@methodts/runtime 0.1.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 (537) hide show
  1. package/dist/__fixtures__/executor-fixtures.d.ts +10 -0
  2. package/dist/__fixtures__/executor-fixtures.d.ts.map +1 -0
  3. package/dist/__fixtures__/executor-fixtures.js +36 -0
  4. package/dist/__fixtures__/executor-fixtures.js.map +1 -0
  5. package/dist/architecture.test.d.ts +2 -0
  6. package/dist/architecture.test.d.ts.map +1 -0
  7. package/dist/architecture.test.js +143 -0
  8. package/dist/architecture.test.js.map +1 -0
  9. package/dist/config/cost-governor-config.d.ts +40 -0
  10. package/dist/config/cost-governor-config.d.ts.map +1 -0
  11. package/dist/config/cost-governor-config.js +48 -0
  12. package/dist/config/cost-governor-config.js.map +1 -0
  13. package/dist/config/index.d.ts +7 -0
  14. package/dist/config/index.d.ts.map +1 -0
  15. package/dist/config/index.js +6 -0
  16. package/dist/config/index.js.map +1 -0
  17. package/dist/config/sessions-config.d.ts +29 -0
  18. package/dist/config/sessions-config.d.ts.map +1 -0
  19. package/dist/config/sessions-config.js +37 -0
  20. package/dist/config/sessions-config.js.map +1 -0
  21. package/dist/config/strategies-config.d.ts +38 -0
  22. package/dist/config/strategies-config.d.ts.map +1 -0
  23. package/dist/config/strategies-config.js +41 -0
  24. package/dist/config/strategies-config.js.map +1 -0
  25. package/dist/cost-governor/backpressure-queue.d.ts +20 -0
  26. package/dist/cost-governor/backpressure-queue.d.ts.map +1 -0
  27. package/dist/cost-governor/backpressure-queue.js +78 -0
  28. package/dist/cost-governor/backpressure-queue.js.map +1 -0
  29. package/dist/cost-governor/backpressure-queue.test.d.ts +2 -0
  30. package/dist/cost-governor/backpressure-queue.test.d.ts.map +1 -0
  31. package/dist/cost-governor/backpressure-queue.test.js +48 -0
  32. package/dist/cost-governor/backpressure-queue.test.js.map +1 -0
  33. package/dist/cost-governor/cost-events.d.ts +65 -0
  34. package/dist/cost-governor/cost-events.d.ts.map +1 -0
  35. package/dist/cost-governor/cost-events.js +48 -0
  36. package/dist/cost-governor/cost-events.js.map +1 -0
  37. package/dist/cost-governor/cost-governor-app-id.test.d.ts +19 -0
  38. package/dist/cost-governor/cost-governor-app-id.test.d.ts.map +1 -0
  39. package/dist/cost-governor/cost-governor-app-id.test.js +201 -0
  40. package/dist/cost-governor/cost-governor-app-id.test.js.map +1 -0
  41. package/dist/cost-governor/cost-oracle-impl.d.ts +19 -0
  42. package/dist/cost-governor/cost-oracle-impl.d.ts.map +1 -0
  43. package/dist/cost-governor/cost-oracle-impl.js +52 -0
  44. package/dist/cost-governor/cost-oracle-impl.js.map +1 -0
  45. package/dist/cost-governor/estimator.d.ts +22 -0
  46. package/dist/cost-governor/estimator.d.ts.map +1 -0
  47. package/dist/cost-governor/estimator.js +119 -0
  48. package/dist/cost-governor/estimator.js.map +1 -0
  49. package/dist/cost-governor/estimator.test.d.ts +2 -0
  50. package/dist/cost-governor/estimator.test.d.ts.map +1 -0
  51. package/dist/cost-governor/estimator.test.js +141 -0
  52. package/dist/cost-governor/estimator.test.js.map +1 -0
  53. package/dist/cost-governor/index.d.ts +75 -0
  54. package/dist/cost-governor/index.d.ts.map +1 -0
  55. package/dist/cost-governor/index.js +120 -0
  56. package/dist/cost-governor/index.js.map +1 -0
  57. package/dist/cost-governor/observations-store.d.ts +49 -0
  58. package/dist/cost-governor/observations-store.d.ts.map +1 -0
  59. package/dist/cost-governor/observations-store.js +179 -0
  60. package/dist/cost-governor/observations-store.js.map +1 -0
  61. package/dist/cost-governor/observations-store.test.d.ts +2 -0
  62. package/dist/cost-governor/observations-store.test.d.ts.map +1 -0
  63. package/dist/cost-governor/observations-store.test.js +191 -0
  64. package/dist/cost-governor/observations-store.test.js.map +1 -0
  65. package/dist/cost-governor/percentile.d.ts +17 -0
  66. package/dist/cost-governor/percentile.d.ts.map +1 -0
  67. package/dist/cost-governor/percentile.js +33 -0
  68. package/dist/cost-governor/percentile.js.map +1 -0
  69. package/dist/cost-governor/percentile.test.d.ts +2 -0
  70. package/dist/cost-governor/percentile.test.d.ts.map +1 -0
  71. package/dist/cost-governor/percentile.test.js +46 -0
  72. package/dist/cost-governor/percentile.test.js.map +1 -0
  73. package/dist/cost-governor/rate-governor-impl.d.ts +73 -0
  74. package/dist/cost-governor/rate-governor-impl.d.ts.map +1 -0
  75. package/dist/cost-governor/rate-governor-impl.js +148 -0
  76. package/dist/cost-governor/rate-governor-impl.js.map +1 -0
  77. package/dist/cost-governor/signature-builder.d.ts +22 -0
  78. package/dist/cost-governor/signature-builder.d.ts.map +1 -0
  79. package/dist/cost-governor/signature-builder.js +43 -0
  80. package/dist/cost-governor/signature-builder.js.map +1 -0
  81. package/dist/cost-governor/signature-builder.test.d.ts +2 -0
  82. package/dist/cost-governor/signature-builder.test.d.ts.map +1 -0
  83. package/dist/cost-governor/signature-builder.test.js +58 -0
  84. package/dist/cost-governor/signature-builder.test.js.map +1 -0
  85. package/dist/cost-governor/token-bucket.d.ts +57 -0
  86. package/dist/cost-governor/token-bucket.d.ts.map +1 -0
  87. package/dist/cost-governor/token-bucket.js +109 -0
  88. package/dist/cost-governor/token-bucket.js.map +1 -0
  89. package/dist/cost-governor/token-bucket.test.d.ts +2 -0
  90. package/dist/cost-governor/token-bucket.test.d.ts.map +1 -0
  91. package/dist/cost-governor/token-bucket.test.js +67 -0
  92. package/dist/cost-governor/token-bucket.test.js.map +1 -0
  93. package/dist/dlq/cortex-dlq-observer.d.ts +22 -0
  94. package/dist/dlq/cortex-dlq-observer.d.ts.map +1 -0
  95. package/dist/dlq/cortex-dlq-observer.js +29 -0
  96. package/dist/dlq/cortex-dlq-observer.js.map +1 -0
  97. package/dist/dlq/dlq-observer.test.d.ts +8 -0
  98. package/dist/dlq/dlq-observer.test.d.ts.map +1 -0
  99. package/dist/dlq/dlq-observer.test.js +103 -0
  100. package/dist/dlq/dlq-observer.test.js.map +1 -0
  101. package/dist/dlq/index.d.ts +6 -0
  102. package/dist/dlq/index.d.ts.map +1 -0
  103. package/dist/dlq/index.js +6 -0
  104. package/dist/dlq/index.js.map +1 -0
  105. package/dist/event-bus/adapters.d.ts +50 -0
  106. package/dist/event-bus/adapters.d.ts.map +1 -0
  107. package/dist/event-bus/adapters.js +51 -0
  108. package/dist/event-bus/adapters.js.map +1 -0
  109. package/dist/event-bus/adapters.test.d.ts +5 -0
  110. package/dist/event-bus/adapters.test.d.ts.map +1 -0
  111. package/dist/event-bus/adapters.test.js +73 -0
  112. package/dist/event-bus/adapters.test.js.map +1 -0
  113. package/dist/event-bus/agent-event-adapter.d.ts +22 -0
  114. package/dist/event-bus/agent-event-adapter.d.ts.map +1 -0
  115. package/dist/event-bus/agent-event-adapter.js +49 -0
  116. package/dist/event-bus/agent-event-adapter.js.map +1 -0
  117. package/dist/event-bus/agent-event-adapter.test.d.ts +5 -0
  118. package/dist/event-bus/agent-event-adapter.test.d.ts.map +1 -0
  119. package/dist/event-bus/agent-event-adapter.test.js +170 -0
  120. package/dist/event-bus/agent-event-adapter.test.js.map +1 -0
  121. package/dist/event-bus/channel-sink.d.ts +71 -0
  122. package/dist/event-bus/channel-sink.d.ts.map +1 -0
  123. package/dist/event-bus/channel-sink.js +159 -0
  124. package/dist/event-bus/channel-sink.js.map +1 -0
  125. package/dist/event-bus/channel-sink.test.d.ts +5 -0
  126. package/dist/event-bus/channel-sink.test.d.ts.map +1 -0
  127. package/dist/event-bus/channel-sink.test.js +234 -0
  128. package/dist/event-bus/channel-sink.test.js.map +1 -0
  129. package/dist/event-bus/event-types.snapshot.test.d.ts +27 -0
  130. package/dist/event-bus/event-types.snapshot.test.d.ts.map +1 -0
  131. package/dist/event-bus/event-types.snapshot.test.js +165 -0
  132. package/dist/event-bus/event-types.snapshot.test.js.map +1 -0
  133. package/dist/event-bus/genesis-sink.d.ts +55 -0
  134. package/dist/event-bus/genesis-sink.d.ts.map +1 -0
  135. package/dist/event-bus/genesis-sink.js +141 -0
  136. package/dist/event-bus/genesis-sink.js.map +1 -0
  137. package/dist/event-bus/genesis-sink.test.d.ts +5 -0
  138. package/dist/event-bus/genesis-sink.test.d.ts.map +1 -0
  139. package/dist/event-bus/genesis-sink.test.js +160 -0
  140. package/dist/event-bus/genesis-sink.test.js.map +1 -0
  141. package/dist/event-bus/in-memory-event-bus.d.ts +60 -0
  142. package/dist/event-bus/in-memory-event-bus.d.ts.map +1 -0
  143. package/dist/event-bus/in-memory-event-bus.js +274 -0
  144. package/dist/event-bus/in-memory-event-bus.js.map +1 -0
  145. package/dist/event-bus/in-memory-event-bus.test.d.ts +5 -0
  146. package/dist/event-bus/in-memory-event-bus.test.d.ts.map +1 -0
  147. package/dist/event-bus/in-memory-event-bus.test.js +457 -0
  148. package/dist/event-bus/in-memory-event-bus.test.js.map +1 -0
  149. package/dist/event-bus/index.d.ts +22 -0
  150. package/dist/event-bus/index.d.ts.map +1 -0
  151. package/dist/event-bus/index.js +17 -0
  152. package/dist/event-bus/index.js.map +1 -0
  153. package/dist/event-bus/persistence-sink.d.ts +74 -0
  154. package/dist/event-bus/persistence-sink.d.ts.map +1 -0
  155. package/dist/event-bus/persistence-sink.js +193 -0
  156. package/dist/event-bus/persistence-sink.js.map +1 -0
  157. package/dist/event-bus/persistence-sink.test.d.ts +6 -0
  158. package/dist/event-bus/persistence-sink.test.d.ts.map +1 -0
  159. package/dist/event-bus/persistence-sink.test.js +319 -0
  160. package/dist/event-bus/persistence-sink.test.js.map +1 -0
  161. package/dist/event-bus/session-checkpoint-sink.d.ts +91 -0
  162. package/dist/event-bus/session-checkpoint-sink.d.ts.map +1 -0
  163. package/dist/event-bus/session-checkpoint-sink.js +107 -0
  164. package/dist/event-bus/session-checkpoint-sink.js.map +1 -0
  165. package/dist/event-bus/session-checkpoint-sink.test.d.ts +5 -0
  166. package/dist/event-bus/session-checkpoint-sink.test.d.ts.map +1 -0
  167. package/dist/event-bus/session-checkpoint-sink.test.js +215 -0
  168. package/dist/event-bus/session-checkpoint-sink.test.js.map +1 -0
  169. package/dist/event-bus/webhook-connector.d.ts +59 -0
  170. package/dist/event-bus/webhook-connector.d.ts.map +1 -0
  171. package/dist/event-bus/webhook-connector.js +191 -0
  172. package/dist/event-bus/webhook-connector.js.map +1 -0
  173. package/dist/event-bus/webhook-connector.test.d.ts +5 -0
  174. package/dist/event-bus/webhook-connector.test.d.ts.map +1 -0
  175. package/dist/event-bus/webhook-connector.test.js +214 -0
  176. package/dist/event-bus/webhook-connector.test.js.map +1 -0
  177. package/dist/executors/cortex-job-backed-executor.d.ts +137 -0
  178. package/dist/executors/cortex-job-backed-executor.d.ts.map +1 -0
  179. package/dist/executors/cortex-job-backed-executor.js +441 -0
  180. package/dist/executors/cortex-job-backed-executor.js.map +1 -0
  181. package/dist/executors/cortex-job-backed-executor.test.d.ts +13 -0
  182. package/dist/executors/cortex-job-backed-executor.test.d.ts.map +1 -0
  183. package/dist/executors/cortex-job-backed-executor.test.js +303 -0
  184. package/dist/executors/cortex-job-backed-executor.test.js.map +1 -0
  185. package/dist/executors/index.d.ts +9 -0
  186. package/dist/executors/index.d.ts.map +1 -0
  187. package/dist/executors/index.js +9 -0
  188. package/dist/executors/index.js.map +1 -0
  189. package/dist/index.d.ts +2 -0
  190. package/dist/index.d.ts.map +1 -0
  191. package/dist/index.js +13 -0
  192. package/dist/index.js.map +1 -0
  193. package/dist/ports/checkpoint-sink.d.ts +69 -0
  194. package/dist/ports/checkpoint-sink.d.ts.map +1 -0
  195. package/dist/ports/checkpoint-sink.js +16 -0
  196. package/dist/ports/checkpoint-sink.js.map +1 -0
  197. package/dist/ports/checkpoint.d.ts +68 -0
  198. package/dist/ports/checkpoint.d.ts.map +1 -0
  199. package/dist/ports/checkpoint.js +14 -0
  200. package/dist/ports/checkpoint.js.map +1 -0
  201. package/dist/ports/continuation-envelope-cross-app.test.d.ts +10 -0
  202. package/dist/ports/continuation-envelope-cross-app.test.d.ts.map +1 -0
  203. package/dist/ports/continuation-envelope-cross-app.test.js +95 -0
  204. package/dist/ports/continuation-envelope-cross-app.test.js.map +1 -0
  205. package/dist/ports/continuation-envelope.d.ts +199 -0
  206. package/dist/ports/continuation-envelope.d.ts.map +1 -0
  207. package/dist/ports/continuation-envelope.js +69 -0
  208. package/dist/ports/continuation-envelope.js.map +1 -0
  209. package/dist/ports/conversation.d.ts +64 -0
  210. package/dist/ports/conversation.d.ts.map +1 -0
  211. package/dist/ports/conversation.js +19 -0
  212. package/dist/ports/conversation.js.map +1 -0
  213. package/dist/ports/cost-oracle.d.ts +26 -0
  214. package/dist/ports/cost-oracle.d.ts.map +1 -0
  215. package/dist/ports/cost-oracle.js +9 -0
  216. package/dist/ports/cost-oracle.js.map +1 -0
  217. package/dist/ports/cross-app-invoker.d.ts +198 -0
  218. package/dist/ports/cross-app-invoker.d.ts.map +1 -0
  219. package/dist/ports/cross-app-invoker.js +157 -0
  220. package/dist/ports/cross-app-invoker.js.map +1 -0
  221. package/dist/ports/dlq-observer.d.ts +40 -0
  222. package/dist/ports/dlq-observer.d.ts.map +1 -0
  223. package/dist/ports/dlq-observer.js +20 -0
  224. package/dist/ports/dlq-observer.js.map +1 -0
  225. package/dist/ports/event-bus.d.ts +169 -0
  226. package/dist/ports/event-bus.d.ts.map +1 -0
  227. package/dist/ports/event-bus.js +20 -0
  228. package/dist/ports/event-bus.js.map +1 -0
  229. package/dist/ports/event-reader.d.ts +21 -0
  230. package/dist/ports/event-reader.d.ts.map +1 -0
  231. package/dist/ports/event-reader.js +12 -0
  232. package/dist/ports/event-reader.js.map +1 -0
  233. package/dist/ports/event-rotator.d.ts +39 -0
  234. package/dist/ports/event-rotator.d.ts.map +1 -0
  235. package/dist/ports/event-rotator.js +15 -0
  236. package/dist/ports/event-rotator.js.map +1 -0
  237. package/dist/ports/file-system.d.ts +48 -0
  238. package/dist/ports/file-system.d.ts.map +1 -0
  239. package/dist/ports/file-system.js +10 -0
  240. package/dist/ports/file-system.js.map +1 -0
  241. package/dist/ports/historical-observations.d.ts +39 -0
  242. package/dist/ports/historical-observations.d.ts.map +1 -0
  243. package/dist/ports/historical-observations.js +12 -0
  244. package/dist/ports/historical-observations.js.map +1 -0
  245. package/dist/ports/in-memory-source.d.ts +46 -0
  246. package/dist/ports/in-memory-source.d.ts.map +1 -0
  247. package/dist/ports/in-memory-source.js +69 -0
  248. package/dist/ports/in-memory-source.js.map +1 -0
  249. package/dist/ports/index.d.ts +32 -0
  250. package/dist/ports/index.d.ts.map +1 -0
  251. package/dist/ports/index.js +10 -0
  252. package/dist/ports/index.js.map +1 -0
  253. package/dist/ports/job-backed-executor.d.ts +139 -0
  254. package/dist/ports/job-backed-executor.d.ts.map +1 -0
  255. package/dist/ports/job-backed-executor.js +56 -0
  256. package/dist/ports/job-backed-executor.js.map +1 -0
  257. package/dist/ports/methodology-source.d.ts +95 -0
  258. package/dist/ports/methodology-source.d.ts.map +1 -0
  259. package/dist/ports/methodology-source.js +26 -0
  260. package/dist/ports/methodology-source.js.map +1 -0
  261. package/dist/ports/native-session-discovery.d.ts +20 -0
  262. package/dist/ports/native-session-discovery.d.ts.map +1 -0
  263. package/dist/ports/native-session-discovery.js +13 -0
  264. package/dist/ports/native-session-discovery.js.map +1 -0
  265. package/dist/ports/projection-store.d.ts +48 -0
  266. package/dist/ports/projection-store.d.ts.map +1 -0
  267. package/dist/ports/projection-store.js +17 -0
  268. package/dist/ports/projection-store.js.map +1 -0
  269. package/dist/ports/projection.d.ts +29 -0
  270. package/dist/ports/projection.d.ts.map +1 -0
  271. package/dist/ports/projection.js +13 -0
  272. package/dist/ports/projection.js.map +1 -0
  273. package/dist/ports/rate-governor.d.ts +17 -0
  274. package/dist/ports/rate-governor.d.ts.map +1 -0
  275. package/dist/ports/rate-governor.js +11 -0
  276. package/dist/ports/rate-governor.js.map +1 -0
  277. package/dist/ports/schedule-client.d.ts +29 -0
  278. package/dist/ports/schedule-client.d.ts.map +1 -0
  279. package/dist/ports/schedule-client.js +2 -0
  280. package/dist/ports/schedule-client.js.map +1 -0
  281. package/dist/ports/session-pool.d.ts +162 -0
  282. package/dist/ports/session-pool.d.ts.map +1 -0
  283. package/dist/ports/session-pool.js +21 -0
  284. package/dist/ports/session-pool.js.map +1 -0
  285. package/dist/ports/session-store-errors.d.ts +22 -0
  286. package/dist/ports/session-store-errors.d.ts.map +1 -0
  287. package/dist/ports/session-store-errors.js +29 -0
  288. package/dist/ports/session-store-errors.js.map +1 -0
  289. package/dist/ports/session-store-types.d.ts +132 -0
  290. package/dist/ports/session-store-types.d.ts.map +1 -0
  291. package/dist/ports/session-store-types.js +14 -0
  292. package/dist/ports/session-store-types.js.map +1 -0
  293. package/dist/ports/session-store.d.ts +69 -0
  294. package/dist/ports/session-store.d.ts.map +1 -0
  295. package/dist/ports/session-store.js +23 -0
  296. package/dist/ports/session-store.js.map +1 -0
  297. package/dist/ports/yaml-loader.d.ts +15 -0
  298. package/dist/ports/yaml-loader.d.ts.map +1 -0
  299. package/dist/ports/yaml-loader.js +13 -0
  300. package/dist/ports/yaml-loader.js.map +1 -0
  301. package/dist/scheduling/index.d.ts +6 -0
  302. package/dist/scheduling/index.d.ts.map +1 -0
  303. package/dist/scheduling/index.js +6 -0
  304. package/dist/scheduling/index.js.map +1 -0
  305. package/dist/scheduling/scheduled-pact.d.ts +97 -0
  306. package/dist/scheduling/scheduled-pact.d.ts.map +1 -0
  307. package/dist/scheduling/scheduled-pact.js +89 -0
  308. package/dist/scheduling/scheduled-pact.js.map +1 -0
  309. package/dist/sessions/__tests__/cognitive-modules.test.d.ts +10 -0
  310. package/dist/sessions/__tests__/cognitive-modules.test.d.ts.map +1 -0
  311. package/dist/sessions/__tests__/cognitive-modules.test.js +535 -0
  312. package/dist/sessions/__tests__/cognitive-modules.test.js.map +1 -0
  313. package/dist/sessions/__tests__/cognitive-provider.test.d.ts +13 -0
  314. package/dist/sessions/__tests__/cognitive-provider.test.d.ts.map +1 -0
  315. package/dist/sessions/__tests__/cognitive-provider.test.js +331 -0
  316. package/dist/sessions/__tests__/cognitive-provider.test.js.map +1 -0
  317. package/dist/sessions/__tests__/cognitive-sink.test.d.ts +19 -0
  318. package/dist/sessions/__tests__/cognitive-sink.test.d.ts.map +1 -0
  319. package/dist/sessions/__tests__/cognitive-sink.test.js +334 -0
  320. package/dist/sessions/__tests__/cognitive-sink.test.js.map +1 -0
  321. package/dist/sessions/__tests__/runtime-tools.test.d.ts +2 -0
  322. package/dist/sessions/__tests__/runtime-tools.test.d.ts.map +1 -0
  323. package/dist/sessions/__tests__/runtime-tools.test.js +83 -0
  324. package/dist/sessions/__tests__/runtime-tools.test.js.map +1 -0
  325. package/dist/sessions/auto-retro.d.ts +29 -0
  326. package/dist/sessions/auto-retro.d.ts.map +1 -0
  327. package/dist/sessions/auto-retro.js +181 -0
  328. package/dist/sessions/auto-retro.js.map +1 -0
  329. package/dist/sessions/auto-retro.test.d.ts +2 -0
  330. package/dist/sessions/auto-retro.test.d.ts.map +1 -0
  331. package/dist/sessions/auto-retro.test.js +361 -0
  332. package/dist/sessions/auto-retro.test.js.map +1 -0
  333. package/dist/sessions/channels.d.ts +55 -0
  334. package/dist/sessions/channels.d.ts.map +1 -0
  335. package/dist/sessions/channels.js +118 -0
  336. package/dist/sessions/channels.js.map +1 -0
  337. package/dist/sessions/channels.test.d.ts +2 -0
  338. package/dist/sessions/channels.test.d.ts.map +1 -0
  339. package/dist/sessions/channels.test.js +285 -0
  340. package/dist/sessions/channels.test.js.map +1 -0
  341. package/dist/sessions/cognitive-modules.d.ts +100 -0
  342. package/dist/sessions/cognitive-modules.d.ts.map +1 -0
  343. package/dist/sessions/cognitive-modules.js +458 -0
  344. package/dist/sessions/cognitive-modules.js.map +1 -0
  345. package/dist/sessions/cognitive-provider.d.ts +42 -0
  346. package/dist/sessions/cognitive-provider.d.ts.map +1 -0
  347. package/dist/sessions/cognitive-provider.js +208 -0
  348. package/dist/sessions/cognitive-provider.js.map +1 -0
  349. package/dist/sessions/cognitive-sink.d.ts +73 -0
  350. package/dist/sessions/cognitive-sink.d.ts.map +1 -0
  351. package/dist/sessions/cognitive-sink.js +154 -0
  352. package/dist/sessions/cognitive-sink.js.map +1 -0
  353. package/dist/sessions/diagnostics.d.ts +70 -0
  354. package/dist/sessions/diagnostics.d.ts.map +1 -0
  355. package/dist/sessions/diagnostics.js +129 -0
  356. package/dist/sessions/diagnostics.js.map +1 -0
  357. package/dist/sessions/diagnostics.test.d.ts +2 -0
  358. package/dist/sessions/diagnostics.test.d.ts.map +1 -0
  359. package/dist/sessions/diagnostics.test.js +135 -0
  360. package/dist/sessions/diagnostics.test.js.map +1 -0
  361. package/dist/sessions/index.d.ts +32 -0
  362. package/dist/sessions/index.d.ts.map +1 -0
  363. package/dist/sessions/index.js +33 -0
  364. package/dist/sessions/index.js.map +1 -0
  365. package/dist/sessions/pool.d.ts +218 -0
  366. package/dist/sessions/pool.d.ts.map +1 -0
  367. package/dist/sessions/pool.js +991 -0
  368. package/dist/sessions/pool.js.map +1 -0
  369. package/dist/sessions/pool.test.d.ts +2 -0
  370. package/dist/sessions/pool.test.d.ts.map +1 -0
  371. package/dist/sessions/pool.test.js +633 -0
  372. package/dist/sessions/pool.test.js.map +1 -0
  373. package/dist/sessions/print-session.d.ts +142 -0
  374. package/dist/sessions/print-session.d.ts.map +1 -0
  375. package/dist/sessions/print-session.js +325 -0
  376. package/dist/sessions/print-session.js.map +1 -0
  377. package/dist/sessions/print-session.test.d.ts +2 -0
  378. package/dist/sessions/print-session.test.d.ts.map +1 -0
  379. package/dist/sessions/print-session.test.js +418 -0
  380. package/dist/sessions/print-session.test.js.map +1 -0
  381. package/dist/sessions/runtime-tools.d.ts +22 -0
  382. package/dist/sessions/runtime-tools.d.ts.map +1 -0
  383. package/dist/sessions/runtime-tools.js +162 -0
  384. package/dist/sessions/runtime-tools.js.map +1 -0
  385. package/dist/sessions/scope-hook.d.ts +77 -0
  386. package/dist/sessions/scope-hook.d.ts.map +1 -0
  387. package/dist/sessions/scope-hook.js +323 -0
  388. package/dist/sessions/scope-hook.js.map +1 -0
  389. package/dist/sessions/scope-hook.test.d.ts +2 -0
  390. package/dist/sessions/scope-hook.test.d.ts.map +1 -0
  391. package/dist/sessions/scope-hook.test.js +249 -0
  392. package/dist/sessions/scope-hook.test.js.map +1 -0
  393. package/dist/sessions/session-store/checkpoint-sink-impl.d.ts +16 -0
  394. package/dist/sessions/session-store/checkpoint-sink-impl.d.ts.map +1 -0
  395. package/dist/sessions/session-store/checkpoint-sink-impl.js +191 -0
  396. package/dist/sessions/session-store/checkpoint-sink-impl.js.map +1 -0
  397. package/dist/sessions/session-store/checkpoint-sink-impl.test.d.ts +5 -0
  398. package/dist/sessions/session-store/checkpoint-sink-impl.test.d.ts.map +1 -0
  399. package/dist/sessions/session-store/checkpoint-sink-impl.test.js +137 -0
  400. package/dist/sessions/session-store/checkpoint-sink-impl.test.js.map +1 -0
  401. package/dist/sessions/session-store/conformance.d.ts +59 -0
  402. package/dist/sessions/session-store/conformance.d.ts.map +1 -0
  403. package/dist/sessions/session-store/conformance.js +172 -0
  404. package/dist/sessions/session-store/conformance.js.map +1 -0
  405. package/dist/sessions/session-store/conformance.test.d.ts +7 -0
  406. package/dist/sessions/session-store/conformance.test.d.ts.map +1 -0
  407. package/dist/sessions/session-store/conformance.test.js +22 -0
  408. package/dist/sessions/session-store/conformance.test.js.map +1 -0
  409. package/dist/sessions/session-store/in-memory-session-store.d.ts +23 -0
  410. package/dist/sessions/session-store/in-memory-session-store.d.ts.map +1 -0
  411. package/dist/sessions/session-store/in-memory-session-store.js +197 -0
  412. package/dist/sessions/session-store/in-memory-session-store.js.map +1 -0
  413. package/dist/sessions/session-store/in-memory-session-store.test.d.ts +6 -0
  414. package/dist/sessions/session-store/in-memory-session-store.test.d.ts.map +1 -0
  415. package/dist/sessions/session-store/in-memory-session-store.test.js +183 -0
  416. package/dist/sessions/session-store/in-memory-session-store.test.js.map +1 -0
  417. package/dist/sessions/session-store/index.d.ts +20 -0
  418. package/dist/sessions/session-store/index.d.ts.map +1 -0
  419. package/dist/sessions/session-store/index.js +15 -0
  420. package/dist/sessions/session-store/index.js.map +1 -0
  421. package/dist/sessions/session-store/resume.d.ts +88 -0
  422. package/dist/sessions/session-store/resume.d.ts.map +1 -0
  423. package/dist/sessions/session-store/resume.js +96 -0
  424. package/dist/sessions/session-store/resume.js.map +1 -0
  425. package/dist/sessions/session-store/resume.test.d.ts +5 -0
  426. package/dist/sessions/session-store/resume.test.d.ts.map +1 -0
  427. package/dist/sessions/session-store/resume.test.js +119 -0
  428. package/dist/sessions/session-store/resume.test.js.map +1 -0
  429. package/dist/sessions/spawn-queue.d.ts +28 -0
  430. package/dist/sessions/spawn-queue.d.ts.map +1 -0
  431. package/dist/sessions/spawn-queue.js +63 -0
  432. package/dist/sessions/spawn-queue.js.map +1 -0
  433. package/dist/sessions/spawn-queue.test.d.ts +2 -0
  434. package/dist/sessions/spawn-queue.test.d.ts.map +1 -0
  435. package/dist/sessions/spawn-queue.test.js +65 -0
  436. package/dist/sessions/spawn-queue.test.js.map +1 -0
  437. package/dist/sessions/types.d.ts +16 -0
  438. package/dist/sessions/types.d.ts.map +1 -0
  439. package/dist/sessions/types.js +11 -0
  440. package/dist/sessions/types.js.map +1 -0
  441. package/dist/sessions/worktree-stale.test.d.ts +2 -0
  442. package/dist/sessions/worktree-stale.test.d.ts.map +1 -0
  443. package/dist/sessions/worktree-stale.test.js +468 -0
  444. package/dist/sessions/worktree-stale.test.js.map +1 -0
  445. package/dist/strategy/artifact-store.d.ts +12 -0
  446. package/dist/strategy/artifact-store.d.ts.map +1 -0
  447. package/dist/strategy/artifact-store.js +12 -0
  448. package/dist/strategy/artifact-store.js.map +1 -0
  449. package/dist/strategy/artifact-store.test.d.ts +2 -0
  450. package/dist/strategy/artifact-store.test.d.ts.map +1 -0
  451. package/dist/strategy/artifact-store.test.js +170 -0
  452. package/dist/strategy/artifact-store.test.js.map +1 -0
  453. package/dist/strategy/context-load-executor.d.ts +23 -0
  454. package/dist/strategy/context-load-executor.d.ts.map +1 -0
  455. package/dist/strategy/context-load-executor.js +87 -0
  456. package/dist/strategy/context-load-executor.js.map +1 -0
  457. package/dist/strategy/context-load-executor.test.d.ts +16 -0
  458. package/dist/strategy/context-load-executor.test.d.ts.map +1 -0
  459. package/dist/strategy/context-load-executor.test.js +158 -0
  460. package/dist/strategy/context-load-executor.test.js.map +1 -0
  461. package/dist/strategy/cortex-cross-app-invoker.stub.d.ts +65 -0
  462. package/dist/strategy/cortex-cross-app-invoker.stub.d.ts.map +1 -0
  463. package/dist/strategy/cortex-cross-app-invoker.stub.js +68 -0
  464. package/dist/strategy/cortex-cross-app-invoker.stub.js.map +1 -0
  465. package/dist/strategy/cross-app-node-executor.d.ts +54 -0
  466. package/dist/strategy/cross-app-node-executor.d.ts.map +1 -0
  467. package/dist/strategy/cross-app-node-executor.js +98 -0
  468. package/dist/strategy/cross-app-node-executor.js.map +1 -0
  469. package/dist/strategy/cross-app-node-executor.test.d.ts +13 -0
  470. package/dist/strategy/cross-app-node-executor.test.d.ts.map +1 -0
  471. package/dist/strategy/cross-app-node-executor.test.js +160 -0
  472. package/dist/strategy/cross-app-node-executor.test.js.map +1 -0
  473. package/dist/strategy/gates.d.ts +13 -0
  474. package/dist/strategy/gates.d.ts.map +1 -0
  475. package/dist/strategy/gates.js +13 -0
  476. package/dist/strategy/gates.js.map +1 -0
  477. package/dist/strategy/gates.test.d.ts +2 -0
  478. package/dist/strategy/gates.test.d.ts.map +1 -0
  479. package/dist/strategy/gates.test.js +299 -0
  480. package/dist/strategy/gates.test.js.map +1 -0
  481. package/dist/strategy/human-approval-resolver.d.ts +23 -0
  482. package/dist/strategy/human-approval-resolver.d.ts.map +1 -0
  483. package/dist/strategy/human-approval-resolver.js +94 -0
  484. package/dist/strategy/human-approval-resolver.js.map +1 -0
  485. package/dist/strategy/human-approval-resolver.test.d.ts +16 -0
  486. package/dist/strategy/human-approval-resolver.test.d.ts.map +1 -0
  487. package/dist/strategy/human-approval-resolver.test.js +200 -0
  488. package/dist/strategy/human-approval-resolver.test.js.map +1 -0
  489. package/dist/strategy/in-process-cross-app-invoker.d.ts +105 -0
  490. package/dist/strategy/in-process-cross-app-invoker.d.ts.map +1 -0
  491. package/dist/strategy/in-process-cross-app-invoker.js +206 -0
  492. package/dist/strategy/in-process-cross-app-invoker.js.map +1 -0
  493. package/dist/strategy/in-process-cross-app-invoker.test.d.ts +15 -0
  494. package/dist/strategy/in-process-cross-app-invoker.test.d.ts.map +1 -0
  495. package/dist/strategy/in-process-cross-app-invoker.test.js +190 -0
  496. package/dist/strategy/in-process-cross-app-invoker.test.js.map +1 -0
  497. package/dist/strategy/index.d.ts +29 -0
  498. package/dist/strategy/index.d.ts.map +1 -0
  499. package/dist/strategy/index.js +29 -0
  500. package/dist/strategy/index.js.map +1 -0
  501. package/dist/strategy/pacta-strategy.d.ts +97 -0
  502. package/dist/strategy/pacta-strategy.d.ts.map +1 -0
  503. package/dist/strategy/pacta-strategy.js +117 -0
  504. package/dist/strategy/pacta-strategy.js.map +1 -0
  505. package/dist/strategy/pacta-strategy.test.d.ts +2 -0
  506. package/dist/strategy/pacta-strategy.test.d.ts.map +1 -0
  507. package/dist/strategy/pacta-strategy.test.js +234 -0
  508. package/dist/strategy/pacta-strategy.test.js.map +1 -0
  509. package/dist/strategy/retro-generator.d.ts +18 -0
  510. package/dist/strategy/retro-generator.d.ts.map +1 -0
  511. package/dist/strategy/retro-generator.js +22 -0
  512. package/dist/strategy/retro-generator.js.map +1 -0
  513. package/dist/strategy/retro-writer.d.ts +25 -0
  514. package/dist/strategy/retro-writer.d.ts.map +1 -0
  515. package/dist/strategy/retro-writer.js +65 -0
  516. package/dist/strategy/retro-writer.js.map +1 -0
  517. package/dist/strategy/strategy-executor.d.ts +39 -0
  518. package/dist/strategy/strategy-executor.d.ts.map +1 -0
  519. package/dist/strategy/strategy-executor.js +253 -0
  520. package/dist/strategy/strategy-executor.js.map +1 -0
  521. package/dist/strategy/strategy-executor.test.d.ts +8 -0
  522. package/dist/strategy/strategy-executor.test.d.ts.map +1 -0
  523. package/dist/strategy/strategy-executor.test.js +1301 -0
  524. package/dist/strategy/strategy-executor.test.js.map +1 -0
  525. package/dist/strategy/strategy-parser.d.ts +30 -0
  526. package/dist/strategy/strategy-parser.d.ts.map +1 -0
  527. package/dist/strategy/strategy-parser.js +30 -0
  528. package/dist/strategy/strategy-parser.js.map +1 -0
  529. package/dist/strategy/sub-strategy-source.d.ts +27 -0
  530. package/dist/strategy/sub-strategy-source.d.ts.map +1 -0
  531. package/dist/strategy/sub-strategy-source.js +77 -0
  532. package/dist/strategy/sub-strategy-source.js.map +1 -0
  533. package/dist/strategy/types.d.ts +12 -0
  534. package/dist/strategy/types.d.ts.map +1 -0
  535. package/dist/strategy/types.js +9 -0
  536. package/dist/strategy/types.js.map +1 -0
  537. package/package.json +87 -0
@@ -0,0 +1,458 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * Bridge Cognitive Modules — CognitiveModule implementations extracted from
4
+ * the monolithic cognitive-provider.ts inline loop.
5
+ *
6
+ * BridgeReasonerActorModule: extracts the inner while-loop (multi-tool cycle)
7
+ * BridgeMonitorModule: extracts the inline monitor block (anomaly, write gate, etc.)
8
+ *
9
+ * All 11 behavioral fixes from PRDs 033/040/041 remain intact inside these modules.
10
+ * The refactor is structural, not behavioral.
11
+ *
12
+ * PRD 042 Phase 1-3: Module Type Definitions + Factories
13
+ */
14
+ import { moduleId } from '@methodts/pacta';
15
+ // ── Constants (duplicated from cognitive-provider.ts — forbidden to import) ──
16
+ const FORMAT_INSTRUCTION = `You MUST respond with exactly three XML sections. No other text outside these tags.
17
+
18
+ <plan>Brief 2-3 step plan.</plan>
19
+ <reasoning>Your analysis and rationale.</reasoning>
20
+ <action>{"tool":"ToolName","input":{"key":"value"}}</action>
21
+
22
+ The <action> tag MUST contain valid JSON with a "tool" field matching one of the available tools.
23
+ When the task is complete, use: <action>{"tool":"done","input":{"result":"your final answer here"}}</action>
24
+
25
+ CRITICAL RULE — If you see "[\\u2713 DELIVERABLE WRITTEN" anywhere in your context, the task output is already saved. Your ONLY valid next action is done. Do not read, write, or research further.
26
+
27
+ IMPORTANT — For Write operations with large or multi-line content, use a <content> block INSTEAD of putting content in the JSON. This avoids JSON escaping issues:
28
+ <action>{"tool":"Write","input":{"path":"output.md"}}</action>
29
+ <content>
30
+ ...your multi-line content here, no escaping needed...
31
+ </content>
32
+
33
+ Example response:
34
+ <plan>1. Read the file. 2. Report the contents.</plan>
35
+ <reasoning>I need to read the file to answer the question.</reasoning>
36
+ <action>{"tool":"Read","input":{"path":"package.json"}}</action>`;
37
+ export const READ_ONLY_ACTIONS = new Set(['Read', 'Glob', 'Grep', 'Search', 'List']);
38
+ const MAX_CONSECUTIVE_FAILED_PARSES = 3;
39
+ // ── Helper ─────────────────────────────────────────────────────────
40
+ /** Returns the default monitor control (no interventions). */
41
+ export function defaultBridgeMonitorControl() {
42
+ return {
43
+ target: moduleId('reasoner-actor'),
44
+ timestamp: Date.now(),
45
+ forceReplan: false,
46
+ restricted: [],
47
+ interventionMessage: null,
48
+ writeGateFired: false,
49
+ prevCycleAction: null,
50
+ };
51
+ }
52
+ // ── BridgeReasonerActorModule Factory ──────────────────────────────
53
+ /**
54
+ * Creates a BridgeReasonerActorModule that extracts the inner while-loop
55
+ * from cognitive-provider.ts into a CognitiveModule implementation.
56
+ *
57
+ * All 11 behavioral fixes remain inside:
58
+ * - Write-completion hint (salience 1.0 after successful Write)
59
+ * - Write gate counters (promptSuccessfulReads/Writes, writeGateFired)
60
+ * - Impasse detection (exact-match semantic key, within-step local)
61
+ * - Parse failure circuit-breaker (consecutiveFailedParses >= 3)
62
+ * - Content block handling (<content> tag for Write)
63
+ * - Truncation hint (Read result truncation message)
64
+ */
65
+ export function createBridgeReasonerActorModule(adapter, tools, ws, raWritePort, raReadPort, obsPort, config, onEvent, cognitiveSink, onChunk) {
66
+ const raModuleId = moduleId('reasoner-actor');
67
+ return {
68
+ id: raModuleId,
69
+ initialState() {
70
+ return {
71
+ foldedCtx: [],
72
+ promptSuccessfulReads: 0,
73
+ promptSuccessfulWrites: 0,
74
+ writeGateFired: false,
75
+ };
76
+ },
77
+ async step(prompt, state, control) {
78
+ // Clone state for immutability
79
+ const foldedCtx = [...state.foldedCtx];
80
+ let promptSuccessfulReads = state.promptSuccessfulReads;
81
+ let promptSuccessfulWrites = state.promptSuccessfulWrites;
82
+ let writeGateFired = state.writeGateFired;
83
+ // Per-cycle locals
84
+ let prevSemanticKey = null;
85
+ let consecutiveFailedParses = 0;
86
+ let cycleDone = false;
87
+ let lastOutput = '';
88
+ let prevConf = 1.0;
89
+ let prevAction = null;
90
+ let cycleInputTokens = 0;
91
+ let cycleOutputTokens = 0;
92
+ const { maxToolsPerCycle, maxOutputTokens, wsCapacity, cycleNumber, maxCycles } = config;
93
+ // Bug 1 fix: propagate writeGateFired from monitor control into RA state
94
+ if (control.writeGateFired)
95
+ writeGateFired = true;
96
+ const forceReplan = control.forceReplan;
97
+ const restricted = control.restricted;
98
+ // ── Context injection ──
99
+ if (foldedCtx.length > 0 || forceReplan) {
100
+ const parts = [`[Cycle ${cycleNumber}/${maxCycles}]`];
101
+ if (foldedCtx.length > 0)
102
+ parts.push(`## Completed Actions\n${foldedCtx.join('\n')}`);
103
+ if (forceReplan) {
104
+ const noActionStall = control.prevCycleAction === 'no-action' || control.prevCycleAction === 'parse-error';
105
+ parts.push(noActionStall
106
+ ? 'Your last response had NO <action> block. You MUST end with <action>{"tool":"ToolName","input":{...}}</action>. Do not describe what you would do — call the tool directly NOW.'
107
+ : 'MUST try a different strategy. Previous approach is stagnating.');
108
+ }
109
+ if (restricted.length > 0)
110
+ parts.push(`RESTRICTED actions: ${restricted.join(', ')}`);
111
+ if (control.interventionMessage)
112
+ parts.push(control.interventionMessage);
113
+ obsPort.write({ source: moduleId('observer'), content: parts.join('\n\n'), salience: 0.9, timestamp: Date.now() });
114
+ }
115
+ // ── Multi-tool inner loop ──
116
+ let toolsThisCycle = 0;
117
+ while (toolsThisCycle < maxToolsPerCycle) {
118
+ const wsEntries = raReadPort.read();
119
+ const strat = forceReplan && toolsThisCycle === 0
120
+ ? 'Consider the problem deeply. Weigh alternatives and identify the strongest path.'
121
+ : 'Produce a structured plan with numbered steps. Identify dependencies and risks.';
122
+ const toolList = tools.list().map((t) => `- ${t.name}: ${t.description ?? ''}`).join('\n');
123
+ const now = Date.now();
124
+ const syntheticSnapshot = [
125
+ { source: moduleId('observer'), content: strat, salience: 1.0, timestamp: now },
126
+ { source: moduleId('observer'), content: `Available tools:\n${toolList}`, salience: 0.95, timestamp: now },
127
+ { source: moduleId('observer'), content: FORMAT_INSTRUCTION, salience: 0.95, timestamp: now },
128
+ ...wsEntries,
129
+ ];
130
+ try {
131
+ const res = await adapter.invoke(syntheticSnapshot, {
132
+ pactTemplate: { mode: { type: 'oneshot' }, budget: { maxOutputTokens } },
133
+ });
134
+ const text = String(res.output);
135
+ const inTok = res.usage.inputTokens;
136
+ const outTok = res.usage.outputTokens;
137
+ cycleInputTokens += inTok;
138
+ cycleOutputTokens += outTok;
139
+ if (!text.trim()) {
140
+ onEvent({ type: 'cycle-action', cycle: cycleNumber, action: 'empty-response', confidence: 0.1, tokens: res.usage.totalTokens });
141
+ cognitiveSink?.handle({ type: 'cognitive:module_step', moduleId: raModuleId, phase: 'empty-response', durationMs: 0, hasError: true, timestamp: Date.now() });
142
+ prevConf = 0.1;
143
+ prevAction = 'empty-response';
144
+ foldedCtx.push(`[c${cycleNumber}] empty-response`);
145
+ if (foldedCtx.length > 15)
146
+ foldedCtx.shift();
147
+ break;
148
+ }
149
+ const plan = text.match(/<plan>([\s\S]*?)<\/plan>/)?.[1]?.trim() ?? '';
150
+ const reasoning = text.match(/<reasoning>([\s\S]*?)<\/reasoning>/)?.[1]?.trim() ?? '';
151
+ const actionRaw = text.match(/<action>([\s\S]*?)<\/action>/)?.[1]?.trim() ?? '';
152
+ const contentBlock = text.match(/<content>([\s\S]*?)<\/content>/)?.[1] ?? null;
153
+ if (reasoning) {
154
+ const chunk = `**[Cycle ${cycleNumber}/${maxCycles} | Tool ${toolsThisCycle + 1}]** ${reasoning}\n`;
155
+ onEvent({ type: 'text', content: chunk });
156
+ onChunk?.(chunk);
157
+ }
158
+ let actionName = 'unknown';
159
+ let confidence = 0.5;
160
+ let parsed;
161
+ try {
162
+ parsed = JSON.parse(actionRaw);
163
+ consecutiveFailedParses = 0;
164
+ if (contentBlock !== null && parsed.tool === 'Write') {
165
+ parsed.input = parsed.input ?? {};
166
+ parsed.input.content = contentBlock;
167
+ }
168
+ }
169
+ catch {
170
+ actionName = actionRaw ? 'parse-error' : 'no-action';
171
+ confidence = 0.2;
172
+ prevConf = confidence;
173
+ prevAction = actionName;
174
+ consecutiveFailedParses++;
175
+ onEvent({ type: 'cycle-action', cycle: cycleNumber, action: actionName, confidence, tokens: res.usage.totalTokens });
176
+ cognitiveSink?.handle({ type: 'cognitive:module_step', moduleId: raModuleId, phase: actionName, durationMs: 0, hasError: true, timestamp: Date.now() });
177
+ foldedCtx.push(`[c${cycleNumber}] ${actionName}: ${(plan || reasoning).slice(0, 80)}`);
178
+ if (foldedCtx.length > 15)
179
+ foldedCtx.shift();
180
+ // Early bail-out: circuit-breaker
181
+ if (consecutiveFailedParses >= MAX_CONSECUTIVE_FAILED_PARSES) {
182
+ lastOutput = reasoning || plan || `Model could not produce a valid action after ${MAX_CONSECUTIVE_FAILED_PARSES} attempts. Last response:\n${text.slice(0, 500)}`;
183
+ const cbMsg = `\n[cognitive] Stopping: ${MAX_CONSECUTIVE_FAILED_PARSES} consecutive parse failures. The model may not support the required output format.\n`;
184
+ onEvent({ type: 'text', content: cbMsg });
185
+ onChunk?.(cbMsg);
186
+ cognitiveSink?.handle({ type: 'cognitive:cycle_aborted', reason: `${MAX_CONSECUTIVE_FAILED_PARSES} consecutive parse failures`, phase: 'action', cycleNumber, timestamp: Date.now() });
187
+ cycleDone = true;
188
+ break;
189
+ }
190
+ // Continue the while-loop to allow consecutive failures to accumulate
191
+ // toward the circuit-breaker threshold. Each failed parse still counts
192
+ // as a tool slot consumed.
193
+ toolsThisCycle++;
194
+ continue;
195
+ }
196
+ actionName = parsed.tool ?? 'unknown';
197
+ if (actionName === 'done') {
198
+ lastOutput = parsed.input?.result ?? reasoning ?? plan;
199
+ onEvent({ type: 'cycle-action', cycle: cycleNumber, action: 'done', confidence: 1.0, tokens: res.usage.totalTokens });
200
+ cognitiveSink?.handle({ type: 'cognitive:cycle_phase', phase: 'done', cycleNumber, timestamp: Date.now() });
201
+ cycleDone = true;
202
+ break;
203
+ }
204
+ // ── Impasse detection (exact match) ──
205
+ const semanticKey = `${actionName}:${JSON.stringify(parsed.input ?? {})}`;
206
+ if (prevSemanticKey === semanticKey) {
207
+ raWritePort.write({
208
+ source: raModuleId,
209
+ content: '[IMPASSE] You are repeating the same action with identical input. Try a fundamentally different approach.',
210
+ salience: 0.95, timestamp: Date.now(),
211
+ });
212
+ onEvent({
213
+ type: 'monitor', cycle: cycleNumber,
214
+ intervention: 'impasse-detected',
215
+ action: actionName,
216
+ });
217
+ cognitiveSink?.handle({
218
+ type: 'cognitive:control_policy_violation',
219
+ directive: { target: raModuleId, timestamp: Date.now() },
220
+ reason: `impasse: repeated action ${actionName} with identical input`,
221
+ timestamp: Date.now(),
222
+ });
223
+ }
224
+ prevSemanticKey = semanticKey;
225
+ try {
226
+ const toolRes = await tools.execute(actionName, parsed.input ?? {});
227
+ confidence = toolRes.isError ? 0.3 : 0.7;
228
+ const resStr = typeof toolRes.output === 'string' ? toolRes.output : JSON.stringify(toolRes.output);
229
+ raWritePort.write({
230
+ source: raModuleId,
231
+ content: `[${actionName}] Result:\n${resStr}`,
232
+ salience: 0.8, timestamp: Date.now(),
233
+ });
234
+ // Truncation hint
235
+ if (actionName === 'Read' && resStr.endsWith('... (truncated)')) {
236
+ const readPath = parsed.input?.path;
237
+ raWritePort.write({
238
+ source: moduleId('observer'),
239
+ content: `[READ TRUNCATED] Output was cut at 8000 chars. To read the rest, use: Read({"path":"${readPath}","offset":<next_line_number>,"limit":100}). First, estimate the line number from the truncated content.`,
240
+ salience: 0.88, timestamp: Date.now(),
241
+ });
242
+ }
243
+ // Write-completion hint
244
+ if (actionName === 'Write' && !toolRes.isError) {
245
+ const writePath = parsed.input?.path ?? 'file';
246
+ obsPort.write({
247
+ source: moduleId('observer'),
248
+ content: `[\u2713 DELIVERABLE WRITTEN \u2192 ${writePath}]\nTask output is saved. Execute this action immediately:\n<action>{"tool":"done","input":{"result":"Output written to ${writePath}"}}</action>`,
249
+ salience: 1.0, timestamp: Date.now(),
250
+ });
251
+ }
252
+ // Write gate counters
253
+ if (!toolRes.isError) {
254
+ if (READ_ONLY_ACTIONS.has(actionName))
255
+ promptSuccessfulReads++;
256
+ if (actionName === 'Write') {
257
+ promptSuccessfulWrites++;
258
+ promptSuccessfulReads = 0;
259
+ writeGateFired = false;
260
+ }
261
+ }
262
+ }
263
+ catch (toolErr) {
264
+ const msg = toolErr instanceof Error ? toolErr.message : String(toolErr);
265
+ confidence = 0.1;
266
+ raWritePort.write({
267
+ source: raModuleId,
268
+ content: `[${actionName}] Tool error: ${msg}`,
269
+ salience: 0.8, timestamp: Date.now(),
270
+ });
271
+ }
272
+ prevConf = confidence;
273
+ prevAction = actionName;
274
+ onEvent({ type: 'cycle-action', cycle: cycleNumber, action: actionName, confidence, tokens: res.usage.totalTokens });
275
+ cognitiveSink?.handle({ type: 'cognitive:module_step', moduleId: raModuleId, phase: actionName, durationMs: 0, hasError: confidence < 0.5, timestamp: Date.now() });
276
+ foldedCtx.push(`[c${cycleNumber}] ${actionName}: ${(plan || reasoning).slice(0, 80)}`);
277
+ if (foldedCtx.length > 15)
278
+ foldedCtx.shift();
279
+ toolsThisCycle++;
280
+ }
281
+ catch (err) {
282
+ const msg = err instanceof Error ? err.message : String(err);
283
+ onEvent({ type: 'cycle-action', cycle: cycleNumber, action: 'error', confidence: 0, tokens: 0 });
284
+ const errMsg = `\n[cycle ${cycleNumber}] Error: ${msg}\n`;
285
+ onEvent({ type: 'text', content: errMsg });
286
+ onChunk?.(errMsg);
287
+ cognitiveSink?.handle({ type: 'cognitive:cycle_aborted', reason: msg, phase: 'action', cycleNumber, timestamp: Date.now() });
288
+ break;
289
+ }
290
+ }
291
+ // Compute workspace utilization
292
+ const wsSnapshot = ws.snapshot();
293
+ const wsUtilization = wsSnapshot.length / wsCapacity;
294
+ const newState = {
295
+ foldedCtx,
296
+ promptSuccessfulReads,
297
+ promptSuccessfulWrites,
298
+ writeGateFired,
299
+ };
300
+ const monitoring = {
301
+ source: raModuleId,
302
+ timestamp: Date.now(),
303
+ type: 'bridge-reasoner-actor',
304
+ prevConf,
305
+ prevAction,
306
+ consecutiveFailedParses,
307
+ wsUtilization,
308
+ promptInputTokens: cycleInputTokens,
309
+ promptOutputTokens: cycleOutputTokens,
310
+ writeGateFired,
311
+ promptSuccessfulReads,
312
+ promptSuccessfulWrites,
313
+ cycleDone,
314
+ lastOutput,
315
+ };
316
+ return {
317
+ output: monitoring,
318
+ state: newState,
319
+ monitoring,
320
+ };
321
+ },
322
+ };
323
+ }
324
+ // ── BridgeMonitorModule Factory ────────────────────────────────────
325
+ /**
326
+ * Creates a BridgeMonitorModule that extracts the inline monitor block
327
+ * from cognitive-provider.ts into a CognitiveModule implementation.
328
+ *
329
+ * Reads the previous cycle's RA monitoring signal and produces control
330
+ * directives for the current cycle's RA.
331
+ *
332
+ * Workspace writes use source: moduleId('monitor') (identity fix per PRD 042).
333
+ */
334
+ export function createBridgeMonitorModule(ws, monitorPort, wsCapacity, config, onEvent, cognitiveSink) {
335
+ const monModuleId = moduleId('monitor');
336
+ return {
337
+ id: monModuleId,
338
+ initialState() {
339
+ return {
340
+ readOnlyRun: 0,
341
+ interventions: 0,
342
+ accumulatedInputTokens: 0,
343
+ };
344
+ },
345
+ async step(monitoring, state, _noControl) {
346
+ // First cycle: no monitoring available yet — return default control
347
+ if (monitoring === null) {
348
+ return {
349
+ output: defaultBridgeMonitorControl(),
350
+ state: { ...state },
351
+ monitoring: {
352
+ source: monModuleId,
353
+ timestamp: Date.now(),
354
+ },
355
+ };
356
+ }
357
+ const { confThreshold, stagThreshold, intBudget } = config;
358
+ // Clone state for immutability
359
+ let readOnlyRun = state.readOnlyRun;
360
+ let interventions = state.interventions;
361
+ let accumulatedInputTokens = state.accumulatedInputTokens + monitoring.promptInputTokens;
362
+ // Track read-only runs
363
+ if (monitoring.prevAction && READ_ONLY_ACTIONS.has(monitoring.prevAction)) {
364
+ readOnlyRun++;
365
+ }
366
+ else {
367
+ readOnlyRun = 0;
368
+ }
369
+ let forceReplan = false;
370
+ const restricted = [];
371
+ let interventionMessage = null;
372
+ // ── Anomaly detection ──
373
+ const anomaly = monitoring.prevConf < confThreshold || readOnlyRun >= stagThreshold;
374
+ if (anomaly && interventions < intBudget) {
375
+ interventions++;
376
+ forceReplan = true;
377
+ if (interventions < 3 && monitoring.prevAction)
378
+ restricted.push(monitoring.prevAction);
379
+ const interventionKind = interventions >= 3 ? 'reframe' : 'constrain';
380
+ onEvent({
381
+ type: 'monitor', cycle: 0, // cycle number not available in monitor — caller sets context
382
+ intervention: interventionKind,
383
+ restricted: restricted.length > 0 ? restricted : undefined,
384
+ });
385
+ cognitiveSink?.handle({
386
+ type: 'cognitive:control_directive',
387
+ directive: {
388
+ target: moduleId('reasoner-actor'),
389
+ timestamp: Date.now(),
390
+ },
391
+ timestamp: Date.now(),
392
+ });
393
+ }
394
+ // ── Workspace saturation intervention ──
395
+ const wsEntries = ws.snapshot();
396
+ const wsUtilization = wsEntries.length / wsCapacity;
397
+ if (wsUtilization >= 0.8) {
398
+ monitorPort.write({
399
+ source: monModuleId,
400
+ content: `[WORKSPACE ${wsEntries.length}/${wsCapacity} entries \u2014 near capacity] Context entries are being evicted. Stop accumulating information. Summarize what you know and produce your final output NOW.`,
401
+ salience: 0.92,
402
+ timestamp: Date.now(),
403
+ });
404
+ onEvent({ type: 'monitor', cycle: 0, intervention: 'workspace-saturation' });
405
+ }
406
+ // ── Token budget intervention ──
407
+ if (accumulatedInputTokens > 100_000) {
408
+ monitorPort.write({
409
+ source: monModuleId,
410
+ content: `[TOKEN BUDGET ALERT: ~${Math.round(accumulatedInputTokens / 1000)}k input tokens used] Context window pressure is high. Do NOT read more files. Use what you already know to produce your final Write + done action immediately.`,
411
+ salience: 0.95,
412
+ timestamp: Date.now(),
413
+ });
414
+ onEvent({ type: 'monitor', cycle: 0, intervention: 'token-budget-pressure' });
415
+ }
416
+ // ── Write gate intervention ──
417
+ let writeGateJustFired = false;
418
+ if (monitoring.promptSuccessfulReads >= 3 && monitoring.promptSuccessfulWrites === 0 && !monitoring.writeGateFired) {
419
+ forceReplan = true;
420
+ writeGateJustFired = true;
421
+ for (const tool of READ_ONLY_ACTIONS) {
422
+ if (!restricted.includes(tool))
423
+ restricted.push(tool);
424
+ }
425
+ monitorPort.write({
426
+ source: monModuleId,
427
+ content: `[WRITE GATE] You have gathered enough information (${monitoring.promptSuccessfulReads} reads). Read, Glob, Grep, Search, and List are strongly DISCOURAGED. You should produce a Write action to save your output or call done if the task is complete.`,
428
+ salience: 0.85,
429
+ timestamp: Date.now(),
430
+ });
431
+ onEvent({ type: 'monitor', cycle: 0, intervention: 'write-gate' });
432
+ }
433
+ const newState = {
434
+ readOnlyRun,
435
+ interventions,
436
+ accumulatedInputTokens,
437
+ };
438
+ const output = {
439
+ target: moduleId('reasoner-actor'),
440
+ timestamp: Date.now(),
441
+ forceReplan,
442
+ restricted,
443
+ interventionMessage,
444
+ writeGateFired: writeGateJustFired,
445
+ prevCycleAction: monitoring.prevAction,
446
+ };
447
+ return {
448
+ output,
449
+ state: newState,
450
+ monitoring: {
451
+ source: monModuleId,
452
+ timestamp: Date.now(),
453
+ },
454
+ };
455
+ },
456
+ };
457
+ }
458
+ //# sourceMappingURL=cognitive-modules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cognitive-modules.js","sourceRoot":"","sources":["../../src/sessions/cognitive-modules.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;;;;;;;;GAWG;AAcH,OAAO,EAAE,QAAQ,EAAE,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ED,MAAM,QAAQ,GAAuB;gBACnC,WAAW;gBACX,aAAa;gBACb,sBAAsB;aACvB,CAAC;YAEF,MAAM,MAAM,GAAyB;gBACnC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC;gBAClC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,WAAW;gBACX,UAAU;gBACV,mBAAmB;gBACnB,cAAc,EAAE,kBAAkB;gBAClC,eAAe,EAAE,UAAU,CAAC,UAAU;aACvC,CAAC;YAEF,OAAO;gBACL,MAAM;gBACN,KAAK,EAAE,QAAQ;gBACf,UAAU,EAAE;oBACV,MAAM,EAAE,WAAW;oBACnB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Cognitive Agent Provider v3 — manual module composition (PRD 042 Phase 4).
3
+ *
4
+ * Architecture: BridgeMonitorModule + BridgeReasonerActorModule composed in a
5
+ * manual for-loop with monitor-first execution order. Module factories from
6
+ * cognitive-modules.ts encapsulate all behavioral logic (11 fixes from PRDs
7
+ * 033/040/041). This file owns the outer cycle engine and session lifecycle.
8
+ *
9
+ * Execution order per cycle:
10
+ * 1. Monitor reads last cycle's RA monitoring -> produces BridgeMonitorControl
11
+ * 2. RA runs inner while-loop with monitor's control applied immediately
12
+ *
13
+ * External interface unchanged: createCognitiveSession returning PtySession.
14
+ */
15
+ import type { ProviderAdapter, ToolProvider } from '@methodts/pacta';
16
+ import type { PtySession } from './print-session.js';
17
+ import type { StreamEvent } from './pool.js';
18
+ import type { CognitiveEventBusSink as CognitiveSink } from './cognitive-sink.js';
19
+ export interface CognitiveSessionConfig {
20
+ name?: string;
21
+ patterns?: string[];
22
+ maxCycles?: number;
23
+ maxToolsPerCycle?: number;
24
+ workspaceCapacity?: number;
25
+ confidenceThreshold?: number;
26
+ stagnationThreshold?: number;
27
+ interventionBudget?: number;
28
+ maxOutputTokens?: number;
29
+ }
30
+ export interface CognitiveSessionOptions {
31
+ id: string;
32
+ workdir: string;
33
+ onEvent: (event: StreamEvent) => void;
34
+ adapter: ProviderAdapter;
35
+ tools: ToolProvider;
36
+ config?: CognitiveSessionConfig;
37
+ initialPrompt?: string;
38
+ /** Optional CognitiveSink for emitting typed CognitiveEvents to the bridge event bus (PRD 026). */
39
+ cognitiveSink?: CognitiveSink;
40
+ }
41
+ export declare function createCognitiveSession(options: CognitiveSessionOptions): PtySession;
42
+ //# sourceMappingURL=cognitive-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cognitive-provider.d.ts","sourceRoot":"","sources":["../../src/sessions/cognitive-provider.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAEV,eAAe,EAEf,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,UAAU,EAAsC,MAAM,oBAAoB,CAAC;AACzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAYlF,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACtC,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mGAAmG;IACnG,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AASD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,UAAU,CA2MnF"}