@bastani/atomic 0.9.19-alpha.2 → 0.9.19-alpha.4
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 +42 -0
- package/dist/builtin/intercom/CHANGELOG.md +15 -0
- package/dist/builtin/intercom/broker/broker.ts +8 -0
- package/dist/builtin/intercom/broker/client.ts +18 -0
- package/dist/builtin/intercom/broker/send-handler.ts +9 -0
- package/dist/builtin/intercom/index.bundle.mjs +161 -30
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/types.ts +2 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +18 -0
- package/dist/builtin/subagents/README.md +14 -14
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +14 -14
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +142 -60
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +33 -0
- package/dist/builtin/workflows/README.md +14 -15
- package/dist/builtin/workflows/builtin/{chunk-mygmtz6e.js → chunk-9k3ywfgd.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-r9qq7xfj.js → chunk-ahbntmx2.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-zggjyg5z.js → chunk-n8zysf1t.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +5 -5
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +171 -207
- package/dist/builtin/workflows/src/index.js +33 -6
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +2 -1
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +1 -1
- package/dist/core/agent-session-auto-compaction.js +1 -1
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.js +1 -1
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +33 -2
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +1 -1
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +22 -8
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +7 -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-persistent-custom-messages.d.ts +1 -1
- package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +13 -3
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +1 -1
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +83 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
- package/dist/core/agent-session-queue-pause.js +11 -0
- package/dist/core/agent-session-queue-pause.js.map +1 -1
- package/dist/core/agent-session-tasks.d.ts +5 -0
- package/dist/core/agent-session-tasks.d.ts.map +1 -1
- package/dist/core/agent-session-tasks.js +8 -1
- package/dist/core/agent-session-tasks.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +2 -0
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +12 -0
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-transfer.d.ts.map +1 -1
- package/dist/core/agent-session-transfer.js +7 -0
- package/dist/core/agent-session-transfer.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js +2 -0
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +4 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +22 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +6 -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/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +3 -0
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-host-modules.js +2 -1
- package/dist/core/extensions/loader-host-modules.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +4 -1
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +1 -1
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +9 -3
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/workflow-events.d.ts +1 -1
- package/dist/core/extensions/workflow-events.d.ts.map +1 -1
- package/dist/core/extensions/workflow-events.js.map +1 -1
- package/dist/core/retry-policy.d.ts +1 -0
- package/dist/core/retry-policy.d.ts.map +1 -1
- package/dist/core/retry-policy.js +2 -1
- package/dist/core/retry-policy.js.map +1 -1
- package/dist/core/sdk-exports.d.ts +1 -1
- package/dist/core/sdk-exports.d.ts.map +1 -1
- package/dist/core/sdk-exports.js +1 -1
- package/dist/core/sdk-exports.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +6 -3
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +25 -8
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-types.d.ts +6 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -5
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts +14 -2
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +45 -4
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +5 -1
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/pause.d.ts +4 -0
- package/dist/core/tasks/pause.d.ts.map +1 -0
- package/dist/core/tasks/pause.js +49 -0
- package/dist/core/tasks/pause.js.map +1 -0
- package/dist/core/tasks/supervisor.d.ts +3 -1
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +48 -22
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts +16 -2
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.js +82 -0
- package/dist/core/tools/bash-pty-native.js.map +1 -1
- package/dist/core/tools/bash.d.ts +15 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +49 -4
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +12 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/kill.d.ts +17 -0
- package/dist/core/tools/kill.d.ts.map +1 -0
- package/dist/core/tools/kill.js +49 -0
- package/dist/core/tools/kill.js.map +1 -0
- package/dist/core/tools/powershell.d.ts +84 -28
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +11 -3
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/resource-selectors.d.ts +1 -1
- package/dist/core/tools/resource-selectors.d.ts.map +1 -1
- package/dist/core/tools/resource-selectors.js +7 -4
- package/dist/core/tools/resource-selectors.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +14 -0
- package/dist/core/workflow-stage-admission.d.ts.map +1 -1
- package/dist/core/workflow-stage-admission.js +63 -3
- package/dist/core/workflow-stage-admission.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +3 -2
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-row.js +8 -1
- package/dist/modes/interactive/components/task-row.js.map +1 -1
- package/docs/background-tasks.md +31 -2
- package/docs/compaction.md +20 -0
- package/docs/computer-use.md +390 -0
- package/docs/development.md +23 -74
- package/docs/docs.json +1 -0
- package/docs/extensions.md +15 -1
- package/docs/herdr.md +26 -77
- package/docs/index.md +1 -0
- package/docs/intercom.md +14 -2
- package/docs/models/evals.md +2 -0
- package/docs/models/model-selection.md +10 -7
- package/docs/quickstart.md +1 -1
- package/docs/sdk.md +11 -1
- package/docs/settings.md +24 -0
- package/docs/subagents.md +10 -6
- package/docs/tmux.md +2 -0
- package/docs/tools.md +11 -1
- package/docs/usage.md +1 -1
- package/docs/workflows/api-reference.md +5 -4
- package/docs/workflows/authoring.md +3 -3
- package/docs/workflows/operations.md +44 -33
- package/docs/workflows/reliable-design.md +3 -3
- package/docs/workflows/verification.md +99 -40
- package/docs/workflows.md +4 -2
- package/npm-shrinkwrap.json +59 -59
- package/package.json +3 -3
|
@@ -423,7 +423,7 @@ var require_serialize_error = __commonJS(function(exports, module) {
|
|
|
423
423
|
};
|
|
424
424
|
});
|
|
425
425
|
|
|
426
|
-
// ../../node_modules/superjson/dist/double-indexed-kv.js
|
|
426
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/double-indexed-kv.js
|
|
427
427
|
var require_double_indexed_kv = __commonJS(function(exports) {
|
|
428
428
|
exports.__esModule = true;
|
|
429
429
|
exports.DoubleIndexedKV = undefined;
|
|
@@ -451,7 +451,7 @@ var require_double_indexed_kv = __commonJS(function(exports) {
|
|
|
451
451
|
exports.DoubleIndexedKV = DoubleIndexedKV;
|
|
452
452
|
});
|
|
453
453
|
|
|
454
|
-
// ../../node_modules/superjson/dist/registry.js
|
|
454
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/registry.js
|
|
455
455
|
var require_registry = __commonJS(function(exports) {
|
|
456
456
|
exports.__esModule = true;
|
|
457
457
|
exports.Registry = undefined;
|
|
@@ -484,7 +484,7 @@ var require_registry = __commonJS(function(exports) {
|
|
|
484
484
|
exports.Registry = Registry;
|
|
485
485
|
});
|
|
486
486
|
|
|
487
|
-
// ../../node_modules/superjson/dist/class-registry.js
|
|
487
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/class-registry.js
|
|
488
488
|
var require_class_registry = __commonJS(function(exports) {
|
|
489
489
|
var __extends = exports && exports.__extends || function() {
|
|
490
490
|
var extendStatics = function(d, b) {
|
|
@@ -537,7 +537,7 @@ var require_class_registry = __commonJS(function(exports) {
|
|
|
537
537
|
exports.ClassRegistry = ClassRegistry;
|
|
538
538
|
});
|
|
539
539
|
|
|
540
|
-
// ../../node_modules/superjson/dist/util.js
|
|
540
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/util.js
|
|
541
541
|
var require_util = __commonJS(function(exports) {
|
|
542
542
|
var __read = exports && exports.__read || function(o, n) {
|
|
543
543
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -612,7 +612,7 @@ var require_util = __commonJS(function(exports) {
|
|
|
612
612
|
exports.findArr = findArr;
|
|
613
613
|
});
|
|
614
614
|
|
|
615
|
-
// ../../node_modules/superjson/dist/custom-transformer-registry.js
|
|
615
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/custom-transformer-registry.js
|
|
616
616
|
var require_custom_transformer_registry = __commonJS(function(exports) {
|
|
617
617
|
exports.__esModule = true;
|
|
618
618
|
exports.CustomTransformerRegistry = undefined;
|
|
@@ -637,7 +637,7 @@ var require_custom_transformer_registry = __commonJS(function(exports) {
|
|
|
637
637
|
exports.CustomTransformerRegistry = CustomTransformerRegistry;
|
|
638
638
|
});
|
|
639
639
|
|
|
640
|
-
// ../../node_modules/superjson/dist/is.js
|
|
640
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/is.js
|
|
641
641
|
var require_is = __commonJS(function(exports) {
|
|
642
642
|
exports.__esModule = true;
|
|
643
643
|
exports.isURL = exports.isTypedArray = exports.isInfinite = exports.isBigint = exports.isPrimitive = exports.isNaNValue = exports.isError = exports.isDate = exports.isSymbol = exports.isSet = exports.isMap = exports.isRegExp = exports.isBoolean = exports.isNumber = exports.isString = exports.isArray = exports.isEmptyObject = exports.isPlainObject = exports.isNull = exports.isUndefined = undefined;
|
|
@@ -732,7 +732,7 @@ var require_is = __commonJS(function(exports) {
|
|
|
732
732
|
exports.isURL = isURL;
|
|
733
733
|
});
|
|
734
734
|
|
|
735
|
-
// ../../node_modules/superjson/dist/pathstringifier.js
|
|
735
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/pathstringifier.js
|
|
736
736
|
var require_pathstringifier = __commonJS(function(exports) {
|
|
737
737
|
exports.__esModule = true;
|
|
738
738
|
exports.parsePath = exports.stringifyPath = exports.escapeKey = undefined;
|
|
@@ -770,7 +770,7 @@ var require_pathstringifier = __commonJS(function(exports) {
|
|
|
770
770
|
exports.parsePath = parsePath;
|
|
771
771
|
});
|
|
772
772
|
|
|
773
|
-
// ../../node_modules/superjson/dist/transformer.js
|
|
773
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/transformer.js
|
|
774
774
|
var require_transformer = __commonJS(function(exports) {
|
|
775
775
|
var __assign = exports && exports.__assign || function() {
|
|
776
776
|
__assign = Object.assign || function(t) {
|
|
@@ -1046,7 +1046,7 @@ var require_transformer = __commonJS(function(exports) {
|
|
|
1046
1046
|
exports.untransformValue = untransformValue;
|
|
1047
1047
|
});
|
|
1048
1048
|
|
|
1049
|
-
// ../../node_modules/superjson/dist/accessDeep.js
|
|
1049
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/accessDeep.js
|
|
1050
1050
|
var require_accessDeep = __commonJS(function(exports) {
|
|
1051
1051
|
exports.__esModule = true;
|
|
1052
1052
|
exports.setDeep = exports.getDeep = undefined;
|
|
@@ -1168,7 +1168,7 @@ var require_accessDeep = __commonJS(function(exports) {
|
|
|
1168
1168
|
exports.setDeep = setDeep;
|
|
1169
1169
|
});
|
|
1170
1170
|
|
|
1171
|
-
// ../../node_modules/superjson/dist/plainer.js
|
|
1171
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/plainer.js
|
|
1172
1172
|
var require_plainer = __commonJS(function(exports) {
|
|
1173
1173
|
var __read = exports && exports.__read || function(o, n) {
|
|
1174
1174
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -1545,7 +1545,7 @@ var require_cjs = __commonJS(function(exports) {
|
|
|
1545
1545
|
exports.isWeakSet = isWeakSet;
|
|
1546
1546
|
});
|
|
1547
1547
|
|
|
1548
|
-
// ../../node_modules/copy-anything/dist/cjs/index.cjs
|
|
1548
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/copy-anything/dist/cjs/index.cjs
|
|
1549
1549
|
var require_cjs2 = __commonJS(function(exports) {
|
|
1550
1550
|
var isWhat = require_cjs();
|
|
1551
1551
|
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
@@ -1583,7 +1583,7 @@ var require_cjs2 = __commonJS(function(exports) {
|
|
|
1583
1583
|
exports.copy = copy;
|
|
1584
1584
|
});
|
|
1585
1585
|
|
|
1586
|
-
// ../../node_modules/superjson/dist/index.js
|
|
1586
|
+
// ../../node_modules/@dbos-inc/dbos-sdk/node_modules/superjson/dist/index.js
|
|
1587
1587
|
var require_dist = __commonJS(function(exports) {
|
|
1588
1588
|
var __assign = exports && exports.__assign || function() {
|
|
1589
1589
|
__assign = Object.assign || function(t) {
|
|
@@ -66513,7 +66513,7 @@ class WorkflowObservationRuntime {
|
|
|
66513
66513
|
const run = this.runs().find((candidate) => candidate.id === runId);
|
|
66514
66514
|
if (!run)
|
|
66515
66515
|
return;
|
|
66516
|
-
if ((action === "quit" || action === "kill" || action === "
|
|
66516
|
+
if ((action === "quit" || action === "kill" || action === "pause") && this.liveRunIds.has(runId))
|
|
66517
66517
|
this.stoppingRunIds.add(runId);
|
|
66518
66518
|
if (action === "resume")
|
|
66519
66519
|
this.stoppingRunIds.delete(runId);
|
|
@@ -68991,8 +68991,8 @@ function renderIdentifierRows2(id, width, theme) {
|
|
|
68991
68991
|
function renderDetailHintRows(detail, width, theme) {
|
|
68992
68992
|
const resumable = detail.status === "paused" && detail.resumable !== false || detail.resumable === true && (detail.status === "crashed" || detail.status === "failed" || detail.status === "blocked");
|
|
68993
68993
|
const inspectOnly = detail.ownerActiveElsewhere === true || detail.status === "crashed" && !resumable || detail.endedAt !== undefined && !resumable;
|
|
68994
|
-
const prefix = inspectOnly ? " ▸ workflow status id=" : resumable ? " ▸ workflow resume id=" : " ▸ workflow
|
|
68995
|
-
const suffix = inspectOnly ? detail.ownerActiveElsewhere === true ? " inspect; owner active elsewhere " : " inspect retained state " : resumable ? " continue workflow " : "
|
|
68994
|
+
const prefix = inspectOnly ? " ▸ workflow status id=" : resumable ? " ▸ workflow resume id=" : " ▸ workflow pause id=";
|
|
68995
|
+
const suffix = inspectOnly ? detail.ownerActiveElsewhere === true ? " inspect; owner active elsewhere " : " inspect retained state " : resumable ? " continue workflow " : " pause workflow ";
|
|
68996
68996
|
const continuation = " ";
|
|
68997
68997
|
const rows = wrapIdentifierLines(detail.runId, width, prefix, continuation);
|
|
68998
68998
|
const last = rows[rows.length - 1];
|
|
@@ -72116,7 +72116,16 @@ function projectedToolStatus(tool) {
|
|
|
72116
72116
|
return tool.status;
|
|
72117
72117
|
}
|
|
72118
72118
|
function expandWorkflowGraph(snapshot, rootRunId) {
|
|
72119
|
-
|
|
72119
|
+
return createWorkflowGraphExpander(snapshot)(rootRunId);
|
|
72120
|
+
}
|
|
72121
|
+
function createWorkflowGraphExpander(snapshot) {
|
|
72122
|
+
let runById;
|
|
72123
|
+
return (rootRunId) => {
|
|
72124
|
+
runById ??= new Map(snapshot.runs.map((run) => [run.id, run]));
|
|
72125
|
+
return expandIndexedWorkflowGraph(runById, rootRunId);
|
|
72126
|
+
};
|
|
72127
|
+
}
|
|
72128
|
+
function expandIndexedWorkflowGraph(runById, rootRunId) {
|
|
72120
72129
|
const root = runById.get(rootRunId);
|
|
72121
72130
|
if (!root)
|
|
72122
72131
|
return { stages: [], renderStages: [], tools: [], nodes: [], targets: new Map };
|
|
@@ -72590,7 +72599,7 @@ class GraphCanvas {
|
|
|
72590
72599
|
|
|
72591
72600
|
// dist/builtin/workflows/src/tui/layout.ts
|
|
72592
72601
|
var NODE_W = 24;
|
|
72593
|
-
var NODE_H =
|
|
72602
|
+
var NODE_H = 6;
|
|
72594
72603
|
function computeLayout(stages, opts = {}) {
|
|
72595
72604
|
const colGap = opts.colGap ?? 4;
|
|
72596
72605
|
const rowGap = opts.rowGap ?? 3;
|
|
@@ -74106,6 +74115,23 @@ function metaText(stage) {
|
|
|
74106
74115
|
const dependencyText = deps === 0 ? "root" : deps === 1 ? "1 dep" : `${deps} deps`;
|
|
74107
74116
|
return dependencyText;
|
|
74108
74117
|
}
|
|
74118
|
+
function modelText(stage, innerWidth) {
|
|
74119
|
+
const model = stage.model;
|
|
74120
|
+
if (model === undefined || model === "")
|
|
74121
|
+
return "—";
|
|
74122
|
+
const slash = model.lastIndexOf("/");
|
|
74123
|
+
const short = slash >= 0 ? model.slice(slash + 1) : model;
|
|
74124
|
+
const level = stage.thinkingLevel;
|
|
74125
|
+
const showLevel = level !== undefined && level !== "" && level !== "off";
|
|
74126
|
+
const suffix = showLevel ? ` · ${level}` : "";
|
|
74127
|
+
const full = `${short}${suffix}`;
|
|
74128
|
+
if (visibleWidth(full) <= innerWidth)
|
|
74129
|
+
return full;
|
|
74130
|
+
const modelSuffix = short.endsWith("-fast") ? "-fast" : "";
|
|
74131
|
+
const name = modelSuffix ? short.slice(0, -modelSuffix.length) : short;
|
|
74132
|
+
const room = Math.max(1, innerWidth - visibleWidth(modelSuffix + suffix));
|
|
74133
|
+
return `${truncateToWidth2(name, room, "…")}${modelSuffix}${suffix}`;
|
|
74134
|
+
}
|
|
74109
74135
|
function workflowChildRunRows(stage, width) {
|
|
74110
74136
|
const child = stage.workflowChild ?? stage.workflowChildRun;
|
|
74111
74137
|
if (child === undefined)
|
|
@@ -74195,6 +74221,7 @@ function renderNodeCard(stage, opts) {
|
|
|
74195
74221
|
}) + `${bg}${bc}│${RESET}`;
|
|
74196
74222
|
const contentRows = Math.max(0, height - 2);
|
|
74197
74223
|
const metaLine = `${bg}${bc}│${RESET}${centreColored(metaText(stage), innerWidth, theme.dim, bg)}${bg}${bc}│${RESET}`;
|
|
74224
|
+
const modelLine = `${bg}${bc}│${RESET}${centreColored(modelText(stage, innerWidth), innerWidth, theme.textMuted, bg)}${bg}${bc}│${RESET}`;
|
|
74198
74225
|
const childRunLines = workflowChildRunRows(stage, innerWidth).map((row) => `${bg}${bc}│${RESET}${centreColored(row, innerWidth, theme.dim, bg)}${bg}${bc}│${RESET}`);
|
|
74199
74226
|
const queuedCount = queuedBadgeCount(opts.queuedMessageCount);
|
|
74200
74227
|
const childMeta = workflowChildMetaText(stage);
|
|
@@ -74205,8 +74232,9 @@ function renderNodeCard(stage, opts) {
|
|
|
74205
74232
|
const interior = stage.status === "awaiting_input" ? [
|
|
74206
74233
|
statusLine,
|
|
74207
74234
|
`${bg}${bc}│${RESET}` + centreColored("waiting for response", innerWidth, theme.info, bg) + `${bg}${bc}│${RESET}`,
|
|
74208
|
-
`${bg}${bc}│${RESET}` + centreColored("↵ enter to respond", innerWidth, theme.dim, bg) + `${bg}${bc}│${RESET}
|
|
74209
|
-
|
|
74235
|
+
`${bg}${bc}│${RESET}` + centreColored("↵ enter to respond", innerWidth, theme.dim, bg) + `${bg}${bc}│${RESET}`,
|
|
74236
|
+
modelLine
|
|
74237
|
+
] : childSummaryLine === undefined ? [durLine, statusLine, modelLine, metaLine] : [...childRunLines, childSummaryLine];
|
|
74210
74238
|
const preferredBadgeRow = stage.status === "awaiting_input" ? 1 : childSummaryLine === undefined ? interior.length - 1 : -1;
|
|
74211
74239
|
while (interior.length < contentRows) {
|
|
74212
74240
|
interior.push(`${bg}${bc}│${RESET}${bg}${" ".repeat(innerWidth)}${bg}${bc}│${RESET}`);
|
|
@@ -78841,14 +78869,14 @@ function statusFg(run, theme, allRuns) {
|
|
|
78841
78869
|
return theme.dim;
|
|
78842
78870
|
}
|
|
78843
78871
|
}
|
|
78844
|
-
function modeLabel(
|
|
78845
|
-
return
|
|
78872
|
+
function modeLabel(stages) {
|
|
78873
|
+
return stages.length > 1 ? "chain" : "single";
|
|
78846
78874
|
}
|
|
78847
|
-
function progressLabel(
|
|
78848
|
-
const total =
|
|
78875
|
+
function progressLabel(stages) {
|
|
78876
|
+
const total = stages.length;
|
|
78849
78877
|
if (total === 0)
|
|
78850
78878
|
return;
|
|
78851
|
-
const done =
|
|
78879
|
+
const done = stages.filter((s) => s.status === "completed" || s.status === "failed" || s.status === "skipped").length;
|
|
78852
78880
|
return `${done}/${total}`;
|
|
78853
78881
|
}
|
|
78854
78882
|
function elapsedLabel(run, now) {
|
|
@@ -78900,7 +78928,7 @@ function pendingStageLabel(run, width = Number.POSITIVE_INFINITY, resolveBoundar
|
|
|
78900
78928
|
}
|
|
78901
78929
|
return;
|
|
78902
78930
|
}
|
|
78903
|
-
function metaLine(run, now, width = Number.POSITIVE_INFINITY, resolveBoundarySegments) {
|
|
78931
|
+
function metaLine(run, expandGraph, now, width = Number.POSITIVE_INFINITY, resolveBoundarySegments) {
|
|
78904
78932
|
if (run.endedAt !== undefined) {
|
|
78905
78933
|
return elapsedLabel(run, now);
|
|
78906
78934
|
}
|
|
@@ -78908,8 +78936,9 @@ function metaLine(run, now, width = Number.POSITIVE_INFINITY, resolveBoundarySeg
|
|
|
78908
78936
|
return run.resumable === false ? "quit · not resumable" : "quit · resumable via /workflow resume";
|
|
78909
78937
|
if (effectiveRunStatus(run) === "blocked")
|
|
78910
78938
|
return "blocked · resumable via /workflow resume";
|
|
78911
|
-
const
|
|
78912
|
-
const
|
|
78939
|
+
const { stages } = expandGraph(run.id);
|
|
78940
|
+
const prefix = [modeLabel(stages)];
|
|
78941
|
+
const prog = progressLabel(stages);
|
|
78913
78942
|
if (prog)
|
|
78914
78943
|
prefix.push(prog);
|
|
78915
78944
|
const suffix = [];
|
|
@@ -78964,9 +78993,9 @@ function runMetaWidth(run, width) {
|
|
|
78964
78993
|
const inner = Math.max(2, Math.max(32, width) - 2);
|
|
78965
78994
|
return Math.max(0, inner - visibleWidth(` ${run.name} · `));
|
|
78966
78995
|
}
|
|
78967
|
-
function themedRunLines(run, now, theme, allRuns, width) {
|
|
78996
|
+
function themedRunLines(run, now, theme, allRuns, width, expandGraph) {
|
|
78968
78997
|
const resolveBoundarySegments = (runId) => workflowBoundarySegments(allRuns, runId);
|
|
78969
|
-
const meta = metaLine(run, now, runMetaWidth(run, width), resolveBoundarySegments);
|
|
78998
|
+
const meta = metaLine(run, expandGraph, now, runMetaWidth(run, width), resolveBoundarySegments);
|
|
78970
78999
|
const metaColor = effectiveRunStatus(run) === "running" ? theme.textMuted : theme.dim;
|
|
78971
79000
|
return renderRunIdentityRows({
|
|
78972
79001
|
runId: run.id,
|
|
@@ -78978,12 +79007,12 @@ function themedRunLines(run, now, theme, allRuns, width) {
|
|
|
78978
79007
|
theme
|
|
78979
79008
|
});
|
|
78980
79009
|
}
|
|
78981
|
-
function plainRunLines(run, now, allRuns, width) {
|
|
79010
|
+
function plainRunLines(run, now, allRuns, width, expandGraph) {
|
|
78982
79011
|
const resolveBoundarySegments = (runId) => workflowBoundarySegments(allRuns, runId);
|
|
78983
79012
|
return renderRunIdentityRows({
|
|
78984
79013
|
runId: run.id,
|
|
78985
79014
|
name: run.name,
|
|
78986
|
-
meta: metaLine(run, now, runMetaWidth(run, width), resolveBoundarySegments),
|
|
79015
|
+
meta: metaLine(run, expandGraph, now, runMetaWidth(run, width), resolveBoundarySegments),
|
|
78987
79016
|
glyph: statusGlyph2(run, allRuns)
|
|
78988
79017
|
});
|
|
78989
79018
|
}
|
|
@@ -79036,9 +79065,10 @@ function buildThemedWidgetLines(snap, piTheme, width = 120, now = Date.now()) {
|
|
|
79036
79065
|
const badges = formatTitleBadges(badgeList, graphTheme, themed);
|
|
79037
79066
|
const title = `BACKGROUND ${subtitle}${badges ? ` ${badges}` : ""}`;
|
|
79038
79067
|
const body = [];
|
|
79068
|
+
const expandGraph = createWorkflowGraphExpander(snap);
|
|
79039
79069
|
for (let i = 0;i < display.length; i++) {
|
|
79040
79070
|
const run = display[i];
|
|
79041
|
-
const runLines = themed ? themedRunLines(run, now, graphTheme, snap.runs, width) : plainRunLines(run, now, snap.runs, width);
|
|
79071
|
+
const runLines = themed ? themedRunLines(run, now, graphTheme, snap.runs, width, expandGraph) : plainRunLines(run, now, snap.runs, width, expandGraph);
|
|
79042
79072
|
body.push(...runLines);
|
|
79043
79073
|
if (i < display.length - 1)
|
|
79044
79074
|
body.push("");
|
|
@@ -80049,6 +80079,7 @@ function encodeCheckpoint(checkpoint) {
|
|
|
80049
80079
|
...s.durationMs !== undefined ? { durationMs: s.durationMs } : {},
|
|
80050
80080
|
...s.result !== undefined ? { result: s.result } : {},
|
|
80051
80081
|
...s.model !== undefined ? { model: s.model } : {},
|
|
80082
|
+
...s.thinkingLevel !== undefined ? { thinkingLevel: s.thinkingLevel } : {},
|
|
80052
80083
|
...s.attemptedModels !== undefined ? { attemptedModels: [...s.attemptedModels] } : {},
|
|
80053
80084
|
...s.modelAttempts !== undefined ? { modelAttempts: s.modelAttempts } : {},
|
|
80054
80085
|
...s.structured !== undefined ? { structured: s.structured } : {},
|
|
@@ -80113,7 +80144,7 @@ function decodeEnvelope(workflowId, env) {
|
|
|
80113
80144
|
};
|
|
80114
80145
|
}
|
|
80115
80146
|
const topology = stageTopology(env.topology);
|
|
80116
|
-
if (env.kind !== "stage" || topology === undefined || env.replayKey !== undefined && typeof env.replayKey !== "string" || env.sessionId !== undefined && typeof env.sessionId !== "string" || env.sessionFile !== undefined && typeof env.sessionFile !== "string" || !isOptionalFiniteNumber(env.startedAt) || !isOptionalFiniteNumber(env.endedAt) || !isOptionalFiniteNumber(env.durationMs) || env.result !== undefined && typeof env.result !== "string" || env.model !== undefined && typeof env.model !== "string" || env.attemptedModels !== undefined && !isStringArray(env.attemptedModels) || env.modelAttempts !== undefined && !isModelAttempts(env.modelAttempts) || env.artifacts !== undefined && !isWorkflowArtifacts(env.artifacts) || env.warnings !== undefined && !isStringArray(env.warnings))
|
|
80147
|
+
if (env.kind !== "stage" || topology === undefined || env.replayKey !== undefined && typeof env.replayKey !== "string" || env.sessionId !== undefined && typeof env.sessionId !== "string" || env.sessionFile !== undefined && typeof env.sessionFile !== "string" || !isOptionalFiniteNumber(env.startedAt) || !isOptionalFiniteNumber(env.endedAt) || !isOptionalFiniteNumber(env.durationMs) || env.result !== undefined && typeof env.result !== "string" || env.model !== undefined && typeof env.model !== "string" || env.thinkingLevel !== undefined && typeof env.thinkingLevel !== "string" || env.attemptedModels !== undefined && !isStringArray(env.attemptedModels) || env.modelAttempts !== undefined && !isModelAttempts(env.modelAttempts) || env.artifacts !== undefined && !isWorkflowArtifacts(env.artifacts) || env.warnings !== undefined && !isStringArray(env.warnings))
|
|
80117
80148
|
return;
|
|
80118
80149
|
return {
|
|
80119
80150
|
kind: "stage",
|
|
@@ -80129,6 +80160,7 @@ function decodeEnvelope(workflowId, env) {
|
|
|
80129
80160
|
...typeof env.durationMs === "number" ? { durationMs: env.durationMs } : {},
|
|
80130
80161
|
...typeof env.result === "string" ? { result: env.result } : {},
|
|
80131
80162
|
...typeof env.model === "string" ? { model: env.model } : {},
|
|
80163
|
+
...typeof env.thinkingLevel === "string" ? { thinkingLevel: env.thinkingLevel } : {},
|
|
80132
80164
|
...isStringArray(env.attemptedModels) ? { attemptedModels: env.attemptedModels } : {},
|
|
80133
80165
|
...Array.isArray(env.modelAttempts) ? { modelAttempts: env.modelAttempts } : {},
|
|
80134
80166
|
...env.structured !== undefined ? { structured: env.structured } : {},
|
|
@@ -83875,8 +83907,7 @@ function createRealDbosHandle(dbos, mainWorkflow, checkpointWorkflow) {
|
|
|
83875
83907
|
const stepName = wid.slice(prefix.length);
|
|
83876
83908
|
if (stepName.length === 0)
|
|
83877
83909
|
continue;
|
|
83878
|
-
const
|
|
83879
|
-
const output = await handle.getResult();
|
|
83910
|
+
const output = s.output === undefined || typeof s.output === "string" ? await dbos.retrieveWorkflow(wid).getResult() : s.output;
|
|
83880
83911
|
records.push({ stepName, output, completedAt: s.createdAt });
|
|
83881
83912
|
}
|
|
83882
83913
|
return records;
|
|
@@ -85083,8 +85114,11 @@ async function rollbackStartedCluster(cluster, startupError) {
|
|
|
85083
85114
|
async function waitForClusterReadiness(logFile, rollbackCluster, isReachable = tcpReachable, attempts = READY_ATTEMPTS, wait = delay) {
|
|
85084
85115
|
try {
|
|
85085
85116
|
for (let attempt = 0;attempt < attempts; attempt += 1) {
|
|
85086
|
-
|
|
85117
|
+
await assertRetainedPostgresRunning(rollbackCluster, logFile);
|
|
85118
|
+
if (await isReachable(EMBEDDED_HOST, EMBEDDED_PORT)) {
|
|
85119
|
+
await assertRetainedPostgresRunning(rollbackCluster, logFile);
|
|
85087
85120
|
return;
|
|
85121
|
+
}
|
|
85088
85122
|
await wait(READY_DELAY_MS);
|
|
85089
85123
|
}
|
|
85090
85124
|
throw new Error(`Embedded Postgres started but never accepted connections on ${EMBEDDED_HOST}:${EMBEDDED_PORT}; see ${logFile}.`);
|
|
@@ -85092,6 +85126,19 @@ async function waitForClusterReadiness(logFile, rollbackCluster, isReachable = t
|
|
|
85092
85126
|
await rollbackStartedCluster(rollbackCluster, startupError);
|
|
85093
85127
|
}
|
|
85094
85128
|
}
|
|
85129
|
+
async function assertRetainedPostgresRunning(cluster, logFile) {
|
|
85130
|
+
if (cluster === undefined)
|
|
85131
|
+
return;
|
|
85132
|
+
const observed = await cluster.lease.wait(0).catch((error) => {
|
|
85133
|
+
if (error instanceof Error && error.message === "Timed out waiting for the retained Postgres process to exit") {
|
|
85134
|
+
return;
|
|
85135
|
+
}
|
|
85136
|
+
throw error;
|
|
85137
|
+
});
|
|
85138
|
+
if (observed?.exited) {
|
|
85139
|
+
throw new Error(`The embedded Postgres process exited early before accepting connections on ${EMBEDDED_HOST}:${EMBEDDED_PORT}; see ${logFile}.${logTail(logFile)}`);
|
|
85140
|
+
}
|
|
85141
|
+
}
|
|
85095
85142
|
function shutdownEmbeddedDbosPostgres() {
|
|
85096
85143
|
const cluster = activeCluster;
|
|
85097
85144
|
if (cluster === undefined)
|
|
@@ -86257,6 +86304,7 @@ function durableStageCheckpointMetadata(stage, run, sourceOrder) {
|
|
|
86257
86304
|
...stage.sessionFile !== undefined ? { sessionFile: stage.sessionFile } : {},
|
|
86258
86305
|
...stage.durationMs !== undefined ? { durationMs: stage.durationMs } : {},
|
|
86259
86306
|
...stage.model !== undefined ? { model: stage.model } : {},
|
|
86307
|
+
...stage.thinkingLevel !== undefined ? { thinkingLevel: stage.thinkingLevel } : {},
|
|
86260
86308
|
...stage.attemptedModels !== undefined ? { attemptedModels: [...stage.attemptedModels] } : {},
|
|
86261
86309
|
...stage.modelAttempts !== undefined ? { modelAttempts: [...stage.modelAttempts] } : {},
|
|
86262
86310
|
...stage.structured !== undefined ? { structured: stage.structured } : {},
|
|
@@ -87183,6 +87231,7 @@ function completeTaskResult(name, base, checkpoint) {
|
|
|
87183
87231
|
...base.sessionFile !== undefined || checkpoint.sessionFile !== undefined ? { sessionFile: base.sessionFile ?? checkpoint.sessionFile } : {},
|
|
87184
87232
|
...base.artifacts !== undefined || checkpoint.artifacts !== undefined ? { artifacts: [...base.artifacts ?? checkpoint.artifacts ?? []] } : {},
|
|
87185
87233
|
...base.model !== undefined || checkpoint.model !== undefined ? { model: base.model ?? checkpoint.model } : {},
|
|
87234
|
+
...base.thinkingLevel !== undefined || checkpoint.thinkingLevel !== undefined ? { thinkingLevel: base.thinkingLevel ?? checkpoint.thinkingLevel } : {},
|
|
87186
87235
|
...base.attemptedModels !== undefined || checkpoint.attemptedModels !== undefined ? { attemptedModels: [...base.attemptedModels ?? checkpoint.attemptedModels ?? []] } : {},
|
|
87187
87236
|
...base.modelAttempts !== undefined || checkpoint.modelAttempts !== undefined ? { modelAttempts: [...base.modelAttempts ?? checkpoint.modelAttempts ?? []] } : {},
|
|
87188
87237
|
...base.warnings !== undefined || checkpoint.warnings !== undefined ? { warnings: [...base.warnings ?? checkpoint.warnings ?? []] } : {}
|
|
@@ -87283,6 +87332,7 @@ function taskCheckpointMetadata(result) {
|
|
|
87283
87332
|
...result.sessionId !== undefined ? { sessionId: result.sessionId } : {},
|
|
87284
87333
|
...result.sessionFile !== undefined ? { sessionFile: result.sessionFile } : {},
|
|
87285
87334
|
...result.model !== undefined ? { model: result.model } : {},
|
|
87335
|
+
...result.thinkingLevel !== undefined ? { thinkingLevel: result.thinkingLevel } : {},
|
|
87286
87336
|
...result.attemptedModels !== undefined ? { attemptedModels: [...result.attemptedModels] } : {},
|
|
87287
87337
|
...result.modelAttempts !== undefined ? { modelAttempts: [...result.modelAttempts] } : {},
|
|
87288
87338
|
...result.structured !== undefined ? { structured: result.structured } : {},
|
|
@@ -87312,6 +87362,7 @@ function mergeCheckpointHydrationMetadata(replayValueCheckpoint, checkpoints) {
|
|
|
87312
87362
|
...replayValueCheckpoint.sessionId === undefined ? metadataValue(checkpoints, "sessionId") : {},
|
|
87313
87363
|
...replayValueCheckpoint.sessionFile === undefined ? metadataValue(checkpoints, "sessionFile") : {},
|
|
87314
87364
|
...replayValueCheckpoint.model === undefined ? metadataValue(checkpoints, "model") : {},
|
|
87365
|
+
...replayValueCheckpoint.thinkingLevel === undefined ? metadataValue(checkpoints, "thinkingLevel") : {},
|
|
87315
87366
|
...replayValueCheckpoint.attemptedModels === undefined ? metadataValue(checkpoints, "attemptedModels") : {},
|
|
87316
87367
|
...replayValueCheckpoint.modelAttempts === undefined ? metadataValue(checkpoints, "modelAttempts") : {},
|
|
87317
87368
|
...replayValueCheckpoint.structured === undefined ? metadataValue(checkpoints, "structured") : {},
|
|
@@ -87401,6 +87452,7 @@ function recordCachedStageIntoStore(store, runId, name, replayKey, output, compl
|
|
|
87401
87452
|
...checkpoint?.sessionId !== undefined ? { sessionId: checkpoint.sessionId } : {},
|
|
87402
87453
|
...checkpoint?.sessionFile !== undefined ? { sessionFile: checkpoint.sessionFile } : {},
|
|
87403
87454
|
...checkpoint?.model !== undefined ? { model: checkpoint.model } : {},
|
|
87455
|
+
...checkpoint?.thinkingLevel !== undefined ? { thinkingLevel: checkpoint.thinkingLevel } : {},
|
|
87404
87456
|
...checkpoint?.attemptedModels !== undefined ? { attemptedModels: checkpoint.attemptedModels } : {},
|
|
87405
87457
|
...checkpoint?.modelAttempts !== undefined ? { modelAttempts: checkpoint.modelAttempts } : {},
|
|
87406
87458
|
...checkpoint?.structured !== undefined ? { structured: checkpoint.structured } : {},
|
|
@@ -88216,19 +88268,15 @@ async function resumeRun(runId, opts) {
|
|
|
88216
88268
|
...acknowledgementMessage !== undefined ? { message: acknowledgementMessage } : {}
|
|
88217
88269
|
};
|
|
88218
88270
|
}
|
|
88219
|
-
function pauseRun(runId, opts) {
|
|
88220
|
-
return pauseRunWithAction(runId, opts, "pause");
|
|
88221
|
-
}
|
|
88222
88271
|
async function pauseRunWithAction(runId, opts, action = "pause") {
|
|
88223
88272
|
const activeStore = opts?.store ?? store;
|
|
88224
88273
|
const registry = opts?.stageControlRegistry ?? stageControlRegistry;
|
|
88225
88274
|
const run = activeStore.runs().find((candidate) => candidate.id === runId);
|
|
88226
|
-
const actorMetadata = opts?.actor === undefined ? undefined : { actor: opts.actor };
|
|
88227
88275
|
if (!run)
|
|
88228
88276
|
return { ok: false, runId, reason: "not_found" };
|
|
88229
88277
|
if (run.endedAt !== undefined)
|
|
88230
88278
|
return { ok: false, runId, reason: "already_ended" };
|
|
88231
|
-
workflowObservationRuntime(activeStore).control(runId, action
|
|
88279
|
+
workflowObservationRuntime(activeStore).control(runId, action);
|
|
88232
88280
|
if (opts?.stageId !== undefined) {
|
|
88233
88281
|
const handle = registry.get(runId, opts.stageId);
|
|
88234
88282
|
if (!handle)
|
|
@@ -88243,9 +88291,7 @@ async function pauseRunWithAction(runId, opts, action = "pause") {
|
|
|
88243
88291
|
const paused = stage === undefined ? [] : [structuredClone(stage)];
|
|
88244
88292
|
const stillActive = currentRun?.stages.some((candidate) => candidate.id !== opts.stageId && (candidate.status === "running" || candidate.status === "pending")) ?? false;
|
|
88245
88293
|
if (!stillActive)
|
|
88246
|
-
activeStore.recordRunPaused(runId
|
|
88247
|
-
else if (actorMetadata !== undefined)
|
|
88248
|
-
activeStore.recordStagePaused(runId, opts.stageId, undefined, actorMetadata);
|
|
88294
|
+
activeStore.recordRunPaused(runId);
|
|
88249
88295
|
return { ok: true, runId, paused };
|
|
88250
88296
|
}
|
|
88251
88297
|
const controlRunIds = expandedControlRunIds(activeStore, runId);
|
|
@@ -88256,7 +88302,7 @@ async function pauseRunWithAction(runId, opts, action = "pause") {
|
|
|
88256
88302
|
const activeRunIds = new Set([...controlRunIds, ...runtimeControls.map(({ controlRunId }) => controlRunId)]);
|
|
88257
88303
|
if (runtimeControls.some(({ controlRunId }) => controlRunId === runId) && [...activeRunIds].every((id) => toolControls.active(id).length === 0 && registry.run(id).stages().length === 0)) {
|
|
88258
88304
|
await Promise.all(runtimeControls.map(({ handle }) => handle.pause()));
|
|
88259
|
-
activeStore.recordRunPaused(runId
|
|
88305
|
+
activeStore.recordRunPaused(runId);
|
|
88260
88306
|
return {
|
|
88261
88307
|
ok: true,
|
|
88262
88308
|
runId,
|
|
@@ -88282,19 +88328,10 @@ async function pauseRunWithAction(runId, opts, action = "pause") {
|
|
|
88282
88328
|
continue;
|
|
88283
88329
|
activeStore.recordRunPaused(pausedRunId);
|
|
88284
88330
|
}
|
|
88285
|
-
activeStore.recordRunPaused(runId
|
|
88331
|
+
activeStore.recordRunPaused(runId);
|
|
88286
88332
|
return { ok: true, runId, paused };
|
|
88287
88333
|
}
|
|
88288
|
-
async function
|
|
88289
|
-
const activeStore = opts?.store ?? store;
|
|
88290
|
-
const inFlight = topLevelWorkflowRuns(activeStore.runs()).filter((run) => run.endedAt === undefined);
|
|
88291
|
-
return Promise.all(inFlight.map((run) => pauseRun(run.id, {
|
|
88292
|
-
store: activeStore,
|
|
88293
|
-
stageControlRegistry: opts?.stageControlRegistry,
|
|
88294
|
-
...opts?.actor === undefined ? {} : { actor: opts.actor }
|
|
88295
|
-
})));
|
|
88296
|
-
}
|
|
88297
|
-
async function interruptRun(runId, opts) {
|
|
88334
|
+
async function pauseRun(runId, opts) {
|
|
88298
88335
|
if (opts?.stageId === undefined) {
|
|
88299
88336
|
const activeStore = opts?.store ?? store;
|
|
88300
88337
|
const toolControls = opts?.toolControlRegistry ?? toolControlRegistry;
|
|
@@ -88304,19 +88341,18 @@ async function interruptRun(runId, opts) {
|
|
|
88304
88341
|
store: activeStore,
|
|
88305
88342
|
stageControlRegistry: opts?.stageControlRegistry,
|
|
88306
88343
|
toolControlRegistry: toolControls
|
|
88307
|
-
}, "
|
|
88344
|
+
}, "pause");
|
|
88308
88345
|
if (quit.ok)
|
|
88309
88346
|
return { ok: true, runId: quit.runId, paused: quit.paused };
|
|
88310
88347
|
return { ok: false, runId: quit.runId, reason: quit.reason };
|
|
88311
88348
|
}
|
|
88312
88349
|
}
|
|
88313
|
-
|
|
88314
|
-
return result.ok && result.message !== undefined ? { ...result, message: `Run ${runId} interrupted. ${result.message}` } : result;
|
|
88350
|
+
return pauseRunWithAction(runId, opts, "pause");
|
|
88315
88351
|
}
|
|
88316
|
-
async function
|
|
88352
|
+
async function pauseAllRuns(opts) {
|
|
88317
88353
|
const activeStore = opts?.store ?? store;
|
|
88318
88354
|
const inFlight = topLevelWorkflowRuns(activeStore.runs()).filter((run) => run.endedAt === undefined);
|
|
88319
|
-
return Promise.all(inFlight.map((run) =>
|
|
88355
|
+
return Promise.all(inFlight.map((run) => pauseRun(run.id, {
|
|
88320
88356
|
store: activeStore,
|
|
88321
88357
|
stageControlRegistry: opts?.stageControlRegistry,
|
|
88322
88358
|
toolControlRegistry: opts?.toolControlRegistry
|
|
@@ -89444,9 +89480,6 @@ function resolvedControlNodeTarget(node) {
|
|
|
89444
89480
|
const graphTarget = node.workflowGraphTarget;
|
|
89445
89481
|
return node.nodeKind === "tool" ? { ok: true, kind: "tool", runId: graphTarget.runId, nodeId: graphTarget.stageId, name: node.name } : { ok: true, kind: "stage", runId: graphTarget.runId, stageId: graphTarget.stageId };
|
|
89446
89482
|
}
|
|
89447
|
-
function toolNodePauseRejectionMessage(name, nodeId) {
|
|
89448
|
-
return `Tool nodes cannot be paused; ctx.tool ${name} (${nodeId}) has no turn boundary. Use interrupt or quit to abort it.`;
|
|
89449
|
-
}
|
|
89450
89483
|
function overlaySurfaceFromContext(ctx) {
|
|
89451
89484
|
return typeof ctx?.ui?.custom === "function" ? { ui: ctx.ui } : undefined;
|
|
89452
89485
|
}
|
|
@@ -89951,7 +89984,7 @@ function mergeConfigs(base, override) {
|
|
|
89951
89984
|
}
|
|
89952
89985
|
var WORKFLOW_CONFIG_DEFAULTS = {
|
|
89953
89986
|
maxDepth: 4,
|
|
89954
|
-
defaultConcurrency:
|
|
89987
|
+
defaultConcurrency: 3,
|
|
89955
89988
|
persistRuns: true,
|
|
89956
89989
|
statusFile: false,
|
|
89957
89990
|
resumeInFlight: "ask",
|
|
@@ -101041,7 +101074,7 @@ class ConcurrencyLimiter {
|
|
|
101041
101074
|
}
|
|
101042
101075
|
}
|
|
101043
101076
|
function createRunLimiter(defaultConcurrency) {
|
|
101044
|
-
return new ConcurrencyLimiter(defaultConcurrency ??
|
|
101077
|
+
return new ConcurrencyLimiter(defaultConcurrency ?? 3);
|
|
101045
101078
|
}
|
|
101046
101079
|
|
|
101047
101080
|
// dist/builtin/workflows/src/shared/abort.ts
|
|
@@ -101631,6 +101664,7 @@ function createTaskPrimitive(runtime) {
|
|
|
101631
101664
|
...sessionId !== undefined ? { sessionId } : {},
|
|
101632
101665
|
...stage.sessionFile !== undefined ? { sessionFile: stage.sessionFile } : {},
|
|
101633
101666
|
...stageMeta.model !== undefined ? { model: stageMeta.model } : {},
|
|
101667
|
+
...stageMeta.thinkingLevel !== undefined ? { thinkingLevel: stageMeta.thinkingLevel } : {},
|
|
101634
101668
|
...stageMeta.attemptedModels !== undefined ? { attemptedModels: stageMeta.attemptedModels } : {},
|
|
101635
101669
|
...stageMeta.modelAttempts !== undefined ? { modelAttempts: stageMeta.modelAttempts } : {},
|
|
101636
101670
|
...stageMeta.warnings !== undefined ? { warnings: stageMeta.warnings } : {}
|
|
@@ -102373,6 +102407,7 @@ function mergeStageDraft(existing, checkpoint, sequence) {
|
|
|
102373
102407
|
...valueOrExisting("endedAt", checkpoint, existing),
|
|
102374
102408
|
...valueOrExisting("durationMs", checkpoint, existing),
|
|
102375
102409
|
...valueOrExisting("model", checkpoint, existing),
|
|
102410
|
+
...valueOrExisting("thinkingLevel", checkpoint, existing),
|
|
102376
102411
|
...valueOrExisting("attemptedModels", checkpoint, existing),
|
|
102377
102412
|
...valueOrExisting("modelAttempts", checkpoint, existing),
|
|
102378
102413
|
...checkpoint.topology !== undefined ? { topology: checkpoint.topology } : existing?.topology !== undefined ? { topology: existing.topology } : {}
|
|
@@ -103262,6 +103297,7 @@ function stageSnapshotFromDraft(draft, id, parentIds) {
|
|
|
103262
103297
|
...draft.sessionId !== undefined ? { sessionId: draft.sessionId } : {},
|
|
103263
103298
|
...draft.sessionFile !== undefined ? { sessionFile: draft.sessionFile } : {},
|
|
103264
103299
|
...draft.model !== undefined ? { model: draft.model } : {},
|
|
103300
|
+
...draft.thinkingLevel !== undefined ? { thinkingLevel: draft.thinkingLevel } : {},
|
|
103265
103301
|
...draft.attemptedModels !== undefined ? { attemptedModels: draft.attemptedModels } : {},
|
|
103266
103302
|
...draft.modelAttempts !== undefined ? { modelAttempts: draft.modelAttempts } : {}
|
|
103267
103303
|
};
|
|
@@ -105042,7 +105078,7 @@ function createReplayStageContext(input) {
|
|
|
105042
105078
|
return replaySource.model;
|
|
105043
105079
|
},
|
|
105044
105080
|
get thinkingLevel() {
|
|
105045
|
-
return;
|
|
105081
|
+
return replaySource.thinkingLevel;
|
|
105046
105082
|
},
|
|
105047
105083
|
get messages() {
|
|
105048
105084
|
return [];
|
|
@@ -105068,6 +105104,7 @@ function createReplayStageContext(input) {
|
|
|
105068
105104
|
__pendingMessageCount: () => 0,
|
|
105069
105105
|
__modelFallbackMeta: () => ({
|
|
105070
105106
|
...replaySource.model !== undefined ? { model: replaySource.model } : {},
|
|
105107
|
+
...replaySource.thinkingLevel !== undefined ? { thinkingLevel: replaySource.thinkingLevel } : {},
|
|
105071
105108
|
...replaySource.attemptedModels !== undefined ? { attemptedModels: replaySource.attemptedModels } : {},
|
|
105072
105109
|
...replaySource.modelAttempts !== undefined ? { modelAttempts: replaySource.modelAttempts } : {}
|
|
105073
105110
|
}),
|
|
@@ -106101,7 +106138,8 @@ class StageSessionPause {
|
|
|
106101
106138
|
abortBoundary: Promise.withResolvers(),
|
|
106102
106139
|
runnerOwnedDeliveries: new Set,
|
|
106103
106140
|
confirmed: false,
|
|
106104
|
-
...nativeQueuePause === undefined ? {} : { nativeQueuePause }
|
|
106141
|
+
...nativeQueuePause === undefined ? {} : { nativeQueuePause },
|
|
106142
|
+
...session?.pauseTasks && session.resumeTasks ? { taskControl: session } : {}
|
|
106105
106143
|
};
|
|
106106
106144
|
request.deferred.promise.catch(() => {});
|
|
106107
106145
|
request.abortBoundary.promise.catch(() => {});
|
|
@@ -106109,7 +106147,11 @@ class StageSessionPause {
|
|
|
106109
106147
|
let failed = false;
|
|
106110
106148
|
try {
|
|
106111
106149
|
request.nativeQueuePause?.pauseQueuedMessages();
|
|
106112
|
-
|
|
106150
|
+
const tasks = request.taskControl?.pauseTasks?.();
|
|
106151
|
+
const settled = await Promise.allSettled([tasks, (async () => session?.abort())()]);
|
|
106152
|
+
for (const result of settled)
|
|
106153
|
+
if (result.status === "rejected")
|
|
106154
|
+
throw result.reason;
|
|
106113
106155
|
request.abortBoundary.resolve();
|
|
106114
106156
|
await request.abortBoundary.promise;
|
|
106115
106157
|
request.confirmed = true;
|
|
@@ -106117,6 +106159,7 @@ class StageSessionPause {
|
|
|
106117
106159
|
failed = true;
|
|
106118
106160
|
request.abortBoundary.reject(error);
|
|
106119
106161
|
request.deferred.reject(error);
|
|
106162
|
+
request.taskControl?.resumeTasks?.();
|
|
106120
106163
|
await this.rollbackNativePause(request.nativeQueuePause);
|
|
106121
106164
|
throw error;
|
|
106122
106165
|
} finally {
|
|
@@ -106184,6 +106227,7 @@ class StageSessionPause {
|
|
|
106184
106227
|
if (releaseAdmitted)
|
|
106185
106228
|
return;
|
|
106186
106229
|
beforeRelease?.();
|
|
106230
|
+
request.taskControl?.resumeTasks?.();
|
|
106187
106231
|
releaseAdmitted = true;
|
|
106188
106232
|
};
|
|
106189
106233
|
let releasedQueuedMessages;
|
|
@@ -106280,6 +106324,9 @@ async function rejectDisposedCreatedSession(result, stageName) {
|
|
|
106280
106324
|
class StageSessionReplacement {
|
|
106281
106325
|
previous;
|
|
106282
106326
|
cleanups = new Set;
|
|
106327
|
+
get retiringSession() {
|
|
106328
|
+
return this.previous;
|
|
106329
|
+
}
|
|
106283
106330
|
retire(session) {
|
|
106284
106331
|
this.previous = session;
|
|
106285
106332
|
}
|
|
@@ -106664,7 +106711,7 @@ class StageSessionController {
|
|
|
106664
106711
|
pendingThinkingLevel;
|
|
106665
106712
|
pendingListeners = new Set;
|
|
106666
106713
|
listenerUnsubscribes = new Map;
|
|
106667
|
-
pauseControl = new StageSessionPause(() => this.session);
|
|
106714
|
+
pauseControl = new StageSessionPause(() => this.session ?? this.replacement.retiringSession);
|
|
106668
106715
|
hasExplicitModelFallbackConfig;
|
|
106669
106716
|
candidatesPromise;
|
|
106670
106717
|
activeCandidateIndex;
|
|
@@ -106943,8 +106990,10 @@ class StageSessionController {
|
|
|
106943
106990
|
currentModelFallbackMeta() {
|
|
106944
106991
|
const attemptedModels = this.modelAttempts.map((attempt) => attempt.model);
|
|
106945
106992
|
const model = this.selectedModel ?? workflowModelId(this.session?.model);
|
|
106993
|
+
const thinkingLevel = this.session?.thinkingLevel ?? this.pendingThinkingLevel;
|
|
106946
106994
|
return {
|
|
106947
106995
|
...model !== undefined ? { model } : {},
|
|
106996
|
+
...thinkingLevel !== undefined ? { thinkingLevel } : {},
|
|
106948
106997
|
...attemptedModels.length > 0 ? { attemptedModels } : {},
|
|
106949
106998
|
...this.modelAttempts.length > 0 ? { modelAttempts: [...this.modelAttempts] } : {},
|
|
106950
106999
|
...this.modelWarnings.length > 0 ? { warnings: [...this.modelWarnings] } : {}
|
|
@@ -108314,6 +108363,8 @@ function createWorkflowStageFactory(input) {
|
|
|
108314
108363
|
...replaySource.result !== undefined ? { result: replaySource.result } : {},
|
|
108315
108364
|
...replaySource.sessionId !== undefined ? { sessionId: replaySource.sessionId } : {},
|
|
108316
108365
|
...replaySource.sessionFile !== undefined ? { sessionFile: replaySource.sessionFile } : {},
|
|
108366
|
+
...replaySource.model !== undefined ? { model: replaySource.model } : {},
|
|
108367
|
+
...replaySource.thinkingLevel !== undefined ? { thinkingLevel: replaySource.thinkingLevel } : {},
|
|
108317
108368
|
replayedFromStageId: replaySource.id,
|
|
108318
108369
|
replayed: true
|
|
108319
108370
|
} : {},
|
|
@@ -108338,6 +108389,10 @@ function createWorkflowStageFactory(input) {
|
|
|
108338
108389
|
const applyModelFallbackMeta = (meta) => {
|
|
108339
108390
|
if (meta.model !== undefined)
|
|
108340
108391
|
stageSnapshot.model = meta.model;
|
|
108392
|
+
if (meta.thinkingLevel !== undefined)
|
|
108393
|
+
stageSnapshot.thinkingLevel = meta.thinkingLevel;
|
|
108394
|
+
else
|
|
108395
|
+
delete stageSnapshot.thinkingLevel;
|
|
108341
108396
|
if (meta.attemptedModels !== undefined)
|
|
108342
108397
|
stageSnapshot.attemptedModels = meta.attemptedModels;
|
|
108343
108398
|
if (meta.modelAttempts !== undefined)
|
|
@@ -111091,7 +111146,7 @@ function formatWorkflowHeartbeatNoticeText(details) {
|
|
|
111091
111146
|
const workflowName = escapeQuotedText3(details.workflowName);
|
|
111092
111147
|
const elapsed = formatWorkflowHeartbeatElapsed(details);
|
|
111093
111148
|
const cadence = formatWorkflowHeartbeatCadence(details.intervalMinutes);
|
|
111094
|
-
return `${WORKFLOW_HEARTBEAT_GLYPH} Workflow "${workflowName}" heartbeat (run ${details.runId}) — still running` + `${elapsed === undefined ? "" : ` after ${elapsed}`}, on a ${cadence} cadence. ` + "This is a periodic alignment check. Review whether the run is still on goal. " + "When steering or communication is useful, use Intercom. Before steering a stage, join its invocation group. " + "Use the Intercom `groups` action to discover it. Workflow invocation groups are named `workflow:<rootRunId>`. " + "Consider the expanded workflow topology and match each update's reach to its impact: send a local update to " + "its affected stage; when shared scope or acceptance criteria change, broadcast one authoritative Intercom update " + "to `workflow:<rootRunId>/**` (or a narrower path pattern such as `workflow:<rootRunId>/review-*`) rather than " + "enumerating stages, including each worker-to-reviewer loop. `**` reaches every live stage now and remains sticky " + "for every future stage, including nested children, until the root run terminates. Use `intercom list` inside the " + "invocation group to see live, pending, and possible future targets. Targets use " + "`workflow:<rootRunId>/<segment>[/<segment>...]`; `*` matches one segment and `**` any depth. Intercom delivers " + "immediately to live stages and queues updates for known stages that have not started, delivering them before their " + "first model turn, so workers and reviewers begin with one consistent contract. A valid target outside the known set " + "queues with a `notInKnownSet` warning and settles undeliverable at terminal only if never delivered. " + "Use `ask` once the target has a live session that can reply. " + "Use workflow pause, resume,
|
|
111149
|
+
return `${WORKFLOW_HEARTBEAT_GLYPH} Workflow "${workflowName}" heartbeat (run ${details.runId}) — still running` + `${elapsed === undefined ? "" : ` after ${elapsed}`}, on a ${cadence} cadence. ` + "This is a periodic alignment check. Review whether the run is still on goal. " + "When steering or communication is useful, use Intercom. Before steering a stage, join its invocation group. " + "Use the Intercom `groups` action to discover it. Workflow invocation groups are named `workflow:<rootRunId>`. " + "Consider the expanded workflow topology and match each update's reach to its impact: send a local update to " + "its affected stage; when shared scope or acceptance criteria change, broadcast one authoritative Intercom update " + "to `workflow:<rootRunId>/**` (or a narrower path pattern such as `workflow:<rootRunId>/review-*`) rather than " + "enumerating stages, including each worker-to-reviewer loop. `**` reaches every live stage now and remains sticky " + "for every future stage, including nested children, until the root run terminates. Use `intercom list` inside the " + "invocation group to see live, pending, and possible future targets. Targets use " + "`workflow:<rootRunId>/<segment>[/<segment>...]`; `*` matches one segment and `**` any depth. Intercom delivers " + "immediately to live stages and queues updates for known stages that have not started, delivering them before their " + "first model turn, so workers and reviewers begin with one consistent contract. A valid target outside the known set " + "queues with a `notInKnownSet` warning and settles undeliverable at terminal only if never delivered. " + "Use `ask` once the target has a live session that can reply. " + "Use workflow pause, resume, or quit for run control. " + "Continue the progressing run when no intervention is needed, or ask the user when a decision is needed. " + `Inspect: /workflow status ${details.runId}`;
|
|
111095
111150
|
}
|
|
111096
111151
|
function registerWorkflowHeartbeatRenderer(options) {
|
|
111097
111152
|
const register = options.registerMessageRenderer;
|
|
@@ -113271,11 +113326,13 @@ function makeWorkflowStageOrchestrationContext(meta, pi) {
|
|
|
113271
113326
|
function withWorkflowStageSessionOptions(options, meta, pi) {
|
|
113272
113327
|
const policyExcludedTools = meta?.executionMode === "non_interactive" ? ["workflow", "ask_user_question"] : ["workflow"];
|
|
113273
113328
|
const excludedTools = Array.from(new Set([...options.excludedTools ?? [], ...policyExcludedTools]));
|
|
113329
|
+
const existingContext = meta?.orchestrationContext ?? options.orchestrationContext;
|
|
113330
|
+
const defaultContext = meta && existingContext?.lateMessageRouter === undefined ? makeWorkflowStageOrchestrationContext(meta, pi) : undefined;
|
|
113274
113331
|
return {
|
|
113275
113332
|
...options,
|
|
113276
113333
|
excludedTools,
|
|
113277
113334
|
...meta ? {
|
|
113278
|
-
orchestrationContext:
|
|
113335
|
+
orchestrationContext: defaultContext === undefined ? existingContext : { ...defaultContext, ...existingContext, lateMessageRouter: defaultContext.lateMessageRouter }
|
|
113279
113336
|
} : {}
|
|
113280
113337
|
};
|
|
113281
113338
|
}
|
|
@@ -113904,9 +113961,8 @@ function adminCompletions() {
|
|
|
113904
113961
|
{ value: "attach ", label: "attach", description: "Open the in-place attach pane on a node" },
|
|
113905
113962
|
{ value: "list ", label: "list", description: "List registered workflows" },
|
|
113906
113963
|
{ value: "status ", label: "status", description: "List current-session active and retained terminal runs" },
|
|
113907
|
-
{ value: "
|
|
113964
|
+
{ value: "pause ", label: "pause", description: "Pause a run" },
|
|
113908
113965
|
{ value: "quit ", label: "quit", description: "Quit a run and keep it resumable" },
|
|
113909
|
-
{ value: "pause ", label: "pause", description: "Pause a run or stage" },
|
|
113910
113966
|
{ value: "resume ", label: "resume", description: "Re-open overlay for a run" },
|
|
113911
113967
|
{ value: "inputs ", label: "inputs", description: "Show a workflow's input schema" },
|
|
113912
113968
|
{ value: "reload ", label: "reload", description: "Reload workflow resources" }
|
|
@@ -113933,7 +113989,7 @@ function workflowArgumentCompletionsNeedWorkflowResources(partial) {
|
|
|
113933
113989
|
return true;
|
|
113934
113990
|
if (!subcommand || subcommand === "inputs")
|
|
113935
113991
|
return true;
|
|
113936
|
-
if (["status", "connect", "resume", "attach", "pause", "
|
|
113992
|
+
if (["status", "connect", "resume", "attach", "pause", "quit", "reload"].includes(subcommand)) {
|
|
113937
113993
|
return false;
|
|
113938
113994
|
}
|
|
113939
113995
|
return true;
|
|
@@ -113947,12 +114003,12 @@ function workflowArgumentCompletions(partial, runtime) {
|
|
|
113947
114003
|
}
|
|
113948
114004
|
if (subcommand === "inputs")
|
|
113949
114005
|
return completeToken(partial, workflows());
|
|
113950
|
-
if (["status", "connect", "resume", "attach"
|
|
114006
|
+
if (["status", "connect", "resume", "attach"].includes(subcommand)) {
|
|
113951
114007
|
return completeToken(partial, runIdItems());
|
|
113952
114008
|
}
|
|
113953
|
-
if (subcommand === "
|
|
114009
|
+
if (subcommand === "pause") {
|
|
113954
114010
|
return completeToken(partial, [
|
|
113955
|
-
{ value: "--all ", label: "--all", description: "
|
|
114011
|
+
{ value: "--all ", label: "--all", description: "Pause all in-flight runs" },
|
|
113956
114012
|
{ value: "--yes ", label: "--yes", description: "Skip confirmation" },
|
|
113957
114013
|
{ value: "-y ", label: "-y", description: "Skip confirmation" },
|
|
113958
114014
|
...runIdItems()
|
|
@@ -114768,8 +114824,8 @@ ${renderSessionList(store.runs(), { theme, includeAll: true })}`);
|
|
|
114768
114824
|
print(`Connected to ${resolved.runId}. h hide · ctrl+x leave graph · return to main chat · esc close.`);
|
|
114769
114825
|
return true;
|
|
114770
114826
|
}
|
|
114771
|
-
if (action === "
|
|
114772
|
-
const { tokens, yes } = action === "
|
|
114827
|
+
if (action === "pause" || action === "quit") {
|
|
114828
|
+
const { tokens, yes } = action === "pause" ? stripYesFlag(rest) : { tokens: rest, yes: false };
|
|
114773
114829
|
const unsupportedTarget = action === "quit" ? tokens.find((token) => token === "-y" || token === "--yes") : undefined;
|
|
114774
114830
|
let target = action === "quit" ? unsupportedTarget ?? tokens.find((token) => token !== "--all") : tokens.find((token) => !token.startsWith("--"));
|
|
114775
114831
|
const wantsAll = unsupportedTarget === undefined && tokens.includes("--all");
|
|
@@ -114786,15 +114842,15 @@ ${renderSessionList(store.runs(), { theme, includeAll: true })}`);
|
|
|
114786
114842
|
fail(`No in-flight runs to ${action}.`);
|
|
114787
114843
|
return true;
|
|
114788
114844
|
}
|
|
114789
|
-
if (action === "
|
|
114790
|
-
const title = `
|
|
114845
|
+
if (action === "pause" && !yes && confirmationPrompt) {
|
|
114846
|
+
const title = `Pause all ${inFlight.length} in-flight workflow runs?`;
|
|
114791
114847
|
const body = `Pauses: ${inFlight.map((run) => `${run.name} (${run.id})`).join(", ")}`;
|
|
114792
114848
|
if (!await confirmationPrompt(title, body)) {
|
|
114793
114849
|
print("Cancelled.");
|
|
114794
114850
|
return true;
|
|
114795
114851
|
}
|
|
114796
114852
|
}
|
|
114797
|
-
const results = action === "quit" ? await quitAllRuns({ actor: "user" }) : await
|
|
114853
|
+
const results = action === "quit" ? await quitAllRuns({ actor: "user" }) : await pauseAllRuns();
|
|
114798
114854
|
const successes = results.filter((result) => result.ok);
|
|
114799
114855
|
const changed = successes.length;
|
|
114800
114856
|
const failures = results.filter((result) => !result.ok);
|
|
@@ -114807,7 +114863,7 @@ ${renderSessionList(store.runs(), { theme, includeAll: true })}`);
|
|
|
114807
114863
|
fail(message);
|
|
114808
114864
|
} else if (changed > 0) {
|
|
114809
114865
|
print(successes.some((result) => result.message !== undefined) ? successes.map((result) => result.message ?? `Run ${result.runId} stopped.`).join(`
|
|
114810
|
-
`) : action === "quit" ? `Quit ${changed} run(s); resume with /workflow resume.` : `
|
|
114866
|
+
`) : action === "quit" ? `Quit ${changed} run(s); resume with /workflow resume.` : `Paused ${changed} run(s).`);
|
|
114811
114867
|
} else {
|
|
114812
114868
|
fail(`No in-flight runs to ${action}.`);
|
|
114813
114869
|
}
|
|
@@ -114844,24 +114900,24 @@ ${renderSessionList(store.runs(), { theme, includeAll: true })}`);
|
|
|
114844
114900
|
return true;
|
|
114845
114901
|
}
|
|
114846
114902
|
if (!yes && run && run.endedAt === undefined && confirmationPrompt) {
|
|
114847
|
-
const confirmed = await confirmationPrompt(`
|
|
114903
|
+
const confirmed = await confirmationPrompt(`Pause workflow run ${run.name} (${run.id})?`, "Pauses live work so it can be resumed later.");
|
|
114848
114904
|
if (!confirmed) {
|
|
114849
114905
|
print(`Cancelled. Run ${resolved.runId} is still active.`);
|
|
114850
114906
|
return true;
|
|
114851
114907
|
}
|
|
114852
114908
|
}
|
|
114853
114909
|
try {
|
|
114854
|
-
const result = await
|
|
114910
|
+
const result = await pauseRun(resolved.runId);
|
|
114855
114911
|
if (result.ok)
|
|
114856
|
-
print(result.message ?? `Run ${result.runId}
|
|
114912
|
+
print(result.message ?? `Run ${result.runId} paused and can be resumed.`);
|
|
114857
114913
|
else
|
|
114858
|
-
fail(result.reason === "not_found" ? `Run not found: ${target}` : result.reason === "already_ended" ? `Run already ended: ${target}` : result.reason === "stage_not_found" ? `Stage not found for run ${resolved.runId}.` : `No active stages to
|
|
114914
|
+
fail(result.reason === "not_found" ? `Run not found: ${target}` : result.reason === "already_ended" ? `Run already ended: ${target}` : result.reason === "stage_not_found" ? `Stage not found for run ${resolved.runId}.` : `No active stages to pause on run ${resolved.runId}.`);
|
|
114859
114915
|
} catch (error) {
|
|
114860
|
-
fail(`Failed to
|
|
114916
|
+
fail(`Failed to pause run ${resolved.runId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
114861
114917
|
}
|
|
114862
114918
|
return true;
|
|
114863
114919
|
}
|
|
114864
|
-
if (action === "attach" || action === "
|
|
114920
|
+
if (action === "attach" || action === "resume") {
|
|
114865
114921
|
const target = rest[0];
|
|
114866
114922
|
const stageTarget = rest[1];
|
|
114867
114923
|
const message = action === "resume" ? rest.slice(2).join(" ").trim() || undefined : undefined;
|
|
@@ -114869,14 +114925,7 @@ ${renderSessionList(store.runs(), { theme, includeAll: true })}`);
|
|
|
114869
114925
|
if (!target) {
|
|
114870
114926
|
const ui = ctx.ui;
|
|
114871
114927
|
if (!canOpenPicker(ui)) {
|
|
114872
|
-
if (action === "
|
|
114873
|
-
const active = topLevelWorkflowRuns(store.runs()).filter((r) => r.endedAt === undefined);
|
|
114874
|
-
fail(active.length === 0 ? "No active runs to pause." : `Picker requires an interactive UI surface. Active runs:
|
|
114875
|
-
${active.map((r) => ` ${r.id} ${r.name}`).join(`
|
|
114876
|
-
`)}
|
|
114877
|
-
|
|
114878
|
-
Usage: /workflow pause <runId> [stageId]`);
|
|
114879
|
-
} else if (action === "attach") {
|
|
114928
|
+
if (action === "attach") {
|
|
114880
114929
|
fail(`${renderSessionList(store.runs(), { theme, includeAll: true })}
|
|
114881
114930
|
|
|
114882
114931
|
Picker requires an interactive UI surface. Pass a runId: /workflow attach <id> [stageId]`);
|
|
@@ -115040,21 +115089,6 @@ Picker requires an interactive UI surface. Pass a runId: /workflow attach <id> [
|
|
|
115040
115089
|
}
|
|
115041
115090
|
const stageId = resolvedStage.stageId;
|
|
115042
115091
|
const stageRunId = resolvedStage.runId ?? runId;
|
|
115043
|
-
if (action === "pause") {
|
|
115044
|
-
try {
|
|
115045
|
-
const result = await pauseRun(stageRunId, { stageId, actor: "user" });
|
|
115046
|
-
if (!result.ok) {
|
|
115047
|
-
fail(result.reason === "not_found" ? `Run not found: ${stageRunId}` : result.reason === "already_ended" ? `Run ${stageRunId} already ended.` : result.reason === "no_active_stages" ? `No pausable stages on run ${stageRunId}.` : `Stage not found: ${stageTarget ?? "(unknown)"}`);
|
|
115048
|
-
return true;
|
|
115049
|
-
}
|
|
115050
|
-
if (policy.allowInputPicker)
|
|
115051
|
-
deps.overlay.open(runId, overlaySurfaceFromContext(ctx), stageId, stageRunId);
|
|
115052
|
-
print(result.message ?? (result.paused.length === 0 ? `No stages were paused on run ${stageRunId}.` : `Paused ${result.paused.length} stage(s) on run ${stageRunId}: ${result.paused.map((stage) => stage.name).join(", ")}`));
|
|
115053
|
-
} catch (error) {
|
|
115054
|
-
fail(`Failed to pause run ${stageRunId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
115055
|
-
}
|
|
115056
|
-
return true;
|
|
115057
|
-
}
|
|
115058
115092
|
const run = store.runs().find((r) => r.id === stageRunId);
|
|
115059
115093
|
const hadPausedRunState = run?.status === "paused";
|
|
115060
115094
|
const hadPausedStageState = run !== undefined && workflowHasPausedStages(store, stageRunId);
|
|
@@ -115128,7 +115162,7 @@ Picker requires an interactive UI surface. Pass a runId: /workflow attach <id> [
|
|
|
115128
115162
|
// dist/builtin/workflows/src/extension/workflow-command-registration.ts
|
|
115129
115163
|
function registerWorkflowSlashCommand(pi, workflowCommands, deps) {
|
|
115130
115164
|
registerWorkflowCommand(pi, "workflow", {
|
|
115131
|
-
description: "Run or inspect Atomic workflows. Usage: /workflow <name> [key=value…] | /workflow [list|status|connect|attach|
|
|
115165
|
+
description: "Run or inspect Atomic workflows. Usage: /workflow <name> [key=value…] | /workflow [list|status|connect|attach|quit|pause|resume|inputs|reload] [args]",
|
|
115132
115166
|
handler: (args, ctx) => workflowSlashHandler(args, ctx, pi, deps),
|
|
115133
115167
|
getArgumentCompletions: (partial) => {
|
|
115134
115168
|
const buildCompletions = () => workflowArgumentCompletions(partial, deps.runtimeProxy);
|
|
@@ -115177,7 +115211,7 @@ Available: ${formatAvailableWorkflowNames(deps.runtimeProxy.registry.names())}`)
|
|
|
115177
115211
|
};
|
|
115178
115212
|
const parts = tokenizeWorkflowArgs(args);
|
|
115179
115213
|
const subcommand = parts[0] ?? "";
|
|
115180
|
-
if (["connect", "attach", "
|
|
115214
|
+
if (["connect", "attach", "resume"].includes(subcommand)) {
|
|
115181
115215
|
await handleRunControlCommand(subcommand, parts.slice(1), ctx, reporter, deps.runControl);
|
|
115182
115216
|
return;
|
|
115183
115217
|
}
|
|
@@ -115237,7 +115271,7 @@ Available: ${formatAvailableWorkflowNames(deps.runtimeProxy.registry.names())}`)
|
|
|
115237
115271
|
}
|
|
115238
115272
|
return;
|
|
115239
115273
|
}
|
|
115240
|
-
if (subcommand === "
|
|
115274
|
+
if (subcommand === "pause") {
|
|
115241
115275
|
await handleRunControlCommand(subcommand, withImplicitYesFlag(parts.slice(1)), ctx, reporter, deps.runControl);
|
|
115242
115276
|
return;
|
|
115243
115277
|
}
|
|
@@ -115756,7 +115790,7 @@ function renderStatusToolContent(result) {
|
|
|
115756
115790
|
lines.push(` … ${omitted} more pending stage${omitted === 1 ? "" : "s"}; use status with runId`);
|
|
115757
115791
|
}
|
|
115758
115792
|
});
|
|
115759
|
-
lines.push("hint: status with runId returns full run detail; workflow answer answers pending prompts using runId/stageId/promptId; workflow resume controls paused runs; pause/
|
|
115793
|
+
lines.push("hint: status with runId returns full run detail; workflow answer answers pending prompts using runId/stageId/promptId; workflow resume controls paused runs; pause/quit also accept runId. Ordinary Intercom handles free-form workflow-stage communication at workflow:<rootRunId>/<segment>[/<segment>...]: live stage delivery is immediate; a known pending stage `send` queues before its first model turn; `ask` requires a live reply-capable stage.");
|
|
115760
115794
|
return lines.join(`
|
|
115761
115795
|
`);
|
|
115762
115796
|
}
|
|
@@ -115887,7 +115921,6 @@ function renderWorkflowToolContent(result, args) {
|
|
|
115887
115921
|
case "answer":
|
|
115888
115922
|
case "pause":
|
|
115889
115923
|
case "reload":
|
|
115890
|
-
case "interrupt":
|
|
115891
115924
|
case "quit":
|
|
115892
115925
|
case "resume":
|
|
115893
115926
|
return compactWorkflowToolMessage(result);
|
|
@@ -115973,64 +116006,6 @@ function resumeControlFailure(runId, error) {
|
|
|
115973
116006
|
message: `Failed to resume run ${runId}: ${detail}`
|
|
115974
116007
|
};
|
|
115975
116008
|
}
|
|
115976
|
-
async function workflowPauseAction(args) {
|
|
115977
|
-
const target = resolveToolRunTarget(args, "No in-flight runs to pause.");
|
|
115978
|
-
const action = "pause";
|
|
115979
|
-
if (target.kind === "all") {
|
|
115980
|
-
if (args.stageId !== undefined && args.stageId.length > 0) {
|
|
115981
|
-
return { action, runId: "--all", status: "noop", message: allStageConflictMessage("pause") };
|
|
115982
|
-
}
|
|
115983
|
-
try {
|
|
115984
|
-
const results = await pauseAllRuns({ actor: "agent" });
|
|
115985
|
-
const paused = results.filter((result) => result.ok).length;
|
|
115986
|
-
return {
|
|
115987
|
-
action,
|
|
115988
|
-
runId: "--all",
|
|
115989
|
-
status: paused > 0 ? "paused" : "noop",
|
|
115990
|
-
message: [
|
|
115991
|
-
paused > 0 ? `Paused ${paused} run(s).` : "No in-flight runs to pause.",
|
|
115992
|
-
...results.flatMap((result) => result.ok && result.message !== undefined ? [result.message] : [])
|
|
115993
|
-
].join(`
|
|
115994
|
-
`)
|
|
115995
|
-
};
|
|
115996
|
-
} catch (error) {
|
|
115997
|
-
return controlFailure(action, "--all", error);
|
|
115998
|
-
}
|
|
115999
|
-
}
|
|
116000
|
-
if (target.kind === "malformed" || target.kind === "not_found")
|
|
116001
|
-
return { action, runId: target.target, status: "noop", message: target.message };
|
|
116002
|
-
const controlNode = resolveControlNodeTarget(target.runId, args.stageId);
|
|
116003
|
-
if (!controlNode.ok)
|
|
116004
|
-
return { action, runId: target.runId, status: "noop", message: controlNode.message };
|
|
116005
|
-
if (controlNode.kind === "tool") {
|
|
116006
|
-
return {
|
|
116007
|
-
action,
|
|
116008
|
-
runId: target.runId,
|
|
116009
|
-
status: "noop",
|
|
116010
|
-
message: toolNodePauseRejectionMessage(controlNode.name, controlNode.nodeId)
|
|
116011
|
-
};
|
|
116012
|
-
}
|
|
116013
|
-
const stage = resolveToolStageTarget(target.runId, args.stageId);
|
|
116014
|
-
if (!stage.ok)
|
|
116015
|
-
return { action, runId: target.runId, status: "noop", message: stage.message };
|
|
116016
|
-
const stageRunId = stage.runId ?? target.runId;
|
|
116017
|
-
try {
|
|
116018
|
-
const result = await pauseRun(stageRunId, { stageId: stage.stageId, actor: "agent" });
|
|
116019
|
-
return result.ok ? {
|
|
116020
|
-
action,
|
|
116021
|
-
runId: result.runId,
|
|
116022
|
-
status: "paused",
|
|
116023
|
-
message: result.message ?? `Paused ${result.paused.length} stage(s) on run ${result.runId}.`
|
|
116024
|
-
} : {
|
|
116025
|
-
action,
|
|
116026
|
-
runId: stageRunId,
|
|
116027
|
-
status: "noop",
|
|
116028
|
-
message: stageFailureMessage(stageRunId, result.reason, "pause")
|
|
116029
|
-
};
|
|
116030
|
-
} catch (error) {
|
|
116031
|
-
return controlFailure(action, stageRunId, error);
|
|
116032
|
-
}
|
|
116033
|
-
}
|
|
116034
116009
|
async function workflowReloadAction(args, deps) {
|
|
116035
116010
|
try {
|
|
116036
116011
|
const report = normalizeWorkflowReloadReport(await deps.reloadWorkflowResources());
|
|
@@ -116144,22 +116119,22 @@ async function workflowQuitAction(args) {
|
|
|
116144
116119
|
return controlFailure(action, target.runId, error);
|
|
116145
116120
|
}
|
|
116146
116121
|
}
|
|
116147
|
-
async function
|
|
116148
|
-
const target = resolveToolRunTarget(args, "No in-flight runs to
|
|
116149
|
-
const action = "
|
|
116122
|
+
async function workflowPauseAction(args) {
|
|
116123
|
+
const target = resolveToolRunTarget(args, "No in-flight runs to pause.");
|
|
116124
|
+
const action = "pause";
|
|
116150
116125
|
if (target.kind === "all") {
|
|
116151
116126
|
if (args.stageId !== undefined && args.stageId.length > 0) {
|
|
116152
|
-
return { action, runId: "--all", status: "noop", message: allStageConflictMessage("
|
|
116127
|
+
return { action, runId: "--all", status: "noop", message: allStageConflictMessage("pause") };
|
|
116153
116128
|
}
|
|
116154
116129
|
try {
|
|
116155
|
-
const results = await
|
|
116156
|
-
const
|
|
116130
|
+
const results = await pauseAllRuns();
|
|
116131
|
+
const paused = results.filter((result) => result.ok).length;
|
|
116157
116132
|
return {
|
|
116158
116133
|
action,
|
|
116159
116134
|
runId: "--all",
|
|
116160
|
-
status:
|
|
116135
|
+
status: paused > 0 ? "paused" : "noop",
|
|
116161
116136
|
message: [
|
|
116162
|
-
|
|
116137
|
+
paused > 0 ? `Paused ${paused} run(s).` : "No in-flight runs to pause.",
|
|
116163
116138
|
...results.flatMap((result) => result.ok && result.message !== undefined ? [result.message] : [])
|
|
116164
116139
|
].join(`
|
|
116165
116140
|
`)
|
|
@@ -116180,20 +116155,20 @@ async function workflowInterruptAction(args) {
|
|
|
116180
116155
|
return { action, runId: target.runId, status: "noop", message: stage.message };
|
|
116181
116156
|
const stageRunId = stage.runId ?? target.runId;
|
|
116182
116157
|
try {
|
|
116183
|
-
const result = await
|
|
116158
|
+
const result = await pauseRun(stageRunId, { stageId: stage.stageId });
|
|
116184
116159
|
if (result.ok) {
|
|
116185
116160
|
return {
|
|
116186
116161
|
action,
|
|
116187
116162
|
runId: result.runId,
|
|
116188
116163
|
status: "paused",
|
|
116189
|
-
message: result.message ?? (stage.stageId ? `Stage ${stage.stageId}
|
|
116164
|
+
message: result.message ?? (stage.stageId ? `Stage ${stage.stageId} paused on run ${result.runId} and can be resumed.` : `Run ${result.runId} paused and can be resumed.`)
|
|
116190
116165
|
};
|
|
116191
116166
|
}
|
|
116192
116167
|
return {
|
|
116193
116168
|
action,
|
|
116194
116169
|
runId: stageRunId,
|
|
116195
116170
|
status: "noop",
|
|
116196
|
-
message: stageFailureMessage(stageRunId, result.reason, "
|
|
116171
|
+
message: stageFailureMessage(stageRunId, result.reason, "pause")
|
|
116197
116172
|
};
|
|
116198
116173
|
} catch (error) {
|
|
116199
116174
|
return controlFailure(action, stageRunId, error);
|
|
@@ -116586,7 +116561,7 @@ function workflowStagesResult(args, source) {
|
|
|
116586
116561
|
error: target.message
|
|
116587
116562
|
};
|
|
116588
116563
|
}
|
|
116589
|
-
const stageSnapshots =
|
|
116564
|
+
const stageSnapshots = expandWorkflowGraph(readGraphStoreSnapshot(activeStore), target.runId).stages;
|
|
116590
116565
|
const stages = stageSnapshots.filter((stage) => filter === "all" || stage.status === filter).map(summarizeStage);
|
|
116591
116566
|
return { action: "stages", runId: target.runId, filter, stages };
|
|
116592
116567
|
}
|
|
@@ -116825,8 +116800,6 @@ function makeExecuteWorkflowTool(runtime, reloadWorkflowResources, ensureWorkflo
|
|
|
116825
116800
|
return awaitRequest(workflowReloadAction(args, { reloadWorkflowResources }));
|
|
116826
116801
|
case "quit":
|
|
116827
116802
|
return awaitRequest(workflowQuitAction(args));
|
|
116828
|
-
case "interrupt":
|
|
116829
|
-
return awaitRequest(workflowInterruptAction(args));
|
|
116830
116803
|
case "resume":
|
|
116831
116804
|
return awaitRequest(workflowResumeAction(args, { getRuntime, policy, ensureWorkflowResourcesLoaded, signal, onRunAccepted }));
|
|
116832
116805
|
default: {
|
|
@@ -116888,9 +116861,6 @@ function renderCall(args, opts = {}) {
|
|
|
116888
116861
|
case "reload":
|
|
116889
116862
|
line = "workflow: reload runtime";
|
|
116890
116863
|
break;
|
|
116891
|
-
case "interrupt":
|
|
116892
|
-
line = name === undefined ? "workflow: interrupt run" : `workflow: interrupt run ${quoted(name)}`;
|
|
116893
|
-
break;
|
|
116894
116864
|
case "quit":
|
|
116895
116865
|
line = name === undefined ? "workflow: quit run" : `workflow: quit run ${quoted(name)}`;
|
|
116896
116866
|
break;
|
|
@@ -117092,10 +117062,6 @@ function renderResult(result, opts) {
|
|
|
117092
117062
|
const r = result;
|
|
117093
117063
|
return renderNotice("WORKFLOW RELOAD", r.message, opts, themed);
|
|
117094
117064
|
}
|
|
117095
|
-
case "interrupt": {
|
|
117096
|
-
const r = result;
|
|
117097
|
-
return renderNotice("WORKFLOW INTERRUPT", `${r.runId}: ${r.message}`, opts, themed);
|
|
117098
|
-
}
|
|
117099
117065
|
case "quit": {
|
|
117100
117066
|
const r = result;
|
|
117101
117067
|
return renderNotice("WORKFLOW QUIT", `${r.runId}: ${r.message}`, opts, themed);
|
|
@@ -117125,7 +117091,7 @@ function renderResult(result, opts) {
|
|
|
117125
117091
|
}
|
|
117126
117092
|
|
|
117127
117093
|
// dist/builtin/workflows/src/extension/workflow-prompts.ts
|
|
117128
|
-
var WORKFLOW_TOOL_DESCRIPTION = "Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/atomic/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; " + "Requests to do the task 'quickly' or 'inline' mean no workflow creation or launch, including hidden/nested replacements. " + "when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; after successfully creating and reloading a newly authored custom workflow, report the folder containing its generated code as 'Custom workflow created. You can inspect its code at: <workflow-folder-path>'; do this only for newly created custom workflows, never builtin or pre-existing workflows; " + "discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, " + "answer pending prompts only while the root workflow is nonterminal, pause/resume/
|
|
117094
|
+
var WORKFLOW_TOOL_DESCRIPTION = "Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/atomic/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; " + "Requests to do the task 'quickly' or 'inline' mean no workflow creation or launch, including hidden/nested replacements. " + "when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; after successfully creating and reloading a newly authored custom workflow, report the folder containing its generated code as 'Custom workflow created. You can inspect its code at: <workflow-folder-path>'; do this only for newly created custom workflows, never builtin or pre-existing workflows; " + "discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, " + "answer pending prompts only while the root workflow is nonterminal, pause/resume/quit runs, and reload workflow resources. " + "When steering or communication is useful, use Intercom. Before steering a stage, join its invocation group. Use the Intercom `groups` action to discover it. Workflow invocation groups are named `workflow:<rootRunId>`. Then address the stage as `workflow:<rootRunId>/<segment>[/<segment>...]`; each segment may be a stage name, run id, or glob (`*` matches one segment and `**` any depth). Use `intercom list` inside the invocation group to see live, pending, and possible future targets. Live delivery is immediate; a known stage that has not started is queued and receives the message before its first model turn. Name and pattern sends remain sticky for every future matching stage until the root run terminates. When shared scope or acceptance criteria change, broadcast one authoritative update to `workflow:<rootRunId>/**` (or a narrower path pattern) rather than enumerating stages. A syntactically valid target outside the known set queues with a `notInKnownSet` warning and settles undeliverable at terminal only if never delivered. Use `ask` only for a reply-capable live session. " + "Treat a blocked run as continuable by default unless the user requests inline/no-workflow execution: then safely hold/stop it, reconcile completed work and in-flight side effects, and continue inline without duplication. Otherwise resume resumable blocks, answer pending prompts, steer past the obstacle, or start a follow-up workflow past a terminal block; resolve material ambiguity from user intent and repository evidence without bypassing safety or authorization. " + "For action 'run' and 'resume', budget accepts per-field duration, token, cost, and warning overrides; fields resolve over the workflow declaration and config, and 0 disables a field. " + "Before launching, share an estimated duration without confidence labels. Proceed with inherited budget limits without asking the user to choose a budget before each launch. Pass budget only for a user-specified limit; otherwise omit it and inherit the declaration and config. An estimate is not a budget. " + "For primitive prompt answers, use booleans or the documented confirm labels, exact case-insensitive select labels or 1-based indexes, and text strings for input/editor; an invalid answer remains pending and returns guidance instead of choosing a default. " + "For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. " + "Wrap critical parts of run inputs and steering messages in <keepContext>...</keepContext> so compaction preserves them verbatim in the stages that inherit them; tag role constraints, prohibitions, must-hold criteria, and identifiers, not background or bulk reference material. " + "For transcripts, prefer status/stages/stage to get sessionFile/transcriptPath, " + "quote the exact path without rewriting separators (Windows backslashes are valid), " + "then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview. " + "Use action 'models' to inspect models in the configured catalog; the result is a configured-auth snapshot showing what's present in the registry with configured authentication, not proof of credentials, entitlements, OAuth freshness, or live provider access. " + "When authoring a workflow that should dynamically select a model, first call workflow({ action: 'models' }) to inspect the configured catalog, then select from the returned provider/id entries considering the isCurrent marker and available thinking levels.";
|
|
117129
117095
|
var DEFAULT_PROMPT_GUIDANCE = [
|
|
117130
117096
|
`**Workflows**: Unless the user explicitly chooses inline execution for this task, treat workflows as the default execution path for non-trivial tasks and requests with structure and a verifiable objective. The following fit, architecture, launch and recovery defaults apply only when that choice has not opted out. Use the \`workflow\` tool for existing named workflows; when a different graph is needed, author a custom TypeScript \`workflow({...})\` with normal coding tools, reload workflow resources, and run it.
|
|
117131
117097
|
- Explicit requests such as "quickly", "inline", "do this directly", "don't use a workflow", or equivalent wording mean no workflow creation or launch for the specified task, even when complex. Treat "quickly" as an inline execution choice, not a request for a faster workflow. Do not substitute a hidden/nested workflow or pressure the user to reapprove their choice. Preserve appropriate testing, review and evidence inline, and all unrelated safety and authorization constraints. Quoted examples and questions about inline code are not execution-mode instructions; neither are descriptions of software that should run quickly. Do not extend a scoped preference to unrelated tasks.
|
|
@@ -117163,10 +117129,10 @@ var DEFAULT_PROMPT_GUIDANCE = [
|
|
|
117163
117129
|
- For unfamiliar named workflows, discover with \`action: "list"\`, inspect with \`action: "get"\` or \`action: "inputs"\`, and run with \`action: "run"\`, \`workflow\`, and validated \`inputs\`; do not invent workflow names or input keys.
|
|
117164
117130
|
- Before launching a workflow, give the user an estimated wall-clock completion range without confidence labels or scores. Base it on the critical path rather than summing parallel node durations; cite available timing sources and distinguish observed check runtimes from estimated model work, queue time, repair risk, and human wait time. If history is missing, state that briefly rather than inventing metrics. An estimate is not a \`budget\` override or a promise.
|
|
117165
117131
|
- Proceed with inherited budget limits without asking the user to choose a budget before each launch; preserve existing budget limits and approval gates. Do not pass a \`budget\` unless the user asked for a limit: omitting \`budget\` inherits the workflow declaration and config. When the user does state a limit, pass only the fields they named, leave every other field inherited, and use \`0\` to disable a field they asked you to remove. Never convert an estimate into a cap.
|
|
117166
|
-
- Heartbeat cadence is 15 minutes by default. Keep that interval unless the user explicitly asks for a different cadence. A heartbeat is a periodic alignment check: re-read the objective, judge whether the run is still on goal, and continue a progressing run when no intervention is needed. Use workflow pause, resume,
|
|
117132
|
+
- Heartbeat cadence is 15 minutes by default. Keep that interval unless the user explicitly asks for a different cadence. A heartbeat is a periodic alignment check: re-read the objective, judge whether the run is still on goal, and continue a progressing run when no intervention is needed. Use workflow pause, resume, or quit when run control is useful, and ask the user when a decision is needed.
|
|
117167
117133
|
- Wrap critical parts of the \`inputs\` you pass — objective, prompt, acceptance criteria — in \`<keepContext>\` / \`</keepContext>\`. Tagged text survives compaction verbatim regardless of the compression ratio, and stages inherit it because workflows inject your inputs into their prompts. A long stage is compacted repeatedly, and compaction ranks lines individually: a verbose restated objective outlives the one line that bounds it, so a stage can end up executing a coherent but unbounded version of what you asked for. Decide this per launch rather than tagging everything — tag role constraints, prohibitions, must-hold criteria, and identifiers such as a target branch, worktree path, or issue number; leave background, quoted issue text, and reference material untagged and pass bulk through files and \`reads\`. Protected lines count against the keep target rather than raising it, so an over-tagged input makes the evidence stages need compress harder.
|
|
117168
117134
|
- Tag steering the same way. An Intercom \`send\` amendment is authoritative and stages must carry it forward, but it arrives late in an already-long session and is exactly one short message competing with the whole transcript; \`<keepContext>\` around the requirement keeps it from being compacted away before the stage acts on it.
|
|
117169
|
-
- In interactive chat, named workflow launches run in the background. Run \`/workflow connect <run>\` to see agents working and chat with and steer each stage. Inspection and control calls (\`status\`, \`stages\`, \`stage\`, \`transcript\`, \`answer\`, \`pause\`, \`resume\`, \`
|
|
117135
|
+
- In interactive chat, named workflow launches run in the background. Run \`/workflow connect <run>\` to see agents working and chat with and steer each stage. Inspection and control calls (\`status\`, \`stages\`, \`stage\`, \`transcript\`, \`answer\`, \`pause\`, \`resume\`, \`quit\`) remain available while work runs.
|
|
117170
117136
|
- At lifecycle updates, revise the estimate only when new evidence materially changes the remaining path; at completion, report actual elapsed time against the estimate and note the main bottleneck for future scheduling. Do not add confidence labels or scores to duration estimates.
|
|
117171
117137
|
- \`workflow answer\` handles a pending human-input prompt. Before steering a stage, join its invocation group. Use the Intercom \`groups\` action to discover it. Workflow invocation groups are named \`workflow:<rootRunId>\`. Send free-form updates through Intercom to \`workflow:<rootRunId>/<segment>[/<segment>...]\`; each segment may be a stage name, run id, or glob (\`*\` matches one segment and \`**\` any depth). Use \`intercom list\` inside the invocation group to see live, pending, and possible future targets. Atomic delivers immediately to live stages and queues messages for known stages that have not started, delivering them before their first model turn; name and pattern sends remain sticky for every future matching stage until the root run terminates. When shared scope or acceptance criteria change, broadcast one authoritative update to \`workflow:<rootRunId>/**\` (or a narrower path pattern) rather than enumerating stages. A valid target outside the known set queues with a \`notInKnownSet\` warning and settles undeliverable at terminal only if never delivered. Use \`ask\` once the target has a live session that can reply. Use explicit \`/workflow attach <run> <stage>\` for user-driven post-mortem chat.
|
|
117172
117138
|
- A blocked run is continuable by default unless the user requests inline/no-workflow execution. Honor that preference by safely holding/stopping the affected run and reconciling completed work and in-flight effects before continuing inline without duplication. Otherwise resume, answer pending prompts, steer, or use a follow-up workflow; minimal remaining work can be completed inline. Resolve material ambiguity from the objective and repository evidence without bypassing authorization.
|
|
@@ -117174,7 +117140,7 @@ var DEFAULT_PROMPT_GUIDANCE = [
|
|
|
117174
117140
|
- When \`ask_user_question\` or an equivalent question tool is available, all agent-authored questions to the user must use that tool instead of plain text, including clarifications, choices, confirmations, and permission to proceed. Prefer \`ask_user_question\` when available; otherwise use the equivalent tool's supported schema. In these sessions, never end a status or final message with a prose-only question. This does not replace workflow-authored \`ctx.ui\` gates or \`workflow answer\` for relaying an actual user response to a pending prompt. Intercom questions are for agents, not a substitute for user approval.
|
|
117175
117141
|
- When human input is unavailable because no usable question tool exists or the session is headless, do not stall on a question. Choose the interpretation best supported by the stated objective and repository evidence: mine git history, commits, PRs, issues, and the user's own comments to infer how they would decide, record the assumption and rationale, and continue fully autonomously on best judgment. Tool unavailability alone is not a blocker. Preserve explicit approval gates, safety, authorization, and budget limits. A cancelled or unanswered available question is not permission to use this fallback.
|
|
117176
117142
|
- Natural-language instructions to create or use a worktree do not enable runner isolation. A named workflow must declare and implement any worktree and feature-branch inputs it supports; inspect its inputs and pass a distinct path and branch for each concurrent item. Reusable \`baseBranch\` binding creates a missing target as a detached checkout from that base or reuses an existing same-repository worktree as-is; neither case checks out a separate feature-branch input.
|
|
117177
|
-
- Once you have started the selected single run or every run in the selected bounded wave, end the current turn and wait for user input or lifecycle notices. Do not use sleep/status polling loops: key start, finish, and failure events arrive automatically. Use targeted \`status\`/\`stages\`/\`stage\` checks only when the user asks or the next step needs them, and use Intercom \`send\`/\`ask\` for stage communication or \`answer\`/\`pause\`/\`resume\`/\`
|
|
117143
|
+
- Once you have started the selected single run or every run in the selected bounded wave, end the current turn and wait for user input or lifecycle notices. Do not use sleep/status polling loops: key start, finish, and failure events arrive automatically. Use targeted \`status\`/\`stages\`/\`stage\` checks only when the user asks or the next step needs them, and use Intercom \`send\`/\`ask\` for stage communication or \`answer\`/\`pause\`/\`resume\`/\`quit\` for workflow prompts and control.
|
|
117178
117144
|
- For transcripts, avoid whole-file reads. Get \`sessionFile\`/\`transcriptPath\` from \`stages\` or \`stage\`, preserve the exact path and platform separators, search with \`rg\`/\`grep\`, and read small relevant ranges; use explicit \`tail\` or \`limit\` only for a bounded preview.`,
|
|
117179
117145
|
`**Workflow authoring and handoffs**:
|
|
117180
117146
|
- When a user asks to create or edit a workflow, clarify only unresolved requirements that materially affect its purpose, inputs, stages, handoffs, validation, success criteria, or starter pattern. Read the workflow docs/examples, implement the TypeScript definition with normal coding tools, reload it, and run representative test inputs before presenting it. Use the create-spec skill when it adds value; it is not mandatory when context is already sufficient.
|
|
@@ -117243,21 +117209,20 @@ var WorkflowParametersSchema = Type24.Object({
|
|
|
117243
117209
|
Type24.Literal("transcript"),
|
|
117244
117210
|
Type24.Literal("answer"),
|
|
117245
117211
|
Type24.Literal("pause"),
|
|
117246
|
-
Type24.Literal("interrupt"),
|
|
117247
117212
|
Type24.Literal("quit"),
|
|
117248
117213
|
Type24.Literal("resume"),
|
|
117249
117214
|
Type24.Literal("reload")
|
|
117250
117215
|
], {
|
|
117251
|
-
description: "Workflow action: run/list/get/inputs/models/status, inspect stage metadata, answer pending prompts, pause/resume/
|
|
117216
|
+
description: "Workflow action: run/list/get/inputs/models/status, inspect stage metadata, answer pending prompts, pause/resume/quit runs, inspect the configured model catalog, or reload workflow resources. 'status' without runId lists every workflow run in the current session with concise per-run summaries (status, timing, active stages, awaiting-input prompts); filter the listing with statusFilter. 'status' with runId returns one run's full detail. For transcript inspection, prefer status/stages/stage first to get sessionFile/transcriptPath, quote the exact path without rewriting separators (Windows backslashes are valid), then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview."
|
|
117252
117217
|
})),
|
|
117253
117218
|
runId: Type24.Optional(Type24.String({
|
|
117254
|
-
description: "Full 36-character run UUID for status/stages/stage/transcript/answer/pause/resume/
|
|
117219
|
+
description: "Full 36-character run UUID for status/stages/stage/transcript/answer/pause/resume/quit. Prefixes are not accepted; pass the id exactly as displayed. Omit runId with action 'status' to list all session runs and their statuses. Use '--all' or all:true for supported bulk run-control actions."
|
|
117255
117220
|
})),
|
|
117256
117221
|
all: Type24.Optional(Type24.Boolean({
|
|
117257
|
-
description: "Apply supported run-control actions (pause/
|
|
117222
|
+
description: "Apply supported run-control actions (pause/quit) to all in-flight runs instead of one run; cannot be combined with stageId."
|
|
117258
117223
|
})),
|
|
117259
117224
|
stageId: Type24.Optional(Type24.String({
|
|
117260
|
-
description: "Exact stage id or exact stage name for stage-scoped inspection, transcript, answer, pause, or resume. Prefixes and partial names are not accepted. A nested stage id is the full 'runId:stageId' composite. For
|
|
117225
|
+
description: "Exact stage id or exact stage name for stage-scoped inspection, transcript, answer, pause, or resume. Prefixes and partial names are not accepted. A nested stage id is the full 'runId:stageId' composite. For pause and quit it may also name an in-flight ctx.tool node by its exact tool:<argsHash> id or tool name, which aborts that single call."
|
|
117261
117226
|
})),
|
|
117262
117227
|
message: Type24.Optional(Type24.String({
|
|
117263
117228
|
description: "Prompt answer text for answer, or optional text forwarded when resuming paused work."
|
|
@@ -117311,7 +117276,6 @@ var MUTATING_WORKFLOW_ACTIONS = new Set([
|
|
|
117311
117276
|
"answer",
|
|
117312
117277
|
"pause",
|
|
117313
117278
|
"resume",
|
|
117314
|
-
"interrupt",
|
|
117315
117279
|
"quit"
|
|
117316
117280
|
]);
|
|
117317
117281
|
function workflowToolTimeoutResult(args, timeoutMs, runId) {
|