wicked-crew 0.16.11 → 0.16.13

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 (341) hide show
  1. package/README.md +28 -8
  2. package/dist/api/artifact-outline.d.ts +64 -0
  3. package/dist/api/artifact-outline.d.ts.map +1 -0
  4. package/dist/api/artifact-outline.js +254 -0
  5. package/dist/api/artifact-outline.js.map +1 -0
  6. package/dist/api/beneath.d.ts +76 -0
  7. package/dist/api/beneath.d.ts.map +1 -0
  8. package/dist/api/beneath.js +214 -0
  9. package/dist/api/beneath.js.map +1 -0
  10. package/dist/api/capture.d.ts +2 -2
  11. package/dist/api/chat-citations.d.ts +25 -1
  12. package/dist/api/chat-citations.d.ts.map +1 -1
  13. package/dist/api/chat-citations.js +186 -61
  14. package/dist/api/chat-citations.js.map +1 -1
  15. package/dist/api/chat-context.d.ts +236 -0
  16. package/dist/api/chat-context.d.ts.map +1 -0
  17. package/dist/api/chat-context.js +808 -0
  18. package/dist/api/chat-context.js.map +1 -0
  19. package/dist/api/chat-history.d.ts +20 -0
  20. package/dist/api/chat-history.d.ts.map +1 -1
  21. package/dist/api/chat-history.js +46 -1
  22. package/dist/api/chat-history.js.map +1 -1
  23. package/dist/api/chat-proposals.d.ts +534 -0
  24. package/dist/api/chat-proposals.d.ts.map +1 -0
  25. package/dist/api/chat-proposals.js +1562 -0
  26. package/dist/api/chat-proposals.js.map +1 -0
  27. package/dist/api/chat-scope.d.ts +41 -0
  28. package/dist/api/chat-scope.d.ts.map +1 -1
  29. package/dist/api/chat-scope.js +87 -15
  30. package/dist/api/chat-scope.js.map +1 -1
  31. package/dist/api/chat-transcripts.d.ts +27 -2
  32. package/dist/api/chat-transcripts.d.ts.map +1 -1
  33. package/dist/api/chat-transcripts.js +105 -4
  34. package/dist/api/chat-transcripts.js.map +1 -1
  35. package/dist/api/diagnostics.d.ts +15 -0
  36. package/dist/api/diagnostics.d.ts.map +1 -1
  37. package/dist/api/diagnostics.js +56 -0
  38. package/dist/api/diagnostics.js.map +1 -1
  39. package/dist/api/elicitation-cache.d.ts +13 -0
  40. package/dist/api/elicitation-cache.d.ts.map +1 -1
  41. package/dist/api/elicitation-cache.js +12 -0
  42. package/dist/api/elicitation-cache.js.map +1 -1
  43. package/dist/api/eval-sample.d.ts +12 -12
  44. package/dist/api/frame-guard.d.ts +62 -0
  45. package/dist/api/frame-guard.d.ts.map +1 -0
  46. package/dist/api/frame-guard.js +97 -0
  47. package/dist/api/frame-guard.js.map +1 -0
  48. package/dist/api/governance-steering.d.ts +4 -4
  49. package/dist/api/multiscope.d.ts +3 -0
  50. package/dist/api/multiscope.d.ts.map +1 -1
  51. package/dist/api/multiscope.js +13 -0
  52. package/dist/api/multiscope.js.map +1 -1
  53. package/dist/api/needs.d.ts +6 -0
  54. package/dist/api/needs.d.ts.map +1 -1
  55. package/dist/api/needs.js +31 -4
  56. package/dist/api/needs.js.map +1 -1
  57. package/dist/api/product.d.ts.map +1 -1
  58. package/dist/api/product.js +13 -2
  59. package/dist/api/product.js.map +1 -1
  60. package/dist/api/project-aggregates.d.ts +6 -6
  61. package/dist/api/project-aggregates.d.ts.map +1 -1
  62. package/dist/api/project-aggregates.js +16 -24
  63. package/dist/api/project-aggregates.js.map +1 -1
  64. package/dist/api/requirements.d.ts +261 -6
  65. package/dist/api/requirements.d.ts.map +1 -1
  66. package/dist/api/requirements.js +344 -64
  67. package/dist/api/requirements.js.map +1 -1
  68. package/dist/api/routes.d.ts +156 -4
  69. package/dist/api/routes.d.ts.map +1 -1
  70. package/dist/api/routes.js +851 -78
  71. package/dist/api/routes.js.map +1 -1
  72. package/dist/api/run-brief.d.ts +78 -0
  73. package/dist/api/run-brief.d.ts.map +1 -0
  74. package/dist/api/run-brief.js +318 -0
  75. package/dist/api/run-brief.js.map +1 -0
  76. package/dist/api/run-files.d.ts.map +1 -1
  77. package/dist/api/run-files.js +5 -1
  78. package/dist/api/run-files.js.map +1 -1
  79. package/dist/api/run-timing-index.d.ts +27 -0
  80. package/dist/api/run-timing-index.d.ts.map +1 -1
  81. package/dist/api/run-timing-index.js +65 -0
  82. package/dist/api/run-timing-index.js.map +1 -1
  83. package/dist/api/seat-images.d.ts +102 -0
  84. package/dist/api/seat-images.d.ts.map +1 -0
  85. package/dist/api/seat-images.js +333 -0
  86. package/dist/api/seat-images.js.map +1 -0
  87. package/dist/api/server.d.ts +3 -0
  88. package/dist/api/server.d.ts.map +1 -1
  89. package/dist/api/server.js +265 -2
  90. package/dist/api/server.js.map +1 -1
  91. package/dist/api/steering-landing.d.ts +48 -1
  92. package/dist/api/steering-landing.d.ts.map +1 -1
  93. package/dist/api/steering-landing.js +116 -42
  94. package/dist/api/steering-landing.js.map +1 -1
  95. package/dist/api/system-snapshot.d.ts +51 -2
  96. package/dist/api/system-snapshot.d.ts.map +1 -1
  97. package/dist/api/system-snapshot.js +151 -15
  98. package/dist/api/system-snapshot.js.map +1 -1
  99. package/dist/api/testing.d.ts +4 -4
  100. package/dist/api/testing.js +2 -2
  101. package/dist/api/testing.js.map +1 -1
  102. package/dist/apps/spec.d.ts +3009 -0
  103. package/dist/apps/spec.d.ts.map +1 -0
  104. package/dist/apps/spec.js +870 -0
  105. package/dist/apps/spec.js.map +1 -0
  106. package/dist/campaigns/routes.js +1 -1
  107. package/dist/campaigns/routes.js.map +1 -1
  108. package/dist/cli/index.js +3 -3
  109. package/dist/cli/index.js.map +1 -1
  110. package/dist/core/adapter.d.ts +12 -0
  111. package/dist/core/adapter.d.ts.map +1 -1
  112. package/dist/core/adapter.js +36 -1
  113. package/dist/core/adapter.js.map +1 -1
  114. package/dist/core/deliver-text.d.ts.map +1 -1
  115. package/dist/core/deliver-text.js +22 -10
  116. package/dist/core/deliver-text.js.map +1 -1
  117. package/dist/core/estate-mcp-client.d.ts +7 -1
  118. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  119. package/dist/core/estate-mcp-client.js +10 -2
  120. package/dist/core/estate-mcp-client.js.map +1 -1
  121. package/dist/core/exec.d.ts +12 -0
  122. package/dist/core/exec.d.ts.map +1 -1
  123. package/dist/core/exec.js +23 -0
  124. package/dist/core/exec.js.map +1 -1
  125. package/dist/core/reassign-refusal.d.ts.map +1 -1
  126. package/dist/core/reassign-refusal.js +23 -3
  127. package/dist/core/reassign-refusal.js.map +1 -1
  128. package/dist/core/repoPaths.d.ts +32 -7
  129. package/dist/core/repoPaths.d.ts.map +1 -1
  130. package/dist/core/repoPaths.js +56 -9
  131. package/dist/core/repoPaths.js.map +1 -1
  132. package/dist/core/requirements-graph-setting.d.ts +32 -0
  133. package/dist/core/requirements-graph-setting.d.ts.map +1 -0
  134. package/dist/core/requirements-graph-setting.js +84 -0
  135. package/dist/core/requirements-graph-setting.js.map +1 -0
  136. package/dist/core/run-boot-resume.d.ts +4 -1
  137. package/dist/core/run-boot-resume.d.ts.map +1 -1
  138. package/dist/core/run-boot-resume.js +6 -1
  139. package/dist/core/run-boot-resume.js.map +1 -1
  140. package/dist/core/run-identity.d.ts.map +1 -1
  141. package/dist/core/run-identity.js +6 -0
  142. package/dist/core/run-identity.js.map +1 -1
  143. package/dist/core/types.d.ts +14 -0
  144. package/dist/core/types.d.ts.map +1 -1
  145. package/dist/core/types.js.map +1 -1
  146. package/dist/decisions/chat-recorder.d.ts +14 -3
  147. package/dist/decisions/chat-recorder.d.ts.map +1 -1
  148. package/dist/decisions/chat-recorder.js +54 -9
  149. package/dist/decisions/chat-recorder.js.map +1 -1
  150. package/dist/editors/csp.d.ts +24 -4
  151. package/dist/editors/csp.d.ts.map +1 -1
  152. package/dist/editors/csp.js +35 -8
  153. package/dist/editors/csp.js.map +1 -1
  154. package/dist/editors/registry.d.ts +46 -21
  155. package/dist/editors/registry.d.ts.map +1 -1
  156. package/dist/editors/registry.js +13 -2
  157. package/dist/editors/registry.js.map +1 -1
  158. package/dist/editors/routes.d.ts +4 -1
  159. package/dist/editors/routes.d.ts.map +1 -1
  160. package/dist/editors/routes.js +30 -3
  161. package/dist/editors/routes.js.map +1 -1
  162. package/dist/editors/visuals.d.ts +51 -0
  163. package/dist/editors/visuals.d.ts.map +1 -0
  164. package/dist/editors/visuals.js +164 -0
  165. package/dist/editors/visuals.js.map +1 -0
  166. package/dist/editors/webrtc-guard.d.ts +94 -0
  167. package/dist/editors/webrtc-guard.d.ts.map +1 -0
  168. package/dist/editors/webrtc-guard.js +506 -0
  169. package/dist/editors/webrtc-guard.js.map +1 -0
  170. package/dist/inspect/reading.d.ts +110 -0
  171. package/dist/inspect/reading.d.ts.map +1 -0
  172. package/dist/inspect/reading.js +325 -0
  173. package/dist/inspect/reading.js.map +1 -0
  174. package/dist/inspect/routes.d.ts +14 -0
  175. package/dist/inspect/routes.d.ts.map +1 -0
  176. package/dist/inspect/routes.js +44 -0
  177. package/dist/inspect/routes.js.map +1 -0
  178. package/dist/inspect/service.d.ts +161 -0
  179. package/dist/inspect/service.d.ts.map +1 -0
  180. package/dist/inspect/service.js +466 -0
  181. package/dist/inspect/service.js.map +1 -0
  182. package/dist/interactive/bridge-pool.d.ts +11 -2
  183. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  184. package/dist/interactive/bridge-pool.js +10 -1
  185. package/dist/interactive/bridge-pool.js.map +1 -1
  186. package/dist/interactive/doc-binding.d.ts +156 -0
  187. package/dist/interactive/doc-binding.d.ts.map +1 -0
  188. package/dist/interactive/doc-binding.js +277 -0
  189. package/dist/interactive/doc-binding.js.map +1 -0
  190. package/dist/interactive/doc-delete-routes.d.ts +3 -0
  191. package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
  192. package/dist/interactive/doc-delete-routes.js +4 -0
  193. package/dist/interactive/doc-delete-routes.js.map +1 -1
  194. package/dist/interactive/draft-events.d.ts +89 -3
  195. package/dist/interactive/draft-events.d.ts.map +1 -1
  196. package/dist/interactive/draft-events.js +441 -30
  197. package/dist/interactive/draft-events.js.map +1 -1
  198. package/dist/interactive/draft-skill.d.ts +7 -0
  199. package/dist/interactive/draft-skill.d.ts.map +1 -1
  200. package/dist/interactive/draft-skill.js +10 -3
  201. package/dist/interactive/draft-skill.js.map +1 -1
  202. package/dist/interactive/edit-events.d.ts +2 -0
  203. package/dist/interactive/edit-events.d.ts.map +1 -1
  204. package/dist/interactive/edit-events.js +11 -0
  205. package/dist/interactive/edit-events.js.map +1 -1
  206. package/dist/interactive/proposal-create.d.ts +143 -0
  207. package/dist/interactive/proposal-create.d.ts.map +1 -0
  208. package/dist/interactive/proposal-create.js +318 -0
  209. package/dist/interactive/proposal-create.js.map +1 -0
  210. package/dist/interactive/proxy-routes.d.ts +60 -3
  211. package/dist/interactive/proxy-routes.d.ts.map +1 -1
  212. package/dist/interactive/proxy-routes.js +217 -3
  213. package/dist/interactive/proxy-routes.js.map +1 -1
  214. package/dist/interactive/source-packet.d.ts +126 -0
  215. package/dist/interactive/source-packet.d.ts.map +1 -0
  216. package/dist/interactive/source-packet.js +482 -0
  217. package/dist/interactive/source-packet.js.map +1 -0
  218. package/dist/learnings/estate.d.ts +16 -0
  219. package/dist/learnings/estate.d.ts.map +1 -0
  220. package/dist/learnings/estate.js +68 -0
  221. package/dist/learnings/estate.js.map +1 -0
  222. package/dist/learnings/extract.d.ts +56 -0
  223. package/dist/learnings/extract.d.ts.map +1 -0
  224. package/dist/learnings/extract.js +252 -0
  225. package/dist/learnings/extract.js.map +1 -0
  226. package/dist/learnings/recall.d.ts +43 -0
  227. package/dist/learnings/recall.d.ts.map +1 -0
  228. package/dist/learnings/recall.js +104 -0
  229. package/dist/learnings/recall.js.map +1 -0
  230. package/dist/learnings/service.d.ts +183 -0
  231. package/dist/learnings/service.d.ts.map +1 -0
  232. package/dist/learnings/service.js +571 -0
  233. package/dist/learnings/service.js.map +1 -0
  234. package/dist/mcp/ask-server.d.ts.map +1 -1
  235. package/dist/mcp/ask-server.js +37 -4
  236. package/dist/mcp/ask-server.js.map +1 -1
  237. package/dist/mcp/broker.d.ts +12 -1
  238. package/dist/mcp/broker.d.ts.map +1 -1
  239. package/dist/mcp/broker.js +24 -5
  240. package/dist/mcp/broker.js.map +1 -1
  241. package/dist/mcp/invoke.d.ts +26 -2
  242. package/dist/mcp/invoke.d.ts.map +1 -1
  243. package/dist/mcp/invoke.js +51 -5
  244. package/dist/mcp/invoke.js.map +1 -1
  245. package/dist/persona/routes.d.ts +92 -0
  246. package/dist/persona/routes.d.ts.map +1 -0
  247. package/dist/persona/routes.js +69 -0
  248. package/dist/persona/routes.js.map +1 -0
  249. package/dist/persona/store.d.ts +104 -0
  250. package/dist/persona/store.d.ts.map +1 -0
  251. package/dist/persona/store.js +176 -0
  252. package/dist/persona/store.js.map +1 -0
  253. package/dist/persona/voice.d.ts +4 -0
  254. package/dist/persona/voice.d.ts.map +1 -0
  255. package/dist/persona/voice.js +58 -0
  256. package/dist/persona/voice.js.map +1 -0
  257. package/dist/projects/routes.d.ts +2 -2
  258. package/dist/setup/known.d.ts +56 -0
  259. package/dist/setup/known.d.ts.map +1 -0
  260. package/dist/setup/known.js +159 -0
  261. package/dist/setup/known.js.map +1 -0
  262. package/dist/setup/routes.d.ts +13 -0
  263. package/dist/setup/routes.d.ts.map +1 -0
  264. package/dist/setup/routes.js +20 -0
  265. package/dist/setup/routes.js.map +1 -0
  266. package/dist/standing-orders/history.d.ts +2 -0
  267. package/dist/standing-orders/history.d.ts.map +1 -1
  268. package/dist/standing-orders/history.js +1 -0
  269. package/dist/standing-orders/history.js.map +1 -1
  270. package/dist/studio/assets/WickedSans-Regular-fb698rcD.woff2 +0 -0
  271. package/dist/studio/assets/WickedSans-SemiBold-CD53n1AC.woff2 +0 -0
  272. package/dist/studio/assets/WickedScript-Regular-CY5juO6I.woff2 +0 -0
  273. package/dist/studio/assets/WickedSerif-Regular-mdPEjaVZ.woff2 +0 -0
  274. package/dist/studio/assets/index-BUZ_-Syk.css +32 -0
  275. package/dist/studio/assets/index-u4O_7N-b.js +986 -0
  276. package/dist/studio/editors/wicked-deck/editor.json +6 -1
  277. package/dist/studio/editors/wicked-deck/icon.svg +1 -0
  278. package/dist/studio/editors/wicked-deck/index.html +1 -1
  279. package/dist/studio/editors/wicked-doc/editor.json +6 -1
  280. package/dist/studio/editors/wicked-doc/icon.svg +1 -0
  281. package/dist/studio/editors/wicked-doc/index.html +1 -1
  282. package/dist/studio/editors/wicked-insights/editor.json +6 -1
  283. package/dist/studio/editors/wicked-insights/icon.svg +1 -0
  284. package/dist/studio/editors/wicked-insights/index.html +1 -1
  285. package/dist/studio/editors/wicked-page/editor.json +6 -1
  286. package/dist/studio/editors/wicked-page/icon.svg +1 -0
  287. package/dist/studio/editors/wicked-page/index.html +1 -1
  288. package/dist/studio/editors/wicked-video/editor.json +6 -1
  289. package/dist/studio/editors/wicked-video/icon.svg +1 -0
  290. package/dist/studio/editors/wicked-video/index.html +1 -1
  291. package/dist/studio/index.html +2 -2
  292. package/dist/studio/testid-inventory.json +5155 -2707
  293. package/dist/voice/dashboard.d.ts +376 -0
  294. package/dist/voice/dashboard.d.ts.map +1 -0
  295. package/dist/voice/dashboard.js +92 -0
  296. package/dist/voice/dashboard.js.map +1 -0
  297. package/dist/voice/inject-input.d.ts +51 -0
  298. package/dist/voice/inject-input.d.ts.map +1 -0
  299. package/dist/voice/inject-input.js +126 -0
  300. package/dist/voice/inject-input.js.map +1 -0
  301. package/dist/voice/routes.d.ts +41 -0
  302. package/dist/voice/routes.d.ts.map +1 -0
  303. package/dist/voice/routes.js +116 -0
  304. package/dist/voice/routes.js.map +1 -0
  305. package/dist/voice/service.d.ts +177 -0
  306. package/dist/voice/service.d.ts.map +1 -0
  307. package/dist/voice/service.js +400 -0
  308. package/dist/voice/service.js.map +1 -0
  309. package/dist/workflow-catalog/build.d.ts +35 -0
  310. package/dist/workflow-catalog/build.d.ts.map +1 -0
  311. package/dist/workflow-catalog/build.js +229 -0
  312. package/dist/workflow-catalog/build.js.map +1 -0
  313. package/dist/workflow-catalog/catalog-data.d.ts +36 -0
  314. package/dist/workflow-catalog/catalog-data.d.ts.map +1 -0
  315. package/dist/workflow-catalog/catalog-data.js +430 -0
  316. package/dist/workflow-catalog/catalog-data.js.map +1 -0
  317. package/dist/working-doc/event-lines.d.ts +76 -0
  318. package/dist/working-doc/event-lines.d.ts.map +1 -0
  319. package/dist/working-doc/event-lines.js +247 -0
  320. package/dist/working-doc/event-lines.js.map +1 -0
  321. package/dist/working-doc/routes.d.ts +1 -1
  322. package/dist/working-doc/routes.d.ts.map +1 -1
  323. package/dist/working-doc/routes.js +2 -1
  324. package/dist/working-doc/routes.js.map +1 -1
  325. package/dist/working-doc/sections.d.ts +3 -1
  326. package/dist/working-doc/sections.d.ts.map +1 -1
  327. package/dist/working-doc/sections.js +4 -2
  328. package/dist/working-doc/sections.js.map +1 -1
  329. package/dist/working-doc/service.d.ts +66 -1
  330. package/dist/working-doc/service.d.ts.map +1 -1
  331. package/dist/working-doc/service.js +298 -22
  332. package/dist/working-doc/service.js.map +1 -1
  333. package/dist/working-doc/store.d.ts +8 -2
  334. package/dist/working-doc/store.d.ts.map +1 -1
  335. package/dist/working-doc/store.js.map +1 -1
  336. package/endpoint-manifest.json +205 -2
  337. package/package.json +5 -4
  338. package/workflows/distill-learnings.json +27 -0
  339. package/workflows/inspect-unit.json +27 -0
  340. package/dist/studio/assets/index-B-f_VEL2.css +0 -32
  341. package/dist/studio/assets/index-DhkxIK-0.js +0 -845
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Run learnings, part 1: what a run's own record says it learned (the operator's 2026-10-30 ask:
3
+ * "with all the run activity, no memories or learnings are being saved").
4
+ *
5
+ * Pure. A run's `SessionView` (its units, as `GET /runs/:id` serves them) and its recorded events in,
6
+ * a list of {@link LearningCandidate}s out. Nothing is written here; {@link ./service.ts} decides
7
+ * what is filed, and everything filed is a PROPOSAL a person approves (never a direct memory write).
8
+ *
9
+ * Two kinds of candidate:
10
+ *
11
+ * - `template` candidates are worded here, from structured fields, and are filed as they are, at
12
+ * the run's checkpoints: a test the floor saw fail and then pass on its identical retry (flaky
13
+ * under load), and a check the floor could not start in its sandbox.
14
+ * - `material` candidates are raw evidence a person or a seat wrote: the operator's rulings at a
15
+ * gate (a floor override, a QE skip, each with its reason), standing steers from the working
16
+ * document, the orchestrator's recorded decisions and their reasons, a QE reviewer that could
17
+ * not run its checks, a reviewer that asked for changes, a check that was red on the base too
18
+ * or ran out of time. They are long and run-specific, so at the end of the run ONE distinct,
19
+ * cheap seat distils them into durable learnings (the builder never grades itself). Only when no
20
+ * such seat can run are they filed raw, trimmed, for the person to edit or reject.
21
+ */
22
+ import type { SessionView } from 'wicked-crew-api-types';
23
+ import type { LooseEvent } from '../insights/run-facts.js';
24
+ /** What a learning is (the payload's `capture`). */
25
+ export type LearningKind = 'gotcha' | 'decision' | 'pattern' | 'steering';
26
+ /** Where a candidate came from in the run's record. */
27
+ export type LearningSource = 'repo_checks' | 'operator_ruling' | 'steer' | 'working_notes' | 'qe_review' | 'review';
28
+ export interface LearningCandidate {
29
+ /** Stable identity across sweeps of the same run (and across runs for a template). */
30
+ key: string;
31
+ kind: LearningKind;
32
+ source: LearningSource;
33
+ /** `template`: worded here, filed as is. `material`: evidence for the distil seat. */
34
+ form: 'template' | 'material';
35
+ content: string;
36
+ /** The unit it came from, when one did. */
37
+ ord: number | null;
38
+ /** The seat whose work it is about, when one is. */
39
+ cli: string | null;
40
+ }
41
+ /** The longest material text kept per candidate (a ruling, a steer, a review). */
42
+ export declare const MATERIAL_MAX_CHARS = 1500;
43
+ /** Whitespace-folded, lower-cased text: the dedupe form of a learning. */
44
+ export declare function normalizeLearning(text: string): string;
45
+ /** The run's repository name, as the run names it. */
46
+ export declare function repoOf(view: SessionView): string | null;
47
+ /** The project the run is filed in, when it is. */
48
+ export declare function projectOf(view: SessionView): string | null;
49
+ /** Every seat that worked on this run: the power-mode lead, each non-reviewing unit's seat and every earlier author of it. */
50
+ export declare function creatorSeats(view: SessionView): string[];
51
+ /**
52
+ * Every learning candidate in a run's record so far. Safe to call at any point of a run (a checkpoint)
53
+ * and again at its end: the same evidence yields the same keys.
54
+ */
55
+ export declare function extractLearnings(view: SessionView, events: readonly LooseEvent[]): LearningCandidate[];
56
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/learnings/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,oDAAoD;AACpD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAE1E,uDAAuD;AACvD,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,iBAAiB,GACjB,OAAO,GACP,eAAe,GACf,WAAW,GACX,QAAQ,CAAC;AAEb,MAAM,WAAW,iBAAiB;IAChC,sFAAsF;IACtF,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,sFAAsF;IACtF,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,oDAAoD;IACpD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAQvC,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAuBD,sDAAsD;AACtD,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAEvD;AAED,mDAAmD;AACnD,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAE1D;AAED,8HAA8H;AAC9H,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,EAAE,CAexD;AAgKD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,UAAU,EAAE,GAAG,iBAAiB,EAAE,CAKtG"}
@@ -0,0 +1,252 @@
1
+ /**
2
+ * Run learnings, part 1: what a run's own record says it learned (the operator's 2026-10-30 ask:
3
+ * "with all the run activity, no memories or learnings are being saved").
4
+ *
5
+ * Pure. A run's `SessionView` (its units, as `GET /runs/:id` serves them) and its recorded events in,
6
+ * a list of {@link LearningCandidate}s out. Nothing is written here; {@link ./service.ts} decides
7
+ * what is filed, and everything filed is a PROPOSAL a person approves (never a direct memory write).
8
+ *
9
+ * Two kinds of candidate:
10
+ *
11
+ * - `template` candidates are worded here, from structured fields, and are filed as they are, at
12
+ * the run's checkpoints: a test the floor saw fail and then pass on its identical retry (flaky
13
+ * under load), and a check the floor could not start in its sandbox.
14
+ * - `material` candidates are raw evidence a person or a seat wrote: the operator's rulings at a
15
+ * gate (a floor override, a QE skip, each with its reason), standing steers from the working
16
+ * document, the orchestrator's recorded decisions and their reasons, a QE reviewer that could
17
+ * not run its checks, a reviewer that asked for changes, a check that was red on the base too
18
+ * or ran out of time. They are long and run-specific, so at the end of the run ONE distinct,
19
+ * cheap seat distils them into durable learnings (the builder never grades itself). Only when no
20
+ * such seat can run are they filed raw, trimmed, for the person to edit or reject.
21
+ */
22
+ import { createHash } from 'node:crypto';
23
+ /** The longest material text kept per candidate (a ruling, a steer, a review). */
24
+ export const MATERIAL_MAX_CHARS = 1500;
25
+ /** The most test names one template names. */
26
+ const MAX_TESTS_NAMED = 6;
27
+ const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
28
+ const str = (v) => (typeof v === 'string' && v.trim() !== '' ? v : null);
29
+ const strings = (v) => (Array.isArray(v) ? v.filter((s) => typeof s === 'string' && s.trim() !== '') : []);
30
+ /** Whitespace-folded, lower-cased text: the dedupe form of a learning. */
31
+ export function normalizeLearning(text) {
32
+ return text.replace(/\s+/gu, ' ').trim().toLowerCase();
33
+ }
34
+ function keyOf(kind, text) {
35
+ return `${kind}:${createHash('sha256').update(normalizeLearning(text)).digest('hex').slice(0, 16)}`;
36
+ }
37
+ function clip(text, max = MATERIAL_MAX_CHARS) {
38
+ const t = text.trim();
39
+ return t.length <= max ? t : `${t.slice(0, max - 1).trimEnd()}…`;
40
+ }
41
+ /** A test id as the runner printed it, without the runner's own prefix. */
42
+ function testName(id) {
43
+ return id.replace(/^(FAIL|test)\s+/u, '').replace(/\s+\[[^\]]*\]$/u, '').trim();
44
+ }
45
+ function namesList(ids) {
46
+ const names = [...new Set(ids.map(testName))].filter((n) => n !== '');
47
+ const shown = names.slice(0, MAX_TESTS_NAMED).map((n) => `\`${n}\``);
48
+ const more = names.length - shown.length;
49
+ return more > 0 ? `${shown.join(', ')} and ${more} more` : shown.join(', ');
50
+ }
51
+ /** The run's repository name, as the run names it. */
52
+ export function repoOf(view) {
53
+ return str(view.session['repo_ref']);
54
+ }
55
+ /** The project the run is filed in, when it is. */
56
+ export function projectOf(view) {
57
+ return str(view.session['project_id']);
58
+ }
59
+ /** Every seat that worked on this run: the power-mode lead, each non-reviewing unit's seat and every earlier author of it. */
60
+ export function creatorSeats(view) {
61
+ const out = new Set();
62
+ const team = view.session['team'];
63
+ const primary = isRecord(team) && isRecord(team['primary']) ? str(team['primary']['cli']) : null;
64
+ if (primary !== null)
65
+ out.add(primary);
66
+ for (const u of view.units) {
67
+ // Every seat that did the run's work: a creator, and a neutral step's seat (triage, recon, plan). Only a
68
+ // reviewing seat (an evaluator) may distil, since it judged the work rather than producing it.
69
+ if (u['role'] === 'evaluator')
70
+ continue;
71
+ const cli = str(u['assigned_cli']);
72
+ if (cli !== null)
73
+ out.add(cli);
74
+ // A reassigned or failed-over unit: every seat that authored it built this run too.
75
+ for (const author of strings(u['authored_by']))
76
+ out.add(author);
77
+ }
78
+ return [...out];
79
+ }
80
+ function unitsOf(view) {
81
+ return view.units.filter(isRecord);
82
+ }
83
+ /** The floor's per-check records of a unit, flattened (head run first, then its reruns). */
84
+ function checksOf(unit) {
85
+ const rc = unit['repo_checks'];
86
+ if (!isRecord(rc) || !Array.isArray(rc['checks']))
87
+ return [];
88
+ return rc['checks'].filter(isRecord);
89
+ }
90
+ function fromRepoChecks(view, repo) {
91
+ const out = [];
92
+ for (const unit of unitsOf(view)) {
93
+ const ord = typeof unit['ord'] === 'number' ? unit['ord'] : null;
94
+ for (const check of checksOf(unit)) {
95
+ const name = str(check['name']) ?? 'a check';
96
+ const decision = isRecord(check['decision']) ? check['decision'] : {};
97
+ const outcome = str(decision['outcome']);
98
+ // A check's own retry cleared these, or the engine's identical retry passed the whole check.
99
+ const flakyIds = new Set(strings(check['flaky_ids']));
100
+ for (const rerun of Array.isArray(check['reruns']) ? check['reruns'].filter(isRecord) : []) {
101
+ for (const id of strings(rerun['flaky_ids']))
102
+ flakyIds.add(id);
103
+ }
104
+ if (flakyIds.size > 0) {
105
+ for (const id of flakyIds) {
106
+ const content = `In ${repo}, the test \`${testName(id)}\` (repo check \`${name}\`) is flaky: it failed and then passed ` +
107
+ `on a re-run of the same tree. A lone failure of it is not evidence against a change; re-run it before debugging.`;
108
+ out.push({ key: keyOf('gotcha', content), kind: 'gotcha', source: 'repo_checks', form: 'template', content, ord, cli: null });
109
+ }
110
+ }
111
+ else if (decision['flaky'] === true || check['classification'] === 'flaky_under_load') {
112
+ const failed = strings(check['failure_ids']);
113
+ const which = failed.length > 0 ? ` (it failed on ${namesList(failed)})` : '';
114
+ const content = `In ${repo}, the repo check \`${name}\` failed on an oversubscribed host and passed on its identical retry${which}. ` +
115
+ `It is load-sensitive: retry it on a quieter host before treating a failure as the change's.`;
116
+ out.push({ key: keyOf('gotcha', content), kind: 'gotcha', source: 'repo_checks', form: 'template', content, ord, cli: null });
117
+ }
118
+ if (outcome === 'could_not_run') {
119
+ const why = str(decision['reason']) ?? str(check['stderr_tail']) ?? 'no reason recorded';
120
+ const content = `In ${repo}, the repo check \`${name}\` could not be started in the run's sandbox: ${clip(why, 300)}. ` +
121
+ `Check its tools are on the seat's PATH before blaming the change.`;
122
+ out.push({ key: keyOf('gotcha', content), kind: 'gotcha', source: 'repo_checks', form: 'template', content, ord, cli: null });
123
+ }
124
+ if (outcome === 'base_red_unseparated' || outcome === 'timed_out' || outcome === 'flaky_twice') {
125
+ const base = isRecord(check['base']) && isRecord(check['base']['run']) ? check['base']['run'] : null;
126
+ const baseFailed = base !== null ? strings(base['failure_ids']) : [];
127
+ const headFailed = strings(check['failure_ids']);
128
+ const lines = [
129
+ `Repo check \`${name}\` in ${repo}: ${outcome.replace(/_/gu, ' ')}${str(decision['reason']) !== null ? ` (${str(decision['reason'])})` : ''}.`,
130
+ str(check['bound_note']) !== null ? `Bound: ${str(check['bound_note'])}.` : '',
131
+ headFailed.length > 0 ? `Failed on the change: ${namesList(headFailed)}.` : '',
132
+ baseFailed.length > 0 ? `Failed on the base commit too: ${namesList(baseFailed)}.` : '',
133
+ ].filter((l) => l !== '');
134
+ const content = lines.join(' ');
135
+ out.push({ key: keyOf('gotcha', content), kind: 'gotcha', source: 'repo_checks', form: 'material', content, ord, cli: null });
136
+ }
137
+ }
138
+ }
139
+ return out;
140
+ }
141
+ /** "floor overridden by operator (local (human)): <reason>" → "<reason>" with the action named. */
142
+ function rulingText(ruling) {
143
+ const text = str(ruling['text']);
144
+ if (text === null)
145
+ return null;
146
+ const action = str(ruling['action']) ?? 'ruling';
147
+ const reason = text.replace(/^[^:]{0,120}\((?:[^()]|\([^()]*\))*\):\s*/u, '').trim();
148
+ const label = action === 'operator_judgment' ? 'The operator overrode a failed check' : action === 'skip_qe' ? 'The operator skipped QE acceptance' : `The operator ruled (${action})`;
149
+ return `${label}: ${reason}`;
150
+ }
151
+ function fromOperatorRulings(view) {
152
+ const out = [];
153
+ const seen = new Set();
154
+ for (const unit of unitsOf(view)) {
155
+ const ord = typeof unit['ord'] === 'number' ? unit['ord'] : null;
156
+ for (const ruling of Array.isArray(unit['operator_rulings']) ? unit['operator_rulings'].filter(isRecord) : []) {
157
+ const text = rulingText(ruling);
158
+ if (text === null)
159
+ continue;
160
+ const content = clip(text);
161
+ const key = keyOf('steering', content);
162
+ if (seen.has(key))
163
+ continue;
164
+ seen.add(key);
165
+ out.push({ key, kind: 'steering', source: 'operator_ruling', form: 'material', content, ord, cli: null });
166
+ }
167
+ }
168
+ return out;
169
+ }
170
+ /** The QE reviewer could not run its checks: what it said it lacked is a sandbox fact worth keeping. */
171
+ function fromQeReview(view) {
172
+ const out = [];
173
+ for (const unit of unitsOf(view)) {
174
+ const qe = unit['qe_review'];
175
+ if (!isRecord(qe) || qe['outcome'] !== 'inconclusive')
176
+ continue;
177
+ const reason = str(qe['reason']);
178
+ if (reason === null)
179
+ continue;
180
+ const content = clip(`The QE reviewer could not run its checks: ${reason}`);
181
+ const attempts = Array.isArray(qe['attempts']) ? qe['attempts'].filter(isRecord) : [];
182
+ const seat = attempts.length > 0 ? str(attempts[attempts.length - 1]?.['seat']) : null;
183
+ out.push({ key: keyOf('gotcha', content), kind: 'gotcha', source: 'qe_review', form: 'material', content, ord: typeof unit['ord'] === 'number' ? unit['ord'] : null, cli: seat });
184
+ }
185
+ return out;
186
+ }
187
+ /** A standing steer the operator wrote (the working document's Constraints, a typed message). */
188
+ function steerText(message) {
189
+ const body = message
190
+ .replace(/\[working-doc [^\]]*\]\s*$/u, '')
191
+ .split('\n')
192
+ .filter((l) => !/^(Operator steering from|It adds to your brief|It replaces any standing)/u.test(l.trim()))
193
+ .join('\n')
194
+ .trim();
195
+ return body === '' ? null : body;
196
+ }
197
+ function fromEvents(events) {
198
+ const out = [];
199
+ const seen = new Set();
200
+ const push = (c) => {
201
+ if (seen.has(c.key))
202
+ return;
203
+ seen.add(c.key);
204
+ out.push(c);
205
+ };
206
+ for (const e of events) {
207
+ const ord = typeof e.ord === 'number' ? e.ord : null;
208
+ if (e.type === 'workerMessageQueued') {
209
+ const message = str(e['message']);
210
+ // Only a person's steer: the engine's own queued messages do not say they are the operator's.
211
+ if (message === null || !/operator/iu.test(message.slice(0, 200)))
212
+ continue;
213
+ const body = steerText(message);
214
+ if (body === null)
215
+ continue;
216
+ const content = clip(`The operator steered the work: ${body}`);
217
+ push({ key: keyOf('steering', content), kind: 'steering', source: 'steer', form: 'material', content, ord, cli: null });
218
+ }
219
+ else if (e.type === 'powerWorkingNotes') {
220
+ const seat = str(e['seat']);
221
+ for (const d of Array.isArray(e['decisions']) ? e['decisions'].filter(isRecord) : []) {
222
+ const text = str(d['text']);
223
+ if (text === null)
224
+ continue;
225
+ const why = str(d['why']);
226
+ const content = clip(why !== null ? `Decision: ${text.trim()} Because: ${why.trim()}` : `Decision: ${text.trim()}`);
227
+ push({ key: keyOf('decision', content), kind: 'decision', source: 'working_notes', form: 'material', content, ord, cli: seat });
228
+ }
229
+ }
230
+ else if (e.type === 'gateEvaluated') {
231
+ // A distinct reviewer or judge that did NOT pass the work: what it flagged is a pattern candidate.
232
+ const verdict = (str(e['agentVerdict']) ?? str(e['evaluatorVerdict']) ?? '').toLowerCase();
233
+ const reasoning = str(e['agentReasoning']);
234
+ if (reasoning === null || verdict === '' || verdict === 'pass' || verdict === 'none')
235
+ continue;
236
+ const content = clip(`A reviewer flagged (${verdict}): ${reasoning}`);
237
+ push({ key: keyOf('pattern', content), kind: 'pattern', source: 'review', form: 'material', content, ord, cli: str(e['judgeCli']) });
238
+ }
239
+ }
240
+ return out;
241
+ }
242
+ /**
243
+ * Every learning candidate in a run's record so far. Safe to call at any point of a run (a checkpoint)
244
+ * and again at its end: the same evidence yields the same keys.
245
+ */
246
+ export function extractLearnings(view, events) {
247
+ const repo = repoOf(view) ?? 'this repository';
248
+ const all = [...fromRepoChecks(view, repo), ...fromOperatorRulings(view), ...fromQeReview(view), ...fromEvents(events)];
249
+ const seen = new Set();
250
+ return all.filter((c) => (seen.has(c.key) ? false : (seen.add(c.key), true)));
251
+ }
252
+ //# sourceMappingURL=extract.js.map
@@ -0,0 +1 @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CAAC,EAAE,CAAC,CAAC;QACvI,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAiB,EAAE,MAA6B;IAC/E,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC;IAC/C,MAAM,GAAG,GAAG,CAAC,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACxH,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Run learnings, part 3: an approved learning reaches the next run's brief.
3
+ *
4
+ * At launch the daemon reads the memory store (`memory.list`, the complete set: relevance recall
5
+ * excludes faceted memories under an empty intent) and appends the approved learnings that apply to
6
+ * this run to its problem, inside a marked block (like the linked-issues block) the deliver text
7
+ * takes back out. A memory applies when every repo/project facet it carries matches the run's: one
8
+ * faceted to another repository or project never crosses over; one with neither facet (an operator
9
+ * preference, a pattern a person widened) applies everywhere. The run's own words rank them; at
10
+ * most {@link MAX_RECALLED} are included, so a large store never floods a brief.
11
+ *
12
+ * Best-effort by contract: a store that cannot be read launches the run without the block.
13
+ */
14
+ export declare const RUN_LEARNINGS_OPEN = "<!-- wicked-crew:learnings -->";
15
+ export declare const RUN_LEARNINGS_CLOSE = "<!-- /wicked-crew:learnings -->";
16
+ export declare const MAX_RECALLED = 8;
17
+ export interface MemoryRow {
18
+ memory_id?: string;
19
+ content: string;
20
+ facets: Record<string, unknown>;
21
+ created_at?: number;
22
+ }
23
+ /** Whether a memory's repo/project facets allow it in a run on `repo` filed in `project`. */
24
+ export declare function appliesTo(facets: Record<string, unknown>, repo: string | null, project: string | null): boolean;
25
+ /** The learnings that apply, best first: scoped to this repo/project before general ones, then by overlap with the problem, then newest. */
26
+ export declare function selectLearnings(rows: readonly MemoryRow[], problem: string, repo: string | null, project: string | null, max?: number): MemoryRow[];
27
+ /** The marked block, or `null` when nothing applies. */
28
+ export declare function learningsBlock(selected: readonly MemoryRow[]): string | null;
29
+ /** `problem` with every learnings block the daemon appended taken back out. */
30
+ export declare function stripRunLearnings(problem: string): string;
31
+ /** Append the block to a launch's problem. Returns the problem unchanged when nothing applies. */
32
+ export declare function withRunLearnings(raw: string, rows: readonly MemoryRow[], repo: string | null, project: string | null): {
33
+ problem: string;
34
+ recalled: number;
35
+ };
36
+ /** `memory.list` read loosely into rows (a malformed item is skipped). */
37
+ export declare function memoryRows(raw: unknown): MemoryRow[];
38
+ /** The launch hook: read the store through `estateTool` and append what applies. */
39
+ export declare function recallLearnings(estateTool: (tool: string, args: Record<string, unknown>) => Promise<unknown>, problem: string, repo: string | null, project: string | null): Promise<{
40
+ problem: string;
41
+ recalled: number;
42
+ }>;
43
+ //# sourceMappingURL=recall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recall.d.ts","sourceRoot":"","sources":["../../src/learnings/recall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,kBAAkB,mCAAmC,CAAC;AACnE,eAAO,MAAM,mBAAmB,oCAAoC,CAAC;AACrE,eAAO,MAAM,YAAY,IAAI,CAAC;AAI9B,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM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O,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAEhD"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Run learnings, part 3: an approved learning reaches the next run's brief.
3
+ *
4
+ * At launch the daemon reads the memory store (`memory.list`, the complete set: relevance recall
5
+ * excludes faceted memories under an empty intent) and appends the approved learnings that apply to
6
+ * this run to its problem, inside a marked block (like the linked-issues block) the deliver text
7
+ * takes back out. A memory applies when every repo/project facet it carries matches the run's: one
8
+ * faceted to another repository or project never crosses over; one with neither facet (an operator
9
+ * preference, a pattern a person widened) applies everywhere. The run's own words rank them; at
10
+ * most {@link MAX_RECALLED} are included, so a large store never floods a brief.
11
+ *
12
+ * Best-effort by contract: a store that cannot be read launches the run without the block.
13
+ */
14
+ export const RUN_LEARNINGS_OPEN = '<!-- wicked-crew:learnings -->';
15
+ export const RUN_LEARNINGS_CLOSE = '<!-- /wicked-crew:learnings -->';
16
+ export const MAX_RECALLED = 8;
17
+ /** The longest one recalled learning may be in a brief. */
18
+ const MAX_RECALLED_CHARS = 600;
19
+ const WORD = /[a-z0-9][a-z0-9_.-]{2,}/gu;
20
+ function words(text) {
21
+ return new Set(text.toLowerCase().match(WORD) ?? []);
22
+ }
23
+ /** Whether a memory's repo/project facets allow it in a run on `repo` filed in `project`. */
24
+ export function appliesTo(facets, repo, project) {
25
+ const r = typeof facets['repo'] === 'string' ? facets['repo'] : null;
26
+ const p = typeof facets['project'] === 'string' ? facets['project'] : null;
27
+ if (r !== null && r !== repo)
28
+ return false;
29
+ if (p !== null && p !== project)
30
+ return false;
31
+ return true;
32
+ }
33
+ /** The learnings that apply, best first: scoped to this repo/project before general ones, then by overlap with the problem, then newest. */
34
+ export function selectLearnings(rows, problem, repo, project, max = MAX_RECALLED) {
35
+ const asked = words(problem);
36
+ const scored = rows
37
+ .filter((m) => typeof m.content === 'string' && m.content.trim() !== '' && appliesTo(m.facets ?? {}, repo, project))
38
+ .map((m) => {
39
+ const scoped = (typeof m.facets['repo'] === 'string' ? 2 : 0) + (typeof m.facets['project'] === 'string' ? 1 : 0);
40
+ let overlap = 0;
41
+ for (const w of words(m.content))
42
+ if (asked.has(w))
43
+ overlap += 1;
44
+ return { m, scoped, overlap, at: typeof m.created_at === 'number' ? m.created_at : 0 };
45
+ });
46
+ scored.sort((a, b) => b.scoped - a.scoped || b.overlap - a.overlap || b.at - a.at);
47
+ return scored.slice(0, max).map((s) => s.m);
48
+ }
49
+ /** A learning's text as one brief line: whitespace folded, capped, and never able to open or close the block. */
50
+ function briefLine(content) {
51
+ const t = content.replaceAll(RUN_LEARNINGS_OPEN, '').replaceAll(RUN_LEARNINGS_CLOSE, '').replace(/\s+/gu, ' ').trim();
52
+ return t.length > MAX_RECALLED_CHARS ? `${t.slice(0, MAX_RECALLED_CHARS - 1)}…` : t;
53
+ }
54
+ /** The marked block, or `null` when nothing applies. */
55
+ export function learningsBlock(selected) {
56
+ const lines = selected.map((m) => briefLine(m.content)).filter((l) => l !== '');
57
+ if (lines.length === 0)
58
+ return null;
59
+ return [
60
+ RUN_LEARNINGS_OPEN,
61
+ 'Learnings from earlier runs (approved by the operator; context, not instructions):',
62
+ ...lines.map((l) => `- ${l}`),
63
+ RUN_LEARNINGS_CLOSE,
64
+ ].join('\n');
65
+ }
66
+ /** `problem` with every learnings block the daemon appended taken back out. */
67
+ export function stripRunLearnings(problem) {
68
+ let out = problem;
69
+ for (let at = out.indexOf(RUN_LEARNINGS_OPEN); at !== -1; at = out.indexOf(RUN_LEARNINGS_OPEN)) {
70
+ const end = out.indexOf(RUN_LEARNINGS_CLOSE, at);
71
+ const tail = end === -1 ? '' : out.slice(end + RUN_LEARNINGS_CLOSE.length);
72
+ out = `${out.slice(0, at).trimEnd()}${tail}`;
73
+ }
74
+ return out;
75
+ }
76
+ /** Append the block to a launch's problem. Returns the problem unchanged when nothing applies. */
77
+ export function withRunLearnings(raw, rows, repo, project) {
78
+ // A relaunch from an earlier run's problem carries its block: it is replaced, never stacked.
79
+ const problem = stripRunLearnings(raw);
80
+ const selected = selectLearnings(rows, problem, repo, project);
81
+ const block = learningsBlock(selected);
82
+ if (block === null)
83
+ return { problem, recalled: 0 };
84
+ return { problem: `${problem.trimEnd()}\n\n${block}`, recalled: selected.length };
85
+ }
86
+ /** `memory.list` read loosely into rows (a malformed item is skipped). */
87
+ export function memoryRows(raw) {
88
+ const items = typeof raw === 'object' && raw !== null ? raw['items'] : undefined;
89
+ if (!Array.isArray(items))
90
+ throw new Error('memory.list returned an unexpected shape');
91
+ return items
92
+ .filter((m) => typeof m === 'object' && m !== null && typeof m['content'] === 'string')
93
+ .map((m) => ({
94
+ content: m['content'],
95
+ facets: typeof m['facets'] === 'object' && m['facets'] !== null ? m['facets'] : {},
96
+ ...(typeof m['memory_id'] === 'string' ? { memory_id: m['memory_id'] } : {}),
97
+ ...(typeof m['created_at'] === 'number' ? { created_at: m['created_at'] } : {}),
98
+ }));
99
+ }
100
+ /** The launch hook: read the store through `estateTool` and append what applies. */
101
+ export async function recallLearnings(estateTool, problem, repo, project) {
102
+ return withRunLearnings(problem, memoryRows(await estateTool('memory.list', {})), repo, project);
103
+ }
104
+ //# sourceMappingURL=recall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recall.js","sourceRoot":"","sources":["../../src/learnings/recall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gCAAgC,CAAC;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AACrE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,2DAA2D;AAC3D,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAS/B,MAAM,IAAI,GAAG,2BAA2B,CAAC;AAEzC,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,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