pi-plus-sdk 0.1.2 → 0.1.3
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/README.md +9 -2
- package/api.d.ts +53 -0
- package/api.js +147 -144
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,8 +28,15 @@ await session.prompt("Review this repository");
|
|
|
28
28
|
baked into `api.js` by the shared bundle-time redirect plugin, and the nine
|
|
29
29
|
non-TUI pi-plus extensions (subagent, tasks, memory, plan, ask-user, hooks,
|
|
30
30
|
context-guard, `/cd`, `/init`) are registered exactly as the CLI wrapper registers them. No CLI
|
|
31
|
-
logic ships in this artifact: no hub dispatch
|
|
32
|
-
no banner/vim/tab-title/plain-tools.
|
|
31
|
+
logic ships in this artifact: no hub command dispatch (`pipi profile ...`), no
|
|
32
|
+
completion, no pipi help text, no banner/vim/tab-title/plain-tools.
|
|
33
|
+
- Profile management ships as a library: the curated `@earendil-works/pi-hub`
|
|
34
|
+
surface is re-exported (`src/profiles.ts`) — `loadProfiles/findProfile/
|
|
35
|
+
addProfile/updateProfile/removeProfile/renameProfile/setDefaultProfile/
|
|
36
|
+
clearDefaultProfile/getDefaultProfileName` for `~/.pi/profiles.json`, and
|
|
37
|
+
`materializeProfile/removeProfileDir/profileDirFor/AGENT_DIR/
|
|
38
|
+
syncProfilePackagesToSource` for the per-profile agent dirs. Hosts get the
|
|
39
|
+
exact contract the `pipi` CLI dispatches instead of reimplementing it.
|
|
33
40
|
- `createPlusAgentSession()` extends the upstream `createAgentSession` (re-exported,
|
|
34
41
|
with the whole upstream SDK surface) and always binds extensions once — do not call
|
|
35
42
|
`session.bindExtensions()` yourself. Pass `ui` dialog handlers to get working
|
package/api.d.ts
CHANGED
|
@@ -42,3 +42,56 @@ export interface CreatePlusAgentSessionOptions extends CreateAgentSessionOptions
|
|
|
42
42
|
export declare function createPlusAgentSession(
|
|
43
43
|
options?: CreatePlusAgentSessionOptions,
|
|
44
44
|
): Promise<CreateAgentSessionResult>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Profile management: the curated @earendil-works/pi-hub surface bundled into
|
|
48
|
+
* api.js (profiles.json CRUD + per-profile materialized agent dirs). Types are
|
|
49
|
+
* declared inline because pi-hub is not a dependency of this package — keep
|
|
50
|
+
* them in sync with packages/hub/src/types.ts.
|
|
51
|
+
*/
|
|
52
|
+
export interface Profile {
|
|
53
|
+
provider?: string;
|
|
54
|
+
model?: string;
|
|
55
|
+
models?: string[];
|
|
56
|
+
thinking?: string;
|
|
57
|
+
token?: string;
|
|
58
|
+
url?: string;
|
|
59
|
+
/** Arbitrary settings.json overrides, merged over the source agent settings.
|
|
60
|
+
* A null value deletes the key from the materialized settings.json. */
|
|
61
|
+
settings?: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ProfilesData {
|
|
65
|
+
profiles: Record<string, Profile>;
|
|
66
|
+
default?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface AgentSettingsData {
|
|
70
|
+
defaultProvider?: string;
|
|
71
|
+
defaultModel?: string;
|
|
72
|
+
defaultThinkingLevel?: string;
|
|
73
|
+
skills?: unknown;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export declare const THINKING_LEVELS: string[];
|
|
78
|
+
|
|
79
|
+
/** Marker stored in `profiles.json` `default` meaning "no profile, run plain pi". */
|
|
80
|
+
export declare const BUILT_IN_DEFAULT: "__builtin__";
|
|
81
|
+
|
|
82
|
+
/** Source agent dir (PI_CODING_AGENT_DIR or ~/.pi/agent): profiles without an applied profile. */
|
|
83
|
+
export declare const AGENT_DIR: string;
|
|
84
|
+
|
|
85
|
+
export declare function loadProfiles(): ProfilesData;
|
|
86
|
+
export declare function findProfile(name: string): Profile | undefined;
|
|
87
|
+
export declare function getDefaultProfileName(): string | undefined;
|
|
88
|
+
export declare function setDefaultProfile(name: string): void;
|
|
89
|
+
export declare function clearDefaultProfile(): void;
|
|
90
|
+
export declare function addProfile(name: string, profile: Profile): void;
|
|
91
|
+
export declare function updateProfile(name: string, profile: Profile): void;
|
|
92
|
+
export declare function removeProfile(name: string): void;
|
|
93
|
+
export declare function renameProfile(oldName: string, newName: string): void;
|
|
94
|
+
export declare function profileDirFor(name: string): string;
|
|
95
|
+
export declare function materializeProfile(name: string, profile: Profile): string;
|
|
96
|
+
export declare function removeProfileDir(name: string): void;
|
|
97
|
+
export declare function syncProfilePackagesToSource(profileDir: string): boolean;
|