@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/async/job-manager.ts
CHANGED
|
@@ -23,6 +23,12 @@ export interface AsyncJob {
|
|
|
23
23
|
* supply an id (e.g. legacy tests, SDK consumers without an agent context).
|
|
24
24
|
*/
|
|
25
25
|
ownerId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Job is registered but parked behind a caller-managed gate (e.g. a task
|
|
28
|
+
* batch semaphore). Queued jobs do not count toward the running-job limit
|
|
29
|
+
* until the caller invokes `markRunning()` from the run context.
|
|
30
|
+
*/
|
|
31
|
+
queued?: boolean;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
export interface AsyncJobManagerOptions {
|
|
@@ -53,6 +59,8 @@ export interface AsyncJobRegisterOptions {
|
|
|
53
59
|
/** Registry id of the agent that owns this job; used to scope cancelAll. */
|
|
54
60
|
ownerId?: string;
|
|
55
61
|
onProgress?: (text: string, details?: Record<string, unknown>) => void | Promise<void>;
|
|
62
|
+
/** Register the job in queued state; see {@link AsyncJob.queued}. */
|
|
63
|
+
queued?: boolean;
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
/**
|
|
@@ -110,6 +118,17 @@ export class AsyncJobManager {
|
|
|
110
118
|
this.#retentionMs = Math.max(0, Math.floor(options.retentionMs ?? DEFAULT_RETENTION_MS));
|
|
111
119
|
}
|
|
112
120
|
|
|
121
|
+
/** True when the running-job count has reached the configured cap. */
|
|
122
|
+
get atCapacity(): boolean {
|
|
123
|
+
if (this.#disposed) return true;
|
|
124
|
+
// Mirror register(): queued jobs hold no execution slot.
|
|
125
|
+
let activeCount = 0;
|
|
126
|
+
for (const job of this.#jobs.values()) {
|
|
127
|
+
if (job.status === "running" && !job.queued) activeCount++;
|
|
128
|
+
}
|
|
129
|
+
return activeCount >= this.#maxRunningJobs;
|
|
130
|
+
}
|
|
131
|
+
|
|
113
132
|
register(
|
|
114
133
|
type: "bash" | "task",
|
|
115
134
|
label: string,
|
|
@@ -117,14 +136,21 @@ export class AsyncJobManager {
|
|
|
117
136
|
jobId: string;
|
|
118
137
|
signal: AbortSignal;
|
|
119
138
|
reportProgress: (text: string, details?: Record<string, unknown>) => Promise<void>;
|
|
139
|
+
/** Clear the queued flag once the job actually starts executing. */
|
|
140
|
+
markRunning: () => void;
|
|
120
141
|
}) => Promise<string>,
|
|
121
142
|
options?: AsyncJobRegisterOptions,
|
|
122
143
|
): string {
|
|
123
144
|
if (this.#disposed) {
|
|
124
145
|
throw new Error("Async job manager is disposed");
|
|
125
146
|
}
|
|
126
|
-
|
|
127
|
-
|
|
147
|
+
// Queued jobs hold no execution slot yet — only count jobs that are
|
|
148
|
+
// actually running so a large parked batch cannot starve registration.
|
|
149
|
+
let activeCount = 0;
|
|
150
|
+
for (const existing of this.#jobs.values()) {
|
|
151
|
+
if (existing.status === "running" && !existing.queued) activeCount++;
|
|
152
|
+
}
|
|
153
|
+
if (activeCount >= this.#maxRunningJobs) {
|
|
128
154
|
throw new Error(
|
|
129
155
|
`Background job limit reached (${this.#maxRunningJobs}). Wait for running jobs to finish or cancel one.`,
|
|
130
156
|
);
|
|
@@ -144,6 +170,7 @@ export class AsyncJobManager {
|
|
|
144
170
|
abortController,
|
|
145
171
|
promise: Promise.resolve(),
|
|
146
172
|
ownerId: options?.ownerId,
|
|
173
|
+
queued: options?.queued === true,
|
|
147
174
|
};
|
|
148
175
|
|
|
149
176
|
const reportProgress = async (text: string, details?: Record<string, unknown>): Promise<void> => {
|
|
@@ -159,7 +186,14 @@ export class AsyncJobManager {
|
|
|
159
186
|
};
|
|
160
187
|
job.promise = (async () => {
|
|
161
188
|
try {
|
|
162
|
-
const text = await run({
|
|
189
|
+
const text = await run({
|
|
190
|
+
jobId: id,
|
|
191
|
+
signal: abortController.signal,
|
|
192
|
+
reportProgress,
|
|
193
|
+
markRunning: () => {
|
|
194
|
+
job.queued = false;
|
|
195
|
+
},
|
|
196
|
+
});
|
|
163
197
|
if (job.status === "cancelled") {
|
|
164
198
|
job.resultText = text;
|
|
165
199
|
this.#scheduleEviction(id);
|
|
@@ -278,6 +312,26 @@ export class AsyncJobManager {
|
|
|
278
312
|
return before - this.#deliveries.length;
|
|
279
313
|
}
|
|
280
314
|
|
|
315
|
+
/**
|
|
316
|
+
* Lift a foreground-wait suppression set via `acknowledgeDeliveries`. If the
|
|
317
|
+
* job already finished while suppressed (its delivery enqueue was skipped),
|
|
318
|
+
* re-enqueue the completion so the result is still delivered exactly once.
|
|
319
|
+
*/
|
|
320
|
+
resumeDeliveries(jobIds: string[]): void {
|
|
321
|
+
for (const rawId of jobIds) {
|
|
322
|
+
const jobId = rawId.trim();
|
|
323
|
+
if (!jobId) continue;
|
|
324
|
+
if (!this.#suppressedDeliveries.delete(jobId)) continue;
|
|
325
|
+
const job = this.#jobs.get(jobId);
|
|
326
|
+
if (!job || (job.status !== "completed" && job.status !== "failed")) continue;
|
|
327
|
+
const queued =
|
|
328
|
+
this.#deliveries.some(delivery => delivery.jobId === jobId) ||
|
|
329
|
+
this.#inFlightDeliveries.some(delivery => delivery.jobId === jobId);
|
|
330
|
+
if (queued) continue;
|
|
331
|
+
this.#enqueueDelivery(jobId, job.status === "completed" ? (job.resultText ?? "") : (job.errorText ?? ""));
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
281
335
|
/**
|
|
282
336
|
* Cancel running jobs. With `filter.ownerId` set, cancels only jobs the
|
|
283
337
|
* matching agent registered; with no filter, cancels every running job
|
|
@@ -66,7 +66,7 @@ export function createDashboardController(): DashboardController {
|
|
|
66
66
|
|
|
67
67
|
let scrollOffset = 0;
|
|
68
68
|
return {
|
|
69
|
-
render(width: number): string[] {
|
|
69
|
+
render(width: number): readonly string[] {
|
|
70
70
|
const terminalRows = process.stdout.rows ?? 40;
|
|
71
71
|
const header = renderExpandedHeader(runtime, width, theme);
|
|
72
72
|
const body = renderDashboardLines(runtime, width, theme, 0);
|
|
@@ -18,16 +18,16 @@ Working directory: `{{working_dir}}`
|
|
|
18
18
|
{{baseline_warning}}
|
|
19
19
|
{{/if}}
|
|
20
20
|
|
|
21
|
-
### What you
|
|
21
|
+
### What you MUST produce
|
|
22
22
|
|
|
23
|
-
Write `./autoresearch.sh` at the working directory. It is the canonical benchmark entrypoint and
|
|
23
|
+
Write `./autoresearch.sh` at the working directory. It is the canonical benchmark entrypoint and MUST:
|
|
24
24
|
|
|
25
25
|
- exit 0 on success and non-zero on failure;
|
|
26
26
|
- print the primary metric as a single line `METRIC <name>=<value>`;
|
|
27
27
|
- print any secondary metrics as additional `METRIC <name>=<value>` lines;
|
|
28
28
|
- run the same workload deterministically every time (no live network, no time-of-day dependencies, fixed seeds where applicable).
|
|
29
29
|
|
|
30
|
-
You
|
|
30
|
+
You MAY edit anything else needed to make `autoresearch.sh` work — benchmark binaries, `Cargo.toml`, `package.json`, helper scripts, fixtures. All those edits are part of the harness baseline and will be committed for you when you call `init_experiment` on an autoresearch branch.
|
|
31
31
|
|
|
32
32
|
### Steps
|
|
33
33
|
|
|
@@ -38,6 +38,6 @@ You **may** edit anything else needed to make `autoresearch.sh` work — benchma
|
|
|
38
38
|
|
|
39
39
|
### Rules
|
|
40
40
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
41
|
+
- NEVER call `run_experiment`, `log_experiment`, or `update_notes` yet. They will error with "no active autoresearch session" until `init_experiment` runs.
|
|
42
|
+
- NEVER treat a compile-only check as a benchmark. The harness MUST actually execute the workload and emit `METRIC`.
|
|
43
|
+
- NEVER create `autoresearch.md`, `autoresearch.checks.sh`, `autoresearch.program.md`, `autoresearch.ideas.md`, `autoresearch.jsonl`, `.autoresearch/`, or `autoresearch.config.json`. Session state is tracked for you.
|
|
@@ -11,17 +11,17 @@ Primary goal:
|
|
|
11
11
|
There is no goal recorded for this session yet. Infer what to optimize from the latest user message and the conversation; capture the goal in your notes (`update_notes`) once it is clear.
|
|
12
12
|
{{/if}}
|
|
13
13
|
|
|
14
|
-
Session state and run artifacts are managed for you. The benchmark entrypoint is `bash autoresearch.sh` (committed during Phase 1).
|
|
14
|
+
Session state and run artifacts are managed for you. The benchmark entrypoint is `bash autoresearch.sh` (committed during Phase 1). NEVER edit `autoresearch.sh` mid-segment unless you intentionally bump segment via `init_experiment new_segment: true`. NEVER create `autoresearch.md` or `.autoresearch/` in this repo.
|
|
15
15
|
|
|
16
16
|
Working directory: `{{working_dir}}`
|
|
17
17
|
{{#if has_branch}}Active branch: `{{branch}}`{{/if}}
|
|
18
18
|
{{#if has_baseline_commit}}Baseline commit: `{{baseline_commit}}`{{/if}}
|
|
19
19
|
|
|
20
|
-
You are running an autonomous experiment loop.
|
|
20
|
+
You are running an autonomous experiment loop. You MUST keep iterating until the user interrupts you or the configured maximum iteration count is reached.
|
|
21
21
|
|
|
22
22
|
### Available tools
|
|
23
23
|
- `init_experiment` — open or reconfigure the session. Pass `new_segment: true` to start a fresh baseline within the current session.
|
|
24
|
-
- `run_experiment` — run the benchmark (`bash autoresearch.sh`). Output is captured automatically and `METRIC name=value` / `ASI key=value` lines printed by the harness are parsed back to you. The command is fixed
|
|
24
|
+
- `run_experiment` — run the benchmark (`bash autoresearch.sh`). Output is captured automatically and `METRIC name=value` / `ASI key=value` lines printed by the harness are parsed back to you. The command is fixed.
|
|
25
25
|
- `log_experiment` — record the result. On `keep`, modified files are committed for you; on `discard`/`crash`/`checks_failed`, the worktree is reverted. Pass `flag_runs` to mark earlier runs as suspect; flagged runs are excluded from baseline and best-metric math.
|
|
26
26
|
- `update_notes` — replace the durable session playbook (`body`) or append to the ideas backlog (`append_idea`). The notes are injected into your system prompt every iteration.
|
|
27
27
|
|
|
@@ -97,7 +97,7 @@ Finish the `log_experiment` step before starting another benchmark.
|
|
|
97
97
|
{{/if}}
|
|
98
98
|
|
|
99
99
|
### Guardrails
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
100
|
+
- NEVER game the benchmark.
|
|
101
|
+
- NEVER overfit to synthetic inputs if the real workload is broader.
|
|
102
|
+
- MUST preserve correctness.
|
|
103
103
|
- If the user sends another message while a run is in progress, finish the current run and logging cycle first, then address the new input in the next iteration.
|
package/src/capability/fs.ts
CHANGED
|
@@ -15,6 +15,16 @@ export async function readFile(filePath: string): Promise<string | null> {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
try {
|
|
18
|
+
// Gate on the file type first: discovery scans foreign config dirs
|
|
19
|
+
// (~/.claude, ~/.cursor, project trees), and reading a FIFO/socket/char
|
|
20
|
+
// device with `.text()` blocks until EOF — i.e. forever — hanging
|
|
21
|
+
// startup with zero output. `stat` follows symlinks, so symlinked
|
|
22
|
+
// context files (CLAUDE.md -> AGENTS.md) still resolve.
|
|
23
|
+
const stats = await fs.promises.stat(abs);
|
|
24
|
+
if (!stats.isFile()) {
|
|
25
|
+
contentCache.set(abs, null);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
18
28
|
const content = await Bun.file(abs).text();
|
|
19
29
|
contentCache.set(abs, content);
|
|
20
30
|
return content;
|
package/src/cli/args.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI argument parsing and help display
|
|
3
3
|
*/
|
|
4
|
-
import { type Effort, THINKING_EFFORTS } from "@oh-my-pi/pi-
|
|
4
|
+
import { type Effort, THINKING_EFFORTS } from "@oh-my-pi/pi-catalog/effort";
|
|
5
5
|
import { APP_NAME, CONFIG_DIR_NAME, logger } from "@oh-my-pi/pi-utils";
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
import { parseEffort } from "../thinking";
|
|
@@ -24,14 +24,12 @@ import {
|
|
|
24
24
|
type CredentialCompletionResult,
|
|
25
25
|
completeSimple,
|
|
26
26
|
DEFAULT_AUTH_GATEWAY_BIND,
|
|
27
|
-
type GeneratedProvider,
|
|
28
|
-
getBundledModels,
|
|
29
|
-
getBundledProviders,
|
|
30
27
|
type Model,
|
|
31
28
|
RemoteAuthCredentialStore,
|
|
32
29
|
type SnapshotResponse,
|
|
33
30
|
startAuthGateway,
|
|
34
31
|
} from "@oh-my-pi/pi-ai";
|
|
32
|
+
import { type GeneratedProvider, getBundledModels, getBundledProviders } from "@oh-my-pi/pi-catalog/models";
|
|
35
33
|
import { getConfigRootDir, isEnoent, VERSION } from "@oh-my-pi/pi-utils";
|
|
36
34
|
import chalk from "chalk";
|
|
37
35
|
import { type AuthBrokerClientConfig, resolveAuthBrokerConfig } from "../session/auth-broker-config";
|
|
@@ -12,10 +12,10 @@ import type {
|
|
|
12
12
|
SimpleStreamOptions,
|
|
13
13
|
} from "@oh-my-pi/pi-ai";
|
|
14
14
|
import { streamSimple } from "@oh-my-pi/pi-ai";
|
|
15
|
+
import type { CanonicalModelVariant } from "@oh-my-pi/pi-catalog/identity";
|
|
15
16
|
import { replaceTabs, truncateToWidth } from "@oh-my-pi/pi-tui";
|
|
16
17
|
import { formatDuration, getProjectDir } from "@oh-my-pi/pi-utils";
|
|
17
18
|
import chalk from "chalk";
|
|
18
|
-
import type { CanonicalModelVariant } from "../config/model-equivalence";
|
|
19
19
|
import { type CanonicalModelQueryOptions, ModelRegistry } from "../config/model-registry";
|
|
20
20
|
import {
|
|
21
21
|
formatModelString,
|
package/src/cli/gallery-cli.ts
CHANGED
|
@@ -104,7 +104,7 @@ export async function renderGalleryState(
|
|
|
104
104
|
state: GalleryState,
|
|
105
105
|
width: number,
|
|
106
106
|
expanded = false,
|
|
107
|
-
): Promise<string[]> {
|
|
107
|
+
): Promise<readonly string[]> {
|
|
108
108
|
if (fixture.renderState) {
|
|
109
109
|
return await fixture.renderState(state, width, expanded);
|
|
110
110
|
}
|
|
@@ -56,7 +56,7 @@ function addGroupedReadArgs(component: ReadToolGroupComponent): void {
|
|
|
56
56
|
component.updateArgs({ path: groupedReadRepeatedRanges }, "read-ranges");
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
function renderReadGroupFixtureState(state: GalleryFixtureState, width: number, expanded: boolean): string[] {
|
|
59
|
+
function renderReadGroupFixtureState(state: GalleryFixtureState, width: number, expanded: boolean): readonly string[] {
|
|
60
60
|
const component = new ReadToolGroupComponent();
|
|
61
61
|
component.setExpanded(expanded);
|
|
62
62
|
|
|
@@ -22,7 +22,11 @@ export interface GalleryFixture {
|
|
|
22
22
|
* Custom gallery-only renderer for fixtures that are not one ToolExecutionComponent
|
|
23
23
|
* (for example the read-group transcript component).
|
|
24
24
|
*/
|
|
25
|
-
renderState?: (
|
|
25
|
+
renderState?: (
|
|
26
|
+
state: GalleryFixtureState,
|
|
27
|
+
width: number,
|
|
28
|
+
expanded: boolean,
|
|
29
|
+
) => readonly string[] | Promise<readonly string[]>;
|
|
26
30
|
/**
|
|
27
31
|
* Set for tools whose real `AgentTool` attaches `renderCall`/`renderResult`
|
|
28
32
|
* directly on the instance (e.g. `task`). The harness then attaches
|
package/src/cli/list-models.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* List available models with optional fuzzy search
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import type { Api, Model } from "@oh-my-pi/pi-ai";
|
|
5
|
+
import { getSupportedEfforts } from "@oh-my-pi/pi-catalog/model-thinking";
|
|
5
6
|
import { fuzzyFilter } from "@oh-my-pi/pi-tui";
|
|
6
7
|
import { formatNumber } from "@oh-my-pi/pi-utils";
|
|
7
8
|
import type { ModelRegistry } from "../config/model-registry";
|
|
@@ -64,22 +65,16 @@ export async function listModels(modelRegistry: ModelRegistry, searchPattern?: s
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
const filteredCanonical = modelRegistry
|
|
67
|
-
.
|
|
68
|
-
.map(
|
|
69
|
-
|
|
70
|
-
availableOnly: true,
|
|
71
|
-
candidates: filteredModels,
|
|
72
|
-
});
|
|
73
|
-
if (!selected) return undefined;
|
|
74
|
-
return {
|
|
68
|
+
.getCanonicalModelSelections({ availableOnly: true, candidates: filteredModels })
|
|
69
|
+
.map(
|
|
70
|
+
({ record, model: selected }): CanonicalRow => ({
|
|
75
71
|
canonical: record.id,
|
|
76
72
|
selected: `${selected.provider}/${selected.id}`,
|
|
77
73
|
variants: String(record.variants.length),
|
|
78
74
|
context: formatNumber(selected.contextWindow),
|
|
79
75
|
maxOut: formatNumber(selected.maxTokens),
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.filter((row): row is CanonicalRow => row !== undefined)
|
|
76
|
+
}),
|
|
77
|
+
)
|
|
83
78
|
.sort((left, right) => left.canonical.localeCompare(right.canonical));
|
|
84
79
|
|
|
85
80
|
if (filteredModels.length === 0 && filteredCanonical.length === 0) {
|