my-pi 0.1.62 → 0.1.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,14 +11,9 @@ Composable [pi](https://pi.dev) coding agent for humans and agents.
11
11
 
12
12
  Built on the
13
13
  [@earendil-works/pi-coding-agent](https://github.com/badlogic/pi-mono)
14
- SDK. Adds MCP server support, a managed extension registry, user
15
- extension stacking, LSP tools, prompt presets, local SQLite telemetry
16
- for evals, and a programmatic API.
17
-
18
- User extension stacking was originally inspired by
19
- [pi-vs-claude-code](https://github.com/disler/pi-vs-claude-code);
20
- my-pi now layers that pattern behind a registry-driven set of built-in
21
- extensions.
14
+ SDK. Adds MCP server support, a managed extension registry, composable
15
+ user extensions, LSP tools, prompt presets, local SQLite telemetry for
16
+ evals, and a programmatic API.
22
17
 
23
18
  ## What this is for
24
19
 
@@ -62,7 +57,7 @@ directly as its own CLI.
62
57
  - **Git UI** — interactive source-control staging in the TUI.
63
58
  - **Local telemetry** — optional SQLite telemetry for evals, tool
64
59
  analysis, and operational debugging.
65
- - **Built-in registry + user extension stacking** — ship defaults,
60
+ - **Built-in registry + composable user extensions** — ship defaults,
66
61
  manage built-ins with `/extensions`, and layer extra project or
67
62
  ad-hoc extensions on top.
68
63
 
@@ -394,18 +389,18 @@ Set the listed environment variables to `allow` or `trust` where
394
389
  supported to re-enable one feature intentionally while staying in safe
395
390
  mode.
396
391
 
397
- ### Extension stacking
392
+ ### Additional extensions
398
393
 
399
394
  ```bash
400
395
  pnpx my-pi@latest -e ./ext/damage-control.ts -e ./ext/tool-counter.ts
401
396
  pnpx my-pi@latest --no-builtin -e ./ext/custom.ts "do something"
402
397
  ```
403
398
 
404
- Stack arbitrary Pi extensions via repeated `-e` / `--extension` flags.
405
- This is the part originally inspired by `pi-vs-claude-code`'s simple
406
- `pi -e one.ts -e two.ts` recipes. Use `--no-builtin` to skip my-pi's
407
- managed built-in extensions and run only Pi defaults plus the
408
- extensions you pass explicitly.
399
+ Add project or ad-hoc Pi extensions with repeated `-e` / `--extension`
400
+ flags. They are composed with the managed built-ins in the same
401
+ runtime. Use `--no-builtin` to skip my-pi's managed built-in
402
+ extensions and run only Pi defaults plus the extensions you pass
403
+ explicitly.
409
404
 
410
405
  Built-in extension choices can also be saved interactively with
411
406
  `/extensions`. Startup flags like `--no-recall`, `--no-skills`, and
package/dist/api.d.ts CHANGED
@@ -15,6 +15,7 @@ import * as _$_spences10_pi_git_ui0 from "@spences10/pi-git-ui";
15
15
  import * as _$_spences10_pi_confirm_destructive0 from "@spences10/pi-confirm-destructive";
16
16
  import * as _$_spences10_pi_svelte_guardrails0 from "@spences10/pi-svelte-guardrails";
17
17
  import * as _$_spences10_pi_coding_preferences0 from "@spences10/pi-coding-preferences";
18
+ import * as _$_spences10_pi_handoff0 from "@spences10/pi-handoff";
18
19
  import * as _$_spences10_pi_team_mode0 from "@spences10/pi-team-mode";
19
20
 
20
21
  //#region src/extensions/startup-screen/index.d.ts
@@ -271,6 +272,18 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
271
272
  readonly cli_description: "Disable coding preferences guardrails";
272
273
  readonly aliases: readonly ["coding-preferences", "preferences", "prefs"];
273
274
  readonly load: () => Promise<typeof _$_spences10_pi_coding_preferences0.default>;
275
+ }, {
276
+ readonly key: "handoff";
277
+ readonly label: "Handoff";
278
+ readonly docs_label: "Handoff";
279
+ readonly description: "Prompt shim for portable handoffs to later sessions and teammates";
280
+ readonly default_enabled: true;
281
+ readonly option_name: "handoff";
282
+ readonly cli_arg: "no-handoff";
283
+ readonly cli_flag: "--no-handoff";
284
+ readonly cli_description: "Disable handoff prompt guidance";
285
+ readonly aliases: readonly ["handoff", "continuation"];
286
+ readonly load: () => Promise<typeof _$_spences10_pi_handoff0.default>;
274
287
  }, {
275
288
  readonly key: "team-mode";
276
289
  readonly label: "Team mode";
package/dist/api.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as BUILTIN_EXTENSION_REGISTRY, t as BUILTIN_EXTENSIONS } from "./builtin-registry-byJRe4EK.js";
1
+ import { n as BUILTIN_EXTENSION_REGISTRY, t as BUILTIN_EXTENSIONS } from "./builtin-registry-ii02fNMx.js";
2
2
  import { createRequire } from "node:module";
3
- import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
3
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
4
4
  import { basename, dirname, join, resolve } from "node:path";
5
5
  import { clampThinkingLevel } from "@earendil-works/pi-ai";
6
6
  import { InteractiveMode, SessionManager, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, getAgentDir, runPrintMode, runRpcMode } from "@earendil-works/pi-coding-agent";
@@ -21,6 +21,7 @@ function normalize_settings(value) {
21
21
  for (const [key, state] of Object.entries(raw_enabled)) if (typeof state === "boolean") enabled[key] = state;
22
22
  }
23
23
  return {
24
+ ...raw && typeof raw === "object" ? raw : {},
24
25
  version: 1,
25
26
  extensions: { enabled }
26
27
  };
@@ -87,6 +88,18 @@ function timestamp_for_filename(date = /* @__PURE__ */ new Date()) {
87
88
  function backup_path_for(original_path, backup_dir) {
88
89
  return join(backup_dir, `${basename(dirname(original_path))}-${basename(original_path)}`);
89
90
  }
91
+ function move_file_to_backup(source, target) {
92
+ try {
93
+ renameSync(source, target);
94
+ } catch (error) {
95
+ if (error instanceof Error && "code" in error && error.code === "EXDEV") {
96
+ copyFileSync(source, target);
97
+ unlinkSync(source);
98
+ return;
99
+ }
100
+ throw error;
101
+ }
102
+ }
90
103
  function migrate_legacy_settings() {
91
104
  const legacy = find_legacy_settings_files();
92
105
  const entries = Object.values(legacy).filter((entry) => entry !== void 0);
@@ -137,7 +150,7 @@ function migrate_legacy_settings() {
137
150
  for (const entry of entries) {
138
151
  if (!existsSync(entry.path)) continue;
139
152
  const target = backup_path_for(entry.path, backup_dir);
140
- renameSync(entry.path, target);
153
+ move_file_to_backup(entry.path, target);
141
154
  moved_files.push(entry.path);
142
155
  }
143
156
  writeFileSync(join(backup_dir, "migration-report.json"), JSON.stringify({
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}\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\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\texistsSync,\n\tmkdirSync,\n\trenameSync,\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\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\trenameSync(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// User extension stacking started from pi-vs-claude-code-style `-e` layering;\n// built-ins are now managed through my-pi's registry.\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":";;;;;;;;;;;AASA,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,SAAS;EACT,YAAY,EAAE,SAAS;EACvB;;;;ACjBF,SAAgB,0BAAmC;CAClD,OAAO,WAAW,mBAAmB,CAAC;;AAGvC,SAAgB,wBAAsC;CACrD,IAAI,CAAC,yBAAyB,EAAE,OAAO,EAAE,GAAG,kBAAkB;CAC9D,OAAO,mBAAmB,eAAe,CAAC;;AAG3C,SAAgB,uBAAuB,UAA8B;CACpE,eAAe,SAAS;;AAGzB,SAAgB,0BAAwC;CACvD,IAAI,CAAC,yBAAyB,EAC7B,uBAAuB,iBAAiB;CACzC,OAAO,uBAAuB;;;;ACE/B,SAAgB,4CAAoD;CAGnE,OAAO,KADN,QAAQ,IAAI,mBAAmB,KAAK,SAAS,EAAE,UAAU,EACzC,SAAS,kBAAkB;;AAG7C,SAAS,eAAkB,MAA6B;CACvD,IAAI,CAAC,WAAW,KAAK,EAAE,OAAO,KAAA;CAC9B,OAAO,KAAK,MAAM,aAAa,MAAM,QAAQ,CAAC;;AAG/C,SAAS,WACR,MAC0C;CAC1C,MAAM,SAAS,eAAkB,KAAK;CACtC,OAAO,WAAW,KAAA,IAAY,KAA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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,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,wB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AAI,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"}
@@ -333,6 +333,19 @@ const BUILTIN_EXTENSION_REGISTRY = [
333
333
  ],
334
334
  load: async () => (await import("@spences10/pi-coding-preferences")).default
335
335
  },
336
+ {
337
+ key: "handoff",
338
+ label: "Handoff",
339
+ docs_label: "Handoff",
340
+ description: "Prompt shim for portable handoffs to later sessions and teammates",
341
+ default_enabled: true,
342
+ option_name: "handoff",
343
+ cli_arg: "no-handoff",
344
+ cli_flag: "--no-handoff",
345
+ cli_description: "Disable handoff prompt guidance",
346
+ aliases: ["handoff", "continuation"],
347
+ load: async () => (await import("@spences10/pi-handoff")).default
348
+ },
336
349
  {
337
350
  key: "team-mode",
338
351
  label: "Team mode",
@@ -355,4 +368,4 @@ const BUILTIN_EXTENSIONS = BUILTIN_EXTENSION_REGISTRY.map(({ load: _load, ...ext
355
368
  //#endregion
356
369
  export { BUILTIN_EXTENSION_REGISTRY as n, BUILTIN_EXTENSIONS as t };
357
370
 
358
- //# sourceMappingURL=builtin-registry-byJRe4EK.js.map
371
+ //# sourceMappingURL=builtin-registry-ii02fNMx.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-registry-byJRe4EK.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: '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;GAAU;EAClD,MAAM,aAAa,MAAM,OAAO,0BAA0B;EAC1D;CACD;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aAA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ACC;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-ii02fNMx.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'Prompt shim for portable handoffs to later sessions and teammates',\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 prompt guidance',\n\t\taliases: ['handoff', 'continuation'],\n\t\tload: async () => (await import('@spences10/pi-handoff')).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;GAAU;EAClD,MAAM,aAAa,MAAM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AAM,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,0BAA0B;EAC1D;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"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as BUILTIN_EXTENSIONS } from "./builtin-registry-byJRe4EK.js";
2
+ import { t as BUILTIN_EXTENSIONS } from "./builtin-registry-ii02fNMx.js";
3
3
  import { defineCommand, renderUsage, runMain } from "citty";
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
  import { dirname, join, resolve } from "node:path";
@@ -118,7 +118,7 @@ NOTES
118
118
  - In non-interactive modes, my-pi keeps headless-capable built-ins like
119
119
  MCP, LSP, prompt presets, recall, nopeek, Omnisearch, SQLite tools, hooks, and secret redaction.
120
120
  - UI-only built-ins like session auto-naming are skipped.
121
- - Repeat -e / --extension to stack multiple extensions.
121
+ - Repeat -e / --extension to compose multiple extensions.
122
122
 
123
123
  NESTED RUNS
124
124
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/cli-args.ts","../src/warnings.ts","../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport {\n\tBUILTIN_EXTENSIONS,\n\ttype BuiltinExtensionOptionName,\n} from './extensions/builtin-registry.js';\n\nconst THINKING_LEVELS = new Set([\n\t'off',\n\t'minimal',\n\t'low',\n\t'medium',\n\t'high',\n\t'xhigh',\n]);\n\nexport type CliThinkingLevel =\n\t| 'off'\n\t| 'minimal'\n\t| 'low'\n\t| 'medium'\n\t| 'high'\n\t| 'xhigh';\n\nexport type BuiltinDisableCliArgs = Record<\n\tstring,\n\t{\n\t\ttype: 'boolean';\n\t\tdescription: string;\n\t\tdefault: false;\n\t}\n>;\n\nexport function create_builtin_disable_cli_args(): BuiltinDisableCliArgs {\n\treturn Object.fromEntries(\n\t\tBUILTIN_EXTENSIONS.map((extension) => [\n\t\t\textension.cli_arg,\n\t\t\t{\n\t\t\t\ttype: 'boolean' as const,\n\t\t\t\tdescription: extension.cli_description,\n\t\t\t\tdefault: false as const,\n\t\t\t},\n\t\t]),\n\t);\n}\n\nexport function resolve_builtin_extension_options(\n\targs: Record<string, unknown>,\n): Partial<Record<BuiltinExtensionOptionName, boolean>> {\n\tconst no_builtin = Boolean(args['no-builtin']);\n\treturn Object.fromEntries(\n\t\tBUILTIN_EXTENSIONS.map((extension) => [\n\t\t\textension.option_name,\n\t\t\t!no_builtin && !args[extension.cli_arg],\n\t\t]),\n\t) as Partial<Record<BuiltinExtensionOptionName, boolean>>;\n}\n\nexport function collect_flag_values(\n\targv: string[],\n\tflags: readonly string[],\n): string[] {\n\tconst values: string[] = [];\n\tconst flag_set = new Set(flags);\n\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tconst arg = argv[i];\n\t\tif (!arg) continue;\n\n\t\tconst equals_index = arg.indexOf('=');\n\t\tif (equals_index !== -1) {\n\t\t\tconst name = arg.slice(0, equals_index);\n\t\t\tif (flag_set.has(name)) {\n\t\t\t\tvalues.push(arg.slice(equals_index + 1));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (flag_set.has(arg) && i + 1 < argv.length) {\n\t\t\tconst next = argv[i + 1];\n\t\t\tif (next !== undefined) {\n\t\t\t\tvalues.push(next);\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn values;\n}\n\nexport function parse_extension_paths(\n\targv: string[],\n\tcwd = process.cwd(),\n): string[] {\n\treturn collect_flag_values(argv, ['-e', '--extension'])\n\t\t.map((path) => path.trim())\n\t\t.filter(Boolean)\n\t\t.map((path) => resolve(cwd, path));\n}\n\nexport function parse_tool_allowlist(\n\targv: string[],\n): string[] | undefined {\n\tconst tools = collect_flag_values(argv, ['--tools', '-t'])\n\t\t.flatMap((value) => value.split(','))\n\t\t.map((tool) => tool.trim())\n\t\t.filter(Boolean);\n\treturn tools.length ? [...new Set(tools)] : undefined;\n}\n\nexport function parse_skill_allowlist(\n\targv: string[],\n): string[] | undefined {\n\tconst skills = collect_flag_values(argv, ['--skill'])\n\t\t.flatMap((value) => value.split(','))\n\t\t.map((skill) => skill.trim())\n\t\t.filter(Boolean);\n\treturn skills.length ? [...new Set(skills)] : undefined;\n}\n\nexport function parse_thinking_level(\n\tvalue: string | undefined,\n): CliThinkingLevel | undefined {\n\tconst normalized = value?.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\tif (!THINKING_LEVELS.has(normalized)) {\n\t\tthrow new Error(\n\t\t\t'--thinking must be one of: off, minimal, low, medium, high, xhigh.',\n\t\t);\n\t}\n\treturn normalized as CliThinkingLevel;\n}\n","const SQLITE_EXPERIMENTAL_WARNING =\n\t'SQLite is an experimental feature';\nconst FILTER_INSTALLED = Symbol.for(\n\t'my-pi.sqlite-warning-filter-installed',\n);\nconst ORIGINAL_EMIT_WARNING = Symbol.for(\n\t'my-pi.original-emit-warning',\n);\n\ntype WarningEmitter = Pick<typeof process, 'emitWarning'> & {\n\t[FILTER_INSTALLED]?: boolean;\n\t[ORIGINAL_EMIT_WARNING]?: typeof process.emitWarning;\n};\n\nexport function should_suppress_warning(warning: Error): boolean {\n\treturn (\n\t\twarning.name === 'ExperimentalWarning' &&\n\t\twarning.message.includes(SQLITE_EXPERIMENTAL_WARNING)\n\t);\n}\n\nfunction should_suppress_emit_warning_args(args: unknown[]): boolean {\n\tconst [warning, options_or_type] = args;\n\tif (warning instanceof Error)\n\t\treturn should_suppress_warning(warning);\n\tconst warning_type =\n\t\ttypeof options_or_type === 'string'\n\t\t\t? options_or_type\n\t\t\t: options_or_type && typeof options_or_type === 'object'\n\t\t\t\t? (options_or_type as { type?: unknown }).type\n\t\t\t\t: undefined;\n\treturn (\n\t\twarning_type === 'ExperimentalWarning' &&\n\t\tString(warning).includes(SQLITE_EXPERIMENTAL_WARNING)\n\t);\n}\n\nexport function install_sqlite_warning_filter(\n\tprocess_like: WarningEmitter = process,\n): void {\n\tif (process_like[FILTER_INSTALLED]) return;\n\tprocess_like[FILTER_INSTALLED] = true;\n\n\tconst original_emit_warning =\n\t\tprocess_like[ORIGINAL_EMIT_WARNING] ?? process_like.emitWarning;\n\tprocess_like[ORIGINAL_EMIT_WARNING] = original_emit_warning;\n\n\tprocess_like.emitWarning = function emit_filtered_warning(\n\t\tthis: WarningEmitter,\n\t\t...args: unknown[]\n\t) {\n\t\tif (should_suppress_emit_warning_args(args)) return;\n\t\treturn (\n\t\t\toriginal_emit_warning as (...args: unknown[]) => void\n\t\t).apply(this, args);\n\t} as typeof process.emitWarning;\n}\n","#!/usr/bin/env node\n\n// CLI for my-pi — composable pi coding agent\n// User extension stacking started from https://github.com/disler/pi-vs-claude-code;\n// built-ins are now managed through my-pi's registry.\n\nimport { defineCommand, renderUsage, runMain } from 'citty';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport {\n\tcreate_builtin_disable_cli_args,\n\tparse_extension_paths,\n\tparse_skill_allowlist,\n\tparse_thinking_level,\n\tparse_tool_allowlist,\n\tresolve_builtin_extension_options,\n} from './cli-args.js';\nimport { install_sqlite_warning_filter } from './warnings.js';\n\ninstall_sqlite_warning_filter();\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst package_root = join(__dirname, '..');\nconst pkg = JSON.parse(\n\treadFileSync(join(package_root, 'package.json'), 'utf-8'),\n);\n\n// my-pi is a wrapper around Pi; upstream Pi update banners are useful in\n// this repo, but confusing for installed wrapper users.\nif (!existsSync(join(package_root, '.git'))) {\n\tprocess.env.PI_SKIP_VERSION_CHECK ??= '1';\n}\n\nasync function read_stdin(): Promise<string> {\n\tconst chunks: Buffer[] = [];\n\tfor await (const chunk of process.stdin) {\n\t\tchunks.push(chunk as Buffer);\n\t}\n\treturn Buffer.concat(chunks).toString('utf-8').trim();\n}\n\nconst HELP_APPENDIX = `\nMODES\n\n my-pi\n Interactive TUI with slash commands, editor, and session UI.\n\n my-pi \"prompt\"\n my-pi -P \"prompt\"\n One-shot print mode with plain text output.\n\n my-pi --json \"prompt\"\n Non-interactive NDJSON mode for scripts, evals, and other agents.\n\n my-pi --mode rpc\n RPC mode over stdin/stdout JSONL for orchestrators and teammate sessions.\n\nNOTES\n\n - In non-interactive modes, my-pi keeps headless-capable built-ins like\n MCP, LSP, prompt presets, recall, nopeek, Omnisearch, SQLite tools, hooks, and secret redaction.\n - UI-only built-ins like session auto-naming are skipped.\n - Repeat -e / --extension to stack multiple extensions.\n\nNESTED RUNS\n\n - Child runs inherit cwd and environment unless you isolate them explicitly.\n - Use --agent-dir to isolate auth, config, sessions, and telemetry state.\n - For safer evals or unknown repos, use --untrusted plus an explicit\n --system-prompt.\n\nEXAMPLES\n\n my-pi\n my-pi \"fix the failing test\"\n my-pi -P \"summarize this repo\"\n my-pi --json \"list all TODO comments\"\n echo \"plan a login page\" | my-pi --json\n my-pi --telemetry --json \"run eval case\"\n my-pi --telemetry --telemetry-db ./tmp/evals.db --json \"run case\"\n my-pi --untrusted --agent-dir /tmp/pi-agent --json \"run case\"\n my-pi -e ./my-ext.ts -e ./other-ext.ts \"hello\"\n my-pi -m claude-haiku-4-5-20241022 \"explain this file\"\n XIAOMI_API_KEY=... my-pi -m xiaomi/mimo-v2.5-pro \"summarize this repo\"\n my-pi -m cloudflare-workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast \"explain this file\"\n my-pi --preset terse,no-purple-prose \"summarize this repo\"\n my-pi --system-prompt \"You are a JSON classifier. Return only JSON.\" --json \"classify this\"\n\nPROMPT PRESETS\n\n Interactive commands:\n /prompt-preset help\n /prompt-preset export-defaults\n /prompt-preset edit-global terse\n /prompt-preset base detailed\n /prompt-preset enable bullets\n\n Short alias: /preset\n\n Editable preset files:\n ~/.pi/agent/presets/*.md\n .pi/presets/*.md\n`;\n\nasync function render_rich_usage(\n\tcmd: any,\n\tparent?: any,\n): Promise<string> {\n\treturn `${await (renderUsage as any)(cmd, parent)}\\n${HELP_APPENDIX}`;\n}\n\nasync function print_usage(cmd: any, parent?: any): Promise<void> {\n\tconsole.log(await render_rich_usage(cmd, parent));\n}\n\nconst main = defineCommand({\n\tmeta: {\n\t\tname: 'my-pi',\n\t\tversion: pkg.version,\n\t\tdescription:\n\t\t\t'Composable pi coding agent with MCP, LSP, presets, and local eval telemetry',\n\t},\n\targs: {\n\t\tprint: {\n\t\t\ttype: 'boolean',\n\t\t\talias: 'P',\n\t\t\tdescription: 'Print mode (non-interactive, one-shot)',\n\t\t\tdefault: false,\n\t\t},\n\t\t'agent-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override Pi auth/config/session directory for this process',\n\t\t\trequired: false,\n\t\t},\n\t\t'session-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override Pi session storage directory for this process',\n\t\t\trequired: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\talias: 'j',\n\t\t\tdescription: 'Output NDJSON events (for agent consumption)',\n\t\t\tdefault: false,\n\t\t},\n\t\tmode: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Runtime mode: interactive, print, json, or rpc',\n\t\t\trequired: false,\n\t\t},\n\t\textension: {\n\t\t\ttype: 'string',\n\t\t\talias: 'e',\n\t\t\tdescription:\n\t\t\t\t'Extension path to load; repeatable via argv parsing',\n\t\t\trequired: false,\n\t\t},\n\t\t'no-builtin': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Disable all built-in extensions',\n\t\t\tdefault: false,\n\t\t},\n\t\tuntrusted: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription:\n\t\t\t\t'Safe mode for unknown repos: skip project MCP, hooks, project prompt presets, project skills, and project LSP binaries unless explicitly re-enabled',\n\t\t\tdefault: false,\n\t\t},\n\t\t...create_builtin_disable_cli_args(),\n\t\ttelemetry: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Enable local SQLite telemetry for this process',\n\t\t\tdefault: false,\n\t\t},\n\t\t'no-telemetry': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Disable local SQLite telemetry for this process',\n\t\t\tdefault: false,\n\t\t},\n\t\t'telemetry-db': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override telemetry database path for this process',\n\t\t\trequired: false,\n\t\t},\n\t\tmodel: {\n\t\t\ttype: 'string',\n\t\t\talias: 'm',\n\t\t\tdescription:\n\t\t\t\t'Model to use (e.g. claude-sonnet-4-5-20241022, gpt-5.4, cloudflare-workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast)',\n\t\t},\n\t\tthinking: {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Thinking level: off, minimal, low, medium, high, or xhigh',\n\t\t\trequired: false,\n\t\t},\n\t\ttools: {\n\t\t\ttype: 'string',\n\t\t\talias: 't',\n\t\t\tdescription:\n\t\t\t\t'Comma-separated allowlist of tool names to enable',\n\t\t\trequired: false,\n\t\t},\n\t\tskill: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Skill name to allow; repeatable in argv parsing',\n\t\t\trequired: false,\n\t\t},\n\t\t'system-prompt': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Replace the base system prompt',\n\t\t\trequired: false,\n\t\t},\n\t\t'append-system-prompt': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Append one-off instructions to the system prompt',\n\t\t\trequired: false,\n\t\t},\n\t\tprompt: {\n\t\t\ttype: 'string',\n\t\t\talias: 'p',\n\t\t\tdescription: 'Prompt text (alternative to positional argument)',\n\t\t\trequired: false,\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst cwd = process.cwd();\n\t\tconst extension_paths = parse_extension_paths(process.argv, cwd);\n\t\tconst selected_tools = parse_tool_allowlist(process.argv);\n\t\tconst selected_skills = parse_skill_allowlist(process.argv);\n\t\tlet selected_thinking;\n\t\ttry {\n\t\t\tselected_thinking = parse_thinking_level(args.thinking);\n\t\t} catch (error) {\n\t\t\tconsole.error(\n\t\t\t\terror instanceof Error ? error.message : String(error),\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tlet runtime_mode: 'interactive' | 'print' | 'json' | 'rpc' =\n\t\t\t'interactive';\n\t\tif (args.mode) {\n\t\t\tconst requested = String(args.mode).trim().toLowerCase();\n\t\t\tif (\n\t\t\t\t!['interactive', 'print', 'json', 'rpc'].includes(requested)\n\t\t\t) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Error: --mode must be one of interactive, print, json, rpc.',\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\truntime_mode = requested as\n\t\t\t\t| 'interactive'\n\t\t\t\t| 'print'\n\t\t\t\t| 'json'\n\t\t\t\t| 'rpc';\n\t\t}\n\t\tif (args.json) runtime_mode = 'json';\n\t\telse if (args.print) runtime_mode = 'print';\n\n\t\t// Resolve prompt: named --prompt flag > positional > stdin\n\t\tlet prompt = args.prompt;\n\t\tif (!prompt) {\n\t\t\t// Check for positional arguments (after citty strips flags)\n\t\t\tconst positionals = (args as any)._ as string[] | undefined;\n\t\t\tif (positionals && positionals.length > 0) {\n\t\t\t\tprompt = positionals[0];\n\t\t\t}\n\t\t}\n\t\tif (!prompt && !process.stdin.isTTY && runtime_mode !== 'rpc') {\n\t\t\tprompt = await read_stdin();\n\t\t}\n\t\tif (prompt && runtime_mode === 'interactive')\n\t\t\truntime_mode = 'print';\n\n\t\tif (\n\t\t\t!args.print &&\n\t\t\t!args.json &&\n\t\t\truntime_mode !== 'rpc' &&\n\t\t\t!prompt &&\n\t\t\t!process.stdout.isTTY\n\t\t) {\n\t\t\tawait print_usage(main as any);\n\t\t\treturn;\n\t\t}\n\n\t\t// Startup feedback so silence = broken (issue #3)\n\t\tif (runtime_mode !== 'interactive') {\n\t\t\tprocess.stderr.write(\n\t\t\t\t`my-pi: connecting to ${args.model || 'default model'}...\\n`,\n\t\t\t);\n\t\t}\n\n\t\tif (args.telemetry && args['no-telemetry']) {\n\t\t\tconsole.error(\n\t\t\t\t'Error: --telemetry and --no-telemetry cannot be used together.',\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tlet telemetry_override: boolean | undefined;\n\t\tif (args.telemetry) {\n\t\t\ttelemetry_override = true;\n\t\t} else if (args['no-telemetry']) {\n\t\t\ttelemetry_override = false;\n\t\t}\n\n\t\tconst [\n\t\t\t{ create_my_pi },\n\t\t\t{ InteractiveMode, runPrintMode, runRpcMode },\n\t\t] = await Promise.all([\n\t\t\timport('./api.js'),\n\t\t\timport('@earendil-works/pi-coding-agent'),\n\t\t]);\n\n\t\tconst runtime = await create_my_pi({\n\t\t\tcwd,\n\t\t\tagent_dir: args['agent-dir'],\n\t\t\tsession_dir: args['session-dir'],\n\t\t\textensions: extension_paths,\n\t\t\truntime_mode,\n\t\t\t...resolve_builtin_extension_options(args),\n\t\t\ttelemetry: telemetry_override,\n\t\t\ttelemetry_db_path: args['telemetry-db'],\n\t\t\tmodel: args.model,\n\t\t\tthinking: selected_thinking,\n\t\t\tselected_tools,\n\t\t\tselected_skills,\n\t\t\tsystem_prompt: args['system-prompt'],\n\t\t\tappend_system_prompt: args['append-system-prompt'],\n\t\t\tuntrusted_repo: args.untrusted,\n\t\t});\n\n\t\tif (runtime_mode === 'rpc') {\n\t\t\tawait runRpcMode(runtime);\n\t\t} else if (args.print || args.json || prompt) {\n\t\t\tlet output_mode: 'json' | 'text' = 'text';\n\t\t\tif (args.json) {\n\t\t\t\toutput_mode = 'json';\n\t\t\t}\n\t\t\tconst code = await runPrintMode(runtime, {\n\t\t\t\tmode: output_mode,\n\t\t\t\tinitialMessage: prompt || '',\n\t\t\t\tinitialImages: [],\n\t\t\t\tmessages: [],\n\t\t\t});\n\t\t\tprocess.exit(code);\n\t\t} else if (!process.stdout.isTTY) {\n\t\t\tawait print_usage(main as any);\n\t\t} else {\n\t\t\tconst mode = new InteractiveMode(runtime, {\n\t\t\t\tmigratedProviders: [],\n\t\t\t\tmodelFallbackMessage: undefined,\n\t\t\t\tinitialMessage: undefined,\n\t\t\t\tinitialImages: [],\n\t\t\t\tinitialMessages: [],\n\t\t\t});\n\t\t\tawait mode.run();\n\t\t}\n\t},\n});\n\nvoid runMain(main as any, {\n\tshowUsage: async (cmd: any, parent: any) => {\n\t\tawait print_usage(cmd, parent);\n\t},\n});\n"],"mappings":";;;;;;;AAMA,MAAM,kBAAkB,IAAI,IAAI;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAmBF,SAAgB,kCAAyD;CACxE,OAAO,OAAO,YACb,mBAAmB,KAAK,cAAc,CACrC,UAAU,SACV;EACC,MAAM;EACN,aAAa,UAAU;EACvB,SAAS;EACT,CACD,CAAC,CACF;;AAGF,SAAgB,kCACf,MACuD;CACvD,MAAM,aAAa,QAAQ,KAAK,cAAc;CAC9C,OAAO,OAAO,YACb,mBAAmB,KAAK,cAAc,CACrC,UAAU,aACV,CAAC,cAAc,CAAC,KAAK,UAAU,SAC/B,CAAC,CACF;;AAGF,SAAgB,oBACf,MACA,OACW;CACX,MAAM,SAAmB,EAAE;CAC3B,MAAM,WAAW,IAAI,IAAI,MAAM;CAE/B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACrC,MAAM,MAAM,KAAK;EACjB,IAAI,CAAC,KAAK;EAEV,MAAM,eAAe,IAAI,QAAQ,IAAI;EACr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AO,YAAoB,KAAK,OAAO,CAAC,IAAI;;AAGvD,eAAe,YAAY,KAAU,QAA6B;CACjE,QAAQ,IAAI,MAAM,kBAAkB,KAAK,OAAO,CAAC;;AAGlD,MAAM,OAAO,cAAc;CAC1B,MAAM;EACL,MAAM;EACN,SAAS,IAAI;EACb,aACC;EACD;CACD,MAAM;EACL,OAAO;GACN,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS;GACT;EACD,aAAa;GACZ,MAAM;GACN,aACC;GACD,UAAU;GACV;EACD,eAAe;GACd,MAAM;GACN,aACC;GACD,UAAU;GACV;EACD,MAAM;GACL,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS;GACT;EACD,MAAM;GACL,MAAM;GACN,aAAa;GACb,UAAU;GACV;EACD,WAAW;GACV,MAAM;GACN,OAAO;GACP,aACC;GACD,UAAU;GACV;EACD,cAAc;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACT;EACD,WAAW;GACV,MAAM;GACN,aACC;GACD,SAAS;GACT;EACD,GAAG,iCAAiC;EACpC,WAAW;GACV,MAAM;GACN,aAAa;GACb,SAAS;GACT;EACD,gBAAgB;GACf,MAAM;GACN,aAAa;GACb,SAAS;GACT;EACD,gBAAgB;GACf,MAAM;GACN,aACC;GACD,UAAU;GACV;EACD,OAAO;GACN,MAAM;GACN,OAAO;GACP,aACC;GACD;EACD,UAAU;GACT,MAAM;GACN,aACC;GACD,UAAU;GACV;EACD,OAAO;GACN,MAAM;GACN,OAAO;GACP,aACC;GACD,UAAU;GACV;EACD,OAAO;GACN,MAAM;GACN,aAAa;GACb,UAAU;GACV;EACD,iBAAiB;GAChB,MAAM;GACN,aAAa;GACb,UAAU;GACV;EACD,wBAAwB;GACvB,MAAM;GACN,aAAa;GACb,UAAU;GACV;EACD,QAAQ;GACP,MAAM;GACN,OAAO;GACP,aAAa;GACb,UAAU;GACV;EACD;CACD,MAAM,IAAI,EAAE,QAAQ;EACnB,MAAM,MAAM,QAAQ,KAAK;EACzB,M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AAE,iBAAiB,cAAc,gBAC9B,MAAM,QAAQ,IAAI,CACrB,OAAO,aACP,OAAO,mCACP,CAAC;EAEF,MAAM,UAAU,MAAM,aAAa;GAClC;GACA,WAAW,KAAK;GAChB,aAAa,KAAK;GAClB,YAAY;GACZ;GACA,GAAG,kCAAkC,KAAK;GAC1C,WAAW;GACX,mBAAmB,KAAK;GACxB,OAAO,KAAK;GACZ,UAAU;GACV;GACA;GACA,eAAe,KAAK;GACpB,sBAAsB,KAAK;GAC3B,gBAAgB,KAAK;GACrB,CAAC;EAEF,IAAI,iBAAiB,OACpB,MAAM,WAAW,QAAQ;OACnB,IAAI,KAAK,SAAS,KAAK,QAAQ,QAAQ;GAC7C,IAAI,cAA+B;GACnC,IAAI,KAAK,MACR,cAAc;GAEf,MAAM,OAAO,MAAM,aAAa,SAAS;IACxC,MAAM;IACN,gBAAgB,UAAU;IAC1B,eAAe,EAAE;IACjB,UAAU,EAAE;IACZ,CAAC;GACF,QAAQ,KAAK,KAAK;SACZ,IAAI,CAAC,QAAQ,OAAO,OAC1B,MAAM,YAAY,KAAY;OAS9B,MAAM,IAPW,gBAAgB,SAAS;GACzC,mBAAmB,EAAE;GACrB,sBAAsB,KAAA;GACtB,gBAAgB,KAAA;GAChB,eAAe,EAAE;GACjB,iBAAiB,EAAE;GACnB,CACS,CAAC,KAAK;;CAGlB,CAAC;AAEG,QAAQ,MAAa,EACzB,WAAW,OAAO,KAAU,WAAgB;CAC3C,MAAM,YAAY,KAAK,OAAO;GAE/B,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/cli-args.ts","../src/warnings.ts","../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport {\n\tBUILTIN_EXTENSIONS,\n\ttype BuiltinExtensionOptionName,\n} from './extensions/builtin-registry.js';\n\nconst THINKING_LEVELS = new Set([\n\t'off',\n\t'minimal',\n\t'low',\n\t'medium',\n\t'high',\n\t'xhigh',\n]);\n\nexport type CliThinkingLevel =\n\t| 'off'\n\t| 'minimal'\n\t| 'low'\n\t| 'medium'\n\t| 'high'\n\t| 'xhigh';\n\nexport type BuiltinDisableCliArgs = Record<\n\tstring,\n\t{\n\t\ttype: 'boolean';\n\t\tdescription: string;\n\t\tdefault: false;\n\t}\n>;\n\nexport function create_builtin_disable_cli_args(): BuiltinDisableCliArgs {\n\treturn Object.fromEntries(\n\t\tBUILTIN_EXTENSIONS.map((extension) => [\n\t\t\textension.cli_arg,\n\t\t\t{\n\t\t\t\ttype: 'boolean' as const,\n\t\t\t\tdescription: extension.cli_description,\n\t\t\t\tdefault: false as const,\n\t\t\t},\n\t\t]),\n\t);\n}\n\nexport function resolve_builtin_extension_options(\n\targs: Record<string, unknown>,\n): Partial<Record<BuiltinExtensionOptionName, boolean>> {\n\tconst no_builtin = Boolean(args['no-builtin']);\n\treturn Object.fromEntries(\n\t\tBUILTIN_EXTENSIONS.map((extension) => [\n\t\t\textension.option_name,\n\t\t\t!no_builtin && !args[extension.cli_arg],\n\t\t]),\n\t) as Partial<Record<BuiltinExtensionOptionName, boolean>>;\n}\n\nexport function collect_flag_values(\n\targv: string[],\n\tflags: readonly string[],\n): string[] {\n\tconst values: string[] = [];\n\tconst flag_set = new Set(flags);\n\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tconst arg = argv[i];\n\t\tif (!arg) continue;\n\n\t\tconst equals_index = arg.indexOf('=');\n\t\tif (equals_index !== -1) {\n\t\t\tconst name = arg.slice(0, equals_index);\n\t\t\tif (flag_set.has(name)) {\n\t\t\t\tvalues.push(arg.slice(equals_index + 1));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (flag_set.has(arg) && i + 1 < argv.length) {\n\t\t\tconst next = argv[i + 1];\n\t\t\tif (next !== undefined) {\n\t\t\t\tvalues.push(next);\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn values;\n}\n\nexport function parse_extension_paths(\n\targv: string[],\n\tcwd = process.cwd(),\n): string[] {\n\treturn collect_flag_values(argv, ['-e', '--extension'])\n\t\t.map((path) => path.trim())\n\t\t.filter(Boolean)\n\t\t.map((path) => resolve(cwd, path));\n}\n\nexport function parse_tool_allowlist(\n\targv: string[],\n): string[] | undefined {\n\tconst tools = collect_flag_values(argv, ['--tools', '-t'])\n\t\t.flatMap((value) => value.split(','))\n\t\t.map((tool) => tool.trim())\n\t\t.filter(Boolean);\n\treturn tools.length ? [...new Set(tools)] : undefined;\n}\n\nexport function parse_skill_allowlist(\n\targv: string[],\n): string[] | undefined {\n\tconst skills = collect_flag_values(argv, ['--skill'])\n\t\t.flatMap((value) => value.split(','))\n\t\t.map((skill) => skill.trim())\n\t\t.filter(Boolean);\n\treturn skills.length ? [...new Set(skills)] : undefined;\n}\n\nexport function parse_thinking_level(\n\tvalue: string | undefined,\n): CliThinkingLevel | undefined {\n\tconst normalized = value?.trim().toLowerCase();\n\tif (!normalized) return undefined;\n\tif (!THINKING_LEVELS.has(normalized)) {\n\t\tthrow new Error(\n\t\t\t'--thinking must be one of: off, minimal, low, medium, high, xhigh.',\n\t\t);\n\t}\n\treturn normalized as CliThinkingLevel;\n}\n","const SQLITE_EXPERIMENTAL_WARNING =\n\t'SQLite is an experimental feature';\nconst FILTER_INSTALLED = Symbol.for(\n\t'my-pi.sqlite-warning-filter-installed',\n);\nconst ORIGINAL_EMIT_WARNING = Symbol.for(\n\t'my-pi.original-emit-warning',\n);\n\ntype WarningEmitter = Pick<typeof process, 'emitWarning'> & {\n\t[FILTER_INSTALLED]?: boolean;\n\t[ORIGINAL_EMIT_WARNING]?: typeof process.emitWarning;\n};\n\nexport function should_suppress_warning(warning: Error): boolean {\n\treturn (\n\t\twarning.name === 'ExperimentalWarning' &&\n\t\twarning.message.includes(SQLITE_EXPERIMENTAL_WARNING)\n\t);\n}\n\nfunction should_suppress_emit_warning_args(args: unknown[]): boolean {\n\tconst [warning, options_or_type] = args;\n\tif (warning instanceof Error)\n\t\treturn should_suppress_warning(warning);\n\tconst warning_type =\n\t\ttypeof options_or_type === 'string'\n\t\t\t? options_or_type\n\t\t\t: options_or_type && typeof options_or_type === 'object'\n\t\t\t\t? (options_or_type as { type?: unknown }).type\n\t\t\t\t: undefined;\n\treturn (\n\t\twarning_type === 'ExperimentalWarning' &&\n\t\tString(warning).includes(SQLITE_EXPERIMENTAL_WARNING)\n\t);\n}\n\nexport function install_sqlite_warning_filter(\n\tprocess_like: WarningEmitter = process,\n): void {\n\tif (process_like[FILTER_INSTALLED]) return;\n\tprocess_like[FILTER_INSTALLED] = true;\n\n\tconst original_emit_warning =\n\t\tprocess_like[ORIGINAL_EMIT_WARNING] ?? process_like.emitWarning;\n\tprocess_like[ORIGINAL_EMIT_WARNING] = original_emit_warning;\n\n\tprocess_like.emitWarning = function emit_filtered_warning(\n\t\tthis: WarningEmitter,\n\t\t...args: unknown[]\n\t) {\n\t\tif (should_suppress_emit_warning_args(args)) return;\n\t\treturn (\n\t\t\toriginal_emit_warning as (...args: unknown[]) => void\n\t\t).apply(this, args);\n\t} as typeof process.emitWarning;\n}\n","#!/usr/bin/env node\n\n// CLI for my-pi — composable pi coding agent\n\nimport { defineCommand, renderUsage, runMain } from 'citty';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport {\n\tcreate_builtin_disable_cli_args,\n\tparse_extension_paths,\n\tparse_skill_allowlist,\n\tparse_thinking_level,\n\tparse_tool_allowlist,\n\tresolve_builtin_extension_options,\n} from './cli-args.js';\nimport { install_sqlite_warning_filter } from './warnings.js';\n\ninstall_sqlite_warning_filter();\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst package_root = join(__dirname, '..');\nconst pkg = JSON.parse(\n\treadFileSync(join(package_root, 'package.json'), 'utf-8'),\n);\n\n// my-pi is a wrapper around Pi; upstream Pi update banners are useful in\n// this repo, but confusing for installed wrapper users.\nif (!existsSync(join(package_root, '.git'))) {\n\tprocess.env.PI_SKIP_VERSION_CHECK ??= '1';\n}\n\nasync function read_stdin(): Promise<string> {\n\tconst chunks: Buffer[] = [];\n\tfor await (const chunk of process.stdin) {\n\t\tchunks.push(chunk as Buffer);\n\t}\n\treturn Buffer.concat(chunks).toString('utf-8').trim();\n}\n\nconst HELP_APPENDIX = `\nMODES\n\n my-pi\n Interactive TUI with slash commands, editor, and session UI.\n\n my-pi \"prompt\"\n my-pi -P \"prompt\"\n One-shot print mode with plain text output.\n\n my-pi --json \"prompt\"\n Non-interactive NDJSON mode for scripts, evals, and other agents.\n\n my-pi --mode rpc\n RPC mode over stdin/stdout JSONL for orchestrators and teammate sessions.\n\nNOTES\n\n - In non-interactive modes, my-pi keeps headless-capable built-ins like\n MCP, LSP, prompt presets, recall, nopeek, Omnisearch, SQLite tools, hooks, and secret redaction.\n - UI-only built-ins like session auto-naming are skipped.\n - Repeat -e / --extension to compose multiple extensions.\n\nNESTED RUNS\n\n - Child runs inherit cwd and environment unless you isolate them explicitly.\n - Use --agent-dir to isolate auth, config, sessions, and telemetry state.\n - For safer evals or unknown repos, use --untrusted plus an explicit\n --system-prompt.\n\nEXAMPLES\n\n my-pi\n my-pi \"fix the failing test\"\n my-pi -P \"summarize this repo\"\n my-pi --json \"list all TODO comments\"\n echo \"plan a login page\" | my-pi --json\n my-pi --telemetry --json \"run eval case\"\n my-pi --telemetry --telemetry-db ./tmp/evals.db --json \"run case\"\n my-pi --untrusted --agent-dir /tmp/pi-agent --json \"run case\"\n my-pi -e ./my-ext.ts -e ./other-ext.ts \"hello\"\n my-pi -m claude-haiku-4-5-20241022 \"explain this file\"\n XIAOMI_API_KEY=... my-pi -m xiaomi/mimo-v2.5-pro \"summarize this repo\"\n my-pi -m cloudflare-workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast \"explain this file\"\n my-pi --preset terse,no-purple-prose \"summarize this repo\"\n my-pi --system-prompt \"You are a JSON classifier. Return only JSON.\" --json \"classify this\"\n\nPROMPT PRESETS\n\n Interactive commands:\n /prompt-preset help\n /prompt-preset export-defaults\n /prompt-preset edit-global terse\n /prompt-preset base detailed\n /prompt-preset enable bullets\n\n Short alias: /preset\n\n Editable preset files:\n ~/.pi/agent/presets/*.md\n .pi/presets/*.md\n`;\n\nasync function render_rich_usage(\n\tcmd: any,\n\tparent?: any,\n): Promise<string> {\n\treturn `${await (renderUsage as any)(cmd, parent)}\\n${HELP_APPENDIX}`;\n}\n\nasync function print_usage(cmd: any, parent?: any): Promise<void> {\n\tconsole.log(await render_rich_usage(cmd, parent));\n}\n\nconst main = defineCommand({\n\tmeta: {\n\t\tname: 'my-pi',\n\t\tversion: pkg.version,\n\t\tdescription:\n\t\t\t'Composable pi coding agent with MCP, LSP, presets, and local eval telemetry',\n\t},\n\targs: {\n\t\tprint: {\n\t\t\ttype: 'boolean',\n\t\t\talias: 'P',\n\t\t\tdescription: 'Print mode (non-interactive, one-shot)',\n\t\t\tdefault: false,\n\t\t},\n\t\t'agent-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override Pi auth/config/session directory for this process',\n\t\t\trequired: false,\n\t\t},\n\t\t'session-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override Pi session storage directory for this process',\n\t\t\trequired: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\talias: 'j',\n\t\t\tdescription: 'Output NDJSON events (for agent consumption)',\n\t\t\tdefault: false,\n\t\t},\n\t\tmode: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Runtime mode: interactive, print, json, or rpc',\n\t\t\trequired: false,\n\t\t},\n\t\textension: {\n\t\t\ttype: 'string',\n\t\t\talias: 'e',\n\t\t\tdescription:\n\t\t\t\t'Extension path to load; repeatable via argv parsing',\n\t\t\trequired: false,\n\t\t},\n\t\t'no-builtin': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Disable all built-in extensions',\n\t\t\tdefault: false,\n\t\t},\n\t\tuntrusted: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription:\n\t\t\t\t'Safe mode for unknown repos: skip project MCP, hooks, project prompt presets, project skills, and project LSP binaries unless explicitly re-enabled',\n\t\t\tdefault: false,\n\t\t},\n\t\t...create_builtin_disable_cli_args(),\n\t\ttelemetry: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Enable local SQLite telemetry for this process',\n\t\t\tdefault: false,\n\t\t},\n\t\t'no-telemetry': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Disable local SQLite telemetry for this process',\n\t\t\tdefault: false,\n\t\t},\n\t\t'telemetry-db': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Override telemetry database path for this process',\n\t\t\trequired: false,\n\t\t},\n\t\tmodel: {\n\t\t\ttype: 'string',\n\t\t\talias: 'm',\n\t\t\tdescription:\n\t\t\t\t'Model to use (e.g. claude-sonnet-4-5-20241022, gpt-5.4, cloudflare-workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast)',\n\t\t},\n\t\tthinking: {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Thinking level: off, minimal, low, medium, high, or xhigh',\n\t\t\trequired: false,\n\t\t},\n\t\ttools: {\n\t\t\ttype: 'string',\n\t\t\talias: 't',\n\t\t\tdescription:\n\t\t\t\t'Comma-separated allowlist of tool names to enable',\n\t\t\trequired: false,\n\t\t},\n\t\tskill: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Skill name to allow; repeatable in argv parsing',\n\t\t\trequired: false,\n\t\t},\n\t\t'system-prompt': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Replace the base system prompt',\n\t\t\trequired: false,\n\t\t},\n\t\t'append-system-prompt': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Append one-off instructions to the system prompt',\n\t\t\trequired: false,\n\t\t},\n\t\tprompt: {\n\t\t\ttype: 'string',\n\t\t\talias: 'p',\n\t\t\tdescription: 'Prompt text (alternative to positional argument)',\n\t\t\trequired: false,\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst cwd = process.cwd();\n\t\tconst extension_paths = parse_extension_paths(process.argv, cwd);\n\t\tconst selected_tools = parse_tool_allowlist(process.argv);\n\t\tconst selected_skills = parse_skill_allowlist(process.argv);\n\t\tlet selected_thinking;\n\t\ttry {\n\t\t\tselected_thinking = parse_thinking_level(args.thinking);\n\t\t} catch (error) {\n\t\t\tconsole.error(\n\t\t\t\terror instanceof Error ? error.message : String(error),\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tlet runtime_mode: 'interactive' | 'print' | 'json' | 'rpc' =\n\t\t\t'interactive';\n\t\tif (args.mode) {\n\t\t\tconst requested = String(args.mode).trim().toLowerCase();\n\t\t\tif (\n\t\t\t\t!['interactive', 'print', 'json', 'rpc'].includes(requested)\n\t\t\t) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Error: --mode must be one of interactive, print, json, rpc.',\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\truntime_mode = requested as\n\t\t\t\t| 'interactive'\n\t\t\t\t| 'print'\n\t\t\t\t| 'json'\n\t\t\t\t| 'rpc';\n\t\t}\n\t\tif (args.json) runtime_mode = 'json';\n\t\telse if (args.print) runtime_mode = 'print';\n\n\t\t// Resolve prompt: named --prompt flag > positional > stdin\n\t\tlet prompt = args.prompt;\n\t\tif (!prompt) {\n\t\t\t// Check for positional arguments (after citty strips flags)\n\t\t\tconst positionals = (args as any)._ as string[] | undefined;\n\t\t\tif (positionals && positionals.length > 0) {\n\t\t\t\tprompt = positionals[0];\n\t\t\t}\n\t\t}\n\t\tif (!prompt && !process.stdin.isTTY && runtime_mode !== 'rpc') {\n\t\t\tprompt = await read_stdin();\n\t\t}\n\t\tif (prompt && runtime_mode === 'interactive')\n\t\t\truntime_mode = 'print';\n\n\t\tif (\n\t\t\t!args.print &&\n\t\t\t!args.json &&\n\t\t\truntime_mode !== 'rpc' &&\n\t\t\t!prompt &&\n\t\t\t!process.stdout.isTTY\n\t\t) {\n\t\t\tawait print_usage(main as any);\n\t\t\treturn;\n\t\t}\n\n\t\t// Startup feedback so silence = broken (issue #3)\n\t\tif (runtime_mode !== 'interactive') {\n\t\t\tprocess.stderr.write(\n\t\t\t\t`my-pi: connecting to ${args.model || 'default model'}...\\n`,\n\t\t\t);\n\t\t}\n\n\t\tif (args.telemetry && args['no-telemetry']) {\n\t\t\tconsole.error(\n\t\t\t\t'Error: --telemetry and --no-telemetry cannot be used together.',\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tlet telemetry_override: boolean | undefined;\n\t\tif (args.telemetry) {\n\t\t\ttelemetry_override = true;\n\t\t} else if (args['no-telemetry']) {\n\t\t\ttelemetry_override = false;\n\t\t}\n\n\t\tconst [\n\t\t\t{ create_my_pi },\n\t\t\t{ InteractiveMode, runPrintMode, runRpcMode },\n\t\t] = await Promise.all([\n\t\t\timport('./api.js'),\n\t\t\timport('@earendil-works/pi-coding-agent'),\n\t\t]);\n\n\t\tconst runtime = await create_my_pi({\n\t\t\tcwd,\n\t\t\tagent_dir: args['agent-dir'],\n\t\t\tsession_dir: args['session-dir'],\n\t\t\textensions: extension_paths,\n\t\t\truntime_mode,\n\t\t\t...resolve_builtin_extension_options(args),\n\t\t\ttelemetry: telemetry_override,\n\t\t\ttelemetry_db_path: args['telemetry-db'],\n\t\t\tmodel: args.model,\n\t\t\tthinking: selected_thinking,\n\t\t\tselected_tools,\n\t\t\tselected_skills,\n\t\t\tsystem_prompt: args['system-prompt'],\n\t\t\tappend_system_prompt: args['append-system-prompt'],\n\t\t\tuntrusted_repo: args.untrusted,\n\t\t});\n\n\t\tif (runtime_mode === 'rpc') {\n\t\t\tawait runRpcMode(runtime);\n\t\t} else if (args.print || args.json || prompt) {\n\t\t\tlet output_mode: 'json' | 'text' = 'text';\n\t\t\tif (args.json) {\n\t\t\t\toutput_mode = 'json';\n\t\t\t}\n\t\t\tconst code = await runPrintMode(runtime, {\n\t\t\t\tmode: output_mode,\n\t\t\t\tinitialMessage: prompt || '',\n\t\t\t\tinitialImages: [],\n\t\t\t\tmessages: [],\n\t\t\t});\n\t\t\tprocess.exit(code);\n\t\t} else if (!process.stdout.isTTY) {\n\t\t\tawait print_usage(main as any);\n\t\t} else {\n\t\t\tconst mode = new InteractiveMode(runtime, {\n\t\t\t\tmigratedProviders: [],\n\t\t\t\tmodelFallbackMessage: undefined,\n\t\t\t\tinitialMessage: undefined,\n\t\t\t\tinitialImages: [],\n\t\t\t\tinitialMessages: [],\n\t\t\t});\n\t\t\tawait mode.run();\n\t\t}\n\t},\n});\n\nvoid runMain(main as any, {\n\tshowUsage: async (cmd: any, parent: any) => {\n\t\tawait print_usage(cmd, parent);\n\t},\n});\n"],"mappings":";;;;;;;AAMA,MAAM,kBAAkB,IAAI,IAAI;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAmBF,SAAgB,kCAAyD;CACxE,OAAO,OAAO,YACb,mBAAmB,KAAK,cAAc,CACrC,UAAU,SACV;EACC,MAAM;EACN,aAAa,UAAU;EACvB,SAAS;EACT,CACD,CAAC,CACF;;AAGF,SAAgB,kCACf,MACuD;CACvD,MAAM,aAAa,QAAQ,KAAK,cAAc;CAC9C,OAAO,OAAO,YACb,mBAAmB,KAAK,cAAc,CACrC,UAAU,aACV,CAAC,cAAc,CAAC,KAAK,UAAU,SAC/B,CAAC,CACF;;AAGF,SAAgB,oBACf,MACA,OACW;CACX,MAAM,SAAmB,EAAE;CAC3B,MAAM,WAAW,IAAI,IAAI,MAAM;CAE/B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACrC,MAAM,MAAM,KAAK;EACjB,IAAI,CAAC,KAAK;EAEV,MAAM,eAAe,IAAI,QAAQ,IAAI;EACrC,IAAI,iBAAiB,IAAI;GACxB,MAAM,OAAO,IAAI,MAAM,GAAG,aAAa;GACvC,IAAI,SAAS,IAAI,KAAK,EACrB,OAAO,KAAK,IAAI,MAAM,eAAe,EAAE,CAAC;G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Ac;CAC1B,MAAM;EACL,MAAM;EACN,SAAS,IAAI;EACb,aACC;EACD;CACD,MAAM;EACL,OAAO;GACN,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS;GACT;EACD,aAAa;GACZ,MAAM;GACN,aACC;GACD,UAAU;GACV;EACD,eAAe;GACd,MAAM;GACN,aACC;GACD,UAAU;GACV;EACD,MAAM;GACL,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS;GACT;EACD,MAAM;GACL,MAAM;GACN,aAAa;GACb,UAAU;GACV;EACD,WAAW;GACV,MAAM;GACN,OAAO;GACP,aACC;GACD,UAAU;GACV;EACD,cAAc;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACT;EACD,WAAW;GACV,MAAM;GACN,aACC;GACD,SAAS;GACT;EACD,GAAG,iCAAiC;EACpC,WAAW;GACV,MAAM;GACN,aAAa;GACb,SAAS;GACT;EACD,gBAAgB;GACf,MAAM;GACN,aAAa;GACb,SAAS;GACT;EACD,gBAAgB;GACf,MAAM;GACN,aACC;GACD,UAAU;GACV;EACD,OAAO;GACN,MAAM;GACN,OAAO;GACP,aACC;GACD;EACD,UAAU;GACT,MAAM;GACN,aACC;GACD,UAAU;GACV;EACD,OAAO;GACN,MAAM;GACN,OAAO;GACP,aACC;GACD,UAAU;GACV;EACD,OAAO;GACN,MAAM;GACN,aAAa;GACb,UAAU;GACV;EACD,iBAAiB;GAChB,MAAM;GACN,aAAa;GACb,UAAU;GACV;EACD,wBAAwB;GACvB,MAAM;GACN,aAAa;GACb,UAAU;GACV;EACD,QAAQ;GACP,MAAM;GACN,OAAO;GACP,aAAa;GACb,UAAU;GACV;EACD;CACD,MAAM,IAAI,EAAE,QAAQ;EACnB,MAAM,MAAM,QAAQ,KAAK;EACzB,MAAM,kBAAkB,sBAAsB,QAAQ,MAAM,IAAI;EAChE,MAAM,iBAAiB,qBAAqB,QAAQ,KAAK;EACzD,MAAM,kBAAkB,sBAAsB,QAAQ,KAAK;EAC3D,IAAI;EACJ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Aa,KAAK;GAClB,YAAY;GACZ;GACA,GAAG,kCAAkC,KAAK;GAC1C,WAAW;GACX,mBAAmB,KAAK;GACxB,OAAO,KAAK;GACZ,UAAU;GACV;GACA;GACA,eAAe,KAAK;GACpB,sBAAsB,KAAK;GAC3B,gBAAgB,KAAK;GACrB,CAAC;EAEF,IAAI,iBAAiB,OACpB,MAAM,WAAW,QAAQ;OACnB,IAAI,KAAK,SAAS,KAAK,QAAQ,QAAQ;GAC7C,IAAI,cAA+B;GACnC,IAAI,KAAK,MACR,cAAc;GAEf,MAAM,OAAO,MAAM,aAAa,SAAS;IACxC,MAAM;IACN,gBAAgB,UAAU;IAC1B,eAAe,EAAE;IACjB,UAAU,EAAE;IACZ,CAAC;GACF,QAAQ,KAAK,KAAK;SACZ,IAAI,CAAC,QAAQ,OAAO,OAC1B,MAAM,YAAY,KAAY;OAS9B,MAAM,IAPW,gBAAgB,SAAS;GACzC,mBAAmB,EAAE;GACrB,sBAAsB,KAAA;GACtB,gBAAgB,KAAA;GAChB,eAAe,EAAE;GACjB,iBAAiB,EAAE;GACnB,CACS,CAAC,KAAK;;CAGlB,CAAC;AAEG,QAAQ,MAAa,EACzB,WAAW,OAAO,KAAU,WAAgB;CAC3C,MAAM,YAAY,KAAK,OAAO;GAE/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-pi",
3
- "version": "0.1.62",
3
+ "version": "0.1.65",
4
4
  "description": "Composable pi coding agent with MCP, LSP, prompt presets, and local eval telemetry",
5
5
  "keywords": [
6
6
  "cli",
@@ -48,10 +48,10 @@
48
48
  "@earendil-works/pi-tui": "0.75.3",
49
49
  "citty": "^0.2.2",
50
50
  "typebox": "^1.1.38",
51
+ "@spences10/pi-project-trust": "0.0.12",
52
+ "@spences10/pi-settings": "0.0.0",
51
53
  "@spences10/pi-themes": "0.0.8",
52
- "@spences10/pi-tui-modal": "0.0.20",
53
- "@spences10/pi-project-trust": "0.0.11",
54
- "@spences10/pi-settings": "0.0.0"
54
+ "@spences10/pi-tui-modal": "0.0.20"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@changesets/cli": "^2.31.0",
@@ -65,21 +65,22 @@
65
65
  "@spences10/pi-child-env": "0.1.8",
66
66
  "@spences10/pi-coding-preferences": "0.0.10",
67
67
  "@spences10/pi-context": "0.0.23",
68
+ "@spences10/pi-confirm-destructive": "0.0.15",
68
69
  "@spences10/pi-footer": "0.0.7",
69
70
  "@spences10/pi-git-ui": "0.0.11",
70
- "@spences10/pi-confirm-destructive": "0.0.15",
71
- "@spences10/pi-mcp": "0.0.35",
72
- "@spences10/pi-lsp": "0.0.32",
71
+ "@spences10/pi-handoff": "0.0.1",
72
+ "@spences10/pi-lsp": "0.0.33",
73
+ "@spences10/pi-mcp": "0.0.36",
73
74
  "@spences10/pi-nopeek": "0.0.13",
74
- "@spences10/pi-omnisearch": "0.0.13",
75
75
  "@spences10/pi-recall": "0.0.13",
76
- "@spences10/pi-skill-importer": "0.0.7",
76
+ "@spences10/pi-omnisearch": "0.0.13",
77
77
  "@spences10/pi-redact": "0.0.12",
78
+ "@spences10/pi-skill-importer": "0.0.7",
78
79
  "@spences10/pi-skills": "0.0.27",
79
80
  "@spences10/pi-sqlite-tools": "0.0.12",
80
81
  "@spences10/pi-svelte-guardrails": "0.0.11",
81
82
  "@spences10/pi-team-mode": "0.0.29",
82
- "@spences10/pi-telemetry": "0.0.22"
83
+ "@spences10/pi-telemetry": "0.0.23"
83
84
  },
84
85
  "engines": {
85
86
  "node": ">=24.15.0"