@agimon-ai/po-config 0.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +170 -0
  3. package/dist/agentPluginMcp.cjs +322 -0
  4. package/dist/agentPluginMcp.cjs.map +1 -0
  5. package/dist/agentPluginMcp.d.mts +38 -0
  6. package/dist/agentPluginMcp.d.mts.map +1 -0
  7. package/dist/agentPluginMcp.mjs +318 -0
  8. package/dist/agentPluginMcp.mjs.map +1 -0
  9. package/dist/apiContracts.cjs +203 -0
  10. package/dist/apiContracts.cjs.map +1 -0
  11. package/dist/apiContracts.d.mts +53 -0
  12. package/dist/apiContracts.d.mts.map +1 -0
  13. package/dist/apiContracts.mjs +198 -0
  14. package/dist/apiContracts.mjs.map +1 -0
  15. package/dist/atomicJson-1W0WhuFF.mjs +44 -0
  16. package/dist/atomicJson-1W0WhuFF.mjs.map +1 -0
  17. package/dist/atomicJson-Dt2z_DXl.cjs +52 -0
  18. package/dist/atomicJson-Dt2z_DXl.cjs.map +1 -0
  19. package/dist/atomicJson.cjs +3 -0
  20. package/dist/atomicJson.d.mts +2 -0
  21. package/dist/atomicJson.mjs +2 -0
  22. package/dist/config-BUw5kHsx.cjs +219 -0
  23. package/dist/config-BUw5kHsx.cjs.map +1 -0
  24. package/dist/config-CKA07FxG.mjs +162 -0
  25. package/dist/config-CKA07FxG.mjs.map +1 -0
  26. package/dist/config-Cm3EV1jp.d.mts +320 -0
  27. package/dist/config-Cm3EV1jp.d.mts.map +1 -0
  28. package/dist/config-NSHRd6na.mjs +2 -0
  29. package/dist/config-zZz80Mh5.cjs +1 -0
  30. package/dist/config.cjs +24 -0
  31. package/dist/config.d.mts +3 -0
  32. package/dist/config.mjs +3 -0
  33. package/dist/configPolicy--TNX7feH.mjs +718 -0
  34. package/dist/configPolicy--TNX7feH.mjs.map +1 -0
  35. package/dist/configPolicy-DmsZEp0t.cjs +795 -0
  36. package/dist/configPolicy-DmsZEp0t.cjs.map +1 -0
  37. package/dist/configSchema.cjs +0 -0
  38. package/dist/configSchema.d.mts +2 -0
  39. package/dist/configSchema.mjs +1 -0
  40. package/dist/configWriter-BTuinLjs.cjs +150 -0
  41. package/dist/configWriter-BTuinLjs.cjs.map +1 -0
  42. package/dist/configWriter-BgkGaLrf.mjs +130 -0
  43. package/dist/configWriter-BgkGaLrf.mjs.map +1 -0
  44. package/dist/configWriter.cjs +5 -0
  45. package/dist/configWriter.d.mts +2 -0
  46. package/dist/configWriter.mjs +2 -0
  47. package/dist/domains-CBYkuxs5.cjs +727 -0
  48. package/dist/domains-CBYkuxs5.cjs.map +1 -0
  49. package/dist/domains-DZOu9vYM.mjs +633 -0
  50. package/dist/domains-DZOu9vYM.mjs.map +1 -0
  51. package/dist/domains.cjs +19 -0
  52. package/dist/domains.d.mts +3 -0
  53. package/dist/domains.mjs +3 -0
  54. package/dist/extensions/mcp-ui.mjs +101 -0
  55. package/dist/extensions/mcp-ui.mjs.map +1 -0
  56. package/dist/extensions/mcp.cjs +171 -0
  57. package/dist/extensions/mcp.cjs.map +1 -0
  58. package/dist/extensions/mcp.d.mts +5 -0
  59. package/dist/extensions/mcp.d.mts.map +1 -0
  60. package/dist/extensions/mcp.mjs +166 -0
  61. package/dist/extensions/mcp.mjs.map +1 -0
  62. package/dist/extensions/server.cjs +504 -0
  63. package/dist/extensions/server.cjs.map +1 -0
  64. package/dist/extensions/server.d.mts +5 -0
  65. package/dist/extensions/server.d.mts.map +1 -0
  66. package/dist/extensions/server.mjs +499 -0
  67. package/dist/extensions/server.mjs.map +1 -0
  68. package/dist/harnessState-CCyBeutB.cjs +188 -0
  69. package/dist/harnessState-CCyBeutB.cjs.map +1 -0
  70. package/dist/harnessState-Dn_S7fB9.mjs +163 -0
  71. package/dist/harnessState-Dn_S7fB9.mjs.map +1 -0
  72. package/dist/harnessState.cjs +6 -0
  73. package/dist/harnessState.d.mts +2 -0
  74. package/dist/harnessState.mjs +2 -0
  75. package/dist/harnessStore-CJSxdSkV.cjs +343 -0
  76. package/dist/harnessStore-CJSxdSkV.cjs.map +1 -0
  77. package/dist/harnessStore-CltwLB7M.mjs +262 -0
  78. package/dist/harnessStore-CltwLB7M.mjs.map +1 -0
  79. package/dist/harnessStore.cjs +15 -0
  80. package/dist/harnessStore.d.mts +2 -0
  81. package/dist/harnessStore.mjs +2 -0
  82. package/dist/index-BAaTySaM.d.mts +35 -0
  83. package/dist/index-BAaTySaM.d.mts.map +1 -0
  84. package/dist/index-BT29GZx5.d.mts +142 -0
  85. package/dist/index-BT29GZx5.d.mts.map +1 -0
  86. package/dist/index-B_lp0W3U.d.mts +114 -0
  87. package/dist/index-B_lp0W3U.d.mts.map +1 -0
  88. package/dist/index-C6GaYjq-.d.mts +6 -0
  89. package/dist/index-C6GaYjq-.d.mts.map +1 -0
  90. package/dist/index-CIQrKS1A.d.mts +50 -0
  91. package/dist/index-CIQrKS1A.d.mts.map +1 -0
  92. package/dist/index-CRcoVYXz.d.mts +39 -0
  93. package/dist/index-CRcoVYXz.d.mts.map +1 -0
  94. package/dist/index-CVlciCJF.d.mts +40 -0
  95. package/dist/index-CVlciCJF.d.mts.map +1 -0
  96. package/dist/index-CeOk2kqs.d.mts +118 -0
  97. package/dist/index-CeOk2kqs.d.mts.map +1 -0
  98. package/dist/index-Ch7ptOkW.d.mts +54 -0
  99. package/dist/index-Ch7ptOkW.d.mts.map +1 -0
  100. package/dist/index-Cvdt-Y-i.d.mts +66 -0
  101. package/dist/index-Cvdt-Y-i.d.mts.map +1 -0
  102. package/dist/index-DJpG-I9K.d.mts +122 -0
  103. package/dist/index-DJpG-I9K.d.mts.map +1 -0
  104. package/dist/index-DNk4q0Qm.d.mts +81 -0
  105. package/dist/index-DNk4q0Qm.d.mts.map +1 -0
  106. package/dist/index.cjs +121 -0
  107. package/dist/index.d.mts +15 -0
  108. package/dist/index.mjs +15 -0
  109. package/dist/init-C_9nyp3-.cjs +448 -0
  110. package/dist/init-C_9nyp3-.cjs.map +1 -0
  111. package/dist/init-DJ6wm-dr.mjs +415 -0
  112. package/dist/init-DJ6wm-dr.mjs.map +1 -0
  113. package/dist/init.cjs +7 -0
  114. package/dist/init.d.mts +2 -0
  115. package/dist/init.mjs +2 -0
  116. package/dist/layeredConfig-B922ibgn.mjs +67 -0
  117. package/dist/layeredConfig-B922ibgn.mjs.map +1 -0
  118. package/dist/layeredConfig-DdI5ysUf.cjs +94 -0
  119. package/dist/layeredConfig-DdI5ysUf.cjs.map +1 -0
  120. package/dist/layeredConfig.cjs +6 -0
  121. package/dist/layeredConfig.d.mts +2 -0
  122. package/dist/layeredConfig.mjs +2 -0
  123. package/dist/majorModes-CmPLEpMT.mjs +333 -0
  124. package/dist/majorModes-CmPLEpMT.mjs.map +1 -0
  125. package/dist/majorModes-DPhVMuhT.cjs +383 -0
  126. package/dist/majorModes-DPhVMuhT.cjs.map +1 -0
  127. package/dist/majorModes.cjs +10 -0
  128. package/dist/majorModes.d.mts +2 -0
  129. package/dist/majorModes.mjs +2 -0
  130. package/dist/piConfig-Bx26HMb_.d.mts +33 -0
  131. package/dist/piConfig-Bx26HMb_.d.mts.map +1 -0
  132. package/dist/piConfig-CCBdZXQr.cjs +260 -0
  133. package/dist/piConfig-CCBdZXQr.cjs.map +1 -0
  134. package/dist/piConfig-qGyCbcVj.mjs +197 -0
  135. package/dist/piConfig-qGyCbcVj.mjs.map +1 -0
  136. package/dist/piConfig.cjs +12 -0
  137. package/dist/piConfig.d.mts +2 -0
  138. package/dist/piConfig.mjs +2 -0
  139. package/dist/piContext.cjs +18 -0
  140. package/dist/piContext.d.mts +3 -0
  141. package/dist/piContext.mjs +2 -0
  142. package/dist/profiles-CTrUCmIh.d.mts +27 -0
  143. package/dist/profiles-CTrUCmIh.d.mts.map +1 -0
  144. package/dist/profiles-DnF9DBpd.cjs +552 -0
  145. package/dist/profiles-DnF9DBpd.cjs.map +1 -0
  146. package/dist/profiles-fujQKrS0.mjs +483 -0
  147. package/dist/profiles-fujQKrS0.mjs.map +1 -0
  148. package/dist/profiles.cjs +13 -0
  149. package/dist/profiles.d.mts +25 -0
  150. package/dist/profiles.d.mts.map +1 -0
  151. package/dist/profiles.mjs +2 -0
  152. package/dist/rolldown-runtime-VH7oDXx4.cjs +28 -0
  153. package/dist/selectionSwitch.cjs +70 -0
  154. package/dist/selectionSwitch.cjs.map +1 -0
  155. package/dist/selectionSwitch.d.mts +30 -0
  156. package/dist/selectionSwitch.d.mts.map +1 -0
  157. package/dist/selectionSwitch.mjs +64 -0
  158. package/dist/selectionSwitch.mjs.map +1 -0
  159. package/dist/sessionConfig-Boh4Fdje.cjs +342 -0
  160. package/dist/sessionConfig-Boh4Fdje.cjs.map +1 -0
  161. package/dist/sessionConfig-CtLoc-lO.mjs +240 -0
  162. package/dist/sessionConfig-CtLoc-lO.mjs.map +1 -0
  163. package/dist/types.cjs +9 -0
  164. package/dist/types.d.mts +2 -0
  165. package/dist/types.mjs +2 -0
  166. package/llms.txt +12 -0
  167. package/package.json +206 -0
  168. package/src/prompts/po-author-config/SKILL.md +26 -0
  169. package/src/prompts/po-author-config/agents/openai.yaml +4 -0
  170. package/src/prompts/po-author-config/references/config-contract.md +201 -0
@@ -0,0 +1,70 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
3
+ const require_harnessStore = require("./harnessStore-CJSxdSkV.cjs");
4
+ const require_majorModes = require("./majorModes-DPhVMuhT.cjs");
5
+ const require_profiles = require("./profiles-DnF9DBpd.cjs");
6
+ let node_fs = require("node:fs");
7
+ node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
8
+ let node_path = require("node:path");
9
+ node_path = require_rolldown_runtime.__toESM(node_path, 1);
10
+ //#region src/services/selectionSwitch/index.ts
11
+ const PERSONA_FILE = "persona.md";
12
+ /**
13
+ * Applying a selection axis to harness state.
14
+ *
15
+ * Every axis writes through the harness store and relies on Pi's reload
16
+ * re-executing extension modules, which drops their module-level caches and
17
+ * makes them re-read the environment.
18
+ *
19
+ * These live here rather than in the packages that own the /mode and /profile
20
+ * commands because the synced startup path applies the same switches from its
21
+ * --major-mode and --profile flags before any command exists to run them.
22
+ * Domains is the exception and stays with its resource staging.
23
+ */
24
+ /** Applies one major mode and the hook groups its effective layers contribute. */
25
+ function applyMajorMode(config, majorMode, state, compositionFingerprint, childExtensions) {
26
+ const selected = require_majorModes.filterHookDisabledLayers(config, require_majorModes.resolveLayers(config, majorMode), state.hooks);
27
+ return require_harnessStore.updateHarnessState({
28
+ majorMode,
29
+ layers: selected,
30
+ compositionFingerprint,
31
+ ...childExtensions ? { childExtensions: [...childExtensions] } : {},
32
+ hookGroups: require_majorModes.layerHookGroups(config, selected)
33
+ });
34
+ }
35
+ /**
36
+ * Persona: rewrites the assembled prompt file that the persona extension reads.
37
+ *
38
+ * The extension re-reads the file on reload and appends its block to whatever
39
+ * system prompt it is given, so the repository's own AGENTS.md keeps applying
40
+ * underneath. Returns false when the directories hold no readable persona.
41
+ */
42
+ async function applyPersona(personaDirectory, state, personaRoot) {
43
+ const { root, temporaryDirectory } = require_harnessStore.requireHarnessPaths(state);
44
+ const prompt = require_profiles.buildPersonaPrompt(personaRoot ?? root, personaDirectory);
45
+ if (!prompt) return false;
46
+ const personaPath = node_path.default.join(temporaryDirectory, PERSONA_FILE);
47
+ await node_fs.default.promises.writeFile(personaPath, `${prompt}\n`, { mode: 384 });
48
+ require_harnessStore.updateHarnessState({ personaFile: personaPath });
49
+ return true;
50
+ }
51
+ /** Profile: one persona plus the environment defaults it declares. */
52
+ async function applyProfile(profile, state) {
53
+ if (!await applyPersona(profile.persona, state, profile.personaRoot)) throw new Error(`Profile ${profile.name} has no readable persona files`);
54
+ const profileEnvironment = require_profiles.replaceProfileEnvironment(process.env, state.profileEnvironment, profile.env);
55
+ require_harnessStore.updateHarnessState({
56
+ profile: profile.name,
57
+ profileEnvironment,
58
+ profileIdentity: profile.identity,
59
+ profileVoice: profile.voice
60
+ });
61
+ const environmentKeys = Object.keys(profile.env).sort();
62
+ const environmentSummary = environmentKeys.length > 0 ? `; env defaults ${environmentKeys.join(", ")}` : "";
63
+ return `Loaded ${profile.name}: persona ${profile.persona}${environmentSummary}.`;
64
+ }
65
+ //#endregion
66
+ exports.applyMajorMode = applyMajorMode;
67
+ exports.applyPersona = applyPersona;
68
+ exports.applyProfile = applyProfile;
69
+
70
+ //# sourceMappingURL=selectionSwitch.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionSwitch.cjs","names":["filterHookDisabledLayers","resolveLayers","updateHarnessState","layerHookGroups","requireHarnessPaths","buildPersonaPrompt","path","fs","replaceProfileEnvironment"],"sources":["../src/services/selectionSwitch/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { DoomHarnessContext, HarnessState } from '../../types/config';\nimport { requireHarnessPaths, updateHarnessState } from '../harnessStore';\nimport { filterHookDisabledLayers, layerHookGroups, type MajorModesConfig, resolveLayers } from '../majorModes';\nimport { type AgentProfile, buildPersonaPrompt, replaceProfileEnvironment } from '../profiles';\n\nconst PERSONA_FILE = 'persona.md';\n\n/**\n * Applying a selection axis to harness state.\n *\n * Every axis writes through the harness store and relies on Pi's reload\n * re-executing extension modules, which drops their module-level caches and\n * makes them re-read the environment.\n *\n * These live here rather than in the packages that own the /mode and /profile\n * commands because the synced startup path applies the same switches from its\n * --major-mode and --profile flags before any command exists to run them.\n * Domains is the exception and stays with its resource staging.\n */\n\n/** Applies one major mode and the hook groups its effective layers contribute. */\nexport function applyMajorMode(\n config: MajorModesConfig,\n majorMode: string,\n state: DoomHarnessContext,\n compositionFingerprint?: string,\n childExtensions?: readonly string[],\n): HarnessState {\n const selected = filterHookDisabledLayers(config, resolveLayers(config, majorMode), state.hooks);\n return updateHarnessState({\n majorMode,\n layers: selected,\n compositionFingerprint,\n ...(childExtensions ? { childExtensions: [...childExtensions] } : {}),\n hookGroups: layerHookGroups(config, selected),\n });\n}\n\n/**\n * Persona: rewrites the assembled prompt file that the persona extension reads.\n *\n * The extension re-reads the file on reload and appends its block to whatever\n * system prompt it is given, so the repository's own AGENTS.md keeps applying\n * underneath. Returns false when the directories hold no readable persona.\n */\nexport async function applyPersona(\n personaDirectory: string,\n state: DoomHarnessContext,\n personaRoot?: string,\n): Promise<boolean> {\n const { root, temporaryDirectory } = requireHarnessPaths(state);\n\n const prompt = buildPersonaPrompt(personaRoot ?? root, personaDirectory);\n if (!prompt) return false;\n\n const personaPath = path.join(temporaryDirectory, PERSONA_FILE);\n await fs.promises.writeFile(personaPath, `${prompt}\\n`, { mode: 0o600 });\n updateHarnessState({ personaFile: personaPath });\n return true;\n}\n\n/** Profile: one persona plus the environment defaults it declares. */\nexport async function applyProfile(profile: AgentProfile, state: DoomHarnessContext): Promise<string> {\n const appliedPersona = await applyPersona(profile.persona, state, profile.personaRoot);\n if (!appliedPersona) throw new Error(`Profile ${profile.name} has no readable persona files`);\n\n const profileEnvironment = replaceProfileEnvironment(process.env, state.profileEnvironment, profile.env);\n // Written unconditionally, including as undefined, so switching to a profile\n // that declares nothing clears the previous persona's name, icon, and voice.\n updateHarnessState({\n profile: profile.name,\n profileEnvironment,\n profileIdentity: profile.identity,\n profileVoice: profile.voice,\n });\n\n const environmentKeys = Object.keys(profile.env).sort();\n const environmentSummary = environmentKeys.length > 0 ? `; env defaults ${environmentKeys.join(', ')}` : '';\n return `Loaded ${profile.name}: persona ${profile.persona}${environmentSummary}.`;\n}\n"],"mappings":";;;;;;;;;;AAQA,MAAM,eAAe;;;;;;;;;;;;;;AAgBrB,SAAgB,eACd,QACA,WACA,OACA,wBACA,iBACc;CACd,MAAM,WAAWA,mBAAAA,yBAAyB,QAAQC,mBAAAA,cAAc,QAAQ,SAAS,GAAG,MAAM,KAAK;CAC/F,OAAOC,qBAAAA,mBAAmB;EACxB;EACA,QAAQ;EACR;EACA,GAAI,kBAAkB,EAAE,iBAAiB,CAAC,GAAG,eAAe,EAAE,IAAI,CAAC;EACnE,YAAYC,mBAAAA,gBAAgB,QAAQ,QAAQ;CAC9C,CAAC;AACH;;;;;;;;AASA,eAAsB,aACpB,kBACA,OACA,aACkB;CAClB,MAAM,EAAE,MAAM,uBAAuBC,qBAAAA,oBAAoB,KAAK;CAE9D,MAAM,SAASC,iBAAAA,mBAAmB,eAAe,MAAM,gBAAgB;CACvE,IAAI,CAAC,QAAQ,OAAO;CAEpB,MAAM,cAAcC,UAAAA,QAAK,KAAK,oBAAoB,YAAY;CAC9D,MAAMC,QAAAA,QAAG,SAAS,UAAU,aAAa,GAAG,OAAO,KAAK,EAAE,MAAM,IAAM,CAAC;CACvE,qBAAA,mBAAmB,EAAE,aAAa,YAAY,CAAC;CAC/C,OAAO;AACT;;AAGA,eAAsB,aAAa,SAAuB,OAA4C;CAEpG,IAAI,CAAC,MADwB,aAAa,QAAQ,SAAS,OAAO,QAAQ,WAAW,GAChE,MAAM,IAAI,MAAM,WAAW,QAAQ,KAAK,+BAA+B;CAE5F,MAAM,qBAAqBC,iBAAAA,0BAA0B,QAAQ,KAAK,MAAM,oBAAoB,QAAQ,GAAG;CAGvG,qBAAA,mBAAmB;EACjB,SAAS,QAAQ;EACjB;EACA,iBAAiB,QAAQ;EACzB,cAAc,QAAQ;CACxB,CAAC;CAED,MAAM,kBAAkB,OAAO,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK;CACtD,MAAM,qBAAqB,gBAAgB,SAAS,IAAI,kBAAkB,gBAAgB,KAAK,IAAI,MAAM;CACzG,OAAO,UAAU,QAAQ,KAAK,YAAY,QAAQ,UAAU,mBAAmB;AACjF"}
@@ -0,0 +1,30 @@
1
+ import { v as DoomHarnessContext, x as HarnessState } from "./config-Cm3EV1jp.mjs";
2
+ import { o as MajorModesConfig } from "./index-CeOk2kqs.mjs";
3
+ import { t as AgentProfile } from "./index-DNk4q0Qm.mjs";
4
+ //#region src/services/selectionSwitch/index.d.ts
5
+ /**
6
+ * Applying a selection axis to harness state.
7
+ *
8
+ * Every axis writes through the harness store and relies on Pi's reload
9
+ * re-executing extension modules, which drops their module-level caches and
10
+ * makes them re-read the environment.
11
+ *
12
+ * These live here rather than in the packages that own the /mode and /profile
13
+ * commands because the synced startup path applies the same switches from its
14
+ * --major-mode and --profile flags before any command exists to run them.
15
+ * Domains is the exception and stays with its resource staging.
16
+ */
17
+ /** Applies one major mode and the hook groups its effective layers contribute. */
18
+ export declare function applyMajorMode(config: MajorModesConfig, majorMode: string, state: DoomHarnessContext, compositionFingerprint?: string, childExtensions?: readonly string[]): HarnessState;
19
+ /**
20
+ * Persona: rewrites the assembled prompt file that the persona extension reads.
21
+ *
22
+ * The extension re-reads the file on reload and appends its block to whatever
23
+ * system prompt it is given, so the repository's own AGENTS.md keeps applying
24
+ * underneath. Returns false when the directories hold no readable persona.
25
+ */
26
+ export declare function applyPersona(personaDirectory: string, state: DoomHarnessContext, personaRoot?: string): Promise<boolean>;
27
+ /** Profile: one persona plus the environment defaults it declares. */
28
+ export declare function applyProfile(profile: AgentProfile, state: DoomHarnessContext): Promise<string>;
29
+ //#endregion
30
+ //# sourceMappingURL=selectionSwitch.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionSwitch.d.mts","names":[],"sources":["../src/services/selectionSwitch/index.ts"],"mappings":";;;;;;;;;;;;;;;;;wBAwBgB,eACd,QAAQ,kBACR,mBACA,OAAO,oBACP,iCACA,sCACC;;;;;;;;wBAkBmB,aACpB,0BACA,OAAO,oBACP,uBACC;;wBAamB,aAAa,SAAS,cAAc,OAAO,qBAAqB"}
@@ -0,0 +1,64 @@
1
+ import { c as requireHarnessPaths, p as updateHarnessState } from "./harnessStore-CltwLB7M.mjs";
2
+ import { i as layerHookGroups, s as resolveLayers, t as filterHookDisabledLayers } from "./majorModes-CmPLEpMT.mjs";
3
+ import { r as buildPersonaPrompt, s as replaceProfileEnvironment } from "./profiles-fujQKrS0.mjs";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+ //#region src/services/selectionSwitch/index.ts
7
+ const PERSONA_FILE = "persona.md";
8
+ /**
9
+ * Applying a selection axis to harness state.
10
+ *
11
+ * Every axis writes through the harness store and relies on Pi's reload
12
+ * re-executing extension modules, which drops their module-level caches and
13
+ * makes them re-read the environment.
14
+ *
15
+ * These live here rather than in the packages that own the /mode and /profile
16
+ * commands because the synced startup path applies the same switches from its
17
+ * --major-mode and --profile flags before any command exists to run them.
18
+ * Domains is the exception and stays with its resource staging.
19
+ */
20
+ /** Applies one major mode and the hook groups its effective layers contribute. */
21
+ function applyMajorMode(config, majorMode, state, compositionFingerprint, childExtensions) {
22
+ const selected = filterHookDisabledLayers(config, resolveLayers(config, majorMode), state.hooks);
23
+ return updateHarnessState({
24
+ majorMode,
25
+ layers: selected,
26
+ compositionFingerprint,
27
+ ...childExtensions ? { childExtensions: [...childExtensions] } : {},
28
+ hookGroups: layerHookGroups(config, selected)
29
+ });
30
+ }
31
+ /**
32
+ * Persona: rewrites the assembled prompt file that the persona extension reads.
33
+ *
34
+ * The extension re-reads the file on reload and appends its block to whatever
35
+ * system prompt it is given, so the repository's own AGENTS.md keeps applying
36
+ * underneath. Returns false when the directories hold no readable persona.
37
+ */
38
+ async function applyPersona(personaDirectory, state, personaRoot) {
39
+ const { root, temporaryDirectory } = requireHarnessPaths(state);
40
+ const prompt = buildPersonaPrompt(personaRoot ?? root, personaDirectory);
41
+ if (!prompt) return false;
42
+ const personaPath = path.join(temporaryDirectory, PERSONA_FILE);
43
+ await fs.promises.writeFile(personaPath, `${prompt}\n`, { mode: 384 });
44
+ updateHarnessState({ personaFile: personaPath });
45
+ return true;
46
+ }
47
+ /** Profile: one persona plus the environment defaults it declares. */
48
+ async function applyProfile(profile, state) {
49
+ if (!await applyPersona(profile.persona, state, profile.personaRoot)) throw new Error(`Profile ${profile.name} has no readable persona files`);
50
+ const profileEnvironment = replaceProfileEnvironment(process.env, state.profileEnvironment, profile.env);
51
+ updateHarnessState({
52
+ profile: profile.name,
53
+ profileEnvironment,
54
+ profileIdentity: profile.identity,
55
+ profileVoice: profile.voice
56
+ });
57
+ const environmentKeys = Object.keys(profile.env).sort();
58
+ const environmentSummary = environmentKeys.length > 0 ? `; env defaults ${environmentKeys.join(", ")}` : "";
59
+ return `Loaded ${profile.name}: persona ${profile.persona}${environmentSummary}.`;
60
+ }
61
+ //#endregion
62
+ export { applyMajorMode, applyPersona, applyProfile };
63
+
64
+ //# sourceMappingURL=selectionSwitch.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionSwitch.mjs","names":[],"sources":["../src/services/selectionSwitch/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { DoomHarnessContext, HarnessState } from '../../types/config';\nimport { requireHarnessPaths, updateHarnessState } from '../harnessStore';\nimport { filterHookDisabledLayers, layerHookGroups, type MajorModesConfig, resolveLayers } from '../majorModes';\nimport { type AgentProfile, buildPersonaPrompt, replaceProfileEnvironment } from '../profiles';\n\nconst PERSONA_FILE = 'persona.md';\n\n/**\n * Applying a selection axis to harness state.\n *\n * Every axis writes through the harness store and relies on Pi's reload\n * re-executing extension modules, which drops their module-level caches and\n * makes them re-read the environment.\n *\n * These live here rather than in the packages that own the /mode and /profile\n * commands because the synced startup path applies the same switches from its\n * --major-mode and --profile flags before any command exists to run them.\n * Domains is the exception and stays with its resource staging.\n */\n\n/** Applies one major mode and the hook groups its effective layers contribute. */\nexport function applyMajorMode(\n config: MajorModesConfig,\n majorMode: string,\n state: DoomHarnessContext,\n compositionFingerprint?: string,\n childExtensions?: readonly string[],\n): HarnessState {\n const selected = filterHookDisabledLayers(config, resolveLayers(config, majorMode), state.hooks);\n return updateHarnessState({\n majorMode,\n layers: selected,\n compositionFingerprint,\n ...(childExtensions ? { childExtensions: [...childExtensions] } : {}),\n hookGroups: layerHookGroups(config, selected),\n });\n}\n\n/**\n * Persona: rewrites the assembled prompt file that the persona extension reads.\n *\n * The extension re-reads the file on reload and appends its block to whatever\n * system prompt it is given, so the repository's own AGENTS.md keeps applying\n * underneath. Returns false when the directories hold no readable persona.\n */\nexport async function applyPersona(\n personaDirectory: string,\n state: DoomHarnessContext,\n personaRoot?: string,\n): Promise<boolean> {\n const { root, temporaryDirectory } = requireHarnessPaths(state);\n\n const prompt = buildPersonaPrompt(personaRoot ?? root, personaDirectory);\n if (!prompt) return false;\n\n const personaPath = path.join(temporaryDirectory, PERSONA_FILE);\n await fs.promises.writeFile(personaPath, `${prompt}\\n`, { mode: 0o600 });\n updateHarnessState({ personaFile: personaPath });\n return true;\n}\n\n/** Profile: one persona plus the environment defaults it declares. */\nexport async function applyProfile(profile: AgentProfile, state: DoomHarnessContext): Promise<string> {\n const appliedPersona = await applyPersona(profile.persona, state, profile.personaRoot);\n if (!appliedPersona) throw new Error(`Profile ${profile.name} has no readable persona files`);\n\n const profileEnvironment = replaceProfileEnvironment(process.env, state.profileEnvironment, profile.env);\n // Written unconditionally, including as undefined, so switching to a profile\n // that declares nothing clears the previous persona's name, icon, and voice.\n updateHarnessState({\n profile: profile.name,\n profileEnvironment,\n profileIdentity: profile.identity,\n profileVoice: profile.voice,\n });\n\n const environmentKeys = Object.keys(profile.env).sort();\n const environmentSummary = environmentKeys.length > 0 ? `; env defaults ${environmentKeys.join(', ')}` : '';\n return `Loaded ${profile.name}: persona ${profile.persona}${environmentSummary}.`;\n}\n"],"mappings":";;;;;;AAQA,MAAM,eAAe;;;;;;;;;;;;;;AAgBrB,SAAgB,eACd,QACA,WACA,OACA,wBACA,iBACc;CACd,MAAM,WAAW,yBAAyB,QAAQ,cAAc,QAAQ,SAAS,GAAG,MAAM,KAAK;CAC/F,OAAO,mBAAmB;EACxB;EACA,QAAQ;EACR;EACA,GAAI,kBAAkB,EAAE,iBAAiB,CAAC,GAAG,eAAe,EAAE,IAAI,CAAC;EACnE,YAAY,gBAAgB,QAAQ,QAAQ;CAC9C,CAAC;AACH;;;;;;;;AASA,eAAsB,aACpB,kBACA,OACA,aACkB;CAClB,MAAM,EAAE,MAAM,uBAAuB,oBAAoB,KAAK;CAE9D,MAAM,SAAS,mBAAmB,eAAe,MAAM,gBAAgB;CACvE,IAAI,CAAC,QAAQ,OAAO;CAEpB,MAAM,cAAc,KAAK,KAAK,oBAAoB,YAAY;CAC9D,MAAM,GAAG,SAAS,UAAU,aAAa,GAAG,OAAO,KAAK,EAAE,MAAM,IAAM,CAAC;CACvE,mBAAmB,EAAE,aAAa,YAAY,CAAC;CAC/C,OAAO;AACT;;AAGA,eAAsB,aAAa,SAAuB,OAA4C;CAEpG,IAAI,CAAC,MADwB,aAAa,QAAQ,SAAS,OAAO,QAAQ,WAAW,GAChE,MAAM,IAAI,MAAM,WAAW,QAAQ,KAAK,+BAA+B;CAE5F,MAAM,qBAAqB,0BAA0B,QAAQ,KAAK,MAAM,oBAAoB,QAAQ,GAAG;CAGvG,mBAAmB;EACjB,SAAS,QAAQ;EACjB;EACA,iBAAiB,QAAQ;EACzB,cAAc,QAAQ;CACxB,CAAC;CAED,MAAM,kBAAkB,OAAO,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK;CACtD,MAAM,qBAAqB,gBAAgB,SAAS,IAAI,kBAAkB,gBAAgB,KAAK,IAAI,MAAM;CACzG,OAAO,UAAU,QAAQ,KAAK,YAAY,QAAQ,UAAU,mBAAmB;AACjF"}
@@ -0,0 +1,342 @@
1
+ const require_config = require("./config-BUw5kHsx.cjs");
2
+ const require_harnessStore = require("./harnessStore-CJSxdSkV.cjs");
3
+ require("./config-zZz80Mh5.cjs");
4
+ let _deepseek_ai_cordis = require("@deepseek-ai/cordis");
5
+ let _agimon_ai_po_core_config = require("@agimon-ai/po-core/config");
6
+ //#region src/services/doomConfigService/index.ts
7
+ function deepFreeze$1(value) {
8
+ if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
9
+ for (const child of Object.values(value)) deepFreeze$1(child);
10
+ return Object.freeze(value);
11
+ }
12
+ /**
13
+ * Doom configuration published on the shared cordis Context.
14
+ *
15
+ * Every extension resolves the same instance by name, so configuration stays
16
+ * one read per session instead of one per consumer, and the registration is
17
+ * removed with the fiber that created it. The loader is injected so this stays
18
+ * free of filesystem access.
19
+ */
20
+ var DoomConfigService = class extends _deepseek_ai_cordis.Service {
21
+ loadConfig;
22
+ generation;
23
+ snapshot;
24
+ constructor(ctx, snapshot, loadConfig, generation = `doom-config:${crypto.randomUUID()}`) {
25
+ super(ctx, _agimon_ai_po_core_config.DOOM_CONFIG_SERVICE);
26
+ this.loadConfig = loadConfig;
27
+ this.snapshot = deepFreeze$1(snapshot);
28
+ this.generation = generation;
29
+ }
30
+ getSnapshot() {
31
+ return this.snapshot;
32
+ }
33
+ replaceSnapshot(context) {
34
+ this.snapshot = deepFreeze$1(context);
35
+ return this.snapshot;
36
+ }
37
+ load(repoRoot, homeDirectory) {
38
+ return this.loadConfig(repoRoot, homeDirectory);
39
+ }
40
+ };
41
+ //#endregion
42
+ //#region src/services/sessionConfig/index.ts
43
+ const DOOM_CONFIG_ENTRY_TYPE = "po:config:v1";
44
+ const DOOM_CONFIG_TRANSITION_ENTRY_TYPE = "po:transition:v1";
45
+ function isSelection(value) {
46
+ if (typeof value !== "object" || value === null) return false;
47
+ const selection = value;
48
+ return selection.version === 1 && typeof selection.majorMode === "string" && Array.isArray(selection.domains) && selection.domains.every((domain) => typeof domain === "string") && (selection.profile === void 0 || typeof selection.profile === "string") && (selection.compositionFingerprint === void 0 || typeof selection.compositionFingerprint === "string");
49
+ }
50
+ function branchSelection(entries) {
51
+ for (let index = entries.length - 1; index >= 0; index -= 1) {
52
+ const entry = entries[index];
53
+ if (entry?.type === "custom" && entry.customType === "po:config:v1" && isSelection(entry.data)) return entry.data;
54
+ }
55
+ }
56
+ function isTransitionStrategy(value) {
57
+ return value === "pi-reload" || value === "process-relaunch";
58
+ }
59
+ function isTransition(value) {
60
+ if (typeof value !== "object" || value === null) return false;
61
+ const transition = value;
62
+ return transition.version === 1 && typeof transition.operationId === "string" && isSelection(transition.active) && isSelection(transition.target) && isTransitionStrategy(transition.strategy) && (transition.phase === "pending" || transition.phase === "applied" || transition.phase === "aborted" || transition.phase === "superseded");
63
+ }
64
+ function branchTransition(entries) {
65
+ for (let index = entries.length - 1; index >= 0; index -= 1) {
66
+ const entry = entries[index];
67
+ if (entry?.type === "custom" && entry.customType === "po:transition:v1" && isTransition(entry.data)) return entry.data;
68
+ }
69
+ }
70
+ function sameSelection(left, state) {
71
+ return left.majorMode === state.majorMode && left.profile === state.profile && (left.compositionFingerprint === void 0 || left.compositionFingerprint === state.compositionFingerprint) && left.domains.length === state.domains.length && left.domains.every((domain, index) => domain === state.domains[index]);
72
+ }
73
+ function isActiveTransitionTarget(target, state) {
74
+ return target.compositionFingerprint !== void 0 && target.compositionFingerprint === state.compositionFingerprint && sameSelection(target, state);
75
+ }
76
+ function pendingFromTransition(transition) {
77
+ if (transition.phase !== "pending") return void 0;
78
+ return {
79
+ ...transition,
80
+ phase: "pending"
81
+ };
82
+ }
83
+ function pendingFromLegacySelection(selection, bootstrap) {
84
+ if (sameSelection(selection, bootstrap)) return void 0;
85
+ return {
86
+ version: 1,
87
+ operationId: "legacy-config-selection",
88
+ active: {
89
+ version: 1,
90
+ majorMode: bootstrap.majorMode,
91
+ domains: [...bootstrap.domains],
92
+ profile: bootstrap.profile,
93
+ compositionFingerprint: bootstrap.compositionFingerprint
94
+ },
95
+ target: selection,
96
+ strategy: "process-relaunch",
97
+ phase: "pending"
98
+ };
99
+ }
100
+ function deepFreeze(value) {
101
+ if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
102
+ for (const child of Object.values(value)) deepFreeze(child);
103
+ return Object.freeze(value);
104
+ }
105
+ function readDoomConfigSelection(ctx) {
106
+ return branchSelection(ctx.sessionManager.getBranch());
107
+ }
108
+ function resolveContextState(ctx) {
109
+ const bootstrap = require_harnessStore.getSessionHarnessState(ctx.sessionManager.getSessionId());
110
+ return resolveBranchState(ctx.sessionManager.getBranch(), bootstrap);
111
+ }
112
+ function resolveBranchState(entries, bootstrap) {
113
+ const selection = branchSelection(entries);
114
+ const transition = branchTransition(entries);
115
+ const transitionPending = transition ? pendingFromTransition(transition) : void 0;
116
+ const pendingSelection = transition ? transitionPending : selection ? pendingFromLegacySelection(selection, bootstrap) : void 0;
117
+ return {
118
+ harness: bootstrap,
119
+ pendingSelection,
120
+ requiresRelaunch: pendingSelection !== void 0 && (transitionPending === void 0 || !isActiveTransitionTarget(pendingSelection.target, bootstrap)),
121
+ root: bootstrap.root
122
+ };
123
+ }
124
+ function createDoomConfigContext(ctx) {
125
+ const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);
126
+ return deepFreeze({
127
+ settings: require_config.loadDoomConfig(root ?? ctx.cwd),
128
+ harness,
129
+ pendingSelection,
130
+ requiresRelaunch
131
+ });
132
+ }
133
+ async function createDoomConfigContextAsync(ctx) {
134
+ const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);
135
+ return deepFreeze({
136
+ settings: await require_config.loadDoomConfigAsync(root ?? ctx.cwd),
137
+ harness,
138
+ pendingSelection,
139
+ requiresRelaunch
140
+ });
141
+ }
142
+ /** Initializes from this native session's branch, awaiting durable transition acknowledgement. */
143
+ async function createNativeDoomConfigContext(execution) {
144
+ const bootstrap = require_harnessStore.getSessionHarnessState(execution.sessionId);
145
+ const branch = (await execution.session.entries({ type: "custom" })).map((entry) => ({
146
+ type: String(entry.type),
147
+ customType: typeof entry.customType === "string" ? entry.customType : void 0,
148
+ data: entry.data
149
+ }));
150
+ const transition = branchTransition(branch);
151
+ if (transition?.phase === "pending" && isActiveTransitionTarget(transition.target, bootstrap)) {
152
+ const data = {
153
+ ...transition,
154
+ phase: "applied"
155
+ };
156
+ await execution.session.appendCustomEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, data);
157
+ branch.push({
158
+ type: "custom",
159
+ customType: DOOM_CONFIG_TRANSITION_ENTRY_TYPE,
160
+ data
161
+ });
162
+ }
163
+ const { harness, pendingSelection, requiresRelaunch, root } = resolveBranchState(branch, bootstrap);
164
+ return deepFreeze({
165
+ settings: await require_config.loadDoomConfigAsync(root ?? execution.cwd, void 0, execution.environment),
166
+ harness,
167
+ pendingSelection,
168
+ requiresRelaunch
169
+ });
170
+ }
171
+ function appendDoomConfigSelection(pi, selection) {
172
+ pi.appendEntry(DOOM_CONFIG_ENTRY_TYPE, selection);
173
+ }
174
+ /** Journals the live selection, defaulting to whatever the harness store holds. */
175
+ function persistHarnessSelection(pi, state = require_harnessStore.getHarnessState()) {
176
+ appendDoomConfigSelection(pi, {
177
+ version: 1,
178
+ majorMode: state.majorMode,
179
+ domains: state.domains,
180
+ profile: state.profile,
181
+ compositionFingerprint: state.compositionFingerprint
182
+ });
183
+ }
184
+ function appendDoomConfigTransition(pi, transition) {
185
+ pi.appendEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, transition);
186
+ }
187
+ function supersedeDoomConfigTransition(pi, transition) {
188
+ pi.appendEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, {
189
+ ...transition,
190
+ phase: "superseded"
191
+ });
192
+ }
193
+ /** Acknowledges the latest pending transition from a fresh session that owns its exact target composition. */
194
+ function acknowledgeDoomConfigTransition(pi, ctx, harness) {
195
+ const transition = branchTransition(ctx.sessionManager.getBranch());
196
+ if (!transition || transition.phase !== "pending" || !isActiveTransitionTarget(transition.target, harness)) return false;
197
+ appendDoomConfigTransition(pi, {
198
+ ...transition,
199
+ phase: "applied"
200
+ });
201
+ return true;
202
+ }
203
+ function readDoomConfigPendingSelection(ctx) {
204
+ const bootstrap = require_harnessStore.getSessionHarnessState(ctx.sessionManager.getSessionId());
205
+ const transition = branchTransition(ctx.sessionManager.getBranch());
206
+ const transitionPending = transition ? pendingFromTransition(transition) : void 0;
207
+ if (transition) return transitionPending;
208
+ const selection = branchSelection(ctx.sessionManager.getBranch());
209
+ return selection ? pendingFromLegacySelection(selection, bootstrap) : void 0;
210
+ }
211
+ function provideDoomConfigContext(ctx, context, generation = `doom-config:${crypto.randomUUID()}`) {
212
+ return new DoomConfigService(ctx, deepFreeze(context), require_config.loadDoomConfig, generation);
213
+ }
214
+ /** Returns the binding identity used to fence in-flight transitions. */
215
+ function readDoomConfigContextGeneration(ctx) {
216
+ return readDoomConfigService(ctx)?.generation;
217
+ }
218
+ /** Precomputes an immutable context before a transaction reaches publication. */
219
+ function freezeDoomConfigContext(context) {
220
+ return deepFreeze(context);
221
+ }
222
+ /** Replaces a live binding with a deeply frozen context after publication. */
223
+ function replaceDoomConfigContext(ctx, context) {
224
+ const next = deepFreeze(context);
225
+ return requireDoomConfigService(ctx).replaceSnapshot(next);
226
+ }
227
+ function readDoomConfigService(ctx) {
228
+ return ctx.get(_agimon_ai_po_core_config.DOOM_CONFIG_SERVICE);
229
+ }
230
+ function requireDoomConfigService(ctx) {
231
+ const service = readDoomConfigService(ctx);
232
+ if (!service) throw new Error("Doom config service is unavailable. Load @agimon-ai/po-config/extensions/server.");
233
+ return service;
234
+ }
235
+ function requireDoomConfigContext(ctx) {
236
+ return requireDoomConfigService(ctx).getSnapshot();
237
+ }
238
+ //#endregion
239
+ Object.defineProperty(exports, "DOOM_CONFIG_ENTRY_TYPE", {
240
+ enumerable: true,
241
+ get: function() {
242
+ return DOOM_CONFIG_ENTRY_TYPE;
243
+ }
244
+ });
245
+ Object.defineProperty(exports, "DOOM_CONFIG_TRANSITION_ENTRY_TYPE", {
246
+ enumerable: true,
247
+ get: function() {
248
+ return DOOM_CONFIG_TRANSITION_ENTRY_TYPE;
249
+ }
250
+ });
251
+ Object.defineProperty(exports, "acknowledgeDoomConfigTransition", {
252
+ enumerable: true,
253
+ get: function() {
254
+ return acknowledgeDoomConfigTransition;
255
+ }
256
+ });
257
+ Object.defineProperty(exports, "appendDoomConfigSelection", {
258
+ enumerable: true,
259
+ get: function() {
260
+ return appendDoomConfigSelection;
261
+ }
262
+ });
263
+ Object.defineProperty(exports, "appendDoomConfigTransition", {
264
+ enumerable: true,
265
+ get: function() {
266
+ return appendDoomConfigTransition;
267
+ }
268
+ });
269
+ Object.defineProperty(exports, "createDoomConfigContext", {
270
+ enumerable: true,
271
+ get: function() {
272
+ return createDoomConfigContext;
273
+ }
274
+ });
275
+ Object.defineProperty(exports, "createDoomConfigContextAsync", {
276
+ enumerable: true,
277
+ get: function() {
278
+ return createDoomConfigContextAsync;
279
+ }
280
+ });
281
+ Object.defineProperty(exports, "createNativeDoomConfigContext", {
282
+ enumerable: true,
283
+ get: function() {
284
+ return createNativeDoomConfigContext;
285
+ }
286
+ });
287
+ Object.defineProperty(exports, "freezeDoomConfigContext", {
288
+ enumerable: true,
289
+ get: function() {
290
+ return freezeDoomConfigContext;
291
+ }
292
+ });
293
+ Object.defineProperty(exports, "persistHarnessSelection", {
294
+ enumerable: true,
295
+ get: function() {
296
+ return persistHarnessSelection;
297
+ }
298
+ });
299
+ Object.defineProperty(exports, "provideDoomConfigContext", {
300
+ enumerable: true,
301
+ get: function() {
302
+ return provideDoomConfigContext;
303
+ }
304
+ });
305
+ Object.defineProperty(exports, "readDoomConfigContextGeneration", {
306
+ enumerable: true,
307
+ get: function() {
308
+ return readDoomConfigContextGeneration;
309
+ }
310
+ });
311
+ Object.defineProperty(exports, "readDoomConfigPendingSelection", {
312
+ enumerable: true,
313
+ get: function() {
314
+ return readDoomConfigPendingSelection;
315
+ }
316
+ });
317
+ Object.defineProperty(exports, "readDoomConfigSelection", {
318
+ enumerable: true,
319
+ get: function() {
320
+ return readDoomConfigSelection;
321
+ }
322
+ });
323
+ Object.defineProperty(exports, "replaceDoomConfigContext", {
324
+ enumerable: true,
325
+ get: function() {
326
+ return replaceDoomConfigContext;
327
+ }
328
+ });
329
+ Object.defineProperty(exports, "requireDoomConfigContext", {
330
+ enumerable: true,
331
+ get: function() {
332
+ return requireDoomConfigContext;
333
+ }
334
+ });
335
+ Object.defineProperty(exports, "supersedeDoomConfigTransition", {
336
+ enumerable: true,
337
+ get: function() {
338
+ return supersedeDoomConfigTransition;
339
+ }
340
+ });
341
+
342
+ //# sourceMappingURL=sessionConfig-Boh4Fdje.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionConfig-Boh4Fdje.cjs","names":["deepFreeze","Service","DOOM_CONFIG_SERVICE","getSessionHarnessState","loadDoomConfig","loadDoomConfigAsync","getHarnessState","DOOM_CONFIG_SERVICE"],"sources":["../src/services/doomConfigService/index.ts","../src/services/sessionConfig/index.ts"],"sourcesContent":["import { type Context, Service } from '@deepseek-ai/cordis';\n\nimport {\n DOOM_CONFIG_SERVICE,\n type DeepReadonly,\n type DoomConfig,\n type DoomConfigContext,\n type DoomConfigLoader,\n type IDoomConfigService,\n} from '../../types/config';\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\n/**\n * Doom configuration published on the shared cordis Context.\n *\n * Every extension resolves the same instance by name, so configuration stays\n * one read per session instead of one per consumer, and the registration is\n * removed with the fiber that created it. The loader is injected so this stays\n * free of filesystem access.\n */\nexport class DoomConfigService extends Service implements IDoomConfigService {\n readonly generation: string;\n private snapshot: DoomConfigContext;\n\n constructor(\n ctx: Context,\n snapshot: DoomConfigContext,\n private readonly loadConfig: DoomConfigLoader,\n generation = `doom-config:${crypto.randomUUID()}`,\n ) {\n super(ctx, DOOM_CONFIG_SERVICE);\n this.snapshot = deepFreeze(snapshot) as DoomConfigContext;\n this.generation = generation;\n }\n\n getSnapshot(): DoomConfigContext {\n return this.snapshot;\n }\n\n replaceSnapshot(context: DoomConfigContext): DoomConfigContext {\n this.snapshot = deepFreeze(context) as DoomConfigContext;\n return this.snapshot;\n }\n\n load(repoRoot: string, homeDirectory?: string): DoomConfig {\n return this.loadConfig(repoRoot, homeDirectory);\n }\n}\n","import type { DoomHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\n\nimport type {\n DoomConfigSelection as ConfigSelection,\n DeepReadonly,\n DoomConfigContext,\n DoomConfigPendingSelection,\n DoomConfigTransitionRecord,\n DoomConfigTransitionStrategy,\n HarnessState,\n IDoomConfigService,\n} from '../../types/config';\nimport { DOOM_CONFIG_SERVICE } from '../../types/config';\nimport { loadDoomConfig, loadDoomConfigAsync } from '../config';\nimport { DoomConfigService } from '../doomConfigService';\nimport { getHarnessState, getSessionHarnessState } from '../harnessStore';\n\nexport const DOOM_CONFIG_ENTRY_TYPE = 'po:config:v1';\nexport const DOOM_CONFIG_TRANSITION_ENTRY_TYPE = 'po:transition:v1';\n\nexport type DoomConfigSelection = ConfigSelection;\n\ntype DoomConfigTransitionEntry = DoomConfigTransitionRecord;\n\nfunction isSelection(value: unknown): value is DoomConfigSelection {\n if (typeof value !== 'object' || value === null) return false;\n const selection = value as Partial<DoomConfigSelection>;\n return (\n selection.version === 1 &&\n typeof selection.majorMode === 'string' &&\n Array.isArray(selection.domains) &&\n selection.domains.every((domain) => typeof domain === 'string') &&\n (selection.profile === undefined || typeof selection.profile === 'string') &&\n (selection.compositionFingerprint === undefined || typeof selection.compositionFingerprint === 'string')\n );\n}\n\nfunction branchSelection(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): DoomConfigSelection | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === DOOM_CONFIG_ENTRY_TYPE && isSelection(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction isTransitionStrategy(value: unknown): value is DoomConfigTransitionStrategy {\n return value === 'pi-reload' || value === 'process-relaunch';\n}\n\nfunction isTransition(value: unknown): value is DoomConfigTransitionEntry {\n if (typeof value !== 'object' || value === null) return false;\n const transition = value as Partial<DoomConfigTransitionEntry>;\n return (\n transition.version === 1 &&\n typeof transition.operationId === 'string' &&\n isSelection(transition.active) &&\n isSelection(transition.target) &&\n isTransitionStrategy(transition.strategy) &&\n (transition.phase === 'pending' ||\n transition.phase === 'applied' ||\n transition.phase === 'aborted' ||\n transition.phase === 'superseded')\n );\n}\n\nfunction branchTransition(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): DoomConfigTransitionEntry | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (\n entry?.type === 'custom' &&\n entry.customType === DOOM_CONFIG_TRANSITION_ENTRY_TYPE &&\n isTransition(entry.data)\n ) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction sameSelection(left: DoomConfigSelection, state: HarnessState): boolean {\n return (\n left.majorMode === state.majorMode &&\n left.profile === state.profile &&\n (left.compositionFingerprint === undefined || left.compositionFingerprint === state.compositionFingerprint) &&\n left.domains.length === state.domains.length &&\n left.domains.every((domain, index) => domain === state.domains[index])\n );\n}\n\nfunction isActiveTransitionTarget(target: DoomConfigSelection, state: HarnessState): boolean {\n return (\n target.compositionFingerprint !== undefined &&\n target.compositionFingerprint === state.compositionFingerprint &&\n sameSelection(target, state)\n );\n}\n\nfunction pendingFromTransition(transition: DoomConfigTransitionEntry): DoomConfigPendingSelection | undefined {\n if (transition.phase !== 'pending') return undefined;\n return { ...transition, phase: 'pending' };\n}\n\nfunction pendingFromLegacySelection(\n selection: DoomConfigSelection,\n bootstrap: HarnessState,\n): DoomConfigPendingSelection | undefined {\n if (sameSelection(selection, bootstrap)) return undefined;\n const active: DoomConfigSelection = {\n version: 1,\n majorMode: bootstrap.majorMode,\n domains: [...bootstrap.domains],\n profile: bootstrap.profile,\n compositionFingerprint: bootstrap.compositionFingerprint,\n };\n return {\n version: 1,\n operationId: 'legacy-config-selection',\n active,\n target: selection,\n strategy: 'process-relaunch',\n phase: 'pending',\n };\n}\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\nexport function readDoomConfigSelection(\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n): DoomConfigSelection | undefined {\n return branchSelection(ctx.sessionManager.getBranch());\n}\n\nfunction resolveContextState(ctx: Pick<ExtensionContext, 'sessionManager'>): {\n harness: HarnessState;\n pendingSelection: DoomConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n return resolveBranchState(ctx.sessionManager.getBranch(), bootstrap);\n}\n\nfunction resolveBranchState(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n bootstrap: HarnessState,\n): {\n harness: HarnessState;\n pendingSelection: DoomConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const selection = branchSelection(entries);\n const transition = branchTransition(entries);\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n const pendingSelection = transition\n ? transitionPending\n : selection\n ? pendingFromLegacySelection(selection, bootstrap)\n : undefined;\n return {\n harness: bootstrap,\n pendingSelection,\n requiresRelaunch:\n pendingSelection !== undefined &&\n (transitionPending === undefined || !isActiveTransitionTarget(pendingSelection.target, bootstrap)),\n root: bootstrap.root,\n };\n}\n\nexport function createDoomConfigContext(ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>): DoomConfigContext {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n return deepFreeze({ settings: loadDoomConfig(root ?? ctx.cwd), harness, pendingSelection, requiresRelaunch });\n}\n\nexport async function createDoomConfigContextAsync(\n ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>,\n): Promise<DoomConfigContext> {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n const settings = await loadDoomConfigAsync(root ?? ctx.cwd);\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\n/** Initializes from this native session's branch, awaiting durable transition acknowledgement. */\nexport async function createNativeDoomConfigContext(\n execution: DoomHeadlessExecutionContext,\n): Promise<DoomConfigContext> {\n const bootstrap = getSessionHarnessState(execution.sessionId);\n const entries = await execution.session.entries({ type: 'custom' });\n const branch = entries.map((entry) => ({\n type: String(entry.type),\n customType: typeof entry.customType === 'string' ? entry.customType : undefined,\n data: entry.data,\n }));\n const transition = branchTransition(branch);\n if (transition?.phase === 'pending' && isActiveTransitionTarget(transition.target, bootstrap)) {\n const data = { ...transition, phase: 'applied' as const };\n await execution.session.appendCustomEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, data);\n branch.push({ type: 'custom', customType: DOOM_CONFIG_TRANSITION_ENTRY_TYPE, data });\n }\n const { harness, pendingSelection, requiresRelaunch, root } = resolveBranchState(branch, bootstrap);\n const settings = await loadDoomConfigAsync(root ?? execution.cwd, undefined, execution.environment);\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\nexport function appendDoomConfigSelection(pi: Pick<ExtensionAPI, 'appendEntry'>, selection: DoomConfigSelection): void {\n pi.appendEntry(DOOM_CONFIG_ENTRY_TYPE, selection);\n}\n\n/** Journals the live selection, defaulting to whatever the harness store holds. */\nexport function persistHarnessSelection(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n state: {\n readonly majorMode: string;\n readonly domains: readonly string[];\n readonly profile?: string;\n readonly compositionFingerprint?: string;\n } = getHarnessState(),\n): void {\n appendDoomConfigSelection(pi, {\n version: 1,\n majorMode: state.majorMode,\n domains: state.domains,\n profile: state.profile,\n compositionFingerprint: state.compositionFingerprint,\n });\n}\n\nexport function appendDoomConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: DoomConfigTransitionRecord,\n): void {\n pi.appendEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, transition);\n}\n\nexport function supersedeDoomConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: DoomConfigPendingSelection,\n): void {\n pi.appendEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, { ...transition, phase: 'superseded' });\n}\n\n/** Acknowledges the latest pending transition from a fresh session that owns its exact target composition. */\nexport function acknowledgeDoomConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n harness: HarnessState,\n): boolean {\n const transition = branchTransition(ctx.sessionManager.getBranch());\n if (!transition || transition.phase !== 'pending' || !isActiveTransitionTarget(transition.target, harness)) {\n return false;\n }\n appendDoomConfigTransition(pi, { ...transition, phase: 'applied' });\n return true;\n}\n\nexport function readDoomConfigPendingSelection(\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n): DoomConfigPendingSelection | undefined {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n const transition = branchTransition(ctx.sessionManager.getBranch());\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n if (transition) return transitionPending;\n const selection = branchSelection(ctx.sessionManager.getBranch());\n return selection ? pendingFromLegacySelection(selection, bootstrap) : undefined;\n}\n\nexport function provideDoomConfigContext(\n ctx: Context,\n context: DoomConfigContext,\n generation = `doom-config:${crypto.randomUUID()}`,\n): IDoomConfigService {\n return new DoomConfigService(ctx, deepFreeze(context) as DoomConfigContext, loadDoomConfig, generation);\n}\n\n/** Returns the binding identity used to fence in-flight transitions. */\nexport function readDoomConfigContextGeneration(ctx: Context): string | undefined {\n return readDoomConfigService(ctx)?.generation;\n}\n\n/** Precomputes an immutable context before a transaction reaches publication. */\nexport function freezeDoomConfigContext(context: DoomConfigContext): DoomConfigContext {\n return deepFreeze(context);\n}\n\n/** Replaces a live binding with a deeply frozen context after publication. */\nexport function replaceDoomConfigContext(ctx: Context, context: DoomConfigContext): DoomConfigContext {\n const next = deepFreeze(context);\n return requireDoomConfigService(ctx).replaceSnapshot(next as DoomConfigContext);\n}\n\nexport function readDoomConfigService(ctx: Context): IDoomConfigService | undefined {\n return ctx.get(DOOM_CONFIG_SERVICE) as IDoomConfigService | undefined;\n}\n\nexport function requireDoomConfigService(ctx: Context): IDoomConfigService {\n const service = readDoomConfigService(ctx);\n if (!service) throw new Error('Doom config service is unavailable. Load @agimon-ai/po-config/extensions/server.');\n return service;\n}\n\nexport function requireDoomConfigContext(ctx: Context): DoomConfigContext {\n return requireDoomConfigService(ctx).getSnapshot();\n}\n"],"mappings":";;;;;;AAWA,SAASA,aAAmB,OAAqC;CAC/D,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GACtE,OAAO;CAET,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,aAAW,KAAK;CAC1D,OAAO,OAAO,OAAO,KAAK;AAC5B;;;;;;;;;AAUA,IAAa,oBAAb,cAAuCC,oBAAAA,QAAsC;CAOxD;CANnB;CACA;CAEA,YACE,KACA,UACA,YACA,aAAa,eAAe,OAAO,WAAW,KAC9C;EACA,MAAM,KAAKC,0BAAAA,mBAAmB;EAHb,KAAA,aAAA;EAIjB,KAAK,WAAWF,aAAW,QAAQ;EACnC,KAAK,aAAa;CACpB;CAEA,cAAiC;EAC/B,OAAO,KAAK;CACd;CAEA,gBAAgB,SAA+C;EAC7D,KAAK,WAAWA,aAAW,OAAO;EAClC,OAAO,KAAK;CACd;CAEA,KAAK,UAAkB,eAAoC;EACzD,OAAO,KAAK,WAAW,UAAU,aAAa;CAChD;AACF;;;ACnCA,MAAa,yBAAyB;AACtC,MAAa,oCAAoC;AAMjD,SAAS,YAAY,OAA8C;CACjE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,YAAY;CAClB,OACE,UAAU,YAAY,KACtB,OAAO,UAAU,cAAc,YAC/B,MAAM,QAAQ,UAAU,OAAO,KAC/B,UAAU,QAAQ,OAAO,WAAW,OAAO,WAAW,QAAQ,MAC7D,UAAU,YAAY,KAAA,KAAa,OAAO,UAAU,YAAY,cAChE,UAAU,2BAA2B,KAAA,KAAa,OAAO,UAAU,2BAA2B;AAEnG;AAEA,SAAS,gBACP,SACiC;C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