@agimon-ai/doompi-help 0.0.1-alpha.6 → 0.0.1-alpha.8

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.
Files changed (36) hide show
  1. package/README.md +7 -6
  2. package/dist/adapters/pi/extension.cjs +2 -0
  3. package/dist/adapters/pi/extension.cjs.map +1 -0
  4. package/dist/adapters/pi/extension.d.cts +11 -0
  5. package/dist/adapters/pi/extension.d.cts.map +1 -0
  6. package/dist/adapters/pi/extension.d.mts +11 -0
  7. package/dist/adapters/pi/extension.d.mts.map +1 -0
  8. package/dist/adapters/pi/extension.mjs +2 -0
  9. package/dist/adapters/pi/extension.mjs.map +1 -0
  10. package/dist/adapters/pi/helpCommand.cjs +2 -0
  11. package/dist/adapters/pi/helpCommand.cjs.map +1 -0
  12. package/dist/adapters/pi/helpCommand.mjs +2 -0
  13. package/dist/adapters/pi/helpCommand.mjs.map +1 -0
  14. package/dist/adapters/pi/helpMode.cjs +1 -1
  15. package/dist/adapters/pi/helpMode.cjs.map +1 -1
  16. package/dist/adapters/pi/helpMode.mjs +1 -1
  17. package/dist/adapters/pi/helpMode.mjs.map +1 -1
  18. package/dist/container/index.cjs.map +1 -1
  19. package/dist/container/index.mjs.map +1 -1
  20. package/dist/extensions/pi.cjs +1 -0
  21. package/dist/extensions/pi.d.cts +2 -0
  22. package/dist/extensions/pi.d.mts +2 -0
  23. package/dist/extensions/pi.mjs +1 -0
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.d.cts +2 -2
  26. package/dist/index.d.mts +2 -2
  27. package/dist/index.mjs +1 -1
  28. package/package.json +12 -8
  29. package/dist/extensions/doom.cjs +0 -2
  30. package/dist/extensions/doom.cjs.map +0 -1
  31. package/dist/extensions/doom.d.cts +0 -8
  32. package/dist/extensions/doom.d.cts.map +0 -1
  33. package/dist/extensions/doom.d.mts +0 -8
  34. package/dist/extensions/doom.d.mts.map +0 -1
  35. package/dist/extensions/doom.mjs +0 -2
  36. package/dist/extensions/doom.mjs.map +0 -1
package/README.md CHANGED
@@ -15,17 +15,18 @@ Help keeps extension documentation out of the default model context. Packages co
15
15
 
16
16
  ## Install
17
17
 
18
- DoomPi includes Help as a core parent capability. To load the package directly in Pi:
18
+ DoomPi includes Help in every parent and detached-child composition. No layer declaration is
19
+ required. To load the package directly in Pi:
19
20
 
20
21
  ```bash
21
22
  pi install npm:@agimon-ai/doompi-help
22
23
  ```
23
24
 
24
- The Pi entrypoint is `@agimon-ai/doompi-help/extensions/doom`.
25
+ The sole Pi entrypoint is `@agimon-ai/doompi-help/extensions/pi`; DoomPi and vanilla Pi execute the same factory.
25
26
 
26
27
  ## Activate and deactivate
27
28
 
28
- In an interactive DoomPi session, use `SPC h e`. Headless clients use the existing `minor_mode` protocol action.
29
+ In an interactive DoomPi session, use `SPC h e`. Headless DoomPi clients invoke the Help action through the shared minor-mode catalog service. In vanilla Pi, run `/doom-help`; the command does not require Doom config or Leader Space.
29
30
 
30
31
  Activation resolves each contributor in this order:
31
32
 
@@ -39,15 +40,15 @@ The package contributes `doompi-help`. Other packages, including Workflow and Co
39
40
 
40
41
  ## Parent and child behavior
41
42
 
42
- The DoomPi distribution assembles the Help host only in parent sessions and starts it inactive. Child sessions do not assemble the Help runtime. A custom plain-Pi host can load the extension directly, but must supply the lifecycle expected by its integration.
43
+ Parent and child sessions receive the same distribution-default factory. Each factory joins the runner-owned Cordis host and provides one `doom/help` service from the active session fiber. Session replacement retracts the old service, its contributions, and every injected UI or mode integration before the new generation becomes active.
43
44
 
44
45
  ## Public API
45
46
 
46
47
  ```ts
47
- import { activateHelpExtension, registerHelpExtension } from '@agimon-ai/doompi-help';
48
+ import { helpExtension, installHelpRuntime } from '@agimon-ai/doompi-help';
48
49
  ```
49
50
 
50
- The root export is intended for hosts and tests; ordinary users activate Help through the extension and mode protocol.
51
+ The root export is intended for hosts and tests; ordinary users activate Help through the extension and shared minor-mode service.
51
52
 
52
53
  ## Development
53
54
 
@@ -0,0 +1,2 @@
1
+ const e=require("./helpCommand.cjs"),t=require("./helpMode.cjs"),n=require("../../container/index.cjs");let r=require("@agimon-ai/doompi-extension-contracts/cordis-host"),i=require("@agimon-ai/doompi-extension-contracts/help"),a=require("@agimon-ai/doompi-extension-contracts/mode"),o=require("@agimon-ai/doompi-extension-contracts/ui-hub");const s=`@agimon-ai/doompi-help`;function c(c,l,u={}){let d;e.registerHelpCommand(l,()=>{if(!d)throw Error(`Doom Help is waiting for the active session service.`);return d}),c.inject([r.DOOM_CORDIS_SESSION_SERVICE],e=>{let c=e.get(r.DOOM_CORDIS_SESSION_SERVICE),l=(0,i.createDoomHelpService)(`${c.generation}:help`),f=l.register({source:s,moduleUrl:require("url").pathToFileURL(__filename).href,skills:[{name:`doompi-help`,description:`Use Doom Pi package Help safely, including activation, exact-version retrieval, and diagnostics.`}]}),p=n.createHelpRuntime(l,u);d=p.activation;try{e.provide(i.DOOM_HELP_SERVICE,l),e.inject([a.DOOM_MINOR_MODE_CATALOG_SERVICE],e=>{let n=t.registerHelpModeIntegration((0,a.requireMinorModeCatalog)(e),p.activation);return()=>n.dispose()}),e.inject([o.DOOM_UI_HUB_SERVICE],e=>t.registerHelpUiIntegration((0,o.requireDoomUiHub)(e),p.activation))}catch(e){throw d===p.activation&&(d=void 0),p.dispose(),f.dispose(),l.dispose(),e}return()=>{d===p.activation&&(d=void 0),p.dispose(),f.dispose(),l.dispose()}})}async function l(e){let t=await(0,r.connectDoomCordisHost)(e,s),n=t.root.plugin(u,{pi:e});try{await n}catch(e){try{await n.dispose()}finally{await t.dispose()}throw e}let i;e.on(`session_shutdown`,()=>i??=(async()=>{try{await n.dispose()}finally{await t.dispose()}})())}function u(e,t){c(e,t.pi)}exports.default=l,exports.helpExtension=l,exports.installHelpRuntime=c;
2
+ //# sourceMappingURL=extension.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.cjs","names":["DOOM_CORDIS_SESSION_SERVICE","createDoomHelpService","createHelpRuntime","DOOM_HELP_SERVICE","DOOM_MINOR_MODE_CATALOG_SERVICE","registerHelpModeIntegration","requireMinorModeCatalog","DOOM_UI_HUB_SERVICE","registerHelpUiIntegration","requireDoomUiHub","connectDoomCordisHost"],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import {\n connectDoomCordisHost,\n DOOM_CORDIS_SESSION_SERVICE,\n type DoomCordisSessionService,\n} from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport {\n createDoomHelpService,\n DOOM_HELP_SERVICE,\n type DoomHelpService,\n} from '@agimon-ai/doompi-extension-contracts/help';\nimport { DOOM_MINOR_MODE_CATALOG_SERVICE, requireMinorModeCatalog } from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE, requireDoomUiHub } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport { registerHelpCommand } from '../../adapters/pi/helpCommand.ts';\nimport { registerHelpModeIntegration, registerHelpUiIntegration } from '../../adapters/pi/helpMode.ts';\nimport { createHelpRuntime, type HelpRuntimeOptions } from '../../container/index.ts';\nimport type { HelpActivationService } from '../../types/help.ts';\n\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-help';\n\n/** Install Help resources into its host-owned Cordis plugin fiber. */\nexport function installHelpRuntime(cordis: Context, pi: ExtensionAPI, options: HelpRuntimeOptions = {}): void {\n let activeActivation: HelpActivationService | undefined;\n registerHelpCommand(pi, () => {\n if (!activeActivation) throw new Error('Doom Help is waiting for the active session service.');\n return activeActivation;\n });\n\n cordis.inject([DOOM_CORDIS_SESSION_SERVICE], (sessionContext) => {\n const session = sessionContext.get(DOOM_CORDIS_SESSION_SERVICE) as DoomCordisSessionService;\n const service: DoomHelpService = createDoomHelpService(`${session.generation}:help`);\n const selfContribution = service.register({\n source: PACKAGE_SOURCE,\n moduleUrl: import.meta.url,\n skills: [\n {\n name: 'doompi-help',\n description:\n 'Use Doom Pi package Help safely, including activation, exact-version retrieval, and diagnostics.',\n },\n ],\n });\n const runtime = createHelpRuntime(service, options);\n activeActivation = runtime.activation;\n try {\n sessionContext.provide(DOOM_HELP_SERVICE, service);\n sessionContext.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const mode = registerHelpModeIntegration(requireMinorModeCatalog(modeContext), runtime.activation);\n return () => mode.dispose();\n });\n sessionContext.inject([DOOM_UI_HUB_SERVICE], (uiContext) =>\n registerHelpUiIntegration(requireDoomUiHub(uiContext), runtime.activation),\n );\n } catch (error) {\n if (activeActivation === runtime.activation) activeActivation = undefined;\n runtime.dispose();\n selfContribution.dispose();\n service.dispose();\n throw error;\n }\n return () => {\n if (activeActivation === runtime.activation) activeActivation = undefined;\n runtime.dispose();\n selfContribution.dispose();\n service.dispose();\n };\n });\n}\n\n/** The package's single standard Pi factory, including optional typed Doom integrations. */\nexport async function helpExtension(pi: ExtensionAPI): Promise<void> {\n const connection = await connectDoomCordisHost(pi, PACKAGE_SOURCE);\n const fiber = connection.root.plugin(helpPlugin, { pi });\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 let disposal: Promise<void> | undefined;\n pi.on(\n 'session_shutdown',\n () =>\n (disposal ??= (async () => {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n })()),\n );\n}\n\ninterface HelpPluginConfig {\n readonly pi: ExtensionAPI;\n}\n\nfunction helpPlugin(cordis: Context, config: HelpPluginConfig): void {\n installHelpRuntime(cordis, config.pi);\n}\n\nexport default helpExtension;\n"],"mappings":"qVAmBA,MAAM,EAAiB,yBAGvB,SAAgB,EAAmB,EAAiB,EAAkB,EAA8B,CAAC,EAAS,CAC5G,IAAI,EACJ,EAAA,oBAAoB,MAAU,CAC5B,GAAI,CAAC,EAAkB,MAAU,MAAM,sDAAsD,EAC7F,OAAO,CACT,CAAC,EAED,EAAO,OAAO,CAACA,EAAAA,2BAA2B,EAA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,QAAQ,CAC3B,CACA,MAAM,CACR,CACA,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,CAMA,SAAS,EAAW,EAAiB,EAAgC,CACnE,EAAmB,EAAQ,EAAO,EAAE,CACtC"}
@@ -0,0 +1,11 @@
1
+ import { HelpRuntimeOptions } from "../../container/index.cjs";
2
+ import { Context } from "@deepseek-ai/cordis";
3
+ import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
4
+ //#region src/adapters/pi/extension.d.ts
5
+ /** Install Help resources into its host-owned Cordis plugin fiber. */
6
+ declare function installHelpRuntime(cordis: Context, pi: ExtensionAPI, options?: HelpRuntimeOptions): void;
7
+ /** The package's single standard Pi factory, including optional typed Doom integrations. */
8
+ declare function helpExtension(pi: ExtensionAPI): Promise<void>;
9
+ //#endregion
10
+ export { helpExtension as default, helpExtension, installHelpRuntime };
11
+ //# sourceMappingURL=extension.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;;iBAsBgB,mBAAmB,QAAQ,SAAS,IAAI,cAAc,UAAS;;iBAiDzD,cAAc,IAAI,eAAe"}
@@ -0,0 +1,11 @@
1
+ import { HelpRuntimeOptions } from "../../container/index.mjs";
2
+ import { Context } from "@deepseek-ai/cordis";
3
+ import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
4
+ //#region src/adapters/pi/extension.d.ts
5
+ /** Install Help resources into its host-owned Cordis plugin fiber. */
6
+ declare function installHelpRuntime(cordis: Context, pi: ExtensionAPI, options?: HelpRuntimeOptions): void;
7
+ /** The package's single standard Pi factory, including optional typed Doom integrations. */
8
+ declare function helpExtension(pi: ExtensionAPI): Promise<void>;
9
+ //#endregion
10
+ export { helpExtension as default, helpExtension, installHelpRuntime };
11
+ //# sourceMappingURL=extension.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;;iBAsBgB,mBAAmB,QAAQ,SAAS,IAAI,cAAc,UAAS;;iBAiDzD,cAAc,IAAI,eAAe"}
@@ -0,0 +1,2 @@
1
+ import{registerHelpCommand as e}from"./helpCommand.mjs";import{registerHelpModeIntegration as t,registerHelpUiIntegration as n}from"./helpMode.mjs";import{createHelpRuntime as r}from"../../container/index.mjs";import{DOOM_CORDIS_SESSION_SERVICE as i,connectDoomCordisHost as a}from"@agimon-ai/doompi-extension-contracts/cordis-host";import{DOOM_HELP_SERVICE as o,createDoomHelpService as s}from"@agimon-ai/doompi-extension-contracts/help";import{DOOM_MINOR_MODE_CATALOG_SERVICE as c,requireMinorModeCatalog as l}from"@agimon-ai/doompi-extension-contracts/mode";import{DOOM_UI_HUB_SERVICE as u,requireDoomUiHub as d}from"@agimon-ai/doompi-extension-contracts/ui-hub";const f=`@agimon-ai/doompi-help`;function p(a,p,m={}){let h;e(p,()=>{if(!h)throw Error(`Doom Help is waiting for the active session service.`);return h}),a.inject([i],e=>{let a=e.get(i),p=s(`${a.generation}:help`),g=p.register({source:f,moduleUrl:import.meta.url,skills:[{name:`doompi-help`,description:`Use Doom Pi package Help safely, including activation, exact-version retrieval, and diagnostics.`}]}),_=r(p,m);h=_.activation;try{e.provide(o,p),e.inject([c],e=>{let n=t(l(e),_.activation);return()=>n.dispose()}),e.inject([u],e=>n(d(e),_.activation))}catch(e){throw h===_.activation&&(h=void 0),_.dispose(),g.dispose(),p.dispose(),e}return()=>{h===_.activation&&(h=void 0),_.dispose(),g.dispose(),p.dispose()}})}async function m(e){let t=await a(e,f),n=t.root.plugin(h,{pi:e});try{await n}catch(e){try{await n.dispose()}finally{await t.dispose()}throw e}let r;e.on(`session_shutdown`,()=>r??=(async()=>{try{await n.dispose()}finally{await t.dispose()}})())}function h(e,t){p(e,t.pi)}export{m as default,m as helpExtension,p as installHelpRuntime};
2
+ //# sourceMappingURL=extension.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.mjs","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import {\n connectDoomCordisHost,\n DOOM_CORDIS_SESSION_SERVICE,\n type DoomCordisSessionService,\n} from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport {\n createDoomHelpService,\n DOOM_HELP_SERVICE,\n type DoomHelpService,\n} from '@agimon-ai/doompi-extension-contracts/help';\nimport { DOOM_MINOR_MODE_CATALOG_SERVICE, requireMinorModeCatalog } from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE, requireDoomUiHub } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport { registerHelpCommand } from '../../adapters/pi/helpCommand.ts';\nimport { registerHelpModeIntegration, registerHelpUiIntegration } from '../../adapters/pi/helpMode.ts';\nimport { createHelpRuntime, type HelpRuntimeOptions } from '../../container/index.ts';\nimport type { HelpActivationService } from '../../types/help.ts';\n\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-help';\n\n/** Install Help resources into its host-owned Cordis plugin fiber. */\nexport function installHelpRuntime(cordis: Context, pi: ExtensionAPI, options: HelpRuntimeOptions = {}): void {\n let activeActivation: HelpActivationService | undefined;\n registerHelpCommand(pi, () => {\n if (!activeActivation) throw new Error('Doom Help is waiting for the active session service.');\n return activeActivation;\n });\n\n cordis.inject([DOOM_CORDIS_SESSION_SERVICE], (sessionContext) => {\n const session = sessionContext.get(DOOM_CORDIS_SESSION_SERVICE) as DoomCordisSessionService;\n const service: DoomHelpService = createDoomHelpService(`${session.generation}:help`);\n const selfContribution = service.register({\n source: PACKAGE_SOURCE,\n moduleUrl: import.meta.url,\n skills: [\n {\n name: 'doompi-help',\n description:\n 'Use Doom Pi package Help safely, including activation, exact-version retrieval, and diagnostics.',\n },\n ],\n });\n const runtime = createHelpRuntime(service, options);\n activeActivation = runtime.activation;\n try {\n sessionContext.provide(DOOM_HELP_SERVICE, service);\n sessionContext.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) => {\n const mode = registerHelpModeIntegration(requireMinorModeCatalog(modeContext), runtime.activation);\n return () => mode.dispose();\n });\n sessionContext.inject([DOOM_UI_HUB_SERVICE], (uiContext) =>\n registerHelpUiIntegration(requireDoomUiHub(uiContext), runtime.activation),\n );\n } catch (error) {\n if (activeActivation === runtime.activation) activeActivation = undefined;\n runtime.dispose();\n selfContribution.dispose();\n service.dispose();\n throw error;\n }\n return () => {\n if (activeActivation === runtime.activation) activeActivation = undefined;\n runtime.dispose();\n selfContribution.dispose();\n service.dispose();\n };\n });\n}\n\n/** The package's single standard Pi factory, including optional typed Doom integrations. */\nexport async function helpExtension(pi: ExtensionAPI): Promise<void> {\n const connection = await connectDoomCordisHost(pi, PACKAGE_SOURCE);\n const fiber = connection.root.plugin(helpPlugin, { pi });\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 let disposal: Promise<void> | undefined;\n pi.on(\n 'session_shutdown',\n () =>\n (disposal ??= (async () => {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n })()),\n );\n}\n\ninterface HelpPluginConfig {\n readonly pi: ExtensionAPI;\n}\n\nfunction helpPlugin(cordis: Context, config: HelpPluginConfig): void {\n installHelpRuntime(cordis, config.pi);\n}\n\nexport default helpExtension;\n"],"mappings":"0pBAmBA,MAAM,EAAiB,yBAGvB,SAAgB,EAAmB,EAAiB,EAAkB,EAA8B,CAAC,EAAS,CAC5G,IAAI,EACJ,EAAoB,MAAU,CAC5B,GAAI,CAAC,EAAkB,MAAU,MAAM,sDAAsD,EAC7F,OAAO,CACT,CAAC,EAED,EAAO,OAAO,CAAC,CAA2B,EAAI,GAAmB,CAC/D,IAAM,EAAU,EAAe,I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,EAAO,EAAE,CACtC"}
@@ -0,0 +1,2 @@
1
+ const e=`doom-help`,t=`Toggle package Help guidance`;function n(n,r){n.registerCommand(e,{description:t,handler:async(e,t)=>{let n=r(),i=n.getState().activation===`inactive`?await n.activate():n.deactivate();if(!t.hasUI)return;let a=i.activation===`inactive`?`Package Help deactivated.`:`Package Help activated.`;t.ui.notify(a,i.activation===`degraded`?`warning`:`info`)}})}exports.HELP_COMMAND_DESCRIPTION=t,exports.HELP_COMMAND_NAME=e,exports.registerHelpCommand=n;
2
+ //# sourceMappingURL=helpCommand.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpCommand.cjs","names":[],"sources":["../../../src/adapters/pi/helpCommand.ts"],"sourcesContent":["import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport type { HelpActivationService } from '../../types/help.ts';\n\nexport const HELP_COMMAND_NAME = 'doom-help';\nexport const HELP_COMMAND_DESCRIPTION = 'Toggle package Help guidance';\n\nexport type RequireHelpActivation = () => HelpActivationService;\n\nexport function registerHelpCommand(\n pi: Pick<ExtensionAPI, 'registerCommand'>,\n requireActivation: RequireHelpActivation,\n): void {\n pi.registerCommand(HELP_COMMAND_NAME, {\n description: HELP_COMMAND_DESCRIPTION,\n handler: async (_arguments, context) => {\n const activation = requireActivation();\n const current = activation.getState();\n const next = current.activation === 'inactive' ? await activation.activate() : activation.deactivate();\n if (!context.hasUI) return;\n const message = next.activation === 'inactive' ? 'Package Help deactivated.' : 'Package Help activated.';\n context.ui.notify(message, next.activation === 'degraded' ? 'warning' : 'info');\n },\n });\n}\n"],"mappings":"AAGA,MAAa,EAAoB,YACpB,EAA2B,+BAIxC,SAAgB,EACd,EACA,EACM,CACN,EAAG,gBAAgB,EAAmB,CACpC,YAAa,EACb,QAAS,MAAO,EAAY,IAAY,CACtC,IAAM,EAAa,EAAkB,EAE/B,EADU,EAAW,SACR,CAAC,CAAC,aAAe,WAAa,MAAM,EAAW,SAAS,EAAI,EAAW,WAAW,EACrG,GAAI,CAAC,EAAQ,MAAO,OACpB,IAAM,EAAU,EAAK,aAAe,WAAa,4BAA8B,0BAC/E,EAAQ,GAAG,OAAO,EAAS,EAAK,aAAe,WAAa,UAAY,MAAM,CAChF,CACF,CAAC,CACH"}
@@ -0,0 +1,2 @@
1
+ const e=`doom-help`,t=`Toggle package Help guidance`;function n(n,r){n.registerCommand(e,{description:t,handler:async(e,t)=>{let n=r(),i=n.getState().activation===`inactive`?await n.activate():n.deactivate();if(!t.hasUI)return;let a=i.activation===`inactive`?`Package Help deactivated.`:`Package Help activated.`;t.ui.notify(a,i.activation===`degraded`?`warning`:`info`)}})}export{t as HELP_COMMAND_DESCRIPTION,e as HELP_COMMAND_NAME,n as registerHelpCommand};
2
+ //# sourceMappingURL=helpCommand.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpCommand.mjs","names":[],"sources":["../../../src/adapters/pi/helpCommand.ts"],"sourcesContent":["import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport type { HelpActivationService } from '../../types/help.ts';\n\nexport const HELP_COMMAND_NAME = 'doom-help';\nexport const HELP_COMMAND_DESCRIPTION = 'Toggle package Help guidance';\n\nexport type RequireHelpActivation = () => HelpActivationService;\n\nexport function registerHelpCommand(\n pi: Pick<ExtensionAPI, 'registerCommand'>,\n requireActivation: RequireHelpActivation,\n): void {\n pi.registerCommand(HELP_COMMAND_NAME, {\n description: HELP_COMMAND_DESCRIPTION,\n handler: async (_arguments, context) => {\n const activation = requireActivation();\n const current = activation.getState();\n const next = current.activation === 'inactive' ? await activation.activate() : activation.deactivate();\n if (!context.hasUI) return;\n const message = next.activation === 'inactive' ? 'Package Help deactivated.' : 'Package Help activated.';\n context.ui.notify(message, next.activation === 'degraded' ? 'warning' : 'info');\n },\n });\n}\n"],"mappings":"AAGA,MAAa,EAAoB,YACpB,EAA2B,+BAIxC,SAAgB,EACd,EACA,EACM,CACN,EAAG,gBAAgB,EAAmB,CACpC,YAAa,EACb,QAAS,MAAO,EAAY,IAAY,CACtC,IAAM,EAAa,EAAkB,EAE/B,EADU,EAAW,SACR,CAAC,CAAC,aAAe,WAAa,MAAM,EAAW,SAAS,EAAI,EAAW,WAAW,EACrG,GAAI,CAAC,EAAQ,MAAO,OACpB,IAAM,EAAU,EAAK,aAAe,WAAa,4BAA8B,0BAC/E,EAAQ,GAAG,OAAO,EAAS,EAAK,aAAe,WAAa,UAAY,MAAM,CAChF,CACF,CAAC,CACH"}
@@ -1,2 +1,2 @@
1
- let e=require("@agimon-ai/doompi-extension-contracts/leader"),t=require("@agimon-ai/doompi-extension-contracts/mode");const n=`@agimon-ai/doompi-help`,r=`help`,i=`help.toggle`,a={key:`h`,label:`help`,order:70},o=`activate`,s=`deactivate`;function c(e){return e.slice(0,160)}function l(e){if(e.activation===`activating`)return{activation:`activating`,condition:`queued`,detail:`loading package Help`,actions:[{id:o,enabled:!1,disabledReason:`Help activation is already running.`},{id:s,enabled:!0}]};if(e.activation===`active`||e.activation===`degraded`){let t=e.activation===`degraded`;return{activation:`active`,condition:t?`degraded`:`ready`,detail:c(`${e.skills.length} package Help skill${e.skills.length===1?``:`s`}`),...t?{color:`warning`}:{color:`accent`},actions:[{id:o,enabled:!1,disabledReason:`Help is already active.`},{id:s,enabled:!0}]}}let t=e.diagnostics[0]?.message;return{activation:`inactive`,condition:t?`failed`:`ready`,...t?{detail:c(t),color:`warning`}:{},actions:[{id:o,enabled:!0},{id:s,enabled:!1,disabledReason:`Help is not active.`}]}}function u(e){let t=e.activation!==`inactive`;return[{id:`help.toggle`,path:[a,t?{key:`e`,label:`exit`,detail:`hide package Help`}:{key:`e`,label:`enter`,detail:`load package Help`}],action:{name:i}}]}function d(e){queueMicrotask(()=>{throw e instanceof Error?e:Error(String(e))})}function f(a,f){let p=a,m=(0,t.registerMinorModeOwner)(p,{descriptor:{source:n,id:r,label:`Help`,description:`Activation-gated package guidance from exact installed package versions.`,order:50,actions:[{id:o,label:`Activate`,description:`Load package-owned Help indexes and expose their generated skills.`,contexts:[`tui`,`headless`],parameters:[]},{id:s,label:`Deactivate`,description:`Remove all active package Help skills immediately.`,contexts:[`tui`,`headless`],parameters:[]}]},initialState:l(f.getState()),async handleAction(e,t,n){if(e===o){let e=await f.activate(n.signal);return{message:c(`Activated ${e.skills.length} package Help skill${e.skills.length===1?``:`s`}${e.activation===`degraded`?` with diagnostics.`:`.`}`)}}if(e===s)return f.deactivate(),{message:`Package Help deactivated.`};throw Error(`Unknown Help mode action: ${e}`)},onError:d}),h=(0,e.createDoomLeaderContribution)(p,{source:n,bindings:u(f.getState())}),g=(0,e.registerDoomLeaderActionHandlers)(p,{source:n,handlers:{[i]:async e=>{f.getState().activation===`inactive`?await f.activate():f.deactivate(),e.hasUI&&e.ui.notify(f.getState().activation===`inactive`?`Package Help deactivated.`:`Package Help activated.`,`info`)}},onError:(e,t,n)=>{n.hasUI?n.ui.notify(e instanceof Error?e.message:String(e),`error`):d(e)}}),_=f.subscribe(e=>{m.publish(l(e)),h.update(u(e))}),v=!1;return{mode:m,dispose(){v||(v=!0,_(),g(),h.dispose(),m.dispose())}}}exports.HELP_LEADER_ACTION=i,exports.HELP_MODE_ID=r,exports.HELP_PACKAGE_SOURCE=n,exports.helpMinorModeState=l,exports.registerHelpModeIntegration=f;
1
+ let e=require("@agimon-ai/doompi-extension-contracts/mode");const t=`@agimon-ai/doompi-help`,n=`help`,r=`help.toggle`,i={key:`h`,label:`help`,order:70},a=`activate`,o=`deactivate`;function s(e){return e.slice(0,160)}function c(e){if(e.activation===`activating`)return{activation:`activating`,condition:`queued`,detail:`loading package Help`,actions:[{id:a,enabled:!1,disabledReason:`Help activation is already running.`},{id:o,enabled:!0}]};if(e.activation===`active`||e.activation===`degraded`){let t=e.activation===`degraded`;return{activation:`active`,condition:t?`degraded`:`ready`,detail:s(`${e.skills.length} package Help skill${e.skills.length===1?``:`s`}`),...t?{color:`warning`}:{color:`accent`},actions:[{id:a,enabled:!1,disabledReason:`Help is already active.`},{id:o,enabled:!0}]}}let t=e.diagnostics[0]?.message;return{activation:`inactive`,condition:t?`failed`:`ready`,...t?{detail:s(t),color:`warning`}:{},actions:[{id:a,enabled:!0},{id:o,enabled:!1,disabledReason:`Help is not active.`}]}}function l(e){let t=e.activation!==`inactive`;return[{id:`help.toggle`,path:[i,t?{key:`e`,label:`exit`,detail:`hide package Help`}:{key:`e`,label:`enter`,detail:`load package Help`}],action:{name:r}}]}function u(e){queueMicrotask(()=>{throw e instanceof Error?e:Error(String(e))})}function d(r,i){let l=(0,e.registerMinorModeOwner)(r,{descriptor:{source:t,id:n,label:`Help`,description:`Activation-gated package guidance from exact installed package versions.`,order:50,actions:[{id:a,label:`Activate`,description:`Load package-owned Help indexes and expose their generated skills.`,contexts:[`tui`,`headless`],parameters:[]},{id:o,label:`Deactivate`,description:`Remove all active package Help skills immediately.`,contexts:[`tui`,`headless`],parameters:[]}]},initialState:c(i.getState()),async handleAction(e,t,n){if(e===a){let e=await i.activate(n.signal);return{message:s(`Activated ${e.skills.length} package Help skill${e.skills.length===1?``:`s`}${e.activation===`degraded`?` with diagnostics.`:`.`}`)}}if(e===o)return i.deactivate(),{message:`Package Help deactivated.`};throw Error(`Unknown Help mode action: ${e}`)},onError:u}),d=i.subscribe(e=>l.publish(c(e))),f=!1;return{mode:l,dispose(){f||(f=!0,d(),l.dispose())}}}function f(e,n){let i=e.registerLeader({source:t,bindings:l(n.getState())}),a=e.registerLeaderActions({source:t,handlers:{[r]:async e=>{n.getState().activation===`inactive`?await n.activate():n.deactivate(),e.hasUI&&e.ui.notify(n.getState().activation===`inactive`?`Package Help deactivated.`:`Package Help activated.`,`info`)}},onError:(e,t,n)=>{n.hasUI?n.ui.notify(e instanceof Error?e.message:String(e),`error`):u(e)}}),o=n.subscribe(e=>i.update(l(e))),s=!1;return()=>{s||(s=!0,o(),a(),i.dispose())}}exports.HELP_LEADER_ACTION=r,exports.HELP_MODE_ID=n,exports.HELP_PACKAGE_SOURCE=t,exports.helpMinorModeState=c,exports.registerHelpModeIntegration=d,exports.registerHelpUiIntegration=f;
2
2
  //# sourceMappingURL=helpMode.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpMode.cjs","names":["registerMinorModeOwner","createDoomLeaderContribution","registerDoomLeaderActionHandlers"],"sources":["../../../src/adapters/pi/helpMode.ts"],"sourcesContent":["import type { DoomExtensionContext, DoomExtensionHost } from '@agimon-ai/doompi-extension-contracts/config';\nimport {\n createDoomLeaderContribution,\n type LeaderBinding,\n registerDoomLeaderActionHandlers,\n} from '@agimon-ai/doompi-extension-contracts/leader';\nimport {\n type MinorModeOwnerHandle,\n type MinorModeState,\n registerMinorModeOwner,\n} from '@agimon-ai/doompi-extension-contracts/mode';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport type { HelpActivationService, HelpRuntimeState } from '../../types/help.ts';\n\nexport const HELP_PACKAGE_SOURCE = '@agimon-ai/doompi-help';\nexport const HELP_MODE_ID = 'help';\nexport const HELP_MODE_ORDER = 50;\nexport const HELP_LEADER_ACTION = 'help.toggle';\n\nconst HELP_GROUP = { key: 'h', label: 'help', order: 70 } as const;\nconst MODE_ACTION_ACTIVATE = 'activate';\nconst MODE_ACTION_DEACTIVATE = 'deactivate';\nconst MAX_MODE_DETAIL_LENGTH = 160;\n\ntype HelpModeContext = ExtensionContext & DoomExtensionContext;\ntype HelpModeHost = DoomExtensionHost<HelpModeContext>;\n\nfunction boundedDetail(value: string): string {\n return value.slice(0, MAX_MODE_DETAIL_LENGTH);\n}\n\nexport function helpMinorModeState(state: HelpRuntimeState): MinorModeState {\n if (state.activation === 'activating') {\n return {\n activation: 'activating',\n condition: 'queued',\n detail: 'loading package Help',\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: false, disabledReason: 'Help activation is already running.' },\n { id: MODE_ACTION_DEACTIVATE, enabled: true },\n ],\n };\n }\n if (state.activation === 'active' || state.activation === 'degraded') {\n const degraded = state.activation === 'degraded';\n return {\n activation: 'active',\n condition: degraded ? 'degraded' : 'ready',\n detail: boundedDetail(`${state.skills.length} package Help skill${state.skills.length === 1 ? '' : 's'}`),\n ...(degraded ? { color: 'warning' as const } : { color: 'accent' as const }),\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: false, disabledReason: 'Help is already active.' },\n { id: MODE_ACTION_DEACTIVATE, enabled: true },\n ],\n };\n }\n const failure = state.diagnostics[0]?.message;\n return {\n activation: 'inactive',\n condition: failure ? 'failed' : 'ready',\n ...(failure ? { detail: boundedDetail(failure), color: 'warning' as const } : {}),\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: true },\n { id: MODE_ACTION_DEACTIVATE, enabled: false, disabledReason: 'Help is not active.' },\n ],\n };\n}\n\nfunction leaderBindings(state: HelpRuntimeState): LeaderBinding[] {\n const active = state.activation !== 'inactive';\n return [\n {\n id: 'help.toggle',\n path: [\n HELP_GROUP,\n active\n ? { key: 'e', label: 'exit', detail: 'hide package Help' }\n : { key: 'e', label: 'enter', detail: 'load package Help' },\n ],\n action: { name: HELP_LEADER_ACTION },\n },\n ];\n}\n\nfunction reportAsync(error: unknown): void {\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport interface HelpModeIntegration {\n mode: MinorModeOwnerHandle;\n dispose(): void;\n}\n\nexport function registerHelpModeIntegration(pi: ExtensionAPI, activation: HelpActivationService): HelpModeIntegration {\n const host = pi as unknown as HelpModeHost;\n const mode = registerMinorModeOwner(host, {\n descriptor: {\n source: HELP_PACKAGE_SOURCE,\n id: HELP_MODE_ID,\n label: 'Help',\n description: 'Activation-gated package guidance from exact installed package versions.',\n order: HELP_MODE_ORDER,\n actions: [\n {\n id: MODE_ACTION_ACTIVATE,\n label: 'Activate',\n description: 'Load package-owned Help indexes and expose their generated skills.',\n contexts: ['tui', 'headless'],\n parameters: [],\n },\n {\n id: MODE_ACTION_DEACTIVATE,\n label: 'Deactivate',\n description: 'Remove all active package Help skills immediately.',\n contexts: ['tui', 'headless'],\n parameters: [],\n },\n ],\n },\n initialState: helpMinorModeState(activation.getState()),\n async handleAction(actionId, _arguments, execution) {\n if (actionId === MODE_ACTION_ACTIVATE) {\n const state = await activation.activate(execution.signal);\n return {\n message: boundedDetail(\n `Activated ${state.skills.length} package Help skill${state.skills.length === 1 ? '' : 's'}${state.activation === 'degraded' ? ' with diagnostics.' : '.'}`,\n ),\n };\n }\n if (actionId === MODE_ACTION_DEACTIVATE) {\n activation.deactivate();\n return { message: 'Package Help deactivated.' };\n }\n throw new Error(`Unknown Help mode action: ${actionId}`);\n },\n onError: reportAsync,\n });\n const leader = createDoomLeaderContribution(host, {\n source: HELP_PACKAGE_SOURCE,\n bindings: leaderBindings(activation.getState()),\n });\n const actionDisposer = registerDoomLeaderActionHandlers(host, {\n source: HELP_PACKAGE_SOURCE,\n handlers: {\n [HELP_LEADER_ACTION]: async (context) => {\n const state = activation.getState();\n if (state.activation === 'inactive') await activation.activate();\n else activation.deactivate();\n if (context.hasUI) {\n context.ui.notify(\n activation.getState().activation === 'inactive' ? 'Package Help deactivated.' : 'Package Help activated.',\n 'info',\n );\n }\n },\n },\n onError: (error, _action, context) => {\n if (context.hasUI) context.ui.notify(error instanceof Error ? error.message : String(error), 'error');\n else reportAsync(error);\n },\n });\n const stateDisposer = activation.subscribe((state) => {\n mode.publish(helpMinorModeState(state));\n leader.update(leaderBindings(state));\n });\n let disposed = false;\n return {\n mode,\n dispose() {\n if (disposed) return;\n disposed = true;\n stateDisposer();\n actionDisposer();\n leader.dispose();\n mode.dispose();\n },\n };\n}\n"],"mappings":"sHAcA,MAAa,EAAsB,yBACtB,EAAe,OAEf,EAAqB,cAE5B,EAAa,CAAE,IAAK,IAAK,MAAO,OAAQ,MAAO,EAAG,EAClD,EAAuB,WACvB,EAAyB,aAM/B,SAAS,EAAc,EAAuB,CAC5C,OAAO,EAAM,MAAM,EAAG,GAAsB,CAC9C,CAEA,SAAgB,EAAmB,EAAyC,CAC1E,GAAI,EAAM,aAAe,aACvB,MAAO,CACL,WAAY,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,CAAK,EAAG,OAAO,EAC/F,EAAY,CAAK,CACxB,CACF,CAAC,EACK,EAAgB,EAAW,UAAW,GAAU,CACpD,EAAK,QAAQ,EAAmB,CAAK,CAAC,EACtC,EAAO,OAAO,EAAe,CAAK,CAAC,CACrC,CAAC,EACG,EAAW,GACf,MAAO,CACL,OACA,SAAU,CACJ,IACJ,EAAW,GACX,EAAc,EACd,EAAe,EACf,EAAO,QAAQ,EACf,EAAK,QAAQ,EACf,CACF,CACF"}
1
+ {"version":3,"file":"helpMode.cjs","names":["registerMinorModeOwner"],"sources":["../../../src/adapters/pi/helpMode.ts"],"sourcesContent":["import type { LeaderBinding } from '@agimon-ai/doompi-extension-contracts/leader';\nimport {\n type MinorModeCatalogService,\n type MinorModeOwnerHandle,\n type MinorModeState,\n registerMinorModeOwner,\n} from '@agimon-ai/doompi-extension-contracts/mode';\nimport type { DoomUiHubService } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport type { ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport type { HelpActivationService, HelpRuntimeState } from '../../types/help.ts';\n\nexport const HELP_PACKAGE_SOURCE = '@agimon-ai/doompi-help';\nexport const HELP_MODE_ID = 'help';\nexport const HELP_MODE_ORDER = 50;\nexport const HELP_LEADER_ACTION = 'help.toggle';\n\nconst HELP_GROUP = { key: 'h', label: 'help', order: 70 } as const;\nconst MODE_ACTION_ACTIVATE = 'activate';\nconst MODE_ACTION_DEACTIVATE = 'deactivate';\nconst MAX_MODE_DETAIL_LENGTH = 160;\n\nfunction boundedDetail(value: string): string {\n return value.slice(0, MAX_MODE_DETAIL_LENGTH);\n}\n\nexport function helpMinorModeState(state: HelpRuntimeState): MinorModeState {\n if (state.activation === 'activating') {\n return {\n activation: 'activating',\n condition: 'queued',\n detail: 'loading package Help',\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: false, disabledReason: 'Help activation is already running.' },\n { id: MODE_ACTION_DEACTIVATE, enabled: true },\n ],\n };\n }\n if (state.activation === 'active' || state.activation === 'degraded') {\n const degraded = state.activation === 'degraded';\n return {\n activation: 'active',\n condition: degraded ? 'degraded' : 'ready',\n detail: boundedDetail(`${state.skills.length} package Help skill${state.skills.length === 1 ? '' : 's'}`),\n ...(degraded ? { color: 'warning' as const } : { color: 'accent' as const }),\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: false, disabledReason: 'Help is already active.' },\n { id: MODE_ACTION_DEACTIVATE, enabled: true },\n ],\n };\n }\n const failure = state.diagnostics[0]?.message;\n return {\n activation: 'inactive',\n condition: failure ? 'failed' : 'ready',\n ...(failure ? { detail: boundedDetail(failure), color: 'warning' as const } : {}),\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: true },\n { id: MODE_ACTION_DEACTIVATE, enabled: false, disabledReason: 'Help is not active.' },\n ],\n };\n}\n\nfunction leaderBindings(state: HelpRuntimeState): LeaderBinding[] {\n const active = state.activation !== 'inactive';\n return [\n {\n id: 'help.toggle',\n path: [\n HELP_GROUP,\n active\n ? { key: 'e', label: 'exit', detail: 'hide package Help' }\n : { key: 'e', label: 'enter', detail: 'load package Help' },\n ],\n action: { name: HELP_LEADER_ACTION },\n },\n ];\n}\n\nfunction reportAsync(error: unknown): void {\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport interface HelpModeIntegration {\n mode: MinorModeOwnerHandle;\n dispose(): void;\n}\n\nexport function registerHelpModeIntegration(\n catalog: MinorModeCatalogService,\n activation: HelpActivationService,\n): HelpModeIntegration {\n const mode = registerMinorModeOwner<ExtensionContext>(catalog, {\n descriptor: {\n source: HELP_PACKAGE_SOURCE,\n id: HELP_MODE_ID,\n label: 'Help',\n description: 'Activation-gated package guidance from exact installed package versions.',\n order: HELP_MODE_ORDER,\n actions: [\n {\n id: MODE_ACTION_ACTIVATE,\n label: 'Activate',\n description: 'Load package-owned Help indexes and expose their generated skills.',\n contexts: ['tui', 'headless'],\n parameters: [],\n },\n {\n id: MODE_ACTION_DEACTIVATE,\n label: 'Deactivate',\n description: 'Remove all active package Help skills immediately.',\n contexts: ['tui', 'headless'],\n parameters: [],\n },\n ],\n },\n initialState: helpMinorModeState(activation.getState()),\n async handleAction(actionId, _arguments, execution) {\n if (actionId === MODE_ACTION_ACTIVATE) {\n const state = await activation.activate(execution.signal);\n return {\n message: boundedDetail(\n `Activated ${state.skills.length} package Help skill${state.skills.length === 1 ? '' : 's'}${state.activation === 'degraded' ? ' with diagnostics.' : '.'}`,\n ),\n };\n }\n if (actionId === MODE_ACTION_DEACTIVATE) {\n activation.deactivate();\n return { message: 'Package Help deactivated.' };\n }\n throw new Error(`Unknown Help mode action: ${actionId}`);\n },\n onError: reportAsync,\n });\n const stateDisposer = activation.subscribe((state) => mode.publish(helpMinorModeState(state)));\n let disposed = false;\n return {\n mode,\n dispose() {\n if (disposed) return;\n disposed = true;\n stateDisposer();\n mode.dispose();\n },\n };\n}\n\nexport function registerHelpUiIntegration(hub: DoomUiHubService, activation: HelpActivationService): () => void {\n const leader = hub.registerLeader({\n source: HELP_PACKAGE_SOURCE,\n bindings: leaderBindings(activation.getState()),\n });\n const actionDisposer = hub.registerLeaderActions<ExtensionContext>({\n source: HELP_PACKAGE_SOURCE,\n handlers: {\n [HELP_LEADER_ACTION]: async (context) => {\n const state = activation.getState();\n if (state.activation === 'inactive') await activation.activate();\n else activation.deactivate();\n if (context.hasUI) {\n context.ui.notify(\n activation.getState().activation === 'inactive' ? 'Package Help deactivated.' : 'Package Help activated.',\n 'info',\n );\n }\n },\n },\n onError: (error, _action, context) => {\n if (context.hasUI) context.ui.notify(error instanceof Error ? error.message : String(error), 'error');\n else reportAsync(error);\n },\n });\n const stateDisposer = activation.subscribe((state) => leader.update(leaderBindings(state)));\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n stateDisposer();\n actionDisposer();\n leader.dispose();\n };\n}\n"],"mappings":"4DAWA,MAAa,EAAsB,yBACtB,EAAe,OAEf,EAAqB,cAE5B,EAAa,CAAE,IAAK,IAAK,M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iB,EAAI,sBAAwC,CACjE,OAAQ,EACR,SAAU,EACP,GAAqB,KAAO,IAAY,CACzB,EAAW,SACjB,CAAC,CAAC,aAAe,WAAY,MAAM,EAAW,SAAS,EAC1D,EAAW,WAAW,EACvB,EAAQ,OACV,EAAQ,GAAG,OACT,EAAW,SAAS,CAAC,CAAC,aAAe,WAAa,4BAA8B,0BAChF,MACF,CAEJ,CACF,EACA,SAAU,EAAO,EAAS,IAAY,CAChC,EAAQ,MAAO,EAAQ,GAAG,OAAO,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EAAG,OAAO,EAC/F,EAAY,CAAK,CACxB,CACF,CAAC,EACK,EAAgB,EAAW,UAAW,GAAU,EAAO,OAAO,EAAe,CAAK,CAAC,CAAC,EACtF,EAAW,GACf,UAAa,CACP,IACJ,EAAW,GACX,EAAc,EACd,EAAe,EACf,EAAO,QAAQ,EACjB,CACF"}
@@ -1,2 +1,2 @@
1
- import{createDoomLeaderContribution as e,registerDoomLeaderActionHandlers as t}from"@agimon-ai/doompi-extension-contracts/leader";import{registerMinorModeOwner as n}from"@agimon-ai/doompi-extension-contracts/mode";const r=`@agimon-ai/doompi-help`,i=`help`,a=`help.toggle`,o={key:`h`,label:`help`,order:70},s=`activate`,c=`deactivate`;function l(e){return e.slice(0,160)}function u(e){if(e.activation===`activating`)return{activation:`activating`,condition:`queued`,detail:`loading package Help`,actions:[{id:s,enabled:!1,disabledReason:`Help activation is already running.`},{id:c,enabled:!0}]};if(e.activation===`active`||e.activation===`degraded`){let t=e.activation===`degraded`;return{activation:`active`,condition:t?`degraded`:`ready`,detail:l(`${e.skills.length} package Help skill${e.skills.length===1?``:`s`}`),...t?{color:`warning`}:{color:`accent`},actions:[{id:s,enabled:!1,disabledReason:`Help is already active.`},{id:c,enabled:!0}]}}let t=e.diagnostics[0]?.message;return{activation:`inactive`,condition:t?`failed`:`ready`,...t?{detail:l(t),color:`warning`}:{},actions:[{id:s,enabled:!0},{id:c,enabled:!1,disabledReason:`Help is not active.`}]}}function d(e){let t=e.activation!==`inactive`;return[{id:`help.toggle`,path:[o,t?{key:`e`,label:`exit`,detail:`hide package Help`}:{key:`e`,label:`enter`,detail:`load package Help`}],action:{name:a}}]}function f(e){queueMicrotask(()=>{throw e instanceof Error?e:Error(String(e))})}function p(o,p){let m=o,h=n(m,{descriptor:{source:r,id:i,label:`Help`,description:`Activation-gated package guidance from exact installed package versions.`,order:50,actions:[{id:s,label:`Activate`,description:`Load package-owned Help indexes and expose their generated skills.`,contexts:[`tui`,`headless`],parameters:[]},{id:c,label:`Deactivate`,description:`Remove all active package Help skills immediately.`,contexts:[`tui`,`headless`],parameters:[]}]},initialState:u(p.getState()),async handleAction(e,t,n){if(e===s){let e=await p.activate(n.signal);return{message:l(`Activated ${e.skills.length} package Help skill${e.skills.length===1?``:`s`}${e.activation===`degraded`?` with diagnostics.`:`.`}`)}}if(e===c)return p.deactivate(),{message:`Package Help deactivated.`};throw Error(`Unknown Help mode action: ${e}`)},onError:f}),g=e(m,{source:r,bindings:d(p.getState())}),_=t(m,{source:r,handlers:{[a]:async e=>{p.getState().activation===`inactive`?await p.activate():p.deactivate(),e.hasUI&&e.ui.notify(p.getState().activation===`inactive`?`Package Help deactivated.`:`Package Help activated.`,`info`)}},onError:(e,t,n)=>{n.hasUI?n.ui.notify(e instanceof Error?e.message:String(e),`error`):f(e)}}),v=p.subscribe(e=>{h.publish(u(e)),g.update(d(e))}),y=!1;return{mode:h,dispose(){y||(y=!0,v(),_(),g.dispose(),h.dispose())}}}export{a as HELP_LEADER_ACTION,i as HELP_MODE_ID,r as HELP_PACKAGE_SOURCE,u as helpMinorModeState,p as registerHelpModeIntegration};
1
+ import{registerMinorModeOwner as e}from"@agimon-ai/doompi-extension-contracts/mode";const t=`@agimon-ai/doompi-help`,n=`help`,r=`help.toggle`,i={key:`h`,label:`help`,order:70},a=`activate`,o=`deactivate`;function s(e){return e.slice(0,160)}function c(e){if(e.activation===`activating`)return{activation:`activating`,condition:`queued`,detail:`loading package Help`,actions:[{id:a,enabled:!1,disabledReason:`Help activation is already running.`},{id:o,enabled:!0}]};if(e.activation===`active`||e.activation===`degraded`){let t=e.activation===`degraded`;return{activation:`active`,condition:t?`degraded`:`ready`,detail:s(`${e.skills.length} package Help skill${e.skills.length===1?``:`s`}`),...t?{color:`warning`}:{color:`accent`},actions:[{id:a,enabled:!1,disabledReason:`Help is already active.`},{id:o,enabled:!0}]}}let t=e.diagnostics[0]?.message;return{activation:`inactive`,condition:t?`failed`:`ready`,...t?{detail:s(t),color:`warning`}:{},actions:[{id:a,enabled:!0},{id:o,enabled:!1,disabledReason:`Help is not active.`}]}}function l(e){let t=e.activation!==`inactive`;return[{id:`help.toggle`,path:[i,t?{key:`e`,label:`exit`,detail:`hide package Help`}:{key:`e`,label:`enter`,detail:`load package Help`}],action:{name:r}}]}function u(e){queueMicrotask(()=>{throw e instanceof Error?e:Error(String(e))})}function d(r,i){let l=e(r,{descriptor:{source:t,id:n,label:`Help`,description:`Activation-gated package guidance from exact installed package versions.`,order:50,actions:[{id:a,label:`Activate`,description:`Load package-owned Help indexes and expose their generated skills.`,contexts:[`tui`,`headless`],parameters:[]},{id:o,label:`Deactivate`,description:`Remove all active package Help skills immediately.`,contexts:[`tui`,`headless`],parameters:[]}]},initialState:c(i.getState()),async handleAction(e,t,n){if(e===a){let e=await i.activate(n.signal);return{message:s(`Activated ${e.skills.length} package Help skill${e.skills.length===1?``:`s`}${e.activation===`degraded`?` with diagnostics.`:`.`}`)}}if(e===o)return i.deactivate(),{message:`Package Help deactivated.`};throw Error(`Unknown Help mode action: ${e}`)},onError:u}),d=i.subscribe(e=>l.publish(c(e))),f=!1;return{mode:l,dispose(){f||(f=!0,d(),l.dispose())}}}function f(e,n){let i=e.registerLeader({source:t,bindings:l(n.getState())}),a=e.registerLeaderActions({source:t,handlers:{[r]:async e=>{n.getState().activation===`inactive`?await n.activate():n.deactivate(),e.hasUI&&e.ui.notify(n.getState().activation===`inactive`?`Package Help deactivated.`:`Package Help activated.`,`info`)}},onError:(e,t,n)=>{n.hasUI?n.ui.notify(e instanceof Error?e.message:String(e),`error`):u(e)}}),o=n.subscribe(e=>i.update(l(e))),s=!1;return()=>{s||(s=!0,o(),a(),i.dispose())}}export{r as HELP_LEADER_ACTION,n as HELP_MODE_ID,t as HELP_PACKAGE_SOURCE,c as helpMinorModeState,d as registerHelpModeIntegration,f as registerHelpUiIntegration};
2
2
  //# sourceMappingURL=helpMode.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpMode.mjs","names":[],"sources":["../../../src/adapters/pi/helpMode.ts"],"sourcesContent":["import type { DoomExtensionContext, DoomExtensionHost } from '@agimon-ai/doompi-extension-contracts/config';\nimport {\n createDoomLeaderContribution,\n type LeaderBinding,\n registerDoomLeaderActionHandlers,\n} from '@agimon-ai/doompi-extension-contracts/leader';\nimport {\n type MinorModeOwnerHandle,\n type MinorModeState,\n registerMinorModeOwner,\n} from '@agimon-ai/doompi-extension-contracts/mode';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport type { HelpActivationService, HelpRuntimeState } from '../../types/help.ts';\n\nexport const HELP_PACKAGE_SOURCE = '@agimon-ai/doompi-help';\nexport const HELP_MODE_ID = 'help';\nexport const HELP_MODE_ORDER = 50;\nexport const HELP_LEADER_ACTION = 'help.toggle';\n\nconst HELP_GROUP = { key: 'h', label: 'help', order: 70 } as const;\nconst MODE_ACTION_ACTIVATE = 'activate';\nconst MODE_ACTION_DEACTIVATE = 'deactivate';\nconst MAX_MODE_DETAIL_LENGTH = 160;\n\ntype HelpModeContext = ExtensionContext & DoomExtensionContext;\ntype HelpModeHost = DoomExtensionHost<HelpModeContext>;\n\nfunction boundedDetail(value: string): string {\n return value.slice(0, MAX_MODE_DETAIL_LENGTH);\n}\n\nexport function helpMinorModeState(state: HelpRuntimeState): MinorModeState {\n if (state.activation === 'activating') {\n return {\n activation: 'activating',\n condition: 'queued',\n detail: 'loading package Help',\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: false, disabledReason: 'Help activation is already running.' },\n { id: MODE_ACTION_DEACTIVATE, enabled: true },\n ],\n };\n }\n if (state.activation === 'active' || state.activation === 'degraded') {\n const degraded = state.activation === 'degraded';\n return {\n activation: 'active',\n condition: degraded ? 'degraded' : 'ready',\n detail: boundedDetail(`${state.skills.length} package Help skill${state.skills.length === 1 ? '' : 's'}`),\n ...(degraded ? { color: 'warning' as const } : { color: 'accent' as const }),\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: false, disabledReason: 'Help is already active.' },\n { id: MODE_ACTION_DEACTIVATE, enabled: true },\n ],\n };\n }\n const failure = state.diagnostics[0]?.message;\n return {\n activation: 'inactive',\n condition: failure ? 'failed' : 'ready',\n ...(failure ? { detail: boundedDetail(failure), color: 'warning' as const } : {}),\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: true },\n { id: MODE_ACTION_DEACTIVATE, enabled: false, disabledReason: 'Help is not active.' },\n ],\n };\n}\n\nfunction leaderBindings(state: HelpRuntimeState): LeaderBinding[] {\n const active = state.activation !== 'inactive';\n return [\n {\n id: 'help.toggle',\n path: [\n HELP_GROUP,\n active\n ? { key: 'e', label: 'exit', detail: 'hide package Help' }\n : { key: 'e', label: 'enter', detail: 'load package Help' },\n ],\n action: { name: HELP_LEADER_ACTION },\n },\n ];\n}\n\nfunction reportAsync(error: unknown): void {\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport interface HelpModeIntegration {\n mode: MinorModeOwnerHandle;\n dispose(): void;\n}\n\nexport function registerHelpModeIntegration(pi: ExtensionAPI, activation: HelpActivationService): HelpModeIntegration {\n const host = pi as unknown as HelpModeHost;\n const mode = registerMinorModeOwner(host, {\n descriptor: {\n source: HELP_PACKAGE_SOURCE,\n id: HELP_MODE_ID,\n label: 'Help',\n description: 'Activation-gated package guidance from exact installed package versions.',\n order: HELP_MODE_ORDER,\n actions: [\n {\n id: MODE_ACTION_ACTIVATE,\n label: 'Activate',\n description: 'Load package-owned Help indexes and expose their generated skills.',\n contexts: ['tui', 'headless'],\n parameters: [],\n },\n {\n id: MODE_ACTION_DEACTIVATE,\n label: 'Deactivate',\n description: 'Remove all active package Help skills immediately.',\n contexts: ['tui', 'headless'],\n parameters: [],\n },\n ],\n },\n initialState: helpMinorModeState(activation.getState()),\n async handleAction(actionId, _arguments, execution) {\n if (actionId === MODE_ACTION_ACTIVATE) {\n const state = await activation.activate(execution.signal);\n return {\n message: boundedDetail(\n `Activated ${state.skills.length} package Help skill${state.skills.length === 1 ? '' : 's'}${state.activation === 'degraded' ? ' with diagnostics.' : '.'}`,\n ),\n };\n }\n if (actionId === MODE_ACTION_DEACTIVATE) {\n activation.deactivate();\n return { message: 'Package Help deactivated.' };\n }\n throw new Error(`Unknown Help mode action: ${actionId}`);\n },\n onError: reportAsync,\n });\n const leader = createDoomLeaderContribution(host, {\n source: HELP_PACKAGE_SOURCE,\n bindings: leaderBindings(activation.getState()),\n });\n const actionDisposer = registerDoomLeaderActionHandlers(host, {\n source: HELP_PACKAGE_SOURCE,\n handlers: {\n [HELP_LEADER_ACTION]: async (context) => {\n const state = activation.getState();\n if (state.activation === 'inactive') await activation.activate();\n else activation.deactivate();\n if (context.hasUI) {\n context.ui.notify(\n activation.getState().activation === 'inactive' ? 'Package Help deactivated.' : 'Package Help activated.',\n 'info',\n );\n }\n },\n },\n onError: (error, _action, context) => {\n if (context.hasUI) context.ui.notify(error instanceof Error ? error.message : String(error), 'error');\n else reportAsync(error);\n },\n });\n const stateDisposer = activation.subscribe((state) => {\n mode.publish(helpMinorModeState(state));\n leader.update(leaderBindings(state));\n });\n let disposed = false;\n return {\n mode,\n dispose() {\n if (disposed) return;\n disposed = true;\n stateDisposer();\n actionDisposer();\n leader.dispose();\n mode.dispose();\n },\n };\n}\n"],"mappings":"sNAcA,MAAa,EAAsB,yBACtB,EAAe,OAEf,EAAqB,cAE5B,EAAa,CAAE,IAAK,IAAK,MAAO,OAAQ,MAAO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ACF,CAEJ,CACF,EACA,SAAU,EAAO,EAAS,IAAY,CAChC,EAAQ,MAAO,EAAQ,GAAG,OAAO,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EAAG,OAAO,EAC/F,EAAY,CAAK,CACxB,CACF,CAAC,EACK,EAAgB,EAAW,UAAW,GAAU,CACpD,EAAK,QAAQ,EAAmB,CAAK,CAAC,EACtC,EAAO,OAAO,EAAe,CAAK,CAAC,CACrC,CAAC,EACG,EAAW,GACf,MAAO,CACL,OACA,SAAU,CACJ,IACJ,EAAW,GACX,EAAc,EACd,EAAe,EACf,EAAO,QAAQ,EACf,EAAK,QAAQ,EACf,CACF,CACF"}
1
+ {"version":3,"file":"helpMode.mjs","names":[],"sources":["../../../src/adapters/pi/helpMode.ts"],"sourcesContent":["import type { LeaderBinding } from '@agimon-ai/doompi-extension-contracts/leader';\nimport {\n type MinorModeCatalogService,\n type MinorModeOwnerHandle,\n type MinorModeState,\n registerMinorModeOwner,\n} from '@agimon-ai/doompi-extension-contracts/mode';\nimport type { DoomUiHubService } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport type { ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport type { HelpActivationService, HelpRuntimeState } from '../../types/help.ts';\n\nexport const HELP_PACKAGE_SOURCE = '@agimon-ai/doompi-help';\nexport const HELP_MODE_ID = 'help';\nexport const HELP_MODE_ORDER = 50;\nexport const HELP_LEADER_ACTION = 'help.toggle';\n\nconst HELP_GROUP = { key: 'h', label: 'help', order: 70 } as const;\nconst MODE_ACTION_ACTIVATE = 'activate';\nconst MODE_ACTION_DEACTIVATE = 'deactivate';\nconst MAX_MODE_DETAIL_LENGTH = 160;\n\nfunction boundedDetail(value: string): string {\n return value.slice(0, MAX_MODE_DETAIL_LENGTH);\n}\n\nexport function helpMinorModeState(state: HelpRuntimeState): MinorModeState {\n if (state.activation === 'activating') {\n return {\n activation: 'activating',\n condition: 'queued',\n detail: 'loading package Help',\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: false, disabledReason: 'Help activation is already running.' },\n { id: MODE_ACTION_DEACTIVATE, enabled: true },\n ],\n };\n }\n if (state.activation === 'active' || state.activation === 'degraded') {\n const degraded = state.activation === 'degraded';\n return {\n activation: 'active',\n condition: degraded ? 'degraded' : 'ready',\n detail: boundedDetail(`${state.skills.length} package Help skill${state.skills.length === 1 ? '' : 's'}`),\n ...(degraded ? { color: 'warning' as const } : { color: 'accent' as const }),\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: false, disabledReason: 'Help is already active.' },\n { id: MODE_ACTION_DEACTIVATE, enabled: true },\n ],\n };\n }\n const failure = state.diagnostics[0]?.message;\n return {\n activation: 'inactive',\n condition: failure ? 'failed' : 'ready',\n ...(failure ? { detail: boundedDetail(failure), color: 'warning' as const } : {}),\n actions: [\n { id: MODE_ACTION_ACTIVATE, enabled: true },\n { id: MODE_ACTION_DEACTIVATE, enabled: false, disabledReason: 'Help is not active.' },\n ],\n };\n}\n\nfunction leaderBindings(state: HelpRuntimeState): LeaderBinding[] {\n const active = state.activation !== 'inactive';\n return [\n {\n id: 'help.toggle',\n path: [\n HELP_GROUP,\n active\n ? { key: 'e', label: 'exit', detail: 'hide package Help' }\n : { key: 'e', label: 'enter', detail: 'load package Help' },\n ],\n action: { name: HELP_LEADER_ACTION },\n },\n ];\n}\n\nfunction reportAsync(error: unknown): void {\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport interface HelpModeIntegration {\n mode: MinorModeOwnerHandle;\n dispose(): void;\n}\n\nexport function registerHelpModeIntegration(\n catalog: MinorModeCatalogService,\n activation: HelpActivationService,\n): HelpModeIntegration {\n const mode = registerMinorModeOwner<ExtensionContext>(catalog, {\n descriptor: {\n source: HELP_PACKAGE_SOURCE,\n id: HELP_MODE_ID,\n label: 'Help',\n description: 'Activation-gated package guidance from exact installed package versions.',\n order: HELP_MODE_ORDER,\n actions: [\n {\n id: MODE_ACTION_ACTIVATE,\n label: 'Activate',\n description: 'Load package-owned Help indexes and expose their generated skills.',\n contexts: ['tui', 'headless'],\n parameters: [],\n },\n {\n id: MODE_ACTION_DEACTIVATE,\n label: 'Deactivate',\n description: 'Remove all active package Help skills immediately.',\n contexts: ['tui', 'headless'],\n parameters: [],\n },\n ],\n },\n initialState: helpMinorModeState(activation.getState()),\n async handleAction(actionId, _arguments, execution) {\n if (actionId === MODE_ACTION_ACTIVATE) {\n const state = await activation.activate(execution.signal);\n return {\n message: boundedDetail(\n `Activated ${state.skills.length} package Help skill${state.skills.length === 1 ? '' : 's'}${state.activation === 'degraded' ? ' with diagnostics.' : '.'}`,\n ),\n };\n }\n if (actionId === MODE_ACTION_DEACTIVATE) {\n activation.deactivate();\n return { message: 'Package Help deactivated.' };\n }\n throw new Error(`Unknown Help mode action: ${actionId}`);\n },\n onError: reportAsync,\n });\n const stateDisposer = activation.subscribe((state) => mode.publish(helpMinorModeState(state)));\n let disposed = false;\n return {\n mode,\n dispose() {\n if (disposed) return;\n disposed = true;\n stateDisposer();\n mode.dispose();\n },\n };\n}\n\nexport function registerHelpUiIntegration(hub: DoomUiHubService, activation: HelpActivationService): () => void {\n const leader = hub.registerLeader({\n source: HELP_PACKAGE_SOURCE,\n bindings: leaderBindings(activation.getState()),\n });\n const actionDisposer = hub.registerLeaderActions<ExtensionContext>({\n source: HELP_PACKAGE_SOURCE,\n handlers: {\n [HELP_LEADER_ACTION]: async (context) => {\n const state = activation.getState();\n if (state.activation === 'inactive') await activation.activate();\n else activation.deactivate();\n if (context.hasUI) {\n context.ui.notify(\n activation.getState().activation === 'inactive' ? 'Package Help deactivated.' : 'Package Help activated.',\n 'info',\n );\n }\n },\n },\n onError: (error, _action, context) => {\n if (context.hasUI) context.ui.notify(error instanceof Error ? error.message : String(error), 'error');\n else reportAsync(error);\n },\n });\n const stateDisposer = activation.subscribe((state) => leader.update(leaderBindings(state)));\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n stateDisposer();\n actionDisposer();\n leader.disp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AI,eAAe,CAChC,OAAQ,EACR,SAAU,EAAe,EAAW,SAAS,CAAC,CAChD,CAAC,EACK,EAAiB,EAAI,sBAAwC,CACjE,OAAQ,EACR,SAAU,EACP,GAAqB,KAAO,IAAY,CACzB,EAAW,SACjB,CAAC,CAAC,aAAe,WAAY,MAAM,EAAW,SAAS,EAC1D,EAAW,WAAW,EACvB,EAAQ,OACV,EAAQ,GAAG,OACT,EAAW,SAAS,CAAC,CAAC,aAAe,WAAa,4BAA8B,0BAChF,MACF,CAEJ,CACF,EACA,SAAU,EAAO,EAAS,IAAY,CAChC,EAAQ,MAAO,EAAQ,GAAG,OAAO,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EAAG,OAAO,EAC/F,EAAY,CAAK,CACxB,CACF,CAAC,EACK,EAAgB,EAAW,UAAW,GAAU,EAAO,OAAO,EAAe,CAAK,CAAC,CAAC,EACtF,EAAW,GACf,UAAa,CACP,IACJ,EAAW,GACX,EAAc,EACd,EAAe,EACf,EAAO,QAAQ,EACjB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["defaultHelpCacheRoot","HelpIndexCache","DefaultHelpActivationService","DefaultHelpIndexResolver","DefaultHelpSkillMaterializer"],"sources":["../../src/container/index.ts"],"sourcesContent":["import type { DoomHelpContribution, DoomHelpHostHandle } from '@agimon-ai/doompi-extension-contracts/help';\nimport { DefaultHelpSkillMaterializer, defaultHelpCacheRoot, HelpIndexCache } from '../adapters/helpStorage.ts';\nimport { DefaultHelpIndexResolver } from '../adapters/llmsResolver.ts';\nimport { DefaultHelpActivationService } from '../services/helpActivation.ts';\nimport type { HelpFetch } from '../types/help.ts';\n\nexport interface HelpRuntimeOptions {\n cacheRoot?: string;\n fetch?: HelpFetch;\n timeoutMs?: number;\n onBackgroundError?(error: unknown): void;\n}\n\nexport interface HelpRuntimeComposition {\n activation: DefaultHelpActivationService;\n dispose(): void;\n}\n\nfunction reportAsync(error: unknown): void {\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport function createHelpRuntime(host: DoomHelpHostHandle, options: HelpRuntimeOptions = {}): HelpRuntimeComposition {\n const cacheRoot = options.cacheRoot ?? defaultHelpCacheRoot();\n const cache = new HelpIndexCache(cacheRoot);\n const activation = new DefaultHelpActivationService({\n resolver: new DefaultHelpIndexResolver({ cache, fetch: options.fetch, timeoutMs: options.timeoutMs }),\n materializer: new DefaultHelpSkillMaterializer(cacheRoot),\n publisher: { publish: (snapshot) => host.publish(snapshot) },\n onBackgroundError(error) {\n if (options.onBackgroundError) options.onBackgroundError(error);\n else reportAsync(error);\n },\n });\n const synchronize = (contributions: readonly DoomHelpContribution[]): void => {\n activation.replaceContributions(contributions);\n };\n const unsubscribe = host.subscribeContributions((contributions) => synchronize(contributions));\n synchronize(host.listContributions());\n let disposed = false;\n return {\n activation,\n dispose() {\n if (disposed) return;\n disposed = true;\n unsubscribe();\n activation.dispose();\n },\n };\n}\n"],"mappings":"qIAkBA,SAAS,EAAY,EAAsB,CACzC,mBAAqB,CACnB,MAAM,aAAiB,MAAQ,EAAY,MAAM,OAAO,CAAK,CAAC,CAChE,CAAC,CACH,CAEA,SAAgB,EAAkB,EAA0B,EAA8B,CAAC,EAA2B,CACpH,IAAM,EAAY,EAAQ,WAAaA,EAAAA,qBAAqB,EACtD,EAAQ,IAAIC,EAAAA,eAAe,CAAS,EACpC,EAAa,IAAIC,EAAAA,6BAA6B,CAClD,SAAU,IAAIC,EAAAA,yBAAyB,CAAE,QAAO,MAAO,EAAQ,MAAO,UAAW,EAAQ,SAAU,CAAC,EACpG,aAAc,IAAIC,EAAAA,6BAA6B,CAAS,EACxD,UAAW,CAAE,QAAU,GAAa,EAAK,QAAQ,CAAQ,CAAE,EAC3D,kBAAkB,EAAO,CACnB,EAAQ,kBAAmB,EAAQ,kBAAkB,CAAK,EACzD,EAAY,CAAK,CACxB,CACF,CAAC,EACK,EAAe,GAAyD,CAC5E,EAAW,qBAAqB,CAAa,CAC/C,EACM,EAAc,EAAK,uBAAwB,GAAkB,EAAY,CAAa,CAAC,EAC7F,EAAY,EAAK,kBAAkB,CAAC,EACpC,IAAI,EAAW,GACf,MAAO,CACL,aACA,SAAU,CACJ,IACJ,EAAW,GACX,EAAY,EACZ,EAAW,QAAQ,EACrB,CACF,CACF"}
1
+ {"version":3,"file":"index.cjs","names":["defaultHelpCacheRoot","HelpIndexCache","DefaultHelpActivationService","DefaultHelpIndexResolver","DefaultHelpSkillMaterializer"],"sources":["../../src/container/index.ts"],"sourcesContent":["import type { DoomHelpContribution, DoomHelpService } from '@agimon-ai/doompi-extension-contracts/help';\nimport { DefaultHelpSkillMaterializer, defaultHelpCacheRoot, HelpIndexCache } from '../adapters/helpStorage.ts';\nimport { DefaultHelpIndexResolver } from '../adapters/llmsResolver.ts';\nimport { DefaultHelpActivationService } from '../services/helpActivation.ts';\nimport type { HelpFetch } from '../types/help.ts';\n\nexport interface HelpRuntimeOptions {\n cacheRoot?: string;\n fetch?: HelpFetch;\n timeoutMs?: number;\n onBackgroundError?(error: unknown): void;\n}\n\nexport interface HelpRuntimeComposition {\n activation: DefaultHelpActivationService;\n dispose(): void;\n}\n\nfunction reportAsync(error: unknown): void {\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport function createHelpRuntime(service: DoomHelpService, options: HelpRuntimeOptions = {}): HelpRuntimeComposition {\n const cacheRoot = options.cacheRoot ?? defaultHelpCacheRoot();\n const cache = new HelpIndexCache(cacheRoot);\n const activation = new DefaultHelpActivationService({\n resolver: new DefaultHelpIndexResolver({ cache, fetch: options.fetch, timeoutMs: options.timeoutMs }),\n materializer: new DefaultHelpSkillMaterializer(cacheRoot),\n publisher: { publish: (snapshot) => service.publish(snapshot) },\n onBackgroundError(error) {\n if (options.onBackgroundError) options.onBackgroundError(error);\n else reportAsync(error);\n },\n });\n const synchronize = (contributions: readonly DoomHelpContribution[]): void => {\n activation.replaceContributions(contributions);\n };\n const unsubscribe = service.subscribeContributions((contributions) => synchronize(contributions));\n synchronize(service.listContributions());\n let disposed = false;\n return {\n activation,\n dispose() {\n if (disposed) return;\n disposed = true;\n unsubscribe();\n activation.dispose();\n },\n };\n}\n"],"mappings":"qIAkBA,SAAS,EAAY,EAAsB,CACzC,mBAAqB,CACnB,MAAM,aAAiB,MAAQ,EAAY,MAAM,OAAO,CAAK,CAAC,CAChE,CAAC,CACH,CAEA,SAAgB,EAAkB,EAA0B,EAA8B,CAAC,EAA2B,CACpH,IAAM,EAAY,EAAQ,WAAaA,EAAAA,qBAAqB,EACtD,EAAQ,IAAIC,EAAAA,eAAe,CAAS,EACpC,EAAa,IAAIC,EAAAA,6BAA6B,CAClD,SAAU,IAAIC,EAAAA,yBAAyB,CAAE,QAAO,MAAO,EAAQ,MAAO,UAAW,EAAQ,SAAU,CAAC,EACpG,aAAc,IAAIC,EAAAA,6BAA6B,CAAS,EACxD,UAAW,CAAE,QAAU,GAAa,EAAQ,QAAQ,CAAQ,CAAE,EAC9D,kBAAkB,EAAO,CACnB,EAAQ,kBAAmB,EAAQ,kBAAkB,CAAK,EACzD,EAAY,CAAK,CACxB,CACF,CAAC,EACK,EAAe,GAAyD,CAC5E,EAAW,qBAAqB,CAAa,CAC/C,EACM,EAAc,EAAQ,uBAAwB,GAAkB,EAAY,CAAa,CAAC,EAChG,EAAY,EAAQ,kBAAkB,CAAC,EACvC,IAAI,EAAW,GACf,MAAO,CACL,aACA,SAAU,CACJ,IACJ,EAAW,GACX,EAAY,EACZ,EAAW,QAAQ,EACrB,CACF,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/container/index.ts"],"sourcesContent":["import type { DoomHelpContribution, DoomHelpHostHandle } from '@agimon-ai/doompi-extension-contracts/help';\nimport { DefaultHelpSkillMaterializer, defaultHelpCacheRoot, HelpIndexCache } from '../adapters/helpStorage.ts';\nimport { DefaultHelpIndexResolver } from '../adapters/llmsResolver.ts';\nimport { DefaultHelpActivationService } from '../services/helpActivation.ts';\nimport type { HelpFetch } from '../types/help.ts';\n\nexport interface HelpRuntimeOptions {\n cacheRoot?: string;\n fetch?: HelpFetch;\n timeoutMs?: number;\n onBackgroundError?(error: unknown): void;\n}\n\nexport interface HelpRuntimeComposition {\n activation: DefaultHelpActivationService;\n dispose(): void;\n}\n\nfunction reportAsync(error: unknown): void {\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport function createHelpRuntime(host: DoomHelpHostHandle, options: HelpRuntimeOptions = {}): HelpRuntimeComposition {\n const cacheRoot = options.cacheRoot ?? defaultHelpCacheRoot();\n const cache = new HelpIndexCache(cacheRoot);\n const activation = new DefaultHelpActivationService({\n resolver: new DefaultHelpIndexResolver({ cache, fetch: options.fetch, timeoutMs: options.timeoutMs }),\n materializer: new DefaultHelpSkillMaterializer(cacheRoot),\n publisher: { publish: (snapshot) => host.publish(snapshot) },\n onBackgroundError(error) {\n if (options.onBackgroundError) options.onBackgroundError(error);\n else reportAsync(error);\n },\n });\n const synchronize = (contributions: readonly DoomHelpContribution[]): void => {\n activation.replaceContributions(contributions);\n };\n const unsubscribe = host.subscribeContributions((contributions) => synchronize(contributions));\n synchronize(host.listContributions());\n let disposed = false;\n return {\n activation,\n dispose() {\n if (disposed) return;\n disposed = true;\n unsubscribe();\n activation.dispose();\n },\n };\n}\n"],"mappings":"+QAkBA,SAAS,EAAY,EAAsB,CACzC,mBAAqB,CACnB,MAAM,aAAiB,MAAQ,EAAY,MAAM,OAAO,CAAK,CAAC,CAChE,CAAC,CACH,CAEA,SAAgB,EAAkB,EAA0B,EAA8B,CAAC,EAA2B,CACpH,IAAM,EAAY,EAAQ,WAAa,EAAqB,EACtD,EAAQ,IAAI,EAAe,CAAS,EACpC,EAAa,IAAI,EAA6B,CAClD,SAAU,IAAI,EAAyB,CAAE,QAAO,MAAO,EAAQ,MAAO,UAAW,EAAQ,SAAU,CAAC,EACpG,aAAc,IAAI,EAA6B,CAAS,EACxD,UAAW,CAAE,QAAU,GAAa,EAAK,QAAQ,CAAQ,CAAE,EAC3D,kBAAkB,EAAO,CACnB,EAAQ,kBAAmB,EAAQ,kBAAkB,CAAK,EACzD,EAAY,CAAK,CACxB,CACF,CAAC,EACK,EAAe,GAAyD,CAC5E,EAAW,qBAAqB,CAAa,CAC/C,EACM,EAAc,EAAK,uBAAwB,GAAkB,EAAY,CAAa,CAAC,EAC7F,EAAY,EAAK,kBAAkB,CAAC,EACpC,IAAI,EAAW,GACf,MAAO,CACL,aACA,SAAU,CACJ,IACJ,EAAW,GACX,EAAY,EACZ,EAAW,QAAQ,EACrB,CACF,CACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/container/index.ts"],"sourcesContent":["import type { DoomHelpContribution, DoomHelpService } from '@agimon-ai/doompi-extension-contracts/help';\nimport { DefaultHelpSkillMaterializer, defaultHelpCacheRoot, HelpIndexCache } from '../adapters/helpStorage.ts';\nimport { DefaultHelpIndexResolver } from '../adapters/llmsResolver.ts';\nimport { DefaultHelpActivationService } from '../services/helpActivation.ts';\nimport type { HelpFetch } from '../types/help.ts';\n\nexport interface HelpRuntimeOptions {\n cacheRoot?: string;\n fetch?: HelpFetch;\n timeoutMs?: number;\n onBackgroundError?(error: unknown): void;\n}\n\nexport interface HelpRuntimeComposition {\n activation: DefaultHelpActivationService;\n dispose(): void;\n}\n\nfunction reportAsync(error: unknown): void {\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport function createHelpRuntime(service: DoomHelpService, options: HelpRuntimeOptions = {}): HelpRuntimeComposition {\n const cacheRoot = options.cacheRoot ?? defaultHelpCacheRoot();\n const cache = new HelpIndexCache(cacheRoot);\n const activation = new DefaultHelpActivationService({\n resolver: new DefaultHelpIndexResolver({ cache, fetch: options.fetch, timeoutMs: options.timeoutMs }),\n materializer: new DefaultHelpSkillMaterializer(cacheRoot),\n publisher: { publish: (snapshot) => service.publish(snapshot) },\n onBackgroundError(error) {\n if (options.onBackgroundError) options.onBackgroundError(error);\n else reportAsync(error);\n },\n });\n const synchronize = (contributions: readonly DoomHelpContribution[]): void => {\n activation.replaceContributions(contributions);\n };\n const unsubscribe = service.subscribeContributions((contributions) => synchronize(contributions));\n synchronize(service.listContributions());\n let disposed = false;\n return {\n activation,\n dispose() {\n if (disposed) return;\n disposed = true;\n unsubscribe();\n activation.dispose();\n },\n };\n}\n"],"mappings":"+QAkBA,SAAS,EAAY,EAAsB,CACzC,mBAAqB,CACnB,MAAM,aAAiB,MAAQ,EAAY,MAAM,OAAO,CAAK,CAAC,CAChE,CAAC,CACH,CAEA,SAAgB,EAAkB,EAA0B,EAA8B,CAAC,EAA2B,CACpH,IAAM,EAAY,EAAQ,WAAa,EAAqB,EACtD,EAAQ,IAAI,EAAe,CAAS,EACpC,EAAa,IAAI,EAA6B,CAClD,SAAU,IAAI,EAAyB,CAAE,QAAO,MAAO,EAAQ,MAAO,UAAW,EAAQ,SAAU,CAAC,EACpG,aAAc,IAAI,EAA6B,CAAS,EACxD,UAAW,CAAE,QAAU,GAAa,EAAQ,QAAQ,CAAQ,CAAE,EAC9D,kBAAkB,EAAO,CACnB,EAAQ,kBAAmB,EAAQ,kBAAkB,CAAK,EACzD,EAAY,CAAK,CACxB,CACF,CAAC,EACK,EAAe,GAAyD,CAC5E,EAAW,qBAAqB,CAAa,CAC/C,EACM,EAAc,EAAQ,uBAAwB,GAAkB,EAAY,CAAa,CAAC,EAChG,EAAY,EAAQ,kBAAkB,CAAC,EACvC,IAAI,EAAW,GACf,MAAO,CACL,aACA,SAAU,CACJ,IACJ,EAAW,GACX,EAAY,EACZ,EAAW,QAAQ,EACrB,CACF,CACF"}
@@ -0,0 +1 @@
1
+ const e=require("../adapters/pi/extension.cjs");module.exports=e.default;
@@ -0,0 +1,2 @@
1
+ import helpExtension from "../adapters/pi/extension.cjs";
2
+ export = helpExtension;
@@ -0,0 +1,2 @@
1
+ import helpExtension from "../adapters/pi/extension.mjs";
2
+ export { helpExtension as default };
@@ -0,0 +1 @@
1
+ import e from"../adapters/pi/extension.mjs";export{e as default};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./extensions/doom.cjs");exports.activateHelpExtension=e.activateHelpExtension,exports.registerHelpExtension=e.default;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./adapters/pi/extension.cjs");exports.helpExtension=e.default,exports.installHelpRuntime=e.installHelpRuntime;
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import registerHelpExtension, { activateHelpExtension } from "./extensions/doom.cjs";
2
- export { activateHelpExtension, registerHelpExtension };
1
+ import helpExtension, { installHelpRuntime } from "./adapters/pi/extension.cjs";
2
+ export { helpExtension, installHelpRuntime };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import registerHelpExtension, { activateHelpExtension } from "./extensions/doom.mjs";
2
- export { activateHelpExtension, registerHelpExtension };
1
+ import helpExtension, { installHelpRuntime } from "./adapters/pi/extension.mjs";
2
+ export { helpExtension, installHelpRuntime };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import e,{activateHelpExtension as t}from"./extensions/doom.mjs";export{t as activateHelpExtension,e as registerHelpExtension};
1
+ import e,{installHelpRuntime as t}from"./adapters/pi/extension.mjs";export{e as helpExtension,t as installHelpRuntime};
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-help",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.8",
4
4
  "description": "Activation-gated package guidance and help skills for DoomPi and Pi extensions.",
5
5
  "keywords": [
6
6
  "agent-documentation",
7
+ "ai",
7
8
  "coding-agent",
9
+ "developer-tools",
8
10
  "doompi",
9
11
  "help-system",
10
12
  "pi-coding-agent",
11
13
  "pi-extension",
14
+ "pi-package",
12
15
  "skills"
13
16
  ],
14
17
  "homepage": "https://agimon.ai",
@@ -31,10 +34,10 @@
31
34
  "import": "./dist/index.mjs",
32
35
  "require": "./dist/index.cjs"
33
36
  },
34
- "./extensions/doom": {
35
- "types": "./dist/extensions/doom.d.mts",
36
- "import": "./dist/extensions/doom.mjs",
37
- "require": "./dist/extensions/doom.cjs"
37
+ "./extensions/pi": {
38
+ "types": "./dist/extensions/pi.d.mts",
39
+ "import": "./dist/extensions/pi.mjs",
40
+ "require": "./dist/extensions/pi.cjs"
38
41
  },
39
42
  "./package.json": "./package.json"
40
43
  },
@@ -42,7 +45,8 @@
42
45
  "access": "public"
43
46
  },
44
47
  "dependencies": {
45
- "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.23"
48
+ "@deepseek-ai/cordis": "4.0.1",
49
+ "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.25"
46
50
  },
47
51
  "devDependencies": {
48
52
  "@earendil-works/pi-coding-agent": "0.84.2",
@@ -51,7 +55,7 @@
51
55
  "tsdown": "0.22.14",
52
56
  "typescript": "6.0.3",
53
57
  "vitest": "4.1.10",
54
- "@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.23"
58
+ "@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.25"
55
59
  },
56
60
  "peerDependencies": {
57
61
  "@earendil-works/pi-coding-agent": "0.84.2"
@@ -66,7 +70,7 @@
66
70
  },
67
71
  "pi": {
68
72
  "extensions": [
69
- "./dist/extensions/doom.mjs"
73
+ "./dist/extensions/pi.mjs"
70
74
  ]
71
75
  },
72
76
  "scripts": {
@@ -1,2 +0,0 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../adapters/pi/helpMode.cjs"),t=require("../container/index.cjs");let n=require("@agimon-ai/doompi-extension-contracts/help");const r=`@agimon-ai/doompi-help`,i=Symbol.for(`${r}/installed-hosts`);function a(e){let t=globalThis,n=t[i]??new WeakSet;return t[i]=n,!n.has(e)&&(n.add(e),!0)}function o(i,a={}){let o=i,s=(0,n.provideDoomHelpHost)(o),c=t.createHelpRuntime(s,a),l=e.registerHelpModeIntegration(i,c.activation),u=(0,n.registerDoomHelpContribution)(o,{source:r,moduleUrl:require("url").pathToFileURL(__filename).href,skills:[{name:`doompi-help`,description:`Use Doom Pi package Help safely, including activation, exact-version retrieval, and diagnostics.`}]});i.on(`session_start`,()=>{c.activation.deactivate()});let d=!1;return()=>{d||(d=!0,l.dispose(),u.dispose(),c.dispose(),s.dispose())}}function s(e){if(!a(e))return;let t=o(e);e.on(`session_shutdown`,t)}exports.activateHelpExtension=o,exports.default=s,exports.registerHelpExtension=s;
2
- //# sourceMappingURL=doom.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doom.cjs","names":["provideDoomHelpHost","createHelpRuntime","registerHelpModeIntegration","registerDoomHelpContribution"],"sources":["../../src/exports/extensions/doom.ts"],"sourcesContent":["import type { DoomExtensionHost } from '@agimon-ai/doompi-extension-contracts/config';\nimport { provideDoomHelpHost, registerDoomHelpContribution } from '@agimon-ai/doompi-extension-contracts/help';\nimport type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport { registerHelpModeIntegration } from '../../adapters/pi/helpMode.ts';\nimport { createHelpRuntime, type HelpRuntimeOptions } from '../../container/index.ts';\n\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-help';\nconst INSTALLATIONS_KEY = Symbol.for(`${PACKAGE_SOURCE}/installed-hosts`);\n\ntype InstallationRegistry = typeof globalThis & {\n [INSTALLATIONS_KEY]?: WeakSet<object>;\n};\n\nfunction claimHostInstallation(pi: ExtensionAPI): boolean {\n const registry = globalThis as InstallationRegistry;\n const installedHosts = registry[INSTALLATIONS_KEY] ?? new WeakSet<object>();\n registry[INSTALLATIONS_KEY] = installedHosts;\n if (installedHosts.has(pi)) return false;\n installedHosts.add(pi);\n return true;\n}\n\nexport function activateHelpExtension(pi: ExtensionAPI, options: HelpRuntimeOptions = {}): () => void {\n const protocolHost = pi as unknown as DoomExtensionHost;\n const host = provideDoomHelpHost(protocolHost);\n const runtime = createHelpRuntime(host, options);\n const mode = registerHelpModeIntegration(pi, runtime.activation);\n const selfContribution = registerDoomHelpContribution(protocolHost, {\n source: PACKAGE_SOURCE,\n moduleUrl: import.meta.url,\n skills: [\n {\n name: 'doompi-help',\n description: 'Use Doom Pi package Help safely, including activation, exact-version retrieval, and diagnostics.',\n },\n ],\n });\n pi.on('session_start', () => {\n runtime.activation.deactivate();\n });\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n mode.dispose();\n selfContribution.dispose();\n runtime.dispose();\n host.dispose();\n };\n}\n\nexport function registerHelpExtension(pi: ExtensionAPI): void {\n if (!claimHostInstallation(pi)) return;\n const dispose = activateHelpExtension(pi);\n pi.on('session_shutdown', dispose);\n}\n\nexport default registerHelpExtension;\n"],"mappings":"8OAMA,MAAM,EAAiB,yBACjB,EAAoB,OAAO,IAAI,GAAG,EAAe,iBAAiB,EAMxE,SAAS,EAAsB,EAA2B,CACxD,IAAM,EAAW,WACX,EAAiB,EAAS,IAAsB,IAAI,QAI1D,MAHA,GAAS,GAAqB,EAC9B,CAAI,EAAe,IAAI,CAAE,IACzB,EAAe,IAAI,CAAE,EACd,GACT,CAEA,SAAgB,EAAsB,EAAkB,EAA8B,CAAC,EAAe,CACpG,IAAM,EAAe,EACf,GAAA,EAAOA,EAAAA,oBAAAA,CAAoB,CAAY,EACvC,EAAUC,EAAAA,kBAAkB,EAAM,CAAO,EACzC,EAAOC,EAAAA,4BAA4B,EAAI,EAAQ,UAAU,EACzD,GAAA,EAAmBC,EAAAA,6BAAAA,CAA6B,EAAc,CAClE,OAAQ,EACR,UAAA,QAAA,KAAA,CAAA,CAAA,cAAA,UAAA,CAAA,CAAA,KACA,OAAQ,CACN,CACE,KAAM,cACN,YAAa,kGACf,CACF,CACF,CAAC,EACD,EAAG,GAAG,oBAAuB,CAC3B,EAAQ,WAAW,WAAW,CAChC,CAAC,EACD,IAAI,EAAW,GACf,UAAa,CACP,IACJ,EAAW,GACX,EAAK,QAAQ,EACb,EAAiB,QAAQ,EACzB,EAAQ,QAAQ,EAChB,EAAK,QAAQ,EACf,CACF,CAEA,SAAgB,EAAsB,EAAwB,CAC5D,GAAI,CAAC,EAAsB,CAAE,EAAG,OAChC,IAAM,EAAU,EAAsB,CAAE,EACxC,EAAG,GAAG,mBAAoB,CAAO,CACnC"}
@@ -1,8 +0,0 @@
1
- import { HelpRuntimeOptions } from "../container/index.cjs";
2
- import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
- //#region src/exports/extensions/doom.d.ts
4
- declare function activateHelpExtension(pi: ExtensionAPI, options?: HelpRuntimeOptions): () => void;
5
- declare function registerHelpExtension(pi: ExtensionAPI): void;
6
- //#endregion
7
- export { activateHelpExtension, registerHelpExtension as default, registerHelpExtension };
8
- //# sourceMappingURL=doom.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doom.d.cts","names":[],"sources":["../../src/exports/extensions/doom.ts"],"mappings":";;;iBAsBgB,sBAAsB,IAAI,cAAc,UAAS;iBA6BjD,sBAAsB,IAAI"}
@@ -1,8 +0,0 @@
1
- import { HelpRuntimeOptions } from "../container/index.mjs";
2
- import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
- //#region src/exports/extensions/doom.d.ts
4
- declare function activateHelpExtension(pi: ExtensionAPI, options?: HelpRuntimeOptions): () => void;
5
- declare function registerHelpExtension(pi: ExtensionAPI): void;
6
- //#endregion
7
- export { activateHelpExtension, registerHelpExtension as default, registerHelpExtension };
8
- //# sourceMappingURL=doom.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doom.d.mts","names":[],"sources":["../../src/exports/extensions/doom.ts"],"mappings":";;;iBAsBgB,sBAAsB,IAAI,cAAc,UAAS;iBA6BjD,sBAAsB,IAAI"}
@@ -1,2 +0,0 @@
1
- import{registerHelpModeIntegration as e}from"../adapters/pi/helpMode.mjs";import{createHelpRuntime as t}from"../container/index.mjs";import{provideDoomHelpHost as n,registerDoomHelpContribution as r}from"@agimon-ai/doompi-extension-contracts/help";const i=`@agimon-ai/doompi-help`,a=Symbol.for(`${i}/installed-hosts`);function o(e){let t=globalThis,n=t[a]??new WeakSet;return t[a]=n,!n.has(e)&&(n.add(e),!0)}function s(a,o={}){let s=a,c=n(s),l=t(c,o),u=e(a,l.activation),d=r(s,{source:i,moduleUrl:import.meta.url,skills:[{name:`doompi-help`,description:`Use Doom Pi package Help safely, including activation, exact-version retrieval, and diagnostics.`}]});a.on(`session_start`,()=>{l.activation.deactivate()});let f=!1;return()=>{f||(f=!0,u.dispose(),d.dispose(),l.dispose(),c.dispose())}}function c(e){if(!o(e))return;let t=s(e);e.on(`session_shutdown`,t)}export{s as activateHelpExtension,c as default,c as registerHelpExtension};
2
- //# sourceMappingURL=doom.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doom.mjs","names":[],"sources":["../../src/exports/extensions/doom.ts"],"sourcesContent":["import type { DoomExtensionHost } from '@agimon-ai/doompi-extension-contracts/config';\nimport { provideDoomHelpHost, registerDoomHelpContribution } from '@agimon-ai/doompi-extension-contracts/help';\nimport type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport { registerHelpModeIntegration } from '../../adapters/pi/helpMode.ts';\nimport { createHelpRuntime, type HelpRuntimeOptions } from '../../container/index.ts';\n\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-help';\nconst INSTALLATIONS_KEY = Symbol.for(`${PACKAGE_SOURCE}/installed-hosts`);\n\ntype InstallationRegistry = typeof globalThis & {\n [INSTALLATIONS_KEY]?: WeakSet<object>;\n};\n\nfunction claimHostInstallation(pi: ExtensionAPI): boolean {\n const registry = globalThis as InstallationRegistry;\n const installedHosts = registry[INSTALLATIONS_KEY] ?? new WeakSet<object>();\n registry[INSTALLATIONS_KEY] = installedHosts;\n if (installedHosts.has(pi)) return false;\n installedHosts.add(pi);\n return true;\n}\n\nexport function activateHelpExtension(pi: ExtensionAPI, options: HelpRuntimeOptions = {}): () => void {\n const protocolHost = pi as unknown as DoomExtensionHost;\n const host = provideDoomHelpHost(protocolHost);\n const runtime = createHelpRuntime(host, options);\n const mode = registerHelpModeIntegration(pi, runtime.activation);\n const selfContribution = registerDoomHelpContribution(protocolHost, {\n source: PACKAGE_SOURCE,\n moduleUrl: import.meta.url,\n skills: [\n {\n name: 'doompi-help',\n description: 'Use Doom Pi package Help safely, including activation, exact-version retrieval, and diagnostics.',\n },\n ],\n });\n pi.on('session_start', () => {\n runtime.activation.deactivate();\n });\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n mode.dispose();\n selfContribution.dispose();\n runtime.dispose();\n host.dispose();\n };\n}\n\nexport function registerHelpExtension(pi: ExtensionAPI): void {\n if (!claimHostInstallation(pi)) return;\n const dispose = activateHelpExtension(pi);\n pi.on('session_shutdown', dispose);\n}\n\nexport default registerHelpExtension;\n"],"mappings":"wPAMA,MAAM,EAAiB,yBACjB,EAAoB,OAAO,IAAI,GAAG,EAAe,iBAAiB,EAMxE,SAAS,EAAsB,EAA2B,CACxD,IAAM,EAAW,WACX,EAAiB,EAAS,IAAsB,IAAI,QAI1D,MAHA,GAAS,GAAqB,EAC9B,CAAI,EAAe,IAAI,CAAE,IACzB,EAAe,IAAI,CAAE,EACd,GACT,CAEA,SAAgB,EAAsB,EAAkB,EAA8B,CAAC,EAAe,CACpG,IAAM,EAAe,EACf,EAAO,EAAoB,CAAY,EACvC,EAAU,EAAkB,EAAM,CAAO,EACzC,EAAO,EAA4B,EAAI,EAAQ,UAAU,EACzD,EAAmB,EAA6B,EAAc,CAClE,OAAQ,EACR,UAAW,YAAY,IACvB,OAAQ,CACN,CACE,KAAM,cACN,YAAa,kGACf,CACF,CACF,CAAC,EACD,EAAG,GAAG,oBAAuB,CAC3B,EAAQ,WAAW,WAAW,CAChC,CAAC,EACD,IAAI,EAAW,GACf,UAAa,CACP,IACJ,EAAW,GACX,EAAK,QAAQ,EACb,EAAiB,QAAQ,EACzB,EAAQ,QAAQ,EAChB,EAAK,QAAQ,EACf,CACF,CAEA,SAAgB,EAAsB,EAAwB,CAC5D,GAAI,CAAC,EAAsB,CAAE,EAAG,OAChC,IAAM,EAAU,EAAsB,CAAE,EACxC,EAAG,GAAG,mBAAoB,CAAO,CACnC"}