@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/compact_ask.js ADDED
@@ -0,0 +1,280 @@
1
+ // Record a model exchange through the existing request/session components.
2
+ // Passive inputs keep this observed exchange out of the session runner's work.
3
+ import { derivedEid, identityEid } from "@yaks/graph/identity";
4
+ import { Stale } from "@yaks/graph/errors";
5
+ import { token } from "@yaks/graph/sha256";
6
+ import { attemptState } from "./attempt.js";
7
+ import { toldRow } from "./told.js";
8
+ import { MODEL, ModelError } from "@yaks/model";
9
+ // Failed provider responses may contain usage even when no Reply was returned.
10
+ let failureUsage = (error)=>{
11
+ if (!(error instanceof ModelError) || !error.response?.body) return;
12
+ try {
13
+ let raw = JSON.parse(error.response.body);
14
+ let usage = raw.response?.usage ?? raw.usage;
15
+ if (!usage || typeof usage != 'object') return;
16
+ let values = {
17
+ input_tokens: usage.input_tokens,
18
+ output_tokens: usage.output_tokens,
19
+ total_tokens: usage.total_tokens,
20
+ cached_tokens: usage.input_tokens_details?.cached_tokens,
21
+ reasoning_tokens: usage.output_tokens_details?.reasoning_tokens
22
+ };
23
+ let valid = Object.entries(values).filter(([, v])=>typeof v == 'number' && Number.isFinite(v) && v >= 0);
24
+ return valid.length ? Object.fromEntries(valid) : undefined;
25
+ } catch {
26
+ return;
27
+ }
28
+ };
29
+ /** Deliver a saved passive exchange even though its transcript owes no model turn. */ export let completeCompact = async (g, ask, { reply, mark })=>{
30
+ if (attemptState(ask) != 'inflight') return;
31
+ let session = ask.entry.session;
32
+ let texts = reply.items.filter((i)=>i.kind == 'assistant').map((i)=>i.text);
33
+ let empty = !texts.join('\n').trim() ? new ModelError('compaction', 'Empty summary') : undefined;
34
+ let actor = {
35
+ by: String(ask.ask.to),
36
+ via: session
37
+ };
38
+ try {
39
+ await g.apply([
40
+ {
41
+ entity: ask.entity,
42
+ $actor: actor,
43
+ $was: {
44
+ attempt: {
45
+ by: token(ask.attempt.by)
46
+ }
47
+ },
48
+ attempt: {
49
+ by: null
50
+ },
51
+ completed: {},
52
+ ...empty ? {
53
+ failed: {
54
+ reason: empty.message
55
+ },
56
+ refusal: {
57
+ code: empty.code
58
+ }
59
+ } : {},
60
+ ...mark,
61
+ ...reply.usage ? {
62
+ usage: reply.usage
63
+ } : {},
64
+ ...reply.cost == null ? {} : {
65
+ cost: {
66
+ dollars: reply.cost,
67
+ reported: reply.costReported ?? true
68
+ }
69
+ }
70
+ },
71
+ ...(empty ? [
72
+ empty.message
73
+ ] : texts).map((body, index)=>({
74
+ entity: {
75
+ eid: derivedEid('compaction-result|' + ask.entity.eid + '|' + index)
76
+ },
77
+ $actor: actor,
78
+ entry: {
79
+ session
80
+ },
81
+ output: {
82
+ source: ask.entity.eid
83
+ },
84
+ content: {
85
+ body
86
+ }
87
+ }))
88
+ ], {
89
+ trusted: true
90
+ });
91
+ } catch (error) {
92
+ if (!(error instanceof Stale) || error.eid != ask.entity.eid || error.comp != 'attempt') throw error;
93
+ }
94
+ };
95
+ /** One observed compaction exchange, with stable affinity across cuts. */ export let compactAsk = async (g, parent, source, offered, req)=>{
96
+ let served = offered;
97
+ let conversation = identityEid('compaction', [
98
+ parent
99
+ ]);
100
+ let tool = identityEid('tool', [
101
+ 'session_compact'
102
+ ]);
103
+ let call = crypto.randomUUID();
104
+ let input = crypto.randomUUID();
105
+ let ask = crypto.randomUUID();
106
+ let model = identityEid(MODEL, [
107
+ served.name
108
+ ]);
109
+ let provider = served.provider;
110
+ let actor = {
111
+ by: model,
112
+ via: conversation
113
+ };
114
+ let save = (rows)=>g.apply(rows.map((b)=>({
115
+ ...b,
116
+ $actor: actor
117
+ })), {
118
+ trusted: true
119
+ });
120
+ req = {
121
+ ...req,
122
+ conversation,
123
+ call: ask
124
+ };
125
+ let told = req.instructions ? toldRow(req.instructions) : undefined;
126
+ let sending = {
127
+ told: told?.entity.eid ?? null
128
+ };
129
+ await save([
130
+ ...told ? [
131
+ told
132
+ ] : [],
133
+ {
134
+ entity: {
135
+ eid: model
136
+ },
137
+ model: {
138
+ name: served.name
139
+ }
140
+ },
141
+ {
142
+ entity: {
143
+ eid: tool
144
+ },
145
+ tool: {
146
+ name: 'session_compact',
147
+ step: {
148
+ doing: 'Tidying up the conversation…',
149
+ done: 'Tidied up the conversation'
150
+ }
151
+ }
152
+ },
153
+ {
154
+ entity: {
155
+ eid: call
156
+ },
157
+ call: {
158
+ to: tool,
159
+ source
160
+ },
161
+ execution: {}
162
+ },
163
+ {
164
+ entity: {
165
+ eid: conversation
166
+ },
167
+ session: {
168
+ source: call
169
+ }
170
+ },
171
+ {
172
+ entity: {
173
+ eid: input
174
+ },
175
+ entry: {
176
+ session: conversation
177
+ },
178
+ notice: {},
179
+ content: {
180
+ body: JSON.stringify(req.items)
181
+ }
182
+ },
183
+ {
184
+ entity: {
185
+ eid: ask
186
+ },
187
+ entry: {
188
+ session: conversation
189
+ },
190
+ notice: {},
191
+ using: {
192
+ model,
193
+ ...provider ? {
194
+ provider
195
+ } : {}
196
+ },
197
+ sending,
198
+ ask: {
199
+ to: model,
200
+ through: input
201
+ },
202
+ attempt: {
203
+ by: conversation
204
+ }
205
+ }
206
+ ]);
207
+ // Notice entries remain passive while preserving the original selection.
208
+ let using = {
209
+ model,
210
+ ...provider ? {
211
+ provider
212
+ } : {}
213
+ };
214
+ let compacted;
215
+ try {
216
+ compacted = await served.model(req);
217
+ } catch (e) {
218
+ if (e instanceof ModelError && e.code == 'model_result_delivery') throw e;
219
+ // Provider failure bodies can still report billed tokens. Keep unknown
220
+ // counts absent rather than recording a made-up zero.
221
+ let usage = failureUsage(e);
222
+ // The parent records a compaction defect once. This observed exchange
223
+ // keeps its failure without creating another exception.
224
+ await save([
225
+ {
226
+ entity: {
227
+ eid: ask
228
+ },
229
+ using,
230
+ sending,
231
+ attempt: {
232
+ by: null
233
+ },
234
+ completed: {},
235
+ ...usage ? {
236
+ usage
237
+ } : {},
238
+ ...e instanceof ModelError ? {
239
+ refusal: {
240
+ code: e.code
241
+ },
242
+ ...e.response && g.vocab.comp('response') ? {
243
+ response: e.response
244
+ } : {}
245
+ } : {
246
+ failed: {
247
+ reason: String(e)
248
+ }
249
+ }
250
+ },
251
+ {
252
+ entity: {
253
+ eid: crypto.randomUUID()
254
+ },
255
+ entry: {
256
+ session: conversation
257
+ },
258
+ output: {
259
+ source: ask
260
+ },
261
+ content: {
262
+ body: String(e)
263
+ }
264
+ }
265
+ ]);
266
+ throw e;
267
+ }
268
+ let [original] = await g.get([
269
+ ask
270
+ ]);
271
+ await completeCompact(g, original, {
272
+ reply: compacted,
273
+ mark: served.model.mark?.(compacted)
274
+ });
275
+ if (!compacted.items.some((i)=>i.kind == 'assistant' && i.text.trim())) {
276
+ throw new ModelError('compaction', 'Empty summary');
277
+ }
278
+ return compacted;
279
+ };
280
+ //# sourceMappingURL=compact_ask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compact_ask.js","sources":["./compact_ask.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+EAA+E;AAE/E,SAAS,UAAU,EAAE,WAAW,oCAAyC;AACzE,SAAS,KAAK,kCAAuC;AACrD,SAAS,KAAK,kCAAuC;AACrD,SAAS,YAAY,uBAAsB;AAC3C,SAAS,OAAO,oBAAmB;AAEnC,SACE,KAAK,EAEL,UAAU,2BAGmB;AAE/B,+EAA+E;AAC/E,IAAI,eAAe,CAAC;EAClB,IAAI,CAAC,CAAC,iBAAiB,UAAU,KAAK,CAAC,MAAM,QAAQ,EAAE,MAAM;EAC7D,IAAI;IACF,IAAI,MAAM,KAAK,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI;IACxC,IAAI,QAAQ,IAAI,QAAQ,EAAE,SAAS,IAAI,KAAK;IAC5C,IAAI,CAAC,SAAS,OAAO,SAAS,UAAU;IACxC,IAAI,SAAS;MACX,cAAc,MAAM,YAAY;MAChC,eAAe,MAA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E,wDAAwD;IACxD,MAAM,KAAK;MACT;QACE,QAAQ;UAAE,KAAK;QAAI;QACnB;QACA;QACA,SAAS;UAAE,IAAI;QAAK;QACpB,WAAW,CAAC;QACZ,GAAG,QAAQ;UAAE;QAAM,IAAI,CAAC,CAAC;QACzB,GAAG,aAAa,aACZ;UACA,SAAS;YAAE,MAAM,EAAE,IAAI;UAAC;UACxB,GAAG,EAAE,QAAQ,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,cAC1B;YAAE,UAAU,EAAE,QAAQ;UAAC,IACvB,CAAC,CAAC;QACR,IACE;UAAE,QAAQ;YAAE,QAAQ,OAAO;UAAG;QAAE,CAAC;MACvC;MACA;QACE,QAAQ;UAAE,KAAK,OAAO,UAAU;QAAG;QACnC,OAAO;UAAE,SAAS;QAAa;QAC/B,QAAQ;UAAE,QAAQ;QAAI;QACtB,SAAS;UAAE,MAAM,OAAO;QAAG;MAC7B;KACD;IACD,MAAM;EACR;EACA,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,GAAG,CAAC;IAAC;GAAI;EAClC,MAAM,gBAAgB,GAAG,UAAU;IACjC,OAAO;IACP,MAAM,OAAO,KAAK,CAAC,IAAI,GAAG;EAC5B;EACA,IAAI,CAAC,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC,IAAM,EAAE,IAAI,IAAI,eAAe,EAAE,IAAI,CAAC,IAAI,KAAK;IACxE,MAAM,IAAI,WAAW,cAAc;EACrC;EACA,OAAO;AACT,EAAC"}
package/compact_ask.ts ADDED
@@ -0,0 +1,199 @@
1
+ // Record a model exchange through the existing request/session components.
2
+ // Passive inputs keep this observed exchange out of the session runner's work.
3
+ import type { Bundle, Comp, Eid, Graph } from 'jsr:@yaks/graph@0.2.36'
4
+ import { derivedEid, identityEid } from '@yaks/graph/identity'
5
+ import { Stale } from '@yaks/graph/errors'
6
+ import { token } from '@yaks/graph/sha256'
7
+ import { attemptState } from './attempt.js'
8
+ import { toldRow } from './told.js'
9
+ import type { ModelResult } from '@yaks/model'
10
+ import {
11
+ MODEL,
12
+ type Model,
13
+ ModelError,
14
+ type Reply,
15
+ type Request,
16
+ } from '@yaks/model'
17
+
18
+ // Failed provider responses may contain usage even when no Reply was returned.
19
+ let failureUsage = (error: unknown): Comp | undefined => {
20
+ if (!(error instanceof ModelError) || !error.response?.body) return
21
+ try {
22
+ let raw = JSON.parse(error.response.body)
23
+ let usage = raw.response?.usage ?? raw.usage
24
+ if (!usage || typeof usage != 'object') return
25
+ let values = {
26
+ input_tokens: usage.input_tokens,
27
+ output_tokens: usage.output_tokens,
28
+ total_tokens: usage.total_tokens,
29
+ cached_tokens: usage.input_tokens_details?.cached_tokens,
30
+ reasoning_tokens: usage.output_tokens_details?.reasoning_tokens,
31
+ }
32
+ let valid = Object.entries(values).filter(([, v]) =>
33
+ typeof v == 'number' && Number.isFinite(v) && v >= 0
34
+ )
35
+ return valid.length ? Object.fromEntries(valid) : undefined
36
+ } catch {
37
+ return
38
+ }
39
+ }
40
+
41
+ /** Deliver a saved passive exchange even though its transcript owes no model turn. */
42
+ export let completeCompact = async (
43
+ g: Graph,
44
+ ask: Bundle,
45
+ { reply, mark }: ModelResult,
46
+ ): Promise<void> => {
47
+ if (attemptState(ask) != 'inflight') return
48
+ let session = (ask.entry as Comp).session as Eid
49
+ let texts = reply.items.filter((i) => i.kind == 'assistant').map((i) =>
50
+ i.text
51
+ )
52
+ let empty = !texts.join('\n').trim()
53
+ ? new ModelError('compaction', 'Empty summary')
54
+ : undefined
55
+ let actor = { by: String((ask.ask as Comp).to), via: session }
56
+ try {
57
+ await g.apply([
58
+ {
59
+ entity: ask.entity,
60
+ $actor: actor,
61
+ $was: { attempt: { by: token((ask.attempt as Comp).by) } },
62
+ attempt: { by: null },
63
+ completed: {},
64
+ ...empty
65
+ ? { failed: { reason: empty.message }, refusal: { code: empty.code } }
66
+ : {},
67
+ ...mark,
68
+ ...reply.usage ? { usage: reply.usage } : {},
69
+ ...reply.cost == null ? {} : {
70
+ cost: { dollars: reply.cost, reported: reply.costReported ?? true },
71
+ },
72
+ },
73
+ ...(empty ? [empty.message] : texts).map((body, index) => ({
74
+ entity: {
75
+ eid: derivedEid('compaction-result|' + ask.entity.eid + '|' + index),
76
+ },
77
+ $actor: actor,
78
+ entry: { session },
79
+ output: { source: ask.entity.eid },
80
+ content: { body },
81
+ })),
82
+ ], { trusted: true })
83
+ } catch (error) {
84
+ if (
85
+ !(error instanceof Stale) || error.eid != ask.entity.eid ||
86
+ error.comp != 'attempt'
87
+ ) throw error
88
+ }
89
+ }
90
+
91
+ /** One observed compaction exchange, with stable affinity across cuts. */
92
+ export let compactAsk = async (
93
+ g: Graph,
94
+ parent: Eid,
95
+ source: Eid,
96
+ offered: { model: Model; name: string; provider?: Eid },
97
+ req: Request,
98
+ ): Promise<Reply> => {
99
+ let served = offered
100
+ let conversation = identityEid('compaction', [parent])
101
+ let tool = identityEid('tool', ['session_compact'])
102
+ let call = crypto.randomUUID()
103
+ let input = crypto.randomUUID()
104
+ let ask = crypto.randomUUID()
105
+ let model = identityEid(MODEL, [served.name])
106
+ let provider = served.provider
107
+ let actor = { by: model, via: conversation }
108
+ let save = (rows: Bundle[]) =>
109
+ g.apply(rows.map((b) => ({ ...b, $actor: actor })), { trusted: true })
110
+ req = { ...req, conversation, call: ask }
111
+ let told = req.instructions ? toldRow(req.instructions) : undefined
112
+ let sending = { told: told?.entity.eid ?? null }
113
+ await save([
114
+ ...told ? [told] : [],
115
+ { entity: { eid: model }, model: { name: served.name } },
116
+
117
+ {
118
+ entity: { eid: tool },
119
+ tool: {
120
+ name: 'session_compact',
121
+ step: {
122
+ doing: 'Tidying up the conversation…',
123
+ done: 'Tidied up the conversation',
124
+ },
125
+ },
126
+ },
127
+ {
128
+ entity: { eid: call },
129
+ call: { to: tool, source },
130
+ execution: {},
131
+ },
132
+ { entity: { eid: conversation }, session: { source: call } },
133
+ {
134
+ entity: { eid: input },
135
+ entry: { session: conversation },
136
+ notice: {},
137
+ content: { body: JSON.stringify(req.items) },
138
+ },
139
+ {
140
+ entity: { eid: ask },
141
+ entry: { session: conversation },
142
+ notice: {},
143
+ using: { model, ...provider ? { provider } : {} },
144
+ sending,
145
+ ask: { to: model, through: input },
146
+ attempt: { by: conversation },
147
+ },
148
+ ])
149
+ // Notice entries remain passive while preserving the original selection.
150
+ let using = {
151
+ model,
152
+ ...provider ? { provider } : {},
153
+ }
154
+ let compacted: Reply
155
+ try {
156
+ compacted = await served.model(req)
157
+ } catch (e) {
158
+ if (e instanceof ModelError && e.code == 'model_result_delivery') throw e
159
+ // Provider failure bodies can still report billed tokens. Keep unknown
160
+ // counts absent rather than recording a made-up zero.
161
+ let usage = failureUsage(e)
162
+ // The parent records a compaction defect once. This observed exchange
163
+ // keeps its failure without creating another exception.
164
+ await save([
165
+ {
166
+ entity: { eid: ask },
167
+ using,
168
+ sending,
169
+ attempt: { by: null },
170
+ completed: {},
171
+ ...usage ? { usage } : {},
172
+ ...e instanceof ModelError
173
+ ? {
174
+ refusal: { code: e.code },
175
+ ...e.response && g.vocab.comp('response')
176
+ ? { response: e.response }
177
+ : {},
178
+ }
179
+ : { failed: { reason: String(e) } },
180
+ },
181
+ {
182
+ entity: { eid: crypto.randomUUID() },
183
+ entry: { session: conversation },
184
+ output: { source: ask },
185
+ content: { body: String(e) },
186
+ },
187
+ ])
188
+ throw e
189
+ }
190
+ let [original] = await g.get([ask])
191
+ await completeCompact(g, original, {
192
+ reply: compacted,
193
+ mark: served.model.mark?.(compacted),
194
+ })
195
+ if (!compacted.items.some((i) => i.kind == 'assistant' && i.text.trim())) {
196
+ throw new ModelError('compaction', 'Empty summary')
197
+ }
198
+ return compacted
199
+ }
package/continue.js ADDED
@@ -0,0 +1,131 @@
1
+ // `/yak:continue`, the Claude Code plugin's command (plugins/yak), answered at
2
+ // the prompt hook (./routes.ts) before Claude Code asks its model anything:
3
+ // the hand-off is wanted most when that model's plan is spent. The hook
4
+ // blocks the prompt, and Claude Code shows the person the reason it gives,
5
+ // which is the answer.
6
+ //
7
+ // - `/yak:continue [provider/]model [words]` hands this conversation to that
8
+ // model in place (@yaks/harness `session_send`), which takes it over here
9
+ // and goes on from the words, or from "Continue.".
10
+ // - `/yak:continue S-12` writes another session into this Claude Code
11
+ // account (`session_open`, ./resume.ts), for `/resume` to continue here.
12
+ // - `/yak:continue` alone says how, and how much room each plan has left.
13
+ import { answerOf, faultOf, toolEid } from "@yaks/tools/result";
14
+ import { accountOf, statusLine } from "./statusline.js";
15
+ /** The command, as the person types it. */ export let COMMAND = '/yak:continue';
16
+ /**
17
+ * What a prompt asks of `/yak:continue`, or nothing for any other prompt.
18
+ *
19
+ * ```ts
20
+ * import { continued } from './continue.ts'
21
+ * import { equal } from '@yaks/testing'
22
+ *
23
+ * equal(continued('/yak:continue codex/gpt-5.5 fix the test'),
24
+ * { provider: 'codex', model: 'gpt-5.5', text: 'fix the test' })
25
+ * equal(continued('/yak:continue gpt-5.5'), { model: 'gpt-5.5', text: 'Continue.' })
26
+ * equal(continued('/yak:continue S-12'), { open: 'S-12' })
27
+ * equal(continued('/yak:continue'), { how: true })
28
+ * equal(continued('/yak:continued'), undefined)
29
+ * ```
30
+ */ export let continued = (prompt)=>{
31
+ let said = prompt.trim();
32
+ if (said != COMMAND && !said.startsWith(COMMAND + ' ')) return undefined;
33
+ let [first, ...rest] = said.slice(COMMAND.length).trim().split(/\s+/);
34
+ if (!first) return {
35
+ how: true
36
+ };
37
+ if (/^[A-Z]+-\d+$|^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(first)) {
38
+ return {
39
+ open: first
40
+ };
41
+ }
42
+ let slash = first.indexOf('/');
43
+ return {
44
+ ...slash > 0 ? {
45
+ provider: first.slice(0, slash)
46
+ } : {},
47
+ model: slash > 0 ? first.slice(slash + 1) : first,
48
+ text: rest.join(' ') || 'Continue.'
49
+ };
50
+ };
51
+ let HOW = `${COMMAND} [provider/]model [words] hands this conversation to ` + `that model in yak; ${COMMAND} S-<n> brings a session here.`;
52
+ // Run a tool as the hook's caller would, and say what it answered.
53
+ let run = async (host, request, tool, args)=>{
54
+ if (!host.runner || !host.text) {
55
+ throw new Error(`${COMMAND} needs a tool runner and a text renderer`);
56
+ }
57
+ await host.runner.ensure([
58
+ tool
59
+ ]);
60
+ let id = crypto.randomUUID();
61
+ let actor = await host.who?.(request);
62
+ let landed = await host.runner.call({
63
+ entity: {
64
+ eid: id
65
+ },
66
+ call: {
67
+ to: toolEid(tool),
68
+ args
69
+ },
70
+ ...actor ? {
71
+ $actor: actor
72
+ } : {}
73
+ });
74
+ let fault = faultOf(landed, id);
75
+ if (fault) {
76
+ let body = fault.content ?? fault.doc;
77
+ return {
78
+ said: String(body?.body ?? `${tool} failed`),
79
+ failed: true
80
+ };
81
+ }
82
+ return {
83
+ said: await host.text(answerOf(landed, id), {
84
+ readOnly: false
85
+ }),
86
+ failed: false
87
+ };
88
+ };
89
+ let human = (b)=>b?.entity.prefix && b.entity.num ? `${b.entity.prefix}-${b.entity.num}` : b?.entity.eid;
90
+ /** The answer to `/yak:continue` from the Claude Code session that sent
91
+ * `event`: what was done, or why not. */ export let carryOn = async (host, request, event, asked)=>{
92
+ let session = String(event.session_id ?? '');
93
+ if ('how' in asked) {
94
+ let room = await statusLine(host.graph, {
95
+ transcript_path: String(event.transcript_path ?? '')
96
+ });
97
+ return [
98
+ HOW,
99
+ room
100
+ ].filter(Boolean).join('\n');
101
+ }
102
+ if ('open' in asked) {
103
+ let { said } = await run(host, request, 'session_open', {
104
+ session: asked.open,
105
+ in: 'claude',
106
+ ...accountOf(String(event.transcript_path ?? '')) ? {
107
+ account: accountOf(String(event.transcript_path))
108
+ } : {},
109
+ ...typeof event.cwd == 'string' ? {
110
+ cwd: event.cwd
111
+ } : {}
112
+ });
113
+ return said;
114
+ }
115
+ let { said, failed } = await run(host, request, 'session_send', {
116
+ session,
117
+ text: asked.text,
118
+ model: asked.model,
119
+ ...asked.provider ? {
120
+ provider: asked.provider
121
+ } : {},
122
+ wait: false
123
+ });
124
+ if (failed) return said;
125
+ let [row] = await host.graph.get([
126
+ session
127
+ ]);
128
+ let id = human(row);
129
+ return `${id} goes on with ${asked.model} in yak. Follow it in ` + `\`yak session tui\`; to bring it back here, \`${COMMAND} ${id}\`.`;
130
+ };
131
+ //# sourceMappingURL=continue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continue.js","sources":["./continue.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2EAA2E;AAC3E,uBAAuB;AACvB,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,qDAAqD;AACrD,sEAAsE;AACtE,2EAA2E;AAC3E,0EAA0E;AAM1E,SAAS,QAAQ,EAAE,OAAO,EAAE,OAAO,kCAAuC;AAC1E,SAAS,SAAS,EAAE,UAAU,0BAAyB;AAEvD,yCAAyC,GACzC,OAAO,IAAI,UAAU,gBAAe;AAQpC;;;;;;;;;;;;;;CAcC,GACD,OAAO,IAAI,YAAY,CAAC;EACtB,IAAI,OAAO,OAAO,IAAI;EACtB,IAAI,QAAQ,WAAW,CAAC,KAAK,UAAU,CAAC,UAAU,MAAM,OAAO;EAC/D,IAAI,CAAC,OAAO,GAAG,KAAK,GAAG,KAAK,KAAK,CAAC,QAAQ,MAAM,EAAE,IAAI,GAAG,KAAK,CAAC;EAC/D,IAAI,CAAC,OAAO,OAAO;IAAE,KAAK;EAAK;EAC/B,IAAI,4CAA4C,IAAI,CAAC,QAAQ;IAC3D,OAAO;MAAE,MAAM;IAAM;EACvB;EACA,IAAI,QAAQ,MAAM,OAAO,CAAC;EAC1B,OAAO;IACL,GAAG,QAAQ,IAAI;MAAE,UAAU,MAAM,KAAK,CAAC,GAAG;IAAO,IAAI,CAAC,CAAC;IACvD,OAAO,QAAQ,IAAI,MAAM,KAAK,CAAC,QAAQ,KAAK;IAC5C,MAAM,KAAK,IAAI,CAAC,QAAQ;EAC1B;AACF,EAAC;AAED,IAAI,MAAM,GAAG,QAAQ,qDAAqD,CA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