@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
|
@@ -324,15 +324,15 @@ ${chalk.bold("Options:")}
|
|
|
324
324
|
--name, -n <name> Set session display name
|
|
325
325
|
--models <patterns> Comma-separated model patterns for ctrl+p cycling
|
|
326
326
|
Supports globs (anthropic/*, *sonnet*) and fuzzy matching
|
|
327
|
-
--no-tools, -nt Disable
|
|
327
|
+
--no-tools, -nt Disable every tool except mandatory ordinary intercom
|
|
328
328
|
--no-builtin-tools, -nbt Disable built-in tools by default but keep extension/custom tools enabled
|
|
329
|
-
--tools, -t <tools> Comma-separated allowlist of tool names
|
|
330
|
-
|
|
331
|
-
--exclude-tools, -xt <tools> Comma-separated denylist of tool names
|
|
332
|
-
|
|
329
|
+
--tools, -t <tools> Comma-separated allowlist of non-mandatory tool names
|
|
330
|
+
Mandatory ordinary intercom remains available
|
|
331
|
+
--exclude-tools, -xt <tools> Comma-separated denylist of non-mandatory tool names
|
|
332
|
+
Mandatory ordinary intercom cannot be excluded
|
|
333
333
|
--thinking <level> Set thinking level: off, minimal, low, medium, high, xhigh, max
|
|
334
334
|
--extension, -e <path> Load an extension file (can be used multiple times)
|
|
335
|
-
--no-extensions, -ne Disable extension discovery
|
|
335
|
+
--no-extensions, -ne Disable optional extension discovery; mandatory bundled Intercom remains loaded
|
|
336
336
|
--skill <path> Load a skill file or directory (can be used multiple times)
|
|
337
337
|
--no-skills, -ns Disable skills discovery and loading
|
|
338
338
|
--prompt-template <path> Load a prompt template file or directory (can be used multiple times)
|
|
@@ -5820,11 +5820,13 @@ function runSynchronousCallback(descriptor, callback) {
|
|
|
5820
5820
|
}
|
|
5821
5821
|
}
|
|
5822
5822
|
async function runCallback(descriptor, callback) {
|
|
5823
|
+
if (!reporter)
|
|
5824
|
+
return callback();
|
|
5825
|
+
await yieldToEventLoop();
|
|
5823
5826
|
const active = beginActivity(descriptor);
|
|
5824
5827
|
if (!active)
|
|
5825
5828
|
return callback();
|
|
5826
5829
|
try {
|
|
5827
|
-
await yieldToEventLoop();
|
|
5828
5830
|
return await callback();
|
|
5829
5831
|
} finally {
|
|
5830
5832
|
active.reporter.finished(active.activity.id);
|
|
@@ -8260,12 +8262,42 @@ async function runInputHandlers(extensions, ctx, text, images, source, streaming
|
|
|
8260
8262
|
return currentText !== text || currentImages !== images ? { action: "transform", text: currentText, images: currentImages } : { action: "continue" };
|
|
8261
8263
|
}
|
|
8262
8264
|
|
|
8265
|
+
// src/core/mandatory-runtime-tools.ts
|
|
8266
|
+
var MANDATORY_TOOL_NAMES = new Set(["intercom"]);
|
|
8267
|
+
var TRUSTED_MANDATORY_DEFINITIONS = new WeakSet;
|
|
8268
|
+
function markTrustedMandatoryRuntimeExtension(extension) {
|
|
8269
|
+
extension.sourceInfo = { ...extension.sourceInfo, configurationOrigin: "bundled" };
|
|
8270
|
+
for (const registration of extension.tools.values()) {
|
|
8271
|
+
registration.sourceInfo = extension.sourceInfo;
|
|
8272
|
+
if (MANDATORY_TOOL_NAMES.has(registration.definition.name)) {
|
|
8273
|
+
TRUSTED_MANDATORY_DEFINITIONS.add(registration.definition);
|
|
8274
|
+
}
|
|
8275
|
+
}
|
|
8276
|
+
for (const command of extension.commands.values())
|
|
8277
|
+
command.sourceInfo = extension.sourceInfo;
|
|
8278
|
+
}
|
|
8279
|
+
function isTrustedMandatoryRuntimeTool(registration) {
|
|
8280
|
+
return MANDATORY_TOOL_NAMES.has(registration.definition.name) && TRUSTED_MANDATORY_DEFINITIONS.has(registration.definition);
|
|
8281
|
+
}
|
|
8282
|
+
function isMandatoryRuntimeTool(name) {
|
|
8283
|
+
return MANDATORY_TOOL_NAMES.has(name);
|
|
8284
|
+
}
|
|
8285
|
+
function appendRegisteredMandatoryTools(tools, registry) {
|
|
8286
|
+
for (const name of MANDATORY_TOOL_NAMES) {
|
|
8287
|
+
const tool = registry.get(name);
|
|
8288
|
+
if (tool && !tools.some((candidate) => candidate.name === name))
|
|
8289
|
+
tools.push(tool);
|
|
8290
|
+
}
|
|
8291
|
+
return tools;
|
|
8292
|
+
}
|
|
8293
|
+
|
|
8263
8294
|
// src/core/extensions/runner-registries.ts
|
|
8264
8295
|
function collectRegisteredTools(extensions) {
|
|
8265
8296
|
const toolsByName = new Map;
|
|
8266
8297
|
for (const ext of extensions) {
|
|
8267
8298
|
for (const tool of ext.tools.values()) {
|
|
8268
|
-
|
|
8299
|
+
const existing = toolsByName.get(tool.definition.name);
|
|
8300
|
+
if (!existing || isMandatoryRuntimeTool(tool.definition.name) && isTrustedMandatoryRuntimeTool(tool)) {
|
|
8269
8301
|
toolsByName.set(tool.definition.name, tool);
|
|
8270
8302
|
}
|
|
8271
8303
|
}
|
|
@@ -8273,13 +8305,16 @@ function collectRegisteredTools(extensions) {
|
|
|
8273
8305
|
return Array.from(toolsByName.values());
|
|
8274
8306
|
}
|
|
8275
8307
|
function findToolDefinition(extensions, toolName) {
|
|
8308
|
+
let first;
|
|
8276
8309
|
for (const ext of extensions) {
|
|
8277
8310
|
const tool = ext.tools.get(toolName);
|
|
8278
|
-
if (tool)
|
|
8311
|
+
if (!tool)
|
|
8312
|
+
continue;
|
|
8313
|
+
first ??= tool;
|
|
8314
|
+
if (isMandatoryRuntimeTool(toolName) && isTrustedMandatoryRuntimeTool(tool))
|
|
8279
8315
|
return tool.definition;
|
|
8280
|
-
}
|
|
8281
8316
|
}
|
|
8282
|
-
return;
|
|
8317
|
+
return first?.definition;
|
|
8283
8318
|
}
|
|
8284
8319
|
function collectFlags(extensions) {
|
|
8285
8320
|
const allFlags = new Map;
|
|
@@ -8362,6 +8397,7 @@ var RESERVED_KEYBINDINGS_FOR_EXTENSION_CONFLICTS = [
|
|
|
8362
8397
|
"app.thinking.toggle",
|
|
8363
8398
|
"app.editor.external",
|
|
8364
8399
|
"app.message.followUp",
|
|
8400
|
+
"app.message.copy",
|
|
8365
8401
|
"tui.input.submit",
|
|
8366
8402
|
"tui.select.confirm",
|
|
8367
8403
|
"tui.select.cancel",
|
|
@@ -8558,6 +8594,8 @@ class ExtensionRunner {
|
|
|
8558
8594
|
shortcutDiagnostics = [];
|
|
8559
8595
|
commandDiagnostics = [];
|
|
8560
8596
|
staleMessage;
|
|
8597
|
+
uiPromptBinding = 0;
|
|
8598
|
+
activeUIPrompt;
|
|
8561
8599
|
constructor(extensions, runtime, cwd, sessionManager, modelRegistry, orchestrationContext, subagentPolicy) {
|
|
8562
8600
|
this.extensions = extensions;
|
|
8563
8601
|
this.runtime = runtime;
|
|
@@ -8652,9 +8690,71 @@ class ExtensionRunner {
|
|
|
8652
8690
|
this.reloadHandler = async () => {};
|
|
8653
8691
|
}
|
|
8654
8692
|
setUIContext(uiContext, mode = "print") {
|
|
8655
|
-
this.
|
|
8693
|
+
this.endActiveUIPrompt();
|
|
8694
|
+
const binding = ++this.uiPromptBinding;
|
|
8695
|
+
this.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;
|
|
8656
8696
|
this.mode = mode;
|
|
8657
8697
|
}
|
|
8698
|
+
wrapUIPromptContext(ui, binding) {
|
|
8699
|
+
return {
|
|
8700
|
+
...ui,
|
|
8701
|
+
select: (title, options, opts) => this.withUIPrompt(binding, "select", title, () => ui.select(title, options, opts)),
|
|
8702
|
+
confirm: (title, message, opts) => this.withUIPrompt(binding, "confirm", title, () => ui.confirm(title, message, opts)),
|
|
8703
|
+
input: (title, placeholder, opts) => this.withUIPrompt(binding, "input", title, () => ui.input(title, placeholder, opts)),
|
|
8704
|
+
editor: (title, prefill, opts) => this.withUIPrompt(binding, "editor", title, () => ui.editor(title, prefill, opts)),
|
|
8705
|
+
custom: (factory, options) => this.withUIPrompt(binding, "custom", undefined, () => ui.custom(factory, options))
|
|
8706
|
+
};
|
|
8707
|
+
}
|
|
8708
|
+
withUIPrompt(binding, kind, title, run) {
|
|
8709
|
+
if (binding !== this.uiPromptBinding)
|
|
8710
|
+
return run();
|
|
8711
|
+
let prompt = this.activeUIPrompt;
|
|
8712
|
+
if (!prompt) {
|
|
8713
|
+
prompt = { depth: 0, kind, title };
|
|
8714
|
+
this.activeUIPrompt = prompt;
|
|
8715
|
+
this.emitUIPromptEvent({
|
|
8716
|
+
type: "ui_prompt_start",
|
|
8717
|
+
reason: "ui_prompt",
|
|
8718
|
+
kind,
|
|
8719
|
+
...title === undefined ? {} : { title }
|
|
8720
|
+
});
|
|
8721
|
+
}
|
|
8722
|
+
prompt.depth += 1;
|
|
8723
|
+
let finished = false;
|
|
8724
|
+
const finish = () => {
|
|
8725
|
+
if (finished)
|
|
8726
|
+
return;
|
|
8727
|
+
finished = true;
|
|
8728
|
+
if (this.activeUIPrompt !== prompt)
|
|
8729
|
+
return;
|
|
8730
|
+
prompt.depth -= 1;
|
|
8731
|
+
if (prompt.depth === 0)
|
|
8732
|
+
this.endActiveUIPrompt(prompt);
|
|
8733
|
+
};
|
|
8734
|
+
try {
|
|
8735
|
+
return run().finally(finish);
|
|
8736
|
+
} catch (error) {
|
|
8737
|
+
finish();
|
|
8738
|
+
throw error;
|
|
8739
|
+
}
|
|
8740
|
+
}
|
|
8741
|
+
endActiveUIPrompt(prompt = this.activeUIPrompt) {
|
|
8742
|
+
if (!prompt || this.activeUIPrompt !== prompt)
|
|
8743
|
+
return;
|
|
8744
|
+
this.activeUIPrompt = undefined;
|
|
8745
|
+
prompt.depth = 0;
|
|
8746
|
+
this.emitUIPromptEvent({
|
|
8747
|
+
type: "ui_prompt_end",
|
|
8748
|
+
reason: "ui_prompt",
|
|
8749
|
+
kind: prompt.kind,
|
|
8750
|
+
...prompt.title === undefined ? {} : { title: prompt.title }
|
|
8751
|
+
});
|
|
8752
|
+
}
|
|
8753
|
+
emitUIPromptEvent(event) {
|
|
8754
|
+
queueMicrotask(() => {
|
|
8755
|
+
this.emit(event);
|
|
8756
|
+
});
|
|
8757
|
+
}
|
|
8658
8758
|
getUIContext() {
|
|
8659
8759
|
return this.uiContext;
|
|
8660
8760
|
}
|
|
@@ -11023,11 +11123,13 @@ async function _runAgentContinue() {
|
|
|
11023
11123
|
}
|
|
11024
11124
|
async function _continueQueuedAgentMessages() {
|
|
11025
11125
|
await this._agentEventQueue;
|
|
11026
|
-
while (!this._queuedMessagesPaused && this.agent.hasQueuedMessages()) {
|
|
11126
|
+
while (!this._stopAfterTurnBlockedContinuation && !this._queuedMessagesPaused && this.agent.hasQueuedMessages()) {
|
|
11027
11127
|
await this.agent.continue();
|
|
11028
11128
|
await this.waitForRetry();
|
|
11029
11129
|
await this._agentEventQueue;
|
|
11030
11130
|
}
|
|
11131
|
+
if (this._stopAfterTurnBlockedContinuation)
|
|
11132
|
+
return;
|
|
11031
11133
|
await answerAdmittedQueuedMessage(this);
|
|
11032
11134
|
}
|
|
11033
11135
|
async function answerAdmittedQueuedMessage(session) {
|
|
@@ -12711,14 +12813,13 @@ function getToolDefinition(name) {
|
|
|
12711
12813
|
}
|
|
12712
12814
|
function setActiveToolsByName(toolNames) {
|
|
12713
12815
|
const tools = [];
|
|
12714
|
-
const validToolNames = [];
|
|
12715
12816
|
for (const name of toolNames) {
|
|
12716
12817
|
const tool = this._toolRegistry.get(name);
|
|
12717
|
-
if (tool)
|
|
12818
|
+
if (tool)
|
|
12718
12819
|
tools.push(tool);
|
|
12719
|
-
validToolNames.push(name);
|
|
12720
|
-
}
|
|
12721
12820
|
}
|
|
12821
|
+
appendRegisteredMandatoryTools(tools, this._toolRegistry);
|
|
12822
|
+
const validToolNames = tools.map((tool) => tool.name);
|
|
12722
12823
|
this.agent.state.tools = tools;
|
|
12723
12824
|
this._baseSystemPrompt = this._rebuildSystemPrompt(validToolNames);
|
|
12724
12825
|
this.agent.state.systemPrompt = this._systemPromptOverride ?? this._baseSystemPrompt;
|
|
@@ -12775,7 +12876,7 @@ function _rebuildSystemPrompt(toolNames) {
|
|
|
12775
12876
|
customPrompt: loaderSystemPrompt,
|
|
12776
12877
|
appendSystemPrompt,
|
|
12777
12878
|
selectedTools: validToolNames,
|
|
12778
|
-
excludedTools: this._excludedToolNames ? Array.from(this._excludedToolNames) : undefined,
|
|
12879
|
+
excludedTools: this._excludedToolNames ? Array.from(this._excludedToolNames).filter((name) => !isMandatoryRuntimeTool(name)) : undefined,
|
|
12779
12880
|
toolSnippets,
|
|
12780
12881
|
promptGuidelines
|
|
12781
12882
|
};
|
|
@@ -13786,6 +13887,17 @@ function _installAgentToolHooks() {
|
|
|
13786
13887
|
}
|
|
13787
13888
|
function _installAgentNextTurnRefresh() {
|
|
13788
13889
|
const previousPrepareNextTurnWithContext = this.agent.prepareNextTurnWithContext ?? (this.agent.prepareNextTurn ? async (_turn, signal) => await this.agent.prepareNextTurn?.(signal) : undefined);
|
|
13890
|
+
const previousShouldStopAfterTurn = this.agent.shouldStopAfterTurn;
|
|
13891
|
+
this.agent.shouldStopAfterTurn = async (turn, signal) => {
|
|
13892
|
+
const toolCallIds = turn.message.content.filter((part) => part.type === "toolCall").map((part) => part.id);
|
|
13893
|
+
const terminatingBatch = toolCallIds.length > 0 && toolCallIds.every((id) => this._terminatingToolCallIds.has(id));
|
|
13894
|
+
for (const id of toolCallIds)
|
|
13895
|
+
this._terminatingToolCallIds.delete(id);
|
|
13896
|
+
const shouldStop = await previousShouldStopAfterTurn?.(turn, signal) ?? false;
|
|
13897
|
+
this._stopAfterTurnBlockedContinuation = shouldStop;
|
|
13898
|
+
await settleFallbackAfterTurn(this, turn, terminatingBatch);
|
|
13899
|
+
return shouldStop;
|
|
13900
|
+
};
|
|
13789
13901
|
const previousTransformContext = this.agent.transformContext;
|
|
13790
13902
|
this.agent.transformContext = async (messages, signal) => {
|
|
13791
13903
|
const transformed = previousTransformContext ? await previousTransformContext(messages, signal) : messages;
|
|
@@ -13793,24 +13905,17 @@ function _installAgentNextTurnRefresh() {
|
|
|
13793
13905
|
assertToolPairingInvariant(guarded);
|
|
13794
13906
|
return guarded;
|
|
13795
13907
|
};
|
|
13796
|
-
|
|
13797
|
-
const
|
|
13798
|
-
const
|
|
13799
|
-
const
|
|
13800
|
-
const
|
|
13801
|
-
|
|
13802
|
-
this._terminatingToolCallIds.delete(id);
|
|
13803
|
-
const messages = turn.toolResults.length > 0 && !terminatingBatch ? await this._preflightPostToolContext(previousContext.messages, signal) : previousContext.messages;
|
|
13804
|
-
const preserveFallbackForFailure = turn.message.role === "assistant" && !this.agent.hasQueuedMessages() && (turn.message.stopReason === "length" || this._isEmptyCompletion?.(turn.message) === true || this._isSafetyRefusal?.(turn.message) === true);
|
|
13805
|
-
if (!preserveFallbackForFailure && (turn.toolResults.length === 0 || terminatingBatch)) {
|
|
13806
|
-
await this._agentEventQueue;
|
|
13807
|
-
await this._settleFallbackModelScope();
|
|
13808
|
-
}
|
|
13908
|
+
const prepareTurn = async (turn, signal) => {
|
|
13909
|
+
const compactedMessages = turn.toolResults.length > 0 ? await this._preflightPostToolContext(turn.context.messages, signal) : turn.context.messages;
|
|
13910
|
+
const compactedContext = compactedMessages === turn.context.messages ? turn.context : { ...turn.context, messages: compactedMessages };
|
|
13911
|
+
const preparedTurn = compactedContext === turn.context ? turn : { ...turn, context: compactedContext };
|
|
13912
|
+
const previousSnapshot = await previousPrepareNextTurnWithContext?.(preparedTurn, signal);
|
|
13913
|
+
const previousContext = previousSnapshot?.context ?? compactedContext;
|
|
13809
13914
|
return {
|
|
13810
13915
|
...previousSnapshot,
|
|
13811
13916
|
context: {
|
|
13812
13917
|
...previousContext,
|
|
13813
|
-
messages,
|
|
13918
|
+
messages: previousContext.messages,
|
|
13814
13919
|
systemPrompt: this._systemPromptOverride ?? this._baseSystemPrompt,
|
|
13815
13920
|
tools: this.agent.state.tools.slice()
|
|
13816
13921
|
},
|
|
@@ -13818,6 +13923,14 @@ function _installAgentNextTurnRefresh() {
|
|
|
13818
13923
|
thinkingLevel: this.agent.state.thinkingLevel
|
|
13819
13924
|
};
|
|
13820
13925
|
};
|
|
13926
|
+
this.agent.prepareNextTurnWithContext = prepareTurn;
|
|
13927
|
+
}
|
|
13928
|
+
async function settleFallbackAfterTurn(session, turn, terminatingBatch) {
|
|
13929
|
+
const preserveFallbackForFailure = turn.message.role === "assistant" && !session.agent.hasQueuedMessages() && (turn.message.stopReason === "length" || session._isEmptyCompletion?.(turn.message) === true || session._isSafetyRefusal?.(turn.message) === true);
|
|
13930
|
+
if (!preserveFallbackForFailure && (turn.toolResults.length === 0 || terminatingBatch)) {
|
|
13931
|
+
await session._agentEventQueue;
|
|
13932
|
+
await session._settleFallbackModelScope();
|
|
13933
|
+
}
|
|
13821
13934
|
}
|
|
13822
13935
|
var agentSessionToolHooksMethods = {
|
|
13823
13936
|
_installAgentToolHooks,
|
|
@@ -14311,7 +14424,7 @@ async function loadVirtualModules() {
|
|
|
14311
14424
|
import("@bastani/pi-ai/oauth"),
|
|
14312
14425
|
import("@bastani/pi-ai/api/cloudflare-gateway-binding"),
|
|
14313
14426
|
import("proper-lockfile"),
|
|
14314
|
-
import("./chunk-
|
|
14427
|
+
import("./chunk-dattsgxg.js")
|
|
14315
14428
|
]);
|
|
14316
14429
|
return {
|
|
14317
14430
|
typebox,
|
|
@@ -14696,6 +14809,15 @@ async function loadExtensionModule(extensionPath, cacheToken) {
|
|
|
14696
14809
|
}
|
|
14697
14810
|
|
|
14698
14811
|
// src/core/extensions/loader-core.ts
|
|
14812
|
+
var runtimeEventBuses = new WeakMap;
|
|
14813
|
+
function getExtensionRuntimeEventBus(runtime) {
|
|
14814
|
+
let eventBus = runtimeEventBuses.get(runtime);
|
|
14815
|
+
if (!eventBus) {
|
|
14816
|
+
eventBus = createEventBus();
|
|
14817
|
+
runtimeEventBuses.set(runtime, eventBus);
|
|
14818
|
+
}
|
|
14819
|
+
return eventBus;
|
|
14820
|
+
}
|
|
14699
14821
|
var INTER_EXTENSION_YIELD_THRESHOLD_MS = 16;
|
|
14700
14822
|
function createExtension(extensionPath, resolvedPath) {
|
|
14701
14823
|
const source = extensionPath.startsWith("<") && extensionPath.endsWith(">") ? extensionPath.slice(1, -1).split(":")[0] || "temporary" : "local";
|
|
@@ -14762,6 +14884,7 @@ async function loadExtensionsInternal(paths, cwd, eventBus, workflowResourceProv
|
|
|
14762
14884
|
const resolvedCwd = cacheToken?.cwd ?? resolvePath(cwd);
|
|
14763
14885
|
const resolvedEventBus = eventBus ?? createEventBus();
|
|
14764
14886
|
const resolvedRuntime = runtime ?? createExtensionRuntime();
|
|
14887
|
+
runtimeEventBuses.set(resolvedRuntime, resolvedEventBus);
|
|
14765
14888
|
let processedExtensionCount = 0;
|
|
14766
14889
|
let lastYieldAt = Date.now();
|
|
14767
14890
|
for (const extPath of paths) {
|
|
@@ -23101,7 +23224,7 @@ class ExtensionSelectorComponent extends Container12 {
|
|
|
23101
23224
|
import { matchesKey as matchesKey5, truncateToWidth as truncateToWidth10, wrapTextWithAnsi as wrapTextWithAnsi3 } from "@earendil-works/pi-tui";
|
|
23102
23225
|
var ROWS = ["chat", "workflow"];
|
|
23103
23226
|
var LABEL_WIDTH = 16;
|
|
23104
|
-
var DESCRIPTION = "
|
|
23227
|
+
var DESCRIPTION = "Use faster routing for the selected model when supported by its provider.";
|
|
23105
23228
|
var ROW_DETAILS = {
|
|
23106
23229
|
chat: {
|
|
23107
23230
|
label: "Chat",
|
|
@@ -23123,7 +23246,7 @@ class FastModeSelectorComponent {
|
|
|
23123
23246
|
}
|
|
23124
23247
|
invalidate() {}
|
|
23125
23248
|
render(width) {
|
|
23126
|
-
const lines = [truncateToWidth10(theme.bold(theme.fg("accent", "
|
|
23249
|
+
const lines = [truncateToWidth10(theme.bold(theme.fg("accent", "Fast mode")), width)];
|
|
23127
23250
|
for (const line of wrapTextWithAnsi3(DESCRIPTION, Math.max(20, width))) {
|
|
23128
23251
|
lines.push(theme.fg("muted", line));
|
|
23129
23252
|
}
|
|
@@ -24397,6 +24520,10 @@ var KEYBINDINGS = {
|
|
|
24397
24520
|
defaultKeys: windowsKeybindings ? "alt+q" : "alt+up",
|
|
24398
24521
|
description: "Restore queued messages"
|
|
24399
24522
|
},
|
|
24523
|
+
"app.message.copy": {
|
|
24524
|
+
defaultKeys: "ctrl+x",
|
|
24525
|
+
description: "Copy fullscreen selection or last agent message"
|
|
24526
|
+
},
|
|
24400
24527
|
"app.clipboard.pasteImage": {
|
|
24401
24528
|
defaultKeys: windowsKeybindings ? "alt+v" : "ctrl+v",
|
|
24402
24529
|
description: "Paste image from clipboard (text fallback)"
|
|
@@ -25815,6 +25942,9 @@ function createSettingsChangeHandler(callbacks) {
|
|
|
25815
25942
|
case "fullscreen-exit-output":
|
|
25816
25943
|
callbacks.onFullscreenExitOutputChange(newValue);
|
|
25817
25944
|
break;
|
|
25945
|
+
case "fullscreen-copy-on-select":
|
|
25946
|
+
callbacks.onFullscreenCopyOnSelectChange(newValue === "true");
|
|
25947
|
+
break;
|
|
25818
25948
|
case "editor-padding":
|
|
25819
25949
|
callbacks.onEditorPaddingXChange(parseInt(newValue, 10));
|
|
25820
25950
|
break;
|
|
@@ -26201,6 +26331,13 @@ function insertUiToggles(items, config) {
|
|
|
26201
26331
|
values: ["transcript", "resume-hint"]
|
|
26202
26332
|
});
|
|
26203
26333
|
insertAfter(items, "fullscreen-exit-output", {
|
|
26334
|
+
id: "fullscreen-copy-on-select",
|
|
26335
|
+
label: "Fullscreen copy on select",
|
|
26336
|
+
description: "Copy selected transcript text automatically on mouse release",
|
|
26337
|
+
currentValue: config.fullscreenCopyOnSelect ? "true" : "false",
|
|
26338
|
+
values: ["true", "false"]
|
|
26339
|
+
});
|
|
26340
|
+
insertAfter(items, "fullscreen-copy-on-select", {
|
|
26204
26341
|
id: "editor-padding",
|
|
26205
26342
|
label: "Editor padding",
|
|
26206
26343
|
description: "Horizontal padding for input editor (0-3)",
|
|
@@ -39079,6 +39216,8 @@ function _refreshToolRegistry(options) {
|
|
|
39079
39216
|
const allowedToolNames = this._allowedToolNames;
|
|
39080
39217
|
const excludedToolNames = this._excludedToolNames;
|
|
39081
39218
|
const isExposedTool = (name) => {
|
|
39219
|
+
if (isMandatoryRuntimeTool(name))
|
|
39220
|
+
return true;
|
|
39082
39221
|
if (allowedToolNames && !allowedToolNames.has(name)) {
|
|
39083
39222
|
return false;
|
|
39084
39223
|
}
|
|
@@ -39087,10 +39226,10 @@ function _refreshToolRegistry(options) {
|
|
|
39087
39226
|
}
|
|
39088
39227
|
return true;
|
|
39089
39228
|
};
|
|
39090
|
-
const registeredTools = this._extensionRunner.getAllRegisteredTools();
|
|
39229
|
+
const registeredTools = this._extensionRunner.getAllRegisteredTools().filter((tool) => !isMandatoryRuntimeTool(tool.definition.name) || isTrustedMandatoryRuntimeTool(tool));
|
|
39091
39230
|
const allCustomTools = [
|
|
39092
39231
|
...registeredTools,
|
|
39093
|
-
...this._customTools.map((definition) => ({
|
|
39232
|
+
...this._customTools.filter((definition) => !isMandatoryRuntimeTool(definition.name)).map((definition) => ({
|
|
39094
39233
|
definition,
|
|
39095
39234
|
sourceInfo: createSyntheticSourceInfo(`<sdk:${definition.name}>`, { source: "sdk" })
|
|
39096
39235
|
}))
|
|
@@ -40040,6 +40179,7 @@ class AgentSessionBase {
|
|
|
40040
40179
|
_postToolCompactionPreflightError = undefined;
|
|
40041
40180
|
_pendingPostToolCompactionGuard = undefined;
|
|
40042
40181
|
_terminatingToolCallIds = new Set;
|
|
40182
|
+
_stopAfterTurnBlockedContinuation = false;
|
|
40043
40183
|
_disposed = false;
|
|
40044
40184
|
_branchSummaryAbortController = undefined;
|
|
40045
40185
|
_sessionSummaryAbortController = undefined;
|
|
@@ -40544,11 +40684,12 @@ var WORKSPACE_BUILTINS = [
|
|
|
40544
40684
|
{ packageName: "@bastani/subagents", workspaceDirName: "subagents", distDirName: "subagents" },
|
|
40545
40685
|
{ packageName: "@bastani/mcp", workspaceDirName: "mcp", distDirName: "mcp" },
|
|
40546
40686
|
{ packageName: "@bastani/web-access", workspaceDirName: "web-access", distDirName: "web-access" },
|
|
40547
|
-
{ packageName: "@bastani/intercom", workspaceDirName: "intercom", distDirName: "intercom" }
|
|
40687
|
+
{ packageName: "@bastani/intercom", workspaceDirName: "intercom", distDirName: "intercom", mandatory: true }
|
|
40548
40688
|
];
|
|
40549
40689
|
var BUILTIN_PACKAGES = WORKSPACE_BUILTINS.map((spec) => ({
|
|
40550
40690
|
packageName: spec.packageName,
|
|
40551
40691
|
distDirName: spec.distDirName,
|
|
40692
|
+
mandatory: spec.mandatory === true,
|
|
40552
40693
|
requiredEntries: requiredEntriesForBuiltin(spec.distDirName),
|
|
40553
40694
|
sourceCandidates: ({ here, packageDir, isSourceCheckout }) => isSourceCheckout ? [join29(packageDir, "..", spec.workspaceDirName), join29(here, "..", "..", "..", spec.workspaceDirName)] : []
|
|
40554
40695
|
}));
|
|
@@ -40604,6 +40745,23 @@ function getBuiltinPackagePaths() {
|
|
|
40604
40745
|
return packageDir ? [packageDir] : [];
|
|
40605
40746
|
});
|
|
40606
40747
|
}
|
|
40748
|
+
function getMandatoryBuiltinPackagePaths() {
|
|
40749
|
+
const context = getBuiltinPackageCandidateContext();
|
|
40750
|
+
return BUILTIN_PACKAGES.filter((descriptor) => descriptor.mandatory).flatMap((descriptor) => {
|
|
40751
|
+
const packageDir = firstExistingPackageDir([...descriptor.sourceCandidates(context), ...distCandidates(context, descriptor)], descriptor);
|
|
40752
|
+
return packageDir ? [packageDir] : [];
|
|
40753
|
+
});
|
|
40754
|
+
}
|
|
40755
|
+
function getMandatoryBuiltinExtensionPaths() {
|
|
40756
|
+
return getMandatoryBuiltinPackagePaths().flatMap((packageDir) => {
|
|
40757
|
+
try {
|
|
40758
|
+
const manifest = JSON.parse(stripBom(readFileSync16(join29(packageDir, "package.json"), "utf-8")));
|
|
40759
|
+
return (manifest.atomic?.extensions ?? manifest.pi?.extensions ?? []).map((entry) => resolve9(packageDir, entry));
|
|
40760
|
+
} catch {
|
|
40761
|
+
return [];
|
|
40762
|
+
}
|
|
40763
|
+
});
|
|
40764
|
+
}
|
|
40607
40765
|
// src/core/cloudflare-gateway-binding.ts
|
|
40608
40766
|
import {
|
|
40609
40767
|
CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL,
|
|
@@ -46382,6 +46540,13 @@ function getEnabledResources(resources, metadataByPath) {
|
|
|
46382
46540
|
function getEnabledPaths(resources, metadataByPath) {
|
|
46383
46541
|
return getEnabledResources(resources, metadataByPath).map((r) => r.path);
|
|
46384
46542
|
}
|
|
46543
|
+
function getBuiltinExtensionPaths(resources, metadataByPath, noExtensions) {
|
|
46544
|
+
for (const resource of resources) {
|
|
46545
|
+
if (!metadataByPath.has(resource.path))
|
|
46546
|
+
metadataByPath.set(resource.path, resource.metadata);
|
|
46547
|
+
}
|
|
46548
|
+
return noExtensions ? [] : resources.filter((resource) => resource.enabled).map((resource) => resource.path);
|
|
46549
|
+
}
|
|
46385
46550
|
function mapSkillPath(resource, metadataByPath) {
|
|
46386
46551
|
if (resource.metadata.source !== "auto" && resource.metadata.origin !== "package") {
|
|
46387
46552
|
return resource.path;
|
|
@@ -46425,12 +46590,12 @@ async function loadProjectTrustExtensions(loader) {
|
|
|
46425
46590
|
const metadataByPath = new Map;
|
|
46426
46591
|
const cliEnabledExtensions = getEnabledPaths(cliExtensionPaths.extensions, metadataByPath);
|
|
46427
46592
|
const enabledExtensions = getEnabledPaths(resolvedPaths.extensions, metadataByPath);
|
|
46428
|
-
const builtinEnabledExtensions =
|
|
46593
|
+
const builtinEnabledExtensions = getBuiltinExtensionPaths(builtinPackagePaths.extensions, metadataByPath, state.noExtensions);
|
|
46429
46594
|
const workflowResources = collectWorkflowResources(resolvedPaths, cliExtensionPaths, builtinPackagePaths);
|
|
46430
46595
|
state.workflowResources = workflowResources;
|
|
46431
46596
|
const workflowResourceProvider = createWorkflowResourceProvider(loader);
|
|
46432
46597
|
const inheritanceSnapshotProvider = createInheritanceSnapshotProvider(loader);
|
|
46433
|
-
const extensionPaths =
|
|
46598
|
+
const extensionPaths = mergeResourcePaths(state.cwd, cliEnabledExtensions, state.noExtensions ? builtinEnabledExtensions : [...enabledExtensions, ...builtinEnabledExtensions]);
|
|
46434
46599
|
const extensionsResult = await loadExtensionsCached(extensionPaths, state.cwd, state.eventBus, workflowResourceProvider, undefined, inheritanceSnapshotProvider);
|
|
46435
46600
|
const inlineExtensions = await loadExtensionFactories(loader, extensionsResult.runtime, workflowResourceProvider, inheritanceSnapshotProvider);
|
|
46436
46601
|
extensionsResult.extensions.push(...inlineExtensions.extensions);
|
|
@@ -46510,7 +46675,7 @@ async function reloadDefaultResourceLoader(loader, options) {
|
|
|
46510
46675
|
const enabledSkillResources = getEnabledResources(resolvedPaths.skills, metadataByPath);
|
|
46511
46676
|
const enabledPrompts = getEnabledPaths(resolvedPaths.prompts, metadataByPath);
|
|
46512
46677
|
const enabledThemes = getEnabledPaths(resolvedPaths.themes, metadataByPath);
|
|
46513
|
-
const builtinEnabledExtensions =
|
|
46678
|
+
const builtinEnabledExtensions = getBuiltinExtensionPaths(builtinPackagePaths.extensions, metadataByPath, state.noExtensions);
|
|
46514
46679
|
const builtinEnabledSkillResources = state.noSkills ? [] : getEnabledResources(builtinPackagePaths.skills, metadataByPath);
|
|
46515
46680
|
const builtinEnabledPrompts = state.noPromptTemplates ? [] : getEnabledPaths(builtinPackagePaths.prompts, metadataByPath);
|
|
46516
46681
|
const builtinEnabledThemes = state.noThemes ? [] : getEnabledPaths(builtinPackagePaths.themes, metadataByPath);
|
|
@@ -46524,9 +46689,13 @@ async function reloadDefaultResourceLoader(loader, options) {
|
|
|
46524
46689
|
const workflowResources = collectWorkflowResources(resolvedPaths, cliExtensionPaths, builtinPackagePaths);
|
|
46525
46690
|
state.workflowResources = workflowResources;
|
|
46526
46691
|
const workflowResourceProvider = createWorkflowResourceProvider(loader);
|
|
46527
|
-
const extensionPaths =
|
|
46692
|
+
const extensionPaths = mergeResourcePaths(state.cwd, cliEnabledExtensions, state.noExtensions ? builtinEnabledExtensions : [...enabledExtensions, ...builtinEnabledExtensions]);
|
|
46528
46693
|
const inheritanceSnapshotProvider = createInheritanceSnapshotProvider(loader);
|
|
46529
46694
|
const extensionsResult = options?.deferExtensions ? { extensions: [], errors: [], runtime: createExtensionRuntime() } : await loadFinalExtensionSet(loader, extensionPaths, preTrustExtensions, workflowResourceProvider, inheritanceSnapshotProvider);
|
|
46695
|
+
const mandatoryExtensionPaths = new Set(getMandatoryBuiltinExtensionPaths().map((path14) => resolvePath(path14, state.cwd, { normalizeUnicodeSpaces: true })));
|
|
46696
|
+
const loadedMandatoryExtensions = new Set(extensionsResult.extensions.filter((extension) => mandatoryExtensionPaths.has(resolvePath(extension.resolvedPath, state.cwd, { normalizeUnicodeSpaces: true }))));
|
|
46697
|
+
for (const extension of loadedMandatoryExtensions)
|
|
46698
|
+
markTrustedMandatoryRuntimeExtension(extension);
|
|
46530
46699
|
for (const p of state.additionalExtensionPaths) {
|
|
46531
46700
|
if (isLocalPath(p)) {
|
|
46532
46701
|
const resolved = resolveResourcePath(state.cwd, p);
|
|
@@ -46537,6 +46706,12 @@ async function reloadDefaultResourceLoader(loader, options) {
|
|
|
46537
46706
|
}
|
|
46538
46707
|
state.extensionsResult = state.extensionsOverride ? state.extensionsOverride(extensionsResult) : extensionsResult;
|
|
46539
46708
|
applyExtensionSourceInfo(loader, state.extensionsResult.extensions, metadataByPath);
|
|
46709
|
+
for (const extension of state.extensionsResult.extensions) {
|
|
46710
|
+
const registration = extension.tools.get("intercom");
|
|
46711
|
+
if (loadedMandatoryExtensions.has(extension) && registration && isTrustedMandatoryRuntimeTool(registration)) {
|
|
46712
|
+
markTrustedMandatoryRuntimeExtension(extension);
|
|
46713
|
+
}
|
|
46714
|
+
}
|
|
46540
46715
|
resolveInheritedExtensionOverlaps(state.extensionsResult);
|
|
46541
46716
|
const skillPaths = state.noSkills ? mergeResourcePaths(state.cwd, cliEnabledSkills, state.additionalSkillPaths) : mergeResourcePaths(state.cwd, [...cliEnabledSkills, ...enabledSkills, ...builtinEnabledSkills], state.additionalSkillPaths);
|
|
46542
46717
|
state.lastSkillPaths = skillPaths;
|
|
@@ -47739,6 +47914,28 @@ var uiAccessors = {
|
|
|
47739
47914
|
state.markModified("fullscreenExitOutput");
|
|
47740
47915
|
state.save();
|
|
47741
47916
|
},
|
|
47917
|
+
getFullscreenCopyOnSelect() {
|
|
47918
|
+
return settingsInternals(this).settings.fullscreenCopyOnSelect !== false;
|
|
47919
|
+
},
|
|
47920
|
+
setFullscreenCopyOnSelect(enabled) {
|
|
47921
|
+
const state = settingsInternals(this);
|
|
47922
|
+
state.globalSettings.fullscreenCopyOnSelect = enabled;
|
|
47923
|
+
state.markModified("fullscreenCopyOnSelect");
|
|
47924
|
+
state.save();
|
|
47925
|
+
},
|
|
47926
|
+
getTerminalCapabilityOverrides() {
|
|
47927
|
+
const terminal = settingsInternals(this).settings.terminal;
|
|
47928
|
+
const overrides = {};
|
|
47929
|
+
if (typeof terminal?.hyperlinks === "boolean")
|
|
47930
|
+
overrides.hyperlinks = terminal.hyperlinks;
|
|
47931
|
+
if (terminal?.images === "kitty" || terminal?.images === "iterm2")
|
|
47932
|
+
overrides.images = terminal.images;
|
|
47933
|
+
else if (terminal?.images === false)
|
|
47934
|
+
overrides.images = null;
|
|
47935
|
+
if (typeof terminal?.trueColor === "boolean")
|
|
47936
|
+
overrides.trueColor = terminal.trueColor;
|
|
47937
|
+
return overrides;
|
|
47938
|
+
},
|
|
47742
47939
|
getEditorPaddingX() {
|
|
47743
47940
|
return settingsInternals(this).settings.editorPaddingX ?? 0;
|
|
47744
47941
|
},
|
|
@@ -48266,6 +48463,99 @@ function restoreAnthropicReplayThinkingBlocks(payload, sourceMessages, model) {
|
|
|
48266
48463
|
return { ...payload, messages: nextPayloadMessages };
|
|
48267
48464
|
}
|
|
48268
48465
|
|
|
48466
|
+
// src/core/mandatory-resource-loader.ts
|
|
48467
|
+
function hasTrustedIntercom(extension) {
|
|
48468
|
+
const registration = extension.tools.get("intercom");
|
|
48469
|
+
return registration !== undefined && isTrustedMandatoryRuntimeTool(registration);
|
|
48470
|
+
}
|
|
48471
|
+
async function restoreMandatoryExtensions(target, cwd) {
|
|
48472
|
+
if (target.extensions.some(hasTrustedIntercom))
|
|
48473
|
+
return target;
|
|
48474
|
+
const loaded = await loadExtensions(getMandatoryBuiltinExtensionPaths(), cwd, getExtensionRuntimeEventBus(target.runtime), undefined, target.runtime);
|
|
48475
|
+
for (const extension of loaded.extensions)
|
|
48476
|
+
markTrustedMandatoryRuntimeExtension(extension);
|
|
48477
|
+
const restored = {
|
|
48478
|
+
...target,
|
|
48479
|
+
extensions: [...target.extensions, ...loaded.extensions],
|
|
48480
|
+
errors: [...target.errors, ...loaded.errors]
|
|
48481
|
+
};
|
|
48482
|
+
if (!restored.extensions.some(hasTrustedIntercom)) {
|
|
48483
|
+
const detail = loaded.errors.map(({ error }) => error).join("; ") || "extension did not register intercom";
|
|
48484
|
+
throw new Error(`Mandatory bundled Intercom is unavailable: ${detail}`);
|
|
48485
|
+
}
|
|
48486
|
+
return restored;
|
|
48487
|
+
}
|
|
48488
|
+
|
|
48489
|
+
class MandatoryResourceLoader {
|
|
48490
|
+
delegate;
|
|
48491
|
+
cwd;
|
|
48492
|
+
extensionsResult;
|
|
48493
|
+
toolOnly = false;
|
|
48494
|
+
constructor(delegate, cwd, extensionsResult) {
|
|
48495
|
+
this.delegate = delegate;
|
|
48496
|
+
this.cwd = cwd;
|
|
48497
|
+
this.extensionsResult = extensionsResult;
|
|
48498
|
+
}
|
|
48499
|
+
limitToTool() {
|
|
48500
|
+
this.toolOnly = true;
|
|
48501
|
+
this.removeLocalInteractionSurfaces();
|
|
48502
|
+
}
|
|
48503
|
+
removeLocalInteractionSurfaces() {
|
|
48504
|
+
const extension = this.extensionsResult.extensions.find(hasTrustedIntercom);
|
|
48505
|
+
extension?.commands.delete("intercom");
|
|
48506
|
+
extension?.shortcuts.delete("alt+m");
|
|
48507
|
+
}
|
|
48508
|
+
getExtensions() {
|
|
48509
|
+
return this.extensionsResult;
|
|
48510
|
+
}
|
|
48511
|
+
getSkills() {
|
|
48512
|
+
return this.delegate.getSkills();
|
|
48513
|
+
}
|
|
48514
|
+
getSkillCatalog() {
|
|
48515
|
+
return this.delegate.getSkillCatalog?.() ?? buildSkillCatalog(this.delegate.getSkills().skills);
|
|
48516
|
+
}
|
|
48517
|
+
getPrompts() {
|
|
48518
|
+
return this.delegate.getPrompts();
|
|
48519
|
+
}
|
|
48520
|
+
getThemes() {
|
|
48521
|
+
return this.delegate.getThemes();
|
|
48522
|
+
}
|
|
48523
|
+
getAgentsFiles() {
|
|
48524
|
+
return this.delegate.getAgentsFiles();
|
|
48525
|
+
}
|
|
48526
|
+
getSystemPrompt() {
|
|
48527
|
+
return this.delegate.getSystemPrompt();
|
|
48528
|
+
}
|
|
48529
|
+
getSystemPromptSource() {
|
|
48530
|
+
return this.delegate.getSystemPromptSource();
|
|
48531
|
+
}
|
|
48532
|
+
getAppendSystemPrompt() {
|
|
48533
|
+
return this.delegate.getAppendSystemPrompt();
|
|
48534
|
+
}
|
|
48535
|
+
getAppendSystemPromptSources() {
|
|
48536
|
+
return this.delegate.getAppendSystemPromptSources();
|
|
48537
|
+
}
|
|
48538
|
+
extendResources(paths) {
|
|
48539
|
+
return this.delegate.extendResources(paths);
|
|
48540
|
+
}
|
|
48541
|
+
async reload(options) {
|
|
48542
|
+
await this.delegate.reload(options);
|
|
48543
|
+
this.extensionsResult = await restoreMandatoryExtensions(this.delegate.getExtensions(), this.cwd);
|
|
48544
|
+
if (this.toolOnly)
|
|
48545
|
+
this.removeLocalInteractionSurfaces();
|
|
48546
|
+
}
|
|
48547
|
+
}
|
|
48548
|
+
async function withMandatoryResourceLoader(loader, cwd) {
|
|
48549
|
+
if (loader instanceof MandatoryResourceLoader)
|
|
48550
|
+
return loader;
|
|
48551
|
+
const extensionsResult = await restoreMandatoryExtensions(loader.getExtensions(), cwd);
|
|
48552
|
+
return new MandatoryResourceLoader(loader, cwd, extensionsResult);
|
|
48553
|
+
}
|
|
48554
|
+
function limitMandatoryIntercomToTool(loader) {
|
|
48555
|
+
if (loader instanceof MandatoryResourceLoader)
|
|
48556
|
+
loader.limitToTool();
|
|
48557
|
+
}
|
|
48558
|
+
|
|
48269
48559
|
// src/core/model-resolver-defaults.ts
|
|
48270
48560
|
var defaultModelPerProvider = {
|
|
48271
48561
|
"amazon-bedrock": "us.anthropic.claude-opus-4-6-v1",
|
|
@@ -48295,7 +48585,7 @@ var defaultModelPerProvider = {
|
|
|
48295
48585
|
huggingface: "moonshotai/Kimi-K2.6",
|
|
48296
48586
|
fireworks: "accounts/fireworks/models/kimi-k2p6",
|
|
48297
48587
|
together: "moonshotai/Kimi-K2.6",
|
|
48298
|
-
baseten: "zai-org/GLM-5.
|
|
48588
|
+
baseten: "zai-org/GLM-5.3",
|
|
48299
48589
|
opencode: "kimi-k2.6",
|
|
48300
48590
|
"opencode-go": "kimi-k2.6",
|
|
48301
48591
|
"kimi-coding": "kimi-for-coding",
|
|
@@ -49056,14 +49346,16 @@ async function createAgentSessionServices(options) {
|
|
|
49056
49346
|
const settingsSpan = startTimingSpan("createAgentSessionServices.settingsManager");
|
|
49057
49347
|
const settingsManager = options.settingsManager ?? SettingsManager.create(cwd, agentDir);
|
|
49058
49348
|
endTimingSpan(settingsSpan);
|
|
49059
|
-
const
|
|
49060
|
-
|
|
49349
|
+
const resourceLoaderOptions = options.resourceLoaderOptions ?? {};
|
|
49350
|
+
const defaultResourceLoader = new DefaultResourceLoader({
|
|
49351
|
+
...resourceLoaderOptions,
|
|
49061
49352
|
cwd,
|
|
49062
49353
|
agentDir,
|
|
49063
49354
|
settingsManager
|
|
49064
49355
|
});
|
|
49065
49356
|
const reloadSpan = startTimingSpan("createAgentSessionServices.resourceLoader.reload");
|
|
49066
|
-
await
|
|
49357
|
+
await defaultResourceLoader.reload(options.resourceLoaderReloadOptions);
|
|
49358
|
+
const resourceLoader = await withMandatoryResourceLoader(defaultResourceLoader, cwd);
|
|
49067
49359
|
endTimingSpan(reloadSpan);
|
|
49068
49360
|
const diagnostics = [];
|
|
49069
49361
|
const providerSpan = startTimingSpan("createAgentSessionServices.providerRegistrations");
|
|
@@ -49462,6 +49754,7 @@ async function createAgentSession(options = {}) {
|
|
|
49462
49754
|
await resourceLoader.reload();
|
|
49463
49755
|
time("resourceLoader.reload");
|
|
49464
49756
|
}
|
|
49757
|
+
resourceLoader = await withMandatoryResourceLoader(resourceLoader, cwd);
|
|
49465
49758
|
const existingSession = sessionManager.buildSessionContext();
|
|
49466
49759
|
const repairedMessages = repairOrphanToolResults(existingSession.messages, { repairTrailing: true });
|
|
49467
49760
|
const existingMessages = options.initialContextTransform ? options.initialContextTransform(repairedMessages) : repairedMessages;
|
|
@@ -49682,6 +49975,7 @@ async function createAgentSession(options = {}) {
|
|
|
49682
49975
|
};
|
|
49683
49976
|
}
|
|
49684
49977
|
// src/main.ts
|
|
49978
|
+
import { setCapabilityOverrides as setCapabilityOverrides8 } from "@earendil-works/pi-tui";
|
|
49685
49979
|
import chalk13 from "chalk";
|
|
49686
49980
|
|
|
49687
49981
|
// src/cli/auth-check.ts
|
|
@@ -50232,8 +50526,14 @@ import chalk6 from "chalk";
|
|
|
50232
50526
|
|
|
50233
50527
|
// src/cli/startup-ui.ts
|
|
50234
50528
|
import { existsSync as existsSync35 } from "node:fs";
|
|
50235
|
-
import {
|
|
50529
|
+
import {
|
|
50530
|
+
ProcessTerminal,
|
|
50531
|
+
setCapabilityOverrides,
|
|
50532
|
+
setKeybindings,
|
|
50533
|
+
TuiMainScreen
|
|
50534
|
+
} from "@earendil-works/pi-tui";
|
|
50236
50535
|
function createStartupTui(settingsManager) {
|
|
50536
|
+
setCapabilityOverrides(settingsManager.getTerminalCapabilityOverrides());
|
|
50237
50537
|
initTheme(settingsManager.getTheme());
|
|
50238
50538
|
setKeybindings(KeybindingsManager.create());
|
|
50239
50539
|
const ui = new TuiMainScreen(new ProcessTerminal, settingsManager.getShowHardwareCursor(), getAgentDir());
|
|
@@ -52012,12 +52312,13 @@ async function applyCliRuntimeApiKey(modelRuntime, providerId, apiKey, signal) {
|
|
|
52012
52312
|
|
|
52013
52313
|
// src/main-session.ts
|
|
52014
52314
|
import { createInterface as createInterface3 } from "node:readline";
|
|
52015
|
-
import { ProcessTerminal as ProcessTerminal3, setKeybindings as setKeybindings3, TuiMainScreen as TuiMainScreen3 } from "@earendil-works/pi-tui";
|
|
52315
|
+
import { ProcessTerminal as ProcessTerminal3, setCapabilityOverrides as setCapabilityOverrides3, setKeybindings as setKeybindings3, TuiMainScreen as TuiMainScreen3 } from "@earendil-works/pi-tui";
|
|
52016
52316
|
import chalk8 from "chalk";
|
|
52017
52317
|
|
|
52018
52318
|
// src/cli/session-picker.ts
|
|
52019
|
-
import { ProcessTerminal as ProcessTerminal2, setKeybindings as setKeybindings2, TuiMainScreen as TuiMainScreen2 } from "@earendil-works/pi-tui";
|
|
52020
|
-
async function selectSession(currentSessionsLoader, allSessionsLoader) {
|
|
52319
|
+
import { ProcessTerminal as ProcessTerminal2, setCapabilityOverrides as setCapabilityOverrides2, setKeybindings as setKeybindings2, TuiMainScreen as TuiMainScreen2 } from "@earendil-works/pi-tui";
|
|
52320
|
+
async function selectSession(currentSessionsLoader, allSessionsLoader, settingsManager) {
|
|
52321
|
+
setCapabilityOverrides2(settingsManager.getTerminalCapabilityOverrides());
|
|
52021
52322
|
return new Promise((resolve20) => {
|
|
52022
52323
|
const ui = new TuiMainScreen2(new ProcessTerminal2, undefined, getAgentDir());
|
|
52023
52324
|
const keybindings = KeybindingsManager.create();
|
|
@@ -52186,7 +52487,7 @@ async function createSessionManager(parsed, cwd, sessionDir, settingsManager) {
|
|
|
52186
52487
|
if (parsed.resume) {
|
|
52187
52488
|
initTheme(settingsManager.getTheme(), true);
|
|
52188
52489
|
try {
|
|
52189
|
-
const selectedPath = await selectSession((onProgress) => SessionManager.list(cwd, sessionDir, onProgress), (onProgress) => SessionManager.listAll(sessionDir, onProgress));
|
|
52490
|
+
const selectedPath = await selectSession((onProgress) => SessionManager.list(cwd, sessionDir, onProgress), (onProgress) => SessionManager.listAll(sessionDir, onProgress), settingsManager);
|
|
52190
52491
|
if (!selectedPath) {
|
|
52191
52492
|
console.log(chalk8.dim("No session selected"));
|
|
52192
52493
|
process.exit(0);
|
|
@@ -52209,6 +52510,7 @@ async function createSessionManager(parsed, cwd, sessionDir, settingsManager) {
|
|
|
52209
52510
|
return SessionManager.create(cwd, sessionDir, { id: parsed.sessionId });
|
|
52210
52511
|
}
|
|
52211
52512
|
async function promptForMissingSessionCwd(issue, settingsManager) {
|
|
52513
|
+
setCapabilityOverrides3(settingsManager.getTerminalCapabilityOverrides());
|
|
52212
52514
|
initTheme(settingsManager.getTheme());
|
|
52213
52515
|
setKeybindings3(KeybindingsManager.create());
|
|
52214
52516
|
return new Promise((resolve20) => {
|
|
@@ -55321,7 +55623,11 @@ function onInteractiveEngineRemoteCommandsChanged(runtime, listener) {
|
|
|
55321
55623
|
}
|
|
55322
55624
|
|
|
55323
55625
|
// src/modes/interactive/interactive-mode-base.ts
|
|
55324
|
-
import {
|
|
55626
|
+
import {
|
|
55627
|
+
isKeyRelease as isKeyRelease3,
|
|
55628
|
+
isViewportTUI,
|
|
55629
|
+
setCapabilityOverrides as setCapabilityOverrides4
|
|
55630
|
+
} from "@earendil-works/pi-tui";
|
|
55325
55631
|
|
|
55326
55632
|
// src/modes/interactive-engine/engine-diagnostic-view.ts
|
|
55327
55633
|
function renderEngineDiagnostic(diagnostic, view) {
|
|
@@ -55746,7 +56052,7 @@ var BUILTIN_SLASH_COMMANDS = [
|
|
|
55746
56052
|
{ name: "tree", description: "Navigate session tree (switch branches)" },
|
|
55747
56053
|
{ name: "thinking", description: "Set thinking level", argumentHint: "<level>" },
|
|
55748
56054
|
{ name: "scoped-models", description: "Enable/disable models for ctrl+p cycling" },
|
|
55749
|
-
{ name: "fast", description: "Configure
|
|
56055
|
+
{ name: "fast", description: "Configure fast mode for chat and workflows on supported models" },
|
|
55750
56056
|
{ name: "export", description: "Export session (HTML default, or specify path: .html/.jsonl)" },
|
|
55751
56057
|
{ name: "import", description: "Import and resume a session from a JSONL file" },
|
|
55752
56058
|
{ name: "share", description: "Share session as a secret GitHub gist" },
|
|
@@ -56203,6 +56509,7 @@ var viewportInputListeners = new WeakSet;
|
|
|
56203
56509
|
var viewportInputGates = new WeakMap;
|
|
56204
56510
|
var overlayUnhandledInputHandlers = new WeakMap;
|
|
56205
56511
|
var viewportInputReplays = new WeakSet;
|
|
56512
|
+
var overlayOwnedSelections = new WeakSet;
|
|
56206
56513
|
var viewportInputSubscriptions = new WeakMap;
|
|
56207
56514
|
var SGR_MOUSE_SEQUENCE = /^\x1b\[<(\d+);\d+;\d+([Mm])/;
|
|
56208
56515
|
var LEFT_MOUSE_MODIFIER_MASK = 4 | 8 | 16;
|
|
@@ -56271,8 +56578,20 @@ class AtomicTuiAltScreen extends TuiAltScreen {
|
|
|
56271
56578
|
deferral.shouldDeferViewportInputToOverlay = () => !viewportInputReplays.has(this) && deferToOverlay?.() === true;
|
|
56272
56579
|
}
|
|
56273
56580
|
applyLineResets(lines) {
|
|
56581
|
+
if (overlayOwnedSelections.has(this) && !this.isFocusedOverlay())
|
|
56582
|
+
this.clearOverlayOwnedSelection();
|
|
56274
56583
|
return stripOverlayActiveRowMarker(super.applyLineResets(lines));
|
|
56275
56584
|
}
|
|
56585
|
+
clearOverlayOwnedSelection() {
|
|
56586
|
+
const selection = this;
|
|
56587
|
+
selection.selectionAnchor = undefined;
|
|
56588
|
+
selection.selectionFocus = undefined;
|
|
56589
|
+
selection.selectionInitialRange = undefined;
|
|
56590
|
+
selection.selectionPressActive = false;
|
|
56591
|
+
selection.selectionDragged = false;
|
|
56592
|
+
selection.lastClick = undefined;
|
|
56593
|
+
overlayOwnedSelections.delete(this);
|
|
56594
|
+
}
|
|
56276
56595
|
isPiTuiMouseSequence(data) {
|
|
56277
56596
|
if (parseMouseSequences(data))
|
|
56278
56597
|
return true;
|
|
@@ -56349,6 +56668,7 @@ class AtomicTuiAltScreen extends TuiAltScreen {
|
|
|
56349
56668
|
if (isLeftMouseButton(sequence))
|
|
56350
56669
|
viewportListener(sequence.data);
|
|
56351
56670
|
}
|
|
56671
|
+
overlayOwnedSelections.add(this);
|
|
56352
56672
|
}
|
|
56353
56673
|
replayViewportInput(viewportListener, data) {
|
|
56354
56674
|
viewportInputReplays.add(this);
|
|
@@ -56429,6 +56749,7 @@ function createFullscreenTui(options) {
|
|
|
56429
56749
|
openUrl: openBrowser
|
|
56430
56750
|
}),
|
|
56431
56751
|
onRightClickPaste: options.onRightClickPaste,
|
|
56752
|
+
copyOnSelect: options.copyOnSelect,
|
|
56432
56753
|
copySelection: options.copySelection ?? copySelectionToHostClipboard
|
|
56433
56754
|
}, options.shouldHandleViewportInput, options.onOverlayUnhandledInput);
|
|
56434
56755
|
}
|
|
@@ -56551,6 +56872,18 @@ class InteractiveModeBase {
|
|
|
56551
56872
|
return false;
|
|
56552
56873
|
return this.defaultEditor.handleInput(data);
|
|
56553
56874
|
}
|
|
56875
|
+
setFullscreenCopyOnSelect(enabled) {
|
|
56876
|
+
if (this.renderer.mode === "fullscreen")
|
|
56877
|
+
this.renderer.setCopyOnSelect(enabled);
|
|
56878
|
+
}
|
|
56879
|
+
getFullscreenCopyOnSelect() {
|
|
56880
|
+
return this.renderer.mode === "fullscreen" ? this.renderer.getCopyOnSelect() : undefined;
|
|
56881
|
+
}
|
|
56882
|
+
async copyActiveFullscreenSelection() {
|
|
56883
|
+
if (this.renderer.mode !== "fullscreen" || !this.renderer.hasActiveSelection())
|
|
56884
|
+
return;
|
|
56885
|
+
return this.renderer.copyActiveSelectionToClipboard();
|
|
56886
|
+
}
|
|
56554
56887
|
onRightClickPaste = () => {
|
|
56555
56888
|
this.handleRightClickPaste();
|
|
56556
56889
|
};
|
|
@@ -56750,11 +57083,13 @@ class InteractiveModeBase {
|
|
|
56750
57083
|
await this.rebindCurrentSession();
|
|
56751
57084
|
await this.themeController.applyFromSettings();
|
|
56752
57085
|
});
|
|
57086
|
+
setCapabilityOverrides4(this.settingsManager.getTerminalCapabilityOverrides());
|
|
56753
57087
|
this.version = VERSION;
|
|
56754
57088
|
this.renderer = createInteractiveTui({
|
|
56755
57089
|
showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
|
|
56756
57090
|
logDirectory: runtimeHost.services.agentDir,
|
|
56757
57091
|
terminal: options.terminal,
|
|
57092
|
+
copyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
|
|
56758
57093
|
onRightClickPaste: this.onRightClickPaste,
|
|
56759
57094
|
shouldHandleViewportInput: this.shouldHandleViewportInput,
|
|
56760
57095
|
onOverlayUnhandledInput: this.onOverlayUnhandledInput,
|
|
@@ -57782,6 +58117,7 @@ InteractiveModeBase.prototype.completeDeferredStartup = async function() {
|
|
|
57782
58117
|
try {
|
|
57783
58118
|
await this.bindCurrentSessionExtensions();
|
|
57784
58119
|
await this.session.reload({ reason: "startup" });
|
|
58120
|
+
this.applyRuntimeSettings();
|
|
57785
58121
|
this.rebuildChatFromMessages();
|
|
57786
58122
|
if (!this.promptTurnWorkingLoaderActive) {
|
|
57787
58123
|
this.stopWorkingLoader();
|
|
@@ -58483,6 +58819,7 @@ ${warningLines}`, 0, 0));
|
|
|
58483
58819
|
};
|
|
58484
58820
|
|
|
58485
58821
|
// src/modes/interactive/interactive-session-runtime.ts
|
|
58822
|
+
import { setCapabilityOverrides as setCapabilityOverrides5 } from "@earendil-works/pi-tui";
|
|
58486
58823
|
InteractiveModeBase.prototype.bindCurrentSessionExtensions = async function() {
|
|
58487
58824
|
const uiContext = this.createExtensionUIContext();
|
|
58488
58825
|
await this.session.bindExtensions({
|
|
@@ -58566,6 +58903,8 @@ InteractiveModeBase.prototype.bindCurrentSessionExtensions = async function() {
|
|
|
58566
58903
|
}
|
|
58567
58904
|
};
|
|
58568
58905
|
InteractiveModeBase.prototype.applyRuntimeSettings = function() {
|
|
58906
|
+
setCapabilityOverrides5(this.settingsManager.getTerminalCapabilityOverrides());
|
|
58907
|
+
this.setFullscreenCopyOnSelect(this.settingsManager.getFullscreenCopyOnSelect());
|
|
58569
58908
|
this.transcriptScrollView?.setScrollbar(this.settingsManager.getFullscreenScrollbar());
|
|
58570
58909
|
this.footer.setSession(this.session);
|
|
58571
58910
|
this.usageMeter.setSession(this.session);
|
|
@@ -58628,7 +58967,7 @@ InteractiveModeBase.prototype.setupExtensionShortcuts = function(extensionRunner
|
|
|
58628
58967
|
if (shortcuts.size === 0)
|
|
58629
58968
|
return;
|
|
58630
58969
|
const createContext = () => ({
|
|
58631
|
-
ui:
|
|
58970
|
+
ui: extensionRunner.getUIContext(),
|
|
58632
58971
|
mode: "tui",
|
|
58633
58972
|
hasUI: true,
|
|
58634
58973
|
cwd: this.sessionManager.getCwd(),
|
|
@@ -60029,6 +60368,9 @@ InteractiveModeBase.prototype.setupKeyHandlers = function() {
|
|
|
60029
60368
|
});
|
|
60030
60369
|
this.defaultEditor.onAction("app.message.followUp", () => this.handleFollowUp());
|
|
60031
60370
|
this.defaultEditor.onAction("app.message.dequeue", () => this.handleDequeue());
|
|
60371
|
+
this.defaultEditor.onAction("app.message.copy", () => {
|
|
60372
|
+
this.handleCopyCommand({ preferSelection: true });
|
|
60373
|
+
});
|
|
60032
60374
|
this.defaultEditor.onAction("app.session.new", () => this.handleClearCommand());
|
|
60033
60375
|
this.defaultEditor.onAction("app.session.tree", () => this.showTreeSelector());
|
|
60034
60376
|
this.defaultEditor.onAction("app.session.fork", () => this.showUserMessageSelector());
|
|
@@ -60920,7 +61262,8 @@ InteractiveModeBase.prototype.handleEvent = async function(event) {
|
|
|
60920
61262
|
} else if (event.reason === "manual") {
|
|
60921
61263
|
this.manualCompactionTakeoverPending = false;
|
|
60922
61264
|
}
|
|
60923
|
-
|
|
61265
|
+
const resumesActiveRun = event.midTurn && !event.aborted && !event.errorMessage && !manualTakeoverPending;
|
|
61266
|
+
if (!manualTakeoverPending && !resumesActiveRun && this.settingsManager.getShowTerminalProgress()) {
|
|
60924
61267
|
this.ui.terminal.setProgress(false);
|
|
60925
61268
|
}
|
|
60926
61269
|
if (!manualTakeoverPending && this.autoCompactionEscapeHandlerSaved) {
|
|
@@ -61904,7 +62247,7 @@ InteractiveModeBase.prototype.showSelector = function(create) {
|
|
|
61904
62247
|
};
|
|
61905
62248
|
InteractiveModeBase.prototype.showFastModeSelector = function() {
|
|
61906
62249
|
if (!this.hasCodexFastModeSupportedModels()) {
|
|
61907
|
-
this.showWarning("
|
|
62250
|
+
this.showWarning("Fast mode isn't available for any configured model.");
|
|
61908
62251
|
return;
|
|
61909
62252
|
}
|
|
61910
62253
|
this.showSelector((done) => {
|
|
@@ -61963,6 +62306,7 @@ InteractiveModeBase.prototype.showSettingsSelector = function() {
|
|
|
61963
62306
|
showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
|
|
61964
62307
|
fullscreenScrollbar: this.settingsManager.getFullscreenScrollbar(),
|
|
61965
62308
|
fullscreenExitOutput: this.settingsManager.getFullscreenExitOutput(),
|
|
62309
|
+
fullscreenCopyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
|
|
61966
62310
|
editorPaddingX: this.settingsManager.getEditorPaddingX(),
|
|
61967
62311
|
outputPad: this.settingsManager.getOutputPad(),
|
|
61968
62312
|
showCacheMissNotices: this.settingsManager.getShowCacheMissNotices(),
|
|
@@ -62080,6 +62424,10 @@ InteractiveModeBase.prototype.showSettingsSelector = function() {
|
|
|
62080
62424
|
onFullscreenExitOutputChange: (output) => {
|
|
62081
62425
|
this.settingsManager.setFullscreenExitOutput(output);
|
|
62082
62426
|
},
|
|
62427
|
+
onFullscreenCopyOnSelectChange: (enabled) => {
|
|
62428
|
+
this.settingsManager.setFullscreenCopyOnSelect(enabled);
|
|
62429
|
+
this.setFullscreenCopyOnSelect(enabled);
|
|
62430
|
+
},
|
|
62083
62431
|
onEditorPaddingXChange: (padding) => {
|
|
62084
62432
|
this.settingsManager.setEditorPaddingX(padding);
|
|
62085
62433
|
this.defaultEditor.setPaddingX(padding);
|
|
@@ -63032,18 +63380,8 @@ InteractiveModeBase.prototype.handleReloadCommand = async function() {
|
|
|
63032
63380
|
activeHeader.setExpanded(this.toolOutputExpanded);
|
|
63033
63381
|
}
|
|
63034
63382
|
setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
|
|
63035
|
-
this.
|
|
63383
|
+
this.applyRuntimeSettings();
|
|
63036
63384
|
await this.themeController.applyFromSettings();
|
|
63037
|
-
const editorPaddingX = this.settingsManager.getEditorPaddingX();
|
|
63038
|
-
const autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();
|
|
63039
|
-
this.defaultEditor.setPaddingX(editorPaddingX);
|
|
63040
|
-
this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);
|
|
63041
|
-
if (this.editor !== this.defaultEditor) {
|
|
63042
|
-
this.editor.setPaddingX?.(editorPaddingX);
|
|
63043
|
-
this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);
|
|
63044
|
-
}
|
|
63045
|
-
this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());
|
|
63046
|
-
this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
|
|
63047
63385
|
this.setupAutocompleteProvider();
|
|
63048
63386
|
const runner = this.session.extensionRunner;
|
|
63049
63387
|
this.setupExtensionShortcuts(runner);
|
|
@@ -63236,7 +63574,12 @@ Gist: ${hyperlink3(gistUrl, gistUrl)}`);
|
|
|
63236
63574
|
}
|
|
63237
63575
|
}
|
|
63238
63576
|
};
|
|
63239
|
-
InteractiveModeBase.prototype.handleCopyCommand = async function() {
|
|
63577
|
+
InteractiveModeBase.prototype.handleCopyCommand = async function(options = {}) {
|
|
63578
|
+
if (options.preferSelection && this.getFullscreenCopyOnSelect() === false) {
|
|
63579
|
+
const selectionCopied = await this.copyActiveFullscreenSelection();
|
|
63580
|
+
if (selectionCopied !== undefined)
|
|
63581
|
+
return;
|
|
63582
|
+
}
|
|
63240
63583
|
const text = this.session.getLastAssistantText();
|
|
63241
63584
|
if (!text) {
|
|
63242
63585
|
this.showError("No agent messages to copy yet.");
|
|
@@ -66900,6 +67243,9 @@ class RpcOutputBuffer {
|
|
|
66900
67243
|
}
|
|
66901
67244
|
}
|
|
66902
67245
|
|
|
67246
|
+
// src/modes/rpc/rpc-session-binding.ts
|
|
67247
|
+
import { setCapabilityOverrides as setCapabilityOverrides6 } from "@earendil-works/pi-tui";
|
|
67248
|
+
|
|
66903
67249
|
// src/modes/rpc/rpc-extension-ui.ts
|
|
66904
67250
|
import * as crypto5 from "node:crypto";
|
|
66905
67251
|
function createDialogPromise({
|
|
@@ -67185,6 +67531,7 @@ class RpcSessionBinding {
|
|
|
67185
67531
|
this.session = this.runtimeHost.session;
|
|
67186
67532
|
this.disposeSubscriptions();
|
|
67187
67533
|
const session = this.session;
|
|
67534
|
+
setCapabilityOverrides6(session.settingsManager.getTerminalCapabilityOverrides());
|
|
67188
67535
|
this.renderService?.bindSession(session);
|
|
67189
67536
|
this.footerDataProvider = new FooterDataProvider(session.sessionManager.getCwd());
|
|
67190
67537
|
const models = session.scopedModels.length > 0 ? session.scopedModels.map((scoped) => scoped.model) : session.modelRuntime.getAvailableSnapshot();
|
|
@@ -67499,7 +67846,7 @@ import { join as join59 } from "node:path";
|
|
|
67499
67846
|
import chalk12 from "chalk";
|
|
67500
67847
|
|
|
67501
67848
|
// src/cli/config-selector.ts
|
|
67502
|
-
import { ProcessTerminal as ProcessTerminal6, TuiMainScreen as TuiMainScreen8 } from "@earendil-works/pi-tui";
|
|
67849
|
+
import { ProcessTerminal as ProcessTerminal6, setCapabilityOverrides as setCapabilityOverrides7, TuiMainScreen as TuiMainScreen8 } from "@earendil-works/pi-tui";
|
|
67503
67850
|
|
|
67504
67851
|
// src/modes/interactive/components/config-selector.ts
|
|
67505
67852
|
import {
|
|
@@ -68038,6 +68385,7 @@ class ConfigSelectorComponent extends Container35 {
|
|
|
68038
68385
|
|
|
68039
68386
|
// src/cli/config-selector.ts
|
|
68040
68387
|
async function selectConfig(options) {
|
|
68388
|
+
setCapabilityOverrides7(options.settingsManager.getTerminalCapabilityOverrides());
|
|
68041
68389
|
initTheme(options.settingsManager.getTheme(), true);
|
|
68042
68390
|
return new Promise((resolve20) => {
|
|
68043
68391
|
const ui = new TuiMainScreen8(new ProcessTerminal6, undefined, options.agentDir);
|
|
@@ -69088,6 +69436,7 @@ async function main(argv, options) {
|
|
|
69088
69436
|
startupEarlyInputCapture = undefined;
|
|
69089
69437
|
}
|
|
69090
69438
|
const startupSettingsManager = SettingsManager.create(cwd, agentDir, { projectTrusted: startupProjectTrusted });
|
|
69439
|
+
setCapabilityOverrides8(startupSettingsManager.getTerminalCapabilityOverrides());
|
|
69091
69440
|
const startupSettingsDiagnostics = collectSettingsDiagnostics(startupSettingsManager, "startup session lookup");
|
|
69092
69441
|
if (appMode === "interactive" && parsed.useTheme !== undefined) {
|
|
69093
69442
|
startupSettingsManager.applyOverrides({ theme: parsed.useTheme });
|
|
@@ -69222,6 +69571,8 @@ async function main(argv, options) {
|
|
|
69222
69571
|
extensionFactories: isolateInteractiveHost ? undefined : extensionFactories
|
|
69223
69572
|
}
|
|
69224
69573
|
});
|
|
69574
|
+
if (isolateInteractiveHost)
|
|
69575
|
+
limitMandatoryIntercomToTool(services2.resourceLoader);
|
|
69225
69576
|
const { settingsManager: settingsManager2, modelRuntime: modelRuntime2, resourceLoader: resourceLoader2 } = services2;
|
|
69226
69577
|
const diagnostics = [
|
|
69227
69578
|
...services2.diagnostics,
|
|
@@ -69284,6 +69635,7 @@ async function main(argv, options) {
|
|
|
69284
69635
|
endTimingSpan(runtimeCreationSpan);
|
|
69285
69636
|
const { services, session, modelFallbackMessage } = runtime;
|
|
69286
69637
|
const { settingsManager, modelRuntime, resourceLoader } = services;
|
|
69638
|
+
setCapabilityOverrides8(settingsManager.getTerminalCapabilityOverrides());
|
|
69287
69639
|
applyHttpProxySettings(settingsManager.getGlobalSettings().httpProxy);
|
|
69288
69640
|
configureHttpDispatcher(settingsManager.getHttpIdleTimeoutMs());
|
|
69289
69641
|
if (parsed.help) {
|