@agimon-ai/doompi-help 0.0.1-alpha.4 → 0.0.1-alpha.41

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 (41) hide show
  1. package/README.md +71 -12
  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/llms.txt +4 -0
  29. package/package.json +38 -17
  30. package/src/exports/webClient.ts +1 -0
  31. package/src/prompts/doompi-use-help/SKILL.md +27 -0
  32. package/src/web/index.ts +21 -0
  33. package/src/web/tsconfig.json +22 -0
  34. package/dist/extensions/doom.cjs +0 -2
  35. package/dist/extensions/doom.cjs.map +0 -1
  36. package/dist/extensions/doom.d.cts +0 -8
  37. package/dist/extensions/doom.d.cts.map +0 -1
  38. package/dist/extensions/doom.d.mts +0 -8
  39. package/dist/extensions/doom.d.mts.map +0 -1
  40. package/dist/extensions/doom.mjs +0 -2
  41. package/dist/extensions/doom.mjs.map +0 -1
package/README.md CHANGED
@@ -1,15 +1,75 @@
1
1
  # @agimon-ai/doompi-help
2
2
 
3
- Activation-gated package guidance for DoomPi.
3
+ Load package-owned DoomPi guidance only when Help mode is active.
4
4
 
5
- The runtime is assembled only in parent Doom Pi sessions and starts inactive. `SPC h e` and
6
- the existing `minor_mode` client share the same activation service. Activation resolves a
7
- contributor's bundled `llms.txt` first, then an immutable exact-version cache, and finally a
8
- verified exact-version unpkg fallback. Deactivation removes generated Help skill wrappers
9
- before the next prompt or catalog access; child sessions never load this package.
5
+ Part of the [DoomPi distribution](https://www.npmjs.com/package/@agimon-ai/doompi).
10
6
 
11
- The package itself contributes `doompi-help`. Workflow and Config contribute
12
- `workflow-help` and `doompi-config-help` from their own package indexes.
7
+ Packages contribute concise `llms.txt` indexes. Help keeps them out of the default model context and exposes them only while Help mode is active.
8
+
9
+ > **Alpha:** Help contribution contracts may change between releases.
10
+
11
+ ## Requirements
12
+
13
+ - Node.js 22.19.0 or newer
14
+ - Pi 0.85.0
15
+
16
+ ## Install
17
+
18
+ The seeded `modes.yaml` selects Help in `default.packages`. It is configurable, not fixed host
19
+ infrastructure: keep it in that bundle or select it through a layer. To load it directly in Pi:
20
+
21
+ ```bash
22
+ pi install npm:@agimon-ai/doompi-help
23
+ ```
24
+
25
+ Pi loads the package through `@agimon-ai/doompi-help/extensions/pi`. DoomPi and standalone Pi use
26
+ the same extension.
27
+
28
+ ## Activate and deactivate
29
+
30
+ In an interactive DoomPi session, use `SPC h e`. Headless DoomPi clients invoke the Help action
31
+ through the shared minor-mode catalog service. In standalone Pi, run `/doom-help`; the command does
32
+ not require Doom config or Leader Space.
33
+
34
+ Activation resolves each contributor in this order:
35
+
36
+ 1. its published `llms.txt`;
37
+ 2. an immutable exact-version cache;
38
+ 3. a verified exact-version unpkg fallback.
39
+
40
+ Deactivation withdraws the active Help skills before the next prompt or catalog read. Cached
41
+ package content or previously generated wrappers may remain on disk, but they are no longer active
42
+ model context.
43
+
44
+ The package contributes `doompi-use-help`. A standard parent catalog can compose two groups from
45
+ the packages that are present:
46
+
47
+ - **How to author:** extension, Config, Major Mode, Domain, Profile, Hook, Workflow, and Skill
48
+ guidance under explicit `doompi-author-*` names.
49
+ - **How to use:** Help, Voice, Plan, Goal, Loop, Workflow, Runner, MCP, and Skill guidance under
50
+ explicit `doompi-use-*` names.
51
+
52
+ Each owning package registers its descriptors and exact package index through the shared Help
53
+ service. Missing or inactive packages do not leave placeholder skills in the catalog.
54
+
55
+ ## Parent and child behavior
56
+
57
+ Parent and child sessions use the same extension entry when their composition selects Help. Replacing a session removes
58
+ the previous Help service, its contributions, and its UI and mode integrations before activating
59
+ the replacement.
60
+
61
+ Root and axis authoring guidance is parent-only when those packages are absent from detached-child
62
+ composition. Config and selected child features can still contribute package guidance to a
63
+ detached child.
64
+
65
+ ## Public API
66
+
67
+ ```ts
68
+ import { helpExtension, installHelpRuntime } from '@agimon-ai/doompi-help';
69
+ ```
70
+
71
+ The root export is intended for host integrations and tests. Users activate Help through the normal
72
+ extension.
13
73
 
14
74
  ## Development
15
75
 
@@ -20,9 +80,8 @@ pnpm test
20
80
  pnpm lint
21
81
  ```
22
82
 
23
- The parent-only Doom extension entrypoint is `@agimon-ai/doompi-help/extensions/doom`.
83
+ Maintained by [Agimon](https://agimon.ai/about).
24
84
 
25
- ## Release order
85
+ ## License
26
86
 
27
- Publish `@agimon-ai/doompi-extension-contracts` before `@agimon-ai/doompi-help`, then publish
28
- the `@agimon-ai/doompi` runtime that consumes both. Do not hand-edit generated changelogs.
87
+ MIT
@@ -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-use-help`,description:`Use Doom Pi Help to activate package guidance, load exact-version skills, and diagnose unavailable or conflicting contributions.`}]}),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-use-help',\n description:\n 'Use Doom Pi Help to activate package guidance, load exact-version skills, and diagnose unavailable or conflicting contributions.',\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,EAAI,GAAmB,CAC/D,IAAM,EAAU,EAAe,IAAIA,EAAAA,2BAA2B,EACxD,GAAA,EAA2B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AY,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-use-help`,description:`Use Doom Pi Help to activate package guidance, load exact-version skills, and diagnose unavailable or conflicting contributions.`}]}),_=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-use-help',\n description:\n 'Use Doom Pi Help to activate package guidance, load exact-version skills, and diagnose unavailable or conflicting contributions.',\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,IAAI,CAA2B,EACxD,EAA2B,EAAsB,GAAG,EAAQ,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+ 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`,detail:`package docs and logs`,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,aACZ,UAAW,SACX,OAAQ,uBACR,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Y,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', detail: 'package docs and logs', 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,MAAO,OAAQ,OAA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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`,detail:`package docs and logs`,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,MAA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AA8B,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,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', detail: 'package docs and logs', 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;\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,EAA0B,EAAuB,EAA+C,CAC9G,IAAM,EAAS,EAAI,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/llms.txt CHANGED
@@ -5,3 +5,7 @@ Activation-gated, package-owned guidance for Doom Pi parent sessions.
5
5
  ## Resources
6
6
 
7
7
  - [Package README](./README.md): Public entrypoints, activation model, security guarantees, and development commands.
8
+
9
+ ## How to use
10
+
11
+ - [doompi-use-help](./src/prompts/doompi-use-help/SKILL.md): Activate package guidance, load exact-version skills, and diagnose unavailable or conflicting contributions.
package/package.json CHANGED
@@ -1,22 +1,36 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-help",
3
- "version": "0.0.1-alpha.4",
4
- "description": "Activation-gated package guidance for DoomPi",
3
+ "version": "0.0.1-alpha.41",
4
+ "description": "Activation-gated package guidance and help skills for DoomPi and Pi extensions.",
5
5
  "keywords": [
6
+ "agent-documentation",
6
7
  "ai",
7
8
  "coding-agent",
8
9
  "developer-tools",
9
10
  "doompi",
11
+ "help-system",
12
+ "pi-coding-agent",
10
13
  "pi-extension",
11
14
  "pi-package",
12
- "typescript"
15
+ "skills"
13
16
  ],
14
17
  "homepage": "https://agimon.ai",
18
+ "bugs": {
19
+ "url": "https://github.com/AgiFlow/doompi/issues"
20
+ },
15
21
  "license": "MIT",
16
22
  "author": "Vuong Ngo",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/AgiFlow/doompi.git",
26
+ "directory": "packages/minor/doompi-help"
27
+ },
17
28
  "files": [
18
29
  "dist",
30
+ "src/web",
31
+ "src/exports/webClient.ts",
19
32
  "llms.txt",
33
+ "src/prompts",
20
34
  "README.md",
21
35
  "LICENSE",
22
36
  "package.json"
@@ -31,10 +45,10 @@
31
45
  "import": "./dist/index.mjs",
32
46
  "require": "./dist/index.cjs"
33
47
  },
34
- "./extensions/doom": {
35
- "types": "./dist/extensions/doom.d.mts",
36
- "import": "./dist/extensions/doom.mjs",
37
- "require": "./dist/extensions/doom.cjs"
48
+ "./extensions/pi": {
49
+ "types": "./dist/extensions/pi.d.mts",
50
+ "import": "./dist/extensions/pi.mjs",
51
+ "require": "./dist/extensions/pi.cjs"
38
52
  },
39
53
  "./package.json": "./package.json"
40
54
  },
@@ -42,19 +56,21 @@
42
56
  "access": "public"
43
57
  },
44
58
  "dependencies": {
45
- "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.21"
59
+ "@deepseek-ai/cordis": "4.0.1",
60
+ "@agimon-ai/doompi-web-contracts": "0.0.1-alpha.20",
61
+ "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.57"
46
62
  },
47
63
  "devDependencies": {
48
- "@earendil-works/pi-coding-agent": "0.84.2",
49
- "@types/node": "26.1.1",
50
- "@vitest/coverage-v8": "4.1.10",
64
+ "@earendil-works/pi-coding-agent": "0.85.0",
65
+ "@types/node": "26.4.0",
66
+ "@vitest/coverage-v8": "4.1.11",
51
67
  "tsdown": "0.22.14",
52
- "typescript": "6.0.3",
53
- "vitest": "4.1.10",
54
- "@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.21"
68
+ "typescript": "7.0.2",
69
+ "vitest": "4.1.11",
70
+ "@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.54"
55
71
  },
56
72
  "peerDependencies": {
57
- "@earendil-works/pi-coding-agent": "0.84.2"
73
+ "@earendil-works/pi-coding-agent": "0.85.0"
58
74
  },
59
75
  "peerDependenciesMeta": {
60
76
  "@earendil-works/pi-coding-agent": {
@@ -64,15 +80,20 @@
64
80
  "engines": {
65
81
  "node": ">=22.19.0"
66
82
  },
83
+ "doompiWeb": {
84
+ "pluginId": "help",
85
+ "channels": [],
86
+ "client": "./src/exports/webClient.ts"
87
+ },
67
88
  "pi": {
68
89
  "extensions": [
69
- "./dist/extensions/doom.mjs"
90
+ "./dist/extensions/pi.mjs"
70
91
  ]
71
92
  },
72
93
  "scripts": {
73
94
  "build": "tsdown",
74
95
  "test": "vitest --run",
75
- "typecheck": "tsc --noEmit",
96
+ "typecheck": "tsc --noEmit && tsc --noEmit -p src/web/tsconfig.json",
76
97
  "lint": "oxlint . && oxfmt . --check",
77
98
  "fixcode": "oxlint . --fix && oxfmt ."
78
99
  }
@@ -0,0 +1 @@
1
+ export { webPlugin } from '../web/index.ts';
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: doompi-use-help
3
+ description: Use Doom Pi Help to activate package guidance, load exact-version skills, and diagnose unavailable or conflicting contributions.
4
+ ---
5
+
6
+ # Use Doom Pi Help
7
+
8
+ Use Help when a question depends on the installed Doom Pi packages and their current authoring or usage guidance.
9
+
10
+ ## Activate guidance
11
+
12
+ 1. In an interactive Doom Pi session, use `SPC h e` to toggle Help.
13
+ 2. In standalone Pi, run `/doom-help`.
14
+ 3. In a headless host, invoke Help through the shared minor-mode catalog.
15
+ 4. Read the skills that appear after activation, then select the narrowest skill for the task.
16
+ 5. Deactivate Help when the package guidance is no longer needed.
17
+
18
+ Help resolves package-owned `llms.txt` indexes from the installed package, an immutable exact-version cache, or an integrity-verified exact-version registry fallback. Treat the resulting skills as guidance for the installed version, not for an unspecified latest release.
19
+
20
+ ## Diagnose activation
21
+
22
+ - If Help remains inactive, inspect the first reported diagnostic and verify that at least one package contributed a valid index and skill.
23
+ - If one package fails but others load, continue with the loaded skills and report the degraded source separately.
24
+ - If skill names collide, the contribution from the earlier package source wins and Help records a diagnostic for the duplicate.
25
+ - If no source can load, do not invent package guidance. Report the activation failure and use verified local package documentation instead.
26
+
27
+ Deactivation removes active Help skills immediately. Cached files may remain on disk, but they are not active model context.
@@ -0,0 +1,21 @@
1
+ import { defineWebPlugin } from '@agimon-ai/doompi-web-contracts';
2
+
3
+ /**
4
+ * This package's cockpit presence: pure metadata. The selection bar renders
5
+ * the minor-mode entry and folds in what the session reports; no signal is published yet, so it shows as unavailable.
6
+ */
7
+ export const webPlugin = defineWebPlugin({
8
+ id: 'help',
9
+ minorModes: [{ name: 'help', keys: 'h e', order: 10 }],
10
+ // The TUI's SPC h e, through the /minor command an RPC client can send.
11
+ leaderBindings: [
12
+ {
13
+ id: 'help.toggle',
14
+ path: [
15
+ { key: 'h', label: 'help', detail: 'package docs and logs' },
16
+ { key: 'e', label: 'toggle', detail: 'load or hide package Help' },
17
+ ],
18
+ command: 'minor help',
19
+ },
20
+ ],
21
+ });
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "noImplicitAny": true,
10
+ "noUnusedLocals": true,
11
+ "noUnusedParameters": true,
12
+ "noImplicitReturns": true,
13
+ "noFallthroughCasesInSwitch": true,
14
+ "noEmit": true,
15
+ "resolveJsonModule": true,
16
+ "esModuleInterop": true,
17
+ "skipLibCheck": true,
18
+ "allowImportingTsExtensions": true,
19
+ "forceConsistentCasingInFileNames": true
20
+ },
21
+ "include": [".", "../types", "../exports/webClient.ts"]
22
+ }
@@ -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"}