@agimon-ai/po-core 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 (1149) hide show
  1. package/LICENSE +149 -21
  2. package/NOTICE +41 -0
  3. package/dist/agentModel.cjs +1 -1
  4. package/dist/agentModel.d.mts +2 -2
  5. package/dist/agentModel.mjs +1 -2
  6. package/dist/apiContracts.cjs +623 -802
  7. package/dist/apiContracts.cjs.map +1 -1
  8. package/dist/apiContracts.d.mts +277 -615
  9. package/dist/apiContracts.d.mts.map +1 -1
  10. package/dist/apiContracts.mjs +617 -794
  11. package/dist/apiContracts.mjs.map +1 -1
  12. package/dist/askUser.cjs +2 -2
  13. package/dist/askUser.d.mts +2 -2
  14. package/dist/askUser.mjs +1 -2
  15. package/dist/authorTools.mjs +1 -2
  16. package/dist/backgroundWork.cjs +3 -3
  17. package/dist/backgroundWork.d.mts +2 -2
  18. package/dist/backgroundWork.mjs +1 -2
  19. package/dist/bundleAssetPolicy.mjs +1 -2
  20. package/dist/chatgptAuth.cjs +3 -2
  21. package/dist/chatgptAuth.d.mts +3 -2
  22. package/dist/chatgptAuth.mjs +2 -1
  23. package/dist/childProcess.cjs +1 -1
  24. package/dist/childProcess.d.mts +2 -2
  25. package/dist/childProcess.mjs +1 -2
  26. package/dist/childSession.cjs +11 -6
  27. package/dist/childSession.d.mts +3 -3
  28. package/dist/childSession.mjs +3 -3
  29. package/dist/cockpitContainer.mjs +1 -2
  30. package/dist/config.cjs +1 -1
  31. package/dist/config.d.mts +3 -3
  32. package/dist/config.mjs +1 -2
  33. package/dist/contextApi.cjs +1 -0
  34. package/dist/contextApi.d.mts +2 -2
  35. package/dist/contextApi.mjs +2 -2
  36. package/dist/contextContributions.cjs +4 -4
  37. package/dist/contextContributions.d.mts +3 -3
  38. package/dist/contextContributions.mjs +3 -3
  39. package/dist/contextDetailStore.cjs +7 -5
  40. package/dist/contextDetailStore.cjs.map +1 -1
  41. package/dist/contextDetailStore.d.mts +2 -1
  42. package/dist/contextDetailStore.d.mts.map +1 -1
  43. package/dist/contextDetailStore.mjs +6 -4
  44. package/dist/contextDetailStore.mjs.map +1 -1
  45. package/dist/contextProjection.cjs +7 -2
  46. package/dist/contextProjection.cjs.map +1 -1
  47. package/dist/contextProjection.d.mts +4 -1
  48. package/dist/contextProjection.d.mts.map +1 -1
  49. package/dist/contextProjection.mjs +5 -2
  50. package/dist/contextProjection.mjs.map +1 -1
  51. package/dist/cordisHost.cjs +11 -11
  52. package/dist/cordisHost.d.mts +2 -2
  53. package/dist/cordisHost.mjs +1 -2
  54. package/dist/delegation.cjs +8 -8
  55. package/dist/delegation.d.mts +2 -2
  56. package/dist/delegation.mjs +1 -2
  57. package/dist/executionBudget.cjs +4 -3
  58. package/dist/executionBudget.cjs.map +1 -1
  59. package/dist/executionBudget.d.mts +2 -2
  60. package/dist/executionBudget.d.mts.map +1 -1
  61. package/dist/executionBudget.mjs +4 -3
  62. package/dist/executionBudget.mjs.map +1 -1
  63. package/dist/extensionFile.cjs +5 -0
  64. package/dist/extensionFile.d.mts +4 -2
  65. package/dist/extensionFile.mjs +4 -2
  66. package/dist/footer.d.mts +2 -2
  67. package/dist/footer.mjs +1 -2
  68. package/dist/headless.cjs +14 -14
  69. package/dist/headless.d.mts +2 -2
  70. package/dist/headless.mjs +1 -2
  71. package/dist/headlessHub.cjs +308 -109
  72. package/dist/headlessHub.cjs.map +1 -1
  73. package/dist/headlessHub.d.mts +71 -36
  74. package/dist/headlessHub.d.mts.map +1 -1
  75. package/dist/headlessHub.mjs +309 -110
  76. package/dist/headlessHub.mjs.map +1 -1
  77. package/dist/headlessProtocol.cjs +327 -0
  78. package/dist/headlessProtocol.cjs.map +1 -0
  79. package/dist/headlessProtocol.d.mts +30 -0
  80. package/dist/headlessProtocol.d.mts.map +1 -0
  81. package/dist/headlessProtocol.mjs +326 -0
  82. package/dist/headlessProtocol.mjs.map +1 -0
  83. package/dist/headlessServer.cjs +166 -151
  84. package/dist/headlessServer.cjs.map +1 -1
  85. package/dist/headlessServer.d.mts +13 -5
  86. package/dist/headlessServer.d.mts.map +1 -1
  87. package/dist/headlessServer.mjs +166 -151
  88. package/dist/headlessServer.mjs.map +1 -1
  89. package/dist/headlessSessionHost.d.mts +58 -21
  90. package/dist/headlessSessionHost.d.mts.map +1 -1
  91. package/dist/help.cjs +20 -20
  92. package/dist/help.d.mts +2 -2
  93. package/dist/help.mjs +2 -2
  94. package/dist/history.cjs +16 -20
  95. package/dist/history.d.mts +9 -7
  96. package/dist/history.mjs +6 -7
  97. package/dist/historyOwnership.cjs.map +1 -1
  98. package/dist/historyOwnership.d.mts +1 -1
  99. package/dist/historyOwnership.mjs.map +1 -1
  100. package/dist/hubChannel.cjs +9 -0
  101. package/dist/hubChannel.d.mts +3 -2
  102. package/dist/hubChannel.mjs +3 -2
  103. package/dist/index.cjs +26 -28
  104. package/dist/index.d.mts +6 -6
  105. package/dist/index.mjs +6 -6
  106. package/dist/interop/chord.mjs +1 -0
  107. package/dist/interop/chordContext.mjs +1 -0
  108. package/dist/json.cjs +11 -5
  109. package/dist/json.d.mts +4 -2
  110. package/dist/json.mjs +4 -2
  111. package/dist/kernel.cjs +1 -1
  112. package/dist/kernel.d.mts +3 -3
  113. package/dist/kernel.mjs +1 -2
  114. package/dist/leader.d.mts +2 -2
  115. package/dist/leader.mjs +1 -2
  116. package/dist/logSinkTelemetry.mjs +1 -2
  117. package/dist/machineApi.cjs +80 -74
  118. package/dist/machineApi.cjs.map +1 -1
  119. package/dist/machineApi.d.mts +5 -2
  120. package/dist/machineApi.d.mts.map +1 -1
  121. package/dist/machineApi.mjs +78 -71
  122. package/dist/machineApi.mjs.map +1 -1
  123. package/dist/main.cjs +2 -1
  124. package/dist/main.d.mts +2 -1
  125. package/dist/main.mjs +2 -1
  126. package/dist/mcpFacet.d.mts +3 -3
  127. package/dist/mcpProjection.cjs +13 -13
  128. package/dist/mcpProjection.d.mts +2 -2
  129. package/dist/mcpProjection.mjs +1 -2
  130. package/dist/mcpSchemaCost.cjs +4 -4
  131. package/dist/mcpSchemaCost.cjs.map +1 -1
  132. package/dist/mcpSchemaCost.d.mts +2 -2
  133. package/dist/mcpSchemaCost.mjs +4 -4
  134. package/dist/mcpSchemaCost.mjs.map +1 -1
  135. package/dist/mcpSession.cjs +7 -7
  136. package/dist/mcpSession.d.mts +2 -2
  137. package/dist/mcpSession.mjs +1 -2
  138. package/dist/mcpStatus.cjs +2 -2
  139. package/dist/mcpStatus.d.mts +2 -2
  140. package/dist/mcpStatus.mjs +1 -2
  141. package/dist/mcpToolResolver.cjs +3 -3
  142. package/dist/mcpToolResolver.d.mts +2 -2
  143. package/dist/mcpToolResolver.mjs +1 -2
  144. package/dist/mcpWidget.d.mts +2 -2
  145. package/dist/moduleResolution.cjs +43 -8
  146. package/dist/moduleResolution.cjs.map +1 -1
  147. package/dist/moduleResolution.d.mts +10 -1
  148. package/dist/moduleResolution.d.mts.map +1 -1
  149. package/dist/moduleResolution.mjs +40 -7
  150. package/dist/moduleResolution.mjs.map +1 -1
  151. package/dist/narration.cjs +3 -3
  152. package/dist/narration.d.mts +2 -2
  153. package/dist/narration.mjs +1 -2
  154. package/dist/native.cjs +9 -0
  155. package/dist/native.d.mts +4 -3
  156. package/dist/native.mjs +3 -2
  157. package/dist/nodePlatform.cjs +77 -0
  158. package/dist/nodePlatform.cjs.map +1 -0
  159. package/dist/nodePlatform.d.mts +17 -0
  160. package/dist/nodePlatform.d.mts.map +1 -0
  161. package/dist/nodePlatform.mjs +72 -0
  162. package/dist/nodePlatform.mjs.map +1 -0
  163. package/dist/notification.cjs +15 -15
  164. package/dist/notification.d.mts +2 -2
  165. package/dist/notification.mjs +1 -2
  166. package/dist/packageApi.cjs +11 -11
  167. package/dist/packageApi.d.mts +2 -2
  168. package/dist/packageApi.mjs +2 -2
  169. package/dist/packageApiServer.cjs +45 -27
  170. package/dist/packageApiServer.cjs.map +1 -1
  171. package/dist/packageApiServer.d.mts +36 -26
  172. package/dist/packageApiServer.d.mts.map +1 -1
  173. package/dist/packageApiServer.mjs +44 -26
  174. package/dist/packageApiServer.mjs.map +1 -1
  175. package/dist/piSettings.cjs +41 -20
  176. package/dist/piSettings.d.mts +4 -2
  177. package/dist/piSettings.mjs +4 -2
  178. package/dist/platform.cjs +62 -0
  179. package/dist/platform.d.mts +10 -0
  180. package/dist/platform.mjs +10 -0
  181. package/dist/pluginProtocol.cjs +7 -8
  182. package/dist/pluginProtocol.d.mts +2 -2
  183. package/dist/pluginProtocol.mjs +1 -2
  184. package/dist/poPackage.cjs +12 -0
  185. package/dist/poPackage.d.mts +3 -0
  186. package/dist/poPackage.mjs +3 -0
  187. package/dist/profileIdentity.cjs +1 -1
  188. package/dist/profileIdentity.d.mts +2 -2
  189. package/dist/profileIdentity.mjs +1 -2
  190. package/dist/protocol.cjs +3 -3
  191. package/dist/protocol.d.mts +2 -2
  192. package/dist/protocol.mjs +1 -2
  193. package/dist/readiness.cjs +6 -6
  194. package/dist/readiness.d.mts +2 -2
  195. package/dist/readiness.mjs +1 -2
  196. package/dist/remoteApi.cjs.map +1 -1
  197. package/dist/remoteApi.d.mts +2 -2
  198. package/dist/remoteApi.mjs.map +1 -1
  199. package/dist/remoteRuntime.cjs +42 -65
  200. package/dist/remoteRuntime.cjs.map +1 -1
  201. package/dist/remoteRuntime.d.mts +3 -2
  202. package/dist/remoteRuntime.d.mts.map +1 -1
  203. package/dist/remoteRuntime.mjs +41 -62
  204. package/dist/remoteRuntime.mjs.map +1 -1
  205. package/dist/runtimeConfig.cjs +4 -4
  206. package/dist/runtimeConfig.cjs.map +1 -1
  207. package/dist/runtimeConfig.d.mts +10 -9
  208. package/dist/runtimeConfig.d.mts.map +1 -1
  209. package/dist/runtimeConfig.mjs +4 -4
  210. package/dist/runtimeConfig.mjs.map +1 -1
  211. package/dist/runtimeContextApi.cjs +10 -3
  212. package/dist/runtimeContextApi.cjs.map +1 -1
  213. package/dist/runtimeContextApi.d.mts +3 -3
  214. package/dist/runtimeContextApi.d.mts.map +1 -1
  215. package/dist/runtimeContextApi.mjs +10 -3
  216. package/dist/runtimeContextApi.mjs.map +1 -1
  217. package/dist/runtimeCordisHost.cjs +46 -46
  218. package/dist/runtimeCordisHost.cjs.map +1 -1
  219. package/dist/runtimeCordisHost.d.mts +29 -28
  220. package/dist/runtimeCordisHost.d.mts.map +1 -1
  221. package/dist/runtimeCordisHost.mjs +42 -42
  222. package/dist/runtimeCordisHost.mjs.map +1 -1
  223. package/dist/runtimeIdentity.cjs +6 -9
  224. package/dist/runtimeIdentity.cjs.map +1 -1
  225. package/dist/runtimeIdentity.d.mts +5 -1
  226. package/dist/runtimeIdentity.d.mts.map +1 -1
  227. package/dist/runtimeIdentity.mjs +5 -8
  228. package/dist/runtimeIdentity.mjs.map +1 -1
  229. package/dist/runtimeJson.cjs +10 -45
  230. package/dist/runtimeJson.d.mts +3 -22
  231. package/dist/runtimeJson.mjs +3 -39
  232. package/dist/runtimeLogSinkTelemetry.cjs +19 -19
  233. package/dist/runtimeLogSinkTelemetry.cjs.map +1 -1
  234. package/dist/runtimeLogSinkTelemetry.d.mts +19 -19
  235. package/dist/runtimeLogSinkTelemetry.mjs +19 -19
  236. package/dist/runtimeLogSinkTelemetry.mjs.map +1 -1
  237. package/dist/runtimePackages.cjs +7 -2
  238. package/dist/runtimePackages.cjs.map +1 -1
  239. package/dist/runtimePackages.d.mts +4 -1
  240. package/dist/runtimePackages.d.mts.map +1 -1
  241. package/dist/runtimePackages.mjs +7 -2
  242. package/dist/runtimePackages.mjs.map +1 -1
  243. package/dist/runtimePiSettings.cjs +40 -263
  244. package/dist/runtimePiSettings.d.mts +3 -72
  245. package/dist/runtimePiSettings.mjs +3 -241
  246. package/dist/runtimeProtocol.cjs +19 -19
  247. package/dist/runtimeProtocol.cjs.map +1 -1
  248. package/dist/runtimeProtocol.d.mts +7 -7
  249. package/dist/runtimeProtocol.d.mts.map +1 -1
  250. package/dist/runtimeProtocol.mjs +17 -17
  251. package/dist/runtimeProtocol.mjs.map +1 -1
  252. package/dist/runtimeTransition.cjs +9 -9
  253. package/dist/runtimeTransition.cjs.map +1 -1
  254. package/dist/runtimeTransition.d.mts +10 -10
  255. package/dist/runtimeTransition.d.mts.map +1 -1
  256. package/dist/runtimeTransition.mjs +7 -7
  257. package/dist/runtimeTransition.mjs.map +1 -1
  258. package/dist/sandboxHarness.mjs +1 -2
  259. package/dist/server.cjs +3 -7
  260. package/dist/server.d.mts +6 -6
  261. package/dist/server.mjs +3 -4
  262. package/dist/serverPlugin.cjs +39 -0
  263. package/dist/serverPlugin.d.mts +12 -0
  264. package/dist/serverPlugin.mjs +11 -0
  265. package/dist/serverTelemetry.cjs +1 -1
  266. package/dist/serverTelemetry.cjs.map +1 -1
  267. package/dist/serverTelemetry.d.mts +2 -2
  268. package/dist/serverTelemetry.mjs +2 -2
  269. package/dist/serverTelemetry.mjs.map +1 -1
  270. package/dist/sessionFilesApi.cjs +41 -37
  271. package/dist/sessionFilesApi.cjs.map +1 -1
  272. package/dist/sessionFilesApi.d.mts +6 -3
  273. package/dist/sessionFilesApi.d.mts.map +1 -1
  274. package/dist/sessionFilesApi.mjs +41 -36
  275. package/dist/sessionFilesApi.mjs.map +1 -1
  276. package/dist/sessionProtocol.cjs +31 -6
  277. package/dist/sessionProtocol.d.mts +8 -3
  278. package/dist/sessionProtocol.mjs +8 -2
  279. package/dist/skills.cjs +5 -5
  280. package/dist/skills.d.mts +2 -2
  281. package/dist/skills.mjs +1 -2
  282. package/dist/sqliteSessionStorage.cjs +28 -50
  283. package/dist/sqliteSessionStorage.cjs.map +1 -1
  284. package/dist/sqliteSessionStorage.d.mts +13 -20
  285. package/dist/sqliteSessionStorage.d.mts.map +1 -1
  286. package/dist/sqliteSessionStorage.mjs +25 -48
  287. package/dist/sqliteSessionStorage.mjs.map +1 -1
  288. package/dist/src/constants/agentSettled.cjs +7 -0
  289. package/dist/src/constants/agentSettled.cjs.map +1 -0
  290. package/dist/src/constants/agentSettled.mjs +7 -0
  291. package/dist/src/constants/agentSettled.mjs.map +1 -0
  292. package/dist/src/constants/contextApi.cjs +3 -1
  293. package/dist/src/constants/contextApi.cjs.map +1 -1
  294. package/dist/src/constants/contextApi.d.mts +2 -1
  295. package/dist/src/constants/contextApi.d.mts.map +1 -1
  296. package/dist/src/constants/contextApi.mjs +3 -2
  297. package/dist/src/constants/contextApi.mjs.map +1 -1
  298. package/dist/src/constants/voiceTools.cjs +6 -6
  299. package/dist/src/constants/voiceTools.cjs.map +1 -1
  300. package/dist/src/constants/voiceTools.d.mts +3 -3
  301. package/dist/src/constants/voiceTools.mjs +4 -4
  302. package/dist/src/constants/voiceTools.mjs.map +1 -1
  303. package/dist/src/extensions/extensionFile.cjs +22 -5
  304. package/dist/src/extensions/extensionFile.cjs.map +1 -1
  305. package/dist/src/extensions/extensionFile.d.mts +17 -4
  306. package/dist/src/extensions/extensionFile.d.mts.map +1 -1
  307. package/dist/src/extensions/extensionFile.mjs +22 -6
  308. package/dist/src/extensions/extensionFile.mjs.map +1 -1
  309. package/dist/src/extensions/serverPlugin.cjs +231 -92
  310. package/dist/src/extensions/serverPlugin.cjs.map +1 -1
  311. package/dist/src/extensions/serverPlugin.d.mts +2 -2
  312. package/dist/src/extensions/serverPlugin.d.mts.map +1 -1
  313. package/dist/src/extensions/serverPlugin.mjs +232 -93
  314. package/dist/src/extensions/serverPlugin.mjs.map +1 -1
  315. package/dist/src/pi/piSessionRuntime.cjs +349 -142
  316. package/dist/src/pi/piSessionRuntime.cjs.map +1 -1
  317. package/dist/src/pi/piSessionRuntime.d.mts +18 -17
  318. package/dist/src/pi/piSessionRuntime.d.mts.map +1 -1
  319. package/dist/src/pi/piSessionRuntime.mjs +342 -135
  320. package/dist/src/pi/piSessionRuntime.mjs.map +1 -1
  321. package/dist/src/schemas/agentModel.cjs +2 -2
  322. package/dist/src/schemas/agentModel.cjs.map +1 -1
  323. package/dist/src/schemas/agentModel.d.mts +1 -1
  324. package/dist/src/schemas/agentModel.mjs +2 -2
  325. package/dist/src/schemas/agentModel.mjs.map +1 -1
  326. package/dist/src/schemas/apiContracts.d.mts +2 -2
  327. package/dist/src/schemas/apiContracts.d.mts.map +1 -1
  328. package/dist/src/schemas/askUser.cjs +4 -4
  329. package/dist/src/schemas/askUser.cjs.map +1 -1
  330. package/dist/src/schemas/askUser.d.mts +4 -4
  331. package/dist/src/schemas/askUser.d.mts.map +1 -1
  332. package/dist/src/schemas/askUser.mjs +3 -3
  333. package/dist/src/schemas/askUser.mjs.map +1 -1
  334. package/dist/src/schemas/backgroundWork.cjs +10 -10
  335. package/dist/src/schemas/backgroundWork.cjs.map +1 -1
  336. package/dist/src/schemas/backgroundWork.d.mts +9 -9
  337. package/dist/src/schemas/backgroundWork.d.mts.map +1 -1
  338. package/dist/src/schemas/backgroundWork.mjs +8 -8
  339. package/dist/src/schemas/backgroundWork.mjs.map +1 -1
  340. package/dist/src/schemas/childProcess.cjs +5 -5
  341. package/dist/src/schemas/childProcess.cjs.map +1 -1
  342. package/dist/src/schemas/childProcess.d.mts +2 -2
  343. package/dist/src/schemas/childProcess.mjs +5 -5
  344. package/dist/src/schemas/childProcess.mjs.map +1 -1
  345. package/dist/src/schemas/contextContributions.cjs +10 -10
  346. package/dist/src/schemas/contextContributions.cjs.map +1 -1
  347. package/dist/src/schemas/contextContributions.d.mts +16 -16
  348. package/dist/src/schemas/contextContributions.d.mts.map +1 -1
  349. package/dist/src/schemas/contextContributions.mjs +8 -8
  350. package/dist/src/schemas/contextContributions.mjs.map +1 -1
  351. package/dist/src/schemas/delegation.cjs +17 -17
  352. package/dist/src/schemas/delegation.cjs.map +1 -1
  353. package/dist/src/schemas/delegation.d.mts +16 -16
  354. package/dist/src/schemas/delegation.d.mts.map +1 -1
  355. package/dist/src/schemas/delegation.mjs +10 -10
  356. package/dist/src/schemas/delegation.mjs.map +1 -1
  357. package/dist/src/schemas/extensionFile.d.mts +23 -19
  358. package/dist/src/schemas/extensionFile.d.mts.map +1 -1
  359. package/dist/src/schemas/footer.cjs.map +1 -1
  360. package/dist/src/schemas/footer.d.mts +5 -5
  361. package/dist/src/schemas/footer.d.mts.map +1 -1
  362. package/dist/src/schemas/footer.mjs.map +1 -1
  363. package/dist/src/schemas/headless.cjs +37 -37
  364. package/dist/src/schemas/headless.cjs.map +1 -1
  365. package/dist/src/schemas/headless.d.mts +100 -101
  366. package/dist/src/schemas/headless.d.mts.map +1 -1
  367. package/dist/src/schemas/headless.mjs +24 -24
  368. package/dist/src/schemas/headless.mjs.map +1 -1
  369. package/dist/src/schemas/help.cjs +60 -60
  370. package/dist/src/schemas/help.cjs.map +1 -1
  371. package/dist/src/schemas/help.d.mts +43 -43
  372. package/dist/src/schemas/help.d.mts.map +1 -1
  373. package/dist/src/schemas/help.mjs +41 -41
  374. package/dist/src/schemas/help.mjs.map +1 -1
  375. package/dist/src/schemas/home.cjs +127 -0
  376. package/dist/src/schemas/home.cjs.map +1 -0
  377. package/dist/src/schemas/home.d.mts +63 -0
  378. package/dist/src/schemas/home.d.mts.map +1 -0
  379. package/dist/src/schemas/home.mjs +121 -0
  380. package/dist/src/schemas/home.mjs.map +1 -0
  381. package/dist/src/schemas/httpApiContracts.cjs +441 -0
  382. package/dist/src/schemas/httpApiContracts.cjs.map +1 -0
  383. package/dist/src/schemas/httpApiContracts.d.mts +78 -0
  384. package/dist/src/schemas/httpApiContracts.d.mts.map +1 -0
  385. package/dist/src/schemas/httpApiContracts.mjs +434 -0
  386. package/dist/src/schemas/httpApiContracts.mjs.map +1 -0
  387. package/dist/src/schemas/hubChannel.cjs +3 -0
  388. package/dist/src/schemas/hubChannel.cjs.map +1 -1
  389. package/dist/src/schemas/hubChannel.d.mts +84 -60
  390. package/dist/src/schemas/hubChannel.d.mts.map +1 -1
  391. package/dist/src/schemas/hubChannel.mjs +3 -1
  392. package/dist/src/schemas/hubChannel.mjs.map +1 -1
  393. package/dist/src/schemas/leader.cjs.map +1 -1
  394. package/dist/src/schemas/leader.d.mts +3 -3
  395. package/dist/src/schemas/leader.d.mts.map +1 -1
  396. package/dist/src/schemas/leader.mjs.map +1 -1
  397. package/dist/src/schemas/mcpBundle.d.mts +3 -3
  398. package/dist/src/schemas/mcpFacet.cjs.map +1 -1
  399. package/dist/src/schemas/mcpFacet.d.mts +22 -22
  400. package/dist/src/schemas/mcpFacet.d.mts.map +1 -1
  401. package/dist/src/schemas/mcpFacet.mjs.map +1 -1
  402. package/dist/src/schemas/mcpProjection.cjs +41 -41
  403. package/dist/src/schemas/mcpProjection.cjs.map +1 -1
  404. package/dist/src/schemas/mcpProjection.d.mts +31 -30
  405. package/dist/src/schemas/mcpProjection.d.mts.map +1 -1
  406. package/dist/src/schemas/mcpProjection.mjs +29 -29
  407. package/dist/src/schemas/mcpProjection.mjs.map +1 -1
  408. package/dist/src/schemas/mcpSession.cjs +23 -23
  409. package/dist/src/schemas/mcpSession.cjs.map +1 -1
  410. package/dist/src/schemas/mcpSession.d.mts +12 -12
  411. package/dist/src/schemas/mcpSession.d.mts.map +1 -1
  412. package/dist/src/schemas/mcpSession.mjs +18 -18
  413. package/dist/src/schemas/mcpSession.mjs.map +1 -1
  414. package/dist/src/schemas/mcpStatus.cjs +5 -5
  415. package/dist/src/schemas/mcpStatus.cjs.map +1 -1
  416. package/dist/src/schemas/mcpStatus.d.mts +4 -4
  417. package/dist/src/schemas/mcpStatus.d.mts.map +1 -1
  418. package/dist/src/schemas/mcpStatus.mjs +4 -4
  419. package/dist/src/schemas/mcpStatus.mjs.map +1 -1
  420. package/dist/src/schemas/mcpToolResolver.cjs +9 -9
  421. package/dist/src/schemas/mcpToolResolver.cjs.map +1 -1
  422. package/dist/src/schemas/mcpToolResolver.d.mts +7 -7
  423. package/dist/src/schemas/mcpToolResolver.d.mts.map +1 -1
  424. package/dist/src/schemas/mcpToolResolver.mjs +7 -7
  425. package/dist/src/schemas/mcpToolResolver.mjs.map +1 -1
  426. package/dist/src/schemas/narration.cjs +9 -9
  427. package/dist/src/schemas/narration.cjs.map +1 -1
  428. package/dist/src/schemas/narration.d.mts +5 -5
  429. package/dist/src/schemas/narration.d.mts.map +1 -1
  430. package/dist/src/schemas/narration.mjs +7 -7
  431. package/dist/src/schemas/narration.mjs.map +1 -1
  432. package/dist/src/schemas/notification.cjs +45 -45
  433. package/dist/src/schemas/notification.cjs.map +1 -1
  434. package/dist/src/schemas/notification.d.mts +22 -22
  435. package/dist/src/schemas/notification.d.mts.map +1 -1
  436. package/dist/src/schemas/notification.mjs +31 -31
  437. package/dist/src/schemas/notification.mjs.map +1 -1
  438. package/dist/src/schemas/packageApi.cjs +28 -28
  439. package/dist/src/schemas/packageApi.cjs.map +1 -1
  440. package/dist/src/schemas/packageApi.d.mts +91 -65
  441. package/dist/src/schemas/packageApi.d.mts.map +1 -1
  442. package/dist/src/schemas/packageApi.mjs +18 -18
  443. package/dist/src/schemas/packageApi.mjs.map +1 -1
  444. package/dist/src/schemas/platform.cjs +34 -0
  445. package/dist/src/schemas/platform.cjs.map +1 -0
  446. package/dist/src/schemas/platform.d.mts +75 -0
  447. package/dist/src/schemas/platform.d.mts.map +1 -0
  448. package/dist/src/schemas/platform.mjs +27 -0
  449. package/dist/src/schemas/platform.mjs.map +1 -0
  450. package/dist/src/schemas/pluginContributions.cjs.map +1 -1
  451. package/dist/src/schemas/pluginContributions.d.mts +12 -12
  452. package/dist/src/schemas/pluginContributions.d.mts.map +1 -1
  453. package/dist/src/schemas/pluginContributions.mjs.map +1 -1
  454. package/dist/src/schemas/pluginProtocol.cjs +24 -27
  455. package/dist/src/schemas/pluginProtocol.cjs.map +1 -1
  456. package/dist/src/schemas/pluginProtocol.d.mts +21 -21
  457. package/dist/src/schemas/pluginProtocol.d.mts.map +1 -1
  458. package/dist/src/schemas/pluginProtocol.mjs +18 -20
  459. package/dist/src/schemas/pluginProtocol.mjs.map +1 -1
  460. package/dist/src/schemas/profileIdentity.cjs +2 -2
  461. package/dist/src/schemas/profileIdentity.cjs.map +1 -1
  462. package/dist/src/schemas/profileIdentity.d.mts +1 -1
  463. package/dist/src/schemas/profileIdentity.mjs +2 -2
  464. package/dist/src/schemas/profileIdentity.mjs.map +1 -1
  465. package/dist/src/schemas/protocolChannelsContract.cjs +27 -0
  466. package/dist/src/schemas/protocolChannelsContract.cjs.map +1 -0
  467. package/dist/src/schemas/protocolChannelsContract.d.mts +37 -0
  468. package/dist/src/schemas/protocolChannelsContract.d.mts.map +1 -0
  469. package/dist/src/schemas/protocolChannelsContract.mjs +25 -0
  470. package/dist/src/schemas/protocolChannelsContract.mjs.map +1 -0
  471. package/dist/src/schemas/protocolContracts.cjs +168 -0
  472. package/dist/src/schemas/protocolContracts.cjs.map +1 -0
  473. package/dist/src/schemas/protocolContracts.d.mts +69 -0
  474. package/dist/src/schemas/protocolContracts.d.mts.map +1 -0
  475. package/dist/src/schemas/protocolContracts.mjs +164 -0
  476. package/dist/src/schemas/protocolContracts.mjs.map +1 -0
  477. package/dist/src/schemas/protocolHubContract.cjs +51 -0
  478. package/dist/src/schemas/protocolHubContract.cjs.map +1 -0
  479. package/dist/src/schemas/protocolHubContract.d.mts +218 -0
  480. package/dist/src/schemas/protocolHubContract.d.mts.map +1 -0
  481. package/dist/src/schemas/protocolHubContract.mjs +49 -0
  482. package/dist/src/schemas/protocolHubContract.mjs.map +1 -0
  483. package/dist/src/schemas/protocolSessionContract.cjs +22 -0
  484. package/dist/src/schemas/protocolSessionContract.cjs.map +1 -0
  485. package/dist/src/schemas/protocolSessionContract.d.mts +324 -0
  486. package/dist/src/schemas/protocolSessionContract.d.mts.map +1 -0
  487. package/dist/src/schemas/protocolSessionContract.mjs +22 -0
  488. package/dist/src/schemas/protocolSessionContract.mjs.map +1 -0
  489. package/dist/src/schemas/protocolThreadContract.cjs +21 -0
  490. package/dist/src/schemas/protocolThreadContract.cjs.map +1 -0
  491. package/dist/src/schemas/protocolThreadContract.d.mts +29 -0
  492. package/dist/src/schemas/protocolThreadContract.d.mts.map +1 -0
  493. package/dist/src/schemas/protocolThreadContract.mjs +20 -0
  494. package/dist/src/schemas/protocolThreadContract.mjs.map +1 -0
  495. package/dist/src/schemas/readiness.cjs +36 -36
  496. package/dist/src/schemas/readiness.cjs.map +1 -1
  497. package/dist/src/schemas/readiness.d.mts +37 -37
  498. package/dist/src/schemas/readiness.d.mts.map +1 -1
  499. package/dist/src/schemas/readiness.mjs +31 -31
  500. package/dist/src/schemas/readiness.mjs.map +1 -1
  501. package/dist/src/schemas/serverBundle.d.mts +5 -5
  502. package/dist/src/schemas/serverPlugin.cjs +103 -0
  503. package/dist/src/schemas/serverPlugin.cjs.map +1 -0
  504. package/dist/src/schemas/serverPlugin.d.mts +176 -0
  505. package/dist/src/schemas/serverPlugin.d.mts.map +1 -0
  506. package/dist/src/schemas/serverPlugin.mjs +95 -0
  507. package/dist/src/schemas/serverPlugin.mjs.map +1 -0
  508. package/dist/src/schemas/serverScope.cjs +37 -0
  509. package/dist/src/schemas/serverScope.cjs.map +1 -0
  510. package/dist/src/schemas/serverScope.d.mts +77 -0
  511. package/dist/src/schemas/serverScope.d.mts.map +1 -0
  512. package/dist/src/schemas/serverScope.mjs +33 -0
  513. package/dist/src/schemas/serverScope.mjs.map +1 -0
  514. package/dist/src/schemas/sessionApiContracts.cjs +320 -0
  515. package/dist/src/schemas/sessionApiContracts.cjs.map +1 -0
  516. package/dist/src/schemas/sessionApiContracts.mjs +318 -0
  517. package/dist/src/schemas/sessionApiContracts.mjs.map +1 -0
  518. package/dist/src/schemas/sessionProtocol.cjs +20 -13
  519. package/dist/src/schemas/sessionProtocol.cjs.map +1 -1
  520. package/dist/src/schemas/sessionProtocol.d.mts +37 -54
  521. package/dist/src/schemas/sessionProtocol.d.mts.map +1 -1
  522. package/dist/src/schemas/sessionProtocol.mjs +17 -8
  523. package/dist/src/schemas/sessionProtocol.mjs.map +1 -1
  524. package/dist/src/schemas/skills.cjs +16 -16
  525. package/dist/src/schemas/skills.cjs.map +1 -1
  526. package/dist/src/schemas/skills.d.mts +7 -7
  527. package/dist/src/schemas/skills.d.mts.map +1 -1
  528. package/dist/src/schemas/skills.mjs +12 -12
  529. package/dist/src/schemas/skills.mjs.map +1 -1
  530. package/dist/src/schemas/toolOverrides.cjs +9 -9
  531. package/dist/src/schemas/toolOverrides.cjs.map +1 -1
  532. package/dist/src/schemas/toolOverrides.d.mts +8 -8
  533. package/dist/src/schemas/toolOverrides.d.mts.map +1 -1
  534. package/dist/src/schemas/toolOverrides.mjs +7 -7
  535. package/dist/src/schemas/toolOverrides.mjs.map +1 -1
  536. package/dist/src/schemas/toolSurface.cjs +9 -9
  537. package/dist/src/schemas/toolSurface.cjs.map +1 -1
  538. package/dist/src/schemas/toolSurface.d.mts +13 -13
  539. package/dist/src/schemas/toolSurface.d.mts.map +1 -1
  540. package/dist/src/schemas/toolSurface.mjs +7 -7
  541. package/dist/src/schemas/toolSurface.mjs.map +1 -1
  542. package/dist/src/schemas/uiHub.cjs +9 -9
  543. package/dist/src/schemas/uiHub.cjs.map +1 -1
  544. package/dist/src/schemas/uiHub.d.mts +12 -12
  545. package/dist/src/schemas/uiHub.d.mts.map +1 -1
  546. package/dist/src/schemas/uiHub.mjs +7 -7
  547. package/dist/src/schemas/uiHub.mjs.map +1 -1
  548. package/dist/src/server/directHarnessRuntime.cjs +691 -775
  549. package/dist/src/server/directHarnessRuntime.cjs.map +1 -1
  550. package/dist/src/server/directHarnessRuntime.d.mts +5 -1
  551. package/dist/src/server/directHarnessRuntime.d.mts.map +1 -0
  552. package/dist/src/server/directHarnessRuntime.mjs +671 -754
  553. package/dist/src/server/directHarnessRuntime.mjs.map +1 -1
  554. package/dist/src/server/largeFrameLink.cjs +47 -0
  555. package/dist/src/server/largeFrameLink.cjs.map +1 -0
  556. package/dist/src/server/largeFrameLink.mjs +47 -0
  557. package/dist/src/server/largeFrameLink.mjs.map +1 -0
  558. package/dist/src/server/liveImport.cjs +1 -1
  559. package/dist/src/server/liveImport.cjs.map +1 -1
  560. package/dist/src/server/liveImport.d.mts +1 -1
  561. package/dist/src/server/liveImport.mjs +1 -1
  562. package/dist/src/server/liveImport.mjs.map +1 -1
  563. package/dist/src/server/mcpBundleLoader.cjs.map +1 -1
  564. package/dist/src/server/mcpBundleLoader.d.mts +6 -6
  565. package/dist/src/server/mcpBundleLoader.d.mts.map +1 -1
  566. package/dist/src/server/mcpBundleLoader.mjs.map +1 -1
  567. package/dist/src/server/serverPackages.cjs +60 -0
  568. package/dist/src/server/serverPackages.cjs.map +1 -0
  569. package/dist/src/server/serverPackages.d.mts +44 -0
  570. package/dist/src/server/serverPackages.d.mts.map +1 -0
  571. package/dist/src/server/serverPackages.mjs +59 -0
  572. package/dist/src/server/serverPackages.mjs.map +1 -0
  573. package/dist/src/server/serverScope.cjs +510 -0
  574. package/dist/src/server/serverScope.cjs.map +1 -0
  575. package/dist/src/server/serverScope.d.mts +123 -0
  576. package/dist/src/server/serverScope.d.mts.map +1 -0
  577. package/dist/src/server/serverScope.mjs +510 -0
  578. package/dist/src/server/serverScope.mjs.map +1 -0
  579. package/dist/src/server/sessionMcpHandler.cjs +3 -3
  580. package/dist/src/server/sessionMcpHandler.cjs.map +1 -1
  581. package/dist/src/server/sessionMcpHandler.mjs +4 -4
  582. package/dist/src/server/sessionMcpHandler.mjs.map +1 -1
  583. package/dist/src/server/sessionMcpRoutes.cjs +2 -1
  584. package/dist/src/server/sessionMcpRoutes.cjs.map +1 -1
  585. package/dist/src/server/sessionMcpRoutes.mjs +2 -1
  586. package/dist/src/server/sessionMcpRoutes.mjs.map +1 -1
  587. package/dist/src/server/threadJournals.cjs +38 -107
  588. package/dist/src/server/threadJournals.cjs.map +1 -1
  589. package/dist/src/server/threadJournals.mjs +38 -104
  590. package/dist/src/server/threadJournals.mjs.map +1 -1
  591. package/dist/src/services/apiSurfaceAssert/index.cjs +1 -1
  592. package/dist/src/services/apiSurfaceAssert/index.cjs.map +1 -1
  593. package/dist/src/services/apiSurfaceAssert/index.d.mts +6 -6
  594. package/dist/src/services/apiSurfaceAssert/index.mjs +1 -1
  595. package/dist/src/services/apiSurfaceAssert/index.mjs.map +1 -1
  596. package/dist/src/services/chatgptAuth/index.cjs +1 -220
  597. package/dist/src/services/chatgptAuth/index.cjs.map +1 -1
  598. package/dist/src/services/chatgptAuth/index.d.mts +0 -18
  599. package/dist/src/services/chatgptAuth/index.d.mts.map +1 -1
  600. package/dist/src/services/chatgptAuth/index.mjs +1 -217
  601. package/dist/src/services/chatgptAuth/index.mjs.map +1 -1
  602. package/dist/src/services/chatgptImages/index.cjs +1 -1
  603. package/dist/src/services/chatgptImages/index.cjs.map +1 -1
  604. package/dist/src/services/chatgptImages/index.mjs +1 -1
  605. package/dist/src/services/chatgptImages/index.mjs.map +1 -1
  606. package/dist/src/services/chatgptLogin/index.cjs +230 -0
  607. package/dist/src/services/chatgptLogin/index.cjs.map +1 -0
  608. package/dist/src/services/chatgptLogin/index.d.mts +21 -0
  609. package/dist/src/services/chatgptLogin/index.d.mts.map +1 -0
  610. package/dist/src/services/chatgptLogin/index.mjs +227 -0
  611. package/dist/src/services/chatgptLogin/index.mjs.map +1 -0
  612. package/dist/src/services/chatgptWebSearch/index.cjs +1 -1
  613. package/dist/src/services/chatgptWebSearch/index.cjs.map +1 -1
  614. package/dist/src/services/chatgptWebSearch/index.mjs +1 -1
  615. package/dist/src/services/chatgptWebSearch/index.mjs.map +1 -1
  616. package/dist/src/services/contextContributions/index.cjs +8 -8
  617. package/dist/src/services/contextContributions/index.cjs.map +1 -1
  618. package/dist/src/services/contextContributions/index.d.mts +3 -3
  619. package/dist/src/services/contextContributions/index.d.mts.map +1 -1
  620. package/dist/src/services/contextContributions/index.mjs +8 -8
  621. package/dist/src/services/contextContributions/index.mjs.map +1 -1
  622. package/dist/src/services/devProxyStore/devProxyRecords.cjs +59 -0
  623. package/dist/src/services/devProxyStore/devProxyRecords.cjs.map +1 -0
  624. package/dist/src/services/devProxyStore/devProxyRecords.mjs +56 -0
  625. package/dist/src/services/devProxyStore/devProxyRecords.mjs.map +1 -0
  626. package/dist/src/services/devProxyStore/index.cjs +7 -101
  627. package/dist/src/services/devProxyStore/index.cjs.map +1 -1
  628. package/dist/src/services/devProxyStore/index.mjs +7 -101
  629. package/dist/src/services/devProxyStore/index.mjs.map +1 -1
  630. package/dist/src/services/devProxyStore/sync.cjs +66 -0
  631. package/dist/src/services/devProxyStore/sync.cjs.map +1 -0
  632. package/dist/src/services/devProxyStore/sync.mjs +63 -0
  633. package/dist/src/services/devProxyStore/sync.mjs.map +1 -0
  634. package/dist/src/services/durableNavigation/docs.cjs +15 -0
  635. package/dist/src/services/durableNavigation/docs.cjs.map +1 -0
  636. package/dist/src/services/durableNavigation/docs.mjs +16 -0
  637. package/dist/src/services/durableNavigation/docs.mjs.map +1 -0
  638. package/dist/src/services/durableNavigation/index.cjs +3 -18
  639. package/dist/src/services/durableNavigation/index.cjs.map +1 -1
  640. package/dist/src/services/durableNavigation/index.mjs +2 -17
  641. package/dist/src/services/durableNavigation/index.mjs.map +1 -1
  642. package/dist/src/services/durableQueue/docs.cjs +12 -0
  643. package/dist/src/services/durableQueue/docs.cjs.map +1 -0
  644. package/dist/src/services/durableQueue/docs.mjs +13 -0
  645. package/dist/src/services/durableQueue/docs.mjs.map +1 -0
  646. package/dist/src/services/durableQueue/index.cjs +151 -0
  647. package/dist/src/services/durableQueue/index.cjs.map +1 -0
  648. package/dist/src/services/durableQueue/index.mjs +149 -0
  649. package/dist/src/services/durableQueue/index.mjs.map +1 -0
  650. package/dist/src/services/durableRequestReceipts/docs.cjs +11 -0
  651. package/dist/src/services/durableRequestReceipts/docs.cjs.map +1 -0
  652. package/dist/src/services/durableRequestReceipts/docs.mjs +12 -0
  653. package/dist/src/services/durableRequestReceipts/docs.mjs.map +1 -0
  654. package/dist/src/services/{requestReceipts → durableRequestReceipts}/index.cjs +10 -16
  655. package/dist/src/services/durableRequestReceipts/index.cjs.map +1 -0
  656. package/dist/src/services/durableRequestReceipts/index.d.mts +12 -0
  657. package/dist/src/services/durableRequestReceipts/index.d.mts.map +1 -0
  658. package/dist/src/services/{requestReceipts → durableRequestReceipts}/index.mjs +7 -13
  659. package/dist/src/services/durableRequestReceipts/index.mjs.map +1 -0
  660. package/dist/src/services/durableSession/docs.cjs +65 -0
  661. package/dist/src/services/durableSession/docs.cjs.map +1 -0
  662. package/dist/src/services/durableSession/docs.d.mts +17 -0
  663. package/dist/src/services/durableSession/docs.d.mts.map +1 -0
  664. package/dist/src/services/durableSession/docs.mjs +60 -0
  665. package/dist/src/services/durableSession/docs.mjs.map +1 -0
  666. package/dist/src/services/durableSession/index.cjs +21 -0
  667. package/dist/src/services/durableSession/index.cjs.map +1 -0
  668. package/dist/src/services/durableSession/index.d.mts +13 -0
  669. package/dist/src/services/durableSession/index.d.mts.map +1 -0
  670. package/dist/src/services/durableSession/index.mjs +20 -0
  671. package/dist/src/services/durableSession/index.mjs.map +1 -0
  672. package/dist/src/services/durableSubagents/docs.cjs +15 -0
  673. package/dist/src/services/durableSubagents/docs.cjs.map +1 -0
  674. package/dist/src/services/durableSubagents/docs.mjs +16 -0
  675. package/dist/src/services/durableSubagents/docs.mjs.map +1 -0
  676. package/dist/src/services/durableSubagents/extension.cjs +11 -0
  677. package/dist/src/services/durableSubagents/extension.cjs.map +1 -0
  678. package/dist/src/services/durableSubagents/extension.mjs +12 -0
  679. package/dist/src/services/durableSubagents/extension.mjs.map +1 -0
  680. package/dist/src/services/durableSubagents/index.cjs +95 -0
  681. package/dist/src/services/durableSubagents/index.cjs.map +1 -0
  682. package/dist/src/services/durableSubagents/index.mjs +90 -0
  683. package/dist/src/services/durableSubagents/index.mjs.map +1 -0
  684. package/dist/src/services/durableSubagents/tasks.cjs +25 -0
  685. package/dist/src/services/durableSubagents/tasks.cjs.map +1 -0
  686. package/dist/src/services/durableSubagents/tasks.mjs +26 -0
  687. package/dist/src/services/durableSubagents/tasks.mjs.map +1 -0
  688. package/dist/src/services/headlessClient/index.cjs +20 -13
  689. package/dist/src/services/headlessClient/index.cjs.map +1 -1
  690. package/dist/src/services/headlessClient/index.mjs +21 -14
  691. package/dist/src/services/headlessClient/index.mjs.map +1 -1
  692. package/dist/src/services/historyOwnership/type.d.mts +15 -0
  693. package/dist/src/services/historyOwnership/type.d.mts.map +1 -0
  694. package/dist/src/services/hubChannelHarness/index.cjs +2 -2
  695. package/dist/src/services/hubChannelHarness/index.cjs.map +1 -1
  696. package/dist/src/services/hubChannelHarness/index.d.mts +8 -8
  697. package/dist/src/services/hubChannelHarness/index.d.mts.map +1 -1
  698. package/dist/src/services/hubChannelHarness/index.mjs +2 -2
  699. package/dist/src/services/hubChannelHarness/index.mjs.map +1 -1
  700. package/dist/src/services/json/core.cjs +30 -0
  701. package/dist/src/services/json/core.cjs.map +1 -0
  702. package/dist/src/services/json/core.d.mts +21 -0
  703. package/dist/src/services/json/core.d.mts.map +1 -0
  704. package/dist/src/services/json/core.mjs +26 -0
  705. package/dist/src/services/json/core.mjs.map +1 -0
  706. package/dist/src/services/json/sync.cjs +48 -0
  707. package/dist/src/services/json/sync.cjs.map +1 -0
  708. package/dist/src/services/json/sync.d.mts +22 -0
  709. package/dist/src/services/json/sync.d.mts.map +1 -0
  710. package/dist/src/services/json/sync.mjs +43 -0
  711. package/dist/src/services/json/sync.mjs.map +1 -0
  712. package/dist/src/services/kernel/index.cjs +2 -2
  713. package/dist/src/services/kernel/index.cjs.map +1 -1
  714. package/dist/src/services/kernel/index.d.mts +3 -3
  715. package/dist/src/services/kernel/index.d.mts.map +1 -1
  716. package/dist/src/services/kernel/index.mjs +2 -2
  717. package/dist/src/services/kernel/index.mjs.map +1 -1
  718. package/dist/src/services/nativeChildTools/index.cjs +16 -0
  719. package/dist/src/services/nativeChildTools/index.cjs.map +1 -0
  720. package/dist/src/services/nativeChildTools/index.mjs +16 -0
  721. package/dist/src/services/nativeChildTools/index.mjs.map +1 -0
  722. package/dist/src/services/nodeHost/index.cjs +30 -0
  723. package/dist/src/services/nodeHost/index.cjs.map +1 -0
  724. package/dist/src/services/nodeHost/index.d.mts +16 -0
  725. package/dist/src/services/nodeHost/index.d.mts.map +1 -0
  726. package/dist/src/services/nodeHost/index.mjs +27 -0
  727. package/dist/src/services/nodeHost/index.mjs.map +1 -0
  728. package/dist/src/services/nodeModelDependencies/index.cjs +89 -0
  729. package/dist/src/services/nodeModelDependencies/index.cjs.map +1 -0
  730. package/dist/src/services/nodeModelDependencies/index.mjs +86 -0
  731. package/dist/src/services/nodeModelDependencies/index.mjs.map +1 -0
  732. package/dist/src/services/openSessionRegistry/index.cjs +6 -128
  733. package/dist/src/services/openSessionRegistry/index.cjs.map +1 -1
  734. package/dist/src/services/openSessionRegistry/index.d.mts +5 -36
  735. package/dist/src/services/openSessionRegistry/index.mjs +6 -128
  736. package/dist/src/services/openSessionRegistry/index.mjs.map +1 -1
  737. package/dist/src/services/openSessionRegistry/openSessionRecords.cjs +87 -0
  738. package/dist/src/services/openSessionRegistry/openSessionRecords.cjs.map +1 -0
  739. package/dist/src/services/openSessionRegistry/openSessionRecords.d.mts +30 -0
  740. package/dist/src/services/openSessionRegistry/openSessionRecords.d.mts.map +1 -0
  741. package/dist/src/services/openSessionRegistry/openSessionRecords.mjs +81 -0
  742. package/dist/src/services/openSessionRegistry/openSessionRecords.mjs.map +1 -0
  743. package/dist/src/services/openSessionRegistry/sync.cjs +71 -0
  744. package/dist/src/services/openSessionRegistry/sync.cjs.map +1 -0
  745. package/dist/src/services/openSessionRegistry/sync.d.mts +14 -0
  746. package/dist/src/services/openSessionRegistry/sync.d.mts.map +1 -0
  747. package/dist/src/services/openSessionRegistry/sync.mjs +68 -0
  748. package/dist/src/services/openSessionRegistry/sync.mjs.map +1 -0
  749. package/dist/src/services/packageApiHarness/index.cjs +1 -1
  750. package/dist/src/services/packageApiHarness/index.cjs.map +1 -1
  751. package/dist/src/services/packageApiHarness/index.d.mts +6 -6
  752. package/dist/src/services/packageApiHarness/index.d.mts.map +1 -1
  753. package/dist/src/services/packageApiHarness/index.mjs +2 -2
  754. package/dist/src/services/packageApiHarness/index.mjs.map +1 -1
  755. package/dist/src/services/piArgs/index.cjs +53 -0
  756. package/dist/src/services/piArgs/index.cjs.map +1 -0
  757. package/dist/src/services/piArgs/index.d.mts +6 -0
  758. package/dist/src/services/piArgs/index.d.mts.map +1 -0
  759. package/dist/src/services/piArgs/index.mjs +53 -0
  760. package/dist/src/services/piArgs/index.mjs.map +1 -0
  761. package/dist/src/services/piExtensionHost/index.cjs +47 -39
  762. package/dist/src/services/piExtensionHost/index.cjs.map +1 -1
  763. package/dist/src/services/piExtensionHost/index.d.mts +83 -0
  764. package/dist/src/services/piExtensionHost/index.d.mts.map +1 -0
  765. package/dist/src/services/piExtensionHost/index.mjs +47 -38
  766. package/dist/src/services/piExtensionHost/index.mjs.map +1 -1
  767. package/dist/src/services/piHelpTools/index.cjs +5 -5
  768. package/dist/src/services/piHelpTools/index.cjs.map +1 -1
  769. package/dist/src/services/piHelpTools/index.d.mts.map +1 -1
  770. package/dist/src/services/piHelpTools/index.mjs +7 -7
  771. package/dist/src/services/piHelpTools/index.mjs.map +1 -1
  772. package/dist/src/services/piMessages/index.cjs +106 -0
  773. package/dist/src/services/piMessages/index.cjs.map +1 -0
  774. package/dist/src/services/piMessages/index.mjs +105 -0
  775. package/dist/src/services/piMessages/index.mjs.map +1 -0
  776. package/dist/src/services/piSessionEntries/index.cjs +4 -4
  777. package/dist/src/services/piSessionEntries/index.cjs.map +1 -1
  778. package/dist/src/services/piSessionEntries/index.mjs +3 -3
  779. package/dist/src/services/piSessionEntries/index.mjs.map +1 -1
  780. package/dist/src/services/piSettings/core.cjs +308 -0
  781. package/dist/src/services/piSettings/core.cjs.map +1 -0
  782. package/dist/src/services/piSettings/core.d.mts +102 -0
  783. package/dist/src/services/piSettings/core.d.mts.map +1 -0
  784. package/dist/src/services/piSettings/core.mjs +276 -0
  785. package/dist/src/services/piSettings/core.mjs.map +1 -0
  786. package/dist/src/services/piSettings/sync.cjs +119 -0
  787. package/dist/src/services/piSettings/sync.cjs.map +1 -0
  788. package/dist/src/services/piSettings/sync.d.mts +44 -0
  789. package/dist/src/services/piSettings/sync.d.mts.map +1 -0
  790. package/dist/src/services/piSettings/sync.mjs +110 -0
  791. package/dist/src/services/piSettings/sync.mjs.map +1 -0
  792. package/dist/src/services/piSummary/index.cjs +7 -0
  793. package/dist/src/services/piSummary/index.cjs.map +1 -0
  794. package/dist/src/services/piSummary/index.mjs +7 -0
  795. package/dist/src/services/piSummary/index.mjs.map +1 -0
  796. package/dist/src/services/platformFiles/index.cjs +44 -0
  797. package/dist/src/services/platformFiles/index.cjs.map +1 -0
  798. package/dist/src/services/platformFiles/index.d.mts +16 -0
  799. package/dist/src/services/platformFiles/index.d.mts.map +1 -0
  800. package/dist/src/services/platformFiles/index.mjs +39 -0
  801. package/dist/src/services/platformFiles/index.mjs.map +1 -0
  802. package/dist/src/services/pluginLifecycle/index.cjs +19 -13
  803. package/dist/src/services/pluginLifecycle/index.cjs.map +1 -1
  804. package/dist/src/services/pluginLifecycle/index.d.mts +2 -0
  805. package/dist/src/services/pluginLifecycle/index.d.mts.map +1 -1
  806. package/dist/src/services/pluginLifecycle/index.mjs +19 -14
  807. package/dist/src/services/pluginLifecycle/index.mjs.map +1 -1
  808. package/dist/src/services/poPackage/core.cjs +73 -0
  809. package/dist/src/services/poPackage/core.cjs.map +1 -0
  810. package/dist/src/services/poPackage/core.d.mts +32 -0
  811. package/dist/src/services/poPackage/core.d.mts.map +1 -0
  812. package/dist/src/services/poPackage/core.mjs +66 -0
  813. package/dist/src/services/poPackage/core.mjs.map +1 -0
  814. package/dist/src/services/poPackage/sync.cjs +55 -0
  815. package/dist/src/services/poPackage/sync.cjs.map +1 -0
  816. package/dist/src/services/poPackage/sync.d.mts +21 -0
  817. package/dist/src/services/poPackage/sync.d.mts.map +1 -0
  818. package/dist/src/services/poPackage/sync.mjs +50 -0
  819. package/dist/src/services/poPackage/sync.mjs.map +1 -0
  820. package/dist/src/services/providerAuth/index.cjs +11 -7
  821. package/dist/src/services/providerAuth/index.cjs.map +1 -1
  822. package/dist/src/services/providerAuth/index.mjs +11 -7
  823. package/dist/src/services/providerAuth/index.mjs.map +1 -1
  824. package/dist/src/services/publicFileShares/index.cjs +1 -1
  825. package/dist/src/services/publicFileShares/index.cjs.map +1 -1
  826. package/dist/src/services/publicFileShares/index.d.mts +2 -2
  827. package/dist/src/services/publicFileShares/index.mjs +2 -2
  828. package/dist/src/services/publicFileShares/index.mjs.map +1 -1
  829. package/dist/src/services/remoteAccess/index.d.mts +1 -0
  830. package/dist/src/services/remoteAccess/index.d.mts.map +1 -1
  831. package/dist/src/services/remoteAccessStore/index.cjs +8 -190
  832. package/dist/src/services/remoteAccessStore/index.cjs.map +1 -1
  833. package/dist/src/services/remoteAccessStore/index.d.mts +2 -0
  834. package/dist/src/services/remoteAccessStore/index.mjs +7 -187
  835. package/dist/src/services/remoteAccessStore/index.mjs.map +1 -1
  836. package/dist/src/services/remoteAccessStore/remoteAccessRecords.cjs +98 -0
  837. package/dist/src/services/remoteAccessStore/remoteAccessRecords.cjs.map +1 -0
  838. package/dist/src/services/remoteAccessStore/remoteAccessRecords.mjs +88 -0
  839. package/dist/src/services/remoteAccessStore/remoteAccessRecords.mjs.map +1 -0
  840. package/dist/src/services/remoteAccessStore/sync.cjs +111 -0
  841. package/dist/src/services/remoteAccessStore/sync.cjs.map +1 -0
  842. package/dist/src/services/remoteAccessStore/sync.mjs +108 -0
  843. package/dist/src/services/remoteAccessStore/sync.mjs.map +1 -0
  844. package/dist/src/services/runtimeIdentity/sync.cjs +23 -0
  845. package/dist/src/services/runtimeIdentity/sync.cjs.map +1 -0
  846. package/dist/src/services/runtimeIdentity/sync.d.mts +9 -0
  847. package/dist/src/services/runtimeIdentity/sync.d.mts.map +1 -0
  848. package/dist/src/services/runtimeIdentity/sync.mjs +20 -0
  849. package/dist/src/services/runtimeIdentity/sync.mjs.map +1 -0
  850. package/dist/src/services/serialRunner/index.cjs +25 -0
  851. package/dist/src/services/serialRunner/index.cjs.map +1 -0
  852. package/dist/src/services/serialRunner/index.d.mts +10 -0
  853. package/dist/src/services/serialRunner/index.d.mts.map +1 -0
  854. package/dist/src/services/serialRunner/index.mjs +25 -0
  855. package/dist/src/services/serialRunner/index.mjs.map +1 -0
  856. package/dist/src/services/{serverFacet → serverHost}/index.cjs +5 -5
  857. package/dist/src/services/serverHost/index.cjs.map +1 -0
  858. package/dist/src/services/serverHost/index.d.mts +31 -0
  859. package/dist/src/services/serverHost/index.d.mts.map +1 -0
  860. package/dist/src/services/{serverFacet → serverHost}/index.mjs +5 -5
  861. package/dist/src/services/serverHost/index.mjs.map +1 -0
  862. package/dist/src/services/sessionAttachments/index.cjs +4 -3
  863. package/dist/src/services/sessionAttachments/index.cjs.map +1 -1
  864. package/dist/src/services/sessionAttachments/index.d.mts +1 -6
  865. package/dist/src/services/sessionAttachments/index.d.mts.map +1 -1
  866. package/dist/src/services/sessionAttachments/index.mjs +3 -2
  867. package/dist/src/services/sessionAttachments/index.mjs.map +1 -1
  868. package/dist/src/services/sessionAttachments/type.d.mts +9 -0
  869. package/dist/src/services/sessionAttachments/type.d.mts.map +1 -0
  870. package/dist/src/services/sessionFiles/index.cjs +96 -0
  871. package/dist/src/services/sessionFiles/index.cjs.map +1 -0
  872. package/dist/src/services/sessionFiles/index.d.mts +33 -0
  873. package/dist/src/services/sessionFiles/index.d.mts.map +1 -0
  874. package/dist/src/services/sessionFiles/index.mjs +89 -0
  875. package/dist/src/services/sessionFiles/index.mjs.map +1 -0
  876. package/dist/src/services/sessionFiles/sessionDirectory.cjs +66 -0
  877. package/dist/src/services/sessionFiles/sessionDirectory.cjs.map +1 -0
  878. package/dist/src/services/sessionFiles/sessionDirectory.mjs +62 -0
  879. package/dist/src/services/sessionFiles/sessionDirectory.mjs.map +1 -0
  880. package/dist/src/services/sessionGitStatus/index.cjs +31 -33
  881. package/dist/src/services/sessionGitStatus/index.cjs.map +1 -1
  882. package/dist/src/services/sessionGitStatus/index.mjs +31 -33
  883. package/dist/src/services/sessionGitStatus/index.mjs.map +1 -1
  884. package/dist/src/services/sessionPresentation/index.cjs +3 -27
  885. package/dist/src/services/sessionPresentation/index.cjs.map +1 -1
  886. package/dist/src/services/sessionPresentation/index.mjs +3 -27
  887. package/dist/src/services/sessionPresentation/index.mjs.map +1 -1
  888. package/dist/src/services/skillPrompt/index.cjs +11 -0
  889. package/dist/src/services/skillPrompt/index.cjs.map +1 -0
  890. package/dist/src/services/skillPrompt/index.mjs +11 -0
  891. package/dist/src/services/skillPrompt/index.mjs.map +1 -0
  892. package/dist/src/services/sqliteSessionHistory/index.cjs +44 -30
  893. package/dist/src/services/sqliteSessionHistory/index.cjs.map +1 -1
  894. package/dist/src/services/sqliteSessionHistory/index.d.mts +7 -4
  895. package/dist/src/services/sqliteSessionHistory/index.d.mts.map +1 -1
  896. package/dist/src/services/sqliteSessionHistory/index.mjs +43 -28
  897. package/dist/src/services/sqliteSessionHistory/index.mjs.map +1 -1
  898. package/dist/src/services/sqliteTranscriptReader/index.cjs +21 -45
  899. package/dist/src/services/sqliteTranscriptReader/index.cjs.map +1 -1
  900. package/dist/src/services/sqliteTranscriptReader/index.d.mts +3 -2
  901. package/dist/src/services/sqliteTranscriptReader/index.d.mts.map +1 -1
  902. package/dist/src/services/sqliteTranscriptReader/index.mjs +16 -38
  903. package/dist/src/services/sqliteTranscriptReader/index.mjs.map +1 -1
  904. package/dist/src/services/testMode/index.cjs +162 -0
  905. package/dist/src/services/testMode/index.cjs.map +1 -0
  906. package/dist/src/services/testMode/index.d.mts +17 -0
  907. package/dist/src/services/testMode/index.d.mts.map +1 -0
  908. package/dist/src/services/testMode/index.mjs +155 -0
  909. package/dist/src/services/testMode/index.mjs.map +1 -0
  910. package/dist/src/services/toolOverrides/index.cjs +6 -6
  911. package/dist/src/services/toolOverrides/index.cjs.map +1 -1
  912. package/dist/src/services/toolOverrides/index.d.mts +3 -3
  913. package/dist/src/services/toolOverrides/index.d.mts.map +1 -1
  914. package/dist/src/services/toolOverrides/index.mjs +6 -6
  915. package/dist/src/services/toolOverrides/index.mjs.map +1 -1
  916. package/dist/src/services/toolPrompt/index.d.mts +17 -0
  917. package/dist/src/services/toolPrompt/index.d.mts.map +1 -0
  918. package/dist/src/services/toolSurface/index.cjs +3 -3
  919. package/dist/src/services/toolSurface/index.cjs.map +1 -1
  920. package/dist/src/services/toolSurface/index.d.mts +3 -3
  921. package/dist/src/services/toolSurface/index.d.mts.map +1 -1
  922. package/dist/src/services/toolSurface/index.mjs +4 -4
  923. package/dist/src/services/toolSurface/index.mjs.map +1 -1
  924. package/dist/src/services/traceContext/index.cjs.map +1 -1
  925. package/dist/src/services/traceContext/index.mjs.map +1 -1
  926. package/dist/src/services/transcriptPages/index.cjs +159 -33
  927. package/dist/src/services/transcriptPages/index.cjs.map +1 -1
  928. package/dist/src/services/transcriptPages/index.mjs +158 -34
  929. package/dist/src/services/transcriptPages/index.mjs.map +1 -1
  930. package/dist/src/services/voiceToolsContract/index.cjs +7 -7
  931. package/dist/src/services/voiceToolsContract/index.cjs.map +1 -1
  932. package/dist/src/services/voiceToolsContract/index.d.mts +4 -4
  933. package/dist/src/services/voiceToolsContract/index.d.mts.map +1 -1
  934. package/dist/src/services/voiceToolsContract/index.mjs +7 -7
  935. package/dist/src/services/voiceToolsContract/index.mjs.map +1 -1
  936. package/dist/src/services/workspaceRegistry/index.cjs +9 -179
  937. package/dist/src/services/workspaceRegistry/index.cjs.map +1 -1
  938. package/dist/src/services/workspaceRegistry/index.d.mts +5 -47
  939. package/dist/src/services/workspaceRegistry/index.mjs +7 -176
  940. package/dist/src/services/workspaceRegistry/index.mjs.map +1 -1
  941. package/dist/src/services/workspaceRegistry/sync.cjs +148 -0
  942. package/dist/src/services/workspaceRegistry/sync.cjs.map +1 -0
  943. package/dist/src/services/workspaceRegistry/sync.d.mts +34 -0
  944. package/dist/src/services/workspaceRegistry/sync.d.mts.map +1 -0
  945. package/dist/src/services/workspaceRegistry/sync.mjs +140 -0
  946. package/dist/src/services/workspaceRegistry/sync.mjs.map +1 -0
  947. package/dist/src/services/workspaceRegistry/workspaceRecords.cjs +114 -0
  948. package/dist/src/services/workspaceRegistry/workspaceRecords.cjs.map +1 -0
  949. package/dist/src/services/workspaceRegistry/workspaceRecords.d.mts +31 -0
  950. package/dist/src/services/workspaceRegistry/workspaceRecords.d.mts.map +1 -0
  951. package/dist/src/services/workspaceRegistry/workspaceRecords.mjs +101 -0
  952. package/dist/src/services/workspaceRegistry/workspaceRecords.mjs.map +1 -0
  953. package/dist/src/systems/child/adapters/headlessChildSessionService.cjs +339 -202
  954. package/dist/src/systems/child/adapters/headlessChildSessionService.cjs.map +1 -1
  955. package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts +16 -21
  956. package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts.map +1 -1
  957. package/dist/src/systems/child/adapters/headlessChildSessionService.mjs +329 -191
  958. package/dist/src/systems/child/adapters/headlessChildSessionService.mjs.map +1 -1
  959. package/dist/src/systems/child/services/childSession/index.cjs +94 -20
  960. package/dist/src/systems/child/services/childSession/index.cjs.map +1 -1
  961. package/dist/src/systems/child/services/childSession/index.d.mts +12 -3
  962. package/dist/src/systems/child/services/childSession/index.d.mts.map +1 -1
  963. package/dist/src/systems/child/services/childSession/index.mjs +94 -20
  964. package/dist/src/systems/child/services/childSession/index.mjs.map +1 -1
  965. package/dist/src/systems/child/types/childSession.cjs +33 -13
  966. package/dist/src/systems/child/types/childSession.cjs.map +1 -1
  967. package/dist/src/systems/child/types/childSession.d.mts +143 -80
  968. package/dist/src/systems/child/types/childSession.d.mts.map +1 -1
  969. package/dist/src/systems/child/types/childSession.mjs +24 -9
  970. package/dist/src/systems/child/types/childSession.mjs.map +1 -1
  971. package/dist/src/systems/main/adapters/headlessHost.cjs +30 -27
  972. package/dist/src/systems/main/adapters/headlessHost.cjs.map +1 -1
  973. package/dist/src/systems/main/adapters/headlessHost.d.mts +22 -22
  974. package/dist/src/systems/main/adapters/headlessHost.d.mts.map +1 -1
  975. package/dist/src/systems/main/adapters/headlessHost.mjs +33 -30
  976. package/dist/src/systems/main/adapters/headlessHost.mjs.map +1 -1
  977. package/dist/src/systems/main/adapters/headlessSessionHost.cjs +248 -229
  978. package/dist/src/systems/main/adapters/headlessSessionHost.cjs.map +1 -1
  979. package/dist/src/systems/main/adapters/headlessSessionHost.d.mts +4 -5
  980. package/dist/src/systems/main/adapters/headlessSessionHost.d.mts.map +1 -1
  981. package/dist/src/systems/main/adapters/headlessSessionHost.mjs +239 -219
  982. package/dist/src/systems/main/adapters/headlessSessionHost.mjs.map +1 -1
  983. package/dist/src/systems/main/types/headlessHost.d.mts +16 -14
  984. package/dist/src/systems/main/types/headlessHost.d.mts.map +1 -1
  985. package/dist/src/testing/pi/testHost.cjs +2 -2
  986. package/dist/src/testing/pi/testHost.cjs.map +1 -1
  987. package/dist/src/testing/pi/testHost.d.mts +3 -2
  988. package/dist/src/testing/pi/testHost.mjs +3 -3
  989. package/dist/src/testing/pi/testHost.mjs.map +1 -1
  990. package/dist/src/types/config.d.mts +1 -1
  991. package/dist/src/types/config.d.mts.map +1 -1
  992. package/dist/src/types/kernel.d.mts +3 -3
  993. package/dist/src/types/server/directHarnessRuntime.d.mts +54 -25
  994. package/dist/src/types/server/directHarnessRuntime.d.mts.map +1 -1
  995. package/dist/src/types/server/sessionToolSurface.d.mts +9 -9
  996. package/dist/src/web/services/apiClient/index.d.mts +1 -0
  997. package/dist/src/web/services/apiPaths/index.cjs.map +1 -1
  998. package/dist/src/web/services/apiPaths/index.d.mts +1 -1
  999. package/dist/src/web/services/apiPaths/index.mjs.map +1 -1
  1000. package/dist/src/web/services/mcpWidget.cjs.map +1 -1
  1001. package/dist/src/web/services/mcpWidget.d.mts +2 -2
  1002. package/dist/src/web/services/mcpWidget.d.mts.map +1 -1
  1003. package/dist/src/web/services/mcpWidget.mjs.map +1 -1
  1004. package/dist/src/web/services/testing/templateRail.cjs +3 -0
  1005. package/dist/src/web/services/testing/templateRail.cjs.map +1 -1
  1006. package/dist/src/web/services/testing/templateRail.mjs +3 -0
  1007. package/dist/src/web/services/testing/templateRail.mjs.map +1 -1
  1008. package/dist/src/web/types/mcpWidget.d.mts +1 -1
  1009. package/dist/src/web/types/nativeTemplate.d.mts +1 -1
  1010. package/dist/src/web/types/nativeTemplate.d.mts.map +1 -1
  1011. package/dist/src/web/types/template.d.mts +8 -0
  1012. package/dist/src/web/types/template.d.mts.map +1 -1
  1013. package/dist/src/web/types/webPlugin.d.mts +17 -5
  1014. package/dist/src/web/types/webPlugin.d.mts.map +1 -1
  1015. package/dist/testMode.cjs +4 -0
  1016. package/dist/testMode.d.mts +2 -0
  1017. package/dist/testMode.mjs +1 -0
  1018. package/dist/testing.cjs +1 -1
  1019. package/dist/testing.d.mts +2 -2
  1020. package/dist/testing.mjs +2 -2
  1021. package/dist/toolInventory.cjs.map +1 -1
  1022. package/dist/toolInventory.mjs.map +1 -1
  1023. package/dist/toolNames.mjs +1 -2
  1024. package/dist/toolOverrides.cjs +4 -4
  1025. package/dist/toolOverrides.d.mts +3 -3
  1026. package/dist/toolOverrides.mjs +3 -3
  1027. package/dist/toolSurface.cjs +4 -4
  1028. package/dist/toolSurface.d.mts +3 -3
  1029. package/dist/toolSurface.mjs +3 -3
  1030. package/dist/transition.cjs +3 -3
  1031. package/dist/transition.d.cjs +3 -3
  1032. package/dist/transition.d.mts +2 -2
  1033. package/dist/transition.mjs +1 -2
  1034. package/dist/transitionClassifier.cjs.map +1 -1
  1035. package/dist/transitionClassifier.d.mts +2 -2
  1036. package/dist/transitionClassifier.d.mts.map +1 -1
  1037. package/dist/transitionClassifier.mjs.map +1 -1
  1038. package/dist/transitionCoordinator.cjs +3 -3
  1039. package/dist/transitionCoordinator.cjs.map +1 -1
  1040. package/dist/transitionCoordinator.d.mts +4 -4
  1041. package/dist/transitionCoordinator.d.mts.map +1 -1
  1042. package/dist/transitionCoordinator.mjs +3 -3
  1043. package/dist/transitionCoordinator.mjs.map +1 -1
  1044. package/dist/typesContextApi.d.mts +2 -1
  1045. package/dist/typesContextApi.d.mts.map +1 -1
  1046. package/dist/uiHub.cjs +3 -3
  1047. package/dist/uiHub.d.mts +2 -2
  1048. package/dist/uiHub.mjs +1 -2
  1049. package/dist/voiceTools.cjs +5 -5
  1050. package/dist/voiceTools.d.mts +3 -3
  1051. package/dist/voiceTools.mjs +3 -3
  1052. package/dist/web.cjs +8 -0
  1053. package/dist/web.d.mts +3 -2
  1054. package/dist/web.mjs +2 -1
  1055. package/dist/webCompositions.cjs.map +1 -1
  1056. package/dist/webCompositions.d.mts +7 -7
  1057. package/dist/webCompositions.d.mts.map +1 -1
  1058. package/dist/webCompositions.mjs.map +1 -1
  1059. package/licenses/Codex-Apache-2.0.txt +201 -0
  1060. package/package.json +58 -53
  1061. package/dist/doomPackage.cjs +0 -61
  1062. package/dist/doomPackage.cjs.map +0 -1
  1063. package/dist/doomPackage.d.mts +0 -17
  1064. package/dist/doomPackage.d.mts.map +0 -1
  1065. package/dist/doomPackage.mjs +0 -54
  1066. package/dist/doomPackage.mjs.map +0 -1
  1067. package/dist/jsonlSessionRepo.cjs +0 -44
  1068. package/dist/jsonlSessionRepo.cjs.map +0 -1
  1069. package/dist/jsonlSessionRepo.d.mts +0 -7
  1070. package/dist/jsonlSessionRepo.d.mts.map +0 -1
  1071. package/dist/jsonlSessionRepo.mjs +0 -42
  1072. package/dist/jsonlSessionRepo.mjs.map +0 -1
  1073. package/dist/runtimeJson.cjs.map +0 -1
  1074. package/dist/runtimeJson.d.mts.map +0 -1
  1075. package/dist/runtimeJson.mjs.map +0 -1
  1076. package/dist/runtimePiSettings.cjs.map +0 -1
  1077. package/dist/runtimePiSettings.d.mts.map +0 -1
  1078. package/dist/runtimePiSettings.mjs.map +0 -1
  1079. package/dist/serverFacet.cjs +0 -34
  1080. package/dist/serverFacet.d.mts +0 -10
  1081. package/dist/serverFacet.mjs +0 -9
  1082. package/dist/src/pi/piWebSocketListener.cjs +0 -115
  1083. package/dist/src/pi/piWebSocketListener.cjs.map +0 -1
  1084. package/dist/src/pi/piWebSocketListener.mjs +0 -115
  1085. package/dist/src/pi/piWebSocketListener.mjs.map +0 -1
  1086. package/dist/src/schemas/serverFacet.cjs +0 -111
  1087. package/dist/src/schemas/serverFacet.cjs.map +0 -1
  1088. package/dist/src/schemas/serverFacet.d.mts +0 -152
  1089. package/dist/src/schemas/serverFacet.d.mts.map +0 -1
  1090. package/dist/src/schemas/serverFacet.mjs +0 -101
  1091. package/dist/src/schemas/serverFacet.mjs.map +0 -1
  1092. package/dist/src/schemas/sessionUpdates.d.mts +0 -34
  1093. package/dist/src/schemas/sessionUpdates.d.mts.map +0 -1
  1094. package/dist/src/server/headlessProtocol.cjs +0 -382
  1095. package/dist/src/server/headlessProtocol.cjs.map +0 -1
  1096. package/dist/src/server/headlessProtocol.mjs +0 -382
  1097. package/dist/src/server/headlessProtocol.mjs.map +0 -1
  1098. package/dist/src/server/nativeChildTranscriptReader.cjs +0 -20
  1099. package/dist/src/server/nativeChildTranscriptReader.cjs.map +0 -1
  1100. package/dist/src/server/nativeChildTranscriptReader.mjs +0 -18
  1101. package/dist/src/server/nativeChildTranscriptReader.mjs.map +0 -1
  1102. package/dist/src/server/serverFacetLoader.cjs +0 -214
  1103. package/dist/src/server/serverFacetLoader.cjs.map +0 -1
  1104. package/dist/src/server/serverFacetLoader.d.mts +0 -72
  1105. package/dist/src/server/serverFacetLoader.d.mts.map +0 -1
  1106. package/dist/src/server/serverFacetLoader.mjs +0 -212
  1107. package/dist/src/server/serverFacetLoader.mjs.map +0 -1
  1108. package/dist/src/services/acpSessionUpdates/index.cjs +0 -129
  1109. package/dist/src/services/acpSessionUpdates/index.cjs.map +0 -1
  1110. package/dist/src/services/acpSessionUpdates/index.mjs +0 -129
  1111. package/dist/src/services/acpSessionUpdates/index.mjs.map +0 -1
  1112. package/dist/src/services/historyImport/index.cjs +0 -8
  1113. package/dist/src/services/historyImport/index.cjs.map +0 -1
  1114. package/dist/src/services/historyImport/index.d.mts +0 -68
  1115. package/dist/src/services/historyImport/index.d.mts.map +0 -1
  1116. package/dist/src/services/historyImport/index.mjs +0 -8
  1117. package/dist/src/services/historyImport/index.mjs.map +0 -1
  1118. package/dist/src/services/openSessionRegistry/index.d.mts.map +0 -1
  1119. package/dist/src/services/requestReceipts/index.cjs.map +0 -1
  1120. package/dist/src/services/requestReceipts/index.d.mts +0 -11
  1121. package/dist/src/services/requestReceipts/index.d.mts.map +0 -1
  1122. package/dist/src/services/requestReceipts/index.mjs.map +0 -1
  1123. package/dist/src/services/rpcTranscript/index.cjs +0 -633
  1124. package/dist/src/services/rpcTranscript/index.cjs.map +0 -1
  1125. package/dist/src/services/rpcTranscript/index.d.mts +0 -50
  1126. package/dist/src/services/rpcTranscript/index.d.mts.map +0 -1
  1127. package/dist/src/services/rpcTranscript/index.mjs +0 -632
  1128. package/dist/src/services/rpcTranscript/index.mjs.map +0 -1
  1129. package/dist/src/services/serverFacet/index.cjs.map +0 -1
  1130. package/dist/src/services/serverFacet/index.d.mts +0 -31
  1131. package/dist/src/services/serverFacet/index.d.mts.map +0 -1
  1132. package/dist/src/services/serverFacet/index.mjs.map +0 -1
  1133. package/dist/src/services/workspaceRegistry/index.d.mts.map +0 -1
  1134. package/dist/src/systems/child/adapters/nativeChildRuntimes.cjs +0 -28
  1135. package/dist/src/systems/child/adapters/nativeChildRuntimes.cjs.map +0 -1
  1136. package/dist/src/systems/child/adapters/nativeChildRuntimes.mjs +0 -25
  1137. package/dist/src/systems/child/adapters/nativeChildRuntimes.mjs.map +0 -1
  1138. package/dist/terminalPiChildSessionService.cjs +0 -324
  1139. package/dist/terminalPiChildSessionService.cjs.map +0 -1
  1140. package/dist/terminalPiChildSessionService.d.mts +0 -46
  1141. package/dist/terminalPiChildSessionService.d.mts.map +0 -1
  1142. package/dist/terminalPiChildSessionService.mjs +0 -318
  1143. package/dist/terminalPiChildSessionService.mjs.map +0 -1
  1144. package/dist/v3Export.cjs +0 -10
  1145. package/dist/v3Export.cjs.map +0 -1
  1146. package/dist/v3Export.d.mts +0 -35
  1147. package/dist/v3Export.d.mts.map +0 -1
  1148. package/dist/v3Export.mjs +0 -9
  1149. package/dist/v3Export.mjs.map +0 -1
package/dist/help.cjs CHANGED
@@ -1,24 +1,24 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_help = require("./src/schemas/help.cjs");
3
3
  const require_index = require("./src/services/piHelpTools/index.cjs");
4
- exports.DOOM_HELP_ERROR_CODE = require_help.DOOM_HELP_ERROR_CODE;
5
- exports.DOOM_HELP_MAX_CONTRIBUTORS = require_help.DOOM_HELP_MAX_CONTRIBUTORS;
6
- exports.DOOM_HELP_MAX_DESCRIPTION_LENGTH = require_help.DOOM_HELP_MAX_DESCRIPTION_LENGTH;
7
- exports.DOOM_HELP_MAX_DIAGNOSTICS = require_help.DOOM_HELP_MAX_DIAGNOSTICS;
8
- exports.DOOM_HELP_MAX_DIAGNOSTIC_LENGTH = require_help.DOOM_HELP_MAX_DIAGNOSTIC_LENGTH;
9
- exports.DOOM_HELP_MAX_SKILLS = require_help.DOOM_HELP_MAX_SKILLS;
10
- exports.DOOM_HELP_SERVICE = require_help.DOOM_HELP_SERVICE;
11
- exports.DOOM_HELP_WHEN = require_help.DOOM_HELP_WHEN;
12
- exports.DoomHelpActivationSchema = require_help.DoomHelpActivationSchema;
13
- exports.DoomHelpContributionSchema = require_help.DoomHelpContributionSchema;
14
- exports.DoomHelpDiagnosticSchema = require_help.DoomHelpDiagnosticSchema;
15
- exports.DoomHelpError = require_help.DoomHelpError;
16
- exports.DoomHelpSkillDescriptorSchema = require_help.DoomHelpSkillDescriptorSchema;
17
- exports.DoomHelpSkillNameSchema = require_help.DoomHelpSkillNameSchema;
18
- exports.DoomHelpSkillSchema = require_help.DoomHelpSkillSchema;
19
- exports.DoomHelpSnapshotSchema = require_help.DoomHelpSnapshotSchema;
20
- exports.DoomHelpSourceSchema = require_help.DoomHelpSourceSchema;
21
- exports.createDoomHelpService = require_help.createDoomHelpService;
4
+ exports.PO_HELP_ERROR_CODE = require_help.PO_HELP_ERROR_CODE;
5
+ exports.PO_HELP_MAX_CONTRIBUTORS = require_help.PO_HELP_MAX_CONTRIBUTORS;
6
+ exports.PO_HELP_MAX_DESCRIPTION_LENGTH = require_help.PO_HELP_MAX_DESCRIPTION_LENGTH;
7
+ exports.PO_HELP_MAX_DIAGNOSTICS = require_help.PO_HELP_MAX_DIAGNOSTICS;
8
+ exports.PO_HELP_MAX_DIAGNOSTIC_LENGTH = require_help.PO_HELP_MAX_DIAGNOSTIC_LENGTH;
9
+ exports.PO_HELP_MAX_SKILLS = require_help.PO_HELP_MAX_SKILLS;
10
+ exports.PO_HELP_SERVICE = require_help.PO_HELP_SERVICE;
11
+ exports.PO_HELP_WHEN = require_help.PO_HELP_WHEN;
12
+ exports.PoHelpActivationSchema = require_help.PoHelpActivationSchema;
13
+ exports.PoHelpContributionSchema = require_help.PoHelpContributionSchema;
14
+ exports.PoHelpDiagnosticSchema = require_help.PoHelpDiagnosticSchema;
15
+ exports.PoHelpError = require_help.PoHelpError;
16
+ exports.PoHelpSkillDescriptorSchema = require_help.PoHelpSkillDescriptorSchema;
17
+ exports.PoHelpSkillNameSchema = require_help.PoHelpSkillNameSchema;
18
+ exports.PoHelpSkillSchema = require_help.PoHelpSkillSchema;
19
+ exports.PoHelpSnapshotSchema = require_help.PoHelpSnapshotSchema;
20
+ exports.PoHelpSourceSchema = require_help.PoHelpSourceSchema;
22
21
  exports.createPiHelpToolGate = require_index.createPiHelpToolGate;
23
- exports.readDoomHelpService = require_help.readDoomHelpService;
24
- exports.requireDoomHelpService = require_help.requireDoomHelpService;
22
+ exports.createPoHelpService = require_help.createPoHelpService;
23
+ exports.readPoHelpService = require_help.readPoHelpService;
24
+ exports.requirePoHelpService = require_help.requirePoHelpService;
package/dist/help.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { DOOM_HELP_ERROR_CODE, DOOM_HELP_MAX_CONTRIBUTORS, DOOM_HELP_MAX_DESCRIPTION_LENGTH, DOOM_HELP_MAX_DIAGNOSTICS, DOOM_HELP_MAX_DIAGNOSTIC_LENGTH, DOOM_HELP_MAX_SKILLS, DOOM_HELP_SERVICE, DOOM_HELP_WHEN, DoomHelpActivation, DoomHelpActivationSchema, DoomHelpContribution, DoomHelpContributionHandle, DoomHelpContributionSchema, DoomHelpDiagnostic, DoomHelpDiagnosticSchema, DoomHelpError, DoomHelpErrorCode, DoomHelpService, DoomHelpSkill, DoomHelpSkillDescriptor, DoomHelpSkillDescriptorSchema, DoomHelpSkillNameSchema, DoomHelpSkillSchema, DoomHelpSnapshot, DoomHelpSnapshotDraft, DoomHelpSnapshotSchema, DoomHelpSourceSchema, createDoomHelpService, readDoomHelpService, requireDoomHelpService } from "./src/schemas/help.mjs";
1
+ import { PO_HELP_ERROR_CODE, PO_HELP_MAX_CONTRIBUTORS, PO_HELP_MAX_DESCRIPTION_LENGTH, PO_HELP_MAX_DIAGNOSTICS, PO_HELP_MAX_DIAGNOSTIC_LENGTH, PO_HELP_MAX_SKILLS, PO_HELP_SERVICE, PO_HELP_WHEN, PoHelpActivation, PoHelpActivationSchema, PoHelpContribution, PoHelpContributionHandle, PoHelpContributionSchema, PoHelpDiagnostic, PoHelpDiagnosticSchema, PoHelpError, PoHelpErrorCode, PoHelpService, PoHelpSkill, PoHelpSkillDescriptor, PoHelpSkillDescriptorSchema, PoHelpSkillNameSchema, PoHelpSkillSchema, PoHelpSnapshot, PoHelpSnapshotDraft, PoHelpSnapshotSchema, PoHelpSourceSchema, createPoHelpService, readPoHelpService, requirePoHelpService } from "./src/schemas/help.mjs";
2
2
  import { createPiHelpToolGate } from "./src/services/piHelpTools/index.mjs";
3
- export { DOOM_HELP_ERROR_CODE, DOOM_HELP_MAX_CONTRIBUTORS, DOOM_HELP_MAX_DESCRIPTION_LENGTH, DOOM_HELP_MAX_DIAGNOSTICS, DOOM_HELP_MAX_DIAGNOSTIC_LENGTH, DOOM_HELP_MAX_SKILLS, DOOM_HELP_SERVICE, DOOM_HELP_WHEN, type DoomHelpActivation, DoomHelpActivationSchema, type DoomHelpContribution, type DoomHelpContributionHandle, DoomHelpContributionSchema, type DoomHelpDiagnostic, DoomHelpDiagnosticSchema, DoomHelpError, type DoomHelpErrorCode, type DoomHelpService, type DoomHelpSkill, type DoomHelpSkillDescriptor, DoomHelpSkillDescriptorSchema, DoomHelpSkillNameSchema, DoomHelpSkillSchema, type DoomHelpSnapshot, type DoomHelpSnapshotDraft, DoomHelpSnapshotSchema, DoomHelpSourceSchema, createDoomHelpService, createPiHelpToolGate, readDoomHelpService, requireDoomHelpService };
3
+ export { PO_HELP_ERROR_CODE, PO_HELP_MAX_CONTRIBUTORS, PO_HELP_MAX_DESCRIPTION_LENGTH, PO_HELP_MAX_DIAGNOSTICS, PO_HELP_MAX_DIAGNOSTIC_LENGTH, PO_HELP_MAX_SKILLS, PO_HELP_SERVICE, PO_HELP_WHEN, type PoHelpActivation, PoHelpActivationSchema, type PoHelpContribution, type PoHelpContributionHandle, PoHelpContributionSchema, type PoHelpDiagnostic, PoHelpDiagnosticSchema, PoHelpError, type PoHelpErrorCode, type PoHelpService, type PoHelpSkill, type PoHelpSkillDescriptor, PoHelpSkillDescriptorSchema, PoHelpSkillNameSchema, PoHelpSkillSchema, type PoHelpSnapshot, type PoHelpSnapshotDraft, PoHelpSnapshotSchema, PoHelpSourceSchema, createPiHelpToolGate, createPoHelpService, readPoHelpService, requirePoHelpService };
package/dist/help.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { DOOM_HELP_ERROR_CODE, DOOM_HELP_MAX_CONTRIBUTORS, DOOM_HELP_MAX_DESCRIPTION_LENGTH, DOOM_HELP_MAX_DIAGNOSTICS, DOOM_HELP_MAX_DIAGNOSTIC_LENGTH, DOOM_HELP_MAX_SKILLS, DOOM_HELP_SERVICE, DOOM_HELP_WHEN, DoomHelpActivationSchema, DoomHelpContributionSchema, DoomHelpDiagnosticSchema, DoomHelpError, DoomHelpSkillDescriptorSchema, DoomHelpSkillNameSchema, DoomHelpSkillSchema, DoomHelpSnapshotSchema, DoomHelpSourceSchema, createDoomHelpService, readDoomHelpService, requireDoomHelpService } from "./src/schemas/help.mjs";
1
+ import { PO_HELP_ERROR_CODE, PO_HELP_MAX_CONTRIBUTORS, PO_HELP_MAX_DESCRIPTION_LENGTH, PO_HELP_MAX_DIAGNOSTICS, PO_HELP_MAX_DIAGNOSTIC_LENGTH, PO_HELP_MAX_SKILLS, PO_HELP_SERVICE, PO_HELP_WHEN, PoHelpActivationSchema, PoHelpContributionSchema, PoHelpDiagnosticSchema, PoHelpError, PoHelpSkillDescriptorSchema, PoHelpSkillNameSchema, PoHelpSkillSchema, PoHelpSnapshotSchema, PoHelpSourceSchema, createPoHelpService, readPoHelpService, requirePoHelpService } from "./src/schemas/help.mjs";
2
2
  import { createPiHelpToolGate } from "./src/services/piHelpTools/index.mjs";
3
- export { DOOM_HELP_ERROR_CODE, DOOM_HELP_MAX_CONTRIBUTORS, DOOM_HELP_MAX_DESCRIPTION_LENGTH, DOOM_HELP_MAX_DIAGNOSTICS, DOOM_HELP_MAX_DIAGNOSTIC_LENGTH, DOOM_HELP_MAX_SKILLS, DOOM_HELP_SERVICE, DOOM_HELP_WHEN, DoomHelpActivationSchema, DoomHelpContributionSchema, DoomHelpDiagnosticSchema, DoomHelpError, DoomHelpSkillDescriptorSchema, DoomHelpSkillNameSchema, DoomHelpSkillSchema, DoomHelpSnapshotSchema, DoomHelpSourceSchema, createDoomHelpService, createPiHelpToolGate, readDoomHelpService, requireDoomHelpService };
3
+ export { PO_HELP_ERROR_CODE, PO_HELP_MAX_CONTRIBUTORS, PO_HELP_MAX_DESCRIPTION_LENGTH, PO_HELP_MAX_DIAGNOSTICS, PO_HELP_MAX_DIAGNOSTIC_LENGTH, PO_HELP_MAX_SKILLS, PO_HELP_SERVICE, PO_HELP_WHEN, PoHelpActivationSchema, PoHelpContributionSchema, PoHelpDiagnosticSchema, PoHelpError, PoHelpSkillDescriptorSchema, PoHelpSkillNameSchema, PoHelpSkillSchema, PoHelpSnapshotSchema, PoHelpSourceSchema, createPiHelpToolGate, createPoHelpService, readPoHelpService, requirePoHelpService };
package/dist/history.cjs CHANGED
@@ -1,25 +1,21 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_historyOwnership = require("./historyOwnership.cjs");
3
- const require_jsonlSessionRepo = require("./jsonlSessionRepo.cjs");
4
- const require_index = require("./src/services/historyImport/index.cjs");
5
- const require_v3Export = require("./v3Export.cjs");
6
- const require_index$1 = require("./src/services/sqliteSessionHistory/index.cjs");
7
- const require_index$2 = require("./src/services/sqliteTranscriptReader/index.cjs");
8
- const require_index$3 = require("./src/services/openSessionRegistry/index.cjs");
9
- const require_index$4 = require("./src/services/workspaceRegistry/index.cjs");
10
- const require_index$5 = require("./src/services/requestReceipts/index.cjs");
3
+ const require_index = require("./src/services/sqliteSessionHistory/index.cjs");
4
+ const require_index$1 = require("./src/services/sqliteTranscriptReader/index.cjs");
5
+ const require_sync = require("./src/services/openSessionRegistry/sync.cjs");
6
+ require("./src/services/openSessionRegistry/index.cjs");
7
+ const require_sync$1 = require("./src/services/workspaceRegistry/sync.cjs");
8
+ require("./src/services/workspaceRegistry/index.cjs");
9
+ const require_index$4 = require("./src/services/durableRequestReceipts/index.cjs");
11
10
  exports.createHistoryOwnership = require_historyOwnership.createHistoryOwnership;
12
- exports.createOpenSessionRegistry = require_index$3.createOpenSessionRegistry;
13
- exports.createRequestReceipts = require_index$5.createRequestReceipts;
11
+ exports.createOpenSessionRegistry = require_sync.createOpenSessionRegistry;
12
+ exports.createRequestReceipts = require_index$4.createRequestReceipts;
14
13
  exports.createV4HistoryOwnership = require_historyOwnership.createV4HistoryOwnership;
15
- exports.createWorkspaceRegistry = require_index$4.createWorkspaceRegistry;
16
- exports.exportV4ToV3 = require_v3Export.exportV4ToV3;
14
+ exports.createWorkspaceRegistry = require_sync$1.createWorkspaceRegistry;
17
15
  exports.historyOwnershipLockPath = require_historyOwnership.historyOwnershipLockPath;
18
- exports.identifyWorkspace = require_index$4.identifyWorkspace;
19
- exports.importV3WithPinnedUpstream = require_jsonlSessionRepo.importV3WithPinnedUpstream;
20
- exports.listSavedSessionRecords = require_index$1.listSavedSessionRecords;
21
- exports.listSavedSessions = require_index$1.listSavedSessions;
22
- exports.protectAndImportHistory = require_index.protectAndImportHistory;
23
- exports.readSqliteTranscript = require_index$2.readSqliteTranscript;
24
- exports.readWorkspaceMarker = require_index$4.readWorkspaceMarker;
25
- exports.writeWorkspaceMarker = require_index$4.writeWorkspaceMarker;
16
+ exports.identifyWorkspace = require_sync$1.identifyWorkspace;
17
+ exports.listSavedSessionRecords = require_index.listSavedSessionRecords;
18
+ exports.listSavedSessions = require_index.listSavedSessions;
19
+ exports.readSqliteTranscript = require_index$1.readSqliteTranscript;
20
+ exports.readWorkspaceMarker = require_sync$1.readWorkspaceMarker;
21
+ exports.writeWorkspaceMarker = require_sync$1.writeWorkspaceMarker;
@@ -1,10 +1,12 @@
1
- import { HistoryBranchProof, HistoryEntryProof, HistoryImportOptions, HistoryImportVerification, HistoryOwnership, HistoryOwnershipLease, HistorySourceIdentity, HistoryStagingImportInput, ProtectedHistoryImportResult, protectAndImportHistory } from "./src/services/historyImport/index.mjs";
1
+ import { HistoryOwnership, HistoryOwnershipLease } from "./src/services/historyOwnership/type.mjs";
2
2
  import { HistoryOwnershipOptions, createHistoryOwnership, createV4HistoryOwnership, historyOwnershipLockPath } from "./historyOwnership.mjs";
3
- import { importV3WithPinnedUpstream } from "./jsonlSessionRepo.mjs";
4
- import { V3ExportLoss, V3ExportLossReport, V3ExportOptions, V3ExportResult, exportV4ToV3 } from "./v3Export.mjs";
5
3
  import { SavedSessionExecution, SavedSessionRecord, listSavedSessionRecords, listSavedSessions } from "./src/services/sqliteSessionHistory/index.mjs";
6
4
  import { SqliteTranscriptOwnership, readSqliteTranscript } from "./src/services/sqliteTranscriptReader/index.mjs";
7
- import { OpenSessionRecord, OpenSessionRegistry, OpenSessionRegistryOptions, createOpenSessionRegistry } from "./src/services/openSessionRegistry/index.mjs";
8
- import { WorkspaceIdentity, WorkspaceRecord, WorkspaceRegistry, WorkspaceRegistryOptions, createWorkspaceRegistry, identifyWorkspace, readWorkspaceMarker, writeWorkspaceMarker } from "./src/services/workspaceRegistry/index.mjs";
9
- import { createRequestReceipts } from "./src/services/requestReceipts/index.mjs";
10
- export { type HistoryBranchProof, type HistoryEntryProof, type HistoryImportOptions, type HistoryImportVerification, type HistoryOwnership, type HistoryOwnershipLease, type HistoryOwnershipOptions, type HistorySourceIdentity, type HistoryStagingImportInput, type OpenSessionRecord, type OpenSessionRegistry, type OpenSessionRegistryOptions, type ProtectedHistoryImportResult, type SavedSessionExecution, type SavedSessionRecord, type SqliteTranscriptOwnership, type V3ExportLoss, type V3ExportLossReport, type V3ExportOptions, type V3ExportResult, type WorkspaceIdentity, type WorkspaceRecord, type WorkspaceRegistry, type WorkspaceRegistryOptions, createHistoryOwnership, createOpenSessionRegistry, createRequestReceipts, createV4HistoryOwnership, createWorkspaceRegistry, exportV4ToV3, historyOwnershipLockPath, identifyWorkspace, importV3WithPinnedUpstream, listSavedSessionRecords, listSavedSessions, protectAndImportHistory, readSqliteTranscript, readWorkspaceMarker, writeWorkspaceMarker };
5
+ import { OpenSessionRecord, OpenSessionRegistry, OpenSessionRegistryOptions } from "./src/services/openSessionRegistry/openSessionRecords.mjs";
6
+ import { createOpenSessionRegistry } from "./src/services/openSessionRegistry/sync.mjs";
7
+ import "./src/services/openSessionRegistry/index.mjs";
8
+ import { WorkspaceIdentity, WorkspaceRecord, WorkspaceRegistry, WorkspaceRegistryOptions } from "./src/services/workspaceRegistry/workspaceRecords.mjs";
9
+ import { createWorkspaceRegistry, identifyWorkspace, readWorkspaceMarker, writeWorkspaceMarker } from "./src/services/workspaceRegistry/sync.mjs";
10
+ import "./src/services/workspaceRegistry/index.mjs";
11
+ import { createRequestReceipts } from "./src/services/durableRequestReceipts/index.mjs";
12
+ export { type HistoryOwnership, type HistoryOwnershipLease, type HistoryOwnershipOptions, type OpenSessionRecord, type OpenSessionRegistry, type OpenSessionRegistryOptions, type SavedSessionExecution, type SavedSessionRecord, type SqliteTranscriptOwnership, type WorkspaceIdentity, type WorkspaceRecord, type WorkspaceRegistry, type WorkspaceRegistryOptions, createHistoryOwnership, createOpenSessionRegistry, createRequestReceipts, createV4HistoryOwnership, createWorkspaceRegistry, historyOwnershipLockPath, identifyWorkspace, listSavedSessionRecords, listSavedSessions, readSqliteTranscript, readWorkspaceMarker, writeWorkspaceMarker };
package/dist/history.mjs CHANGED
@@ -1,10 +1,9 @@
1
1
  import { createHistoryOwnership, createV4HistoryOwnership, historyOwnershipLockPath } from "./historyOwnership.mjs";
2
- import { importV3WithPinnedUpstream } from "./jsonlSessionRepo.mjs";
3
- import { protectAndImportHistory } from "./src/services/historyImport/index.mjs";
4
- import { exportV4ToV3 } from "./v3Export.mjs";
5
2
  import { listSavedSessionRecords, listSavedSessions } from "./src/services/sqliteSessionHistory/index.mjs";
6
3
  import { readSqliteTranscript } from "./src/services/sqliteTranscriptReader/index.mjs";
7
- import { createOpenSessionRegistry } from "./src/services/openSessionRegistry/index.mjs";
8
- import { createWorkspaceRegistry, identifyWorkspace, readWorkspaceMarker, writeWorkspaceMarker } from "./src/services/workspaceRegistry/index.mjs";
9
- import { createRequestReceipts } from "./src/services/requestReceipts/index.mjs";
10
- export { createHistoryOwnership, createOpenSessionRegistry, createRequestReceipts, createV4HistoryOwnership, createWorkspaceRegistry, exportV4ToV3, historyOwnershipLockPath, identifyWorkspace, importV3WithPinnedUpstream, listSavedSessionRecords, listSavedSessions, protectAndImportHistory, readSqliteTranscript, readWorkspaceMarker, writeWorkspaceMarker };
4
+ import { createOpenSessionRegistry } from "./src/services/openSessionRegistry/sync.mjs";
5
+ import "./src/services/openSessionRegistry/index.mjs";
6
+ import { createWorkspaceRegistry, identifyWorkspace, readWorkspaceMarker, writeWorkspaceMarker } from "./src/services/workspaceRegistry/sync.mjs";
7
+ import "./src/services/workspaceRegistry/index.mjs";
8
+ import { createRequestReceipts } from "./src/services/durableRequestReceipts/index.mjs";
9
+ export { createHistoryOwnership, createOpenSessionRegistry, createRequestReceipts, createV4HistoryOwnership, createWorkspaceRegistry, historyOwnershipLockPath, identifyWorkspace, listSavedSessionRecords, listSavedSessions, readSqliteTranscript, readWorkspaceMarker, writeWorkspaceMarker };
@@ -1 +1 @@
1
- {"version":3,"file":"historyOwnership.cjs","names":["path","fs","randomUUID"],"sources":["../src/services/historyOwnership/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { HistoryOwnership, HistoryOwnershipLease } from '../historyImport';\n\nconst LOCK_SUFFIX = '.po-v4.lock';\nconst LOCK_VERSION = 1;\nconst LOCK_FORMAT = 'po-v4-history-ownership';\n\ninterface HistoryLockRecord {\n version: 1;\n format: 'po-v4-history-ownership';\n pid: number;\n sourcePath: string;\n token: string;\n}\n\ninterface HeldHistoryLock {\n lockPath: string;\n token: string;\n handle: number;\n}\n\nexport interface HistoryOwnershipOptions {\n /** Checks managed writers; this cannot account for an unmanaged Pi process. */\n assertQuiescent?: (sourcePath: string) => void | Promise<void>;\n /** The source format admitted by this owner. Defaults to canonical v4. */\n sourceFormat?: 'v3' | 'v4' | 'sqlite';\n /** Additional paths to lock for the lifetime of each acquired source lease. */\n additionalPaths?: readonly string[];\n}\n\nfunction canonicalSourcePath(sourcePath: string): string {\n const absolute = path.resolve(sourcePath);\n if (fs.existsSync(absolute)) return fs.realpathSync(absolute);\n const segments = [path.basename(absolute)];\n let parent = path.dirname(absolute);\n while (!fs.existsSync(parent)) {\n segments.unshift(path.basename(parent));\n parent = path.dirname(parent);\n }\n return path.join(fs.realpathSync(parent), ...segments);\n}\n\n/** Resolve aliases so every writer and exporter contends for the same lock. */\nexport function historyOwnershipLockPath(sourcePath: string): string {\n return `${canonicalSourcePath(sourcePath)}${LOCK_SUFFIX}`;\n}\n\nfunction isHistoryObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isV4Header(value: unknown): boolean {\n return isHistoryObject(value) && value.kind === 'header' && value.v === 4;\n}\n\nfunction isV3Header(value: unknown): boolean {\n return isHistoryObject(value) && value.type === 'session' && value.version === 3;\n}\n\nfunction readHeader(sourcePath: string, format: 'v3' | 'v4'): unknown {\n const firstLine = fs.readFileSync(sourcePath, 'utf8').split('\\n', 1)[0] ?? '';\n try {\n return JSON.parse(firstLine);\n } catch (error) {\n const message =\n format === 'v4'\n ? `History ownership source is not canonical v4 JSONL: ${sourcePath}`\n : `Offline history source is not canonical v3 JSONL: ${sourcePath}`;\n throw new Error(message, { cause: error });\n }\n}\n\nfunction assertIndependentRegularFile(sourcePath: string, label: string): void {\n const stat = fs.statSync(sourcePath);\n if (!stat.isFile() || stat.nlink !== 1) throw new Error(`${label} must be an independent regular file`);\n}\n\nfunction assertV4Source(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'Canonical history');\n if (!isV4Header(readHeader(sourcePath, 'v4')))\n throw new Error(`History ownership only supports canonical v4 sources: ${sourcePath}`);\n}\n\nfunction assertV3Source(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'Offline v3 history source');\n if (!isV3Header(readHeader(sourcePath, 'v3')))\n throw new Error(`Offline history import only supports v3 sources: ${sourcePath}`);\n}\n\nfunction assertSqliteSource(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'SQLite history');\n const descriptor = fs.openSync(sourcePath, 'r');\n try {\n const header = Buffer.alloc(16);\n if (\n fs.readSync(descriptor, header, 0, header.length, 0) !== header.length ||\n header.toString('utf8') !== 'SQLite format 3\\u0000'\n )\n throw new Error(`History ownership source is not SQLite: ${sourcePath}`);\n } finally {\n fs.closeSync(descriptor);\n }\n}\n\nfunction isFileSystemError(error: unknown): error is NodeJS.ErrnoException {\n return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';\n}\n\nfunction readToken(lockPath: string): string | undefined {\n try {\n const value = JSON.parse(fs.readFileSync(lockPath, 'utf8')) as Partial<HistoryLockRecord>;\n return typeof value.token === 'string' ? value.token : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** A dead owner is recoverable only when the entire lock record is recognizable. */\nfunction readRecoverableLock(lockPath: string, sourcePath: string): HistoryLockRecord | undefined {\n try {\n const stat = fs.lstatSync(lockPath);\n if (!stat.isFile() || stat.nlink !== 1) return undefined;\n const value: unknown = JSON.parse(fs.readFileSync(lockPath, 'utf8'));\n if (\n !isHistoryObject(value) ||\n value.version !== LOCK_VERSION ||\n value.format !== LOCK_FORMAT ||\n value.sourcePath !== sourcePath ||\n !Number.isSafeInteger(value.pid) ||\n (value.pid as number) <= 0 ||\n typeof value.token !== 'string' ||\n !/^[\\da-f]{8}(?:-[\\da-f]{4}){3}-[\\da-f]{12}$/iu.test(value.token)\n )\n return undefined;\n return value as unknown as HistoryLockRecord;\n } catch {\n return undefined;\n }\n}\n\nfunction ownerMayBeAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return !(isFileSystemError(error) && error.code === 'ESRCH');\n }\n}\n/** A guard left by a dead acquirer can be retired without touching its source lock. */\nfunction retireDeadGuard(guard: string): boolean {\n try {\n const stat = fs.lstatSync(guard);\n if (!stat.isDirectory()) return false;\n const entries = fs.readdirSync(guard);\n // An empty guard might still belong to a process killed between mkdir and\n // publishing its marker. Fail closed rather than race a new acquirer.\n if (entries.length !== 1 || !/^owner-[\\da-f-]{36}\\.json$/iu.test(entries[0]!)) return false;\n const marker = path.join(guard, entries[0]!);\n const markerStat = fs.lstatSync(marker);\n if (!markerStat.isFile() || markerStat.nlink !== 1) return false;\n const owner: unknown = JSON.parse(fs.readFileSync(marker, 'utf8'));\n if (!isHistoryObject(owner) || !Number.isSafeInteger(owner.pid) || (owner.pid as number) <= 0) return false;\n if (ownerMayBeAlive(owner.pid as number)) return false;\n // Only the process that unlinks this unique marker may retire the directory.\n // Other cleaners see a newly empty guard and refuse to remove it.\n fs.unlinkSync(marker);\n fs.rmdirSync(guard);\n return true;\n } catch {\n return false;\n }\n}\n\n/** All new acquirers hold this guard until their ownership record is durable. */\nfunction withAcquisitionGuard<T>(lockPath: string, acquire: () => T): T {\n const guard = `${lockPath}.recovery`;\n try {\n fs.mkdirSync(guard, { mode: 0o700 });\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== 'EEXIST' || !retireDeadGuard(guard)) throw error;\n fs.mkdirSync(guard, { mode: 0o700 });\n }\n const marker = path.join(guard, `owner-${randomUUID()}.json`);\n try {\n fs.writeFileSync(marker, JSON.stringify({ pid: process.pid }), { flag: 'wx', mode: 0o600 });\n return acquire();\n } finally {\n fs.rmSync(marker, { force: true });\n fs.rmdirSync(guard);\n }\n}\n\n/** Called only under the acquisition guard, before publishing a new owner. */\nfunction recoverDeadOwner(lockPath: string, sourcePath: string): boolean {\n try {\n const record = readRecoverableLock(lockPath, sourcePath);\n if (!record || ownerMayBeAlive(record.pid)) return false;\n const before = fs.lstatSync(lockPath);\n if (readRecoverableLock(lockPath, sourcePath)?.token !== record.token || ownerMayBeAlive(record.pid)) return false;\n const current = fs.lstatSync(lockPath);\n if (before.dev !== current.dev || before.ino !== current.ino) return false;\n // The owner is gone, and other recoverers cannot remove this lock while\n // the guard is held. Legacy writers still contend on the exclusive wx open.\n fs.unlinkSync(lockPath);\n return true;\n } catch (error) {\n if (isFileSystemError(error) && error.code === 'ENOENT') return false;\n throw error;\n }\n}\n\nfunction releaseLock(lockPath: string, token: string, handle: number): void {\n fs.closeSync(handle);\n // Recovery only retires a lock after its recorded owner has exited, so that\n // owner cannot be here releasing it concurrently. A replaced lock is ambiguous.\n if (readToken(lockPath) === token) fs.rmSync(lockPath, { force: true });\n}\n\nfunction createLease(\n locks: readonly HeldHistoryLock[],\n sourcePath: string,\n assertQuiescent: (sourcePath: string) => void | Promise<void>,\n): HistoryOwnershipLease {\n let released = false;\n return {\n assertQuiescent: () => {\n if (released) throw new Error('History ownership lease has been released');\n for (const lock of locks) {\n const held = fs.fstatSync(lock.handle);\n const current = fs.statSync(lock.lockPath);\n if (held.dev !== current.dev || held.ino !== current.ino || readToken(lock.lockPath) !== lock.token) {\n throw new Error('History ownership lock was replaced');\n }\n }\n return assertQuiescent(sourcePath);\n },\n release: () => {\n if (released) return;\n released = true;\n let firstError: unknown;\n for (const lock of [...locks].reverse()) {\n try {\n releaseLock(lock.lockPath, lock.token, lock.handle);\n } catch (error) {\n firstError ??= error;\n }\n }\n if (firstError !== undefined) throw firstError;\n },\n };\n}\n\n/**\n * Creates the canonical history owner used by runtime writers, export CLI, and\n * the explicit offline importer. The default source boundary remains v4.\n * Complete locks left by a dead process are recovered under an exclusive guard.\n * A live owner or an ambiguous sidecar still blocks acquisition.\n */\nexport function createHistoryOwnership(options: HistoryOwnershipOptions = {}): HistoryOwnership {\n const assertQuiescent = options.assertQuiescent ?? (() => undefined);\n const assertSource =\n options.sourceFormat === 'sqlite'\n ? assertSqliteSource\n : options.sourceFormat === 'v3'\n ? assertV3Source\n : assertV4Source;\n return {\n async acquire(sourcePath: string): Promise<HistoryOwnershipLease> {\n const absoluteSourcePath = canonicalSourcePath(sourcePath);\n const paths = [absoluteSourcePath, ...(options.additionalPaths ?? [])].map(canonicalSourcePath);\n const canonicalPaths = [...new Set(paths)].sort((left, right) => left.localeCompare(right));\n const locks: HeldHistoryLock[] = [];\n let conflictingLockPath = historyOwnershipLockPath(absoluteSourcePath);\n try {\n for (const lockedPath of canonicalPaths) {\n const lockPath = historyOwnershipLockPath(lockedPath);\n conflictingLockPath = lockPath;\n const token = randomUUID();\n const record: HistoryLockRecord = {\n version: LOCK_VERSION,\n format: LOCK_FORMAT,\n pid: process.pid,\n sourcePath: lockedPath,\n token,\n };\n fs.mkdirSync(path.dirname(lockPath), { recursive: true, mode: 0o700 });\n withAcquisitionGuard(lockPath, () => {\n let handle: number;\n try {\n handle = fs.openSync(lockPath, 'wx', 0o600);\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== 'EEXIST' || !recoverDeadOwner(lockPath, lockedPath))\n throw error;\n handle = fs.openSync(lockPath, 'wx', 0o600);\n }\n const lock = { lockPath, token, handle };\n locks.push(lock);\n fs.writeFileSync(handle, `${JSON.stringify(record)}\\n`, 'utf8');\n fs.fsyncSync(handle);\n });\n }\n assertSource(absoluteSourcePath);\n } catch (error) {\n for (const lock of [...locks].reverse()) {\n try {\n releaseLock(lock.lockPath, lock.token, lock.handle);\n } catch {\n // Preserve the acquisition failure and never remove a replaced lock.\n }\n }\n if (isFileSystemError(error) && error.code === 'EEXIST') {\n throw new Error(`History ownership lock already exists or is ambiguous: ${conflictingLockPath}`, {\n cause: error,\n });\n }\n throw error;\n }\n return createLease(locks, absoluteSourcePath, assertQuiescent);\n },\n };\n}\n\n/** Explicitly named alias for hosts that want to document the v4 boundary. */\nexport const createV4HistoryOwnership = createHistoryOwnership;\n"],"mappings":";;;;;;;;AAMA,MAAM,cAAc;AACpB,MAAM,eAAe;AACrB,MAAM,cAAc;AAyBpB,SAAS,oBAAoB,YAA4B;CACvD,MAAM,WAAWA,UAAAA,QAAK,QAAQ,UAAU;CACxC,IAAIC,QAAAA,QAAG,WAAW,QAAQ,GAAG,OAAOA,QAAAA,QAAG,aAAa,QAAQ;CAC5D,MAAM,WAAW,CAACD,UAAAA,QAAK,SAAS,QAAQ,CAAC;CACzC,IAAI,SAASA,UAAAA,QAAK,QAAQ,QAAQ;CAClC,OAAO,CAACC,QAAAA,QAAG,WAAW,MAAM,GAAG;EAC7B,SAAS,QAAQD,UAAAA,QAAK,SAAS,MAAM,CAAC;EACtC,SAASA,UAAAA,QAAK,QAAQ,MAAM;CAC9B;CACA,OAAOA,UAAAA,QAAK,KAAKC,QAAAA,QAAG,aAAa,MAAM,GAAG,GAAG,QAAQ;AACvD;;AAGA,SAAgB,yBAAyB,YAA4B;CACnE,OAAO,GAAG,oBAAoB,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AAAA,QAAG,SAAS,UAAU,MAAM,GAAK;KAC5C,SAAS,OAAO;MACd,IAAI,CAAC,kBAAkB,KAAK,KAAK,MAAM,SAAS,YAAY,CAAC,iBAAiB,UAAU,UAAU,GAChG,MAAM;MACR,SAASA,QAAAA,QAAG,SAAS,UAAU,MAAM,GAAK;KAC5C;KACA,MAAM,OAAO;MAAE;MAAU;MAAO;KAAO;KACvC,MAAM,KAAK,IAAI;KACf,QAAA,QAAG,cAAc,QAAQ,GAAG,KAAK,UAAU,MAAM,EAAE,KAAK,MAAM;KAC9D,QAAA,QAAG,UAAU,MAAM;IACrB,CAAC;GACH;GACA,aAAa,kBAAkB;EACjC,SAAS,OAAO;GACd,KAAK,MAAM,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,GACpC,IAAI;IACF,YAAY,KAAK,UAAU,KAAK,OAAO,KAAK,MAAM;GACpD,QAAQ,CAER;GAEF,IAAI,kBAAkB,KAAK,KAAK,MAAM,SAAS,UAC7C,MAAM,IAAI,MAAM,0DAA0D,uBAAuB,EAC/F,OAAO,MACT,CAAC;GAEH,MAAM;EACR;EACA,OAAO,YAAY,OAAO,oBAAoB,eAAe;CAC/D,EACF;AACF;;AAGA,MAAa,2BAA2B"}
1
+ {"version":3,"file":"historyOwnership.cjs","names":["path","fs","randomUUID"],"sources":["../src/services/historyOwnership/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { HistoryOwnership, HistoryOwnershipLease } from './type';\n\nconst LOCK_SUFFIX = '.po-v4.lock';\nconst LOCK_VERSION = 1;\nconst LOCK_FORMAT = 'po-v4-history-ownership';\n\ninterface HistoryLockRecord {\n version: 1;\n format: 'po-v4-history-ownership';\n pid: number;\n sourcePath: string;\n token: string;\n}\n\ninterface HeldHistoryLock {\n lockPath: string;\n token: string;\n handle: number;\n}\n\nexport interface HistoryOwnershipOptions {\n /** Checks managed writers; this cannot account for an unmanaged Pi process. */\n assertQuiescent?: (sourcePath: string) => void | Promise<void>;\n /** The source format admitted by this owner. Defaults to canonical v4. */\n sourceFormat?: 'v3' | 'v4' | 'sqlite';\n /** Additional paths to lock for the lifetime of each acquired source lease. */\n additionalPaths?: readonly string[];\n}\n\nfunction canonicalSourcePath(sourcePath: string): string {\n const absolute = path.resolve(sourcePath);\n if (fs.existsSync(absolute)) return fs.realpathSync(absolute);\n const segments = [path.basename(absolute)];\n let parent = path.dirname(absolute);\n while (!fs.existsSync(parent)) {\n segments.unshift(path.basename(parent));\n parent = path.dirname(parent);\n }\n return path.join(fs.realpathSync(parent), ...segments);\n}\n\n/** Resolve aliases so every writer and exporter contends for the same lock. */\nexport function historyOwnershipLockPath(sourcePath: string): string {\n return `${canonicalSourcePath(sourcePath)}${LOCK_SUFFIX}`;\n}\n\nfunction isHistoryObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isV4Header(value: unknown): boolean {\n return isHistoryObject(value) && value.kind === 'header' && value.v === 4;\n}\n\nfunction isV3Header(value: unknown): boolean {\n return isHistoryObject(value) && value.type === 'session' && value.version === 3;\n}\n\nfunction readHeader(sourcePath: string, format: 'v3' | 'v4'): unknown {\n const firstLine = fs.readFileSync(sourcePath, 'utf8').split('\\n', 1)[0] ?? '';\n try {\n return JSON.parse(firstLine);\n } catch (error) {\n const message =\n format === 'v4'\n ? `History ownership source is not canonical v4 JSONL: ${sourcePath}`\n : `Offline history source is not canonical v3 JSONL: ${sourcePath}`;\n throw new Error(message, { cause: error });\n }\n}\n\nfunction assertIndependentRegularFile(sourcePath: string, label: string): void {\n const stat = fs.statSync(sourcePath);\n if (!stat.isFile() || stat.nlink !== 1) throw new Error(`${label} must be an independent regular file`);\n}\n\nfunction assertV4Source(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'Canonical history');\n if (!isV4Header(readHeader(sourcePath, 'v4')))\n throw new Error(`History ownership only supports canonical v4 sources: ${sourcePath}`);\n}\n\nfunction assertV3Source(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'Offline v3 history source');\n if (!isV3Header(readHeader(sourcePath, 'v3')))\n throw new Error(`Offline history import only supports v3 sources: ${sourcePath}`);\n}\n\nfunction assertSqliteSource(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'SQLite history');\n const descriptor = fs.openSync(sourcePath, 'r');\n try {\n const header = Buffer.alloc(16);\n if (\n fs.readSync(descriptor, header, 0, header.length, 0) !== header.length ||\n header.toString('utf8') !== 'SQLite format 3\\u0000'\n )\n throw new Error(`History ownership source is not SQLite: ${sourcePath}`);\n } finally {\n fs.closeSync(descriptor);\n }\n}\n\nfunction isFileSystemError(error: unknown): error is NodeJS.ErrnoException {\n return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';\n}\n\nfunction readToken(lockPath: string): string | undefined {\n try {\n const value = JSON.parse(fs.readFileSync(lockPath, 'utf8')) as Partial<HistoryLockRecord>;\n return typeof value.token === 'string' ? value.token : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** A dead owner is recoverable only when the entire lock record is recognizable. */\nfunction readRecoverableLock(lockPath: string, sourcePath: string): HistoryLockRecord | undefined {\n try {\n const stat = fs.lstatSync(lockPath);\n if (!stat.isFile() || stat.nlink !== 1) return undefined;\n const value: unknown = JSON.parse(fs.readFileSync(lockPath, 'utf8'));\n if (\n !isHistoryObject(value) ||\n value.version !== LOCK_VERSION ||\n value.format !== LOCK_FORMAT ||\n value.sourcePath !== sourcePath ||\n !Number.isSafeInteger(value.pid) ||\n (value.pid as number) <= 0 ||\n typeof value.token !== 'string' ||\n !/^[\\da-f]{8}(?:-[\\da-f]{4}){3}-[\\da-f]{12}$/iu.test(value.token)\n )\n return undefined;\n return value as unknown as HistoryLockRecord;\n } catch {\n return undefined;\n }\n}\n\nfunction ownerMayBeAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return !(isFileSystemError(error) && error.code === 'ESRCH');\n }\n}\n/** A guard left by a dead acquirer can be retired without touching its source lock. */\nfunction retireDeadGuard(guard: string): boolean {\n try {\n const stat = fs.lstatSync(guard);\n if (!stat.isDirectory()) return false;\n const entries = fs.readdirSync(guard);\n // An empty guard might still belong to a process killed between mkdir and\n // publishing its marker. Fail closed rather than race a new acquirer.\n if (entries.length !== 1 || !/^owner-[\\da-f-]{36}\\.json$/iu.test(entries[0]!)) return false;\n const marker = path.join(guard, entries[0]!);\n const markerStat = fs.lstatSync(marker);\n if (!markerStat.isFile() || markerStat.nlink !== 1) return false;\n const owner: unknown = JSON.parse(fs.readFileSync(marker, 'utf8'));\n if (!isHistoryObject(owner) || !Number.isSafeInteger(owner.pid) || (owner.pid as number) <= 0) return false;\n if (ownerMayBeAlive(owner.pid as number)) return false;\n // Only the process that unlinks this unique marker may retire the directory.\n // Other cleaners see a newly empty guard and refuse to remove it.\n fs.unlinkSync(marker);\n fs.rmdirSync(guard);\n return true;\n } catch {\n return false;\n }\n}\n\n/** All new acquirers hold this guard until their ownership record is durable. */\nfunction withAcquisitionGuard<T>(lockPath: string, acquire: () => T): T {\n const guard = `${lockPath}.recovery`;\n try {\n fs.mkdirSync(guard, { mode: 0o700 });\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== 'EEXIST' || !retireDeadGuard(guard)) throw error;\n fs.mkdirSync(guard, { mode: 0o700 });\n }\n const marker = path.join(guard, `owner-${randomUUID()}.json`);\n try {\n fs.writeFileSync(marker, JSON.stringify({ pid: process.pid }), { flag: 'wx', mode: 0o600 });\n return acquire();\n } finally {\n fs.rmSync(marker, { force: true });\n fs.rmdirSync(guard);\n }\n}\n\n/** Called only under the acquisition guard, before publishing a new owner. */\nfunction recoverDeadOwner(lockPath: string, sourcePath: string): boolean {\n try {\n const record = readRecoverableLock(lockPath, sourcePath);\n if (!record || ownerMayBeAlive(record.pid)) return false;\n const before = fs.lstatSync(lockPath);\n if (readRecoverableLock(lockPath, sourcePath)?.token !== record.token || ownerMayBeAlive(record.pid)) return false;\n const current = fs.lstatSync(lockPath);\n if (before.dev !== current.dev || before.ino !== current.ino) return false;\n // The owner is gone, and other recoverers cannot remove this lock while\n // the guard is held. Legacy writers still contend on the exclusive wx open.\n fs.unlinkSync(lockPath);\n return true;\n } catch (error) {\n if (isFileSystemError(error) && error.code === 'ENOENT') return false;\n throw error;\n }\n}\n\nfunction releaseLock(lockPath: string, token: string, handle: number): void {\n fs.closeSync(handle);\n // Recovery only retires a lock after its recorded owner has exited, so that\n // owner cannot be here releasing it concurrently. A replaced lock is ambiguous.\n if (readToken(lockPath) === token) fs.rmSync(lockPath, { force: true });\n}\n\nfunction createLease(\n locks: readonly HeldHistoryLock[],\n sourcePath: string,\n assertQuiescent: (sourcePath: string) => void | Promise<void>,\n): HistoryOwnershipLease {\n let released = false;\n return {\n assertQuiescent: () => {\n if (released) throw new Error('History ownership lease has been released');\n for (const lock of locks) {\n const held = fs.fstatSync(lock.handle);\n const current = fs.statSync(lock.lockPath);\n if (held.dev !== current.dev || held.ino !== current.ino || readToken(lock.lockPath) !== lock.token) {\n throw new Error('History ownership lock was replaced');\n }\n }\n return assertQuiescent(sourcePath);\n },\n release: () => {\n if (released) return;\n released = true;\n let firstError: unknown;\n for (const lock of [...locks].reverse()) {\n try {\n releaseLock(lock.lockPath, lock.token, lock.handle);\n } catch (error) {\n firstError ??= error;\n }\n }\n if (firstError !== undefined) throw firstError;\n },\n };\n}\n\n/**\n * Creates the canonical history owner used by runtime writers, export CLI, and\n * the explicit offline importer. The default source boundary remains v4.\n * Complete locks left by a dead process are recovered under an exclusive guard.\n * A live owner or an ambiguous sidecar still blocks acquisition.\n */\nexport function createHistoryOwnership(options: HistoryOwnershipOptions = {}): HistoryOwnership {\n const assertQuiescent = options.assertQuiescent ?? (() => undefined);\n const assertSource =\n options.sourceFormat === 'sqlite'\n ? assertSqliteSource\n : options.sourceFormat === 'v3'\n ? assertV3Source\n : assertV4Source;\n return {\n async acquire(sourcePath: string): Promise<HistoryOwnershipLease> {\n const absoluteSourcePath = canonicalSourcePath(sourcePath);\n const paths = [absoluteSourcePath, ...(options.additionalPaths ?? [])].map(canonicalSourcePath);\n const canonicalPaths = [...new Set(paths)].sort((left, right) => left.localeCompare(right));\n const locks: HeldHistoryLock[] = [];\n let conflictingLockPath = historyOwnershipLockPath(absoluteSourcePath);\n try {\n for (const lockedPath of canonicalPaths) {\n const lockPath = historyOwnershipLockPath(lockedPath);\n conflictingLockPath = lockPath;\n const token = randomUUID();\n const record: HistoryLockRecord = {\n version: LOCK_VERSION,\n format: LOCK_FORMAT,\n pid: process.pid,\n sourcePath: lockedPath,\n token,\n };\n fs.mkdirSync(path.dirname(lockPath), { recursive: true, mode: 0o700 });\n withAcquisitionGuard(lockPath, () => {\n let handle: number;\n try {\n handle = fs.openSync(lockPath, 'wx', 0o600);\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== 'EEXIST' || !recoverDeadOwner(lockPath, lockedPath))\n throw error;\n handle = fs.openSync(lockPath, 'wx', 0o600);\n }\n const lock = { lockPath, token, handle };\n locks.push(lock);\n fs.writeFileSync(handle, `${JSON.stringify(record)}\\n`, 'utf8');\n fs.fsyncSync(handle);\n });\n }\n assertSource(absoluteSourcePath);\n } catch (error) {\n for (const lock of [...locks].reverse()) {\n try {\n releaseLock(lock.lockPath, lock.token, lock.handle);\n } catch {\n // Preserve the acquisition failure and never remove a replaced lock.\n }\n }\n if (isFileSystemError(error) && error.code === 'EEXIST') {\n throw new Error(`History ownership lock already exists or is ambiguous: ${conflictingLockPath}`, {\n cause: error,\n });\n }\n throw error;\n }\n return createLease(locks, absoluteSourcePath, assertQuiescent);\n },\n };\n}\n\n/** Explicitly named alias for hosts that want to document the v4 boundary. */\nexport const createV4HistoryOwnership = createHistoryOwnership;\n"],"mappings":";;;;;;;;AAMA,MAAM,cAAc;AACpB,MAAM,eAAe;AACrB,MAAM,cAAc;A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EACR;EACA,OAAO,YAAY,OAAO,oBAAoB,eAAe;CAC/D,EACF;AACF;;AAGA,MAAa,2BAA2B"}
@@ -1,4 +1,4 @@
1
- import { HistoryOwnership } from "./src/services/historyImport/index.mjs";
1
+ import { HistoryOwnership } from "./src/services/historyOwnership/type.mjs";
2
2
  //#region src/services/historyOwnership/index.d.ts
3
3
  export interface HistoryOwnershipOptions {
4
4
  /** Checks managed writers; this cannot account for an unmanaged Pi process. */
@@ -1 +1 @@
1
- {"version":3,"file":"historyOwnership.mjs","names":[],"sources":["../src/services/historyOwnership/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { HistoryOwnership, HistoryOwnershipLease } from '../historyImport';\n\nconst LOCK_SUFFIX = '.po-v4.lock';\nconst LOCK_VERSION = 1;\nconst LOCK_FORMAT = 'po-v4-history-ownership';\n\ninterface HistoryLockRecord {\n version: 1;\n format: 'po-v4-history-ownership';\n pid: number;\n sourcePath: string;\n token: string;\n}\n\ninterface HeldHistoryLock {\n lockPath: string;\n token: string;\n handle: number;\n}\n\nexport interface HistoryOwnershipOptions {\n /** Checks managed writers; this cannot account for an unmanaged Pi process. */\n assertQuiescent?: (sourcePath: string) => void | Promise<void>;\n /** The source format admitted by this owner. Defaults to canonical v4. */\n sourceFormat?: 'v3' | 'v4' | 'sqlite';\n /** Additional paths to lock for the lifetime of each acquired source lease. */\n additionalPaths?: readonly string[];\n}\n\nfunction canonicalSourcePath(sourcePath: string): string {\n const absolute = path.resolve(sourcePath);\n if (fs.existsSync(absolute)) return fs.realpathSync(absolute);\n const segments = [path.basename(absolute)];\n let parent = path.dirname(absolute);\n while (!fs.existsSync(parent)) {\n segments.unshift(path.basename(parent));\n parent = path.dirname(parent);\n }\n return path.join(fs.realpathSync(parent), ...segments);\n}\n\n/** Resolve aliases so every writer and exporter contends for the same lock. */\nexport function historyOwnershipLockPath(sourcePath: string): string {\n return `${canonicalSourcePath(sourcePath)}${LOCK_SUFFIX}`;\n}\n\nfunction isHistoryObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isV4Header(value: unknown): boolean {\n return isHistoryObject(value) && value.kind === 'header' && value.v === 4;\n}\n\nfunction isV3Header(value: unknown): boolean {\n return isHistoryObject(value) && value.type === 'session' && value.version === 3;\n}\n\nfunction readHeader(sourcePath: string, format: 'v3' | 'v4'): unknown {\n const firstLine = fs.readFileSync(sourcePath, 'utf8').split('\\n', 1)[0] ?? '';\n try {\n return JSON.parse(firstLine);\n } catch (error) {\n const message =\n format === 'v4'\n ? `History ownership source is not canonical v4 JSONL: ${sourcePath}`\n : `Offline history source is not canonical v3 JSONL: ${sourcePath}`;\n throw new Error(message, { cause: error });\n }\n}\n\nfunction assertIndependentRegularFile(sourcePath: string, label: string): void {\n const stat = fs.statSync(sourcePath);\n if (!stat.isFile() || stat.nlink !== 1) throw new Error(`${label} must be an independent regular file`);\n}\n\nfunction assertV4Source(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'Canonical history');\n if (!isV4Header(readHeader(sourcePath, 'v4')))\n throw new Error(`History ownership only supports canonical v4 sources: ${sourcePath}`);\n}\n\nfunction assertV3Source(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'Offline v3 history source');\n if (!isV3Header(readHeader(sourcePath, 'v3')))\n throw new Error(`Offline history import only supports v3 sources: ${sourcePath}`);\n}\n\nfunction assertSqliteSource(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'SQLite history');\n const descriptor = fs.openSync(sourcePath, 'r');\n try {\n const header = Buffer.alloc(16);\n if (\n fs.readSync(descriptor, header, 0, header.length, 0) !== header.length ||\n header.toString('utf8') !== 'SQLite format 3\\u0000'\n )\n throw new Error(`History ownership source is not SQLite: ${sourcePath}`);\n } finally {\n fs.closeSync(descriptor);\n }\n}\n\nfunction isFileSystemError(error: unknown): error is NodeJS.ErrnoException {\n return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';\n}\n\nfunction readToken(lockPath: string): string | undefined {\n try {\n const value = JSON.parse(fs.readFileSync(lockPath, 'utf8')) as Partial<HistoryLockRecord>;\n return typeof value.token === 'string' ? value.token : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** A dead owner is recoverable only when the entire lock record is recognizable. */\nfunction readRecoverableLock(lockPath: string, sourcePath: string): HistoryLockRecord | undefined {\n try {\n const stat = fs.lstatSync(lockPath);\n if (!stat.isFile() || stat.nlink !== 1) return undefined;\n const value: unknown = JSON.parse(fs.readFileSync(lockPath, 'utf8'));\n if (\n !isHistoryObject(value) ||\n value.version !== LOCK_VERSION ||\n value.format !== LOCK_FORMAT ||\n value.sourcePath !== sourcePath ||\n !Number.isSafeInteger(value.pid) ||\n (value.pid as number) <= 0 ||\n typeof value.token !== 'string' ||\n !/^[\\da-f]{8}(?:-[\\da-f]{4}){3}-[\\da-f]{12}$/iu.test(value.token)\n )\n return undefined;\n return value as unknown as HistoryLockRecord;\n } catch {\n return undefined;\n }\n}\n\nfunction ownerMayBeAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return !(isFileSystemError(error) && error.code === 'ESRCH');\n }\n}\n/** A guard left by a dead acquirer can be retired without touching its source lock. */\nfunction retireDeadGuard(guard: string): boolean {\n try {\n const stat = fs.lstatSync(guard);\n if (!stat.isDirectory()) return false;\n const entries = fs.readdirSync(guard);\n // An empty guard might still belong to a process killed between mkdir and\n // publishing its marker. Fail closed rather than race a new acquirer.\n if (entries.length !== 1 || !/^owner-[\\da-f-]{36}\\.json$/iu.test(entries[0]!)) return false;\n const marker = path.join(guard, entries[0]!);\n const markerStat = fs.lstatSync(marker);\n if (!markerStat.isFile() || markerStat.nlink !== 1) return false;\n const owner: unknown = JSON.parse(fs.readFileSync(marker, 'utf8'));\n if (!isHistoryObject(owner) || !Number.isSafeInteger(owner.pid) || (owner.pid as number) <= 0) return false;\n if (ownerMayBeAlive(owner.pid as number)) return false;\n // Only the process that unlinks this unique marker may retire the directory.\n // Other cleaners see a newly empty guard and refuse to remove it.\n fs.unlinkSync(marker);\n fs.rmdirSync(guard);\n return true;\n } catch {\n return false;\n }\n}\n\n/** All new acquirers hold this guard until their ownership record is durable. */\nfunction withAcquisitionGuard<T>(lockPath: string, acquire: () => T): T {\n const guard = `${lockPath}.recovery`;\n try {\n fs.mkdirSync(guard, { mode: 0o700 });\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== 'EEXIST' || !retireDeadGuard(guard)) throw error;\n fs.mkdirSync(guard, { mode: 0o700 });\n }\n const marker = path.join(guard, `owner-${randomUUID()}.json`);\n try {\n fs.writeFileSync(marker, JSON.stringify({ pid: process.pid }), { flag: 'wx', mode: 0o600 });\n return acquire();\n } finally {\n fs.rmSync(marker, { force: true });\n fs.rmdirSync(guard);\n }\n}\n\n/** Called only under the acquisition guard, before publishing a new owner. */\nfunction recoverDeadOwner(lockPath: string, sourcePath: string): boolean {\n try {\n const record = readRecoverableLock(lockPath, sourcePath);\n if (!record || ownerMayBeAlive(record.pid)) return false;\n const before = fs.lstatSync(lockPath);\n if (readRecoverableLock(lockPath, sourcePath)?.token !== record.token || ownerMayBeAlive(record.pid)) return false;\n const current = fs.lstatSync(lockPath);\n if (before.dev !== current.dev || before.ino !== current.ino) return false;\n // The owner is gone, and other recoverers cannot remove this lock while\n // the guard is held. Legacy writers still contend on the exclusive wx open.\n fs.unlinkSync(lockPath);\n return true;\n } catch (error) {\n if (isFileSystemError(error) && error.code === 'ENOENT') return false;\n throw error;\n }\n}\n\nfunction releaseLock(lockPath: string, token: string, handle: number): void {\n fs.closeSync(handle);\n // Recovery only retires a lock after its recorded owner has exited, so that\n // owner cannot be here releasing it concurrently. A replaced lock is ambiguous.\n if (readToken(lockPath) === token) fs.rmSync(lockPath, { force: true });\n}\n\nfunction createLease(\n locks: readonly HeldHistoryLock[],\n sourcePath: string,\n assertQuiescent: (sourcePath: string) => void | Promise<void>,\n): HistoryOwnershipLease {\n let released = false;\n return {\n assertQuiescent: () => {\n if (released) throw new Error('History ownership lease has been released');\n for (const lock of locks) {\n const held = fs.fstatSync(lock.handle);\n const current = fs.statSync(lock.lockPath);\n if (held.dev !== current.dev || held.ino !== current.ino || readToken(lock.lockPath) !== lock.token) {\n throw new Error('History ownership lock was replaced');\n }\n }\n return assertQuiescent(sourcePath);\n },\n release: () => {\n if (released) return;\n released = true;\n let firstError: unknown;\n for (const lock of [...locks].reverse()) {\n try {\n releaseLock(lock.lockPath, lock.token, lock.handle);\n } catch (error) {\n firstError ??= error;\n }\n }\n if (firstError !== undefined) throw firstError;\n },\n };\n}\n\n/**\n * Creates the canonical history owner used by runtime writers, export CLI, and\n * the explicit offline importer. The default source boundary remains v4.\n * Complete locks left by a dead process are recovered under an exclusive guard.\n * A live owner or an ambiguous sidecar still blocks acquisition.\n */\nexport function createHistoryOwnership(options: HistoryOwnershipOptions = {}): HistoryOwnership {\n const assertQuiescent = options.assertQuiescent ?? (() => undefined);\n const assertSource =\n options.sourceFormat === 'sqlite'\n ? assertSqliteSource\n : options.sourceFormat === 'v3'\n ? assertV3Source\n : assertV4Source;\n return {\n async acquire(sourcePath: string): Promise<HistoryOwnershipLease> {\n const absoluteSourcePath = canonicalSourcePath(sourcePath);\n const paths = [absoluteSourcePath, ...(options.additionalPaths ?? [])].map(canonicalSourcePath);\n const canonicalPaths = [...new Set(paths)].sort((left, right) => left.localeCompare(right));\n const locks: HeldHistoryLock[] = [];\n let conflictingLockPath = historyOwnershipLockPath(absoluteSourcePath);\n try {\n for (const lockedPath of canonicalPaths) {\n const lockPath = historyOwnershipLockPath(lockedPath);\n conflictingLockPath = lockPath;\n const token = randomUUID();\n const record: HistoryLockRecord = {\n version: LOCK_VERSION,\n format: LOCK_FORMAT,\n pid: process.pid,\n sourcePath: lockedPath,\n token,\n };\n fs.mkdirSync(path.dirname(lockPath), { recursive: true, mode: 0o700 });\n withAcquisitionGuard(lockPath, () => {\n let handle: number;\n try {\n handle = fs.openSync(lockPath, 'wx', 0o600);\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== 'EEXIST' || !recoverDeadOwner(lockPath, lockedPath))\n throw error;\n handle = fs.openSync(lockPath, 'wx', 0o600);\n }\n const lock = { lockPath, token, handle };\n locks.push(lock);\n fs.writeFileSync(handle, `${JSON.stringify(record)}\\n`, 'utf8');\n fs.fsyncSync(handle);\n });\n }\n assertSource(absoluteSourcePath);\n } catch (error) {\n for (const lock of [...locks].reverse()) {\n try {\n releaseLock(lock.lockPath, lock.token, lock.handle);\n } catch {\n // Preserve the acquisition failure and never remove a replaced lock.\n }\n }\n if (isFileSystemError(error) && error.code === 'EEXIST') {\n throw new Error(`History ownership lock already exists or is ambiguous: ${conflictingLockPath}`, {\n cause: error,\n });\n }\n throw error;\n }\n return createLease(locks, absoluteSourcePath, assertQuiescent);\n },\n };\n}\n\n/** Explicitly named alias for hosts that want to document the v4 boundary. */\nexport const createV4HistoryOwnership = createHistoryOwnership;\n"],"mappings":";;;;AAMA,MAAM,cAAc;AACpB,MAAM,eAAe;AACrB,MAAM,cAAc;AAyBpB,SAAS,oBAAoB,YAA4B;CACvD,MAAM,WAAW,KAAK,QAAQ,UAAU;CACxC,IAAI,GAAG,WAAW,QAAQ,GAAG,OAAO,GAAG,aAAa,QAAQ;CAC5D,MAAM,WAAW,CAAC,KAAK,SAAS,QAAQ,CAAC;CACzC,IAAI,SAAS,KAAK,QAAQ,QAAQ;CAClC,OAAO,CAAC,GAAG,WAAW,MAAM,GAAG;EAC7B,SAAS,QAAQ,KAAK,SAAS,MAAM,CAAC;EACtC,SAAS,KAAK,QAAQ,MAAM;CAC9B;CACA,OAAO,KAAK,KAAK,GAAG,aAAa,MAAM,GAAG,GAAG,QAAQ;AACvD;;AAGA,SAAgB,yBAAyB,YAA4B;CACnE,OAAO,GAAG,oBAAoB,UAAU,IAAI;AAC9C;AA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AAE,KAAK,MAAM;KAC9D,GAAG,UAAU,MAAM;IACrB,CAAC;GACH;GACA,aAAa,kBAAkB;EACjC,SAAS,OAAO;GACd,KAAK,MAAM,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,GACpC,IAAI;IACF,YAAY,KAAK,UAAU,KAAK,OAAO,KAAK,MAAM;GACpD,QAAQ,CAER;GAEF,IAAI,kBAAkB,KAAK,KAAK,MAAM,SAAS,UAC7C,MAAM,IAAI,MAAM,0DAA0D,uBAAuB,EAC/F,OAAO,MACT,CAAC;GAEH,MAAM;EACR;EACA,OAAO,YAAY,OAAO,oBAAoB,eAAe;CAC/D,EACF;AACF;;AAGA,MAAa,2BAA2B"}
1
+ {"version":3,"file":"historyOwnership.mjs","names":[],"sources":["../src/services/historyOwnership/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { HistoryOwnership, HistoryOwnershipLease } from './type';\n\nconst LOCK_SUFFIX = '.po-v4.lock';\nconst LOCK_VERSION = 1;\nconst LOCK_FORMAT = 'po-v4-history-ownership';\n\ninterface HistoryLockRecord {\n version: 1;\n format: 'po-v4-history-ownership';\n pid: number;\n sourcePath: string;\n token: string;\n}\n\ninterface HeldHistoryLock {\n lockPath: string;\n token: string;\n handle: number;\n}\n\nexport interface HistoryOwnershipOptions {\n /** Checks managed writers; this cannot account for an unmanaged Pi process. */\n assertQuiescent?: (sourcePath: string) => void | Promise<void>;\n /** The source format admitted by this owner. Defaults to canonical v4. */\n sourceFormat?: 'v3' | 'v4' | 'sqlite';\n /** Additional paths to lock for the lifetime of each acquired source lease. */\n additionalPaths?: readonly string[];\n}\n\nfunction canonicalSourcePath(sourcePath: string): string {\n const absolute = path.resolve(sourcePath);\n if (fs.existsSync(absolute)) return fs.realpathSync(absolute);\n const segments = [path.basename(absolute)];\n let parent = path.dirname(absolute);\n while (!fs.existsSync(parent)) {\n segments.unshift(path.basename(parent));\n parent = path.dirname(parent);\n }\n return path.join(fs.realpathSync(parent), ...segments);\n}\n\n/** Resolve aliases so every writer and exporter contends for the same lock. */\nexport function historyOwnershipLockPath(sourcePath: string): string {\n return `${canonicalSourcePath(sourcePath)}${LOCK_SUFFIX}`;\n}\n\nfunction isHistoryObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isV4Header(value: unknown): boolean {\n return isHistoryObject(value) && value.kind === 'header' && value.v === 4;\n}\n\nfunction isV3Header(value: unknown): boolean {\n return isHistoryObject(value) && value.type === 'session' && value.version === 3;\n}\n\nfunction readHeader(sourcePath: string, format: 'v3' | 'v4'): unknown {\n const firstLine = fs.readFileSync(sourcePath, 'utf8').split('\\n', 1)[0] ?? '';\n try {\n return JSON.parse(firstLine);\n } catch (error) {\n const message =\n format === 'v4'\n ? `History ownership source is not canonical v4 JSONL: ${sourcePath}`\n : `Offline history source is not canonical v3 JSONL: ${sourcePath}`;\n throw new Error(message, { cause: error });\n }\n}\n\nfunction assertIndependentRegularFile(sourcePath: string, label: string): void {\n const stat = fs.statSync(sourcePath);\n if (!stat.isFile() || stat.nlink !== 1) throw new Error(`${label} must be an independent regular file`);\n}\n\nfunction assertV4Source(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'Canonical history');\n if (!isV4Header(readHeader(sourcePath, 'v4')))\n throw new Error(`History ownership only supports canonical v4 sources: ${sourcePath}`);\n}\n\nfunction assertV3Source(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'Offline v3 history source');\n if (!isV3Header(readHeader(sourcePath, 'v3')))\n throw new Error(`Offline history import only supports v3 sources: ${sourcePath}`);\n}\n\nfunction assertSqliteSource(sourcePath: string): void {\n if (!fs.existsSync(sourcePath)) return;\n assertIndependentRegularFile(sourcePath, 'SQLite history');\n const descriptor = fs.openSync(sourcePath, 'r');\n try {\n const header = Buffer.alloc(16);\n if (\n fs.readSync(descriptor, header, 0, header.length, 0) !== header.length ||\n header.toString('utf8') !== 'SQLite format 3\\u0000'\n )\n throw new Error(`History ownership source is not SQLite: ${sourcePath}`);\n } finally {\n fs.closeSync(descriptor);\n }\n}\n\nfunction isFileSystemError(error: unknown): error is NodeJS.ErrnoException {\n return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string';\n}\n\nfunction readToken(lockPath: string): string | undefined {\n try {\n const value = JSON.parse(fs.readFileSync(lockPath, 'utf8')) as Partial<HistoryLockRecord>;\n return typeof value.token === 'string' ? value.token : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** A dead owner is recoverable only when the entire lock record is recognizable. */\nfunction readRecoverableLock(lockPath: string, sourcePath: string): HistoryLockRecord | undefined {\n try {\n const stat = fs.lstatSync(lockPath);\n if (!stat.isFile() || stat.nlink !== 1) return undefined;\n const value: unknown = JSON.parse(fs.readFileSync(lockPath, 'utf8'));\n if (\n !isHistoryObject(value) ||\n value.version !== LOCK_VERSION ||\n value.format !== LOCK_FORMAT ||\n value.sourcePath !== sourcePath ||\n !Number.isSafeInteger(value.pid) ||\n (value.pid as number) <= 0 ||\n typeof value.token !== 'string' ||\n !/^[\\da-f]{8}(?:-[\\da-f]{4}){3}-[\\da-f]{12}$/iu.test(value.token)\n )\n return undefined;\n return value as unknown as HistoryLockRecord;\n } catch {\n return undefined;\n }\n}\n\nfunction ownerMayBeAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return !(isFileSystemError(error) && error.code === 'ESRCH');\n }\n}\n/** A guard left by a dead acquirer can be retired without touching its source lock. */\nfunction retireDeadGuard(guard: string): boolean {\n try {\n const stat = fs.lstatSync(guard);\n if (!stat.isDirectory()) return false;\n const entries = fs.readdirSync(guard);\n // An empty guard might still belong to a process killed between mkdir and\n // publishing its marker. Fail closed rather than race a new acquirer.\n if (entries.length !== 1 || !/^owner-[\\da-f-]{36}\\.json$/iu.test(entries[0]!)) return false;\n const marker = path.join(guard, entries[0]!);\n const markerStat = fs.lstatSync(marker);\n if (!markerStat.isFile() || markerStat.nlink !== 1) return false;\n const owner: unknown = JSON.parse(fs.readFileSync(marker, 'utf8'));\n if (!isHistoryObject(owner) || !Number.isSafeInteger(owner.pid) || (owner.pid as number) <= 0) return false;\n if (ownerMayBeAlive(owner.pid as number)) return false;\n // Only the process that unlinks this unique marker may retire the directory.\n // Other cleaners see a newly empty guard and refuse to remove it.\n fs.unlinkSync(marker);\n fs.rmdirSync(guard);\n return true;\n } catch {\n return false;\n }\n}\n\n/** All new acquirers hold this guard until their ownership record is durable. */\nfunction withAcquisitionGuard<T>(lockPath: string, acquire: () => T): T {\n const guard = `${lockPath}.recovery`;\n try {\n fs.mkdirSync(guard, { mode: 0o700 });\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== 'EEXIST' || !retireDeadGuard(guard)) throw error;\n fs.mkdirSync(guard, { mode: 0o700 });\n }\n const marker = path.join(guard, `owner-${randomUUID()}.json`);\n try {\n fs.writeFileSync(marker, JSON.stringify({ pid: process.pid }), { flag: 'wx', mode: 0o600 });\n return acquire();\n } finally {\n fs.rmSync(marker, { force: true });\n fs.rmdirSync(guard);\n }\n}\n\n/** Called only under the acquisition guard, before publishing a new owner. */\nfunction recoverDeadOwner(lockPath: string, sourcePath: string): boolean {\n try {\n const record = readRecoverableLock(lockPath, sourcePath);\n if (!record || ownerMayBeAlive(record.pid)) return false;\n const before = fs.lstatSync(lockPath);\n if (readRecoverableLock(lockPath, sourcePath)?.token !== record.token || ownerMayBeAlive(record.pid)) return false;\n const current = fs.lstatSync(lockPath);\n if (before.dev !== current.dev || before.ino !== current.ino) return false;\n // The owner is gone, and other recoverers cannot remove this lock while\n // the guard is held. Legacy writers still contend on the exclusive wx open.\n fs.unlinkSync(lockPath);\n return true;\n } catch (error) {\n if (isFileSystemError(error) && error.code === 'ENOENT') return false;\n throw error;\n }\n}\n\nfunction releaseLock(lockPath: string, token: string, handle: number): void {\n fs.closeSync(handle);\n // Recovery only retires a lock after its recorded owner has exited, so that\n // owner cannot be here releasing it concurrently. A replaced lock is ambiguous.\n if (readToken(lockPath) === token) fs.rmSync(lockPath, { force: true });\n}\n\nfunction createLease(\n locks: readonly HeldHistoryLock[],\n sourcePath: string,\n assertQuiescent: (sourcePath: string) => void | Promise<void>,\n): HistoryOwnershipLease {\n let released = false;\n return {\n assertQuiescent: () => {\n if (released) throw new Error('History ownership lease has been released');\n for (const lock of locks) {\n const held = fs.fstatSync(lock.handle);\n const current = fs.statSync(lock.lockPath);\n if (held.dev !== current.dev || held.ino !== current.ino || readToken(lock.lockPath) !== lock.token) {\n throw new Error('History ownership lock was replaced');\n }\n }\n return assertQuiescent(sourcePath);\n },\n release: () => {\n if (released) return;\n released = true;\n let firstError: unknown;\n for (const lock of [...locks].reverse()) {\n try {\n releaseLock(lock.lockPath, lock.token, lock.handle);\n } catch (error) {\n firstError ??= error;\n }\n }\n if (firstError !== undefined) throw firstError;\n },\n };\n}\n\n/**\n * Creates the canonical history owner used by runtime writers, export CLI, and\n * the explicit offline importer. The default source boundary remains v4.\n * Complete locks left by a dead process are recovered under an exclusive guard.\n * A live owner or an ambiguous sidecar still blocks acquisition.\n */\nexport function createHistoryOwnership(options: HistoryOwnershipOptions = {}): HistoryOwnership {\n const assertQuiescent = options.assertQuiescent ?? (() => undefined);\n const assertSource =\n options.sourceFormat === 'sqlite'\n ? assertSqliteSource\n : options.sourceFormat === 'v3'\n ? assertV3Source\n : assertV4Source;\n return {\n async acquire(sourcePath: string): Promise<HistoryOwnershipLease> {\n const absoluteSourcePath = canonicalSourcePath(sourcePath);\n const paths = [absoluteSourcePath, ...(options.additionalPaths ?? [])].map(canonicalSourcePath);\n const canonicalPaths = [...new Set(paths)].sort((left, right) => left.localeCompare(right));\n const locks: HeldHistoryLock[] = [];\n let conflictingLockPath = historyOwnershipLockPath(absoluteSourcePath);\n try {\n for (const lockedPath of canonicalPaths) {\n const lockPath = historyOwnershipLockPath(lockedPath);\n conflictingLockPath = lockPath;\n const token = randomUUID();\n const record: HistoryLockRecord = {\n version: LOCK_VERSION,\n format: LOCK_FORMAT,\n pid: process.pid,\n sourcePath: lockedPath,\n token,\n };\n fs.mkdirSync(path.dirname(lockPath), { recursive: true, mode: 0o700 });\n withAcquisitionGuard(lockPath, () => {\n let handle: number;\n try {\n handle = fs.openSync(lockPath, 'wx', 0o600);\n } catch (error) {\n if (!isFileSystemError(error) || error.code !== 'EEXIST' || !recoverDeadOwner(lockPath, lockedPath))\n throw error;\n handle = fs.openSync(lockPath, 'wx', 0o600);\n }\n const lock = { lockPath, token, handle };\n locks.push(lock);\n fs.writeFileSync(handle, `${JSON.stringify(record)}\\n`, 'utf8');\n fs.fsyncSync(handle);\n });\n }\n assertSource(absoluteSourcePath);\n } catch (error) {\n for (const lock of [...locks].reverse()) {\n try {\n releaseLock(lock.lockPath, lock.token, lock.handle);\n } catch {\n // Preserve the acquisition failure and never remove a replaced lock.\n }\n }\n if (isFileSystemError(error) && error.code === 'EEXIST') {\n throw new Error(`History ownership lock already exists or is ambiguous: ${conflictingLockPath}`, {\n cause: error,\n });\n }\n throw error;\n }\n return createLease(locks, absoluteSourcePath, assertQuiescent);\n },\n };\n}\n\n/** Explicitly named alias for hosts that want to document the v4 boundary. */\nexport const createV4HistoryOwnership = createHistoryOwnership;\n"],"mappings":";;;;AAMA,MAAM,cAAc;AACpB,MAAM,eAAe;AACrB,MAAM,cAAc;AAyBpB,SAAS,oBAAoB,YAA4B;CACvD,MAAM,WAAW,KAAK,QAAQ,UAAU;CACxC,IAAI,GAAG,WAAW,QAAQ,GAAG,OAAO,GAAG,aAAa,QAAQ;CAC5D,MAAM,WAAW,CAAC,KAAK,SAAS,QAAQ,CAAC;CACzC,IAAI,SAAS,KAAK,QAAQ,QAAQ;CAClC,OAAO,CAAC,GAAG,WAAW,MAAM,GAAG;EAC7B,SAAS,QAAQ,KAAK,SAAS,MAAM,CAAC;EACtC,SAAS,KAAK,QAAQ,MAAM;CAC9B;CACA,O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AAU,MAAM,GAAK;KAC5C;KACA,MAAM,OAAO;MAAE;MAAU;MAAO;KAAO;KACvC,MAAM,KAAK,IAAI;KACf,GAAG,cAAc,QAAQ,GAAG,KAAK,UAAU,MAAM,EAAE,KAAK,MAAM;KAC9D,GAAG,UAAU,MAAM;IACrB,CAAC;GACH;GACA,aAAa,kBAAkB;EACjC,SAAS,OAAO;GACd,KAAK,MAAM,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,GACpC,IAAI;IACF,YAAY,KAAK,UAAU,KAAK,OAAO,KAAK,MAAM;GACpD,QAAQ,CAER;GAEF,IAAI,kBAAkB,KAAK,KAAK,MAAM,SAAS,UAC7C,MAAM,IAAI,MAAM,0DAA0D,uBAAuB,EAC/F,OAAO,MACT,CAAC;GAEH,MAAM;EACR;EACA,OAAO,YAAY,OAAO,oBAAoB,eAAe;CAC/D,EACF;AACF;;AAGA,MAAa,2BAA2B"}
@@ -1,4 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_hubChannel = require("./src/schemas/hubChannel.cjs");
3
+ const require_home = require("./src/schemas/home.cjs");
4
+ exports.HOME_ENTITY_LIMIT = require_home.HOME_ENTITY_LIMIT;
5
+ exports.HOME_KINDS = require_home.HOME_KINDS;
6
+ exports.HOME_PAGE_LIMIT = require_home.HOME_PAGE_LIMIT;
7
+ exports.REMOTE_CONVERSATION_SESSION_PROVENANCE = require_hubChannel.REMOTE_CONVERSATION_SESSION_PROVENANCE;
3
8
  exports.WORKFLOW_DISPATCHER_SESSION_PROVENANCE = require_hubChannel.WORKFLOW_DISPATCHER_SESSION_PROVENANCE;
4
9
  exports.WORKFLOW_STEP_SESSION_PROVENANCE = require_hubChannel.WORKFLOW_STEP_SESSION_PROVENANCE;
10
+ exports.parseHomeContribution = require_home.parseHomeContribution;
11
+ exports.parseHomeEntity = require_home.parseHomeEntity;
12
+ exports.parseHomeProjection = require_home.parseHomeProjection;
13
+ exports.parseHomeSnapshot = require_home.parseHomeSnapshot;
@@ -1,2 +1,3 @@
1
- import { DoomComputerUseHostBinding, DoomComputerUseHostOperation, DoomComputerUseHostRequest, DoomComputerUseSessionAccess, DoomDirectEventBus, DoomDirectEventSubscriptionOptions, DoomHubChannel, DoomHubChannelConnection, DoomHubChannelFrame, DoomHubChannelHost, DoomHubChannelLifecycle, DoomHubChannelSource, DoomHubReservedWorktreeProvisioner, DoomHubReservedWorktreeRequest, DoomHubSessionApiRequest, DoomHubSessionCreateRequest, DoomHubSessionExecutionState, DoomHubSessionPromptOptions, DoomHubSessionPromptReceipt, DoomHubSessionReservations, DoomHubSessionScope, DoomHubSessionSelection, DoomHubSessionService, DoomPendingSessionSetup, DoomSessionActivity, DoomSessionCommunicationEndpoint, DoomSessionContext, WORKFLOW_DISPATCHER_SESSION_PROVENANCE, WORKFLOW_STEP_SESSION_PROVENANCE } from "./src/schemas/hubChannel.mjs";
2
- export { DoomComputerUseHostBinding, DoomComputerUseHostOperation, DoomComputerUseHostRequest, DoomComputerUseSessionAccess, DoomDirectEventBus, DoomDirectEventSubscriptionOptions, DoomHubChannel, DoomHubChannelConnection, DoomHubChannelFrame, DoomHubChannelHost, DoomHubChannelLifecycle, DoomHubChannelSource, DoomHubReservedWorktreeProvisioner, DoomHubReservedWorktreeRequest, DoomHubSessionApiRequest, DoomHubSessionCreateRequest, DoomHubSessionExecutionState, DoomHubSessionPromptOptions, DoomHubSessionPromptReceipt, DoomHubSessionReservations, DoomHubSessionScope, DoomHubSessionSelection, DoomHubSessionService, DoomPendingSessionSetup, DoomSessionActivity, DoomSessionCommunicationEndpoint, DoomSessionContext, WORKFLOW_DISPATCHER_SESSION_PROVENANCE, WORKFLOW_STEP_SESSION_PROVENANCE };
1
+ import { HOME_ENTITY_LIMIT, HOME_KINDS, HOME_PAGE_LIMIT, HomeContribution, HomeCoverage, HomeEntity, HomeItem, HomeKind, HomeProjection, HomeRequest, HomeSnapshot, HomeSourceStatus, parseHomeContribution, parseHomeEntity, parseHomeProjection, parseHomeSnapshot } from "./src/schemas/home.mjs";
2
+ import { PoComputerUseHostBinding, PoComputerUseHostOperation, PoComputerUseHostRequest, PoComputerUseSessionAccess, PoDirectEventBus, PoDirectEventSubscriptionOptions, PoHubChannel, PoHubChannelConnection, PoHubChannelFrame, PoHubChannelHost, PoHubChannelLifecycle, PoHubChannelSource, PoHubReservedWorktreeProvisioner, PoHubReservedWorktreeRequest, PoHubSessionApiRequest, PoHubSessionCreateRequest, PoHubSessionExecutionState, PoHubSessionPromptOptions, PoHubSessionPromptReceipt, PoHubSessionReservations, PoHubSessionScope, PoHubSessionSelection, PoHubSessionService, PoPendingSessionSetup, PoSessionActivity, PoSessionCommunicationEndpoint, PoSessionContext, PoSessionPeerDescription, REMOTE_CONVERSATION_SESSION_PROVENANCE, WORKFLOW_DISPATCHER_SESSION_PROVENANCE, WORKFLOW_STEP_SESSION_PROVENANCE } from "./src/schemas/hubChannel.mjs";
3
+ export { HOME_ENTITY_LIMIT, HOME_KINDS, HOME_PAGE_LIMIT, HomeContribution, HomeCoverage, HomeEntity, HomeItem, HomeKind, HomeProjection, HomeRequest, HomeSnapshot, HomeSourceStatus, PoComputerUseHostBinding, PoComputerUseHostOperation, PoComputerUseHostRequest, PoComputerUseSessionAccess, PoDirectEventBus, PoDirectEventSubscriptionOptions, PoHubChannel, PoHubChannelConnection, PoHubChannelFrame, PoHubChannelHost, PoHubChannelLifecycle, PoHubChannelSource, PoHubReservedWorktreeProvisioner, PoHubReservedWorktreeRequest, PoHubSessionApiRequest, PoHubSessionCreateRequest, PoHubSessionExecutionState, PoHubSessionPromptOptions, PoHubSessionPromptReceipt, PoHubSessionReservations, PoHubSessionScope, PoHubSessionSelection, PoHubSessionService, PoPendingSessionSetup, PoSessionActivity, PoSessionCommunicationEndpoint, PoSessionContext, PoSessionPeerDescription, REMOTE_CONVERSATION_SESSION_PROVENANCE, WORKFLOW_DISPATCHER_SESSION_PROVENANCE, WORKFLOW_STEP_SESSION_PROVENANCE, parseHomeContribution, parseHomeEntity, parseHomeProjection, parseHomeSnapshot };
@@ -1,2 +1,3 @@
1
- import { WORKFLOW_DISPATCHER_SESSION_PROVENANCE, WORKFLOW_STEP_SESSION_PROVENANCE } from "./src/schemas/hubChannel.mjs";
2
- export { WORKFLOW_DISPATCHER_SESSION_PROVENANCE, WORKFLOW_STEP_SESSION_PROVENANCE };
1
+ import { REMOTE_CONVERSATION_SESSION_PROVENANCE, WORKFLOW_DISPATCHER_SESSION_PROVENANCE, WORKFLOW_STEP_SESSION_PROVENANCE } from "./src/schemas/hubChannel.mjs";
2
+ import { HOME_ENTITY_LIMIT, HOME_KINDS, HOME_PAGE_LIMIT, parseHomeContribution, parseHomeEntity, parseHomeProjection, parseHomeSnapshot } from "./src/schemas/home.mjs";
3
+ export { HOME_ENTITY_LIMIT, HOME_KINDS, HOME_PAGE_LIMIT, REMOTE_CONVERSATION_SESSION_PROVENANCE, WORKFLOW_DISPATCHER_SESSION_PROVENANCE, WORKFLOW_STEP_SESSION_PROVENANCE, parseHomeContribution, parseHomeEntity, parseHomeProjection, parseHomeSnapshot };
package/dist/index.cjs CHANGED
@@ -8,37 +8,35 @@ exports.AskUserBlockedEventSchema = require_askUser.AskUserBlockedEventSchema;
8
8
  exports.AskUserPromptEventSchema = require_askUser.AskUserPromptEventSchema;
9
9
  exports.AskUserPromptOptionSchema = require_askUser.AskUserPromptOptionSchema;
10
10
  exports.AskUserPromptQuestionSchema = require_askUser.AskUserPromptQuestionSchema;
11
- exports.DOOM_ASK_USER_BLOCKED_EVENT = require_askUser.DOOM_ASK_USER_BLOCKED_EVENT;
12
- exports.DOOM_ASK_USER_PROMPT_EVENT = require_askUser.DOOM_ASK_USER_PROMPT_EVENT;
13
- exports.DOOM_COCKPIT_SERVER_ID = require_sessionProtocol.DOOM_COCKPIT_SERVER_ID;
14
- exports.DOOM_NARRATION_SERVICE = require_narration.DOOM_NARRATION_SERVICE;
15
- exports.DOOM_NOTIFICATION_ENTRY_TYPE = require_notification.DOOM_NOTIFICATION_ENTRY_TYPE;
16
- exports.DOOM_NOTIFICATION_ENTRY_VERSION = require_notification.DOOM_NOTIFICATION_ENTRY_VERSION;
17
- exports.DOOM_NOTIFICATION_SERVICE = require_notification.DOOM_NOTIFICATION_SERVICE;
18
- exports.DOOM_SESSION_MANAGEMENT_SERVICE_ID = require_sessionProtocol.DOOM_SESSION_MANAGEMENT_SERVICE_ID;
19
- exports.DOOM_SESSION_SERVICE_ID = require_sessionProtocol.DOOM_SESSION_SERVICE_ID;
20
- exports.DoomHubService = require_sessionProtocol.DoomHubService;
21
- exports.DoomNotificationEntryDataSchema = require_notification.DoomNotificationEntryDataSchema;
22
- exports.DoomNotificationLevelSchema = require_notification.DoomNotificationLevelSchema;
23
- exports.DoomNotificationRequestSchema = require_notification.DoomNotificationRequestSchema;
24
- exports.DoomProtocolError = require_runtimeProtocol.DoomProtocolError;
25
- exports.DoomProtocolValidationError = require_runtimeProtocol.DoomProtocolValidationError;
26
- exports.DoomSessionManagementService = require_sessionProtocol.DoomSessionManagementService;
27
- exports.DoomSessionService = require_sessionProtocol.DoomSessionService;
28
- exports.MAX_DOOM_NOTIFICATION_BODY_CHARACTERS = require_notification.MAX_DOOM_NOTIFICATION_BODY_CHARACTERS;
29
- exports.MAX_DOOM_NOTIFICATION_SUBTITLE_CHARACTERS = require_notification.MAX_DOOM_NOTIFICATION_SUBTITLE_CHARACTERS;
30
- exports.MAX_DOOM_NOTIFICATION_TITLE_CHARACTERS = require_notification.MAX_DOOM_NOTIFICATION_TITLE_CHARACTERS;
31
11
  exports.MAX_NARRATION_TEXT_CHARACTERS = require_narration.MAX_NARRATION_TEXT_CHARACTERS;
12
+ exports.MAX_PO_NOTIFICATION_BODY_CHARACTERS = require_notification.MAX_PO_NOTIFICATION_BODY_CHARACTERS;
13
+ exports.MAX_PO_NOTIFICATION_SUBTITLE_CHARACTERS = require_notification.MAX_PO_NOTIFICATION_SUBTITLE_CHARACTERS;
14
+ exports.MAX_PO_NOTIFICATION_TITLE_CHARACTERS = require_notification.MAX_PO_NOTIFICATION_TITLE_CHARACTERS;
15
+ exports.MAX_SESSION_GROUPS = require_sessionProtocol.MAX_SESSION_GROUPS;
16
+ exports.MAX_SESSION_GROUP_LENGTH = require_sessionProtocol.MAX_SESSION_GROUP_LENGTH;
32
17
  exports.NarrationRequestSchema = require_narration.NarrationRequestSchema;
33
- exports.createDoomNotificationEntryData = require_notification.createDoomNotificationEntryData;
18
+ exports.PO_ASK_USER_BLOCKED_EVENT = require_askUser.PO_ASK_USER_BLOCKED_EVENT;
19
+ exports.PO_ASK_USER_PROMPT_EVENT = require_askUser.PO_ASK_USER_PROMPT_EVENT;
20
+ exports.PO_NARRATION_SERVICE = require_narration.PO_NARRATION_SERVICE;
21
+ exports.PO_NOTIFICATION_ENTRY_TYPE = require_notification.PO_NOTIFICATION_ENTRY_TYPE;
22
+ exports.PO_NOTIFICATION_ENTRY_VERSION = require_notification.PO_NOTIFICATION_ENTRY_VERSION;
23
+ exports.PO_NOTIFICATION_SERVICE = require_notification.PO_NOTIFICATION_SERVICE;
24
+ exports.PoNotificationEntryDataSchema = require_notification.PoNotificationEntryDataSchema;
25
+ exports.PoNotificationLevelSchema = require_notification.PoNotificationLevelSchema;
26
+ exports.PoNotificationRequestSchema = require_notification.PoNotificationRequestSchema;
27
+ exports.PoProtocolError = require_runtimeProtocol.PoProtocolError;
28
+ exports.PoProtocolValidationError = require_runtimeProtocol.PoProtocolValidationError;
29
+ exports.SESSION_GROUPS_CHANGED_FRAME = require_sessionProtocol.SESSION_GROUPS_CHANGED_FRAME;
34
30
  exports.createNarrationRequest = require_narration.createNarrationRequest;
31
+ exports.createPoNotificationEntryData = require_notification.createPoNotificationEntryData;
35
32
  exports.createProtocolRuntime = require_runtimeProtocol.createProtocolRuntime;
36
- exports.isDoomNotificationEntryData = require_notification.isDoomNotificationEntryData;
37
- exports.isDoomNotificationRequest = require_notification.isDoomNotificationRequest;
38
33
  exports.isNarrationRequest = require_narration.isNarrationRequest;
39
- exports.normalizeDoomNotificationRequest = require_notification.normalizeDoomNotificationRequest;
34
+ exports.isPoNotificationEntryData = require_notification.isPoNotificationEntryData;
35
+ exports.isPoNotificationRequest = require_notification.isPoNotificationRequest;
40
36
  exports.normalizeNarrationText = require_narration.normalizeNarrationText;
41
- exports.readDoomNarrationService = require_narration.readDoomNarrationService;
42
- exports.readDoomNotificationService = require_notification.readDoomNotificationService;
43
- exports.requireDoomNarrationService = require_narration.requireDoomNarrationService;
44
- exports.requireDoomNotificationService = require_notification.requireDoomNotificationService;
37
+ exports.normalizePoNotificationRequest = require_notification.normalizePoNotificationRequest;
38
+ exports.normalizeSessionGroups = require_sessionProtocol.normalizeSessionGroups;
39
+ exports.readPoNarrationService = require_narration.readPoNarrationService;
40
+ exports.readPoNotificationService = require_notification.readPoNotificationService;
41
+ exports.requirePoNarrationService = require_narration.requirePoNarrationService;
42
+ exports.requirePoNotificationService = require_notification.requirePoNotificationService;
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { AskUserBlockedEvent, AskUserBlockedEventSchema, AskUserPromptEvent, AskUserPromptEventSchema, AskUserPromptOption, AskUserPromptOptionSchema, AskUserPromptQuestion, AskUserPromptQuestionSchema, DOOM_ASK_USER_BLOCKED_EVENT, DOOM_ASK_USER_PROMPT_EVENT } from "./src/schemas/askUser.mjs";
2
- import { AssistantTranscriptItem, ClearQueueResult, DOOM_COCKPIT_SERVER_ID, DOOM_SESSION_MANAGEMENT_SERVICE_ID, DOOM_SESSION_SERVICE_ID, DoomHubService, DoomSessionManagementService, DoomSessionService, ExtensionUiResponse, FollowUpArgs, HubService, ImageContentPart, JsonValue, ModelRef, PromoteQueuedArgs, PromptArgs, ProtocolEvent, QueuedItemArgs, RewindArgs, RewindResult, RewindSummaryEntry, SessionCommand, SessionCommandSourceInfo, SessionLifecycle, SessionManagementService, SessionMessageArgs, SessionPhase, SessionPresentation, SessionService, SessionServiceState, SessionSnapshot, SessionStateInfo, SessionStats, SessionUsage, SteerArgs, TextContentPart, ThinkingContentPart, ThinkingLevel, ToolCallContentPart, ToolTranscriptItem, TranscriptItem, TranscriptPage, TranscriptPageRequest, TranscriptProgress, UserTranscriptItem } from "./src/schemas/sessionProtocol.mjs";
3
- import { DOOM_NOTIFICATION_ENTRY_TYPE, DOOM_NOTIFICATION_ENTRY_VERSION, DOOM_NOTIFICATION_SERVICE, DoomNotificationEntryData, DoomNotificationEntryDataSchema, DoomNotificationLevel, DoomNotificationLevelSchema, DoomNotificationRequest, DoomNotificationRequestSchema, DoomNotificationService, MAX_DOOM_NOTIFICATION_BODY_CHARACTERS, MAX_DOOM_NOTIFICATION_SUBTITLE_CHARACTERS, MAX_DOOM_NOTIFICATION_TITLE_CHARACTERS, createDoomNotificationEntryData, isDoomNotificationEntryData, isDoomNotificationRequest, normalizeDoomNotificationRequest, readDoomNotificationService, requireDoomNotificationService } from "./src/schemas/notification.mjs";
4
- import { DOOM_NARRATION_SERVICE, DoomNarrationService, MAX_NARRATION_TEXT_CHARACTERS, NarrationRequest, NarrationRequestSchema, createNarrationRequest, isNarrationRequest, normalizeNarrationText, readDoomNarrationService, requireDoomNarrationService } from "./src/schemas/narration.mjs";
5
- import { DoomProtocolError, DoomProtocolValidationError, EventBusLike, ProtocolRuntime, ProtocolRuntimeOptions, RequestOptions, createProtocolRuntime } from "./runtimeProtocol.mjs";
6
- export { AskUserBlockedEvent, AskUserBlockedEventSchema, AskUserPromptEvent, AskUserPromptEventSchema, AskUserPromptOption, AskUserPromptOptionSchema, AskUserPromptQuestion, AskUserPromptQuestionSchema, AssistantTranscriptItem, ClearQueueResult, DOOM_ASK_USER_BLOCKED_EVENT, DOOM_ASK_USER_PROMPT_EVENT, DOOM_COCKPIT_SERVER_ID, DOOM_NARRATION_SERVICE, DOOM_NOTIFICATION_ENTRY_TYPE, DOOM_NOTIFICATION_ENTRY_VERSION, DOOM_NOTIFICATION_SERVICE, DOOM_SESSION_MANAGEMENT_SERVICE_ID, DOOM_SESSION_SERVICE_ID, DoomHubService, DoomNarrationService, DoomNotificationEntryData, DoomNotificationEntryDataSchema, DoomNotificationLevel, DoomNotificationLevelSchema, DoomNotificationRequest, DoomNotificationRequestSchema, DoomNotificationService, DoomProtocolError, DoomProtocolValidationError, DoomSessionManagementService, DoomSessionService, type EventBusLike, ExtensionUiResponse, FollowUpArgs, HubService, ImageContentPart, JsonValue, MAX_DOOM_NOTIFICATION_BODY_CHARACTERS, MAX_DOOM_NOTIFICATION_SUBTITLE_CHARACTERS, MAX_DOOM_NOTIFICATION_TITLE_CHARACTERS, MAX_NARRATION_TEXT_CHARACTERS, ModelRef, NarrationRequest, NarrationRequestSchema, PromoteQueuedArgs, PromptArgs, ProtocolEvent, type ProtocolRuntime, type ProtocolRuntimeOptions, QueuedItemArgs, type RequestOptions, RewindArgs, RewindResult, RewindSummaryEntry, SessionCommand, SessionCommandSourceInfo, SessionLifecycle, SessionManagementService, SessionMessageArgs, SessionPhase, SessionPresentation, SessionService, SessionServiceState, SessionSnapshot, SessionStateInfo, SessionStats, SessionUsage, SteerArgs, TextContentPart, ThinkingContentPart, ThinkingLevel, ToolCallContentPart, ToolTranscriptItem, TranscriptItem, TranscriptPage, TranscriptPageRequest, TranscriptProgress, UserTranscriptItem, createDoomNotificationEntryData, createNarrationRequest, createProtocolRuntime, isDoomNotificationEntryData, isDoomNotificationRequest, isNarrationRequest, normalizeDoomNotificationRequest, normalizeNarrationText, readDoomNarrationService, readDoomNotificationService, requireDoomNarrationService, requireDoomNotificationService };
1
+ import { AskUserBlockedEvent, AskUserBlockedEventSchema, AskUserPromptEvent, AskUserPromptEventSchema, AskUserPromptOption, AskUserPromptOptionSchema, AskUserPromptQuestion, AskUserPromptQuestionSchema, PO_ASK_USER_BLOCKED_EVENT, PO_ASK_USER_PROMPT_EVENT } from "./src/schemas/askUser.mjs";
2
+ import { AssistantTranscriptItem, ClearQueueResult, ExtensionUiResponse, FollowUpArgs, ImageContentPart, JsonValue, MAX_SESSION_GROUPS, MAX_SESSION_GROUP_LENGTH, ModelRef, PromoteQueuedArgs, PromptArgs, ProtocolEvent, QueuedItemArgs, RewindArgs, RewindResult, RewindSummaryEntry, SESSION_GROUPS_CHANGED_FRAME, SessionCommand, SessionCommandSourceInfo, SessionLifecycle, SessionLive, SessionLiveTool, SessionMessageArgs, SessionPhase, SessionPresentation, SessionService, SessionServiceState, SessionSnapshot, SessionStateInfo, SessionStats, SessionUsage, SteerArgs, TextContentPart, ThinkingContentPart, ThinkingLevel, ToolCallContentPart, ToolTranscriptItem, TranscriptItem, TranscriptPage, TranscriptPageRequest, UserTranscriptItem, normalizeSessionGroups } from "./src/schemas/sessionProtocol.mjs";
3
+ import { MAX_PO_NOTIFICATION_BODY_CHARACTERS, MAX_PO_NOTIFICATION_SUBTITLE_CHARACTERS, MAX_PO_NOTIFICATION_TITLE_CHARACTERS, PO_NOTIFICATION_ENTRY_TYPE, PO_NOTIFICATION_ENTRY_VERSION, PO_NOTIFICATION_SERVICE, PoNotificationEntryData, PoNotificationEntryDataSchema, PoNotificationLevel, PoNotificationLevelSchema, PoNotificationRequest, PoNotificationRequestSchema, PoNotificationService, createPoNotificationEntryData, isPoNotificationEntryData, isPoNotificationRequest, normalizePoNotificationRequest, readPoNotificationService, requirePoNotificationService } from "./src/schemas/notification.mjs";
4
+ import { MAX_NARRATION_TEXT_CHARACTERS, NarrationRequest, NarrationRequestSchema, PO_NARRATION_SERVICE, PoNarrationService, createNarrationRequest, isNarrationRequest, normalizeNarrationText, readPoNarrationService, requirePoNarrationService } from "./src/schemas/narration.mjs";
5
+ import { EventBusLike, PoProtocolError, PoProtocolValidationError, ProtocolRuntime, ProtocolRuntimeOptions, RequestOptions, createProtocolRuntime } from "./runtimeProtocol.mjs";
6
+ export { AskUserBlockedEvent, AskUserBlockedEventSchema, AskUserPromptEvent, AskUserPromptEventSchema, AskUserPromptOption, AskUserPromptOptionSchema, AskUserPromptQuestion, AskUserPromptQuestionSchema, AssistantTranscriptItem, ClearQueueResult, type EventBusLike, ExtensionUiResponse, FollowUpArgs, ImageContentPart, JsonValue, MAX_NARRATION_TEXT_CHARACTERS, MAX_PO_NOTIFICATION_BODY_CHARACTERS, MAX_PO_NOTIFICATION_SUBTITLE_CHARACTERS, MAX_PO_NOTIFICATION_TITLE_CHARACTERS, MAX_SESSION_GROUPS, MAX_SESSION_GROUP_LENGTH, ModelRef, NarrationRequest, NarrationRequestSchema, PO_ASK_USER_BLOCKED_EVENT, PO_ASK_USER_PROMPT_EVENT, PO_NARRATION_SERVICE, PO_NOTIFICATION_ENTRY_TYPE, PO_NOTIFICATION_ENTRY_VERSION, PO_NOTIFICATION_SERVICE, PoNarrationService, PoNotificationEntryData, PoNotificationEntryDataSchema, PoNotificationLevel, PoNotificationLevelSchema, PoNotificationRequest, PoNotificationRequestSchema, PoNotificationService, PoProtocolError, PoProtocolValidationError, PromoteQueuedArgs, PromptArgs, ProtocolEvent, type ProtocolRuntime, type ProtocolRuntimeOptions, QueuedItemArgs, type RequestOptions, RewindArgs, RewindResult, RewindSummaryEntry, SESSION_GROUPS_CHANGED_FRAME, SessionCommand, SessionCommandSourceInfo, SessionLifecycle, SessionLive, SessionLiveTool, SessionMessageArgs, SessionPhase, SessionPresentation, SessionService, SessionServiceState, SessionSnapshot, SessionStateInfo, SessionStats, SessionUsage, SteerArgs, TextContentPart, ThinkingContentPart, ThinkingLevel, ToolCallContentPart, ToolTranscriptItem, TranscriptItem, TranscriptPage, TranscriptPageRequest, UserTranscriptItem, createNarrationRequest, createPoNotificationEntryData, createProtocolRuntime, isNarrationRequest, isPoNotificationEntryData, isPoNotificationRequest, normalizeNarrationText, normalizePoNotificationRequest, normalizeSessionGroups, readPoNarrationService, readPoNotificationService, requirePoNarrationService, requirePoNotificationService };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { AskUserBlockedEventSchema, AskUserPromptEventSchema, AskUserPromptOptionSchema, AskUserPromptQuestionSchema, DOOM_ASK_USER_BLOCKED_EVENT, DOOM_ASK_USER_PROMPT_EVENT } from "./src/schemas/askUser.mjs";
2
- import { DOOM_NARRATION_SERVICE, MAX_NARRATION_TEXT_CHARACTERS, NarrationRequestSchema, createNarrationRequest, isNarrationRequest, normalizeNarrationText, readDoomNarrationService, requireDoomNarrationService } from "./src/schemas/narration.mjs";
3
- import { DOOM_NOTIFICATION_ENTRY_TYPE, DOOM_NOTIFICATION_ENTRY_VERSION, DOOM_NOTIFICATION_SERVICE, DoomNotificationEntryDataSchema, DoomNotificationLevelSchema, DoomNotificationRequestSchema, MAX_DOOM_NOTIFICATION_BODY_CHARACTERS, MAX_DOOM_NOTIFICATION_SUBTITLE_CHARACTERS, MAX_DOOM_NOTIFICATION_TITLE_CHARACTERS, createDoomNotificationEntryData, isDoomNotificationEntryData, isDoomNotificationRequest, normalizeDoomNotificationRequest, readDoomNotificationService, requireDoomNotificationService } from "./src/schemas/notification.mjs";
4
- import { DOOM_COCKPIT_SERVER_ID, DOOM_SESSION_MANAGEMENT_SERVICE_ID, DOOM_SESSION_SERVICE_ID, DoomHubService, DoomSessionManagementService, DoomSessionService } from "./src/schemas/sessionProtocol.mjs";
5
- import { DoomProtocolError, DoomProtocolValidationError, createProtocolRuntime } from "./runtimeProtocol.mjs";
6
- export { AskUserBlockedEventSchema, AskUserPromptEventSchema, AskUserPromptOptionSchema, AskUserPromptQuestionSchema, DOOM_ASK_USER_BLOCKED_EVENT, DOOM_ASK_USER_PROMPT_EVENT, DOOM_COCKPIT_SERVER_ID, DOOM_NARRATION_SERVICE, DOOM_NOTIFICATION_ENTRY_TYPE, DOOM_NOTIFICATION_ENTRY_VERSION, DOOM_NOTIFICATION_SERVICE, DOOM_SESSION_MANAGEMENT_SERVICE_ID, DOOM_SESSION_SERVICE_ID, DoomHubService, DoomNotificationEntryDataSchema, DoomNotificationLevelSchema, DoomNotificationRequestSchema, DoomProtocolError, DoomProtocolValidationError, DoomSessionManagementService, DoomSessionService, MAX_DOOM_NOTIFICATION_BODY_CHARACTERS, MAX_DOOM_NOTIFICATION_SUBTITLE_CHARACTERS, MAX_DOOM_NOTIFICATION_TITLE_CHARACTERS, MAX_NARRATION_TEXT_CHARACTERS, NarrationRequestSchema, createDoomNotificationEntryData, createNarrationRequest, createProtocolRuntime, isDoomNotificationEntryData, isDoomNotificationRequest, isNarrationRequest, normalizeDoomNotificationRequest, normalizeNarrationText, readDoomNarrationService, readDoomNotificationService, requireDoomNarrationService, requireDoomNotificationService };
1
+ import { AskUserBlockedEventSchema, AskUserPromptEventSchema, AskUserPromptOptionSchema, AskUserPromptQuestionSchema, PO_ASK_USER_BLOCKED_EVENT, PO_ASK_USER_PROMPT_EVENT } from "./src/schemas/askUser.mjs";
2
+ import { MAX_NARRATION_TEXT_CHARACTERS, NarrationRequestSchema, PO_NARRATION_SERVICE, createNarrationRequest, isNarrationRequest, normalizeNarrationText, readPoNarrationService, requirePoNarrationService } from "./src/schemas/narration.mjs";
3
+ import { MAX_PO_NOTIFICATION_BODY_CHARACTERS, MAX_PO_NOTIFICATION_SUBTITLE_CHARACTERS, MAX_PO_NOTIFICATION_TITLE_CHARACTERS, PO_NOTIFICATION_ENTRY_TYPE, PO_NOTIFICATION_ENTRY_VERSION, PO_NOTIFICATION_SERVICE, PoNotificationEntryDataSchema, PoNotificationLevelSchema, PoNotificationRequestSchema, createPoNotificationEntryData, isPoNotificationEntryData, isPoNotificationRequest, normalizePoNotificationRequest, readPoNotificationService, requirePoNotificationService } from "./src/schemas/notification.mjs";
4
+ import { MAX_SESSION_GROUPS, MAX_SESSION_GROUP_LENGTH, SESSION_GROUPS_CHANGED_FRAME, normalizeSessionGroups } from "./src/schemas/sessionProtocol.mjs";
5
+ import { PoProtocolError, PoProtocolValidationError, createProtocolRuntime } from "./runtimeProtocol.mjs";
6
+ export { AskUserBlockedEventSchema, AskUserPromptEventSchema, AskUserPromptOptionSchema, AskUserPromptQuestionSchema, MAX_NARRATION_TEXT_CHARACTERS, MAX_PO_NOTIFICATION_BODY_CHARACTERS, MAX_PO_NOTIFICATION_SUBTITLE_CHARACTERS, MAX_PO_NOTIFICATION_TITLE_CHARACTERS, MAX_SESSION_GROUPS, MAX_SESSION_GROUP_LENGTH, NarrationRequestSchema, PO_ASK_USER_BLOCKED_EVENT, PO_ASK_USER_PROMPT_EVENT, PO_NARRATION_SERVICE, PO_NOTIFICATION_ENTRY_TYPE, PO_NOTIFICATION_ENTRY_VERSION, PO_NOTIFICATION_SERVICE, PoNotificationEntryDataSchema, PoNotificationLevelSchema, PoNotificationRequestSchema, PoProtocolError, PoProtocolValidationError, SESSION_GROUPS_CHANGED_FRAME, createNarrationRequest, createPoNotificationEntryData, createProtocolRuntime, isNarrationRequest, isPoNotificationEntryData, isPoNotificationRequest, normalizeNarrationText, normalizePoNotificationRequest, normalizeSessionGroups, readPoNarrationService, readPoNotificationService, requirePoNarrationService, requirePoNotificationService };
@@ -0,0 +1 @@
1
+ export * from '@earendil-works/chord';
@@ -0,0 +1 @@
1
+ export * from '@earendil-works/chord/context';
package/dist/json.cjs CHANGED
@@ -1,6 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_runtimeJson = require("./runtimeJson.cjs");
3
- exports.isRecord = require_runtimeJson.isRecord;
4
- exports.readJson = require_runtimeJson.readJson;
5
- exports.writeFileAtomic = require_runtimeJson.writeFileAtomic;
6
- exports.writeJson = require_runtimeJson.writeJson;
2
+ const require_core = require("./src/services/json/core.cjs");
3
+ const require_sync = require("./src/services/json/sync.cjs");
4
+ require("./runtimeJson.cjs");
5
+ exports.isRecord = require_core.isRecord;
6
+ exports.parseJsonObject = require_core.parseJsonObject;
7
+ exports.readJson = require_sync.readJson;
8
+ exports.readJsonAsync = require_core.readJsonAsync;
9
+ exports.serializeJson = require_core.serializeJson;
10
+ exports.writeFileAtomic = require_sync.writeFileAtomic;
11
+ exports.writeJson = require_sync.writeJson;
12
+ exports.writeJsonAsync = require_core.writeJsonAsync;
package/dist/json.d.mts CHANGED
@@ -1,2 +1,4 @@
1
- import { JsonObject, isRecord, readJson, writeFileAtomic, writeJson } from "./runtimeJson.mjs";
2
- export { JsonObject, isRecord, readJson, writeFileAtomic, writeJson };
1
+ import { JsonObject, isRecord, parseJsonObject, readJsonAsync, serializeJson, writeJsonAsync } from "./src/services/json/core.mjs";
2
+ import { readJson, writeFileAtomic, writeJson } from "./src/services/json/sync.mjs";
3
+ import "./runtimeJson.mjs";
4
+ export { JsonObject, isRecord, parseJsonObject, readJson, readJsonAsync, serializeJson, writeFileAtomic, writeJson, writeJsonAsync };
package/dist/json.mjs CHANGED
@@ -1,2 +1,4 @@
1
- import { isRecord, readJson, writeFileAtomic, writeJson } from "./runtimeJson.mjs";
2
- export { isRecord, readJson, writeFileAtomic, writeJson };
1
+ import { isRecord, parseJsonObject, readJsonAsync, serializeJson, writeJsonAsync } from "./src/services/json/core.mjs";
2
+ import { readJson, writeFileAtomic, writeJson } from "./src/services/json/sync.mjs";
3
+ import "./runtimeJson.mjs";
4
+ export { isRecord, parseJsonObject, readJson, readJsonAsync, serializeJson, writeFileAtomic, writeJson, writeJsonAsync };
package/dist/kernel.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_index = require("./src/services/kernel/index.cjs");
3
- exports.createDoomKernel = require_index.createDoomKernel;
3
+ exports.createPoKernel = require_index.createPoKernel;
package/dist/kernel.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { DoomKernel, KernelContribution, KernelRegistration, KernelSlotHandle, KernelSlotSink } from "./src/types/kernel.mjs";
2
- import { CreateDoomKernelOptions, createDoomKernel } from "./src/services/kernel/index.mjs";
3
- export { type CreateDoomKernelOptions, type DoomKernel, type KernelContribution, type KernelRegistration, type KernelSlotHandle, type KernelSlotSink, createDoomKernel };
1
+ import { KernelContribution, KernelRegistration, KernelSlotHandle, KernelSlotSink, PoKernel } from "./src/types/kernel.mjs";
2
+ import { CreatePoKernelOptions, createPoKernel } from "./src/services/kernel/index.mjs";
3
+ export { type CreatePoKernelOptions, type KernelContribution, type KernelRegistration, type KernelSlotHandle, type KernelSlotSink, type PoKernel, createPoKernel };