pi-plus-sdk 0.1.14 → 0.1.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 +7 -0
- package/api.d.ts +41 -0
- package/api.js +32 -31
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
### Added
|
|
6
6
|
|
|
7
|
+
- `/plan <prompt>` in the plan extension (shared core): any argument other than the `show` / `edit` subcommands turns plan mode on (when off) and forwards the text to the model as a user message (queued as steering while the agent is streaming).
|
|
8
|
+
- The plan review dialog renders the plan as markdown instead of raw text (shared core, `packages/plus/src/extensions/plan/component.ts`): `ExitPlanMode` presents the plan file in a scrollable rendered-markdown view with the three Claude Code choices — Approve and proceed / Stay in plan mode / Edit plan — driven by ↑↓/j/k + enter, digit keys 1-3, or esc to stay (a plain-text `ui.select` remains the fallback for RPC / headless hosts). `/plan show` reuses the same view read-only, replacing the raw `ui.notify` dump.
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- 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).
|
|
13
|
+
|
|
7
14
|
- 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.
|
|
8
15
|
- Runtime settings layering for hub profiles applies to SDK hosts with no environment plumbing (shared `loader/redirects.mjs` entry for `coding-agent/src/core/settings-manager.ts`): whenever the agent dir passed to `SettingsManager.create` is a hub-materialized profile dir (a direct child of `~/.pi/pi-hub/profiles`, honoring `PI_HUB_PI_DIR`/`PI_HUB_DIR`; the pipi-set `PI_PLUS_BASE_AGENT_DIR` marker also still activates it), the global scope reads the base agent `settings.json` deep-merged under the profile `settings.json` with the profile winning, and writes route per top-level key — the profile-scoped `defaultProvider`/`defaultModel`/`defaultThinkingLevel` to the profile file, everything else to the agent file with any profile shadow cleared. Any other agent dir keeps `SettingsManager.create` behaving exactly as upstream.
|
|
9
16
|
- The pi-plus context settings are re-exported from the SDK surface (`packages/plus/src/context/threshold-setting.ts`): `readPlusSettings/writePlusSettings/getPlusSettingsPath` for the pi-plus settings store next to `settings.json`, plus the typed getters/setters and UI formatters behind the pipi `/settings` rows — `get/setAutoCompactThresholdPercent` (default 80%), `get/setContextFloorTokens` (default/built-in minimum 13000), and `get/setContextWindowCapTokens` (undefined = no cap). Embedding hosts get the same knobs the TUI edits, against the same file detection actually reads. `SessionManager.deleteSession` and `SessionManager.search` (new in the re-exported upstream surface) cover transcript deletion and title/content search for history-management UIs.
|
package/api.d.ts
CHANGED
|
@@ -73,11 +73,52 @@ export declare function gatePermissionToolCall(
|
|
|
73
73
|
/** Build the pi-plus-permissions inline extension for a host. */
|
|
74
74
|
export declare function createPermissionsExtension(options?: PermissionsExtensionOptions): InlineExtension;
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Holder the plan extension couples to (see plan/index.ts): embedding hosts
|
|
78
|
+
* (pi-plus-desktop) inject a per-tab state via createPermissionsExtension,
|
|
79
|
+
* and plan-mode engage/exit must read/write THAT holder, because the
|
|
80
|
+
* permissions gate re-syncs the shared plan gate state from its own holder's
|
|
81
|
+
* mode on every tool call — coupling to the module default would let the
|
|
82
|
+
* first tool call silently tear plan mode down. Registered by the factory,
|
|
83
|
+
* last-write-wins; falls back to the module default until one registers.
|
|
84
|
+
*/
|
|
85
|
+
export declare function setActivePermissionState(
|
|
86
|
+
state: PermissionModeState,
|
|
87
|
+
onModeChange?: (mode: PermissionMode) => void,
|
|
88
|
+
): void;
|
|
89
|
+
export declare function getActivePermissionState(): PermissionModeState;
|
|
90
|
+
/** Mirror a plan-side mode switch into the host UI (the registered onModeChange, if any). */
|
|
91
|
+
export declare function notifyActivePermissionModeChange(mode: PermissionMode): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Pick from a host's dedicated plan-review dialog (pi-plus-desktop renders
|
|
95
|
+
* the plan as markdown with Claude Code style choices). "approveAcceptEdits" /
|
|
96
|
+
* "approveBypass" approve AND select the post-approval permission mode, so
|
|
97
|
+
* the plan runs with the chosen level of automation. undefined = dismissed.
|
|
98
|
+
*/
|
|
99
|
+
export type PlanReviewDialogChoice = "approveAcceptEdits" | "approveBypass" | "edit" | "stay";
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Optional ExtensionUIContext extension SDK hosts provide via
|
|
103
|
+
* createPlusUIContext to take over the plan-review presentation.
|
|
104
|
+
*/
|
|
105
|
+
export interface PlanReviewDialogUI {
|
|
106
|
+
planReview(plan: string): Promise<PlanReviewDialogChoice | undefined>;
|
|
107
|
+
}
|
|
108
|
+
|
|
76
109
|
export interface PlusUIDialogHandlers {
|
|
77
110
|
select(title: string, options: string[]): Promise<string | undefined>;
|
|
78
111
|
confirm(title: string, message: string): Promise<boolean>;
|
|
79
112
|
input(title: string, placeholder?: string): Promise<string | undefined>;
|
|
80
113
|
editor?(title: string, prefill?: string): Promise<string | undefined>;
|
|
114
|
+
/**
|
|
115
|
+
* Dedicated plan-review dialog (ExitPlanMode). The host renders the plan
|
|
116
|
+
* markdown and offers Claude Code style choices; "approveAcceptEdits" /
|
|
117
|
+
* "approveBypass" approve the plan AND set the post-approval permission
|
|
118
|
+
* mode. Return undefined when dismissed (stays in plan mode). Omit to fall
|
|
119
|
+
* back to the plain-text select.
|
|
120
|
+
*/
|
|
121
|
+
planReview?(plan: string): Promise<PlanReviewDialogChoice | undefined>;
|
|
81
122
|
notify?(message: string, type?: "info" | "warning" | "error"): void;
|
|
82
123
|
}
|
|
83
124
|
|