@a5c-ai/babysitter-sdk 5.0.1-staging.ff2c19f9 → 5.0.1-staging.ffad3b46492e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -0
- 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/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/detectExistingRun.d.ts +14 -0
- package/dist/cli/commands/detectExistingRun.d.ts.map +1 -0
- package/dist/cli/commands/detectExistingRun.js +89 -0
- package/dist/cli/commands/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/log.d.ts.map +1 -1
- package/dist/cli/commands/hooks/log.js +4 -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 +92 -46
- 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 +27 -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/checkIteration.d.ts.map +1 -1
- package/dist/cli/commands/session/checkIteration.js +0 -22
- package/dist/cli/commands/session/common.js +1 -1
- package/dist/cli/commands/session/init.d.ts.map +1 -1
- package/dist/cli/commands/session/init.js +2 -1
- package/dist/cli/commands/session/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 +9 -18
- package/dist/cli/commands/session/update.d.ts +0 -1
- package/dist/cli/commands/session/update.d.ts.map +1 -1
- package/dist/cli/commands/session/update.js +0 -12
- package/dist/cli/commands/skill/remoteDiscovery.js +1 -1
- package/dist/cli/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/argFlags.d.ts.map +1 -1
- package/dist/cli/main/argFlags.js +0 -3
- package/dist/cli/main/argPositionals.d.ts.map +1 -1
- package/dist/cli/main/argPositionals.js +1 -0
- package/dist/cli/main/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.d.ts.map +1 -1
- package/dist/cli/main/dispatchRunSession.js +2 -11
- package/dist/cli/main/program.js +3 -3
- package/dist/cli/main/runAssignProcess.d.ts +3 -0
- package/dist/cli/main/runAssignProcess.d.ts.map +1 -0
- package/dist/cli/main/runAssignProcess.js +172 -0
- package/dist/cli/main/runCommands.d.ts +1 -0
- package/dist/cli/main/runCommands.d.ts.map +1 -1
- package/dist/cli/main/runCommands.js +3 -1
- package/dist/cli/main/runCreate.d.ts.map +1 -1
- package/dist/cli/main/runCreate.js +66 -29
- 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/types.d.ts +0 -1
- package/dist/cli/main/types.d.ts.map +1 -1
- package/dist/cli/main/usage.d.ts.map +1 -1
- package/dist/cli/main/usage.js +48 -43
- package/dist/cli/render/events/index.d.ts.map +1 -1
- package/dist/cli/render/events/index.js +2 -0
- package/dist/cli/render/events/processAssigned.d.ts +3 -0
- package/dist/cli/render/events/processAssigned.d.ts.map +1 -0
- package/dist/cli/render/events/processAssigned.js +22 -0
- package/dist/config/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 +4 -2
- 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/cost/index.js +1 -1
- package/dist/harness/BaseAdapter.d.ts.map +1 -1
- package/dist/harness/BaseAdapter.js +1 -0
- package/dist/harness/adapters/claude-code.d.ts +2 -8
- package/dist/harness/adapters/claude-code.d.ts.map +1 -1
- package/dist/harness/adapters/claude-code.js +3 -8
- package/dist/harness/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 +91 -37
- package/dist/harness/amuxMetadata.d.ts.map +1 -1
- package/dist/harness/amuxMetadata.js +2 -1
- package/dist/harness/customAdapter.d.ts.map +1 -1
- package/dist/harness/customAdapter.js +1 -18
- 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/promptContexts.d.ts +6 -1
- package/dist/harness/hooks/promptContexts.d.ts.map +1 -1
- package/dist/harness/hooks/promptContexts.js +65 -142
- package/dist/harness/hooks/runState.d.ts +1 -0
- package/dist/harness/hooks/runState.d.ts.map +1 -1
- package/dist/harness/hooks/runState.js +20 -23
- package/dist/harness/hooks/sessionBinding.d.ts.map +1 -1
- package/dist/harness/hooks/sessionBinding.js +13 -8
- 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 +14 -16
- package/dist/harness/hooks/stopHookHandler.d.ts.map +1 -1
- package/dist/harness/hooks/stopHookHandler.js +310 -36
- package/dist/harness/hooks/utils.d.ts +5 -1
- package/dist/harness/hooks/utils.d.ts.map +1 -1
- package/dist/harness/hooks/utils.js +18 -11
- 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 -4
- package/dist/harness/install.d.ts.map +1 -1
- package/dist/harness/install.js +142 -0
- package/dist/harness/installSupport.d.ts.map +1 -1
- package/dist/harness/installSupport.js +28 -8
- package/dist/harness/registry.d.ts.map +1 -1
- package/dist/harness/registry.js +64 -68
- package/dist/harness/types.d.ts +7 -0
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/unified/adapter.d.ts.map +1 -1
- package/dist/harness/unified/adapter.js +31 -0
- package/dist/harness/unified/subprocess.d.ts.map +1 -1
- package/dist/harness/unified/subprocess.js +3 -0
- package/dist/hooks/dispatcher.d.ts +2 -2
- package/dist/hooks/dispatcher.d.ts.map +1 -1
- package/dist/hooks/dispatcher.js +56 -15
- package/dist/index.js +3 -3
- package/dist/logging/runLogger.d.ts.map +1 -1
- package/dist/logging/runLogger.js +2 -0
- package/dist/mcp/index.js +3 -3
- package/dist/mcp/tools/discovery.js +6 -6
- package/dist/mcp/tools/runs.js +18 -18
- package/dist/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/mcp/tools/sessions.js +23 -28
- package/dist/mcp/tools/tasks.js +13 -13
- package/dist/mcp/transport/index.js +1 -1
- 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/plugins/marketplace.d.ts.map +1 -1
- package/dist/plugins/marketplace.js +26 -2
- package/dist/plugins/migrations.d.ts.map +1 -1
- package/dist/plugins/migrations.js +31 -9
- package/dist/processLibrary/active.d.ts.map +1 -1
- package/dist/processLibrary/active.js +18 -1
- package/dist/prompts/capabilityCollector.d.ts.map +1 -1
- package/dist/prompts/capabilityCollector.js +23 -14
- package/dist/prompts/compose.d.ts.map +1 -1
- package/dist/prompts/compose.js +14 -3
- package/dist/prompts/context.d.ts +2 -2
- package/dist/prompts/context.d.ts.map +1 -1
- package/dist/prompts/context.js +4 -11
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +3 -6
- package/dist/prompts/parts/criticalRules.d.ts.map +1 -1
- package/dist/prompts/parts/criticalRules.js +15 -2
- package/dist/prompts/parts/runCreation.d.ts.map +1 -1
- package/dist/prompts/parts/runCreation.js +25 -4
- package/dist/prompts/parts/taskKinds.d.ts.map +1 -1
- package/dist/prompts/parts/taskKinds.js +11 -3
- package/dist/prompts/templateRenderer.d.ts.map +1 -1
- package/dist/prompts/templateRenderer.js +114 -22
- package/dist/prompts/templates/commands/assimilate.md +1 -1
- package/dist/prompts/templates/commands/cleanup.md +31 -9
- package/dist/prompts/templates/commands/contrib.md +1 -1
- package/dist/prompts/templates/commands/doctor.md +3 -4
- package/dist/prompts/templates/commands/forever.md +1 -1
- package/dist/prompts/templates/commands/project-install.md +1 -1
- package/dist/prompts/templates/commands/retrospect.md +1 -1
- package/dist/prompts/templates/commands/user-install.md +1 -1
- package/dist/prompts/templates/effects.md +1 -1
- package/dist/prompts/templates/iteration.md +1 -1
- package/dist/prompts/templates/quick-reference.md +5 -0
- package/dist/prompts/templates/results-posting.md +2 -2
- package/dist/prompts/templates/run-creation.md +47 -3
- 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 +8 -2
- package/dist/runtime/createRun.d.ts.map +1 -1
- package/dist/runtime/createRun.js +38 -17
- 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/breakpoint.js +1 -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 +2 -0
- 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 +85 -3
- 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/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 -0
- package/dist/runtime/processContext.d.ts.map +1 -1
- package/dist/runtime/processContext.js +53 -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/replay/stateCache.d.ts +2 -0
- package/dist/runtime/replay/stateCache.d.ts.map +1 -1
- package/dist/runtime/replay/stateCache.js +14 -3
- package/dist/runtime/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 +52 -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/sdkVersion.d.ts +5 -0
- package/dist/sdkVersion.d.ts.map +1 -0
- package/dist/sdkVersion.js +49 -0
- package/dist/session/cleanup.d.ts.map +1 -1
- package/dist/session/cleanup.js +38 -22
- package/dist/session/discovery.d.ts +6 -6
- package/dist/session/discovery.js +6 -6
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +1 -3
- package/dist/session/parse.d.ts.map +1 -1
- package/dist/session/parse.js +5 -1
- package/dist/session/types.d.ts +4 -8
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/write.d.ts +1 -10
- package/dist/session/write.d.ts.map +1 -1
- package/dist/session/write.js +4 -31
- package/dist/storage/createRunDir.d.ts.map +1 -1
- package/dist/storage/createRunDir.js +3 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -1
- package/dist/storage/journal.d.ts.map +1 -1
- package/dist/storage/journal.js +48 -28
- package/dist/storage/runFiles.d.ts +1 -0
- package/dist/storage/runFiles.d.ts.map +1 -1
- package/dist/storage/runFiles.js +5 -0
- package/dist/storage/tasks.d.ts.map +1 -1
- package/dist/storage/tasks.js +3 -2
- package/dist/storage/types.d.ts +18 -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 +22 -5
- 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 +41 -14
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/tasks-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/agent-platform` 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.
|
|
@@ -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 {
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ExistingRunInfo {
|
|
2
|
+
runId: string;
|
|
3
|
+
runDir: string;
|
|
4
|
+
processId: string;
|
|
5
|
+
isBareRun: boolean;
|
|
6
|
+
entrypoint: {
|
|
7
|
+
importPath: string;
|
|
8
|
+
exportName?: string;
|
|
9
|
+
};
|
|
10
|
+
completionProof?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function detectExistingRun(): Promise<ExistingRunInfo | undefined>;
|
|
13
|
+
export declare function formatExistingRunBlock(existingRun: ExistingRunInfo): string;
|
|
14
|
+
//# sourceMappingURL=detectExistingRun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectExistingRun.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/detectExistingRun.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CA0B9E;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,eAAe,GAAG,MAAM,CAiB3E"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.detectExistingRun = detectExistingRun;
|
|
37
|
+
exports.formatExistingRunBlock = formatExistingRunBlock;
|
|
38
|
+
const node_fs_1 = require("node:fs");
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const config_1 = require("../../config");
|
|
41
|
+
async function detectExistingRun() {
|
|
42
|
+
try {
|
|
43
|
+
const runsDir = (0, config_1.resolveRunsDir)();
|
|
44
|
+
const entries = await node_fs_1.promises.readdir(runsDir, { withFileTypes: true });
|
|
45
|
+
const dirs = entries.filter((e) => e.isDirectory()).map((e) => e.name).sort().reverse();
|
|
46
|
+
for (const runId of dirs.slice(0, 5)) {
|
|
47
|
+
const runFile = path.join(runsDir, runId, "run.json");
|
|
48
|
+
try {
|
|
49
|
+
const raw = await node_fs_1.promises.readFile(runFile, "utf8");
|
|
50
|
+
const meta = JSON.parse(raw);
|
|
51
|
+
const entrypoint = meta["entrypoint"];
|
|
52
|
+
const processId = meta["processId"] ?? "";
|
|
53
|
+
const isBareRun = entrypoint?.importPath === "bare-run";
|
|
54
|
+
return {
|
|
55
|
+
runId,
|
|
56
|
+
runDir: path.join(runsDir, runId),
|
|
57
|
+
processId,
|
|
58
|
+
isBareRun,
|
|
59
|
+
entrypoint: { importPath: entrypoint?.importPath ?? "", exportName: entrypoint?.exportName },
|
|
60
|
+
completionProof: meta["completionProof"]
|
|
61
|
+
?? meta["metadata"]?.["completionProof"],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch { /* no runs dir */ }
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
function formatExistingRunBlock(existingRun) {
|
|
73
|
+
return [
|
|
74
|
+
'## Existing Run State',
|
|
75
|
+
'',
|
|
76
|
+
`- Run ID: \`${existingRun.runId}\``,
|
|
77
|
+
`- Run Dir: \`${existingRun.runDir}\``,
|
|
78
|
+
`- Process ID: \`${existingRun.processId}\``,
|
|
79
|
+
`- Bare Run: \`${existingRun.isBareRun}\``,
|
|
80
|
+
`- Entrypoint: \`${existingRun.entrypoint.importPath}${existingRun.entrypoint.exportName ? '#' + existingRun.entrypoint.exportName : ''}\``,
|
|
81
|
+
'',
|
|
82
|
+
existingRun.isBareRun
|
|
83
|
+
? `**This is a bare run.** Use \`run:assign-process ${existingRun.runDir} --entry <path>#<export>\` to assign a process before iterating.`
|
|
84
|
+
: `This run already has a process assigned. Use \`run:iterate ${existingRun.runDir} --json\` to continue.`,
|
|
85
|
+
'',
|
|
86
|
+
'---',
|
|
87
|
+
'',
|
|
88
|
+
].join('\n');
|
|
89
|
+
}
|
|
@@ -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
|
};
|