@a5c-ai/babysitter-sdk 5.0.1-staging.ff2c19f9 → 5.0.1-staging.ff407b73
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 +68 -0
- package/dist/cli/commands/breakpointRules.d.ts.map +1 -1
- package/dist/cli/commands/breakpointRules.js +30 -27
- package/dist/cli/commands/compressOutputHelpers.d.ts.map +1 -1
- package/dist/cli/commands/compressOutputHelpers.js +18 -2
- package/dist/cli/commands/costStats.d.ts.map +1 -1
- package/dist/cli/commands/costStats.js +35 -27
- package/dist/cli/commands/harness/install.d.ts +2 -3
- package/dist/cli/commands/harness/install.d.ts.map +1 -1
- package/dist/cli/commands/harness/install.js +11 -10
- package/dist/cli/commands/health/checks.d.ts.map +1 -1
- package/dist/cli/commands/health/checks.js +4 -3
- package/dist/cli/commands/health/environment.d.ts.map +1 -1
- package/dist/cli/commands/health/environment.js +11 -1
- package/dist/cli/commands/hooks/run.d.ts.map +1 -1
- package/dist/cli/commands/hooks/run.js +3 -2
- package/dist/cli/commands/instructions.d.ts +1 -1
- package/dist/cli/commands/instructions.d.ts.map +1 -1
- package/dist/cli/commands/instructions.js +71 -5
- package/dist/cli/commands/runIterate.d.ts.map +1 -1
- package/dist/cli/commands/runIterate.js +2 -35
- package/dist/cli/commands/session/associate.d.ts.map +1 -1
- package/dist/cli/commands/session/associate.js +4 -36
- package/dist/cli/commands/session/iterationMessage.d.ts.map +1 -1
- package/dist/cli/commands/session/iterationMessage.js +9 -54
- package/dist/cli/commands/session/resume.d.ts.map +1 -1
- package/dist/cli/commands/session/resume.js +6 -16
- package/dist/cli/commands/skill.d.ts.map +1 -1
- package/dist/cli/commands/skill.js +2 -1
- package/dist/cli/commands/tokensStats.d.ts.map +1 -1
- package/dist/cli/commands/tokensStats.js +36 -28
- package/dist/cli/main/argFlagParsers.d.ts.map +1 -1
- package/dist/cli/main/argFlagParsers.js +2 -1
- package/dist/cli/main/args.d.ts.map +1 -1
- package/dist/cli/main/args.js +4 -27
- package/dist/cli/main/dispatchHarness.js +1 -1
- package/dist/cli/main/dispatchRunSession.js +0 -10
- package/dist/cli/main/runCreate.js +2 -2
- package/dist/cli/main/runSupport.d.ts +9 -1
- package/dist/cli/main/runSupport.d.ts.map +1 -1
- package/dist/cli/main/runSupport.js +71 -1
- package/dist/cli/main/usage.d.ts.map +1 -1
- package/dist/cli/main/usage.js +42 -38
- package/dist/config/configValidation.d.ts.map +1 -1
- package/dist/config/configValidation.js +2 -1
- package/dist/config/defaults.d.ts +2 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +3 -1
- package/dist/config/index.d.ts +3 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +15 -2
- package/dist/config/runs.d.ts +22 -0
- package/dist/config/runs.d.ts.map +1 -0
- package/dist/config/runs.js +192 -0
- package/dist/harness/adapters/cursor.d.ts +1 -0
- package/dist/harness/adapters/cursor.d.ts.map +1 -1
- package/dist/harness/adapters/cursor.js +34 -0
- package/dist/harness/amuxFallbackMetadata.d.ts.map +1 -1
- package/dist/harness/amuxFallbackMetadata.js +62 -37
- package/dist/harness/amuxMetadata.d.ts.map +1 -1
- package/dist/harness/amuxMetadata.js +2 -1
- package/dist/harness/discovery.d.ts +21 -1
- package/dist/harness/discovery.d.ts.map +1 -1
- package/dist/harness/discovery.js +55 -0
- package/dist/harness/hooks/runState.d.ts.map +1 -1
- package/dist/harness/hooks/runState.js +12 -23
- package/dist/harness/hooks/sessionBinding.d.ts.map +1 -1
- package/dist/harness/hooks/sessionBinding.js +3 -6
- package/dist/harness/hooks/stopHookContinuation.d.ts.map +1 -1
- package/dist/harness/hooks/stopHookContinuation.js +8 -16
- package/dist/harness/hooks/stopHookHandler.d.ts.map +1 -1
- package/dist/harness/hooks/stopHookHandler.js +2 -1
- package/dist/harness/hooks/utils.js +3 -3
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +2 -1
- package/dist/harness/install.d.ts +1 -0
- package/dist/harness/install.d.ts.map +1 -1
- package/dist/harness/install.js +63 -0
- package/dist/harness/installSupport.d.ts.map +1 -1
- package/dist/harness/installSupport.js +19 -0
- package/dist/harness/types.d.ts +7 -0
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/unified/subprocess.d.ts.map +1 -1
- package/dist/harness/unified/subprocess.js +3 -0
- package/dist/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/mcp/tools/sessions.js +2 -8
- package/dist/mcp/util/resolve-run-dir.d.ts +1 -1
- package/dist/mcp/util/resolve-run-dir.d.ts.map +1 -1
- package/dist/mcp/util/resolve-run-dir.js +3 -39
- package/dist/prompts/compose.js +1 -1
- package/dist/prompts/templates/effects.md +1 -1
- package/dist/prompts/templates/iteration.md +1 -1
- package/dist/prompts/templates/results-posting.md +2 -2
- package/dist/prompts/templates/run-creation.md +2 -2
- package/dist/prompts/templates/run-overlap-detection.md +6 -4
- package/dist/prompts/templates/task-examples.md +7 -7
- package/dist/prompts/templates/task-kinds.md +7 -3
- package/dist/runtime/commitEffectResult.d.ts.map +1 -1
- package/dist/runtime/commitEffectResult.js +5 -2
- package/dist/runtime/createRun.d.ts.map +1 -1
- package/dist/runtime/createRun.js +28 -14
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +8 -1
- package/dist/runtime/intrinsics/subprocess.d.ts +5 -0
- package/dist/runtime/intrinsics/subprocess.d.ts.map +1 -0
- package/dist/runtime/intrinsics/subprocess.js +56 -0
- package/dist/runtime/intrinsics/task.d.ts +1 -0
- package/dist/runtime/intrinsics/task.d.ts.map +1 -1
- package/dist/runtime/orchestrateIteration.d.ts.map +1 -1
- package/dist/runtime/orchestrateIteration.js +8 -2
- package/dist/runtime/policy/engine.d.ts +4 -0
- package/dist/runtime/policy/engine.d.ts.map +1 -0
- package/dist/runtime/policy/engine.js +97 -0
- package/dist/runtime/policy/index.d.ts +3 -1
- package/dist/runtime/policy/index.d.ts.map +1 -1
- package/dist/runtime/policy/index.js +9 -1
- package/dist/runtime/policy/logging.d.ts +6 -0
- package/dist/runtime/policy/logging.d.ts.map +1 -0
- package/dist/runtime/policy/logging.js +43 -0
- package/dist/runtime/policy/types.d.ts +4 -0
- package/dist/runtime/policy/types.d.ts.map +1 -1
- package/dist/runtime/processContext.d.ts +3 -0
- package/dist/runtime/processContext.d.ts.map +1 -1
- package/dist/runtime/processContext.js +3 -0
- package/dist/runtime/replay/createReplayEngine.d.ts +1 -0
- package/dist/runtime/replay/createReplayEngine.d.ts.map +1 -1
- package/dist/runtime/replay/createReplayEngine.js +26 -0
- package/dist/runtime/runLifecycleState.d.ts +7 -0
- package/dist/runtime/runLifecycleState.d.ts.map +1 -0
- package/dist/runtime/runLifecycleState.js +54 -0
- package/dist/runtime/types.d.ts +33 -1
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/session/cleanup.d.ts.map +1 -1
- package/dist/session/cleanup.js +26 -21
- package/dist/session/types.d.ts +1 -1
- package/dist/session/types.d.ts.map +1 -1
- package/dist/storage/createRunDir.d.ts.map +1 -1
- package/dist/storage/createRunDir.js +1 -0
- package/dist/storage/types.d.ts +14 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/tasks/defineTask.d.ts +28 -0
- package/dist/tasks/defineTask.d.ts.map +1 -1
- package/dist/tasks/defineTask.js +42 -1
- package/dist/tasks/types.d.ts +18 -3
- package/dist/tasks/types.d.ts.map +1 -1
- package/package.json +20 -6
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { BaseHarnessAdapter } from "../BaseAdapter";
|
|
7
7
|
declare class CursorAdapter extends BaseHarnessAdapter {
|
|
8
8
|
constructor();
|
|
9
|
+
handleStopHook(args: import("../types").HookHandlerArgs): Promise<number>;
|
|
9
10
|
}
|
|
10
11
|
export declare function createCursorAdapter(): CursorAdapter;
|
|
11
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/harness/adapters/cursor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/harness/adapters/cursor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gBAAgB,CAAC;AAqCxE,cAAM,aAAc,SAAQ,kBAAkB;;IAK7B,cAAc,CAC3B,IAAI,EAAE,OAAO,UAAU,EAAE,eAAe,GACvC,OAAO,CAAC,MAAM,CAAC;CAwCnB;AAED,wBAAgB,mBAAmB,IAAI,aAAa,CAEnD"}
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.createCursorAdapter = createCursorAdapter;
|
|
9
|
+
const config_1 = require("../../config");
|
|
10
|
+
const stopHookContinuation_1 = require("../hooks/stopHookContinuation");
|
|
11
|
+
const stopHookHandler_1 = require("../hooks/stopHookHandler");
|
|
9
12
|
const types_1 = require("../types");
|
|
10
13
|
const BaseAdapter_1 = require("../BaseAdapter");
|
|
11
14
|
const amuxMetadata_1 = require("../amuxMetadata");
|
|
@@ -45,6 +48,37 @@ class CursorAdapter extends BaseAdapter_1.BaseHarnessAdapter {
|
|
|
45
48
|
constructor() {
|
|
46
49
|
super(buildConfig());
|
|
47
50
|
}
|
|
51
|
+
async handleStopHook(args) {
|
|
52
|
+
if (this.config.noHookSupport || !this.supportsHookType("stop")) {
|
|
53
|
+
process.stdout.write("{}\n");
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
const common = await (0, stopHookHandler_1.handleStopHookCommon)(args, {
|
|
57
|
+
harness: this.config.name,
|
|
58
|
+
sessionIdFields: ["session_id", "conversation_id"],
|
|
59
|
+
useDetailedRunState: true,
|
|
60
|
+
pluginRootEnvVars: this.config.pluginRootEnvVars,
|
|
61
|
+
resolveStateDir: (a) => (0, config_1.normalizeSessionStateDir)(a.stateDir ?? process.env.BABYSITTER_STATE_DIR),
|
|
62
|
+
});
|
|
63
|
+
if (!common.shouldContinue) {
|
|
64
|
+
return common.exitCode;
|
|
65
|
+
}
|
|
66
|
+
const { systemMessage } = await (0, stopHookContinuation_1.buildStopHookContinuation)({
|
|
67
|
+
nextIteration: common.nextIteration,
|
|
68
|
+
maxIterations: common.state.maxIterations,
|
|
69
|
+
runState: common.runStateDetails?.runState ?? "",
|
|
70
|
+
pendingKinds: common.runStateDetails?.pendingKinds ?? "",
|
|
71
|
+
completionProof: common.runStateDetails?.completionProof ?? "",
|
|
72
|
+
prompt: common.prompt,
|
|
73
|
+
resolvedPluginRoot: common.resolvedPluginRoot,
|
|
74
|
+
runId: common.state.runId ?? undefined,
|
|
75
|
+
runsDir: common.runsDir,
|
|
76
|
+
entrypointImportPath: common.runStateDetails?.entrypointImportPath,
|
|
77
|
+
});
|
|
78
|
+
// Cursor continues a blocked stop-hook flow via followup_message.
|
|
79
|
+
process.stdout.write(JSON.stringify({ followup_message: systemMessage }) + "\n");
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
48
82
|
}
|
|
49
83
|
function createCursorAdapter() {
|
|
50
84
|
return new CursorAdapter();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amuxFallbackMetadata.d.ts","sourceRoot":"","sources":["../../src/harness/amuxFallbackMetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"amuxFallbackMetadata.d.ts","sourceRoot":"","sources":["../../src/harness/amuxFallbackMetadata.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAkM1D,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAiC,CAAC"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.STATIC_FALLBACK_METADATA = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const agent_catalog_1 = require("@a5c-ai/agent-catalog");
|
|
5
|
+
const config_1 = require("../config");
|
|
6
|
+
const LEGACY_REPO_RUNS_DIR = ".a5c/runs";
|
|
7
|
+
const DEFAULT_SESSION_DIR = (0, config_1.resolveRunsDir)();
|
|
8
|
+
function resolveFallbackSessionDir(sessionDir) {
|
|
9
|
+
return sessionDir === LEGACY_REPO_RUNS_DIR
|
|
10
|
+
? (0, config_1.resolveRunsDir)()
|
|
11
|
+
: sessionDir;
|
|
12
|
+
}
|
|
13
|
+
const LOCAL_FALLBACK_METADATA = {
|
|
6
14
|
claude: {
|
|
7
15
|
name: "claude",
|
|
8
16
|
hostEnvSignals: ["CLAUDE_ENV_FILE"],
|
|
@@ -13,22 +21,22 @@ exports.STATIC_FALLBACK_METADATA = {
|
|
|
13
21
|
requiresToolApproval: true,
|
|
14
22
|
supportsInteractiveMode: true,
|
|
15
23
|
supportsStdinInjection: true,
|
|
16
|
-
supportsSubagentDispatch:
|
|
17
|
-
supportsParallelExecution:
|
|
24
|
+
supportsSubagentDispatch: true,
|
|
25
|
+
supportsParallelExecution: true,
|
|
18
26
|
supportsImageInput: true,
|
|
19
27
|
hasRuntimeHooks: true,
|
|
20
28
|
hasStopHook: true,
|
|
21
29
|
},
|
|
22
|
-
sessionDir:
|
|
30
|
+
sessionDir: DEFAULT_SESSION_DIR,
|
|
23
31
|
},
|
|
24
32
|
codex: {
|
|
25
33
|
name: "codex",
|
|
26
|
-
hostEnvSignals: ["CODEX_THREAD_ID", "CODEX_SESSION_ID"
|
|
34
|
+
hostEnvSignals: ["CODEX_THREAD_ID", "CODEX_SESSION_ID"],
|
|
27
35
|
capabilities: {
|
|
28
36
|
supportsSkills: true,
|
|
29
37
|
supportsThinking: true,
|
|
30
|
-
supportsMCP:
|
|
31
|
-
requiresToolApproval:
|
|
38
|
+
supportsMCP: true,
|
|
39
|
+
requiresToolApproval: true,
|
|
32
40
|
supportsInteractiveMode: true,
|
|
33
41
|
supportsStdinInjection: true,
|
|
34
42
|
supportsSubagentDispatch: false,
|
|
@@ -37,7 +45,7 @@ exports.STATIC_FALLBACK_METADATA = {
|
|
|
37
45
|
hasRuntimeHooks: true,
|
|
38
46
|
hasStopHook: true,
|
|
39
47
|
},
|
|
40
|
-
sessionDir:
|
|
48
|
+
sessionDir: DEFAULT_SESSION_DIR,
|
|
41
49
|
},
|
|
42
50
|
cursor: {
|
|
43
51
|
name: "cursor",
|
|
@@ -46,25 +54,25 @@ exports.STATIC_FALLBACK_METADATA = {
|
|
|
46
54
|
supportsSkills: true,
|
|
47
55
|
supportsThinking: true,
|
|
48
56
|
supportsMCP: false,
|
|
49
|
-
requiresToolApproval:
|
|
57
|
+
requiresToolApproval: true,
|
|
50
58
|
supportsInteractiveMode: true,
|
|
51
59
|
supportsStdinInjection: true,
|
|
52
60
|
supportsSubagentDispatch: false,
|
|
53
61
|
supportsParallelExecution: false,
|
|
54
62
|
supportsImageInput: true,
|
|
55
|
-
hasRuntimeHooks:
|
|
56
|
-
hasStopHook:
|
|
63
|
+
hasRuntimeHooks: false,
|
|
64
|
+
hasStopHook: false,
|
|
57
65
|
},
|
|
58
|
-
sessionDir:
|
|
66
|
+
sessionDir: DEFAULT_SESSION_DIR,
|
|
59
67
|
},
|
|
60
68
|
gemini: {
|
|
61
69
|
name: "gemini",
|
|
62
|
-
hostEnvSignals: ["GEMINI_SESSION_ID", "
|
|
70
|
+
hostEnvSignals: ["GEMINI_SESSION_ID", "GEMINI_PROJECT_DIR", "GEMINI_CWD"],
|
|
63
71
|
capabilities: {
|
|
64
72
|
supportsSkills: true,
|
|
65
73
|
supportsThinking: true,
|
|
66
74
|
supportsMCP: false,
|
|
67
|
-
requiresToolApproval:
|
|
75
|
+
requiresToolApproval: true,
|
|
68
76
|
supportsInteractiveMode: true,
|
|
69
77
|
supportsStdinInjection: true,
|
|
70
78
|
supportsSubagentDispatch: false,
|
|
@@ -73,16 +81,16 @@ exports.STATIC_FALLBACK_METADATA = {
|
|
|
73
81
|
hasRuntimeHooks: true,
|
|
74
82
|
hasStopHook: true,
|
|
75
83
|
},
|
|
76
|
-
sessionDir:
|
|
84
|
+
sessionDir: DEFAULT_SESSION_DIR,
|
|
77
85
|
},
|
|
78
86
|
copilot: {
|
|
79
87
|
name: "copilot",
|
|
80
|
-
hostEnvSignals: ["COPILOT_SESSION_ID"],
|
|
88
|
+
hostEnvSignals: ["COPILOT_SESSION_ID", "COPILOT_ENV_FILE"],
|
|
81
89
|
capabilities: {
|
|
82
90
|
supportsSkills: true,
|
|
83
91
|
supportsThinking: true,
|
|
84
92
|
supportsMCP: false,
|
|
85
|
-
requiresToolApproval:
|
|
93
|
+
requiresToolApproval: true,
|
|
86
94
|
supportsInteractiveMode: true,
|
|
87
95
|
supportsStdinInjection: true,
|
|
88
96
|
supportsSubagentDispatch: false,
|
|
@@ -91,52 +99,52 @@ exports.STATIC_FALLBACK_METADATA = {
|
|
|
91
99
|
hasRuntimeHooks: true,
|
|
92
100
|
hasStopHook: true,
|
|
93
101
|
},
|
|
94
|
-
sessionDir:
|
|
102
|
+
sessionDir: DEFAULT_SESSION_DIR,
|
|
95
103
|
},
|
|
96
104
|
omp: {
|
|
97
105
|
name: "omp",
|
|
98
|
-
hostEnvSignals: ["OMP_SESSION_ID"],
|
|
106
|
+
hostEnvSignals: ["OMP_SESSION_ID", "OMP_PLUGIN_ROOT"],
|
|
99
107
|
capabilities: {
|
|
100
108
|
supportsSkills: true,
|
|
101
109
|
supportsThinking: true,
|
|
102
110
|
supportsMCP: false,
|
|
103
|
-
requiresToolApproval:
|
|
111
|
+
requiresToolApproval: true,
|
|
104
112
|
supportsInteractiveMode: true,
|
|
105
113
|
supportsStdinInjection: true,
|
|
106
|
-
supportsSubagentDispatch:
|
|
114
|
+
supportsSubagentDispatch: true,
|
|
107
115
|
supportsParallelExecution: false,
|
|
108
116
|
supportsImageInput: true,
|
|
109
|
-
hasRuntimeHooks:
|
|
110
|
-
hasStopHook:
|
|
117
|
+
hasRuntimeHooks: false,
|
|
118
|
+
hasStopHook: false,
|
|
111
119
|
},
|
|
112
|
-
sessionDir:
|
|
120
|
+
sessionDir: DEFAULT_SESSION_DIR,
|
|
113
121
|
},
|
|
114
122
|
opencode: {
|
|
115
123
|
name: "opencode",
|
|
116
|
-
hostEnvSignals: ["
|
|
124
|
+
hostEnvSignals: ["OPENCODE_SESSION_ID", "OPENCODE_CONFIG", "OPENCODE_PLUGIN_ROOT"],
|
|
117
125
|
capabilities: {
|
|
118
126
|
supportsSkills: true,
|
|
119
127
|
supportsThinking: true,
|
|
120
128
|
supportsMCP: false,
|
|
121
|
-
requiresToolApproval:
|
|
129
|
+
requiresToolApproval: true,
|
|
122
130
|
supportsInteractiveMode: true,
|
|
123
131
|
supportsStdinInjection: true,
|
|
124
132
|
supportsSubagentDispatch: false,
|
|
125
133
|
supportsParallelExecution: false,
|
|
126
134
|
supportsImageInput: true,
|
|
127
|
-
hasRuntimeHooks:
|
|
128
|
-
hasStopHook:
|
|
135
|
+
hasRuntimeHooks: false,
|
|
136
|
+
hasStopHook: false,
|
|
129
137
|
},
|
|
130
|
-
sessionDir:
|
|
138
|
+
sessionDir: DEFAULT_SESSION_DIR,
|
|
131
139
|
},
|
|
132
140
|
openclaw: {
|
|
133
141
|
name: "openclaw",
|
|
134
|
-
hostEnvSignals: [],
|
|
142
|
+
hostEnvSignals: ["OPENCLAW_SHELL", "OPENCLAW_HOME"],
|
|
135
143
|
capabilities: {
|
|
136
144
|
supportsSkills: true,
|
|
137
145
|
supportsThinking: true,
|
|
138
146
|
supportsMCP: false,
|
|
139
|
-
requiresToolApproval:
|
|
147
|
+
requiresToolApproval: true,
|
|
140
148
|
supportsInteractiveMode: true,
|
|
141
149
|
supportsStdinInjection: true,
|
|
142
150
|
supportsSubagentDispatch: false,
|
|
@@ -145,24 +153,41 @@ exports.STATIC_FALLBACK_METADATA = {
|
|
|
145
153
|
hasRuntimeHooks: false,
|
|
146
154
|
hasStopHook: false,
|
|
147
155
|
},
|
|
148
|
-
sessionDir:
|
|
156
|
+
sessionDir: DEFAULT_SESSION_DIR,
|
|
149
157
|
},
|
|
150
158
|
pi: {
|
|
151
159
|
name: "pi",
|
|
152
|
-
hostEnvSignals: ["PI_SESSION_ID"],
|
|
160
|
+
hostEnvSignals: ["PI_SESSION_ID", "PI_PLUGIN_ROOT"],
|
|
153
161
|
capabilities: {
|
|
154
162
|
supportsSkills: true,
|
|
155
163
|
supportsThinking: true,
|
|
156
164
|
supportsMCP: false,
|
|
157
|
-
requiresToolApproval:
|
|
165
|
+
requiresToolApproval: true,
|
|
158
166
|
supportsInteractiveMode: true,
|
|
159
167
|
supportsStdinInjection: true,
|
|
160
|
-
supportsSubagentDispatch:
|
|
168
|
+
supportsSubagentDispatch: true,
|
|
161
169
|
supportsParallelExecution: false,
|
|
162
170
|
supportsImageInput: true,
|
|
163
171
|
hasRuntimeHooks: false,
|
|
164
172
|
hasStopHook: false,
|
|
165
173
|
},
|
|
166
|
-
sessionDir:
|
|
174
|
+
sessionDir: DEFAULT_SESSION_DIR,
|
|
167
175
|
},
|
|
168
176
|
};
|
|
177
|
+
function buildStaticFallbackMetadata() {
|
|
178
|
+
try {
|
|
179
|
+
return Object.fromEntries(Object.values((0, agent_catalog_1.listFallbackHarnessMetadata)()).map((metadata) => [
|
|
180
|
+
metadata.adapterName,
|
|
181
|
+
{
|
|
182
|
+
name: metadata.adapterName,
|
|
183
|
+
hostEnvSignals: metadata.hostEnvSignals,
|
|
184
|
+
capabilities: metadata.capabilities,
|
|
185
|
+
sessionDir: resolveFallbackSessionDir(metadata.sessionDir),
|
|
186
|
+
},
|
|
187
|
+
]));
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return LOCAL_FALLBACK_METADATA;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.STATIC_FALLBACK_METADATA = buildStaticFallbackMetadata();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amuxMetadata.d.ts","sourceRoot":"","sources":["../../src/harness/amuxMetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"amuxMetadata.d.ts","sourceRoot":"","sources":["../../src/harness/amuxMetadata.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,uBAAuB,EAAE,OAAO,CAAC;IACjC,sBAAsB,EAAE,OAAO,CAAC;IAChC,wBAAwB,EAAE,OAAO,CAAC;IAClC,yBAAyB,EAAE,OAAO,CAAC;IACnC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iFAAiF;IACjF,eAAe,EAAE,OAAO,CAAC;IACzB,oDAAoD;IACpD,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,qDAAqD;IACrD,YAAY,EAAE,sBAAsB,CAAC;IACrC,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB;AAwFD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAEvF;AAkCD,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,mBAAmB,CAwG/E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
|
|
@@ -4,6 +4,7 @@ exports._setAmuxModuleForTesting = _setAmuxModuleForTesting;
|
|
|
4
4
|
exports.getAmuxAdapterMetadata = getAmuxAdapterMetadata;
|
|
5
5
|
exports.clearAmuxMetadataCache = clearAmuxMetadataCache;
|
|
6
6
|
const node_module_1 = require("node:module");
|
|
7
|
+
const config_1 = require("../config");
|
|
7
8
|
const amuxFallbackMetadata_1 = require("./amuxFallbackMetadata");
|
|
8
9
|
// ---------------------------------------------------------------------------
|
|
9
10
|
// Name mapping (babysitter harness name -> agent-mux adapter name)
|
|
@@ -162,7 +163,7 @@ function getAmuxAdapterMetadata(harnessName) {
|
|
|
162
163
|
},
|
|
163
164
|
sessionDir: typeof adapter.sessionDir === "function"
|
|
164
165
|
? adapter.sessionDir()
|
|
165
|
-
:
|
|
166
|
+
: (0, config_1.resolveRunsDir)(),
|
|
166
167
|
};
|
|
167
168
|
cache.set(amuxName, metadata);
|
|
168
169
|
return metadata;
|
|
@@ -13,8 +13,20 @@
|
|
|
13
13
|
* process. This answers "are we running *inside* a Claude Code session?"
|
|
14
14
|
* rather than "is the `claude` binary installed?".
|
|
15
15
|
*/
|
|
16
|
-
import type { CallerHarnessResult, HarnessDiscoveryResult } from "./types";
|
|
16
|
+
import type { CallerHarnessResult, HarnessDiscoveryResult, HarnessCapability } from "./types";
|
|
17
17
|
export { KNOWN_HARNESSES } from "./registry";
|
|
18
|
+
export interface HooksMuxCallerHarnessResult {
|
|
19
|
+
/** Normalized babysitter harness identifier. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Original hooks-mux adapter identifier. */
|
|
22
|
+
sourceAdapter: string;
|
|
23
|
+
/** Environment variable names that matched the hooks-mux rule. */
|
|
24
|
+
matchedEnvVars: string[];
|
|
25
|
+
/** Capabilities advertised by the normalized harness. */
|
|
26
|
+
capabilities: HarnessCapability[];
|
|
27
|
+
/** Detection confidence from hooks-mux rules. */
|
|
28
|
+
confidence: "high" | "medium" | "low";
|
|
29
|
+
}
|
|
18
30
|
/**
|
|
19
31
|
* Checks whether a single CLI command is available on the system.
|
|
20
32
|
*
|
|
@@ -57,4 +69,12 @@ export declare function discoverHarnesses(): Promise<HarnessDiscoveryResult[]>;
|
|
|
57
69
|
* env vars), the first match in `KNOWN_HARNESSES` order wins.
|
|
58
70
|
*/
|
|
59
71
|
export declare function detectCallerHarness(): CallerHarnessResult | null;
|
|
72
|
+
/**
|
|
73
|
+
* Detect the active caller harness using hooks-mux style discovery rules.
|
|
74
|
+
*
|
|
75
|
+
* This mirrors hooks-mux environment-based detection, but normalizes the
|
|
76
|
+
* adapter name back to babysitter's harness identifiers so SDK command
|
|
77
|
+
* surfaces can reuse the result without depending on hooks-mux packages.
|
|
78
|
+
*/
|
|
79
|
+
export declare function detectCallerHarnessViaHooksMux(env?: Record<string, string | undefined>): HooksMuxCallerHarnessResult | null;
|
|
60
80
|
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/harness/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/harness/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EAEtB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAc7C,MAAM,WAAW,2BAA2B;IAC1C,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,yDAAyD;IACzD,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,iDAAiD;IACjD,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CACvC;AA2BD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BlE;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAS3E;AAmCD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,IAAI,mBAAmB,GAAG,IAAI,CAahE;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,2BAA2B,GAAG,IAAI,CA0CpC"}
|
|
@@ -52,14 +52,27 @@ exports.KNOWN_HARNESSES = void 0;
|
|
|
52
52
|
exports.checkCliAvailable = checkCliAvailable;
|
|
53
53
|
exports.discoverHarnesses = discoverHarnesses;
|
|
54
54
|
exports.detectCallerHarness = detectCallerHarness;
|
|
55
|
+
exports.detectCallerHarnessViaHooksMux = detectCallerHarnessViaHooksMux;
|
|
55
56
|
const node_child_process_1 = require("node:child_process");
|
|
56
57
|
const node_fs_1 = require("node:fs");
|
|
57
58
|
const path = __importStar(require("node:path"));
|
|
58
59
|
const os = __importStar(require("node:os"));
|
|
60
|
+
const agent_catalog_1 = require("@a5c-ai/agent-catalog");
|
|
59
61
|
const registry_1 = require("./registry");
|
|
60
62
|
const install_1 = require("./install");
|
|
61
63
|
var registry_2 = require("./registry");
|
|
62
64
|
Object.defineProperty(exports, "KNOWN_HARNESSES", { enumerable: true, get: function () { return registry_2.KNOWN_HARNESSES; } });
|
|
65
|
+
const HOOKS_MUX_ADAPTER_TO_HARNESS = {
|
|
66
|
+
claude: "claude-code",
|
|
67
|
+
codex: "codex",
|
|
68
|
+
gemini: "gemini-cli",
|
|
69
|
+
copilot: "github-copilot",
|
|
70
|
+
cursor: "cursor",
|
|
71
|
+
pi: "pi",
|
|
72
|
+
"oh-my-pi": "oh-my-pi",
|
|
73
|
+
opencode: "opencode",
|
|
74
|
+
openclaw: "openclaw",
|
|
75
|
+
};
|
|
63
76
|
/**
|
|
64
77
|
* Checks whether a harness config directory exists in cwd or home.
|
|
65
78
|
*/
|
|
@@ -206,6 +219,48 @@ function detectCallerHarness() {
|
|
|
206
219
|
}
|
|
207
220
|
return null;
|
|
208
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Detect the active caller harness using hooks-mux style discovery rules.
|
|
224
|
+
*
|
|
225
|
+
* This mirrors hooks-mux environment-based detection, but normalizes the
|
|
226
|
+
* adapter name back to babysitter's harness identifiers so SDK command
|
|
227
|
+
* surfaces can reuse the result without depending on hooks-mux packages.
|
|
228
|
+
*/
|
|
229
|
+
function detectCallerHarnessViaHooksMux(env = process.env) {
|
|
230
|
+
const detectionRules = (0, agent_catalog_1.getHooksMuxDetectionRules)();
|
|
231
|
+
let bestMatch = null;
|
|
232
|
+
for (const rule of detectionRules) {
|
|
233
|
+
const normalizedName = HOOKS_MUX_ADAPTER_TO_HARNESS[rule.adapter];
|
|
234
|
+
if (!normalizedName) {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (rule.absentSignals?.some((signal) => env[signal])) {
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
const matchedEnvVars = rule.signals.filter((signal) => {
|
|
241
|
+
const value = env[signal];
|
|
242
|
+
return value != null && value !== "";
|
|
243
|
+
});
|
|
244
|
+
if (matchedEnvVars.length === 0) {
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
const capabilities = (0, registry_1.getHarnessDiscoverySpec)(normalizedName)?.capabilities ?? [];
|
|
248
|
+
const match = {
|
|
249
|
+
name: normalizedName,
|
|
250
|
+
sourceAdapter: rule.adapter,
|
|
251
|
+
matchedEnvVars,
|
|
252
|
+
capabilities,
|
|
253
|
+
confidence: rule.confidence,
|
|
254
|
+
};
|
|
255
|
+
if (match.confidence === "high") {
|
|
256
|
+
return match;
|
|
257
|
+
}
|
|
258
|
+
if (!bestMatch) {
|
|
259
|
+
bestMatch = match;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return bestMatch;
|
|
263
|
+
}
|
|
209
264
|
// ---------------------------------------------------------------------------
|
|
210
265
|
// Internal helpers
|
|
211
266
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runState.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/runState.ts"],"names":[],"mappings":"
|
|
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,CAoD/B"}
|
|
@@ -39,24 +39,14 @@ const node_fs_1 = require("node:fs");
|
|
|
39
39
|
const journal_1 = require("../../storage/journal");
|
|
40
40
|
const runFiles_1 = require("../../storage/runFiles");
|
|
41
41
|
const effectIndex_1 = require("../../runtime/replay/effectIndex");
|
|
42
|
+
const runLifecycleState_1 = require("../../runtime/runLifecycleState");
|
|
42
43
|
const completionProof_1 = require("../../cli/completionProof");
|
|
44
|
+
const config_1 = require("../../config");
|
|
43
45
|
const utils_1 = require("./utils");
|
|
44
46
|
function resolveRunDir(runId, runsDir, log) {
|
|
45
|
-
|
|
47
|
+
const runDir = (0, config_1.resolveExistingRunDir)(runId, { override: runsDir });
|
|
46
48
|
if (!(0, node_fs_1.existsSync)(path.join(runDir, "run.json")) && !path.isAbsolute(runId)) {
|
|
47
|
-
|
|
48
|
-
path.join(".a5c", ".a5c", "runs", runId),
|
|
49
|
-
path.join(".a5c", "runs", runId),
|
|
50
|
-
];
|
|
51
|
-
for (const candidate of alternatives) {
|
|
52
|
-
const resolved = path.resolve(candidate);
|
|
53
|
-
if (resolved !== path.resolve(runDir) &&
|
|
54
|
-
(0, node_fs_1.existsSync)(path.join(resolved, "run.json"))) {
|
|
55
|
-
log?.info(`Run not found at ${runDir}, using fallback: ${resolved}`);
|
|
56
|
-
runDir = resolved;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
49
|
+
log?.info(`Run ${runId} was not found in the primary runs root; continuing with compatibility lookup result ${runDir}`);
|
|
60
50
|
}
|
|
61
51
|
return runDir;
|
|
62
52
|
}
|
|
@@ -66,38 +56,37 @@ async function resolveHookRunState(args) {
|
|
|
66
56
|
const metadata = await (0, runFiles_1.readRunMetadata)(runDir);
|
|
67
57
|
const journal = await (0, journal_1.loadJournal)(runDir);
|
|
68
58
|
const index = await (0, effectIndex_1.buildEffectIndex)({ runDir, events: journal });
|
|
69
|
-
const hasCompleted = journal.some((event) => event.type === "RUN_COMPLETED");
|
|
70
|
-
const hasFailed = journal.some((event) => event.type === "RUN_FAILED");
|
|
71
59
|
const pendingRecords = index.listPendingEffects();
|
|
60
|
+
const runState = (0, runLifecycleState_1.deriveObservedRunState)(journal, pendingRecords.length);
|
|
72
61
|
const pendingByKind = (0, utils_1.countPendingByKind)(pendingRecords);
|
|
73
62
|
const pendingKinds = Object.keys(pendingByKind).join(", ");
|
|
74
63
|
const onlyBreakpointsPending = pendingRecords.length > 0 && (0, utils_1.isOnlyBreakpoints)(pendingByKind);
|
|
75
|
-
if (
|
|
64
|
+
if (runState === "completed") {
|
|
76
65
|
return {
|
|
77
|
-
runState
|
|
66
|
+
runState,
|
|
78
67
|
completionProof: (0, completionProof_1.resolveCompletionProof)(metadata),
|
|
79
68
|
pendingKinds,
|
|
80
69
|
onlyBreakpointsPending,
|
|
81
70
|
};
|
|
82
71
|
}
|
|
83
|
-
if (
|
|
72
|
+
if (runState === "failed") {
|
|
84
73
|
return {
|
|
85
|
-
runState
|
|
74
|
+
runState,
|
|
86
75
|
completionProof: "",
|
|
87
76
|
pendingKinds,
|
|
88
77
|
onlyBreakpointsPending,
|
|
89
78
|
};
|
|
90
79
|
}
|
|
91
|
-
if (
|
|
80
|
+
if (runState === "waiting") {
|
|
92
81
|
return {
|
|
93
|
-
runState
|
|
82
|
+
runState,
|
|
94
83
|
completionProof: "",
|
|
95
84
|
pendingKinds,
|
|
96
85
|
onlyBreakpointsPending,
|
|
97
86
|
};
|
|
98
87
|
}
|
|
99
88
|
return {
|
|
100
|
-
runState
|
|
89
|
+
runState,
|
|
101
90
|
completionProof: "",
|
|
102
91
|
pendingKinds,
|
|
103
92
|
onlyBreakpointsPending,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionBinding.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/sessionBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"sessionBinding.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/sessionBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOxD,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,IAAI,EAAE,kBAAkB,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CACpC;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CA2G5B"}
|
|
@@ -44,6 +44,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
44
44
|
exports.bindSession = bindSession;
|
|
45
45
|
const path = __importStar(require("node:path"));
|
|
46
46
|
const journal_1 = require("../../storage/journal");
|
|
47
|
+
const runLifecycleState_1 = require("../../runtime/runLifecycleState");
|
|
47
48
|
const parse_1 = require("../../session/parse");
|
|
48
49
|
const write_1 = require("../../session/write");
|
|
49
50
|
async function bindSession(args) {
|
|
@@ -61,9 +62,7 @@ async function bindSession(args) {
|
|
|
61
62
|
if (existing.state.runDir) {
|
|
62
63
|
try {
|
|
63
64
|
const journal = await (0, journal_1.loadJournal)(existing.state.runDir);
|
|
64
|
-
|
|
65
|
-
const hasFailed = journal.some((e) => e.type === "RUN_FAILED");
|
|
66
|
-
isTerminal = hasCompleted || hasFailed;
|
|
65
|
+
isTerminal = (0, runLifecycleState_1.isTerminalRunState)((0, runLifecycleState_1.deriveObservedRunState)(journal, (0, runLifecycleState_1.countPendingEffectsFromJournal)(journal)));
|
|
67
66
|
}
|
|
68
67
|
catch {
|
|
69
68
|
// Safe default
|
|
@@ -73,9 +72,7 @@ async function bindSession(args) {
|
|
|
73
72
|
try {
|
|
74
73
|
const oldRunDir = path.join(runsDir, oldRunId);
|
|
75
74
|
const journal = await (0, journal_1.loadJournal)(oldRunDir);
|
|
76
|
-
|
|
77
|
-
const hasFailed = journal.some((e) => e.type === "RUN_FAILED");
|
|
78
|
-
isTerminal = hasCompleted || hasFailed;
|
|
75
|
+
isTerminal = (0, runLifecycleState_1.isTerminalRunState)((0, runLifecycleState_1.deriveObservedRunState)(journal, (0, runLifecycleState_1.countPendingEffectsFromJournal)(journal)));
|
|
79
76
|
}
|
|
80
77
|
catch {
|
|
81
78
|
// Safe default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stopHookContinuation.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/stopHookContinuation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"stopHookContinuation.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/stopHookContinuation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAO1C,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,GAAG,EAAE,UAAU,GACd,oBAAoB,CAoCtB;AAMD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA4CD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE;IACJ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,UAAU,CAAC;CACjB,GACA,OAAO,CAAC,uBAAuB,CAAC,CAoDlC;AAMD,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE;IACJ,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,GACA,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,CA8GpD"}
|
|
@@ -47,6 +47,7 @@ const node_fs_1 = require("node:fs");
|
|
|
47
47
|
const journal_1 = require("../../storage/journal");
|
|
48
48
|
const runFiles_1 = require("../../storage/runFiles");
|
|
49
49
|
const effectIndex_1 = require("../../runtime/replay/effectIndex");
|
|
50
|
+
const runLifecycleState_1 = require("../../runtime/runLifecycleState");
|
|
50
51
|
const completionProof_1 = require("../../cli/completionProof");
|
|
51
52
|
const skill_1 = require("../../cli/commands/skill");
|
|
52
53
|
const transcript_1 = require("../../session/transcript");
|
|
@@ -55,6 +56,7 @@ const density_filter_1 = require("../../compression/density-filter");
|
|
|
55
56
|
const library_cache_1 = require("../../compression/library-cache");
|
|
56
57
|
const active_1 = require("../../processLibrary/active");
|
|
57
58
|
const resolveInputPath_1 = require("../../cli/resolveInputPath");
|
|
59
|
+
const config_1 = require("../../config");
|
|
58
60
|
const utils_1 = require("./utils");
|
|
59
61
|
function parseAssistantStopState(hookInput, log) {
|
|
60
62
|
const transcriptPath = (0, utils_1.safeStr)(hookInput, "transcript_path");
|
|
@@ -101,9 +103,10 @@ function resolveCandidateRunDir(runId, runsDir, preferredRunDir, log) {
|
|
|
101
103
|
candidates.push(runId);
|
|
102
104
|
}
|
|
103
105
|
else {
|
|
104
|
-
candidates.push(
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
candidates.push((0, config_1.resolveExistingRunDir)(runId, { override: runsDir }));
|
|
107
|
+
for (const readableRoot of (0, config_1.getReadableRunsDirs)({ override: runsDir })) {
|
|
108
|
+
candidates.push(path.join(readableRoot, runId));
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
111
|
const uniqueCandidates = candidates.filter((candidate, index) => candidates.findIndex((other) => path.resolve(other) === path.resolve(candidate)) === index);
|
|
109
112
|
for (const candidate of uniqueCandidates) {
|
|
@@ -147,28 +150,17 @@ async function resolveStopHookRunState(args) {
|
|
|
147
150
|
entrypointImportPath = metadata?.entrypoint?.importPath;
|
|
148
151
|
const journal = await (0, journal_1.loadJournal)(runDir);
|
|
149
152
|
const index = await (0, effectIndex_1.buildEffectIndex)({ runDir, events: journal });
|
|
150
|
-
const hasCompleted = journal.some((e) => e.type === "RUN_COMPLETED");
|
|
151
|
-
const hasFailed = journal.some((e) => e.type === "RUN_FAILED");
|
|
152
153
|
const pendingRecords = index.listPendingEffects();
|
|
154
|
+
runState = (0, runLifecycleState_1.deriveObservedRunState)(journal, pendingRecords.length);
|
|
153
155
|
const pendingByKind = (0, utils_1.countPendingByKind)(pendingRecords);
|
|
154
156
|
const kindKeys = Object.keys(pendingByKind);
|
|
155
157
|
if (kindKeys.length > 0) {
|
|
156
158
|
pendingKinds = kindKeys.join(", ");
|
|
157
159
|
}
|
|
158
160
|
onlyBreakpointsPending = pendingRecords.length > 0 && (0, utils_1.isOnlyBreakpoints)(pendingByKind);
|
|
159
|
-
if (
|
|
160
|
-
runState = "completed";
|
|
161
|
+
if (runState === "completed") {
|
|
161
162
|
completionProof = (0, completionProof_1.resolveCompletionProof)(metadata);
|
|
162
163
|
}
|
|
163
|
-
else if (hasFailed) {
|
|
164
|
-
runState = "failed";
|
|
165
|
-
}
|
|
166
|
-
else if (pendingRecords.length > 0) {
|
|
167
|
-
runState = "waiting";
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
runState = "created";
|
|
171
|
-
}
|
|
172
164
|
}
|
|
173
165
|
catch {
|
|
174
166
|
runState = "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stopHookHandler.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/stopHookHandler.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAIL,KAAK,UAAU,EAIhB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"stopHookHandler.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/stopHookHandler.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAIL,KAAK,UAAU,EAIhB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,UAAU,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,wBAAwB,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACpD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,CAAC;CACpD;AAmBD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CA8S/B"}
|