@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
@@ -0,0 +1,15 @@
1
+ import type { Bundle, Comp, Eid, Graph } from "@yaks/graph";
2
+ import type { ChildLimits } from "./children.js";
3
+ /** During expansion the old server's value wins. After conversion only marks
4
+ * remain; no dispatch means no place, not a queued root. */ export declare let dispatchStatus: (b: Bundle | undefined) => unknown;
5
+ /** Patch a transcript's `dispatch` only if its state is still `was`. */ export declare let swap: (g: Graph, eid: Eid, was: unknown, patch: Comp, together?: Bundle[]) => Promise<boolean>;
6
+ /** The children waiting for a place, oldest first. */ export declare let queue: (g: Graph) => Promise<Bundle[]>;
7
+ /** The children holding a place. Their transcript may have just ended. */ export declare let activeChildren: (g: Graph) => Promise<Bundle[]>;
8
+ /** How many children hold a place. */ export declare let active: (g: Graph) => Promise<number>;
9
+ /** The order a child joining the queue takes: behind every other holding a
10
+ * place. A settled child's order no longer places anyone. */ export declare let tail: (g: Graph) => Promise<number>;
11
+ /** Admit the oldest queued children while fewer than the bound are active. */ export declare let admitNext: (g: Graph, limits?: ChildLimits) => Promise<void>;
12
+ /** Give up a child's place while it waits, and answer how to take one back:
13
+ * queue again and return once admitted, or once `signal` aborts. A transcript
14
+ * holding no place (a root) has nothing to give up. */ export declare let aside: (g: Graph, session: Eid, limits: ChildLimits, signal?: AbortSignal) => Promise<() => Promise<void>>;
15
+ //# sourceMappingURL=admission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission.d.ts","sources":["../admission.ts"],"names":[],"mappings":"AAOA,cAAc,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,2BAAgC;AAItE,cAAc,WAAW,wBAAuB;AAKhD;0DAC0D,GAC1D,OAAO,YAAI,iBAAkB,GAAG,SAAS,SAAS,KAAG,OAAO,CAK3D;AA8BD,sEAAsE,GACtE,OAAO,YAAI,OACT,GAAG,OACH,KAAK,KACL,KAAK,OAAO,EACZ,OAAO,MACP,WAAU,aACT,QAAQ,OAAO,EAgDjB;AAED,oDAAoD,GACpD,OAAO,YAAI,QAAe,GAAG,UAAQ,QAAQ,UAG1C;AAEH,wEAAwE,GACxE,OAAO,YAAI,iBAAkB,GAAG,UAAQ,QAAQ,UAAgC;AAEhF,oCAAoC,GACpC,OAAO,YAAI,SAAgB,GAAG,UAAQ,QAAQ,MAAM,EAClB;AAElC;2DAC2D,GAC3D,OAAO,YAAI,OAAc,GAAG,UAAQ,QAAQ,MAAM,EAK/C;AAEH,4EAA4E,GAC5E,OAAO,YAAI,YACT,GAAG,OACH,SAAQ,gBACP,QAAQ,IAAI,EAKd;AAED;;qDAEqD,GACrD,OAAO,YAAI,QACT,GAAG,OACH,SAAS,KACT,QAAQ,aACR,SAAS,gBACR,cAAc,QAAQ,IAAI,GAY5B"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The harness's id for the tool call a JSON-RPC message makes: Claude Code's
3
+ * `claudecode/toolUseId` in the message's `_meta`.
4
+ *
5
+ * ```ts
6
+ * import { callIn } from '@yaks/session/graph'
7
+ * import { assertEquals } from '@std/assert'
8
+ *
9
+ * let message = {
10
+ * method: 'tools/call',
11
+ * params: { name: 'graph_show', _meta: { 'claudecode/toolUseId': 'toolu_1' } },
12
+ * }
13
+ * assertEquals(callIn(message), 'toolu_1')
14
+ * assertEquals(callIn({ method: 'tools/list' }), undefined)
15
+ * ```
16
+ */ export declare let callIn: (message: unknown) => string | undefined;
17
+ //# sourceMappingURL=announce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announce.d.ts","sources":["../announce.ts"],"names":[],"mappings":"AA6DA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,YAAI,SAAU,SAAS,OAAO,KAAG,MAAM,GAAG,SAAS,CAKzD"}
@@ -0,0 +1,200 @@
1
+ import type { Bundle, Eid, Graph } from "@yaks/graph";
2
+ /** Words given to a session. A notice the runner writes with prose, as a
3
+ * compaction's checkpoint, is no one's words, so it never starts a turn. */ export declare let given: (b: Bundle) => boolean;
4
+ /** A reply: what a model said, which answers the words given before it. */ export declare let said: (b: Bundle) => boolean;
5
+ /**
6
+ * The inputs a turn ending at `end` answers: each line given since the reply
7
+ * before it, with a helper's report standing for the inputs of the turn whose
8
+ * call started it. A reply hears up to the ask that wrote it: words given
9
+ * while it was being written are left to the next. `calls` names that call for each child
10
+ * (`spawned{parent, call}`). Of a transcript's newest lines alone (`whole`
11
+ * false), it is undefined where the inputs lie before them.
12
+ *
13
+ * ```ts
14
+ * import { equal } from '@yaks/testing'
15
+ * import { origins } from './answer.ts'
16
+ * let line = (eid: string, b: object) => ({ entity: { eid }, ...b })
17
+ * let lines = [
18
+ * line('a', { content: { body: 'Look into it' } }),
19
+ * line('c', { call: { to: 'spawn' } }),
20
+ * line('r', { content: { body: 'On it.' }, output: {} }),
21
+ * line('d', { content: { body: 'Found it' }, delivery: { child: 'h' } }),
22
+ * ]
23
+ * equal(origins(lines, 4, new Map([['h', 'c']]))?.map((b) => b.entity.eid), ['a'])
24
+ * equal(origins(lines.slice(2), 2, new Map(), false), undefined)
25
+ * let late = [
26
+ * line('a', { content: { body: 'Write the guide' } }),
27
+ * line('k', { ask: { through: 'a' } }),
28
+ * line('b', { content: { body: 'And the logo?' } }),
29
+ * line('g', { content: { body: 'The guide' }, output: { source: 'k' } }),
30
+ * line('k2', { ask: { through: 'g' } }),
31
+ * line('l', { content: { body: 'Logo set' }, output: { source: 'k2' } }),
32
+ * ]
33
+ * equal(origins(late, 3, new Map())?.map((b) => b.entity.eid), ['a'])
34
+ * equal(origins(late, 5, new Map())?.map((b) => b.entity.eid), ['b'])
35
+ * let resumed = [
36
+ * line('a', { content: { body: 'Fix the app' } }),
37
+ * line('k', { ask: { through: 'a' } }),
38
+ * line('w', { notice: {}, output: { source: 'k' }, content: { body: 'Waiting for funds' } }),
39
+ * line('r', { output: { source: 'k' }, content: { body: 'Fixed' } }),
40
+ * ]
41
+ * equal(origins(resumed, 3, new Map())?.map((b) => b.entity.eid), ['a'])
42
+ * ```
43
+ */ export declare let origins: (entries: Bundle[], end: number, calls: Map<string, string>, whole?: boolean) => Bundle[] | undefined;
44
+ /**
45
+ * The entries since the newest words given: the turn being answered.
46
+ *
47
+ * ```ts
48
+ * import { equal } from '@yaks/testing'
49
+ * import { replyOf, turnOf } from './answer.ts'
50
+ * let line = (seq: number, b: object) => ({
51
+ * entity: { eid: `e${seq}` }, entry: { session: 's', seq }, ...b,
52
+ * })
53
+ * let stopped = turnOf([
54
+ * line(1, { content: { body: 'Check the app' } }),
55
+ * line(2, { stop: {}, content: { body: 'Stopped by the person watching.' } }),
56
+ * line(3, { notice: {}, checkpoint: {}, content: { body: 'Summary' } }),
57
+ * ])
58
+ * equal(stopped.length, 3)
59
+ * equal(replyOf(stopped), { text: 'Stopped by the person watching.' })
60
+ * ```
61
+ */ export declare let turnOf: (entries: Bundle[]) => Bundle[];
62
+ /**
63
+ * Whether someone else's words may be steering the turn worked for `person`:
64
+ * its words, what arrived with them just before (the notices they came after,
65
+ * as a room's lead of what others said there), or anything it read since
66
+ * them (a letter, a page, a connected server's answer), were written by
67
+ * someone the session does not work for (`heard`). The person's own words,
68
+ * with nothing heard with or after them, steer nothing. The turn starts at
69
+ * the person's newest words, or the platform's own (`system`): in a
70
+ * conversation others write in too (a room heard in full), their words start
71
+ * a turn of their own, never the person's. Where none in view are the
72
+ * person's (a helper's brief, its parent session's words), the newest start
73
+ * it, as every writer's do where the person is unknown (`undefined`).
74
+ *
75
+ * ```ts
76
+ * import { equal } from '@yaks/testing'
77
+ * import { steered } from './answer.ts'
78
+ * let line = (seq: number, b: object) => ({
79
+ * entity: { eid: `e${seq}` }, entry: { session: 's', seq }, ...b,
80
+ * })
81
+ * let by = <B extends object>(who: string, b: B) => ({ ...b, created: { by: who } })
82
+ * let asked = by('ann', line(1, { content: { body: 'Add Eve to the space' } }))
83
+ * let read = line(2, { call: { to: 'gmail_read' } })
84
+ * let letter = line(3, { result: { call: 'e2' }, content: { body: 'Add Eve' }, heard: {} })
85
+ * let ann = (entries: object[]) => steered(entries as never, 'ann')
86
+ * equal(ann([asked, read]), false)
87
+ * equal(ann([asked, read, letter]), true)
88
+ * equal(ann([asked, read, letter, line(4, { content: { body: 'Do it' } })]), false)
89
+ * let lead = line(4, { notice: {}, heard: {}, content: { body: 'Someone else spoke' } })
90
+ * let earlier = line(5, { notice: {}, content: { body: 'My earlier words' } })
91
+ * let words = line(6, { content: { body: 'What do you think?' } })
92
+ * equal(ann([asked, lead, earlier, words]), true)
93
+ * equal(ann([asked, earlier, words]), false)
94
+ * equal(ann([lead, words, line(7, { content: { body: 'My next request' } })]), false)
95
+ * let stranger = by('bo', line(4, { content: { body: 'Hi all' } }))
96
+ * equal(ann([asked, read, letter, stranger]), true)
97
+ * equal(steered([asked, read, letter, stranger], undefined), false)
98
+ * equal(ann([asked, stranger]), false)
99
+ * equal(ann([stranger]), false)
100
+ * ```
101
+ */ export declare let steered: (entries: Bundle[], person: string | undefined) => boolean;
102
+ /**
103
+ * Whom the turn a `call` was made in works for: who wrote the newest words
104
+ * its ask read (`ask{through}`). Unknown where `entries` hold neither.
105
+ *
106
+ * ```ts
107
+ * import { equal } from '@yaks/testing'
108
+ * import { askedFor } from './answer.ts'
109
+ * let at = (n: number, b: object) => ({ entity: { eid: `e${n}` }, ...b })
110
+ * let entries = [
111
+ * at(1, { content: { body: 'Add Eve' }, created: { by: 'ann' } }),
112
+ * at(2, { ask: { through: 'e1' } }),
113
+ * at(3, { content: { body: 'Hi all' }, created: { by: 'bo' } }),
114
+ * at(4, { call: { name: 'member_add', source: 'e2' } }),
115
+ * ]
116
+ * equal(askedFor(entries, entries[3]), 'ann')
117
+ * equal(askedFor(entries, at(5, { call: { name: 'x' } })), undefined)
118
+ * ```
119
+ */ export declare let askedFor: (entries: Bundle[], call: Bundle) => string | undefined;
120
+ /** What a turn ended with in plain words, what went wrong where it did, and
121
+ * whether the host broke it (`broke`): the work stopped before it could
122
+ * finish, on the host's side. */ export type Reply = {
123
+ text: string;
124
+ fault?: string;
125
+ broke?: true;
126
+ };
127
+ /** Who a reply's words name: the `host` at fault where something failed,
128
+ * and the assistant answering (`name`). */ export type Naming = {
129
+ host?: string;
130
+ name?: string;
131
+ };
132
+ /**
133
+ * What ended a session's work: its newest reply, else what kept it from one,
134
+ * in plain words, naming the host where it is at fault ({@link Naming}). `fault` is what went
135
+ * wrong, for the host's tracker: a refusal, a failure, a step that threw, or
136
+ * an end with no reply. A person's stop is no fault, nor a ceiling met (a
137
+ * spent budget says so in its own words). Every end the host is at fault for
138
+ * `broke` it; a model that declined, was busy or is unavailable did not. A
139
+ * reply with no words to what no person said (the platform's own words, or a
140
+ * helper's report) {@link PASS}es: the model had nothing to add.
141
+ *
142
+ * ```ts
143
+ * import { equal } from '@yaks/testing'
144
+ * import { replyOf } from './answer.ts'
145
+ * let line = (seq: number, b: object) => ({
146
+ * entity: { eid: `e${seq}` }, entry: { session: 's', seq }, ...b,
147
+ * })
148
+ * let said = line(2, { output: { source: 'a' }, content: { body: 'Done.' } })
149
+ * equal(replyOf([said]), { text: 'Done.' })
150
+ * equal(replyOf([said, line(3, {
151
+ * output: { source: 'a' }, refusal: { code: 'request' },
152
+ * content: { body: '400 tools.26: input_schema does not support oneOf' },
153
+ * })], { host: 'yaks.app' }), {
154
+ * text: "I couldn't finish this: something in yaks.app failed while" +
155
+ * ' working on it. The people who run yaks.app have been told.',
156
+ * fault: 'request: 400 tools.26: input_schema does not support oneOf',
157
+ * broke: true,
158
+ * })
159
+ * equal(replyOf([line(3, {
160
+ * output: { source: 'a' }, refusal: { code: 'limit' },
161
+ * content: { body: "clerk's model and voice budget for this month is spent" },
162
+ * })]), { text: "clerk's model and voice budget for this month is spent" })
163
+ * equal(replyOf([line(3, {
164
+ * exception: { type: 'Unknown', value: 'unknown prop: .presence' },
165
+ * content: { body: 'Unknown: unknown prop: .presence' },
166
+ * })]).fault, 'Unknown: unknown prop: .presence')
167
+ * equal(replyOf([]).fault, 'ended without an answer')
168
+ * let quiet = line(5, { output: { source: 'a' }, content: { body: '' } })
169
+ * let report = line(4, { delivery: { child: 'h' }, content: { body: 'Done' } })
170
+ * let note = line(4, { system: {}, content: { body: 'Still working' } })
171
+ * equal(replyOf([report, quiet]), { text: '(listening)' })
172
+ * equal(replyOf([note, quiet]), { text: '(listening)' })
173
+ * let asked = line(4, { content: { body: 'Fix the app' } })
174
+ * equal(replyOf([asked, quiet]).fault, 'ended without an answer')
175
+ * let refused = line(4, {
176
+ * result: { call: 'c' }, refusal: { code: 'arguments' },
177
+ * content: { body: 'Invalid tool arguments: missing command' },
178
+ * })
179
+ * equal(replyOf([said, refused, line(5, { ask: {} })]).fault,
180
+ * 'ended without an answer')
181
+ * ```
182
+ */ export declare let replyOf: (entries: Bundle[], _dts_1: never) => Reply;
183
+ /** A transcript's answer as its turn ends: the {@link Reply}, the newest
184
+ * words given (`mark`, absent where none were), and the inputs it answers
185
+ * (`given`). A helper's or a fork's answers none: its report goes to the
186
+ * session that started it (./children.ts `deliverChild`). */ export type Answer = Reply & {
187
+ mark?: Bundle;
188
+ given: Bundle[];
189
+ };
190
+ /**
191
+ * The answer of `session`'s turn ({@link Answer}), read back from its newest
192
+ * line only as far as it needs, never every line a conversation has held for
193
+ * weeks: a helper's own turn, and a conversation's back to the reply before
194
+ * the words it answers and before each call that started a helper whose
195
+ * report stands for words. `naming` says who a failure's words name
196
+ * ({@link replyOf}). `replied` reads the turn of the newest reply, said while
197
+ * newer words wait (./run.ts `Runner.replied`): those words are the next
198
+ * turn's, not one that ended without an answer.
199
+ */ export declare let answerOf: (g: Graph, session: Eid, naming?: Naming, replied?: boolean) => Promise<Answer>;
200
+ //# sourceMappingURL=answer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer.d.ts","sources":["../answer.ts"],"names":[],"mappings":"AASA,cAAc,MAAM,EAAQ,GAAG,EAAE,KAAK,2BAAgC;AAUtE;0EAC0E,GAC1E,OAAO,YAAI,QAAS,GAAG,WAAS,OAAO,CAAqC;AAE5E,yEAAyE,GACzE,OAAO,YAAI,OAAQ,GAAG,WAAS,OAAO,CACa;AAiBnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCC,GACD,OAAO,YAAI,UACT,SAAS,UACT,KAAK,MAAM,EACX,OAAO,IAAI,MAAM,EAAE,MAAM,GACzB,oBACC,WAAW,SAAS,CAwBtB;AA8BD;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,YAAI,SAAU,SAAS,aAAW,SACiB;AAK1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCC,GACD,OAAO,YAAI,UACT,SAAS,UACT,QAAQ,MAAM,GAAG,SAAS,KACzB,OAAO,CAOT;AAED;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,YAAI,WACT,SAAS,UACT,MAAM,WACL,MAAM,GAAG,SAAS,CASpB;AAkBD;;+BAE+B,GAC/B,YAAY;EAAU,MAAM,MAAM;EAAE,QAAQ,MAAM;EAAE,QAAQ,IAAI;;AAEhE;yCACyC,GACzC,YAAY;EAAW,OAAO,MAAM;EAAE,OAAO,MAAM;;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDC,GACD,OAAO,YAAI,UACT,SAAS,UACT,kBACC,MAwCF;AAED;;;2DAG2D,GAC3D,YAAY,SAAS;EAAU,OAAO;EAAQ,OAAO;;AAErD;;;;;;;;;CASC,GACD,OAAO,YAAI,WACT,GAAG,OACH,SAAS,KACT,SAAS,QACT,sBACC,QAAQ,QAmCV"}
@@ -0,0 +1,10 @@
1
+ import type { Bundle } from "@yaks/graph/bundle";
2
+ import type { Graph } from "@yaks/graph";
3
+ /** Append an ordinary input or a passive notice. The session plugin assigns seq
4
+ * inside the graph transaction. Supply an eid for idempotent delivery and from
5
+ * for words authored outside the receiving model's own conversation. */ export declare let appendEntry: (g: Graph, session: string, body: string, opts?: {
6
+ eid?: string;
7
+ notice?: boolean;
8
+ from?: string;
9
+ }) => Bundle[] | Promise<Bundle[]>;
10
+ //# sourceMappingURL=append.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"append.d.ts","sources":["../append.ts"],"names":[],"mappings":"AAGA,cAAc,MAAM,kCAA6C;AACjE,cAAc,KAAK,2BAAgC;AA2LnD;;sEAEsE,GACtE,OAAO,YAAI,cAAe,GAAG,OAAO,SAAS,MAAM,EAAE,MAAM,MAAM,EAAE;EACjE,MAAM,MAAM;EACZ,SAAS,OAAO;EAChB,OAAO,MAAM;MACN,WAAW,QAAQ,UAMvB"}
@@ -0,0 +1,6 @@
1
+ export type Chunks = {
2
+ read: () => Promise<string | undefined>;
3
+ close: () => Promise<void>;
4
+ done: boolean;
5
+ };
6
+ //# sourceMappingURL=archive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archive.d.ts","sources":["../archive.ts"],"names":[],"mappings":"AAMA,YAAY;EACV,YAAY,QAAQ,MAAM,GAAG,SAAS;EACtC,aAAa,QAAQ,IAAI;EACzB,MAAM,OAAO"}
@@ -0,0 +1,11 @@
1
+ import type { Bundle, Eid, Graph } from "@yaks/graph";
2
+ /** The task words sent to `session` are about: `task` where the caller named
3
+ * one, else the one task the session holds. None where it holds several or
4
+ * none, or the graph keeps no comments. */ export declare let askedOf: (g: Pick<Graph, 'vocab' | 'read'>, session: Eid, task?: Eid) => Promise<Eid | undefined>;
5
+ /** The comment that keeps words sent to `session` on `task`: it is also the
6
+ * knock that carries them to the session, so it is said once. */ export declare let ask: (session: Eid, task: Eid, text: string, from?: Eid) => Bundle;
7
+ /** Every ask on these tasks, oldest first, each as its task's eid and the row
8
+ * with its author's title (`by`). */ export declare let asksOn: (g: Pick<Graph, 'vocab' | 'read' | 'get'>, tasks: Eid[]) => Promise<Map<Eid, Bundle[]>>;
9
+ /** The asks as a run reads them: one per line under its id and who asked,
10
+ * its words whole and indented beneath. */ export declare let asksSaid: (g: Pick<Graph, 'vocab' | 'get'>, rows: Bundle[], indent?: string) => Promise<string[]>;
11
+ //# sourceMappingURL=asks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asks.d.ts","sources":["../asks.ts"],"names":[],"mappings":"AAWA,cAAc,MAAM,EAAQ,GAAG,EAAE,KAAK,2BAAgC;AAStE;;yCAEyC,GACzC,OAAO,YAAI,UACT,GAAG,KAAK,OAAO,UAAU,SACzB,SAAS,KACT,OAAO,QACN,QAAQ,MAAM,SAAS,EAKzB;AAED;+DAC+D,GAC/D,OAAO,YAAI,MACT,SAAS,KACT,MAAM,KACN,MAAM,MAAM,EACZ,OAAO,QACN,OAKD;AAEF;mCACmC,GACnC,OAAO,YAAI,SACT,GAAG,KAAK,OAAO,UAAU,SAAS,QAClC,OAAO,UACN,QAAQ,IAAI,KAAK,WAsBnB;AAED;yCACyC,GACzC,OAAO,YAAI,WACT,GAAG,KAAK,OAAO,UAAU,QACzB,MAAM,UACN,oBACC,QAAQ,MAAM,IAsBhB"}
@@ -0,0 +1,15 @@
1
+ import type { Eid, Hook } from "@yaks/graph";
2
+ /** What the audit needs from the application: a clock, and an id for the row
3
+ * it writes. */ export type AuditOpts = {
4
+ /** the moment the record is stamped with (default: now, ISO-8601) */ now?: () => string;
5
+ /** the eid the row is written under (default: `crypto.randomUUID()`) */ mint?: () => Eid;
6
+ };
7
+ /**
8
+ * The `audit` hook: turn a {@link Bounced} that rolled a batch back into a
9
+ * `conflict` record, written through the detached transaction the phase
10
+ * receives. Any other refusal passes through untouched — this hook audits
11
+ * collisions, not every failure.
12
+ *
13
+ * Registered by {@link https://jsr.io/@yaks/session/doc/~/sessions | sessions}.
14
+ */ export declare let auditing: (opts?: AuditOpts) => Hook;
15
+ //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.d.ts","sources":["../audit.ts"],"names":[],"mappings":"AAoBA,cAAsB,GAAG,EAAE,IAAI,2BAAgC;AAM/D;cACc,GACd,YAAY;EACV,mEAAmE,GACnE,YAAY,MAAM;EAClB,sEAAsE,GACtE,aAAa;;AAGf;;;;;;;CAOC,GACD,OAAO,YAAI,WACR,OAAM,cAAiB,KAoBvB"}
@@ -0,0 +1,19 @@
1
+ import type { Eid } from "@yaks/graph";
2
+ /**
3
+ * A lock somebody else holds. The take is refused and the whole batch rolls
4
+ * back: a lock is a lease, not a patch, so the way to get one is to wait for
5
+ * the holder to let go — never to write over them.
6
+ *
7
+ * The three eids are the audit: `@yaks/session`'s `audit` hook turns a thrown
8
+ * `Bounced` into a `conflict` record after the rollback.
9
+ */ export declare class Bounced extends Error {
10
+ on: Eid;
11
+ loser: Eid;
12
+ holder: Eid;
13
+ /**
14
+ * @param on the entity both sessions wanted
15
+ * @param loser the session whose take was refused
16
+ * @param holder the session that already held the lock
17
+ */ constructor(on: Eid, loser: Eid, holder: Eid);
18
+ }
19
+ //# sourceMappingURL=bounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounce.d.ts","sources":["../bounce.ts"],"names":[],"mappings":"AASA,cAAc,GAAG,2BAAgC;AAEjD;;;;;;;CAOC,GACD,OAAO,cAAM,gBAAgB;EAOlB,IAAI;EACJ,OAAO;EACP,QAAQ;EARjB;;;;GAIC,GACD,YACE,AAAO,IAAI,GAAG,EACd,AAAO,OAAO,GAAG,EACjB,AAAO,QAAQ,GAAG;AAKtB"}
package/_dist/bus.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { Feed } from "@yaks/host";
2
+ import { type Recalling } from "./recall.js";
3
+ /** What a door over this host's graph needs to hear for one session, and to
4
+ * set beside its person's words what they said before (./recall.ts). */ export type Door = Recalling & {
5
+ feed?: Feed;
6
+ stopping?: AbortSignal;
7
+ };
8
+ //# sourceMappingURL=bus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bus.d.ts","sources":["../bus.ts"],"names":[],"mappings":"AA0BA,cAAc,IAAI,0BAA+B;AAoCjD,SAA8B,KAAK,SAAS,sBAAqB;AA6ZjE;sEACsE,GACtE,YAAY,OAAO;EACjB,OAAO;EACP,WAAW"}
@@ -0,0 +1,45 @@
1
+ import type { Bundle, Graph } from "@yaks/graph";
2
+ export type CacheOpts = {
3
+ from?: string;
4
+ until?: string;
5
+ session?: string;
6
+ requests?: boolean;
7
+ };
8
+ export type CacheRequest = {
9
+ request: string;
10
+ at: string | null;
11
+ session: string;
12
+ provider: string;
13
+ model: string;
14
+ path: string;
15
+ input_tokens: number | null;
16
+ cached_tokens: number | null;
17
+ cached_share: number | null;
18
+ };
19
+ export type CacheTotals = {
20
+ requests: number;
21
+ input_tokens: number;
22
+ cached_tokens: number;
23
+ reported_input_tokens: number;
24
+ reported_cached_tokens: number;
25
+ unknown_cache_input_tokens: number;
26
+ unknown_input_requests: number;
27
+ unknown_cache_requests: number;
28
+ zero_cache_requests: number;
29
+ cached_share: number | null;
30
+ };
31
+ export type CacheReport = {
32
+ from: string | null;
33
+ until: string | null;
34
+ total: CacheTotals;
35
+ imported_observations: number;
36
+ groups: Record<string, (CacheTotals & {
37
+ key: string;
38
+ })[]>;
39
+ requests?: CacheRequest[];
40
+ };
41
+ /** A bound as the UTC instant it names, read in the time grammar
42
+ * (`timeInstant`); the upper bound is exclusive for adjacent runs. */ export declare let cacheTime: (value?: string) => string | undefined;
43
+ /** Pure reduction of request bundles plus their session/call/model metadata. */ export declare let cacheOf: (rows: Bundle[], metadata?: Bundle[], opts?: CacheOpts) => CacheReport;
44
+ /** Select only observations in range, then batch-fetch provenance, not logs. */ export declare let cacheRead: (g: Pick<Graph, 'read' | 'get'>, opts?: CacheOpts) => Promise<CacheReport>;
45
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sources":["../cache.ts"],"names":[],"mappings":"AAIA,cAAc,MAAM,EAAQ,KAAK,2BAAgC;AAIjE,YAAY;EACV,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,UAAU,MAAM;EAChB,WAAW,OAAO;;AAGpB,YAAY;EACV,SAAS,MAAM;EACf,IAAI,MAAM,GAAG,IAAI;EACjB,SAAS,MAAM;EACf,UAAU,MAAM;EAChB,OAAO,MAAM;EACb,MAAM,MAAM;EACZ,cAAc,MAAM,GAAG,IAAI;EAC3B,eAAe,MAAM,GAAG,IAAI;EAC5B,cAAc,MAAM,GAAG,IAAI;;AAG7B,YAAY;EACV,UAAU,MAAM;EAChB,cAAc,MAAM;EACpB,eAAe,MAAM;EACrB,uBAAuB,MAAM;EAC7B,wBAAwB,MAAM;EAC9B,4BAA4B,MAAM;EAClC,wBAAwB,MAAM;EAC9B,wBAAwB,MAAM;EAC9B,qBAAqB,MAAM;EAC3B,cAAc,MAAM,GAAG,IAAI;;AAG7B,YAAY;EACV,MAAM,MAAM,GAAG,IAAI;EACnB,OAAO,MAAM,GAAG,IAAI;EACpB,OAAO;EACP,uBAAuB,MAAM;EAC7B,QAAQ,OAAO,MAAM,GAAG;IAAgB,KAAK,MAAM;;EACnD,WAAW;;AAWb;oEACoE,GACpE,OAAO,YAAI,YAAa,QAAQ,MAAM,KAAG,MAAM,GAAG,SAAS,CAU1D;AAuCD,8EAA8E,GAC9E,OAAO,YAAI,UACT,MAAM,UACN,WAAU,UACV,OAAM,cACL,YAuEF;AAED,8EAA8E,GAC9E,OAAO,YAAI,YACT,GAAG,KAAK,OAAO,SAAS,QACxB,OAAM,cACL,QAAQ,aAuCV"}
@@ -0,0 +1,6 @@
1
+ import type { Bundle, Graph } from "@yaks/graph";
2
+ /** What a report calls a row: its short id (`S-12`) where its store numbers
3
+ * it, else its whole eid, which every tool takes. */ export declare let calledIn: (g: Graph, b: Bundle) => string;
4
+ /** The main thread above a chain of passive children. */ export declare let noticeParent: (g: Graph, child: string) => Promise<string>;
5
+ /** Raise exceptional work without starting a turn in the main thread. */ export declare let raiseNotice: (g: Graph, child: string, body: string, eid: string) => Promise<Bundle[]>;
6
+ //# sourceMappingURL=child-notice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-notice.d.ts","sources":["../child-notice.ts"],"names":[],"mappings":"AAGA,cAAc,MAAM,EAAQ,KAAK,2BAAgC;AAMjE;mDACmD,GACnD,OAAO,YAAI,WAAY,GAAG,OAAO,GAAG,WAAS,MAAM,CACM;AAEzD,uDAAuD,GACvD,OAAO,YAAI,eAAsB,GAAG,OAAO,OAAO,MAAM,KAAG,QAAQ,MAAM,EAMxE;AAaD,uEAAuE,GACvE,OAAO,YAAI,cACT,GAAG,OACH,OAAO,MAAM,EACb,MAAM,MAAM,EACZ,KAAK,MAAM,KACV,QAAQ,UAKT"}
@@ -0,0 +1,59 @@
1
+ import type { Bundle, Comp, Eid, Graph } from "@yaks/graph";
2
+ import { type Tool } from "./react.js";
3
+ import { type Clock } from "@yaks/fp";
4
+ export type ChildLimits = {
5
+ /** Defaults for user-created tasks, resolved before durable queue admission. */ taskDefaults?: (parent: Eid, child: Eid) => Promise<Record<string, unknown>>;
6
+ maxChildren?: number;
7
+ maxSessions?: number;
8
+ /** Fork the current request with a harness-written instruction. */ forkLatest?: boolean;
9
+ /** Return a historical recap for a cold fork, scoped to its request. */ forkRecap?: (request: Bundle, visible: ReadonlySet<Eid>) => Promise<string | undefined>;
10
+ /** Application-owned optional spawn parameters and preparation, applied when
11
+ * the child is admitted. */ childProperties?: Record<string, unknown>;
12
+ prepareChild?: (input: {
13
+ parent: Eid;
14
+ child: Eid;
15
+ args: Record<string, unknown>;
16
+ }) => Promise<Omit<Bundle, 'entity'>>;
17
+ /** The clock a wait keeps time by (default the system's). */ clock?: Clock;
18
+ /** The model a child asks (`using{provider, model, effort}`, each by eid
19
+ * or by name), given the one it would take: its parent's in force, with the
20
+ * model and effort its spawn named. Without this, that one. */ using?: (using: Comp, parent: Comp) => Comp | Promise<Comp>;
21
+ };
22
+ /** The session that directly started this helper or fork. */ export declare let parentOf: (g: Graph, session: Eid) => Promise<Eid | undefined>;
23
+ export declare let childPlace: (g: Graph, eid: Eid) => Promise<Bundle | undefined>;
24
+ /** The child a call starts ({@link spawnChild}'s `source`): the same each
25
+ * time it is asked, so a replay finds it, and so does a caller that names
26
+ * its own sources. */ export declare let childOf: (call: Eid) => Eid;
27
+ /** Direct children, including forks created by the session tools. */ export declare let children: (g: Graph, session: Eid) => Promise<Bundle[]>;
28
+ /** The admission path the harness calls, shared by root starts and delegated
29
+ * starts. */ export declare let admit: <T>(g: Graph, parent: Eid | undefined, limits: ChildLimits, create: () => Promise<T>) => Promise<T>;
30
+ /** Submit helper work from an outside caller, without inventing a model tool
31
+ * call in the parent's transcript. It shares the model's admission path. */ export declare let spawnChild: (g: Graph, session: Eid, args: Record<string, unknown>, limits?: ChildLimits, source?: Eid) => Promise<Eid>;
32
+ /** Submit a microtask under the session's claimed work (or the session when
33
+ * it holds no task). The task, containment, child and claim commit together:
34
+ * queued work is accepted without preparing a checkout. No filing metadata is inherited.
35
+ * The first line is the title; the complete submitted text is kept as body.
36
+ * This is called by a person, not by a model, so delivery is an ordinary
37
+ * input. */ export declare let taskEntry: (g: Graph, session: Eid, text: string, limits?: ChildLimits) => Promise<{
38
+ task: Eid;
39
+ child: Eid;
40
+ }>;
41
+ /** The model-facing tools use the same admission and spawn write as
42
+ * taskEntry. */ export declare let sessionTools: (g: Graph, limits?: ChildLimits) => Tool[];
43
+ /** The session `session` works for: up its `spawned` links to a person's
44
+ * conversation, or to a session started on its own (`spawned.quiet`). */ export declare let topOf: (g: Graph, session: Eid) => Promise<Eid>;
45
+ /**
46
+ * Stop `session` and every helper under it, however deep, in one write: the
47
+ * step each is in is withdrawn (./run.ts), and none goes on past it until new
48
+ * words reopen it. A helper `by` stops says who stopped it in its stop, which
49
+ * the session that started it reads in its report (`deliverChild`), and the
50
+ * conversation it works for ({@link topOf}), where that is further up, is told
51
+ * of its end in a notice, as a passive child's is (./child-notice.ts), which
52
+ * no report of its own would tell it and which starts no turn. Answers whether
53
+ * any of them was working; where none was, nothing is written.
54
+ */ export declare let stopAll: (g: Graph, session: Eid, by: Eid, via?: Eid) => Promise<boolean>;
55
+ /** Stop a fork under the same conversation when its request changes. */ export declare let stopFork: (g: Graph, by: Eid) => Tool;
56
+ export declare let workingChildren: (g: Graph, session: Eid, repliesOnly?: boolean) => Promise<boolean>;
57
+ /** Build one idempotent completion receipt, while holding the parent's queue.
58
+ * The final-entry-derived id also allows a child to be sent another turn. */ export declare let deliverChild: (g: Graph, child: Eid, now?: number) => Promise<number | undefined>;
59
+ //# sourceMappingURL=children.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"children.d.ts","sources":["../children.ts"],"names":[],"mappings":"AAWA,cAAc,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,2BAAgC;AAOtE,SACE,KAAK,IAAI,qBAKQ;AAGnB,SAAS,KAAK,KAAK,wBAAqC;AAMxD,YAAY;EACV,8EAA8E,GAC9E,gBAAgB,QAAQ,KAAK,OAAO,QAAQ,QAAQ,OAAO,MAAM,EAAE,OAAO;EAC1E,cAAc,MAAM;EACpB,cAAc,MAAM;EACpB,iEAAiE,GACjE,aAAa,OAAO;EACpB,sEAAsE,GACtE,aACE,SAAS,QACT,SAAS,YAAY,SAClB,QAAQ,MAAM,GAAG,SAAS;EAC/B;4BAC0B,GAC1B,kBAAkB,OAAO,MAAM,EAAE,OAAO;EACxC,gBACE;IAAS,QAAQ;IAAK,OAAO;IAAK,MAAM,OAAO,MAAM,EAAE,OAAO;QAC3D,QAAQ,KAAK,QAAQ;EAC1B,2DAA2D,GAC3D,QAAQ;EACR;;+DAE6D,GAC7D,SAAS,OAAO,MAAM,QAAQ,SAAS,OAAO,QAAQ;;AAUxD,2DAA2D,GAC3D,OAAO,YAAI,WACT,GAAG,OACH,SAAS,QACR,QAAQ,MAAM,SAAS,EAGzB;AAGD,OAAO,YAAI,aACT,GAAG,OACH,KAAK,QACJ,QAAQ,SAAS,SAAS,EAItB;AAaP;;oBAEoB,GACpB,OAAO,YAAI,UAAW,MAAM,QAAM,IAAkC;AAEpE,mEAAmE,GACnE,OAAO,YAAI,WAAY,GAAG,OAAO,SAAS,QAAM,QAAQ,UACK;AAM7D;WACW,GACX,OAAO,YAAI,QAAS,GAClB,GAAG,OACH,QAAQ,MAAM,SAAS,EACvB,QAAQ,aACR,cAAc,QAAQ,OACrB,QAAQ,GAqBV;AA4VD;0EAC0E,GAC1E,OAAO,YAAI,aACT,GAAG,OACH,SAAS,KACT,MAAM,OAAO,MAAM,EAAE,OAAO,GAC5B,SAAQ,aACR,SAAQ,QACP,QAAQ,KAOR;AAEH;;;;;UAKU,GACV,OAAO,YAAI,YACT,GAAG,OACH,SAAS,KACT,MAAM,MAAM,EACZ,SAAQ,gBACP;EAAU,MAAM;EAAK,OAAO;GAkB9B;AAED;cACc,GACd,OAAO,YAAI,eAAgB,GAAG,OAAO,SAAQ,gBAAmB,OAsI/D;AAED;uEACuE,GACvE,OAAO,YAAI,QAAe,GAAG,OAAO,SAAS,QAAM,QAAQ,KAI1D;AAeD;;;;;;;;;CASC,GACD,OAAO,YAAI,UACT,GAAG,OACH,SAAS,KACT,IAAI,KACJ,MAAM,QACL,QAAQ,OAAO,EA4DjB;AAED,sEAAsE,GACtE,OAAO,YAAI,WAAY,GAAG,OAAO,IAAI,QAAM,KAgCzC;AAMF,OAAO,YAAI,kBACT,GAAG,OACH,SAAS,KACT,0BACC,QAAQ,OAAO,EAYjB;AAED;2EAC2E,GAC3E,OAAO,YAAI,eACT,GAAG,OACH,OAAO,KACP,MAAK,MAAM,KACV,QAAQ,MAAM,GAAG,SAAS,EA4F5B"}
package/_dist/cli.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export declare let tools: {
2
+ session_context: (args: Record<string, unknown>, context: {
3
+ json: boolean;
4
+ config?: string;
5
+ out: (text: string) => void;
6
+ }) => number | undefined;
7
+ };
8
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sources":["../cli.ts"],"names":[],"mappings":"AAKA,OAAO,YAAI;EACT,kBACE,MAAM,OAAO,MAAM,EAAE,OAAO,GAC5B;IAAW,MAAM,OAAO;IAAE,SAAS,MAAM;IAAE,MAAM,MAAM,MAAM,KAAK,IAAI;QACnE,MAAM,GAAG,SAAS;EAkBxB"}
@@ -0,0 +1,9 @@
1
+ import type { VocabDoc } from "@yaks/vocab";
2
+ /** The session vocabulary, to load beside the packages whose components a
3
+ * transcript uses — what serves an ask (@yaks/model), what a call and its
4
+ * result are (@yaks/tools), what an instruction is made of (@yaks/context):
5
+ * `loadVocab([sessionDoc, modelDoc, toolsDoc, contextDoc, ...mine])`. */ export declare let sessionDoc: VocabDoc;
6
+ export declare let SESSION: string;
7
+ export declare let CLAIM: string;
8
+ export declare let CONFLICT: string;
9
+ //# sourceMappingURL=comp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comp.d.ts","sources":["../comp.ts"],"names":[],"mappings":"AAkEA,cAAc,QAAQ,2BAAgC;AAGtD;;;uEAGuE,GACvE,OAAO,YAAI,YAAY,SAAc;AAErC,OAAO,YAAI,gBAAmB;AAC9B,OAAO,YAAI,cAAe;AAC1B,OAAO,YAAI,iBAAqB"}
@@ -0,0 +1,19 @@
1
+ import type { Bundle } from "@yaks/graph";
2
+ /** The context window, in tokens, of a model whose row and provider name
3
+ * none (@yaks/model `model.context`, `provider.context`). */ export declare let CONTEXT: number;
4
+ /** Estimate the tokens in serialized text. Multibyte text gets a larger
5
+ * allowance because a single character may take several tokens. */ export declare let tokens: (value: unknown) => number;
6
+ /**
7
+ * The lines of a transcript a turn reads: what a model is sent (inputs,
8
+ * replies, calls and their results), without the record kept beside them
9
+ * (asks, errors), and without the typed questions other turns asked or the
10
+ * answers they got. Those are rows for whoever asked (a page acts on them),
11
+ * not lines of the conversation, so a wake that asks every few minutes never
12
+ * crowds out what was said. `asking` is the entry whose questions this turn
13
+ * asks: it reads that one.
14
+ */ export declare let lines: (entries: Bundle[], asking?: Bundle) => Bundle[];
15
+ /** The newest `n` lines of a transcript, reaching back to the input that
16
+ * began the turn they cut into, so no call or result is sent without its
17
+ * pair: what a turn sends when its `sending.window` is `n`. All of them when
18
+ * `n` is not a count. */ export declare let recent: (entries: Bundle[], n?: unknown) => Bundle[];
19
+ //# sourceMappingURL=compact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compact.d.ts","sources":["../compact.ts"],"names":[],"mappings":"AAKA,cAAc,MAAM,2BAAsC;AA8D1D;2DAC2D,GAC3D,OAAO,YAAI,gBAAiB;AAoB5B;iEACiE,GACjE,OAAO,YAAI,SAAU,OAAO,OAAO,KAAG,MAAM,CAI3C;AAoED;;;;;;;;CAQC,GACD,OAAO,YAAI,QAAS,SAAS,UAAU,SAAS,WAAS,SAOtD;AAEH;;;uBAGuB,GACvB,OAAO,YAAI,SAAU,SAAS,UAAU,IAAI,OAAO,KAAG,SAMrD"}