@a5c-ai/babysitter-sdk 0.0.183-staging.64fe647d → 0.0.183-staging.714cc8f6
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/dist/cli/commands/harnessPhase1.d.ts.map +1 -1
- package/dist/cli/commands/harnessPhase1.js +1 -1
- package/dist/cli/commands/harnessPhase2.d.ts.map +1 -1
- package/dist/cli/commands/harnessPhase2.js +4 -2
- package/dist/cli/commands/harnessPrompts.d.ts +2 -2
- package/dist/cli/commands/harnessPrompts.d.ts.map +1 -1
- package/dist/cli/commands/harnessPrompts.js +34 -36
- package/dist/cli/commands/hookRun.d.ts.map +1 -1
- package/dist/cli/commands/hookRun.js +32 -4
- package/dist/cli/commands/instructions.d.ts +19 -0
- package/dist/cli/commands/instructions.d.ts.map +1 -0
- package/dist/cli/commands/instructions.js +158 -0
- package/dist/cli/commands/log.d.ts +22 -0
- package/dist/cli/commands/log.d.ts.map +1 -0
- package/dist/cli/commands/log.js +99 -0
- package/dist/cli/commands/session.d.ts +1 -0
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +50 -10
- package/dist/cli/commands/templates/process-generation-prompt.md +80 -3
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +90 -6
- package/dist/harness/claudeCode.d.ts.map +1 -1
- package/dist/harness/claudeCode.js +4 -0
- package/dist/harness/codex.d.ts.map +1 -1
- package/dist/harness/codex.js +4 -0
- package/dist/harness/pi.d.ts.map +1 -1
- package/dist/harness/pi.js +4 -0
- package/dist/harness/types.d.ts +8 -0
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/logging/index.d.ts +3 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +11 -0
- package/dist/logging/runLogger.d.ts +83 -0
- package/dist/logging/runLogger.d.ts.map +1 -0
- package/dist/logging/runLogger.js +177 -0
- package/dist/mcp/tools/runs.d.ts.map +1 -1
- package/dist/mcp/tools/runs.js +2 -0
- package/dist/prompts/compose.d.ts +28 -0
- package/dist/prompts/compose.d.ts.map +1 -0
- package/dist/prompts/compose.js +165 -0
- package/dist/prompts/context.d.ts +19 -0
- package/dist/prompts/context.d.ts.map +1 -0
- package/dist/prompts/context.js +122 -0
- package/dist/prompts/index.d.ts +11 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +47 -0
- package/dist/prompts/parts/breakpointHandling.d.ts +8 -0
- package/dist/prompts/parts/breakpointHandling.d.ts.map +1 -0
- package/dist/prompts/parts/breakpointHandling.js +12 -0
- package/dist/prompts/parts/completionProof.d.ts +6 -0
- package/dist/prompts/parts/completionProof.d.ts.map +1 -0
- package/dist/prompts/parts/completionProof.js +10 -0
- package/dist/prompts/parts/criticalRules.d.ts +7 -0
- package/dist/prompts/parts/criticalRules.d.ts.map +1 -0
- package/dist/prompts/parts/criticalRules.js +16 -0
- package/dist/prompts/parts/dependencies.d.ts +6 -0
- package/dist/prompts/parts/dependencies.d.ts.map +1 -0
- package/dist/prompts/parts/dependencies.js +10 -0
- package/dist/prompts/parts/effects.d.ts +6 -0
- package/dist/prompts/parts/effects.d.ts.map +1 -0
- package/dist/prompts/parts/effects.js +10 -0
- package/dist/prompts/parts/index.d.ts +26 -0
- package/dist/prompts/parts/index.d.ts.map +1 -0
- package/dist/prompts/parts/index.js +48 -0
- package/dist/prompts/parts/intentFidelityChecks.d.ts +7 -0
- package/dist/prompts/parts/intentFidelityChecks.d.ts.map +1 -0
- package/dist/prompts/parts/intentFidelityChecks.js +14 -0
- package/dist/prompts/parts/interview.d.ts +6 -0
- package/dist/prompts/parts/interview.d.ts.map +1 -0
- package/dist/prompts/parts/interview.js +18 -0
- package/dist/prompts/parts/iteration.d.ts +6 -0
- package/dist/prompts/parts/iteration.d.ts.map +1 -0
- package/dist/prompts/parts/iteration.js +15 -0
- package/dist/prompts/parts/loopControl.d.ts +11 -0
- package/dist/prompts/parts/loopControl.d.ts.map +1 -0
- package/dist/prompts/parts/loopControl.js +22 -0
- package/dist/prompts/parts/nonNegotiables.d.ts +7 -0
- package/dist/prompts/parts/nonNegotiables.d.ts.map +1 -0
- package/dist/prompts/parts/nonNegotiables.js +14 -0
- package/dist/prompts/parts/processCreation.d.ts +6 -0
- package/dist/prompts/parts/processCreation.d.ts.map +1 -0
- package/dist/prompts/parts/processCreation.js +24 -0
- package/dist/prompts/parts/processGuidelines.d.ts +7 -0
- package/dist/prompts/parts/processGuidelines.d.ts.map +1 -0
- package/dist/prompts/parts/processGuidelines.js +11 -0
- package/dist/prompts/parts/quickReference.d.ts +6 -0
- package/dist/prompts/parts/quickReference.d.ts.map +1 -0
- package/dist/prompts/parts/quickReference.js +17 -0
- package/dist/prompts/parts/recovery.d.ts +7 -0
- package/dist/prompts/parts/recovery.d.ts.map +1 -0
- package/dist/prompts/parts/recovery.js +11 -0
- package/dist/prompts/parts/resultsPosting.d.ts +7 -0
- package/dist/prompts/parts/resultsPosting.d.ts.map +1 -0
- package/dist/prompts/parts/resultsPosting.js +11 -0
- package/dist/prompts/parts/runCreation.d.ts +7 -0
- package/dist/prompts/parts/runCreation.d.ts.map +1 -0
- package/dist/prompts/parts/runCreation.js +53 -0
- package/dist/prompts/parts/seeAlso.d.ts +7 -0
- package/dist/prompts/parts/seeAlso.d.ts.map +1 -0
- package/dist/prompts/parts/seeAlso.js +11 -0
- package/dist/prompts/parts/taskExamples.d.ts +7 -0
- package/dist/prompts/parts/taskExamples.d.ts.map +1 -0
- package/dist/prompts/parts/taskExamples.js +11 -0
- package/dist/prompts/parts/taskKinds.d.ts +6 -0
- package/dist/prompts/parts/taskKinds.d.ts.map +1 -0
- package/dist/prompts/parts/taskKinds.js +17 -0
- package/dist/prompts/parts/userProfile.d.ts +7 -0
- package/dist/prompts/parts/userProfile.d.ts.map +1 -0
- package/dist/prompts/parts/userProfile.js +11 -0
- package/dist/prompts/templateRenderer.d.ts +18 -0
- package/dist/prompts/templateRenderer.d.ts.map +1 -0
- package/dist/prompts/templateRenderer.js +131 -0
- package/dist/prompts/templates/breakpoint-handling.md +101 -0
- package/dist/prompts/templates/completion-proof.md +13 -0
- package/dist/prompts/templates/critical-rules.md +57 -0
- package/dist/prompts/templates/dependencies.md +9 -0
- package/dist/prompts/templates/effects.md +36 -0
- package/dist/prompts/templates/intent-fidelity-checks.md +14 -0
- package/dist/prompts/templates/interview.md +65 -0
- package/dist/prompts/templates/iteration.md +41 -0
- package/dist/prompts/templates/loop-control.md +54 -0
- package/dist/prompts/templates/non-negotiables.md +11 -0
- package/dist/prompts/templates/process-creation.md +61 -0
- package/dist/prompts/templates/process-guidelines.md +88 -0
- package/dist/prompts/templates/quick-reference.md +35 -0
- package/dist/prompts/templates/recovery.md +20 -0
- package/dist/prompts/templates/results-posting.md +61 -0
- package/dist/prompts/templates/run-creation.md +36 -0
- package/dist/prompts/templates/see-also.md +4 -0
- package/dist/prompts/templates/task-examples.md +72 -0
- package/dist/prompts/templates/task-kinds.md +60 -0
- package/dist/prompts/templates/user-profile.md +48 -0
- package/dist/prompts/types.d.ts +105 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +7 -0
- package/dist/runtime/intrinsics/breakpoint.d.ts +2 -2
- package/dist/runtime/intrinsics/breakpoint.d.ts.map +1 -1
- package/dist/runtime/intrinsics/breakpoint.js +25 -1
- package/dist/runtime/intrinsics/task.js +1 -1
- package/dist/runtime/processContext.d.ts +14 -0
- package/dist/runtime/processContext.d.ts.map +1 -1
- package/dist/runtime/processContext.js +91 -5
- package/dist/runtime/replay/createReplayEngine.d.ts.map +1 -1
- package/dist/runtime/replay/createReplayEngine.js +82 -1
- package/dist/runtime/replay/effectIndex.d.ts +3 -1
- package/dist/runtime/replay/effectIndex.d.ts.map +1 -1
- package/dist/runtime/replay/effectIndex.js +9 -2
- package/dist/runtime/types.d.ts +20 -1
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/tasks/types.d.ts +9 -0
- package/dist/tasks/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harnessPhase1.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/harnessPhase1.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAa1C,OAAO,EAIL,KAAK,2BAA2B,EAEhC,KAAK,iBAAiB,EAGtB,KAAK,oBAAoB,IAAI,0BAA0B,EAwBxD,MAAM,gBAAgB,CAAC;AAkBxB,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAyHD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAyB/D;AAg5BD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAmDzE;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAU/F;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgBrE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAwBhG;AAwGD,wBAAgB,oCAAoC,CAAC,IAAI,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,0BAA0B,C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,CAygBlB"}
|
|
@@ -1502,7 +1502,7 @@ async function runProcessDefinitionPhase(args) {
|
|
|
1502
1502
|
})));
|
|
1503
1503
|
const workspaceAssessment = await assessWorkspaceForExternalAuthoring(args.workspace);
|
|
1504
1504
|
writeVerboseData("phase1 workspace assessment", workspaceAssessment);
|
|
1505
|
-
const processDefinitionSystemPrompt = (0, harnessPrompts_1.buildProcessDefinitionSystemPrompt)(args.outputPath, args.promptContext);
|
|
1505
|
+
const processDefinitionSystemPrompt = await (0, harnessPrompts_1.buildProcessDefinitionSystemPrompt)(args.outputPath, args.promptContext, args.interactive);
|
|
1506
1506
|
const initialMetaPrompt = (0, harnessPrompts_1.buildProcessDefinitionUserPrompt)(args.prompt, args.outputPath, {
|
|
1507
1507
|
interactive: args.interactive,
|
|
1508
1508
|
workspaceAssessment: workspaceAssessment.kind,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harnessPhase2.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/harnessPhase2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAkB1C,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAI3B,KAAK,oBAAoB,IAAI,0BAA0B,EACvD,KAAK,YAAY,EA8BjB,eAAe,EAIhB,MAAM,gBAAgB,CAAC;AAaxB,wBAAsB,aAAa,CACjC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IACP,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC9C,EACD,SAAS,CAAC,EAAE,eAAe,GAAG,IAAI,EAClC,UAAU,CAAC,EAAE,sBAAsB,EAAE,EACrC,EAAE,CAAC,EAAE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
|
},
|
|
431
431
|
prompt: args.prompt,
|
|
432
432
|
inputs: args.prompt ? { prompt: args.prompt } : undefined,
|
|
433
|
+
...(args.interactive === false ? { metadata: { nonInteractive: true } } : {}),
|
|
433
434
|
});
|
|
434
435
|
state.runId = created.runId;
|
|
435
436
|
state.runDir = created.runDir;
|
|
@@ -673,6 +674,7 @@ async function runOrchestrationPhase(args) {
|
|
|
673
674
|
inputs: effectivePrompt
|
|
674
675
|
? { prompt: effectivePrompt }
|
|
675
676
|
: undefined,
|
|
677
|
+
...(args.interactive === false ? { metadata: { nonInteractive: true } } : {}),
|
|
676
678
|
});
|
|
677
679
|
state.runId = result.runId;
|
|
678
680
|
state.runDir = result.runDir;
|
|
@@ -1275,7 +1277,7 @@ async function runOrchestrationPhase(args) {
|
|
|
1275
1277
|
uiContext: args.interactive && args.rl
|
|
1276
1278
|
? (0, harnessUtils_1.createReadlineAskUserQuestionUiContext)(args.rl)
|
|
1277
1279
|
: undefined,
|
|
1278
|
-
appendSystemPrompt: [(0, harnessPrompts_1.buildOrchestrationSystemPrompt)(args.selectedHarnessName, args.promptContext)],
|
|
1280
|
+
appendSystemPrompt: [(0, harnessPrompts_1.buildOrchestrationSystemPrompt)(args.selectedHarnessName, args.promptContext, args.interactive)],
|
|
1279
1281
|
ephemeral: true,
|
|
1280
1282
|
});
|
|
1281
1283
|
writeVerbose(`[phase2 setup] harness=${args.selectedHarnessName} workspace=${path.resolve(args.workspace ?? process.cwd())} model=${args.model ?? "(default)"} processPath=${path.resolve(args.processPath)}`);
|
|
@@ -1283,7 +1285,7 @@ async function runOrchestrationPhase(args) {
|
|
|
1283
1285
|
name: tool.name,
|
|
1284
1286
|
label: tool.label,
|
|
1285
1287
|
})));
|
|
1286
|
-
writeVerboseData("phase2 system prompt", (0, harnessPrompts_1.buildOrchestrationSystemPrompt)(args.selectedHarnessName, args.promptContext));
|
|
1288
|
+
writeVerboseData("phase2 system prompt", (0, harnessPrompts_1.buildOrchestrationSystemPrompt)(args.selectedHarnessName, args.promptContext, args.interactive));
|
|
1287
1289
|
(0, harnessUtils_1.emitProgress)({ phase: "2", status: "started", harness: args.selectedHarnessName }, args.json, args.verbose);
|
|
1288
1290
|
let unsubscribe = null;
|
|
1289
1291
|
try {
|
|
@@ -23,9 +23,9 @@ export interface ProcessDefinitionUserPromptOptions {
|
|
|
23
23
|
workspaceAssessment?: "empty" | "non-empty";
|
|
24
24
|
workspaceEntries?: string[];
|
|
25
25
|
}
|
|
26
|
-
export declare function buildProcessDefinitionSystemPrompt(outputPath: string, context: HarnessPromptContext): string
|
|
26
|
+
export declare function buildProcessDefinitionSystemPrompt(outputPath: string, context: HarnessPromptContext, interactive?: boolean | undefined): Promise<string>;
|
|
27
27
|
export declare function buildProcessDefinitionUserPrompt(userPrompt: string, outputPath: string, options?: ProcessDefinitionUserPromptOptions): string;
|
|
28
|
-
export declare function buildOrchestrationSystemPrompt(selectedHarnessName: string, context: HarnessPromptContext): string;
|
|
28
|
+
export declare function buildOrchestrationSystemPrompt(selectedHarnessName: string, context: HarnessPromptContext, interactive?: boolean | undefined): string;
|
|
29
29
|
export declare function buildOrchestrationBootstrapPrompt(processPath: string, userPrompt: string | undefined, maxIterations: number): string;
|
|
30
30
|
export declare function buildOrchestrationTurnPrompt(args: {
|
|
31
31
|
processPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harnessPrompts.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/harnessPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"harnessPrompts.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/harnessPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAQlE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IAC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CAAC,IAAI,EAAE;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,KAAK,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CA+CT"}
|
|
@@ -5,6 +5,9 @@ exports.buildProcessDefinitionUserPrompt = buildProcessDefinitionUserPrompt;
|
|
|
5
5
|
exports.buildOrchestrationSystemPrompt = buildOrchestrationSystemPrompt;
|
|
6
6
|
exports.buildOrchestrationBootstrapPrompt = buildOrchestrationBootstrapPrompt;
|
|
7
7
|
exports.buildOrchestrationTurnPrompt = buildOrchestrationTurnPrompt;
|
|
8
|
+
const context_1 = require("../../prompts/context");
|
|
9
|
+
const compose_1 = require("../../prompts/compose");
|
|
10
|
+
const active_1 = require("../../processLibrary/active");
|
|
8
11
|
function formatHarnessCatalog(context) {
|
|
9
12
|
const lines = ["Discovered harnesses:"];
|
|
10
13
|
for (const harness of context.discoveredHarnesses) {
|
|
@@ -55,12 +58,13 @@ function formatHarnessAssignmentGuidance(context) {
|
|
|
55
58
|
return [
|
|
56
59
|
"Harness assignment guidance:",
|
|
57
60
|
`- Only assign installed harness names. Installed harnesses: ${installedList}.`,
|
|
58
|
-
"- Default `agent`, `node`, and `orchestrator_task` work to the internal PI worker.
|
|
61
|
+
"- Default `agent`, `node`, and `orchestrator_task` work to the internal PI worker. Prefer `task.execution.harness` to route a task to a specific installed harness. The legacy `task.metadata.harness` field is still supported but `execution.harness` takes precedence when both are present.",
|
|
59
62
|
"- Treat `pi` / `oh-my-pi` as the internal harness. Its default worker mode is native/local PI execution with isolation disabled unless the task opts into stronger guardrails.",
|
|
60
63
|
"- Shell effects run through the internal PI worker even when orchestration is bound to an external CLI harness. Keep shell work on that worker by default.",
|
|
61
64
|
"- Do not set `task.metadata.bashSandbox`, `task.metadata.isolated`, or `task.metadata.enableCompaction` for ordinary internal PI work. Leave them unset unless the task truly requires stronger guardrails or long-running compaction.",
|
|
62
65
|
"- For risky shell or system-changing subtasks that truly need stronger guardrails, encode them explicitly in task metadata: `bashSandbox: \"secure\"` to opt into AgentSH, `isolated: true` to disable repo/global extensions and skills, and `enableCompaction: true` when a long-running internal worker needs compaction.",
|
|
63
66
|
"- Treat `claude-code`, `codex`, `gemini-cli`, and other external CLIs as text-agent harnesses. Use them only when their behavior is materially better for that task.",
|
|
67
|
+
"- Tasks may include an `execution` field with `model`, `harness`, and `permissions`. `execution.model` is universal (plugins and internal harness). `execution.harness` and `execution.permissions` are only used by the internal harness (`harness:create-run`) and ignored by plugins.",
|
|
64
68
|
"- External CLI harnesses do not inherit AgentSH protection for their own internal shell or tool execution. Route security-sensitive shell work through the internal PI worker instead of assuming the external harness is guarded.",
|
|
65
69
|
context.selectedHarnessName
|
|
66
70
|
? `- The selected orchestration binding harness for this run is ${context.selectedHarnessName}.`
|
|
@@ -77,7 +81,26 @@ function formatSharedContext(context) {
|
|
|
77
81
|
...formatHarnessAssignmentGuidance(context),
|
|
78
82
|
];
|
|
79
83
|
}
|
|
80
|
-
function buildProcessDefinitionSystemPrompt(outputPath, context) {
|
|
84
|
+
async function buildProcessDefinitionSystemPrompt(outputPath, context, interactive) {
|
|
85
|
+
// Resolve the active process-library root for the PI context
|
|
86
|
+
let processLibraryRoot;
|
|
87
|
+
let processLibraryReferenceRoot;
|
|
88
|
+
try {
|
|
89
|
+
const resolved = await (0, active_1.resolveActiveProcessLibrary)();
|
|
90
|
+
if (resolved.binding?.dir) {
|
|
91
|
+
processLibraryRoot = resolved.binding.dir;
|
|
92
|
+
processLibraryReferenceRoot = (0, active_1.getDefaultProcessLibrarySpec)().referenceRoot;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// No binding — templates will fall back to manual instructions
|
|
97
|
+
}
|
|
98
|
+
const piCtx = (0, context_1.createPiContext)({
|
|
99
|
+
interactive,
|
|
100
|
+
processLibraryRoot,
|
|
101
|
+
processLibraryReferenceRoot,
|
|
102
|
+
});
|
|
103
|
+
const composedInstructions = (0, compose_1.composeProcessCreatePrompt)(piCtx);
|
|
81
104
|
return [
|
|
82
105
|
"You are the babysitter harness:create-run phase 1 agent.",
|
|
83
106
|
"Your job is to turn the user's intent into a concrete babysitter process definition before any run is created or bound.",
|
|
@@ -88,33 +111,21 @@ function buildProcessDefinitionSystemPrompt(outputPath, context) {
|
|
|
88
111
|
"- Use the AskUserQuestion tool when clarification is useful. Ask focused, high-signal questions in batches when possible.",
|
|
89
112
|
"- Before authoring the process in any mode, resolve the active shared process-library and conduct a real search against it. In this built-in PI path, use `babysitter_resolve_process_library`, `babysitter_search_process_library`, and `babysitter_read_process_library_file`; those tools are the internal `harness:create-run` harness surface for process-library work. Outside this built-in path, use `babysitter process-library:active --json`, then search the returned `binding.dir`. Do not skip this process-library search step.",
|
|
90
113
|
"- Treat `binding.dir` as the active process-library root that must be searched first. If you need the cloned repo root itself for adjacent material, use `defaultSpec.cloneDir`. Treat `reference/` under the active root or `defaultSpec.referenceRoot` as the canonical reference area.",
|
|
91
|
-
"- In interactive mode, follow a real interview phase: inspect the repo/workspace state first, inspect the most relevant process-library references through the active binding, then ask only the next highest-signal AskUserQuestion when material ambiguity remains. Do not plan more than one interview step ahead.",
|
|
92
|
-
"- In non-interactive mode, skip user questions but still parse the request, inspect the repo/workspace structure, resolve the active process-library root, and search that active library for the most relevant specialization or methodology before authoring the process.",
|
|
93
114
|
"- Research the workspace before finalizing the process. Use your available read/search/bash/write tools as needed.",
|
|
94
115
|
"- Treat the provided workspace as the only relevant filesystem root unless the user explicitly points you somewhere else.",
|
|
95
116
|
"- You may inspect local babysitter process references when they materially improve the process design. Prefer project `.a5c/processes/`, the active process-library root returned in `binding.dir`, the cloned repo root returned in `defaultSpec.cloneDir` when you need adjacent reference material, local plugin paths such as `plugins/babysitter/skills/babysit/process/`, repository `library/` materials, and local babysitter discover/profile CLI commands when available.",
|
|
96
|
-
"- If you use user profile context, read it through the babysitter CLI only, for example `babysitter profile:read --user --json`. Never import or call SDK profile helpers directly from generated processes or task instructions.",
|
|
97
117
|
"- Use babysitter_write_process_definition to write the final JavaScript process file to the exact output path provided below.",
|
|
98
118
|
"- The module must export a named `async function process(inputs, ctx)`.",
|
|
99
119
|
"- The process must orchestrate the work through babysitter tasks instead of doing the main implementation directly in `process(inputs, ctx)`.",
|
|
100
120
|
"- Define at least one task with `defineTask(...)`, and invoke tasks from `process(inputs, ctx)` via `await ctx.task(...)`.",
|
|
101
|
-
"- Default every task to the internal PI worker. Omit `task.metadata.harness` unless a task must explicitly override that default.",
|
|
102
|
-
"- If you define tasks with `defineTask(...)`, every returned TaskDef must include a top-level `kind` field.",
|
|
103
|
-
"- Agent tasks must use `kind: \"agent\"` with `agent: { name, prompt, outputSchema }`; shell tasks must use `kind: \"shell\"` with `shell: { command: \"...\" }`; node tasks must use `kind: \"node\"` with `node: { entry, args? }`.",
|
|
104
|
-
"- Call defined tasks with `await ctx.task(definedTask, args)`; do not invent alternate task runners.",
|
|
105
|
-
"- At least one defined task must be an `agent` task for the main work. Shell tasks are for concrete runnable commands only.",
|
|
106
121
|
"- Any task passed to `ctx.task(...)` must be a DefinedTask created via `defineTask(...)`; never pass plain object task definitions or ad-hoc task objects.",
|
|
107
122
|
"- Inside that named `process(inputs, ctx)` export, do not reference Node's global process object as `process.*`; use `globalThis.process` or an imported alias like `nodeProcess` instead.",
|
|
108
123
|
"- If the process needs the workspace root, do not assume `ctx.workspaceDir` or `ctx.cwd` exists in runtime context. Resolve it from the module location using `import.meta.url`, for example with `path.dirname(fileURLToPath(import.meta.url))`.",
|
|
109
124
|
"- Keep the generated module syntactically valid ESM. If you embed HTML/CSS/JS asset contents inside the process source, do not use raw nested template literals; prefer arrays joined with \"\\n\", String.raw, or escaped inner backticks and \\${...} sequences.",
|
|
110
125
|
"- The generated process must directly execute the user's requested work. Do not generate a meta-process that writes another babysitter process unless the user explicitly asked for process authoring.",
|
|
111
|
-
"- Prefer modular, reusable process composition when possible. Reference relevant methodologies, skills, agents, or prior processes before inventing a process structure from scratch.",
|
|
112
|
-
"- Prefer processes with explicit milestones, quality gates, verification loops, and convergence on the actual user request.",
|
|
113
126
|
"- After the file is written through babysitter_write_process_definition, call babysitter_report_process_definition exactly once with the final path and a concise summary.",
|
|
114
127
|
"- Do not claim completion in plain text without calling babysitter_report_process_definition.",
|
|
115
128
|
"- If different tasks should run on different harnesses, encode that in the process definition rather than leaving it implicit.",
|
|
116
|
-
"- Do not set `task.metadata.bashSandbox`, `task.metadata.isolated`, or `task.metadata.enableCompaction` for ordinary internal PI tasks. Leave them unset unless the task truly requires stronger guardrails or long-running compaction.",
|
|
117
|
-
"- If a task truly needs stronger internal guardrails, encode them explicitly in task metadata instead of assuming every internal task is secure or isolated by default.",
|
|
118
129
|
"",
|
|
119
130
|
"Process Library Activation:",
|
|
120
131
|
"- You MUST call `babysitter_resolve_process_library` to bootstrap and resolve the active process-library root before authoring the process. This is non-optional.",
|
|
@@ -122,22 +133,9 @@ function buildProcessDefinitionSystemPrompt(outputPath, context) {
|
|
|
122
133
|
"- If the cloned repo root is needed for adjacent reference material, use `defaultSpec.cloneDir`.",
|
|
123
134
|
"- Use `babysitter_search_process_library` and `babysitter_read_process_library_file` to search the library. Do not skip the search step.",
|
|
124
135
|
"",
|
|
125
|
-
"
|
|
126
|
-
"- In interactive mode, follow a structured multi-step interview: first inspect the repo/workspace state, then search the process library for relevant specializations, methodologies, skills, and agents. Use babysitter discover commands at various stages.",
|
|
127
|
-
"- After each interview step, decide what the next highest-signal step is. Do not plan more than one step ahead. The same step type can repeat.",
|
|
128
|
-
"- Interview steps can include: research the repo, search the process library, ask the user a question via AskUserQuestion, research online, inspect local processes.",
|
|
136
|
+
"--- Shared Process Creation Instructions ---",
|
|
129
137
|
"",
|
|
130
|
-
|
|
131
|
-
"- Before writing the process, scan methodologies and processes in the active process library to find relevant patterns to use as reference. Also scan `.a5c/processes/` for project-level reusable processes.",
|
|
132
|
-
"- Search for process files (.js), skills (SKILL.md), and agents (AGENT.md) during the process building phase. Search paths: `.a5c/processes/` (project level), `specializations/` under active root, `methodologies/` under active root.",
|
|
133
|
-
"- When creating the process file, include `@skill` and `@agent` JSDoc markers in the file header listing skills and agents relevant to this process. The SDK reads these markers to provide targeted discovery results instead of scanning all available skills.",
|
|
134
|
-
"- JSDoc marker format: `@skill <name> <path-relative-to-binding.dir>`, `@agent <name> <path-relative-to-binding.dir>`.",
|
|
135
|
-
"- Prefer modular, reusable process composition. If a generic reusable part is identified, build it modularly in `.a5c/processes/` for future composition.",
|
|
136
|
-
"- Processes should include: explicit milestones, quality gates with executable verification, iterative convergence loops, integration phases with integration tests.",
|
|
137
|
-
"- Test-driven approach where quality gate agents can use executable tools, scripts, and tests to verify accuracy and completeness.",
|
|
138
|
-
"",
|
|
139
|
-
"Non-interactive Mode Enhancement:",
|
|
140
|
-
"- In non-interactive mode, still parse the request, inspect the workspace, resolve the active process-library root, and search for the most relevant specialization or methodology before authoring. Do not skip the search step just because it is non-interactive.",
|
|
138
|
+
composedInstructions,
|
|
141
139
|
"",
|
|
142
140
|
`Required output path: ${outputPath}`,
|
|
143
141
|
...formatSharedContext(context),
|
|
@@ -174,7 +172,9 @@ function buildProcessDefinitionUserPrompt(userPrompt, outputPath, options) {
|
|
|
174
172
|
lines.push("Before writing the process, you MUST resolve and search the active process-library. Use babysitter_resolve_process_library, then babysitter_search_process_library to find relevant patterns.", "The generated process must directly execute the user's requested work rather than write another babysitter process.", "Use babysitter_write_process_definition to write the file now, then call babysitter_report_process_definition exactly once.");
|
|
175
173
|
return lines.join("\n");
|
|
176
174
|
}
|
|
177
|
-
function buildOrchestrationSystemPrompt(selectedHarnessName, context) {
|
|
175
|
+
function buildOrchestrationSystemPrompt(selectedHarnessName, context, interactive) {
|
|
176
|
+
const piCtx = (0, context_1.createPiContext)({ interactive });
|
|
177
|
+
const composedInstructions = (0, compose_1.composeOrchestrationPrompt)(piCtx);
|
|
178
178
|
return [
|
|
179
179
|
"You are the babysitter harness:create-run phase 2 orchestration agent.",
|
|
180
180
|
"Your job is to run the babysitter orchestration loop through tools, not by narrating what should happen.",
|
|
@@ -187,18 +187,16 @@ function buildOrchestrationSystemPrompt(selectedHarnessName, context) {
|
|
|
187
187
|
"- Call babysitter_run_create to create the run if it does not already exist.",
|
|
188
188
|
"- Immediately call babysitter_bind_session after run creation and before the first orchestration iteration.",
|
|
189
189
|
"- Work in bounded turns. In each turn, call babysitter_run_iterate at most once unless the prompt explicitly tells you otherwise.",
|
|
190
|
-
"- When babysitter_run_iterate reports pending effects, resolve each effect through tools.",
|
|
191
|
-
"- For breakpoint effects, use AskUserQuestion in interactive mode with explicit approval options, then call babysitter_task_post_result. Never auto-approve or fabricate an approval response. In non-interactive mode, select the best option according to the user intent and current context, then call babysitter_task_post_result.",
|
|
192
|
-
"- For `shell` effects, prefer `babysitter_run_shell_effect` so the command executes on an internal PI worker that respects task metadata. Use raw bash/coding tools only when the effect payload clearly requires manual inspection or direct intervention before posting the explicit outcome with babysitter_task_post_result.",
|
|
193
|
-
"- For `agent`, `node`, and `orchestrator_task` effects, prefer babysitter_dispatch_effect_harness so the pending effect is fulfilled through the intended harness wrapper. These babysitter effect tools are the built-in internal `harness:create-run` harness surface for phase 2. If you fulfill an effect directly with your own coding tools, you must still call babysitter_task_post_result with the explicit outcome.",
|
|
194
190
|
"- Do not rely on a hidden host-side effect executor. Perform or dispatch each effect intentionally based on the effect payload you received from babysitter_run_iterate.",
|
|
195
191
|
"- Shell effects are first-class pending effects. Do not skip them, narrate them, or assume the host will run them for you.",
|
|
196
192
|
"- When choosing how to execute pending work, respect task-level harness metadata and the installed harness catalog provided below.",
|
|
197
|
-
"- Shell effects execute on internal PI worker sessions. Respect `task.metadata.bashSandbox`, `task.metadata.isolated`, and `task.metadata.enableCompaction` when the process encoded stronger guardrails for that worker.",
|
|
198
|
-
"- Internal secure execution is available through opt-in PI worker sessions; prefer that path for shell or security-sensitive work instead of assuming an external CLI harness is guarded.",
|
|
199
193
|
"- Stay in the orchestration loop until the run completes, fails, or reaches a hard limit reported by the tools.",
|
|
200
194
|
"- When the run reaches a terminal state, call babysitter_finish_orchestration exactly once.",
|
|
201
195
|
"",
|
|
196
|
+
"--- Shared Orchestration Instructions ---",
|
|
197
|
+
"",
|
|
198
|
+
composedInstructions,
|
|
199
|
+
"",
|
|
202
200
|
"This phase is the bound orchestration phase. Preserve the hook-style loop semantics by always continuing through the babysitter tools.",
|
|
203
201
|
...formatSharedContext(context),
|
|
204
202
|
].join("\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookRun.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hookRun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"hookRun.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hookRun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,wGAAwG;IACxG,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAmJD,wBAAsB,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0F7E"}
|
|
@@ -16,6 +16,7 @@ exports.handleHookRun = handleHookRun;
|
|
|
16
16
|
const harness_1 = require("../../harness");
|
|
17
17
|
const config_loader_1 = require("../../compression/config-loader");
|
|
18
18
|
const density_filter_1 = require("../../compression/density-filter");
|
|
19
|
+
const runLogger_1 = require("../../logging/runLogger");
|
|
19
20
|
// ---------------------------------------------------------------------------
|
|
20
21
|
// Stdin reader
|
|
21
22
|
// ---------------------------------------------------------------------------
|
|
@@ -130,6 +131,20 @@ async function handlePreToolUse() {
|
|
|
130
131
|
// ---------------------------------------------------------------------------
|
|
131
132
|
// Main dispatcher
|
|
132
133
|
// ---------------------------------------------------------------------------
|
|
134
|
+
/** Fire-and-forget log to the structured run log facility. */
|
|
135
|
+
function logHookEvent(hookType, message, context) {
|
|
136
|
+
void (0, runLogger_1.appendRunLog)({
|
|
137
|
+
timestamp: new Date().toISOString(),
|
|
138
|
+
level: "info",
|
|
139
|
+
type: "hook",
|
|
140
|
+
label: `hook:${hookType}`,
|
|
141
|
+
message,
|
|
142
|
+
source: "hook:run",
|
|
143
|
+
context,
|
|
144
|
+
}).catch(() => {
|
|
145
|
+
// Never let logging break hook execution.
|
|
146
|
+
});
|
|
147
|
+
}
|
|
133
148
|
async function handleHookRun(args) {
|
|
134
149
|
const { hookType, harness, json } = args;
|
|
135
150
|
if (!hookType) {
|
|
@@ -145,12 +160,17 @@ async function handleHookRun(args) {
|
|
|
145
160
|
}
|
|
146
161
|
return 1;
|
|
147
162
|
}
|
|
163
|
+
logHookEvent(hookType, "Hook invoked", { harness });
|
|
148
164
|
// harness-agnostic hook types — handle before adapter lookup
|
|
149
165
|
if (hookType === "user-prompt-submit") {
|
|
150
|
-
|
|
166
|
+
const code = await handleUserPromptSubmit();
|
|
167
|
+
logHookEvent(hookType, `Hook completed with code=${code}`);
|
|
168
|
+
return code;
|
|
151
169
|
}
|
|
152
170
|
if (hookType === "pre-tool-use") {
|
|
153
|
-
|
|
171
|
+
const code = await handlePreToolUse();
|
|
172
|
+
logHookEvent(hookType, `Hook completed with code=${code}`);
|
|
173
|
+
return code;
|
|
154
174
|
}
|
|
155
175
|
const adapter = (0, harness_1.getAdapterByName)(harness);
|
|
156
176
|
if (!adapter) {
|
|
@@ -159,6 +179,7 @@ async function handleHookRun(args) {
|
|
|
159
179
|
error: "UNSUPPORTED_HARNESS",
|
|
160
180
|
message: `Unsupported harness: "${harness}". Supported: ${supported.join(", ")}`,
|
|
161
181
|
};
|
|
182
|
+
logHookEvent(hookType, `Unsupported harness: ${harness}`, { error: error.error });
|
|
162
183
|
if (json) {
|
|
163
184
|
process.stderr.write(JSON.stringify(error, null, 2) + "\n");
|
|
164
185
|
}
|
|
@@ -175,6 +196,7 @@ async function handleHookRun(args) {
|
|
|
175
196
|
error: "UNSUPPORTED_HOOK_TYPE",
|
|
176
197
|
message,
|
|
177
198
|
};
|
|
199
|
+
logHookEvent(hookType, message, { error: error.error });
|
|
178
200
|
if (json) {
|
|
179
201
|
process.stderr.write(JSON.stringify(error, null, 2) + "\n");
|
|
180
202
|
}
|
|
@@ -183,16 +205,20 @@ async function handleHookRun(args) {
|
|
|
183
205
|
}
|
|
184
206
|
return 1;
|
|
185
207
|
}
|
|
208
|
+
let exitCode;
|
|
186
209
|
switch (hookType) {
|
|
187
210
|
case "stop":
|
|
188
|
-
|
|
211
|
+
exitCode = await adapter.handleStopHook(args);
|
|
212
|
+
break;
|
|
189
213
|
case "session-start":
|
|
190
|
-
|
|
214
|
+
exitCode = await adapter.handleSessionStartHook(args);
|
|
215
|
+
break;
|
|
191
216
|
default: {
|
|
192
217
|
const error = {
|
|
193
218
|
error: "UNKNOWN_HOOK_TYPE",
|
|
194
219
|
message: `Unknown hook type: ${hookType}. Supported: stop, session-start, user-prompt-submit`,
|
|
195
220
|
};
|
|
221
|
+
logHookEvent(hookType, error.message, { error: error.error });
|
|
196
222
|
if (json) {
|
|
197
223
|
process.stderr.write(JSON.stringify(error, null, 2) + "\n");
|
|
198
224
|
}
|
|
@@ -202,4 +228,6 @@ async function handleHookRun(args) {
|
|
|
202
228
|
return 1;
|
|
203
229
|
}
|
|
204
230
|
}
|
|
231
|
+
logHookEvent(hookType, `Hook completed with code=${exitCode}`, { harness });
|
|
232
|
+
return exitCode;
|
|
205
233
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI handlers for `instructions:*` commands.
|
|
3
|
+
*
|
|
4
|
+
* Each subcommand resolves a PromptContext for the given harness,
|
|
5
|
+
* calls the appropriate composer, and outputs the result.
|
|
6
|
+
*
|
|
7
|
+
* @module cli/commands/instructions
|
|
8
|
+
*/
|
|
9
|
+
export interface InstructionsCommandArgs {
|
|
10
|
+
subcommand: "babysit-skill" | "process-create" | "orchestrate" | "breakpoint-handling";
|
|
11
|
+
harness: string;
|
|
12
|
+
interactive: boolean | undefined;
|
|
13
|
+
json: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Route and handle an `instructions:*` subcommand.
|
|
17
|
+
*/
|
|
18
|
+
export declare function handleInstructionsCommand(args: InstructionsCommandArgs): Promise<number>;
|
|
19
|
+
//# sourceMappingURL=instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,eAAe,GAAG,gBAAgB,GAAG,aAAa,GAAG,qBAAqB,CAAC;IACvF,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;CACf;AA4GD;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAiEjB"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CLI handlers for `instructions:*` commands.
|
|
4
|
+
*
|
|
5
|
+
* Each subcommand resolves a PromptContext for the given harness,
|
|
6
|
+
* calls the appropriate composer, and outputs the result.
|
|
7
|
+
*
|
|
8
|
+
* @module cli/commands/instructions
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.handleInstructionsCommand = handleInstructionsCommand;
|
|
12
|
+
const prompts_1 = require("../../prompts");
|
|
13
|
+
const active_1 = require("../../processLibrary/active");
|
|
14
|
+
const registry_1 = require("../../harness/registry");
|
|
15
|
+
/**
|
|
16
|
+
* Legacy fallback map — used only when an adapter does not implement
|
|
17
|
+
* `getPromptContext()`. New harnesses should add the method to their
|
|
18
|
+
* adapter instead of extending this map.
|
|
19
|
+
*/
|
|
20
|
+
const KNOWN_HARNESSES = {
|
|
21
|
+
"claude-code": prompts_1.createClaudeCodeContext,
|
|
22
|
+
"codex": prompts_1.createCodexContext,
|
|
23
|
+
"pi": prompts_1.createPiContext,
|
|
24
|
+
};
|
|
25
|
+
const COMPOSERS = {
|
|
26
|
+
"babysit-skill": {
|
|
27
|
+
fn: prompts_1.composeBabysitSkillPrompt,
|
|
28
|
+
promptType: "babysit-skill",
|
|
29
|
+
partsIncluded: [
|
|
30
|
+
"non-negotiables", "dependencies", "interview", "user-profile",
|
|
31
|
+
"process-creation", "intent-fidelity-checks", "run-creation",
|
|
32
|
+
"iteration", "effects", "breakpoint-handling", "results-posting",
|
|
33
|
+
"loop-control", "completion-proof", "task-kinds", "task-examples",
|
|
34
|
+
"quick-reference", "recovery", "process-guidelines", "critical-rules",
|
|
35
|
+
"see-also",
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
"process-create": {
|
|
39
|
+
fn: prompts_1.composeProcessCreatePrompt,
|
|
40
|
+
promptType: "process-create",
|
|
41
|
+
partsIncluded: [
|
|
42
|
+
"interview", "user-profile", "process-creation",
|
|
43
|
+
"intent-fidelity-checks", "process-guidelines",
|
|
44
|
+
"task-kinds", "task-examples",
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
"orchestrate": {
|
|
48
|
+
fn: prompts_1.composeOrchestrationPrompt,
|
|
49
|
+
promptType: "orchestrate",
|
|
50
|
+
partsIncluded: [
|
|
51
|
+
"run-creation", "iteration", "effects", "breakpoint-handling",
|
|
52
|
+
"results-posting", "loop-control", "completion-proof",
|
|
53
|
+
"quick-reference", "recovery", "critical-rules",
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
"breakpoint-handling": {
|
|
57
|
+
fn: prompts_1.composeBreakpointPrompt,
|
|
58
|
+
promptType: "breakpoint-handling",
|
|
59
|
+
partsIncluded: ["breakpoint-handling", "results-posting"],
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Resolve a PromptContext factory by harness name.
|
|
64
|
+
*
|
|
65
|
+
* Prefers the adapter's own `getPromptContext()` method when available,
|
|
66
|
+
* falling back to the legacy KNOWN_HARNESSES map for adapters that have
|
|
67
|
+
* not yet been updated. Returns undefined for completely unknown names.
|
|
68
|
+
*/
|
|
69
|
+
function resolveContextFactory(harness) {
|
|
70
|
+
// Try adapter-based resolution first
|
|
71
|
+
const adapter = (0, registry_1.getAdapterByName)(harness);
|
|
72
|
+
if (adapter?.getPromptContext) {
|
|
73
|
+
return (overrides) => {
|
|
74
|
+
const base = adapter.getPromptContext({ interactive: overrides?.interactive });
|
|
75
|
+
// Merge any additional overrides beyond interactive
|
|
76
|
+
if (overrides) {
|
|
77
|
+
return { ...base, ...overrides };
|
|
78
|
+
}
|
|
79
|
+
return base;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
// Fallback to legacy map
|
|
83
|
+
return KNOWN_HARNESSES[harness];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Try to resolve the active process-library root from the SDK directly.
|
|
87
|
+
* Returns the library root and reference root if a binding exists,
|
|
88
|
+
* or undefined values if resolution fails (no binding, network error, etc.).
|
|
89
|
+
*/
|
|
90
|
+
async function tryResolveProcessLibraryRoot() {
|
|
91
|
+
try {
|
|
92
|
+
const resolved = await (0, active_1.resolveActiveProcessLibrary)();
|
|
93
|
+
if (resolved.binding?.dir) {
|
|
94
|
+
const defaultSpec = (0, active_1.getDefaultProcessLibrarySpec)();
|
|
95
|
+
return {
|
|
96
|
+
processLibraryRoot: resolved.binding.dir,
|
|
97
|
+
processLibraryReferenceRoot: defaultSpec.referenceRoot,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// No binding exists or resolution failed — fall back to manual instructions
|
|
103
|
+
}
|
|
104
|
+
return {};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Route and handle an `instructions:*` subcommand.
|
|
108
|
+
*/
|
|
109
|
+
async function handleInstructionsCommand(args) {
|
|
110
|
+
const factory = resolveContextFactory(args.harness);
|
|
111
|
+
if (!factory) {
|
|
112
|
+
const known = Object.keys(KNOWN_HARNESSES).join(", ");
|
|
113
|
+
if (args.json) {
|
|
114
|
+
console.log(JSON.stringify({
|
|
115
|
+
error: "unknown_harness",
|
|
116
|
+
message: `Unknown harness "${args.harness}". Known harnesses: ${known}`,
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
console.error(`[instructions] Unknown harness "${args.harness}". Known harnesses: ${known}`);
|
|
121
|
+
}
|
|
122
|
+
return 1;
|
|
123
|
+
}
|
|
124
|
+
const composer = COMPOSERS[args.subcommand];
|
|
125
|
+
if (!composer) {
|
|
126
|
+
const known = Object.keys(COMPOSERS).join(", ");
|
|
127
|
+
if (args.json) {
|
|
128
|
+
console.log(JSON.stringify({
|
|
129
|
+
error: "unknown_subcommand",
|
|
130
|
+
message: `Unknown subcommand "${args.subcommand}". Known subcommands: ${known}`,
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
console.error(`[instructions] Unknown subcommand "${args.subcommand}". Known subcommands: ${known}`);
|
|
135
|
+
}
|
|
136
|
+
return 1;
|
|
137
|
+
}
|
|
138
|
+
// Resolve the active process-library root before composing the prompt
|
|
139
|
+
const libraryInfo = await tryResolveProcessLibraryRoot();
|
|
140
|
+
const ctx = factory({
|
|
141
|
+
interactive: args.interactive,
|
|
142
|
+
...libraryInfo,
|
|
143
|
+
});
|
|
144
|
+
const content = composer.fn(ctx);
|
|
145
|
+
if (args.json) {
|
|
146
|
+
console.log(JSON.stringify({
|
|
147
|
+
harness: args.harness,
|
|
148
|
+
interactive: args.interactive,
|
|
149
|
+
promptType: composer.promptType,
|
|
150
|
+
content,
|
|
151
|
+
partsIncluded: composer.partsIncluded,
|
|
152
|
+
}, null, 2));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
console.log(content);
|
|
156
|
+
}
|
|
157
|
+
return 0;
|
|
158
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* log CLI command.
|
|
3
|
+
*
|
|
4
|
+
* Writes a structured log entry to the appropriate contextual log file.
|
|
5
|
+
* Intended to be called from shell hooks and scripts as a canonical way
|
|
6
|
+
* to emit structured logs without embedding JSONL formatting inline.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* babysitter log --type <process|hook|cli> --message <msg> [--run-id <id>] [--label <label>] [--level <level>] [--source <src>] [--json]
|
|
10
|
+
*/
|
|
11
|
+
export interface LogCommandArgs {
|
|
12
|
+
logType: string;
|
|
13
|
+
message: string;
|
|
14
|
+
runId?: string;
|
|
15
|
+
processId?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
level?: string;
|
|
18
|
+
source?: string;
|
|
19
|
+
json: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function handleLog(args: LogCommandArgs): Promise<number>;
|
|
22
|
+
//# sourceMappingURL=log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AAaD,wBAAsB,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA4ErE"}
|