@bastani/atomic 0.9.16-alpha.7 → 0.9.16-alpha.9
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 +25 -0
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/README.md +4 -4
- package/dist/builtin/intercom/broker/broker.ts +617 -22
- package/dist/builtin/intercom/broker/client-message-validation.ts +9 -0
- package/dist/builtin/intercom/broker/client.ts +200 -10
- package/dist/builtin/intercom/broker/pending-send-registry.ts +4 -0
- package/dist/builtin/intercom/broker/send-handler.ts +90 -36
- package/dist/builtin/intercom/broker/send-signature.ts +20 -8
- package/dist/builtin/intercom/group.ts +85 -0
- package/dist/builtin/intercom/index.bundle.mjs +746 -55
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/session-target.ts +54 -0
- package/dist/builtin/intercom/skills/intercom/SKILL.md +18 -3
- package/dist/builtin/intercom/source-ownership.ts +31 -0
- package/dist/builtin/intercom/types.ts +115 -0
- package/dist/builtin/mcp/index.bundle.mjs +175 -37
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +239 -53
- package/dist/builtin/web-access/index.bundle.mjs +175 -37
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +15 -0
- package/dist/builtin/workflows/README.md +40 -37
- package/dist/builtin/workflows/builtin/adversarial-verification.js +13 -0
- package/dist/builtin/workflows/builtin/{shared-prompts.ts → chunk-0x6e303p.js} +133 -154
- package/dist/builtin/workflows/builtin/chunk-17zk6ffd.js +69794 -0
- package/dist/builtin/workflows/builtin/chunk-29wrp38a.js +199 -0
- package/dist/builtin/workflows/builtin/chunk-2dqb5s2q.js +602 -0
- package/dist/builtin/workflows/builtin/chunk-4febxsv4.js +264 -0
- package/dist/builtin/workflows/builtin/chunk-5wgwscd0.js +4 -0
- package/dist/builtin/workflows/builtin/chunk-6fqs7c01.js +155 -0
- package/dist/builtin/workflows/builtin/chunk-7430zyas.js +126 -0
- package/dist/builtin/workflows/builtin/chunk-7at6dnkr.js +33 -0
- package/dist/builtin/workflows/builtin/chunk-82ha8p41.js +175 -0
- package/dist/builtin/workflows/builtin/chunk-8v8wmb7z.js +529 -0
- package/dist/builtin/workflows/builtin/chunk-bfkmzv9h.js +156 -0
- package/dist/builtin/workflows/builtin/chunk-c53y8bdh.js +345 -0
- package/dist/builtin/workflows/builtin/chunk-cg9tmks0.js +206 -0
- package/dist/builtin/workflows/builtin/chunk-h5e65g7g.js +1080 -0
- package/dist/builtin/workflows/builtin/chunk-hzzn6adg.js +221 -0
- package/dist/builtin/workflows/builtin/chunk-nqr34qp3.js +1061 -0
- package/dist/builtin/workflows/builtin/chunk-qe6bfpbd.js +1207 -0
- package/dist/builtin/workflows/builtin/chunk-qwzvgxnq.js +404 -0
- package/dist/builtin/workflows/builtin/chunk-qx2ptjs3.js +215 -0
- package/dist/builtin/workflows/builtin/chunk-rbnj9621.js +2447 -0
- package/dist/builtin/workflows/builtin/chunk-wpckd35c.js +12 -0
- package/dist/builtin/workflows/builtin/chunk-x2ghn0je.js +4110 -0
- package/dist/builtin/workflows/builtin/classify-and-act.js +12 -0
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +10 -0
- package/dist/builtin/workflows/builtin/generate-and-filter.js +12 -0
- package/dist/builtin/workflows/builtin/goal.js +16 -0
- package/dist/builtin/workflows/builtin/index.js +49 -0
- package/dist/builtin/workflows/builtin/loop-until-done.js +12 -0
- package/dist/builtin/workflows/builtin/open-claude-design.js +11 -0
- package/dist/builtin/workflows/builtin/ralph.js +16 -0
- package/dist/builtin/workflows/builtin/steering-context.d.ts +6 -0
- package/dist/builtin/workflows/builtin/steering-context.js +7 -0
- package/dist/builtin/workflows/builtin/tournament.js +13 -0
- package/dist/builtin/workflows/package.json +10 -7
- package/dist/builtin/workflows/src/authoring/typebox-defaults.d.ts +41 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +1294 -430
- package/dist/builtin/workflows/src/{index.bundle.mjs → index.js} +1022 -429
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +403 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +327 -0
- package/dist/builtin/workflows/src/shared/budget.d.ts +67 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +60 -0
- package/dist/builtin/workflows/src/shared/workflow-heartbeat-contract.d.ts +21 -0
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +12 -5
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +2 -0
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +2 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +4 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/builtin-install-layout.d.ts +1 -1
- package/dist/core/builtin-install-layout.d.ts.map +1 -1
- package/dist/core/builtin-install-layout.js +1 -1
- package/dist/core/builtin-install-layout.js.map +1 -1
- package/dist/core/codex-fast-mode.d.ts +10 -7
- package/dist/core/codex-fast-mode.d.ts.map +1 -1
- package/dist/core/codex-fast-mode.js +31 -13
- package/dist/core/codex-fast-mode.js.map +1 -1
- package/dist/core/extensions/agent-events.d.ts +15 -0
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +3 -1
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +35 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/event-types.d.ts +2 -2
- package/dist/core/extensions/event-types.d.ts.map +1 -1
- package/dist/core/extensions/event-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +6 -1
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +6 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +65 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/model-runtime.d.ts +2 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +4 -0
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +1 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +8 -0
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +5 -5
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-storage.d.ts +2 -0
- package/dist/core/session-manager-storage.d.ts.map +1 -1
- package/dist/core/session-manager-storage.js +4 -2
- package/dist/core/session-manager-storage.js.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +6 -1
- package/dist/core/workflow-stage-admission.d.ts.map +1 -1
- package/dist/core/workflow-stage-admission.js +8 -9
- package/dist/core/workflow-stage-admission.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +1 -1
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +4 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +69 -10
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +18 -2
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-api.js +33 -5
- package/dist/modes/rpc/rpc-client-api.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +8 -4
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +13 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/extensions.md +19 -0
- package/docs/intercom.md +15 -6
- package/docs/packages.md +2 -2
- package/docs/providers.md +8 -3
- package/docs/quickstart.md +2 -2
- package/docs/rpc.md +21 -4
- package/docs/settings.md +6 -4
- package/docs/subagents.md +1 -1
- package/docs/usage.md +1 -1
- package/docs/workflows.md +108 -239
- package/npm-shrinkwrap.json +32 -32
- package/package.json +9 -13
- package/dist/builtin/workflows/ambient.d.ts +0 -61
- package/dist/builtin/workflows/builtin/adversarial-verification-prompts.ts +0 -26
- package/dist/builtin/workflows/builtin/adversarial-verification-runner.ts +0 -391
- package/dist/builtin/workflows/builtin/adversarial-verification.ts +0 -34
- package/dist/builtin/workflows/builtin/classify-and-act-prompts.ts +0 -14
- package/dist/builtin/workflows/builtin/classify-and-act-runner.ts +0 -108
- package/dist/builtin/workflows/builtin/classify-and-act.ts +0 -40
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize-prompts.ts +0 -14
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize-runner.ts +0 -96
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.ts +0 -37
- package/dist/builtin/workflows/builtin/generate-and-filter-prompts.ts +0 -41
- package/dist/builtin/workflows/builtin/generate-and-filter-runner.ts +0 -90
- package/dist/builtin/workflows/builtin/generate-and-filter.ts +0 -31
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +0 -64
- package/dist/builtin/workflows/builtin/goal-convergence.ts +0 -87
- package/dist/builtin/workflows/builtin/goal-ledger.ts +0 -139
- package/dist/builtin/workflows/builtin/goal-models.ts +0 -72
- package/dist/builtin/workflows/builtin/goal-orchestrator-prompts.ts +0 -94
- package/dist/builtin/workflows/builtin/goal-prompts.ts +0 -217
- package/dist/builtin/workflows/builtin/goal-reducer.ts +0 -176
- package/dist/builtin/workflows/builtin/goal-reports.ts +0 -76
- package/dist/builtin/workflows/builtin/goal-reverify.ts +0 -305
- package/dist/builtin/workflows/builtin/goal-review.ts +0 -139
- package/dist/builtin/workflows/builtin/goal-runner.ts +0 -504
- package/dist/builtin/workflows/builtin/goal-schemas.ts +0 -89
- package/dist/builtin/workflows/builtin/goal-types.ts +0 -164
- package/dist/builtin/workflows/builtin/goal.ts +0 -78
- package/dist/builtin/workflows/builtin/index.ts +0 -16
- package/dist/builtin/workflows/builtin/loop-until-done-prompts.ts +0 -87
- package/dist/builtin/workflows/builtin/loop-until-done-runner.ts +0 -282
- package/dist/builtin/workflows/builtin/loop-until-done.ts +0 -51
- package/dist/builtin/workflows/builtin/open-claude-design-live-protocol.ts +0 -305
- package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +0 -337
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +0 -347
- package/dist/builtin/workflows/builtin/open-claude-design-setup.ts +0 -313
- package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +0 -311
- package/dist/builtin/workflows/builtin/open-claude-design.ts +0 -57
- package/dist/builtin/workflows/builtin/pattern-artifact-root.ts +0 -28
- package/dist/builtin/workflows/builtin/progress-scoring.ts +0 -230
- package/dist/builtin/workflows/builtin/ralph-core.ts +0 -449
- package/dist/builtin/workflows/builtin/ralph-forked-prompts.ts +0 -100
- package/dist/builtin/workflows/builtin/ralph-models.ts +0 -183
- package/dist/builtin/workflows/builtin/ralph-review-gate.ts +0 -103
- package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +0 -104
- package/dist/builtin/workflows/builtin/ralph-runner.ts +0 -459
- package/dist/builtin/workflows/builtin/ralph.ts +0 -82
- package/dist/builtin/workflows/builtin/review-convergence.ts +0 -229
- package/dist/builtin/workflows/builtin/selection-math.ts +0 -156
- package/dist/builtin/workflows/builtin/steering-context.ts +0 -51
- package/dist/builtin/workflows/builtin/tournament-prompts.ts +0 -70
- package/dist/builtin/workflows/builtin/tournament-runner.ts +0 -400
- package/dist/builtin/workflows/builtin/tournament.ts +0 -73
- package/dist/builtin/workflows/builtin/verification-criteria.ts +0 -330
- package/dist/builtin/workflows/builtin/verification-prompts.ts +0 -206
- package/dist/builtin/workflows/builtin/verification-usage.ts +0 -44
|
@@ -3854,10 +3854,10 @@ function hasAssistantMessage(entries) {
|
|
|
3854
3854
|
return entries.some((entry) => entry.type === "message" && entry.message.role === "assistant");
|
|
3855
3855
|
}
|
|
3856
3856
|
function persistAppendedEntry(filePath, entries, entry, flushed) {
|
|
3857
|
-
if (!hasAssistantMessage(entries))
|
|
3858
|
-
return false;
|
|
3859
3857
|
if (flushed)
|
|
3860
3858
|
appendSessionEntry(filePath, entry);
|
|
3859
|
+
else if (!hasAssistantMessage(entries))
|
|
3860
|
+
return false;
|
|
3861
3861
|
else
|
|
3862
3862
|
appendSessionEntries(filePath, entries);
|
|
3863
3863
|
return true;
|
|
@@ -9925,6 +9925,8 @@ function appendDurableDisplayCard(session, message, delivery) {
|
|
|
9925
9925
|
const card = { ...message, excludeFromContext: true };
|
|
9926
9926
|
const admitted = message;
|
|
9927
9927
|
const intentEntryId = session.sessionManager.appendCustomMessageEntry(card.customType, card.content, card.display, card.details, true, { delivery }, admitted.stageAdmissionKey);
|
|
9928
|
+
if (admitted.stageAdmissionKey !== undefined)
|
|
9929
|
+
session.sessionManager.flush();
|
|
9928
9930
|
session.agent.state.messages.push(card);
|
|
9929
9931
|
return { card, intentEntryId };
|
|
9930
9932
|
}
|
|
@@ -10150,12 +10152,17 @@ var init_agent_session_persistent_custom_messages = __esm(() => {
|
|
|
10150
10152
|
});
|
|
10151
10153
|
|
|
10152
10154
|
// src/core/agent-session-custom-message-commit.ts
|
|
10155
|
+
function appendDurableStageAdmission(session, message) {
|
|
10156
|
+
session._appendCustomMessage(message);
|
|
10157
|
+
if (message.stageAdmissionKey !== undefined)
|
|
10158
|
+
session.sessionManager?.flush();
|
|
10159
|
+
}
|
|
10153
10160
|
async function commitAdmittedCustomMessage(session, appMessage, options) {
|
|
10154
10161
|
const owner = resolveWorkflowStageDeliveryTarget(session);
|
|
10155
10162
|
if (owner !== session)
|
|
10156
10163
|
return commitAdmittedCustomMessage(owner, appMessage, options);
|
|
10157
10164
|
const self = session;
|
|
10158
|
-
const useProtectedReconciliation = options?.persistWhenStreaming === true && options.triggerTurn === true
|
|
10165
|
+
const useProtectedReconciliation = options?.persistWhenStreaming === true && options.excludeFromContext !== true && (options.triggerTurn === true || options.stageAdmissionKey !== undefined);
|
|
10159
10166
|
if (options?.deliverAs === "nextTurn") {
|
|
10160
10167
|
self._pendingNextTurnMessages.push(appMessage);
|
|
10161
10168
|
} else if (self._queuedMessagesPaused) {
|
|
@@ -10169,20 +10176,20 @@ async function commitAdmittedCustomMessage(session, appMessage, options) {
|
|
|
10169
10176
|
} else if (self.isStreaming) {
|
|
10170
10177
|
self._pendingCustomMessages.push(appMessage);
|
|
10171
10178
|
} else {
|
|
10172
|
-
self
|
|
10179
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10173
10180
|
}
|
|
10174
10181
|
} else if (options?.deliverAs === "interrupt" && options.triggerTurn) {
|
|
10175
10182
|
const interrupt = self._enqueueInterruptCustomMessage(appMessage, options);
|
|
10176
10183
|
self._workflowStageAdmission?.trackAdmittedWork(interrupt);
|
|
10177
10184
|
interrupt.catch(() => {});
|
|
10178
10185
|
} else if (self.isStreaming && options?.excludeFromContext === true && options.triggerTurn !== true && options.deliverAs === undefined) {
|
|
10179
|
-
self
|
|
10186
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10180
10187
|
} else if (self.isStreaming && options?.triggerTurn === false) {
|
|
10181
10188
|
self._pendingCustomMessages.push(appMessage);
|
|
10182
10189
|
} else if (self.isStreaming && useProtectedReconciliation) {
|
|
10183
10190
|
await queueProtectedStreamingCustomMessage(self, appMessage, options?.deliverAs === "followUp" ? "followUp" : "steer");
|
|
10184
10191
|
} else if (self.isStreaming && options?.persistWhenStreaming === true) {
|
|
10185
|
-
self
|
|
10192
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10186
10193
|
} else if (self.isStreaming && options?.triggerTurn !== false) {
|
|
10187
10194
|
self._queueAgentMessage(appMessage, options?.deliverAs === "followUp" ? "followUp" : "steer");
|
|
10188
10195
|
} else if (options?.triggerTurn) {
|
|
@@ -10205,7 +10212,7 @@ async function commitAdmittedCustomMessage(session, appMessage, options) {
|
|
|
10205
10212
|
self._continueQueuedAgentMessages().catch(() => {});
|
|
10206
10213
|
}
|
|
10207
10214
|
} else {
|
|
10208
|
-
self
|
|
10215
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10209
10216
|
}
|
|
10210
10217
|
}
|
|
10211
10218
|
function _commitAdmittedCustomMessage(appMessage, options) {
|
|
@@ -12229,6 +12236,8 @@ class ExtensionRunner {
|
|
|
12229
12236
|
shortcutDiagnostics = [];
|
|
12230
12237
|
commandDiagnostics = [];
|
|
12231
12238
|
staleMessage;
|
|
12239
|
+
uiPromptBinding = 0;
|
|
12240
|
+
activeUIPrompt;
|
|
12232
12241
|
constructor(extensions, runtime, cwd, sessionManager, modelRegistry, orchestrationContext, subagentPolicy) {
|
|
12233
12242
|
this.extensions = extensions;
|
|
12234
12243
|
this.runtime = runtime;
|
|
@@ -12323,9 +12332,71 @@ class ExtensionRunner {
|
|
|
12323
12332
|
this.reloadHandler = async () => {};
|
|
12324
12333
|
}
|
|
12325
12334
|
setUIContext(uiContext, mode = "print") {
|
|
12326
|
-
this.
|
|
12335
|
+
this.endActiveUIPrompt();
|
|
12336
|
+
const binding = ++this.uiPromptBinding;
|
|
12337
|
+
this.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;
|
|
12327
12338
|
this.mode = mode;
|
|
12328
12339
|
}
|
|
12340
|
+
wrapUIPromptContext(ui, binding) {
|
|
12341
|
+
return {
|
|
12342
|
+
...ui,
|
|
12343
|
+
select: (title, options, opts) => this.withUIPrompt(binding, "select", title, () => ui.select(title, options, opts)),
|
|
12344
|
+
confirm: (title, message, opts) => this.withUIPrompt(binding, "confirm", title, () => ui.confirm(title, message, opts)),
|
|
12345
|
+
input: (title, placeholder, opts) => this.withUIPrompt(binding, "input", title, () => ui.input(title, placeholder, opts)),
|
|
12346
|
+
editor: (title, prefill, opts) => this.withUIPrompt(binding, "editor", title, () => ui.editor(title, prefill, opts)),
|
|
12347
|
+
custom: (factory, options) => this.withUIPrompt(binding, "custom", undefined, () => ui.custom(factory, options))
|
|
12348
|
+
};
|
|
12349
|
+
}
|
|
12350
|
+
withUIPrompt(binding, kind, title, run) {
|
|
12351
|
+
if (binding !== this.uiPromptBinding)
|
|
12352
|
+
return run();
|
|
12353
|
+
let prompt = this.activeUIPrompt;
|
|
12354
|
+
if (!prompt) {
|
|
12355
|
+
prompt = { depth: 0, kind, title };
|
|
12356
|
+
this.activeUIPrompt = prompt;
|
|
12357
|
+
this.emitUIPromptEvent({
|
|
12358
|
+
type: "ui_prompt_start",
|
|
12359
|
+
reason: "ui_prompt",
|
|
12360
|
+
kind,
|
|
12361
|
+
...title === undefined ? {} : { title }
|
|
12362
|
+
});
|
|
12363
|
+
}
|
|
12364
|
+
prompt.depth += 1;
|
|
12365
|
+
let finished = false;
|
|
12366
|
+
const finish = () => {
|
|
12367
|
+
if (finished)
|
|
12368
|
+
return;
|
|
12369
|
+
finished = true;
|
|
12370
|
+
if (this.activeUIPrompt !== prompt)
|
|
12371
|
+
return;
|
|
12372
|
+
prompt.depth -= 1;
|
|
12373
|
+
if (prompt.depth === 0)
|
|
12374
|
+
this.endActiveUIPrompt(prompt);
|
|
12375
|
+
};
|
|
12376
|
+
try {
|
|
12377
|
+
return run().finally(finish);
|
|
12378
|
+
} catch (error) {
|
|
12379
|
+
finish();
|
|
12380
|
+
throw error;
|
|
12381
|
+
}
|
|
12382
|
+
}
|
|
12383
|
+
endActiveUIPrompt(prompt = this.activeUIPrompt) {
|
|
12384
|
+
if (!prompt || this.activeUIPrompt !== prompt)
|
|
12385
|
+
return;
|
|
12386
|
+
this.activeUIPrompt = undefined;
|
|
12387
|
+
prompt.depth = 0;
|
|
12388
|
+
this.emitUIPromptEvent({
|
|
12389
|
+
type: "ui_prompt_end",
|
|
12390
|
+
reason: "ui_prompt",
|
|
12391
|
+
kind: prompt.kind,
|
|
12392
|
+
...prompt.title === undefined ? {} : { title: prompt.title }
|
|
12393
|
+
});
|
|
12394
|
+
}
|
|
12395
|
+
emitUIPromptEvent(event) {
|
|
12396
|
+
queueMicrotask(() => {
|
|
12397
|
+
this.emit(event);
|
|
12398
|
+
});
|
|
12399
|
+
}
|
|
12329
12400
|
getUIContext() {
|
|
12330
12401
|
return this.uiContext;
|
|
12331
12402
|
}
|
|
@@ -21607,11 +21678,20 @@ import {
|
|
|
21607
21678
|
function isCodexFastModeSupportedProvider(provider) {
|
|
21608
21679
|
return provider === "openai" || provider === "openai-codex";
|
|
21609
21680
|
}
|
|
21610
|
-
function
|
|
21611
|
-
return
|
|
21681
|
+
function isGitHubCopilotModel(model) {
|
|
21682
|
+
return model.provider === "github-copilot";
|
|
21683
|
+
}
|
|
21684
|
+
function isGitHubCopilotFastModeSupportedModel(model, credential) {
|
|
21685
|
+
if (!isGitHubCopilotModel(model) || credential?.type !== "oauth")
|
|
21686
|
+
return false;
|
|
21687
|
+
const fastModelIds = credential.fastModelIds;
|
|
21688
|
+
return Array.isArray(fastModelIds) && fastModelIds.every((modelId) => typeof modelId === "string") && fastModelIds.includes(`${model.id}-fast`);
|
|
21689
|
+
}
|
|
21690
|
+
function isCodexFastModeSupportedModel(model, copilotCredential) {
|
|
21691
|
+
return isCodexFastModeSupportedProvider(model.provider) || model.api === "openai-codex-responses" || model.id !== undefined && isGitHubCopilotFastModeSupportedModel({ provider: model.provider, id: model.id }, copilotCredential);
|
|
21612
21692
|
}
|
|
21613
|
-
function hasSupportedCodexFastModeModel(models) {
|
|
21614
|
-
return models.some(isCodexFastModeSupportedModel);
|
|
21693
|
+
function hasSupportedCodexFastModeModel(models, copilotCredential) {
|
|
21694
|
+
return models.some((model) => isCodexFastModeSupportedModel(model, copilotCredential));
|
|
21615
21695
|
}
|
|
21616
21696
|
function isWorkflowStageOrchestrationContext(context) {
|
|
21617
21697
|
return context?.kind === "workflow-stage";
|
|
@@ -21622,11 +21702,11 @@ function getCodexFastModeScope(context) {
|
|
|
21622
21702
|
function isCodexFastModeEnabledForScope(settings, scope) {
|
|
21623
21703
|
return settings[scope];
|
|
21624
21704
|
}
|
|
21625
|
-
function shouldApplyCodexFastModeForScope(model, settings, scope) {
|
|
21626
|
-
return isCodexFastModeSupportedModel(model) && isCodexFastModeEnabledForScope(settings, scope);
|
|
21705
|
+
function shouldApplyCodexFastModeForScope(model, settings, scope, copilotCredential) {
|
|
21706
|
+
return isCodexFastModeSupportedModel(model, copilotCredential) && isCodexFastModeEnabledForScope(settings, scope);
|
|
21627
21707
|
}
|
|
21628
|
-
function shouldApplyCodexFastMode(model, settings, context) {
|
|
21629
|
-
return shouldApplyCodexFastModeForScope(model, settings, getCodexFastModeScope(context));
|
|
21708
|
+
function shouldApplyCodexFastMode(model, settings, context, copilotCredential) {
|
|
21709
|
+
return shouldApplyCodexFastModeForScope(model, settings, getCodexFastModeScope(context), copilotCredential);
|
|
21630
21710
|
}
|
|
21631
21711
|
function formatCodexFastModeModelLabel(modelName, enabled) {
|
|
21632
21712
|
return enabled ? `${modelName} fast` : modelName;
|
|
@@ -21767,7 +21847,7 @@ class FooterComponent {
|
|
|
21767
21847
|
pwd += ` • ${sessionName}`;
|
|
21768
21848
|
const modelName = state.model?.id || "no-model";
|
|
21769
21849
|
const fastModeSettings = this.session.settingsManager.getCodexFastModeSettings();
|
|
21770
|
-
const fastModeEnabled = state.model ? shouldApplyCodexFastMode(state.model, fastModeSettings, this.session.orchestrationContext) : false;
|
|
21850
|
+
const fastModeEnabled = state.model ? shouldApplyCodexFastMode(state.model, fastModeSettings, this.session.orchestrationContext, this.session.modelRuntime.getCredentialSnapshot?.("github-copilot")) : false;
|
|
21771
21851
|
let modelLabel2 = modelName;
|
|
21772
21852
|
if (state.model?.reasoning) {
|
|
21773
21853
|
const thinkingLevel = state.thinkingLevel || "off";
|
|
@@ -39355,14 +39435,18 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
39355
39435
|
|
|
39356
39436
|
class WorkflowStageAdmissionBoundary {
|
|
39357
39437
|
open = true;
|
|
39358
|
-
completed
|
|
39438
|
+
completed;
|
|
39359
39439
|
inFlight = new Map;
|
|
39360
39440
|
pending = new Set;
|
|
39361
39441
|
invocationContext = new AsyncLocalStorage;
|
|
39362
39442
|
closePromise;
|
|
39363
39443
|
drainAdmittedWork;
|
|
39364
|
-
constructor(drainAdmittedWork =
|
|
39365
|
-
this.drainAdmittedWork = drainAdmittedWork;
|
|
39444
|
+
constructor(drainAdmittedWork = undefined, completedKeys = []) {
|
|
39445
|
+
this.drainAdmittedWork = drainAdmittedWork ?? (async () => {});
|
|
39446
|
+
this.completed = new Set(completedKeys);
|
|
39447
|
+
}
|
|
39448
|
+
static restore(entries, drainAdmittedWork) {
|
|
39449
|
+
return new WorkflowStageAdmissionBoundary(drainAdmittedWork, Array.from(entries).flatMap((entry) => entry.type === "custom_message" && typeof entry.stageAdmissionKey === "string" ? [entry.stageAdmissionKey] : []));
|
|
39366
39450
|
}
|
|
39367
39451
|
admit(key, deliver, routeLate) {
|
|
39368
39452
|
if (key !== undefined) {
|
|
@@ -39601,7 +39685,7 @@ class AgentSessionBase {
|
|
|
39601
39685
|
this._subagentPolicy = config.subagentPolicy;
|
|
39602
39686
|
this._systemPromptTransform = config.systemPromptTransform;
|
|
39603
39687
|
const stageContext = config.orchestrationContext?.kind === "workflow-stage" ? config.orchestrationContext : undefined;
|
|
39604
|
-
this._workflowStageAdmission = stageContext?.messageAdmission?.boundary ?? (stageContext ?
|
|
39688
|
+
this._workflowStageAdmission = stageContext?.messageAdmission?.boundary ?? (stageContext ? WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch()) : undefined);
|
|
39605
39689
|
if (this._workflowStageAdmission && stageContext && stageContext.messageAdmission === undefined) {
|
|
39606
39690
|
stageContext.messageAdmission = {
|
|
39607
39691
|
boundary: this._workflowStageAdmission,
|
|
@@ -46699,6 +46783,31 @@ class RemoteQueuePause {
|
|
|
46699
46783
|
var init_remote_queue_pause = () => {};
|
|
46700
46784
|
|
|
46701
46785
|
// src/modes/interactive-engine/isolated-runtime.ts
|
|
46786
|
+
import { clampThinkingLevel as clampThinkingLevel5 } from "@bastani/pi-ai/compat";
|
|
46787
|
+
function applyPersistedModelDefault(session, model, alreadyInScope) {
|
|
46788
|
+
session.settingsManager.setDefaultModelAndProvider(model.provider, model.id);
|
|
46789
|
+
if (alreadyInScope || session.scopedModels.length === 0)
|
|
46790
|
+
return;
|
|
46791
|
+
const enabledModels = session.settingsManager.getEnabledModels();
|
|
46792
|
+
if (!enabledModels?.length)
|
|
46793
|
+
return;
|
|
46794
|
+
const modelReference = `${model.provider}/${model.id}`;
|
|
46795
|
+
if (enabledModels.some((pattern) => pattern.toLowerCase() === modelReference.toLowerCase()))
|
|
46796
|
+
return;
|
|
46797
|
+
session.settingsManager.setEnabledModels([...enabledModels, modelReference]);
|
|
46798
|
+
}
|
|
46799
|
+
function thinkingPersistTarget(result) {
|
|
46800
|
+
if (!result.provider || !result.modelId)
|
|
46801
|
+
return;
|
|
46802
|
+
return { provider: result.provider, modelId: result.modelId };
|
|
46803
|
+
}
|
|
46804
|
+
function applyPersistedThinkingDefault(session, level, target) {
|
|
46805
|
+
if (target) {
|
|
46806
|
+
session.settingsManager.setModelThinkingLevel(target.provider, target.modelId, level);
|
|
46807
|
+
return;
|
|
46808
|
+
}
|
|
46809
|
+
session.settingsManager.setDefaultThinkingLevel(level);
|
|
46810
|
+
}
|
|
46702
46811
|
var IsolatedInteractiveRuntime;
|
|
46703
46812
|
var init_isolated_runtime = __esm(() => {
|
|
46704
46813
|
init_agent_session_runtime();
|
|
@@ -46717,6 +46826,7 @@ var init_isolated_runtime = __esm(() => {
|
|
|
46717
46826
|
steeringMessages = [];
|
|
46718
46827
|
followUpMessages = [];
|
|
46719
46828
|
queueUpdateGeneration = 0;
|
|
46829
|
+
thinkingEpoch = 0;
|
|
46720
46830
|
pendingQueueClear;
|
|
46721
46831
|
engineCallbackActive = false;
|
|
46722
46832
|
queuePause;
|
|
@@ -47081,43 +47191,56 @@ var init_isolated_runtime = __esm(() => {
|
|
|
47081
47191
|
},
|
|
47082
47192
|
setModel: {
|
|
47083
47193
|
configurable: true,
|
|
47084
|
-
value: async (model) => {
|
|
47085
|
-
const selected = await this.client.setModel(model.provider, model.id);
|
|
47086
|
-
|
|
47194
|
+
value: async (model, options) => {
|
|
47195
|
+
const selected = await this.client.setModel(model.provider, model.id, options);
|
|
47196
|
+
const nextModel = session.modelRuntime.getModel(selected.provider, selected.id) ?? model;
|
|
47197
|
+
session.agent.state.model = nextModel;
|
|
47087
47198
|
this.resolveModelFallback();
|
|
47199
|
+
if (options?.persist === true)
|
|
47200
|
+
await this.syncPersistedModelCatalog(session, nextModel);
|
|
47088
47201
|
}
|
|
47089
47202
|
},
|
|
47090
47203
|
setThinkingLevel: {
|
|
47091
47204
|
configurable: true,
|
|
47092
|
-
value: (level) => {
|
|
47093
|
-
|
|
47094
|
-
|
|
47205
|
+
value: (level, options) => {
|
|
47206
|
+
const availableLevels = session.getAvailableThinkingLevels();
|
|
47207
|
+
const effectiveLevel = availableLevels.includes(level) ? level : session.model ? clampThinkingLevel5(session.model, level) : "off";
|
|
47208
|
+
session.agent.state.thinkingLevel = effectiveLevel;
|
|
47209
|
+
const epoch = ++this.thinkingEpoch;
|
|
47210
|
+
this.dispatchBestEffort("set thinking level", this.client.setThinkingLevelAck(level, options).then((result) => {
|
|
47211
|
+
this.applyThinkingAck(session, epoch, result, options?.persist === true);
|
|
47212
|
+
}));
|
|
47095
47213
|
}
|
|
47096
47214
|
},
|
|
47097
47215
|
cycleModel: {
|
|
47098
47216
|
configurable: true,
|
|
47099
|
-
value: async (direction) => {
|
|
47217
|
+
value: async (direction, options) => {
|
|
47100
47218
|
const previousModel = session.model;
|
|
47101
|
-
const result = await this.client.cycleModel(direction);
|
|
47219
|
+
const result = await this.client.cycleModel(direction, options);
|
|
47102
47220
|
if (!result)
|
|
47103
47221
|
return;
|
|
47104
47222
|
const model = session.modelRuntime.getModel(result.model.provider, result.model.id) ?? result.model;
|
|
47105
47223
|
session.agent.state.model = model;
|
|
47106
47224
|
session.agent.state.thinkingLevel = result.thinkingLevel;
|
|
47107
47225
|
this.resolveModelFallbackAfterExplicitModelSelection(previousModel, model);
|
|
47226
|
+
if (options?.persist === true)
|
|
47227
|
+
await this.syncPersistedModelCatalog(session, model);
|
|
47108
47228
|
return { ...result, model };
|
|
47109
47229
|
}
|
|
47110
47230
|
},
|
|
47111
47231
|
cycleThinkingLevel: {
|
|
47112
47232
|
configurable: true,
|
|
47113
|
-
value: () => {
|
|
47233
|
+
value: (options) => {
|
|
47114
47234
|
const levels = session.getAvailableThinkingLevels();
|
|
47115
47235
|
if (levels.length <= 1)
|
|
47116
47236
|
return;
|
|
47117
47237
|
const current = levels.indexOf(session.thinkingLevel);
|
|
47118
47238
|
const level = levels[(current + 1) % levels.length];
|
|
47119
47239
|
session.agent.state.thinkingLevel = level;
|
|
47120
|
-
|
|
47240
|
+
const epoch = ++this.thinkingEpoch;
|
|
47241
|
+
this.dispatchBestEffort("cycle thinking level", this.client.setThinkingLevelAck(level, options).then((result) => {
|
|
47242
|
+
this.applyThinkingAck(session, epoch, result, options?.persist === true);
|
|
47243
|
+
}));
|
|
47121
47244
|
return level;
|
|
47122
47245
|
}
|
|
47123
47246
|
},
|
|
@@ -47161,6 +47284,14 @@ var init_isolated_runtime = __esm(() => {
|
|
|
47161
47284
|
this.engineCallbackActive = false;
|
|
47162
47285
|
}
|
|
47163
47286
|
}
|
|
47287
|
+
applyThinkingAck(session, epoch, result, persist) {
|
|
47288
|
+
if (persist) {
|
|
47289
|
+
applyPersistedThinkingDefault(session, result.level, thinkingPersistTarget(result));
|
|
47290
|
+
}
|
|
47291
|
+
if (epoch === this.thinkingEpoch) {
|
|
47292
|
+
session.agent.state.thinkingLevel = result.level;
|
|
47293
|
+
}
|
|
47294
|
+
}
|
|
47164
47295
|
dispatchBestEffort(label, operation) {
|
|
47165
47296
|
operation.catch((error) => {
|
|
47166
47297
|
if (this.health.isRecovering())
|
|
@@ -47201,6 +47332,12 @@ var init_isolated_runtime = __esm(() => {
|
|
|
47201
47332
|
}
|
|
47202
47333
|
});
|
|
47203
47334
|
}
|
|
47335
|
+
async syncPersistedModelCatalog(session, model) {
|
|
47336
|
+
const alreadyInScope = session.scopedModels.some((scoped) => scoped.model.provider === model.provider && scoped.model.id === model.id);
|
|
47337
|
+
const catalog = await this.client.requestInternal({ type: "get_available_models" });
|
|
47338
|
+
this.remoteModelCatalog.apply(catalog);
|
|
47339
|
+
applyPersistedModelDefault(session, model, alreadyInScope);
|
|
47340
|
+
}
|
|
47204
47341
|
refreshSessionView() {
|
|
47205
47342
|
const session = super.session;
|
|
47206
47343
|
const sessionFile = session.sessionFile;
|
|
@@ -47240,6 +47377,7 @@ var init_isolated_runtime = __esm(() => {
|
|
|
47240
47377
|
session.agent.state.model = event.model;
|
|
47241
47378
|
break;
|
|
47242
47379
|
case "thinking_level_changed":
|
|
47380
|
+
this.thinkingEpoch += 1;
|
|
47243
47381
|
session.agent.state.thinkingLevel = event.level;
|
|
47244
47382
|
break;
|
|
47245
47383
|
case "session_info_changed":
|
|
@@ -48453,7 +48591,7 @@ var init_slash_commands = __esm(() => {
|
|
|
48453
48591
|
{ name: "tree", description: "Navigate session tree (switch branches)" },
|
|
48454
48592
|
{ name: "thinking", description: "Set thinking level", argumentHint: "<level>" },
|
|
48455
48593
|
{ name: "scoped-models", description: "Enable/disable models for ctrl+p cycling" },
|
|
48456
|
-
{ name: "fast", description: "Configure
|
|
48594
|
+
{ name: "fast", description: "Configure OpenAI fast mode for chat and workflows in supported models" },
|
|
48457
48595
|
{ name: "export", description: "Export session (HTML default, or specify path: .html/.jsonl)" },
|
|
48458
48596
|
{ name: "import", description: "Import and resume a session from a JSONL file" },
|
|
48459
48597
|
{ name: "share", description: "Share session as a secret GitHub gist" },
|
|
@@ -49905,7 +50043,7 @@ var init_interactive_autocomplete = __esm(() => {
|
|
|
49905
50043
|
return [...this.session.modelRuntime.getAvailableSnapshot()];
|
|
49906
50044
|
};
|
|
49907
50045
|
InteractiveModeBase.prototype.hasCodexFastModeSupportedModels = function() {
|
|
49908
|
-
return hasSupportedCodexFastModeModel(this.getCodexFastModeCandidateModels());
|
|
50046
|
+
return hasSupportedCodexFastModeModel(this.getCodexFastModeCandidateModels(), this.session.modelRuntime.getCredentialSnapshot?.("github-copilot"));
|
|
49909
50047
|
};
|
|
49910
50048
|
InteractiveModeBase.prototype.buildRemoteSlashCommands = function(localCommands) {
|
|
49911
50049
|
const remote = getInteractiveEngineRemoteCommands(this.runtimeHost);
|
|
@@ -50593,7 +50731,7 @@ var init_interactive_startup = __esm(() => {
|
|
|
50593
50731
|
if (!model) {
|
|
50594
50732
|
return modelLabel2;
|
|
50595
50733
|
}
|
|
50596
|
-
const fastModeEnabled = shouldApplyCodexFastMode(model, this.session.settingsManager.getCodexFastModeSettings(), this.session.orchestrationContext);
|
|
50734
|
+
const fastModeEnabled = shouldApplyCodexFastMode(model, this.session.settingsManager.getCodexFastModeSettings(), this.session.orchestrationContext, this.session.modelRuntime.getCredentialSnapshot?.("github-copilot"));
|
|
50597
50735
|
return formatCodexFastModeModelLabel(modelLabel2, fastModeEnabled);
|
|
50598
50736
|
};
|
|
50599
50737
|
InteractiveModeBase.prototype.getStartupIdentityText = function(maxWidth, gap = 0, manifestoPhase = 4) {
|
|
@@ -51519,7 +51657,7 @@ var init_interactive_extension_runtime = __esm(() => {
|
|
|
51519
51657
|
if (shortcuts.size === 0)
|
|
51520
51658
|
return;
|
|
51521
51659
|
const createContext = () => ({
|
|
51522
|
-
ui:
|
|
51660
|
+
ui: extensionRunner.getUIContext(),
|
|
51523
51661
|
mode: "tui",
|
|
51524
51662
|
hasUI: true,
|
|
51525
51663
|
cwd: this.sessionManager.getCwd(),
|
|
@@ -55108,7 +55246,7 @@ var init_interactive_selectors = __esm(() => {
|
|
|
55108
55246
|
});
|
|
55109
55247
|
|
|
55110
55248
|
// src/modes/interactive/interactive-model-routing.ts
|
|
55111
|
-
import { clampThinkingLevel as
|
|
55249
|
+
import { clampThinkingLevel as clampThinkingLevel6 } from "@bastani/pi-ai/compat";
|
|
55112
55250
|
function resolveThinkingSelectorDefault(rawDefault, availableLevels, model) {
|
|
55113
55251
|
if (rawDefault === undefined)
|
|
55114
55252
|
return;
|
|
@@ -55116,7 +55254,7 @@ function resolveThinkingSelectorDefault(rawDefault, availableLevels, model) {
|
|
|
55116
55254
|
return rawDefault;
|
|
55117
55255
|
if (!model)
|
|
55118
55256
|
return availableLevels.includes("off") ? "off" : availableLevels[0];
|
|
55119
|
-
const clamped =
|
|
55257
|
+
const clamped = clampThinkingLevel6(model, rawDefault);
|
|
55120
55258
|
if (availableLevels.includes(clamped))
|
|
55121
55259
|
return clamped;
|
|
55122
55260
|
return availableLevels.includes("off") ? "off" : availableLevels[0];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/mcp",
|
|
3
|
-
"version": "0.9.16-alpha.
|
|
3
|
+
"version": "0.9.16-alpha.9",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension that adapts MCP (Model Context Protocol) servers into the coding agent. Fork of: https://github.com/nicobailon/pi-mcp-adapter",
|
|
6
6
|
"contributors": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/subagents",
|
|
3
|
-
"version": "0.9.16-alpha.
|
|
3
|
+
"version": "0.9.16-alpha.9",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
|
|
6
6
|
"contributors": [
|