pi-openai-toolkit 0.23.2 → 0.24.1

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.
Files changed (54) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +83 -83
  3. package/README.md +4 -15
  4. package/README.zh.md +4 -15
  5. package/config.schema.json +264 -278
  6. package/docs/configuration.md +304 -306
  7. package/docs/internals.md +34 -120
  8. package/package.json +123 -136
  9. package/src/compact-client.ts +412 -412
  10. package/src/compaction-projection.ts +35 -35
  11. package/src/config/legacy.ts +469 -519
  12. package/src/config/migration.ts +115 -103
  13. package/src/config/notifications.ts +46 -36
  14. package/src/config/policy.ts +115 -116
  15. package/src/config/v2.ts +1128 -1167
  16. package/src/config.ts +320 -310
  17. package/src/debug.ts +238 -238
  18. package/src/deferred-tool-carryover.ts +282 -282
  19. package/src/details-store.ts +151 -151
  20. package/src/extension-runtime.ts +1095 -1919
  21. package/src/image-generation/extension.ts +189 -189
  22. package/src/image-generation/protocol.ts +579 -579
  23. package/src/image-generation/types.ts +300 -300
  24. package/src/native-fallback.ts +140 -152
  25. package/src/payload-rewrite.ts +515 -515
  26. package/src/pi-context-hook.ts +117 -117
  27. package/src/remote-v2-client.ts +811 -811
  28. package/src/request-context-cache.ts +155 -155
  29. package/src/responses-headers.ts +180 -180
  30. package/src/retired-remote-windows.ts +35 -0
  31. package/src/runtime.ts +875 -865
  32. package/src/serializer.ts +882 -882
  33. package/src/supported-environment.ts +27 -27
  34. package/src/types.ts +541 -565
  35. package/src/web-search/alpha-client.ts +876 -876
  36. package/src/web-search/extension.ts +530 -530
  37. package/src/web-search/payload.ts +299 -299
  38. package/src/web-search/prompt.ts +60 -60
  39. package/src/web-search/types.ts +166 -166
  40. package/tsconfig.check.json +50 -50
  41. package/src/context-management/codex-provider.ts +0 -270
  42. package/src/context-management/history-notes.ts +0 -357
  43. package/src/context-management/manual-compact.ts +0 -247
  44. package/src/context-management/messages.ts +0 -238
  45. package/src/context-management/namespace-tools.ts +0 -426
  46. package/src/context-management/responses-tools.ts +0 -238
  47. package/src/context-management/scoped-compaction.ts +0 -89
  48. package/src/context-management/tool-contract.ts +0 -62
  49. package/src/context-management/tools.ts +0 -371
  50. package/src/context-management/types.ts +0 -168
  51. package/src/context-management/window-budget.ts +0 -83
  52. package/src/context-management/window-bulk.ts +0 -155
  53. package/src/context-management/window-manager.ts +0 -912
  54. package/src/context-management/window-request.ts +0 -125
package/docs/internals.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Toolkit Internals
2
2
 
3
- Developer-facing reference for [pi-openai-toolkit](../README.md). The README keeps this protocol and implementation detail out of the installation path. If you are changing wire behavior, fixtures, or the compaction strategy code, start here.
3
+ Developer-facing reference for [pi-openai-toolkit](../README.md). See the [configuration reference](configuration.md) for supported settings and retirement guidance.
4
4
 
5
5
  ---
6
6
 
@@ -8,9 +8,7 @@ Developer-facing reference for [pi-openai-toolkit](../README.md). The README kee
8
8
 
9
9
  - [Configuration resolution](#configuration-resolution)
10
10
  - [Codex Fast session control](#codex-fast-session-control)
11
- - [Remote Context protocol](#remote-context-protocol)
12
- - [Rollover lifecycle](#rollover-lifecycle)
13
- - [Managed manual compact](#managed-manual-compact)
11
+ - [Remote Windows retirement](#remote-windows-retirement)
14
12
  - [Remote Compaction v2 wire contract](#remote-compaction-v2-wire-contract)
15
13
  - [Artifacts and debugging](#artifacts-and-debugging)
16
14
  - [Provenance](#provenance)
@@ -19,166 +17,82 @@ Developer-facing reference for [pi-openai-toolkit](../README.md). The README kee
19
17
 
20
18
  ### Configuration resolution
21
19
 
22
- The single global document is loaded through [src/config.ts](../src/config.ts). [src/config/legacy.ts](../src/config/legacy.ts) owns unversioned compatibility; [src/config/v2.ts](../src/config/v2.ts) validates v2 scopes, resolves exact policy, and records leaf origins. [src/config/policy.ts](../src/config/policy.ts) defines effective values independently of persisted session data. See the [configuration reference](configuration.md) for supported fields and migration limits.
20
+ The single global document is loaded through [src/config.ts](../src/config.ts). [src/config/legacy.ts](../src/config/legacy.ts) owns unversioned compatibility; [src/config/v2.ts](../src/config/v2.ts) validates v2 scopes, resolves exact policy, and records leaf origins. [src/config/policy.ts](../src/config/policy.ts) defines effective values independently of persisted session data.
23
21
 
24
- Feature entrypoints resolve once per public operation and pass that immutable snapshot through awaited helpers. A separately named compaction producer is resolved from the same decoded document for its own identity. Subsequent independent callbacks reload; a compression uses its initiating policy snapshot. Legacy recovery reads only its persisted owned selection record and never initiates a handoff. There is no general cross-event provider transaction, project lookup, singleton cache, or config state writer. Internal legacy-shaped engine adapters preserve compaction/search algorithms without exposing v2 parsing to consumers. Cross-feature gateway policy belongs to the resolver, not the context enable switch.
22
+ Feature entrypoints resolve once per public operation and pass that immutable snapshot through awaited helpers. A separately named compaction producer is resolved from the same decoded document for its own identity. Subsequent independent callbacks reload. There is no general cross-event provider transaction, project lookup, singleton policy cache, or config writer. Shared gateway compatibility belongs to the resolver, independently of context mode.
25
23
 
26
- Selected invalid policy blocks dependent operations; unrelated model errors remain reportable without replacing the selected model. Retired `autoMode` sections are ignored with a warning; they never create effective policy or invalidate other features. Image choices are checked before auth, uploads, or paid requests. The human `/toolkit-config` command inspects effective values, validation, or a migration candidate without action APIs or network access. Migration is preview-only; source bytes and unknown/dormant content stay untouched.
24
+ Selected invalid policy blocks dependent operations; unrelated model errors remain reportable without replacing the selected policy. Retired Auto Mode and ancillary window sections are ignored with controlled warnings and create no effective policy. Selecting the removed window mode blocks context instead of implicitly choosing another route. Image choices are checked before auth, uploads, or paid requests. Human /toolkit-config commands inspect effective values, validation or preview-only migration without action APIs or network access; source bytes remain unchanged.
27
25
 
28
26
  ---
29
27
 
30
28
  ### Codex Fast session control
31
29
 
32
- [src/codex-fast/extension.ts](../src/codex-fast/extension.ts) registers the human-only, no-argument `/fast` toggle and an owned `ctx.ui.setStatus()` item. The command accepts UI-backed TUI/RPC (including pi-web) and older UI contexts without `mode`; print/JSON and headless commands cannot toggle. Notifications confirm changes, while status rendering belongs to the client. Default OFF requests `service_tier: "default"`; ON requests `"priority"`, the Codex Fast wire value. The status is the local request preference, not verified server acceptance or latency. Fast can increase usage/cost. No config setting, model tool, credential probe, retry, new header, reasoning-effort change or custom footer is added.
30
+ [src/codex-fast/extension.ts](../src/codex-fast/extension.ts) registers the human-only, no-argument /fast toggle and an owned ctx.ui.setStatus() item. It accepts UI-backed TUI/RPC (including pi-web) and older UI contexts without mode; print/JSON and headless commands cannot toggle. Notifications confirm changes, while rendering belongs to the client. Default OFF requests service_tier default; ON requests priority. This is the local request preference, not verified backend acceleration. Fast may increase cost; no config setting, model tool, credential probe, reasoning change or custom footer is added.
33
31
 
34
- Native `openai-codex-responses` routes qualify. Non-official HTTP(S) `openai-responses` gateways qualify for recognizable GPT/Codex IDs or an existing exact Codex gateway identity, including a resolved virtual route. Unknown opaque aliases without that identity, Azure, other APIs and ordinary `api.openai.com` API-key routes remain untouched. A capability marker is not backend entitlement.
32
+ Native openai-codex-responses routes qualify. Non-official HTTP(S) openai-responses gateways qualify for recognizable GPT/Codex IDs or an exact Codex gateway identity, including a resolved virtual route. Unknown opaque aliases without that identity, Azure, other APIs and ordinary api.openai.com API-key routes remain untouched. Capability does not establish entitlement.
35
33
 
36
- Version-1 `pi-openai-toolkit:codex-fast` custom entries contain only the owning Pi `sessionId` and `enabled` boolean. They are excluded from model context. Reload/resume and active-branch navigation reconstruct the latest valid owned preference; malformed latest metadata defaults OFF. Independent new/forked sessions ignore copied foreign preferences and start OFF. Remote window UUID changes do not reset the Pi session selection. A model switch shows N/A without discarding it. Missing identity or a failed append does not report a successful toggle.
34
+ Version-1 pi-openai-toolkit:codex-fast entries contain only the owning Pi sessionId and enabled boolean and stay outside model context. Reload/resume and active-branch navigation restore the latest valid owned preference; malformed latest metadata defaults OFF. New/forked sessions ignore foreign preferences and start OFF. Model switches show N/A without discarding the saved preference. Missing identity or a failed append cannot report success.
37
35
 
38
- The payload hook takes one selection snapshot and returns a new object only when a matching ordinary Responses request needs a tier change. Explicit OFF also overrides an existing Fast/Flex tier to Standard. Dedicated compaction shapes and malformed/foreign payloads are left unchanged. Fast loads after Web Search/image registration and before the final Astra effort pass, so its tier does not alter the pre-search cached extras used by separate search/image/compaction clients.
39
-
40
- Native Pi and Toolkit gateway WebSocket adapters already compare non-input body fields before incremental reuse. A changed `service_tier` invalidates the incompatible `previous_response_id` delta; the existing transport/retry logic is retained. Offline official-Pi fixtures in [test/pi-codex-fast.test.ts](../test/pi-codex-fast.test.ts) cover TUI/RPC command/status/notifications, actual native/gateway HTTP/WebSocket bodies, saved reopen/reload, fork isolation and continuation transitions. They do not establish live Fast availability.
41
-
42
- ---
43
-
44
- ### Remote Context protocol
45
-
46
- Internal alpha endpoints, adapted from `@howaboua/pi-codex-conversion`:
47
-
48
- ```text
49
- POST {base}/alpha/history/v2/list_windows | list_items | read_item | search_contents
50
- POST {base}/alpha/notes/v2/list_files_by_prefix | read_file | search_contents | append_to_file | write_file
51
- POST {base}/alpha/notes/v2/thread_hint
52
- ```
53
-
54
- The native route uses `{base} = <backend-api>/codex` with `Authorization: Bearer <oauth token>`, `ChatGPT-Account-ID`, and Codex CLI headers. The gateway route uses the configured `/v1` base with the API key configured for that provider, `originator: codex_cli_rs`, `X-Codex-Affinity-Scope`, and `X-Codex-Model` carrying the bare model ID. Inherited OAuth headers, cookies, and account IDs are stripped before the request leaves the process. Both routes set `Session-Id` and `X-Client-Request-Id` to the bounded Pi session ID, plus `x-openai-tool-output-truncation-policy` and `x-openai-encrypted-tool-arguments` for endpoints with encrypted parameters. Encrypted results come back as `encrypted_output` and are re-encoded into later requests. These are alpha contracts, so the upstream backend may change them at any time.
55
-
56
- Search text and note bodies are sent under the encrypted-argument policy. Live model requests carry `x-codex-window-id` and `x-codex-turn-metadata` request headers derived from the active window identity.
57
-
58
- Coverage is never inferred from model names. A native session uses provider `openai-codex` with API `openai-codex-responses` for any model ID. A gateway session uses API `openai-responses` and must carry an exact `provider/model` key whose `models[exact].compatibility.transport` is `"codex-gateway"` (legacy `compaction.gatewayContextModels`); no gateway is opted in by default. See [src/context-management/codex-provider.ts](../src/context-management/codex-provider.ts). The toolkit registers no provider or model with Pi. It resolves credentials and base URLs through Pi's `ModelRegistry`.
59
-
60
- ---
61
-
62
- ### Tool-selection boundary and unavailable Context Management
63
-
64
- The four Toolkit context tools are `new_context`, `get_context_remaining`, `history`, and `notes`. The canonical names live in [src/context-management/tool-contract.ts](../src/context-management/tool-contract.ts). A launcher that creates a Pi session for an exact `compaction.gatewayContextModels` model should union those names into an explicit `tools` allowlist before `createAgentSession`, unless the caller selected `noTools`/`--no-tools`; an explicit `excludeTools` entry remains authoritative and is never re-added. This package does not contain the `pi-subagent` or child-session launcher source, so the helper and contract here do not claim to modify that external layer.
65
-
66
- After registration, Pi's published registry is authoritative. Toolkit distinguishes `verified` (all four owned definitions), `excluded` (a readable registry contains none of them), `unverified` (a transient read or partial publication), and `conflict` (registration/API/ownership failure). Only `excluded` is a live-turn downgrade: `context_with_system` applies the safe local projection at any effective inherited window boundary and strips internal markers, provider payload/header hooks return no-op results, and the lifecycle artifact records `context-tools-excluded`. Without an owned boundary, ordinary child requests remain unchanged apart from marker filtering. Conflicts, unreadable/partial registries, malformed window state and missing gateway identity remain fail-closed for live provider requests.
67
-
68
- If a covered Remote Context session reaches `session_before_compact` without an active context runtime, the first compaction path is the configured `compaction.remoteCompactModel` through Remote V2. The active session model remains the checkpoint consumer; the configured remote model is only the compactor. If that model is missing/unusable, only an explicitly configured/enabled `nativeFallback.model` may run. Otherwise the hook cancels rather than silently invoking the active model or Pi's default compaction. This compaction fallback does not weaken the live-provider safety rules above.
36
+ The payload hook snapshots selection and returns a new object only when an eligible ordinary request needs a tier change. Explicit OFF overrides existing Fast/Flex preferences to Standard. Compaction shapes and malformed/foreign payloads stay unchanged. Fast loads after Web Search/images and before Astra; it cannot change pre-search extras cached for separate clients. Native and Toolkit gateway WebSocket adapters compare non-input body fields, so a tier change invalidates an incompatible previous_response_id delta. Offline actual-encoder fixtures live in [test/pi-codex-fast.test.ts](../test/pi-codex-fast.test.ts), not live Fast availability evidence.
69
37
 
70
38
  ---
71
39
 
72
- ### Rollover lifecycle
73
-
74
- The `new_context` happy path, end to end:
75
-
76
- ```mermaid
77
- sequenceDiagram
78
- accTitle: Remote Context rollover
79
- accDescr: A Pi model checkpoints notes, requests a local new_context boundary, and sends the next request with the new window identity.
80
- participant Model
81
- participant Toolkit
82
- participant Pi
83
- participant Backend
84
- Model->>Toolkit: notes append_to_file (checkpoint)
85
- Toolkit->>Backend: alpha notes request (encrypted args)
86
- Backend-->>Toolkit: encrypted_output
87
- Model->>Toolkit: new_context
88
- Toolkit->>Toolkit: verify successful notes write in this window
89
- Toolkit-->>Model: checkpoint receipt with the successful note path
90
- Toolkit-->>Pi: new window marker persisted
91
- Note over Model: Context switch is complete; read the receipt once, then resume the active task
92
- Model->>Backend: next request with the new x-codex-window-id
93
- Pi->>Toolkit: session_before_compact
94
- Toolkit->>Toolkit: resolve boundary against Pi's effective context
95
- Toolkit-->>Pi: safe no-summary boundary, or cancel obsolete cleanup
96
- ```
97
-
98
- State invariants the lifecycle code must keep honest:
99
-
100
- - The checkpoint gate verifies a successful `notes` `append_to_file` or `write_file` against the persisted session branch after the latest window boundary, so it survives restarts and forks. A response with `ok: false` or `success: false` is not successful, even when HTTP returns 200.
101
- - The gate uses the live session/branch identity from `ctx.sessionManager`; cached manager identity must not hide a valid current-window pair, and old or foreign-session evidence must remain rejected.
102
- - Every rollover carries the most recent successful checkpoint path in its handoff message. The optional `thread_hint` is supplemental; a hint failure must not erase the local receipt.
103
- - A successful rollover closes the pre-rollover checkpoint phase. The first turn in the new window reads the receipt once and resumes the active user task; it must not immediately create another checkpoint or call `new_context` as part of that handoff. A later checkpoint is only for a later rollover, and `canRolloverFromCurrentWindow()` enforces it: a window entered by a rollover has to produce a tool result from a tool that is not one of `new_context`, `get_context_remaining`, `history`, or `notes` before it can roll over again.
104
- - Pi 0.87 separates conversation-only `context` handlers from full-transcript `context_with_system` handlers. Toolkit uses the latter to trim windows and re-anchor the merged prompt/tool state with `preserveSystemHead()`. The output owns its leading system message; Pi does not repair it after this phase.
105
- - When even that rebuild would lose declared tools, the trim is refused and the full message list is sent: a window that still carries the previous turns is usable, a window with no tools silently degrades into a chat the model can only narrate. Each refusal is reported once per window and lost-tool set through `takeProjectionDiagnostics()`, which writes a `context.projection.tool_loadout_shrink` compaction artifact and warns in the UI.
106
- - The manager also remembers the head it last anchored. When a boundary compaction retires the transcript entry that declared the tools, the branch itself no longer contains a system message, and the remembered head is re-anchored instead of sending a tool-less window. The cache is request-time only, refreshed by every projection, and cleared by `reset()`.
107
- - `new_context` has no force escape hatch: a persisted successful notes checkpoint in the current window is always required before rollover. The model must wait for the notes result to be persisted before retrying.
108
- - After a marker is accepted for sending, the manager keeps a session/window-anchored pending guard until that exact target marker is persisted or the session changes. A duplicate `new_context` during this persistence gap returns `started: false` and sends no second marker; projected/in-memory messages do not retire the guard. The exact queued target can already trim the current Remote request and select its metadata, but this preview is recomputed per request and never authorizes maintenance compaction before persistence.
109
- - Budget checks are skipped until the current window has produced its own assistant usage. Acting on the previous window's usage anchor would burn the once-per-window reminder on a false alarm.
110
- - Pi's canonical session projection is the source of effective history. Toolkit may further restrict that projection, but never reconstruct omitted or summarized messages from the raw branch. Boundary resolution uses projected source entries and the active branch's latest compaction; an older marker retained inside a newer compaction does not authorize dropping that compaction's summary.
111
- - Window identity and cleanup eligibility are separate. A persisted `codex-context-window` message restores identity after reload/fork, but its historical `trimPreviousWindow` flag is not an outstanding command. A newer native summary or opaque checkpoint supersedes old cleanup without erasing window identity. Missing or edited boundary evidence is never repaired by loading raw history.
112
- - Genuine owned rollover maintenance may persist a safe no-summary boundary. It must not move the retained start backwards or replace a newer summary/checkpoint. User `/compact` and remote-compaction threshold/overflow do not treat that cleanup as successful compression: they prepare a strictly scoped current-window input and complete actual compression in the same host operation. Preparation alone changes no durable state.
113
- - An effective persisted window boundary belongs to the session, not the selected model or context mode. `context_with_system`, `before_provider_request`, and `session_before_compact` synchronize it before mode-specific exits, including `remote-compaction`, `pi`, and legacy disabled/off selections. A non-window consumer receives only the effective current context, with the current system/tool head preserved and internal markers removed; no Remote tools, metadata or affinity headers are activated by the local safety check. A pre-window opaque checkpoint cannot rehydrate retired history after local projection. A historical boundary limits the input of configured, remote, native and Pi-default compactors; it does not select an engine or cause an intermediate no-summary commit. Once a later ordinary compaction owns effective context, the historical window does not suppress its summary or valid opaque replay. A genuinely new window can retire that checkpoint. Disabling opaque checkpoint generation through `responsesApis` does not disable required replay of an inherited checkpoint; an unsupported transport, authentication failure, or endpoint mismatch aborts the request instead of exposing its placeholder. The legacy `leaveManagedMode` setting remains compatible but does not start a bulk close-out from `model_select` or `agent_settled`.
114
- - Native text summarization delegates prompt construction, tool-result truncation, split-turn requests and output limits to Pi's `compact()`. Toolkit does not use character-count estimates to reject the configured summary model. If its resolution, authentication or summary generation fails, compaction is cancelled with the error and context is preserved; the active model is not an implicit retry target. Disabled/unset/same-model selections retain native current-model policy. If the host preparation contains retired windows, a scoped adapter must produce the genuine native result instead of returning undefined with unsafe input. Remote-window projection excludes retired history before every producer call.
115
-
116
- ---
40
+ ### Remote Windows retirement
117
41
 
118
- ### Managed manual compact
42
+ Remote Windows and its execution/compatibility chain are removed: no window tools, history/notes/thread-hint client, window metadata/ingest rewriting, reminders, rollover, maintenance, scoped-window compaction or manual selection recovery remain. Shared ordinary gateway/auth/session-affinity support is separate and retained.
119
43
 
120
- There is no dedicated Remote Windows user `/compact` execution or post-idle continuation. The built-in command and Pi scheduler remain unchanged. Engine selection is independent of persisted window ownership:
44
+ A minimal pure detector recognizes reserved evidence on the **current branch**: codex-context-window custom messages, cleanup compaction strategies or the exact old no-summary sentinel, and pi-openai-toolkit:manual-compact custom records. Malformed, terminal or superseded evidence is also refused; abandoned sibling entries do not affect a clean branch. No old ownership/projector is reconstructed.
121
45
 
122
- 1. Recognize explicitly owned rollover maintenance before user-manual routing, even though both can have reason `manual`.
123
- 2. Only effective `context.mode=remote-compaction` chooses Toolkit's ordinary remote/fallback policy. `remote-windows` and `pi` select Pi native text compression, not the Toolkit producer or configured fallback.
124
- 3. Build immutable current-window input from Pi's canonical projection whenever a window constrains context. Exclude retired plaintext, opaque checkpoints and file-operation metadata. Preserve the current prompt/tools, edits, complete tool pairs, owning checkpoint and real retained source IDs. Missing ownership or unsafe head repair cancels instead of reopening raw history.
125
- 4. Remote compression uses the entire scoped window, including verified opaque replay and current tool declarations. Hook-source preparation executes both ordered phases once in a read-only async scope; legacy skips those hooks. Native compression rebuilds cut/split-prefix/previous-summary/file-operation preparation within the same scope. Merely filtering messages or cloning a hook event cannot make an unsafe host default preparation safe.
126
- 5. Native execution uses public `compact()` with bound `ctx.modelRegistry.streamSimple`, model-specific auth/base URL/env and current thinking. The extension context does not expose host-private custom stream/retry callbacks; unscoped defaults remain host-owned. An existing opaque owner, even with malformed reserved details, cannot be merged by text summarization: cancel native/default/fallback and preserve it. A compatible remote compactor may still replay it; never resurrect its retired plaintext.
127
- 6. Return actual compressed output to Pi for normal persistence. No intermediate cleanup commit, model switch, notes-writing duty, window rollover or synthetic continuation is part of user `/compact`. General cancellation and ownership checks remain required through consumption of the hook result; host queues stay untouched.
46
+ Full-context and provider-dispatch boundaries abort legacy-window requests before old plaintext/sentinels can be transmitted. Compression returns an explicit cancellation before remote, standalone, native or host-default dispatch, including Pi/disabled modes. Throwing alone is insufficient because Pi can treat a rejected before-compact hook as absent. Startup/navigation notices do not replace per-operation checks.
128
47
 
129
- Normal notes/history and explicit `new_context` are preserved. The raw session JSONL retains previous windows for audit; the backend history/notes APIs are separate storage. Request-time filtering is not a durable isolation guarantee when the extension never loads: Pi recognizes native compaction cutoffs, not Toolkit window markers by themselves.
130
-
131
- Pi's pre-hook empty/already-compacted outcomes remain unchanged. A legacy session already ending at no-summary cleanup must receive a genuine new user entry before retrying. Toolkit does not fabricate entries, rewrite old logs or patch host eligibility. Old version-1 `pi-openai-toolkit:manual-compact` records remain decodable for owned selection recovery only; reload/navigation never retries notes, rollover or inference, and a newer user selection wins.
132
-
133
- The public SDK fixtures in [test/pi-compaction-policy.test.ts](../test/pi-compaction-policy.test.ts) verify actual producer/native input, disk persistence, manual no-continuation behavior and native threshold/overflow recovery with isolated HOME/settings and mocked native/gateway traffic.
48
+ Start a new session to continue. Toolkit does not rewrite/delete files, migrate backend notes, restore temporary models/thinking, create a new session automatically or synthesize a continuation. The extension must be loaded to enforce refusal; historical markers alone are not native Pi cutoffs. See [retirement configuration](configuration.md#removed-remote-windows).
134
49
 
135
50
  ---
136
51
 
137
52
  ### Remote Compaction v2 wire contract
138
53
 
139
- V2 serves eligible `remote-compaction` operations, including manual, threshold and overflow. A model that Remote Context declines, such as a gateway without an exact transport opt-in, can still use this path when its API appears in `context.remoteCompaction.apis`. `remote-windows` user-manual operations use native compression instead. An effective inherited window constrains input without changing that policy. Compaction generation follows the active strategy. Across mode changes, an already-persisted checkpoint remains authoritative until a safe newer window or compaction replaces it; a historical window identity alone must not suppress checkpoint replay.
54
+ Eligible remote-compaction operations use the same ordinary policy for manual, threshold and overflow. APIs are narrowed by context.remoteCompaction.apis. Pi mode leaves clean-session compaction with Pi; retired sessions remain refused in every mode. Pi owns eligibility, scheduling, persistence and continuation; there is no replacement scheduler or manual post-idle driver.
55
+
56
+ The selected model is the checkpoint **consumer**. An optional configured model is the synthetic **producer**, never a selected-model change. An unset producer or an exact full provider/model-id match reuses the current runtime, auth snapshot and session directly; a current virtual selection reuses its resolved physical runtime. Different provider/model identities still resolve separately and must share the consumer's normalized authenticated effective base URL. Matching bare model IDs or endpoint alone is not same-model equality. A successful exact-match remote path is not a native-summary shortcut.
140
57
 
141
- A `compaction_trigger` item appended to the live streaming request yields one output item of `type: "compaction"` with non-empty `encrypted_content`, stored in `CompactionEntry.details.compactedWindow`. On later requests the opaque checkpoint is replayed ahead of live turns, with no text summary. Replay fails closed: if the summary anchor cannot be located, the request is aborted with a notification and a content-free failure artifact. The sentinel-only payload is never sent.
58
+ A compaction_trigger item appended to a separate synthetic streaming Responses request yields one output item of type compaction with nonempty encrypted_content, stored in CompactionEntry.details.compactedWindow. The request retains the current conversation identity; the selected model/thinking never changes and no new session or synthetic continuation is created. On later requests the opaque checkpoint replaces Pi's verified summary anchor ahead of live turns. Missing anchors abort with a notification and content-free failure artifact; sentinel-only payloads are never sent.
142
59
 
143
- The incremental SSE consumer validates the first terminal event and reconciles its checkpoint with prior item evidence. A valid completed frame ends the operation even if the HTTP body stays open; reader cancellation is best-effort cleanup and is not awaited. Incomplete frames at EOF, conflicting checkpoint evidence and terminal errors cannot become successful checkpoints.
60
+ The incremental SSE consumer validates the first terminal event and reconciles its checkpoint with prior item evidence. A valid completed frame ends the operation even if the body stays open; best-effort reader cancellation is not awaited. Incomplete EOF, conflicting evidence and terminal errors cannot become successful checkpoints. Astra-only configuration_update items and injected native Web Search are excluded from synthetic compaction.
144
61
 
145
- A missing, empty, or invalid V2 checkpoint is never stored. Ordinary compaction may then try the gated standalone protocol below; exhausted remote attempts warn once and enter the unchanged native text-summary chain. A failed remote operation selects `remoteCompactModel` for the configured native tier; a remote-ineligible model selects `nativeFallback.model`. Disabled/unset/same-model selections delegate to Pi's default summary, including when `nativeFallback.enabled` is false. Explicit summary-model failures cancel instead of retrying with the active model. Aborts and projection/provenance/context-edit failures still cancel immediately. `remoteCompactModel` must resolve to the same effective base URL as the active consumer, which is never switched for synthetic requests.
62
+ Missing/invalid checkpoints are not stored. Ordinary compaction may try the gated standalone protocol below; exhausted remote attempts warn once before native text summary. A failed remote attempt selects remoteCompactModel for the configured native tier; remote-ineligible resolution selects nativeFallback.model. Disabled/unset/same-model native selections keep Pi's default, including when nativeFallback.enabled is false. Explicit summary failures, aborts and projection/provenance/context-edit failures cancel; an invalid producer does not silently retry Remote V2 using the consumer.
146
63
 
147
64
  #### Official API-key standalone fallback
148
65
 
149
- The ordinary path reuses one resolved physical producer, auth snapshot, and prepared full input. After a qualifying V2 failure, it makes at most one POST to `https://api.openai.com/v1/responses/compact`. Eligibility requires `openai-responses`, no Codex gateway affinity, public `ModelRegistry.hasConfiguredAuth(model) === true` and `isUsingOAuth(model) === false`, and the final Authorization header matching the resolved Bearer key. Missing/throwing/nonboolean metadata is unknown, not API-key evidence. Provider aliases may qualify at the official endpoint; OAuth, native Codex, Azure, custom gateways and inactive automatic Remote Context recovery do not opt into this standalone fallback. No token-shape inspection, extra auth resolution, model/account switch, redirect, capability cache, or generated version/beta header is introduced.
66
+ The ordinary path reuses one resolved physical producer, auth snapshot and prepared input. After a qualifying V2 failure, at most one POST goes to https://api.openai.com/v1/responses/compact. Eligibility requires openai-responses, no Codex affinity, public hasConfiguredAuth(model) true and isUsingOAuth(model) false, and final Authorization matching the resolved Bearer key. Missing/throwing/nonboolean metadata is unknown. OAuth, native Codex, Azure and custom gateways do not opt in; provider aliases can qualify at the official endpoint. There is no token-shape inference, extra auth resolution, account/model switch, redirect, capability cache or automatic version/beta header.
150
67
 
151
- Qualifying failures are HTTP 400/404/405/422/501 without auth/quota exclusions, invalid/empty successful V2 checkpoint responses, or streamed errors with a recognized unsupported-protocol code. HTTP 401/403/429, known subscription/auth/billing/rate-limit restrictions, network failures, aborts, and generic server outages never trigger another protocol probe. OpenAI subscription-sharing OAuth and native Codex OAuth are distinct grants; selecting a separately authenticated Codex route does not authorize copying its credential to OpenAI.
68
+ Qualifying failures include HTTP 400/404/405/422/501 without auth/quota exclusions, invalid/empty successful V2 checkpoints and recognized unsupported-protocol streamed errors. HTTP 401/403/429, subscription/auth/billing/rate-limit restrictions, network errors, aborts and generic server outages never authorize a probe. OpenAI subscription-sharing OAuth and native Codex OAuth are separate grants, not interchangeable credentials.
152
69
 
153
- Standalone JSON contains `model`, `input`, `instructions` and only validated SDK-supported service-tier/cache fields. It omits `previous_response_id`, stream/store/tools/reasoning/text and the V2 trigger. A nonempty output must contain at least one nonempty encrypted `compaction` item and no malformed checkpoint. Every returned item and unknown structured field survives in original order, including retained user/assistant messages. Unlike V2, this protocol does not impose a single-output-item invariant. The existing `openai-native-compact-v1` strategy and an honest opaque window marker are persisted with consumer/producer identity, input provenance, deferred tools and Pi's `tokensBefore`. Retained assistant text is not a portable summary.
70
+ Standalone JSON contains model, input, instructions and only validated service-tier/cache fields. It omits previous_response_id, stream/store/tools/reasoning/text and the V2 trigger. A nonempty output needs at least one valid encrypted checkpoint; all items and unknown structured fields, including an own __proto__ key, survive in order. Unlike V2, multiple checkpoints are allowed. Persist the existing openai-native-compact-v1 strategy and honest opaque sentinel with consumer/producer/provenance/deferred metadata and Pi's tokensBefore. Retained assistant text is not a portable summary.
154
71
 
155
- Existing persistence/replay splices the entire canonical window between the leading prompt and live tail. Recursion uses that window plus current live tail once; verified Pi-retained copies are removed, current deferred schemas load after the end of the whole window, and historical declarations remain intact. Standalone cancellation can win before JSON checkpoint acceptance; V2's validated terminal remains authoritative over later reader cleanup cancellation.
72
+ Replay splices the **whole canonical array** between leading prompts and the live tail. Recursion sends the array plus live tail once; retained copies are verified/removed, current deferred schemas load after the whole array and historical declarations stay intact. Standalone cancellation can win before JSON acceptance; a validated V2 terminal wins over later cleanup cancellation. Isolated mock wire and real-Pi persistence/reopen/continuation fixtures cover both input modes; they do not establish live API-key acceptance.
156
73
 
157
- The API-key path is covered by isolated mocked wire tests and real Pi persistence/reopen/continuation fixtures in both input-source modes. This is not live API-key acceptance. Earlier credentialed evidence used native Codex OAuth only; it does not establish API-key or OpenAI subscription-sharing OAuth support for every model/account.
74
+ #### Canonical context and replay
158
75
 
159
- Pi 0.87 makes `SessionManager` the source of model-visible context. An omitted `context.remoteCompaction.inputSource` keeps `"legacy"` behavior: first compaction reads `buildSessionProjection()` (falling back to Pi's preparation if unavailable), and recursion uses the opaque window plus the canonically projected branch tail. Both paths honor persisted context edits. Legacy mode still bypasses request-time extension transforms.
76
+ Pi SessionManager supplies model-visible context. The default legacy source reads buildSessionProjection() for first compaction (using Pi preparation only when projection is unavailable) and uses the opaque checkpoint plus canonical branch tail recursively. Persisted context edits remain effective; this mode bypasses request-time extension transforms.
160
77
 
161
- Setting `context.remoteCompaction.inputSource: "pi-context-hook"` opts into a narrow runtime bridge around Pi's public `ExtensionRunner.createContext()`. It adds a non-enumerable `ctx.projectContextForCompaction(messages)` method backed by `ExtensionRunner.emitContext()`. This runs the ordered conversation-only and full-transcript phases on the canonical projection. If the bridge, session projection, or recursive summary anchor is unavailable, the extension cancels rather than sending unprojected history.
78
+ The pi-context-hook source uses the existing narrow bridge around ExtensionRunner.createContext(), exposing non-enumerable ctx.projectContextForCompaction(messages) backed by emitContext(). Both ordered conversation-only and full-transcript phases run on canonical input. Missing bridge/projection/recursive summary anchor cancels rather than sending raw unprojected history.
162
79
 
163
- Retained-message matching uses the SDK projection and source entry IDs, including omissions and replacements made before compaction. Older retained compaction entries contribute no second summary. A compaction whose kept boundary is its own ID retains no earlier messages. Edits to post-checkpoint input are applied to the live tail; an edit targeting history already sealed in an opaque checkpoint blocks replay and recursive compaction with `checkpoint-context-edited`. The encrypted checkpoint cannot be selectively rewritten. Start a new session or navigate before that checkpoint to rebuild from editable history; the raw log remains unchanged.
80
+ Retained-copy matching uses canonical contributions and real source IDs. Older retained compactions contribute no second summary; a kept boundary equal to the checkpoint itself retains none. Post-checkpoint edits apply to the live tail. An edit targeting sealed history blocks replay/recursion with checkpoint-context-edited: encrypted content cannot be selectively rewritten. Navigate before it or start a new session to rebuild; raw logs stay unchanged.
164
81
 
165
- New checkpoints record `inputProvenance: "pi-context-hook-v1"` or `"legacy-raw-context-v1"`, and replay/recursion reject missing or mode-mismatched markers without searching past the latest compaction. Retained `role: "custom"` messages are optional during replay because they may be changed or removed by context hooks; required user, assistant, and complete tool-call/result content remains ordered and fail-closed.
82
+ Checkpoints record pi-context-hook-v1 or legacy-raw-context-v1 provenance. Missing/mismatched provenance is not repaired by searching past the newest checkpoint. Effective endpoint compatibility is authoritative; consumer/producer provider/API/model fields are diagnostic. Optional custom retained messages may be changed/removed by hooks, but required user/assistant/complete tool pairs remain ordered and fail-closed.
83
+
84
+ Deferred-tool carryover uses valid cache-stack activation metadata without taking ownership of it. Only uniquely matched real schemas are moved to supported additional_tools/tool_search load points immediately after the full checkpoint boundary. Preserve unrelated tools, immutable payloads, unknown fields and current prompt state.
166
85
 
167
86
  ---
168
87
 
169
88
  ### Artifacts and debugging
170
89
 
171
- With `diagnostics.level: "debug"`, the toolkit writes lifecycle and compaction artifacts under `diagnostics.artifactRoot` (default `~/.pi/agent/artifacts/pi-openai-toolkit/compaction`):
90
+ Debug diagnostics write lifecycle/compaction artifacts under diagnostics.artifactRoot, defaulting to ~/.pi/agent/artifacts/pi-openai-toolkit/compaction. Request capture and compact-response capture are independently opt-in; neither is a reason to log ordinary conversation responses. Keep them off unless diagnosing a specific operation.
172
91
 
173
- - Each `session_start` writes a lifecycle artifact whose `activation` field records `active` or the exact inactive reason, such as `unsupported-model`, `unsupported-api`, `missing-api-key`, `auth-resolution-failed`, or `tool-name-conflict`.
174
- - `diagnostics.captureRequests` independently writes provider request metadata and payloads, while `diagnostics.captureResponses` writes compact status and structural summaries with complete response and body fields critically redacted. Keep both off unless inspecting a specific request.
175
- - Artifacts always redact Authorization credentials, API keys and tokens, Codex account IDs, and opaque `encrypted_content` or `encrypted_output`, even when `diagnostics.redactSensitiveData` is `false`.
176
- - Compaction failures record protocol, stable reason/status, controlled public error identifiers/hints and the next step. Arbitrary provider messages and raw bodies are never promoted into diagnostics; unknown identifiers are omitted, and network exceptions use a generic content-free message. Debug-enabled headless runs record the same remote-to-native transition without requiring UI notifications.
92
+ Credentials, account IDs and opaque encrypted_content/encrypted_output are critically redacted even when optional redaction is disabled. Failures retain protocol, stable reason/status, controlled public identifiers/hints and next step, not arbitrary provider messages or raw bodies. Debug headless operation records remote-to-native transitions without dumping configuration to stdout. Retired-session diagnostics contain controlled reasons and guidance, never saved note/transcript content.
177
93
 
178
94
  ---
179
95
 
180
96
  ### Provenance
181
97
 
182
- The Remote Context protocol was reverse-engineered from `@howaboua/pi-codex-conversion@3.0.29` (source commit `7021ae48e8efe36a3becc5830d529696ff798e5e`). The Astra compatibility layer is adapted from Oh My Pi 18.1.8 (MIT). Web Search behavior was adapted from [pi-openai-web-search](https://github.com/code-yeongyu/pi-openai-web-search) (commit `3964338`). Attribution details are in [NOTICE](../NOTICE).
183
-
184
- Protocol fixtures live in [src/context-management/](../src/context-management/) and must be updated together with any upstream alpha endpoint change. New wire behavior requires fixture-based tests.
98
+ Historical Remote Context work was adapted from @howaboua/pi-codex-conversion@3.0.29 (commit 7021ae48e8efe36a3becc5830d529696ff798e5e); that active feature has been removed. Astra compatibility is adapted from Oh My Pi 18.1.8 (MIT). Web Search behavior was adapted from [pi-openai-web-search](https://github.com/code-yeongyu/pi-openai-web-search) (commit 3964338). Attribution is preserved in [NOTICE](../NOTICE). Current protocol changes require fixture-based ordinary compaction/search/image/transport regressions, not resurrected window fixtures.
package/package.json CHANGED
@@ -1,136 +1,123 @@
1
- {
2
- "name": "pi-openai-toolkit",
3
- "version": "0.23.2",
4
- "private": false,
5
- "type": "module",
6
- "engines": {
7
- "node": ">=22.19.0"
8
- },
9
- "description": "OpenAI toolkit for Pi: Codex Remote Context windows, remote compaction v2, routed Web Search, image gen.",
10
- "author": "awoaCrim and contributors",
11
- "license": "MIT",
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/awoaCrim/pi-openai-toolkit.git"
15
- },
16
- "bugs": {
17
- "url": "https://github.com/awoaCrim/pi-openai-toolkit/issues"
18
- },
19
- "homepage": "https://github.com/awoaCrim/pi-openai-toolkit#readme",
20
- "publishConfig": {
21
- "access": "public",
22
- "registry": "https://registry.npmjs.org/"
23
- },
24
- "keywords": [
25
- "pi-package",
26
- "pi-extension",
27
- "openai",
28
- "compaction",
29
- "web-search",
30
- "image-generation",
31
- "codex",
32
- "responses"
33
- ],
34
- "pi": {
35
- "extensions": [
36
- "./src/extension-runtime.ts",
37
- "./src/web-search/extension.ts",
38
- "./src/image-generation/extension.ts",
39
- "./src/codex-fast/extension.ts",
40
- "./src/codex-astra/extension.ts",
41
- "./src/responses-websocket/extension.ts"
42
- ]
43
- },
44
- "files": [
45
- "src/compact-client.ts",
46
- "src/compaction-errors.ts",
47
- "src/compaction-projection.ts",
48
- "src/pi-context-hook.ts",
49
- "src/config.ts",
50
- "src/config-command.ts",
51
- "src/config/policy.ts",
52
- "src/config/legacy.ts",
53
- "src/config/v2.ts",
54
- "src/config/migration.ts",
55
- "src/config/notifications.ts",
56
- "config.schema.json",
57
- "src/debug.ts",
58
- "src/details-store.ts",
59
- "src/deferred-tool-carryover.ts",
60
- "src/extension-runtime.ts",
61
- "src/context-management/types.ts",
62
- "src/context-management/messages.ts",
63
- "src/context-management/window-budget.ts",
64
- "src/context-management/window-request.ts",
65
- "src/context-management/window-bulk.ts",
66
- "src/context-management/window-manager.ts",
67
- "src/context-management/scoped-compaction.ts",
68
- "src/context-management/manual-compact.ts",
69
- "src/context-management/codex-provider.ts",
70
- "src/context-management/history-notes.ts",
71
- "src/context-management/tools.ts",
72
- "src/context-management/namespace-tools.ts",
73
- "src/context-management/responses-tools.ts",
74
- "src/context-management/tool-contract.ts",
75
- "src/image-generation/artifacts.ts",
76
- "src/image-generation/client.ts",
77
- "src/image-generation/eligibility.ts",
78
- "src/image-generation/extension.ts",
79
- "src/image-generation/protocol.ts",
80
- "src/image-generation/references.ts",
81
- "src/image-generation/render.ts",
82
- "src/image-generation/service.ts",
83
- "src/image-generation/types.ts",
84
- "src/codex-fast/extension.ts",
85
- "src/codex-fast/payload.ts",
86
- "src/codex-fast/state.ts",
87
- "src/codex-astra/effort-planner.ts",
88
- "src/codex-astra/extension.ts",
89
- "src/responses-websocket/extension.ts",
90
- "src/responses-websocket/transport.ts",
91
- "src/model-scope.ts",
92
- "src/native-fallback.ts",
93
- "src/payload-rewrite.ts",
94
- "src/provider-headers.ts",
95
- "src/responses-headers.ts",
96
- "src/remote-v2-client.ts",
97
- "src/request-context-cache.ts",
98
- "src/runtime.ts",
99
- "src/serializer.ts",
100
- "src/supported-environment.ts",
101
- "src/types.ts",
102
- "src/web-search/alpha-client.ts",
103
- "src/web-search/extension.ts",
104
- "src/web-search/payload.ts",
105
- "src/web-search/prompt.ts",
106
- "src/web-search/types.ts",
107
- "docs/internals.md",
108
- "docs/configuration.md",
109
- "README.md",
110
- "README.zh.md",
111
- "LICENSE",
112
- "NOTICE",
113
- "tsconfig.check.json"
114
- ],
115
- "scripts": {
116
- "test": "bun test",
117
- "test:coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov && node ./scripts/check-lcov.mjs ./coverage/lcov.info",
118
- "test:pi": "bun test ./test/pi-smoke.test.ts",
119
- "typecheck": "tsc -p tsconfig.check.json"
120
- },
121
- "peerDependencies": {
122
- "@earendil-works/pi-agent-core": ">=0.87.0",
123
- "@earendil-works/pi-ai": ">=0.87.0",
124
- "@earendil-works/pi-coding-agent": ">=0.87.0",
125
- "@earendil-works/pi-tui": ">=0.87.0"
126
- },
127
- "devDependencies": {
128
- "@earendil-works/pi-agent-core": "1.0.0",
129
- "@earendil-works/pi-ai": "1.0.0",
130
- "@earendil-works/pi-coding-agent": "1.0.0",
131
- "@earendil-works/pi-tui": "1.0.0",
132
- "@types/node": "24.12.4",
133
- "bun": "1.2.23",
134
- "typescript": "5.9.3"
135
- }
136
- }
1
+ {
2
+ "name": "pi-openai-toolkit",
3
+ "version": "0.24.1",
4
+ "private": false,
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=22.19.0"
8
+ },
9
+ "description": "OpenAI toolkit for Pi: remote compaction v2, routed Web Search, image generation and Codex utilities.",
10
+ "author": "awoaCrim and contributors",
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/awoaCrim/pi-openai-toolkit.git"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/awoaCrim/pi-openai-toolkit/issues"
18
+ },
19
+ "homepage": "https://github.com/awoaCrim/pi-openai-toolkit#readme",
20
+ "publishConfig": {
21
+ "access": "public",
22
+ "registry": "https://registry.npmjs.org/"
23
+ },
24
+ "keywords": [
25
+ "pi-package",
26
+ "pi-extension",
27
+ "openai",
28
+ "compaction",
29
+ "web-search",
30
+ "image-generation",
31
+ "codex",
32
+ "responses"
33
+ ],
34
+ "pi": {
35
+ "extensions": [
36
+ "./src/extension-runtime.ts",
37
+ "./src/web-search/extension.ts",
38
+ "./src/image-generation/extension.ts",
39
+ "./src/codex-fast/extension.ts",
40
+ "./src/codex-astra/extension.ts",
41
+ "./src/responses-websocket/extension.ts"
42
+ ]
43
+ },
44
+ "files": [
45
+ "src/compact-client.ts",
46
+ "src/compaction-errors.ts",
47
+ "src/compaction-projection.ts",
48
+ "src/pi-context-hook.ts",
49
+ "src/config.ts",
50
+ "src/config-command.ts",
51
+ "src/config/policy.ts",
52
+ "src/config/legacy.ts",
53
+ "src/config/v2.ts",
54
+ "src/config/migration.ts",
55
+ "src/config/notifications.ts",
56
+ "config.schema.json",
57
+ "src/debug.ts",
58
+ "src/details-store.ts",
59
+ "src/deferred-tool-carryover.ts",
60
+ "src/extension-runtime.ts",
61
+ "src/retired-remote-windows.ts",
62
+ "src/image-generation/artifacts.ts",
63
+ "src/image-generation/client.ts",
64
+ "src/image-generation/eligibility.ts",
65
+ "src/image-generation/extension.ts",
66
+ "src/image-generation/protocol.ts",
67
+ "src/image-generation/references.ts",
68
+ "src/image-generation/render.ts",
69
+ "src/image-generation/service.ts",
70
+ "src/image-generation/types.ts",
71
+ "src/codex-fast/extension.ts",
72
+ "src/codex-fast/payload.ts",
73
+ "src/codex-fast/state.ts",
74
+ "src/codex-astra/effort-planner.ts",
75
+ "src/codex-astra/extension.ts",
76
+ "src/responses-websocket/extension.ts",
77
+ "src/responses-websocket/transport.ts",
78
+ "src/model-scope.ts",
79
+ "src/native-fallback.ts",
80
+ "src/payload-rewrite.ts",
81
+ "src/provider-headers.ts",
82
+ "src/responses-headers.ts",
83
+ "src/remote-v2-client.ts",
84
+ "src/request-context-cache.ts",
85
+ "src/runtime.ts",
86
+ "src/serializer.ts",
87
+ "src/supported-environment.ts",
88
+ "src/types.ts",
89
+ "src/web-search/alpha-client.ts",
90
+ "src/web-search/extension.ts",
91
+ "src/web-search/payload.ts",
92
+ "src/web-search/prompt.ts",
93
+ "src/web-search/types.ts",
94
+ "docs/internals.md",
95
+ "docs/configuration.md",
96
+ "README.md",
97
+ "README.zh.md",
98
+ "LICENSE",
99
+ "NOTICE",
100
+ "tsconfig.check.json"
101
+ ],
102
+ "scripts": {
103
+ "test": "bun test",
104
+ "test:coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov && node ./scripts/check-lcov.mjs ./coverage/lcov.info",
105
+ "test:pi": "bun test ./test/pi-smoke.test.ts",
106
+ "typecheck": "tsc -p tsconfig.check.json"
107
+ },
108
+ "peerDependencies": {
109
+ "@earendil-works/pi-agent-core": ">=0.87.0",
110
+ "@earendil-works/pi-ai": ">=0.87.0",
111
+ "@earendil-works/pi-coding-agent": ">=0.87.0",
112
+ "@earendil-works/pi-tui": ">=0.87.0"
113
+ },
114
+ "devDependencies": {
115
+ "@earendil-works/pi-agent-core": "1.0.0",
116
+ "@earendil-works/pi-ai": "1.0.0",
117
+ "@earendil-works/pi-coding-agent": "1.0.0",
118
+ "@earendil-works/pi-tui": "1.0.0",
119
+ "@types/node": "24.12.4",
120
+ "bun": "1.2.23",
121
+ "typescript": "5.9.3"
122
+ }
123
+ }