@a5c-ai/agent-platform 5.0.1-staging.04ca6ab00d21 → 5.0.1-staging.4422159e935e
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 +8 -13
- package/dist/daemon/index.d.ts +2 -0
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +5 -1
- package/dist/harness/index.d.ts +8 -0
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +26 -1
- package/dist/harness/internal/createRun/agent-core-loop.d.ts +43 -0
- package/dist/harness/internal/createRun/agent-core-loop.d.ts.map +1 -0
- package/dist/harness/internal/createRun/agent-core-loop.js +240 -0
- package/dist/harness/internal/createRun/orchestration/effects.js +1 -1
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.js +1 -1
- package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.js +1 -1
- package/dist/harness/internal/createRun/orchestration/internalPhase.js +1 -1
- package/dist/harness/internal/createRun/pi.d.ts +9 -33
- package/dist/harness/internal/createRun/pi.d.ts.map +1 -1
- package/dist/harness/internal/createRun/pi.js +33 -214
- package/dist/harness/internal/createRun/planProcess/delegation.js +1 -1
- package/dist/harness/internal/createRun/planProcess/phase.js +5 -5
- package/dist/harness/internal/createRun/utils.d.ts +1 -1
- package/dist/harness/internal/createRun/utils.d.ts.map +1 -1
- package/dist/harness/internal/createRun/utils.js +5 -2
- package/dist/harness/piWrapper/moduleSupport.js +2 -2
- package/dist/harness/piWrapper.d.ts +2 -2
- package/dist/harness/piWrapper.js +2 -2
- package/dist/harness/types.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/seams/contract.d.ts +5 -5
- package/dist/seams/contract.d.ts.map +1 -1
- package/dist/seams/contract.js +3 -5
- package/dist/seams/contract.test.js +4 -7
- package/package.json +14 -18
- package/dist/cli/amuxEventsFormatter.d.ts +0 -26
- package/dist/cli/amuxEventsFormatter.d.ts.map +0 -1
- package/dist/cli/amuxEventsFormatter.js +0 -86
- package/dist/cli/args/argFlags.d.ts +0 -6
- package/dist/cli/args/argFlags.d.ts.map +0 -1
- package/dist/cli/args/argFlags.js +0 -72
- package/dist/cli/args/argPositionals.d.ts +0 -3
- package/dist/cli/args/argPositionals.d.ts.map +0 -1
- package/dist/cli/args/argPositionals.js +0 -18
- package/dist/cli/args/index.d.ts +0 -4
- package/dist/cli/args/index.d.ts.map +0 -1
- package/dist/cli/args/index.js +0 -75
- package/dist/cli/args/types.d.ts +0 -13
- package/dist/cli/args/types.d.ts.map +0 -1
- package/dist/cli/args/types.js +0 -2
- package/dist/cli/commands/daemon.d.ts +0 -31
- package/dist/cli/commands/daemon.d.ts.map +0 -1
- package/dist/cli/commands/daemon.js +0 -156
- package/dist/cli/commands/harness/createRun.d.ts +0 -3
- package/dist/cli/commands/harness/createRun.d.ts.map +0 -1
- package/dist/cli/commands/harness/createRun.js +0 -8
- package/dist/cli/commands/harness/resumeRun.d.ts +0 -20
- package/dist/cli/commands/harness/resumeRun.d.ts.map +0 -1
- package/dist/cli/commands/harness/resumeRun.js +0 -341
- package/dist/cli/commands/jsonlInteractive.d.ts +0 -35
- package/dist/cli/commands/jsonlInteractive.d.ts.map +0 -1
- package/dist/cli/commands/jsonlInteractive.js +0 -302
- package/dist/cli/commands/mcpServe.d.ts +0 -18
- package/dist/cli/commands/mcpServe.d.ts.map +0 -1
- package/dist/cli/commands/mcpServe.js +0 -59
- package/dist/cli/commands/session/history.d.ts +0 -14
- package/dist/cli/commands/session/history.d.ts.map +0 -1
- package/dist/cli/commands/session/history.js +0 -100
- package/dist/cli/commands/tui.d.ts +0 -23
- package/dist/cli/commands/tui.d.ts.map +0 -1
- package/dist/cli/commands/tui.js +0 -183
- package/dist/cli/dispatch.d.ts +0 -4
- package/dist/cli/dispatch.d.ts.map +0 -1
- package/dist/cli/dispatch.js +0 -332
- package/dist/cli/main.d.ts +0 -7
- package/dist/cli/main.d.ts.map +0 -1
- package/dist/cli/main.js +0 -41
- package/dist/cli/program.d.ts +0 -7
- package/dist/cli/program.d.ts.map +0 -1
- package/dist/cli/program.js +0 -8
- package/dist/cli/ui.d.ts +0 -9
- package/dist/cli/ui.d.ts.map +0 -1
- package/dist/cli/ui.js +0 -125
- package/dist/prompts/commandTemplates.d.ts +0 -3
- package/dist/prompts/commandTemplates.d.ts.map +0 -1
- package/dist/prompts/commandTemplates.js +0 -238
package/README.md
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
# @a5c-ai/agent-platform
|
|
2
2
|
|
|
3
|
-
Agent Platform layer — harness integration, governance,
|
|
3
|
+
Agent Platform layer — harness integration, governance, interaction, storage.
|
|
4
4
|
|
|
5
5
|
<!-- docs-status:start -->
|
|
6
6
|
> Status: Public advanced/runtime package.
|
|
7
7
|
> Canonical docs home: [Package and Plugin Docs Map](../../docs/package-and-plugin-map.md).
|
|
8
|
-
> This README is the canonical runtime
|
|
8
|
+
> This README is the canonical runtime/platform API contract. The product CLI implementation lives in `@a5c-ai/omni`.
|
|
9
9
|
<!-- docs-status:end -->
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install
|
|
14
|
+
npm install @a5c-ai/agent-platform
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Use this package as the reusable platform API layer. Install `@a5c-ai/omni` for the product CLI.
|
|
20
20
|
|
|
21
|
-
```
|
|
22
|
-
agent-platform
|
|
23
|
-
|
|
24
|
-
babysitter session:init --session-id demo --state-dir .a5c --run-id run-123
|
|
25
|
-
agent-platform start-server --transport stdio
|
|
26
|
-
agent-platform discover --json
|
|
27
|
-
agent-platform invoke claude-code --prompt "implement feature X" --workspace .
|
|
28
|
-
agent-platform tui --workspace .
|
|
21
|
+
```ts
|
|
22
|
+
import { discoverHarnesses, invokeHarness } from "@a5c-ai/agent-platform/harness";
|
|
23
|
+
import { apiRunStatus } from "@a5c-ai/agent-platform/api";
|
|
29
24
|
```
|
|
30
25
|
|
|
31
|
-
Use the main `babysitter` CLI for harness installation and session-state commands:
|
|
26
|
+
Use `@a5c-ai/omni` for the product CLI and the main `babysitter` CLI for harness installation and session-state commands:
|
|
32
27
|
|
|
33
28
|
```bash
|
|
34
29
|
babysitter harness:install claude-code
|
package/dist/daemon/index.d.ts
CHANGED
|
@@ -4,4 +4,6 @@
|
|
|
4
4
|
* through this barrel file.
|
|
5
5
|
*/
|
|
6
6
|
export { startDaemon, stopDaemon, getDaemonStatus, loadDaemonConfig, writeDaemonConfig, createFileWatcher, createWebhookListener, createTimerScheduler, runDaemonLoop, readDaemonLoopStatus, appendDaemonLog, readDaemonLog, type DaemonConfig, type DaemonStartOptions, type DaemonStartOutput, type DaemonStopOptions, type DaemonStopOutput, type DaemonStatusOptions, type DaemonStatusOutput, type DaemonMetadata, type TriggerConfig, type TriggerEvent, type FileTriggerEvent, type AutomationTriggerEvent, type FileTriggerConfig, type FileWatcherHandle, type WebhookListenerOptions, type WebhookListenerHandle, type TriggerCallback, type TimerSchedulerHandle, type DaemonLoopOptions, type DaemonLoopStatus, type DaemonLogEntry, } from "@a5c-ai/agent-runtime/daemon";
|
|
7
|
+
export { executeAutomationTrigger } from "./automationExecutor";
|
|
8
|
+
export { isAutomationTriggerEvent } from "./types";
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/daemon/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,WAAW,EACX,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/daemon/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,WAAW,EACX,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/daemon/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readDaemonLog = exports.appendDaemonLog = exports.readDaemonLoopStatus = exports.runDaemonLoop = exports.createTimerScheduler = exports.createWebhookListener = exports.createFileWatcher = exports.writeDaemonConfig = exports.loadDaemonConfig = exports.getDaemonStatus = exports.stopDaemon = exports.startDaemon = void 0;
|
|
3
|
+
exports.isAutomationTriggerEvent = exports.executeAutomationTrigger = exports.readDaemonLog = exports.appendDaemonLog = exports.readDaemonLoopStatus = exports.runDaemonLoop = exports.createTimerScheduler = exports.createWebhookListener = exports.createFileWatcher = exports.writeDaemonConfig = exports.loadDaemonConfig = exports.getDaemonStatus = exports.stopDaemon = exports.startDaemon = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Re-export shim — canonical implementation lives in @a5c-ai/agent-runtime.
|
|
6
6
|
* Internal agent-platform consumers continue to import via relative paths
|
|
@@ -19,3 +19,7 @@ Object.defineProperty(exports, "runDaemonLoop", { enumerable: true, get: functio
|
|
|
19
19
|
Object.defineProperty(exports, "readDaemonLoopStatus", { enumerable: true, get: function () { return daemon_1.readDaemonLoopStatus; } });
|
|
20
20
|
Object.defineProperty(exports, "appendDaemonLog", { enumerable: true, get: function () { return daemon_1.appendDaemonLog; } });
|
|
21
21
|
Object.defineProperty(exports, "readDaemonLog", { enumerable: true, get: function () { return daemon_1.readDaemonLog; } });
|
|
22
|
+
var automationExecutor_1 = require("./automationExecutor");
|
|
23
|
+
Object.defineProperty(exports, "executeAutomationTrigger", { enumerable: true, get: function () { return automationExecutor_1.executeAutomationTrigger; } });
|
|
24
|
+
var types_1 = require("./types");
|
|
25
|
+
Object.defineProperty(exports, "isAutomationTriggerEvent", { enumerable: true, get: function () { return types_1.isAutomationTriggerEvent; } });
|
package/dist/harness/index.d.ts
CHANGED
|
@@ -7,4 +7,12 @@ export { buildLaunchSpec } from "./invoker/launch";
|
|
|
7
7
|
export { createAgentCoreSession, type AgentCoreEventListener } from "@a5c-ai/agent-core";
|
|
8
8
|
export type { AgentCoreSessionHandle } from "@a5c-ai/agent-core";
|
|
9
9
|
export * as amux from "./amux";
|
|
10
|
+
export { handleHarnessCreateRun, handleSessionCreate, runOrchestrationPhase, selectHarness, } from "./internal/createRun";
|
|
11
|
+
export type { HarnessCreateRunArgs, SessionCreateArgs, } from "./internal/createRun";
|
|
12
|
+
export type { OutputMode, ToolResultShape, } from "./internal/createRun/utils";
|
|
13
|
+
export { BOLD, DIM, MAGENTA, RED, RESET, formatToolResult, writeVerboseBlock, writeVerboseLine, } from "./internal/createRun/utils";
|
|
14
|
+
export { assessRun, discoverRuns } from "./internal/createRun/resumeState";
|
|
15
|
+
export { normalizeBuiltInHarnessName } from "./builtInHarness";
|
|
16
|
+
export { invokeViaAgentMux, type AmuxBridgeOptions, type AmuxBridgeResult, type AmuxEventCallback, type AmuxClient, type AmuxRunHandle, type AmuxAgentEvent, type AmuxInteractionChannel, } from "./amux";
|
|
17
|
+
export { HARNESS_TO_AMUX_ADAPTER, mapHarnessToAmuxAdapter, hasAmuxAdapter, } from "./amux";
|
|
10
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACzF,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACzF,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,UAAU,EACV,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,IAAI,EACJ,GAAG,EACH,OAAO,EACP,GAAG,EACH,KAAK,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,sBAAsB,GAC5B,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,cAAc,GACf,MAAM,QAAQ,CAAC"}
|
package/dist/harness/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.amux = exports.createAgentCoreSession = exports.buildLaunchSpec = exports.HARNESS_CLI_MAP = exports.buildHarnessArgs = exports.invokeHarness = exports.parseSearchResults = exports.filterByRelevance = exports.extractTextFromHtml = exports.stripHtmlTags = exports.AGENTIC_TOOL_NAMES = exports.disposeAgentCoreToolDefinitions = exports.createAgentCoreToolDefinitions = exports.resetAdapter = exports.setAdapter = exports.getAdapter = exports.listSupportedHarnesses = exports.getAdapterByName = exports.detectAdapter = exports.KNOWN_HARNESSES = exports.checkCliAvailable = exports.detectCallerHarness = exports.discoverHarnesses = exports.HarnessCapability = void 0;
|
|
36
|
+
exports.hasAmuxAdapter = exports.mapHarnessToAmuxAdapter = exports.HARNESS_TO_AMUX_ADAPTER = exports.invokeViaAgentMux = exports.normalizeBuiltInHarnessName = exports.discoverRuns = exports.assessRun = exports.writeVerboseLine = exports.writeVerboseBlock = exports.formatToolResult = exports.RESET = exports.RED = exports.MAGENTA = exports.DIM = exports.BOLD = exports.selectHarness = exports.runOrchestrationPhase = exports.handleSessionCreate = exports.handleHarnessCreateRun = exports.amux = exports.createAgentCoreSession = exports.buildLaunchSpec = exports.HARNESS_CLI_MAP = exports.buildHarnessArgs = exports.invokeHarness = exports.parseSearchResults = exports.filterByRelevance = exports.extractTextFromHtml = exports.stripHtmlTags = exports.AGENTIC_TOOL_NAMES = exports.disposeAgentCoreToolDefinitions = exports.createAgentCoreToolDefinitions = exports.resetAdapter = exports.setAdapter = exports.getAdapter = exports.listSupportedHarnesses = exports.getAdapterByName = exports.detectAdapter = exports.KNOWN_HARNESSES = exports.checkCliAvailable = exports.detectCallerHarness = exports.discoverHarnesses = exports.HarnessCapability = void 0;
|
|
37
37
|
var types_1 = require("./types");
|
|
38
38
|
Object.defineProperty(exports, "HarnessCapability", { enumerable: true, get: function () { return types_1.HarnessCapability; } });
|
|
39
39
|
var babysitter_sdk_1 = require("@a5c-ai/babysitter-sdk");
|
|
@@ -64,3 +64,28 @@ Object.defineProperty(exports, "buildLaunchSpec", { enumerable: true, get: funct
|
|
|
64
64
|
var agent_core_2 = require("@a5c-ai/agent-core");
|
|
65
65
|
Object.defineProperty(exports, "createAgentCoreSession", { enumerable: true, get: function () { return agent_core_2.createAgentCoreSession; } });
|
|
66
66
|
exports.amux = __importStar(require("./amux"));
|
|
67
|
+
var createRun_1 = require("./internal/createRun");
|
|
68
|
+
Object.defineProperty(exports, "handleHarnessCreateRun", { enumerable: true, get: function () { return createRun_1.handleHarnessCreateRun; } });
|
|
69
|
+
Object.defineProperty(exports, "handleSessionCreate", { enumerable: true, get: function () { return createRun_1.handleSessionCreate; } });
|
|
70
|
+
Object.defineProperty(exports, "runOrchestrationPhase", { enumerable: true, get: function () { return createRun_1.runOrchestrationPhase; } });
|
|
71
|
+
Object.defineProperty(exports, "selectHarness", { enumerable: true, get: function () { return createRun_1.selectHarness; } });
|
|
72
|
+
var utils_1 = require("./internal/createRun/utils");
|
|
73
|
+
Object.defineProperty(exports, "BOLD", { enumerable: true, get: function () { return utils_1.BOLD; } });
|
|
74
|
+
Object.defineProperty(exports, "DIM", { enumerable: true, get: function () { return utils_1.DIM; } });
|
|
75
|
+
Object.defineProperty(exports, "MAGENTA", { enumerable: true, get: function () { return utils_1.MAGENTA; } });
|
|
76
|
+
Object.defineProperty(exports, "RED", { enumerable: true, get: function () { return utils_1.RED; } });
|
|
77
|
+
Object.defineProperty(exports, "RESET", { enumerable: true, get: function () { return utils_1.RESET; } });
|
|
78
|
+
Object.defineProperty(exports, "formatToolResult", { enumerable: true, get: function () { return utils_1.formatToolResult; } });
|
|
79
|
+
Object.defineProperty(exports, "writeVerboseBlock", { enumerable: true, get: function () { return utils_1.writeVerboseBlock; } });
|
|
80
|
+
Object.defineProperty(exports, "writeVerboseLine", { enumerable: true, get: function () { return utils_1.writeVerboseLine; } });
|
|
81
|
+
var resumeState_1 = require("./internal/createRun/resumeState");
|
|
82
|
+
Object.defineProperty(exports, "assessRun", { enumerable: true, get: function () { return resumeState_1.assessRun; } });
|
|
83
|
+
Object.defineProperty(exports, "discoverRuns", { enumerable: true, get: function () { return resumeState_1.discoverRuns; } });
|
|
84
|
+
var builtInHarness_1 = require("./builtInHarness");
|
|
85
|
+
Object.defineProperty(exports, "normalizeBuiltInHarnessName", { enumerable: true, get: function () { return builtInHarness_1.normalizeBuiltInHarnessName; } });
|
|
86
|
+
var amux_1 = require("./amux");
|
|
87
|
+
Object.defineProperty(exports, "invokeViaAgentMux", { enumerable: true, get: function () { return amux_1.invokeViaAgentMux; } });
|
|
88
|
+
var amux_2 = require("./amux");
|
|
89
|
+
Object.defineProperty(exports, "HARNESS_TO_AMUX_ADAPTER", { enumerable: true, get: function () { return amux_2.HARNESS_TO_AMUX_ADAPTER; } });
|
|
90
|
+
Object.defineProperty(exports, "mapHarnessToAmuxAdapter", { enumerable: true, get: function () { return amux_2.mapHarnessToAmuxAdapter; } });
|
|
91
|
+
Object.defineProperty(exports, "hasAmuxAdapter", { enumerable: true, get: function () { return amux_2.hasAmuxAdapter; } });
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-core internal loop utilities.
|
|
3
|
+
*
|
|
4
|
+
* Prompt retry logic, session options builder, timeout constants, and
|
|
5
|
+
* metadata helpers used by the createRun orchestration phases.
|
|
6
|
+
*
|
|
7
|
+
* Previously lived in pi.ts — renamed to reflect that these are generic
|
|
8
|
+
* agent-core concerns, not Pi-specific.
|
|
9
|
+
*/
|
|
10
|
+
import type { EffectAction } from "@a5c-ai/babysitter-sdk";
|
|
11
|
+
import type { AgentCorePromptResult, AgentCoreSessionOptions } from "../../types";
|
|
12
|
+
import type { DelegationConfig } from "./utils";
|
|
13
|
+
export declare const TRANSIENT_PROMPT_RETRY_DELAYS_MS: number[];
|
|
14
|
+
export declare const PARENT_PROMPT_TIMEOUT_MS = 900000;
|
|
15
|
+
export declare const DEFAULT_PROMPT_TIMEOUT_MS = 900000;
|
|
16
|
+
export declare const WORKER_TIMEOUT_MS = 1800000;
|
|
17
|
+
export declare function readBooleanMetadata(metadata: Record<string, unknown> | undefined, key: string): boolean | undefined;
|
|
18
|
+
export declare function readBashSandboxMetadata(metadata: Record<string, unknown> | undefined): AgentCoreSessionOptions["bashSandbox"] | undefined;
|
|
19
|
+
export declare function readStringMetadata(metadata: Record<string, unknown> | undefined, key: string): string | undefined;
|
|
20
|
+
export declare function isProcessModuleLoadFailure(error: unknown): boolean;
|
|
21
|
+
export declare function isRetryablePromptFailure(error: unknown): boolean;
|
|
22
|
+
export declare function isIgnorablePromptFailure(output: string): boolean;
|
|
23
|
+
type PromptCapableSession = {
|
|
24
|
+
prompt(text: string, timeout?: number): Promise<AgentCorePromptResult>;
|
|
25
|
+
};
|
|
26
|
+
export declare function promptWithRetry(args: {
|
|
27
|
+
session: PromptCapableSession;
|
|
28
|
+
message: string;
|
|
29
|
+
timeout: number;
|
|
30
|
+
label: string;
|
|
31
|
+
writeVerbose?: (message: string) => void;
|
|
32
|
+
writeVerboseData?: (label: string, value: unknown, maxChars?: number) => void;
|
|
33
|
+
}): Promise<AgentCorePromptResult>;
|
|
34
|
+
export declare function buildWorkerSessionOptions(args: {
|
|
35
|
+
action: EffectAction;
|
|
36
|
+
workspace?: string;
|
|
37
|
+
model?: string;
|
|
38
|
+
customTools?: unknown[];
|
|
39
|
+
delegationConfig?: DelegationConfig;
|
|
40
|
+
}): AgentCoreSessionOptions;
|
|
41
|
+
export declare function resolveAgentCoreBackendForHarness(harnessName?: string): string | undefined;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=agent-core-loop.d.ts.map
|
|
@@ -0,0 +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,wBAAwB,CAAC;AAC3D,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,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,GAAG,EAAE,MAAM,GACV,OAAO,GAAG,SAAS,CAYrB;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC5C,uBAAuB,CAAC,aAAa,CAAC,GAAG,SAAS,CAKpD;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAGpB;AAMD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAElE;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAwBhE;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhE;AAMD,KAAK,oBAAoB,GAAG;IAC1B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACxE,CAAC;AAEF,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,OAAO,EAAE,oBAAoB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,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,qBAAqB,CAAC,CAuCjC;AAMD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,uBAAuB,CAoE1B;AAMD,wBAAgB,iCAAiC,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY1F"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Agent-core internal loop utilities.
|
|
4
|
+
*
|
|
5
|
+
* Prompt retry logic, session options builder, timeout constants, and
|
|
6
|
+
* metadata helpers used by the createRun orchestration phases.
|
|
7
|
+
*
|
|
8
|
+
* Previously lived in pi.ts — renamed to reflect that these are generic
|
|
9
|
+
* agent-core concerns, not Pi-specific.
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.WORKER_TIMEOUT_MS = exports.DEFAULT_PROMPT_TIMEOUT_MS = exports.PARENT_PROMPT_TIMEOUT_MS = exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS = void 0;
|
|
46
|
+
exports.readBooleanMetadata = readBooleanMetadata;
|
|
47
|
+
exports.readBashSandboxMetadata = readBashSandboxMetadata;
|
|
48
|
+
exports.readStringMetadata = readStringMetadata;
|
|
49
|
+
exports.isProcessModuleLoadFailure = isProcessModuleLoadFailure;
|
|
50
|
+
exports.isRetryablePromptFailure = isRetryablePromptFailure;
|
|
51
|
+
exports.isIgnorablePromptFailure = isIgnorablePromptFailure;
|
|
52
|
+
exports.promptWithRetry = promptWithRetry;
|
|
53
|
+
exports.buildWorkerSessionOptions = buildWorkerSessionOptions;
|
|
54
|
+
exports.resolveAgentCoreBackendForHarness = resolveAgentCoreBackendForHarness;
|
|
55
|
+
const path = __importStar(require("node:path"));
|
|
56
|
+
const node_fs_1 = require("node:fs");
|
|
57
|
+
const amuxHarnessMap_1 = require("../../amux/amuxHarnessMap");
|
|
58
|
+
const builtInHarness_1 = require("../../builtInHarness");
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Timeout constants
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS = process.env.VITEST
|
|
63
|
+
? [0, 0]
|
|
64
|
+
: [1_000, 3_000];
|
|
65
|
+
exports.PARENT_PROMPT_TIMEOUT_MS = 900_000;
|
|
66
|
+
exports.DEFAULT_PROMPT_TIMEOUT_MS = 900_000;
|
|
67
|
+
exports.WORKER_TIMEOUT_MS = 1_800_000;
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Metadata helpers
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
function readBooleanMetadata(metadata, key) {
|
|
72
|
+
const value = metadata?.[key];
|
|
73
|
+
if (typeof value === "boolean") {
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
if (value === "true") {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (value === "false") {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
function readBashSandboxMetadata(metadata) {
|
|
85
|
+
const value = metadata?.bashSandbox;
|
|
86
|
+
return value === "auto" || value === "secure" || value === "local"
|
|
87
|
+
? value
|
|
88
|
+
: undefined;
|
|
89
|
+
}
|
|
90
|
+
function readStringMetadata(metadata, key) {
|
|
91
|
+
const value = metadata?.[key];
|
|
92
|
+
return typeof value === "string" ? value : undefined;
|
|
93
|
+
}
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
// Error classification
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
function isProcessModuleLoadFailure(error) {
|
|
98
|
+
return error instanceof Error && /^Failed to load process module at /.test(error.message);
|
|
99
|
+
}
|
|
100
|
+
function isRetryablePromptFailure(error) {
|
|
101
|
+
const message = typeof error === "string"
|
|
102
|
+
? error
|
|
103
|
+
: error instanceof Error
|
|
104
|
+
? error.message
|
|
105
|
+
: typeof error === "object" && error !== null && "output" in error
|
|
106
|
+
? String(error.output ?? "")
|
|
107
|
+
: "";
|
|
108
|
+
if (!message) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
const normalized = message.toLowerCase();
|
|
112
|
+
return normalized.includes("the server had an error processing your request") ||
|
|
113
|
+
normalized.includes("please retry your request") ||
|
|
114
|
+
normalized.includes("temporarily unavailable") ||
|
|
115
|
+
normalized.includes("rate limit") ||
|
|
116
|
+
normalized.includes("too many requests") ||
|
|
117
|
+
normalized.includes("pitimeouterror") ||
|
|
118
|
+
normalized.includes("prompt timed out") ||
|
|
119
|
+
normalized.includes("deadline exceeded") ||
|
|
120
|
+
normalized.includes("already processing");
|
|
121
|
+
}
|
|
122
|
+
function isIgnorablePromptFailure(output) {
|
|
123
|
+
return output.includes("msg.content.filter is not a function");
|
|
124
|
+
}
|
|
125
|
+
async function promptWithRetry(args) {
|
|
126
|
+
let attempt = 0;
|
|
127
|
+
for (;;) {
|
|
128
|
+
try {
|
|
129
|
+
const result = await args.session.prompt(args.message, args.timeout);
|
|
130
|
+
if (result.success ||
|
|
131
|
+
!isRetryablePromptFailure(result.output) ||
|
|
132
|
+
attempt >= exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS.length) {
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
const delayMs = exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS[attempt] ?? 0;
|
|
136
|
+
attempt += 1;
|
|
137
|
+
args.writeVerbose?.(`[${args.label} retry] transient failure; retrying prompt attempt ${attempt}/${exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS.length} after ${delayMs}ms`);
|
|
138
|
+
args.writeVerboseData?.(`${args.label} retry failure output`, result.output);
|
|
139
|
+
if (delayMs > 0) {
|
|
140
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if (!isRetryablePromptFailure(error) || attempt >= exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS.length) {
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
const delayMs = exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS[attempt] ?? 0;
|
|
148
|
+
attempt += 1;
|
|
149
|
+
args.writeVerbose?.(`[${args.label} retry] transient exception; retrying prompt attempt ${attempt}/${exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS.length} after ${delayMs}ms`);
|
|
150
|
+
args.writeVerboseData?.(`${args.label} retry error`, error);
|
|
151
|
+
if (delayMs > 0) {
|
|
152
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
// Worker session options
|
|
159
|
+
// ---------------------------------------------------------------------------
|
|
160
|
+
function buildWorkerSessionOptions(args) {
|
|
161
|
+
const metadata = args.action.taskDef?.metadata;
|
|
162
|
+
const isolated = readBooleanMetadata(metadata, "isolated");
|
|
163
|
+
const enableCompaction = readBooleanMetadata(metadata, "enableCompaction");
|
|
164
|
+
const effectiveModel = args.delegationConfig?.model ?? args.model;
|
|
165
|
+
const effectiveTimeout = args.delegationConfig?.timeout ?? exports.WORKER_TIMEOUT_MS;
|
|
166
|
+
const effectiveToolsMode = args.delegationConfig?.toolsMode
|
|
167
|
+
?? readStringMetadata(metadata, "toolsMode")
|
|
168
|
+
?? "coding";
|
|
169
|
+
const rawThinkingLevel = args.delegationConfig?.thinkingLevel
|
|
170
|
+
?? readStringMetadata(metadata, "thinkingLevel");
|
|
171
|
+
const effectiveThinkingLevel = rawThinkingLevel === "none" ? undefined : rawThinkingLevel;
|
|
172
|
+
const effectiveBashSandbox = args.delegationConfig?.bashSandbox
|
|
173
|
+
?? readBashSandboxMetadata(metadata);
|
|
174
|
+
let appendSystemPrompt;
|
|
175
|
+
const skillNames = args.delegationConfig?.skills ?? metadata?.skills;
|
|
176
|
+
if (skillNames?.length) {
|
|
177
|
+
const skillContents = [];
|
|
178
|
+
for (const skillName of skillNames) {
|
|
179
|
+
try {
|
|
180
|
+
const candidates = [
|
|
181
|
+
path.join(args.workspace ?? process.cwd(), ".a5c", "skills", skillName, "SKILL.md"),
|
|
182
|
+
path.join(args.workspace ?? process.cwd(), ".claude", "plugins", skillName, "SKILL.md"),
|
|
183
|
+
];
|
|
184
|
+
for (const candidate of candidates) {
|
|
185
|
+
if ((0, node_fs_1.existsSync)(candidate)) {
|
|
186
|
+
skillContents.push((0, node_fs_1.readFileSync)(candidate, "utf8"));
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
catch { /* skip missing skills */ }
|
|
192
|
+
}
|
|
193
|
+
if (skillContents.length) {
|
|
194
|
+
appendSystemPrompt = [skillContents.join("\n\n---\n\n")];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const subagentName = args.delegationConfig?.subagentName ?? readStringMetadata(metadata, "subagentName");
|
|
198
|
+
let agentDir;
|
|
199
|
+
if (subagentName) {
|
|
200
|
+
const candidates = [
|
|
201
|
+
path.join(args.workspace ?? process.cwd(), ".claude", "agents", subagentName),
|
|
202
|
+
];
|
|
203
|
+
for (const candidate of candidates) {
|
|
204
|
+
if ((0, node_fs_1.existsSync)(candidate)) {
|
|
205
|
+
agentDir = candidate;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
workspace: args.workspace,
|
|
212
|
+
model: effectiveModel,
|
|
213
|
+
timeout: effectiveTimeout,
|
|
214
|
+
toolsMode: effectiveToolsMode,
|
|
215
|
+
ephemeral: true,
|
|
216
|
+
...(args.customTools?.length ? { customTools: args.customTools } : {}),
|
|
217
|
+
...(isolated !== undefined ? { isolated } : {}),
|
|
218
|
+
...(enableCompaction !== undefined ? { enableCompaction } : {}),
|
|
219
|
+
...(effectiveBashSandbox ? { bashSandbox: effectiveBashSandbox } : {}),
|
|
220
|
+
...(effectiveThinkingLevel ? { thinkingLevel: effectiveThinkingLevel } : {}),
|
|
221
|
+
...(appendSystemPrompt ? { appendSystemPrompt } : {}),
|
|
222
|
+
...(agentDir ? { agentDir } : {}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
// Harness → backend resolution
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
function resolveAgentCoreBackendForHarness(harnessName) {
|
|
229
|
+
const normalizedHarness = (0, builtInHarness_1.normalizeBuiltInHarnessName)(harnessName?.trim() ?? "");
|
|
230
|
+
if (!normalizedHarness || normalizedHarness === "agent-core") {
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
if (normalizedHarness === "pi") {
|
|
234
|
+
return "pi";
|
|
235
|
+
}
|
|
236
|
+
if ((0, amuxHarnessMap_1.hasAmuxAdapter)(normalizedHarness)) {
|
|
237
|
+
return (0, amuxHarnessMap_1.mapHarnessToAmuxAdapter)(normalizedHarness);
|
|
238
|
+
}
|
|
239
|
+
return normalizedHarness;
|
|
240
|
+
}
|
|
@@ -165,7 +165,7 @@ async function resolveEffect(action, harnessName, options, piSession, discovered
|
|
|
165
165
|
const piResult = await (0, utils_1.promptPiWithRetry)({
|
|
166
166
|
session: piSession,
|
|
167
167
|
message: prompt,
|
|
168
|
-
timeout: utils_1.
|
|
168
|
+
timeout: utils_1.WORKER_TIMEOUT_MS,
|
|
169
169
|
label: `effect ${action.effectId}`,
|
|
170
170
|
});
|
|
171
171
|
return {
|
|
@@ -43,7 +43,7 @@ async function invokePromptEffect(action, taskHarness, prompt, options, piSessio
|
|
|
43
43
|
const piResult = await (0, utils_1.promptPiWithRetry)({
|
|
44
44
|
session: piSession,
|
|
45
45
|
message: (0, utils_1.compressInternalHarnessPrompt)(prompt, options.compressionConfig, "skill"),
|
|
46
|
-
timeout: utils_1.
|
|
46
|
+
timeout: utils_1.WORKER_TIMEOUT_MS, label: `effect ${action.effectId}`,
|
|
47
47
|
});
|
|
48
48
|
return {
|
|
49
49
|
status: piResult.success ? "ok" : "error",
|
|
@@ -90,7 +90,7 @@ async function recoverExternalProcessError(args) {
|
|
|
90
90
|
await (0, utils_1.promptPiWithRetry)({
|
|
91
91
|
session: recoverySession,
|
|
92
92
|
message: recoveryPrompt,
|
|
93
|
-
timeout: utils_1.
|
|
93
|
+
timeout: utils_1.WORKER_TIMEOUT_MS,
|
|
94
94
|
label: "process-error-recovery",
|
|
95
95
|
});
|
|
96
96
|
}
|
|
@@ -272,7 +272,7 @@ async function runInternalOrchestrationPhase(args) {
|
|
|
272
272
|
result = await (0, utils_1.promptPiWithRetry)({
|
|
273
273
|
session: orchestrationSession,
|
|
274
274
|
message: (0, utils_1.compressInternalHarnessPrompt)(message, args.compressionConfig, "agent"),
|
|
275
|
-
timeout: utils_1.
|
|
275
|
+
timeout: utils_1.PARENT_PROMPT_TIMEOUT_MS,
|
|
276
276
|
label,
|
|
277
277
|
writeVerbose,
|
|
278
278
|
writeVerboseData,
|
|
@@ -1,34 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export declare function readStringMetadata(metadata: Record<string, unknown> | undefined, key: string): string | undefined;
|
|
11
|
-
export declare function isProcessModuleLoadFailure(error: unknown): boolean;
|
|
12
|
-
export declare function isRetryablePiPromptFailure(error: unknown): boolean;
|
|
13
|
-
export declare function isIgnorablePiPromptFailure(output: string): boolean;
|
|
14
|
-
type PromptCapableSession = {
|
|
15
|
-
prompt(text: string, timeout?: number): Promise<AgentCorePromptResult>;
|
|
16
|
-
};
|
|
17
|
-
export declare function promptPiWithRetry(args: {
|
|
18
|
-
session: PromptCapableSession;
|
|
19
|
-
message: string;
|
|
20
|
-
timeout: number;
|
|
21
|
-
label: string;
|
|
22
|
-
writeVerbose?: (message: string) => void;
|
|
23
|
-
writeVerboseData?: (label: string, value: unknown, maxChars?: number) => void;
|
|
24
|
-
}): Promise<AgentCorePromptResult>;
|
|
25
|
-
export declare function buildPiWorkerSessionOptions(args: {
|
|
26
|
-
action: EffectAction;
|
|
27
|
-
workspace?: string;
|
|
28
|
-
model?: string;
|
|
29
|
-
customTools?: unknown[];
|
|
30
|
-
delegationConfig?: DelegationConfig;
|
|
31
|
-
}): AgentCoreSessionOptions;
|
|
32
|
-
export declare function resolveAgentCoreBackendForHarness(harnessName?: string): string | undefined;
|
|
33
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Legacy Pi module — re-exports from agent-core-loop.ts for backwards compat.
|
|
3
|
+
*
|
|
4
|
+
* All canonical implementations now live in ./agent-core-loop.ts.
|
|
5
|
+
* This file preserves the old Pi-prefixed names so existing imports
|
|
6
|
+
* continue to work during migration.
|
|
7
|
+
*/
|
|
8
|
+
export { TRANSIENT_PROMPT_RETRY_DELAYS_MS, PARENT_PROMPT_TIMEOUT_MS, DEFAULT_PROMPT_TIMEOUT_MS, WORKER_TIMEOUT_MS, readBooleanMetadata, readBashSandboxMetadata, readStringMetadata, isProcessModuleLoadFailure, isRetryablePromptFailure, isIgnorablePromptFailure, promptWithRetry, buildWorkerSessionOptions, resolveAgentCoreBackendForHarness, } from "./agent-core-loop";
|
|
9
|
+
export { TRANSIENT_PROMPT_RETRY_DELAYS_MS as TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS, PARENT_PROMPT_TIMEOUT_MS as PI_PARENT_PROMPT_TIMEOUT_MS, DEFAULT_PROMPT_TIMEOUT_MS as PI_DEFAULT_PROMPT_TIMEOUT_MS, WORKER_TIMEOUT_MS as PI_WORKER_TIMEOUT_MS, isRetryablePromptFailure as isRetryablePiPromptFailure, isIgnorablePromptFailure as isIgnorablePiPromptFailure, promptWithRetry as promptPiWithRetry, buildWorkerSessionOptions as buildPiWorkerSessionOptions, } from "./agent-core-loop";
|
|
34
10
|
//# sourceMappingURL=pi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../../../src/harness/internal/createRun/pi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../../../src/harness/internal/createRun/pi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,gCAAgC,EAChC,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EACzB,iCAAiC,GAClC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,gCAAgC,IAAI,mCAAmC,EACvE,wBAAwB,IAAI,2BAA2B,EACvD,yBAAyB,IAAI,4BAA4B,EACzD,iBAAiB,IAAI,oBAAoB,EACzC,wBAAwB,IAAI,0BAA0B,EACtD,wBAAwB,IAAI,0BAA0B,EACtD,eAAe,IAAI,iBAAiB,EACpC,yBAAyB,IAAI,2BAA2B,GACzD,MAAM,mBAAmB,CAAC"}
|