@bastani/atomic 0.9.19-alpha.2 → 0.9.19-alpha.3
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 +14 -0
- package/dist/builtin/intercom/CHANGELOG.md +7 -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 +44 -4
- 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 +6 -0
- package/dist/builtin/subagents/README.md +2 -2
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +2 -2
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +13 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +56 -33
- package/dist/builtin/workflows/src/index.js +14 -4
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +2 -2
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +3 -0
- 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-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/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/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/settings-manager-basic-accessors.d.ts +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +2 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-types.d.ts +1 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts +9 -0
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +36 -2
- package/dist/core/tasks/agent-adapter.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.d.ts +2 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +1 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +1 -0
- 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/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/docs/background-tasks.md +7 -1
- package/docs/development.md +23 -74
- package/docs/extensions.md +4 -0
- package/docs/herdr.md +25 -78
- package/docs/intercom.md +4 -0
- package/docs/models/evals.md +2 -0
- package/docs/models/model-selection.md +10 -7
- package/docs/settings.md +4 -0
- package/docs/subagents.md +3 -1
- package/docs/tools.md +4 -0
- package/docs/workflows/api-reference.md +1 -1
- package/docs/workflows/operations.md +8 -3
- 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) {
|
|
@@ -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 };
|
|
@@ -78841,14 +78850,14 @@ function statusFg(run, theme, allRuns) {
|
|
|
78841
78850
|
return theme.dim;
|
|
78842
78851
|
}
|
|
78843
78852
|
}
|
|
78844
|
-
function modeLabel(
|
|
78845
|
-
return
|
|
78853
|
+
function modeLabel(stages) {
|
|
78854
|
+
return stages.length > 1 ? "chain" : "single";
|
|
78846
78855
|
}
|
|
78847
|
-
function progressLabel(
|
|
78848
|
-
const total =
|
|
78856
|
+
function progressLabel(stages) {
|
|
78857
|
+
const total = stages.length;
|
|
78849
78858
|
if (total === 0)
|
|
78850
78859
|
return;
|
|
78851
|
-
const done =
|
|
78860
|
+
const done = stages.filter((s) => s.status === "completed" || s.status === "failed" || s.status === "skipped").length;
|
|
78852
78861
|
return `${done}/${total}`;
|
|
78853
78862
|
}
|
|
78854
78863
|
function elapsedLabel(run, now) {
|
|
@@ -78900,7 +78909,7 @@ function pendingStageLabel(run, width = Number.POSITIVE_INFINITY, resolveBoundar
|
|
|
78900
78909
|
}
|
|
78901
78910
|
return;
|
|
78902
78911
|
}
|
|
78903
|
-
function metaLine(run, now, width = Number.POSITIVE_INFINITY, resolveBoundarySegments) {
|
|
78912
|
+
function metaLine(run, expandGraph, now, width = Number.POSITIVE_INFINITY, resolveBoundarySegments) {
|
|
78904
78913
|
if (run.endedAt !== undefined) {
|
|
78905
78914
|
return elapsedLabel(run, now);
|
|
78906
78915
|
}
|
|
@@ -78908,8 +78917,9 @@ function metaLine(run, now, width = Number.POSITIVE_INFINITY, resolveBoundarySeg
|
|
|
78908
78917
|
return run.resumable === false ? "quit · not resumable" : "quit · resumable via /workflow resume";
|
|
78909
78918
|
if (effectiveRunStatus(run) === "blocked")
|
|
78910
78919
|
return "blocked · resumable via /workflow resume";
|
|
78911
|
-
const
|
|
78912
|
-
const
|
|
78920
|
+
const { stages } = expandGraph(run.id);
|
|
78921
|
+
const prefix = [modeLabel(stages)];
|
|
78922
|
+
const prog = progressLabel(stages);
|
|
78913
78923
|
if (prog)
|
|
78914
78924
|
prefix.push(prog);
|
|
78915
78925
|
const suffix = [];
|
|
@@ -78964,9 +78974,9 @@ function runMetaWidth(run, width) {
|
|
|
78964
78974
|
const inner = Math.max(2, Math.max(32, width) - 2);
|
|
78965
78975
|
return Math.max(0, inner - visibleWidth(` ${run.name} · `));
|
|
78966
78976
|
}
|
|
78967
|
-
function themedRunLines(run, now, theme, allRuns, width) {
|
|
78977
|
+
function themedRunLines(run, now, theme, allRuns, width, expandGraph) {
|
|
78968
78978
|
const resolveBoundarySegments = (runId) => workflowBoundarySegments(allRuns, runId);
|
|
78969
|
-
const meta = metaLine(run, now, runMetaWidth(run, width), resolveBoundarySegments);
|
|
78979
|
+
const meta = metaLine(run, expandGraph, now, runMetaWidth(run, width), resolveBoundarySegments);
|
|
78970
78980
|
const metaColor = effectiveRunStatus(run) === "running" ? theme.textMuted : theme.dim;
|
|
78971
78981
|
return renderRunIdentityRows({
|
|
78972
78982
|
runId: run.id,
|
|
@@ -78978,12 +78988,12 @@ function themedRunLines(run, now, theme, allRuns, width) {
|
|
|
78978
78988
|
theme
|
|
78979
78989
|
});
|
|
78980
78990
|
}
|
|
78981
|
-
function plainRunLines(run, now, allRuns, width) {
|
|
78991
|
+
function plainRunLines(run, now, allRuns, width, expandGraph) {
|
|
78982
78992
|
const resolveBoundarySegments = (runId) => workflowBoundarySegments(allRuns, runId);
|
|
78983
78993
|
return renderRunIdentityRows({
|
|
78984
78994
|
runId: run.id,
|
|
78985
78995
|
name: run.name,
|
|
78986
|
-
meta: metaLine(run, now, runMetaWidth(run, width), resolveBoundarySegments),
|
|
78996
|
+
meta: metaLine(run, expandGraph, now, runMetaWidth(run, width), resolveBoundarySegments),
|
|
78987
78997
|
glyph: statusGlyph2(run, allRuns)
|
|
78988
78998
|
});
|
|
78989
78999
|
}
|
|
@@ -79036,9 +79046,10 @@ function buildThemedWidgetLines(snap, piTheme, width = 120, now = Date.now()) {
|
|
|
79036
79046
|
const badges = formatTitleBadges(badgeList, graphTheme, themed);
|
|
79037
79047
|
const title = `BACKGROUND ${subtitle}${badges ? ` ${badges}` : ""}`;
|
|
79038
79048
|
const body = [];
|
|
79049
|
+
const expandGraph = createWorkflowGraphExpander(snap);
|
|
79039
79050
|
for (let i = 0;i < display.length; i++) {
|
|
79040
79051
|
const run = display[i];
|
|
79041
|
-
const runLines = themed ? themedRunLines(run, now, graphTheme, snap.runs, width) : plainRunLines(run, now, snap.runs, width);
|
|
79052
|
+
const runLines = themed ? themedRunLines(run, now, graphTheme, snap.runs, width, expandGraph) : plainRunLines(run, now, snap.runs, width, expandGraph);
|
|
79042
79053
|
body.push(...runLines);
|
|
79043
79054
|
if (i < display.length - 1)
|
|
79044
79055
|
body.push("");
|
|
@@ -89951,7 +89962,7 @@ function mergeConfigs(base, override) {
|
|
|
89951
89962
|
}
|
|
89952
89963
|
var WORKFLOW_CONFIG_DEFAULTS = {
|
|
89953
89964
|
maxDepth: 4,
|
|
89954
|
-
defaultConcurrency:
|
|
89965
|
+
defaultConcurrency: 3,
|
|
89955
89966
|
persistRuns: true,
|
|
89956
89967
|
statusFile: false,
|
|
89957
89968
|
resumeInFlight: "ask",
|
|
@@ -101041,7 +101052,7 @@ class ConcurrencyLimiter {
|
|
|
101041
101052
|
}
|
|
101042
101053
|
}
|
|
101043
101054
|
function createRunLimiter(defaultConcurrency) {
|
|
101044
|
-
return new ConcurrencyLimiter(defaultConcurrency ??
|
|
101055
|
+
return new ConcurrencyLimiter(defaultConcurrency ?? 3);
|
|
101045
101056
|
}
|
|
101046
101057
|
|
|
101047
101058
|
// dist/builtin/workflows/src/shared/abort.ts
|
|
@@ -106101,7 +106112,8 @@ class StageSessionPause {
|
|
|
106101
106112
|
abortBoundary: Promise.withResolvers(),
|
|
106102
106113
|
runnerOwnedDeliveries: new Set,
|
|
106103
106114
|
confirmed: false,
|
|
106104
|
-
...nativeQueuePause === undefined ? {} : { nativeQueuePause }
|
|
106115
|
+
...nativeQueuePause === undefined ? {} : { nativeQueuePause },
|
|
106116
|
+
...session?.pauseTasks && session.resumeTasks ? { taskControl: session } : {}
|
|
106105
106117
|
};
|
|
106106
106118
|
request.deferred.promise.catch(() => {});
|
|
106107
106119
|
request.abortBoundary.promise.catch(() => {});
|
|
@@ -106109,7 +106121,11 @@ class StageSessionPause {
|
|
|
106109
106121
|
let failed = false;
|
|
106110
106122
|
try {
|
|
106111
106123
|
request.nativeQueuePause?.pauseQueuedMessages();
|
|
106112
|
-
|
|
106124
|
+
const tasks = request.taskControl?.pauseTasks?.();
|
|
106125
|
+
const settled = await Promise.allSettled([tasks, (async () => session?.abort())()]);
|
|
106126
|
+
for (const result of settled)
|
|
106127
|
+
if (result.status === "rejected")
|
|
106128
|
+
throw result.reason;
|
|
106113
106129
|
request.abortBoundary.resolve();
|
|
106114
106130
|
await request.abortBoundary.promise;
|
|
106115
106131
|
request.confirmed = true;
|
|
@@ -106117,6 +106133,7 @@ class StageSessionPause {
|
|
|
106117
106133
|
failed = true;
|
|
106118
106134
|
request.abortBoundary.reject(error);
|
|
106119
106135
|
request.deferred.reject(error);
|
|
106136
|
+
request.taskControl?.resumeTasks?.();
|
|
106120
106137
|
await this.rollbackNativePause(request.nativeQueuePause);
|
|
106121
106138
|
throw error;
|
|
106122
106139
|
} finally {
|
|
@@ -106184,6 +106201,7 @@ class StageSessionPause {
|
|
|
106184
106201
|
if (releaseAdmitted)
|
|
106185
106202
|
return;
|
|
106186
106203
|
beforeRelease?.();
|
|
106204
|
+
request.taskControl?.resumeTasks?.();
|
|
106187
106205
|
releaseAdmitted = true;
|
|
106188
106206
|
};
|
|
106189
106207
|
let releasedQueuedMessages;
|
|
@@ -106280,6 +106298,9 @@ async function rejectDisposedCreatedSession(result, stageName) {
|
|
|
106280
106298
|
class StageSessionReplacement {
|
|
106281
106299
|
previous;
|
|
106282
106300
|
cleanups = new Set;
|
|
106301
|
+
get retiringSession() {
|
|
106302
|
+
return this.previous;
|
|
106303
|
+
}
|
|
106283
106304
|
retire(session) {
|
|
106284
106305
|
this.previous = session;
|
|
106285
106306
|
}
|
|
@@ -106664,7 +106685,7 @@ class StageSessionController {
|
|
|
106664
106685
|
pendingThinkingLevel;
|
|
106665
106686
|
pendingListeners = new Set;
|
|
106666
106687
|
listenerUnsubscribes = new Map;
|
|
106667
|
-
pauseControl = new StageSessionPause(() => this.session);
|
|
106688
|
+
pauseControl = new StageSessionPause(() => this.session ?? this.replacement.retiringSession);
|
|
106668
106689
|
hasExplicitModelFallbackConfig;
|
|
106669
106690
|
candidatesPromise;
|
|
106670
106691
|
activeCandidateIndex;
|
|
@@ -113271,11 +113292,13 @@ function makeWorkflowStageOrchestrationContext(meta, pi) {
|
|
|
113271
113292
|
function withWorkflowStageSessionOptions(options, meta, pi) {
|
|
113272
113293
|
const policyExcludedTools = meta?.executionMode === "non_interactive" ? ["workflow", "ask_user_question"] : ["workflow"];
|
|
113273
113294
|
const excludedTools = Array.from(new Set([...options.excludedTools ?? [], ...policyExcludedTools]));
|
|
113295
|
+
const existingContext = meta?.orchestrationContext ?? options.orchestrationContext;
|
|
113296
|
+
const defaultContext = meta && existingContext?.lateMessageRouter === undefined ? makeWorkflowStageOrchestrationContext(meta, pi) : undefined;
|
|
113274
113297
|
return {
|
|
113275
113298
|
...options,
|
|
113276
113299
|
excludedTools,
|
|
113277
113300
|
...meta ? {
|
|
113278
|
-
orchestrationContext:
|
|
113301
|
+
orchestrationContext: defaultContext === undefined ? existingContext : { ...defaultContext, ...existingContext, lateMessageRouter: defaultContext.lateMessageRouter }
|
|
113279
113302
|
} : {}
|
|
113280
113303
|
};
|
|
113281
113304
|
}
|
|
@@ -116586,7 +116609,7 @@ function workflowStagesResult(args, source) {
|
|
|
116586
116609
|
error: target.message
|
|
116587
116610
|
};
|
|
116588
116611
|
}
|
|
116589
|
-
const stageSnapshots =
|
|
116612
|
+
const stageSnapshots = expandWorkflowGraph(readGraphStoreSnapshot(activeStore), target.runId).stages;
|
|
116590
116613
|
const stages = stageSnapshots.filter((stage) => filter === "all" || stage.status === filter).map(summarizeStage);
|
|
116591
116614
|
return { action: "stages", runId: target.runId, filter, stages };
|
|
116592
116615
|
}
|
|
@@ -10462,7 +10462,7 @@ class ConcurrencyLimiter {
|
|
|
10462
10462
|
}
|
|
10463
10463
|
}
|
|
10464
10464
|
function createRunLimiter(defaultConcurrency) {
|
|
10465
|
-
return new ConcurrencyLimiter(defaultConcurrency ??
|
|
10465
|
+
return new ConcurrencyLimiter(defaultConcurrency ?? 3);
|
|
10466
10466
|
}
|
|
10467
10467
|
|
|
10468
10468
|
// dist/builtin/workflows/src/shared/abort.ts
|
|
@@ -15448,7 +15448,8 @@ class StageSessionPause {
|
|
|
15448
15448
|
abortBoundary: Promise.withResolvers(),
|
|
15449
15449
|
runnerOwnedDeliveries: new Set,
|
|
15450
15450
|
confirmed: false,
|
|
15451
|
-
...nativeQueuePause === undefined ? {} : { nativeQueuePause }
|
|
15451
|
+
...nativeQueuePause === undefined ? {} : { nativeQueuePause },
|
|
15452
|
+
...session?.pauseTasks && session.resumeTasks ? { taskControl: session } : {}
|
|
15452
15453
|
};
|
|
15453
15454
|
request.deferred.promise.catch(() => {});
|
|
15454
15455
|
request.abortBoundary.promise.catch(() => {});
|
|
@@ -15456,7 +15457,11 @@ class StageSessionPause {
|
|
|
15456
15457
|
let failed = false;
|
|
15457
15458
|
try {
|
|
15458
15459
|
request.nativeQueuePause?.pauseQueuedMessages();
|
|
15459
|
-
|
|
15460
|
+
const tasks = request.taskControl?.pauseTasks?.();
|
|
15461
|
+
const settled = await Promise.allSettled([tasks, (async () => session?.abort())()]);
|
|
15462
|
+
for (const result of settled)
|
|
15463
|
+
if (result.status === "rejected")
|
|
15464
|
+
throw result.reason;
|
|
15460
15465
|
request.abortBoundary.resolve();
|
|
15461
15466
|
await request.abortBoundary.promise;
|
|
15462
15467
|
request.confirmed = true;
|
|
@@ -15464,6 +15469,7 @@ class StageSessionPause {
|
|
|
15464
15469
|
failed = true;
|
|
15465
15470
|
request.abortBoundary.reject(error);
|
|
15466
15471
|
request.deferred.reject(error);
|
|
15472
|
+
request.taskControl?.resumeTasks?.();
|
|
15467
15473
|
await this.rollbackNativePause(request.nativeQueuePause);
|
|
15468
15474
|
throw error;
|
|
15469
15475
|
} finally {
|
|
@@ -15531,6 +15537,7 @@ class StageSessionPause {
|
|
|
15531
15537
|
if (releaseAdmitted)
|
|
15532
15538
|
return;
|
|
15533
15539
|
beforeRelease?.();
|
|
15540
|
+
request.taskControl?.resumeTasks?.();
|
|
15534
15541
|
releaseAdmitted = true;
|
|
15535
15542
|
};
|
|
15536
15543
|
let releasedQueuedMessages;
|
|
@@ -15627,6 +15634,9 @@ async function rejectDisposedCreatedSession(result, stageName) {
|
|
|
15627
15634
|
class StageSessionReplacement {
|
|
15628
15635
|
previous;
|
|
15629
15636
|
cleanups = new Set;
|
|
15637
|
+
get retiringSession() {
|
|
15638
|
+
return this.previous;
|
|
15639
|
+
}
|
|
15630
15640
|
retire(session) {
|
|
15631
15641
|
this.previous = session;
|
|
15632
15642
|
}
|
|
@@ -16011,7 +16021,7 @@ class StageSessionController {
|
|
|
16011
16021
|
pendingThinkingLevel;
|
|
16012
16022
|
pendingListeners = new Set;
|
|
16013
16023
|
listenerUnsubscribes = new Map;
|
|
16014
|
-
pauseControl = new StageSessionPause(() => this.session);
|
|
16024
|
+
pauseControl = new StageSessionPause(() => this.session ?? this.replacement.retiringSession);
|
|
16015
16025
|
hasExplicitModelFallbackConfig;
|
|
16016
16026
|
candidatesPromise;
|
|
16017
16027
|
activeCandidateIndex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session-message-queue.d.ts","sourceRoot":"","sources":["../../src/core/agent-session-message-queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAA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EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAmBlH;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,YAAY,GAAG,kBAAkB,CAShF;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAOhG;AACD;;GAEG;AACH,wBAAgB,UAAU,CACzB,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,iBAAiB,GACzB;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA+C5C;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,MAAM,EAAE,CAEzE;AAED,iDAAiD;AACjD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,MAAM,EAAE,CAEzE;AAMD,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,GAAG,eAAe,GAAG,IAAI,CAGvF;AAED;;;GAGG;AAEH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,GAAG,eAAe,GAAG,IAAI,CAGvF;AAKD,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3C,CAAC"}
|
|
@@ -267,14 +267,14 @@ export function _queueAgentMessage(message, delivery) {
|
|
|
267
267
|
else {
|
|
268
268
|
hold.steering.push(message);
|
|
269
269
|
}
|
|
270
|
-
return;
|
|
271
270
|
}
|
|
272
|
-
if (delivery === "followUp") {
|
|
271
|
+
else if (delivery === "followUp") {
|
|
273
272
|
this.agent.followUp(message);
|
|
274
273
|
}
|
|
275
274
|
else {
|
|
276
275
|
this.agent.steer(message);
|
|
277
276
|
}
|
|
277
|
+
this._agentTaskHost?.yieldTaskWaits(message.role === "user" ? "input-needed" : "intercom-coordination");
|
|
278
278
|
}
|
|
279
279
|
export function _drainQueuedAgentMessages() {
|
|
280
280
|
// pi-agent-core exposes public clear methods but no public drain/restore pair.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session-message-queue.js","sourceRoot":"","sources":["../../src/core/agent-session-message-queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACrH,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAAC;AAErH,OAAO,EACN,iCAAiC,EACjC,uCAAuC,GACvC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAGN,4BAA4B,EAE5B,sBAAsB,EAEtB,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,iCAAiC,EAAE,CAAC;AAE7C,MAAM,uBAAuB,GAAG,IAAI,OAAO,EAA+B,CAAC;AAE3E,SAAS,0BAA0B,CAAC,KAAmB,EAAE,SAA8B;IACtF,MAAM,QAAQ,GAAG,uBAAuB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IACzE,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,uBAAuB,CAAC,GAAG,CAC1B,KAAK,EACL,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAC/B,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAqB,IAAY,EAAE,MAAuB;IAC1F,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,CAAC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,mBAAmB;AACnB,4EAA4E;AAE5E,MAAM,UAAU,eAAe,CAAqB,IAA6B;IAChF,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;;GAGG;AAEH,MAAM,UAAU,eAAe,CAAqB,IAA6B;IAChF,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,4EAA4E;AAC5E,8BAA8B;AAC9B,4EAA4E;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC9C,WAAW;IACX,cAAc;IACd,wBAAwB;IACxB,iCAAiC;IACjC,2BAA2B;IAC3B,iBAAiB;IACjB,kBAAkB;IAClB,4BAA4B;IAC5B,oBAAoB;IACpB,2BAA2B;IAC3B,8BAA8B;IAC9B,8BAA8B;IAC9B,+BAA+B;IAC/B,wCAAwC;IACxC,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,yBAAyB;IACzB,2BAA2B;IAC3B,UAAU;IACV,mBAAmB;IACnB,mBAAmB;IACnB,KAAK;IACL,eAAe;IACf,eAAe;CACf,CAAC","sourcesContent":["import type { ImageContent, TextContent } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport { commitAdmittedCustomMessage, commitAdmittedCustomMessages } from \"./agent-session-custom-message-commit.ts\";\nimport { forwardedMessageOptions, resolveWorkflowStageDeliveryTarget } from \"./agent-session-delivery-forwarding.ts\";\nimport type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\nimport {\n\tisProtectedStreamingCustomMessage,\n\trestoreProtectedStreamingCustomMessages,\n} from \"./agent-session-persistent-custom-messages.ts\";\nimport { abort, pauseQueuedMessages, resumeQueuedMessages } from \"./agent-session-queue-pause.ts\";\nimport { transferWorkflowStageDeliveriesTo } from \"./agent-session-transfer.ts\";\nimport {\n\ttype AgentQueueAccess,\n\ttype ClearQueueOptions,\n\tcustomMessageExcludesContext,\n\ttype DrainedAgentQueues,\n\tdrainAgentMessageQueue,\n\ttype InterruptQueueHold,\n\tnormalizeInterruptAbortMessage,\n} from \"./agent-session-types.ts\";\nimport type { SendMessageOptions, SendMessagesOptions } from \"./extensions/index.js\";\nimport type { CustomMessage, StageAdmittedCustomMessage } from \"./messages.ts\";\n\nexport { transferWorkflowStageDeliveriesTo };\n\nconst interruptMutationQueues = new WeakMap<AgentSession, Promise<void>>();\n\nfunction serializeInterruptMutation(owner: AgentSession, operation: () => Promise<void>): Promise<void> {\n\tconst previous = interruptMutationQueues.get(owner) ?? Promise.resolve();\n\tconst delivery = previous.then(operation);\n\tinterruptMutationQueues.set(\n\t\towner,\n\t\tdelivery.catch(() => undefined),\n\t);\n\treturn delivery;\n}\n\nexport async function _queueSteer(this: AgentSession, text: string, images?: ImageContent[]): Promise<void> {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._queueSteer(text, images);\n\tthis._steeringMessages.push(text);\n\tthis._emitQueueUpdate();\n\tconst content: (TextContent | ImageContent)[] = [{ type: \"text\", text }];\n\tif (images) {\n\t\tcontent.push(...images);\n\t}\n\tthis._queueAgentMessage(\n\t\t{\n\t\t\trole: \"user\",\n\t\t\tcontent,\n\t\t\ttimestamp: Date.now(),\n\t\t},\n\t\t\"steer\",\n\t);\n}\n\n/**\n * Internal: Queue a follow-up message (already expanded, no extension command check).\n */\n\nexport async function _queueFollowUp(this: AgentSession, text: string, images?: ImageContent[]): Promise<void> {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._queueFollowUp(text, images);\n\tthis._followUpMessages.push(text);\n\tthis._emitQueueUpdate();\n\tconst content: (TextContent | ImageContent)[] = [{ type: \"text\", text }];\n\tif (images) {\n\t\tcontent.push(...images);\n\t}\n\tthis._queueAgentMessage(\n\t\t{\n\t\t\trole: \"user\",\n\t\t\tcontent,\n\t\t\ttimestamp: Date.now(),\n\t\t},\n\t\t\"followUp\",\n\t);\n}\n\n/**\n * Throw an error if the text is an extension command.\n */\n\nexport function _throwIfExtensionCommand(this: AgentSession, text: string): void {\n\tconst spaceIndex = text.indexOf(\" \");\n\tconst commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);\n\tconst command = this._extensionRunner.getCommand(commandName);\n\n\tif (command) {\n\t\tthrow new Error(\n\t\t\t`Extension command \"/${commandName}\" cannot be queued. Use prompt() or execute the command when not streaming.`,\n\t\t);\n\t}\n}\n\n/**\n * Send a custom message to the session. Creates a CustomMessageEntry.\n *\n * Handles five cases:\n * - Streaming + interrupt trigger: aborts the active run and starts an immediate custom-message turn\n * - Streaming + explicit display-only context exclusion: appends to state/session, no turn and no queue\n * - Streaming otherwise: queues message, processed when loop pulls from queue\n * - Not streaming + triggerTurn: appends to state/session, starts new turn\n * - Not streaming + no trigger: appends to state/session, no turn\n *\n * @param message Custom message with customType, content, display, details\n * @param options.triggerTurn If true and not streaming, triggers a new LLM turn\n * @param options.deliverAs Delivery mode: \"steer\", \"followUp\", \"nextTurn\", or \"interrupt\"\n */\n\nexport async function sendCustomMessage<T = unknown>(\n\tthis: AgentSession,\n\tmessage: Pick<CustomMessage<T>, \"customType\" | \"content\" | \"display\" | \"details\">,\n\toptions?: SendMessageOptions,\n): Promise<void> {\n\tconst currentOwner = resolveWorkflowStageDeliveryTarget(this);\n\tif (currentOwner !== this) return currentOwner.sendCustomMessage(message, options);\n\tconst appMessage = {\n\t\trole: \"custom\" as const,\n\t\tcustomType: message.customType,\n\t\tcontent: message.content ?? [],\n\t\tdisplay: message.display,\n\t\tdetails: message.details,\n\t\ttimestamp: Date.now(),\n\t\t...(options?.excludeFromContext === true ? { excludeFromContext: true } : {}),\n\t\t...(options?.stageAdmissionKey === undefined ? {} : { stageAdmissionKey: options.stageAdmissionKey }),\n\t} satisfies CustomMessage<T> & { stageAdmissionKey?: string };\n\tconst boundary = this._workflowStageAdmission;\n\tconst deliver = async (): Promise<void> => {\n\t\tif (boundary && options?.stageAdmissionBarrier) await options.stageAdmissionBarrier();\n\t\tawait commitAdmittedCustomMessage(this, appMessage, options);\n\t};\n\tif (boundary === undefined) return deliver();\n\tawait boundary.admit(options?.stageAdmissionKey, deliver, () => {\n\t\tconst router = this._orchestrationContext?.lateMessageRouter;\n\t\tif (router === undefined) throw new Error(\"Workflow stage closed without a late-message router\");\n\t\treturn router.routeMessage(message, options);\n\t}).completion;\n}\n\n/** Atomically admits a custom-message batch in array order. */\nexport async function sendCustomMessages<T = unknown>(\n\tthis: AgentSession,\n\tmessages: Array<Pick<CustomMessage<T>, \"customType\" | \"content\" | \"display\" | \"details\">>,\n\toptions?: SendMessagesOptions,\n): Promise<void> {\n\tconst currentOwner = resolveWorkflowStageDeliveryTarget(this);\n\tif (currentOwner !== this) return currentOwner.sendCustomMessages(messages, options);\n\tconst timestamp = Date.now();\n\tconst appMessages = messages.map(\n\t\t(message) =>\n\t\t\t({\n\t\t\t\trole: \"custom\" as const,\n\t\t\t\tcustomType: message.customType,\n\t\t\t\tcontent: message.content ?? [],\n\t\t\t\tdisplay: message.display,\n\t\t\t\tdetails: message.details,\n\t\t\t\ttimestamp,\n\t\t\t\t...(options?.excludeFromContext === true ? { excludeFromContext: true } : {}),\n\t\t\t\t...(options?.stageAdmissionKey === undefined ? {} : { stageAdmissionKey: options.stageAdmissionKey }),\n\t\t\t}) satisfies CustomMessage<T> & { stageAdmissionKey?: string },\n\t);\n\tif (appMessages.length === 0) return;\n\tconst boundary = this._workflowStageAdmission;\n\tconst deliver = async (): Promise<void> => {\n\t\tif (boundary && options?.stageAdmissionBarrier) await options.stageAdmissionBarrier();\n\t\tawait commitAdmittedCustomMessages(this, appMessages, options);\n\t};\n\tif (boundary === undefined) return deliver();\n\tawait boundary.admit(options?.stageAdmissionKey, deliver, () => {\n\t\tconst router = this._orchestrationContext?.lateMessageRouter;\n\t\tif (router === undefined) throw new Error(\"Workflow stage closed without a late-message router\");\n\t\treturn router.routeMessages(messages, options);\n\t}).completion;\n}\n\nexport function sealWorkflowStageGeneration(this: AgentSession): void {\n\tthis._workflowStageAdmission?.seal();\n}\n\nexport async function closeWorkflowStageGeneration(this: AgentSession): Promise<void> {\n\tawait this._workflowStageAdmission?.close();\n\tawait this.agent?.waitForIdle?.();\n\tawait this._agentEventQueue;\n}\n\nexport function _appendCustomMessage<T>(this: AgentSession, message: CustomMessage<T>): void {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) {\n\t\towner._appendCustomMessage(message);\n\t\treturn;\n\t}\n\tconst stageAdmissionMessage = message as StageAdmittedCustomMessage;\n\tthis.agent.state.messages.push(message);\n\tthis.sessionManager.appendCustomMessageEntry(\n\t\tmessage.customType,\n\t\tmessage.content,\n\t\tmessage.display,\n\t\tmessage.details,\n\t\tcustomMessageExcludesContext(message),\n\t\tundefined,\n\t\tstageAdmissionMessage.stageAdmissionKey,\n\t);\n\tthis._emit({ type: \"message_start\", message });\n\tthis._emit({ type: \"message_end\", message });\n}\n\n/** Append context-only custom messages once the current turn's tool results are in history. */\nexport function _flushPendingCustomMessages(this: AgentSession): void {\n\tif (this._pendingCustomMessages.length === 0) return;\n\tconst pending = this._pendingCustomMessages;\n\tthis._pendingCustomMessages = [];\n\tfor (const message of pending) this._appendCustomMessage(message);\n}\nexport function _enqueueInterruptCustomMessage<T>(\n\tthis: AgentSession,\n\tmessage: CustomMessage<T>,\n\toptions?: SendMessageOptions,\n): Promise<void> {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._enqueueInterruptCustomMessage(message, forwardedMessageOptions(options));\n\tthis._pendingInterruptDeliveries += 1;\n\t// Establish the hold synchronously when the interrupt is enqueued, not when\n\t// the serialized delivery callback later starts. Callers commonly fire and\n\t// forget sendCustomMessage(), then queue additional steer/follow-up messages\n\t// before the promise chain gets a microtask; those messages must be captured\n\t// in the active interrupt hold instead of pi-agent-core's live queues.\n\tthis._ensureActiveInterruptQueueHold();\n\tconst delivery = this._interruptDeliveryQueue.then(async () => {\n\t\ttry {\n\t\t\tawait this._sendInterruptCustomMessageNow(message, options);\n\t\t} finally {\n\t\t\t// Retirement moves the pending count and hold synchronously. Settle the\n\t\t\t// same live owner so its queue cannot remain stranded on the replacement.\n\t\t\tconst liveOwner = resolveWorkflowStageDeliveryTarget(this);\n\t\t\tliveOwner._pendingInterruptDeliveries -= 1;\n\t\t\tif (liveOwner._pendingInterruptDeliveries === 0) {\n\t\t\t\tliveOwner._restoreAndClearActiveInterruptQueueHold();\n\t\t\t}\n\t\t}\n\t});\n\tthis._interruptDeliveryQueue = delivery.catch(() => undefined);\n\treturn delivery;\n}\n\nasync function sendInterruptCustomMessageUnlocked<T>(\n\tsession: AgentSession,\n\tmessage: CustomMessage<T>,\n\toptions?: SendMessageOptions,\n): Promise<void> {\n\tsession.abortRetry();\n\tsession._ensureActiveInterruptQueueHold();\n\tif (session.isStreaming) {\n\t\tconst previousAbortMessage = session._activeInterruptAbortMessage;\n\t\tsession._activeInterruptAbortMessage = normalizeInterruptAbortMessage(options?.interruptAbortMessage);\n\t\ttry {\n\t\t\tsession.agent.abort();\n\t\t\tawait session.agent.waitForIdle();\n\t\t\tawait session._agentEventQueue;\n\t\t} finally {\n\t\t\tsession._activeInterruptAbortMessage = previousAbortMessage;\n\t\t}\n\t}\n\tconst owner = resolveWorkflowStageDeliveryTarget(session);\n\tif (owner !== session) return owner._sendInterruptCustomMessageNow(message, forwardedMessageOptions(options));\n\tif (session._queuedMessagesPaused) {\n\t\tsession._queueAgentMessage(message, \"steer\");\n\t\treturn;\n\t}\n\tawait session.agent.prompt(message);\n}\n\nexport function _sendInterruptCustomMessageNow<T>(\n\tthis: AgentSession,\n\tmessage: CustomMessage<T>,\n\toptions?: SendMessageOptions,\n): Promise<void> {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._sendInterruptCustomMessageNow(message, forwardedMessageOptions(options));\n\treturn serializeInterruptMutation(this, () => sendInterruptCustomMessageUnlocked(this, message, options));\n}\n\nexport function _ensureActiveInterruptQueueHold(this: AgentSession): InterruptQueueHold {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._ensureActiveInterruptQueueHold();\n\tif (this._activeInterruptQueueHold !== undefined) {\n\t\treturn this._activeInterruptQueueHold;\n\t}\n\tconst drained = this._drainQueuedAgentMessages();\n\tthis._activeInterruptQueueHold = {\n\t\tsteering: [...drained.steering],\n\t\tfollowUp: [...drained.followUp],\n\t};\n\treturn this._activeInterruptQueueHold;\n}\n\nexport function _restoreAndClearActiveInterruptQueueHold(this: AgentSession): void {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) {\n\t\towner._restoreAndClearActiveInterruptQueueHold();\n\t\treturn;\n\t}\n\tif (this._queuedMessagesPaused) return;\n\tconst hold = this._activeInterruptQueueHold;\n\tif (hold === undefined) return;\n\tconst currentCoreQueues = this._drainQueuedAgentMessages();\n\tthis._restoreQueuedAgentMessages({\n\t\tsteering: [...hold.steering, ...currentCoreQueues.steering],\n\t\tfollowUp: [...hold.followUp, ...currentCoreQueues.followUp],\n\t});\n\tthis._activeInterruptQueueHold = undefined;\n}\n\nexport function _queueAgentMessage(this: AgentSession, message: AgentMessage, delivery: \"steer\" | \"followUp\"): void {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) {\n\t\towner._queueAgentMessage(message, delivery);\n\t\treturn;\n\t}\n\tconst hold = this._activeInterruptQueueHold;\n\tif (hold !== undefined) {\n\t\tif (delivery === \"followUp\") {\n\t\t\thold.followUp.push(message);\n\t\t} else {\n\t\t\thold.steering.push(message);\n\t\t}\n\t\treturn;\n\t}\n\tif (delivery === \"followUp\") {\n\t\tthis.agent.followUp(message);\n\t} else {\n\t\tthis.agent.steer(message);\n\t}\n}\n\nexport function _drainQueuedAgentMessages(this: AgentSession): DrainedAgentQueues {\n\t// pi-agent-core exposes public clear methods but no public drain/restore pair.\n\t// Interrupt and pause holds prevent an aborting run from consuming queued raw\n\t// messages while preserving every entry for the existing resume boundary.\n\tconst agentWithQueues = this.agent as unknown as AgentQueueAccess;\n\treturn {\n\t\tsteering: drainAgentMessageQueue(agentWithQueues.steeringQueue),\n\t\tfollowUp: drainAgentMessageQueue(agentWithQueues.followUpQueue),\n\t};\n}\n\nexport function _restoreQueuedAgentMessages(this: AgentSession, queues: DrainedAgentQueues): void {\n\tfor (const message of queues.steering) {\n\t\tthis.agent.steer(message);\n\t}\n\tfor (const message of queues.followUp) {\n\t\tthis.agent.followUp(message);\n\t}\n}\n/**\n * Clear queued text for editor restoration while retaining optional raw custom entries.\n */\nexport function clearQueue(\n\tthis: AgentSession,\n\toptions?: ClearQueueOptions,\n): { steering: string[]; followUp: string[] } {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner.clearQueue(options);\n\tconst steering = [...this._steeringMessages];\n\tconst followUp = [...this._followUpMessages];\n\tthis._steeringMessages = [];\n\tthis._followUpMessages = [];\n\tconst removed = this._drainQueuedAgentMessages();\n\tconst hold = this._activeInterruptQueueHold;\n\tif (hold !== undefined) {\n\t\tremoved.steering.push(...hold.steering.splice(0));\n\t\tremoved.followUp.push(...hold.followUp.splice(0));\n\t}\n\trestoreProtectedStreamingCustomMessages(this, removed);\n\tif (options?.preserveUnprotectedCustomMessages && hold !== undefined) {\n\t\tconst restoreUnprotectedCustomMessages = (\n\t\t\tremovedMessages: AgentMessage[],\n\t\t\theldMessages: AgentMessage[],\n\t\t): void => {\n\t\t\tconst currentlyHeld = [...heldMessages];\n\t\t\tconst preserved = removedMessages.filter(\n\t\t\t\t(message): message is Extract<AgentMessage, { role: \"custom\" }> =>\n\t\t\t\t\tmessage.role === \"custom\" && !isProtectedStreamingCustomMessage(this, message),\n\t\t\t);\n\t\t\tif (preserved.length === 0) return;\n\t\t\tconst preservedReferences = new Set<AgentMessage>(preserved);\n\t\t\tconst restoredProtected = new Set(currentlyHeld);\n\t\t\tconst ordered = removedMessages.filter(\n\t\t\t\t(message) => preservedReferences.has(message) || restoredProtected.has(message),\n\t\t\t);\n\t\t\tconst unmatched = currentlyHeld.filter((message) => !ordered.includes(message));\n\t\t\theldMessages.splice(0, heldMessages.length, ...ordered, ...unmatched);\n\t\t};\n\t\trestoreUnprotectedCustomMessages(removed.steering, hold.steering);\n\t\trestoreUnprotectedCustomMessages(removed.followUp, hold.followUp);\n\t}\n\tif (\n\t\t!this._queuedMessagesPaused &&\n\t\tthis._pendingInterruptDeliveries === 0 &&\n\t\thold !== undefined &&\n\t\thold.steering.length === 0 &&\n\t\thold.followUp.length === 0\n\t) {\n\t\tthis._activeInterruptQueueHold = undefined;\n\t}\n\tthis._emitQueueUpdate();\n\treturn { steering, followUp };\n}\n\n/** Number of pending messages (includes both steering and follow-up) */\nexport function getSteeringMessages(this: AgentSession): readonly string[] {\n\treturn this._steeringMessages;\n}\n\n/** Get pending follow-up messages (read-only) */\nexport function getFollowUpMessages(this: AgentSession): readonly string[] {\n\treturn this._followUpMessages;\n}\n\n// =========================================================================\n// Model Management\n// =========================================================================\n\nexport function setSteeringMode(this: AgentSession, mode: \"all\" | \"one-at-a-time\"): void {\n\tthis.agent.steeringMode = mode;\n\tthis.settingsManager.setSteeringMode(mode);\n}\n\n/**\n * Set follow-up message mode.\n * Saves to settings.\n */\n\nexport function setFollowUpMode(this: AgentSession, mode: \"all\" | \"one-at-a-time\"): void {\n\tthis.agent.followUpMode = mode;\n\tthis.settingsManager.setFollowUpMode(mode);\n}\n\n// =========================================================================\n// Queue and delivery settings\n// =========================================================================\nexport const agentSessionMessageQueueMethods = {\n\t_queueSteer,\n\t_queueFollowUp,\n\t_throwIfExtensionCommand,\n\ttransferWorkflowStageDeliveriesTo,\n\tsealWorkflowStageGeneration,\n\tsendCustomMessage,\n\tsendCustomMessages,\n\tcloseWorkflowStageGeneration,\n\t_appendCustomMessage,\n\t_flushPendingCustomMessages,\n\t_enqueueInterruptCustomMessage,\n\t_sendInterruptCustomMessageNow,\n\t_ensureActiveInterruptQueueHold,\n\t_restoreAndClearActiveInterruptQueueHold,\n\tpauseQueuedMessages,\n\tresumeQueuedMessages,\n\t_queueAgentMessage,\n\t_drainQueuedAgentMessages,\n\t_restoreQueuedAgentMessages,\n\tclearQueue,\n\tgetSteeringMessages,\n\tgetFollowUpMessages,\n\tabort,\n\tsetSteeringMode,\n\tsetFollowUpMode,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"agent-session-message-queue.js","sourceRoot":"","sources":["../../src/core/agent-session-message-queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACrH,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAAC;AAErH,OAAO,EACN,iCAAiC,EACjC,uCAAuC,GACvC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAGN,4BAA4B,EAE5B,sBAAsB,EAEtB,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,iCAAiC,EAAE,CAAC;AAE7C,MAAM,uBAAuB,GAAG,IAAI,OAAO,EAA+B,CAAC;AAE3E,SAAS,0BAA0B,CAAC,KAAmB,EAAE,SAA8B;IACtF,MAAM,QAAQ,GAAG,uBAAuB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IACzE,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,uBAAuB,CAAC,GAAG,CAC1B,KAAK,EACL,QAAQ,CAAC,KAA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,SAAS,CAAC;IAC5C,CAAC;IACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACxB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAC/B,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,mBAAmB;IAClC,OAAO,IAAI,CAAC,iBAAiB,CAAC;AAC/B,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,mBAAmB;IAClC,OAAO,IAAI,CAAC,iBAAiB,CAAC;AAC/B,CAAC;AAED,4EAA4E;AAC5E,mBAAmB;AACnB,4EAA4E;AAE5E,MAAM,UAAU,eAAe,CAAqB,IAA6B;IAChF,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;;GAGG;AAEH,MAAM,UAAU,eAAe,CAAqB,IAA6B;IAChF,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,4EAA4E;AAC5E,8BAA8B;AAC9B,4EAA4E;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC9C,WAAW;IACX,cAAc;IACd,wBAAwB;IACxB,iCAAiC;IACjC,2BAA2B;IAC3B,iBAAiB;IACjB,kBAAkB;IAClB,4BAA4B;IAC5B,oBAAoB;IACpB,2BAA2B;IAC3B,8BAA8B;IAC9B,8BAA8B;IAC9B,+BAA+B;IAC/B,wCAAwC;IACxC,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,yBAAyB;IACzB,2BAA2B;IAC3B,UAAU;IACV,mBAAmB;IACnB,mBAAmB;IACnB,KAAK;IACL,eAAe;IACf,eAAe;CACf,CAAC","sourcesContent":["import type { ImageContent, TextContent } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport { commitAdmittedCustomMessage, commitAdmittedCustomMessages } from \"./agent-session-custom-message-commit.ts\";\nimport { forwardedMessageOptions, resolveWorkflowStageDeliveryTarget } from \"./agent-session-delivery-forwarding.ts\";\nimport type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\nimport {\n\tisProtectedStreamingCustomMessage,\n\trestoreProtectedStreamingCustomMessages,\n} from \"./agent-session-persistent-custom-messages.ts\";\nimport { abort, pauseQueuedMessages, resumeQueuedMessages } from \"./agent-session-queue-pause.ts\";\nimport { transferWorkflowStageDeliveriesTo } from \"./agent-session-transfer.ts\";\nimport {\n\ttype AgentQueueAccess,\n\ttype ClearQueueOptions,\n\tcustomMessageExcludesContext,\n\ttype DrainedAgentQueues,\n\tdrainAgentMessageQueue,\n\ttype InterruptQueueHold,\n\tnormalizeInterruptAbortMessage,\n} from \"./agent-session-types.ts\";\nimport type { SendMessageOptions, SendMessagesOptions } from \"./extensions/index.js\";\nimport type { CustomMessage, StageAdmittedCustomMessage } from \"./messages.ts\";\n\nexport { transferWorkflowStageDeliveriesTo };\n\nconst interruptMutationQueues = new WeakMap<AgentSession, Promise<void>>();\n\nfunction serializeInterruptMutation(owner: AgentSession, operation: () => Promise<void>): Promise<void> {\n\tconst previous = interruptMutationQueues.get(owner) ?? Promise.resolve();\n\tconst delivery = previous.then(operation);\n\tinterruptMutationQueues.set(\n\t\towner,\n\t\tdelivery.catch(() => undefined),\n\t);\n\treturn delivery;\n}\n\nexport async function _queueSteer(this: AgentSession, text: string, images?: ImageContent[]): Promise<void> {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._queueSteer(text, images);\n\tthis._steeringMessages.push(text);\n\tthis._emitQueueUpdate();\n\tconst content: (TextContent | ImageContent)[] = [{ type: \"text\", text }];\n\tif (images) {\n\t\tcontent.push(...images);\n\t}\n\tthis._queueAgentMessage(\n\t\t{\n\t\t\trole: \"user\",\n\t\t\tcontent,\n\t\t\ttimestamp: Date.now(),\n\t\t},\n\t\t\"steer\",\n\t);\n}\n\n/**\n * Internal: Queue a follow-up message (already expanded, no extension command check).\n */\n\nexport async function _queueFollowUp(this: AgentSession, text: string, images?: ImageContent[]): Promise<void> {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._queueFollowUp(text, images);\n\tthis._followUpMessages.push(text);\n\tthis._emitQueueUpdate();\n\tconst content: (TextContent | ImageContent)[] = [{ type: \"text\", text }];\n\tif (images) {\n\t\tcontent.push(...images);\n\t}\n\tthis._queueAgentMessage(\n\t\t{\n\t\t\trole: \"user\",\n\t\t\tcontent,\n\t\t\ttimestamp: Date.now(),\n\t\t},\n\t\t\"followUp\",\n\t);\n}\n\n/**\n * Throw an error if the text is an extension command.\n */\n\nexport function _throwIfExtensionCommand(this: AgentSession, text: string): void {\n\tconst spaceIndex = text.indexOf(\" \");\n\tconst commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);\n\tconst command = this._extensionRunner.getCommand(commandName);\n\n\tif (command) {\n\t\tthrow new Error(\n\t\t\t`Extension command \"/${commandName}\" cannot be queued. Use prompt() or execute the command when not streaming.`,\n\t\t);\n\t}\n}\n\n/**\n * Send a custom message to the session. Creates a CustomMessageEntry.\n *\n * Handles five cases:\n * - Streaming + interrupt trigger: aborts the active run and starts an immediate custom-message turn\n * - Streaming + explicit display-only context exclusion: appends to state/session, no turn and no queue\n * - Streaming otherwise: queues message, processed when loop pulls from queue\n * - Not streaming + triggerTurn: appends to state/session, starts new turn\n * - Not streaming + no trigger: appends to state/session, no turn\n *\n * @param message Custom message with customType, content, display, details\n * @param options.triggerTurn If true and not streaming, triggers a new LLM turn\n * @param options.deliverAs Delivery mode: \"steer\", \"followUp\", \"nextTurn\", or \"interrupt\"\n */\n\nexport async function sendCustomMessage<T = unknown>(\n\tthis: AgentSession,\n\tmessage: Pick<CustomMessage<T>, \"customType\" | \"content\" | \"display\" | \"details\">,\n\toptions?: SendMessageOptions,\n): Promise<void> {\n\tconst currentOwner = resolveWorkflowStageDeliveryTarget(this);\n\tif (currentOwner !== this) return currentOwner.sendCustomMessage(message, options);\n\tconst appMessage = {\n\t\trole: \"custom\" as const,\n\t\tcustomType: message.customType,\n\t\tcontent: message.content ?? [],\n\t\tdisplay: message.display,\n\t\tdetails: message.details,\n\t\ttimestamp: Date.now(),\n\t\t...(options?.excludeFromContext === true ? { excludeFromContext: true } : {}),\n\t\t...(options?.stageAdmissionKey === undefined ? {} : { stageAdmissionKey: options.stageAdmissionKey }),\n\t} satisfies CustomMessage<T> & { stageAdmissionKey?: string };\n\tconst boundary = this._workflowStageAdmission;\n\tconst deliver = async (): Promise<void> => {\n\t\tif (boundary && options?.stageAdmissionBarrier) await options.stageAdmissionBarrier();\n\t\tawait commitAdmittedCustomMessage(this, appMessage, options);\n\t};\n\tif (boundary === undefined) return deliver();\n\tawait boundary.admit(options?.stageAdmissionKey, deliver, () => {\n\t\tconst router = this._orchestrationContext?.lateMessageRouter;\n\t\tif (router === undefined) throw new Error(\"Workflow stage closed without a late-message router\");\n\t\treturn router.routeMessage(message, options);\n\t}).completion;\n}\n\n/** Atomically admits a custom-message batch in array order. */\nexport async function sendCustomMessages<T = unknown>(\n\tthis: AgentSession,\n\tmessages: Array<Pick<CustomMessage<T>, \"customType\" | \"content\" | \"display\" | \"details\">>,\n\toptions?: SendMessagesOptions,\n): Promise<void> {\n\tconst currentOwner = resolveWorkflowStageDeliveryTarget(this);\n\tif (currentOwner !== this) return currentOwner.sendCustomMessages(messages, options);\n\tconst timestamp = Date.now();\n\tconst appMessages = messages.map(\n\t\t(message) =>\n\t\t\t({\n\t\t\t\trole: \"custom\" as const,\n\t\t\t\tcustomType: message.customType,\n\t\t\t\tcontent: message.content ?? [],\n\t\t\t\tdisplay: message.display,\n\t\t\t\tdetails: message.details,\n\t\t\t\ttimestamp,\n\t\t\t\t...(options?.excludeFromContext === true ? { excludeFromContext: true } : {}),\n\t\t\t\t...(options?.stageAdmissionKey === undefined ? {} : { stageAdmissionKey: options.stageAdmissionKey }),\n\t\t\t}) satisfies CustomMessage<T> & { stageAdmissionKey?: string },\n\t);\n\tif (appMessages.length === 0) return;\n\tconst boundary = this._workflowStageAdmission;\n\tconst deliver = async (): Promise<void> => {\n\t\tif (boundary && options?.stageAdmissionBarrier) await options.stageAdmissionBarrier();\n\t\tawait commitAdmittedCustomMessages(this, appMessages, options);\n\t};\n\tif (boundary === undefined) return deliver();\n\tawait boundary.admit(options?.stageAdmissionKey, deliver, () => {\n\t\tconst router = this._orchestrationContext?.lateMessageRouter;\n\t\tif (router === undefined) throw new Error(\"Workflow stage closed without a late-message router\");\n\t\treturn router.routeMessages(messages, options);\n\t}).completion;\n}\n\nexport function sealWorkflowStageGeneration(this: AgentSession): void {\n\tthis._workflowStageAdmission?.seal();\n}\n\nexport async function closeWorkflowStageGeneration(this: AgentSession): Promise<void> {\n\tawait this._workflowStageAdmission?.close();\n\tawait this.agent?.waitForIdle?.();\n\tawait this._agentEventQueue;\n}\n\nexport function _appendCustomMessage<T>(this: AgentSession, message: CustomMessage<T>): void {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) {\n\t\towner._appendCustomMessage(message);\n\t\treturn;\n\t}\n\tconst stageAdmissionMessage = message as StageAdmittedCustomMessage;\n\tthis.agent.state.messages.push(message);\n\tthis.sessionManager.appendCustomMessageEntry(\n\t\tmessage.customType,\n\t\tmessage.content,\n\t\tmessage.display,\n\t\tmessage.details,\n\t\tcustomMessageExcludesContext(message),\n\t\tundefined,\n\t\tstageAdmissionMessage.stageAdmissionKey,\n\t);\n\tthis._emit({ type: \"message_start\", message });\n\tthis._emit({ type: \"message_end\", message });\n}\n\n/** Append context-only custom messages once the current turn's tool results are in history. */\nexport function _flushPendingCustomMessages(this: AgentSession): void {\n\tif (this._pendingCustomMessages.length === 0) return;\n\tconst pending = this._pendingCustomMessages;\n\tthis._pendingCustomMessages = [];\n\tfor (const message of pending) this._appendCustomMessage(message);\n}\nexport function _enqueueInterruptCustomMessage<T>(\n\tthis: AgentSession,\n\tmessage: CustomMessage<T>,\n\toptions?: SendMessageOptions,\n): Promise<void> {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._enqueueInterruptCustomMessage(message, forwardedMessageOptions(options));\n\tthis._pendingInterruptDeliveries += 1;\n\t// Establish the hold synchronously when the interrupt is enqueued, not when\n\t// the serialized delivery callback later starts. Callers commonly fire and\n\t// forget sendCustomMessage(), then queue additional steer/follow-up messages\n\t// before the promise chain gets a microtask; those messages must be captured\n\t// in the active interrupt hold instead of pi-agent-core's live queues.\n\tthis._ensureActiveInterruptQueueHold();\n\tconst delivery = this._interruptDeliveryQueue.then(async () => {\n\t\ttry {\n\t\t\tawait this._sendInterruptCustomMessageNow(message, options);\n\t\t} finally {\n\t\t\t// Retirement moves the pending count and hold synchronously. Settle the\n\t\t\t// same live owner so its queue cannot remain stranded on the replacement.\n\t\t\tconst liveOwner = resolveWorkflowStageDeliveryTarget(this);\n\t\t\tliveOwner._pendingInterruptDeliveries -= 1;\n\t\t\tif (liveOwner._pendingInterruptDeliveries === 0) {\n\t\t\t\tliveOwner._restoreAndClearActiveInterruptQueueHold();\n\t\t\t}\n\t\t}\n\t});\n\tthis._interruptDeliveryQueue = delivery.catch(() => undefined);\n\treturn delivery;\n}\n\nasync function sendInterruptCustomMessageUnlocked<T>(\n\tsession: AgentSession,\n\tmessage: CustomMessage<T>,\n\toptions?: SendMessageOptions,\n): Promise<void> {\n\tsession.abortRetry();\n\tsession._ensureActiveInterruptQueueHold();\n\tif (session.isStreaming) {\n\t\tconst previousAbortMessage = session._activeInterruptAbortMessage;\n\t\tsession._activeInterruptAbortMessage = normalizeInterruptAbortMessage(options?.interruptAbortMessage);\n\t\ttry {\n\t\t\tsession.agent.abort();\n\t\t\tawait session.agent.waitForIdle();\n\t\t\tawait session._agentEventQueue;\n\t\t} finally {\n\t\t\tsession._activeInterruptAbortMessage = previousAbortMessage;\n\t\t}\n\t}\n\tconst owner = resolveWorkflowStageDeliveryTarget(session);\n\tif (owner !== session) return owner._sendInterruptCustomMessageNow(message, forwardedMessageOptions(options));\n\tif (session._queuedMessagesPaused) {\n\t\tsession._queueAgentMessage(message, \"steer\");\n\t\treturn;\n\t}\n\tawait session.agent.prompt(message);\n}\n\nexport function _sendInterruptCustomMessageNow<T>(\n\tthis: AgentSession,\n\tmessage: CustomMessage<T>,\n\toptions?: SendMessageOptions,\n): Promise<void> {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._sendInterruptCustomMessageNow(message, forwardedMessageOptions(options));\n\treturn serializeInterruptMutation(this, () => sendInterruptCustomMessageUnlocked(this, message, options));\n}\n\nexport function _ensureActiveInterruptQueueHold(this: AgentSession): InterruptQueueHold {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner._ensureActiveInterruptQueueHold();\n\tif (this._activeInterruptQueueHold !== undefined) {\n\t\treturn this._activeInterruptQueueHold;\n\t}\n\tconst drained = this._drainQueuedAgentMessages();\n\tthis._activeInterruptQueueHold = {\n\t\tsteering: [...drained.steering],\n\t\tfollowUp: [...drained.followUp],\n\t};\n\treturn this._activeInterruptQueueHold;\n}\n\nexport function _restoreAndClearActiveInterruptQueueHold(this: AgentSession): void {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) {\n\t\towner._restoreAndClearActiveInterruptQueueHold();\n\t\treturn;\n\t}\n\tif (this._queuedMessagesPaused) return;\n\tconst hold = this._activeInterruptQueueHold;\n\tif (hold === undefined) return;\n\tconst currentCoreQueues = this._drainQueuedAgentMessages();\n\tthis._restoreQueuedAgentMessages({\n\t\tsteering: [...hold.steering, ...currentCoreQueues.steering],\n\t\tfollowUp: [...hold.followUp, ...currentCoreQueues.followUp],\n\t});\n\tthis._activeInterruptQueueHold = undefined;\n}\n\nexport function _queueAgentMessage(this: AgentSession, message: AgentMessage, delivery: \"steer\" | \"followUp\"): void {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) {\n\t\towner._queueAgentMessage(message, delivery);\n\t\treturn;\n\t}\n\tconst hold = this._activeInterruptQueueHold;\n\tif (hold !== undefined) {\n\t\tif (delivery === \"followUp\") {\n\t\t\thold.followUp.push(message);\n\t\t} else {\n\t\t\thold.steering.push(message);\n\t\t}\n\t} else if (delivery === \"followUp\") {\n\t\tthis.agent.followUp(message);\n\t} else {\n\t\tthis.agent.steer(message);\n\t}\n\tthis._agentTaskHost?.yieldTaskWaits(message.role === \"user\" ? \"input-needed\" : \"intercom-coordination\");\n}\n\nexport function _drainQueuedAgentMessages(this: AgentSession): DrainedAgentQueues {\n\t// pi-agent-core exposes public clear methods but no public drain/restore pair.\n\t// Interrupt and pause holds prevent an aborting run from consuming queued raw\n\t// messages while preserving every entry for the existing resume boundary.\n\tconst agentWithQueues = this.agent as unknown as AgentQueueAccess;\n\treturn {\n\t\tsteering: drainAgentMessageQueue(agentWithQueues.steeringQueue),\n\t\tfollowUp: drainAgentMessageQueue(agentWithQueues.followUpQueue),\n\t};\n}\n\nexport function _restoreQueuedAgentMessages(this: AgentSession, queues: DrainedAgentQueues): void {\n\tfor (const message of queues.steering) {\n\t\tthis.agent.steer(message);\n\t}\n\tfor (const message of queues.followUp) {\n\t\tthis.agent.followUp(message);\n\t}\n}\n/**\n * Clear queued text for editor restoration while retaining optional raw custom entries.\n */\nexport function clearQueue(\n\tthis: AgentSession,\n\toptions?: ClearQueueOptions,\n): { steering: string[]; followUp: string[] } {\n\tconst owner = resolveWorkflowStageDeliveryTarget(this);\n\tif (owner !== this) return owner.clearQueue(options);\n\tconst steering = [...this._steeringMessages];\n\tconst followUp = [...this._followUpMessages];\n\tthis._steeringMessages = [];\n\tthis._followUpMessages = [];\n\tconst removed = this._drainQueuedAgentMessages();\n\tconst hold = this._activeInterruptQueueHold;\n\tif (hold !== undefined) {\n\t\tremoved.steering.push(...hold.steering.splice(0));\n\t\tremoved.followUp.push(...hold.followUp.splice(0));\n\t}\n\trestoreProtectedStreamingCustomMessages(this, removed);\n\tif (options?.preserveUnprotectedCustomMessages && hold !== undefined) {\n\t\tconst restoreUnprotectedCustomMessages = (\n\t\t\tremovedMessages: AgentMessage[],\n\t\t\theldMessages: AgentMessage[],\n\t\t): void => {\n\t\t\tconst currentlyHeld = [...heldMessages];\n\t\t\tconst preserved = removedMessages.filter(\n\t\t\t\t(message): message is Extract<AgentMessage, { role: \"custom\" }> =>\n\t\t\t\t\tmessage.role === \"custom\" && !isProtectedStreamingCustomMessage(this, message),\n\t\t\t);\n\t\t\tif (preserved.length === 0) return;\n\t\t\tconst preservedReferences = new Set<AgentMessage>(preserved);\n\t\t\tconst restoredProtected = new Set(currentlyHeld);\n\t\t\tconst ordered = removedMessages.filter(\n\t\t\t\t(message) => preservedReferences.has(message) || restoredProtected.has(message),\n\t\t\t);\n\t\t\tconst unmatched = currentlyHeld.filter((message) => !ordered.includes(message));\n\t\t\theldMessages.splice(0, heldMessages.length, ...ordered, ...unmatched);\n\t\t};\n\t\trestoreUnprotectedCustomMessages(removed.steering, hold.steering);\n\t\trestoreUnprotectedCustomMessages(removed.followUp, hold.followUp);\n\t}\n\tif (\n\t\t!this._queuedMessagesPaused &&\n\t\tthis._pendingInterruptDeliveries === 0 &&\n\t\thold !== undefined &&\n\t\thold.steering.length === 0 &&\n\t\thold.followUp.length === 0\n\t) {\n\t\tthis._activeInterruptQueueHold = undefined;\n\t}\n\tthis._emitQueueUpdate();\n\treturn { steering, followUp };\n}\n\n/** Number of pending messages (includes both steering and follow-up) */\nexport function getSteeringMessages(this: AgentSession): readonly string[] {\n\treturn this._steeringMessages;\n}\n\n/** Get pending follow-up messages (read-only) */\nexport function getFollowUpMessages(this: AgentSession): readonly string[] {\n\treturn this._followUpMessages;\n}\n\n// =========================================================================\n// Model Management\n// =========================================================================\n\nexport function setSteeringMode(this: AgentSession, mode: \"all\" | \"one-at-a-time\"): void {\n\tthis.agent.steeringMode = mode;\n\tthis.settingsManager.setSteeringMode(mode);\n}\n\n/**\n * Set follow-up message mode.\n * Saves to settings.\n */\n\nexport function setFollowUpMode(this: AgentSession, mode: \"all\" | \"one-at-a-time\"): void {\n\tthis.agent.followUpMode = mode;\n\tthis.settingsManager.setFollowUpMode(mode);\n}\n\n// =========================================================================\n// Queue and delivery settings\n// =========================================================================\nexport const agentSessionMessageQueueMethods = {\n\t_queueSteer,\n\t_queueFollowUp,\n\t_throwIfExtensionCommand,\n\ttransferWorkflowStageDeliveriesTo,\n\tsealWorkflowStageGeneration,\n\tsendCustomMessage,\n\tsendCustomMessages,\n\tcloseWorkflowStageGeneration,\n\t_appendCustomMessage,\n\t_flushPendingCustomMessages,\n\t_enqueueInterruptCustomMessage,\n\t_sendInterruptCustomMessageNow,\n\t_ensureActiveInterruptQueueHold,\n\t_restoreAndClearActiveInterruptQueueHold,\n\tpauseQueuedMessages,\n\tresumeQueuedMessages,\n\t_queueAgentMessage,\n\t_drainQueuedAgentMessages,\n\t_restoreQueuedAgentMessages,\n\tclearQueue,\n\tgetSteeringMessages,\n\tgetFollowUpMessages,\n\tabort,\n\tsetSteeringMode,\n\tsetFollowUpMode,\n};\n"]}
|
|
@@ -116,6 +116,9 @@ export interface AgentSessionMethodSurface extends AgentSessionQueuePauseControl
|
|
|
116
116
|
dispose(): void;
|
|
117
117
|
getAgentTaskHost(): import("./tasks/agent-adapter.js").AgentTaskHost;
|
|
118
118
|
closeSessionTasks(): Promise<void>;
|
|
119
|
+
/** Internal workflow pause: cancel owned execution without closing message admission. */
|
|
120
|
+
pauseTasks(): Promise<void>;
|
|
121
|
+
resumeTasks(): void;
|
|
119
122
|
getActiveToolNames(): string[];
|
|
120
123
|
getAllTools(): ToolInfo[];
|
|
121
124
|
getToolDefinition(name: string): ToolDefinition | undefined;
|