@agent-vm/agent-vm-worker 0.0.20
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.
- package/LICENSE +21 -0
- package/dist/config/worker-config.d.ts +158 -0
- package/dist/config/worker-config.d.ts.map +1 -0
- package/dist/config/worker-config.js +280 -0
- package/dist/config/worker-config.js.map +1 -0
- package/dist/context/gather-context.d.ts +9 -0
- package/dist/context/gather-context.d.ts.map +1 -0
- package/dist/context/gather-context.js +72 -0
- package/dist/context/gather-context.js.map +1 -0
- package/dist/coordinator/coordinator-helpers.d.ts +13 -0
- package/dist/coordinator/coordinator-helpers.d.ts.map +1 -0
- package/dist/coordinator/coordinator-helpers.js +63 -0
- package/dist/coordinator/coordinator-helpers.js.map +1 -0
- package/dist/coordinator/coordinator-types.d.ts +25 -0
- package/dist/coordinator/coordinator-types.d.ts.map +1 -0
- package/dist/coordinator/coordinator-types.js +2 -0
- package/dist/coordinator/coordinator-types.js.map +1 -0
- package/dist/coordinator/coordinator.d.ts +4 -0
- package/dist/coordinator/coordinator.d.ts.map +1 -0
- package/dist/coordinator/coordinator.js +74 -0
- package/dist/coordinator/coordinator.js.map +1 -0
- package/dist/coordinator/task-runner.d.ts +5 -0
- package/dist/coordinator/task-runner.d.ts.map +1 -0
- package/dist/coordinator/task-runner.js +310 -0
- package/dist/coordinator/task-runner.js.map +1 -0
- package/dist/git/git-operations.d.ts +33 -0
- package/dist/git/git-operations.d.ts.map +1 -0
- package/dist/git/git-operations.js +109 -0
- package/dist/git/git-operations.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +11 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +140 -0
- package/dist/main.js.map +1 -0
- package/dist/plan-phase/plan-cycle.d.ts +27 -0
- package/dist/plan-phase/plan-cycle.d.ts.map +1 -0
- package/dist/plan-phase/plan-cycle.js +83 -0
- package/dist/plan-phase/plan-cycle.js.map +1 -0
- package/dist/prompt/message-builders.d.ts +44 -0
- package/dist/prompt/message-builders.d.ts.map +1 -0
- package/dist/prompt/message-builders.js +83 -0
- package/dist/prompt/message-builders.js.map +1 -0
- package/dist/prompt/prompt-assembler.d.ts +11 -0
- package/dist/prompt/prompt-assembler.d.ts.map +1 -0
- package/dist/prompt/prompt-assembler.js +34 -0
- package/dist/prompt/prompt-assembler.js.map +1 -0
- package/dist/prompt/prompt-defaults.d.ts +10 -0
- package/dist/prompt/prompt-defaults.d.ts.map +1 -0
- package/dist/prompt/prompt-defaults.js +200 -0
- package/dist/prompt/prompt-defaults.js.map +1 -0
- package/dist/server.d.ts +32 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +75 -0
- package/dist/server.js.map +1 -0
- package/dist/shared/phase-names.d.ts +8 -0
- package/dist/shared/phase-names.d.ts.map +1 -0
- package/dist/shared/phase-names.js +11 -0
- package/dist/shared/phase-names.js.map +1 -0
- package/dist/shared/repo-location.d.ts +13 -0
- package/dist/shared/repo-location.d.ts.map +1 -0
- package/dist/shared/repo-location.js +9 -0
- package/dist/shared/repo-location.js.map +1 -0
- package/dist/shared/review-result.d.ts +17 -0
- package/dist/shared/review-result.d.ts.map +1 -0
- package/dist/shared/review-result.js +12 -0
- package/dist/shared/review-result.js.map +1 -0
- package/dist/shared/skill-types.d.ts +7 -0
- package/dist/shared/skill-types.d.ts.map +1 -0
- package/dist/shared/skill-types.js +6 -0
- package/dist/shared/skill-types.js.map +1 -0
- package/dist/shared/stderr.d.ts +2 -0
- package/dist/shared/stderr.d.ts.map +1 -0
- package/dist/shared/stderr.js +4 -0
- package/dist/shared/stderr.js.map +1 -0
- package/dist/state/event-log.d.ts +4 -0
- package/dist/state/event-log.d.ts.map +1 -0
- package/dist/state/event-log.js +67 -0
- package/dist/state/event-log.js.map +1 -0
- package/dist/state/task-event-types.d.ts +280 -0
- package/dist/state/task-event-types.d.ts.map +1 -0
- package/dist/state/task-event-types.js +106 -0
- package/dist/state/task-event-types.js.map +1 -0
- package/dist/state/task-state.d.ts +35 -0
- package/dist/state/task-state.d.ts.map +1 -0
- package/dist/state/task-state.js +191 -0
- package/dist/state/task-state.js.map +1 -0
- package/dist/validation-runner/verification-runner.d.ts +30 -0
- package/dist/validation-runner/verification-runner.d.ts.map +1 -0
- package/dist/validation-runner/verification-runner.js +196 -0
- package/dist/validation-runner/verification-runner.js.map +1 -0
- package/dist/work-executor/codex-executor.d.ts +9 -0
- package/dist/work-executor/codex-executor.d.ts.map +1 -0
- package/dist/work-executor/codex-executor.js +159 -0
- package/dist/work-executor/codex-executor.js.map +1 -0
- package/dist/work-executor/executor-factory.d.ts +4 -0
- package/dist/work-executor/executor-factory.d.ts.map +1 -0
- package/dist/work-executor/executor-factory.js +17 -0
- package/dist/work-executor/executor-factory.js.map +1 -0
- package/dist/work-executor/executor-interface.d.ts +33 -0
- package/dist/work-executor/executor-interface.d.ts.map +1 -0
- package/dist/work-executor/executor-interface.js +2 -0
- package/dist/work-executor/executor-interface.js.map +1 -0
- package/dist/work-executor/local-tool-mcp-server.d.ts +8 -0
- package/dist/work-executor/local-tool-mcp-server.d.ts.map +1 -0
- package/dist/work-executor/local-tool-mcp-server.js +187 -0
- package/dist/work-executor/local-tool-mcp-server.js.map +1 -0
- package/dist/work-executor/persistent-thread.d.ts +16 -0
- package/dist/work-executor/persistent-thread.d.ts.map +1 -0
- package/dist/work-executor/persistent-thread.js +37 -0
- package/dist/work-executor/persistent-thread.js.map +1 -0
- package/dist/work-phase/controller-tools/controller-tool-support.d.ts +19 -0
- package/dist/work-phase/controller-tools/controller-tool-support.d.ts.map +1 -0
- package/dist/work-phase/controller-tools/controller-tool-support.js +92 -0
- package/dist/work-phase/controller-tools/controller-tool-support.js.map +1 -0
- package/dist/work-phase/controller-tools/git-pull-default-tool.d.ts +10 -0
- package/dist/work-phase/controller-tools/git-pull-default-tool.d.ts.map +1 -0
- package/dist/work-phase/controller-tools/git-pull-default-tool.js +36 -0
- package/dist/work-phase/controller-tools/git-pull-default-tool.js.map +1 -0
- package/dist/work-phase/controller-tools/git-push-tool.d.ts +10 -0
- package/dist/work-phase/controller-tools/git-push-tool.d.ts.map +1 -0
- package/dist/work-phase/controller-tools/git-push-tool.js +45 -0
- package/dist/work-phase/controller-tools/git-push-tool.js.map +1 -0
- package/dist/work-phase/validation-tool.d.ts +11 -0
- package/dist/work-phase/validation-tool.d.ts.map +1 -0
- package/dist/work-phase/validation-tool.js +25 -0
- package/dist/work-phase/validation-tool.js.map +1 -0
- package/dist/work-phase/work-cycle.d.ts +28 -0
- package/dist/work-phase/work-cycle.d.ts.map +1 -0
- package/dist/work-phase/work-cycle.js +122 -0
- package/dist/work-phase/work-cycle.js.map +1 -0
- package/dist/wrapup-phase/wrapup-runner.d.ts +30 -0
- package/dist/wrapup-phase/wrapup-runner.d.ts.map +1 -0
- package/dist/wrapup-phase/wrapup-runner.js +91 -0
- package/dist/wrapup-phase/wrapup-runner.js.map +1 -0
- package/package.json +57 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { computeTotalTaskTimeoutMs, loadWorkerConfig, resolveModelAlias, resolvePhaseExecutor, resolveWorkerConfigInstructionReferences, workerConfigSchema, type WorkerConfig, } from './config/worker-config.js';
|
|
2
|
+
export { createCoordinator, type Coordinator, type CreateTaskInput, } from './coordinator/coordinator.js';
|
|
3
|
+
export { gatherContext, readOptionalFile, type RepoContext } from './context/gather-context.js';
|
|
4
|
+
export { buildCommitMessage, configureGit, createBranch, getDiff, getDiffStat, parseRepoFromUrl, sanitizeBranchName, stageAndCommit, } from './git/git-operations.js';
|
|
5
|
+
export { DEFAULT_BASE_INSTRUCTIONS, DEFAULT_PLAN_AGENT_INSTRUCTIONS, DEFAULT_PLAN_REVIEWER_INSTRUCTIONS, DEFAULT_WORK_AGENT_INSTRUCTIONS, DEFAULT_WORK_REVIEWER_INSTRUCTIONS, DEFAULT_WRAPUP_INSTRUCTIONS, interpolateBaseInstructions, resolveRoleInstructions, type Role, } from './prompt/prompt-defaults.js';
|
|
6
|
+
export { buildRoleSystemPrompt } from './prompt/prompt-assembler.js';
|
|
7
|
+
export { buildInitialPlanMessage, buildInitialWorkMessage, buildPlanReviewMessage, buildPlanReviseMessage, buildWorkReviewMessage, buildWorkReviseMessage, } from './prompt/message-builders.js';
|
|
8
|
+
export { createTaskRequestSchema, createApp, type ServerDeps } from './server.js';
|
|
9
|
+
export { appendEvent, replayEvents } from './state/event-log.js';
|
|
10
|
+
export { applyEvent, createInitialState, hydrateTaskStates, isTerminal, loadTaskStateFromLog, type TaskState, } from './state/task-state.js';
|
|
11
|
+
export type { PhaseName, TaskConfig, TaskEvent, TaskStatus, TimestampedEvent, VerificationCommandResult, } from './state/task-event-types.js';
|
|
12
|
+
export { reviewResultSchema, type ReviewResult } from './shared/review-result.js';
|
|
13
|
+
export { repoLocationSchema, repoTargetSchema, type RepoLocation, type RepoTarget, } from './shared/repo-location.js';
|
|
14
|
+
export { skillReferenceSchema, type SkillReference } from './shared/skill-types.js';
|
|
15
|
+
export { createCodexExecutor, type CodexExecutorConfig } from './work-executor/codex-executor.js';
|
|
16
|
+
export { createWorkExecutor } from './work-executor/executor-factory.js';
|
|
17
|
+
export type { ExecutorCapabilities, ExecutorResult, StructuredInput, ToolDefinition, WorkExecutor, } from './work-executor/executor-interface.js';
|
|
18
|
+
export { createPersistentThread, type PersistentThread, type PersistentThreadResponse, } from './work-executor/persistent-thread.js';
|
|
19
|
+
export { allVerificationsPassed, buildVerificationFailureSummary, parseCommand, runCommandWithTimeout, runVerification, type RunVerificationOptions, type VerificationCommand, } from './validation-runner/verification-runner.js';
|
|
20
|
+
export { buildValidationTool } from './work-phase/validation-tool.js';
|
|
21
|
+
export { createGitPullDefaultTool } from './work-phase/controller-tools/git-pull-default-tool.js';
|
|
22
|
+
export { createGitPushTool } from './work-phase/controller-tools/git-push-tool.js';
|
|
23
|
+
export { runWorkCycle, type WorkCycleResult } from './work-phase/work-cycle.js';
|
|
24
|
+
export { runWrapup, type WrapupRunResult } from './wrapup-phase/wrapup-runner.js';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,wCAAwC,EACxC,kBAAkB,EAClB,KAAK,YAAY,GACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,yBAAyB,EACzB,+BAA+B,EAC/B,kCAAkC,EAClC,+BAA+B,EAC/B,kCAAkC,EAClC,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,KAAK,IAAI,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACN,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACN,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,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alTaskTimeoutMs, loadWorkerConfig, resolveModelAlias, resolvePhaseExecutor, resolveWorkerConfigInstructionReferences, workerConfigSchema, } from './config/worker-config.js';
|
|
2
|
+
export { createCoordinator, } from './coordinator/coordinator.js';
|
|
3
|
+
export { gatherContext, readOptionalFile } from './context/gather-context.js';
|
|
4
|
+
export { buildCommitMessage, configureGit, createBranch, getDiff, getDiffStat, parseRepoFromUrl, sanitizeBranchName, stageAndCommit, } from './git/git-operations.js';
|
|
5
|
+
export { DEFAULT_BASE_INSTRUCTIONS, DEFAULT_PLAN_AGENT_INSTRUCTIONS, DEFAULT_PLAN_REVIEWER_INSTRUCTIONS, DEFAULT_WORK_AGENT_INSTRUCTIONS, DEFAULT_WORK_REVIEWER_INSTRUCTIONS, DEFAULT_WRAPUP_INSTRUCTIONS, interpolateBaseInstructions, resolveRoleInstructions, } from './prompt/prompt-defaults.js';
|
|
6
|
+
export { buildRoleSystemPrompt } from './prompt/prompt-assembler.js';
|
|
7
|
+
export { buildInitialPlanMessage, buildInitialWorkMessage, buildPlanReviewMessage, buildPlanReviseMessage, buildWorkReviewMessage, buildWorkReviseMessage, } from './prompt/message-builders.js';
|
|
8
|
+
export { createTaskRequestSchema, createApp } from './server.js';
|
|
9
|
+
export { appendEvent, replayEvents } from './state/event-log.js';
|
|
10
|
+
export { applyEvent, createInitialState, hydrateTaskStates, isTerminal, loadTaskStateFromLog, } from './state/task-state.js';
|
|
11
|
+
export { reviewResultSchema } from './shared/review-result.js';
|
|
12
|
+
export { repoLocationSchema, repoTargetSchema, } from './shared/repo-location.js';
|
|
13
|
+
export { skillReferenceSchema } from './shared/skill-types.js';
|
|
14
|
+
export { createCodexExecutor } from './work-executor/codex-executor.js';
|
|
15
|
+
export { createWorkExecutor } from './work-executor/executor-factory.js';
|
|
16
|
+
export { createPersistentThread, } from './work-executor/persistent-thread.js';
|
|
17
|
+
export { allVerificationsPassed, buildVerificationFailureSummary, parseCommand, runCommandWithTimeout, runVerification, } from './validation-runner/verification-runner.js';
|
|
18
|
+
export { buildValidationTool } from './work-phase/validation-tool.js';
|
|
19
|
+
export { createGitPullDefaultTool } from './work-phase/controller-tools/git-pull-default-tool.js';
|
|
20
|
+
export { createGitPushTool } from './work-phase/controller-tools/git-push-tool.js';
|
|
21
|
+
export { runWorkCycle } from './work-phase/work-cycle.js';
|
|
22
|
+
export { runWrapup } from './wrapup-phase/wrapup-runner.js';
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,wCAAwC,EACxC,kBAAkB,GAElB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,iBAAiB,GAGjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAoB,MAAM,6BAA6B,CAAC;AAChG,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,yBAAyB,EACzB,+BAA+B,EAC/B,kCAAkC,EAClC,+BAA+B,EAC/B,kCAAkC,EAClC,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,GAEvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACN,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACN,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,oBAAoB,GAEpB,MAAM,uBAAuB,CAAC;AAS/B,OAAO,EAAE,kBAAkB,EAAqB,MAAM,2BAA2B,CAAC;AAClF,OAAO,EACN,kBAAkB,EAClB,gBAAgB,GAGhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAuB,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAA4B,MAAM,mCAAmC,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAQzE,OAAO,EACN,sBAAsB,GAGtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,sBAAsB,EACtB,+BAA+B,EAC/B,YAAY,EACZ,qBAAqB,EACrB,eAAe,GAGf,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,YAAY,EAAwB,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAwB,MAAM,iCAAiC,CAAC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export declare class ReportedCliError extends Error {
|
|
3
|
+
}
|
|
4
|
+
export interface CliIo {
|
|
5
|
+
readonly stdout: Pick<NodeJS.WriteStream, 'write'>;
|
|
6
|
+
readonly stderr: Pick<NodeJS.WriteStream, 'write'>;
|
|
7
|
+
}
|
|
8
|
+
export declare function runAgentVmWorkerCli(argv: readonly string[], io?: CliIo): Promise<void>;
|
|
9
|
+
export declare function handleCliMainError(error: unknown, stderr: Pick<NodeJS.WriteStream, 'write'>): void;
|
|
10
|
+
export declare function main(argv?: readonly string[]): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAaA,qBAAa,gBAAiB,SAAQ,KAAK;CAAG;AAE9C,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CACnD;AAyGD,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,GAAE,KAA0D,GAC5D,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GACvC,IAAI,CAKN;AAED,wBAAsB,IAAI,CAAC,IAAI,GAAE,SAAS,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAKzF"}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { serve } from '@hono/node-server';
|
|
3
|
+
import { command, number, option, optional, runSafely, string, subcommands } from 'cmd-ts';
|
|
4
|
+
import { loadWorkerConfig, resolvePhaseExecutor } from './config/worker-config.js';
|
|
5
|
+
import { createCoordinator } from './coordinator/coordinator.js';
|
|
6
|
+
import { createApp } from './server.js';
|
|
7
|
+
function writeStdout(message) {
|
|
8
|
+
process.stdout.write(`${message}\n`);
|
|
9
|
+
}
|
|
10
|
+
export class ReportedCliError extends Error {
|
|
11
|
+
}
|
|
12
|
+
function isHelpRequest(argv) {
|
|
13
|
+
return argv.includes('--help') || argv.includes('-h');
|
|
14
|
+
}
|
|
15
|
+
const serveCommand = command({
|
|
16
|
+
name: 'serve',
|
|
17
|
+
description: 'Start the agent-vm-worker HTTP server',
|
|
18
|
+
args: {
|
|
19
|
+
port: option({
|
|
20
|
+
type: number,
|
|
21
|
+
long: 'port',
|
|
22
|
+
short: 'p',
|
|
23
|
+
defaultValue: () => 18789,
|
|
24
|
+
description: 'Port to listen on',
|
|
25
|
+
}),
|
|
26
|
+
config: option({
|
|
27
|
+
type: optional(string),
|
|
28
|
+
long: 'config',
|
|
29
|
+
short: 'c',
|
|
30
|
+
description: 'Path to worker config JSON',
|
|
31
|
+
}),
|
|
32
|
+
stateDir: option({
|
|
33
|
+
type: optional(string),
|
|
34
|
+
long: 'state-dir',
|
|
35
|
+
description: 'State directory path',
|
|
36
|
+
}),
|
|
37
|
+
},
|
|
38
|
+
handler: async (args) => {
|
|
39
|
+
const configPath = args.config ?? process.env.WORKER_CONFIG_PATH ?? undefined;
|
|
40
|
+
const baseConfig = await loadWorkerConfig(configPath);
|
|
41
|
+
const config = args.stateDir ? { ...baseConfig, stateDir: args.stateDir } : baseConfig;
|
|
42
|
+
const workspaceDir = process.env.WORKSPACE_DIR ?? '/workspace';
|
|
43
|
+
const startTime = Date.now();
|
|
44
|
+
const coordinator = await createCoordinator({ config, workspaceDir });
|
|
45
|
+
const defaultExecutor = resolvePhaseExecutor(config, {});
|
|
46
|
+
const app = createApp({
|
|
47
|
+
getActiveTaskId: () => coordinator.getActiveTaskId(),
|
|
48
|
+
getActiveTaskStatus: () => {
|
|
49
|
+
const activeTaskId = coordinator.getActiveTaskId();
|
|
50
|
+
if (!activeTaskId)
|
|
51
|
+
return null;
|
|
52
|
+
return coordinator.getTaskState(activeTaskId)?.status ?? null;
|
|
53
|
+
},
|
|
54
|
+
getTaskState: (taskId) => coordinator.getTaskState(taskId),
|
|
55
|
+
submitTask: async (input) => coordinator.submitTask(input),
|
|
56
|
+
closeTask: async (taskId) => coordinator.closeTask(taskId),
|
|
57
|
+
getUptime: () => Math.floor((Date.now() - startTime) / 1000),
|
|
58
|
+
getExecutorInfo: () => ({
|
|
59
|
+
provider: defaultExecutor.provider,
|
|
60
|
+
model: defaultExecutor.model,
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
serve({
|
|
64
|
+
fetch: app.fetch,
|
|
65
|
+
port: args.port,
|
|
66
|
+
}, (info) => {
|
|
67
|
+
writeStdout(`[agent-vm-worker] Server listening on http://localhost:${info.port}`);
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
const healthCommand = command({
|
|
72
|
+
name: 'health',
|
|
73
|
+
description: 'Check worker health',
|
|
74
|
+
args: {
|
|
75
|
+
port: option({
|
|
76
|
+
type: number,
|
|
77
|
+
long: 'port',
|
|
78
|
+
short: 'p',
|
|
79
|
+
defaultValue: () => 18789,
|
|
80
|
+
description: 'Port to check',
|
|
81
|
+
}),
|
|
82
|
+
},
|
|
83
|
+
handler: async (args) => {
|
|
84
|
+
try {
|
|
85
|
+
const response = await fetch(`http://localhost:${args.port}/health`);
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
throw new Error(`Health check failed: ${response.status}`);
|
|
88
|
+
}
|
|
89
|
+
const data = await response.json();
|
|
90
|
+
writeStdout(JSON.stringify(data, null, 2));
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
throw new Error(`Health check failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
const app = subcommands({
|
|
98
|
+
name: 'agent-vm-worker',
|
|
99
|
+
description: 'Configurable task worker for Gondolin VMs',
|
|
100
|
+
cmds: {
|
|
101
|
+
serve: serveCommand,
|
|
102
|
+
health: healthCommand,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
export async function runAgentVmWorkerCli(argv, io = { stdout: process.stdout, stderr: process.stderr }) {
|
|
106
|
+
const result = await runSafely(app, [...argv]);
|
|
107
|
+
if (result._tag === 'ok') {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const outputStream = result.error.config.into === 'stderr' ? io.stderr : io.stdout;
|
|
111
|
+
outputStream.write(result.error.config.message);
|
|
112
|
+
if (!result.error.config.message.endsWith('\n')) {
|
|
113
|
+
outputStream.write('\n');
|
|
114
|
+
}
|
|
115
|
+
// cmd-ts subcommands still surface top-level help as a stdout Exit with nonzero exitCode.
|
|
116
|
+
// We keep cmd-ts's generated help text verbatim and only normalize that help path to success.
|
|
117
|
+
if (result.error.config.into === 'stdout' && isHelpRequest(argv)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (result.error.config.exitCode !== 0) {
|
|
121
|
+
throw new ReportedCliError(result.error.config.message);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export function handleCliMainError(error, stderr) {
|
|
125
|
+
if (error instanceof ReportedCliError) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
129
|
+
}
|
|
130
|
+
export async function main(argv = process.argv.slice(2)) {
|
|
131
|
+
await runAgentVmWorkerCli(argv, {
|
|
132
|
+
stdout: process.stdout,
|
|
133
|
+
stderr: process.stderr,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
void main().catch((error) => {
|
|
137
|
+
handleCliMainError(error, process.stderr);
|
|
138
|
+
process.exitCode = 1;
|
|
139
|
+
});
|
|
140
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,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AAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;AACF,CAAC;AAED,MAAM,UAAU,kBAAkB,CACjC,KAAc,EACd,MAAyC;IAEzC,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;QACvC,OAAO;IACR,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAA0B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE,MAAM,mBAAmB,CAAC,IAAI,EAAE;QAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;KACtB,CAAC,CAAC;AACJ,CAAC;AAED,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC3B,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PlanCycleConfig } from '../config/worker-config.js';
|
|
2
|
+
import type { RepoLocation } from '../shared/repo-location.js';
|
|
3
|
+
import { type ReviewResult } from '../shared/review-result.js';
|
|
4
|
+
import type { PersistentThread, PersistentThreadResponse } from '../work-executor/persistent-thread.js';
|
|
5
|
+
export interface RunPlanCycleProps {
|
|
6
|
+
readonly spec: string;
|
|
7
|
+
readonly repos: readonly RepoLocation[];
|
|
8
|
+
readonly repoSummary: string | null;
|
|
9
|
+
readonly context: Record<string, unknown>;
|
|
10
|
+
readonly cycle: PlanCycleConfig;
|
|
11
|
+
readonly planThread: PersistentThread;
|
|
12
|
+
/** Required when cycle.kind === 'review'; unused when 'noReview'. */
|
|
13
|
+
readonly reviewThread: PersistentThread | null;
|
|
14
|
+
readonly systemPromptPlanAgent: string;
|
|
15
|
+
/** Required when cycle.kind === 'review'; unused when 'noReview'. */
|
|
16
|
+
readonly systemPromptPlanReviewer: string | null;
|
|
17
|
+
readonly onPlanAgentTurn: (cycle: number, result: PersistentThreadResponse) => void | Promise<void>;
|
|
18
|
+
readonly onPlanReviewerTurn: (cycle: number, result: PersistentThreadResponse, review: ReviewResult) => void | Promise<void>;
|
|
19
|
+
/** Abort signal from the coordinator; when set, cycle stops after the current turn. */
|
|
20
|
+
readonly isClosed?: () => boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface PlanCycleResult {
|
|
23
|
+
readonly plan: string;
|
|
24
|
+
readonly review: ReviewResult | null;
|
|
25
|
+
}
|
|
26
|
+
export declare function runPlanCycle(props: RunPlanCycleProps): Promise<PlanCycleResult>;
|
|
27
|
+
//# sourceMappingURL=plan-cycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-cycle.d.ts","sourceRoot":"","sources":["../../src/plan-phase/plan-cycle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAMlE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,KAAK,EACX,gBAAgB,EAChB,wBAAwB,EACxB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,qEAAqE;IACrE,QAAQ,CAAC,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC/C,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,qEAAqE;IACrE,QAAQ,CAAC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,eAAe,EAAE,CACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB,KAC5B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,CAAC,kBAAkB,EAAE,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,wBAAwB,EAChC,MAAM,EAAE,YAAY,KAChB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,uFAAuF;IACvF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CACrC;AAiDD,wBAAsB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CA0DrF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { buildInitialPlanMessage, buildPlanReviewMessage, buildPlanReviseMessage, } from '../prompt/message-builders.js';
|
|
2
|
+
import { reviewResultSchema } from '../shared/review-result.js';
|
|
3
|
+
function firstTurn(systemPrompt, userMessage) {
|
|
4
|
+
return `# System\n${systemPrompt}\n\n# Task\n${userMessage}`;
|
|
5
|
+
}
|
|
6
|
+
function parsePlan(response) {
|
|
7
|
+
let parsed;
|
|
8
|
+
try {
|
|
9
|
+
parsed = JSON.parse(response);
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
throw new Error(`plan-agent response is not valid JSON. Raw: ${response.slice(0, 200)}`, {
|
|
13
|
+
cause: error,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (typeof parsed !== 'object' ||
|
|
17
|
+
parsed === null ||
|
|
18
|
+
!('plan' in parsed) ||
|
|
19
|
+
typeof parsed.plan !== 'string') {
|
|
20
|
+
throw new Error(`plan-agent response missing string plan field. Raw: ${response.slice(0, 200)}`);
|
|
21
|
+
}
|
|
22
|
+
return parsed.plan;
|
|
23
|
+
}
|
|
24
|
+
function parseReview(response) {
|
|
25
|
+
let parsed;
|
|
26
|
+
try {
|
|
27
|
+
parsed = JSON.parse(response);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw new Error(`plan-reviewer response is not valid JSON. Raw: ${response.slice(0, 200)}`, {
|
|
31
|
+
cause: error,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const result = reviewResultSchema.safeParse(parsed);
|
|
35
|
+
if (!result.success) {
|
|
36
|
+
throw new Error(`plan-reviewer response does not match ReviewResult schema: ${result.error.message}. Raw: ${response.slice(0, 200)}`);
|
|
37
|
+
}
|
|
38
|
+
return result.data;
|
|
39
|
+
}
|
|
40
|
+
export async function runPlanCycle(props) {
|
|
41
|
+
const initialMessage = buildInitialPlanMessage({
|
|
42
|
+
spec: props.spec,
|
|
43
|
+
repos: props.repos,
|
|
44
|
+
repoSummary: props.repoSummary,
|
|
45
|
+
context: props.context,
|
|
46
|
+
});
|
|
47
|
+
const initialResponse = await props.planThread.send(firstTurn(props.systemPromptPlanAgent, initialMessage));
|
|
48
|
+
await props.onPlanAgentTurn(0, initialResponse);
|
|
49
|
+
let currentPlan = parsePlan(initialResponse.response);
|
|
50
|
+
// kind === 'noReview': agent only. No reviewer thread used.
|
|
51
|
+
if (props.cycle.kind === 'noReview') {
|
|
52
|
+
return { plan: currentPlan, review: null };
|
|
53
|
+
}
|
|
54
|
+
if (props.reviewThread === null || props.systemPromptPlanReviewer === null) {
|
|
55
|
+
throw new Error('runPlanCycle: kind="review" requires reviewThread and systemPromptPlanReviewer');
|
|
56
|
+
}
|
|
57
|
+
const reviewThread = props.reviewThread;
|
|
58
|
+
const systemPromptReviewer = props.systemPromptPlanReviewer;
|
|
59
|
+
const cycleCount = props.cycle.cycleCount;
|
|
60
|
+
let lastReview = null;
|
|
61
|
+
for (let cycle = 1; cycle <= cycleCount; cycle += 1) {
|
|
62
|
+
if (props.isClosed?.()) {
|
|
63
|
+
return { plan: currentPlan, review: lastReview };
|
|
64
|
+
}
|
|
65
|
+
const reviewMessage = buildPlanReviewMessage({
|
|
66
|
+
spec: props.spec,
|
|
67
|
+
plan: currentPlan,
|
|
68
|
+
cycle,
|
|
69
|
+
});
|
|
70
|
+
const reviewResponse = await reviewThread.send(cycle === 1 ? firstTurn(systemPromptReviewer, reviewMessage) : reviewMessage);
|
|
71
|
+
lastReview = parseReview(reviewResponse.response);
|
|
72
|
+
await props.onPlanReviewerTurn(cycle, reviewResponse, lastReview);
|
|
73
|
+
if (props.isClosed?.()) {
|
|
74
|
+
return { plan: currentPlan, review: lastReview };
|
|
75
|
+
}
|
|
76
|
+
// Always revise after every review — reviewer feedback always reaches the agent.
|
|
77
|
+
const reviseResponse = await props.planThread.send(buildPlanReviseMessage({ cycle, review: lastReview }));
|
|
78
|
+
await props.onPlanAgentTurn(cycle, reviseResponse);
|
|
79
|
+
currentPlan = parsePlan(reviseResponse.response);
|
|
80
|
+
}
|
|
81
|
+
return { plan: currentPlan, review: lastReview };
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=plan-cycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-cycle.js","sourceRoot":"","sources":["../../src/plan-phase/plan-cycle.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,kBAA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+
import type { RepoLocation } from '../shared/repo-location.js';
|
|
2
|
+
import type { ReviewResult } from '../shared/review-result.js';
|
|
3
|
+
import type { VerificationCommandResult } from '../state/task-event-types.js';
|
|
4
|
+
import type { VerificationCommand } from '../validation-runner/verification-runner.js';
|
|
5
|
+
export interface BuildInitialPlanMessageProps {
|
|
6
|
+
readonly spec: string;
|
|
7
|
+
readonly repos: readonly RepoLocation[];
|
|
8
|
+
readonly repoSummary: string | null;
|
|
9
|
+
readonly context: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildInitialPlanMessage(props: BuildInitialPlanMessageProps): string;
|
|
12
|
+
export interface BuildPlanReviewMessageProps {
|
|
13
|
+
readonly spec: string;
|
|
14
|
+
readonly plan: string;
|
|
15
|
+
readonly cycle: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function buildPlanReviewMessage(props: BuildPlanReviewMessageProps): string;
|
|
18
|
+
export interface BuildPlanReviseMessageProps {
|
|
19
|
+
readonly cycle: number;
|
|
20
|
+
readonly review: ReviewResult;
|
|
21
|
+
}
|
|
22
|
+
export declare function buildPlanReviseMessage(props: BuildPlanReviseMessageProps): string;
|
|
23
|
+
export interface BuildInitialWorkMessageProps {
|
|
24
|
+
readonly spec: string;
|
|
25
|
+
readonly plan: string;
|
|
26
|
+
readonly planReview: ReviewResult | null;
|
|
27
|
+
readonly validationCommandList: readonly VerificationCommand[];
|
|
28
|
+
}
|
|
29
|
+
export declare function buildInitialWorkMessage(props: BuildInitialWorkMessageProps): string;
|
|
30
|
+
export interface BuildWorkReviewMessageProps {
|
|
31
|
+
readonly spec: string;
|
|
32
|
+
readonly plan: string;
|
|
33
|
+
readonly diff: string;
|
|
34
|
+
readonly cycle: number;
|
|
35
|
+
readonly validationCommandList?: readonly VerificationCommand[];
|
|
36
|
+
}
|
|
37
|
+
export declare function buildWorkReviewMessage(props: BuildWorkReviewMessageProps): string;
|
|
38
|
+
export interface BuildWorkReviseMessageProps {
|
|
39
|
+
readonly cycle: number;
|
|
40
|
+
readonly review: ReviewResult;
|
|
41
|
+
readonly validationResults: readonly VerificationCommandResult[];
|
|
42
|
+
}
|
|
43
|
+
export declare function buildWorkReviseMessage(props: BuildWorkReviseMessageProps): string;
|
|
44
|
+
//# sourceMappingURL=message-builders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-builders.d.ts","sourceRoot":"","sources":["../../src/prompt/message-builders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAwCvF,MAAM,WAAW,4BAA4B;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,GAAG,MAAM,CAQnF;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,MAAM,CAMjF;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC9B;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,MAAM,CAOjF;AAED,MAAM,WAAW,4BAA4B;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,qBAAqB,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAC/D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,GAAG,MAAM,CAcnF;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,qBAAqB,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAChE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,MAAM,CAQjF;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,iBAAiB,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACjE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,MAAM,CAQjF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function formatComments(comments) {
|
|
2
|
+
if (comments.length === 0)
|
|
3
|
+
return '(no comments)';
|
|
4
|
+
return comments
|
|
5
|
+
.map((comment) => {
|
|
6
|
+
const location = typeof comment.line === 'number' ? `${comment.file}:${String(comment.line)}` : comment.file;
|
|
7
|
+
return `- [${comment.severity}] ${location} - ${comment.comment}`;
|
|
8
|
+
})
|
|
9
|
+
.join('\n');
|
|
10
|
+
}
|
|
11
|
+
function formatRepos(repos) {
|
|
12
|
+
if (repos.length === 0)
|
|
13
|
+
return '(no repositories)';
|
|
14
|
+
return repos
|
|
15
|
+
.map((repo) => `- ${repo.repoUrl} (branch: ${repo.baseBranch})\n Workspace: ${repo.workspacePath}`)
|
|
16
|
+
.join('\n');
|
|
17
|
+
}
|
|
18
|
+
function formatValidationList(commands) {
|
|
19
|
+
if (commands.length === 0) {
|
|
20
|
+
return '(none configured - run_validation will return an empty array)';
|
|
21
|
+
}
|
|
22
|
+
return commands.map((command) => `- ${command.name}: ${command.command}`).join('\n');
|
|
23
|
+
}
|
|
24
|
+
function formatValidationResults(results) {
|
|
25
|
+
if (results.length === 0)
|
|
26
|
+
return '(no validation results recorded)';
|
|
27
|
+
return results
|
|
28
|
+
.map((result) => `- ${result.name}: passed=${String(result.passed)} exitCode=${String(result.exitCode)}\n output: ${result.output.slice(0, 800)}`)
|
|
29
|
+
.join('\n');
|
|
30
|
+
}
|
|
31
|
+
export function buildInitialPlanMessage(props) {
|
|
32
|
+
const parts = [`Spec:\n${props.spec}`, `Repositories:\n${formatRepos(props.repos)}`];
|
|
33
|
+
if (props.repoSummary)
|
|
34
|
+
parts.push(`Repo summary:\n${props.repoSummary}`);
|
|
35
|
+
if (Object.keys(props.context).length > 0) {
|
|
36
|
+
parts.push(`Context:\n${JSON.stringify(props.context, null, 2)}`);
|
|
37
|
+
}
|
|
38
|
+
parts.push('Produce a plan. Return JSON: { "plan": "..." }');
|
|
39
|
+
return parts.join('\n\n');
|
|
40
|
+
}
|
|
41
|
+
export function buildPlanReviewMessage(props) {
|
|
42
|
+
return [
|
|
43
|
+
`Spec:\n${props.spec}`,
|
|
44
|
+
`Plan v${String(props.cycle)}:\n${props.plan}`,
|
|
45
|
+
'Review. Return JSON per the ReviewResult schema from your instructions.',
|
|
46
|
+
].join('\n\n');
|
|
47
|
+
}
|
|
48
|
+
export function buildPlanReviseMessage(props) {
|
|
49
|
+
return [
|
|
50
|
+
`Plan reviewer cycle ${String(props.cycle)} feedback:`,
|
|
51
|
+
`Summary: ${props.review.summary}`,
|
|
52
|
+
`Comments:\n${formatComments(props.review.comments)}`,
|
|
53
|
+
'Revise the plan. Return JSON: { "plan": "..." }',
|
|
54
|
+
].join('\n\n');
|
|
55
|
+
}
|
|
56
|
+
export function buildInitialWorkMessage(props) {
|
|
57
|
+
const parts = [`Spec:\n${props.spec}`, `Approved plan:\n${props.plan}`];
|
|
58
|
+
if (props.planReview) {
|
|
59
|
+
parts.push(`Plan review commentary (advisory):\nSummary: ${props.planReview.summary}\nComments:\n${formatComments(props.planReview.comments)}`);
|
|
60
|
+
}
|
|
61
|
+
parts.push(`Validation commands available:\n${formatValidationList(props.validationCommandList)}`);
|
|
62
|
+
parts.push('Implement the plan. Return JSON: { "summary": "...", "commitShas": [], "remainingConcerns": "" }');
|
|
63
|
+
return parts.join('\n\n');
|
|
64
|
+
}
|
|
65
|
+
export function buildWorkReviewMessage(props) {
|
|
66
|
+
return [
|
|
67
|
+
`Spec:\n${props.spec}`,
|
|
68
|
+
`Plan:\n${props.plan}`,
|
|
69
|
+
`Diff v${String(props.cycle)}:\n${props.diff}`,
|
|
70
|
+
`Validation commands configured:\n${formatValidationList(props.validationCommandList ?? [])}`,
|
|
71
|
+
'You MUST call run_validation exactly once before returning your review. Return JSON per the ReviewResult schema from your instructions.',
|
|
72
|
+
].join('\n\n');
|
|
73
|
+
}
|
|
74
|
+
export function buildWorkReviseMessage(props) {
|
|
75
|
+
return [
|
|
76
|
+
`Work reviewer cycle ${String(props.cycle)} feedback:`,
|
|
77
|
+
`Summary: ${props.review.summary}`,
|
|
78
|
+
`Comments:\n${formatComments(props.review.comments)}`,
|
|
79
|
+
`Validation results:\n${formatValidationResults(props.validationResults)}`,
|
|
80
|
+
'Revise. Return JSON: { "summary": "...", "commitShas": [], "remainingConcerns": "" }',
|
|
81
|
+
].join('\n\n');
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=message-builders.js.map
|
|
@@ -0,0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O;QACN,uBAAuB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;QACtD,YAAY,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;QAClC,cAAc,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QACrD,wBAAwB,uBAAuB,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;QAC1E,sFAAsF;KACtF,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SkillReference } from '../shared/skill-types.js';
|
|
2
|
+
import { type Role } from './prompt-defaults.js';
|
|
3
|
+
export interface BuildRoleSystemPromptProps {
|
|
4
|
+
readonly role: Role;
|
|
5
|
+
readonly baseInstructionsOverride: string | null;
|
|
6
|
+
readonly roleInstructionsOverride: string | null;
|
|
7
|
+
readonly branchPrefix: string;
|
|
8
|
+
readonly skills: readonly SkillReference[];
|
|
9
|
+
}
|
|
10
|
+
export declare function buildRoleSystemPrompt(props: BuildRoleSystemPromptProps): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=prompt-assembler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-assembler.d.ts","sourceRoot":"","sources":["../../src/prompt/prompt-assembler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAGN,KAAK,IAAI,EACT,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;CAC3C;AA2BD,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAS9F"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { writeStderr } from '../shared/stderr.js';
|
|
3
|
+
import { DEFAULT_BASE_INSTRUCTIONS, resolveRoleInstructions, } from './prompt-defaults.js';
|
|
4
|
+
async function resolveSkillContent(skills) {
|
|
5
|
+
const bodies = await Promise.all(skills.map(async (skill) => {
|
|
6
|
+
try {
|
|
7
|
+
const content = await readFile(skill.path, 'utf-8');
|
|
8
|
+
return `## Skill: ${skill.name}\n${content}`;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
const code = error && typeof error === 'object' && 'code' in error ? error.code : undefined;
|
|
12
|
+
if (code === 'ENOENT') {
|
|
13
|
+
writeStderr(`[prompt-assembler] Skill not found, skipping: ${skill.name} at ${skill.path}`);
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
17
|
+
writeStderr(`[prompt-assembler] Skill load failed (${skill.name}): ${message}`);
|
|
18
|
+
throw new Error(`Skill load failed for "${skill.name}" at "${skill.path}": ${message}`, {
|
|
19
|
+
cause: error,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
return bodies.filter((body) => body !== null).join('\n\n');
|
|
24
|
+
}
|
|
25
|
+
export async function buildRoleSystemPrompt(props) {
|
|
26
|
+
const baseTemplate = props.baseInstructionsOverride ?? DEFAULT_BASE_INSTRUCTIONS;
|
|
27
|
+
const baseInstructions = baseTemplate.replaceAll('{branchPrefix}', props.branchPrefix);
|
|
28
|
+
const roleInstructions = resolveRoleInstructions(props.role, props.roleInstructionsOverride);
|
|
29
|
+
const skillContent = await resolveSkillContent(props.skills);
|
|
30
|
+
return [baseInstructions, roleInstructions, skillContent]
|
|
31
|
+
.filter((section) => section.length > 0)
|
|
32
|
+
.join('\n\n---\n\n');
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=prompt-assembler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-assembler.js","sourceRoot":"","sources":["../../src/prompt/prompt-assembler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACN,yBAAyB,EACzB,uBAAuB,GAEvB,MAAM,sBAAsB,CAAC;AAU9B,KAAK,UAAU,mBAAmB,CAAC,MAAiC;IACnE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAA0B,EAAE;QAClD,IAAI,CAAC;YACJ,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACpD,OAAO,aAAa,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,GAAG,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;YAC5F,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACvB,WAAW,CACV,iDAAiD,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,EAAE,CAC9E,CAAC;gBACF,OAAO,IAAI,CAAC;YACb,CAAC;YACD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,WAAW,CAAC,yCAAyC,KAAK,CAAC,IAAI,MAAM,OAAO,EAAE,CAAC,CAAC;YAChF,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC,IAAI,MAAM,OAAO,EAAE,EAAE;gBACvF,KAAK,EAAE,KAAK;aACZ,CAAC,CAAC;QACJ,CAAC;IACF,CAAC,CAAC,CACF,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,KAAiC;IAC5E,MAAM,YAAY,GAAG,KAAK,CAAC,wBAAwB,IAAI,yBAAyB,CAAC;IACjF,MAAM,gBAAgB,GAAG,YAAY,CAAC,UAAU,CAAC,gBAAgB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IACvF,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC7F,MAAM,YAAY,GAAG,MAAM,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7D,OAAO,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,CAAC;SACvD,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;SACvC,IAAI,CAAC,aAAa,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Role = 'plan-agent' | 'plan-reviewer' | 'work-agent' | 'work-reviewer' | 'wrapup';
|
|
2
|
+
export declare const DEFAULT_BASE_INSTRUCTIONS = "You are an agent operating inside a sandboxed VM. You have access to the repository workspace mounted at /workspace. All outbound network requests go through a mediation proxy.\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## 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 - The VM env var GITHUB_TOKEN is a Gondolin mediation placeholder, NOT the real token. gh must see SOME token to skip its login check, so always invoke gh with GH_TOKEN=\"$GITHUB_TOKEN\" prefixed:\n GH_TOKEN=\"$GITHUB_TOKEN\" gh pr create --base <default> --title \"...\" --body \"...\"\n - The proxy strips the placeholder and injects the real token at the wire level. You never handle the real token directly.\n\n## Mediated secrets\n\nThe same mediation pattern applies to every credential surfaced into your env. The value you see is a Gondolin placeholder; the proxy swaps it for the real secret on outbound requests to the allowed hosts declared in zone config. Never print, log, or try to inspect the value.\n\nDefault mediated env vars for worker zones:\n- GITHUB_TOKEN: for github.com / api.github.com\n- OPENAI_API_KEY: for api.openai.com\n\nIf your task needs another credential, it must be declared in the zone secrets with injection: \"http-mediation\" and the relevant allowed host. Without that declaration, no auth flows.\n\nIf NPM_AUTH_TOKEN is configured for registry.npmjs.org and the repo needs private npm packages, configure npm at task runtime rather than expecting the gateway image to contain auth files:\n\n```bash\nprintf '//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}\\n' > \"$HOME/.npmrc\"\n```\n\nThe single quotes preserve the literal template so npm substitutes it from the environment during registry calls. Do not inline the env var with double quotes or bake .npmrc into an image.\n\n## Output discipline\n- Keep prose brief.\n- When asked for JSON, return only JSON with no markdown fence or prose wrapper.";
|
|
3
|
+
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\" }";
|
|
4
|
+
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}";
|
|
5
|
+
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\": \"\" }";
|
|
6
|
+
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}";
|
|
7
|
+
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 function resolveRoleInstructions(role: Role, configValue: string | null): string;
|
|
9
|
+
export declare function interpolateBaseInstructions(branchPrefix: string): string;
|
|
10
|
+
//# sourceMappingURL=prompt-defaults.d.ts.map
|
|
@@ -0,0 +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,yBAAyB,41FA6C2C,CAAC;AAElF,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;AAED,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAExE"}
|