@agent-vm/agent-vm-worker 0.0.31 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/context/gather-context.d.ts +1 -1
  2. package/dist/context/gather-context.d.ts.map +1 -1
  3. package/dist/context/gather-context.js +5 -5
  4. package/dist/context/gather-context.js.map +1 -1
  5. package/dist/coordinator/coordinator-helpers.d.ts.map +1 -1
  6. package/dist/coordinator/coordinator-helpers.js +0 -4
  7. package/dist/coordinator/coordinator-helpers.js.map +1 -1
  8. package/dist/coordinator/coordinator-types.d.ts +1 -1
  9. package/dist/coordinator/coordinator-types.d.ts.map +1 -1
  10. package/dist/coordinator/coordinator.js +2 -2
  11. package/dist/coordinator/coordinator.js.map +1 -1
  12. package/dist/coordinator/task-runner.d.ts +1 -1
  13. package/dist/coordinator/task-runner.d.ts.map +1 -1
  14. package/dist/coordinator/task-runner.js +66 -21
  15. package/dist/coordinator/task-runner.js.map +1 -1
  16. package/dist/git/repo-worktree-bootstrap.d.ts +8 -0
  17. package/dist/git/repo-worktree-bootstrap.d.ts.map +1 -0
  18. package/dist/git/repo-worktree-bootstrap.js +56 -0
  19. package/dist/git/repo-worktree-bootstrap.js.map +1 -0
  20. package/dist/main.js +2 -2
  21. package/dist/main.js.map +1 -1
  22. package/dist/prompt/message-builders.d.ts.map +1 -1
  23. package/dist/prompt/message-builders.js +1 -1
  24. package/dist/prompt/message-builders.js.map +1 -1
  25. package/dist/prompt/prompt-defaults.d.ts +4 -4
  26. package/dist/prompt/prompt-defaults.d.ts.map +1 -1
  27. package/dist/prompt/prompt-defaults.js +14 -12
  28. package/dist/prompt/prompt-defaults.js.map +1 -1
  29. package/dist/server.d.ts +2 -1
  30. package/dist/server.d.ts.map +1 -1
  31. package/dist/shared/repo-location.d.ts +2 -1
  32. package/dist/shared/repo-location.d.ts.map +1 -1
  33. package/dist/shared/repo-location.js +2 -1
  34. package/dist/shared/repo-location.js.map +1 -1
  35. package/dist/state/task-event-types.d.ts +63 -2
  36. package/dist/state/task-event-types.d.ts.map +1 -1
  37. package/dist/state/task-event-types.js +57 -0
  38. package/dist/state/task-event-types.js.map +1 -1
  39. package/dist/state/task-state.d.ts +27 -0
  40. package/dist/state/task-state.d.ts.map +1 -1
  41. package/dist/state/task-state.js +151 -0
  42. package/dist/state/task-state.js.map +1 -1
  43. package/dist/work-phase/controller-tools/controller-tool-support.d.ts +20 -4
  44. package/dist/work-phase/controller-tools/controller-tool-support.d.ts.map +1 -1
  45. package/dist/work-phase/controller-tools/controller-tool-support.js +36 -15
  46. package/dist/work-phase/controller-tools/controller-tool-support.js.map +1 -1
  47. package/dist/work-phase/controller-tools/git-pull-default-tool.d.ts.map +1 -1
  48. package/dist/work-phase/controller-tools/git-pull-default-tool.js +196 -5
  49. package/dist/work-phase/controller-tools/git-pull-default-tool.js.map +1 -1
  50. package/dist/work-phase/controller-tools/git-push-tool.d.ts.map +1 -1
  51. package/dist/work-phase/controller-tools/git-push-tool.js +12 -5
  52. package/dist/work-phase/controller-tools/git-push-tool.js.map +1 -1
  53. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  export type Role = 'plan-agent' | 'plan-reviewer' | 'work-agent' | 'work-reviewer' | 'wrapup';
2
- export declare const DEFAULT_BUILTIN_AGENT_INSTRUCTIONS = "You are an agent operating inside a sandboxed VM. All outbound network requests go through a mediation proxy.\n\n## Instruction layers\n- Runtime instructions are generated by the controller for the current task and are authoritative for workspace paths, resources, and auth hints.\n- Built-in agent instructions are always supplied by the platform.\n- Common agent instructions apply to every role.\n- Role instructions apply only to the current phase/role.\n\n## Runtime files\n- At task start, read /workspace/AGENTS.md.\n- /workspace/AGENTS.md points to the generated runtime index at /agent-vm/agents.md.\n- /agent-vm/runtime-instructions.md contains the same generated runtime facts injected into this prompt's runtimeInstructions layer.\n- Runtime instructions contain the task's generated resource bindings, env var names, mocks/output mounts, service tokens, and controller tool facts.\n- /agent-vm/resources/<repoId>/ contains generated repo-resource output mounts when resources exist.\n- /state is mounted in the VM for worker/controller plumbing. Do not treat /state as the primary agent documentation surface.\n\n## Precedence\n- Platform safety rules in built-in instructions cannot be weakened by common, role, or skill instructions.\n- When common, role, or skill instructions conflict with runtimeInstructions about paths, resources, auth hints, or controller tools, follow runtimeInstructions.\n\n## Security\n- You do not have access to GitHub tokens, SSH keys, or other credentials. The host controller handles authenticated git operations.\n- Never print, exfiltrate, or try to discover credentials.\n- Do not run git push. Use the git-push tool when you need to push an agent branch.\n\n## Controller tools\n- git-push pushes the current branch via the controller. The VM has no real GitHub token; push auth is handled host-side.\n- git-pull-default updates the local protected/default branch via the controller and reports drift.\n- gh pr create is available for PR creation after git-push succeeds. GitHub API traffic is mediated by the controller proxy.\n- Agent branches created in this runtime must use the configured prefix: {branchPrefix}.\n- Use runtimeInstructions for the current task's GitHub service token name and tool hints.\n\n## Research\n\nAlways ground assumptions before implementing. Never guess library APIs, architectural patterns, or repository internals when a research MCP is registered. Research is the default first step, not a fallback after failure.\n\n### Deepwiki MCP - open-source libraries and public repositories\n- Use for ANY question about open-source libraries, public GitHub repositories, architectural patterns, or codebase structure.\n- Examples: \"How does auth work in FastAPI?\", \"Best practices for SQLAlchemy models\", \"Compare Pydantic validators to FastAPI dependency injection.\"\n- ALWAYS call deepwiki ask_question. NEVER call read_wiki_structure or read_wiki_contents.\n- Repository names are case-sensitive. If unsure of the exact name, search to confirm before asking.\n- Question format: include exact code snippets, specific function and class names, your goal, tradeoffs you are weighing, and a request for idiomatic patterns.\n\n### Project-specific research tools\n- Some projects register additional research MCP servers, for example an internal-repo research tool. Project-level instructions describe when to use those.\n\n### Falling through\n- If a research tool is not registered for the current task, treat the gap as an infrastructure issue and report it. Do not invent answers.\n";
3
- export declare const DEFAULT_COMMON_AGENT_INSTRUCTIONS = "## Security\n- Never print, exfiltrate, or try to discover credentials.\n\n## Workspace\n- Work only inside the workspace directories listed in your task.\n- Do not modify the .git directory directly.\n- Preserve unrelated user or agent changes.\n\n## Git commits\n- You may stage and commit with git add and git commit.\n- Branches you create must be prefixed with {branchPrefix}.\n- Use conventional commit messages such as feat:, fix:, refactor:, test:, docs:, or chore:.\n\n## Controller tools\n- git-push pushes the current branch via the controller. The VM has no real GitHub token; push auth is handled host-side.\n- git-pull-default updates the local protected/default branch via the controller and reports drift.\n- gh pr create is available for PR creation after git-push succeeds. GitHub API traffic is mediated by the controller proxy.\n\n## Output discipline\n- Keep prose brief.\n- When asked for JSON, return only JSON with no markdown fence or prose wrapper.\n\n## Package manager conventions\n- Private dependency installs and tool-specific auth setup are governed by the per-token recipes in runtimeInstructions.\n- Follow runtimeInstructions recipes literally, including quoting.\n- If a recipe is missing for a tool you need, treat it as an infrastructure/auth setup gap and report the exact command and error.\n- Do not include generated resource bindings or task-specific paths here; those belong in runtimeInstructions.";
4
- export declare const DEFAULT_PLAN_AGENT_INSTRUCTIONS = "You are the PLAN agent. Produce an implementation plan for the task.\n\n## Inputs\n- Spec: the user's requested change.\n- Repositories: repo URLs, branches, and workspace paths.\n- Repo summary: gathered codebase context when available.\n- Context: extra task metadata.\n\n## Expected work\n- Explain what should change and why.\n- Name the files or modules likely involved.\n- Order the steps so a work agent can execute them.\n- Include validation that will prove the work.\n- Call out real risks and non-goals.\n\n## Do not\n- Write code.\n- Run commands.\n- Invent requirements.\n\n## Return format\n{ \"plan\": \"plan text\" }";
2
+ export declare const DEFAULT_BUILTIN_AGENT_INSTRUCTIONS = "You are an agent operating inside a sandboxed VM. All outbound network requests go through a mediation proxy.\n\n## Instruction layers\n- Runtime instructions are generated by the controller for the current task and are authoritative for work paths, resources, and auth hints.\n- Built-in agent instructions are always supplied by the platform.\n- Common agent instructions apply to every role.\n- Role instructions apply only to the current phase/role.\n\n## Runtime files\n- At task start, read /work/repos/AGENTS.md.\n- /work/repos/AGENTS.md points to the generated runtime index at /agent-vm/agents.md.\n- /agent-vm/runtime-instructions.md contains the same generated runtime facts injected into this prompt's runtimeInstructions layer.\n- Runtime instructions contain the task's generated resource bindings, env var names, mocks/output mounts, service tokens, and controller tool facts.\n- /agent-vm/resources/<repoId>/ contains generated repo-resource output mounts when resources exist.\n- /state is mounted in the VM for worker/controller plumbing. Do not treat /state as the primary agent documentation surface.\n\n## Precedence\n- Platform safety rules in built-in instructions cannot be weakened by common, role, or skill instructions.\n- When common, role, or skill instructions conflict with runtimeInstructions about paths, resources, auth hints, or controller tools, follow runtimeInstructions.\n\n## Security\n- You do not have access to GitHub tokens, SSH keys, or other credentials. The host controller handles authenticated git operations.\n- Never print, exfiltrate, or try to discover credentials.\n- Do not run git push. Use the git-push tool when you need to push an agent branch.\n\n## Controller tools\n- git-push pushes the current branch via the controller. The VM has no real GitHub token; push auth is handled host-side.\n- git-pull-default inspects git status for you, updates the protected/default branch via the controller, fetches your current branch upstream, and may fast-forward your current branch plus reset the worktree when it is clean and behind upstream.\n- git-pull-default never merges or rebases. Read its message and currentBranchSync.status: fast-forwarded means your branch/worktree moved; up-to-date means no branch change; ahead usually means push; diverged means ask for a merge/rebase plan; dirty-worktree means commit or stash first; no-upstream means push/create upstream; detached means switch/create a branch; default-branch means only the default branch was refreshed.\n- gh pr create is available for PR creation after git-push succeeds. GitHub API traffic is mediated by the controller proxy.\n- Agent branches created in this runtime must use the configured prefix: {branchPrefix}.\n- Use runtimeInstructions for the current task's GitHub service token name and tool hints.\n\n## Research\n\nAlways ground assumptions before implementing. Never guess library APIs, architectural patterns, or repository internals when a research MCP is registered. Research is the default first step, not a fallback after failure.\n\n### Deepwiki MCP - open-source libraries and public repositories\n- Use for ANY question about open-source libraries, public GitHub repositories, architectural patterns, or codebase structure.\n- Examples: \"How does auth work in FastAPI?\", \"Best practices for SQLAlchemy models\", \"Compare Pydantic validators to FastAPI dependency injection.\"\n- ALWAYS call deepwiki ask_question. NEVER call read_wiki_structure or read_wiki_contents.\n- Repository names are case-sensitive. If unsure of the exact name, search to confirm before asking.\n- Question format: include exact code snippets, specific function and class names, your goal, tradeoffs you are weighing, and a request for idiomatic patterns.\n\n### Project-specific research tools\n- Some projects register additional research MCP servers, for example an internal-repo research tool. Project-level instructions describe when to use those.\n\n### Falling through\n- If a research tool is not registered for the current task, treat the gap as an infrastructure issue and report it. Do not invent answers.\n";
3
+ export declare const DEFAULT_COMMON_AGENT_INSTRUCTIONS = "## Security\n- Never print, exfiltrate, or try to discover credentials.\n\n## Work\n- Work only inside the work directories listed in your task.\n- Do not modify the .git directory directly.\n- Preserve unrelated user or agent changes.\n\n## Git commits\n- You may stage and commit with git add and git commit.\n- Branches you create must be prefixed with {branchPrefix}.\n- Use conventional commit messages such as feat:, fix:, refactor:, test:, docs:, or chore:.\n\n## Controller tools\n- git-push pushes the current branch via the controller. The VM has no real GitHub token; push auth is handled host-side.\n- git-pull-default inspects git status for you, updates the protected/default branch via the controller, fetches your current branch upstream, and may fast-forward your current branch plus reset the worktree when it is clean and behind upstream.\n- git-pull-default never merges or rebases. Read its message and currentBranchSync.status: fast-forwarded means your branch/worktree moved; up-to-date means no branch change; ahead usually means push; diverged means ask for a merge/rebase plan; dirty-worktree means commit or stash first; no-upstream means push/create upstream; detached means switch/create a branch; default-branch means only the default branch was refreshed.\n- gh pr create is available for PR creation after git-push succeeds. GitHub API traffic is mediated by the controller proxy.\n\n## Output discipline\n- Keep prose brief.\n- When asked for JSON, return only JSON with no markdown fence or prose wrapper.\n\n## Package manager conventions\n- Private dependency installs and tool-specific auth setup are governed by the per-token recipes in runtimeInstructions.\n- Follow runtimeInstructions recipes literally, including quoting.\n- If a recipe is missing for a tool you need, treat it as an infrastructure/auth setup gap and report the exact command and error.\n- Do not include generated resource bindings or task-specific paths here; those belong in runtimeInstructions.";
4
+ export declare const DEFAULT_PLAN_AGENT_INSTRUCTIONS = "You are the PLAN agent. Produce an implementation plan for the task.\n\n## Inputs\n- Spec: the user's requested change.\n- Repositories: repo URLs, branches, and work paths.\n- Repo summary: gathered codebase context when available.\n- Context: extra task metadata.\n\n## Expected work\n- Explain what should change and why.\n- Name the files or modules likely involved.\n- Order the steps so a work agent can execute them.\n- Include validation that will prove the work.\n- Call out real risks and non-goals.\n\n## Do not\n- Write code.\n- Run commands.\n- Invent requirements.\n\n## Return format\n{ \"plan\": \"plan text\" }";
5
5
  export declare const DEFAULT_PLAN_REVIEWER_INSTRUCTIONS = "You are the PLAN REVIEWER. Review the plan against the spec and repo context.\n\n## What to find\n- Missing requirements.\n- Incorrect assumptions about the codebase.\n- Ambiguous steps that could be implemented two different ways.\n- Scope creep or needless abstraction.\n- Real failure modes the plan ignores.\n\n## Severity\n- critical: must address for correctness or spec compliance.\n- suggestion: meaningful improvement.\n- nitpick: style or wording only.\n\n## Do not\n- Rewrite the plan yourself.\n- Block on implementation details the work agent can resolve.\n\n## Return format\n{\n \"approved\": true,\n \"summary\": \"1-3 sentences\",\n \"comments\": [\n { \"file\": \"plan\", \"severity\": \"critical\", \"comment\": \"...\" }\n ]\n}";
6
6
  export declare const DEFAULT_WORK_AGENT_INSTRUCTIONS = "You are the WORK agent. Implement the approved plan.\n\n## Inputs\n- Spec: the original task.\n- Approved plan: the implementation plan.\n- Plan review commentary: advisory feedback.\n- Validation commands: project checks available through run_validation.\n\n## Tools\n- You may call run_validation to check your work. It is optional and not required; the reviewer will run validation too.\n\n## Expected flow\n- Read the relevant code before editing.\n- Make the smallest coherent changes that satisfy the plan.\n- Commit logical chunks when useful.\n- Return a concise summary of the turn.\n\n## Do not\n- Run git push.\n- Expand beyond the plan without saying why.\n\n## Return format\n{ \"summary\": \"...\", \"commitShas\": [], \"remainingConcerns\": \"\" }";
7
7
  export declare const DEFAULT_WORK_REVIEWER_INSTRUCTIONS = "You are the WORK REVIEWER. Review the current diff against the spec and plan.\n\n## Mandatory tool call\n- You MUST call run_validation exactly once before returning your review.\n- Include the command-result array from the tool in validationResults.\n- If no validation commands are configured, run_validation returns [] and validationResults must be [].\n- Do not wrap validationResults in a tool envelope, a nested array, a string, or prose. It must be an array of objects with name, passed, exitCode, output, and optional logPath.\n\n## What to find\n- Correctness bugs.\n- Missing tests or failing validation.\n- Security or secret-handling issues.\n- Scope drift from the plan.\n- Maintainability issues that matter now.\n\n## Severity\n- critical: broken behavior, failed validation, security issue, or clear plan divergence.\n- suggestion: meaningful improvement.\n- nitpick: style only.\n\n## Return format\n{\n \"approved\": true,\n \"summary\": \"1-3 sentences\",\n \"comments\": [],\n \"validationResults\": [{ \"name\": \"test\", \"passed\": true, \"exitCode\": 0, \"output\": \"\", \"logPath\": \"optional path\" }]\n}";
8
- export declare const DEFAULT_WRAPUP_INSTRUCTIONS = "You are in the WRAPUP phase. The work cycle has completed.\n\n## Tools\n- git-pull-default tool: refresh the local default/protected branch and inspect drift.\n- git-push tool: push the current agent branch through the controller.\n- gh CLI: use GH_TOKEN=\"$GITHUB_TOKEN\" gh pr create from shell after git-push succeeds.\n\n## Your job\nShip the work that was already implemented. You are a fresh wrapup thread with explicit handoff context from the work agent. You are not here to redesign the solution or make broad new edits. Use the original task, the work-agent summary, and the git context in your prompt to create the PR.\n\n## How to ship\n1. Inspect the current branch and git state. You should be on an agent/* branch with committed work.\n2. If work is uncommitted, make a normal local commit with a clear conventional commit message.\n3. Call git-pull-default to update the local protected/default branch and see whether your branch is behind.\n4. If the default branch moved, decide whether a rebase or merge is needed. Resolve any conflicts locally, then commit the resolution.\n5. Call git-push. If it returns success=false, read the message and fix the git state instead of pretending the push worked.\n6. After git-push succeeds, run gh pr create from the shell. Use a clear title and body based on the work summary.\n - IMPORTANT: gh short-circuits with a login prompt unless GH_TOKEN is set. The VM env has GITHUB_TOKEN set to a mediation placeholder. Always invoke gh with that placeholder copied into GH_TOKEN:\n GH_TOKEN=\"$GITHUB_TOKEN\" gh pr create --base <default> --title \"...\" --body \"...\"\n The controller proxy injects the real token at the wire level.\n7. Return JSON with the PR URL, branch name, pushed commit SHAs if known, and a concise summary.\n\n## Expected successful path\n- You call git-pull-default and confirm default-branch drift.\n- You call git-push and confirm the controller pushed the agent branch.\n- You run GH_TOKEN=\"$GITHUB_TOKEN\" gh pr create and capture the GitHub PR URL.\n- You return JSON with prUrl, branchName, pushedCommits, and summary.\n\n## Important rules\n- The VM has no real GitHub token. Never run raw git push. Always use git-push.\n- gh pr create is allowed; GitHub HTTP traffic is mediated by the controller proxy. Use GH_TOKEN=\"$GITHUB_TOKEN\" prefix with gh.\n- Do not call run_validation here. The work phase already handled validation.\n- Do not call git-push while on the protected/default branch. Create or switch to an agent/* branch first.\n\n## Do not\n- Run git push.\n- Call run_validation here.\n- Start unrelated cleanup.\n- Modify files unless git-pull-default reveals a real conflict or missing commit.\n\n## Return format\n{ \"summary\": \"wrapup result\", \"prUrl\": \"https://github.com/org/repo/pull/1\", \"branchName\": \"agent/name\", \"pushedCommits\": [\"sha\"] }";
8
+ export declare const DEFAULT_WRAPUP_INSTRUCTIONS = "You are in the WRAPUP phase. The work cycle has completed.\n\n## Tools\n- git-pull-default tool: inspect git status, refresh the local default/protected branch, fetch the current branch upstream, and fast-forward the current branch plus reset the worktree only when clean and safe.\n- git-push tool: push the current agent branch through the controller.\n- gh CLI: use GH_TOKEN=\"$GITHUB_TOKEN\" gh pr create from shell after git-push succeeds.\n\n## Your job\nShip the work that was already implemented. You are a fresh wrapup thread with explicit handoff context from the work agent. You are not here to redesign the solution or make broad new edits. Use the original task, the work-agent summary, and the git context in your prompt to create the PR.\n\n## How to ship\n1. Inspect the current branch and git state. You should be on an agent/* branch with committed work.\n2. If work is uncommitted, make a normal local commit with a clear conventional commit message.\n3. Call git-pull-default to update the local protected/default branch and refresh your current branch. Read the returned message. If currentBranchSync.status is fast-forwarded, your branch and worktree have already moved to the new HEAD. If it is up-to-date, ahead, default-branch, diverged, no-upstream, detached, or dirty-worktree, follow the reported action instead of forcing a pull.\n4. If the default branch moved or the current branch diverged, decide whether a rebase or merge is needed. Resolve any conflicts locally, then commit the resolution.\n5. Call git-push. If it returns success=false, read the message and fix the git state instead of pretending the push worked.\n6. After git-push succeeds, run gh pr create from the shell. Use a clear title and body based on the work summary.\n - IMPORTANT: gh short-circuits with a login prompt unless GH_TOKEN is set. The VM env has GITHUB_TOKEN set to a mediation placeholder. Always invoke gh with that placeholder copied into GH_TOKEN:\n GH_TOKEN=\"$GITHUB_TOKEN\" gh pr create --base <default> --title \"...\" --body \"...\"\n The controller proxy injects the real token at the wire level.\n7. Return JSON with the PR URL, branch name, pushed commit SHAs if known, and a concise summary.\n\n## Expected successful path\n- You call git-pull-default and confirm default/current branch drift.\n- You call git-push and confirm the controller pushed the agent branch.\n- You run GH_TOKEN=\"$GITHUB_TOKEN\" gh pr create and capture the GitHub PR URL.\n- You return JSON with prUrl, branchName, pushedCommits, and summary.\n\n## Important rules\n- The VM has no real GitHub token. Never run raw git push. Always use git-push.\n- gh pr create is allowed; GitHub HTTP traffic is mediated by the controller proxy. Use GH_TOKEN=\"$GITHUB_TOKEN\" prefix with gh.\n- Do not call run_validation here. The work phase already handled validation.\n- Do not call git-push while on the protected/default branch. Create or switch to an agent/* branch first.\n\n## Do not\n- Run git push.\n- Call run_validation here.\n- Start unrelated cleanup.\n- Modify files unless git-pull-default reveals a real conflict or missing commit.\n\n## Return format\n{ \"summary\": \"wrapup result\", \"prUrl\": \"https://github.com/org/repo/pull/1\", \"branchName\": \"agent/name\", \"pushedCommits\": [\"sha\"] }";
9
9
  export declare function resolveRoleInstructions(role: Role, configValue: string | null): string;
10
10
  //# sourceMappingURL=prompt-defaults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-defaults.d.ts","sourceRoot":"","sources":["../../src/prompt/prompt-defaults.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,eAAe,GAAG,QAAQ,CAAC;AAE9F,eAAO,MAAM,kCAAkC,w/GAgD9C,CAAC;AAEF,eAAO,MAAM,iCAAiC,u6CA0BiE,CAAC;AAEhH,eAAO,MAAM,+BAA+B,6nBAqBpB,CAAC;AAEzB,eAAO,MAAM,kCAAkC,uvBAyB7C,CAAC;AAEH,eAAO,MAAM,+BAA+B,+vBAsBoB,CAAC;AAEjE,eAAO,MAAM,kCAAkC,qnCA0B7C,CAAC;AAEH,eAAO,MAAM,2BAA2B,m0FAyC4F,CAAC;AAUrI,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEtF"}
1
+ {"version":3,"file":"prompt-defaults.d.ts","sourceRoot":"","sources":["../../src/prompt/prompt-defaults.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,eAAe,GAAG,QAAQ,CAAC;AAE9F,eAAO,MAAM,kCAAkC,ojIAiD9C,CAAC;AAEF,eAAO,MAAM,iCAAiC,49DA2BiE,CAAC;AAEhH,eAAO,MAAM,+BAA+B,wnBAqBpB,CAAC;AAEzB,eAAO,MAAM,kCAAkC,uvBAyB7C,CAAC;AAEH,eAAO,MAAM,+BAA+B,+vBAsBoB,CAAC;AAEjE,eAAO,MAAM,kCAAkC,qnCA0B7C,CAAC;AAEH,eAAO,MAAM,2BAA2B,4vGAyC4F,CAAC;AAUrI,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEtF"}
@@ -1,14 +1,14 @@
1
1
  export const DEFAULT_BUILTIN_AGENT_INSTRUCTIONS = `You are an agent operating inside a sandboxed VM. All outbound network requests go through a mediation proxy.
2
2
 
3
3
  ## Instruction layers
4
- - Runtime instructions are generated by the controller for the current task and are authoritative for workspace paths, resources, and auth hints.
4
+ - Runtime instructions are generated by the controller for the current task and are authoritative for work paths, resources, and auth hints.
5
5
  - Built-in agent instructions are always supplied by the platform.
6
6
  - Common agent instructions apply to every role.
7
7
  - Role instructions apply only to the current phase/role.
8
8
 
9
9
  ## Runtime files
10
- - At task start, read /workspace/AGENTS.md.
11
- - /workspace/AGENTS.md points to the generated runtime index at /agent-vm/agents.md.
10
+ - At task start, read /work/repos/AGENTS.md.
11
+ - /work/repos/AGENTS.md points to the generated runtime index at /agent-vm/agents.md.
12
12
  - /agent-vm/runtime-instructions.md contains the same generated runtime facts injected into this prompt's runtimeInstructions layer.
13
13
  - Runtime instructions contain the task's generated resource bindings, env var names, mocks/output mounts, service tokens, and controller tool facts.
14
14
  - /agent-vm/resources/<repoId>/ contains generated repo-resource output mounts when resources exist.
@@ -25,7 +25,8 @@ export const DEFAULT_BUILTIN_AGENT_INSTRUCTIONS = `You are an agent operating in
25
25
 
26
26
  ## Controller tools
27
27
  - git-push pushes the current branch via the controller. The VM has no real GitHub token; push auth is handled host-side.
28
- - git-pull-default updates the local protected/default branch via the controller and reports drift.
28
+ - git-pull-default inspects git status for you, updates the protected/default branch via the controller, fetches your current branch upstream, and may fast-forward your current branch plus reset the worktree when it is clean and behind upstream.
29
+ - git-pull-default never merges or rebases. Read its message and currentBranchSync.status: fast-forwarded means your branch/worktree moved; up-to-date means no branch change; ahead usually means push; diverged means ask for a merge/rebase plan; dirty-worktree means commit or stash first; no-upstream means push/create upstream; detached means switch/create a branch; default-branch means only the default branch was refreshed.
29
30
  - gh pr create is available for PR creation after git-push succeeds. GitHub API traffic is mediated by the controller proxy.
30
31
  - Agent branches created in this runtime must use the configured prefix: {branchPrefix}.
31
32
  - Use runtimeInstructions for the current task's GitHub service token name and tool hints.
@@ -50,8 +51,8 @@ Always ground assumptions before implementing. Never guess library APIs, archite
50
51
  export const DEFAULT_COMMON_AGENT_INSTRUCTIONS = `## Security
51
52
  - Never print, exfiltrate, or try to discover credentials.
52
53
 
53
- ## Workspace
54
- - Work only inside the workspace directories listed in your task.
54
+ ## Work
55
+ - Work only inside the work directories listed in your task.
55
56
  - Do not modify the .git directory directly.
56
57
  - Preserve unrelated user or agent changes.
57
58
 
@@ -62,7 +63,8 @@ export const DEFAULT_COMMON_AGENT_INSTRUCTIONS = `## Security
62
63
 
63
64
  ## Controller tools
64
65
  - git-push pushes the current branch via the controller. The VM has no real GitHub token; push auth is handled host-side.
65
- - git-pull-default updates the local protected/default branch via the controller and reports drift.
66
+ - git-pull-default inspects git status for you, updates the protected/default branch via the controller, fetches your current branch upstream, and may fast-forward your current branch plus reset the worktree when it is clean and behind upstream.
67
+ - git-pull-default never merges or rebases. Read its message and currentBranchSync.status: fast-forwarded means your branch/worktree moved; up-to-date means no branch change; ahead usually means push; diverged means ask for a merge/rebase plan; dirty-worktree means commit or stash first; no-upstream means push/create upstream; detached means switch/create a branch; default-branch means only the default branch was refreshed.
66
68
  - gh pr create is available for PR creation after git-push succeeds. GitHub API traffic is mediated by the controller proxy.
67
69
 
68
70
  ## Output discipline
@@ -78,7 +80,7 @@ export const DEFAULT_PLAN_AGENT_INSTRUCTIONS = `You are the PLAN agent. Produce
78
80
 
79
81
  ## Inputs
80
82
  - Spec: the user's requested change.
81
- - Repositories: repo URLs, branches, and workspace paths.
83
+ - Repositories: repo URLs, branches, and work paths.
82
84
  - Repo summary: gathered codebase context when available.
83
85
  - Context: extra task metadata.
84
86
 
@@ -175,7 +177,7 @@ export const DEFAULT_WORK_REVIEWER_INSTRUCTIONS = `You are the WORK REVIEWER. Re
175
177
  export const DEFAULT_WRAPUP_INSTRUCTIONS = `You are in the WRAPUP phase. The work cycle has completed.
176
178
 
177
179
  ## Tools
178
- - git-pull-default tool: refresh the local default/protected branch and inspect drift.
180
+ - git-pull-default tool: inspect git status, refresh the local default/protected branch, fetch the current branch upstream, and fast-forward the current branch plus reset the worktree only when clean and safe.
179
181
  - git-push tool: push the current agent branch through the controller.
180
182
  - gh CLI: use GH_TOKEN="$GITHUB_TOKEN" gh pr create from shell after git-push succeeds.
181
183
 
@@ -185,8 +187,8 @@ Ship the work that was already implemented. You are a fresh wrapup thread with e
185
187
  ## How to ship
186
188
  1. Inspect the current branch and git state. You should be on an agent/* branch with committed work.
187
189
  2. If work is uncommitted, make a normal local commit with a clear conventional commit message.
188
- 3. Call git-pull-default to update the local protected/default branch and see whether your branch is behind.
189
- 4. If the default branch moved, decide whether a rebase or merge is needed. Resolve any conflicts locally, then commit the resolution.
190
+ 3. Call git-pull-default to update the local protected/default branch and refresh your current branch. Read the returned message. If currentBranchSync.status is fast-forwarded, your branch and worktree have already moved to the new HEAD. If it is up-to-date, ahead, default-branch, diverged, no-upstream, detached, or dirty-worktree, follow the reported action instead of forcing a pull.
191
+ 4. If the default branch moved or the current branch diverged, decide whether a rebase or merge is needed. Resolve any conflicts locally, then commit the resolution.
190
192
  5. Call git-push. If it returns success=false, read the message and fix the git state instead of pretending the push worked.
191
193
  6. After git-push succeeds, run gh pr create from the shell. Use a clear title and body based on the work summary.
192
194
  - IMPORTANT: gh short-circuits with a login prompt unless GH_TOKEN is set. The VM env has GITHUB_TOKEN set to a mediation placeholder. Always invoke gh with that placeholder copied into GH_TOKEN:
@@ -195,7 +197,7 @@ Ship the work that was already implemented. You are a fresh wrapup thread with e
195
197
  7. Return JSON with the PR URL, branch name, pushed commit SHAs if known, and a concise summary.
196
198
 
197
199
  ## Expected successful path
198
- - You call git-pull-default and confirm default-branch drift.
200
+ - You call git-pull-default and confirm default/current branch drift.
199
201
  - You call git-push and confirm the controller pushed the agent branch.
200
202
  - You run GH_TOKEN="$GITHUB_TOKEN" gh pr create and capture the GitHub PR URL.
201
203
  - You return JSON with prUrl, branchName, pushedCommits, and summary.
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-defaults.js","sourceRoot":"","sources":["../../src/prompt/prompt-defaults.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kCAAkC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDjD,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;+GA0B8D,CAAC;AAEhH,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;wBAqBvB,CAAC;AAEzB,MAAM,CAAC,MAAM,kCAAkC,GAAG;;;;;;;;;;;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,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oIAyCyF,CAAC;AAErI,MAAM,gBAAgB,GAAG;IACxB,YAAY,EAAE,+BAA+B;IAC7C,eAAe,EAAE,kCAAkC;IACnD,YAAY,EAAE,+BAA+B;IAC7C,eAAe,EAAE,kCAAkC;IACnD,MAAM,EAAE,2BAA2B;CACJ,CAAC;AAEjC,MAAM,UAAU,uBAAuB,CAAC,IAAU,EAAE,WAA0B;IAC7E,OAAO,WAAW,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC"}
package/dist/server.d.ts CHANGED
@@ -7,7 +7,8 @@ export declare const createTaskRequestSchema: z.ZodObject<{
7
7
  repos: z.ZodDefault<z.ZodArray<z.ZodObject<{
8
8
  repoUrl: z.ZodString;
9
9
  baseBranch: z.ZodString;
10
- workspacePath: z.ZodString;
10
+ gitDirPath: z.ZodString;
11
+ workPath: z.ZodString;
11
12
  }, z.core.$strip>>>;
12
13
  context: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
14
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAoBvD,eAAO,MAAM,uBAAuB;;;;;;;;;iBAKlC,CAAC;AAEH,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,eAAe,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,CAAC;IACjE,QAAQ,CAAC,UA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AA;KAAE,CAAC,CAAC;IACrD,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,MAAM,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC;IACtE,QAAQ,CAAC,SAAS,EAAE,MAAM,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM;QAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACvB,CAAC;CACF;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAmEhD"}
@@ -7,7 +7,8 @@ export type RepoTarget = z.infer<typeof repoTargetSchema>;
7
7
  export declare const repoLocationSchema: z.ZodObject<{
8
8
  repoUrl: z.ZodString;
9
9
  baseBranch: z.ZodString;
10
- workspacePath: z.ZodString;
10
+ gitDirPath: z.ZodString;
11
+ workPath: z.ZodString;
11
12
  }, z.core.$strip>;
12
13
  export type RepoLocation = z.infer<typeof repoLocationSchema>;
13
14
  //# sourceMappingURL=repo-location.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repo-location.d.ts","sourceRoot":"","sources":["../../src/shared/repo-location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,kBAAkB;;;;iBAE7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"repo-location.d.ts","sourceRoot":"","sources":["../../src/shared/repo-location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,kBAAkB;;;;;iBAG7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -4,6 +4,7 @@ export const repoTargetSchema = z.object({
4
4
  baseBranch: z.string().min(1),
5
5
  });
6
6
  export const repoLocationSchema = repoTargetSchema.extend({
7
- workspacePath: z.string().min(1),
7
+ gitDirPath: z.string().min(1),
8
+ workPath: z.string().min(1),
8
9
  });
9
10
  //# sourceMappingURL=repo-location.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"repo-location.js","sourceRoot":"","sources":["../../src/shared/repo-location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACzD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC"}
1
+ {"version":3,"file":"repo-location.js","sourceRoot":"","sources":["../../src/shared/repo-location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACzD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC3B,CAAC,CAAC"}
@@ -25,7 +25,8 @@ export declare const taskConfigSchema: z.ZodObject<{
25
25
  repos: z.ZodArray<z.ZodObject<{
26
26
  repoUrl: z.ZodString;
27
27
  baseBranch: z.ZodString;
28
- workspacePath: z.ZodString;
28
+ gitDirPath: z.ZodString;
29
+ workPath: z.ZodString;
29
30
  }, z.core.$strip>>;
30
31
  context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
31
32
  effectiveConfig: z.ZodObject<{
@@ -113,7 +114,8 @@ export declare const taskEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
114
  repos: z.ZodArray<z.ZodObject<{
114
115
  repoUrl: z.ZodString;
115
116
  baseBranch: z.ZodString;
116
- workspacePath: z.ZodString;
117
+ gitDirPath: z.ZodString;
118
+ workPath: z.ZodString;
117
119
  }, z.core.$strip>>;
118
120
  context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
119
121
  effectiveConfig: z.ZodObject<{
@@ -268,6 +270,65 @@ export declare const taskEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
268
270
  prUrl: z.ZodNullable<z.ZodString>;
269
271
  branchName: z.ZodNullable<z.ZodString>;
270
272
  pushedCommits: z.ZodArray<z.ZodString>;
273
+ }, z.core.$strip>, z.ZodObject<{
274
+ repoUrl: z.ZodString;
275
+ branch: z.ZodString;
276
+ event: z.ZodLiteral<"controller-git-push-started">;
277
+ }, z.core.$strip>, z.ZodObject<{
278
+ repoUrl: z.ZodString;
279
+ branch: z.ZodString;
280
+ event: z.ZodLiteral<"controller-git-push-retry">;
281
+ attempts: z.ZodNumber;
282
+ message: z.ZodString;
283
+ retryDelaySeconds: z.ZodNumber;
284
+ }, z.core.$strip>, z.ZodObject<{
285
+ repoUrl: z.ZodString;
286
+ branch: z.ZodString;
287
+ event: z.ZodLiteral<"controller-git-push-fetch-retry">;
288
+ attempts: z.ZodNumber;
289
+ message: z.ZodString;
290
+ retryDelaySeconds: z.ZodNumber;
291
+ }, z.core.$strip>, z.ZodObject<{
292
+ repoUrl: z.ZodString;
293
+ branch: z.ZodString;
294
+ event: z.ZodLiteral<"controller-git-push-succeeded">;
295
+ attempts: z.ZodNumber;
296
+ localHead: z.ZodOptional<z.ZodString>;
297
+ remoteBranchHead: z.ZodOptional<z.ZodString>;
298
+ }, z.core.$strip>, z.ZodObject<{
299
+ repoUrl: z.ZodString;
300
+ branch: z.ZodString;
301
+ event: z.ZodLiteral<"controller-git-push-failed">;
302
+ attempts: z.ZodNumber;
303
+ message: z.ZodString;
304
+ phase: z.ZodOptional<z.ZodEnum<{
305
+ push: "push";
306
+ "pre-push-fetch": "pre-push-fetch";
307
+ "post-push-fetch": "post-push-fetch";
308
+ }>>;
309
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
310
+ }, z.core.$strip>, z.ZodObject<{
311
+ repoUrl: z.ZodString;
312
+ event: z.ZodLiteral<"controller-git-pull-started">;
313
+ }, z.core.$strip>, z.ZodObject<{
314
+ repoUrl: z.ZodString;
315
+ event: z.ZodLiteral<"controller-git-pull-retry">;
316
+ attempts: z.ZodNumber;
317
+ message: z.ZodString;
318
+ retryDelaySeconds: z.ZodNumber;
319
+ }, z.core.$strip>, z.ZodObject<{
320
+ repoUrl: z.ZodString;
321
+ event: z.ZodLiteral<"controller-git-pull-succeeded">;
322
+ attempts: z.ZodNumber;
323
+ defaultBranch: z.ZodString;
324
+ remoteDefaultHead: z.ZodOptional<z.ZodString>;
325
+ localDefaultHead: z.ZodOptional<z.ZodString>;
326
+ }, z.core.$strip>, z.ZodObject<{
327
+ repoUrl: z.ZodString;
328
+ event: z.ZodLiteral<"controller-git-pull-failed">;
329
+ attempts: z.ZodNumber;
330
+ message: z.ZodString;
331
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
271
332
  }, z.core.$strip>, z.ZodObject<{
272
333
  event: z.ZodLiteral<"task-completed">;
273
334
  }, z.core.$strip>, z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"task-event-types.d.ts","sourceRoot":"","sources":["../../src/state/task-event-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,eAAe;;;;EAAqB,CAAC;AAClD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,gBAAgB,+HAUS,CAAC;AAEvC,eAAO,MAAM,gBAAgB;;;;;;;;;;EAA2B,CAAC;AACzD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,iBAAiB,4CAA6C,CAAC;AAE5E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAM3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,+BAA+B;;;;;;iBAM1C,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAyH1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CACzB"}
@@ -31,6 +31,13 @@ export const verificationCommandResultSchema = z.object({
31
31
  output: z.string(),
32
32
  logPath: z.string().optional(),
33
33
  });
34
+ const controllerGitPushBaseSchema = z.object({
35
+ repoUrl: z.string().min(1),
36
+ branch: z.string().min(1),
37
+ });
38
+ const controllerGitPullBaseSchema = z.object({
39
+ repoUrl: z.string().min(1),
40
+ });
34
41
  export const taskEventSchema = z.discriminatedUnion('event', [
35
42
  z.object({
36
43
  event: z.literal('task-accepted'),
@@ -92,6 +99,56 @@ export const taskEventSchema = z.discriminatedUnion('event', [
92
99
  branchName: z.string().nullable(),
93
100
  pushedCommits: z.array(z.string()),
94
101
  }),
102
+ controllerGitPushBaseSchema.extend({
103
+ event: z.literal('controller-git-push-started'),
104
+ }),
105
+ controllerGitPushBaseSchema.extend({
106
+ event: z.literal('controller-git-push-retry'),
107
+ attempts: z.number().int().positive(),
108
+ message: z.string(),
109
+ retryDelaySeconds: z.number().positive(),
110
+ }),
111
+ controllerGitPushBaseSchema.extend({
112
+ event: z.literal('controller-git-push-fetch-retry'),
113
+ attempts: z.number().int().positive(),
114
+ message: z.string(),
115
+ retryDelaySeconds: z.number().positive(),
116
+ }),
117
+ controllerGitPushBaseSchema.extend({
118
+ event: z.literal('controller-git-push-succeeded'),
119
+ attempts: z.number().int().positive(),
120
+ localHead: z.string().optional(),
121
+ remoteBranchHead: z.string().optional(),
122
+ }),
123
+ controllerGitPushBaseSchema.extend({
124
+ event: z.literal('controller-git-push-failed'),
125
+ attempts: z.number().int().nonnegative(),
126
+ message: z.string(),
127
+ phase: z.enum(['pre-push-fetch', 'push', 'post-push-fetch']).optional(),
128
+ retryAfterSeconds: z.number().int().positive().optional(),
129
+ }),
130
+ controllerGitPullBaseSchema.extend({
131
+ event: z.literal('controller-git-pull-started'),
132
+ }),
133
+ controllerGitPullBaseSchema.extend({
134
+ event: z.literal('controller-git-pull-retry'),
135
+ attempts: z.number().int().positive(),
136
+ message: z.string(),
137
+ retryDelaySeconds: z.number().positive(),
138
+ }),
139
+ controllerGitPullBaseSchema.extend({
140
+ event: z.literal('controller-git-pull-succeeded'),
141
+ attempts: z.number().int().positive(),
142
+ defaultBranch: z.string().min(1),
143
+ remoteDefaultHead: z.string().optional(),
144
+ localDefaultHead: z.string().optional(),
145
+ }),
146
+ controllerGitPullBaseSchema.extend({
147
+ event: z.literal('controller-git-pull-failed'),
148
+ attempts: z.number().int().nonnegative(),
149
+ message: z.string(),
150
+ retryAfterSeconds: z.number().int().positive().optional(),
151
+ }),
95
152
  z.object({
96
153
  event: z.literal('task-completed'),
97
154
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"task-event-types.js","sourceRoot":"","sources":["../../src/state/task-event-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAGlD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,SAAS;IACT,YAAY;IACZ,eAAe;IACf,YA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,CAAC,CAAC,MAAM,CAAC;QACR,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;KAClC,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACR,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;KAClB,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACR,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;KAC/B,CAAC;CACF,CAAC,CAAC"}
@@ -1,5 +1,28 @@
1
1
  import type { ReviewResult } from '../shared/review-result.js';
2
2
  import type { TaskConfig, TaskEvent, TaskStatus, VerificationCommandResult } from './task-event-types.js';
3
+ export interface ControllerGitPushState {
4
+ readonly repoUrl: string;
5
+ readonly branch: string;
6
+ readonly status: 'started' | 'retrying' | 'succeeded' | 'failed';
7
+ readonly attempts: number;
8
+ readonly message: string | null;
9
+ readonly phase: 'pre-push-fetch' | 'push' | 'post-push-fetch' | null;
10
+ readonly retryDelaySeconds: number | null;
11
+ readonly retryAfterSeconds: number | null;
12
+ readonly localHead: string | null;
13
+ readonly remoteBranchHead: string | null;
14
+ }
15
+ export interface ControllerGitPullState {
16
+ readonly repoUrl: string;
17
+ readonly status: 'started' | 'retrying' | 'succeeded' | 'failed';
18
+ readonly attempts: number;
19
+ readonly message: string | null;
20
+ readonly retryDelaySeconds: number | null;
21
+ readonly retryAfterSeconds: number | null;
22
+ readonly defaultBranch: string | null;
23
+ readonly remoteDefaultHead: string | null;
24
+ readonly localDefaultHead: string | null;
25
+ }
3
26
  export interface TaskState {
4
27
  readonly taskId: string;
5
28
  readonly status: TaskStatus;
@@ -24,6 +47,10 @@ export interface TaskState {
24
47
  readonly branchName: string | null;
25
48
  readonly pushedCommits: readonly string[];
26
49
  } | null;
50
+ readonly controllerOperations: {
51
+ readonly gitPushes: readonly ControllerGitPushState[];
52
+ readonly gitPulls: readonly ControllerGitPullState[];
53
+ };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E,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,SAAS,CA8BhF;AA4CD,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,CAqNxE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAEpD;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CA0BtF;AAED,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAyBzF"}
@@ -31,6 +31,10 @@ export function createInitialState(taskId, config) {
31
31
  lastWorkReview: null,
32
32
  lastValidationResults: null,
33
33
  wrapupResult: null,
34
+ controllerOperations: {
35
+ gitPushes: [],
36
+ gitPulls: [],
37
+ },
34
38
  createdAt: now,
35
39
  updatedAt: now,
36
40
  };
@@ -49,6 +53,26 @@ function maxCyclesForPhase(state, phase) {
49
53
  const exhaustivePhase = phase;
50
54
  throw new Error(`Unhandled phase '${String(exhaustivePhase)}'.`);
51
55
  }
56
+ function upsertGitPushState(state, nextPushState) {
57
+ const gitPushes = state.controllerOperations.gitPushes.filter((pushState) => pushState.repoUrl !== nextPushState.repoUrl || pushState.branch !== nextPushState.branch);
58
+ return {
59
+ ...state,
60
+ controllerOperations: {
61
+ ...state.controllerOperations,
62
+ gitPushes: [...gitPushes, nextPushState],
63
+ },
64
+ };
65
+ }
66
+ function upsertGitPullState(state, nextPullState) {
67
+ const gitPulls = state.controllerOperations.gitPulls.filter((pullState) => pullState.repoUrl !== nextPullState.repoUrl);
68
+ return {
69
+ ...state,
70
+ controllerOperations: {
71
+ ...state.controllerOperations,
72
+ gitPulls: [...gitPulls, nextPullState],
73
+ },
74
+ };
75
+ }
52
76
  export function applyEvent(state, event) {
53
77
  const updatedAt = new Date().toISOString();
54
78
  switch (event.event) {
@@ -123,6 +147,133 @@ export function applyEvent(state, event) {
123
147
  },
124
148
  updatedAt,
125
149
  };
150
+ case 'controller-git-push-started':
151
+ return {
152
+ ...upsertGitPushState(state, {
153
+ repoUrl: event.repoUrl,
154
+ branch: event.branch,
155
+ status: 'started',
156
+ attempts: 0,
157
+ message: null,
158
+ phase: null,
159
+ retryDelaySeconds: null,
160
+ retryAfterSeconds: null,
161
+ localHead: null,
162
+ remoteBranchHead: null,
163
+ }),
164
+ updatedAt,
165
+ };
166
+ case 'controller-git-push-retry':
167
+ return {
168
+ ...upsertGitPushState(state, {
169
+ repoUrl: event.repoUrl,
170
+ branch: event.branch,
171
+ status: 'retrying',
172
+ attempts: event.attempts,
173
+ message: event.message,
174
+ phase: 'push',
175
+ retryDelaySeconds: event.retryDelaySeconds,
176
+ retryAfterSeconds: null,
177
+ localHead: null,
178
+ remoteBranchHead: null,
179
+ }),
180
+ updatedAt,
181
+ };
182
+ case 'controller-git-push-fetch-retry':
183
+ // Pre-push default-branch fetch retries are logged without surfacing a phantom push.
184
+ return { ...state, updatedAt };
185
+ case 'controller-git-push-succeeded':
186
+ return {
187
+ ...upsertGitPushState(state, {
188
+ repoUrl: event.repoUrl,
189
+ branch: event.branch,
190
+ status: 'succeeded',
191
+ attempts: event.attempts,
192
+ message: null,
193
+ phase: null,
194
+ retryDelaySeconds: null,
195
+ retryAfterSeconds: null,
196
+ localHead: event.localHead ?? null,
197
+ remoteBranchHead: event.remoteBranchHead ?? null,
198
+ }),
199
+ updatedAt,
200
+ };
201
+ case 'controller-git-push-failed':
202
+ return {
203
+ ...upsertGitPushState(state, {
204
+ repoUrl: event.repoUrl,
205
+ branch: event.branch,
206
+ status: 'failed',
207
+ attempts: event.attempts,
208
+ message: event.message,
209
+ phase: event.phase ?? null,
210
+ retryDelaySeconds: null,
211
+ retryAfterSeconds: event.retryAfterSeconds ?? null,
212
+ localHead: null,
213
+ remoteBranchHead: null,
214
+ }),
215
+ updatedAt,
216
+ };
217
+ case 'controller-git-pull-started':
218
+ return {
219
+ ...upsertGitPullState(state, {
220
+ repoUrl: event.repoUrl,
221
+ status: 'started',
222
+ attempts: 0,
223
+ message: null,
224
+ retryDelaySeconds: null,
225
+ retryAfterSeconds: null,
226
+ defaultBranch: null,
227
+ remoteDefaultHead: null,
228
+ localDefaultHead: null,
229
+ }),
230
+ updatedAt,
231
+ };
232
+ case 'controller-git-pull-retry':
233
+ return {
234
+ ...upsertGitPullState(state, {
235
+ repoUrl: event.repoUrl,
236
+ status: 'retrying',
237
+ attempts: event.attempts,
238
+ message: event.message,
239
+ retryDelaySeconds: event.retryDelaySeconds,
240
+ retryAfterSeconds: null,
241
+ defaultBranch: null,
242
+ remoteDefaultHead: null,
243
+ localDefaultHead: null,
244
+ }),
245
+ updatedAt,
246
+ };
247
+ case 'controller-git-pull-succeeded':
248
+ return {
249
+ ...upsertGitPullState(state, {
250
+ repoUrl: event.repoUrl,
251
+ status: 'succeeded',
252
+ attempts: event.attempts,
253
+ message: null,
254
+ retryDelaySeconds: null,
255
+ retryAfterSeconds: null,
256
+ defaultBranch: event.defaultBranch,
257
+ remoteDefaultHead: event.remoteDefaultHead ?? null,
258
+ localDefaultHead: event.localDefaultHead ?? null,
259
+ }),
260
+ updatedAt,
261
+ };
262
+ case 'controller-git-pull-failed':
263
+ return {
264
+ ...upsertGitPullState(state, {
265
+ repoUrl: event.repoUrl,
266
+ status: 'failed',
267
+ attempts: event.attempts,
268
+ message: event.message,
269
+ retryDelaySeconds: null,
270
+ retryAfterSeconds: event.retryAfterSeconds ?? null,
271
+ defaultBranch: null,
272
+ remoteDefaultHead: null,
273
+ localDefaultHead: null,
274
+ }),
275
+ updatedAt,
276
+ };
126
277
  case 'task-completed':
127
278
  return { ...state, status: 'completed', updatedAt };
128
279
  case 'task-failed':