@oh-my-pi/pi-coding-agent 15.10.9 → 15.10.11
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 +117 -0
- package/dist/cli.js +23087 -0
- package/dist/tokenizers.linux-x64-gnu-xcjh3jwk.node +0 -0
- package/dist/types/async/job-manager.d.ts +18 -0
- package/dist/types/cli/args.d.ts +1 -1
- package/dist/types/cli/dry-balance-cli.d.ts +1 -1
- package/dist/types/cli/gallery-cli.d.ts +1 -1
- package/dist/types/cli/gallery-fixtures/types.d.ts +1 -1
- package/dist/types/cli/usage-cli.d.ts +72 -0
- package/dist/types/commands/launch.d.ts +1 -1
- package/dist/types/commands/read.d.ts +1 -1
- package/dist/types/commands/usage.d.ts +25 -0
- package/dist/types/config/append-only-context-mode.d.ts +2 -1
- package/dist/types/config/model-discovery.d.ts +55 -0
- package/dist/types/config/model-registry.d.ts +20 -219
- package/dist/types/config/model-resolver.d.ts +16 -10
- package/dist/types/config/model-roles.d.ts +28 -0
- package/dist/types/config/models-config-schema.d.ts +523 -42
- package/dist/types/config/models-config.d.ts +385 -0
- package/dist/types/config/settings-schema.d.ts +12 -16
- package/dist/types/config/settings.d.ts +1 -1
- package/dist/types/debug/log-viewer.d.ts +1 -1
- package/dist/types/debug/raw-sse.d.ts +1 -1
- package/dist/types/debug/terminal-info.d.ts +0 -1
- package/dist/types/eval/backend.d.ts +0 -2
- package/dist/types/eval/idle-timeout.d.ts +0 -4
- package/dist/types/eval/js/shared/rewrite-imports.d.ts +6 -6
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/extensibility/extensions/types.d.ts +3 -3
- package/dist/types/hindsight/mental-models.d.ts +17 -8
- package/dist/types/internal-urls/artifact-protocol.d.ts +2 -2
- package/dist/types/internal-urls/types.d.ts +1 -1
- package/dist/types/lsp/edits.d.ts +9 -0
- package/dist/types/lsp/index.d.ts +2 -2
- package/dist/types/lsp/types.d.ts +2 -0
- package/dist/types/lsp/utils.d.ts +3 -0
- package/dist/types/mcp/json-rpc.d.ts +5 -0
- package/dist/types/mnemopi/state.d.ts +11 -1
- package/dist/types/modes/components/agent-dashboard.d.ts +1 -1
- package/dist/types/modes/components/assistant-message.d.ts +3 -1
- package/dist/types/modes/components/bash-execution.d.ts +1 -1
- package/dist/types/modes/components/copy-selector.d.ts +1 -1
- package/dist/types/modes/components/dynamic-border.d.ts +1 -1
- package/dist/types/modes/components/extensions/extension-dashboard.d.ts +1 -1
- package/dist/types/modes/components/extensions/extension-list.d.ts +1 -1
- package/dist/types/modes/components/extensions/inspector-panel.d.ts +1 -1
- package/dist/types/modes/components/footer.d.ts +1 -1
- package/dist/types/modes/components/hook-editor.d.ts +5 -0
- package/dist/types/modes/components/hook-input.d.ts +4 -0
- package/dist/types/modes/components/hook-selector.d.ts +1 -1
- package/dist/types/modes/components/model-selector.d.ts +1 -1
- package/dist/types/modes/components/plan-review-overlay.d.ts +1 -1
- package/dist/types/modes/components/session-observer-overlay.d.ts +1 -1
- package/dist/types/modes/components/session-selector.d.ts +1 -1
- package/dist/types/modes/components/status-line/component.d.ts +1 -1
- package/dist/types/modes/components/tiny-title-download-progress.d.ts +1 -1
- package/dist/types/modes/components/transcript-container.d.ts +31 -26
- package/dist/types/modes/components/tree-selector.d.ts +1 -1
- package/dist/types/modes/components/user-message-selector.d.ts +1 -1
- package/dist/types/modes/components/user-message.d.ts +2 -1
- package/dist/types/modes/components/visual-truncate.d.ts +1 -1
- package/dist/types/modes/components/welcome.d.ts +19 -3
- package/dist/types/modes/controllers/mcp-command-controller.d.ts +1 -1
- package/dist/types/modes/controllers/streaming-reveal.d.ts +1 -1
- package/dist/types/modes/interactive-mode.d.ts +1 -1
- package/dist/types/modes/setup-wizard/scenes/sign-in.d.ts +1 -1
- package/dist/types/modes/setup-wizard/scenes/types.d.ts +1 -1
- package/dist/types/modes/setup-wizard/scenes/web-search.d.ts +1 -1
- package/dist/types/modes/setup-wizard/wizard-overlay.d.ts +1 -1
- package/dist/types/modes/types.d.ts +2 -1
- package/dist/types/session/agent-session.d.ts +1 -1
- package/dist/types/session/auth-broker-config.d.ts +4 -0
- package/dist/types/session/session-manager.d.ts +1 -1
- package/dist/types/slash-commands/helpers/stats-dashboard.d.ts +13 -0
- package/dist/types/ssh/connection-manager.d.ts +8 -0
- package/dist/types/task/discovery.d.ts +1 -2
- package/dist/types/task/parallel.d.ts +2 -2
- package/dist/types/task/worktree.d.ts +2 -0
- package/dist/types/tiny/title-client.d.ts +1 -1
- package/dist/types/tools/ask.d.ts +4 -0
- package/dist/types/tools/conflict-detect.d.ts +16 -0
- package/dist/types/tools/github-cache.d.ts +7 -0
- package/dist/types/tools/sqlite-reader.d.ts +3 -0
- package/dist/types/tools/todo.d.ts +2 -0
- package/dist/types/tui/output-block.d.ts +3 -3
- package/dist/types/utils/changelog.d.ts +8 -0
- package/dist/types/web/scrapers/readthedocs.d.ts +3 -0
- package/dist/types/web/scrapers/types.d.ts +12 -0
- package/dist/types/web/search/providers/codex.d.ts +1 -1
- package/dist/types/web/search/providers/gemini.d.ts +1 -1
- package/examples/extensions/tools.ts +5 -4
- package/package.json +14 -11
- package/scripts/build-binary.ts +18 -23
- package/scripts/bundle-dist.ts +81 -0
- package/scripts/{dev-launch → omp} +1 -1
- package/scripts/{dev-launch-preload.ts → omp.ts} +1 -1
- package/src/async/job-manager.ts +57 -3
- package/src/autoresearch/dashboard.ts +1 -1
- package/src/autoresearch/prompt-setup.md +6 -6
- package/src/autoresearch/prompt.md +6 -6
- package/src/capability/fs.ts +10 -0
- package/src/cli/args.ts +1 -1
- package/src/cli/auth-gateway-cli.ts +1 -3
- package/src/cli/dry-balance-cli.ts +1 -1
- package/src/cli/gallery-cli.ts +1 -1
- package/src/cli/gallery-fixtures/fs.ts +1 -1
- package/src/cli/gallery-fixtures/types.ts +5 -1
- package/src/cli/list-models.ts +7 -12
- package/src/cli/usage-cli.ts +603 -0
- package/src/cli-commands.ts +1 -0
- package/src/cli.ts +69 -5
- package/src/commands/complete.ts +1 -1
- package/src/commands/launch.ts +1 -1
- package/src/commands/read.ts +6 -3
- package/src/commands/usage.ts +35 -0
- package/src/commit/agentic/agent.ts +1 -1
- package/src/commit/model-selection.ts +1 -1
- package/src/config/append-only-context-mode.ts +6 -12
- package/src/config/model-discovery.ts +554 -0
- package/src/config/model-registry.ts +308 -1025
- package/src/config/model-resolver.ts +113 -156
- package/src/config/model-roles.ts +74 -0
- package/src/config/models-config-schema.ts +57 -8
- package/src/config/models-config.ts +129 -0
- package/src/config/settings-schema.ts +18 -14
- package/src/config/settings.ts +37 -1
- package/src/dap/client.ts +124 -37
- package/src/dap/session.ts +259 -158
- package/src/debug/log-viewer.ts +1 -1
- package/src/debug/raw-sse.ts +1 -1
- package/src/debug/terminal-info.ts +0 -3
- package/src/edit/diff.ts +95 -18
- package/src/edit/hashline/block-resolver.ts +20 -1
- package/src/edit/hashline/diff.ts +36 -1
- package/src/edit/hashline/execute.ts +8 -2
- package/src/edit/index.ts +16 -1
- package/src/edit/modes/patch.ts +52 -0
- package/src/edit/modes/replace.ts +56 -22
- package/src/edit/notebook.ts +22 -2
- package/src/edit/renderer.ts +36 -10
- package/src/eval/__tests__/completion-bridge.test.ts +1 -1
- package/src/eval/backend.ts +0 -2
- package/src/eval/completion-bridge.ts +2 -1
- package/src/eval/idle-timeout.ts +2 -9
- package/src/eval/js/context-manager.ts +6 -8
- package/src/eval/js/executor.ts +6 -2
- package/src/eval/js/index.ts +0 -2
- package/src/eval/js/shared/helpers.ts +5 -6
- package/src/eval/js/shared/local-module-loader.ts +1 -1
- package/src/eval/js/shared/prelude.txt +62 -1
- package/src/eval/js/shared/rewrite-imports.ts +49 -23
- package/src/eval/js/shared/runtime.ts +1 -1
- package/src/eval/py/index.ts +0 -2
- package/src/eval/py/kernel.ts +19 -0
- package/src/eval/py/runner.py +107 -3
- package/src/exec/bash-executor.ts +3 -1
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +3 -1
- package/src/extensibility/extensions/types.ts +3 -2
- package/src/extensibility/plugins/legacy-pi-compat.ts +20 -3
- package/src/hindsight/mental-models.ts +59 -12
- package/src/hindsight/state.ts +6 -1
- package/src/internal-urls/artifact-protocol.ts +11 -2
- package/src/internal-urls/docs-index.generated.ts +10 -10
- package/src/internal-urls/issue-pr-protocol.ts +12 -5
- package/src/internal-urls/router.ts +1 -1
- package/src/internal-urls/types.ts +1 -1
- package/src/lib/xai-http.ts +1 -1
- package/src/lsp/client.ts +118 -38
- package/src/lsp/clients/biome-client.ts +101 -39
- package/src/lsp/edits.ts +143 -95
- package/src/lsp/index.ts +31 -22
- package/src/lsp/render.ts +1 -1
- package/src/lsp/types.ts +2 -0
- package/src/lsp/utils.ts +28 -10
- package/src/main.ts +165 -17
- package/src/mcp/json-rpc.ts +35 -5
- package/src/mcp/transports/stdio.ts +7 -1
- package/src/memories/index.ts +2 -1
- package/src/mnemopi/backend.ts +25 -3
- package/src/mnemopi/state.ts +38 -2
- package/src/modes/components/agent-dashboard.ts +10 -7
- package/src/modes/components/assistant-message.ts +19 -13
- package/src/modes/components/bash-execution.ts +1 -1
- package/src/modes/components/copy-selector.ts +1 -1
- package/src/modes/components/diff.ts +13 -2
- package/src/modes/components/dynamic-border.ts +12 -3
- package/src/modes/components/extensions/extension-dashboard.ts +8 -5
- package/src/modes/components/extensions/extension-list.ts +1 -1
- package/src/modes/components/extensions/inspector-panel.ts +1 -1
- package/src/modes/components/footer.ts +1 -1
- package/src/modes/components/history-search.ts +1 -1
- package/src/modes/components/hook-editor.ts +8 -0
- package/src/modes/components/hook-input.ts +8 -0
- package/src/modes/components/hook-selector.ts +2 -2
- package/src/modes/components/model-selector.ts +66 -54
- package/src/modes/components/plan-review-overlay.ts +1 -1
- package/src/modes/components/session-observer-overlay.ts +2 -2
- package/src/modes/components/session-selector.ts +1 -1
- package/src/modes/components/settings-selector.ts +5 -1
- package/src/modes/components/status-line/component.ts +1 -1
- package/src/modes/components/tiny-title-download-progress.ts +1 -1
- package/src/modes/components/transcript-container.ts +373 -141
- package/src/modes/components/tree-selector.ts +3 -3
- package/src/modes/components/user-message-selector.ts +1 -1
- package/src/modes/components/user-message.ts +17 -5
- package/src/modes/components/visual-truncate.ts +1 -1
- package/src/modes/components/welcome.ts +108 -26
- package/src/modes/controllers/command-controller.ts +10 -3
- package/src/modes/controllers/event-controller.ts +73 -49
- package/src/modes/controllers/input-controller.ts +5 -5
- package/src/modes/controllers/mcp-command-controller.ts +1 -1
- package/src/modes/controllers/selector-controller.ts +1 -5
- package/src/modes/controllers/streaming-reveal.ts +85 -18
- package/src/modes/interactive-mode.ts +5 -19
- package/src/modes/setup-wizard/scenes/glyph.ts +1 -1
- package/src/modes/setup-wizard/scenes/providers.ts +1 -1
- package/src/modes/setup-wizard/scenes/sign-in.ts +1 -1
- package/src/modes/setup-wizard/scenes/theme.ts +1 -1
- package/src/modes/setup-wizard/scenes/types.ts +1 -1
- package/src/modes/setup-wizard/scenes/web-search.ts +1 -1
- package/src/modes/setup-wizard/wizard-overlay.ts +1 -1
- package/src/modes/types.ts +2 -1
- package/src/prompts/agents/explore.md +2 -2
- package/src/prompts/agents/librarian.md +1 -2
- package/src/prompts/agents/oracle.md +1 -1
- package/src/prompts/agents/plan.md +5 -5
- package/src/prompts/agents/task.md +5 -5
- package/src/prompts/ci-green-request.md +5 -7
- package/src/prompts/goals/goal-budget-limit.md +2 -2
- package/src/prompts/goals/goal-continuation.md +4 -4
- package/src/prompts/goals/goal-mode-active.md +1 -1
- package/src/prompts/memories/read-path.md +1 -1
- package/src/prompts/memories/stage_one_system.md +2 -2
- package/src/prompts/review-custom-request.md +1 -1
- package/src/prompts/system/agent-creation-architect.md +2 -2
- package/src/prompts/system/auto-continue.md +1 -1
- package/src/prompts/system/background-tan-dispatch.md +1 -1
- package/src/prompts/system/btw-user.md +2 -2
- package/src/prompts/system/commit-message-system.md +13 -1
- package/src/prompts/system/custom-system-prompt.md +1 -1
- package/src/prompts/system/eager-todo.md +2 -2
- package/src/prompts/system/irc-incoming.md +1 -1
- package/src/prompts/system/manual-continue.md +1 -1
- package/src/prompts/system/omfg-user.md +3 -4
- package/src/prompts/system/orchestrate-notice.md +9 -9
- package/src/prompts/system/plan-mode-active.md +4 -4
- package/src/prompts/system/plan-mode-subagent.md +4 -5
- package/src/prompts/system/plan-mode-tool-decision-reminder.md +1 -1
- package/src/prompts/system/project-prompt.md +2 -2
- package/src/prompts/system/subagent-system-prompt.md +4 -4
- package/src/prompts/system/system-prompt.md +15 -26
- package/src/prompts/system/title-system.md +2 -2
- package/src/prompts/system/ttsr-tool-reminder.md +1 -1
- package/src/prompts/system/workflow-notice.md +1 -1
- package/src/prompts/tools/ast-edit.md +1 -1
- package/src/prompts/tools/ast-grep.md +2 -2
- package/src/prompts/tools/bash.md +8 -10
- package/src/prompts/tools/browser.md +7 -7
- package/src/prompts/tools/debug.md +1 -1
- package/src/prompts/tools/eval.md +3 -3
- package/src/prompts/tools/find.md +0 -1
- package/src/prompts/tools/github.md +8 -7
- package/src/prompts/tools/goal.md +1 -1
- package/src/prompts/tools/image-gen.md +1 -1
- package/src/prompts/tools/inspect-image-system.md +1 -1
- package/src/prompts/tools/irc.md +15 -15
- package/src/prompts/tools/lsp.md +2 -2
- package/src/prompts/tools/patch.md +2 -2
- package/src/prompts/tools/read.md +3 -4
- package/src/prompts/tools/recall.md +1 -1
- package/src/prompts/tools/reflect.md +1 -1
- package/src/prompts/tools/render-mermaid.md +2 -2
- package/src/prompts/tools/replace.md +4 -10
- package/src/prompts/tools/rewind.md +2 -2
- package/src/prompts/tools/search-tool-bm25.md +1 -9
- package/src/prompts/tools/search.md +0 -1
- package/src/prompts/tools/ssh.md +0 -4
- package/src/prompts/tools/task.md +2 -3
- package/src/prompts/tools/todo.md +6 -2
- package/src/sdk.ts +23 -10
- package/src/session/agent-session.ts +44 -10
- package/src/session/auth-broker-config.ts +30 -1
- package/src/session/session-manager.ts +2 -2
- package/src/session/streaming-output.ts +23 -2
- package/src/slash-commands/builtin-registry.ts +20 -0
- package/src/slash-commands/helpers/stats-dashboard.ts +85 -0
- package/src/ssh/connection-manager.ts +27 -0
- package/src/task/commands.ts +2 -1
- package/src/task/discovery.ts +17 -24
- package/src/task/executor.ts +61 -53
- package/src/task/index.ts +137 -60
- package/src/task/parallel.ts +3 -3
- package/src/task/render.ts +2 -2
- package/src/task/worktree.ts +64 -56
- package/src/thinking.ts +2 -1
- package/src/tiny/title-client.ts +32 -14
- package/src/tools/archive-reader.ts +30 -2
- package/src/tools/ask.ts +104 -21
- package/src/tools/ast-edit.ts +25 -5
- package/src/tools/auto-generated-guard.ts +20 -3
- package/src/tools/bash-interactive.ts +27 -7
- package/src/tools/bash.ts +54 -13
- package/src/tools/browser/launch.ts +11 -2
- package/src/tools/browser/readable.ts +19 -2
- package/src/tools/browser/registry.ts +4 -1
- package/src/tools/browser/render.ts +2 -2
- package/src/tools/browser/tab-supervisor.ts +55 -16
- package/src/tools/conflict-detect.ts +50 -4
- package/src/tools/debug.ts +1 -1
- package/src/tools/eval-render.ts +5 -5
- package/src/tools/eval.ts +0 -2
- package/src/tools/fetch.ts +33 -10
- package/src/tools/gh-cache-invalidation.ts +63 -8
- package/src/tools/gh-renderer.ts +1 -1
- package/src/tools/gh.ts +172 -29
- package/src/tools/github-cache.ts +70 -6
- package/src/tools/image-gen.ts +3 -9
- package/src/tools/irc.ts +5 -1
- package/src/tools/job.ts +1 -1
- package/src/tools/read.ts +202 -61
- package/src/tools/render-utils.ts +3 -3
- package/src/tools/resolve.ts +1 -1
- package/src/tools/search.ts +92 -29
- package/src/tools/sqlite-reader.ts +17 -5
- package/src/tools/ssh.ts +8 -8
- package/src/tools/todo.ts +51 -12
- package/src/tools/write.ts +118 -18
- package/src/tui/output-block.ts +4 -4
- package/src/utils/changelog.ts +27 -1
- package/src/utils/file-mentions.ts +2 -1
- package/src/web/scrapers/arxiv.ts +1 -1
- package/src/web/scrapers/go-pkg.ts +1 -1
- package/src/web/scrapers/iacr.ts +1 -1
- package/src/web/scrapers/readthedocs.ts +1 -1
- package/src/web/scrapers/twitter.ts +2 -1
- package/src/web/scrapers/types.ts +87 -8
- package/src/web/scrapers/wikipedia.ts +1 -1
- package/src/web/scrapers/youtube.ts +6 -1
- package/src/web/search/index.ts +1 -1
- package/src/web/search/providers/anthropic.ts +8 -2
- package/src/web/search/providers/codex.ts +2 -1
- package/src/web/search/providers/gemini.ts +2 -3
- package/src/web/search/render.ts +8 -6
- package/dist/types/config/model-equivalence.d.ts +0 -24
- package/dist/types/config/model-id-affixes.d.ts +0 -12
- package/dist/types/config/model-provider-priority.d.ts +0 -1
- package/dist/types/exec/idle-timeout-watchdog.d.ts +0 -18
- package/src/config/model-equivalence.ts +0 -875
- package/src/config/model-id-affixes.ts +0 -81
- package/src/config/model-provider-priority.ts +0 -56
- package/src/exec/idle-timeout-watchdog.ts +0 -126
package/src/cli.ts
CHANGED
|
@@ -14,9 +14,9 @@ try {
|
|
|
14
14
|
* CLI entry point — registers all commands explicitly and delegates to the
|
|
15
15
|
* lightweight CLI runner from pi-utils.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import type { CliConfig } from "@oh-my-pi/pi-utils/cli";
|
|
18
18
|
import { APP_NAME, MIN_BUN_VERSION, VERSION } from "@oh-my-pi/pi-utils/dirs";
|
|
19
|
-
import {
|
|
19
|
+
import { declareWorkerHostEntry } from "@oh-my-pi/pi-utils/env";
|
|
20
20
|
|
|
21
21
|
if (Bun.semver.order(Bun.version, MIN_BUN_VERSION) < 0) {
|
|
22
22
|
process.stderr.write(
|
|
@@ -27,6 +27,12 @@ if (Bun.semver.order(Bun.version, MIN_BUN_VERSION) < 0) {
|
|
|
27
27
|
|
|
28
28
|
process.title = APP_NAME;
|
|
29
29
|
|
|
30
|
+
// Declare this module as the worker-host entry: Worker threads and worker
|
|
31
|
+
// subprocesses re-enter `Bun.main` with a hidden argv selector instead of
|
|
32
|
+
// loading separate worker entrypoints (single-entry contract across source,
|
|
33
|
+
// npm bundle, and compiled binary).
|
|
34
|
+
declareWorkerHostEntry();
|
|
35
|
+
|
|
30
36
|
async function showHelp(config: CliConfig): Promise<void> {
|
|
31
37
|
const { renderRootHelp } = await import("@oh-my-pi/pi-utils/cli");
|
|
32
38
|
const { getExtraHelpText } = await import("./cli/args");
|
|
@@ -54,6 +60,45 @@ async function runSmokeTest(): Promise<void> {
|
|
|
54
60
|
process.stdout.write("smoke-test: ok\n");
|
|
55
61
|
}
|
|
56
62
|
|
|
63
|
+
const TINY_WORKER_ARGS = new Set(["--tiny-worker", "__tiny_worker"]);
|
|
64
|
+
const STATS_SYNC_WORKER_ARG = "__omp_stats_sync_worker";
|
|
65
|
+
const TAB_WORKER_ARG = "__omp_tab_worker";
|
|
66
|
+
const JS_EVAL_WORKER_ARG = "__omp_js_eval_worker";
|
|
67
|
+
|
|
68
|
+
async function runWorkerEntrypoint(arg: string | undefined): Promise<boolean> {
|
|
69
|
+
if (arg === STATS_SYNC_WORKER_ARG) {
|
|
70
|
+
// The sync worker handles messages via `self.onmessage`, assigned during
|
|
71
|
+
// this *async* dynamic import. Bun flushes the worker's initial message
|
|
72
|
+
// buffer when the entry module's top-level evaluation finishes — before
|
|
73
|
+
// this dispatch completes — so anything the parent posted right after
|
|
74
|
+
// spawning (the smoke ping, the first parse request) would be dropped.
|
|
75
|
+
// Park early events and replay them once the module's handler is live.
|
|
76
|
+
// (The tab/eval workers are immune: `parentPort.on("message")` queues
|
|
77
|
+
// until a listener attaches.)
|
|
78
|
+
const scope = globalThis as unknown as { onmessage: ((event: MessageEvent) => void) | null };
|
|
79
|
+
const pending: MessageEvent[] = [];
|
|
80
|
+
const buffer = (event: MessageEvent): void => {
|
|
81
|
+
pending.push(event);
|
|
82
|
+
};
|
|
83
|
+
scope.onmessage = buffer;
|
|
84
|
+
await import("@oh-my-pi/omp-stats/sync-worker");
|
|
85
|
+
const handler = scope.onmessage;
|
|
86
|
+
if (handler && handler !== buffer) {
|
|
87
|
+
for (const event of pending) handler.call(scope, event);
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
if (arg === TAB_WORKER_ARG) {
|
|
92
|
+
await import("./tools/browser/tab-worker-entry");
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
if (arg === JS_EVAL_WORKER_ARG) {
|
|
96
|
+
await import("./eval/js/worker-entry");
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
57
102
|
/**
|
|
58
103
|
* Hidden subcommand that boots the tiny-model worker inside this process
|
|
59
104
|
* over the parent's IPC channel. The agent's main process spawns the same
|
|
@@ -90,11 +135,16 @@ async function runTinyWorker(): Promise<void> {
|
|
|
90
135
|
};
|
|
91
136
|
},
|
|
92
137
|
});
|
|
138
|
+
const keepalive = setInterval(() => {}, 2 ** 30);
|
|
93
139
|
// Parent went away (crashed, SIGKILL, etc.) — commit suicide so we don't
|
|
94
140
|
// linger as an orphan. SIGKILL via `process.kill` keeps us symmetrical
|
|
95
141
|
// with the parent's hard-kill on shutdown: skip every JS/native finalizer.
|
|
96
142
|
process.on("disconnect", () => shutdown());
|
|
97
|
-
|
|
143
|
+
try {
|
|
144
|
+
await shuttingDown;
|
|
145
|
+
} finally {
|
|
146
|
+
clearInterval(keepalive);
|
|
147
|
+
}
|
|
98
148
|
process.kill(process.pid, "SIGKILL");
|
|
99
149
|
}
|
|
100
150
|
|
|
@@ -104,10 +154,17 @@ export async function runCli(argv: string[]): Promise<void> {
|
|
|
104
154
|
await runSmokeTest();
|
|
105
155
|
return;
|
|
106
156
|
}
|
|
107
|
-
if (argv[0]
|
|
157
|
+
if (TINY_WORKER_ARGS.has(argv[0] ?? "")) {
|
|
108
158
|
await runTinyWorker();
|
|
109
159
|
return;
|
|
110
160
|
}
|
|
161
|
+
if (await runWorkerEntrypoint(argv[0])) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const [{ run }, { commands, isSubcommand }] = await Promise.all([
|
|
165
|
+
import("@oh-my-pi/pi-utils/cli"),
|
|
166
|
+
import("./cli-commands"),
|
|
167
|
+
]);
|
|
111
168
|
// --help and --version are handled by run() directly, don't rewrite those.
|
|
112
169
|
// Everything else that isn't a known subcommand routes to "launch".
|
|
113
170
|
const first = argv[0];
|
|
@@ -120,4 +177,11 @@ export async function runCli(argv: string[]): Promise<void> {
|
|
|
120
177
|
return run({ bin: APP_NAME, version: VERSION, argv: runArgv, commands, help: showHelp });
|
|
121
178
|
}
|
|
122
179
|
|
|
123
|
-
await
|
|
180
|
+
// Floating call instead of top-level await: TLA forces `--bytecode` (CJS
|
|
181
|
+
// lowering) builds to fail, and the entrypoint needs nothing after this.
|
|
182
|
+
// The catch mirrors what an unhandled TLA rejection produced: error dump to
|
|
183
|
+
// stderr, exit code 1. Success paths resolve without touching the exit code.
|
|
184
|
+
runCli(process.argv.slice(2)).catch((err: unknown) => {
|
|
185
|
+
process.stderr.write(`${Bun.inspect(err, { colors: process.stderr.isTTY === true })}\n`);
|
|
186
|
+
process.exit(1);
|
|
187
|
+
});
|
package/src/commands/complete.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* first field. The import surface is kept deliberately narrow so a TAB press
|
|
9
9
|
* doesn't pay for the full agent boot.
|
|
10
10
|
*/
|
|
11
|
-
import { type GeneratedProvider, getBundledModels, getBundledProviders } from "@oh-my-pi/pi-
|
|
11
|
+
import { type GeneratedProvider, getBundledModels, getBundledProviders } from "@oh-my-pi/pi-catalog/models";
|
|
12
12
|
import { Command } from "@oh-my-pi/pi-utils/cli";
|
|
13
13
|
import { SessionManager } from "../session/session-manager";
|
|
14
14
|
|
package/src/commands/launch.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Root command for the coding agent CLI.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { THINKING_EFFORTS } from "@oh-my-pi/pi-
|
|
5
|
+
import { THINKING_EFFORTS } from "@oh-my-pi/pi-catalog/effort";
|
|
6
6
|
import { APP_NAME } from "@oh-my-pi/pi-utils";
|
|
7
7
|
import { Args, Command, Flags } from "@oh-my-pi/pi-utils/cli";
|
|
8
8
|
import { parseArgs } from "../cli/args";
|
package/src/commands/read.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Show what the read tool will return for a
|
|
2
|
+
* Show what the read tool will return for a path, URL, or internal URI.
|
|
3
3
|
*/
|
|
4
4
|
import { Args, Command } from "@oh-my-pi/pi-utils/cli";
|
|
5
5
|
import { type ReadCommandArgs, runReadCommand } from "../cli/read-cli";
|
|
6
6
|
import { initTheme } from "../modes/theme/theme";
|
|
7
7
|
|
|
8
8
|
export default class Read extends Command {
|
|
9
|
-
static description = "Show what the read tool will return for a path or
|
|
9
|
+
static description = "Show what the read tool will return for a path, URL, or internal URI";
|
|
10
10
|
|
|
11
11
|
static args = {
|
|
12
12
|
path: Args.string({
|
|
13
|
-
description:
|
|
13
|
+
description:
|
|
14
|
+
"Path, URL, or internal URI to read (append :sel for line ranges or raw mode, e.g. src/foo.ts:50-100)",
|
|
14
15
|
required: true,
|
|
15
16
|
}),
|
|
16
17
|
};
|
|
@@ -20,6 +21,8 @@ export default class Read extends Command {
|
|
|
20
21
|
"omp read src/foo.ts:50-100",
|
|
21
22
|
"omp read src/foo.ts:raw",
|
|
22
23
|
"omp read https://example.com",
|
|
24
|
+
"omp read omp://",
|
|
25
|
+
"omp read issue://123",
|
|
23
26
|
"omp read path/to/archive.zip:dir/file.ts",
|
|
24
27
|
"omp read path/to/db.sqlite:users:42",
|
|
25
28
|
];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Show provider usage limits for every authenticated account.
|
|
3
|
+
*/
|
|
4
|
+
import { Command, Flags } from "@oh-my-pi/pi-utils/cli";
|
|
5
|
+
import { runUsageCommand } from "../cli/usage-cli";
|
|
6
|
+
|
|
7
|
+
export default class Usage extends Command {
|
|
8
|
+
static description = "Show provider usage limits for every authenticated account";
|
|
9
|
+
|
|
10
|
+
static flags = {
|
|
11
|
+
json: Flags.boolean({ char: "j", description: "Output usage reports as JSON", default: false }),
|
|
12
|
+
provider: Flags.string({ char: "p", description: "Only show usage for this provider id (e.g. anthropic)" }),
|
|
13
|
+
redact: Flags.boolean({
|
|
14
|
+
char: "r",
|
|
15
|
+
description: "Redact account emails/ids (shortest unique prefix) for sharing screenshots",
|
|
16
|
+
default: false,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
static examples = [
|
|
21
|
+
"# Detailed per-account usage breakdown across all providers\n omp usage",
|
|
22
|
+
"# Only Anthropic accounts\n omp usage --provider anthropic",
|
|
23
|
+
"# Redact account identifiers for screenshots\n omp usage --redact",
|
|
24
|
+
"# Machine-readable output\n omp usage --json",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
async run(): Promise<void> {
|
|
28
|
+
const { flags } = await this.parse(Usage);
|
|
29
|
+
await runUsageCommand({
|
|
30
|
+
json: flags.json,
|
|
31
|
+
provider: flags.provider,
|
|
32
|
+
redact: flags.redact,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -213,7 +213,7 @@ function writeAssistantMessage(message: string): void {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
function renderMarkdownLines(message: string): string[] {
|
|
216
|
+
function renderMarkdownLines(message: string): readonly string[] {
|
|
217
217
|
const width = Math.max(40, process.stdout.columns ?? 100);
|
|
218
218
|
const markdown = new Markdown(message, 0, 0, getMarkdownTheme());
|
|
219
219
|
return markdown.render(width);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { Api, ApiKey, Model } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import type { ApiKeyResolverRegistry } from "../config/api-key-resolver";
|
|
4
|
-
import { MODEL_ROLE_IDS } from "../config/model-registry";
|
|
5
4
|
import {
|
|
6
5
|
getModelMatchPreferences,
|
|
7
6
|
type ModelLookupRegistry,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
resolveModelRoleValue,
|
|
10
9
|
resolveRoleSelection,
|
|
11
10
|
} from "../config/model-resolver";
|
|
11
|
+
import { MODEL_ROLE_IDS } from "../config/model-roles";
|
|
12
12
|
import type { Settings } from "../config/settings";
|
|
13
13
|
import MODEL_PRIO from "../priority.json" with { type: "json" };
|
|
14
14
|
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
+
import { hostMatchesUrl } from "@oh-my-pi/pi-catalog/hosts";
|
|
2
|
+
|
|
1
3
|
/** Provider metadata needed to resolve append-only context mode. */
|
|
2
4
|
export interface AppendOnlyContextModel {
|
|
3
5
|
provider: string;
|
|
4
6
|
baseUrl: string;
|
|
5
|
-
compat
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function isXiaomiHost(baseUrl: string): boolean {
|
|
9
|
-
try {
|
|
10
|
-
const host = new URL(baseUrl).hostname;
|
|
11
|
-
return host === "xiaomimimo.com" || host.endsWith(".xiaomimimo.com");
|
|
12
|
-
} catch {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
7
|
+
/** Verbatim sparse compat config (explicit user intent), never the resolved record. */
|
|
8
|
+
compatConfig?: object;
|
|
15
9
|
}
|
|
16
10
|
|
|
17
11
|
function shouldAutoEnableAppendOnlyContext(model: AppendOnlyContextModel | null | undefined): boolean {
|
|
18
12
|
if (!model) return false;
|
|
19
13
|
if (model.provider === "deepseek") return true;
|
|
20
|
-
if (
|
|
21
|
-
return !!model.
|
|
14
|
+
if (hostMatchesUrl(model.baseUrl, "xiaomi")) return true;
|
|
15
|
+
return !!model.compatConfig && "supportsStore" in model.compatConfig && model.compatConfig.supportsStore === true;
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
/** Resolves whether append-only context should be active for a model and setting. */
|