@oh-my-pi/pi-coding-agent 16.1.0 → 16.1.2
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 +36 -1
- package/dist/cli.js +3134 -3158
- package/dist/types/cli/bench-cli.d.ts +2 -1
- package/dist/types/config/settings-schema.d.ts +28 -37
- package/dist/types/lsp/types.d.ts +5 -3
- package/dist/types/main.d.ts +2 -0
- package/dist/types/modes/components/assistant-message.d.ts +12 -0
- package/dist/types/modes/components/cache-invalidation-marker.d.ts +7 -2
- package/dist/types/modes/components/welcome.d.ts +1 -1
- package/dist/types/sdk.d.ts +19 -2
- package/dist/types/session/auth-broker-config.d.ts +33 -6
- package/dist/types/system-prompt.d.ts +5 -1
- package/dist/types/task/executor.d.ts +10 -0
- package/dist/types/tools/find.d.ts +0 -2
- package/dist/types/tools/search.d.ts +3 -3
- package/package.json +12 -12
- package/scripts/measure-prompt-tokens.ts +63 -0
- package/src/cli/bench-cli.ts +64 -3
- package/src/cli/startup-cwd.ts +3 -13
- package/src/config/settings-schema.ts +34 -37
- package/src/config/settings.ts +40 -0
- package/src/cursor.ts +1 -1
- package/src/debug/raw-sse-buffer.ts +31 -10
- package/src/eval/py/prelude.py +1 -1
- package/src/export/html/tool-views.generated.js +1 -1
- package/src/extensibility/extensions/runner.ts +8 -2
- package/src/internal-urls/docs-index.generated.txt +1 -1
- package/src/lsp/client.ts +9 -9
- package/src/lsp/types.ts +6 -3
- package/src/main.ts +29 -9
- package/src/modes/components/assistant-message.ts +86 -0
- package/src/modes/components/cache-invalidation-marker.ts +12 -2
- package/src/modes/components/settings-defs.ts +7 -0
- package/src/modes/components/tips.txt +2 -1
- package/src/modes/components/welcome.ts +86 -8
- package/src/modes/controllers/event-controller.ts +1 -1
- package/src/prompts/system/personalities/default.md +8 -16
- package/src/prompts/system/system-prompt.md +101 -115
- package/src/prompts/tools/ast-edit.md +10 -12
- package/src/prompts/tools/ast-grep.md +14 -18
- package/src/prompts/tools/bash.md +19 -21
- package/src/prompts/tools/browser.md +24 -24
- package/src/prompts/tools/checkpoint.md +0 -1
- package/src/prompts/tools/debug.md +11 -15
- package/src/prompts/tools/eval.md +27 -27
- package/src/prompts/tools/find.md +6 -10
- package/src/prompts/tools/github.md +11 -15
- package/src/prompts/tools/goal.md +0 -7
- package/src/prompts/tools/inspect-image.md +0 -1
- package/src/prompts/tools/irc.md +15 -24
- package/src/prompts/tools/job.md +5 -8
- package/src/prompts/tools/learn.md +2 -2
- package/src/prompts/tools/lsp.md +27 -30
- package/src/prompts/tools/manage-skill.md +4 -4
- package/src/prompts/tools/read.md +21 -23
- package/src/prompts/tools/replace.md +0 -1
- package/src/prompts/tools/resolve.md +4 -9
- package/src/prompts/tools/rewind.md +1 -1
- package/src/prompts/tools/search.md +8 -10
- package/src/prompts/tools/task.md +33 -38
- package/src/prompts/tools/todo.md +14 -18
- package/src/prompts/tools/web-search.md +0 -4
- package/src/prompts/tools/write.md +1 -1
- package/src/sdk.ts +49 -102
- package/src/session/agent-session.ts +23 -12
- package/src/session/auth-broker-config.ts +36 -76
- package/src/session/session-history-format.ts +1 -1
- package/src/session/session-manager.ts +33 -6
- package/src/system-prompt.ts +28 -8
- package/src/task/executor.ts +57 -0
- package/src/task/index.ts +15 -1
- package/src/tools/browser.ts +1 -1
- package/src/tools/eval.ts +1 -1
- package/src/tools/find.ts +4 -17
- package/src/tools/memory-edit.ts +1 -1
- package/src/tools/search.ts +5 -5
|
@@ -595,7 +595,11 @@ export class ExtensionRunner {
|
|
|
595
595
|
}
|
|
596
596
|
|
|
597
597
|
async emit<TEvent extends RunnerEmitEvent>(event: TEvent): Promise<RunnerEmitResult<TEvent>> {
|
|
598
|
-
|
|
598
|
+
// Defer the per-event context allocation (and the Promise.race/Bun.sleep
|
|
599
|
+
// timeout machinery) to the first matching handler. Streaming sessions emit
|
|
600
|
+
// message_update / tool_execution_* per delta with usually no extension
|
|
601
|
+
// subscribed; building `ctx` for a zero-handler event is pure waste.
|
|
602
|
+
let ctx: ExtensionContext | undefined;
|
|
599
603
|
let result: SessionBeforeEventResult | SessionCompactingResult | SessionStopEventResult | undefined;
|
|
600
604
|
|
|
601
605
|
if (this.#isSessionShutdownEvent(event)) {
|
|
@@ -604,17 +608,19 @@ export class ExtensionRunner {
|
|
|
604
608
|
for (const ext of this.extensions) {
|
|
605
609
|
const handlers = ext.handlers.get(event.type);
|
|
606
610
|
if (!handlers || handlers.length === 0) continue;
|
|
611
|
+
ctx ??= this.createContext();
|
|
607
612
|
for (const handler of handlers) {
|
|
608
613
|
promises.push(this.#runHandlerWithTimeout(handler, event, ctx, ext, timeoutMs));
|
|
609
614
|
}
|
|
610
615
|
}
|
|
611
|
-
await Promise.all(promises);
|
|
616
|
+
if (promises.length > 0) await Promise.all(promises);
|
|
612
617
|
return result as RunnerEmitResult<TEvent>;
|
|
613
618
|
}
|
|
614
619
|
|
|
615
620
|
for (const ext of this.extensions) {
|
|
616
621
|
const handlers = ext.handlers.get(event.type);
|
|
617
622
|
if (!handlers || handlers.length === 0) continue;
|
|
623
|
+
ctx ??= this.createContext();
|
|
618
624
|
|
|
619
625
|
for (const handler of handlers) {
|
|
620
626
|
const handlerResult = await this.#runHandlerWithTimeout(
|