@yaks/session 0.0.0-stage → 0.2.36

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 (393) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +1392 -2
  3. package/_dist/admission.d.ts +15 -0
  4. package/_dist/admission.d.ts.map +1 -0
  5. package/_dist/announce.d.ts +17 -0
  6. package/_dist/announce.d.ts.map +1 -0
  7. package/_dist/answer.d.ts +200 -0
  8. package/_dist/answer.d.ts.map +1 -0
  9. package/_dist/append.d.ts +10 -0
  10. package/_dist/append.d.ts.map +1 -0
  11. package/_dist/archive.d.ts +6 -0
  12. package/_dist/archive.d.ts.map +1 -0
  13. package/_dist/asks.d.ts +11 -0
  14. package/_dist/asks.d.ts.map +1 -0
  15. package/_dist/audit.d.ts +15 -0
  16. package/_dist/audit.d.ts.map +1 -0
  17. package/_dist/bounce.d.ts +19 -0
  18. package/_dist/bounce.d.ts.map +1 -0
  19. package/_dist/bus.d.ts +8 -0
  20. package/_dist/bus.d.ts.map +1 -0
  21. package/_dist/cache.d.ts +45 -0
  22. package/_dist/cache.d.ts.map +1 -0
  23. package/_dist/child-notice.d.ts +6 -0
  24. package/_dist/child-notice.d.ts.map +1 -0
  25. package/_dist/children.d.ts +59 -0
  26. package/_dist/children.d.ts.map +1 -0
  27. package/_dist/cli.d.ts +8 -0
  28. package/_dist/cli.d.ts.map +1 -0
  29. package/_dist/comp.d.ts +9 -0
  30. package/_dist/comp.d.ts.map +1 -0
  31. package/_dist/compact.d.ts +19 -0
  32. package/_dist/compact.d.ts.map +1 -0
  33. package/_dist/conversation.d.ts +158 -0
  34. package/_dist/conversation.d.ts.map +1 -0
  35. package/_dist/cost.d.ts +13 -0
  36. package/_dist/cost.d.ts.map +1 -0
  37. package/_dist/deferred.d.ts +79 -0
  38. package/_dist/deferred.d.ts.map +1 -0
  39. package/_dist/ended.d.ts +27 -0
  40. package/_dist/ended.d.ts.map +1 -0
  41. package/_dist/files.d.ts +73 -0
  42. package/_dist/files.d.ts.map +1 -0
  43. package/_dist/fork.d.ts +23 -0
  44. package/_dist/fork.d.ts.map +1 -0
  45. package/_dist/graft.d.ts +33 -0
  46. package/_dist/graft.d.ts.map +1 -0
  47. package/_dist/graph.d.ts +14 -0
  48. package/_dist/graph.d.ts.map +1 -0
  49. package/_dist/handoff.d.ts +29 -0
  50. package/_dist/handoff.d.ts.map +1 -0
  51. package/_dist/imported.d.ts +63 -0
  52. package/_dist/imported.d.ts.map +1 -0
  53. package/_dist/intake.d.ts +43 -0
  54. package/_dist/intake.d.ts.map +1 -0
  55. package/_dist/joined.d.ts +35 -0
  56. package/_dist/joined.d.ts.map +1 -0
  57. package/_dist/lease.d.ts +21 -0
  58. package/_dist/lease.d.ts.map +1 -0
  59. package/_dist/lines.d.ts +13 -0
  60. package/_dist/lines.d.ts.map +1 -0
  61. package/_dist/mod.d.ts +107 -0
  62. package/_dist/mod.d.ts.map +1 -0
  63. package/_dist/naming.d.ts +10 -0
  64. package/_dist/naming.d.ts.map +1 -0
  65. package/_dist/native.d.ts +13 -0
  66. package/_dist/native.d.ts.map +1 -0
  67. package/_dist/parts.d.ts +145 -0
  68. package/_dist/parts.d.ts.map +1 -0
  69. package/_dist/plugin.d.ts +33 -0
  70. package/_dist/plugin.d.ts.map +1 -0
  71. package/_dist/project.d.ts +67 -0
  72. package/_dist/project.d.ts.map +1 -0
  73. package/_dist/prose.d.ts +7 -0
  74. package/_dist/prose.d.ts.map +1 -0
  75. package/_dist/providers.d.ts +36 -0
  76. package/_dist/providers.d.ts.map +1 -0
  77. package/_dist/reach.d.ts +39 -0
  78. package/_dist/reach.d.ts.map +1 -0
  79. package/_dist/react.d.ts +236 -0
  80. package/_dist/react.d.ts.map +1 -0
  81. package/_dist/readers.d.ts +221 -0
  82. package/_dist/readers.d.ts.map +1 -0
  83. package/_dist/reap.d.ts +21 -0
  84. package/_dist/reap.d.ts.map +1 -0
  85. package/_dist/recall.d.ts +32 -0
  86. package/_dist/recall.d.ts.map +1 -0
  87. package/_dist/routes.d.ts +15 -0
  88. package/_dist/routes.d.ts.map +1 -0
  89. package/_dist/run.d.ts +81 -0
  90. package/_dist/run.d.ts.map +1 -0
  91. package/_dist/service.d.ts +131 -0
  92. package/_dist/service.d.ts.map +1 -0
  93. package/_dist/source.d.ts +9 -0
  94. package/_dist/source.d.ts.map +1 -0
  95. package/_dist/start.d.ts +29 -0
  96. package/_dist/start.d.ts.map +1 -0
  97. package/_dist/state.d.ts +75 -0
  98. package/_dist/state.d.ts.map +1 -0
  99. package/_dist/status.d.ts +38 -0
  100. package/_dist/status.d.ts.map +1 -0
  101. package/_dist/tail.d.ts +121 -0
  102. package/_dist/tail.d.ts.map +1 -0
  103. package/_dist/timing.d.ts +9 -0
  104. package/_dist/timing.d.ts.map +1 -0
  105. package/_dist/told.d.ts +17 -0
  106. package/_dist/told.d.ts.map +1 -0
  107. package/_dist/tools.d.ts +41 -0
  108. package/_dist/tools.d.ts.map +1 -0
  109. package/_dist/transcript.d.ts +5 -0
  110. package/_dist/transcript.d.ts.map +1 -0
  111. package/_dist/turn.d.ts +49 -0
  112. package/_dist/turn.d.ts.map +1 -0
  113. package/_dist/unknown.d.ts +6 -0
  114. package/_dist/unknown.d.ts.map +1 -0
  115. package/_dist/views.d.ts +9 -0
  116. package/_dist/views.d.ts.map +1 -0
  117. package/_dist/vocab.d.ts +9 -0
  118. package/_dist/vocab.d.ts.map +1 -0
  119. package/_dist/wait.d.ts +15 -0
  120. package/_dist/wait.d.ts.map +1 -0
  121. package/_dist/wake.d.ts +116 -0
  122. package/_dist/wake.d.ts.map +1 -0
  123. package/_dist/watch.d.ts +52 -0
  124. package/_dist/watch.d.ts.map +1 -0
  125. package/_dist/who.d.ts +84 -0
  126. package/_dist/who.d.ts.map +1 -0
  127. package/_dist/window.d.ts +43 -0
  128. package/_dist/window.d.ts.map +1 -0
  129. package/admission.js +137 -0
  130. package/admission.js.map +1 -0
  131. package/admission.ts +164 -0
  132. package/announce.js +123 -0
  133. package/announce.js.map +1 -0
  134. package/announce.ts +126 -0
  135. package/answer.js +372 -0
  136. package/answer.js.map +1 -0
  137. package/answer.ts +426 -0
  138. package/append.js +125 -0
  139. package/append.js.map +1 -0
  140. package/append.ts +205 -0
  141. package/archive.js +62 -0
  142. package/archive.js.map +1 -0
  143. package/archive.ts +62 -0
  144. package/asks.js +80 -0
  145. package/asks.js.map +1 -0
  146. package/asks.ts +106 -0
  147. package/attempt.js +46 -0
  148. package/attempt.js.map +1 -0
  149. package/attempt.ts +60 -0
  150. package/audit.js +57 -0
  151. package/audit.js.map +1 -0
  152. package/audit.ts +65 -0
  153. package/bounce.js +29 -0
  154. package/bounce.js.map +1 -0
  155. package/bounce.ts +34 -0
  156. package/bus.js +568 -0
  157. package/bus.js.map +1 -0
  158. package/bus.ts +683 -0
  159. package/cache.js +169 -0
  160. package/cache.js.map +1 -0
  161. package/cache.ts +230 -0
  162. package/child-notice.js +128 -0
  163. package/child-notice.js.map +1 -0
  164. package/child-notice.ts +136 -0
  165. package/children.js +937 -0
  166. package/children.js.map +1 -0
  167. package/children.ts +925 -0
  168. package/claude-control.js +8 -0
  169. package/claude-control.js.map +1 -0
  170. package/claude-control.ts +12 -0
  171. package/cli.js +23 -0
  172. package/cli.js.map +1 -0
  173. package/cli.ts +28 -0
  174. package/comp.js +76 -0
  175. package/comp.js.map +1 -0
  176. package/comp.ts +78 -0
  177. package/compact.js +157 -0
  178. package/compact.js.map +1 -0
  179. package/compact.ts +209 -0
  180. package/compact_ask.js +280 -0
  181. package/compact_ask.js.map +1 -0
  182. package/compact_ask.ts +199 -0
  183. package/continue.js +131 -0
  184. package/continue.js.map +1 -0
  185. package/continue.ts +143 -0
  186. package/conversation.js +337 -0
  187. package/conversation.js.map +1 -0
  188. package/conversation.ts +593 -0
  189. package/cost.js +111 -0
  190. package/cost.js.map +1 -0
  191. package/cost.ts +93 -0
  192. package/deferred.js +207 -0
  193. package/deferred.js.map +1 -0
  194. package/deferred.ts +219 -0
  195. package/deno.json +1 -0
  196. package/dependencies.js +114 -0
  197. package/dependencies.js.map +1 -0
  198. package/dependencies.ts +110 -0
  199. package/draining.js +20 -0
  200. package/draining.js.map +1 -0
  201. package/draining.ts +26 -0
  202. package/ended.js +210 -0
  203. package/ended.js.map +1 -0
  204. package/ended.ts +225 -0
  205. package/files.js +285 -0
  206. package/files.js.map +1 -0
  207. package/files.ts +318 -0
  208. package/fork.js +96 -0
  209. package/fork.js.map +1 -0
  210. package/fork.ts +124 -0
  211. package/graft.js +97 -0
  212. package/graft.js.map +1 -0
  213. package/graft.ts +88 -0
  214. package/graph.js +49 -0
  215. package/graph.js.map +1 -0
  216. package/graph.ts +61 -0
  217. package/handoff.js +111 -0
  218. package/handoff.js.map +1 -0
  219. package/handoff.ts +147 -0
  220. package/help.js +432 -0
  221. package/help.js.map +1 -0
  222. package/help.ts +431 -0
  223. package/hooks.js +253 -0
  224. package/hooks.js.map +1 -0
  225. package/hooks.ts +333 -0
  226. package/imported.js +259 -0
  227. package/imported.js.map +1 -0
  228. package/imported.ts +201 -0
  229. package/inspect.js +353 -0
  230. package/inspect.js.map +1 -0
  231. package/inspect.ts +378 -0
  232. package/intake.js +115 -0
  233. package/intake.js.map +1 -0
  234. package/intake.ts +124 -0
  235. package/joined.js +67 -0
  236. package/joined.js.map +1 -0
  237. package/joined.ts +69 -0
  238. package/lease.js +146 -0
  239. package/lease.js.map +1 -0
  240. package/lease.ts +151 -0
  241. package/lifecycle.js +49 -0
  242. package/lifecycle.js.map +1 -0
  243. package/lifecycle.ts +46 -0
  244. package/lines.js +171 -0
  245. package/lines.js.map +1 -0
  246. package/lines.ts +177 -0
  247. package/listen.js +604 -0
  248. package/listen.js.map +1 -0
  249. package/listen.ts +976 -0
  250. package/log.js +78 -0
  251. package/log.js.map +1 -0
  252. package/log.ts +88 -0
  253. package/mod.js +107 -0
  254. package/mod.js.map +1 -0
  255. package/mod.ts +113 -0
  256. package/name.js +51 -0
  257. package/name.js.map +1 -0
  258. package/name.ts +84 -0
  259. package/naming.js +96 -0
  260. package/naming.js.map +1 -0
  261. package/naming.ts +102 -0
  262. package/native.js +17 -0
  263. package/native.js.map +1 -0
  264. package/native.ts +17 -0
  265. package/package.json +133 -4
  266. package/parts.js +334 -0
  267. package/parts.js.map +1 -0
  268. package/parts.ts +383 -0
  269. package/plugin.js +77 -0
  270. package/plugin.js.map +1 -0
  271. package/plugin.ts +98 -0
  272. package/project.js +354 -0
  273. package/project.js.map +1 -0
  274. package/project.ts +407 -0
  275. package/prompt.js +57 -0
  276. package/prompt.js.map +1 -0
  277. package/prompt.ts +92 -0
  278. package/prose.js +43 -0
  279. package/prose.js.map +1 -0
  280. package/prose.ts +63 -0
  281. package/providers.js +279 -0
  282. package/providers.js.map +1 -0
  283. package/providers.ts +306 -0
  284. package/pruning.js +80 -0
  285. package/pruning.js.map +1 -0
  286. package/pruning.ts +147 -0
  287. package/reach.js +923 -0
  288. package/reach.js.map +1 -0
  289. package/reach.ts +1107 -0
  290. package/react.js +2259 -0
  291. package/react.js.map +1 -0
  292. package/react.ts +2864 -0
  293. package/readers.js +956 -0
  294. package/readers.js.map +1 -0
  295. package/readers.ts +1017 -0
  296. package/reap.js +60 -0
  297. package/reap.js.map +1 -0
  298. package/reap.ts +65 -0
  299. package/recall.js +67 -0
  300. package/recall.js.map +1 -0
  301. package/recall.ts +114 -0
  302. package/reopen.js +45 -0
  303. package/reopen.js.map +1 -0
  304. package/reopen.ts +44 -0
  305. package/result-entry.js +32 -0
  306. package/result-entry.js.map +1 -0
  307. package/result-entry.ts +34 -0
  308. package/resume.js +266 -0
  309. package/resume.js.map +1 -0
  310. package/resume.ts +283 -0
  311. package/routes.js +129 -0
  312. package/routes.js.map +1 -0
  313. package/routes.ts +147 -0
  314. package/routine.js +179 -0
  315. package/routine.js.map +1 -0
  316. package/routine.ts +191 -0
  317. package/run.js +932 -0
  318. package/run.js.map +1 -0
  319. package/run.ts +999 -0
  320. package/service.js +806 -0
  321. package/service.js.map +1 -0
  322. package/service.ts +911 -0
  323. package/source.js +26 -0
  324. package/source.js.map +1 -0
  325. package/source.ts +40 -0
  326. package/start.js +197 -0
  327. package/start.js.map +1 -0
  328. package/start.ts +214 -0
  329. package/state.js +247 -0
  330. package/state.js.map +1 -0
  331. package/state.ts +404 -0
  332. package/status.js +1222 -0
  333. package/status.js.map +1 -0
  334. package/status.ts +1555 -0
  335. package/status_bench.ts +50 -0
  336. package/statusline.js +187 -0
  337. package/statusline.js.map +1 -0
  338. package/statusline.ts +232 -0
  339. package/tail.js +748 -0
  340. package/tail.js.map +1 -0
  341. package/tail.ts +815 -0
  342. package/talk.js +58 -0
  343. package/talk.js.map +1 -0
  344. package/talk.ts +51 -0
  345. package/task-context.js +41 -0
  346. package/task-context.js.map +1 -0
  347. package/task-context.ts +53 -0
  348. package/texted.js +65 -0
  349. package/texted.js.map +1 -0
  350. package/texted.ts +65 -0
  351. package/timing.js +37 -0
  352. package/timing.js.map +1 -0
  353. package/timing.ts +52 -0
  354. package/told.js +56 -0
  355. package/told.js.map +1 -0
  356. package/told.ts +54 -0
  357. package/tools.js +595 -0
  358. package/tools.js.map +1 -0
  359. package/tools.ts +633 -0
  360. package/transcript.js +34 -0
  361. package/transcript.js.map +1 -0
  362. package/transcript.ts +41 -0
  363. package/turn.js +47 -0
  364. package/turn.js.map +1 -0
  365. package/turn.ts +68 -0
  366. package/unknown.js +8 -0
  367. package/unknown.js.map +1 -0
  368. package/unknown.ts +9 -0
  369. package/views.js +15 -0
  370. package/views.js.map +1 -0
  371. package/views.ts +21 -0
  372. package/vocab.js +24 -0
  373. package/vocab.js.map +1 -0
  374. package/vocab.json +1573 -0
  375. package/vocab.ts +30 -0
  376. package/wait.js +30 -0
  377. package/wait.js.map +1 -0
  378. package/wait.ts +45 -0
  379. package/wake.js +552 -0
  380. package/wake.js.map +1 -0
  381. package/wake.ts +597 -0
  382. package/watch.js +520 -0
  383. package/watch.js.map +1 -0
  384. package/watch.ts +596 -0
  385. package/who.js +309 -0
  386. package/who.js.map +1 -0
  387. package/who.ts +347 -0
  388. package/window.js +179 -0
  389. package/window.js.map +1 -0
  390. package/window.ts +268 -0
  391. package/woken.js +129 -0
  392. package/woken.js.map +1 -0
  393. package/woken.ts +127 -0
package/watch.js ADDED
@@ -0,0 +1,520 @@
1
+ // Who hears a task change. A task's watchers are the session that filed it,
2
+ // every session whose own words mention its id (what it said, or what it was
3
+ // told; a tool's result is what it read, not what it said), the writer of any
4
+ // task, comment or letter whose text mentions it, and each actor whose
5
+ // @yaks/notify `subscription` watches it; an actor muting it hears nothing.
6
+ // A person who commented on it watches it too: they spoke to that work.
7
+ // When the task is completed, cancelled or answered, or someone comments on
8
+ // it, `session_watch` knocks each of them once (./listen.ts says the knock).
9
+ //
10
+ // A knock goes to the watcher's session while it can hear, and once that
11
+ // session is over, to its project's operator: the session a person opened for
12
+ // that project (`session.operator`) that spoke last and is not over, else the
13
+ // project itself, held for whoever works for it next. A watcher that is a
14
+ // persona or a project is that project's from the start.
15
+ //
16
+ // A person hears through their assistant: the session standing here for the
17
+ // conversation they hold with it in another store (`session.person`,
18
+ // ./who.ts `standIn`), which whoever keeps that door passes on (@yaks/tunnel).
19
+ // Their comment carries no session, since a comment written through one is an
20
+ // agent's, so the watcher is the person and the session is found from them. A
21
+ // person with no such conversation is knocked nowhere, and nobody is told of
22
+ // their own act. A task assigned to a person knocks that same session, and
23
+ // nobody else: an assignment is news to the one it names.
24
+ //
25
+ // A person's assistant hears news, not traffic: work they spoke to finishing
26
+ // (completed, cancelled or answered), work newly assigned to them, and a
27
+ // comment that answers one of their own (`comment.reply_to`). Any other
28
+ // comment knocks no session standing for a person, however it watches.
29
+ //
30
+ // Each change knocks a target once, named for the target and the change, so
31
+ // two watchers routed to one session make one knock and a run that is tried
32
+ // again knocks nobody twice. A person's comment already reaches the session
33
+ // that filed the task and the one holding it (./listen.ts), so those two are
34
+ // not knocked for it.
35
+ //
36
+ // Nobody is knocked about their own write, and a session's subagents write
37
+ // for it: a subagent runs inside its parent's process and hands what it did
38
+ // back as the result of the parent's own call, so a knock about its comment
39
+ // would tell the parent what it just read (`writers`). A helper writes in its
40
+ // operator's place (./help.ts), so its operator, and the project it helps, are
41
+ // not knocked about what it wrote: that knock would be routine and start the
42
+ // next helper on the same work (`standing`).
43
+ //
44
+ // A mark that names nobody who made it, no `by` and no `via`, records an act in
45
+ // another store at that store's time, as @yaks/heal closes a bug's task when
46
+ // the tracker resolves or archives the bug. That store tells of the act, so the
47
+ // mark knocks nobody.
48
+ //
49
+ // One event is one knock. A managed run that ends leaves its whole report as
50
+ // a comment on its task that knocks whoever started it (`reported`, which
51
+ // @yaks/spawn's completion writes by). That receipt is the knock for
52
+ // the run's work on the task: the session it knocks is not knocked for the
53
+ // comment a second time, and nobody it reaches, that session or a watcher
54
+ // knocked about the comment, is knocked a little earlier for the run marking
55
+ // the task completed or cancelled. Each would be a second helper's batch for
56
+ // one report (./help.ts). Only a person's assistant, which hears no such
57
+ // comment, hears of the mark.
58
+ import { line, sub } from "@yaks/query";
59
+ import { addressed, argsOf } from "@yaks/graph/call";
60
+ import { Refused } from "@yaks/graph/errors";
61
+ import { derivedEid } from "@yaks/graph/identity";
62
+ import { HUMAN, human, mentions } from "@yaks/id";
63
+ import { CLAIM, SESSION } from "./comp.js";
64
+ import { ended, projects, taken } from "./listen.js";
65
+ import { HELPING } from "./routine.js";
66
+ let comp = (b, name)=>b?.[name] ?? {};
67
+ let str = (v)=>typeof v == 'string' ? v : '';
68
+ let fold = (text, max = 200)=>{
69
+ let line = text.replace(/\s+/g, ' ').trim();
70
+ return line.length > max ? `${line.slice(0, max - 1)}…` : line;
71
+ };
72
+ /** The sessions and actors that mention the task `id` names: the sessions
73
+ * whose own entries do, and the writer of each other entity whose `doc.body`
74
+ * does, by the session it came through or else the actor. An entry keeps the
75
+ * id as it was typed; a body stores the task's eid (@yaks/graph `prose`), or
76
+ * the id where it was written before, and a search for the id finds both. */ let mentioners = async (g, task, id)=>{
77
+ // A human id, a prefix and a number: a bare hash is not how anyone
78
+ // mentions a task.
79
+ if (!HUMAN.test(id)) return [];
80
+ let said = g.vocab.prop('content', 'body') && g.vocab.comp('entry') ? await g.read(line`.content.body~=${id}&.entry&!result&!notice&.fields=entry.session,content.body&.limit=500`) : [];
81
+ let written = g.vocab.prop('doc', 'body') ? await g.read(line`${id}&.doc&.fields=created.by,created.via,doc.body&.limit=200`) : [];
82
+ return [
83
+ ...said.filter((b)=>mentions(str(comp(b, 'content').body), id)).map((b)=>str(comp(b, 'entry').session)),
84
+ ...written.filter((b)=>{
85
+ let body = str(comp(b, 'doc').body);
86
+ return b.entity.eid != task && (mentions(body, task) || mentions(body, id));
87
+ }).map((b)=>str(comp(b, 'created').via) || str(comp(b, 'created').by))
88
+ ].filter(Boolean);
89
+ };
90
+ /** The actors whose subscription to `task` is in `mode`. */ let subscribed = async (g, task, mode)=>g.vocab.prop('subscription', 'mode') ? (await g.read(line`.subscription.target=${task}&.subscription.mode=${mode}&.fields=subscription.actor`)).map((b)=>str(comp(b, 'subscription').actor)).filter(Boolean) : [];
91
+ // A person's own words: by a person and through no session, as
92
+ // `session_start` reads a person's comment.
93
+ let OWN = line`.created.by.person&!created.via.${SESSION}`;
94
+ /** The people who commented on `task` themselves. */ let spoke = async (g, task)=>g.vocab.comp('person') && g.vocab.comp('comment') ? (await g.read(line`.comment.target=${task}&${sub(OWN)}&.fields=created.by&.limit=500`)).map((b)=>str(comp(b, 'created').by)).filter(Boolean) : [];
95
+ /** The person whose own comment `row` answers, if it answers one. */ let answered = async (g, row)=>{
96
+ let to = str(comp(row, 'comment').reply_to);
97
+ if (!to || !g.vocab.comp('person')) return '';
98
+ let [own] = await g.read(line`.entity.eid=${to}&${sub(OWN)}&.fields=created.by`);
99
+ return str(comp(own, 'created').by);
100
+ };
101
+ /** The session standing here for the conversation `person` holds with their
102
+ * assistant in another store (./who.ts `standIn`): the newest one said to
103
+ * be theirs. */ export let standingFor = async (g, person)=>g.vocab.prop(SESSION, 'person') ? (await g.read(line`.${SESSION}.person=${person}&.${SESSION}.door&.order=-created.at&.limit=1&.fields=entity.eid`))[0]?.entity.eid : undefined;
104
+ /** Everyone watching `task`, as sessions or actors, and those muting it. */ export let watchers = async (g, task)=>{
105
+ let made = comp(task, 'created');
106
+ return {
107
+ watching: [
108
+ ...new Set([
109
+ str(made.via) || str(made.by),
110
+ ...await mentioners(g, task.entity.eid, human(g.vocab)(task)),
111
+ ...await spoke(g, task.entity.eid),
112
+ ...await subscribed(g, task.entity.eid, 'watch')
113
+ ].filter(Boolean))
114
+ ],
115
+ muting: new Set(await subscribed(g, task.entity.eid, 'mute'))
116
+ };
117
+ };
118
+ // The project a watcher answers to: a session's persona's home, a persona's
119
+ // home, or the project itself. None for anyone else.
120
+ let projectOf = (rows, eid)=>{
121
+ let b = rows.get(eid);
122
+ if (b?.project) return eid;
123
+ let persona = b?.[SESSION] ? str(comp(b, SESSION).persona) : eid;
124
+ return str(comp(rows.get(persona), 'persona').home);
125
+ };
126
+ // A project and every project it is filed under, nearest first.
127
+ let above = (tree, project)=>{
128
+ let found = [
129
+ project
130
+ ];
131
+ for(let up = tree.get(project); up && !found.includes(up);){
132
+ found.push(up);
133
+ up = tree.get(up);
134
+ }
135
+ return found;
136
+ };
137
+ /** The operator of a project still able to hear: a session a person opened
138
+ * wearing a persona homed there or at a project it is filed under (the
139
+ * projects ./listen.ts gives such a session what is held for), not over, the
140
+ * one that spoke last. */ export let operatorOf = async (g, project)=>{
141
+ if (!g.vocab.prop(SESSION, 'operator')) return;
142
+ let homes = above(await projects(g), project);
143
+ if (!homes.length) return;
144
+ let open = await g.read(line`.${SESSION}.operator=true&.${SESSION}.persona.persona.home=${homes}&!${SESSION}.ended&.fields=${SESSION}.ended`);
145
+ let gone = await ended(g, open);
146
+ let live = open.filter((s)=>!gone.has(s.entity.eid));
147
+ let last = await Promise.all(live.map(async (s)=>{
148
+ let [entry] = await g.read(line`.entry.session=${s.entity.eid}&.order=-entry.seq&.limit=1&.fields=created.at`);
149
+ return {
150
+ eid: s.entity.eid,
151
+ at: str(comp(entry, 'created').at)
152
+ };
153
+ }));
154
+ return last.toSorted((a, b)=>b.at.localeCompare(a.at))[0]?.eid;
155
+ };
156
+ /** Where each watcher's knock goes: its session while that can hear, else
157
+ * its project's operator, else the project. A person's goes to the session
158
+ * standing for their conversation with their assistant ({@link standingFor}),
159
+ * unless the act is their own (`by`). Anyone muting the task is left out, and
160
+ * with `relay` false, so is a session that is over. */ export let targets = async (g, watching, muting, relay = true, by)=>{
161
+ let rows = new Map((watching.length ? await g.get(watching, [
162
+ SESSION,
163
+ 'persona',
164
+ 'project',
165
+ 'person'
166
+ ].filter((c)=>g.vocab.comp(c))) : []).map((b)=>[
167
+ b.entity.eid,
168
+ b
169
+ ]));
170
+ let homes = [
171
+ ...new Set([
172
+ ...rows.values()
173
+ ].map((b)=>str(comp(b, SESSION).persona)).filter(Boolean))
174
+ ];
175
+ let personas = homes.length && g.vocab.comp('persona') ? await g.get(homes, [
176
+ 'persona'
177
+ ]) : [];
178
+ for (let b of personas){
179
+ rows.set(b.entity.eid, b);
180
+ }
181
+ let sessions = [
182
+ ...rows.values()
183
+ ].filter((b)=>b[SESSION]);
184
+ let gone = await ended(g, sessions);
185
+ let operators = new Map();
186
+ let out = new Set();
187
+ for (let w of watching){
188
+ let project = projectOf(rows, w);
189
+ if (muting.has(w) || project && muting.has(project)) continue;
190
+ if (rows.get(w)?.[SESSION]) {
191
+ if (!gone.has(w)) out.add(w);
192
+ if (!gone.has(w) || !relay) continue;
193
+ }
194
+ if (rows.get(w)?.person) {
195
+ let heard = w == by ? undefined : await standingFor(g, w);
196
+ if (heard) out.add(heard);
197
+ continue;
198
+ }
199
+ if (!project) continue;
200
+ if (!operators.has(project)) {
201
+ operators.set(project, await operatorOf(g, project));
202
+ }
203
+ out.add(operators.get(project) ?? project);
204
+ }
205
+ return [
206
+ ...out
207
+ ];
208
+ };
209
+ // How far a line of sessions is followed up before it stops: a longer one is
210
+ // a cycle someone wrote.
211
+ let DEPTH = 8;
212
+ // What places a session in its line, read alone: the rest of `session` (its
213
+ // computed status above all) is derived from its whole log.
214
+ let placed = async (g, eid)=>(await g.read(line`.entity.eid=${eid}&.${SESSION}&.fields=${[
215
+ `${SESSION}.source`,
216
+ `${SESSION}.ended`,
217
+ `${SESSION}.transcript`
218
+ ].concat(g.vocab.comp('spawned') ? [
219
+ 'spawned.parent'
220
+ ] : []).concat(g.vocab.comp('helping') ? [
221
+ 'helping.project'
222
+ ] : [])}`))[0];
223
+ let managed = async (g, eid)=>g.vocab.comp('process') ? (await g.get([
224
+ eid
225
+ ], [
226
+ 'process',
227
+ 'exit'
228
+ ]))[0] : undefined;
229
+ /** The sessions a write through `via` is the own write of: that session, and
230
+ * while it is a subagent (a transcript its harness keeps in a file and runs
231
+ * inside its parent's process, as a Claude Code subagent is), each session up
232
+ * its line. A managed run or a native child is a line of work of its own. */ export let writers = async (g, via)=>{
233
+ let own = new Set();
234
+ for(let at = via; at && !own.has(at) && own.size < DEPTH;){
235
+ own.add(at);
236
+ let s = await placed(g, at);
237
+ let parent = str(comp(s, 'spawned').parent);
238
+ at = parent && comp(s, SESSION).transcript && !(await managed(g, at))?.process ? parent : '';
239
+ }
240
+ return own;
241
+ };
242
+ /** Whom a write through `via` is the own write of because `via` helps them
243
+ * (./help.ts): a helper takes its operator's routine in its place, so what it
244
+ * writes is that operator's own. The project it helps, each project filed
245
+ * under it, and that project's operator hear nothing of it; a knock to any of
246
+ * them would be routine, and start the next helper on the first one's work. */ let standing = async (g, via)=>{
247
+ let [s] = via && g.vocab.comp(HELPING) ? await g.get([
248
+ via
249
+ ], [
250
+ HELPING
251
+ ]) : [];
252
+ let helped = str(comp(s, HELPING).project);
253
+ if (!helped) return ()=>false;
254
+ let tree = await projects(g);
255
+ let operator = await operatorOf(g, helped);
256
+ return (t)=>t == operator || above(tree, t).includes(helped);
257
+ };
258
+ // The task an id a call was given names, or none where it names nothing now.
259
+ let named = async (g, id)=>{
260
+ if (!id) return '';
261
+ try {
262
+ return (await addressed(g, [
263
+ id
264
+ ], 'task'))[0];
265
+ } catch (error) {
266
+ if (error instanceof Refused) return '';
267
+ throw error;
268
+ }
269
+ };
270
+ /**
271
+ * Where a managed run's ending is reported: the task its spawn call names,
272
+ * else the tasks it holds, and the session to knock, which is the one that
273
+ * started it or, that one being over, the nearest up its own line that can
274
+ * still hear. @yaks/spawn's completion writes its receipt by this, and
275
+ * {@link knocks} leaves that receipt to be the one knock. A helper's own
276
+ * ending (./help.ts) knocks nobody: what it did is in the graph, and what
277
+ * needs its operator it handed up itself.
278
+ *
279
+ * ```ts
280
+ * import { reported } from '@yaks/session'
281
+ *
282
+ * // let { tasks, to } = await reported(graph, run)
283
+ * ```
284
+ */ export let reported = async (g, run)=>{
285
+ let row = await placed(g, run);
286
+ let source = str(comp(row, SESSION).source);
287
+ let [call] = source ? await g.get([
288
+ source
289
+ ], [
290
+ 'call',
291
+ 'entry',
292
+ 'created'
293
+ ]) : [];
294
+ // Claims may already have been released by the terminal-entry effect, or
295
+ // by the agent itself. The originating spawn call still names its task, as
296
+ // its caller wrote it (`T-12`).
297
+ let task = call?.call ? await named(g, str(argsOf(call).task)) : '';
298
+ let tasks = task ? [
299
+ task
300
+ ] : g.vocab.comp('task') ? (await g.read(line`.task&.${CLAIM}.session=${run}`)).map((b)=>b.entity.eid) : [];
301
+ if (row?.helping) return {
302
+ tasks
303
+ };
304
+ let seen = new Set([
305
+ run
306
+ ]);
307
+ let at = str(comp(row, 'spawned').parent) || str(comp(call, 'entry').session) || str(comp(call, 'created').via);
308
+ while(at && !seen.has(at) && seen.size < DEPTH){
309
+ seen.add(at);
310
+ let s = await placed(g, at);
311
+ if (!s) break;
312
+ if (!(await ended(g, [
313
+ s
314
+ ])).has(at)) return {
315
+ tasks,
316
+ to: at
317
+ };
318
+ at = str(comp(s, 'spawned').parent);
319
+ }
320
+ return {
321
+ tasks
322
+ };
323
+ };
324
+ // Who hears a change another way, so is not knocked for it. A comment: the
325
+ // session it knocks itself. A mark a managed run made while still at work on
326
+ // the task: everyone its receipt reaches, which is the session the receipt
327
+ // knocks and every watcher the receipt, a comment, knocks in turn. A person's
328
+ // assistant hears no comment that does not answer them, so for it the mark is
329
+ // the news.
330
+ let told = async (g, row, task, via)=>{
331
+ let none = ()=>false;
332
+ if (row.comment) {
333
+ let to = str(comp(row, 'knock').target);
334
+ return (t)=>t == to;
335
+ }
336
+ let run = via ? await managed(g, via) : undefined;
337
+ if (!run?.process || run.exit) return none;
338
+ let { tasks, to } = await reported(g, via);
339
+ if (!tasks.includes(task)) return none;
340
+ return (t, person)=>t == to || !person;
341
+ };
342
+ // A task's newest mark: answered, completed or cancelled.
343
+ let marked = (g, task)=>{
344
+ let id = human(g.vocab)(task);
345
+ let decided = comp(task, 'decided');
346
+ let mark = task.decided && task.completed ? {
347
+ name: 'decided',
348
+ what: `${id} answered "${str(decided.choice)}"`
349
+ } : task.cancelled ? {
350
+ name: 'cancelled',
351
+ what: `${id} cancelled`
352
+ } : task.completed ? {
353
+ name: 'completed',
354
+ what: `${id} completed`
355
+ } : undefined;
356
+ if (!mark) return;
357
+ let c = comp(task, mark.name);
358
+ // A mark naming nobody who made it records an act in another store, at that
359
+ // store's time: @yaks/heal closes a bug's task with the tracker's
360
+ // resolution or archival. That store tells it, so it knocks nobody here.
361
+ if (!str(c.by) && !str(c.via)) return;
362
+ let reason = mark.name == 'cancelled' && str(c.reason) ? ` (${fold(str(c.reason))})` : '';
363
+ return {
364
+ key: `${task.entity.eid} ${mark.name} ${str(c.at)}`,
365
+ what: `${mark.what}${reason}`,
366
+ text: str(comp(task, 'doc').title),
367
+ by: str(c.by),
368
+ via: str(c.via),
369
+ decision: mark.name == 'decided'
370
+ };
371
+ };
372
+ // An open task's assignment to a person, as it stands: to whom, and by its
373
+ // last writer. `at` is when the commit that assigned it owed its run, so each
374
+ // assignment is a change of its own and a run tried again is the same one.
375
+ let assigned = async (g, task, at = '')=>{
376
+ let to = str(comp(task, 'filed').assignee);
377
+ if (!to || task.completed || task.cancelled) return;
378
+ let [who] = await g.get([
379
+ to
380
+ ], [
381
+ 'doc',
382
+ 'person'
383
+ ].filter((c)=>g.vocab.comp(c)));
384
+ if (!who?.person) return;
385
+ let wrote = comp(task, 'updated').by ? 'updated' : 'created';
386
+ return {
387
+ to,
388
+ key: `${task.entity.eid} assigned ${to} ${at}`,
389
+ what: `${human(g.vocab)(task)} assigned to ${str(comp(who, 'doc').title) || human(g.vocab)(who)}`,
390
+ text: str(comp(task, 'doc').title),
391
+ by: str(comp(task, wrote).by),
392
+ via: str(comp(task, wrote).via)
393
+ };
394
+ };
395
+ /**
396
+ * The knocks a change to a task owes its watchers: the task itself (a mark)
397
+ * or a comment on it. None where `eid` is neither, the change is not one a
398
+ * watcher hears, or every watcher wrote it or was told already. Where what
399
+ * `moved` is the task's `filed`, the change is its assignment, owed to the
400
+ * person it names alone.
401
+ *
402
+ * ```ts
403
+ * import { knocks } from '@yaks/session'
404
+ *
405
+ * // await graph.apply(await knocks(graph, task), { trusted: true })
406
+ * ```
407
+ */ export let knocks = async (g, eid, moved = {})=>{
408
+ if (!g.vocab.comp('knock')) return [];
409
+ let [row] = await g.get([
410
+ eid
411
+ ]);
412
+ let on = row?.comment ? str(comp(row, 'comment').target) : eid;
413
+ let [task] = on != eid ? await g.get([
414
+ on
415
+ ]) : [
416
+ row
417
+ ];
418
+ if (!task?.task) return [];
419
+ let made = comp(row, 'created');
420
+ let given = moved.name == 'filed' ? await assigned(g, task, moved.at) : undefined;
421
+ let change = moved.name == 'filed' ? given : row.comment ? {
422
+ key: `${eid} comment`,
423
+ what: `${human(g.vocab)(row)} on ${human(g.vocab)(task)}`,
424
+ text: str(comp(row, 'doc').body),
425
+ by: str(made.by),
426
+ via: str(made.via)
427
+ } : marked(g, task);
428
+ if (!change) return [];
429
+ let { watching, muting } = await watchers(g, task);
430
+ if (given) watching = [
431
+ given.to
432
+ ];
433
+ let replied = row.comment ? await answered(g, row) : '';
434
+ // A person's comment reaches the session that filed the task, and the one
435
+ // holding it, through ./listen.ts already.
436
+ let [writer] = change.via ? await g.get([
437
+ change.via
438
+ ], [
439
+ SESSION
440
+ ]) : [];
441
+ if (row.comment && !writer?.[SESSION]) {
442
+ let told = [
443
+ str(comp(task, 'created').via),
444
+ str(comp(task, CLAIM).session)
445
+ ];
446
+ watching = watching.filter((w)=>!told.includes(w));
447
+ }
448
+ let own = change.via ? await writers(g, change.via) : new Set();
449
+ let knows = await told(g, row, task.entity.eid, change.via);
450
+ watching = watching.filter((w)=>!own.has(w));
451
+ let worked = !!row.comment && (await taken(g, [
452
+ eid
453
+ ])).has(eid);
454
+ let stands = await standing(g, change.via);
455
+ let to = (await targets(g, watching, muting, !worked, change.by)).filter((t)=>!own.has(t) && !stands(t));
456
+ // The person each target stands for, if it stands for one.
457
+ let stood = new Map((to.length ? await g.get(to, [
458
+ SESSION
459
+ ]) : []).map((b)=>[
460
+ b.entity.eid,
461
+ str(comp(b, SESSION).person)
462
+ ]));
463
+ to = to.filter((t)=>!knows(t, stood.get(t) ?? ''));
464
+ // A comment reaches a person's assistant only when it answers them.
465
+ if (row.comment) {
466
+ to = to.filter((t)=>[
467
+ replied,
468
+ ''
469
+ ].includes(stood.get(t) ?? ''));
470
+ }
471
+ if (!to.length) return [];
472
+ let actorFields = change.decision ? [
473
+ 'doc',
474
+ 'persona',
475
+ 'project'
476
+ ].filter((c)=>g.vocab.comp(c)) : [
477
+ 'doc'
478
+ ];
479
+ let [who] = change.by ? await g.get([
480
+ change.by
481
+ ], actorFields) : [];
482
+ let name = who ? str(comp(who, 'doc').title) || human(g.vocab)(who) : '';
483
+ let prefix = change.decision && (who?.persona || who?.project) ? 'Agent decision: ' : '';
484
+ // The words whole: a knock cut short costs its reader a second command,
485
+ // and with it a second read of its whole context.
486
+ let text = fold(change.text, Infinity);
487
+ let body = `${prefix}${change.what}${name ? ` by ${name}` : ''}` + (text ? `: ${text}` : '');
488
+ let named = to.map((target)=>({
489
+ target,
490
+ eid: derivedEid(`session watch ${target} ${change.key}`)
491
+ }));
492
+ let had = new Set((await g.get(named.map((n)=>n.eid), [
493
+ 'knock'
494
+ ])).filter((b)=>b.knock).map((b)=>b.entity.eid));
495
+ return named.filter((n)=>!had.has(n.eid)).map((n)=>({
496
+ entity: {
497
+ eid: n.eid
498
+ },
499
+ knock: {
500
+ target: n.target,
501
+ // What it tells of: the comment, or the task a mark or an assignment
502
+ // moved, so a reader tells a task's change from talk about it.
503
+ about: row.comment ? eid : task.entity.eid,
504
+ ...change.by ? {
505
+ from: change.by
506
+ } : {}
507
+ },
508
+ doc: {
509
+ body
510
+ }
511
+ }));
512
+ };
513
+ /** The code behind `session_watch`: knock the watchers of the task `eid` is,
514
+ * or that the comment `eid` is on, for what `moved`. */ export let watch = async (g, eid, moved)=>{
515
+ let owed = await knocks(g, eid, moved);
516
+ if (owed.length) await g.apply(owed, {
517
+ trusted: true
518
+ });
519
+ };
520
+ //# sourceMappingURL=watch.js.map
package/watch.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.js","sources":["./watch.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,8EAA8E;AAC9E,uEAAuE;AACvE,4EAA4E;AAC5E,wEAAwE;AACxE,4EAA4E;AAC5E,6EAA6E;AAC7E,EAAE;AACF,yEAAyE;AACzE,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,yDAAyD;AACzD,EAAE;AACF,4EAA4E;AAC5E,qEAAqE;AACrE,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,0DAA0D;AAC1D,EAAE;AACF,6EAA6E;AAC7E,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,sBAAsB;AACtB,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E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