@oh-my-pi/pi-coding-agent 15.13.1 → 15.13.3
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 +47 -0
- package/dist/cli.js +1057 -289
- package/dist/types/config/model-registry.d.ts +1 -0
- package/dist/types/config/models-config-schema.d.ts +3 -0
- package/dist/types/config/models-config.d.ts +3 -0
- package/dist/types/config/settings-schema.d.ts +97 -0
- package/dist/types/edit/hashline/block-resolver.d.ts +1 -1
- package/dist/types/edit/index.d.ts +2 -0
- package/dist/types/eval/js/context-manager.d.ts +15 -0
- package/dist/types/modes/components/welcome.d.ts +1 -0
- package/dist/types/modes/controllers/input-controller.d.ts +4 -4
- package/dist/types/modes/interactive-mode.d.ts +1 -0
- package/dist/types/modes/rpc/rpc-types.d.ts +2 -1
- package/dist/types/modes/types.d.ts +6 -0
- package/dist/types/sdk.d.ts +3 -0
- package/dist/types/session/session-dump-format.d.ts +2 -1
- package/dist/types/session/unexpected-stop-classifier.d.ts +13 -0
- package/dist/types/stt/asr-client.d.ts +1 -1
- package/dist/types/system-prompt.d.ts +11 -0
- package/dist/types/tiny/title-client.d.ts +1 -1
- package/dist/types/tools/ask.d.ts +2 -0
- package/dist/types/tools/ast-edit.d.ts +2 -0
- package/dist/types/tools/ast-grep.d.ts +2 -0
- package/dist/types/tools/browser.d.ts +2 -0
- package/dist/types/tools/debug.d.ts +2 -0
- package/dist/types/tools/eval.d.ts +2 -0
- package/dist/types/tools/find.d.ts +2 -0
- package/dist/types/tools/inspect-image.d.ts +2 -1
- package/dist/types/tools/irc.d.ts +2 -0
- package/dist/types/tools/job.d.ts +1 -0
- package/dist/types/tools/ssh.d.ts +2 -0
- package/dist/types/tools/todo.d.ts +2 -0
- package/dist/types/tts/tts-client.d.ts +1 -1
- package/dist/types/tui/tree-list.d.ts +1 -0
- package/dist/types/utils/thinking-display.d.ts +1 -17
- package/package.json +12 -12
- package/src/cli.ts +25 -12
- package/src/config/model-registry.ts +16 -2
- package/src/config/models-config-schema.ts +2 -0
- package/src/config/models-config.ts +1 -0
- package/src/config/settings-schema.ts +78 -0
- package/src/edit/hashline/block-resolver.ts +1 -1
- package/src/edit/hashline/execute.ts +1 -6
- package/src/edit/index.ts +48 -0
- package/src/eval/__tests__/agent-bridge.test.ts +106 -46
- package/src/eval/__tests__/js-context-manager.test.ts +53 -3
- package/src/eval/js/context-manager.ts +132 -29
- package/src/eval/js/worker-core.ts +1 -1
- package/src/eval/js/worker-entry.ts +7 -0
- package/src/export/html/template.js +18 -22
- package/src/internal-urls/docs-index.generated.ts +12 -3
- package/src/main.ts +15 -5
- package/src/modes/acp/acp-agent.ts +2 -2
- package/src/modes/acp/acp-event-mapper.ts +2 -2
- package/src/modes/components/agent-hub.ts +31 -7
- package/src/modes/components/assistant-message.ts +24 -15
- package/src/modes/components/snapcompact-shape-preview-doc.md +2 -2
- package/src/modes/components/snapcompact-shape-preview.ts +2 -2
- package/src/modes/components/tree-selector.ts +3 -2
- package/src/modes/components/welcome.ts +14 -4
- package/src/modes/controllers/event-controller.ts +3 -3
- package/src/modes/controllers/input-controller.ts +28 -39
- package/src/modes/controllers/streaming-reveal.ts +4 -4
- package/src/modes/interactive-mode.ts +2 -0
- package/src/modes/rpc/rpc-mode.ts +1 -0
- package/src/modes/rpc/rpc-types.ts +2 -2
- package/src/modes/types.ts +6 -0
- package/src/modes/utils/ui-helpers.ts +3 -3
- package/src/prompts/agents/oracle.md +0 -1
- package/src/prompts/agents/reviewer.md +0 -1
- package/src/prompts/system/system-prompt.md +17 -21
- package/src/prompts/system/unexpected-stop-classifier.md +17 -0
- package/src/prompts/system/unexpected-stop-retry.md +4 -0
- package/src/prompts/tools/ask.md +0 -8
- package/src/prompts/tools/ast-edit.md +0 -15
- package/src/prompts/tools/ast-grep.md +0 -13
- package/src/prompts/tools/browser.md +0 -21
- package/src/prompts/tools/debug.md +0 -13
- package/src/prompts/tools/eval.md +0 -9
- package/src/prompts/tools/find.md +0 -13
- package/src/prompts/tools/inspect-image.md +0 -9
- package/src/prompts/tools/irc.md +0 -15
- package/src/prompts/tools/patch.md +0 -13
- package/src/prompts/tools/ssh.md +0 -9
- package/src/prompts/tools/todo.md +1 -19
- package/src/sdk.ts +19 -0
- package/src/session/agent-session.ts +289 -29
- package/src/session/session-dump-format.ts +17 -49
- package/src/session/unexpected-stop-classifier.ts +129 -0
- package/src/stt/asr-client.ts +1 -1
- package/src/system-prompt.ts +31 -0
- package/src/tiny/title-client.ts +1 -1
- package/src/tools/ask.ts +41 -0
- package/src/tools/ast-edit.ts +46 -0
- package/src/tools/ast-grep.ts +24 -0
- package/src/tools/browser/tab-supervisor.ts +1 -1
- package/src/tools/browser/tab-worker-entry.ts +12 -4
- package/src/tools/browser.ts +52 -0
- package/src/tools/debug.ts +17 -0
- package/src/tools/eval.ts +20 -1
- package/src/tools/find.ts +24 -0
- package/src/tools/inspect-image.ts +27 -1
- package/src/tools/irc.ts +41 -0
- package/src/tools/job.ts +1 -0
- package/src/tools/ssh.ts +16 -0
- package/src/tools/todo.ts +82 -3
- package/src/tts/tts-client.ts +1 -1
- package/src/tui/tree-list.ts +68 -19
- package/src/utils/thinking-display.ts +8 -34
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { parentPort } from "node:worker_threads";
|
|
2
|
+
import { consumeWorkerInbox } from "@oh-my-pi/pi-utils/worker-host";
|
|
2
3
|
import { WorkerCore } from "./worker-core";
|
|
3
4
|
import type { Transport, WorkerInbound, WorkerOutbound } from "./worker-protocol";
|
|
4
5
|
|
|
5
6
|
if (!parentPort) throw new Error("js worker-entry: missing parentPort");
|
|
6
7
|
|
|
7
8
|
const port = parentPort;
|
|
9
|
+
// When the CLI host pre-buffered messages (it imports this module dynamically),
|
|
10
|
+
// bind that inbox so the parent's already-delivered `init` is replayed. Loaded
|
|
11
|
+
// directly (test/SDK fallback), this module's top-level runs synchronously at
|
|
12
|
+
// worker start, so the direct `parentPort.on` below wins the flush on its own.
|
|
13
|
+
const inbox = consumeWorkerInbox();
|
|
8
14
|
const transport: Transport = {
|
|
9
15
|
send: (msg: WorkerOutbound) => port.postMessage(msg),
|
|
10
16
|
onMessage: handler => {
|
|
17
|
+
if (inbox) return inbox.bind(data => handler(data as WorkerInbound));
|
|
11
18
|
const wrap = (data: unknown): void => handler(data as WorkerInbound);
|
|
12
19
|
port.on("message", wrap);
|
|
13
20
|
return () => port.off("message", wrap);
|
|
@@ -278,10 +278,12 @@
|
|
|
278
278
|
let searchQuery = '';
|
|
279
279
|
|
|
280
280
|
function hasTextContent(content) {
|
|
281
|
-
if (typeof content === 'string') return content
|
|
281
|
+
if (typeof content === 'string') return Boolean(canonicalizeMessage(content));
|
|
282
282
|
if (Array.isArray(content)) {
|
|
283
283
|
for (const c of content) {
|
|
284
|
-
if (c.type === 'text' && c.text
|
|
284
|
+
if (c.type === 'text' && c.text) {
|
|
285
|
+
if (canonicalizeMessage(c.text)) return true;
|
|
286
|
+
}
|
|
285
287
|
}
|
|
286
288
|
}
|
|
287
289
|
return false;
|
|
@@ -450,24 +452,16 @@
|
|
|
450
452
|
return div.innerHTML;
|
|
451
453
|
}
|
|
452
454
|
|
|
453
|
-
function
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
455
|
+
function canonicalizeMessage(text) {
|
|
456
|
+
if (!text) return '';
|
|
457
|
+
const trimmed = text.trim();
|
|
458
|
+
for (let i = 0; i < trimmed.length; i++) {
|
|
459
|
+
const code = trimmed.charCodeAt(i);
|
|
460
|
+
if (code !== 0x2e && code !== 0x2026 && code !== 0x20 && code !== 0x09 && code !== 0x0a && code !== 0x0d) {
|
|
461
|
+
return trimmed;
|
|
460
462
|
}
|
|
461
|
-
if (code === 0x20 || code === 0x09 || code === 0x0a || code === 0x0d) continue;
|
|
462
|
-
return false;
|
|
463
463
|
}
|
|
464
|
-
return
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
function visibleThinkingText(block) {
|
|
468
|
-
const text = block.thinking.trim();
|
|
469
|
-
if (!text) return '';
|
|
470
|
-
return isDotOnlyThinking(text) ? '' : text;
|
|
464
|
+
return '';
|
|
471
465
|
}
|
|
472
466
|
|
|
473
467
|
/**
|
|
@@ -1074,10 +1068,13 @@
|
|
|
1074
1068
|
let html = `<div class="assistant-message" id="${entryId}">${copyBtnHtml}${tsHtml}`;
|
|
1075
1069
|
|
|
1076
1070
|
for (const block of msg.content) {
|
|
1077
|
-
if (block.type === 'text'
|
|
1078
|
-
|
|
1071
|
+
if (block.type === 'text') {
|
|
1072
|
+
const canon = canonicalizeMessage(block.text);
|
|
1073
|
+
if (canon) {
|
|
1074
|
+
html += `<div class="assistant-text markdown-content">${safeMarkedParse(block.text)}</div>`;
|
|
1075
|
+
}
|
|
1079
1076
|
} else if (block.type === 'thinking') {
|
|
1080
|
-
const thinking =
|
|
1077
|
+
const thinking = canonicalizeMessage(block.thinking);
|
|
1081
1078
|
if (!thinking) continue;
|
|
1082
1079
|
html += `<div class="thinking-block">
|
|
1083
1080
|
<div class="thinking-text">${escapeHtml(thinking)}</div>
|
|
@@ -1085,7 +1082,6 @@
|
|
|
1085
1082
|
</div>`;
|
|
1086
1083
|
}
|
|
1087
1084
|
}
|
|
1088
|
-
|
|
1089
1085
|
for (const block of msg.content) {
|
|
1090
1086
|
if (block.type === 'toolCall') {
|
|
1091
1087
|
html += renderToolCall(block, sctx);
|