@narumitw/pi-starship 0.63.0 → 0.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -131,7 +131,8 @@ These tool limits are not an operating-system sandbox for extension code.
131
131
  The native editor retains editing, newline, submission, and large-paste behavior.
132
132
  While the agent runs, normal submission queues a steering message for the next assistant turn; `app.message.followUp` queues a message after the current task finishes.
133
133
  The default follow-up key is Alt+Enter, or Ctrl+Q on Windows and WSL; when idle, it submits normally.
134
- Tool output starts expanded. Press Ctrl+O to collapse or expand all tool output in this conversation; this follows Pi's `app.tools.expand` keybinding and does not change the main conversation.
134
+ Tool output starts with the main conversation's current expansion setting (collapsed by default in Pi). Ctrl+O follows `app.tools.expand` and changes only this side thread; its setting is retained when returning from review or profile naming. Completed tool blocks also support native click-to-toggle behavior.
135
+ Tool arguments, progress, results, errors, and edit previews use Pi's built-in read/write/edit renderers and lifecycle. Edit previews can read only the owned draft. Native renderer rules still apply: Ctrl+O does not force an edit diff to collapse if Pi's edit renderer keeps it visible.
135
136
  Pending messages appear in gray above the editor, with a count on its upper border; the view shows at most three pending rows.
136
137
  Use `app.message.dequeue` (Alt+Up, or Alt+Q on Windows and WSL) to restore queued messages to the editor.
137
138
  These message shortcuts use Pi's configured bindings and native precedence, including explicit history actions taking priority.
@@ -139,12 +140,15 @@ The configured cancel action stops an active response and restores undelivered m
139
140
  Failed or aborted responses also restore undelivered messages without restarting automatically.
140
141
  Editor actions win conflicting cancel bindings, and Escape remains a stop fallback unless assigned to an editor action.
141
142
  Ctrl+C discards the entire flow, including when cancellation is remapped, and restores the current session's active footer.
142
- The fullscreen chat reuses Pi's native user, assistant, and tool message components, including Markdown, user-message backgrounds, and message spacing.
143
- The editor and footer preview stay at the bottom while the transcript grows above them.
143
+ The fullscreen chat uses a Starship-owned `TuiAltScreen` with Pi's native user, assistant, and tool message components, including Markdown, user-message backgrounds, and message spacing.
144
+ A native `ScrollView` holds the history; queued messages, the editor, diagnostics, and footer preview stay in a fixed bottom dock.
145
+ Use the mouse wheel or configured `tui.altScreen.*` viewport actions to scroll history, including `tui.altScreen.pageUp` and `tui.altScreen.pageDown`.
146
+ This intentionally replaces history paging through `tui.editor.pageUp` and `tui.editor.pageDown`; move custom history paging bindings to the corresponding `tui.altScreen.*` actions.
147
+ The editor retains its native editing bindings; native viewport actions take priority when bindings conflict.
144
148
  Short gray labels on the editor borders show draft status and controls.
145
149
  The full-width preview has no extra separator, with its last line at the terminal bottom, matching the saved footer's position.
146
150
  At short heights, error details yield first; if the whole preview cannot fit beside the editor, it is hidden rather than clipped.
147
- The view shows recent output with expanded, read-only tool results.
151
+ The view shows recent output with read-only tool results and the current local expansion setting.
148
152
  Choose **Continue** in the exact-draft save review; cancelling discards the temporary draft but keeps any previously saved profile.
149
153
 
150
154
  **The agent never writes the active settings file or profiles.** When idle with a valid draft, press **Ctrl+S** to save it as a profile; the gray editor-border hint shows the active save key.
@@ -157,6 +161,12 @@ Cancelling the name prompt returns to the chat without saving. Closing, discardi
157
161
  Detected changes to disk, loaded settings, or the saved profile block stale application; this is not a cross-process lock.
158
162
  Saving a repair of an invalid original document requires an explicit repair warning in the confirmation.
159
163
 
164
+ The parent TUI is suspended while the chat owns the shared terminal; only one renderer is active at a time.
165
+ Terminal ownership returns before the existing parent-hosted review, profile-name, and apply-confirmation screens open.
166
+ This intentionally deviates from Pi's guidance not to create a second terminal renderer in an extension: Starship uses a separate fullscreen host for native history scrolling and a fixed dock, with lifecycle tests required for safe ownership transfer.
167
+ It is not a claim of official support or a diagnosis or verified fix of the originally reported wheel/key failure.
168
+ See [Configuration chat runtime](https://github.com/narumiruna/pi-extensions/blob/main/packages/pi-starship/docs/configuration-chat-runtime.md) in the repository for ownership rules, verification evidence, and the maintainer's physical-terminal checklist.
169
+
160
170
  Your chat input, settings and runtime module snapshots read by the agent, local paths, and tool results are sent to the selected model provider.
161
171
  Do not include secrets in the draft or conversation.
162
172
  This flow requires TUI mode and a model whose provider supports normal tool calls; it does not load parent extensions, project instructions, MCP tools, or the main transcript into the child.
@@ -235,6 +245,7 @@ packages/pi-starship/
235
245
  │ └── pi-starship.ts # Footer lifecycle and cached refresh
236
246
  ├── dist/ # Generated Jiti runtime
237
247
  ├── scripts/build-runtime.mjs # Runtime builder
248
+ ├── docs/ # Configuration chat runtime and terminal handoff
238
249
  ├── skills/configure-pi-starship/ # Authoritative configuration skill and references
239
250
  └── test/ # Behavior and lifecycle coverage
240
251
  ```
@@ -12,7 +12,7 @@ import {
12
12
  readProfile,
13
13
  renameProfile,
14
14
  saveProfile
15
- } from "./chunk-Y24TJYG6.ts";
15
+ } from "./chunk-UIKPE4UC.ts";
16
16
  import {
17
17
  BUILT_IN_EXAMPLE,
18
18
  ConfigPublicationError,
@@ -676,4 +676,4 @@ export {
676
676
  showHistory,
677
677
  saveAsProfile
678
678
  };
679
- //# sourceMappingURL=chunk-63R6R5DH.ts.map
679
+ //# sourceMappingURL=chunk-DIHVBO5Z.ts.map
@@ -1583,4 +1583,4 @@ export {
1583
1583
  configurationMenuScreen,
1584
1584
  reloadConfiguration
1585
1585
  };
1586
- //# sourceMappingURL=chunk-Y24TJYG6.ts.map
1586
+ //# sourceMappingURL=chunk-UIKPE4UC.ts.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/profile-store.ts", "../../src/command-preview.ts", "../../src/presets/bracketed-segments.ts", "../../src/presets/catppuccin-powerline.ts", "../../src/presets/gruvbox-rainbow.ts", "../../src/presets/jetpack.ts", "../../src/presets/minimal.ts", "../../src/presets/nerd-font-symbols.ts", "../../src/presets/no-empty-icons.ts", "../../src/presets/no-nerd-font.ts", "../../src/presets/no-runtime-versions.ts", "../../src/presets/pastel-powerline.ts", "../../src/presets/plain-text-symbols.ts", "../../src/presets/pure-preset.ts", "../../src/presets/tokyo-night.ts", "../../src/presets/catalog.ts", "../../src/command-configuration.ts"],
4
- "sourcesContent": ["import { randomUUID } from \"node:crypto\";\nimport {\n type BigIntStats,\n closeSync,\n constants,\n fstatSync,\n fsyncSync,\n lstatSync,\n mkdirSync,\n openSync,\n readdirSync,\n readFileSync,\n realpathSync,\n renameSync,\n rmdirSync,\n unlinkSync,\n writeFileSync,\n} from \"node:fs\";\nimport { basename, dirname, join, parse, resolve, sep } from \"node:path\";\n\nexport interface DocumentIdentity {\n readonly dev: bigint;\n readonly ino: bigint;\n readonly size: bigint;\n readonly mtimeNs: bigint;\n readonly ctimeNs: bigint;\n}\n\nexport interface ProfileDocument {\n readonly kind: \"profile\";\n readonly name: string;\n readonly path: string;\n readonly rawDocument: string | undefined;\n readonly rawBytes: Buffer;\n readonly readError?: string;\n readonly identity: DocumentIdentity;\n}\n\nexport interface TextProfileDocument extends ProfileDocument {\n readonly rawDocument: string;\n}\n\nexport interface ArchiveReference {\n readonly name: string;\n readonly path: string;\n}\n\nexport interface HistoryDocument {\n readonly kind: \"history\";\n /** Filename, including .toml; not an arbitrary path. */\n readonly name: string;\n readonly path: string;\n /** Undefined when rawBytes are not valid UTF-8; never apply a decoded fallback. */\n readonly rawDocument: string | undefined;\n readonly rawBytes: Buffer;\n readonly readError?: string;\n readonly identity: DocumentIdentity;\n readonly legacy: boolean;\n /** ISO recovery time for new entries; local timestamp for legacy backups. */\n readonly createdAt: string;\n}\n\ntype Document = ProfileDocument | HistoryDocument;\nconst HISTORY_NAME =\n /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}\\.\\d{3}Z)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.toml$/u;\nconst LEGACY_NAME = /^pi-starship-(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})\\.toml$/u;\nconst RESERVED_NAME = /^(?:con|prn|aux|nul|com[1-9\u00B9\u00B2\u00B3]|lpt[1-9\u00B9\u00B2\u00B3]|conin\\$|conout\\$|clock\\$)(?:\\.|$)/iu;\n\n/** Normalize new names, but never trim, truncate, or replace forbidden characters. */\nexport function normalizeProfileName(value: string): string {\n const name = value.normalize(\"NFC\");\n if (\n [...name].length < 1 ||\n [...name].length > 80 ||\n name !== name.trim() ||\n name.startsWith(\".\") ||\n name.endsWith(\".\") ||\n /[\\p{Cc}\\p{Cf}\\p{Cs}<>:\"/\\\\|?*]/u.test(name) ||\n RESERVED_NAME.test(name) ||\n Buffer.byteLength(`${name}.toml`, \"utf8\") > 255\n ) {\n throw new Error(\"Invalid profile name: use 1\u201380 characters without controls, path characters, or reserved names\");\n }\n return name;\n}\n\n/** The caller supplies a trusted settings directory; its home/system symlink ancestors are valid. */\nfunction trustedDirectory(path: string): string {\n try {\n return realpathSync(path);\n } catch (error) {\n if (!isMissing(error)) throw error;\n const parent = dirname(path);\n if (parent === path) throw error;\n return join(trustedDirectory(parent), basename(path));\n }\n}\n\nfunction rootPath(settingsPath: string): string {\n return join(trustedDirectory(dirname(resolve(settingsPath))), \"pi-starship\");\n}\n\nfunction profileDirectory(settingsPath: string): string {\n return join(rootPath(settingsPath), \"profiles\");\n}\n\nfunction historyDirectory(settingsPath: string): string {\n return join(rootPath(settingsPath), \"history\");\n}\n\nfunction isMissing(error: unknown): boolean {\n return (error as NodeJS.ErrnoException).code === \"ENOENT\";\n}\n\nfunction statIfPresent(path: string): BigIntStats | undefined {\n try {\n return lstatSync(path, { bigint: true });\n } catch (error) {\n if (isMissing(error)) return undefined;\n throw error;\n }\n}\n\n/** Paths already have a canonical trusted parent; reject symlinks in every storage-owned component. */\nfunction checkedDirectory(path: string, create = false): boolean {\n const absolute = resolve(path);\n const root = parse(absolute).root;\n let current = root;\n for (const part of absolute.slice(root.length).split(sep).filter(Boolean)) {\n current = join(current, part);\n let stat = statIfPresent(current);\n let created = false;\n if (!stat && create) {\n try {\n mkdirSync(current, { mode: 0o700 });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n }\n stat = statIfPresent(current);\n created = true;\n }\n if (!stat) return false;\n if (!stat.isDirectory() || stat.isSymbolicLink()) throw new Error(`Not a safe directory: ${current}`);\n // Persist each new ancestor's directory entry, including a previously absent agent directory.\n if (created) flushDirectory(dirname(current));\n }\n return true;\n}\n\nfunction identity(stat: BigIntStats): DocumentIdentity {\n return Object.freeze({ dev: stat.dev, ino: stat.ino, size: stat.size, mtimeNs: stat.mtimeNs, ctimeNs: stat.ctimeNs });\n}\n\nfunction sameIdentity(left: DocumentIdentity, right: DocumentIdentity): boolean {\n return (\n left.dev === right.dev &&\n left.ino === right.ino &&\n left.size === right.size &&\n left.mtimeNs === right.mtimeNs &&\n left.ctimeNs === right.ctimeNs\n );\n}\n\nfunction sameFile(left: DocumentIdentity, right: BigIntStats): boolean {\n return left.dev === right.dev && left.ino === right.ino;\n}\n\nfunction encodeDocument(rawDocument: string): Buffer {\n const bytes = Buffer.from(rawDocument, \"utf8\");\n if (bytes.toString(\"utf8\") !== rawDocument) throw new Error(\"Document is not lossless UTF-8 text\");\n return bytes;\n}\n\nfunction readBytes(path: string): { rawBytes: Buffer; identity: DocumentIdentity } {\n if (!checkedDirectory(dirname(path))) throw new Error(`Document directory is missing: ${dirname(path)}`);\n const before = statIfPresent(path);\n if (!before?.isFile() || before.isSymbolicLink()) throw new Error(`Not a regular document: ${path}`);\n const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);\n try {\n const opened = fstatSync(fd, { bigint: true });\n if (!opened.isFile() || !sameIdentity(identity(before), identity(opened))) {\n throw new Error(`Document changed while opening: ${path}`);\n }\n const bytes = readFileSync(fd);\n const after = fstatSync(fd, { bigint: true });\n const published = statIfPresent(path);\n if (\n !sameIdentity(identity(opened), identity(after)) ||\n !published ||\n !sameIdentity(identity(after), identity(published))\n ) {\n throw new Error(`Document changed while reading: ${path}`);\n }\n return { rawBytes: bytes, identity: identity(after) };\n } finally {\n closeSync(fd);\n }\n}\n\nexport function readProfile(settingsPath: string, name: string): ProfileDocument {\n const normalized = normalizeProfileName(name);\n const path = join(profileDirectory(settingsPath), `${normalized}.toml`);\n const document = readBytes(path);\n const decoded = document.rawBytes.toString(\"utf8\");\n const valid = Buffer.from(decoded, \"utf8\").equals(document.rawBytes);\n return Object.freeze({\n kind: \"profile\",\n name: normalized,\n path,\n ...document,\n rawDocument: valid ? decoded : undefined,\n ...(valid ? {} : { readError: \"Profile document is not valid UTF-8; raw bytes are preserved\" }),\n });\n}\n\n/** Reject a removed, replaced, or edited profile before applying its reviewed snapshot. */\nexport function assertProfileUnchanged(settingsPath: string, expected: ProfileDocument): void {\n assertExpected(readProfile(settingsPath, expected.name), expected);\n}\n\nexport function listProfiles(settingsPath: string): ProfileDocument[] {\n const directory = profileDirectory(settingsPath);\n if (!checkedDirectory(directory)) return [];\n const profiles: ProfileDocument[] = [];\n for (const filename of readdirSync(directory).sort()) {\n if (!filename.endsWith(\".toml\")) continue;\n const name = filename.slice(0, -5);\n try {\n if (normalizeProfileName(name) !== name) continue;\n } catch {\n continue;\n }\n const stat = statIfPresent(join(directory, filename));\n if (!stat?.isFile() || stat.isSymbolicLink()) continue;\n profiles.push(readProfile(settingsPath, name));\n }\n return profiles;\n}\n\n/**\n * Sync mutations cannot interleave in one JS thread. This directory lock also coordinates\n * cooperating store callers in other processes. Contention fails instead of blocking the event\n * loop. A crashed owner's lock requires explicit manual recovery; never guess that a lock is stale.\n * Node has no portable rename-no-replace operation. Collision checks + rename under this lock\n * prevent cooperative clobbering, NOT races with external editors or directory replacement.\n * There is no portable openat/renameat API here; external directory TOCTOU remains as well.\n */\nfunction mutate<T>(settingsPath: string, operation: () => T): T {\n const root = rootPath(settingsPath);\n checkedDirectory(root, true);\n const lock = join(root, \".mutation-lock\");\n try {\n mkdirSync(lock, { mode: 0o700 });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"EEXIST\") {\n throw new Error(`Profile/history storage is locked; inspect the owner before manually removing ${lock}`);\n }\n throw error;\n }\n const owned = lstatSync(lock, { bigint: true });\n let result!: T;\n let operationError: unknown;\n let failed = false;\n try {\n result = operation();\n } catch (error) {\n failed = true;\n operationError = error;\n }\n try {\n const current = statIfPresent(lock);\n if (current?.isDirectory() && sameFile(identity(owned), current)) rmdirSync(lock);\n } catch (error) {\n if (failed) throw new AggregateError([operationError, error], `Mutation and lock cleanup failed at ${lock}`);\n throw new Error(`Mutation completed but lock cleanup failed at ${lock}`, { cause: error });\n }\n if (failed) throw operationError;\n return result;\n}\n\n/** Conservative Unicode caseless key, including expansions such as \u00DF -> ss and final sigma. */\nfunction collisionKey(name: string): string {\n // A second pass includes uppercase sharp S (\u1E9E -> \u00DF -> ss).\n return name.normalize(\"NFC\").toUpperCase().toLowerCase().toUpperCase().toLowerCase().normalize(\"NFC\");\n}\n\nfunction assertAvailable(directory: string, filename: string): void {\n const key = collisionKey(filename);\n if (readdirSync(directory).some((entry) => collisionKey(entry) === key)) {\n throw new Error(`Document name already exists: ${filename}`);\n }\n}\n\nfunction assertExpected<T extends Document>(current: T, expected: T): void {\n if (\n current.kind !== expected.kind ||\n current.path !== expected.path ||\n current.name !== expected.name ||\n current.rawDocument !== expected.rawDocument ||\n !current.rawBytes.equals(expected.rawBytes) ||\n !sameIdentity(current.identity, expected.identity)\n ) {\n throw new Error(`Document changed since review: ${current.path}`);\n }\n}\n\nfunction flushDirectory(path: string): void {\n // Windows does not support opening/fsyncing directories through this API.\n // File flushing still applies; directory-entry crash durability is POSIX-only.\n if (process.platform === \"win32\") return;\n checkedDirectory(path);\n const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_DIRECTORY);\n try {\n fsyncSync(fd);\n } finally {\n closeSync(fd);\n }\n}\n\nfunction flushMutation(directory: string, path: string): void {\n try {\n flushDirectory(directory);\n } catch (error) {\n throw new Error(`Mutation completed at ${path}, but directory flush failed: ${String(error)}`, { cause: error });\n }\n}\n\n/** Published files are never removed on a subsequent flush/read failure. */\nfunction publish(directory: string, filename: string, bytes: Buffer, beforeRename: () => void): void {\n const temporary = join(directory, `.tmp-${randomUUID()}`);\n const fd = openSync(\n temporary,\n constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW,\n 0o600,\n );\n const owned = fstatSync(fd, { bigint: true });\n let open = true;\n try {\n writeFileSync(fd, bytes);\n fsyncSync(fd);\n closeSync(fd);\n open = false;\n checkedDirectory(directory);\n beforeRename();\n const destination = join(directory, filename);\n renameSync(temporary, destination);\n flushMutation(directory, destination);\n } finally {\n try {\n if (open) closeSync(fd);\n } finally {\n const current = statIfPresent(temporary);\n if (current && sameFile(identity(owned), current)) unlinkSync(temporary);\n }\n }\n}\n\nfunction readTextProfile(settingsPath: string, name: string): TextProfileDocument {\n const document = readProfile(settingsPath, name);\n if (document.rawDocument === undefined) throw new Error(document.readError);\n return { ...document, rawDocument: document.rawDocument };\n}\n\nexport function createProfile(settingsPath: string, name: string, rawDocument: string): TextProfileDocument {\n const normalized = normalizeProfileName(name);\n const bytes = encodeDocument(rawDocument);\n return mutate(settingsPath, () => {\n const directory = profileDirectory(settingsPath);\n checkedDirectory(directory, true);\n const filename = `${normalized}.toml`;\n assertAvailable(directory, filename);\n publish(directory, filename, bytes, () => assertAvailable(directory, filename));\n return readTextProfile(settingsPath, normalized);\n });\n}\n\nexport function duplicateProfile(\n settingsPath: string,\n name: string,\n newName: string,\n expected: ProfileDocument,\n): ProfileDocument {\n const normalized = normalizeProfileName(newName);\n return mutate(settingsPath, () => {\n const current = readProfile(settingsPath, name);\n assertExpected(current, expected);\n const directory = profileDirectory(settingsPath);\n const filename = `${normalized}.toml`;\n assertAvailable(directory, filename);\n publish(directory, filename, current.rawBytes, () => {\n assertExpected(readProfile(settingsPath, name), expected);\n assertAvailable(directory, filename);\n });\n return readProfile(settingsPath, normalized);\n });\n}\n\nexport function saveProfile(\n settingsPath: string,\n name: string,\n rawDocument: string,\n expected: ProfileDocument,\n): TextProfileDocument {\n const normalized = normalizeProfileName(name);\n const bytes = encodeDocument(rawDocument);\n return mutate(settingsPath, () => {\n const current = readProfile(settingsPath, normalized);\n assertExpected(current, expected);\n if (current.rawDocument === rawDocument) return { ...current, rawDocument };\n publish(profileDirectory(settingsPath), `${normalized}.toml`, bytes, () => {\n assertExpected(readProfile(settingsPath, normalized), expected);\n });\n return readTextProfile(settingsPath, normalized);\n });\n}\n\nexport function renameProfile(\n settingsPath: string,\n name: string,\n newName: string,\n expected: ProfileDocument,\n): ProfileDocument {\n const normalized = normalizeProfileName(newName);\n return mutate(settingsPath, () => {\n const current = readProfile(settingsPath, name);\n assertExpected(current, expected);\n if (current.name === normalized) return current;\n // Explicitly reject case-only renames rather than depending on filesystem case behavior.\n if (collisionKey(current.name) === collisionKey(normalized))\n throw new Error(\"Case-only profile rename is not supported\");\n const directory = profileDirectory(settingsPath);\n assertAvailable(directory, `${normalized}.toml`);\n assertExpected(readProfile(settingsPath, name), expected);\n const destination = join(directory, `${normalized}.toml`);\n renameSync(current.path, destination);\n flushMutation(directory, destination);\n return readProfile(settingsPath, normalized);\n });\n}\n\nexport function deleteProfile(settingsPath: string, name: string, expected: ProfileDocument): void {\n mutate(settingsPath, () => {\n const current = readProfile(settingsPath, name);\n assertExpected(current, expected);\n unlinkSync(current.path);\n flushMutation(dirname(current.path), current.path);\n });\n}\n\nfunction assertTimestamp(value: string): void {\n const time = Date.parse(value);\n if (!Number.isFinite(time) || new Date(time).toISOString() !== value) throw new Error(\"Invalid history timestamp\");\n}\n\nfunction historyLocation(settingsPath: string, name: string): { path: string; legacy: boolean; createdAt: string } {\n const modern = HISTORY_NAME.exec(name);\n if (modern) {\n const createdAt = modern[1].replace(/T(\\d{2})-(\\d{2})-(\\d{2})/u, \"T$1:$2:$3\");\n assertTimestamp(createdAt);\n return { path: join(historyDirectory(settingsPath), name), legacy: false, createdAt };\n }\n const legacy = LEGACY_NAME.exec(name);\n if (legacy) {\n const createdAt = `${legacy[1]}-${legacy[2]}-${legacy[3]}T${legacy[4]}:${legacy[5]}`;\n assertTimestamp(`${createdAt}:00.000Z`);\n return { path: join(rootPath(settingsPath), name), legacy: true, createdAt };\n }\n throw new Error(\"Invalid history filename\");\n}\n\nexport function readHistory(settingsPath: string, name: string): HistoryDocument {\n const location = historyLocation(settingsPath, name);\n const document = readBytes(location.path);\n const decoded = document.rawBytes.toString(\"utf8\");\n const valid = Buffer.from(decoded, \"utf8\").equals(document.rawBytes);\n return Object.freeze({\n kind: \"history\",\n name,\n ...location,\n ...document,\n rawDocument: valid ? decoded : undefined,\n ...(valid ? {} : { readError: \"Recovery document is not valid UTF-8; raw bytes are preserved\" }),\n });\n}\n\nexport function listHistory(settingsPath: string): HistoryDocument[] {\n const history: HistoryDocument[] = [];\n for (const [directory, pattern] of [\n [historyDirectory(settingsPath), HISTORY_NAME],\n [rootPath(settingsPath), LEGACY_NAME],\n ] as const) {\n if (!checkedDirectory(directory)) continue;\n for (const name of readdirSync(directory).sort()) {\n if (!pattern.test(name)) continue;\n try {\n historyLocation(settingsPath, name);\n } catch (error) {\n if (error instanceof Error && error.message === \"Invalid history timestamp\") continue;\n throw error;\n }\n const stat = statIfPresent(join(directory, name));\n if (!stat?.isFile() || stat.isSymbolicLink()) continue;\n history.push(readHistory(settingsPath, name));\n }\n }\n return history.sort(\n (left, right) => Date.parse(right.createdAt) - Date.parse(left.createdAt) || left.name.localeCompare(right.name),\n );\n}\n\n/** Return only after file AND directory fsync. Keep recovery bytes even if a later operation fails. */\nexport function archiveConfigDocument(settingsPath: string, rawDocument: string | Buffer): ArchiveReference {\n const bytes = typeof rawDocument === \"string\" ? encodeDocument(rawDocument) : Buffer.from(rawDocument);\n return mutate(settingsPath, () => {\n const directory = historyDirectory(settingsPath);\n checkedDirectory(directory, true);\n const name = `${new Date().toISOString().replace(/:/gu, \"-\")}-${randomUUID()}.toml`;\n publish(directory, name, bytes, () => assertAvailable(directory, name));\n return Object.freeze({ name, path: join(directory, name) });\n });\n}\n\nexport function deleteHistory(settingsPath: string, name: string, expected: HistoryDocument): void {\n if (historyLocation(settingsPath, name).legacy) throw new Error(\"Legacy recovery files are read-only\");\n mutate(settingsPath, () => {\n const current = readHistory(settingsPath, name);\n assertExpected(current, expected);\n unlinkSync(current.path);\n flushMutation(dirname(current.path), current.path);\n });\n}\n", "import { stripVTControlCharacters } from \"node:util\";\nimport type { ExtensionCommandContext, KeybindingsManager, Theme } from \"@earendil-works/pi-coding-agent\";\nimport { Key, matchesKey, truncateToWidth, wrapTextWithAnsi } from \"@earendil-works/pi-tui\";\nimport { runCustomInteraction } from \"@narumitw/pi-tui-kit\";\n\nconst RESERVED_HOST_ROWS = 3;\n\nexport interface PreviewMenuItem<Value extends string> {\n value: Value;\n label: string;\n}\n\nexport type PreviewMenuResult<Value extends string> =\n | { kind: \"selected\"; value: Value }\n | { kind: \"cancelled\" }\n | { kind: \"closed\" };\n\nexport async function showPreviewActionMenu<Value extends string>(\n ctx: ExtensionCommandContext,\n title: string,\n body: (width: number, theme: Theme) => readonly string[],\n items: readonly PreviewMenuItem<Value>[],\n signal?: AbortSignal,\n isCurrent: () => boolean = () => !signal?.aborted,\n): Promise<PreviewMenuResult<Value> | undefined> {\n if (signal?.aborted || !isCurrent()) return { kind: \"closed\" };\n const result = await runCustomInteraction<PreviewMenuResult<Value>>(ctx, {\n signal,\n isCurrent,\n create: ({ tui, theme, keybindings, complete }) => {\n let selectedIndex = 0;\n let scrollOffset = 0;\n let lastMaximumScroll = 0;\n let lastViewportSize = 1;\n let disposed = false;\n\n const requestRender = () => {\n if (!disposed) tui.requestRender();\n };\n const moveSelection = (delta: number) => {\n if (items.length === 0) return;\n selectedIndex = (selectedIndex + delta + items.length) % items.length;\n requestRender();\n };\n const movePreview = (offset: number) => {\n scrollOffset = Math.max(0, Math.min(offset, lastMaximumScroll));\n requestRender();\n };\n\n return {\n render(width: number): string[] {\n const safeWidth = Math.max(1, width);\n const terminalRows = Number.isFinite(tui.terminal.rows) ? Math.floor(tui.terminal.rows) : 24;\n const availableRows = Math.max(1, terminalRows - RESERVED_HOST_ROWS);\n const bodyLines = body(safeWidth, theme).flatMap((line) => (line ? wrapTextWithAnsi(line, safeWidth) : [\"\"]));\n const layout = allocateLayout(availableRows, items.length, bodyLines.length);\n lastViewportSize = layout.previewRows;\n lastMaximumScroll = Math.max(0, bodyLines.length - layout.previewRows);\n scrollOffset = Math.max(0, Math.min(scrollOffset, lastMaximumScroll));\n const actionStart = actionWindowStart(selectedIndex, items.length, layout.actionRows);\n const actionLines = items.slice(actionStart, actionStart + layout.actionRows).map((item, index) => {\n const absoluteIndex = actionStart + index;\n const prefix = absoluteIndex === selectedIndex ? \"\u2192 \" : \" \";\n return theme.fg(\n absoluteIndex === selectedIndex ? \"accent\" : \"text\",\n `${prefix}${safeDisplayText(item.label)}`,\n );\n });\n const position = layout.positionRows\n ? [theme.fg(\"dim\", previewPosition(scrollOffset, layout.previewRows, bodyLines.length))]\n : [];\n const lines = [\n ...(layout.titleRows ? [theme.fg(\"accent\", theme.bold(safeDisplayText(title)))] : []),\n ...bodyLines.slice(scrollOffset, scrollOffset + layout.previewRows),\n ...position,\n ...actionLines,\n ...(layout.hintRows ? [theme.fg(\"dim\", previewHint(keybindings))] : []),\n ];\n return lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n },\n invalidate() {},\n handleInput(data: string) {\n if (disposed) return;\n if (matchesKey(data, Key.ctrl(\"c\"))) {\n complete({ kind: \"closed\" });\n } else if (keybindings.matches(data, \"tui.select.cancel\")) {\n complete({ kind: \"cancelled\" });\n } else if (keybindings.matches(data, \"tui.select.up\")) {\n moveSelection(-1);\n } else if (keybindings.matches(data, \"tui.select.down\")) {\n moveSelection(1);\n } else if (keybindings.matches(data, \"tui.select.pageUp\")) {\n movePreview(scrollOffset - lastViewportSize);\n } else if (keybindings.matches(data, \"tui.select.pageDown\")) {\n movePreview(scrollOffset + lastViewportSize);\n } else if (matchesKey(data, Key.home)) {\n movePreview(0);\n } else if (matchesKey(data, Key.end)) {\n movePreview(lastMaximumScroll);\n } else if (keybindings.matches(data, \"tui.select.confirm\")) {\n const item = items[selectedIndex];\n if (item) complete({ kind: \"selected\", value: item.value });\n }\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n },\n };\n },\n });\n if (result.kind === \"completed\") return result.value;\n if (result.kind === \"error\") throw result.error;\n if (result.kind === \"stale\" && (signal?.aborted || !isCurrent())) return { kind: \"closed\" };\n return undefined;\n}\n\ninterface PreviewLayout {\n titleRows: number;\n previewRows: number;\n positionRows: number;\n actionRows: number;\n hintRows: number;\n}\n\nfunction allocateLayout(availableRows: number, actionCount: number, bodyLineCount: number): PreviewLayout {\n if (availableRows === 1) {\n return { titleRows: 0, previewRows: 0, positionRows: 0, actionRows: 1, hintRows: 0 };\n }\n const titleRows = availableRows >= 3 ? 1 : 0;\n const hintRows = availableRows >= 3 ? 1 : 0;\n const minimumPreviewRows = bodyLineCount > 0 && availableRows >= 4 ? 1 : 0;\n const availableActionRows = Math.max(1, availableRows - titleRows - hintRows - minimumPreviewRows);\n const actionRows = Math.min(Math.max(1, actionCount), availableActionRows);\n let previewRows = Math.max(0, availableRows - titleRows - hintRows - actionRows);\n const positionRows = previewRows >= 2 && bodyLineCount > previewRows ? 1 : 0;\n previewRows -= positionRows;\n return { titleRows, previewRows, positionRows, actionRows, hintRows };\n}\n\nfunction actionWindowStart(selectedIndex: number, itemCount: number, viewportSize: number): number {\n if (itemCount <= viewportSize) return 0;\n return Math.max(0, Math.min(selectedIndex, itemCount - viewportSize));\n}\n\nfunction previewPosition(offset: number, viewportSize: number, lineCount: number): string {\n if (lineCount === 0) return \"0/0\";\n return `${offset + 1}-${Math.min(lineCount, offset + viewportSize)}/${lineCount}`;\n}\n\nfunction previewHint(keybindings: Pick<KeybindingsManager, \"getKeys\">): string {\n const up = bindingText(keybindings, \"tui.select.up\");\n const down = bindingText(keybindings, \"tui.select.down\");\n const confirm = bindingText(keybindings, \"tui.select.confirm\");\n const cancel = bindingText(keybindings, \"tui.select.cancel\", \"ctrl+c\");\n const pageUp = bindingText(keybindings, \"tui.select.pageUp\");\n const pageDown = bindingText(keybindings, \"tui.select.pageDown\");\n return [\n ...(up || down ? [`${[up, down].filter(Boolean).join(\"/\")} navigate`] : []),\n ...(confirm ? [`${confirm} select`] : []),\n ...(cancel ? [`${cancel} discard`] : []),\n \"ctrl+c close\",\n ...(pageUp || pageDown ? [`${[pageUp, pageDown].filter(Boolean).join(\"/\")} preview`] : []),\n ].join(\" \u2022 \");\n}\n\nfunction bindingText(\n keybindings: Pick<KeybindingsManager, \"getKeys\">,\n binding: Parameters<KeybindingsManager[\"getKeys\"]>[0],\n excluded?: string,\n): string {\n return keybindings\n .getKeys(binding)\n .filter((key) => key !== excluded)\n .map((key) => {\n if (key === \"up\") return \"\u2191\";\n if (key === \"down\") return \"\u2193\";\n if (key === \"escape\") return \"esc\";\n if (key === \"return\") return \"enter\";\n return safeDisplayText(key);\n })\n .join(\"/\");\n}\n\nfunction safeDisplayText(value: string): string {\n return Array.from(stripVTControlCharacters(value), (character) => {\n const codePoint = character.codePointAt(0) ?? 0;\n const control = codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f);\n return control ? \"\" : character;\n }).join(\"\");\n}\n", "export const BRACKETED_SEGMENTS_PRESET = String.raw`# Font-safe bracketed segments inspired by Starship.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = '[\\[$symbol\\]]($style) '\nstyle = \"bold white\"\n\n[model]\nformat = '[\\[$symbol $model\\]]($style) '\nsymbol = \"AI\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = '[\\[$symbol $level\\]]($style) '\nsymbol = \"think\"\nstyle = \"bold purple\"\n\n[directory]\nformat = '[\\[$symbol $path\\]]($style) '\nsymbol = \"dir\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = '[\\[$symbol $branch\\]]($style) '\nsymbol = \"git\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = '[\\[$all_status( $ahead_behind)\\]]($style) '\nstyle = \"red bold\"\n\n[activity]\nformat = '[\\[$text\\]]($style) '\nsymbol = \"run\"\nstyle = \"bold yellow\"\n\n[context]\nformat = '[\\[$symbol $percentage\\]]($style) '\nsymbol = \"ctx\"\n\n[time]\nformat = '[\\[$time\\]]($style)'\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const CATPPUCCIN_POWERLINE_PRESET = `# Pi-native adaptation of Starship's Catppuccin Powerline preset.\nformat = \"[\uE0B6](red)$brand$model[\uE0B0](bg:peach fg:red)$directory[\uE0B0](bg:yellow fg:peach)$git_branch$git_status[\uE0B0](fg:yellow bg:green)$thinking$activity[\uE0B0](fg:green bg:sapphire)$context[\uE0B0](fg:sapphire bg:lavender)$time[\uE0B4](fg:lavender)\"\npalette = \"catppuccin_mocha\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:crust bg:red bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:red bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:peach bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:crust bg:yellow bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:crust bg:yellow bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:crust bg:green bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:crust bg:green bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:crust bg:sapphire bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"sapphire\"\nhidden = false\n\n[time]\nformat = \"[ \uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:lavender bold\"\n\n[palettes.catppuccin_mocha]\nred = \"#f38ba8\"\npeach = \"#fab387\"\nyellow = \"#f9e2af\"\ngreen = \"#a6e3a1\"\nsapphire = \"#74c7ec\"\nlavender = \"#b4befe\"\ncrust = \"#11111b\"\n\n[palettes.catppuccin_frappe]\nred = \"#e78284\"\npeach = \"#ef9f76\"\nyellow = \"#e5c890\"\ngreen = \"#a6d189\"\nsapphire = \"#85c1dc\"\nlavender = \"#babbf1\"\ncrust = \"#232634\"\n\n[palettes.catppuccin_latte]\nred = \"#d20f39\"\npeach = \"#fe640b\"\nyellow = \"#df8e1d\"\ngreen = \"#40a02b\"\nsapphire = \"#209fb5\"\nlavender = \"#7287fd\"\ncrust = \"#dce0e8\"\n\n[palettes.catppuccin_macchiato]\nred = \"#ed8796\"\npeach = \"#f5a97f\"\nyellow = \"#eed49f\"\ngreen = \"#a6da95\"\nsapphire = \"#7dc4e4\"\nlavender = \"#b7bdf8\"\ncrust = \"#181926\"\n`;\n", "export const GRUVBOX_RAINBOW_PRESET = `# Pi-native adaptation of Starship's Gruvbox Rainbow preset.\nformat = \"[\uE0B6](color_orange)$brand$model[\uE0B0](bg:color_yellow fg:color_orange)$directory[\uE0B0](fg:color_yellow bg:color_aqua)$git_branch$git_status[\uE0B0](fg:color_aqua bg:color_blue)$thinking$activity[\uE0B0](fg:color_blue bg:color_bg3)$context[\uE0B0](fg:color_bg3 bg:color_bg1)$time[\uE0B4](fg:color_bg1)\"\npalette = \"gruvbox_dark\"\n\n[palettes.gruvbox_dark]\ncolor_fg0 = \"#fbf1c7\"\ncolor_bg1 = \"#3c3836\"\ncolor_bg3 = \"#665c54\"\ncolor_blue = \"#458588\"\ncolor_aqua = \"#689d6a\"\ncolor_green = \"#98971a\"\ncolor_orange = \"#d65d0e\"\ncolor_purple = \"#b16286\"\ncolor_red = \"#cc241d\"\ncolor_yellow = \"#d79921\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:color_fg0 bg:color_orange bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_orange bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_yellow bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:color_fg0 bg:color_aqua bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:color_fg0 bg:color_aqua bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:color_fg0 bg:color_blue bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:color_fg0 bg:color_blue bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:color_fg0 bg:color_bg3 bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"color_bg3\"\nhidden = false\n\n[time]\nformat = \"[ \uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_bg1 bold\"\n`;\n", "export const JETPACK_PRESET = `# Pi-native adaptation of Starship's Jetpack preset.\n# Left-side session activity and right-side workspace context meet at $fill.\nformat = \"$activity$context$fill$directory$git_branch$git_state$git_status$time\"\n\n[activity]\nformat = \"[\u25C4 $text ]($style)\"\nsymbol = \"\"\nstyle = \"italic white\"\n\n[context]\nformat = \"[\u25EF $percentage]($style) \"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold purple\"\nhidden = false\n\n[fill]\nsymbol = \" \"\nstyle = \"none\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"italic blue\"\ntruncation_length = 2\ntruncation_symbol = \"\u25A1 \"\nhome_symbol = \"\u2302\"\n\n[git_branch]\nformat = \"[$symbol$branch]($style)\"\nsymbol = \"\u25B3 \"\nstyle = \"italic bright-blue\"\ntruncation_length = 11\ntruncation_symbol = \"\u22EF\"\n\n[git_state]\nformat = \"([\u23AA$state $progress_current/$progress_total\u23A5]($style))\"\nsymbol = \"\"\nstyle = \"italic bright-purple\"\n\n[git_status]\nformat = \"([\u23AA$all_status$ahead_behind\u23A5]($style))\"\nstyle = \"bold italic bright-blue\"\n\n[time]\nformat = \"[ $time]($style)\"\nsymbol = \"\"\nstyle = \"italic dimmed white\"\n`;\n", "export const MINIMAL_PRESET = `# A compact, font-safe Pi footer.\nformat = \"$model$directory$git_branch$activity\"\n\n[model]\nformat = \"[$model]($style) \"\nsymbol = \"\"\nstyle = \"bold blue\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[git:$branch]($style) \"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[activity]\nformat = \"[$text]($style)\"\nsymbol = \"*\"\nstyle = \"bold yellow\"\n`;\n", "export const NERD_FONT_SYMBOLS_PRESET = `# Balanced Pi footer with Nerd Font symbols.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nsymbol = \"\uE285\"\n\n[model]\nsymbol = \"\uDB81\uDEA9\"\n\n[thinking]\nsymbol = \"\uDB81\uDD1F\"\n\n[directory]\nsymbol = \"\uDB80\uDE4B\"\n\n[git_branch]\nsymbol = \"\uF418\"\n\n[activity]\nsymbol = \"\uDB81\uDC6E\"\n\n[context]\nsymbol = \"\uDB80\uDF5B\"\n\n[time]\nsymbol = \"\uF43A\"\n`;\n", "export const NO_EMPTY_ICONS_PRESET = `# Pi-native adaptation of Starship's No Empty Icons preset.\n# Each label lives inside the same conditional group as its value.\nformat = \"$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[model]\nformat = \"([model $model]($style) )\"\nsymbol = \"\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"([thinking $level]($style) )\"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"([in $path]($style) )\"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"([on $branch]($style) )\"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"([$all_status$ahead_behind]($style) )\"\nstyle = \"red bold\"\n\n[activity]\nformat = \"([while $text]($style) )\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"([using $percentage context]($style) )\"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"([at $time]($style))\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const NO_NERD_FONT_PRESET = `# Pi-native adaptation of Starship's No Nerd Font preset.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"\u2726\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol $model]($style) \"\nsymbol = \"\u25C6\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol $level]($style) \"\nsymbol = \"\u25C7\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$symbol $path]($style) \"\nsymbol = \"\u2302\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol $branch]($style) \"\nsymbol = \"\u2387\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"\u25CF\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$symbol $percentage]($style) \"\nsymbol = \"\u25CC\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$symbol $time]($style)\"\nsymbol = \"\u25F4\"\nstyle = \"bold yellow\"\n`;\n", "export const NO_RUNTIME_VERSIONS_PRESET = `# Pi-native adaptation of Starship's No Runtime Versions preset.\n# Model and thinking modules retain presence symbols while hiding version-like details.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"\u03C0\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol]($style) \"\nsymbol = \"AI\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol]($style) \"\nsymbol = \"think\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol$branch]($style) \"\nsymbol = \"git:\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$symbol]($style) \"\nsymbol = \"run\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$percentage]($style) \"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$time]($style)\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const PASTEL_POWERLINE_PRESET = `# Pi-native adaptation of Starship's Pastel Powerline preset.\nformat = \"[\uE0B6](#9A348E)$brand$model[\uE0B0](bg:#DA627D fg:#9A348E)$directory[\uE0B0](fg:#DA627D bg:#FCA17D)$git_branch$git_status[\uE0B0](fg:#FCA17D bg:#86BBD8)$thinking$activity[\uE0B0](fg:#86BBD8 bg:#06969A)$context[\uE0B0](fg:#06969A bg:#33658A)$time[\uE0B4](fg:#33658A)\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:#ffffff bg:#9A348E bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#9A348E bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#DA627D bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:#1f1f1f bg:#FCA17D bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:#1f1f1f bg:#FCA17D bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:#1f1f1f bg:#86BBD8 bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:#1f1f1f bg:#86BBD8 bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:#ffffff bg:#06969A bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"#06969A\"\nhidden = false\n\n[time]\nformat = \"[ \u2665 $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#33658A bold\"\n`;\n", "export const PLAIN_TEXT_SYMBOLS_PRESET = `# Pi-native adaptation of Starship's Plain Text Symbols preset.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"pi\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol $model]($style) \"\nsymbol = \"model\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol $level]($style) \"\nsymbol = \"thinking\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$symbol $path]($style) \"\nsymbol = \"dir\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol $branch]($style) \"\nsymbol = \"git\"\nstyle = \"bold purple\"\ntruncation_symbol = \"...\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"active\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$symbol $percentage]($style) \"\nsymbol = \"context\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$symbol $time]($style)\"\nsymbol = \"time\"\nstyle = \"bold yellow\"\n`;\n", "export const PURE_PRESET = `# Pi-native adaptation of Starship's Pure preset.\nformat = \"$directory$git_branch$git_state$git_status$activity\\\\n$model$thinking$context$fill$time\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"blue\"\n\n[git_branch]\nformat = \"[$branch]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[git_state]\nformat = '([($state( $progress_current/$progress_total))]($style) )'\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[git_status]\nformat = \"[(*$all_status)](218) [$ahead_behind]($style) \"\nstyle = \"cyan\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"\"\nstyle = \"yellow\"\n\n[model]\nformat = \"[$model]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[thinking]\nformat = \"[$level]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[context]\nformat = \"[$percentage]($style)\"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bright-black\"\nhidden = false\n\n[fill]\nsymbol = \" \"\nstyle = \"none\"\n\n[time]\nformat = \"[$time]($style)\"\nsymbol = \"\"\nstyle = \"bright-black\"\n`;\n", "export const TOKYO_NIGHT_PRESET = `# Pi-native adaptation of Starship's Tokyo Night preset.\nformat = \"[\u2591\u2592\u2593](#a3aed2)$brand$model[\uE0B4](bg:#769ff0 fg:#a3aed2)$directory[\uE0B4](fg:#769ff0 bg:#394260)$git_branch$git_status[\uE0B4](fg:#394260 bg:#212736)$thinking$activity[\uE0B4](fg:#212736 bg:#1d2230)$context$time[\uE0B4](fg:#1d2230)\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:#090c0c bg:#a3aed2 bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#090c0c bg:#a3aed2 bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#e3e5e5 bg:#769ff0 bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:#769ff0 bg:#394260 bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:#769ff0 bg:#394260 bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:#769ff0 bg:#212736 bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:#769ff0 bg:#212736 bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:#a0a9cb bg:#1d2230 bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"#1d2230\"\nhidden = false\n\n[time]\nformat = \"[\uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#a0a9cb bg:#1d2230 bold\"\n`;\n", "import { BRACKETED_SEGMENTS_PRESET } from \"./bracketed-segments.js\";\nimport { CATPPUCCIN_POWERLINE_PRESET } from \"./catppuccin-powerline.js\";\nimport { GRUVBOX_RAINBOW_PRESET } from \"./gruvbox-rainbow.js\";\nimport { JETPACK_PRESET } from \"./jetpack.js\";\nimport { MINIMAL_PRESET } from \"./minimal.js\";\nimport { NERD_FONT_SYMBOLS_PRESET } from \"./nerd-font-symbols.js\";\nimport { NO_EMPTY_ICONS_PRESET } from \"./no-empty-icons.js\";\nimport { NO_NERD_FONT_PRESET } from \"./no-nerd-font.js\";\nimport { NO_RUNTIME_VERSIONS_PRESET } from \"./no-runtime-versions.js\";\nimport { PASTEL_POWERLINE_PRESET } from \"./pastel-powerline.js\";\nimport { PLAIN_TEXT_SYMBOLS_PRESET } from \"./plain-text-symbols.js\";\nimport { PURE_PRESET } from \"./pure-preset.js\";\nimport { TOKYO_NIGHT_PRESET } from \"./tokyo-night.js\";\n\nexport interface StarshipPreset {\n id:\n | \"minimal\"\n | \"bracketed-segments\"\n | \"catppuccin-powerline\"\n | \"gruvbox-rainbow\"\n | \"jetpack\"\n | \"nerd-font-symbols\"\n | \"no-empty-icons\"\n | \"no-nerd-font\"\n | \"no-runtime-versions\"\n | \"pastel-powerline\"\n | \"plain-text-symbols\"\n | \"pure-preset\"\n | \"tokyo-night\";\n label: string;\n description: string;\n requiresNerdFont: boolean;\n rawDocument: string;\n}\n\nexport const STARSHIP_PRESETS = [\n {\n id: \"minimal\",\n label: \"Minimal\",\n description: \"Compact Pi essentials \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: MINIMAL_PRESET,\n },\n {\n id: \"bracketed-segments\",\n label: \"Bracketed Segments\",\n description: \"Balanced Pi and Git details in brackets \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: BRACKETED_SEGMENTS_PRESET,\n },\n {\n id: \"catppuccin-powerline\",\n label: \"Catppuccin Powerline\",\n description: \"Mocha connected color blocks \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: CATPPUCCIN_POWERLINE_PRESET,\n },\n {\n id: \"gruvbox-rainbow\",\n label: \"Gruvbox Rainbow\",\n description: \"Warm Gruvbox connected segments \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: GRUVBOX_RAINBOW_PRESET,\n },\n {\n id: \"jetpack\",\n label: \"Jetpack\",\n description: \"Airy geometric left/right layout \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: JETPACK_PRESET,\n },\n {\n id: \"nerd-font-symbols\",\n label: \"Nerd Font Symbols\",\n description: \"Balanced default layout with icon-rich symbols \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: NERD_FONT_SYMBOLS_PRESET,\n },\n {\n id: \"no-empty-icons\",\n label: \"No Empty Icons\",\n description: \"Conditional labels never appear without values \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: NO_EMPTY_ICONS_PRESET,\n },\n {\n id: \"no-nerd-font\",\n label: \"No Nerd Font\",\n description: \"Portable Unicode symbols without private-use glyphs \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: NO_NERD_FONT_PRESET,\n },\n {\n id: \"no-runtime-versions\",\n label: \"No Runtime Versions\",\n description: \"Presence indicators without model or thinking details \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: NO_RUNTIME_VERSIONS_PRESET,\n },\n {\n id: \"pastel-powerline\",\n label: \"Pastel Powerline\",\n description: \"Pastel connected color blocks \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: PASTEL_POWERLINE_PRESET,\n },\n {\n id: \"plain-text-symbols\",\n label: \"Plain Text Symbols\",\n description: \"Plain words replace pictograms \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: PLAIN_TEXT_SYMBOLS_PRESET,\n },\n {\n id: \"pure-preset\",\n label: \"Pure Preset\",\n description: \"Clean two-line workspace and session context \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: PURE_PRESET,\n },\n {\n id: \"tokyo-night\",\n label: \"Tokyo Night\",\n description: \"Cool connected color blocks \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: TOKYO_NIGHT_PRESET,\n },\n] as const satisfies readonly StarshipPreset[];\n\nexport function getStarshipPreset(id: StarshipPreset[\"id\"]): StarshipPreset {\n const preset = STARSHIP_PRESETS.find((candidate) => candidate.id === id);\n if (!preset) throw new Error(`Unknown pi-starship preset: ${id}`);\n return preset;\n}\n\nexport function presetForDocument(rawDocument: string | undefined): StarshipPreset | undefined {\n return STARSHIP_PRESETS.find((preset) => preset.rawDocument === rawDocument);\n}\n", "import { type ExtensionCommandContext, withFileMutationQueue } from \"@earendil-works/pi-coding-agent\";\nimport { sanitizeTerminalText } from \"@narumitw/pi-tui-kit/terminal-text\";\nimport { type PreviewMenuResult, showPreviewActionMenu } from \"./command-preview.js\";\nimport {\n assertConfigDocumentUnchanged,\n BUILT_IN_EXAMPLE,\n type ConfigDocumentSnapshot,\n type LoadedStarshipConfig,\n loadStarshipConfig,\n readConfigDocumentSnapshot,\n} from \"./config.js\";\nimport { presetForDocument } from \"./presets/catalog.js\";\nimport { archiveConfigDocument } from \"./profile-store.js\";\n\nconst RELOAD_ACTIONS = {\n apply: \"apply\",\n cancel: \"cancel\",\n} as const;\n\nexport interface WorkflowOwner {\n signal: AbortSignal;\n isCurrent(): boolean;\n /** Session ownership independent of command cancellation and candidate/revision guards. */\n isSessionCurrent?(): boolean;\n}\n\nexport interface ConfigurationCommandOptions {\n getLoaded(): LoadedStarshipConfig;\n getLoadedRevision?(): number;\n apply(loaded: LoadedStarshipConfig, ctx: ExtensionCommandContext): void;\n settingsPath: string;\n renderPreview?(loaded: LoadedStarshipConfig, width: number, ctx: ExtensionCommandContext): string[];\n read?: (settingsPath: string) => LoadedStarshipConfig;\n archive?: typeof archiveConfigDocument;\n}\n\nexport interface ConfigurationPresentation {\n state: string;\n source: string;\n health: string;\n restoreDisabled: boolean;\n restoreDescription: string;\n}\n\nexport function configurationPresentation(loaded: LoadedStarshipConfig): ConfigurationPresentation {\n const healthyMissing = isHealthyMissing(loaded);\n const savedBuiltIn = loaded.source === \"user\" && loaded.rawDocument === BUILT_IN_EXAMPLE;\n const activePreset = presetForDocument(loaded.rawDocument);\n const fallback = loaded.source === \"built-in\" && loaded.diagnostics.length > 0;\n return {\n state: healthyMissing\n ? \"Pi native footer\"\n : savedBuiltIn\n ? \"Saved built-in configuration\"\n : activePreset\n ? `${activePreset.label} preset`\n : fallback\n ? \"Built-in fallback\"\n : \"Custom configuration\",\n source: healthyMissing\n ? \"No settings file\"\n : activePreset\n ? \"Bundled preset\"\n : loaded.source === \"user\"\n ? \"User file\"\n : \"Built-in fallback\",\n health: configurationHealth(loaded),\n restoreDisabled: healthyMissing,\n restoreDescription: healthyMissing\n ? \"Already using Pi native footer \u00B7 no file to remove\"\n : \"Preview before restoring Pi native footer\",\n };\n}\n\nexport function configurationMenuScreen(loaded: LoadedStarshipConfig, settingsPath: string) {\n const presentation = configurationPresentation(loaded);\n return {\n kind: \"actions\" as const,\n title: \"Configuration\",\n lines: [\n `State: ${presentation.state}`,\n `Source: ${presentation.source}`,\n `Path: ${sanitizeTerminalText(settingsPath)}`,\n ...diagnosticLines(loaded, true, loaded.diagnostics.length),\n ],\n items: [\n {\n id: \"configuration-reload\",\n label: \"Reload from disk\u2026\",\n description: \"Validate and preview external changes\",\n action: \"configuration-reload\" as const,\n },\n {\n id: \"gist-share\",\n label: \"Share settings as Gist\u2026\",\n description: \"Upload reviewed TOML to GitHub \u00B7 unlisted, not private \u00B7 requires gh\",\n action: \"gist-share\" as const,\n },\n {\n id: \"gist-import\",\n label: \"Import settings from Gist\u2026\",\n description: \"Review and preview remote TOML before replacing settings \u00B7 requires gh\",\n action: \"gist-import\" as const,\n },\n {\n id: \"history\",\n label: \"History\",\n description: \"Review and restore recovery copies; legacy skill backups are read-only\",\n action: \"history\" as const,\n },\n ],\n hint: \"back\" as const,\n };\n}\n\nexport async function reloadConfiguration(\n ctx: ExtensionCommandContext,\n options: ConfigurationCommandOptions,\n owner: WorkflowOwner,\n): Promise<\"applied\" | \"stay\" | \"close\"> {\n if (!isCurrentOwner(owner)) return \"stay\";\n const previous = options.getLoaded();\n const revision = options.getLoadedRevision?.();\n const candidate = readReloadCandidate(options);\n let disk: ConfigDocumentSnapshot;\n try {\n disk = readConfigDocumentSnapshot(options.settingsPath);\n } catch (error) {\n ctx.ui.notify(`Footer reload was blocked: ${safeError(error)}`, \"error\");\n return \"stay\";\n }\n if (!candidate.ok) {\n ctx.ui.notify(`Footer reload was blocked: ${safeError(candidate.error)}`, \"error\");\n return \"stay\";\n }\n if (sameLoadedDocument(previous, candidate.loaded)) {\n ctx.ui.notify(\"The current disk configuration is already loaded.\", \"info\");\n return \"stay\";\n }\n\n const selection = await showPreviewActionMenu(\n ctx,\n \"Reload preview\",\n (width) => reloadPreviewBody(ctx, options, candidate.loaded, width),\n [\n { value: RELOAD_ACTIONS.apply, label: \"Apply reloaded configuration\u2026\" },\n { value: RELOAD_ACTIONS.cancel, label: \"Cancel\" },\n ],\n owner.signal,\n owner.isCurrent,\n );\n if (!isCurrentOwner(owner) || activeRevisionChanged(options, revision)) return \"stay\";\n if (selection?.kind === \"closed\") return \"close\";\n if (selectedReloadAction(selection) !== RELOAD_ACTIONS.apply) return \"stay\";\n\n const confirmed = await ctx.ui.confirm(\n \"Apply configuration from disk?\",\n candidate.loaded.rawDocument === undefined\n ? \"Show Pi's native footer for this session? No settings file will be created.\"\n : \"Apply the validated settings document to this session without changing its bytes? The previous loaded document will be kept in History.\",\n { signal: owner.signal },\n );\n if (!isCurrentOwner(owner) || activeRevisionChanged(options, revision) || !confirmed) {\n return \"stay\";\n }\n\n let warnings = 0;\n try {\n const applied = await withFileMutationQueue(options.settingsPath, async () => {\n if (\n !isCurrentOwner(owner) ||\n activeRevisionChanged(options, revision) ||\n !sameLoadedDocument(previous, options.getLoaded())\n )\n return false;\n assertConfigDocumentUnchanged(options.settingsPath, disk);\n const fresh = readReloadCandidate(options);\n if (!fresh.ok) throw new Error(fresh.error);\n if (!sameLoadedDocument(candidate.loaded, fresh.loaded)) {\n throw new Error(\n \"The settings document changed after preview. The previous footer remains active; reload again to review the latest version.\",\n );\n }\n let recoveryPath: string | undefined;\n const previousBytes = previous.rawBytes ?? previous.rawDocument;\n if (previousBytes !== undefined) {\n recoveryPath = (options.archive ?? archiveConfigDocument)(options.settingsPath, previousBytes).path;\n }\n assertConfigDocumentUnchanged(options.settingsPath, disk);\n if (!isCurrentOwner(owner) || activeRevisionChanged(options, revision)) return false;\n try {\n options.apply(fresh.loaded, ctx);\n } catch (error) {\n let rollbackError: unknown;\n try {\n if (!isCurrentOwner(owner)) throw new Error(\"The session owner changed; stale restoration was blocked\");\n const current = options.getLoaded();\n if (!sameLoadedDocument(current, previous) && !sameLoadedDocument(current, fresh.loaded))\n throw new Error(\"The active runtime changed; stale restoration was blocked\");\n options.apply(previous, ctx);\n } catch (rollback) {\n rollbackError = rollback;\n }\n throw new Error(\n `Footer reload failed: ${formatError(error)}. ${\n rollbackError\n ? `Restoring the previous configuration also failed: ${formatError(rollbackError)}.`\n : \"The previous configuration was restored.\"\n }${recoveryPath ? ` Recovery copy retained: ${recoveryPath}.` : \"\"}`,\n );\n }\n warnings = fresh.loaded.diagnostics.length;\n return true;\n });\n if (!isCurrentOwner(owner) || !applied) return \"stay\";\n } catch (error) {\n if (isCurrentOwner(owner))\n ctx.ui.notify(`Footer reload was blocked after confirmation: ${safeError(error)}`, \"error\");\n return \"stay\";\n }\n ctx.ui.notify(\n warnings === 0\n ? \"Footer configuration reloaded and applied.\"\n : `Footer configuration reloaded and applied with ${warnings} warning${warnings === 1 ? \"\" : \"s\"}.`,\n \"info\",\n );\n return \"applied\";\n}\n\nfunction readReloadCandidate(\n options: ConfigurationCommandOptions,\n): { ok: true; loaded: LoadedStarshipConfig } | { ok: false; error: string } {\n let loaded: LoadedStarshipConfig;\n try {\n loaded = (options.read ?? loadStarshipConfig)(options.settingsPath);\n } catch (error) {\n return { ok: false, error: formatError(error) };\n }\n const errors = loaded.diagnostics.filter((item) => item.severity === \"error\");\n if (errors.length > 0) {\n return { ok: false, error: errors.map((item) => item.message).join(\"; \") };\n }\n return { ok: true, loaded };\n}\n\nfunction reloadPreviewBody(\n ctx: ExtensionCommandContext,\n options: ConfigurationCommandOptions,\n loaded: LoadedStarshipConfig,\n width: number,\n): string[] {\n const presentation = configurationPresentation(loaded);\n let preview: string[];\n try {\n preview = options.renderPreview?.(loaded, width, ctx) ?? [\"Live preview is unavailable until the footer is ready.\"];\n } catch (error) {\n preview = [`Preview unavailable: ${safeError(formatError(error))}`];\n }\n return [\n `Candidate: ${presentation.state}`,\n `Source: ${presentation.source}`,\n `Path: ${sanitizeTerminalText(options.settingsPath)}`,\n loaded.rawDocument === undefined\n ? \"Applying shows Pi's native footer and creates no settings file.\"\n : \"Applying changes only the active session; the settings document bytes stay unchanged.\",\n ...diagnosticLines(loaded, true),\n \"\",\n ...preview,\n ];\n}\n\nexport function diagnosticLines(loaded: LoadedStarshipConfig, includeSummary: boolean, limit = 8): string[] {\n const diagnostics = loaded.diagnostics\n .slice(0, limit)\n .map((item) => `${sanitizeTerminalText(item.path || \"root\")}: ${sanitizeTerminalText(item.message)}`);\n const remaining = loaded.diagnostics.length - diagnostics.length;\n return [\n ...(includeSummary ? [`Health: ${configurationHealth(loaded)}`] : []),\n ...(diagnostics.length > 0 ? diagnostics : [\"No configuration warnings.\"]),\n ...(remaining > 0 ? [`${remaining} additional warnings not shown.`] : []),\n ];\n}\n\nfunction configurationHealth(loaded: LoadedStarshipConfig): string {\n const errors = loaded.diagnostics.filter((item) => item.severity === \"error\").length;\n if (errors > 0) return `${errors} error${errors === 1 ? \"\" : \"s\"}`;\n const warnings = loaded.diagnostics.length;\n return warnings === 0 ? \"Healthy\" : `${warnings} warning${warnings === 1 ? \"\" : \"s\"}`;\n}\n\nfunction isHealthyMissing(loaded: LoadedStarshipConfig): boolean {\n return loaded.source === \"built-in\" && loaded.rawDocument === undefined && loaded.diagnostics.length === 0;\n}\n\nfunction sameLoadedDocument(left: LoadedStarshipConfig, right: LoadedStarshipConfig): boolean {\n return (\n left.source === right.source &&\n left.rawDocument === right.rawDocument &&\n JSON.stringify(left.diagnostics) === JSON.stringify(right.diagnostics)\n );\n}\n\nfunction activeRevisionChanged(options: ConfigurationCommandOptions, revision: number | undefined): boolean {\n return revision !== undefined && options.getLoadedRevision?.() !== revision;\n}\n\nfunction isCurrentOwner(owner: WorkflowOwner): boolean {\n return !owner.signal.aborted && owner.isCurrent();\n}\n\nfunction selectedReloadAction(\n result: PreviewMenuResult<(typeof RELOAD_ACTIONS)[keyof typeof RELOAD_ACTIONS]> | undefined,\n) {\n return result?.kind === \"selected\" ? result.value : null;\n}\n\nfunction safeError(value: unknown): string {\n return sanitizeTerminalText(typeof value === \"string\" ? value : formatError(value));\n}\n\nfunction formatError(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"],
5
- "mappings": ";;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,SAAS,MAAM,OAAO,SAAS,WAAW;AA6C7D,IAAM,eACJ;AACF,IAAM,cAAc;AACpB,IAAM,gBAAgB;AAGf,SAAS,qBAAqB,OAAuB;AAC1D,QAAM,OAAO,MAAM,UAAU,KAAK;AAClC,MACE,CAAC,GAAG,IAAI,EAAE,SAAS,KACnB,CAAC,GAAG,IAAI,EAAE,SAAS,MACnB,SAAS,KAAK,KAAK,KACnB,KAAK,WAAW,GAAG,KACnB,KAAK,SAAS,GAAG,KACjB,kCAAkC,KAAK,IAAI,KAC3C,cAAc,KAAK,IAAI,KACvB,OAAO,WAAW,GAAG,IAAI,SAAS,MAAM,IAAI,KAC5C;AACA,UAAM,IAAI,MAAM,qGAAgG;AAAA,EAClH;AACA,SAAO;AACT;AAGA,SAAS,iBAAiB,MAAsB;AAC9C,MAAI;AACF,WAAO,aAAa,IAAI;AAAA,EAC1B,SAAS,OAAO;AACd,QAAI,CAAC,UAAU,KAAK,EAAG,OAAM;AAC7B,UAAM,SAAS,QAAQ,IAAI;AAC3B,QAAI,WAAW,KAAM,OAAM;AAC3B,WAAO,KAAK,iBAAiB,MAAM,GAAG,SAAS,IAAI,CAAC;AAAA,EACtD;AACF;AAEA,SAAS,SAAS,cAA8B;AAC9C,SAAO,KAAK,iBAAiB,QAAQ,QAAQ,YAAY,CAAC,CAAC,GAAG,aAAa;AAC7E;AAEA,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iCAAiC,IAAI,CAAC;AAAA,EACzE;AACF;AAEA,SAAS,oBAAoB,QAAsC;AACjE,QAAM,SAAS,OAAO,YAAY,OAAO,CAAC,SAAS,KAAK,aAAa,OAAO,EAAE;AAC9E,MAAI,SAAS,EAAG,QAAO,GAAG,MAAM,SAAS,WAAW,IAAI,KAAK,GAAG;AAChE,QAAM,WAAW,OAAO,YAAY;AACpC,SAAO,aAAa,IAAI,YAAY,GAAG,QAAQ,WAAW,aAAa,IAAI,KAAK,GAAG;AACrF;AAEA,SAAS,iBAAiB,QAAuC;AAC/D,SAAO,OAAO,WAAW,cAAc,OAAO,gBAAgB,UAAa,OAAO,YAAY,WAAW;AAC3G;AAEA,SAAS,mBAAmB,MAA4B,OAAsC;AAC5F,SACE,KAAK,WAAW,MAAM,UACtB,KAAK,gBAAgB,MAAM,eAC3B,KAAK,UAAU,KAAK,WAAW,MAAM,KAAK,UAAU,MAAM,WAAW;AAEzE;AAEA,SAAS,sBAAsB,SAAsC,UAAuC;AAC1G,SAAO,aAAa,UAAa,QAAQ,oBAAoB,MAAM;AACrE;AAEA,SAAS,eAAe,OAA+B;AACrD,SAAO,CAAC,MAAM,OAAO,WAAW,MAAM,UAAU;AAClD;AAEA,SAAS,qBACP,QACA;AACA,SAAO,QAAQ,SAAS,aAAa,OAAO,QAAQ;AACtD;AAEA,SAAS,UAAU,OAAwB;AACzC,SAAO,qBAAqB,OAAO,UAAU,WAAW,QAAQ,YAAY,KAAK,CAAC;AACpF;AAEA,SAAS,YAAY,OAAwB;AAC3C,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;",
4
+ "sourcesContent": ["import { randomUUID } from \"node:crypto\";\nimport {\n type BigIntStats,\n closeSync,\n constants,\n fstatSync,\n fsyncSync,\n lstatSync,\n mkdirSync,\n openSync,\n readdirSync,\n readFileSync,\n realpathSync,\n renameSync,\n rmdirSync,\n unlinkSync,\n writeFileSync,\n} from \"node:fs\";\nimport { basename, dirname, join, parse, resolve, sep } from \"node:path\";\n\nexport interface DocumentIdentity {\n readonly dev: bigint;\n readonly ino: bigint;\n readonly size: bigint;\n readonly mtimeNs: bigint;\n readonly ctimeNs: bigint;\n}\n\nexport interface ProfileDocument {\n readonly kind: \"profile\";\n readonly name: string;\n readonly path: string;\n readonly rawDocument: string | undefined;\n readonly rawBytes: Buffer;\n readonly readError?: string;\n readonly identity: DocumentIdentity;\n}\n\nexport interface TextProfileDocument extends ProfileDocument {\n readonly rawDocument: string;\n}\n\nexport interface ArchiveReference {\n readonly name: string;\n readonly path: string;\n}\n\nexport interface HistoryDocument {\n readonly kind: \"history\";\n /** Filename, including .toml; not an arbitrary path. */\n readonly name: string;\n readonly path: string;\n /** Undefined when rawBytes are not valid UTF-8; never apply a decoded fallback. */\n readonly rawDocument: string | undefined;\n readonly rawBytes: Buffer;\n readonly readError?: string;\n readonly identity: DocumentIdentity;\n readonly legacy: boolean;\n /** ISO recovery time for new entries; local timestamp for legacy backups. */\n readonly createdAt: string;\n}\n\ntype Document = ProfileDocument | HistoryDocument;\nconst HISTORY_NAME =\n /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}\\.\\d{3}Z)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.toml$/u;\nconst LEGACY_NAME = /^pi-starship-(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})\\.toml$/u;\nconst RESERVED_NAME = /^(?:con|prn|aux|nul|com[1-9\u00B9\u00B2\u00B3]|lpt[1-9\u00B9\u00B2\u00B3]|conin\\$|conout\\$|clock\\$)(?:\\.|$)/iu;\n\n/** Normalize new names, but never trim, truncate, or replace forbidden characters. */\nexport function normalizeProfileName(value: string): string {\n const name = value.normalize(\"NFC\");\n if (\n [...name].length < 1 ||\n [...name].length > 80 ||\n name !== name.trim() ||\n name.startsWith(\".\") ||\n name.endsWith(\".\") ||\n /[\\p{Cc}\\p{Cf}\\p{Cs}<>:\"/\\\\|?*]/u.test(name) ||\n RESERVED_NAME.test(name) ||\n Buffer.byteLength(`${name}.toml`, \"utf8\") > 255\n ) {\n throw new Error(\"Invalid profile name: use 1\u201380 characters without controls, path characters, or reserved names\");\n }\n return name;\n}\n\n/** The caller supplies a trusted settings directory; its home/system symlink ancestors are valid. */\nfunction trustedDirectory(path: string): string {\n try {\n return realpathSync(path);\n } catch (error) {\n if (!isMissing(error)) throw error;\n const parent = dirname(path);\n if (parent === path) throw error;\n return join(trustedDirectory(parent), basename(path));\n }\n}\n\nfunction rootPath(settingsPath: string): string {\n return join(trustedDirectory(dirname(resolve(settingsPath))), \"pi-starship\");\n}\n\nfunction profileDirectory(settingsPath: string): string {\n return join(rootPath(settingsPath), \"profiles\");\n}\n\nfunction historyDirectory(settingsPath: string): string {\n return join(rootPath(settingsPath), \"history\");\n}\n\nfunction isMissing(error: unknown): boolean {\n return (error as NodeJS.ErrnoException).code === \"ENOENT\";\n}\n\nfunction statIfPresent(path: string): BigIntStats | undefined {\n try {\n return lstatSync(path, { bigint: true });\n } catch (error) {\n if (isMissing(error)) return undefined;\n throw error;\n }\n}\n\n/** Paths already have a canonical trusted parent; reject symlinks in every storage-owned component. */\nfunction checkedDirectory(path: string, create = false): boolean {\n const absolute = resolve(path);\n const root = parse(absolute).root;\n let current = root;\n for (const part of absolute.slice(root.length).split(sep).filter(Boolean)) {\n current = join(current, part);\n let stat = statIfPresent(current);\n let created = false;\n if (!stat && create) {\n try {\n mkdirSync(current, { mode: 0o700 });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n }\n stat = statIfPresent(current);\n created = true;\n }\n if (!stat) return false;\n if (!stat.isDirectory() || stat.isSymbolicLink()) throw new Error(`Not a safe directory: ${current}`);\n // Persist each new ancestor's directory entry, including a previously absent agent directory.\n if (created) flushDirectory(dirname(current));\n }\n return true;\n}\n\nfunction identity(stat: BigIntStats): DocumentIdentity {\n return Object.freeze({ dev: stat.dev, ino: stat.ino, size: stat.size, mtimeNs: stat.mtimeNs, ctimeNs: stat.ctimeNs });\n}\n\nfunction sameIdentity(left: DocumentIdentity, right: DocumentIdentity): boolean {\n return (\n left.dev === right.dev &&\n left.ino === right.ino &&\n left.size === right.size &&\n left.mtimeNs === right.mtimeNs &&\n left.ctimeNs === right.ctimeNs\n );\n}\n\nfunction sameFile(left: DocumentIdentity, right: BigIntStats): boolean {\n return left.dev === right.dev && left.ino === right.ino;\n}\n\nfunction encodeDocument(rawDocument: string): Buffer {\n const bytes = Buffer.from(rawDocument, \"utf8\");\n if (bytes.toString(\"utf8\") !== rawDocument) throw new Error(\"Document is not lossless UTF-8 text\");\n return bytes;\n}\n\nfunction readBytes(path: string): { rawBytes: Buffer; identity: DocumentIdentity } {\n if (!checkedDirectory(dirname(path))) throw new Error(`Document directory is missing: ${dirname(path)}`);\n const before = statIfPresent(path);\n if (!before?.isFile() || before.isSymbolicLink()) throw new Error(`Not a regular document: ${path}`);\n const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);\n try {\n const opened = fstatSync(fd, { bigint: true });\n if (!opened.isFile() || !sameIdentity(identity(before), identity(opened))) {\n throw new Error(`Document changed while opening: ${path}`);\n }\n const bytes = readFileSync(fd);\n const after = fstatSync(fd, { bigint: true });\n const published = statIfPresent(path);\n if (\n !sameIdentity(identity(opened), identity(after)) ||\n !published ||\n !sameIdentity(identity(after), identity(published))\n ) {\n throw new Error(`Document changed while reading: ${path}`);\n }\n return { rawBytes: bytes, identity: identity(after) };\n } finally {\n closeSync(fd);\n }\n}\n\nexport function readProfile(settingsPath: string, name: string): ProfileDocument {\n const normalized = normalizeProfileName(name);\n const path = join(profileDirectory(settingsPath), `${normalized}.toml`);\n const document = readBytes(path);\n const decoded = document.rawBytes.toString(\"utf8\");\n const valid = Buffer.from(decoded, \"utf8\").equals(document.rawBytes);\n return Object.freeze({\n kind: \"profile\",\n name: normalized,\n path,\n ...document,\n rawDocument: valid ? decoded : undefined,\n ...(valid ? {} : { readError: \"Profile document is not valid UTF-8; raw bytes are preserved\" }),\n });\n}\n\n/** Reject a removed, replaced, or edited profile before applying its reviewed snapshot. */\nexport function assertProfileUnchanged(settingsPath: string, expected: ProfileDocument): void {\n assertExpected(readProfile(settingsPath, expected.name), expected);\n}\n\nexport function listProfiles(settingsPath: string): ProfileDocument[] {\n const directory = profileDirectory(settingsPath);\n if (!checkedDirectory(directory)) return [];\n const profiles: ProfileDocument[] = [];\n for (const filename of readdirSync(directory).sort()) {\n if (!filename.endsWith(\".toml\")) continue;\n const name = filename.slice(0, -5);\n try {\n if (normalizeProfileName(name) !== name) continue;\n } catch {\n continue;\n }\n const stat = statIfPresent(join(directory, filename));\n if (!stat?.isFile() || stat.isSymbolicLink()) continue;\n profiles.push(readProfile(settingsPath, name));\n }\n return profiles;\n}\n\n/**\n * Sync mutations cannot interleave in one JS thread. This directory lock also coordinates\n * cooperating store callers in other processes. Contention fails instead of blocking the event\n * loop. A crashed owner's lock requires explicit manual recovery; never guess that a lock is stale.\n * Node has no portable rename-no-replace operation. Collision checks + rename under this lock\n * prevent cooperative clobbering, NOT races with external editors or directory replacement.\n * There is no portable openat/renameat API here; external directory TOCTOU remains as well.\n */\nfunction mutate<T>(settingsPath: string, operation: () => T): T {\n const root = rootPath(settingsPath);\n checkedDirectory(root, true);\n const lock = join(root, \".mutation-lock\");\n try {\n mkdirSync(lock, { mode: 0o700 });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"EEXIST\") {\n throw new Error(`Profile/history storage is locked; inspect the owner before manually removing ${lock}`);\n }\n throw error;\n }\n const owned = lstatSync(lock, { bigint: true });\n let result!: T;\n let operationError: unknown;\n let failed = false;\n try {\n result = operation();\n } catch (error) {\n failed = true;\n operationError = error;\n }\n try {\n const current = statIfPresent(lock);\n if (current?.isDirectory() && sameFile(identity(owned), current)) rmdirSync(lock);\n } catch (error) {\n if (failed) throw new AggregateError([operationError, error], `Mutation and lock cleanup failed at ${lock}`);\n throw new Error(`Mutation completed but lock cleanup failed at ${lock}`, { cause: error });\n }\n if (failed) throw operationError;\n return result;\n}\n\n/** Conservative Unicode caseless key, including expansions such as \u00DF -> ss and final sigma. */\nfunction collisionKey(name: string): string {\n // A second pass includes uppercase sharp S (\u1E9E -> \u00DF -> ss).\n return name.normalize(\"NFC\").toUpperCase().toLowerCase().toUpperCase().toLowerCase().normalize(\"NFC\");\n}\n\nfunction assertAvailable(directory: string, filename: string): void {\n const key = collisionKey(filename);\n if (readdirSync(directory).some((entry) => collisionKey(entry) === key)) {\n throw new Error(`Document name already exists: ${filename}`);\n }\n}\n\nfunction assertExpected<T extends Document>(current: T, expected: T): void {\n if (\n current.kind !== expected.kind ||\n current.path !== expected.path ||\n current.name !== expected.name ||\n current.rawDocument !== expected.rawDocument ||\n !current.rawBytes.equals(expected.rawBytes) ||\n !sameIdentity(current.identity, expected.identity)\n ) {\n throw new Error(`Document changed since review: ${current.path}`);\n }\n}\n\nfunction flushDirectory(path: string): void {\n // Windows does not support opening/fsyncing directories through this API.\n // File flushing still applies; directory-entry crash durability is POSIX-only.\n if (process.platform === \"win32\") return;\n checkedDirectory(path);\n const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_DIRECTORY);\n try {\n fsyncSync(fd);\n } finally {\n closeSync(fd);\n }\n}\n\nfunction flushMutation(directory: string, path: string): void {\n try {\n flushDirectory(directory);\n } catch (error) {\n throw new Error(`Mutation completed at ${path}, but directory flush failed: ${String(error)}`, { cause: error });\n }\n}\n\n/** Published files are never removed on a subsequent flush/read failure. */\nfunction publish(directory: string, filename: string, bytes: Buffer, beforeRename: () => void): void {\n const temporary = join(directory, `.tmp-${randomUUID()}`);\n const fd = openSync(\n temporary,\n constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW,\n 0o600,\n );\n const owned = fstatSync(fd, { bigint: true });\n let open = true;\n try {\n writeFileSync(fd, bytes);\n fsyncSync(fd);\n closeSync(fd);\n open = false;\n checkedDirectory(directory);\n beforeRename();\n const destination = join(directory, filename);\n renameSync(temporary, destination);\n flushMutation(directory, destination);\n } finally {\n try {\n if (open) closeSync(fd);\n } finally {\n const current = statIfPresent(temporary);\n if (current && sameFile(identity(owned), current)) unlinkSync(temporary);\n }\n }\n}\n\nfunction readTextProfile(settingsPath: string, name: string): TextProfileDocument {\n const document = readProfile(settingsPath, name);\n if (document.rawDocument === undefined) throw new Error(document.readError);\n return { ...document, rawDocument: document.rawDocument };\n}\n\nexport function createProfile(settingsPath: string, name: string, rawDocument: string): TextProfileDocument {\n const normalized = normalizeProfileName(name);\n const bytes = encodeDocument(rawDocument);\n return mutate(settingsPath, () => {\n const directory = profileDirectory(settingsPath);\n checkedDirectory(directory, true);\n const filename = `${normalized}.toml`;\n assertAvailable(directory, filename);\n publish(directory, filename, bytes, () => assertAvailable(directory, filename));\n return readTextProfile(settingsPath, normalized);\n });\n}\n\nexport function duplicateProfile(\n settingsPath: string,\n name: string,\n newName: string,\n expected: ProfileDocument,\n): ProfileDocument {\n const normalized = normalizeProfileName(newName);\n return mutate(settingsPath, () => {\n const current = readProfile(settingsPath, name);\n assertExpected(current, expected);\n const directory = profileDirectory(settingsPath);\n const filename = `${normalized}.toml`;\n assertAvailable(directory, filename);\n publish(directory, filename, current.rawBytes, () => {\n assertExpected(readProfile(settingsPath, name), expected);\n assertAvailable(directory, filename);\n });\n return readProfile(settingsPath, normalized);\n });\n}\n\nexport function saveProfile(\n settingsPath: string,\n name: string,\n rawDocument: string,\n expected: ProfileDocument,\n): TextProfileDocument {\n const normalized = normalizeProfileName(name);\n const bytes = encodeDocument(rawDocument);\n return mutate(settingsPath, () => {\n const current = readProfile(settingsPath, normalized);\n assertExpected(current, expected);\n if (current.rawDocument === rawDocument) return { ...current, rawDocument };\n publish(profileDirectory(settingsPath), `${normalized}.toml`, bytes, () => {\n assertExpected(readProfile(settingsPath, normalized), expected);\n });\n return readTextProfile(settingsPath, normalized);\n });\n}\n\nexport function renameProfile(\n settingsPath: string,\n name: string,\n newName: string,\n expected: ProfileDocument,\n): ProfileDocument {\n const normalized = normalizeProfileName(newName);\n return mutate(settingsPath, () => {\n const current = readProfile(settingsPath, name);\n assertExpected(current, expected);\n if (current.name === normalized) return current;\n // Explicitly reject case-only renames rather than depending on filesystem case behavior.\n if (collisionKey(current.name) === collisionKey(normalized))\n throw new Error(\"Case-only profile rename is not supported\");\n const directory = profileDirectory(settingsPath);\n assertAvailable(directory, `${normalized}.toml`);\n assertExpected(readProfile(settingsPath, name), expected);\n const destination = join(directory, `${normalized}.toml`);\n renameSync(current.path, destination);\n flushMutation(directory, destination);\n return readProfile(settingsPath, normalized);\n });\n}\n\nexport function deleteProfile(settingsPath: string, name: string, expected: ProfileDocument): void {\n mutate(settingsPath, () => {\n const current = readProfile(settingsPath, name);\n assertExpected(current, expected);\n unlinkSync(current.path);\n flushMutation(dirname(current.path), current.path);\n });\n}\n\nfunction assertTimestamp(value: string): void {\n const time = Date.parse(value);\n if (!Number.isFinite(time) || new Date(time).toISOString() !== value) throw new Error(\"Invalid history timestamp\");\n}\n\nfunction historyLocation(settingsPath: string, name: string): { path: string; legacy: boolean; createdAt: string } {\n const modern = HISTORY_NAME.exec(name);\n if (modern) {\n const createdAt = modern[1].replace(/T(\\d{2})-(\\d{2})-(\\d{2})/u, \"T$1:$2:$3\");\n assertTimestamp(createdAt);\n return { path: join(historyDirectory(settingsPath), name), legacy: false, createdAt };\n }\n const legacy = LEGACY_NAME.exec(name);\n if (legacy) {\n const createdAt = `${legacy[1]}-${legacy[2]}-${legacy[3]}T${legacy[4]}:${legacy[5]}`;\n assertTimestamp(`${createdAt}:00.000Z`);\n return { path: join(rootPath(settingsPath), name), legacy: true, createdAt };\n }\n throw new Error(\"Invalid history filename\");\n}\n\nexport function readHistory(settingsPath: string, name: string): HistoryDocument {\n const location = historyLocation(settingsPath, name);\n const document = readBytes(location.path);\n const decoded = document.rawBytes.toString(\"utf8\");\n const valid = Buffer.from(decoded, \"utf8\").equals(document.rawBytes);\n return Object.freeze({\n kind: \"history\",\n name,\n ...location,\n ...document,\n rawDocument: valid ? decoded : undefined,\n ...(valid ? {} : { readError: \"Recovery document is not valid UTF-8; raw bytes are preserved\" }),\n });\n}\n\nexport function listHistory(settingsPath: string): HistoryDocument[] {\n const history: HistoryDocument[] = [];\n for (const [directory, pattern] of [\n [historyDirectory(settingsPath), HISTORY_NAME],\n [rootPath(settingsPath), LEGACY_NAME],\n ] as const) {\n if (!checkedDirectory(directory)) continue;\n for (const name of readdirSync(directory).sort()) {\n if (!pattern.test(name)) continue;\n try {\n historyLocation(settingsPath, name);\n } catch (error) {\n if (error instanceof Error && error.message === \"Invalid history timestamp\") continue;\n throw error;\n }\n const stat = statIfPresent(join(directory, name));\n if (!stat?.isFile() || stat.isSymbolicLink()) continue;\n history.push(readHistory(settingsPath, name));\n }\n }\n return history.sort(\n (left, right) => Date.parse(right.createdAt) - Date.parse(left.createdAt) || left.name.localeCompare(right.name),\n );\n}\n\n/** Return only after file AND directory fsync. Keep recovery bytes even if a later operation fails. */\nexport function archiveConfigDocument(settingsPath: string, rawDocument: string | Buffer): ArchiveReference {\n const bytes = typeof rawDocument === \"string\" ? encodeDocument(rawDocument) : Buffer.from(rawDocument);\n return mutate(settingsPath, () => {\n const directory = historyDirectory(settingsPath);\n checkedDirectory(directory, true);\n const name = `${new Date().toISOString().replace(/:/gu, \"-\")}-${randomUUID()}.toml`;\n publish(directory, name, bytes, () => assertAvailable(directory, name));\n return Object.freeze({ name, path: join(directory, name) });\n });\n}\n\nexport function deleteHistory(settingsPath: string, name: string, expected: HistoryDocument): void {\n if (historyLocation(settingsPath, name).legacy) throw new Error(\"Legacy recovery files are read-only\");\n mutate(settingsPath, () => {\n const current = readHistory(settingsPath, name);\n assertExpected(current, expected);\n unlinkSync(current.path);\n flushMutation(dirname(current.path), current.path);\n });\n}\n", "import { stripVTControlCharacters } from \"node:util\";\nimport type { ExtensionCommandContext, KeybindingsManager, Theme } from \"@earendil-works/pi-coding-agent\";\nimport { Key, matchesKey, truncateToWidth, wrapTextWithAnsi } from \"@earendil-works/pi-tui\";\nimport { runCustomInteraction } from \"@narumitw/pi-tui-kit\";\n\nconst RESERVED_HOST_ROWS = 3;\n\nexport interface PreviewMenuItem<Value extends string> {\n value: Value;\n label: string;\n}\n\nexport type PreviewMenuResult<Value extends string> =\n | { kind: \"selected\"; value: Value }\n | { kind: \"cancelled\" }\n | { kind: \"closed\" };\n\nexport async function showPreviewActionMenu<Value extends string>(\n ctx: ExtensionCommandContext,\n title: string,\n body: (width: number, theme: Theme) => readonly string[],\n items: readonly PreviewMenuItem<Value>[],\n signal?: AbortSignal,\n isCurrent: () => boolean = () => !signal?.aborted,\n): Promise<PreviewMenuResult<Value> | undefined> {\n if (signal?.aborted || !isCurrent()) return { kind: \"closed\" };\n const result = await runCustomInteraction<PreviewMenuResult<Value>>(ctx, {\n signal,\n isCurrent,\n create: ({ tui, theme, keybindings, complete }) => {\n let selectedIndex = 0;\n let scrollOffset = 0;\n let lastMaximumScroll = 0;\n let lastViewportSize = 1;\n let disposed = false;\n\n const requestRender = () => {\n if (!disposed) tui.requestRender();\n };\n const moveSelection = (delta: number) => {\n if (items.length === 0) return;\n selectedIndex = (selectedIndex + delta + items.length) % items.length;\n requestRender();\n };\n const movePreview = (offset: number) => {\n scrollOffset = Math.max(0, Math.min(offset, lastMaximumScroll));\n requestRender();\n };\n\n return {\n render(width: number): string[] {\n const safeWidth = Math.max(1, width);\n const terminalRows = Number.isFinite(tui.terminal.rows) ? Math.floor(tui.terminal.rows) : 24;\n const availableRows = Math.max(1, terminalRows - RESERVED_HOST_ROWS);\n const bodyLines = body(safeWidth, theme).flatMap((line) => (line ? wrapTextWithAnsi(line, safeWidth) : [\"\"]));\n const layout = allocateLayout(availableRows, items.length, bodyLines.length);\n lastViewportSize = layout.previewRows;\n lastMaximumScroll = Math.max(0, bodyLines.length - layout.previewRows);\n scrollOffset = Math.max(0, Math.min(scrollOffset, lastMaximumScroll));\n const actionStart = actionWindowStart(selectedIndex, items.length, layout.actionRows);\n const actionLines = items.slice(actionStart, actionStart + layout.actionRows).map((item, index) => {\n const absoluteIndex = actionStart + index;\n const prefix = absoluteIndex === selectedIndex ? \"\u2192 \" : \" \";\n return theme.fg(\n absoluteIndex === selectedIndex ? \"accent\" : \"text\",\n `${prefix}${safeDisplayText(item.label)}`,\n );\n });\n const position = layout.positionRows\n ? [theme.fg(\"dim\", previewPosition(scrollOffset, layout.previewRows, bodyLines.length))]\n : [];\n const lines = [\n ...(layout.titleRows ? [theme.fg(\"accent\", theme.bold(safeDisplayText(title)))] : []),\n ...bodyLines.slice(scrollOffset, scrollOffset + layout.previewRows),\n ...position,\n ...actionLines,\n ...(layout.hintRows ? [theme.fg(\"dim\", previewHint(keybindings))] : []),\n ];\n return lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n },\n invalidate() {},\n handleInput(data: string) {\n if (disposed) return;\n if (matchesKey(data, Key.ctrl(\"c\"))) {\n complete({ kind: \"closed\" });\n } else if (keybindings.matches(data, \"tui.select.cancel\")) {\n complete({ kind: \"cancelled\" });\n } else if (keybindings.matches(data, \"tui.select.up\")) {\n moveSelection(-1);\n } else if (keybindings.matches(data, \"tui.select.down\")) {\n moveSelection(1);\n } else if (keybindings.matches(data, \"tui.select.pageUp\")) {\n movePreview(scrollOffset - lastViewportSize);\n } else if (keybindings.matches(data, \"tui.select.pageDown\")) {\n movePreview(scrollOffset + lastViewportSize);\n } else if (matchesKey(data, Key.home)) {\n movePreview(0);\n } else if (matchesKey(data, Key.end)) {\n movePreview(lastMaximumScroll);\n } else if (keybindings.matches(data, \"tui.select.confirm\")) {\n const item = items[selectedIndex];\n if (item) complete({ kind: \"selected\", value: item.value });\n }\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n },\n };\n },\n });\n if (result.kind === \"completed\") return result.value;\n if (result.kind === \"error\") throw result.error;\n if (result.kind === \"stale\" && (signal?.aborted || !isCurrent())) return { kind: \"closed\" };\n return undefined;\n}\n\ninterface PreviewLayout {\n titleRows: number;\n previewRows: number;\n positionRows: number;\n actionRows: number;\n hintRows: number;\n}\n\nfunction allocateLayout(availableRows: number, actionCount: number, bodyLineCount: number): PreviewLayout {\n if (availableRows === 1) {\n return { titleRows: 0, previewRows: 0, positionRows: 0, actionRows: 1, hintRows: 0 };\n }\n const titleRows = availableRows >= 3 ? 1 : 0;\n const hintRows = availableRows >= 3 ? 1 : 0;\n const minimumPreviewRows = bodyLineCount > 0 && availableRows >= 4 ? 1 : 0;\n const availableActionRows = Math.max(1, availableRows - titleRows - hintRows - minimumPreviewRows);\n const actionRows = Math.min(Math.max(1, actionCount), availableActionRows);\n let previewRows = Math.max(0, availableRows - titleRows - hintRows - actionRows);\n const positionRows = previewRows >= 2 && bodyLineCount > previewRows ? 1 : 0;\n previewRows -= positionRows;\n return { titleRows, previewRows, positionRows, actionRows, hintRows };\n}\n\nfunction actionWindowStart(selectedIndex: number, itemCount: number, viewportSize: number): number {\n if (itemCount <= viewportSize) return 0;\n return Math.max(0, Math.min(selectedIndex, itemCount - viewportSize));\n}\n\nfunction previewPosition(offset: number, viewportSize: number, lineCount: number): string {\n if (lineCount === 0) return \"0/0\";\n return `${offset + 1}-${Math.min(lineCount, offset + viewportSize)}/${lineCount}`;\n}\n\nfunction previewHint(keybindings: Pick<KeybindingsManager, \"getKeys\">): string {\n const up = bindingText(keybindings, \"tui.select.up\");\n const down = bindingText(keybindings, \"tui.select.down\");\n const confirm = bindingText(keybindings, \"tui.select.confirm\");\n const cancel = bindingText(keybindings, \"tui.select.cancel\", \"ctrl+c\");\n const pageUp = bindingText(keybindings, \"tui.select.pageUp\");\n const pageDown = bindingText(keybindings, \"tui.select.pageDown\");\n return [\n ...(up || down ? [`${[up, down].filter(Boolean).join(\"/\")} navigate`] : []),\n ...(confirm ? [`${confirm} select`] : []),\n ...(cancel ? [`${cancel} discard`] : []),\n \"ctrl+c close\",\n ...(pageUp || pageDown ? [`${[pageUp, pageDown].filter(Boolean).join(\"/\")} preview`] : []),\n ].join(\" \u2022 \");\n}\n\nfunction bindingText(\n keybindings: Pick<KeybindingsManager, \"getKeys\">,\n binding: Parameters<KeybindingsManager[\"getKeys\"]>[0],\n excluded?: string,\n): string {\n return keybindings\n .getKeys(binding)\n .filter((key) => key !== excluded)\n .map((key) => {\n if (key === \"up\") return \"\u2191\";\n if (key === \"down\") return \"\u2193\";\n if (key === \"escape\") return \"esc\";\n if (key === \"return\") return \"enter\";\n return safeDisplayText(key);\n })\n .join(\"/\");\n}\n\nfunction safeDisplayText(value: string): string {\n return Array.from(stripVTControlCharacters(value), (character) => {\n const codePoint = character.codePointAt(0) ?? 0;\n const control = codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f);\n return control ? \"\" : character;\n }).join(\"\");\n}\n", "export const BRACKETED_SEGMENTS_PRESET = String.raw`# Font-safe bracketed segments inspired by Starship.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = '[\\[$symbol\\]]($style) '\nstyle = \"bold white\"\n\n[model]\nformat = '[\\[$symbol $model\\]]($style) '\nsymbol = \"AI\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = '[\\[$symbol $level\\]]($style) '\nsymbol = \"think\"\nstyle = \"bold purple\"\n\n[directory]\nformat = '[\\[$symbol $path\\]]($style) '\nsymbol = \"dir\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = '[\\[$symbol $branch\\]]($style) '\nsymbol = \"git\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = '[\\[$all_status( $ahead_behind)\\]]($style) '\nstyle = \"red bold\"\n\n[activity]\nformat = '[\\[$text\\]]($style) '\nsymbol = \"run\"\nstyle = \"bold yellow\"\n\n[context]\nformat = '[\\[$symbol $percentage\\]]($style) '\nsymbol = \"ctx\"\n\n[time]\nformat = '[\\[$time\\]]($style)'\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const CATPPUCCIN_POWERLINE_PRESET = `# Pi-native adaptation of Starship's Catppuccin Powerline preset.\nformat = \"[\uE0B6](red)$brand$model[\uE0B0](bg:peach fg:red)$directory[\uE0B0](bg:yellow fg:peach)$git_branch$git_status[\uE0B0](fg:yellow bg:green)$thinking$activity[\uE0B0](fg:green bg:sapphire)$context[\uE0B0](fg:sapphire bg:lavender)$time[\uE0B4](fg:lavender)\"\npalette = \"catppuccin_mocha\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:crust bg:red bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:red bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:peach bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:crust bg:yellow bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:crust bg:yellow bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:crust bg:green bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:crust bg:green bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:crust bg:sapphire bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"sapphire\"\nhidden = false\n\n[time]\nformat = \"[ \uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:lavender bold\"\n\n[palettes.catppuccin_mocha]\nred = \"#f38ba8\"\npeach = \"#fab387\"\nyellow = \"#f9e2af\"\ngreen = \"#a6e3a1\"\nsapphire = \"#74c7ec\"\nlavender = \"#b4befe\"\ncrust = \"#11111b\"\n\n[palettes.catppuccin_frappe]\nred = \"#e78284\"\npeach = \"#ef9f76\"\nyellow = \"#e5c890\"\ngreen = \"#a6d189\"\nsapphire = \"#85c1dc\"\nlavender = \"#babbf1\"\ncrust = \"#232634\"\n\n[palettes.catppuccin_latte]\nred = \"#d20f39\"\npeach = \"#fe640b\"\nyellow = \"#df8e1d\"\ngreen = \"#40a02b\"\nsapphire = \"#209fb5\"\nlavender = \"#7287fd\"\ncrust = \"#dce0e8\"\n\n[palettes.catppuccin_macchiato]\nred = \"#ed8796\"\npeach = \"#f5a97f\"\nyellow = \"#eed49f\"\ngreen = \"#a6da95\"\nsapphire = \"#7dc4e4\"\nlavender = \"#b7bdf8\"\ncrust = \"#181926\"\n`;\n", "export const GRUVBOX_RAINBOW_PRESET = `# Pi-native adaptation of Starship's Gruvbox Rainbow preset.\nformat = \"[\uE0B6](color_orange)$brand$model[\uE0B0](bg:color_yellow fg:color_orange)$directory[\uE0B0](fg:color_yellow bg:color_aqua)$git_branch$git_status[\uE0B0](fg:color_aqua bg:color_blue)$thinking$activity[\uE0B0](fg:color_blue bg:color_bg3)$context[\uE0B0](fg:color_bg3 bg:color_bg1)$time[\uE0B4](fg:color_bg1)\"\npalette = \"gruvbox_dark\"\n\n[palettes.gruvbox_dark]\ncolor_fg0 = \"#fbf1c7\"\ncolor_bg1 = \"#3c3836\"\ncolor_bg3 = \"#665c54\"\ncolor_blue = \"#458588\"\ncolor_aqua = \"#689d6a\"\ncolor_green = \"#98971a\"\ncolor_orange = \"#d65d0e\"\ncolor_purple = \"#b16286\"\ncolor_red = \"#cc241d\"\ncolor_yellow = \"#d79921\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:color_fg0 bg:color_orange bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_orange bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_yellow bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:color_fg0 bg:color_aqua bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:color_fg0 bg:color_aqua bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:color_fg0 bg:color_blue bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:color_fg0 bg:color_blue bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:color_fg0 bg:color_bg3 bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"color_bg3\"\nhidden = false\n\n[time]\nformat = \"[ \uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_bg1 bold\"\n`;\n", "export const JETPACK_PRESET = `# Pi-native adaptation of Starship's Jetpack preset.\n# Left-side session activity and right-side workspace context meet at $fill.\nformat = \"$activity$context$fill$directory$git_branch$git_state$git_status$time\"\n\n[activity]\nformat = \"[\u25C4 $text ]($style)\"\nsymbol = \"\"\nstyle = \"italic white\"\n\n[context]\nformat = \"[\u25EF $percentage]($style) \"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold purple\"\nhidden = false\n\n[fill]\nsymbol = \" \"\nstyle = \"none\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"italic blue\"\ntruncation_length = 2\ntruncation_symbol = \"\u25A1 \"\nhome_symbol = \"\u2302\"\n\n[git_branch]\nformat = \"[$symbol$branch]($style)\"\nsymbol = \"\u25B3 \"\nstyle = \"italic bright-blue\"\ntruncation_length = 11\ntruncation_symbol = \"\u22EF\"\n\n[git_state]\nformat = \"([\u23AA$state $progress_current/$progress_total\u23A5]($style))\"\nsymbol = \"\"\nstyle = \"italic bright-purple\"\n\n[git_status]\nformat = \"([\u23AA$all_status$ahead_behind\u23A5]($style))\"\nstyle = \"bold italic bright-blue\"\n\n[time]\nformat = \"[ $time]($style)\"\nsymbol = \"\"\nstyle = \"italic dimmed white\"\n`;\n", "export const MINIMAL_PRESET = `# A compact, font-safe Pi footer.\nformat = \"$model$directory$git_branch$activity\"\n\n[model]\nformat = \"[$model]($style) \"\nsymbol = \"\"\nstyle = \"bold blue\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[git:$branch]($style) \"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[activity]\nformat = \"[$text]($style)\"\nsymbol = \"*\"\nstyle = \"bold yellow\"\n`;\n", "export const NERD_FONT_SYMBOLS_PRESET = `# Balanced Pi footer with Nerd Font symbols.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nsymbol = \"\uE285\"\n\n[model]\nsymbol = \"\uDB81\uDEA9\"\n\n[thinking]\nsymbol = \"\uDB81\uDD1F\"\n\n[directory]\nsymbol = \"\uDB80\uDE4B\"\n\n[git_branch]\nsymbol = \"\uF418\"\n\n[activity]\nsymbol = \"\uDB81\uDC6E\"\n\n[context]\nsymbol = \"\uDB80\uDF5B\"\n\n[time]\nsymbol = \"\uF43A\"\n`;\n", "export const NO_EMPTY_ICONS_PRESET = `# Pi-native adaptation of Starship's No Empty Icons preset.\n# Each label lives inside the same conditional group as its value.\nformat = \"$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[model]\nformat = \"([model $model]($style) )\"\nsymbol = \"\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"([thinking $level]($style) )\"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"([in $path]($style) )\"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"([on $branch]($style) )\"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"([$all_status$ahead_behind]($style) )\"\nstyle = \"red bold\"\n\n[activity]\nformat = \"([while $text]($style) )\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"([using $percentage context]($style) )\"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"([at $time]($style))\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const NO_NERD_FONT_PRESET = `# Pi-native adaptation of Starship's No Nerd Font preset.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"\u2726\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol $model]($style) \"\nsymbol = \"\u25C6\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol $level]($style) \"\nsymbol = \"\u25C7\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$symbol $path]($style) \"\nsymbol = \"\u2302\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol $branch]($style) \"\nsymbol = \"\u2387\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"\u25CF\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$symbol $percentage]($style) \"\nsymbol = \"\u25CC\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$symbol $time]($style)\"\nsymbol = \"\u25F4\"\nstyle = \"bold yellow\"\n`;\n", "export const NO_RUNTIME_VERSIONS_PRESET = `# Pi-native adaptation of Starship's No Runtime Versions preset.\n# Model and thinking modules retain presence symbols while hiding version-like details.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"\u03C0\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol]($style) \"\nsymbol = \"AI\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol]($style) \"\nsymbol = \"think\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol$branch]($style) \"\nsymbol = \"git:\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$symbol]($style) \"\nsymbol = \"run\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$percentage]($style) \"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$time]($style)\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const PASTEL_POWERLINE_PRESET = `# Pi-native adaptation of Starship's Pastel Powerline preset.\nformat = \"[\uE0B6](#9A348E)$brand$model[\uE0B0](bg:#DA627D fg:#9A348E)$directory[\uE0B0](fg:#DA627D bg:#FCA17D)$git_branch$git_status[\uE0B0](fg:#FCA17D bg:#86BBD8)$thinking$activity[\uE0B0](fg:#86BBD8 bg:#06969A)$context[\uE0B0](fg:#06969A bg:#33658A)$time[\uE0B4](fg:#33658A)\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:#ffffff bg:#9A348E bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#9A348E bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#DA627D bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:#1f1f1f bg:#FCA17D bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:#1f1f1f bg:#FCA17D bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:#1f1f1f bg:#86BBD8 bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:#1f1f1f bg:#86BBD8 bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:#ffffff bg:#06969A bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"#06969A\"\nhidden = false\n\n[time]\nformat = \"[ \u2665 $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#33658A bold\"\n`;\n", "export const PLAIN_TEXT_SYMBOLS_PRESET = `# Pi-native adaptation of Starship's Plain Text Symbols preset.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"pi\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol $model]($style) \"\nsymbol = \"model\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol $level]($style) \"\nsymbol = \"thinking\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$symbol $path]($style) \"\nsymbol = \"dir\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol $branch]($style) \"\nsymbol = \"git\"\nstyle = \"bold purple\"\ntruncation_symbol = \"...\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"active\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$symbol $percentage]($style) \"\nsymbol = \"context\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$symbol $time]($style)\"\nsymbol = \"time\"\nstyle = \"bold yellow\"\n`;\n", "export const PURE_PRESET = `# Pi-native adaptation of Starship's Pure preset.\nformat = \"$directory$git_branch$git_state$git_status$activity\\\\n$model$thinking$context$fill$time\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"blue\"\n\n[git_branch]\nformat = \"[$branch]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[git_state]\nformat = '([($state( $progress_current/$progress_total))]($style) )'\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[git_status]\nformat = \"[(*$all_status)](218) [$ahead_behind]($style) \"\nstyle = \"cyan\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"\"\nstyle = \"yellow\"\n\n[model]\nformat = \"[$model]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[thinking]\nformat = \"[$level]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[context]\nformat = \"[$percentage]($style)\"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bright-black\"\nhidden = false\n\n[fill]\nsymbol = \" \"\nstyle = \"none\"\n\n[time]\nformat = \"[$time]($style)\"\nsymbol = \"\"\nstyle = \"bright-black\"\n`;\n", "export const TOKYO_NIGHT_PRESET = `# Pi-native adaptation of Starship's Tokyo Night preset.\nformat = \"[\u2591\u2592\u2593](#a3aed2)$brand$model[\uE0B4](bg:#769ff0 fg:#a3aed2)$directory[\uE0B4](fg:#769ff0 bg:#394260)$git_branch$git_status[\uE0B4](fg:#394260 bg:#212736)$thinking$activity[\uE0B4](fg:#212736 bg:#1d2230)$context$time[\uE0B4](fg:#1d2230)\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:#090c0c bg:#a3aed2 bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#090c0c bg:#a3aed2 bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#e3e5e5 bg:#769ff0 bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:#769ff0 bg:#394260 bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:#769ff0 bg:#394260 bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:#769ff0 bg:#212736 bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:#769ff0 bg:#212736 bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:#a0a9cb bg:#1d2230 bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"#1d2230\"\nhidden = false\n\n[time]\nformat = \"[\uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#a0a9cb bg:#1d2230 bold\"\n`;\n", "import { BRACKETED_SEGMENTS_PRESET } from \"./bracketed-segments.js\";\nimport { CATPPUCCIN_POWERLINE_PRESET } from \"./catppuccin-powerline.js\";\nimport { GRUVBOX_RAINBOW_PRESET } from \"./gruvbox-rainbow.js\";\nimport { JETPACK_PRESET } from \"./jetpack.js\";\nimport { MINIMAL_PRESET } from \"./minimal.js\";\nimport { NERD_FONT_SYMBOLS_PRESET } from \"./nerd-font-symbols.js\";\nimport { NO_EMPTY_ICONS_PRESET } from \"./no-empty-icons.js\";\nimport { NO_NERD_FONT_PRESET } from \"./no-nerd-font.js\";\nimport { NO_RUNTIME_VERSIONS_PRESET } from \"./no-runtime-versions.js\";\nimport { PASTEL_POWERLINE_PRESET } from \"./pastel-powerline.js\";\nimport { PLAIN_TEXT_SYMBOLS_PRESET } from \"./plain-text-symbols.js\";\nimport { PURE_PRESET } from \"./pure-preset.js\";\nimport { TOKYO_NIGHT_PRESET } from \"./tokyo-night.js\";\n\nexport interface StarshipPreset {\n id:\n | \"minimal\"\n | \"bracketed-segments\"\n | \"catppuccin-powerline\"\n | \"gruvbox-rainbow\"\n | \"jetpack\"\n | \"nerd-font-symbols\"\n | \"no-empty-icons\"\n | \"no-nerd-font\"\n | \"no-runtime-versions\"\n | \"pastel-powerline\"\n | \"plain-text-symbols\"\n | \"pure-preset\"\n | \"tokyo-night\";\n label: string;\n description: string;\n requiresNerdFont: boolean;\n rawDocument: string;\n}\n\nexport const STARSHIP_PRESETS = [\n {\n id: \"minimal\",\n label: \"Minimal\",\n description: \"Compact Pi essentials \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: MINIMAL_PRESET,\n },\n {\n id: \"bracketed-segments\",\n label: \"Bracketed Segments\",\n description: \"Balanced Pi and Git details in brackets \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: BRACKETED_SEGMENTS_PRESET,\n },\n {\n id: \"catppuccin-powerline\",\n label: \"Catppuccin Powerline\",\n description: \"Mocha connected color blocks \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: CATPPUCCIN_POWERLINE_PRESET,\n },\n {\n id: \"gruvbox-rainbow\",\n label: \"Gruvbox Rainbow\",\n description: \"Warm Gruvbox connected segments \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: GRUVBOX_RAINBOW_PRESET,\n },\n {\n id: \"jetpack\",\n label: \"Jetpack\",\n description: \"Airy geometric left/right layout \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: JETPACK_PRESET,\n },\n {\n id: \"nerd-font-symbols\",\n label: \"Nerd Font Symbols\",\n description: \"Balanced default layout with icon-rich symbols \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: NERD_FONT_SYMBOLS_PRESET,\n },\n {\n id: \"no-empty-icons\",\n label: \"No Empty Icons\",\n description: \"Conditional labels never appear without values \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: NO_EMPTY_ICONS_PRESET,\n },\n {\n id: \"no-nerd-font\",\n label: \"No Nerd Font\",\n description: \"Portable Unicode symbols without private-use glyphs \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: NO_NERD_FONT_PRESET,\n },\n {\n id: \"no-runtime-versions\",\n label: \"No Runtime Versions\",\n description: \"Presence indicators without model or thinking details \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: NO_RUNTIME_VERSIONS_PRESET,\n },\n {\n id: \"pastel-powerline\",\n label: \"Pastel Powerline\",\n description: \"Pastel connected color blocks \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: PASTEL_POWERLINE_PRESET,\n },\n {\n id: \"plain-text-symbols\",\n label: \"Plain Text Symbols\",\n description: \"Plain words replace pictograms \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: PLAIN_TEXT_SYMBOLS_PRESET,\n },\n {\n id: \"pure-preset\",\n label: \"Pure Preset\",\n description: \"Clean two-line workspace and session context \u00B7 font-safe\",\n requiresNerdFont: false,\n rawDocument: PURE_PRESET,\n },\n {\n id: \"tokyo-night\",\n label: \"Tokyo Night\",\n description: \"Cool connected color blocks \u00B7 requires Nerd Font\",\n requiresNerdFont: true,\n rawDocument: TOKYO_NIGHT_PRESET,\n },\n] as const satisfies readonly StarshipPreset[];\n\nexport function getStarshipPreset(id: StarshipPreset[\"id\"]): StarshipPreset {\n const preset = STARSHIP_PRESETS.find((candidate) => candidate.id === id);\n if (!preset) throw new Error(`Unknown pi-starship preset: ${id}`);\n return preset;\n}\n\nexport function presetForDocument(rawDocument: string | undefined): StarshipPreset | undefined {\n return STARSHIP_PRESETS.find((preset) => preset.rawDocument === rawDocument);\n}\n", "import { type ExtensionCommandContext, withFileMutationQueue } from \"@earendil-works/pi-coding-agent\";\nimport { sanitizeTerminalText } from \"@narumitw/pi-tui-kit/terminal-text\";\nimport { type PreviewMenuResult, showPreviewActionMenu } from \"./command-preview.js\";\nimport {\n assertConfigDocumentUnchanged,\n BUILT_IN_EXAMPLE,\n type ConfigDocumentSnapshot,\n type LoadedStarshipConfig,\n loadStarshipConfig,\n readConfigDocumentSnapshot,\n} from \"./config.js\";\nimport { presetForDocument } from \"./presets/catalog.js\";\nimport { archiveConfigDocument } from \"./profile-store.js\";\n\nconst RELOAD_ACTIONS = {\n apply: \"apply\",\n cancel: \"cancel\",\n} as const;\n\nexport interface WorkflowOwner {\n signal: AbortSignal;\n isCurrent(): boolean;\n /** Session ownership independent of command cancellation and candidate/revision guards. */\n isSessionCurrent?(): boolean;\n /** The shared parent terminal can remain live after its session context changes. */\n canRestoreTerminal?(): boolean;\n}\n\nexport interface ConfigurationCommandOptions {\n getLoaded(): LoadedStarshipConfig;\n getLoadedRevision?(): number;\n apply(loaded: LoadedStarshipConfig, ctx: ExtensionCommandContext): void;\n settingsPath: string;\n renderPreview?(loaded: LoadedStarshipConfig, width: number, ctx: ExtensionCommandContext): string[];\n read?: (settingsPath: string) => LoadedStarshipConfig;\n archive?: typeof archiveConfigDocument;\n}\n\nexport interface ConfigurationPresentation {\n state: string;\n source: string;\n health: string;\n restoreDisabled: boolean;\n restoreDescription: string;\n}\n\nexport function configurationPresentation(loaded: LoadedStarshipConfig): ConfigurationPresentation {\n const healthyMissing = isHealthyMissing(loaded);\n const savedBuiltIn = loaded.source === \"user\" && loaded.rawDocument === BUILT_IN_EXAMPLE;\n const activePreset = presetForDocument(loaded.rawDocument);\n const fallback = loaded.source === \"built-in\" && loaded.diagnostics.length > 0;\n return {\n state: healthyMissing\n ? \"Pi native footer\"\n : savedBuiltIn\n ? \"Saved built-in configuration\"\n : activePreset\n ? `${activePreset.label} preset`\n : fallback\n ? \"Built-in fallback\"\n : \"Custom configuration\",\n source: healthyMissing\n ? \"No settings file\"\n : activePreset\n ? \"Bundled preset\"\n : loaded.source === \"user\"\n ? \"User file\"\n : \"Built-in fallback\",\n health: configurationHealth(loaded),\n restoreDisabled: healthyMissing,\n restoreDescription: healthyMissing\n ? \"Already using Pi native footer \u00B7 no file to remove\"\n : \"Preview before restoring Pi native footer\",\n };\n}\n\nexport function configurationMenuScreen(loaded: LoadedStarshipConfig, settingsPath: string) {\n const presentation = configurationPresentation(loaded);\n return {\n kind: \"actions\" as const,\n title: \"Configuration\",\n lines: [\n `State: ${presentation.state}`,\n `Source: ${presentation.source}`,\n `Path: ${sanitizeTerminalText(settingsPath)}`,\n ...diagnosticLines(loaded, true, loaded.diagnostics.length),\n ],\n items: [\n {\n id: \"configuration-reload\",\n label: \"Reload from disk\u2026\",\n description: \"Validate and preview external changes\",\n action: \"configuration-reload\" as const,\n },\n {\n id: \"gist-share\",\n label: \"Share settings as Gist\u2026\",\n description: \"Upload reviewed TOML to GitHub \u00B7 unlisted, not private \u00B7 requires gh\",\n action: \"gist-share\" as const,\n },\n {\n id: \"gist-import\",\n label: \"Import settings from Gist\u2026\",\n description: \"Review and preview remote TOML before replacing settings \u00B7 requires gh\",\n action: \"gist-import\" as const,\n },\n {\n id: \"history\",\n label: \"History\",\n description: \"Review and restore recovery copies; legacy skill backups are read-only\",\n action: \"history\" as const,\n },\n ],\n hint: \"back\" as const,\n };\n}\n\nexport async function reloadConfiguration(\n ctx: ExtensionCommandContext,\n options: ConfigurationCommandOptions,\n owner: WorkflowOwner,\n): Promise<\"applied\" | \"stay\" | \"close\"> {\n if (!isCurrentOwner(owner)) return \"stay\";\n const previous = options.getLoaded();\n const revision = options.getLoadedRevision?.();\n const candidate = readReloadCandidate(options);\n let disk: ConfigDocumentSnapshot;\n try {\n disk = readConfigDocumentSnapshot(options.settingsPath);\n } catch (error) {\n ctx.ui.notify(`Footer reload was blocked: ${safeError(error)}`, \"error\");\n return \"stay\";\n }\n if (!candidate.ok) {\n ctx.ui.notify(`Footer reload was blocked: ${safeError(candidate.error)}`, \"error\");\n return \"stay\";\n }\n if (sameLoadedDocument(previous, candidate.loaded)) {\n ctx.ui.notify(\"The current disk configuration is already loaded.\", \"info\");\n return \"stay\";\n }\n\n const selection = await showPreviewActionMenu(\n ctx,\n \"Reload preview\",\n (width) => reloadPreviewBody(ctx, options, candidate.loaded, width),\n [\n { value: RELOAD_ACTIONS.apply, label: \"Apply reloaded configuration\u2026\" },\n { value: RELOAD_ACTIONS.cancel, label: \"Cancel\" },\n ],\n owner.signal,\n owner.isCurrent,\n );\n if (!isCurrentOwner(owner) || activeRevisionChanged(options, revision)) return \"stay\";\n if (selection?.kind === \"closed\") return \"close\";\n if (selectedReloadAction(selection) !== RELOAD_ACTIONS.apply) return \"stay\";\n\n const confirmed = await ctx.ui.confirm(\n \"Apply configuration from disk?\",\n candidate.loaded.rawDocument === undefined\n ? \"Show Pi's native footer for this session? No settings file will be created.\"\n : \"Apply the validated settings document to this session without changing its bytes? The previous loaded document will be kept in History.\",\n { signal: owner.signal },\n );\n if (!isCurrentOwner(owner) || activeRevisionChanged(options, revision) || !confirmed) {\n return \"stay\";\n }\n\n let warnings = 0;\n try {\n const applied = await withFileMutationQueue(options.settingsPath, async () => {\n if (\n !isCurrentOwner(owner) ||\n activeRevisionChanged(options, revision) ||\n !sameLoadedDocument(previous, options.getLoaded())\n )\n return false;\n assertConfigDocumentUnchanged(options.settingsPath, disk);\n const fresh = readReloadCandidate(options);\n if (!fresh.ok) throw new Error(fresh.error);\n if (!sameLoadedDocument(candidate.loaded, fresh.loaded)) {\n throw new Error(\n \"The settings document changed after preview. The previous footer remains active; reload again to review the latest version.\",\n );\n }\n let recoveryPath: string | undefined;\n const previousBytes = previous.rawBytes ?? previous.rawDocument;\n if (previousBytes !== undefined) {\n recoveryPath = (options.archive ?? archiveConfigDocument)(options.settingsPath, previousBytes).path;\n }\n assertConfigDocumentUnchanged(options.settingsPath, disk);\n if (!isCurrentOwner(owner) || activeRevisionChanged(options, revision)) return false;\n try {\n options.apply(fresh.loaded, ctx);\n } catch (error) {\n let rollbackError: unknown;\n try {\n if (!isCurrentOwner(owner)) throw new Error(\"The session owner changed; stale restoration was blocked\");\n const current = options.getLoaded();\n if (!sameLoadedDocument(current, previous) && !sameLoadedDocument(current, fresh.loaded))\n throw new Error(\"The active runtime changed; stale restoration was blocked\");\n options.apply(previous, ctx);\n } catch (rollback) {\n rollbackError = rollback;\n }\n throw new Error(\n `Footer reload failed: ${formatError(error)}. ${\n rollbackError\n ? `Restoring the previous configuration also failed: ${formatError(rollbackError)}.`\n : \"The previous configuration was restored.\"\n }${recoveryPath ? ` Recovery copy retained: ${recoveryPath}.` : \"\"}`,\n );\n }\n warnings = fresh.loaded.diagnostics.length;\n return true;\n });\n if (!isCurrentOwner(owner) || !applied) return \"stay\";\n } catch (error) {\n if (isCurrentOwner(owner))\n ctx.ui.notify(`Footer reload was blocked after confirmation: ${safeError(error)}`, \"error\");\n return \"stay\";\n }\n ctx.ui.notify(\n warnings === 0\n ? \"Footer configuration reloaded and applied.\"\n : `Footer configuration reloaded and applied with ${warnings} warning${warnings === 1 ? \"\" : \"s\"}.`,\n \"info\",\n );\n return \"applied\";\n}\n\nfunction readReloadCandidate(\n options: ConfigurationCommandOptions,\n): { ok: true; loaded: LoadedStarshipConfig } | { ok: false; error: string } {\n let loaded: LoadedStarshipConfig;\n try {\n loaded = (options.read ?? loadStarshipConfig)(options.settingsPath);\n } catch (error) {\n return { ok: false, error: formatError(error) };\n }\n const errors = loaded.diagnostics.filter((item) => item.severity === \"error\");\n if (errors.length > 0) {\n return { ok: false, error: errors.map((item) => item.message).join(\"; \") };\n }\n return { ok: true, loaded };\n}\n\nfunction reloadPreviewBody(\n ctx: ExtensionCommandContext,\n options: ConfigurationCommandOptions,\n loaded: LoadedStarshipConfig,\n width: number,\n): string[] {\n const presentation = configurationPresentation(loaded);\n let preview: string[];\n try {\n preview = options.renderPreview?.(loaded, width, ctx) ?? [\"Live preview is unavailable until the footer is ready.\"];\n } catch (error) {\n preview = [`Preview unavailable: ${safeError(formatError(error))}`];\n }\n return [\n `Candidate: ${presentation.state}`,\n `Source: ${presentation.source}`,\n `Path: ${sanitizeTerminalText(options.settingsPath)}`,\n loaded.rawDocument === undefined\n ? \"Applying shows Pi's native footer and creates no settings file.\"\n : \"Applying changes only the active session; the settings document bytes stay unchanged.\",\n ...diagnosticLines(loaded, true),\n \"\",\n ...preview,\n ];\n}\n\nexport function diagnosticLines(loaded: LoadedStarshipConfig, includeSummary: boolean, limit = 8): string[] {\n const diagnostics = loaded.diagnostics\n .slice(0, limit)\n .map((item) => `${sanitizeTerminalText(item.path || \"root\")}: ${sanitizeTerminalText(item.message)}`);\n const remaining = loaded.diagnostics.length - diagnostics.length;\n return [\n ...(includeSummary ? [`Health: ${configurationHealth(loaded)}`] : []),\n ...(diagnostics.length > 0 ? diagnostics : [\"No configuration warnings.\"]),\n ...(remaining > 0 ? [`${remaining} additional warnings not shown.`] : []),\n ];\n}\n\nfunction configurationHealth(loaded: LoadedStarshipConfig): string {\n const errors = loaded.diagnostics.filter((item) => item.severity === \"error\").length;\n if (errors > 0) return `${errors} error${errors === 1 ? \"\" : \"s\"}`;\n const warnings = loaded.diagnostics.length;\n return warnings === 0 ? \"Healthy\" : `${warnings} warning${warnings === 1 ? \"\" : \"s\"}`;\n}\n\nfunction isHealthyMissing(loaded: LoadedStarshipConfig): boolean {\n return loaded.source === \"built-in\" && loaded.rawDocument === undefined && loaded.diagnostics.length === 0;\n}\n\nfunction sameLoadedDocument(left: LoadedStarshipConfig, right: LoadedStarshipConfig): boolean {\n return (\n left.source === right.source &&\n left.rawDocument === right.rawDocument &&\n JSON.stringify(left.diagnostics) === JSON.stringify(right.diagnostics)\n );\n}\n\nfunction activeRevisionChanged(options: ConfigurationCommandOptions, revision: number | undefined): boolean {\n return revision !== undefined && options.getLoadedRevision?.() !== revision;\n}\n\nfunction isCurrentOwner(owner: WorkflowOwner): boolean {\n return !owner.signal.aborted && owner.isCurrent();\n}\n\nfunction selectedReloadAction(\n result: PreviewMenuResult<(typeof RELOAD_ACTIONS)[keyof typeof RELOAD_ACTIONS]> | undefined,\n) {\n return result?.kind === \"selected\" ? result.value : null;\n}\n\nfunction safeError(value: unknown): string {\n return sanitizeTerminalText(typeof value === \"string\" ? value : formatError(value));\n}\n\nfunction formatError(error: unknown): string {\n return error instanceof Error ? error.message : String(error);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,MAAI,SAAS,EAAG,QAAO,GAAG,MAAM,SAAS,WAAW,IAAI,KAAK,GAAG;AAChE,QAAM,WAAW,OAAO,YAAY;AACpC,SAAO,aAAa,IAAI,YAAY,GAAG,QAAQ,WAAW,aAAa,IAAI,KAAK,GAAG;AACrF;AAEA,SAAS,iBAAiB,QAAuC;AAC/D,SAAO,OAAO,WAAW,cAAc,OAAO,gBAAgB,UAAa,OAAO,YAAY,WAAW;AAC3G;AAEA,SAAS,mBAAmB,MAA4B,OAAsC;AAC5F,SACE,KAAK,WAAW,MAAM,UACtB,KAAK,gBAAgB,MAAM,eAC3B,KAAK,UAAU,KAAK,WAAW,MAAM,KAAK,UAAU,MAAM,WAAW;AAEzE;AAEA,SAAS,sBAAsB,SAAsC,UAAuC;AAC1G,SAAO,aAAa,UAAa,QAAQ,oBAAoB,MAAM;AACrE;AAEA,SAAS,eAAe,OAA+B;AACrD,SAAO,CAAC,MAAM,OAAO,WAAW,MAAM,UAAU;AAClD;AAEA,SAAS,qBACP,QACA;AACA,SAAO,QAAQ,SAAS,aAAa,OAAO,QAAQ;AACtD;AAEA,SAAS,UAAU,OAAwB;AACzC,SAAO,qBAAqB,OAAO,UAAU,WAAW,QAAQ,YAAY,KAAK,CAAC;AACpF;AAEA,SAAS,YAAY,OAAwB;AAC3C,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;",
6
6
  "names": []
7
7
  }
@@ -2,7 +2,7 @@
2
2
  // @ts-nocheck -- the generated entry uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  configurationMenuScreen
5
- } from "./chunk-Y24TJYG6.ts";
5
+ } from "./chunk-UIKPE4UC.ts";
6
6
  import "./chunk-A65IOGL6.ts";
7
7
  import "./chunk-IYDZ3R2T.ts";
8
8
  import "./chunk-KP33I6BR.ts";
@@ -144,4 +144,4 @@ function showConfigurationMenu(ctx, options, owner, selected) {
144
144
  export {
145
145
  showConfigurationMenu
146
146
  };
147
- //# sourceMappingURL=command-configuration-menu-YOLN2SPR.ts.map
147
+ //# sourceMappingURL=command-configuration-menu-ZN2VXU4L.ts.map