@ashx-j/lunr 0.2.12 → 0.2.14
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 +16 -1
- package/README.md +6 -3
- package/dist/builtin-extensions/ashxj-tui.d.ts +16 -1
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +44 -20
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +27 -22
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +5 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +12 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.js +3 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-append.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-append.js +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-append.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-root-attachment.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-root-attachment.js +3 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/chain-root-attachment.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/fleet-view.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/fleet-view.js +3 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/background/fleet-view.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +3 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +7 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +19 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts +10 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +19 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +17 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts +3 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js +14 -3
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +14 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/fleet.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/fleet.js +2 -2
- package/dist/builtin-extensions/pi-subagents/src/tui/fleet.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +12 -10
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/catalog/models.json +1 -1
- package/dist/catalog/providers/amazon-bedrock.json +1 -1
- package/dist/catalog/providers/anthropic.json +1 -1
- package/dist/catalog/providers/azure-openai-responses.json +1 -1
- package/dist/catalog/providers/cloudflare-ai-gateway.json +1 -1
- package/dist/catalog/providers/cloudflare-workers-ai.json +1 -1
- package/dist/catalog/providers/fireworks.json +1 -1
- package/dist/catalog/providers/github-copilot.json +1 -1
- package/dist/catalog/providers/google-vertex.json +1 -1
- package/dist/catalog/providers/google.json +1 -1
- package/dist/catalog/providers/groq.json +1 -1
- package/dist/catalog/providers/huggingface.json +1 -1
- package/dist/catalog/providers/nvidia.json +1 -1
- package/dist/catalog/providers/openai-codex.json +1 -1
- package/dist/catalog/providers/openai.json +1 -1
- package/dist/catalog/providers/opencode-go.json +1 -1
- package/dist/catalog/providers/opencode.json +1 -1
- package/dist/catalog/providers/openrouter.json +1 -1
- package/dist/catalog/providers/together.json +1 -1
- package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
- package/dist/catalog/publication.json +131 -3
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +1 -0
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +52 -27
- package/dist/cli.js.map +1 -1
- package/dist/core/catalog-cache-scope.d.ts +3 -0
- package/dist/core/catalog-cache-scope.d.ts.map +1 -0
- package/dist/core/catalog-cache-scope.js +12 -0
- package/dist/core/catalog-cache-scope.js.map +1 -0
- package/dist/core/catalog-merge.d.ts +2 -0
- package/dist/core/catalog-merge.d.ts.map +1 -1
- package/dist/core/catalog-merge.js +29 -2
- package/dist/core/catalog-merge.js.map +1 -1
- package/dist/core/catalog-refresh-polling.d.ts +8 -0
- package/dist/core/catalog-refresh-polling.d.ts.map +1 -0
- package/dist/core/catalog-refresh-polling.js +30 -0
- package/dist/core/catalog-refresh-polling.js.map +1 -0
- package/dist/core/codex-catalog.d.ts +3 -0
- package/dist/core/codex-catalog.d.ts.map +1 -0
- package/dist/core/codex-catalog.js +15 -0
- package/dist/core/codex-catalog.js.map +1 -0
- package/dist/core/context-breakdown.d.ts +3 -1
- package/dist/core/context-breakdown.d.ts.map +1 -1
- package/dist/core/context-breakdown.js +5 -2
- package/dist/core/context-breakdown.js.map +1 -1
- package/dist/core/customize.d.ts +2 -4
- package/dist/core/customize.d.ts.map +1 -1
- package/dist/core/customize.js +2 -8
- package/dist/core/customize.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +3 -4
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +54 -82
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/live-catalog.d.ts +5 -2
- package/dist/core/live-catalog.d.ts.map +1 -1
- package/dist/core/live-catalog.js +108 -27
- package/dist/core/live-catalog.js.map +1 -1
- package/dist/core/model-runtime.d.ts +8 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +64 -12
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/official-catalog.d.ts +4 -0
- package/dist/core/official-catalog.d.ts.map +1 -1
- package/dist/core/official-catalog.js +86 -21
- package/dist/core/official-catalog.js.map +1 -1
- package/dist/core/settings-manager.d.ts +7 -6
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +13 -17
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +106 -50
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +2 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +14 -4
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +1 -3
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +4 -32
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +2 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +4 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/plan-message.d.ts +1 -3
- package/dist/modes/interactive/components/plan-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/plan-message.js +1 -16
- package/dist/modes/interactive/components/plan-message.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -5
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +113 -117
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +1 -3
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +2 -19
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +12 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +153 -130
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/skill-tag-autocomplete.d.ts +13 -0
- package/dist/modes/interactive/skill-tag-autocomplete.d.ts.map +1 -0
- package/dist/modes/interactive/skill-tag-autocomplete.js +72 -0
- package/dist/modes/interactive/skill-tag-autocomplete.js.map +1 -0
- package/dist/modes/interactive/theme/moon.json +0 -1
- package/dist/modes/interactive/theme/theme-schema.json +3 -3
- package/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +95 -90
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/startup/interactive-view.d.ts +55 -0
- package/dist/startup/interactive-view.d.ts.map +1 -0
- package/dist/startup/interactive-view.js +332 -0
- package/dist/startup/interactive-view.js.map +1 -0
- package/dist/startup/launch-routing.d.ts +8 -0
- package/dist/startup/launch-routing.d.ts.map +1 -0
- package/dist/startup/launch-routing.js +29 -0
- package/dist/startup/launch-routing.js.map +1 -0
- package/dist/startup/startup-milestones.d.ts +4 -0
- package/dist/startup/startup-milestones.d.ts.map +1 -0
- package/dist/startup/startup-milestones.js +14 -0
- package/dist/startup/startup-milestones.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +10 -4
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/docs/features.md +2 -2
- package/docs/interactive-startup.md +58 -0
- package/docs/keybindings.md +1 -1
- package/docs/model-catalog.md +29 -0
- package/docs/quickstart.md +1 -1
- package/docs/settings.md +2 -3
- package/docs/skills.md +10 -0
- package/docs/terminal-setup.md +2 -2
- package/docs/usage.md +2 -1
- package/docs/windows.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +16 -16
package/dist/main.js
CHANGED
|
@@ -16,17 +16,16 @@ import { listModels } from "./cli/list-models.js";
|
|
|
16
16
|
import { createProjectTrustContext } from "./cli/project-trust.js";
|
|
17
17
|
import { selectSession } from "./cli/session-picker.js";
|
|
18
18
|
import { shouldRunFirstTimeSetup, showFirstTimeSetup, showStartupSelector } from "./cli/startup-ui.js";
|
|
19
|
+
import { handleUpdateCli } from "./cli/update-cli.js";
|
|
19
20
|
import { APP_NAME, appendDebugLog, ENV_SESSION_DIR, expandTildePath, getAgentDir, getSessionsDir, VERSION, } from "./config.js";
|
|
20
21
|
import { createAgentSessionRuntime } from "./core/agent-session-runtime.js";
|
|
21
22
|
import { createAgentSessionFromServices, createAgentSessionServices, } from "./core/agent-session-services.js";
|
|
22
23
|
import { formatNoModelsAvailableMessage } from "./core/auth-guidance.js";
|
|
23
24
|
import { registerCustomizeBridge } from "./core/customize.js";
|
|
24
|
-
import { exportFromFile } from "./core/export-html/index.js";
|
|
25
25
|
import { applyHttpProxySettings, configureHttpDispatcher } from "./core/http-dispatcher.js";
|
|
26
26
|
import { registerMemoryCapBridge } from "./core/memory-cap.js";
|
|
27
27
|
import { resolveCliModel, resolveModelScope } from "./core/model-resolver.js";
|
|
28
28
|
import { getModelTiersBridge, registerModelTierBridge } from "./core/model-tiers.js";
|
|
29
|
-
import { registerUsageServiceBridge } from "./core/usage-service.js";
|
|
30
29
|
import { restoreStdout, takeOverStdout } from "./core/output-guard.js";
|
|
31
30
|
import { resolveProjectTrusted } from "./core/project-trust.js";
|
|
32
31
|
import { formatMissingSessionCwdPrompt, getMissingSessionCwdIssue, MissingSessionCwdError, } from "./core/session-cwd.js";
|
|
@@ -36,12 +35,11 @@ import { SettingsManager } from "./core/settings-manager.js";
|
|
|
36
35
|
import { applyInheritedSubagentPermissions } from "./core/subagent-permission-inherit.js";
|
|
37
36
|
import { printTimings, resetTimings, time } from "./core/timings.js";
|
|
38
37
|
import { hasTrustRequiringProjectResources, ProjectTrustStore } from "./core/trust-manager.js";
|
|
39
|
-
import {
|
|
38
|
+
import { registerUsageServiceBridge } from "./core/usage-service.js";
|
|
40
39
|
import { runMigrations, showDeprecationWarnings } from "./migrations.js";
|
|
41
|
-
import { InteractiveMode } from "./modes/interactive/interactive-mode.js";
|
|
42
40
|
import { initTheme, stopThemeWatcher } from "./modes/interactive/theme/theme.js";
|
|
43
|
-
import { handleUpdateCli } from "./cli/update-cli.js";
|
|
44
41
|
import { handleConfigCommand, handlePackageCommand } from "./package-manager-cli.js";
|
|
42
|
+
import { markStartupMilestone } from "./startup/startup-milestones.js";
|
|
45
43
|
import { isLocalPath, normalizePath, resolvePath } from "./utils/paths.js";
|
|
46
44
|
const EXTENSION_LOAD_FAILURE_HINT = `Hint: Start without extensions using "${APP_NAME} -ne".`;
|
|
47
45
|
/**
|
|
@@ -179,7 +177,10 @@ async function resolveSessionPath(sessionArg, cwd, sessionDir) {
|
|
|
179
177
|
return { type: "not_found", arg: sessionArg };
|
|
180
178
|
}
|
|
181
179
|
/** Prompt user for yes/no confirmation */
|
|
182
|
-
async function promptConfirm(message) {
|
|
180
|
+
async function promptConfirm(message, startupView) {
|
|
181
|
+
if (startupView) {
|
|
182
|
+
return startupView.confirm("Confirm", message);
|
|
183
|
+
}
|
|
183
184
|
return new Promise((resolve) => {
|
|
184
185
|
const rl = createInterface({
|
|
185
186
|
input: process.stdin,
|
|
@@ -246,7 +247,7 @@ function forkSessionOrExit(sourcePath, cwd, sessionDir, sessionId) {
|
|
|
246
247
|
process.exit(1);
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
|
-
async function createSessionManager(parsed, cwd, sessionDir, settingsManager) {
|
|
250
|
+
async function createSessionManager(parsed, cwd, sessionDir, settingsManager, startupView) {
|
|
250
251
|
if (parsed.noSession || parsed.help || parsed.listModels !== undefined) {
|
|
251
252
|
return SessionManager.inMemory(cwd, parsed.sessionId !== undefined ? { id: parsed.sessionId } : undefined);
|
|
252
253
|
}
|
|
@@ -277,7 +278,7 @@ async function createSessionManager(parsed, cwd, sessionDir, settingsManager) {
|
|
|
277
278
|
return openSessionOrExit(resolved.path, sessionDir);
|
|
278
279
|
case "global": {
|
|
279
280
|
console.log(chalk.yellow(`Session found in different project: ${resolved.cwd}`));
|
|
280
|
-
const shouldFork = await promptConfirm("Fork this session into current directory?");
|
|
281
|
+
const shouldFork = await promptConfirm("Fork this session into current directory?", startupView);
|
|
281
282
|
if (!shouldFork) {
|
|
282
283
|
console.log(chalk.dim("Aborted."));
|
|
283
284
|
process.exit(0);
|
|
@@ -291,7 +292,11 @@ async function createSessionManager(parsed, cwd, sessionDir, settingsManager) {
|
|
|
291
292
|
}
|
|
292
293
|
if (parsed.resume) {
|
|
293
294
|
try {
|
|
294
|
-
const
|
|
295
|
+
const currentSessionsLoader = (onProgress) => SessionManager.list(cwd, sessionDir, onProgress);
|
|
296
|
+
const allSessionsLoader = (onProgress) => SessionManager.listAll(sessionDir, onProgress);
|
|
297
|
+
const selectedPath = startupView
|
|
298
|
+
? await startupView.selectSession(currentSessionsLoader, allSessionsLoader)
|
|
299
|
+
: await selectSession(currentSessionsLoader, allSessionsLoader, settingsManager);
|
|
295
300
|
if (!selectedPath) {
|
|
296
301
|
console.log(chalk.dim("No session selected"));
|
|
297
302
|
process.exit(0);
|
|
@@ -398,11 +403,27 @@ function buildSessionOptions(parsed, scopedModels, hasExistingSession, modelRunt
|
|
|
398
403
|
function resolveCliPaths(cwd, paths) {
|
|
399
404
|
return paths?.map((value) => (isLocalPath(value) ? resolvePath(value, cwd) : value));
|
|
400
405
|
}
|
|
401
|
-
|
|
402
|
-
return
|
|
406
|
+
function createStartupViewTrustContext(cwd, startupView) {
|
|
407
|
+
return {
|
|
408
|
+
cwd,
|
|
409
|
+
mode: "tui",
|
|
410
|
+
hasUI: true,
|
|
411
|
+
ui: {
|
|
412
|
+
select: (title, options) => startupView.select(title, options.map((option) => ({ label: option, value: option }))),
|
|
413
|
+
confirm: (title, message) => startupView.confirm(title, message),
|
|
414
|
+
input: (title, placeholder) => startupView.input(title, placeholder),
|
|
415
|
+
notify: () => { },
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
async function promptForMissingSessionCwd(issue, settingsManager, startupView) {
|
|
420
|
+
const options = [
|
|
403
421
|
{ label: "Continue", value: issue.fallbackCwd },
|
|
404
422
|
{ label: "Cancel", value: undefined },
|
|
405
|
-
]
|
|
423
|
+
];
|
|
424
|
+
return startupView
|
|
425
|
+
? startupView.select(formatMissingSessionCwdPrompt(issue), options)
|
|
426
|
+
: showStartupSelector(settingsManager, formatMissingSessionCwdPrompt(issue), options);
|
|
406
427
|
}
|
|
407
428
|
export async function main(args, options) {
|
|
408
429
|
resetTimings();
|
|
@@ -429,11 +450,10 @@ export async function main(args, options) {
|
|
|
429
450
|
if (await handleConfigCommand(args, { extensionFactories: options?.extensionFactories })) {
|
|
430
451
|
return;
|
|
431
452
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
return;
|
|
453
|
+
if (args[0] === "gateway") {
|
|
454
|
+
const { handleGatewayCommand } = await import("./gateway/command.js");
|
|
455
|
+
if (await handleGatewayCommand(args))
|
|
456
|
+
return;
|
|
437
457
|
}
|
|
438
458
|
const parsed = parseArgs(args);
|
|
439
459
|
if (parsed.diagnostics.length > 0) {
|
|
@@ -453,6 +473,7 @@ export async function main(args, options) {
|
|
|
453
473
|
if (parsed.export) {
|
|
454
474
|
let result;
|
|
455
475
|
try {
|
|
476
|
+
const { exportFromFile } = await import("./core/export-html/index.js");
|
|
456
477
|
const outputPath = parsed.messages.length > 0 ? parsed.messages[0] : undefined;
|
|
457
478
|
result = await exportFromFile(parsed.export, outputPath);
|
|
458
479
|
}
|
|
@@ -465,6 +486,10 @@ export async function main(args, options) {
|
|
|
465
486
|
process.exit(0);
|
|
466
487
|
}
|
|
467
488
|
let appMode = resolveAppMode(parsed, process.stdin.isTTY, process.stdout.isTTY);
|
|
489
|
+
const interactiveModeImport = appMode === "interactive" ? import("./modes/interactive/interactive-mode.js") : undefined;
|
|
490
|
+
const startupView = appMode === "interactive" ? options?.startupView : undefined;
|
|
491
|
+
if (options?.startupView && !startupView)
|
|
492
|
+
options.startupView.stop();
|
|
468
493
|
// lunr: parent-delegated children inherit plan or auto before any tool call.
|
|
469
494
|
// Non-child print/json stays fail-closed (module default manual, no handler).
|
|
470
495
|
applyInheritedSubagentPermissions();
|
|
@@ -496,7 +521,9 @@ export async function main(args, options) {
|
|
|
496
521
|
// Experimental first-time setup: theme choice and analytics opt-in.
|
|
497
522
|
// Runs before any runtime services are created so the chosen settings apply everywhere.
|
|
498
523
|
if (appMode === "interactive" && !parsed.help && parsed.listModels === undefined && shouldRunFirstTimeSetup()) {
|
|
524
|
+
startupView?.pause();
|
|
499
525
|
await showFirstTimeSetup(startupSettingsManager);
|
|
526
|
+
startupView?.resume();
|
|
500
527
|
time("firstTimeSetup");
|
|
501
528
|
}
|
|
502
529
|
// Decide the final runtime cwd before creating cwd-bound runtime services.
|
|
@@ -508,11 +535,11 @@ export async function main(args, options) {
|
|
|
508
535
|
const sessionDir = (parsed.sessionDir ? normalizePath(parsed.sessionDir) : undefined) ??
|
|
509
536
|
(envSessionDir ? expandTildePath(envSessionDir) : undefined) ??
|
|
510
537
|
startupSettingsManager.getSessionDir();
|
|
511
|
-
let sessionManager = await createSessionManager(parsed, cwd, sessionDir, startupSettingsManager);
|
|
538
|
+
let sessionManager = await createSessionManager(parsed, cwd, sessionDir, startupSettingsManager, startupView);
|
|
512
539
|
const missingSessionCwdIssue = getMissingSessionCwdIssue(sessionManager, cwd);
|
|
513
540
|
if (missingSessionCwdIssue) {
|
|
514
541
|
if (appMode === "interactive") {
|
|
515
|
-
const selectedCwd = await promptForMissingSessionCwd(missingSessionCwdIssue, startupSettingsManager);
|
|
542
|
+
const selectedCwd = await promptForMissingSessionCwd(missingSessionCwdIssue, startupSettingsManager, startupView);
|
|
516
543
|
if (!selectedCwd) {
|
|
517
544
|
process.exit(0);
|
|
518
545
|
}
|
|
@@ -532,31 +559,27 @@ export async function main(args, options) {
|
|
|
532
559
|
sessionManager.appendSessionInfo(name);
|
|
533
560
|
}
|
|
534
561
|
time("createSessionManager");
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
if (retentionDays > 0) {
|
|
562
|
+
const runSessionRetention = async () => {
|
|
563
|
+
try {
|
|
564
|
+
const retentionDays = startupSettingsManager.getSessionRetentionDays();
|
|
565
|
+
if (retentionDays <= 0)
|
|
566
|
+
return;
|
|
541
567
|
const activeSessionFile = sessionManager.getSessionFile();
|
|
542
568
|
const { deleted } = await pruneOldSessions(getSessionsDir(), retentionDays, {
|
|
543
569
|
excludeFile: activeSessionFile,
|
|
544
570
|
});
|
|
545
|
-
// Also cover a custom session dir (--session-dir / settings), which is a flat
|
|
546
|
-
// .jsonl directory outside the default sessions root.
|
|
547
571
|
if (sessionDir) {
|
|
548
572
|
const extra = await pruneOldSessions(sessionDir, retentionDays, { excludeFile: activeSessionFile });
|
|
549
573
|
deleted.push(...extra.deleted);
|
|
550
574
|
}
|
|
551
575
|
if (deleted.length > 0) {
|
|
552
|
-
appendDebugLog(`session-retention: deleted ${deleted.length} file(s):\n${deleted.map((
|
|
576
|
+
appendDebugLog(`session-retention: deleted ${deleted.length} file(s):\n${deleted.map((path) => ` ${path}`).join("\n")}`);
|
|
553
577
|
}
|
|
554
578
|
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
}
|
|
559
|
-
time("pruneOldSessions");
|
|
579
|
+
catch (error) {
|
|
580
|
+
appendDebugLog(`session-retention: prune failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
581
|
+
}
|
|
582
|
+
};
|
|
560
583
|
const trustStore = new ProjectTrustStore(agentDir);
|
|
561
584
|
const sessionCwd = sessionManager.getCwd();
|
|
562
585
|
const autoTrustOnReloadCwd = parsed.projectTrustOverride === undefined && !hasTrustRequiringProjectResources(sessionCwd)
|
|
@@ -568,7 +591,7 @@ export async function main(args, options) {
|
|
|
568
591
|
const resolvedSkillPaths = resolveCliPaths(cwd, parsed.skills);
|
|
569
592
|
const resolvedPromptTemplatePaths = resolveCliPaths(cwd, parsed.promptTemplates);
|
|
570
593
|
const resolvedThemePaths = resolveCliPaths(cwd, parsed.themes);
|
|
571
|
-
|
|
594
|
+
const builtinRoster = appMode === "interactive" ? [...lightBuiltinExtensions] : await loadAllBuiltinExtensions();
|
|
572
595
|
const rememberAttachedFactories = (factories) => {
|
|
573
596
|
const seen = new Set(builtinRoster.map((entry) => (typeof entry === "function" ? undefined : entry.name)).filter(Boolean));
|
|
574
597
|
for (const factory of factories) {
|
|
@@ -609,12 +632,14 @@ export async function main(args, options) {
|
|
|
609
632
|
defaultProjectTrust: startupSettingsManager.getDefaultProjectTrust(),
|
|
610
633
|
extensionsResult,
|
|
611
634
|
projectTrustContext: projectTrustContext ??
|
|
612
|
-
|
|
613
|
-
cwd,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
635
|
+
(isInitialRuntime && startupView
|
|
636
|
+
? createStartupViewTrustContext(cwd, startupView)
|
|
637
|
+
: createProjectTrustContext({
|
|
638
|
+
cwd,
|
|
639
|
+
mode: isInitialRuntime ? trustPromptMode : appMode,
|
|
640
|
+
settingsManager: startupSettingsManager,
|
|
641
|
+
hasUI: isInitialRuntime && trustPromptMode === "interactive",
|
|
642
|
+
})),
|
|
618
643
|
onExtensionError: (message) => projectTrustDiagnostics.push({ type: "warning", message }),
|
|
619
644
|
});
|
|
620
645
|
projectTrustByCwd.set(cwd, trusted);
|
|
@@ -640,6 +665,15 @@ export async function main(args, options) {
|
|
|
640
665
|
},
|
|
641
666
|
});
|
|
642
667
|
const { settingsManager, modelRuntime, resourceLoader } = services;
|
|
668
|
+
if (parsed.model &&
|
|
669
|
+
!resolveCliModel({
|
|
670
|
+
cliProvider: parsed.provider,
|
|
671
|
+
cliModel: parsed.model,
|
|
672
|
+
cliThinking: parsed.thinking,
|
|
673
|
+
modelRuntime,
|
|
674
|
+
}).model) {
|
|
675
|
+
await modelRuntime.refreshIfStale();
|
|
676
|
+
}
|
|
643
677
|
const diagnostics = [
|
|
644
678
|
...projectTrustDiagnostics,
|
|
645
679
|
...services.diagnostics,
|
|
@@ -695,7 +729,14 @@ export async function main(args, options) {
|
|
|
695
729
|
agentDir,
|
|
696
730
|
sessionManager,
|
|
697
731
|
});
|
|
732
|
+
if (startupView?.isExitRequested) {
|
|
733
|
+
await runtime.dispose();
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
markStartupMilestone("runtime_hydrated");
|
|
698
737
|
time("createAgentSessionRuntime");
|
|
738
|
+
if (appMode !== "interactive")
|
|
739
|
+
await runSessionRetention();
|
|
699
740
|
const { services, session, modelFallbackMessage } = runtime;
|
|
700
741
|
const { settingsManager, modelRuntime, resourceLoader } = services;
|
|
701
742
|
applyHttpProxySettings(settingsManager.getGlobalSettings().httpProxy);
|
|
@@ -734,16 +775,23 @@ export async function main(args, options) {
|
|
|
734
775
|
time("prepareInitialMessage");
|
|
735
776
|
initTheme(settingsManager.getTheme(), appMode === "interactive");
|
|
736
777
|
time("initTheme");
|
|
737
|
-
|
|
738
|
-
if (appMode === "interactive" && deprecationWarnings.length > 0) {
|
|
778
|
+
if (appMode === "interactive" && !startupView && deprecationWarnings.length > 0) {
|
|
739
779
|
await showDeprecationWarnings(deprecationWarnings);
|
|
740
780
|
}
|
|
741
781
|
time("resolveModelScope");
|
|
742
|
-
|
|
782
|
+
if (!(appMode === "interactive" && startupView))
|
|
783
|
+
reportDiagnostics(runtime.diagnostics);
|
|
743
784
|
if (runtime.diagnostics.some((diagnostic) => diagnostic.type === "error")) {
|
|
744
|
-
|
|
745
|
-
|
|
785
|
+
const extensionHint = runtime.diagnostics.some((diagnostic) => diagnostic.message.includes("Failed to load extension"))
|
|
786
|
+
? `\n${EXTENSION_LOAD_FAILURE_HINT}`
|
|
787
|
+
: "";
|
|
788
|
+
if (startupView) {
|
|
789
|
+
process.exitCode = 1;
|
|
790
|
+
await startupView.fail(`${runtime.diagnostics.map((diagnostic) => diagnostic.message).join("\n")}${extensionHint}`);
|
|
791
|
+
return;
|
|
746
792
|
}
|
|
793
|
+
if (extensionHint)
|
|
794
|
+
console.error(chalk.yellow(EXTENSION_LOAD_FAILURE_HINT));
|
|
747
795
|
process.exit(1);
|
|
748
796
|
}
|
|
749
797
|
time("createAgentSession");
|
|
@@ -761,7 +809,10 @@ export async function main(args, options) {
|
|
|
761
809
|
await runRpcMode(runtime);
|
|
762
810
|
}
|
|
763
811
|
else if (appMode === "interactive") {
|
|
764
|
-
const { loadDeferredBuiltinExtensions } = await
|
|
812
|
+
const [{ InteractiveMode }, { loadDeferredBuiltinExtensions }] = await Promise.all([
|
|
813
|
+
interactiveModeImport,
|
|
814
|
+
import("./builtin-extensions/index.js"),
|
|
815
|
+
]);
|
|
765
816
|
const interactiveMode = new InteractiveMode(runtime, {
|
|
766
817
|
migratedProviders,
|
|
767
818
|
modelFallbackMessage,
|
|
@@ -770,16 +821,21 @@ export async function main(args, options) {
|
|
|
770
821
|
initialImages,
|
|
771
822
|
initialMessages: parsed.messages,
|
|
772
823
|
verbose: parsed.verbose,
|
|
824
|
+
deprecationWarnings: startupView ? deprecationWarnings : undefined,
|
|
825
|
+
startupDiagnostics: startupView
|
|
826
|
+
? runtime.diagnostics.filter((diagnostic) => diagnostic.type !== "error")
|
|
827
|
+
: undefined,
|
|
828
|
+
startupView: startupView?.binding(),
|
|
829
|
+
deferredMaintenance: runSessionRetention,
|
|
773
830
|
deferredBuiltinFactories: parsed.noExtensions ? undefined : loadDeferredBuiltinExtensions,
|
|
774
831
|
onDeferredBuiltinsAttached: rememberAttachedFactories,
|
|
775
832
|
});
|
|
776
833
|
if (startupBenchmark) {
|
|
777
834
|
await interactiveMode.init();
|
|
778
835
|
time("interactiveMode.init");
|
|
779
|
-
await interactiveMode.
|
|
780
|
-
time("
|
|
781
|
-
//
|
|
782
|
-
// (Kitty keyboard protocol, device attributes, cell size) before restoring the terminal.
|
|
836
|
+
await interactiveMode.waitForStartupReady();
|
|
837
|
+
time("promptBarrier");
|
|
838
|
+
// Consume terminal-query replies before returning control to the shell.
|
|
783
839
|
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
784
840
|
interactiveMode.stop();
|
|
785
841
|
stopThemeWatcher();
|