pi-plus-sdk 0.1.15 → 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/api.d.ts +41 -0
- package/api.js +31 -30
- package/package.json +1 -1
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
|
|