@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
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @a5c-ai/babysitter-sdk
|
|
2
|
+
|
|
3
|
+
Core runtime, storage, task, plugin, MCP, and CLI primitives for Babysitter.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @a5c-ai/babysitter-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Optional breakpoint routing support:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @a5c-ai/breakpoints-mux
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This package ships the built runtime in `dist/`, bundled command/skill templates in `skills/`, and this package README for npm auditability.
|
|
18
|
+
|
|
19
|
+
## CLI Surface
|
|
20
|
+
|
|
21
|
+
The package exposes three binaries:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx @a5c-ai/babysitter-sdk babysitter --help
|
|
25
|
+
npx @a5c-ai/babysitter-sdk babysitter-sdk --help
|
|
26
|
+
npx @a5c-ai/babysitter-sdk babysitter-mcp-server --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`babysitter` and `babysitter-sdk` point at the same CLI entrypoint. The public command groups currently include:
|
|
30
|
+
|
|
31
|
+
- `run:*`, `task:*`, and `session:*` for run orchestration and task result posting
|
|
32
|
+
- `skill:*`, `harness:*`, and `plugin:*` for discovery, installation, and registry flows
|
|
33
|
+
- `process-library:*`, `profile:*`, and `instructions:*` for library/profile management and generated guidance
|
|
34
|
+
- `tokens:*`, `compression:*`, `log`, `hook:*`, `health`, `configure`, and `version` for operator workflows
|
|
35
|
+
|
|
36
|
+
The optional interactive runtime commands such as `create-run`, `resume-run`, `plan`, `yolo`, `observe`, and `tui` live in the separate `@a5c-ai/babysitter-agent` package.
|
|
37
|
+
|
|
38
|
+
## API Surface
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import {
|
|
42
|
+
createRun,
|
|
43
|
+
defineTask,
|
|
44
|
+
createBabysitterMcpServer,
|
|
45
|
+
} from "@a5c-ai/babysitter-sdk";
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The root export surface currently re-exports these modules:
|
|
49
|
+
|
|
50
|
+
- runtime, runtime types, storage, storage types, tasks, testing
|
|
51
|
+
- CLI arg parsing helpers and command entrypoint helpers
|
|
52
|
+
- hooks, harness, breakpoints, MCP, plugins, prompts, logging, cost, config, profiles
|
|
53
|
+
- session helpers, process-library helpers, and compression utilities
|
|
54
|
+
|
|
55
|
+
## Validation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm run lint --workspace=@a5c-ai/babysitter-sdk
|
|
59
|
+
npm run build --workspace=@a5c-ai/babysitter-sdk
|
|
60
|
+
npm run test --workspace=@a5c-ai/babysitter-sdk
|
|
61
|
+
npm run smoke:cli --workspace=@a5c-ai/babysitter-sdk
|
|
62
|
+
npm run verify:metadata
|
|
63
|
+
npm pack --json --dry-run --workspace=@a5c-ai/babysitter-sdk
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Release Expectations
|
|
67
|
+
|
|
68
|
+
`@a5c-ai/babysitter-sdk` is a centrally released public package. Keep this README aligned with the actual CLI/API surface, keep `package.json#files` aligned with what ships, and verify the dry-run tarball before changing release-facing behavior.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpointRules.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/breakpointRules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"breakpointRules.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/breakpointRules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgB1F"}
|
|
@@ -45,6 +45,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
46
|
exports.handleBreakpointCommand = handleBreakpointCommand;
|
|
47
47
|
const crypto = __importStar(require("node:crypto"));
|
|
48
|
+
const config_1 = require("../../config");
|
|
48
49
|
const rules_1 = require("../../breakpoints/rules");
|
|
49
50
|
const evaluator_1 = require("../../breakpoints/evaluator");
|
|
50
51
|
async function handleBreakpointCommand(args) {
|
|
@@ -159,41 +160,43 @@ async function handleHistory(args) {
|
|
|
159
160
|
// Scan journal directories for breakpoint EFFECT_RESOLVED events
|
|
160
161
|
const { promises: fs } = await Promise.resolve().then(() => __importStar(require("node:fs")));
|
|
161
162
|
const path = await Promise.resolve().then(() => __importStar(require("node:path")));
|
|
162
|
-
const runsDir = args.runsDir ??
|
|
163
|
+
const runsDir = args.runsDir ?? (0, config_1.resolveRunsDir)();
|
|
163
164
|
const limit = args.limit ?? 50;
|
|
164
165
|
const entries = [];
|
|
165
166
|
try {
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
journalFiles = await fs.readdir(journalDir);
|
|
172
|
-
}
|
|
173
|
-
catch {
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
for (const jf of journalFiles) {
|
|
167
|
+
for (const candidateRunsDir of (0, config_1.getReadableRunsDirs)({ override: runsDir })) {
|
|
168
|
+
const runDirs = await fs.readdir(candidateRunsDir).catch(() => []);
|
|
169
|
+
for (const runId of runDirs.slice(-limit * 2)) {
|
|
170
|
+
const journalDir = path.join(candidateRunsDir, runId, "journal");
|
|
171
|
+
let journalFiles;
|
|
177
172
|
try {
|
|
178
|
-
|
|
179
|
-
const event = JSON.parse(raw);
|
|
180
|
-
const data = event.data;
|
|
181
|
-
if (event.type === "EFFECT_RESOLVED" && data?.breakpointId) {
|
|
182
|
-
const bpId = data.breakpointId;
|
|
183
|
-
if (args.breakpointId && bpId !== args.breakpointId)
|
|
184
|
-
continue;
|
|
185
|
-
entries.push({
|
|
186
|
-
runId,
|
|
187
|
-
breakpointId: bpId,
|
|
188
|
-
effectId: data.effectId,
|
|
189
|
-
status: data.status,
|
|
190
|
-
resolvedAt: event.recordedAt,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
173
|
+
journalFiles = await fs.readdir(journalDir);
|
|
193
174
|
}
|
|
194
175
|
catch {
|
|
195
176
|
continue;
|
|
196
177
|
}
|
|
178
|
+
for (const jf of journalFiles) {
|
|
179
|
+
try {
|
|
180
|
+
const raw = await fs.readFile(path.join(journalDir, jf), "utf-8");
|
|
181
|
+
const event = JSON.parse(raw);
|
|
182
|
+
const data = event.data;
|
|
183
|
+
if (event.type === "EFFECT_RESOLVED" && data?.breakpointId) {
|
|
184
|
+
const bpId = data.breakpointId;
|
|
185
|
+
if (args.breakpointId && bpId !== args.breakpointId)
|
|
186
|
+
continue;
|
|
187
|
+
entries.push({
|
|
188
|
+
runId,
|
|
189
|
+
breakpointId: bpId,
|
|
190
|
+
effectId: data.effectId,
|
|
191
|
+
status: data.status,
|
|
192
|
+
resolvedAt: event.recordedAt,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
197
200
|
}
|
|
198
201
|
}
|
|
199
202
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compressOutputHelpers.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/compressOutputHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,aAAa,GACrB,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GACrD,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAU5E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAQlE;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CASlE;
|
|
1
|
+
{"version":3,"file":"compressOutputHelpers.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/compressOutputHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,aAAa,GACrB,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GACrD,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAU5E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAQlE;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CASlE;AAmFD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAWzE;AAmBD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAmCpD;AAMD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,SAAK,EAAE,UAAU,SAAM,GAAG,MAAM,CAkC1G;AAMD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2BjD;AAmDD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAGvE;AAMD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAM,GAAG,MAAM,CAI5D"}
|
|
@@ -93,17 +93,33 @@ function compactStatus(status) {
|
|
|
93
93
|
const staged = [];
|
|
94
94
|
const unstaged = [];
|
|
95
95
|
const untracked = [];
|
|
96
|
+
let section = null;
|
|
96
97
|
for (const line of lines) {
|
|
97
98
|
if (!line.trim() || line.startsWith("On branch") || line.startsWith("HEAD"))
|
|
98
99
|
continue;
|
|
100
|
+
if (line.startsWith("Changes to be committed")) {
|
|
101
|
+
section = "staged";
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (line.startsWith("Changes not staged for commit")) {
|
|
105
|
+
section = "unstaged";
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (line.startsWith("Untracked files")) {
|
|
109
|
+
section = "untracked";
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
99
112
|
if (line.startsWith("\t")) {
|
|
100
113
|
const name = line.trim();
|
|
101
|
-
if (
|
|
114
|
+
if (section === "staged") {
|
|
102
115
|
staged.push(name);
|
|
103
116
|
}
|
|
104
|
-
else {
|
|
117
|
+
else if (section === "unstaged") {
|
|
105
118
|
unstaged.push(name);
|
|
106
119
|
}
|
|
120
|
+
else if (section === "untracked") {
|
|
121
|
+
untracked.push(name);
|
|
122
|
+
}
|
|
107
123
|
}
|
|
108
124
|
else if (line.startsWith("?? ")) {
|
|
109
125
|
untracked.push(line.slice(3));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"costStats.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/costStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EACV,gBAAgB,EAKjB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"costStats.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/costStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EACV,gBAAgB,EAKjB,MAAM,kBAAkB,CAAC;AAmQ1B,wBAAsB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuChF"}
|
|
@@ -46,7 +46,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
46
46
|
exports.handleCostStats = handleCostStats;
|
|
47
47
|
const node_fs_1 = require("node:fs");
|
|
48
48
|
const path = __importStar(require("node:path"));
|
|
49
|
-
const
|
|
49
|
+
const config_1 = require("../../config");
|
|
50
50
|
const storage_1 = require("../../storage");
|
|
51
51
|
const journal_1 = require("../../cost/journal");
|
|
52
52
|
// ============================================================================
|
|
@@ -74,8 +74,8 @@ function col(text, color, useColors) {
|
|
|
74
74
|
// ============================================================================
|
|
75
75
|
// Single Run
|
|
76
76
|
// ============================================================================
|
|
77
|
-
async function costStatsForRun(
|
|
78
|
-
const runDir =
|
|
77
|
+
async function costStatsForRun(runId, runsDirOverride) {
|
|
78
|
+
const runDir = (0, config_1.resolveExistingRunDir)(runId, { override: runsDirOverride });
|
|
79
79
|
let stat;
|
|
80
80
|
try {
|
|
81
81
|
stat = await node_fs_1.promises.stat(runDir);
|
|
@@ -91,30 +91,39 @@ async function costStatsForRun(runsDir, runId) {
|
|
|
91
91
|
// ============================================================================
|
|
92
92
|
// All Runs
|
|
93
93
|
// ============================================================================
|
|
94
|
-
async function costStatsForAllRuns(
|
|
95
|
-
let entries;
|
|
96
|
-
try {
|
|
97
|
-
entries = await node_fs_1.promises.readdir(runsDir);
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
entries = [];
|
|
101
|
-
}
|
|
94
|
+
async function costStatsForAllRuns(readableRunsDirs) {
|
|
102
95
|
const runs = [];
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
const seenRunDirs = new Set();
|
|
97
|
+
for (const runsDir of readableRunsDirs) {
|
|
98
|
+
let entries;
|
|
105
99
|
try {
|
|
106
|
-
|
|
107
|
-
if (!s.isDirectory())
|
|
108
|
-
continue;
|
|
100
|
+
entries = await node_fs_1.promises.readdir(runsDir);
|
|
109
101
|
}
|
|
110
102
|
catch {
|
|
111
|
-
|
|
103
|
+
entries = [];
|
|
104
|
+
}
|
|
105
|
+
for (const entry of entries) {
|
|
106
|
+
const runDir = path.join(runsDir, entry);
|
|
107
|
+
let normalizedRunDir;
|
|
108
|
+
try {
|
|
109
|
+
const s = await node_fs_1.promises.stat(runDir);
|
|
110
|
+
if (!s.isDirectory())
|
|
111
|
+
continue;
|
|
112
|
+
normalizedRunDir = path.resolve(runDir);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (seenRunDirs.has(normalizedRunDir)) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
seenRunDirs.add(normalizedRunDir);
|
|
121
|
+
const events = await (0, storage_1.loadJournal)(runDir);
|
|
122
|
+
const stats = (0, journal_1.computeRunCostStats)(entry, events);
|
|
123
|
+
if (stats.eventCount === 0)
|
|
124
|
+
continue;
|
|
125
|
+
runs.push(stats);
|
|
112
126
|
}
|
|
113
|
-
const events = await (0, storage_1.loadJournal)(runDir);
|
|
114
|
-
const stats = (0, journal_1.computeRunCostStats)(entry, events);
|
|
115
|
-
if (stats.eventCount === 0)
|
|
116
|
-
continue;
|
|
117
|
-
runs.push(stats);
|
|
118
127
|
}
|
|
119
128
|
let totalInputTokens = 0;
|
|
120
129
|
let totalOutputTokens = 0;
|
|
@@ -277,11 +286,10 @@ function printAggregateTable(agg, useColors) {
|
|
|
277
286
|
// Main Handler
|
|
278
287
|
// ============================================================================
|
|
279
288
|
async function handleCostStats(options) {
|
|
280
|
-
const
|
|
281
|
-
const resolvedRunsDir = path.resolve(runsDir);
|
|
289
|
+
const readableRunsDirs = (0, config_1.getReadableRunsDirs)({ override: options.runsDir });
|
|
282
290
|
const useColors = supportsColors();
|
|
283
291
|
if (options.all) {
|
|
284
|
-
const agg = await costStatsForAllRuns(
|
|
292
|
+
const agg = await costStatsForAllRuns(readableRunsDirs);
|
|
285
293
|
if (options.json) {
|
|
286
294
|
console.log(JSON.stringify(agg, null, 2));
|
|
287
295
|
}
|
|
@@ -291,9 +299,9 @@ async function handleCostStats(options) {
|
|
|
291
299
|
return 0;
|
|
292
300
|
}
|
|
293
301
|
if (options.runId) {
|
|
294
|
-
const stats = await costStatsForRun(
|
|
302
|
+
const stats = await costStatsForRun(options.runId, options.runsDir);
|
|
295
303
|
if (!stats) {
|
|
296
|
-
const msg = `Run not found: ${options.runId} (looked in ${
|
|
304
|
+
const msg = `Run not found: ${options.runId} (looked in ${readableRunsDirs.join(", ")})`;
|
|
297
305
|
if (options.json) {
|
|
298
306
|
console.error(JSON.stringify({ error: msg }));
|
|
299
307
|
}
|
|
@@ -10,9 +10,8 @@ export declare function handleHarnessInstall(args: HarnessInstallCommandArgs): P
|
|
|
10
10
|
* Install a babysitter plugin for a harness.
|
|
11
11
|
*
|
|
12
12
|
* Plugin installation remains harness-specific since it involves babysitter's
|
|
13
|
-
* own plugin packaging
|
|
14
|
-
* babysitter plugin system rather than per-adapter install logic.
|
|
13
|
+
* own plugin packaging. This uses the published per-harness plugin installer.
|
|
15
14
|
*/
|
|
16
|
-
export declare function handleHarnessInstallPlugin(args: HarnessInstallCommandArgs): number
|
|
15
|
+
export declare function handleHarnessInstallPlugin(args: HarnessInstallCommandArgs): Promise<number>;
|
|
17
16
|
export declare function formatHarnessInstallError(error: unknown, json: boolean): number;
|
|
18
17
|
//# sourceMappingURL=install.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/harness/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAS1B,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/harness/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAS1B,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAsDD;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAK3F;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAKjG;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAW/E"}
|
|
@@ -17,12 +17,18 @@ function formatInstallResult(payload, json) {
|
|
|
17
17
|
console.log(JSON.stringify(payload, null, 2));
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
+
if (payload.status) {
|
|
21
|
+
console.log(`Status: ${payload.status}`);
|
|
22
|
+
}
|
|
20
23
|
if (payload.warning) {
|
|
21
24
|
console.log(`Warning: ${payload.warning}`);
|
|
22
25
|
}
|
|
23
26
|
if (payload.summary) {
|
|
24
27
|
console.log(payload.summary);
|
|
25
28
|
}
|
|
29
|
+
if (payload.error) {
|
|
30
|
+
console.log(`Error: ${payload.error}`);
|
|
31
|
+
}
|
|
26
32
|
if (payload.command) {
|
|
27
33
|
console.log(`Command: ${payload.command}`);
|
|
28
34
|
}
|
|
@@ -49,24 +55,19 @@ async function handleHarnessInstall(args) {
|
|
|
49
55
|
const harnessName = requireHarnessName(args.harnessName, "harness:install");
|
|
50
56
|
const result = await (0, install_1.installHarnessViaAmux)(harnessName, args);
|
|
51
57
|
formatInstallResult(result, args.json);
|
|
52
|
-
return 0;
|
|
58
|
+
return result.success === false ? 1 : 0;
|
|
53
59
|
}
|
|
54
60
|
/**
|
|
55
61
|
* Install a babysitter plugin for a harness.
|
|
56
62
|
*
|
|
57
63
|
* Plugin installation remains harness-specific since it involves babysitter's
|
|
58
|
-
* own plugin packaging
|
|
59
|
-
* babysitter plugin system rather than per-adapter install logic.
|
|
64
|
+
* own plugin packaging. This uses the published per-harness plugin installer.
|
|
60
65
|
*/
|
|
61
|
-
function handleHarnessInstallPlugin(args) {
|
|
66
|
+
async function handleHarnessInstallPlugin(args) {
|
|
62
67
|
const harnessName = requireHarnessName(args.harnessName, "harness:install-plugin");
|
|
63
|
-
const result =
|
|
64
|
-
harness: harnessName,
|
|
65
|
-
summary: `Use "babysitter plugin:install" to install babysitter plugins for ${harnessName}. ` +
|
|
66
|
-
`Direct harness plugin installation has been consolidated into the plugin system.`,
|
|
67
|
-
};
|
|
68
|
+
const result = await (0, install_1.installHarnessPlugin)(harnessName, args);
|
|
68
69
|
formatInstallResult(result, args.json);
|
|
69
|
-
return 0;
|
|
70
|
+
return result.success === false ? 1 : 0;
|
|
70
71
|
}
|
|
71
72
|
function formatHarnessInstallError(error, json) {
|
|
72
73
|
const err = error instanceof Error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/health/checks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/health/checks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAsC7C,wBAAsB,eAAe,IAAI,OAAO,CAAC,WAAW,CAAC,CAuB5D;AAED,wBAAgB,gBAAgB,IAAI,WAAW,CAsC9C;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA8EzE;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA4D9E"}
|
|
@@ -43,6 +43,7 @@ exports.checkA5cDirectory = checkA5cDirectory;
|
|
|
43
43
|
exports.checkPackageDependency = checkPackageDependency;
|
|
44
44
|
const node_fs_1 = require("node:fs");
|
|
45
45
|
const path = __importStar(require("node:path"));
|
|
46
|
+
const config_1 = require("../../../config");
|
|
46
47
|
// ============================================================================
|
|
47
48
|
// Version Utilities
|
|
48
49
|
// ============================================================================
|
|
@@ -136,7 +137,7 @@ function checkNodeVersion() {
|
|
|
136
137
|
}
|
|
137
138
|
async function checkA5cDirectory(cwd) {
|
|
138
139
|
const a5cDir = path.join(cwd, ".a5c");
|
|
139
|
-
const runsDir =
|
|
140
|
+
const runsDir = (0, config_1.resolveRunsDir)({ cwd });
|
|
140
141
|
try {
|
|
141
142
|
const stats = await node_fs_1.promises.stat(a5cDir);
|
|
142
143
|
if (!stats.isDirectory()) {
|
|
@@ -147,7 +148,7 @@ async function checkA5cDirectory(cwd) {
|
|
|
147
148
|
message: `.a5c exists but is not a directory at ${a5cDir}`,
|
|
148
149
|
nextSteps: [
|
|
149
150
|
"Remove the .a5c file and let the SDK create the directory",
|
|
150
|
-
"Or run: rm .a5c && mkdir -p .a5c
|
|
151
|
+
"Or run: rm .a5c && mkdir -p .a5c",
|
|
151
152
|
],
|
|
152
153
|
details: { path: a5cDir, isDirectory: false },
|
|
153
154
|
};
|
|
@@ -196,7 +197,7 @@ async function checkA5cDirectory(cwd) {
|
|
|
196
197
|
message: `.a5c directory does not exist at ${a5cDir}`,
|
|
197
198
|
nextSteps: [
|
|
198
199
|
"The directory will be created automatically when running babysitter commands",
|
|
199
|
-
"Or create it manually: mkdir -p .a5c
|
|
200
|
+
"Or create it manually: mkdir -p .a5c",
|
|
200
201
|
],
|
|
201
202
|
details: { path: a5cDir, exists: false },
|
|
202
203
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/health/environment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/health/environment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,wBAAgB,yBAAyB,IAAI,WAAW,CAiGvD"}
|
|
@@ -2,16 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkEnvironmentVariables = checkEnvironmentVariables;
|
|
4
4
|
const defaults_1 = require("../../../config/defaults");
|
|
5
|
+
const config_1 = require("../../../config");
|
|
5
6
|
function checkEnvironmentVariables() {
|
|
6
7
|
const envChecks = [];
|
|
7
8
|
const runsDir = process.env[defaults_1.CONFIG_ENV_VARS.RUNS_DIR];
|
|
9
|
+
const runsScope = (0, config_1.getRunsScope)();
|
|
8
10
|
envChecks.push({
|
|
9
11
|
name: "BABYSITTER_RUNS_DIR",
|
|
10
12
|
key: defaults_1.CONFIG_ENV_VARS.RUNS_DIR,
|
|
11
13
|
value: runsDir,
|
|
12
14
|
required: false,
|
|
13
15
|
valid: true,
|
|
14
|
-
note: runsDir ? `Custom runs directory: ${runsDir}` : `Using default: ${
|
|
16
|
+
note: runsDir ? `Custom runs directory: ${runsDir}` : `Using ${runsScope} scope default: ${(0, config_1.resolveRunsDir)()}`,
|
|
17
|
+
});
|
|
18
|
+
envChecks.push({
|
|
19
|
+
name: "BABYSITTER_RUNS_SCOPE",
|
|
20
|
+
key: defaults_1.CONFIG_ENV_VARS.RUNS_SCOPE,
|
|
21
|
+
value: process.env[defaults_1.CONFIG_ENV_VARS.RUNS_SCOPE],
|
|
22
|
+
required: false,
|
|
23
|
+
valid: true,
|
|
24
|
+
note: `Runs scope: ${runsScope}`,
|
|
15
25
|
});
|
|
16
26
|
const maxIterations = process.env[defaults_1.CONFIG_ENV_VARS.MAX_ITERATIONS];
|
|
17
27
|
let maxIterValid = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/hooks/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,wGAAwG;IACxG,OAAO,EAAE,MAAM,CAAC;IAChB,8IAA8I;IAC9I,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAmJD,wBAAsB,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/hooks/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,wGAAwG;IACxG,OAAO,EAAE,MAAM,CAAC;IAChB,8IAA8I;IAC9I,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAmJD,wBAAsB,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CA2F7E"}
|
|
@@ -208,6 +208,7 @@ async function handleHookRun(args) {
|
|
|
208
208
|
let exitCode;
|
|
209
209
|
switch (hookType) {
|
|
210
210
|
case "stop":
|
|
211
|
+
case "session-end":
|
|
211
212
|
exitCode = await adapter.handleStopHook(args);
|
|
212
213
|
break;
|
|
213
214
|
case "session-start":
|
|
@@ -216,14 +217,14 @@ async function handleHookRun(args) {
|
|
|
216
217
|
default: {
|
|
217
218
|
const error = {
|
|
218
219
|
error: "UNKNOWN_HOOK_TYPE",
|
|
219
|
-
message: `Unknown hook type: ${hookType}. Supported: stop, session-start, user-prompt-submit`,
|
|
220
|
+
message: `Unknown hook type: ${hookType}. Supported: stop, session-end, session-start, user-prompt-submit, pre-tool-use`,
|
|
220
221
|
};
|
|
221
222
|
logHookEvent(hookType, error.message, { error: error.error });
|
|
222
223
|
if (json) {
|
|
223
224
|
process.stderr.write(JSON.stringify(error, null, 2) + "\n");
|
|
224
225
|
}
|
|
225
226
|
else {
|
|
226
|
-
process.stderr.write(`Error: Unknown hook type: ${hookType}. Supported: stop, session-start, user-prompt-submit\n`);
|
|
227
|
+
process.stderr.write(`Error: Unknown hook type: ${hookType}. Supported: stop, session-end, session-start, user-prompt-submit, pre-tool-use\n`);
|
|
227
228
|
}
|
|
228
229
|
return 1;
|
|
229
230
|
}
|
|
@@ -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;AAmCH,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;AAwND;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAkIjB"}
|
|
@@ -13,7 +13,9 @@ const node_fs_1 = require("node:fs");
|
|
|
13
13
|
const prompts_1 = require("../../prompts");
|
|
14
14
|
const active_1 = require("../../processLibrary/active");
|
|
15
15
|
const registry_1 = require("../../harness/registry");
|
|
16
|
+
const discovery_1 = require("../../harness/discovery");
|
|
16
17
|
const parse_1 = require("../../session/parse");
|
|
18
|
+
const contextShared_1 = require("../../prompts/contextShared");
|
|
17
19
|
const COMPOSERS = {
|
|
18
20
|
"babysit-skill": {
|
|
19
21
|
fn: prompts_1.composeBabysitSkillPrompt,
|
|
@@ -78,6 +80,9 @@ const COMPOSERS = {
|
|
|
78
80
|
* Resolve a PromptContext factory by harness name.
|
|
79
81
|
*/
|
|
80
82
|
function resolveContextFactory(harness) {
|
|
83
|
+
if (harness === "custom") {
|
|
84
|
+
return (overrides) => createPessimisticPromptContext(overrides);
|
|
85
|
+
}
|
|
81
86
|
if (!(0, registry_1.getAdapterByName)(harness)?.getPromptContext) {
|
|
82
87
|
return undefined;
|
|
83
88
|
}
|
|
@@ -89,6 +94,60 @@ function resolveContextFactory(harness) {
|
|
|
89
94
|
return context;
|
|
90
95
|
};
|
|
91
96
|
}
|
|
97
|
+
function createPessimisticPromptContext(overrides) {
|
|
98
|
+
return (0, contextShared_1.createPromptContext)({
|
|
99
|
+
harness: "custom",
|
|
100
|
+
harnessLabel: "Custom Harness",
|
|
101
|
+
capabilities: ["task-tool", "breakpoint-routing"],
|
|
102
|
+
pluginRootVar: "",
|
|
103
|
+
loopControlTerm: "in-turn",
|
|
104
|
+
sessionBindingFlags: "",
|
|
105
|
+
hookDriven: false,
|
|
106
|
+
interactiveToolName: "",
|
|
107
|
+
sessionEnvVars: "`--session-id`, `AGENT_SESSION_ID`, or the PID-scoped session marker fallback",
|
|
108
|
+
resumeFlags: "",
|
|
109
|
+
cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
|
|
110
|
+
iterateFlags: "",
|
|
111
|
+
hasIntentFidelityChecks: false,
|
|
112
|
+
hasNonNegotiables: false,
|
|
113
|
+
}, overrides);
|
|
114
|
+
}
|
|
115
|
+
function resolveInstructionsHarness(harness) {
|
|
116
|
+
if (harness) {
|
|
117
|
+
return {
|
|
118
|
+
harness,
|
|
119
|
+
source: "explicit",
|
|
120
|
+
warnings: [],
|
|
121
|
+
evidence: [],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const caller = (0, discovery_1.detectCallerHarness)();
|
|
125
|
+
if (caller) {
|
|
126
|
+
return {
|
|
127
|
+
harness: caller.name,
|
|
128
|
+
source: "caller",
|
|
129
|
+
warnings: [],
|
|
130
|
+
evidence: caller.matchedEnvVars,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const hooksMuxCaller = (0, discovery_1.detectCallerHarnessViaHooksMux)();
|
|
134
|
+
if (hooksMuxCaller) {
|
|
135
|
+
return {
|
|
136
|
+
harness: hooksMuxCaller.name,
|
|
137
|
+
source: "hooks-mux",
|
|
138
|
+
warnings: [],
|
|
139
|
+
evidence: hooksMuxCaller.matchedEnvVars,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
harness: "custom",
|
|
144
|
+
source: "fallback",
|
|
145
|
+
warnings: [
|
|
146
|
+
"Host discovery failed for `instructions:*`; using the pessimistic custom-harness prompt context.",
|
|
147
|
+
],
|
|
148
|
+
evidence: [],
|
|
149
|
+
};
|
|
150
|
+
}
|
|
92
151
|
/**
|
|
93
152
|
* Try to resolve the active process-library root from the SDK directly.
|
|
94
153
|
* Returns the library root and reference root if a binding exists,
|
|
@@ -139,17 +198,18 @@ function detectHooksActive(harness) {
|
|
|
139
198
|
* Route and handle an `instructions:*` subcommand.
|
|
140
199
|
*/
|
|
141
200
|
async function handleInstructionsCommand(args) {
|
|
142
|
-
const
|
|
201
|
+
const resolvedHarness = resolveInstructionsHarness(args.harness);
|
|
202
|
+
const factory = resolveContextFactory(resolvedHarness.harness);
|
|
143
203
|
if (!factory) {
|
|
144
204
|
const known = registry_1.KNOWN_HARNESSES.map((spec) => spec.name).join(", ");
|
|
145
205
|
if (args.json) {
|
|
146
206
|
console.log(JSON.stringify({
|
|
147
207
|
error: "unknown_harness",
|
|
148
|
-
message: `Unknown harness "${
|
|
208
|
+
message: `Unknown harness "${resolvedHarness.harness}". Known harnesses: ${known}`,
|
|
149
209
|
}));
|
|
150
210
|
}
|
|
151
211
|
else {
|
|
152
|
-
console.error(`[instructions] Unknown harness "${
|
|
212
|
+
console.error(`[instructions] Unknown harness "${resolvedHarness.harness}". Known harnesses: ${known}`);
|
|
153
213
|
}
|
|
154
214
|
return 1;
|
|
155
215
|
}
|
|
@@ -172,7 +232,7 @@ async function handleInstructionsCommand(args) {
|
|
|
172
232
|
// Detect whether hooks are actually active in this session.
|
|
173
233
|
// If the session-start hook never ran (no breadcrumb file), override
|
|
174
234
|
// hookDriven to false so the agent drives the loop in-turn.
|
|
175
|
-
const hooksActive = detectHooksActive(
|
|
235
|
+
const hooksActive = detectHooksActive(resolvedHarness.harness);
|
|
176
236
|
const hookOverride = {};
|
|
177
237
|
if (!hooksActive) {
|
|
178
238
|
hookOverride.hookDriven = false;
|
|
@@ -201,11 +261,14 @@ async function handleInstructionsCommand(args) {
|
|
|
201
261
|
}
|
|
202
262
|
if (args.json) {
|
|
203
263
|
console.log(JSON.stringify({
|
|
204
|
-
harness:
|
|
264
|
+
harness: resolvedHarness.harness,
|
|
265
|
+
harnessSource: resolvedHarness.source,
|
|
266
|
+
discoveryEvidence: resolvedHarness.evidence,
|
|
205
267
|
interactive: args.interactive,
|
|
206
268
|
promptType: composer.promptType,
|
|
207
269
|
hookDriven: ctx.hookDriven,
|
|
208
270
|
hooksDetected: hooksActive,
|
|
271
|
+
warnings: resolvedHarness.warnings,
|
|
209
272
|
executionContext,
|
|
210
273
|
capabilityFlags,
|
|
211
274
|
suggestedProcesses: (0, prompts_1.processPathsForCapabilities)(capabilityFlags),
|
|
@@ -214,6 +277,9 @@ async function handleInstructionsCommand(args) {
|
|
|
214
277
|
}, null, 2));
|
|
215
278
|
}
|
|
216
279
|
else {
|
|
280
|
+
for (const warning of resolvedHarness.warnings) {
|
|
281
|
+
console.error(`[instructions] Warning: ${warning}`);
|
|
282
|
+
}
|
|
217
283
|
if (!hooksActive && ctx.hookDriven !== false) {
|
|
218
284
|
// Context factory defaulted hookDriven to true, but we overrode it.
|
|
219
285
|
// This is a no-op because the override already happened, but it
|
|
@@ -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;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAaxD,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;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,CAgKtF"}
|