@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
|
@@ -49,15 +49,18 @@ exports.resolveArtifactAbsolutePath = resolveArtifactAbsolutePath;
|
|
|
49
49
|
exports.defaultResultRef = defaultResultRef;
|
|
50
50
|
exports.formatEntrypointSpecifier = formatEntrypointSpecifier;
|
|
51
51
|
exports.parseEntrypointSpecifier = parseEntrypointSpecifier;
|
|
52
|
+
exports.ensureProcessLocalSdkDependency = ensureProcessLocalSdkDependency;
|
|
52
53
|
exports.validateProcessEntrypoint = validateProcessEntrypoint;
|
|
53
54
|
exports.readInputsFile = readInputsFile;
|
|
54
55
|
exports.readStdinUtf8 = readStdinUtf8;
|
|
55
56
|
exports.resolveCommandRunDir = resolveCommandRunDir;
|
|
56
57
|
const node_fs_1 = require("node:fs");
|
|
58
|
+
const node_module_1 = require("node:module");
|
|
57
59
|
const path = __importStar(require("node:path"));
|
|
58
60
|
const node_url_1 = require("node:url");
|
|
59
61
|
const args_1 = require("./args");
|
|
60
62
|
const resolveInputPath_1 = require("../resolveInputPath");
|
|
63
|
+
const SDK_PACKAGE_SPECIFIER = "@a5c-ai/babysitter-sdk/package.json";
|
|
61
64
|
const dynamicImportModule = (() => {
|
|
62
65
|
if (process.env.VITEST) {
|
|
63
66
|
return (specifier) => Promise.resolve(`${specifier}`).then(s => __importStar(require(s)));
|
|
@@ -233,7 +236,68 @@ function listModuleExports(mod) {
|
|
|
233
236
|
const keys = Object.keys(mod);
|
|
234
237
|
return keys.length > 0 ? keys.join(", ") : "(none)";
|
|
235
238
|
}
|
|
236
|
-
|
|
239
|
+
function resolveSelfSdkPackageDir() {
|
|
240
|
+
let currentDir = __dirname;
|
|
241
|
+
let reachedRoot = false;
|
|
242
|
+
while (!reachedRoot) {
|
|
243
|
+
const packageJsonPath = path.join(currentDir, "package.json");
|
|
244
|
+
try {
|
|
245
|
+
const pkg = JSON.parse((0, node_fs_1.readFileSync)(packageJsonPath, "utf8"));
|
|
246
|
+
if (pkg.name === "@a5c-ai/babysitter-sdk") {
|
|
247
|
+
return currentDir;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
// Keep walking upward.
|
|
252
|
+
}
|
|
253
|
+
const parentDir = path.dirname(currentDir);
|
|
254
|
+
reachedRoot = parentDir === currentDir;
|
|
255
|
+
if (!reachedRoot) {
|
|
256
|
+
currentDir = parentDir;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
throw new Error("Unable to resolve the current @a5c-ai/babysitter-sdk package root");
|
|
260
|
+
}
|
|
261
|
+
function defaultResolveSdkPackageDir() {
|
|
262
|
+
try {
|
|
263
|
+
return path.dirname(require.resolve(SDK_PACKAGE_SPECIFIER));
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
return resolveSelfSdkPackageDir();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
async function ensureProcessLocalSdkDependency(importPath, options = {}) {
|
|
270
|
+
const resolvedPath = path.isAbsolute(importPath) ? importPath : (0, resolveInputPath_1.resolveInputPath)(importPath);
|
|
271
|
+
const processDir = path.dirname(resolvedPath);
|
|
272
|
+
const processRequire = (options.createRequireFn ?? node_module_1.createRequire)(path.join(processDir, "__babysitter_process__.cjs"));
|
|
273
|
+
try {
|
|
274
|
+
processRequire.resolve(SDK_PACKAGE_SPECIFIER);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
// Fall through to a local fallback dependency.
|
|
279
|
+
}
|
|
280
|
+
const fsImpl = options.fsImpl ?? node_fs_1.promises;
|
|
281
|
+
const targetSdkDir = path.join(processDir, "node_modules", "@a5c-ai", "babysitter-sdk");
|
|
282
|
+
try {
|
|
283
|
+
await fsImpl.access(targetSdkDir);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
catch {
|
|
287
|
+
// Create below.
|
|
288
|
+
}
|
|
289
|
+
await fsImpl.mkdir(path.dirname(targetSdkDir), { recursive: true });
|
|
290
|
+
try {
|
|
291
|
+
await fsImpl.symlink((options.resolveSdkPackageDir ?? defaultResolveSdkPackageDir)(), targetSdkDir, process.platform === "win32" ? "junction" : "dir");
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
const code = error?.code;
|
|
295
|
+
if (code !== "EEXIST") {
|
|
296
|
+
throw error;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
async function validateProcessEntrypoint(importPath, exportName, options = {}) {
|
|
237
301
|
const resolvedPath = path.isAbsolute(importPath) ? importPath : (0, resolveInputPath_1.resolveInputPath)(importPath);
|
|
238
302
|
try {
|
|
239
303
|
await node_fs_1.promises.access(resolvedPath);
|
|
@@ -242,6 +306,12 @@ async function validateProcessEntrypoint(importPath, exportName) {
|
|
|
242
306
|
throw new Error(`Process entry file not found: ${resolvedPath}. ` +
|
|
243
307
|
`Ensure the path is correct and points to a valid JS/TS module.`);
|
|
244
308
|
}
|
|
309
|
+
try {
|
|
310
|
+
await ensureProcessLocalSdkDependency(resolvedPath, options);
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
throw new Error(`Failed to prepare project-local SDK dependency for ${resolvedPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
314
|
+
}
|
|
245
315
|
const moduleUrl = (0, node_url_1.pathToFileURL)(resolvedPath).href;
|
|
246
316
|
let mod;
|
|
247
317
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/cli/main/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/cli/main/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AA2I1D,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,UAAyB,GAAG,MAAM,CAa5F;AAED,eAAO,MAAM,WAAW,QAAqC,CAAC;AAC9D,eAAO,MAAM,WAAW,QAAqC,CAAC;AAC9D,eAAO,MAAM,KAAK,QAAc,CAAC"}
|
package/dist/cli/main/usage.js
CHANGED
|
@@ -4,49 +4,49 @@ exports.USAGE = exports.HUMAN_USAGE = exports.AGENT_USAGE = void 0;
|
|
|
4
4
|
exports.formatUsage = formatUsage;
|
|
5
5
|
const program_1 = require("./program");
|
|
6
6
|
function coreAgentUsage(commandName) {
|
|
7
|
-
return ` ${commandName} run:create --process-id <id> --entry <path#export> [--
|
|
8
|
-
${commandName} run:status <runDir> [--
|
|
9
|
-
${commandName} run:events <runDir> [--
|
|
10
|
-
${commandName} run:rebuild-state <runDir> [--
|
|
11
|
-
${commandName} run:repair-journal <runDir> [--
|
|
12
|
-
${commandName} run:iterate <runDir> [--
|
|
13
|
-
${commandName} task:post <runDir> <effectId> --status <ok|error> [--
|
|
14
|
-
${commandName} task:list <runDir> [--
|
|
15
|
-
${commandName} task:show <runDir> <effectId> [--
|
|
16
|
-
${commandName} skill:discover [--run-id <id>] [--cache-ttl <seconds>] [--
|
|
7
|
+
return ` ${commandName} run:create --process-id <id> --entry <path#export> [--inputs <file>] [--run-id <id>] [--process-revision <rev>] [--request <id>] [--prompt <text>] [--harness <name>] [--session-id <id>] [--non-interactive] [--json] [--dry-run]
|
|
8
|
+
${commandName} run:status <runDir> [--json]
|
|
9
|
+
${commandName} run:events <runDir> [--json] [--limit <n>] [--reverse] [--filter-type <type>]
|
|
10
|
+
${commandName} run:rebuild-state <runDir> [--json] [--dry-run]
|
|
11
|
+
${commandName} run:repair-journal <runDir> [--json] [--dry-run]
|
|
12
|
+
${commandName} run:iterate <runDir> [--json] [--verbose] [--iteration <n>]
|
|
13
|
+
${commandName} task:post <runDir> <effectId> --status <ok|error> [--json] [--dry-run] [--value <file>] [--value-inline <json>] [--error <file>] [--stdout-ref <ref>] [--stderr-ref <ref>] [--stdout-file <file>] [--stderr-file <file>] [--started-at <iso8601>] [--finished-at <iso8601>] [--metadata <file>] [--invocation-key <key>]
|
|
14
|
+
${commandName} task:list <runDir> [--pending] [--kind <kind>] [--json]
|
|
15
|
+
${commandName} task:show <runDir> <effectId> [--json]
|
|
16
|
+
${commandName} skill:discover [--run-id <id>] [--cache-ttl <seconds>] [--include-remote] [--summary-only] [--process-path <path>] [--json]
|
|
17
17
|
${commandName} session:init --session-id <id> --state-dir <dir> [--max-iterations <n>] [--run-id <id>] [--prompt <text>] [--json]
|
|
18
|
-
${commandName} session:associate --session-id <id> --state-dir <dir> --run-id <id> [--force] [--
|
|
19
|
-
${commandName} session:resume --session-id <id> [--state-dir <dir>] --run-id <id> [--max-iterations <n>] [--
|
|
18
|
+
${commandName} session:associate --session-id <id> --state-dir <dir> --run-id <id> [--force] [--json]
|
|
19
|
+
${commandName} session:resume --session-id <id> [--state-dir <dir>] --run-id <id> [--max-iterations <n>] [--json]
|
|
20
20
|
${commandName} session:state --session-id <id> --state-dir <dir> [--json]
|
|
21
21
|
${commandName} session:update --session-id <id> --state-dir <dir> [--iteration <n>] [--last-iteration-at <iso8601>] [--iteration-times <csv>] [--delete] [--json]
|
|
22
22
|
${commandName} session:check-iteration --session-id <id> --state-dir <dir> [--json]
|
|
23
23
|
${commandName} session:last-message --transcript-path <file> [--json]
|
|
24
|
-
${commandName} session:iteration-message --iteration <n> [--run-id <id>] [--
|
|
24
|
+
${commandName} session:iteration-message --iteration <n> [--run-id <id>] [--json]
|
|
25
25
|
${commandName} session:whoami [--harness <name>] [--json]
|
|
26
|
-
${commandName} session:cleanup [--harness <name>] [--dry-run] [--
|
|
26
|
+
${commandName} session:cleanup [--harness <name>] [--dry-run] [--json]
|
|
27
27
|
${commandName} process-library:active [--run-id <id>] [--session-id <id>] [--state-dir <dir>] [--json]
|
|
28
28
|
${commandName} profile:read --user|--project [--dir <dir>] [--json]
|
|
29
29
|
${commandName} profile:write --user|--project --input <file> [--dir <dir>] [--json]
|
|
30
30
|
${commandName} profile:merge --user|--project --input <file> [--dir <dir>] [--json]
|
|
31
31
|
${commandName} profile:render --user|--project [--dir <dir>] [--json]
|
|
32
|
-
${commandName} instructions:babysit-skill --harness <name> [--interactive|--no-interactive] [--json]
|
|
32
|
+
${commandName} instructions:babysit-skill [--harness <name>] [--interactive|--no-interactive] [--json]
|
|
33
33
|
${commandName} harness:install <name> [--workspace <dir>] [--json] [--dry-run] [--verbose]
|
|
34
34
|
${commandName} harness:install-plugin <name> [--workspace <dir>] [--json] [--dry-run] [--verbose]`;
|
|
35
35
|
}
|
|
36
36
|
function coreHumanUsage(commandName) {
|
|
37
37
|
return ` ${commandName} log --type <process|hook|cli> --message <msg> [--run-id <id>] [--label <label>] [--level <level>] [--source <src>] [--json]
|
|
38
38
|
${commandName} hook:log --hook-type <type> --log-file <path> [--json]
|
|
39
|
-
${commandName} hook:run --hook-type <stop|session-start|user-prompt-submit|pre-tool-use> [--harness <
|
|
39
|
+
${commandName} hook:run --hook-type <stop|session-end|session-start|user-prompt-submit|pre-tool-use> [--harness <name>] [--state-dir <dir>] [--json] [--verbose]
|
|
40
40
|
${commandName} session:init --session-id <id> --state-dir <dir> [--max-iterations <n>] [--run-id <id>] [--prompt <text>] [--json]
|
|
41
|
-
${commandName} session:associate --session-id <id> --state-dir <dir> --run-id <id> [--force] [--
|
|
42
|
-
${commandName} session:resume --session-id <id> [--state-dir <dir>] --run-id <id> [--max-iterations <n>] [--
|
|
41
|
+
${commandName} session:associate --session-id <id> --state-dir <dir> --run-id <id> [--force] [--json]
|
|
42
|
+
${commandName} session:resume --session-id <id> [--state-dir <dir>] --run-id <id> [--max-iterations <n>] [--json]
|
|
43
43
|
${commandName} session:state --session-id <id> --state-dir <dir> [--json]
|
|
44
44
|
${commandName} session:update --session-id <id> --state-dir <dir> [--iteration <n>] [--last-iteration-at <iso8601>] [--iteration-times <csv>] [--delete] [--json]
|
|
45
45
|
${commandName} session:check-iteration --session-id <id> --state-dir <dir> [--json]
|
|
46
46
|
${commandName} session:last-message --transcript-path <file> [--json]
|
|
47
|
-
${commandName} session:iteration-message --iteration <n> [--run-id <id>] [--
|
|
47
|
+
${commandName} session:iteration-message --iteration <n> [--run-id <id>] [--json]
|
|
48
48
|
${commandName} session:whoami [--harness <name>] [--json]
|
|
49
|
-
${commandName} session:cleanup [--harness <name>] [--dry-run] [--
|
|
49
|
+
${commandName} session:cleanup [--harness <name>] [--dry-run] [--json]
|
|
50
50
|
${commandName} compress-output <command and args...>
|
|
51
51
|
${commandName} skill:fetch-remote --source-type <github|well-known> --url <url> [--json]
|
|
52
52
|
${commandName} process-library:clone [--repo <url>] [--dir <path>] [--ref <ref>] [--state-dir <dir>] [--json]
|
|
@@ -62,21 +62,21 @@ function coreHumanUsage(commandName) {
|
|
|
62
62
|
${commandName} plugin:update-marketplace --marketplace-name <name> [--marketplace-branch <ref>] [--global|--project] [--json] [--verbose]
|
|
63
63
|
${commandName} plugin:update-registry [<pluginName>] [--plugin-name <name>] [--plugin-version <ver>] [--global|--project] [--json] [--verbose]
|
|
64
64
|
${commandName} plugin:remove-from-registry [<pluginName>] [--plugin-name <name>] [--global|--project] [--json] [--verbose]
|
|
65
|
-
${commandName} tokens:stats [runId] [--all] [--
|
|
65
|
+
${commandName} tokens:stats [runId] [--all] [--json]
|
|
66
66
|
${commandName} compression:status [--json]
|
|
67
67
|
${commandName} compression:toggle <layer> <on|off> [--json]
|
|
68
68
|
${commandName} compression:set <layer.key> <value> [--json]
|
|
69
69
|
${commandName} compression:reset [--json]
|
|
70
70
|
${commandName} harness:install <name> [--workspace <dir>] [--json] [--dry-run] [--verbose]
|
|
71
71
|
${commandName} harness:install-plugin <name> [--workspace <dir>] [--json] [--dry-run] [--verbose]
|
|
72
|
-
${commandName} instructions:process-create --harness <name> [--interactive|--no-interactive] [--json]
|
|
73
|
-
${commandName} instructions:orchestrate --harness <name> [--interactive|--no-interactive] [--json]
|
|
74
|
-
${commandName} instructions:breakpoint-handling --harness <name> [--interactive|--no-interactive] [--json]
|
|
72
|
+
${commandName} instructions:process-create [--harness <name>] [--interactive|--no-interactive] [--json]
|
|
73
|
+
${commandName} instructions:orchestrate [--harness <name>] [--interactive|--no-interactive] [--json]
|
|
74
|
+
${commandName} instructions:breakpoint-handling [--harness <name>] [--interactive|--no-interactive] [--json]
|
|
75
75
|
${commandName} breakpoint:approve-rule <pattern> [--action auto-approve|never-auto-approve] [--source <source>] [--note <note>] [--json]
|
|
76
76
|
${commandName} breakpoint:remove-rule <ruleId> [--json]
|
|
77
77
|
${commandName} breakpoint:list-rules [--json]
|
|
78
78
|
${commandName} breakpoint:should-auto-approve <breakpointId> [--tags <csv>] [--expert <expert>] [--json]
|
|
79
|
-
${commandName} breakpoint:history [--breakpoint-id <id>] [--
|
|
79
|
+
${commandName} breakpoint:history [--breakpoint-id <id>] [--limit <n>] [--json]
|
|
80
80
|
${commandName} health [--json] [--verbose]
|
|
81
81
|
${commandName} configure [show|validate|paths] [--json] [--defaults-only]
|
|
82
82
|
${commandName} version
|
|
@@ -86,32 +86,32 @@ Harness runtime commands are provided by the optional ${"@a5c-ai/babysitter-agen
|
|
|
86
86
|
babysitter-harness start-server [--transport <stdio|websocket>]`;
|
|
87
87
|
}
|
|
88
88
|
function harnessAgentUsage(commandName) {
|
|
89
|
-
return ` ${commandName} create-run [--prompt <text>] [--harness <name>] [--process <path>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--
|
|
90
|
-
${commandName} resume-run [--run-id <id>] [--
|
|
89
|
+
return ` ${commandName} create-run [--prompt <text>] [--harness <name>] [--process <path>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--interactive|--no-interactive|--non-interactive] [--json] [--verbose]
|
|
90
|
+
${commandName} resume-run [--run-id <id>] [--harness <name>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--interactive|--no-interactive] [--json] [--verbose]
|
|
91
91
|
${commandName} invoke <name> --prompt <text> [--workspace <dir>] [--model <model>] [--timeout <ms>] [--json]
|
|
92
92
|
${commandName} observe [--workspace <dir>] [--tui]
|
|
93
93
|
${commandName} tui [--run-id <id>] [--verbosity minimal|normal|verbose] [--workspace <dir>] [--json]
|
|
94
94
|
${commandName} discover [--json]`;
|
|
95
95
|
}
|
|
96
96
|
function harnessHumanUsage(commandName) {
|
|
97
|
-
return ` ${commandName} create-run [--prompt <text>] [--harness <name>] [--process <path>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--
|
|
97
|
+
return ` ${commandName} create-run [--prompt <text>] [--harness <name>] [--process <path>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--interactive|--no-interactive|--non-interactive] [--json] [--verbose]
|
|
98
98
|
${commandName} call [...] (alias for create-run)
|
|
99
99
|
${commandName} yolo [...] (alias for create-run --non-interactive)
|
|
100
100
|
${commandName} plan [...] (alias for create-run, stops after PhasePlanProcess)
|
|
101
101
|
${commandName} forever [...] (alias for create-run, infinite loop process)
|
|
102
|
-
${commandName} resume-run [--run-id <id>] [--
|
|
102
|
+
${commandName} resume-run [--run-id <id>] [--harness <name>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--interactive|--no-interactive] [--json] [--verbose]
|
|
103
103
|
${commandName} resume [...] (alias for resume-run)
|
|
104
|
-
${commandName} retrospect [--run-id <id>...] [--all] [--prompt <text>] [--harness <name>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--
|
|
105
|
-
${commandName} cleanup [--dry-run] [--keep-days <n>] [--prompt <text>] [--harness <name>] [--workspace <dir>] [--model <model>] [--
|
|
106
|
-
${commandName} assimilate [--prompt <text>] [--harness <name>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--
|
|
107
|
-
${commandName} doctor [--run-id <id>] [--
|
|
108
|
-
${commandName} contrib [--prompt <text>] [--harness <name>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--
|
|
104
|
+
${commandName} retrospect [--run-id <id>...] [--all] [--prompt <text>] [--harness <name>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--json] [--verbose]
|
|
105
|
+
${commandName} cleanup [--dry-run] [--keep-days <n>] [--prompt <text>] [--harness <name>] [--workspace <dir>] [--model <model>] [--json] [--verbose]
|
|
106
|
+
${commandName} assimilate [--prompt <text>] [--harness <name>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--json] [--verbose]
|
|
107
|
+
${commandName} doctor [--run-id <id>] [--json] [--verbose]
|
|
108
|
+
${commandName} contrib [--prompt <text>] [--harness <name>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--json] [--verbose]
|
|
109
109
|
${commandName} anycli --service <name> [--scope <scopes>] [--mcp] [--auth-file <path>] [--transport <type>] [--prompt <text>] [--workspace <dir>] [--json] [--verbose]
|
|
110
110
|
${commandName} session-history --session-id <id> --state-dir <dir> [--run-id <id>] [--json]
|
|
111
111
|
${commandName} help [<topic>]
|
|
112
112
|
${commandName} observe [--workspace <dir>] [--tui]
|
|
113
|
-
${commandName} user-install [--harness <name>] [--workspace <dir>] [--model <model>] [--
|
|
114
|
-
${commandName} project-install [--harness <name>] [--workspace <dir>] [--model <model>] [--
|
|
113
|
+
${commandName} user-install [--harness <name>] [--workspace <dir>] [--model <model>] [--json] [--verbose]
|
|
114
|
+
${commandName} project-install [--harness <name>] [--workspace <dir>] [--model <model>] [--json] [--verbose]
|
|
115
115
|
${commandName} discover [--json]
|
|
116
116
|
${commandName} list [--json]
|
|
117
117
|
${commandName} invoke <name> --prompt <text> [--workspace <dir>] [--model <model>] [--timeout <ms>] [--json]
|
|
@@ -123,14 +123,18 @@ Install or update harness CLIs and plugins with the main babysitter CLI:
|
|
|
123
123
|
babysitter harness:install-plugin <name>`;
|
|
124
124
|
}
|
|
125
125
|
const GLOBAL_FLAGS_USAGE = `Global flags:
|
|
126
|
-
--runs-dir <dir> Override the runs directory (
|
|
126
|
+
--runs-dir <dir> Override the runs directory (advanced compatibility flag).
|
|
127
127
|
--json Emit JSON output when supported by the command.
|
|
128
128
|
--dry-run Describe planned mutations without changing on-disk state.
|
|
129
129
|
--verbose Log resolved paths and options to stderr for debugging.
|
|
130
130
|
--show-config Show current configuration before executing command.
|
|
131
131
|
--help, -h Show agent-facing help text.
|
|
132
132
|
--help-human Show human-facing help text.
|
|
133
|
-
--version, -v Show CLI version
|
|
133
|
+
--version, -v Show CLI version.
|
|
134
|
+
|
|
135
|
+
Runs storage defaults:
|
|
136
|
+
global scope ~/.a5c/runs
|
|
137
|
+
repo scope <repo>/.a5c/runs (set BABYSITTER_RUNS_SCOPE=repo)`;
|
|
134
138
|
function formatUsage(surface, program = program_1.CORE_PROGRAM) {
|
|
135
139
|
const agentCommands = program.variant === "harness"
|
|
136
140
|
? harnessAgentUsage(program.commandName)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configValidation.d.ts","sourceRoot":"","sources":["../../src/config/configValidation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"configValidation.d.ts","sourceRoot":"","sources":["../../src/config/configValidation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAwCrF;;GAEG;AACH,wBAAgB,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAqCjF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,sBAAsB,CA+D/E;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAExD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAEjE"}
|
|
@@ -9,6 +9,7 @@ exports.validateConfig = validateConfig;
|
|
|
9
9
|
exports.getDefaults = getDefaults;
|
|
10
10
|
exports.isValidLogLevel = isValidLogLevel;
|
|
11
11
|
const defaults_1 = require("./defaults");
|
|
12
|
+
const runs_1 = require("./runs");
|
|
12
13
|
/**
|
|
13
14
|
* Valid log levels for validation
|
|
14
15
|
*/
|
|
@@ -51,7 +52,7 @@ function parseEnvLogLevel(value, fallback) {
|
|
|
51
52
|
function getConfig(overrides) {
|
|
52
53
|
const env = typeof process !== "undefined" ? process.env : {};
|
|
53
54
|
return {
|
|
54
|
-
runsDir: overrides?.runsDir ??
|
|
55
|
+
runsDir: overrides?.runsDir ?? (0, runs_1.resolveRunsDir)(),
|
|
55
56
|
maxIterations: overrides?.maxIterations ??
|
|
56
57
|
parseEnvPositiveInt(env[defaults_1.CONFIG_ENV_VARS.MAX_ITERATIONS], defaults_1.DEFAULTS.maxIterations),
|
|
57
58
|
qualityThreshold: overrides?.qualityThreshold ??
|
|
@@ -39,6 +39,7 @@ export interface ConfigValidationResult {
|
|
|
39
39
|
*/
|
|
40
40
|
export declare const CONFIG_ENV_VARS: {
|
|
41
41
|
readonly RUNS_DIR: "BABYSITTER_RUNS_DIR";
|
|
42
|
+
readonly RUNS_SCOPE: "BABYSITTER_RUNS_SCOPE";
|
|
42
43
|
readonly MAX_ITERATIONS: "BABYSITTER_MAX_ITERATIONS";
|
|
43
44
|
readonly QUALITY_THRESHOLD: "BABYSITTER_QUALITY_THRESHOLD";
|
|
44
45
|
readonly TIMEOUT: "BABYSITTER_TIMEOUT";
|
|
@@ -49,6 +50,7 @@ export declare const CONFIG_ENV_VARS: {
|
|
|
49
50
|
};
|
|
50
51
|
/** Default SDK configuration values; env vars and explicit overrides can replace them. */
|
|
51
52
|
export declare const DEFAULTS: Readonly<BabysitterConfig>;
|
|
53
|
+
export declare function getConfiguredGlobalStateRoot(): string;
|
|
52
54
|
/**
|
|
53
55
|
* Normalizes a session-state directory path.
|
|
54
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;CAUlB,CAAC;AAEX,0FAA0F;AAC1F,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,gBAAgB,CAatC,CAAC;AAEX,wBAAgB,4BAA4B,IAAI,MAAM,CAIrD;AASD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAYlE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAiBxC;AAGD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/config/defaults.js
CHANGED
|
@@ -41,6 +41,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
41
41
|
})();
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
43
|
exports.isValidLogLevel = exports.getDefaults = exports.validateConfig = exports.getConfig = exports.DEFAULTS = exports.CONFIG_ENV_VARS = void 0;
|
|
44
|
+
exports.getConfiguredGlobalStateRoot = getConfiguredGlobalStateRoot;
|
|
44
45
|
exports.normalizeSessionStateDir = normalizeSessionStateDir;
|
|
45
46
|
exports.getGlobalStateDir = getGlobalStateDir;
|
|
46
47
|
exports.getGlobalLogDir = getGlobalLogDir;
|
|
@@ -51,6 +52,7 @@ const os = __importStar(require("node:os"));
|
|
|
51
52
|
*/
|
|
52
53
|
exports.CONFIG_ENV_VARS = {
|
|
53
54
|
RUNS_DIR: "BABYSITTER_RUNS_DIR",
|
|
55
|
+
RUNS_SCOPE: "BABYSITTER_RUNS_SCOPE",
|
|
54
56
|
MAX_ITERATIONS: "BABYSITTER_MAX_ITERATIONS",
|
|
55
57
|
QUALITY_THRESHOLD: "BABYSITTER_QUALITY_THRESHOLD",
|
|
56
58
|
TIMEOUT: "BABYSITTER_TIMEOUT",
|
|
@@ -61,7 +63,7 @@ exports.CONFIG_ENV_VARS = {
|
|
|
61
63
|
};
|
|
62
64
|
/** Default SDK configuration values; env vars and explicit overrides can replace them. */
|
|
63
65
|
exports.DEFAULTS = {
|
|
64
|
-
runsDir: "
|
|
66
|
+
runsDir: path.join(getConfiguredGlobalStateRoot(), "runs"),
|
|
65
67
|
maxIterations: 256,
|
|
66
68
|
qualityThreshold: 80,
|
|
67
69
|
timeout: 120000,
|
package/dist/config/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* import { DEFAULTS, getConfig, validateConfig } from "@a5c-ai/babysitter-sdk/config";
|
|
10
10
|
*
|
|
11
11
|
* // Use defaults directly
|
|
12
|
-
* console.log(DEFAULTS.runsDir); // "
|
|
12
|
+
* console.log(DEFAULTS.runsDir); // "/home/alice/.a5c/runs"
|
|
13
13
|
*
|
|
14
14
|
* // Get merged config with env overrides
|
|
15
15
|
* const config = getConfig({ maxIterations: 500 });
|
|
@@ -21,5 +21,6 @@
|
|
|
21
21
|
* }
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
export { type LogLevel, type BabysitterConfig, type ConfigValidationResult, DEFAULTS, CONFIG_ENV_VARS, getConfig, getGlobalLogDir, getGlobalStateDir, normalizeSessionStateDir, validateConfig, getDefaults, isValidLogLevel, } from "./defaults";
|
|
24
|
+
export { type LogLevel, type BabysitterConfig, type ConfigValidationResult, DEFAULTS, CONFIG_ENV_VARS, getConfig, getGlobalLogDir, getGlobalStateDir, getConfiguredGlobalStateRoot, normalizeSessionStateDir, validateConfig, getDefaults, isValidLogLevel, } from "./defaults";
|
|
25
|
+
export { type RunsScope, findRepoRoot, getGlobalRunsDir, getReadableRunsDirs, getRepoRoot, getRepoRunsDir, getRunsScope, parseRunsScope, resolveExistingRunDir, resolveProjectRootForRun, resolveRunRootFromRunDir, resolveRunsDir, } from "./runs";
|
|
25
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAG3B,QAAQ,EACR,eAAe,EAGf,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACd,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAG3B,QAAQ,EACR,eAAe,EAGf,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,EACxB,cAAc,EACd,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,SAAS,EACd,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,cAAc,GACf,MAAM,QAAQ,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* import { DEFAULTS, getConfig, validateConfig } from "@a5c-ai/babysitter-sdk/config";
|
|
11
11
|
*
|
|
12
12
|
* // Use defaults directly
|
|
13
|
-
* console.log(DEFAULTS.runsDir); // "
|
|
13
|
+
* console.log(DEFAULTS.runsDir); // "/home/alice/.a5c/runs"
|
|
14
14
|
*
|
|
15
15
|
* // Get merged config with env overrides
|
|
16
16
|
* const config = getConfig({ maxIterations: 500 });
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.isValidLogLevel = exports.getDefaults = exports.validateConfig = exports.normalizeSessionStateDir = exports.getGlobalStateDir = exports.getGlobalLogDir = exports.getConfig = exports.CONFIG_ENV_VARS = exports.DEFAULTS = void 0;
|
|
26
|
+
exports.resolveRunsDir = exports.resolveRunRootFromRunDir = exports.resolveProjectRootForRun = exports.resolveExistingRunDir = exports.parseRunsScope = exports.getRunsScope = exports.getRepoRunsDir = exports.getRepoRoot = exports.getReadableRunsDirs = exports.getGlobalRunsDir = exports.findRepoRoot = exports.isValidLogLevel = exports.getDefaults = exports.validateConfig = exports.normalizeSessionStateDir = exports.getConfiguredGlobalStateRoot = exports.getGlobalStateDir = exports.getGlobalLogDir = exports.getConfig = exports.CONFIG_ENV_VARS = exports.DEFAULTS = void 0;
|
|
27
27
|
var defaults_1 = require("./defaults");
|
|
28
28
|
// Constants
|
|
29
29
|
Object.defineProperty(exports, "DEFAULTS", { enumerable: true, get: function () { return defaults_1.DEFAULTS; } });
|
|
@@ -32,7 +32,20 @@ Object.defineProperty(exports, "CONFIG_ENV_VARS", { enumerable: true, get: funct
|
|
|
32
32
|
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return defaults_1.getConfig; } });
|
|
33
33
|
Object.defineProperty(exports, "getGlobalLogDir", { enumerable: true, get: function () { return defaults_1.getGlobalLogDir; } });
|
|
34
34
|
Object.defineProperty(exports, "getGlobalStateDir", { enumerable: true, get: function () { return defaults_1.getGlobalStateDir; } });
|
|
35
|
+
Object.defineProperty(exports, "getConfiguredGlobalStateRoot", { enumerable: true, get: function () { return defaults_1.getConfiguredGlobalStateRoot; } });
|
|
35
36
|
Object.defineProperty(exports, "normalizeSessionStateDir", { enumerable: true, get: function () { return defaults_1.normalizeSessionStateDir; } });
|
|
36
37
|
Object.defineProperty(exports, "validateConfig", { enumerable: true, get: function () { return defaults_1.validateConfig; } });
|
|
37
38
|
Object.defineProperty(exports, "getDefaults", { enumerable: true, get: function () { return defaults_1.getDefaults; } });
|
|
38
39
|
Object.defineProperty(exports, "isValidLogLevel", { enumerable: true, get: function () { return defaults_1.isValidLogLevel; } });
|
|
40
|
+
var runs_1 = require("./runs");
|
|
41
|
+
Object.defineProperty(exports, "findRepoRoot", { enumerable: true, get: function () { return runs_1.findRepoRoot; } });
|
|
42
|
+
Object.defineProperty(exports, "getGlobalRunsDir", { enumerable: true, get: function () { return runs_1.getGlobalRunsDir; } });
|
|
43
|
+
Object.defineProperty(exports, "getReadableRunsDirs", { enumerable: true, get: function () { return runs_1.getReadableRunsDirs; } });
|
|
44
|
+
Object.defineProperty(exports, "getRepoRoot", { enumerable: true, get: function () { return runs_1.getRepoRoot; } });
|
|
45
|
+
Object.defineProperty(exports, "getRepoRunsDir", { enumerable: true, get: function () { return runs_1.getRepoRunsDir; } });
|
|
46
|
+
Object.defineProperty(exports, "getRunsScope", { enumerable: true, get: function () { return runs_1.getRunsScope; } });
|
|
47
|
+
Object.defineProperty(exports, "parseRunsScope", { enumerable: true, get: function () { return runs_1.parseRunsScope; } });
|
|
48
|
+
Object.defineProperty(exports, "resolveExistingRunDir", { enumerable: true, get: function () { return runs_1.resolveExistingRunDir; } });
|
|
49
|
+
Object.defineProperty(exports, "resolveProjectRootForRun", { enumerable: true, get: function () { return runs_1.resolveProjectRootForRun; } });
|
|
50
|
+
Object.defineProperty(exports, "resolveRunRootFromRunDir", { enumerable: true, get: function () { return runs_1.resolveRunRootFromRunDir; } });
|
|
51
|
+
Object.defineProperty(exports, "resolveRunsDir", { enumerable: true, get: function () { return runs_1.resolveRunsDir; } });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type RunsScope = "global" | "repo";
|
|
2
|
+
export declare function parseRunsScope(rawValue?: string): RunsScope;
|
|
3
|
+
export declare function getRunsScope(): RunsScope;
|
|
4
|
+
export declare function findRepoRoot(startDir?: string): string | undefined;
|
|
5
|
+
export declare function getRepoRoot(startDir?: string): string;
|
|
6
|
+
export declare function getRepoRunsDir(startDir?: string): string;
|
|
7
|
+
export declare function getGlobalRunsDir(): string;
|
|
8
|
+
export declare function resolveRunsDir(options?: {
|
|
9
|
+
cwd?: string;
|
|
10
|
+
override?: string;
|
|
11
|
+
}): string;
|
|
12
|
+
export declare function getReadableRunsDirs(options?: {
|
|
13
|
+
cwd?: string;
|
|
14
|
+
override?: string;
|
|
15
|
+
}): string[];
|
|
16
|
+
export declare function resolveExistingRunDir(runRef: string, options?: {
|
|
17
|
+
cwd?: string;
|
|
18
|
+
override?: string;
|
|
19
|
+
}): string;
|
|
20
|
+
export declare function resolveRunRootFromRunDir(runDir: string, cwd?: string): string;
|
|
21
|
+
export declare function resolveProjectRootForRun(runDir: string, entryImportPath?: string, fallbackCwd?: string): string;
|
|
22
|
+
//# sourceMappingURL=runs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/config/runs.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AA6B1C,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAiB3D;AAED,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED,wBAAgB,YAAY,CAAC,QAAQ,SAAgB,GAAG,MAAM,GAAG,SAAS,CAgBzE;AAED,wBAAgB,WAAW,CAAC,QAAQ,SAAgB,GAAG,MAAM,CAE5D;AAED,wBAAgB,cAAc,CAAC,QAAQ,SAAgB,GAAG,MAAM,CAE/D;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAQD,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAYT;AAED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,EAAE,CAKX;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACA,MAAM,CA8BR;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAgB,GAAG,MAAM,CASpF;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,EACxB,WAAW,SAAgB,GAC1B,MAAM,CAeR"}
|
|
@@ -0,0 +1,192 @@
|
|
|
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.parseRunsScope = parseRunsScope;
|
|
37
|
+
exports.getRunsScope = getRunsScope;
|
|
38
|
+
exports.findRepoRoot = findRepoRoot;
|
|
39
|
+
exports.getRepoRoot = getRepoRoot;
|
|
40
|
+
exports.getRepoRunsDir = getRepoRunsDir;
|
|
41
|
+
exports.getGlobalRunsDir = getGlobalRunsDir;
|
|
42
|
+
exports.resolveRunsDir = resolveRunsDir;
|
|
43
|
+
exports.getReadableRunsDirs = getReadableRunsDirs;
|
|
44
|
+
exports.resolveExistingRunDir = resolveExistingRunDir;
|
|
45
|
+
exports.resolveRunRootFromRunDir = resolveRunRootFromRunDir;
|
|
46
|
+
exports.resolveProjectRootForRun = resolveProjectRootForRun;
|
|
47
|
+
const fs = __importStar(require("node:fs"));
|
|
48
|
+
const path = __importStar(require("node:path"));
|
|
49
|
+
const defaults_1 = require("./defaults");
|
|
50
|
+
function normalizeComparablePath(value) {
|
|
51
|
+
const normalized = path.normalize(path.resolve(value));
|
|
52
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
53
|
+
}
|
|
54
|
+
function dedupePaths(values) {
|
|
55
|
+
const seen = new Set();
|
|
56
|
+
const result = [];
|
|
57
|
+
for (const value of values) {
|
|
58
|
+
const comparable = normalizeComparablePath(value);
|
|
59
|
+
if (seen.has(comparable)) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
seen.add(comparable);
|
|
63
|
+
result.push(path.resolve(value));
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
function isPresentPath(target) {
|
|
68
|
+
try {
|
|
69
|
+
return fs.existsSync(target);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function parseRunsScope(rawValue) {
|
|
76
|
+
const normalized = rawValue?.trim().toLowerCase();
|
|
77
|
+
switch (normalized) {
|
|
78
|
+
case "repo":
|
|
79
|
+
case "project":
|
|
80
|
+
case "root":
|
|
81
|
+
case "local":
|
|
82
|
+
return "repo";
|
|
83
|
+
case "global":
|
|
84
|
+
case "home":
|
|
85
|
+
case "user":
|
|
86
|
+
case undefined:
|
|
87
|
+
case "":
|
|
88
|
+
return "global";
|
|
89
|
+
default:
|
|
90
|
+
return "global";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function getRunsScope() {
|
|
94
|
+
return parseRunsScope(process.env[defaults_1.CONFIG_ENV_VARS.RUNS_SCOPE]);
|
|
95
|
+
}
|
|
96
|
+
function findRepoRoot(startDir = process.cwd()) {
|
|
97
|
+
let current = path.resolve(startDir);
|
|
98
|
+
let reachedRoot = false;
|
|
99
|
+
while (!reachedRoot) {
|
|
100
|
+
if (isPresentPath(path.join(current, ".git")) || isPresentPath(path.join(current, ".a5c"))) {
|
|
101
|
+
return current;
|
|
102
|
+
}
|
|
103
|
+
const parent = path.dirname(current);
|
|
104
|
+
if (parent === current) {
|
|
105
|
+
reachedRoot = true;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
current = parent;
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
function getRepoRoot(startDir = process.cwd()) {
|
|
113
|
+
return findRepoRoot(startDir) ?? path.resolve(startDir);
|
|
114
|
+
}
|
|
115
|
+
function getRepoRunsDir(startDir = process.cwd()) {
|
|
116
|
+
return path.join(getRepoRoot(startDir), ".a5c", "runs");
|
|
117
|
+
}
|
|
118
|
+
function getGlobalRunsDir() {
|
|
119
|
+
return path.join((0, defaults_1.getConfiguredGlobalStateRoot)(), "runs");
|
|
120
|
+
}
|
|
121
|
+
function resolveRelativeRunsDir(value, cwd) {
|
|
122
|
+
const scope = getRunsScope();
|
|
123
|
+
const baseDir = scope === "repo" ? getRepoRoot(cwd) : (0, defaults_1.getConfiguredGlobalStateRoot)();
|
|
124
|
+
return path.resolve(baseDir, value);
|
|
125
|
+
}
|
|
126
|
+
function resolveRunsDir(options) {
|
|
127
|
+
const cwd = options?.cwd ?? process.cwd();
|
|
128
|
+
const explicit = options?.override?.trim() || process.env[defaults_1.CONFIG_ENV_VARS.RUNS_DIR]?.trim();
|
|
129
|
+
if (explicit) {
|
|
130
|
+
return path.isAbsolute(explicit)
|
|
131
|
+
? path.resolve(explicit)
|
|
132
|
+
: resolveRelativeRunsDir(explicit, cwd);
|
|
133
|
+
}
|
|
134
|
+
return getRunsScope() === "repo"
|
|
135
|
+
? getRepoRunsDir(cwd)
|
|
136
|
+
: getGlobalRunsDir();
|
|
137
|
+
}
|
|
138
|
+
function getReadableRunsDirs(options) {
|
|
139
|
+
const cwd = options?.cwd ?? process.cwd();
|
|
140
|
+
const primary = resolveRunsDir({ cwd, override: options?.override });
|
|
141
|
+
const legacyRepo = getRepoRunsDir(cwd);
|
|
142
|
+
return dedupePaths([primary, legacyRepo]);
|
|
143
|
+
}
|
|
144
|
+
function resolveExistingRunDir(runRef, options) {
|
|
145
|
+
const cwd = options?.cwd ?? process.cwd();
|
|
146
|
+
const readableRoots = getReadableRunsDirs({ cwd, override: options?.override });
|
|
147
|
+
const repoRoot = getRepoRoot(cwd);
|
|
148
|
+
if (path.isAbsolute(runRef)) {
|
|
149
|
+
return path.resolve(runRef);
|
|
150
|
+
}
|
|
151
|
+
const normalizedRef = runRef.replace(/\\/g, "/");
|
|
152
|
+
const looksLikePath = normalizedRef.includes("/") ||
|
|
153
|
+
normalizedRef.includes(".a5c/") ||
|
|
154
|
+
normalizedRef === "." ||
|
|
155
|
+
normalizedRef === "..";
|
|
156
|
+
const candidates = looksLikePath
|
|
157
|
+
? dedupePaths([
|
|
158
|
+
path.resolve(cwd, runRef),
|
|
159
|
+
path.resolve(repoRoot, runRef),
|
|
160
|
+
])
|
|
161
|
+
: readableRoots.map((root) => path.join(root, runRef));
|
|
162
|
+
for (const candidate of candidates) {
|
|
163
|
+
if (isPresentPath(path.join(candidate, "run.json"))) {
|
|
164
|
+
return candidate;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return candidates[0];
|
|
168
|
+
}
|
|
169
|
+
function resolveRunRootFromRunDir(runDir, cwd = process.cwd()) {
|
|
170
|
+
const absoluteRunDir = path.resolve(runDir);
|
|
171
|
+
for (const candidateRoot of getReadableRunsDirs({ cwd })) {
|
|
172
|
+
const relative = path.relative(candidateRoot, absoluteRunDir);
|
|
173
|
+
if (!relative.startsWith("..") && !path.isAbsolute(relative)) {
|
|
174
|
+
return candidateRoot;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return path.dirname(absoluteRunDir);
|
|
178
|
+
}
|
|
179
|
+
function resolveProjectRootForRun(runDir, entryImportPath, fallbackCwd = process.cwd()) {
|
|
180
|
+
if (entryImportPath?.trim()) {
|
|
181
|
+
const absoluteEntrypoint = path.resolve(runDir, entryImportPath);
|
|
182
|
+
const repoRoot = findRepoRoot(path.dirname(absoluteEntrypoint));
|
|
183
|
+
if (repoRoot) {
|
|
184
|
+
return repoRoot;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const cwdRepoRoot = findRepoRoot(fallbackCwd);
|
|
188
|
+
if (cwdRepoRoot) {
|
|
189
|
+
return cwdRepoRoot;
|
|
190
|
+
}
|
|
191
|
+
return path.dirname(resolveRunRootFromRunDir(runDir, fallbackCwd));
|
|
192
|
+
}
|