pi-plus-sdk 0.1.38 → 0.2.2

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 (4) hide show
  1. package/README.md +7 -0
  2. package/api.d.ts +51 -0
  3. package/api.js +4 -4
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -48,6 +48,13 @@ await session.prompt("Review this repository");
48
48
  Session history management completes the surface: `SessionManager.listAll` to
49
49
  enumerate, `SessionManager.search(query)` to match titles and transcript text, and
50
50
  `SessionManager.deleteSession(path)` to remove a transcript.
51
+ - Pi package maintenance ships as a library (`src/packages.ts`): `listPackages`,
52
+ `installPackage`, `removePackage`, and `updatePackages` are the programmatic form
53
+ of `pi install`/`remove`/`list`/`update --extensions` — the pi packages (extensions,
54
+ skills, prompts, themes) surface from pi.dev/docs/latest/packages. They take
55
+ explicit `cwd`/`agentDir` (or a caller-owned `SettingsManager`) plus `projectTrusted`
56
+ and an `onProgress` callback; project-scope (`local`) writes are refused by the
57
+ underlying manager when the project is not trusted.
51
58
  - Provider login ships as a library (`src/auth.ts`): `loginProvider(providerId, { agentDir?, interaction?, signal?, method? })`
52
59
  runs pi's model-runtime login flow (OAuth login page / API-key setup — the same
53
60
  flow `pipi profile add <name> -p <provider>` and the `--sign-in` flag on
package/api.d.ts CHANGED
@@ -9,6 +9,12 @@
9
9
 
10
10
  export * from "@earendil-works/pi-coding-agent";
11
11
 
12
+ import type {
13
+ ConfiguredPackage,
14
+ ProgressCallback,
15
+ SettingsManager,
16
+ } from "@earendil-works/pi-coding-agent";
17
+
12
18
  import type {
13
19
  AgentSession,
14
20
  AgentSessionRuntime,
@@ -151,6 +157,51 @@ export declare function subscribeToRecapFailures(
151
157
  listener: (failure: RecapFailure) => void,
152
158
  ): () => void;
153
159
 
160
+ /** Options shared by the package-maintenance entries. */
161
+ export interface PlusPackageMaintenanceOptions {
162
+ /** Project directory for project-scope declarations (default `process.cwd()`). */
163
+ cwd?: string;
164
+ /** Agent dir holding user-scope settings.json (default pi's agent dir). */
165
+ agentDir?: string;
166
+ /**
167
+ * Caller-owned settings manager. When given, `cwd`/`agentDir`/
168
+ * `projectTrusted` are not used for settings resolution (the manager's own
169
+ * storage decides), and `agentDir` still defaults to pi's agent dir for
170
+ * install locations.
171
+ */
172
+ settingsManager?: SettingsManager;
173
+ /**
174
+ * Whether project-scope settings are honored (default true). Embedding
175
+ * hosts decide project trust themselves — mirroring
176
+ * `createPlusAgentSessionRuntime`'s `projectTrusted` — instead of pi's
177
+ * interactive trust prompt.
178
+ */
179
+ projectTrusted?: boolean;
180
+ /** Receives progress events from installs/updates (clone/npm stages). */
181
+ onProgress?: ProgressCallback;
182
+ }
183
+
184
+ export interface PlusPackageInstallOptions extends PlusPackageMaintenanceOptions {
185
+ /**
186
+ * Persist the source in the project's `.pi/settings.json` instead of the
187
+ * user settings. Requires a project-trusted settings manager.
188
+ */
189
+ local?: boolean;
190
+ }
191
+
192
+ /** Configured packages from both scopes, in user-then-project order. Synchronous. */
193
+ export declare function listPackages(options?: PlusPackageMaintenanceOptions): ConfiguredPackage[];
194
+ /** Install a package source and persist it in settings (user scope unless `local`). */
195
+ export declare function installPackage(source: string, options?: PlusPackageInstallOptions): Promise<void>;
196
+ /** Remove a package source from settings; returns false when nothing matched. */
197
+ export declare function removePackage(source: string, options?: PlusPackageInstallOptions): Promise<boolean>;
198
+ /**
199
+ * Reconcile installed packages with their configured sources (clone/npm ref
200
+ * refreshes — pinned refs do not move). Pass `source` to update one package;
201
+ * omit it to update everything in both scopes.
202
+ */
203
+ export declare function updatePackages(source?: string, options?: PlusPackageMaintenanceOptions): Promise<void>;
204
+
154
205
  export interface CreatePlusAgentSessionOptions extends CreateAgentSessionOptions {
155
206
  extensionFactories?: InlineExtension[];
156
207
  ui?: PlusUIDialogHandlers;