@a5c-ai/babysitter-sdk 5.0.1-staging.ff407b73 → 5.0.1-staging.ffad3b46492e
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/README.md +2 -2
- package/dist/breakpoints/evaluator.js +1 -1
- package/dist/breakpoints/proven-verification.d.ts +6 -6
- package/dist/breakpoints/proven-verification.d.ts.map +1 -1
- package/dist/breakpoints/proven-verification.js +9 -9
- package/dist/cli/commands/detectExistingRun.d.ts +14 -0
- package/dist/cli/commands/detectExistingRun.d.ts.map +1 -0
- package/dist/cli/commands/detectExistingRun.js +89 -0
- package/dist/cli/commands/hooks/log.d.ts.map +1 -1
- package/dist/cli/commands/hooks/log.js +4 -1
- package/dist/cli/commands/instructions.d.ts.map +1 -1
- package/dist/cli/commands/instructions.js +24 -44
- package/dist/cli/commands/mcpServe.d.ts +1 -1
- package/dist/cli/commands/mcpServe.js +3 -3
- package/dist/cli/commands/runIterate.d.ts +1 -0
- package/dist/cli/commands/runIterate.d.ts.map +1 -1
- package/dist/cli/commands/runIterate.js +25 -0
- package/dist/cli/commands/session/checkIteration.d.ts.map +1 -1
- package/dist/cli/commands/session/checkIteration.js +0 -22
- package/dist/cli/commands/session/common.js +1 -1
- package/dist/cli/commands/session/init.d.ts.map +1 -1
- package/dist/cli/commands/session/init.js +2 -1
- package/dist/cli/commands/session/resume.d.ts.map +1 -1
- package/dist/cli/commands/session/resume.js +3 -2
- package/dist/cli/commands/session/update.d.ts +0 -1
- package/dist/cli/commands/session/update.d.ts.map +1 -1
- package/dist/cli/commands/session/update.js +0 -12
- package/dist/cli/commands/skill/remoteDiscovery.js +1 -1
- package/dist/cli/main/argFlags.d.ts.map +1 -1
- package/dist/cli/main/argFlags.js +0 -3
- package/dist/cli/main/argPositionals.d.ts.map +1 -1
- package/dist/cli/main/argPositionals.js +1 -0
- package/dist/cli/main/dispatchRunSession.d.ts.map +1 -1
- package/dist/cli/main/dispatchRunSession.js +2 -1
- package/dist/cli/main/program.js +3 -3
- package/dist/cli/main/runAssignProcess.d.ts +3 -0
- package/dist/cli/main/runAssignProcess.d.ts.map +1 -0
- package/dist/cli/main/runAssignProcess.js +172 -0
- package/dist/cli/main/runCommands.d.ts +1 -0
- package/dist/cli/main/runCommands.d.ts.map +1 -1
- package/dist/cli/main/runCommands.js +3 -1
- package/dist/cli/main/runCreate.d.ts.map +1 -1
- package/dist/cli/main/runCreate.js +64 -27
- package/dist/cli/main/types.d.ts +0 -1
- package/dist/cli/main/types.d.ts.map +1 -1
- package/dist/cli/main/usage.d.ts.map +1 -1
- package/dist/cli/main/usage.js +7 -6
- package/dist/cli/render/events/index.d.ts.map +1 -1
- package/dist/cli/render/events/index.js +2 -0
- package/dist/cli/render/events/processAssigned.d.ts +3 -0
- package/dist/cli/render/events/processAssigned.d.ts.map +1 -0
- package/dist/cli/render/events/processAssigned.js +22 -0
- package/dist/config/defaults.js +1 -1
- package/dist/cost/index.js +1 -1
- package/dist/harness/BaseAdapter.d.ts.map +1 -1
- package/dist/harness/BaseAdapter.js +1 -0
- package/dist/harness/adapters/claude-code.d.ts +2 -8
- package/dist/harness/adapters/claude-code.d.ts.map +1 -1
- package/dist/harness/adapters/claude-code.js +3 -8
- package/dist/harness/amuxFallbackMetadata.d.ts.map +1 -1
- package/dist/harness/amuxFallbackMetadata.js +31 -2
- package/dist/harness/customAdapter.d.ts.map +1 -1
- package/dist/harness/customAdapter.js +1 -18
- package/dist/harness/hooks/promptContexts.d.ts +6 -1
- package/dist/harness/hooks/promptContexts.d.ts.map +1 -1
- package/dist/harness/hooks/promptContexts.js +65 -142
- package/dist/harness/hooks/runState.d.ts +1 -0
- package/dist/harness/hooks/runState.d.ts.map +1 -1
- package/dist/harness/hooks/runState.js +8 -0
- package/dist/harness/hooks/sessionBinding.d.ts.map +1 -1
- package/dist/harness/hooks/sessionBinding.js +10 -2
- package/dist/harness/hooks/stopHookContinuation.d.ts +1 -0
- package/dist/harness/hooks/stopHookContinuation.d.ts.map +1 -1
- package/dist/harness/hooks/stopHookContinuation.js +6 -0
- package/dist/harness/hooks/stopHookHandler.d.ts.map +1 -1
- package/dist/harness/hooks/stopHookHandler.js +309 -36
- package/dist/harness/hooks/utils.d.ts +5 -1
- package/dist/harness/hooks/utils.d.ts.map +1 -1
- package/dist/harness/hooks/utils.js +15 -8
- package/dist/harness/install.d.ts +0 -4
- package/dist/harness/install.d.ts.map +1 -1
- package/dist/harness/install.js +79 -0
- package/dist/harness/installSupport.d.ts.map +1 -1
- package/dist/harness/installSupport.js +12 -11
- package/dist/harness/registry.d.ts.map +1 -1
- package/dist/harness/registry.js +64 -68
- package/dist/harness/unified/adapter.d.ts.map +1 -1
- package/dist/harness/unified/adapter.js +31 -0
- package/dist/hooks/dispatcher.d.ts +2 -2
- package/dist/hooks/dispatcher.d.ts.map +1 -1
- package/dist/hooks/dispatcher.js +56 -15
- package/dist/index.js +3 -3
- package/dist/logging/runLogger.d.ts.map +1 -1
- package/dist/logging/runLogger.js +2 -0
- package/dist/mcp/index.js +3 -3
- package/dist/mcp/tools/discovery.js +6 -6
- package/dist/mcp/tools/runs.js +18 -18
- package/dist/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/mcp/tools/sessions.js +21 -20
- package/dist/mcp/tools/tasks.js +13 -13
- package/dist/mcp/transport/index.js +1 -1
- package/dist/plugins/marketplace.d.ts.map +1 -1
- package/dist/plugins/marketplace.js +26 -2
- package/dist/plugins/migrations.d.ts.map +1 -1
- package/dist/plugins/migrations.js +31 -9
- package/dist/processLibrary/active.d.ts.map +1 -1
- package/dist/processLibrary/active.js +18 -1
- package/dist/prompts/capabilityCollector.d.ts.map +1 -1
- package/dist/prompts/capabilityCollector.js +23 -14
- package/dist/prompts/compose.d.ts.map +1 -1
- package/dist/prompts/compose.js +13 -2
- package/dist/prompts/context.d.ts +2 -2
- package/dist/prompts/context.d.ts.map +1 -1
- package/dist/prompts/context.js +4 -11
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +3 -6
- package/dist/prompts/parts/criticalRules.d.ts.map +1 -1
- package/dist/prompts/parts/criticalRules.js +15 -2
- package/dist/prompts/parts/runCreation.d.ts.map +1 -1
- package/dist/prompts/parts/runCreation.js +25 -4
- package/dist/prompts/parts/taskKinds.d.ts.map +1 -1
- package/dist/prompts/parts/taskKinds.js +11 -3
- package/dist/prompts/templateRenderer.d.ts.map +1 -1
- package/dist/prompts/templateRenderer.js +114 -22
- package/dist/prompts/templates/commands/assimilate.md +1 -1
- package/dist/prompts/templates/commands/cleanup.md +31 -9
- package/dist/prompts/templates/commands/contrib.md +1 -1
- package/dist/prompts/templates/commands/doctor.md +3 -4
- package/dist/prompts/templates/commands/forever.md +1 -1
- package/dist/prompts/templates/commands/project-install.md +1 -1
- package/dist/prompts/templates/commands/retrospect.md +1 -1
- package/dist/prompts/templates/commands/user-install.md +1 -1
- package/dist/prompts/templates/quick-reference.md +5 -0
- package/dist/prompts/templates/run-creation.md +45 -1
- package/dist/runtime/commitEffectResult.d.ts.map +1 -1
- package/dist/runtime/commitEffectResult.js +3 -0
- package/dist/runtime/createRun.d.ts.map +1 -1
- package/dist/runtime/createRun.js +10 -3
- package/dist/runtime/intrinsics/breakpoint.js +1 -1
- package/dist/runtime/intrinsics/subprocess.js +2 -2
- package/dist/runtime/intrinsics/task.d.ts +2 -1
- package/dist/runtime/intrinsics/task.d.ts.map +1 -1
- package/dist/runtime/intrinsics/task.js +42 -3
- package/dist/runtime/invocation/hashInvocationKey.d.ts +2 -1
- package/dist/runtime/invocation/hashInvocationKey.d.ts.map +1 -1
- package/dist/runtime/invocation/hashInvocationKey.js +5 -1
- package/dist/runtime/orchestrateIteration.d.ts.map +1 -1
- package/dist/runtime/orchestrateIteration.js +77 -1
- package/dist/runtime/processCodeHash.d.ts +2 -0
- package/dist/runtime/processCodeHash.d.ts.map +1 -0
- package/dist/runtime/processCodeHash.js +21 -0
- package/dist/runtime/processContext.d.ts +6 -3
- package/dist/runtime/processContext.d.ts.map +1 -1
- package/dist/runtime/processContext.js +50 -0
- package/dist/runtime/replay/createReplayEngine.d.ts +1 -1
- package/dist/runtime/replay/createReplayEngine.d.ts.map +1 -1
- package/dist/runtime/replay/stateCache.d.ts +2 -0
- package/dist/runtime/replay/stateCache.d.ts.map +1 -1
- package/dist/runtime/replay/stateCache.js +14 -3
- package/dist/runtime/types.d.ts +21 -3
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/workDirLeak.d.ts +8 -0
- package/dist/runtime/workDirLeak.d.ts.map +1 -0
- package/dist/runtime/workDirLeak.js +51 -0
- package/dist/sdkVersion.d.ts +5 -0
- package/dist/sdkVersion.d.ts.map +1 -0
- package/dist/sdkVersion.js +49 -0
- package/dist/session/cleanup.d.ts.map +1 -1
- package/dist/session/cleanup.js +12 -1
- package/dist/session/discovery.d.ts +6 -6
- package/dist/session/discovery.js +6 -6
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +1 -3
- package/dist/session/parse.d.ts.map +1 -1
- package/dist/session/parse.js +5 -1
- package/dist/session/types.d.ts +3 -7
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/write.d.ts +1 -10
- package/dist/session/write.d.ts.map +1 -1
- package/dist/session/write.js +4 -31
- package/dist/storage/createRunDir.d.ts.map +1 -1
- package/dist/storage/createRunDir.js +2 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -1
- package/dist/storage/journal.d.ts.map +1 -1
- package/dist/storage/journal.js +48 -28
- package/dist/storage/runFiles.d.ts +1 -0
- package/dist/storage/runFiles.d.ts.map +1 -1
- package/dist/storage/runFiles.js +5 -0
- package/dist/storage/tasks.d.ts.map +1 -1
- package/dist/storage/tasks.js +3 -2
- package/dist/storage/types.d.ts +4 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/tasks/types.d.ts +4 -2
- package/dist/tasks/types.d.ts.map +1 -1
- package/dist/utils/sessionMarker.d.ts +16 -0
- package/dist/utils/sessionMarker.d.ts.map +1 -1
- package/dist/utils/sessionMarker.js +55 -20
- package/package.json +24 -11
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ npm install @a5c-ai/babysitter-sdk
|
|
|
11
11
|
Optional breakpoint routing support:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install @a5c-ai/
|
|
14
|
+
npm install @a5c-ai/tasks-mux
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
This package ships the built runtime in `dist/`, bundled command/skill templates in `skills/`, and this package README for npm auditability.
|
|
@@ -33,7 +33,7 @@ npx @a5c-ai/babysitter-sdk babysitter-mcp-server --help
|
|
|
33
33
|
- `process-library:*`, `profile:*`, and `instructions:*` for library/profile management and generated guidance
|
|
34
34
|
- `tokens:*`, `compression:*`, `log`, `hook:*`, `health`, `configure`, and `version` for operator workflows
|
|
35
35
|
|
|
36
|
-
The optional interactive runtime commands such as `create-run`, `resume-run`, `plan`, `yolo`, `observe`, and `tui` live in the separate `@a5c-ai/
|
|
36
|
+
The optional interactive runtime commands such as `create-run`, `resume-run`, `plan`, `yolo`, `observe`, and `tui` live in the separate `@a5c-ai/agent-platform` package.
|
|
37
37
|
|
|
38
38
|
## API Surface
|
|
39
39
|
|
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.evaluateAutoApproval = evaluateAutoApproval;
|
|
16
16
|
const patterns_1 = require("./patterns");
|
|
17
17
|
// ---------------------------------------------------------------------------
|
|
18
|
-
// Inlined posture helpers (canonical implementation moved to
|
|
18
|
+
// Inlined posture helpers (canonical implementation moved to agent-platform)
|
|
19
19
|
// ---------------------------------------------------------------------------
|
|
20
20
|
const DEFAULT_POSTURES = {
|
|
21
21
|
read: { name: 'permissive', allowAutoApprove: true, minConsecutiveApprovalsForAutoN: 0, requireExplicitRule: false, requiredApproverLevel: 'any' },
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Optional integration with @a5c-ai/
|
|
2
|
+
* Optional integration with @a5c-ai/tasks-mux proven subsystem.
|
|
3
3
|
*
|
|
4
4
|
* Provides cryptographic verification of breakpoint answers when the
|
|
5
|
-
*
|
|
5
|
+
* tasks-mux package is available as an optional peer dependency.
|
|
6
6
|
* Never throws -- always returns a graceful result.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
export interface BreakpointVerificationConfig {
|
|
12
12
|
/** Whether verification is enabled. When false, verification is skipped. */
|
|
13
13
|
enabled: boolean;
|
|
14
|
-
/** Directory containing trusted public keys. Passed to
|
|
14
|
+
/** Directory containing trusted public keys. Passed to tasks-mux verifyAnswer. */
|
|
15
15
|
trustedKeysDir?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -20,7 +20,7 @@ export interface BreakpointVerificationConfig {
|
|
|
20
20
|
export interface BreakpointVerificationResult {
|
|
21
21
|
/** Whether the answer was successfully verified as authentic. */
|
|
22
22
|
verified: boolean;
|
|
23
|
-
/** Detailed verification result from
|
|
23
|
+
/** Detailed verification result from tasks-mux (when available). */
|
|
24
24
|
verificationResult?: {
|
|
25
25
|
valid: boolean;
|
|
26
26
|
publicKeyFingerprint?: string;
|
|
@@ -38,9 +38,9 @@ export interface BreakpointVerificationResult {
|
|
|
38
38
|
export declare function hasSignatureFields(result: Record<string, unknown>): boolean;
|
|
39
39
|
/**
|
|
40
40
|
* Verify a breakpoint result's cryptographic signature using the
|
|
41
|
-
*
|
|
41
|
+
* tasks-mux proven subsystem.
|
|
42
42
|
*
|
|
43
|
-
* This function never throws. If
|
|
43
|
+
* This function never throws. If tasks-mux is not installed,
|
|
44
44
|
* verification is disabled, or the result is unsigned, it returns
|
|
45
45
|
* a graceful { verified: false } result with an explanatory reason.
|
|
46
46
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proven-verification.d.ts","sourceRoot":"","sources":["../../src/breakpoints/proven-verification.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,4EAA4E;IAC5E,OAAO,EAAE,OAAO,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"proven-verification.d.ts","sourceRoot":"","sources":["../../src/breakpoints/proven-verification.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,4EAA4E;IAC5E,OAAO,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,iEAAiE;IACjE,QAAQ,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,kBAAkB,CAAC,EAAE;QACnB,KAAK,EAAE,OAAO,CAAC;QACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAaD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAI3E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,CAAC,EAAE,4BAA4B,GACpC,OAAO,CAAC,4BAA4B,CAAC,CAuEvC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Optional integration with @a5c-ai/
|
|
3
|
+
* Optional integration with @a5c-ai/tasks-mux proven subsystem.
|
|
4
4
|
*
|
|
5
5
|
* Provides cryptographic verification of breakpoint answers when the
|
|
6
|
-
*
|
|
6
|
+
* tasks-mux package is available as an optional peer dependency.
|
|
7
7
|
* Never throws -- always returns a graceful result.
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -61,9 +61,9 @@ function hasSignatureFields(result) {
|
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Verify a breakpoint result's cryptographic signature using the
|
|
64
|
-
*
|
|
64
|
+
* tasks-mux proven subsystem.
|
|
65
65
|
*
|
|
66
|
-
* This function never throws. If
|
|
66
|
+
* This function never throws. If tasks-mux is not installed,
|
|
67
67
|
* verification is disabled, or the result is unsigned, it returns
|
|
68
68
|
* a graceful { verified: false } result with an explanatory reason.
|
|
69
69
|
*
|
|
@@ -80,18 +80,18 @@ async function verifyBreakpointResult(result, config) {
|
|
|
80
80
|
if (!hasSignatureFields(result)) {
|
|
81
81
|
return { verified: false, reason: "result is not signed" };
|
|
82
82
|
}
|
|
83
|
-
// Attempt to dynamically import
|
|
83
|
+
// Attempt to dynamically import tasks-mux proven subsystem.
|
|
84
84
|
// The module is an optional peer dependency -- the import may fail at runtime.
|
|
85
85
|
// We use a string variable to prevent TypeScript from statically resolving the import.
|
|
86
86
|
try {
|
|
87
|
-
const modulePath = "@a5c-ai/
|
|
87
|
+
const modulePath = "@a5c-ai/tasks-mux/proven";
|
|
88
88
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
89
89
|
const proven = await Promise.resolve(`${modulePath}`).then(s => __importStar(require(s)));
|
|
90
90
|
const { verifyAnswer } = proven;
|
|
91
91
|
if (typeof verifyAnswer !== "function") {
|
|
92
92
|
return {
|
|
93
93
|
verified: false,
|
|
94
|
-
reason: "
|
|
94
|
+
reason: "tasks-mux/proven does not export verifyAnswer",
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
const verificationResult = await verifyAnswer(result, effectiveConfig.trustedKeysDir);
|
|
@@ -101,7 +101,7 @@ async function verifyBreakpointResult(result, config) {
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
catch (err) {
|
|
104
|
-
// Dynamic import failed --
|
|
104
|
+
// Dynamic import failed -- tasks-mux is not installed or broken
|
|
105
105
|
const message = err instanceof Error ? err.message : String(err);
|
|
106
106
|
if (message.includes("Cannot find module") ||
|
|
107
107
|
message.includes("MODULE_NOT_FOUND") ||
|
|
@@ -109,7 +109,7 @@ async function verifyBreakpointResult(result, config) {
|
|
|
109
109
|
message.includes("Could not resolve")) {
|
|
110
110
|
return {
|
|
111
111
|
verified: false,
|
|
112
|
-
reason: "
|
|
112
|
+
reason: "tasks-mux not installed",
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
return {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ExistingRunInfo {
|
|
2
|
+
runId: string;
|
|
3
|
+
runDir: string;
|
|
4
|
+
processId: string;
|
|
5
|
+
isBareRun: boolean;
|
|
6
|
+
entrypoint: {
|
|
7
|
+
importPath: string;
|
|
8
|
+
exportName?: string;
|
|
9
|
+
};
|
|
10
|
+
completionProof?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function detectExistingRun(): Promise<ExistingRunInfo | undefined>;
|
|
13
|
+
export declare function formatExistingRunBlock(existingRun: ExistingRunInfo): string;
|
|
14
|
+
//# sourceMappingURL=detectExistingRun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectExistingRun.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/detectExistingRun.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CA0B9E;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,eAAe,GAAG,MAAM,CAiB3E"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.detectExistingRun = detectExistingRun;
|
|
37
|
+
exports.formatExistingRunBlock = formatExistingRunBlock;
|
|
38
|
+
const node_fs_1 = require("node:fs");
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const config_1 = require("../../config");
|
|
41
|
+
async function detectExistingRun() {
|
|
42
|
+
try {
|
|
43
|
+
const runsDir = (0, config_1.resolveRunsDir)();
|
|
44
|
+
const entries = await node_fs_1.promises.readdir(runsDir, { withFileTypes: true });
|
|
45
|
+
const dirs = entries.filter((e) => e.isDirectory()).map((e) => e.name).sort().reverse();
|
|
46
|
+
for (const runId of dirs.slice(0, 5)) {
|
|
47
|
+
const runFile = path.join(runsDir, runId, "run.json");
|
|
48
|
+
try {
|
|
49
|
+
const raw = await node_fs_1.promises.readFile(runFile, "utf8");
|
|
50
|
+
const meta = JSON.parse(raw);
|
|
51
|
+
const entrypoint = meta["entrypoint"];
|
|
52
|
+
const processId = meta["processId"] ?? "";
|
|
53
|
+
const isBareRun = entrypoint?.importPath === "bare-run";
|
|
54
|
+
return {
|
|
55
|
+
runId,
|
|
56
|
+
runDir: path.join(runsDir, runId),
|
|
57
|
+
processId,
|
|
58
|
+
isBareRun,
|
|
59
|
+
entrypoint: { importPath: entrypoint?.importPath ?? "", exportName: entrypoint?.exportName },
|
|
60
|
+
completionProof: meta["completionProof"]
|
|
61
|
+
?? meta["metadata"]?.["completionProof"],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch { /* no runs dir */ }
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
function formatExistingRunBlock(existingRun) {
|
|
73
|
+
return [
|
|
74
|
+
'## Existing Run State',
|
|
75
|
+
'',
|
|
76
|
+
`- Run ID: \`${existingRun.runId}\``,
|
|
77
|
+
`- Run Dir: \`${existingRun.runDir}\``,
|
|
78
|
+
`- Process ID: \`${existingRun.processId}\``,
|
|
79
|
+
`- Bare Run: \`${existingRun.isBareRun}\``,
|
|
80
|
+
`- Entrypoint: \`${existingRun.entrypoint.importPath}${existingRun.entrypoint.exportName ? '#' + existingRun.entrypoint.exportName : ''}\``,
|
|
81
|
+
'',
|
|
82
|
+
existingRun.isBareRun
|
|
83
|
+
? `**This is a bare run.** Use \`run:assign-process ${existingRun.runDir} --entry <path>#<export>\` to assign a process before iterating.`
|
|
84
|
+
: `This run already has a process assigned. Use \`run:iterate ${existingRun.runDir} --json\` to continue.`,
|
|
85
|
+
'',
|
|
86
|
+
'---',
|
|
87
|
+
'',
|
|
88
|
+
].join('\n');
|
|
89
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/hooks/log.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/hooks/log.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AA8LD,wBAAsB,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwG7E"}
|
|
@@ -45,6 +45,7 @@ exports.handleHookLog = handleHookLog;
|
|
|
45
45
|
const node_fs_1 = require("node:fs");
|
|
46
46
|
const path = __importStar(require("node:path"));
|
|
47
47
|
const resolveInputPath_1 = require("../../resolveInputPath");
|
|
48
|
+
const sdkVersion_1 = require("../../../sdkVersion");
|
|
48
49
|
// ---------------------------------------------------------------------------
|
|
49
50
|
// Event label mapping (matches the label used in the original logger.sh)
|
|
50
51
|
// ---------------------------------------------------------------------------
|
|
@@ -174,7 +175,9 @@ const FIELD_EXTRACTORS = {
|
|
|
174
175
|
// ---------------------------------------------------------------------------
|
|
175
176
|
function formatLogLine(hookType, eventLabel, fields) {
|
|
176
177
|
const timestamp = new Date().toISOString();
|
|
177
|
-
const kvPairs = fields
|
|
178
|
+
const kvPairs = [...fields, ["sdkVersion", sdkVersion_1.BABYSITTER_SDK_VERSION]]
|
|
179
|
+
.map(([k, v]) => `${k}=${v}`)
|
|
180
|
+
.join(" ");
|
|
178
181
|
return `[${timestamp}] [${eventLabel}] hook=${hookType} ${kvPairs}`;
|
|
179
182
|
}
|
|
180
183
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoCH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,eAAe,GAAG,gBAAgB,GAAG,aAAa,GAAG,qBAAqB,CAAC;IACvF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AA4MD;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAwGjB"}
|
|
@@ -16,6 +16,7 @@ const registry_1 = require("../../harness/registry");
|
|
|
16
16
|
const discovery_1 = require("../../harness/discovery");
|
|
17
17
|
const parse_1 = require("../../session/parse");
|
|
18
18
|
const contextShared_1 = require("../../prompts/contextShared");
|
|
19
|
+
const detectExistingRun_1 = require("./detectExistingRun");
|
|
19
20
|
const COMPOSERS = {
|
|
20
21
|
"babysit-skill": {
|
|
21
22
|
fn: prompts_1.composeBabysitSkillPrompt,
|
|
@@ -169,18 +170,6 @@ async function tryResolveProcessLibraryRoot() {
|
|
|
169
170
|
}
|
|
170
171
|
return {};
|
|
171
172
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Detect whether the session-start hook has actually run by checking for the
|
|
174
|
-
* session state file it creates (`<stateDir>/<sessionId>.md`).
|
|
175
|
-
*
|
|
176
|
-
* The definitive signal is now the PID-scoped session marker written by the
|
|
177
|
-
* session-start hook; absence of the marker (even when env vars like
|
|
178
|
-
* GEMINI_SESSION_ID / CODEX_SESSION_ID / AGENT_SESSION_ID are present)
|
|
179
|
-
* usually means hooks did not fire. Env-var-only resolution is a fallback
|
|
180
|
-
* path that may bind to stale IDs inherited from ancestor shells, so it
|
|
181
|
-
* cannot be trusted as proof that hooks are active. The hook writes the
|
|
182
|
-
* state file as a side effect of `babysitter hook:run --hook-type session-start`.
|
|
183
|
-
*/
|
|
184
173
|
function detectHooksActive(harness) {
|
|
185
174
|
const adapter = (0, registry_1.getAdapterByName)(harness);
|
|
186
175
|
if (!adapter)
|
|
@@ -230,9 +219,9 @@ async function handleInstructionsCommand(args) {
|
|
|
230
219
|
// Resolve the active process-library root before composing the prompt
|
|
231
220
|
const libraryInfo = await tryResolveProcessLibraryRoot();
|
|
232
221
|
// Detect whether hooks are actually active in this session.
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
const hooksActive = detectHooksActive(resolvedHarness.harness);
|
|
222
|
+
// hookDriven=false when: non-interactive mode, or session-start hook never ran.
|
|
223
|
+
// Non-interactive mode never has hooks — the agent must drive the loop in-turn.
|
|
224
|
+
const hooksActive = args.interactive !== false && detectHooksActive(resolvedHarness.harness);
|
|
236
225
|
const hookOverride = {};
|
|
237
226
|
if (!hooksActive) {
|
|
238
227
|
hookOverride.hookDriven = false;
|
|
@@ -243,6 +232,7 @@ async function handleInstructionsCommand(args) {
|
|
|
243
232
|
// scheduled reporting, local-dev relaxations).
|
|
244
233
|
const executionContext = (0, prompts_1.detectExecutionContext)();
|
|
245
234
|
const capabilityFlags = (0, prompts_1.deriveCapabilityFlags)(executionContext);
|
|
235
|
+
const existingRun = await (0, detectExistingRun_1.detectExistingRun)();
|
|
246
236
|
const ctx = factory({
|
|
247
237
|
interactive: args.interactive,
|
|
248
238
|
...libraryInfo,
|
|
@@ -272,41 +262,31 @@ async function handleInstructionsCommand(args) {
|
|
|
272
262
|
executionContext,
|
|
273
263
|
capabilityFlags,
|
|
274
264
|
suggestedProcesses: (0, prompts_1.processPathsForCapabilities)(capabilityFlags),
|
|
265
|
+
existingRun: existingRun ?? null,
|
|
275
266
|
content,
|
|
276
267
|
partsIncluded: composer.partsIncluded,
|
|
277
268
|
}, null, 2));
|
|
278
269
|
}
|
|
279
270
|
else {
|
|
280
|
-
for (const warning of resolvedHarness.warnings)
|
|
271
|
+
for (const warning of resolvedHarness.warnings)
|
|
281
272
|
console.error(`[instructions] Warning: ${warning}`);
|
|
282
|
-
|
|
283
|
-
if (!hooksActive && ctx.hookDriven !== false) {
|
|
284
|
-
// Context factory defaulted hookDriven to true, but we overrode it.
|
|
285
|
-
// This is a no-op because the override already happened, but it
|
|
286
|
-
// clarifies the JSON output. The text output is self-explanatory
|
|
287
|
-
// from the generated instructions.
|
|
288
|
-
}
|
|
289
|
-
const activeCapabilities = Object.entries(capabilityFlags)
|
|
290
|
-
.filter(([, v]) => v === true)
|
|
291
|
-
.map(([k]) => k);
|
|
292
|
-
const contextHeader = [
|
|
293
|
-
'## Execution Context',
|
|
294
|
-
'',
|
|
295
|
-
`- CI: \`${executionContext.ci}\``,
|
|
296
|
-
`- Trigger: \`${executionContext.trigger}\``,
|
|
297
|
-
executionContext.branch.ref ? `- Branch: \`${executionContext.branch.ref}\`` : undefined,
|
|
298
|
-
executionContext.repo ? `- Repo: \`${executionContext.repo.owner}/${executionContext.repo.name}\`` : undefined,
|
|
299
|
-
executionContext.actor ? `- Actor: \`${executionContext.actor.login}\`${executionContext.actor.isBot ? ' (bot)' : ''}` : undefined,
|
|
300
|
-
'',
|
|
301
|
-
`Active context capabilities: ${activeCapabilities.length > 0 ? activeCapabilities.map(c => `\`${c}\``).join(', ') : '_(none)_'}`,
|
|
302
|
-
'',
|
|
303
|
-
'When selecting library processes to dispatch, prefer those whose triggers match the active capabilities above.',
|
|
304
|
-
'',
|
|
305
|
-
'---',
|
|
306
|
-
'',
|
|
307
|
-
].filter((l) => l !== undefined).join('\n');
|
|
308
|
-
const processGuide = (0, prompts_1.renderCapabilityProcessGuide)(capabilityFlags);
|
|
309
|
-
console.log(contextHeader + processGuide + content);
|
|
273
|
+
console.log(formatTextOutput(executionContext, capabilityFlags, existingRun, content));
|
|
310
274
|
}
|
|
311
275
|
return 0;
|
|
312
276
|
}
|
|
277
|
+
function formatTextOutput(executionContext, capabilityFlags, existingRun, content) {
|
|
278
|
+
const caps = Object.entries(capabilityFlags).filter(([, v]) => v).map(([k]) => k);
|
|
279
|
+
const header = [
|
|
280
|
+
'## Execution Context', '',
|
|
281
|
+
`- CI: \`${executionContext.ci}\``,
|
|
282
|
+
`- Trigger: \`${executionContext.trigger}\``,
|
|
283
|
+
executionContext.branch.ref ? `- Branch: \`${executionContext.branch.ref}\`` : undefined,
|
|
284
|
+
executionContext.repo ? `- Repo: \`${executionContext.repo.owner}/${executionContext.repo.name}\`` : undefined,
|
|
285
|
+
executionContext.actor ? `- Actor: \`${executionContext.actor.login}\`${executionContext.actor.isBot ? ' (bot)' : ''}` : undefined,
|
|
286
|
+
'', `Active context capabilities: ${caps.length > 0 ? caps.map(c => `\`${c}\``).join(', ') : '_(none)_'}`,
|
|
287
|
+
'', 'When selecting library processes to dispatch, prefer those whose triggers match the active capabilities above.', '', '---', '',
|
|
288
|
+
].filter((l) => l !== undefined).join('\n');
|
|
289
|
+
const guide = (0, prompts_1.renderCapabilityProcessGuide)(capabilityFlags);
|
|
290
|
+
const runBlock = existingRun ? (0, detectExistingRun_1.formatExistingRunBlock)(existingRun) : '';
|
|
291
|
+
return header + guide + runBlock + content;
|
|
292
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* mcp:serve command - Launch the babysitter MCP server on stdio transport.
|
|
3
3
|
*
|
|
4
4
|
* stdout is reserved for MCP protocol messages; all logging goes to stderr.
|
|
5
|
-
* WebSocket transport is available via @a5c-ai/
|
|
5
|
+
* WebSocket transport is available via @a5c-ai/agent-platform.
|
|
6
6
|
*/
|
|
7
7
|
export declare function handleMcpServe(args: {
|
|
8
8
|
json: boolean;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* mcp:serve command - Launch the babysitter MCP server on stdio transport.
|
|
4
4
|
*
|
|
5
5
|
* stdout is reserved for MCP protocol messages; all logging goes to stderr.
|
|
6
|
-
* WebSocket transport is available via @a5c-ai/
|
|
6
|
+
* WebSocket transport is available via @a5c-ai/agent-platform.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.handleMcpServe = handleMcpServe;
|
|
@@ -16,8 +16,8 @@ function installShutdownHandlers(shutdownFn) {
|
|
|
16
16
|
async function handleMcpServe(args) {
|
|
17
17
|
const transportType = args.transport ?? "stdio";
|
|
18
18
|
if (transportType === "ws" || transportType === "websocket") {
|
|
19
|
-
process.stderr.write("WebSocket transport has moved to @a5c-ai/
|
|
20
|
-
"Use
|
|
19
|
+
process.stderr.write("WebSocket transport has moved to @a5c-ai/agent-platform.\n" +
|
|
20
|
+
"Use agent-platform mcp:serve --transport websocket instead.\n");
|
|
21
21
|
return 1;
|
|
22
22
|
}
|
|
23
23
|
const server = (0, mcp_1.createBabysitterMcpServer)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runIterate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/runIterate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"runIterate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/runIterate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAcxD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+FAA+F;IAC/F,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IAChD,8FAA8F;IAC9F,wBAAwB,CAAC,EAAE;QACzB,QAAQ,EAAE,YAAY,EAAE,CAAC;QACzB,UAAU,EAAE,YAAY,EAAE,CAAC;KAC5B,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAsLtF"}
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.runIterate = runIterate;
|
|
15
15
|
const runFiles_1 = require("../../storage/runFiles");
|
|
16
|
+
const journal_1 = require("../../storage/journal");
|
|
16
17
|
const runtime_1 = require("../../runtime/hooks/runtime");
|
|
17
18
|
const orchestrateIteration_1 = require("../../runtime/orchestrateIteration");
|
|
18
19
|
const completionProof_1 = require("../completionProof");
|
|
19
20
|
const grouping_1 = require("../../tasks/grouping");
|
|
20
21
|
const asyncEffects_1 = require("../../runtime/asyncEffects");
|
|
21
22
|
const config_1 = require("../../config");
|
|
23
|
+
const processCodeHash_1 = require("../../runtime/processCodeHash");
|
|
22
24
|
const runIterateHelpers_1 = require("./runIterateHelpers");
|
|
23
25
|
async function runIterate(options) {
|
|
24
26
|
const { runDir, verbose } = options;
|
|
@@ -29,8 +31,28 @@ async function runIterate(options) {
|
|
|
29
31
|
const iterationCount = await (0, runIterateHelpers_1.detectIterationCount)(runDir);
|
|
30
32
|
const iteration = options.iteration ?? (iterationCount + 1);
|
|
31
33
|
const projectRoot = (0, config_1.resolveProjectRootForRun)(runDir, metadata.entrypoint?.importPath);
|
|
34
|
+
const warnings = [];
|
|
35
|
+
const currentProcessCodeHash = await (0, processCodeHash_1.hashProcessCodeFile)(metadata.entrypoint?.importPath, runDir);
|
|
36
|
+
if (metadata.processCodeHash && currentProcessCodeHash && metadata.processCodeHash !== currentProcessCodeHash) {
|
|
37
|
+
warnings.push("Process code changed since last recorded process hash; replay may need journal reconstruction.");
|
|
38
|
+
const previousProcessCodeHash = metadata.processCodeHash;
|
|
39
|
+
metadata.processCodeHash = currentProcessCodeHash;
|
|
40
|
+
await (0, runFiles_1.writeRunMetadata)(runDir, metadata);
|
|
41
|
+
await (0, journal_1.appendEvent)({
|
|
42
|
+
runDir,
|
|
43
|
+
eventType: "PROCESS_CODE_HASH_CHANGED",
|
|
44
|
+
event: {
|
|
45
|
+
runId,
|
|
46
|
+
processId: metadata.processId,
|
|
47
|
+
previousProcessCodeHash,
|
|
48
|
+
processCodeHash: currentProcessCodeHash,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
32
52
|
if (verbose) {
|
|
33
53
|
console.error(`[run:iterate] Starting iteration ${iteration} for run ${runId}`);
|
|
54
|
+
for (const warning of warnings)
|
|
55
|
+
console.error(`[run:iterate] Warning: ${warning}`);
|
|
34
56
|
}
|
|
35
57
|
const iterationResult = await (0, orchestrateIteration_1.orchestrateIteration)({ runDir });
|
|
36
58
|
if (iterationResult.status === "completed") {
|
|
@@ -50,6 +72,7 @@ async function runIterate(options) {
|
|
|
50
72
|
action: "none",
|
|
51
73
|
reason: "completed",
|
|
52
74
|
completionProof,
|
|
75
|
+
warnings: warnings.length ? warnings : undefined,
|
|
53
76
|
metadata: { runId, processId: metadata.processId, hookStatus: "executed" },
|
|
54
77
|
};
|
|
55
78
|
}
|
|
@@ -68,6 +91,7 @@ async function runIterate(options) {
|
|
|
68
91
|
status: "failed",
|
|
69
92
|
action: "none",
|
|
70
93
|
reason: "failed",
|
|
94
|
+
warnings: warnings.length ? warnings : undefined,
|
|
71
95
|
metadata: { runId, processId: metadata.processId, hookStatus: "executed" },
|
|
72
96
|
};
|
|
73
97
|
}
|
|
@@ -127,6 +151,7 @@ async function runIterate(options) {
|
|
|
127
151
|
count,
|
|
128
152
|
until,
|
|
129
153
|
nextActions: iterationResult.status === "waiting" ? iterationResult.nextActions : undefined,
|
|
154
|
+
warnings: warnings.length ? warnings : undefined,
|
|
130
155
|
metadata: {
|
|
131
156
|
runId,
|
|
132
157
|
processId: metadata.processId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkIteration.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/checkIteration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkIteration.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/checkIteration.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,yBAAyB;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,CA2EjB"}
|
|
@@ -56,28 +56,6 @@ async function handleSessionCheckIteration(args) {
|
|
|
56
56
|
const updatedTimes = state.iteration >= 5
|
|
57
57
|
? (0, session_1.updateIterationTimes)(state.iterationTimes, state.lastIterationAt, now)
|
|
58
58
|
: state.iterationTimes;
|
|
59
|
-
if ((0, session_1.isIterationTooFast)(updatedTimes)) {
|
|
60
|
-
const averageTime = updatedTimes.reduce((sum, value) => sum + value, 0) / updatedTimes.length;
|
|
61
|
-
const result = {
|
|
62
|
-
found: true,
|
|
63
|
-
shouldContinue: false,
|
|
64
|
-
reason: "iteration_too_fast",
|
|
65
|
-
averageTime,
|
|
66
|
-
threshold: 15,
|
|
67
|
-
iteration: state.iteration,
|
|
68
|
-
maxIterations: state.maxIterations,
|
|
69
|
-
runId: state.runId ?? "",
|
|
70
|
-
prompt: file.prompt ?? "",
|
|
71
|
-
stopMessage: `Average iteration time too fast (${averageTime}s <= 15s)`,
|
|
72
|
-
};
|
|
73
|
-
if (args.json) {
|
|
74
|
-
console.log(JSON.stringify(result, null, 2));
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
console.log(`[session:check-iteration] shouldContinue=false reason=iteration_too_fast avg=${averageTime}s`);
|
|
78
|
-
}
|
|
79
|
-
return 0;
|
|
80
|
-
}
|
|
81
59
|
const result = {
|
|
82
60
|
found: true,
|
|
83
61
|
shouldContinue: true,
|
|
@@ -16,7 +16,7 @@ function emitSessionCommandError(json, error, lines) {
|
|
|
16
16
|
return 1;
|
|
17
17
|
}
|
|
18
18
|
function resolveSessionStateDir(stateDir) {
|
|
19
|
-
return
|
|
19
|
+
return (0, config_1.normalizeSessionStateDir)(stateDir ?? process.env.BABYSITTER_STATE_DIR);
|
|
20
20
|
}
|
|
21
21
|
function requireSessionScope(args, options = {}) {
|
|
22
22
|
if (!args.sessionId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/init.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAyF9E"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handleSessionInit = handleSessionInit;
|
|
4
|
+
const config_1 = require("../../../config");
|
|
4
5
|
const session_1 = require("../../../session");
|
|
5
6
|
const common_1 = require("./common");
|
|
6
7
|
async function handleSessionInit(args) {
|
|
@@ -9,7 +10,7 @@ async function handleSessionInit(args) {
|
|
|
9
10
|
return required;
|
|
10
11
|
}
|
|
11
12
|
const { sessionId, stateDir } = required;
|
|
12
|
-
const maxIterations = args.maxIterations ??
|
|
13
|
+
const maxIterations = args.maxIterations ?? config_1.DEFAULTS.maxIterations;
|
|
13
14
|
const runId = args.runId ?? "";
|
|
14
15
|
const prompt = args.prompt ?? "";
|
|
15
16
|
const filePath = (0, session_1.getSessionFilePath)(stateDir, sessionId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/resume.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resume.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/resume.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;CACf;AAaD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqGlF"}
|
|
@@ -40,6 +40,7 @@ const config_1 = require("../../../config");
|
|
|
40
40
|
const journal_1 = require("../../../storage/journal");
|
|
41
41
|
const runLifecycleState_1 = require("../../../runtime/runLifecycleState");
|
|
42
42
|
const session_1 = require("../../../session");
|
|
43
|
+
const common_1 = require("./common");
|
|
43
44
|
function emitError(json, error, lines) {
|
|
44
45
|
if (json) {
|
|
45
46
|
console.error(JSON.stringify(error, null, 2));
|
|
@@ -59,8 +60,8 @@ async function handleSessionResume(args) {
|
|
|
59
60
|
if (!runId) {
|
|
60
61
|
return emitError(json, { error: 'MISSING_RUN_ID', message: '--run-id is required' }, ['❌ Error: --run-id is required']);
|
|
61
62
|
}
|
|
62
|
-
const stateDir =
|
|
63
|
-
const maxIterations = args.maxIterations ??
|
|
63
|
+
const stateDir = (0, common_1.resolveSessionStateDir)(args.stateDir);
|
|
64
|
+
const maxIterations = args.maxIterations ?? config_1.DEFAULTS.maxIterations;
|
|
64
65
|
const runsDir = args.runsDir ?? (0, config_1.resolveRunsDir)();
|
|
65
66
|
const runDir = (0, config_1.resolveExistingRunDir)(runId, { override: runsDir });
|
|
66
67
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/update.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyDlF"}
|
|
@@ -9,18 +9,6 @@ async function handleSessionUpdate(args) {
|
|
|
9
9
|
return required;
|
|
10
10
|
}
|
|
11
11
|
const filePath = (0, session_1.getSessionFilePath)(required.stateDir, required.sessionId);
|
|
12
|
-
if (args.delete) {
|
|
13
|
-
const deleted = await (0, session_1.deleteSessionFile)(filePath);
|
|
14
|
-
const result = { success: true, deleted, stateFile: filePath };
|
|
15
|
-
if (args.json) {
|
|
16
|
-
console.log(JSON.stringify(result, null, 2));
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
console.log(`[session:update] deleted=${deleted}`);
|
|
20
|
-
console.log(` stateFile: ${filePath}`);
|
|
21
|
-
}
|
|
22
|
-
return 0;
|
|
23
|
-
}
|
|
24
12
|
let existing;
|
|
25
13
|
try {
|
|
26
14
|
existing = await (0, session_1.readSessionFile)(filePath);
|