pi-goal-x 0.32.3 → 0.34.0
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/docs/advanced-usage.md +8 -2
- package/docs/architecture.md +23 -4
- package/docs/controls.md +140 -0
- package/docs/prompt-caching.md +5 -1
- package/extensions/auditor-selector.ts +4 -2
- package/extensions/goal-auditor.ts +7 -16
- package/extensions/goal-commands.ts +85 -37
- package/extensions/goal-context.ts +12 -0
- package/extensions/goal-controls.ts +202 -0
- package/extensions/goal-core-tools.ts +9 -7
- package/extensions/goal-dialog-controls.ts +31 -0
- package/extensions/goal-draft.ts +4 -3
- package/extensions/goal-drafting.ts +10 -9
- package/extensions/goal-events.ts +72 -31
- package/extensions/goal-format.ts +3 -2
- package/extensions/goal-interruption.ts +53 -0
- package/extensions/goal-ledger.ts +6 -2
- package/extensions/goal-questionnaire.ts +34 -30
- package/extensions/goal-recovery.ts +5 -2
- package/extensions/goal-scheduler-state.ts +17 -5
- package/extensions/goal-scheduler.ts +118 -20
- package/extensions/goal-session-safety.ts +21 -8
- package/extensions/goal-settings.ts +114 -80
- package/extensions/goal-state.ts +21 -9
- package/extensions/goal-status.ts +10 -3
- package/extensions/goal-task-confirmation.ts +7 -6
- package/extensions/goal-task-tools.ts +13 -17
- package/extensions/goal-tool-inputs.ts +47 -0
- package/extensions/goal-tool-names.ts +2 -4
- package/extensions/goal-widget.ts +51 -78
- package/extensions/goal.ts +2 -4
- package/extensions/prompts/goal-prompts.ts +7 -6
- package/extensions/storage/atomic-rename.ts +52 -0
- package/extensions/storage/goal-files.ts +25 -6
- package/extensions/widgets/goal-controls-dialog.ts +329 -0
- package/extensions/widgets/goal-dashboard-model.ts +9 -2
- package/extensions/widgets/goal-dashboard-renderer.ts +15 -12
- package/extensions/widgets/goal-escape-dialog.ts +8 -7
- package/extensions/widgets/goal-widget.ts +17 -5
- package/package.json +21 -13
package/docs/advanced-usage.md
CHANGED
|
@@ -4,7 +4,13 @@ For installation, goal workflows, commands and the settings overview, see the [R
|
|
|
4
4
|
|
|
5
5
|
## Automatic continuation and optional execution contracts
|
|
6
6
|
|
|
7
|
-
Active goals continue automatically after successful executions, including reasoning-only responses and final-task verification. No tool call, task update, scheduling declaration
|
|
7
|
+
Active goals continue automatically after successful executions, including reasoning-only responses and final-task verification. No tool call, task update, or scheduling declaration is required.
|
|
8
|
+
|
|
9
|
+
Default continuation is immediate. To slow repeated replies without recognized work, enable **slow repeated idle replies (opt-in)** under Advanced execution in `/goal-settings` (`idleContinuationBackoff: true`). Use the scope switch to choose a global default or a project override. An explicit project `false` overrides global `true`; removing the override restores inheritance.
|
|
10
|
+
|
|
11
|
+
When enabled, one execution without recognized work continues immediately. Further such executions wait 30, 60, 120, 240, then 300 seconds between attempts. Work observed anywhere in the execution or a change to the objective, requirements or tasks resets the delay. Goal inspection, echo-only calls, accounting and scheduling declarations alone do not reset it. This heuristic may delay reasoning or unfamiliar custom tools, and repeated recognized tool calls can bypass it. It reduces request rate; it does not guarantee progress or finite spending. Use a run allowance or token budget for a hard limit.
|
|
12
|
+
|
|
13
|
+
The delay survives reloads and shows a relative time, local clock time and resume command. Waiting spends no autonomous runs or active time. Turning the option off cancels a pending delay promptly without renewing spent runs or resuming a paused goal. Turning it on starts observing a subsequent execution, rather than classifying work retroactively. Old saved delay metadata has no effect without opt-in. `/goal-resume` renews the run allowance and continues now; incoming user/producer messages remain ordinary host work outside that allowance. Strict waits and provider-error recovery keep their separate timing.
|
|
8
14
|
|
|
9
15
|
Enable `strictExecutionContract: true` in `/goal-settings` or your global/project settings to require explicit ready/wait decisions. In that mode, a missing decision permits one repair prompt within the remaining allowance, then pauses. This is a user preference; agents should not enable it merely to continue.
|
|
10
16
|
|
|
@@ -63,7 +69,7 @@ After confirmation, a goal stopped only by its budget can continue if the revise
|
|
|
63
69
|
|
|
64
70
|
Some Pi `openai-responses` configurations omit the wire-level `strict` flag. OpenAI Responses may normalize schemas into strict mode when that flag is omitted. This can conflict with optional goal arguments; it is separate from pi-goal-x's `strictExecutionContract` scheduling setting.
|
|
65
71
|
|
|
66
|
-
For the reported OpenCode model, a narrowly scoped Pi `models.json` override makes the
|
|
72
|
+
For the reported OpenCode model, a narrowly scoped Pi `models.json` override makes the Pi adapter send `strict: false` for ordinary tools:
|
|
67
73
|
|
|
68
74
|
```json
|
|
69
75
|
{
|
package/docs/architecture.md
CHANGED
|
@@ -249,6 +249,26 @@ token/time intervals per turn; a goal never double-charges the same interval.
|
|
|
249
249
|
`GoalRuntime` (goal-runtime.ts) owns continuation scheduling, the stale
|
|
250
250
|
checkpoint state, the turn-stop guard, and one-shot steering reminders.
|
|
251
251
|
|
|
252
|
+
`GoalScheduler` persists dispatch intent and allowance consumption. Default
|
|
253
|
+
continuation is immediate. Explicit `idleContinuationBackoff=true` also records a
|
|
254
|
+
bounded idle streak and earliest next attempt: one immediate continuation, then
|
|
255
|
+
30 seconds doubling to five minutes. Work accumulates over the whole logical run;
|
|
256
|
+
content snapshots exclude usage, revisions and scheduler writes. Disabled pacing
|
|
257
|
+
skips those snapshots. Settings are rechecked at scheduling and admission; opting
|
|
258
|
+
out removes saved delay metadata without renewing consumption. Resume and genuine
|
|
259
|
+
host input reset pacing; strict waits and provider recovery remain independent.
|
|
260
|
+
|
|
261
|
+
Pi 1.4 prepares goal-triggered turns natively. The extension uses
|
|
262
|
+
`context_with_system` to filter its messages and add current goal state after
|
|
263
|
+
Pi has restored the system prompt and tool declarations. System messages stay
|
|
264
|
+
at their original history boundaries, including deltas from other extensions.
|
|
265
|
+
`agent_settled.aborted` stops continuation/recovery and pauses the associated
|
|
266
|
+
goal. Rejected stale checkpoints settle without changing the replacement goal.
|
|
267
|
+
|
|
268
|
+
Audit display messages flush only at idle settlement and remain scoped to their
|
|
269
|
+
session. If Pi has invalidated a settlement context, the handler skips it before
|
|
270
|
+
consuming continuation intent or changing the replacement session's queue.
|
|
271
|
+
|
|
252
272
|
An optional `token_budget` may be set at creation. When accounted usage
|
|
253
273
|
reaches the budget, `accountProgress` transitions the goal to the distinct
|
|
254
274
|
`budget_limited` status exactly once (status leaves `active`, so accounting
|
|
@@ -306,11 +326,10 @@ npm run check
|
|
|
306
326
|
```
|
|
307
327
|
|
|
308
328
|
`test:unit`, `test:integration`, and `test:all` automatically discover test
|
|
309
|
-
entries and run them
|
|
329
|
+
entries and run them with small test-only adapters for the
|
|
310
330
|
SDK values used by handlers. This avoids loading unrelated model-provider and
|
|
311
|
-
TUI media modules. The fast path requires Node 22.
|
|
312
|
-
the slow, real-SDK, process-isolated
|
|
313
|
-
compatibility path. The suites cover: surface baselines (lifecycle-dependent goal tool
|
|
331
|
+
TUI media modules. The fast path requires Node 22.19+; `test:serial` remains
|
|
332
|
+
the slow, real-SDK, process-isolated alternative. The suites cover: surface baselines (lifecycle-dependent goal tool
|
|
314
333
|
profile and fourteen commands), golden file/ledger fixtures, stale-continuation behavior,
|
|
315
334
|
GoalService mutation boundary, runtime/accounting, token-budget transitions,
|
|
316
335
|
task-tool consolidation, verification contracts, the independent auditor,
|
package/docs/controls.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Commands and keys
|
|
2
|
+
|
|
3
|
+
Open `/goal-settings` and choose **Controls**, or run `/goal-settings controls`.
|
|
4
|
+
The screen has three sections: **Commands**, **Keys** and **Pausing**. Type to
|
|
5
|
+
filter, use the arrow keys and Enter to edit, and Tab to switch sections.
|
|
6
|
+
Page Up/Down moves through long lists; Home/End jumps to the first/last row.
|
|
7
|
+
Ctrl+S switches between **This project** and **All projects**. The selected row shows
|
|
8
|
+
whether its value comes from the project, global settings or the default.
|
|
9
|
+
|
|
10
|
+
Changes are saved when you choose Save or confirm a recorded key. Escape backs
|
|
11
|
+
out of an edit without saving. **Use inherited value** removes a project
|
|
12
|
+
override; **Remove global override** restores the default. **Use default** pins
|
|
13
|
+
the default in the selected scope. Each section also has a reset action that
|
|
14
|
+
removes only that section's overrides in the selected scope.
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
Each action has a preferred command followed by any aliases. Choose **Edit
|
|
19
|
+
command paths** to replace them, **Add an alias** to keep the current spellings,
|
|
20
|
+
or **Disable** to remove its command invocations. For example, add `/goal edit`
|
|
21
|
+
to **Revise the goal** to use the existing confirmation workflow with that
|
|
22
|
+
spelling. Arguments after the command path are passed through to the action.
|
|
23
|
+
Subcommands appear in argument completion; the longest matching complete path
|
|
24
|
+
wins. A routing-only root lists its available subcommands when called without
|
|
25
|
+
a matching action.
|
|
26
|
+
|
|
27
|
+
Command changes need a reload. The screen shows when changes are pending;
|
|
28
|
+
Ctrl+R applies them while Pi is idle when controls were opened through a slash
|
|
29
|
+
command. If controls were opened from a shortcut, close them and run `/reload`.
|
|
30
|
+
Keys and pause order take effect immediately.
|
|
31
|
+
|
|
32
|
+
`/goal-settings` always remains available as a recovery entry. You can give the
|
|
33
|
+
settings action other spellings, but this entry cannot be removed. Pi command
|
|
34
|
+
roots such as `/reload` and `/settings` are reserved. The editor checks conflicts
|
|
35
|
+
with other commands before saving.
|
|
36
|
+
For settings, **Recovery entry only** removes additional aliases while keeping
|
|
37
|
+
`/goal-settings` available.
|
|
38
|
+
|
|
39
|
+
The settings keys below are stable action IDs, even after renaming an invocation:
|
|
40
|
+
|
|
41
|
+
| Action ID | Action |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `goal` | Guided goal draft |
|
|
44
|
+
| `sisyphus` | Guided Sisyphus draft |
|
|
45
|
+
| `goal-direct` | Immediate goal creation |
|
|
46
|
+
| `sisyphus-direct` | Immediate Sisyphus creation |
|
|
47
|
+
| `goal-tweak` | Confirmed revision |
|
|
48
|
+
| `goal-pause` | Pause goal and stop turn |
|
|
49
|
+
| `goal-resume` | Resume and renew the run allowance |
|
|
50
|
+
| `goal-clear` | Confirmed archival |
|
|
51
|
+
| `goal-list` | List open goals |
|
|
52
|
+
| `goal-status` | Status; also accepts `verbose` or `health` |
|
|
53
|
+
| `goal-refresh` | Read state and settings again |
|
|
54
|
+
| `goal-recovery` | Recovery report; also accepts `repair` |
|
|
55
|
+
| `goal-focus` | Choose a goal |
|
|
56
|
+
| `goal-unfocus` | Detach this session |
|
|
57
|
+
| `goal-settings` | Settings and controls |
|
|
58
|
+
| `goal-cancel` | Cancel a draft |
|
|
59
|
+
|
|
60
|
+
## Keys
|
|
61
|
+
|
|
62
|
+
Choose an action under **Keys**, then record a key or edit its Pi key names.
|
|
63
|
+
**Record another key** adds a second binding. **Disable** leaves it unbound.
|
|
64
|
+
Conflicts are checked before saving; errors leave your input available to fix.
|
|
65
|
+
Use a free key or change a conflicting Pi binding in its `keybindings.json`.
|
|
66
|
+
|
|
67
|
+
Every public goal shortcut is listed: pause, audit interruption, auditor toggle,
|
|
68
|
+
dashboard expansion, compact scrolling, expanded navigation, and goal dialog
|
|
69
|
+
controls. Each command action can also have a shortcut, independently of its
|
|
70
|
+
slash command names. A shortcut for direct creation or revision asks for the
|
|
71
|
+
objective or change before invoking the usual workflow.
|
|
72
|
+
|
|
73
|
+
Goal dialog controls apply to questionnaires and confirmation dialogs. They
|
|
74
|
+
have their own context, so the same key can confirm a dialog and pause a live
|
|
75
|
+
goal. Text editing and the settings screen use Pi's usual UI controls. The
|
|
76
|
+
settings screen remains usable when you change goal dialog navigation.
|
|
77
|
+
While typing an answer, letters and Pi's editing keys keep editing text. Escape
|
|
78
|
+
leaves the answer editor; free custom keys such as F7 can do the same.
|
|
79
|
+
|
|
80
|
+
Pi key names include `escape`, `f6`, `ctrl+alt+p`, `pageUp` and `super+k`. Multiple
|
|
81
|
+
keys can be separated with commas. For a comma key combined with other bindings,
|
|
82
|
+
the text editor also accepts a JSON key list, for example `["ctrl+,", "f6"]`.
|
|
83
|
+
Existing comma-key lists reopen in this form so they can be saved unchanged.
|
|
84
|
+
Terminals must report a key before Pi can use it; some modifier combinations
|
|
85
|
+
require the Kitty keyboard protocol. See [Pi's keybinding reference](https://github.com/earendil-works/pi/blob/v1.4.0/packages/coding-agent/docs/keybindings.md).
|
|
86
|
+
|
|
87
|
+
## Pausing
|
|
88
|
+
|
|
89
|
+
The default is still Escape, with **Goal and turn together**. An open dialog
|
|
90
|
+
owns its input; closing the expanded dashboard or interrupting an audit takes
|
|
91
|
+
priority over pausing in that view.
|
|
92
|
+
|
|
93
|
+
| Pause order | First press | Next press |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| Goal and turn together | Pause the goal and stop the turn | Pi's normal interrupt |
|
|
96
|
+
| Goal first | Pause the goal; let the current turn finish | Stop the remaining turn |
|
|
97
|
+
| Turn first | Stop the turn and wait for the user, keeping the goal active | Pause the goal |
|
|
98
|
+
|
|
99
|
+
Goal first finishes the current Pi turn, then stops before another model
|
|
100
|
+
request. A turn-only stop holds automatic continuation, provider recovery and wake-ups.
|
|
101
|
+
It does not spend another run allowance. Resume or send a new user message to
|
|
102
|
+
continue. Reloading an interrupted autonomous run does not replay it.
|
|
103
|
+
|
|
104
|
+
When you move the pause key away from Pi's interrupt key, Pi's interrupt stops
|
|
105
|
+
the turn and waits for you without pausing the goal. The configured pause key
|
|
106
|
+
uses the selected order. The explicit **Pause the goal** command always stops
|
|
107
|
+
both the goal and its turn, including a turn left running by **Goal first**.
|
|
108
|
+
|
|
109
|
+
## Settings files
|
|
110
|
+
|
|
111
|
+
The UI writes the existing sparse settings layers:
|
|
112
|
+
|
|
113
|
+
- Global: `${PI_CODING_AGENT_DIR:-~/.pi/agent}/pi-goal-x-settings.json`.
|
|
114
|
+
- Project: `<project>/.pi/pi-goal-x-settings.json`.
|
|
115
|
+
|
|
116
|
+
Project leaves override global leaves. Missing leaves inherit; an empty list
|
|
117
|
+
explicitly disables an action. Existing `keybindings.dashboard` settings keep
|
|
118
|
+
their meaning. For example:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"commands": {
|
|
123
|
+
"goal-tweak": ["goal-tweak", "goal edit"],
|
|
124
|
+
"goal-resume": ["work continue"]
|
|
125
|
+
},
|
|
126
|
+
"pauseOrder": "turn-first",
|
|
127
|
+
"keybindings": {
|
|
128
|
+
"pause": ["f6", "ctrl+alt+p"],
|
|
129
|
+
"toggleAuditor": "ctrl+alt+a",
|
|
130
|
+
"interruptAudit": "escape",
|
|
131
|
+
"dashboard": { "toggleExpand": "ctrl+alt+t" },
|
|
132
|
+
"dialog": { "confirm": "enter", "cancel": "escape" },
|
|
133
|
+
"commands": { "goal-settings": "f10", "goal-status": [] }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Use `/goal-refresh` after external key or pause-order edits, and `/reload` after
|
|
139
|
+
external command edits. Verbose goal status reports the effective controls and
|
|
140
|
+
their sources. Developer-only `PI_GOAL_DEBUG` shortcuts are unchanged.
|
package/docs/prompt-caching.md
CHANGED
|
@@ -10,11 +10,15 @@ The request layout is:
|
|
|
10
10
|
|
|
11
11
|
Changing goal state never rewrites the system prompt or historical messages. The full goal-state message is not persisted into the session. Old checkpoints remain until Pi compacts history; retaining small markers avoids shifting the prefix on every continuation. Display-only auditor messages are consistently excluded, and tool calls stay adjacent to their results.
|
|
12
12
|
|
|
13
|
+
Goal context filtering and live-state tails use Pi's `context_with_system` event, preserving system and tool deltas in their original positions. Parent and delegated sessions use this hook from their first request.
|
|
14
|
+
|
|
13
15
|
For Anthropic-style explicit caching, the extension moves Pi's existing cache_control breakpoint from the transient state message onto the preceding cacheable history block. The Bedrock equivalent moves the cachePoint. Both preserve the configured TTL and do not add breakpoints. Payloads without an existing explicit marker—including caching disabled and implicit-cache providers—receive no marker changes. The extension does not set cache keys, enable paid extended retention, or replace provider defaults.
|
|
14
16
|
|
|
15
17
|
Execution tools already use an idempotent profile: goal progress, focus, and lifecycle changes do not change schemas. Explicit switches into/out of drafting and changes to disableTasks can change tools and legitimately rebuild the cache. Drafting messages are appended to conversation history. Isolated auditor and Oracle sessions already use fixed instructions/tool profiles and place goal-specific evidence in their user messages; their tool loops retain history. They have separate sessions and use Pi's cache defaults. Opting these sessions into project resources also opts into any behavior from those resources.
|
|
16
18
|
|
|
17
|
-
Cache reuse can still be interrupted by Pi compaction, branch/session changes, model/provider switches, other extensions changing earlier content, changed tool schemas, provider expiry, minimum-length or breakpoint-lookback limits, or routing. The extension cannot guarantee a hit rate or a particular cost reduction. The supported
|
|
19
|
+
Cache reuse can still be interrupted by Pi compaction, branch/session changes, model/provider switches, other extensions changing earlier content, changed tool schemas, provider expiry, minimum-length or breakpoint-lookback limits, or routing. The extension cannot guarantee a hit rate or a particular cost reduction. The supported host range is Pi 1.4+ within 1.x, with Node 22.19 or newer. Development dependencies pin Pi 1.4.0.
|
|
20
|
+
|
|
21
|
+
Pi 1.4 prepares custom-triggered turns through the same public startup protocol as user prompts. The extension leaves structured prompt and tool deltas intact, including additional sections supplied by other extensions. Direct creation, drafting, resume and reload use the host's native prompt preparation from the first request. Explicit tool-profile changes can still rebuild the prefix.
|
|
18
22
|
|
|
19
23
|
Validation includes consecutive request-prefix regressions; actual Anthropic, Anthropic-compatible Chat Completions, OpenAI Chat Completions and Responses serialization with short/long/disabled retention; Bedrock payload-shape checks; lifecycle/tool-pair safety tests; and full SDK parent/auditor/Oracle payload captures. These tests stop before HTTP dispatch. They verify request construction, not live provider hit rates.
|
|
20
24
|
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* current-session/default choice (which clears the explicit provider/model),
|
|
6
6
|
* authenticated models from the model registry (with a ✓ marker on the exact
|
|
7
7
|
* current selection), and an advanced manual `provider/model` entry. The
|
|
8
|
-
* thinking-level row offers
|
|
8
|
+
* thinking-level row offers Pi's seven levels or `(default)`.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { GOAL_THINKING_LEVELS } from "./goal-settings.ts";
|
|
12
|
+
|
|
11
13
|
export type AuditorModelSummary = { provider: string; id: string; name?: string };
|
|
12
14
|
|
|
13
15
|
export type AuditorChoice =
|
|
@@ -15,7 +17,7 @@ export type AuditorChoice =
|
|
|
15
17
|
| { kind: "model"; provider: string; model: string; label: string }
|
|
16
18
|
| { kind: "manual"; label: string };
|
|
17
19
|
|
|
18
|
-
export const AUDITOR_THINKING_LEVELS =
|
|
20
|
+
export const AUDITOR_THINKING_LEVELS = GOAL_THINKING_LEVELS;
|
|
19
21
|
|
|
20
22
|
export function auditorModelLabel(model: AuditorModelSummary): string {
|
|
21
23
|
return `${model.provider}/${model.id}${model.name && model.name !== model.id ? ` — ${model.name}` : ""}`;
|
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
SessionManager,
|
|
11
11
|
SettingsManager,
|
|
12
12
|
type ExtensionContext,
|
|
13
|
+
type ModelRuntime,
|
|
13
14
|
type ResourceLoader,
|
|
14
15
|
} from "@earendil-works/pi-coding-agent";
|
|
15
16
|
import type { GoalRecord, GoalTask, GoalTaskList } from "./goal-record.ts";
|
|
16
17
|
import { countTaskSubtree } from "./goal-task-count.ts";
|
|
17
|
-
import { loadGoalSettings, type GoalSettings, type ThinkingLevel } from "./goal-settings.ts";
|
|
18
|
+
import { GOAL_THINKING_LEVELS, loadGoalSettings, type GoalSettings, type ThinkingLevel } from "./goal-settings.ts";
|
|
18
19
|
import { statusLabel } from "./goal-core.ts";
|
|
19
20
|
|
|
20
21
|
export interface AuditorProgress {
|
|
@@ -47,7 +48,7 @@ export interface GoalAuditorResult {
|
|
|
47
48
|
error?: string;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
const THINKING_LEVELS = new Set(
|
|
51
|
+
const THINKING_LEVELS = new Set<string>(GOAL_THINKING_LEVELS);
|
|
51
52
|
|
|
52
53
|
function asNonEmptyString(value: unknown): string | undefined {
|
|
53
54
|
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
@@ -277,25 +278,15 @@ export function resolveAuditorModel(ctx: ExtensionContext, config: GoalSettings)
|
|
|
277
278
|
/**
|
|
278
279
|
* Options that reuse the parent session's auth + registered providers for the nested auditor.
|
|
279
280
|
*
|
|
280
|
-
* Pi
|
|
281
|
-
* ExtensionContext still exposes `modelRegistry`, which wraps the live ModelRuntime.
|
|
281
|
+
* Pi 1.4's extension ModelRegistry wraps the live ModelRuntime.
|
|
282
282
|
* Sharing that runtime keeps extension providers such as `pi-cursor-sdk`'s `cursor`
|
|
283
283
|
* provider (and its auth) available. Without this, the auditor builds a fresh runtime
|
|
284
284
|
* with an empty resource loader, so Cursor models fail with "No API key found for cursor"
|
|
285
285
|
* even when `~/.pi/agent/auth.json` has a Cursor key.
|
|
286
|
-
*
|
|
287
|
-
* Older SDKs still accept `modelRegistry`; pass both for compatibility.
|
|
288
286
|
*/
|
|
289
|
-
export function resolveAuditorSessionModelOptions(ctx: ExtensionContext): {
|
|
290
|
-
modelRegistry
|
|
291
|
-
modelRuntime
|
|
292
|
-
} {
|
|
293
|
-
const registry = ctx.modelRegistry as unknown as { runtime?: unknown } | undefined;
|
|
294
|
-
const runtime = registry?.runtime;
|
|
295
|
-
if (runtime) {
|
|
296
|
-
return { modelRegistry: ctx.modelRegistry, modelRuntime: runtime };
|
|
297
|
-
}
|
|
298
|
-
return { modelRegistry: ctx.modelRegistry };
|
|
287
|
+
export function resolveAuditorSessionModelOptions(ctx: ExtensionContext): { modelRuntime?: ModelRuntime } {
|
|
288
|
+
const registry = ctx.modelRegistry as unknown as { runtime?: ModelRuntime } | undefined;
|
|
289
|
+
return { modelRuntime: registry?.runtime };
|
|
299
290
|
}
|
|
300
291
|
|
|
301
292
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- pi SDK types Model<any> idiomatically (pi-coding-agent sdk.d.ts)
|