@bastani/atomic 0.9.89-alpha.1 → 0.9.89
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 +289 -0
- package/dist/builtin/intercom/CHANGELOG.md +31 -0
- package/dist/builtin/intercom/broker/broker-instance.ts +15 -1
- package/dist/builtin/intercom/broker/broker.ts +25 -8
- package/dist/builtin/intercom/broker/client.ts +29 -14
- package/dist/builtin/intercom/broker/multinode-router.ts +193 -52
- package/dist/builtin/intercom/broker/multinode-state-store.ts +6 -2
- package/dist/builtin/intercom/broker/restoring-recipients.ts +5 -0
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +3 -2
- package/dist/builtin/intercom/index.bundle.mjs +19 -12
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/types.ts +6 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +45 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +17 -6
- package/dist/builtin/web-access/CHANGELOG.md +11 -0
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +106 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +310 -344
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +99 -17
- package/dist/builtin/workflows/src/index.js +99 -17
- package/dist/builtin/workflows/src/local-worker-entry.mjs +99 -17
- package/dist/cli/storage-command.js +8 -0
- package/dist/cli/storage-command.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts.map +1 -1
- package/dist/core/auth-storage-backends.js +1 -0
- package/dist/core/auth-storage-backends.js.map +1 -1
- package/dist/core/keybindings.d.ts +8 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/process-start-token.d.ts.map +1 -1
- package/dist/core/process-start-token.js +8 -1
- package/dist/core/process-start-token.js.map +1 -1
- package/dist/core/resume/blueprint/build-lock.d.ts.map +1 -1
- package/dist/core/resume/blueprint/build-lock.js +2 -1
- package/dist/core/resume/blueprint/build-lock.js.map +1 -1
- package/dist/core/storage/errors.d.ts +4 -2
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js +6 -1
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +5 -0
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +13 -0
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tools/shell-task-render.d.ts +1 -2
- package/dist/core/tools/shell-task-render.d.ts.map +1 -1
- package/dist/core/tools/shell-task-render.js +3 -7
- package/dist/core/tools/shell-task-render.js.map +1 -1
- package/dist/core/tools/windows-directory-security.d.ts.map +1 -1
- package/dist/core/tools/windows-directory-security.js +3 -11
- package/dist/core/tools/windows-directory-security.js.map +1 -1
- package/dist/core/worktree-snapshot/capture.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/capture.js +25 -1
- package/dist/core/worktree-snapshot/capture.js.map +1 -1
- package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/restore.js +38 -9
- package/dist/core/worktree-snapshot/restore.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts +5 -0
- package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/agent-panel.js +13 -0
- package/dist/modes/interactive/components/agent-panel.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +5 -2
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/heartbeat-block.d.ts +34 -0
- package/dist/modes/interactive/components/heartbeat-block.d.ts.map +1 -0
- package/dist/modes/interactive/components/heartbeat-block.js +50 -0
- package/dist/modes/interactive/components/heartbeat-block.js.map +1 -0
- package/dist/modes/interactive/components/input-label.d.ts.map +1 -1
- package/dist/modes/interactive/components/input-label.js +8 -3
- package/dist/modes/interactive/components/input-label.js.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.js +3 -7
- package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +13 -7
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/notice-line.d.ts +10 -2
- package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
- package/dist/modes/interactive/components/notice-line.js +13 -3
- package/dist/modes/interactive/components/notice-line.js.map +1 -1
- package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -1
- package/dist/modes/interactive/components/provider-brand.js +3 -0
- package/dist/modes/interactive/components/provider-brand.js.map +1 -1
- package/dist/modes/interactive/components/task-heartbeat-message.d.ts +9 -4
- package/dist/modes/interactive/components/task-heartbeat-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-heartbeat-message.js +33 -27
- package/dist/modes/interactive/components/task-heartbeat-message.js.map +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts +16 -0
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +95 -4
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-list.d.ts +5 -1
- package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-list.js +20 -3
- package/dist/modes/interactive/components/task-list.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +10 -7
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +1 -2
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/theme/color-utils.d.ts +29 -1
- package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -1
- package/dist/modes/interactive/theme/color-utils.js +81 -7
- package/dist/modes/interactive/theme/color-utils.js.map +1 -1
- package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/global-theme.js +3 -0
- package/dist/modes/interactive/theme/global-theme.js.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts +22 -2
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +64 -18
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -0
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +2 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +6 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +170 -15
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/windows-powershell.d.ts +9 -0
- package/dist/utils/windows-powershell.d.ts.map +1 -0
- package/dist/utils/windows-powershell.js +16 -0
- package/dist/utils/windows-powershell.js.map +1 -0
- package/docs/background-tasks.md +6 -6
- package/docs/getting-started/installation.md +4 -2
- package/docs/keybindings.md +3 -0
- package/docs/storage.md +24 -5
- package/docs/subagents.md +1 -1
- package/docs/themes/reference.md +7 -0
- package/docs/tui/reference.md +1 -1
- package/docs/windows.md +1 -1
- package/docs/workflows/api-reference.md +9 -1
- package/docs/workflows/operations.md +1 -1
- package/npm-shrinkwrap.json +49 -49
- package/package.json +6 -6
- package/schemas/keybindings.schema.json +4 -0
|
@@ -50021,6 +50021,9 @@ function assertRowVersion(row) {
|
|
|
50021
50021
|
if (found !== JOURNAL_SCHEMA_VERSION)
|
|
50022
50022
|
throw new JournalSchemaVersionError(found);
|
|
50023
50023
|
}
|
|
50024
|
+
function counterInRange(column) {
|
|
50025
|
+
return `${column} >= 0 AND ${column} = ROUND(${column}) AND ${column} <= ?`;
|
|
50026
|
+
}
|
|
50024
50027
|
function entryFromRow(row) {
|
|
50025
50028
|
assertRowVersion(row);
|
|
50026
50029
|
const key = row[JOURNAL_COLUMNS.key];
|
|
@@ -50538,8 +50541,8 @@ class SqlRunJournal {
|
|
|
50538
50541
|
params: [owned.runId]
|
|
50539
50542
|
},
|
|
50540
50543
|
{
|
|
50541
|
-
sql: `UPDATE ${t.leases} SET ${JOURNAL_COLUMNS.renewedAt} = ${this.dialect.nowMs} WHERE ${JOURNAL_COLUMNS.runId} = ? AND ${JOURNAL_COLUMNS.holderId} = ? AND ${JOURNAL_COLUMNS.epoch} = ? AND EXISTS (SELECT 1 FROM ${t.meta} WHERE ${JOURNAL_COLUMNS.schemaVersion} = ?)`,
|
|
50542
|
-
params: [owned.runId, owned.holderId, owned.epoch, JOURNAL_SCHEMA_VERSION]
|
|
50544
|
+
sql: `UPDATE ${t.leases} SET ${JOURNAL_COLUMNS.renewedAt} = ${this.dialect.nowMs} WHERE ${JOURNAL_COLUMNS.runId} = ? AND ${JOURNAL_COLUMNS.holderId} = ? AND ${JOURNAL_COLUMNS.epoch} = ? AND ${counterInRange(JOURNAL_COLUMNS.epoch)} AND EXISTS (SELECT 1 FROM ${t.meta} WHERE ${JOURNAL_COLUMNS.schemaVersion} = ?)`,
|
|
50545
|
+
params: [owned.runId, owned.holderId, owned.epoch, Number.MAX_SAFE_INTEGER, JOURNAL_SCHEMA_VERSION]
|
|
50543
50546
|
}
|
|
50544
50547
|
], { ...JOURNAL_WRITE_TRANSACTION, priority: true });
|
|
50545
50548
|
assertRowVersion(rows[0][0]);
|
|
@@ -50599,7 +50602,7 @@ class SqlRunJournal {
|
|
|
50599
50602
|
});
|
|
50600
50603
|
const batch = this.database.batch?.bind(this.database);
|
|
50601
50604
|
if (batch && prepared.every((append) => append instanceof Error || this.inOneRequest(append)))
|
|
50602
|
-
return this.operation(() => this.appendInOneRequest(batch, owned, prepared));
|
|
50605
|
+
return this.operation(() => this.appendInOneRequest((statements) => batch(statements, JOURNAL_WRITE_TRANSACTION), owned, prepared));
|
|
50603
50606
|
return this.operation(() => this.transaction(async (tx) => {
|
|
50604
50607
|
await this.checkLease(tx, owned);
|
|
50605
50608
|
const results = [];
|
|
@@ -50622,8 +50625,8 @@ class SqlRunJournal {
|
|
|
50622
50625
|
}
|
|
50623
50626
|
async appendInOneRequest(batch, owned, prepared) {
|
|
50624
50627
|
const t = this.tables;
|
|
50625
|
-
const holds = `EXISTS (SELECT 1 FROM ${t.leases} WHERE ${JOURNAL_COLUMNS.runId} = ? AND ${JOURNAL_COLUMNS.holderId} = ? AND ${JOURNAL_COLUMNS.epoch} = ?)`;
|
|
50626
|
-
const held = [owned.runId, owned.holderId, owned.epoch];
|
|
50628
|
+
const holds = `EXISTS (SELECT 1 FROM ${t.leases} WHERE ${JOURNAL_COLUMNS.runId} = ? AND ${JOURNAL_COLUMNS.holderId} = ? AND ${JOURNAL_COLUMNS.epoch} = ? AND ${counterInRange(JOURNAL_COLUMNS.epoch)})`;
|
|
50629
|
+
const held = [owned.runId, owned.holderId, owned.epoch, Number.MAX_SAFE_INTEGER];
|
|
50627
50630
|
const latest = `SELECT * FROM ${t.events} WHERE ${JOURNAL_COLUMNS.runId} = ? AND ${JOURNAL_COLUMNS.seq} = (SELECT MAX(${JOURNAL_COLUMNS.seq}) FROM ${t.events} WHERE ${JOURNAL_COLUMNS.runId} = ?)`;
|
|
50628
50631
|
const statements = [
|
|
50629
50632
|
{
|
|
@@ -50641,7 +50644,7 @@ class SqlRunJournal {
|
|
|
50641
50644
|
params: [owned.runId, key]
|
|
50642
50645
|
});
|
|
50643
50646
|
const appends = `FROM (SELECT COALESCE(MAX(${JOURNAL_COLUMNS.seq}), 0) AS latest FROM ${t.events} WHERE ${JOURNAL_COLUMNS.runId} = ?) AS current
|
|
50644
|
-
WHERE current.latest < ? AND ${holds} AND EXISTS (SELECT 1 FROM ${t.meta} WHERE ${JOURNAL_COLUMNS.schemaVersion} = ?)${key === undefined ? "" : ` AND NOT EXISTS (SELECT 1 FROM ${t.events} WHERE ${JOURNAL_COLUMNS.runId} = ? AND ${JOURNAL_COLUMNS.key} = ?)`}`;
|
|
50647
|
+
WHERE current.latest < ? AND current.latest >= 0 AND current.latest = ROUND(current.latest) AND ${holds} AND EXISTS (SELECT 1 FROM ${t.meta} WHERE ${JOURNAL_COLUMNS.schemaVersion} = ?)${key === undefined ? "" : ` AND NOT EXISTS (SELECT 1 FROM ${t.events} WHERE ${JOURNAL_COLUMNS.runId} = ? AND ${JOURNAL_COLUMNS.key} = ?)`}`;
|
|
50645
50648
|
const appendsParams = [
|
|
50646
50649
|
owned.runId,
|
|
50647
50650
|
Number.MAX_SAFE_INTEGER,
|
|
@@ -82611,9 +82614,9 @@ var init_client = __esm(() => {
|
|
|
82611
82614
|
break;
|
|
82612
82615
|
}
|
|
82613
82616
|
case "released_children_ack": {
|
|
82614
|
-
const { requestId, refusal } = brokerMessage;
|
|
82617
|
+
const { requestId, refusal, published } = brokerMessage;
|
|
82615
82618
|
const parsed = refusal === undefined ? undefined : readReleasedChildRefusal(refusal);
|
|
82616
|
-
if (typeof requestId !== "string" || refusal !== undefined && parsed === undefined) {
|
|
82619
|
+
if (typeof requestId !== "string" || refusal !== undefined && parsed === undefined || published !== undefined && typeof published !== "boolean") {
|
|
82617
82620
|
throw new Error("Invalid released_children_ack message");
|
|
82618
82621
|
}
|
|
82619
82622
|
const pending = this.pendingRestoringRecipientRequests.get(requestId);
|
|
@@ -82621,14 +82624,14 @@ var init_client = __esm(() => {
|
|
|
82621
82624
|
return;
|
|
82622
82625
|
this.pendingRestoringRecipientRequests.delete(requestId);
|
|
82623
82626
|
if (parsed === undefined)
|
|
82624
|
-
pending.resolve();
|
|
82627
|
+
pending.resolve(published !== false);
|
|
82625
82628
|
else
|
|
82626
82629
|
pending.reject(releasedChildErrorFor(parsed));
|
|
82627
82630
|
break;
|
|
82628
82631
|
}
|
|
82629
82632
|
case "restoring_recipient_ack": {
|
|
82630
|
-
const { requestId, error } = brokerMessage;
|
|
82631
|
-
if (typeof requestId !== "string" || error !== undefined && typeof error !== "string") {
|
|
82633
|
+
const { requestId, error, published } = brokerMessage;
|
|
82634
|
+
if (typeof requestId !== "string" || error !== undefined && typeof error !== "string" || published !== undefined && typeof published !== "boolean") {
|
|
82632
82635
|
throw new Error("Invalid restoring_recipient_ack message");
|
|
82633
82636
|
}
|
|
82634
82637
|
const pending = this.pendingRestoringRecipientRequests.get(requestId);
|
|
@@ -82636,7 +82639,7 @@ var init_client = __esm(() => {
|
|
|
82636
82639
|
return;
|
|
82637
82640
|
this.pendingRestoringRecipientRequests.delete(requestId);
|
|
82638
82641
|
if (error === undefined)
|
|
82639
|
-
pending.resolve();
|
|
82642
|
+
pending.resolve(published !== false);
|
|
82640
82643
|
else
|
|
82641
82644
|
pending.reject(new Error(error));
|
|
82642
82645
|
break;
|
|
@@ -83059,8 +83062,8 @@ var init_client = __esm(() => {
|
|
|
83059
83062
|
}
|
|
83060
83063
|
});
|
|
83061
83064
|
}
|
|
83062
|
-
reserveRestoringRecipient(capability, options = {}) {
|
|
83063
|
-
|
|
83065
|
+
async reserveRestoringRecipient(capability, options = {}) {
|
|
83066
|
+
const published = await this.restoringRecipientRequest({
|
|
83064
83067
|
type: "reserve_restoring_recipient",
|
|
83065
83068
|
capability,
|
|
83066
83069
|
...options.group === undefined ? {} : { group: options.group },
|
|
@@ -83068,6 +83071,7 @@ var init_client = __esm(() => {
|
|
|
83068
83071
|
...options.dormant === true ? { dormant: true } : {},
|
|
83069
83072
|
...options.holdMs === undefined ? {} : { holdMs: options.holdMs }
|
|
83070
83073
|
});
|
|
83074
|
+
return { published };
|
|
83071
83075
|
}
|
|
83072
83076
|
releaseRestoringRecipient(capability, outcome) {
|
|
83073
83077
|
const { gone, refusal } = typeof outcome === "string" ? { gone: outcome, refusal: undefined } : outcome ?? {};
|
|
@@ -83076,6 +83080,8 @@ var init_client = __esm(() => {
|
|
|
83076
83080
|
capability,
|
|
83077
83081
|
...gone === undefined ? {} : { gone },
|
|
83078
83082
|
...refusal === undefined ? {} : { refusal }
|
|
83083
|
+
}).then(() => {
|
|
83084
|
+
return;
|
|
83079
83085
|
});
|
|
83080
83086
|
}
|
|
83081
83087
|
async reserveReleasedChildren(children) {
|
|
@@ -83132,7 +83138,9 @@ var init_client = __esm(() => {
|
|
|
83132
83138
|
} catch (error) {
|
|
83133
83139
|
return Promise.reject(toError(error));
|
|
83134
83140
|
}
|
|
83135
|
-
return this.restoringRecipientRequest({ type: "acknowledge_released_child_wake", childName })
|
|
83141
|
+
return this.restoringRecipientRequest({ type: "acknowledge_released_child_wake", childName }).then(() => {
|
|
83142
|
+
return;
|
|
83143
|
+
});
|
|
83136
83144
|
}
|
|
83137
83145
|
acknowledgeReleasedChildReply(reply, accepted, deliverToChild = false) {
|
|
83138
83146
|
if (!this.socket || this.socket.destroyed)
|
|
@@ -83234,9 +83242,9 @@ var init_client = __esm(() => {
|
|
|
83234
83242
|
this.requestTimeout(socket, new Error("Restoring-recipient request timeout")).then(reject);
|
|
83235
83243
|
}, RESTORING_RECIPIENT_REQUEST_TIMEOUT_MS);
|
|
83236
83244
|
this.pendingRestoringRecipientRequests.set(requestId, {
|
|
83237
|
-
resolve: () => {
|
|
83245
|
+
resolve: (published = true) => {
|
|
83238
83246
|
clearTimeout(timeout);
|
|
83239
|
-
resolve();
|
|
83247
|
+
resolve(published);
|
|
83240
83248
|
},
|
|
83241
83249
|
reject: (error) => {
|
|
83242
83250
|
clearTimeout(timeout);
|
|
@@ -98192,9 +98200,15 @@ var init_stage_runner_reopen = __esm(() => {
|
|
|
98192
98200
|
});
|
|
98193
98201
|
|
|
98194
98202
|
// dist/builtin/workflows/src/runs/foreground/stage-runner-replacement.ts
|
|
98203
|
+
function holdsDeliveries(session) {
|
|
98204
|
+
return session.queuedMessagesPaused === true;
|
|
98205
|
+
}
|
|
98206
|
+
|
|
98195
98207
|
class StageSessionReplacement {
|
|
98196
98208
|
previous;
|
|
98197
98209
|
cleanups = new Set;
|
|
98210
|
+
releaseSuccessorQueue = false;
|
|
98211
|
+
successorRelease;
|
|
98198
98212
|
get retiringSession() {
|
|
98199
98213
|
return this.previous;
|
|
98200
98214
|
}
|
|
@@ -98202,6 +98216,31 @@ class StageSessionReplacement {
|
|
|
98202
98216
|
if (session)
|
|
98203
98217
|
this.previous = session;
|
|
98204
98218
|
}
|
|
98219
|
+
async stop(session, options = {}) {
|
|
98220
|
+
if (!session)
|
|
98221
|
+
return "stopped";
|
|
98222
|
+
const alreadyHeld = holdsDeliveries(session);
|
|
98223
|
+
const stopping = Promise.resolve().then(() => session.abort());
|
|
98224
|
+
let outcome;
|
|
98225
|
+
try {
|
|
98226
|
+
outcome = await boundedStop(stopping, options.timeoutMs ?? REPLACED_SESSION_STOP_TIMEOUT_MS, options.signal);
|
|
98227
|
+
} finally {
|
|
98228
|
+
if (!alreadyHeld && holdsDeliveries(session))
|
|
98229
|
+
this.releaseSuccessorQueue = true;
|
|
98230
|
+
}
|
|
98231
|
+
if (outcome !== "stopped")
|
|
98232
|
+
stopping.catch(() => {});
|
|
98233
|
+
return outcome;
|
|
98234
|
+
}
|
|
98235
|
+
successorReady() {
|
|
98236
|
+
const release = this.successorRelease;
|
|
98237
|
+
if (release === undefined)
|
|
98238
|
+
return;
|
|
98239
|
+
return release.then(() => {
|
|
98240
|
+
if (this.successorRelease === release)
|
|
98241
|
+
this.successorRelease = undefined;
|
|
98242
|
+
});
|
|
98243
|
+
}
|
|
98205
98244
|
adopt(session) {
|
|
98206
98245
|
const previous = this.previous;
|
|
98207
98246
|
this.previous = undefined;
|
|
@@ -98211,6 +98250,14 @@ class StageSessionReplacement {
|
|
|
98211
98250
|
const target = asAgentSession(session);
|
|
98212
98251
|
if (source && target)
|
|
98213
98252
|
source.transferWorkflowStageDeliveriesTo?.(target);
|
|
98253
|
+
if (this.releaseSuccessorQueue) {
|
|
98254
|
+
this.releaseSuccessorQueue = false;
|
|
98255
|
+
this.successorRelease = Promise.resolve().then(() => session.resumeQueuedMessages?.()).then(() => {
|
|
98256
|
+
return;
|
|
98257
|
+
}, (error) => {
|
|
98258
|
+
console.error("atomic-workflows: releasing a replacement stage session's deliveries failed", error);
|
|
98259
|
+
});
|
|
98260
|
+
}
|
|
98214
98261
|
const cleanup = this.disposeAfterIdle(previous);
|
|
98215
98262
|
this.cleanups.add(cleanup);
|
|
98216
98263
|
cleanup.finally(() => this.cleanups.delete(cleanup)).catch(() => {});
|
|
@@ -98223,6 +98270,8 @@ class StageSessionReplacement {
|
|
|
98223
98270
|
async disposeRetired() {
|
|
98224
98271
|
const previous = this.previous;
|
|
98225
98272
|
this.previous = undefined;
|
|
98273
|
+
this.releaseSuccessorQueue = false;
|
|
98274
|
+
this.successorRelease = undefined;
|
|
98226
98275
|
if (!previous)
|
|
98227
98276
|
return;
|
|
98228
98277
|
await disposeStageSession(previous).catch((error) => {
|
|
@@ -98236,6 +98285,29 @@ class StageSessionReplacement {
|
|
|
98236
98285
|
await disposeStageSession(session);
|
|
98237
98286
|
}
|
|
98238
98287
|
}
|
|
98288
|
+
function boundedStop(stopping, timeoutMs, signal) {
|
|
98289
|
+
if (signal?.aborted)
|
|
98290
|
+
return Promise.resolve("cancelled");
|
|
98291
|
+
return new Promise((resolve, reject) => {
|
|
98292
|
+
const timer = setTimeout(() => finish("timed-out"), timeoutMs);
|
|
98293
|
+
const onAbort = () => finish("cancelled");
|
|
98294
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
98295
|
+
let settled = false;
|
|
98296
|
+
function finish(outcome, error) {
|
|
98297
|
+
if (settled)
|
|
98298
|
+
return;
|
|
98299
|
+
settled = true;
|
|
98300
|
+
clearTimeout(timer);
|
|
98301
|
+
signal?.removeEventListener("abort", onAbort);
|
|
98302
|
+
if (error !== undefined)
|
|
98303
|
+
reject(error);
|
|
98304
|
+
else
|
|
98305
|
+
resolve(outcome);
|
|
98306
|
+
}
|
|
98307
|
+
stopping.then(() => finish("stopped"), (error) => finish("stopped", error));
|
|
98308
|
+
});
|
|
98309
|
+
}
|
|
98310
|
+
var REPLACED_SESSION_STOP_TIMEOUT_MS = 1e4;
|
|
98239
98311
|
var init_stage_runner_replacement = __esm(() => {
|
|
98240
98312
|
init_stage_runner_session();
|
|
98241
98313
|
});
|
|
@@ -100749,6 +100821,13 @@ class StageSessionController {
|
|
|
100749
100821
|
this.unsubscribeTerminateWatcher?.();
|
|
100750
100822
|
this.unsubscribeTerminateWatcher = undefined;
|
|
100751
100823
|
this.residency.terminatingToolCallIds.clear();
|
|
100824
|
+
try {
|
|
100825
|
+
const stopped = await this.residency.replacement.stop(current, { signal: this.opts.signal });
|
|
100826
|
+
if (stopped === "timed-out")
|
|
100827
|
+
console.warn(`atomic-workflows: stage "${this.opts.stageName}" replaced a session whose turn did not end within ${REPLACED_SESSION_STOP_TIMEOUT_MS} ms; it starts no new turn and is disposed once idle`);
|
|
100828
|
+
} catch (error) {
|
|
100829
|
+
console.error("atomic-workflows: stopping a replaced stage session failed", error);
|
|
100830
|
+
}
|
|
100752
100831
|
const shutdown = Promise.resolve().then(() => shutdownStageSession(current));
|
|
100753
100832
|
this.sessionShutdownPromise = shutdown;
|
|
100754
100833
|
shutdown.then(() => {
|
|
@@ -100760,6 +100839,9 @@ class StageSessionController {
|
|
|
100760
100839
|
throw this.staleCreationReason(startGeneration);
|
|
100761
100840
|
}
|
|
100762
100841
|
async promptWithPauseResume(activeSession, initialText, sdkOptions) {
|
|
100842
|
+
const successorReady = this.residency.replacement.successorReady();
|
|
100843
|
+
if (successorReady !== undefined)
|
|
100844
|
+
await successorReady;
|
|
100763
100845
|
let nextText = initialText;
|
|
100764
100846
|
let nextOptions = sdkOptions;
|
|
100765
100847
|
while (nextText !== undefined) {
|
|
@@ -117506,6 +117588,9 @@ function subscribeIntercomControl(pi, callbacks) {
|
|
|
117506
117588
|
};
|
|
117507
117589
|
}
|
|
117508
117590
|
|
|
117591
|
+
// dist/builtin/workflows/src/tui/color-utils.ts
|
|
117592
|
+
import { hexColorAnsi } from "@bastani/atomic";
|
|
117593
|
+
|
|
117509
117594
|
// ../../node_modules/marked/lib/marked.esm.js
|
|
117510
117595
|
function A() {
|
|
117511
117596
|
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
@@ -124393,6 +124478,13 @@ markdownParser.use({
|
|
|
124393
124478
|
extensions: [...LATEX_MARKDOWN_EXTENSIONS]
|
|
124394
124479
|
});
|
|
124395
124480
|
// ../tui/dist/components/scroll-view.js
|
|
124481
|
+
function colorTurnedOff(env = process.env) {
|
|
124482
|
+
if (env.NO_COLOR !== undefined)
|
|
124483
|
+
return true;
|
|
124484
|
+
const forced = env.FORCE_COLOR?.trim().toLowerCase();
|
|
124485
|
+
return forced === "0" || forced === "false";
|
|
124486
|
+
}
|
|
124487
|
+
|
|
124396
124488
|
class ScrollView extends Container {
|
|
124397
124489
|
child;
|
|
124398
124490
|
followEnd;
|
|
@@ -124423,8 +124515,9 @@ class ScrollView extends Container {
|
|
|
124423
124515
|
this.primary = options.primary ?? false;
|
|
124424
124516
|
this.overscroll = options.overscroll ?? "chain";
|
|
124425
124517
|
this.currentScrollbar = options.scrollbar ?? "hidden";
|
|
124426
|
-
|
|
124427
|
-
this.
|
|
124518
|
+
const plain = colorTurnedOff();
|
|
124519
|
+
this.scrollbarTrackStyle = options.scrollbarTrackStyle ?? ((text) => plain ? text : `\x1B[90m${text}\x1B[39m`);
|
|
124520
|
+
this.scrollbarThumbStyle = options.scrollbarThumbStyle ?? ((text) => plain ? text : `\x1B[37m${text}\x1B[39m`);
|
|
124428
124521
|
this.scrollbarHideDelayMs = Math.max(0, Math.floor(options.scrollbarHideDelayMs ?? 1000));
|
|
124429
124522
|
}
|
|
124430
124523
|
get scrollTop() {
|
|
@@ -125523,16 +125616,26 @@ function lerpColor(a, b, t) {
|
|
|
125523
125616
|
return toHex(r, g, bl);
|
|
125524
125617
|
}
|
|
125525
125618
|
function hexToAnsi(hex) {
|
|
125526
|
-
|
|
125527
|
-
return `\x1B[38;2;${r};${g};${b}m`;
|
|
125619
|
+
return hexColorAnsi(hex, "fg");
|
|
125528
125620
|
}
|
|
125529
125621
|
function hexBg(hex) {
|
|
125530
|
-
|
|
125531
|
-
|
|
125622
|
+
return hexColorAnsi(hex, "bg");
|
|
125623
|
+
}
|
|
125624
|
+
function colorLevelKey() {
|
|
125625
|
+
return hexColorAnsi("#000000", "fg");
|
|
125626
|
+
}
|
|
125627
|
+
function colorsOff() {
|
|
125628
|
+
return colorLevelKey() === "";
|
|
125532
125629
|
}
|
|
125533
125630
|
var DEFAULT_BG = "\x1B[49m";
|
|
125534
125631
|
var RESET = "\x1B[0m";
|
|
125535
125632
|
var BOLD = "\x1B[1m";
|
|
125633
|
+
function textStyle(sequence) {
|
|
125634
|
+
return colorsOff() ? "" : sequence;
|
|
125635
|
+
}
|
|
125636
|
+
function boldOn() {
|
|
125637
|
+
return textStyle(BOLD);
|
|
125638
|
+
}
|
|
125536
125639
|
function fillBackground(text, width, background) {
|
|
125537
125640
|
return filledBackgroundLines.get(`${width}\x00${background}\x00${text}`, () => {
|
|
125538
125641
|
return new Text(truncateToWidth(text, width, "…"), 0, 0, (line) => `${background}${line.replace(/\x1b\[(?:0|49)?m/g, (reset) => reset + background)}${RESET}`).render(width)[0] ?? "";
|
|
@@ -125540,7 +125643,7 @@ function fillBackground(text, width, background) {
|
|
|
125540
125643
|
}
|
|
125541
125644
|
function paint(text, fg, opts = {}) {
|
|
125542
125645
|
const bgSeq = opts.bg ? hexBg(opts.bg) : "";
|
|
125543
|
-
const boldSeq = opts.bold ?
|
|
125646
|
+
const boldSeq = opts.bold ? boldOn() : "";
|
|
125544
125647
|
return `${bgSeq}${hexToAnsi(fg)}${boldSeq}${text}${RESET}`;
|
|
125545
125648
|
}
|
|
125546
125649
|
|
|
@@ -125709,7 +125812,7 @@ function renderRunIdentityRows(opts) {
|
|
|
125709
125812
|
const themed = opts.theme !== undefined;
|
|
125710
125813
|
const glyph = themed ? `${hexToAnsi(opts.glyphColor ?? opts.theme.text)}${opts.glyph}${RESET}` : opts.glyph;
|
|
125711
125814
|
const id = themed ? (text) => `${hexToAnsi(opts.theme.accent)}${text}${RESET}` : (text) => text;
|
|
125712
|
-
const name = themed ? `${hexToAnsi(opts.theme.text)}${
|
|
125815
|
+
const name = themed ? `${hexToAnsi(opts.theme.text)}${boldOn()}${opts.name}${RESET}` : opts.name;
|
|
125713
125816
|
const metaColor = opts.metaColor ?? opts.theme?.dim;
|
|
125714
125817
|
const meta = themed && opts.meta !== undefined && opts.meta.length > 0 ? ` · ${hexToAnsi(metaColor ?? opts.theme.textMuted)}${opts.meta}${RESET}` : opts.meta !== undefined && opts.meta.length > 0 ? ` · ${opts.meta}` : "";
|
|
125715
125818
|
const rows = chunks.map((chunk, index) => {
|
|
@@ -126075,7 +126178,7 @@ function renderThemed(detail, now, theme, width, resolveOwningRunStatus, resolve
|
|
|
126075
126178
|
out.push("");
|
|
126076
126179
|
const tools = detail.tools;
|
|
126077
126180
|
if (detail.stages.length > 0 || tools.length === 0) {
|
|
126078
|
-
out.push(` ${muted}${
|
|
126181
|
+
out.push(` ${muted}${boldOn()}STAGES${RESET} `);
|
|
126079
126182
|
if (detail.stages.length === 0)
|
|
126080
126183
|
out.push(` ${dim}(no stages recorded yet)${RESET} `);
|
|
126081
126184
|
else
|
|
@@ -126084,14 +126187,14 @@ function renderThemed(detail, now, theme, width, resolveOwningRunStatus, resolve
|
|
|
126084
126187
|
out.push("");
|
|
126085
126188
|
}
|
|
126086
126189
|
if (tools.length > 0) {
|
|
126087
|
-
out.push(` ${muted}${
|
|
126190
|
+
out.push(` ${muted}${boldOn()}TOOLS${RESET} `);
|
|
126088
126191
|
for (const tool of tools)
|
|
126089
126192
|
out.push(...renderToolRowsThemed(tool, now, theme, width - 4));
|
|
126090
126193
|
out.push("");
|
|
126091
126194
|
}
|
|
126092
126195
|
const artifactRows = artifactRowsFor(detail, width);
|
|
126093
126196
|
if (artifactRows.length > 0) {
|
|
126094
|
-
out.push(` ${muted}${
|
|
126197
|
+
out.push(` ${muted}${boldOn()}ARTIFACTS${RESET} `);
|
|
126095
126198
|
for (const [k, v] of artifactRows) {
|
|
126096
126199
|
out.push(` ${muted}${pad(k, KEY_COL)}${RESET}${dim}${truncateToWidth2(v, Math.max(1, width - 4 - KEY_COL), "…")}${RESET} `);
|
|
126097
126200
|
}
|
|
@@ -126771,7 +126874,7 @@ function renderRunEntry(run, now, width, theme, allRuns, indicatorStatuses, reso
|
|
|
126771
126874
|
const trailingText = truncateToWidth2(trailing?.text ?? "", Math.max(0, interior - 1), ELLIPSIS);
|
|
126772
126875
|
const nameBudget = Math.max(1, interior - 3 - visibleWidth(trailingText) - (trailingText ? 2 : 0));
|
|
126773
126876
|
const name = truncateToWidth2(boundedToolTitleText(run.name, nameBudget * 4), nameBudget, ELLIPSIS);
|
|
126774
|
-
const nameSeg = theme ? `${text}${
|
|
126877
|
+
const nameSeg = theme ? `${text}${boldOn()}${name}${RESET}` : name;
|
|
126775
126878
|
const trailingSeg = theme && trailingText ? `${hexToAnsi(trailing?.fg ?? theme.dim)}${trailingText}${RESET}` : trailingText;
|
|
126776
126879
|
const identity = ` ${nameSeg}${trailingSeg ? ` ${trailingSeg}` : ""}`;
|
|
126777
126880
|
const mode = run.stages.length > 1 ? "chain " : "single";
|
|
@@ -127133,7 +127236,7 @@ function renderWorkflowEntry(entry, opts) {
|
|
|
127133
127236
|
const interior = Math.max(8, width - 2);
|
|
127134
127237
|
const titleBudget = Math.max(8, Math.min(TAG_NAME_BUDGET, interior - 2));
|
|
127135
127238
|
const title = truncateToWidth2(entry.name, titleBudget, ELLIPSIS);
|
|
127136
|
-
const titleLine = theme ? ` ${hexToAnsi(theme.text)}${
|
|
127239
|
+
const titleLine = theme ? ` ${hexToAnsi(theme.text)}${boldOn()}${title}${RESET} ` : ` ${title} `;
|
|
127137
127240
|
const descBudget = Math.max(8, interior - 4);
|
|
127138
127241
|
const description = truncateToWidth2(entry.description, descBudget, ELLIPSIS);
|
|
127139
127242
|
const row1 = ` ${paintMuted(description, theme)} `;
|
|
@@ -128062,7 +128165,7 @@ function centreColored(content, width, fg, bg, opts = {}) {
|
|
|
128062
128165
|
const pad = Math.max(0, width - safeWidth);
|
|
128063
128166
|
const left = Math.max(0, Math.floor(pad / 2));
|
|
128064
128167
|
const right = Math.max(0, pad - left);
|
|
128065
|
-
const bold = opts.bold ?
|
|
128168
|
+
const bold = opts.bold ? boldOn() : "";
|
|
128066
128169
|
return `${bg}${" ".repeat(left)}` + `${hexToAnsi(fg)}${bold}${safe}${RESET}` + `${bg}${" ".repeat(right)}`;
|
|
128067
128170
|
}
|
|
128068
128171
|
function buildTitleSlot(name, innerWidth, focused, theme, cardBg, compact = false) {
|
|
@@ -128077,7 +128180,7 @@ function buildTitleSlot(name, innerWidth, focused, theme, cardBg, compact = fals
|
|
|
128077
128180
|
return { slot: styled, visibleWidth: visibleWidth(tabText) };
|
|
128078
128181
|
}
|
|
128079
128182
|
const titleRaw = compact ? safeName : ` ${safeName} `;
|
|
128080
|
-
const styled = `${
|
|
128183
|
+
const styled = `${boldOn()}${titleRaw}${RESET}${cardBg}`;
|
|
128081
128184
|
return { slot: styled, visibleWidth: visibleWidth(titleRaw) };
|
|
128082
128185
|
}
|
|
128083
128186
|
function renderNodeCard(stage, opts) {
|
|
@@ -128408,7 +128511,7 @@ function renderStageFailureDetailLines(stage, opts) {
|
|
|
128408
128511
|
const tokens = stageTokensText(stage);
|
|
128409
128512
|
const indent = " ";
|
|
128410
128513
|
const room = Math.max(1, width - indent.length);
|
|
128411
|
-
const title = `${indent}${statusTone}${
|
|
128514
|
+
const title = `${indent}${statusTone}${boldOn()}${statusGlyph} ${inertDisplayLine(boundedToolTitleText(stage.name, width * 4))}${RESET}${muted} · ${statusWord}${after}${tokens}${RESET}`;
|
|
128412
128515
|
if (opts.logs) {
|
|
128413
128516
|
const partLimit = Math.min(TOOL_PAYLOAD_VALUE_LIMIT, room * MAX_FAILURE_LOG_ROWS);
|
|
128414
128517
|
const markerRow = truncateToWidth2(TOOL_PAYLOAD_TRUNCATION_MARKER, room, "…");
|
|
@@ -128815,8 +128918,8 @@ function wrapOutcomeLogLine(line, room) {
|
|
|
128815
128918
|
}
|
|
128816
128919
|
function renderRunOutcome(outcome, opts) {
|
|
128817
128920
|
const width = Math.max(1, Math.floor(opts.width));
|
|
128818
|
-
const t =
|
|
128819
|
-
const paint = (color, text, bold = false) => t === undefined || color === undefined ? text : `${hexToAnsi(color)}${bold ?
|
|
128921
|
+
const t = colorsOff() ? undefined : opts.theme;
|
|
128922
|
+
const paint = (color, text, bold = false) => t === undefined || color === undefined ? text : `${hexToAnsi(color)}${bold ? boldOn() : ""}${text}${RESET}`;
|
|
128820
128923
|
const stateColor = {
|
|
128821
128924
|
completed: t?.success,
|
|
128822
128925
|
failed: t?.error,
|
|
@@ -129677,7 +129780,7 @@ function renderOutlinePill(label, borderHex, chromeBg) {
|
|
|
129677
129780
|
const paddedWidth = visibleWidth(padded);
|
|
129678
129781
|
const inner = "─".repeat(paddedWidth);
|
|
129679
129782
|
const top = `${chromeBg}${bc}╭${inner}╮${RESET}`;
|
|
129680
|
-
const mid = `${chromeBg}${bc}│${
|
|
129783
|
+
const mid = `${chromeBg}${bc}│${boldOn()}${padded}${RESET}${chromeBg}${bc}│${RESET}`;
|
|
129681
129784
|
const bot = `${chromeBg}${bc}╰${inner}╯${RESET}`;
|
|
129682
129785
|
return { top, mid, bot, visibleWidth: paddedWidth + 2 };
|
|
129683
129786
|
}
|
|
@@ -129917,7 +130020,7 @@ class GraphViewRenderHelpers extends GraphViewState {
|
|
|
129917
130020
|
text: (text) => `${hexToAnsi(t.text)}${text}${RESET}`,
|
|
129918
130021
|
muted: (text) => `${hexToAnsi(t.textMuted)}${text}${RESET}`,
|
|
129919
130022
|
border: (text) => `${hexToAnsi(t.borderActive)}${text}${RESET}`,
|
|
129920
|
-
bold: (text) => `${hexToAnsi(t.text)}${
|
|
130023
|
+
bold: (text) => `${hexToAnsi(t.text)}${boldOn()}${text}${RESET}`
|
|
129921
130024
|
};
|
|
129922
130025
|
}
|
|
129923
130026
|
_actionKey(action, fallback, label) {
|
|
@@ -130153,7 +130256,7 @@ class GraphViewRenderHelpers extends GraphViewState {
|
|
|
130153
130256
|
if (!keys)
|
|
130154
130257
|
continue;
|
|
130155
130258
|
plainParts.push(entry.label.length > 0 ? `${keys} ${entry.label}` : keys);
|
|
130156
|
-
styledParts.push(entry.label.length > 0 ? `${text}${
|
|
130259
|
+
styledParts.push(entry.label.length > 0 ? `${text}${boldOn()}${keys}${RESET}${chromeBg} ${muted}${entry.label}${RESET}${chromeBg}` : `${text}${boldOn()}${keys}${RESET}${chromeBg}`);
|
|
130157
130260
|
}
|
|
130158
130261
|
return {
|
|
130159
130262
|
width: visibleWidth(plainParts.join(sepText)),
|
|
@@ -130784,7 +130887,7 @@ function renderSwitcher(stages, state, opts) {
|
|
|
130784
130887
|
const queryDisplay = state.query ? ` ${truncateToWidth2(state.query, queryBudget, "…")}` : "";
|
|
130785
130888
|
const leftSegmentWidth = visibleWidth(`${leftLabelText}${queryDisplay}`);
|
|
130786
130889
|
const gap = Math.max(1, innerWidth - leftSegmentWidth - visibleWidth(hint) - 1);
|
|
130787
|
-
const header = `${panelBg}${muted}${
|
|
130890
|
+
const header = `${panelBg}${muted}${boldOn()}${leftLabelText}${RESET}${panelBg}` + (queryDisplay ? `${text}${queryDisplay}${RESET}${panelBg}` : "") + " ".repeat(gap) + `${dim}${hint}${RESET}${panelBg}`;
|
|
130788
130891
|
lines.push(`${border}│${RESET}${padVisible2(header, innerWidth)}${border}│${RESET}`);
|
|
130789
130892
|
const rule = innerWidth <= 2 ? " ".repeat(innerWidth) : ` ${dim}${"─".repeat(innerWidth - 2)}${RESET}${panelBg} `;
|
|
130790
130893
|
lines.push(`${border}│${RESET}${panelBg}${rule}${border}│${RESET}`);
|
|
@@ -130811,7 +130914,7 @@ function renderSwitcher(stages, state, opts) {
|
|
|
130811
130914
|
const prefix = ` ${icon} ${selectedName}`;
|
|
130812
130915
|
const visibleRow = `${prefix}${" ".repeat(Math.max(1, innerWidth - visibleWidth(`${prefix}${label}`) - 1))}${label} `;
|
|
130813
130916
|
const padded = padVisible2(visibleRow, innerWidth);
|
|
130814
|
-
const styled = `${accent}${accentFg}${
|
|
130917
|
+
const styled = `${accent}${accentFg}${boldOn()}${padded}${RESET}`;
|
|
130815
130918
|
lines.push(`${border}│${RESET}${styled}${border}│${RESET}`);
|
|
130816
130919
|
} else {
|
|
130817
130920
|
const iconColor = hexToAnsi(statusColor(displayStatus, theme));
|
|
@@ -130876,7 +130979,7 @@ function styledStatus(status, theme) {
|
|
|
130876
130979
|
return theme === undefined ? glyph : `${hexToAnsi(statusColor2(status, theme))}${glyph}${RESET}`;
|
|
130877
130980
|
}
|
|
130878
130981
|
function styledTitle(text, theme) {
|
|
130879
|
-
return theme === undefined ? text : `${hexToAnsi(theme.toolTitle)}${
|
|
130982
|
+
return theme === undefined ? text : `${hexToAnsi(theme.toolTitle)}${boldOn()}${text}${RESET}`;
|
|
130880
130983
|
}
|
|
130881
130984
|
function styledOutput(text, theme) {
|
|
130882
130985
|
return theme === undefined ? text : `${hexToAnsi(theme.toolOutput)}${text}${RESET}`;
|
|
@@ -131225,12 +131328,14 @@ class GraphViewRenderer extends GraphViewGraphRenderer {
|
|
|
131225
131328
|
_toolDetailFrame(node, width) {
|
|
131226
131329
|
const safeWidth = Math.max(1, Math.floor(width));
|
|
131227
131330
|
const cached = this.detailFrame;
|
|
131228
|
-
|
|
131331
|
+
const colorLevel = colorLevelKey();
|
|
131332
|
+
if (cached !== null && cached.width === safeWidth && cached.colorLevel === colorLevel)
|
|
131229
131333
|
return cached;
|
|
131230
131334
|
const frame = {
|
|
131231
131335
|
width: safeWidth,
|
|
131232
131336
|
blockWidth: safeWidth,
|
|
131233
131337
|
leftPad: 0,
|
|
131338
|
+
colorLevel,
|
|
131234
131339
|
lines: renderToolDetailLines(node, {
|
|
131235
131340
|
theme: this.graphTheme,
|
|
131236
131341
|
width: safeWidth,
|
|
@@ -131252,13 +131357,15 @@ class GraphViewRenderer extends GraphViewGraphRenderer {
|
|
|
131252
131357
|
const safeWidth = Math.max(1, Math.floor(width));
|
|
131253
131358
|
const fullAttempts = stage.modelAttempts ?? this.store.run(this.stageDetail.runId)?.stages.find((candidate) => candidate.id === this.stageDetail?.stageId)?.modelAttempts;
|
|
131254
131359
|
const cached = this.stageDetailFrame;
|
|
131255
|
-
|
|
131360
|
+
const colorLevel = colorLevelKey();
|
|
131361
|
+
if (cached !== null && cached.frame.width === safeWidth && cached.frame.colorLevel === colorLevel && cached.stage === stage && cached.modelAttempts === fullAttempts && cached.logs === this.stageDetail.logs)
|
|
131256
131362
|
return cached.frame;
|
|
131257
131363
|
const detailStage = fullAttempts === undefined || fullAttempts === stage.modelAttempts ? stage : { ...stage, modelAttempts: fullAttempts };
|
|
131258
131364
|
const frame = {
|
|
131259
131365
|
width: safeWidth,
|
|
131260
131366
|
blockWidth: safeWidth,
|
|
131261
131367
|
leftPad: 0,
|
|
131368
|
+
colorLevel,
|
|
131262
131369
|
lines: renderStageFailureDetailLines(detailStage, {
|
|
131263
131370
|
theme: this.graphTheme,
|
|
131264
131371
|
width: safeWidth,
|
|
@@ -131279,13 +131386,15 @@ class GraphViewRenderer extends GraphViewGraphRenderer {
|
|
|
131279
131386
|
const elapsedMs = elapsedRunMs(run, Date.now());
|
|
131280
131387
|
const elapsedSecond = Math.floor(elapsedMs / 1000);
|
|
131281
131388
|
const cached = this.runDetailFrame;
|
|
131282
|
-
|
|
131389
|
+
const colorLevel = colorLevelKey();
|
|
131390
|
+
if (cached !== null && cached.frame.width === safeWidth && cached.frame.colorLevel === colorLevel && cached.run === run && cached.outcome === outcome && cached.logs === detail.logs && cached.selected === selected && cached.elapsedSecond === elapsedSecond)
|
|
131283
131391
|
return cached.frame;
|
|
131284
131392
|
const rendered = renderRunOutcome({ ...outcome, elapsedMs }, { theme: this.graphTheme, width: safeWidth, logs: detail.logs, selected });
|
|
131285
131393
|
const frame = {
|
|
131286
131394
|
width: safeWidth,
|
|
131287
131395
|
blockWidth: safeWidth,
|
|
131288
131396
|
leftPad: 0,
|
|
131397
|
+
colorLevel,
|
|
131289
131398
|
lines: rendered.lines,
|
|
131290
131399
|
...rendered.selectedRow === undefined ? {} : { selectedRow: rendered.selectedRow }
|
|
131291
131400
|
};
|
|
@@ -132481,7 +132590,7 @@ function editorThemeFromGraphTheme(t) {
|
|
|
132481
132590
|
text: normal,
|
|
132482
132591
|
muted: (text) => hexToAnsi(t.dim) + text + RESET,
|
|
132483
132592
|
border: (text) => hexToAnsi(t.border) + text + RESET,
|
|
132484
|
-
bold: (text) =>
|
|
132593
|
+
bold: (text) => boldOn() + text + RESET
|
|
132485
132594
|
})
|
|
132486
132595
|
};
|
|
132487
132596
|
}
|
|
@@ -132516,9 +132625,9 @@ function paint2(text, fg, opts = {}) {
|
|
|
132516
132625
|
return "";
|
|
132517
132626
|
let out = hexToAnsi(fg);
|
|
132518
132627
|
if (opts.bold)
|
|
132519
|
-
out +=
|
|
132628
|
+
out += boldOn();
|
|
132520
132629
|
if (opts.italic)
|
|
132521
|
-
out += ITALIC;
|
|
132630
|
+
out += textStyle(ITALIC);
|
|
132522
132631
|
if (opts.bg)
|
|
132523
132632
|
out = hexBg(opts.bg) + out;
|
|
132524
132633
|
return out + text + RESET;
|
|
@@ -132528,14 +132637,14 @@ function paintOnFill(text, fg, opts = {}) {
|
|
|
132528
132637
|
return "";
|
|
132529
132638
|
let out = hexToAnsi(fg);
|
|
132530
132639
|
if (opts.bold)
|
|
132531
|
-
out +=
|
|
132640
|
+
out += boldOn();
|
|
132532
132641
|
if (opts.italic)
|
|
132533
|
-
out += ITALIC;
|
|
132642
|
+
out += textStyle(ITALIC);
|
|
132534
132643
|
let close = FG_RESET;
|
|
132535
132644
|
if (opts.bold)
|
|
132536
|
-
close += WEIGHT_RESET;
|
|
132645
|
+
close += textStyle(WEIGHT_RESET);
|
|
132537
132646
|
if (opts.italic)
|
|
132538
|
-
close += ITALIC_RESET;
|
|
132647
|
+
close += textStyle(ITALIC_RESET);
|
|
132539
132648
|
return out + text + close;
|
|
132540
132649
|
}
|
|
132541
132650
|
function stripAnsi(s) {
|
|
@@ -133072,7 +133181,7 @@ function drawCursor(text, caret, cursorOn, theme) {
|
|
|
133072
133181
|
return beforeFx + paint(at, theme.text) + afterFx;
|
|
133073
133182
|
const cursorFg = hexToAnsi(theme.backgroundPanel);
|
|
133074
133183
|
const cursorBg = hexBg(theme.accent);
|
|
133075
|
-
return beforeFx + cursorBg + cursorFg +
|
|
133184
|
+
return beforeFx + cursorBg + cursorFg + boldOn() + at + RESET + afterFx;
|
|
133076
133185
|
}
|
|
133077
133186
|
function padToUsable(content, usable) {
|
|
133078
133187
|
const w = visibleWidth(content);
|
|
@@ -133647,139 +133756,8 @@ function chatHostStyle(ctx) {
|
|
|
133647
133756
|
};
|
|
133648
133757
|
}
|
|
133649
133758
|
|
|
133650
|
-
// dist/builtin/workflows/src/tui/workflow-notice-card.ts
|
|
133651
|
-
var MIN_CARD_WIDTH = 32;
|
|
133652
|
-
var FIELD_LABEL_WIDTH = 9;
|
|
133653
|
-
function renderWorkflowNoticeCard(input) {
|
|
133654
|
-
const opts = inertCardText(input);
|
|
133655
|
-
const width = Math.max(1, Math.floor(opts.width));
|
|
133656
|
-
if (width < MIN_CARD_WIDTH)
|
|
133657
|
-
return wrapPlainText(opts.fallbackText, width);
|
|
133658
|
-
const theme = opts.theme;
|
|
133659
|
-
const accent = theme ? toneColor(theme, opts.tone) : undefined;
|
|
133660
|
-
const innerWidth = Math.max(2, width - 2);
|
|
133661
|
-
const bodyLines = [];
|
|
133662
|
-
appendHeadline(bodyLines, opts, innerWidth);
|
|
133663
|
-
for (const field of opts.fields ?? []) {
|
|
133664
|
-
if (field.value === undefined || field.value.length === 0)
|
|
133665
|
-
continue;
|
|
133666
|
-
appendField(bodyLines, field, innerWidth, theme);
|
|
133667
|
-
}
|
|
133668
|
-
for (const hint of opts.hints ?? []) {
|
|
133669
|
-
if (hint.length === 0)
|
|
133670
|
-
continue;
|
|
133671
|
-
appendHint(bodyLines, hint, innerWidth, theme);
|
|
133672
|
-
}
|
|
133673
|
-
if (opts.footer && opts.footer.length > 0) {
|
|
133674
|
-
appendFreeText(bodyLines, opts.footer, innerWidth, theme, "muted");
|
|
133675
|
-
}
|
|
133676
|
-
return renderRoundedBoxLines({
|
|
133677
|
-
title: opts.title,
|
|
133678
|
-
bodyLines,
|
|
133679
|
-
width,
|
|
133680
|
-
...theme ? { theme, accent } : {}
|
|
133681
|
-
});
|
|
133682
|
-
}
|
|
133683
|
-
function inertCardText(opts) {
|
|
133684
|
-
return {
|
|
133685
|
-
...opts,
|
|
133686
|
-
title: inertDisplayLine(opts.title),
|
|
133687
|
-
headline: inertDisplayText(opts.headline),
|
|
133688
|
-
fallbackText: inertDisplayText(opts.fallbackText),
|
|
133689
|
-
...opts.fields === undefined ? {} : {
|
|
133690
|
-
fields: opts.fields.map((field) => field.value === undefined ? field : { ...field, value: inertDisplayText(field.value) })
|
|
133691
|
-
},
|
|
133692
|
-
...opts.hints === undefined ? {} : { hints: opts.hints.map((hint) => inertDisplayLine(hint)) },
|
|
133693
|
-
...opts.footer === undefined ? {} : { footer: inertDisplayText(opts.footer) }
|
|
133694
|
-
};
|
|
133695
|
-
}
|
|
133696
|
-
function appendHeadline(rows, opts, innerWidth) {
|
|
133697
|
-
const prefix = `${opts.glyph} `;
|
|
133698
|
-
const continuationPrefix = `${" ".repeat(visibleWidth(opts.glyph))} `;
|
|
133699
|
-
const budget = Math.max(1, innerWidth - 1 - visibleWidth(prefix));
|
|
133700
|
-
const lines = wrapPlainText(opts.headline, budget);
|
|
133701
|
-
const theme = opts.theme;
|
|
133702
|
-
const tone = theme ? toneColor(theme, opts.tone) : undefined;
|
|
133703
|
-
for (let i = 0;i < lines.length; i++) {
|
|
133704
|
-
const rawPrefix = i === 0 ? prefix : continuationPrefix;
|
|
133705
|
-
const styledPrefix = i === 0 ? style(rawPrefix, theme, tone, true) : " ".repeat(visibleWidth(rawPrefix));
|
|
133706
|
-
const line = ` ${styledPrefix}${style(lines[i] ?? "", theme, theme?.text, true)}`;
|
|
133707
|
-
rows.push(fit(line, innerWidth));
|
|
133708
|
-
}
|
|
133709
|
-
}
|
|
133710
|
-
function appendField(rows, field, innerWidth, theme) {
|
|
133711
|
-
const label = truncateToWidth2(field.label, FIELD_LABEL_WIDTH, "…").padEnd(FIELD_LABEL_WIDTH, " ");
|
|
133712
|
-
const firstPrefixWidth = 1 + FIELD_LABEL_WIDTH + 1;
|
|
133713
|
-
const firstBudget = Math.max(1, innerWidth - firstPrefixWidth);
|
|
133714
|
-
const value2 = field.value ?? "";
|
|
133715
|
-
const valueTone = field.tone ?? "text";
|
|
133716
|
-
if (visibleWidth(value2) <= firstBudget && !value2.includes(`
|
|
133717
|
-
`)) {
|
|
133718
|
-
rows.push(fit(` ${style(label, theme, theme?.dim, true)} ${style(value2, theme, colorForField(theme, valueTone))}`, innerWidth));
|
|
133719
|
-
return;
|
|
133720
|
-
}
|
|
133721
|
-
rows.push(fit(` ${style(field.label, theme, theme?.dim, true)}`, innerWidth));
|
|
133722
|
-
if (visibleWidth(value2) <= innerWidth - 1 && !value2.includes(`
|
|
133723
|
-
`)) {
|
|
133724
|
-
rows.push(fit(` ${style(value2, theme, colorForField(theme, valueTone))}`, innerWidth));
|
|
133725
|
-
return;
|
|
133726
|
-
}
|
|
133727
|
-
const continuationPrefix = " ";
|
|
133728
|
-
const continuationBudget = Math.max(1, innerWidth - visibleWidth(continuationPrefix));
|
|
133729
|
-
for (const line of wrapPlainText(value2, continuationBudget)) {
|
|
133730
|
-
rows.push(fit(`${continuationPrefix}${style(line, theme, colorForField(theme, valueTone))}`, innerWidth));
|
|
133731
|
-
}
|
|
133732
|
-
}
|
|
133733
|
-
function appendHint(rows, hint, innerWidth, theme) {
|
|
133734
|
-
const prefix = "▸ ";
|
|
133735
|
-
const continuationPrefix = " ";
|
|
133736
|
-
const budget = Math.max(1, innerWidth - 1 - visibleWidth(prefix));
|
|
133737
|
-
const lines = wrapPlainText(hint, budget);
|
|
133738
|
-
for (let i = 0;i < lines.length; i++) {
|
|
133739
|
-
const rawPrefix = i === 0 ? prefix : continuationPrefix;
|
|
133740
|
-
const styledPrefix = i === 0 ? style(rawPrefix, theme, theme?.accent, true) : " ".repeat(visibleWidth(rawPrefix));
|
|
133741
|
-
rows.push(fit(` ${styledPrefix}${style(lines[i] ?? "", theme, theme?.textMuted)}`, innerWidth));
|
|
133742
|
-
}
|
|
133743
|
-
}
|
|
133744
|
-
function appendFreeText(rows, text, innerWidth, theme, tone) {
|
|
133745
|
-
const budget = Math.max(1, innerWidth - 1);
|
|
133746
|
-
for (const line of wrapPlainText(text, budget)) {
|
|
133747
|
-
rows.push(fit(` ${style(line, theme, colorForField(theme, tone ?? "text"))}`, innerWidth));
|
|
133748
|
-
}
|
|
133749
|
-
}
|
|
133750
|
-
function colorForField(theme, tone) {
|
|
133751
|
-
if (!theme)
|
|
133752
|
-
return;
|
|
133753
|
-
if (tone === "text")
|
|
133754
|
-
return theme.text;
|
|
133755
|
-
if (tone === "muted")
|
|
133756
|
-
return theme.textMuted;
|
|
133757
|
-
return toneColor(theme, tone ?? "info");
|
|
133758
|
-
}
|
|
133759
|
-
function toneColor(theme, tone) {
|
|
133760
|
-
switch (tone) {
|
|
133761
|
-
case "success":
|
|
133762
|
-
return theme.success;
|
|
133763
|
-
case "warning":
|
|
133764
|
-
return theme.warning;
|
|
133765
|
-
case "error":
|
|
133766
|
-
return theme.error;
|
|
133767
|
-
case "mauve":
|
|
133768
|
-
return theme.mauve;
|
|
133769
|
-
default:
|
|
133770
|
-
return theme.info;
|
|
133771
|
-
}
|
|
133772
|
-
}
|
|
133773
|
-
function style(text, theme, color, bold = false) {
|
|
133774
|
-
if (!theme || !color || text.length === 0)
|
|
133775
|
-
return text;
|
|
133776
|
-
return `${hexToAnsi(color)}${bold ? BOLD : ""}${text}${RESET}`;
|
|
133777
|
-
}
|
|
133778
|
-
function fit(line, width) {
|
|
133779
|
-
return truncateToWidth2(line, width, "…");
|
|
133780
|
-
}
|
|
133781
|
-
|
|
133782
133759
|
// dist/builtin/workflows/src/tui/stage-chat-view-transcript.ts
|
|
133760
|
+
import { NoticeLine } from "@bastani/atomic";
|
|
133783
133761
|
function noticeSummary(n) {
|
|
133784
133762
|
if (n.kind === "decision" && n.meta !== undefined)
|
|
133785
133763
|
return `~ ${n.meta}`;
|
|
@@ -133802,15 +133780,18 @@ function stageNoticeCountsAsMessage(entry) {
|
|
|
133802
133780
|
return false;
|
|
133803
133781
|
}
|
|
133804
133782
|
}
|
|
133805
|
-
function noticeRow(entry,
|
|
133783
|
+
function noticeRow(entry, settings = () => {
|
|
133784
|
+
return;
|
|
133785
|
+
}) {
|
|
133786
|
+
const spec = stageNoticeLine(entry);
|
|
133806
133787
|
return {
|
|
133807
133788
|
render(width) {
|
|
133808
|
-
|
|
133809
|
-
|
|
133810
|
-
|
|
133811
|
-
|
|
133812
|
-
|
|
133813
|
-
});
|
|
133789
|
+
const current = settings();
|
|
133790
|
+
return new NoticeLine({
|
|
133791
|
+
...spec,
|
|
133792
|
+
countHiddenDetail: true,
|
|
133793
|
+
...current?.outputPad === undefined ? {} : { outputPad: current.outputPad }
|
|
133794
|
+
}, current?.expanded === true).render(width);
|
|
133814
133795
|
},
|
|
133815
133796
|
invalidate() {}
|
|
133816
133797
|
};
|
|
@@ -133939,96 +133920,77 @@ function extractToolResultText(result) {
|
|
|
133939
133920
|
const content = result.content;
|
|
133940
133921
|
return extractMessageText2(content);
|
|
133941
133922
|
}
|
|
133942
|
-
function
|
|
133923
|
+
function changeMeta(entry) {
|
|
133924
|
+
return [entry.from === undefined ? "" : `was ${entry.from}`, entry.meta ?? ""].filter(Boolean);
|
|
133925
|
+
}
|
|
133926
|
+
function oneLineText(value2) {
|
|
133927
|
+
return value2.replace(/\s+/g, " ").trim();
|
|
133928
|
+
}
|
|
133929
|
+
function stageNoticeLine(entry) {
|
|
133943
133930
|
switch (entry.kind) {
|
|
133944
|
-
case "
|
|
133931
|
+
case "model":
|
|
133945
133932
|
return {
|
|
133946
|
-
|
|
133947
|
-
|
|
133948
|
-
|
|
133949
|
-
|
|
133950
|
-
|
|
133933
|
+
status: "info",
|
|
133934
|
+
label: "Model changed to",
|
|
133935
|
+
subject: entry.value,
|
|
133936
|
+
outcome: "",
|
|
133937
|
+
meta: changeMeta(entry)
|
|
133951
133938
|
};
|
|
133952
|
-
case "
|
|
133939
|
+
case "thinking":
|
|
133953
133940
|
return {
|
|
133954
|
-
|
|
133955
|
-
|
|
133956
|
-
|
|
133957
|
-
|
|
133958
|
-
|
|
133941
|
+
status: "info",
|
|
133942
|
+
label: "Thinking level changed to",
|
|
133943
|
+
subject: entry.value,
|
|
133944
|
+
outcome: "",
|
|
133945
|
+
meta: changeMeta(entry)
|
|
133959
133946
|
};
|
|
133960
|
-
case "
|
|
133947
|
+
case "compaction":
|
|
133961
133948
|
return {
|
|
133962
|
-
|
|
133963
|
-
|
|
133964
|
-
|
|
133965
|
-
|
|
133966
|
-
fields: stageNoticeFields(entry)
|
|
133949
|
+
status: "success",
|
|
133950
|
+
label: "Context",
|
|
133951
|
+
outcome: entry.value === "compacted" ? "compacted" : `compacted (${entry.value})`,
|
|
133952
|
+
meta: entry.meta === undefined ? [] : [entry.meta]
|
|
133967
133953
|
};
|
|
133968
|
-
case "
|
|
133954
|
+
case "tree":
|
|
133969
133955
|
return {
|
|
133970
|
-
|
|
133971
|
-
|
|
133972
|
-
|
|
133973
|
-
|
|
133974
|
-
|
|
133956
|
+
status: "info",
|
|
133957
|
+
label: "Branch changed to",
|
|
133958
|
+
subject: entry.value,
|
|
133959
|
+
outcome: "",
|
|
133960
|
+
meta: changeMeta(entry)
|
|
133975
133961
|
};
|
|
133962
|
+
case "abort":
|
|
133963
|
+
return { status: "stopped", label: "Stage", outcome: entry.value, meta: changeMeta(entry) };
|
|
133976
133964
|
case "cleanup":
|
|
133977
133965
|
return {
|
|
133978
|
-
|
|
133979
|
-
|
|
133980
|
-
|
|
133981
|
-
|
|
133982
|
-
|
|
133983
|
-
|
|
133984
|
-
|
|
133966
|
+
status: "warning",
|
|
133967
|
+
label: "Task",
|
|
133968
|
+
outcome: "finished; its process cleanup is still being confirmed",
|
|
133969
|
+
meta: [entry.value],
|
|
133970
|
+
...entry.meta === undefined ? {} : { detail: entry.meta.split("; ").join(`
|
|
133971
|
+
`) }
|
|
133972
|
+
};
|
|
133973
|
+
case "decision": {
|
|
133974
|
+
const status = entry.value === "advanced" ? "success" : entry.value === "stayed" ? "info" : "warning";
|
|
133985
133975
|
return {
|
|
133986
|
-
|
|
133987
|
-
|
|
133988
|
-
|
|
133989
|
-
|
|
133990
|
-
fields: [
|
|
133991
|
-
{ label: "outcome", value: entry.value, tone: "text" },
|
|
133992
|
-
{ label: "model", value: entry.from, tone: "muted" }
|
|
133993
|
-
]
|
|
133976
|
+
status,
|
|
133977
|
+
label: entry.meta ?? "Decision model judged the stage's readiness",
|
|
133978
|
+
outcome: "",
|
|
133979
|
+
meta: [entry.meta === undefined ? entry.value : "", entry.from ?? ""].filter(Boolean)
|
|
133994
133980
|
};
|
|
133981
|
+
}
|
|
133995
133982
|
case "undelivered":
|
|
133996
133983
|
return {
|
|
133997
|
-
|
|
133998
|
-
|
|
133999
|
-
|
|
134000
|
-
|
|
134001
|
-
|
|
134002
|
-
{ label: "message", value: entry.value, tone: "text" },
|
|
134003
|
-
{ label: "next", value: "send it to another stage if it still matters", tone: "muted" }
|
|
134004
|
-
]
|
|
134005
|
-
};
|
|
134006
|
-
case "tree":
|
|
134007
|
-
return {
|
|
134008
|
-
title: "STAGE TREE",
|
|
134009
|
-
glyph: "◆",
|
|
134010
|
-
headline: "Stage branch tree changed",
|
|
134011
|
-
tone: "info",
|
|
134012
|
-
fields: stageNoticeFields(entry, "muted")
|
|
133984
|
+
status: "warning",
|
|
133985
|
+
label: "Stage",
|
|
133986
|
+
outcome: "finished before this message was delivered",
|
|
133987
|
+
detail: [`message ${oneLineText(entry.value)}`, "Send it to another stage if it still matters."].join(`
|
|
133988
|
+
`)
|
|
134013
133989
|
};
|
|
134014
133990
|
default:
|
|
134015
|
-
return {
|
|
134016
|
-
title: "STAGE NOTICE",
|
|
134017
|
-
glyph: "◆",
|
|
134018
|
-
headline: "Workflow stage notice",
|
|
134019
|
-
tone: "info",
|
|
134020
|
-
fields: stageNoticeFields(entry, "muted")
|
|
134021
|
-
};
|
|
133991
|
+
return { status: "info", label: entry.kind, outcome: entry.value, meta: changeMeta(entry) };
|
|
134022
133992
|
}
|
|
134023
133993
|
}
|
|
134024
|
-
function stageNoticeFields(entry, valueTone = "text") {
|
|
134025
|
-
return [
|
|
134026
|
-
{ label: "kind", value: entry.kind, tone: "muted" },
|
|
134027
|
-
{ label: "value", value: entry.value, tone: valueTone },
|
|
134028
|
-
{ label: "from", value: entry.from, tone: "muted" },
|
|
134029
|
-
{ label: "meta", value: entry.meta, tone: "muted" }
|
|
134030
|
-
];
|
|
134031
|
-
}
|
|
134032
133994
|
|
|
134033
133995
|
// dist/builtin/workflows/src/tui/stage-chat-view-types.ts
|
|
134034
133996
|
var VIEW_LINE_COUNT = 32;
|
|
@@ -134311,7 +134273,10 @@ function createChatHost(ctx, opts) {
|
|
|
134311
134273
|
editorTheme: editorThemeFromGraphTheme(ctx.theme),
|
|
134312
134274
|
getChatRenderSettings: () => stageChatRenderSettings(ctx, opts),
|
|
134313
134275
|
footerData: ctx.footerData,
|
|
134314
|
-
renderExtraEntry: (entry) => noticeRow(entry,
|
|
134276
|
+
renderExtraEntry: (entry) => noticeRow(entry, () => {
|
|
134277
|
+
const settings = stageChatRenderSettings(ctx, opts);
|
|
134278
|
+
return { expanded: settings?.toolOutputExpanded === true, outputPad: settings?.outputPad };
|
|
134279
|
+
}),
|
|
134315
134280
|
countsAsMessage: stageNoticeCountsAsMessage
|
|
134316
134281
|
});
|
|
134317
134282
|
}
|
|
@@ -138721,7 +138686,7 @@ import { isAbsolute as isAbsolute17, join as join42 } from "node:path";
|
|
|
138721
138686
|
import { CONFIG_DIR_NAME as CONFIG_DIR_NAME3, getAgentDir as getAgentDir13 } from "@bastani/atomic";
|
|
138722
138687
|
// dist/builtin/workflows/src/extension/lifecycle-notifications.ts
|
|
138723
138688
|
init_returned_run_status();
|
|
138724
|
-
import { NoticeLine, reportDebugAsync as reportDebug4, sliceHead as sliceHead20 } from "@bastani/atomic";
|
|
138689
|
+
import { NoticeLine as NoticeLine2, reportDebugAsync as reportDebug4, sliceHead as sliceHead20 } from "@bastani/atomic";
|
|
138725
138690
|
init_tool_payload_bounds();
|
|
138726
138691
|
|
|
138727
138692
|
// dist/builtin/workflows/src/extension/lifecycle-notification-delivery.ts
|
|
@@ -138995,7 +138960,7 @@ function registerLifecycleNoticeRenderer(options) {
|
|
|
138995
138960
|
const message = raw;
|
|
138996
138961
|
if (!message.details)
|
|
138997
138962
|
return;
|
|
138998
|
-
return makeNoticeComponent(message.details, options?.expanded === true);
|
|
138963
|
+
return makeNoticeComponent(message.details, options?.expanded === true, options?.outputPad);
|
|
138999
138964
|
};
|
|
139000
138965
|
register(LIFECYCLE_NOTICE_CUSTOM_TYPE, renderer);
|
|
139001
138966
|
rendererRegisteredHosts2.add(host);
|
|
@@ -139325,8 +139290,8 @@ function formatLifecycleOutputs(outputs) {
|
|
|
139325
139290
|
return "available; inspect the run result";
|
|
139326
139291
|
}
|
|
139327
139292
|
}
|
|
139328
|
-
function makeNoticeComponent(details, expanded) {
|
|
139329
|
-
const line = new
|
|
139293
|
+
function makeNoticeComponent(details, expanded, outputPad) {
|
|
139294
|
+
const line = new NoticeLine2({ ...lifecycleNoticeLine(details), ...outputPad === undefined ? {} : { outputPad } }, expanded);
|
|
139330
139295
|
let cachedWidth;
|
|
139331
139296
|
let cachedLines;
|
|
139332
139297
|
return {
|
|
@@ -139789,7 +139754,7 @@ async function loadWorkflowConfig(opts = {}) {
|
|
|
139789
139754
|
}
|
|
139790
139755
|
|
|
139791
139756
|
// dist/builtin/workflows/src/extension/hil-answer-notifications.ts
|
|
139792
|
-
import { reportDebugAsync as reportDebug5, sliceHead as sliceHead21 } from "@bastani/atomic";
|
|
139757
|
+
import { NoticeLine as NoticeLine3, reportDebugAsync as reportDebug5, sliceHead as sliceHead21 } from "@bastani/atomic";
|
|
139793
139758
|
var HIL_ANSWER_NOTICE_CUSTOM_TYPE = "workflows:hil-answer-notice";
|
|
139794
139759
|
var HIL_ANSWER_SNIPPET_LIMIT = 1000;
|
|
139795
139760
|
var rendererRegisteredHosts3 = new WeakSet;
|
|
@@ -139854,11 +139819,11 @@ function registerHilAnswerNoticeRenderer(options) {
|
|
|
139854
139819
|
const host = options.rendererHost ?? register;
|
|
139855
139820
|
if (rendererRegisteredHosts3.has(host))
|
|
139856
139821
|
return;
|
|
139857
|
-
const renderer = (raw,
|
|
139822
|
+
const renderer = (raw, renderOptions) => {
|
|
139858
139823
|
const details = readHilAnswerNoticeDetails(raw);
|
|
139859
139824
|
if (details === undefined)
|
|
139860
139825
|
return;
|
|
139861
|
-
return makeNoticeComponent2(details,
|
|
139826
|
+
return makeNoticeComponent2(details, renderOptions?.expanded === true, renderOptions?.outputPad);
|
|
139862
139827
|
};
|
|
139863
139828
|
register(HIL_ANSWER_NOTICE_CUSTOM_TYPE, renderer);
|
|
139864
139829
|
rendererRegisteredHosts3.add(host);
|
|
@@ -140000,34 +139965,31 @@ function warnHilAnswerSendFailure(error) {
|
|
|
140000
139965
|
function escapeQuotedText2(value2) {
|
|
140001
139966
|
return value2.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
140002
139967
|
}
|
|
140003
|
-
function
|
|
140004
|
-
|
|
139968
|
+
function hilAnswerNoticeLine(details) {
|
|
139969
|
+
return {
|
|
139970
|
+
status: "success",
|
|
139971
|
+
label: "Workflow",
|
|
139972
|
+
subject: details.workflowName,
|
|
139973
|
+
outcome: "received the user's response",
|
|
139974
|
+
meta: [details.stageName ?? details.stageId],
|
|
139975
|
+
detail: [
|
|
139976
|
+
`run ${details.runId}`,
|
|
139977
|
+
...details.promptMessage ? [`prompt ${details.promptMessage}`] : [],
|
|
139978
|
+
`answer ${details.answerSummary}`,
|
|
139979
|
+
"No main-chat action is needed; do not answer other workflow prompts unless the user explicitly provides that answer."
|
|
139980
|
+
].join(`
|
|
139981
|
+
`)
|
|
139982
|
+
};
|
|
139983
|
+
}
|
|
139984
|
+
function makeNoticeComponent2(details, expanded, outputPad) {
|
|
139985
|
+
const line = new NoticeLine3({ ...hilAnswerNoticeLine(details), countHiddenDetail: true, ...outputPad === undefined ? {} : { outputPad } }, expanded);
|
|
140005
139986
|
return {
|
|
140006
139987
|
render(width) {
|
|
140007
|
-
return
|
|
140008
|
-
title: "HIL ANSWERED",
|
|
140009
|
-
glyph: "✓",
|
|
140010
|
-
headline: `Workflow "${details.workflowName}" received the user's response`,
|
|
140011
|
-
tone: "success",
|
|
140012
|
-
fields: [
|
|
140013
|
-
{ label: "workflow", value: details.workflowName },
|
|
140014
|
-
{ label: "run", value: details.runId },
|
|
140015
|
-
{ label: "stage", value: details.stageName ?? details.stageId },
|
|
140016
|
-
{ label: "prompt", value: details.promptMessage, tone: "muted" },
|
|
140017
|
-
{ label: "answer", value: details.answerSummary }
|
|
140018
|
-
],
|
|
140019
|
-
footer: "No main-chat action is needed; do not answer other workflow prompts unless the user explicitly provides that answer.",
|
|
140020
|
-
fallbackText: text,
|
|
140021
|
-
width,
|
|
140022
|
-
...theme ? { theme } : {}
|
|
140023
|
-
});
|
|
139988
|
+
return line.render(width);
|
|
140024
139989
|
},
|
|
140025
139990
|
invalidate() {}
|
|
140026
139991
|
};
|
|
140027
139992
|
}
|
|
140028
|
-
function themeFromRenderer(piTheme) {
|
|
140029
|
-
return piTheme === undefined ? undefined : deriveGraphThemeFromPiTheme(piTheme);
|
|
140030
|
-
}
|
|
140031
139993
|
|
|
140032
139994
|
// dist/builtin/workflows/src/extension/workflow-command-surfaces.ts
|
|
140033
139995
|
function formatWorkflowResourceLoadWarning(error) {
|
|
@@ -141158,7 +141120,7 @@ function isResumePromptTheme(theme) {
|
|
|
141158
141120
|
return typeof Reflect.get(theme, "fg") === "function";
|
|
141159
141121
|
}
|
|
141160
141122
|
function renderWorkflowDefinitionChangedPrompt(width, theme) {
|
|
141161
|
-
const fg = isResumePromptTheme(theme) &&
|
|
141123
|
+
const fg = isResumePromptTheme(theme) && !colorsOff() ? theme.fg.bind(theme) : undefined;
|
|
141162
141124
|
const pad = width > 4 ? " " : "";
|
|
141163
141125
|
const inner = Math.max(1, width - pad.length);
|
|
141164
141126
|
const hint = ` · enter ${WORKFLOW_DEFINITION_CHANGED_CONFIRM_LABEL} · esc ${WORKFLOW_DEFINITION_CHANGED_CANCEL_LABEL}`;
|
|
@@ -143589,7 +143551,7 @@ function createStatusWriter(store, config, opts = {}) {
|
|
|
143589
143551
|
}
|
|
143590
143552
|
|
|
143591
143553
|
// dist/builtin/workflows/src/extension/undelivered-stage-message-notifications.ts
|
|
143592
|
-
import { reportDebugAsync as reportDebug6, sliceHead as sliceHead24 } from "@bastani/atomic";
|
|
143554
|
+
import { NoticeLine as NoticeLine4, reportDebugAsync as reportDebug6, sliceHead as sliceHead24 } from "@bastani/atomic";
|
|
143593
143555
|
var UNDELIVERED_STAGE_MESSAGE_CUSTOM_TYPE = "workflows:undelivered-stage-message";
|
|
143594
143556
|
var SNIPPET_LIMIT = 240;
|
|
143595
143557
|
var rendererRegisteredHosts4 = new WeakSet;
|
|
@@ -143633,11 +143595,11 @@ function registerUndeliveredStageMessageRenderer(options) {
|
|
|
143633
143595
|
const host = options.rendererHost ?? register;
|
|
143634
143596
|
if (rendererRegisteredHosts4.has(host))
|
|
143635
143597
|
return;
|
|
143636
|
-
const renderer = (raw,
|
|
143598
|
+
const renderer = (raw, options) => {
|
|
143637
143599
|
const details = raw.details;
|
|
143638
143600
|
if (details === undefined)
|
|
143639
143601
|
return;
|
|
143640
|
-
return noticeComponent(details,
|
|
143602
|
+
return noticeComponent(details, options?.expanded === true, options?.outputPad);
|
|
143641
143603
|
};
|
|
143642
143604
|
register(UNDELIVERED_STAGE_MESSAGE_CUSTOM_TYPE, renderer);
|
|
143643
143605
|
rendererRegisteredHosts4.add(host);
|
|
@@ -143662,32 +143624,36 @@ function snippet(value2) {
|
|
|
143662
143624
|
const normalized = value2.replace(/\s+/g, " ").trim();
|
|
143663
143625
|
return normalized.length <= SNIPPET_LIMIT ? normalized : `${sliceHead24(normalized, SNIPPET_LIMIT - 1)}…`;
|
|
143664
143626
|
}
|
|
143665
|
-
function
|
|
143666
|
-
|
|
143627
|
+
function undeliveredStageMessageNoticeLine(details) {
|
|
143628
|
+
return {
|
|
143629
|
+
status: "warning",
|
|
143630
|
+
label: "Stage",
|
|
143631
|
+
subject: details.stageName,
|
|
143632
|
+
outcome: "finished before this message was delivered",
|
|
143633
|
+
meta: [details.workflowName],
|
|
143634
|
+
detail: [
|
|
143635
|
+
`run ${details.runId}`,
|
|
143636
|
+
`message ${snippet(details.text)}`,
|
|
143637
|
+
"Send it to another stage if it still matters."
|
|
143638
|
+
].join(`
|
|
143639
|
+
`)
|
|
143640
|
+
};
|
|
143641
|
+
}
|
|
143642
|
+
function noticeComponent(details, expanded, outputPad) {
|
|
143643
|
+
const line = new NoticeLine4({
|
|
143644
|
+
...undeliveredStageMessageNoticeLine(details),
|
|
143645
|
+
countHiddenDetail: true,
|
|
143646
|
+
...outputPad === undefined ? {} : { outputPad }
|
|
143647
|
+
}, expanded);
|
|
143667
143648
|
return {
|
|
143668
143649
|
render(width) {
|
|
143669
|
-
return
|
|
143670
|
-
title: "MESSAGE NOT DELIVERED",
|
|
143671
|
-
glyph: "✗",
|
|
143672
|
-
headline: `Stage "${details.stageName}" finished before this message was delivered`,
|
|
143673
|
-
tone: "warning",
|
|
143674
|
-
fields: [
|
|
143675
|
-
{ label: "workflow", value: details.workflowName },
|
|
143676
|
-
{ label: "run", value: details.runId },
|
|
143677
|
-
{ label: "stage", value: details.stageName },
|
|
143678
|
-
{ label: "message", value: snippet(details.text) }
|
|
143679
|
-
],
|
|
143680
|
-
footer: "Send it to another stage if it still matters.",
|
|
143681
|
-
fallbackText: formatUndeliveredStageMessageNoticeText(details),
|
|
143682
|
-
width,
|
|
143683
|
-
...theme ? { theme } : {}
|
|
143684
|
-
});
|
|
143650
|
+
return line.render(width);
|
|
143685
143651
|
},
|
|
143686
143652
|
invalidate() {}
|
|
143687
143653
|
};
|
|
143688
143654
|
}
|
|
143689
143655
|
// dist/builtin/workflows/src/extension/workflow-heartbeat-notice.ts
|
|
143690
|
-
|
|
143656
|
+
import { HeartbeatBlock } from "@bastani/atomic";
|
|
143691
143657
|
var WORKFLOW_HEARTBEAT_GLYPH = "♥";
|
|
143692
143658
|
var rendererRegisteredHosts5 = new WeakSet;
|
|
143693
143659
|
function formatWorkflowHeartbeatNoticeText(details) {
|
|
@@ -143703,42 +143669,47 @@ function registerWorkflowHeartbeatRenderer(options) {
|
|
|
143703
143669
|
const host = options.rendererHost ?? register;
|
|
143704
143670
|
if (rendererRegisteredHosts5.has(host))
|
|
143705
143671
|
return;
|
|
143706
|
-
const renderer = (raw,
|
|
143672
|
+
const renderer = (raw, renderOptions) => {
|
|
143707
143673
|
const message = raw;
|
|
143708
143674
|
if (!message.details)
|
|
143709
143675
|
return;
|
|
143710
|
-
return makeWorkflowHeartbeatComponent(message.details,
|
|
143676
|
+
return makeWorkflowHeartbeatComponent(message.details, renderOptions?.expanded === true, renderOptions?.outputPad);
|
|
143711
143677
|
};
|
|
143712
143678
|
register(WORKFLOW_HEARTBEAT_CUSTOM_TYPE, renderer);
|
|
143713
143679
|
rendererRegisteredHosts5.add(host);
|
|
143714
143680
|
}
|
|
143715
|
-
function
|
|
143716
|
-
const
|
|
143681
|
+
function workflowHeartbeatBlock(details, expanded = false, outputPad) {
|
|
143682
|
+
const elapsed = formatWorkflowHeartbeatElapsed(details);
|
|
143683
|
+
const runId = inertDisplayLine(details.runId);
|
|
143684
|
+
const name = inertDisplayLine(details.workflowName);
|
|
143685
|
+
const cadence = `${formatWorkflowHeartbeatCadence(details.intervalMinutes)} cadence`;
|
|
143686
|
+
const records = expanded ? [
|
|
143687
|
+
[
|
|
143688
|
+
{ text: `workflow ${name}`, wrap: true },
|
|
143689
|
+
{ text: `run ${runId}`, wrap: true },
|
|
143690
|
+
{ text: elapsed === undefined ? cadence : `${cadence} · running for ${elapsed}`, wrap: true }
|
|
143691
|
+
]
|
|
143692
|
+
] : [[`run ${runId} · ${cadence}`]];
|
|
143693
|
+
return new HeartbeatBlock({
|
|
143694
|
+
title: "Workflow heartbeat",
|
|
143695
|
+
subject: `${name} still running`,
|
|
143696
|
+
meta: elapsed === undefined ? [] : [elapsed],
|
|
143697
|
+
records,
|
|
143698
|
+
hint: `/workflows ${runId}`,
|
|
143699
|
+
expandable: true,
|
|
143700
|
+
expanded,
|
|
143701
|
+
...outputPad === undefined ? {} : { outputPad }
|
|
143702
|
+
});
|
|
143703
|
+
}
|
|
143704
|
+
function makeWorkflowHeartbeatComponent(details, expanded, outputPad) {
|
|
143705
|
+
const block = workflowHeartbeatBlock(details, expanded, outputPad);
|
|
143717
143706
|
return {
|
|
143718
143707
|
render(width) {
|
|
143719
|
-
return
|
|
143708
|
+
return block.render(width);
|
|
143720
143709
|
},
|
|
143721
143710
|
invalidate() {}
|
|
143722
143711
|
};
|
|
143723
143712
|
}
|
|
143724
|
-
function renderWorkflowHeartbeatCard(details, opts) {
|
|
143725
|
-
return renderWorkflowNoticeCard({
|
|
143726
|
-
title: WORKFLOW_HEARTBEAT_TITLE,
|
|
143727
|
-
glyph: WORKFLOW_HEARTBEAT_GLYPH,
|
|
143728
|
-
headline: `Workflow "${details.workflowName}" is still running`,
|
|
143729
|
-
tone: "mauve",
|
|
143730
|
-
fields: [
|
|
143731
|
-
{ label: "workflow", value: details.workflowName },
|
|
143732
|
-
{ label: "run", value: details.runId },
|
|
143733
|
-
{ label: "cadence", value: formatWorkflowHeartbeatCadence(details.intervalMinutes), tone: "muted" },
|
|
143734
|
-
{ label: "elapsed", value: formatWorkflowHeartbeatElapsed(details), tone: "muted" }
|
|
143735
|
-
],
|
|
143736
|
-
hints: [`/workflows ${details.runId}`],
|
|
143737
|
-
fallbackText: opts.fallbackText,
|
|
143738
|
-
width: opts.width,
|
|
143739
|
-
...opts.theme ? { theme: opts.theme } : {}
|
|
143740
|
-
});
|
|
143741
|
-
}
|
|
143742
143713
|
function formatWorkflowHeartbeatCadence(intervalMinutes) {
|
|
143743
143714
|
return `${intervalMinutes}-minute`;
|
|
143744
143715
|
}
|
|
@@ -143758,9 +143729,6 @@ function formatWorkflowHeartbeatElapsed(details) {
|
|
|
143758
143729
|
function escapeQuotedText3(value2) {
|
|
143759
143730
|
return value2.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
143760
143731
|
}
|
|
143761
|
-
function themeFromRenderer2(piTheme) {
|
|
143762
|
-
return piTheme === undefined ? undefined : deriveGraphThemeFromPiTheme(piTheme);
|
|
143763
|
-
}
|
|
143764
143732
|
|
|
143765
143733
|
// dist/builtin/workflows/src/extension/workflow-heartbeat-scheduler.ts
|
|
143766
143734
|
init_workflow_heartbeat_anchor();
|
|
@@ -145343,7 +145311,6 @@ import { getDocsPath, keyHintIfBound, ToolBlock, ToolBlockMarkdown } from "@bast
|
|
|
145343
145311
|
// dist/builtin/workflows/src/tui/workflows-listing.ts
|
|
145344
145312
|
import {
|
|
145345
145313
|
navEntryKeys as navEntryKeys3,
|
|
145346
|
-
PLAIN_SELECTOR_STYLE,
|
|
145347
145314
|
renderNavHintLine as renderNavHintLine2,
|
|
145348
145315
|
SelectorState,
|
|
145349
145316
|
selectorHintEntries,
|
|
@@ -146441,8 +146408,7 @@ function renderCompactListing(state, runs, search, style, width, previewOpen, pr
|
|
|
146441
146408
|
return lines.map((line) => truncateToWidth(line, width));
|
|
146442
146409
|
}
|
|
146443
146410
|
function listingStyle() {
|
|
146444
|
-
|
|
146445
|
-
return process.env.NO_COLOR === undefined ? themed : { ...PLAIN_SELECTOR_STYLE, bold: themed.bold };
|
|
146411
|
+
return themeSelectorStyle();
|
|
146446
146412
|
}
|
|
146447
146413
|
function openWorkflowsListing(ui, source) {
|
|
146448
146414
|
return new Promise((resolve) => {
|