my-pi 0.1.71 → 0.1.73
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/dist/api.d.ts +17 -34
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/{builtin-registry-D1pRq6E-.js → builtin-registry-DBm8gws_.js} +7 -7
- package/dist/{builtin-registry-D1pRq6E-.js.map → builtin-registry-DBm8gws_.js.map} +1 -1
- package/dist/{handoff-DilTi7gO.js → handoff-C6wR2mSG.js} +1 -1
- package/dist/{handoff-DilTi7gO.js.map → handoff-C6wR2mSG.js.map} +1 -1
- package/dist/{hooks-resolution-D-TK_OJO.js → hooks-resolution-Ct3OPm5A.js} +1 -1
- package/dist/{hooks-resolution-D-TK_OJO.js.map → hooks-resolution-Ct3OPm5A.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{prompt-presets-BA4Ov8OH.js → prompt-presets-BlCoIFYT.js} +5 -1
- package/dist/{prompt-presets-BA4Ov8OH.js.map → prompt-presets-BlCoIFYT.js.map} +1 -1
- package/dist/{session-name-CffcCpkZ.js → session-name-IR78cGVP.js} +1 -1
- package/dist/{session-name-CffcCpkZ.js.map → session-name-IR78cGVP.js.map} +1 -1
- package/dist/{startup-screen-nx4_PbA5.js → startup-screen-DUeBWuAc.js} +1 -1
- package/dist/{startup-screen-nx4_PbA5.js.map → startup-screen-DUeBWuAc.js.map} +1 -1
- package/package.json +16 -16
- /package/dist/{footer-DI_dqrz-.js → footer-Dt5eBLRN.js} +0 -0
package/dist/api.d.ts
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import { Api, Model } from "@earendil-works/pi-ai";
|
|
2
|
-
import * as _$_earendil_works_pi_coding_agent0 from "@earendil-works/pi-coding-agent";
|
|
3
2
|
import { AgentSessionRuntime, CreateAgentSessionFromServicesOptions, ExtensionAPI, ExtensionFactory, ExtensionFactory as ExtensionFactory$1, InteractiveMode, InteractiveModeOptions, PrintModeOptions, runPrintMode, runRpcMode } from "@earendil-works/pi-coding-agent";
|
|
4
|
-
import * as _$_spences10_pi_footer0 from "@spences10/pi-footer";
|
|
5
|
-
import * as _$_spences10_pi_context0 from "@spences10/pi-context";
|
|
6
|
-
import * as _$_spences10_pi_mcp0 from "@spences10/pi-mcp";
|
|
7
|
-
import * as _$_spences10_pi_skills0 from "@spences10/pi-skills";
|
|
8
|
-
import * as _$_spences10_pi_skill_importer0 from "@spences10/pi-skill-importer";
|
|
9
|
-
import * as _$_spences10_pi_redact0 from "@spences10/pi-redact";
|
|
10
|
-
import * as _$_spences10_pi_recall0 from "@spences10/pi-recall";
|
|
11
|
-
import * as _$_spences10_pi_nopeek0 from "@spences10/pi-nopeek";
|
|
12
|
-
import * as _$_spences10_pi_omnisearch0 from "@spences10/pi-omnisearch";
|
|
13
|
-
import * as _$_spences10_pi_sqlite_tools0 from "@spences10/pi-sqlite-tools";
|
|
14
|
-
import * as _$_spences10_pi_git_ui0 from "@spences10/pi-git-ui";
|
|
15
|
-
import * as _$_spences10_pi_confirm_destructive0 from "@spences10/pi-confirm-destructive";
|
|
16
|
-
import * as _$_spences10_pi_svelte_guardrails0 from "@spences10/pi-svelte-guardrails";
|
|
17
|
-
import * as _$_spences10_pi_coding_preferences0 from "@spences10/pi-coding-preferences";
|
|
18
|
-
import * as _$_spences10_pi_team_mode0 from "@spences10/pi-team-mode";
|
|
19
|
-
|
|
20
3
|
//#region src/extensions/startup-screen/index.d.ts
|
|
21
4
|
declare function startup_screen_extension(pi: ExtensionAPI): void;
|
|
22
5
|
//#endregion
|
|
@@ -41,7 +24,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
41
24
|
readonly cli_flag: "--no-context-sidecar";
|
|
42
25
|
readonly cli_description: "Disable SQLite context sidecar for large tool output";
|
|
43
26
|
readonly aliases: readonly ["context-sidecar", "context", "sidecar"];
|
|
44
|
-
readonly load: () => Promise<typeof
|
|
27
|
+
readonly load: () => Promise<typeof import("@spences10/pi-context").default>;
|
|
45
28
|
}, {
|
|
46
29
|
readonly key: "mcp";
|
|
47
30
|
readonly label: "MCP";
|
|
@@ -53,7 +36,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
53
36
|
readonly cli_flag: "--no-mcp";
|
|
54
37
|
readonly cli_description: "Disable built-in MCP extension";
|
|
55
38
|
readonly aliases: readonly ["mcp"];
|
|
56
|
-
readonly load: () => Promise<typeof
|
|
39
|
+
readonly load: () => Promise<typeof import("@spences10/pi-mcp").default>;
|
|
57
40
|
}, {
|
|
58
41
|
readonly key: "footer";
|
|
59
42
|
readonly label: "Footer";
|
|
@@ -69,7 +52,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
69
52
|
readonly disabled_in: readonly ["print", "json", "rpc"];
|
|
70
53
|
readonly reason: "Footer only renders in the interactive TUI";
|
|
71
54
|
};
|
|
72
|
-
readonly load: () => Promise<typeof
|
|
55
|
+
readonly load: () => Promise<typeof import("@spences10/pi-footer").default>;
|
|
73
56
|
}, {
|
|
74
57
|
readonly key: "skills";
|
|
75
58
|
readonly label: "Skills";
|
|
@@ -81,7 +64,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
81
64
|
readonly cli_flag: "--no-skills";
|
|
82
65
|
readonly cli_description: "Disable built-in skills extension";
|
|
83
66
|
readonly aliases: readonly ["skills", "skill"];
|
|
84
|
-
readonly load: () => Promise<typeof
|
|
67
|
+
readonly load: () => Promise<typeof import("@spences10/pi-skills").default>;
|
|
85
68
|
}, {
|
|
86
69
|
readonly key: "skill-importer";
|
|
87
70
|
readonly label: "Skill importer";
|
|
@@ -93,7 +76,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
93
76
|
readonly cli_flag: "--no-skill-importer";
|
|
94
77
|
readonly cli_description: "Disable external skill importer extension";
|
|
95
78
|
readonly aliases: readonly ["skill-importer", "import-skills", "skill-import"];
|
|
96
|
-
readonly load: () => Promise<typeof
|
|
79
|
+
readonly load: () => Promise<typeof import("@spences10/pi-skill-importer").default>;
|
|
97
80
|
}, {
|
|
98
81
|
readonly key: "filter-output";
|
|
99
82
|
readonly label: "Secret redaction";
|
|
@@ -105,7 +88,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
105
88
|
readonly cli_flag: "--no-filter";
|
|
106
89
|
readonly cli_description: "Disable secret redaction in tool output";
|
|
107
90
|
readonly aliases: readonly ["filter-output", "filter_output", "filter", "redaction", "secret-redaction", "output-redaction"];
|
|
108
|
-
readonly load: () => Promise<typeof
|
|
91
|
+
readonly load: () => Promise<typeof import("@spences10/pi-redact").default>;
|
|
109
92
|
}, {
|
|
110
93
|
readonly key: "recall";
|
|
111
94
|
readonly label: "Recall";
|
|
@@ -117,7 +100,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
117
100
|
readonly cli_flag: "--no-recall";
|
|
118
101
|
readonly cli_description: "Disable recall extension";
|
|
119
102
|
readonly aliases: readonly ["recall", "pirecall"];
|
|
120
|
-
readonly load: () => Promise<typeof
|
|
103
|
+
readonly load: () => Promise<typeof import("@spences10/pi-recall").default>;
|
|
121
104
|
}, {
|
|
122
105
|
readonly key: "nopeek";
|
|
123
106
|
readonly label: "Nopeek";
|
|
@@ -129,7 +112,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
129
112
|
readonly cli_flag: "--no-nopeek";
|
|
130
113
|
readonly cli_description: "Disable nopeek reminder extension";
|
|
131
114
|
readonly aliases: readonly ["nopeek", "secrets", "secret-loading"];
|
|
132
|
-
readonly load: () => Promise<typeof
|
|
115
|
+
readonly load: () => Promise<typeof import("@spences10/pi-nopeek").default>;
|
|
133
116
|
}, {
|
|
134
117
|
readonly key: "omnisearch";
|
|
135
118
|
readonly label: "Omnisearch";
|
|
@@ -141,7 +124,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
141
124
|
readonly cli_flag: "--no-omnisearch";
|
|
142
125
|
readonly cli_description: "Disable mcp-omnisearch reminder extension";
|
|
143
126
|
readonly aliases: readonly ["omnisearch", "search", "web-search", "research"];
|
|
144
|
-
readonly load: () => Promise<typeof
|
|
127
|
+
readonly load: () => Promise<typeof import("@spences10/pi-omnisearch").default>;
|
|
145
128
|
}, {
|
|
146
129
|
readonly key: "sqlite-tools";
|
|
147
130
|
readonly label: "SQLite tools";
|
|
@@ -153,7 +136,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
153
136
|
readonly cli_flag: "--no-sqlite-tools";
|
|
154
137
|
readonly cli_description: "Disable mcp-sqlite-tools reminder extension";
|
|
155
138
|
readonly aliases: readonly ["sqlite-tools", "sqlite", "mcp-sqlite-tools"];
|
|
156
|
-
readonly load: () => Promise<typeof
|
|
139
|
+
readonly load: () => Promise<typeof import("@spences10/pi-sqlite-tools").default>;
|
|
157
140
|
}, {
|
|
158
141
|
readonly key: "startup-screen";
|
|
159
142
|
readonly label: "Startup screen";
|
|
@@ -197,7 +180,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
197
180
|
readonly disabled_in: readonly ["print", "json", "rpc"];
|
|
198
181
|
readonly reason: "Git UI is only useful in interactive mode";
|
|
199
182
|
};
|
|
200
|
-
readonly load: () => Promise<typeof
|
|
183
|
+
readonly load: () => Promise<typeof import("@spences10/pi-git-ui").default>;
|
|
201
184
|
}, {
|
|
202
185
|
readonly key: "lsp";
|
|
203
186
|
readonly label: "LSP";
|
|
@@ -209,7 +192,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
209
192
|
readonly cli_flag: "--no-lsp";
|
|
210
193
|
readonly cli_description: "Disable LSP extension";
|
|
211
194
|
readonly aliases: readonly ["lsp", "language-server"];
|
|
212
|
-
readonly load: () => Promise<(pi:
|
|
195
|
+
readonly load: () => Promise<(pi: import("@earendil-works/pi-coding-agent").ExtensionAPI) => Promise<void>>;
|
|
213
196
|
}, {
|
|
214
197
|
readonly key: "session-name";
|
|
215
198
|
readonly label: "Session name";
|
|
@@ -237,7 +220,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
237
220
|
readonly cli_flag: "--no-confirm-destructive";
|
|
238
221
|
readonly cli_description: "Disable destructive action confirmations";
|
|
239
222
|
readonly aliases: readonly ["confirm-destructive", "confirm"];
|
|
240
|
-
readonly load: () => Promise<typeof
|
|
223
|
+
readonly load: () => Promise<typeof import("@spences10/pi-confirm-destructive").default>;
|
|
241
224
|
}, {
|
|
242
225
|
readonly key: "hooks-resolution";
|
|
243
226
|
readonly label: "Hooks resolution";
|
|
@@ -261,7 +244,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
261
244
|
readonly cli_flag: "--no-svelte-guardrails";
|
|
262
245
|
readonly cli_description: "Disable Svelte guardrails";
|
|
263
246
|
readonly aliases: readonly ["svelte-guardrails", "svelte"];
|
|
264
|
-
readonly load: () => Promise<typeof
|
|
247
|
+
readonly load: () => Promise<typeof import("@spences10/pi-svelte-guardrails").default>;
|
|
265
248
|
}, {
|
|
266
249
|
readonly key: "coding-preferences";
|
|
267
250
|
readonly label: "Coding preferences";
|
|
@@ -273,7 +256,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
273
256
|
readonly cli_flag: "--no-coding-preferences";
|
|
274
257
|
readonly cli_description: "Disable coding preferences guardrails";
|
|
275
258
|
readonly aliases: readonly ["coding-preferences", "preferences", "prefs"];
|
|
276
|
-
readonly load: () => Promise<typeof
|
|
259
|
+
readonly load: () => Promise<typeof import("@spences10/pi-coding-preferences").default>;
|
|
277
260
|
}, {
|
|
278
261
|
readonly key: "handoff";
|
|
279
262
|
readonly label: "Handoff";
|
|
@@ -297,7 +280,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
297
280
|
readonly cli_flag: "--no-team-mode";
|
|
298
281
|
readonly cli_description: "Disable experimental team mode extension";
|
|
299
282
|
readonly aliases: readonly ["team-mode", "team", "teammates"];
|
|
300
|
-
readonly load: () => Promise<typeof
|
|
283
|
+
readonly load: () => Promise<typeof import("@spences10/pi-team-mode").default>;
|
|
301
284
|
}];
|
|
302
285
|
type BuiltinExtensionKey = (typeof BUILTIN_EXTENSION_REGISTRY)[number]['key'];
|
|
303
286
|
type BuiltinExtensionOptionName = (typeof BUILTIN_EXTENSION_REGISTRY)[number]['option_name'];
|
|
@@ -332,7 +315,7 @@ declare function resolve_model_reference(model_reference: string | undefined, mo
|
|
|
332
315
|
declare function resolve_effective_thinking_level(model: Model<Api> | undefined, thinking: MyPiThinkingLevel | undefined): MyPiThinkingLevel | undefined;
|
|
333
316
|
declare function get_force_disabled_builtins(options: Pick<CreateMyPiOptions, 'runtime_mode'> & BuiltinExtensionOptions): ReadonlySet<BuiltinExtensionKey>;
|
|
334
317
|
declare function create_lazy_builtin_extension_factory(key: BuiltinExtensionKey, load_extension: BuiltinExtensionLoader, force_disabled: ReadonlySet<BuiltinExtensionKey>): ExtensionFactory$1;
|
|
335
|
-
declare function create_my_pi(options?: CreateMyPiOptions): Promise<
|
|
318
|
+
declare function create_my_pi(options?: CreateMyPiOptions): Promise<import("@earendil-works/pi-coding-agent").AgentSessionRuntime>;
|
|
336
319
|
//#endregion
|
|
337
320
|
export { type AgentSessionRuntime, CreateMyPiOptions, type ExtensionFactory, InteractiveMode, type InteractiveModeOptions, MyPiRuntimeMode, MyPiThinkingLevel, type PrintModeOptions, apply_untrusted_repo_defaults, create_lazy_builtin_extension_factory, create_my_pi, get_force_disabled_builtins, resolve_effective_thinking_level, resolve_model_reference, runPrintMode, runRpcMode };
|
|
338
321
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as BUILTIN_EXTENSION_REGISTRY, t as BUILTIN_EXTENSIONS } from "./builtin-registry-
|
|
1
|
+
import { n as BUILTIN_EXTENSION_REGISTRY, t as BUILTIN_EXTENSIONS } from "./builtin-registry-DBm8gws_.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { basename, dirname, join, resolve } from "node:path";
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","names":[],"sources":["../src/settings/schema.ts","../src/settings/current.ts","../src/settings/legacy.ts","../src/settings/migrate.ts","../src/settings/index.ts","../src/extensions/manager/config.ts","../src/extensions/manager/index.ts","../src/api.ts"],"sourcesContent":["import type { BuiltinExtensionKey } from '../extensions/builtin-registry.js';\n\nexport interface MyPiSettings {\n\tversion: 1;\n\textensions: {\n\t\tenabled: Partial<Record<BuiltinExtensionKey, boolean>>;\n\t};\n\tmcp?: { policy?: unknown };\n\tcodingPreferences?: unknown;\n\tpromptPresets?: { global?: unknown; state?: unknown };\n\ttrust?: Record<string, unknown>;\n\tpackages?: Record<string, unknown>;\n}\n\nexport const DEFAULT_SETTINGS: MyPiSettings = {\n\tversion: 1,\n\textensions: {\n\t\tenabled: {},\n\t},\n};\n\nexport function normalize_settings(value: unknown): MyPiSettings {\n\tconst raw = value as Partial<MyPiSettings> | null | undefined;\n\tconst enabled: MyPiSettings['extensions']['enabled'] = {};\n\tconst raw_enabled = raw?.extensions?.enabled;\n\tif (raw_enabled && typeof raw_enabled === 'object') {\n\t\tfor (const [key, state] of Object.entries(raw_enabled)) {\n\t\t\tif (typeof state === 'boolean') {\n\t\t\t\tenabled[key as BuiltinExtensionKey] = state;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\t...(raw && typeof raw === 'object' ? raw : {}),\n\t\tversion: 1,\n\t\textensions: { enabled },\n\t};\n}\n","import {\n\tget_settings_path,\n\tread_settings,\n\twrite_settings,\n} from '@spences10/pi-settings';\nimport { existsSync } from 'node:fs';\nimport {\n\tDEFAULT_SETTINGS,\n\tnormalize_settings,\n\ttype MyPiSettings,\n} from './schema.js';\n\nexport { get_settings_path } from '@spences10/pi-settings';\n\nexport function current_settings_exists(): boolean {\n\treturn existsSync(get_settings_path());\n}\n\nexport function read_current_settings(): MyPiSettings {\n\tif (!current_settings_exists()) return { ...DEFAULT_SETTINGS };\n\treturn normalize_settings(read_settings());\n}\n\nexport function write_current_settings(settings: MyPiSettings): void {\n\twrite_settings(settings);\n}\n\nexport function ensure_current_settings(): MyPiSettings {\n\tif (!current_settings_exists())\n\t\twrite_current_settings(DEFAULT_SETTINGS);\n\treturn read_current_settings();\n}\n","import { getAgentDir } from '@earendil-works/pi-coding-agent';\n// Temporary migration bridge: keep for two minor releases after\n// my-pi-settings.json ships, then remove with migrate.ts and related tests.\nimport { existsSync, readFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { type BuiltinExtensionKey } from '../extensions/builtin-registry.js';\n\nexport interface LegacyBuiltinExtensionsConfig {\n\tversion?: number;\n\tenabled?: Partial<Record<BuiltinExtensionKey, boolean>>;\n}\n\nexport interface LegacySettingsFiles {\n\textensions?: {\n\t\tpath: string;\n\t\tconfig: LegacyBuiltinExtensionsConfig;\n\t};\n\tmcpPolicy?: { path: string; config: unknown };\n\tcodingPreferences?: { path: string; config: unknown };\n\tpromptPresets?: { path: string; config: unknown };\n\tpromptPresetState?: { path: string; config: unknown };\n\ttrustedHooks?: { path: string; config: unknown };\n\ttrustedMcpProjects?: { path: string; config: unknown };\n\ttrustedLspBinaries?: { path: string; config: unknown };\n\ttelemetry?: { path: string; config: unknown };\n\tfooter?: { path: string; config: unknown };\n\tskills?: { path: string; config: unknown };\n\tsvelteGuardrails?: { path: string; config: unknown };\n\tcontext?: { path: string; config: unknown };\n}\n\nexport function get_legacy_builtin_extensions_config_path(): string {\n\tconst xdg =\n\t\tprocess.env.XDG_CONFIG_HOME || join(homedir(), '.config');\n\treturn join(xdg, 'my-pi', 'extensions.json');\n}\n\nfunction read_json_file<T>(path: string): T | undefined {\n\tif (!existsSync(path)) return undefined;\n\treturn JSON.parse(readFileSync(path, 'utf-8')) as T;\n}\n\nfunction maybe_file<T>(\n\tpath: string,\n): { path: string; config: T } | undefined {\n\tconst config = read_json_file<T>(path);\n\treturn config === undefined ? undefined : { path, config };\n}\n\nexport function find_legacy_settings_files(): LegacySettingsFiles {\n\tconst agent = getAgentDir();\n\tconst xdg =\n\t\tprocess.env.XDG_CONFIG_HOME || join(homedir(), '.config');\n\treturn {\n\t\textensions: maybe_file<LegacyBuiltinExtensionsConfig>(\n\t\t\tget_legacy_builtin_extensions_config_path(),\n\t\t),\n\t\tmcpPolicy: maybe_file(join(agent, 'mcp-policy.json')),\n\t\tcodingPreferences: maybe_file(\n\t\t\tjoin(agent, 'coding-preferences.json'),\n\t\t),\n\t\tpromptPresets: maybe_file(join(agent, 'presets.json')),\n\t\tpromptPresetState: maybe_file(\n\t\t\tjoin(agent, 'prompt-preset-state.json'),\n\t\t),\n\t\ttrustedHooks: maybe_file(join(agent, 'trusted-hooks.json')),\n\t\ttrustedMcpProjects: maybe_file(\n\t\t\tjoin(agent, 'trusted-mcp-projects.json'),\n\t\t),\n\t\ttrustedLspBinaries: maybe_file(\n\t\t\tjoin(agent, 'trusted-lsp-binaries.json'),\n\t\t),\n\t\ttelemetry: maybe_file(join(agent, 'telemetry.json')),\n\t\tfooter: maybe_file(join(agent, 'extensions', 'pi-footer.json')),\n\t\tskills: maybe_file(join(xdg, 'my-pi', 'skills.json')),\n\t\tsvelteGuardrails: maybe_file(\n\t\t\tjoin(xdg, 'my-pi', 'svelte-guardrails.json'),\n\t\t),\n\t\tcontext: maybe_file(join(xdg, 'my-pi', 'context.json')),\n\t};\n}\n\nexport function has_legacy_settings_files(): boolean {\n\treturn Object.values(find_legacy_settings_files()).some(Boolean);\n}\n","import { getAgentDir } from '@earendil-works/pi-coding-agent';\nimport {\n\tread_settings,\n\twrite_settings,\n} from '@spences10/pi-settings';\nimport {\n\tcopyFileSync,\n\texistsSync,\n\tmkdirSync,\n\trenameSync,\n\tunlinkSync,\n\twriteFileSync,\n} from 'node:fs';\nimport { basename, dirname, join } from 'node:path';\nimport { find_legacy_settings_files } from './legacy.js';\nimport { normalize_settings, type MyPiSettings } from './schema.js';\n\nexport interface SettingsMigrationResult {\n\tmigrated: boolean;\n\tbackup_dir?: string;\n\tmoved_files: string[];\n\tsettings: MyPiSettings;\n}\n\nfunction timestamp_for_filename(date = new Date()): string {\n\treturn date.toISOString().replace(/[:.]/g, '-');\n}\n\nfunction backup_path_for(\n\toriginal_path: string,\n\tbackup_dir: string,\n): string {\n\tconst parent = basename(dirname(original_path));\n\treturn join(backup_dir, `${parent}-${basename(original_path)}`);\n}\n\nfunction move_file_to_backup(source: string, target: string): void {\n\ttry {\n\t\trenameSync(source, target);\n\t} catch (error) {\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\t'code' in error &&\n\t\t\terror.code === 'EXDEV'\n\t\t) {\n\t\t\tcopyFileSync(source, target);\n\t\t\tunlinkSync(source);\n\t\t\treturn;\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nexport function migrate_legacy_settings(): SettingsMigrationResult {\n\tconst legacy = find_legacy_settings_files();\n\tconst entries = Object.values(legacy).filter(\n\t\t(entry) => entry !== undefined,\n\t);\n\tconst settings = read_settings();\n\n\tif (legacy.extensions) {\n\t\tsettings.extensions = {\n\t\t\t...settings.extensions,\n\t\t\tenabled: {\n\t\t\t\t...settings.extensions?.enabled,\n\t\t\t\t...legacy.extensions.config.enabled,\n\t\t\t},\n\t\t};\n\t}\n\tif (legacy.mcpPolicy) {\n\t\tsettings.mcp = {\n\t\t\t...settings.mcp,\n\t\t\tpolicy: legacy.mcpPolicy.config,\n\t\t};\n\t}\n\tif (legacy.codingPreferences) {\n\t\tsettings.codingPreferences = legacy.codingPreferences.config;\n\t}\n\tif (legacy.promptPresets || legacy.promptPresetState) {\n\t\tsettings.promptPresets = {\n\t\t\t...settings.promptPresets,\n\t\t\t...(legacy.promptPresets && {\n\t\t\t\tglobal: legacy.promptPresets.config,\n\t\t\t}),\n\t\t\t...(legacy.promptPresetState && {\n\t\t\t\tstate: legacy.promptPresetState.config,\n\t\t\t}),\n\t\t};\n\t}\n\tsettings.trust = {\n\t\t...settings.trust,\n\t\t...(legacy.trustedHooks && { hooks: legacy.trustedHooks.config }),\n\t\t...(legacy.trustedMcpProjects && {\n\t\t\tmcpProjects: legacy.trustedMcpProjects.config,\n\t\t}),\n\t\t...(legacy.trustedLspBinaries && {\n\t\t\tlspBinaries: legacy.trustedLspBinaries.config,\n\t\t}),\n\t};\n\tsettings.packages = {\n\t\t...settings.packages,\n\t\t...(legacy.telemetry && { telemetry: legacy.telemetry.config }),\n\t\t...(legacy.footer && { footer: legacy.footer.config }),\n\t\t...(legacy.skills && { skills: legacy.skills.config }),\n\t\t...(legacy.svelteGuardrails && {\n\t\t\tsvelteGuardrails: legacy.svelteGuardrails.config,\n\t\t}),\n\t\t...(legacy.context && { context: legacy.context.config }),\n\t};\n\n\twrite_settings(settings);\n\n\tif (entries.length === 0) {\n\t\treturn {\n\t\t\tmigrated: false,\n\t\t\tmoved_files: [],\n\t\t\tsettings: normalize_settings(settings),\n\t\t};\n\t}\n\n\tconst backup_dir = join(\n\t\tgetAgentDir(),\n\t\t`legacy-config-backup-${timestamp_for_filename()}`,\n\t);\n\tmkdirSync(backup_dir, { recursive: true, mode: 0o700 });\n\n\tconst moved_files: string[] = [];\n\tfor (const entry of entries) {\n\t\tif (!existsSync(entry.path)) continue;\n\t\tconst target = backup_path_for(entry.path, backup_dir);\n\t\tmove_file_to_backup(entry.path, target);\n\t\tmoved_files.push(entry.path);\n\t}\n\n\twriteFileSync(\n\t\tjoin(backup_dir, 'migration-report.json'),\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\tsettings_path: join(getAgentDir(), 'my-pi-settings.json'),\n\t\t\t\tmoved_files,\n\t\t\t},\n\t\t\tnull,\n\t\t\t'\\t',\n\t\t) + '\\n',\n\t\t{ mode: 0o600 },\n\t);\n\n\treturn {\n\t\tmigrated: true,\n\t\tbackup_dir,\n\t\tmoved_files,\n\t\tsettings: normalize_settings(settings),\n\t};\n}\n","import {\n\tensure_current_settings,\n\tread_current_settings,\n\twrite_current_settings,\n} from './current.js';\nimport { has_legacy_settings_files } from './legacy.js';\nimport { migrate_legacy_settings } from './migrate.js';\nimport type { MyPiSettings } from './schema.js';\n\nexport { get_settings_path } from './current.js';\nexport { migrate_legacy_settings } from './migrate.js';\nexport type { MyPiSettings } from './schema.js';\n\nexport function load_settings(): MyPiSettings {\n\tif (has_legacy_settings_files())\n\t\treturn migrate_legacy_settings().settings;\n\treturn ensure_current_settings();\n}\n\nexport function save_settings(settings: MyPiSettings): void {\n\twrite_current_settings(settings);\n}\n\nexport function update_settings(\n\tupdater: (settings: MyPiSettings) => MyPiSettings,\n): MyPiSettings {\n\tconst next = updater(read_current_settings());\n\twrite_current_settings(next);\n\treturn next;\n}\n","import {\n\tBUILTIN_EXTENSIONS,\n\ttype BuiltinExtensionInfo,\n\ttype BuiltinExtensionKey,\n} from '../builtin-registry.js';\nimport {\n\tget_settings_path,\n\tload_settings,\n\tsave_settings,\n} from '../../settings/index.js';\n\nexport { BUILTIN_EXTENSIONS };\nexport type { BuiltinExtensionInfo, BuiltinExtensionKey };\n\nexport interface BuiltinExtensionsConfig {\n\tversion: number;\n\tenabled: Partial<Record<BuiltinExtensionKey, boolean>>;\n}\n\nexport interface BuiltinExtensionState extends BuiltinExtensionInfo {\n\tsaved_enabled: boolean;\n\teffective_enabled: boolean;\n\tforced_disabled: boolean;\n}\n\nexport function get_builtin_extensions_config_path(): string {\n\treturn get_settings_path();\n}\n\nexport function load_builtin_extensions_config(): BuiltinExtensionsConfig {\n\tconst settings = load_settings();\n\tconst enabled: BuiltinExtensionsConfig['enabled'] = {};\n\tfor (const extension of BUILTIN_EXTENSIONS) {\n\t\tconst value = settings.extensions.enabled[extension.key];\n\t\tif (typeof value === 'boolean') enabled[extension.key] = value;\n\t}\n\treturn { version: 1, enabled };\n}\n\nexport function save_builtin_extensions_config(\n\tconfig: BuiltinExtensionsConfig,\n): void {\n\tconst settings = load_settings();\n\tsave_settings({\n\t\t...settings,\n\t\textensions: {\n\t\t\t...settings.extensions,\n\t\t\tenabled: config.enabled,\n\t\t},\n\t});\n}\n\nexport function is_builtin_extension_enabled(\n\tconfig: BuiltinExtensionsConfig,\n\tkey: BuiltinExtensionKey,\n): boolean {\n\treturn config.enabled[key] ?? true;\n}\n\nexport function is_builtin_extension_active(\n\tconfig: BuiltinExtensionsConfig,\n\tkey: BuiltinExtensionKey,\n\tforce_disabled: ReadonlySet<BuiltinExtensionKey> = new Set(),\n): boolean {\n\treturn (\n\t\tis_builtin_extension_enabled(config, key) &&\n\t\t!force_disabled.has(key)\n\t);\n}\n\nexport function resolve_builtin_extension_states(\n\tforce_disabled: ReadonlySet<BuiltinExtensionKey> = new Set(),\n\tconfig: BuiltinExtensionsConfig = load_builtin_extensions_config(),\n): BuiltinExtensionState[] {\n\treturn BUILTIN_EXTENSIONS.map((extension) => {\n\t\tconst saved_enabled = is_builtin_extension_enabled(\n\t\t\tconfig,\n\t\t\textension.key,\n\t\t);\n\t\tconst forced = force_disabled.has(extension.key);\n\t\treturn {\n\t\t\t...extension,\n\t\t\tsaved_enabled,\n\t\t\teffective_enabled: saved_enabled && !forced,\n\t\t\tforced_disabled: forced,\n\t\t};\n\t});\n}\n\nexport function find_builtin_extension(\n\tquery: string,\n): BuiltinExtensionInfo | undefined {\n\tconst normalized = query.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\n\treturn BUILTIN_EXTENSIONS.find((extension) =>\n\t\t[extension.key, extension.label, ...extension.aliases].some(\n\t\t\t(value) => value.toLowerCase() === normalized,\n\t\t),\n\t);\n}\n","import type {\n\tExtensionAPI,\n\tExtensionCommandContext,\n} from '@earendil-works/pi-coding-agent';\nimport { type SettingItem } from '@earendil-works/pi-tui';\nimport { show_settings_modal } from '@spences10/pi-tui-modal';\nimport {\n\tBUILTIN_EXTENSIONS,\n\tfind_builtin_extension,\n\tload_builtin_extensions_config,\n\tresolve_builtin_extension_states,\n\tsave_builtin_extensions_config,\n\ttype BuiltinExtensionKey,\n\ttype BuiltinExtensionState,\n} from './config.js';\n\nconst ENABLED = '● enabled';\nconst DISABLED = '○ disabled';\n\nexport interface ExtensionsManagerOptions {\n\tforce_disabled?: Iterable<BuiltinExtensionKey>;\n}\n\nfunction to_force_disabled_set(\n\tforce_disabled?: Iterable<BuiltinExtensionKey>,\n): ReadonlySet<BuiltinExtensionKey> {\n\treturn new Set(force_disabled ?? []);\n}\n\nfunction format_effective_state(\n\tstate: BuiltinExtensionState,\n): string {\n\tif (state.effective_enabled) {\n\t\treturn 'enabled';\n\t}\n\tif (state.forced_disabled) {\n\t\treturn `disabled in this process by ${state.cli_flag}`;\n\t}\n\treturn 'disabled';\n}\n\nfunction format_extension_lines(\n\tstates: BuiltinExtensionState[],\n\toptions?: { heading?: string },\n): string {\n\tconst lines: string[] = [];\n\tif (options?.heading) {\n\t\tlines.push(options.heading, '');\n\t}\n\n\tconst enabled_now = states.filter(\n\t\t(state) => state.effective_enabled,\n\t).length;\n\tconst disabled_now = states.length - enabled_now;\n\tlines.push(\n\t\t`${states.length} built-in extensions (${enabled_now} enabled now, ${disabled_now} disabled now)`,\n\t\t'',\n\t);\n\n\tfor (const state of states) {\n\t\tlines.push(\n\t\t\t`${state.saved_enabled ? ENABLED : DISABLED} ${state.label}`,\n\t\t);\n\t\tlines.push(` key: ${state.key}`);\n\t\tlines.push(\n\t\t\t` saved config: ${state.saved_enabled ? 'enabled' : 'disabled'}`,\n\t\t);\n\t\tlines.push(\n\t\t\t` current process: ${format_effective_state(state)}`,\n\t\t);\n\t\tlines.push(` ${state.description}`);\n\t}\n\n\treturn lines.join('\\n');\n}\n\nfunction to_setting_item(state: BuiltinExtensionState): SettingItem {\n\tconst detail_lines = [\n\t\tstate.key,\n\t\tstate.description,\n\t\t`current process: ${format_effective_state(state)}`,\n\t\t`startup override: ${state.cli_flag}`,\n\t];\n\n\treturn {\n\t\tid: state.key,\n\t\tlabel: state.label,\n\t\tdescription: detail_lines.join('\\n'),\n\t\tcurrentValue: state.saved_enabled ? ENABLED : DISABLED,\n\t\tvalues: [ENABLED, DISABLED],\n\t};\n}\n\nfunction sets_equal(\n\ta: ReadonlySet<string>,\n\tb: ReadonlySet<string>,\n): boolean {\n\tif (a.size !== b.size) return false;\n\tfor (const value of a) {\n\t\tif (!b.has(value)) return false;\n\t}\n\treturn true;\n}\n\nfunction search_states(\n\tstates: BuiltinExtensionState[],\n\tquery: string,\n): BuiltinExtensionState[] {\n\tconst normalized = query.trim().toLowerCase();\n\tif (!normalized) return states;\n\n\treturn states.filter((state) =>\n\t\t[\n\t\t\tstate.key,\n\t\t\tstate.label,\n\t\t\tstate.description,\n\t\t\t...state.aliases,\n\t\t].some((value) => value.toLowerCase().includes(normalized)),\n\t);\n}\n\nfunction save_extension_enabled(\n\tkey: BuiltinExtensionKey,\n\tenabled: boolean,\n): void {\n\tconst config = load_builtin_extensions_config();\n\tconfig.enabled[key] = enabled;\n\tsave_builtin_extensions_config(config);\n}\n\nexport function create_extensions_extension(\n\toptions: ExtensionsManagerOptions = {},\n) {\n\tconst force_disabled = to_force_disabled_set(\n\t\toptions.force_disabled,\n\t);\n\n\tasync function show_manager(\n\t\tctx: ExtensionCommandContext,\n\t): Promise<boolean> {\n\t\tif (!ctx.hasUI) return false;\n\n\t\tconst states = resolve_builtin_extension_states(force_disabled);\n\t\tconst initial_enabled = new Set(\n\t\t\tstates\n\t\t\t\t.filter((state) => state.saved_enabled)\n\t\t\t\t.map((state) => state.key),\n\t\t);\n\t\tconst current_enabled = new Set(initial_enabled);\n\n\t\tconst items = states.map(to_setting_item);\n\t\tawait show_settings_modal(ctx, {\n\t\t\ttitle: 'Built-in extensions',\n\t\t\tsubtitle: () => {\n\t\t\t\tconst saved_enabled = current_enabled.size;\n\t\t\t\tconst saved_disabled = states.length - saved_enabled;\n\t\t\t\tconst enabled_now = [...current_enabled].filter(\n\t\t\t\t\t(key) => !force_disabled.has(key as BuiltinExtensionKey),\n\t\t\t\t).length;\n\t\t\t\tconst disabled_now = states.length - enabled_now;\n\t\t\t\treturn `${saved_enabled} saved enabled • ${saved_disabled} saved disabled • ${enabled_now} enabled now • ${disabled_now} disabled now`;\n\t\t\t},\n\t\t\titems,\n\t\t\tenable_search: true,\n\t\t\tfooter:\n\t\t\t\t'esc close • search filters • changes save immediately • CLI --no-* flags still win in this process',\n\t\t\ton_change: (id, new_value) => {\n\t\t\t\tconst key = id as BuiltinExtensionKey;\n\t\t\t\tconst enabled = new_value === ENABLED;\n\t\t\t\tif (enabled) {\n\t\t\t\t\tcurrent_enabled.add(key);\n\t\t\t\t} else {\n\t\t\t\t\tcurrent_enabled.delete(key);\n\t\t\t\t}\n\t\t\t\tsave_extension_enabled(key, enabled);\n\t\t\t},\n\t\t});\n\n\t\tif (!sets_equal(initial_enabled, current_enabled)) {\n\t\t\tctx.ui.notify(\n\t\t\t\tforce_disabled.size > 0\n\t\t\t\t\t? 'Reloading to apply updated built-in extensions. CLI --no-* flags still force-disable some extensions in this process.'\n\t\t\t\t\t: 'Reloading to apply updated built-in extensions...',\n\t\t\t\t'info',\n\t\t\t);\n\t\t\tawait ctx.reload();\n\t\t}\n\n\t\treturn true;\n\t}\n\n\treturn async function extensions(pi: ExtensionAPI) {\n\t\tconst subs = ['list', 'enable', 'disable', 'toggle', 'search'];\n\n\t\tpi.registerCommand('extensions', {\n\t\t\tdescription: 'Manage built-in my-pi extensions',\n\t\t\tgetArgumentCompletions: (prefix) => {\n\t\t\t\tconst parts = prefix.trim().split(/\\s+/);\n\t\t\t\tif (parts.length <= 1) {\n\t\t\t\t\treturn subs\n\t\t\t\t\t\t.filter((sub) => sub.startsWith(parts[0] || ''))\n\t\t\t\t\t\t.map((sub) => ({ value: sub, label: sub }));\n\t\t\t\t}\n\n\t\t\t\tif (['enable', 'disable', 'toggle'].includes(parts[0])) {\n\t\t\t\t\tconst q = parts.slice(1).join(' ').toLowerCase();\n\t\t\t\t\treturn resolve_builtin_extension_states(force_disabled)\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t(state) =>\n\t\t\t\t\t\t\t\tstate.key.toLowerCase().includes(q) ||\n\t\t\t\t\t\t\t\tstate.label.toLowerCase().includes(q),\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.slice(0, 20)\n\t\t\t\t\t\t.map((state) => ({\n\t\t\t\t\t\t\tvalue: `${parts[0]} ${state.key}`,\n\t\t\t\t\t\t\tlabel: `${state.key} ${state.saved_enabled ? ENABLED : DISABLED}`,\n\t\t\t\t\t\t}));\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\t\t\t},\n\t\t\thandler: async (args, ctx) => {\n\t\t\t\tconst trimmed = args.trim();\n\n\t\t\t\tif (!trimmed) {\n\t\t\t\t\tif (await show_manager(ctx)) return;\n\t\t\t\t}\n\n\t\t\t\tconst [sub, ...rest] = (trimmed || 'list').split(/\\s+/);\n\t\t\t\tconst arg = rest.join(' ');\n\t\t\t\tconst states =\n\t\t\t\t\tresolve_builtin_extension_states(force_disabled);\n\n\t\t\t\tswitch (sub) {\n\t\t\t\t\tcase 'list': {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\tformat_extension_lines(states, {\n\t\t\t\t\t\t\t\theading: 'Built-in extensions',\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'enable':\n\t\t\t\t\tcase 'disable':\n\t\t\t\t\tcase 'toggle': {\n\t\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\t\tif (await show_manager(ctx)) return;\n\t\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t\t`Usage: /extensions ${sub} <key>`,\n\t\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst extension = find_builtin_extension(arg);\n\t\t\t\t\t\tif (!extension) {\n\t\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t\t`Unknown extension: ${arg}. Use: ${BUILTIN_EXTENSIONS.map((item) => item.key).join(', ')}`,\n\t\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst current_state = states.find(\n\t\t\t\t\t\t\t(state) => state.key === extension.key,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst next_enabled =\n\t\t\t\t\t\t\tsub === 'enable'\n\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t: sub === 'disable'\n\t\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t\t: !current_state?.saved_enabled;\n\t\t\t\t\t\tsave_extension_enabled(extension.key, next_enabled);\n\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\tnext_enabled && force_disabled.has(extension.key)\n\t\t\t\t\t\t\t\t? `Enabled ${extension.key} in saved config. Still disabled in this process by ${extension.cli_flag}. /reload or restart without that flag to apply.`\n\t\t\t\t\t\t\t\t: `${extension.key} ${next_enabled ? 'enabled' : 'disabled'}. /reload to apply.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'search': {\n\t\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t\t'Usage: /extensions search <query>',\n\t\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst results = search_states(states, arg);\n\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t\t`No built-in extensions matching \"${arg}\"`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\tformat_extension_lines(results, {\n\t\t\t\t\t\t\t\theading: `Built-in extensions matching \"${arg}\"`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t`Unknown: ${sub}. Use: ${subs.join(', ')}`,\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t};\n}\n\nexport default create_extensions_extension();\n","// Composable programmatic API for my-pi\n\nimport {\n\tclampThinkingLevel,\n\ttype Api,\n\ttype Model,\n} from '@earendil-works/pi-ai';\nimport {\n\tInteractiveMode,\n\tSessionManager,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tgetAgentDir,\n\trunPrintMode,\n\trunRpcMode,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype ExtensionFactory,\n\ttype LoadExtensionsResult,\n} from '@earendil-works/pi-coding-agent';\nimport { apply_project_trust_untrusted_defaults } from '@spences10/pi-project-trust';\nimport { createRequire } from 'node:module';\nimport { dirname, resolve } from 'node:path';\nimport {\n\tBUILTIN_EXTENSION_REGISTRY,\n\ttype BuiltinExtensionKey,\n\ttype BuiltinExtensionOptionName,\n} from './extensions/builtin-registry.js';\nimport {\n\tis_builtin_extension_active,\n\tload_builtin_extensions_config,\n} from './extensions/manager/config.js';\nimport { create_extensions_extension } from './extensions/manager/index.js';\n\nexport type MyPiRuntimeMode =\n\t| 'interactive'\n\t| 'print'\n\t| 'json'\n\t| 'rpc';\n\nexport type MyPiThinkingLevel = NonNullable<\n\tCreateAgentSessionFromServicesOptions['thinkingLevel']\n>;\n\ntype BuiltinExtensionOptions = Partial<\n\tRecord<BuiltinExtensionOptionName, boolean>\n>;\n\nexport interface CreateMyPiOptions extends BuiltinExtensionOptions {\n\tcwd?: string;\n\tagent_dir?: string;\n\textensions?: string[];\n\textensionFactories?: ExtensionFactory[];\n\truntime_mode?: MyPiRuntimeMode;\n\ttelemetry?: boolean;\n\ttelemetry_db_path?: string;\n\tmodel?: string;\n\tthinking?: MyPiThinkingLevel;\n\tselected_tools?: string[];\n\tselected_skills?: string[];\n\tsession_dir?: string;\n\tsystem_prompt?: string;\n\tappend_system_prompt?: string;\n\tuntrusted_repo?: boolean;\n}\n\ntype BuiltinExtensionLoader = () => Promise<ExtensionFactory>;\n\nconst require = createRequire(import.meta.url);\nconst PACKAGE_THEME_DIR = resolve(\n\tdirname(require.resolve('@spences10/pi-themes/package.json')),\n\t'themes',\n);\nconst PI_AGENT_DIR_ENV = 'PI_CODING_AGENT_DIR';\nconst MY_PI_RUNTIME_MODE_ENV = 'MY_PI_RUNTIME_MODE';\n\ntype EnvSnapshot = Map<string, string | undefined>;\n\nfunction snapshot_env(\n\tenv: NodeJS.ProcessEnv,\n\tkeys: Iterable<string>,\n): EnvSnapshot {\n\treturn new Map(Array.from(keys, (key) => [key, env[key]]));\n}\n\nfunction restore_env(\n\tenv: NodeJS.ProcessEnv,\n\tsnapshot: EnvSnapshot,\n): void {\n\tfor (const [key, value] of snapshot) {\n\t\tif (value === undefined) delete env[key];\n\t\telse env[key] = value;\n\t}\n}\n\nfunction wrap_runtime_env_restore<\n\tT extends { dispose(): Promise<void> },\n>(runtime: T, restore: () => void): T {\n\tconst dispose = runtime.dispose.bind(runtime);\n\tlet restored = false;\n\tconst restore_once = () => {\n\t\tif (restored) return;\n\t\trestored = true;\n\t\trestore();\n\t};\n\n\truntime.dispose = (async () => {\n\t\ttry {\n\t\t\tawait dispose();\n\t\t} finally {\n\t\t\trestore_once();\n\t\t}\n\t}) as T['dispose'];\n\n\treturn runtime;\n}\n\nconst UNTRUSTED_CHILD_ENV_DEFAULTS: Record<string, string> = {\n\tMY_PI_CHILD_ENV_ALLOWLIST: '',\n\tMY_PI_MCP_ENV_ALLOWLIST: '',\n\tMY_PI_LSP_ENV_ALLOWLIST: '',\n\tMY_PI_HOOKS_ENV_ALLOWLIST: '',\n\tMY_PI_TEAM_MODE_ENV_ALLOWLIST: '',\n};\n\nexport function apply_untrusted_repo_defaults(\n\tenv: NodeJS.ProcessEnv = process.env,\n): string[] {\n\tconst applied = apply_project_trust_untrusted_defaults(env);\n\tfor (const [key, value] of Object.entries(\n\t\tUNTRUSTED_CHILD_ENV_DEFAULTS,\n\t)) {\n\t\tif (env[key] !== undefined) continue;\n\t\tenv[key] = value;\n\t\tapplied.push(key);\n\t}\n\treturn applied;\n}\n\nfunction is_resource_enabled(value: string | undefined): boolean {\n\tconst normalized = value?.trim().toLowerCase();\n\tif (!normalized) return true;\n\tif (['0', 'false', 'no', 'skip', 'disable'].includes(normalized)) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction resolve_agent_dir(cwd: string, agent_dir?: string): string {\n\treturn agent_dir ? resolve(cwd, agent_dir) : getAgentDir();\n}\n\ninterface ModelRegistryLike {\n\tgetAll(): Model<Api>[];\n}\n\nexport function resolve_model_reference(\n\tmodel_reference: string | undefined,\n\tmodel_registry: ModelRegistryLike,\n): Model<Api> | undefined {\n\tif (!model_reference) return undefined;\n\tconst models = model_registry.getAll();\n\tconst lower_reference = model_reference.toLowerCase();\n\tconst slash_index = model_reference.indexOf('/');\n\n\tif (slash_index !== -1) {\n\t\tconst maybe_provider = model_reference.slice(0, slash_index);\n\t\tconst model_id = model_reference.slice(slash_index + 1);\n\t\tconst provider = models.find(\n\t\t\t(model) =>\n\t\t\t\tmodel.provider.toLowerCase() === maybe_provider.toLowerCase(),\n\t\t)?.provider;\n\n\t\tif (provider) {\n\t\t\tconst provider_match = models.find(\n\t\t\t\t(model) =>\n\t\t\t\t\tmodel.provider === provider &&\n\t\t\t\t\tmodel.id.toLowerCase() === model_id.toLowerCase(),\n\t\t\t);\n\t\t\tif (provider_match) return provider_match;\n\t\t}\n\t}\n\n\treturn models.find((model) => {\n\t\tconst id = model.id.toLowerCase();\n\t\tconst full_id = `${model.provider}/${model.id}`.toLowerCase();\n\t\treturn id === lower_reference || full_id === lower_reference;\n\t});\n}\n\nexport function resolve_effective_thinking_level(\n\tmodel: Model<Api> | undefined,\n\tthinking: MyPiThinkingLevel | undefined,\n): MyPiThinkingLevel | undefined {\n\tif (!thinking || !model) return thinking;\n\treturn clampThinkingLevel(model, thinking);\n}\n\nexport function get_force_disabled_builtins(\n\toptions: Pick<CreateMyPiOptions, 'runtime_mode'> &\n\t\tBuiltinExtensionOptions,\n): ReadonlySet<BuiltinExtensionKey> {\n\tconst force_disabled = new Set<BuiltinExtensionKey>();\n\tfor (const extension of BUILTIN_EXTENSION_REGISTRY) {\n\t\tconst enabled =\n\t\t\toptions[extension.option_name] ?? extension.default_enabled;\n\t\tif (!enabled) force_disabled.add(extension.key);\n\t\tconst disabled_in =\n\t\t\t'mode_constraints' in extension\n\t\t\t\t? extension.mode_constraints.disabled_in\n\t\t\t\t: undefined;\n\t\tif (\n\t\t\toptions.runtime_mode &&\n\t\t\t(\n\t\t\t\tdisabled_in as readonly MyPiRuntimeMode[] | undefined\n\t\t\t)?.includes(options.runtime_mode)\n\t\t) {\n\t\t\tforce_disabled.add(extension.key);\n\t\t}\n\t}\n\treturn force_disabled;\n}\n\nfunction warn_builtin_extension_unavailable(\n\tkey: BuiltinExtensionKey | 'telemetry',\n\terror: unknown,\n): void {\n\tconst reason =\n\t\terror instanceof Error ? error.message : String(error);\n\tprocess.emitWarning(\n\t\t`Built-in extension \"${key}\" is unavailable and was skipped: ${reason}`,\n\t\t{ code: 'MY_PI_BUILTIN_EXTENSION_UNAVAILABLE' },\n\t);\n}\n\nexport function create_lazy_builtin_extension_factory(\n\tkey: BuiltinExtensionKey,\n\tload_extension: BuiltinExtensionLoader,\n\tforce_disabled: ReadonlySet<BuiltinExtensionKey>,\n): ExtensionFactory {\n\treturn async (pi) => {\n\t\tconst config = load_builtin_extensions_config();\n\t\tif (!is_builtin_extension_active(config, key, force_disabled)) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst extension = await load_extension();\n\t\t\tawait extension(pi);\n\t\t} catch (error) {\n\t\t\twarn_builtin_extension_unavailable(key, error);\n\t\t}\n\t};\n}\n\nfunction create_lazy_telemetry_extension(options: {\n\tenabled?: boolean;\n\tdb_path?: string;\n\tcwd?: string;\n}): ExtensionFactory {\n\treturn async (pi) => {\n\t\ttry {\n\t\t\tconst { create_telemetry_extension } =\n\t\t\t\tawait import('@spences10/pi-telemetry');\n\t\t\tawait create_telemetry_extension(options)(pi);\n\t\t} catch (error) {\n\t\t\twarn_builtin_extension_unavailable('telemetry', error);\n\t\t}\n\t};\n}\n\nfunction create_extensions_override(\n\tmanaged_inline_paths: string[],\n): (base: LoadExtensionsResult) => LoadExtensionsResult {\n\tconst managed_paths = new Set(managed_inline_paths);\n\treturn (base) => {\n\t\tconst managed = new Map(\n\t\t\tbase.extensions.map((extension) => [extension.path, extension]),\n\t\t);\n\t\tconst ordered_managed = managed_inline_paths\n\t\t\t.map((path) => managed.get(path))\n\t\t\t.filter(\n\t\t\t\t(\n\t\t\t\t\textension,\n\t\t\t\t): extension is LoadExtensionsResult['extensions'][number] =>\n\t\t\t\t\tBoolean(extension),\n\t\t\t);\n\t\tconst others = base.extensions.filter(\n\t\t\t(extension) => !managed_paths.has(extension.path),\n\t\t);\n\t\treturn {\n\t\t\t...base,\n\t\t\textensions: [...ordered_managed, ...others],\n\t\t};\n\t};\n}\n\nexport async function create_my_pi(options: CreateMyPiOptions = {}) {\n\tconst {\n\t\tcwd = process.cwd(),\n\t\tagent_dir,\n\t\textensions = [],\n\t\textensionFactories: user_factories = [],\n\t\truntime_mode = 'interactive',\n\t\ttelemetry,\n\t\ttelemetry_db_path,\n\t\tmodel,\n\t\tthinking,\n\t\tselected_tools,\n\t\tselected_skills,\n\t\tsession_dir,\n\t\tsystem_prompt,\n\t\tappend_system_prompt,\n\t\tuntrusted_repo = false,\n\t} = options;\n\n\tconst env_keys_to_restore = new Set<string>([\n\t\tMY_PI_RUNTIME_MODE_ENV,\n\t]);\n\tif (agent_dir) env_keys_to_restore.add(PI_AGENT_DIR_ENV);\n\tconst env_snapshot = snapshot_env(process.env, env_keys_to_restore);\n\tlet restore_runtime_env = () =>\n\t\trestore_env(process.env, env_snapshot);\n\n\tif (untrusted_repo) {\n\t\tconst applied = apply_untrusted_repo_defaults();\n\t\tif (applied.length) {\n\t\t\tconst restore_previous = restore_runtime_env;\n\t\t\trestore_runtime_env = () => {\n\t\t\t\tfor (const key of applied) delete process.env[key];\n\t\t\t\trestore_previous();\n\t\t\t};\n\t\t}\n\t}\n\n\tconst effective_agent_dir = resolve_agent_dir(cwd, agent_dir);\n\tif (agent_dir) {\n\t\tprocess.env[PI_AGENT_DIR_ENV] = effective_agent_dir;\n\t}\n\tprocess.env[MY_PI_RUNTIME_MODE_ENV] = runtime_mode;\n\n\tconst resolved_extensions = extensions.map((p) => resolve(cwd, p));\n\tconst force_disabled = get_force_disabled_builtins({\n\t\t...options,\n\t\truntime_mode,\n\t});\n\tconst builtins_config = load_builtin_extensions_config();\n\tconst skills_builtin_enabled = is_builtin_extension_active(\n\t\tbuiltins_config,\n\t\t'skills',\n\t\tforce_disabled,\n\t);\n\tconst skills_package = skills_builtin_enabled\n\t\t? await import('@spences10/pi-skills').catch((error) => {\n\t\t\t\twarn_builtin_extension_unavailable('skills', error);\n\t\t\t\treturn undefined;\n\t\t\t})\n\t\t: undefined;\n\n\tconst managed_extension_factories: ExtensionFactory[] = [\n\t\tcreate_lazy_telemetry_extension({\n\t\t\tenabled: telemetry,\n\t\t\tdb_path: telemetry_db_path,\n\t\t\tcwd,\n\t\t}),\n\t\tcreate_extensions_extension({ force_disabled }),\n\t\t...BUILTIN_EXTENSION_REGISTRY.map((extension) =>\n\t\t\tcreate_lazy_builtin_extension_factory(\n\t\t\t\textension.key,\n\t\t\t\textension.load,\n\t\t\t\tforce_disabled,\n\t\t\t),\n\t\t),\n\t];\n\tconst managed_inline_paths = managed_extension_factories.map(\n\t\t(_, index) => `<inline:${index + 1}>`,\n\t);\n\n\tconst create_runtime = async ({\n\t\tcwd: runtime_cwd,\n\t\tsessionManager,\n\t\tsessionStartEvent,\n\t}: {\n\t\tcwd: string;\n\t\tsessionManager: SessionManager;\n\t\tsessionStartEvent?: unknown;\n\t}) => {\n\t\t// Keep skill filtering reloadable so profile changes made by\n\t\t// /skills are reflected without restarting the process.\n\t\tconst runtime_skills_manager =\n\t\t\tskills_package?.create_skills_manager({\n\t\t\t\tcwd: runtime_cwd,\n\t\t\t\tproject_skills_enabled: is_resource_enabled(\n\t\t\t\t\tprocess.env.MY_PI_PROJECT_SKILLS,\n\t\t\t\t),\n\t\t\t});\n\t\tconst additional_skill_paths =\n\t\t\truntime_skills_manager?.get_enabled_skill_paths() ?? [];\n\n\t\tconst services = await createAgentSessionServices({\n\t\t\tcwd: runtime_cwd,\n\t\t\tagentDir: effective_agent_dir,\n\t\t\tresourceLoaderOptions: {\n\t\t\t\t...(additional_skill_paths.length\n\t\t\t\t\t? { additionalSkillPaths: additional_skill_paths }\n\t\t\t\t\t: {}),\n\t\t\t\t...(system_prompt !== undefined\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tsystemPromptOverride: () => system_prompt,\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t\t...(append_system_prompt !== undefined\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tappendSystemPromptOverride: (base: string[]) => [\n\t\t\t\t\t\t\t\t...base,\n\t\t\t\t\t\t\t\tappend_system_prompt,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t\tadditionalExtensionPaths: [...resolved_extensions],\n\t\t\t\t...(runtime_mode === 'interactive'\n\t\t\t\t\t? { additionalThemePaths: [PACKAGE_THEME_DIR] }\n\t\t\t\t\t: {}),\n\t\t\t\textensionFactories: [\n\t\t\t\t\t...managed_extension_factories,\n\t\t\t\t\t...user_factories,\n\t\t\t\t],\n\t\t\t\textensionsOverride: create_extensions_override(\n\t\t\t\t\tmanaged_inline_paths,\n\t\t\t\t),\n\t\t\t\tskillsOverride: (base: any) => {\n\t\t\t\t\tif (!runtime_skills_manager) return base;\n\t\t\t\t\truntime_skills_manager.refresh();\n\n\t\t\t\t\tconst selected_skill_names = selected_skills?.length\n\t\t\t\t\t\t? new Set(selected_skills)\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...base,\n\t\t\t\t\t\tskills: base.skills.filter((skill: any) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tselected_skill_names &&\n\t\t\t\t\t\t\t\t!selected_skill_names.has(skill.name)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn runtime_skills_manager.is_enabled_by_skill(\n\t\t\t\t\t\t\t\tskill.name,\n\t\t\t\t\t\t\t\tskill.filePath,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t} as any,\n\t\t});\n\n\t\tconst requested_model = resolve_model_reference(\n\t\t\tmodel,\n\t\t\tservices.modelRegistry,\n\t\t);\n\t\tconst effective_thinking = resolve_effective_thinking_level(\n\t\t\trequested_model,\n\t\t\tthinking,\n\t\t);\n\t\tif (\n\t\t\trequested_model &&\n\t\t\tthinking &&\n\t\t\teffective_thinking &&\n\t\t\teffective_thinking !== thinking\n\t\t) {\n\t\t\tservices.diagnostics.push({\n\t\t\t\ttype: 'warning',\n\t\t\t\tmessage: `Requested thinking level \"${thinking}\" is not supported by ${requested_model.provider}/${requested_model.id}; using \"${effective_thinking}\".`,\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\t...(await createAgentSessionFromServices({\n\t\t\t\tservices,\n\t\t\t\tsessionManager,\n\t\t\t\tsessionStartEvent: sessionStartEvent as any,\n\t\t\t\t...(requested_model ? { model: requested_model } : {}),\n\t\t\t\t...(effective_thinking\n\t\t\t\t\t? { thinkingLevel: effective_thinking }\n\t\t\t\t\t: {}),\n\t\t\t\t...(selected_tools?.length ? { tools: selected_tools } : {}),\n\t\t\t})),\n\t\t\tservices,\n\t\t\tdiagnostics: services.diagnostics,\n\t\t};\n\t};\n\n\ttry {\n\t\treturn wrap_runtime_env_restore(\n\t\t\tawait createAgentSessionRuntime(create_runtime, {\n\t\t\t\tcwd,\n\t\t\t\tagentDir: effective_agent_dir,\n\t\t\t\tsessionManager: SessionManager.create(\n\t\t\t\t\tcwd,\n\t\t\t\t\tsession_dir ? resolve(cwd, session_dir) : undefined,\n\t\t\t\t),\n\t\t\t}),\n\t\t\trestore_runtime_env,\n\t\t);\n\t} catch (error) {\n\t\trestore_runtime_env();\n\t\tthrow error;\n\t}\n}\n\nexport { InteractiveMode, runPrintMode, runRpcMode };\n\nexport type {\n\tAgentSessionRuntime,\n\tExtensionFactory,\n\tInteractiveModeOptions,\n\tPrintModeOptions,\n} from '@earendil-works/pi-coding-agent';\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,mBAAiC;CAC7C,SAAS;CACT,YAAY,EACX,SAAS,EAAE,EACX;CACD;AAED,SAAgB,mBAAmB,OAA8B;CAChE,MAAM,MAAM;CACZ,MAAM,UAAiD,EAAE;CACzD,MAAM,cAAc,KAAK,YAAY;CACrC,IAAI,eAAe,OAAO,gBAAgB;OACpC,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,YAAY,EACrD,IAAI,OAAO,UAAU,WACpB,QAAQ,OAA8B;;CAKzC,OAAO;EACN,GAAI,OAAO,OAAO,QAAQ,WAAW,MAAM,EAAE;EAC7C,SAAS;EACT,YAAY,EAAE,SAAS;EACvB;;;;ACvBF,SAAgB,0BAAmC;CAClD,OAAO,WAAW,mBAAmB,CAAC;;AAGvC,SAAgB,wBAAs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,CAAC,wBAAwB,OAAO;KACpC,uBAAuB,SAAS;KAEhC,MAAM,uBAAuB,iBAAiB,SAC3C,IAAI,IAAI,gBAAgB,GACxB,KAAA;KACH,OAAO;MACN,GAAG;MACH,QAAQ,KAAK,OAAO,QAAQ,UAAe;OAC1C,IACC,wBACA,CAAC,qBAAqB,IAAI,MAAM,KAAK,EAErC,OAAO;OAER,OAAO,uBAAuB,oBAC7B,MAAM,MACN,MAAM,SACN;QACA;MACF;;IAEF;GACD,CAAC;EAEF,MAAM,kBAAkB,wBACvB,OACA,SAAS,cACT;EACD,MAAM,qBAAqB,iCAC1B,iBACA,SACA;EACD,IACC,mBACA,YACA,sBACA,uBAAuB,UAEvB,SAAS,YAAY,KAAK;GACzB,MAAM;GACN,SAAS,6BAA6B,SAAS,wBAAwB,gBAAgB,SAAS,GAAG,gBAAgB,GAAG,WAAW,mBAAmB;GACpJ,CAAC;EAGH,OAAO;GACN,GAAI,MAAM,+BAA+B;IACxC;IACA;IACmB;IACnB,GAAI,kBAAkB,EAAE,OAAO,iBAAiB,GAAG,EAAE;IACrD,GAAI,qBACD,EAAE,eAAe,oBAAoB,GACrC,EAAE;IACL,GAAI,gBAAgB,SAAS,EAAE,OAAO,gBAAgB,GAAG,EAAE;IAC3D,CAAC;GACF;GACA,aAAa,SAAS;GACtB;;CAGF,IAAI;EACH,OAAO,yBACN,MAAM,0BAA0B,gBAAgB;GAC/C;GACA,UAAU;GACV,gBAAgB,eAAe,OAC9B,KACA,cAAc,QAAQ,KAAK,YAAY,GAAG,KAAA,EAC1C;GACD,CAAC,EACF,oBACA;UACO,OAAO;EACf,qBAAqB;EACrB,MAAM"}
|
|
1
|
+
{"version":3,"file":"api.js","names":[],"sources":["../src/settings/schema.ts","../src/settings/current.ts","../src/settings/legacy.ts","../src/settings/migrate.ts","../src/settings/index.ts","../src/extensions/manager/config.ts","../src/extensions/manager/index.ts","../src/api.ts"],"sourcesContent":["import type { BuiltinExtensionKey } from '../extensions/builtin-registry.js';\n\nexport interface MyPiSettings {\n\tversion: 1;\n\textensions: {\n\t\tenabled: Partial<Record<BuiltinExtensionKey, boolean>>;\n\t};\n\tmcp?: { policy?: unknown };\n\tcodingPreferences?: unknown;\n\tpromptPresets?: { global?: unknown; state?: unknown };\n\ttrust?: Record<string, unknown>;\n\tpackages?: Record<string, unknown>;\n}\n\nexport const DEFAULT_SETTINGS: MyPiSettings = {\n\tversion: 1,\n\textensions: {\n\t\tenabled: {},\n\t},\n};\n\nexport function normalize_settings(value: unknown): MyPiSettings {\n\tconst raw = value as Partial<MyPiSettings> | null | undefined;\n\tconst enabled: MyPiSettings['extensions']['enabled'] = {};\n\tconst raw_enabled = raw?.extensions?.enabled;\n\tif (raw_enabled && typeof raw_enabled === 'object') {\n\t\tfor (const [key, state] of Object.entries(raw_enabled)) {\n\t\t\tif (typeof state === 'boolean') {\n\t\t\t\tenabled[key as BuiltinExtensionKey] = state;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\t...(raw && typeof raw === 'object' ? raw : {}),\n\t\tversion: 1,\n\t\textensions: { enabled },\n\t};\n}\n","import {\n\tget_settings_path,\n\tread_settings,\n\twrite_settings,\n} from '@spences10/pi-settings';\nimport { existsSync } from 'node:fs';\nimport {\n\tDEFAULT_SETTINGS,\n\tnormalize_settings,\n\ttype MyPiSettings,\n} from './schema.js';\n\nexport { get_settings_path } from '@spences10/pi-settings';\n\nexport function current_settings_exists(): boolean {\n\treturn existsSync(get_settings_path());\n}\n\nexport function read_current_settings(): MyPiSettings {\n\tif (!current_settings_exists()) return { ...DEFAULT_SETTINGS };\n\treturn normalize_settings(read_settings());\n}\n\nexport function write_current_settings(settings: MyPiSettings): void {\n\twrite_settings(settings);\n}\n\nexport function ensure_current_settings(): MyPiSettings {\n\tif (!current_settings_exists())\n\t\twrite_current_settings(DEFAULT_SETTINGS);\n\treturn read_current_settings();\n}\n","import { getAgentDir } from '@earendil-works/pi-coding-agent';\n// Temporary migration bridge: keep for two minor releases after\n// my-pi-settings.json ships, then remove with migrate.ts and related tests.\nimport { existsSync, readFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { type BuiltinExtensionKey } from '../extensions/builtin-registry.js';\n\nexport interface LegacyBuiltinExtensionsConfig {\n\tversion?: number;\n\tenabled?: Partial<Record<BuiltinExtensionKey, boolean>>;\n}\n\nexport interface LegacySettingsFiles {\n\textensions?: {\n\t\tpath: string;\n\t\tconfig: LegacyBuiltinExtensionsConfig;\n\t};\n\tmcpPolicy?: { path: string; config: unknown };\n\tcodingPreferences?: { path: string; config: unknown };\n\tpromptPresets?: { path: string; config: unknown };\n\tpromptPresetState?: { path: string; config: unknown };\n\ttrustedHooks?: { path: string; config: unknown };\n\ttrustedMcpProjects?: { path: string; config: unknown };\n\ttrustedLspBinaries?: { path: string; config: unknown };\n\ttelemetry?: { path: string; config: unknown };\n\tfooter?: { path: string; config: unknown };\n\tskills?: { path: string; config: unknown };\n\tsvelteGuardrails?: { path: string; config: unknown };\n\tcontext?: { path: string; config: unknown };\n}\n\nexport function get_legacy_builtin_extensions_config_path(): string {\n\tconst xdg =\n\t\tprocess.env.XDG_CONFIG_HOME || join(homedir(), '.config');\n\treturn join(xdg, 'my-pi', 'extensions.json');\n}\n\nfunction read_json_file<T>(path: string): T | undefined {\n\tif (!existsSync(path)) return undefined;\n\treturn JSON.parse(readFileSync(path, 'utf-8')) as T;\n}\n\nfunction maybe_file<T>(\n\tpath: string,\n): { path: string; config: T } | undefined {\n\tconst config = read_json_file<T>(path);\n\treturn config === undefined ? undefined : { path, config };\n}\n\nexport function find_legacy_settings_files(): LegacySettingsFiles {\n\tconst agent = getAgentDir();\n\tconst xdg =\n\t\tprocess.env.XDG_CONFIG_HOME || join(homedir(), '.config');\n\treturn {\n\t\textensions: maybe_file<LegacyBuiltinExtensionsConfig>(\n\t\t\tget_legacy_builtin_extensions_config_path(),\n\t\t),\n\t\tmcpPolicy: maybe_file(join(agent, 'mcp-policy.json')),\n\t\tcodingPreferences: maybe_file(\n\t\t\tjoin(agent, 'coding-preferences.json'),\n\t\t),\n\t\tpromptPresets: maybe_file(join(agent, 'presets.json')),\n\t\tpromptPresetState: maybe_file(\n\t\t\tjoin(agent, 'prompt-preset-state.json'),\n\t\t),\n\t\ttrustedHooks: maybe_file(join(agent, 'trusted-hooks.json')),\n\t\ttrustedMcpProjects: maybe_file(\n\t\t\tjoin(agent, 'trusted-mcp-projects.json'),\n\t\t),\n\t\ttrustedLspBinaries: maybe_file(\n\t\t\tjoin(agent, 'trusted-lsp-binaries.json'),\n\t\t),\n\t\ttelemetry: maybe_file(join(agent, 'telemetry.json')),\n\t\tfooter: maybe_file(join(agent, 'extensions', 'pi-footer.json')),\n\t\tskills: maybe_file(join(xdg, 'my-pi', 'skills.json')),\n\t\tsvelteGuardrails: maybe_file(\n\t\t\tjoin(xdg, 'my-pi', 'svelte-guardrails.json'),\n\t\t),\n\t\tcontext: maybe_file(join(xdg, 'my-pi', 'context.json')),\n\t};\n}\n\nexport function has_legacy_settings_files(): boolean {\n\treturn Object.values(find_legacy_settings_files()).some(Boolean);\n}\n","import { getAgentDir } from '@earendil-works/pi-coding-agent';\nimport {\n\tread_settings,\n\twrite_settings,\n} from '@spences10/pi-settings';\nimport {\n\tcopyFileSync,\n\texistsSync,\n\tmkdirSync,\n\trenameSync,\n\tunlinkSync,\n\twriteFileSync,\n} from 'node:fs';\nimport { basename, dirname, join } from 'node:path';\nimport { find_legacy_settings_files } from './legacy.js';\nimport { normalize_settings, type MyPiSettings } from './schema.js';\n\nexport interface SettingsMigrationResult {\n\tmigrated: boolean;\n\tbackup_dir?: string;\n\tmoved_files: string[];\n\tsettings: MyPiSettings;\n}\n\nfunction timestamp_for_filename(date = new Date()): string {\n\treturn date.toISOString().replace(/[:.]/g, '-');\n}\n\nfunction backup_path_for(\n\toriginal_path: string,\n\tbackup_dir: string,\n): string {\n\tconst parent = basename(dirname(original_path));\n\treturn join(backup_dir, `${parent}-${basename(original_path)}`);\n}\n\nfunction move_file_to_backup(source: string, target: string): void {\n\ttry {\n\t\trenameSync(source, target);\n\t} catch (error) {\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\t'code' in error &&\n\t\t\terror.code === 'EXDEV'\n\t\t) {\n\t\t\tcopyFileSync(source, target);\n\t\t\tunlinkSync(source);\n\t\t\treturn;\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nexport function migrate_legacy_settings(): SettingsMigrationResult {\n\tconst legacy = find_legacy_settings_files();\n\tconst entries = Object.values(legacy).filter(\n\t\t(entry) => entry !== undefined,\n\t);\n\tconst settings = read_settings();\n\n\tif (legacy.extensions) {\n\t\tsettings.extensions = {\n\t\t\t...settings.extensions,\n\t\t\tenabled: {\n\t\t\t\t...settings.extensions?.enabled,\n\t\t\t\t...legacy.extensions.config.enabled,\n\t\t\t},\n\t\t};\n\t}\n\tif (legacy.mcpPolicy) {\n\t\tsettings.mcp = {\n\t\t\t...settings.mcp,\n\t\t\tpolicy: legacy.mcpPolicy.config,\n\t\t};\n\t}\n\tif (legacy.codingPreferences) {\n\t\tsettings.codingPreferences = legacy.codingPreferences.config;\n\t}\n\tif (legacy.promptPresets || legacy.promptPresetState) {\n\t\tsettings.promptPresets = {\n\t\t\t...settings.promptPresets,\n\t\t\t...(legacy.promptPresets && {\n\t\t\t\tglobal: legacy.promptPresets.config,\n\t\t\t}),\n\t\t\t...(legacy.promptPresetState && {\n\t\t\t\tstate: legacy.promptPresetState.config,\n\t\t\t}),\n\t\t};\n\t}\n\tsettings.trust = {\n\t\t...settings.trust,\n\t\t...(legacy.trustedHooks && { hooks: legacy.trustedHooks.config }),\n\t\t...(legacy.trustedMcpProjects && {\n\t\t\tmcpProjects: legacy.trustedMcpProjects.config,\n\t\t}),\n\t\t...(legacy.trustedLspBinaries && {\n\t\t\tlspBinaries: legacy.trustedLspBinaries.config,\n\t\t}),\n\t};\n\tsettings.packages = {\n\t\t...settings.packages,\n\t\t...(legacy.telemetry && { telemetry: legacy.telemetry.config }),\n\t\t...(legacy.footer && { footer: legacy.footer.config }),\n\t\t...(legacy.skills && { skills: legacy.skills.config }),\n\t\t...(legacy.svelteGuardrails && {\n\t\t\tsvelteGuardrails: legacy.svelteGuardrails.config,\n\t\t}),\n\t\t...(legacy.context && { context: legacy.context.config }),\n\t};\n\n\twrite_settings(settings);\n\n\tif (entries.length === 0) {\n\t\treturn {\n\t\t\tmigrated: false,\n\t\t\tmoved_files: [],\n\t\t\tsettings: normalize_settings(settings),\n\t\t};\n\t}\n\n\tconst backup_dir = join(\n\t\tgetAgentDir(),\n\t\t`legacy-config-backup-${timestamp_for_filename()}`,\n\t);\n\tmkdirSync(backup_dir, { recursive: true, mode: 0o700 });\n\n\tconst moved_files: string[] = [];\n\tfor (const entry of entries) {\n\t\tif (!existsSync(entry.path)) continue;\n\t\tconst target = backup_path_for(entry.path, backup_dir);\n\t\tmove_file_to_backup(entry.path, target);\n\t\tmoved_files.push(entry.path);\n\t}\n\n\twriteFileSync(\n\t\tjoin(backup_dir, 'migration-report.json'),\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\tsettings_path: join(getAgentDir(), 'my-pi-settings.json'),\n\t\t\t\tmoved_files,\n\t\t\t},\n\t\t\tnull,\n\t\t\t'\\t',\n\t\t) + '\\n',\n\t\t{ mode: 0o600 },\n\t);\n\n\treturn {\n\t\tmigrated: true,\n\t\tbackup_dir,\n\t\tmoved_files,\n\t\tsettings: normalize_settings(settings),\n\t};\n}\n","import {\n\tensure_current_settings,\n\tread_current_settings,\n\twrite_current_settings,\n} from './current.js';\nimport { has_legacy_settings_files } from './legacy.js';\nimport { migrate_legacy_settings } from './migrate.js';\nimport type { MyPiSettings } from './schema.js';\n\nexport { get_settings_path } from './current.js';\nexport { migrate_legacy_settings } from './migrate.js';\nexport type { MyPiSettings } from './schema.js';\n\nexport function load_settings(): MyPiSettings {\n\tif (has_legacy_settings_files())\n\t\treturn migrate_legacy_settings().settings;\n\treturn ensure_current_settings();\n}\n\nexport function save_settings(settings: MyPiSettings): void {\n\twrite_current_settings(settings);\n}\n\nexport function update_settings(\n\tupdater: (settings: MyPiSettings) => MyPiSettings,\n): MyPiSettings {\n\tconst next = updater(read_current_settings());\n\twrite_current_settings(next);\n\treturn next;\n}\n","import {\n\tBUILTIN_EXTENSIONS,\n\ttype BuiltinExtensionInfo,\n\ttype BuiltinExtensionKey,\n} from '../builtin-registry.js';\nimport {\n\tget_settings_path,\n\tload_settings,\n\tsave_settings,\n} from '../../settings/index.js';\n\nexport { BUILTIN_EXTENSIONS };\nexport type { BuiltinExtensionInfo, BuiltinExtensionKey };\n\nexport interface BuiltinExtensionsConfig {\n\tversion: number;\n\tenabled: Partial<Record<BuiltinExtensionKey, boolean>>;\n}\n\nexport interface BuiltinExtensionState extends BuiltinExtensionInfo {\n\tsaved_enabled: boolean;\n\teffective_enabled: boolean;\n\tforced_disabled: boolean;\n}\n\nexport function get_builtin_extensions_config_path(): string {\n\treturn get_settings_path();\n}\n\nexport function load_builtin_extensions_config(): BuiltinExtensionsConfig {\n\tconst settings = load_settings();\n\tconst enabled: BuiltinExtensionsConfig['enabled'] = {};\n\tfor (const extension of BUILTIN_EXTENSIONS) {\n\t\tconst value = settings.extensions.enabled[extension.key];\n\t\tif (typeof value === 'boolean') enabled[extension.key] = value;\n\t}\n\treturn { version: 1, enabled };\n}\n\nexport function save_builtin_extensions_config(\n\tconfig: BuiltinExtensionsConfig,\n): void {\n\tconst settings = load_settings();\n\tsave_settings({\n\t\t...settings,\n\t\textensions: {\n\t\t\t...settings.extensions,\n\t\t\tenabled: config.enabled,\n\t\t},\n\t});\n}\n\nexport function is_builtin_extension_enabled(\n\tconfig: BuiltinExtensionsConfig,\n\tkey: BuiltinExtensionKey,\n): boolean {\n\treturn config.enabled[key] ?? true;\n}\n\nexport function is_builtin_extension_active(\n\tconfig: BuiltinExtensionsConfig,\n\tkey: BuiltinExtensionKey,\n\tforce_disabled: ReadonlySet<BuiltinExtensionKey> = new Set(),\n): boolean {\n\treturn (\n\t\tis_builtin_extension_enabled(config, key) &&\n\t\t!force_disabled.has(key)\n\t);\n}\n\nexport function resolve_builtin_extension_states(\n\tforce_disabled: ReadonlySet<BuiltinExtensionKey> = new Set(),\n\tconfig: BuiltinExtensionsConfig = load_builtin_extensions_config(),\n): BuiltinExtensionState[] {\n\treturn BUILTIN_EXTENSIONS.map((extension) => {\n\t\tconst saved_enabled = is_builtin_extension_enabled(\n\t\t\tconfig,\n\t\t\textension.key,\n\t\t);\n\t\tconst forced = force_disabled.has(extension.key);\n\t\treturn {\n\t\t\t...extension,\n\t\t\tsaved_enabled,\n\t\t\teffective_enabled: saved_enabled && !forced,\n\t\t\tforced_disabled: forced,\n\t\t};\n\t});\n}\n\nexport function find_builtin_extension(\n\tquery: string,\n): BuiltinExtensionInfo | undefined {\n\tconst normalized = query.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\n\treturn BUILTIN_EXTENSIONS.find((extension) =>\n\t\t[extension.key, extension.label, ...extension.aliases].some(\n\t\t\t(value) => value.toLowerCase() === normalized,\n\t\t),\n\t);\n}\n","import type {\n\tExtensionAPI,\n\tExtensionCommandContext,\n} from '@earendil-works/pi-coding-agent';\nimport { type SettingItem } from '@earendil-works/pi-tui';\nimport { show_settings_modal } from '@spences10/pi-tui-modal';\nimport {\n\tBUILTIN_EXTENSIONS,\n\tfind_builtin_extension,\n\tload_builtin_extensions_config,\n\tresolve_builtin_extension_states,\n\tsave_builtin_extensions_config,\n\ttype BuiltinExtensionKey,\n\ttype BuiltinExtensionState,\n} from './config.js';\n\nconst ENABLED = '● enabled';\nconst DISABLED = '○ disabled';\n\nexport interface ExtensionsManagerOptions {\n\tforce_disabled?: Iterable<BuiltinExtensionKey>;\n}\n\nfunction to_force_disabled_set(\n\tforce_disabled?: Iterable<BuiltinExtensionKey>,\n): ReadonlySet<BuiltinExtensionKey> {\n\treturn new Set(force_disabled ?? []);\n}\n\nfunction format_effective_state(\n\tstate: BuiltinExtensionState,\n): string {\n\tif (state.effective_enabled) {\n\t\treturn 'enabled';\n\t}\n\tif (state.forced_disabled) {\n\t\treturn `disabled in this process by ${state.cli_flag}`;\n\t}\n\treturn 'disabled';\n}\n\nfunction format_extension_lines(\n\tstates: BuiltinExtensionState[],\n\toptions?: { heading?: string },\n): string {\n\tconst lines: string[] = [];\n\tif (options?.heading) {\n\t\tlines.push(options.heading, '');\n\t}\n\n\tconst enabled_now = states.filter(\n\t\t(state) => state.effective_enabled,\n\t).length;\n\tconst disabled_now = states.length - enabled_now;\n\tlines.push(\n\t\t`${states.length} built-in extensions (${enabled_now} enabled now, ${disabled_now} disabled now)`,\n\t\t'',\n\t);\n\n\tfor (const state of states) {\n\t\tlines.push(\n\t\t\t`${state.saved_enabled ? ENABLED : DISABLED} ${state.label}`,\n\t\t);\n\t\tlines.push(` key: ${state.key}`);\n\t\tlines.push(\n\t\t\t` saved config: ${state.saved_enabled ? 'enabled' : 'disabled'}`,\n\t\t);\n\t\tlines.push(\n\t\t\t` current process: ${format_effective_state(state)}`,\n\t\t);\n\t\tlines.push(` ${state.description}`);\n\t}\n\n\treturn lines.join('\\n');\n}\n\nfunction to_setting_item(state: BuiltinExtensionState): SettingItem {\n\tconst detail_lines = [\n\t\tstate.key,\n\t\tstate.description,\n\t\t`current process: ${format_effective_state(state)}`,\n\t\t`startup override: ${state.cli_flag}`,\n\t];\n\n\treturn {\n\t\tid: state.key,\n\t\tlabel: state.label,\n\t\tdescription: detail_lines.join('\\n'),\n\t\tcurrentValue: state.saved_enabled ? ENABLED : DISABLED,\n\t\tvalues: [ENABLED, DISABLED],\n\t};\n}\n\nfunction sets_equal(\n\ta: ReadonlySet<string>,\n\tb: ReadonlySet<string>,\n): boolean {\n\tif (a.size !== b.size) return false;\n\tfor (const value of a) {\n\t\tif (!b.has(value)) return false;\n\t}\n\treturn true;\n}\n\nfunction search_states(\n\tstates: BuiltinExtensionState[],\n\tquery: string,\n): BuiltinExtensionState[] {\n\tconst normalized = query.trim().toLowerCase();\n\tif (!normalized) return states;\n\n\treturn states.filter((state) =>\n\t\t[\n\t\t\tstate.key,\n\t\t\tstate.label,\n\t\t\tstate.description,\n\t\t\t...state.aliases,\n\t\t].some((value) => value.toLowerCase().includes(normalized)),\n\t);\n}\n\nfunction save_extension_enabled(\n\tkey: BuiltinExtensionKey,\n\tenabled: boolean,\n): void {\n\tconst config = load_builtin_extensions_config();\n\tconfig.enabled[key] = enabled;\n\tsave_builtin_extensions_config(config);\n}\n\nexport function create_extensions_extension(\n\toptions: ExtensionsManagerOptions = {},\n) {\n\tconst force_disabled = to_force_disabled_set(\n\t\toptions.force_disabled,\n\t);\n\n\tasync function show_manager(\n\t\tctx: ExtensionCommandContext,\n\t): Promise<boolean> {\n\t\tif (!ctx.hasUI) return false;\n\n\t\tconst states = resolve_builtin_extension_states(force_disabled);\n\t\tconst initial_enabled = new Set(\n\t\t\tstates\n\t\t\t\t.filter((state) => state.saved_enabled)\n\t\t\t\t.map((state) => state.key),\n\t\t);\n\t\tconst current_enabled = new Set(initial_enabled);\n\n\t\tconst items = states.map(to_setting_item);\n\t\tawait show_settings_modal(ctx, {\n\t\t\ttitle: 'Built-in extensions',\n\t\t\tsubtitle: () => {\n\t\t\t\tconst saved_enabled = current_enabled.size;\n\t\t\t\tconst saved_disabled = states.length - saved_enabled;\n\t\t\t\tconst enabled_now = [...current_enabled].filter(\n\t\t\t\t\t(key) => !force_disabled.has(key as BuiltinExtensionKey),\n\t\t\t\t).length;\n\t\t\t\tconst disabled_now = states.length - enabled_now;\n\t\t\t\treturn `${saved_enabled} saved enabled • ${saved_disabled} saved disabled • ${enabled_now} enabled now • ${disabled_now} disabled now`;\n\t\t\t},\n\t\t\titems,\n\t\t\tenable_search: true,\n\t\t\tfooter:\n\t\t\t\t'esc close • search filters • changes save immediately • CLI --no-* flags still win in this process',\n\t\t\ton_change: (id, new_value) => {\n\t\t\t\tconst key = id as BuiltinExtensionKey;\n\t\t\t\tconst enabled = new_value === ENABLED;\n\t\t\t\tif (enabled) {\n\t\t\t\t\tcurrent_enabled.add(key);\n\t\t\t\t} else {\n\t\t\t\t\tcurrent_enabled.delete(key);\n\t\t\t\t}\n\t\t\t\tsave_extension_enabled(key, enabled);\n\t\t\t},\n\t\t});\n\n\t\tif (!sets_equal(initial_enabled, current_enabled)) {\n\t\t\tctx.ui.notify(\n\t\t\t\tforce_disabled.size > 0\n\t\t\t\t\t? 'Reloading to apply updated built-in extensions. CLI --no-* flags still force-disable some extensions in this process.'\n\t\t\t\t\t: 'Reloading to apply updated built-in extensions...',\n\t\t\t\t'info',\n\t\t\t);\n\t\t\tawait ctx.reload();\n\t\t}\n\n\t\treturn true;\n\t}\n\n\treturn async function extensions(pi: ExtensionAPI) {\n\t\tconst subs = ['list', 'enable', 'disable', 'toggle', 'search'];\n\n\t\tpi.registerCommand('extensions', {\n\t\t\tdescription: 'Manage built-in my-pi extensions',\n\t\t\tgetArgumentCompletions: (prefix) => {\n\t\t\t\tconst parts = prefix.trim().split(/\\s+/);\n\t\t\t\tif (parts.length <= 1) {\n\t\t\t\t\treturn subs\n\t\t\t\t\t\t.filter((sub) => sub.startsWith(parts[0] || ''))\n\t\t\t\t\t\t.map((sub) => ({ value: sub, label: sub }));\n\t\t\t\t}\n\n\t\t\t\tif (['enable', 'disable', 'toggle'].includes(parts[0])) {\n\t\t\t\t\tconst q = parts.slice(1).join(' ').toLowerCase();\n\t\t\t\t\treturn resolve_builtin_extension_states(force_disabled)\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t(state) =>\n\t\t\t\t\t\t\t\tstate.key.toLowerCase().includes(q) ||\n\t\t\t\t\t\t\t\tstate.label.toLowerCase().includes(q),\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.slice(0, 20)\n\t\t\t\t\t\t.map((state) => ({\n\t\t\t\t\t\t\tvalue: `${parts[0]} ${state.key}`,\n\t\t\t\t\t\t\tlabel: `${state.key} ${state.saved_enabled ? ENABLED : DISABLED}`,\n\t\t\t\t\t\t}));\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\t\t\t},\n\t\t\thandler: async (args, ctx) => {\n\t\t\t\tconst trimmed = args.trim();\n\n\t\t\t\tif (!trimmed) {\n\t\t\t\t\tif (await show_manager(ctx)) return;\n\t\t\t\t}\n\n\t\t\t\tconst [sub, ...rest] = (trimmed || 'list').split(/\\s+/);\n\t\t\t\tconst arg = rest.join(' ');\n\t\t\t\tconst states =\n\t\t\t\t\tresolve_builtin_extension_states(force_disabled);\n\n\t\t\t\tswitch (sub) {\n\t\t\t\t\tcase 'list': {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\tformat_extension_lines(states, {\n\t\t\t\t\t\t\t\theading: 'Built-in extensions',\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'enable':\n\t\t\t\t\tcase 'disable':\n\t\t\t\t\tcase 'toggle': {\n\t\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\t\tif (await show_manager(ctx)) return;\n\t\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t\t`Usage: /extensions ${sub} <key>`,\n\t\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst extension = find_builtin_extension(arg);\n\t\t\t\t\t\tif (!extension) {\n\t\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t\t`Unknown extension: ${arg}. Use: ${BUILTIN_EXTENSIONS.map((item) => item.key).join(', ')}`,\n\t\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst current_state = states.find(\n\t\t\t\t\t\t\t(state) => state.key === extension.key,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst next_enabled =\n\t\t\t\t\t\t\tsub === 'enable'\n\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t: sub === 'disable'\n\t\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t\t: !current_state?.saved_enabled;\n\t\t\t\t\t\tsave_extension_enabled(extension.key, next_enabled);\n\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\tnext_enabled && force_disabled.has(extension.key)\n\t\t\t\t\t\t\t\t? `Enabled ${extension.key} in saved config. Still disabled in this process by ${extension.cli_flag}. /reload or restart without that flag to apply.`\n\t\t\t\t\t\t\t\t: `${extension.key} ${next_enabled ? 'enabled' : 'disabled'}. /reload to apply.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'search': {\n\t\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t\t'Usage: /extensions search <query>',\n\t\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst results = search_states(states, arg);\n\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t\t`No built-in extensions matching \"${arg}\"`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\tformat_extension_lines(results, {\n\t\t\t\t\t\t\t\theading: `Built-in extensions matching \"${arg}\"`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t`Unknown: ${sub}. Use: ${subs.join(', ')}`,\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t};\n}\n\nexport default create_extensions_extension();\n","// Composable programmatic API for my-pi\n\nimport {\n\tclampThinkingLevel,\n\ttype Api,\n\ttype Model,\n} from '@earendil-works/pi-ai';\nimport {\n\tInteractiveMode,\n\tSessionManager,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tgetAgentDir,\n\trunPrintMode,\n\trunRpcMode,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype ExtensionFactory,\n\ttype LoadExtensionsResult,\n} from '@earendil-works/pi-coding-agent';\nimport { apply_project_trust_untrusted_defaults } from '@spences10/pi-project-trust';\nimport { createRequire } from 'node:module';\nimport { dirname, resolve } from 'node:path';\nimport {\n\tBUILTIN_EXTENSION_REGISTRY,\n\ttype BuiltinExtensionKey,\n\ttype BuiltinExtensionOptionName,\n} from './extensions/builtin-registry.js';\nimport {\n\tis_builtin_extension_active,\n\tload_builtin_extensions_config,\n} from './extensions/manager/config.js';\nimport { create_extensions_extension } from './extensions/manager/index.js';\n\nexport type MyPiRuntimeMode =\n\t| 'interactive'\n\t| 'print'\n\t| 'json'\n\t| 'rpc';\n\nexport type MyPiThinkingLevel = NonNullable<\n\tCreateAgentSessionFromServicesOptions['thinkingLevel']\n>;\n\ntype BuiltinExtensionOptions = Partial<\n\tRecord<BuiltinExtensionOptionName, boolean>\n>;\n\nexport interface CreateMyPiOptions extends BuiltinExtensionOptions {\n\tcwd?: string;\n\tagent_dir?: string;\n\textensions?: string[];\n\textensionFactories?: ExtensionFactory[];\n\truntime_mode?: MyPiRuntimeMode;\n\ttelemetry?: boolean;\n\ttelemetry_db_path?: string;\n\tmodel?: string;\n\tthinking?: MyPiThinkingLevel;\n\tselected_tools?: string[];\n\tselected_skills?: string[];\n\tsession_dir?: string;\n\tsystem_prompt?: string;\n\tappend_system_prompt?: string;\n\tuntrusted_repo?: boolean;\n}\n\ntype BuiltinExtensionLoader = () => Promise<ExtensionFactory>;\n\nconst require = createRequire(import.meta.url);\nconst PACKAGE_THEME_DIR = resolve(\n\tdirname(require.resolve('@spences10/pi-themes/package.json')),\n\t'themes',\n);\nconst PI_AGENT_DIR_ENV = 'PI_CODING_AGENT_DIR';\nconst MY_PI_RUNTIME_MODE_ENV = 'MY_PI_RUNTIME_MODE';\n\ntype EnvSnapshot = Map<string, string | undefined>;\n\nfunction snapshot_env(\n\tenv: NodeJS.ProcessEnv,\n\tkeys: Iterable<string>,\n): EnvSnapshot {\n\treturn new Map(Array.from(keys, (key) => [key, env[key]]));\n}\n\nfunction restore_env(\n\tenv: NodeJS.ProcessEnv,\n\tsnapshot: EnvSnapshot,\n): void {\n\tfor (const [key, value] of snapshot) {\n\t\tif (value === undefined) delete env[key];\n\t\telse env[key] = value;\n\t}\n}\n\nfunction wrap_runtime_env_restore<\n\tT extends { dispose(): Promise<void> },\n>(runtime: T, restore: () => void): T {\n\tconst dispose = runtime.dispose.bind(runtime);\n\tlet restored = false;\n\tconst restore_once = () => {\n\t\tif (restored) return;\n\t\trestored = true;\n\t\trestore();\n\t};\n\n\truntime.dispose = (async () => {\n\t\ttry {\n\t\t\tawait dispose();\n\t\t} finally {\n\t\t\trestore_once();\n\t\t}\n\t}) as T['dispose'];\n\n\treturn runtime;\n}\n\nconst UNTRUSTED_CHILD_ENV_DEFAULTS: Record<string, string> = {\n\tMY_PI_CHILD_ENV_ALLOWLIST: '',\n\tMY_PI_MCP_ENV_ALLOWLIST: '',\n\tMY_PI_LSP_ENV_ALLOWLIST: '',\n\tMY_PI_HOOKS_ENV_ALLOWLIST: '',\n\tMY_PI_TEAM_MODE_ENV_ALLOWLIST: '',\n};\n\nexport function apply_untrusted_repo_defaults(\n\tenv: NodeJS.ProcessEnv = process.env,\n): string[] {\n\tconst applied = apply_project_trust_untrusted_defaults(env);\n\tfor (const [key, value] of Object.entries(\n\t\tUNTRUSTED_CHILD_ENV_DEFAULTS,\n\t)) {\n\t\tif (env[key] !== undefined) continue;\n\t\tenv[key] = value;\n\t\tapplied.push(key);\n\t}\n\treturn applied;\n}\n\nfunction is_resource_enabled(value: string | undefined): boolean {\n\tconst normalized = value?.trim().toLowerCase();\n\tif (!normalized) return true;\n\tif (['0', 'false', 'no', 'skip', 'disable'].includes(normalized)) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction resolve_agent_dir(cwd: string, agent_dir?: string): string {\n\treturn agent_dir ? resolve(cwd, agent_dir) : getAgentDir();\n}\n\ninterface ModelRegistryLike {\n\tgetAll(): Model<Api>[];\n}\n\nexport function resolve_model_reference(\n\tmodel_reference: string | undefined,\n\tmodel_registry: ModelRegistryLike,\n): Model<Api> | undefined {\n\tif (!model_reference) return undefined;\n\tconst models = model_registry.getAll();\n\tconst lower_reference = model_reference.toLowerCase();\n\tconst slash_index = model_reference.indexOf('/');\n\n\tif (slash_index !== -1) {\n\t\tconst maybe_provider = model_reference.slice(0, slash_index);\n\t\tconst model_id = model_reference.slice(slash_index + 1);\n\t\tconst provider = models.find(\n\t\t\t(model) =>\n\t\t\t\tmodel.provider.toLowerCase() === maybe_provider.toLowerCase(),\n\t\t)?.provider;\n\n\t\tif (provider) {\n\t\t\tconst provider_match = models.find(\n\t\t\t\t(model) =>\n\t\t\t\t\tmodel.provider === provider &&\n\t\t\t\t\tmodel.id.toLowerCase() === model_id.toLowerCase(),\n\t\t\t);\n\t\t\tif (provider_match) return provider_match;\n\t\t}\n\t}\n\n\treturn models.find((model) => {\n\t\tconst id = model.id.toLowerCase();\n\t\tconst full_id = `${model.provider}/${model.id}`.toLowerCase();\n\t\treturn id === lower_reference || full_id === lower_reference;\n\t});\n}\n\nexport function resolve_effective_thinking_level(\n\tmodel: Model<Api> | undefined,\n\tthinking: MyPiThinkingLevel | undefined,\n): MyPiThinkingLevel | undefined {\n\tif (!thinking || !model) return thinking;\n\treturn clampThinkingLevel(model, thinking);\n}\n\nexport function get_force_disabled_builtins(\n\toptions: Pick<CreateMyPiOptions, 'runtime_mode'> &\n\t\tBuiltinExtensionOptions,\n): ReadonlySet<BuiltinExtensionKey> {\n\tconst force_disabled = new Set<BuiltinExtensionKey>();\n\tfor (const extension of BUILTIN_EXTENSION_REGISTRY) {\n\t\tconst enabled =\n\t\t\toptions[extension.option_name] ?? extension.default_enabled;\n\t\tif (!enabled) force_disabled.add(extension.key);\n\t\tconst disabled_in =\n\t\t\t'mode_constraints' in extension\n\t\t\t\t? extension.mode_constraints.disabled_in\n\t\t\t\t: undefined;\n\t\tif (\n\t\t\toptions.runtime_mode &&\n\t\t\t(\n\t\t\t\tdisabled_in as readonly MyPiRuntimeMode[] | undefined\n\t\t\t)?.includes(options.runtime_mode)\n\t\t) {\n\t\t\tforce_disabled.add(extension.key);\n\t\t}\n\t}\n\treturn force_disabled;\n}\n\nfunction warn_builtin_extension_unavailable(\n\tkey: BuiltinExtensionKey | 'telemetry',\n\terror: unknown,\n): void {\n\tconst reason =\n\t\terror instanceof Error ? error.message : String(error);\n\tprocess.emitWarning(\n\t\t`Built-in extension \"${key}\" is unavailable and was skipped: ${reason}`,\n\t\t{ code: 'MY_PI_BUILTIN_EXTENSION_UNAVAILABLE' },\n\t);\n}\n\nexport function create_lazy_builtin_extension_factory(\n\tkey: BuiltinExtensionKey,\n\tload_extension: BuiltinExtensionLoader,\n\tforce_disabled: ReadonlySet<BuiltinExtensionKey>,\n): ExtensionFactory {\n\treturn async (pi) => {\n\t\tconst config = load_builtin_extensions_config();\n\t\tif (!is_builtin_extension_active(config, key, force_disabled)) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst extension = await load_extension();\n\t\t\tawait extension(pi);\n\t\t} catch (error) {\n\t\t\twarn_builtin_extension_unavailable(key, error);\n\t\t}\n\t};\n}\n\nfunction create_lazy_telemetry_extension(options: {\n\tenabled?: boolean;\n\tdb_path?: string;\n\tcwd?: string;\n}): ExtensionFactory {\n\treturn async (pi) => {\n\t\ttry {\n\t\t\tconst { create_telemetry_extension } =\n\t\t\t\tawait import('@spences10/pi-telemetry');\n\t\t\tawait create_telemetry_extension(options)(pi);\n\t\t} catch (error) {\n\t\t\twarn_builtin_extension_unavailable('telemetry', error);\n\t\t}\n\t};\n}\n\nfunction create_extensions_override(\n\tmanaged_inline_paths: string[],\n): (base: LoadExtensionsResult) => LoadExtensionsResult {\n\tconst managed_paths = new Set(managed_inline_paths);\n\treturn (base) => {\n\t\tconst managed = new Map(\n\t\t\tbase.extensions.map((extension) => [extension.path, extension]),\n\t\t);\n\t\tconst ordered_managed = managed_inline_paths\n\t\t\t.map((path) => managed.get(path))\n\t\t\t.filter(\n\t\t\t\t(\n\t\t\t\t\textension,\n\t\t\t\t): extension is LoadExtensionsResult['extensions'][number] =>\n\t\t\t\t\tBoolean(extension),\n\t\t\t);\n\t\tconst others = base.extensions.filter(\n\t\t\t(extension) => !managed_paths.has(extension.path),\n\t\t);\n\t\treturn {\n\t\t\t...base,\n\t\t\textensions: [...ordered_managed, ...others],\n\t\t};\n\t};\n}\n\nexport async function create_my_pi(options: CreateMyPiOptions = {}) {\n\tconst {\n\t\tcwd = process.cwd(),\n\t\tagent_dir,\n\t\textensions = [],\n\t\textensionFactories: user_factories = [],\n\t\truntime_mode = 'interactive',\n\t\ttelemetry,\n\t\ttelemetry_db_path,\n\t\tmodel,\n\t\tthinking,\n\t\tselected_tools,\n\t\tselected_skills,\n\t\tsession_dir,\n\t\tsystem_prompt,\n\t\tappend_system_prompt,\n\t\tuntrusted_repo = false,\n\t} = options;\n\n\tconst env_keys_to_restore = new Set<string>([\n\t\tMY_PI_RUNTIME_MODE_ENV,\n\t]);\n\tif (agent_dir) env_keys_to_restore.add(PI_AGENT_DIR_ENV);\n\tconst env_snapshot = snapshot_env(process.env, env_keys_to_restore);\n\tlet restore_runtime_env = () =>\n\t\trestore_env(process.env, env_snapshot);\n\n\tif (untrusted_repo) {\n\t\tconst applied = apply_untrusted_repo_defaults();\n\t\tif (applied.length) {\n\t\t\tconst restore_previous = restore_runtime_env;\n\t\t\trestore_runtime_env = () => {\n\t\t\t\tfor (const key of applied) delete process.env[key];\n\t\t\t\trestore_previous();\n\t\t\t};\n\t\t}\n\t}\n\n\tconst effective_agent_dir = resolve_agent_dir(cwd, agent_dir);\n\tif (agent_dir) {\n\t\tprocess.env[PI_AGENT_DIR_ENV] = effective_agent_dir;\n\t}\n\tprocess.env[MY_PI_RUNTIME_MODE_ENV] = runtime_mode;\n\n\tconst resolved_extensions = extensions.map((p) => resolve(cwd, p));\n\tconst force_disabled = get_force_disabled_builtins({\n\t\t...options,\n\t\truntime_mode,\n\t});\n\tconst builtins_config = load_builtin_extensions_config();\n\tconst skills_builtin_enabled = is_builtin_extension_active(\n\t\tbuiltins_config,\n\t\t'skills',\n\t\tforce_disabled,\n\t);\n\tconst skills_package = skills_builtin_enabled\n\t\t? await import('@spences10/pi-skills').catch((error) => {\n\t\t\t\twarn_builtin_extension_unavailable('skills', error);\n\t\t\t\treturn undefined;\n\t\t\t})\n\t\t: undefined;\n\n\tconst managed_extension_factories: ExtensionFactory[] = [\n\t\tcreate_lazy_telemetry_extension({\n\t\t\tenabled: telemetry,\n\t\t\tdb_path: telemetry_db_path,\n\t\t\tcwd,\n\t\t}),\n\t\tcreate_extensions_extension({ force_disabled }),\n\t\t...BUILTIN_EXTENSION_REGISTRY.map((extension) =>\n\t\t\tcreate_lazy_builtin_extension_factory(\n\t\t\t\textension.key,\n\t\t\t\textension.load,\n\t\t\t\tforce_disabled,\n\t\t\t),\n\t\t),\n\t];\n\tconst managed_inline_paths = managed_extension_factories.map(\n\t\t(_, index) => `<inline:${index + 1}>`,\n\t);\n\n\tconst create_runtime = async ({\n\t\tcwd: runtime_cwd,\n\t\tsessionManager,\n\t\tsessionStartEvent,\n\t}: {\n\t\tcwd: string;\n\t\tsessionManager: SessionManager;\n\t\tsessionStartEvent?: unknown;\n\t}) => {\n\t\t// Keep skill filtering reloadable so profile changes made by\n\t\t// /skills are reflected without restarting the process.\n\t\tconst runtime_skills_manager =\n\t\t\tskills_package?.create_skills_manager({\n\t\t\t\tcwd: runtime_cwd,\n\t\t\t\tproject_skills_enabled: is_resource_enabled(\n\t\t\t\t\tprocess.env.MY_PI_PROJECT_SKILLS,\n\t\t\t\t),\n\t\t\t});\n\t\tconst additional_skill_paths =\n\t\t\truntime_skills_manager?.get_enabled_skill_paths() ?? [];\n\n\t\tconst services = await createAgentSessionServices({\n\t\t\tcwd: runtime_cwd,\n\t\t\tagentDir: effective_agent_dir,\n\t\t\tresourceLoaderOptions: {\n\t\t\t\t...(additional_skill_paths.length\n\t\t\t\t\t? { additionalSkillPaths: additional_skill_paths }\n\t\t\t\t\t: {}),\n\t\t\t\t...(system_prompt !== undefined\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tsystemPromptOverride: () => system_prompt,\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t\t...(append_system_prompt !== undefined\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tappendSystemPromptOverride: (base: string[]) => [\n\t\t\t\t\t\t\t\t...base,\n\t\t\t\t\t\t\t\tappend_system_prompt,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t\tadditionalExtensionPaths: [...resolved_extensions],\n\t\t\t\t...(runtime_mode === 'interactive'\n\t\t\t\t\t? { additionalThemePaths: [PACKAGE_THEME_DIR] }\n\t\t\t\t\t: {}),\n\t\t\t\textensionFactories: [\n\t\t\t\t\t...managed_extension_factories,\n\t\t\t\t\t...user_factories,\n\t\t\t\t],\n\t\t\t\textensionsOverride: create_extensions_override(\n\t\t\t\t\tmanaged_inline_paths,\n\t\t\t\t),\n\t\t\t\tskillsOverride: (base: any) => {\n\t\t\t\t\tif (!runtime_skills_manager) return base;\n\t\t\t\t\truntime_skills_manager.refresh();\n\n\t\t\t\t\tconst selected_skill_names = selected_skills?.length\n\t\t\t\t\t\t? new Set(selected_skills)\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...base,\n\t\t\t\t\t\tskills: base.skills.filter((skill: any) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tselected_skill_names &&\n\t\t\t\t\t\t\t\t!selected_skill_names.has(skill.name)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn runtime_skills_manager.is_enabled_by_skill(\n\t\t\t\t\t\t\t\tskill.name,\n\t\t\t\t\t\t\t\tskill.filePath,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t} as any,\n\t\t});\n\n\t\tconst requested_model = resolve_model_reference(\n\t\t\tmodel,\n\t\t\tservices.modelRegistry,\n\t\t);\n\t\tconst effective_thinking = resolve_effective_thinking_level(\n\t\t\trequested_model,\n\t\t\tthinking,\n\t\t);\n\t\tif (\n\t\t\trequested_model &&\n\t\t\tthinking &&\n\t\t\teffective_thinking &&\n\t\t\teffective_thinking !== thinking\n\t\t) {\n\t\t\tservices.diagnostics.push({\n\t\t\t\ttype: 'warning',\n\t\t\t\tmessage: `Requested thinking level \"${thinking}\" is not supported by ${requested_model.provider}/${requested_model.id}; using \"${effective_thinking}\".`,\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\t...(await createAgentSessionFromServices({\n\t\t\t\tservices,\n\t\t\t\tsessionManager,\n\t\t\t\tsessionStartEvent: sessionStartEvent as any,\n\t\t\t\t...(requested_model ? { model: requested_model } : {}),\n\t\t\t\t...(effective_thinking\n\t\t\t\t\t? { thinkingLevel: effective_thinking }\n\t\t\t\t\t: {}),\n\t\t\t\t...(selected_tools?.length ? { tools: selected_tools } : {}),\n\t\t\t})),\n\t\t\tservices,\n\t\t\tdiagnostics: services.diagnostics,\n\t\t};\n\t};\n\n\ttry {\n\t\treturn wrap_runtime_env_restore(\n\t\t\tawait createAgentSessionRuntime(create_runtime, {\n\t\t\t\tcwd,\n\t\t\t\tagentDir: effective_agent_dir,\n\t\t\t\tsessionManager: SessionManager.create(\n\t\t\t\t\tcwd,\n\t\t\t\t\tsession_dir ? resolve(cwd, session_dir) : undefined,\n\t\t\t\t),\n\t\t\t}),\n\t\t\trestore_runtime_env,\n\t\t);\n\t} catch (error) {\n\t\trestore_runtime_env();\n\t\tthrow error;\n\t}\n}\n\nexport { InteractiveMode, runPrintMode, runRpcMode };\n\nexport type {\n\tAgentSessionRuntime,\n\tExtensionFactory,\n\tInteractiveModeOptions,\n\tPrintModeOptions,\n} from '@earendil-works/pi-coding-agent';\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,mBAAiC;CAC7C,SAAS;CACT,YAAY,EACX,SAAS,CAAC,EACX;AACD;AAEA,SAAgB,mBAAmB,OAA8B;CAChE,MAAM,MAAM;CACZ,MAAM,UAAiD,CAAC;CACxD,MAAM,cAAc,KAAK,YAAY;CACrC,IAAI,eAAe,OAAO,gBAAgB;OACpC,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,WAAW,GACpD,IAAI,OAAO,UAAU,WACpB,QAAQ,OAA8B;CAAA;CAKzC,OAAO;EACN,GAAI,OAAO,OAAO,QAAQ,WAAW,MAAM,CAAC;EAC5C,SAAS;EACT,YAAY,EAAE,QAAQ;CACvB;AACD;;;ACxBA,SAAgB,0BAAmC;CAClD,OAAO,WAAW,kBAAkB,CAAC;AACtC;AAEA,SAAgB,wBAAsC;CACrD,IAAI,CAAC,wBAAwB,GAAG,OAAO,EAAE,GAAG,iBAAiB;CAC7D,OAAO,mBAAmB,cAAc,CAAC;AAC1C;AAEA,SAAgB,uBAAuB,UAA8B;CACpE,eAAe,QAAQ;AACxB;AAEA,SAAgB,0BAAwC;CACvD,IAAI,CAAC,wBAAwB,GAC5B,uBAAuB,gBAAgB;CACxC,OAAO,sBAAsB;AAC9B;;;ACCA,SAAgB,4CAAoD;CAGnE,OAAO,KADN,QAAQ,IAAI,mBAAmB,KAAK,QAAQ,GAAG,SAAS,GACxC,SAAS,iBAAiB;AAC5C;AAEA,SAAS,eAAkB,MAA6B;CACvD,IAAI,CAAC,WAAW,IAAI,GAAG,O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AAe,IACvB,KAAA;KACH,OAAO;MACN,GAAG;MACH,QAAQ,KAAK,OAAO,QAAQ,UAAe;OAC1C,IACC,wBACA,CAAC,qBAAqB,IAAI,MAAM,IAAI,GAEpC,OAAO;OAER,OAAO,uBAAuB,oBAC7B,MAAM,MACN,MAAM,QACP;MACD,CAAC;KACF;IACD;GACD;EACD,CAAC;EAED,MAAM,kBAAkB,wBACvB,OACA,SAAS,aACV;EACA,MAAM,qBAAqB,iCAC1B,iBACA,QACD;EACA,IACC,mBACA,YACA,sBACA,uBAAuB,UAEvB,SAAS,YAAY,KAAK;GACzB,MAAM;GACN,SAAS,6BAA6B,SAAS,wBAAwB,gBAAgB,SAAS,GAAG,gBAAgB,GAAG,WAAW,mBAAmB;EACrJ,CAAC;EAGF,OAAO;GACN,GAAI,MAAM,+BAA+B;IACxC;IACA;IACmB;IACnB,GAAI,kBAAkB,EAAE,OAAO,gBAAgB,IAAI,CAAC;IACpD,GAAI,qBACD,EAAE,eAAe,mBAAmB,IACpC,CAAC;IACJ,GAAI,gBAAgB,SAAS,EAAE,OAAO,eAAe,IAAI,CAAC;GAC3D,CAAC;GACD;GACA,aAAa,SAAS;EACvB;CACD;CAEA,IAAI;EACH,OAAO,yBACN,MAAM,0BAA0B,gBAAgB;GAC/C;GACA,UAAU;GACV,gBAAgB,eAAe,OAC9B,KACA,cAAc,QAAQ,KAAK,WAAW,IAAI,KAAA,CAC3C;EACD,CAAC,GACD,mBACD;CACD,SAAS,OAAO;EACf,oBAAoB;EACpB,MAAM;CACP;AACD"}
|
|
@@ -53,7 +53,7 @@ const BUILTIN_EXTENSION_REGISTRY = [
|
|
|
53
53
|
],
|
|
54
54
|
reason: "Footer only renders in the interactive TUI"
|
|
55
55
|
},
|
|
56
|
-
load: async () => (await import("./footer-
|
|
56
|
+
load: async () => (await import("./footer-Dt5eBLRN.js")).default
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
key: "skills",
|
|
@@ -194,7 +194,7 @@ const BUILTIN_EXTENSION_REGISTRY = [
|
|
|
194
194
|
],
|
|
195
195
|
reason: "Startup screen only renders in the interactive TUI"
|
|
196
196
|
},
|
|
197
|
-
load: async () => (await import("./startup-screen-
|
|
197
|
+
load: async () => (await import("./startup-screen-DUeBWuAc.js")).default
|
|
198
198
|
},
|
|
199
199
|
{
|
|
200
200
|
key: "prompt-presets",
|
|
@@ -211,7 +211,7 @@ const BUILTIN_EXTENSION_REGISTRY = [
|
|
|
211
211
|
"preset",
|
|
212
212
|
"presets"
|
|
213
213
|
],
|
|
214
|
-
load: async () => (await import("./prompt-presets-
|
|
214
|
+
load: async () => (await import("./prompt-presets-BlCoIFYT.js")).default
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
key: "git-ui",
|
|
@@ -275,7 +275,7 @@ const BUILTIN_EXTENSION_REGISTRY = [
|
|
|
275
275
|
],
|
|
276
276
|
reason: "UI-only session naming is only useful in interactive mode"
|
|
277
277
|
},
|
|
278
|
-
load: async () => (await import("./session-name-
|
|
278
|
+
load: async () => (await import("./session-name-IR78cGVP.js")).default
|
|
279
279
|
},
|
|
280
280
|
{
|
|
281
281
|
key: "confirm-destructive",
|
|
@@ -301,7 +301,7 @@ const BUILTIN_EXTENSION_REGISTRY = [
|
|
|
301
301
|
cli_flag: "--no-hooks",
|
|
302
302
|
cli_description: "Disable Claude-style hook execution",
|
|
303
303
|
aliases: ["hooks-resolution", "hooks"],
|
|
304
|
-
load: async () => (await import("./hooks-resolution-
|
|
304
|
+
load: async () => (await import("./hooks-resolution-Ct3OPm5A.js")).default
|
|
305
305
|
},
|
|
306
306
|
{
|
|
307
307
|
key: "svelte-guardrails",
|
|
@@ -344,7 +344,7 @@ const BUILTIN_EXTENSION_REGISTRY = [
|
|
|
344
344
|
cli_flag: "--no-handoff",
|
|
345
345
|
cli_description: "Disable handoff helper command",
|
|
346
346
|
aliases: ["handoff", "continuation"],
|
|
347
|
-
load: async () => (await import("./handoff-
|
|
347
|
+
load: async () => (await import("./handoff-C6wR2mSG.js")).default
|
|
348
348
|
},
|
|
349
349
|
{
|
|
350
350
|
key: "team-mode",
|
|
@@ -368,4 +368,4 @@ const BUILTIN_EXTENSIONS = BUILTIN_EXTENSION_REGISTRY.map(({ load: _load, ...ext
|
|
|
368
368
|
//#endregion
|
|
369
369
|
export { BUILTIN_EXTENSION_REGISTRY as n, BUILTIN_EXTENSIONS as t };
|
|
370
370
|
|
|
371
|
-
//# sourceMappingURL=builtin-registry-
|
|
371
|
+
//# sourceMappingURL=builtin-registry-DBm8gws_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-registry-D1pRq6E-.js","names":[],"sources":["../src/extensions/builtin-registry.ts"],"sourcesContent":["import type { ExtensionFactory } from '@earendil-works/pi-coding-agent';\n\nexport type BuiltinExtensionRuntimeMode =\n\t| 'interactive'\n\t| 'print'\n\t| 'json'\n\t| 'rpc';\n\ntype BuiltinExtensionLoader = () => Promise<ExtensionFactory>;\n\nexport interface BuiltinExtensionManifestEntry {\n\tkey: string;\n\tlabel: string;\n\tdocs_label: string;\n\tdescription: string;\n\tdefault_enabled: boolean;\n\toption_name: string;\n\tcli_arg: string;\n\tcli_flag: `--${string}`;\n\tcli_description: string;\n\taliases: readonly string[];\n\tmode_constraints?: {\n\t\tdisabled_in: readonly BuiltinExtensionRuntimeMode[];\n\t\treason: string;\n\t};\n\tload: BuiltinExtensionLoader;\n}\n\nexport const BUILTIN_EXTENSION_REGISTRY = [\n\t{\n\t\tkey: 'context-sidecar',\n\t\tlabel: 'Context sidecar',\n\t\tdocs_label: 'SQLite context sidecar',\n\t\tdescription: 'Local SQLite FTS sidecar for oversized tool output',\n\t\tdefault_enabled: true,\n\t\toption_name: 'context_sidecar',\n\t\tcli_arg: 'no-context-sidecar',\n\t\tcli_flag: '--no-context-sidecar',\n\t\tcli_description:\n\t\t\t'Disable SQLite context sidecar for large tool output',\n\t\taliases: ['context-sidecar', 'context', 'sidecar'],\n\t\tload: async () => (await import('@spences10/pi-context')).default,\n\t},\n\t{\n\t\tkey: 'mcp',\n\t\tlabel: 'MCP',\n\t\tdocs_label: 'MCP',\n\t\tdescription: 'MCP server integration and /mcp command',\n\t\tdefault_enabled: true,\n\t\toption_name: 'mcp',\n\t\tcli_arg: 'no-mcp',\n\t\tcli_flag: '--no-mcp',\n\t\tcli_description: 'Disable built-in MCP extension',\n\t\taliases: ['mcp'],\n\t\tload: async () => (await import('@spences10/pi-mcp')).default,\n\t},\n\t{\n\t\tkey: 'footer',\n\t\tlabel: 'Footer',\n\t\tdocs_label: 'Footer',\n\t\tdescription: 'Configurable interactive footer/statusline',\n\t\tdefault_enabled: true,\n\t\toption_name: 'footer',\n\t\tcli_arg: 'no-footer',\n\t\tcli_flag: '--no-footer',\n\t\tcli_description: 'Disable custom footer/statusline',\n\t\taliases: ['footer', 'statusline', 'status-line'],\n\t\tmode_constraints: {\n\t\t\tdisabled_in: ['print', 'json', 'rpc'],\n\t\t\treason: 'Footer only renders in the interactive TUI',\n\t\t},\n\t\tload: async () => (await import('./footer/index.js')).default,\n\t},\n\t{\n\t\tkey: 'skills',\n\t\tlabel: 'Skills',\n\t\tdocs_label: 'Skills',\n\t\tdescription: 'Managed pi-native skills and /skills command',\n\t\tdefault_enabled: true,\n\t\toption_name: 'skills',\n\t\tcli_arg: 'no-skills',\n\t\tcli_flag: '--no-skills',\n\t\tcli_description: 'Disable built-in skills extension',\n\t\taliases: ['skills', 'skill'],\n\t\tload: async () => (await import('@spences10/pi-skills')).default,\n\t},\n\t{\n\t\tkey: 'skill-importer',\n\t\tlabel: 'Skill importer',\n\t\tdocs_label: 'Skill importer',\n\t\tdescription:\n\t\t\t'Import external Claude/plugin skills into Pi-native storage',\n\t\tdefault_enabled: true,\n\t\toption_name: 'skill_importer',\n\t\tcli_arg: 'no-skill-importer',\n\t\tcli_flag: '--no-skill-importer',\n\t\tcli_description: 'Disable external skill importer extension',\n\t\taliases: ['skill-importer', 'import-skills', 'skill-import'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-skill-importer')).default,\n\t},\n\t{\n\t\tkey: 'filter-output',\n\t\tlabel: 'Secret redaction',\n\t\tdocs_label: 'Secret redaction',\n\t\tdescription:\n\t\t\t'Redacts secrets from tool output before the model sees them',\n\t\tdefault_enabled: true,\n\t\toption_name: 'filter_output',\n\t\tcli_arg: 'no-filter',\n\t\tcli_flag: '--no-filter',\n\t\tcli_description: 'Disable secret redaction in tool output',\n\t\taliases: [\n\t\t\t'filter-output',\n\t\t\t'filter_output',\n\t\t\t'filter',\n\t\t\t'redaction',\n\t\t\t'secret-redaction',\n\t\t\t'output-redaction',\n\t\t],\n\t\tload: async () => (await import('@spences10/pi-redact')).default,\n\t},\n\t{\n\t\tkey: 'recall',\n\t\tlabel: 'Recall',\n\t\tdocs_label: 'Recall',\n\t\tdescription: 'pirecall reminder and background session sync',\n\t\tdefault_enabled: true,\n\t\toption_name: 'recall',\n\t\tcli_arg: 'no-recall',\n\t\tcli_flag: '--no-recall',\n\t\tcli_description: 'Disable recall extension',\n\t\taliases: ['recall', 'pirecall'],\n\t\tload: async () => (await import('@spences10/pi-recall')).default,\n\t},\n\t{\n\t\tkey: 'nopeek',\n\t\tlabel: 'Nopeek',\n\t\tdocs_label: 'Nopeek',\n\t\tdescription:\n\t\t\t'nopeek reminder for secret-safe environment loading',\n\t\tdefault_enabled: true,\n\t\toption_name: 'nopeek',\n\t\tcli_arg: 'no-nopeek',\n\t\tcli_flag: '--no-nopeek',\n\t\tcli_description: 'Disable nopeek reminder extension',\n\t\taliases: ['nopeek', 'secrets', 'secret-loading'],\n\t\tload: async () => (await import('@spences10/pi-nopeek')).default,\n\t},\n\t{\n\t\tkey: 'omnisearch',\n\t\tlabel: 'Omnisearch',\n\t\tdocs_label: 'Omnisearch',\n\t\tdescription: 'mcp-omnisearch reminder for verified web research',\n\t\tdefault_enabled: true,\n\t\toption_name: 'omnisearch',\n\t\tcli_arg: 'no-omnisearch',\n\t\tcli_flag: '--no-omnisearch',\n\t\tcli_description: 'Disable mcp-omnisearch reminder extension',\n\t\taliases: ['omnisearch', 'search', 'web-search', 'research'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-omnisearch')).default,\n\t},\n\t{\n\t\tkey: 'sqlite-tools',\n\t\tlabel: 'SQLite tools',\n\t\tdocs_label: 'SQLite tools',\n\t\tdescription:\n\t\t\t'mcp-sqlite-tools reminder for safer SQLite database work',\n\t\tdefault_enabled: true,\n\t\toption_name: 'sqlite_tools',\n\t\tcli_arg: 'no-sqlite-tools',\n\t\tcli_flag: '--no-sqlite-tools',\n\t\tcli_description: 'Disable mcp-sqlite-tools reminder extension',\n\t\taliases: ['sqlite-tools', 'sqlite', 'mcp-sqlite-tools'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-sqlite-tools')).default,\n\t},\n\t{\n\t\tkey: 'startup-screen',\n\t\tlabel: 'Startup screen',\n\t\tdocs_label: 'Startup screen',\n\t\tdescription:\n\t\t\t'Pixel-art gradient startup header for interactive sessions',\n\t\tdefault_enabled: true,\n\t\toption_name: 'startup_screen',\n\t\tcli_arg: 'no-startup-screen',\n\t\tcli_flag: '--no-startup-screen',\n\t\tcli_description: 'Disable the custom startup screen',\n\t\taliases: ['startup-screen', 'startup', 'header', 'splash'],\n\t\tmode_constraints: {\n\t\t\tdisabled_in: ['print', 'json', 'rpc'],\n\t\t\treason: 'Startup screen only renders in the interactive TUI',\n\t\t},\n\t\tload: async () =>\n\t\t\t(await import('./startup-screen/index.js')).default,\n\t},\n\t{\n\t\tkey: 'prompt-presets',\n\t\tlabel: 'Prompt presets',\n\t\tdocs_label: 'Prompt presets',\n\t\tdescription:\n\t\t\t'Runtime prompt preset selection and /prompt-preset command',\n\t\tdefault_enabled: true,\n\t\toption_name: 'prompt_presets',\n\t\tcli_arg: 'no-prompt-presets',\n\t\tcli_flag: '--no-prompt-presets',\n\t\tcli_description: 'Disable prompt presets extension',\n\t\taliases: ['prompt-preset', 'preset', 'presets'],\n\t\tload: async () =>\n\t\t\t(await import('./prompt-presets/index.js')).default,\n\t},\n\t{\n\t\tkey: 'git-ui',\n\t\tlabel: 'Git UI',\n\t\tdocs_label: 'Git staging UI',\n\t\tdescription: 'Interactive source control staging panel',\n\t\tdefault_enabled: true,\n\t\toption_name: 'git_ui',\n\t\tcli_arg: 'no-git-ui',\n\t\tcli_flag: '--no-git-ui',\n\t\tcli_description: 'Disable built-in Git staging UI',\n\t\taliases: ['git-ui', 'git', 'source-control', 'scm'],\n\t\tmode_constraints: {\n\t\t\tdisabled_in: ['print', 'json', 'rpc'],\n\t\t\treason: 'Git UI is only useful in interactive mode',\n\t\t},\n\t\tload: async () => (await import('@spences10/pi-git-ui')).default,\n\t},\n\t{\n\t\tkey: 'lsp',\n\t\tlabel: 'LSP',\n\t\tdocs_label: 'LSP',\n\t\tdescription:\n\t\t\t'Language Server Protocol tools (diagnostics, hover, definition, references)',\n\t\tdefault_enabled: true,\n\t\toption_name: 'lsp',\n\t\tcli_arg: 'no-lsp',\n\t\tcli_flag: '--no-lsp',\n\t\tcli_description: 'Disable LSP extension',\n\t\taliases: ['lsp', 'language-server'],\n\t\tload: async () => (await import('@spences10/pi-lsp')).default,\n\t},\n\t{\n\t\tkey: 'session-name',\n\t\tlabel: 'Session name',\n\t\tdocs_label: 'Session auto-naming',\n\t\tdescription:\n\t\t\t'AI-powered session auto-naming and /session-name command',\n\t\tdefault_enabled: true,\n\t\toption_name: 'session_name',\n\t\tcli_arg: 'no-session-name',\n\t\tcli_flag: '--no-session-name',\n\t\tcli_description: 'Disable session name extension',\n\t\taliases: ['session-name', 'session', 'auto-name'],\n\t\tmode_constraints: {\n\t\t\tdisabled_in: ['print', 'json', 'rpc'],\n\t\t\treason:\n\t\t\t\t'UI-only session naming is only useful in interactive mode',\n\t\t},\n\t\tload: async () =>\n\t\t\t(await import('./session-name/index.js')).default,\n\t},\n\t{\n\t\tkey: 'confirm-destructive',\n\t\tlabel: 'Confirm destructive',\n\t\tdocs_label: 'Destructive action confirmation',\n\t\tdescription:\n\t\t\t'Prompt before destructive tool calls like file deletes, overwrites, and hard resets',\n\t\tdefault_enabled: true,\n\t\toption_name: 'confirm_destructive',\n\t\tcli_arg: 'no-confirm-destructive',\n\t\tcli_flag: '--no-confirm-destructive',\n\t\tcli_description: 'Disable destructive action confirmations',\n\t\taliases: ['confirm-destructive', 'confirm'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-confirm-destructive')).default,\n\t},\n\t{\n\t\tkey: 'hooks-resolution',\n\t\tlabel: 'Hooks resolution',\n\t\tdocs_label: 'Hooks resolution',\n\t\tdescription:\n\t\t\t'Claude Code style PreToolUse and PostToolUse hook compatibility from .claude, .rulesync, and .pi configs',\n\t\tdefault_enabled: true,\n\t\toption_name: 'hooks_resolution',\n\t\tcli_arg: 'no-hooks',\n\t\tcli_flag: '--no-hooks',\n\t\tcli_description: 'Disable Claude-style hook execution',\n\t\taliases: ['hooks-resolution', 'hooks'],\n\t\tload: async () =>\n\t\t\t(await import('./hooks-resolution/index.js')).default,\n\t},\n\t{\n\t\tkey: 'svelte-guardrails',\n\t\tlabel: 'Svelte guardrails',\n\t\tdocs_label: 'Svelte guardrails',\n\t\tdescription:\n\t\t\t'Blocks discouraged Svelte patterns like $effect before agents write them',\n\t\tdefault_enabled: true,\n\t\toption_name: 'svelte_guardrails',\n\t\tcli_arg: 'no-svelte-guardrails',\n\t\tcli_flag: '--no-svelte-guardrails',\n\t\tcli_description: 'Disable Svelte guardrails',\n\t\taliases: ['svelte-guardrails', 'svelte'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-svelte-guardrails')).default,\n\t},\n\t{\n\t\tkey: 'coding-preferences',\n\t\tlabel: 'Coding preferences',\n\t\tdocs_label: 'Coding preferences',\n\t\tdescription:\n\t\t\t'Blocks configured coding workflow anti-patterns from JSON preferences',\n\t\tdefault_enabled: true,\n\t\toption_name: 'coding_preferences',\n\t\tcli_arg: 'no-coding-preferences',\n\t\tcli_flag: '--no-coding-preferences',\n\t\tcli_description: 'Disable coding preferences guardrails',\n\t\taliases: ['coding-preferences', 'preferences', 'prefs'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-coding-preferences')).default,\n\t},\n\t{\n\t\tkey: 'handoff',\n\t\tlabel: 'Handoff',\n\t\tdocs_label: 'Handoff',\n\t\tdescription:\n\t\t\t'Help command for Pi continuation primitives like /fork, /tree, /export, /import, and /share',\n\t\tdefault_enabled: true,\n\t\toption_name: 'handoff',\n\t\tcli_arg: 'no-handoff',\n\t\tcli_flag: '--no-handoff',\n\t\tcli_description: 'Disable handoff helper command',\n\t\taliases: ['handoff', 'continuation'],\n\t\tload: async () => (await import('./handoff/index.js')).default,\n\t},\n\t{\n\t\tkey: 'team-mode',\n\t\tlabel: 'Team mode',\n\t\tdocs_label: 'Team mode',\n\t\tdescription:\n\t\t\t'Experimental orchestrator/team mode with RPC teammates, tasks, and mailboxes',\n\t\tdefault_enabled: true,\n\t\toption_name: 'team_mode',\n\t\tcli_arg: 'no-team-mode',\n\t\tcli_flag: '--no-team-mode',\n\t\tcli_description: 'Disable experimental team mode extension',\n\t\taliases: ['team-mode', 'team', 'teammates'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-team-mode')).default,\n\t},\n] as const satisfies readonly BuiltinExtensionManifestEntry[];\n\nexport type BuiltinExtensionKey =\n\t(typeof BUILTIN_EXTENSION_REGISTRY)[number]['key'];\n\nexport type BuiltinExtensionOptionName =\n\t(typeof BUILTIN_EXTENSION_REGISTRY)[number]['option_name'];\n\nexport type BuiltinExtensionInfo = Omit<\n\tBuiltinExtensionManifestEntry,\n\t'load'\n> & {\n\tkey: BuiltinExtensionKey;\n\toption_name: BuiltinExtensionOptionName;\n};\n\nexport const BUILTIN_EXTENSIONS: BuiltinExtensionInfo[] =\n\tBUILTIN_EXTENSION_REGISTRY.map(\n\t\t({ load: _load, ...extension }) => extension,\n\t);\n"],"mappings":";AA4BA,MAAa,6BAA6B;CACzC;EACC,KAAK;EACL,OAAO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;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS;GAAC;GAAsB;GAAe;GAAQ;EACvD,MAAM,aACJ,MAAM,OAAO,qCAAqC;EACpD;CACD;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS,CAAC,WAAW,eAAe;EACpC,MAAM,aAAa,MAAM,OAAO,0BAAuB;EACvD;CACD;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS;GAAC;GAAa;GAAQ;GAAY;EAC3C,MAAM,aACJ,MAAM,OAAO,4BAA4B;EAC3C;CACD;AAgBD,MAAa,qBACZ,2BAA2B,KACzB,EAAE,MAAM,OAAO,GAAG,gBAAgB,UACnC"}
|
|
1
|
+
{"version":3,"file":"builtin-registry-DBm8gws_.js","names":[],"sources":["../src/extensions/builtin-registry.ts"],"sourcesContent":["import type { ExtensionFactory } from '@earendil-works/pi-coding-agent';\n\nexport type BuiltinExtensionRuntimeMode =\n\t| 'interactive'\n\t| 'print'\n\t| 'json'\n\t| 'rpc';\n\ntype BuiltinExtensionLoader = () => Promise<ExtensionFactory>;\n\nexport interface BuiltinExtensionManifestEntry {\n\tkey: string;\n\tlabel: string;\n\tdocs_label: string;\n\tdescription: string;\n\tdefault_enabled: boolean;\n\toption_name: string;\n\tcli_arg: string;\n\tcli_flag: `--${string}`;\n\tcli_description: string;\n\taliases: readonly string[];\n\tmode_constraints?: {\n\t\tdisabled_in: readonly BuiltinExtensionRuntimeMode[];\n\t\treason: string;\n\t};\n\tload: BuiltinExtensionLoader;\n}\n\nexport const BUILTIN_EXTENSION_REGISTRY = [\n\t{\n\t\tkey: 'context-sidecar',\n\t\tlabel: 'Context sidecar',\n\t\tdocs_label: 'SQLite context sidecar',\n\t\tdescription: 'Local SQLite FTS sidecar for oversized tool output',\n\t\tdefault_enabled: true,\n\t\toption_name: 'context_sidecar',\n\t\tcli_arg: 'no-context-sidecar',\n\t\tcli_flag: '--no-context-sidecar',\n\t\tcli_description:\n\t\t\t'Disable SQLite context sidecar for large tool output',\n\t\taliases: ['context-sidecar', 'context', 'sidecar'],\n\t\tload: async () => (await import('@spences10/pi-context')).default,\n\t},\n\t{\n\t\tkey: 'mcp',\n\t\tlabel: 'MCP',\n\t\tdocs_label: 'MCP',\n\t\tdescription: 'MCP server integration and /mcp command',\n\t\tdefault_enabled: true,\n\t\toption_name: 'mcp',\n\t\tcli_arg: 'no-mcp',\n\t\tcli_flag: '--no-mcp',\n\t\tcli_description: 'Disable built-in MCP extension',\n\t\taliases: ['mcp'],\n\t\tload: async () => (await import('@spences10/pi-mcp')).default,\n\t},\n\t{\n\t\tkey: 'footer',\n\t\tlabel: 'Footer',\n\t\tdocs_label: 'Footer',\n\t\tdescription: 'Configurable interactive footer/statusline',\n\t\tdefault_enabled: true,\n\t\toption_name: 'footer',\n\t\tcli_arg: 'no-footer',\n\t\tcli_flag: '--no-footer',\n\t\tcli_description: 'Disable custom footer/statusline',\n\t\taliases: ['footer', 'statusline', 'status-line'],\n\t\tmode_constraints: {\n\t\t\tdisabled_in: ['print', 'json', 'rpc'],\n\t\t\treason: 'Footer only renders in the interactive TUI',\n\t\t},\n\t\tload: async () => (await import('./footer/index.js')).default,\n\t},\n\t{\n\t\tkey: 'skills',\n\t\tlabel: 'Skills',\n\t\tdocs_label: 'Skills',\n\t\tdescription: 'Managed pi-native skills and /skills command',\n\t\tdefault_enabled: true,\n\t\toption_name: 'skills',\n\t\tcli_arg: 'no-skills',\n\t\tcli_flag: '--no-skills',\n\t\tcli_description: 'Disable built-in skills extension',\n\t\taliases: ['skills', 'skill'],\n\t\tload: async () => (await import('@spences10/pi-skills')).default,\n\t},\n\t{\n\t\tkey: 'skill-importer',\n\t\tlabel: 'Skill importer',\n\t\tdocs_label: 'Skill importer',\n\t\tdescription:\n\t\t\t'Import external Claude/plugin skills into Pi-native storage',\n\t\tdefault_enabled: true,\n\t\toption_name: 'skill_importer',\n\t\tcli_arg: 'no-skill-importer',\n\t\tcli_flag: '--no-skill-importer',\n\t\tcli_description: 'Disable external skill importer extension',\n\t\taliases: ['skill-importer', 'import-skills', 'skill-import'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-skill-importer')).default,\n\t},\n\t{\n\t\tkey: 'filter-output',\n\t\tlabel: 'Secret redaction',\n\t\tdocs_label: 'Secret redaction',\n\t\tdescription:\n\t\t\t'Redacts secrets from tool output before the model sees them',\n\t\tdefault_enabled: true,\n\t\toption_name: 'filter_output',\n\t\tcli_arg: 'no-filter',\n\t\tcli_flag: '--no-filter',\n\t\tcli_description: 'Disable secret redaction in tool output',\n\t\taliases: [\n\t\t\t'filter-output',\n\t\t\t'filter_output',\n\t\t\t'filter',\n\t\t\t'redaction',\n\t\t\t'secret-redaction',\n\t\t\t'output-redaction',\n\t\t],\n\t\tload: async () => (await import('@spences10/pi-redact')).default,\n\t},\n\t{\n\t\tkey: 'recall',\n\t\tlabel: 'Recall',\n\t\tdocs_label: 'Recall',\n\t\tdescription: 'pirecall reminder and background session sync',\n\t\tdefault_enabled: true,\n\t\toption_name: 'recall',\n\t\tcli_arg: 'no-recall',\n\t\tcli_flag: '--no-recall',\n\t\tcli_description: 'Disable recall extension',\n\t\taliases: ['recall', 'pirecall'],\n\t\tload: async () => (await import('@spences10/pi-recall')).default,\n\t},\n\t{\n\t\tkey: 'nopeek',\n\t\tlabel: 'Nopeek',\n\t\tdocs_label: 'Nopeek',\n\t\tdescription:\n\t\t\t'nopeek reminder for secret-safe environment loading',\n\t\tdefault_enabled: true,\n\t\toption_name: 'nopeek',\n\t\tcli_arg: 'no-nopeek',\n\t\tcli_flag: '--no-nopeek',\n\t\tcli_description: 'Disable nopeek reminder extension',\n\t\taliases: ['nopeek', 'secrets', 'secret-loading'],\n\t\tload: async () => (await import('@spences10/pi-nopeek')).default,\n\t},\n\t{\n\t\tkey: 'omnisearch',\n\t\tlabel: 'Omnisearch',\n\t\tdocs_label: 'Omnisearch',\n\t\tdescription: 'mcp-omnisearch reminder for verified web research',\n\t\tdefault_enabled: true,\n\t\toption_name: 'omnisearch',\n\t\tcli_arg: 'no-omnisearch',\n\t\tcli_flag: '--no-omnisearch',\n\t\tcli_description: 'Disable mcp-omnisearch reminder extension',\n\t\taliases: ['omnisearch', 'search', 'web-search', 'research'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-omnisearch')).default,\n\t},\n\t{\n\t\tkey: 'sqlite-tools',\n\t\tlabel: 'SQLite tools',\n\t\tdocs_label: 'SQLite tools',\n\t\tdescription:\n\t\t\t'mcp-sqlite-tools reminder for safer SQLite database work',\n\t\tdefault_enabled: true,\n\t\toption_name: 'sqlite_tools',\n\t\tcli_arg: 'no-sqlite-tools',\n\t\tcli_flag: '--no-sqlite-tools',\n\t\tcli_description: 'Disable mcp-sqlite-tools reminder extension',\n\t\taliases: ['sqlite-tools', 'sqlite', 'mcp-sqlite-tools'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-sqlite-tools')).default,\n\t},\n\t{\n\t\tkey: 'startup-screen',\n\t\tlabel: 'Startup screen',\n\t\tdocs_label: 'Startup screen',\n\t\tdescription:\n\t\t\t'Pixel-art gradient startup header for interactive sessions',\n\t\tdefault_enabled: true,\n\t\toption_name: 'startup_screen',\n\t\tcli_arg: 'no-startup-screen',\n\t\tcli_flag: '--no-startup-screen',\n\t\tcli_description: 'Disable the custom startup screen',\n\t\taliases: ['startup-screen', 'startup', 'header', 'splash'],\n\t\tmode_constraints: {\n\t\t\tdisabled_in: ['print', 'json', 'rpc'],\n\t\t\treason: 'Startup screen only renders in the interactive TUI',\n\t\t},\n\t\tload: async () =>\n\t\t\t(await import('./startup-screen/index.js')).default,\n\t},\n\t{\n\t\tkey: 'prompt-presets',\n\t\tlabel: 'Prompt presets',\n\t\tdocs_label: 'Prompt presets',\n\t\tdescription:\n\t\t\t'Runtime prompt preset selection and /prompt-preset command',\n\t\tdefault_enabled: true,\n\t\toption_name: 'prompt_presets',\n\t\tcli_arg: 'no-prompt-presets',\n\t\tcli_flag: '--no-prompt-presets',\n\t\tcli_description: 'Disable prompt presets extension',\n\t\taliases: ['prompt-preset', 'preset', 'presets'],\n\t\tload: async () =>\n\t\t\t(await import('./prompt-presets/index.js')).default,\n\t},\n\t{\n\t\tkey: 'git-ui',\n\t\tlabel: 'Git UI',\n\t\tdocs_label: 'Git staging UI',\n\t\tdescription: 'Interactive source control staging panel',\n\t\tdefault_enabled: true,\n\t\toption_name: 'git_ui',\n\t\tcli_arg: 'no-git-ui',\n\t\tcli_flag: '--no-git-ui',\n\t\tcli_description: 'Disable built-in Git staging UI',\n\t\taliases: ['git-ui', 'git', 'source-control', 'scm'],\n\t\tmode_constraints: {\n\t\t\tdisabled_in: ['print', 'json', 'rpc'],\n\t\t\treason: 'Git UI is only useful in interactive mode',\n\t\t},\n\t\tload: async () => (await import('@spences10/pi-git-ui')).default,\n\t},\n\t{\n\t\tkey: 'lsp',\n\t\tlabel: 'LSP',\n\t\tdocs_label: 'LSP',\n\t\tdescription:\n\t\t\t'Language Server Protocol tools (diagnostics, hover, definition, references)',\n\t\tdefault_enabled: true,\n\t\toption_name: 'lsp',\n\t\tcli_arg: 'no-lsp',\n\t\tcli_flag: '--no-lsp',\n\t\tcli_description: 'Disable LSP extension',\n\t\taliases: ['lsp', 'language-server'],\n\t\tload: async () => (await import('@spences10/pi-lsp')).default,\n\t},\n\t{\n\t\tkey: 'session-name',\n\t\tlabel: 'Session name',\n\t\tdocs_label: 'Session auto-naming',\n\t\tdescription:\n\t\t\t'AI-powered session auto-naming and /session-name command',\n\t\tdefault_enabled: true,\n\t\toption_name: 'session_name',\n\t\tcli_arg: 'no-session-name',\n\t\tcli_flag: '--no-session-name',\n\t\tcli_description: 'Disable session name extension',\n\t\taliases: ['session-name', 'session', 'auto-name'],\n\t\tmode_constraints: {\n\t\t\tdisabled_in: ['print', 'json', 'rpc'],\n\t\t\treason:\n\t\t\t\t'UI-only session naming is only useful in interactive mode',\n\t\t},\n\t\tload: async () =>\n\t\t\t(await import('./session-name/index.js')).default,\n\t},\n\t{\n\t\tkey: 'confirm-destructive',\n\t\tlabel: 'Confirm destructive',\n\t\tdocs_label: 'Destructive action confirmation',\n\t\tdescription:\n\t\t\t'Prompt before destructive tool calls like file deletes, overwrites, and hard resets',\n\t\tdefault_enabled: true,\n\t\toption_name: 'confirm_destructive',\n\t\tcli_arg: 'no-confirm-destructive',\n\t\tcli_flag: '--no-confirm-destructive',\n\t\tcli_description: 'Disable destructive action confirmations',\n\t\taliases: ['confirm-destructive', 'confirm'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-confirm-destructive')).default,\n\t},\n\t{\n\t\tkey: 'hooks-resolution',\n\t\tlabel: 'Hooks resolution',\n\t\tdocs_label: 'Hooks resolution',\n\t\tdescription:\n\t\t\t'Claude Code style PreToolUse and PostToolUse hook compatibility from .claude, .rulesync, and .pi configs',\n\t\tdefault_enabled: true,\n\t\toption_name: 'hooks_resolution',\n\t\tcli_arg: 'no-hooks',\n\t\tcli_flag: '--no-hooks',\n\t\tcli_description: 'Disable Claude-style hook execution',\n\t\taliases: ['hooks-resolution', 'hooks'],\n\t\tload: async () =>\n\t\t\t(await import('./hooks-resolution/index.js')).default,\n\t},\n\t{\n\t\tkey: 'svelte-guardrails',\n\t\tlabel: 'Svelte guardrails',\n\t\tdocs_label: 'Svelte guardrails',\n\t\tdescription:\n\t\t\t'Blocks discouraged Svelte patterns like $effect before agents write them',\n\t\tdefault_enabled: true,\n\t\toption_name: 'svelte_guardrails',\n\t\tcli_arg: 'no-svelte-guardrails',\n\t\tcli_flag: '--no-svelte-guardrails',\n\t\tcli_description: 'Disable Svelte guardrails',\n\t\taliases: ['svelte-guardrails', 'svelte'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-svelte-guardrails')).default,\n\t},\n\t{\n\t\tkey: 'coding-preferences',\n\t\tlabel: 'Coding preferences',\n\t\tdocs_label: 'Coding preferences',\n\t\tdescription:\n\t\t\t'Blocks configured coding workflow anti-patterns from JSON preferences',\n\t\tdefault_enabled: true,\n\t\toption_name: 'coding_preferences',\n\t\tcli_arg: 'no-coding-preferences',\n\t\tcli_flag: '--no-coding-preferences',\n\t\tcli_description: 'Disable coding preferences guardrails',\n\t\taliases: ['coding-preferences', 'preferences', 'prefs'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-coding-preferences')).default,\n\t},\n\t{\n\t\tkey: 'handoff',\n\t\tlabel: 'Handoff',\n\t\tdocs_label: 'Handoff',\n\t\tdescription:\n\t\t\t'Help command for Pi continuation primitives like /fork, /tree, /export, /import, and /share',\n\t\tdefault_enabled: true,\n\t\toption_name: 'handoff',\n\t\tcli_arg: 'no-handoff',\n\t\tcli_flag: '--no-handoff',\n\t\tcli_description: 'Disable handoff helper command',\n\t\taliases: ['handoff', 'continuation'],\n\t\tload: async () => (await import('./handoff/index.js')).default,\n\t},\n\t{\n\t\tkey: 'team-mode',\n\t\tlabel: 'Team mode',\n\t\tdocs_label: 'Team mode',\n\t\tdescription:\n\t\t\t'Experimental orchestrator/team mode with RPC teammates, tasks, and mailboxes',\n\t\tdefault_enabled: true,\n\t\toption_name: 'team_mode',\n\t\tcli_arg: 'no-team-mode',\n\t\tcli_flag: '--no-team-mode',\n\t\tcli_description: 'Disable experimental team mode extension',\n\t\taliases: ['team-mode', 'team', 'teammates'],\n\t\tload: async () =>\n\t\t\t(await import('@spences10/pi-team-mode')).default,\n\t},\n] as const satisfies readonly BuiltinExtensionManifestEntry[];\n\nexport type BuiltinExtensionKey =\n\t(typeof BUILTIN_EXTENSION_REGISTRY)[number]['key'];\n\nexport type BuiltinExtensionOptionName =\n\t(typeof BUILTIN_EXTENSION_REGISTRY)[number]['option_name'];\n\nexport type BuiltinExtensionInfo = Omit<\n\tBuiltinExtensionManifestEntry,\n\t'load'\n> & {\n\tkey: BuiltinExtensionKey;\n\toption_name: BuiltinExtensionOptionName;\n};\n\nexport const BUILTIN_EXTENSIONS: BuiltinExtensionInfo[] =\n\tBUILTIN_EXTENSION_REGISTRY.map(\n\t\t({ load: _load, ...extension }) => extension,\n\t);\n"],"mappings":";AA4BA,MAAa,6BAA6B;CACzC;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBACC;EACD,SAAS;GAAC;GAAmB;GAAW;EAAS;EACjD,MAAM,aAAa,MAAM,OAAO,0BAA0B;CAC3D;CACA;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS,CAAC,KAAK;EACf,MAAM,aAAa,MAAM,OAAO,sBAAsB;CACvD;CACA;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS;GAAC;GAAU;GAAc;EAAa;EAC/C,kBAAkB;GACjB,aAAa;IAAC;IAAS;IAAQ;GAAK;GACpC,QAAQ;EACT;EACA,MAAM,aAAa,MAAM,OAAO,yBAAsB;CACvD;CACA;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS,CAAC,UAAU,OAAO;EAC3B,MAAM,aAAa,MAAM,OAAO,yBAAyB;CAC1D;CACA;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS;GAAC;GAAkB;GAAiB;EAAc;EAC3D,MAAM,aACJ,MAAM,OAAO,iCA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AAoB,OAAO;EACrC,MAAM,aACJ,MAAM,OAAO,mCAAgC;CAChD;CACA;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS,CAAC,qBAAqB,QAAQ;EACvC,MAAM,aACJ,MAAM,OAAO,oCAAoC;CACpD;CACA;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS;GAAC;GAAsB;GAAe;EAAO;EACtD,MAAM,aACJ,MAAM,OAAO,qCAAqC;CACrD;CACA;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS,CAAC,WAAW,cAAc;EACnC,MAAM,aAAa,MAAM,OAAO,0BAAuB;CACxD;CACA;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS;GAAC;GAAa;GAAQ;EAAW;EAC1C,MAAM,aACJ,MAAM,OAAO,4BAA4B;CAC5C;AACD;AAgBA,MAAa,qBACZ,2BAA2B,KACzB,EAAE,MAAM,OAAO,GAAG,gBAAgB,SACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handoff-
|
|
1
|
+
{"version":3,"file":"handoff-C6wR2mSG.js","names":[],"sources":["../src/extensions/handoff/index.ts"],"sourcesContent":["// Handoff extension — zero-context help for Pi continuation primitives.\n\nimport type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\n\nexport const HANDOFF_GUIDE = `Handoff in Pi\n\nUse built-ins first:\n- /fork: exact-context branch for experiments or continuing in a fresh session\n- /tree: inspect/navigate conversation branches\n- /export and /import: move session data between Pi instances\n- /share: create a shareable session artifact\n\nUse a markdown handoff only when the recipient is outside Pi or needs a compact task/return brief.\nReturn brief: changed files, validation, risks, next action.`;\n\nexport function handoff_command_output(args: string): string {\n\tconst trimmed = args.trim();\n\tif (!trimmed) return HANDOFF_GUIDE;\n\treturn `${HANDOFF_GUIDE}\\n\\nIntent noted: ${trimmed}`;\n}\n\nexport default function handoff(pi: ExtensionAPI): void {\n\tpi.registerCommand('handoff', {\n\t\tdescription:\n\t\t\t'Show when to use /fork, /tree, /export, /import, /share, or a portable handoff',\n\t\thandler: async (args, ctx) => {\n\t\t\tctx.ui.notify(handoff_command_output(args), 'info');\n\t\t},\n\t});\n}\n"],"mappings":";AAIA,MAAa,gBAAgB;;;;;;;;;;AAW7B,SAAgB,uBAAuB,MAAsB;CAC5D,MAAM,UAAU,KAAK,KAAK;CAC1B,IAAI,CAAC,SAAS,OAAO;CACrB,OAAO,GAAG,cAAc,oBAAoB;AAC7C;AAEA,SAAwB,QAAQ,IAAwB;CACvD,GAAG,gBAAgB,WAAW;EAC7B,aACC;EACD,SAAS,OAAO,MAAM,QAAQ;GAC7B,IAAI,GAAG,OAAO,uBAAuB,IAAI,GAAG,MAAM;EACnD;CACD,CAAC;AACF"}
|