@a5c-ai/genty-platform 5.1.1-staging.ab08a86fa136 → 5.1.1-staging.b362bbfbd41b
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/dist/harness/extensionToolBridge.d.ts +9 -11
- package/dist/harness/extensionToolBridge.d.ts.map +1 -1
- package/dist/harness/extensionToolBridge.js +26 -1
- package/dist/harness/internal/createRun/agent-core-loop.d.ts +2 -1
- package/dist/harness/internal/createRun/agent-core-loop.d.ts.map +1 -1
- package/dist/harness/internal/createRun/index.d.ts.map +1 -1
- package/dist/harness/internal/createRun/index.js +33 -2
- package/dist/harness/internal/createRun/orchestration/constants.d.ts +1 -0
- package/dist/harness/internal/createRun/orchestration/constants.d.ts.map +1 -1
- package/dist/harness/internal/createRun/orchestration/constants.js +6 -1
- package/dist/harness/internal/createRun/orchestration/dispatch.d.ts.map +1 -1
- package/dist/harness/internal/createRun/orchestration/dispatch.js +7 -0
- package/dist/harness/internal/createRun/orchestration/effects.d.ts.map +1 -1
- package/dist/harness/internal/createRun/orchestration/effects.js +16 -1
- package/dist/harness/internal/createRun/orchestration/externalPhase.d.ts.map +1 -1
- package/dist/harness/internal/createRun/orchestration/externalPhase.js +2 -2
- package/dist/harness/internal/createRun/orchestration/index.d.ts +21 -1
- package/dist/harness/internal/createRun/orchestration/index.d.ts.map +1 -1
- package/dist/harness/internal/createRun/orchestration/index.js +148 -13
- package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts +19 -0
- package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts.map +1 -1
- package/dist/harness/internal/createRun/orchestration/internalPhase.js +139 -8
- package/dist/harness/internal/createRun/orchestration/internalTools.d.ts +2 -1
- package/dist/harness/internal/createRun/orchestration/internalTools.d.ts.map +1 -1
- package/dist/harness/internal/createRun/orchestration/internalTools.js +2 -2
- package/dist/harness/internal/createRun/planProcess/agentOutput.d.ts.map +1 -1
- package/dist/harness/internal/createRun/planProcess/agentOutput.js +58 -10
- package/dist/harness/internal/createRun/planProcess/delegation.d.ts +11 -1
- package/dist/harness/internal/createRun/planProcess/delegation.d.ts.map +1 -1
- package/dist/harness/internal/createRun/planProcess/delegation.js +28 -2
- package/dist/harness/internal/createRun/planProcess/external.d.ts.map +1 -1
- package/dist/harness/internal/createRun/planProcess/external.js +2 -1
- package/dist/harness/internal/createRun/planProcess/phase.d.ts.map +1 -1
- package/dist/harness/internal/createRun/planProcess/phase.js +22 -73
- package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts +8 -1
- package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts.map +1 -1
- package/dist/harness/internal/createRun/planProcess/phaseHelpers.js +3 -1
- package/dist/harness/internal/createRun/prompts.d.ts +17 -0
- package/dist/harness/internal/createRun/prompts.d.ts.map +1 -1
- package/dist/harness/internal/createRun/prompts.js +37 -0
- package/dist/harness/internal/createRun/utils.d.ts +12 -1
- package/dist/harness/internal/createRun/utils.d.ts.map +1 -1
- package/dist/harness/internal/createRun/utils.js +18 -0
- package/dist/harness/types.d.ts +14 -3
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/orchestration/defaultOrchestrationProvider.d.ts.map +1 -1
- package/dist/orchestration/defaultOrchestrationProvider.js +96 -4
- package/package.json +8 -9
- package/dist/harness/piSecureSandbox.d.ts +0 -8
- package/dist/harness/piSecureSandbox.d.ts.map +0 -1
- package/dist/harness/piSecureSandbox.js +0 -366
- package/dist/harness/piSecureSandboxTypes.d.ts +0 -51
- package/dist/harness/piSecureSandboxTypes.d.ts.map +0 -1
- package/dist/harness/piSecureSandboxTypes.js +0 -6
- package/dist/harness/piWrapper/compaction.d.ts +0 -13
- package/dist/harness/piWrapper/compaction.d.ts.map +0 -1
- package/dist/harness/piWrapper/compaction.js +0 -39
- package/dist/harness/piWrapper/instructionPrompts.d.ts +0 -2
- package/dist/harness/piWrapper/instructionPrompts.d.ts.map +0 -1
- package/dist/harness/piWrapper/instructionPrompts.js +0 -97
- package/dist/harness/piWrapper/moduleSupport.d.ts +0 -78
- package/dist/harness/piWrapper/moduleSupport.d.ts.map +0 -1
- package/dist/harness/piWrapper/moduleSupport.js +0 -207
- package/dist/harness/piWrapper.d.ts +0 -82
- package/dist/harness/piWrapper.d.ts.map +0 -1
- package/dist/harness/piWrapper.js +0 -406
|
@@ -1,13 +1,11 @@
|
|
|
1
|
+
import type { CustomToolDefinition } from "@a5c-ai/genty-core";
|
|
1
2
|
import type { ExtensionRegistry } from '@a5c-ai/genty-core/extensions';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}>;
|
|
11
|
-
}
|
|
12
|
-
export declare function bridgeExtensionTools(registry: ExtensionRegistry): BridgedToolDefinition[];
|
|
3
|
+
/**
|
|
4
|
+
* Bridges extension-registered tools into genty-core {@link CustomToolDefinition}s
|
|
5
|
+
* so they flow through the agent-core tool-calling loop alongside built-in
|
|
6
|
+
* custom tools. Extension tools expose a loose `inputSchema`
|
|
7
|
+
* (`Record<string, unknown>`); we coerce it into a permissive TypeBox object so
|
|
8
|
+
* the unified tool surface has a concrete parameter schema.
|
|
9
|
+
*/
|
|
10
|
+
export declare function bridgeExtensionTools(registry: ExtensionRegistry): CustomToolDefinition[];
|
|
13
11
|
//# sourceMappingURL=extensionToolBridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionToolBridge.d.ts","sourceRoot":"","sources":["../../src/harness/extensionToolBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"extensionToolBridge.d.ts","sourceRoot":"","sources":["../../src/harness/extensionToolBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAc,MAAM,oBAAoB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,oBAAoB,EAAE,CAuBxF"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bridgeExtensionTools = bridgeExtensionTools;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
/**
|
|
6
|
+
* Bridges extension-registered tools into genty-core {@link CustomToolDefinition}s
|
|
7
|
+
* so they flow through the agent-core tool-calling loop alongside built-in
|
|
8
|
+
* custom tools. Extension tools expose a loose `inputSchema`
|
|
9
|
+
* (`Record<string, unknown>`); we coerce it into a permissive TypeBox object so
|
|
10
|
+
* the unified tool surface has a concrete parameter schema.
|
|
11
|
+
*/
|
|
4
12
|
function bridgeExtensionTools(registry) {
|
|
5
13
|
return registry.getAllTools().map((extTool) => ({
|
|
6
14
|
name: extTool.name,
|
|
15
|
+
label: extTool.name,
|
|
7
16
|
description: extTool.description,
|
|
8
|
-
|
|
17
|
+
parameters: toToolParameters(extTool.inputSchema),
|
|
18
|
+
execute: async (_toolCallId, params) => {
|
|
9
19
|
try {
|
|
10
20
|
const result = await extTool.handler(params);
|
|
11
21
|
return {
|
|
@@ -21,3 +31,18 @@ function bridgeExtensionTools(registry) {
|
|
|
21
31
|
},
|
|
22
32
|
}));
|
|
23
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Coerce an extension tool's loose JSON-schema-ish `inputSchema` into a TypeBox
|
|
36
|
+
* `TObject`. Extension schemas are already JSON Schema fragments, so we wrap
|
|
37
|
+
* them in a permissive object that carries the original schema's `properties`
|
|
38
|
+
* when present and otherwise accepts arbitrary properties.
|
|
39
|
+
*/
|
|
40
|
+
function toToolParameters(inputSchema) {
|
|
41
|
+
const properties = inputSchema && typeof inputSchema === 'object' && inputSchema.type === 'object'
|
|
42
|
+
? inputSchema.properties
|
|
43
|
+
: undefined;
|
|
44
|
+
if (properties) {
|
|
45
|
+
return typebox_1.Type.Object(properties, { additionalProperties: true });
|
|
46
|
+
}
|
|
47
|
+
return typebox_1.Type.Object({}, { additionalProperties: true });
|
|
48
|
+
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* agent-core concerns, not Pi-specific.
|
|
9
9
|
*/
|
|
10
10
|
import type { EffectAction } from "../../../types";
|
|
11
|
+
import type { CustomToolDefinition } from "@a5c-ai/genty-core";
|
|
11
12
|
import type { AgentCorePromptResult, AgentCoreSessionOptions } from "../../types";
|
|
12
13
|
import type { DelegationConfig } from "./utils";
|
|
13
14
|
export declare const TRANSIENT_PROMPT_RETRY_DELAYS_MS: number[];
|
|
@@ -35,7 +36,7 @@ export declare function buildWorkerSessionOptions(args: {
|
|
|
35
36
|
action: EffectAction;
|
|
36
37
|
workspace?: string;
|
|
37
38
|
model?: string;
|
|
38
|
-
customTools?:
|
|
39
|
+
customTools?: CustomToolDefinition[];
|
|
39
40
|
delegationConfig?: DelegationConfig;
|
|
40
41
|
}): AgentCoreSessionOptions;
|
|
41
42
|
export declare function resolveAgentCoreBackendForHarness(harnessName?: string): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-core-loop.d.ts","sourceRoot":"","sources":["../../../../src/harness/internal/createRun/agent-core-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAMhD,eAAO,MAAM,gCAAgC,UAE3B,CAAC;AAEnB,eAAO,MAAM,wBAAwB,SAAU,CAAC;AAChD,eAAO,MAAM,yBAAyB,SAAU,CAAC;AACjD,eAAO,MAAM,iBAAiB,UAAY,CAAC;AAM3C,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,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,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/harness/internal/createRun/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,oBAAoB,EAc1B,MAAM,SAAS,CAAC;AAYjB,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,mDAAmD;AACnD,YAAY,EAAE,oBAAoB,IAAI,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAwJjB;AA4BD,qDAAqD;AACrD,eAAO,MAAM,mBAAmB,+BAAyB,CAAC"}
|
|
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.handleSessionCreate = exports.runOrchestrationPhase = exports.selectHarness = void 0;
|
|
19
19
|
exports.handleHarnessCreateRun = handleHarnessCreateRun;
|
|
20
20
|
const utils_1 = require("./utils");
|
|
21
|
-
// SDK-owned: adapter lookup
|
|
21
|
+
// SDK-owned: adapter lookup is harness infrastructure
|
|
22
22
|
const babysitter_sdk_1 = require("@a5c-ai/babysitter-sdk");
|
|
23
23
|
const defaults_1 = require("../../../utils/defaults");
|
|
24
24
|
const planProcess_1 = require("./planProcess");
|
|
@@ -31,8 +31,39 @@ var orchestration_2 = require("./orchestration");
|
|
|
31
31
|
Object.defineProperty(exports, "runOrchestrationPhase", { enumerable: true, get: function () { return orchestration_2.runOrchestrationPhase; } });
|
|
32
32
|
// ── Main Entry Point ─────────────────────────────────────────────────
|
|
33
33
|
async function handleHarnessCreateRun(parsed) {
|
|
34
|
+
// #949: genty IS the execution harness when run standalone via this
|
|
35
|
+
// autonomous entrypoint. The BABYSITTER_EXECUTE_TASKS / BABYSITTER_CROSS_SUBAGENTS
|
|
36
|
+
// gates default OFF (emit-only) for plugin/host contexts, but genty's own
|
|
37
|
+
// autonomous runtime MUST auto-execute shell/node and dispatch agents. Opt the
|
|
38
|
+
// flags ON here (without clobbering an explicit caller override) so standalone
|
|
39
|
+
// genty behaves exactly as before. This is the seam that keeps genty-autonomous
|
|
40
|
+
// tests green.
|
|
41
|
+
process.env.BABYSITTER_EXECUTE_TASKS ??= "1";
|
|
42
|
+
process.env.BABYSITTER_CROSS_SUBAGENTS ??= "1";
|
|
34
43
|
const { prompt: initialPrompt, harness: preferredHarness, processPath: providedProcessPath, workspace, model, maxIterations = defaults_1.ORCHESTRATION_DEFAULTS.maxIterations, runsDir: requestedRunsDir, json, verbose, } = parsed;
|
|
35
|
-
|
|
44
|
+
// Bug #936: when no explicit --runs-dir is given, resolveRunsDir() defaults to
|
|
45
|
+
// the GLOBAL ~/.a5c/runs (scope=global), so a plain `genty call` materializes
|
|
46
|
+
// the run — and its completion proof — outside <workspace>/.a5c/runs where the
|
|
47
|
+
// live-stack validator (and users) look. resolveWorkspaceRunsDir defaults to
|
|
48
|
+
// the workspace repo runs dir instead, while still honoring an explicit
|
|
49
|
+
// runsDir or a BABYSITTER_RUNS_DIR / repo-scope override. This is the single
|
|
50
|
+
// source of truth threaded into BOTH the plan-process phase (parent run
|
|
51
|
+
// creation) and the orchestration phase.
|
|
52
|
+
const runsDir = (0, orchestration_1.resolveWorkspaceRunsDir)(requestedRunsDir, workspace ?? process.cwd());
|
|
53
|
+
// Bug #936 (residual): the resolved runsDir is threaded as a param into the
|
|
54
|
+
// plan-process and orchestration phases, but the SDK's run creation (and any
|
|
55
|
+
// NESTED run it spawns) ultimately resolves its location from BABYSITTER_RUNS_DIR
|
|
56
|
+
// / resolveRunsDir() — the param did not reliably reach every createRun seam, so
|
|
57
|
+
// a plain `genty call/yolo` still materialized the run in the GLOBAL ~/.a5c/runs
|
|
58
|
+
// and the live-stack validator (which checks <workspace>/.a5c/runs) reported
|
|
59
|
+
// "no .a5c/runs/ directory found" despite authoring+execution+file-creation all
|
|
60
|
+
// passing. Pin BABYSITTER_RUNS_DIR to the resolved workspace runs dir so ALL run
|
|
61
|
+
// creation (parent + nested + the in-process orchestration) lands where the
|
|
62
|
+
// validator and users look. An explicit external override is respected (only set
|
|
63
|
+
// when unset).
|
|
64
|
+
if (!process.env.BABYSITTER_RUNS_DIR?.trim()) {
|
|
65
|
+
process.env.BABYSITTER_RUNS_DIR = runsDir;
|
|
66
|
+
}
|
|
36
67
|
const mode = (0, utils_1.resolveOutputMode)(json, parsed.outputMode);
|
|
37
68
|
const interactive = parsed.interactive ?? (mode === "cli" && process.stdin.isTTY === true);
|
|
38
69
|
// TUI and adapters-events modes: never create a readline interface
|
|
@@ -3,5 +3,6 @@ export declare const MAX_CONSECUTIVE_TIMEOUTS = 3;
|
|
|
3
3
|
export declare const MAX_CONSECUTIVE_STALLS = 5;
|
|
4
4
|
export declare const MAX_CONSECUTIVE_PROCESS_ERROR_STALLS = 5;
|
|
5
5
|
export declare const MAX_PROCESS_ERROR_RECOVERIES = 5;
|
|
6
|
+
export declare const MAX_DELEGATED_EFFECT_FAILURES = 2;
|
|
6
7
|
export declare const EFFECT_RETRY_DELAYS_OVERRIDE: number[] | undefined;
|
|
7
8
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mCAAmC,UAE7B,CAAC;AAGpB,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD,eAAO,MAAM,4BAA4B,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mCAAmC,UAE7B,CAAC;AAGpB,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAK9C,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C,eAAO,MAAM,4BAA4B,sBAE5B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EFFECT_RETRY_DELAYS_OVERRIDE = exports.MAX_PROCESS_ERROR_RECOVERIES = exports.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS = exports.MAX_CONSECUTIVE_STALLS = exports.MAX_CONSECUTIVE_TIMEOUTS = exports.PROCESS_MODULE_LOAD_RETRY_DELAYS_MS = void 0;
|
|
3
|
+
exports.EFFECT_RETRY_DELAYS_OVERRIDE = exports.MAX_DELEGATED_EFFECT_FAILURES = exports.MAX_PROCESS_ERROR_RECOVERIES = exports.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS = exports.MAX_CONSECUTIVE_STALLS = exports.MAX_CONSECUTIVE_TIMEOUTS = exports.PROCESS_MODULE_LOAD_RETRY_DELAYS_MS = void 0;
|
|
4
4
|
exports.PROCESS_MODULE_LOAD_RETRY_DELAYS_MS = process.env.VITEST
|
|
5
5
|
? [0, 0]
|
|
6
6
|
: [100, 250, 500];
|
|
@@ -12,6 +12,11 @@ exports.MAX_CONSECUTIVE_STALLS = 5;
|
|
|
12
12
|
exports.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS = 5;
|
|
13
13
|
// Total process-error recoveries allowed across the entire run lifetime
|
|
14
14
|
exports.MAX_PROCESS_ERROR_RECOVERIES = 5;
|
|
15
|
+
// #936: Max times the host may post the SAME delegated effect as a failure
|
|
16
|
+
// before failing the run fast. A delegated agent/skill effect that keeps
|
|
17
|
+
// failing must NOT be retried thousands of times until the orchestration
|
|
18
|
+
// timeout — surface the real agent error and fail promptly.
|
|
19
|
+
exports.MAX_DELEGATED_EFFECT_FAILURES = 2;
|
|
15
20
|
exports.EFFECT_RETRY_DELAYS_OVERRIDE = process.env.VITEST
|
|
16
21
|
? [0, 0, 0]
|
|
17
22
|
: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/dispatch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG5E,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClE,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D,CAAC;AAaF,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,MAAM,EACnB,UAAU,GAAE,SAAS,sBAAsB,EAAO,GACjD,OAAO,CAGT;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/dispatch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG5E,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClE,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D,CAAC;AAaF,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,MAAM,EACnB,UAAU,GAAE,SAAS,sBAAsB,EAAO,GACjD,OAAO,CAGT;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,CA4ChC"}
|
|
@@ -27,6 +27,13 @@ async function dispatchEffectActions(options) {
|
|
|
27
27
|
if (!commit) {
|
|
28
28
|
continue;
|
|
29
29
|
}
|
|
30
|
+
// #949: a "pending" result means resolveEffect EMITTED the effect rather than
|
|
31
|
+
// executing it (auto-exec/dispatch gated OFF). Do NOT commit a resolved
|
|
32
|
+
// result for it — leave the effect pending so the host (or a later iteration
|
|
33
|
+
// with the flags enabled) performs it.
|
|
34
|
+
if (commit.result.status === "pending") {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
30
37
|
await options.commitAction(commit);
|
|
31
38
|
if (commit.result.status === "ok") {
|
|
32
39
|
ok += 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/effects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAW1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAO9D,OAAO,EACL,cAAc,IAAI,qBAAqB,EACvC,iBAAiB,IAAI,wBAAwB,EAC7C,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,KAAK,mBAAmB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EACL,WAAW,IAAI,kBAAkB,EACjC,uBAAuB,IAAI,8BAA8B,EACzD,gBAAgB,IAAI,oBAAoB,EACxC,iBAAiB,IAAI,sBAAsB,EAC3C,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,WAAW,IAAI,kBAAkB,EACjC,mBAAmB,IAAI,0BAA0B,EAClD,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/effects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAW1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAO9D,OAAO,EACL,cAAc,IAAI,qBAAqB,EACvC,iBAAiB,IAAI,wBAAwB,EAC7C,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,KAAK,mBAAmB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EACL,WAAW,IAAI,kBAAkB,EACjC,uBAAuB,IAAI,8BAA8B,EACzD,gBAAgB,IAAI,oBAAoB,EACxC,iBAAiB,IAAI,sBAAsB,EAC3C,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,WAAW,IAAI,kBAAkB,EACjC,mBAAmB,IAAI,0BAA0B,EAClD,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAS7D,OAAO,EAIL,sBAAsB,EAatB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,mBA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,GAAG,IAAI,GACtE,OAAO,CAAC,mBAAmB,CAAC,CAqF9B;AAED,wBAAsB,wCAAwC,CAAC,IAAI,EAAE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/E,GAAG,OAAO,CAAC,eAAe,CAAC,CA6C3B"}
|
|
@@ -90,10 +90,25 @@ async function resolveEffect(action, harnessName, options, piSession, discovered
|
|
|
90
90
|
if (kind === "mcp" || getMcpTaskConfig(action)) {
|
|
91
91
|
return resolveMcpEffect(action, options);
|
|
92
92
|
}
|
|
93
|
+
// #949: cross-harness agent/skill dispatch is gated behind
|
|
94
|
+
// BABYSITTER_CROSS_SUBAGENTS (default OFF). When disabled, EMIT the agent
|
|
95
|
+
// effect as pending instead of routing it through tasks-adapter / a harness.
|
|
96
|
+
// genty's autonomous entrypoint (handleHarnessCreateRun) opts this flag ON so
|
|
97
|
+
// standalone runs still dispatch. "breakpoint" effects are human-input, not
|
|
98
|
+
// cross-subagent dispatch, so they are not gated here.
|
|
99
|
+
if ((kind === "agent" || kind === "skill") && !(0, babysitter_sdk_1.crossSubagentsEnabled)()) {
|
|
100
|
+
return { status: "pending", value: { emitted: true, kind } };
|
|
101
|
+
}
|
|
93
102
|
const tasksMuxResult = await resolveViaTasksMuxIfRoutable(action, options, rl, json, askUserQuestionHandler);
|
|
94
103
|
if (tasksMuxResult) {
|
|
95
104
|
return tasksMuxResult;
|
|
96
105
|
}
|
|
106
|
+
// #949: shell/node task auto-execution is gated behind BABYSITTER_EXECUTE_TASKS
|
|
107
|
+
// (default OFF). When disabled, EMIT the effect as pending instead of running
|
|
108
|
+
// it. genty's autonomous entrypoint opts this flag ON.
|
|
109
|
+
if ((kind === "node" || kind === "orchestrator_task" || kind === "shell") && !(0, babysitter_sdk_1.executeTasksEnabled)()) {
|
|
110
|
+
return { status: "pending", value: { emitted: true, kind } };
|
|
111
|
+
}
|
|
97
112
|
if (kind === "node" || kind === "orchestrator_task") {
|
|
98
113
|
const meta = action.taskDef?.metadata;
|
|
99
114
|
const prompt = typeof meta?.prompt === "string"
|
|
@@ -763,7 +778,7 @@ async function invokeSubprocessEffect(action, harnessName, options, discovered,
|
|
|
763
778
|
status: "running",
|
|
764
779
|
};
|
|
765
780
|
await (0, global_1.getGlobalRegistry)().getOrchestration().postEffectResult(childHandle, childAction.effectId, {
|
|
766
|
-
status: childEffectResult.status,
|
|
781
|
+
status: (0, utils_1.assertResolvedStatus)(childEffectResult.status),
|
|
767
782
|
value: childEffectResult.value,
|
|
768
783
|
error: childEffectResult.error,
|
|
769
784
|
startedAt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externalPhase.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/externalPhase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"externalPhase.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/externalPhase.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAGzD,wBAAsB,6BAA6B,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAmUhH"}
|
|
@@ -167,7 +167,7 @@ async function runExternalOrchestrationPhase(args) {
|
|
|
167
167
|
status: "running",
|
|
168
168
|
};
|
|
169
169
|
await (0, global_1.getGlobalRegistry)().getOrchestration().postEffectResult(runHandle, action.effectId, {
|
|
170
|
-
status: effectResult.status,
|
|
170
|
+
status: (0, utils_1.assertResolvedStatus)(effectResult.status),
|
|
171
171
|
value: effectResult.value,
|
|
172
172
|
error: effectResult.error,
|
|
173
173
|
startedAt,
|
|
@@ -203,7 +203,7 @@ async function runExternalOrchestrationPhase(args) {
|
|
|
203
203
|
taskId: action.taskId,
|
|
204
204
|
kind: action.kind,
|
|
205
205
|
title: action.taskDef?.title,
|
|
206
|
-
status: effectResult.status,
|
|
206
|
+
status: (0, utils_1.assertResolvedStatus)(effectResult.status),
|
|
207
207
|
},
|
|
208
208
|
});
|
|
209
209
|
if (overlays.budgetEnforcement?.paused) {
|
|
@@ -7,10 +7,30 @@
|
|
|
7
7
|
export { MAX_CONSECUTIVE_PROCESS_ERROR_STALLS, MAX_CONSECUTIVE_STALLS, MAX_CONSECUTIVE_TIMEOUTS, MAX_PROCESS_ERROR_RECOVERIES, } from "./constants";
|
|
8
8
|
export { orchestrateIterationWithProcessLoadRetry, readProcessFileFingerprint, resolveEffect, resolveEffectWithRetry, resolveHarnessSessionIdForBinding, } from "./effects";
|
|
9
9
|
export { runExternalOrchestrationPhase } from "./externalPhase";
|
|
10
|
-
export { runInternalOrchestrationPhase } from "./internalPhase";
|
|
10
|
+
export { runInternalOrchestrationPhase, resolveWorkspaceRunsDir } from "./internalPhase";
|
|
11
11
|
export { subscribeVerbosePiEvents } from "./verbose";
|
|
12
12
|
import type { RunOrchestrationPhaseArgs } from "./types";
|
|
13
|
+
/**
|
|
14
|
+
* Parse a babysitter CLI `--json` stdout payload, failing loudly (and fast)
|
|
15
|
+
* when the CLI emitted a non-JSON line instead of a structured result.
|
|
16
|
+
*
|
|
17
|
+
* Bug #936 phase-2: when a delegated effect failed, `babysitter run:iterate`
|
|
18
|
+
* (or its child) could emit a bare `Error: Effect failed` line on stdout. The
|
|
19
|
+
* old code did an UNGUARDED `JSON.parse(...)`, which surfaced the cryptic
|
|
20
|
+
* `Unexpected token 'E', "Error: Effect failed" is not valid JSON` and then
|
|
21
|
+
* spun the iterate loop until the 80-minute orchestration timeout.
|
|
22
|
+
*
|
|
23
|
+
* This helper trims, attempts the parse, and on failure throws a clear
|
|
24
|
+
* {@link BabysitterRuntimeError} that includes the command, the first ~500
|
|
25
|
+
* chars of the raw non-JSON stdout AND stderr, so the failure is diagnosable
|
|
26
|
+
* immediately instead of as a SyntaxError 80 minutes later.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseBabysitterCliJson(raw: string, context: {
|
|
29
|
+
command: string;
|
|
30
|
+
stderr?: string;
|
|
31
|
+
}): Record<string, unknown>;
|
|
13
32
|
export declare function runOrchestrationPhase(args: RunOrchestrationPhaseArgs): Promise<number>;
|
|
33
|
+
export declare function runCliOrchestration(args: RunOrchestrationPhaseArgs): Promise<number>;
|
|
14
34
|
export declare function resolveAndPostEffect(action: {
|
|
15
35
|
effectId: string;
|
|
16
36
|
kind: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,oCAAoC,EACpC,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,wCAAwC,EACxC,0BAA0B,EAC1B,aAAa,EACb,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,oCAAoC,EACpC,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,wCAAwC,EACxC,0BAA0B,EAC1B,aAAa,EACb,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,u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Property(exports, "__esModule", { value: true });
|
|
42
|
-
exports.subscribeVerbosePiEvents = exports.runInternalOrchestrationPhase = exports.runExternalOrchestrationPhase = exports.resolveHarnessSessionIdForBinding = exports.resolveEffectWithRetry = exports.resolveEffect = exports.readProcessFileFingerprint = exports.orchestrateIterationWithProcessLoadRetry = exports.MAX_PROCESS_ERROR_RECOVERIES = exports.MAX_CONSECUTIVE_TIMEOUTS = exports.MAX_CONSECUTIVE_STALLS = exports.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS = void 0;
|
|
42
|
+
exports.subscribeVerbosePiEvents = exports.resolveWorkspaceRunsDir = exports.runInternalOrchestrationPhase = exports.runExternalOrchestrationPhase = exports.resolveHarnessSessionIdForBinding = exports.resolveEffectWithRetry = exports.resolveEffect = exports.readProcessFileFingerprint = exports.orchestrateIterationWithProcessLoadRetry = exports.MAX_PROCESS_ERROR_RECOVERIES = exports.MAX_CONSECUTIVE_TIMEOUTS = exports.MAX_CONSECUTIVE_STALLS = exports.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS = void 0;
|
|
43
|
+
exports.parseBabysitterCliJson = parseBabysitterCliJson;
|
|
43
44
|
exports.runOrchestrationPhase = runOrchestrationPhase;
|
|
45
|
+
exports.runCliOrchestration = runCliOrchestration;
|
|
44
46
|
exports.resolveAndPostEffect = resolveAndPostEffect;
|
|
45
47
|
var constants_1 = require("./constants");
|
|
46
48
|
Object.defineProperty(exports, "MAX_CONSECUTIVE_PROCESS_ERROR_STALLS", { enumerable: true, get: function () { return constants_1.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS; } });
|
|
@@ -57,14 +59,63 @@ var externalPhase_1 = require("./externalPhase");
|
|
|
57
59
|
Object.defineProperty(exports, "runExternalOrchestrationPhase", { enumerable: true, get: function () { return externalPhase_1.runExternalOrchestrationPhase; } });
|
|
58
60
|
var internalPhase_1 = require("./internalPhase");
|
|
59
61
|
Object.defineProperty(exports, "runInternalOrchestrationPhase", { enumerable: true, get: function () { return internalPhase_1.runInternalOrchestrationPhase; } });
|
|
62
|
+
Object.defineProperty(exports, "resolveWorkspaceRunsDir", { enumerable: true, get: function () { return internalPhase_1.resolveWorkspaceRunsDir; } });
|
|
60
63
|
var verbose_1 = require("./verbose");
|
|
61
64
|
Object.defineProperty(exports, "subscribeVerbosePiEvents", { enumerable: true, get: function () { return verbose_1.subscribeVerbosePiEvents; } });
|
|
62
65
|
const externalPhase_2 = require("./externalPhase");
|
|
63
66
|
const internalPhase_2 = require("./internalPhase");
|
|
64
67
|
const utils_1 = require("../utils");
|
|
68
|
+
// #949: cross-harness dispatch (agent/skill) and task auto-execution (shell/node)
|
|
69
|
+
// are gated behind BABYSITTER_CROSS_SUBAGENTS / BABYSITTER_EXECUTE_TASKS (default
|
|
70
|
+
// OFF). Defense-in-depth: the gate must live at this execution seam, not only at
|
|
71
|
+
// the entrypoint env mutation in handleHarnessCreateRun.
|
|
72
|
+
const babysitter_sdk_1 = require("@a5c-ai/babysitter-sdk");
|
|
65
73
|
async function importOptionalModule(specifier) {
|
|
66
74
|
return Promise.resolve(`${specifier}`).then(s => __importStar(require(s)));
|
|
67
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Parse a babysitter CLI `--json` stdout payload, failing loudly (and fast)
|
|
78
|
+
* when the CLI emitted a non-JSON line instead of a structured result.
|
|
79
|
+
*
|
|
80
|
+
* Bug #936 phase-2: when a delegated effect failed, `babysitter run:iterate`
|
|
81
|
+
* (or its child) could emit a bare `Error: Effect failed` line on stdout. The
|
|
82
|
+
* old code did an UNGUARDED `JSON.parse(...)`, which surfaced the cryptic
|
|
83
|
+
* `Unexpected token 'E', "Error: Effect failed" is not valid JSON` and then
|
|
84
|
+
* spun the iterate loop until the 80-minute orchestration timeout.
|
|
85
|
+
*
|
|
86
|
+
* This helper trims, attempts the parse, and on failure throws a clear
|
|
87
|
+
* {@link BabysitterRuntimeError} that includes the command, the first ~500
|
|
88
|
+
* chars of the raw non-JSON stdout AND stderr, so the failure is diagnosable
|
|
89
|
+
* immediately instead of as a SyntaxError 80 minutes later.
|
|
90
|
+
*/
|
|
91
|
+
function parseBabysitterCliJson(raw, context) {
|
|
92
|
+
const trimmed = (raw ?? "").trim();
|
|
93
|
+
try {
|
|
94
|
+
return JSON.parse(trimmed);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
const parseMessage = error instanceof Error ? error.message : String(error);
|
|
98
|
+
const stdoutSnippet = trimmed.slice(0, 500);
|
|
99
|
+
const stderrSnippet = (context.stderr ?? "").trim().slice(0, 500);
|
|
100
|
+
throw new utils_1.BabysitterRuntimeError("BabysitterCliNonJsonOutput", `babysitter ${context.command} did not emit valid JSON on stdout under --json `
|
|
101
|
+
+ `(${parseMessage}).\n--- stdout (first 500 chars) ---\n${stdoutSnippet || "<empty>"}`
|
|
102
|
+
+ `\n--- stderr (first 500 chars) ---\n${stderrSnippet || "<empty>"}`, { category: utils_1.ErrorCategory.Runtime });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* execFileSync throws on non-zero exit; the error carries `stdout`/`stderr`
|
|
107
|
+
* buffers. Surface BOTH so a failed iterate/create is diagnosable. The literal
|
|
108
|
+
* `Error: Effect failed` line that triggered #936 lands on one of these.
|
|
109
|
+
*/
|
|
110
|
+
function describeExecFileError(err) {
|
|
111
|
+
const e = err;
|
|
112
|
+
const decode = (v) => typeof v === "string" ? v : Buffer.isBuffer(v) ? v.toString("utf8") : "";
|
|
113
|
+
return {
|
|
114
|
+
message: err instanceof Error ? err.message : String(err),
|
|
115
|
+
stdout: decode(e?.stdout),
|
|
116
|
+
stderr: decode(e?.stderr),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
68
119
|
async function runOrchestrationPhase(args) {
|
|
69
120
|
const externalExitCode = await (0, externalPhase_2.runExternalOrchestrationPhase)(args);
|
|
70
121
|
if (externalExitCode !== undefined) {
|
|
@@ -77,7 +128,15 @@ async function runCliOrchestration(args) {
|
|
|
77
128
|
const path = await Promise.resolve().then(() => __importStar(require("node:path")));
|
|
78
129
|
const processPath = args.processPath;
|
|
79
130
|
const workspace = args.workspace ?? process.cwd();
|
|
80
|
-
|
|
131
|
+
// Bug #936: when no explicit --runs-dir is provided, babysitter run:create
|
|
132
|
+
// defaults to the GLOBAL ~/.a5c/runs, so the nested run (and its completion
|
|
133
|
+
// proof) land outside <workspace>/.a5c/runs where the live-stack validator —
|
|
134
|
+
// and users — look. Default to the WORKSPACE runs dir instead. An explicit
|
|
135
|
+
// args.runsDir or a BABYSITTER_RUNS_DIR / repo-scope override still wins (see
|
|
136
|
+
// resolveWorkspaceRunsDir's precedence). The resolver walks to the workspace's
|
|
137
|
+
// repo root when present and otherwise uses the workspace itself, so a
|
|
138
|
+
// non-git-repo live-stack workspace still resolves to <workspace>/.a5c/runs.
|
|
139
|
+
const runsDir = (0, internalPhase_2.resolveWorkspaceRunsDir)(args.runsDir, workspace);
|
|
81
140
|
const prompt = args.prompt ?? "";
|
|
82
141
|
const model = args.model;
|
|
83
142
|
// Resolve babysitter CLI: prefer the SDK's dist/cli/main.js over global binary
|
|
@@ -115,7 +174,9 @@ async function runCliOrchestration(args) {
|
|
|
115
174
|
timeout: 30_000,
|
|
116
175
|
env: { ...process.env },
|
|
117
176
|
});
|
|
118
|
-
|
|
177
|
+
// #936: guarded parse — a non-JSON line (e.g. "Error: Effect failed") on
|
|
178
|
+
// stdout must surface a clear error, not a cryptic SyntaxError.
|
|
179
|
+
const parsed = parseBabysitterCliJson(createResult, { command: "run:create" });
|
|
119
180
|
runDir = parsed.runDir;
|
|
120
181
|
await fsPromises.unlink(inputsFile).catch(() => { });
|
|
121
182
|
if (!args.json) {
|
|
@@ -124,9 +185,14 @@ async function runCliOrchestration(args) {
|
|
|
124
185
|
}
|
|
125
186
|
catch (err) {
|
|
126
187
|
await fsPromises.unlink(inputsFile).catch(() => { });
|
|
127
|
-
|
|
188
|
+
// execFileSync throws on non-zero exit — capture stdout/stderr buffers so
|
|
189
|
+
// the failure reason (not just "Command failed") is visible.
|
|
190
|
+
const { message, stdout, stderr } = describeExecFileError(err);
|
|
191
|
+
const detail = err instanceof utils_1.BabysitterRuntimeError
|
|
192
|
+
? message
|
|
193
|
+
: `${message}${stdout ? `\n--- stdout ---\n${stdout.slice(0, 500)}` : ""}${stderr ? `\n--- stderr ---\n${stderr.slice(0, 500)}` : ""}`;
|
|
128
194
|
if (!args.json) {
|
|
129
|
-
process.stderr.write(`\x1b[31mFailed to create run:\x1b[0m ${
|
|
195
|
+
process.stderr.write(`\x1b[31mFailed to create run:\x1b[0m ${detail}\n`);
|
|
130
196
|
}
|
|
131
197
|
return 1;
|
|
132
198
|
}
|
|
@@ -137,14 +203,38 @@ async function runCliOrchestration(args) {
|
|
|
137
203
|
process.stderr.write(`[genty-orchestration] iteration ${i}/${maxIterations} starting\n`);
|
|
138
204
|
try {
|
|
139
205
|
const iterArgs = [...babysitterPrefix, "run:iterate", runDir, "--json", "--iteration", String(i)];
|
|
206
|
+
// #936: keep the iterate calls anchored to the same runs dir as create so
|
|
207
|
+
// the run lifecycle stays in <workspace>/.a5c/runs throughout.
|
|
208
|
+
if (runsDir)
|
|
209
|
+
iterArgs.push("--runs-dir", runsDir);
|
|
140
210
|
process.stderr.write(`[genty-orchestration] exec: ${babysitterCmd} ${iterArgs.join(" ")}\n`);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
211
|
+
let iterResult;
|
|
212
|
+
try {
|
|
213
|
+
iterResult = execFileSync(babysitterCmd, iterArgs, {
|
|
214
|
+
cwd: workspace,
|
|
215
|
+
encoding: "utf8",
|
|
216
|
+
timeout: 120_000,
|
|
217
|
+
env: { ...process.env },
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
catch (execErr) {
|
|
221
|
+
// #936: run:iterate exited non-zero. FAIL FAST with the captured
|
|
222
|
+
// stdout/stderr (which carries the real failure, e.g. the
|
|
223
|
+
// "Error: Effect failed" line) instead of letting the loop spin to
|
|
224
|
+
// the 80-minute orchestration timeout. Prefer stdout for the guarded
|
|
225
|
+
// JSON parse when present so a structured failure result is honored.
|
|
226
|
+
const { message, stdout, stderr } = describeExecFileError(execErr);
|
|
227
|
+
if (stdout.trim().length > 0) {
|
|
228
|
+
iterResult = stdout;
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
throw new utils_1.BabysitterRuntimeError("BabysitterIterateFailed", `babysitter run:iterate (iteration ${i}) exited non-zero: ${message}`
|
|
232
|
+
+ `\n--- stderr (first 500 chars) ---\n${stderr.trim().slice(0, 500) || "<empty>"}`, { category: utils_1.ErrorCategory.Runtime });
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// #936: guarded parse — throws a clear BabysitterRuntimeError including
|
|
236
|
+
// the raw stdout/stderr when run:iterate emits a non-JSON line.
|
|
237
|
+
const parsed = parseBabysitterCliJson(iterResult, { command: `run:iterate (iteration ${i})` });
|
|
148
238
|
process.stderr.write(`[genty-orchestration] iterate result: status=${parsed.status} actions=${parsed.nextActions?.length ?? 0} reason=${parsed.reason ?? 'n/a'}\n`);
|
|
149
239
|
if (parsed.status === "completed") {
|
|
150
240
|
if (!args.json) {
|
|
@@ -195,12 +285,31 @@ async function runCliOrchestration(args) {
|
|
|
195
285
|
return 1;
|
|
196
286
|
}
|
|
197
287
|
async function resolveAndPostEffect(action, runDir, workspace, model, babysitterBin = "babysitter") {
|
|
288
|
+
// #949: gate at the execution seam. Cross-harness dispatch (agent/skill) and
|
|
289
|
+
// task auto-execution (shell/node) only run when their flags are ON. When OFF,
|
|
290
|
+
// do NOT execute and do NOT post — leave the effect pending so the next
|
|
291
|
+
// iteration re-emits it (mirrors resolveEffect's pending contract). genty's
|
|
292
|
+
// autonomous entrypoint (handleHarnessCreateRun) opts these flags ON.
|
|
293
|
+
if ((action.kind === "agent" || action.kind === "skill") && !(0, babysitter_sdk_1.crossSubagentsEnabled)()) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if ((action.kind === "shell" || action.kind === "node" || action.kind === "orchestrator_task") && !(0, babysitter_sdk_1.executeTasksEnabled)()) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
198
299
|
const { execFileSync, execSync } = await Promise.resolve().then(() => __importStar(require("node:child_process")));
|
|
199
300
|
const { createAgentCoreSession } = await Promise.resolve().then(() => __importStar(require("../utils")));
|
|
200
301
|
const babysitterParts = babysitterBin.split(" ");
|
|
201
302
|
const bCmd = babysitterParts[0];
|
|
202
303
|
const bPrefix = babysitterParts.slice(1);
|
|
304
|
+
// #936: track the effect outcome explicitly. A delegated agent/skill prompt
|
|
305
|
+
// that fails (result.success === false) or a shell command that exits
|
|
306
|
+
// non-zero MUST be posted as `--status error` with the real error — NOT
|
|
307
|
+
// silently posted as ok with an error string as the value. Posting a poisoned
|
|
308
|
+
// "ok" value is what produced the downstream "Error: Effect failed" line and
|
|
309
|
+
// the 80-minute spin.
|
|
203
310
|
let value;
|
|
311
|
+
let postStatus = "ok";
|
|
312
|
+
let postError;
|
|
204
313
|
const tasksMuxValue = await resolveViaTasksMuxForCli(action, workspace, model);
|
|
205
314
|
if (tasksMuxValue !== undefined) {
|
|
206
315
|
value = tasksMuxValue;
|
|
@@ -219,7 +328,18 @@ async function resolveAndPostEffect(action, runDir, workspace, model, babysitter
|
|
|
219
328
|
});
|
|
220
329
|
try {
|
|
221
330
|
const result = await session.prompt(prompt);
|
|
222
|
-
|
|
331
|
+
if (result.success === false) {
|
|
332
|
+
// Delegated session failed — propagate the failure so the process can
|
|
333
|
+
// handle it, instead of posting the failure text as a successful value.
|
|
334
|
+
postStatus = "error";
|
|
335
|
+
postError = (typeof result.output === "string" && result.output.trim().length > 0)
|
|
336
|
+
? result.output
|
|
337
|
+
: `Delegated ${action.kind} effect failed (exitCode=${result.exitCode ?? "unknown"})`;
|
|
338
|
+
value = JSON.stringify(result.output ?? "");
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
value = JSON.stringify(result.output ?? "");
|
|
342
|
+
}
|
|
223
343
|
}
|
|
224
344
|
finally {
|
|
225
345
|
session.dispose();
|
|
@@ -232,7 +352,10 @@ async function resolveAndPostEffect(action, runDir, workspace, model, babysitter
|
|
|
232
352
|
value = JSON.stringify(output);
|
|
233
353
|
}
|
|
234
354
|
catch (err) {
|
|
355
|
+
// A failed shell command is a real effect failure — post it as error.
|
|
235
356
|
const stderr = err.stderr ?? "";
|
|
357
|
+
postStatus = "error";
|
|
358
|
+
postError = stderr || (err instanceof Error ? err.message : "shell command failed");
|
|
236
359
|
value = JSON.stringify(stderr || "shell command failed");
|
|
237
360
|
}
|
|
238
361
|
}
|
|
@@ -246,6 +369,18 @@ async function resolveAndPostEffect(action, runDir, workspace, model, babysitter
|
|
|
246
369
|
try {
|
|
247
370
|
const fs = await Promise.resolve().then(() => __importStar(require("node:fs/promises")));
|
|
248
371
|
const path = await Promise.resolve().then(() => __importStar(require("node:path")));
|
|
372
|
+
if (postStatus === "error") {
|
|
373
|
+
// task:post --status error reads the error payload as JSON from --error
|
|
374
|
+
// <file> (see handleTaskPost -> readJsonFile). Write a structured error
|
|
375
|
+
// object, not a bare string, so the CLI commits a proper failure result.
|
|
376
|
+
const errorFile = path.join(runDir, "tasks", action.effectId, "error.json");
|
|
377
|
+
await fs.mkdir(path.dirname(errorFile), { recursive: true });
|
|
378
|
+
await fs.writeFile(errorFile, JSON.stringify({ name: "Error", message: postError ?? "Effect failed" }));
|
|
379
|
+
execFileSync(bCmd, [...bPrefix, "task:post", runDir, action.effectId, "--status", "error", "--error", errorFile, "--json"], {
|
|
380
|
+
cwd: workspace, encoding: "utf8", timeout: 30_000, env: { ...process.env },
|
|
381
|
+
});
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
249
384
|
const taskDir = path.join(runDir, "tasks", action.effectId);
|
|
250
385
|
await fs.mkdir(taskDir, { recursive: true });
|
|
251
386
|
await fs.writeFile(path.join(taskDir, "output.json"), value);
|
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
import type { RunOrchestrationPhaseArgs } from "./types";
|
|
2
2
|
export declare function runInternalOrchestrationPhase(args: RunOrchestrationPhaseArgs): Promise<number>;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the runs directory for genty's internal (in-process) execution.
|
|
5
|
+
*
|
|
6
|
+
* Precedence (highest first):
|
|
7
|
+
* 1. An explicit runsDir passed by the caller (CLI --runs-dir).
|
|
8
|
+
* 2. The BABYSITTER_RUNS_DIR / BABYSITTER_RUNS_SCOPE env overrides, honored
|
|
9
|
+
* via the SDK's resolveRunsDir({ cwd }).
|
|
10
|
+
* 3. The WORKSPACE repo runs dir (<repoRoot>/.a5c/runs) — NOT the global
|
|
11
|
+
* ~/.a5c/runs. The SDK defaults to global scope when nothing is set, which
|
|
12
|
+
* means a plain `genty call` never materializes the workspace .a5c/runs/.
|
|
13
|
+
* Forcing the workspace dir here makes the internal path establish the run
|
|
14
|
+
* lifecycle where downstream tooling (and the live-stack verification)
|
|
15
|
+
* expects it. See #936 bug 2.
|
|
16
|
+
*
|
|
17
|
+
* The SDK is loaded lazily (sync require, only when this is actually called) to
|
|
18
|
+
* avoid eagerly pulling the heavy SDK + atlas index into the module graph, per
|
|
19
|
+
* the #936 default-provider lazy-load decision.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveWorkspaceRunsDir(explicitRunsDir: string | undefined, workspace: string | undefined): string;
|
|
3
22
|
//# sourceMappingURL=internalPhase.d.ts.map
|