@bastani/atomic 0.9.16-alpha.9 → 0.9.16
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 +120 -0
- package/README.md +4 -4
- package/dist/builtin/intercom/CHANGELOG.md +42 -0
- package/dist/builtin/intercom/README.md +18 -17
- package/dist/builtin/intercom/broker/broker.ts +43 -18
- package/dist/builtin/intercom/broker/client.ts +138 -7
- package/dist/builtin/intercom/broker/group-isolation.ts +3 -3
- package/dist/builtin/intercom/broker/group-membership.ts +55 -0
- package/dist/builtin/intercom/broker/presence-handler.ts +62 -50
- package/dist/builtin/intercom/broker/send-handler.ts +2 -3
- package/dist/builtin/intercom/group.ts +40 -0
- package/dist/builtin/intercom/index.bundle.mjs +490 -183
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/intercom/skills/intercom/SKILL.md +16 -10
- package/dist/builtin/intercom/types.ts +24 -2
- package/dist/builtin/mcp/index.bundle.mjs +202 -52
- package/dist/builtin/mcp/package.json +2 -2
- package/dist/builtin/subagents/CHANGELOG.md +51 -0
- package/dist/builtin/subagents/README.md +3 -3
- package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
- package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-locator.md +1 -1
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +1 -1
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-locator.md +1 -1
- package/dist/builtin/subagents/agents/debugger.md +1 -1
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +422 -140
- package/dist/builtin/web-access/index.bundle.mjs +202 -52
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +70 -0
- package/dist/builtin/workflows/README.md +2 -2
- package/dist/builtin/workflows/builtin/{chunk-h5e65g7g.js → chunk-3y1hmzw6.js} +36 -6
- package/dist/builtin/workflows/builtin/{chunk-nqr34qp3.js → chunk-6rbajjf5.js} +7 -1
- package/dist/builtin/workflows/builtin/{chunk-qe6bfpbd.js → chunk-bz1c9732.js} +15 -3
- package/dist/builtin/workflows/builtin/{chunk-8v8wmb7z.js → chunk-dattsgxg.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-17zk6ffd.js → chunk-gdx0avpx.js} +355 -67
- package/dist/builtin/workflows/builtin/{chunk-rbnj9621.js → chunk-w9c7rkrk.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +3 -3
- package/dist/builtin/workflows/builtin/index.js +5 -5
- package/dist/builtin/workflows/builtin/open-claude-design.js +2 -2
- package/dist/builtin/workflows/builtin/ralph.js +3 -3
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +531 -143
- package/dist/builtin/workflows/src/index.js +212 -72
- package/dist/cli/args.js +6 -6
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +2 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/session-picker.d.ts +2 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +3 -2
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +2 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +1 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +3 -6
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +3 -1
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +6 -3
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +7 -5
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +37 -23
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +9 -2
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/builtin-packages.d.ts +4 -0
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +22 -1
- package/dist/core/builtin-packages.js.map +1 -1
- package/dist/core/callback-activity.d.ts.map +1 -1
- package/dist/core/callback-activity.js +6 -3
- package/dist/core/callback-activity.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts +1 -0
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +11 -1
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner-registries.d.ts.map +1 -1
- package/dist/core/extensions/runner-registries.js +9 -4
- package/dist/core/extensions/runner-registries.js.map +1 -1
- package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -1
- package/dist/core/extensions/runner-shortcuts.js +1 -0
- package/dist/core/extensions/runner-shortcuts.js.map +1 -1
- package/dist/core/keybindings.d.ts +5 -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/mandatory-resource-loader.d.ts +6 -0
- package/dist/core/mandatory-resource-loader.d.ts.map +1 -0
- package/dist/core/mandatory-resource-loader.js +94 -0
- package/dist/core/mandatory-resource-loader.js.map +1 -0
- package/dist/core/mandatory-runtime-tools.d.ts +10 -0
- package/dist/core/mandatory-runtime-tools.d.ts.map +1 -0
- package/dist/core/mandatory-runtime-tools.js +31 -0
- package/dist/core/mandatory-runtime-tools.js.map +1 -0
- package/dist/core/model-resolver-defaults.js +1 -1
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +24 -13
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +2 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager-ui-accessors.d.ts +4 -1
- package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-ui-accessors.js +22 -0
- package/dist/core/settings-manager-ui-accessors.js.map +1 -1
- package/dist/core/settings-types.d.ts +4 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +3 -2
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.js +2 -2
- package/dist/modes/interactive/components/fast-mode-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.js +3 -0
- package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js +7 -0
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +2 -1
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +1 -0
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +3 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +15 -1
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +6 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +6 -1
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +3 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +7 -12
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts +1 -0
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +16 -0
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +2 -0
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/docs/compaction.md +1 -1
- package/docs/environment-variables.md +2 -0
- package/docs/extensions.md +1 -1
- package/docs/intercom.md +29 -24
- package/docs/keybindings.md +5 -2
- package/docs/packages.md +1 -1
- package/docs/providers.md +2 -2
- package/docs/sdk.md +9 -7
- package/docs/settings.md +9 -3
- package/docs/subagents.md +2 -2
- package/docs/usage.md +7 -6
- package/docs/workflows.md +11 -7
- package/npm-shrinkwrap.json +59 -77
- package/package.json +7 -7
|
@@ -9224,11 +9224,13 @@ function runSynchronousCallback(descriptor, callback) {
|
|
|
9224
9224
|
}
|
|
9225
9225
|
}
|
|
9226
9226
|
async function runCallback(descriptor, callback) {
|
|
9227
|
+
if (!reporter)
|
|
9228
|
+
return callback();
|
|
9229
|
+
await yieldToEventLoop();
|
|
9227
9230
|
const active = beginActivity(descriptor);
|
|
9228
9231
|
if (!active)
|
|
9229
9232
|
return callback();
|
|
9230
9233
|
try {
|
|
9231
|
-
await yieldToEventLoop();
|
|
9232
9234
|
return await callback();
|
|
9233
9235
|
} finally {
|
|
9234
9236
|
active.reporter.finished(active.activity.id);
|
|
@@ -11957,12 +11959,34 @@ var init_runner_events = __esm(() => {
|
|
|
11957
11959
|
init_callback_activity();
|
|
11958
11960
|
});
|
|
11959
11961
|
|
|
11962
|
+
// src/core/mandatory-runtime-tools.ts
|
|
11963
|
+
function isTrustedMandatoryRuntimeTool(registration) {
|
|
11964
|
+
return MANDATORY_TOOL_NAMES.has(registration.definition.name) && TRUSTED_MANDATORY_DEFINITIONS.has(registration.definition);
|
|
11965
|
+
}
|
|
11966
|
+
function isMandatoryRuntimeTool(name) {
|
|
11967
|
+
return MANDATORY_TOOL_NAMES.has(name);
|
|
11968
|
+
}
|
|
11969
|
+
function appendRegisteredMandatoryTools(tools, registry) {
|
|
11970
|
+
for (const name of MANDATORY_TOOL_NAMES) {
|
|
11971
|
+
const tool = registry.get(name);
|
|
11972
|
+
if (tool && !tools.some((candidate) => candidate.name === name))
|
|
11973
|
+
tools.push(tool);
|
|
11974
|
+
}
|
|
11975
|
+
return tools;
|
|
11976
|
+
}
|
|
11977
|
+
var MANDATORY_TOOL_NAMES, TRUSTED_MANDATORY_DEFINITIONS;
|
|
11978
|
+
var init_mandatory_runtime_tools = __esm(() => {
|
|
11979
|
+
MANDATORY_TOOL_NAMES = new Set(["intercom"]);
|
|
11980
|
+
TRUSTED_MANDATORY_DEFINITIONS = new WeakSet;
|
|
11981
|
+
});
|
|
11982
|
+
|
|
11960
11983
|
// src/core/extensions/runner-registries.ts
|
|
11961
11984
|
function collectRegisteredTools(extensions) {
|
|
11962
11985
|
const toolsByName = new Map;
|
|
11963
11986
|
for (const ext of extensions) {
|
|
11964
11987
|
for (const tool of ext.tools.values()) {
|
|
11965
|
-
|
|
11988
|
+
const existing = toolsByName.get(tool.definition.name);
|
|
11989
|
+
if (!existing || isMandatoryRuntimeTool(tool.definition.name) && isTrustedMandatoryRuntimeTool(tool)) {
|
|
11966
11990
|
toolsByName.set(tool.definition.name, tool);
|
|
11967
11991
|
}
|
|
11968
11992
|
}
|
|
@@ -11970,13 +11994,16 @@ function collectRegisteredTools(extensions) {
|
|
|
11970
11994
|
return Array.from(toolsByName.values());
|
|
11971
11995
|
}
|
|
11972
11996
|
function findToolDefinition(extensions, toolName) {
|
|
11997
|
+
let first;
|
|
11973
11998
|
for (const ext of extensions) {
|
|
11974
11999
|
const tool = ext.tools.get(toolName);
|
|
11975
|
-
if (tool)
|
|
12000
|
+
if (!tool)
|
|
12001
|
+
continue;
|
|
12002
|
+
first ??= tool;
|
|
12003
|
+
if (isMandatoryRuntimeTool(toolName) && isTrustedMandatoryRuntimeTool(tool))
|
|
11976
12004
|
return tool.definition;
|
|
11977
|
-
}
|
|
11978
12005
|
}
|
|
11979
|
-
return;
|
|
12006
|
+
return first?.definition;
|
|
11980
12007
|
}
|
|
11981
12008
|
function collectFlags(extensions) {
|
|
11982
12009
|
const allFlags = new Map;
|
|
@@ -12044,6 +12071,9 @@ function resolveRegisteredCommands(extensions) {
|
|
|
12044
12071
|
return { ...command, invocationName };
|
|
12045
12072
|
});
|
|
12046
12073
|
}
|
|
12074
|
+
var init_runner_registries = __esm(() => {
|
|
12075
|
+
init_mandatory_runtime_tools();
|
|
12076
|
+
});
|
|
12047
12077
|
|
|
12048
12078
|
// src/core/extensions/runner-shortcuts.ts
|
|
12049
12079
|
function resolveExtensionShortcuts(extensions, resolvedKeybindings, hasUI) {
|
|
@@ -12107,6 +12137,7 @@ var init_runner_shortcuts = __esm(() => {
|
|
|
12107
12137
|
"app.thinking.toggle",
|
|
12108
12138
|
"app.editor.external",
|
|
12109
12139
|
"app.message.followUp",
|
|
12140
|
+
"app.message.copy",
|
|
12110
12141
|
"tui.input.submit",
|
|
12111
12142
|
"tui.select.confirm",
|
|
12112
12143
|
"tui.select.cancel",
|
|
@@ -12570,6 +12601,7 @@ var init_runner = __esm(() => {
|
|
|
12570
12601
|
init_loader_runtime();
|
|
12571
12602
|
init_runner_context();
|
|
12572
12603
|
init_runner_events();
|
|
12604
|
+
init_runner_registries();
|
|
12573
12605
|
init_runner_shortcuts();
|
|
12574
12606
|
init_runner_ui();
|
|
12575
12607
|
init_stale_context();
|
|
@@ -14773,11 +14805,13 @@ async function _runAgentContinue() {
|
|
|
14773
14805
|
}
|
|
14774
14806
|
async function _continueQueuedAgentMessages() {
|
|
14775
14807
|
await this._agentEventQueue;
|
|
14776
|
-
while (!this._queuedMessagesPaused && this.agent.hasQueuedMessages()) {
|
|
14808
|
+
while (!this._stopAfterTurnBlockedContinuation && !this._queuedMessagesPaused && this.agent.hasQueuedMessages()) {
|
|
14777
14809
|
await this.agent.continue();
|
|
14778
14810
|
await this.waitForRetry();
|
|
14779
14811
|
await this._agentEventQueue;
|
|
14780
14812
|
}
|
|
14813
|
+
if (this._stopAfterTurnBlockedContinuation)
|
|
14814
|
+
return;
|
|
14781
14815
|
await answerAdmittedQueuedMessage(this);
|
|
14782
14816
|
}
|
|
14783
14817
|
async function answerAdmittedQueuedMessage(session) {
|
|
@@ -16168,14 +16202,13 @@ function getToolDefinition(name) {
|
|
|
16168
16202
|
}
|
|
16169
16203
|
function setActiveToolsByName(toolNames) {
|
|
16170
16204
|
const tools = [];
|
|
16171
|
-
const validToolNames = [];
|
|
16172
16205
|
for (const name of toolNames) {
|
|
16173
16206
|
const tool = this._toolRegistry.get(name);
|
|
16174
|
-
if (tool)
|
|
16207
|
+
if (tool)
|
|
16175
16208
|
tools.push(tool);
|
|
16176
|
-
validToolNames.push(name);
|
|
16177
|
-
}
|
|
16178
16209
|
}
|
|
16210
|
+
appendRegisteredMandatoryTools(tools, this._toolRegistry);
|
|
16211
|
+
const validToolNames = tools.map((tool) => tool.name);
|
|
16179
16212
|
this.agent.state.tools = tools;
|
|
16180
16213
|
this._baseSystemPrompt = this._rebuildSystemPrompt(validToolNames);
|
|
16181
16214
|
this.agent.state.systemPrompt = this._systemPromptOverride ?? this._baseSystemPrompt;
|
|
@@ -16232,7 +16265,7 @@ function _rebuildSystemPrompt(toolNames) {
|
|
|
16232
16265
|
customPrompt: loaderSystemPrompt,
|
|
16233
16266
|
appendSystemPrompt,
|
|
16234
16267
|
selectedTools: validToolNames,
|
|
16235
|
-
excludedTools: this._excludedToolNames ? Array.from(this._excludedToolNames) : undefined,
|
|
16268
|
+
excludedTools: this._excludedToolNames ? Array.from(this._excludedToolNames).filter((name) => !isMandatoryRuntimeTool(name)) : undefined,
|
|
16236
16269
|
toolSnippets,
|
|
16237
16270
|
promptGuidelines
|
|
16238
16271
|
};
|
|
@@ -16245,6 +16278,7 @@ function _refreshBaseSystemPromptFromActiveTools() {
|
|
|
16245
16278
|
}
|
|
16246
16279
|
var agentSessionStateMethods;
|
|
16247
16280
|
var init_agent_session_state = __esm(() => {
|
|
16281
|
+
init_mandatory_runtime_tools();
|
|
16248
16282
|
init_skill_catalog();
|
|
16249
16283
|
init_system_prompt();
|
|
16250
16284
|
agentSessionStateMethods = {
|
|
@@ -17272,6 +17306,17 @@ function _installAgentToolHooks() {
|
|
|
17272
17306
|
}
|
|
17273
17307
|
function _installAgentNextTurnRefresh() {
|
|
17274
17308
|
const previousPrepareNextTurnWithContext = this.agent.prepareNextTurnWithContext ?? (this.agent.prepareNextTurn ? async (_turn, signal) => await this.agent.prepareNextTurn?.(signal) : undefined);
|
|
17309
|
+
const previousShouldStopAfterTurn = this.agent.shouldStopAfterTurn;
|
|
17310
|
+
this.agent.shouldStopAfterTurn = async (turn, signal) => {
|
|
17311
|
+
const toolCallIds = turn.message.content.filter((part) => part.type === "toolCall").map((part) => part.id);
|
|
17312
|
+
const terminatingBatch = toolCallIds.length > 0 && toolCallIds.every((id) => this._terminatingToolCallIds.has(id));
|
|
17313
|
+
for (const id of toolCallIds)
|
|
17314
|
+
this._terminatingToolCallIds.delete(id);
|
|
17315
|
+
const shouldStop = await previousShouldStopAfterTurn?.(turn, signal) ?? false;
|
|
17316
|
+
this._stopAfterTurnBlockedContinuation = shouldStop;
|
|
17317
|
+
await settleFallbackAfterTurn(this, turn, terminatingBatch);
|
|
17318
|
+
return shouldStop;
|
|
17319
|
+
};
|
|
17275
17320
|
const previousTransformContext = this.agent.transformContext;
|
|
17276
17321
|
this.agent.transformContext = async (messages, signal) => {
|
|
17277
17322
|
const transformed = previousTransformContext ? await previousTransformContext(messages, signal) : messages;
|
|
@@ -17279,24 +17324,17 @@ function _installAgentNextTurnRefresh() {
|
|
|
17279
17324
|
assertToolPairingInvariant(guarded);
|
|
17280
17325
|
return guarded;
|
|
17281
17326
|
};
|
|
17282
|
-
|
|
17283
|
-
const
|
|
17284
|
-
const
|
|
17285
|
-
const
|
|
17286
|
-
const
|
|
17287
|
-
|
|
17288
|
-
this._terminatingToolCallIds.delete(id);
|
|
17289
|
-
const messages = turn.toolResults.length > 0 && !terminatingBatch ? await this._preflightPostToolContext(previousContext.messages, signal) : previousContext.messages;
|
|
17290
|
-
const preserveFallbackForFailure = turn.message.role === "assistant" && !this.agent.hasQueuedMessages() && (turn.message.stopReason === "length" || this._isEmptyCompletion?.(turn.message) === true || this._isSafetyRefusal?.(turn.message) === true);
|
|
17291
|
-
if (!preserveFallbackForFailure && (turn.toolResults.length === 0 || terminatingBatch)) {
|
|
17292
|
-
await this._agentEventQueue;
|
|
17293
|
-
await this._settleFallbackModelScope();
|
|
17294
|
-
}
|
|
17327
|
+
const prepareTurn = async (turn, signal) => {
|
|
17328
|
+
const compactedMessages = turn.toolResults.length > 0 ? await this._preflightPostToolContext(turn.context.messages, signal) : turn.context.messages;
|
|
17329
|
+
const compactedContext = compactedMessages === turn.context.messages ? turn.context : { ...turn.context, messages: compactedMessages };
|
|
17330
|
+
const preparedTurn = compactedContext === turn.context ? turn : { ...turn, context: compactedContext };
|
|
17331
|
+
const previousSnapshot = await previousPrepareNextTurnWithContext?.(preparedTurn, signal);
|
|
17332
|
+
const previousContext = previousSnapshot?.context ?? compactedContext;
|
|
17295
17333
|
return {
|
|
17296
17334
|
...previousSnapshot,
|
|
17297
17335
|
context: {
|
|
17298
17336
|
...previousContext,
|
|
17299
|
-
messages,
|
|
17337
|
+
messages: previousContext.messages,
|
|
17300
17338
|
systemPrompt: this._systemPromptOverride ?? this._baseSystemPrompt,
|
|
17301
17339
|
tools: this.agent.state.tools.slice()
|
|
17302
17340
|
},
|
|
@@ -17304,6 +17342,14 @@ function _installAgentNextTurnRefresh() {
|
|
|
17304
17342
|
thinkingLevel: this.agent.state.thinkingLevel
|
|
17305
17343
|
};
|
|
17306
17344
|
};
|
|
17345
|
+
this.agent.prepareNextTurnWithContext = prepareTurn;
|
|
17346
|
+
}
|
|
17347
|
+
async function settleFallbackAfterTurn(session, turn, terminatingBatch) {
|
|
17348
|
+
const preserveFallbackForFailure = turn.message.role === "assistant" && !session.agent.hasQueuedMessages() && (turn.message.stopReason === "length" || session._isEmptyCompletion?.(turn.message) === true || session._isSafetyRefusal?.(turn.message) === true);
|
|
17349
|
+
if (!preserveFallbackForFailure && (turn.toolResults.length === 0 || terminatingBatch)) {
|
|
17350
|
+
await session._agentEventQueue;
|
|
17351
|
+
await session._settleFallbackModelScope();
|
|
17352
|
+
}
|
|
17307
17353
|
}
|
|
17308
17354
|
var agentSessionToolHooksMethods;
|
|
17309
17355
|
var init_agent_session_tool_hooks = __esm(() => {
|
|
@@ -17401,6 +17447,7 @@ var init_loader_virtual_modules = __esm(() => {
|
|
|
17401
17447
|
});
|
|
17402
17448
|
|
|
17403
17449
|
// src/core/extensions/loader-core.ts
|
|
17450
|
+
var runtimeEventBuses;
|
|
17404
17451
|
var init_loader_core = __esm(() => {
|
|
17405
17452
|
init_event_loop();
|
|
17406
17453
|
init_paths();
|
|
@@ -17410,6 +17457,7 @@ var init_loader_core = __esm(() => {
|
|
|
17410
17457
|
init_loader_resources();
|
|
17411
17458
|
init_loader_runtime();
|
|
17412
17459
|
init_loader_virtual_modules();
|
|
17460
|
+
runtimeEventBuses = new WeakMap;
|
|
17413
17461
|
});
|
|
17414
17462
|
|
|
17415
17463
|
// src/core/package-manager-manifest.ts
|
|
@@ -22512,7 +22560,7 @@ class FastModeSelectorComponent {
|
|
|
22512
22560
|
}
|
|
22513
22561
|
invalidate() {}
|
|
22514
22562
|
render(width) {
|
|
22515
|
-
const lines = [truncateToWidth10(theme.bold(theme.fg("accent", "
|
|
22563
|
+
const lines = [truncateToWidth10(theme.bold(theme.fg("accent", "Fast mode")), width)];
|
|
22516
22564
|
for (const line of wrapTextWithAnsi3(DESCRIPTION, Math.max(20, width))) {
|
|
22517
22565
|
lines.push(theme.fg("muted", line));
|
|
22518
22566
|
}
|
|
@@ -22595,7 +22643,7 @@ class FastModeSelectorComponent {
|
|
|
22595
22643
|
return this.getFocusedRow() === row ? theme.fg("muted", text) : theme.fg("dim", text);
|
|
22596
22644
|
}
|
|
22597
22645
|
}
|
|
22598
|
-
var ROWS, LABEL_WIDTH = 16, DESCRIPTION = "
|
|
22646
|
+
var ROWS, LABEL_WIDTH = 16, DESCRIPTION = "Use faster routing for the selected model when supported by its provider.", ROW_DETAILS;
|
|
22599
22647
|
var init_fast_mode_selector = __esm(() => {
|
|
22600
22648
|
init_theme();
|
|
22601
22649
|
ROWS = ["chat", "workflow"];
|
|
@@ -23822,6 +23870,10 @@ var init_keybindings = __esm(() => {
|
|
|
23822
23870
|
defaultKeys: windowsKeybindings ? "alt+q" : "alt+up",
|
|
23823
23871
|
description: "Restore queued messages"
|
|
23824
23872
|
},
|
|
23873
|
+
"app.message.copy": {
|
|
23874
|
+
defaultKeys: "ctrl+x",
|
|
23875
|
+
description: "Copy fullscreen selection or last agent message"
|
|
23876
|
+
},
|
|
23825
23877
|
"app.clipboard.pasteImage": {
|
|
23826
23878
|
defaultKeys: windowsKeybindings ? "alt+v" : "ctrl+v",
|
|
23827
23879
|
description: "Paste image from clipboard (text fallback)"
|
|
@@ -25207,6 +25259,9 @@ function createSettingsChangeHandler(callbacks) {
|
|
|
25207
25259
|
case "fullscreen-exit-output":
|
|
25208
25260
|
callbacks.onFullscreenExitOutputChange(newValue);
|
|
25209
25261
|
break;
|
|
25262
|
+
case "fullscreen-copy-on-select":
|
|
25263
|
+
callbacks.onFullscreenCopyOnSelectChange(newValue === "true");
|
|
25264
|
+
break;
|
|
25210
25265
|
case "editor-padding":
|
|
25211
25266
|
callbacks.onEditorPaddingXChange(parseInt(newValue, 10));
|
|
25212
25267
|
break;
|
|
@@ -25594,6 +25649,13 @@ function insertUiToggles(items, config) {
|
|
|
25594
25649
|
values: ["transcript", "resume-hint"]
|
|
25595
25650
|
});
|
|
25596
25651
|
insertAfter(items, "fullscreen-exit-output", {
|
|
25652
|
+
id: "fullscreen-copy-on-select",
|
|
25653
|
+
label: "Fullscreen copy on select",
|
|
25654
|
+
description: "Copy selected transcript text automatically on mouse release",
|
|
25655
|
+
currentValue: config.fullscreenCopyOnSelect ? "true" : "false",
|
|
25656
|
+
values: ["true", "false"]
|
|
25657
|
+
});
|
|
25658
|
+
insertAfter(items, "fullscreen-copy-on-select", {
|
|
25597
25659
|
id: "editor-padding",
|
|
25598
25660
|
label: "Editor padding",
|
|
25599
25661
|
description: "Horizontal padding for input editor (0-3)",
|
|
@@ -38724,6 +38786,8 @@ function _refreshToolRegistry(options) {
|
|
|
38724
38786
|
const allowedToolNames = this._allowedToolNames;
|
|
38725
38787
|
const excludedToolNames = this._excludedToolNames;
|
|
38726
38788
|
const isExposedTool = (name) => {
|
|
38789
|
+
if (isMandatoryRuntimeTool(name))
|
|
38790
|
+
return true;
|
|
38727
38791
|
if (allowedToolNames && !allowedToolNames.has(name)) {
|
|
38728
38792
|
return false;
|
|
38729
38793
|
}
|
|
@@ -38732,10 +38796,10 @@ function _refreshToolRegistry(options) {
|
|
|
38732
38796
|
}
|
|
38733
38797
|
return true;
|
|
38734
38798
|
};
|
|
38735
|
-
const registeredTools = this._extensionRunner.getAllRegisteredTools();
|
|
38799
|
+
const registeredTools = this._extensionRunner.getAllRegisteredTools().filter((tool) => !isMandatoryRuntimeTool(tool.definition.name) || isTrustedMandatoryRuntimeTool(tool));
|
|
38736
38800
|
const allCustomTools = [
|
|
38737
38801
|
...registeredTools,
|
|
38738
|
-
...this._customTools.map((definition) => ({
|
|
38802
|
+
...this._customTools.filter((definition) => !isMandatoryRuntimeTool(definition.name)).map((definition) => ({
|
|
38739
38803
|
definition,
|
|
38740
38804
|
sourceInfo: createSyntheticSourceInfo(`<sdk:${definition.name}>`, { source: "sdk" })
|
|
38741
38805
|
}))
|
|
@@ -38856,6 +38920,7 @@ function _buildRuntime(options) {
|
|
|
38856
38920
|
var agentSessionToolRegistryMethods;
|
|
38857
38921
|
var init_agent_session_tool_registry = __esm(() => {
|
|
38858
38922
|
init_extensions();
|
|
38923
|
+
init_mandatory_runtime_tools();
|
|
38859
38924
|
init_model_registry();
|
|
38860
38925
|
init_tools();
|
|
38861
38926
|
init_session_temp_dir();
|
|
@@ -39698,6 +39763,7 @@ class AgentSessionBase {
|
|
|
39698
39763
|
_postToolCompactionPreflightError = undefined;
|
|
39699
39764
|
_pendingPostToolCompactionGuard = undefined;
|
|
39700
39765
|
_terminatingToolCallIds = new Set;
|
|
39766
|
+
_stopAfterTurnBlockedContinuation = false;
|
|
39701
39767
|
_disposed = false;
|
|
39702
39768
|
_branchSummaryAbortController = undefined;
|
|
39703
39769
|
_sessionSummaryAbortController = undefined;
|
|
@@ -39846,11 +39912,12 @@ var init_builtin_packages = __esm(() => {
|
|
|
39846
39912
|
{ packageName: "@bastani/subagents", workspaceDirName: "subagents", distDirName: "subagents" },
|
|
39847
39913
|
{ packageName: "@bastani/mcp", workspaceDirName: "mcp", distDirName: "mcp" },
|
|
39848
39914
|
{ packageName: "@bastani/web-access", workspaceDirName: "web-access", distDirName: "web-access" },
|
|
39849
|
-
{ packageName: "@bastani/intercom", workspaceDirName: "intercom", distDirName: "intercom" }
|
|
39915
|
+
{ packageName: "@bastani/intercom", workspaceDirName: "intercom", distDirName: "intercom", mandatory: true }
|
|
39850
39916
|
];
|
|
39851
39917
|
BUILTIN_PACKAGES = WORKSPACE_BUILTINS.map((spec) => ({
|
|
39852
39918
|
packageName: spec.packageName,
|
|
39853
39919
|
distDirName: spec.distDirName,
|
|
39920
|
+
mandatory: spec.mandatory === true,
|
|
39854
39921
|
requiredEntries: requiredEntriesForBuiltin(spec.distDirName),
|
|
39855
39922
|
sourceCandidates: ({ here, packageDir, isSourceCheckout }) => isSourceCheckout ? [join37(packageDir, "..", spec.workspaceDirName), join37(here, "..", "..", "..", spec.workspaceDirName)] : []
|
|
39856
39923
|
}));
|
|
@@ -43196,7 +43263,9 @@ var init_resource_loader_extensions = __esm(() => {
|
|
|
43196
43263
|
var init_resource_loader_reload = __esm(() => {
|
|
43197
43264
|
init_event_loop();
|
|
43198
43265
|
init_paths();
|
|
43266
|
+
init_builtin_packages();
|
|
43199
43267
|
init_loader();
|
|
43268
|
+
init_mandatory_runtime_tools();
|
|
43200
43269
|
init_resource_loader_assets();
|
|
43201
43270
|
init_resource_loader_context_files();
|
|
43202
43271
|
init_resource_loader_discovery();
|
|
@@ -44353,6 +44422,28 @@ var init_settings_manager_ui_accessors = __esm(() => {
|
|
|
44353
44422
|
state.markModified("fullscreenExitOutput");
|
|
44354
44423
|
state.save();
|
|
44355
44424
|
},
|
|
44425
|
+
getFullscreenCopyOnSelect() {
|
|
44426
|
+
return settingsInternals(this).settings.fullscreenCopyOnSelect !== false;
|
|
44427
|
+
},
|
|
44428
|
+
setFullscreenCopyOnSelect(enabled) {
|
|
44429
|
+
const state = settingsInternals(this);
|
|
44430
|
+
state.globalSettings.fullscreenCopyOnSelect = enabled;
|
|
44431
|
+
state.markModified("fullscreenCopyOnSelect");
|
|
44432
|
+
state.save();
|
|
44433
|
+
},
|
|
44434
|
+
getTerminalCapabilityOverrides() {
|
|
44435
|
+
const terminal = settingsInternals(this).settings.terminal;
|
|
44436
|
+
const overrides = {};
|
|
44437
|
+
if (typeof terminal?.hyperlinks === "boolean")
|
|
44438
|
+
overrides.hyperlinks = terminal.hyperlinks;
|
|
44439
|
+
if (terminal?.images === "kitty" || terminal?.images === "iterm2")
|
|
44440
|
+
overrides.images = terminal.images;
|
|
44441
|
+
else if (terminal?.images === false)
|
|
44442
|
+
overrides.images = null;
|
|
44443
|
+
if (typeof terminal?.trueColor === "boolean")
|
|
44444
|
+
overrides.trueColor = terminal.trueColor;
|
|
44445
|
+
return overrides;
|
|
44446
|
+
},
|
|
44356
44447
|
getEditorPaddingX() {
|
|
44357
44448
|
return settingsInternals(this).settings.editorPaddingX ?? 0;
|
|
44358
44449
|
},
|
|
@@ -44498,6 +44589,14 @@ var init_resource_loader = __esm(() => {
|
|
|
44498
44589
|
init_resource_loader_core();
|
|
44499
44590
|
init_skill_catalog();
|
|
44500
44591
|
});
|
|
44592
|
+
// src/core/mandatory-resource-loader.ts
|
|
44593
|
+
var init_mandatory_resource_loader = __esm(() => {
|
|
44594
|
+
init_builtin_packages();
|
|
44595
|
+
init_loader();
|
|
44596
|
+
init_mandatory_runtime_tools();
|
|
44597
|
+
init_skill_catalog();
|
|
44598
|
+
});
|
|
44599
|
+
|
|
44501
44600
|
// src/core/model-resolver-defaults.ts
|
|
44502
44601
|
function findPreferredAvailableModel(availableModels) {
|
|
44503
44602
|
for (const [provider, defaultId] of Object.entries(defaultModelPerProvider)) {
|
|
@@ -44538,7 +44637,7 @@ var init_model_resolver_defaults = __esm(() => {
|
|
|
44538
44637
|
huggingface: "moonshotai/Kimi-K2.6",
|
|
44539
44638
|
fireworks: "accounts/fireworks/models/kimi-k2p6",
|
|
44540
44639
|
together: "moonshotai/Kimi-K2.6",
|
|
44541
|
-
baseten: "zai-org/GLM-5.
|
|
44640
|
+
baseten: "zai-org/GLM-5.3",
|
|
44542
44641
|
opencode: "kimi-k2.6",
|
|
44543
44642
|
"opencode-go": "kimi-k2.6",
|
|
44544
44643
|
"kimi-coding": "kimi-for-coding",
|
|
@@ -45196,6 +45295,7 @@ var init_session_cwd = __esm(() => {
|
|
|
45196
45295
|
var init_agent_session_services = __esm(() => {
|
|
45197
45296
|
init_config();
|
|
45198
45297
|
init_paths();
|
|
45298
|
+
init_mandatory_resource_loader();
|
|
45199
45299
|
init_model_runtime();
|
|
45200
45300
|
init_resource_loader();
|
|
45201
45301
|
init_sdk();
|
|
@@ -45532,6 +45632,7 @@ var init_sdk = __esm(() => {
|
|
|
45532
45632
|
init_agent_session();
|
|
45533
45633
|
init_auth_guidance();
|
|
45534
45634
|
init_codex_fast_mode();
|
|
45635
|
+
init_mandatory_resource_loader();
|
|
45535
45636
|
init_messages();
|
|
45536
45637
|
init_model_resolver();
|
|
45537
45638
|
init_model_runtime();
|
|
@@ -45635,7 +45736,12 @@ var init_list_models = __esm(() => {
|
|
|
45635
45736
|
});
|
|
45636
45737
|
|
|
45637
45738
|
// src/cli/startup-ui.ts
|
|
45638
|
-
import {
|
|
45739
|
+
import {
|
|
45740
|
+
ProcessTerminal,
|
|
45741
|
+
setCapabilityOverrides,
|
|
45742
|
+
setKeybindings,
|
|
45743
|
+
TuiMainScreen
|
|
45744
|
+
} from "@earendil-works/pi-tui";
|
|
45639
45745
|
var init_startup_ui = __esm(() => {
|
|
45640
45746
|
init_config();
|
|
45641
45747
|
init_keybindings();
|
|
@@ -45723,7 +45829,7 @@ var init_main_first_time_setup = __esm(() => {
|
|
|
45723
45829
|
init_startup_ui();
|
|
45724
45830
|
});
|
|
45725
45831
|
// src/cli/session-picker.ts
|
|
45726
|
-
import { ProcessTerminal as ProcessTerminal2, setKeybindings as setKeybindings2, TuiMainScreen as TuiMainScreen2 } from "@earendil-works/pi-tui";
|
|
45832
|
+
import { ProcessTerminal as ProcessTerminal2, setCapabilityOverrides as setCapabilityOverrides2, setKeybindings as setKeybindings2, TuiMainScreen as TuiMainScreen2 } from "@earendil-works/pi-tui";
|
|
45727
45833
|
var init_session_picker = __esm(() => {
|
|
45728
45834
|
init_config();
|
|
45729
45835
|
init_keybindings();
|
|
@@ -45731,7 +45837,7 @@ var init_session_picker = __esm(() => {
|
|
|
45731
45837
|
});
|
|
45732
45838
|
|
|
45733
45839
|
// src/main-session.ts
|
|
45734
|
-
import { ProcessTerminal as ProcessTerminal3, setKeybindings as setKeybindings3, TuiMainScreen as TuiMainScreen3 } from "@earendil-works/pi-tui";
|
|
45840
|
+
import { ProcessTerminal as ProcessTerminal3, setCapabilityOverrides as setCapabilityOverrides3, setKeybindings as setKeybindings3, TuiMainScreen as TuiMainScreen3 } from "@earendil-works/pi-tui";
|
|
45735
45841
|
import chalk10 from "chalk";
|
|
45736
45842
|
var init_main_session = __esm(() => {
|
|
45737
45843
|
init_session_picker();
|
|
@@ -48549,7 +48655,7 @@ var init_slash_commands = __esm(() => {
|
|
|
48549
48655
|
{ name: "tree", description: "Navigate session tree (switch branches)" },
|
|
48550
48656
|
{ name: "thinking", description: "Set thinking level", argumentHint: "<level>" },
|
|
48551
48657
|
{ name: "scoped-models", description: "Enable/disable models for ctrl+p cycling" },
|
|
48552
|
-
{ name: "fast", description: "Configure
|
|
48658
|
+
{ name: "fast", description: "Configure fast mode for chat and workflows on supported models" },
|
|
48553
48659
|
{ name: "export", description: "Export session (HTML default, or specify path: .html/.jsonl)" },
|
|
48554
48660
|
{ name: "import", description: "Import and resume a session from a JSONL file" },
|
|
48555
48661
|
{ name: "share", description: "Share session as a secret GitHub gist" },
|
|
@@ -49175,6 +49281,7 @@ function createFullscreenTui(options) {
|
|
|
49175
49281
|
openUrl: openBrowser
|
|
49176
49282
|
}),
|
|
49177
49283
|
onRightClickPaste: options.onRightClickPaste,
|
|
49284
|
+
copyOnSelect: options.copyOnSelect,
|
|
49178
49285
|
copySelection: options.copySelection ?? copySelectionToHostClipboard
|
|
49179
49286
|
}, options.shouldHandleViewportInput, options.onOverlayUnhandledInput);
|
|
49180
49287
|
}
|
|
@@ -49216,7 +49323,7 @@ function createInteractiveTuiReference(getTui) {
|
|
|
49216
49323
|
getPrototypeOf: () => Reflect.getPrototypeOf(getTui())
|
|
49217
49324
|
});
|
|
49218
49325
|
}
|
|
49219
|
-
var viewportInputListeners, viewportInputGates, overlayUnhandledInputHandlers, viewportInputReplays, viewportInputSubscriptions, SGR_MOUSE_SEQUENCE, LEFT_MOUSE_MODIFIER_MASK, AtomicTuiAltScreen, AtomicTuiMainScreen;
|
|
49326
|
+
var viewportInputListeners, viewportInputGates, overlayUnhandledInputHandlers, viewportInputReplays, overlayOwnedSelections, viewportInputSubscriptions, SGR_MOUSE_SEQUENCE, LEFT_MOUSE_MODIFIER_MASK, AtomicTuiAltScreen, AtomicTuiMainScreen;
|
|
49220
49327
|
var init_interactive_tui = __esm(() => {
|
|
49221
49328
|
init_clipboard();
|
|
49222
49329
|
init_open_browser();
|
|
@@ -49225,6 +49332,7 @@ var init_interactive_tui = __esm(() => {
|
|
|
49225
49332
|
viewportInputGates = new WeakMap;
|
|
49226
49333
|
overlayUnhandledInputHandlers = new WeakMap;
|
|
49227
49334
|
viewportInputReplays = new WeakSet;
|
|
49335
|
+
overlayOwnedSelections = new WeakSet;
|
|
49228
49336
|
viewportInputSubscriptions = new WeakMap;
|
|
49229
49337
|
SGR_MOUSE_SEQUENCE = /^\x1b\[<(\d+);\d+;\d+([Mm])/;
|
|
49230
49338
|
LEFT_MOUSE_MODIFIER_MASK = 4 | 8 | 16;
|
|
@@ -49240,8 +49348,20 @@ var init_interactive_tui = __esm(() => {
|
|
|
49240
49348
|
deferral.shouldDeferViewportInputToOverlay = () => !viewportInputReplays.has(this) && deferToOverlay?.() === true;
|
|
49241
49349
|
}
|
|
49242
49350
|
applyLineResets(lines) {
|
|
49351
|
+
if (overlayOwnedSelections.has(this) && !this.isFocusedOverlay())
|
|
49352
|
+
this.clearOverlayOwnedSelection();
|
|
49243
49353
|
return stripOverlayActiveRowMarker(super.applyLineResets(lines));
|
|
49244
49354
|
}
|
|
49355
|
+
clearOverlayOwnedSelection() {
|
|
49356
|
+
const selection = this;
|
|
49357
|
+
selection.selectionAnchor = undefined;
|
|
49358
|
+
selection.selectionFocus = undefined;
|
|
49359
|
+
selection.selectionInitialRange = undefined;
|
|
49360
|
+
selection.selectionPressActive = false;
|
|
49361
|
+
selection.selectionDragged = false;
|
|
49362
|
+
selection.lastClick = undefined;
|
|
49363
|
+
overlayOwnedSelections.delete(this);
|
|
49364
|
+
}
|
|
49245
49365
|
isPiTuiMouseSequence(data) {
|
|
49246
49366
|
if (parseMouseSequences(data))
|
|
49247
49367
|
return true;
|
|
@@ -49318,6 +49438,7 @@ var init_interactive_tui = __esm(() => {
|
|
|
49318
49438
|
if (isLeftMouseButton(sequence))
|
|
49319
49439
|
viewportListener(sequence.data);
|
|
49320
49440
|
}
|
|
49441
|
+
overlayOwnedSelections.add(this);
|
|
49321
49442
|
}
|
|
49322
49443
|
replayViewportInput(viewportListener, data) {
|
|
49323
49444
|
viewportInputReplays.add(this);
|
|
@@ -49385,7 +49506,11 @@ var init_interactive_tui = __esm(() => {
|
|
|
49385
49506
|
});
|
|
49386
49507
|
|
|
49387
49508
|
// src/modes/interactive/interactive-mode-base.ts
|
|
49388
|
-
import {
|
|
49509
|
+
import {
|
|
49510
|
+
isKeyRelease as isKeyRelease3,
|
|
49511
|
+
isViewportTUI,
|
|
49512
|
+
setCapabilityOverrides as setCapabilityOverrides4
|
|
49513
|
+
} from "@earendil-works/pi-tui";
|
|
49389
49514
|
function isFullscreenViewportAction(data, keybindings) {
|
|
49390
49515
|
return FULLSCREEN_VIEWPORT_ACTIONS.some((action) => keybindings.matches(data, action));
|
|
49391
49516
|
}
|
|
@@ -49446,6 +49571,18 @@ class InteractiveModeBase {
|
|
|
49446
49571
|
return false;
|
|
49447
49572
|
return this.defaultEditor.handleInput(data);
|
|
49448
49573
|
}
|
|
49574
|
+
setFullscreenCopyOnSelect(enabled) {
|
|
49575
|
+
if (this.renderer.mode === "fullscreen")
|
|
49576
|
+
this.renderer.setCopyOnSelect(enabled);
|
|
49577
|
+
}
|
|
49578
|
+
getFullscreenCopyOnSelect() {
|
|
49579
|
+
return this.renderer.mode === "fullscreen" ? this.renderer.getCopyOnSelect() : undefined;
|
|
49580
|
+
}
|
|
49581
|
+
async copyActiveFullscreenSelection() {
|
|
49582
|
+
if (this.renderer.mode !== "fullscreen" || !this.renderer.hasActiveSelection())
|
|
49583
|
+
return;
|
|
49584
|
+
return this.renderer.copyActiveSelectionToClipboard();
|
|
49585
|
+
}
|
|
49449
49586
|
onRightClickPaste = () => {
|
|
49450
49587
|
this.handleRightClickPaste();
|
|
49451
49588
|
};
|
|
@@ -49645,11 +49782,13 @@ class InteractiveModeBase {
|
|
|
49645
49782
|
await this.rebindCurrentSession();
|
|
49646
49783
|
await this.themeController.applyFromSettings();
|
|
49647
49784
|
});
|
|
49785
|
+
setCapabilityOverrides4(this.settingsManager.getTerminalCapabilityOverrides());
|
|
49648
49786
|
this.version = VERSION;
|
|
49649
49787
|
this.renderer = createInteractiveTui({
|
|
49650
49788
|
showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
|
|
49651
49789
|
logDirectory: runtimeHost.services.agentDir,
|
|
49652
49790
|
terminal: options.terminal,
|
|
49791
|
+
copyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
|
|
49653
49792
|
onRightClickPaste: this.onRightClickPaste,
|
|
49654
49793
|
shouldHandleViewportInput: this.shouldHandleViewportInput,
|
|
49655
49794
|
onOverlayUnhandledInput: this.onOverlayUnhandledInput,
|
|
@@ -50772,6 +50911,7 @@ var init_interactive_deferred_startup = __esm(() => {
|
|
|
50772
50911
|
try {
|
|
50773
50912
|
await this.bindCurrentSessionExtensions();
|
|
50774
50913
|
await this.session.reload({ reason: "startup" });
|
|
50914
|
+
this.applyRuntimeSettings();
|
|
50775
50915
|
this.rebuildChatFromMessages();
|
|
50776
50916
|
if (!this.promptTurnWorkingLoaderActive) {
|
|
50777
50917
|
this.stopWorkingLoader();
|
|
@@ -51460,6 +51600,7 @@ ${warningLines}`, 0, 0));
|
|
|
51460
51600
|
});
|
|
51461
51601
|
|
|
51462
51602
|
// src/modes/interactive/interactive-session-runtime.ts
|
|
51603
|
+
import { setCapabilityOverrides as setCapabilityOverrides5 } from "@earendil-works/pi-tui";
|
|
51463
51604
|
var init_interactive_session_runtime = __esm(() => {
|
|
51464
51605
|
init_interactive_mode_base();
|
|
51465
51606
|
init_interactive_mode_deps();
|
|
@@ -51546,6 +51687,8 @@ var init_interactive_session_runtime = __esm(() => {
|
|
|
51546
51687
|
}
|
|
51547
51688
|
};
|
|
51548
51689
|
InteractiveModeBase.prototype.applyRuntimeSettings = function() {
|
|
51690
|
+
setCapabilityOverrides5(this.settingsManager.getTerminalCapabilityOverrides());
|
|
51691
|
+
this.setFullscreenCopyOnSelect(this.settingsManager.getFullscreenCopyOnSelect());
|
|
51549
51692
|
this.transcriptScrollView?.setScrollbar(this.settingsManager.getFullscreenScrollbar());
|
|
51550
51693
|
this.footer.setSession(this.session);
|
|
51551
51694
|
this.usageMeter.setSession(this.session);
|
|
@@ -53062,6 +53205,9 @@ var init_interactive_input_handling = __esm(() => {
|
|
|
53062
53205
|
});
|
|
53063
53206
|
this.defaultEditor.onAction("app.message.followUp", () => this.handleFollowUp());
|
|
53064
53207
|
this.defaultEditor.onAction("app.message.dequeue", () => this.handleDequeue());
|
|
53208
|
+
this.defaultEditor.onAction("app.message.copy", () => {
|
|
53209
|
+
this.handleCopyCommand({ preferSelection: true });
|
|
53210
|
+
});
|
|
53065
53211
|
this.defaultEditor.onAction("app.session.new", () => this.handleClearCommand());
|
|
53066
53212
|
this.defaultEditor.onAction("app.session.tree", () => this.showTreeSelector());
|
|
53067
53213
|
this.defaultEditor.onAction("app.session.fork", () => this.showUserMessageSelector());
|
|
@@ -53969,7 +54115,8 @@ var init_interactive_agent_events = __esm(() => {
|
|
|
53969
54115
|
} else if (event.reason === "manual") {
|
|
53970
54116
|
this.manualCompactionTakeoverPending = false;
|
|
53971
54117
|
}
|
|
53972
|
-
|
|
54118
|
+
const resumesActiveRun = event.midTurn && !event.aborted && !event.errorMessage && !manualTakeoverPending;
|
|
54119
|
+
if (!manualTakeoverPending && !resumesActiveRun && this.settingsManager.getShowTerminalProgress()) {
|
|
53973
54120
|
this.ui.terminal.setProgress(false);
|
|
53974
54121
|
}
|
|
53975
54122
|
if (!manualTakeoverPending && this.autoCompactionEscapeHandlerSaved) {
|
|
@@ -54985,7 +55132,7 @@ var init_interactive_selectors = __esm(() => {
|
|
|
54985
55132
|
};
|
|
54986
55133
|
InteractiveModeBase.prototype.showFastModeSelector = function() {
|
|
54987
55134
|
if (!this.hasCodexFastModeSupportedModels()) {
|
|
54988
|
-
this.showWarning("
|
|
55135
|
+
this.showWarning("Fast mode isn't available for any configured model.");
|
|
54989
55136
|
return;
|
|
54990
55137
|
}
|
|
54991
55138
|
this.showSelector((done) => {
|
|
@@ -55044,6 +55191,7 @@ var init_interactive_selectors = __esm(() => {
|
|
|
55044
55191
|
showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
|
|
55045
55192
|
fullscreenScrollbar: this.settingsManager.getFullscreenScrollbar(),
|
|
55046
55193
|
fullscreenExitOutput: this.settingsManager.getFullscreenExitOutput(),
|
|
55194
|
+
fullscreenCopyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
|
|
55047
55195
|
editorPaddingX: this.settingsManager.getEditorPaddingX(),
|
|
55048
55196
|
outputPad: this.settingsManager.getOutputPad(),
|
|
55049
55197
|
showCacheMissNotices: this.settingsManager.getShowCacheMissNotices(),
|
|
@@ -55161,6 +55309,10 @@ var init_interactive_selectors = __esm(() => {
|
|
|
55161
55309
|
onFullscreenExitOutputChange: (output) => {
|
|
55162
55310
|
this.settingsManager.setFullscreenExitOutput(output);
|
|
55163
55311
|
},
|
|
55312
|
+
onFullscreenCopyOnSelectChange: (enabled) => {
|
|
55313
|
+
this.settingsManager.setFullscreenCopyOnSelect(enabled);
|
|
55314
|
+
this.setFullscreenCopyOnSelect(enabled);
|
|
55315
|
+
},
|
|
55164
55316
|
onEditorPaddingXChange: (padding) => {
|
|
55165
55317
|
this.settingsManager.setEditorPaddingX(padding);
|
|
55166
55318
|
this.defaultEditor.setPaddingX(padding);
|
|
@@ -56147,18 +56299,8 @@ var init_interactive_slash_commands = __esm(() => {
|
|
|
56147
56299
|
activeHeader.setExpanded(this.toolOutputExpanded);
|
|
56148
56300
|
}
|
|
56149
56301
|
setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
|
|
56150
|
-
this.
|
|
56302
|
+
this.applyRuntimeSettings();
|
|
56151
56303
|
await this.themeController.applyFromSettings();
|
|
56152
|
-
const editorPaddingX = this.settingsManager.getEditorPaddingX();
|
|
56153
|
-
const autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();
|
|
56154
|
-
this.defaultEditor.setPaddingX(editorPaddingX);
|
|
56155
|
-
this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);
|
|
56156
|
-
if (this.editor !== this.defaultEditor) {
|
|
56157
|
-
this.editor.setPaddingX?.(editorPaddingX);
|
|
56158
|
-
this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);
|
|
56159
|
-
}
|
|
56160
|
-
this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());
|
|
56161
|
-
this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
|
|
56162
56304
|
this.setupAutocompleteProvider();
|
|
56163
56305
|
const runner = this.session.extensionRunner;
|
|
56164
56306
|
this.setupExtensionShortcuts(runner);
|
|
@@ -56351,7 +56493,12 @@ Gist: ${hyperlink3(gistUrl, gistUrl)}`);
|
|
|
56351
56493
|
}
|
|
56352
56494
|
}
|
|
56353
56495
|
};
|
|
56354
|
-
InteractiveModeBase.prototype.handleCopyCommand = async function() {
|
|
56496
|
+
InteractiveModeBase.prototype.handleCopyCommand = async function(options = {}) {
|
|
56497
|
+
if (options.preferSelection && this.getFullscreenCopyOnSelect() === false) {
|
|
56498
|
+
const selectionCopied = await this.copyActiveFullscreenSelection();
|
|
56499
|
+
if (selectionCopied !== undefined)
|
|
56500
|
+
return;
|
|
56501
|
+
}
|
|
56355
56502
|
const text = this.session.getLastAssistantText();
|
|
56356
56503
|
if (!text) {
|
|
56357
56504
|
this.showError("No agent messages to copy yet.");
|
|
@@ -56898,6 +57045,7 @@ var init_rpc_extension_ui = __esm(() => {
|
|
|
56898
57045
|
});
|
|
56899
57046
|
|
|
56900
57047
|
// src/modes/rpc/rpc-session-binding.ts
|
|
57048
|
+
import { setCapabilityOverrides as setCapabilityOverrides6 } from "@earendil-works/pi-tui";
|
|
56901
57049
|
var init_rpc_session_binding = __esm(() => {
|
|
56902
57050
|
init_footer_data_provider();
|
|
56903
57051
|
init_output_guard();
|
|
@@ -56974,7 +57122,7 @@ var init_config_selector = __esm(() => {
|
|
|
56974
57122
|
});
|
|
56975
57123
|
|
|
56976
57124
|
// src/cli/config-selector.ts
|
|
56977
|
-
import { ProcessTerminal as ProcessTerminal6, TuiMainScreen as TuiMainScreen8 } from "@earendil-works/pi-tui";
|
|
57125
|
+
import { ProcessTerminal as ProcessTerminal6, setCapabilityOverrides as setCapabilityOverrides7, TuiMainScreen as TuiMainScreen8 } from "@earendil-works/pi-tui";
|
|
56978
57126
|
var init_config_selector2 = __esm(() => {
|
|
56979
57127
|
init_config_selector();
|
|
56980
57128
|
init_theme();
|
|
@@ -57021,6 +57169,7 @@ var init_package_manager_cli = __esm(() => {
|
|
|
57021
57169
|
});
|
|
57022
57170
|
|
|
57023
57171
|
// src/main.ts
|
|
57172
|
+
import { setCapabilityOverrides as setCapabilityOverrides8 } from "@earendil-works/pi-tui";
|
|
57024
57173
|
import chalk15 from "chalk";
|
|
57025
57174
|
var init_main = __esm(() => {
|
|
57026
57175
|
init_args();
|
|
@@ -57035,6 +57184,7 @@ var init_main = __esm(() => {
|
|
|
57035
57184
|
init_auth_storage();
|
|
57036
57185
|
init_builtin_packages();
|
|
57037
57186
|
init_http_dispatcher();
|
|
57187
|
+
init_mandatory_resource_loader();
|
|
57038
57188
|
init_model_resolver();
|
|
57039
57189
|
init_model_runtime();
|
|
57040
57190
|
init_output_guard();
|
|
@@ -63604,8 +63754,8 @@ class ScopedDurableBackend {
|
|
|
63604
63754
|
async recordAdditiveCheckpointBestEffort(checkpoint) {
|
|
63605
63755
|
return await this.inner.recordAdditiveCheckpointBestEffort(this.remap(checkpoint));
|
|
63606
63756
|
}
|
|
63607
|
-
flush() {
|
|
63608
|
-
return this.inner.flush();
|
|
63757
|
+
flush(workflowId) {
|
|
63758
|
+
return workflowId === undefined ? this.inner.flush() : this.inner.flush(this.scope.rootWorkflowId);
|
|
63609
63759
|
}
|
|
63610
63760
|
getToolOutput(_workflowId, argsHash) {
|
|
63611
63761
|
return this.inner.getToolOutput(this.scope.rootWorkflowId, this.scopeKey(argsHash));
|
|
@@ -67486,17 +67636,7 @@ function resolveStageGroup(stageOptions, workflowGroup) {
|
|
|
67486
67636
|
const trimmed = group.trim();
|
|
67487
67637
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
67488
67638
|
}
|
|
67489
|
-
function stageHasIntercomAccess(
|
|
67490
|
-
if (!stageOptions)
|
|
67491
|
-
return true;
|
|
67492
|
-
if (stageOptions.noTools === "all")
|
|
67493
|
-
return false;
|
|
67494
|
-
const tools = stageOptions.tools;
|
|
67495
|
-
if (Array.isArray(tools) && !tools.includes("intercom"))
|
|
67496
|
-
return false;
|
|
67497
|
-
const excluded = stageOptions.excludedTools;
|
|
67498
|
-
if (Array.isArray(excluded) && excluded.includes("intercom"))
|
|
67499
|
-
return false;
|
|
67639
|
+
function stageHasIntercomAccess(_stageOptions) {
|
|
67500
67640
|
return true;
|
|
67501
67641
|
}
|
|
67502
67642
|
function stageCanUseWorkflowPendingStageRoute(stageOptions, workflowGroup) {
|
|
@@ -67952,11 +68092,11 @@ function wrapUiWithDurable(base, deps) {
|
|
|
67952
68092
|
};
|
|
67953
68093
|
const releasePending = async (identity, token) => {
|
|
67954
68094
|
releaseDurablePrompt(deps.backend, deps.workflowId, identity.hash, token);
|
|
67955
|
-
await deps.backend.flush();
|
|
68095
|
+
await deps.backend.flush(deps.workflowId);
|
|
67956
68096
|
};
|
|
67957
68097
|
const beginPending = (identity) => {
|
|
67958
68098
|
const token = reserveDurablePrompt(deps.backend, deps.workflowId, identity.hash);
|
|
67959
|
-
const write = deps.backend.flush();
|
|
68099
|
+
const write = deps.backend.flush(deps.workflowId);
|
|
67960
68100
|
return { token, write };
|
|
67961
68101
|
};
|
|
67962
68102
|
const waitForPendingWrite = async (identity, pending) => {
|
|
@@ -67967,7 +68107,7 @@ function wrapUiWithDurable(base, deps) {
|
|
|
67967
68107
|
} catch (error) {
|
|
67968
68108
|
releaseDurablePrompt(deps.backend, deps.workflowId, identity.hash, pending.token);
|
|
67969
68109
|
try {
|
|
67970
|
-
await deps.backend.flush();
|
|
68110
|
+
await deps.backend.flush(deps.workflowId);
|
|
67971
68111
|
} catch {}
|
|
67972
68112
|
throw error;
|
|
67973
68113
|
}
|
|
@@ -68315,7 +68455,7 @@ async function admitDurableRootRun(args) {
|
|
|
68315
68455
|
args.backend.setWorkflowStatus(args.runId, "running");
|
|
68316
68456
|
}
|
|
68317
68457
|
if (!args.isChildRun)
|
|
68318
|
-
await args.backend.flush();
|
|
68458
|
+
await args.backend.flush(args.runId);
|
|
68319
68459
|
}
|
|
68320
68460
|
|
|
68321
68461
|
// dist/builtin/workflows/src/shared/returned-run-status.ts
|
|
@@ -68439,7 +68579,7 @@ async function finalizeDurableTerminalStatus(input2) {
|
|
|
68439
68579
|
} : undefined;
|
|
68440
68580
|
input2.durableBackend.setWorkflowStatus(input2.runId, durableStatus, undefined, input2.runSnapshot.resumable, failure2);
|
|
68441
68581
|
}
|
|
68442
|
-
await input2.durableBackend.flush();
|
|
68582
|
+
await input2.durableBackend.flush(input2.runId);
|
|
68443
68583
|
}
|
|
68444
68584
|
function toDurableStatus(status) {
|
|
68445
68585
|
switch (status) {
|
|
@@ -74759,7 +74899,7 @@ async function run(def, inputs, opts = {}) {
|
|
|
74759
74899
|
const result = normalizeWorkflowRunOutput(def.name, rawResult);
|
|
74760
74900
|
assertWorkflowRunOutputs(def.name, result, def.outputs);
|
|
74761
74901
|
assertWorkflowCreatedExecution(runSnapshot);
|
|
74762
|
-
await durableBackend.flush();
|
|
74902
|
+
await durableBackend.flush(runId);
|
|
74763
74903
|
const returned = classifyReturnedRunStatus(result, runSnapshot);
|
|
74764
74904
|
const recorded = activeStore.recordRunEnd(runId, returned.status, result, returned.error, returned.metadata);
|
|
74765
74905
|
appendRunEndWhenRecorded(opts.persistence, recorded, {
|
|
@@ -74775,7 +74915,7 @@ async function run(def, inputs, opts = {}) {
|
|
|
74775
74915
|
if (opts.parentRun === undefined)
|
|
74776
74916
|
recordRunTimingCheckpoint(durableBackend, runSnapshot);
|
|
74777
74917
|
durableBackend.setWorkflowStatus(runId, returned.status, undefined, returned.metadata?.resumable);
|
|
74778
|
-
await durableBackend.flush();
|
|
74918
|
+
await durableBackend.flush(runId);
|
|
74779
74919
|
return reconcileTerminalRunResult(runId, runSnapshot, activeStore, { status: returned.status, result, error: returned.error }, opts.onRunEnd);
|
|
74780
74920
|
} catch (err) {
|
|
74781
74921
|
terminalEvents.selectFailure(err);
|