@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
|
@@ -4589,10 +4589,10 @@ function hasAssistantMessage(entries) {
|
|
|
4589
4589
|
return entries.some((entry) => entry.type === "message" && entry.message.role === "assistant");
|
|
4590
4590
|
}
|
|
4591
4591
|
function persistAppendedEntry(filePath, entries, entry, flushed) {
|
|
4592
|
-
if (!hasAssistantMessage(entries))
|
|
4593
|
-
return false;
|
|
4594
4592
|
if (flushed)
|
|
4595
4593
|
appendSessionEntry(filePath, entry);
|
|
4594
|
+
else if (!hasAssistantMessage(entries))
|
|
4595
|
+
return false;
|
|
4596
4596
|
else
|
|
4597
4597
|
appendSessionEntries(filePath, entries);
|
|
4598
4598
|
return true;
|
|
@@ -10723,6 +10723,8 @@ function appendDurableDisplayCard(session, message, delivery) {
|
|
|
10723
10723
|
const card = { ...message, excludeFromContext: true };
|
|
10724
10724
|
const admitted = message;
|
|
10725
10725
|
const intentEntryId = session.sessionManager.appendCustomMessageEntry(card.customType, card.content, card.display, card.details, true, { delivery }, admitted.stageAdmissionKey);
|
|
10726
|
+
if (admitted.stageAdmissionKey !== undefined)
|
|
10727
|
+
session.sessionManager.flush();
|
|
10726
10728
|
session.agent.state.messages.push(card);
|
|
10727
10729
|
return { card, intentEntryId };
|
|
10728
10730
|
}
|
|
@@ -10948,12 +10950,17 @@ var init_agent_session_persistent_custom_messages = __esm(() => {
|
|
|
10948
10950
|
});
|
|
10949
10951
|
|
|
10950
10952
|
// src/core/agent-session-custom-message-commit.ts
|
|
10953
|
+
function appendDurableStageAdmission(session, message) {
|
|
10954
|
+
session._appendCustomMessage(message);
|
|
10955
|
+
if (message.stageAdmissionKey !== undefined)
|
|
10956
|
+
session.sessionManager?.flush();
|
|
10957
|
+
}
|
|
10951
10958
|
async function commitAdmittedCustomMessage(session, appMessage, options) {
|
|
10952
10959
|
const owner = resolveWorkflowStageDeliveryTarget(session);
|
|
10953
10960
|
if (owner !== session)
|
|
10954
10961
|
return commitAdmittedCustomMessage(owner, appMessage, options);
|
|
10955
10962
|
const self = session;
|
|
10956
|
-
const useProtectedReconciliation = options?.persistWhenStreaming === true && options.triggerTurn === true
|
|
10963
|
+
const useProtectedReconciliation = options?.persistWhenStreaming === true && options.excludeFromContext !== true && (options.triggerTurn === true || options.stageAdmissionKey !== undefined);
|
|
10957
10964
|
if (options?.deliverAs === "nextTurn") {
|
|
10958
10965
|
self._pendingNextTurnMessages.push(appMessage);
|
|
10959
10966
|
} else if (self._queuedMessagesPaused) {
|
|
@@ -10967,20 +10974,20 @@ async function commitAdmittedCustomMessage(session, appMessage, options) {
|
|
|
10967
10974
|
} else if (self.isStreaming) {
|
|
10968
10975
|
self._pendingCustomMessages.push(appMessage);
|
|
10969
10976
|
} else {
|
|
10970
|
-
self
|
|
10977
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10971
10978
|
}
|
|
10972
10979
|
} else if (options?.deliverAs === "interrupt" && options.triggerTurn) {
|
|
10973
10980
|
const interrupt = self._enqueueInterruptCustomMessage(appMessage, options);
|
|
10974
10981
|
self._workflowStageAdmission?.trackAdmittedWork(interrupt);
|
|
10975
10982
|
interrupt.catch(() => {});
|
|
10976
10983
|
} else if (self.isStreaming && options?.excludeFromContext === true && options.triggerTurn !== true && options.deliverAs === undefined) {
|
|
10977
|
-
self
|
|
10984
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10978
10985
|
} else if (self.isStreaming && options?.triggerTurn === false) {
|
|
10979
10986
|
self._pendingCustomMessages.push(appMessage);
|
|
10980
10987
|
} else if (self.isStreaming && useProtectedReconciliation) {
|
|
10981
10988
|
await queueProtectedStreamingCustomMessage(self, appMessage, options?.deliverAs === "followUp" ? "followUp" : "steer");
|
|
10982
10989
|
} else if (self.isStreaming && options?.persistWhenStreaming === true) {
|
|
10983
|
-
self
|
|
10990
|
+
appendDurableStageAdmission(self, appMessage);
|
|
10984
10991
|
} else if (self.isStreaming && options?.triggerTurn !== false) {
|
|
10985
10992
|
self._queueAgentMessage(appMessage, options?.deliverAs === "followUp" ? "followUp" : "steer");
|
|
10986
10993
|
} else if (options?.triggerTurn) {
|
|
@@ -11003,7 +11010,7 @@ async function commitAdmittedCustomMessage(session, appMessage, options) {
|
|
|
11003
11010
|
self._continueQueuedAgentMessages().catch(() => {});
|
|
11004
11011
|
}
|
|
11005
11012
|
} else {
|
|
11006
|
-
self
|
|
11013
|
+
appendDurableStageAdmission(self, appMessage);
|
|
11007
11014
|
}
|
|
11008
11015
|
}
|
|
11009
11016
|
function _commitAdmittedCustomMessage(appMessage, options) {
|
|
@@ -13310,6 +13317,8 @@ class ExtensionRunner {
|
|
|
13310
13317
|
shortcutDiagnostics = [];
|
|
13311
13318
|
commandDiagnostics = [];
|
|
13312
13319
|
staleMessage;
|
|
13320
|
+
uiPromptBinding = 0;
|
|
13321
|
+
activeUIPrompt;
|
|
13313
13322
|
constructor(extensions, runtime, cwd, sessionManager, modelRegistry, orchestrationContext, subagentPolicy) {
|
|
13314
13323
|
this.extensions = extensions;
|
|
13315
13324
|
this.runtime = runtime;
|
|
@@ -13404,9 +13413,71 @@ class ExtensionRunner {
|
|
|
13404
13413
|
this.reloadHandler = async () => {};
|
|
13405
13414
|
}
|
|
13406
13415
|
setUIContext(uiContext, mode = "print") {
|
|
13407
|
-
this.
|
|
13416
|
+
this.endActiveUIPrompt();
|
|
13417
|
+
const binding = ++this.uiPromptBinding;
|
|
13418
|
+
this.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;
|
|
13408
13419
|
this.mode = mode;
|
|
13409
13420
|
}
|
|
13421
|
+
wrapUIPromptContext(ui, binding) {
|
|
13422
|
+
return {
|
|
13423
|
+
...ui,
|
|
13424
|
+
select: (title, options, opts) => this.withUIPrompt(binding, "select", title, () => ui.select(title, options, opts)),
|
|
13425
|
+
confirm: (title, message, opts) => this.withUIPrompt(binding, "confirm", title, () => ui.confirm(title, message, opts)),
|
|
13426
|
+
input: (title, placeholder, opts) => this.withUIPrompt(binding, "input", title, () => ui.input(title, placeholder, opts)),
|
|
13427
|
+
editor: (title, prefill, opts) => this.withUIPrompt(binding, "editor", title, () => ui.editor(title, prefill, opts)),
|
|
13428
|
+
custom: (factory, options) => this.withUIPrompt(binding, "custom", undefined, () => ui.custom(factory, options))
|
|
13429
|
+
};
|
|
13430
|
+
}
|
|
13431
|
+
withUIPrompt(binding, kind, title, run) {
|
|
13432
|
+
if (binding !== this.uiPromptBinding)
|
|
13433
|
+
return run();
|
|
13434
|
+
let prompt = this.activeUIPrompt;
|
|
13435
|
+
if (!prompt) {
|
|
13436
|
+
prompt = { depth: 0, kind, title };
|
|
13437
|
+
this.activeUIPrompt = prompt;
|
|
13438
|
+
this.emitUIPromptEvent({
|
|
13439
|
+
type: "ui_prompt_start",
|
|
13440
|
+
reason: "ui_prompt",
|
|
13441
|
+
kind,
|
|
13442
|
+
...title === undefined ? {} : { title }
|
|
13443
|
+
});
|
|
13444
|
+
}
|
|
13445
|
+
prompt.depth += 1;
|
|
13446
|
+
let finished = false;
|
|
13447
|
+
const finish = () => {
|
|
13448
|
+
if (finished)
|
|
13449
|
+
return;
|
|
13450
|
+
finished = true;
|
|
13451
|
+
if (this.activeUIPrompt !== prompt)
|
|
13452
|
+
return;
|
|
13453
|
+
prompt.depth -= 1;
|
|
13454
|
+
if (prompt.depth === 0)
|
|
13455
|
+
this.endActiveUIPrompt(prompt);
|
|
13456
|
+
};
|
|
13457
|
+
try {
|
|
13458
|
+
return run().finally(finish);
|
|
13459
|
+
} catch (error) {
|
|
13460
|
+
finish();
|
|
13461
|
+
throw error;
|
|
13462
|
+
}
|
|
13463
|
+
}
|
|
13464
|
+
endActiveUIPrompt(prompt = this.activeUIPrompt) {
|
|
13465
|
+
if (!prompt || this.activeUIPrompt !== prompt)
|
|
13466
|
+
return;
|
|
13467
|
+
this.activeUIPrompt = undefined;
|
|
13468
|
+
prompt.depth = 0;
|
|
13469
|
+
this.emitUIPromptEvent({
|
|
13470
|
+
type: "ui_prompt_end",
|
|
13471
|
+
reason: "ui_prompt",
|
|
13472
|
+
kind: prompt.kind,
|
|
13473
|
+
...prompt.title === undefined ? {} : { title: prompt.title }
|
|
13474
|
+
});
|
|
13475
|
+
}
|
|
13476
|
+
emitUIPromptEvent(event) {
|
|
13477
|
+
queueMicrotask(() => {
|
|
13478
|
+
this.emit(event);
|
|
13479
|
+
});
|
|
13480
|
+
}
|
|
13410
13481
|
getUIContext() {
|
|
13411
13482
|
return this.uiContext;
|
|
13412
13483
|
}
|
|
@@ -19160,6 +19231,7 @@ async function loadVirtualModules() {
|
|
|
19160
19231
|
piAi,
|
|
19161
19232
|
piAiOauth,
|
|
19162
19233
|
piAiCloudflareGatewayBinding,
|
|
19234
|
+
properLockfile,
|
|
19163
19235
|
piCodingAgent
|
|
19164
19236
|
] = await Promise.all([
|
|
19165
19237
|
import("typebox"),
|
|
@@ -19171,6 +19243,7 @@ async function loadVirtualModules() {
|
|
|
19171
19243
|
import("@bastani/pi-ai/compat"),
|
|
19172
19244
|
import("@bastani/pi-ai/oauth"),
|
|
19173
19245
|
import("@bastani/pi-ai/api/cloudflare-gateway-binding"),
|
|
19246
|
+
import("proper-lockfile"),
|
|
19174
19247
|
Promise.resolve().then(() => (init_src(), exports_src))
|
|
19175
19248
|
]);
|
|
19176
19249
|
return {
|
|
@@ -19191,6 +19264,7 @@ async function loadVirtualModules() {
|
|
|
19191
19264
|
"@earendil-works/pi-ai/compat": piAi,
|
|
19192
19265
|
"@earendil-works/pi-ai/oauth": piAiOauth,
|
|
19193
19266
|
"@earendil-works/pi-ai/api/cloudflare-gateway-binding": piAiCloudflareGatewayBinding,
|
|
19267
|
+
"proper-lockfile": properLockfile,
|
|
19194
19268
|
"@bastani/atomic": piCodingAgent,
|
|
19195
19269
|
"@mariozechner/pi-agent-core": piAgentCore,
|
|
19196
19270
|
"@mariozechner/pi-tui": piTui,
|
|
@@ -26320,11 +26394,20 @@ function isCodexFastModeCandidateModelId(modelId) {
|
|
|
26320
26394
|
const provider = modelId?.split("/", 1)[0];
|
|
26321
26395
|
return provider !== undefined && isCodexFastModeSupportedProvider(provider);
|
|
26322
26396
|
}
|
|
26323
|
-
function
|
|
26324
|
-
return
|
|
26397
|
+
function isGitHubCopilotModel(model) {
|
|
26398
|
+
return model.provider === "github-copilot";
|
|
26325
26399
|
}
|
|
26326
|
-
function
|
|
26327
|
-
|
|
26400
|
+
function isGitHubCopilotFastModeSupportedModel(model, credential) {
|
|
26401
|
+
if (!isGitHubCopilotModel(model) || credential?.type !== "oauth")
|
|
26402
|
+
return false;
|
|
26403
|
+
const fastModelIds = credential.fastModelIds;
|
|
26404
|
+
return Array.isArray(fastModelIds) && fastModelIds.every((modelId) => typeof modelId === "string") && fastModelIds.includes(`${model.id}-fast`);
|
|
26405
|
+
}
|
|
26406
|
+
function isCodexFastModeSupportedModel(model, copilotCredential) {
|
|
26407
|
+
return isCodexFastModeSupportedProvider(model.provider) || model.api === "openai-codex-responses" || model.id !== undefined && isGitHubCopilotFastModeSupportedModel({ provider: model.provider, id: model.id }, copilotCredential);
|
|
26408
|
+
}
|
|
26409
|
+
function hasSupportedCodexFastModeModel(models, copilotCredential) {
|
|
26410
|
+
return models.some((model) => isCodexFastModeSupportedModel(model, copilotCredential));
|
|
26328
26411
|
}
|
|
26329
26412
|
function isWorkflowStageOrchestrationContext(context) {
|
|
26330
26413
|
return context?.kind === "workflow-stage";
|
|
@@ -26335,11 +26418,11 @@ function getCodexFastModeScope(context) {
|
|
|
26335
26418
|
function isCodexFastModeEnabledForScope(settings, scope) {
|
|
26336
26419
|
return settings[scope];
|
|
26337
26420
|
}
|
|
26338
|
-
function shouldApplyCodexFastModeForScope(model, settings, scope) {
|
|
26339
|
-
return isCodexFastModeSupportedModel(model) && isCodexFastModeEnabledForScope(settings, scope);
|
|
26421
|
+
function shouldApplyCodexFastModeForScope(model, settings, scope, copilotCredential) {
|
|
26422
|
+
return isCodexFastModeSupportedModel(model, copilotCredential) && isCodexFastModeEnabledForScope(settings, scope);
|
|
26340
26423
|
}
|
|
26341
|
-
function shouldApplyCodexFastMode(model, settings, context) {
|
|
26342
|
-
return shouldApplyCodexFastModeForScope(model, settings, getCodexFastModeScope(context));
|
|
26424
|
+
function shouldApplyCodexFastMode(model, settings, context, copilotCredential) {
|
|
26425
|
+
return shouldApplyCodexFastModeForScope(model, settings, getCodexFastModeScope(context), copilotCredential);
|
|
26343
26426
|
}
|
|
26344
26427
|
function usesFirstPartyCodexRouting(model) {
|
|
26345
26428
|
return model.provider === "openai-codex" && isFirstPartyCodexBaseUrl(model.baseUrl);
|
|
@@ -26365,8 +26448,8 @@ function withCodexFastModeHeaders(model, headers, enabled) {
|
|
|
26365
26448
|
setHeader(fastHeaders, CODEX_FAST_MODE_ROUTING_HEADER, `model=${model.id};tier=${CODEX_FAST_MODE_SERVICE_TIER}`);
|
|
26366
26449
|
return fastHeaders;
|
|
26367
26450
|
}
|
|
26368
|
-
function withCodexFastModeStreamOptions(
|
|
26369
|
-
if (!enabled) {
|
|
26451
|
+
function withCodexFastModeStreamOptions(model, options, enabled) {
|
|
26452
|
+
if (!enabled || model.provider === "github-copilot") {
|
|
26370
26453
|
return options;
|
|
26371
26454
|
}
|
|
26372
26455
|
return {
|
|
@@ -26500,10 +26583,14 @@ function streamWithCodexFastMode(model, context, options, streamers = DEFAULT_CO
|
|
|
26500
26583
|
function isObjectPayload(payload) {
|
|
26501
26584
|
return typeof payload === "object" && payload !== null && !Array.isArray(payload);
|
|
26502
26585
|
}
|
|
26503
|
-
function withCodexFastModePayload(payload, enabled) {
|
|
26504
|
-
if (!enabled || !isObjectPayload(payload)
|
|
26586
|
+
function withCodexFastModePayload(payload, enabled, model) {
|
|
26587
|
+
if (!enabled || !isObjectPayload(payload))
|
|
26505
26588
|
return payload;
|
|
26589
|
+
if (model?.provider === "github-copilot") {
|
|
26590
|
+
return payload.model === model.id ? { ...payload, model: `${model.id}-fast` } : payload;
|
|
26506
26591
|
}
|
|
26592
|
+
if (payload.service_tier !== undefined)
|
|
26593
|
+
return payload;
|
|
26507
26594
|
return {
|
|
26508
26595
|
...payload,
|
|
26509
26596
|
service_tier: CODEX_FAST_MODE_SERVICE_TIER
|
|
@@ -26653,7 +26740,7 @@ class FooterComponent {
|
|
|
26653
26740
|
pwd += ` • ${sessionName}`;
|
|
26654
26741
|
const modelName = state.model?.id || "no-model";
|
|
26655
26742
|
const fastModeSettings = this.session.settingsManager.getCodexFastModeSettings();
|
|
26656
|
-
const fastModeEnabled = state.model ? shouldApplyCodexFastMode(state.model, fastModeSettings, this.session.orchestrationContext) : false;
|
|
26743
|
+
const fastModeEnabled = state.model ? shouldApplyCodexFastMode(state.model, fastModeSettings, this.session.orchestrationContext, this.session.modelRuntime.getCredentialSnapshot?.("github-copilot")) : false;
|
|
26657
26744
|
let modelLabel2 = modelName;
|
|
26658
26745
|
if (state.model?.reasoning) {
|
|
26659
26746
|
const thinkingLevel = state.thinkingLevel || "off";
|
|
@@ -45421,14 +45508,18 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
45421
45508
|
|
|
45422
45509
|
class WorkflowStageAdmissionBoundary {
|
|
45423
45510
|
open = true;
|
|
45424
|
-
completed
|
|
45511
|
+
completed;
|
|
45425
45512
|
inFlight = new Map;
|
|
45426
45513
|
pending = new Set;
|
|
45427
45514
|
invocationContext = new AsyncLocalStorage;
|
|
45428
45515
|
closePromise;
|
|
45429
45516
|
drainAdmittedWork;
|
|
45430
|
-
constructor(drainAdmittedWork =
|
|
45431
|
-
this.drainAdmittedWork = drainAdmittedWork;
|
|
45517
|
+
constructor(drainAdmittedWork = undefined, completedKeys = []) {
|
|
45518
|
+
this.drainAdmittedWork = drainAdmittedWork ?? (async () => {});
|
|
45519
|
+
this.completed = new Set(completedKeys);
|
|
45520
|
+
}
|
|
45521
|
+
static restore(entries, drainAdmittedWork) {
|
|
45522
|
+
return new WorkflowStageAdmissionBoundary(drainAdmittedWork, Array.from(entries).flatMap((entry) => entry.type === "custom_message" && typeof entry.stageAdmissionKey === "string" ? [entry.stageAdmissionKey] : []));
|
|
45432
45523
|
}
|
|
45433
45524
|
admit(key, deliver, routeLate) {
|
|
45434
45525
|
if (key !== undefined) {
|
|
@@ -45667,7 +45758,7 @@ class AgentSessionBase {
|
|
|
45667
45758
|
this._subagentPolicy = config.subagentPolicy;
|
|
45668
45759
|
this._systemPromptTransform = config.systemPromptTransform;
|
|
45669
45760
|
const stageContext = config.orchestrationContext?.kind === "workflow-stage" ? config.orchestrationContext : undefined;
|
|
45670
|
-
this._workflowStageAdmission = stageContext?.messageAdmission?.boundary ?? (stageContext ?
|
|
45761
|
+
this._workflowStageAdmission = stageContext?.messageAdmission?.boundary ?? (stageContext ? WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch()) : undefined);
|
|
45671
45762
|
if (this._workflowStageAdmission && stageContext && stageContext.messageAdmission === undefined) {
|
|
45672
45763
|
stageContext.messageAdmission = {
|
|
45673
45764
|
boundary: this._workflowStageAdmission,
|
|
@@ -45999,6 +46090,9 @@ class AuthStorage {
|
|
|
45999
46090
|
this.data = this.parseStorageData(content);
|
|
46000
46091
|
} catch {}
|
|
46001
46092
|
}
|
|
46093
|
+
peek(provider) {
|
|
46094
|
+
return this.data[provider];
|
|
46095
|
+
}
|
|
46002
46096
|
async read(provider) {
|
|
46003
46097
|
const credential = this.data[provider];
|
|
46004
46098
|
if (credential?.type !== "api_key")
|
|
@@ -47052,6 +47146,10 @@ function getReloadableStore(store) {
|
|
|
47052
47146
|
const reloadable = store;
|
|
47053
47147
|
return typeof reloadable.reload === "function" ? reloadable : undefined;
|
|
47054
47148
|
}
|
|
47149
|
+
function getSnapshotStore(store) {
|
|
47150
|
+
const snapshotStore = store;
|
|
47151
|
+
return typeof snapshotStore.peek === "function" ? snapshotStore : undefined;
|
|
47152
|
+
}
|
|
47055
47153
|
|
|
47056
47154
|
class RuntimeCredentials {
|
|
47057
47155
|
store;
|
|
@@ -47071,6 +47169,10 @@ class RuntimeCredentials {
|
|
|
47071
47169
|
async reload() {
|
|
47072
47170
|
await getReloadableStore(this.store)?.reload();
|
|
47073
47171
|
}
|
|
47172
|
+
peek(providerId) {
|
|
47173
|
+
const override = this.overrides.get(providerId);
|
|
47174
|
+
return override ? { type: "api_key", key: override } : getSnapshotStore(this.store)?.peek(providerId);
|
|
47175
|
+
}
|
|
47074
47176
|
async read(providerId, options) {
|
|
47075
47177
|
const override = this.overrides.get(providerId);
|
|
47076
47178
|
return override ? { type: "api_key", key: override } : this.store.read(providerId, options);
|
|
@@ -47506,6 +47608,9 @@ class ModelRuntime {
|
|
|
47506
47608
|
hasConfiguredAuth(providerId) {
|
|
47507
47609
|
return this.snapshot.configuredProviders.has(providerId);
|
|
47508
47610
|
}
|
|
47611
|
+
getCredentialSnapshot(providerId) {
|
|
47612
|
+
return this.credentials.peek(providerId);
|
|
47613
|
+
}
|
|
47509
47614
|
async getAuth(providerOrModel, overrides = {}) {
|
|
47510
47615
|
if (typeof providerOrModel === "string")
|
|
47511
47616
|
return this.models.getAuth(providerOrModel, overrides);
|
|
@@ -55461,7 +55566,7 @@ async function createAgentSession(options = {}) {
|
|
|
55461
55566
|
return filtered;
|
|
55462
55567
|
};
|
|
55463
55568
|
const extensionRunnerRef = {};
|
|
55464
|
-
const isCodexFastModeEnabled = (requestModel) => shouldApplyCodexFastMode(requestModel, settingsManager.getCodexFastModeSettings(), options.orchestrationContext);
|
|
55569
|
+
const isCodexFastModeEnabled = (requestModel) => shouldApplyCodexFastMode(requestModel, settingsManager.getCodexFastModeSettings(), options.orchestrationContext, modelRuntime.getCredentialSnapshot("github-copilot"));
|
|
55465
55570
|
agent = new Agent2({
|
|
55466
55571
|
initialState: {
|
|
55467
55572
|
systemPrompt: "",
|
|
@@ -55497,7 +55602,7 @@ async function createAgentSession(options = {}) {
|
|
|
55497
55602
|
const extensionProvider = modelRuntime.getRegisteredProviderConfig(requestModel.provider);
|
|
55498
55603
|
const usesExtensionStream = extensionProvider?.streamSimple !== undefined && requestModel.api === extensionProvider.api;
|
|
55499
55604
|
const transportHeaders = usesExtensionStream ? assembledHeaders : removeUnownedModelHeaders(assembledHeaders, model2.headers, requestHeaders);
|
|
55500
|
-
if (fastModeEnabled && !usesExtensionStream && !authResult) {
|
|
55605
|
+
if (fastModeEnabled && !isGitHubCopilotModel(model2) && !usesExtensionStream && !authResult) {
|
|
55501
55606
|
throw new Error(`No API key found for "${model2.provider}"`);
|
|
55502
55607
|
}
|
|
55503
55608
|
const codexFastModeStreamOptions = withCodexFastModeStreamOptions(requestModel, {
|
|
@@ -55514,7 +55619,7 @@ async function createAgentSession(options = {}) {
|
|
|
55514
55619
|
if (usesExtensionStream) {
|
|
55515
55620
|
return modelRuntime.streamSimple(requestModel, context, codexFastModeStreamOptions);
|
|
55516
55621
|
}
|
|
55517
|
-
if (fastModeEnabled) {
|
|
55622
|
+
if (fastModeEnabled && !isGitHubCopilotModel(requestModel)) {
|
|
55518
55623
|
return streamWithCodexFastMode(requestModel, context, codexFastModeStreamOptions);
|
|
55519
55624
|
}
|
|
55520
55625
|
const transportOptions = usesChatGptCodexTransport(requestModel) && codexFastModeStreamOptions ? withChatGptCodexTransportRouting(requestModel, codexFastModeStreamOptions, false) : codexFastModeStreamOptions;
|
|
@@ -55522,7 +55627,7 @@ async function createAgentSession(options = {}) {
|
|
|
55522
55627
|
},
|
|
55523
55628
|
onPayload: async (payload, model2) => {
|
|
55524
55629
|
const fastModeEnabled = isCodexFastModeEnabled(model2);
|
|
55525
|
-
const guardedPayload = withCodexFastModePayload(payload, fastModeEnabled);
|
|
55630
|
+
const guardedPayload = withCodexFastModePayload(payload, fastModeEnabled, model2);
|
|
55526
55631
|
const sourceMessages = lastConvertedLlmMessages;
|
|
55527
55632
|
const replayGuardedPayload = sourceMessages ? restoreAnthropicReplayThinkingBlocks(guardedPayload, sourceMessages, model2) : guardedPayload;
|
|
55528
55633
|
const runner = extensionRunnerRef.current;
|
|
@@ -59987,6 +60092,31 @@ class RemoteQueuePause {
|
|
|
59987
60092
|
var init_remote_queue_pause = () => {};
|
|
59988
60093
|
|
|
59989
60094
|
// src/modes/interactive-engine/isolated-runtime.ts
|
|
60095
|
+
import { clampThinkingLevel as clampThinkingLevel5 } from "@bastani/pi-ai/compat";
|
|
60096
|
+
function applyPersistedModelDefault(session, model, alreadyInScope) {
|
|
60097
|
+
session.settingsManager.setDefaultModelAndProvider(model.provider, model.id);
|
|
60098
|
+
if (alreadyInScope || session.scopedModels.length === 0)
|
|
60099
|
+
return;
|
|
60100
|
+
const enabledModels = session.settingsManager.getEnabledModels();
|
|
60101
|
+
if (!enabledModels?.length)
|
|
60102
|
+
return;
|
|
60103
|
+
const modelReference = `${model.provider}/${model.id}`;
|
|
60104
|
+
if (enabledModels.some((pattern) => pattern.toLowerCase() === modelReference.toLowerCase()))
|
|
60105
|
+
return;
|
|
60106
|
+
session.settingsManager.setEnabledModels([...enabledModels, modelReference]);
|
|
60107
|
+
}
|
|
60108
|
+
function thinkingPersistTarget(result) {
|
|
60109
|
+
if (!result.provider || !result.modelId)
|
|
60110
|
+
return;
|
|
60111
|
+
return { provider: result.provider, modelId: result.modelId };
|
|
60112
|
+
}
|
|
60113
|
+
function applyPersistedThinkingDefault(session, level, target) {
|
|
60114
|
+
if (target) {
|
|
60115
|
+
session.settingsManager.setModelThinkingLevel(target.provider, target.modelId, level);
|
|
60116
|
+
return;
|
|
60117
|
+
}
|
|
60118
|
+
session.settingsManager.setDefaultThinkingLevel(level);
|
|
60119
|
+
}
|
|
59990
60120
|
var IsolatedInteractiveRuntime;
|
|
59991
60121
|
var init_isolated_runtime = __esm(() => {
|
|
59992
60122
|
init_agent_session_runtime();
|
|
@@ -60005,6 +60135,7 @@ var init_isolated_runtime = __esm(() => {
|
|
|
60005
60135
|
steeringMessages = [];
|
|
60006
60136
|
followUpMessages = [];
|
|
60007
60137
|
queueUpdateGeneration = 0;
|
|
60138
|
+
thinkingEpoch = 0;
|
|
60008
60139
|
pendingQueueClear;
|
|
60009
60140
|
engineCallbackActive = false;
|
|
60010
60141
|
queuePause;
|
|
@@ -60369,43 +60500,56 @@ var init_isolated_runtime = __esm(() => {
|
|
|
60369
60500
|
},
|
|
60370
60501
|
setModel: {
|
|
60371
60502
|
configurable: true,
|
|
60372
|
-
value: async (model) => {
|
|
60373
|
-
const selected = await this.client.setModel(model.provider, model.id);
|
|
60374
|
-
|
|
60503
|
+
value: async (model, options) => {
|
|
60504
|
+
const selected = await this.client.setModel(model.provider, model.id, options);
|
|
60505
|
+
const nextModel = session.modelRuntime.getModel(selected.provider, selected.id) ?? model;
|
|
60506
|
+
session.agent.state.model = nextModel;
|
|
60375
60507
|
this.resolveModelFallback();
|
|
60508
|
+
if (options?.persist === true)
|
|
60509
|
+
await this.syncPersistedModelCatalog(session, nextModel);
|
|
60376
60510
|
}
|
|
60377
60511
|
},
|
|
60378
60512
|
setThinkingLevel: {
|
|
60379
60513
|
configurable: true,
|
|
60380
|
-
value: (level) => {
|
|
60381
|
-
|
|
60382
|
-
|
|
60514
|
+
value: (level, options) => {
|
|
60515
|
+
const availableLevels = session.getAvailableThinkingLevels();
|
|
60516
|
+
const effectiveLevel = availableLevels.includes(level) ? level : session.model ? clampThinkingLevel5(session.model, level) : "off";
|
|
60517
|
+
session.agent.state.thinkingLevel = effectiveLevel;
|
|
60518
|
+
const epoch = ++this.thinkingEpoch;
|
|
60519
|
+
this.dispatchBestEffort("set thinking level", this.client.setThinkingLevelAck(level, options).then((result) => {
|
|
60520
|
+
this.applyThinkingAck(session, epoch, result, options?.persist === true);
|
|
60521
|
+
}));
|
|
60383
60522
|
}
|
|
60384
60523
|
},
|
|
60385
60524
|
cycleModel: {
|
|
60386
60525
|
configurable: true,
|
|
60387
|
-
value: async (direction) => {
|
|
60526
|
+
value: async (direction, options) => {
|
|
60388
60527
|
const previousModel = session.model;
|
|
60389
|
-
const result = await this.client.cycleModel(direction);
|
|
60528
|
+
const result = await this.client.cycleModel(direction, options);
|
|
60390
60529
|
if (!result)
|
|
60391
60530
|
return;
|
|
60392
60531
|
const model = session.modelRuntime.getModel(result.model.provider, result.model.id) ?? result.model;
|
|
60393
60532
|
session.agent.state.model = model;
|
|
60394
60533
|
session.agent.state.thinkingLevel = result.thinkingLevel;
|
|
60395
60534
|
this.resolveModelFallbackAfterExplicitModelSelection(previousModel, model);
|
|
60535
|
+
if (options?.persist === true)
|
|
60536
|
+
await this.syncPersistedModelCatalog(session, model);
|
|
60396
60537
|
return { ...result, model };
|
|
60397
60538
|
}
|
|
60398
60539
|
},
|
|
60399
60540
|
cycleThinkingLevel: {
|
|
60400
60541
|
configurable: true,
|
|
60401
|
-
value: () => {
|
|
60542
|
+
value: (options) => {
|
|
60402
60543
|
const levels = session.getAvailableThinkingLevels();
|
|
60403
60544
|
if (levels.length <= 1)
|
|
60404
60545
|
return;
|
|
60405
60546
|
const current = levels.indexOf(session.thinkingLevel);
|
|
60406
60547
|
const level = levels[(current + 1) % levels.length];
|
|
60407
60548
|
session.agent.state.thinkingLevel = level;
|
|
60408
|
-
|
|
60549
|
+
const epoch = ++this.thinkingEpoch;
|
|
60550
|
+
this.dispatchBestEffort("cycle thinking level", this.client.setThinkingLevelAck(level, options).then((result) => {
|
|
60551
|
+
this.applyThinkingAck(session, epoch, result, options?.persist === true);
|
|
60552
|
+
}));
|
|
60409
60553
|
return level;
|
|
60410
60554
|
}
|
|
60411
60555
|
},
|
|
@@ -60449,6 +60593,14 @@ var init_isolated_runtime = __esm(() => {
|
|
|
60449
60593
|
this.engineCallbackActive = false;
|
|
60450
60594
|
}
|
|
60451
60595
|
}
|
|
60596
|
+
applyThinkingAck(session, epoch, result, persist) {
|
|
60597
|
+
if (persist) {
|
|
60598
|
+
applyPersistedThinkingDefault(session, result.level, thinkingPersistTarget(result));
|
|
60599
|
+
}
|
|
60600
|
+
if (epoch === this.thinkingEpoch) {
|
|
60601
|
+
session.agent.state.thinkingLevel = result.level;
|
|
60602
|
+
}
|
|
60603
|
+
}
|
|
60452
60604
|
dispatchBestEffort(label, operation) {
|
|
60453
60605
|
operation.catch((error) => {
|
|
60454
60606
|
if (this.health.isRecovering())
|
|
@@ -60489,6 +60641,12 @@ var init_isolated_runtime = __esm(() => {
|
|
|
60489
60641
|
}
|
|
60490
60642
|
});
|
|
60491
60643
|
}
|
|
60644
|
+
async syncPersistedModelCatalog(session, model) {
|
|
60645
|
+
const alreadyInScope = session.scopedModels.some((scoped) => scoped.model.provider === model.provider && scoped.model.id === model.id);
|
|
60646
|
+
const catalog = await this.client.requestInternal({ type: "get_available_models" });
|
|
60647
|
+
this.remoteModelCatalog.apply(catalog);
|
|
60648
|
+
applyPersistedModelDefault(session, model, alreadyInScope);
|
|
60649
|
+
}
|
|
60492
60650
|
refreshSessionView() {
|
|
60493
60651
|
const session = super.session;
|
|
60494
60652
|
const sessionFile = session.sessionFile;
|
|
@@ -60528,6 +60686,7 @@ var init_isolated_runtime = __esm(() => {
|
|
|
60528
60686
|
session.agent.state.model = event.model;
|
|
60529
60687
|
break;
|
|
60530
60688
|
case "thinking_level_changed":
|
|
60689
|
+
this.thinkingEpoch += 1;
|
|
60531
60690
|
session.agent.state.thinkingLevel = event.level;
|
|
60532
60691
|
break;
|
|
60533
60692
|
case "session_info_changed":
|
|
@@ -61741,7 +61900,7 @@ var init_slash_commands = __esm(() => {
|
|
|
61741
61900
|
{ name: "tree", description: "Navigate session tree (switch branches)" },
|
|
61742
61901
|
{ name: "thinking", description: "Set thinking level", argumentHint: "<level>" },
|
|
61743
61902
|
{ name: "scoped-models", description: "Enable/disable models for ctrl+p cycling" },
|
|
61744
|
-
{ name: "fast", description: "Configure
|
|
61903
|
+
{ name: "fast", description: "Configure OpenAI fast mode for chat and workflows in supported models" },
|
|
61745
61904
|
{ name: "export", description: "Export session (HTML default, or specify path: .html/.jsonl)" },
|
|
61746
61905
|
{ name: "import", description: "Import and resume a session from a JSONL file" },
|
|
61747
61906
|
{ name: "share", description: "Share session as a secret GitHub gist" },
|
|
@@ -63203,7 +63362,7 @@ var init_interactive_autocomplete = __esm(() => {
|
|
|
63203
63362
|
return [...this.session.modelRuntime.getAvailableSnapshot()];
|
|
63204
63363
|
};
|
|
63205
63364
|
InteractiveModeBase.prototype.hasCodexFastModeSupportedModels = function() {
|
|
63206
|
-
return hasSupportedCodexFastModeModel(this.getCodexFastModeCandidateModels());
|
|
63365
|
+
return hasSupportedCodexFastModeModel(this.getCodexFastModeCandidateModels(), this.session.modelRuntime.getCredentialSnapshot?.("github-copilot"));
|
|
63207
63366
|
};
|
|
63208
63367
|
InteractiveModeBase.prototype.buildRemoteSlashCommands = function(localCommands) {
|
|
63209
63368
|
const remote = getInteractiveEngineRemoteCommands(this.runtimeHost);
|
|
@@ -63891,7 +64050,7 @@ var init_interactive_startup = __esm(() => {
|
|
|
63891
64050
|
if (!model) {
|
|
63892
64051
|
return modelLabel2;
|
|
63893
64052
|
}
|
|
63894
|
-
const fastModeEnabled = shouldApplyCodexFastMode(model, this.session.settingsManager.getCodexFastModeSettings(), this.session.orchestrationContext);
|
|
64053
|
+
const fastModeEnabled = shouldApplyCodexFastMode(model, this.session.settingsManager.getCodexFastModeSettings(), this.session.orchestrationContext, this.session.modelRuntime.getCredentialSnapshot?.("github-copilot"));
|
|
63895
64054
|
return formatCodexFastModeModelLabel(modelLabel2, fastModeEnabled);
|
|
63896
64055
|
};
|
|
63897
64056
|
InteractiveModeBase.prototype.getStartupIdentityText = function(maxWidth, gap = 0, manifestoPhase = 4) {
|
|
@@ -64817,7 +64976,7 @@ var init_interactive_extension_runtime = __esm(() => {
|
|
|
64817
64976
|
if (shortcuts.size === 0)
|
|
64818
64977
|
return;
|
|
64819
64978
|
const createContext = () => ({
|
|
64820
|
-
ui:
|
|
64979
|
+
ui: extensionRunner.getUIContext(),
|
|
64821
64980
|
mode: "tui",
|
|
64822
64981
|
hasUI: true,
|
|
64823
64982
|
cwd: this.sessionManager.getCwd(),
|
|
@@ -68406,7 +68565,7 @@ var init_interactive_selectors = __esm(() => {
|
|
|
68406
68565
|
});
|
|
68407
68566
|
|
|
68408
68567
|
// src/modes/interactive/interactive-model-routing.ts
|
|
68409
|
-
import { clampThinkingLevel as
|
|
68568
|
+
import { clampThinkingLevel as clampThinkingLevel6 } from "@bastani/pi-ai/compat";
|
|
68410
68569
|
function resolveThinkingSelectorDefault(rawDefault, availableLevels, model) {
|
|
68411
68570
|
if (rawDefault === undefined)
|
|
68412
68571
|
return;
|
|
@@ -68414,7 +68573,7 @@ function resolveThinkingSelectorDefault(rawDefault, availableLevels, model) {
|
|
|
68414
68573
|
return rawDefault;
|
|
68415
68574
|
if (!model)
|
|
68416
68575
|
return availableLevels.includes("off") ? "off" : availableLevels[0];
|
|
68417
|
-
const clamped =
|
|
68576
|
+
const clamped = clampThinkingLevel6(model, rawDefault);
|
|
68418
68577
|
if (availableLevels.includes(clamped))
|
|
68419
68578
|
return clamped;
|
|
68420
68579
|
return availableLevels.includes("off") ? "off" : availableLevels[0];
|
|
@@ -70778,11 +70937,20 @@ class RpcClientApi {
|
|
|
70778
70937
|
async getState() {
|
|
70779
70938
|
return this.data(await this.request({ type: "get_state" }));
|
|
70780
70939
|
}
|
|
70781
|
-
async setModel(provider, modelId) {
|
|
70782
|
-
return this.data(await this.request({
|
|
70940
|
+
async setModel(provider, modelId, options) {
|
|
70941
|
+
return this.data(await this.request({
|
|
70942
|
+
type: "set_model",
|
|
70943
|
+
provider,
|
|
70944
|
+
modelId,
|
|
70945
|
+
...options?.persist === true ? { persist: true } : {}
|
|
70946
|
+
}));
|
|
70783
70947
|
}
|
|
70784
|
-
async cycleModel(direction) {
|
|
70785
|
-
return this.data(await this.request({
|
|
70948
|
+
async cycleModel(direction, options) {
|
|
70949
|
+
return this.data(await this.request({
|
|
70950
|
+
type: "cycle_model",
|
|
70951
|
+
direction,
|
|
70952
|
+
...options?.persist === true ? { persist: true } : {}
|
|
70953
|
+
}));
|
|
70786
70954
|
}
|
|
70787
70955
|
async getAvailableModels() {
|
|
70788
70956
|
return this.data(await this.request({ type: "get_available_models" })).models;
|
|
@@ -70816,6 +70984,20 @@ class RpcClientApi {
|
|
|
70816
70984
|
async setThinkingLevel(level) {
|
|
70817
70985
|
await this.request({ type: "set_thinking_level", level });
|
|
70818
70986
|
}
|
|
70987
|
+
async setThinkingLevelAck(level, options) {
|
|
70988
|
+
const response = await this.request({
|
|
70989
|
+
type: "set_thinking_level",
|
|
70990
|
+
level,
|
|
70991
|
+
...options?.persist === true ? { persist: true } : {}
|
|
70992
|
+
});
|
|
70993
|
+
if (!response.success) {
|
|
70994
|
+
return this.data(response);
|
|
70995
|
+
}
|
|
70996
|
+
if (response.command === "set_thinking_level" && "data" in response && response.data) {
|
|
70997
|
+
return response.data;
|
|
70998
|
+
}
|
|
70999
|
+
return { level };
|
|
71000
|
+
}
|
|
70819
71001
|
async cycleThinkingLevel() {
|
|
70820
71002
|
return this.data(await this.request({ type: "cycle_thinking_level" }));
|
|
70821
71003
|
}
|
|
@@ -72834,13 +73016,13 @@ function createRpcCommandHandler({
|
|
|
72834
73016
|
if (!model) {
|
|
72835
73017
|
return createRpcErrorResponse(id, "set_model", `Model not found: ${command.provider}/${command.modelId}`);
|
|
72836
73018
|
}
|
|
72837
|
-
await session.setModel(model);
|
|
73019
|
+
await session.setModel(model, command.persist === true ? { persist: true } : {});
|
|
72838
73020
|
runtimeHost.resolveModelFallback();
|
|
72839
73021
|
return createRpcSuccessResponse(id, "set_model", session.model ?? model);
|
|
72840
73022
|
}
|
|
72841
73023
|
case "cycle_model": {
|
|
72842
73024
|
const previousModel = session.model;
|
|
72843
|
-
const result = await session.cycleModel(command.direction);
|
|
73025
|
+
const result = await session.cycleModel(command.direction, command.persist === true ? { persist: true } : {});
|
|
72844
73026
|
runtimeHost.resolveModelFallbackAfterExplicitModelSelection(previousModel, result?.model);
|
|
72845
73027
|
return createRpcSuccessResponse(id, "cycle_model", result ?? null);
|
|
72846
73028
|
}
|
|
@@ -72903,8 +73085,12 @@ function createRpcCommandHandler({
|
|
|
72903
73085
|
}
|
|
72904
73086
|
}
|
|
72905
73087
|
case "set_thinking_level": {
|
|
72906
|
-
session.setThinkingLevel(command.level);
|
|
72907
|
-
|
|
73088
|
+
session.setThinkingLevel(command.level, command.persist === true ? { persist: true } : {});
|
|
73089
|
+
const model = session.model;
|
|
73090
|
+
return createRpcSuccessResponse(id, "set_thinking_level", {
|
|
73091
|
+
level: session.thinkingLevel,
|
|
73092
|
+
...model ? { provider: model.provider, modelId: model.id } : {}
|
|
73093
|
+
});
|
|
72908
73094
|
}
|
|
72909
73095
|
case "cycle_thinking_level": {
|
|
72910
73096
|
const level = session.cycleThinkingLevel();
|