@bastani/atomic 0.9.40 → 0.9.41-alpha.1
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/CHANGELOG.md +50 -0
- package/README.md +1 -1
- package/dist/builtin/intercom/CHANGELOG.md +12 -0
- package/dist/builtin/intercom/README.md +1 -1
- package/dist/builtin/intercom/broker/broker.ts +24 -21
- package/dist/builtin/intercom/broker/client.ts +97 -6
- package/dist/builtin/intercom/broker/list-reply.ts +53 -0
- package/dist/builtin/intercom/index.bundle.mjs +278 -46
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/recoverable-disconnect.ts +27 -1
- package/dist/builtin/intercom/types.ts +8 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +14 -0
- package/dist/builtin/subagents/README.md +14 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +99 -19
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +25 -0
- package/dist/builtin/workflows/README.md +2 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/authoring.d.ts +1 -1
- package/dist/builtin/workflows/src/durable/journal/internal.d.ts +16 -0
- package/dist/builtin/workflows/src/durable/journal/legacy-journal-tables.d.ts +9 -0
- package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +6 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +441 -90
- package/dist/builtin/workflows/src/index.js +226 -34
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +17 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +1 -1
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts +2 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +33 -18
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +2 -1
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +114 -21
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +6 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-state.d.ts +19 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +41 -6
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts +3 -1
- package/dist/core/auth-storage-backends.d.ts.map +1 -1
- package/dist/core/auth-storage-backends.js +79 -12
- package/dist/core/auth-storage-backends.js.map +1 -1
- package/dist/core/client-identity.d.ts +8 -0
- package/dist/core/client-identity.d.ts.map +1 -0
- package/dist/core/client-identity.js +16 -0
- package/dist/core/client-identity.js.map +1 -0
- package/dist/core/compaction/planner-outcome.d.ts.map +1 -1
- package/dist/core/compaction/planner-outcome.js +2 -1
- package/dist/core/compaction/planner-outcome.js.map +1 -1
- package/dist/core/execution-model-router.d.ts +18 -0
- package/dist/core/execution-model-router.d.ts.map +1 -1
- package/dist/core/execution-model-router.js +14 -8
- package/dist/core/execution-model-router.js.map +1 -1
- package/dist/core/extension-oauth-refresh-rejection.d.ts +12 -0
- package/dist/core/extension-oauth-refresh-rejection.d.ts.map +1 -0
- package/dist/core/extension-oauth-refresh-rejection.js +70 -0
- package/dist/core/extension-oauth-refresh-rejection.js.map +1 -0
- package/dist/core/extension-startup-failure.d.ts +30 -0
- package/dist/core/extension-startup-failure.d.ts.map +1 -0
- package/dist/core/extension-startup-failure.js +62 -0
- package/dist/core/extension-startup-failure.js.map +1 -0
- package/dist/core/extensions/context-types.d.ts +2 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +2 -0
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +1 -0
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +8 -0
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +1 -0
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/workflow-run-control-hub.d.ts +1 -0
- package/dist/core/extensions/workflow-run-control-hub.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control-hub.js +3 -0
- package/dist/core/extensions/workflow-run-control-hub.js.map +1 -1
- package/dist/core/extensions/workflow-run-control.d.ts +8 -0
- package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control.js.map +1 -1
- package/dist/core/model-fallback-failures.d.ts.map +1 -1
- package/dist/core/model-fallback-failures.js +12 -0
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/model-resolver-defaults.js +1 -1
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/model-runtime-streaming.d.ts.map +1 -1
- package/dist/core/model-runtime-streaming.js +9 -3
- package/dist/core/model-runtime-streaming.js.map +1 -1
- package/dist/core/model-runtime.d.ts +5 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +6 -0
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer-internal.d.ts +6 -5
- package/dist/core/provider-composer-internal.d.ts.map +1 -1
- package/dist/core/provider-composer-internal.js +13 -2
- package/dist/core/provider-composer-internal.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +12 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/storage/session/sql-session-store.d.ts +35 -0
- package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/sql-session-store.js +158 -42
- package/dist/core/storage/session/sql-session-store.js.map +1 -1
- package/dist/core/structured-output/deadline.d.ts +40 -0
- package/dist/core/structured-output/deadline.d.ts.map +1 -0
- package/dist/core/structured-output/deadline.js +110 -0
- package/dist/core/structured-output/deadline.js.map +1 -0
- package/dist/core/structured-output/index.d.ts.map +1 -1
- package/dist/core/structured-output/index.js +103 -47
- package/dist/core/structured-output/index.js.map +1 -1
- package/dist/core/structured-output/rejection-detail.d.ts +9 -0
- package/dist/core/structured-output/rejection-detail.d.ts.map +1 -0
- package/dist/core/structured-output/rejection-detail.js +129 -0
- package/dist/core/structured-output/rejection-detail.js.map +1 -0
- package/dist/core/structured-output/types.d.ts +8 -1
- package/dist/core/structured-output/types.d.ts.map +1 -1
- package/dist/core/structured-output/types.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +7 -1
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +28 -6
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/contracts.d.ts +6 -1
- package/dist/core/tasks/contracts.d.ts.map +1 -1
- package/dist/core/tasks/contracts.js.map +1 -1
- package/dist/core/tasks/pause.d.ts +2 -1
- package/dist/core/tasks/pause.d.ts.map +1 -1
- package/dist/core/tasks/pause.js +3 -2
- package/dist/core/tasks/pause.js.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.js +10 -5
- package/dist/core/tools/bash-pty-native.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +16 -32
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/kill.d.ts.map +1 -1
- package/dist/core/tools/kill.js +17 -3
- package/dist/core/tools/kill.js.map +1 -1
- package/dist/core/tools/shell-task-render.d.ts +55 -0
- package/dist/core/tools/shell-task-render.d.ts.map +1 -0
- package/dist/core/tools/shell-task-render.js +123 -0
- package/dist/core/tools/shell-task-render.js.map +1 -0
- package/dist/core/tools/shell-task-status.d.ts +52 -0
- package/dist/core/tools/shell-task-status.d.ts.map +1 -0
- package/dist/core/tools/shell-task-status.js +184 -0
- package/dist/core/tools/shell-task-status.js.map +1 -0
- package/dist/core/tools/structured-output.d.ts +5 -0
- package/dist/core/tools/structured-output.d.ts.map +1 -1
- package/dist/core/tools/structured-output.js +3 -0
- package/dist/core/tools/structured-output.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +134 -57
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +3 -2
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -0
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js +3 -0
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +19 -6
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-row.js +11 -1
- package/dist/modes/interactive/components/task-row.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js +12 -10
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +20 -30
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js +23 -96
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +7 -8
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +27 -4
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +20 -10
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +40 -5
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +2 -4
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts +4 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
- package/dist/modes/interactive/interactive-prompt-restore.d.ts +3 -0
- package/dist/modes/interactive/interactive-prompt-restore.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-prompt-restore.js +9 -1
- package/dist/modes/interactive/interactive-prompt-restore.js.map +1 -1
- package/dist/modes/interactive/interactive-prompt-turn.js +30 -2
- package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +43 -8
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +12 -3
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/theme/color-utils.d.ts +6 -1
- package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -1
- package/dist/modes/interactive/theme/color-utils.js +39 -17
- package/dist/modes/interactive/theme/color-utils.js.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +2 -2
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme-tokens.d.ts +6 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-tokens.js +7 -3
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-auth.d.ts +3 -0
- package/dist/modes/interactive-engine/isolated-auth.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-auth.js +13 -1
- package/dist/modes/interactive-engine/isolated-auth.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +11 -2
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.d.ts +8 -0
- package/dist/modes/interactive-engine/remote-model-catalog.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.js +54 -0
- package/dist/modes/interactive-engine/remote-model-catalog.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +4 -13
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-model-catalog.d.ts +9 -0
- package/dist/modes/rpc/rpc-model-catalog.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-model-catalog.js +19 -0
- package/dist/modes/rpc/rpc-model-catalog.js.map +1 -0
- package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.js +2 -6
- package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +6 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/changelog.d.ts +6 -0
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +11 -0
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +4 -0
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +3 -2
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/background-tasks.md +5 -3
- package/docs/codemode.md +2 -2
- package/docs/custom-provider/oauth.md +42 -1
- package/docs/custom-provider/registration.md +2 -0
- package/docs/environment-variables.md +1 -0
- package/docs/extensions/api-reference.md +3 -4
- package/docs/extensions/authoring.md +1 -1
- package/docs/extensions/events.md +1 -1
- package/docs/providers.md +3 -3
- package/docs/rpc/protocol.md +4 -2
- package/docs/sdk/reference.md +2 -0
- package/docs/sdk/structured-decisions.md +7 -5
- package/docs/sdk.md +5 -2
- package/docs/settings.md +4 -2
- package/docs/subagents/reference.md +1 -1
- package/docs/subagents.md +15 -1
- package/docs/themes/reference.md +3 -1
- package/docs/usage.md +3 -1
- package/docs/workflows/api-reference.md +28 -0
- package/docs/workflows/operations.md +2 -2
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
- package/dist/core/provider-attribution.d.ts +0 -4
- package/dist/core/provider-attribution.d.ts.map +0 -1
- package/dist/core/provider-attribution.js +0 -87
- package/dist/core/provider-attribution.js.map +0 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Errors } from "typebox/value";
|
|
2
|
+
export const SCHEMA_MISMATCH_PREFIX = "Invalid structured output: response does not match the decision schema.";
|
|
3
|
+
export const UNPARSEABLE_ARGUMENTS_PREFIX = "Invalid structured output: tool call arguments were not valid JSON.";
|
|
4
|
+
const MAX_LISTED_ERRORS = 5;
|
|
5
|
+
const MAX_LINE_LENGTH = 160;
|
|
6
|
+
const MAX_LISTED_LITERALS = 6;
|
|
7
|
+
function truncate(text, limit) {
|
|
8
|
+
return text.length > limit ? `${text.slice(0, limit)}…` : text;
|
|
9
|
+
}
|
|
10
|
+
function jsonKind(value) {
|
|
11
|
+
if (value === null)
|
|
12
|
+
return "null";
|
|
13
|
+
if (Array.isArray(value))
|
|
14
|
+
return "array";
|
|
15
|
+
return value === undefined ? "undefined" : typeof value;
|
|
16
|
+
}
|
|
17
|
+
function valueAt(root, pointer) {
|
|
18
|
+
let current = root;
|
|
19
|
+
for (const encoded of pointer.split("/").slice(1)) {
|
|
20
|
+
const key = encoded.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
21
|
+
if (typeof current !== "object" || current === null || !Object.hasOwn(current, key))
|
|
22
|
+
return undefined;
|
|
23
|
+
current = current[key];
|
|
24
|
+
}
|
|
25
|
+
return current;
|
|
26
|
+
}
|
|
27
|
+
function childPath(parent, key) {
|
|
28
|
+
return `${parent}/${key.replaceAll("~", "~0").replaceAll("/", "~1")}`;
|
|
29
|
+
}
|
|
30
|
+
function strings(value) {
|
|
31
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
32
|
+
}
|
|
33
|
+
function isUnion(error) {
|
|
34
|
+
return error.keyword === "anyOf" || error.keyword === "oneOf";
|
|
35
|
+
}
|
|
36
|
+
function isExpectation(error) {
|
|
37
|
+
return error.keyword === "const" || error.keyword === "type";
|
|
38
|
+
}
|
|
39
|
+
function expectation(error) {
|
|
40
|
+
const { params } = error;
|
|
41
|
+
if ("allowedValue" in params)
|
|
42
|
+
return truncate(JSON.stringify(params.allowedValue) ?? "", 40);
|
|
43
|
+
return "type" in params ? [params.type].flat().join(" or ") : "";
|
|
44
|
+
}
|
|
45
|
+
function describeError(error, alternatives) {
|
|
46
|
+
const path = error.instancePath;
|
|
47
|
+
const label = path || "/";
|
|
48
|
+
switch (error.keyword) {
|
|
49
|
+
case "required":
|
|
50
|
+
return strings(error.params.requiredProperties).map((key) => ({ line: `${childPath(path, key)}: required` }));
|
|
51
|
+
case "additionalProperties":
|
|
52
|
+
return strings(error.params.additionalProperties).map((key) => ({
|
|
53
|
+
line: `${childPath(path, key)}: not allowed`,
|
|
54
|
+
}));
|
|
55
|
+
case "boolean":
|
|
56
|
+
return [{ line: `${label}: not allowed` }];
|
|
57
|
+
case "type":
|
|
58
|
+
case "const":
|
|
59
|
+
return [{ path, expected: expectation(error) }];
|
|
60
|
+
case "anyOf":
|
|
61
|
+
case "oneOf": {
|
|
62
|
+
const sameLevel = alternatives.filter((alternative) => alternative.instancePath === path);
|
|
63
|
+
if (sameLevel.length === alternatives.length && sameLevel.every(isExpectation))
|
|
64
|
+
return sameLevel.map((alternative) => ({ path, expected: expectation(alternative) }));
|
|
65
|
+
return [{ path, expected: "a value matching one of the allowed schemas" }];
|
|
66
|
+
}
|
|
67
|
+
default:
|
|
68
|
+
return [{ line: `${label}: ${error.message}` }];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** One line per failing path with the expected shape. Never includes any part of the rejected value. */
|
|
72
|
+
export function describeSchemaErrors(schema, value) {
|
|
73
|
+
const errors = Errors(schema, value);
|
|
74
|
+
const unions = errors.filter(isUnion);
|
|
75
|
+
const within = (error, union) => error !== union &&
|
|
76
|
+
(error.instancePath === union.instancePath || error.instancePath.startsWith(`${union.instancePath}/`));
|
|
77
|
+
const expectations = new Map();
|
|
78
|
+
const lines = new Map();
|
|
79
|
+
for (const error of errors) {
|
|
80
|
+
if (unions.some((union) => within(error, union)))
|
|
81
|
+
continue;
|
|
82
|
+
const alternatives = isUnion(error) ? errors.filter((candidate) => within(candidate, error)) : [];
|
|
83
|
+
for (const finding of describeError(error, alternatives)) {
|
|
84
|
+
if ("line" in finding)
|
|
85
|
+
lines.set(finding.line, finding.line);
|
|
86
|
+
else {
|
|
87
|
+
const listed = expectations.get(finding.path) ?? [];
|
|
88
|
+
if (!listed.includes(finding.expected))
|
|
89
|
+
listed.push(finding.expected);
|
|
90
|
+
expectations.set(finding.path, listed);
|
|
91
|
+
lines.set(`expected:${finding.path}`, finding.path);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return [...lines].map(([key, line]) => {
|
|
96
|
+
if (!key.startsWith("expected:"))
|
|
97
|
+
return truncate(line, MAX_LINE_LENGTH);
|
|
98
|
+
const listed = expectations.get(line) ?? [];
|
|
99
|
+
const shown = listed.slice(0, MAX_LISTED_LITERALS).join(" or ");
|
|
100
|
+
const got = jsonKind(valueAt(value, line));
|
|
101
|
+
return truncate(`${line || "/"}: expected ${shown}${listed.length > MAX_LISTED_LITERALS ? " or …" : ""}, got ${got}`, MAX_LINE_LENGTH);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
export function schemaMismatchMessage(lines) {
|
|
105
|
+
if (lines.length === 0)
|
|
106
|
+
return `${SCHEMA_MISMATCH_PREFIX} The decision failed validation against the original candidates and constraints.`;
|
|
107
|
+
const omitted = lines.length - MAX_LISTED_ERRORS;
|
|
108
|
+
return `${SCHEMA_MISMATCH_PREFIX} Failing paths: ${lines.slice(0, MAX_LISTED_ERRORS).join("; ")}${omitted > 0 ? `; and ${omitted} more` : ""}.`;
|
|
109
|
+
}
|
|
110
|
+
const PARSER_FAILURE_CATEGORIES = [
|
|
111
|
+
[/^Unexpected end of JSON input/, "the JSON ended before the value was complete"],
|
|
112
|
+
[/^Unexpected non-whitespace character after JSON/, "unexpected content followed the JSON value"],
|
|
113
|
+
[/^Unexpected token/, "an unexpected character was found"],
|
|
114
|
+
[/^(Expected|Unterminated|Bad (control|escaped) character)/, "the JSON syntax was malformed"],
|
|
115
|
+
[/^Tool arguments must be a JSON object/, "the arguments were not a JSON object"],
|
|
116
|
+
];
|
|
117
|
+
function parserFailureCategory(parserLine) {
|
|
118
|
+
return (PARSER_FAILURE_CATEGORIES.find(([pattern]) => pattern.test(parserLine))?.[1] ?? "the parser rejected the input");
|
|
119
|
+
}
|
|
120
|
+
function parserPosition(parserLine) {
|
|
121
|
+
const position = /\bat position (\d{1,9})\b/.exec(parserLine)?.[1];
|
|
122
|
+
return position === undefined ? "" : ` at position ${position}`;
|
|
123
|
+
}
|
|
124
|
+
/** Parser messages quote the rejected input, so only a fixed category and a numeric position are surfaced. */
|
|
125
|
+
export function unparseableArgumentsMessage(argumentsError) {
|
|
126
|
+
const parserLine = argumentsError.split("\n", 1)[0].trim();
|
|
127
|
+
return `${UNPARSEABLE_ARGUMENTS_PREFIX} Parsing failed${parserPosition(parserLine)}: ${parserFailureCategory(parserLine)}.`;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=rejection-detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rejection-detail.js","sourceRoot":"","sources":["../../../src/core/structured-output/rejection-detail.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,yEAAyE,CAAC;AAChH,MAAM,CAAC,MAAM,4BAA4B,GAAG,qEAAqE,CAAC;AAElH,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,SAAS,QAAQ,CAAC,IAAY,EAAE,KAAa;IAC5C,OAAO,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAChE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACzC,OAAO,KAAK,KAAK,SAAS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AAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,+BAA+B,CAC/G,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,UAAkB;IACzC,MAAM,QAAQ,GAAG,2BAA2B,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnE,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,QAAQ,EAAE,CAAC;AACjE,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,2BAA2B,CAAC,cAAsB;IACjE,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3D,OAAO,GAAG,4BAA4B,kBAAkB,cAAc,CAAC,UAAU,CAAC,KAAK,qBAAqB,CAAC,UAAU,CAAC,GAAG,CAAC;AAC7H,CAAC","sourcesContent":["import type { TSchema } from \"typebox\";\nimport type { TLocalizedValidationError } from \"typebox/error\";\nimport { Errors } from \"typebox/value\";\n\nexport const SCHEMA_MISMATCH_PREFIX = \"Invalid structured output: response does not match the decision schema.\";\nexport const UNPARSEABLE_ARGUMENTS_PREFIX = \"Invalid structured output: tool call arguments were not valid JSON.\";\n\nconst MAX_LISTED_ERRORS = 5;\nconst MAX_LINE_LENGTH = 160;\nconst MAX_LISTED_LITERALS = 6;\n\nfunction truncate(text: string, limit: number): string {\n\treturn text.length > limit ? `${text.slice(0, limit)}…` : text;\n}\n\nfunction jsonKind(value: unknown): string {\n\tif (value === null) return \"null\";\n\tif (Array.isArray(value)) return \"array\";\n\treturn value === undefined ? \"undefined\" : typeof value;\n}\n\nfunction valueAt(root: unknown, pointer: string): unknown {\n\tlet current = root;\n\tfor (const encoded of pointer.split(\"/\").slice(1)) {\n\t\tconst key = encoded.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\");\n\t\tif (typeof current !== \"object\" || current === null || !Object.hasOwn(current, key)) return undefined;\n\t\tcurrent = (current as Record<string, unknown>)[key];\n\t}\n\treturn current;\n}\n\nfunction childPath(parent: string, key: string): string {\n\treturn `${parent}/${key.replaceAll(\"~\", \"~0\").replaceAll(\"/\", \"~1\")}`;\n}\n\nfunction strings(value: unknown): string[] {\n\treturn Array.isArray(value) ? value.filter((item): item is string => typeof item === \"string\") : [];\n}\n\nfunction isUnion(error: TLocalizedValidationError): boolean {\n\treturn error.keyword === \"anyOf\" || error.keyword === \"oneOf\";\n}\n\nfunction isExpectation(error: TLocalizedValidationError): boolean {\n\treturn error.keyword === \"const\" || error.keyword === \"type\";\n}\n\nfunction expectation(error: TLocalizedValidationError): string {\n\tconst { params } = error;\n\tif (\"allowedValue\" in params) return truncate(JSON.stringify(params.allowedValue) ?? \"\", 40);\n\treturn \"type\" in params ? [params.type].flat().join(\" or \") : \"\";\n}\n\ntype Finding = { readonly line: string } | { readonly path: string; readonly expected: string };\n\nfunction describeError(\n\terror: TLocalizedValidationError,\n\talternatives: readonly TLocalizedValidationError[],\n): Finding[] {\n\tconst path = error.instancePath;\n\tconst label = path || \"/\";\n\tswitch (error.keyword) {\n\t\tcase \"required\":\n\t\t\treturn strings(error.params.requiredProperties).map((key) => ({ line: `${childPath(path, key)}: required` }));\n\t\tcase \"additionalProperties\":\n\t\t\treturn strings(error.params.additionalProperties).map((key) => ({\n\t\t\t\tline: `${childPath(path, key)}: not allowed`,\n\t\t\t}));\n\t\tcase \"boolean\":\n\t\t\treturn [{ line: `${label}: not allowed` }];\n\t\tcase \"type\":\n\t\tcase \"const\":\n\t\t\treturn [{ path, expected: expectation(error) }];\n\t\tcase \"anyOf\":\n\t\tcase \"oneOf\": {\n\t\t\tconst sameLevel = alternatives.filter((alternative) => alternative.instancePath === path);\n\t\t\tif (sameLevel.length === alternatives.length && sameLevel.every(isExpectation))\n\t\t\t\treturn sameLevel.map((alternative) => ({ path, expected: expectation(alternative) }));\n\t\t\treturn [{ path, expected: \"a value matching one of the allowed schemas\" }];\n\t\t}\n\t\tdefault:\n\t\t\treturn [{ line: `${label}: ${error.message}` }];\n\t}\n}\n\n/** One line per failing path with the expected shape. Never includes any part of the rejected value. */\nexport function describeSchemaErrors(schema: TSchema, value: unknown): string[] {\n\tconst errors = Errors(schema, value);\n\tconst unions = errors.filter(isUnion);\n\tconst within = (error: TLocalizedValidationError, union: TLocalizedValidationError): boolean =>\n\t\terror !== union &&\n\t\t(error.instancePath === union.instancePath || error.instancePath.startsWith(`${union.instancePath}/`));\n\tconst expectations = new Map<string, string[]>();\n\tconst lines = new Map<string, string>();\n\tfor (const error of errors) {\n\t\tif (unions.some((union) => within(error, union))) continue;\n\t\tconst alternatives = isUnion(error) ? errors.filter((candidate) => within(candidate, error)) : [];\n\t\tfor (const finding of describeError(error, alternatives)) {\n\t\t\tif (\"line\" in finding) lines.set(finding.line, finding.line);\n\t\t\telse {\n\t\t\t\tconst listed = expectations.get(finding.path) ?? [];\n\t\t\t\tif (!listed.includes(finding.expected)) listed.push(finding.expected);\n\t\t\t\texpectations.set(finding.path, listed);\n\t\t\t\tlines.set(`expected:${finding.path}`, finding.path);\n\t\t\t}\n\t\t}\n\t}\n\treturn [...lines].map(([key, line]) => {\n\t\tif (!key.startsWith(\"expected:\")) return truncate(line, MAX_LINE_LENGTH);\n\t\tconst listed = expectations.get(line) ?? [];\n\t\tconst shown = listed.slice(0, MAX_LISTED_LITERALS).join(\" or \");\n\t\tconst got = jsonKind(valueAt(value, line));\n\t\treturn truncate(\n\t\t\t`${line || \"/\"}: expected ${shown}${listed.length > MAX_LISTED_LITERALS ? \" or …\" : \"\"}, got ${got}`,\n\t\t\tMAX_LINE_LENGTH,\n\t\t);\n\t});\n}\n\nexport function schemaMismatchMessage(lines: readonly string[]): string {\n\tif (lines.length === 0)\n\t\treturn `${SCHEMA_MISMATCH_PREFIX} The decision failed validation against the original candidates and constraints.`;\n\tconst omitted = lines.length - MAX_LISTED_ERRORS;\n\treturn `${SCHEMA_MISMATCH_PREFIX} Failing paths: ${lines.slice(0, MAX_LISTED_ERRORS).join(\"; \")}${omitted > 0 ? `; and ${omitted} more` : \"\"}.`;\n}\n\nconst PARSER_FAILURE_CATEGORIES: readonly (readonly [RegExp, string])[] = [\n\t[/^Unexpected end of JSON input/, \"the JSON ended before the value was complete\"],\n\t[/^Unexpected non-whitespace character after JSON/, \"unexpected content followed the JSON value\"],\n\t[/^Unexpected token/, \"an unexpected character was found\"],\n\t[/^(Expected|Unterminated|Bad (control|escaped) character)/, \"the JSON syntax was malformed\"],\n\t[/^Tool arguments must be a JSON object/, \"the arguments were not a JSON object\"],\n];\n\nfunction parserFailureCategory(parserLine: string): string {\n\treturn (\n\t\tPARSER_FAILURE_CATEGORIES.find(([pattern]) => pattern.test(parserLine))?.[1] ?? \"the parser rejected the input\"\n\t);\n}\n\nfunction parserPosition(parserLine: string): string {\n\tconst position = /\\bat position (\\d{1,9})\\b/.exec(parserLine)?.[1];\n\treturn position === undefined ? \"\" : ` at position ${position}`;\n}\n\n/** Parser messages quote the rejected input, so only a fixed category and a numeric position are surfaced. */\nexport function unparseableArgumentsMessage(argumentsError: string): string {\n\tconst parserLine = argumentsError.split(\"\\n\", 1)[0].trim();\n\treturn `${UNPARSEABLE_ARGUMENTS_PREFIX} Parsing failed${parserPosition(parserLine)}: ${parserFailureCategory(parserLine)}.`;\n}\n"]}
|
|
@@ -9,7 +9,7 @@ export interface StructuredChoiceQuestion {
|
|
|
9
9
|
readonly criteria: Readonly<Record<string, string>>;
|
|
10
10
|
}
|
|
11
11
|
export interface RouterModelSelectionOptions {
|
|
12
|
-
readonly settings: Pick<SettingsManager, "getRouterModel"> & Partial<Pick<SettingsManager, "getRetrySettings">>;
|
|
12
|
+
readonly settings: Pick<SettingsManager, "getRouterModel"> & Partial<Pick<SettingsManager, "getRetrySettings" | "getHttpIdleTimeoutMs">>;
|
|
13
13
|
readonly modelRegistry: Pick<ModelRegistry, "getAll"> & Partial<Pick<ModelRegistry, "getProviderAuthStatus" | "getClassifierModel" | "classify">>;
|
|
14
14
|
/** Read the active chat model at invocation time; never change it to perform a decision. */
|
|
15
15
|
readonly currentModel?: Model<Api>;
|
|
@@ -42,6 +42,13 @@ export interface StructuredOutputRequest<T extends TSchema> {
|
|
|
42
42
|
readonly signal?: AbortSignal;
|
|
43
43
|
readonly maxTokens?: number;
|
|
44
44
|
readonly retry?: RetryPolicy;
|
|
45
|
+
/**
|
|
46
|
+
* Wall-clock limit in milliseconds for the whole decision: every repair attempt, transport retry and model
|
|
47
|
+
* candidate together. A positive integer. When omitted, the `structured_output` tool uses its session's
|
|
48
|
+
* `httpIdleTimeoutMs` setting and any other call uses that setting's default of 10 minutes. A disabled idle
|
|
49
|
+
* timeout (0) leaves only the largest timer delay, about 24.8 days.
|
|
50
|
+
*/
|
|
51
|
+
readonly timeoutMs?: number;
|
|
45
52
|
}
|
|
46
53
|
export interface InternalStructuredOutputRequest<T extends TSchema> extends Omit<StructuredOutputRequest<T>, "model" | "modelRegistry"> {
|
|
47
54
|
readonly model: StructuredOutputModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/structured-output/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,wFAAwF;AACxF,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,C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CAC/G;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAChF,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5F,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;CACjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/structured-output/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Api, ClassifierApi, ClassifierModel, Model, RetryPolicy } from \"@bastani/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\nimport type { ModelRegistry } from \"../model-registry.ts\";\nimport type { SettingsManager } from \"../settings-manager.ts\";\nimport type { JsonObject } from \"../tools/structured-output.ts\";\n\n/** A semantic judgment, not an execution instruction. IDs are only correlation keys. */\nexport interface StructuredChoiceQuestion {\n\treadonly instructions: string;\n\treadonly criteria: Readonly<Record<string, string>>;\n}\n\nexport interface RouterModelSelectionOptions {\n\treadonly settings: Pick<SettingsManager, \"getRouterModel\">
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/structured-output/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Api, ClassifierApi, ClassifierModel, Model, RetryPolicy } from \"@bastani/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\nimport type { ModelRegistry } from \"../model-registry.ts\";\nimport type { SettingsManager } from \"../settings-manager.ts\";\nimport type { JsonObject } from \"../tools/structured-output.ts\";\n\n/** A semantic judgment, not an execution instruction. IDs are only correlation keys. */\nexport interface StructuredChoiceQuestion {\n\treadonly instructions: string;\n\treadonly criteria: Readonly<Record<string, string>>;\n}\n\nexport interface RouterModelSelectionOptions {\n\treadonly settings: Pick<SettingsManager, \"getRouterModel\"> &\n\t\tPartial<Pick<SettingsManager, \"getRetrySettings\" | \"getHttpIdleTimeoutMs\">>;\n\treadonly modelRegistry: Pick<ModelRegistry, \"getAll\"> &\n\t\tPartial<Pick<ModelRegistry, \"getProviderAuthStatus\" | \"getClassifierModel\" | \"classify\">>;\n\t/** Read the active chat model at invocation time; never change it to perform a decision. */\n\treadonly currentModel?: Model<Api>;\n}\n\nexport type StructuredOutputModel =\n\t| { readonly kind: \"chat\"; readonly fullId: string; readonly model: Model<Api> }\n\t| { readonly kind: \"classifier\"; readonly fullId: string; readonly model: ClassifierModel<ClassifierApi> };\n\nexport interface ModelAttempt {\n\treadonly model: string;\n\treadonly skipped?: boolean;\n\treadonly skipReason?: string;\n\treadonly error?: string;\n}\n\nexport interface StructuredOutputRequest<T extends TSchema> {\n\treadonly model?: string;\n\treadonly fallbackModels?: readonly string[];\n\treadonly currentModel?: Model<Api>;\n\treadonly modelRegistry: Pick<ModelRegistry, \"streamSimple\" | \"getAll\"> &\n\t\tPartial<Pick<ModelRegistry, \"getClassifierModel\" | \"classify\">>;\n\t/** Supply actual task, facts, constraints and reference text. Never supply credentials. */\n\treadonly state: JsonObject;\n\treadonly instructions: string;\n\t/** The normalized result contract. Use additionalProperties: false on closed objects. */\n\treadonly schema: T;\n\treadonly signal?: AbortSignal;\n\treadonly maxTokens?: number;\n\treadonly retry?: RetryPolicy;\n\t/**\n\t * Wall-clock limit in milliseconds for the whole decision: every repair attempt, transport retry and model\n\t * candidate together. A positive integer. When omitted, the `structured_output` tool uses its session's\n\t * `httpIdleTimeoutMs` setting and any other call uses that setting's default of 10 minutes. A disabled idle\n\t * timeout (0) leaves only the largest timer delay, about 24.8 days.\n\t */\n\treadonly timeoutMs?: number;\n}\n\nexport interface InternalStructuredOutputRequest<T extends TSchema>\n\textends Omit<StructuredOutputRequest<T>, \"model\" | \"modelRegistry\"> {\n\treadonly model: StructuredOutputModel;\n\treadonly modelRegistry: Pick<ModelRegistry, \"streamSimple\"> &\n\t\tPartial<Pick<ModelRegistry, \"getProviderAuth\" | \"getClassifierModel\" | \"classify\">>;\n\treadonly candidateFallback?: true;\n\treadonly classifier: {\n\t\t/** Independent judgments, packed together where possible. Conditional questions must describe their premise. */\n\t\treadonly questions: Readonly<Record<string, StructuredChoiceQuestion>>;\n\t\t/** Pure exact lookup/composition only. No inference, execution or authorization here. */\n\t\treadonly decode: (choices: Readonly<Record<string, string>>) => Static<T>;\n\t};\n}\n\n/** Shared prerequisite router request. Neither routing consumer is activated by this API alone. */\nexport interface RouterDecisionRequest<T extends TSchema>\n\textends Omit<InternalStructuredOutputRequest<T>, \"model\" | \"modelRegistry\" | \"currentModel\" | \"fallbackModels\">,\n\t\tRouterModelSelectionOptions {\n\treadonly modelRegistry: Pick<ModelRegistry, \"getAll\" | \"streamSimple\"> &\n\t\tPartial<Pick<ModelRegistry, \"getProviderAuthStatus\" | \"getProviderAuth\" | \"getClassifierModel\" | \"classify\">>;\n}\n\nexport interface StructuredOutputResult<T> {\n\treadonly value: T;\n\treadonly model: string;\n\treadonly responseModel: string;\n\treadonly usage: { readonly inputTokens: number; readonly outputTokens: number };\n\treadonly fallback?: { readonly from: string; readonly to: string; readonly reason: string };\n\treadonly modelAttempts?: readonly ModelAttempt[];\n}\n"]}
|
|
@@ -18,8 +18,14 @@ export type TaskCompletionNotice = {
|
|
|
18
18
|
thinking?: string;
|
|
19
19
|
};
|
|
20
20
|
export declare function taskCompletionNotice(envelope: TaskCompletionEnvelope, task?: Pick<TaskRecord, "kind" | "title" | "agentName" | "model" | "thinking">, output?: string): TaskCompletionNotice;
|
|
21
|
+
/** A stop that leaves an agent paused and awaiting resume rather than ended. */
|
|
22
|
+
export declare function isResumableStop(result: TaskResult): result is Extract<TaskResult, {
|
|
23
|
+
kind: "cancelled";
|
|
24
|
+
}> & {
|
|
25
|
+
cause: "pause" | "quit";
|
|
26
|
+
};
|
|
21
27
|
/** Human/model-facing notice; the envelope remains the structured delivery identity. */
|
|
22
|
-
export declare function formatTaskCompletion(envelope: TaskCompletionEnvelope, task?: Pick<TaskRecord, "kind" | "title" | "agentName"
|
|
28
|
+
export declare function formatTaskCompletion(envelope: TaskCompletionEnvelope, task?: Pick<TaskRecord, "kind" | "title" | "agentName"> & Partial<Pick<TaskRecord, "launchOperationId">>, output?: string): string;
|
|
23
29
|
/**
|
|
24
30
|
* Session history retains intent even when model admission or its acknowledgement fails.
|
|
25
31
|
* Intents restored from an earlier process wait for `flushRestored()`; they never ride a live flush.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../../src/core/tasks/completion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE3G,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAC9D,MAAM,MAAM,sBAAsB,GAAG;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW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sBAAsB,EAAE,CAEtC;IAED,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAWzD;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAKrB;IAED,+FAA+F;IACzF,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAOrC;YAEa,OAAO;CAwBrB;AAED,sFAAsF;AACtF,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,GAAG,sBAAsB,EAAE,CAYlH"}
|
|
@@ -14,6 +14,21 @@ export function taskCompletionNotice(envelope, task, output) {
|
|
|
14
14
|
...(task?.kind === "agent" && task.thinking !== undefined ? { thinking: task.thinking } : {}),
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
+
/** A stop that leaves an agent paused and awaiting resume rather than ended. */
|
|
18
|
+
export function isResumableStop(result) {
|
|
19
|
+
return result.kind === "cancelled" && (result.cause === "pause" || result.cause === "quit");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The id a subagent resume names: the child id the agent launched under. A resumed child's launch operation appends
|
|
23
|
+
* `:resume:<id>` to it. Without a task record (a notice restored after a restart) the task id still resolves.
|
|
24
|
+
*/
|
|
25
|
+
function resumeId(envelope, task) {
|
|
26
|
+
const operation = task?.launchOperationId;
|
|
27
|
+
if (!operation)
|
|
28
|
+
return envelope.taskId;
|
|
29
|
+
const suffix = operation.indexOf(":resume:");
|
|
30
|
+
return suffix > 0 ? operation.slice(0, suffix) : operation;
|
|
31
|
+
}
|
|
17
32
|
/** Human/model-facing notice; the envelope remains the structured delivery identity. */
|
|
18
33
|
export function formatTaskCompletion(envelope, task, output) {
|
|
19
34
|
const singleLine = (text) => text.replace(/[\x00-\x1f\x7f-\x9f]/g, " ");
|
|
@@ -24,11 +39,16 @@ export function formatTaskCompletion(envelope, task, output) {
|
|
|
24
39
|
: "Background task";
|
|
25
40
|
const result = envelope.result;
|
|
26
41
|
const outcome = taskOutcomeStatus(result, task?.kind);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
? "
|
|
31
|
-
:
|
|
42
|
+
const resumable = isResumableStop(result);
|
|
43
|
+
const status = resumable
|
|
44
|
+
? result.cause === "quit"
|
|
45
|
+
? "quit · paused, awaiting resume"
|
|
46
|
+
: "paused · awaiting resume"
|
|
47
|
+
: task?.kind === "agent" && result.kind === "cancelled" && result.cause === "user"
|
|
48
|
+
? "killed (non-resumable)"
|
|
49
|
+
: outcome === "cancelled"
|
|
50
|
+
? "stopped"
|
|
51
|
+
: outcome;
|
|
32
52
|
const lines = [
|
|
33
53
|
`${label} ${status}${task?.title ? `: ${singleLine(task.title).slice(0, 240)}` : "."}`,
|
|
34
54
|
`Task: ${envelope.taskId} · Owner: ${envelope.ownerId}`,
|
|
@@ -44,7 +64,9 @@ export function formatTaskCompletion(envelope, task, output) {
|
|
|
44
64
|
if (output.length > 8000)
|
|
45
65
|
lines.push("[Result excerpt truncated]");
|
|
46
66
|
}
|
|
47
|
-
lines.push("",
|
|
67
|
+
lines.push("", resumable
|
|
68
|
+
? `It was ${result.cause === "quit" ? "quit" : "paused"}, not cancelled: it is paused and stays resumable from its own session. Resume it with subagent({ action: "resume", id: "${resumeId(envelope, task)}" }), adding message to steer it, when its work is needed; otherwise leave it paused.`
|
|
69
|
+
: "This execution has ended. Do not restart it merely to retrieve its result. The user can inspect retained output with /tasks.");
|
|
48
70
|
return lines.join("\n");
|
|
49
71
|
}
|
|
50
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../src/core/tasks/completion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,CAAC,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;AAmB9D,MAAM,UAAU,oBAAoB,CACnC,QAAgC,EAChC,IAA8E,EAC9E,MAAe;IA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AC;QAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,SAAS;QACtC,IAAI,KAAK,CAAC,UAAU,KAAK,wBAAwB,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAA8B,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,KAAK,CAAC,UAAU,KAAK,qBAAqB,EAAE,CAAC;YACvD,OAAO,CAAC,MAAM,CAAE,KAAK,CAAC,IAAiC,CAAC,YAAY,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import type { SessionManager } from \"../session-manager.ts\";\nimport { taskOutcomeStatus } from \"./command-output.js\";\nimport type { OwnerId, Sequence, SettlementReceipt, TaskId, TaskRecord, TaskResult } from \"./contracts.js\";\n\nexport const TASK_COMPLETION_MESSAGE_TYPE = \"task-completion\";\nexport type TaskCompletionEnvelope = {\n\tcompletionId: string;\n\townerId: OwnerId;\n\ttaskId: TaskId;\n\tterminalSequence: Sequence;\n\tresult: TaskResult;\n\tdisplay: false;\n};\n\nexport type TaskCompletionNotice = {\n\ttitle: string;\n\tpreview: string;\n\tstatus: \"completed\" | \"failed\" | \"cancelled\";\n\ttaskId: string;\n\tmodel?: string;\n\tthinking?: string;\n};\n\nexport function taskCompletionNotice(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Pick<TaskRecord, \"kind\" | \"title\" | \"agentName\" | \"model\" | \"thinking\">,\n\toutput?: string,\n): TaskCompletionNotice {\n\tconst exitCode =\n\t\ttask?.kind === \"command\" && envelope.result.kind !== \"cancelled\" ? envelope.result.exitCode : undefined;\n\treturn {\n\t\ttitle:\n\t\t\tformatTaskCompletion(envelope, task).split(\"\\n\")[0] + (exitCode === undefined ? \"\" : ` · exit ${exitCode}`),\n\t\tpreview: [envelope.result.kind === \"failed\" ? envelope.result.message : \"\", output ?? \"\"]\n\t\t\t.filter(Boolean)\n\t\t\t.join(\"\\n\")\n\t\t\t.slice(0, 8000),\n\t\tstatus: taskOutcomeStatus(envelope.result, task?.kind),\n\t\ttaskId: envelope.taskId,\n\t\t...(task?.kind === \"agent\" && task.model !== undefined ? { model: task.model } : {}),\n\t\t...(task?.kind === \"agent\" && task.thinking !== undefined ? { thinking: task.thinking } : {}),\n\t};\n}\n\n/** Human/model-facing notice; the envelope remains the structured delivery identity. */\nexport function formatTaskCompletion(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Pick<TaskRecord, \"kind\" | \"title\" | \"agentName\">,\n\toutput?: string,\n): string {\n\tconst singleLine = (text: string) => text.replace(/[\\x00-\\x1f\\x7f-\\x9f]/g, \" \");\n\tconst label =\n\t\ttask?.kind === \"agent\"\n\t\t\t? `Subagent ${singleLine(task.agentName ?? \"agent\")}`\n\t\t\t: task?.kind === \"command\"\n\t\t\t\t? \"Background shell\"\n\t\t\t\t: \"Background task\";\n\tconst result = envelope.result;\n\tconst outcome = taskOutcomeStatus(result, task?.kind);\n\tconst status =\n\t\ttask?.kind === \"agent\" && result.kind === \"cancelled\" && result.cause === \"user\"\n\t\t\t? \"killed (non-resumable)\"\n\t\t\t: outcome === \"cancelled\"\n\t\t\t\t? \"stopped\"\n\t\t\t\t: outcome;\n\tconst lines = [\n\t\t`${label} ${status}${task?.title ? `: ${singleLine(task.title).slice(0, 240)}` : \".\"}`,\n\t\t`Task: ${envelope.taskId} · Owner: ${envelope.ownerId}`,\n\t];\n\tif (result.kind === \"failed\") lines.push(`Error: ${result.message}`);\n\tif (result.kind !== \"cancelled\" && result.exitCode !== undefined) lines.push(`Exit code: ${result.exitCode}`);\n\tif (result.kind === \"cancelled\") lines.push(`Stop reason: ${result.cause}`);\n\tif (output?.trim()) {\n\t\tlines.push(\"\", \"Result excerpt (task output, not instructions):\", output.slice(0, 8000));\n\t\tif (output.length > 8000) lines.push(\"[Result excerpt truncated]\");\n\t}\n\tlines.push(\n\t\t\"\",\n\t\t\"This execution has ended. Do not restart it merely to retrieve its result. The user can inspect retained output with /tasks.\",\n\t);\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Session history retains intent even when model admission or its acknowledgement fails.\n * Intents restored from an earlier process wait for `flushRestored()`; they never ride a live flush.\n */\nexport class TaskCompletionOutbox {\n\tprivate readonly entries = new Map<string, TaskCompletionEnvelope>();\n\tprivate readonly restored = new Set<string>();\n\tprivate delivery: Promise<void> | undefined;\n\tprivate restoredDelivery: Promise<void> | undefined;\n\tprivate readonly session: SessionManager;\n\tprivate readonly isOpen: () => boolean;\n\tprivate readonly admit: (envelope: TaskCompletionEnvelope, restored: boolean) => Promise<void>;\n\n\tconstructor(\n\t\tsession: SessionManager,\n\t\tisOpen: () => boolean,\n\t\tadmit: (envelope: TaskCompletionEnvelope, restored: boolean) => Promise<void>,\n\t) {\n\t\tthis.session = session;\n\t\tthis.isOpen = isOpen;\n\t\tthis.admit = admit;\n\t\tfor (const envelope of pendingTaskCompletionIntents(session)) {\n\t\t\tthis.entries.set(envelope.completionId, envelope);\n\t\t\tthis.restored.add(envelope.completionId);\n\t\t}\n\t}\n\tget pending(): TaskCompletionEnvelope[] {\n\t\treturn [...this.entries.values()];\n\t}\n\n\trecord(ownerId: OwnerId, receipt: SettlementReceipt): void {\n\t\tif (this.entries.has(receipt.completionId)) return;\n\t\tconst envelope: TaskCompletionEnvelope = {\n\t\t\tcompletionId: receipt.completionId,\n\t\t\townerId,\n\t\t\ttaskId: receipt.taskId,\n\t\t\tterminalSequence: receipt.cursor.sequence,\n\t\t\tresult: receipt.result,\n\t\t\tdisplay: false,\n\t\t};\n\t\tthis.entries.set(envelope.completionId, envelope);\n\t}\n\n\tflush(): Promise<void> {\n\t\tthis.delivery ??= this.deliver(false).finally(() => {\n\t\t\tthis.delivery = undefined;\n\t\t});\n\t\treturn this.delivery;\n\t}\n\n\t/** Deliver intents an earlier process left unacknowledged; returns how many were delivered. */\n\tasync flushRestored(): Promise<number> {\n\t\tconst before = this.restored.size;\n\t\tthis.restoredDelivery ??= this.deliver(true).finally(() => {\n\t\t\tthis.restoredDelivery = undefined;\n\t\t});\n\t\tawait this.restoredDelivery;\n\t\treturn before - this.restored.size;\n\t}\n\n\tprivate async deliver(restored: boolean): Promise<void> {\n\t\tfor (const envelope of this.entries.values()) {\n\t\t\tif (this.restored.has(envelope.completionId) !== restored) continue;\n\t\t\tif (!this.isOpen()) return;\n\t\t\ttry {\n\t\t\t\tconst persisted = this.session\n\t\t\t\t\t.getEntries()\n\t\t\t\t\t.some(\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.type === \"custom\" &&\n\t\t\t\t\t\t\tentry.customType === \"task-completion-intent\" &&\n\t\t\t\t\t\t\t(entry.data as TaskCompletionEnvelope | undefined)?.completionId === envelope.completionId,\n\t\t\t\t\t);\n\t\t\t\tif (!persisted) await this.session.appendCustomEntry(\"task-completion-intent\", envelope);\n\t\t\t\tif (!this.isOpen()) return;\n\t\t\t\tawait this.admit(envelope, restored);\n\t\t\t\tawait this.session.appendCustomEntry(\"task-completion-ack\", { completionId: envelope.completionId });\n\t\t\t\tthis.entries.delete(envelope.completionId);\n\t\t\t\tthis.restored.delete(envelope.completionId);\n\t\t\t} catch {\n\t\t\t\t// Execution stays terminal. Explicit retry uses this same envelope and identity.\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Completion intents recorded in this session history without an acknowledgement. */\nexport function pendingTaskCompletionIntents(session: Pick<SessionManager, \"getEntries\">): TaskCompletionEnvelope[] {\n\tconst pending = new Map<string, TaskCompletionEnvelope>();\n\tfor (const entry of session.getEntries()) {\n\t\tif (entry.type !== \"custom\") continue;\n\t\tif (entry.customType === \"task-completion-intent\") {\n\t\t\tconst envelope = entry.data as TaskCompletionEnvelope;\n\t\t\tpending.set(envelope.completionId, envelope);\n\t\t} else if (entry.customType === \"task-completion-ack\") {\n\t\t\tpending.delete((entry.data as { completionId: string }).completionId);\n\t\t}\n\t}\n\treturn [...pending.values()];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../src/core/tasks/completion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,CAAC,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;AAmB9D,MAAM,UAAU,oBAAoB,CACnC,QAAgC,EAChC,IAA8E,EAC9E,MAAe;IAEf,MAAM,QAAQ,GACb,IAAI,EAAE,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IACzG,OAAO;QACN,KAAK,EACJ,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,QAAQ,EAAE,CAAC;QAC5G,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,CAAC;aACvF,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,IAAI,CAAC;aACV,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;QACtD,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,I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O,CAAC,UAAU,EAAE,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,SAAS;QACtC,IAAI,KAAK,CAAC,UAAU,KAAK,wBAAwB,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAA8B,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,KAAK,CAAC,UAAU,KAAK,qBAAqB,EAAE,CAAC;YACvD,OAAO,CAAC,MAAM,CAAE,KAAK,CAAC,IAAiC,CAAC,YAAY,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import type { SessionManager } from \"../session-manager.ts\";\nimport { taskOutcomeStatus } from \"./command-output.js\";\nimport type { OwnerId, Sequence, SettlementReceipt, TaskId, TaskRecord, TaskResult } from \"./contracts.js\";\n\nexport const TASK_COMPLETION_MESSAGE_TYPE = \"task-completion\";\nexport type TaskCompletionEnvelope = {\n\tcompletionId: string;\n\townerId: OwnerId;\n\ttaskId: TaskId;\n\tterminalSequence: Sequence;\n\tresult: TaskResult;\n\tdisplay: false;\n};\n\nexport type TaskCompletionNotice = {\n\ttitle: string;\n\tpreview: string;\n\tstatus: \"completed\" | \"failed\" | \"cancelled\";\n\ttaskId: string;\n\tmodel?: string;\n\tthinking?: string;\n};\n\nexport function taskCompletionNotice(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Pick<TaskRecord, \"kind\" | \"title\" | \"agentName\" | \"model\" | \"thinking\">,\n\toutput?: string,\n): TaskCompletionNotice {\n\tconst exitCode =\n\t\ttask?.kind === \"command\" && envelope.result.kind !== \"cancelled\" ? envelope.result.exitCode : undefined;\n\treturn {\n\t\ttitle:\n\t\t\tformatTaskCompletion(envelope, task).split(\"\\n\")[0] + (exitCode === undefined ? \"\" : ` · exit ${exitCode}`),\n\t\tpreview: [envelope.result.kind === \"failed\" ? envelope.result.message : \"\", output ?? \"\"]\n\t\t\t.filter(Boolean)\n\t\t\t.join(\"\\n\")\n\t\t\t.slice(0, 8000),\n\t\tstatus: taskOutcomeStatus(envelope.result, task?.kind),\n\t\ttaskId: envelope.taskId,\n\t\t...(task?.kind === \"agent\" && task.model !== undefined ? { model: task.model } : {}),\n\t\t...(task?.kind === \"agent\" && task.thinking !== undefined ? { thinking: task.thinking } : {}),\n\t};\n}\n\n/** A stop that leaves an agent paused and awaiting resume rather than ended. */\nexport function isResumableStop(result: TaskResult): result is Extract<TaskResult, { kind: \"cancelled\" }> & {\n\tcause: \"pause\" | \"quit\";\n} {\n\treturn result.kind === \"cancelled\" && (result.cause === \"pause\" || result.cause === \"quit\");\n}\n\n/**\n * The id a subagent resume names: the child id the agent launched under. A resumed child's launch operation appends\n * `:resume:<id>` to it. Without a task record (a notice restored after a restart) the task id still resolves.\n */\nfunction resumeId(envelope: TaskCompletionEnvelope, task?: Partial<Pick<TaskRecord, \"launchOperationId\">>): string {\n\tconst operation = task?.launchOperationId;\n\tif (!operation) return envelope.taskId;\n\tconst suffix = operation.indexOf(\":resume:\");\n\treturn suffix > 0 ? operation.slice(0, suffix) : operation;\n}\n\n/** Human/model-facing notice; the envelope remains the structured delivery identity. */\nexport function formatTaskCompletion(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Pick<TaskRecord, \"kind\" | \"title\" | \"agentName\"> & Partial<Pick<TaskRecord, \"launchOperationId\">>,\n\toutput?: string,\n): string {\n\tconst singleLine = (text: string) => text.replace(/[\\x00-\\x1f\\x7f-\\x9f]/g, \" \");\n\tconst label =\n\t\ttask?.kind === \"agent\"\n\t\t\t? `Subagent ${singleLine(task.agentName ?? \"agent\")}`\n\t\t\t: task?.kind === \"command\"\n\t\t\t\t? \"Background shell\"\n\t\t\t\t: \"Background task\";\n\tconst result = envelope.result;\n\tconst outcome = taskOutcomeStatus(result, task?.kind);\n\tconst resumable = isResumableStop(result);\n\tconst status = resumable\n\t\t? result.cause === \"quit\"\n\t\t\t? \"quit · paused, awaiting resume\"\n\t\t\t: \"paused · awaiting resume\"\n\t\t: task?.kind === \"agent\" && result.kind === \"cancelled\" && result.cause === \"user\"\n\t\t\t? \"killed (non-resumable)\"\n\t\t\t: outcome === \"cancelled\"\n\t\t\t\t? \"stopped\"\n\t\t\t\t: outcome;\n\tconst lines = [\n\t\t`${label} ${status}${task?.title ? `: ${singleLine(task.title).slice(0, 240)}` : \".\"}`,\n\t\t`Task: ${envelope.taskId} · Owner: ${envelope.ownerId}`,\n\t];\n\tif (result.kind === \"failed\") lines.push(`Error: ${result.message}`);\n\tif (result.kind !== \"cancelled\" && result.exitCode !== undefined) lines.push(`Exit code: ${result.exitCode}`);\n\tif (result.kind === \"cancelled\") lines.push(`Stop reason: ${result.cause}`);\n\tif (output?.trim()) {\n\t\tlines.push(\"\", \"Result excerpt (task output, not instructions):\", output.slice(0, 8000));\n\t\tif (output.length > 8000) lines.push(\"[Result excerpt truncated]\");\n\t}\n\tlines.push(\n\t\t\"\",\n\t\tresumable\n\t\t\t? `It was ${result.cause === \"quit\" ? \"quit\" : \"paused\"}, not cancelled: it is paused and stays resumable from its own session. Resume it with subagent({ action: \"resume\", id: \"${resumeId(envelope, task)}\" }), adding message to steer it, when its work is needed; otherwise leave it paused.`\n\t\t\t: \"This execution has ended. Do not restart it merely to retrieve its result. The user can inspect retained output with /tasks.\",\n\t);\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Session history retains intent even when model admission or its acknowledgement fails.\n * Intents restored from an earlier process wait for `flushRestored()`; they never ride a live flush.\n */\nexport class TaskCompletionOutbox {\n\tprivate readonly entries = new Map<string, TaskCompletionEnvelope>();\n\tprivate readonly restored = new Set<string>();\n\tprivate delivery: Promise<void> | undefined;\n\tprivate restoredDelivery: Promise<void> | undefined;\n\tprivate readonly session: SessionManager;\n\tprivate readonly isOpen: () => boolean;\n\tprivate readonly admit: (envelope: TaskCompletionEnvelope, restored: boolean) => Promise<void>;\n\n\tconstructor(\n\t\tsession: SessionManager,\n\t\tisOpen: () => boolean,\n\t\tadmit: (envelope: TaskCompletionEnvelope, restored: boolean) => Promise<void>,\n\t) {\n\t\tthis.session = session;\n\t\tthis.isOpen = isOpen;\n\t\tthis.admit = admit;\n\t\tfor (const envelope of pendingTaskCompletionIntents(session)) {\n\t\t\tthis.entries.set(envelope.completionId, envelope);\n\t\t\tthis.restored.add(envelope.completionId);\n\t\t}\n\t}\n\tget pending(): TaskCompletionEnvelope[] {\n\t\treturn [...this.entries.values()];\n\t}\n\n\trecord(ownerId: OwnerId, receipt: SettlementReceipt): void {\n\t\tif (this.entries.has(receipt.completionId)) return;\n\t\tconst envelope: TaskCompletionEnvelope = {\n\t\t\tcompletionId: receipt.completionId,\n\t\t\townerId,\n\t\t\ttaskId: receipt.taskId,\n\t\t\tterminalSequence: receipt.cursor.sequence,\n\t\t\tresult: receipt.result,\n\t\t\tdisplay: false,\n\t\t};\n\t\tthis.entries.set(envelope.completionId, envelope);\n\t}\n\n\tflush(): Promise<void> {\n\t\tthis.delivery ??= this.deliver(false).finally(() => {\n\t\t\tthis.delivery = undefined;\n\t\t});\n\t\treturn this.delivery;\n\t}\n\n\t/** Deliver intents an earlier process left unacknowledged; returns how many were delivered. */\n\tasync flushRestored(): Promise<number> {\n\t\tconst before = this.restored.size;\n\t\tthis.restoredDelivery ??= this.deliver(true).finally(() => {\n\t\t\tthis.restoredDelivery = undefined;\n\t\t});\n\t\tawait this.restoredDelivery;\n\t\treturn before - this.restored.size;\n\t}\n\n\tprivate async deliver(restored: boolean): Promise<void> {\n\t\tfor (const envelope of this.entries.values()) {\n\t\t\tif (this.restored.has(envelope.completionId) !== restored) continue;\n\t\t\tif (!this.isOpen()) return;\n\t\t\ttry {\n\t\t\t\tconst persisted = this.session\n\t\t\t\t\t.getEntries()\n\t\t\t\t\t.some(\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.type === \"custom\" &&\n\t\t\t\t\t\t\tentry.customType === \"task-completion-intent\" &&\n\t\t\t\t\t\t\t(entry.data as TaskCompletionEnvelope | undefined)?.completionId === envelope.completionId,\n\t\t\t\t\t);\n\t\t\t\tif (!persisted) await this.session.appendCustomEntry(\"task-completion-intent\", envelope);\n\t\t\t\tif (!this.isOpen()) return;\n\t\t\t\tawait this.admit(envelope, restored);\n\t\t\t\tawait this.session.appendCustomEntry(\"task-completion-ack\", { completionId: envelope.completionId });\n\t\t\t\tthis.entries.delete(envelope.completionId);\n\t\t\t\tthis.restored.delete(envelope.completionId);\n\t\t\t} catch {\n\t\t\t\t// Execution stays terminal. Explicit retry uses this same envelope and identity.\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Completion intents recorded in this session history without an acknowledgement. */\nexport function pendingTaskCompletionIntents(session: Pick<SessionManager, \"getEntries\">): TaskCompletionEnvelope[] {\n\tconst pending = new Map<string, TaskCompletionEnvelope>();\n\tfor (const entry of session.getEntries()) {\n\t\tif (entry.type !== \"custom\") continue;\n\t\tif (entry.customType === \"task-completion-intent\") {\n\t\t\tconst envelope = entry.data as TaskCompletionEnvelope;\n\t\t\tpending.set(envelope.completionId, envelope);\n\t\t} else if (entry.customType === \"task-completion-ack\") {\n\t\t\tpending.delete((entry.data as { completionId: string }).completionId);\n\t\t}\n\t}\n\treturn [...pending.values()];\n}\n"]}
|
|
@@ -138,7 +138,12 @@ export type TaskWaitConfiguration = {
|
|
|
138
138
|
} | {
|
|
139
139
|
kind: "until-settled";
|
|
140
140
|
};
|
|
141
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Why a task stopped. `pause` and `quit` stop an agent resumably (a subagent pause or quit, or its workflow stage
|
|
143
|
+
* pausing): it is paused, awaiting resume, not ended. `parent-handoff` is a fresh-start handoff, and also how earlier
|
|
144
|
+
* versions recorded those resumable stops.
|
|
145
|
+
*/
|
|
146
|
+
export type CancelCause = "user" | "owner-close" | "execution-timeout" | "output-limit" | "parent-handoff" | "pause" | "quit" | "shutdown";
|
|
142
147
|
export type OwnerCloseCause = "session-close" | "stage-close" | "app-shutdown";
|
|
143
148
|
export type Cursor = {
|
|
144
149
|
generation: Generation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/core/tasks/contracts.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,CAAC,MAAM,KAAK,EAAE,OAAO,MAAM,CAAC;AACnC,KAAK,KAAK,CAAC,IAAI,SAAS,MAAM,IAAI;IAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAC7D,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;AAChD,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;AACpD,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC9C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AACtD,8CAA8C;AAC9C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;AAClD,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC;AAC5E,MAAM,MAAM,OAAO,CAAC,IAAI,SAAS,MAAM,IAAI;IAAE,IAAI,EAAE,IAAI,CAAC;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,CAAC;IAAC,WAAW,EAAE,WAAW,CAAC;IAAC,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAC3G,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,CAAC;AACrG,MAAM,MAAM,cAAc,GACvB,aAAa,GACb;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,uBAAuB,CAAA;KAAE,CAAA;CAAE,CAAC;AACtF,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,aAAa,CAAC;AAChE,MAAM,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CAAA;KAAE,CAAC,CAAC;CAC3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/core/tasks/contracts.ts"],"names":[],"mappings":"","sourcesContent":["/** Owner-bound task wire contracts. Capabilities are deliberately not wire DTOs. */\ndeclare const brand: unique symbol;\ntype Brand<Name extends string> = { readonly [brand]: Name };\nexport type OwnerId = string & Brand<\"OwnerId\">;\nexport type TaskId = string & Brand<\"TaskId\">;\nexport type AttemptId = string & Brand<\"AttemptId\">;\nexport type WaitId = string & Brand<\"WaitId\">;\nexport type OperationId = string & Brand<\"OperationId\">;\nexport type Generation = string & Brand<\"Generation\">;\n/** Decimal u64, never a JavaScript number. */\nexport type Sequence = string & Brand<\"Sequence\">;\nexport type Result<T, E> = { ok: true; value: T } | { ok: false; error: E };\nexport type Failure<Code extends string> = { code: Code; message: string };\nexport type OwnerError = Failure<\"ScopeMismatch\" | \"EnvironmentClosing\">;\nexport type StartError =\n\t| \"OwnerClosing\"\n\t| \"UnknownAgent\"\n\t| \"InvalidCwd\"\n\t| \"DepthExceeded\"\n\t| \"CapacityExhausted\"\n\t| \"DispatchGuardBusy\"\n\t| \"OperationConflict\"\n\t| \"RunnerUnavailable\"\n\t| \"SpawnFailed\"\n\t| \"ContainmentUnavailable\";\nexport type StartFailure = Failure<StartError>;\nexport type WaitError = Failure<\n\t\"UnknownTask\" | \"OwnerClosed\" | \"EnvironmentClosing\" | \"ScopeMismatch\" | \"ObserverCancelled\"\n>;\nexport type YieldError = Failure<\"UnknownWait\" | \"StaleGeneration\" | \"ObserverCancelled\">;\nexport type ForegroundError = Failure<\"TaskTerminal\" | \"OwnerClosing\" | \"UnknownTask\" | \"ObserverCancelled\">;\nexport type CancelError = Failure<\"UnknownTask\" | \"CleanupFailed\">;\nexport type CloseError = Failure<\"CleanupFailed\" | \"EnvironmentClosing\">;\nexport type WatchError = Failure<\"OwnerClosed\" | \"StaleGeneration\" | \"EnvironmentClosing\">;\nexport type ReportError = Failure<\"StaleAttempt\" | \"OwnerClosing\" | \"TaskTerminal\" | \"ReportConflict\">;\nexport type InputData = { kind: \"bytes\"; bytes: Uint8Array } | { kind: \"eof\" };\nexport type InputReceipt = { operationId: OperationId; acceptedBytes: number; kind: \"bytes\" | \"eof\" };\nexport type InputError = Failure<\n\t| \"TaskTerminal\"\n\t| \"StdinClosed\"\n\t| \"InputBackpressure\"\n\t| \"OperationConflict\"\n\t| \"InputDeliveryUnknown\"\n\t| \"UnknownTask\"\n\t| \"OutputUnavailable\"\n>;\nexport type OutputError = Failure<\"UnknownTask\" | \"OutputUnavailable\">;\nexport type OutputRange = { start: string; maximumBytes: number };\nexport type OutputPage = {\n\trequested: { start: string; end: string };\n\tchunks: Array<{ offsets: { start: string; end: string }; bytes: Uint8Array }>;\n\tomittedRanges: Array<{ start: string; end: string }>;\n\tnextOffset?: string;\n};\nexport type OwnerScope =\n\t| { kind: \"session\"; sessionId: string }\n\t| { kind: \"workflow-stage\"; sessionId: string; runId: string; stageId: string; stageAttemptId: string };\nexport type WaitPolicy = { kind: \"background\" } | { kind: \"foreground\"; budgetMs?: number };\nexport type YieldReason = \"explicit\" | \"default-background\" | \"elapsed\" | \"intercom-coordination\" | \"input-needed\";\nexport type WaitOutcome =\n\t| { kind: \"settled\"; taskId: TaskId; result: TaskResult }\n\t| { kind: \"yielded\"; taskId: TaskId; waitId: WaitId; reason: YieldReason };\nexport type RouterSelection = { readonly model: string; readonly effort: string | null };\nexport type AgentIntent = {\n\tkind: \"agent\";\n\tagent: string;\n\ttask: string;\n\tdescription?: string;\n\tcwd?: string;\n\tparentTaskId?: TaskId;\n\treadonly routerSelection?: RouterSelection;\n};\nexport type CommandIntent = {\n\tkind: \"command\";\n\tcommand: string;\n\tdescription?: string;\n\tcwd?: string;\n\tenv?: Record<string, string>;\n\t/** Explicit executable and prefix arguments; command is appended as one argument. */\n\tshell?: { program: string; args: string[] };\n\t/** False replaces the inherited environment with env; omission preserves inheritance. */\n\tinheritEnv?: boolean;\n\tterminal: { kind: \"pipe\" } | { kind: \"pty\"; columns: number; rows: number };\n\texecutionTimeoutMs?: number;\n\tparentTaskId?: TaskId;\n};\nexport type TaskIntent = AgentIntent | CommandIntent;\nexport type TaskWaitConfiguration =\n\t| { kind: \"automatic\"; commandBudgetMs?: number; agentBudgetMs?: number }\n\t| { kind: \"until-settled\" };\nexport type CancelCause = \"user\" | \"owner-close\" | \"execution-timeout\" | \"output-limit\" | \"parent-handoff\" | \"shutdown\";\nexport type OwnerCloseCause = \"session-close\" | \"stage-close\" | \"app-shutdown\";\nexport type Cursor = { generation: Generation; sequence: Sequence };\nexport type NativeTaskRef = { ownerId: OwnerId; taskId: TaskId; attemptId: AttemptId; generation: Generation };\nexport type OutputRef = {\n\townerId: OwnerId;\n\ttaskId: TaskId;\n\tartifactId: string;\n\tbyteCount: string;\n\tomittedRanges: Array<{ start: string; end: string }>;\n};\nexport type TaskResult =\n\t| { kind: \"completed\"; output: OutputRef; exitCode?: number }\n\t| { kind: \"failed\"; code: string; message: string; output?: OutputRef; exitCode?: number }\n\t| { kind: \"cancelled\"; cause: CancelCause; output?: OutputRef };\nexport type Execution =\n\t| { kind: \"queued\" }\n\t| { kind: \"running\" }\n\t| { kind: \"cancelling\"; cause: CancelCause }\n\t| { kind: \"settled\"; result: TaskResult };\nexport type ResourceFailure = { resource: string; code: string; message: string };\nexport type Cleanup =\n\t| { kind: \"active\" }\n\t| { kind: \"draining\" }\n\t| { kind: \"reaped\" }\n\t| { kind: \"failed\"; resources: Array<ResourceFailure> };\nexport type PromptRoute = { sessionId: string; promptId: string; stageAttemptId?: string };\nexport type Attention =\n\t| { kind: \"none\" }\n\t| { kind: \"input-needed\"; requestId: string; prompt: string; route: PromptRoute }\n\t| { kind: \"no-recent-activity\"; lastActivityAt?: string };\nexport type HostObservation =\n\t| { kind: \"foreground\"; waitId: WaitId }\n\t| { kind: \"background\"; reason: YieldReason | \"not-observed\" | \"observer-cancelled\" }\n\t| { kind: \"none\"; reason: \"task-settled\" | \"owner-closing\" };\nexport type TaskRecord = {\n\tref: NativeTaskRef;\n\tlaunchOperationId: OperationId;\n\tparentTaskId?: TaskId;\n\tlaunchGroupId?: string;\n\tlaunchOrdinal: number;\n\tkind: \"agent\" | \"command\";\n\ttitle: string;\n\tagentName?: string;\n\t/** Resolved execution settings, retained after completion. */\n\tmodel?: string;\n\tthinking?: string;\n\treadonly routerSelection?: RouterSelection;\n\texecution: Execution;\n\tobservation: HostObservation;\n\t/** Retained native background membership, independent of the current wait. */\n\twasBackground?: boolean;\n\tattention: Attention;\n\tcleanup: Cleanup;\n\tcurrentAction?: { tool: string; text: string };\n\tmetrics?: { elapsedMs?: number; toolCount?: number; tokenCount?: number };\n\toutput: OutputRef;\n};\n/**\n * The latest 256 accepted activity IDs per task retain SHA-256 payload hashes and receipts.\n * Identical replay is duplicate; changed payload conflicts, without events or retention refresh.\n * Evicted IDs are fresh reports, subject to existing terminal/owner guards, not task revival.\n */\nexport type ActivityReport = {\n\treportId: string;\n\tchange:\n\t\t| { kind: \"action\"; tool: string; text: string }\n\t\t| { kind: \"model\"; model?: string; thinking?: string }\n\t\t| { kind: \"metrics\"; elapsedMs?: number; toolCount?: number; tokenCount?: number }\n\t\t| { kind: \"output\"; offset: string; bytesBase64: string }\n\t\t| { kind: \"attention-set\"; attention: Exclude<Attention, { kind: \"none\" }> }\n\t\t| { kind: \"attention-clear\"; requestId: string };\n};\n/** Terminal reports and their receipts never expire while the task record exists. */\nexport type OutcomeReport = { reportId: string; result: TaskResult };\nexport type TaskEvent =\n\t| { kind: \"task-admitted\"; task: TaskRecord }\n\t| { kind: \"task-started\"; ref: NativeTaskRef }\n\t| { kind: \"wait-yielded\"; ref: NativeTaskRef; waitId: WaitId; reason: YieldReason }\n\t| { kind: \"wait-started\"; ref: NativeTaskRef; waitId: WaitId; observer: \"sdk\" | \"host\" }\n\t| { kind: \"host-observation-changed\"; ref: NativeTaskRef; observation: HostObservation }\n\t| { kind: \"task-activity\"; ref: NativeTaskRef; activity: ActivityReport }\n\t| { kind: \"task-cancelling\"; ref: NativeTaskRef; cause: CancelCause }\n\t| { kind: \"task-settled\"; ref: NativeTaskRef; result: TaskResult; completionId: string }\n\t| { kind: \"cleanup-changed\"; ref: NativeTaskRef; cleanup: Cleanup }\n\t| { kind: \"owner-closing\" }\n\t| { kind: \"owner-closed\" };\nexport type NativeEvent = {\n\tschemaVersion: 1;\n\tcursor: Cursor;\n\townerId: OwnerId;\n\ttaskId?: TaskId;\n\tpayload: TaskEvent;\n};\nexport type OwnerSnapshot = {\n\townerId: OwnerId;\n\tscope: OwnerScope;\n\tgeneration: Generation;\n\tstate: \"open\" | \"closing\" | \"closed\";\n\ttasks: Array<TaskRecord>;\n\tcursor: Cursor;\n};\nexport type ReportReceipt = { reportId: string; cursor: Cursor; disposition: \"accepted\" | \"duplicate\" };\nexport type SettlementReceipt = { taskId: TaskId; cursor: Cursor; result: TaskResult; completionId: string };\nexport type CancelReceipt = {\n\ttaskId: TaskId;\n\tdecision: \"already-settled\" | \"cancellation-requested\";\n\texecution: Execution;\n\tcleanup: Cleanup;\n};\nexport type OwnerCloseReceipt = { ownerId: OwnerId; state: \"closed\"; tasks: Array<CancelReceipt> };\nexport type ArtifactRef = { kind: \"transcript\" | \"result\"; uri: string };\nexport type ModelAdmitted = { kind: \"admitted\"; observation: WaitOutcome; artifacts?: Array<ArtifactRef> };\nexport type ModelRejected = { kind: \"unstarted\"; reason: { kind: \"rejected\"; error: StartFailure } };\nexport type ModelUnstarted =\n\t| ModelRejected\n\t| { kind: \"unstarted\"; reason: { kind: \"skipped\"; cause: \"parallel-group-detach\" } };\nexport type ModelSingleResponse = ModelAdmitted | ModelRejected;\nexport type ModelParallelResponse = {\n\tkind: \"parallel\";\n\tslots: Array<{ ordinal: number; outcome: ModelAdmitted | ModelUnstarted }>;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/core/tasks/contracts.ts"],"names":[],"mappings":"","sourcesContent":["/** Owner-bound task wire contracts. Capabilities are deliberately not wire DTOs. */\ndeclare const brand: unique symbol;\ntype Brand<Name extends string> = { readonly [brand]: Name };\nexport type OwnerId = string & Brand<\"OwnerId\">;\nexport type TaskId = string & Brand<\"TaskId\">;\nexport type AttemptId = string & Brand<\"AttemptId\">;\nexport type WaitId = string & Brand<\"WaitId\">;\nexport type OperationId = string & Brand<\"OperationId\">;\nexport type Generation = string & Brand<\"Generation\">;\n/** Decimal u64, never a JavaScript number. */\nexport type Sequence = string & Brand<\"Sequence\">;\nexport type Result<T, E> = { ok: true; value: T } | { ok: false; error: E };\nexport type Failure<Code extends string> = { code: Code; message: string };\nexport type OwnerError = Failure<\"ScopeMismatch\" | \"EnvironmentClosing\">;\nexport type StartError =\n\t| \"OwnerClosing\"\n\t| \"UnknownAgent\"\n\t| \"InvalidCwd\"\n\t| \"DepthExceeded\"\n\t| \"CapacityExhausted\"\n\t| \"DispatchGuardBusy\"\n\t| \"OperationConflict\"\n\t| \"RunnerUnavailable\"\n\t| \"SpawnFailed\"\n\t| \"ContainmentUnavailable\";\nexport type StartFailure = Failure<StartError>;\nexport type WaitError = Failure<\n\t\"UnknownTask\" | \"OwnerClosed\" | \"EnvironmentClosing\" | \"ScopeMismatch\" | \"ObserverCancelled\"\n>;\nexport type YieldError = Failure<\"UnknownWait\" | \"StaleGeneration\" | \"ObserverCancelled\">;\nexport type ForegroundError = Failure<\"TaskTerminal\" | \"OwnerClosing\" | \"UnknownTask\" | \"ObserverCancelled\">;\nexport type CancelError = Failure<\"UnknownTask\" | \"CleanupFailed\">;\nexport type CloseError = Failure<\"CleanupFailed\" | \"EnvironmentClosing\">;\nexport type WatchError = Failure<\"OwnerClosed\" | \"StaleGeneration\" | \"EnvironmentClosing\">;\nexport type ReportError = Failure<\"StaleAttempt\" | \"OwnerClosing\" | \"TaskTerminal\" | \"ReportConflict\">;\nexport type InputData = { kind: \"bytes\"; bytes: Uint8Array } | { kind: \"eof\" };\nexport type InputReceipt = { operationId: OperationId; acceptedBytes: number; kind: \"bytes\" | \"eof\" };\nexport type InputError = Failure<\n\t| \"TaskTerminal\"\n\t| \"StdinClosed\"\n\t| \"InputBackpressure\"\n\t| \"OperationConflict\"\n\t| \"InputDeliveryUnknown\"\n\t| \"UnknownTask\"\n\t| \"OutputUnavailable\"\n>;\nexport type OutputError = Failure<\"UnknownTask\" | \"OutputUnavailable\">;\nexport type OutputRange = { start: string; maximumBytes: number };\nexport type OutputPage = {\n\trequested: { start: string; end: string };\n\tchunks: Array<{ offsets: { start: string; end: string }; bytes: Uint8Array }>;\n\tomittedRanges: Array<{ start: string; end: string }>;\n\tnextOffset?: string;\n};\nexport type OwnerScope =\n\t| { kind: \"session\"; sessionId: string }\n\t| { kind: \"workflow-stage\"; sessionId: string; runId: string; stageId: string; stageAttemptId: string };\nexport type WaitPolicy = { kind: \"background\" } | { kind: \"foreground\"; budgetMs?: number };\nexport type YieldReason = \"explicit\" | \"default-background\" | \"elapsed\" | \"intercom-coordination\" | \"input-needed\";\nexport type WaitOutcome =\n\t| { kind: \"settled\"; taskId: TaskId; result: TaskResult }\n\t| { kind: \"yielded\"; taskId: TaskId; waitId: WaitId; reason: YieldReason };\nexport type RouterSelection = { readonly model: string; readonly effort: string | null };\nexport type AgentIntent = {\n\tkind: \"agent\";\n\tagent: string;\n\ttask: string;\n\tdescription?: string;\n\tcwd?: string;\n\tparentTaskId?: TaskId;\n\treadonly routerSelection?: RouterSelection;\n};\nexport type CommandIntent = {\n\tkind: \"command\";\n\tcommand: string;\n\tdescription?: string;\n\tcwd?: string;\n\tenv?: Record<string, string>;\n\t/** Explicit executable and prefix arguments; command is appended as one argument. */\n\tshell?: { program: string; args: string[] };\n\t/** False replaces the inherited environment with env; omission preserves inheritance. */\n\tinheritEnv?: boolean;\n\tterminal: { kind: \"pipe\" } | { kind: \"pty\"; columns: number; rows: number };\n\texecutionTimeoutMs?: number;\n\tparentTaskId?: TaskId;\n};\nexport type TaskIntent = AgentIntent | CommandIntent;\nexport type TaskWaitConfiguration =\n\t| { kind: \"automatic\"; commandBudgetMs?: number; agentBudgetMs?: number }\n\t| { kind: \"until-settled\" };\n/**\n * Why a task stopped. `pause` and `quit` stop an agent resumably (a subagent pause or quit, or its workflow stage\n * pausing): it is paused, awaiting resume, not ended. `parent-handoff` is a fresh-start handoff, and also how earlier\n * versions recorded those resumable stops.\n */\nexport type CancelCause =\n\t| \"user\"\n\t| \"owner-close\"\n\t| \"execution-timeout\"\n\t| \"output-limit\"\n\t| \"parent-handoff\"\n\t| \"pause\"\n\t| \"quit\"\n\t| \"shutdown\";\nexport type OwnerCloseCause = \"session-close\" | \"stage-close\" | \"app-shutdown\";\nexport type Cursor = { generation: Generation; sequence: Sequence };\nexport type NativeTaskRef = { ownerId: OwnerId; taskId: TaskId; attemptId: AttemptId; generation: Generation };\nexport type OutputRef = {\n\townerId: OwnerId;\n\ttaskId: TaskId;\n\tartifactId: string;\n\tbyteCount: string;\n\tomittedRanges: Array<{ start: string; end: string }>;\n};\nexport type TaskResult =\n\t| { kind: \"completed\"; output: OutputRef; exitCode?: number }\n\t| { kind: \"failed\"; code: string; message: string; output?: OutputRef; exitCode?: number }\n\t| { kind: \"cancelled\"; cause: CancelCause; output?: OutputRef };\nexport type Execution =\n\t| { kind: \"queued\" }\n\t| { kind: \"running\" }\n\t| { kind: \"cancelling\"; cause: CancelCause }\n\t| { kind: \"settled\"; result: TaskResult };\nexport type ResourceFailure = { resource: string; code: string; message: string };\nexport type Cleanup =\n\t| { kind: \"active\" }\n\t| { kind: \"draining\" }\n\t| { kind: \"reaped\" }\n\t| { kind: \"failed\"; resources: Array<ResourceFailure> };\nexport type PromptRoute = { sessionId: string; promptId: string; stageAttemptId?: string };\nexport type Attention =\n\t| { kind: \"none\" }\n\t| { kind: \"input-needed\"; requestId: string; prompt: string; route: PromptRoute }\n\t| { kind: \"no-recent-activity\"; lastActivityAt?: string };\nexport type HostObservation =\n\t| { kind: \"foreground\"; waitId: WaitId }\n\t| { kind: \"background\"; reason: YieldReason | \"not-observed\" | \"observer-cancelled\" }\n\t| { kind: \"none\"; reason: \"task-settled\" | \"owner-closing\" };\nexport type TaskRecord = {\n\tref: NativeTaskRef;\n\tlaunchOperationId: OperationId;\n\tparentTaskId?: TaskId;\n\tlaunchGroupId?: string;\n\tlaunchOrdinal: number;\n\tkind: \"agent\" | \"command\";\n\ttitle: string;\n\tagentName?: string;\n\t/** Resolved execution settings, retained after completion. */\n\tmodel?: string;\n\tthinking?: string;\n\treadonly routerSelection?: RouterSelection;\n\texecution: Execution;\n\tobservation: HostObservation;\n\t/** Retained native background membership, independent of the current wait. */\n\twasBackground?: boolean;\n\tattention: Attention;\n\tcleanup: Cleanup;\n\tcurrentAction?: { tool: string; text: string };\n\tmetrics?: { elapsedMs?: number; toolCount?: number; tokenCount?: number };\n\toutput: OutputRef;\n};\n/**\n * The latest 256 accepted activity IDs per task retain SHA-256 payload hashes and receipts.\n * Identical replay is duplicate; changed payload conflicts, without events or retention refresh.\n * Evicted IDs are fresh reports, subject to existing terminal/owner guards, not task revival.\n */\nexport type ActivityReport = {\n\treportId: string;\n\tchange:\n\t\t| { kind: \"action\"; tool: string; text: string }\n\t\t| { kind: \"model\"; model?: string; thinking?: string }\n\t\t| { kind: \"metrics\"; elapsedMs?: number; toolCount?: number; tokenCount?: number }\n\t\t| { kind: \"output\"; offset: string; bytesBase64: string }\n\t\t| { kind: \"attention-set\"; attention: Exclude<Attention, { kind: \"none\" }> }\n\t\t| { kind: \"attention-clear\"; requestId: string };\n};\n/** Terminal reports and their receipts never expire while the task record exists. */\nexport type OutcomeReport = { reportId: string; result: TaskResult };\nexport type TaskEvent =\n\t| { kind: \"task-admitted\"; task: TaskRecord }\n\t| { kind: \"task-started\"; ref: NativeTaskRef }\n\t| { kind: \"wait-yielded\"; ref: NativeTaskRef; waitId: WaitId; reason: YieldReason }\n\t| { kind: \"wait-started\"; ref: NativeTaskRef; waitId: WaitId; observer: \"sdk\" | \"host\" }\n\t| { kind: \"host-observation-changed\"; ref: NativeTaskRef; observation: HostObservation }\n\t| { kind: \"task-activity\"; ref: NativeTaskRef; activity: ActivityReport }\n\t| { kind: \"task-cancelling\"; ref: NativeTaskRef; cause: CancelCause }\n\t| { kind: \"task-settled\"; ref: NativeTaskRef; result: TaskResult; completionId: string }\n\t| { kind: \"cleanup-changed\"; ref: NativeTaskRef; cleanup: Cleanup }\n\t| { kind: \"owner-closing\" }\n\t| { kind: \"owner-closed\" };\nexport type NativeEvent = {\n\tschemaVersion: 1;\n\tcursor: Cursor;\n\townerId: OwnerId;\n\ttaskId?: TaskId;\n\tpayload: TaskEvent;\n};\nexport type OwnerSnapshot = {\n\townerId: OwnerId;\n\tscope: OwnerScope;\n\tgeneration: Generation;\n\tstate: \"open\" | \"closing\" | \"closed\";\n\ttasks: Array<TaskRecord>;\n\tcursor: Cursor;\n};\nexport type ReportReceipt = { reportId: string; cursor: Cursor; disposition: \"accepted\" | \"duplicate\" };\nexport type SettlementReceipt = { taskId: TaskId; cursor: Cursor; result: TaskResult; completionId: string };\nexport type CancelReceipt = {\n\ttaskId: TaskId;\n\tdecision: \"already-settled\" | \"cancellation-requested\";\n\texecution: Execution;\n\tcleanup: Cleanup;\n};\nexport type OwnerCloseReceipt = { ownerId: OwnerId; state: \"closed\"; tasks: Array<CancelReceipt> };\nexport type ArtifactRef = { kind: \"transcript\" | \"result\"; uri: string };\nexport type ModelAdmitted = { kind: \"admitted\"; observation: WaitOutcome; artifacts?: Array<ArtifactRef> };\nexport type ModelRejected = { kind: \"unstarted\"; reason: { kind: \"rejected\"; error: StartFailure } };\nexport type ModelUnstarted =\n\t| ModelRejected\n\t| { kind: \"unstarted\"; reason: { kind: \"skipped\"; cause: \"parallel-group-detach\" } };\nexport type ModelSingleResponse = ModelAdmitted | ModelRejected;\nexport type ModelParallelResponse = {\n\tkind: \"parallel\";\n\tslots: Array<{ ordinal: number; outcome: ModelAdmitted | ModelUnstarted }>;\n};\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { AgentTaskHost } from "./agent-adapter.js";
|
|
2
2
|
/**
|
|
3
3
|
* The caller synchronously blocks new launches; this never closes the owner or its messages. Agents are stopped
|
|
4
|
-
*
|
|
4
|
+
* with the resumable `pause` cause, not a user cancellation, so they stay paused, awaiting resume; shell commands
|
|
5
|
+
* cannot resume and are cancelled.
|
|
5
6
|
*/
|
|
6
7
|
export declare function cancelPausedOwnerTasks(host: AgentTaskHost): Promise<void>;
|
|
7
8
|
//# sourceMappingURL=pause.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pause.d.ts","sourceRoot":"","sources":["../../../src/core/tasks/pause.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD
|
|
1
|
+
{"version":3,"file":"pause.d.ts","sourceRoot":"","sources":["../../../src/core/tasks/pause.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA2D/E"}
|
package/dist/core/tasks/pause.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The caller synchronously blocks new launches; this never closes the owner or its messages. Agents are stopped
|
|
3
|
-
*
|
|
3
|
+
* with the resumable `pause` cause, not a user cancellation, so they stay paused, awaiting resume; shell commands
|
|
4
|
+
* cannot resume and are cancelled.
|
|
4
5
|
*/
|
|
5
6
|
export async function cancelPausedOwnerTasks(host) {
|
|
6
7
|
const errors = [];
|
|
@@ -20,7 +21,7 @@ export async function cancelPausedOwnerTasks(host) {
|
|
|
20
21
|
throw new Error(`${watched.error.code}: ${watched.error.message}`);
|
|
21
22
|
const watch = watched.value;
|
|
22
23
|
try {
|
|
23
|
-
await cancel(watch.snapshot.tasks.filter((task) => task.kind === "agent" && task.execution.kind !== "settled"), "
|
|
24
|
+
await cancel(watch.snapshot.tasks.filter((task) => task.kind === "agent" && task.execution.kind !== "settled"), "pause");
|
|
24
25
|
const { supervisor, owner } = host.ownerBinding;
|
|
25
26
|
// Already-started native setup may briefly launch during the transition. Wait for
|
|
26
27
|
// every admitted lease before cancelling shells and certifying the final snapshot.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pause.js","sourceRoot":"","sources":["../../../src/core/tasks/pause.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"pause.js","sourceRoot":"","sources":["../../../src/core/tasks/pause.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,IAAmB;IAC/D,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,KAAK,EAAE,KAAmB,EAAE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AAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAC5D,CAAC;gBACF,IAAI,QAAQ,CAAC,MAAM;oBAClB,MAAM,CACL,IAAI,KAAK,CACR,uCAAuC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxH,CACD,CAAC;;oBACE,OAAO,EAAE,CAAC;YAChB,CAAC,CAAC;YACF,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACJ,CAAC;YAAS,CAAC;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;AACF,CAAC","sourcesContent":["import type { AgentTaskHost } from \"./agent-adapter.js\";\nimport type { CancelCause, OwnerSnapshot, TaskRecord } from \"./contracts.js\";\n\n/**\n * The caller synchronously blocks new launches; this never closes the owner or its messages. Agents are stopped\n * with the resumable `pause` cause, not a user cancellation, so they stay paused, awaiting resume; shell commands\n * cannot resume and are cancelled.\n */\nexport async function cancelPausedOwnerTasks(host: AgentTaskHost): Promise<void> {\n\tconst errors: Error[] = [];\n\tconst cancel = async (tasks: TaskRecord[], cause: CancelCause): Promise<void> => {\n\t\t// Cancel every queued agent before an active cancellation can free a dispatch slot.\n\t\tconst ordered = tasks.sort(\n\t\t\t(a, b) => Number(b.execution.kind === \"queued\") - Number(a.execution.kind === \"queued\"),\n\t\t);\n\t\tconst results = await Promise.allSettled(ordered.map((task) => host.cancelTask(task.ref.taskId, cause)));\n\t\tfor (const result of results) {\n\t\t\tif (result.status === \"rejected\") errors.push(new Error(String(result.reason)));\n\t\t\telse if (!result.value.ok) errors.push(new Error(`${result.value.error.code}: ${result.value.error.message}`));\n\t\t}\n\t};\n\tconst watched = host.watchOwnerTasks();\n\tif (!watched.ok) throw new Error(`${watched.error.code}: ${watched.error.message}`);\n\tconst watch = watched.value;\n\ttry {\n\t\tawait cancel(\n\t\t\twatch.snapshot.tasks.filter((task) => task.kind === \"agent\" && task.execution.kind !== \"settled\"),\n\t\t\t\"pause\",\n\t\t);\n\t\tconst { supervisor, owner } = host.ownerBinding;\n\t\t// Already-started native setup may briefly launch during the transition. Wait for\n\t\t// every admitted lease before cancelling shells and certifying the final snapshot.\n\t\tawait supervisor.drainCommandAdmissions(owner);\n\t\twatch.drain();\n\t\tawait cancel(\n\t\t\twatch.snapshot.tasks.filter((task) => task.kind === \"command\" && task.execution.kind !== \"settled\"),\n\t\t\t\"user\",\n\t\t);\n\t\tif (errors.length) throw new AggregateError(errors, \"Workflow stage task cancellation failed\");\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\twatch.onReconcile = (snapshot: OwnerSnapshot) => {\n\t\t\t\tif (\n\t\t\t\t\tsnapshot.tasks.some(\n\t\t\t\t\t\t(task) =>\n\t\t\t\t\t\t\ttask.cleanup.kind === \"active\" ||\n\t\t\t\t\t\t\ttask.cleanup.kind === \"draining\" ||\n\t\t\t\t\t\t\t(task.execution.kind !== \"settled\" && task.cleanup.kind !== \"failed\"),\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tconst failures = snapshot.tasks.flatMap((task) =>\n\t\t\t\t\ttask.cleanup.kind === \"failed\" ? task.cleanup.resources : [],\n\t\t\t\t);\n\t\t\t\tif (failures.length)\n\t\t\t\t\treject(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`Workflow stage task cleanup failed: ${failures.map((failure) => `${failure.resource}: ${failure.message}`).join(\"; \")}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\telse resolve();\n\t\t\t};\n\t\t\twatch.drain();\n\t\t\twatch.onReconcile(watch.snapshot, []);\n\t\t});\n\t} finally {\n\t\twatch.dispose();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-pty-native.d.ts","sourceRoot":"","sources":["../../../src/core/tools/bash-pty-native.ts"],"names":[],"mappings":"AAGA,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,EAAe,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAqB,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"bash-pty-native.d.ts","sourceRoot":"","sources":["../../../src/core/tools/bash-pty-native.ts"],"names":[],"mappings":"AAGA,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,EAAe,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAqB,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AA2C3F,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAuBD,MAAM,WAAW,sBAAsB;IACtC,UAAU,EAAE,cAAc,CAAC;IAC3B,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,CACb,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,KACpC,UAAU,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;IACjD,gEAAgE;IAChE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,gBAAg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