@agimon-ai/doompi-ui 0.0.1-alpha.88 → 0.0.1-alpha.89

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.
@@ -150,6 +150,7 @@ function createBuiltinTools(cwd) {
150
150
  const read = (0, _earendil_works_pi_coding_agent.createReadToolDefinition)(cwd);
151
151
  tools.push((0, _agimon_ai_doompi_core_piExtension.definePiTool)({
152
152
  ...read,
153
+ execute: (...args) => (0, _earendil_works_pi_coding_agent.createReadToolDefinition)(args[4].cwd).execute(...args),
153
154
  renderShell: "self",
154
155
  renderCall: (args, theme) => renderReadCall(args, theme),
155
156
  renderResult: (result, options, theme, context) => {
@@ -162,6 +163,7 @@ function createBuiltinTools(cwd) {
162
163
  const edit = (0, _earendil_works_pi_coding_agent.createEditToolDefinition)(cwd);
163
164
  tools.push((0, _agimon_ai_doompi_core_piExtension.definePiTool)({
164
165
  ...edit,
166
+ execute: (...args) => (0, _earendil_works_pi_coding_agent.createEditToolDefinition)(args[4].cwd).execute(...args),
165
167
  renderShell: "self",
166
168
  renderCall: (args, theme) => renderEditCall(args, theme),
167
169
  renderResult: (result, options, theme, context) => {
@@ -175,6 +177,7 @@ function createBuiltinTools(cwd) {
175
177
  const writeResult = write.renderResult;
176
178
  tools.push((0, _agimon_ai_doompi_core_piExtension.definePiTool)({
177
179
  ...write,
180
+ execute: (...args) => (0, _earendil_works_pi_coding_agent.createWriteToolDefinition)(args[4].cwd).execute(...args),
178
181
  renderShell: "self",
179
182
  renderCall: (args, theme, context) => renderWriteCall(args, theme, {
180
183
  expanded: context.expanded,
@@ -191,6 +194,7 @@ function createBuiltinTools(cwd) {
191
194
  const grepResult = grep.renderResult;
192
195
  tools.push((0, _agimon_ai_doompi_core_piExtension.definePiTool)({
193
196
  ...grep,
197
+ execute: (...args) => (0, _earendil_works_pi_coding_agent.createGrepToolDefinition)(args[4].cwd).execute(...args),
194
198
  renderShell: "self",
195
199
  renderCall: (args, theme) => renderGrepCall(args, theme),
196
200
  renderResult: (result, options, theme, context) => {
@@ -204,6 +208,7 @@ function createBuiltinTools(cwd) {
204
208
  const findResult = find.renderResult;
205
209
  tools.push((0, _agimon_ai_doompi_core_piExtension.definePiTool)({
206
210
  ...find,
211
+ execute: (...args) => (0, _earendil_works_pi_coding_agent.createFindToolDefinition)(args[4].cwd).execute(...args),
207
212
  renderShell: "self",
208
213
  renderCall: (args, theme) => renderFindCall(args, theme),
209
214
  renderResult: (result, options, theme, context) => {
@@ -217,6 +222,7 @@ function createBuiltinTools(cwd) {
217
222
  const lsResult = ls.renderResult;
218
223
  tools.push((0, _agimon_ai_doompi_core_piExtension.definePiTool)({
219
224
  ...ls,
225
+ execute: (...args) => (0, _earendil_works_pi_coding_agent.createLsToolDefinition)(args[4].cwd).execute(...args),
220
226
  renderShell: "self",
221
227
  renderCall: (args, theme) => renderLsCall(args, theme),
222
228
  renderResult: (result, options, theme, context) => {
@@ -1 +1 @@
1
- {"version":3,"file":"pi.cjs","names":["wrapTextWithAnsi","previousDoomToolResult","frameDoomToolResult","renderToolHeading","DoomToolCall","highlightCode","getLanguageFromPath","renderDoomDiff","gutterWidth","renderLineNumber","createReadToolDefinition","definePiTool","createEditToolDefinition","createWriteToolDefinition","createGrepToolDefinition","createFindToolDefinition","createLsToolDefinition","notify","readDoomNotificationService","TITLE_PREFIX","path","DoomUiState","DoomLeaderRegistry","readDoomMcpStatus","UI_EVENT","WARNING_STYLE","LEADER_WIDGET_KEY","WIDGET_PLACEMENT","TOOLS_COMMAND","buildToolSources","extensionName","extensionPackageName","extensionToolSource","openToolsOverlay","CONFIG_COMMAND","openConfigOverlay","SESSION_START_EVENT","SESSION_MESSAGE_ENTRY","DoomHeader","DoomFooter","DoomEditor","LeaderHints","BUILTIN_LEADER_COMMANDS","INPUT_EVENT","defineRoot","createUiTelemetry","DOOM_UI_HUB_SERVICE","DOOM_MINOR_MODE_CATALOG_SERVICE","createMinorModeCatalogClient","requireMinorModeCatalog","projectMinorModeRecords","defineCliCommand","defineCliCommand","defineCliHook","defineCliHook","defineCliTool","defineCliTool","defineCliTool","defineCliTool","defineCliTool","defineCliTool","definePiExtension","rootSession","composeRootHooks","commandConfig","commandTools","hookInput","hookSessionStart","piToolContributions","toolEdit","toolFind","toolGrep","toolLs","toolRead","toolWrite"],"sources":["../../src/tui/builtinToolRender.ts","../../src/tui/builtinTools.ts","../../src/services/eventLoopLag/index.ts","../../src/services/uiHub/index.ts","../../src/tui/uiRuntime.ts","../../src/extensions/workspaces/sessions/(backend)/root.cli.ts","../../src/extensions/workspaces/sessions/(backend)/command/config.cli.ts","../../src/extensions/workspaces/sessions/(backend)/command/tools.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/input.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/edit.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/find.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/grep.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/ls.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/read.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/write.cli.ts","../../generated/pi.ts"],"sourcesContent":["import {\n type EditToolDetails,\n type EditToolInput,\n type FindToolInput,\n type GrepToolInput,\n getLanguageFromPath,\n highlightCode,\n type LsToolInput,\n type ReadToolInput,\n type Theme,\n type WriteToolInput,\n} from '@earendil-works/pi-coding-agent';\nimport { type Component, wrapTextWithAnsi } from '@earendil-works/pi-tui';\n\nimport { gutterWidth, renderLineNumber } from './codeGutter';\nimport { renderDoomDiff } from './diffRender';\nimport { DoomToolCall, frameDoomToolResult, previousDoomToolResult, renderToolHeading } from './toolChrome';\n\nconst COLLAPSED_FILE_LINES = 10;\n\ntype Highlighter = (code: string, language?: string) => string[];\ntype LanguageResolver = (path: string) => string | undefined;\n\nexport interface ToolPreviewOptions {\n expanded?: boolean;\n isError?: boolean;\n}\n\nexport interface WritePreviewOptions extends ToolPreviewOptions {\n argsStreaming?: boolean;\n}\n\nexport interface TextToolResult {\n content?: ReadonlyArray<{ type: string; text?: string }>;\n}\n\nexport interface EditToolResult extends TextToolResult {\n details?: EditToolDetails;\n}\n\n/** Self-owned result shell shared by Pi's native file and search tools. */\nclass BuiltinToolContent implements Component {\n constructor(private readonly text: string) {}\n\n render(width: number): string[] {\n if (width <= 0 || this.text.length === 0) return [];\n return wrapTextWithAnsi(this.text, width);\n }\n\n invalidate(): void {\n // Content is immutable and reflows from the current width on every render.\n }\n}\n\n/** Recover the native renderer's component from the shell returned on its previous pass. */\nexport function previousBuiltinResult(component: Component | undefined): Component | undefined {\n return previousDoomToolResult(component);\n}\n\n/** Reuse the shell while allowing Pi's native renderer to reuse its own inner component. */\nexport function frameBuiltinResult(content: Component, theme: Theme, previous: Component | undefined): Component {\n return frameDoomToolResult(content, theme, previous);\n}\n\nfunction renderCall(label: string, primary: string, details: readonly string[], theme: Theme): Component {\n let text = renderToolHeading(label, primary, theme);\n if (details.length > 0) text += ` ${theme.fg('muted', `· ${details.join(' · ')}`)}`;\n return new DoomToolCall(text);\n}\n\nfunction optionalCount(value: number | undefined, unit: string): string | undefined {\n return value === undefined ? undefined : `${value} ${unit}`;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nexport function renderReadCall(args: ReadToolInput, theme: Theme): Component {\n return renderCall(\n 'read',\n args.path,\n compactDetails([args.offset === undefined ? undefined : `from ${args.offset}`, optionalCount(args.limit, 'lines')]),\n theme,\n );\n}\n\nexport function renderEditCall(args: EditToolInput, theme: Theme): Component {\n const count = args.edits.length;\n return renderCall('edit', args.path, [`${count} edit${count === 1 ? '' : 's'}`], theme);\n}\n\n/**\n * Read appends a bracketed pagination note after a blank line. Detach it so the\n * gutter numbers file content only, and mutate the caller's line list to match.\n */\nfunction takeTrailingNote(lines: string[]): string | undefined {\n const last = lines.at(-1);\n if (last === undefined || !last.startsWith('[') || !last.endsWith(']')) return undefined;\n\n lines.pop();\n while (lines.at(-1) === '') lines.pop();\n return last;\n}\n\nfunction textContent(result: TextToolResult): string {\n return (result.content ?? [])\n .filter((block) => block.type === 'text')\n .map((block) => block.text ?? '')\n .join('\\n')\n .replaceAll('\\t', ' ')\n .replaceAll('\\r\\n', '\\n');\n}\n\nexport function renderEditResult(\n args: EditToolInput,\n result: EditToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n if (options.isError) return new BuiltinToolContent(theme.fg('error', textContent(result)));\n\n const diff = result.details?.diff;\n // A successful edit whose details never arrived has nothing worth a frame.\n if (diff === undefined || diff.length === 0) return new BuiltinToolContent('');\n return renderDoomDiff(diff, theme, resolveLanguage(args.path), highlight);\n}\n\nexport function renderWriteCall(\n args: WriteToolInput,\n theme: Theme,\n options: WritePreviewOptions = {},\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const heading = renderToolHeading('write', args.path, theme);\n const details = theme.fg('muted', `· ${args.content.length.toLocaleString('en-US')} chars`);\n if (args.content.length === 0) return new DoomToolCall(`${heading} ${details}`);\n\n const normalizedLines = args.content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n const showLiveTail = options.argsStreaming === true && options.expanded !== true;\n const visibleLines = options.expanded\n ? normalizedLines\n : showLiveTail\n ? normalizedLines.slice(-COLLAPSED_FILE_LINES)\n : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n const hiddenLineCount = normalizedLines.length - visibleLines.length;\n // A live tail shows the file's end, so numbering starts where the tail does.\n const firstVisibleLineNumber = showLiveTail ? hiddenLineCount + 1 : 1;\n const numberWidth = gutterWidth(firstVisibleLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstVisibleLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const previewLines = showLiveTail\n ? [\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} earlier lines · live tail`)] : []),\n ...preview,\n ]\n : [\n ...preview,\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} more lines · ctrl+o expand`)] : []),\n ];\n return new DoomToolCall([`${heading} ${details}`, '', ...previewLines].join('\\n'));\n}\n\nexport function renderReadResult(\n args: ReadToolInput,\n result: TextToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const normalizedLines = textContent(result).split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n if (options.isError) {\n return new BuiltinToolContent(normalizedLines.map((line) => theme.fg('error', line)).join('\\n'));\n }\n\n const note = takeTrailingNote(normalizedLines);\n const visibleLines = options.expanded ? normalizedLines : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n // Read starts at `offset`, so the gutter has to agree with the file, not the excerpt.\n const firstLineNumber = args.offset ?? 1;\n const numberWidth = gutterWidth(firstLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const remaining = normalizedLines.length - visibleLines.length;\n if (remaining > 0) preview.push(theme.fg('muted', `… ${remaining} more lines · ctrl+o expand`));\n if (note !== undefined) preview.push(theme.fg('muted', note));\n return new BuiltinToolContent(preview.join('\\n'));\n}\n\nexport function renderGrepCall(args: GrepToolInput, theme: Theme): Component {\n return renderCall(\n 'grep',\n args.pattern,\n compactDetails([\n args.path ?? '.',\n args.glob,\n args.ignoreCase === true ? 'ignore case' : undefined,\n optionalCount(args.limit, 'matches'),\n ]),\n theme,\n );\n}\n\nexport function renderFindCall(args: FindToolInput, theme: Theme): Component {\n return renderCall(\n 'find',\n args.pattern,\n compactDetails([args.path ?? '.', optionalCount(args.limit, 'results')]),\n theme,\n );\n}\n\nexport function renderLsCall(args: LsToolInput, theme: Theme): Component {\n return renderCall('ls', args.path ?? '.', compactDetails([optionalCount(args.limit, 'entries')]), theme);\n}\n","import { definePiTool, type PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\nimport {\n createEditToolDefinition,\n createFindToolDefinition,\n createGrepToolDefinition,\n createLsToolDefinition,\n createReadToolDefinition,\n createWriteToolDefinition,\n} from '@earendil-works/pi-coding-agent';\n\nimport {\n frameBuiltinResult,\n previousBuiltinResult,\n renderEditCall,\n renderEditResult,\n renderFindCall,\n renderGrepCall,\n renderLsCall,\n renderReadCall,\n renderReadResult,\n renderWriteCall,\n} from './builtinToolRender';\n\n/**\n * Keep Pi's native schemas, prompt metadata, execution, and result formatting;\n * replace only the broad status-background shell and call heading.\n */\nexport function createBuiltinTools(cwd: string): PiToolDeclaration[] {\n const tools: PiToolDeclaration[] = [];\n const read = createReadToolDefinition(cwd);\n tools.push(\n definePiTool({\n ...read,\n renderShell: 'self',\n renderCall: (args, theme) => renderReadCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = renderReadResult(\n context.args,\n result,\n { expanded: options.expanded, isError: context.isError },\n theme,\n );\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const edit = createEditToolDefinition(cwd);\n tools.push(\n definePiTool({\n ...edit,\n renderShell: 'self',\n renderCall: (args, theme) => renderEditCall(args, theme),\n // Doom bands the diff on the background and keeps syntax highlighting on\n // the foreground, which Pi's foreground-only diff renderer cannot express.\n renderResult: (result, options, theme, context) => {\n const content = renderEditResult(\n context.args,\n result,\n { expanded: options.expanded, isError: context.isError },\n theme,\n );\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const write = createWriteToolDefinition(cwd);\n const writeResult = write.renderResult!;\n tools.push(\n definePiTool({\n ...write,\n renderShell: 'self',\n renderCall: (args, theme, context) =>\n renderWriteCall(args, theme, {\n expanded: context.expanded,\n // Restored completed rows may not mark args complete, but their result is no longer partial.\n argsStreaming: context.argsComplete === false && context.isPartial,\n }),\n renderResult: (result, options, theme, context) => {\n const content = writeResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const grep = createGrepToolDefinition(cwd);\n const grepResult = grep.renderResult!;\n tools.push(\n definePiTool({\n ...grep,\n renderShell: 'self',\n renderCall: (args, theme) => renderGrepCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = grepResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const find = createFindToolDefinition(cwd);\n const findResult = find.renderResult!;\n tools.push(\n definePiTool({\n ...find,\n renderShell: 'self',\n renderCall: (args, theme) => renderFindCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = findResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const ls = createLsToolDefinition(cwd);\n const lsResult = ls.renderResult!;\n tools.push(\n definePiTool({\n ...ls,\n renderShell: 'self',\n renderCall: (args, theme) => renderLsCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = lsResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n return tools;\n}\n","/** How often the sampler asks to be woken. Short enough to catch a stall inside a single tool call. */\nconst SAMPLE_INTERVAL_MS = 250;\n/**\n * Below this, a late timer is ordinary scheduling jitter rather than something a\n * user would feel. Reporting every sample would cost more than it measures.\n */\nconst REPORT_THRESHOLD_MS = 250;\n\nexport interface EventLoopLagSampler {\n stop(): void;\n}\n\n/**\n * Reports how far behind schedule the event loop is running.\n *\n * A timer that wakes late is the only signal from inside the process that\n * something synchronous, garbage collection included, held the loop. Nothing in\n * a session transcript records it, so a stall here is otherwise invisible and\n * reads as a slow model or a slow tool.\n */\nexport function startEventLoopLagSampler(report: (lagMs: number) => void): EventLoopLagSampler {\n let expected = Date.now() + SAMPLE_INTERVAL_MS;\n const timer = setInterval(() => {\n const now = Date.now();\n const lagMs = now - expected;\n // Rebased on the wake that just happened rather than advanced by a fixed\n // step, so one long stall does not report itself again on every later tick.\n expected = now + SAMPLE_INTERVAL_MS;\n if (lagMs >= REPORT_THRESHOLD_MS) report(lagMs);\n }, SAMPLE_INTERVAL_MS);\n // A diagnostic must never be the reason a process refuses to exit.\n timer.unref();\n return {\n stop: () => {\n clearInterval(timer);\n },\n };\n}\n","import type {\n ConfigSection,\n DoomConfigActionInput,\n DoomConfigContributionHandle,\n DoomConfigContributionOptions,\n DoomConfigInvocation,\n DoomConfigSectionView,\n DoomExtensionContext,\n} from '@agimon-ai/doompi-core/config';\nimport type {\n DoomFooterContributionDefinition,\n DoomFooterContributionHandle,\n DoomFooterContributionValue,\n DoomFooterStatus,\n} from '@agimon-ai/doompi-core/footer';\nimport type { DoomLeaderActionHandlerOptions, LeaderBinding } from '@agimon-ai/doompi-core/leader';\nimport type { DoomUiHubService } from '@agimon-ai/doompi-core/uiHub';\n\nimport type { DoomLeaderDiagnostic, DoomLeaderRegistry } from '../leaderRegistry';\n\ntype Listener = () => void;\n\nfunction notify(listeners: ReadonlySet<Listener>): void {\n for (const listener of listeners) listener();\n}\n\nfunction copyBindings(bindings: readonly LeaderBinding[]): LeaderBinding[] {\n return bindings.map((binding) => ({\n ...binding,\n path: binding.path.map((segment) => ({ ...segment })) as [\n LeaderBinding['path'][number],\n ...LeaderBinding['path'][number][],\n ],\n ...('command' in binding ? { command: { ...binding.command } } : { action: { ...binding.action } }),\n }));\n}\n\nfunction copySections(sections: readonly ConfigSection[]): ConfigSection[] {\n return sections.map((section) => ({\n ...section,\n fields: section.fields.map((field) => ({\n ...field,\n ...(field.choices ? { choices: field.choices.map((choice) => ({ ...choice })) } : {}),\n ...(field.actions ? { actions: field.actions.map((action) => ({ ...action })) } : {}),\n ...(field.steps ? { steps: field.steps.map((step) => ({ ...step })) } : {}),\n ...(field.output ? { output: [...field.output] } : {}),\n })),\n }));\n}\n\ninterface ActiveFooterContribution {\n readonly token: symbol;\n readonly definition: DoomFooterContributionDefinition;\n value?: DoomFooterContributionValue;\n}\n\nexport class DoomUiFooterStore {\n private readonly contributions = new Map<string, ActiveFooterContribution>();\n private readonly listeners = new Set<Listener>();\n\n register(definition: DoomFooterContributionDefinition): DoomFooterContributionHandle {\n const token = Symbol(definition.source);\n const contribution: ActiveFooterContribution = { token, definition: { ...definition } };\n this.contributions.set(definition.source, contribution);\n notify(this.listeners);\n let disposed = false;\n return {\n update: (value) => {\n if (disposed || this.contributions.get(definition.source)?.token !== token) return;\n contribution.value = value\n ? {\n ...value,\n ...(value.fullSegments ? { fullSegments: value.fullSegments.map((segment) => ({ ...segment })) } : {}),\n ...(value.compactSegments\n ? { compactSegments: value.compactSegments.map((segment) => ({ ...segment })) }\n : {}),\n }\n : undefined;\n notify(this.listeners);\n },\n dispose: () => {\n if (disposed) return;\n disposed = true;\n if (this.contributions.get(definition.source)?.token !== token) return;\n this.contributions.delete(definition.source);\n notify(this.listeners);\n },\n };\n }\n\n getStatuses(): DoomFooterStatus[] {\n return [...this.contributions.values()]\n .flatMap(({ definition, value }) =>\n value\n ? [\n {\n source: definition.source,\n id: definition.id,\n order: definition.order,\n ...(definition.placement ? { placement: definition.placement } : {}),\n ...value,\n },\n ]\n : [],\n )\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.contributions.clear();\n notify(this.listeners);\n this.listeners.clear();\n }\n}\n\ninterface ActiveConfigContribution {\n readonly token: symbol;\n readonly options: DoomConfigContributionOptions<DoomExtensionContext>;\n}\n\nexport class DoomUiConfigStore {\n private readonly contributions = new Map<string, ActiveConfigContribution>();\n private readonly listeners = new Set<Listener>();\n\n constructor(private readonly getContext: () => DoomExtensionContext | undefined) {}\n\n register<ExtensionContext extends DoomExtensionContext>(\n options: DoomConfigContributionOptions<ExtensionContext>,\n ): DoomConfigContributionHandle {\n const token = Symbol(options.source);\n const contribution = {\n token,\n options: options as unknown as DoomConfigContributionOptions<DoomExtensionContext>,\n };\n this.contributions.set(options.source, contribution);\n notify(this.listeners);\n let disposed = false;\n return {\n update: () => {\n if (!disposed && this.contributions.get(options.source)?.token === token) notify(this.listeners);\n },\n dispose: () => {\n if (disposed) return;\n disposed = true;\n if (this.contributions.get(options.source)?.token !== token) return;\n this.contributions.delete(options.source);\n notify(this.listeners);\n },\n };\n }\n\n getSections(): DoomConfigSectionView[] {\n return [...this.contributions.values()]\n .flatMap(({ options }) => {\n try {\n return copySections(options.listSections()).map((section) => ({ source: options.source, ...section }));\n } catch (error) {\n const context = this.getContext();\n if (context) options.onError(error, 'listSections', context);\n return [];\n }\n })\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n invoke(invocation: DoomConfigInvocation): void {\n const active = this.contributions.get(invocation.source);\n const context = this.getContext();\n if (!active || !context) return;\n const handler = active.options.handlers[invocation.action];\n if (!handler) return;\n const input: DoomConfigActionInput = {\n ctx: context,\n sectionId: invocation.sectionId,\n fieldId: invocation.fieldId,\n ...(invocation.value === undefined ? {} : { value: invocation.value }),\n };\n void Promise.resolve(handler(input))\n .catch((error: unknown) => active.options.onError(error, invocation.action, context))\n .finally(() => {\n if (this.contributions.get(invocation.source)?.token === active.token) notify(this.listeners);\n });\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.contributions.clear();\n notify(this.listeners);\n this.listeners.clear();\n }\n}\n\nexport interface DoomUiHubController extends DoomUiHubService {\n readonly config: DoomUiConfigStore;\n readonly footer: DoomUiFooterStore;\n setContext(context: DoomExtensionContext | undefined): void;\n invokeLeaderAction(source: string, action: string): void;\n dispose(): void;\n}\n\nexport interface CreateDoomUiHubOptions {\n readonly leaderRegistry: DoomLeaderRegistry;\n readonly reportDiagnostics: (diagnostics: readonly DoomLeaderDiagnostic[]) => void;\n}\n\nexport function createDoomUiHub({ leaderRegistry, reportDiagnostics }: CreateDoomUiHubOptions): DoomUiHubController {\n let activeContext: DoomExtensionContext | undefined;\n const leaderGenerations = new Map<string, symbol>();\n const actionHandlers = new Map<\n string,\n { token: symbol; options: DoomLeaderActionHandlerOptions<DoomExtensionContext> }\n >();\n const footer = new DoomUiFooterStore();\n const config = new DoomUiConfigStore(() => activeContext);\n\n return {\n footer,\n config,\n registerLeader(contribution) {\n const token = Symbol(contribution.source);\n const publish = (bindings: readonly LeaderBinding[]): void => {\n const result = leaderRegistry.register({ source: contribution.source, bindings: copyBindings(bindings) });\n reportDiagnostics(result.diagnostics);\n };\n publish(contribution.bindings);\n leaderGenerations.set(contribution.source, token);\n let disposed = false;\n return {\n update(bindings) {\n if (disposed || leaderGenerations.get(contribution.source) !== token) return;\n publish(bindings);\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n if (leaderGenerations.get(contribution.source) !== token) return;\n leaderGenerations.delete(contribution.source);\n publish([]);\n },\n };\n },\n registerLeaderActions(options) {\n const token = Symbol(options.source);\n actionHandlers.set(options.source, {\n token,\n options: options as unknown as DoomLeaderActionHandlerOptions<DoomExtensionContext>,\n });\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n if (actionHandlers.get(options.source)?.token === token) actionHandlers.delete(options.source);\n };\n },\n registerFooter: (definition) => footer.register(definition),\n registerConfig: (options) => config.register(options),\n setContext(context) {\n activeContext = context;\n },\n invokeLeaderAction(source, action) {\n const context = activeContext;\n const active = actionHandlers.get(source);\n if (!context || !active) return;\n const handler = active.options.handlers[action];\n if (!handler) return;\n void Promise.resolve(handler(context)).catch((error: unknown) => active.options.onError(error, action, context));\n },\n dispose() {\n activeContext = undefined;\n actionHandlers.clear();\n leaderGenerations.clear();\n footer.dispose();\n config.dispose();\n },\n };\n}\n","import path from 'node:path';\n\nimport { readDoomMcpStatus } from '@agimon-ai/doompi-core/mcpStatus';\nimport { type DoomNotificationLevel, readDoomNotificationService } from '@agimon-ai/doompi-core/notification';\nimport type { PiEventHandlers } from '@agimon-ai/doompi-core/piExtension';\nimport { buildToolSources, type McpServerStatus } from '@agimon-ai/doompi-core/toolInventory';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext, ReadonlyFooterDataProvider } from '@earendil-works/pi-coding-agent';\n\nimport {\n LEADER_WIDGET_KEY,\n TUI_MODE,\n WIDGET_PLACEMENT,\n WARNING_STYLE,\n THEME_ENVIRONMENT_KEY,\n TOOLS_COMMAND,\n CONFIG_COMMAND,\n SESSION_START_EVENT,\n SESSION_MESSAGE_ENTRY,\n INPUT_EVENT,\n INTERACTIVE_INPUT_SOURCE,\n TITLE_MESSAGE_MAX_LENGTH,\n TITLE_PREFIX,\n BUILTIN_LEADER_COMMANDS,\n} from '../constants/ui';\nimport { DoomUiState, type LeaderSnapshot } from '../models/uiState';\nimport { type EventLoopLagSampler, startEventLoopLagSampler } from '../services/eventLoopLag';\nimport { extensionName, extensionPackageName, extensionToolSource } from '../services/extensionSource';\nimport { type DoomLeaderDiagnostic, DoomLeaderRegistry } from '../services/leaderRegistry';\nimport { UI_EVENT, type UiTelemetry } from '../services/telemetry';\nimport { createDoomUiHub } from '../services/uiHub';\nimport { openConfigOverlay } from './configOverlay';\nimport { DoomEditor } from './doomEditor';\nimport { DoomFooter } from './doomFooter';\nimport { DoomHeader } from './doomHeader';\nimport { LeaderHints } from './leaderHints';\nimport { DEFAULT_THEME_NAME } from './theme';\nimport { openToolsOverlay } from './toolsOverlay';\n\nfunction notify(cordis: Context, context: ExtensionContext, body: string, level: DoomNotificationLevel): void {\n const service = readDoomNotificationService(cordis);\n if (service) {\n try {\n void Promise.resolve(service.request({ body, level })).catch(() => undefined);\n } catch {\n // Notification delivery is best effort and does not fall back after routing.\n }\n return;\n }\n context.ui.notify(body, level);\n}\n\nfunction createMessageTitle(message: string, cwd: string): string | undefined {\n const normalizedMessage = message.trim().replace(/\\s+/g, ' ');\n if (!normalizedMessage) return undefined;\n const messageTitle = normalizedMessage.slice(0, TITLE_MESSAGE_MAX_LENGTH).trimEnd();\n return `${TITLE_PREFIX} · ${messageTitle} · ${path.basename(cwd) || cwd}`;\n}\n\ninterface UiPluginOptions {\n readonly pi: ExtensionAPI;\n readonly telemetry: UiTelemetry;\n}\n\nexport interface UiRuntime {\n readonly hub: ReturnType<typeof createDoomUiHub>;\n readonly uiState: DoomUiState;\n readonly commands: readonly (readonly [...Parameters<ExtensionAPI['registerCommand']>])[];\n readonly events: PiEventHandlers;\n dispose(): Promise<void>;\n}\n\nexport function createUiRuntime(cordis: Context, { pi, telemetry }: UiPluginOptions): UiRuntime {\n let disposed = false;\n const uiState = new DoomUiState();\n const leaderRegistry = new DoomLeaderRegistry();\n const pendingDiagnostics = new Set<string>();\n let footerData: ReadonlyFooterDataProvider | undefined;\n let activeContext: ExtensionContext | undefined;\n let sessionGeneration = 0;\n let hasSessionMessage = false;\n let lagSampler: EventLoopLagSampler | undefined;\n\n /**\n * Asks the MCP extension what it is currently connected to.\n *\n * No answer is a normal session: `--no-mcp` leaves nobody providing the query,\n * and the panel simply lists MCP tools under the extension that registered them.\n */\n const readMcpServers = (): readonly McpServerStatus[] | undefined => readDoomMcpStatus(cordis)?.getSnapshot().servers;\n\n const reportDiagnostics = (diagnostics: readonly DoomLeaderDiagnostic[]): void => {\n for (const diagnostic of diagnostics) {\n const binding = diagnostic.bindingId ? ` (${diagnostic.bindingId})` : '';\n const message = `Leader contribution from ${diagnostic.source}${binding}: ${diagnostic.message}`;\n if (pendingDiagnostics.has(message)) continue;\n pendingDiagnostics.add(message);\n // A rejected contribution silently drops another extension's keybindings,\n // and the notice below only reaches a run that has a TUI attached.\n void telemetry.recordWarning(UI_EVENT.leaderContributionRejected, diagnostic.message, {\n 'leader.source': diagnostic.source,\n ...(diagnostic.bindingId ? { 'leader.binding.id': diagnostic.bindingId } : {}),\n });\n if (activeContext?.mode === TUI_MODE) notify(cordis, activeContext, message, WARNING_STYLE);\n }\n };\n\n const hub = createDoomUiHub({ leaderRegistry, reportDiagnostics });\n return {\n hub,\n uiState,\n async dispose() {\n if (disposed) return;\n disposed = true;\n const context = activeContext;\n ++sessionGeneration;\n activeContext = undefined;\n hub.setContext(undefined);\n footerData = undefined;\n lagSampler?.stop();\n lagSampler = undefined;\n hub.dispose();\n uiState.reset();\n if (context?.mode === TUI_MODE) {\n context.ui.setWidget(LEADER_WIDGET_KEY, undefined, { placement: WIDGET_PLACEMENT });\n }\n await telemetry.shutdown();\n },\n commands: [\n [\n TOOLS_COMMAND,\n {\n description: 'Browse the tools available in this session',\n handler: async (_args, ctx) => {\n // Read at open time so a reconnected server or a plan-mode tool swap shows\n // up without restarting the session.\n const mcpServers = readMcpServers();\n const sources = buildToolSources({\n tools: pi.getAllTools(),\n activeTools: pi.getActiveTools(),\n ...(mcpServers ? { mcpServers } : {}),\n resolveExtensionName: extensionName,\n resolveExtensionPackageName: extensionPackageName,\n resolveExtensionToolSource: (toolName) => extensionToolSource(pi, toolName),\n });\n await openToolsOverlay(ctx, sources);\n },\n },\n ],\n\n [\n CONFIG_COMMAND,\n {\n description: 'Browse and change the settings extensions contribute',\n handler: async (_args, ctx) => {\n // The registry is passed live rather than snapshotted: a contributor can be\n // fetching or installing something while the panel is open, and that\n // progress is meant to land in it.\n await openConfigOverlay(ctx, hub.config);\n },\n },\n ],\n ],\n events: {\n [SESSION_START_EVENT]: (_event, ctx) => {\n activeContext = ctx;\n hub.setContext(ctx);\n const activeGeneration = ++sessionGeneration;\n reportDiagnostics(leaderRegistry.flush());\n hasSessionMessage = ctx.sessionManager.getEntries().some((entry) => entry.type === SESSION_MESSAGE_ENTRY);\n if (ctx.mode !== TUI_MODE) return;\n for (const message of pendingDiagnostics) notify(cordis, ctx, message, WARNING_STYLE);\n\n // A resumed or forked session runs this again, and two samplers would\n // double every report.\n lagSampler?.stop();\n lagSampler = startEventLoopLagSampler((lagMs) => {\n void telemetry.recordWarning(UI_EVENT.eventLoopStalled, `Event loop stalled for ${String(lagMs)}ms.`, {\n lag_ms: lagMs,\n });\n });\n\n const themeName = process.env[THEME_ENVIRONMENT_KEY] || DEFAULT_THEME_NAME;\n const themeResult = ctx.ui.setTheme(themeName);\n if (!themeResult.success) {\n notify(cordis, ctx, `Could not apply Doom Pi theme: ${themeResult.error}`, WARNING_STYLE);\n void telemetry.recordWarning(UI_EVENT.themeApplyFailed, themeResult.error ?? 'Unknown theme error', {\n 'ui.theme': themeName,\n });\n }\n\n ctx.ui.setTitle(`${TITLE_PREFIX} · ${path.basename(ctx.cwd) || ctx.cwd} · pi/coding`);\n ctx.ui.setHeader((tui, theme) => new DoomHeader(theme, ctx.cwd, undefined, ctx, () => tui.terminal.rows));\n ctx.ui.setFooter((tui, theme, data) => {\n footerData = data;\n return new DoomFooter(tui, theme, ctx, data, hub.footer, uiState);\n });\n ctx.ui.setEditorComponent(\n (tui, editorTheme, keybindings) =>\n new DoomEditor(\n tui,\n editorTheme,\n keybindings,\n uiState,\n (snapshot: LeaderSnapshot) => {\n if (!snapshot.active) {\n ctx.ui.setWidget(LEADER_WIDGET_KEY, undefined, { placement: WIDGET_PLACEMENT });\n return;\n }\n ctx.ui.setWidget(\n LEADER_WIDGET_KEY,\n (_widgetTui, widgetTheme) =>\n new LeaderHints(widgetTheme, snapshot, ctx, footerData, uiState.getModes()),\n { placement: WIDGET_PLACEMENT },\n );\n },\n undefined,\n ctx.ui.theme,\n {\n registry: leaderRegistry,\n isCommandAvailable: (commandName) =>\n BUILTIN_LEADER_COMMANDS.includes(commandName) ||\n pi.getCommands().some((command) => command.name === commandName),\n onLeaderAction: (source, action) => {\n if (activeContext !== ctx || sessionGeneration !== activeGeneration) {\n notify(cordis, ctx, `Leader action ${action} is unavailable.`, WARNING_STYLE);\n return;\n }\n hub.invokeLeaderAction(source, action);\n },\n onUnavailableCommand: (commandName) => {\n void telemetry.recordWarning(\n UI_EVENT.leaderCommandUnavailable,\n `Leader command /${commandName} is unavailable.`,\n { 'ui.kind': 'command' },\n );\n notify(cordis, ctx, `Leader command /${commandName} is unavailable.`, WARNING_STYLE);\n },\n onUnavailableAction: (action) => {\n void telemetry.recordWarning(\n UI_EVENT.leaderActionUnavailable,\n `Leader action ${action} is unavailable.`,\n {\n 'ui.kind': 'action',\n },\n );\n notify(cordis, ctx, `Leader action ${action} is unavailable.`, WARNING_STYLE);\n },\n },\n ),\n );\n\n void telemetry.recordEvent(UI_EVENT.shellInstalled, {\n 'ui.theme': themeName,\n 'ui.theme.applied': themeResult.success,\n 'ui.leader.group.count': leaderRegistry.getGroup([])?.options.length ?? 0,\n });\n },\n\n [INPUT_EVENT]: (event, ctx) => {\n if (ctx.mode !== TUI_MODE || event.source !== INTERACTIVE_INPUT_SOURCE || hasSessionMessage) return;\n hasSessionMessage = true;\n const title = createMessageTitle(event.text, ctx.cwd);\n if (title) ctx.ui.setTitle(title);\n },\n },\n };\n}\n","import { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\nimport { DOOM_UI_HUB_SERVICE } from '@agimon-ai/doompi-core/uiHub';\nimport {\n DOOM_MINOR_MODE_CATALOG_SERVICE,\n createMinorModeCatalogClient,\n requireMinorModeCatalog,\n} from '@agimon-ai/doompi-minor-mode';\n\nimport { projectMinorModeRecords } from '../../../../models/uiState';\nimport { createUiTelemetry, type UiTelemetry } from '../../../../services/telemetry';\nimport { createBuiltinTools } from '../../../../tui/builtinTools';\nimport { createUiRuntime } from '../../../../tui/uiRuntime';\nimport type { UiPiScope } from './_lib/piScope';\n\nexport default defineRoot(({ context, pi, options, runtime }: PiPluginContext<UiTelemetry>) => {\n if (!runtime) throw new Error('This Pi extension requires the Cordis runtime metadata.');\n const ui = createUiRuntime(context, { pi, telemetry: options ?? createUiTelemetry() });\n const tools = createBuiltinTools(process.cwd());\n const service = (owner: PiPluginContext['context']) => {\n owner.provide(DOOM_UI_HUB_SERVICE, ui.hub);\n owner.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const catalog = createMinorModeCatalogClient(requireMinorModeCatalog(modeContext));\n const update = (): void => ui.uiState.setModes(projectMinorModeRecords(catalog.list()));\n const unsubscribe = catalog.subscribe(update);\n update();\n return () => {\n unsubscribe();\n ui.uiState.setModes([]);\n };\n });\n };\n return {\n value: { ui, tools, runtime } satisfies UiPiScope,\n services: [service],\n onStop: () => ui.dispose(),\n onDispose: () => ui.dispose(),\n };\n});\n","import { defineCliCommand } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliCommand(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.commands[1],\n);\n","import { defineCliCommand } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliCommand(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.commands[0],\n);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliHook((context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.events.input!);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliHook(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.events.session_start!,\n);\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'edit');\n if (!tool) throw new Error('Missing built-in edit tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'find');\n if (!tool) throw new Error('Missing built-in find tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'grep');\n if (!tool) throw new Error('Missing built-in grep tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'ls');\n if (!tool) throw new Error('Missing built-in ls tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'read');\n if (!tool) throw new Error('Missing built-in read tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'write');\n if (!tool) throw new Error('Missing built-in write tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, piToolContributions, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport commandConfig from '../src/extensions/workspaces/sessions/(backend)/command/config.cli';\nimport commandTools from '../src/extensions/workspaces/sessions/(backend)/command/tools.cli';\nimport hookInput from '../src/extensions/workspaces/sessions/(backend)/hook/input.cli';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli';\nimport toolEdit from '../src/extensions/workspaces/sessions/(backend)/tool/edit.cli';\nimport toolFind from '../src/extensions/workspaces/sessions/(backend)/tool/find.cli';\nimport toolGrep from '../src/extensions/workspaces/sessions/(backend)/tool/grep.cli';\nimport toolLs from '../src/extensions/workspaces/sessions/(backend)/tool/ls.cli';\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.cli';\nimport toolWrite from '../src/extensions/workspaces/sessions/(backend)/tool/write.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof commandConfig> | OptionsOf<typeof commandTools> | OptionsOf<typeof hookInput> | OptionsOf<typeof hookSessionStart> | OptionsOf<typeof toolEdit> | OptionsOf<typeof toolFind> | OptionsOf<typeof toolGrep> | OptionsOf<typeof toolLs> | OptionsOf<typeof toolRead> | OptionsOf<typeof toolWrite>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-ui', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get commands(): PiPluginContributions['commands'] { return [at(commandConfig, contextSession), at(commandTools, contextSession)]; },\n events: {\n input: at(hookInput, contextSession) as NonNullable<PiPluginContributions['events']>['input'],\n session_start: at(hookSessionStart, contextSession) as NonNullable<PiPluginContributions['events']>['session_start'],\n },\n ...piToolContributions('@agimon-ai/doompi-ui', [via({ name: 'edit' }, at(toolEdit, contextSession)), via({ name: 'find' }, at(toolFind, contextSession)), via({ name: 'grep' }, at(toolGrep, contextSession)), via({ name: 'ls' }, at(toolLs, contextSession)), via({ name: 'read' }, at(toolRead, contextSession)), via({ name: 'write' }, at(toolWrite, contextSession))]),\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,uBAAuB;;AAuB7B,IAAM,qBAAN,MAA8C;CACf;CAA7B,YAAY,MAA+B;EAAd,KAAA,OAAA;CAAe;CAE5C,OAAO,OAAyB;EAC9B,IAAI,SAAS,KAAK,KAAK,KAAK,WAAW,GAAG,OAAO,CAAC;EAClD,QAAA,GAAOA,uBAAAA,iBAAAA,CAAiB,KAAK,MAAM,KAAK;CAC1C;CAEA,aAAmB,CAEnB;AACF;;AAGA,SAAgB,sBAAsB,WAAyD;CAC7F,OAAOC,mBAAAA,uBAAuB,SAAS;AACzC;;AAGA,SAAgB,mBAAmB,SAAoB,OAAc,UAA4C;CAC/G,OAAOC,mBAAAA,oBAAoB,SAAS,OAAO,QAAQ;AACrD;AAEA,SAAS,WAAW,OAAe,SAAiB,SAA4B,OAAyB;CACvG,IAAI,OAAOC,mBAAAA,kBAAkB,OAAO,SAAS,KAAK;CAClD,IAAI,QAAQ,SAAS,GAAG,QAAQ,IAAI,MAAM,GAAG,SAAS,KAAK,QAAQ,KAAK,KAAK,GAAG;CAChF,OA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B;EAAE,GAAG;EAAS,MAAM,aAAa;CAAM;CAC9D,OAAO;EACL,IAAA,GAAGC,qCAAAA,iBAAAA,CAAiB,YAAY;EAChC,IAAI,WAA8C;GAAE,OAAO,CAAC,GAAGC,oBAAe,cAAc,GAAG,GAAGC,mBAAc,cAAc,CAAC;EAAG;EAClI,QAAQ;GACN,OAAO,GAAGC,mBAAW,cAAc;GACnC,eAAe,GAAGC,0BAAkB,cAAc;EACpD;EACA,IAAA,GAAGC,mCAAAA,oBAAAA,CAAoB,wBAAwB;GAAC,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,KAAK,GAAG,GAAGC,gBAAQ,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,mBAAW,cAAc,CAAC;EAAC,CAAC;EAC3W,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}
1
+ {"version":3,"file":"pi.cjs","names":["wrapTextWithAnsi","previousDoomToolResult","frameDoomToolResult","renderToolHeading","DoomToolCall","highlightCode","getLanguageFromPath","renderDoomDiff","gutterWidth","renderLineNumber","createReadToolDefinition","definePiTool","createEditToolDefinition","createWriteToolDefinition","createGrepToolDefinition","createFindToolDefinition","createLsToolDefinition","notify","readDoomNotificationService","TITLE_PREFIX","path","DoomUiState","DoomLeaderRegistry","readDoomMcpStatus","UI_EVENT","WARNING_STYLE","LEADER_WIDGET_KEY","WIDGET_PLACEMENT","TOOLS_COMMAND","buildToolSources","extensionName","extensionPackageName","extensionToolSource","openToolsOverlay","CONFIG_COMMAND","openConfigOverlay","SESSION_START_EVENT","SESSION_MESSAGE_ENTRY","DoomHeader","DoomFooter","DoomEditor","LeaderHints","BUILTIN_LEADER_COMMANDS","INPUT_EVENT","defineRoot","createUiTelemetry","DOOM_UI_HUB_SERVICE","DOOM_MINOR_MODE_CATALOG_SERVICE","createMinorModeCatalogClient","requireMinorModeCatalog","projectMinorModeRecords","defineCliCommand","defineCliCommand","defineCliHook","defineCliHook","defineCliTool","defineCliTool","defineCliTool","defineCliTool","defineCliTool","defineCliTool","definePiExtension","rootSession","composeRootHooks","commandConfig","commandTools","hookInput","hookSessionStart","piToolContributions","toolEdit","toolFind","toolGrep","toolLs","toolRead","toolWrite"],"sources":["../../src/tui/builtinToolRender.ts","../../src/tui/builtinTools.ts","../../src/services/eventLoopLag/index.ts","../../src/services/uiHub/index.ts","../../src/tui/uiRuntime.ts","../../src/extensions/workspaces/sessions/(backend)/root.cli.ts","../../src/extensions/workspaces/sessions/(backend)/command/config.cli.ts","../../src/extensions/workspaces/sessions/(backend)/command/tools.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/input.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/edit.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/find.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/grep.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/ls.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/read.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/write.cli.ts","../../generated/pi.ts"],"sourcesContent":["import {\n type EditToolDetails,\n type EditToolInput,\n type FindToolInput,\n type GrepToolInput,\n getLanguageFromPath,\n highlightCode,\n type LsToolInput,\n type ReadToolInput,\n type Theme,\n type WriteToolInput,\n} from '@earendil-works/pi-coding-agent';\nimport { type Component, wrapTextWithAnsi } from '@earendil-works/pi-tui';\n\nimport { gutterWidth, renderLineNumber } from './codeGutter';\nimport { renderDoomDiff } from './diffRender';\nimport { DoomToolCall, frameDoomToolResult, previousDoomToolResult, renderToolHeading } from './toolChrome';\n\nconst COLLAPSED_FILE_LINES = 10;\n\ntype Highlighter = (code: string, language?: string) => string[];\ntype LanguageResolver = (path: string) => string | undefined;\n\nexport interface ToolPreviewOptions {\n expanded?: boolean;\n isError?: boolean;\n}\n\nexport interface WritePreviewOptions extends ToolPreviewOptions {\n argsStreaming?: boolean;\n}\n\nexport interface TextToolResult {\n content?: ReadonlyArray<{ type: string; text?: string }>;\n}\n\nexport interface EditToolResult extends TextToolResult {\n details?: EditToolDetails;\n}\n\n/** Self-owned result shell shared by Pi's native file and search tools. */\nclass BuiltinToolContent implements Component {\n constructor(private readonly text: string) {}\n\n render(width: number): string[] {\n if (width <= 0 || this.text.length === 0) return [];\n return wrapTextWithAnsi(this.text, width);\n }\n\n invalidate(): void {\n // Content is immutable and reflows from the current width on every render.\n }\n}\n\n/** Recover the native renderer's component from the shell returned on its previous pass. */\nexport function previousBuiltinResult(component: Component | undefined): Component | undefined {\n return previousDoomToolResult(component);\n}\n\n/** Reuse the shell while allowing Pi's native renderer to reuse its own inner component. */\nexport function frameBuiltinResult(content: Component, theme: Theme, previous: Component | undefined): Component {\n return frameDoomToolResult(content, theme, previous);\n}\n\nfunction renderCall(label: string, primary: string, details: readonly string[], theme: Theme): Component {\n let text = renderToolHeading(label, primary, theme);\n if (details.length > 0) text += ` ${theme.fg('muted', `· ${details.join(' · ')}`)}`;\n return new DoomToolCall(text);\n}\n\nfunction optionalCount(value: number | undefined, unit: string): string | undefined {\n return value === undefined ? undefined : `${value} ${unit}`;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nexport function renderReadCall(args: ReadToolInput, theme: Theme): Component {\n return renderCall(\n 'read',\n args.path,\n compactDetails([args.offset === undefined ? undefined : `from ${args.offset}`, optionalCount(args.limit, 'lines')]),\n theme,\n );\n}\n\nexport function renderEditCall(args: EditToolInput, theme: Theme): Component {\n const count = args.edits.length;\n return renderCall('edit', args.path, [`${count} edit${count === 1 ? '' : 's'}`], theme);\n}\n\n/**\n * Read appends a bracketed pagination note after a blank line. Detach it so the\n * gutter numbers file content only, and mutate the caller's line list to match.\n */\nfunction takeTrailingNote(lines: string[]): string | undefined {\n const last = lines.at(-1);\n if (last === undefined || !last.startsWith('[') || !last.endsWith(']')) return undefined;\n\n lines.pop();\n while (lines.at(-1) === '') lines.pop();\n return last;\n}\n\nfunction textContent(result: TextToolResult): string {\n return (result.content ?? [])\n .filter((block) => block.type === 'text')\n .map((block) => block.text ?? '')\n .join('\\n')\n .replaceAll('\\t', ' ')\n .replaceAll('\\r\\n', '\\n');\n}\n\nexport function renderEditResult(\n args: EditToolInput,\n result: EditToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n if (options.isError) return new BuiltinToolContent(theme.fg('error', textContent(result)));\n\n const diff = result.details?.diff;\n // A successful edit whose details never arrived has nothing worth a frame.\n if (diff === undefined || diff.length === 0) return new BuiltinToolContent('');\n return renderDoomDiff(diff, theme, resolveLanguage(args.path), highlight);\n}\n\nexport function renderWriteCall(\n args: WriteToolInput,\n theme: Theme,\n options: WritePreviewOptions = {},\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const heading = renderToolHeading('write', args.path, theme);\n const details = theme.fg('muted', `· ${args.content.length.toLocaleString('en-US')} chars`);\n if (args.content.length === 0) return new DoomToolCall(`${heading} ${details}`);\n\n const normalizedLines = args.content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n const showLiveTail = options.argsStreaming === true && options.expanded !== true;\n const visibleLines = options.expanded\n ? normalizedLines\n : showLiveTail\n ? normalizedLines.slice(-COLLAPSED_FILE_LINES)\n : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n const hiddenLineCount = normalizedLines.length - visibleLines.length;\n // A live tail shows the file's end, so numbering starts where the tail does.\n const firstVisibleLineNumber = showLiveTail ? hiddenLineCount + 1 : 1;\n const numberWidth = gutterWidth(firstVisibleLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstVisibleLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const previewLines = showLiveTail\n ? [\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} earlier lines · live tail`)] : []),\n ...preview,\n ]\n : [\n ...preview,\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} more lines · ctrl+o expand`)] : []),\n ];\n return new DoomToolCall([`${heading} ${details}`, '', ...previewLines].join('\\n'));\n}\n\nexport function renderReadResult(\n args: ReadToolInput,\n result: TextToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const normalizedLines = textContent(result).split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n if (options.isError) {\n return new BuiltinToolContent(normalizedLines.map((line) => theme.fg('error', line)).join('\\n'));\n }\n\n const note = takeTrailingNote(normalizedLines);\n const visibleLines = options.expanded ? normalizedLines : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n // Read starts at `offset`, so the gutter has to agree with the file, not the excerpt.\n const firstLineNumber = args.offset ?? 1;\n const numberWidth = gutterWidth(firstLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const remaining = normalizedLines.length - visibleLines.length;\n if (remaining > 0) preview.push(theme.fg('muted', `… ${remaining} more lines · ctrl+o expand`));\n if (note !== undefined) preview.push(theme.fg('muted', note));\n return new BuiltinToolContent(preview.join('\\n'));\n}\n\nexport function renderGrepCall(args: GrepToolInput, theme: Theme): Component {\n return renderCall(\n 'grep',\n args.pattern,\n compactDetails([\n args.path ?? '.',\n args.glob,\n args.ignoreCase === true ? 'ignore case' : undefined,\n optionalCount(args.limit, 'matches'),\n ]),\n theme,\n );\n}\n\nexport function renderFindCall(args: FindToolInput, theme: Theme): Component {\n return renderCall(\n 'find',\n args.pattern,\n compactDetails([args.path ?? '.', optionalCount(args.limit, 'results')]),\n theme,\n );\n}\n\nexport function renderLsCall(args: LsToolInput, theme: Theme): Component {\n return renderCall('ls', args.path ?? '.', compactDetails([optionalCount(args.limit, 'entries')]), theme);\n}\n","import { definePiTool, type PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\nimport {\n createEditToolDefinition,\n createFindToolDefinition,\n createGrepToolDefinition,\n createLsToolDefinition,\n createReadToolDefinition,\n createWriteToolDefinition,\n} from '@earendil-works/pi-coding-agent';\n\nimport {\n frameBuiltinResult,\n previousBuiltinResult,\n renderEditCall,\n renderEditResult,\n renderFindCall,\n renderGrepCall,\n renderLsCall,\n renderReadCall,\n renderReadResult,\n renderWriteCall,\n} from './builtinToolRender';\n/**\n * Keep Pi's native schemas, prompt metadata, execution, and result formatting;\n * replace only the broad status-background shell and call heading.\n */\nexport function createBuiltinTools(cwd: string): PiToolDeclaration[] {\n const tools: PiToolDeclaration[] = [];\n const read = createReadToolDefinition(cwd);\n tools.push(\n definePiTool({\n ...read,\n execute: (...args: Parameters<typeof read.execute>) => createReadToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderReadCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = renderReadResult(\n context.args,\n result,\n { expanded: options.expanded, isError: context.isError },\n theme,\n );\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const edit = createEditToolDefinition(cwd);\n tools.push(\n definePiTool({\n ...edit,\n execute: (...args: Parameters<typeof edit.execute>) => createEditToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderEditCall(args, theme),\n // Doom bands the diff on the background and keeps syntax highlighting on\n // the foreground, which Pi's foreground-only diff renderer cannot express.\n renderResult: (result, options, theme, context) => {\n const content = renderEditResult(\n context.args,\n result,\n { expanded: options.expanded, isError: context.isError },\n theme,\n );\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const write = createWriteToolDefinition(cwd);\n const writeResult = write.renderResult!;\n tools.push(\n definePiTool({\n ...write,\n execute: (...args: Parameters<typeof write.execute>) => createWriteToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme, context) =>\n renderWriteCall(args, theme, {\n expanded: context.expanded,\n // Restored completed rows may not mark args complete, but their result is no longer partial.\n argsStreaming: context.argsComplete === false && context.isPartial,\n }),\n renderResult: (result, options, theme, context) => {\n const content = writeResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const grep = createGrepToolDefinition(cwd);\n const grepResult = grep.renderResult!;\n tools.push(\n definePiTool({\n ...grep,\n execute: (...args: Parameters<typeof grep.execute>) => createGrepToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderGrepCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = grepResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const find = createFindToolDefinition(cwd);\n const findResult = find.renderResult!;\n tools.push(\n definePiTool({\n ...find,\n execute: (...args: Parameters<typeof find.execute>) => createFindToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderFindCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = findResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const ls = createLsToolDefinition(cwd);\n const lsResult = ls.renderResult!;\n tools.push(\n definePiTool({\n ...ls,\n execute: (...args: Parameters<typeof ls.execute>) => createLsToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderLsCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = lsResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n return tools;\n}\n","/** How often the sampler asks to be woken. Short enough to catch a stall inside a single tool call. */\nconst SAMPLE_INTERVAL_MS = 250;\n/**\n * Below this, a late timer is ordinary scheduling jitter rather than something a\n * user would feel. Reporting every sample would cost more than it measures.\n */\nconst REPORT_THRESHOLD_MS = 250;\n\nexport interface EventLoopLagSampler {\n stop(): void;\n}\n\n/**\n * Reports how far behind schedule the event loop is running.\n *\n * A timer that wakes late is the only signal from inside the process that\n * something synchronous, garbage collection included, held the loop. Nothing in\n * a session transcript records it, so a stall here is otherwise invisible and\n * reads as a slow model or a slow tool.\n */\nexport function startEventLoopLagSampler(report: (lagMs: number) => void): EventLoopLagSampler {\n let expected = Date.now() + SAMPLE_INTERVAL_MS;\n const timer = setInterval(() => {\n const now = Date.now();\n const lagMs = now - expected;\n // Rebased on the wake that just happened rather than advanced by a fixed\n // step, so one long stall does not report itself again on every later tick.\n expected = now + SAMPLE_INTERVAL_MS;\n if (lagMs >= REPORT_THRESHOLD_MS) report(lagMs);\n }, SAMPLE_INTERVAL_MS);\n // A diagnostic must never be the reason a process refuses to exit.\n timer.unref();\n return {\n stop: () => {\n clearInterval(timer);\n },\n };\n}\n","import type {\n ConfigSection,\n DoomConfigActionInput,\n DoomConfigContributionHandle,\n DoomConfigContributionOptions,\n DoomConfigInvocation,\n DoomConfigSectionView,\n DoomExtensionContext,\n} from '@agimon-ai/doompi-core/config';\nimport type {\n DoomFooterContributionDefinition,\n DoomFooterContributionHandle,\n DoomFooterContributionValue,\n DoomFooterStatus,\n} from '@agimon-ai/doompi-core/footer';\nimport type { DoomLeaderActionHandlerOptions, LeaderBinding } from '@agimon-ai/doompi-core/leader';\nimport type { DoomUiHubService } from '@agimon-ai/doompi-core/uiHub';\n\nimport type { DoomLeaderDiagnostic, DoomLeaderRegistry } from '../leaderRegistry';\n\ntype Listener = () => void;\n\nfunction notify(listeners: ReadonlySet<Listener>): void {\n for (const listener of listeners) listener();\n}\n\nfunction copyBindings(bindings: readonly LeaderBinding[]): LeaderBinding[] {\n return bindings.map((binding) => ({\n ...binding,\n path: binding.path.map((segment) => ({ ...segment })) as [\n LeaderBinding['path'][number],\n ...LeaderBinding['path'][number][],\n ],\n ...('command' in binding ? { command: { ...binding.command } } : { action: { ...binding.action } }),\n }));\n}\n\nfunction copySections(sections: readonly ConfigSection[]): ConfigSection[] {\n return sections.map((section) => ({\n ...section,\n fields: section.fields.map((field) => ({\n ...field,\n ...(field.choices ? { choices: field.choices.map((choice) => ({ ...choice })) } : {}),\n ...(field.actions ? { actions: field.actions.map((action) => ({ ...action })) } : {}),\n ...(field.steps ? { steps: field.steps.map((step) => ({ ...step })) } : {}),\n ...(field.output ? { output: [...field.output] } : {}),\n })),\n }));\n}\n\ninterface ActiveFooterContribution {\n readonly token: symbol;\n readonly definition: DoomFooterContributionDefinition;\n value?: DoomFooterContributionValue;\n}\n\nexport class DoomUiFooterStore {\n private readonly contributions = new Map<string, ActiveFooterContribution>();\n private readonly listeners = new Set<Listener>();\n\n register(definition: DoomFooterContributionDefinition): DoomFooterContributionHandle {\n const token = Symbol(definition.source);\n const contribution: ActiveFooterContribution = { token, definition: { ...definition } };\n this.contributions.set(definition.source, contribution);\n notify(this.listeners);\n let disposed = false;\n return {\n update: (value) => {\n if (disposed || this.contributions.get(definition.source)?.token !== token) return;\n contribution.value = value\n ? {\n ...value,\n ...(value.fullSegments ? { fullSegments: value.fullSegments.map((segment) => ({ ...segment })) } : {}),\n ...(value.compactSegments\n ? { compactSegments: value.compactSegments.map((segment) => ({ ...segment })) }\n : {}),\n }\n : undefined;\n notify(this.listeners);\n },\n dispose: () => {\n if (disposed) return;\n disposed = true;\n if (this.contributions.get(definition.source)?.token !== token) return;\n this.contributions.delete(definition.source);\n notify(this.listeners);\n },\n };\n }\n\n getStatuses(): DoomFooterStatus[] {\n return [...this.contributions.values()]\n .flatMap(({ definition, value }) =>\n value\n ? [\n {\n source: definition.source,\n id: definition.id,\n order: definition.order,\n ...(definition.placement ? { placement: definition.placement } : {}),\n ...value,\n },\n ]\n : [],\n )\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.contributions.clear();\n notify(this.listeners);\n this.listeners.clear();\n }\n}\n\ninterface ActiveConfigContribution {\n readonly token: symbol;\n readonly options: DoomConfigContributionOptions<DoomExtensionContext>;\n}\n\nexport class DoomUiConfigStore {\n private readonly contributions = new Map<string, ActiveConfigContribution>();\n private readonly listeners = new Set<Listener>();\n\n constructor(private readonly getContext: () => DoomExtensionContext | undefined) {}\n\n register<ExtensionContext extends DoomExtensionContext>(\n options: DoomConfigContributionOptions<ExtensionContext>,\n ): DoomConfigContributionHandle {\n const token = Symbol(options.source);\n const contribution = {\n token,\n options: options as unknown as DoomConfigContributionOptions<DoomExtensionContext>,\n };\n this.contributions.set(options.source, contribution);\n notify(this.listeners);\n let disposed = false;\n return {\n update: () => {\n if (!disposed && this.contributions.get(options.source)?.token === token) notify(this.listeners);\n },\n dispose: () => {\n if (disposed) return;\n disposed = true;\n if (this.contributions.get(options.source)?.token !== token) return;\n this.contributions.delete(options.source);\n notify(this.listeners);\n },\n };\n }\n\n getSections(): DoomConfigSectionView[] {\n return [...this.contributions.values()]\n .flatMap(({ options }) => {\n try {\n return copySections(options.listSections()).map((section) => ({ source: options.source, ...section }));\n } catch (error) {\n const context = this.getContext();\n if (context) options.onError(error, 'listSections', context);\n return [];\n }\n })\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n invoke(invocation: DoomConfigInvocation): void {\n const active = this.contributions.get(invocation.source);\n const context = this.getContext();\n if (!active || !context) return;\n const handler = active.options.handlers[invocation.action];\n if (!handler) return;\n const input: DoomConfigActionInput = {\n ctx: context,\n sectionId: invocation.sectionId,\n fieldId: invocation.fieldId,\n ...(invocation.value === undefined ? {} : { value: invocation.value }),\n };\n void Promise.resolve(handler(input))\n .catch((error: unknown) => active.options.onError(error, invocation.action, context))\n .finally(() => {\n if (this.contributions.get(invocation.source)?.token === active.token) notify(this.listeners);\n });\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.contributions.clear();\n notify(this.listeners);\n this.listeners.clear();\n }\n}\n\nexport interface DoomUiHubController extends DoomUiHubService {\n readonly config: DoomUiConfigStore;\n readonly footer: DoomUiFooterStore;\n setContext(context: DoomExtensionContext | undefined): void;\n invokeLeaderAction(source: string, action: string): void;\n dispose(): void;\n}\n\nexport interface CreateDoomUiHubOptions {\n readonly leaderRegistry: DoomLeaderRegistry;\n readonly reportDiagnostics: (diagnostics: readonly DoomLeaderDiagnostic[]) => void;\n}\n\nexport function createDoomUiHub({ leaderRegistry, reportDiagnostics }: CreateDoomUiHubOptions): DoomUiHubController {\n let activeContext: DoomExtensionContext | undefined;\n const leaderGenerations = new Map<string, symbol>();\n const actionHandlers = new Map<\n string,\n { token: symbol; options: DoomLeaderActionHandlerOptions<DoomExtensionContext> }\n >();\n const footer = new DoomUiFooterStore();\n const config = new DoomUiConfigStore(() => activeContext);\n\n return {\n footer,\n config,\n registerLeader(contribution) {\n const token = Symbol(contribution.source);\n const publish = (bindings: readonly LeaderBinding[]): void => {\n const result = leaderRegistry.register({ source: contribution.source, bindings: copyBindings(bindings) });\n reportDiagnostics(result.diagnostics);\n };\n publish(contribution.bindings);\n leaderGenerations.set(contribution.source, token);\n let disposed = false;\n return {\n update(bindings) {\n if (disposed || leaderGenerations.get(contribution.source) !== token) return;\n publish(bindings);\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n if (leaderGenerations.get(contribution.source) !== token) return;\n leaderGenerations.delete(contribution.source);\n publish([]);\n },\n };\n },\n registerLeaderActions(options) {\n const token = Symbol(options.source);\n actionHandlers.set(options.source, {\n token,\n options: options as unknown as DoomLeaderActionHandlerOptions<DoomExtensionContext>,\n });\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n if (actionHandlers.get(options.source)?.token === token) actionHandlers.delete(options.source);\n };\n },\n registerFooter: (definition) => footer.register(definition),\n registerConfig: (options) => config.register(options),\n setContext(context) {\n activeContext = context;\n },\n invokeLeaderAction(source, action) {\n const context = activeContext;\n const active = actionHandlers.get(source);\n if (!context || !active) return;\n const handler = active.options.handlers[action];\n if (!handler) return;\n void Promise.resolve(handler(context)).catch((error: unknown) => active.options.onError(error, action, context));\n },\n dispose() {\n activeContext = undefined;\n actionHandlers.clear();\n leaderGenerations.clear();\n footer.dispose();\n config.dispose();\n },\n };\n}\n","import path from 'node:path';\n\nimport { readDoomMcpStatus } from '@agimon-ai/doompi-core/mcpStatus';\nimport { type DoomNotificationLevel, readDoomNotificationService } from '@agimon-ai/doompi-core/notification';\nimport type { PiEventHandlers } from '@agimon-ai/doompi-core/piExtension';\nimport { buildToolSources, type McpServerStatus } from '@agimon-ai/doompi-core/toolInventory';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext, ReadonlyFooterDataProvider } from '@earendil-works/pi-coding-agent';\n\nimport {\n LEADER_WIDGET_KEY,\n TUI_MODE,\n WIDGET_PLACEMENT,\n WARNING_STYLE,\n THEME_ENVIRONMENT_KEY,\n TOOLS_COMMAND,\n CONFIG_COMMAND,\n SESSION_START_EVENT,\n SESSION_MESSAGE_ENTRY,\n INPUT_EVENT,\n INTERACTIVE_INPUT_SOURCE,\n TITLE_MESSAGE_MAX_LENGTH,\n TITLE_PREFIX,\n BUILTIN_LEADER_COMMANDS,\n} from '../constants/ui';\nimport { DoomUiState, type LeaderSnapshot } from '../models/uiState';\nimport { type EventLoopLagSampler, startEventLoopLagSampler } from '../services/eventLoopLag';\nimport { extensionName, extensionPackageName, extensionToolSource } from '../services/extensionSource';\nimport { type DoomLeaderDiagnostic, DoomLeaderRegistry } from '../services/leaderRegistry';\nimport { UI_EVENT, type UiTelemetry } from '../services/telemetry';\nimport { createDoomUiHub } from '../services/uiHub';\nimport { openConfigOverlay } from './configOverlay';\nimport { DoomEditor } from './doomEditor';\nimport { DoomFooter } from './doomFooter';\nimport { DoomHeader } from './doomHeader';\nimport { LeaderHints } from './leaderHints';\nimport { DEFAULT_THEME_NAME } from './theme';\nimport { openToolsOverlay } from './toolsOverlay';\n\nfunction notify(cordis: Context, context: ExtensionContext, body: string, level: DoomNotificationLevel): void {\n const service = readDoomNotificationService(cordis);\n if (service) {\n try {\n void Promise.resolve(service.request({ body, level })).catch(() => undefined);\n } catch {\n // Notification delivery is best effort and does not fall back after routing.\n }\n return;\n }\n context.ui.notify(body, level);\n}\n\nfunction createMessageTitle(message: string, cwd: string): string | undefined {\n const normalizedMessage = message.trim().replace(/\\s+/g, ' ');\n if (!normalizedMessage) return undefined;\n const messageTitle = normalizedMessage.slice(0, TITLE_MESSAGE_MAX_LENGTH).trimEnd();\n return `${TITLE_PREFIX} · ${messageTitle} · ${path.basename(cwd) || cwd}`;\n}\n\ninterface UiPluginOptions {\n readonly pi: ExtensionAPI;\n readonly telemetry: UiTelemetry;\n}\n\nexport interface UiRuntime {\n readonly hub: ReturnType<typeof createDoomUiHub>;\n readonly uiState: DoomUiState;\n readonly commands: readonly (readonly [...Parameters<ExtensionAPI['registerCommand']>])[];\n readonly events: PiEventHandlers;\n dispose(): Promise<void>;\n}\n\nexport function createUiRuntime(cordis: Context, { pi, telemetry }: UiPluginOptions): UiRuntime {\n let disposed = false;\n const uiState = new DoomUiState();\n const leaderRegistry = new DoomLeaderRegistry();\n const pendingDiagnostics = new Set<string>();\n let footerData: ReadonlyFooterDataProvider | undefined;\n let activeContext: ExtensionContext | undefined;\n let sessionGeneration = 0;\n let hasSessionMessage = false;\n let lagSampler: EventLoopLagSampler | undefined;\n\n /**\n * Asks the MCP extension what it is currently connected to.\n *\n * No answer is a normal session: `--no-mcp` leaves nobody providing the query,\n * and the panel simply lists MCP tools under the extension that registered them.\n */\n const readMcpServers = (): readonly McpServerStatus[] | undefined => readDoomMcpStatus(cordis)?.getSnapshot().servers;\n\n const reportDiagnostics = (diagnostics: readonly DoomLeaderDiagnostic[]): void => {\n for (const diagnostic of diagnostics) {\n const binding = diagnostic.bindingId ? ` (${diagnostic.bindingId})` : '';\n const message = `Leader contribution from ${diagnostic.source}${binding}: ${diagnostic.message}`;\n if (pendingDiagnostics.has(message)) continue;\n pendingDiagnostics.add(message);\n // A rejected contribution silently drops another extension's keybindings,\n // and the notice below only reaches a run that has a TUI attached.\n void telemetry.recordWarning(UI_EVENT.leaderContributionRejected, diagnostic.message, {\n 'leader.source': diagnostic.source,\n ...(diagnostic.bindingId ? { 'leader.binding.id': diagnostic.bindingId } : {}),\n });\n if (activeContext?.mode === TUI_MODE) notify(cordis, activeContext, message, WARNING_STYLE);\n }\n };\n\n const hub = createDoomUiHub({ leaderRegistry, reportDiagnostics });\n return {\n hub,\n uiState,\n async dispose() {\n if (disposed) return;\n disposed = true;\n const context = activeContext;\n ++sessionGeneration;\n activeContext = undefined;\n hub.setContext(undefined);\n footerData = undefined;\n lagSampler?.stop();\n lagSampler = undefined;\n hub.dispose();\n uiState.reset();\n if (context?.mode === TUI_MODE) {\n context.ui.setWidget(LEADER_WIDGET_KEY, undefined, { placement: WIDGET_PLACEMENT });\n }\n await telemetry.shutdown();\n },\n commands: [\n [\n TOOLS_COMMAND,\n {\n description: 'Browse the tools available in this session',\n handler: async (_args, ctx) => {\n // Read at open time so a reconnected server or a plan-mode tool swap shows\n // up without restarting the session.\n const mcpServers = readMcpServers();\n const sources = buildToolSources({\n tools: pi.getAllTools(),\n activeTools: pi.getActiveTools(),\n ...(mcpServers ? { mcpServers } : {}),\n resolveExtensionName: extensionName,\n resolveExtensionPackageName: extensionPackageName,\n resolveExtensionToolSource: (toolName) => extensionToolSource(pi, toolName),\n });\n await openToolsOverlay(ctx, sources);\n },\n },\n ],\n\n [\n CONFIG_COMMAND,\n {\n description: 'Browse and change the settings extensions contribute',\n handler: async (_args, ctx) => {\n // The registry is passed live rather than snapshotted: a contributor can be\n // fetching or installing something while the panel is open, and that\n // progress is meant to land in it.\n await openConfigOverlay(ctx, hub.config);\n },\n },\n ],\n ],\n events: {\n [SESSION_START_EVENT]: (_event, ctx) => {\n activeContext = ctx;\n hub.setContext(ctx);\n const activeGeneration = ++sessionGeneration;\n reportDiagnostics(leaderRegistry.flush());\n hasSessionMessage = ctx.sessionManager.getEntries().some((entry) => entry.type === SESSION_MESSAGE_ENTRY);\n if (ctx.mode !== TUI_MODE) return;\n for (const message of pendingDiagnostics) notify(cordis, ctx, message, WARNING_STYLE);\n\n // A resumed or forked session runs this again, and two samplers would\n // double every report.\n lagSampler?.stop();\n lagSampler = startEventLoopLagSampler((lagMs) => {\n void telemetry.recordWarning(UI_EVENT.eventLoopStalled, `Event loop stalled for ${String(lagMs)}ms.`, {\n lag_ms: lagMs,\n });\n });\n\n const themeName = process.env[THEME_ENVIRONMENT_KEY] || DEFAULT_THEME_NAME;\n const themeResult = ctx.ui.setTheme(themeName);\n if (!themeResult.success) {\n notify(cordis, ctx, `Could not apply Doom Pi theme: ${themeResult.error}`, WARNING_STYLE);\n void telemetry.recordWarning(UI_EVENT.themeApplyFailed, themeResult.error ?? 'Unknown theme error', {\n 'ui.theme': themeName,\n });\n }\n\n ctx.ui.setTitle(`${TITLE_PREFIX} · ${path.basename(ctx.cwd) || ctx.cwd} · pi/coding`);\n ctx.ui.setHeader((tui, theme) => new DoomHeader(theme, ctx.cwd, undefined, ctx, () => tui.terminal.rows));\n ctx.ui.setFooter((tui, theme, data) => {\n footerData = data;\n return new DoomFooter(tui, theme, ctx, data, hub.footer, uiState);\n });\n ctx.ui.setEditorComponent(\n (tui, editorTheme, keybindings) =>\n new DoomEditor(\n tui,\n editorTheme,\n keybindings,\n uiState,\n (snapshot: LeaderSnapshot) => {\n if (!snapshot.active) {\n ctx.ui.setWidget(LEADER_WIDGET_KEY, undefined, { placement: WIDGET_PLACEMENT });\n return;\n }\n ctx.ui.setWidget(\n LEADER_WIDGET_KEY,\n (_widgetTui, widgetTheme) =>\n new LeaderHints(widgetTheme, snapshot, ctx, footerData, uiState.getModes()),\n { placement: WIDGET_PLACEMENT },\n );\n },\n undefined,\n ctx.ui.theme,\n {\n registry: leaderRegistry,\n isCommandAvailable: (commandName) =>\n BUILTIN_LEADER_COMMANDS.includes(commandName) ||\n pi.getCommands().some((command) => command.name === commandName),\n onLeaderAction: (source, action) => {\n if (activeContext !== ctx || sessionGeneration !== activeGeneration) {\n notify(cordis, ctx, `Leader action ${action} is unavailable.`, WARNING_STYLE);\n return;\n }\n hub.invokeLeaderAction(source, action);\n },\n onUnavailableCommand: (commandName) => {\n void telemetry.recordWarning(\n UI_EVENT.leaderCommandUnavailable,\n `Leader command /${commandName} is unavailable.`,\n { 'ui.kind': 'command' },\n );\n notify(cordis, ctx, `Leader command /${commandName} is unavailable.`, WARNING_STYLE);\n },\n onUnavailableAction: (action) => {\n void telemetry.recordWarning(\n UI_EVENT.leaderActionUnavailable,\n `Leader action ${action} is unavailable.`,\n {\n 'ui.kind': 'action',\n },\n );\n notify(cordis, ctx, `Leader action ${action} is unavailable.`, WARNING_STYLE);\n },\n },\n ),\n );\n\n void telemetry.recordEvent(UI_EVENT.shellInstalled, {\n 'ui.theme': themeName,\n 'ui.theme.applied': themeResult.success,\n 'ui.leader.group.count': leaderRegistry.getGroup([])?.options.length ?? 0,\n });\n },\n\n [INPUT_EVENT]: (event, ctx) => {\n if (ctx.mode !== TUI_MODE || event.source !== INTERACTIVE_INPUT_SOURCE || hasSessionMessage) return;\n hasSessionMessage = true;\n const title = createMessageTitle(event.text, ctx.cwd);\n if (title) ctx.ui.setTitle(title);\n },\n },\n };\n}\n","import { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\nimport { DOOM_UI_HUB_SERVICE } from '@agimon-ai/doompi-core/uiHub';\nimport {\n DOOM_MINOR_MODE_CATALOG_SERVICE,\n createMinorModeCatalogClient,\n requireMinorModeCatalog,\n} from '@agimon-ai/doompi-minor-mode';\n\nimport { projectMinorModeRecords } from '../../../../models/uiState';\nimport { createUiTelemetry, type UiTelemetry } from '../../../../services/telemetry';\nimport { createBuiltinTools } from '../../../../tui/builtinTools';\nimport { createUiRuntime } from '../../../../tui/uiRuntime';\nimport type { UiPiScope } from './_lib/piScope';\n\nexport default defineRoot(({ context, pi, options, runtime }: PiPluginContext<UiTelemetry>) => {\n if (!runtime) throw new Error('This Pi extension requires the Cordis runtime metadata.');\n const ui = createUiRuntime(context, { pi, telemetry: options ?? createUiTelemetry() });\n const tools = createBuiltinTools(process.cwd());\n const service = (owner: PiPluginContext['context']) => {\n owner.provide(DOOM_UI_HUB_SERVICE, ui.hub);\n owner.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const catalog = createMinorModeCatalogClient(requireMinorModeCatalog(modeContext));\n const update = (): void => ui.uiState.setModes(projectMinorModeRecords(catalog.list()));\n const unsubscribe = catalog.subscribe(update);\n update();\n return () => {\n unsubscribe();\n ui.uiState.setModes([]);\n };\n });\n };\n return {\n value: { ui, tools, runtime } satisfies UiPiScope,\n services: [service],\n onStop: () => ui.dispose(),\n onDispose: () => ui.dispose(),\n };\n});\n","import { defineCliCommand } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliCommand(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.commands[1],\n);\n","import { defineCliCommand } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliCommand(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.commands[0],\n);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliHook((context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.events.input!);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliHook(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.events.session_start!,\n);\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'edit');\n if (!tool) throw new Error('Missing built-in edit tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'find');\n if (!tool) throw new Error('Missing built-in find tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'grep');\n if (!tool) throw new Error('Missing built-in grep tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'ls');\n if (!tool) throw new Error('Missing built-in ls tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'read');\n if (!tool) throw new Error('Missing built-in read tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'write');\n if (!tool) throw new Error('Missing built-in write tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, piToolContributions, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport commandConfig from '../src/extensions/workspaces/sessions/(backend)/command/config.cli';\nimport commandTools from '../src/extensions/workspaces/sessions/(backend)/command/tools.cli';\nimport hookInput from '../src/extensions/workspaces/sessions/(backend)/hook/input.cli';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli';\nimport toolEdit from '../src/extensions/workspaces/sessions/(backend)/tool/edit.cli';\nimport toolFind from '../src/extensions/workspaces/sessions/(backend)/tool/find.cli';\nimport toolGrep from '../src/extensions/workspaces/sessions/(backend)/tool/grep.cli';\nimport toolLs from '../src/extensions/workspaces/sessions/(backend)/tool/ls.cli';\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.cli';\nimport toolWrite from '../src/extensions/workspaces/sessions/(backend)/tool/write.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof commandConfig> | OptionsOf<typeof commandTools> | OptionsOf<typeof hookInput> | OptionsOf<typeof hookSessionStart> | OptionsOf<typeof toolEdit> | OptionsOf<typeof toolFind> | OptionsOf<typeof toolGrep> | OptionsOf<typeof toolLs> | OptionsOf<typeof toolRead> | OptionsOf<typeof toolWrite>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-ui', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get commands(): PiPluginContributions['commands'] { return [at(commandConfig, contextSession), at(commandTools, contextSession)]; },\n events: {\n input: at(hookInput, contextSession) as NonNullable<PiPluginContributions['events']>['input'],\n session_start: at(hookSessionStart, contextSession) as NonNullable<PiPluginContributions['events']>['session_start'],\n },\n ...piToolContributions('@agimon-ai/doompi-ui', [via({ name: 'edit' }, at(toolEdit, contextSession)), via({ name: 'find' }, at(toolFind, contextSession)), via({ name: 'grep' }, at(toolGrep, contextSession)), via({ name: 'ls' }, at(toolLs, contextSession)), via({ name: 'read' }, at(toolRead, contextSession)), via({ name: 'write' }, at(toolWrite, contextSession))]),\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,uBAAuB;;AAuB7B,IAAM,qBAAN,MAA8C;CACf;CAA7B,YAAY,MAA+B;EAAd,KAAA,OAAA;CAAe;CAE5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AAG;EAAS,MAAM,aAAa;CAAM;CAC9D,OAAO;EACL,IAAA,GAAGC,qCAAAA,iBAAAA,CAAiB,YAAY;EAChC,IAAI,WAA8C;GAAE,OAAO,CAAC,GAAGC,oBAAe,cAAc,GAAG,GAAGC,mBAAc,cAAc,CAAC;EAAG;EAClI,QAAQ;GACN,OAAO,GAAGC,mBAAW,cAAc;GACnC,eAAe,GAAGC,0BAAkB,cAAc;EACpD;EACA,IAAA,GAAGC,mCAAAA,oBAAAA,CAAoB,wBAAwB;GAAC,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,KAAK,GAAG,GAAGC,gBAAQ,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,mBAAW,cAAc,CAAC;EAAC,CAAC;EAC3W,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}
@@ -144,6 +144,7 @@ function createBuiltinTools(cwd) {
144
144
  const read = createReadToolDefinition(cwd);
145
145
  tools.push(definePiTool({
146
146
  ...read,
147
+ execute: (...args) => createReadToolDefinition(args[4].cwd).execute(...args),
147
148
  renderShell: "self",
148
149
  renderCall: (args, theme) => renderReadCall(args, theme),
149
150
  renderResult: (result, options, theme, context) => {
@@ -156,6 +157,7 @@ function createBuiltinTools(cwd) {
156
157
  const edit = createEditToolDefinition(cwd);
157
158
  tools.push(definePiTool({
158
159
  ...edit,
160
+ execute: (...args) => createEditToolDefinition(args[4].cwd).execute(...args),
159
161
  renderShell: "self",
160
162
  renderCall: (args, theme) => renderEditCall(args, theme),
161
163
  renderResult: (result, options, theme, context) => {
@@ -169,6 +171,7 @@ function createBuiltinTools(cwd) {
169
171
  const writeResult = write.renderResult;
170
172
  tools.push(definePiTool({
171
173
  ...write,
174
+ execute: (...args) => createWriteToolDefinition(args[4].cwd).execute(...args),
172
175
  renderShell: "self",
173
176
  renderCall: (args, theme, context) => renderWriteCall(args, theme, {
174
177
  expanded: context.expanded,
@@ -185,6 +188,7 @@ function createBuiltinTools(cwd) {
185
188
  const grepResult = grep.renderResult;
186
189
  tools.push(definePiTool({
187
190
  ...grep,
191
+ execute: (...args) => createGrepToolDefinition(args[4].cwd).execute(...args),
188
192
  renderShell: "self",
189
193
  renderCall: (args, theme) => renderGrepCall(args, theme),
190
194
  renderResult: (result, options, theme, context) => {
@@ -198,6 +202,7 @@ function createBuiltinTools(cwd) {
198
202
  const findResult = find.renderResult;
199
203
  tools.push(definePiTool({
200
204
  ...find,
205
+ execute: (...args) => createFindToolDefinition(args[4].cwd).execute(...args),
201
206
  renderShell: "self",
202
207
  renderCall: (args, theme) => renderFindCall(args, theme),
203
208
  renderResult: (result, options, theme, context) => {
@@ -211,6 +216,7 @@ function createBuiltinTools(cwd) {
211
216
  const lsResult = ls.renderResult;
212
217
  tools.push(definePiTool({
213
218
  ...ls,
219
+ execute: (...args) => createLsToolDefinition(args[4].cwd).execute(...args),
214
220
  renderShell: "self",
215
221
  renderCall: (args, theme) => renderLsCall(args, theme),
216
222
  renderResult: (result, options, theme, context) => {
@@ -1 +1 @@
1
- {"version":3,"file":"pi.mjs","names":["notify","rootSession","commandConfig","commandTools","hookInput","hookSessionStart","toolEdit","toolFind","toolGrep","toolLs","toolRead","toolWrite"],"sources":["../../src/tui/builtinToolRender.ts","../../src/tui/builtinTools.ts","../../src/services/eventLoopLag/index.ts","../../src/services/uiHub/index.ts","../../src/tui/uiRuntime.ts","../../src/extensions/workspaces/sessions/(backend)/root.cli.ts","../../src/extensions/workspaces/sessions/(backend)/command/config.cli.ts","../../src/extensions/workspaces/sessions/(backend)/command/tools.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/input.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/edit.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/find.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/grep.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/ls.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/read.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/write.cli.ts","../../generated/pi.ts"],"sourcesContent":["import {\n type EditToolDetails,\n type EditToolInput,\n type FindToolInput,\n type GrepToolInput,\n getLanguageFromPath,\n highlightCode,\n type LsToolInput,\n type ReadToolInput,\n type Theme,\n type WriteToolInput,\n} from '@earendil-works/pi-coding-agent';\nimport { type Component, wrapTextWithAnsi } from '@earendil-works/pi-tui';\n\nimport { gutterWidth, renderLineNumber } from './codeGutter';\nimport { renderDoomDiff } from './diffRender';\nimport { DoomToolCall, frameDoomToolResult, previousDoomToolResult, renderToolHeading } from './toolChrome';\n\nconst COLLAPSED_FILE_LINES = 10;\n\ntype Highlighter = (code: string, language?: string) => string[];\ntype LanguageResolver = (path: string) => string | undefined;\n\nexport interface ToolPreviewOptions {\n expanded?: boolean;\n isError?: boolean;\n}\n\nexport interface WritePreviewOptions extends ToolPreviewOptions {\n argsStreaming?: boolean;\n}\n\nexport interface TextToolResult {\n content?: ReadonlyArray<{ type: string; text?: string }>;\n}\n\nexport interface EditToolResult extends TextToolResult {\n details?: EditToolDetails;\n}\n\n/** Self-owned result shell shared by Pi's native file and search tools. */\nclass BuiltinToolContent implements Component {\n constructor(private readonly text: string) {}\n\n render(width: number): string[] {\n if (width <= 0 || this.text.length === 0) return [];\n return wrapTextWithAnsi(this.text, width);\n }\n\n invalidate(): void {\n // Content is immutable and reflows from the current width on every render.\n }\n}\n\n/** Recover the native renderer's component from the shell returned on its previous pass. */\nexport function previousBuiltinResult(component: Component | undefined): Component | undefined {\n return previousDoomToolResult(component);\n}\n\n/** Reuse the shell while allowing Pi's native renderer to reuse its own inner component. */\nexport function frameBuiltinResult(content: Component, theme: Theme, previous: Component | undefined): Component {\n return frameDoomToolResult(content, theme, previous);\n}\n\nfunction renderCall(label: string, primary: string, details: readonly string[], theme: Theme): Component {\n let text = renderToolHeading(label, primary, theme);\n if (details.length > 0) text += ` ${theme.fg('muted', `· ${details.join(' · ')}`)}`;\n return new DoomToolCall(text);\n}\n\nfunction optionalCount(value: number | undefined, unit: string): string | undefined {\n return value === undefined ? undefined : `${value} ${unit}`;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nexport function renderReadCall(args: ReadToolInput, theme: Theme): Component {\n return renderCall(\n 'read',\n args.path,\n compactDetails([args.offset === undefined ? undefined : `from ${args.offset}`, optionalCount(args.limit, 'lines')]),\n theme,\n );\n}\n\nexport function renderEditCall(args: EditToolInput, theme: Theme): Component {\n const count = args.edits.length;\n return renderCall('edit', args.path, [`${count} edit${count === 1 ? '' : 's'}`], theme);\n}\n\n/**\n * Read appends a bracketed pagination note after a blank line. Detach it so the\n * gutter numbers file content only, and mutate the caller's line list to match.\n */\nfunction takeTrailingNote(lines: string[]): string | undefined {\n const last = lines.at(-1);\n if (last === undefined || !last.startsWith('[') || !last.endsWith(']')) return undefined;\n\n lines.pop();\n while (lines.at(-1) === '') lines.pop();\n return last;\n}\n\nfunction textContent(result: TextToolResult): string {\n return (result.content ?? [])\n .filter((block) => block.type === 'text')\n .map((block) => block.text ?? '')\n .join('\\n')\n .replaceAll('\\t', ' ')\n .replaceAll('\\r\\n', '\\n');\n}\n\nexport function renderEditResult(\n args: EditToolInput,\n result: EditToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n if (options.isError) return new BuiltinToolContent(theme.fg('error', textContent(result)));\n\n const diff = result.details?.diff;\n // A successful edit whose details never arrived has nothing worth a frame.\n if (diff === undefined || diff.length === 0) return new BuiltinToolContent('');\n return renderDoomDiff(diff, theme, resolveLanguage(args.path), highlight);\n}\n\nexport function renderWriteCall(\n args: WriteToolInput,\n theme: Theme,\n options: WritePreviewOptions = {},\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const heading = renderToolHeading('write', args.path, theme);\n const details = theme.fg('muted', `· ${args.content.length.toLocaleString('en-US')} chars`);\n if (args.content.length === 0) return new DoomToolCall(`${heading} ${details}`);\n\n const normalizedLines = args.content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n const showLiveTail = options.argsStreaming === true && options.expanded !== true;\n const visibleLines = options.expanded\n ? normalizedLines\n : showLiveTail\n ? normalizedLines.slice(-COLLAPSED_FILE_LINES)\n : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n const hiddenLineCount = normalizedLines.length - visibleLines.length;\n // A live tail shows the file's end, so numbering starts where the tail does.\n const firstVisibleLineNumber = showLiveTail ? hiddenLineCount + 1 : 1;\n const numberWidth = gutterWidth(firstVisibleLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstVisibleLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const previewLines = showLiveTail\n ? [\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} earlier lines · live tail`)] : []),\n ...preview,\n ]\n : [\n ...preview,\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} more lines · ctrl+o expand`)] : []),\n ];\n return new DoomToolCall([`${heading} ${details}`, '', ...previewLines].join('\\n'));\n}\n\nexport function renderReadResult(\n args: ReadToolInput,\n result: TextToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const normalizedLines = textContent(result).split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n if (options.isError) {\n return new BuiltinToolContent(normalizedLines.map((line) => theme.fg('error', line)).join('\\n'));\n }\n\n const note = takeTrailingNote(normalizedLines);\n const visibleLines = options.expanded ? normalizedLines : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n // Read starts at `offset`, so the gutter has to agree with the file, not the excerpt.\n const firstLineNumber = args.offset ?? 1;\n const numberWidth = gutterWidth(firstLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const remaining = normalizedLines.length - visibleLines.length;\n if (remaining > 0) preview.push(theme.fg('muted', `… ${remaining} more lines · ctrl+o expand`));\n if (note !== undefined) preview.push(theme.fg('muted', note));\n return new BuiltinToolContent(preview.join('\\n'));\n}\n\nexport function renderGrepCall(args: GrepToolInput, theme: Theme): Component {\n return renderCall(\n 'grep',\n args.pattern,\n compactDetails([\n args.path ?? '.',\n args.glob,\n args.ignoreCase === true ? 'ignore case' : undefined,\n optionalCount(args.limit, 'matches'),\n ]),\n theme,\n );\n}\n\nexport function renderFindCall(args: FindToolInput, theme: Theme): Component {\n return renderCall(\n 'find',\n args.pattern,\n compactDetails([args.path ?? '.', optionalCount(args.limit, 'results')]),\n theme,\n );\n}\n\nexport function renderLsCall(args: LsToolInput, theme: Theme): Component {\n return renderCall('ls', args.path ?? '.', compactDetails([optionalCount(args.limit, 'entries')]), theme);\n}\n","import { definePiTool, type PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\nimport {\n createEditToolDefinition,\n createFindToolDefinition,\n createGrepToolDefinition,\n createLsToolDefinition,\n createReadToolDefinition,\n createWriteToolDefinition,\n} from '@earendil-works/pi-coding-agent';\n\nimport {\n frameBuiltinResult,\n previousBuiltinResult,\n renderEditCall,\n renderEditResult,\n renderFindCall,\n renderGrepCall,\n renderLsCall,\n renderReadCall,\n renderReadResult,\n renderWriteCall,\n} from './builtinToolRender';\n\n/**\n * Keep Pi's native schemas, prompt metadata, execution, and result formatting;\n * replace only the broad status-background shell and call heading.\n */\nexport function createBuiltinTools(cwd: string): PiToolDeclaration[] {\n const tools: PiToolDeclaration[] = [];\n const read = createReadToolDefinition(cwd);\n tools.push(\n definePiTool({\n ...read,\n renderShell: 'self',\n renderCall: (args, theme) => renderReadCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = renderReadResult(\n context.args,\n result,\n { expanded: options.expanded, isError: context.isError },\n theme,\n );\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const edit = createEditToolDefinition(cwd);\n tools.push(\n definePiTool({\n ...edit,\n renderShell: 'self',\n renderCall: (args, theme) => renderEditCall(args, theme),\n // Doom bands the diff on the background and keeps syntax highlighting on\n // the foreground, which Pi's foreground-only diff renderer cannot express.\n renderResult: (result, options, theme, context) => {\n const content = renderEditResult(\n context.args,\n result,\n { expanded: options.expanded, isError: context.isError },\n theme,\n );\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const write = createWriteToolDefinition(cwd);\n const writeResult = write.renderResult!;\n tools.push(\n definePiTool({\n ...write,\n renderShell: 'self',\n renderCall: (args, theme, context) =>\n renderWriteCall(args, theme, {\n expanded: context.expanded,\n // Restored completed rows may not mark args complete, but their result is no longer partial.\n argsStreaming: context.argsComplete === false && context.isPartial,\n }),\n renderResult: (result, options, theme, context) => {\n const content = writeResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const grep = createGrepToolDefinition(cwd);\n const grepResult = grep.renderResult!;\n tools.push(\n definePiTool({\n ...grep,\n renderShell: 'self',\n renderCall: (args, theme) => renderGrepCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = grepResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const find = createFindToolDefinition(cwd);\n const findResult = find.renderResult!;\n tools.push(\n definePiTool({\n ...find,\n renderShell: 'self',\n renderCall: (args, theme) => renderFindCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = findResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const ls = createLsToolDefinition(cwd);\n const lsResult = ls.renderResult!;\n tools.push(\n definePiTool({\n ...ls,\n renderShell: 'self',\n renderCall: (args, theme) => renderLsCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = lsResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n return tools;\n}\n","/** How often the sampler asks to be woken. Short enough to catch a stall inside a single tool call. */\nconst SAMPLE_INTERVAL_MS = 250;\n/**\n * Below this, a late timer is ordinary scheduling jitter rather than something a\n * user would feel. Reporting every sample would cost more than it measures.\n */\nconst REPORT_THRESHOLD_MS = 250;\n\nexport interface EventLoopLagSampler {\n stop(): void;\n}\n\n/**\n * Reports how far behind schedule the event loop is running.\n *\n * A timer that wakes late is the only signal from inside the process that\n * something synchronous, garbage collection included, held the loop. Nothing in\n * a session transcript records it, so a stall here is otherwise invisible and\n * reads as a slow model or a slow tool.\n */\nexport function startEventLoopLagSampler(report: (lagMs: number) => void): EventLoopLagSampler {\n let expected = Date.now() + SAMPLE_INTERVAL_MS;\n const timer = setInterval(() => {\n const now = Date.now();\n const lagMs = now - expected;\n // Rebased on the wake that just happened rather than advanced by a fixed\n // step, so one long stall does not report itself again on every later tick.\n expected = now + SAMPLE_INTERVAL_MS;\n if (lagMs >= REPORT_THRESHOLD_MS) report(lagMs);\n }, SAMPLE_INTERVAL_MS);\n // A diagnostic must never be the reason a process refuses to exit.\n timer.unref();\n return {\n stop: () => {\n clearInterval(timer);\n },\n };\n}\n","import type {\n ConfigSection,\n DoomConfigActionInput,\n DoomConfigContributionHandle,\n DoomConfigContributionOptions,\n DoomConfigInvocation,\n DoomConfigSectionView,\n DoomExtensionContext,\n} from '@agimon-ai/doompi-core/config';\nimport type {\n DoomFooterContributionDefinition,\n DoomFooterContributionHandle,\n DoomFooterContributionValue,\n DoomFooterStatus,\n} from '@agimon-ai/doompi-core/footer';\nimport type { DoomLeaderActionHandlerOptions, LeaderBinding } from '@agimon-ai/doompi-core/leader';\nimport type { DoomUiHubService } from '@agimon-ai/doompi-core/uiHub';\n\nimport type { DoomLeaderDiagnostic, DoomLeaderRegistry } from '../leaderRegistry';\n\ntype Listener = () => void;\n\nfunction notify(listeners: ReadonlySet<Listener>): void {\n for (const listener of listeners) listener();\n}\n\nfunction copyBindings(bindings: readonly LeaderBinding[]): LeaderBinding[] {\n return bindings.map((binding) => ({\n ...binding,\n path: binding.path.map((segment) => ({ ...segment })) as [\n LeaderBinding['path'][number],\n ...LeaderBinding['path'][number][],\n ],\n ...('command' in binding ? { command: { ...binding.command } } : { action: { ...binding.action } }),\n }));\n}\n\nfunction copySections(sections: readonly ConfigSection[]): ConfigSection[] {\n return sections.map((section) => ({\n ...section,\n fields: section.fields.map((field) => ({\n ...field,\n ...(field.choices ? { choices: field.choices.map((choice) => ({ ...choice })) } : {}),\n ...(field.actions ? { actions: field.actions.map((action) => ({ ...action })) } : {}),\n ...(field.steps ? { steps: field.steps.map((step) => ({ ...step })) } : {}),\n ...(field.output ? { output: [...field.output] } : {}),\n })),\n }));\n}\n\ninterface ActiveFooterContribution {\n readonly token: symbol;\n readonly definition: DoomFooterContributionDefinition;\n value?: DoomFooterContributionValue;\n}\n\nexport class DoomUiFooterStore {\n private readonly contributions = new Map<string, ActiveFooterContribution>();\n private readonly listeners = new Set<Listener>();\n\n register(definition: DoomFooterContributionDefinition): DoomFooterContributionHandle {\n const token = Symbol(definition.source);\n const contribution: ActiveFooterContribution = { token, definition: { ...definition } };\n this.contributions.set(definition.source, contribution);\n notify(this.listeners);\n let disposed = false;\n return {\n update: (value) => {\n if (disposed || this.contributions.get(definition.source)?.token !== token) return;\n contribution.value = value\n ? {\n ...value,\n ...(value.fullSegments ? { fullSegments: value.fullSegments.map((segment) => ({ ...segment })) } : {}),\n ...(value.compactSegments\n ? { compactSegments: value.compactSegments.map((segment) => ({ ...segment })) }\n : {}),\n }\n : undefined;\n notify(this.listeners);\n },\n dispose: () => {\n if (disposed) return;\n disposed = true;\n if (this.contributions.get(definition.source)?.token !== token) return;\n this.contributions.delete(definition.source);\n notify(this.listeners);\n },\n };\n }\n\n getStatuses(): DoomFooterStatus[] {\n return [...this.contributions.values()]\n .flatMap(({ definition, value }) =>\n value\n ? [\n {\n source: definition.source,\n id: definition.id,\n order: definition.order,\n ...(definition.placement ? { placement: definition.placement } : {}),\n ...value,\n },\n ]\n : [],\n )\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.contributions.clear();\n notify(this.listeners);\n this.listeners.clear();\n }\n}\n\ninterface ActiveConfigContribution {\n readonly token: symbol;\n readonly options: DoomConfigContributionOptions<DoomExtensionContext>;\n}\n\nexport class DoomUiConfigStore {\n private readonly contributions = new Map<string, ActiveConfigContribution>();\n private readonly listeners = new Set<Listener>();\n\n constructor(private readonly getContext: () => DoomExtensionContext | undefined) {}\n\n register<ExtensionContext extends DoomExtensionContext>(\n options: DoomConfigContributionOptions<ExtensionContext>,\n ): DoomConfigContributionHandle {\n const token = Symbol(options.source);\n const contribution = {\n token,\n options: options as unknown as DoomConfigContributionOptions<DoomExtensionContext>,\n };\n this.contributions.set(options.source, contribution);\n notify(this.listeners);\n let disposed = false;\n return {\n update: () => {\n if (!disposed && this.contributions.get(options.source)?.token === token) notify(this.listeners);\n },\n dispose: () => {\n if (disposed) return;\n disposed = true;\n if (this.contributions.get(options.source)?.token !== token) return;\n this.contributions.delete(options.source);\n notify(this.listeners);\n },\n };\n }\n\n getSections(): DoomConfigSectionView[] {\n return [...this.contributions.values()]\n .flatMap(({ options }) => {\n try {\n return copySections(options.listSections()).map((section) => ({ source: options.source, ...section }));\n } catch (error) {\n const context = this.getContext();\n if (context) options.onError(error, 'listSections', context);\n return [];\n }\n })\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n invoke(invocation: DoomConfigInvocation): void {\n const active = this.contributions.get(invocation.source);\n const context = this.getContext();\n if (!active || !context) return;\n const handler = active.options.handlers[invocation.action];\n if (!handler) return;\n const input: DoomConfigActionInput = {\n ctx: context,\n sectionId: invocation.sectionId,\n fieldId: invocation.fieldId,\n ...(invocation.value === undefined ? {} : { value: invocation.value }),\n };\n void Promise.resolve(handler(input))\n .catch((error: unknown) => active.options.onError(error, invocation.action, context))\n .finally(() => {\n if (this.contributions.get(invocation.source)?.token === active.token) notify(this.listeners);\n });\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.contributions.clear();\n notify(this.listeners);\n this.listeners.clear();\n }\n}\n\nexport interface DoomUiHubController extends DoomUiHubService {\n readonly config: DoomUiConfigStore;\n readonly footer: DoomUiFooterStore;\n setContext(context: DoomExtensionContext | undefined): void;\n invokeLeaderAction(source: string, action: string): void;\n dispose(): void;\n}\n\nexport interface CreateDoomUiHubOptions {\n readonly leaderRegistry: DoomLeaderRegistry;\n readonly reportDiagnostics: (diagnostics: readonly DoomLeaderDiagnostic[]) => void;\n}\n\nexport function createDoomUiHub({ leaderRegistry, reportDiagnostics }: CreateDoomUiHubOptions): DoomUiHubController {\n let activeContext: DoomExtensionContext | undefined;\n const leaderGenerations = new Map<string, symbol>();\n const actionHandlers = new Map<\n string,\n { token: symbol; options: DoomLeaderActionHandlerOptions<DoomExtensionContext> }\n >();\n const footer = new DoomUiFooterStore();\n const config = new DoomUiConfigStore(() => activeContext);\n\n return {\n footer,\n config,\n registerLeader(contribution) {\n const token = Symbol(contribution.source);\n const publish = (bindings: readonly LeaderBinding[]): void => {\n const result = leaderRegistry.register({ source: contribution.source, bindings: copyBindings(bindings) });\n reportDiagnostics(result.diagnostics);\n };\n publish(contribution.bindings);\n leaderGenerations.set(contribution.source, token);\n let disposed = false;\n return {\n update(bindings) {\n if (disposed || leaderGenerations.get(contribution.source) !== token) return;\n publish(bindings);\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n if (leaderGenerations.get(contribution.source) !== token) return;\n leaderGenerations.delete(contribution.source);\n publish([]);\n },\n };\n },\n registerLeaderActions(options) {\n const token = Symbol(options.source);\n actionHandlers.set(options.source, {\n token,\n options: options as unknown as DoomLeaderActionHandlerOptions<DoomExtensionContext>,\n });\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n if (actionHandlers.get(options.source)?.token === token) actionHandlers.delete(options.source);\n };\n },\n registerFooter: (definition) => footer.register(definition),\n registerConfig: (options) => config.register(options),\n setContext(context) {\n activeContext = context;\n },\n invokeLeaderAction(source, action) {\n const context = activeContext;\n const active = actionHandlers.get(source);\n if (!context || !active) return;\n const handler = active.options.handlers[action];\n if (!handler) return;\n void Promise.resolve(handler(context)).catch((error: unknown) => active.options.onError(error, action, context));\n },\n dispose() {\n activeContext = undefined;\n actionHandlers.clear();\n leaderGenerations.clear();\n footer.dispose();\n config.dispose();\n },\n };\n}\n","import path from 'node:path';\n\nimport { readDoomMcpStatus } from '@agimon-ai/doompi-core/mcpStatus';\nimport { type DoomNotificationLevel, readDoomNotificationService } from '@agimon-ai/doompi-core/notification';\nimport type { PiEventHandlers } from '@agimon-ai/doompi-core/piExtension';\nimport { buildToolSources, type McpServerStatus } from '@agimon-ai/doompi-core/toolInventory';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext, ReadonlyFooterDataProvider } from '@earendil-works/pi-coding-agent';\n\nimport {\n LEADER_WIDGET_KEY,\n TUI_MODE,\n WIDGET_PLACEMENT,\n WARNING_STYLE,\n THEME_ENVIRONMENT_KEY,\n TOOLS_COMMAND,\n CONFIG_COMMAND,\n SESSION_START_EVENT,\n SESSION_MESSAGE_ENTRY,\n INPUT_EVENT,\n INTERACTIVE_INPUT_SOURCE,\n TITLE_MESSAGE_MAX_LENGTH,\n TITLE_PREFIX,\n BUILTIN_LEADER_COMMANDS,\n} from '../constants/ui';\nimport { DoomUiState, type LeaderSnapshot } from '../models/uiState';\nimport { type EventLoopLagSampler, startEventLoopLagSampler } from '../services/eventLoopLag';\nimport { extensionName, extensionPackageName, extensionToolSource } from '../services/extensionSource';\nimport { type DoomLeaderDiagnostic, DoomLeaderRegistry } from '../services/leaderRegistry';\nimport { UI_EVENT, type UiTelemetry } from '../services/telemetry';\nimport { createDoomUiHub } from '../services/uiHub';\nimport { openConfigOverlay } from './configOverlay';\nimport { DoomEditor } from './doomEditor';\nimport { DoomFooter } from './doomFooter';\nimport { DoomHeader } from './doomHeader';\nimport { LeaderHints } from './leaderHints';\nimport { DEFAULT_THEME_NAME } from './theme';\nimport { openToolsOverlay } from './toolsOverlay';\n\nfunction notify(cordis: Context, context: ExtensionContext, body: string, level: DoomNotificationLevel): void {\n const service = readDoomNotificationService(cordis);\n if (service) {\n try {\n void Promise.resolve(service.request({ body, level })).catch(() => undefined);\n } catch {\n // Notification delivery is best effort and does not fall back after routing.\n }\n return;\n }\n context.ui.notify(body, level);\n}\n\nfunction createMessageTitle(message: string, cwd: string): string | undefined {\n const normalizedMessage = message.trim().replace(/\\s+/g, ' ');\n if (!normalizedMessage) return undefined;\n const messageTitle = normalizedMessage.slice(0, TITLE_MESSAGE_MAX_LENGTH).trimEnd();\n return `${TITLE_PREFIX} · ${messageTitle} · ${path.basename(cwd) || cwd}`;\n}\n\ninterface UiPluginOptions {\n readonly pi: ExtensionAPI;\n readonly telemetry: UiTelemetry;\n}\n\nexport interface UiRuntime {\n readonly hub: ReturnType<typeof createDoomUiHub>;\n readonly uiState: DoomUiState;\n readonly commands: readonly (readonly [...Parameters<ExtensionAPI['registerCommand']>])[];\n readonly events: PiEventHandlers;\n dispose(): Promise<void>;\n}\n\nexport function createUiRuntime(cordis: Context, { pi, telemetry }: UiPluginOptions): UiRuntime {\n let disposed = false;\n const uiState = new DoomUiState();\n const leaderRegistry = new DoomLeaderRegistry();\n const pendingDiagnostics = new Set<string>();\n let footerData: ReadonlyFooterDataProvider | undefined;\n let activeContext: ExtensionContext | undefined;\n let sessionGeneration = 0;\n let hasSessionMessage = false;\n let lagSampler: EventLoopLagSampler | undefined;\n\n /**\n * Asks the MCP extension what it is currently connected to.\n *\n * No answer is a normal session: `--no-mcp` leaves nobody providing the query,\n * and the panel simply lists MCP tools under the extension that registered them.\n */\n const readMcpServers = (): readonly McpServerStatus[] | undefined => readDoomMcpStatus(cordis)?.getSnapshot().servers;\n\n const reportDiagnostics = (diagnostics: readonly DoomLeaderDiagnostic[]): void => {\n for (const diagnostic of diagnostics) {\n const binding = diagnostic.bindingId ? ` (${diagnostic.bindingId})` : '';\n const message = `Leader contribution from ${diagnostic.source}${binding}: ${diagnostic.message}`;\n if (pendingDiagnostics.has(message)) continue;\n pendingDiagnostics.add(message);\n // A rejected contribution silently drops another extension's keybindings,\n // and the notice below only reaches a run that has a TUI attached.\n void telemetry.recordWarning(UI_EVENT.leaderContributionRejected, diagnostic.message, {\n 'leader.source': diagnostic.source,\n ...(diagnostic.bindingId ? { 'leader.binding.id': diagnostic.bindingId } : {}),\n });\n if (activeContext?.mode === TUI_MODE) notify(cordis, activeContext, message, WARNING_STYLE);\n }\n };\n\n const hub = createDoomUiHub({ leaderRegistry, reportDiagnostics });\n return {\n hub,\n uiState,\n async dispose() {\n if (disposed) return;\n disposed = true;\n const context = activeContext;\n ++sessionGeneration;\n activeContext = undefined;\n hub.setContext(undefined);\n footerData = undefined;\n lagSampler?.stop();\n lagSampler = undefined;\n hub.dispose();\n uiState.reset();\n if (context?.mode === TUI_MODE) {\n context.ui.setWidget(LEADER_WIDGET_KEY, undefined, { placement: WIDGET_PLACEMENT });\n }\n await telemetry.shutdown();\n },\n commands: [\n [\n TOOLS_COMMAND,\n {\n description: 'Browse the tools available in this session',\n handler: async (_args, ctx) => {\n // Read at open time so a reconnected server or a plan-mode tool swap shows\n // up without restarting the session.\n const mcpServers = readMcpServers();\n const sources = buildToolSources({\n tools: pi.getAllTools(),\n activeTools: pi.getActiveTools(),\n ...(mcpServers ? { mcpServers } : {}),\n resolveExtensionName: extensionName,\n resolveExtensionPackageName: extensionPackageName,\n resolveExtensionToolSource: (toolName) => extensionToolSource(pi, toolName),\n });\n await openToolsOverlay(ctx, sources);\n },\n },\n ],\n\n [\n CONFIG_COMMAND,\n {\n description: 'Browse and change the settings extensions contribute',\n handler: async (_args, ctx) => {\n // The registry is passed live rather than snapshotted: a contributor can be\n // fetching or installing something while the panel is open, and that\n // progress is meant to land in it.\n await openConfigOverlay(ctx, hub.config);\n },\n },\n ],\n ],\n events: {\n [SESSION_START_EVENT]: (_event, ctx) => {\n activeContext = ctx;\n hub.setContext(ctx);\n const activeGeneration = ++sessionGeneration;\n reportDiagnostics(leaderRegistry.flush());\n hasSessionMessage = ctx.sessionManager.getEntries().some((entry) => entry.type === SESSION_MESSAGE_ENTRY);\n if (ctx.mode !== TUI_MODE) return;\n for (const message of pendingDiagnostics) notify(cordis, ctx, message, WARNING_STYLE);\n\n // A resumed or forked session runs this again, and two samplers would\n // double every report.\n lagSampler?.stop();\n lagSampler = startEventLoopLagSampler((lagMs) => {\n void telemetry.recordWarning(UI_EVENT.eventLoopStalled, `Event loop stalled for ${String(lagMs)}ms.`, {\n lag_ms: lagMs,\n });\n });\n\n const themeName = process.env[THEME_ENVIRONMENT_KEY] || DEFAULT_THEME_NAME;\n const themeResult = ctx.ui.setTheme(themeName);\n if (!themeResult.success) {\n notify(cordis, ctx, `Could not apply Doom Pi theme: ${themeResult.error}`, WARNING_STYLE);\n void telemetry.recordWarning(UI_EVENT.themeApplyFailed, themeResult.error ?? 'Unknown theme error', {\n 'ui.theme': themeName,\n });\n }\n\n ctx.ui.setTitle(`${TITLE_PREFIX} · ${path.basename(ctx.cwd) || ctx.cwd} · pi/coding`);\n ctx.ui.setHeader((tui, theme) => new DoomHeader(theme, ctx.cwd, undefined, ctx, () => tui.terminal.rows));\n ctx.ui.setFooter((tui, theme, data) => {\n footerData = data;\n return new DoomFooter(tui, theme, ctx, data, hub.footer, uiState);\n });\n ctx.ui.setEditorComponent(\n (tui, editorTheme, keybindings) =>\n new DoomEditor(\n tui,\n editorTheme,\n keybindings,\n uiState,\n (snapshot: LeaderSnapshot) => {\n if (!snapshot.active) {\n ctx.ui.setWidget(LEADER_WIDGET_KEY, undefined, { placement: WIDGET_PLACEMENT });\n return;\n }\n ctx.ui.setWidget(\n LEADER_WIDGET_KEY,\n (_widgetTui, widgetTheme) =>\n new LeaderHints(widgetTheme, snapshot, ctx, footerData, uiState.getModes()),\n { placement: WIDGET_PLACEMENT },\n );\n },\n undefined,\n ctx.ui.theme,\n {\n registry: leaderRegistry,\n isCommandAvailable: (commandName) =>\n BUILTIN_LEADER_COMMANDS.includes(commandName) ||\n pi.getCommands().some((command) => command.name === commandName),\n onLeaderAction: (source, action) => {\n if (activeContext !== ctx || sessionGeneration !== activeGeneration) {\n notify(cordis, ctx, `Leader action ${action} is unavailable.`, WARNING_STYLE);\n return;\n }\n hub.invokeLeaderAction(source, action);\n },\n onUnavailableCommand: (commandName) => {\n void telemetry.recordWarning(\n UI_EVENT.leaderCommandUnavailable,\n `Leader command /${commandName} is unavailable.`,\n { 'ui.kind': 'command' },\n );\n notify(cordis, ctx, `Leader command /${commandName} is unavailable.`, WARNING_STYLE);\n },\n onUnavailableAction: (action) => {\n void telemetry.recordWarning(\n UI_EVENT.leaderActionUnavailable,\n `Leader action ${action} is unavailable.`,\n {\n 'ui.kind': 'action',\n },\n );\n notify(cordis, ctx, `Leader action ${action} is unavailable.`, WARNING_STYLE);\n },\n },\n ),\n );\n\n void telemetry.recordEvent(UI_EVENT.shellInstalled, {\n 'ui.theme': themeName,\n 'ui.theme.applied': themeResult.success,\n 'ui.leader.group.count': leaderRegistry.getGroup([])?.options.length ?? 0,\n });\n },\n\n [INPUT_EVENT]: (event, ctx) => {\n if (ctx.mode !== TUI_MODE || event.source !== INTERACTIVE_INPUT_SOURCE || hasSessionMessage) return;\n hasSessionMessage = true;\n const title = createMessageTitle(event.text, ctx.cwd);\n if (title) ctx.ui.setTitle(title);\n },\n },\n };\n}\n","import { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\nimport { DOOM_UI_HUB_SERVICE } from '@agimon-ai/doompi-core/uiHub';\nimport {\n DOOM_MINOR_MODE_CATALOG_SERVICE,\n createMinorModeCatalogClient,\n requireMinorModeCatalog,\n} from '@agimon-ai/doompi-minor-mode';\n\nimport { projectMinorModeRecords } from '../../../../models/uiState';\nimport { createUiTelemetry, type UiTelemetry } from '../../../../services/telemetry';\nimport { createBuiltinTools } from '../../../../tui/builtinTools';\nimport { createUiRuntime } from '../../../../tui/uiRuntime';\nimport type { UiPiScope } from './_lib/piScope';\n\nexport default defineRoot(({ context, pi, options, runtime }: PiPluginContext<UiTelemetry>) => {\n if (!runtime) throw new Error('This Pi extension requires the Cordis runtime metadata.');\n const ui = createUiRuntime(context, { pi, telemetry: options ?? createUiTelemetry() });\n const tools = createBuiltinTools(process.cwd());\n const service = (owner: PiPluginContext['context']) => {\n owner.provide(DOOM_UI_HUB_SERVICE, ui.hub);\n owner.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const catalog = createMinorModeCatalogClient(requireMinorModeCatalog(modeContext));\n const update = (): void => ui.uiState.setModes(projectMinorModeRecords(catalog.list()));\n const unsubscribe = catalog.subscribe(update);\n update();\n return () => {\n unsubscribe();\n ui.uiState.setModes([]);\n };\n });\n };\n return {\n value: { ui, tools, runtime } satisfies UiPiScope,\n services: [service],\n onStop: () => ui.dispose(),\n onDispose: () => ui.dispose(),\n };\n});\n","import { defineCliCommand } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliCommand(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.commands[1],\n);\n","import { defineCliCommand } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliCommand(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.commands[0],\n);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliHook((context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.events.input!);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliHook(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.events.session_start!,\n);\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'edit');\n if (!tool) throw new Error('Missing built-in edit tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'find');\n if (!tool) throw new Error('Missing built-in find tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'grep');\n if (!tool) throw new Error('Missing built-in grep tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'ls');\n if (!tool) throw new Error('Missing built-in ls tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'read');\n if (!tool) throw new Error('Missing built-in read tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'write');\n if (!tool) throw new Error('Missing built-in write tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, piToolContributions, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport commandConfig from '../src/extensions/workspaces/sessions/(backend)/command/config.cli';\nimport commandTools from '../src/extensions/workspaces/sessions/(backend)/command/tools.cli';\nimport hookInput from '../src/extensions/workspaces/sessions/(backend)/hook/input.cli';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli';\nimport toolEdit from '../src/extensions/workspaces/sessions/(backend)/tool/edit.cli';\nimport toolFind from '../src/extensions/workspaces/sessions/(backend)/tool/find.cli';\nimport toolGrep from '../src/extensions/workspaces/sessions/(backend)/tool/grep.cli';\nimport toolLs from '../src/extensions/workspaces/sessions/(backend)/tool/ls.cli';\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.cli';\nimport toolWrite from '../src/extensions/workspaces/sessions/(backend)/tool/write.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof commandConfig> | OptionsOf<typeof commandTools> | OptionsOf<typeof hookInput> | OptionsOf<typeof hookSessionStart> | OptionsOf<typeof toolEdit> | OptionsOf<typeof toolFind> | OptionsOf<typeof toolGrep> | OptionsOf<typeof toolLs> | OptionsOf<typeof toolRead> | OptionsOf<typeof toolWrite>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-ui', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get commands(): PiPluginContributions['commands'] { return [at(commandConfig, contextSession), at(commandTools, contextSession)]; },\n events: {\n input: at(hookInput, contextSession) as NonNullable<PiPluginContributions['events']>['input'],\n session_start: at(hookSessionStart, contextSession) as NonNullable<PiPluginContributions['events']>['session_start'],\n },\n ...piToolContributions('@agimon-ai/doompi-ui', [via({ name: 'edit' }, at(toolEdit, contextSession)), via({ name: 'find' }, at(toolFind, contextSession)), via({ name: 'grep' }, at(toolGrep, contextSession)), via({ name: 'ls' }, at(toolLs, contextSession)), via({ name: 'read' }, at(toolRead, contextSession)), via({ name: 'write' }, at(toolWrite, contextSession))]),\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,uBAAuB;;AAuB7B,IAAM,qBAAN,MAA8C;CACf;CAA7B,YAAY,MAA+B;EAAd,KAAA,OAAA;CAAe;CAE5C,OAAO,OAAyB;EAC9B,IAAI,SAAS,KAAK,KAAK,KAAK,WAAW,GAAG,OAAO,CAAC;EAClD,OAAO,iBAAiB,KAAK,MAAM,KAAK;CAC1C;CAEA,aAAmB,CAEnB;AACF;;AAGA,SAAgB,sBAAsB,WAAyD;CAC7F,OAAO,uBAAuB,SAAS;AACzC;;AAGA,SAAgB,mBAAmB,SAAoB,OAAc,UAA4C;CAC/G,OAAO,oBAAoB,SAAS,OAAO,QAAQ;AACrD;AAEA,SAAS,WAAW,OAAe,SAAiB,SAA4B,OAAyB;CACvG,IAAI,OAAO,kBAAkB,OAAO,SAAS,KAAK;CAClD,IAAI,QAAQ,SAAS,GAAG,QAAQ,IAAI,MAAM,GAAG,SAAS,KAAK,QAAQ,KAAK,KAAK,GAAG;CAChF,OAAO,IAAI,aAAa,IAAI;AAC9B;AAEA,SAAS,cAAc,OAA2B,MAAkC;CAClF,OAAO,UAAU,KAAA,IAAY,KAAA,IAAY,GAAG,MAAM,GAAG;AACvD;AAEA,SAAS,eAAe,QAAqD;CAC3E,OAAO,OAAO,QAAQ,UAA2B,UAAU,KAAA,KAAa,MAAM,SAAS,CAAC;AAC1F;AAEA,SAAgB,eAAe,MAAqB,OAAyB;CAC3E,OAAO,WACL,QACA,KAAK,MACL,eAAe,CAAC,KAAK,WAAW,KAAA,IAAY,KAAA,IAAY,QAAQ,KAAK,UAAU,cAAc,KAAK,OAAO,OAAO,CAAC,CAAC,GAClH,KACF;AACF;AAEA,SAAgB,eAAe,MAAqB,OAAyB;CAC3E,MAAM,QAAQ,KAAK,MAAM;CACz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O,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,KAAK,GAAG,GAAGC,gBAAQ,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,mBAAW,cAAc,CAAC;EAAC,CAAC;EAC3W,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}
1
+ {"version":3,"file":"pi.mjs","names":["notify","rootSession","commandConfig","commandTools","hookInput","hookSessionStart","toolEdit","toolFind","toolGrep","toolLs","toolRead","toolWrite"],"sources":["../../src/tui/builtinToolRender.ts","../../src/tui/builtinTools.ts","../../src/services/eventLoopLag/index.ts","../../src/services/uiHub/index.ts","../../src/tui/uiRuntime.ts","../../src/extensions/workspaces/sessions/(backend)/root.cli.ts","../../src/extensions/workspaces/sessions/(backend)/command/config.cli.ts","../../src/extensions/workspaces/sessions/(backend)/command/tools.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/input.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/edit.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/find.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/grep.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/ls.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/read.cli.ts","../../src/extensions/workspaces/sessions/(backend)/tool/write.cli.ts","../../generated/pi.ts"],"sourcesContent":["import {\n type EditToolDetails,\n type EditToolInput,\n type FindToolInput,\n type GrepToolInput,\n getLanguageFromPath,\n highlightCode,\n type LsToolInput,\n type ReadToolInput,\n type Theme,\n type WriteToolInput,\n} from '@earendil-works/pi-coding-agent';\nimport { type Component, wrapTextWithAnsi } from '@earendil-works/pi-tui';\n\nimport { gutterWidth, renderLineNumber } from './codeGutter';\nimport { renderDoomDiff } from './diffRender';\nimport { DoomToolCall, frameDoomToolResult, previousDoomToolResult, renderToolHeading } from './toolChrome';\n\nconst COLLAPSED_FILE_LINES = 10;\n\ntype Highlighter = (code: string, language?: string) => string[];\ntype LanguageResolver = (path: string) => string | undefined;\n\nexport interface ToolPreviewOptions {\n expanded?: boolean;\n isError?: boolean;\n}\n\nexport interface WritePreviewOptions extends ToolPreviewOptions {\n argsStreaming?: boolean;\n}\n\nexport interface TextToolResult {\n content?: ReadonlyArray<{ type: string; text?: string }>;\n}\n\nexport interface EditToolResult extends TextToolResult {\n details?: EditToolDetails;\n}\n\n/** Self-owned result shell shared by Pi's native file and search tools. */\nclass BuiltinToolContent implements Component {\n constructor(private readonly text: string) {}\n\n render(width: number): string[] {\n if (width <= 0 || this.text.length === 0) return [];\n return wrapTextWithAnsi(this.text, width);\n }\n\n invalidate(): void {\n // Content is immutable and reflows from the current width on every render.\n }\n}\n\n/** Recover the native renderer's component from the shell returned on its previous pass. */\nexport function previousBuiltinResult(component: Component | undefined): Component | undefined {\n return previousDoomToolResult(component);\n}\n\n/** Reuse the shell while allowing Pi's native renderer to reuse its own inner component. */\nexport function frameBuiltinResult(content: Component, theme: Theme, previous: Component | undefined): Component {\n return frameDoomToolResult(content, theme, previous);\n}\n\nfunction renderCall(label: string, primary: string, details: readonly string[], theme: Theme): Component {\n let text = renderToolHeading(label, primary, theme);\n if (details.length > 0) text += ` ${theme.fg('muted', `· ${details.join(' · ')}`)}`;\n return new DoomToolCall(text);\n}\n\nfunction optionalCount(value: number | undefined, unit: string): string | undefined {\n return value === undefined ? undefined : `${value} ${unit}`;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nexport function renderReadCall(args: ReadToolInput, theme: Theme): Component {\n return renderCall(\n 'read',\n args.path,\n compactDetails([args.offset === undefined ? undefined : `from ${args.offset}`, optionalCount(args.limit, 'lines')]),\n theme,\n );\n}\n\nexport function renderEditCall(args: EditToolInput, theme: Theme): Component {\n const count = args.edits.length;\n return renderCall('edit', args.path, [`${count} edit${count === 1 ? '' : 's'}`], theme);\n}\n\n/**\n * Read appends a bracketed pagination note after a blank line. Detach it so the\n * gutter numbers file content only, and mutate the caller's line list to match.\n */\nfunction takeTrailingNote(lines: string[]): string | undefined {\n const last = lines.at(-1);\n if (last === undefined || !last.startsWith('[') || !last.endsWith(']')) return undefined;\n\n lines.pop();\n while (lines.at(-1) === '') lines.pop();\n return last;\n}\n\nfunction textContent(result: TextToolResult): string {\n return (result.content ?? [])\n .filter((block) => block.type === 'text')\n .map((block) => block.text ?? '')\n .join('\\n')\n .replaceAll('\\t', ' ')\n .replaceAll('\\r\\n', '\\n');\n}\n\nexport function renderEditResult(\n args: EditToolInput,\n result: EditToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n if (options.isError) return new BuiltinToolContent(theme.fg('error', textContent(result)));\n\n const diff = result.details?.diff;\n // A successful edit whose details never arrived has nothing worth a frame.\n if (diff === undefined || diff.length === 0) return new BuiltinToolContent('');\n return renderDoomDiff(diff, theme, resolveLanguage(args.path), highlight);\n}\n\nexport function renderWriteCall(\n args: WriteToolInput,\n theme: Theme,\n options: WritePreviewOptions = {},\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const heading = renderToolHeading('write', args.path, theme);\n const details = theme.fg('muted', `· ${args.content.length.toLocaleString('en-US')} chars`);\n if (args.content.length === 0) return new DoomToolCall(`${heading} ${details}`);\n\n const normalizedLines = args.content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n const showLiveTail = options.argsStreaming === true && options.expanded !== true;\n const visibleLines = options.expanded\n ? normalizedLines\n : showLiveTail\n ? normalizedLines.slice(-COLLAPSED_FILE_LINES)\n : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n const hiddenLineCount = normalizedLines.length - visibleLines.length;\n // A live tail shows the file's end, so numbering starts where the tail does.\n const firstVisibleLineNumber = showLiveTail ? hiddenLineCount + 1 : 1;\n const numberWidth = gutterWidth(firstVisibleLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstVisibleLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const previewLines = showLiveTail\n ? [\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} earlier lines · live tail`)] : []),\n ...preview,\n ]\n : [\n ...preview,\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} more lines · ctrl+o expand`)] : []),\n ];\n return new DoomToolCall([`${heading} ${details}`, '', ...previewLines].join('\\n'));\n}\n\nexport function renderReadResult(\n args: ReadToolInput,\n result: TextToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const normalizedLines = textContent(result).split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n if (options.isError) {\n return new BuiltinToolContent(normalizedLines.map((line) => theme.fg('error', line)).join('\\n'));\n }\n\n const note = takeTrailingNote(normalizedLines);\n const visibleLines = options.expanded ? normalizedLines : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n // Read starts at `offset`, so the gutter has to agree with the file, not the excerpt.\n const firstLineNumber = args.offset ?? 1;\n const numberWidth = gutterWidth(firstLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const remaining = normalizedLines.length - visibleLines.length;\n if (remaining > 0) preview.push(theme.fg('muted', `… ${remaining} more lines · ctrl+o expand`));\n if (note !== undefined) preview.push(theme.fg('muted', note));\n return new BuiltinToolContent(preview.join('\\n'));\n}\n\nexport function renderGrepCall(args: GrepToolInput, theme: Theme): Component {\n return renderCall(\n 'grep',\n args.pattern,\n compactDetails([\n args.path ?? '.',\n args.glob,\n args.ignoreCase === true ? 'ignore case' : undefined,\n optionalCount(args.limit, 'matches'),\n ]),\n theme,\n );\n}\n\nexport function renderFindCall(args: FindToolInput, theme: Theme): Component {\n return renderCall(\n 'find',\n args.pattern,\n compactDetails([args.path ?? '.', optionalCount(args.limit, 'results')]),\n theme,\n );\n}\n\nexport function renderLsCall(args: LsToolInput, theme: Theme): Component {\n return renderCall('ls', args.path ?? '.', compactDetails([optionalCount(args.limit, 'entries')]), theme);\n}\n","import { definePiTool, type PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\nimport {\n createEditToolDefinition,\n createFindToolDefinition,\n createGrepToolDefinition,\n createLsToolDefinition,\n createReadToolDefinition,\n createWriteToolDefinition,\n} from '@earendil-works/pi-coding-agent';\n\nimport {\n frameBuiltinResult,\n previousBuiltinResult,\n renderEditCall,\n renderEditResult,\n renderFindCall,\n renderGrepCall,\n renderLsCall,\n renderReadCall,\n renderReadResult,\n renderWriteCall,\n} from './builtinToolRender';\n/**\n * Keep Pi's native schemas, prompt metadata, execution, and result formatting;\n * replace only the broad status-background shell and call heading.\n */\nexport function createBuiltinTools(cwd: string): PiToolDeclaration[] {\n const tools: PiToolDeclaration[] = [];\n const read = createReadToolDefinition(cwd);\n tools.push(\n definePiTool({\n ...read,\n execute: (...args: Parameters<typeof read.execute>) => createReadToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderReadCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = renderReadResult(\n context.args,\n result,\n { expanded: options.expanded, isError: context.isError },\n theme,\n );\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const edit = createEditToolDefinition(cwd);\n tools.push(\n definePiTool({\n ...edit,\n execute: (...args: Parameters<typeof edit.execute>) => createEditToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderEditCall(args, theme),\n // Doom bands the diff on the background and keeps syntax highlighting on\n // the foreground, which Pi's foreground-only diff renderer cannot express.\n renderResult: (result, options, theme, context) => {\n const content = renderEditResult(\n context.args,\n result,\n { expanded: options.expanded, isError: context.isError },\n theme,\n );\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const write = createWriteToolDefinition(cwd);\n const writeResult = write.renderResult!;\n tools.push(\n definePiTool({\n ...write,\n execute: (...args: Parameters<typeof write.execute>) => createWriteToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme, context) =>\n renderWriteCall(args, theme, {\n expanded: context.expanded,\n // Restored completed rows may not mark args complete, but their result is no longer partial.\n argsStreaming: context.argsComplete === false && context.isPartial,\n }),\n renderResult: (result, options, theme, context) => {\n const content = writeResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const grep = createGrepToolDefinition(cwd);\n const grepResult = grep.renderResult!;\n tools.push(\n definePiTool({\n ...grep,\n execute: (...args: Parameters<typeof grep.execute>) => createGrepToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderGrepCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = grepResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const find = createFindToolDefinition(cwd);\n const findResult = find.renderResult!;\n tools.push(\n definePiTool({\n ...find,\n execute: (...args: Parameters<typeof find.execute>) => createFindToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderFindCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = findResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n\n const ls = createLsToolDefinition(cwd);\n const lsResult = ls.renderResult!;\n tools.push(\n definePiTool({\n ...ls,\n execute: (...args: Parameters<typeof ls.execute>) => createLsToolDefinition(args[4].cwd).execute(...args),\n renderShell: 'self',\n renderCall: (args, theme) => renderLsCall(args, theme),\n renderResult: (result, options, theme, context) => {\n const content = lsResult(result, options, theme, {\n ...context,\n lastComponent: previousBuiltinResult(context.lastComponent),\n });\n return frameBuiltinResult(content, theme, context.lastComponent);\n },\n }),\n );\n return tools;\n}\n","/** How often the sampler asks to be woken. Short enough to catch a stall inside a single tool call. */\nconst SAMPLE_INTERVAL_MS = 250;\n/**\n * Below this, a late timer is ordinary scheduling jitter rather than something a\n * user would feel. Reporting every sample would cost more than it measures.\n */\nconst REPORT_THRESHOLD_MS = 250;\n\nexport interface EventLoopLagSampler {\n stop(): void;\n}\n\n/**\n * Reports how far behind schedule the event loop is running.\n *\n * A timer that wakes late is the only signal from inside the process that\n * something synchronous, garbage collection included, held the loop. Nothing in\n * a session transcript records it, so a stall here is otherwise invisible and\n * reads as a slow model or a slow tool.\n */\nexport function startEventLoopLagSampler(report: (lagMs: number) => void): EventLoopLagSampler {\n let expected = Date.now() + SAMPLE_INTERVAL_MS;\n const timer = setInterval(() => {\n const now = Date.now();\n const lagMs = now - expected;\n // Rebased on the wake that just happened rather than advanced by a fixed\n // step, so one long stall does not report itself again on every later tick.\n expected = now + SAMPLE_INTERVAL_MS;\n if (lagMs >= REPORT_THRESHOLD_MS) report(lagMs);\n }, SAMPLE_INTERVAL_MS);\n // A diagnostic must never be the reason a process refuses to exit.\n timer.unref();\n return {\n stop: () => {\n clearInterval(timer);\n },\n };\n}\n","import type {\n ConfigSection,\n DoomConfigActionInput,\n DoomConfigContributionHandle,\n DoomConfigContributionOptions,\n DoomConfigInvocation,\n DoomConfigSectionView,\n DoomExtensionContext,\n} from '@agimon-ai/doompi-core/config';\nimport type {\n DoomFooterContributionDefinition,\n DoomFooterContributionHandle,\n DoomFooterContributionValue,\n DoomFooterStatus,\n} from '@agimon-ai/doompi-core/footer';\nimport type { DoomLeaderActionHandlerOptions, LeaderBinding } from '@agimon-ai/doompi-core/leader';\nimport type { DoomUiHubService } from '@agimon-ai/doompi-core/uiHub';\n\nimport type { DoomLeaderDiagnostic, DoomLeaderRegistry } from '../leaderRegistry';\n\ntype Listener = () => void;\n\nfunction notify(listeners: ReadonlySet<Listener>): void {\n for (const listener of listeners) listener();\n}\n\nfunction copyBindings(bindings: readonly LeaderBinding[]): LeaderBinding[] {\n return bindings.map((binding) => ({\n ...binding,\n path: binding.path.map((segment) => ({ ...segment })) as [\n LeaderBinding['path'][number],\n ...LeaderBinding['path'][number][],\n ],\n ...('command' in binding ? { command: { ...binding.command } } : { action: { ...binding.action } }),\n }));\n}\n\nfunction copySections(sections: readonly ConfigSection[]): ConfigSection[] {\n return sections.map((section) => ({\n ...section,\n fields: section.fields.map((field) => ({\n ...field,\n ...(field.choices ? { choices: field.choices.map((choice) => ({ ...choice })) } : {}),\n ...(field.actions ? { actions: field.actions.map((action) => ({ ...action })) } : {}),\n ...(field.steps ? { steps: field.steps.map((step) => ({ ...step })) } : {}),\n ...(field.output ? { output: [...field.output] } : {}),\n })),\n }));\n}\n\ninterface ActiveFooterContribution {\n readonly token: symbol;\n readonly definition: DoomFooterContributionDefinition;\n value?: DoomFooterContributionValue;\n}\n\nexport class DoomUiFooterStore {\n private readonly contributions = new Map<string, ActiveFooterContribution>();\n private readonly listeners = new Set<Listener>();\n\n register(definition: DoomFooterContributionDefinition): DoomFooterContributionHandle {\n const token = Symbol(definition.source);\n const contribution: ActiveFooterContribution = { token, definition: { ...definition } };\n this.contributions.set(definition.source, contribution);\n notify(this.listeners);\n let disposed = false;\n return {\n update: (value) => {\n if (disposed || this.contributions.get(definition.source)?.token !== token) return;\n contribution.value = value\n ? {\n ...value,\n ...(value.fullSegments ? { fullSegments: value.fullSegments.map((segment) => ({ ...segment })) } : {}),\n ...(value.compactSegments\n ? { compactSegments: value.compactSegments.map((segment) => ({ ...segment })) }\n : {}),\n }\n : undefined;\n notify(this.listeners);\n },\n dispose: () => {\n if (disposed) return;\n disposed = true;\n if (this.contributions.get(definition.source)?.token !== token) return;\n this.contributions.delete(definition.source);\n notify(this.listeners);\n },\n };\n }\n\n getStatuses(): DoomFooterStatus[] {\n return [...this.contributions.values()]\n .flatMap(({ definition, value }) =>\n value\n ? [\n {\n source: definition.source,\n id: definition.id,\n order: definition.order,\n ...(definition.placement ? { placement: definition.placement } : {}),\n ...value,\n },\n ]\n : [],\n )\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.contributions.clear();\n notify(this.listeners);\n this.listeners.clear();\n }\n}\n\ninterface ActiveConfigContribution {\n readonly token: symbol;\n readonly options: DoomConfigContributionOptions<DoomExtensionContext>;\n}\n\nexport class DoomUiConfigStore {\n private readonly contributions = new Map<string, ActiveConfigContribution>();\n private readonly listeners = new Set<Listener>();\n\n constructor(private readonly getContext: () => DoomExtensionContext | undefined) {}\n\n register<ExtensionContext extends DoomExtensionContext>(\n options: DoomConfigContributionOptions<ExtensionContext>,\n ): DoomConfigContributionHandle {\n const token = Symbol(options.source);\n const contribution = {\n token,\n options: options as unknown as DoomConfigContributionOptions<DoomExtensionContext>,\n };\n this.contributions.set(options.source, contribution);\n notify(this.listeners);\n let disposed = false;\n return {\n update: () => {\n if (!disposed && this.contributions.get(options.source)?.token === token) notify(this.listeners);\n },\n dispose: () => {\n if (disposed) return;\n disposed = true;\n if (this.contributions.get(options.source)?.token !== token) return;\n this.contributions.delete(options.source);\n notify(this.listeners);\n },\n };\n }\n\n getSections(): DoomConfigSectionView[] {\n return [...this.contributions.values()]\n .flatMap(({ options }) => {\n try {\n return copySections(options.listSections()).map((section) => ({ source: options.source, ...section }));\n } catch (error) {\n const context = this.getContext();\n if (context) options.onError(error, 'listSections', context);\n return [];\n }\n })\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n invoke(invocation: DoomConfigInvocation): void {\n const active = this.contributions.get(invocation.source);\n const context = this.getContext();\n if (!active || !context) return;\n const handler = active.options.handlers[invocation.action];\n if (!handler) return;\n const input: DoomConfigActionInput = {\n ctx: context,\n sectionId: invocation.sectionId,\n fieldId: invocation.fieldId,\n ...(invocation.value === undefined ? {} : { value: invocation.value }),\n };\n void Promise.resolve(handler(input))\n .catch((error: unknown) => active.options.onError(error, invocation.action, context))\n .finally(() => {\n if (this.contributions.get(invocation.source)?.token === active.token) notify(this.listeners);\n });\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.contributions.clear();\n notify(this.listeners);\n this.listeners.clear();\n }\n}\n\nexport interface DoomUiHubController extends DoomUiHubService {\n readonly config: DoomUiConfigStore;\n readonly footer: DoomUiFooterStore;\n setContext(context: DoomExtensionContext | undefined): void;\n invokeLeaderAction(source: string, action: string): void;\n dispose(): void;\n}\n\nexport interface CreateDoomUiHubOptions {\n readonly leaderRegistry: DoomLeaderRegistry;\n readonly reportDiagnostics: (diagnostics: readonly DoomLeaderDiagnostic[]) => void;\n}\n\nexport function createDoomUiHub({ leaderRegistry, reportDiagnostics }: CreateDoomUiHubOptions): DoomUiHubController {\n let activeContext: DoomExtensionContext | undefined;\n const leaderGenerations = new Map<string, symbol>();\n const actionHandlers = new Map<\n string,\n { token: symbol; options: DoomLeaderActionHandlerOptions<DoomExtensionContext> }\n >();\n const footer = new DoomUiFooterStore();\n const config = new DoomUiConfigStore(() => activeContext);\n\n return {\n footer,\n config,\n registerLeader(contribution) {\n const token = Symbol(contribution.source);\n const publish = (bindings: readonly LeaderBinding[]): void => {\n const result = leaderRegistry.register({ source: contribution.source, bindings: copyBindings(bindings) });\n reportDiagnostics(result.diagnostics);\n };\n publish(contribution.bindings);\n leaderGenerations.set(contribution.source, token);\n let disposed = false;\n return {\n update(bindings) {\n if (disposed || leaderGenerations.get(contribution.source) !== token) return;\n publish(bindings);\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n if (leaderGenerations.get(contribution.source) !== token) return;\n leaderGenerations.delete(contribution.source);\n publish([]);\n },\n };\n },\n registerLeaderActions(options) {\n const token = Symbol(options.source);\n actionHandlers.set(options.source, {\n token,\n options: options as unknown as DoomLeaderActionHandlerOptions<DoomExtensionContext>,\n });\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n if (actionHandlers.get(options.source)?.token === token) actionHandlers.delete(options.source);\n };\n },\n registerFooter: (definition) => footer.register(definition),\n registerConfig: (options) => config.register(options),\n setContext(context) {\n activeContext = context;\n },\n invokeLeaderAction(source, action) {\n const context = activeContext;\n const active = actionHandlers.get(source);\n if (!context || !active) return;\n const handler = active.options.handlers[action];\n if (!handler) return;\n void Promise.resolve(handler(context)).catch((error: unknown) => active.options.onError(error, action, context));\n },\n dispose() {\n activeContext = undefined;\n actionHandlers.clear();\n leaderGenerations.clear();\n footer.dispose();\n config.dispose();\n },\n };\n}\n","import path from 'node:path';\n\nimport { readDoomMcpStatus } from '@agimon-ai/doompi-core/mcpStatus';\nimport { type DoomNotificationLevel, readDoomNotificationService } from '@agimon-ai/doompi-core/notification';\nimport type { PiEventHandlers } from '@agimon-ai/doompi-core/piExtension';\nimport { buildToolSources, type McpServerStatus } from '@agimon-ai/doompi-core/toolInventory';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext, ReadonlyFooterDataProvider } from '@earendil-works/pi-coding-agent';\n\nimport {\n LEADER_WIDGET_KEY,\n TUI_MODE,\n WIDGET_PLACEMENT,\n WARNING_STYLE,\n THEME_ENVIRONMENT_KEY,\n TOOLS_COMMAND,\n CONFIG_COMMAND,\n SESSION_START_EVENT,\n SESSION_MESSAGE_ENTRY,\n INPUT_EVENT,\n INTERACTIVE_INPUT_SOURCE,\n TITLE_MESSAGE_MAX_LENGTH,\n TITLE_PREFIX,\n BUILTIN_LEADER_COMMANDS,\n} from '../constants/ui';\nimport { DoomUiState, type LeaderSnapshot } from '../models/uiState';\nimport { type EventLoopLagSampler, startEventLoopLagSampler } from '../services/eventLoopLag';\nimport { extensionName, extensionPackageName, extensionToolSource } from '../services/extensionSource';\nimport { type DoomLeaderDiagnostic, DoomLeaderRegistry } from '../services/leaderRegistry';\nimport { UI_EVENT, type UiTelemetry } from '../services/telemetry';\nimport { createDoomUiHub } from '../services/uiHub';\nimport { openConfigOverlay } from './configOverlay';\nimport { DoomEditor } from './doomEditor';\nimport { DoomFooter } from './doomFooter';\nimport { DoomHeader } from './doomHeader';\nimport { LeaderHints } from './leaderHints';\nimport { DEFAULT_THEME_NAME } from './theme';\nimport { openToolsOverlay } from './toolsOverlay';\n\nfunction notify(cordis: Context, context: ExtensionContext, body: string, level: DoomNotificationLevel): void {\n const service = readDoomNotificationService(cordis);\n if (service) {\n try {\n void Promise.resolve(service.request({ body, level })).catch(() => undefined);\n } catch {\n // Notification delivery is best effort and does not fall back after routing.\n }\n return;\n }\n context.ui.notify(body, level);\n}\n\nfunction createMessageTitle(message: string, cwd: string): string | undefined {\n const normalizedMessage = message.trim().replace(/\\s+/g, ' ');\n if (!normalizedMessage) return undefined;\n const messageTitle = normalizedMessage.slice(0, TITLE_MESSAGE_MAX_LENGTH).trimEnd();\n return `${TITLE_PREFIX} · ${messageTitle} · ${path.basename(cwd) || cwd}`;\n}\n\ninterface UiPluginOptions {\n readonly pi: ExtensionAPI;\n readonly telemetry: UiTelemetry;\n}\n\nexport interface UiRuntime {\n readonly hub: ReturnType<typeof createDoomUiHub>;\n readonly uiState: DoomUiState;\n readonly commands: readonly (readonly [...Parameters<ExtensionAPI['registerCommand']>])[];\n readonly events: PiEventHandlers;\n dispose(): Promise<void>;\n}\n\nexport function createUiRuntime(cordis: Context, { pi, telemetry }: UiPluginOptions): UiRuntime {\n let disposed = false;\n const uiState = new DoomUiState();\n const leaderRegistry = new DoomLeaderRegistry();\n const pendingDiagnostics = new Set<string>();\n let footerData: ReadonlyFooterDataProvider | undefined;\n let activeContext: ExtensionContext | undefined;\n let sessionGeneration = 0;\n let hasSessionMessage = false;\n let lagSampler: EventLoopLagSampler | undefined;\n\n /**\n * Asks the MCP extension what it is currently connected to.\n *\n * No answer is a normal session: `--no-mcp` leaves nobody providing the query,\n * and the panel simply lists MCP tools under the extension that registered them.\n */\n const readMcpServers = (): readonly McpServerStatus[] | undefined => readDoomMcpStatus(cordis)?.getSnapshot().servers;\n\n const reportDiagnostics = (diagnostics: readonly DoomLeaderDiagnostic[]): void => {\n for (const diagnostic of diagnostics) {\n const binding = diagnostic.bindingId ? ` (${diagnostic.bindingId})` : '';\n const message = `Leader contribution from ${diagnostic.source}${binding}: ${diagnostic.message}`;\n if (pendingDiagnostics.has(message)) continue;\n pendingDiagnostics.add(message);\n // A rejected contribution silently drops another extension's keybindings,\n // and the notice below only reaches a run that has a TUI attached.\n void telemetry.recordWarning(UI_EVENT.leaderContributionRejected, diagnostic.message, {\n 'leader.source': diagnostic.source,\n ...(diagnostic.bindingId ? { 'leader.binding.id': diagnostic.bindingId } : {}),\n });\n if (activeContext?.mode === TUI_MODE) notify(cordis, activeContext, message, WARNING_STYLE);\n }\n };\n\n const hub = createDoomUiHub({ leaderRegistry, reportDiagnostics });\n return {\n hub,\n uiState,\n async dispose() {\n if (disposed) return;\n disposed = true;\n const context = activeContext;\n ++sessionGeneration;\n activeContext = undefined;\n hub.setContext(undefined);\n footerData = undefined;\n lagSampler?.stop();\n lagSampler = undefined;\n hub.dispose();\n uiState.reset();\n if (context?.mode === TUI_MODE) {\n context.ui.setWidget(LEADER_WIDGET_KEY, undefined, { placement: WIDGET_PLACEMENT });\n }\n await telemetry.shutdown();\n },\n commands: [\n [\n TOOLS_COMMAND,\n {\n description: 'Browse the tools available in this session',\n handler: async (_args, ctx) => {\n // Read at open time so a reconnected server or a plan-mode tool swap shows\n // up without restarting the session.\n const mcpServers = readMcpServers();\n const sources = buildToolSources({\n tools: pi.getAllTools(),\n activeTools: pi.getActiveTools(),\n ...(mcpServers ? { mcpServers } : {}),\n resolveExtensionName: extensionName,\n resolveExtensionPackageName: extensionPackageName,\n resolveExtensionToolSource: (toolName) => extensionToolSource(pi, toolName),\n });\n await openToolsOverlay(ctx, sources);\n },\n },\n ],\n\n [\n CONFIG_COMMAND,\n {\n description: 'Browse and change the settings extensions contribute',\n handler: async (_args, ctx) => {\n // The registry is passed live rather than snapshotted: a contributor can be\n // fetching or installing something while the panel is open, and that\n // progress is meant to land in it.\n await openConfigOverlay(ctx, hub.config);\n },\n },\n ],\n ],\n events: {\n [SESSION_START_EVENT]: (_event, ctx) => {\n activeContext = ctx;\n hub.setContext(ctx);\n const activeGeneration = ++sessionGeneration;\n reportDiagnostics(leaderRegistry.flush());\n hasSessionMessage = ctx.sessionManager.getEntries().some((entry) => entry.type === SESSION_MESSAGE_ENTRY);\n if (ctx.mode !== TUI_MODE) return;\n for (const message of pendingDiagnostics) notify(cordis, ctx, message, WARNING_STYLE);\n\n // A resumed or forked session runs this again, and two samplers would\n // double every report.\n lagSampler?.stop();\n lagSampler = startEventLoopLagSampler((lagMs) => {\n void telemetry.recordWarning(UI_EVENT.eventLoopStalled, `Event loop stalled for ${String(lagMs)}ms.`, {\n lag_ms: lagMs,\n });\n });\n\n const themeName = process.env[THEME_ENVIRONMENT_KEY] || DEFAULT_THEME_NAME;\n const themeResult = ctx.ui.setTheme(themeName);\n if (!themeResult.success) {\n notify(cordis, ctx, `Could not apply Doom Pi theme: ${themeResult.error}`, WARNING_STYLE);\n void telemetry.recordWarning(UI_EVENT.themeApplyFailed, themeResult.error ?? 'Unknown theme error', {\n 'ui.theme': themeName,\n });\n }\n\n ctx.ui.setTitle(`${TITLE_PREFIX} · ${path.basename(ctx.cwd) || ctx.cwd} · pi/coding`);\n ctx.ui.setHeader((tui, theme) => new DoomHeader(theme, ctx.cwd, undefined, ctx, () => tui.terminal.rows));\n ctx.ui.setFooter((tui, theme, data) => {\n footerData = data;\n return new DoomFooter(tui, theme, ctx, data, hub.footer, uiState);\n });\n ctx.ui.setEditorComponent(\n (tui, editorTheme, keybindings) =>\n new DoomEditor(\n tui,\n editorTheme,\n keybindings,\n uiState,\n (snapshot: LeaderSnapshot) => {\n if (!snapshot.active) {\n ctx.ui.setWidget(LEADER_WIDGET_KEY, undefined, { placement: WIDGET_PLACEMENT });\n return;\n }\n ctx.ui.setWidget(\n LEADER_WIDGET_KEY,\n (_widgetTui, widgetTheme) =>\n new LeaderHints(widgetTheme, snapshot, ctx, footerData, uiState.getModes()),\n { placement: WIDGET_PLACEMENT },\n );\n },\n undefined,\n ctx.ui.theme,\n {\n registry: leaderRegistry,\n isCommandAvailable: (commandName) =>\n BUILTIN_LEADER_COMMANDS.includes(commandName) ||\n pi.getCommands().some((command) => command.name === commandName),\n onLeaderAction: (source, action) => {\n if (activeContext !== ctx || sessionGeneration !== activeGeneration) {\n notify(cordis, ctx, `Leader action ${action} is unavailable.`, WARNING_STYLE);\n return;\n }\n hub.invokeLeaderAction(source, action);\n },\n onUnavailableCommand: (commandName) => {\n void telemetry.recordWarning(\n UI_EVENT.leaderCommandUnavailable,\n `Leader command /${commandName} is unavailable.`,\n { 'ui.kind': 'command' },\n );\n notify(cordis, ctx, `Leader command /${commandName} is unavailable.`, WARNING_STYLE);\n },\n onUnavailableAction: (action) => {\n void telemetry.recordWarning(\n UI_EVENT.leaderActionUnavailable,\n `Leader action ${action} is unavailable.`,\n {\n 'ui.kind': 'action',\n },\n );\n notify(cordis, ctx, `Leader action ${action} is unavailable.`, WARNING_STYLE);\n },\n },\n ),\n );\n\n void telemetry.recordEvent(UI_EVENT.shellInstalled, {\n 'ui.theme': themeName,\n 'ui.theme.applied': themeResult.success,\n 'ui.leader.group.count': leaderRegistry.getGroup([])?.options.length ?? 0,\n });\n },\n\n [INPUT_EVENT]: (event, ctx) => {\n if (ctx.mode !== TUI_MODE || event.source !== INTERACTIVE_INPUT_SOURCE || hasSessionMessage) return;\n hasSessionMessage = true;\n const title = createMessageTitle(event.text, ctx.cwd);\n if (title) ctx.ui.setTitle(title);\n },\n },\n };\n}\n","import { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\nimport { DOOM_UI_HUB_SERVICE } from '@agimon-ai/doompi-core/uiHub';\nimport {\n DOOM_MINOR_MODE_CATALOG_SERVICE,\n createMinorModeCatalogClient,\n requireMinorModeCatalog,\n} from '@agimon-ai/doompi-minor-mode';\n\nimport { projectMinorModeRecords } from '../../../../models/uiState';\nimport { createUiTelemetry, type UiTelemetry } from '../../../../services/telemetry';\nimport { createBuiltinTools } from '../../../../tui/builtinTools';\nimport { createUiRuntime } from '../../../../tui/uiRuntime';\nimport type { UiPiScope } from './_lib/piScope';\n\nexport default defineRoot(({ context, pi, options, runtime }: PiPluginContext<UiTelemetry>) => {\n if (!runtime) throw new Error('This Pi extension requires the Cordis runtime metadata.');\n const ui = createUiRuntime(context, { pi, telemetry: options ?? createUiTelemetry() });\n const tools = createBuiltinTools(process.cwd());\n const service = (owner: PiPluginContext['context']) => {\n owner.provide(DOOM_UI_HUB_SERVICE, ui.hub);\n owner.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const catalog = createMinorModeCatalogClient(requireMinorModeCatalog(modeContext));\n const update = (): void => ui.uiState.setModes(projectMinorModeRecords(catalog.list()));\n const unsubscribe = catalog.subscribe(update);\n update();\n return () => {\n unsubscribe();\n ui.uiState.setModes([]);\n };\n });\n };\n return {\n value: { ui, tools, runtime } satisfies UiPiScope,\n services: [service],\n onStop: () => ui.dispose(),\n onDispose: () => ui.dispose(),\n };\n});\n","import { defineCliCommand } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliCommand(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.commands[1],\n);\n","import { defineCliCommand } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliCommand(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.commands[0],\n);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliHook((context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.events.input!);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliHook(\n (context: WithRoot<PiPluginContext<unknown>, UiPiScope>) => context.root.ui.events.session_start!,\n);\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'edit');\n if (!tool) throw new Error('Missing built-in edit tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'find');\n if (!tool) throw new Error('Missing built-in find tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'grep');\n if (!tool) throw new Error('Missing built-in grep tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'ls');\n if (!tool) throw new Error('Missing built-in ls tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'read');\n if (!tool) throw new Error('Missing built-in read tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","import { defineCliTool } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext, PiToolDeclaration } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { UiPiScope } from '../_lib/piScope';\nexport default defineCliTool((context: WithRoot<PiPluginContext<unknown>, UiPiScope>): PiToolDeclaration => {\n const tool = context.root.tools.find((candidate) => candidate.name === 'write');\n if (!tool) throw new Error('Missing built-in write tool.');\n return { ...tool, overrides: context.root.runtime.mode !== 'composed' };\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, piToolContributions, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport commandConfig from '../src/extensions/workspaces/sessions/(backend)/command/config.cli';\nimport commandTools from '../src/extensions/workspaces/sessions/(backend)/command/tools.cli';\nimport hookInput from '../src/extensions/workspaces/sessions/(backend)/hook/input.cli';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli';\nimport toolEdit from '../src/extensions/workspaces/sessions/(backend)/tool/edit.cli';\nimport toolFind from '../src/extensions/workspaces/sessions/(backend)/tool/find.cli';\nimport toolGrep from '../src/extensions/workspaces/sessions/(backend)/tool/grep.cli';\nimport toolLs from '../src/extensions/workspaces/sessions/(backend)/tool/ls.cli';\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.cli';\nimport toolWrite from '../src/extensions/workspaces/sessions/(backend)/tool/write.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof commandConfig> | OptionsOf<typeof commandTools> | OptionsOf<typeof hookInput> | OptionsOf<typeof hookSessionStart> | OptionsOf<typeof toolEdit> | OptionsOf<typeof toolFind> | OptionsOf<typeof toolGrep> | OptionsOf<typeof toolLs> | OptionsOf<typeof toolRead> | OptionsOf<typeof toolWrite>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-ui', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get commands(): PiPluginContributions['commands'] { return [at(commandConfig, contextSession), at(commandTools, contextSession)]; },\n events: {\n input: at(hookInput, contextSession) as NonNullable<PiPluginContributions['events']>['input'],\n session_start: at(hookSessionStart, contextSession) as NonNullable<PiPluginContributions['events']>['session_start'],\n },\n ...piToolContributions('@agimon-ai/doompi-ui', [via({ name: 'edit' }, at(toolEdit, contextSession)), via({ name: 'find' }, at(toolFind, contextSession)), via({ name: 'grep' }, at(toolGrep, contextSession)), via({ name: 'ls' }, at(toolLs, contextSession)), via({ name: 'read' }, at(toolRead, contextSession)), via({ name: 'write' }, at(toolWrite, contextSession))]),\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,uBAAuB;;AAuB7B,IAAM,qBAAN,MAA8C;CACf;CAA7B,YAAY,MAA+B;EAAd,KAAA,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,GAAG,GAAGC,mBAAc,cAAc,CAAC;EAAG;EAClI,QAAQ;GACN,OAAO,GAAGC,mBAAW,cAAc;GACnC,eAAe,GAAGC,0BAAkB,cAAc;EACpD;EACA,GAAG,oBAAoB,wBAAwB;GAAC,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,KAAK,GAAG,GAAGC,gBAAQ,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,cAAc,CAAC;GAAG,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,mBAAW,cAAc,CAAC;EAAC,CAAC;EAC3W,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-ui",
3
- "version": "0.0.1-alpha.88",
3
+ "version": "0.0.1-alpha.89",
4
4
  "description": "Leader-key menus, themes, and TUI components for DoomPi and Pi extensions.",
5
5
  "keywords": [
6
6
  "ai",
@@ -170,19 +170,19 @@
170
170
  "access": "public"
171
171
  },
172
172
  "dependencies": {
173
- "@agimon-ai/doompi-core": "0.0.1-alpha.88",
174
- "@agimon-ai/doompi-hashline": "0.0.1-alpha.54",
175
- "@agimon-ai/doompi-minor-mode": "0.0.1-alpha.88",
176
- "@agimon-ai/doompi-telemetry": "0.0.1-alpha.82",
177
- "@agimon-ai/doompi-web-components": "0.0.1-alpha.46",
173
+ "@agimon-ai/doompi-core": "0.0.1-alpha.89",
174
+ "@agimon-ai/doompi-hashline": "0.0.1-alpha.55",
175
+ "@agimon-ai/doompi-minor-mode": "0.0.1-alpha.89",
176
+ "@agimon-ai/doompi-telemetry": "0.0.1-alpha.83",
177
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.47",
178
178
  "@deepseek-ai/cordis": "4.0.2",
179
179
  "@earendil-works/pi-tui": "0.87.1",
180
180
  "yaml": "2.9.1"
181
181
  },
182
182
  "devDependencies": {
183
- "@agimon-ai/doompi-build": "0.0.1-alpha.14",
184
- "@agimon-ai/doompi-core": "0.0.1-alpha.88",
185
- "@agimon-ai/doompi-web-components": "0.0.1-alpha.46",
183
+ "@agimon-ai/doompi-build": "0.0.1-alpha.15",
184
+ "@agimon-ai/doompi-core": "0.0.1-alpha.89",
185
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.47",
186
186
  "@earendil-works/pi-coding-agent": "0.87.1",
187
187
  "@tanstack/react-store": "0.11.1",
188
188
  "@tanstack/store": "0.11.1",
@@ -196,8 +196,8 @@
196
196
  "vitest": "5.0.1"
197
197
  },
198
198
  "peerDependencies": {
199
- "@agimon-ai/doompi-core": "0.0.1-alpha.88",
200
- "@agimon-ai/doompi-web-components": "0.0.1-alpha.46",
199
+ "@agimon-ai/doompi-core": "0.0.1-alpha.89",
200
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.47",
201
201
  "@earendil-works/pi-coding-agent": "0.87.1"
202
202
  },
203
203
  "peerDependenciesMeta": {