my-pi 0.1.28 → 0.1.29
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 +13 -7
- package/dist/api.d.ts +5 -5
- package/dist/api.js +1 -1
- package/dist/{builtin-registry-CnQL50C2.js → builtin-registry-Dwgexb9N.js} +8 -7
- package/dist/builtin-registry-Dwgexb9N.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{prompt-presets-DU1Ds6xx.js → prompt-presets-BAXHRyX0.js} +2 -6
- package/dist/{prompt-presets-DU1Ds6xx.js.map → prompt-presets-BAXHRyX0.js.map} +1 -1
- package/package.json +11 -11
- package/dist/builtin-registry-CnQL50C2.js.map +0 -1
package/README.md
CHANGED
|
@@ -144,7 +144,7 @@ consumption by other agents or scripts.
|
|
|
144
144
|
|
|
145
145
|
In non-interactive modes (`"prompt"`, `-P`, `--json`), my-pi keeps
|
|
146
146
|
headless-capable built-ins like MCP, LSP, prompt presets, recall,
|
|
147
|
-
hooks, and secret
|
|
147
|
+
hooks, and secret redaction enabled, while skipping UI-only built-ins
|
|
148
148
|
like session auto-naming.
|
|
149
149
|
|
|
150
150
|
### RPC and team mode
|
|
@@ -577,7 +577,12 @@ In interactive mode:
|
|
|
577
577
|
- `/lsp status|list|restart` — inspect or restart language server
|
|
578
578
|
state
|
|
579
579
|
- `/redact-stats` — show how many secrets were redacted this session
|
|
580
|
-
- `/context
|
|
580
|
+
- `/context` / `/context list [limit]` — browse recent context sidecar
|
|
581
|
+
sources in the current project/session scope
|
|
582
|
+
- `/context stats` / `/context-stats` — inspect scoped/global context
|
|
583
|
+
sidecar stats and active retention policy
|
|
584
|
+
- `/context purge [days|expired]` — purge old or expired context
|
|
585
|
+
sidecar entries
|
|
581
586
|
- `/telemetry status|stats|query|export|on|off|path` — inspect, query,
|
|
582
587
|
export, or toggle local SQLite telemetry
|
|
583
588
|
|
|
@@ -596,9 +601,9 @@ In interactive mode:
|
|
|
596
601
|
|
|
597
602
|
## Secret Redaction
|
|
598
603
|
|
|
599
|
-
The
|
|
600
|
-
tokens, passwords, private keys) from tool output before the LLM
|
|
601
|
-
them. Detection patterns come from
|
|
604
|
+
The secret redaction extension automatically redacts secrets (API
|
|
605
|
+
keys, tokens, passwords, private keys) from tool output before the LLM
|
|
606
|
+
sees them. Detection patterns come from
|
|
602
607
|
[nopeek](https://github.com/spences10/nopeek). This is a defensive
|
|
603
608
|
last-mile guard, not a substitute for secret hygiene: prefer `nopeek`
|
|
604
609
|
for loading credentials and avoid printing secrets in the first place.
|
|
@@ -753,8 +758,9 @@ pi install npm:@spences10/pi-themes
|
|
|
753
758
|
redaction and `/redact-stats`
|
|
754
759
|
- [`@spences10/pi-telemetry`](./packages/pi-telemetry/README.md) —
|
|
755
760
|
local SQLite telemetry and `/telemetry`
|
|
756
|
-
- [`@spences10/pi-context`](./packages/pi-context/README.md) —
|
|
757
|
-
SQLite FTS
|
|
761
|
+
- [`@spences10/pi-context`](./packages/pi-context/README.md) — scoped,
|
|
762
|
+
redacted SQLite FTS overflow cache for oversized text output from
|
|
763
|
+
read/bash/LSP and direct MCP results
|
|
758
764
|
- [`@spences10/pi-mcp`](./packages/pi-mcp/README.md) — MCP server
|
|
759
765
|
integration and `/mcp`
|
|
760
766
|
- [`@spences10/pi-lsp`](./packages/pi-lsp/README.md) — LSP-backed
|
package/dist/api.d.ts
CHANGED
|
@@ -57,15 +57,15 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
57
57
|
readonly load: () => Promise<typeof _$_spences10_pi_skills0.default>;
|
|
58
58
|
}, {
|
|
59
59
|
readonly key: "filter-output";
|
|
60
|
-
readonly label: "
|
|
61
|
-
readonly docs_label: "
|
|
62
|
-
readonly description: "
|
|
60
|
+
readonly label: "Secret redaction";
|
|
61
|
+
readonly docs_label: "Secret redaction";
|
|
62
|
+
readonly description: "Redacts secrets from tool output before the model sees them";
|
|
63
63
|
readonly default_enabled: true;
|
|
64
64
|
readonly option_name: "filter_output";
|
|
65
65
|
readonly cli_arg: "no-filter";
|
|
66
66
|
readonly cli_flag: "--no-filter";
|
|
67
67
|
readonly cli_description: "Disable secret redaction in tool output";
|
|
68
|
-
readonly aliases: readonly ["filter-output", "filter_output", "filter", "redaction"];
|
|
68
|
+
readonly aliases: readonly ["filter-output", "filter_output", "filter", "redaction", "secret-redaction", "output-redaction"];
|
|
69
69
|
readonly load: () => Promise<typeof _$_spences10_pi_redact0.default>;
|
|
70
70
|
}, {
|
|
71
71
|
readonly key: "recall";
|
|
@@ -125,7 +125,7 @@ declare const BUILTIN_EXTENSION_REGISTRY: readonly [{
|
|
|
125
125
|
readonly cli_arg: "no-prompt-presets";
|
|
126
126
|
readonly cli_flag: "--no-prompt-presets";
|
|
127
127
|
readonly cli_description: "Disable prompt presets extension";
|
|
128
|
-
readonly aliases: readonly ["prompt-
|
|
128
|
+
readonly aliases: readonly ["prompt-preset", "preset", "presets"];
|
|
129
129
|
readonly load: () => Promise<typeof prompt_presets>;
|
|
130
130
|
}, {
|
|
131
131
|
readonly key: "lsp";
|
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as BUILTIN_EXTENSION_REGISTRY, t as BUILTIN_EXTENSIONS } from "./builtin-registry-
|
|
1
|
+
import { n as BUILTIN_EXTENSION_REGISTRY, t as BUILTIN_EXTENSIONS } from "./builtin-registry-Dwgexb9N.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -45,9 +45,9 @@ const BUILTIN_EXTENSION_REGISTRY = [
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
key: "filter-output",
|
|
48
|
-
label: "
|
|
49
|
-
docs_label: "
|
|
50
|
-
description: "
|
|
48
|
+
label: "Secret redaction",
|
|
49
|
+
docs_label: "Secret redaction",
|
|
50
|
+
description: "Redacts secrets from tool output before the model sees them",
|
|
51
51
|
default_enabled: true,
|
|
52
52
|
option_name: "filter_output",
|
|
53
53
|
cli_arg: "no-filter",
|
|
@@ -57,7 +57,9 @@ const BUILTIN_EXTENSION_REGISTRY = [
|
|
|
57
57
|
"filter-output",
|
|
58
58
|
"filter_output",
|
|
59
59
|
"filter",
|
|
60
|
-
"redaction"
|
|
60
|
+
"redaction",
|
|
61
|
+
"secret-redaction",
|
|
62
|
+
"output-redaction"
|
|
61
63
|
],
|
|
62
64
|
load: async () => (await import("@spences10/pi-redact")).default
|
|
63
65
|
},
|
|
@@ -137,12 +139,11 @@ const BUILTIN_EXTENSION_REGISTRY = [
|
|
|
137
139
|
cli_flag: "--no-prompt-presets",
|
|
138
140
|
cli_description: "Disable prompt presets extension",
|
|
139
141
|
aliases: [
|
|
140
|
-
"prompt-presets",
|
|
141
142
|
"prompt-preset",
|
|
142
143
|
"preset",
|
|
143
144
|
"presets"
|
|
144
145
|
],
|
|
145
|
-
load: async () => (await import("./prompt-presets-
|
|
146
|
+
load: async () => (await import("./prompt-presets-BAXHRyX0.js")).default
|
|
146
147
|
},
|
|
147
148
|
{
|
|
148
149
|
key: "lsp",
|
|
@@ -230,4 +231,4 @@ const BUILTIN_EXTENSIONS = BUILTIN_EXTENSION_REGISTRY.map(({ load: _load, ...ext
|
|
|
230
231
|
//#endregion
|
|
231
232
|
export { BUILTIN_EXTENSION_REGISTRY as n, BUILTIN_EXTENSIONS as t };
|
|
232
233
|
|
|
233
|
-
//# sourceMappingURL=builtin-registry-
|
|
234
|
+
//# sourceMappingURL=builtin-registry-Dwgexb9N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-registry-Dwgexb9N.js","names":[],"sources":["../src/extensions/builtin-registry.ts"],"sourcesContent":["import type { ExtensionFactory } from '@mariozechner/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: '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: '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: '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: '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 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: '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,aAAa;EACb,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS,CAAC,MAAM;EAChB,MAAM,aAAa,MAAM,OAAO,sBAAsB;EACtD;CACD;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS,CAAC,UAAU,QAAQ;EAC5B,MAAM,aAAa,MAAM,OAAO,yBAAyB;EACzD;CACD;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBA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EACtD;CACD;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS;GAAC;GAAgB;GAAW;GAAY;EACjD,kBAAkB;GACjB,aAAa;IAAC;IAAS;IAAQ;IAAM;GACrC,QACC;GACD;EACD,MAAM,aACJ,MAAM,OAAO,+BAA4B;EAC3C;CACD;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS,CAAC,uBAAuB,UAAU;EAC3C,MAAM,aACJ,MAAM,OAAO,sCAAsC;EACrD;CACD;EACC,KAAK;EACL,OAAO;EACP,YAAY;EACZ,aACC;EACD,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,SAAS,CAAC,oBAAoB,QAAQ;EACtC,MAAM,aACJ,MAAM,OAAO,mCAAgC;EAC/C;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-
|
|
2
|
+
import { t as BUILTIN_EXTENSIONS } from "./builtin-registry-Dwgexb9N.js";
|
|
3
3
|
import { defineCommand, renderUsage, runMain } from "citty";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -115,7 +115,7 @@ MODES
|
|
|
115
115
|
NOTES
|
|
116
116
|
|
|
117
117
|
- In non-interactive modes, my-pi keeps headless-capable built-ins like
|
|
118
|
-
MCP, LSP, prompt presets, recall, nopeek, Omnisearch, SQLite tools, hooks, and
|
|
118
|
+
MCP, LSP, prompt presets, recall, nopeek, Omnisearch, SQLite tools, hooks, and secret redaction.
|
|
119
119
|
- UI-only built-ins like session auto-naming are skipped.
|
|
120
120
|
- Repeat -e / --extension to stack multiple extensions.
|
|
121
121
|
|
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// Extension stacking patterns inspired by https://github.com/disler/pi-vs-claude-code\n\nimport { defineCommand, renderUsage, runMain } from 'citty';\nimport { 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 pkg = JSON.parse(\n\treadFileSync(join(__dirname, '..', 'package.json'), 'utf-8'),\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 output filtering.\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('@mariozechner/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;AACxE,QAAO,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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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// Extension stacking patterns inspired by https://github.com/disler/pi-vs-claude-code\n\nimport { defineCommand, renderUsage, runMain } from 'citty';\nimport { 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 pkg = JSON.parse(\n\treadFileSync(join(__dirname, '..', 'package.json'), 'utf-8'),\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('@mariozechner/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;AACxE,QAAO,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;AAC9C,QAAO,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;AAE/B,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACrC,MAAM,MAAM,KAAK;AACjB,MAAI,CAAC,IAAK;EAEV,MAAM,eAAe,IAAI,QAAQ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AQ,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,MAAM,kBAAkB,sBAAsB,QAAQ,MAAM,IAAI;EAChE,MAAM,iBAAiB,qBAAqB,QAAQ,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EF,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;AAEF,MAAI,iBAAiB,MACpB,OAAM,WAAW,QAAQ;WACf,KAAK,SAAS,KAAK,QAAQ,QAAQ;GAC7C,IAAI,cAA+B;AACnC,OAAI,KAAK,KACR,eAAc;GAEf,MAAM,OAAO,MAAM,aAAa,SAAS;IACxC,MAAM;IACN,gBAAgB,UAAU;IAC1B,eAAe,EAAE;IACjB,UAAU,EAAE;IACZ,CAAC;AACF,WAAQ,KAAK,KAAK;aACR,CAAC,QAAQ,OAAO,MAC1B,OAAM,YAAY,KAAY;MAS9B,OAAM,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;AAC3C,OAAM,YAAY,KAAK,OAAO;GAE/B,CAAC"}
|
|
@@ -957,11 +957,7 @@ async function prompt_presets(pi) {
|
|
|
957
957
|
else toggle_layer(preset.name, ctx);
|
|
958
958
|
}
|
|
959
959
|
};
|
|
960
|
-
for (const command_name of [
|
|
961
|
-
"prompt-preset",
|
|
962
|
-
"prompt-presets",
|
|
963
|
-
"preset"
|
|
964
|
-
]) pi.registerCommand(command_name, prompt_preset_command);
|
|
960
|
+
for (const command_name of ["prompt-preset", "preset"]) pi.registerCommand(command_name, prompt_preset_command);
|
|
965
961
|
pi.on("session_start", async (_event, ctx) => {
|
|
966
962
|
presets = load_prompt_presets(ctx.cwd);
|
|
967
963
|
active_base_name = void 0;
|
|
@@ -1008,4 +1004,4 @@ async function prompt_presets(pi) {
|
|
|
1008
1004
|
//#endregion
|
|
1009
1005
|
export { prompt_presets as default };
|
|
1010
1006
|
|
|
1011
|
-
//# sourceMappingURL=prompt-presets-
|
|
1007
|
+
//# sourceMappingURL=prompt-presets-BAXHRyX0.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-presets-DU1Ds6xx.js","names":[],"sources":["../src/extensions/prompt-presets/catalog.ts","../src/extensions/prompt-presets/defaults.ts","../src/extensions/prompt-presets/footer.ts","../src/extensions/prompt-presets/storage.ts","../src/extensions/prompt-presets/index.ts"],"sourcesContent":["import type {\n\tLoadedPromptPreset,\n\tPromptPresetSource,\n} from './types.js';\n\nexport function get_prompt_source_label(\n\tsource: PromptPresetSource,\n): string {\n\tswitch (source) {\n\t\tcase 'builtin':\n\t\t\treturn 'built-in';\n\t\tcase 'user':\n\t\t\treturn 'user';\n\t\tcase 'project':\n\t\t\treturn 'project';\n\t}\n}\n\nexport function list_base_presets(\n\tpresets: Record<string, LoadedPromptPreset>,\n): LoadedPromptPreset[] {\n\treturn Object.values(presets)\n\t\t.filter((preset) => preset.kind === 'base')\n\t\t.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport function list_layer_presets(\n\tpresets: Record<string, LoadedPromptPreset>,\n): LoadedPromptPreset[] {\n\treturn Object.values(presets)\n\t\t.filter((preset) => preset.kind === 'layer')\n\t\t.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport function format_summary(\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n\tpresets: Record<string, LoadedPromptPreset>,\n): string {\n\tconst lines = [`Base: ${active_base_name ?? '(none)'}`];\n\n\tconst layer_names = [...active_layers].sort();\n\tif (layer_names.length === 0) {\n\t\tlines.push('Layers: (none)');\n\t} else {\n\t\tlines.push('Layers:');\n\t\tfor (const name of layer_names) {\n\t\t\tconst preset = presets[name];\n\t\t\tconst description = preset?.description\n\t\t\t\t? ` — ${preset.description}`\n\t\t\t\t: '';\n\t\t\tlines.push(`- ${name}${description}`);\n\t\t}\n\t}\n\n\treturn lines.join('\\n');\n}\n\nexport function format_active_details(\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n\tpresets: Record<string, LoadedPromptPreset>,\n): string {\n\tconst parts: string[] = [];\n\n\tif (active_base_name) {\n\t\tconst base = presets[active_base_name];\n\t\tif (base) {\n\t\t\tparts.push(`Base: ${base.name}`);\n\t\t\tif (base.description)\n\t\t\t\tparts.push(`Description: ${base.description}`);\n\t\t\tparts.push(`Source: ${get_prompt_source_label(base.source)}`);\n\t\t\tparts.push('', base.instructions.trim());\n\t\t}\n\t}\n\n\tconst layer_names = [...active_layers].sort();\n\tif (layer_names.length > 0) {\n\t\tif (parts.length > 0) parts.push('', '---', '');\n\t\tparts.push('Layers:');\n\t\tfor (const name of layer_names) {\n\t\t\tconst layer = presets[name];\n\t\t\tif (!layer) continue;\n\t\t\tparts.push(\n\t\t\t\t`- ${layer.name} (${get_prompt_source_label(layer.source)})`,\n\t\t\t);\n\t\t\tif (layer.description) parts.push(` ${layer.description}`);\n\t\t}\n\t}\n\n\treturn parts.join('\\n') || 'No preset or layers active';\n}\n","import type { PromptPresetMap } from './types.js';\n\nexport const DEFAULT_BASE_PROMPT_PRESET_NAME = 'terse';\n\nexport const DEFAULT_PROMPT_PRESETS: PromptPresetMap = {\n\tterse: {\n\t\tkind: 'base',\n\t\tdescription: 'Short, direct, no fluff',\n\t\tinstructions:\n\t\t\t\"Be concise and direct. Default to the shortest response that fully solves the user's request. Use at most one short paragraph or 3 bullets unless the user explicitly asks for detail. For implementation reports, include only what changed, validation, and the next step if relevant. No purple prose, no filler, no repetitive caveats.\",\n\t},\n\tstandard: {\n\t\tkind: 'base',\n\t\tdescription: 'Clear and concise with key context',\n\t\tinstructions:\n\t\t\t'Be clear, direct, and concise. Include only the reasoning and implementation details that matter. Avoid filler, grandstanding, and ornamental language. Use bullets when they improve scanability.',\n\t},\n\tdetailed: {\n\t\tkind: 'base',\n\t\tdescription: 'More explanation when nuance matters',\n\t\tinstructions:\n\t\t\t'Be thorough when the task is complex or tradeoffs matter, but stay practical. Explain only the details that help the user decide, verify, or implement. Avoid purple prose and unnecessary scene-setting.',\n\t},\n\t'no-purple-prose': {\n\t\tkind: 'layer',\n\t\tdescription: 'Strip out ornamental language',\n\t\tinstructions:\n\t\t\t'Do not use purple prose, flourish, motivational filler, or theatrical transitions. Prefer plain language and concrete statements.',\n\t},\n\tbullets: {\n\t\tkind: 'layer',\n\t\tdescription: 'Prefer short bullets when useful',\n\t\tinstructions:\n\t\t\t'When presenting options, findings, or steps, prefer short bullet lists over long paragraphs.',\n\t},\n\t'clarify-first': {\n\t\tkind: 'layer',\n\t\tdescription:\n\t\t\t'Ask brief clarifying questions when requirements are ambiguous',\n\t\tinstructions:\n\t\t\t'If the request is materially ambiguous, ask the minimum clarifying question(s) needed before proceeding. Do not ask unnecessary questions.',\n\t},\n\t'include-risks': {\n\t\tkind: 'layer',\n\t\tdescription: 'Call out notable risks or tradeoffs',\n\t\tinstructions:\n\t\t\t'When making a recommendation or implementation plan, briefly mention the key risk, tradeoff, or caveat if one materially matters.',\n\t},\n};\n","import {\n\tclampThinkingLevel,\n\tgetSupportedThinkingLevels,\n\ttype ModelThinkingLevel,\n} from '@mariozechner/pi-ai';\nimport type {\n\tExtensionContext,\n\tReadonlyFooterDataProvider,\n} from '@mariozechner/pi-coding-agent';\nimport { truncateToWidth, visibleWidth } from '@mariozechner/pi-tui';\n\nfunction get_footer_prompt_status(\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): string | undefined {\n\tif (!active_base_name && active_layers.size === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst label = active_base_name ?? 'none';\n\tconst layer_suffix =\n\t\tactive_layers.size > 0 ? ` +${active_layers.size}` : '';\n\treturn `prompt:${label}${layer_suffix}`;\n}\n\nfunction sanitize_status_text(text: string): string {\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, ' ')\n\t\t.replace(/ +/g, ' ')\n\t\t.trim();\n}\n\nfunction format_token_count(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\nexport function render_footer_status_line(\n\ttheme: ExtensionContext['ui']['theme'],\n\twidth: number,\n\tleft_items: string[],\n\tright_item?: string,\n): string | undefined {\n\tconst left = sanitize_status_text(left_items.join(' '));\n\tconst right = right_item ? sanitize_status_text(right_item) : '';\n\tif (!left && !right) return undefined;\n\tif (!right) {\n\t\treturn truncateToWidth(\n\t\t\ttheme.fg('dim', left),\n\t\t\twidth,\n\t\t\ttheme.fg('dim', '...'),\n\t\t);\n\t}\n\tif (!left) {\n\t\tconst themed_right = theme.fg('dim', right);\n\t\tconst right_width = visibleWidth(themed_right);\n\t\treturn right_width >= width\n\t\t\t? truncateToWidth(themed_right, width, theme.fg('dim', '...'))\n\t\t\t: `${' '.repeat(width - right_width)}${themed_right}`;\n\t}\n\n\tconst right_width = visibleWidth(right);\n\tif (right_width >= width) {\n\t\treturn truncateToWidth(\n\t\t\ttheme.fg('dim', right),\n\t\t\twidth,\n\t\t\ttheme.fg('dim', '...'),\n\t\t);\n\t}\n\n\tconst min_gap = 1;\n\tconst available_left = Math.max(0, width - right_width - min_gap);\n\tconst truncated_left = truncateToWidth(left, available_left, '...');\n\tconst left_width = visibleWidth(truncated_left);\n\tconst gap = Math.max(min_gap, width - left_width - right_width);\n\treturn (\n\t\ttheme.fg('dim', truncated_left) +\n\t\t' '.repeat(gap) +\n\t\ttheme.fg('dim', right)\n\t);\n}\n\nconst VALID_THINKING_LEVELS = new Set<ModelThinkingLevel>([\n\t'off',\n\t'minimal',\n\t'low',\n\t'medium',\n\t'high',\n\t'xhigh',\n]);\n\nfunction is_model_thinking_level(\n\tlevel: string,\n): level is ModelThinkingLevel {\n\treturn VALID_THINKING_LEVELS.has(level as ModelThinkingLevel);\n}\n\nexport function get_default_footer_thinking_level(\n\tmodel: ExtensionContext['model'],\n): ModelThinkingLevel {\n\tif (!model?.reasoning) return 'off';\n\treturn clampThinkingLevel(model, 'medium');\n}\n\nexport function get_current_thinking_level(\n\tctx: Pick<ExtensionContext, 'model' | 'sessionManager'>,\n): ModelThinkingLevel {\n\tconst entries = ctx.sessionManager.getEntries();\n\tfor (let i = entries.length - 1; i >= 0; i--) {\n\t\tconst entry = entries[i] as {\n\t\t\ttype?: string;\n\t\t\tthinkingLevel?: string;\n\t\t};\n\t\tif (\n\t\t\tentry.type === 'thinking_level_change' &&\n\t\t\ttypeof entry.thinkingLevel === 'string' &&\n\t\t\tis_model_thinking_level(entry.thinkingLevel)\n\t\t) {\n\t\t\tif (!ctx.model?.reasoning) return 'off';\n\t\t\treturn getSupportedThinkingLevels(ctx.model).includes(\n\t\t\t\tentry.thinkingLevel,\n\t\t\t)\n\t\t\t\t? entry.thinkingLevel\n\t\t\t\t: clampThinkingLevel(ctx.model, entry.thinkingLevel);\n\t\t}\n\t}\n\treturn get_default_footer_thinking_level(ctx.model);\n}\n\nfunction render_footer_lines(\n\tctx: ExtensionContext,\n\ttheme: ExtensionContext['ui']['theme'],\n\tfooter_data: ReadonlyFooterDataProvider,\n\twidth: number,\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): string[] {\n\tlet total_input = 0;\n\tlet total_output = 0;\n\tlet total_cache_read = 0;\n\tlet total_cache_write = 0;\n\tlet total_cost = 0;\n\tfor (const entry of ctx.sessionManager.getEntries()) {\n\t\tif (\n\t\t\tentry.type === 'message' &&\n\t\t\tentry.message.role === 'assistant'\n\t\t) {\n\t\t\ttotal_input += entry.message.usage.input;\n\t\t\ttotal_output += entry.message.usage.output;\n\t\t\ttotal_cache_read += entry.message.usage.cacheRead;\n\t\t\ttotal_cache_write += entry.message.usage.cacheWrite;\n\t\t\ttotal_cost += entry.message.usage.cost.total;\n\t\t}\n\t}\n\n\tconst context_usage = ctx.getContextUsage();\n\tconst context_window =\n\t\tcontext_usage?.contextWindow ?? ctx.model?.contextWindow ?? 0;\n\tconst context_percent_value = context_usage?.percent ?? 0;\n\tconst context_percent =\n\t\tcontext_usage?.percent !== null\n\t\t\t? context_percent_value.toFixed(1)\n\t\t\t: '?';\n\n\tlet pwd = ctx.cwd;\n\tconst home = process.env.HOME || process.env.USERPROFILE;\n\tif (home && pwd.startsWith(home)) {\n\t\tpwd = `~${pwd.slice(home.length)}`;\n\t}\n\n\tconst branch = footer_data.getGitBranch();\n\tif (branch) {\n\t\tpwd = `${pwd} (${branch})`;\n\t}\n\n\tconst session_name = ctx.sessionManager.getSessionName();\n\tif (session_name) {\n\t\tpwd = `${pwd} • ${session_name}`;\n\t}\n\n\tconst stats_parts: string[] = [];\n\tif (total_input)\n\t\tstats_parts.push(`↑${format_token_count(total_input)}`);\n\tif (total_output)\n\t\tstats_parts.push(`↓${format_token_count(total_output)}`);\n\tif (total_cache_read)\n\t\tstats_parts.push(`R${format_token_count(total_cache_read)}`);\n\tif (total_cache_write)\n\t\tstats_parts.push(`W${format_token_count(total_cache_write)}`);\n\n\tconst using_subscription = ctx.model\n\t\t? ctx.modelRegistry.isUsingOAuth(ctx.model)\n\t\t: false;\n\tif (total_cost || using_subscription) {\n\t\tstats_parts.push(\n\t\t\t`$${total_cost.toFixed(3)}${using_subscription ? ' (sub)' : ''}`,\n\t\t);\n\t}\n\n\tconst context_percent_display =\n\t\tcontext_percent === '?'\n\t\t\t? `?/${format_token_count(context_window)}`\n\t\t\t: `${context_percent}%/${format_token_count(context_window)}`;\n\tlet context_percent_str = context_percent_display;\n\tif (context_percent_value > 90) {\n\t\tcontext_percent_str = theme.fg('error', context_percent_display);\n\t} else if (context_percent_value > 70) {\n\t\tcontext_percent_str = theme.fg(\n\t\t\t'warning',\n\t\t\tcontext_percent_display,\n\t\t);\n\t}\n\tstats_parts.push(context_percent_str);\n\n\tlet stats_left = stats_parts.join(' ');\n\tlet stats_left_width = visibleWidth(stats_left);\n\tif (stats_left_width > width) {\n\t\tstats_left = truncateToWidth(stats_left, width, '...');\n\t\tstats_left_width = visibleWidth(stats_left);\n\t}\n\n\tconst model_name = ctx.model?.id || 'no-model';\n\tconst thinking_level = get_current_thinking_level(ctx);\n\tlet right_side_without_provider = model_name;\n\tif (ctx.model?.reasoning) {\n\t\tright_side_without_provider =\n\t\t\tthinking_level === 'off'\n\t\t\t\t? `${model_name} • thinking off`\n\t\t\t\t: `${model_name} • ${thinking_level}`;\n\t}\n\n\tlet right_side = right_side_without_provider;\n\tif (footer_data.getAvailableProviderCount() > 1 && ctx.model) {\n\t\tright_side = `(${ctx.model.provider}) ${right_side_without_provider}`;\n\t\tif (stats_left_width + 2 + visibleWidth(right_side) > width) {\n\t\t\tright_side = right_side_without_provider;\n\t\t}\n\t}\n\n\tconst right_side_width = visibleWidth(right_side);\n\tconst total_needed = stats_left_width + 2 + right_side_width;\n\tlet stats_line: string;\n\tif (total_needed <= width) {\n\t\tconst padding = ' '.repeat(\n\t\t\twidth - stats_left_width - right_side_width,\n\t\t);\n\t\tstats_line = stats_left + padding + right_side;\n\t} else {\n\t\tconst available_for_right = width - stats_left_width - 2;\n\t\tif (available_for_right > 0) {\n\t\t\tconst truncated_right = truncateToWidth(\n\t\t\t\tright_side,\n\t\t\t\tavailable_for_right,\n\t\t\t\t'',\n\t\t\t);\n\t\t\tconst truncated_right_width = visibleWidth(truncated_right);\n\t\t\tconst padding = ' '.repeat(\n\t\t\t\tMath.max(0, width - stats_left_width - truncated_right_width),\n\t\t\t);\n\t\t\tstats_line = stats_left + padding + truncated_right;\n\t\t} else {\n\t\t\tstats_line = stats_left;\n\t\t}\n\t}\n\n\tconst dim_stats_left = theme.fg('dim', stats_left);\n\tconst remainder = stats_line.slice(stats_left.length);\n\tconst dim_remainder = theme.fg('dim', remainder);\n\tconst lines = [\n\t\ttruncateToWidth(\n\t\t\ttheme.fg('dim', pwd),\n\t\t\twidth,\n\t\t\ttheme.fg('dim', '...'),\n\t\t),\n\t\tdim_stats_left + dim_remainder,\n\t];\n\n\tconst prompt_status = get_footer_prompt_status(\n\t\tactive_base_name,\n\t\tactive_layers,\n\t);\n\n\tconst other_statuses = Array.from(\n\t\tfooter_data.getExtensionStatuses().entries(),\n\t)\n\t\t.filter(([key]) => key !== 'preset')\n\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t.map(([, text]) => sanitize_status_text(text));\n\tconst combined_status_line = render_footer_status_line(\n\t\ttheme,\n\t\twidth,\n\t\tother_statuses,\n\t\tprompt_status,\n\t);\n\tif (combined_status_line) {\n\t\tlines.push(combined_status_line);\n\t}\n\n\treturn lines;\n}\n\nexport function set_status(\n\tctx: ExtensionContext,\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): void {\n\tctx.ui.setStatus('preset', undefined);\n\tif (!ctx.hasUI) return;\n\tctx.ui.setFooter((tui, theme, footer_data) => {\n\t\tconst unsubscribe = footer_data.onBranchChange(() =>\n\t\t\ttui.requestRender(),\n\t\t);\n\t\treturn {\n\t\t\tdispose: unsubscribe,\n\t\t\tinvalidate() {},\n\t\t\trender(width: number) {\n\t\t\t\treturn render_footer_lines(\n\t\t\t\t\tctx,\n\t\t\t\t\ttheme,\n\t\t\t\t\tfooter_data,\n\t\t\t\t\twidth,\n\t\t\t\t\tactive_base_name,\n\t\t\t\t\tactive_layers,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t});\n}\n","import { getAgentDir } from '@mariozechner/pi-coding-agent';\nimport {\n\texistsSync,\n\tmkdirSync,\n\treaddirSync,\n\treadFileSync,\n\trenameSync,\n\tunlinkSync,\n\twriteFileSync,\n} from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { DEFAULT_PROMPT_PRESETS } from './defaults.js';\nimport type {\n\tLoadedPromptPreset,\n\tPromptPreset,\n\tPromptPresetMap,\n\tPromptPresetSource,\n\tPromptPresetState,\n} from './types.js';\n\nconst PROJECT_PROMPT_PRESETS_ENV = 'MY_PI_PROMPT_PRESETS_PROJECT';\n\ninterface PersistedPromptPresetStates {\n\tversion: number;\n\tprojects: Record<string, PromptPresetState>;\n}\n\nexport function normalize_prompt_presets(\n\tinput: unknown,\n): PromptPresetMap {\n\tif (!input || typeof input !== 'object') return {};\n\n\tconst normalized: PromptPresetMap = {};\n\tfor (const [raw_name, raw_value] of Object.entries(input)) {\n\t\tconst name = raw_name.trim();\n\t\tif (!name) continue;\n\n\t\tif (typeof raw_value === 'string') {\n\t\t\tnormalized[name] = {\n\t\t\t\tkind: 'base',\n\t\t\t\tinstructions: raw_value,\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!raw_value || typeof raw_value !== 'object') continue;\n\t\tconst candidate = raw_value as {\n\t\t\tkind?: unknown;\n\t\t\tdescription?: unknown;\n\t\t\tinstructions?: unknown;\n\t\t};\n\t\tif (typeof candidate.instructions !== 'string') continue;\n\n\t\tnormalized[name] = {\n\t\t\tinstructions: candidate.instructions,\n\t\t\t...(candidate.kind === 'layer'\n\t\t\t\t? { kind: 'layer' as const }\n\t\t\t\t: {}),\n\t\t\t...(typeof candidate.description === 'string'\n\t\t\t\t? { description: candidate.description }\n\t\t\t\t: {}),\n\t\t};\n\t}\n\n\treturn normalized;\n}\n\nexport function merge_prompt_presets(\n\t...sources: PromptPresetMap[]\n): PromptPresetMap {\n\treturn Object.assign({}, ...sources);\n}\n\nfunction to_loaded_prompt_presets(\n\tpresets: PromptPresetMap,\n\tsource: PromptPresetSource,\n): Record<string, LoadedPromptPreset> {\n\treturn Object.fromEntries(\n\t\tObject.entries(presets).map(([name, preset]) => [\n\t\t\tname,\n\t\t\t{\n\t\t\t\tname,\n\t\t\t\tkind: preset.kind === 'layer' ? 'layer' : 'base',\n\t\t\t\tsource,\n\t\t\t\t...preset,\n\t\t\t},\n\t\t]),\n\t);\n}\n\nfunction get_global_presets_path(): string {\n\treturn join(getAgentDir(), 'presets.json');\n}\n\nfunction get_project_presets_path(cwd: string): string {\n\treturn join(cwd, '.pi', 'presets.json');\n}\n\nexport function get_global_presets_dir(): string {\n\treturn join(getAgentDir(), 'presets');\n}\n\nexport function get_project_presets_dir(cwd: string): string {\n\treturn join(cwd, '.pi', 'presets');\n}\n\nfunction sanitize_prompt_preset_file_name(name: string): string {\n\tconst sanitized = name\n\t\t.trim()\n\t\t.replace(/[\\\\/:*?\"<>|]/g, '-')\n\t\t.replace(/^\\.+$/, '')\n\t\t.replace(/^\\.+/, '')\n\t\t.replace(/\\.+$/, '');\n\tif (!sanitized) {\n\t\tthrow new Error(\n\t\t\t'Prompt preset name must contain a file-safe character',\n\t\t);\n\t}\n\treturn sanitized;\n}\n\nexport function get_prompt_preset_file_path(\n\tdir: string,\n\tname: string,\n): string {\n\treturn join(dir, `${sanitize_prompt_preset_file_name(name)}.md`);\n}\n\nfunction get_persisted_prompt_state_path(): string {\n\treturn join(getAgentDir(), 'prompt-preset-state.json');\n}\n\nfunction read_prompt_presets_file(path: string): PromptPresetMap {\n\tif (!existsSync(path)) return {};\n\n\ttry {\n\t\treturn normalize_prompt_presets(\n\t\t\tJSON.parse(readFileSync(path, 'utf-8')),\n\t\t);\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction unquote_frontmatter_value(value: string): string {\n\tconst trimmed = value.trim();\n\tif (trimmed.startsWith('\"') && trimmed.endsWith('\"')) {\n\t\ttry {\n\t\t\treturn JSON.parse(trimmed) as string;\n\t\t} catch {\n\t\t\treturn trimmed.slice(1, -1);\n\t\t}\n\t}\n\tif (trimmed.startsWith(\"'\") && trimmed.endsWith(\"'\")) {\n\t\treturn trimmed.slice(1, -1);\n\t}\n\treturn trimmed;\n}\n\nfunction parse_prompt_preset_markdown(content: string): {\n\tmetadata: Record<string, string>;\n\tbody: string;\n} {\n\tconst normalized = content.replace(/\\r\\n/g, '\\n');\n\tif (!normalized.startsWith('---\\n')) {\n\t\treturn { metadata: {}, body: normalized.trim() };\n\t}\n\n\tconst lines = normalized.split('\\n');\n\tconst end = lines.findIndex(\n\t\t(line, index) => index > 0 && line.trim() === '---',\n\t);\n\tif (end === -1) {\n\t\treturn { metadata: {}, body: normalized.trim() };\n\t}\n\n\tconst metadata: Record<string, string> = {};\n\tfor (const line of lines.slice(1, end)) {\n\t\tconst separator = line.indexOf(':');\n\t\tif (separator === -1) continue;\n\t\tconst key = line.slice(0, separator).trim().toLowerCase();\n\t\tconst value = line.slice(separator + 1).trim();\n\t\tif (!key) continue;\n\t\tmetadata[key] = unquote_frontmatter_value(value);\n\t}\n\n\treturn {\n\t\tmetadata,\n\t\tbody: lines\n\t\t\t.slice(end + 1)\n\t\t\t.join('\\n')\n\t\t\t.trim(),\n\t};\n}\n\nexport function read_prompt_presets_dir(\n\tpath: string,\n): PromptPresetMap {\n\tif (!existsSync(path)) return {};\n\n\ttry {\n\t\tconst presets: PromptPresetMap = {};\n\t\tfor (const entry of readdirSync(path, { withFileTypes: true })\n\t\t\t.filter((item) => item.isFile() && item.name.endsWith('.md'))\n\t\t\t.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tconst name = entry.name.slice(0, -3).trim();\n\t\t\tif (!name) continue;\n\t\t\tconst { metadata, body } = parse_prompt_preset_markdown(\n\t\t\t\treadFileSync(join(path, entry.name), 'utf-8'),\n\t\t\t);\n\t\t\tif (!body) continue;\n\t\t\tpresets[name] = {\n\t\t\t\tkind: metadata.kind === 'layer' ? 'layer' : 'base',\n\t\t\t\tinstructions: body,\n\t\t\t\t...(metadata.description\n\t\t\t\t\t? { description: metadata.description }\n\t\t\t\t\t: {}),\n\t\t\t};\n\t\t}\n\t\treturn presets;\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction format_prompt_preset_markdown(preset: PromptPreset): string {\n\tconst lines = [\n\t\t'---',\n\t\t`kind: ${preset.kind === 'layer' ? 'layer' : 'base'}`,\n\t];\n\tif (preset.description?.trim()) {\n\t\tlines.push(\n\t\t\t`description: ${JSON.stringify(preset.description.trim())}`,\n\t\t);\n\t}\n\tlines.push('---', '', preset.instructions.trim(), '');\n\treturn lines.join('\\n');\n}\n\nexport function save_prompt_preset_file(\n\tdir: string,\n\tname: string,\n\tpreset: PromptPreset,\n): string {\n\tif (!existsSync(dir)) {\n\t\tmkdirSync(dir, { recursive: true, mode: 0o700 });\n\t}\n\n\tconst path = get_prompt_preset_file_path(dir, name);\n\tconst tmp = `${path}.tmp-${Date.now()}`;\n\twriteFileSync(tmp, format_prompt_preset_markdown(preset), {\n\t\tmode: 0o600,\n\t});\n\trenameSync(tmp, path);\n\treturn path;\n}\n\nexport function save_project_prompt_preset_file(\n\tcwd: string,\n\tname: string,\n\tpreset: PromptPreset,\n): string {\n\treturn save_prompt_preset_file(\n\t\tget_project_presets_dir(cwd),\n\t\tname,\n\t\tpreset,\n\t);\n}\n\nexport function save_global_prompt_preset_file(\n\tname: string,\n\tpreset: PromptPreset,\n): string {\n\treturn save_prompt_preset_file(\n\t\tget_global_presets_dir(),\n\t\tname,\n\t\tpreset,\n\t);\n}\n\nfunction should_load_project_prompt_presets(): boolean {\n\tconst normalized = process.env[PROJECT_PROMPT_PRESETS_ENV]\n\t\t?.trim()\n\t\t.toLowerCase();\n\treturn !['0', 'false', 'no', 'skip', 'disable'].includes(\n\t\tnormalized ?? '',\n\t);\n}\n\nexport function load_prompt_presets(\n\tcwd: string,\n): Record<string, LoadedPromptPreset> {\n\treturn Object.assign(\n\t\t{},\n\t\tto_loaded_prompt_presets(DEFAULT_PROMPT_PRESETS, 'builtin'),\n\t\tto_loaded_prompt_presets(\n\t\t\tread_prompt_presets_file(get_global_presets_path()),\n\t\t\t'user',\n\t\t),\n\t\tto_loaded_prompt_presets(\n\t\t\tread_prompt_presets_dir(get_global_presets_dir()),\n\t\t\t'user',\n\t\t),\n\t\t...(should_load_project_prompt_presets()\n\t\t\t? [\n\t\t\t\t\tto_loaded_prompt_presets(\n\t\t\t\t\t\tread_prompt_presets_file(get_project_presets_path(cwd)),\n\t\t\t\t\t\t'project',\n\t\t\t\t\t),\n\t\t\t\t\tto_loaded_prompt_presets(\n\t\t\t\t\t\tread_prompt_presets_dir(get_project_presets_dir(cwd)),\n\t\t\t\t\t\t'project',\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t: []),\n\t);\n}\n\nfunction sort_prompt_presets(\n\tpresets: PromptPresetMap,\n): PromptPresetMap {\n\treturn Object.fromEntries(\n\t\tObject.entries(presets).sort(([a], [b]) => a.localeCompare(b)),\n\t);\n}\n\nexport function save_project_prompt_presets(\n\tcwd: string,\n\tpresets: PromptPresetMap,\n): string {\n\tconst path = get_project_presets_path(cwd);\n\tconst dir = dirname(path);\n\tif (!existsSync(dir)) {\n\t\tmkdirSync(dir, { recursive: true, mode: 0o700 });\n\t}\n\n\tconst tmp = `${path}.tmp-${Date.now()}`;\n\twriteFileSync(\n\t\ttmp,\n\t\tJSON.stringify(sort_prompt_presets(presets), null, '\\t') + '\\n',\n\t\t{ mode: 0o600 },\n\t);\n\trenameSync(tmp, path);\n\treturn path;\n}\n\nexport function remove_project_prompt_preset(\n\tcwd: string,\n\tname: string,\n): {\n\tremoved: boolean;\n\tpath: string;\n\tremaining: number;\n} {\n\tconst json_path = get_project_presets_path(cwd);\n\tconst project_presets = read_prompt_presets_file(json_path);\n\tlet removed = false;\n\tlet removed_path = json_path;\n\n\tif (name in project_presets) {\n\t\tdelete project_presets[name];\n\t\tremoved = true;\n\t\tremoved_path = json_path;\n\t\tif (Object.keys(project_presets).length === 0) {\n\t\t\tif (existsSync(json_path)) {\n\t\t\t\tunlinkSync(json_path);\n\t\t\t}\n\t\t} else {\n\t\t\tsave_project_prompt_presets(cwd, project_presets);\n\t\t}\n\t}\n\n\tconst file_path = get_prompt_preset_file_path(\n\t\tget_project_presets_dir(cwd),\n\t\tname,\n\t);\n\tif (existsSync(file_path)) {\n\t\tunlinkSync(file_path);\n\t\tremoved = true;\n\t\tremoved_path = file_path;\n\t}\n\n\tconst remaining =\n\t\tObject.keys(read_prompt_presets_file(json_path)).length +\n\t\tObject.keys(read_prompt_presets_dir(get_project_presets_dir(cwd)))\n\t\t\t.length;\n\n\treturn { removed, path: removed_path, remaining };\n}\n\nfunction normalize_prompt_preset_state(\n\tinput: unknown,\n): PromptPresetState | undefined {\n\tif (!input || typeof input !== 'object') return undefined;\n\n\tconst candidate = input as {\n\t\tbase_name?: unknown;\n\t\tlayer_names?: unknown;\n\t};\n\tconst base_name =\n\t\ttypeof candidate.base_name === 'string' &&\n\t\tcandidate.base_name.trim()\n\t\t\t? candidate.base_name.trim()\n\t\t\t: null;\n\tconst layer_names = Array.isArray(candidate.layer_names)\n\t\t? [\n\t\t\t\t...new Set(\n\t\t\t\t\tcandidate.layer_names\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t(value): value is string =>\n\t\t\t\t\t\t\t\ttypeof value === 'string' && value.trim().length > 0,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.map((value) => value.trim()),\n\t\t\t\t),\n\t\t\t].sort()\n\t\t: [];\n\n\treturn {\n\t\tbase_name,\n\t\tlayer_names,\n\t};\n}\n\nfunction read_persisted_prompt_states(\n\tpath = get_persisted_prompt_state_path(),\n): PersistedPromptPresetStates {\n\tif (!existsSync(path)) {\n\t\treturn { version: 1, projects: {} };\n\t}\n\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(path, 'utf-8')) as {\n\t\t\tversion?: unknown;\n\t\t\tprojects?: unknown;\n\t\t};\n\t\tconst raw_projects =\n\t\t\tparsed.projects && typeof parsed.projects === 'object'\n\t\t\t\t? parsed.projects\n\t\t\t\t: {};\n\t\tconst projects: Record<string, PromptPresetState> = {};\n\t\tfor (const [cwd, value] of Object.entries(raw_projects)) {\n\t\t\tconst normalized = normalize_prompt_preset_state(value);\n\t\t\tif (!normalized) continue;\n\t\t\tprojects[cwd] = normalized;\n\t\t}\n\t\treturn {\n\t\t\tversion:\n\t\t\t\ttypeof parsed.version === 'number' ? parsed.version : 1,\n\t\t\tprojects,\n\t\t};\n\t} catch {\n\t\treturn { version: 1, projects: {} };\n\t}\n}\n\nexport function load_persisted_prompt_state(\n\tcwd: string,\n\tpath = get_persisted_prompt_state_path(),\n): PromptPresetState | undefined {\n\treturn read_persisted_prompt_states(path).projects[cwd];\n}\n\nexport function save_persisted_prompt_state(\n\tcwd: string,\n\tstate: PromptPresetState,\n\tpath = get_persisted_prompt_state_path(),\n): string {\n\tconst persisted = read_persisted_prompt_states(path);\n\tpersisted.projects[cwd] = normalize_prompt_preset_state(state) ?? {\n\t\tbase_name: null,\n\t\tlayer_names: [],\n\t};\n\n\tconst dir = dirname(path);\n\tif (!existsSync(dir)) {\n\t\tmkdirSync(dir, { recursive: true, mode: 0o700 });\n\t}\n\n\tconst tmp = `${path}.tmp-${Date.now()}`;\n\twriteFileSync(\n\t\ttmp,\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tversion: 1,\n\t\t\t\tprojects: Object.fromEntries(\n\t\t\t\t\tObject.entries(persisted.projects).sort(([a], [b]) =>\n\t\t\t\t\t\ta.localeCompare(b),\n\t\t\t\t\t),\n\t\t\t\t),\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\trenameSync(tmp, path);\n\treturn path;\n}\n","import {\n\ttype ExtensionAPI,\n\ttype ExtensionCommandContext,\n\ttype ExtensionContext,\n} from '@mariozechner/pi-coding-agent';\nimport type { SettingItem } from '@mariozechner/pi-tui';\nimport { show_settings_modal } from '@spences10/pi-tui-modal';\nimport { existsSync } from 'node:fs';\nimport {\n\tformat_active_details,\n\tformat_summary,\n\tget_prompt_source_label,\n\tlist_base_presets,\n\tlist_layer_presets,\n} from './catalog.js';\nimport {\n\tDEFAULT_BASE_PROMPT_PRESET_NAME,\n\tDEFAULT_PROMPT_PRESETS,\n} from './defaults.js';\nimport { set_status } from './footer.js';\nimport {\n\tget_global_presets_dir,\n\tget_project_presets_dir,\n\tget_prompt_preset_file_path,\n\tload_persisted_prompt_state,\n\tload_prompt_presets,\n\tremove_project_prompt_preset,\n\tsave_global_prompt_preset_file,\n\tsave_persisted_prompt_state,\n\tsave_project_prompt_preset_file,\n\tsave_prompt_preset_file,\n} from './storage.js';\nimport type {\n\tLoadedPromptPreset,\n\tPromptPresetKind,\n\tPromptPresetState,\n} from './types.js';\n\nexport {\n\tDEFAULT_BASE_PROMPT_PRESET_NAME,\n\tDEFAULT_PROMPT_PRESETS,\n} from './defaults.js';\nexport {\n\tget_current_thinking_level,\n\tget_default_footer_thinking_level,\n\trender_footer_status_line,\n} from './footer.js';\nexport {\n\tload_persisted_prompt_state,\n\tload_prompt_presets,\n\tmerge_prompt_presets,\n\tnormalize_prompt_presets,\n\tread_prompt_presets_dir,\n\tremove_project_prompt_preset,\n\tsave_persisted_prompt_state,\n\tsave_project_prompt_presets,\n\tsave_prompt_preset_file,\n} from './storage.js';\nexport type {\n\tLoadedPromptPreset,\n\tPromptPreset,\n\tPromptPresetKind,\n\tPromptPresetMap,\n\tPromptPresetSource,\n\tPromptPresetState,\n} from './types.js';\n\nconst PRESET_STATE_TYPE = 'prompt-preset-state';\nconst ENABLED = '● enabled';\nconst DISABLED = '○ disabled';\nconst SELECTED = '● selected';\nconst UNSELECTED = '○';\nconst NONE_BASE_ID = '__base_none__';\n\nfunction get_last_preset_state(\n\tctx: ExtensionContext,\n): PromptPresetState | undefined {\n\tconst entries = ctx.sessionManager.getEntries();\n\tfor (let i = entries.length - 1; i >= 0; i--) {\n\t\tconst entry = entries[i] as {\n\t\t\ttype?: string;\n\t\t\tcustomType?: string;\n\t\t\tdata?: PromptPresetState;\n\t\t};\n\t\tif (\n\t\t\tentry.type === 'custom' &&\n\t\t\tentry.customType === PRESET_STATE_TYPE &&\n\t\t\tentry.data\n\t\t) {\n\t\t\treturn entry.data;\n\t\t}\n\t}\n\treturn undefined;\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 persist_state(\n\tpi: ExtensionAPI,\n\tctx: ExtensionContext,\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): void {\n\tconst state = {\n\t\tbase_name: active_base_name ?? null,\n\t\tlayer_names: [...active_layers].sort(),\n\t};\n\tpi.appendEntry(PRESET_STATE_TYPE, state);\n\tsave_persisted_prompt_state(ctx.cwd, state);\n}\n\nfunction normalize_active_state(\n\tpresets: Record<string, LoadedPromptPreset>,\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): {\n\tactive_base_name: string | undefined;\n\tactive_layers: Set<string>;\n} {\n\tconst next_base_name =\n\t\tactive_base_name && presets[active_base_name]?.kind === 'base'\n\t\t\t? active_base_name\n\t\t\t: undefined;\n\tconst next_layers = new Set(\n\t\t[...active_layers].filter(\n\t\t\t(name) => presets[name]?.kind === 'layer',\n\t\t),\n\t);\n\treturn {\n\t\tactive_base_name: next_base_name,\n\t\tactive_layers: next_layers,\n\t};\n}\n\nfunction parse_preset_flag(flag: string): string[] {\n\treturn flag\n\t\t.split(',')\n\t\t.map((item) => item.trim())\n\t\t.filter(Boolean);\n}\n\nfunction is_subcommand(command: string): boolean {\n\treturn [\n\t\t'help',\n\t\t'list',\n\t\t'show',\n\t\t'clear',\n\t\t'edit',\n\t\t'edit-global',\n\t\t'export-defaults',\n\t\t'delete',\n\t\t'reset',\n\t\t'reload',\n\t\t'base',\n\t\t'enable',\n\t\t'disable',\n\t\t'toggle',\n\t].includes(command);\n}\n\nfunction format_prompt_preset_help(): string {\n\treturn `Prompt presets append instructions to the system prompt.\n\nCommands:\n- /prompt-preset Open the preset picker\n- /prompt-preset show Show the active base and layers\n- /prompt-preset <name> Activate a base preset or toggle a layer\n- /prompt-preset base <name> Activate a base preset\n- /prompt-preset enable <layer> Enable a layer\n- /prompt-preset disable <layer> Disable a layer\n- /prompt-preset edit <name> Edit/create .pi/presets/<name>.md\n- /prompt-preset edit-global <name> Edit/create ~/.pi/agent/presets/<name>.md\n- /prompt-preset export-defaults Export built-ins to ~/.pi/agent/presets/*.md\n- /prompt-preset export-defaults project Export built-ins to .pi/presets/*.md\n- /prompt-preset reload Reload presets after manual file edits\n- /prompt-preset clear Clear active base and layers\n\nExamples:\n- /prompt-preset export-defaults\n- /prompt-preset edit-global terse\n- /prompt-preset base detailed\n- /prompt-preset enable bullets\n- /prompt-preset show\n\nAlias: /preset`;\n}\n\nexport default async function prompt_presets(pi: ExtensionAPI) {\n\tlet presets: Record<string, LoadedPromptPreset> = {};\n\tlet active_base_name: string | undefined;\n\tlet active_layers = new Set<string>();\n\n\tfunction get_base(\n\t\tname: string | undefined,\n\t): LoadedPromptPreset | undefined {\n\t\treturn name ? presets[name] : undefined;\n\t}\n\n\tfunction get_layer(name: string): LoadedPromptPreset | undefined {\n\t\tconst preset = presets[name];\n\t\treturn preset?.kind === 'layer' ? preset : undefined;\n\t}\n\n\tfunction commit_state(\n\t\tctx: ExtensionContext,\n\t\tnext_base_name: string | undefined,\n\t\tnext_layers: ReadonlySet<string>,\n\t\toptions?: { persist?: boolean; notify?: string },\n\t): void {\n\t\tactive_base_name = next_base_name;\n\t\tactive_layers = new Set(next_layers);\n\t\tset_status(ctx, active_base_name, active_layers);\n\t\tif (options?.persist !== false) {\n\t\t\tpersist_state(pi, ctx, active_base_name, active_layers);\n\t\t}\n\t\tif (options?.notify) {\n\t\t\tctx.ui.notify(options.notify, 'info');\n\t\t}\n\t}\n\n\tfunction activate_base(\n\t\tname: string | undefined,\n\t\tctx: ExtensionContext,\n\t\toptions?: { persist?: boolean },\n\t): boolean {\n\t\tif (!name) {\n\t\t\tcommit_state(ctx, undefined, active_layers, {\n\t\t\t\tpersist: options?.persist,\n\t\t\t\tnotify: 'Base preset cleared',\n\t\t\t});\n\t\t\treturn true;\n\t\t}\n\n\t\tconst preset = get_base(name);\n\t\tif (!preset) {\n\t\t\tctx.ui.notify(`Unknown base preset: ${name}`, 'warning');\n\t\t\treturn false;\n\t\t}\n\n\t\tcommit_state(ctx, preset.name, active_layers, {\n\t\t\tpersist: options?.persist,\n\t\t\tnotify: `Base preset \"${preset.name}\" activated`,\n\t\t});\n\t\treturn true;\n\t}\n\n\tfunction set_layer_enabled(\n\t\tname: string,\n\t\tenabled: boolean,\n\t\tctx: ExtensionContext,\n\t\toptions?: { persist?: boolean },\n\t): boolean {\n\t\tconst preset = get_layer(name);\n\t\tif (!preset) {\n\t\t\tctx.ui.notify(`Unknown prompt layer: ${name}`, 'warning');\n\t\t\treturn false;\n\t\t}\n\n\t\tconst next_layers = new Set(active_layers);\n\t\tif (enabled) {\n\t\t\tnext_layers.add(preset.name);\n\t\t} else {\n\t\t\tnext_layers.delete(preset.name);\n\t\t}\n\n\t\tcommit_state(ctx, active_base_name, next_layers, {\n\t\t\tpersist: options?.persist,\n\t\t\tnotify: enabled\n\t\t\t\t? `Layer \"${preset.name}\" enabled`\n\t\t\t\t: `Layer \"${preset.name}\" disabled`,\n\t\t});\n\t\treturn true;\n\t}\n\n\tfunction toggle_layer(\n\t\tname: string,\n\t\tctx: ExtensionContext,\n\t\toptions?: { persist?: boolean },\n\t): boolean {\n\t\treturn set_layer_enabled(\n\t\t\tname,\n\t\t\t!active_layers.has(name),\n\t\t\tctx,\n\t\t\toptions,\n\t\t);\n\t}\n\n\tasync function edit_preset(\n\t\tname: string,\n\t\tctx: ExtensionCommandContext,\n\t\tscope: 'project' | 'global' = 'project',\n\t): Promise<void> {\n\t\tconst existing = presets[name];\n\t\tconst kind_choice = await ctx.ui.select('Preset kind', [\n\t\t\texisting?.kind === 'layer'\n\t\t\t\t? 'layer (current)'\n\t\t\t\t: 'base (current)',\n\t\t\texisting?.kind === 'layer' ? 'base' : 'layer',\n\t\t]);\n\t\tif (!kind_choice) return;\n\t\tconst kind: PromptPresetKind = kind_choice.startsWith('layer')\n\t\t\t? 'layer'\n\t\t\t: 'base';\n\n\t\tconst description = await ctx.ui.input(\n\t\t\t`Description for ${name}`,\n\t\t\texisting?.description ?? '',\n\t\t);\n\t\tif (description === undefined) return;\n\n\t\tconst instructions = await ctx.ui.editor(\n\t\t\t`Edit ${kind} preset: ${name}`,\n\t\t\texisting?.instructions ?? '',\n\t\t);\n\t\tif (instructions === undefined) return;\n\n\t\tconst saved_path =\n\t\t\tscope === 'global'\n\t\t\t\t? save_global_prompt_preset_file(name, {\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tinstructions,\n\t\t\t\t\t\t...(description.trim()\n\t\t\t\t\t\t\t? { description: description.trim() }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t})\n\t\t\t\t: save_project_prompt_preset_file(ctx.cwd, name, {\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tinstructions,\n\t\t\t\t\t\t...(description.trim()\n\t\t\t\t\t\t\t? { description: description.trim() }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t});\n\n\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\tconst normalized = normalize_active_state(\n\t\t\tpresets,\n\t\t\tactive_base_name,\n\t\t\tactive_layers,\n\t\t);\n\t\tactive_base_name = normalized.active_base_name;\n\t\tactive_layers = normalized.active_layers;\n\n\t\tif (kind === 'base') {\n\t\t\tactivate_base(name, ctx);\n\t\t} else {\n\t\t\tset_layer_enabled(name, true, ctx);\n\t\t}\n\t\tctx.ui.notify(`Saved preset \"${name}\" to ${saved_path}`, 'info');\n\t}\n\n\tfunction export_default_presets(\n\t\tctx: ExtensionCommandContext,\n\t\tscope: 'project' | 'global',\n\t): void {\n\t\tconst dir =\n\t\t\tscope === 'global'\n\t\t\t\t? get_global_presets_dir()\n\t\t\t\t: get_project_presets_dir(ctx.cwd);\n\t\tlet written = 0;\n\t\tlet skipped = 0;\n\t\tfor (const [name, preset] of Object.entries(\n\t\t\tDEFAULT_PROMPT_PRESETS,\n\t\t)) {\n\t\t\tconst path = get_prompt_preset_file_path(dir, name);\n\t\t\tif (existsSync(path)) {\n\t\t\t\tskipped += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tsave_prompt_preset_file(dir, name, preset);\n\t\t\twritten += 1;\n\t\t}\n\n\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\tconst normalized = normalize_active_state(\n\t\t\tpresets,\n\t\t\tactive_base_name,\n\t\t\tactive_layers,\n\t\t);\n\t\tactive_base_name = normalized.active_base_name;\n\t\tactive_layers = normalized.active_layers;\n\t\tset_status(ctx, active_base_name, active_layers);\n\n\t\tctx.ui.notify(\n\t\t\t`Exported ${written} built-in preset file(s) to ${dir}${skipped ? ` (${skipped} already existed)` : ''}`,\n\t\t\t'info',\n\t\t);\n\t}\n\n\tfunction remove_custom_preset(\n\t\tname: string,\n\t\tctx: ExtensionCommandContext,\n\t\tmode: 'delete' | 'reset',\n\t): void {\n\t\tconst result = remove_project_prompt_preset(ctx.cwd, name);\n\t\tif (!result.removed) {\n\t\t\tctx.ui.notify(\n\t\t\t\t`No project-local preset named \"${name}\" to ${mode}`,\n\t\t\t\t'warning',\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\tconst normalized = normalize_active_state(\n\t\t\tpresets,\n\t\t\tactive_base_name,\n\t\t\tactive_layers,\n\t\t);\n\t\tactive_base_name = normalized.active_base_name;\n\t\tactive_layers = normalized.active_layers;\n\t\tset_status(ctx, active_base_name, active_layers);\n\t\tpersist_state(pi, ctx, active_base_name, active_layers);\n\n\t\tconst fallback = presets[name];\n\t\tif (mode === 'reset' && fallback) {\n\t\t\tctx.ui.notify(\n\t\t\t\t`Reset \"${name}\" to ${get_prompt_source_label(fallback.source)} preset`,\n\t\t\t\t'info',\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tctx.ui.notify(\n\t\t\tresult.remaining === 0\n\t\t\t\t? `Removed \"${name}\" and deleted ${result.path}`\n\t\t\t\t: `Removed \"${name}\" from ${result.path}`,\n\t\t\t'info',\n\t\t);\n\t}\n\n\tasync function show_manager(\n\t\tctx: ExtensionCommandContext,\n\t): Promise<void> {\n\t\tconst base_presets = list_base_presets(presets);\n\t\tconst layer_presets = list_layer_presets(presets);\n\t\tif (base_presets.length === 0 && layer_presets.length === 0) {\n\t\t\tctx.ui.notify('No prompt presets available', 'warning');\n\t\t\treturn;\n\t\t}\n\n\t\tconst initial_base = active_base_name;\n\t\tconst initial_layers = new Set(active_layers);\n\t\tlet selected_base = active_base_name;\n\t\tconst enabled_layers = new Set(active_layers);\n\n\t\tconst items: SettingItem[] = [];\n\t\tconst base_ids = new Set<string>();\n\t\tconst layer_ids = new Set<string>();\n\n\t\titems.push({\n\t\t\tid: '__header_base__',\n\t\t\tlabel: `── Base presets (${base_presets.length + 1}) ──`,\n\t\t\tdescription: '',\n\t\t\tcurrentValue: '',\n\t\t});\n\t\titems.push({\n\t\t\tid: NONE_BASE_ID,\n\t\t\tlabel: '(none)',\n\t\t\tdescription: 'No active base preset',\n\t\t\tcurrentValue: UNSELECTED,\n\t\t\tvalues: [SELECTED, UNSELECTED],\n\t\t});\n\t\tbase_ids.add(NONE_BASE_ID);\n\n\t\tfor (const preset of base_presets) {\n\t\t\titems.push({\n\t\t\t\tid: preset.name,\n\t\t\t\tlabel: preset.name,\n\t\t\t\tdescription: [\n\t\t\t\t\t`${get_prompt_source_label(preset.source)} • ${preset.description ?? 'base preset'}`,\n\t\t\t\t].join('\\n'),\n\t\t\t\tcurrentValue: UNSELECTED,\n\t\t\t\tvalues: [SELECTED, UNSELECTED],\n\t\t\t});\n\t\t\tbase_ids.add(preset.name);\n\t\t}\n\n\t\titems.push({\n\t\t\tid: '__header_layers__',\n\t\t\tlabel: `── Prompt layers (${layer_presets.length}) ──`,\n\t\t\tdescription: '',\n\t\t\tcurrentValue: '',\n\t\t});\n\t\tfor (const preset of layer_presets) {\n\t\t\titems.push({\n\t\t\t\tid: preset.name,\n\t\t\t\tlabel: preset.name,\n\t\t\t\tdescription: [\n\t\t\t\t\t`${get_prompt_source_label(preset.source)} • ${preset.description ?? 'layer'}`,\n\t\t\t\t].join('\\n'),\n\t\t\t\tcurrentValue: DISABLED,\n\t\t\t\tvalues: [ENABLED, DISABLED],\n\t\t\t});\n\t\t\tlayer_ids.add(preset.name);\n\t\t}\n\n\t\tfunction sync_values() {\n\t\t\tfor (const item of items) {\n\t\t\t\tif (base_ids.has(item.id)) {\n\t\t\t\t\tconst is_selected =\n\t\t\t\t\t\t(item.id === NONE_BASE_ID && !selected_base) ||\n\t\t\t\t\t\titem.id === selected_base;\n\t\t\t\t\titem.currentValue = is_selected ? SELECTED : UNSELECTED;\n\t\t\t\t} else if (layer_ids.has(item.id)) {\n\t\t\t\t\titem.currentValue = enabled_layers.has(item.id)\n\t\t\t\t\t\t? ENABLED\n\t\t\t\t\t\t: DISABLED;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsync_values();\n\n\t\tawait show_settings_modal(ctx, {\n\t\t\ttitle: 'Prompt presets',\n\t\t\tsubtitle: () =>\n\t\t\t\t`base: ${selected_base ?? '(none)'} • ${enabled_layers.size} layer(s) enabled`,\n\t\t\titems,\n\t\t\tmax_visible: Math.min(Math.max(items.length + 4, 8), 24),\n\t\t\tenable_search: true,\n\t\t\ton_change: (id, new_value) => {\n\t\t\t\tif (id.startsWith('__header_')) return;\n\n\t\t\t\tif (base_ids.has(id)) {\n\t\t\t\t\tselected_base =\n\t\t\t\t\t\tnew_value === SELECTED && id !== NONE_BASE_ID\n\t\t\t\t\t\t\t? id\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\tsync_values();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (layer_ids.has(id)) {\n\t\t\t\t\tif (new_value === ENABLED) {\n\t\t\t\t\t\tenabled_layers.add(id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tenabled_layers.delete(id);\n\t\t\t\t\t}\n\t\t\t\t\tsync_values();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tif (\n\t\t\tselected_base !== initial_base ||\n\t\t\t!sets_equal(initial_layers, enabled_layers)\n\t\t) {\n\t\t\tcommit_state(ctx, selected_base, enabled_layers, {\n\t\t\t\tnotify: 'Updated prompt preset selection',\n\t\t\t});\n\t\t}\n\t}\n\n\tpi.registerFlag('preset', {\n\t\tdescription:\n\t\t\t'Activate prompt config on startup. Accepts a base preset or comma-separated preset/layer names.',\n\t\ttype: 'string',\n\t});\n\n\tconst prompt_preset_command: Parameters<\n\t\tExtensionAPI['registerCommand']\n\t>[1] = {\n\t\tdescription:\n\t\t\t'Manage prompt presets and layers. Try: /prompt-preset help, /prompt-preset export-defaults, /prompt-preset edit-global terse',\n\t\tgetArgumentCompletions: (prefix) => {\n\t\t\tconst trimmed = prefix.trim();\n\t\t\tconst parts = trimmed ? trimmed.split(/\\s+/) : [];\n\t\t\tconst base_names = list_base_presets(presets).map(\n\t\t\t\t(preset) => preset.name,\n\t\t\t);\n\t\t\tconst layer_names = list_layer_presets(presets).map(\n\t\t\t\t(preset) => preset.name,\n\t\t\t);\n\t\t\tconst all_names = [...base_names, ...layer_names];\n\n\t\t\tif (parts.length <= 1) {\n\t\t\t\tconst query = parts[0] ?? '';\n\t\t\t\tconst subcommands = [\n\t\t\t\t\t'help',\n\t\t\t\t\t'list',\n\t\t\t\t\t'show',\n\t\t\t\t\t'clear',\n\t\t\t\t\t'edit',\n\t\t\t\t\t'edit-global',\n\t\t\t\t\t'export-defaults',\n\t\t\t\t\t'delete',\n\t\t\t\t\t'reset',\n\t\t\t\t\t'reload',\n\t\t\t\t\t'base',\n\t\t\t\t\t'enable',\n\t\t\t\t\t'disable',\n\t\t\t\t\t'toggle',\n\t\t\t\t];\n\t\t\t\treturn [\n\t\t\t\t\t...subcommands\n\t\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t\t.map((item) => ({ value: item, label: item })),\n\t\t\t\t\t...all_names\n\t\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t\t.map((item) => ({ value: item, label: item })),\n\t\t\t\t];\n\t\t\t}\n\n\t\t\tconst command = parts[0];\n\t\t\tconst query = parts.slice(1).join(' ');\n\t\t\tif (command === 'base') {\n\t\t\t\treturn base_names\n\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t.map((item) => ({ value: `base ${item}`, label: item }));\n\t\t\t}\n\t\t\tif (['enable', 'disable', 'toggle'].includes(command)) {\n\t\t\t\treturn layer_names\n\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t.map((item) => ({\n\t\t\t\t\t\tvalue: `${command} ${item}`,\n\t\t\t\t\t\tlabel: item,\n\t\t\t\t\t}));\n\t\t\t}\n\t\t\tif (command === 'edit' || command === 'edit-global') {\n\t\t\t\treturn all_names\n\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t.map((item) => ({\n\t\t\t\t\t\tvalue: `${command} ${item}`,\n\t\t\t\t\t\tlabel: item,\n\t\t\t\t\t}));\n\t\t\t}\n\t\t\tif (['delete', 'reset'].includes(command)) {\n\t\t\t\treturn all_names\n\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t.map((item) => ({\n\t\t\t\t\t\tvalue: `${command} ${item}`,\n\t\t\t\t\t\tlabel: item,\n\t\t\t\t\t}));\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t\thandler: async (args, ctx) => {\n\t\t\tconst trimmed = args.trim();\n\t\t\tif (!trimmed) {\n\t\t\t\tif (ctx.hasUI) {\n\t\t\t\t\tawait show_manager(ctx);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tctx.ui.notify(\n\t\t\t\t\tformat_summary(active_base_name, active_layers, presets),\n\t\t\t\t\t'info',\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [first, ...rest] = trimmed.split(/\\s+/);\n\t\t\tconst arg = rest.join(' ').trim();\n\n\t\t\tswitch (first) {\n\t\t\t\tcase 'help':\n\t\t\t\t\tctx.ui.notify(format_prompt_preset_help(), 'info');\n\t\t\t\t\treturn;\n\t\t\t\tcase 'list':\n\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\tformat_summary(active_base_name, active_layers, presets),\n\t\t\t\t\t\t'info',\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'show':\n\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\tformat_active_details(\n\t\t\t\t\t\t\tactive_base_name,\n\t\t\t\t\t\t\tactive_layers,\n\t\t\t\t\t\t\tpresets,\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'info',\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'clear':\n\t\t\t\t\tcommit_state(ctx, undefined, new Set(), {\n\t\t\t\t\t\tnotify: 'Cleared base preset and prompt layers',\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\tcase 'reload': {\n\t\t\t\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\t\t\t\tconst normalized = normalize_active_state(\n\t\t\t\t\t\tpresets,\n\t\t\t\t\t\tactive_base_name,\n\t\t\t\t\t\tactive_layers,\n\t\t\t\t\t);\n\t\t\t\t\tactive_base_name = normalized.active_base_name;\n\t\t\t\t\tactive_layers = normalized.active_layers;\n\t\t\t\t\tset_status(ctx, active_base_name, active_layers);\n\t\t\t\t\tctx.ui.notify('Reloaded prompt presets', 'info');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcase 'base':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset base <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tactivate_base(arg, ctx);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'enable':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset enable <layer> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tset_layer_enabled(arg, true, ctx);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'disable':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset disable <layer> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tset_layer_enabled(arg, false, ctx);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'toggle':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset toggle <layer> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\ttoggle_layer(arg, ctx);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'edit': {\n\t\t\t\t\tlet scope: 'project' | 'global' = 'project';\n\t\t\t\t\tlet name = arg;\n\t\t\t\t\tif (arg.startsWith('--global ')) {\n\t\t\t\t\t\tscope = 'global';\n\t\t\t\t\t\tname = arg.slice('--global '.length).trim();\n\t\t\t\t\t} else if (arg.startsWith('--project ')) {\n\t\t\t\t\t\tname = arg.slice('--project '.length).trim();\n\t\t\t\t\t}\n\t\t\t\t\tif (!name) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset edit [--global|--project] <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tawait edit_preset(name, ctx, scope);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcase 'edit-global':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset edit-global <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tawait edit_preset(arg, ctx, 'global');\n\t\t\t\t\treturn;\n\t\t\t\tcase 'export-defaults': {\n\t\t\t\t\tconst scope = arg || 'global';\n\t\t\t\t\tif (scope !== 'global' && scope !== 'project') {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset export-defaults [global|project] (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\texport_default_presets(ctx, scope);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcase 'delete':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset delete <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tremove_custom_preset(arg, ctx, 'delete');\n\t\t\t\t\treturn;\n\t\t\t\tcase 'reset':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset reset <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tremove_custom_preset(arg, ctx, 'reset');\n\t\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (is_subcommand(first)) {\n\t\t\t\tctx.ui.notify(\n\t\t\t\t\t`Unsupported preset command: ${first}`,\n\t\t\t\t\t'warning',\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst preset = presets[trimmed];\n\t\t\tif (!preset) {\n\t\t\t\tctx.ui.notify(\n\t\t\t\t\t`Unknown preset or layer: ${trimmed}. Try /prompt-preset help.`,\n\t\t\t\t\t'warning',\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (preset.kind === 'base') {\n\t\t\t\tactivate_base(preset.name, ctx);\n\t\t\t} else {\n\t\t\t\ttoggle_layer(preset.name, ctx);\n\t\t\t}\n\t\t},\n\t};\n\n\tfor (const command_name of [\n\t\t'prompt-preset',\n\t\t'prompt-presets',\n\t\t'preset',\n\t]) {\n\t\tpi.registerCommand(command_name, prompt_preset_command);\n\t}\n\n\tpi.on('session_start', async (_event, ctx) => {\n\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\tactive_base_name = undefined;\n\t\tactive_layers = new Set();\n\n\t\tconst preset_flag = pi.getFlag('preset');\n\t\tif (typeof preset_flag === 'string' && preset_flag.trim()) {\n\t\t\tfor (const name of parse_preset_flag(preset_flag)) {\n\t\t\t\tconst preset = presets[name];\n\t\t\t\tif (!preset) continue;\n\t\t\t\tif (preset.kind === 'base') {\n\t\t\t\t\tactive_base_name = name;\n\t\t\t\t} else {\n\t\t\t\t\tactive_layers.add(name);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst normalized = normalize_active_state(\n\t\t\t\tpresets,\n\t\t\t\tactive_base_name,\n\t\t\t\tactive_layers,\n\t\t\t);\n\t\t\tactive_base_name = normalized.active_base_name;\n\t\t\tactive_layers = normalized.active_layers;\n\t\t\tset_status(ctx, active_base_name, active_layers);\n\t\t\treturn;\n\t\t}\n\n\t\tconst restored = get_last_preset_state(ctx) ??\n\t\t\tload_persisted_prompt_state(ctx.cwd) ?? {\n\t\t\t\tbase_name: DEFAULT_BASE_PROMPT_PRESET_NAME,\n\t\t\t\tlayer_names: [],\n\t\t\t};\n\t\tactive_base_name = restored.base_name ?? undefined;\n\t\tactive_layers = new Set(restored.layer_names ?? []);\n\t\tconst normalized = normalize_active_state(\n\t\t\tpresets,\n\t\t\tactive_base_name,\n\t\t\tactive_layers,\n\t\t);\n\t\tactive_base_name = normalized.active_base_name;\n\t\tactive_layers = normalized.active_layers;\n\t\tset_status(ctx, active_base_name, active_layers);\n\t});\n\n\tpi.on('before_agent_start', async (event) => {\n\t\tconst blocks: string[] = [];\n\t\tconst base = get_base(active_base_name);\n\t\tif (base?.instructions.trim()) {\n\t\t\tblocks.push(\n\t\t\t\t`## Active Base Prompt: ${base.name}\\n${base.instructions.trim()}`,\n\t\t\t);\n\t\t}\n\n\t\tconst layer_blocks = [...active_layers]\n\t\t\t.sort()\n\t\t\t.map((name) => presets[name])\n\t\t\t.filter((preset): preset is LoadedPromptPreset =>\n\t\t\t\tBoolean(preset?.instructions.trim()),\n\t\t\t)\n\t\t\t.map(\n\t\t\t\t(preset) =>\n\t\t\t\t\t`### ${preset.name}\\n${preset.instructions.trim()}`,\n\t\t\t);\n\t\tif (layer_blocks.length > 0) {\n\t\t\tblocks.push(\n\t\t\t\t`## Active Prompt Layers\\n\\n${layer_blocks.join('\\n\\n')}`,\n\t\t\t);\n\t\t}\n\n\t\tif (blocks.length === 0) return;\n\t\treturn {\n\t\t\tsystemPrompt: `${event.systemPrompt}\\n\\n${blocks.join('\\n\\n')}`,\n\t\t};\n\t});\n\n\tpi.on('session_shutdown', async (_event, ctx) => {\n\t\tctx.ui.setStatus('preset', undefined);\n\t\tctx.ui.setFooter(undefined);\n\t});\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,wBACf,QACS;AACT,SAAQ,QAAR;EACC,KAAK,UACJ,QAAO;EACR,KAAK,OACJ,QAAO;EACR,KAAK,UACJ,QAAO;;;AAIV,SAAgB,kBACf,SACuB;AACvB,QAAO,OAAO,OAAO,QAAQ,CAC3B,QAAQ,WAAW,OAAO,SAAS,OAAO,CAC1C,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;;AAG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mB,SAAS,aAAa,KAAA;AACzC,kBAAgB,IAAI,IAAI,SAAS,eAAe,EAAE,CAAC;EACnD,MAAM,aAAa,uBAClB,SACA,kBACA,cACA;AACD,qBAAmB,WAAW;AAC9B,kBAAgB,WAAW;AAC3B,aAAW,KAAK,kBAAkB,cAAc;GAC/C;AAEF,IAAG,GAAG,sBAAsB,OAAO,UAAU;EAC5C,MAAM,SAAmB,EAAE;EAC3B,MAAM,OAAO,SAAS,iBAAiB;AACvC,MAAI,MAAM,aAAa,MAAM,CAC5B,QAAO,KACN,0BAA0B,KAAK,KAAK,IAAI,KAAK,aAAa,MAAM,GAChE;EAGF,MAAM,eAAe,CAAC,GAAG,cAAc,CACrC,MAAM,CACN,KAAK,SAAS,QAAQ,MAAM,CAC5B,QAAQ,WACR,QAAQ,QAAQ,aAAa,MAAM,CAAC,CACpC,CACA,KACC,WACA,OAAO,OAAO,KAAK,IAAI,OAAO,aAAa,MAAM,GAClD;AACF,MAAI,aAAa,SAAS,EACzB,QAAO,KACN,8BAA8B,aAAa,KAAK,OAAO,GACvD;AAGF,MAAI,OAAO,WAAW,EAAG;AACzB,SAAO,EACN,cAAc,GAAG,MAAM,aAAa,MAAM,OAAO,KAAK,OAAO,IAC7D;GACA;AAEF,IAAG,GAAG,oBAAoB,OAAO,QAAQ,QAAQ;AAChD,MAAI,GAAG,UAAU,UAAU,KAAA,EAAU;AACrC,MAAI,GAAG,UAAU,KAAA,EAAU;GAC1B"}
|
|
1
|
+
{"version":3,"file":"prompt-presets-BAXHRyX0.js","names":[],"sources":["../src/extensions/prompt-presets/catalog.ts","../src/extensions/prompt-presets/defaults.ts","../src/extensions/prompt-presets/footer.ts","../src/extensions/prompt-presets/storage.ts","../src/extensions/prompt-presets/index.ts"],"sourcesContent":["import type {\n\tLoadedPromptPreset,\n\tPromptPresetSource,\n} from './types.js';\n\nexport function get_prompt_source_label(\n\tsource: PromptPresetSource,\n): string {\n\tswitch (source) {\n\t\tcase 'builtin':\n\t\t\treturn 'built-in';\n\t\tcase 'user':\n\t\t\treturn 'user';\n\t\tcase 'project':\n\t\t\treturn 'project';\n\t}\n}\n\nexport function list_base_presets(\n\tpresets: Record<string, LoadedPromptPreset>,\n): LoadedPromptPreset[] {\n\treturn Object.values(presets)\n\t\t.filter((preset) => preset.kind === 'base')\n\t\t.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport function list_layer_presets(\n\tpresets: Record<string, LoadedPromptPreset>,\n): LoadedPromptPreset[] {\n\treturn Object.values(presets)\n\t\t.filter((preset) => preset.kind === 'layer')\n\t\t.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport function format_summary(\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n\tpresets: Record<string, LoadedPromptPreset>,\n): string {\n\tconst lines = [`Base: ${active_base_name ?? '(none)'}`];\n\n\tconst layer_names = [...active_layers].sort();\n\tif (layer_names.length === 0) {\n\t\tlines.push('Layers: (none)');\n\t} else {\n\t\tlines.push('Layers:');\n\t\tfor (const name of layer_names) {\n\t\t\tconst preset = presets[name];\n\t\t\tconst description = preset?.description\n\t\t\t\t? ` — ${preset.description}`\n\t\t\t\t: '';\n\t\t\tlines.push(`- ${name}${description}`);\n\t\t}\n\t}\n\n\treturn lines.join('\\n');\n}\n\nexport function format_active_details(\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n\tpresets: Record<string, LoadedPromptPreset>,\n): string {\n\tconst parts: string[] = [];\n\n\tif (active_base_name) {\n\t\tconst base = presets[active_base_name];\n\t\tif (base) {\n\t\t\tparts.push(`Base: ${base.name}`);\n\t\t\tif (base.description)\n\t\t\t\tparts.push(`Description: ${base.description}`);\n\t\t\tparts.push(`Source: ${get_prompt_source_label(base.source)}`);\n\t\t\tparts.push('', base.instructions.trim());\n\t\t}\n\t}\n\n\tconst layer_names = [...active_layers].sort();\n\tif (layer_names.length > 0) {\n\t\tif (parts.length > 0) parts.push('', '---', '');\n\t\tparts.push('Layers:');\n\t\tfor (const name of layer_names) {\n\t\t\tconst layer = presets[name];\n\t\t\tif (!layer) continue;\n\t\t\tparts.push(\n\t\t\t\t`- ${layer.name} (${get_prompt_source_label(layer.source)})`,\n\t\t\t);\n\t\t\tif (layer.description) parts.push(` ${layer.description}`);\n\t\t}\n\t}\n\n\treturn parts.join('\\n') || 'No preset or layers active';\n}\n","import type { PromptPresetMap } from './types.js';\n\nexport const DEFAULT_BASE_PROMPT_PRESET_NAME = 'terse';\n\nexport const DEFAULT_PROMPT_PRESETS: PromptPresetMap = {\n\tterse: {\n\t\tkind: 'base',\n\t\tdescription: 'Short, direct, no fluff',\n\t\tinstructions:\n\t\t\t\"Be concise and direct. Default to the shortest response that fully solves the user's request. Use at most one short paragraph or 3 bullets unless the user explicitly asks for detail. For implementation reports, include only what changed, validation, and the next step if relevant. No purple prose, no filler, no repetitive caveats.\",\n\t},\n\tstandard: {\n\t\tkind: 'base',\n\t\tdescription: 'Clear and concise with key context',\n\t\tinstructions:\n\t\t\t'Be clear, direct, and concise. Include only the reasoning and implementation details that matter. Avoid filler, grandstanding, and ornamental language. Use bullets when they improve scanability.',\n\t},\n\tdetailed: {\n\t\tkind: 'base',\n\t\tdescription: 'More explanation when nuance matters',\n\t\tinstructions:\n\t\t\t'Be thorough when the task is complex or tradeoffs matter, but stay practical. Explain only the details that help the user decide, verify, or implement. Avoid purple prose and unnecessary scene-setting.',\n\t},\n\t'no-purple-prose': {\n\t\tkind: 'layer',\n\t\tdescription: 'Strip out ornamental language',\n\t\tinstructions:\n\t\t\t'Do not use purple prose, flourish, motivational filler, or theatrical transitions. Prefer plain language and concrete statements.',\n\t},\n\tbullets: {\n\t\tkind: 'layer',\n\t\tdescription: 'Prefer short bullets when useful',\n\t\tinstructions:\n\t\t\t'When presenting options, findings, or steps, prefer short bullet lists over long paragraphs.',\n\t},\n\t'clarify-first': {\n\t\tkind: 'layer',\n\t\tdescription:\n\t\t\t'Ask brief clarifying questions when requirements are ambiguous',\n\t\tinstructions:\n\t\t\t'If the request is materially ambiguous, ask the minimum clarifying question(s) needed before proceeding. Do not ask unnecessary questions.',\n\t},\n\t'include-risks': {\n\t\tkind: 'layer',\n\t\tdescription: 'Call out notable risks or tradeoffs',\n\t\tinstructions:\n\t\t\t'When making a recommendation or implementation plan, briefly mention the key risk, tradeoff, or caveat if one materially matters.',\n\t},\n};\n","import {\n\tclampThinkingLevel,\n\tgetSupportedThinkingLevels,\n\ttype ModelThinkingLevel,\n} from '@mariozechner/pi-ai';\nimport type {\n\tExtensionContext,\n\tReadonlyFooterDataProvider,\n} from '@mariozechner/pi-coding-agent';\nimport { truncateToWidth, visibleWidth } from '@mariozechner/pi-tui';\n\nfunction get_footer_prompt_status(\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): string | undefined {\n\tif (!active_base_name && active_layers.size === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst label = active_base_name ?? 'none';\n\tconst layer_suffix =\n\t\tactive_layers.size > 0 ? ` +${active_layers.size}` : '';\n\treturn `prompt:${label}${layer_suffix}`;\n}\n\nfunction sanitize_status_text(text: string): string {\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, ' ')\n\t\t.replace(/ +/g, ' ')\n\t\t.trim();\n}\n\nfunction format_token_count(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\nexport function render_footer_status_line(\n\ttheme: ExtensionContext['ui']['theme'],\n\twidth: number,\n\tleft_items: string[],\n\tright_item?: string,\n): string | undefined {\n\tconst left = sanitize_status_text(left_items.join(' '));\n\tconst right = right_item ? sanitize_status_text(right_item) : '';\n\tif (!left && !right) return undefined;\n\tif (!right) {\n\t\treturn truncateToWidth(\n\t\t\ttheme.fg('dim', left),\n\t\t\twidth,\n\t\t\ttheme.fg('dim', '...'),\n\t\t);\n\t}\n\tif (!left) {\n\t\tconst themed_right = theme.fg('dim', right);\n\t\tconst right_width = visibleWidth(themed_right);\n\t\treturn right_width >= width\n\t\t\t? truncateToWidth(themed_right, width, theme.fg('dim', '...'))\n\t\t\t: `${' '.repeat(width - right_width)}${themed_right}`;\n\t}\n\n\tconst right_width = visibleWidth(right);\n\tif (right_width >= width) {\n\t\treturn truncateToWidth(\n\t\t\ttheme.fg('dim', right),\n\t\t\twidth,\n\t\t\ttheme.fg('dim', '...'),\n\t\t);\n\t}\n\n\tconst min_gap = 1;\n\tconst available_left = Math.max(0, width - right_width - min_gap);\n\tconst truncated_left = truncateToWidth(left, available_left, '...');\n\tconst left_width = visibleWidth(truncated_left);\n\tconst gap = Math.max(min_gap, width - left_width - right_width);\n\treturn (\n\t\ttheme.fg('dim', truncated_left) +\n\t\t' '.repeat(gap) +\n\t\ttheme.fg('dim', right)\n\t);\n}\n\nconst VALID_THINKING_LEVELS = new Set<ModelThinkingLevel>([\n\t'off',\n\t'minimal',\n\t'low',\n\t'medium',\n\t'high',\n\t'xhigh',\n]);\n\nfunction is_model_thinking_level(\n\tlevel: string,\n): level is ModelThinkingLevel {\n\treturn VALID_THINKING_LEVELS.has(level as ModelThinkingLevel);\n}\n\nexport function get_default_footer_thinking_level(\n\tmodel: ExtensionContext['model'],\n): ModelThinkingLevel {\n\tif (!model?.reasoning) return 'off';\n\treturn clampThinkingLevel(model, 'medium');\n}\n\nexport function get_current_thinking_level(\n\tctx: Pick<ExtensionContext, 'model' | 'sessionManager'>,\n): ModelThinkingLevel {\n\tconst entries = ctx.sessionManager.getEntries();\n\tfor (let i = entries.length - 1; i >= 0; i--) {\n\t\tconst entry = entries[i] as {\n\t\t\ttype?: string;\n\t\t\tthinkingLevel?: string;\n\t\t};\n\t\tif (\n\t\t\tentry.type === 'thinking_level_change' &&\n\t\t\ttypeof entry.thinkingLevel === 'string' &&\n\t\t\tis_model_thinking_level(entry.thinkingLevel)\n\t\t) {\n\t\t\tif (!ctx.model?.reasoning) return 'off';\n\t\t\treturn getSupportedThinkingLevels(ctx.model).includes(\n\t\t\t\tentry.thinkingLevel,\n\t\t\t)\n\t\t\t\t? entry.thinkingLevel\n\t\t\t\t: clampThinkingLevel(ctx.model, entry.thinkingLevel);\n\t\t}\n\t}\n\treturn get_default_footer_thinking_level(ctx.model);\n}\n\nfunction render_footer_lines(\n\tctx: ExtensionContext,\n\ttheme: ExtensionContext['ui']['theme'],\n\tfooter_data: ReadonlyFooterDataProvider,\n\twidth: number,\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): string[] {\n\tlet total_input = 0;\n\tlet total_output = 0;\n\tlet total_cache_read = 0;\n\tlet total_cache_write = 0;\n\tlet total_cost = 0;\n\tfor (const entry of ctx.sessionManager.getEntries()) {\n\t\tif (\n\t\t\tentry.type === 'message' &&\n\t\t\tentry.message.role === 'assistant'\n\t\t) {\n\t\t\ttotal_input += entry.message.usage.input;\n\t\t\ttotal_output += entry.message.usage.output;\n\t\t\ttotal_cache_read += entry.message.usage.cacheRead;\n\t\t\ttotal_cache_write += entry.message.usage.cacheWrite;\n\t\t\ttotal_cost += entry.message.usage.cost.total;\n\t\t}\n\t}\n\n\tconst context_usage = ctx.getContextUsage();\n\tconst context_window =\n\t\tcontext_usage?.contextWindow ?? ctx.model?.contextWindow ?? 0;\n\tconst context_percent_value = context_usage?.percent ?? 0;\n\tconst context_percent =\n\t\tcontext_usage?.percent !== null\n\t\t\t? context_percent_value.toFixed(1)\n\t\t\t: '?';\n\n\tlet pwd = ctx.cwd;\n\tconst home = process.env.HOME || process.env.USERPROFILE;\n\tif (home && pwd.startsWith(home)) {\n\t\tpwd = `~${pwd.slice(home.length)}`;\n\t}\n\n\tconst branch = footer_data.getGitBranch();\n\tif (branch) {\n\t\tpwd = `${pwd} (${branch})`;\n\t}\n\n\tconst session_name = ctx.sessionManager.getSessionName();\n\tif (session_name) {\n\t\tpwd = `${pwd} • ${session_name}`;\n\t}\n\n\tconst stats_parts: string[] = [];\n\tif (total_input)\n\t\tstats_parts.push(`↑${format_token_count(total_input)}`);\n\tif (total_output)\n\t\tstats_parts.push(`↓${format_token_count(total_output)}`);\n\tif (total_cache_read)\n\t\tstats_parts.push(`R${format_token_count(total_cache_read)}`);\n\tif (total_cache_write)\n\t\tstats_parts.push(`W${format_token_count(total_cache_write)}`);\n\n\tconst using_subscription = ctx.model\n\t\t? ctx.modelRegistry.isUsingOAuth(ctx.model)\n\t\t: false;\n\tif (total_cost || using_subscription) {\n\t\tstats_parts.push(\n\t\t\t`$${total_cost.toFixed(3)}${using_subscription ? ' (sub)' : ''}`,\n\t\t);\n\t}\n\n\tconst context_percent_display =\n\t\tcontext_percent === '?'\n\t\t\t? `?/${format_token_count(context_window)}`\n\t\t\t: `${context_percent}%/${format_token_count(context_window)}`;\n\tlet context_percent_str = context_percent_display;\n\tif (context_percent_value > 90) {\n\t\tcontext_percent_str = theme.fg('error', context_percent_display);\n\t} else if (context_percent_value > 70) {\n\t\tcontext_percent_str = theme.fg(\n\t\t\t'warning',\n\t\t\tcontext_percent_display,\n\t\t);\n\t}\n\tstats_parts.push(context_percent_str);\n\n\tlet stats_left = stats_parts.join(' ');\n\tlet stats_left_width = visibleWidth(stats_left);\n\tif (stats_left_width > width) {\n\t\tstats_left = truncateToWidth(stats_left, width, '...');\n\t\tstats_left_width = visibleWidth(stats_left);\n\t}\n\n\tconst model_name = ctx.model?.id || 'no-model';\n\tconst thinking_level = get_current_thinking_level(ctx);\n\tlet right_side_without_provider = model_name;\n\tif (ctx.model?.reasoning) {\n\t\tright_side_without_provider =\n\t\t\tthinking_level === 'off'\n\t\t\t\t? `${model_name} • thinking off`\n\t\t\t\t: `${model_name} • ${thinking_level}`;\n\t}\n\n\tlet right_side = right_side_without_provider;\n\tif (footer_data.getAvailableProviderCount() > 1 && ctx.model) {\n\t\tright_side = `(${ctx.model.provider}) ${right_side_without_provider}`;\n\t\tif (stats_left_width + 2 + visibleWidth(right_side) > width) {\n\t\t\tright_side = right_side_without_provider;\n\t\t}\n\t}\n\n\tconst right_side_width = visibleWidth(right_side);\n\tconst total_needed = stats_left_width + 2 + right_side_width;\n\tlet stats_line: string;\n\tif (total_needed <= width) {\n\t\tconst padding = ' '.repeat(\n\t\t\twidth - stats_left_width - right_side_width,\n\t\t);\n\t\tstats_line = stats_left + padding + right_side;\n\t} else {\n\t\tconst available_for_right = width - stats_left_width - 2;\n\t\tif (available_for_right > 0) {\n\t\t\tconst truncated_right = truncateToWidth(\n\t\t\t\tright_side,\n\t\t\t\tavailable_for_right,\n\t\t\t\t'',\n\t\t\t);\n\t\t\tconst truncated_right_width = visibleWidth(truncated_right);\n\t\t\tconst padding = ' '.repeat(\n\t\t\t\tMath.max(0, width - stats_left_width - truncated_right_width),\n\t\t\t);\n\t\t\tstats_line = stats_left + padding + truncated_right;\n\t\t} else {\n\t\t\tstats_line = stats_left;\n\t\t}\n\t}\n\n\tconst dim_stats_left = theme.fg('dim', stats_left);\n\tconst remainder = stats_line.slice(stats_left.length);\n\tconst dim_remainder = theme.fg('dim', remainder);\n\tconst lines = [\n\t\ttruncateToWidth(\n\t\t\ttheme.fg('dim', pwd),\n\t\t\twidth,\n\t\t\ttheme.fg('dim', '...'),\n\t\t),\n\t\tdim_stats_left + dim_remainder,\n\t];\n\n\tconst prompt_status = get_footer_prompt_status(\n\t\tactive_base_name,\n\t\tactive_layers,\n\t);\n\n\tconst other_statuses = Array.from(\n\t\tfooter_data.getExtensionStatuses().entries(),\n\t)\n\t\t.filter(([key]) => key !== 'preset')\n\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t.map(([, text]) => sanitize_status_text(text));\n\tconst combined_status_line = render_footer_status_line(\n\t\ttheme,\n\t\twidth,\n\t\tother_statuses,\n\t\tprompt_status,\n\t);\n\tif (combined_status_line) {\n\t\tlines.push(combined_status_line);\n\t}\n\n\treturn lines;\n}\n\nexport function set_status(\n\tctx: ExtensionContext,\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): void {\n\tctx.ui.setStatus('preset', undefined);\n\tif (!ctx.hasUI) return;\n\tctx.ui.setFooter((tui, theme, footer_data) => {\n\t\tconst unsubscribe = footer_data.onBranchChange(() =>\n\t\t\ttui.requestRender(),\n\t\t);\n\t\treturn {\n\t\t\tdispose: unsubscribe,\n\t\t\tinvalidate() {},\n\t\t\trender(width: number) {\n\t\t\t\treturn render_footer_lines(\n\t\t\t\t\tctx,\n\t\t\t\t\ttheme,\n\t\t\t\t\tfooter_data,\n\t\t\t\t\twidth,\n\t\t\t\t\tactive_base_name,\n\t\t\t\t\tactive_layers,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t});\n}\n","import { getAgentDir } from '@mariozechner/pi-coding-agent';\nimport {\n\texistsSync,\n\tmkdirSync,\n\treaddirSync,\n\treadFileSync,\n\trenameSync,\n\tunlinkSync,\n\twriteFileSync,\n} from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { DEFAULT_PROMPT_PRESETS } from './defaults.js';\nimport type {\n\tLoadedPromptPreset,\n\tPromptPreset,\n\tPromptPresetMap,\n\tPromptPresetSource,\n\tPromptPresetState,\n} from './types.js';\n\nconst PROJECT_PROMPT_PRESETS_ENV = 'MY_PI_PROMPT_PRESETS_PROJECT';\n\ninterface PersistedPromptPresetStates {\n\tversion: number;\n\tprojects: Record<string, PromptPresetState>;\n}\n\nexport function normalize_prompt_presets(\n\tinput: unknown,\n): PromptPresetMap {\n\tif (!input || typeof input !== 'object') return {};\n\n\tconst normalized: PromptPresetMap = {};\n\tfor (const [raw_name, raw_value] of Object.entries(input)) {\n\t\tconst name = raw_name.trim();\n\t\tif (!name) continue;\n\n\t\tif (typeof raw_value === 'string') {\n\t\t\tnormalized[name] = {\n\t\t\t\tkind: 'base',\n\t\t\t\tinstructions: raw_value,\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!raw_value || typeof raw_value !== 'object') continue;\n\t\tconst candidate = raw_value as {\n\t\t\tkind?: unknown;\n\t\t\tdescription?: unknown;\n\t\t\tinstructions?: unknown;\n\t\t};\n\t\tif (typeof candidate.instructions !== 'string') continue;\n\n\t\tnormalized[name] = {\n\t\t\tinstructions: candidate.instructions,\n\t\t\t...(candidate.kind === 'layer'\n\t\t\t\t? { kind: 'layer' as const }\n\t\t\t\t: {}),\n\t\t\t...(typeof candidate.description === 'string'\n\t\t\t\t? { description: candidate.description }\n\t\t\t\t: {}),\n\t\t};\n\t}\n\n\treturn normalized;\n}\n\nexport function merge_prompt_presets(\n\t...sources: PromptPresetMap[]\n): PromptPresetMap {\n\treturn Object.assign({}, ...sources);\n}\n\nfunction to_loaded_prompt_presets(\n\tpresets: PromptPresetMap,\n\tsource: PromptPresetSource,\n): Record<string, LoadedPromptPreset> {\n\treturn Object.fromEntries(\n\t\tObject.entries(presets).map(([name, preset]) => [\n\t\t\tname,\n\t\t\t{\n\t\t\t\tname,\n\t\t\t\tkind: preset.kind === 'layer' ? 'layer' : 'base',\n\t\t\t\tsource,\n\t\t\t\t...preset,\n\t\t\t},\n\t\t]),\n\t);\n}\n\nfunction get_global_presets_path(): string {\n\treturn join(getAgentDir(), 'presets.json');\n}\n\nfunction get_project_presets_path(cwd: string): string {\n\treturn join(cwd, '.pi', 'presets.json');\n}\n\nexport function get_global_presets_dir(): string {\n\treturn join(getAgentDir(), 'presets');\n}\n\nexport function get_project_presets_dir(cwd: string): string {\n\treturn join(cwd, '.pi', 'presets');\n}\n\nfunction sanitize_prompt_preset_file_name(name: string): string {\n\tconst sanitized = name\n\t\t.trim()\n\t\t.replace(/[\\\\/:*?\"<>|]/g, '-')\n\t\t.replace(/^\\.+$/, '')\n\t\t.replace(/^\\.+/, '')\n\t\t.replace(/\\.+$/, '');\n\tif (!sanitized) {\n\t\tthrow new Error(\n\t\t\t'Prompt preset name must contain a file-safe character',\n\t\t);\n\t}\n\treturn sanitized;\n}\n\nexport function get_prompt_preset_file_path(\n\tdir: string,\n\tname: string,\n): string {\n\treturn join(dir, `${sanitize_prompt_preset_file_name(name)}.md`);\n}\n\nfunction get_persisted_prompt_state_path(): string {\n\treturn join(getAgentDir(), 'prompt-preset-state.json');\n}\n\nfunction read_prompt_presets_file(path: string): PromptPresetMap {\n\tif (!existsSync(path)) return {};\n\n\ttry {\n\t\treturn normalize_prompt_presets(\n\t\t\tJSON.parse(readFileSync(path, 'utf-8')),\n\t\t);\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction unquote_frontmatter_value(value: string): string {\n\tconst trimmed = value.trim();\n\tif (trimmed.startsWith('\"') && trimmed.endsWith('\"')) {\n\t\ttry {\n\t\t\treturn JSON.parse(trimmed) as string;\n\t\t} catch {\n\t\t\treturn trimmed.slice(1, -1);\n\t\t}\n\t}\n\tif (trimmed.startsWith(\"'\") && trimmed.endsWith(\"'\")) {\n\t\treturn trimmed.slice(1, -1);\n\t}\n\treturn trimmed;\n}\n\nfunction parse_prompt_preset_markdown(content: string): {\n\tmetadata: Record<string, string>;\n\tbody: string;\n} {\n\tconst normalized = content.replace(/\\r\\n/g, '\\n');\n\tif (!normalized.startsWith('---\\n')) {\n\t\treturn { metadata: {}, body: normalized.trim() };\n\t}\n\n\tconst lines = normalized.split('\\n');\n\tconst end = lines.findIndex(\n\t\t(line, index) => index > 0 && line.trim() === '---',\n\t);\n\tif (end === -1) {\n\t\treturn { metadata: {}, body: normalized.trim() };\n\t}\n\n\tconst metadata: Record<string, string> = {};\n\tfor (const line of lines.slice(1, end)) {\n\t\tconst separator = line.indexOf(':');\n\t\tif (separator === -1) continue;\n\t\tconst key = line.slice(0, separator).trim().toLowerCase();\n\t\tconst value = line.slice(separator + 1).trim();\n\t\tif (!key) continue;\n\t\tmetadata[key] = unquote_frontmatter_value(value);\n\t}\n\n\treturn {\n\t\tmetadata,\n\t\tbody: lines\n\t\t\t.slice(end + 1)\n\t\t\t.join('\\n')\n\t\t\t.trim(),\n\t};\n}\n\nexport function read_prompt_presets_dir(\n\tpath: string,\n): PromptPresetMap {\n\tif (!existsSync(path)) return {};\n\n\ttry {\n\t\tconst presets: PromptPresetMap = {};\n\t\tfor (const entry of readdirSync(path, { withFileTypes: true })\n\t\t\t.filter((item) => item.isFile() && item.name.endsWith('.md'))\n\t\t\t.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tconst name = entry.name.slice(0, -3).trim();\n\t\t\tif (!name) continue;\n\t\t\tconst { metadata, body } = parse_prompt_preset_markdown(\n\t\t\t\treadFileSync(join(path, entry.name), 'utf-8'),\n\t\t\t);\n\t\t\tif (!body) continue;\n\t\t\tpresets[name] = {\n\t\t\t\tkind: metadata.kind === 'layer' ? 'layer' : 'base',\n\t\t\t\tinstructions: body,\n\t\t\t\t...(metadata.description\n\t\t\t\t\t? { description: metadata.description }\n\t\t\t\t\t: {}),\n\t\t\t};\n\t\t}\n\t\treturn presets;\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction format_prompt_preset_markdown(preset: PromptPreset): string {\n\tconst lines = [\n\t\t'---',\n\t\t`kind: ${preset.kind === 'layer' ? 'layer' : 'base'}`,\n\t];\n\tif (preset.description?.trim()) {\n\t\tlines.push(\n\t\t\t`description: ${JSON.stringify(preset.description.trim())}`,\n\t\t);\n\t}\n\tlines.push('---', '', preset.instructions.trim(), '');\n\treturn lines.join('\\n');\n}\n\nexport function save_prompt_preset_file(\n\tdir: string,\n\tname: string,\n\tpreset: PromptPreset,\n): string {\n\tif (!existsSync(dir)) {\n\t\tmkdirSync(dir, { recursive: true, mode: 0o700 });\n\t}\n\n\tconst path = get_prompt_preset_file_path(dir, name);\n\tconst tmp = `${path}.tmp-${Date.now()}`;\n\twriteFileSync(tmp, format_prompt_preset_markdown(preset), {\n\t\tmode: 0o600,\n\t});\n\trenameSync(tmp, path);\n\treturn path;\n}\n\nexport function save_project_prompt_preset_file(\n\tcwd: string,\n\tname: string,\n\tpreset: PromptPreset,\n): string {\n\treturn save_prompt_preset_file(\n\t\tget_project_presets_dir(cwd),\n\t\tname,\n\t\tpreset,\n\t);\n}\n\nexport function save_global_prompt_preset_file(\n\tname: string,\n\tpreset: PromptPreset,\n): string {\n\treturn save_prompt_preset_file(\n\t\tget_global_presets_dir(),\n\t\tname,\n\t\tpreset,\n\t);\n}\n\nfunction should_load_project_prompt_presets(): boolean {\n\tconst normalized = process.env[PROJECT_PROMPT_PRESETS_ENV]\n\t\t?.trim()\n\t\t.toLowerCase();\n\treturn !['0', 'false', 'no', 'skip', 'disable'].includes(\n\t\tnormalized ?? '',\n\t);\n}\n\nexport function load_prompt_presets(\n\tcwd: string,\n): Record<string, LoadedPromptPreset> {\n\treturn Object.assign(\n\t\t{},\n\t\tto_loaded_prompt_presets(DEFAULT_PROMPT_PRESETS, 'builtin'),\n\t\tto_loaded_prompt_presets(\n\t\t\tread_prompt_presets_file(get_global_presets_path()),\n\t\t\t'user',\n\t\t),\n\t\tto_loaded_prompt_presets(\n\t\t\tread_prompt_presets_dir(get_global_presets_dir()),\n\t\t\t'user',\n\t\t),\n\t\t...(should_load_project_prompt_presets()\n\t\t\t? [\n\t\t\t\t\tto_loaded_prompt_presets(\n\t\t\t\t\t\tread_prompt_presets_file(get_project_presets_path(cwd)),\n\t\t\t\t\t\t'project',\n\t\t\t\t\t),\n\t\t\t\t\tto_loaded_prompt_presets(\n\t\t\t\t\t\tread_prompt_presets_dir(get_project_presets_dir(cwd)),\n\t\t\t\t\t\t'project',\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t: []),\n\t);\n}\n\nfunction sort_prompt_presets(\n\tpresets: PromptPresetMap,\n): PromptPresetMap {\n\treturn Object.fromEntries(\n\t\tObject.entries(presets).sort(([a], [b]) => a.localeCompare(b)),\n\t);\n}\n\nexport function save_project_prompt_presets(\n\tcwd: string,\n\tpresets: PromptPresetMap,\n): string {\n\tconst path = get_project_presets_path(cwd);\n\tconst dir = dirname(path);\n\tif (!existsSync(dir)) {\n\t\tmkdirSync(dir, { recursive: true, mode: 0o700 });\n\t}\n\n\tconst tmp = `${path}.tmp-${Date.now()}`;\n\twriteFileSync(\n\t\ttmp,\n\t\tJSON.stringify(sort_prompt_presets(presets), null, '\\t') + '\\n',\n\t\t{ mode: 0o600 },\n\t);\n\trenameSync(tmp, path);\n\treturn path;\n}\n\nexport function remove_project_prompt_preset(\n\tcwd: string,\n\tname: string,\n): {\n\tremoved: boolean;\n\tpath: string;\n\tremaining: number;\n} {\n\tconst json_path = get_project_presets_path(cwd);\n\tconst project_presets = read_prompt_presets_file(json_path);\n\tlet removed = false;\n\tlet removed_path = json_path;\n\n\tif (name in project_presets) {\n\t\tdelete project_presets[name];\n\t\tremoved = true;\n\t\tremoved_path = json_path;\n\t\tif (Object.keys(project_presets).length === 0) {\n\t\t\tif (existsSync(json_path)) {\n\t\t\t\tunlinkSync(json_path);\n\t\t\t}\n\t\t} else {\n\t\t\tsave_project_prompt_presets(cwd, project_presets);\n\t\t}\n\t}\n\n\tconst file_path = get_prompt_preset_file_path(\n\t\tget_project_presets_dir(cwd),\n\t\tname,\n\t);\n\tif (existsSync(file_path)) {\n\t\tunlinkSync(file_path);\n\t\tremoved = true;\n\t\tremoved_path = file_path;\n\t}\n\n\tconst remaining =\n\t\tObject.keys(read_prompt_presets_file(json_path)).length +\n\t\tObject.keys(read_prompt_presets_dir(get_project_presets_dir(cwd)))\n\t\t\t.length;\n\n\treturn { removed, path: removed_path, remaining };\n}\n\nfunction normalize_prompt_preset_state(\n\tinput: unknown,\n): PromptPresetState | undefined {\n\tif (!input || typeof input !== 'object') return undefined;\n\n\tconst candidate = input as {\n\t\tbase_name?: unknown;\n\t\tlayer_names?: unknown;\n\t};\n\tconst base_name =\n\t\ttypeof candidate.base_name === 'string' &&\n\t\tcandidate.base_name.trim()\n\t\t\t? candidate.base_name.trim()\n\t\t\t: null;\n\tconst layer_names = Array.isArray(candidate.layer_names)\n\t\t? [\n\t\t\t\t...new Set(\n\t\t\t\t\tcandidate.layer_names\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t(value): value is string =>\n\t\t\t\t\t\t\t\ttypeof value === 'string' && value.trim().length > 0,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.map((value) => value.trim()),\n\t\t\t\t),\n\t\t\t].sort()\n\t\t: [];\n\n\treturn {\n\t\tbase_name,\n\t\tlayer_names,\n\t};\n}\n\nfunction read_persisted_prompt_states(\n\tpath = get_persisted_prompt_state_path(),\n): PersistedPromptPresetStates {\n\tif (!existsSync(path)) {\n\t\treturn { version: 1, projects: {} };\n\t}\n\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(path, 'utf-8')) as {\n\t\t\tversion?: unknown;\n\t\t\tprojects?: unknown;\n\t\t};\n\t\tconst raw_projects =\n\t\t\tparsed.projects && typeof parsed.projects === 'object'\n\t\t\t\t? parsed.projects\n\t\t\t\t: {};\n\t\tconst projects: Record<string, PromptPresetState> = {};\n\t\tfor (const [cwd, value] of Object.entries(raw_projects)) {\n\t\t\tconst normalized = normalize_prompt_preset_state(value);\n\t\t\tif (!normalized) continue;\n\t\t\tprojects[cwd] = normalized;\n\t\t}\n\t\treturn {\n\t\t\tversion:\n\t\t\t\ttypeof parsed.version === 'number' ? parsed.version : 1,\n\t\t\tprojects,\n\t\t};\n\t} catch {\n\t\treturn { version: 1, projects: {} };\n\t}\n}\n\nexport function load_persisted_prompt_state(\n\tcwd: string,\n\tpath = get_persisted_prompt_state_path(),\n): PromptPresetState | undefined {\n\treturn read_persisted_prompt_states(path).projects[cwd];\n}\n\nexport function save_persisted_prompt_state(\n\tcwd: string,\n\tstate: PromptPresetState,\n\tpath = get_persisted_prompt_state_path(),\n): string {\n\tconst persisted = read_persisted_prompt_states(path);\n\tpersisted.projects[cwd] = normalize_prompt_preset_state(state) ?? {\n\t\tbase_name: null,\n\t\tlayer_names: [],\n\t};\n\n\tconst dir = dirname(path);\n\tif (!existsSync(dir)) {\n\t\tmkdirSync(dir, { recursive: true, mode: 0o700 });\n\t}\n\n\tconst tmp = `${path}.tmp-${Date.now()}`;\n\twriteFileSync(\n\t\ttmp,\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tversion: 1,\n\t\t\t\tprojects: Object.fromEntries(\n\t\t\t\t\tObject.entries(persisted.projects).sort(([a], [b]) =>\n\t\t\t\t\t\ta.localeCompare(b),\n\t\t\t\t\t),\n\t\t\t\t),\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\trenameSync(tmp, path);\n\treturn path;\n}\n","import {\n\ttype ExtensionAPI,\n\ttype ExtensionCommandContext,\n\ttype ExtensionContext,\n} from '@mariozechner/pi-coding-agent';\nimport type { SettingItem } from '@mariozechner/pi-tui';\nimport { show_settings_modal } from '@spences10/pi-tui-modal';\nimport { existsSync } from 'node:fs';\nimport {\n\tformat_active_details,\n\tformat_summary,\n\tget_prompt_source_label,\n\tlist_base_presets,\n\tlist_layer_presets,\n} from './catalog.js';\nimport {\n\tDEFAULT_BASE_PROMPT_PRESET_NAME,\n\tDEFAULT_PROMPT_PRESETS,\n} from './defaults.js';\nimport { set_status } from './footer.js';\nimport {\n\tget_global_presets_dir,\n\tget_project_presets_dir,\n\tget_prompt_preset_file_path,\n\tload_persisted_prompt_state,\n\tload_prompt_presets,\n\tremove_project_prompt_preset,\n\tsave_global_prompt_preset_file,\n\tsave_persisted_prompt_state,\n\tsave_project_prompt_preset_file,\n\tsave_prompt_preset_file,\n} from './storage.js';\nimport type {\n\tLoadedPromptPreset,\n\tPromptPresetKind,\n\tPromptPresetState,\n} from './types.js';\n\nexport {\n\tDEFAULT_BASE_PROMPT_PRESET_NAME,\n\tDEFAULT_PROMPT_PRESETS,\n} from './defaults.js';\nexport {\n\tget_current_thinking_level,\n\tget_default_footer_thinking_level,\n\trender_footer_status_line,\n} from './footer.js';\nexport {\n\tload_persisted_prompt_state,\n\tload_prompt_presets,\n\tmerge_prompt_presets,\n\tnormalize_prompt_presets,\n\tread_prompt_presets_dir,\n\tremove_project_prompt_preset,\n\tsave_persisted_prompt_state,\n\tsave_project_prompt_presets,\n\tsave_prompt_preset_file,\n} from './storage.js';\nexport type {\n\tLoadedPromptPreset,\n\tPromptPreset,\n\tPromptPresetKind,\n\tPromptPresetMap,\n\tPromptPresetSource,\n\tPromptPresetState,\n} from './types.js';\n\nconst PRESET_STATE_TYPE = 'prompt-preset-state';\nconst ENABLED = '● enabled';\nconst DISABLED = '○ disabled';\nconst SELECTED = '● selected';\nconst UNSELECTED = '○';\nconst NONE_BASE_ID = '__base_none__';\n\nfunction get_last_preset_state(\n\tctx: ExtensionContext,\n): PromptPresetState | undefined {\n\tconst entries = ctx.sessionManager.getEntries();\n\tfor (let i = entries.length - 1; i >= 0; i--) {\n\t\tconst entry = entries[i] as {\n\t\t\ttype?: string;\n\t\t\tcustomType?: string;\n\t\t\tdata?: PromptPresetState;\n\t\t};\n\t\tif (\n\t\t\tentry.type === 'custom' &&\n\t\t\tentry.customType === PRESET_STATE_TYPE &&\n\t\t\tentry.data\n\t\t) {\n\t\t\treturn entry.data;\n\t\t}\n\t}\n\treturn undefined;\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 persist_state(\n\tpi: ExtensionAPI,\n\tctx: ExtensionContext,\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): void {\n\tconst state = {\n\t\tbase_name: active_base_name ?? null,\n\t\tlayer_names: [...active_layers].sort(),\n\t};\n\tpi.appendEntry(PRESET_STATE_TYPE, state);\n\tsave_persisted_prompt_state(ctx.cwd, state);\n}\n\nfunction normalize_active_state(\n\tpresets: Record<string, LoadedPromptPreset>,\n\tactive_base_name: string | undefined,\n\tactive_layers: ReadonlySet<string>,\n): {\n\tactive_base_name: string | undefined;\n\tactive_layers: Set<string>;\n} {\n\tconst next_base_name =\n\t\tactive_base_name && presets[active_base_name]?.kind === 'base'\n\t\t\t? active_base_name\n\t\t\t: undefined;\n\tconst next_layers = new Set(\n\t\t[...active_layers].filter(\n\t\t\t(name) => presets[name]?.kind === 'layer',\n\t\t),\n\t);\n\treturn {\n\t\tactive_base_name: next_base_name,\n\t\tactive_layers: next_layers,\n\t};\n}\n\nfunction parse_preset_flag(flag: string): string[] {\n\treturn flag\n\t\t.split(',')\n\t\t.map((item) => item.trim())\n\t\t.filter(Boolean);\n}\n\nfunction is_subcommand(command: string): boolean {\n\treturn [\n\t\t'help',\n\t\t'list',\n\t\t'show',\n\t\t'clear',\n\t\t'edit',\n\t\t'edit-global',\n\t\t'export-defaults',\n\t\t'delete',\n\t\t'reset',\n\t\t'reload',\n\t\t'base',\n\t\t'enable',\n\t\t'disable',\n\t\t'toggle',\n\t].includes(command);\n}\n\nfunction format_prompt_preset_help(): string {\n\treturn `Prompt presets append instructions to the system prompt.\n\nCommands:\n- /prompt-preset Open the preset picker\n- /prompt-preset show Show the active base and layers\n- /prompt-preset <name> Activate a base preset or toggle a layer\n- /prompt-preset base <name> Activate a base preset\n- /prompt-preset enable <layer> Enable a layer\n- /prompt-preset disable <layer> Disable a layer\n- /prompt-preset edit <name> Edit/create .pi/presets/<name>.md\n- /prompt-preset edit-global <name> Edit/create ~/.pi/agent/presets/<name>.md\n- /prompt-preset export-defaults Export built-ins to ~/.pi/agent/presets/*.md\n- /prompt-preset export-defaults project Export built-ins to .pi/presets/*.md\n- /prompt-preset reload Reload presets after manual file edits\n- /prompt-preset clear Clear active base and layers\n\nExamples:\n- /prompt-preset export-defaults\n- /prompt-preset edit-global terse\n- /prompt-preset base detailed\n- /prompt-preset enable bullets\n- /prompt-preset show\n\nAlias: /preset`;\n}\n\nexport default async function prompt_presets(pi: ExtensionAPI) {\n\tlet presets: Record<string, LoadedPromptPreset> = {};\n\tlet active_base_name: string | undefined;\n\tlet active_layers = new Set<string>();\n\n\tfunction get_base(\n\t\tname: string | undefined,\n\t): LoadedPromptPreset | undefined {\n\t\treturn name ? presets[name] : undefined;\n\t}\n\n\tfunction get_layer(name: string): LoadedPromptPreset | undefined {\n\t\tconst preset = presets[name];\n\t\treturn preset?.kind === 'layer' ? preset : undefined;\n\t}\n\n\tfunction commit_state(\n\t\tctx: ExtensionContext,\n\t\tnext_base_name: string | undefined,\n\t\tnext_layers: ReadonlySet<string>,\n\t\toptions?: { persist?: boolean; notify?: string },\n\t): void {\n\t\tactive_base_name = next_base_name;\n\t\tactive_layers = new Set(next_layers);\n\t\tset_status(ctx, active_base_name, active_layers);\n\t\tif (options?.persist !== false) {\n\t\t\tpersist_state(pi, ctx, active_base_name, active_layers);\n\t\t}\n\t\tif (options?.notify) {\n\t\t\tctx.ui.notify(options.notify, 'info');\n\t\t}\n\t}\n\n\tfunction activate_base(\n\t\tname: string | undefined,\n\t\tctx: ExtensionContext,\n\t\toptions?: { persist?: boolean },\n\t): boolean {\n\t\tif (!name) {\n\t\t\tcommit_state(ctx, undefined, active_layers, {\n\t\t\t\tpersist: options?.persist,\n\t\t\t\tnotify: 'Base preset cleared',\n\t\t\t});\n\t\t\treturn true;\n\t\t}\n\n\t\tconst preset = get_base(name);\n\t\tif (!preset) {\n\t\t\tctx.ui.notify(`Unknown base preset: ${name}`, 'warning');\n\t\t\treturn false;\n\t\t}\n\n\t\tcommit_state(ctx, preset.name, active_layers, {\n\t\t\tpersist: options?.persist,\n\t\t\tnotify: `Base preset \"${preset.name}\" activated`,\n\t\t});\n\t\treturn true;\n\t}\n\n\tfunction set_layer_enabled(\n\t\tname: string,\n\t\tenabled: boolean,\n\t\tctx: ExtensionContext,\n\t\toptions?: { persist?: boolean },\n\t): boolean {\n\t\tconst preset = get_layer(name);\n\t\tif (!preset) {\n\t\t\tctx.ui.notify(`Unknown prompt layer: ${name}`, 'warning');\n\t\t\treturn false;\n\t\t}\n\n\t\tconst next_layers = new Set(active_layers);\n\t\tif (enabled) {\n\t\t\tnext_layers.add(preset.name);\n\t\t} else {\n\t\t\tnext_layers.delete(preset.name);\n\t\t}\n\n\t\tcommit_state(ctx, active_base_name, next_layers, {\n\t\t\tpersist: options?.persist,\n\t\t\tnotify: enabled\n\t\t\t\t? `Layer \"${preset.name}\" enabled`\n\t\t\t\t: `Layer \"${preset.name}\" disabled`,\n\t\t});\n\t\treturn true;\n\t}\n\n\tfunction toggle_layer(\n\t\tname: string,\n\t\tctx: ExtensionContext,\n\t\toptions?: { persist?: boolean },\n\t): boolean {\n\t\treturn set_layer_enabled(\n\t\t\tname,\n\t\t\t!active_layers.has(name),\n\t\t\tctx,\n\t\t\toptions,\n\t\t);\n\t}\n\n\tasync function edit_preset(\n\t\tname: string,\n\t\tctx: ExtensionCommandContext,\n\t\tscope: 'project' | 'global' = 'project',\n\t): Promise<void> {\n\t\tconst existing = presets[name];\n\t\tconst kind_choice = await ctx.ui.select('Preset kind', [\n\t\t\texisting?.kind === 'layer'\n\t\t\t\t? 'layer (current)'\n\t\t\t\t: 'base (current)',\n\t\t\texisting?.kind === 'layer' ? 'base' : 'layer',\n\t\t]);\n\t\tif (!kind_choice) return;\n\t\tconst kind: PromptPresetKind = kind_choice.startsWith('layer')\n\t\t\t? 'layer'\n\t\t\t: 'base';\n\n\t\tconst description = await ctx.ui.input(\n\t\t\t`Description for ${name}`,\n\t\t\texisting?.description ?? '',\n\t\t);\n\t\tif (description === undefined) return;\n\n\t\tconst instructions = await ctx.ui.editor(\n\t\t\t`Edit ${kind} preset: ${name}`,\n\t\t\texisting?.instructions ?? '',\n\t\t);\n\t\tif (instructions === undefined) return;\n\n\t\tconst saved_path =\n\t\t\tscope === 'global'\n\t\t\t\t? save_global_prompt_preset_file(name, {\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tinstructions,\n\t\t\t\t\t\t...(description.trim()\n\t\t\t\t\t\t\t? { description: description.trim() }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t})\n\t\t\t\t: save_project_prompt_preset_file(ctx.cwd, name, {\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tinstructions,\n\t\t\t\t\t\t...(description.trim()\n\t\t\t\t\t\t\t? { description: description.trim() }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t});\n\n\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\tconst normalized = normalize_active_state(\n\t\t\tpresets,\n\t\t\tactive_base_name,\n\t\t\tactive_layers,\n\t\t);\n\t\tactive_base_name = normalized.active_base_name;\n\t\tactive_layers = normalized.active_layers;\n\n\t\tif (kind === 'base') {\n\t\t\tactivate_base(name, ctx);\n\t\t} else {\n\t\t\tset_layer_enabled(name, true, ctx);\n\t\t}\n\t\tctx.ui.notify(`Saved preset \"${name}\" to ${saved_path}`, 'info');\n\t}\n\n\tfunction export_default_presets(\n\t\tctx: ExtensionCommandContext,\n\t\tscope: 'project' | 'global',\n\t): void {\n\t\tconst dir =\n\t\t\tscope === 'global'\n\t\t\t\t? get_global_presets_dir()\n\t\t\t\t: get_project_presets_dir(ctx.cwd);\n\t\tlet written = 0;\n\t\tlet skipped = 0;\n\t\tfor (const [name, preset] of Object.entries(\n\t\t\tDEFAULT_PROMPT_PRESETS,\n\t\t)) {\n\t\t\tconst path = get_prompt_preset_file_path(dir, name);\n\t\t\tif (existsSync(path)) {\n\t\t\t\tskipped += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tsave_prompt_preset_file(dir, name, preset);\n\t\t\twritten += 1;\n\t\t}\n\n\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\tconst normalized = normalize_active_state(\n\t\t\tpresets,\n\t\t\tactive_base_name,\n\t\t\tactive_layers,\n\t\t);\n\t\tactive_base_name = normalized.active_base_name;\n\t\tactive_layers = normalized.active_layers;\n\t\tset_status(ctx, active_base_name, active_layers);\n\n\t\tctx.ui.notify(\n\t\t\t`Exported ${written} built-in preset file(s) to ${dir}${skipped ? ` (${skipped} already existed)` : ''}`,\n\t\t\t'info',\n\t\t);\n\t}\n\n\tfunction remove_custom_preset(\n\t\tname: string,\n\t\tctx: ExtensionCommandContext,\n\t\tmode: 'delete' | 'reset',\n\t): void {\n\t\tconst result = remove_project_prompt_preset(ctx.cwd, name);\n\t\tif (!result.removed) {\n\t\t\tctx.ui.notify(\n\t\t\t\t`No project-local preset named \"${name}\" to ${mode}`,\n\t\t\t\t'warning',\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\tconst normalized = normalize_active_state(\n\t\t\tpresets,\n\t\t\tactive_base_name,\n\t\t\tactive_layers,\n\t\t);\n\t\tactive_base_name = normalized.active_base_name;\n\t\tactive_layers = normalized.active_layers;\n\t\tset_status(ctx, active_base_name, active_layers);\n\t\tpersist_state(pi, ctx, active_base_name, active_layers);\n\n\t\tconst fallback = presets[name];\n\t\tif (mode === 'reset' && fallback) {\n\t\t\tctx.ui.notify(\n\t\t\t\t`Reset \"${name}\" to ${get_prompt_source_label(fallback.source)} preset`,\n\t\t\t\t'info',\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tctx.ui.notify(\n\t\t\tresult.remaining === 0\n\t\t\t\t? `Removed \"${name}\" and deleted ${result.path}`\n\t\t\t\t: `Removed \"${name}\" from ${result.path}`,\n\t\t\t'info',\n\t\t);\n\t}\n\n\tasync function show_manager(\n\t\tctx: ExtensionCommandContext,\n\t): Promise<void> {\n\t\tconst base_presets = list_base_presets(presets);\n\t\tconst layer_presets = list_layer_presets(presets);\n\t\tif (base_presets.length === 0 && layer_presets.length === 0) {\n\t\t\tctx.ui.notify('No prompt presets available', 'warning');\n\t\t\treturn;\n\t\t}\n\n\t\tconst initial_base = active_base_name;\n\t\tconst initial_layers = new Set(active_layers);\n\t\tlet selected_base = active_base_name;\n\t\tconst enabled_layers = new Set(active_layers);\n\n\t\tconst items: SettingItem[] = [];\n\t\tconst base_ids = new Set<string>();\n\t\tconst layer_ids = new Set<string>();\n\n\t\titems.push({\n\t\t\tid: '__header_base__',\n\t\t\tlabel: `── Base presets (${base_presets.length + 1}) ──`,\n\t\t\tdescription: '',\n\t\t\tcurrentValue: '',\n\t\t});\n\t\titems.push({\n\t\t\tid: NONE_BASE_ID,\n\t\t\tlabel: '(none)',\n\t\t\tdescription: 'No active base preset',\n\t\t\tcurrentValue: UNSELECTED,\n\t\t\tvalues: [SELECTED, UNSELECTED],\n\t\t});\n\t\tbase_ids.add(NONE_BASE_ID);\n\n\t\tfor (const preset of base_presets) {\n\t\t\titems.push({\n\t\t\t\tid: preset.name,\n\t\t\t\tlabel: preset.name,\n\t\t\t\tdescription: [\n\t\t\t\t\t`${get_prompt_source_label(preset.source)} • ${preset.description ?? 'base preset'}`,\n\t\t\t\t].join('\\n'),\n\t\t\t\tcurrentValue: UNSELECTED,\n\t\t\t\tvalues: [SELECTED, UNSELECTED],\n\t\t\t});\n\t\t\tbase_ids.add(preset.name);\n\t\t}\n\n\t\titems.push({\n\t\t\tid: '__header_layers__',\n\t\t\tlabel: `── Prompt layers (${layer_presets.length}) ──`,\n\t\t\tdescription: '',\n\t\t\tcurrentValue: '',\n\t\t});\n\t\tfor (const preset of layer_presets) {\n\t\t\titems.push({\n\t\t\t\tid: preset.name,\n\t\t\t\tlabel: preset.name,\n\t\t\t\tdescription: [\n\t\t\t\t\t`${get_prompt_source_label(preset.source)} • ${preset.description ?? 'layer'}`,\n\t\t\t\t].join('\\n'),\n\t\t\t\tcurrentValue: DISABLED,\n\t\t\t\tvalues: [ENABLED, DISABLED],\n\t\t\t});\n\t\t\tlayer_ids.add(preset.name);\n\t\t}\n\n\t\tfunction sync_values() {\n\t\t\tfor (const item of items) {\n\t\t\t\tif (base_ids.has(item.id)) {\n\t\t\t\t\tconst is_selected =\n\t\t\t\t\t\t(item.id === NONE_BASE_ID && !selected_base) ||\n\t\t\t\t\t\titem.id === selected_base;\n\t\t\t\t\titem.currentValue = is_selected ? SELECTED : UNSELECTED;\n\t\t\t\t} else if (layer_ids.has(item.id)) {\n\t\t\t\t\titem.currentValue = enabled_layers.has(item.id)\n\t\t\t\t\t\t? ENABLED\n\t\t\t\t\t\t: DISABLED;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsync_values();\n\n\t\tawait show_settings_modal(ctx, {\n\t\t\ttitle: 'Prompt presets',\n\t\t\tsubtitle: () =>\n\t\t\t\t`base: ${selected_base ?? '(none)'} • ${enabled_layers.size} layer(s) enabled`,\n\t\t\titems,\n\t\t\tmax_visible: Math.min(Math.max(items.length + 4, 8), 24),\n\t\t\tenable_search: true,\n\t\t\ton_change: (id, new_value) => {\n\t\t\t\tif (id.startsWith('__header_')) return;\n\n\t\t\t\tif (base_ids.has(id)) {\n\t\t\t\t\tselected_base =\n\t\t\t\t\t\tnew_value === SELECTED && id !== NONE_BASE_ID\n\t\t\t\t\t\t\t? id\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\tsync_values();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (layer_ids.has(id)) {\n\t\t\t\t\tif (new_value === ENABLED) {\n\t\t\t\t\t\tenabled_layers.add(id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tenabled_layers.delete(id);\n\t\t\t\t\t}\n\t\t\t\t\tsync_values();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tif (\n\t\t\tselected_base !== initial_base ||\n\t\t\t!sets_equal(initial_layers, enabled_layers)\n\t\t) {\n\t\t\tcommit_state(ctx, selected_base, enabled_layers, {\n\t\t\t\tnotify: 'Updated prompt preset selection',\n\t\t\t});\n\t\t}\n\t}\n\n\tpi.registerFlag('preset', {\n\t\tdescription:\n\t\t\t'Activate prompt config on startup. Accepts a base preset or comma-separated preset/layer names.',\n\t\ttype: 'string',\n\t});\n\n\tconst prompt_preset_command: Parameters<\n\t\tExtensionAPI['registerCommand']\n\t>[1] = {\n\t\tdescription:\n\t\t\t'Manage prompt presets and layers. Try: /prompt-preset help, /prompt-preset export-defaults, /prompt-preset edit-global terse',\n\t\tgetArgumentCompletions: (prefix) => {\n\t\t\tconst trimmed = prefix.trim();\n\t\t\tconst parts = trimmed ? trimmed.split(/\\s+/) : [];\n\t\t\tconst base_names = list_base_presets(presets).map(\n\t\t\t\t(preset) => preset.name,\n\t\t\t);\n\t\t\tconst layer_names = list_layer_presets(presets).map(\n\t\t\t\t(preset) => preset.name,\n\t\t\t);\n\t\t\tconst all_names = [...base_names, ...layer_names];\n\n\t\t\tif (parts.length <= 1) {\n\t\t\t\tconst query = parts[0] ?? '';\n\t\t\t\tconst subcommands = [\n\t\t\t\t\t'help',\n\t\t\t\t\t'list',\n\t\t\t\t\t'show',\n\t\t\t\t\t'clear',\n\t\t\t\t\t'edit',\n\t\t\t\t\t'edit-global',\n\t\t\t\t\t'export-defaults',\n\t\t\t\t\t'delete',\n\t\t\t\t\t'reset',\n\t\t\t\t\t'reload',\n\t\t\t\t\t'base',\n\t\t\t\t\t'enable',\n\t\t\t\t\t'disable',\n\t\t\t\t\t'toggle',\n\t\t\t\t];\n\t\t\t\treturn [\n\t\t\t\t\t...subcommands\n\t\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t\t.map((item) => ({ value: item, label: item })),\n\t\t\t\t\t...all_names\n\t\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t\t.map((item) => ({ value: item, label: item })),\n\t\t\t\t];\n\t\t\t}\n\n\t\t\tconst command = parts[0];\n\t\t\tconst query = parts.slice(1).join(' ');\n\t\t\tif (command === 'base') {\n\t\t\t\treturn base_names\n\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t.map((item) => ({ value: `base ${item}`, label: item }));\n\t\t\t}\n\t\t\tif (['enable', 'disable', 'toggle'].includes(command)) {\n\t\t\t\treturn layer_names\n\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t.map((item) => ({\n\t\t\t\t\t\tvalue: `${command} ${item}`,\n\t\t\t\t\t\tlabel: item,\n\t\t\t\t\t}));\n\t\t\t}\n\t\t\tif (command === 'edit' || command === 'edit-global') {\n\t\t\t\treturn all_names\n\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t.map((item) => ({\n\t\t\t\t\t\tvalue: `${command} ${item}`,\n\t\t\t\t\t\tlabel: item,\n\t\t\t\t\t}));\n\t\t\t}\n\t\t\tif (['delete', 'reset'].includes(command)) {\n\t\t\t\treturn all_names\n\t\t\t\t\t.filter((item) => item.startsWith(query))\n\t\t\t\t\t.map((item) => ({\n\t\t\t\t\t\tvalue: `${command} ${item}`,\n\t\t\t\t\t\tlabel: item,\n\t\t\t\t\t}));\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t\thandler: async (args, ctx) => {\n\t\t\tconst trimmed = args.trim();\n\t\t\tif (!trimmed) {\n\t\t\t\tif (ctx.hasUI) {\n\t\t\t\t\tawait show_manager(ctx);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tctx.ui.notify(\n\t\t\t\t\tformat_summary(active_base_name, active_layers, presets),\n\t\t\t\t\t'info',\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [first, ...rest] = trimmed.split(/\\s+/);\n\t\t\tconst arg = rest.join(' ').trim();\n\n\t\t\tswitch (first) {\n\t\t\t\tcase 'help':\n\t\t\t\t\tctx.ui.notify(format_prompt_preset_help(), 'info');\n\t\t\t\t\treturn;\n\t\t\t\tcase 'list':\n\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\tformat_summary(active_base_name, active_layers, presets),\n\t\t\t\t\t\t'info',\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'show':\n\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\tformat_active_details(\n\t\t\t\t\t\t\tactive_base_name,\n\t\t\t\t\t\t\tactive_layers,\n\t\t\t\t\t\t\tpresets,\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'info',\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'clear':\n\t\t\t\t\tcommit_state(ctx, undefined, new Set(), {\n\t\t\t\t\t\tnotify: 'Cleared base preset and prompt layers',\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\tcase 'reload': {\n\t\t\t\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\t\t\t\tconst normalized = normalize_active_state(\n\t\t\t\t\t\tpresets,\n\t\t\t\t\t\tactive_base_name,\n\t\t\t\t\t\tactive_layers,\n\t\t\t\t\t);\n\t\t\t\t\tactive_base_name = normalized.active_base_name;\n\t\t\t\t\tactive_layers = normalized.active_layers;\n\t\t\t\t\tset_status(ctx, active_base_name, active_layers);\n\t\t\t\t\tctx.ui.notify('Reloaded prompt presets', 'info');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcase 'base':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset base <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tactivate_base(arg, ctx);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'enable':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset enable <layer> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tset_layer_enabled(arg, true, ctx);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'disable':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset disable <layer> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tset_layer_enabled(arg, false, ctx);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'toggle':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset toggle <layer> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\ttoggle_layer(arg, ctx);\n\t\t\t\t\treturn;\n\t\t\t\tcase 'edit': {\n\t\t\t\t\tlet scope: 'project' | 'global' = 'project';\n\t\t\t\t\tlet name = arg;\n\t\t\t\t\tif (arg.startsWith('--global ')) {\n\t\t\t\t\t\tscope = 'global';\n\t\t\t\t\t\tname = arg.slice('--global '.length).trim();\n\t\t\t\t\t} else if (arg.startsWith('--project ')) {\n\t\t\t\t\t\tname = arg.slice('--project '.length).trim();\n\t\t\t\t\t}\n\t\t\t\t\tif (!name) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset edit [--global|--project] <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tawait edit_preset(name, ctx, scope);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcase 'edit-global':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset edit-global <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tawait edit_preset(arg, ctx, 'global');\n\t\t\t\t\treturn;\n\t\t\t\tcase 'export-defaults': {\n\t\t\t\t\tconst scope = arg || 'global';\n\t\t\t\t\tif (scope !== 'global' && scope !== 'project') {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset export-defaults [global|project] (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\texport_default_presets(ctx, scope);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcase 'delete':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset delete <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tremove_custom_preset(arg, ctx, 'delete');\n\t\t\t\t\treturn;\n\t\t\t\tcase 'reset':\n\t\t\t\t\tif (!arg) {\n\t\t\t\t\t\tctx.ui.notify(\n\t\t\t\t\t\t\t'Usage: /prompt-preset reset <name> (alias: /preset)',\n\t\t\t\t\t\t\t'warning',\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tremove_custom_preset(arg, ctx, 'reset');\n\t\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (is_subcommand(first)) {\n\t\t\t\tctx.ui.notify(\n\t\t\t\t\t`Unsupported preset command: ${first}`,\n\t\t\t\t\t'warning',\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst preset = presets[trimmed];\n\t\t\tif (!preset) {\n\t\t\t\tctx.ui.notify(\n\t\t\t\t\t`Unknown preset or layer: ${trimmed}. Try /prompt-preset help.`,\n\t\t\t\t\t'warning',\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (preset.kind === 'base') {\n\t\t\t\tactivate_base(preset.name, ctx);\n\t\t\t} else {\n\t\t\t\ttoggle_layer(preset.name, ctx);\n\t\t\t}\n\t\t},\n\t};\n\n\tfor (const command_name of ['prompt-preset', 'preset']) {\n\t\tpi.registerCommand(command_name, prompt_preset_command);\n\t}\n\n\tpi.on('session_start', async (_event, ctx) => {\n\t\tpresets = load_prompt_presets(ctx.cwd);\n\t\tactive_base_name = undefined;\n\t\tactive_layers = new Set();\n\n\t\tconst preset_flag = pi.getFlag('preset');\n\t\tif (typeof preset_flag === 'string' && preset_flag.trim()) {\n\t\t\tfor (const name of parse_preset_flag(preset_flag)) {\n\t\t\t\tconst preset = presets[name];\n\t\t\t\tif (!preset) continue;\n\t\t\t\tif (preset.kind === 'base') {\n\t\t\t\t\tactive_base_name = name;\n\t\t\t\t} else {\n\t\t\t\t\tactive_layers.add(name);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst normalized = normalize_active_state(\n\t\t\t\tpresets,\n\t\t\t\tactive_base_name,\n\t\t\t\tactive_layers,\n\t\t\t);\n\t\t\tactive_base_name = normalized.active_base_name;\n\t\t\tactive_layers = normalized.active_layers;\n\t\t\tset_status(ctx, active_base_name, active_layers);\n\t\t\treturn;\n\t\t}\n\n\t\tconst restored = get_last_preset_state(ctx) ??\n\t\t\tload_persisted_prompt_state(ctx.cwd) ?? {\n\t\t\t\tbase_name: DEFAULT_BASE_PROMPT_PRESET_NAME,\n\t\t\t\tlayer_names: [],\n\t\t\t};\n\t\tactive_base_name = restored.base_name ?? undefined;\n\t\tactive_layers = new Set(restored.layer_names ?? []);\n\t\tconst normalized = normalize_active_state(\n\t\t\tpresets,\n\t\t\tactive_base_name,\n\t\t\tactive_layers,\n\t\t);\n\t\tactive_base_name = normalized.active_base_name;\n\t\tactive_layers = normalized.active_layers;\n\t\tset_status(ctx, active_base_name, active_layers);\n\t});\n\n\tpi.on('before_agent_start', async (event) => {\n\t\tconst blocks: string[] = [];\n\t\tconst base = get_base(active_base_name);\n\t\tif (base?.instructions.trim()) {\n\t\t\tblocks.push(\n\t\t\t\t`## Active Base Prompt: ${base.name}\\n${base.instructions.trim()}`,\n\t\t\t);\n\t\t}\n\n\t\tconst layer_blocks = [...active_layers]\n\t\t\t.sort()\n\t\t\t.map((name) => presets[name])\n\t\t\t.filter((preset): preset is LoadedPromptPreset =>\n\t\t\t\tBoolean(preset?.instructions.trim()),\n\t\t\t)\n\t\t\t.map(\n\t\t\t\t(preset) =>\n\t\t\t\t\t`### ${preset.name}\\n${preset.instructions.trim()}`,\n\t\t\t);\n\t\tif (layer_blocks.length > 0) {\n\t\t\tblocks.push(\n\t\t\t\t`## Active Prompt Layers\\n\\n${layer_blocks.join('\\n\\n')}`,\n\t\t\t);\n\t\t}\n\n\t\tif (blocks.length === 0) return;\n\t\treturn {\n\t\t\tsystemPrompt: `${event.systemPrompt}\\n\\n${blocks.join('\\n\\n')}`,\n\t\t};\n\t});\n\n\tpi.on('session_shutdown', async (_event, ctx) => {\n\t\tctx.ui.setStatus('preset', undefined);\n\t\tctx.ui.setFooter(undefined);\n\t});\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,wBACf,QACS;AACT,SAAQ,QAAR;EACC,KAAK,UACJ,QAAO;EACR,KAAK,OACJ,QAAO;EACR,KAAK,UACJ,QAAO;;;AAIV,SAAgB,kBACf,SACuB;AACvB,QAAO,OAAO,OAAO,QAAQ,CAC3B,QAAQ,WAAW,OAAO,SAAS,OAAO,CAC1C,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;;AAG/C,SAAgB,mBACf,SACuB;AACvB,QAAO,OAAO,OAAO,QAAQ,CAC3B,QAAQ,WAAW,OAAO,SAAS,QAAQ,CAC3C,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;;AAG/C,SAAgB,eACf,kBACA,eACA,SACS;CACT,MAAM,QAAQ,CAAC,SAAS,oBAAoB,WAAW;CAEvD,MAAM,cAAc,CAAC,GAAG,cAAc,CAAC,MAAM;AAC7C,KAAI,YAAY,WAAW,EAC1B,OAAM,KAAK,iBAAiB;MACtB;AACN,QAAM,KAAK,UAAU;AACrB,OAAK,MAAM,QAAQ,aAAa;GAC/B,MAAM,SAAS,QAAQ;GACvB,MAAM,cAAc,QAAQ,cACzB,MAAM,OAAO,gBACb;AACH,SAAM,KAAK,KAAK,OAAO,cAAc;;;AAIvC,QAAO,MAAM,KAAK,KAAK;;AAGxB,SAAgB,sBACf,kBACA,eACA,SACS;CACT,MAAM,QAAkB,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AI,aAAa,SAAS,EACzB,QAAO,KACN,8BAA8B,aAAa,KAAK,OAAO,GACvD;AAGF,MAAI,OAAO,WAAW,EAAG;AACzB,SAAO,EACN,cAAc,GAAG,MAAM,aAAa,MAAM,OAAO,KAAK,OAAO,IAC7D;GACA;AAEF,IAAG,GAAG,oBAAoB,OAAO,QAAQ,QAAQ;AAChD,MAAI,GAAG,UAAU,UAAU,KAAA,EAAU;AACrC,MAAI,GAAG,UAAU,KAAA,EAAU;GAC1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"description": "Composable pi coding agent with MCP, LSP, prompt presets, and local eval telemetry",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -48,22 +48,22 @@
|
|
|
48
48
|
"@mariozechner/pi-tui": "^0.72.1",
|
|
49
49
|
"citty": "^0.2.2",
|
|
50
50
|
"typebox": "^1.1.37",
|
|
51
|
-
"@spences10/pi-child-env": "0.1.3",
|
|
52
51
|
"@spences10/pi-confirm-destructive": "0.0.6",
|
|
53
|
-
"@spences10/pi-context": "0.0.
|
|
54
|
-
"@spences10/pi-
|
|
55
|
-
"@spences10/pi-mcp": "0.0.
|
|
56
|
-
"@spences10/pi-
|
|
52
|
+
"@spences10/pi-context": "0.0.4",
|
|
53
|
+
"@spences10/pi-child-env": "0.1.3",
|
|
54
|
+
"@spences10/pi-mcp": "0.0.14",
|
|
55
|
+
"@spences10/pi-lsp": "0.0.12",
|
|
57
56
|
"@spences10/pi-nopeek": "0.0.4",
|
|
58
57
|
"@spences10/pi-project-trust": "0.0.5",
|
|
59
|
-
"@spences10/pi-
|
|
58
|
+
"@spences10/pi-omnisearch": "0.0.4",
|
|
60
59
|
"@spences10/pi-redact": "0.0.4",
|
|
60
|
+
"@spences10/pi-skills": "0.0.10",
|
|
61
|
+
"@spences10/pi-recall": "0.0.4",
|
|
61
62
|
"@spences10/pi-sqlite-tools": "0.0.4",
|
|
62
|
-
"@spences10/pi-team-mode": "0.0.
|
|
63
|
-
"@spences10/pi-telemetry": "0.0.5",
|
|
63
|
+
"@spences10/pi-team-mode": "0.0.11",
|
|
64
64
|
"@spences10/pi-tui-modal": "0.0.5",
|
|
65
|
-
"@spences10/pi-
|
|
66
|
-
"@spences10/pi-
|
|
65
|
+
"@spences10/pi-themes": "0.0.4",
|
|
66
|
+
"@spences10/pi-telemetry": "0.0.5"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@changesets/cli": "^2.31.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-registry-CnQL50C2.js","names":[],"sources":["../src/extensions/builtin-registry.ts"],"sourcesContent":["import type { ExtensionFactory } from '@mariozechner/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: '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: 'filter-output',\n\t\tlabel: 'Filter output',\n\t\tdocs_label: 'Output filtering',\n\t\tdescription: 'Secret redaction for tool output',\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],\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: '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-presets', '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: '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 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: '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,iBAC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