@ashx-j/lunr 0.2.8 → 0.2.10
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/dist/builtin-extensions/ashxj-spinners.d.ts +4 -0
- package/dist/builtin-extensions/ashxj-spinners.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-spinners.js +14 -3
- package/dist/builtin-extensions/ashxj-spinners.js.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.d.ts +4 -0
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +49 -4
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/lunr-behavior.d.ts +2 -1
- package/dist/builtin-extensions/lunr-behavior.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-behavior.js +26 -14
- package/dist/builtin-extensions/lunr-behavior.js.map +1 -1
- package/dist/builtin-extensions/lunr-todos.d.ts +4 -7
- package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-todos.js +18 -10
- package/dist/builtin-extensions/lunr-todos.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js +3 -3
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +4 -4
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +4 -5
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.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 +5 -1
- 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.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +6 -18
- 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.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +13 -5
- 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 +2 -2
- 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 +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/lunr-child-context.d.ts +21 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/lunr-child-context.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/lunr-child-context.js +22 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/lunr-child-context.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js +2 -2
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +2 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +10 -18
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +4 -6
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +26 -18
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.js +3 -1
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/render-search-error.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/render-search-error.js +1 -1
- package/dist/builtin-extensions/pi-web-access/render-search-error.js.map +1 -1
- package/dist/catalog/models.json +1 -1
- package/dist/catalog/providers/nvidia.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/qwen-cloud-cn.json +1 -1
- package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
- package/dist/catalog/providers/xai.json +1 -1
- package/dist/catalog/publication.json +2 -2
- package/dist/cli/update-cli.d.ts +16 -0
- package/dist/cli/update-cli.d.ts.map +1 -0
- package/dist/cli/update-cli.js +83 -0
- package/dist/cli/update-cli.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -0
- package/dist/cli.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 +9 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/behavior-preset.d.ts +60 -0
- package/dist/core/behavior-preset.d.ts.map +1 -0
- package/dist/core/behavior-preset.js +257 -0
- package/dist/core/behavior-preset.js.map +1 -0
- package/dist/core/customize.d.ts +4 -0
- package/dist/core/customize.d.ts.map +1 -1
- package/dist/core/customize.js +12 -0
- package/dist/core/customize.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +12 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +70 -5
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +1 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-tiers.d.ts +9 -0
- package/dist/core/model-tiers.d.ts.map +1 -1
- package/dist/core/model-tiers.js +16 -0
- package/dist/core/model-tiers.js.map +1 -1
- package/dist/core/settings-manager.d.ts +26 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +74 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +3 -4
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +9 -6
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +2 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +2 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +2 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +2 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +13 -3
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +10 -2
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +5 -3
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/update-check.d.ts +32 -0
- package/dist/core/update-check.d.ts.map +1 -0
- package/dist/core/update-check.js +112 -0
- package/dist/core/update-check.js.map +1 -0
- package/dist/core/usage-service.d.ts +24 -1
- package/dist/core/usage-service.d.ts.map +1 -1
- package/dist/core/usage-service.js +91 -14
- package/dist/core/usage-service.js.map +1 -1
- package/dist/gateway/agent-bridge.d.ts +1 -0
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +5 -1
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +5 -1
- package/dist/gateway/cron.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +13 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +4 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +68 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +15 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +168 -11
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-tail.d.ts +1 -0
- package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-tail.js +2 -6
- package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +7 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +84 -16
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +19 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +221 -37
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/keybindings.md +1 -1
- package/docs/terminal-setup.md +2 -2
- 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 +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"grok-4.3":{"id":"grok-4.3","name":"Grok 4.3","api":"openai-completions","provider":"xai","baseUrl":"https://api.x.ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":2.5,"cacheRead":0.2,"cacheWrite":0},"contextWindow":1000000,"maxTokens":30000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false}},"grok-4.5":{"id":"grok-4.5","name":"Grok 4.5","api":"openai-responses","provider":"xai","baseUrl":"https://api.x.ai/v1","compat":{"supportsLongCacheRetention":false},"reasoning":true,"input":["text","image"],"cost":{"input":2,"output":6,"cacheRead":0.3,"cacheWrite":0},"contextWindow":500000,"maxTokens":500000,"thinkingLevelMap":{"off":null,"minimal":null}},"grok-4.6":{"id":"grok-4.6","name":"Grok 4.6","api":"openai-
|
|
1
|
+
{"grok-4.3":{"id":"grok-4.3","name":"Grok 4.3","api":"openai-completions","provider":"xai","baseUrl":"https://api.x.ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":2.5,"cacheRead":0.2,"cacheWrite":0},"contextWindow":1000000,"maxTokens":30000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false}},"grok-4.5":{"id":"grok-4.5","name":"Grok 4.5","api":"openai-responses","provider":"xai","baseUrl":"https://api.x.ai/v1","compat":{"supportsLongCacheRetention":false},"reasoning":true,"input":["text","image"],"cost":{"input":2,"output":6,"cacheRead":0.3,"cacheWrite":0},"contextWindow":500000,"maxTokens":500000,"thinkingLevelMap":{"off":null,"minimal":null}},"grok-4.6":{"id":"grok-4.6","name":"Grok 4.6","api":"openai-responses","provider":"xai","baseUrl":"https://api.x.ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":6,"cacheRead":0.5,"cacheWrite":0},"contextWindow":500000,"maxTokens":500000,"thinkingLevelMap":{"off":null,"minimal":null,"xhigh":"xhigh"},"compat":{"supportsLongCacheRetention":false}},"grok-build-0.1":{"id":"grok-build-0.1","name":"Grok Build 0.1","api":"openai-completions","provider":"xai","baseUrl":"https://api.x.ai/v1","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":2,"cacheRead":0.2,"cacheWrite":0},"contextWindow":256000,"maxTokens":256000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false}}}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `lunr update` / `lunr update --self` — reinstall the published global CLI.
|
|
3
|
+
* Workspace checkouts (this repo's npx lunr) refuse to self-update.
|
|
4
|
+
*/
|
|
5
|
+
import { checkForUpdate } from "../core/update-check.ts";
|
|
6
|
+
export declare function handleUpdateCli(args: string[], deps?: {
|
|
7
|
+
check?: typeof checkForUpdate;
|
|
8
|
+
spawn?: (command: string, argv: string[]) => Promise<number | null>;
|
|
9
|
+
published?: boolean;
|
|
10
|
+
currentVersion?: string;
|
|
11
|
+
warn?: (msg: string) => void;
|
|
12
|
+
log?: (msg: string) => void;
|
|
13
|
+
error?: (msg: string) => void;
|
|
14
|
+
packageDir?: string;
|
|
15
|
+
}): Promise<boolean>;
|
|
16
|
+
//# sourceMappingURL=update-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-cli.d.ts","sourceRoot":"","sources":["../../src/cli/update-cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,cAAc,EAAsB,MAAM,yBAAyB,CAAC;AAiB7E,wBAAsB,eAAe,CACpC,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,GAAE;IACL,KAAK,CAAC,EAAE,OAAO,cAAc,CAAC;IAC9B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACpE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACf,GACJ,OAAO,CAAC,OAAO,CAAC,CAsElB","sourcesContent":["/**\n * `lunr update` / `lunr update --self` — reinstall the published global CLI.\n * Workspace checkouts (this repo's npx lunr) refuse to self-update.\n */\n\nimport chalk from \"chalk\";\nimport { APP_NAME, getAgentDir, getPackageDir, NPM_CLI_PACKAGE, PACKAGE_NAME, VERSION } from \"../config.ts\";\nimport { SettingsManager } from \"../core/settings-manager.ts\";\nimport { checkForUpdate, isPublishedInstall } from \"../core/update-check.ts\";\nimport { spawnProcess, waitForChildProcess } from \"../utils/child-process.ts\";\n\nfunction printUpdateHelp(): void {\n\tconsole.log(`${chalk.bold(\"Usage:\")}\n ${APP_NAME} update [--self]\n\nReinstall the global ${NPM_CLI_PACKAGE} package from npm.\n\nOptions:\n --self Same as \\`${APP_NAME} update\\` (kept for muscle memory)\n -h, --help\n\nThis does not refresh model catalogs (/refresh) or extension packages (${APP_NAME} install).\n`);\n}\n\nexport async function handleUpdateCli(\n\targs: string[],\n\tdeps: {\n\t\tcheck?: typeof checkForUpdate;\n\t\tspawn?: (command: string, argv: string[]) => Promise<number | null>;\n\t\tpublished?: boolean;\n\t\tcurrentVersion?: string;\n\t\twarn?: (msg: string) => void;\n\t\tlog?: (msg: string) => void;\n\t\terror?: (msg: string) => void;\n\t\tpackageDir?: string;\n\t} = {},\n): Promise<boolean> {\n\tif (args[0] !== \"update\") return false;\n\n\tconst rest = args.slice(1).filter((a) => a !== \"--self\");\n\tif (rest.includes(\"-h\") || rest.includes(\"--help\")) {\n\t\tprintUpdateHelp();\n\t\tprocess.exitCode = 0;\n\t\treturn true;\n\t}\n\tif (rest.length > 0) {\n\t\t(deps.error ?? console.error)(`Unknown argument: ${rest[0]}`);\n\t\tprintUpdateHelp();\n\t\tprocess.exitCode = 2;\n\t\treturn true;\n\t}\n\n\tconst published = deps.published ?? isPublishedInstall();\n\tif (!published) {\n\t\t(deps.error ?? console.error)(\n\t\t\t`This tree is ${PACKAGE_NAME}, not a global ${NPM_CLI_PACKAGE} install. Use \\`npm i -g ${NPM_CLI_PACKAGE}\\` to update the published CLI; workspace \\`npx ${APP_NAME}\\` is not self-updated.`,\n\t\t);\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tconst log = deps.log ?? console.log;\n\tconst error = deps.error ?? console.error;\n\tconst check = deps.check ?? checkForUpdate;\n\tconst result = await check({\n\t\tcurrentVersion: deps.currentVersion ?? VERSION,\n\t\tagentDir: getAgentDir(),\n\t\tpublished: true,\n\t\toffline: process.env.PI_OFFLINE === \"1\",\n\t\tforce: true,\n\t});\n\tif (!result) {\n\t\terror(\"Could not reach the npm registry to check for updates.\");\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\tif (!result.newer) {\n\t\tlog(`${APP_NAME} ${result.current} is up to date.`);\n\t\tprocess.exitCode = 0;\n\t\treturn true;\n\t}\n\n\tconst cwd = process.cwd();\n\tconst settings = SettingsManager.create(cwd, getAgentDir(), { projectTrusted: false });\n\tconst npmArgv = settings.getNpmCommand() ?? [\"npm\"];\n\tconst installArgv = [...npmArgv.slice(1), \"install\", \"-g\", `${NPM_CLI_PACKAGE}@${result.latest}`];\n\tconst command = npmArgv[0] ?? \"npm\";\n\n\tconst packageDir = deps.packageDir ?? getPackageDir();\n\t(deps.warn ?? console.warn)(\n\t\t`Installing ${NPM_CLI_PACKAGE}@${result.latest}. If this process is the global install (${packageDir}), Windows may fail to overwrite files until lunr exits.`,\n\t);\n\n\tconst spawn =\n\t\tdeps.spawn ??\n\t\t(async (cmd: string, argv: string[]) => {\n\t\t\tconst child = spawnProcess(cmd, argv, { stdio: \"inherit\" });\n\t\t\treturn waitForChildProcess(child);\n\t\t});\n\n\tconst code = await spawn(command, installArgv);\n\tprocess.exitCode = code === 0 || code === null ? 0 : code;\n\tif ((process.exitCode ?? 0) === 0) {\n\t\tlog(`Updated ${APP_NAME} ${result.current} → ${result.latest}.`);\n\t}\n\treturn true;\n}\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `lunr update` / `lunr update --self` — reinstall the published global CLI.
|
|
3
|
+
* Workspace checkouts (this repo's npx lunr) refuse to self-update.
|
|
4
|
+
*/
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import { APP_NAME, getAgentDir, getPackageDir, NPM_CLI_PACKAGE, PACKAGE_NAME, VERSION } from "../config.js";
|
|
7
|
+
import { SettingsManager } from "../core/settings-manager.js";
|
|
8
|
+
import { checkForUpdate, isPublishedInstall } from "../core/update-check.js";
|
|
9
|
+
import { spawnProcess, waitForChildProcess } from "../utils/child-process.js";
|
|
10
|
+
function printUpdateHelp() {
|
|
11
|
+
console.log(`${chalk.bold("Usage:")}
|
|
12
|
+
${APP_NAME} update [--self]
|
|
13
|
+
|
|
14
|
+
Reinstall the global ${NPM_CLI_PACKAGE} package from npm.
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
--self Same as \`${APP_NAME} update\` (kept for muscle memory)
|
|
18
|
+
-h, --help
|
|
19
|
+
|
|
20
|
+
This does not refresh model catalogs (/refresh) or extension packages (${APP_NAME} install).
|
|
21
|
+
`);
|
|
22
|
+
}
|
|
23
|
+
export async function handleUpdateCli(args, deps = {}) {
|
|
24
|
+
if (args[0] !== "update")
|
|
25
|
+
return false;
|
|
26
|
+
const rest = args.slice(1).filter((a) => a !== "--self");
|
|
27
|
+
if (rest.includes("-h") || rest.includes("--help")) {
|
|
28
|
+
printUpdateHelp();
|
|
29
|
+
process.exitCode = 0;
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
if (rest.length > 0) {
|
|
33
|
+
(deps.error ?? console.error)(`Unknown argument: ${rest[0]}`);
|
|
34
|
+
printUpdateHelp();
|
|
35
|
+
process.exitCode = 2;
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
const published = deps.published ?? isPublishedInstall();
|
|
39
|
+
if (!published) {
|
|
40
|
+
(deps.error ?? console.error)(`This tree is ${PACKAGE_NAME}, not a global ${NPM_CLI_PACKAGE} install. Use \`npm i -g ${NPM_CLI_PACKAGE}\` to update the published CLI; workspace \`npx ${APP_NAME}\` is not self-updated.`);
|
|
41
|
+
process.exitCode = 1;
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
const log = deps.log ?? console.log;
|
|
45
|
+
const error = deps.error ?? console.error;
|
|
46
|
+
const check = deps.check ?? checkForUpdate;
|
|
47
|
+
const result = await check({
|
|
48
|
+
currentVersion: deps.currentVersion ?? VERSION,
|
|
49
|
+
agentDir: getAgentDir(),
|
|
50
|
+
published: true,
|
|
51
|
+
offline: process.env.PI_OFFLINE === "1",
|
|
52
|
+
force: true,
|
|
53
|
+
});
|
|
54
|
+
if (!result) {
|
|
55
|
+
error("Could not reach the npm registry to check for updates.");
|
|
56
|
+
process.exitCode = 1;
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (!result.newer) {
|
|
60
|
+
log(`${APP_NAME} ${result.current} is up to date.`);
|
|
61
|
+
process.exitCode = 0;
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
const cwd = process.cwd();
|
|
65
|
+
const settings = SettingsManager.create(cwd, getAgentDir(), { projectTrusted: false });
|
|
66
|
+
const npmArgv = settings.getNpmCommand() ?? ["npm"];
|
|
67
|
+
const installArgv = [...npmArgv.slice(1), "install", "-g", `${NPM_CLI_PACKAGE}@${result.latest}`];
|
|
68
|
+
const command = npmArgv[0] ?? "npm";
|
|
69
|
+
const packageDir = deps.packageDir ?? getPackageDir();
|
|
70
|
+
(deps.warn ?? console.warn)(`Installing ${NPM_CLI_PACKAGE}@${result.latest}. If this process is the global install (${packageDir}), Windows may fail to overwrite files until lunr exits.`);
|
|
71
|
+
const spawn = deps.spawn ??
|
|
72
|
+
(async (cmd, argv) => {
|
|
73
|
+
const child = spawnProcess(cmd, argv, { stdio: "inherit" });
|
|
74
|
+
return waitForChildProcess(child);
|
|
75
|
+
});
|
|
76
|
+
const code = await spawn(command, installArgv);
|
|
77
|
+
process.exitCode = code === 0 || code === null ? 0 : code;
|
|
78
|
+
if ((process.exitCode ?? 0) === 0) {
|
|
79
|
+
log(`Updated ${APP_NAME} ${result.current} → ${result.latest}.`);
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=update-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-cli.js","sourceRoot":"","sources":["../../src/cli/update-cli.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * `lunr update` / `lunr update --self` — reinstall the published global CLI.\n * Workspace checkouts (this repo's npx lunr) refuse to self-update.\n */\n\nimport chalk from \"chalk\";\nimport { APP_NAME, getAgentDir, getPackageDir, NPM_CLI_PACKAGE, PACKAGE_NAME, VERSION } from \"../config.ts\";\nimport { SettingsManager } from \"../core/settings-manager.ts\";\nimport { checkForUpdate, isPublishedInstall } from \"../core/update-check.ts\";\nimport { spawnProcess, waitForChildProcess } from \"../utils/child-process.ts\";\n\nfunction printUpdateHelp(): void {\n\tconsole.log(`${chalk.bold(\"Usage:\")}\n ${APP_NAME} update [--self]\n\nReinstall the global ${NPM_CLI_PACKAGE} package from npm.\n\nOptions:\n --self Same as \\`${APP_NAME} update\\` (kept for muscle memory)\n -h, --help\n\nThis does not refresh model catalogs (/refresh) or extension packages (${APP_NAME} install).\n`);\n}\n\nexport async function handleUpdateCli(\n\targs: string[],\n\tdeps: {\n\t\tcheck?: typeof checkForUpdate;\n\t\tspawn?: (command: string, argv: string[]) => Promise<number | null>;\n\t\tpublished?: boolean;\n\t\tcurrentVersion?: string;\n\t\twarn?: (msg: string) => void;\n\t\tlog?: (msg: string) => void;\n\t\terror?: (msg: string) => void;\n\t\tpackageDir?: string;\n\t} = {},\n): Promise<boolean> {\n\tif (args[0] !== \"update\") return false;\n\n\tconst rest = args.slice(1).filter((a) => a !== \"--self\");\n\tif (rest.includes(\"-h\") || rest.includes(\"--help\")) {\n\t\tprintUpdateHelp();\n\t\tprocess.exitCode = 0;\n\t\treturn true;\n\t}\n\tif (rest.length > 0) {\n\t\t(deps.error ?? console.error)(`Unknown argument: ${rest[0]}`);\n\t\tprintUpdateHelp();\n\t\tprocess.exitCode = 2;\n\t\treturn true;\n\t}\n\n\tconst published = deps.published ?? isPublishedInstall();\n\tif (!published) {\n\t\t(deps.error ?? console.error)(\n\t\t\t`This tree is ${PACKAGE_NAME}, not a global ${NPM_CLI_PACKAGE} install. Use \\`npm i -g ${NPM_CLI_PACKAGE}\\` to update the published CLI; workspace \\`npx ${APP_NAME}\\` is not self-updated.`,\n\t\t);\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tconst log = deps.log ?? console.log;\n\tconst error = deps.error ?? console.error;\n\tconst check = deps.check ?? checkForUpdate;\n\tconst result = await check({\n\t\tcurrentVersion: deps.currentVersion ?? VERSION,\n\t\tagentDir: getAgentDir(),\n\t\tpublished: true,\n\t\toffline: process.env.PI_OFFLINE === \"1\",\n\t\tforce: true,\n\t});\n\tif (!result) {\n\t\terror(\"Could not reach the npm registry to check for updates.\");\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\tif (!result.newer) {\n\t\tlog(`${APP_NAME} ${result.current} is up to date.`);\n\t\tprocess.exitCode = 0;\n\t\treturn true;\n\t}\n\n\tconst cwd = process.cwd();\n\tconst settings = SettingsManager.create(cwd, getAgentDir(), { projectTrusted: false });\n\tconst npmArgv = settings.getNpmCommand() ?? [\"npm\"];\n\tconst installArgv = [...npmArgv.slice(1), \"install\", \"-g\", `${NPM_CLI_PACKAGE}@${result.latest}`];\n\tconst command = npmArgv[0] ?? \"npm\";\n\n\tconst packageDir = deps.packageDir ?? getPackageDir();\n\t(deps.warn ?? console.warn)(\n\t\t`Installing ${NPM_CLI_PACKAGE}@${result.latest}. If this process is the global install (${packageDir}), Windows may fail to overwrite files until lunr exits.`,\n\t);\n\n\tconst spawn =\n\t\tdeps.spawn ??\n\t\t(async (cmd: string, argv: string[]) => {\n\t\t\tconst child = spawnProcess(cmd, argv, { stdio: \"inherit\" });\n\t\t\treturn waitForChildProcess(child);\n\t\t});\n\n\tconst code = await spawn(command, installArgv);\n\tprocess.exitCode = code === 0 || code === null ? 0 : code;\n\tif ((process.exitCode ?? 0) === 0) {\n\t\tlog(`Updated ${APP_NAME} ${result.current} → ${result.latest}.`);\n\t}\n\treturn true;\n}\n"]}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\n/**\n * CLI entry point for the refactored coding agent.\n * Uses main.ts with AgentSession and new mode modules.\n *\n * Test with: npx tsx src/cli-new.ts [args...]\n */\nimport { enableCompileCache } from \"node:module\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\n// Enable before importing the rest of the graph so subsequent processes can\n// reuse V8 code cache. Helps the first start after a reboot when the OS page\n// cache is cold. Static imports are hoisted, so main is loaded dynamically.\ntry {\n\tconst agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), \".lunr\", \"agent\");\n\tenableCompileCache(join(agentDir, \"compile-cache\"));\n} catch {\n\t// Node < 22.8 or unwritable cache dir.\n}\n\nconst importStarted = Date.now();\nconst [{ APP_NAME }, { configureHttpDispatcher }, { main }, { noteImportMain }] = await Promise.all([\n\timport(\"./config.ts\"),\n\timport(\"./core/http-dispatcher.ts\"),\n\timport(\"./main.ts\"),\n\timport(\"./core/timings.ts\"),\n]);\nnoteImportMain(Date.now() - importStarted);\n\nprocess.title = APP_NAME;\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\n// Configure undici's global dispatcher before provider SDKs issue requests.\n// Runtime settings are applied once SettingsManager has loaded global/project settings.\nconfigureHttpDispatcher();\n\nawait main(process.argv.slice(2));\n"]}
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\n/**\n * CLI entry point for the refactored coding agent.\n * Uses main.ts with AgentSession and new mode modules.\n *\n * Test with: npx tsx src/cli-new.ts [args...]\n */\nimport { enableCompileCache } from \"node:module\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\n// lunr: set the process / tab title before the slow dynamic import of main.ts\n// so Windows Terminal does not sit on \"node\" during cold start.\nprocess.title = \"lunr\";\nif (process.stdout.isTTY) {\n\tprocess.stdout.write(\"\\x1b]0;lunr\\x07\");\n}\n\n// Enable before importing the rest of the graph so subsequent processes can\n// reuse V8 code cache. Helps the first start after a reboot when the OS page\n// cache is cold. Static imports are hoisted, so main is loaded dynamically.\ntry {\n\tconst agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), \".lunr\", \"agent\");\n\tenableCompileCache(join(agentDir, \"compile-cache\"));\n} catch {\n\t// Node < 22.8 or unwritable cache dir.\n}\n\nconst importStarted = Date.now();\nconst [{ APP_NAME }, { configureHttpDispatcher }, { main }, { noteImportMain }] = await Promise.all([\n\timport(\"./config.ts\"),\n\timport(\"./core/http-dispatcher.ts\"),\n\timport(\"./main.ts\"),\n\timport(\"./core/timings.ts\"),\n]);\nnoteImportMain(Date.now() - importStarted);\n\nprocess.title = APP_NAME;\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\n// Configure undici's global dispatcher before provider SDKs issue requests.\n// Runtime settings are applied once SettingsManager has loaded global/project settings.\nconfigureHttpDispatcher();\n\nawait main(process.argv.slice(2));\n"]}
|
package/dist/cli.js
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
import { enableCompileCache } from "node:module";
|
|
9
9
|
import { homedir } from "node:os";
|
|
10
10
|
import { join } from "node:path";
|
|
11
|
+
// lunr: set the process / tab title before the slow dynamic import of main.ts
|
|
12
|
+
// so Windows Terminal does not sit on "node" during cold start.
|
|
13
|
+
process.title = "lunr";
|
|
14
|
+
if (process.stdout.isTTY) {
|
|
15
|
+
process.stdout.write("\x1b]0;lunr\x07");
|
|
16
|
+
}
|
|
11
17
|
// Enable before importing the rest of the graph so subsequent processes can
|
|
12
18
|
// reuse V8 code cache. Helps the first start after a reboot when the OS page
|
|
13
19
|
// cache is cold. Static imports are hoisted, so main is loaded dynamically.
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,IAAI,CAAC;IACJ,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9F,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;AACrD,CAAC;AAAC,MAAM,CAAC;IACR,uCAAuC;AACxC,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,uBAAuB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;IACnG,MAAM,CAAC,aAAa,CAAC;IACrB,MAAM,CAAC,2BAA2B,CAAC;IACnC,MAAM,CAAC,WAAW,CAAC;IACnB,MAAM,CAAC,mBAAmB,CAAC;CAC3B,CAAC,CAAC;AACH,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC,CAAC;AAE3C,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;AACzB,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC;AACrC,OAAO,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,CAAC,EAAC,CAAC,CAA+B,CAAC;AAE/D,4EAA4E;AAC5E,wFAAwF;AACxF,uBAAuB,EAAE,CAAC;AAE1B,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * CLI entry point for the refactored coding agent.\n * Uses main.ts with AgentSession and new mode modules.\n *\n * Test with: npx tsx src/cli-new.ts [args...]\n */\nimport { enableCompileCache } from \"node:module\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\n// Enable before importing the rest of the graph so subsequent processes can\n// reuse V8 code cache. Helps the first start after a reboot when the OS page\n// cache is cold. Static imports are hoisted, so main is loaded dynamically.\ntry {\n\tconst agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), \".lunr\", \"agent\");\n\tenableCompileCache(join(agentDir, \"compile-cache\"));\n} catch {\n\t// Node < 22.8 or unwritable cache dir.\n}\n\nconst importStarted = Date.now();\nconst [{ APP_NAME }, { configureHttpDispatcher }, { main }, { noteImportMain }] = await Promise.all([\n\timport(\"./config.ts\"),\n\timport(\"./core/http-dispatcher.ts\"),\n\timport(\"./main.ts\"),\n\timport(\"./core/timings.ts\"),\n]);\nnoteImportMain(Date.now() - importStarted);\n\nprocess.title = APP_NAME;\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\n// Configure undici's global dispatcher before provider SDKs issue requests.\n// Runtime settings are applied once SettingsManager has loaded global/project settings.\nconfigureHttpDispatcher();\n\nawait main(process.argv.slice(2));\n"]}
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,8EAA8E;AAC9E,gEAAgE;AAChE,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC;AACvB,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACzC,CAAC;AAED,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,IAAI,CAAC;IACJ,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9F,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;AACrD,CAAC;AAAC,MAAM,CAAC;IACR,uCAAuC;AACxC,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,uBAAuB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;IACnG,MAAM,CAAC,aAAa,CAAC;IACrB,MAAM,CAAC,2BAA2B,CAAC;IACnC,MAAM,CAAC,WAAW,CAAC;IACnB,MAAM,CAAC,mBAAmB,CAAC;CAC3B,CAAC,CAAC;AACH,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC,CAAC;AAE3C,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;AACzB,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC;AACrC,OAAO,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,CAAC,EAAC,CAAC,CAA+B,CAAC;AAE/D,4EAA4E;AAC5E,wFAAwF;AACxF,uBAAuB,EAAE,CAAC;AAE1B,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * CLI entry point for the refactored coding agent.\n * Uses main.ts with AgentSession and new mode modules.\n *\n * Test with: npx tsx src/cli-new.ts [args...]\n */\nimport { enableCompileCache } from \"node:module\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\n// lunr: set the process / tab title before the slow dynamic import of main.ts\n// so Windows Terminal does not sit on \"node\" during cold start.\nprocess.title = \"lunr\";\nif (process.stdout.isTTY) {\n\tprocess.stdout.write(\"\\x1b]0;lunr\\x07\");\n}\n\n// Enable before importing the rest of the graph so subsequent processes can\n// reuse V8 code cache. Helps the first start after a reboot when the OS page\n// cache is cold. Static imports are hoisted, so main is loaded dynamically.\ntry {\n\tconst agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), \".lunr\", \"agent\");\n\tenableCompileCache(join(agentDir, \"compile-cache\"));\n} catch {\n\t// Node < 22.8 or unwritable cache dir.\n}\n\nconst importStarted = Date.now();\nconst [{ APP_NAME }, { configureHttpDispatcher }, { main }, { noteImportMain }] = await Promise.all([\n\timport(\"./config.ts\"),\n\timport(\"./core/http-dispatcher.ts\"),\n\timport(\"./main.ts\"),\n\timport(\"./core/timings.ts\"),\n]);\nnoteImportMain(Date.now() - importStarted);\n\nprocess.title = APP_NAME;\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\n// Configure undici's global dispatcher before provider SDKs issue requests.\n// Runtime settings are applied once SettingsManager has loaded global/project settings.\nconfigureHttpDispatcher();\n\nawait main(process.argv.slice(2));\n"]}
|
|
@@ -611,6 +611,7 @@ export declare class AgentSession {
|
|
|
611
611
|
label?: string;
|
|
612
612
|
}): Promise<{
|
|
613
613
|
editorText?: string;
|
|
614
|
+
editorImages?: ImageContent[];
|
|
614
615
|
cancelled: boolean;
|
|
615
616
|
aborted?: boolean;
|
|
616
617
|
summaryEntry?: BranchSummaryEntry;
|
|
@@ -623,6 +624,7 @@ export declare class AgentSession {
|
|
|
623
624
|
text: string;
|
|
624
625
|
}>;
|
|
625
626
|
private _extractUserMessageText;
|
|
627
|
+
private _extractUserMessageImages;
|
|
626
628
|
/**
|
|
627
629
|
* Get session statistics. Aggregates over ALL session entries (including
|
|
628
630
|
* history that was compacted away), so token/cost totals reflect what was
|