@noopolis/daimon 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (404) hide show
  1. package/README.md +307 -45
  2. package/dist/contracts/attentionContract.d.ts +117 -0
  3. package/dist/contracts/attentionContract.d.ts.map +1 -0
  4. package/dist/contracts/attentionContract.js +14 -0
  5. package/dist/contracts/canonicalJson.d.ts +3 -0
  6. package/dist/contracts/canonicalJson.d.ts.map +1 -0
  7. package/dist/contracts/canonicalJson.js +54 -0
  8. package/dist/contracts/grokWorkerContract.d.ts +74 -0
  9. package/dist/contracts/grokWorkerContract.d.ts.map +1 -0
  10. package/dist/contracts/grokWorkerContract.js +88 -0
  11. package/dist/contracts/organizationRuntimeContract.d.ts +765 -0
  12. package/dist/contracts/organizationRuntimeContract.d.ts.map +1 -0
  13. package/dist/contracts/organizationRuntimeContract.js +121 -0
  14. package/dist/contracts/runtimeContractManifest.d.ts +1615 -0
  15. package/dist/contracts/runtimeContractManifest.d.ts.map +1 -0
  16. package/dist/contracts/runtimeContractManifest.js +181 -0
  17. package/dist/core/credentialRedaction.d.ts +4 -0
  18. package/dist/core/credentialRedaction.d.ts.map +1 -0
  19. package/dist/core/credentialRedaction.js +28 -0
  20. package/dist/core/siblingBuildFreshness.d.ts +21 -0
  21. package/dist/core/siblingBuildFreshness.d.ts.map +1 -0
  22. package/dist/core/siblingBuildFreshness.js +25 -0
  23. package/dist/core/types.d.ts +10 -1
  24. package/dist/core/types.d.ts.map +1 -1
  25. package/dist/examples/exampleCausalId.d.ts +3 -0
  26. package/dist/examples/exampleCausalId.d.ts.map +1 -0
  27. package/dist/examples/exampleCausalId.js +8 -0
  28. package/dist/examples/jungian-play-org.js +3 -2
  29. package/dist/examples/jungian-triad-org.js +3 -2
  30. package/dist/examples/jungianPlayAgent.d.ts +1 -1
  31. package/dist/examples/jungianPlayAgent.d.ts.map +1 -1
  32. package/dist/examples/jungianPlayAgent.js +1 -1
  33. package/dist/examples/jungianProfiles.d.ts +1 -1
  34. package/dist/examples/jungianProfiles.d.ts.map +1 -1
  35. package/dist/examples/jungianTriadProfiles.d.ts +1 -1
  36. package/dist/examples/jungianTriadProfiles.d.ts.map +1 -1
  37. package/dist/examples/pi-agent.js +3 -2
  38. package/dist/examples/pi-memory-org.js +6 -5
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +1 -0
  42. package/dist/mcp/toolServer.d.ts +31 -0
  43. package/dist/mcp/toolServer.d.ts.map +1 -0
  44. package/dist/mcp/toolServer.js +145 -0
  45. package/dist/observability/causalEvents.d.ts +118 -0
  46. package/dist/observability/causalEvents.d.ts.map +1 -0
  47. package/dist/observability/causalEvents.js +223 -0
  48. package/dist/observability/controlCausal.d.ts +117 -0
  49. package/dist/observability/controlCausal.d.ts.map +1 -0
  50. package/dist/observability/controlCausal.js +107 -0
  51. package/dist/observability/emitCausalFixture.d.ts +25 -0
  52. package/dist/observability/emitCausalFixture.d.ts.map +1 -0
  53. package/dist/observability/emitCausalFixture.js +98 -0
  54. package/dist/observability/index.d.ts +2 -0
  55. package/dist/observability/index.d.ts.map +1 -1
  56. package/dist/observability/index.js +2 -0
  57. package/dist/observability/orgObserver.d.ts.map +1 -1
  58. package/dist/observability/orgObserver.js +3 -3
  59. package/dist/pi/agyHeadlessResult.d.ts +60 -0
  60. package/dist/pi/agyHeadlessResult.d.ts.map +1 -0
  61. package/dist/pi/agyHeadlessResult.js +95 -0
  62. package/dist/pi/cliChildOutput.d.ts +67 -0
  63. package/dist/pi/cliChildOutput.d.ts.map +1 -0
  64. package/dist/pi/cliChildOutput.js +269 -0
  65. package/dist/pi/cliEngineRun.d.ts +16 -0
  66. package/dist/pi/cliEngineRun.d.ts.map +1 -0
  67. package/dist/pi/cliEngineRun.js +27 -0
  68. package/dist/pi/cliEngineSpawn.d.ts +55 -0
  69. package/dist/pi/cliEngineSpawn.d.ts.map +1 -0
  70. package/dist/pi/cliEngineSpawn.js +164 -0
  71. package/dist/pi/cliEnvironment.d.ts +12 -0
  72. package/dist/pi/cliEnvironment.d.ts.map +1 -0
  73. package/dist/pi/cliEnvironment.js +32 -0
  74. package/dist/pi/cliMcpRegistration.d.ts +61 -0
  75. package/dist/pi/cliMcpRegistration.d.ts.map +1 -0
  76. package/dist/pi/cliMcpRegistration.js +75 -0
  77. package/dist/pi/cliProcess.d.ts +7 -0
  78. package/dist/pi/cliProcess.d.ts.map +1 -0
  79. package/dist/pi/cliProcess.js +132 -0
  80. package/dist/pi/cliSession.d.ts +106 -0
  81. package/dist/pi/cliSession.d.ts.map +1 -0
  82. package/dist/pi/cliSession.js +379 -0
  83. package/dist/pi/cliTurnMetering.d.ts +60 -0
  84. package/dist/pi/cliTurnMetering.d.ts.map +1 -0
  85. package/dist/pi/cliTurnMetering.js +60 -0
  86. package/dist/pi/codexFilesystemRules.d.ts +3 -0
  87. package/dist/pi/codexFilesystemRules.d.ts.map +1 -0
  88. package/dist/pi/codexFilesystemRules.js +28 -0
  89. package/dist/pi/codexHeadlessResult.d.ts +68 -0
  90. package/dist/pi/codexHeadlessResult.d.ts.map +1 -0
  91. package/dist/pi/codexHeadlessResult.js +122 -0
  92. package/dist/pi/codexRolloutUsage.d.ts +95 -0
  93. package/dist/pi/codexRolloutUsage.d.ts.map +1 -0
  94. package/dist/pi/codexRolloutUsage.js +221 -0
  95. package/dist/pi/engineWakeLimits.d.ts +39 -0
  96. package/dist/pi/engineWakeLimits.d.ts.map +1 -0
  97. package/dist/pi/engineWakeLimits.js +55 -0
  98. package/dist/pi/grokHeadlessResult.d.ts +36 -0
  99. package/dist/pi/grokHeadlessResult.d.ts.map +1 -0
  100. package/dist/pi/grokHeadlessResult.js +118 -0
  101. package/dist/pi/grokHomeMcpRegistration.d.ts +21 -0
  102. package/dist/pi/grokHomeMcpRegistration.d.ts.map +1 -0
  103. package/dist/pi/grokHomeMcpRegistration.js +57 -0
  104. package/dist/pi/grokSandbox.d.ts +11 -0
  105. package/dist/pi/grokSandbox.d.ts.map +1 -0
  106. package/dist/pi/grokSandbox.js +216 -0
  107. package/dist/pi/grokStreamUsage.d.ts +31 -0
  108. package/dist/pi/grokStreamUsage.d.ts.map +1 -0
  109. package/dist/pi/grokStreamUsage.js +51 -0
  110. package/dist/pi/index.d.ts +5 -0
  111. package/dist/pi/index.d.ts.map +1 -1
  112. package/dist/pi/index.js +5 -0
  113. package/dist/pi/memoryTools.d.ts +55 -1
  114. package/dist/pi/memoryTools.d.ts.map +1 -1
  115. package/dist/pi/memoryTools.js +144 -24
  116. package/dist/pi/modelRegistry.d.ts +13 -0
  117. package/dist/pi/modelRegistry.d.ts.map +1 -0
  118. package/dist/pi/modelRegistry.js +19 -0
  119. package/dist/pi/piAgentHandle.d.ts +46 -0
  120. package/dist/pi/piAgentHandle.d.ts.map +1 -0
  121. package/dist/pi/piAgentHandle.js +351 -0
  122. package/dist/pi/piAgentWakeSupport.d.ts +103 -0
  123. package/dist/pi/piAgentWakeSupport.d.ts.map +1 -0
  124. package/dist/pi/piAgentWakeSupport.js +151 -0
  125. package/dist/pi/piHarness.d.ts +40 -5
  126. package/dist/pi/piHarness.d.ts.map +1 -1
  127. package/dist/pi/piHarness.js +151 -256
  128. package/dist/pi/prompts.d.ts +10 -0
  129. package/dist/pi/prompts.d.ts.map +1 -0
  130. package/dist/pi/prompts.js +63 -0
  131. package/dist/pi/rawTrainingCapture.d.ts +59 -0
  132. package/dist/pi/rawTrainingCapture.d.ts.map +1 -0
  133. package/dist/pi/rawTrainingCapture.js +175 -0
  134. package/dist/pi/turnCausal.d.ts +73 -0
  135. package/dist/pi/turnCausal.d.ts.map +1 -0
  136. package/dist/pi/turnCausal.js +75 -0
  137. package/dist/pi/turnTrace.d.ts +128 -0
  138. package/dist/pi/turnTrace.d.ts.map +1 -0
  139. package/dist/pi/turnTrace.js +138 -0
  140. package/dist/pi/wakeAcceptance.d.ts +49 -0
  141. package/dist/pi/wakeAcceptance.d.ts.map +1 -0
  142. package/dist/pi/wakeAcceptance.js +281 -0
  143. package/dist/pi/wakeAcceptanceFs.d.ts +44 -0
  144. package/dist/pi/wakeAcceptanceFs.d.ts.map +1 -0
  145. package/dist/pi/wakeAcceptanceFs.js +318 -0
  146. package/dist/pi/wakeAcceptanceSchema.d.ts +75 -0
  147. package/dist/pi/wakeAcceptanceSchema.d.ts.map +1 -0
  148. package/dist/pi/wakeAcceptanceSchema.js +265 -0
  149. package/dist/pi/wakeModes.d.ts +9 -0
  150. package/dist/pi/wakeModes.d.ts.map +1 -0
  151. package/dist/pi/wakeModes.js +19 -0
  152. package/dist/pi/worldNudge.d.ts +22 -0
  153. package/dist/pi/worldNudge.d.ts.map +1 -0
  154. package/dist/pi/worldNudge.js +62 -0
  155. package/dist/pi/worldToolProtocol.d.ts +13 -0
  156. package/dist/pi/worldToolProtocol.d.ts.map +1 -0
  157. package/dist/pi/worldToolProtocol.js +49 -0
  158. package/dist/pi/worldTools.d.ts +32 -0
  159. package/dist/pi/worldTools.d.ts.map +1 -0
  160. package/dist/pi/worldTools.js +373 -0
  161. package/dist/pi/worldTrajectory.d.ts +52 -0
  162. package/dist/pi/worldTrajectory.d.ts.map +1 -0
  163. package/dist/pi/worldTrajectory.js +131 -0
  164. package/dist/runtime/agySubscriptionBootstrap.d.ts +16 -0
  165. package/dist/runtime/agySubscriptionBootstrap.d.ts.map +1 -0
  166. package/dist/runtime/agySubscriptionBootstrap.js +80 -0
  167. package/dist/runtime/agySubscriptionRealm.d.ts +38 -0
  168. package/dist/runtime/agySubscriptionRealm.d.ts.map +1 -0
  169. package/dist/runtime/agySubscriptionRealm.js +242 -0
  170. package/dist/runtime/attention.d.ts +21 -0
  171. package/dist/runtime/attention.d.ts.map +1 -0
  172. package/dist/runtime/attention.js +36 -0
  173. package/dist/runtime/attentionDispatcher.d.ts +66 -0
  174. package/dist/runtime/attentionDispatcher.d.ts.map +1 -0
  175. package/dist/runtime/attentionDispatcher.js +271 -0
  176. package/dist/runtime/cli.d.ts +7 -0
  177. package/dist/runtime/cli.d.ts.map +1 -0
  178. package/dist/runtime/cli.js +251 -0
  179. package/dist/runtime/codexSandboxProjection.d.ts +17 -0
  180. package/dist/runtime/codexSandboxProjection.d.ts.map +1 -0
  181. package/dist/runtime/codexSandboxProjection.js +40 -0
  182. package/dist/runtime/contract-manifest.json +1 -0
  183. package/dist/runtime/contract-manifest.sha256 +1 -0
  184. package/dist/runtime/contractManifest.d.ts +8 -0
  185. package/dist/runtime/contractManifest.d.ts.map +1 -0
  186. package/dist/runtime/contractManifest.js +4 -0
  187. package/dist/runtime/engineBrokerCapabilities.d.ts +30 -0
  188. package/dist/runtime/engineBrokerCapabilities.d.ts.map +1 -0
  189. package/dist/runtime/engineBrokerCapabilities.js +59 -0
  190. package/dist/runtime/engineBrokerControlClient.d.ts +44 -0
  191. package/dist/runtime/engineBrokerControlClient.d.ts.map +1 -0
  192. package/dist/runtime/engineBrokerControlClient.js +132 -0
  193. package/dist/runtime/engineBrokerCredentialJournal.d.ts +10 -0
  194. package/dist/runtime/engineBrokerCredentialJournal.d.ts.map +1 -0
  195. package/dist/runtime/engineBrokerCredentialJournal.js +17 -0
  196. package/dist/runtime/engineBrokerInferenceProtocol.d.ts +52 -0
  197. package/dist/runtime/engineBrokerInferenceProtocol.d.ts.map +1 -0
  198. package/dist/runtime/engineBrokerInferenceProtocol.js +65 -0
  199. package/dist/runtime/engineBrokerMcpCallLog.d.ts +160 -0
  200. package/dist/runtime/engineBrokerMcpCallLog.d.ts.map +1 -0
  201. package/dist/runtime/engineBrokerMcpCallLog.js +219 -0
  202. package/dist/runtime/engineBrokerMcpFacade.d.ts +56 -0
  203. package/dist/runtime/engineBrokerMcpFacade.d.ts.map +1 -0
  204. package/dist/runtime/engineBrokerMcpFacade.js +343 -0
  205. package/dist/runtime/engineBrokerNativeClient.d.ts +52 -0
  206. package/dist/runtime/engineBrokerNativeClient.d.ts.map +1 -0
  207. package/dist/runtime/engineBrokerNativeClient.js +151 -0
  208. package/dist/runtime/engineBrokerProtocol.d.ts +135 -0
  209. package/dist/runtime/engineBrokerProtocol.d.ts.map +1 -0
  210. package/dist/runtime/engineBrokerProtocol.js +274 -0
  211. package/dist/runtime/engineBrokerSealLedger.d.ts +70 -0
  212. package/dist/runtime/engineBrokerSealLedger.d.ts.map +1 -0
  213. package/dist/runtime/engineBrokerSealLedger.js +123 -0
  214. package/dist/runtime/engineBrokerService.d.ts +37 -0
  215. package/dist/runtime/engineBrokerService.d.ts.map +1 -0
  216. package/dist/runtime/engineBrokerService.js +138 -0
  217. package/dist/runtime/engineBrokerServiceCli.d.ts +5 -0
  218. package/dist/runtime/engineBrokerServiceCli.d.ts.map +1 -0
  219. package/dist/runtime/engineBrokerServiceCli.js +32 -0
  220. package/dist/runtime/engineBrokerServiceConfig.d.ts +50 -0
  221. package/dist/runtime/engineBrokerServiceConfig.d.ts.map +1 -0
  222. package/dist/runtime/engineBrokerServiceConfig.js +92 -0
  223. package/dist/runtime/engineBrokerSingleflight.d.ts +13 -0
  224. package/dist/runtime/engineBrokerSingleflight.d.ts.map +1 -0
  225. package/dist/runtime/engineBrokerSingleflight.js +24 -0
  226. package/dist/runtime/engineBrokerTurnAccounting.d.ts +76 -0
  227. package/dist/runtime/engineBrokerTurnAccounting.d.ts.map +1 -0
  228. package/dist/runtime/engineBrokerTurnAccounting.js +108 -0
  229. package/dist/runtime/engineBrokerTurnRegistry.d.ts +57 -0
  230. package/dist/runtime/engineBrokerTurnRegistry.d.ts.map +1 -0
  231. package/dist/runtime/engineBrokerTurnRegistry.js +158 -0
  232. package/dist/runtime/engineDispatcher.d.ts +36 -0
  233. package/dist/runtime/engineDispatcher.d.ts.map +1 -0
  234. package/dist/runtime/engineDispatcher.js +216 -0
  235. package/dist/runtime/engineReadiness.d.ts +23 -0
  236. package/dist/runtime/engineReadiness.d.ts.map +1 -0
  237. package/dist/runtime/engineReadiness.js +222 -0
  238. package/dist/runtime/grokAuthenticationError.d.ts +8 -0
  239. package/dist/runtime/grokAuthenticationError.d.ts.map +1 -0
  240. package/dist/runtime/grokAuthenticationError.js +20 -0
  241. package/dist/runtime/grokBrokerCredentialAuthority.d.ts +22 -0
  242. package/dist/runtime/grokBrokerCredentialAuthority.d.ts.map +1 -0
  243. package/dist/runtime/grokBrokerCredentialAuthority.js +124 -0
  244. package/dist/runtime/grokBrokerCredentialReader.d.ts +5 -0
  245. package/dist/runtime/grokBrokerCredentialReader.d.ts.map +1 -0
  246. package/dist/runtime/grokBrokerCredentialReader.js +37 -0
  247. package/dist/runtime/grokBrokerModelPolicy.d.ts +23 -0
  248. package/dist/runtime/grokBrokerModelPolicy.d.ts.map +1 -0
  249. package/dist/runtime/grokBrokerModelPolicy.js +28 -0
  250. package/dist/runtime/grokBrokerProjection.d.ts +106 -0
  251. package/dist/runtime/grokBrokerProjection.d.ts.map +1 -0
  252. package/dist/runtime/grokBrokerProjection.js +94 -0
  253. package/dist/runtime/grokBrokerProxy.d.ts +55 -0
  254. package/dist/runtime/grokBrokerProxy.d.ts.map +1 -0
  255. package/dist/runtime/grokBrokerProxy.js +262 -0
  256. package/dist/runtime/grokBrokerProxyRequest.d.ts +30 -0
  257. package/dist/runtime/grokBrokerProxyRequest.d.ts.map +1 -0
  258. package/dist/runtime/grokBrokerProxyRequest.js +74 -0
  259. package/dist/runtime/grokBrokerRealmLease.d.ts +4 -0
  260. package/dist/runtime/grokBrokerRealmLease.d.ts.map +1 -0
  261. package/dist/runtime/grokBrokerRealmLease.js +33 -0
  262. package/dist/runtime/grokBrokerRefresh.d.ts +2 -0
  263. package/dist/runtime/grokBrokerRefresh.d.ts.map +1 -0
  264. package/dist/runtime/grokBrokerRefresh.js +15 -0
  265. package/dist/runtime/grokBrokerTurnMeter.d.ts +128 -0
  266. package/dist/runtime/grokBrokerTurnMeter.d.ts.map +1 -0
  267. package/dist/runtime/grokBrokerTurnMeter.js +251 -0
  268. package/dist/runtime/grokBrokerWorkerConfig.d.ts +86 -0
  269. package/dist/runtime/grokBrokerWorkerConfig.d.ts.map +1 -0
  270. package/dist/runtime/grokBrokerWorkerConfig.js +135 -0
  271. package/dist/runtime/grokEngineBroker.d.ts +48 -0
  272. package/dist/runtime/grokEngineBroker.d.ts.map +1 -0
  273. package/dist/runtime/grokEngineBroker.js +114 -0
  274. package/dist/runtime/grokEngineBrokerLedger.d.ts +52 -0
  275. package/dist/runtime/grokEngineBrokerLedger.d.ts.map +1 -0
  276. package/dist/runtime/grokEngineBrokerLedger.js +114 -0
  277. package/dist/runtime/grokEngineBrokerMetering.d.ts +51 -0
  278. package/dist/runtime/grokEngineBrokerMetering.d.ts.map +1 -0
  279. package/dist/runtime/grokEngineBrokerMetering.js +34 -0
  280. package/dist/runtime/grokEngineBrokerTurn.d.ts +58 -0
  281. package/dist/runtime/grokEngineBrokerTurn.d.ts.map +1 -0
  282. package/dist/runtime/grokEngineBrokerTurn.js +165 -0
  283. package/dist/runtime/grokInferenceClientConfig.d.ts +41 -0
  284. package/dist/runtime/grokInferenceClientConfig.d.ts.map +1 -0
  285. package/dist/runtime/grokInferenceClientConfig.js +62 -0
  286. package/dist/runtime/grokInferenceGrants.d.ts +77 -0
  287. package/dist/runtime/grokInferenceGrants.d.ts.map +1 -0
  288. package/dist/runtime/grokInferenceGrants.js +116 -0
  289. package/dist/runtime/grokInferenceProxy.d.ts +29 -0
  290. package/dist/runtime/grokInferenceProxy.d.ts.map +1 -0
  291. package/dist/runtime/grokInferenceProxy.js +82 -0
  292. package/dist/runtime/grokInferenceProxyRequest.d.ts +23 -0
  293. package/dist/runtime/grokInferenceProxyRequest.d.ts.map +1 -0
  294. package/dist/runtime/grokInferenceProxyRequest.js +63 -0
  295. package/dist/runtime/grokSlotPreflightReceipt.d.ts +70 -0
  296. package/dist/runtime/grokSlotPreflightReceipt.d.ts.map +1 -0
  297. package/dist/runtime/grokSlotPreflightReceipt.js +101 -0
  298. package/dist/runtime/grokSubscriptionRealm.d.ts +4 -0
  299. package/dist/runtime/grokSubscriptionRealm.d.ts.map +1 -0
  300. package/dist/runtime/grokSubscriptionRealm.js +435 -0
  301. package/dist/runtime/grokSubscriptionRealmTypes.d.ts +26 -0
  302. package/dist/runtime/grokSubscriptionRealmTypes.d.ts.map +1 -0
  303. package/dist/runtime/grokSubscriptionRealmTypes.js +1 -0
  304. package/dist/runtime/grokWorkerAttestation.d.ts +170 -0
  305. package/dist/runtime/grokWorkerAttestation.d.ts.map +1 -0
  306. package/dist/runtime/grokWorkerAttestation.js +266 -0
  307. package/dist/runtime/grokWorkerDenyPlacement.d.ts +80 -0
  308. package/dist/runtime/grokWorkerDenyPlacement.d.ts.map +1 -0
  309. package/dist/runtime/grokWorkerDenyPlacement.js +128 -0
  310. package/dist/runtime/grokWorkerHomeAttestation.d.ts +30 -0
  311. package/dist/runtime/grokWorkerHomeAttestation.d.ts.map +1 -0
  312. package/dist/runtime/grokWorkerHomeAttestation.js +69 -0
  313. package/dist/runtime/grokWorkerSandboxProfile.d.ts +27 -0
  314. package/dist/runtime/grokWorkerSandboxProfile.d.ts.map +1 -0
  315. package/dist/runtime/grokWorkerSandboxProfile.js +44 -0
  316. package/dist/runtime/grokWorkerTmpAttestation.d.ts +55 -0
  317. package/dist/runtime/grokWorkerTmpAttestation.d.ts.map +1 -0
  318. package/dist/runtime/grokWorkerTmpAttestation.js +63 -0
  319. package/dist/runtime/index.d.ts +26 -0
  320. package/dist/runtime/index.d.ts.map +1 -0
  321. package/dist/runtime/index.js +23 -0
  322. package/dist/runtime/inferenceUsageLedger.d.ts +38 -0
  323. package/dist/runtime/inferenceUsageLedger.d.ts.map +1 -0
  324. package/dist/runtime/inferenceUsageLedger.js +53 -0
  325. package/dist/runtime/mcpToolResult.d.ts +127 -0
  326. package/dist/runtime/mcpToolResult.d.ts.map +1 -0
  327. package/dist/runtime/mcpToolResult.js +214 -0
  328. package/dist/runtime/moltnetMachineRead.d.ts +97 -0
  329. package/dist/runtime/moltnetMachineRead.d.ts.map +1 -0
  330. package/dist/runtime/moltnetMachineRead.js +183 -0
  331. package/dist/runtime/native/daimon-engine-broker +0 -0
  332. package/dist/runtime/organizationRuntime.d.ts +165 -0
  333. package/dist/runtime/organizationRuntime.d.ts.map +1 -0
  334. package/dist/runtime/organizationRuntime.js +3 -0
  335. package/dist/runtime/organizationRuntimeControl.d.ts +42 -0
  336. package/dist/runtime/organizationRuntimeControl.d.ts.map +1 -0
  337. package/dist/runtime/organizationRuntimeControl.js +235 -0
  338. package/dist/runtime/organizationRuntimeHost.d.ts +19 -0
  339. package/dist/runtime/organizationRuntimeHost.d.ts.map +1 -0
  340. package/dist/runtime/organizationRuntimeHost.js +359 -0
  341. package/dist/runtime/organizationRuntimeParsing.d.ts +6 -0
  342. package/dist/runtime/organizationRuntimeParsing.d.ts.map +1 -0
  343. package/dist/runtime/organizationRuntimeParsing.js +370 -0
  344. package/dist/runtime/organizationRuntimeReadiness.d.ts +12 -0
  345. package/dist/runtime/organizationRuntimeReadiness.d.ts.map +1 -0
  346. package/dist/runtime/organizationRuntimeReadiness.js +59 -0
  347. package/dist/runtime/physicalReadiness.d.ts +47 -0
  348. package/dist/runtime/physicalReadiness.d.ts.map +1 -0
  349. package/dist/runtime/physicalReadiness.js +142 -0
  350. package/dist/runtime/portableCredentialAuth.d.ts +6 -0
  351. package/dist/runtime/portableCredentialAuth.d.ts.map +1 -0
  352. package/dist/runtime/portableCredentialAuth.js +70 -0
  353. package/dist/runtime/portableCredentialMaterial.d.ts +8 -0
  354. package/dist/runtime/portableCredentialMaterial.d.ts.map +1 -0
  355. package/dist/runtime/portableCredentialMaterial.js +169 -0
  356. package/dist/runtime/productionAgentTools.d.ts +5 -0
  357. package/dist/runtime/productionAgentTools.d.ts.map +1 -0
  358. package/dist/runtime/productionAgentTools.js +328 -0
  359. package/dist/runtime/runtimeHomeLayout.d.ts +48 -0
  360. package/dist/runtime/runtimeHomeLayout.d.ts.map +1 -0
  361. package/dist/runtime/runtimeHomeLayout.js +84 -0
  362. package/dist/runtime/schedule.d.ts +40 -0
  363. package/dist/runtime/schedule.d.ts.map +1 -0
  364. package/dist/runtime/schedule.js +371 -0
  365. package/dist/runtime/storeCoordination.d.ts +23 -0
  366. package/dist/runtime/storeCoordination.d.ts.map +1 -0
  367. package/dist/runtime/storeCoordination.js +94 -0
  368. package/dist/runtime/toolResultSpill.d.ts +152 -0
  369. package/dist/runtime/toolResultSpill.d.ts.map +1 -0
  370. package/dist/runtime/toolResultSpill.js +351 -0
  371. package/dist/runtime/turnRequestLedger.d.ts +160 -0
  372. package/dist/runtime/turnRequestLedger.d.ts.map +1 -0
  373. package/dist/runtime/turnRequestLedger.js +249 -0
  374. package/dist/runtime/turnUsageLedger.d.ts +143 -0
  375. package/dist/runtime/turnUsageLedger.d.ts.map +1 -0
  376. package/dist/runtime/turnUsageLedger.js +203 -0
  377. package/dist/runtime/wakeAcceptanceProcessIdentity.d.ts +17 -0
  378. package/dist/runtime/wakeAcceptanceProcessIdentity.d.ts.map +1 -0
  379. package/dist/runtime/wakeAcceptanceProcessIdentity.js +50 -0
  380. package/dist/runtime/wakeAcceptanceReconciliation.d.ts +211 -0
  381. package/dist/runtime/wakeAcceptanceReconciliation.d.ts.map +1 -0
  382. package/dist/runtime/wakeAcceptanceReconciliation.js +289 -0
  383. package/dist/runtime/wakeAcceptanceRecord.d.ts +23 -0
  384. package/dist/runtime/wakeAcceptanceRecord.d.ts.map +1 -0
  385. package/dist/runtime/wakeAcceptanceRecord.js +56 -0
  386. package/dist/runtime/wakeAcceptanceRetention.d.ts +12 -0
  387. package/dist/runtime/wakeAcceptanceRetention.d.ts.map +1 -0
  388. package/dist/runtime/wakeAcceptanceRetention.js +12 -0
  389. package/dist/runtime/wakeAcceptanceStore.d.ts +113 -0
  390. package/dist/runtime/wakeAcceptanceStore.d.ts.map +1 -0
  391. package/dist/runtime/wakeAcceptanceStore.js +558 -0
  392. package/dist/runtime/wakeAcceptanceTypes.d.ts +179 -0
  393. package/dist/runtime/wakeAcceptanceTypes.d.ts.map +1 -0
  394. package/dist/runtime/wakeAcceptanceTypes.js +95 -0
  395. package/dist/runtime/wakeFuse.d.ts +69 -0
  396. package/dist/runtime/wakeFuse.d.ts.map +1 -0
  397. package/dist/runtime/wakeFuse.js +367 -0
  398. package/package.json +25 -17
  399. package/dist/examples/mixed-engine-org.d.ts +0 -2
  400. package/dist/examples/mixed-engine-org.d.ts.map +0 -1
  401. package/dist/examples/mixed-engine-org.js +0 -351
  402. package/dist/examples/mixedEngineCli.d.ts +0 -15
  403. package/dist/examples/mixedEngineCli.d.ts.map +0 -1
  404. package/dist/examples/mixedEngineCli.js +0 -174
@@ -0,0 +1,103 @@
1
+ import type { createAgentSession } from "@earendil-works/pi-coding-agent";
2
+ import type { WakeMemoryContext, MemoryWakeMode } from "@noopolis/mneme";
3
+ import type { WakeEvent, WakeResult } from "../core/types.js";
4
+ import { type PiRawTrainingCapture, type PiRawTrainingCaptureOptions } from "./rawTrainingCapture.js";
5
+ import { type PiTurnTraceModel, type PiTurnTraceToolEvent } from "./turnTrace.js";
6
+ import type { PiWorldTurnContext } from "./worldNudge.js";
7
+ import { type WakeAcceptanceCapability, type WakeAcceptanceStoreLike } from "./wakeAcceptance.js";
8
+ import { type PiWorldTrajectoryCapture, type PiWorldTrajectoryIdentity } from "./worldTrajectory.js";
9
+ export type PiSession = Awaited<ReturnType<typeof createAgentSession>>["session"];
10
+ export interface PiSessionLike {
11
+ subscribe(listener: Parameters<PiSession["subscribe"]>[0]): () => void;
12
+ prompt(text: string, options?: Parameters<PiSession["prompt"]>[1]): Promise<void>;
13
+ /** Optional per-turn context for isolated CLI child environments. */
14
+ bindWake?(event?: WakeEvent): void;
15
+ /** Kept synchronous for existing Pi session implementations. */
16
+ dispose(): void;
17
+ /** Optional additive hook for sessions that must asynchronously quiesce children. */
18
+ disposeAsync?(): Promise<void>;
19
+ }
20
+ export type PiWakeEnvironmentContextRef = {
21
+ current?: string;
22
+ /**
23
+ * Set to the delivery id of the current wake once `moltnet_send` has been
24
+ * accepted during it. Bookkeeping only: it no longer gates whether the wake
25
+ * completion path publishes terminal text (see `hasSendCapability`), but it
26
+ * still records, per wake, whether this agent actually spoke. Never a
27
+ * boolean: a boolean could survive a stale reset and silently misattribute
28
+ * a later wake.
29
+ */
30
+ spokeFor?: string;
31
+ /**
32
+ * Set once per agent, at harness construction, to whether a `moltnet_send`
33
+ * tool is mounted for it (`piHarness.ts`, from `productionTools`) — never
34
+ * reset per wake, unlike `current`/`spokeFor`.
35
+ *
36
+ * A turn that fails partway (a tool error the model narrates back as
37
+ * terminal text, e.g. "Blocked: Moltnet auth is not mounted...") still
38
+ * completes structurally and used to publish that narration through the
39
+ * terminal-text fallback even though `moltnet_send` was never actually
40
+ * called — a second, unintended echo into the room. An agent with a
41
+ * mounted send tool has exactly one legitimate publication channel
42
+ * (`moltnet_send`); its terminal text is always a private note to the
43
+ * runtime, whether it spoke, stayed silent, or failed. Only an agent with
44
+ * no send tool at all keeps the documented terminal-text fallback
45
+ * (`moltnet/internal/bridge/daimon/AGENTS.md`).
46
+ */
47
+ hasSendCapability?: boolean;
48
+ };
49
+ export declare function disposePiSession(session: PiSessionLike): Promise<void>;
50
+ export type PiSessionCreator = (mode: MemoryWakeMode, sessionDirectory: string) => Promise<PiSessionLike>;
51
+ export type PiNativeSessionCreator = (mode: MemoryWakeMode, sessionDirectory: string) => Promise<PiSession>;
52
+ export interface WakeSessionSelection {
53
+ disposeAfterWake: boolean;
54
+ mode: MemoryWakeMode;
55
+ session: PiSessionLike;
56
+ threadId: string;
57
+ }
58
+ type WakeRunner = (event: WakeEvent, transitionToInvoking?: () => Promise<WakeAcceptanceCapability>) => Promise<WakeResult>;
59
+ export declare class PiWakeDeliveryQueue {
60
+ private readonly agentId;
61
+ private readonly acceptance;
62
+ private queue;
63
+ private readonly inProgress;
64
+ constructor(agentId: string, acceptance: WakeAcceptanceStoreLike);
65
+ wake(event: WakeEvent, run: WakeRunner): Promise<WakeResult>;
66
+ private enqueue;
67
+ private runDelivery;
68
+ }
69
+ export declare const cloneWakeEvent: (event: WakeEvent) => WakeEvent;
70
+ export declare const selectPiSessionForWake: (input: {
71
+ agentId: string;
72
+ createSession: PiSessionCreator;
73
+ event: WakeEvent;
74
+ memoryContext: WakeMemoryContext;
75
+ runtimeHomePath: string;
76
+ session: PiSessionLike;
77
+ }) => Promise<WakeSessionSelection>;
78
+ export declare const subscribeToPiTurnEvents: (input: {
79
+ chunks: string[];
80
+ rawTrainingCapture?: PiRawTrainingCapture;
81
+ session: PiSessionLike;
82
+ tools: PiTurnTraceToolEvent[];
83
+ worldTrajectory?: PiWorldTrajectoryCapture;
84
+ }) => (() => void);
85
+ export declare const persistPiTurnArtifacts: (input: {
86
+ agentId: string;
87
+ completedAt: Date;
88
+ model: PiTurnTraceModel;
89
+ piSessionForRawCapture?: PiSession;
90
+ promptText: string;
91
+ rawTrainingCapture?: PiRawTrainingCapture;
92
+ rawTrainingCaptureOptions?: PiRawTrainingCaptureOptions;
93
+ runtimeHomePath: string;
94
+ startedAt: Date;
95
+ status: "completed" | "failed";
96
+ totalMs: number;
97
+ turnId: string;
98
+ worldContext?: PiWorldTurnContext;
99
+ worldTrajectory?: PiWorldTrajectoryCapture;
100
+ worldTrajectoryIdentity?: PiWorldTrajectoryIdentity;
101
+ }) => Promise<void>;
102
+ export {};
103
+ //# sourceMappingURL=piAgentWakeSupport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"piAgentWakeSupport.d.ts","sourceRoot":"","sources":["../../src/pi/piAgentWakeSupport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,gBAAg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MAAM,EAAE,CAAC;IACjB,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAC1C,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,wBAAwB,CAAC;CAC5C,KAAG,CAAC,MAAM,IAAI,CAkBd,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAU,OAAO;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,IAAI,CAAC;IAClB,KAAK,EAAE,gBAAgB,CAAC;IACxB,sBAAsB,CAAC,EAAE,SAAS,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAC1C,yBAAyB,CAAC,EAAE,2BAA2B,CAAC;IACxD,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,eAAe,CAAC,EAAE,wBAAwB,CAAC;IAC3C,uBAAuB,CAAC,EAAE,yBAAyB,CAAC;CACrD,KAAG,OAAO,CAAC,IAAI,CAqCf,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { capturePiRawTrainingEvent, persistPiRawTrainingCapture, } from "./rawTrainingCapture.js";
2
+ import { summarizeSessionEvent, } from "./turnTrace.js";
3
+ import { createAwakeThreadId, createDreamSessionDirectory, createDreamSessionKey, createDreamThreadId, } from "./wakeModes.js";
4
+ import { WakeAcceptanceError, } from "./wakeAcceptance.js";
5
+ import { capturePiWorldTrajectoryEvent, persistPiWorldTrajectory, } from "./worldTrajectory.js";
6
+ export async function disposePiSession(session) {
7
+ await Promise.resolve(session.dispose());
8
+ await session.disposeAsync?.();
9
+ }
10
+ export class PiWakeDeliveryQueue {
11
+ agentId;
12
+ acceptance;
13
+ queue = Promise.resolve();
14
+ inProgress = new Map();
15
+ constructor(agentId, acceptance) {
16
+ this.agentId = agentId;
17
+ this.acceptance = acceptance;
18
+ }
19
+ async wake(event, run) {
20
+ const candidate = event.delivery === undefined
21
+ ? undefined
22
+ : this.acceptance.candidateFromDelivery(event);
23
+ if (candidate === undefined)
24
+ return this.enqueue(() => run(event));
25
+ const active = this.inProgress.get(candidate.identity);
26
+ if (active !== undefined) {
27
+ if (active.digest !== candidate.digest) {
28
+ throw new WakeAcceptanceError("wake_delivery_conflict");
29
+ }
30
+ return active.promise;
31
+ }
32
+ const queued = this.enqueue(() => this.runDelivery(event, run));
33
+ const promise = queued.finally(() => {
34
+ if (this.inProgress.get(candidate.identity)?.promise === promise) {
35
+ this.inProgress.delete(candidate.identity);
36
+ }
37
+ });
38
+ this.inProgress.set(candidate.identity, { digest: candidate.digest, promise });
39
+ return promise;
40
+ }
41
+ enqueue(run) {
42
+ const queued = this.queue.then(run, run);
43
+ this.queue = queued.then(() => undefined, () => undefined);
44
+ return queued;
45
+ }
46
+ async runDelivery(event, run) {
47
+ const admission = await this.acceptance.begin(event);
48
+ if (admission.mode === "replay") {
49
+ return { agentId: this.agentId, text: "", durationMs: 0 };
50
+ }
51
+ let capability = admission.capability;
52
+ try {
53
+ const result = await run(event, async () => {
54
+ capability = await this.acceptance.markInvoking(capability);
55
+ return capability;
56
+ });
57
+ await this.acceptance.markCompleted(capability);
58
+ return result;
59
+ }
60
+ catch (error) {
61
+ await this.acceptance.markIncomplete(capability).catch(() => undefined);
62
+ throw error;
63
+ }
64
+ }
65
+ }
66
+ const cloneContext = (context) => ({
67
+ ...context,
68
+ ...(context?.pairPeers === undefined ? {} : { pairPeers: [...context.pairPeers] }),
69
+ ...(context?.artifactPaths === undefined ? {} : { artifactPaths: [...context.artifactPaths] }),
70
+ });
71
+ export const cloneWakeEvent = (event) => ({
72
+ ...event,
73
+ ...(event.delivery === undefined ? {} : { delivery: { ...event.delivery } }),
74
+ ...(event.context === undefined ? {} : { context: cloneContext(event.context) }),
75
+ });
76
+ export const selectPiSessionForWake = async (input) => {
77
+ if (input.event.kind !== "dream") {
78
+ return {
79
+ disposeAfterWake: false,
80
+ mode: "awake",
81
+ session: input.session,
82
+ threadId: createAwakeThreadId(input.memoryContext, input.agentId),
83
+ };
84
+ }
85
+ const sessionKey = createDreamSessionKey(input.event);
86
+ return {
87
+ disposeAfterWake: true,
88
+ mode: "dream",
89
+ session: await input.createSession("dream", createDreamSessionDirectory(input.runtimeHomePath, sessionKey)),
90
+ threadId: createDreamThreadId(sessionKey),
91
+ };
92
+ };
93
+ export const subscribeToPiTurnEvents = (input) => {
94
+ const unsubscribe = input.session.subscribe((event) => {
95
+ if (input.rawTrainingCapture !== undefined) {
96
+ capturePiRawTrainingEvent(input.rawTrainingCapture, event);
97
+ }
98
+ if (input.worldTrajectory !== undefined) {
99
+ capturePiWorldTrajectoryEvent(input.worldTrajectory, event);
100
+ }
101
+ const toolEvent = summarizeSessionEvent(event);
102
+ if (toolEvent !== undefined)
103
+ input.tools.push(toolEvent);
104
+ if (event.type !== "turn_end" || !("content" in event.message))
105
+ return;
106
+ const { content } = event.message;
107
+ input.chunks.push(typeof content === "string"
108
+ ? content
109
+ : content.filter((entry) => entry.type === "text")
110
+ .map((entry) => entry.text).join(""));
111
+ });
112
+ return unsubscribe;
113
+ };
114
+ export const persistPiTurnArtifacts = async (input) => {
115
+ if (input.rawTrainingCapture !== undefined
116
+ && input.rawTrainingCaptureOptions !== undefined
117
+ && input.piSessionForRawCapture !== undefined) {
118
+ await persistPiRawTrainingCapture({
119
+ agentId: input.agentId,
120
+ capture: input.rawTrainingCapture,
121
+ completedAt: input.completedAt,
122
+ options: input.rawTrainingCaptureOptions,
123
+ runtimeHomePath: input.runtimeHomePath,
124
+ session: input.piSessionForRawCapture,
125
+ startedAt: input.startedAt,
126
+ status: input.status,
127
+ totalMs: input.totalMs,
128
+ turnId: input.turnId,
129
+ world: input.worldContext,
130
+ });
131
+ }
132
+ if (input.worldContext !== undefined
133
+ && input.worldTrajectory !== undefined
134
+ && input.worldTrajectoryIdentity !== undefined) {
135
+ await persistPiWorldTrajectory({
136
+ agentId: input.agentId,
137
+ capture: input.worldTrajectory,
138
+ completedAt: input.completedAt,
139
+ context: input.worldContext,
140
+ instructions: input.worldTrajectoryIdentity.instructions,
141
+ model: input.model,
142
+ promptText: input.promptText,
143
+ runtimeHomePath: input.runtimeHomePath,
144
+ startedAt: input.startedAt,
145
+ status: input.status,
146
+ thinkingLevel: input.worldTrajectoryIdentity.thinkingLevel,
147
+ totalMs: input.totalMs,
148
+ turnId: input.turnId,
149
+ });
150
+ }
151
+ };
@@ -1,8 +1,17 @@
1
- import { createAgentSession } from "@earendil-works/pi-coding-agent";
1
+ import { createAgentSession, type ToolDefinition } from "@earendil-works/pi-coding-agent";
2
+ import { type MemoryAuthorityConfig } from "@noopolis/mneme";
2
3
  import type { AgentHandle, AgentHarnessAdapter, AgentStartInput, HarnessModelSpec } from "../core/types.js";
3
- export interface PiHarnessOptions {
4
+ import { type PiSessionLike } from "./piAgentHandle.js";
5
+ import { type PiWakeEnvironmentContextRef } from "./piAgentWakeSupport.js";
6
+ import { type PiWorldBinding } from "./worldTools.js";
7
+ import { type PiRawTrainingCaptureOptions } from "./rawTrainingCapture.js";
8
+ type HarnessMemoryEmbeddingProvider = {
9
+ dimensions?: number;
10
+ embed(text: string): Promise<number[]>;
11
+ };
12
+ export type PiThinkingLevel = NonNullable<NonNullable<Parameters<typeof createAgentSession>[0]>["thinkingLevel"]>;
13
+ type PiHarnessBaseOptions = {
4
14
  authPath: string;
5
- sessionFactory?: PiSessionFactory;
6
15
  model?: {
7
16
  auth?: HarnessModelSpec["auth"];
8
17
  endpoint?: HarnessModelSpec["endpoint"];
@@ -10,12 +19,37 @@ export interface PiHarnessOptions {
10
19
  name: string;
11
20
  };
12
21
  modelsPath?: string;
22
+ /** Host-only names removed from every engine and Pi bash child environment. */
23
+ protectedEnvironmentNames?: readonly string[];
13
24
  memory?: {
25
+ authority?: MemoryAuthorityConfig;
26
+ embeddingProvider?: HarnessMemoryEmbeddingProvider;
14
27
  source?: string;
15
28
  tokenBudget?: number;
29
+ runtimeHomePath?: string;
16
30
  };
17
- }
18
- export type PiSessionFactory = (input: Parameters<typeof createAgentSession>[0]) => ReturnType<typeof createAgentSession>;
31
+ thinkingLevel?: PiThinkingLevel;
32
+ world?: PiWorldBinding;
33
+ productionTools?: readonly ToolDefinition[];
34
+ /** Engine-owned default; an empty list disables Pi builtins for confined CLI engines. */
35
+ toolNames?: readonly string[];
36
+ wakeEnvironmentContext?: PiWakeEnvironmentContextRef;
37
+ };
38
+ export type PiHarnessOptions = PiHarnessBaseOptions & ({
39
+ rawTrainingCapture?: PiRawTrainingCaptureOptions;
40
+ sessionFactory?: never;
41
+ } | {
42
+ rawTrainingCapture?: never;
43
+ sessionFactory: PiSessionFactory;
44
+ });
45
+ export type PiSessionFactoryInput = Exclude<Parameters<typeof createAgentSession>[0], undefined> & {
46
+ daimonSecretEnvironmentNames?: readonly string[];
47
+ /** The isolated runtime home assigned by Daimon to this one agent. */
48
+ runtimeHomePath?: string;
49
+ };
50
+ export type PiSessionFactory = (input: PiSessionFactoryInput) => Promise<{
51
+ session: PiSessionLike;
52
+ }>;
19
53
  export declare class PiHarnessAdapter implements AgentHarnessAdapter {
20
54
  private readonly options;
21
55
  private readonly authStorage;
@@ -24,4 +58,5 @@ export declare class PiHarnessAdapter implements AgentHarnessAdapter {
24
58
  constructor(options: PiHarnessOptions);
25
59
  startAgent(input: AgentStartInput): Promise<AgentHandle>;
26
60
  }
61
+ export {};
27
62
  //# sourceMappingURL=piHarness.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"piHarness.d.ts","sourceRoot":"","sources":["../../src/pi/piHarness.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,kBAAkB,EAMnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,eAAe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