@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
|
@@ -342,44 +342,38 @@ export const SETTINGS_SCHEMA = {
|
|
|
342
342
|
},
|
|
343
343
|
|
|
344
344
|
// macOS power assertions (caffeinate flags). No-op on other platforms.
|
|
345
|
-
"power.
|
|
346
|
-
type: "
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
tab: "interaction",
|
|
350
|
-
group: "Power (macOS)",
|
|
351
|
-
label: "Prevent Idle Sleep",
|
|
352
|
-
description: "Keep the system awake while a session is open (caffeinate -i)",
|
|
353
|
-
},
|
|
354
|
-
},
|
|
355
|
-
"power.preventSystemSleep": {
|
|
356
|
-
type: "boolean",
|
|
357
|
-
default: false,
|
|
358
|
-
ui: {
|
|
359
|
-
tab: "interaction",
|
|
360
|
-
group: "Power (macOS)",
|
|
361
|
-
label: "Prevent System Sleep on AC",
|
|
362
|
-
description: "Block all system sleep while on AC power (caffeinate -s)",
|
|
363
|
-
},
|
|
364
|
-
},
|
|
365
|
-
"power.declareUserActive": {
|
|
366
|
-
type: "boolean",
|
|
367
|
-
default: false,
|
|
368
|
-
ui: {
|
|
369
|
-
tab: "interaction",
|
|
370
|
-
group: "Power (macOS)",
|
|
371
|
-
label: "Declare User Active",
|
|
372
|
-
description: "Keep the display lit and treat the user as active (caffeinate -u)",
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
"power.preventDisplaySleep": {
|
|
376
|
-
type: "boolean",
|
|
377
|
-
default: false,
|
|
345
|
+
"power.sleepPrevention": {
|
|
346
|
+
type: "enum",
|
|
347
|
+
values: ["off", "idle", "display", "system"] as const,
|
|
348
|
+
default: "idle",
|
|
378
349
|
ui: {
|
|
379
350
|
tab: "interaction",
|
|
380
351
|
group: "Power (macOS)",
|
|
381
|
-
label: "
|
|
382
|
-
description:
|
|
352
|
+
label: "Sleep Prevention",
|
|
353
|
+
description:
|
|
354
|
+
"Prevent macOS sleep during active sessions. Each level is cumulative — it adds the flags of all lower levels.",
|
|
355
|
+
options: [
|
|
356
|
+
{
|
|
357
|
+
value: "off",
|
|
358
|
+
label: "Off",
|
|
359
|
+
description: "Do not prevent any sleep",
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
value: "idle",
|
|
363
|
+
label: "Prevent Idle Sleep",
|
|
364
|
+
description: "Keep the system awake while a session is open (caffeinate -i)",
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
value: "display",
|
|
368
|
+
label: "Prevent Display Sleep",
|
|
369
|
+
description: "Also keep the display from idle-sleeping (caffeinate -i -d)",
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
value: "system",
|
|
373
|
+
label: "Prevent System Sleep",
|
|
374
|
+
description: "Also block all system sleep on AC and declare the user active (caffeinate -i -d -s -u)",
|
|
375
|
+
},
|
|
376
|
+
],
|
|
383
377
|
},
|
|
384
378
|
},
|
|
385
379
|
"advisor.enabled": {
|
|
@@ -401,6 +395,7 @@ export const SETTINGS_SCHEMA = {
|
|
|
401
395
|
group: "Advisor",
|
|
402
396
|
label: "Advisor for Subagents",
|
|
403
397
|
description: "Also enable the advisor on spawned task/eval subagents.",
|
|
398
|
+
condition: "advisorEnabled",
|
|
404
399
|
},
|
|
405
400
|
},
|
|
406
401
|
"advisor.syncBacklog": {
|
|
@@ -413,6 +408,7 @@ export const SETTINGS_SCHEMA = {
|
|
|
413
408
|
label: "Advisor Sync Backlog",
|
|
414
409
|
description:
|
|
415
410
|
"Pause the main agent for up to 30 seconds if the advisor falls behind by this many turns. Off disables catch-up delays.",
|
|
411
|
+
condition: "advisorEnabled",
|
|
416
412
|
},
|
|
417
413
|
},
|
|
418
414
|
"advisor.immuneTurns": {
|
|
@@ -432,6 +428,7 @@ export const SETTINGS_SCHEMA = {
|
|
|
432
428
|
{ value: "4", label: "4 turns" },
|
|
433
429
|
{ value: "5", label: "5 turns" },
|
|
434
430
|
],
|
|
431
|
+
condition: "advisorEnabled",
|
|
435
432
|
},
|
|
436
433
|
},
|
|
437
434
|
shellPath: { type: "string", default: undefined },
|
|
@@ -851,7 +848,7 @@ export const SETTINGS_SCHEMA = {
|
|
|
851
848
|
|
|
852
849
|
"display.cacheMissMarker": {
|
|
853
850
|
type: "boolean",
|
|
854
|
-
default:
|
|
851
|
+
default: false,
|
|
855
852
|
ui: {
|
|
856
853
|
tab: "appearance",
|
|
857
854
|
group: "Display",
|
|
@@ -927,7 +924,7 @@ export const SETTINGS_SCHEMA = {
|
|
|
927
924
|
|
|
928
925
|
inlineToolDescriptors: {
|
|
929
926
|
type: "boolean",
|
|
930
|
-
default:
|
|
927
|
+
default: false,
|
|
931
928
|
ui: {
|
|
932
929
|
tab: "model",
|
|
933
930
|
group: "Prompt",
|
package/src/config/settings.ts
CHANGED
|
@@ -909,6 +909,46 @@ export class Settings {
|
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
911
|
|
|
912
|
+
// power.preventIdleSleep / power.preventSystemSleep / power.declareUserActive
|
|
913
|
+
// / power.preventDisplaySleep (four booleans) → power.sleepPrevention enum.
|
|
914
|
+
// The enum is cumulative: each level adds the flags of all lower levels.
|
|
915
|
+
// Migration picks the highest level whose condition is met, scanning from
|
|
916
|
+
// most to least aggressive so a single enum value captures the old state.
|
|
917
|
+
if (
|
|
918
|
+
!("sleepPrevention" in ((raw.power as Record<string, unknown>) ?? {})) &&
|
|
919
|
+
raw["power.sleepPrevention"] === undefined
|
|
920
|
+
) {
|
|
921
|
+
const powerObj = raw.power as Record<string, unknown> | undefined;
|
|
922
|
+
const getFlag = (key: string): boolean | undefined => {
|
|
923
|
+
const nested = powerObj?.[key];
|
|
924
|
+
const flat = raw[`power.${key}`];
|
|
925
|
+
const value = nested ?? flat;
|
|
926
|
+
return typeof value === "boolean" ? value : undefined;
|
|
927
|
+
};
|
|
928
|
+
const idle = getFlag("preventIdleSleep");
|
|
929
|
+
const system = getFlag("preventSystemSleep");
|
|
930
|
+
const user = getFlag("declareUserActive");
|
|
931
|
+
const display = getFlag("preventDisplaySleep");
|
|
932
|
+
const anySet = idle !== undefined || system !== undefined || user !== undefined || display !== undefined;
|
|
933
|
+
if (anySet) {
|
|
934
|
+
const mode = system || user ? "system" : display ? "display" : idle !== false ? "idle" : "off";
|
|
935
|
+
const powerRoot = (powerObj ?? {}) as Record<string, unknown>;
|
|
936
|
+
powerRoot.sleepPrevention = mode;
|
|
937
|
+
raw.power = powerRoot;
|
|
938
|
+
}
|
|
939
|
+
// Clean up old keys (nested + flat)
|
|
940
|
+
if (powerObj) {
|
|
941
|
+
delete powerObj.preventIdleSleep;
|
|
942
|
+
delete powerObj.preventSystemSleep;
|
|
943
|
+
delete powerObj.declareUserActive;
|
|
944
|
+
delete powerObj.preventDisplaySleep;
|
|
945
|
+
}
|
|
946
|
+
delete raw["power.preventIdleSleep"];
|
|
947
|
+
delete raw["power.preventSystemSleep"];
|
|
948
|
+
delete raw["power.declareUserActive"];
|
|
949
|
+
delete raw["power.preventDisplaySleep"];
|
|
950
|
+
}
|
|
951
|
+
|
|
912
952
|
return raw;
|
|
913
953
|
}
|
|
914
954
|
|
package/src/cursor.ts
CHANGED
|
@@ -181,7 +181,7 @@ export class CursorExecHandlers implements ICursorExecHandlers {
|
|
|
181
181
|
const toolResultMessage = await executeTool(this.options, "search", toolCallId, {
|
|
182
182
|
pattern: args.pattern,
|
|
183
183
|
paths: [searchPath],
|
|
184
|
-
|
|
184
|
+
case: args.caseInsensitive === true ? false : undefined,
|
|
185
185
|
});
|
|
186
186
|
return toolResultMessage;
|
|
187
187
|
}
|
|
@@ -119,9 +119,16 @@ export class RawSseDebugBuffer {
|
|
|
119
119
|
#records: RawSseDebugRecord[] = [];
|
|
120
120
|
// Parallel to `#records`: `#recordChars[i]` is the precomputed char count
|
|
121
121
|
// for `#records[i]`. Kept in lockstep by `#append` (push both) and
|
|
122
|
-
// `#enforceLimits` (
|
|
123
|
-
//
|
|
122
|
+
// `#enforceLimits` (advance `#head` to evict, then `slice` both together
|
|
123
|
+
// when compacting). See the comment above the class for why this is a
|
|
124
|
+
// sidecar array instead of a per-record property.
|
|
124
125
|
#recordChars: number[] = [];
|
|
126
|
+
// Head-index ring over `#records`/`#recordChars`: index of the oldest live
|
|
127
|
+
// record. Eviction advances `#head` (amortized O(1)) rather than an O(n)
|
|
128
|
+
// front `shift()`; the dead `[0, #head)` prefix is reclaimed lazily by
|
|
129
|
+
// `#enforceLimits`. Live count is `#records.length - #head`; the live
|
|
130
|
+
// records are `#records[#head ..]`.
|
|
131
|
+
#head = 0;
|
|
125
132
|
#totalChars = 0;
|
|
126
133
|
#droppedRecords = 0;
|
|
127
134
|
#droppedChars = 0;
|
|
@@ -181,7 +188,7 @@ export class RawSseDebugBuffer {
|
|
|
181
188
|
|
|
182
189
|
snapshot(): RawSseDebugSnapshot {
|
|
183
190
|
return {
|
|
184
|
-
records:
|
|
191
|
+
records: this.#records.slice(this.#head),
|
|
185
192
|
droppedRecords: this.#droppedRecords,
|
|
186
193
|
droppedChars: this.#droppedChars,
|
|
187
194
|
totalEvents: this.#totalEvents,
|
|
@@ -190,9 +197,12 @@ export class RawSseDebugBuffer {
|
|
|
190
197
|
}
|
|
191
198
|
|
|
192
199
|
toRawText(): string {
|
|
193
|
-
// Reads the live
|
|
194
|
-
// from each record, so no caller-visible mutation is possible.
|
|
195
|
-
|
|
200
|
+
// Reads the live window directly: `rawRecordText` only computes a string
|
|
201
|
+
// from each record, so no caller-visible mutation is possible. With a
|
|
202
|
+
// non-empty dead prefix we map a slice past `#head`; `#head === 0` (the
|
|
203
|
+
// common case) maps `#records` in place with no extra copy.
|
|
204
|
+
const live = this.#head === 0 ? this.#records : this.#records.slice(this.#head);
|
|
205
|
+
const body = live.map(rawRecordText).join("\n");
|
|
196
206
|
if (this.#droppedRecords === 0) return body;
|
|
197
207
|
const dropped = `: omp-debug-dropped records=${this.#droppedRecords} chars=${this.#droppedChars}\n\n`;
|
|
198
208
|
return body.length > 0 ? `${dropped}${body}` : dropped;
|
|
@@ -208,14 +218,25 @@ export class RawSseDebugBuffer {
|
|
|
208
218
|
}
|
|
209
219
|
|
|
210
220
|
#enforceLimits(): void {
|
|
211
|
-
while (this.#records.length > MAX_RAW_SSE_EVENTS || this.#totalChars > MAX_RAW_SSE_CHARS) {
|
|
212
|
-
if (this.#records.length === 0)
|
|
213
|
-
this.#
|
|
214
|
-
|
|
221
|
+
while (this.#records.length - this.#head > MAX_RAW_SSE_EVENTS || this.#totalChars > MAX_RAW_SSE_CHARS) {
|
|
222
|
+
if (this.#records.length - this.#head === 0) break;
|
|
223
|
+
const chars = this.#recordChars[this.#head] ?? 0;
|
|
224
|
+
this.#head += 1;
|
|
215
225
|
this.#totalChars = Math.max(0, this.#totalChars - chars);
|
|
216
226
|
this.#droppedRecords += 1;
|
|
217
227
|
this.#droppedChars += chars;
|
|
218
228
|
}
|
|
229
|
+
// Reclaim the consumed `[0, #head)` prefix once it grows large: one O(n)
|
|
230
|
+
// memmove amortized over many O(1) evictions, bounding the backing arrays
|
|
231
|
+
// to ~2x the live window. `#head >= MAX_RAW_SSE_EVENTS` covers the
|
|
232
|
+
// full-record-count steady state; `#head > liveCount` covers a small live
|
|
233
|
+
// window held by a few large records under the char budget.
|
|
234
|
+
const liveCount = this.#records.length - this.#head;
|
|
235
|
+
if (this.#head >= MAX_RAW_SSE_EVENTS || this.#head > liveCount) {
|
|
236
|
+
this.#records = this.#records.slice(this.#head);
|
|
237
|
+
this.#recordChars = this.#recordChars.slice(this.#head);
|
|
238
|
+
this.#head = 0;
|
|
239
|
+
}
|
|
219
240
|
}
|
|
220
241
|
|
|
221
242
|
#emit(): void {
|
package/src/eval/py/prelude.py
CHANGED
|
@@ -5,7 +5,7 @@ if "__omp_prelude_loaded__" not in globals():
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
import os, json, math, re
|
|
7
7
|
from urllib.parse import unquote
|
|
8
|
-
INTENT_FIELD = "
|
|
8
|
+
INTENT_FIELD = "i"
|
|
9
9
|
|
|
10
10
|
# __omp_display is injected by runner.py before the prelude executes; it
|
|
11
11
|
# mirrors IPython's display() semantics with the same MIME bundle output.
|