@agimon-ai/doompi-ui 0.0.1-alpha.39 → 0.0.1-alpha.40

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.
@@ -1,2 +1,2 @@
1
- const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../services/leader/leaderRegistry.cjs"),n=require("../../services/hub/uiHub.cjs"),r=require("../../services/state/uiState.cjs"),i=require("../../services/tools/toolInventory.cjs"),a=require("../../tui/configOverlay.cjs"),o=require("../../tui/doomEditor.cjs"),s=require("../../tui/doomFooter.cjs"),c=require("../../tui/doomHeader.cjs"),l=require("../../tui/leaderHints.cjs");require("../../tui/theme.cjs");const u=require("../../tui/toolsOverlay.cjs"),d=require("../telemetry/logSinkTelemetry.cjs"),f=require("./extensionName.cjs"),p=require("./toolOverrides.cjs");let m=require("node:path");m=e.__toESM(m,1);let h=require("@agimon-ai/doompi-extension-contracts/cordis-host"),g=require("@agimon-ai/doompi-extension-contracts/mcp-status"),_=require("@agimon-ai/doompi-extension-contracts/mode"),v=require("@agimon-ai/doompi-extension-contracts/ui-hub"),y=require("@agimon-ai/doompi-extension-contracts/tool-overrides");const b=`doom-pi-leader`,x=`belowEditor`,S=`warning`,C=`doom-pi`,w=new Set([`hotkeys`]),T=`@agimon-ai/doompi-ui`;function E(e,t){let n=e.trim().replace(/\s+/g,` `);if(!n)return;let r=n.slice(0,64).trimEnd();return`${C} · ${r} · ${m.default.basename(t)||t}`}function D(e,{pi:h,telemetry:D,hostMode:O}){e.inject([y.DOOM_TOOL_OVERRIDES_SERVICE],e=>{let t=(0,y.requireDoomToolOverrides)(e),n=[],r=e=>{if(O===`composed`)return!0;let r=t.claim({source:T,tools:[e]});return r.granted&&n.push(r),r.granted};try{p.registerBuiltinToolUi(h,process.cwd(),r)}catch(e){for(let e of n)e.dispose();throw e}return()=>{for(let e of n)e.dispose()}});let k=new r.DoomUiState,A=new t.DoomLeaderRegistry,j=new Set,M,N,P=0,F=!1,I=()=>(0,g.readDoomMcpStatus)(e)?.getSnapshot().servers;h.registerCommand(`tools`,{description:`Browse the tools available in this session`,handler:async(e,t)=>{let n=I(),r=i.buildToolSources({tools:h.getAllTools(),activeTools:h.getActiveTools(),...n?{mcpServers:n}:{},resolveExtensionName:f.extensionName,resolveExtensionToolSource:e=>f.extensionToolSource(h,e)});await u.openToolsOverlay(t,r)}}),h.registerCommand(`config`,{description:`Browse and change the settings extensions contribute`,handler:async(e,t)=>{await a.openConfigOverlay(t,R.config)}});let L=e=>{for(let t of e){let e=t.bindingId?` (${t.bindingId})`:``,n=`Leader contribution from ${t.source}${e}: ${t.message}`;j.has(n)||(j.add(n),D.recordWarning(d.UI_EVENT.leaderContributionRejected,t.message,{"leader.source":t.source,...t.bindingId?{"leader.binding.id":t.bindingId}:{}}),N?.mode===`tui`&&N.ui.notify(n,S))}},R=n.createDoomUiHub({leaderRegistry:A,reportDiagnostics:L});e.provide(v.DOOM_UI_HUB_SERVICE,R),e.inject([_.DOOM_MINOR_MODE_CATALOG_SERVICE],e=>{let t=(0,_.createMinorModeCatalogClient)((0,_.requireMinorModeCatalog)(e)),n=()=>k.setModes(r.projectMinorModeRecords(t.list())),i=t.subscribe(n);return n(),()=>{i(),k.setModes([])}}),h.on(`session_start`,(e,t)=>{N=t,R.setContext(t);let n=++P;if(L(A.flush()),F=t.sessionManager.getEntries().some(e=>e.type===`message`),t.mode!==`tui`)return;for(let e of j)t.ui.notify(e,S);let r=process.env.DOOMPI_THEME||`doom-pi-dark`,i=t.ui.setTheme(r);i.success||(t.ui.notify(`Could not apply Doom Pi theme: ${i.error}`,S),D.recordWarning(d.UI_EVENT.themeApplyFailed,i.error??`Unknown theme error`,{"ui.theme":r})),t.ui.setTitle(`${C} · ${m.default.basename(t.cwd)||t.cwd} · pi/coding`),t.ui.setHeader((e,n)=>new c.DoomHeader(n,t.cwd,void 0,t,()=>e.terminal.rows)),t.ui.setFooter((e,n,r)=>(M=r,new s.DoomFooter(e,n,t,r,R.footer,k))),t.ui.setEditorComponent((e,r,i)=>new o.DoomEditor(e,r,i,k,e=>{if(!e.active){t.ui.setWidget(b,void 0,{placement:x});return}t.ui.setWidget(b,(n,r)=>new l.LeaderHints(r,e,t,M,k.getModes()),{placement:x})},void 0,t.ui.theme,{registry:A,isCommandAvailable:e=>w.has(e)||h.getCommands().some(t=>t.name===e),onLeaderAction:(e,r)=>{if(N!==t||P!==n){t.ui.notify(`Leader action ${r} is unavailable.`,S);return}R.invokeLeaderAction(e,r)},onUnavailableCommand:e=>{D.recordWarning(d.UI_EVENT.leaderCommandUnavailable,`Leader command /${e} is unavailable.`,{"ui.kind":`command`}),t.ui.notify(`Leader command /${e} is unavailable.`,S)},onUnavailableAction:e=>{D.recordWarning(d.UI_EVENT.leaderActionUnavailable,`Leader action ${e} is unavailable.`,{"ui.kind":`action`}),t.ui.notify(`Leader action ${e} is unavailable.`,S)}})),D.recordEvent(d.UI_EVENT.shellInstalled,{"ui.theme":r,"ui.theme.applied":i.success,"ui.leader.group.count":A.getGroup([])?.options.length??0})}),h.on(`input`,(e,t)=>{if(t.mode!==`tui`||e.source!==`interactive`||F)return;F=!0;let n=E(e.text,t.cwd);n&&t.ui.setTitle(n)}),e.effect(()=>async()=>{let e=N;++P,N=void 0,R.setContext(void 0),M=void 0,R.dispose(),k.reset(),e?.mode===`tui`&&e.ui.setWidget(b,void 0,{placement:x}),await D.shutdown()},T)}async function O(e,t=d.createUiTelemetry()){let n=await(0,h.connectDoomCordisHost)(e,T),r=n.root.plugin(D,{pi:e,telemetry:t,hostMode:n.runtime.mode});try{await r}catch(e){try{await r.dispose()}finally{await n.dispose()}throw e}let i;e.on(`session_shutdown`,()=>i??=(async()=>{try{await r.dispose()}finally{await n.dispose()}})())}exports.doomPiUiExtension=O;
1
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../services/leader/leaderRegistry.cjs"),n=require("../../services/hub/uiHub.cjs"),r=require("../../services/state/uiState.cjs"),i=require("../../services/tools/toolInventory.cjs"),a=require("../../tui/configOverlay.cjs"),o=require("../../tui/doomEditor.cjs"),s=require("../../tui/doomFooter.cjs"),c=require("../../tui/doomHeader.cjs"),l=require("../../tui/leaderHints.cjs");require("../../tui/theme.cjs");const u=require("../../tui/toolsOverlay.cjs"),d=require("../telemetry/logSinkTelemetry.cjs"),f=require("./extensionName.cjs"),p=require("./toolOverrides.cjs");let m=require("node:path");m=e.__toESM(m,1);let h=require("@agimon-ai/doompi-extension-contracts/cordis-host"),g=require("@agimon-ai/doompi-extension-contracts/mcp-status"),_=require("@agimon-ai/doompi-extension-contracts/notification"),v=require("@agimon-ai/doompi-extension-contracts/mode"),y=require("@agimon-ai/doompi-extension-contracts/ui-hub"),b=require("@agimon-ai/doompi-extension-contracts/tool-overrides");const x=`doom-pi-leader`,S=`belowEditor`,C=`warning`,w=`doom-pi`,T=new Set([`hotkeys`]),E=`@agimon-ai/doompi-ui`;function D(e,t,n,r){let i=(0,_.readDoomNotificationService)(e);if(i){try{Promise.resolve(i.request({body:n,level:r})).catch(()=>void 0)}catch{}return}t.ui.notify(n,r)}function O(e,t){let n=e.trim().replace(/\s+/g,` `);if(!n)return;let r=n.slice(0,64).trimEnd();return`${w} · ${r} · ${m.default.basename(t)||t}`}function k(e,{pi:h,telemetry:_,hostMode:k}){e.inject([b.DOOM_TOOL_OVERRIDES_SERVICE],e=>{let t=(0,b.requireDoomToolOverrides)(e),n=[],r=e=>{if(k===`composed`)return!0;let r=t.claim({source:E,tools:[e]});return r.granted&&n.push(r),r.granted};try{p.registerBuiltinToolUi(h,process.cwd(),r)}catch(e){for(let e of n)e.dispose();throw e}return()=>{for(let e of n)e.dispose()}});let A=new r.DoomUiState,j=new t.DoomLeaderRegistry,M=new Set,N,P,F=0,I=!1,L=()=>(0,g.readDoomMcpStatus)(e)?.getSnapshot().servers;h.registerCommand(`tools`,{description:`Browse the tools available in this session`,handler:async(e,t)=>{let n=L(),r=i.buildToolSources({tools:h.getAllTools(),activeTools:h.getActiveTools(),...n?{mcpServers:n}:{},resolveExtensionName:f.extensionName,resolveExtensionToolSource:e=>f.extensionToolSource(h,e)});await u.openToolsOverlay(t,r)}}),h.registerCommand(`config`,{description:`Browse and change the settings extensions contribute`,handler:async(e,t)=>{await a.openConfigOverlay(t,z.config)}});let R=t=>{for(let n of t){let t=n.bindingId?` (${n.bindingId})`:``,r=`Leader contribution from ${n.source}${t}: ${n.message}`;M.has(r)||(M.add(r),_.recordWarning(d.UI_EVENT.leaderContributionRejected,n.message,{"leader.source":n.source,...n.bindingId?{"leader.binding.id":n.bindingId}:{}}),P?.mode===`tui`&&D(e,P,r,C))}},z=n.createDoomUiHub({leaderRegistry:j,reportDiagnostics:R});e.provide(y.DOOM_UI_HUB_SERVICE,z),e.inject([v.DOOM_MINOR_MODE_CATALOG_SERVICE],e=>{let t=(0,v.createMinorModeCatalogClient)((0,v.requireMinorModeCatalog)(e)),n=()=>A.setModes(r.projectMinorModeRecords(t.list())),i=t.subscribe(n);return n(),()=>{i(),A.setModes([])}}),h.on(`session_start`,(t,n)=>{P=n,z.setContext(n);let r=++F;if(R(j.flush()),I=n.sessionManager.getEntries().some(e=>e.type===`message`),n.mode!==`tui`)return;for(let t of M)D(e,n,t,C);let i=process.env.DOOMPI_THEME||`doom-pi-dark`,a=n.ui.setTheme(i);a.success||(D(e,n,`Could not apply Doom Pi theme: ${a.error}`,C),_.recordWarning(d.UI_EVENT.themeApplyFailed,a.error??`Unknown theme error`,{"ui.theme":i})),n.ui.setTitle(`${w} · ${m.default.basename(n.cwd)||n.cwd} · pi/coding`),n.ui.setHeader((e,t)=>new c.DoomHeader(t,n.cwd,void 0,n,()=>e.terminal.rows)),n.ui.setFooter((e,t,r)=>(N=r,new s.DoomFooter(e,t,n,r,z.footer,A))),n.ui.setEditorComponent((t,i,a)=>new o.DoomEditor(t,i,a,A,e=>{if(!e.active){n.ui.setWidget(x,void 0,{placement:S});return}n.ui.setWidget(x,(t,r)=>new l.LeaderHints(r,e,n,N,A.getModes()),{placement:S})},void 0,n.ui.theme,{registry:j,isCommandAvailable:e=>T.has(e)||h.getCommands().some(t=>t.name===e),onLeaderAction:(t,i)=>{if(P!==n||F!==r){D(e,n,`Leader action ${i} is unavailable.`,C);return}z.invokeLeaderAction(t,i)},onUnavailableCommand:t=>{_.recordWarning(d.UI_EVENT.leaderCommandUnavailable,`Leader command /${t} is unavailable.`,{"ui.kind":`command`}),D(e,n,`Leader command /${t} is unavailable.`,C)},onUnavailableAction:t=>{_.recordWarning(d.UI_EVENT.leaderActionUnavailable,`Leader action ${t} is unavailable.`,{"ui.kind":`action`}),D(e,n,`Leader action ${t} is unavailable.`,C)}})),_.recordEvent(d.UI_EVENT.shellInstalled,{"ui.theme":i,"ui.theme.applied":a.success,"ui.leader.group.count":j.getGroup([])?.options.length??0})}),h.on(`input`,(e,t)=>{if(t.mode!==`tui`||e.source!==`interactive`||I)return;I=!0;let n=O(e.text,t.cwd);n&&t.ui.setTitle(n)}),e.effect(()=>async()=>{let e=P;++F,P=void 0,z.setContext(void 0),N=void 0,z.dispose(),A.reset(),e?.mode===`tui`&&e.ui.setWidget(x,void 0,{placement:S}),await _.shutdown()},E)}async function A(e,t=d.createUiTelemetry()){let n=await(0,h.connectDoomCordisHost)(e,E),r=n.root.plugin(k,{pi:e,telemetry:t,hostMode:n.runtime.mode});try{await r}catch(e){try{await r.dispose()}finally{await n.dispose()}throw e}let i;e.on(`session_shutdown`,()=>i??=(async()=>{try{await r.dispose()}finally{await n.dispose()}})())}exports.doomPiUiExtension=A;
2
2
  //# sourceMappingURL=extension.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.cjs","names":["path","DOOM_TOOL_OVERRIDES_SERVICE","requireDoomToolOverrides","DoomUiState","DoomLeaderRegistry","readDoomMcpStatus","buildToolSources","extensionName","extensionToolSource","openToolsOverlay","openConfigOverlay","UI_EVENT","createDoomUiHub","DOOM_UI_HUB_SERVICE","DOOM_MINOR_MODE_CATALOG_SERVICE","createMinorModeCatalogClient","requireMinorModeCatalog","projectMinorModeRecords","DoomHeader","DoomFooter","DoomEditor","LeaderHints","createUiTelemetry","connectDoomCordisHost"],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import path from 'node:path';\nimport { connectDoomCordisHost, type DoomCordisHostMode } from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport { readDoomMcpStatus } from '@agimon-ai/doompi-extension-contracts/mcp-status';\nimport {\n DOOM_MINOR_MODE_CATALOG_SERVICE,\n createMinorModeCatalogClient,\n requireMinorModeCatalog,\n} from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport {\n DOOM_TOOL_OVERRIDES_SERVICE,\n type DoomToolOverrideRegistration,\n requireDoomToolOverrides,\n} from '@agimon-ai/doompi-extension-contracts/tool-overrides';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext, ReadonlyFooterDataProvider } from '@earendil-works/pi-coding-agent';\nimport { type DoomLeaderDiagnostic, DoomLeaderRegistry } from '../../services/leader/leaderRegistry.ts';\nimport { createDoomUiHub } from '../../services/hub/uiHub.ts';\nimport { DoomUiState, type LeaderSnapshot, projectMinorModeRecords } from '../../services/state/uiState.ts';\nimport { buildToolSources, type McpServerStatus } from '../../services/tools/toolInventory.ts';\nimport { openConfigOverlay } from '../../tui/configOverlay.ts';\nimport { DoomEditor } from '../../tui/doomEditor.ts';\nimport { DoomFooter } from '../../tui/doomFooter.ts';\nimport { DoomHeader } from '../../tui/doomHeader.ts';\nimport { LeaderHints } from '../../tui/leaderHints.ts';\nimport { DEFAULT_THEME_NAME } from '../../tui/theme.ts';\nimport { openToolsOverlay } from '../../tui/toolsOverlay.ts';\nimport { createUiTelemetry, UI_EVENT, type UiTelemetry } from '../telemetry/logSinkTelemetry.ts';\nimport { extensionName, extensionToolSource } from './extensionName.ts';\nimport { registerBuiltinToolUi } from './toolOverrides.ts';\n\nconst LEADER_WIDGET_KEY = 'doom-pi-leader';\nconst TUI_MODE = 'tui';\nconst WIDGET_PLACEMENT = 'belowEditor';\nconst WARNING_STYLE = 'warning';\nconst THEME_ENVIRONMENT_KEY = 'DOOMPI_THEME';\nconst HOTKEYS_COMMAND = 'hotkeys';\nconst TOOLS_COMMAND = 'tools';\nconst CONFIG_COMMAND = 'config';\nconst SESSION_START_EVENT = 'session_start';\nconst SESSION_MESSAGE_ENTRY = 'message';\nconst INPUT_EVENT = 'input';\nconst INTERACTIVE_INPUT_SOURCE = 'interactive';\nconst SESSION_SHUTDOWN_EVENT = 'session_shutdown';\nconst TITLE_MESSAGE_MAX_LENGTH = 64;\nconst TITLE_PREFIX = 'doom-pi';\nconst BUILTIN_LEADER_COMMANDS = new Set([HOTKEYS_COMMAND]);\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-ui';\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 readonly hostMode: DoomCordisHostMode;\n}\n\nfunction doomPiUiPlugin(cordis: Context, { pi, telemetry, hostMode }: UiPluginOptions): void {\n cordis.inject([DOOM_TOOL_OVERRIDES_SERVICE], (overridesContext) => {\n const toolOverrides = requireDoomToolOverrides(overridesContext);\n const registrations: DoomToolOverrideRegistration[] = [];\n const shouldRegister = (tool: string): boolean => {\n if (hostMode === 'composed') return true;\n const registration = toolOverrides.claim({ source: PACKAGE_SOURCE, tools: [tool] });\n if (registration.granted) registrations.push(registration);\n return registration.granted;\n };\n try {\n registerBuiltinToolUi(pi, process.cwd(), shouldRegister);\n } catch (error) {\n for (const registration of registrations) registration.dispose();\n throw error;\n }\n return () => {\n for (const registration of registrations) registration.dispose();\n };\n });\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\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 pi.registerCommand(TOOLS_COMMAND, {\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 resolveExtensionToolSource: (toolName) => extensionToolSource(pi, toolName),\n });\n await openToolsOverlay(ctx, sources);\n },\n });\n\n pi.registerCommand(CONFIG_COMMAND, {\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 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) activeContext.ui.notify(message, WARNING_STYLE);\n }\n };\n\n const hub = createDoomUiHub({ leaderRegistry, reportDiagnostics });\n cordis.provide(DOOM_UI_HUB_SERVICE, hub);\n cordis.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const catalog = createMinorModeCatalogClient(requireMinorModeCatalog(modeContext));\n const update = (): void => uiState.setModes(projectMinorModeRecords(catalog.list()));\n const dispose = catalog.subscribe(update);\n update();\n return () => {\n dispose();\n uiState.setModes([]);\n };\n });\n\n pi.on(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) ctx.ui.notify(message, WARNING_STYLE);\n\n const themeName = process.env[THEME_ENVIRONMENT_KEY] || DEFAULT_THEME_NAME;\n const themeResult = ctx.ui.setTheme(themeName);\n if (!themeResult.success) {\n ctx.ui.notify(`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) => 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.has(commandName) ||\n pi.getCommands().some((command) => command.name === commandName),\n onLeaderAction: (source, action) => {\n if (activeContext !== ctx || sessionGeneration !== activeGeneration) {\n ctx.ui.notify(`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 ctx.ui.notify(`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 ctx.ui.notify(`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 pi.on(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 cordis.effect(\n () => async () => {\n const context = activeContext;\n ++sessionGeneration;\n activeContext = undefined;\n hub.setContext(undefined);\n footerData = 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 PACKAGE_SOURCE,\n );\n}\n\n/** The package's standard Pi factory, mounted under the session Cordis host. */\nexport async function doomPiUiExtension(pi: ExtensionAPI, telemetry: UiTelemetry = createUiTelemetry()): Promise<void> {\n const connection = await connectDoomCordisHost(pi, PACKAGE_SOURCE);\n const fiber = connection.root.plugin(doomPiUiPlugin, { pi, telemetry, hostMode: connection.runtime.mode });\n try {\n await fiber;\n } catch (error) {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n throw error;\n }\n\n let disposal: Promise<void> | undefined;\n pi.on(\n SESSION_SHUTDOWN_EVENT,\n () =>\n (disposal ??= (async () => {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n })()),\n );\n}\n"],"mappings":"29BA+BA,MAAM,EAAoB,iBAEpB,EAAmB,cACnB,EAAgB,UAWhB,EAAe,UACf,EAA0B,IAAI,IAAI,CAAC,SAAe,CAAC,EACnD,EAAiB,uBAEvB,SAAS,EAAmB,EAAiB,EAAiC,CAC5E,IAAM,EAAoB,EAAQ,KAAK,CAAC,CAAC,QAAQ,OAAQ,GAAG,EAC5D,GAAI,CAAC,EAAmB,OACxB,IAAM,EAAe,EAAkB,MAAM,EAAG,EAAwB,CAAC,CAAC,QAAQ,EAClF,MAAO,GAAG,EAAa,KAAK,EAAa,KAAKA,EAAAA,QAAK,SAAS,CAAG,GAAK,GACtE,CAQA,SAAS,EAAe,EAAiB,CAAE,KAAI,YAAW,YAAmC,CAC3F,EAAO,OAAO,CAACC,EAAAA,2BAA2B,EAAI,GAAqB,CACjE,IAAM,GAAA,EAAgBC,EAAAA,yBAAAA,CAAyB,CAAgB,EACzD,EAAgD,CAAC,EACjD,EAAkB,GAA0B,CAChD,GAAI,IAAa,WAAY,MAAO,GACpC,IAAM,EAAe,EAAc,MAAM,CAAE,OAAQ,EAAgB,MAAO,CAAC,CAAI,CAAE,CA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AA,SAAS,eAAgB,CAClD,WAAY,EACZ,mBAAoB,EAAY,QAChC,wBAAyB,EAAe,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,QAAU,CAC1E,CAAC,CACH,CAAC,EAED,EAAG,GAAG,SAAc,EAAO,IAAQ,CACjC,GAAI,EAAI,OAAS,OAAY,EAAM,SAAW,eAA4B,EAAmB,OAC7F,EAAoB,GACpB,IAAM,EAAQ,EAAmB,EAAM,KAAM,EAAI,GAAG,EAChD,GAAO,EAAI,GAAG,SAAS,CAAK,CAClC,CAAC,EAED,EAAO,WACC,SAAY,CAChB,IAAM,EAAU,EAChB,EAAE,EACF,EAAgB,IAAA,GAChB,EAAI,WAAW,IAAA,EAAS,EACxB,EAAa,IAAA,GACb,EAAI,QAAQ,EACZ,EAAQ,MAAM,EACV,GAAS,OAAS,OACpB,EAAQ,GAAG,UAAU,EAAmB,IAAA,GAAW,CAAE,UAAW,CAAiB,CAAC,EAEpF,MAAM,EAAU,SAAS,CAC3B,EACA,CACF,CACF,CAGA,eAAsB,EAAkB,EAAkB,EAAyBW,EAAAA,kBAAkB,EAAkB,CACrH,IAAM,EAAa,MAAA,EAAMC,EAAAA,sBAAAA,CAAsB,EAAI,CAAc,EAC3D,EAAQ,EAAW,KAAK,OAAO,EAAgB,CAAE,KAAI,YAAW,SAAU,EAAW,QAAQ,IAAK,CAAC,EACzG,GAAI,CACF,MAAM,CACR,OAAS,EAAO,CACd,GAAI,CACF,MAAM,EAAM,QAAQ,CACtB,QAAU,CACR,MAAM,EAAW,QAAQ,CAC3B,CACA,MAAM,CACR,CAEA,IAAI,EACJ,EAAG,GACD,uBAEG,KAAc,SAAY,CACzB,GAAI,CACF,MAAM,EAAM,QAAQ,CACtB,QAAU,CACR,MAAM,EAAW,QAAQ,CAC3B,CACF,EAAA,CAAG,CACP,CACF"}
1
+ {"version":3,"file":"extension.cjs","names":["readDoomNotificationService","path","DOOM_TOOL_OVERRIDES_SERVICE","requireDoomToolOverrides","DoomUiState","DoomLeaderRegistry","readDoomMcpStatus","buildToolSources","extensionName","extensionToolSource","openToolsOverlay","openConfigOverlay","UI_EVENT","createDoomUiHub","DOOM_UI_HUB_SERVICE","DOOM_MINOR_MODE_CATALOG_SERVICE","createMinorModeCatalogClient","requireMinorModeCatalog","projectMinorModeRecords","DoomHeader","DoomFooter","DoomEditor","LeaderHints","createUiTelemetry","connectDoomCordisHost"],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import path from 'node:path';\nimport { connectDoomCordisHost, type DoomCordisHostMode } from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport { readDoomMcpStatus } from '@agimon-ai/doompi-extension-contracts/mcp-status';\nimport {\n type DoomNotificationLevel,\n readDoomNotificationService,\n} from '@agimon-ai/doompi-extension-contracts/notification';\nimport {\n DOOM_MINOR_MODE_CATALOG_SERVICE,\n createMinorModeCatalogClient,\n requireMinorModeCatalog,\n} from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport {\n DOOM_TOOL_OVERRIDES_SERVICE,\n type DoomToolOverrideRegistration,\n requireDoomToolOverrides,\n} from '@agimon-ai/doompi-extension-contracts/tool-overrides';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext, ReadonlyFooterDataProvider } from '@earendil-works/pi-coding-agent';\nimport { type DoomLeaderDiagnostic, DoomLeaderRegistry } from '../../services/leader/leaderRegistry.ts';\nimport { createDoomUiHub } from '../../services/hub/uiHub.ts';\nimport { DoomUiState, type LeaderSnapshot, projectMinorModeRecords } from '../../services/state/uiState.ts';\nimport { buildToolSources, type McpServerStatus } from '../../services/tools/toolInventory.ts';\nimport { openConfigOverlay } from '../../tui/configOverlay.ts';\nimport { DoomEditor } from '../../tui/doomEditor.ts';\nimport { DoomFooter } from '../../tui/doomFooter.ts';\nimport { DoomHeader } from '../../tui/doomHeader.ts';\nimport { LeaderHints } from '../../tui/leaderHints.ts';\nimport { DEFAULT_THEME_NAME } from '../../tui/theme.ts';\nimport { openToolsOverlay } from '../../tui/toolsOverlay.ts';\nimport { createUiTelemetry, UI_EVENT, type UiTelemetry } from '../telemetry/logSinkTelemetry.ts';\nimport { extensionName, extensionToolSource } from './extensionName.ts';\nimport { registerBuiltinToolUi } from './toolOverrides.ts';\n\nconst LEADER_WIDGET_KEY = 'doom-pi-leader';\nconst TUI_MODE = 'tui';\nconst WIDGET_PLACEMENT = 'belowEditor';\nconst WARNING_STYLE = 'warning';\nconst THEME_ENVIRONMENT_KEY = 'DOOMPI_THEME';\nconst HOTKEYS_COMMAND = 'hotkeys';\nconst TOOLS_COMMAND = 'tools';\nconst CONFIG_COMMAND = 'config';\nconst SESSION_START_EVENT = 'session_start';\nconst SESSION_MESSAGE_ENTRY = 'message';\nconst INPUT_EVENT = 'input';\nconst INTERACTIVE_INPUT_SOURCE = 'interactive';\nconst SESSION_SHUTDOWN_EVENT = 'session_shutdown';\nconst TITLE_MESSAGE_MAX_LENGTH = 64;\nconst TITLE_PREFIX = 'doom-pi';\nconst BUILTIN_LEADER_COMMANDS = new Set([HOTKEYS_COMMAND]);\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-ui';\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 readonly hostMode: DoomCordisHostMode;\n}\n\nfunction doomPiUiPlugin(cordis: Context, { pi, telemetry, hostMode }: UiPluginOptions): void {\n cordis.inject([DOOM_TOOL_OVERRIDES_SERVICE], (overridesContext) => {\n const toolOverrides = requireDoomToolOverrides(overridesContext);\n const registrations: DoomToolOverrideRegistration[] = [];\n const shouldRegister = (tool: string): boolean => {\n if (hostMode === 'composed') return true;\n const registration = toolOverrides.claim({ source: PACKAGE_SOURCE, tools: [tool] });\n if (registration.granted) registrations.push(registration);\n return registration.granted;\n };\n try {\n registerBuiltinToolUi(pi, process.cwd(), shouldRegister);\n } catch (error) {\n for (const registration of registrations) registration.dispose();\n throw error;\n }\n return () => {\n for (const registration of registrations) registration.dispose();\n };\n });\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\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 pi.registerCommand(TOOLS_COMMAND, {\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 resolveExtensionToolSource: (toolName) => extensionToolSource(pi, toolName),\n });\n await openToolsOverlay(ctx, sources);\n },\n });\n\n pi.registerCommand(CONFIG_COMMAND, {\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 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 cordis.provide(DOOM_UI_HUB_SERVICE, hub);\n cordis.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const catalog = createMinorModeCatalogClient(requireMinorModeCatalog(modeContext));\n const update = (): void => uiState.setModes(projectMinorModeRecords(catalog.list()));\n const dispose = catalog.subscribe(update);\n update();\n return () => {\n dispose();\n uiState.setModes([]);\n };\n });\n\n pi.on(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 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) => 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.has(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 pi.on(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 cordis.effect(\n () => async () => {\n const context = activeContext;\n ++sessionGeneration;\n activeContext = undefined;\n hub.setContext(undefined);\n footerData = 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 PACKAGE_SOURCE,\n );\n}\n\n/** The package's standard Pi factory, mounted under the session Cordis host. */\nexport async function doomPiUiExtension(pi: ExtensionAPI, telemetry: UiTelemetry = createUiTelemetry()): Promise<void> {\n const connection = await connectDoomCordisHost(pi, PACKAGE_SOURCE);\n const fiber = connection.root.plugin(doomPiUiPlugin, { pi, telemetry, hostMode: connection.runtime.mode });\n try {\n await fiber;\n } catch (error) {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n throw error;\n }\n\n let disposal: Promise<void> | undefined;\n pi.on(\n SESSION_SHUTDOWN_EVENT,\n () =>\n (disposal ??= (async () => {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n })()),\n );\n}\n"],"mappings":"2hCAmCA,MAAM,EAAoB,iBAEpB,EAAmB,cACnB,EAAgB,UAWhB,EAAe,UACf,EAA0B,IAAI,IAAI,CAAC,SAAe,CAAC,EACnD,EAAiB,uBAEvB,SAAS,EAAO,EAAiB,EAA2B,EAAc,EAAoC,CAC5G,IAAM,GAAA,EAAUA,EAAAA,4BAAAA,CAA4B,CAAM,EAClD,GAAI,EAAS,CACX,GAAI,CACF,QAA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AQ,MAAM,EACV,GAAS,OAAS,OACpB,EAAQ,GAAG,UAAU,EAAmB,IAAA,GAAW,CAAE,UAAW,CAAiB,CAAC,EAEpF,MAAM,EAAU,SAAS,CAC3B,EACA,CACF,CACF,CAGA,eAAsB,EAAkB,EAAkB,EAAyBW,EAAAA,kBAAkB,EAAkB,CACrH,IAAM,EAAa,MAAA,EAAMC,EAAAA,sBAAAA,CAAsB,EAAI,CAAc,EAC3D,EAAQ,EAAW,KAAK,OAAO,EAAgB,CAAE,KAAI,YAAW,SAAU,EAAW,QAAQ,IAAK,CAAC,EACzG,GAAI,CACF,MAAM,CACR,OAAS,EAAO,CACd,GAAI,CACF,MAAM,EAAM,QAAQ,CACtB,QAAU,CACR,MAAM,EAAW,QAAQ,CAC3B,CACA,MAAM,CACR,CAEA,IAAI,EACJ,EAAG,GACD,uBAEG,KAAc,SAAY,CACzB,GAAI,CACF,MAAM,EAAM,QAAQ,CACtB,QAAU,CACR,MAAM,EAAW,QAAQ,CAC3B,CACF,EAAA,CAAG,CACP,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBAyQsB,kBAAkB,IAAI,cAAc,YAAW,cAAoC"}
1
+ {"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBA0RsB,kBAAkB,IAAI,cAAc,YAAW,cAAoC"}
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBAyQsB,kBAAkB,IAAI,cAAc,YAAW,cAAoC"}
1
+ {"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBA0RsB,kBAAkB,IAAI,cAAc,YAAW,cAAoC"}
@@ -1,2 +1,2 @@
1
- import{DoomLeaderRegistry as e}from"../../services/leader/leaderRegistry.mjs";import{createDoomUiHub as t}from"../../services/hub/uiHub.mjs";import{DoomUiState as n,projectMinorModeRecords as r}from"../../services/state/uiState.mjs";import{buildToolSources as i}from"../../services/tools/toolInventory.mjs";import{openConfigOverlay as a}from"../../tui/configOverlay.mjs";import{DoomEditor as o}from"../../tui/doomEditor.mjs";import{DoomFooter as s}from"../../tui/doomFooter.mjs";import{DoomHeader as c}from"../../tui/doomHeader.mjs";import{LeaderHints as l}from"../../tui/leaderHints.mjs";import"../../tui/theme.mjs";import{openToolsOverlay as u}from"../../tui/toolsOverlay.mjs";import{UI_EVENT as d,createUiTelemetry as f}from"../telemetry/logSinkTelemetry.mjs";import{extensionName as p,extensionToolSource as m}from"./extensionName.mjs";import{registerBuiltinToolUi as h}from"./toolOverrides.mjs";import g from"node:path";import{connectDoomCordisHost as _}from"@agimon-ai/doompi-extension-contracts/cordis-host";import{readDoomMcpStatus as v}from"@agimon-ai/doompi-extension-contracts/mcp-status";import{DOOM_MINOR_MODE_CATALOG_SERVICE as y,createMinorModeCatalogClient as b,requireMinorModeCatalog as x}from"@agimon-ai/doompi-extension-contracts/mode";import{DOOM_UI_HUB_SERVICE as S}from"@agimon-ai/doompi-extension-contracts/ui-hub";import{DOOM_TOOL_OVERRIDES_SERVICE as C,requireDoomToolOverrides as w}from"@agimon-ai/doompi-extension-contracts/tool-overrides";const T=`doom-pi-leader`,E=`belowEditor`,D=`warning`,O=`doom-pi`,k=new Set([`hotkeys`]),A=`@agimon-ai/doompi-ui`;function j(e,t){let n=e.trim().replace(/\s+/g,` `);if(!n)return;let r=n.slice(0,64).trimEnd();return`${O} · ${r} · ${g.basename(t)||t}`}function M(f,{pi:_,telemetry:M,hostMode:N}){f.inject([C],e=>{let t=w(e),n=[],r=e=>{if(N===`composed`)return!0;let r=t.claim({source:A,tools:[e]});return r.granted&&n.push(r),r.granted};try{h(_,process.cwd(),r)}catch(e){for(let e of n)e.dispose();throw e}return()=>{for(let e of n)e.dispose()}});let P=new n,F=new e,I=new Set,L,R,z=0,B=!1,V=()=>v(f)?.getSnapshot().servers;_.registerCommand(`tools`,{description:`Browse the tools available in this session`,handler:async(e,t)=>{let n=V(),r=i({tools:_.getAllTools(),activeTools:_.getActiveTools(),...n?{mcpServers:n}:{},resolveExtensionName:p,resolveExtensionToolSource:e=>m(_,e)});await u(t,r)}}),_.registerCommand(`config`,{description:`Browse and change the settings extensions contribute`,handler:async(e,t)=>{await a(t,U.config)}});let H=e=>{for(let t of e){let e=t.bindingId?` (${t.bindingId})`:``,n=`Leader contribution from ${t.source}${e}: ${t.message}`;I.has(n)||(I.add(n),M.recordWarning(d.leaderContributionRejected,t.message,{"leader.source":t.source,...t.bindingId?{"leader.binding.id":t.bindingId}:{}}),R?.mode===`tui`&&R.ui.notify(n,D))}},U=t({leaderRegistry:F,reportDiagnostics:H});f.provide(S,U),f.inject([y],e=>{let t=b(x(e)),n=()=>P.setModes(r(t.list())),i=t.subscribe(n);return n(),()=>{i(),P.setModes([])}}),_.on(`session_start`,(e,t)=>{R=t,U.setContext(t);let n=++z;if(H(F.flush()),B=t.sessionManager.getEntries().some(e=>e.type===`message`),t.mode!==`tui`)return;for(let e of I)t.ui.notify(e,D);let r=process.env.DOOMPI_THEME||`doom-pi-dark`,i=t.ui.setTheme(r);i.success||(t.ui.notify(`Could not apply Doom Pi theme: ${i.error}`,D),M.recordWarning(d.themeApplyFailed,i.error??`Unknown theme error`,{"ui.theme":r})),t.ui.setTitle(`${O} · ${g.basename(t.cwd)||t.cwd} · pi/coding`),t.ui.setHeader((e,n)=>new c(n,t.cwd,void 0,t,()=>e.terminal.rows)),t.ui.setFooter((e,n,r)=>(L=r,new s(e,n,t,r,U.footer,P))),t.ui.setEditorComponent((e,r,i)=>new o(e,r,i,P,e=>{if(!e.active){t.ui.setWidget(T,void 0,{placement:E});return}t.ui.setWidget(T,(n,r)=>new l(r,e,t,L,P.getModes()),{placement:E})},void 0,t.ui.theme,{registry:F,isCommandAvailable:e=>k.has(e)||_.getCommands().some(t=>t.name===e),onLeaderAction:(e,r)=>{if(R!==t||z!==n){t.ui.notify(`Leader action ${r} is unavailable.`,D);return}U.invokeLeaderAction(e,r)},onUnavailableCommand:e=>{M.recordWarning(d.leaderCommandUnavailable,`Leader command /${e} is unavailable.`,{"ui.kind":`command`}),t.ui.notify(`Leader command /${e} is unavailable.`,D)},onUnavailableAction:e=>{M.recordWarning(d.leaderActionUnavailable,`Leader action ${e} is unavailable.`,{"ui.kind":`action`}),t.ui.notify(`Leader action ${e} is unavailable.`,D)}})),M.recordEvent(d.shellInstalled,{"ui.theme":r,"ui.theme.applied":i.success,"ui.leader.group.count":F.getGroup([])?.options.length??0})}),_.on(`input`,(e,t)=>{if(t.mode!==`tui`||e.source!==`interactive`||B)return;B=!0;let n=j(e.text,t.cwd);n&&t.ui.setTitle(n)}),f.effect(()=>async()=>{let e=R;++z,R=void 0,U.setContext(void 0),L=void 0,U.dispose(),P.reset(),e?.mode===`tui`&&e.ui.setWidget(T,void 0,{placement:E}),await M.shutdown()},A)}async function N(e,t=f()){let n=await _(e,A),r=n.root.plugin(M,{pi:e,telemetry:t,hostMode:n.runtime.mode});try{await r}catch(e){try{await r.dispose()}finally{await n.dispose()}throw e}let i;e.on(`session_shutdown`,()=>i??=(async()=>{try{await r.dispose()}finally{await n.dispose()}})())}export{N as doomPiUiExtension};
1
+ import{DoomLeaderRegistry as e}from"../../services/leader/leaderRegistry.mjs";import{createDoomUiHub as t}from"../../services/hub/uiHub.mjs";import{DoomUiState as n,projectMinorModeRecords as r}from"../../services/state/uiState.mjs";import{buildToolSources as i}from"../../services/tools/toolInventory.mjs";import{openConfigOverlay as a}from"../../tui/configOverlay.mjs";import{DoomEditor as o}from"../../tui/doomEditor.mjs";import{DoomFooter as s}from"../../tui/doomFooter.mjs";import{DoomHeader as c}from"../../tui/doomHeader.mjs";import{LeaderHints as l}from"../../tui/leaderHints.mjs";import"../../tui/theme.mjs";import{openToolsOverlay as u}from"../../tui/toolsOverlay.mjs";import{UI_EVENT as d,createUiTelemetry as f}from"../telemetry/logSinkTelemetry.mjs";import{extensionName as p,extensionToolSource as m}from"./extensionName.mjs";import{registerBuiltinToolUi as h}from"./toolOverrides.mjs";import g from"node:path";import{connectDoomCordisHost as _}from"@agimon-ai/doompi-extension-contracts/cordis-host";import{readDoomMcpStatus as v}from"@agimon-ai/doompi-extension-contracts/mcp-status";import{readDoomNotificationService as y}from"@agimon-ai/doompi-extension-contracts/notification";import{DOOM_MINOR_MODE_CATALOG_SERVICE as b,createMinorModeCatalogClient as x,requireMinorModeCatalog as S}from"@agimon-ai/doompi-extension-contracts/mode";import{DOOM_UI_HUB_SERVICE as C}from"@agimon-ai/doompi-extension-contracts/ui-hub";import{DOOM_TOOL_OVERRIDES_SERVICE as w,requireDoomToolOverrides as T}from"@agimon-ai/doompi-extension-contracts/tool-overrides";const E=`doom-pi-leader`,D=`belowEditor`,O=`warning`,k=`doom-pi`,A=new Set([`hotkeys`]),j=`@agimon-ai/doompi-ui`;function M(e,t,n,r){let i=y(e);if(i){try{Promise.resolve(i.request({body:n,level:r})).catch(()=>void 0)}catch{}return}t.ui.notify(n,r)}function N(e,t){let n=e.trim().replace(/\s+/g,` `);if(!n)return;let r=n.slice(0,64).trimEnd();return`${k} · ${r} · ${g.basename(t)||t}`}function P(f,{pi:_,telemetry:y,hostMode:P}){f.inject([w],e=>{let t=T(e),n=[],r=e=>{if(P===`composed`)return!0;let r=t.claim({source:j,tools:[e]});return r.granted&&n.push(r),r.granted};try{h(_,process.cwd(),r)}catch(e){for(let e of n)e.dispose();throw e}return()=>{for(let e of n)e.dispose()}});let F=new n,I=new e,L=new Set,R,z,B=0,V=!1,H=()=>v(f)?.getSnapshot().servers;_.registerCommand(`tools`,{description:`Browse the tools available in this session`,handler:async(e,t)=>{let n=H(),r=i({tools:_.getAllTools(),activeTools:_.getActiveTools(),...n?{mcpServers:n}:{},resolveExtensionName:p,resolveExtensionToolSource:e=>m(_,e)});await u(t,r)}}),_.registerCommand(`config`,{description:`Browse and change the settings extensions contribute`,handler:async(e,t)=>{await a(t,W.config)}});let U=e=>{for(let t of e){let e=t.bindingId?` (${t.bindingId})`:``,n=`Leader contribution from ${t.source}${e}: ${t.message}`;L.has(n)||(L.add(n),y.recordWarning(d.leaderContributionRejected,t.message,{"leader.source":t.source,...t.bindingId?{"leader.binding.id":t.bindingId}:{}}),z?.mode===`tui`&&M(f,z,n,O))}},W=t({leaderRegistry:I,reportDiagnostics:U});f.provide(C,W),f.inject([b],e=>{let t=x(S(e)),n=()=>F.setModes(r(t.list())),i=t.subscribe(n);return n(),()=>{i(),F.setModes([])}}),_.on(`session_start`,(e,t)=>{z=t,W.setContext(t);let n=++B;if(U(I.flush()),V=t.sessionManager.getEntries().some(e=>e.type===`message`),t.mode!==`tui`)return;for(let e of L)M(f,t,e,O);let r=process.env.DOOMPI_THEME||`doom-pi-dark`,i=t.ui.setTheme(r);i.success||(M(f,t,`Could not apply Doom Pi theme: ${i.error}`,O),y.recordWarning(d.themeApplyFailed,i.error??`Unknown theme error`,{"ui.theme":r})),t.ui.setTitle(`${k} · ${g.basename(t.cwd)||t.cwd} · pi/coding`),t.ui.setHeader((e,n)=>new c(n,t.cwd,void 0,t,()=>e.terminal.rows)),t.ui.setFooter((e,n,r)=>(R=r,new s(e,n,t,r,W.footer,F))),t.ui.setEditorComponent((e,r,i)=>new o(e,r,i,F,e=>{if(!e.active){t.ui.setWidget(E,void 0,{placement:D});return}t.ui.setWidget(E,(n,r)=>new l(r,e,t,R,F.getModes()),{placement:D})},void 0,t.ui.theme,{registry:I,isCommandAvailable:e=>A.has(e)||_.getCommands().some(t=>t.name===e),onLeaderAction:(e,r)=>{if(z!==t||B!==n){M(f,t,`Leader action ${r} is unavailable.`,O);return}W.invokeLeaderAction(e,r)},onUnavailableCommand:e=>{y.recordWarning(d.leaderCommandUnavailable,`Leader command /${e} is unavailable.`,{"ui.kind":`command`}),M(f,t,`Leader command /${e} is unavailable.`,O)},onUnavailableAction:e=>{y.recordWarning(d.leaderActionUnavailable,`Leader action ${e} is unavailable.`,{"ui.kind":`action`}),M(f,t,`Leader action ${e} is unavailable.`,O)}})),y.recordEvent(d.shellInstalled,{"ui.theme":r,"ui.theme.applied":i.success,"ui.leader.group.count":I.getGroup([])?.options.length??0})}),_.on(`input`,(e,t)=>{if(t.mode!==`tui`||e.source!==`interactive`||V)return;V=!0;let n=N(e.text,t.cwd);n&&t.ui.setTitle(n)}),f.effect(()=>async()=>{let e=z;++B,z=void 0,W.setContext(void 0),R=void 0,W.dispose(),F.reset(),e?.mode===`tui`&&e.ui.setWidget(E,void 0,{placement:D}),await y.shutdown()},j)}async function F(e,t=f()){let n=await _(e,j),r=n.root.plugin(P,{pi:e,telemetry:t,hostMode:n.runtime.mode});try{await r}catch(e){try{await r.dispose()}finally{await n.dispose()}throw e}let i;e.on(`session_shutdown`,()=>i??=(async()=>{try{await r.dispose()}finally{await n.dispose()}})())}export{F as doomPiUiExtension};
2
2
  //# sourceMappingURL=extension.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.mjs","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import path from 'node:path';\nimport { connectDoomCordisHost, type DoomCordisHostMode } from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport { readDoomMcpStatus } from '@agimon-ai/doompi-extension-contracts/mcp-status';\nimport {\n DOOM_MINOR_MODE_CATALOG_SERVICE,\n createMinorModeCatalogClient,\n requireMinorModeCatalog,\n} from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport {\n DOOM_TOOL_OVERRIDES_SERVICE,\n type DoomToolOverrideRegistration,\n requireDoomToolOverrides,\n} from '@agimon-ai/doompi-extension-contracts/tool-overrides';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext, ReadonlyFooterDataProvider } from '@earendil-works/pi-coding-agent';\nimport { type DoomLeaderDiagnostic, DoomLeaderRegistry } from '../../services/leader/leaderRegistry.ts';\nimport { createDoomUiHub } from '../../services/hub/uiHub.ts';\nimport { DoomUiState, type LeaderSnapshot, projectMinorModeRecords } from '../../services/state/uiState.ts';\nimport { buildToolSources, type McpServerStatus } from '../../services/tools/toolInventory.ts';\nimport { openConfigOverlay } from '../../tui/configOverlay.ts';\nimport { DoomEditor } from '../../tui/doomEditor.ts';\nimport { DoomFooter } from '../../tui/doomFooter.ts';\nimport { DoomHeader } from '../../tui/doomHeader.ts';\nimport { LeaderHints } from '../../tui/leaderHints.ts';\nimport { DEFAULT_THEME_NAME } from '../../tui/theme.ts';\nimport { openToolsOverlay } from '../../tui/toolsOverlay.ts';\nimport { createUiTelemetry, UI_EVENT, type UiTelemetry } from '../telemetry/logSinkTelemetry.ts';\nimport { extensionName, extensionToolSource } from './extensionName.ts';\nimport { registerBuiltinToolUi } from './toolOverrides.ts';\n\nconst LEADER_WIDGET_KEY = 'doom-pi-leader';\nconst TUI_MODE = 'tui';\nconst WIDGET_PLACEMENT = 'belowEditor';\nconst WARNING_STYLE = 'warning';\nconst THEME_ENVIRONMENT_KEY = 'DOOMPI_THEME';\nconst HOTKEYS_COMMAND = 'hotkeys';\nconst TOOLS_COMMAND = 'tools';\nconst CONFIG_COMMAND = 'config';\nconst SESSION_START_EVENT = 'session_start';\nconst SESSION_MESSAGE_ENTRY = 'message';\nconst INPUT_EVENT = 'input';\nconst INTERACTIVE_INPUT_SOURCE = 'interactive';\nconst SESSION_SHUTDOWN_EVENT = 'session_shutdown';\nconst TITLE_MESSAGE_MAX_LENGTH = 64;\nconst TITLE_PREFIX = 'doom-pi';\nconst BUILTIN_LEADER_COMMANDS = new Set([HOTKEYS_COMMAND]);\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-ui';\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 readonly hostMode: DoomCordisHostMode;\n}\n\nfunction doomPiUiPlugin(cordis: Context, { pi, telemetry, hostMode }: UiPluginOptions): void {\n cordis.inject([DOOM_TOOL_OVERRIDES_SERVICE], (overridesContext) => {\n const toolOverrides = requireDoomToolOverrides(overridesContext);\n const registrations: DoomToolOverrideRegistration[] = [];\n const shouldRegister = (tool: string): boolean => {\n if (hostMode === 'composed') return true;\n const registration = toolOverrides.claim({ source: PACKAGE_SOURCE, tools: [tool] });\n if (registration.granted) registrations.push(registration);\n return registration.granted;\n };\n try {\n registerBuiltinToolUi(pi, process.cwd(), shouldRegister);\n } catch (error) {\n for (const registration of registrations) registration.dispose();\n throw error;\n }\n return () => {\n for (const registration of registrations) registration.dispose();\n };\n });\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\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 pi.registerCommand(TOOLS_COMMAND, {\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 resolveExtensionToolSource: (toolName) => extensionToolSource(pi, toolName),\n });\n await openToolsOverlay(ctx, sources);\n },\n });\n\n pi.registerCommand(CONFIG_COMMAND, {\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 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) activeContext.ui.notify(message, WARNING_STYLE);\n }\n };\n\n const hub = createDoomUiHub({ leaderRegistry, reportDiagnostics });\n cordis.provide(DOOM_UI_HUB_SERVICE, hub);\n cordis.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const catalog = createMinorModeCatalogClient(requireMinorModeCatalog(modeContext));\n const update = (): void => uiState.setModes(projectMinorModeRecords(catalog.list()));\n const dispose = catalog.subscribe(update);\n update();\n return () => {\n dispose();\n uiState.setModes([]);\n };\n });\n\n pi.on(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) ctx.ui.notify(message, WARNING_STYLE);\n\n const themeName = process.env[THEME_ENVIRONMENT_KEY] || DEFAULT_THEME_NAME;\n const themeResult = ctx.ui.setTheme(themeName);\n if (!themeResult.success) {\n ctx.ui.notify(`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) => 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.has(commandName) ||\n pi.getCommands().some((command) => command.name === commandName),\n onLeaderAction: (source, action) => {\n if (activeContext !== ctx || sessionGeneration !== activeGeneration) {\n ctx.ui.notify(`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 ctx.ui.notify(`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 ctx.ui.notify(`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 pi.on(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 cordis.effect(\n () => async () => {\n const context = activeContext;\n ++sessionGeneration;\n activeContext = undefined;\n hub.setContext(undefined);\n footerData = 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 PACKAGE_SOURCE,\n );\n}\n\n/** The package's standard Pi factory, mounted under the session Cordis host. */\nexport async function doomPiUiExtension(pi: ExtensionAPI, telemetry: UiTelemetry = createUiTelemetry()): Promise<void> {\n const connection = await connectDoomCordisHost(pi, PACKAGE_SOURCE);\n const fiber = connection.root.plugin(doomPiUiPlugin, { pi, telemetry, hostMode: connection.runtime.mode });\n try {\n await fiber;\n } catch (error) {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n throw error;\n }\n\n let disposal: Promise<void> | undefined;\n pi.on(\n SESSION_SHUTDOWN_EVENT,\n () =>\n (disposal ??= (async () => {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n })()),\n );\n}\n"],"mappings":"47CA+BA,MAAM,EAAoB,iBAEpB,EAAmB,cACnB,EAAgB,UAWhB,EAAe,UACf,EAA0B,IAAI,IAAI,CAAC,SAAe,CAAC,EACnD,EAAiB,uBAEvB,SAAS,EAAmB,EAAiB,EAAiC,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SAAY,CACzB,GAAI,CACF,MAAM,EAAM,QAAQ,CACtB,QAAU,CACR,MAAM,EAAW,QAAQ,CAC3B,CACF,EAAA,CAAG,CACP,CACF"}
1
+ {"version":3,"file":"extension.mjs","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import path from 'node:path';\nimport { connectDoomCordisHost, type DoomCordisHostMode } from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport { readDoomMcpStatus } from '@agimon-ai/doompi-extension-contracts/mcp-status';\nimport {\n type DoomNotificationLevel,\n readDoomNotificationService,\n} from '@agimon-ai/doompi-extension-contracts/notification';\nimport {\n DOOM_MINOR_MODE_CATALOG_SERVICE,\n createMinorModeCatalogClient,\n requireMinorModeCatalog,\n} from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport {\n DOOM_TOOL_OVERRIDES_SERVICE,\n type DoomToolOverrideRegistration,\n requireDoomToolOverrides,\n} from '@agimon-ai/doompi-extension-contracts/tool-overrides';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext, ReadonlyFooterDataProvider } from '@earendil-works/pi-coding-agent';\nimport { type DoomLeaderDiagnostic, DoomLeaderRegistry } from '../../services/leader/leaderRegistry.ts';\nimport { createDoomUiHub } from '../../services/hub/uiHub.ts';\nimport { DoomUiState, type LeaderSnapshot, projectMinorModeRecords } from '../../services/state/uiState.ts';\nimport { buildToolSources, type McpServerStatus } from '../../services/tools/toolInventory.ts';\nimport { openConfigOverlay } from '../../tui/configOverlay.ts';\nimport { DoomEditor } from '../../tui/doomEditor.ts';\nimport { DoomFooter } from '../../tui/doomFooter.ts';\nimport { DoomHeader } from '../../tui/doomHeader.ts';\nimport { LeaderHints } from '../../tui/leaderHints.ts';\nimport { DEFAULT_THEME_NAME } from '../../tui/theme.ts';\nimport { openToolsOverlay } from '../../tui/toolsOverlay.ts';\nimport { createUiTelemetry, UI_EVENT, type UiTelemetry } from '../telemetry/logSinkTelemetry.ts';\nimport { extensionName, extensionToolSource } from './extensionName.ts';\nimport { registerBuiltinToolUi } from './toolOverrides.ts';\n\nconst LEADER_WIDGET_KEY = 'doom-pi-leader';\nconst TUI_MODE = 'tui';\nconst WIDGET_PLACEMENT = 'belowEditor';\nconst WARNING_STYLE = 'warning';\nconst THEME_ENVIRONMENT_KEY = 'DOOMPI_THEME';\nconst HOTKEYS_COMMAND = 'hotkeys';\nconst TOOLS_COMMAND = 'tools';\nconst CONFIG_COMMAND = 'config';\nconst SESSION_START_EVENT = 'session_start';\nconst SESSION_MESSAGE_ENTRY = 'message';\nconst INPUT_EVENT = 'input';\nconst INTERACTIVE_INPUT_SOURCE = 'interactive';\nconst SESSION_SHUTDOWN_EVENT = 'session_shutdown';\nconst TITLE_MESSAGE_MAX_LENGTH = 64;\nconst TITLE_PREFIX = 'doom-pi';\nconst BUILTIN_LEADER_COMMANDS = new Set([HOTKEYS_COMMAND]);\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-ui';\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 readonly hostMode: DoomCordisHostMode;\n}\n\nfunction doomPiUiPlugin(cordis: Context, { pi, telemetry, hostMode }: UiPluginOptions): void {\n cordis.inject([DOOM_TOOL_OVERRIDES_SERVICE], (overridesContext) => {\n const toolOverrides = requireDoomToolOverrides(overridesContext);\n const registrations: DoomToolOverrideRegistration[] = [];\n const shouldRegister = (tool: string): boolean => {\n if (hostMode === 'composed') return true;\n const registration = toolOverrides.claim({ source: PACKAGE_SOURCE, tools: [tool] });\n if (registration.granted) registrations.push(registration);\n return registration.granted;\n };\n try {\n registerBuiltinToolUi(pi, process.cwd(), shouldRegister);\n } catch (error) {\n for (const registration of registrations) registration.dispose();\n throw error;\n }\n return () => {\n for (const registration of registrations) registration.dispose();\n };\n });\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\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 pi.registerCommand(TOOLS_COMMAND, {\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 resolveExtensionToolSource: (toolName) => extensionToolSource(pi, toolName),\n });\n await openToolsOverlay(ctx, sources);\n },\n });\n\n pi.registerCommand(CONFIG_COMMAND, {\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 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 cordis.provide(DOOM_UI_HUB_SERVICE, hub);\n cordis.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const catalog = createMinorModeCatalogClient(requireMinorModeCatalog(modeContext));\n const update = (): void => uiState.setModes(projectMinorModeRecords(catalog.list()));\n const dispose = catalog.subscribe(update);\n update();\n return () => {\n dispose();\n uiState.setModes([]);\n };\n });\n\n pi.on(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 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) => 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.has(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 pi.on(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 cordis.effect(\n () => async () => {\n const context = activeContext;\n ++sessionGeneration;\n activeContext = undefined;\n hub.setContext(undefined);\n footerData = 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 PACKAGE_SOURCE,\n );\n}\n\n/** The package's standard Pi factory, mounted under the session Cordis host. */\nexport async function doomPiUiExtension(pi: ExtensionAPI, telemetry: UiTelemetry = createUiTelemetry()): Promise<void> {\n const connection = await connectDoomCordisHost(pi, PACKAGE_SOURCE);\n const fiber = connection.root.plugin(doomPiUiPlugin, { pi, telemetry, hostMode: connection.runtime.mode });\n try {\n await fiber;\n } catch (error) {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n throw error;\n }\n\n let disposal: Promise<void> | undefined;\n pi.on(\n SESSION_SHUTDOWN_EVENT,\n () =>\n (disposal ??= (async () => {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n })()),\n );\n}\n"],"mappings":"6hDAmCA,MAAM,EAAoB,iBAEpB,EAAmB,cACnB,EAAgB,UAWhB,EAAe,UACf,EAA0B,IAAI,IAAI,CAAC,SAAe,CAAC,EACnD,EAAiB,uBAEvB,SAAS,EAAO,EAAiB,EAA2B,EAAc,EAAoC,CAC5G,IAAM,EAAU,EAA4B,CAAM,EAClD,GAAI,EAAS,CACX,GAAI,CACF,QAAa,QAAQ,EAAQ,QAAQ,CAAE,OAAM,OAAM,CAAC,CAAC,CAAC,CAAC,UAAY,IAAA,EAAS,CAC9E,MAAQ,CAER,CACA,MACF,CACA,EAAQ,G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,QAAQ,CAC3B,CACA,MAAM,CACR,CAEA,IAAI,EACJ,EAAG,GACD,uBAEG,KAAc,SAAY,CACzB,GAAI,CACF,MAAM,EAAM,QAAQ,CACtB,QAAU,CACR,MAAM,EAAW,QAAQ,CAC3B,CACF,EAAA,CAAG,CACP,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-ui",
3
- "version": "0.0.1-alpha.39",
3
+ "version": "0.0.1-alpha.40",
4
4
  "description": "Leader-key menus, themes, and TUI components for DoomPi and Pi extensions.",
5
5
  "keywords": [
6
6
  "ai",
@@ -169,11 +169,11 @@
169
169
  "dependencies": {
170
170
  "@deepseek-ai/cordis": "4.0.1",
171
171
  "yaml": "2.9.0",
172
- "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.39",
173
- "@agimon-ai/doompi-hashline": "0.0.1-alpha.11",
174
- "@agimon-ai/doompi-telemetry": "0.0.1-alpha.39",
175
- "@agimon-ai/doompi-web-components": "0.0.1-alpha.0",
176
- "@agimon-ai/doompi-web-contracts": "0.0.1-alpha.2"
172
+ "@agimon-ai/doompi-telemetry": "0.0.1-alpha.40",
173
+ "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.40",
174
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.1",
175
+ "@agimon-ai/doompi-web-contracts": "0.0.1-alpha.3",
176
+ "@agimon-ai/doompi-hashline": "0.0.1-alpha.12"
177
177
  },
178
178
  "devDependencies": {
179
179
  "@earendil-works/pi-coding-agent": "0.84.3",