Ver Fonte

Merge upstream dev through d9c28f51 and retain local navigation fixes

Integrate de497a3f..d9c28f51 (12 commits). Track five Moon Sea island
markers in the original column, prefer a visible store after activation,
and keep bounded entry and click intervals. Count successful AreaBoss
fights and skip already defeated reward bosses. Reuse the bounded map
return on both skips and battles. Adopt the narrower WantedQuests
OCR retry and remove stray characters upstream that prevented imports.
Update the SwitchAccount server-selection OCR region.

Retain the existing single soul overflow click and metadata, which already
match upstream's coordinates. Keep ActivityShikigami boss rules matching
the local cropped PNGs and JSON. Costume/SwitchSoul regeneration adds no
new behavior. Preserve local mail, realm, exploration, dialog, and battle
strategy fixes. Keep the bounded random-entry helper for compatibility.

Adopt gh-aw v1.0.1 and review-role restrictions. Retain the fork's existing
dev-to-master workflow schedules. The additional upstream Monday master
promotion is outside this dev-only sync.

515 pytest tests passed (tests/ and both FrogBoss suites). Checked nine
Python files, six production imports, three JSON files, ten workflow YAMLs,
seven PNG/rule/metadata sets and 28 synthetic matching cases. Verified the
single overflow target, SwitchAccount OCR and git diff --check. No emulator
or hosted workflow run.
unknown há 1 semana atrás
pai
commit
3969a93ab2
31 ficheiros alterados com 441 adições e 150 exclusões
  1. 54 14
      .github/agents/agentic-workflows.md
  2. 6 6
      .github/aw/actions-lock.json
  3. 45 4
      .github/skills/agentic-workflows/SKILL.md
  4. 58 50
      .github/workflows/agentics-maintenance.yml
  5. 5 3
      .github/workflows/copilot-setup-steps.yml
  6. 0 1
      .github/workflows/issue-handle-bug.lock.yml
  7. 0 1
      .github/workflows/issue-handle-enhancement.lock.yml
  8. 0 1
      .github/workflows/issue-handle-other.lock.yml
  9. 0 1
      .github/workflows/issue-handle-question.lock.yml
  10. 0 1
      .github/workflows/issue-triage.lock.yml
  11. 0 1
      .github/workflows/pr-review-checklist.lock.yml
  12. 4 1
      .github/workflows/pr-review-checklist.md
  13. 0 1
      .github/workflows/pr-review-intent.lock.yml
  14. 4 1
      .github/workflows/pr-review-intent.md
  15. 0 1
      .github/workflows/weekly-report.lock.yml
  16. 45 33
      tasks/AreaBoss/script_task.py
  17. 1 1
      tasks/Component/SwitchAccount/assets.py
  18. 2 2
      tasks/Component/SwitchAccount/ocr.json
  19. 10 0
      tasks/SixRealms/assets.py
  20. BIN
      tasks/SixRealms/gate1/gate1_island_marker_101.png
  21. BIN
      tasks/SixRealms/gate1/gate1_island_marker_102.png
  22. BIN
      tasks/SixRealms/gate1/gate1_island_marker_103.png
  23. BIN
      tasks/SixRealms/gate1/gate1_island_marker_104.png
  24. BIN
      tasks/SixRealms/gate1/gate1_island_marker_105.png
  25. 45 0
      tasks/SixRealms/gate1/image.json
  26. 59 15
      tasks/SixRealms/moon_sea/map.py
  27. 1 6
      tasks/SixRealms/moon_sea/moon_sea.py
  28. 16 5
      tasks/WantedQuests/script_task.py
  29. 21 0
      tests/tasks/AreaBoss/test_area_battle.py
  30. 26 0
      tests/tasks/WantedQuests/test_location_info.py
  31. 39 1
      tests/test_six_realms_island_entry.py

+ 54 - 14
.github/agents/agentic-workflows.md

@@ -8,10 +8,20 @@ disable-model-invocation: true
 
 
 This agent helps you work with **GitHub Agentic Workflows (gh-aw)**, a CLI extension for creating AI-powered workflows in natural language using markdown files.
 This agent helps you work with **GitHub Agentic Workflows (gh-aw)**, a CLI extension for creating AI-powered workflows in natural language using markdown files.
 
 
+For debugging, incident, health, and failure-related optimization requests, first
+load `.github/aw/debug-bootstrap.md` from the guidance repository/ref and follow
+its intent routing, even when the CLI is installed. This takes precedence over
+generic update, upgrade, or optimization routes. Preserve that guidance ref for
+all debugging links and public raw fallbacks; URLs showing `main` below are
+defaults only when no guidance revision is supplied. Reuse already-loaded guides.
+The intent index is `.github/aw/debug-scenarios.md`; load only the selected
+specialized route, not every debugging reference.
+
 ## Repository Instructions Overlay
 ## Repository Instructions Overlay
 
 
-If `.github/aw/instructions.md` exists, load it with:
-@.github/aw/instructions.md
+Load the target repository's `.github/aw/instructions.md`, if present.
+Use `@.github/aw/instructions.md` only in a matching checkout; do not substitute
+a guidance-repository overlay.
 
 
 Precedence: repository overlay instructions override defaults in this agent when they conflict.
 Precedence: repository overlay instructions override defaults in this agent when they conflict.
 
 
@@ -21,7 +31,8 @@ This is a **dispatcher agent** that routes your request to the appropriate speci
 
 
 - **Creating new workflows**: Routes to `create` prompt
 - **Creating new workflows**: Routes to `create` prompt
 - **Updating existing workflows**: Routes to `update` prompt
 - **Updating existing workflows**: Routes to `update` prompt
-- **Debugging workflows**: Routes to `debug` prompt
+- **Diagnosis, patching, and active debugging**: Routes to `debug-agentic-workflow` for the local-first strategy, evidence triage and live gates
+- **Repository-wide debugging or run analysis**: Routes to `analyzing-runs` for existing-run failure clustering before selecting a workflow; supplied run/failure scope takes precedence
 - **Upgrading workflows**: Routes to `upgrade-agentic-workflows` prompt
 - **Upgrading workflows**: Routes to `upgrade-agentic-workflows` prompt
 - **Creating report-generating workflows**: Routes to `report` prompt — consult this whenever the workflow posts status updates, audits, analyses, or any structured output as issues, discussions, or comments
 - **Creating report-generating workflows**: Routes to `report` prompt — consult this whenever the workflow posts status updates, audits, analyses, or any structured output as issues, discussions, or comments
 - **Creating shared components**: Routes to `create-shared-agentic-workflow` prompt
 - **Creating shared components**: Routes to `create-shared-agentic-workflow` prompt
@@ -31,6 +42,7 @@ This is a **dispatcher agent** that routes your request to the appropriate speci
 - **CLI commands and triggering workflows**: Routes to `cli-commands` guide — consult this whenever the user asks how to run, compile, debug, or manage workflows from the command line, or when they need the MCP tool equivalent of a `gh aw` command
 - **CLI commands and triggering workflows**: Routes to `cli-commands` guide — consult this whenever the user asks how to run, compile, debug, or manage workflows from the command line, or when they need the MCP tool equivalent of a `gh aw` command
 - **Reducing token consumption / cost optimization**: Routes to `token-optimization` guide — consult this whenever the user asks how to reduce token usage, lower costs, speed up workflows, or measure the impact of prompt changes with experiments
 - **Reducing token consumption / cost optimization**: Routes to `token-optimization` guide — consult this whenever the user asks how to reduce token usage, lower costs, speed up workflows, or measure the impact of prompt changes with experiments
 - **Choosing workflow architectures and design patterns**: Routes to `patterns` guide — consult this whenever the user asks for strategy, architecture, operating models, or pattern selection for agentic workflows
 - **Choosing workflow architectures and design patterns**: Routes to `patterns` guide — consult this whenever the user asks for strategy, architecture, operating models, or pattern selection for agentic workflows
+- **Git-backed work queues**: Routes to `work-queue` instructions for producers, dispatchers, workers, observers, deployment and recovery
 
 
 Workflows may optionally include:
 Workflows may optionally include:
 
 
@@ -47,7 +59,8 @@ Workflows may optionally include:
 ## Problems This Solves
 ## Problems This Solves
 
 
 - **Workflow Creation**: Design secure, validated agentic workflows with proper triggers, tools, and permissions
 - **Workflow Creation**: Design secure, validated agentic workflows with proper triggers, tools, and permissions
-- **Workflow Debugging**: Analyze logs, identify missing tools, investigate failures, and fix configuration issues
+- **Diagnosis and Patching**: Analyze evidence and produce regression-backed fixes without requiring live runs
+- **Active Debugging**: Run bounded edit/test/run/audit loops where permitted, stopping on dispatch 403 responses
 - **Version Upgrades**: Migrate workflows to new gh-aw versions, apply codemods, fix breaking changes
 - **Version Upgrades**: Migrate workflows to new gh-aw versions, apply codemods, fix breaking changes
 - **Component Design**: Create reusable shared workflow components that wrap MCP servers
 - **Component Design**: Create reusable shared workflow components that wrap MCP servers
 
 
@@ -61,7 +74,9 @@ When you interact with this agent, it will:
 
 
 ## Available Prompts
 ## Available Prompts
 
 
-> **Note**: The prompt and reference files listed below are located in the [`github/gh-aw`](https://github.com/github/gh-aw) repository and are **not available locally** in this repository. Load them from their public URLs.
+> **Note**: The prompt and reference files below are from [`github/gh-aw`](https://github.com/github/gh-aw). Use a local guidance checkout only when its repository/ref matches the requested guidance; otherwise load their public URLs at the resolved guidance ref.
+
+If GitHub API, `gh api`, or GitHub MCP downloads return HTTP 403 (including a token SAML-authorized for a different organization), do not retry with the same token. Fetch the public file without authentication from `https://raw.githubusercontent.com/github/gh-aw/main/<path>` instead, preserving its repository-relative path (including `.github/`). For example: `curl --fail --silent --show-error --location 'https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/create-agentic-workflow.md'`. Use the same fallback for referenced instructions and `SKILL.md` files; never send an Authorization header or token to the raw URL. If the public download fails, report that error rather than proceeding without the required instructions. This fallback is for public `github/gh-aw` content only, not private or enterprise repositories.
 
 
 ### Create New Workflow
 ### Create New Workflow
 **Load when**: User wants to create a new workflow from scratch, add automation, or design a workflow that doesn't exist yet
 **Load when**: User wants to create a new workflow from scratch, add automation, or design a workflow that doesn't exist yet
@@ -83,16 +98,32 @@ When you interact with this agent, it will:
 - "Update the PR reviewer to use discussions instead of issues"
 - "Update the PR reviewer to use discussions instead of issues"
 - "Improve the prompt for the weekly-research workflow"
 - "Improve the prompt for the weekly-research workflow"
 
 
-### Debug Workflow
+### Diagnose, Patch, or Debug a Workflow
 **Load when**: User needs to investigate, audit, debug, or understand a workflow, troubleshoot issues, analyze logs, or fix errors
 **Load when**: User needs to investigate, audit, debug, or understand a workflow, troubleshoot issues, analyze logs, or fix errors
 
 
 **Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/debug-agentic-workflow.md`
 **Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/debug-agentic-workflow.md`
 
 
+The shared strategy distinguishes diagnosis/patching from permitted active debug
+loops using explicit live gates and includes existing-run evidence triage.
+For CLI setup or run-URL scoping in a fresh session, first load
+`https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/debug-bootstrap.md`; it bootstraps
+this same strategy rather than a separate debug procedure.
+
 **Use cases**:
 **Use cases**:
 - "Why is this workflow failing?"
 - "Why is this workflow failing?"
 - "Analyze the logs for workflow X"
 - "Analyze the logs for workflow X"
 - "Investigate missing tool calls in run #12345"
 - "Investigate missing tool calls in run #12345"
 
 
+### Analyze Existing Runs or Repository-Wide Failures
+**Load when**: User asks to debug or optimize agentic workflows generally, without a specific run/failure scope
+
+**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/analyzing-runs.md`
+
+Start with repository-wide existing-run failure clustering, not an arbitrary
+workflow or a request to pick one. Supplied workflow/run/failure scope takes
+precedence. Use the shared debugging strategy for subsequent fixes; never
+dispatch workflows to obtain evidence.
+
 ### Upgrade Agentic Workflows
 ### Upgrade Agentic Workflows
 **Load when**: User wants to upgrade workflows to a new gh-aw version or fix deprecations
 **Load when**: User wants to upgrade workflows to a new gh-aw version or fix deprecations
 
 
@@ -180,6 +211,15 @@ When you interact with this agent, it will:
 
 
 ## Instructions
 ## Instructions
 
 
+### Work Queue
+
+For queue design, deployment, inspection or recovery, load
+`https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/work-queue.md`.
+Also load it after the primary create/update/debug/upgrade prompt whenever a
+workflow uses `tools.work-queue`. Load linked developer docs and specifications
+only when needed; do not substitute lightweight WorkQueueOps backlog guidance
+for the Git-backed protocol.
+
 When a user interacts with you:
 When a user interacts with you:
 
 
 1. **Identify the task type** from the user's request
 1. **Identify the task type** from the user's request
@@ -196,13 +236,13 @@ gh aw init
 # Generate the lock file for a workflow
 # Generate the lock file for a workflow
 gh aw compile [workflow-name]
 gh aw compile [workflow-name]
 
 
-# Trigger a workflow on demand (preferred over gh workflow run)
-gh aw run <workflow-name>             # interactive input collection
-gh aw run <workflow-name> --ref main  # run on a specific branch
+# Only where permitted and human-validated under debug-agentic-workflow.md:
+gh aw run <workflow-name> --ref REVIEWED_REF
 
 
 # Debug workflow runs
 # Debug workflow runs
-gh aw logs [workflow-name]
-gh aw audit <run-id>
+gh aw logs [workflow-name] --repo HOST/OWNER/REPO
+gh aw audit <run-url>  # preserve host/repository and any job/step scope
+gh aw compile <workflow-name> --dry-run  # first test of workflow changes
 
 
 # Upgrade workflows
 # Upgrade workflows
 gh aw fix --write
 gh aw fix --write
@@ -222,12 +262,12 @@ gh aw compile --validate
 
 
 ## Important Notes
 ## Important Notes
 
 
-- Always reference the instructions file at `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/github-agentic-workflows.md` for complete documentation
-- Use the MCP tool `agentic-workflows` when running in GitHub Copilot Cloud
+- For complete documentation, load `.github/aw/github-agentic-workflows.md` from the resolved guidance repository/ref.
+- Use gh-aw MCP tools only when exposed and authorized; otherwise use available CLI, cached evidence or static source through the CLI/MCP reference.
 - Workflows must be compiled to `.lock.yml` files before running in GitHub Actions
 - Workflows must be compiled to `.lock.yml` files before running in GitHub Actions
 - **Bash tools are enabled by default** - Don't restrict bash commands unnecessarily since workflows are sandboxed by the AWF
 - **Bash tools are enabled by default** - Don't restrict bash commands unnecessarily since workflows are sandboxed by the AWF
 - Follow security best practices: minimal permissions, explicit network access, no template injection
 - Follow security best practices: minimal permissions, explicit network access, no template injection
 - **Network configuration**: Use ecosystem identifiers (`node`, `python`, `go`, etc.) or explicit FQDNs in `network.allowed`. Bare shorthands like `npm` or `pypi` are **not** valid. See `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/network.md` for the full list of valid ecosystem identifiers and domain patterns.
 - **Network configuration**: Use ecosystem identifiers (`node`, `python`, `go`, etc.) or explicit FQDNs in `network.allowed`. Bare shorthands like `npm` or `pypi` are **not** valid. See `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/network.md` for the full list of valid ecosystem identifiers and domain patterns.
 - **Single-file output**: When creating a workflow, produce exactly **one** workflow `.md` file. Do not create separate documentation files (architecture docs, runbooks, usage guides, etc.). If documentation is needed, add a brief `## Usage` section inside the workflow file itself.
 - **Single-file output**: When creating a workflow, produce exactly **one** workflow `.md` file. Do not create separate documentation files (architecture docs, runbooks, usage guides, etc.). If documentation is needed, add a brief `## Usage` section inside the workflow file itself.
-- **Triggering runs**: Always use `gh aw run <workflow-name>` to trigger a workflow on demand — not `gh workflow run <file>.lock.yml`. `gh aw run` handles workflow resolution by short name, input parsing and validation, and correct run-tracking for agentic workflows. Use `--ref <branch>` to run on a specific branch.
+- **Triggering runs**: Only where permitted and human-validated under `debug-agentic-workflow.md`, prefer `gh aw run <workflow-name>` over `gh workflow run <file>.lock.yml` for workflow resolution, input validation and run-tracking. Use the reviewed remote ref; explicit no-dispatch rules override user requests.
 - **CLI commands reference**: For a complete guide on all `gh aw` commands and their MCP tool equivalents (for restricted environments), see `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/cli-commands.md`
 - **CLI commands reference**: For a complete guide on all `gh aw` commands and their MCP tool equivalents (for restricted environments), see `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/cli-commands.md`

+ 6 - 6
.github/aw/actions-lock.json

@@ -1,14 +1,14 @@
 {
 {
   "entries": {
   "entries": {
-    "github/gh-aw-actions/setup-cli@v0.89.21": {
+    "github/gh-aw-actions/setup-cli@v1.0.1": {
       "repo": "github/gh-aw-actions/setup-cli",
       "repo": "github/gh-aw-actions/setup-cli",
-      "version": "v0.89.21",
-      "sha": "924af5fdc64061cfbf66fb584c8b07e2ac230c60"
+      "version": "v1.0.1",
+      "sha": "221ba4f4319de6b8e809d1a15528b3ae6a818aa5"
     },
     },
-    "github/gh-aw-actions/setup@v0.89.21": {
+    "github/gh-aw-actions/setup@v1.0.1": {
       "repo": "github/gh-aw-actions/setup",
       "repo": "github/gh-aw-actions/setup",
-      "version": "v0.89.21",
-      "sha": "924af5fdc64061cfbf66fb584c8b07e2ac230c60"
+      "version": "v1.0.1",
+      "sha": "221ba4f4319de6b8e809d1a15528b3ae6a818aa5"
     }
     }
   }
   }
 }
 }

+ 45 - 4
.github/skills/agentic-workflows/SKILL.md

@@ -1,6 +1,6 @@
 ---
 ---
 name: agentic-workflows
 name: agentic-workflows
-description: Route gh-aw workflow design/create/debug/upgrade requests to the right prompts.
+description: Route gh-aw design, creation, diagnosis, patching, active debugging, and upgrade requests to the right strategies.
 ---
 ---
 
 
 # Agentic Workflows Router
 # Agentic Workflows Router
@@ -9,41 +9,71 @@ Use this skill when a user asks to design, create, update, debug, or upgrade Git
 
 
 This skill is a dispatcher: identify the task type, load the matching workflow prompt/skill file, and follow it directly. Keep responses concise and ask a clarifying question if the correct prompt is unclear.
 This skill is a dispatcher: identify the task type, load the matching workflow prompt/skill file, and follow it directly. Keep responses concise and ask a clarifying question if the correct prompt is unclear.
 
 
+For debugging sessions needing CLI setup or run-URL scoping, first load
+`https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/debug-bootstrap.md`; it bootstraps
+the same shared strategy used by the debugging routes below.
+
+Debugging, incident, health, and failure-related optimization requests use the
+bootstrap's intent routing before generic update, upgrade, or optimization routes,
+even when the CLI is installed. Preserve the supplied guidance repository/ref
+for all debugging links and public raw fallbacks; URLs showing `main` below are
+defaults only when no guidance revision is supplied. Reuse already-loaded guides.
+The intent index is `.github/aw/debug-scenarios.md`; load only the selected
+specialized route, not every debugging reference.
+
 Repository overlay (optional):
 Repository overlay (optional):
-- If `.github/aw/instructions.md` exists, load it with `@.github/aw/instructions.md` after loading the matched prompt/skill.
+- Load the target repository's `.github/aw/instructions.md`, if present, after the matched prompt/skill. Use `@.github/aw/instructions.md` only in a matching checkout; do not substitute a guidance-repository overlay.
 - Precedence: repository overlay instructions override upstream defaults when they conflict.
 - Precedence: repository overlay instructions override upstream defaults when they conflict.
 
 
 Read only the files you need:
 Read only the files you need:
-Load these files from `github/gh-aw` (they are not available locally).
+Use a local guidance checkout only when its repository/ref matches the requested guidance; otherwise use the resolved guidance repository/ref (default `github/gh-aw`).
+If GitHub API, `gh api`, or GitHub MCP downloads return HTTP 403 (including a token SAML-authorized for a different organization), do not retry with the same token. Fetch the public file without authentication from `https://raw.githubusercontent.com/github/gh-aw/main/<path>` instead, preserving its repository-relative path (including `.github/`). For example: `curl --fail --silent --show-error --location 'https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/create-agentic-workflow.md'`. Use the same fallback for referenced instructions and `SKILL.md` files; never send an Authorization header or token to the raw URL. If the public download fails, report that error rather than proceeding without the required instructions. This fallback is for public `github/gh-aw` content only, not private or enterprise repositories.
 - `.github/aw/action-container-substitutions.md`
 - `.github/aw/action-container-substitutions.md`
 - `.github/aw/agent-runtime-instructions.md`
 - `.github/aw/agent-runtime-instructions.md`
 - `.github/aw/agentic-chat.md`
 - `.github/aw/agentic-chat.md`
 - `.github/aw/agentic-workflows-mcp.md`
 - `.github/aw/agentic-workflows-mcp.md`
+- `.github/aw/analyzing-runs.md`
 - `.github/aw/asciicharts.md`
 - `.github/aw/asciicharts.md`
 - `.github/aw/campaign.md`
 - `.github/aw/campaign.md`
 - `.github/aw/charts-trending.md`
 - `.github/aw/charts-trending.md`
 - `.github/aw/charts.md`
 - `.github/aw/charts.md`
 - `.github/aw/cli-commands.md`
 - `.github/aw/cli-commands.md`
+- `.github/aw/compat.md`
 - `.github/aw/configure-agentic-engine.md`
 - `.github/aw/configure-agentic-engine.md`
 - `.github/aw/context.md`
 - `.github/aw/context.md`
 - `.github/aw/create-agentic-workflow-trigger-details.md`
 - `.github/aw/create-agentic-workflow-trigger-details.md`
 - `.github/aw/create-agentic-workflow.md`
 - `.github/aw/create-agentic-workflow.md`
 - `.github/aw/create-shared-agentic-workflow.md`
 - `.github/aw/create-shared-agentic-workflow.md`
 - `.github/aw/debug-agentic-workflow.md`
 - `.github/aw/debug-agentic-workflow.md`
+- `.github/aw/debug-bootstrap.md`
+- `.github/aw/debug-compilation.md`
+- `.github/aw/debug-live-testing.md`
+- `.github/aw/debug-model-engine-misconfiguration.md`
+- `.github/aw/debug-playbook.md`
+- `.github/aw/debug-scenarios.md`
+- `.github/aw/debug-security-review.md`
+- `.github/aw/debug-workflow-evidence.md`
+- `.github/aw/debug-workflow-health.md`
 - `.github/aw/dependabot.md`
 - `.github/aw/dependabot.md`
 - `.github/aw/deployment-status.md`
 - `.github/aw/deployment-status.md`
 - `.github/aw/designer-mappings.md`
 - `.github/aw/designer-mappings.md`
 - `.github/aw/designer.md`
 - `.github/aw/designer.md`
+- `.github/aw/doctor.md`
+- `.github/aw/documentation-workflows.md`
 - `.github/aw/drive-memory.md`
 - `.github/aw/drive-memory.md`
 - `.github/aw/enclaves.md`
 - `.github/aw/enclaves.md`
 - `.github/aw/evals.md`
 - `.github/aw/evals.md`
 - `.github/aw/experiments.md`
 - `.github/aw/experiments.md`
+- `.github/aw/formal-methods.md`
 - `.github/aw/github-agentic-workflows.md`
 - `.github/aw/github-agentic-workflows.md`
 - `.github/aw/github-mcp-server-pagination.md`
 - `.github/aw/github-mcp-server-pagination.md`
 - `.github/aw/github-mcp-server-tools.md`
 - `.github/aw/github-mcp-server-tools.md`
 - `.github/aw/github-mcp-server.md`
 - `.github/aw/github-mcp-server.md`
+- `.github/aw/harbor.md`
 - `.github/aw/instructions.md`
 - `.github/aw/instructions.md`
+- `.github/aw/intent.md`
 - `.github/aw/jobs.md`
 - `.github/aw/jobs.md`
+- `.github/aw/ledger.md`
 - `.github/aw/linter-workflows.md`
 - `.github/aw/linter-workflows.md`
 - `.github/aw/llms.md`
 - `.github/aw/llms.md`
 - `.github/aw/loop.md`
 - `.github/aw/loop.md`
@@ -56,7 +86,9 @@ Load these files from `github/gh-aw` (they are not available locally).
 - `.github/aw/multi-agent-research.md`
 - `.github/aw/multi-agent-research.md`
 - `.github/aw/network.md`
 - `.github/aw/network.md`
 - `.github/aw/optimize-agentic-workflow.md`
 - `.github/aw/optimize-agentic-workflow.md`
+- `.github/aw/otel.md`
 - `.github/aw/patterns.md`
 - `.github/aw/patterns.md`
+- `.github/aw/playwright.md`
 - `.github/aw/pr-reviewer.md`
 - `.github/aw/pr-reviewer.md`
 - `.github/aw/release-workflow.md`
 - `.github/aw/release-workflow.md`
 - `.github/aw/report.md`
 - `.github/aw/report.md`
@@ -71,6 +103,7 @@ Load these files from `github/gh-aw` (they are not available locally).
 - `.github/aw/skills.md`
 - `.github/aw/skills.md`
 - `.github/aw/subagents.md`
 - `.github/aw/subagents.md`
 - `.github/aw/syntax-agentic.md`
 - `.github/aw/syntax-agentic.md`
+- `.github/aw/syntax-checkout.md`
 - `.github/aw/syntax-core.md`
 - `.github/aw/syntax-core.md`
 - `.github/aw/syntax-engine.md`
 - `.github/aw/syntax-engine.md`
 - `.github/aw/syntax-tools-imports.md`
 - `.github/aw/syntax-tools-imports.md`
@@ -84,6 +117,7 @@ Load these files from `github/gh-aw` (they are not available locally).
 - `.github/aw/update-agentic-workflow.md`
 - `.github/aw/update-agentic-workflow.md`
 - `.github/aw/upgrade-agentic-workflows.md`
 - `.github/aw/upgrade-agentic-workflows.md`
 - `.github/aw/visual-regression.md`
 - `.github/aw/visual-regression.md`
+- `.github/aw/work-queue.md`
 - `.github/aw/workflow-constraints.md`
 - `.github/aw/workflow-constraints.md`
 - `.github/aw/workflow-editing.md`
 - `.github/aw/workflow-editing.md`
 - `.github/aw/workflow-patterns.md`
 - `.github/aw/workflow-patterns.md`
@@ -93,7 +127,9 @@ After loading the matching workflow prompt or skill, follow it directly:
 - Create new workflows: `.github/aw/create-agentic-workflow.md`
 - Create new workflows: `.github/aw/create-agentic-workflow.md`
 - Configure or add declarative engines: `.github/aw/configure-agentic-engine.md`
 - Configure or add declarative engines: `.github/aw/configure-agentic-engine.md`
 - Update existing workflows: `.github/aw/update-agentic-workflow.md`
 - Update existing workflows: `.github/aw/update-agentic-workflow.md`
-- Debug, audit, or investigate workflows: `.github/aw/debug-agentic-workflow.md`
+- Diagnose, patch, audit, or actively debug workflows: `.github/aw/debug-agentic-workflow.md` (local-first strategy, evidence triage and live gates)
+- Analyze existing runs, logs, or recurring failures: `.github/aw/analyzing-runs.md`. General repository-wide debugging or optimization requests start here with failure clustering before selecting a workflow.
+- AWF model/endpoint 400s, silent cross-family sub-agent failures, `model: auto` failures, install-step 404s after a version pin, or questions about version fields: go directly to `.github/aw/debug-agentic-workflow.md#model-and-engine-misconfiguration` before suggesting model changes.
 - Upgrade workflows and fix deprecations: `.github/aw/upgrade-agentic-workflows.md`
 - Upgrade workflows and fix deprecations: `.github/aw/upgrade-agentic-workflows.md`
 - Create shared components or MCP wrappers: `.github/aw/create-shared-agentic-workflow.md`
 - Create shared components or MCP wrappers: `.github/aw/create-shared-agentic-workflow.md`
 - Create report-generating workflows: `.github/aw/report.md`
 - Create report-generating workflows: `.github/aw/report.md`
@@ -102,7 +138,12 @@ After loading the matching workflow prompt or skill, follow it directly:
 - Render compact markdown charts: `.github/aw/asciicharts.md`
 - Render compact markdown charts: `.github/aw/asciicharts.md`
 - Map CLI commands to MCP usage: `.github/aw/cli-commands.md`
 - Map CLI commands to MCP usage: `.github/aw/cli-commands.md`
 - Choose workflow architecture and patterns: `.github/aw/patterns.md`
 - Choose workflow architecture and patterns: `.github/aw/patterns.md`
+- Design, deploy, inspect or recover a Git-backed work queue: `.github/aw/work-queue.md`
 - Optimize token usage and cost: `.github/aw/token-optimization.md`
 - Optimize token usage and cost: `.github/aw/token-optimization.md`
+- Advanced cost controls without native settings (custom AIC allowances by server size or shared organization budget policies): read `docs/src/content/docs/reference/cost-management.md#configure-advanced-cost-controls-with-admission` ([published guidance](https://github.github.com/gh-aw/reference/cost-management/#configure-advanced-cost-controls-with-admission)). Explain the external authority requirement and cooperative limits; do not invent frontmatter fields or promise hard caps, reservations, or mid-run cancellation.
 - Design long-running multi-agent research workflows: `.github/aw/multi-agent-research.md`
 - Design long-running multi-agent research workflows: `.github/aw/multi-agent-research.md`
+- Add skills or agent plugins requested by the user (`skills:` / `plugins:` frontmatter, never on-the-fly installs): `.github/aw/skills.md`
 
 
 When the task involves OTEL, OTLP, traces, observability backends, or telemetry-driven analysis, also read and follow `skills/otel-queries/SKILL.md` after loading the matching workflow prompt or skill.
 When the task involves OTEL, OTLP, traces, observability backends, or telemetry-driven analysis, also read and follow `skills/otel-queries/SKILL.md` after loading the matching workflow prompt or skill.
+
+When creating, updating, diagnosing or upgrading a workflow that uses `tools.work-queue`, also load `.github/aw/work-queue.md` after the primary prompt. Load deployment docs, operator reference or specification only when that task needs them.

+ 58 - 50
.github/workflows/agentics-maintenance.yml

@@ -1,4 +1,4 @@
-# This file was automatically generated by pkg/workflow/maintenance_workflow.go (v0.89.21). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
+# This file was automatically generated by pkg/workflow/maintenance_workflow.go (v1.0.1). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
 #
 #
 #    ___                   _   _
 #    ___                   _   _
 #   / _ \                 | | (_)
 #   / _ \                 | | (_)
@@ -24,8 +24,10 @@
 # This file defines the generated agentic maintenance workflow for this repository.
 # This file defines the generated agentic maintenance workflow for this repository.
 # It runs scheduled cleanup for expiring safe outputs and supports manual maintenance operations.
 # It runs scheduled cleanup for expiring safe outputs and supports manual maintenance operations.
 #
 #
-# This workflow is generated automatically when workflows use expiring safe outputs
-# or when repository maintenance features are enabled in .github/workflows/aw.json.
+# This workflow is generated automatically when workflows use expiring safe outputs,
+# when workflows enable steering (safe-outputs.steer), declare compaction-enabled
+# ledgers (tools.ledger) or work queues, or when repository maintenance features are
+# enabled in .github/workflows/aw.json.
 #
 #
 # To disable maintenance workflow generation, set in .github/workflows/aw.json:
 # To disable maintenance workflow generation, set in .github/workflows/aw.json:
 # {"maintenance": false}
 # {"maintenance": false}
@@ -55,7 +57,6 @@ on:
           - 'create_labels'
           - 'create_labels'
           - 'activity_report'
           - 'activity_report'
           - 'close_agentic_workflows_issues'
           - 'close_agentic_workflows_issues'
-          - 'clean_cache_memories'
           - 'update_pull_request_branches'
           - 'update_pull_request_branches'
           - 'validate'
           - 'validate'
           - 'forecast'
           - 'forecast'
@@ -67,7 +68,7 @@ on:
   workflow_call:
   workflow_call:
     inputs:
     inputs:
       operation:
       operation:
-        description: 'Optional maintenance operation to run (disable, enable, update, upgrade, safe_outputs, create_labels, activity_report, close_agentic_workflows_issues, clean_cache_memories, update_pull_request_branches, validate, forecast)'
+        description: 'Optional maintenance operation to run (disable, enable, update, upgrade, safe_outputs, create_labels, activity_report, close_agentic_workflows_issues, update_pull_request_branches, validate, forecast)'
         required: false
         required: false
         type: string
         type: string
         default: ''
         default: ''
@@ -79,22 +80,30 @@ on:
     outputs:
     outputs:
       operation_completed:
       operation_completed:
         description: 'The maintenance operation that was completed (empty when none ran or a scheduled job ran)'
         description: 'The maintenance operation that was completed (empty when none ran or a scheduled job ran)'
-        value: ${{ jobs.run_operation.outputs.operation || inputs.operation }}
+        value: ${{ jobs.run_operation.outputs.operation || (inputs.operation == 'safe_outputs' || inputs.operation == 'create_labels' || inputs.operation == 'activity_report' || inputs.operation == 'close_agentic_workflows_issues' || inputs.operation == 'update_pull_request_branches' || inputs.operation == 'validate' || inputs.operation == 'forecast') && inputs.operation || '' }}
       applied_run_url:
       applied_run_url:
         description: 'The run URL that safe outputs were applied from'
         description: 'The run URL that safe outputs were applied from'
         value: ${{ jobs.apply_safe_outputs.outputs.run_url }}
         value: ${{ jobs.apply_safe_outputs.outputs.run_url }}
 
 
+# Jobs request only the permissions needed for their individual maintenance operations.
 permissions: {}
 permissions: {}
 
 
+# Serialize maintenance runs to avoid overlapping writes to repository resources.
+concurrency:
+  group: ${{ github.workflow }}-${{ github.repository }}
+  cancel-in-progress: false
+
 jobs:
 jobs:
   close-expired-discussions:
   close-expired-discussions:
+    name: Close expired discussions
     if: ${{ (!(github.event.repository.fork)) && github.event_name != 'push' && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'none') }}
     if: ${{ (!(github.event.repository.fork)) && github.event_name != 'push' && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'none') }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
+    # Closing expired resources requires write access to this resource type only.
     permissions:
     permissions:
       discussions: write
       discussions: write
     steps:
     steps:
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -109,13 +118,15 @@ jobs:
             const { main } = require(path.join(actionsDir, 'close_expired_discussions.cjs'));
             const { main } = require(path.join(actionsDir, 'close_expired_discussions.cjs'));
             await main();
             await main();
   close-expired-issues:
   close-expired-issues:
+    name: Close expired issues
     if: ${{ (!(github.event.repository.fork)) && github.event_name != 'push' && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'none') }}
     if: ${{ (!(github.event.repository.fork)) && github.event_name != 'push' && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'none') }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
+    # Closing expired resources requires write access to this resource type only.
     permissions:
     permissions:
       issues: write
       issues: write
     steps:
     steps:
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -130,13 +141,15 @@ jobs:
             const { main } = require(path.join(actionsDir, 'close_expired_issues.cjs'));
             const { main } = require(path.join(actionsDir, 'close_expired_issues.cjs'));
             await main();
             await main();
   close-expired-pull-requests:
   close-expired-pull-requests:
+    name: Close expired pull requests
     if: ${{ (!(github.event.repository.fork)) && github.event_name != 'push' && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'none') }}
     if: ${{ (!(github.event.repository.fork)) && github.event_name != 'push' && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'none') }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
+    # Closing expired resources requires write access to this resource type only.
     permissions:
     permissions:
       pull-requests: write
       pull-requests: write
     steps:
     steps:
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -151,31 +164,11 @@ jobs:
             const { main } = require(path.join(actionsDir, 'close_expired_pull_requests.cjs'));
             const { main } = require(path.join(actionsDir, 'close_expired_pull_requests.cjs'));
             await main();
             await main();
 
 
-  cleanup-cache-memory:
-    if: ${{ (!(github.event.repository.fork)) && github.event_name != 'push' && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'none' || inputs.operation == 'clean_cache_memories') }}
-    runs-on: ubuntu-slim
-    permissions:
-      actions: write
-    steps:
-      - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
-        with:
-          destination: ${{ runner.temp }}/gh-aw/actions
-
-      - name: Cleanup outdated cache-memory entries
-        uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
-        with:
-          script: |
-            const path = require('path');
-            const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
-            const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
-            setupGlobals(core, github, context, exec, io, getOctokit);
-            const { main } = require(path.join(actionsDir, 'cleanup_cache_memory.cjs'));
-            await main();
-
   run_operation:
   run_operation:
+    name: Run maintenance operation
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation != '' && inputs.operation != 'none' && inputs.operation != 'safe_outputs' && inputs.operation != 'create_labels' && inputs.operation != 'activity_report' && inputs.operation != 'close_agentic_workflows_issues' && inputs.operation != 'clean_cache_memories' && inputs.operation != 'update_pull_request_branches' && inputs.operation != 'validate' && inputs.operation != 'forecast' && (!(github.event.repository.fork)) }}
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation != '' && inputs.operation != 'none' && inputs.operation != 'safe_outputs' && inputs.operation != 'create_labels' && inputs.operation != 'activity_report' && inputs.operation != 'close_agentic_workflows_issues' && inputs.operation != 'clean_cache_memories' && inputs.operation != 'update_pull_request_branches' && inputs.operation != 'validate' && inputs.operation != 'forecast' && (!(github.event.repository.fork)) }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
+    # Updates, upgrades, and workflow enable/disable operations need repository write access.
     permissions:
     permissions:
       actions: write
       actions: write
       contents: write
       contents: write
@@ -189,7 +182,7 @@ jobs:
           persist-credentials: false
           persist-credentials: false
 
 
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -206,9 +199,9 @@ jobs:
             await main();
             await main();
 
 
       - name: Install gh-aw
       - name: Install gh-aw
-        uses: github/gh-aw-actions/setup-cli@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup-cli@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
-          version: v0.89.21
+          version: v1.0.1
 
 
       - name: Run operation
       - name: Run operation
         uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
         uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
@@ -233,14 +226,16 @@ jobs:
         run: echo "operation=$GH_AW_OPERATION" >> "$GITHUB_OUTPUT"
         run: echo "operation=$GH_AW_OPERATION" >> "$GITHUB_OUTPUT"
 
 
   update_pull_request_branches:
   update_pull_request_branches:
+    name: Update pull request branches
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'update_pull_request_branches' && (!(github.event.repository.fork)) }}
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'update_pull_request_branches' && (!(github.event.repository.fork)) }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
+    # Branch updates may write commits and update pull requests.
     permissions:
     permissions:
       contents: write
       contents: write
       pull-requests: write
       pull-requests: write
     steps:
     steps:
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -271,8 +266,10 @@ jobs:
             await main();
             await main();
 
 
   apply_safe_outputs:
   apply_safe_outputs:
+    name: Apply safe outputs
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'safe_outputs' && (!(github.event.repository.fork)) }}
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'safe_outputs' && (!(github.event.repository.fork)) }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
+    # Replay can create or update any supported safe-output resource.
     permissions:
     permissions:
       actions: read
       actions: read
       contents: write
       contents: write
@@ -291,7 +288,7 @@ jobs:
           persist-credentials: false
           persist-credentials: false
 
 
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -310,6 +307,8 @@ jobs:
       - name: Apply Safe Outputs
       - name: Apply Safe Outputs
         uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
         uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
         env:
         env:
+          GH_AW_JOB_CHECK_RUN_ID: ${{ job.check_run_id }}
+          GH_AW_WORKFLOW_ID: "agentics-maintenance"
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           GH_AW_RUN_URL: ${{ inputs.run_url }}
           GH_AW_RUN_URL: ${{ inputs.run_url }}
         with:
         with:
@@ -329,8 +328,10 @@ jobs:
         run: echo "run_url=$GH_AW_RUN_URL" >> "$GITHUB_OUTPUT"
         run: echo "run_url=$GH_AW_RUN_URL" >> "$GITHUB_OUTPUT"
 
 
   create_labels:
   create_labels:
+    name: Create labels
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'create_labels' && (!(github.event.repository.fork)) }}
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'create_labels' && (!(github.event.repository.fork)) }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
+    # Creating repository labels uses the issues API.
     permissions:
     permissions:
       contents: read
       contents: read
       issues: write
       issues: write
@@ -341,7 +342,7 @@ jobs:
           persist-credentials: false
           persist-credentials: false
 
 
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -358,9 +359,9 @@ jobs:
             await main();
             await main();
 
 
       - name: Install gh-aw
       - name: Install gh-aw
-        uses: github/gh-aw-actions/setup-cli@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup-cli@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
-          version: v0.89.21
+          version: v1.0.1
 
 
       - name: Create missing labels
       - name: Create missing labels
         uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
         uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
@@ -377,9 +378,11 @@ jobs:
             await main();
             await main();
 
 
   activity_report:
   activity_report:
+    name: activity report
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'activity_report' && (!(github.event.repository.fork)) }}
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'activity_report' && (!(github.event.repository.fork)) }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
     timeout-minutes: 120
     timeout-minutes: 120
+    # Read workflow logs and create the resulting report issue.
     permissions:
     permissions:
       actions: read
       actions: read
       contents: read
       contents: read
@@ -391,7 +394,7 @@ jobs:
           persist-credentials: false
           persist-credentials: false
 
 
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -408,9 +411,9 @@ jobs:
             await main();
             await main();
 
 
       - name: Install gh-aw
       - name: Install gh-aw
-        uses: github/gh-aw-actions/setup-cli@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup-cli@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
-          version: v0.89.21
+          version: v1.0.1
 
 
       - name: Restore activity report logs cache
       - name: Restore activity report logs cache
         id: activity_report_logs_cache
         id: activity_report_logs_cache
@@ -484,9 +487,11 @@ jobs:
             core.info('Created issue #' + createdIssue.data.number + ': ' + createdIssue.data.html_url);
             core.info('Created issue #' + createdIssue.data.number + ': ' + createdIssue.data.html_url);
 
 
   forecast_report:
   forecast_report:
+    name: forecast report
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'forecast' && (!(github.event.repository.fork)) }}
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'forecast' && (!(github.event.repository.fork)) }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
     timeout-minutes: 60
     timeout-minutes: 60
+    # Read workflow logs and create the resulting report issue.
     permissions:
     permissions:
       actions: read
       actions: read
       contents: read
       contents: read
@@ -498,7 +503,7 @@ jobs:
           persist-credentials: false
           persist-credentials: false
 
 
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -515,9 +520,9 @@ jobs:
             await main();
             await main();
 
 
       - name: Install gh-aw
       - name: Install gh-aw
-        uses: github/gh-aw-actions/setup-cli@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup-cli@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
-          version: v0.89.21
+          version: v1.0.1
 
 
       - name: Restore forecast report logs cache
       - name: Restore forecast report logs cache
         id: forecast_report_logs_cache
         id: forecast_report_logs_cache
@@ -535,7 +540,6 @@ jobs:
         shell: bash
         shell: bash
         env:
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          DEBUG: "*"
           GH_AW_CMD_PREFIX: gh aw
           GH_AW_CMD_PREFIX: gh aw
         run: |
         run: |
           mkdir -p ./.cache/gh-aw/forecast
           mkdir -p ./.cache/gh-aw/forecast
@@ -588,13 +592,15 @@ jobs:
             await main();
             await main();
 
 
   close_agentic_workflows_issues:
   close_agentic_workflows_issues:
+    name: Close agentic workflows issues
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'close_agentic_workflows_issues' && (!(github.event.repository.fork)) }}
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'close_agentic_workflows_issues' && (!(github.event.repository.fork)) }}
     runs-on: ubuntu-slim
     runs-on: ubuntu-slim
+    # Closing no-repro issues requires issues: write.
     permissions:
     permissions:
       issues: write
       issues: write
     steps:
     steps:
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -623,8 +629,10 @@ jobs:
             await main();
             await main();
 
 
   validate_workflows:
   validate_workflows:
+    name: Validate workflows
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'validate' && (!(github.event.repository.fork)) }}
     if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'validate' && (!(github.event.repository.fork)) }}
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
+    # Read workflow sources and file issues for validation findings.
     permissions:
     permissions:
       contents: read
       contents: read
       issues: write
       issues: write
@@ -635,7 +643,7 @@ jobs:
           persist-credentials: false
           persist-credentials: false
 
 
       - name: Setup Scripts
       - name: Setup Scripts
-        uses: github/gh-aw-actions/setup@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
           destination: ${{ runner.temp }}/gh-aw/actions
           destination: ${{ runner.temp }}/gh-aw/actions
 
 
@@ -652,9 +660,9 @@ jobs:
             await main();
             await main();
 
 
       - name: Install gh-aw
       - name: Install gh-aw
-        uses: github/gh-aw-actions/setup-cli@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
+        uses: github/gh-aw-actions/setup-cli@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
-          version: v0.89.21
+          version: v1.0.1
 
 
       - name: Validate workflows and file issue on findings
       - name: Validate workflows and file issue on findings
         uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
         uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0

+ 5 - 3
.github/workflows/copilot-setup-steps.yml

@@ -19,8 +19,10 @@ jobs:
 
 
     steps:
     steps:
       - name: Checkout repository
       - name: Checkout repository
-        uses: actions/checkout@v6
+        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+        with:
+          persist-credentials: false
       - name: Install gh-aw extension
       - name: Install gh-aw extension
-        uses: github/gh-aw-actions/setup-cli@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
+        uses: github/gh-aw-actions/setup-cli@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
         with:
         with:
-          version: v0.86.2
+          version: v1.0.1

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1
.github/workflows/issue-handle-bug.lock.yml


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1
.github/workflows/issue-handle-enhancement.lock.yml


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1
.github/workflows/issue-handle-other.lock.yml


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1
.github/workflows/issue-handle-question.lock.yml


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1
.github/workflows/issue-triage.lock.yml


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1
.github/workflows/pr-review-checklist.lock.yml


+ 4 - 1
.github/workflows/pr-review-checklist.md

@@ -6,7 +6,10 @@ on:
     types: [opened, reopened]
     types: [opened, reopened]
     branches:
     branches:
       - dev
       - dev
-  roles: all
+  roles:
+    - admin
+    - maintainer
+    - write
 
 
 checkout: false
 checkout: false
 permissions:
 permissions:

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1
.github/workflows/pr-review-intent.lock.yml


+ 4 - 1
.github/workflows/pr-review-intent.md

@@ -6,7 +6,10 @@ on:
     types: [opened, reopened]
     types: [opened, reopened]
     branches:
     branches:
       - dev
       - dev
-  roles: all
+  roles:
+    - admin
+    - maintainer
+    - write
 
 
 checkout: false
 checkout: false
 permissions:
 permissions:

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1
.github/workflows/weekly-report.lock.yml


+ 45 - 33
tasks/AreaBoss/script_task.py

@@ -6,7 +6,6 @@ import time
 import cv2
 import cv2
 import numpy as np
 import numpy as np
 import random
 import random
-import re
 from module.atom.click import RuleClick
 from module.atom.click import RuleClick
 from module.base.timer import Timer
 from module.base.timer import Timer
 from tasks.base_task import BaseTask
 from tasks.base_task import BaseTask
@@ -61,11 +60,9 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
 
 
         self.goto_page(page_area_boss)
         self.goto_page(page_area_boss)
 
 
-        # 已挑战鬼王数量
-        boss_fought = 0
-        if con.boss_reward:
-            if self.fight_reward_boss():  # 挑战成功则加一
-                boss_fought += 1
+        reward_name = self.fight_reward_boss() if con.boss_reward else None
+        defeated = {reward_name} if reward_name else set()
+        boss_fought = len(defeated)
 
 
         self.open_filter()
         self.open_filter()
         # 切换到对应集合(热门/收藏)
         # 切换到对应集合(热门/收藏)
@@ -76,19 +73,16 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
 
 
         # 动态获取可挑战次数
         # 动态获取可挑战次数
         dynamic_count = self._get_dynamic_boss_count()
         dynamic_count = self._get_dynamic_boss_count()
-        available = dynamic_count - boss_fought
-        if available >= 3:
-            self.boss_fight(self.I_BATTLE_1)
-            self.boss_fight(self.I_BATTLE_2)
-            self.boss_fight(self.I_BATTLE_3)
-        elif available == 2:
-            self.boss_fight(self.I_BATTLE_1)
-            self.boss_fight(self.I_BATTLE_2)
-        elif available == 1:
-            self.boss_fight(self.I_BATTLE_1)
+        for battle in (self.I_BATTLE_1, self.I_BATTLE_2, self.I_BATTLE_3):
+            if boss_fought >= dynamic_count:
+                break
+            if self.boss_fight(battle, defeated=defeated if reward_name else None):
+                boss_fought += 1
+        if boss_fought < dynamic_count:
+            logger.warning(f"Only defeated {boss_fought}/{dynamic_count} area bosses")
         # 退出
         # 退出
         self.go_back()
         self.go_back()
-        self.set_next_run(task='AreaBoss', success=True, finish=False)
+        self.set_next_run(task='AreaBoss', success=boss_fought == dynamic_count, finish=False)
 
 
         # 以抛出异常的形式结束
         # 以抛出异常的形式结束
         raise TaskEnd
         raise TaskEnd
@@ -157,7 +151,7 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         self.wait_until_appear(self.I_AB_CLOSE_RED)
         self.wait_until_appear(self.I_AB_CLOSE_RED)
         self.ui_click(self.I_AB_CLOSE_RED, self.I_FILTER)
         self.ui_click(self.I_AB_CLOSE_RED, self.I_FILTER)
 
 
-    def boss_fight(self, battle: RuleImage, fileter_open: bool = True) -> bool:
+    def boss_fight(self, battle: RuleImage, fileter_open: bool = True, defeated: set[str] | None = None) -> bool:
         """
         """
             完成挑战一个鬼王的全流程
             完成挑战一个鬼王的全流程
             从打开筛选界面开始 到关闭鬼王详情界面结束
             从打开筛选界面开始 到关闭鬼王详情界面结束
@@ -174,11 +168,12 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         if not self.open_boss_detail(battle, 3):
         if not self.open_boss_detail(battle, 3):
             return False
             return False
 
 
-        # 如果已经打过该BOSS,直接跳过不打了
-        # if self.is_group_ranked():
-        #     logger.warning("There is no boss could be challenged")
-        #     self.ui_click_until_disappear(self.I_AB_CLOSE_RED, interval=3)
-        #     return True
+        if defeated is not None:
+            name = self.read_boss_name()
+            if not name or name in defeated:
+                logger.info(f"Skip area boss: {name or 'unreadable name'}")
+                self._return_from_boss_detail()
+                return False
 
 
         # 根据 reward_floor 决定模式
         # 根据 reward_floor 决定模式
         if reward_floor in (AreaBossFloor.ONE, AreaBossFloor.TEN):
         if reward_floor in (AreaBossFloor.ONE, AreaBossFloor.TEN):
@@ -198,6 +193,12 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         if not self.start_fight():
         if not self.start_fight():
             result = False
             result = False
             logger.warning("Area Boss Fight Failed ")
             logger.warning("Area Boss Fight Failed ")
+        elif defeated is not None:
+            defeated.add(name)
+        self._return_from_boss_detail()
+        return result
+
+    def _return_from_boss_detail(self):
         timeout = Timer(20).start()
         timeout = Timer(20).start()
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
@@ -208,7 +209,7 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             # 结算和关闭动画后可能直接回地图,不固定等待红叉出现。
             # 结算和关闭动画后可能直接回地图,不固定等待红叉出现。
             # 若地图只是过渡帧,后续 open_filter/go_back 会继续处理详情页。
             # 若地图只是过渡帧,后续 open_filter/go_back 会继续处理详情页。
             if self.appear(self.I_FILTER) or self.appear(self.I_AB_FILTER_OPENED):
             if self.appear(self.I_FILTER) or self.appear(self.I_AB_FILTER_OPENED):
-                return result
+                return
 
 
     def start_fight(self) -> bool:
     def start_fight(self) -> bool:
         while 1:
         while 1:
@@ -327,15 +328,15 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
                 break
                 break
             self.wait_until_appear(self.I_AB_JI_FLOOR_TEN, False, 1)
             self.wait_until_appear(self.I_AB_JI_FLOOR_TEN, False, 1)
 
 
-    def fight_reward_boss(self):
+    def fight_reward_boss(self) -> str | None:
         BOSS_REWARD_PHOTO1 = [self.C_AB_BOSS_REWARD_PHOTO_1, self.C_AB_BOSS_REWARD_PHOTO_2, self.C_AB_BOSS_REWARD_PHOTO_3]
         BOSS_REWARD_PHOTO1 = [self.C_AB_BOSS_REWARD_PHOTO_1, self.C_AB_BOSS_REWARD_PHOTO_2, self.C_AB_BOSS_REWARD_PHOTO_3]
         BOSS_REWARD_PHOTO2 = [self.C_AB_BOSS_REWARD_PHOTO_MINUS_2, self.C_AB_BOSS_REWARD_PHOTO_MINUS_1]
         BOSS_REWARD_PHOTO2 = [self.C_AB_BOSS_REWARD_PHOTO_MINUS_2, self.C_AB_BOSS_REWARD_PHOTO_MINUS_1]
         need_open_filter, boss_name, photo = self.get_hot_in_reward()  # 获取挑战人数最多的Boss的名字
         need_open_filter, boss_name, photo = self.get_hot_in_reward()  # 获取挑战人数最多的Boss的名字
         if photo is None or boss_name == '声望不够':
         if photo is None or boss_name == '声望不够':
-            return False
+            return None
         # 不需要打开筛选界面说明直接找到了目标boss, 直接挑战
         # 不需要打开筛选界面说明直接找到了目标boss, 直接挑战
         if not need_open_filter:
         if not need_open_filter:
-            return self.boss_fight(photo, fileter_open=False)
+            return boss_name if self.boss_fight(photo, fileter_open=False) else None
         # 滑动到最顶层
         # 滑动到最顶层
         logger.info("Swipe to top")
         logger.info("Swipe to top")
         for i in range(random.randint(1, 3)):
         for i in range(random.randint(1, 3)):
@@ -345,7 +346,7 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             self.open_filter()
             self.open_filter()
             name = self.get_bossName(PHOTO)
             name = self.get_bossName(PHOTO)
             if self.check_common_chars(str(name), boss_name):
             if self.check_common_chars(str(name), boss_name):
-                return self.boss_fight(PHOTO, fileter_open=False)
+                return name if self.boss_fight(PHOTO, fileter_open=False) else None
             self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
             self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
         # 倒数一和二
         # 倒数一和二
         for i in range(random.randint(1, 3)):
         for i in range(random.randint(1, 3)):
@@ -354,7 +355,7 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             self.open_filter()
             self.open_filter()
             name = self.get_bossName(PHOTO)
             name = self.get_bossName(PHOTO)
             if self.check_common_chars(str(name), boss_name):
             if self.check_common_chars(str(name), boss_name):
-                return self.boss_fight(PHOTO, fileter_open=False)
+                return name if self.boss_fight(PHOTO, fileter_open=False) else None
             self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
             self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
         self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
         self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
 
 
@@ -385,7 +386,10 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
                 name = '声望不够'
                 name = '声望不够'
             else:
             else:
                 name = self.get_bossName(photo)
                 name = self.get_bossName(photo)
-                if num >= 20000 and not self.appear(self.I_AB_NUM_CHALLENGE_RAIL):
+                if not name:
+                    logger.warning("Skip reward boss: unreadable name")
+                    num = 0
+                elif num >= 20000 and not self.appear(self.I_AB_NUM_CHALLENGE_RAIL):
                     logger.info("The number of challenges is enough")
                     logger.info("The number of challenges is enough")
                     return True, num, name
                     return True, num, name
             # 没找到满足的则关闭boss页面
             # 没找到满足的则关闭boss页面
@@ -438,9 +442,17 @@ class ScriptTask(Battle, GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         if not self.open_boss_detail(click_area, 3):
         if not self.open_boss_detail(click_area, 3):
             logger.info("%s unavailable", str(click_area))
             logger.info("%s unavailable", str(click_area))
             return 0
             return 0
-        ocrName = self.O_AB_BOSS_NAME.detect_and_ocr(self.device.image)
-        bossName = re.sub(r"[\'\[\]]", "", str([result.ocr_text for result in ocrName]))
-        return bossName
+        return self.read_boss_name()
+
+    def read_boss_name(self) -> str:
+        for attempt in range(2):
+            if attempt:
+                self.screenshot()
+            rows = self.O_AB_BOSS_NAME.detect_and_ocr(self.device.image)
+            name = ''.join(''.join(row.ocr_text.split()) for row in rows)
+            if name:
+                return name
+        return ''
 
 
     def open_boss_detail(self, battle: RuleImage, try_num: int = 3) -> bool:
     def open_boss_detail(self, battle: RuleImage, try_num: int = 3) -> bool:
         """
         """

+ 1 - 1
tasks/Component/SwitchAccount/assets.py

@@ -49,7 +49,7 @@ class SwitchAccountAssets:
 	# 登录界面 用户中心(区别于游戏内用户中心) 账户名 
 	# 登录界面 用户中心(区别于游戏内用户中心) 账户名 
 	O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
 	O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
 	# 判断是否在 选择服务器 界面的文本特质 
 	# 判断是否在 选择服务器 界面的文本特质 
-	O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")
+	O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(231,145,102,32), area=(231,141,103,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")
 
 
 
 
 	# Swipe Rule Assets
 	# Swipe Rule Assets

+ 2 - 2
tasks/Component/SwitchAccount/ocr.json

@@ -55,8 +55,8 @@
   },
   },
   {
   {
     "itemName": "sa_check_select_svr",
     "itemName": "sa_check_select_svr",
-    "roiFront": "252,145,97,32",
-    "roiBack": "248,141,102,38",
+    "roiFront": "231,145,102,32",
+    "roiBack": "231,141,103,38",
     "mode": "Single",
     "mode": "Single",
     "method": "Default",
     "method": "Default",
     "keyword": "已有角色",
     "keyword": "已有角色",

+ 10 - 0
tasks/SixRealms/assets.py

@@ -102,6 +102,16 @@ class SixRealmsAssets:
 	I_EXIT_SIXREALMS = RuleImage(roi_front=(507.5,308,100,100), roi_back=(507.5,308,100,100), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_exit_sixrealms.png")
 	I_EXIT_SIXREALMS = RuleImage(roi_front=(507.5,308,100,100), roi_back=(507.5,308,100,100), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_exit_sixrealms.png")
 	# 选择一个式神加入征伐队伍 
 	# 选择一个式神加入征伐队伍 
 	I_SELECT_SHIKIGAMI_AND_CONFIRM = RuleImage(roi_front=(499,238,151,57), roi_back=(479,213,199,113), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_select_shikigami_and_confirm.png")
 	I_SELECT_SHIKIGAMI_AND_CONFIRM = RuleImage(roi_front=(499,238,151,57), roi_back=(479,213,199,113), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_select_shikigami_and_confirm.png")
+	# rest
+	I_ISLAND_MARKER_101 = RuleImage(roi_front=(649,384,20,90), roi_back=(144,227,989,376), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_island_marker_101.png")
+	# mystery
+	I_ISLAND_MARKER_102 = RuleImage(roi_front=(907,449,20,90), roi_back=(144,227,989,376), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_island_marker_102.png")
+	# chaos
+	I_ISLAND_MARKER_103 = RuleImage(roi_front=(650,402,20,90), roi_back=(144,227,989,376), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_island_marker_103.png")
+	# battle
+	I_ISLAND_MARKER_104 = RuleImage(roi_front=(649,381,20,90), roi_back=(144,227,989,376), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_island_marker_104.png")
+	# star
+	I_ISLAND_MARKER_105 = RuleImage(roi_front=(649,372,20,90), roi_back=(144,227,989,376), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_island_marker_105.png")
 
 
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets

BIN
tasks/SixRealms/gate1/gate1_island_marker_101.png


BIN
tasks/SixRealms/gate1/gate1_island_marker_102.png


BIN
tasks/SixRealms/gate1/gate1_island_marker_103.png


BIN
tasks/SixRealms/gate1/gate1_island_marker_104.png


BIN
tasks/SixRealms/gate1/gate1_island_marker_105.png


+ 45 - 0
tasks/SixRealms/gate1/image.json

@@ -169,5 +169,50 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "选择一个式神加入征伐队伍"
     "description": "选择一个式神加入征伐队伍"
+  },
+  {
+    "itemName": "island_marker_101",
+    "imageName": "gate1_island_marker_101.png",
+    "roiFront": "649,384,20,90",
+    "roiBack": "144,227,989,376",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "rest"
+  },
+  {
+    "itemName": "island_marker_102",
+    "imageName": "gate1_island_marker_102.png",
+    "roiFront": "907,449,20,90",
+    "roiBack": "144,227,989,376",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "mystery"
+  },
+  {
+    "itemName": "island_marker_103",
+    "imageName": "gate1_island_marker_103.png",
+    "roiFront": "650,402,20,90",
+    "roiBack": "144,227,989,376",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "chaos"
+  },
+  {
+    "itemName": "island_marker_104",
+    "imageName": "gate1_island_marker_104.png",
+    "roiFront": "649,381,20,90",
+    "roiBack": "144,227,989,376",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "battle"
+  },
+  {
+    "itemName": "island_marker_105",
+    "imageName": "gate1_island_marker_105.png",
+    "roiFront": "649,372,20,90",
+    "roiBack": "144,227,989,376",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "star"
   }
   }
 ]
 ]

+ 59 - 15
tasks/SixRealms/moon_sea/map.py

@@ -1,12 +1,9 @@
-import cv2
 import re
 import re
-import numpy as np
-from numpy import uint8, fromfile
+from module.atom.click import RuleClick
 from module.base.timer import Timer
 from module.base.timer import Timer
 from module.exception import GameStuckError
 from module.exception import GameStuckError
 from module.logger import logger
 from module.logger import logger
 
 
-from tasks.base_task import BaseTask
 from tasks.SixRealms.moon_sea.skills import MoonSeaSkills
 from tasks.SixRealms.moon_sea.skills import MoonSeaSkills
 from tasks.SixRealms.assets import SixRealmsAssets
 from tasks.SixRealms.assets import SixRealmsAssets
 from tasks.SixRealms.common import MoonSeaType
 from tasks.SixRealms.common import MoonSeaType
@@ -14,6 +11,13 @@ from tasks.SixRealms.oas_ocr import StoneOcr
 
 
 
 
 class MoonSeaMap(MoonSeaSkills):
 class MoonSeaMap(MoonSeaSkills):
+    island_markers = {
+        MoonSeaType.island101: SixRealmsAssets.I_ISLAND_MARKER_101,
+        MoonSeaType.island102: SixRealmsAssets.I_ISLAND_MARKER_102,
+        MoonSeaType.island103: SixRealmsAssets.I_ISLAND_MARKER_103,
+        MoonSeaType.island104: SixRealmsAssets.I_ISLAND_MARKER_104,
+        MoonSeaType.island105: SixRealmsAssets.I_ISLAND_MARKER_105,
+    }
     map_ocr = StoneOcr(
     map_ocr = StoneOcr(
         roi=(0, 0, 1280, 720),
         roi=(0, 0, 1280, 720),
         area=(0, 0, 1280, 720),
         area=(0, 0, 1280, 720),
@@ -26,15 +30,44 @@ class MoonSeaMap(MoonSeaSkills):
     def contains_any_char(string, chars):
     def contains_any_char(string, chars):
         return not set(string).isdisjoint(set(chars))
         return not set(string).isdisjoint(set(chars))
 
 
-    def decide(self) -> tuple:
-        """
-        这个玩意,检测不是很准
-        @return: 岛屿的类型,剩余多少回合, (x,y, w, h)
-        """
+    def _marker_boxes(self, kind):
+        marker = self.island_markers[kind]
+        return [tuple(match[1:]) for match in marker.match_all_any(self.device.image)]
+
+    @staticmethod
+    def _nearby_marker(boxes, roi):
+        # 岛屿上下浮动。同类岛并排时,只跟踪原来那一列。
+        center_x = roi[0] + roi[2] / 2
+        nearest = min(boxes, key=lambda box: abs(box[0] + box[2] / 2 - center_x), default=None)
+        if nearest and abs(nearest[0] + nearest[2] / 2 - center_x) <= 60:
+            return nearest
+
+    def decide(self, prefer_store=False) -> tuple:
         self.screenshot()
         self.screenshot()
         if self.appear(self.I_BOSS_FIRE):
         if self.appear(self.I_BOSS_FIRE):
             # 最后的boss
             # 最后的boss
             return MoonSeaType.island106, 0, (0, 0, 0, 0)
             return MoonSeaType.island106, 0, (0, 0, 0, 0)
+        kind, rounds, roi = self._read_map_ocr()
+        candidates = {}
+        for island in self.island_markers:
+            if island == MoonSeaType.island101 and self.appear(self.I_M_STORE):
+                continue
+            boxes = self._marker_boxes(island)
+            if boxes:
+                candidates[island] = boxes
+        if prefer_store and kind != MoonSeaType.island101 and MoonSeaType.island101 in candidates:
+            kind = MoonSeaType.island101
+            roi = max(candidates[kind])
+        elif kind != MoonSeaType.island100:
+            roi = self._nearby_marker(candidates.get(kind, []), roi) or roi
+        elif candidates:
+            # OCR 未识别出岛型时,沿用从右向左的选岛顺序。
+            kind, roi = max(((island, max(boxes)) for island, boxes in candidates.items()),
+                            key=lambda candidate: candidate[1][0])
+        logger.info('Island type: {}, Residue: {}, ROI: {}'.format(kind, rounds, roi))
+        return kind, rounds, roi
+
+    def _read_map_ocr(self):
         isl_type = MoonSeaType.island100
         isl_type = MoonSeaType.island100
         isl_roi = (0, 0, 0, 0)
         isl_roi = (0, 0, 0, 0)
         isl_num = 0
         isl_num = 0
@@ -76,7 +109,6 @@ class MoonSeaMap(MoonSeaSkills):
             elif isl_type == MoonSeaType.island100 and self.contains_any_char(result.ocr_text, chars='星之'):
             elif isl_type == MoonSeaType.island100 and self.contains_any_char(result.ocr_text, chars='星之'):
                 isl_type = MoonSeaType.island105
                 isl_type = MoonSeaType.island105
                 isl_roi = x1, y1, w, h
                 isl_roi = x1, y1, w, h
-        logger.info('Island type: {}, Residue: {}, ROI: {}'.format(isl_type, isl_num, isl_roi))
         return isl_type, isl_num, isl_roi
         return isl_type, isl_num, isl_roi
 
 
     def enter_island(self, isl_type, isl_roi):
     def enter_island(self, isl_type, isl_roi):
@@ -106,17 +138,29 @@ class MoonSeaMap(MoonSeaSkills):
                 click_timer.reset()
                 click_timer.reset()
             logger.info('Entering island randomly')
             logger.info('Entering island randomly')
             return
             return
-        isl_roi = [isl_roi[0]-40, isl_roi[1] + 70, isl_roi[2] + 40, isl_roi[3]+40]
-        self.C_ISLAND_ENTER.roi_front = isl_roi
         timeout = Timer(15).start()
         timeout = Timer(15).start()
+        click_timer = Timer(2.5)
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if not self.in_main() and self.appear(self.I_BACK_EXIT):
+            on_map = self.in_main()
+            if not on_map and self.appear(self.I_BACK_EXIT):
                 break
                 break
             if timeout.reached():
             if timeout.reached():
-                raise GameStuckError('Enter recognized island timeout')
-            if self.click(self.C_ISLAND_ENTER, interval=2.5):
+                raise GameStuckError(f'Enter {isl_type.name} timeout')
+            if not on_map or not click_timer.reached():
                 continue
                 continue
+            click_timer.reset()
+            roi = self._nearby_marker(self._marker_boxes(isl_type), isl_roi)
+            if not roi:
+                kind, _, box = self._read_map_ocr()
+                if kind != isl_type or not self._nearby_marker([box], isl_roi):
+                    continue
+                roi = box
+            x, y, w, h = roi
+            # 以当帧标牌中心为基准,落点在下方 15~75 像素。
+            cx, cy = int(x + w / 2), int(y + h / 2) + 45
+            click_area = (cx - 30, cy - 30, 60, 60)
+            self.click(RuleClick(click_area, click_area, name='island_enter'))
         logger.info('Entering island')
         logger.info('Entering island')
         return
         return
 
 

+ 1 - 6
tasks/SixRealms/moon_sea/moon_sea.py

@@ -72,12 +72,7 @@ class MoonSea(MoonSeaMap, MoonSeaL101, MoonSeaL102, MoonSeaL103, MoonSeaL104, Mo
                 else:
                 else:
                     self.activate_store()
                     self.activate_store()
                     self.wait_animate_stable(self.C_MAIN_ANIMATE_KEEP, timeout=3)
                     self.wait_animate_stable(self.C_MAIN_ANIMATE_KEEP, timeout=3)
-                    isl_type, isl_num, isl_roi = self.decide()
-                    # 文字检测不一定发现到宁息
-                    if isl_type != MoonSeaType.island101:
-                        logger.warning('OCR not found island101')
-                        logger.warning('Try to entry the island in the right randomly order')
-                        self.entry_island_random()
+                    isl_type, isl_num, isl_roi = self.decide(prefer_store=True)
 
 
             # 如果是boss
             # 如果是boss
             if isl_type == MoonSeaType.island106:
             if isl_type == MoonSeaType.island106:

+ 16 - 5
tasks/WantedQuests/script_task.py

@@ -1,6 +1,7 @@
 # This Python file uses the following encoding: utf-8
 # This Python file uses the following encoding: utf-8
 # @author runhey
 # @author runhey
 # github https://github.com/runhey
 # github https://github.com/runhey
+from copy import copy
 from datetime import timedelta, time, datetime
 from datetime import timedelta, time, datetime
 from time import sleep
 from time import sleep
 from typing import List
 from typing import List
@@ -23,6 +24,19 @@ from tasks.WantedQuests.config import CooperationType, CooperationSelectMask
 from tasks.WantedQuests.explore import WQExplore, ExploreWantedBoss
 from tasks.WantedQuests.explore import WQExplore, ExploreWantedBoss
 
 
 
 
+def _read_location_info(rule: RuleOcr, image):
+    # https://github.com/runhey/OnmyojiAutoScript/pull/2006
+    pattern = r"^(.*?)[((]?数量[::]\s*(\d+)[))]"
+    match = re.match(pattern, rule.ocr(image))
+    if match and match.group(1):
+        return match
+    # 数量可能被单行 OCR 漏读;只收紧上下留白,保留完整地点名。
+    retry = copy(rule)
+    x, y, w, h = rule.roi
+    retry.roi = [x, y + 7, w, h - 14]
+    return re.match(pattern, retry.ocr(image))
+
+
 class ScriptTask(WQExplore, SecretScriptTask, WantedQuestsAssets):
 class ScriptTask(WQExplore, SecretScriptTask, WantedQuestsAssets):
     want_strategy_excluding: list[list] = []  # 不需要执行的
     want_strategy_excluding: list[list] = []  # 不需要执行的
     # 追踪界面(显示"前往"按钮的界面,左上角位置,神秘任务不好使)显示以下名称时,任务不再执行
     # 追踪界面(显示"前往"按钮的界面,左上角位置,神秘任务不好使)显示以下名称时,任务不再执行
@@ -269,11 +283,8 @@ class ScriptTask(WQExplore, SecretScriptTask, WantedQuestsAssets):
             # ,荒川之怒·壹,4,前往按钮,function
             # ,荒川之怒·壹,4,前往按钮,function
             result = [-1, '', -1, GOTO_BUTTON[index], self.challenge, '']
             result = [-1, '', -1, GOTO_BUTTON[index], self.challenge, '']
             type_wq = OCR_WQ_TYPE[index].ocr(self.device.image)
             type_wq = OCR_WQ_TYPE[index].ocr(self.device.image)
-            info_wq_1 = OCR_WQ_INFO[index].ocr(self.device.image)
-            info_wq_1 = info_wq_1.replace(':', ':').replace('(', '(').replace(')', ')')
-            info_wq_1 = info_wq_1.replace(':', ':')
-            match = re.match(r"^(.*?)[((]?数量[::]\s*(\d+)[))]", info_wq_1)
-            if not match:
+            match = _read_location_info(OCR_WQ_INFO[index], self.device.image)
+            if not match or not match.group(1):
                 return None
                 return None
             wq_destination = match.group(1)
             wq_destination = match.group(1)
             wq_number = int(match.group(2))
             wq_number = int(match.group(2))

+ 21 - 0
tests/tasks/AreaBoss/test_area_battle.py

@@ -59,3 +59,24 @@ def test_boss_fight_accepts_either_supported_return_screen(returned_to_filter, w
     assert task.boss_fight(None, fileter_open=False) is win
     assert task.boss_fight(None, fileter_open=False) is win
     assert screen[0] == 'map'
     assert screen[0] == 'map'
     assert calls == ([] if returned_to_filter else ['close'])
     assert calls == ([] if returned_to_filter else ['close'])
+
+
+@pytest.mark.parametrize('name,win,should_fight', [
+    ('reward', True, False), ('', True, False),
+    ('next', False, True), ('next', True, True),
+])
+def test_reward_run_only_counts_new_wins(name, win, should_fight):
+    task = object.__new__(ScriptTask)
+    task.config = SimpleNamespace(area_boss=SimpleNamespace(boss=SimpleNamespace(reward_floor=AreaBossFloor.DEFAULT)))
+    task.open_boss_detail = lambda *args: True
+    task.read_boss_name = lambda: name
+    actions = []
+    def start_fight():
+        actions.append('fight')
+        return win
+    task.start_fight = start_fight
+    task._return_from_boss_detail = lambda: actions.append('return')
+    defeated = {'reward'}
+    assert task.boss_fight(None, fileter_open=False, defeated=defeated) is (should_fight and win)
+    assert actions == (['fight', 'return'] if should_fight else ['return'])
+    assert defeated == ({'reward', 'next'} if should_fight and win else {'reward'})

+ 26 - 0
tests/tasks/WantedQuests/test_location_info.py

@@ -0,0 +1,26 @@
+import pytest
+
+from tasks.WantedQuests.script_task import _read_location_info
+
+
+@pytest.mark.parametrize('first,retry,expected', [
+    ('荒川之怒(数量:2)', None, ('荒川之怒', '2')),
+    ('数量:2)', '荒川之怒(数量:2)', ('荒川之怒', '2')),
+    ('荒川之怒', '', None),
+])
+def test_location_read_preserves_width_and_shared_rule(first, retry, expected):
+    seen = []
+    original = (20, 30, 150, 35)
+
+    class Rule:
+        roi = original
+
+        def ocr(self, image):
+            seen.append(tuple(self.roi))
+            return first if len(seen) == 1 else retry
+
+    rule = Rule()
+    match = _read_location_info(rule, None)
+    assert (match.groups() if match else None) == expected
+    assert seen == ([original] if retry is None else [original, (20, 37, 150, 21)])
+    assert rule.roi == original

+ 39 - 1
tests/test_six_realms_island_entry.py

@@ -56,6 +56,43 @@ class IslandEntryTests(unittest.TestCase):
         self.enter_unknown(task)
         self.enter_unknown(task)
         self.assertEqual(task.events, [])
         self.assertEqual(task.events, [])
 
 
+    def test_known_island_tracks_height_without_switching_columns(self):
+        task = OfflineMoonSea(enter_after=2)
+        left = (288, 280, 20, 90)
+        frames = [[(1040, 300, 20, 90), left],
+                  [(288, 320, 20, 90), (1040, 340, 20, 90)]]
+        with patch.object(task, "_marker_boxes", side_effect=frames), \
+                patch.object(task, "click", wraps=task.click) as click, \
+                patch("module.base.timer.time.time", side_effect=lambda: task.now):
+            task.enter_island(MoonSeaType.island104, left)
+        self.assertEqual([call.args[0].roi_front for call in click.call_args_list],
+                         [(268, 340, 60, 60), (268, 380, 60, 60)])
+
+    def test_decide_keeps_ocr_target_without_a_nearby_marker(self):
+        task = OfflineMoonSea()
+        roi = (288, 280, 22, 80)
+        for target, marker, prefer_store in (
+            (MoonSeaType.island104, MoonSeaType.island104, False),
+            (MoonSeaType.island104, MoonSeaType.island103, False),
+            (MoonSeaType.island101, MoonSeaType.island101, True),
+        ):
+            ocr = (target, 9, roi)
+            boxes = {marker: [(1040, 300, 20, 90)]}
+            with self.subTest(target=target, marker=marker, prefer_store=prefer_store), \
+                    patch.object(task, "_read_map_ocr", return_value=ocr), \
+                    patch.object(task, "_marker_boxes", side_effect=lambda kind: boxes.get(kind, [])):
+                self.assertEqual(task.decide(prefer_store=prefer_store), ocr)
+
+    def test_disappearing_marker_times_out_without_clicking_adjacent_island(self):
+        task = OfflineMoonSea()
+        adjacent = (290, 330, 20, 90)
+        with patch.object(task, "_marker_boxes", return_value=[adjacent]), \
+                patch.object(task, "_read_map_ocr", return_value=(MoonSeaType.island104, 9, adjacent)), \
+                patch("module.base.timer.time.time", side_effect=lambda: task.now):
+            with self.assertRaisesRegex(GameStuckError, "Enter island104 timeout"):
+                task.enter_island(MoonSeaType.island104, (1040, 310, 20, 90))
+        self.assertEqual(task.events, [])
+
     def test_entry_cycles_in_order_with_one_shared_interval(self):
     def test_entry_cycles_in_order_with_one_shared_interval(self):
         task = OfflineMoonSea(enter_after=8)
         task = OfflineMoonSea(enter_after=8)
         self.enter_unknown(task)
         self.enter_unknown(task)
@@ -88,7 +125,8 @@ class IslandEntryTests(unittest.TestCase):
         for enter_after in (0, 2, None):
         for enter_after in (0, 2, None):
             with self.subTest(enter_after=enter_after):
             with self.subTest(enter_after=enter_after):
                 task = OfflineMoonSea(enter_after=enter_after)
                 task = OfflineMoonSea(enter_after=enter_after)
-                with patch("module.base.timer.time.time", side_effect=lambda: task.now):
+                with patch.object(task, "_marker_boxes", return_value=[(100, 100, 40, 40)]), \
+                        patch("module.base.timer.time.time", side_effect=lambda: task.now):
                     if enter_after is None:
                     if enter_after is None:
                         with self.assertRaises(GameStuckError):
                         with self.assertRaises(GameStuckError):
                             task.enter_island(MoonSeaType.island101, (100, 100, 40, 40))
                             task.enter_island(MoonSeaType.island101, (100, 100, 40, 40))

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff