@bastani/atomic 0.9.16-alpha.8 → 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 +126 -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 +556 -185
- 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 +268 -54
- 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 +488 -142
- package/dist/builtin/web-access/index.bundle.mjs +268 -54
- 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-zf28603f.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-v04c5qmd.js → chunk-bz1c9732.js} +15 -3
- package/dist/builtin/workflows/builtin/{chunk-cdtd3m3w.js → chunk-dattsgxg.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-5n10x7j2.js → chunk-gdx0avpx.js} +421 -69
- package/dist/builtin/workflows/builtin/{chunk-hdpj1dkw.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 +597 -145
- package/dist/builtin/workflows/src/index.js +278 -74
- 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/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/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-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/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/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/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/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-extension-runtime.js +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.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 +20 -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
|
@@ -1126,15 +1126,15 @@ ${chalk.bold("Options:")}
|
|
|
1126
1126
|
--name, -n <name> Set session display name
|
|
1127
1127
|
--models <patterns> Comma-separated model patterns for ctrl+p cycling
|
|
1128
1128
|
Supports globs (anthropic/*, *sonnet*) and fuzzy matching
|
|
1129
|
-
--no-tools, -nt Disable
|
|
1129
|
+
--no-tools, -nt Disable every tool except mandatory ordinary intercom
|
|
1130
1130
|
--no-builtin-tools, -nbt Disable built-in tools by default but keep extension/custom tools enabled
|
|
1131
|
-
--tools, -t <tools> Comma-separated allowlist of tool names
|
|
1132
|
-
|
|
1133
|
-
--exclude-tools, -xt <tools> Comma-separated denylist of tool names
|
|
1134
|
-
|
|
1131
|
+
--tools, -t <tools> Comma-separated allowlist of non-mandatory tool names
|
|
1132
|
+
Mandatory ordinary intercom remains available
|
|
1133
|
+
--exclude-tools, -xt <tools> Comma-separated denylist of non-mandatory tool names
|
|
1134
|
+
Mandatory ordinary intercom cannot be excluded
|
|
1135
1135
|
--thinking <level> Set thinking level: off, minimal, low, medium, high, xhigh, max
|
|
1136
1136
|
--extension, -e <path> Load an extension file (can be used multiple times)
|
|
1137
|
-
--no-extensions, -ne Disable extension discovery
|
|
1137
|
+
--no-extensions, -ne Disable optional extension discovery; mandatory bundled Intercom remains loaded
|
|
1138
1138
|
--skill <path> Load a skill file or directory (can be used multiple times)
|
|
1139
1139
|
--no-skills, -ns Disable skills discovery and loading
|
|
1140
1140
|
--prompt-template <path> Load a prompt template file or directory (can be used multiple times)
|
|
@@ -10019,11 +10019,13 @@ function runSynchronousCallback(descriptor, callback) {
|
|
|
10019
10019
|
}
|
|
10020
10020
|
}
|
|
10021
10021
|
async function runCallback(descriptor, callback) {
|
|
10022
|
+
if (!reporter)
|
|
10023
|
+
return callback();
|
|
10024
|
+
await yieldToEventLoop();
|
|
10022
10025
|
const active = beginActivity(descriptor);
|
|
10023
10026
|
if (!active)
|
|
10024
10027
|
return callback();
|
|
10025
10028
|
try {
|
|
10026
|
-
await yieldToEventLoop();
|
|
10027
10029
|
return await callback();
|
|
10028
10030
|
} finally {
|
|
10029
10031
|
active.reporter.finished(active.activity.id);
|
|
@@ -13013,12 +13015,45 @@ var init_runner_events = __esm(() => {
|
|
|
13013
13015
|
init_callback_activity();
|
|
13014
13016
|
});
|
|
13015
13017
|
|
|
13018
|
+
// src/core/mandatory-runtime-tools.ts
|
|
13019
|
+
function markTrustedMandatoryRuntimeExtension(extension) {
|
|
13020
|
+
extension.sourceInfo = { ...extension.sourceInfo, configurationOrigin: "bundled" };
|
|
13021
|
+
for (const registration of extension.tools.values()) {
|
|
13022
|
+
registration.sourceInfo = extension.sourceInfo;
|
|
13023
|
+
if (MANDATORY_TOOL_NAMES.has(registration.definition.name)) {
|
|
13024
|
+
TRUSTED_MANDATORY_DEFINITIONS.add(registration.definition);
|
|
13025
|
+
}
|
|
13026
|
+
}
|
|
13027
|
+
for (const command of extension.commands.values())
|
|
13028
|
+
command.sourceInfo = extension.sourceInfo;
|
|
13029
|
+
}
|
|
13030
|
+
function isTrustedMandatoryRuntimeTool(registration) {
|
|
13031
|
+
return MANDATORY_TOOL_NAMES.has(registration.definition.name) && TRUSTED_MANDATORY_DEFINITIONS.has(registration.definition);
|
|
13032
|
+
}
|
|
13033
|
+
function isMandatoryRuntimeTool(name) {
|
|
13034
|
+
return MANDATORY_TOOL_NAMES.has(name);
|
|
13035
|
+
}
|
|
13036
|
+
function appendRegisteredMandatoryTools(tools, registry) {
|
|
13037
|
+
for (const name of MANDATORY_TOOL_NAMES) {
|
|
13038
|
+
const tool = registry.get(name);
|
|
13039
|
+
if (tool && !tools.some((candidate) => candidate.name === name))
|
|
13040
|
+
tools.push(tool);
|
|
13041
|
+
}
|
|
13042
|
+
return tools;
|
|
13043
|
+
}
|
|
13044
|
+
var MANDATORY_TOOL_NAMES, TRUSTED_MANDATORY_DEFINITIONS;
|
|
13045
|
+
var init_mandatory_runtime_tools = __esm(() => {
|
|
13046
|
+
MANDATORY_TOOL_NAMES = new Set(["intercom"]);
|
|
13047
|
+
TRUSTED_MANDATORY_DEFINITIONS = new WeakSet;
|
|
13048
|
+
});
|
|
13049
|
+
|
|
13016
13050
|
// src/core/extensions/runner-registries.ts
|
|
13017
13051
|
function collectRegisteredTools(extensions) {
|
|
13018
13052
|
const toolsByName = new Map;
|
|
13019
13053
|
for (const ext of extensions) {
|
|
13020
13054
|
for (const tool of ext.tools.values()) {
|
|
13021
|
-
|
|
13055
|
+
const existing = toolsByName.get(tool.definition.name);
|
|
13056
|
+
if (!existing || isMandatoryRuntimeTool(tool.definition.name) && isTrustedMandatoryRuntimeTool(tool)) {
|
|
13022
13057
|
toolsByName.set(tool.definition.name, tool);
|
|
13023
13058
|
}
|
|
13024
13059
|
}
|
|
@@ -13026,13 +13061,16 @@ function collectRegisteredTools(extensions) {
|
|
|
13026
13061
|
return Array.from(toolsByName.values());
|
|
13027
13062
|
}
|
|
13028
13063
|
function findToolDefinition(extensions, toolName) {
|
|
13064
|
+
let first;
|
|
13029
13065
|
for (const ext of extensions) {
|
|
13030
13066
|
const tool = ext.tools.get(toolName);
|
|
13031
|
-
if (tool)
|
|
13067
|
+
if (!tool)
|
|
13068
|
+
continue;
|
|
13069
|
+
first ??= tool;
|
|
13070
|
+
if (isMandatoryRuntimeTool(toolName) && isTrustedMandatoryRuntimeTool(tool))
|
|
13032
13071
|
return tool.definition;
|
|
13033
|
-
}
|
|
13034
13072
|
}
|
|
13035
|
-
return;
|
|
13073
|
+
return first?.definition;
|
|
13036
13074
|
}
|
|
13037
13075
|
function collectFlags(extensions) {
|
|
13038
13076
|
const allFlags = new Map;
|
|
@@ -13100,6 +13138,9 @@ function resolveRegisteredCommands(extensions) {
|
|
|
13100
13138
|
return { ...command, invocationName };
|
|
13101
13139
|
});
|
|
13102
13140
|
}
|
|
13141
|
+
var init_runner_registries = __esm(() => {
|
|
13142
|
+
init_mandatory_runtime_tools();
|
|
13143
|
+
});
|
|
13103
13144
|
|
|
13104
13145
|
// src/core/extensions/runner-shortcuts.ts
|
|
13105
13146
|
function resolveExtensionShortcuts(extensions, resolvedKeybindings, hasUI) {
|
|
@@ -13163,6 +13204,7 @@ var init_runner_shortcuts = __esm(() => {
|
|
|
13163
13204
|
"app.thinking.toggle",
|
|
13164
13205
|
"app.editor.external",
|
|
13165
13206
|
"app.message.followUp",
|
|
13207
|
+
"app.message.copy",
|
|
13166
13208
|
"tui.input.submit",
|
|
13167
13209
|
"tui.select.confirm",
|
|
13168
13210
|
"tui.select.cancel",
|
|
@@ -13317,6 +13359,8 @@ class ExtensionRunner {
|
|
|
13317
13359
|
shortcutDiagnostics = [];
|
|
13318
13360
|
commandDiagnostics = [];
|
|
13319
13361
|
staleMessage;
|
|
13362
|
+
uiPromptBinding = 0;
|
|
13363
|
+
activeUIPrompt;
|
|
13320
13364
|
constructor(extensions, runtime, cwd, sessionManager, modelRegistry, orchestrationContext, subagentPolicy) {
|
|
13321
13365
|
this.extensions = extensions;
|
|
13322
13366
|
this.runtime = runtime;
|
|
@@ -13411,9 +13455,71 @@ class ExtensionRunner {
|
|
|
13411
13455
|
this.reloadHandler = async () => {};
|
|
13412
13456
|
}
|
|
13413
13457
|
setUIContext(uiContext, mode = "print") {
|
|
13414
|
-
this.
|
|
13458
|
+
this.endActiveUIPrompt();
|
|
13459
|
+
const binding = ++this.uiPromptBinding;
|
|
13460
|
+
this.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;
|
|
13415
13461
|
this.mode = mode;
|
|
13416
13462
|
}
|
|
13463
|
+
wrapUIPromptContext(ui, binding) {
|
|
13464
|
+
return {
|
|
13465
|
+
...ui,
|
|
13466
|
+
select: (title, options, opts) => this.withUIPrompt(binding, "select", title, () => ui.select(title, options, opts)),
|
|
13467
|
+
confirm: (title, message, opts) => this.withUIPrompt(binding, "confirm", title, () => ui.confirm(title, message, opts)),
|
|
13468
|
+
input: (title, placeholder, opts) => this.withUIPrompt(binding, "input", title, () => ui.input(title, placeholder, opts)),
|
|
13469
|
+
editor: (title, prefill, opts) => this.withUIPrompt(binding, "editor", title, () => ui.editor(title, prefill, opts)),
|
|
13470
|
+
custom: (factory, options) => this.withUIPrompt(binding, "custom", undefined, () => ui.custom(factory, options))
|
|
13471
|
+
};
|
|
13472
|
+
}
|
|
13473
|
+
withUIPrompt(binding, kind, title, run) {
|
|
13474
|
+
if (binding !== this.uiPromptBinding)
|
|
13475
|
+
return run();
|
|
13476
|
+
let prompt = this.activeUIPrompt;
|
|
13477
|
+
if (!prompt) {
|
|
13478
|
+
prompt = { depth: 0, kind, title };
|
|
13479
|
+
this.activeUIPrompt = prompt;
|
|
13480
|
+
this.emitUIPromptEvent({
|
|
13481
|
+
type: "ui_prompt_start",
|
|
13482
|
+
reason: "ui_prompt",
|
|
13483
|
+
kind,
|
|
13484
|
+
...title === undefined ? {} : { title }
|
|
13485
|
+
});
|
|
13486
|
+
}
|
|
13487
|
+
prompt.depth += 1;
|
|
13488
|
+
let finished = false;
|
|
13489
|
+
const finish = () => {
|
|
13490
|
+
if (finished)
|
|
13491
|
+
return;
|
|
13492
|
+
finished = true;
|
|
13493
|
+
if (this.activeUIPrompt !== prompt)
|
|
13494
|
+
return;
|
|
13495
|
+
prompt.depth -= 1;
|
|
13496
|
+
if (prompt.depth === 0)
|
|
13497
|
+
this.endActiveUIPrompt(prompt);
|
|
13498
|
+
};
|
|
13499
|
+
try {
|
|
13500
|
+
return run().finally(finish);
|
|
13501
|
+
} catch (error) {
|
|
13502
|
+
finish();
|
|
13503
|
+
throw error;
|
|
13504
|
+
}
|
|
13505
|
+
}
|
|
13506
|
+
endActiveUIPrompt(prompt = this.activeUIPrompt) {
|
|
13507
|
+
if (!prompt || this.activeUIPrompt !== prompt)
|
|
13508
|
+
return;
|
|
13509
|
+
this.activeUIPrompt = undefined;
|
|
13510
|
+
prompt.depth = 0;
|
|
13511
|
+
this.emitUIPromptEvent({
|
|
13512
|
+
type: "ui_prompt_end",
|
|
13513
|
+
reason: "ui_prompt",
|
|
13514
|
+
kind: prompt.kind,
|
|
13515
|
+
...prompt.title === undefined ? {} : { title: prompt.title }
|
|
13516
|
+
});
|
|
13517
|
+
}
|
|
13518
|
+
emitUIPromptEvent(event) {
|
|
13519
|
+
queueMicrotask(() => {
|
|
13520
|
+
this.emit(event);
|
|
13521
|
+
});
|
|
13522
|
+
}
|
|
13417
13523
|
getUIContext() {
|
|
13418
13524
|
return this.uiContext;
|
|
13419
13525
|
}
|
|
@@ -13590,6 +13696,7 @@ var init_runner = __esm(() => {
|
|
|
13590
13696
|
init_loader_runtime();
|
|
13591
13697
|
init_runner_context();
|
|
13592
13698
|
init_runner_events();
|
|
13699
|
+
init_runner_registries();
|
|
13593
13700
|
init_runner_shortcuts();
|
|
13594
13701
|
init_runner_ui();
|
|
13595
13702
|
init_stale_context();
|
|
@@ -15822,11 +15929,13 @@ async function _runAgentContinue() {
|
|
|
15822
15929
|
}
|
|
15823
15930
|
async function _continueQueuedAgentMessages() {
|
|
15824
15931
|
await this._agentEventQueue;
|
|
15825
|
-
while (!this._queuedMessagesPaused && this.agent.hasQueuedMessages()) {
|
|
15932
|
+
while (!this._stopAfterTurnBlockedContinuation && !this._queuedMessagesPaused && this.agent.hasQueuedMessages()) {
|
|
15826
15933
|
await this.agent.continue();
|
|
15827
15934
|
await this.waitForRetry();
|
|
15828
15935
|
await this._agentEventQueue;
|
|
15829
15936
|
}
|
|
15937
|
+
if (this._stopAfterTurnBlockedContinuation)
|
|
15938
|
+
return;
|
|
15830
15939
|
await answerAdmittedQueuedMessage(this);
|
|
15831
15940
|
}
|
|
15832
15941
|
async function answerAdmittedQueuedMessage(session) {
|
|
@@ -17534,14 +17643,13 @@ function getToolDefinition(name) {
|
|
|
17534
17643
|
}
|
|
17535
17644
|
function setActiveToolsByName(toolNames) {
|
|
17536
17645
|
const tools = [];
|
|
17537
|
-
const validToolNames = [];
|
|
17538
17646
|
for (const name of toolNames) {
|
|
17539
17647
|
const tool = this._toolRegistry.get(name);
|
|
17540
|
-
if (tool)
|
|
17648
|
+
if (tool)
|
|
17541
17649
|
tools.push(tool);
|
|
17542
|
-
validToolNames.push(name);
|
|
17543
|
-
}
|
|
17544
17650
|
}
|
|
17651
|
+
appendRegisteredMandatoryTools(tools, this._toolRegistry);
|
|
17652
|
+
const validToolNames = tools.map((tool) => tool.name);
|
|
17545
17653
|
this.agent.state.tools = tools;
|
|
17546
17654
|
this._baseSystemPrompt = this._rebuildSystemPrompt(validToolNames);
|
|
17547
17655
|
this.agent.state.systemPrompt = this._systemPromptOverride ?? this._baseSystemPrompt;
|
|
@@ -17598,7 +17706,7 @@ function _rebuildSystemPrompt(toolNames) {
|
|
|
17598
17706
|
customPrompt: loaderSystemPrompt,
|
|
17599
17707
|
appendSystemPrompt,
|
|
17600
17708
|
selectedTools: validToolNames,
|
|
17601
|
-
excludedTools: this._excludedToolNames ? Array.from(this._excludedToolNames) : undefined,
|
|
17709
|
+
excludedTools: this._excludedToolNames ? Array.from(this._excludedToolNames).filter((name) => !isMandatoryRuntimeTool(name)) : undefined,
|
|
17602
17710
|
toolSnippets,
|
|
17603
17711
|
promptGuidelines
|
|
17604
17712
|
};
|
|
@@ -17611,6 +17719,7 @@ function _refreshBaseSystemPromptFromActiveTools() {
|
|
|
17611
17719
|
}
|
|
17612
17720
|
var agentSessionStateMethods;
|
|
17613
17721
|
var init_agent_session_state = __esm(() => {
|
|
17722
|
+
init_mandatory_runtime_tools();
|
|
17614
17723
|
init_skill_catalog();
|
|
17615
17724
|
init_system_prompt();
|
|
17616
17725
|
agentSessionStateMethods = {
|
|
@@ -18638,6 +18747,17 @@ function _installAgentToolHooks() {
|
|
|
18638
18747
|
}
|
|
18639
18748
|
function _installAgentNextTurnRefresh() {
|
|
18640
18749
|
const previousPrepareNextTurnWithContext = this.agent.prepareNextTurnWithContext ?? (this.agent.prepareNextTurn ? async (_turn, signal) => await this.agent.prepareNextTurn?.(signal) : undefined);
|
|
18750
|
+
const previousShouldStopAfterTurn = this.agent.shouldStopAfterTurn;
|
|
18751
|
+
this.agent.shouldStopAfterTurn = async (turn, signal) => {
|
|
18752
|
+
const toolCallIds = turn.message.content.filter((part) => part.type === "toolCall").map((part) => part.id);
|
|
18753
|
+
const terminatingBatch = toolCallIds.length > 0 && toolCallIds.every((id) => this._terminatingToolCallIds.has(id));
|
|
18754
|
+
for (const id of toolCallIds)
|
|
18755
|
+
this._terminatingToolCallIds.delete(id);
|
|
18756
|
+
const shouldStop = await previousShouldStopAfterTurn?.(turn, signal) ?? false;
|
|
18757
|
+
this._stopAfterTurnBlockedContinuation = shouldStop;
|
|
18758
|
+
await settleFallbackAfterTurn(this, turn, terminatingBatch);
|
|
18759
|
+
return shouldStop;
|
|
18760
|
+
};
|
|
18641
18761
|
const previousTransformContext = this.agent.transformContext;
|
|
18642
18762
|
this.agent.transformContext = async (messages, signal) => {
|
|
18643
18763
|
const transformed = previousTransformContext ? await previousTransformContext(messages, signal) : messages;
|
|
@@ -18645,24 +18765,17 @@ function _installAgentNextTurnRefresh() {
|
|
|
18645
18765
|
assertToolPairingInvariant(guarded);
|
|
18646
18766
|
return guarded;
|
|
18647
18767
|
};
|
|
18648
|
-
|
|
18649
|
-
const
|
|
18650
|
-
const
|
|
18651
|
-
const
|
|
18652
|
-
const
|
|
18653
|
-
|
|
18654
|
-
this._terminatingToolCallIds.delete(id);
|
|
18655
|
-
const messages = turn.toolResults.length > 0 && !terminatingBatch ? await this._preflightPostToolContext(previousContext.messages, signal) : previousContext.messages;
|
|
18656
|
-
const preserveFallbackForFailure = turn.message.role === "assistant" && !this.agent.hasQueuedMessages() && (turn.message.stopReason === "length" || this._isEmptyCompletion?.(turn.message) === true || this._isSafetyRefusal?.(turn.message) === true);
|
|
18657
|
-
if (!preserveFallbackForFailure && (turn.toolResults.length === 0 || terminatingBatch)) {
|
|
18658
|
-
await this._agentEventQueue;
|
|
18659
|
-
await this._settleFallbackModelScope();
|
|
18660
|
-
}
|
|
18768
|
+
const prepareTurn = async (turn, signal) => {
|
|
18769
|
+
const compactedMessages = turn.toolResults.length > 0 ? await this._preflightPostToolContext(turn.context.messages, signal) : turn.context.messages;
|
|
18770
|
+
const compactedContext = compactedMessages === turn.context.messages ? turn.context : { ...turn.context, messages: compactedMessages };
|
|
18771
|
+
const preparedTurn = compactedContext === turn.context ? turn : { ...turn, context: compactedContext };
|
|
18772
|
+
const previousSnapshot = await previousPrepareNextTurnWithContext?.(preparedTurn, signal);
|
|
18773
|
+
const previousContext = previousSnapshot?.context ?? compactedContext;
|
|
18661
18774
|
return {
|
|
18662
18775
|
...previousSnapshot,
|
|
18663
18776
|
context: {
|
|
18664
18777
|
...previousContext,
|
|
18665
|
-
messages,
|
|
18778
|
+
messages: previousContext.messages,
|
|
18666
18779
|
systemPrompt: this._systemPromptOverride ?? this._baseSystemPrompt,
|
|
18667
18780
|
tools: this.agent.state.tools.slice()
|
|
18668
18781
|
},
|
|
@@ -18670,6 +18783,14 @@ function _installAgentNextTurnRefresh() {
|
|
|
18670
18783
|
thinkingLevel: this.agent.state.thinkingLevel
|
|
18671
18784
|
};
|
|
18672
18785
|
};
|
|
18786
|
+
this.agent.prepareNextTurnWithContext = prepareTurn;
|
|
18787
|
+
}
|
|
18788
|
+
async function settleFallbackAfterTurn(session, turn, terminatingBatch) {
|
|
18789
|
+
const preserveFallbackForFailure = turn.message.role === "assistant" && !session.agent.hasQueuedMessages() && (turn.message.stopReason === "length" || session._isEmptyCompletion?.(turn.message) === true || session._isSafetyRefusal?.(turn.message) === true);
|
|
18790
|
+
if (!preserveFallbackForFailure && (turn.toolResults.length === 0 || terminatingBatch)) {
|
|
18791
|
+
await session._agentEventQueue;
|
|
18792
|
+
await session._settleFallbackModelScope();
|
|
18793
|
+
}
|
|
18673
18794
|
}
|
|
18674
18795
|
var agentSessionToolHooksMethods;
|
|
18675
18796
|
var init_agent_session_tool_hooks = __esm(() => {
|
|
@@ -19567,6 +19688,14 @@ var init_loader_virtual_modules = __esm(() => {
|
|
|
19567
19688
|
|
|
19568
19689
|
// src/core/extensions/loader-core.ts
|
|
19569
19690
|
import * as path7 from "node:path";
|
|
19691
|
+
function getExtensionRuntimeEventBus(runtime) {
|
|
19692
|
+
let eventBus = runtimeEventBuses.get(runtime);
|
|
19693
|
+
if (!eventBus) {
|
|
19694
|
+
eventBus = createEventBus();
|
|
19695
|
+
runtimeEventBuses.set(runtime, eventBus);
|
|
19696
|
+
}
|
|
19697
|
+
return eventBus;
|
|
19698
|
+
}
|
|
19570
19699
|
function createExtension(extensionPath, resolvedPath) {
|
|
19571
19700
|
const source = extensionPath.startsWith("<") && extensionPath.endsWith(">") ? extensionPath.slice(1, -1).split(":")[0] || "temporary" : "local";
|
|
19572
19701
|
const baseDir = extensionPath.startsWith("<") ? undefined : path7.dirname(resolvedPath);
|
|
@@ -19632,6 +19761,7 @@ async function loadExtensionsInternal(paths, cwd, eventBus, workflowResourceProv
|
|
|
19632
19761
|
const resolvedCwd = cacheToken?.cwd ?? resolvePath(cwd);
|
|
19633
19762
|
const resolvedEventBus = eventBus ?? createEventBus();
|
|
19634
19763
|
const resolvedRuntime = runtime ?? createExtensionRuntime();
|
|
19764
|
+
runtimeEventBuses.set(resolvedRuntime, resolvedEventBus);
|
|
19635
19765
|
let processedExtensionCount = 0;
|
|
19636
19766
|
let lastYieldAt = Date.now();
|
|
19637
19767
|
for (const extPath of paths) {
|
|
@@ -19663,7 +19793,7 @@ async function loadExtensions(paths, cwd, eventBus, workflowResourceProvider = e
|
|
|
19663
19793
|
async function loadExtensionsCached(paths, cwd, eventBus, workflowResourceProvider = emptyWorkflowResourceProvider, runtime, resourceLoaderInheritanceSnapshotProvider) {
|
|
19664
19794
|
return loadExtensionsInternal(paths, cwd, eventBus, workflowResourceProvider, runtime, resourceLoaderInheritanceSnapshotProvider, true);
|
|
19665
19795
|
}
|
|
19666
|
-
var INTER_EXTENSION_YIELD_THRESHOLD_MS = 16;
|
|
19796
|
+
var runtimeEventBuses, INTER_EXTENSION_YIELD_THRESHOLD_MS = 16;
|
|
19667
19797
|
var init_loader_core = __esm(() => {
|
|
19668
19798
|
init_event_loop();
|
|
19669
19799
|
init_paths();
|
|
@@ -19673,6 +19803,7 @@ var init_loader_core = __esm(() => {
|
|
|
19673
19803
|
init_loader_resources();
|
|
19674
19804
|
init_loader_runtime();
|
|
19675
19805
|
init_loader_virtual_modules();
|
|
19806
|
+
runtimeEventBuses = new WeakMap;
|
|
19676
19807
|
});
|
|
19677
19808
|
|
|
19678
19809
|
// src/core/package-manager-manifest.ts
|
|
@@ -28211,7 +28342,7 @@ class FastModeSelectorComponent {
|
|
|
28211
28342
|
}
|
|
28212
28343
|
invalidate() {}
|
|
28213
28344
|
render(width) {
|
|
28214
|
-
const lines = [truncateToWidth10(theme.bold(theme.fg("accent", "
|
|
28345
|
+
const lines = [truncateToWidth10(theme.bold(theme.fg("accent", "Fast mode")), width)];
|
|
28215
28346
|
for (const line of wrapTextWithAnsi3(DESCRIPTION, Math.max(20, width))) {
|
|
28216
28347
|
lines.push(theme.fg("muted", line));
|
|
28217
28348
|
}
|
|
@@ -28294,7 +28425,7 @@ class FastModeSelectorComponent {
|
|
|
28294
28425
|
return this.getFocusedRow() === row ? theme.fg("muted", text) : theme.fg("dim", text);
|
|
28295
28426
|
}
|
|
28296
28427
|
}
|
|
28297
|
-
var ROWS, LABEL_WIDTH = 16, DESCRIPTION = "
|
|
28428
|
+
var ROWS, LABEL_WIDTH = 16, DESCRIPTION = "Use faster routing for the selected model when supported by its provider.", ROW_DETAILS;
|
|
28298
28429
|
var init_fast_mode_selector = __esm(() => {
|
|
28299
28430
|
init_theme();
|
|
28300
28431
|
ROWS = ["chat", "workflow"];
|
|
@@ -29600,6 +29731,10 @@ var init_keybindings = __esm(() => {
|
|
|
29600
29731
|
defaultKeys: windowsKeybindings ? "alt+q" : "alt+up",
|
|
29601
29732
|
description: "Restore queued messages"
|
|
29602
29733
|
},
|
|
29734
|
+
"app.message.copy": {
|
|
29735
|
+
defaultKeys: "ctrl+x",
|
|
29736
|
+
description: "Copy fullscreen selection or last agent message"
|
|
29737
|
+
},
|
|
29603
29738
|
"app.clipboard.pasteImage": {
|
|
29604
29739
|
defaultKeys: windowsKeybindings ? "alt+v" : "ctrl+v",
|
|
29605
29740
|
description: "Paste image from clipboard (text fallback)"
|
|
@@ -30992,6 +31127,9 @@ function createSettingsChangeHandler(callbacks) {
|
|
|
30992
31127
|
case "fullscreen-exit-output":
|
|
30993
31128
|
callbacks.onFullscreenExitOutputChange(newValue);
|
|
30994
31129
|
break;
|
|
31130
|
+
case "fullscreen-copy-on-select":
|
|
31131
|
+
callbacks.onFullscreenCopyOnSelectChange(newValue === "true");
|
|
31132
|
+
break;
|
|
30995
31133
|
case "editor-padding":
|
|
30996
31134
|
callbacks.onEditorPaddingXChange(parseInt(newValue, 10));
|
|
30997
31135
|
break;
|
|
@@ -31379,6 +31517,13 @@ function insertUiToggles(items, config) {
|
|
|
31379
31517
|
values: ["transcript", "resume-hint"]
|
|
31380
31518
|
});
|
|
31381
31519
|
insertAfter(items, "fullscreen-exit-output", {
|
|
31520
|
+
id: "fullscreen-copy-on-select",
|
|
31521
|
+
label: "Fullscreen copy on select",
|
|
31522
|
+
description: "Copy selected transcript text automatically on mouse release",
|
|
31523
|
+
currentValue: config.fullscreenCopyOnSelect ? "true" : "false",
|
|
31524
|
+
values: ["true", "false"]
|
|
31525
|
+
});
|
|
31526
|
+
insertAfter(items, "fullscreen-copy-on-select", {
|
|
31382
31527
|
id: "editor-padding",
|
|
31383
31528
|
label: "Editor padding",
|
|
31384
31529
|
description: "Horizontal padding for input editor (0-3)",
|
|
@@ -44656,6 +44801,8 @@ function _refreshToolRegistry(options) {
|
|
|
44656
44801
|
const allowedToolNames = this._allowedToolNames;
|
|
44657
44802
|
const excludedToolNames = this._excludedToolNames;
|
|
44658
44803
|
const isExposedTool = (name) => {
|
|
44804
|
+
if (isMandatoryRuntimeTool(name))
|
|
44805
|
+
return true;
|
|
44659
44806
|
if (allowedToolNames && !allowedToolNames.has(name)) {
|
|
44660
44807
|
return false;
|
|
44661
44808
|
}
|
|
@@ -44664,10 +44811,10 @@ function _refreshToolRegistry(options) {
|
|
|
44664
44811
|
}
|
|
44665
44812
|
return true;
|
|
44666
44813
|
};
|
|
44667
|
-
const registeredTools = this._extensionRunner.getAllRegisteredTools();
|
|
44814
|
+
const registeredTools = this._extensionRunner.getAllRegisteredTools().filter((tool) => !isMandatoryRuntimeTool(tool.definition.name) || isTrustedMandatoryRuntimeTool(tool));
|
|
44668
44815
|
const allCustomTools = [
|
|
44669
44816
|
...registeredTools,
|
|
44670
|
-
...this._customTools.map((definition) => ({
|
|
44817
|
+
...this._customTools.filter((definition) => !isMandatoryRuntimeTool(definition.name)).map((definition) => ({
|
|
44671
44818
|
definition,
|
|
44672
44819
|
sourceInfo: createSyntheticSourceInfo(`<sdk:${definition.name}>`, { source: "sdk" })
|
|
44673
44820
|
}))
|
|
@@ -44788,6 +44935,7 @@ function _buildRuntime(options) {
|
|
|
44788
44935
|
var agentSessionToolRegistryMethods;
|
|
44789
44936
|
var init_agent_session_tool_registry = __esm(() => {
|
|
44790
44937
|
init_extensions();
|
|
44938
|
+
init_mandatory_runtime_tools();
|
|
44791
44939
|
init_model_registry();
|
|
44792
44940
|
init_tools();
|
|
44793
44941
|
init_session_temp_dir();
|
|
@@ -45630,6 +45778,7 @@ class AgentSessionBase {
|
|
|
45630
45778
|
_postToolCompactionPreflightError = undefined;
|
|
45631
45779
|
_pendingPostToolCompactionGuard = undefined;
|
|
45632
45780
|
_terminatingToolCallIds = new Set;
|
|
45781
|
+
_stopAfterTurnBlockedContinuation = false;
|
|
45633
45782
|
_disposed = false;
|
|
45634
45783
|
_branchSummaryAbortController = undefined;
|
|
45635
45784
|
_sessionSummaryAbortController = undefined;
|
|
@@ -46217,6 +46366,23 @@ function getBuiltinPackagePaths() {
|
|
|
46217
46366
|
return packageDir ? [packageDir] : [];
|
|
46218
46367
|
});
|
|
46219
46368
|
}
|
|
46369
|
+
function getMandatoryBuiltinPackagePaths() {
|
|
46370
|
+
const context = getBuiltinPackageCandidateContext();
|
|
46371
|
+
return BUILTIN_PACKAGES.filter((descriptor) => descriptor.mandatory).flatMap((descriptor) => {
|
|
46372
|
+
const packageDir = firstExistingPackageDir([...descriptor.sourceCandidates(context), ...distCandidates(context, descriptor)], descriptor);
|
|
46373
|
+
return packageDir ? [packageDir] : [];
|
|
46374
|
+
});
|
|
46375
|
+
}
|
|
46376
|
+
function getMandatoryBuiltinExtensionPaths() {
|
|
46377
|
+
return getMandatoryBuiltinPackagePaths().flatMap((packageDir) => {
|
|
46378
|
+
try {
|
|
46379
|
+
const manifest = JSON.parse(stripBom(readFileSync21(join43(packageDir, "package.json"), "utf-8")));
|
|
46380
|
+
return (manifest.atomic?.extensions ?? manifest.pi?.extensions ?? []).map((entry) => resolve12(packageDir, entry));
|
|
46381
|
+
} catch {
|
|
46382
|
+
return [];
|
|
46383
|
+
}
|
|
46384
|
+
});
|
|
46385
|
+
}
|
|
46220
46386
|
var WORKSPACE_BUILTINS, BUILTIN_PACKAGES;
|
|
46221
46387
|
var init_builtin_packages = __esm(() => {
|
|
46222
46388
|
init_config();
|
|
@@ -46227,11 +46393,12 @@ var init_builtin_packages = __esm(() => {
|
|
|
46227
46393
|
{ packageName: "@bastani/subagents", workspaceDirName: "subagents", distDirName: "subagents" },
|
|
46228
46394
|
{ packageName: "@bastani/mcp", workspaceDirName: "mcp", distDirName: "mcp" },
|
|
46229
46395
|
{ packageName: "@bastani/web-access", workspaceDirName: "web-access", distDirName: "web-access" },
|
|
46230
|
-
{ packageName: "@bastani/intercom", workspaceDirName: "intercom", distDirName: "intercom" }
|
|
46396
|
+
{ packageName: "@bastani/intercom", workspaceDirName: "intercom", distDirName: "intercom", mandatory: true }
|
|
46231
46397
|
];
|
|
46232
46398
|
BUILTIN_PACKAGES = WORKSPACE_BUILTINS.map((spec) => ({
|
|
46233
46399
|
packageName: spec.packageName,
|
|
46234
46400
|
distDirName: spec.distDirName,
|
|
46401
|
+
mandatory: spec.mandatory === true,
|
|
46235
46402
|
requiredEntries: requiredEntriesForBuiltin(spec.distDirName),
|
|
46236
46403
|
sourceCandidates: ({ here, packageDir, isSourceCheckout }) => isSourceCheckout ? [join43(packageDir, "..", spec.workspaceDirName), join43(here, "..", "..", "..", spec.workspaceDirName)] : []
|
|
46237
46404
|
}));
|
|
@@ -52206,6 +52373,13 @@ function getEnabledResources(resources, metadataByPath) {
|
|
|
52206
52373
|
function getEnabledPaths(resources, metadataByPath) {
|
|
52207
52374
|
return getEnabledResources(resources, metadataByPath).map((r) => r.path);
|
|
52208
52375
|
}
|
|
52376
|
+
function getBuiltinExtensionPaths(resources, metadataByPath, noExtensions) {
|
|
52377
|
+
for (const resource of resources) {
|
|
52378
|
+
if (!metadataByPath.has(resource.path))
|
|
52379
|
+
metadataByPath.set(resource.path, resource.metadata);
|
|
52380
|
+
}
|
|
52381
|
+
return noExtensions ? [] : resources.filter((resource) => resource.enabled).map((resource) => resource.path);
|
|
52382
|
+
}
|
|
52209
52383
|
function mapSkillPath(resource, metadataByPath) {
|
|
52210
52384
|
if (resource.metadata.source !== "auto" && resource.metadata.origin !== "package") {
|
|
52211
52385
|
return resource.path;
|
|
@@ -52249,12 +52423,12 @@ async function loadProjectTrustExtensions(loader) {
|
|
|
52249
52423
|
const metadataByPath = new Map;
|
|
52250
52424
|
const cliEnabledExtensions = getEnabledPaths(cliExtensionPaths.extensions, metadataByPath);
|
|
52251
52425
|
const enabledExtensions = getEnabledPaths(resolvedPaths.extensions, metadataByPath);
|
|
52252
|
-
const builtinEnabledExtensions =
|
|
52426
|
+
const builtinEnabledExtensions = getBuiltinExtensionPaths(builtinPackagePaths.extensions, metadataByPath, state.noExtensions);
|
|
52253
52427
|
const workflowResources = collectWorkflowResources(resolvedPaths, cliExtensionPaths, builtinPackagePaths);
|
|
52254
52428
|
state.workflowResources = workflowResources;
|
|
52255
52429
|
const workflowResourceProvider = createWorkflowResourceProvider(loader);
|
|
52256
52430
|
const inheritanceSnapshotProvider = createInheritanceSnapshotProvider(loader);
|
|
52257
|
-
const extensionPaths =
|
|
52431
|
+
const extensionPaths = mergeResourcePaths(state.cwd, cliEnabledExtensions, state.noExtensions ? builtinEnabledExtensions : [...enabledExtensions, ...builtinEnabledExtensions]);
|
|
52258
52432
|
const extensionsResult = await loadExtensionsCached(extensionPaths, state.cwd, state.eventBus, workflowResourceProvider, undefined, inheritanceSnapshotProvider);
|
|
52259
52433
|
const inlineExtensions = await loadExtensionFactories(loader, extensionsResult.runtime, workflowResourceProvider, inheritanceSnapshotProvider);
|
|
52260
52434
|
extensionsResult.extensions.push(...inlineExtensions.extensions);
|
|
@@ -52334,7 +52508,7 @@ async function reloadDefaultResourceLoader(loader, options) {
|
|
|
52334
52508
|
const enabledSkillResources = getEnabledResources(resolvedPaths.skills, metadataByPath);
|
|
52335
52509
|
const enabledPrompts = getEnabledPaths(resolvedPaths.prompts, metadataByPath);
|
|
52336
52510
|
const enabledThemes = getEnabledPaths(resolvedPaths.themes, metadataByPath);
|
|
52337
|
-
const builtinEnabledExtensions =
|
|
52511
|
+
const builtinEnabledExtensions = getBuiltinExtensionPaths(builtinPackagePaths.extensions, metadataByPath, state.noExtensions);
|
|
52338
52512
|
const builtinEnabledSkillResources = state.noSkills ? [] : getEnabledResources(builtinPackagePaths.skills, metadataByPath);
|
|
52339
52513
|
const builtinEnabledPrompts = state.noPromptTemplates ? [] : getEnabledPaths(builtinPackagePaths.prompts, metadataByPath);
|
|
52340
52514
|
const builtinEnabledThemes = state.noThemes ? [] : getEnabledPaths(builtinPackagePaths.themes, metadataByPath);
|
|
@@ -52348,9 +52522,13 @@ async function reloadDefaultResourceLoader(loader, options) {
|
|
|
52348
52522
|
const workflowResources = collectWorkflowResources(resolvedPaths, cliExtensionPaths, builtinPackagePaths);
|
|
52349
52523
|
state.workflowResources = workflowResources;
|
|
52350
52524
|
const workflowResourceProvider = createWorkflowResourceProvider(loader);
|
|
52351
|
-
const extensionPaths =
|
|
52525
|
+
const extensionPaths = mergeResourcePaths(state.cwd, cliEnabledExtensions, state.noExtensions ? builtinEnabledExtensions : [...enabledExtensions, ...builtinEnabledExtensions]);
|
|
52352
52526
|
const inheritanceSnapshotProvider = createInheritanceSnapshotProvider(loader);
|
|
52353
52527
|
const extensionsResult = options?.deferExtensions ? { extensions: [], errors: [], runtime: createExtensionRuntime() } : await loadFinalExtensionSet(loader, extensionPaths, preTrustExtensions, workflowResourceProvider, inheritanceSnapshotProvider);
|
|
52528
|
+
const mandatoryExtensionPaths = new Set(getMandatoryBuiltinExtensionPaths().map((path16) => resolvePath(path16, state.cwd, { normalizeUnicodeSpaces: true })));
|
|
52529
|
+
const loadedMandatoryExtensions = new Set(extensionsResult.extensions.filter((extension) => mandatoryExtensionPaths.has(resolvePath(extension.resolvedPath, state.cwd, { normalizeUnicodeSpaces: true }))));
|
|
52530
|
+
for (const extension of loadedMandatoryExtensions)
|
|
52531
|
+
markTrustedMandatoryRuntimeExtension(extension);
|
|
52354
52532
|
for (const p of state.additionalExtensionPaths) {
|
|
52355
52533
|
if (isLocalPath(p)) {
|
|
52356
52534
|
const resolved = resolveResourcePath(state.cwd, p);
|
|
@@ -52361,6 +52539,12 @@ async function reloadDefaultResourceLoader(loader, options) {
|
|
|
52361
52539
|
}
|
|
52362
52540
|
state.extensionsResult = state.extensionsOverride ? state.extensionsOverride(extensionsResult) : extensionsResult;
|
|
52363
52541
|
applyExtensionSourceInfo(loader, state.extensionsResult.extensions, metadataByPath);
|
|
52542
|
+
for (const extension of state.extensionsResult.extensions) {
|
|
52543
|
+
const registration = extension.tools.get("intercom");
|
|
52544
|
+
if (loadedMandatoryExtensions.has(extension) && registration && isTrustedMandatoryRuntimeTool(registration)) {
|
|
52545
|
+
markTrustedMandatoryRuntimeExtension(extension);
|
|
52546
|
+
}
|
|
52547
|
+
}
|
|
52364
52548
|
resolveInheritedExtensionOverlaps(state.extensionsResult);
|
|
52365
52549
|
const skillPaths = state.noSkills ? mergeResourcePaths(state.cwd, cliEnabledSkills, state.additionalSkillPaths) : mergeResourcePaths(state.cwd, [...cliEnabledSkills, ...enabledSkills, ...builtinEnabledSkills], state.additionalSkillPaths);
|
|
52366
52550
|
state.lastSkillPaths = skillPaths;
|
|
@@ -52440,7 +52624,9 @@ async function reloadDefaultResourceLoader(loader, options) {
|
|
|
52440
52624
|
var init_resource_loader_reload = __esm(() => {
|
|
52441
52625
|
init_event_loop();
|
|
52442
52626
|
init_paths();
|
|
52627
|
+
init_builtin_packages();
|
|
52443
52628
|
init_loader();
|
|
52629
|
+
init_mandatory_runtime_tools();
|
|
52444
52630
|
init_resource_loader_assets();
|
|
52445
52631
|
init_resource_loader_context_files();
|
|
52446
52632
|
init_resource_loader_discovery();
|
|
@@ -53597,6 +53783,28 @@ var init_settings_manager_ui_accessors = __esm(() => {
|
|
|
53597
53783
|
state.markModified("fullscreenExitOutput");
|
|
53598
53784
|
state.save();
|
|
53599
53785
|
},
|
|
53786
|
+
getFullscreenCopyOnSelect() {
|
|
53787
|
+
return settingsInternals(this).settings.fullscreenCopyOnSelect !== false;
|
|
53788
|
+
},
|
|
53789
|
+
setFullscreenCopyOnSelect(enabled) {
|
|
53790
|
+
const state = settingsInternals(this);
|
|
53791
|
+
state.globalSettings.fullscreenCopyOnSelect = enabled;
|
|
53792
|
+
state.markModified("fullscreenCopyOnSelect");
|
|
53793
|
+
state.save();
|
|
53794
|
+
},
|
|
53795
|
+
getTerminalCapabilityOverrides() {
|
|
53796
|
+
const terminal = settingsInternals(this).settings.terminal;
|
|
53797
|
+
const overrides = {};
|
|
53798
|
+
if (typeof terminal?.hyperlinks === "boolean")
|
|
53799
|
+
overrides.hyperlinks = terminal.hyperlinks;
|
|
53800
|
+
if (terminal?.images === "kitty" || terminal?.images === "iterm2")
|
|
53801
|
+
overrides.images = terminal.images;
|
|
53802
|
+
else if (terminal?.images === false)
|
|
53803
|
+
overrides.images = null;
|
|
53804
|
+
if (typeof terminal?.trueColor === "boolean")
|
|
53805
|
+
overrides.trueColor = terminal.trueColor;
|
|
53806
|
+
return overrides;
|
|
53807
|
+
},
|
|
53600
53808
|
getEditorPaddingX() {
|
|
53601
53809
|
return settingsInternals(this).settings.editorPaddingX ?? 0;
|
|
53602
53810
|
},
|
|
@@ -54147,6 +54355,105 @@ function restoreAnthropicReplayThinkingBlocks(payload, sourceMessages, model) {
|
|
|
54147
54355
|
return { ...payload, messages: nextPayloadMessages };
|
|
54148
54356
|
}
|
|
54149
54357
|
|
|
54358
|
+
// src/core/mandatory-resource-loader.ts
|
|
54359
|
+
function hasTrustedIntercom(extension) {
|
|
54360
|
+
const registration = extension.tools.get("intercom");
|
|
54361
|
+
return registration !== undefined && isTrustedMandatoryRuntimeTool(registration);
|
|
54362
|
+
}
|
|
54363
|
+
async function restoreMandatoryExtensions(target, cwd) {
|
|
54364
|
+
if (target.extensions.some(hasTrustedIntercom))
|
|
54365
|
+
return target;
|
|
54366
|
+
const loaded = await loadExtensions(getMandatoryBuiltinExtensionPaths(), cwd, getExtensionRuntimeEventBus(target.runtime), undefined, target.runtime);
|
|
54367
|
+
for (const extension of loaded.extensions)
|
|
54368
|
+
markTrustedMandatoryRuntimeExtension(extension);
|
|
54369
|
+
const restored = {
|
|
54370
|
+
...target,
|
|
54371
|
+
extensions: [...target.extensions, ...loaded.extensions],
|
|
54372
|
+
errors: [...target.errors, ...loaded.errors]
|
|
54373
|
+
};
|
|
54374
|
+
if (!restored.extensions.some(hasTrustedIntercom)) {
|
|
54375
|
+
const detail = loaded.errors.map(({ error }) => error).join("; ") || "extension did not register intercom";
|
|
54376
|
+
throw new Error(`Mandatory bundled Intercom is unavailable: ${detail}`);
|
|
54377
|
+
}
|
|
54378
|
+
return restored;
|
|
54379
|
+
}
|
|
54380
|
+
|
|
54381
|
+
class MandatoryResourceLoader {
|
|
54382
|
+
delegate;
|
|
54383
|
+
cwd;
|
|
54384
|
+
extensionsResult;
|
|
54385
|
+
toolOnly = false;
|
|
54386
|
+
constructor(delegate, cwd, extensionsResult) {
|
|
54387
|
+
this.delegate = delegate;
|
|
54388
|
+
this.cwd = cwd;
|
|
54389
|
+
this.extensionsResult = extensionsResult;
|
|
54390
|
+
}
|
|
54391
|
+
limitToTool() {
|
|
54392
|
+
this.toolOnly = true;
|
|
54393
|
+
this.removeLocalInteractionSurfaces();
|
|
54394
|
+
}
|
|
54395
|
+
removeLocalInteractionSurfaces() {
|
|
54396
|
+
const extension = this.extensionsResult.extensions.find(hasTrustedIntercom);
|
|
54397
|
+
extension?.commands.delete("intercom");
|
|
54398
|
+
extension?.shortcuts.delete("alt+m");
|
|
54399
|
+
}
|
|
54400
|
+
getExtensions() {
|
|
54401
|
+
return this.extensionsResult;
|
|
54402
|
+
}
|
|
54403
|
+
getSkills() {
|
|
54404
|
+
return this.delegate.getSkills();
|
|
54405
|
+
}
|
|
54406
|
+
getSkillCatalog() {
|
|
54407
|
+
return this.delegate.getSkillCatalog?.() ?? buildSkillCatalog(this.delegate.getSkills().skills);
|
|
54408
|
+
}
|
|
54409
|
+
getPrompts() {
|
|
54410
|
+
return this.delegate.getPrompts();
|
|
54411
|
+
}
|
|
54412
|
+
getThemes() {
|
|
54413
|
+
return this.delegate.getThemes();
|
|
54414
|
+
}
|
|
54415
|
+
getAgentsFiles() {
|
|
54416
|
+
return this.delegate.getAgentsFiles();
|
|
54417
|
+
}
|
|
54418
|
+
getSystemPrompt() {
|
|
54419
|
+
return this.delegate.getSystemPrompt();
|
|
54420
|
+
}
|
|
54421
|
+
getSystemPromptSource() {
|
|
54422
|
+
return this.delegate.getSystemPromptSource();
|
|
54423
|
+
}
|
|
54424
|
+
getAppendSystemPrompt() {
|
|
54425
|
+
return this.delegate.getAppendSystemPrompt();
|
|
54426
|
+
}
|
|
54427
|
+
getAppendSystemPromptSources() {
|
|
54428
|
+
return this.delegate.getAppendSystemPromptSources();
|
|
54429
|
+
}
|
|
54430
|
+
extendResources(paths) {
|
|
54431
|
+
return this.delegate.extendResources(paths);
|
|
54432
|
+
}
|
|
54433
|
+
async reload(options) {
|
|
54434
|
+
await this.delegate.reload(options);
|
|
54435
|
+
this.extensionsResult = await restoreMandatoryExtensions(this.delegate.getExtensions(), this.cwd);
|
|
54436
|
+
if (this.toolOnly)
|
|
54437
|
+
this.removeLocalInteractionSurfaces();
|
|
54438
|
+
}
|
|
54439
|
+
}
|
|
54440
|
+
async function withMandatoryResourceLoader(loader, cwd) {
|
|
54441
|
+
if (loader instanceof MandatoryResourceLoader)
|
|
54442
|
+
return loader;
|
|
54443
|
+
const extensionsResult = await restoreMandatoryExtensions(loader.getExtensions(), cwd);
|
|
54444
|
+
return new MandatoryResourceLoader(loader, cwd, extensionsResult);
|
|
54445
|
+
}
|
|
54446
|
+
function limitMandatoryIntercomToTool(loader) {
|
|
54447
|
+
if (loader instanceof MandatoryResourceLoader)
|
|
54448
|
+
loader.limitToTool();
|
|
54449
|
+
}
|
|
54450
|
+
var init_mandatory_resource_loader = __esm(() => {
|
|
54451
|
+
init_builtin_packages();
|
|
54452
|
+
init_loader();
|
|
54453
|
+
init_mandatory_runtime_tools();
|
|
54454
|
+
init_skill_catalog();
|
|
54455
|
+
});
|
|
54456
|
+
|
|
54150
54457
|
// src/core/model-resolver-defaults.ts
|
|
54151
54458
|
function findPreferredAvailableModel(availableModels) {
|
|
54152
54459
|
for (const [provider, defaultId] of Object.entries(defaultModelPerProvider)) {
|
|
@@ -54187,7 +54494,7 @@ var init_model_resolver_defaults = __esm(() => {
|
|
|
54187
54494
|
huggingface: "moonshotai/Kimi-K2.6",
|
|
54188
54495
|
fireworks: "accounts/fireworks/models/kimi-k2p6",
|
|
54189
54496
|
together: "moonshotai/Kimi-K2.6",
|
|
54190
|
-
baseten: "zai-org/GLM-5.
|
|
54497
|
+
baseten: "zai-org/GLM-5.3",
|
|
54191
54498
|
opencode: "kimi-k2.6",
|
|
54192
54499
|
"opencode-go": "kimi-k2.6",
|
|
54193
54500
|
"kimi-coding": "kimi-for-coding",
|
|
@@ -54976,14 +55283,16 @@ async function createAgentSessionServices(options) {
|
|
|
54976
55283
|
const settingsSpan = startTimingSpan("createAgentSessionServices.settingsManager");
|
|
54977
55284
|
const settingsManager = options.settingsManager ?? SettingsManager.create(cwd, agentDir);
|
|
54978
55285
|
endTimingSpan(settingsSpan);
|
|
54979
|
-
const
|
|
54980
|
-
|
|
55286
|
+
const resourceLoaderOptions = options.resourceLoaderOptions ?? {};
|
|
55287
|
+
const defaultResourceLoader = new DefaultResourceLoader({
|
|
55288
|
+
...resourceLoaderOptions,
|
|
54981
55289
|
cwd,
|
|
54982
55290
|
agentDir,
|
|
54983
55291
|
settingsManager
|
|
54984
55292
|
});
|
|
54985
55293
|
const reloadSpan = startTimingSpan("createAgentSessionServices.resourceLoader.reload");
|
|
54986
|
-
await
|
|
55294
|
+
await defaultResourceLoader.reload(options.resourceLoaderReloadOptions);
|
|
55295
|
+
const resourceLoader = await withMandatoryResourceLoader(defaultResourceLoader, cwd);
|
|
54987
55296
|
endTimingSpan(reloadSpan);
|
|
54988
55297
|
const diagnostics = [];
|
|
54989
55298
|
const providerSpan = startTimingSpan("createAgentSessionServices.providerRegistrations");
|
|
@@ -55036,6 +55345,7 @@ async function createAgentSessionFromServices(options) {
|
|
|
55036
55345
|
var init_agent_session_services = __esm(() => {
|
|
55037
55346
|
init_config();
|
|
55038
55347
|
init_paths();
|
|
55348
|
+
init_mandatory_resource_loader();
|
|
55039
55349
|
init_model_runtime();
|
|
55040
55350
|
init_resource_loader();
|
|
55041
55351
|
init_sdk();
|
|
@@ -55418,6 +55728,7 @@ async function createAgentSession(options = {}) {
|
|
|
55418
55728
|
await resourceLoader.reload();
|
|
55419
55729
|
time("resourceLoader.reload");
|
|
55420
55730
|
}
|
|
55731
|
+
resourceLoader = await withMandatoryResourceLoader(resourceLoader, cwd);
|
|
55421
55732
|
const existingSession = sessionManager.buildSessionContext();
|
|
55422
55733
|
const repairedMessages = repairOrphanToolResults(existingSession.messages, { repairTrailing: true });
|
|
55423
55734
|
const existingMessages = options.initialContextTransform ? options.initialContextTransform(repairedMessages) : repairedMessages;
|
|
@@ -55643,6 +55954,7 @@ var init_sdk = __esm(() => {
|
|
|
55643
55954
|
init_agent_session();
|
|
55644
55955
|
init_auth_guidance();
|
|
55645
55956
|
init_codex_fast_mode();
|
|
55957
|
+
init_mandatory_resource_loader();
|
|
55646
55958
|
init_messages();
|
|
55647
55959
|
init_model_resolver();
|
|
55648
55960
|
init_model_runtime();
|
|
@@ -56219,8 +56531,14 @@ var init_list_models = __esm(() => {
|
|
|
56219
56531
|
|
|
56220
56532
|
// src/cli/startup-ui.ts
|
|
56221
56533
|
import { existsSync as existsSync45 } from "node:fs";
|
|
56222
|
-
import {
|
|
56534
|
+
import {
|
|
56535
|
+
ProcessTerminal,
|
|
56536
|
+
setCapabilityOverrides,
|
|
56537
|
+
setKeybindings,
|
|
56538
|
+
TuiMainScreen
|
|
56539
|
+
} from "@earendil-works/pi-tui";
|
|
56223
56540
|
function createStartupTui(settingsManager) {
|
|
56541
|
+
setCapabilityOverrides(settingsManager.getTerminalCapabilityOverrides());
|
|
56224
56542
|
initTheme(settingsManager.getTheme());
|
|
56225
56543
|
setKeybindings(KeybindingsManager.create());
|
|
56226
56544
|
const ui = new TuiMainScreen(new ProcessTerminal, settingsManager.getShowHardwareCursor(), getAgentDir());
|
|
@@ -58050,8 +58368,9 @@ async function applyCliRuntimeApiKey(modelRuntime, providerId, apiKey, signal) {
|
|
|
58050
58368
|
}
|
|
58051
58369
|
|
|
58052
58370
|
// src/cli/session-picker.ts
|
|
58053
|
-
import { ProcessTerminal as ProcessTerminal2, setKeybindings as setKeybindings2, TuiMainScreen as TuiMainScreen2 } from "@earendil-works/pi-tui";
|
|
58054
|
-
async function selectSession(currentSessionsLoader, allSessionsLoader) {
|
|
58371
|
+
import { ProcessTerminal as ProcessTerminal2, setCapabilityOverrides as setCapabilityOverrides2, setKeybindings as setKeybindings2, TuiMainScreen as TuiMainScreen2 } from "@earendil-works/pi-tui";
|
|
58372
|
+
async function selectSession(currentSessionsLoader, allSessionsLoader, settingsManager) {
|
|
58373
|
+
setCapabilityOverrides2(settingsManager.getTerminalCapabilityOverrides());
|
|
58055
58374
|
return new Promise((resolve23) => {
|
|
58056
58375
|
const ui = new TuiMainScreen2(new ProcessTerminal2, undefined, getAgentDir());
|
|
58057
58376
|
const keybindings = KeybindingsManager.create();
|
|
@@ -58089,7 +58408,7 @@ var init_session_picker = __esm(() => {
|
|
|
58089
58408
|
|
|
58090
58409
|
// src/main-session.ts
|
|
58091
58410
|
import { createInterface as createInterface3 } from "node:readline";
|
|
58092
|
-
import { ProcessTerminal as ProcessTerminal3, setKeybindings as setKeybindings3, TuiMainScreen as TuiMainScreen3 } from "@earendil-works/pi-tui";
|
|
58411
|
+
import { ProcessTerminal as ProcessTerminal3, setCapabilityOverrides as setCapabilityOverrides3, setKeybindings as setKeybindings3, TuiMainScreen as TuiMainScreen3 } from "@earendil-works/pi-tui";
|
|
58093
58412
|
import chalk10 from "chalk";
|
|
58094
58413
|
async function findLocalSessionByExactId(sessionId, cwd, sessionDir) {
|
|
58095
58414
|
const localSessions = await SessionManager.list(cwd, sessionDir);
|
|
@@ -58228,7 +58547,7 @@ async function createSessionManager(parsed, cwd, sessionDir, settingsManager) {
|
|
|
58228
58547
|
if (parsed.resume) {
|
|
58229
58548
|
initTheme(settingsManager.getTheme(), true);
|
|
58230
58549
|
try {
|
|
58231
|
-
const selectedPath = await selectSession((onProgress) => SessionManager.list(cwd, sessionDir, onProgress), (onProgress) => SessionManager.listAll(sessionDir, onProgress));
|
|
58550
|
+
const selectedPath = await selectSession((onProgress) => SessionManager.list(cwd, sessionDir, onProgress), (onProgress) => SessionManager.listAll(sessionDir, onProgress), settingsManager);
|
|
58232
58551
|
if (!selectedPath) {
|
|
58233
58552
|
console.log(chalk10.dim("No session selected"));
|
|
58234
58553
|
process.exit(0);
|
|
@@ -58251,6 +58570,7 @@ async function createSessionManager(parsed, cwd, sessionDir, settingsManager) {
|
|
|
58251
58570
|
return SessionManager.create(cwd, sessionDir, { id: parsed.sessionId });
|
|
58252
58571
|
}
|
|
58253
58572
|
async function promptForMissingSessionCwd(issue, settingsManager) {
|
|
58573
|
+
setCapabilityOverrides3(settingsManager.getTerminalCapabilityOverrides());
|
|
58254
58574
|
initTheme(settingsManager.getTheme());
|
|
58255
58575
|
setKeybindings3(KeybindingsManager.create());
|
|
58256
58576
|
return new Promise((resolve23) => {
|
|
@@ -61836,7 +62156,7 @@ var init_slash_commands = __esm(() => {
|
|
|
61836
62156
|
{ name: "tree", description: "Navigate session tree (switch branches)" },
|
|
61837
62157
|
{ name: "thinking", description: "Set thinking level", argumentHint: "<level>" },
|
|
61838
62158
|
{ name: "scoped-models", description: "Enable/disable models for ctrl+p cycling" },
|
|
61839
|
-
{ name: "fast", description: "Configure
|
|
62159
|
+
{ name: "fast", description: "Configure fast mode for chat and workflows on supported models" },
|
|
61840
62160
|
{ name: "export", description: "Export session (HTML default, or specify path: .html/.jsonl)" },
|
|
61841
62161
|
{ name: "import", description: "Import and resume a session from a JSONL file" },
|
|
61842
62162
|
{ name: "share", description: "Share session as a secret GitHub gist" },
|
|
@@ -62472,6 +62792,7 @@ function createFullscreenTui(options) {
|
|
|
62472
62792
|
openUrl: openBrowser
|
|
62473
62793
|
}),
|
|
62474
62794
|
onRightClickPaste: options.onRightClickPaste,
|
|
62795
|
+
copyOnSelect: options.copyOnSelect,
|
|
62475
62796
|
copySelection: options.copySelection ?? copySelectionToHostClipboard
|
|
62476
62797
|
}, options.shouldHandleViewportInput, options.onOverlayUnhandledInput);
|
|
62477
62798
|
}
|
|
@@ -62513,7 +62834,7 @@ function createInteractiveTuiReference(getTui) {
|
|
|
62513
62834
|
getPrototypeOf: () => Reflect.getPrototypeOf(getTui())
|
|
62514
62835
|
});
|
|
62515
62836
|
}
|
|
62516
|
-
var viewportInputListeners, viewportInputGates, overlayUnhandledInputHandlers, viewportInputReplays, viewportInputSubscriptions, SGR_MOUSE_SEQUENCE, LEFT_MOUSE_MODIFIER_MASK, AtomicTuiAltScreen, AtomicTuiMainScreen;
|
|
62837
|
+
var viewportInputListeners, viewportInputGates, overlayUnhandledInputHandlers, viewportInputReplays, overlayOwnedSelections, viewportInputSubscriptions, SGR_MOUSE_SEQUENCE, LEFT_MOUSE_MODIFIER_MASK, AtomicTuiAltScreen, AtomicTuiMainScreen;
|
|
62517
62838
|
var init_interactive_tui = __esm(() => {
|
|
62518
62839
|
init_clipboard();
|
|
62519
62840
|
init_open_browser();
|
|
@@ -62522,6 +62843,7 @@ var init_interactive_tui = __esm(() => {
|
|
|
62522
62843
|
viewportInputGates = new WeakMap;
|
|
62523
62844
|
overlayUnhandledInputHandlers = new WeakMap;
|
|
62524
62845
|
viewportInputReplays = new WeakSet;
|
|
62846
|
+
overlayOwnedSelections = new WeakSet;
|
|
62525
62847
|
viewportInputSubscriptions = new WeakMap;
|
|
62526
62848
|
SGR_MOUSE_SEQUENCE = /^\x1b\[<(\d+);\d+;\d+([Mm])/;
|
|
62527
62849
|
LEFT_MOUSE_MODIFIER_MASK = 4 | 8 | 16;
|
|
@@ -62537,8 +62859,20 @@ var init_interactive_tui = __esm(() => {
|
|
|
62537
62859
|
deferral.shouldDeferViewportInputToOverlay = () => !viewportInputReplays.has(this) && deferToOverlay?.() === true;
|
|
62538
62860
|
}
|
|
62539
62861
|
applyLineResets(lines) {
|
|
62862
|
+
if (overlayOwnedSelections.has(this) && !this.isFocusedOverlay())
|
|
62863
|
+
this.clearOverlayOwnedSelection();
|
|
62540
62864
|
return stripOverlayActiveRowMarker(super.applyLineResets(lines));
|
|
62541
62865
|
}
|
|
62866
|
+
clearOverlayOwnedSelection() {
|
|
62867
|
+
const selection = this;
|
|
62868
|
+
selection.selectionAnchor = undefined;
|
|
62869
|
+
selection.selectionFocus = undefined;
|
|
62870
|
+
selection.selectionInitialRange = undefined;
|
|
62871
|
+
selection.selectionPressActive = false;
|
|
62872
|
+
selection.selectionDragged = false;
|
|
62873
|
+
selection.lastClick = undefined;
|
|
62874
|
+
overlayOwnedSelections.delete(this);
|
|
62875
|
+
}
|
|
62542
62876
|
isPiTuiMouseSequence(data) {
|
|
62543
62877
|
if (parseMouseSequences(data))
|
|
62544
62878
|
return true;
|
|
@@ -62615,6 +62949,7 @@ var init_interactive_tui = __esm(() => {
|
|
|
62615
62949
|
if (isLeftMouseButton(sequence))
|
|
62616
62950
|
viewportListener(sequence.data);
|
|
62617
62951
|
}
|
|
62952
|
+
overlayOwnedSelections.add(this);
|
|
62618
62953
|
}
|
|
62619
62954
|
replayViewportInput(viewportListener, data) {
|
|
62620
62955
|
viewportInputReplays.add(this);
|
|
@@ -62682,7 +63017,11 @@ var init_interactive_tui = __esm(() => {
|
|
|
62682
63017
|
});
|
|
62683
63018
|
|
|
62684
63019
|
// src/modes/interactive/interactive-mode-base.ts
|
|
62685
|
-
import {
|
|
63020
|
+
import {
|
|
63021
|
+
isKeyRelease as isKeyRelease3,
|
|
63022
|
+
isViewportTUI,
|
|
63023
|
+
setCapabilityOverrides as setCapabilityOverrides4
|
|
63024
|
+
} from "@earendil-works/pi-tui";
|
|
62686
63025
|
function isFullscreenViewportAction(data, keybindings) {
|
|
62687
63026
|
return FULLSCREEN_VIEWPORT_ACTIONS.some((action) => keybindings.matches(data, action));
|
|
62688
63027
|
}
|
|
@@ -62743,6 +63082,18 @@ class InteractiveModeBase {
|
|
|
62743
63082
|
return false;
|
|
62744
63083
|
return this.defaultEditor.handleInput(data);
|
|
62745
63084
|
}
|
|
63085
|
+
setFullscreenCopyOnSelect(enabled) {
|
|
63086
|
+
if (this.renderer.mode === "fullscreen")
|
|
63087
|
+
this.renderer.setCopyOnSelect(enabled);
|
|
63088
|
+
}
|
|
63089
|
+
getFullscreenCopyOnSelect() {
|
|
63090
|
+
return this.renderer.mode === "fullscreen" ? this.renderer.getCopyOnSelect() : undefined;
|
|
63091
|
+
}
|
|
63092
|
+
async copyActiveFullscreenSelection() {
|
|
63093
|
+
if (this.renderer.mode !== "fullscreen" || !this.renderer.hasActiveSelection())
|
|
63094
|
+
return;
|
|
63095
|
+
return this.renderer.copyActiveSelectionToClipboard();
|
|
63096
|
+
}
|
|
62746
63097
|
onRightClickPaste = () => {
|
|
62747
63098
|
this.handleRightClickPaste();
|
|
62748
63099
|
};
|
|
@@ -62942,11 +63293,13 @@ class InteractiveModeBase {
|
|
|
62942
63293
|
await this.rebindCurrentSession();
|
|
62943
63294
|
await this.themeController.applyFromSettings();
|
|
62944
63295
|
});
|
|
63296
|
+
setCapabilityOverrides4(this.settingsManager.getTerminalCapabilityOverrides());
|
|
62945
63297
|
this.version = VERSION;
|
|
62946
63298
|
this.renderer = createInteractiveTui({
|
|
62947
63299
|
showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
|
|
62948
63300
|
logDirectory: runtimeHost.services.agentDir,
|
|
62949
63301
|
terminal: options.terminal,
|
|
63302
|
+
copyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
|
|
62950
63303
|
onRightClickPaste: this.onRightClickPaste,
|
|
62951
63304
|
shouldHandleViewportInput: this.shouldHandleViewportInput,
|
|
62952
63305
|
onOverlayUnhandledInput: this.onOverlayUnhandledInput,
|
|
@@ -64069,6 +64422,7 @@ var init_interactive_deferred_startup = __esm(() => {
|
|
|
64069
64422
|
try {
|
|
64070
64423
|
await this.bindCurrentSessionExtensions();
|
|
64071
64424
|
await this.session.reload({ reason: "startup" });
|
|
64425
|
+
this.applyRuntimeSettings();
|
|
64072
64426
|
this.rebuildChatFromMessages();
|
|
64073
64427
|
if (!this.promptTurnWorkingLoaderActive) {
|
|
64074
64428
|
this.stopWorkingLoader();
|
|
@@ -64757,6 +65111,7 @@ ${warningLines}`, 0, 0));
|
|
|
64757
65111
|
});
|
|
64758
65112
|
|
|
64759
65113
|
// src/modes/interactive/interactive-session-runtime.ts
|
|
65114
|
+
import { setCapabilityOverrides as setCapabilityOverrides5 } from "@earendil-works/pi-tui";
|
|
64760
65115
|
var init_interactive_session_runtime = __esm(() => {
|
|
64761
65116
|
init_interactive_mode_base();
|
|
64762
65117
|
init_interactive_mode_deps();
|
|
@@ -64843,6 +65198,8 @@ var init_interactive_session_runtime = __esm(() => {
|
|
|
64843
65198
|
}
|
|
64844
65199
|
};
|
|
64845
65200
|
InteractiveModeBase.prototype.applyRuntimeSettings = function() {
|
|
65201
|
+
setCapabilityOverrides5(this.settingsManager.getTerminalCapabilityOverrides());
|
|
65202
|
+
this.setFullscreenCopyOnSelect(this.settingsManager.getFullscreenCopyOnSelect());
|
|
64846
65203
|
this.transcriptScrollView?.setScrollbar(this.settingsManager.getFullscreenScrollbar());
|
|
64847
65204
|
this.footer.setSession(this.session);
|
|
64848
65205
|
this.usageMeter.setSession(this.session);
|
|
@@ -64912,7 +65269,7 @@ var init_interactive_extension_runtime = __esm(() => {
|
|
|
64912
65269
|
if (shortcuts.size === 0)
|
|
64913
65270
|
return;
|
|
64914
65271
|
const createContext = () => ({
|
|
64915
|
-
ui:
|
|
65272
|
+
ui: extensionRunner.getUIContext(),
|
|
64916
65273
|
mode: "tui",
|
|
64917
65274
|
hasUI: true,
|
|
64918
65275
|
cwd: this.sessionManager.getCwd(),
|
|
@@ -66359,6 +66716,9 @@ var init_interactive_input_handling = __esm(() => {
|
|
|
66359
66716
|
});
|
|
66360
66717
|
this.defaultEditor.onAction("app.message.followUp", () => this.handleFollowUp());
|
|
66361
66718
|
this.defaultEditor.onAction("app.message.dequeue", () => this.handleDequeue());
|
|
66719
|
+
this.defaultEditor.onAction("app.message.copy", () => {
|
|
66720
|
+
this.handleCopyCommand({ preferSelection: true });
|
|
66721
|
+
});
|
|
66362
66722
|
this.defaultEditor.onAction("app.session.new", () => this.handleClearCommand());
|
|
66363
66723
|
this.defaultEditor.onAction("app.session.tree", () => this.showTreeSelector());
|
|
66364
66724
|
this.defaultEditor.onAction("app.session.fork", () => this.showUserMessageSelector());
|
|
@@ -67266,7 +67626,8 @@ var init_interactive_agent_events = __esm(() => {
|
|
|
67266
67626
|
} else if (event.reason === "manual") {
|
|
67267
67627
|
this.manualCompactionTakeoverPending = false;
|
|
67268
67628
|
}
|
|
67269
|
-
|
|
67629
|
+
const resumesActiveRun = event.midTurn && !event.aborted && !event.errorMessage && !manualTakeoverPending;
|
|
67630
|
+
if (!manualTakeoverPending && !resumesActiveRun && this.settingsManager.getShowTerminalProgress()) {
|
|
67270
67631
|
this.ui.terminal.setProgress(false);
|
|
67271
67632
|
}
|
|
67272
67633
|
if (!manualTakeoverPending && this.autoCompactionEscapeHandlerSaved) {
|
|
@@ -68282,7 +68643,7 @@ var init_interactive_selectors = __esm(() => {
|
|
|
68282
68643
|
};
|
|
68283
68644
|
InteractiveModeBase.prototype.showFastModeSelector = function() {
|
|
68284
68645
|
if (!this.hasCodexFastModeSupportedModels()) {
|
|
68285
|
-
this.showWarning("
|
|
68646
|
+
this.showWarning("Fast mode isn't available for any configured model.");
|
|
68286
68647
|
return;
|
|
68287
68648
|
}
|
|
68288
68649
|
this.showSelector((done) => {
|
|
@@ -68341,6 +68702,7 @@ var init_interactive_selectors = __esm(() => {
|
|
|
68341
68702
|
showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
|
|
68342
68703
|
fullscreenScrollbar: this.settingsManager.getFullscreenScrollbar(),
|
|
68343
68704
|
fullscreenExitOutput: this.settingsManager.getFullscreenExitOutput(),
|
|
68705
|
+
fullscreenCopyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
|
|
68344
68706
|
editorPaddingX: this.settingsManager.getEditorPaddingX(),
|
|
68345
68707
|
outputPad: this.settingsManager.getOutputPad(),
|
|
68346
68708
|
showCacheMissNotices: this.settingsManager.getShowCacheMissNotices(),
|
|
@@ -68458,6 +68820,10 @@ var init_interactive_selectors = __esm(() => {
|
|
|
68458
68820
|
onFullscreenExitOutputChange: (output) => {
|
|
68459
68821
|
this.settingsManager.setFullscreenExitOutput(output);
|
|
68460
68822
|
},
|
|
68823
|
+
onFullscreenCopyOnSelectChange: (enabled) => {
|
|
68824
|
+
this.settingsManager.setFullscreenCopyOnSelect(enabled);
|
|
68825
|
+
this.setFullscreenCopyOnSelect(enabled);
|
|
68826
|
+
},
|
|
68461
68827
|
onEditorPaddingXChange: (padding) => {
|
|
68462
68828
|
this.settingsManager.setEditorPaddingX(padding);
|
|
68463
68829
|
this.defaultEditor.setPaddingX(padding);
|
|
@@ -69444,18 +69810,8 @@ var init_interactive_slash_commands = __esm(() => {
|
|
|
69444
69810
|
activeHeader.setExpanded(this.toolOutputExpanded);
|
|
69445
69811
|
}
|
|
69446
69812
|
setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
|
|
69447
|
-
this.
|
|
69813
|
+
this.applyRuntimeSettings();
|
|
69448
69814
|
await this.themeController.applyFromSettings();
|
|
69449
|
-
const editorPaddingX = this.settingsManager.getEditorPaddingX();
|
|
69450
|
-
const autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();
|
|
69451
|
-
this.defaultEditor.setPaddingX(editorPaddingX);
|
|
69452
|
-
this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);
|
|
69453
|
-
if (this.editor !== this.defaultEditor) {
|
|
69454
|
-
this.editor.setPaddingX?.(editorPaddingX);
|
|
69455
|
-
this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);
|
|
69456
|
-
}
|
|
69457
|
-
this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());
|
|
69458
|
-
this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
|
|
69459
69815
|
this.setupAutocompleteProvider();
|
|
69460
69816
|
const runner = this.session.extensionRunner;
|
|
69461
69817
|
this.setupExtensionShortcuts(runner);
|
|
@@ -69648,7 +70004,12 @@ Gist: ${hyperlink3(gistUrl, gistUrl)}`);
|
|
|
69648
70004
|
}
|
|
69649
70005
|
}
|
|
69650
70006
|
};
|
|
69651
|
-
InteractiveModeBase.prototype.handleCopyCommand = async function() {
|
|
70007
|
+
InteractiveModeBase.prototype.handleCopyCommand = async function(options = {}) {
|
|
70008
|
+
if (options.preferSelection && this.getFullscreenCopyOnSelect() === false) {
|
|
70009
|
+
const selectionCopied = await this.copyActiveFullscreenSelection();
|
|
70010
|
+
if (selectionCopied !== undefined)
|
|
70011
|
+
return;
|
|
70012
|
+
}
|
|
69652
70013
|
const text = this.session.getLastAssistantText();
|
|
69653
70014
|
if (!text) {
|
|
69654
70015
|
this.showError("No agent messages to copy yet.");
|
|
@@ -73702,6 +74063,8 @@ var init_rpc_extension_ui = __esm(() => {
|
|
|
73702
74063
|
});
|
|
73703
74064
|
|
|
73704
74065
|
// src/modes/rpc/rpc-session-binding.ts
|
|
74066
|
+
import { setCapabilityOverrides as setCapabilityOverrides6 } from "@earendil-works/pi-tui";
|
|
74067
|
+
|
|
73705
74068
|
class RpcSessionBinding {
|
|
73706
74069
|
session;
|
|
73707
74070
|
unsubscribe;
|
|
@@ -73745,6 +74108,7 @@ class RpcSessionBinding {
|
|
|
73745
74108
|
this.session = this.runtimeHost.session;
|
|
73746
74109
|
this.disposeSubscriptions();
|
|
73747
74110
|
const session = this.session;
|
|
74111
|
+
setCapabilityOverrides6(session.settingsManager.getTerminalCapabilityOverrides());
|
|
73748
74112
|
this.renderService?.bindSession(session);
|
|
73749
74113
|
this.footerDataProvider = new FooterDataProvider(session.sessionManager.getCwd());
|
|
73750
74114
|
const models = session.scopedModels.length > 0 ? session.scopedModels.map((scoped) => scoped.model) : session.modelRuntime.getAvailableSnapshot();
|
|
@@ -74640,8 +75004,9 @@ var init_config_selector = __esm(() => {
|
|
|
74640
75004
|
});
|
|
74641
75005
|
|
|
74642
75006
|
// src/cli/config-selector.ts
|
|
74643
|
-
import { ProcessTerminal as ProcessTerminal6, TuiMainScreen as TuiMainScreen8 } from "@earendil-works/pi-tui";
|
|
75007
|
+
import { ProcessTerminal as ProcessTerminal6, setCapabilityOverrides as setCapabilityOverrides7, TuiMainScreen as TuiMainScreen8 } from "@earendil-works/pi-tui";
|
|
74644
75008
|
async function selectConfig(options) {
|
|
75009
|
+
setCapabilityOverrides7(options.settingsManager.getTerminalCapabilityOverrides());
|
|
74645
75010
|
initTheme(options.settingsManager.getTheme(), true);
|
|
74646
75011
|
return new Promise((resolve23) => {
|
|
74647
75012
|
const ui = new TuiMainScreen8(new ProcessTerminal6, undefined, options.agentDir);
|
|
@@ -75494,6 +75859,7 @@ var init_package_manager_cli = __esm(() => {
|
|
|
75494
75859
|
});
|
|
75495
75860
|
|
|
75496
75861
|
// src/main.ts
|
|
75862
|
+
import { setCapabilityOverrides as setCapabilityOverrides8 } from "@earendil-works/pi-tui";
|
|
75497
75863
|
import chalk15 from "chalk";
|
|
75498
75864
|
function authCheckErrorMessage(error) {
|
|
75499
75865
|
return error instanceof AuthCommandError ? error.message : "Failed to check provider readiness";
|
|
@@ -75728,6 +76094,7 @@ async function main(argv, options) {
|
|
|
75728
76094
|
startupEarlyInputCapture = undefined;
|
|
75729
76095
|
}
|
|
75730
76096
|
const startupSettingsManager = SettingsManager.create(cwd, agentDir, { projectTrusted: startupProjectTrusted });
|
|
76097
|
+
setCapabilityOverrides8(startupSettingsManager.getTerminalCapabilityOverrides());
|
|
75731
76098
|
const startupSettingsDiagnostics = collectSettingsDiagnostics(startupSettingsManager, "startup session lookup");
|
|
75732
76099
|
if (appMode === "interactive" && parsed.useTheme !== undefined) {
|
|
75733
76100
|
startupSettingsManager.applyOverrides({ theme: parsed.useTheme });
|
|
@@ -75862,6 +76229,8 @@ async function main(argv, options) {
|
|
|
75862
76229
|
extensionFactories: isolateInteractiveHost ? undefined : extensionFactories
|
|
75863
76230
|
}
|
|
75864
76231
|
});
|
|
76232
|
+
if (isolateInteractiveHost)
|
|
76233
|
+
limitMandatoryIntercomToTool(services2.resourceLoader);
|
|
75865
76234
|
const { settingsManager: settingsManager2, modelRuntime: modelRuntime2, resourceLoader: resourceLoader2 } = services2;
|
|
75866
76235
|
const diagnostics = [
|
|
75867
76236
|
...services2.diagnostics,
|
|
@@ -75924,6 +76293,7 @@ async function main(argv, options) {
|
|
|
75924
76293
|
endTimingSpan(runtimeCreationSpan);
|
|
75925
76294
|
const { services, session, modelFallbackMessage } = runtime;
|
|
75926
76295
|
const { settingsManager, modelRuntime, resourceLoader } = services;
|
|
76296
|
+
setCapabilityOverrides8(settingsManager.getTerminalCapabilityOverrides());
|
|
75927
76297
|
applyHttpProxySettings(settingsManager.getGlobalSettings().httpProxy);
|
|
75928
76298
|
configureHttpDispatcher(settingsManager.getHttpIdleTimeoutMs());
|
|
75929
76299
|
if (parsed.help) {
|
|
@@ -76055,6 +76425,7 @@ var init_main = __esm(() => {
|
|
|
76055
76425
|
init_auth_storage();
|
|
76056
76426
|
init_builtin_packages();
|
|
76057
76427
|
init_http_dispatcher();
|
|
76428
|
+
init_mandatory_resource_loader();
|
|
76058
76429
|
init_model_resolver();
|
|
76059
76430
|
init_model_runtime();
|
|
76060
76431
|
init_output_guard();
|
|
@@ -77905,9 +78276,6 @@ function defaultIntercomExtensionDir(agentDir = defaultAgentDir()) {
|
|
|
77905
78276
|
function bundledIntercomExtensionDir() {
|
|
77906
78277
|
return path21.resolve(path21.dirname(fileURLToPath5(import.meta.url)), "..", "..", "..", "intercom");
|
|
77907
78278
|
}
|
|
77908
|
-
function defaultIntercomConfigPath(agentDir = defaultAgentDir()) {
|
|
77909
|
-
return path21.join(agentDir, "intercom", "config.json");
|
|
77910
|
-
}
|
|
77911
78279
|
function defaultSubagentConfigDir(agentDir = defaultAgentDir()) {
|
|
77912
78280
|
return path21.join(agentDir, "extensions", "subagent");
|
|
77913
78281
|
}
|
|
@@ -77957,16 +78325,6 @@ function resolveIntercomBridgeConfig(value) {
|
|
|
77957
78325
|
instructionFile: typeof value.instructionFile === "string" ? value.instructionFile : ""
|
|
77958
78326
|
};
|
|
77959
78327
|
}
|
|
77960
|
-
function intercomConfigStatus(configPath) {
|
|
77961
|
-
if (!fs18.existsSync(configPath))
|
|
77962
|
-
return { enabled: true };
|
|
77963
|
-
try {
|
|
77964
|
-
const parsed = JSON.parse(fs18.readFileSync(configPath, "utf-8"));
|
|
77965
|
-
return { enabled: parsed.enabled !== false };
|
|
77966
|
-
} catch (error) {
|
|
77967
|
-
return { enabled: true, error };
|
|
77968
|
-
}
|
|
77969
|
-
}
|
|
77970
78328
|
function readJsonBestEffort(filePath) {
|
|
77971
78329
|
try {
|
|
77972
78330
|
return JSON.parse(fs18.readFileSync(filePath, "utf-8"));
|
|
@@ -78102,25 +78460,6 @@ function resolveIntercomExtensionDir(input2, agentDir) {
|
|
|
78102
78460
|
return legacyDir;
|
|
78103
78461
|
return configuredPiIntercomPackageDir(input2, agentDir) ?? legacyDir;
|
|
78104
78462
|
}
|
|
78105
|
-
function extensionSandboxAllowsIntercom(extensions, extensionDir) {
|
|
78106
|
-
if (extensions === undefined)
|
|
78107
|
-
return true;
|
|
78108
|
-
const intercomDir = path21.resolve(extensionDir).replaceAll("\\", "/").toLowerCase();
|
|
78109
|
-
for (const entry of extensions) {
|
|
78110
|
-
const normalized = entry.trim().replaceAll("\\", "/").toLowerCase();
|
|
78111
|
-
if (normalized === "pi-intercom")
|
|
78112
|
-
return true;
|
|
78113
|
-
if (normalized === intercomDir)
|
|
78114
|
-
return true;
|
|
78115
|
-
if (normalized.startsWith(`${intercomDir}/`))
|
|
78116
|
-
return true;
|
|
78117
|
-
if (normalized.endsWith("/pi-intercom"))
|
|
78118
|
-
return true;
|
|
78119
|
-
if (normalized.includes("/pi-intercom/"))
|
|
78120
|
-
return true;
|
|
78121
|
-
}
|
|
78122
|
-
return false;
|
|
78123
|
-
}
|
|
78124
78463
|
function expandTilde(filePath) {
|
|
78125
78464
|
return filePath.startsWith("~/") ? path21.join(os7.homedir(), filePath.slice(2)) : filePath;
|
|
78126
78465
|
}
|
|
@@ -78163,13 +78502,6 @@ function resolveIntercomBridge(input2) {
|
|
|
78163
78502
|
if (!fs18.existsSync(extensionDir)) {
|
|
78164
78503
|
return { active: false, mode, extensionDir, instruction: defaultInstruction };
|
|
78165
78504
|
}
|
|
78166
|
-
const configPath = path21.resolve(input2.configPath ?? defaultIntercomConfigPath(agentDir));
|
|
78167
|
-
const intercomStatus = intercomConfigStatus(configPath);
|
|
78168
|
-
if (intercomStatus.error)
|
|
78169
|
-
console.warn(`Failed to parse intercom config at '${configPath}'. Assuming enabled.`, intercomStatus.error);
|
|
78170
|
-
if (!intercomStatus.enabled) {
|
|
78171
|
-
return { active: false, mode, extensionDir, instruction: defaultInstruction };
|
|
78172
|
-
}
|
|
78173
78505
|
const instruction = buildIntercomBridgeInstruction(orchestratorTarget, resolveInstructionTemplate(config.instructionFile, settingsDir));
|
|
78174
78506
|
return {
|
|
78175
78507
|
active: true,
|
|
@@ -78182,8 +78514,6 @@ function resolveIntercomBridge(input2) {
|
|
|
78182
78514
|
function applyIntercomBridgeToAgent(agent, bridge) {
|
|
78183
78515
|
if (!bridge.active || !bridge.orchestratorTarget)
|
|
78184
78516
|
return agent;
|
|
78185
|
-
if (!extensionSandboxAllowsIntercom(agent.extensions, bridge.extensionDir))
|
|
78186
|
-
return agent;
|
|
78187
78517
|
const bridgeTools = ["intercom", "contact_supervisor"];
|
|
78188
78518
|
const tools = agent.tools ? [...agent.tools, ...bridgeTools.filter((tool) => !agent.tools?.includes(tool))] : agent.tools;
|
|
78189
78519
|
const instruction = bridge.instruction;
|
|
@@ -80032,23 +80362,45 @@ function getSubagentCodexFastModeSettings(cwd) {
|
|
|
80032
80362
|
return { chat: false, workflow: false };
|
|
80033
80363
|
}
|
|
80034
80364
|
}
|
|
80035
|
-
function
|
|
80365
|
+
function modelIdentityFromModelId(model) {
|
|
80036
80366
|
if (!model)
|
|
80037
80367
|
return;
|
|
80038
80368
|
const { baseModel } = splitKnownThinkingSuffix(model);
|
|
80039
|
-
|
|
80369
|
+
const slash = baseModel.indexOf("/");
|
|
80370
|
+
if (slash <= 0 || slash === baseModel.length - 1)
|
|
80040
80371
|
return;
|
|
80041
|
-
return baseModel.
|
|
80372
|
+
return { provider: baseModel.slice(0, slash), id: baseModel.slice(slash + 1) };
|
|
80373
|
+
}
|
|
80374
|
+
function resolvedIdentityMatches(resolved, model) {
|
|
80375
|
+
if (!model)
|
|
80376
|
+
return true;
|
|
80377
|
+
const parsed = modelIdentityFromModelId(model);
|
|
80378
|
+
if (!parsed)
|
|
80379
|
+
return false;
|
|
80380
|
+
if (parsed.provider !== resolved.provider)
|
|
80381
|
+
return false;
|
|
80382
|
+
return resolved.id === undefined || parsed.id === resolved.id;
|
|
80042
80383
|
}
|
|
80043
|
-
function
|
|
80044
|
-
|
|
80384
|
+
function identityForFastMode(input2) {
|
|
80385
|
+
if (input2.resolvedModel && resolvedIdentityMatches(input2.resolvedModel, input2.model)) {
|
|
80386
|
+
return input2.resolvedModel;
|
|
80387
|
+
}
|
|
80388
|
+
if (input2.model) {
|
|
80389
|
+
const resolved = input2.resolveModel?.(input2.model);
|
|
80390
|
+
if (resolved)
|
|
80391
|
+
return resolved;
|
|
80392
|
+
}
|
|
80393
|
+
return modelIdentityFromModelId(input2.model);
|
|
80394
|
+
}
|
|
80395
|
+
function resolveSubagentCodexFastModeScope(orchestrationContext) {
|
|
80396
|
+
return orchestrationContext?.kind === "workflow-stage" ? "workflow" : "chat";
|
|
80045
80397
|
}
|
|
80046
80398
|
function resolveSubagentModelFastMode(input2) {
|
|
80047
|
-
const
|
|
80048
|
-
if (!
|
|
80399
|
+
const model = identityForFastMode(input2);
|
|
80400
|
+
if (!model)
|
|
80049
80401
|
return false;
|
|
80050
80402
|
const settings = input2.settings ?? getSubagentCodexFastModeSettings(input2.cwd);
|
|
80051
|
-
return shouldApplyCodexFastModeForScope(
|
|
80403
|
+
return shouldApplyCodexFastModeForScope(model, settings, input2.scope ?? "chat", input2.copilotCredential);
|
|
80052
80404
|
}
|
|
80053
80405
|
|
|
80054
80406
|
// dist/builtin/subagents/src/shared/jsonl-writer.ts
|
|
@@ -80228,10 +80580,11 @@ function thinkingLevelForSession(session) {
|
|
|
80228
80580
|
function initialThinkingForAttempt(model, configuredThinking) {
|
|
80229
80581
|
return resolveEffectiveThinking(model, configuredThinking) ?? configuredThinking;
|
|
80230
80582
|
}
|
|
80231
|
-
function defaultFastModeForChild(cwd, context,
|
|
80583
|
+
function defaultFastModeForChild(cwd, context, resolvedModel) {
|
|
80232
80584
|
const settings = getSubagentCodexFastModeSettings(cwd);
|
|
80233
|
-
const scope = resolveSubagentCodexFastModeScope(
|
|
80234
|
-
|
|
80585
|
+
const scope = resolveSubagentCodexFastModeScope(context);
|
|
80586
|
+
const copilotCredential = readStoredCredential("github-copilot");
|
|
80587
|
+
return (model) => resolveSubagentModelFastMode({ model, resolvedModel, cwd, settings, scope, copilotCredential });
|
|
80235
80588
|
}
|
|
80236
80589
|
var EMPTY_STATS = {
|
|
80237
80590
|
sessionFile: undefined,
|
|
@@ -80989,7 +81342,7 @@ class SubagentControlRuntime {
|
|
|
80989
81342
|
startAttempt(admitted, candidate, signals, options = {}) {
|
|
80990
81343
|
const initialModel = modelIdForCandidate(candidate, admitted.policy.model);
|
|
80991
81344
|
const initialThinking = initialThinkingForAttempt(initialModel, candidate.thinkingLevel ?? admitted.policy.thinkingLevel);
|
|
80992
|
-
const fastModeForModel = options.fastModeForModel ?? defaultFastModeForChild(admitted.policy.cwd, admitted.spec.parent?.orchestrationContext,
|
|
81345
|
+
const fastModeForModel = options.fastModeForModel ?? defaultFastModeForChild(admitted.policy.cwd, admitted.spec.parent?.orchestrationContext, candidate.model);
|
|
80993
81346
|
const running = {
|
|
80994
81347
|
id: this.nextAttemptId++,
|
|
80995
81348
|
child: admitted,
|
|
@@ -83845,6 +84198,7 @@ ${worktreeSuffix}` : childContent;
|
|
|
83845
84198
|
}
|
|
83846
84199
|
|
|
83847
84200
|
// dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts
|
|
84201
|
+
init_src();
|
|
83848
84202
|
import { existsSync as existsSync63, statSync as statSync21 } from "node:fs";
|
|
83849
84203
|
import { join as join92 } from "node:path";
|
|
83850
84204
|
|
|
@@ -84069,17 +84423,12 @@ function progressFor(agent, task, outcome, startedAt, fastMode) {
|
|
|
84069
84423
|
...outcome.status === "interrupted" && isParentCancellation(outcome.cause) ? { cause: outcome.cause } : {}
|
|
84070
84424
|
};
|
|
84071
84425
|
}
|
|
84072
|
-
function resultFromOutcome(agent, task, outcome, startedAt, artifactPaths,
|
|
84426
|
+
function resultFromOutcome(agent, task, outcome, startedAt, artifactPaths, fastModeForModel) {
|
|
84073
84427
|
const status = outcome.status;
|
|
84074
84428
|
const output = outcome.status === "ok" ? outcome.output : outcome.envelope;
|
|
84075
84429
|
const model = outcome.model;
|
|
84076
84430
|
const thinking = outcome.thinking;
|
|
84077
|
-
const fastModeEnabled =
|
|
84078
|
-
model,
|
|
84079
|
-
cwd: fastMode.cwd,
|
|
84080
|
-
settings: fastMode.settings,
|
|
84081
|
-
scope: fastMode.scope
|
|
84082
|
-
});
|
|
84431
|
+
const fastModeEnabled = fastModeForModel(model);
|
|
84083
84432
|
const result2 = {
|
|
84084
84433
|
agent: agent.name,
|
|
84085
84434
|
task,
|
|
@@ -84157,13 +84506,18 @@ async function runSingleInProcess(runtimeCwd, agent, task, options) {
|
|
|
84157
84506
|
const inheritsDispatchConfig = agent.model === undefined && (agent.fallbackModels === undefined || agent.fallbackModels.length === 0) && options.modelOverride === undefined;
|
|
84158
84507
|
const resolvedCandidate = candidate ? options.resolveCandidateModel?.(candidate) : undefined;
|
|
84159
84508
|
const fastModeSettings = getSubagentCodexFastModeSettings(cwd);
|
|
84509
|
+
const copilotCredential = readStoredCredential("github-copilot");
|
|
84160
84510
|
const orchestrationContext = workflowOrchestrationContext(options);
|
|
84161
|
-
const fastModeScope = resolveSubagentCodexFastModeScope(
|
|
84511
|
+
const fastModeScope = resolveSubagentCodexFastModeScope(orchestrationContext);
|
|
84512
|
+
const resolveModel = (modelId) => options.resolveCandidateModel?.(modelId)?.model;
|
|
84162
84513
|
const fastModeForModel = (model) => resolveSubagentModelFastMode({
|
|
84163
84514
|
model,
|
|
84515
|
+
resolvedModel: resolvedCandidate?.model,
|
|
84516
|
+
resolveModel,
|
|
84164
84517
|
cwd,
|
|
84165
84518
|
settings: fastModeSettings,
|
|
84166
|
-
scope: fastModeScope
|
|
84519
|
+
scope: fastModeScope,
|
|
84520
|
+
copilotCredential
|
|
84167
84521
|
});
|
|
84168
84522
|
const parent = {
|
|
84169
84523
|
path: options.runId,
|
|
@@ -84296,11 +84650,7 @@ ${task}`);
|
|
|
84296
84650
|
detachCleanup();
|
|
84297
84651
|
parentAskCleanup();
|
|
84298
84652
|
running.promise.then(async (continuedOutcome) => {
|
|
84299
|
-
const recovered = resultFromOutcome(agent, task, continuedOutcome, startedAt, artifactPaths,
|
|
84300
|
-
cwd,
|
|
84301
|
-
settings: fastModeSettings,
|
|
84302
|
-
scope: fastModeScope
|
|
84303
|
-
});
|
|
84653
|
+
const recovered = resultFromOutcome(agent, task, continuedOutcome, startedAt, artifactPaths, fastModeForModel);
|
|
84304
84654
|
await control.deliverChildResult({
|
|
84305
84655
|
path: continuedOutcome.path,
|
|
84306
84656
|
status: continuedOutcome.status,
|
|
@@ -84362,11 +84712,7 @@ ${task}`);
|
|
|
84362
84712
|
detachCleanup();
|
|
84363
84713
|
parentAskCleanup();
|
|
84364
84714
|
const outcome = winner.value;
|
|
84365
|
-
const result2 = resultFromOutcome(agent, task, outcome, startedAt, artifactPaths,
|
|
84366
|
-
cwd,
|
|
84367
|
-
settings: fastModeSettings,
|
|
84368
|
-
scope: fastModeScope
|
|
84369
|
-
});
|
|
84715
|
+
const result2 = resultFromOutcome(agent, task, outcome, startedAt, artifactPaths, fastModeForModel);
|
|
84370
84716
|
if (filteredCandidates.skippedAttempts.length)
|
|
84371
84717
|
result2.modelAttempts = [...filteredCandidates.skippedAttempts, ...result2.modelAttempts ?? []];
|
|
84372
84718
|
await control.deliverChildResult({
|