@a5c-ai/babysitter-sdk 5.0.1-staging.69cb593ea → 5.0.1-staging.6ab464ce4307
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/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/common.js +1 -1
- package/dist/cli/commands/session/resume.d.ts.map +1 -1
- package/dist/cli/commands/session/resume.js +2 -1
- package/dist/cli/main/program.js +2 -2
- package/dist/cli/main/runAssignProcess.d.ts.map +1 -1
- package/dist/cli/main/runAssignProcess.js +3 -0
- package/dist/cli/main/runCreate.d.ts.map +1 -1
- package/dist/cli/main/runCreate.js +33 -0
- package/dist/cli/main/usage.js +3 -3
- 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 +2 -8
- package/dist/harness/amuxFallbackMetadata.d.ts.map +1 -1
- package/dist/harness/amuxFallbackMetadata.js +22 -1
- package/dist/harness/customAdapter.d.ts.map +1 -1
- package/dist/harness/customAdapter.js +1 -18
- 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/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 +301 -11
- package/dist/harness/hooks/utils.d.ts +4 -0
- package/dist/harness/hooks/utils.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/mcp/index.js +3 -3
- 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/parts/criticalRules.js +1 -1
- package/dist/prompts/templateRenderer.d.ts.map +1 -1
- package/dist/prompts/templateRenderer.js +114 -22
- 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 +5 -0
- 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 +74 -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/types.d.ts +19 -2
- 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/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/storage/journal.d.ts.map +1 -1
- package/dist/storage/journal.js +45 -27
- package/dist/storage/types.d.ts +1 -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 +16 -5
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 {
|
|
@@ -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,
|
|
@@ -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":"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,7 +60,7 @@ 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 stateDir = (0, common_1.resolveSessionStateDir)(args.stateDir);
|
|
63
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 });
|
package/dist/cli/main/program.js
CHANGED
|
@@ -11,8 +11,8 @@ exports.CORE_PROGRAM = {
|
|
|
11
11
|
};
|
|
12
12
|
exports.HARNESS_PROGRAM = {
|
|
13
13
|
variant: "harness",
|
|
14
|
-
commandName: "
|
|
15
|
-
packageName: "@a5c-ai/
|
|
14
|
+
commandName: "agent-platform",
|
|
15
|
+
packageName: "@a5c-ai/agent-platform",
|
|
16
16
|
};
|
|
17
17
|
exports.HARNESS_RUNTIME_COMMANDS = [
|
|
18
18
|
"create-run",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runAssignProcess.d.ts","sourceRoot":"","sources":["../../../src/cli/main/runAssignProcess.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"runAssignProcess.d.ts","sourceRoot":"","sources":["../../../src/cli/main/runAssignProcess.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAW1C,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAsIhF"}
|
|
@@ -41,6 +41,7 @@ const lock_1 = require("../../storage/lock");
|
|
|
41
41
|
const args_1 = require("./args");
|
|
42
42
|
const runSupport_1 = require("./runSupport");
|
|
43
43
|
const usage_1 = require("./usage");
|
|
44
|
+
const processCodeHash_1 = require("../../runtime/processCodeHash");
|
|
44
45
|
async function handleRunAssignProcess(parsed) {
|
|
45
46
|
if (!parsed.runDirArg) {
|
|
46
47
|
console.error("run:assign-process requires a <runDir> positional argument");
|
|
@@ -136,6 +137,7 @@ async function handleRunAssignProcess(parsed) {
|
|
|
136
137
|
};
|
|
137
138
|
current.processPath = absoluteImportPath;
|
|
138
139
|
current.processId = processId;
|
|
140
|
+
current.processCodeHash = await (0, processCodeHash_1.hashProcessCodeFile)(absoluteImportPath);
|
|
139
141
|
if (parsed.processRevision) {
|
|
140
142
|
current.processRevision = parsed.processRevision;
|
|
141
143
|
}
|
|
@@ -148,6 +150,7 @@ async function handleRunAssignProcess(parsed) {
|
|
|
148
150
|
entrypoint: current.entrypoint,
|
|
149
151
|
previousEntrypoint,
|
|
150
152
|
force: parsed.sessionForce ?? false,
|
|
153
|
+
...(current.processCodeHash ? { processCodeHash: current.processCodeHash } : {}),
|
|
151
154
|
},
|
|
152
155
|
});
|
|
153
156
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCreate.d.ts","sourceRoot":"","sources":["../../../src/cli/main/runCreate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runCreate.d.ts","sourceRoot":"","sources":["../../../src/cli/main/runCreate.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,wBAAsB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CA0NzE;AA2BD,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAmC/E;AAED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAiGhF"}
|
|
@@ -40,10 +40,12 @@ const crypto = __importStar(require("node:crypto"));
|
|
|
40
40
|
const node_fs_1 = require("node:fs");
|
|
41
41
|
const path = __importStar(require("node:path"));
|
|
42
42
|
const createRun_1 = require("../../runtime/createRun");
|
|
43
|
+
const journal_1 = require("../../storage/journal");
|
|
43
44
|
const stateCache_1 = require("../../runtime/replay/stateCache");
|
|
44
45
|
const ulids_1 = require("../../storage/ulids");
|
|
45
46
|
const harness_1 = require("../../harness");
|
|
46
47
|
const skill_1 = require("../commands/skill");
|
|
48
|
+
const runIterate_1 = require("../commands/runIterate");
|
|
47
49
|
const active_1 = require("../../processLibrary/active");
|
|
48
50
|
const args_1 = require("./args");
|
|
49
51
|
const runSupport_1 = require("./runSupport");
|
|
@@ -184,6 +186,21 @@ async function handleRunCreate(parsed) {
|
|
|
184
186
|
else if (parsed.sessionId !== undefined && parsed.harness) {
|
|
185
187
|
sessionBound = { harness: parsed.harness, sessionId: "", error: `Unsupported harness: ${parsed.harness}` };
|
|
186
188
|
}
|
|
189
|
+
let initialIteration;
|
|
190
|
+
if (await shouldSeedInitialIterationAfterRunCreate({
|
|
191
|
+
isBareRun,
|
|
192
|
+
adapter,
|
|
193
|
+
sessionBound,
|
|
194
|
+
runDir: result.runDir,
|
|
195
|
+
})) {
|
|
196
|
+
initialIteration = await (0, runIterate_1.runIterate)({
|
|
197
|
+
runDir: result.runDir,
|
|
198
|
+
iteration: 1,
|
|
199
|
+
verbose: parsed.verbose,
|
|
200
|
+
json: parsed.json,
|
|
201
|
+
harnessCapabilities: adapter?.getCapabilities?.(),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
187
204
|
let discoveredSkills;
|
|
188
205
|
let discoveredAgents;
|
|
189
206
|
const discoverPluginRoot = parsed.pluginRoot ?? adapter?.resolvePluginRoot(parsed);
|
|
@@ -230,6 +247,7 @@ async function handleRunCreate(parsed) {
|
|
|
230
247
|
runDir: result.runDir,
|
|
231
248
|
entry: entrySpec,
|
|
232
249
|
session: sessionOut,
|
|
250
|
+
...(initialIteration ? { initialIteration } : {}),
|
|
233
251
|
discoveredSkills: summarizeDiscovery(discoveredSkills, parsed.verbose),
|
|
234
252
|
discoveredAgents: summarizeDiscovery(discoveredAgents, parsed.verbose),
|
|
235
253
|
}, null, 2));
|
|
@@ -242,9 +260,24 @@ async function handleRunCreate(parsed) {
|
|
|
242
260
|
else if (sessionBound) {
|
|
243
261
|
console.log(`[run:create] session=${sessionBound.sessionId} bound via ${sessionBound.harness} stateFile=${sessionBound.stateFile}`);
|
|
244
262
|
}
|
|
263
|
+
if (initialIteration) {
|
|
264
|
+
console.log(`[run:create] initialIteration status=${initialIteration.status} reason=${initialIteration.reason ?? ""}`);
|
|
265
|
+
}
|
|
245
266
|
}
|
|
246
267
|
return sessionBound?.fatal ? 1 : 0;
|
|
247
268
|
}
|
|
269
|
+
async function shouldSeedInitialIterationAfterRunCreate(args) {
|
|
270
|
+
if (args.isBareRun)
|
|
271
|
+
return false;
|
|
272
|
+
if (args.adapter?.name !== "claude-code")
|
|
273
|
+
return false;
|
|
274
|
+
if (!args.adapter.getCapabilities?.().includes(harness_1.HarnessCapability.StopHook))
|
|
275
|
+
return false;
|
|
276
|
+
if (!args.sessionBound?.sessionId || args.sessionBound.error || args.sessionBound.fatal)
|
|
277
|
+
return false;
|
|
278
|
+
const journal = await (0, journal_1.loadJournal)(args.runDir);
|
|
279
|
+
return journal.length === 1 && journal[0]?.type === "RUN_CREATED";
|
|
280
|
+
}
|
|
248
281
|
function summarizeDiscovery(entries, verbose) {
|
|
249
282
|
if (verbose || !entries) {
|
|
250
283
|
return entries;
|
package/dist/cli/main/usage.js
CHANGED
|
@@ -82,9 +82,9 @@ function coreHumanUsage(commandName) {
|
|
|
82
82
|
${commandName} configure [show|validate|paths] [--json] [--defaults-only]
|
|
83
83
|
${commandName} version
|
|
84
84
|
|
|
85
|
-
Harness runtime commands are provided by the optional ${"@a5c-ai/
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
Harness runtime commands are provided by the optional ${"@a5c-ai/agent-platform"} package:
|
|
86
|
+
agent-platform call --harness claude-code --prompt "implement feature X" --workspace .
|
|
87
|
+
agent-platform start-server [--transport <stdio|websocket>]`;
|
|
88
88
|
}
|
|
89
89
|
function harnessAgentUsage(commandName) {
|
|
90
90
|
return ` ${commandName} create-run [--prompt <text>] [--harness <name>] [--process <path>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--interactive|--no-interactive|--non-interactive] [--json] [--verbose]
|
package/dist/cost/index.js
CHANGED
|
@@ -35,4 +35,4 @@ var collector_1 = require("./collector");
|
|
|
35
35
|
// Cost data collector
|
|
36
36
|
Object.defineProperty(exports, "collectCostDataForRun", { enumerable: true, get: function () { return collector_1.collectCostDataForRun; } });
|
|
37
37
|
Object.defineProperty(exports, "resolveClaudeCodeSessionDir", { enumerable: true, get: function () { return collector_1.resolveClaudeCodeSessionDir; } });
|
|
38
|
-
// effectCost moved to @a5c-ai/
|
|
38
|
+
// effectCost moved to @a5c-ai/agent-platform (GAP-SUBOBS-003)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAdapter.d.ts","sourceRoot":"","sources":["../../src/harness/BaseAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseAdapter.d.ts","sourceRoot":"","sources":["../../src/harness/BaseAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAcjB,MAAM,WAAW,aAAa;IAC5B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,+CAA+C;IAC/C,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,yEAAyE;IACzE,eAAe,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,mBAAmB,EAAE,OAAO,CAAC;IAC7B,yCAAyC;IACzC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,oFAAoF;IACpF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,wHAAwH;IACxH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,yFAAyF;IACzF,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAGpC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2EAA2E;IAC3E,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,2DAA2D;IAC3D,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGjD,4CAA4C;IAC5C,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,+DAA+D;IAC/D,aAAa,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,UAAU,EAAE,OAAO,CAAC;IACpB,6CAA6C;IAC7C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,uBAAuB,EAAE,OAAO,CAAC;IACjC,wDAAwD;IACxD,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAMD,8BAAsB,kBAAmB,YAAW,cAAc;IACpD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa;gBAArB,MAAM,EAAE,aAAa;IAEpD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,QAAQ,IAAI,OAAO;IAInB,qBAAqB,IAAI,OAAO;IAIhC,gBAAgB,CAAC,MAAM,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,SAAS;IAmBpE,eAAe,CAAC,IAAI,EAAE;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,MAAM,GAAG,SAAS;IAMtB,iBAAiB,CAAC,IAAI,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,SAAS;IAUpE,eAAe,IAAI,iBAAiB,EAAE;IAItC,gBAAgB,CAAC,IAAI,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,GAAG,aAAa;IAsBvE,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAajE,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAoCtD,sBAAsB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAyDpE,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIxD,uBAAuB,IAAI,MAAM;IAKjC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQ3C,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAKpD"}
|
|
@@ -4,15 +4,9 @@
|
|
|
4
4
|
* Derives all behavior from BaseHarnessAdapter + agent-mux metadata.
|
|
5
5
|
*/
|
|
6
6
|
import { BaseHarnessAdapter } from "../BaseAdapter";
|
|
7
|
+
import { type SessionResolutionDetails as SharedSessionResolutionDetails } from "../../utils/sessionMarker";
|
|
7
8
|
export declare function resolveCurrentSessionIdFromEnv(): string | undefined;
|
|
8
|
-
export
|
|
9
|
-
sessionId?: string;
|
|
10
|
-
resolvedFrom: "env-var" | "explicit" | "none";
|
|
11
|
-
/** @deprecated PID-marker logic removed. Always null. */
|
|
12
|
-
ancestorPid: number | null;
|
|
13
|
-
/** @deprecated PID-marker logic removed. Always null. */
|
|
14
|
-
ancestorAlive: boolean | null;
|
|
15
|
-
}
|
|
9
|
+
export type SessionResolutionDetails = SharedSessionResolutionDetails;
|
|
16
10
|
export declare function resolveSessionIdDetailed(explicit?: string): SessionResolutionDetails;
|
|
17
11
|
export declare const __resolveCurrentSessionIdFromEnvForTests: typeof resolveCurrentSessionIdFromEnv;
|
|
18
12
|
export declare function setBabysitterSessionIdInEnvFile(envFile: string, sessionId: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../src/harness/adapters/claude-code.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../src/harness/adapters/claude-code.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAEL,KAAK,wBAAwB,IAAI,8BAA8B,EAChE,MAAM,2BAA2B,CAAC;AAMnC,wBAAgB,8BAA8B,IAAI,MAAM,GAAG,SAAS,CAEnE;AAED,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,CAAC;AAEtE,wBAAgB,wBAAwB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,wBAAwB,CAKpF;AAED,eAAO,MAAM,wCAAwC,uCAAiC,CAAC;AAEvF,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAExF;AAwBD,cAAM,iBAAkB,SAAQ,kBAAkB;;CAIjD;AAED,wBAAgB,uBAAuB,IAAI,iBAAiB,CAE3D"}
|
|
@@ -14,6 +14,7 @@ const node_fs_1 = require("node:fs");
|
|
|
14
14
|
const BaseAdapter_1 = require("../BaseAdapter");
|
|
15
15
|
const amuxMetadata_1 = require("../amuxMetadata");
|
|
16
16
|
const derivePromptContext_1 = require("../derivePromptContext");
|
|
17
|
+
const sessionMarker_1 = require("../../utils/sessionMarker");
|
|
17
18
|
// ---------------------------------------------------------------------------
|
|
18
19
|
// Backward-compatible exported utilities
|
|
19
20
|
// ---------------------------------------------------------------------------
|
|
@@ -21,14 +22,7 @@ function resolveCurrentSessionIdFromEnv() {
|
|
|
21
22
|
return process.env.AGENT_SESSION_ID;
|
|
22
23
|
}
|
|
23
24
|
function resolveSessionIdDetailed(explicit) {
|
|
24
|
-
|
|
25
|
-
return { sessionId: explicit, resolvedFrom: "explicit", ancestorPid: null, ancestorAlive: null };
|
|
26
|
-
}
|
|
27
|
-
const agentSessionId = process.env.AGENT_SESSION_ID;
|
|
28
|
-
if (agentSessionId) {
|
|
29
|
-
return { sessionId: agentSessionId, resolvedFrom: "env-var", ancestorPid: null, ancestorAlive: null };
|
|
30
|
-
}
|
|
31
|
-
return { sessionId: undefined, resolvedFrom: "none", ancestorPid: null, ancestorAlive: null };
|
|
25
|
+
return (0, sessionMarker_1.resolveSessionIdWithMarkerDetailed)("claude-code", explicit ? { sessionId: explicit } : {});
|
|
32
26
|
}
|
|
33
27
|
exports.__resolveCurrentSessionIdFromEnvForTests = resolveCurrentSessionIdFromEnv;
|
|
34
28
|
function setBabysitterSessionIdInEnvFile(envFile, sessionId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amuxFallbackMetadata.d.ts","sourceRoot":"","sources":["../../src/harness/amuxFallbackMetadata.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"amuxFallbackMetadata.d.ts","sourceRoot":"","sources":["../../src/harness/amuxFallbackMetadata.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AA4N1D,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAiC,CAAC"}
|
|
@@ -192,7 +192,28 @@ function buildStaticFallbackMetadata() {
|
|
|
192
192
|
sessionDir: resolveFallbackSessionDir(metadata.sessionDir),
|
|
193
193
|
},
|
|
194
194
|
]));
|
|
195
|
-
|
|
195
|
+
if (Object.keys(catalogMetadata).length === 0)
|
|
196
|
+
return LOCAL_FALLBACK_METADATA;
|
|
197
|
+
// Merge: use catalog data for host signals and session dir, but prefer
|
|
198
|
+
// LOCAL_FALLBACK_METADATA for capabilities when catalog returns all-false
|
|
199
|
+
// (graph schema mismatch between supports edges and capability lookups).
|
|
200
|
+
const merged = { ...LOCAL_FALLBACK_METADATA };
|
|
201
|
+
for (const [name, catalogEntry] of Object.entries(catalogMetadata)) {
|
|
202
|
+
const local = LOCAL_FALLBACK_METADATA[name];
|
|
203
|
+
if (local) {
|
|
204
|
+
const anyCatalogCapTrue = Object.values(catalogEntry.capabilities).some(v => v === true);
|
|
205
|
+
merged[name] = {
|
|
206
|
+
...local,
|
|
207
|
+
hostEnvSignals: catalogEntry.hostEnvSignals.length > 0 ? catalogEntry.hostEnvSignals : local.hostEnvSignals,
|
|
208
|
+
sessionDir: catalogEntry.sessionDir,
|
|
209
|
+
capabilities: anyCatalogCapTrue ? catalogEntry.capabilities : local.capabilities,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
merged[name] = catalogEntry;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return merged;
|
|
196
217
|
}
|
|
197
218
|
catch {
|
|
198
219
|
return LOCAL_FALLBACK_METADATA;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customAdapter.d.ts","sourceRoot":"","sources":["../../src/harness/customAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,SAAS,CAAC;AAGjB,wBAAgB,mBAAmB,IAAI,cAAc,
|
|
1
|
+
{"version":3,"file":"customAdapter.d.ts","sourceRoot":"","sources":["../../src/harness/customAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,SAAS,CAAC;AAGjB,wBAAgB,mBAAmB,IAAI,cAAc,CAqEpD"}
|
|
@@ -60,24 +60,7 @@ function createCustomAdapter() {
|
|
|
60
60
|
return false;
|
|
61
61
|
},
|
|
62
62
|
resolveSessionId(parsed) {
|
|
63
|
-
|
|
64
|
-
return parsed.sessionId;
|
|
65
|
-
const trustEnv = process.env.AGENT_TRUST_ENV_SESSION === "1" ||
|
|
66
|
-
process.env.BABYSITTER_TRUST_ENV_SESSION === "1";
|
|
67
|
-
const agentSessionId = process.env.AGENT_SESSION_ID;
|
|
68
|
-
if (trustEnv) {
|
|
69
|
-
if (agentSessionId)
|
|
70
|
-
return agentSessionId;
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
// 1. Cross-harness standard env var
|
|
74
|
-
if (agentSessionId)
|
|
75
|
-
return agentSessionId;
|
|
76
|
-
// 2. PID-scoped marker fallback (if any harness ancestor happens to exist)
|
|
77
|
-
const fromMarker = (0, sessionMarker_1.readSessionMarker)("custom");
|
|
78
|
-
if (fromMarker)
|
|
79
|
-
return fromMarker;
|
|
80
|
-
return undefined;
|
|
63
|
+
return (0, sessionMarker_1.resolveSessionIdWithMarker)("custom", parsed);
|
|
81
64
|
},
|
|
82
65
|
resolveStateDir(args) {
|
|
83
66
|
return (0, config_1.normalizeSessionStateDir)(args.stateDir ?? process.env.BABYSITTER_STATE_DIR);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runState.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/runState.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,EAAE,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9D,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAUD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACvC,GAAG,OAAO,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"runState.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/runState.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,EAAE,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9D,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,OAAO,CAAC;IAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAUD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACvC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA8D/B"}
|
|
@@ -61,12 +61,17 @@ async function resolveHookRunState(args) {
|
|
|
61
61
|
const pendingByKind = (0, utils_1.countPendingByKind)(pendingRecords);
|
|
62
62
|
const pendingKinds = Object.keys(pendingByKind).join(", ");
|
|
63
63
|
const onlyBreakpointsPending = pendingRecords.length > 0 && (0, utils_1.isOnlyBreakpoints)(pendingByKind);
|
|
64
|
+
const currentPendingEffectId = pendingRecords
|
|
65
|
+
.filter((record) => record.kind !== "breakpoint")
|
|
66
|
+
.sort((left, right) => (left.requestedAt ?? "").localeCompare(right.requestedAt ?? "")
|
|
67
|
+
|| left.effectId.localeCompare(right.effectId))[0]?.effectId;
|
|
64
68
|
if (runState === "completed") {
|
|
65
69
|
return {
|
|
66
70
|
runState,
|
|
67
71
|
completionProof: (0, completionProof_1.resolveCompletionProof)(metadata),
|
|
68
72
|
pendingKinds,
|
|
69
73
|
onlyBreakpointsPending,
|
|
74
|
+
currentPendingEffectId,
|
|
70
75
|
};
|
|
71
76
|
}
|
|
72
77
|
if (runState === "failed") {
|
|
@@ -75,6 +80,7 @@ async function resolveHookRunState(args) {
|
|
|
75
80
|
completionProof: "",
|
|
76
81
|
pendingKinds,
|
|
77
82
|
onlyBreakpointsPending,
|
|
83
|
+
currentPendingEffectId,
|
|
78
84
|
};
|
|
79
85
|
}
|
|
80
86
|
if (runState === "waiting") {
|
|
@@ -83,6 +89,7 @@ async function resolveHookRunState(args) {
|
|
|
83
89
|
completionProof: "",
|
|
84
90
|
pendingKinds,
|
|
85
91
|
onlyBreakpointsPending,
|
|
92
|
+
currentPendingEffectId,
|
|
86
93
|
};
|
|
87
94
|
}
|
|
88
95
|
return {
|
|
@@ -90,6 +97,7 @@ async function resolveHookRunState(args) {
|
|
|
90
97
|
completionProof: "",
|
|
91
98
|
pendingKinds,
|
|
92
99
|
onlyBreakpointsPending,
|
|
100
|
+
currentPendingEffectId,
|
|
93
101
|
};
|
|
94
102
|
}
|
|
95
103
|
catch {
|