pi-plus-sdk 0.2.15 → 0.2.16
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 +2 -0
- package/api.d.ts +8 -0
- package/api.js +8 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### Added
|
|
6
6
|
|
|
7
|
+
- `createPlusSdkExtensionFactories(agentDir?: string)` builds the hidden non-TUI pi-plus extension factories with the session's agent dir bound into the sub-agent-spawning extensions (`pi-plus-subagent`, `pi-plus-memory`); `plusSdkExtensionFactories` stays the env-fallback binding (`createPlusSdkExtensionFactories()`), so hosts importing the array directly keep the pipi-CLI behavior. Declared in `api.d.ts`.
|
|
7
8
|
- The SDK entry now owns the session/host-facing surface that previously required direct upstream edits: `api.js` re-exports `getDefaultSessionDir` through the pi-plus session overlay and the `ConfiguredPackage`, `PackageUpdate`, and `DefaultResourceLoaderOptions` types via type-only imports from their source modules (the coding-agent barrel stays pristine), and `api.d.ts` declares the pi-plus runtime additions — `AgentSession.getSlashCommands()`, `SessionManager.deleteSession()`, `SessionManager.search()` (instance side via module augmentation, statics via a shadow class export) — plus inline mirrors of the four re-exported names. Embedding hosts keep the same runtime and typed surface as before the upstream edits were moved into the plus packages.
|
|
8
9
|
- The web search extension (`pi-plus-web-search`, shared core `packages/plus/src/extensions/web-search/`) joins `plusSdkExtensionFactories`: SDK sessions get the `WebSearch` (provider chain over `WEB_SEARCH_PROVIDER`/`*_API_KEY` env vars, keyless DuckDuckGo fallback last) and `WebFetch` (URL → text) tools, registered exactly as the CLI wrapper registers them.
|
|
9
10
|
- Session recap failures are re-exported from the SDK surface (`packages/plus/src/extensions/recap/events.ts`): `subscribeToRecapFailures(listener)` — fires with a `{ sessionId, reason: "timeout" | "error", message }` `RecapFailure` after every failed auto-title call (the one-off recap LLM call after the first prompt or a compaction hitting its 30s timeout, or a provider error), returning an unsubscribe function — plus the `RecapFailure`/`RecapFailureReason` types. A host (e.g. the pi-plus desktop) can show its own "session name not set" indicator or trigger a retry without polling. In-process only. Hosts that wire `PlusUIDialogHandlers.notify` via `createPlusUIContext` also receive the failure as a transcript warning through the notify bridge, since the TUI warning that replaced the old stderr dump routes through the same `ui.notify`.
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
|
|
13
14
|
### Fixed
|
|
14
15
|
|
|
16
|
+
- Sessions created through the SDK no longer leak the session model to the stored default profile's endpoint via background sub-agent spawns: `createPlusAgentSession` and `createPlusAgentSessionRuntime` now build their extension list with `createPlusSdkExtensionFactories(agentDir)` so spawned `pipi` children carry `--as <profile>` (see the pi-plus changelog for the mechanism). Hosts like the Pi+ desktop never set `PI_CODING_AGENT_DIR`, so before this the turn-end memory extractor and sub-agent tool re-resolved the default profile and hit its auth/baseUrl with the session's model.
|
|
15
17
|
- Plan mode no longer blocks writes to the plan file itself: the plan extension's gate state moved into a module-level shared holder (`sharedPlanGateState`) that the permissions extension's "plan" permission mode keeps in sync with the mode — so both gates agree on the plan-file carve-out however plan mode is engaged (`/plan`, `EnterPlanMode`, Shift+Tab, `/permissions plan`, or a host writing the shared mode holder). Permission-only plan mode used to be a carve-out-less read-only mode with no plan file at all; now mode "plan" always means full plan mode with the session plan file as the one writable path, exiting plan mode drops a permissions-side "plan" mode to "bypass" instead of leaving the read-only gate latched, and the plan-mode footer indicator renders once (the plan extension no longer sets its own status slot on top of the permissions footer).
|
|
16
18
|
|
|
17
19
|
- The task store API is re-exported from the SDK surface (`packages/plus/src/extensions/tasks/store.ts`): `TaskStore` (file-backed `TaskCreate`/`TaskUpdate`/`TaskList`/`TaskGet` storage under `<agentDir>/tasks/<sessionId>/`, now a per-process singleton per list id), `subscribeToTasks(listId, listener)` — fires immediately with the current list, then with the full post-mutation list after every task-tool change in this process, returning an unsubscribe function — plus the `Task`/`TaskStatus`/`TaskListListener` types. A host (e.g. the pi-plus desktop) can render a native task panel that stays in sync without polling the files. In-process only: writers in another process are not observed.
|
package/api.d.ts
CHANGED
|
@@ -171,6 +171,14 @@ export interface DefaultResourceLoaderOptions {
|
|
|
171
171
|
export declare function setDefaultSessionInteractive(interactive: boolean): void;
|
|
172
172
|
export declare function getDefaultSessionInteractive(): boolean;
|
|
173
173
|
|
|
174
|
+
/** Hidden pi-plus extension factories for SDK hosts. `agentDir` (the session's
|
|
175
|
+
* agent dir) pins the hub profile for spawned sub-agent children (`--as`):
|
|
176
|
+
* SDK hosts set no PI_CODING_AGENT_DIR per session, so without the pin a
|
|
177
|
+
* child re-resolves the stored default profile and runs the session's model
|
|
178
|
+
* against that profile's endpoint. Unset falls back to the env (pipi CLI). */
|
|
179
|
+
export declare function createPlusSdkExtensionFactories(agentDir?: string): InlineExtension[];
|
|
180
|
+
|
|
181
|
+
/** Default env-fallback binding: `createPlusSdkExtensionFactories()`. */
|
|
174
182
|
export declare const plusSdkExtensionFactories: InlineExtension[];
|
|
175
183
|
|
|
176
184
|
// --- pi-plus-permissions (bypass | acceptEdits | plan tool-call gate) ------
|