@agimon-ai/po-config 0.0.0-alpha.2 → 0.0.0-alpha.21

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 (221) hide show
  1. package/LICENSE +149 -21
  2. package/README.md +11 -11
  3. package/dist/agentPluginMcp.cjs +313 -134
  4. package/dist/agentPluginMcp.cjs.map +1 -1
  5. package/dist/agentPluginMcp.d.mts +22 -4
  6. package/dist/agentPluginMcp.d.mts.map +1 -1
  7. package/dist/agentPluginMcp.mjs +312 -134
  8. package/dist/agentPluginMcp.mjs.map +1 -1
  9. package/dist/apiContracts.cjs.map +1 -1
  10. package/dist/apiContracts.mjs.map +1 -1
  11. package/dist/atomicJson-D3MHqnLW.cjs +59 -0
  12. package/dist/atomicJson-D3MHqnLW.cjs.map +1 -0
  13. package/dist/atomicJson-Dj3rlZbD.mjs +40 -0
  14. package/dist/atomicJson-Dj3rlZbD.mjs.map +1 -0
  15. package/dist/atomicJson.cjs +4 -2
  16. package/dist/atomicJson.d.mts +2 -2
  17. package/dist/atomicJson.mjs +3 -2
  18. package/dist/{index-BT29GZx5.d.mts → completion-Ba0TiBHa.d.mts} +58 -27
  19. package/dist/completion-Ba0TiBHa.d.mts.map +1 -0
  20. package/dist/config-BBvn_ZLP.mjs +1 -0
  21. package/dist/config-Cdybp9rT.cjs +155 -0
  22. package/dist/config-Cdybp9rT.cjs.map +1 -0
  23. package/dist/config-Cxc2xw54.mjs +112 -0
  24. package/dist/config-Cxc2xw54.mjs.map +1 -0
  25. package/dist/{config-D2HbBLzo.d.mts → config-pxC7FyUJ.d.mts} +33 -33
  26. package/dist/config-pxC7FyUJ.d.mts.map +1 -0
  27. package/dist/config.cjs +21 -17
  28. package/dist/config.d.mts +3 -3
  29. package/dist/config.mjs +4 -3
  30. package/dist/{configPolicy-Ce1QKDxa.cjs → configPolicy-CowlLhK1.cjs} +99 -99
  31. package/dist/configPolicy-CowlLhK1.cjs.map +1 -0
  32. package/dist/{configPolicy-DCQgF5-f.mjs → configPolicy-DueX0k6i.mjs} +84 -84
  33. package/dist/configPolicy-DueX0k6i.mjs.map +1 -0
  34. package/dist/configSchema.d.mts +2 -2
  35. package/dist/configWriter-DCASRzr-.mjs +180 -0
  36. package/dist/configWriter-DCASRzr-.mjs.map +1 -0
  37. package/dist/configWriter-DGO0gmXo.cjs +218 -0
  38. package/dist/configWriter-DGO0gmXo.cjs.map +1 -0
  39. package/dist/configWriter.cjs +7 -4
  40. package/dist/configWriter.d.mts +2 -2
  41. package/dist/configWriter.mjs +1 -2
  42. package/dist/core-B0Qg0Qq2.cjs +224 -0
  43. package/dist/core-B0Qg0Qq2.cjs.map +1 -0
  44. package/dist/core-DKWW9gkh.mjs +139 -0
  45. package/dist/core-DKWW9gkh.mjs.map +1 -0
  46. package/dist/{domains-DGCb7uMC.cjs → domains-CiDUsRiX.cjs} +473 -171
  47. package/dist/domains-CiDUsRiX.cjs.map +1 -0
  48. package/dist/{domains-BroCVHrS.mjs → domains-IlieGHaY.mjs} +437 -170
  49. package/dist/domains-IlieGHaY.mjs.map +1 -0
  50. package/dist/domains.cjs +9 -3
  51. package/dist/domains.d.mts +3 -3
  52. package/dist/domains.mjs +3 -3
  53. package/dist/extensions/mcp-ui.mjs +1 -1
  54. package/dist/extensions/mcp-ui.mjs.map +1 -1
  55. package/dist/extensions/mcp.cjs +3 -3
  56. package/dist/extensions/mcp.cjs.map +1 -1
  57. package/dist/extensions/mcp.d.mts +1 -1
  58. package/dist/extensions/mcp.mjs +2 -2
  59. package/dist/extensions/mcp.mjs.map +1 -1
  60. package/dist/extensions/server.cjs +55 -47
  61. package/dist/extensions/server.cjs.map +1 -1
  62. package/dist/extensions/server.d.mts +2 -2
  63. package/dist/extensions/server.d.mts.map +1 -1
  64. package/dist/extensions/server.mjs +56 -48
  65. package/dist/extensions/server.mjs.map +1 -1
  66. package/dist/{harnessState-Dn_S7fB9.mjs → harnessState-8lZda_8r.mjs} +2 -2
  67. package/dist/{harnessState-Dn_S7fB9.mjs.map → harnessState-8lZda_8r.mjs.map} +1 -1
  68. package/dist/{harnessState-CCyBeutB.cjs → harnessState-BrmH0lG5.cjs} +2 -2
  69. package/dist/{harnessState-CCyBeutB.cjs.map → harnessState-BrmH0lG5.cjs.map} +1 -1
  70. package/dist/harnessState.cjs +1 -1
  71. package/dist/harnessState.d.mts +1 -1
  72. package/dist/harnessState.mjs +1 -2
  73. package/dist/{harnessStore-CJSxdSkV.cjs → harnessStore-BinxGITh.cjs} +189 -81
  74. package/dist/harnessStore-BinxGITh.cjs.map +1 -0
  75. package/dist/{harnessStore-CltwLB7M.mjs → harnessStore-w8zHmJ_H.mjs} +160 -82
  76. package/dist/harnessStore-w8zHmJ_H.mjs.map +1 -0
  77. package/dist/harnessStore.cjs +6 -1
  78. package/dist/harnessStore.d.mts +2 -2
  79. package/dist/harnessStore.mjs +1 -2
  80. package/dist/index-7RuIAWX1.d.mts +63 -0
  81. package/dist/index-7RuIAWX1.d.mts.map +1 -0
  82. package/dist/{index-CkDDvVQt.d.mts → index-BNcG0voG.d.mts} +61 -16
  83. package/dist/index-BNcG0voG.d.mts.map +1 -0
  84. package/dist/{index-Dy_-m7gx.d.mts → index-BTOU4XiI.d.mts} +3 -3
  85. package/dist/{index-Dy_-m7gx.d.mts.map → index-BTOU4XiI.d.mts.map} +1 -1
  86. package/dist/index-COokUToB.d.mts +83 -0
  87. package/dist/index-COokUToB.d.mts.map +1 -0
  88. package/dist/index-D3vGEYup.d.mts +135 -0
  89. package/dist/index-D3vGEYup.d.mts.map +1 -0
  90. package/dist/{index-Ch7ptOkW.d.mts → index-DNEK9W6n.d.mts} +26 -16
  91. package/dist/index-DNEK9W6n.d.mts.map +1 -0
  92. package/dist/index-D_OtYtsl.d.mts +37 -0
  93. package/dist/index-D_OtYtsl.d.mts.map +1 -0
  94. package/dist/{index-DNk4q0Qm.d.mts → index-Nbj2iQWw.d.mts} +19 -25
  95. package/dist/index-Nbj2iQWw.d.mts.map +1 -0
  96. package/dist/{index-CEUc7m16.d.mts → index-dYgF03lE.d.mts} +82 -32
  97. package/dist/index-dYgF03lE.d.mts.map +1 -0
  98. package/dist/index-fTuf8tVH.d.mts +34 -0
  99. package/dist/index-fTuf8tVH.d.mts.map +1 -0
  100. package/dist/index-nVcEC1jO.d.mts +62 -0
  101. package/dist/index-nVcEC1jO.d.mts.map +1 -0
  102. package/dist/index.cjs +81 -59
  103. package/dist/index.d.mts +16 -15
  104. package/dist/index.mjs +17 -15
  105. package/dist/{init-Cd3Ki6Ub.cjs → init-BdZ-gqqk.cjs} +209 -59
  106. package/dist/init-BdZ-gqqk.cjs.map +1 -0
  107. package/dist/{init-DVzhiCUE.mjs → init-DG7MxGxC.mjs} +187 -48
  108. package/dist/init-DG7MxGxC.mjs.map +1 -0
  109. package/dist/init.cjs +8 -6
  110. package/dist/init.d.mts +2 -2
  111. package/dist/init.mjs +1 -2
  112. package/dist/layeredConfig-BbkoIEfM.mjs +95 -0
  113. package/dist/layeredConfig-BbkoIEfM.mjs.map +1 -0
  114. package/dist/layeredConfig-Bs18dXQG.cjs +127 -0
  115. package/dist/layeredConfig-Bs18dXQG.cjs.map +1 -0
  116. package/dist/layeredConfig.cjs +5 -4
  117. package/dist/layeredConfig.d.mts +7 -2
  118. package/dist/layeredConfig.d.mts.map +1 -0
  119. package/dist/layeredConfig.mjs +1 -2
  120. package/dist/{majorModes-D1Itd8SN.mjs → majorModes-B8Km83e1.mjs} +130 -23
  121. package/dist/majorModes-B8Km83e1.mjs.map +1 -0
  122. package/dist/{majorModes-DnNSH9ZK.cjs → majorModes-CLccNMZt.cjs} +147 -22
  123. package/dist/majorModes-CLccNMZt.cjs.map +1 -0
  124. package/dist/majorModes.cjs +4 -1
  125. package/dist/majorModes.d.mts +2 -2
  126. package/dist/majorModes.mjs +1 -2
  127. package/dist/{piConfig-qGyCbcVj.mjs → piConfig-Bq36PQFF.mjs} +104 -69
  128. package/dist/piConfig-Bq36PQFF.mjs.map +1 -0
  129. package/dist/{piConfig-Bx26HMb_.d.mts → piConfig-C9rGUqPe.d.mts} +3 -3
  130. package/dist/{piConfig-Bx26HMb_.d.mts.map → piConfig-C9rGUqPe.d.mts.map} +1 -1
  131. package/dist/{piConfig-CCBdZXQr.cjs → piConfig-cluCie5i.cjs} +122 -70
  132. package/dist/piConfig-cluCie5i.cjs.map +1 -0
  133. package/dist/piConfig.cjs +4 -1
  134. package/dist/piConfig.d.mts +2 -2
  135. package/dist/piConfig.mjs +1 -2
  136. package/dist/piContext.cjs +27 -16
  137. package/dist/piContext.d.mts +3 -3
  138. package/dist/piContext.mjs +1 -2
  139. package/dist/{profiles-DBcYg5nA.mjs → profiles-CHict0x-.mjs} +322 -101
  140. package/dist/profiles-CHict0x-.mjs.map +1 -0
  141. package/dist/{profiles-tpplXY4r.cjs → profiles-t2EUj0aB.cjs} +359 -102
  142. package/dist/profiles-t2EUj0aB.cjs.map +1 -0
  143. package/dist/profiles.cjs +7 -1
  144. package/dist/profiles.d.mts +27 -3
  145. package/dist/profiles.d.mts.map +1 -1
  146. package/dist/profiles.mjs +1 -2
  147. package/dist/selectionSwitch.cjs +88 -22
  148. package/dist/selectionSwitch.cjs.map +1 -1
  149. package/dist/selectionSwitch.d.mts +40 -18
  150. package/dist/selectionSwitch.d.mts.map +1 -1
  151. package/dist/selectionSwitch.mjs +85 -22
  152. package/dist/selectionSwitch.mjs.map +1 -1
  153. package/dist/{sessionConfig-DV5xTRRw.mjs → sessionConfig-DFQF618G.mjs} +48 -47
  154. package/dist/sessionConfig-DFQF618G.mjs.map +1 -0
  155. package/dist/{sessionConfig-Bf6xHWLd.cjs → sessionConfig-DeP6pplT.cjs} +74 -85
  156. package/dist/sessionConfig-DeP6pplT.cjs.map +1 -0
  157. package/dist/sync-BJ8gCP9s.mjs +29 -0
  158. package/dist/sync-BJ8gCP9s.mjs.map +1 -0
  159. package/dist/sync-CC_15kkB.d.mts +46 -0
  160. package/dist/sync-CC_15kkB.d.mts.map +1 -0
  161. package/dist/sync-Dlxz2msM.cjs +37 -0
  162. package/dist/sync-Dlxz2msM.cjs.map +1 -0
  163. package/dist/types.cjs +2 -2
  164. package/dist/types.d.mts +2 -2
  165. package/dist/types.mjs +1 -2
  166. package/llms.txt +1 -1
  167. package/package.json +16 -16
  168. package/src/prompts/po-author-config/SKILL.md +4 -4
  169. package/src/prompts/po-author-config/agents/openai.yaml +1 -1
  170. package/src/prompts/po-author-config/references/config-contract.md +5 -5
  171. package/dist/atomicJson-1W0WhuFF.mjs +0 -44
  172. package/dist/atomicJson-1W0WhuFF.mjs.map +0 -1
  173. package/dist/atomicJson-Dt2z_DXl.cjs +0 -52
  174. package/dist/atomicJson-Dt2z_DXl.cjs.map +0 -1
  175. package/dist/config-CfTb0_9G.cjs +0 -219
  176. package/dist/config-CfTb0_9G.cjs.map +0 -1
  177. package/dist/config-D2HbBLzo.d.mts.map +0 -1
  178. package/dist/config-DoQWSt1V.mjs +0 -162
  179. package/dist/config-DoQWSt1V.mjs.map +0 -1
  180. package/dist/config-NSHRd6na.mjs +0 -2
  181. package/dist/configPolicy-Ce1QKDxa.cjs.map +0 -1
  182. package/dist/configPolicy-DCQgF5-f.mjs.map +0 -1
  183. package/dist/configWriter-B7uO8MuN.cjs +0 -150
  184. package/dist/configWriter-B7uO8MuN.cjs.map +0 -1
  185. package/dist/configWriter-DUtLgOlD.mjs +0 -130
  186. package/dist/configWriter-DUtLgOlD.mjs.map +0 -1
  187. package/dist/domains-BroCVHrS.mjs.map +0 -1
  188. package/dist/domains-DGCb7uMC.cjs.map +0 -1
  189. package/dist/harnessStore-CJSxdSkV.cjs.map +0 -1
  190. package/dist/harnessStore-CltwLB7M.mjs.map +0 -1
  191. package/dist/index-78zvoS9s.d.mts +0 -35
  192. package/dist/index-78zvoS9s.d.mts.map +0 -1
  193. package/dist/index-BT29GZx5.d.mts.map +0 -1
  194. package/dist/index-C6GaYjq-.d.mts +0 -6
  195. package/dist/index-C6GaYjq-.d.mts.map +0 -1
  196. package/dist/index-CEUc7m16.d.mts.map +0 -1
  197. package/dist/index-CRcoVYXz.d.mts +0 -39
  198. package/dist/index-CRcoVYXz.d.mts.map +0 -1
  199. package/dist/index-CVlciCJF.d.mts +0 -40
  200. package/dist/index-CVlciCJF.d.mts.map +0 -1
  201. package/dist/index-Ch7ptOkW.d.mts.map +0 -1
  202. package/dist/index-CkDDvVQt.d.mts.map +0 -1
  203. package/dist/index-Cvdt-Y-i.d.mts +0 -66
  204. package/dist/index-Cvdt-Y-i.d.mts.map +0 -1
  205. package/dist/index-DNk4q0Qm.d.mts.map +0 -1
  206. package/dist/index-DdH0w56b.d.mts +0 -116
  207. package/dist/index-DdH0w56b.d.mts.map +0 -1
  208. package/dist/init-Cd3Ki6Ub.cjs.map +0 -1
  209. package/dist/init-DVzhiCUE.mjs.map +0 -1
  210. package/dist/layeredConfig-fukqN2EA.mjs +0 -67
  211. package/dist/layeredConfig-fukqN2EA.mjs.map +0 -1
  212. package/dist/layeredConfig-ol0274TN.cjs +0 -94
  213. package/dist/layeredConfig-ol0274TN.cjs.map +0 -1
  214. package/dist/majorModes-D1Itd8SN.mjs.map +0 -1
  215. package/dist/majorModes-DnNSH9ZK.cjs.map +0 -1
  216. package/dist/piConfig-CCBdZXQr.cjs.map +0 -1
  217. package/dist/piConfig-qGyCbcVj.mjs.map +0 -1
  218. package/dist/profiles-DBcYg5nA.mjs.map +0 -1
  219. package/dist/profiles-tpplXY4r.cjs.map +0 -1
  220. package/dist/sessionConfig-Bf6xHWLd.cjs.map +0 -1
  221. package/dist/sessionConfig-DV5xTRRw.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"configWriter-DUtLgOlD.mjs","names":[],"sources":["../src/services/configWriter/index.ts"],"sourcesContent":["/**\n * Writes into the global Doom config file, one key path at a time.\n *\n * Extracted from doom-file-edit, which owned the only writer in the repo and had\n * it hard-coded to `editor.command`. Several extensions now edit their own\n * settings from the config panel, and every one of them needs the same four\n * properties: keep the user's comments, never publish a file the parser would\n * reject, never leave a half-written file behind, and apply a set of related\n * edits together.\n *\n * That last one is not a convenience. `voice.adapters.<engine>.model` accepts a\n * path or an id but not both, so switching between them is a set and an unset\n * that must land in the same write, or the file is briefly invalid.\n *\n * Atomicity is the same rename trick as `atomicJson.ts` next door, and carries\n * the same caveat: it prevents torn reads, not lost updates. Two sessions with\n * the panel open still clobber each other, because the rename only publishes\n * what the caller already computed.\n *\n * AVOID:\n * - Treating this as a lock\n * - Writing an empty string; the parser rejects blank values, so clearing a key\n * means removing it\n */\n\nimport { randomUUID } from 'node:crypto';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\n\nimport { parseDocument } from 'yaml';\n\nimport { parseDoomConfig } from '../configPolicy';\n\n/**\n * The global file holds machine-wide credentials-adjacent settings and lives in\n * the user's home, so it stays private.\n */\nconst PRIVATE_FILE_MODE = 0o600;\nconst PRIVATE_DIRECTORY_MODE = 0o700;\n\n/**\n * The repository file is committed to git and read by everyone who checks the\n * project out, so it takes the modes `init.ts` already seeds it with. Writing it\n * private would produce a 0600 file in a working tree, which is both wrong and\n * invisible until someone else clones.\n */\nconst REPOSITORY_FILE_MODE = 0o644;\nconst REPOSITORY_DIRECTORY_MODE = 0o755;\n\n/** Which file a write is aimed at; the modes follow from it. */\nexport type DoomConfigScope = 'global' | 'repository';\n\n/** The permissions a scope's file and its parent directory are created with. */\nfunction modesForScope(scope: DoomConfigScope): { file: number; directory: number } {\n return scope === 'repository'\n ? { file: REPOSITORY_FILE_MODE, directory: REPOSITORY_DIRECTORY_MODE }\n : { file: PRIVATE_FILE_MODE, directory: PRIVATE_DIRECTORY_MODE };\n}\n\nexport interface DoomConfigEdit {\n /** Key path into the document, e.g. `['voice', 'adapters', 'mlx-whisper', 'model', 'id']`. */\n readonly keyPath: readonly string[];\n /**\n * The value to write. `undefined` removes the key.\n *\n * Not only strings: the config holds numbers (`utteranceIdleMs`) and lists\n * (`startPhrases`), and a panel that edits them as text has to hand back the\n * parsed value or the next load rejects what it wrote.\n */\n readonly value?: string | number | boolean | readonly string[];\n}\n\nexport interface WriteDoomConfigOptions {\n /**\n * Remove ancestors left holding nothing. Defaults to true, and is not\n * cosmetic: an adapter left as `{}` fails validation, because the parser\n * requires a model once the adapter exists at all.\n */\n readonly prune?: boolean;\n /**\n * Which file this is, so the write lands with the right permissions.\n * Defaults to `global`, which is what every caller wrote before the\n * repository file was writable at all.\n */\n readonly scope?: DoomConfigScope;\n}\n\nasync function readIfPresent(filePath: string): Promise<string> {\n try {\n return await fs.readFile(filePath, 'utf8');\n } catch (error) {\n if (error instanceof Error && 'code' in error && error.code === 'ENOENT') return '';\n throw error;\n }\n}\n\nfunction isEmptyCollection(value: unknown): boolean {\n if (value === null || typeof value !== 'object') return false;\n const items = (value as { items?: unknown }).items;\n return Array.isArray(items) && items.length === 0;\n}\n\n/** Drops ancestors of a removed key that are now empty, deepest first. */\nfunction pruneEmptyAncestors(document: ReturnType<typeof parseDocument>, keyPath: readonly string[]): void {\n for (let depth = keyPath.length - 1; depth > 0; depth -= 1) {\n const ancestor = keyPath.slice(0, depth);\n if (!document.hasIn(ancestor)) continue;\n if (!isEmptyCollection(document.getIn(ancestor, true))) return;\n document.deleteIn(ancestor);\n }\n}\n\n/**\n * Applies every edit as one document mutation, or throws having written nothing.\n *\n * Validation runs against the serialized result rather than each edit, so a pair\n * of edits only valid together is accepted, and a single edit that breaks an\n * invariant elsewhere is still caught.\n */\nexport async function writeDoomConfigValues(\n filePath: string,\n edits: readonly DoomConfigEdit[],\n options: WriteDoomConfigOptions = {},\n): Promise<void> {\n if (edits.length === 0) return;\n const content = await readIfPresent(filePath);\n // Not `content || '{}\\n'`: seeding an absent file with a flow map makes yaml\n // keep that style, so the first write produces `{ editor: { command: ... } }`\n // and every later one grows that one line. An empty source starts a block map.\n const document = parseDocument(content, { keepSourceTokens: true });\n if (document.errors.length > 0) throw new Error(`Could not parse Doom config at ${filePath}`);\n\n for (const edit of edits) {\n const keyPath = [...edit.keyPath];\n if (edit.value !== undefined) {\n document.setIn(keyPath, edit.value);\n continue;\n }\n // deleteIn throws when an ancestor is missing rather than treating the key as\n // already absent, and clearing an unset key is worth supporting.\n if (!document.hasIn(keyPath)) continue;\n document.deleteIn(keyPath);\n if (options.prune !== false) pruneEmptyAncestors(document, keyPath);\n }\n\n const output = document.toString();\n parseDoomConfig(output, filePath);\n\n const modes = modesForScope(options.scope ?? 'global');\n await fs.mkdir(path.dirname(filePath), { mode: modes.directory, recursive: true });\n const temporaryPath = `${filePath}.${process.pid}.${randomUUID()}.tmp`;\n try {\n await fs.writeFile(temporaryPath, output, { encoding: 'utf8', mode: modes.file });\n await fs.rename(temporaryPath, filePath);\n } catch (error) {\n await fs.rm(temporaryPath, { force: true });\n throw error;\n }\n}\n\nexport async function setDoomConfigValue(\n filePath: string,\n keyPath: readonly string[],\n value: string,\n options: WriteDoomConfigOptions = {},\n): Promise<void> {\n await writeDoomConfigValues(filePath, [{ keyPath, value }], options);\n}\n\nexport async function unsetDoomConfigValue(\n filePath: string,\n keyPath: readonly string[],\n options: WriteDoomConfigOptions = {},\n): Promise<void> {\n await writeDoomConfigValues(filePath, [{ keyPath }], options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,oBAAoB;AAC1B,MAAM,yBAAyB;;;;;;;AAQ/B,MAAM,uBAAuB;AAC7B,MAAM,4BAA4B;;AAMlC,SAAS,cAAc,OAA6D;CAClF,OAAO,UAAU,eACb;EAAE,MAAM;EAAsB,WAAW;CAA0B,IACnE;EAAE,MAAM;EAAmB,WAAW;CAAuB;AACnE;AA8BA,eAAe,cAAc,UAAmC;CAC9D,IAAI;EACF,OAAO,MAAM,GAAG,SAAS,UAAU,MAAM;CAC3C,SAAS,OAAO;EACd,IAAI,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS,UAAU,OAAO;EACjF,MAAM;CACR;AACF;AAEA,SAAS,kBAAkB,OAAyB;CAClD,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU,O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AAE,UAAU;GAAQ,MAAM,MAAM;EAAK,CAAC;EAChF,MAAM,GAAG,OAAO,eAAe,QAAQ;CACzC,SAAS,OAAO;EACd,MAAM,GAAG,GAAG,eAAe,EAAE,OAAO,KAAK,CAAC;EAC1C,MAAM;CACR;AACF;AAEA,eAAsB,mBACpB,UACA,SACA,OACA,UAAkC,CAAC,GACpB;CACf,MAAM,sBAAsB,UAAU,CAAC;EAAE;EAAS;CAAM,CAAC,GAAG,OAAO;AACrE;AAEA,eAAsB,qBACpB,UACA,SACA,UAAkC,CAAC,GACpB;CACf,MAAM,sBAAsB,UAAU,CAAC,EAAE,QAAQ,CAAC,GAAG,OAAO;AAC9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"domains-BroCVHrS.mjs","names":["isRecord","requireRecord","optionalString","requireString","assertOnlyKeys"],"sources":["../src/services/pluginCatalog/index.ts","../src/services/domains/completion.ts","../src/services/domains/index.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport type {\n GitPluginSource,\n PluginCatalog,\n PluginCatalogEntry,\n PluginManifestMetadata,\n PluginSource,\n} from '../../types/domains';\n\nconst AGENT_PLUGIN_SCHEMA_PREFIX = 'https://agent-plugins.org/schemas/';\nconst CACHE_DIRECTORY = 'plugin-cache';\nconst PLUGIN_ID_SEGMENT = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\nconst NPM_PACKAGE_NAME = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/;\nconst LEGACY_PLUGIN_MANIFEST_PATHS = [\n '.codex-plugin/plugin.json',\n '.claude-plugin/plugin.json',\n '.cursor-plugin/plugin.json',\n] as const;\n\nexport const MARKETPLACE_MANIFEST_RELATIVE_PATHS = [\n '.agents/plugins/marketplace.json',\n '.agents/plugins/api_marketplace.json',\n '.claude-plugin/marketplace.json',\n '.cursor-plugin/marketplace.json',\n] as const;\n\nexport interface PluginCatalogConfigSource {\n filePath: string;\n baseDirectory: string;\n value: unknown;\n}\n\ninterface MarketplaceLocation {\n manifestPath: string;\n root: string;\n}\n\ninterface ParsedConfiguredEntry {\n source: PluginSource;\n description?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction requireRecord(value: unknown, label: string): Record<string, unknown> {\n if (!isRecord(value)) throw new Error(`${label} must be an object`);\n return value;\n}\n\nfunction optionalString(value: unknown, label: string): string | undefined {\n if (value === undefined) return undefined;\n if (typeof value !== 'string' || !value.trim()) throw new Error(`${label} must be a non-empty string`);\n return value.trim();\n}\n\nfunction requireString(value: unknown, label: string): string {\n const result = optionalString(value, label);\n if (!result) throw new Error(`${label} must be a non-empty string`);\n return result;\n}\n\nfunction assertOnlyKeys(record: Record<string, unknown>, allowed: readonly string[], label: string): void {\n const unexpected = Object.keys(record).filter((key) => !allowed.includes(key));\n if (unexpected.length > 0) throw new Error(`${label} contains unsupported field \"${unexpected[0]}\"`);\n}\n\nfunction validatePluginIdSegment(value: string, label: string): void {\n if (!PLUGIN_ID_SEGMENT.test(value)) {\n throw new Error(`${label} must start with an alphanumeric character and contain only alphanumerics, ., _, or -`);\n }\n}\n\nfunction validatePluginId(value: string, label: string): void {\n const segments = value.split('@');\n if (segments.length > 2 || segments.some((segment) => !PLUGIN_ID_SEGMENT.test(segment))) {\n throw new Error(`${label} must be a plugin name or plugin@marketplace identifier`);\n }\n}\n\nfunction normalizeRemoteSubdirectory(value: unknown, label: string): string | undefined {\n const raw = optionalString(value, label);\n if (!raw) return undefined;\n const normalized = raw.replaceAll('\\\\', '/').replace(/^\\.\\//, '');\n if (\n normalized.startsWith('/') ||\n normalized.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')\n ) {\n throw new Error(`${label} must stay within the remote repository root`);\n }\n return normalized;\n}\n\nfunction normalizeGitUrl(value: unknown, baseDirectory: string, label: string): string {\n const url = requireString(value, label);\n if (/^(?:https?|ssh|file):\\/\\//.test(url) || /^git@[^:]+:.+/.test(url) || path.isAbsolute(url)) return url;\n if (url.startsWith('./') || url.startsWith('.\\\\')) {\n const relative = url.replaceAll('\\\\', '/').slice(2);\n if (!relative || relative.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')) {\n throw new Error(`${label} must stay within its declaring root`);\n }\n return path.resolve(baseDirectory, relative);\n }\n if (/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+(?:\\.git)?$/.test(url)) {\n return `https://github.com/${url.endsWith('.git') ? url : `${url}.git`}`;\n }\n throw new Error(`${label} is not a supported Git URL`);\n}\n\nfunction resolveMarketplaceLocalPath(rawPath: string, marketplace: MarketplaceLocation, label: string): string {\n if (rawPath === '.' || rawPath === './') return marketplace.root;\n const cursorMarketplace = marketplace.manifestPath.endsWith('.cursor-plugin/marketplace.json');\n const relative = rawPath.startsWith('./') ? rawPath.slice(2) : cursorMarketplace ? rawPath : undefined;\n if (!relative) throw new Error(`${label} must start with ./`);\n const normalized = relative.replaceAll('\\\\', '/');\n if (normalized.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')) {\n throw new Error(`${label} must stay within the marketplace root`);\n }\n return path.resolve(marketplace.root, normalized);\n}\n\nfunction parseSourceObject(\n value: Record<string, unknown>,\n baseDirectory: string,\n label: string,\n marketplace?: MarketplaceLocation,\n): PluginSource {\n const sourceType = requireString(value.source, `${label}.source`);\n if (sourceType === 'local') {\n assertOnlyKeys(value, ['source', 'path', 'description'], label);\n const rawPath = requireString(value.path, `${label}.path`);\n return {\n type: 'local',\n path: marketplace\n ? resolveMarketplaceLocalPath(rawPath, marketplace, `${label}.path`)\n : path.resolve(baseDirectory, rawPath),\n };\n }\n if (sourceType === 'url' || sourceType === 'git-subdir') {\n assertOnlyKeys(value, ['source', 'url', 'path', 'ref', 'sha', 'description'], label);\n const remotePath = normalizeRemoteSubdirectory(value.path, `${label}.path`);\n if (sourceType === 'git-subdir' && !remotePath) {\n throw new Error(`${label}.path must be a non-empty string for git-subdir sources`);\n }\n const ref = optionalString(value.ref, `${label}.ref`);\n const sha = optionalString(value.sha, `${label}.sha`);\n return {\n type: 'git',\n url: normalizeGitUrl(value.url, marketplace?.root ?? baseDirectory, `${label}.url`),\n ...(remotePath ? { path: remotePath } : {}),\n ...(ref ? { ref } : {}),\n ...(sha ? { sha } : {}),\n };\n }\n if (sourceType === 'npm') {\n assertOnlyKeys(value, ['source', 'package', 'version', 'registry', 'description'], label);\n const packageName = requireString(value.package, `${label}.package`);\n if (!NPM_PACKAGE_NAME.test(packageName)) throw new Error(`${label}.package must be a valid npm package name`);\n const version = optionalString(value.version, `${label}.version`);\n const registry = optionalString(value.registry, `${label}.registry`);\n return {\n type: 'npm',\n package: packageName,\n ...(version ? { version } : {}),\n ...(registry ? { registry } : {}),\n };\n }\n throw new Error(`${label}.source must be local, url, git-subdir, or npm`);\n}\n\nfunction parsePluginSource(\n value: unknown,\n baseDirectory: string,\n label: string,\n marketplace?: MarketplaceLocation,\n): PluginSource {\n if (typeof value === 'string') {\n const rawPath = requireString(value, label);\n return {\n type: 'local',\n path: marketplace\n ? resolveMarketplaceLocalPath(rawPath, marketplace, label)\n : path.resolve(baseDirectory, rawPath),\n };\n }\n return parseSourceObject(requireRecord(value, label), baseDirectory, label, marketplace);\n}\n\nfunction parseConfiguredEntry(value: unknown, baseDirectory: string, label: string): ParsedConfiguredEntry {\n if (typeof value === 'string') return { source: parsePluginSource(value, baseDirectory, label) };\n const record = requireRecord(value, label);\n const description = optionalString(record.description, `${label}.description`);\n if (record.source === undefined && typeof record.path === 'string') {\n assertOnlyKeys(record, ['path', 'description'], label);\n return {\n source: { type: 'local', path: path.resolve(baseDirectory, requireString(record.path, `${label}.path`)) },\n ...(description ? { description } : {}),\n };\n }\n if (typeof record.source === 'string' && !['local', 'url', 'git-subdir', 'npm'].includes(record.source)) {\n assertOnlyKeys(record, ['source', 'description'], label);\n return {\n source: parsePluginSource(record.source, baseDirectory, `${label}.source`),\n ...(description ? { description } : {}),\n };\n }\n if (isRecord(record.source)) {\n assertOnlyKeys(record, ['source', 'description'], label);\n return {\n source: parsePluginSource(record.source, baseDirectory, `${label}.source`),\n ...(description ? { description } : {}),\n };\n }\n return {\n source: parseSourceObject(record, baseDirectory, label),\n ...(description ? { description } : {}),\n };\n}\n\nfunction marketplaceRootFromManifest(manifestPath: string): string | undefined {\n const normalized = path.resolve(manifestPath);\n for (const relativePath of MARKETPLACE_MANIFEST_RELATIVE_PATHS) {\n const suffix = path.normalize(relativePath);\n if (!normalized.endsWith(suffix)) continue;\n let root = normalized;\n for (const _segment of relativePath.split('/')) root = path.dirname(root);\n return root;\n }\n return undefined;\n}\n\nfunction findMarketplace(rootOrManifest: string): MarketplaceLocation | undefined {\n if (fs.existsSync(rootOrManifest) && fs.statSync(rootOrManifest).isFile()) {\n const root = marketplaceRootFromManifest(rootOrManifest);\n return root ? { manifestPath: path.resolve(rootOrManifest), root } : undefined;\n }\n for (const relativePath of MARKETPLACE_MANIFEST_RELATIVE_PATHS) {\n const manifestPath = path.join(rootOrManifest, relativePath);\n if (fs.existsSync(manifestPath) && fs.statSync(manifestPath).isFile()) {\n return { manifestPath: path.resolve(manifestPath), root: path.resolve(rootOrManifest) };\n }\n }\n return undefined;\n}\n\nfunction readJsonRecord(filePath: string, label: string): Record<string, unknown> {\n let parsed: unknown;\n try {\n parsed = JSON.parse(fs.readFileSync(filePath, 'utf8')) as unknown;\n } catch (error) {\n throw new Error(\n `${label} at ${filePath} is invalid JSON: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n return requireRecord(parsed, `${label} at ${filePath}`);\n}\n\n/** Matches Codex manifest precedence, including schema-gated root plugin.json. */\nexport function findPluginManifestPath(pluginRoot: string): string | undefined {\n const rootManifest = path.join(pluginRoot, 'plugin.json');\n try {\n const metadata = fs.lstatSync(rootManifest);\n if (metadata.isSymbolicLink() || !metadata.isFile()) return undefined;\n const parsed = JSON.parse(fs.readFileSync(rootManifest, 'utf8')) as unknown;\n const schema = isRecord(parsed) && typeof parsed.$schema === 'string' ? parsed.$schema : undefined;\n if (schema?.startsWith(AGENT_PLUGIN_SCHEMA_PREFIX)) return rootManifest;\n } catch {\n // A missing, unreadable, or unrelated root manifest does not outrank legacy manifests.\n }\n return LEGACY_PLUGIN_MANIFEST_PATHS.map((relativePath) => path.join(pluginRoot, relativePath)).find(\n (manifestPath) => fs.existsSync(manifestPath) && fs.statSync(manifestPath).isFile(),\n );\n}\n\nfunction readPluginManifestMetadata(pluginRoot: string, diagnostics: string[]): PluginManifestMetadata | undefined {\n const manifestPath = findPluginManifestPath(pluginRoot);\n if (!manifestPath) return undefined;\n try {\n const manifest = readJsonRecord(manifestPath, 'Plugin manifest');\n const schema = optionalString(manifest.$schema, `${manifestPath}.$schema`);\n const name = optionalString(manifest.name, `${manifestPath}.name`);\n const version = optionalString(manifest.version, `${manifestPath}.version`);\n const description = optionalString(manifest.description, `${manifestPath}.description`);\n return {\n path: manifestPath,\n ...(name ? { name } : {}),\n ...(version ? { version } : {}),\n ...(description ? { description } : {}),\n ...(schema?.startsWith(AGENT_PLUGIN_SCHEMA_PREFIX) ? { agentPluginSchema: schema } : {}),\n };\n } catch (error) {\n diagnostics.push(error instanceof Error ? error.message : String(error));\n return { path: manifestPath };\n }\n}\n\nfunction discoverPluginRoot(\n pluginRoot: string,\n entries: Record<string, PluginCatalogEntry>,\n diagnostics: string[],\n): boolean {\n const diagnosticCount = diagnostics.length;\n const manifest = readPluginManifestMetadata(pluginRoot, diagnostics);\n if (!manifest || diagnostics.length !== diagnosticCount) return false;\n const name = manifest.name ?? path.basename(pluginRoot);\n try {\n validatePluginIdSegment(name, `Plugin name in ${manifest.path}`);\n } catch (error) {\n diagnostics.push(error instanceof Error ? error.message : String(error));\n return false;\n }\n entries[name] = {\n source: { type: 'local', path: pluginRoot },\n ...(manifest.description ? { description: manifest.description } : {}),\n manifest,\n };\n return true;\n}\n\nfunction discoverPluginFolder(\n root: string,\n entries: Record<string, PluginCatalogEntry>,\n diagnostics: string[],\n): number {\n if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) return 0;\n if (findPluginManifestPath(root)) return discoverPluginRoot(root, entries, diagnostics) ? 1 : 0;\n\n let discovered = 0;\n const children = fs\n .readdirSync(root, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .sort((left, right) => left.name.localeCompare(right.name));\n for (const child of children) {\n if (discoverPluginRoot(path.join(root, child.name), entries, diagnostics)) discovered += 1;\n }\n return discovered;\n}\n\nfunction parseMarketplace(\n marketplace: MarketplaceLocation,\n entries: Record<string, PluginCatalogEntry>,\n diagnostics: string[],\n): void {\n const document = readJsonRecord(marketplace.manifestPath, 'Marketplace manifest');\n const marketplaceName = requireString(document.name, `${marketplace.manifestPath}.name`);\n validatePluginIdSegment(marketplaceName, `${marketplace.manifestPath}.name`);\n if (!Array.isArray(document.plugins)) throw new Error(`${marketplace.manifestPath}.plugins must be an array`);\n for (let index = 0; index < document.plugins.length; index += 1) {\n const label = `${marketplace.manifestPath}.plugins[${index}]`;\n try {\n const plugin = requireRecord(document.plugins[index], label);\n const pluginName = requireString(plugin.name, `${label}.name`);\n validatePluginIdSegment(pluginName, `${label}.name`);\n const id = `${pluginName}@${marketplaceName}`;\n if (Object.hasOwn(entries, id)) continue;\n const source = parsePluginSource(plugin.source, marketplace.root, `${label}.source`, marketplace);\n const description = optionalString(plugin.description, `${label}.description`);\n const manifest = source.type === 'local' ? readPluginManifestMetadata(source.path, diagnostics) : undefined;\n const resolvedDescription = description ?? manifest?.description;\n entries[id] = {\n source,\n marketplace: marketplaceName,\n ...(resolvedDescription ? { description: resolvedDescription } : {}),\n ...(manifest ? { manifest } : {}),\n };\n } catch (error) {\n diagnostics.push(error instanceof Error ? error.message : String(error));\n }\n }\n}\n\nfunction parseConfiguredRoots(source: PluginCatalogConfigSource): string[] {\n if (source.value === undefined) return [];\n const document = requireRecord(source.value, `plugins in ${source.filePath}`);\n assertOnlyKeys(document, ['roots', 'entries'], `plugins in ${source.filePath}`);\n if (document.roots === undefined) return [];\n if (!Array.isArray(document.roots)) throw new Error(`plugins.roots in ${source.filePath} must be an array`);\n return document.roots.map((root, index) =>\n path.resolve(source.baseDirectory, requireString(root, `plugins.roots[${index}] in ${source.filePath}`)),\n );\n}\n\nfunction applyConfiguredEntries(\n source: PluginCatalogConfigSource,\n entries: Record<string, PluginCatalogEntry>,\n diagnostics: string[],\n): void {\n if (source.value === undefined) return;\n const document = requireRecord(source.value, `plugins in ${source.filePath}`);\n if (document.entries === undefined) return;\n const configuredEntries = requireRecord(document.entries, `plugins.entries in ${source.filePath}`);\n for (const [name, value] of Object.entries(configuredEntries)) {\n validatePluginId(name, `Plugin entry \"${name}\" in ${source.filePath}`);\n const parsed = parseConfiguredEntry(value, source.baseDirectory, `plugins.entries.${name} in ${source.filePath}`);\n const manifest =\n parsed.source.type === 'local' ? readPluginManifestMetadata(parsed.source.path, diagnostics) : undefined;\n const description = parsed.description ?? manifest?.description;\n entries[name] = {\n source: parsed.source,\n ...(description ? { description } : {}),\n ...(manifest ? { manifest } : {}),\n };\n }\n}\n\nexport function pluginDirectoryForSource(source: PluginSource, homeDoomDirectory: string): string {\n if (source.type === 'local') return source.path;\n const identity =\n source.type === 'git'\n ? ['git', source.url, source.path ?? '', source.ref ?? '', source.sha ?? '']\n : ['npm', source.package, source.version ?? '', source.registry ?? ''];\n const digest = crypto.createHash('sha256').update(JSON.stringify(identity)).digest('hex');\n return path.join(homeDoomDirectory, CACHE_DIRECTORY, digest);\n}\n\nexport function loadPluginCatalog(\n sources: readonly PluginCatalogConfigSource[],\n repoRoot: string,\n homeDirectory: string,\n): PluginCatalog {\n const diagnostics: string[] = [];\n const entries: Record<string, PluginCatalogEntry> = {};\n const roots = [...new Set(sources.flatMap(parseConfiguredRoots))];\n const candidates = [homeDirectory, repoRoot, ...roots];\n const marketplaces: string[] = [];\n const seenMarketplaces = new Set<string>();\n\n for (const candidate of candidates) {\n const marketplace = findMarketplace(candidate);\n if (!marketplace) continue;\n if (seenMarketplaces.has(marketplace.manifestPath)) continue;\n seenMarketplaces.add(marketplace.manifestPath);\n marketplaces.push(marketplace.manifestPath);\n try {\n parseMarketplace(marketplace, entries, diagnostics);\n } catch (error) {\n diagnostics.push(error instanceof Error ? error.message : String(error));\n }\n }\n\n for (const root of roots) {\n if (findMarketplace(root)) continue;\n if (discoverPluginFolder(root, entries, diagnostics) === 0) {\n diagnostics.push(`Plugin root contains neither a supported marketplace nor discoverable plugins: ${root}`);\n }\n }\n\n for (const source of sources) applyConfiguredEntries(source, entries, diagnostics);\n return { roots, marketplaces, entries, diagnostics };\n}\n\nexport function isRemotePluginSource(\n source: PluginSource,\n): source is GitPluginSource | Extract<PluginSource, { type: 'npm' }> {\n return source.type !== 'local';\n}\n","import type { DomainManifest } from '../../types/domains';\n\nconst NAME_DELIMITER = ',';\n\n/** Splits comma-joined selections and expands aliases into concrete domain names. */\nexport function expandDomainNames(manifest: DomainManifest, domainNames: readonly string[]): string[] {\n return domainNames\n .flatMap((raw) =>\n raw\n .split(NAME_DELIMITER)\n .map((name) => name.trim())\n .filter(Boolean),\n )\n .flatMap((name) => manifest.aliases[name] ?? [name]);\n}\n\nexport function domainCompletionPrefix(textBeforeCursor: string): string | undefined {\n const match = textBeforeCursor.match(/^\\/domains\\s+(?:[^\\s,]+,)*([^\\s,]*)$/);\n return match?.[1];\n}\n\nexport function domainCompletionItems(domainNames: string[], query: string): Array<{ value: string; label: string }> {\n const normalizedQuery = query.toLowerCase();\n return domainNames\n .filter((name) => name.toLowerCase().startsWith(normalizedQuery))\n .map((name) => ({ value: name, label: name }));\n}\n","import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport type {\n DomainDefinition,\n DomainManifest,\n DomainMcpAllowlist,\n DomainPlugin,\n PluginEntry,\n ResolvedDomain,\n} from '../../types/domains';\nimport { globalDoomConfigDirectory } from '../config';\nimport { readDoomConfigSources } from '../layeredConfig';\nimport { loadPluginCatalog, pluginDirectoryForSource } from '../pluginCatalog';\nimport { expandDomainNames } from './completion';\n\nexport { DOOM_DIR } from '../layeredConfig';\n\nconst DOMAINS_FILE = 'domains.yaml';\nconst UNKNOWN_DOMAIN_ERROR = 'Unknown domain';\nconst UNKNOWN_PLUGIN_ERROR = 'Unknown plugin';\nconst MISSING_PLUGIN_DIRECTORY_ERROR = 'Plugin directory does not exist';\nconst DEFAULT_DOMAINS_PATH = '.po/domains.yaml';\nconst SUPPORTED_AGENT_PLUGIN_SCHEMA = 'https://agent-plugins.org/schemas/1.0.0/plugin.schema.json';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction requireRecord(value: unknown, label: string): Record<string, unknown> {\n if (!isRecord(value)) throw new Error(`${label} must be an object`);\n return value;\n}\n\nfunction assertOnlyKeys(record: Record<string, unknown>, allowed: readonly string[], label: string): void {\n const unexpected = Object.keys(record).filter((key) => !allowed.includes(key));\n if (unexpected.length > 0) throw new Error(`${label} contains unsupported field \"${unexpected[0]}\"`);\n}\n\nfunction requireString(value: unknown, label: string): string {\n if (typeof value !== 'string' || !value.trim()) throw new Error(`${label} must be a non-empty string`);\n return value.trim();\n}\n\nfunction optionalString(value: unknown, label: string): string | undefined {\n if (value === undefined) return undefined;\n return requireString(value, label);\n}\n\nfunction parseStringArray(value: unknown, label: string): string[] {\n if (!Array.isArray(value)) throw new Error(`${label} must be an array of non-empty strings`);\n return [...new Set(value.map((entry, index) => requireString(entry, `${label}[${index}]`)))];\n}\n\nfunction parseOptionalBoolean(value: unknown, label: string): boolean | undefined {\n if (value === undefined) return undefined;\n if (typeof value !== 'boolean') throw new Error(`${label} must be a boolean`);\n return value;\n}\n\nfunction parseDefaultDomains(value: unknown): string[] {\n return parseStringArray(value, `defaultDomains in ${DEFAULT_DOMAINS_PATH}`);\n}\n\nfunction parseDomainPlugin(value: unknown, label: string): DomainPlugin {\n if (typeof value === 'string') return requireString(value, label);\n const plugin = requireRecord(value, label);\n assertOnlyKeys(plugin, ['name', 'skills', 'agents', 'hooks', 'mcp'], label);\n const skills = plugin.skills === undefined ? undefined : parseStringArray(plugin.skills, `${label}.skills`);\n const agents = plugin.agents === undefined ? undefined : parseStringArray(plugin.agents, `${label}.agents`);\n const hooks = parseOptionalBoolean(plugin.hooks, `${label}.hooks`);\n const mcp = parseOptionalBoolean(plugin.mcp, `${label}.mcp`);\n return {\n name: requireString(plugin.name, `${label}.name`),\n ...(skills ? { skills } : {}),\n ...(agents ? { agents } : {}),\n ...(hooks === undefined ? {} : { hooks }),\n ...(mcp === undefined ? {} : { mcp }),\n };\n}\n\nfunction parseMcpAllowlist(value: unknown, label: string): DomainMcpAllowlist {\n const mcp = requireRecord(value, label);\n assertOnlyKeys(mcp, ['servers', 'proxy'], label);\n return {\n ...(mcp.servers === undefined ? {} : { servers: parseStringArray(mcp.servers, `${label}.servers`) }),\n ...(mcp.proxy === undefined ? {} : { proxy: parseStringArray(mcp.proxy, `${label}.proxy`) }),\n };\n}\n\nfunction parseDomain(value: unknown, label: string): DomainDefinition {\n const domain = requireRecord(value, label);\n assertOnlyKeys(domain, ['description', 'plugins', 'mcp', 'sharedSkills'], label);\n const description = optionalString(domain.description, `${label}.description`);\n if (domain.plugins !== undefined && !Array.isArray(domain.plugins)) {\n throw new Error(`${label}.plugins must be an array`);\n }\n const sharedSkills = parseOptionalBoolean(domain.sharedSkills, `${label}.sharedSkills`);\n return {\n ...(description ? { description } : {}),\n ...(Array.isArray(domain.plugins)\n ? { plugins: domain.plugins.map((plugin, index) => parseDomainPlugin(plugin, `${label}.plugins[${index}]`)) }\n : {}),\n ...(domain.mcp === undefined ? {} : { mcp: parseMcpAllowlist(domain.mcp, `${label}.mcp`) }),\n ...(sharedSkills === undefined ? {} : { sharedSkills }),\n };\n}\n\nfunction parseAliases(value: unknown, label: string): Record<string, string[]> {\n if (value === undefined) return {};\n const aliases = requireRecord(value, label);\n return Object.fromEntries(\n Object.entries(aliases).map(([name, domains]) => [name, parseStringArray(domains, `${label}.${name}`)]),\n );\n}\n\n/**\n * Reads domains and plugin catalogs from global and repository configs.\n *\n * Named domains and explicit plugin entries are replaced by later repository\n * definitions. Configured roots accumulate, with exact marketplace manifests\n * deduplicated in discovery order. Explicit entries override discovered IDs.\n */\nexport function loadDomains(repoRoot: string, homeDirectory: string = os.homedir()): DomainManifest {\n const sources = readDoomConfigSources<unknown>(DOMAINS_FILE, repoRoot, homeDirectory);\n const aliases: Record<string, string[]> = {};\n const domains: Record<string, ResolvedDomain> = {};\n let defaultDomains: string[] | undefined;\n\n for (const source of sources) {\n const document = requireRecord(source.document, source.filePath);\n assertOnlyKeys(document, ['plugins', 'domains', 'aliases', 'defaultDomains'], source.filePath);\n Object.assign(aliases, parseAliases(document.aliases, `aliases in ${source.filePath}`));\n if (document.domains !== undefined) {\n const sourceDomains = requireRecord(document.domains, `domains in ${source.filePath}`);\n for (const [name, definition] of Object.entries(sourceDomains)) {\n domains[name] = {\n ...parseDomain(definition, `domains.${name} in ${source.filePath}`),\n baseDirectory: source.baseDirectory,\n };\n }\n }\n if (Object.hasOwn(document, 'defaultDomains')) defaultDomains = parseDefaultDomains(document.defaultDomains);\n }\n\n const plugins = loadPluginCatalog(\n sources.map((source) => ({\n filePath: source.filePath,\n baseDirectory: source.baseDirectory,\n value: requireRecord(source.document, source.filePath).plugins,\n })),\n repoRoot,\n homeDirectory,\n );\n\n if (defaultDomains) {\n for (const name of expandDomainNames({ plugins, domains, aliases }, defaultDomains)) {\n if (!Object.hasOwn(domains, name)) {\n throw new Error(`Unknown default domain \"${name}\" in ${DEFAULT_DOMAINS_PATH}`);\n }\n }\n }\n return { plugins, domains, aliases, ...(defaultDomains ? { defaultDomains } : {}) };\n}\n\nexport function listDomainNames(repoRoot: string, homeDirectory?: string): string[] {\n const manifest = loadDomains(repoRoot, homeDirectory);\n return [...new Set([...Object.keys(manifest.domains), ...Object.keys(manifest.aliases)])].sort();\n}\n\n/**\n * Whether to include .claude/skills as shared fallbacks.\n *\n * Shared skills are included unless every selected domain opts out, so mixing a\n * trimmed domain with an untrimmed one cannot strip the untrimmed one's skills.\n */\nexport function resolveSharedSkills(repoRoot: string, domainNames: string[], homeDirectory?: string): boolean {\n const manifest = loadDomains(repoRoot, homeDirectory);\n const expanded = expandDomainNames(manifest, domainNames);\n if (expanded.length === 0) return true;\n return expanded.some((name) => manifest.domains[name]?.sharedSkills !== false);\n}\n\n/** Resolves named domain plugins while preserving each subset filter. */\nexport function resolvePluginEntries(\n repoRoot: string,\n domainNames: string[],\n explicitDirectories: string[],\n homeDirectory: string = os.homedir(),\n): PluginEntry[] {\n const manifest = loadDomains(repoRoot, homeDirectory);\n const entries: PluginEntry[] = [];\n const seen = new Set<string>();\n const homeDoomDirectory = globalDoomConfigDirectory(homeDirectory);\n\n for (const domainName of expandDomainNames(manifest, domainNames)) {\n const domain = manifest.domains[domainName];\n if (!domain) throw new Error(`${UNKNOWN_DOMAIN_ERROR}: ${domainName}`);\n for (const selection of domain.plugins ?? []) {\n const isSubset = typeof selection !== 'string';\n const pluginName = isSubset ? selection.name : selection;\n const plugin = manifest.plugins.entries[pluginName];\n if (!plugin) throw new Error(`${UNKNOWN_PLUGIN_ERROR} \"${pluginName}\" referenced by domain \"${domainName}\"`);\n const directory = pluginDirectoryForSource(plugin.source, homeDoomDirectory);\n if (plugin.source.type === 'local' && (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory())) {\n throw new Error(`${MISSING_PLUGIN_DIRECTORY_ERROR}: ${directory}`);\n }\n if (seen.has(directory)) continue;\n seen.add(directory);\n entries.push({\n name: pluginName,\n directory,\n // The domain is only in scope here. `resolvePluginDirectories` keeps\n // just the path, so anything downstream that wants to say which domain\n // brought a plugin has to be told now or not at all.\n domain: domainName,\n source: plugin.source,\n ...(plugin.manifest ? { manifest: plugin.manifest } : {}),\n ...(plugin.manifest?.agentPluginSchema === SUPPORTED_AGENT_PLUGIN_SCHEMA\n ? { skillDiscovery: 'direct-children' as const }\n : {}),\n ...(isSubset && selection.skills ? { skills: selection.skills } : {}),\n ...(isSubset && selection.agents ? { agents: selection.agents } : {}),\n ...(isSubset && selection.hooks !== undefined ? { hooks: selection.hooks } : {}),\n ...(isSubset && selection.mcp !== undefined ? { mcp: selection.mcp } : {}),\n });\n }\n }\n\n for (const configuredDirectory of explicitDirectories) {\n const directory = path.resolve(configuredDirectory);\n if (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory()) {\n throw new Error(`${MISSING_PLUGIN_DIRECTORY_ERROR}: ${directory}`);\n }\n if (seen.has(directory)) continue;\n seen.add(directory);\n entries.push({\n name: path.basename(directory),\n directory,\n source: { type: 'local', path: directory },\n });\n }\n return entries;\n}\n\nexport function resolvePluginDirectories(\n repoRoot: string,\n domainNames: string[],\n explicitDirectories: string[],\n homeDirectory?: string,\n): string[] {\n return resolvePluginEntries(repoRoot, domainNames, explicitDirectories, homeDirectory).map(\n (entry) => entry.directory,\n );\n}\n\nexport const PO_DOMAINS_ENV = 'PO_DOMAINS';\nexport const DEFAULT_DOMAIN = 'default';\nconst MARKETING_MAJOR_MODE = 'marketing';\n\nfunction parseDomainList(value: string): string[] {\n return value\n .split(',')\n .map((entry) => entry.trim())\n .filter(Boolean);\n}\n\n/**\n * Domains selected when the caller names none.\n *\n * Configuration keeps this axis independent of the major mode. The\n * major-mode-derived choice is retained only as the compatibility fallback for\n * domains files that declare no defaultDomains.\n */\nexport function defaultDomainsForMajorMode(\n majorMode: string,\n environment: NodeJS.ProcessEnv,\n defaultDomains?: readonly string[],\n): string[] {\n const inherited = environment[PO_DOMAINS_ENV];\n // An explicitly empty variable means no domains, so this tests for the key\n // rather than for a truthy value.\n if (inherited !== undefined) return parseDomainList(inherited);\n if (defaultDomains !== undefined) return [...defaultDomains];\n return parseDomainList(majorMode === MARKETING_MAJOR_MODE ? MARKETING_MAJOR_MODE : DEFAULT_DOMAIN);\n}\n"],"mappings":";;;;;;;AAYA,MAAM,6BAA6B;AACnC,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAC1B,MAAM,m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ACnE,MAAM,IAAI,MAAM,GAAG,+BAA+B,IAAI,WAAW;EAEnE,IAAI,KAAK,IAAI,SAAS,GAAG;EACzB,KAAK,IAAI,SAAS;EAClB,QAAQ,KAAK;GACX,MAAM,KAAK,SAAS,SAAS;GAC7B;GACA,QAAQ;IAAE,MAAM;IAAS,MAAM;GAAU;EAC3C,CAAC;CACH;CACA,OAAO;AACT;AAEA,SAAgB,yBACd,UACA,aACA,qBACA,eACU;CACV,OAAO,qBAAqB,UAAU,aAAa,qBAAqB,aAAa,CAAC,CAAC,KACpF,UAAU,MAAM,SACnB;AACF;AAEA,MAAa,iBAAiB;AAC9B,MAAa,iBAAiB;AAC9B,MAAM,uBAAuB;AAE7B,SAAS,gBAAgB,OAAyB;CAChD,OAAO,MACJ,MAAM,GAAG,CAAC,CACV,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;AACnB;;;;;;;;AASA,SAAgB,2BACd,WACA,aACA,gBACU;CACV,MAAM,YAAY,YAAY;CAG9B,IAAI,cAAc,KAAA,GAAW,OAAO,gBAAgB,SAAS;CAC7D,IAAI,mBAAmB,KAAA,GAAW,OAAO,CAAC,GAAG,cAAc;CAC3D,OAAO,gBAAgB,cAAc,uBAAuB,uBAAuB,cAAc;AACnG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"domains-DGCb7uMC.cjs","names":["isRecord","requireRecord","optionalString","requireString","assertOnlyKeys","path","fs","crypto","os","readDoomConfigSources","globalDoomConfigDirectory","fs","path"],"sources":["../src/services/pluginCatalog/index.ts","../src/services/domains/completion.ts","../src/services/domains/index.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport type {\n GitPluginSource,\n PluginCatalog,\n PluginCatalogEntry,\n PluginManifestMetadata,\n PluginSource,\n} from '../../types/domains';\n\nconst AGENT_PLUGIN_SCHEMA_PREFIX = 'https://agent-plugins.org/schemas/';\nconst CACHE_DIRECTORY = 'plugin-cache';\nconst PLUGIN_ID_SEGMENT = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\nconst NPM_PACKAGE_NAME = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/;\nconst LEGACY_PLUGIN_MANIFEST_PATHS = [\n '.codex-plugin/plugin.json',\n '.claude-plugin/plugin.json',\n '.cursor-plugin/plugin.json',\n] as const;\n\nexport const MARKETPLACE_MANIFEST_RELATIVE_PATHS = [\n '.agents/plugins/marketplace.json',\n '.agents/plugins/api_marketplace.json',\n '.claude-plugin/marketplace.json',\n '.cursor-plugin/marketplace.json',\n] as const;\n\nexport interface PluginCatalogConfigSource {\n filePath: string;\n baseDirectory: string;\n value: unknown;\n}\n\ninterface MarketplaceLocation {\n manifestPath: string;\n root: string;\n}\n\ninterface ParsedConfiguredEntry {\n source: PluginSource;\n description?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction requireRecord(value: unknown, label: string): Record<string, unknown> {\n if (!isRecord(value)) throw new Error(`${label} must be an object`);\n return value;\n}\n\nfunction optionalString(value: unknown, label: string): string | undefined {\n if (value === undefined) return undefined;\n if (typeof value !== 'string' || !value.trim()) throw new Error(`${label} must be a non-empty string`);\n return value.trim();\n}\n\nfunction requireString(value: unknown, label: string): string {\n const result = optionalString(value, label);\n if (!result) throw new Error(`${label} must be a non-empty string`);\n return result;\n}\n\nfunction assertOnlyKeys(record: Record<string, unknown>, allowed: readonly string[], label: string): void {\n const unexpected = Object.keys(record).filter((key) => !allowed.includes(key));\n if (unexpected.length > 0) throw new Error(`${label} contains unsupported field \"${unexpected[0]}\"`);\n}\n\nfunction validatePluginIdSegment(value: string, label: string): void {\n if (!PLUGIN_ID_SEGMENT.test(value)) {\n throw new Error(`${label} must start with an alphanumeric character and contain only alphanumerics, ., _, or -`);\n }\n}\n\nfunction validatePluginId(value: string, label: string): void {\n const segments = value.split('@');\n if (segments.length > 2 || segments.some((segment) => !PLUGIN_ID_SEGMENT.test(segment))) {\n throw new Error(`${label} must be a plugin name or plugin@marketplace identifier`);\n }\n}\n\nfunction normalizeRemoteSubdirectory(value: unknown, label: string): string | undefined {\n const raw = optionalString(value, label);\n if (!raw) return undefined;\n const normalized = raw.replaceAll('\\\\', '/').replace(/^\\.\\//, '');\n if (\n normalized.startsWith('/') ||\n normalized.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')\n ) {\n throw new Error(`${label} must stay within the remote repository root`);\n }\n return normalized;\n}\n\nfunction normalizeGitUrl(value: unknown, baseDirectory: string, label: string): string {\n const url = requireString(value, label);\n if (/^(?:https?|ssh|file):\\/\\//.test(url) || /^git@[^:]+:.+/.test(url) || path.isAbsolute(url)) return url;\n if (url.startsWith('./') || url.startsWith('.\\\\')) {\n const relative = url.replaceAll('\\\\', '/').slice(2);\n if (!relative || relative.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')) {\n throw new Error(`${label} must stay within its declaring root`);\n }\n return path.resolve(baseDirectory, relative);\n }\n if (/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+(?:\\.git)?$/.test(url)) {\n return `https://github.com/${url.endsWith('.git') ? url : `${url}.git`}`;\n }\n throw new Error(`${label} is not a supported Git URL`);\n}\n\nfunction resolveMarketplaceLocalPath(rawPath: string, marketplace: MarketplaceLocation, label: string): string {\n if (rawPath === '.' || rawPath === './') return marketplace.root;\n const cursorMarketplace = marketplace.manifestPath.endsWith('.cursor-plugin/marketplace.json');\n const relative = rawPath.startsWith('./') ? rawPath.slice(2) : cursorMarketplace ? rawPath : undefined;\n if (!relative) throw new Error(`${label} must start with ./`);\n const normalized = relative.replaceAll('\\\\', '/');\n if (normalized.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')) {\n throw new Error(`${label} must stay within the marketplace root`);\n }\n return path.resolve(marketplace.root, normalized);\n}\n\nfunction parseSourceObject(\n value: Record<string, unknown>,\n baseDirectory: string,\n label: string,\n marketplace?: MarketplaceLocation,\n): PluginSource {\n const sourceType = requireString(value.source, `${label}.source`);\n if (sourceType === 'local') {\n assertOnlyKeys(value, ['source', 'path', 'description'], label);\n const rawPath = requireString(value.path, `${label}.path`);\n return {\n type: 'local',\n path: marketplace\n ? resolveMarketplaceLocalPath(rawPath, marketplace, `${label}.path`)\n : path.resolve(baseDirectory, rawPath),\n };\n }\n if (sourceType === 'url' || sourceType === 'git-subdir') {\n assertOnlyKeys(value, ['source', 'url', 'path', 'ref', 'sha', 'description'], label);\n const remotePath = normalizeRemoteSubdirectory(value.path, `${label}.path`);\n if (sourceType === 'git-subdir' && !remotePath) {\n throw new Error(`${label}.path must be a non-empty string for git-subdir sources`);\n }\n const ref = optionalString(value.ref, `${label}.ref`);\n const sha = optionalString(value.sha, `${label}.sha`);\n return {\n type: 'git',\n url: normalizeGitUrl(value.url, marketplace?.root ?? baseDirectory, `${label}.url`),\n ...(remotePath ? { path: remotePath } : {}),\n ...(ref ? { ref } : {}),\n ...(sha ? { sha } : {}),\n };\n }\n if (sourceType === 'npm') {\n assertOnlyKeys(value, ['source', 'package', 'version', 'registry', 'description'], label);\n const packageName = requireString(value.package, `${label}.package`);\n if (!NPM_PACKAGE_NAME.test(packageName)) throw new Error(`${label}.package must be a valid npm package name`);\n const version = optionalString(value.version, `${label}.version`);\n const registry = optionalString(value.registry, `${label}.registry`);\n return {\n type: 'npm',\n package: packageName,\n ...(version ? { version } : {}),\n ...(registry ? { registry } : {}),\n };\n }\n throw new Error(`${label}.source must be local, url, git-subdir, or npm`);\n}\n\nfunction parsePluginSource(\n value: unknown,\n baseDirectory: string,\n label: string,\n marketplace?: MarketplaceLocation,\n): PluginSource {\n if (typeof value === 'string') {\n const rawPath = requireString(value, label);\n return {\n type: 'local',\n path: marketplace\n ? resolveMarketplaceLocalPath(rawPath, marketplace, label)\n : path.resolve(baseDirectory, rawPath),\n };\n }\n return parseSourceObject(requireRecord(value, label), baseDirectory, label, marketplace);\n}\n\nfunction parseConfiguredEntry(value: unknown, baseDirectory: string, label: string): ParsedConfiguredEntry {\n if (typeof value === 'string') return { source: parsePluginSource(value, baseDirectory, label) };\n const record = requireRecord(value, label);\n const description = optionalString(record.description, `${label}.description`);\n if (record.source === undefined && typeof record.path === 'string') {\n assertOnlyKeys(record, ['path', 'description'], label);\n return {\n source: { type: 'local', path: path.resolve(baseDirectory, requireString(record.path, `${label}.path`)) },\n ...(description ? { description } : {}),\n };\n }\n if (typeof record.source === 'string' && !['local', 'url', 'git-subdir', 'npm'].includes(record.source)) {\n assertOnlyKeys(record, ['source', 'description'], label);\n return {\n source: parsePluginSource(record.source, baseDirectory, `${label}.source`),\n ...(description ? { description } : {}),\n };\n }\n if (isRecord(record.source)) {\n assertOnlyKeys(record, ['source', 'description'], label);\n return {\n source: parsePluginSource(record.source, baseDirectory, `${label}.source`),\n ...(description ? { description } : {}),\n };\n }\n return {\n source: parseSourceObject(record, baseDirectory, label),\n ...(description ? { description } : {}),\n };\n}\n\nfunction marketplaceRootFromManifest(manifestPath: string): string | undefined {\n const normalized = path.resolve(manifestPath);\n for (const relativePath of MARKETPLACE_MANIFEST_RELATIVE_PATHS) {\n const suffix = path.normalize(relativePath);\n if (!normalized.endsWith(suffix)) continue;\n let root = normalized;\n for (const _segment of relativePath.split('/')) root = path.dirname(root);\n return root;\n }\n return undefined;\n}\n\nfunction findMarketplace(rootOrManifest: string): MarketplaceLocation | undefined {\n if (fs.existsSync(rootOrManifest) && fs.statSync(rootOrManifest).isFile()) {\n const root = marketplaceRootFromManifest(rootOrManifest);\n return root ? { manifestPath: path.resolve(rootOrManifest), root } : undefined;\n }\n for (const relativePath of MARKETPLACE_MANIFEST_RELATIVE_PATHS) {\n const manifestPath = path.join(rootOrManifest, relativePath);\n if (fs.existsSync(manifestPath) && fs.statSync(manifestPath).isFile()) {\n return { manifestPath: path.resolve(manifestPath), root: path.resolve(rootOrManifest) };\n }\n }\n return undefined;\n}\n\nfunction readJsonRecord(filePath: string, label: string): Record<string, unknown> {\n let parsed: unknown;\n try {\n parsed = JSON.parse(fs.readFileSync(filePath, 'utf8')) as unknown;\n } catch (error) {\n throw new Error(\n `${label} at ${filePath} is invalid JSON: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n return requireRecord(parsed, `${label} at ${filePath}`);\n}\n\n/** Matches Codex manifest precedence, including schema-gated root plugin.json. */\nexport function findPluginManifestPath(pluginRoot: string): string | undefined {\n const rootManifest = path.join(pluginRoot, 'plugin.json');\n try {\n const metadata = fs.lstatSync(rootManifest);\n if (metadata.isSymbolicLink() || !metadata.isFile()) return undefined;\n const parsed = JSON.parse(fs.readFileSync(rootManifest, 'utf8')) as unknown;\n const schema = isRecord(parsed) && typeof parsed.$schema === 'string' ? parsed.$schema : undefined;\n if (schema?.startsWith(AGENT_PLUGIN_SCHEMA_PREFIX)) return rootManifest;\n } catch {\n // A missing, unreadable, or unrelated root manifest does not outrank legacy manifests.\n }\n return LEGACY_PLUGIN_MANIFEST_PATHS.map((relativePath) => path.join(pluginRoot, relativePath)).find(\n (manifestPath) => fs.existsSync(manifestPath) && fs.statSync(manifestPath).isFile(),\n );\n}\n\nfunction readPluginManifestMetadata(pluginRoot: string, diagnostics: string[]): PluginManifestMetadata | undefined {\n const manifestPath = findPluginManifestPath(pluginRoot);\n if (!manifestPath) return undefined;\n try {\n const manifest = readJsonRecord(manifestPath, 'Plugin manifest');\n const schema = optionalString(manifest.$schema, `${manifestPath}.$schema`);\n const name = optionalString(manifest.name, `${manifestPath}.name`);\n const version = optionalString(manifest.version, `${manifestPath}.version`);\n const description = optionalString(manifest.description, `${manifestPath}.description`);\n return {\n path: manifestPath,\n ...(name ? { name } : {}),\n ...(version ? { version } : {}),\n ...(description ? { description } : {}),\n ...(schema?.startsWith(AGENT_PLUGIN_SCHEMA_PREFIX) ? { agentPluginSchema: schema } : {}),\n };\n } catch (error) {\n diagnostics.push(error instanceof Error ? error.message : String(error));\n return { path: manifestPath };\n }\n}\n\nfunction discoverPluginRoot(\n pluginRoot: string,\n entries: Record<string, PluginCatalogEntry>,\n diagnostics: string[],\n): boolean {\n const diagnosticCount = diagnostics.length;\n const manifest = readPluginManifestMetadata(pluginRoot, diagnostics);\n if (!manifest || diagnostics.length !== diagnosticCount) return false;\n const name = manifest.name ?? path.basename(pluginRoot);\n try {\n validatePluginIdSegment(name, `Plugin name in ${manifest.path}`);\n } catch (error) {\n diagnostics.push(error instanceof Error ? error.message : String(error));\n return false;\n }\n entries[name] = {\n source: { type: 'local', path: pluginRoot },\n ...(manifest.description ? { description: manifest.description } : {}),\n manifest,\n };\n return true;\n}\n\nfunction discoverPluginFolder(\n root: string,\n entries: Record<string, PluginCatalogEntry>,\n diagnostics: string[],\n): number {\n if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) return 0;\n if (findPluginManifestPath(root)) return discoverPluginRoot(root, entries, diagnostics) ? 1 : 0;\n\n let discovered = 0;\n const children = fs\n .readdirSync(root, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .sort((left, right) => left.name.localeCompare(right.name));\n for (const child of children) {\n if (discoverPluginRoot(path.join(root, child.name), entries, diagnostics)) discovered += 1;\n }\n return discovered;\n}\n\nfunction parseMarketplace(\n marketplace: MarketplaceLocation,\n entries: Record<string, PluginCatalogEntry>,\n diagnostics: string[],\n): void {\n const document = readJsonRecord(marketplace.manifestPath, 'Marketplace manifest');\n const marketplaceName = requireString(document.name, `${marketplace.manifestPath}.name`);\n validatePluginIdSegment(marketplaceName, `${marketplace.manifestPath}.name`);\n if (!Array.isArray(document.plugins)) throw new Error(`${marketplace.manifestPath}.plugins must be an array`);\n for (let index = 0; index < document.plugins.length; index += 1) {\n const label = `${marketplace.manifestPath}.plugins[${index}]`;\n try {\n const plugin = requireRecord(document.plugins[index], label);\n const pluginName = requireString(plugin.name, `${label}.name`);\n validatePluginIdSegment(pluginName, `${label}.name`);\n const id = `${pluginName}@${marketplaceName}`;\n if (Object.hasOwn(entries, id)) continue;\n const source = parsePluginSource(plugin.source, marketplace.root, `${label}.source`, marketplace);\n const description = optionalString(plugin.description, `${label}.description`);\n const manifest = source.type === 'local' ? readPluginManifestMetadata(source.path, diagnostics) : undefined;\n const resolvedDescription = description ?? manifest?.description;\n entries[id] = {\n source,\n marketplace: marketplaceName,\n ...(resolvedDescription ? { description: resolvedDescription } : {}),\n ...(manifest ? { manifest } : {}),\n };\n } catch (error) {\n diagnostics.push(error instanceof Error ? error.message : String(error));\n }\n }\n}\n\nfunction parseConfiguredRoots(source: PluginCatalogConfigSource): string[] {\n if (source.value === undefined) return [];\n const document = requireRecord(source.value, `plugins in ${source.filePath}`);\n assertOnlyKeys(document, ['roots', 'entries'], `plugins in ${source.filePath}`);\n if (document.roots === undefined) return [];\n if (!Array.isArray(document.roots)) throw new Error(`plugins.roots in ${source.filePath} must be an array`);\n return document.roots.map((root, index) =>\n path.resolve(source.baseDirectory, requireString(root, `plugins.roots[${index}] in ${source.filePath}`)),\n );\n}\n\nfunction applyConfiguredEntries(\n source: PluginCatalogConfigSource,\n entries: Record<string, PluginCatalogEntry>,\n diagnostics: string[],\n): void {\n if (source.value === undefined) return;\n const document = requireRecord(source.value, `plugins in ${source.filePath}`);\n if (document.entries === undefined) return;\n const configuredEntries = requireRecord(document.entries, `plugins.entries in ${source.filePath}`);\n for (const [name, value] of Object.entries(configuredEntries)) {\n validatePluginId(name, `Plugin entry \"${name}\" in ${source.filePath}`);\n const parsed = parseConfiguredEntry(value, source.baseDirectory, `plugins.entries.${name} in ${source.filePath}`);\n const manifest =\n parsed.source.type === 'local' ? readPluginManifestMetadata(parsed.source.path, diagnostics) : undefined;\n const description = parsed.description ?? manifest?.description;\n entries[name] = {\n source: parsed.source,\n ...(description ? { description } : {}),\n ...(manifest ? { manifest } : {}),\n };\n }\n}\n\nexport function pluginDirectoryForSource(source: PluginSource, homeDoomDirectory: string): string {\n if (source.type === 'local') return source.path;\n const identity =\n source.type === 'git'\n ? ['git', source.url, source.path ?? '', source.ref ?? '', source.sha ?? '']\n : ['npm', source.package, source.version ?? '', source.registry ?? ''];\n const digest = crypto.createHash('sha256').update(JSON.stringify(identity)).digest('hex');\n return path.join(homeDoomDirectory, CACHE_DIRECTORY, digest);\n}\n\nexport function loadPluginCatalog(\n sources: readonly PluginCatalogConfigSource[],\n repoRoot: string,\n homeDirectory: string,\n): PluginCatalog {\n const diagnostics: string[] = [];\n const entries: Record<string, PluginCatalogEntry> = {};\n const roots = [...new Set(sources.flatMap(parseConfiguredRoots))];\n const candidates = [homeDirectory, repoRoot, ...roots];\n const marketplaces: string[] = [];\n const seenMarketplaces = new Set<string>();\n\n for (const candidate of candidates) {\n const marketplace = findMarketplace(candidate);\n if (!marketplace) continue;\n if (seenMarketplaces.has(marketplace.manifestPath)) continue;\n seenMarketplaces.add(marketplace.manifestPath);\n marketplaces.push(marketplace.manifestPath);\n try {\n parseMarketplace(marketplace, entries, diagnostics);\n } catch (error) {\n diagnostics.push(error instanceof Error ? error.message : String(error));\n }\n }\n\n for (const root of roots) {\n if (findMarketplace(root)) continue;\n if (discoverPluginFolder(root, entries, diagnostics) === 0) {\n diagnostics.push(`Plugin root contains neither a supported marketplace nor discoverable plugins: ${root}`);\n }\n }\n\n for (const source of sources) applyConfiguredEntries(source, entries, diagnostics);\n return { roots, marketplaces, entries, diagnostics };\n}\n\nexport function isRemotePluginSource(\n source: PluginSource,\n): source is GitPluginSource | Extract<PluginSource, { type: 'npm' }> {\n return source.type !== 'local';\n}\n","import type { DomainManifest } from '../../types/domains';\n\nconst NAME_DELIMITER = ',';\n\n/** Splits comma-joined selections and expands aliases into concrete domain names. */\nexport function expandDomainNames(manifest: DomainManifest, domainNames: readonly string[]): string[] {\n return domainNames\n .flatMap((raw) =>\n raw\n .split(NAME_DELIMITER)\n .map((name) => name.trim())\n .filter(Boolean),\n )\n .flatMap((name) => manifest.aliases[name] ?? [name]);\n}\n\nexport function domainCompletionPrefix(textBeforeCursor: string): string | undefined {\n const match = textBeforeCursor.match(/^\\/domains\\s+(?:[^\\s,]+,)*([^\\s,]*)$/);\n return match?.[1];\n}\n\nexport function domainCompletionItems(domainNames: string[], query: string): Array<{ value: string; label: string }> {\n const normalizedQuery = query.toLowerCase();\n return domainNames\n .filter((name) => name.toLowerCase().startsWith(normalizedQuery))\n .map((name) => ({ value: name, label: name }));\n}\n","import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport type {\n DomainDefinition,\n DomainManifest,\n DomainMcpAllowlist,\n DomainPlugin,\n PluginEntry,\n ResolvedDomain,\n} from '../../types/domains';\nimport { globalDoomConfigDirectory } from '../config';\nimport { readDoomConfigSources } from '../layeredConfig';\nimport { loadPluginCatalog, pluginDirectoryForSource } from '../pluginCatalog';\nimport { expandDomainNames } from './completion';\n\nexport { DOOM_DIR } from '../layeredConfig';\n\nconst DOMAINS_FILE = 'domains.yaml';\nconst UNKNOWN_DOMAIN_ERROR = 'Unknown domain';\nconst UNKNOWN_PLUGIN_ERROR = 'Unknown plugin';\nconst MISSING_PLUGIN_DIRECTORY_ERROR = 'Plugin directory does not exist';\nconst DEFAULT_DOMAINS_PATH = '.po/domains.yaml';\nconst SUPPORTED_AGENT_PLUGIN_SCHEMA = 'https://agent-plugins.org/schemas/1.0.0/plugin.schema.json';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction requireRecord(value: unknown, label: string): Record<string, unknown> {\n if (!isRecord(value)) throw new Error(`${label} must be an object`);\n return value;\n}\n\nfunction assertOnlyKeys(record: Record<string, unknown>, allowed: readonly string[], label: string): void {\n const unexpected = Object.keys(record).filter((key) => !allowed.includes(key));\n if (unexpected.length > 0) throw new Error(`${label} contains unsupported field \"${unexpected[0]}\"`);\n}\n\nfunction requireString(value: unknown, label: string): string {\n if (typeof value !== 'string' || !value.trim()) throw new Error(`${label} must be a non-empty string`);\n return value.trim();\n}\n\nfunction optionalString(value: unknown, label: string): string | undefined {\n if (value === undefined) return undefined;\n return requireString(value, label);\n}\n\nfunction parseStringArray(value: unknown, label: string): string[] {\n if (!Array.isArray(value)) throw new Error(`${label} must be an array of non-empty strings`);\n return [...new Set(value.map((entry, index) => requireString(entry, `${label}[${index}]`)))];\n}\n\nfunction parseOptionalBoolean(value: unknown, label: string): boolean | undefined {\n if (value === undefined) return undefined;\n if (typeof value !== 'boolean') throw new Error(`${label} must be a boolean`);\n return value;\n}\n\nfunction parseDefaultDomains(value: unknown): string[] {\n return parseStringArray(value, `defaultDomains in ${DEFAULT_DOMAINS_PATH}`);\n}\n\nfunction parseDomainPlugin(value: unknown, label: string): DomainPlugin {\n if (typeof value === 'string') return requireString(value, label);\n const plugin = requireRecord(value, label);\n assertOnlyKeys(plugin, ['name', 'skills', 'agents', 'hooks', 'mcp'], label);\n const skills = plugin.skills === undefined ? undefined : parseStringArray(plugin.skills, `${label}.skills`);\n const agents = plugin.agents === undefined ? undefined : parseStringArray(plugin.agents, `${label}.agents`);\n const hooks = parseOptionalBoolean(plugin.hooks, `${label}.hooks`);\n const mcp = parseOptionalBoolean(plugin.mcp, `${label}.mcp`);\n return {\n name: requireString(plugin.name, `${label}.name`),\n ...(skills ? { skills } : {}),\n ...(agents ? { agents } : {}),\n ...(hooks === undefined ? {} : { hooks }),\n ...(mcp === undefined ? {} : { mcp }),\n };\n}\n\nfunction parseMcpAllowlist(value: unknown, label: string): DomainMcpAllowlist {\n const mcp = requireRecord(value, label);\n assertOnlyKeys(mcp, ['servers', 'proxy'], label);\n return {\n ...(mcp.servers === undefined ? {} : { servers: parseStringArray(mcp.servers, `${label}.servers`) }),\n ...(mcp.proxy === undefined ? {} : { proxy: parseStringArray(mcp.proxy, `${label}.proxy`) }),\n };\n}\n\nfunction parseDomain(value: unknown, label: string): DomainDefinition {\n const domain = requireRecord(value, label);\n assertOnlyKeys(domain, ['description', 'plugins', 'mcp', 'sharedSkills'], label);\n const description = optionalString(domain.description, `${label}.description`);\n if (domain.plugins !== undefined && !Array.isArray(domain.plugins)) {\n throw new Error(`${label}.plugins must be an array`);\n }\n const sharedSkills = parseOptionalBoolean(domain.sharedSkills, `${label}.sharedSkills`);\n return {\n ...(description ? { description } : {}),\n ...(Array.isArray(domain.plugins)\n ? { plugins: domain.plugins.map((plugin, index) => parseDomainPlugin(plugin, `${label}.plugins[${index}]`)) }\n : {}),\n ...(domain.mcp === undefined ? {} : { mcp: parseMcpAllowlist(domain.mcp, `${label}.mcp`) }),\n ...(sharedSkills === undefined ? {} : { sharedSkills }),\n };\n}\n\nfunction parseAliases(value: unknown, label: string): Record<string, string[]> {\n if (value === undefined) return {};\n const aliases = requireRecord(value, label);\n return Object.fromEntries(\n Object.entries(aliases).map(([name, domains]) => [name, parseStringArray(domains, `${label}.${name}`)]),\n );\n}\n\n/**\n * Reads domains and plugin catalogs from global and repository configs.\n *\n * Named domains and explicit plugin entries are replaced by later repository\n * definitions. Configured roots accumulate, with exact marketplace manifests\n * deduplicated in discovery order. Explicit entries override discovered IDs.\n */\nexport function loadDomains(repoRoot: string, homeDirectory: string = os.homedir()): DomainManifest {\n const sources = readDoomConfigSources<unknown>(DOMAINS_FILE, repoRoot, homeDirectory);\n const aliases: Record<string, string[]> = {};\n const domains: Record<string, ResolvedDomain> = {};\n let defaultDomains: string[] | undefined;\n\n for (const source of sources) {\n const document = requireRecord(source.document, source.filePath);\n assertOnlyKeys(document, ['plugins', 'domains', 'aliases', 'defaultDomains'], source.filePath);\n Object.assign(aliases, parseAliases(document.aliases, `aliases in ${source.filePath}`));\n if (document.domains !== undefined) {\n const sourceDomains = requireRecord(document.domains, `domains in ${source.filePath}`);\n for (const [name, definition] of Object.entries(sourceDomains)) {\n domains[name] = {\n ...parseDomain(definition, `domains.${name} in ${source.filePath}`),\n baseDirectory: source.baseDirectory,\n };\n }\n }\n if (Object.hasOwn(document, 'defaultDomains')) defaultDomains = parseDefaultDomains(document.defaultDomains);\n }\n\n const plugins = loadPluginCatalog(\n sources.map((source) => ({\n filePath: source.filePath,\n baseDirectory: source.baseDirectory,\n value: requireRecord(source.document, source.filePath).plugins,\n })),\n repoRoot,\n homeDirectory,\n );\n\n if (defaultDomains) {\n for (const name of expandDomainNames({ plugins, domains, aliases }, defaultDomains)) {\n if (!Object.hasOwn(domains, name)) {\n throw new Error(`Unknown default domain \"${name}\" in ${DEFAULT_DOMAINS_PATH}`);\n }\n }\n }\n return { plugins, domains, aliases, ...(defaultDomains ? { defaultDomains } : {}) };\n}\n\nexport function listDomainNames(repoRoot: string, homeDirectory?: string): string[] {\n const manifest = loadDomains(repoRoot, homeDirectory);\n return [...new Set([...Object.keys(manifest.domains), ...Object.keys(manifest.aliases)])].sort();\n}\n\n/**\n * Whether to include .claude/skills as shared fallbacks.\n *\n * Shared skills are included unless every selected domain opts out, so mixing a\n * trimmed domain with an untrimmed one cannot strip the untrimmed one's skills.\n */\nexport function resolveSharedSkills(repoRoot: string, domainNames: string[], homeDirectory?: string): boolean {\n const manifest = loadDomains(repoRoot, homeDirectory);\n const expanded = expandDomainNames(manifest, domainNames);\n if (expanded.length === 0) return true;\n return expanded.some((name) => manifest.domains[name]?.sharedSkills !== false);\n}\n\n/** Resolves named domain plugins while preserving each subset filter. */\nexport function resolvePluginEntries(\n repoRoot: string,\n domainNames: string[],\n explicitDirectories: string[],\n homeDirectory: string = os.homedir(),\n): PluginEntry[] {\n const manifest = loadDomains(repoRoot, homeDirectory);\n const entries: PluginEntry[] = [];\n const seen = new Set<string>();\n const homeDoomDirectory = globalDoomConfigDirectory(homeDirectory);\n\n for (const domainName of expandDomainNames(manifest, domainNames)) {\n const domain = manifest.domains[domainName];\n if (!domain) throw new Error(`${UNKNOWN_DOMAIN_ERROR}: ${domainName}`);\n for (const selection of domain.plugins ?? []) {\n const isSubset = typeof selection !== 'string';\n const pluginName = isSubset ? selection.name : selection;\n const plugin = manifest.plugins.entries[pluginName];\n if (!plugin) throw new Error(`${UNKNOWN_PLUGIN_ERROR} \"${pluginName}\" referenced by domain \"${domainName}\"`);\n const directory = pluginDirectoryForSource(plugin.source, homeDoomDirectory);\n if (plugin.source.type === 'local' && (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory())) {\n throw new Error(`${MISSING_PLUGIN_DIRECTORY_ERROR}: ${directory}`);\n }\n if (seen.has(directory)) continue;\n seen.add(directory);\n entries.push({\n name: pluginName,\n directory,\n // The domain is only in scope here. `resolvePluginDirectories` keeps\n // just the path, so anything downstream that wants to say which domain\n // brought a plugin has to be told now or not at all.\n domain: domainName,\n source: plugin.source,\n ...(plugin.manifest ? { manifest: plugin.manifest } : {}),\n ...(plugin.manifest?.agentPluginSchema === SUPPORTED_AGENT_PLUGIN_SCHEMA\n ? { skillDiscovery: 'direct-children' as const }\n : {}),\n ...(isSubset && selection.skills ? { skills: selection.skills } : {}),\n ...(isSubset && selection.agents ? { agents: selection.agents } : {}),\n ...(isSubset && selection.hooks !== undefined ? { hooks: selection.hooks } : {}),\n ...(isSubset && selection.mcp !== undefined ? { mcp: selection.mcp } : {}),\n });\n }\n }\n\n for (const configuredDirectory of explicitDirectories) {\n const directory = path.resolve(configuredDirectory);\n if (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory()) {\n throw new Error(`${MISSING_PLUGIN_DIRECTORY_ERROR}: ${directory}`);\n }\n if (seen.has(directory)) continue;\n seen.add(directory);\n entries.push({\n name: path.basename(directory),\n directory,\n source: { type: 'local', path: directory },\n });\n }\n return entries;\n}\n\nexport function resolvePluginDirectories(\n repoRoot: string,\n domainNames: string[],\n explicitDirectories: string[],\n homeDirectory?: string,\n): string[] {\n return resolvePluginEntries(repoRoot, domainNames, explicitDirectories, homeDirectory).map(\n (entry) => entry.directory,\n );\n}\n\nexport const PO_DOMAINS_ENV = 'PO_DOMAINS';\nexport const DEFAULT_DOMAIN = 'default';\nconst MARKETING_MAJOR_MODE = 'marketing';\n\nfunction parseDomainList(value: string): string[] {\n return value\n .split(',')\n .map((entry) => entry.trim())\n .filter(Boolean);\n}\n\n/**\n * Domains selected when the caller names none.\n *\n * Configuration keeps this axis independent of the major mode. The\n * major-mode-derived choice is retained only as the compatibility fallback for\n * domains files that declare no defaultDomains.\n */\nexport function defaultDomainsForMajorMode(\n majorMode: string,\n environment: NodeJS.ProcessEnv,\n defaultDomains?: readonly string[],\n): string[] {\n const inherited = environment[PO_DOMAINS_ENV];\n // An explicitly empty variable means no domains, so this tests for the key\n // rather than for a truthy value.\n if (inherited !== undefined) return parseDomainList(inherited);\n if (defaultDomains !== undefined) return [...defaultDomains];\n return parseDomainList(majorMode === MARKETING_MAJOR_MODE ? MARKETING_MAJOR_MODE : DEFAULT_DOMAIN);\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,6BAA6B;AACnC,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AACzB,MAAM,+BAA+B;CACnC;CACA;CACA;AACF;AAEA,MAAa,sCAAsC;CACjD;CACA;CACA;CACA;AACF;AAkBA,SAASA,WAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAASC,gBAAc,OAAgB,OAAwC;CAC7E,IAAI,CAACD,WAAS,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,mBAAmB;CAClE,OAAO;AACT;AAEA,SAASE,iBAAe,OAAgB,OAAmC;CACzE,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,4BAA4B;CACrG,OAAO,MAAM,KAAK;AACpB;AAEA,SAASC,gBAAc,OAAgB,OAAuB;CAC5D,MAAM,SAASD,iBAAe,OAAO,KAAK;CAC1C,IAAI,CAAC,QAAQ,MAAM,IAAI,MAAM,GAAG,MAAM,4BAA4B;CAClE,OAAO;AACT;AAEA,SAASE,iBAAe,QAAiC,SAA4B,OAAqB;CACxG,MAAM,aAAa,OAAO,KAAK,MAAM,CAAC,CAAC,QAAQ,QAAQ,CAAC,QAAQ,SAAS,GAAG,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yB;CAChD,OAAO,MACJ,MAAM,GAAG,CAAC,CACV,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;AACnB;;;;;;;;AASA,SAAgB,2BACd,WACA,aACA,gBACU;CACV,MAAM,YAAY,YAAY;CAG9B,IAAI,cAAc,KAAA,GAAW,OAAO,gBAAgB,SAAS;CAC7D,IAAI,mBAAmB,KAAA,GAAW,OAAO,CAAC,GAAG,cAAc;CAC3D,OAAO,gBAAgB,cAAc,uBAAuB,uBAAuB,cAAc;AACnG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"harnessStore-CJSxdSkV.cjs","names":["fs","readHarnessState","HARNESS_STATE_KEYS","readDoomSessionEnvironment","path","os"],"sources":["../src/models/harnessCache.ts","../src/services/harnessStore/index.ts"],"sourcesContent":["import type { HarnessState } from '../types/config';\n\nexport interface LoadedHarnessState {\n /** Undefined when this process is running off the environment fallback. */\n filePath?: string;\n owned: boolean;\n state: HarnessState;\n}\n\nexport interface CachedHarnessState extends LoadedHarnessState {\n /** The file's mtime when it was read, so a rewrite by another copy is noticed. */\n mtimeMs?: number;\n}\n\nexport const harnessCache: { loaded: CachedHarnessState | undefined } = { loaded: undefined };\n","import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { readDoomSessionEnvironment } from '@agimon-ai/po-core/cordisHost';\n\nimport { harnessCache, type CachedHarnessState, type LoadedHarnessState } from '../../models/harnessCache';\nimport type { HarnessState } from '../../types/config';\nimport { writePrivateAtomicJson } from '../atomicJson';\nimport {\n HARNESS_STATE_KEYS,\n projectHarnessEnvironment,\n readHarnessState,\n type HarnessStateParseReporter,\n} from '../harnessState';\n\n/**\n * Who owns the harness state, and where it lives.\n *\n * The state used to be the environment: twenty variables that every reader\n * re-parsed and every writer mutated globally. The file is the authority now,\n * and the environment is a projection published for the readers that can only\n * see an environment, which are bash hooks, the shell launchers, packages that\n * do not depend on this one, and any process spawned by any of them.\n *\n * OWNERSHIP IS PER PROCESS, AND THAT IS THE WHOLE DESIGN:\n * Doom Team subagents run detached, in their own process group, from an\n * environment snapshot taken at spawn. A child can outlive its parent. If it\n * shared the parent's file it would corrupt a session it does not own, and if\n * that file sat in the parent's run directory the parent's shutdown sweep would\n * delete it from under a live run. So every process writes a file it owns:\n * `owner.pid` records who, and a process that finds someone else's file copies\n * it before its first write.\n *\n * AVOID:\n * - Treating the file as shared mutable state between processes. Atomic writes\n * prevent torn reads, not lost updates\n * - Reading the environment directly for anything this exposes\n */\n\n/** Points at the state file. The one variable that is not derived. */\nexport const HARNESS_STATE_POINTER = 'PO_STATE';\n\nconst STATE_FILE_VERSION = 1;\nconst STATE_FILE_NAME = 'harness-state.json';\nconst ADOPTED_DIRECTORY = 'doom-harness';\n/**\n * Written for a process that does not exist yet, so the first one to read it\n * owns it. A spawner cannot know its child's pid, and a child that inherited\n * its parent's file would lose it the moment the parent cleaned up.\n */\nconst UNCLAIMED_OWNER = 0;\n\nexport interface HarnessStateFile {\n version: number;\n owner: { pid: number; startedAt: string };\n state: HarnessState;\n}\n\nexport interface HarnessStateTransactionSnapshot {\n readonly filePath?: string;\n readonly owned: boolean;\n readonly state: HarnessState;\n readonly environment: Readonly<Record<string, string | undefined>>;\n}\n\n/** Drops the cached state. For tests, and for a process changing identity. */\nexport function resetHarnessStore(): void {\n harnessCache.loaded = undefined;\n}\n\nfunction fileMtime(filePath: string): number | undefined {\n try {\n return fs.statSync(filePath).mtimeMs;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Whether the cache still describes what the process points at.\n *\n * A session can load more than one copy of this package (a layer package\n * installed under .pi/npm brings its own), and each copy caches on its own.\n * The pointer and the file are shared, so a switch persisted through one copy\n * moves the pointer or rewrites the file, and every other copy must notice\n * rather than answer from memory.\n */\nfunction cacheCurrent(cache: CachedHarnessState, environment: NodeJS.ProcessEnv): boolean {\n const pointer = environment[HARNESS_STATE_POINTER];\n if (cache.filePath !== pointer) return false;\n if (!cache.filePath) return true;\n try {\n return fs.statSync(cache.filePath).mtimeMs === cache.mtimeMs;\n } catch {\n return false;\n }\n}\n\nfunction parseStateFile(source: string, filePath: string): HarnessStateFile {\n const parsed = JSON.parse(source) as Partial<HarnessStateFile>;\n if (parsed.version !== STATE_FILE_VERSION) {\n throw new Error(\n `Harness state at ${filePath} has version ${String(parsed.version)}, expected ${STATE_FILE_VERSION}`,\n );\n }\n if (typeof parsed.state !== 'object' || parsed.state === null) {\n throw new Error(`Harness state at ${filePath} has no state object`);\n }\n return {\n version: STATE_FILE_VERSION,\n owner: { pid: parsed.owner?.pid ?? -1, startedAt: parsed.owner?.startedAt ?? '' },\n state: parsed.state as HarnessState,\n };\n}\n\n/**\n * Reads the state for this process, once.\n *\n * A missing pointer means nobody wrote a file for this process, so the\n * environment is all there is: a nested run, a third-party spawn, or a caller\n * older than the store. A pointer that cannot be read is reported and then\n * treated the same way, because a session that starts degraded beats a session\n * that does not start at all.\n */\nexport function loadHarnessState(\n environment: NodeJS.ProcessEnv = process.env,\n report?: HarnessStateParseReporter,\n): LoadedHarnessState {\n // The cache describes this process. Asking about another environment is a\n // question about another process, so it reads through rather than answering\n // from what this one happens to hold.\n const cacheable = environment === process.env;\n if (cacheable && harnessCache.loaded && cacheCurrent(harnessCache.loaded, environment)) return harnessCache.loaded;\n\n const filePath = environment[HARNESS_STATE_POINTER];\n let result: CachedHarnessState | undefined;\n if (filePath && fs.existsSync(filePath)) {\n try {\n const file = parseStateFile(fs.readFileSync(filePath, 'utf8'), filePath);\n const owned = file.owner.pid === process.pid || file.owner.pid === UNCLAIMED_OWNER;\n result = { filePath, owned, state: file.state, mtimeMs: fileMtime(filePath) };\n } catch (error) {\n report?.(HARNESS_STATE_POINTER, error);\n }\n }\n result ??= { owned: false, state: readHarnessState(environment, report) };\n if (cacheable) harnessCache.loaded = result;\n return result;\n}\n\n/** Captures the owned state pointer and every projected harness variable. */\nexport function snapshotHarnessState(environment: NodeJS.ProcessEnv = process.env): HarnessStateTransactionSnapshot {\n const loadedState = loadHarnessState(environment);\n const environmentSnapshot: Record<string, string | undefined> = {\n [HARNESS_STATE_POINTER]: environment[HARNESS_STATE_POINTER],\n };\n for (const key of Object.values(HARNESS_STATE_KEYS)) environmentSnapshot[key] = environment[key];\n return {\n filePath: loadedState.filePath,\n owned: loadedState.owned,\n state: structuredClone(loadedState.state),\n environment: environmentSnapshot,\n };\n}\n\n/** Restores a snapshot only while the current process still owns its state pointer. */\nexport function restoreHarnessStateSnapshot(\n snapshot: HarnessStateTransactionSnapshot,\n environment: NodeJS.ProcessEnv = process.env,\n): void {\n const current = loadHarnessState(environment);\n if (snapshot.filePath && snapshot.owned) {\n if (!current.owned || current.filePath !== snapshot.filePath) {\n throw new Error('Harness state ownership changed; refusing to restore an older snapshot.');\n }\n persist(snapshot.filePath, snapshot.state);\n } else if (!snapshot.filePath) {\n if (current.filePath && !current.owned) {\n throw new Error('Harness state is no longer owned by this process; refusing to restore an older snapshot.');\n }\n if (current.filePath && current.owned) fs.rmSync(current.filePath, { force: true });\n resetHarnessStore();\n } else if (current.filePath !== snapshot.filePath) {\n throw new Error('Harness state pointer changed; refusing to restore an older snapshot.');\n }\n for (const [key, value] of Object.entries(snapshot.environment)) {\n if (value === undefined) delete environment[key];\n else environment[key] = value;\n }\n if (environment === process.env) {\n harnessCache.loaded = snapshot.filePath\n ? {\n filePath: snapshot.filePath,\n owned: snapshot.owned,\n state: snapshot.state,\n mtimeMs: fileMtime(snapshot.filePath),\n }\n : undefined;\n }\n}\n\nexport function getHarnessState(report?: HarnessStateParseReporter): HarnessState {\n return loadHarnessState(process.env, report).state;\n}\n\n/**\n * The harness state of one session, by id.\n *\n * A server runs many sessions' extensions in one process, each with its own state file, so\n * a session-scoped reader asks by session id. A terminal session owns its process, and the\n * answer is the same as `getHarnessState`.\n */\nexport function getSessionHarnessState(\n sessionId: string | undefined,\n report?: HarnessStateParseReporter,\n): HarnessState {\n return loadHarnessState(readDoomSessionEnvironment(sessionId), report).state;\n}\n\nfunction stateFilePath(directory: string): string {\n return path.join(directory, STATE_FILE_NAME);\n}\n\n/** Where a process writes state when it was not given a file of its own. */\nfunction adoptedStateFilePath(): string {\n return path.join(os.tmpdir(), ADOPTED_DIRECTORY, `${String(process.pid)}.json`);\n}\n\nfunction persist(filePath: string, state: HarnessState, ownerPid = process.pid): void {\n writePrivateAtomicJson(filePath, {\n version: STATE_FILE_VERSION,\n owner: { pid: ownerPid, startedAt: new Date().toISOString() },\n state,\n } satisfies HarnessStateFile);\n}\n\n/**\n * Starts a session: writes the file and publishes the derived environment.\n *\n * The environment is a parameter because the caller is usually describing a\n * process other than itself. The launcher builds the environment for the Pi it\n * is about to spawn, and Doom Team builds the snapshot for a detached child, so\n * neither should touch its own `process.env` to do it.\n */\nexport function createHarnessSession(\n state: HarnessState,\n options: {\n directory: string;\n environment: NodeJS.ProcessEnv;\n /**\n * Leave the file for a process that does not exist yet to claim.\n *\n * What a spawner wants: the child owns its state from its first read, in a\n * directory the spawner manages, so the parent cleaning up its own session\n * cannot pull the file out from under a detached run.\n */\n unclaimed?: boolean;\n },\n): string {\n const filePath = stateFilePath(options.directory);\n persist(filePath, state, options.unclaimed ? UNCLAIMED_OWNER : process.pid);\n options.environment[HARNESS_STATE_POINTER] = filePath;\n projectHarnessEnvironment(state, options.environment);\n // Only prime the cache when this process is the one being described.\n if (!options.unclaimed && options.environment === process.env)\n harnessCache.loaded = { filePath, owned: true, state, mtimeMs: fileMtime(filePath) };\n return filePath;\n}\n\n/**\n * Applies a patch to this process's state.\n *\n * Copy on write: a process holding a file it does not own writes its own copy\n * and repoints itself at it, so a child can never rewrite its parent's session.\n */\nexport function updateHarnessState(\n patch: Partial<HarnessState>,\n environment: NodeJS.ProcessEnv = process.env,\n): HarnessState {\n const current = loadHarnessState(environment);\n const state = { ...current.state, ...patch };\n const filePath = current.owned && current.filePath ? current.filePath : adoptedStateFilePath();\n persist(filePath, state);\n environment[HARNESS_STATE_POINTER] = filePath;\n if (environment === process.env) harnessCache.loaded = { filePath, owned: true, state, mtimeMs: fileMtime(filePath) };\n projectHarnessEnvironment(patch, environment);\n return state;\n}\n\n/** Removes this process's own state file. Safe when there is none. */\nexport function disposeHarnessState(environment: NodeJS.ProcessEnv = process.env): void {\n const current = harnessCache.loaded;\n resetHarnessStore();\n if (!current?.owned || !current.filePath) return;\n fs.rmSync(current.filePath, { force: true });\n delete environment[HARNESS_STATE_POINTER];\n}\n\nexport function harnessRoot(state: Pick<HarnessState, 'root'> = getHarnessState()): string {\n return state.root ?? process.cwd();\n}\n\n/**\n * The repository root, or a hard error.\n *\n * Separate from `requireHarnessPaths` because most callers only need the root,\n * and separate from `harnessRoot` because falling back to `process.cwd()` would\n * quietly operate on whatever directory the session happens to sit in. A caller\n * that asks for the root wants the session's repository or nothing.\n */\nexport function requireHarnessRoot(state: Pick<HarnessState, 'root'> = getHarnessState()): string {\n if (!state.root) throw new Error(`${HARNESS_STATE_KEYS.root} is not set`);\n return state.root;\n}\n\n/** The root and the run's scratch directory, for callers that write to disk. */\nexport function requireHarnessPaths(state: Pick<HarnessState, 'root' | 'temporaryDirectory'> = getHarnessState()): {\n root: string;\n temporaryDirectory: string;\n} {\n const root = requireHarnessRoot(state);\n if (!state.temporaryDirectory) throw new Error(`${HARNESS_STATE_KEYS.temporaryDirectory} is not set`);\n return { root, temporaryDirectory: state.temporaryDirectory };\n}\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,eAA2D,EAAE,QAAQ,KAAA,EAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;AC2B5F,MAAa,wBAAwB;AAErC,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;;;;;;AAM1B,MAAM,kBAAkB;;AAgBxB,SAAgB,oBAA0B;CACxC,aAAa,SAAS,KAAA;AACxB;AAEA,SAAS,UAAU,UAAsC;CACvD,IAAI;EACF,OAAOA,QAAAA,QAAG,SAAS,QAAQ,CAAC,CAAC;CAC/B,QAAQ;EACN;CACF;AACF;;;;;;;;;;AAWA,SAAS,aA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U,QAAQ;CAAE;CACpH,qBAAA,0BAA0B,OAAO,WAAW;CAC5C,OAAO;AACT;;AAGA,SAAgB,oBAAoB,cAAiC,QAAQ,KAAW;CACtF,MAAM,UAAU,aAAa;CAC7B,kBAAkB;CAClB,IAAI,CAAC,SAAS,SAAS,CAAC,QAAQ,UAAU;CAC1C,QAAA,QAAG,OAAO,QAAQ,UAAU,EAAE,OAAO,KAAK,CAAC;CAC3C,OAAO,YAAY;AACrB;AAEA,SAAgB,YAAY,QAAoC,gBAAgB,GAAW;CACzF,OAAO,MAAM,QAAQ,QAAQ,IAAI;AACnC;;;;;;;;;AAUA,SAAgB,mBAAmB,QAAoC,gBAAgB,GAAW;CAChG,IAAI,CAAC,MAAM,MAAM,MAAM,IAAI,MAAM,GAAGH,qBAAAA,mBAAmB,KAAK,YAAY;CACxE,OAAO,MAAM;AACf;;AAGA,SAAgB,oBAAoB,QAA2D,gBAAgB,GAG7G;CACA,MAAM,OAAO,mBAAmB,KAAK;CACrC,IAAI,CAAC,MAAM,oBAAoB,MAAM,IAAI,MAAM,GAAGA,qBAAAA,mBAAmB,mBAAmB,YAAY;CACpG,OAAO;EAAE;EAAM,oBAAoB,MAAM;CAAmB;AAC9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"harnessStore-CltwLB7M.mjs","names":[],"sources":["../src/models/harnessCache.ts","../src/services/harnessStore/index.ts"],"sourcesContent":["import type { HarnessState } from '../types/config';\n\nexport interface LoadedHarnessState {\n /** Undefined when this process is running off the environment fallback. */\n filePath?: string;\n owned: boolean;\n state: HarnessState;\n}\n\nexport interface CachedHarnessState extends LoadedHarnessState {\n /** The file's mtime when it was read, so a rewrite by another copy is noticed. */\n mtimeMs?: number;\n}\n\nexport const harnessCache: { loaded: CachedHarnessState | undefined } = { loaded: undefined };\n","import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { readDoomSessionEnvironment } from '@agimon-ai/po-core/cordisHost';\n\nimport { harnessCache, type CachedHarnessState, type LoadedHarnessState } from '../../models/harnessCache';\nimport type { HarnessState } from '../../types/config';\nimport { writePrivateAtomicJson } from '../atomicJson';\nimport {\n HARNESS_STATE_KEYS,\n projectHarnessEnvironment,\n readHarnessState,\n type HarnessStateParseReporter,\n} from '../harnessState';\n\n/**\n * Who owns the harness state, and where it lives.\n *\n * The state used to be the environment: twenty variables that every reader\n * re-parsed and every writer mutated globally. The file is the authority now,\n * and the environment is a projection published for the readers that can only\n * see an environment, which are bash hooks, the shell launchers, packages that\n * do not depend on this one, and any process spawned by any of them.\n *\n * OWNERSHIP IS PER PROCESS, AND THAT IS THE WHOLE DESIGN:\n * Doom Team subagents run detached, in their own process group, from an\n * environment snapshot taken at spawn. A child can outlive its parent. If it\n * shared the parent's file it would corrupt a session it does not own, and if\n * that file sat in the parent's run directory the parent's shutdown sweep would\n * delete it from under a live run. So every process writes a file it owns:\n * `owner.pid` records who, and a process that finds someone else's file copies\n * it before its first write.\n *\n * AVOID:\n * - Treating the file as shared mutable state between processes. Atomic writes\n * prevent torn reads, not lost updates\n * - Reading the environment directly for anything this exposes\n */\n\n/** Points at the state file. The one variable that is not derived. */\nexport const HARNESS_STATE_POINTER = 'PO_STATE';\n\nconst STATE_FILE_VERSION = 1;\nconst STATE_FILE_NAME = 'harness-state.json';\nconst ADOPTED_DIRECTORY = 'doom-harness';\n/**\n * Written for a process that does not exist yet, so the first one to read it\n * owns it. A spawner cannot know its child's pid, and a child that inherited\n * its parent's file would lose it the moment the parent cleaned up.\n */\nconst UNCLAIMED_OWNER = 0;\n\nexport interface HarnessStateFile {\n version: number;\n owner: { pid: number; startedAt: string };\n state: HarnessState;\n}\n\nexport interface HarnessStateTransactionSnapshot {\n readonly filePath?: string;\n readonly owned: boolean;\n readonly state: HarnessState;\n readonly environment: Readonly<Record<string, string | undefined>>;\n}\n\n/** Drops the cached state. For tests, and for a process changing identity. */\nexport function resetHarnessStore(): void {\n harnessCache.loaded = undefined;\n}\n\nfunction fileMtime(filePath: string): number | undefined {\n try {\n return fs.statSync(filePath).mtimeMs;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Whether the cache still describes what the process points at.\n *\n * A session can load more than one copy of this package (a layer package\n * installed under .pi/npm brings its own), and each copy caches on its own.\n * The pointer and the file are shared, so a switch persisted through one copy\n * moves the pointer or rewrites the file, and every other copy must notice\n * rather than answer from memory.\n */\nfunction cacheCurrent(cache: CachedHarnessState, environment: NodeJS.ProcessEnv): boolean {\n const pointer = environment[HARNESS_STATE_POINTER];\n if (cache.filePath !== pointer) return false;\n if (!cache.filePath) return true;\n try {\n return fs.statSync(cache.filePath).mtimeMs === cache.mtimeMs;\n } catch {\n return false;\n }\n}\n\nfunction parseStateFile(source: string, filePath: string): HarnessStateFile {\n const parsed = JSON.parse(source) as Partial<HarnessStateFile>;\n if (parsed.version !== STATE_FILE_VERSION) {\n throw new Error(\n `Harness state at ${filePath} has version ${String(parsed.version)}, expected ${STATE_FILE_VERSION}`,\n );\n }\n if (typeof parsed.state !== 'object' || parsed.state === null) {\n throw new Error(`Harness state at ${filePath} has no state object`);\n }\n return {\n version: STATE_FILE_VERSION,\n owner: { pid: parsed.owner?.pid ?? -1, startedAt: parsed.owner?.startedAt ?? '' },\n state: parsed.state as HarnessState,\n };\n}\n\n/**\n * Reads the state for this process, once.\n *\n * A missing pointer means nobody wrote a file for this process, so the\n * environment is all there is: a nested run, a third-party spawn, or a caller\n * older than the store. A pointer that cannot be read is reported and then\n * treated the same way, because a session that starts degraded beats a session\n * that does not start at all.\n */\nexport function loadHarnessState(\n environment: NodeJS.ProcessEnv = process.env,\n report?: HarnessStateParseReporter,\n): LoadedHarnessState {\n // The cache describes this process. Asking about another environment is a\n // question about another process, so it reads through rather than answering\n // from what this one happens to hold.\n const cacheable = environment === process.env;\n if (cacheable && harnessCache.loaded && cacheCurrent(harnessCache.loaded, environment)) return harnessCache.loaded;\n\n const filePath = environment[HARNESS_STATE_POINTER];\n let result: CachedHarnessState | undefined;\n if (filePath && fs.existsSync(filePath)) {\n try {\n const file = parseStateFile(fs.readFileSync(filePath, 'utf8'), filePath);\n const owned = file.owner.pid === process.pid || file.owner.pid === UNCLAIMED_OWNER;\n result = { filePath, owned, state: file.state, mtimeMs: fileMtime(filePath) };\n } catch (error) {\n report?.(HARNESS_STATE_POINTER, error);\n }\n }\n result ??= { owned: false, state: readHarnessState(environment, report) };\n if (cacheable) harnessCache.loaded = result;\n return result;\n}\n\n/** Captures the owned state pointer and every projected harness variable. */\nexport function snapshotHarnessState(environment: NodeJS.ProcessEnv = process.env): HarnessStateTransactionSnapshot {\n const loadedState = loadHarnessState(environment);\n const environmentSnapshot: Record<string, string | undefined> = {\n [HARNESS_STATE_POINTER]: environment[HARNESS_STATE_POINTER],\n };\n for (const key of Object.values(HARNESS_STATE_KEYS)) environmentSnapshot[key] = environment[key];\n return {\n filePath: loadedState.filePath,\n owned: loadedState.owned,\n state: structuredClone(loadedState.state),\n environment: environmentSnapshot,\n };\n}\n\n/** Restores a snapshot only while the current process still owns its state pointer. */\nexport function restoreHarnessStateSnapshot(\n snapshot: HarnessStateTransactionSnapshot,\n environment: NodeJS.ProcessEnv = process.env,\n): void {\n const current = loadHarnessState(environment);\n if (snapshot.filePath && snapshot.owned) {\n if (!current.owned || current.filePath !== snapshot.filePath) {\n throw new Error('Harness state ownership changed; refusing to restore an older snapshot.');\n }\n persist(snapshot.filePath, snapshot.state);\n } else if (!snapshot.filePath) {\n if (current.filePath && !current.owned) {\n throw new Error('Harness state is no longer owned by this process; refusing to restore an older snapshot.');\n }\n if (current.filePath && current.owned) fs.rmSync(current.filePath, { force: true });\n resetHarnessStore();\n } else if (current.filePath !== snapshot.filePath) {\n throw new Error('Harness state pointer changed; refusing to restore an older snapshot.');\n }\n for (const [key, value] of Object.entries(snapshot.environment)) {\n if (value === undefined) delete environment[key];\n else environment[key] = value;\n }\n if (environment === process.env) {\n harnessCache.loaded = snapshot.filePath\n ? {\n filePath: snapshot.filePath,\n owned: snapshot.owned,\n state: snapshot.state,\n mtimeMs: fileMtime(snapshot.filePath),\n }\n : undefined;\n }\n}\n\nexport function getHarnessState(report?: HarnessStateParseReporter): HarnessState {\n return loadHarnessState(process.env, report).state;\n}\n\n/**\n * The harness state of one session, by id.\n *\n * A server runs many sessions' extensions in one process, each with its own state file, so\n * a session-scoped reader asks by session id. A terminal session owns its process, and the\n * answer is the same as `getHarnessState`.\n */\nexport function getSessionHarnessState(\n sessionId: string | undefined,\n report?: HarnessStateParseReporter,\n): HarnessState {\n return loadHarnessState(readDoomSessionEnvironment(sessionId), report).state;\n}\n\nfunction stateFilePath(directory: string): string {\n return path.join(directory, STATE_FILE_NAME);\n}\n\n/** Where a process writes state when it was not given a file of its own. */\nfunction adoptedStateFilePath(): string {\n return path.join(os.tmpdir(), ADOPTED_DIRECTORY, `${String(process.pid)}.json`);\n}\n\nfunction persist(filePath: string, state: HarnessState, ownerPid = process.pid): void {\n writePrivateAtomicJson(filePath, {\n version: STATE_FILE_VERSION,\n owner: { pid: ownerPid, startedAt: new Date().toISOString() },\n state,\n } satisfies HarnessStateFile);\n}\n\n/**\n * Starts a session: writes the file and publishes the derived environment.\n *\n * The environment is a parameter because the caller is usually describing a\n * process other than itself. The launcher builds the environment for the Pi it\n * is about to spawn, and Doom Team builds the snapshot for a detached child, so\n * neither should touch its own `process.env` to do it.\n */\nexport function createHarnessSession(\n state: HarnessState,\n options: {\n directory: string;\n environment: NodeJS.ProcessEnv;\n /**\n * Leave the file for a process that does not exist yet to claim.\n *\n * What a spawner wants: the child owns its state from its first read, in a\n * directory the spawner manages, so the parent cleaning up its own session\n * cannot pull the file out from under a detached run.\n */\n unclaimed?: boolean;\n },\n): string {\n const filePath = stateFilePath(options.directory);\n persist(filePath, state, options.unclaimed ? UNCLAIMED_OWNER : process.pid);\n options.environment[HARNESS_STATE_POINTER] = filePath;\n projectHarnessEnvironment(state, options.environment);\n // Only prime the cache when this process is the one being described.\n if (!options.unclaimed && options.environment === process.env)\n harnessCache.loaded = { filePath, owned: true, state, mtimeMs: fileMtime(filePath) };\n return filePath;\n}\n\n/**\n * Applies a patch to this process's state.\n *\n * Copy on write: a process holding a file it does not own writes its own copy\n * and repoints itself at it, so a child can never rewrite its parent's session.\n */\nexport function updateHarnessState(\n patch: Partial<HarnessState>,\n environment: NodeJS.ProcessEnv = process.env,\n): HarnessState {\n const current = loadHarnessState(environment);\n const state = { ...current.state, ...patch };\n const filePath = current.owned && current.filePath ? current.filePath : adoptedStateFilePath();\n persist(filePath, state);\n environment[HARNESS_STATE_POINTER] = filePath;\n if (environment === process.env) harnessCache.loaded = { filePath, owned: true, state, mtimeMs: fileMtime(filePath) };\n projectHarnessEnvironment(patch, environment);\n return state;\n}\n\n/** Removes this process's own state file. Safe when there is none. */\nexport function disposeHarnessState(environment: NodeJS.ProcessEnv = process.env): void {\n const current = harnessCache.loaded;\n resetHarnessStore();\n if (!current?.owned || !current.filePath) return;\n fs.rmSync(current.filePath, { force: true });\n delete environment[HARNESS_STATE_POINTER];\n}\n\nexport function harnessRoot(state: Pick<HarnessState, 'root'> = getHarnessState()): string {\n return state.root ?? process.cwd();\n}\n\n/**\n * The repository root, or a hard error.\n *\n * Separate from `requireHarnessPaths` because most callers only need the root,\n * and separate from `harnessRoot` because falling back to `process.cwd()` would\n * quietly operate on whatever directory the session happens to sit in. A caller\n * that asks for the root wants the session's repository or nothing.\n */\nexport function requireHarnessRoot(state: Pick<HarnessState, 'root'> = getHarnessState()): string {\n if (!state.root) throw new Error(`${HARNESS_STATE_KEYS.root} is not set`);\n return state.root;\n}\n\n/** The root and the run's scratch directory, for callers that write to disk. */\nexport function requireHarnessPaths(state: Pick<HarnessState, 'root' | 'temporaryDirectory'> = getHarnessState()): {\n root: string;\n temporaryDirectory: string;\n} {\n const root = requireHarnessRoot(state);\n if (!state.temporaryDirectory) throw new Error(`${HARNESS_STATE_KEYS.temporaryDirectory} is not set`);\n return { root, temporaryDirectory: state.temporaryDirectory };\n}\n"],"mappings":";;;;;;;AAcA,MAAa,eAA2D,EAAE,QA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EAAE,GAAG,QAAQ;EAAO,GAAG;CAAM;CAC3C,MAAM,WAAW,QAAQ,SAAS,QAAQ,WAAW,QAAQ,WAAW,qBAAqB;CAC7F,QAAQ,UAAU,KAAK;CACvB,YAAY,yBAAyB;CACrC,IAAI,gBAAgB,QAAQ,KAAK,aAAa,SAAS;EAAE;EAAU,OAAO;EAAM;EAAO,SAAS,UAAU,QAAQ;CAAE;CACpH,0BAA0B,OAAO,WAAW;CAC5C,OAAO;AACT;;AAGA,SAAgB,oBAAoB,cAAiC,QAAQ,KAAW;CACtF,MAAM,UAAU,aAAa;CAC7B,kBAAkB;CAClB,IAAI,CAAC,SAAS,SAAS,CAAC,QAAQ,UAAU;CAC1C,GAAG,OAAO,QAAQ,UAAU,EAAE,OAAO,KAAK,CAAC;CAC3C,OAAO,YAAY;AACrB;AAEA,SAAgB,YAAY,QAAoC,gBAAgB,GAAW;CACzF,OAAO,MAAM,QAAQ,QAAQ,IAAI;AACnC;;;;;;;;;AAUA,SAAgB,mBAAmB,QAAoC,gBAAgB,GAAW;CAChG,IAAI,CAAC,MAAM,MAAM,MAAM,IAAI,MAAM,GAAG,mBAAmB,KAAK,YAAY;CACxE,OAAO,MAAM;AACf;;AAGA,SAAgB,oBAAoB,QAA2D,gBAAgB,GAG7G;CACA,MAAM,OAAO,mBAAmB,KAAK;CACrC,IAAI,CAAC,MAAM,oBAAoB,MAAM,IAAI,MAAM,GAAG,mBAAmB,mBAAmB,YAAY;CACpG,OAAO;EAAE;EAAM,oBAAoB,MAAM;CAAmB;AAC9D"}
@@ -1,35 +0,0 @@
1
- import { C as IDoomConfigService, g as DoomConfigTransitionRecord, m as DoomConfigSelection$1, p as DoomConfigPendingSelection, u as DoomConfigContext, x as HarnessState } from "./config-D2HbBLzo.mjs";
2
- import { Context } from "@deepseek-ai/cordis";
3
- import "@agimon-ai/po-core/headless";
4
- import { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
5
- //#region src/services/sessionConfig/index.d.ts
6
- declare const DOOM_CONFIG_ENTRY_TYPE = "po:config:v1";
7
- declare const DOOM_CONFIG_TRANSITION_ENTRY_TYPE = "po:transition:v1";
8
- type DoomConfigSelection = DoomConfigSelection$1;
9
- declare function readDoomConfigSelection(ctx: Pick<ExtensionContext, 'sessionManager'>): DoomConfigSelection | undefined;
10
- declare function createDoomConfigContext(ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>): DoomConfigContext;
11
- declare function createDoomConfigContextAsync(ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>): Promise<DoomConfigContext>;
12
- declare function appendDoomConfigSelection(pi: Pick<ExtensionAPI, 'appendEntry'>, selection: DoomConfigSelection): void;
13
- /** Journals the live selection, defaulting to whatever the harness store holds. */
14
- declare function persistHarnessSelection(pi: Pick<ExtensionAPI, 'appendEntry'>, state?: {
15
- readonly majorMode: string;
16
- readonly domains: readonly string[];
17
- readonly profile?: string;
18
- readonly compositionFingerprint?: string;
19
- }): void;
20
- declare function appendDoomConfigTransition(pi: Pick<ExtensionAPI, 'appendEntry'>, transition: DoomConfigTransitionRecord): void;
21
- declare function supersedeDoomConfigTransition(pi: Pick<ExtensionAPI, 'appendEntry'>, transition: DoomConfigPendingSelection): void;
22
- /** Acknowledges the latest pending transition from a fresh session that owns its exact target composition. */
23
- declare function acknowledgeDoomConfigTransition(pi: Pick<ExtensionAPI, 'appendEntry'>, ctx: Pick<ExtensionContext, 'sessionManager'>, harness: HarnessState): boolean;
24
- declare function readDoomConfigPendingSelection(ctx: Pick<ExtensionContext, 'sessionManager'>): DoomConfigPendingSelection | undefined;
25
- declare function provideDoomConfigContext(ctx: Context, context: DoomConfigContext, generation?: string): IDoomConfigService;
26
- /** Returns the binding identity used to fence in-flight transitions. */
27
- declare function readDoomConfigContextGeneration(ctx: Context): string | undefined;
28
- /** Precomputes an immutable context before a transaction reaches publication. */
29
- declare function freezeDoomConfigContext(context: DoomConfigContext): DoomConfigContext;
30
- /** Replaces a live binding with a deeply frozen context after publication. */
31
- declare function replaceDoomConfigContext(ctx: Context, context: DoomConfigContext): DoomConfigContext;
32
- declare function requireDoomConfigContext(ctx: Context): DoomConfigContext;
33
- //#endregion
34
- export { supersedeDoomConfigTransition as _, appendDoomConfigSelection as a, createDoomConfigContextAsync as c, provideDoomConfigContext as d, readDoomConfigContextGeneration as f, requireDoomConfigContext as g, replaceDoomConfigContext as h, acknowledgeDoomConfigTransition as i, freezeDoomConfigContext as l, readDoomConfigSelection as m, DOOM_CONFIG_TRANSITION_ENTRY_TYPE as n, appendDoomConfigTransition as o, readDoomConfigPendingSelection as p, DoomConfigSelection as r, createDoomConfigContext as s, DOOM_CONFIG_ENTRY_TYPE as t, persistHarnessSelection as u };
35
- //# sourceMappingURL=index-78zvoS9s.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-78zvoS9s.d.mts","names":["ConfigSelection"],"sources":["../src/services/sessionConfig/index.ts"],"mappings":";;;;;cAmBa;cACA;KAED,sBAAsBA;iBAsHlB,wBACd,KAAK,KAAK,sCACT;iBAyCa,wBAAwB,KAAK,KAAK,8CAA8C;iBAK1E,6BACpB,KAAK,KAAK,8CACT,QAAQ;iBA4BK,0BAA0B,IAAI,KAAK,8BAA8B,WAAW;;iBAK5E,wBACd,IAAI,KAAK,8BACT;WACW;WACA;WACA;WACA;;iBAYG,2BACd,IAAI,KAAK,8BACT,YAAY;iBAKE,8BACd,IAAI,KAAK,8BACT,YAAY;;iBAME,gCACd,IAAI,KAAK,8BACT,KAAK,KAAK,qCACV,SAAS;iBAUK,+BACd,KAAK,KAAK,sCACT;iBASa,yBACd,KAAK,SACL,SAAS,mBACT,sBACC;;iBAKa,gCAAgC,KAAK;;iBAKrC,wBAAwB,SAAS,oBAAoB;;iBAKrD,yBAAyB,KAAK,SAAS,SAAS,oBAAoB;iBAepE,yBAAyB,KAAK,UAAU"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-BT29GZx5.d.mts","names":[],"sources":["../src/types/domains.ts","../src/services/domains/index.ts","../src/services/domains/completion.ts","../src/services/pluginCatalog/index.ts"],"mappings":";UAAiB;EACf;;EAEA;;UAGe;EACf;EACA;;EAEA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;KAGU,eAAe,oBAAoB,kBAAkB;KACrD;UAEK;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf,QAAQ;EACR;EACA;EACA,WAAW;;UAGI;;EAEf;;EAEA;;EAEA,SAAS,eAAe;;EAExB;;;KAIU;EAEN;EAAc;EAAmB;EAAmB;EAAiB;;UAE1D;;EAEf;;EAEA;;UAGe;EACf;EACA,UAAU;EACV,MAAM;EACN;;UAGe,uBAAuB;EACtC;;UAGe;EACf,SAAS;EACT,SAAS,eAAe;EACxB,SAAS;EACT;;UAGe;;EAEf;EACA;;EAEA;;EAEA,SAAS;;EAET,WAAW;EACX,iBAAiB;EACjB;EACA;EACA;EACA;;;;;;;;;;;iBC6Bc,YAAY,kBAAkB,yBAAuC;iBA0CrE,gBAAgB,kBAAkB;;;;;;;iBAWlC,oBAAoB,kBAAkB,uBAAuB;;iBAQ7D,qBACd,kBACA,uBACA,+BACA,yBACC;iBAwDa,yBACd,kBACA,uBACA,+BACA;cAOW;cACA;;;;;;;;iBAiBG,2BACd,mBACA,aAAa,OAAO,YACpB;;;;iBCjRc,kBAAkB,UAAU,gBAAgB;iBAW5C,uBAAuB;iBAKvB,sBAAsB,uBAAuB,gBAAgB;EAAQ;EAAe;;;;cCCvF;;iBAgPG,uBAAuB;iBAmJvB,yBAAyB,QAAQ,cAAc;iBA8C/C,qBACd,QAAQ,eACP,UAAU,kBAAkB,QAAQ;EAAgB"}
@@ -1,6 +0,0 @@
1
- //#region src/services/atomicJson/index.d.ts
2
- /** Writes JSON readable by its owner only, replacing the target atomically. */
3
- declare function writePrivateAtomicJson(filePath: string, value: unknown): void;
4
- //#endregion
5
- export { writePrivateAtomicJson as t };
6
- //# sourceMappingURL=index-C6GaYjq-.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-C6GaYjq-.d.mts","names":[],"sources":["../src/services/atomicJson/index.ts"],"mappings":";;iBA4BgB,uBAAuB,kBAAkB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CEUc7m16.d.mts","names":[],"sources":["../src/models/harnessCache.ts","../src/services/harnessStore/index.ts"],"mappings":";;;UAEiB;;EAEf;EACA;EACA,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCmCI;UAYI;EACf;EACA;IAAS;IAAa;;EACtB,OAAO;;UAGQ;WACN;WACA;WACA,OAAO;WACP,aAAa,SAAS;;;iBAIjB;;;;;;;;;;iBA0DA,iBACd,cAAa,OAAO,YACpB,SAAS,4BACR;;iBAwBa,qBAAqB,cAAa,OAAO,aAA2B;;iBAepE,4BACd,UAAU,iCACV,cAAa,OAAO;iBAiCN,gBAAgB,SAAS,4BAA4B;;;;;;;;iBAWrD,uBACd,+BACA,SAAS,4BACR;;;;;;;;;iBA6Ba,qBACd,OAAO,cACP;EACE;EACA,aAAa,OAAO;;;;;;;;EAQpB;;;;;;;;iBAmBY,mBACd,OAAO,QAAQ,eACf,cAAa,OAAO,aACnB;;iBAYa,oBAAoB,cAAa,OAAO;iBAQxC,YAAY,QAAO,KAAK;;;;;;;;;iBAYxB,mBAAmB,QAAO,KAAK;;iBAM/B,oBAAoB,QAAO,KAAK;EAC9C;EACA"}
@@ -1,39 +0,0 @@
1
- //#region src/services/init/index.d.ts
2
- /** The global seed files are processed in this fixed order. */
3
- declare const GLOBAL_DOOM_SEED_FILES: readonly ['config.yaml', 'modes.yaml', 'domains.yaml', 'profiles.yaml'];
4
- type DoomSeedFile = (typeof GLOBAL_DOOM_SEED_FILES)[number];
5
- /** Portable defaults for a new global Doom configuration directory. */
6
- declare const DOOM_CONFIG_TEMPLATES: Readonly<Record<DoomSeedFile, string>>;
7
- /** Standalone defaults for a repository that is trying Po through DPI. */
8
- declare const REPOSITORY_DOOM_CONFIG_TEMPLATES: Readonly<Record<DoomSeedFile, string>>;
9
- /** Result of filling a Doom seed directory. File arrays contain names in seed order. */
10
- interface GlobalDoomInitResult {
11
- directory: string;
12
- created: string[];
13
- preserved: string[];
14
- /** Existing files overwritten from the template. Only ever non-empty under `force`. */
15
- replaced: string[];
16
- }
17
- interface GlobalDoomInitOptions {
18
- /**
19
- * Overwrite existing seed files instead of preserving them.
20
- *
21
- * Off by default: init is safe to re-run, and hand-edited config is the
22
- * normal case rather than the exception.
23
- */
24
- force?: boolean;
25
- }
26
- type RepositoryDoomInitOptions = GlobalDoomInitOptions;
27
- type RepositoryDoomInitResult = GlobalDoomInitResult;
28
- /**
29
- * Fills missing global seed files.
30
- *
31
- * Existing files are left alone so that re-running init never discards
32
- * hand-edited config; pass `force` to overwrite them from the template.
33
- */
34
- declare function initializeGlobalDoomConfig(homeDirectory?: string, options?: GlobalDoomInitOptions): GlobalDoomInitResult;
35
- /** Seeds repository-local configuration without creating or changing Pi settings. */
36
- declare function initializeRepositoryDoomConfig(repositoryRoot?: string, options?: RepositoryDoomInitOptions): RepositoryDoomInitResult;
37
- //#endregion
38
- export { REPOSITORY_DOOM_CONFIG_TEMPLATES as a, initializeGlobalDoomConfig as c, GlobalDoomInitResult as i, initializeRepositoryDoomConfig as l, GLOBAL_DOOM_SEED_FILES as n, RepositoryDoomInitOptions as o, GlobalDoomInitOptions as r, RepositoryDoomInitResult as s, DOOM_CONFIG_TEMPLATES as t };
39
- //# sourceMappingURL=index-CRcoVYXz.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CRcoVYXz.d.mts","names":[],"sources":["../src/services/init/index.ts"],"mappings":";;cAiBa;KAER,uBAAuB;;cAGf,uBAAuB,SAAS,OAAO;;cA0LvC,kCAAkC,SAAS,OAAO;;UA8D9C;EACf;EACA;EACA;;EAEA;;UAGe;;;;;;;EAOf;;KAGU,4BAA4B;KAC5B,2BAA2B;;;;;;;iBAiKvB,2BACd,wBACA,UAAS,wBACR;;iBAWa,+BACd,yBACA,UAAS,4BACR"}
@@ -1,40 +0,0 @@
1
- import { a as PiConfigPaths, i as PiConfigLoadOptions, r as PiConfig } from "./piConfig-Bx26HMb_.mjs";
2
- //#region src/services/imageSettings/index.d.ts
3
- /** Pi's own cap, from its resize core; also the largest value worth writing. */
4
- declare const DEFAULT_IMAGE_MAX_DIMENSION = 2000;
5
- /** Below this a screenshot stops being readable, which is what reads are for. */
6
- declare const MIN_IMAGE_MAX_DIMENSION = 256;
7
- interface PiImageSettings {
8
- /** Pi's own toggle. Unset is on, matching Pi's default. */
9
- autoResize: boolean;
10
- /** The longest edge an image keeps once resizing is on. */
11
- maxDimension: number;
12
- }
13
- /** The written form of a change; an absent field leaves that key alone. */
14
- interface PiImageSettingsUpdate {
15
- autoResize?: boolean;
16
- maxDimension?: number;
17
- }
18
- declare function clampImageMaxDimension(value: number): number;
19
- /** Resolves the effective limits, defaulting anything absent or unusable. */
20
- declare function parsePiImageSettings(config: PiConfig): PiImageSettings;
21
- //#endregion
22
- //#region src/services/piConfig/index.d.ts
23
- declare function piConfigPaths(repoRoot: string, homeDirectory?: string, agentDirectory?: string): PiConfigPaths;
24
- declare function loadPiConfig(options: PiConfigLoadOptions): PiConfig;
25
- declare function loadPiConfigAsync(options: PiConfigLoadOptions): Promise<PiConfig>;
26
- /** The file a change lands in; Pi's own settings toggle writes the same one. */
27
- declare function piImageSettingsPath(homeDirectory?: string): string;
28
- declare function loadPiImageSettings(homeDirectory?: string): PiImageSettings;
29
- /**
30
- * Writes the changed keys back and reports the limits that now apply.
31
- *
32
- * Read-modify-write on Pi's own file, so a save races a concurrent Pi settings
33
- * save rather than merging with it. Pi writes only the fields its UI touched,
34
- * as this does, which keeps the window to the one setting being changed on
35
- * both sides at once.
36
- */
37
- declare function savePiImageSettings(update: PiImageSettingsUpdate, homeDirectory?: string): PiImageSettings;
38
- //#endregion
39
- export { piImageSettingsPath as a, MIN_IMAGE_MAX_DIMENSION as c, clampImageMaxDimension as d, parsePiImageSettings as f, piConfigPaths as i, PiImageSettings as l, loadPiConfigAsync as n, savePiImageSettings as o, loadPiImageSettings as r, DEFAULT_IMAGE_MAX_DIMENSION as s, loadPiConfig as t, PiImageSettingsUpdate as u };
40
- //# sourceMappingURL=index-CVlciCJF.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CVlciCJF.d.mts","names":[],"sources":["../src/services/imageSettings/index.ts","../src/services/piConfig/index.ts"],"mappings":";;;cA0Ba;;cAEA;UAEI;;EAEf;;EAEA;;;UAIe;EACf;EACA;;iBAGc,uBAAuB;;iBAYvB,qBAAqB,QAAQ,WAAW;;;iBCkBxC,cACd,kBACA,wBACA,0BACC;iBASa,aAAa,SAAS,sBAAsB;iBAkBtC,kBAAkB,SAAS,sBAAsB,QAAQ;;iBAoC/D,oBAAoB;iBAIpB,oBAAoB,yBAA+B;;;;;;;;;iBAanD,oBAAoB,QAAQ,uBAAuB,yBAA+B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-Ch7ptOkW.d.mts","names":[],"sources":["../src/services/layeredConfig/index.ts"],"mappings":";;cASa;;UAKI;;EAEf;;EAEA;;;UAIe,iBAAiB,mBAAmB;;EAEnD;;;;;;;;;;EAUA;;EAEA;EACA,UAAU;;;;;;;;;;;iBAYI,qBACd,kBACA,kBACA,yBACC;EAAQ;EAAkB;;iBAOb,sBAAsB,WACpC,kBACA,kBACA,yBACC,MAAM,iBAAiB;;;;;;;;;iBAwBV,kBAAkB,WAAW,uBAC3C,SAAS,cAAc,iBAAiB,aACxC,SAAS,UAAU,cAAc,eAAe,sBAC/C,eAAe,SAAS"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CkDDvVQt.d.mts","names":[],"sources":["../src/services/majorModes/index.ts"],"mappings":";;;KAQY,qBAAqB;;UAGhB;EACf;EACA;EACA,SAAS;;;UAIM;EACf;EACA;EACA,QAAQ;EACR;EACA;;UAGe;;;;;;;EAOf;;;;;;;EAOA,WAAW,eAAe;EAC1B;;;UAIe,gCAAgC;EAC/C;;EAEA;;UAGe;;EAEf;;EAEA;;UAGe;;EAEf,UAAU;EACV,QAAQ,eAAe;;EAEvB;;EAEA,yBAAyB;;EAEzB,WAAW,eAAe;;EAE1B,mBAAmB,eAAe;;UAGnB;EACf,WAAW;EACX,eAAe;EACf,uBAAuB;;EAEvB,kBAAkB;;EAElB,0BAA0B;;EAE1B,aAAa,mBAAmB;;EAEhC,gBAAgB,mBAAmB;;;;;;;;iBAsBrB,wBAAwB;;;;;;;;;iBAoLxB,qBACd,kBACA,wBACA,cAAa,OAAO,aACnB;;iBAkFa,6BACd,QAAQ,kBACR,iBACA,sBACC;;iBA4Ba,cAAc,QAAQ,kBAAkB;;iBAqBxC,aAAa,QAAQ,kBAAkB,cAAc,WAAW;;iBAmDhE,gBAAgB,QAAQ,kBAAkB;;;;;;;iBAc1C,yBACd,QAAQ,kBACR,2BACA;;;;;;;;iBAac,4BACd,kBACA,wBACA,cAAa,OAAO;EACjB,QAAQ;EAAkB,aAAa"}
@@ -1,66 +0,0 @@
1
- //#region src/services/configWriter/index.d.ts
2
- /**
3
- * Writes into the global Doom config file, one key path at a time.
4
- *
5
- * Extracted from doom-file-edit, which owned the only writer in the repo and had
6
- * it hard-coded to `editor.command`. Several extensions now edit their own
7
- * settings from the config panel, and every one of them needs the same four
8
- * properties: keep the user's comments, never publish a file the parser would
9
- * reject, never leave a half-written file behind, and apply a set of related
10
- * edits together.
11
- *
12
- * That last one is not a convenience. `voice.adapters.<engine>.model` accepts a
13
- * path or an id but not both, so switching between them is a set and an unset
14
- * that must land in the same write, or the file is briefly invalid.
15
- *
16
- * Atomicity is the same rename trick as `atomicJson.ts` next door, and carries
17
- * the same caveat: it prevents torn reads, not lost updates. Two sessions with
18
- * the panel open still clobber each other, because the rename only publishes
19
- * what the caller already computed.
20
- *
21
- * AVOID:
22
- * - Treating this as a lock
23
- * - Writing an empty string; the parser rejects blank values, so clearing a key
24
- * means removing it
25
- */
26
- /** Which file a write is aimed at; the modes follow from it. */
27
- type DoomConfigScope = 'global' | 'repository';
28
- interface DoomConfigEdit {
29
- /** Key path into the document, e.g. `['voice', 'adapters', 'mlx-whisper', 'model', 'id']`. */
30
- readonly keyPath: readonly string[];
31
- /**
32
- * The value to write. `undefined` removes the key.
33
- *
34
- * Not only strings: the config holds numbers (`utteranceIdleMs`) and lists
35
- * (`startPhrases`), and a panel that edits them as text has to hand back the
36
- * parsed value or the next load rejects what it wrote.
37
- */
38
- readonly value?: string | number | boolean | readonly string[];
39
- }
40
- interface WriteDoomConfigOptions {
41
- /**
42
- * Remove ancestors left holding nothing. Defaults to true, and is not
43
- * cosmetic: an adapter left as `{}` fails validation, because the parser
44
- * requires a model once the adapter exists at all.
45
- */
46
- readonly prune?: boolean;
47
- /**
48
- * Which file this is, so the write lands with the right permissions.
49
- * Defaults to `global`, which is what every caller wrote before the
50
- * repository file was writable at all.
51
- */
52
- readonly scope?: DoomConfigScope;
53
- }
54
- /**
55
- * Applies every edit as one document mutation, or throws having written nothing.
56
- *
57
- * Validation runs against the serialized result rather than each edit, so a pair
58
- * of edits only valid together is accepted, and a single edit that breaks an
59
- * invariant elsewhere is still caught.
60
- */
61
- declare function writeDoomConfigValues(filePath: string, edits: readonly DoomConfigEdit[], options?: WriteDoomConfigOptions): Promise<void>;
62
- declare function setDoomConfigValue(filePath: string, keyPath: readonly string[], value: string, options?: WriteDoomConfigOptions): Promise<void>;
63
- declare function unsetDoomConfigValue(filePath: string, keyPath: readonly string[], options?: WriteDoomConfigOptions): Promise<void>;
64
- //#endregion
65
- export { unsetDoomConfigValue as a, setDoomConfigValue as i, DoomConfigScope as n, writeDoomConfigValues as o, WriteDoomConfigOptions as r, DoomConfigEdit as t };
66
- //# sourceMappingURL=index-Cvdt-Y-i.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-Cvdt-Y-i.d.mts","names":[],"sources":["../src/services/configWriter/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;KAkDY;UASK;;WAEN;;;;;;;;WAQA;;UAGM;;;;;;WAMN;;;;;;WAMA,QAAQ;;;;;;;;;iBAmCG,sBACpB,kBACA,gBAAgB,kBAChB,UAAS,yBACR;iBAqCmB,mBACpB,kBACA,4BACA,eACA,UAAS,yBACR;iBAImB,qBACpB,kBACA,4BACA,UAAS,yBACR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DNk4q0Qm.d.mts","names":[],"sources":["../src/services/profileBinding/type.ts","../src/services/profiles/index.ts"],"mappings":";;;UACiB;WACN;WACA;;WAEA;;UAGM;;WAEN;WACA;;;UAIM;WACN;WACA;WACA;WACA;WACA,SAAS,SAAS,eAAe;WACjC,UAAU;;;;;cCRR;;UAOI;EACf;;EAEA;;;;;EAKA;;EAEA,KAAK;;EAEL,cAAc;;EAEd,WAAW;;EAEX,QAAQ;;;;;;;;;;iBAwNM,aAAa,kBAAkB,yBAAuC;;;;;;;;;;;iBA6BtE,mBACd,kBACA;EACG,UAAU;EAAgB;;;iBAcf,eAAe,kBAAkB,cAAc,yBAAyB;iBAMxE,iBAAiB,kBAAkB;;iBA2CnC,mBAAmB,qBAAqB;;iBAuBxC,wBACd,aAAa,OAAO,YACpB,UAAU,yBACT;;iBAWa,0BACd,aAAa,OAAO,YACpB,UAAU,wBACV,MAAM,yBACL"}