@yaks/harness 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 (230) hide show
  1. package/FRONTEND.md +170 -0
  2. package/LICENSE +202 -0
  3. package/MCPAuthPanel.js +166 -0
  4. package/MCPAuthPanel.js.map +1 -0
  5. package/MCPAuthPanel.ts +184 -0
  6. package/ModelPanel.js +124 -0
  7. package/ModelPanel.js.map +1 -0
  8. package/ModelPanel.ts +143 -0
  9. package/PersonaPanel.js +106 -0
  10. package/PersonaPanel.js.map +1 -0
  11. package/PersonaPanel.ts +110 -0
  12. package/README.md +1570 -2
  13. package/RuntimePanel.js +180 -0
  14. package/RuntimePanel.js.map +1 -0
  15. package/RuntimePanel.ts +205 -0
  16. package/STREAMING.md +101 -0
  17. package/WINDOWS.md +78 -0
  18. package/WORKER.md +221 -0
  19. package/_dist/agent.d.ts +197 -0
  20. package/_dist/agent.d.ts.map +1 -0
  21. package/_dist/cli.d.ts +10 -0
  22. package/_dist/cli.d.ts.map +1 -0
  23. package/_dist/conversations.d.ts +45 -0
  24. package/_dist/conversations.d.ts.map +1 -0
  25. package/_dist/default.d.ts +32 -0
  26. package/_dist/default.d.ts.map +1 -0
  27. package/_dist/detail.d.ts +16 -0
  28. package/_dist/detail.d.ts.map +1 -0
  29. package/_dist/diagnostics.d.ts +5 -0
  30. package/_dist/diagnostics.d.ts.map +1 -0
  31. package/_dist/effects.d.ts +35 -0
  32. package/_dist/effects.d.ts.map +1 -0
  33. package/_dist/http.d.ts +12 -0
  34. package/_dist/http.d.ts.map +1 -0
  35. package/_dist/isolated.d.ts +6 -0
  36. package/_dist/isolated.d.ts.map +1 -0
  37. package/_dist/local.d.ts +74 -0
  38. package/_dist/local.d.ts.map +1 -0
  39. package/_dist/machine.d.ts +3 -0
  40. package/_dist/machine.d.ts.map +1 -0
  41. package/_dist/mcp_auth.d.ts +8 -0
  42. package/_dist/mcp_auth.d.ts.map +1 -0
  43. package/_dist/mod.d.ts +43 -0
  44. package/_dist/mod.d.ts.map +1 -0
  45. package/_dist/model_selection.d.ts +8 -0
  46. package/_dist/model_selection.d.ts.map +1 -0
  47. package/_dist/routes.d.ts +11 -0
  48. package/_dist/routes.d.ts.map +1 -0
  49. package/_dist/runs.d.ts +7 -0
  50. package/_dist/runs.d.ts.map +1 -0
  51. package/_dist/runtime.d.ts +2 -0
  52. package/_dist/runtime.d.ts.map +1 -0
  53. package/_dist/session_machines.d.ts +18 -0
  54. package/_dist/session_machines.d.ts.map +1 -0
  55. package/_dist/skills.d.ts +11 -0
  56. package/_dist/skills.d.ts.map +1 -0
  57. package/_dist/store.d.ts +38 -0
  58. package/_dist/store.d.ts.map +1 -0
  59. package/_dist/tools.d.ts +28 -0
  60. package/_dist/tools.d.ts.map +1 -0
  61. package/_dist/view.d.ts +5 -0
  62. package/_dist/view.d.ts.map +1 -0
  63. package/_dist/vocab.d.ts +7 -0
  64. package/_dist/vocab.d.ts.map +1 -0
  65. package/_dist/worn.d.ts +52 -0
  66. package/_dist/worn.d.ts.map +1 -0
  67. package/agent.js +773 -0
  68. package/agent.js.map +1 -0
  69. package/agent.ts +959 -0
  70. package/app.js +811 -0
  71. package/app.js.map +1 -0
  72. package/app.ts +868 -0
  73. package/artifact_tools.js +186 -0
  74. package/artifact_tools.js.map +1 -0
  75. package/artifact_tools.ts +190 -0
  76. package/backend_worker.ts +286 -0
  77. package/cli.js +43 -0
  78. package/cli.js.map +1 -0
  79. package/cli.ts +48 -0
  80. package/conversations.js +526 -0
  81. package/conversations.js.map +1 -0
  82. package/conversations.ts +576 -0
  83. package/conversations_testing.ts +162 -0
  84. package/default.js +162 -0
  85. package/default.js.map +1 -0
  86. package/default.ts +168 -0
  87. package/deferred_model.ts +1 -0
  88. package/deno.json +1 -0
  89. package/detail.js +50 -0
  90. package/detail.js.map +1 -0
  91. package/detail.ts +75 -0
  92. package/diagnostics.js +132 -0
  93. package/diagnostics.js.map +1 -0
  94. package/diagnostics.ts +150 -0
  95. package/draft_vault.js +149 -0
  96. package/draft_vault.js.map +1 -0
  97. package/draft_vault.ts +176 -0
  98. package/effects.js +233 -0
  99. package/effects.js.map +1 -0
  100. package/effects.ts +250 -0
  101. package/frontend/vocab.json +376 -0
  102. package/frontend.js +511 -0
  103. package/frontend.js.map +1 -0
  104. package/frontend.ts +389 -0
  105. package/http.js +107 -0
  106. package/http.js.map +1 -0
  107. package/http.ts +105 -0
  108. package/input_text.js +91 -0
  109. package/input_text.js.map +1 -0
  110. package/input_text.ts +99 -0
  111. package/instructions.js +111 -0
  112. package/instructions.js.map +1 -0
  113. package/instructions.ts +145 -0
  114. package/isolated.js +512 -0
  115. package/isolated.js.map +1 -0
  116. package/isolated.ts +502 -0
  117. package/keyboard.js +544 -0
  118. package/keyboard.js.map +1 -0
  119. package/keyboard.ts +403 -0
  120. package/legacy_instructions.js +3 -0
  121. package/legacy_instructions.js.map +1 -0
  122. package/legacy_instructions.ts +13 -0
  123. package/local.js +181 -0
  124. package/local.js.map +1 -0
  125. package/local.ts +282 -0
  126. package/machine.js +3 -0
  127. package/machine.js.map +1 -0
  128. package/machine.ts +8 -0
  129. package/mcp.js +123 -0
  130. package/mcp.js.map +1 -0
  131. package/mcp.ts +141 -0
  132. package/mcp_auth.js +63 -0
  133. package/mcp_auth.js.map +1 -0
  134. package/mcp_auth.ts +91 -0
  135. package/mcp_authorize.js +17 -0
  136. package/mcp_authorize.js.map +1 -0
  137. package/mcp_authorize.ts +18 -0
  138. package/mcp_registry.js +178 -0
  139. package/mcp_registry.js.map +1 -0
  140. package/mcp_registry.ts +193 -0
  141. package/mod.js +43 -0
  142. package/mod.js.map +1 -0
  143. package/mod.ts +45 -0
  144. package/model_selection.js +72 -0
  145. package/model_selection.js.map +1 -0
  146. package/model_selection.ts +86 -0
  147. package/numbers.js +6 -0
  148. package/numbers.js.map +1 -0
  149. package/numbers.ts +8 -0
  150. package/package.json +106 -4
  151. package/panels.js +119 -0
  152. package/panels.js.map +1 -0
  153. package/panels.ts +259 -0
  154. package/patch.js +329 -0
  155. package/patch.js.map +1 -0
  156. package/patch.ts +325 -0
  157. package/perf.ts +65 -0
  158. package/providers.js +36 -0
  159. package/providers.js.map +1 -0
  160. package/providers.ts +53 -0
  161. package/remote.js +441 -0
  162. package/remote.js.map +1 -0
  163. package/remote.ts +446 -0
  164. package/results.js +49 -0
  165. package/results.js.map +1 -0
  166. package/results.ts +39 -0
  167. package/routes.js +64 -0
  168. package/routes.js.map +1 -0
  169. package/routes.ts +87 -0
  170. package/runs.js +478 -0
  171. package/runs.js.map +1 -0
  172. package/runs.ts +479 -0
  173. package/runtime/vocab.json +36 -0
  174. package/runtime.js +105 -0
  175. package/runtime.js.map +1 -0
  176. package/runtime.ts +112 -0
  177. package/session_machines.js +203 -0
  178. package/session_machines.js.map +1 -0
  179. package/session_machines.ts +216 -0
  180. package/sheet.js +55 -0
  181. package/sheet.js.map +1 -0
  182. package/sheet.ts +31 -0
  183. package/shutdown.js +7 -0
  184. package/shutdown.js.map +1 -0
  185. package/shutdown.ts +7 -0
  186. package/skills.js +116 -0
  187. package/skills.js.map +1 -0
  188. package/skills.ts +114 -0
  189. package/startup_bench.ts +140 -0
  190. package/status.js +82 -0
  191. package/status.js.map +1 -0
  192. package/status.ts +97 -0
  193. package/steps.baseline.json +28 -0
  194. package/steps_bench.ts +155 -0
  195. package/store.js +31 -0
  196. package/store.js.map +1 -0
  197. package/store.ts +82 -0
  198. package/streaming.js +3 -0
  199. package/streaming.js.map +1 -0
  200. package/streaming.ts +8 -0
  201. package/streaming_bench.ts +76 -0
  202. package/switch_bench.ts +97 -0
  203. package/testing.ts +177 -0
  204. package/tools.js +287 -0
  205. package/tools.js.map +1 -0
  206. package/tools.ts +313 -0
  207. package/transcript.js +149 -0
  208. package/transcript.js.map +1 -0
  209. package/transcript.ts +187 -0
  210. package/tree.js +97 -0
  211. package/tree.js.map +1 -0
  212. package/tree.ts +114 -0
  213. package/unfinished.js +186 -0
  214. package/unfinished.js.map +1 -0
  215. package/unfinished.ts +198 -0
  216. package/view.js +92 -0
  217. package/view.js.map +1 -0
  218. package/view.ts +102 -0
  219. package/vocab.js +23 -0
  220. package/vocab.js.map +1 -0
  221. package/vocab.json +494 -0
  222. package/vocab.ts +22 -0
  223. package/window_bench.ts +114 -0
  224. package/worker_bench.ts +72 -0
  225. package/workspace.js +21 -0
  226. package/workspace.js.map +1 -0
  227. package/workspace.ts +17 -0
  228. package/worn.js +194 -0
  229. package/worn.js.map +1 -0
  230. package/worn.ts +246 -0
package/transcript.js ADDED
@@ -0,0 +1,149 @@
1
+ /** Terminal transcript trees selected by query specificity, not a kind switch. */ import { toolEid } from "@yaks/tools/result";
2
+ import { parse } from "@yaks/query";
3
+ import { showing } from "@yaks/tui";
4
+ import { define } from "@yaks/render";
5
+ import { entryBody } from "@yaks/session";
6
+ import { parse as markdown, render as renderMarkdown } from "@yaks/markdown";
7
+ let row = (query, label, color, dim = false, prose = false, boxed = false, content)=>({
8
+ view: 'Transcript',
9
+ match: parse(query),
10
+ render: (b, h, ctx)=>h('div', {
11
+ wrap: '1',
12
+ ...boxed ? {
13
+ border: 'Composer_Border'
14
+ } : {}
15
+ }, h('span', {
16
+ class: 'Dim'
17
+ }, String(b.entry?.seq ?? '').padStart(3)), ' ', h('span', {
18
+ class: color
19
+ }, label.padEnd(9)), ' ', content ? content(b, h, ctx) : prose ? h('div', {
20
+ class: dim ? 'Dim' : undefined
21
+ }, renderMarkdown(markdown(String(b.content?.body ?? '')), h)) : h('span', {
22
+ class: dim ? 'Dim' : undefined
23
+ }, entryBody(b, h, {
24
+ ...ctx,
25
+ full: true
26
+ })))
27
+ });
28
+ // Previews affect presentation only. Inspection and model context use the
29
+ // original content. Bound characters as well as lines for minified tool output.
30
+ const resultPreview = (b, h)=>{
31
+ const text = String(b.content?.body ?? '');
32
+ const lines = text.split('\n', 6);
33
+ const head = lines.slice(0, 5).join('\n');
34
+ const preview = Array.from(head.slice(0, 4000)).slice(0, 2000).join('');
35
+ const clipped = preview.length < text.length;
36
+ return h('div', {
37
+ class: 'Dim'
38
+ }, h('div', {
39
+ wrap: '1',
40
+ 'max-height': '5',
41
+ ...!clipped ? {
42
+ 'overflow-text': '… output preview; full text retained in transcript storage'
43
+ } : {}
44
+ }, ...preview.split('\n').flatMap((line, i)=>i ? [
45
+ h('br', null),
46
+ line
47
+ ] : [
48
+ line
49
+ ])), clipped ? h('div', null, '… output preview; full text retained in transcript storage') : null);
50
+ };
51
+ const shellCommand = (b, h, ctx)=>{
52
+ const command = b.call?.args?.command;
53
+ // A call with no command to show, or arguments the model spelled as no
54
+ // object, gets the ordinary view.
55
+ if (typeof command != 'string') {
56
+ return entryBody(b, h, {
57
+ ...ctx,
58
+ full: true
59
+ });
60
+ }
61
+ return h('div', {
62
+ wrap: '1'
63
+ }, h('span', {
64
+ class: 'Muted'
65
+ }, '$ '), ...command.split('\n').flatMap((line, i)=>i ? [
66
+ h('br', null),
67
+ line
68
+ ] : [
69
+ line
70
+ ]));
71
+ };
72
+ // A view matching more predicates beats the generic entry/content rows. Views
73
+ // with equal scores fall back to registration order: failures outrank tool
74
+ // results, which outrank prose. Older content-only receipts carry no author
75
+ // component; their durable delivery IDs keep them out of the user-message
76
+ // fallback. Other machine-written components win ties.
77
+ export let transcriptViews = define([
78
+ {
79
+ view: 'Transcript',
80
+ match: parse('.entry&.attachment&.content'),
81
+ render: (b, h, ctx)=>{
82
+ let eid = String(b.attachment.artifact ?? '');
83
+ let alt = String(b.content.body ?? 'Image artifact');
84
+ let load = ctx.image;
85
+ if (!load || !ctx.inlineImages) return h('div', {
86
+ wrap: '1'
87
+ }, alt);
88
+ return h('terminal-image', {
89
+ ref: showing({
90
+ key: eid,
91
+ alt,
92
+ rows: 8,
93
+ load: ()=>load(eid)
94
+ })
95
+ });
96
+ }
97
+ },
98
+ {
99
+ view: 'Transcript',
100
+ match: parse('.entry&.prompt'),
101
+ render: (b, h)=>{
102
+ let prompt = b.prompt;
103
+ // Display provenance, not instruction text. A fixed row also prevents
104
+ // long source names from changing the virtual list's measured height.
105
+ let source = String(prompt.source ?? '').replaceAll('\\', '/').split('/').filter(Boolean).at(-1) ?? '';
106
+ let summary = [
107
+ prompt.scope,
108
+ source
109
+ ].filter(Boolean).join(' · ').replace(/\s+/g, ' ');
110
+ return h('div', {
111
+ height: '1'
112
+ }, h('span', {
113
+ class: 'Dim'
114
+ }, String(b.entry?.seq ?? '').padStart(3)), ' ', h('span', {
115
+ class: 'Muted'
116
+ }, 'prompt'.padEnd(9)), ' ', h('span', {
117
+ class: 'Muted'
118
+ }, summary));
119
+ }
120
+ },
121
+ row('.entry&.interrupted', 'interrupted', 'Muted'),
122
+ row('.entry&.refusal', 'refusal', 'Bad'),
123
+ row('.entry&.failed', 'failed', 'Bad'),
124
+ row('.entry&.exception', 'exception', 'Bad'),
125
+ row('.entry&.notice&.content', 'notice', 'Muted', true),
126
+ row('.entry&.result', 'result', 'Muted', true, false, false, resultPreview),
127
+ row(`.entry&.call&.call.to=${toolEid('shell')}`, 'call', 'Key', false, false, false, shellCommand),
128
+ row('.entry&.call', 'call', 'Key'),
129
+ // A provider run's last turn is both, and reads as the stop it is.
130
+ row('.entry&.stop', 'stop', 'Warn'),
131
+ row('.entry&.ask&.attempt.by&!interrupted', 'asking', 'Key'),
132
+ row('.entry&.ask&.interrupted', 'interrupted', 'Muted'),
133
+ row('.entry&.ask', 'ask', 'Muted'),
134
+ row('.entry&.output', 'output', 'Accent', false, true),
135
+ {
136
+ ...row('.entry&.content', 'input', 'Good', false, true, true),
137
+ render: (b, h, ctx)=>{
138
+ // Child receipts are ordinary context entries, not control notices.
139
+ // Their envelope survives identity migration without treating human
140
+ // authorship as machine output or changing session readiness.
141
+ const body = String(b.content?.body ?? '');
142
+ const receipt = /^(?:child [0-9a-f-]{36} (?:settled|failed|stopped)|task (?:T-\d+|[0-9a-f-]{36}) (?:done|cancelled))\n/i.test(body);
143
+ const selected = receipt ? row('.entry&.content', 'notice', 'Muted', true) : row('.entry&.content', 'input', 'Good', false, true, true);
144
+ return selected.render(b, h, ctx);
145
+ }
146
+ },
147
+ row('.entry', 'entry', 'Muted')
148
+ ]);
149
+ //# sourceMappingURL=transcript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcript.js","sources":["./transcript.ts"],"names":[],"mappings":"AAAA,gFAAgF,GAEhF,SAAS,OAAO,kCAAuC;AACvD,SAAS,KAAK,2BAAgC;AAC9C,SAAS,OAAO,yBAA8B;AAC9C,SAAS,MAAM,4BAAgE;AAC/E,SAAS,SAAS,6BAAkC;AACpD,SAAS,SAAS,QAAQ,EAAE,UAAU,cAAc,8BAAmC;AAEvF,IAAI,MAAM,CACR,OACA,OACA,OACA,MAAM,KAAK,EACX,QAAQ,KAAK,EACb,QAAQ,KAAK,EACb,UACqC,CAAC;IACtC,MAAM;IACN,OAAO,MAAM;IACb,QAAQ,CAAC,GAAG,GAAG,MACb,EACE,OACA;QAAE,MAAM;QAAK,GAAI,QAAQ;UAAE,QAAQ;QAAkB,IAAI,CAAC,CAAC;MAAE,GAC7D,EACE,QACA;QAAE,OAAO;MAAM,GACf,OAAO,AAAC,EAAE,KAAK,EAAW,OAAO,IAAI,QAAQ,CAAC,KAEhD,KACA,EAAE,QAAQ;QAAE,OAAO;MAAM,GAAG,MAAM,MAAM,CAAC,KACzC,KACA,UAAU,QAAQ,GAAG,GAAG,OAAO,QAC3B,EACA,OACA;QAAE,OAAO,MAAM,QAAQ;MAAU,GACjC,eAAe,SAAS,OAAO,AAAC,EAAE,OAAO,EAAW,QAAQ,MAAM,MAElE,EACA,QACA;QAAE,OAAO,MAAM,QAAQ;MAAU,GACjC,UAAU,GAAG,GAAG;QAAE,GAAG,GAAG;QAAE,MAAM;MAAK;EAG/C,CAAC;AAED,0EAA0E;AAC1E,gFAAgF;AAChF,MAAM,gBAA2B,CAAC,GAAG;EACnC,MAAM,OAAO,OAAO,AAAC,EAAE,OAAO,EAAuB,QAAQ;EAC7D,MAAM,QAAQ,KAA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,UAAU;EACtD,IAAI,4BAA4B,eAAe;EAC/C,IAAI,eAAe,OAAO;EAC1B,IAAI,kBAAkB,UAAU,UAAU,OAAO;EACjD;IACE,GAAG,IAAI,mBAAmB,SAAS,QAAQ,OAAO,MAAM,KAAK;IAC7D,QAAQ,CAAC,GAAG,GAAG;MACb,oEAAoE;MACpE,oEAAoE;MACpE,8DAA8D;MAC9D,MAAM,OAAO,OAAO,AAAC,EAAE,OAAO,EAAuB,QAAQ;MAC7D,MAAM,UACJ,yGACG,IAAI,CAAC;MACV,MAAM,WAAW,UACb,IAAI,mBAAmB,UAAU,SAAS,QAC1C,IAAI,mBAAmB,SAAS,QAAQ,OAAO,MAAM;MACzD,OAAO,SAAS,MAAM,CAAC,GAAG,GAAG;IAC/B;EACF;EACA,IAAI,UAAU,SAAS;CACxB,EAAC"}
package/transcript.ts ADDED
@@ -0,0 +1,187 @@
1
+ /** Terminal transcript trees selected by query specificity, not a kind switch. */
2
+ import type { Comp } from 'jsr:@yaks/graph@0.2.36'
3
+ import { toolEid } from '@yaks/tools/result'
4
+ import { parse } from '@yaks/query'
5
+ import { showing } from '@yaks/tui'
6
+ import { define, type Renderer, type Rendering } from '@yaks/render'
7
+ import { entryBody } from '@yaks/session'
8
+ import { parse as markdown, render as renderMarkdown } from '@yaks/markdown'
9
+
10
+ let row = (
11
+ query: string,
12
+ label: string,
13
+ color: string,
14
+ dim = false,
15
+ prose = false,
16
+ boxed = false,
17
+ content?: Rendering,
18
+ ): Renderer & { render: Rendering } => ({
19
+ view: 'Transcript',
20
+ match: parse(query),
21
+ render: (b, h, ctx) =>
22
+ h(
23
+ 'div',
24
+ { wrap: '1', ...(boxed ? { border: 'Composer_Border' } : {}) },
25
+ h(
26
+ 'span',
27
+ { class: 'Dim' },
28
+ String((b.entry as Comp)?.seq ?? '').padStart(3),
29
+ ),
30
+ ' ',
31
+ h('span', { class: color }, label.padEnd(9)),
32
+ ' ',
33
+ content ? content(b, h, ctx) : prose
34
+ ? h(
35
+ 'div',
36
+ { class: dim ? 'Dim' : undefined },
37
+ renderMarkdown(markdown(String((b.content as Comp)?.body ?? '')), h),
38
+ )
39
+ : h(
40
+ 'span',
41
+ { class: dim ? 'Dim' : undefined },
42
+ entryBody(b, h, { ...ctx, full: true }),
43
+ ),
44
+ ),
45
+ })
46
+
47
+ // Previews affect presentation only. Inspection and model context use the
48
+ // original content. Bound characters as well as lines for minified tool output.
49
+ const resultPreview: Rendering = (b, h) => {
50
+ const text = String((b.content as Comp | undefined)?.body ?? '')
51
+ const lines = text.split('\n', 6)
52
+ const head = lines.slice(0, 5).join('\n')
53
+ const preview = Array.from(head.slice(0, 4000)).slice(0, 2000).join('')
54
+ const clipped = preview.length < text.length
55
+ return h(
56
+ 'div',
57
+ { class: 'Dim' },
58
+ h(
59
+ 'div',
60
+ {
61
+ wrap: '1',
62
+ 'max-height': '5',
63
+ ...(!clipped
64
+ ? {
65
+ 'overflow-text':
66
+ '… output preview; full text retained in transcript storage',
67
+ }
68
+ : {}),
69
+ },
70
+ ...preview.split('\n').flatMap((line, i) =>
71
+ i ? [h('br', null), line] : [line]
72
+ ),
73
+ ),
74
+ clipped
75
+ ? h(
76
+ 'div',
77
+ null,
78
+ '… output preview; full text retained in transcript storage',
79
+ )
80
+ : null,
81
+ )
82
+ }
83
+
84
+ const shellCommand: Rendering = (b, h, ctx) => {
85
+ const command = ((b.call as Comp)?.args as Comp | undefined)?.command
86
+ // A call with no command to show, or arguments the model spelled as no
87
+ // object, gets the ordinary view.
88
+ if (typeof command != 'string') {
89
+ return entryBody(b, h, { ...ctx, full: true })
90
+ }
91
+ return h(
92
+ 'div',
93
+ { wrap: '1' },
94
+ h('span', { class: 'Muted' }, '$ '),
95
+ ...command.split('\n').flatMap((line, i) =>
96
+ i ? [h('br', null), line] : [line]
97
+ ),
98
+ )
99
+ }
100
+
101
+ // A view matching more predicates beats the generic entry/content rows. Views
102
+ // with equal scores fall back to registration order: failures outrank tool
103
+ // results, which outrank prose. Older content-only receipts carry no author
104
+ // component; their durable delivery IDs keep them out of the user-message
105
+ // fallback. Other machine-written components win ties.
106
+ export let transcriptViews = define([
107
+ {
108
+ view: 'Transcript',
109
+ match: parse('.entry&.attachment&.content'),
110
+ render: (b, h, ctx) => {
111
+ let eid = String((b.attachment as Comp).artifact ?? '')
112
+ let alt = String((b.content as Comp).body ?? 'Image artifact')
113
+ let load = ctx.image as
114
+ | ((eid: string) => Promise<Uint8Array>)
115
+ | undefined
116
+ if (!load || !ctx.inlineImages) return h('div', { wrap: '1' }, alt)
117
+ return h('terminal-image', {
118
+ ref: showing({ key: eid, alt, rows: 8, load: () => load(eid) }),
119
+ })
120
+ },
121
+ },
122
+ {
123
+ view: 'Transcript',
124
+ match: parse('.entry&.prompt'),
125
+ render: (b, h) => {
126
+ let prompt = b.prompt as Comp
127
+ // Display provenance, not instruction text. A fixed row also prevents
128
+ // long source names from changing the virtual list's measured height.
129
+ let source = String(prompt.source ?? '').replaceAll('\\', '/')
130
+ .split('/').filter(Boolean).at(-1) ?? ''
131
+ let summary = [prompt.scope, source].filter(Boolean).join(' · ')
132
+ .replace(/\s+/g, ' ')
133
+ return h(
134
+ 'div',
135
+ { height: '1' },
136
+ h(
137
+ 'span',
138
+ { class: 'Dim' },
139
+ String((b.entry as Comp)?.seq ?? '').padStart(3),
140
+ ),
141
+ ' ',
142
+ h('span', { class: 'Muted' }, 'prompt'.padEnd(9)),
143
+ ' ',
144
+ h('span', { class: 'Muted' }, summary),
145
+ )
146
+ },
147
+ },
148
+ row('.entry&.interrupted', 'interrupted', 'Muted'),
149
+ row('.entry&.refusal', 'refusal', 'Bad'),
150
+ row('.entry&.failed', 'failed', 'Bad'),
151
+ row('.entry&.exception', 'exception', 'Bad'),
152
+ row('.entry&.notice&.content', 'notice', 'Muted', true),
153
+ row('.entry&.result', 'result', 'Muted', true, false, false, resultPreview),
154
+ row(
155
+ `.entry&.call&.call.to=${toolEid('shell')}`,
156
+ 'call',
157
+ 'Key',
158
+ false,
159
+ false,
160
+ false,
161
+ shellCommand,
162
+ ),
163
+ row('.entry&.call', 'call', 'Key'),
164
+ // A provider run's last turn is both, and reads as the stop it is.
165
+ row('.entry&.stop', 'stop', 'Warn'),
166
+ row('.entry&.ask&.attempt.by&!interrupted', 'asking', 'Key'),
167
+ row('.entry&.ask&.interrupted', 'interrupted', 'Muted'),
168
+ row('.entry&.ask', 'ask', 'Muted'),
169
+ row('.entry&.output', 'output', 'Accent', false, true),
170
+ {
171
+ ...row('.entry&.content', 'input', 'Good', false, true, true),
172
+ render: (b, h, ctx) => {
173
+ // Child receipts are ordinary context entries, not control notices.
174
+ // Their envelope survives identity migration without treating human
175
+ // authorship as machine output or changing session readiness.
176
+ const body = String((b.content as Comp | undefined)?.body ?? '')
177
+ const receipt =
178
+ /^(?:child [0-9a-f-]{36} (?:settled|failed|stopped)|task (?:T-\d+|[0-9a-f-]{36}) (?:done|cancelled))\n/i
179
+ .test(body)
180
+ const selected = receipt
181
+ ? row('.entry&.content', 'notice', 'Muted', true)
182
+ : row('.entry&.content', 'input', 'Good', false, true, true)
183
+ return selected.render(b, h, ctx)
184
+ },
185
+ },
186
+ row('.entry', 'entry', 'Muted'),
187
+ ])
package/tree.js ADDED
@@ -0,0 +1,97 @@
1
+ /** Identity-based tree projection. No UI or graph store dependencies. */ export let parentId = (b)=>b.spawned?.parent;
2
+ export let rootOf = (rows, id)=>{
3
+ let byId = new Map(rows.map((b)=>[
4
+ b.entity.eid,
5
+ b
6
+ ]));
7
+ let seen = new Set();
8
+ while(id && !seen.has(id)){
9
+ seen.add(id);
10
+ let parent = byId.get(id) && parentId(byId.get(id));
11
+ if (!parent || !byId.has(parent) || seen.has(parent)) return id;
12
+ id = parent;
13
+ }
14
+ return id;
15
+ };
16
+ /** Settled children hide by default, independently of task completion. */ export const hideCompletedChild = (b)=>b.session?.status == 'settled';
17
+ export let sessionTree = (rows, opts = {})=>{
18
+ let byId = new Map(rows.map((b)=>[
19
+ b.entity.eid,
20
+ b
21
+ ]));
22
+ let children = new Map();
23
+ let roots = [];
24
+ for (let b of rows){
25
+ let p = parentId(b);
26
+ if (p && p != b.entity.eid && byId.has(p)) {
27
+ let group = children.get(p) ?? [];
28
+ group.push(b);
29
+ children.set(p, group);
30
+ } else roots.push(b);
31
+ }
32
+ let path = new Set();
33
+ let id = opts.selected;
34
+ while(id && !path.has(id)){
35
+ path.add(id);
36
+ id = byId.get(id) && parentId(byId.get(id));
37
+ }
38
+ const neededAncestors = new Set();
39
+ // Keep settled ancestors reachable when they contain active descendants.
40
+ for (const b of rows){
41
+ if (hideCompletedChild(b) || b.archived) continue;
42
+ let parent = parentId(b);
43
+ const seen = new Set();
44
+ while(parent && !seen.has(parent)){
45
+ seen.add(parent);
46
+ neededAncestors.add(parent);
47
+ parent = byId.get(parent) && parentId(byId.get(parent));
48
+ }
49
+ }
50
+ let out = [], visited = new Set();
51
+ let visit = (b, depth)=>{
52
+ let id = b.entity.eid;
53
+ if (visited.has(id)) return;
54
+ visited.add(id);
55
+ if (b.archived && !opts.showArchived && !path.has(id)) return;
56
+ if (depth > 0 && !opts.showSettled && !path.has(id) && !neededAncestors.has(id) && hideCompletedChild(b)) return;
57
+ out.push({
58
+ bundle: b,
59
+ depth,
60
+ prefix: ''
61
+ });
62
+ for (let child of children.get(id) ?? [])visit(child, depth + 1);
63
+ };
64
+ for (let root of roots)visit(root, 0);
65
+ // Components disconnected from every root are corrupt cycles, not collapsed
66
+ // descendants. Render each once so damaged data remains inspectable.
67
+ let reachable = new Set();
68
+ let mark = (id)=>{
69
+ if (reachable.has(id)) return;
70
+ reachable.add(id);
71
+ for (let b of children.get(id) ?? [])mark(b.entity.eid);
72
+ };
73
+ for (let b of roots)mark(b.entity.eid);
74
+ for (let b of rows){
75
+ if (!reachable.has(b.entity.eid)) {
76
+ mark(b.entity.eid);
77
+ visit(b, 0);
78
+ }
79
+ }
80
+ // Connect only visible rows, so filtered siblings do not leave dangling lines.
81
+ let more = new Array(out.length);
82
+ let next = [];
83
+ for(let i = out.length - 1; i >= 0; i--){
84
+ let depth = out[i].depth;
85
+ while(next.length && out[next.at(-1)].depth > depth)next.pop();
86
+ more[i] = !!next.length && out[next.at(-1)].depth == depth;
87
+ next.push(i);
88
+ }
89
+ let continuation = [];
90
+ for(let i = 0; i < out.length; i++){
91
+ let row = out[i];
92
+ row.prefix = row.depth == 0 ? '' : continuation.slice(1, row.depth).map((v)=>v ? '│ ' : ' ').join('') + (more[i] ? '├─' : '└─');
93
+ continuation[row.depth] = more[i];
94
+ }
95
+ return out;
96
+ };
97
+ //# sourceMappingURL=tree.js.map
package/tree.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.js","sources":["./tree.ts"],"names":[],"mappings":"AAAA,uEAAuE,GAGvE,OAAO,IAAI,WAAW,CAAC,IACpB,EAAE,OAAO,EAAuB,OAA4B;AAE/D,OAAO,IAAI,SAAS,CAAC,MAAgB;EACnC,IAAI,OAAO,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,IAAM;MAAC,EAAE,MAAM,CAAC,GAAG;MAAE;KAAE;EACpD,IAAI,OAAO,IAAI;EACf,MAAO,MAAM,CAAC,KAAK,GAAG,CAAC,IAAK;IAC1B,KAAK,GAAG,CAAC;IACT,IAAI,SAAS,KAAK,GAAG,CAAC,OAAO,SAAS,KAAK,GAAG,CAAC;IAC/C,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,WAAW,KAAK,GAAG,CAAC,SAAS,OAAO;IAC7D,KAAK;EACP;EACA,OAAO;AACT,EAAC;AAMD,wEAAwE,GACxE,OAAO,MAAM,qBAAqB,CAAC,IACjC,AAAC,EAAE,OAAO,EAAuB,UAAU,UAAS;AAOtD,OAAO,IAAI,cAAc,CACvB,MACA,OAAoB,CAAC,CAAC;EAEtB,IAAI,OAAO,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,IAAM;MAAC,EAAE,MAAM,CAAC,GAAG;MAAE;KAAE;EACpD,IAAI,WAAW,IAAI;EACnB,IAAI,QA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A,aAAa,KAAK,CAAC,GAAG,IAAI,KAAK,EAAE,GAAG,CAAC,CAAC,IAAM,IAAI,OAAO,MAAM,IAAI,CAAC,MAClE,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,IAAI;IAC1B,YAAY,CAAC,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,EAAE;EACnC;EACA,OAAO;AACT,EAAC"}
package/tree.ts ADDED
@@ -0,0 +1,114 @@
1
+ /** Identity-based tree projection. No UI or graph store dependencies. */
2
+ import type { Bundle, Comp } from 'jsr:@yaks/graph@0.2.36'
3
+
4
+ export let parentId = (b: Bundle): string | undefined =>
5
+ (b.spawned as Comp | undefined)?.parent as string | undefined
6
+
7
+ export let rootOf = (rows: Bundle[], id?: string): string | undefined => {
8
+ let byId = new Map(rows.map((b) => [b.entity.eid, b]))
9
+ let seen = new Set<string>()
10
+ while (id && !seen.has(id)) {
11
+ seen.add(id)
12
+ let parent = byId.get(id) && parentId(byId.get(id)!)
13
+ if (!parent || !byId.has(parent) || seen.has(parent)) return id
14
+ id = parent
15
+ }
16
+ return id
17
+ }
18
+ export type TreeRow = {
19
+ bundle: Bundle
20
+ depth: number
21
+ prefix: string
22
+ }
23
+ /** Settled children hide by default, independently of task completion. */
24
+ export const hideCompletedChild = (b: Bundle): boolean =>
25
+ (b.session as Comp | undefined)?.status == 'settled'
26
+
27
+ export type TreeOptions = {
28
+ selected?: string
29
+ showSettled?: boolean
30
+ showArchived?: boolean
31
+ }
32
+ export let sessionTree = (
33
+ rows: Bundle[],
34
+ opts: TreeOptions = {},
35
+ ): TreeRow[] => {
36
+ let byId = new Map(rows.map((b) => [b.entity.eid, b]))
37
+ let children = new Map<string, Bundle[]>()
38
+ let roots: Bundle[] = []
39
+ for (let b of rows) {
40
+ let p = parentId(b)
41
+ if (p && p != b.entity.eid && byId.has(p)) {
42
+ let group = children.get(p) ?? []
43
+ group.push(b)
44
+ children.set(p, group)
45
+ } else roots.push(b)
46
+ }
47
+ let path = new Set<string>()
48
+ let id = opts.selected
49
+ while (id && !path.has(id)) {
50
+ path.add(id)
51
+ id = byId.get(id) && parentId(byId.get(id)!)
52
+ }
53
+ const neededAncestors = new Set<string>()
54
+ // Keep settled ancestors reachable when they contain active descendants.
55
+ for (const b of rows) {
56
+ if (hideCompletedChild(b) || b.archived) continue
57
+ let parent = parentId(b)
58
+ const seen = new Set<string>()
59
+ while (parent && !seen.has(parent)) {
60
+ seen.add(parent)
61
+ neededAncestors.add(parent)
62
+ parent = byId.get(parent) && parentId(byId.get(parent)!)
63
+ }
64
+ }
65
+ let out: TreeRow[] = [], visited = new Set<string>()
66
+ let visit = (b: Bundle, depth: number) => {
67
+ let id = b.entity.eid
68
+ if (visited.has(id)) return
69
+ visited.add(id)
70
+ if (b.archived && !opts.showArchived && !path.has(id)) return
71
+ if (
72
+ depth > 0 && !opts.showSettled && !path.has(id) &&
73
+ !neededAncestors.has(id) &&
74
+ hideCompletedChild(b)
75
+ ) return
76
+ out.push({ bundle: b, depth, prefix: '' })
77
+ for (let child of children.get(id) ?? []) visit(child, depth + 1)
78
+ }
79
+ for (let root of roots) visit(root, 0)
80
+ // Components disconnected from every root are corrupt cycles, not collapsed
81
+ // descendants. Render each once so damaged data remains inspectable.
82
+ let reachable = new Set<string>()
83
+ let mark = (id: string) => {
84
+ if (reachable.has(id)) return
85
+ reachable.add(id)
86
+ for (let b of children.get(id) ?? []) mark(b.entity.eid)
87
+ }
88
+ for (let b of roots) mark(b.entity.eid)
89
+ for (let b of rows) {
90
+ if (!reachable.has(b.entity.eid)) {
91
+ mark(b.entity.eid)
92
+ visit(b, 0)
93
+ }
94
+ }
95
+ // Connect only visible rows, so filtered siblings do not leave dangling lines.
96
+ let more = new Array<boolean>(out.length)
97
+ let next: number[] = []
98
+ for (let i = out.length - 1; i >= 0; i--) {
99
+ let depth = out[i].depth
100
+ while (next.length && out[next.at(-1)!].depth > depth) next.pop()
101
+ more[i] = !!next.length && out[next.at(-1)!].depth == depth
102
+ next.push(i)
103
+ }
104
+ let continuation: boolean[] = []
105
+ for (let i = 0; i < out.length; i++) {
106
+ let row = out[i]
107
+ row.prefix = row.depth == 0
108
+ ? ''
109
+ : continuation.slice(1, row.depth).map((v) => v ? '│ ' : ' ').join('') +
110
+ (more[i] ? '├─' : '└─')
111
+ continuation[row.depth] = more[i]
112
+ }
113
+ return out
114
+ }