@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.
- package/LICENSE +202 -0
- package/README.md +1392 -2
- package/_dist/admission.d.ts +15 -0
- package/_dist/admission.d.ts.map +1 -0
- package/_dist/announce.d.ts +17 -0
- package/_dist/announce.d.ts.map +1 -0
- package/_dist/answer.d.ts +200 -0
- package/_dist/answer.d.ts.map +1 -0
- package/_dist/append.d.ts +10 -0
- package/_dist/append.d.ts.map +1 -0
- package/_dist/archive.d.ts +6 -0
- package/_dist/archive.d.ts.map +1 -0
- package/_dist/asks.d.ts +11 -0
- package/_dist/asks.d.ts.map +1 -0
- package/_dist/audit.d.ts +15 -0
- package/_dist/audit.d.ts.map +1 -0
- package/_dist/bounce.d.ts +19 -0
- package/_dist/bounce.d.ts.map +1 -0
- package/_dist/bus.d.ts +8 -0
- package/_dist/bus.d.ts.map +1 -0
- package/_dist/cache.d.ts +45 -0
- package/_dist/cache.d.ts.map +1 -0
- package/_dist/child-notice.d.ts +6 -0
- package/_dist/child-notice.d.ts.map +1 -0
- package/_dist/children.d.ts +59 -0
- package/_dist/children.d.ts.map +1 -0
- package/_dist/cli.d.ts +8 -0
- package/_dist/cli.d.ts.map +1 -0
- package/_dist/comp.d.ts +9 -0
- package/_dist/comp.d.ts.map +1 -0
- package/_dist/compact.d.ts +19 -0
- package/_dist/compact.d.ts.map +1 -0
- package/_dist/conversation.d.ts +158 -0
- package/_dist/conversation.d.ts.map +1 -0
- package/_dist/cost.d.ts +13 -0
- package/_dist/cost.d.ts.map +1 -0
- package/_dist/deferred.d.ts +79 -0
- package/_dist/deferred.d.ts.map +1 -0
- package/_dist/ended.d.ts +27 -0
- package/_dist/ended.d.ts.map +1 -0
- package/_dist/files.d.ts +73 -0
- package/_dist/files.d.ts.map +1 -0
- package/_dist/fork.d.ts +23 -0
- package/_dist/fork.d.ts.map +1 -0
- package/_dist/graft.d.ts +33 -0
- package/_dist/graft.d.ts.map +1 -0
- package/_dist/graph.d.ts +14 -0
- package/_dist/graph.d.ts.map +1 -0
- package/_dist/handoff.d.ts +29 -0
- package/_dist/handoff.d.ts.map +1 -0
- package/_dist/imported.d.ts +63 -0
- package/_dist/imported.d.ts.map +1 -0
- package/_dist/intake.d.ts +43 -0
- package/_dist/intake.d.ts.map +1 -0
- package/_dist/joined.d.ts +35 -0
- package/_dist/joined.d.ts.map +1 -0
- package/_dist/lease.d.ts +21 -0
- package/_dist/lease.d.ts.map +1 -0
- package/_dist/lines.d.ts +13 -0
- package/_dist/lines.d.ts.map +1 -0
- package/_dist/mod.d.ts +107 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/naming.d.ts +10 -0
- package/_dist/naming.d.ts.map +1 -0
- package/_dist/native.d.ts +13 -0
- package/_dist/native.d.ts.map +1 -0
- package/_dist/parts.d.ts +145 -0
- package/_dist/parts.d.ts.map +1 -0
- package/_dist/plugin.d.ts +33 -0
- package/_dist/plugin.d.ts.map +1 -0
- package/_dist/project.d.ts +67 -0
- package/_dist/project.d.ts.map +1 -0
- package/_dist/prose.d.ts +7 -0
- package/_dist/prose.d.ts.map +1 -0
- package/_dist/providers.d.ts +36 -0
- package/_dist/providers.d.ts.map +1 -0
- package/_dist/reach.d.ts +39 -0
- package/_dist/reach.d.ts.map +1 -0
- package/_dist/react.d.ts +236 -0
- package/_dist/react.d.ts.map +1 -0
- package/_dist/readers.d.ts +221 -0
- package/_dist/readers.d.ts.map +1 -0
- package/_dist/reap.d.ts +21 -0
- package/_dist/reap.d.ts.map +1 -0
- package/_dist/recall.d.ts +32 -0
- package/_dist/recall.d.ts.map +1 -0
- package/_dist/routes.d.ts +15 -0
- package/_dist/routes.d.ts.map +1 -0
- package/_dist/run.d.ts +81 -0
- package/_dist/run.d.ts.map +1 -0
- package/_dist/service.d.ts +131 -0
- package/_dist/service.d.ts.map +1 -0
- package/_dist/source.d.ts +9 -0
- package/_dist/source.d.ts.map +1 -0
- package/_dist/start.d.ts +29 -0
- package/_dist/start.d.ts.map +1 -0
- package/_dist/state.d.ts +75 -0
- package/_dist/state.d.ts.map +1 -0
- package/_dist/status.d.ts +38 -0
- package/_dist/status.d.ts.map +1 -0
- package/_dist/tail.d.ts +121 -0
- package/_dist/tail.d.ts.map +1 -0
- package/_dist/timing.d.ts +9 -0
- package/_dist/timing.d.ts.map +1 -0
- package/_dist/told.d.ts +17 -0
- package/_dist/told.d.ts.map +1 -0
- package/_dist/tools.d.ts +41 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/transcript.d.ts +5 -0
- package/_dist/transcript.d.ts.map +1 -0
- package/_dist/turn.d.ts +49 -0
- package/_dist/turn.d.ts.map +1 -0
- package/_dist/unknown.d.ts +6 -0
- package/_dist/unknown.d.ts.map +1 -0
- package/_dist/views.d.ts +9 -0
- package/_dist/views.d.ts.map +1 -0
- package/_dist/vocab.d.ts +9 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/_dist/wait.d.ts +15 -0
- package/_dist/wait.d.ts.map +1 -0
- package/_dist/wake.d.ts +116 -0
- package/_dist/wake.d.ts.map +1 -0
- package/_dist/watch.d.ts +52 -0
- package/_dist/watch.d.ts.map +1 -0
- package/_dist/who.d.ts +84 -0
- package/_dist/who.d.ts.map +1 -0
- package/_dist/window.d.ts +43 -0
- package/_dist/window.d.ts.map +1 -0
- package/admission.js +137 -0
- package/admission.js.map +1 -0
- package/admission.ts +164 -0
- package/announce.js +123 -0
- package/announce.js.map +1 -0
- package/announce.ts +126 -0
- package/answer.js +372 -0
- package/answer.js.map +1 -0
- package/answer.ts +426 -0
- package/append.js +125 -0
- package/append.js.map +1 -0
- package/append.ts +205 -0
- package/archive.js +62 -0
- package/archive.js.map +1 -0
- package/archive.ts +62 -0
- package/asks.js +80 -0
- package/asks.js.map +1 -0
- package/asks.ts +106 -0
- package/attempt.js +46 -0
- package/attempt.js.map +1 -0
- package/attempt.ts +60 -0
- package/audit.js +57 -0
- package/audit.js.map +1 -0
- package/audit.ts +65 -0
- package/bounce.js +29 -0
- package/bounce.js.map +1 -0
- package/bounce.ts +34 -0
- package/bus.js +568 -0
- package/bus.js.map +1 -0
- package/bus.ts +683 -0
- package/cache.js +169 -0
- package/cache.js.map +1 -0
- package/cache.ts +230 -0
- package/child-notice.js +128 -0
- package/child-notice.js.map +1 -0
- package/child-notice.ts +136 -0
- package/children.js +937 -0
- package/children.js.map +1 -0
- package/children.ts +925 -0
- package/claude-control.js +8 -0
- package/claude-control.js.map +1 -0
- package/claude-control.ts +12 -0
- package/cli.js +23 -0
- package/cli.js.map +1 -0
- package/cli.ts +28 -0
- package/comp.js +76 -0
- package/comp.js.map +1 -0
- package/comp.ts +78 -0
- package/compact.js +157 -0
- package/compact.js.map +1 -0
- package/compact.ts +209 -0
- package/compact_ask.js +280 -0
- package/compact_ask.js.map +1 -0
- package/compact_ask.ts +199 -0
- package/continue.js +131 -0
- package/continue.js.map +1 -0
- package/continue.ts +143 -0
- package/conversation.js +337 -0
- package/conversation.js.map +1 -0
- package/conversation.ts +593 -0
- package/cost.js +111 -0
- package/cost.js.map +1 -0
- package/cost.ts +93 -0
- package/deferred.js +207 -0
- package/deferred.js.map +1 -0
- package/deferred.ts +219 -0
- package/deno.json +1 -0
- package/dependencies.js +114 -0
- package/dependencies.js.map +1 -0
- package/dependencies.ts +110 -0
- package/draining.js +20 -0
- package/draining.js.map +1 -0
- package/draining.ts +26 -0
- package/ended.js +210 -0
- package/ended.js.map +1 -0
- package/ended.ts +225 -0
- package/files.js +285 -0
- package/files.js.map +1 -0
- package/files.ts +318 -0
- package/fork.js +96 -0
- package/fork.js.map +1 -0
- package/fork.ts +124 -0
- package/graft.js +97 -0
- package/graft.js.map +1 -0
- package/graft.ts +88 -0
- package/graph.js +49 -0
- package/graph.js.map +1 -0
- package/graph.ts +61 -0
- package/handoff.js +111 -0
- package/handoff.js.map +1 -0
- package/handoff.ts +147 -0
- package/help.js +432 -0
- package/help.js.map +1 -0
- package/help.ts +431 -0
- package/hooks.js +253 -0
- package/hooks.js.map +1 -0
- package/hooks.ts +333 -0
- package/imported.js +259 -0
- package/imported.js.map +1 -0
- package/imported.ts +201 -0
- package/inspect.js +353 -0
- package/inspect.js.map +1 -0
- package/inspect.ts +378 -0
- package/intake.js +115 -0
- package/intake.js.map +1 -0
- package/intake.ts +124 -0
- package/joined.js +67 -0
- package/joined.js.map +1 -0
- package/joined.ts +69 -0
- package/lease.js +146 -0
- package/lease.js.map +1 -0
- package/lease.ts +151 -0
- package/lifecycle.js +49 -0
- package/lifecycle.js.map +1 -0
- package/lifecycle.ts +46 -0
- package/lines.js +171 -0
- package/lines.js.map +1 -0
- package/lines.ts +177 -0
- package/listen.js +604 -0
- package/listen.js.map +1 -0
- package/listen.ts +976 -0
- package/log.js +78 -0
- package/log.js.map +1 -0
- package/log.ts +88 -0
- package/mod.js +107 -0
- package/mod.js.map +1 -0
- package/mod.ts +113 -0
- package/name.js +51 -0
- package/name.js.map +1 -0
- package/name.ts +84 -0
- package/naming.js +96 -0
- package/naming.js.map +1 -0
- package/naming.ts +102 -0
- package/native.js +17 -0
- package/native.js.map +1 -0
- package/native.ts +17 -0
- package/package.json +133 -4
- package/parts.js +334 -0
- package/parts.js.map +1 -0
- package/parts.ts +383 -0
- package/plugin.js +77 -0
- package/plugin.js.map +1 -0
- package/plugin.ts +98 -0
- package/project.js +354 -0
- package/project.js.map +1 -0
- package/project.ts +407 -0
- package/prompt.js +57 -0
- package/prompt.js.map +1 -0
- package/prompt.ts +92 -0
- package/prose.js +43 -0
- package/prose.js.map +1 -0
- package/prose.ts +63 -0
- package/providers.js +279 -0
- package/providers.js.map +1 -0
- package/providers.ts +306 -0
- package/pruning.js +80 -0
- package/pruning.js.map +1 -0
- package/pruning.ts +147 -0
- package/reach.js +923 -0
- package/reach.js.map +1 -0
- package/reach.ts +1107 -0
- package/react.js +2259 -0
- package/react.js.map +1 -0
- package/react.ts +2864 -0
- package/readers.js +956 -0
- package/readers.js.map +1 -0
- package/readers.ts +1017 -0
- package/reap.js +60 -0
- package/reap.js.map +1 -0
- package/reap.ts +65 -0
- package/recall.js +67 -0
- package/recall.js.map +1 -0
- package/recall.ts +114 -0
- package/reopen.js +45 -0
- package/reopen.js.map +1 -0
- package/reopen.ts +44 -0
- package/result-entry.js +32 -0
- package/result-entry.js.map +1 -0
- package/result-entry.ts +34 -0
- package/resume.js +266 -0
- package/resume.js.map +1 -0
- package/resume.ts +283 -0
- package/routes.js +129 -0
- package/routes.js.map +1 -0
- package/routes.ts +147 -0
- package/routine.js +179 -0
- package/routine.js.map +1 -0
- package/routine.ts +191 -0
- package/run.js +932 -0
- package/run.js.map +1 -0
- package/run.ts +999 -0
- package/service.js +806 -0
- package/service.js.map +1 -0
- package/service.ts +911 -0
- package/source.js +26 -0
- package/source.js.map +1 -0
- package/source.ts +40 -0
- package/start.js +197 -0
- package/start.js.map +1 -0
- package/start.ts +214 -0
- package/state.js +247 -0
- package/state.js.map +1 -0
- package/state.ts +404 -0
- package/status.js +1222 -0
- package/status.js.map +1 -0
- package/status.ts +1555 -0
- package/status_bench.ts +50 -0
- package/statusline.js +187 -0
- package/statusline.js.map +1 -0
- package/statusline.ts +232 -0
- package/tail.js +748 -0
- package/tail.js.map +1 -0
- package/tail.ts +815 -0
- package/talk.js +58 -0
- package/talk.js.map +1 -0
- package/talk.ts +51 -0
- package/task-context.js +41 -0
- package/task-context.js.map +1 -0
- package/task-context.ts +53 -0
- package/texted.js +65 -0
- package/texted.js.map +1 -0
- package/texted.ts +65 -0
- package/timing.js +37 -0
- package/timing.js.map +1 -0
- package/timing.ts +52 -0
- package/told.js +56 -0
- package/told.js.map +1 -0
- package/told.ts +54 -0
- package/tools.js +595 -0
- package/tools.js.map +1 -0
- package/tools.ts +633 -0
- package/transcript.js +34 -0
- package/transcript.js.map +1 -0
- package/transcript.ts +41 -0
- package/turn.js +47 -0
- package/turn.js.map +1 -0
- package/turn.ts +68 -0
- package/unknown.js +8 -0
- package/unknown.js.map +1 -0
- package/unknown.ts +9 -0
- package/views.js +15 -0
- package/views.js.map +1 -0
- package/views.ts +21 -0
- package/vocab.js +24 -0
- package/vocab.js.map +1 -0
- package/vocab.json +1573 -0
- package/vocab.ts +30 -0
- package/wait.js +30 -0
- package/wait.js.map +1 -0
- package/wait.ts +45 -0
- package/wake.js +552 -0
- package/wake.js.map +1 -0
- package/wake.ts +597 -0
- package/watch.js +520 -0
- package/watch.js.map +1 -0
- package/watch.ts +596 -0
- package/who.js +309 -0
- package/who.js.map +1 -0
- package/who.ts +347 -0
- package/window.js +179 -0
- package/window.js.map +1 -0
- package/window.ts +268 -0
- package/woken.js +129 -0
- package/woken.js.map +1 -0
- package/woken.ts +127 -0
package/imported.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// One line of a harness's log, as the rows it becomes: what the importer
|
|
2
|
+
// (./tail.ts) writes for each line it reads, and what a host handed a run's
|
|
3
|
+
// lines rather than its file writes the same way (@yaks/spawn ./machines.ts).
|
|
4
|
+
// It reads no file, so a Worker imports it.
|
|
5
|
+
|
|
6
|
+
import type { Bundle, Comp, Eid } from 'jsr:@yaks/graph@0.2.36'
|
|
7
|
+
import { derivedEid, identityEid } from '@yaks/graph/identity'
|
|
8
|
+
import { toolEid } from '@yaks/tools/result'
|
|
9
|
+
import { limitRows } from '@yaks/model'
|
|
10
|
+
import type { Comps, Said } from './readers.ts'
|
|
11
|
+
|
|
12
|
+
/** The entity a harness's call becomes, named by the harness's own id for it,
|
|
13
|
+
* which is also what its result names. */
|
|
14
|
+
export let callOf = (session: Eid, id: string): Eid =>
|
|
15
|
+
derivedEid(`call ${session} ${id}`)
|
|
16
|
+
|
|
17
|
+
/** The entry a model request becomes, named by the harness's own id for it,
|
|
18
|
+
* which every line of its reply names again. */
|
|
19
|
+
export let askOf = (session: Eid, id: string): Eid =>
|
|
20
|
+
derivedEid(`ask ${session} ${id}`)
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Whether an entry is prose: what a person typed (content alone), or what the
|
|
24
|
+
* model said (content and the output that marks it).
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { prose } from '@yaks/session/tail'
|
|
28
|
+
* import { assertEquals } from '@std/assert'
|
|
29
|
+
*
|
|
30
|
+
* assertEquals(prose({ content: { body: 'hi' } }), true)
|
|
31
|
+
* assertEquals(prose({ content: { body: 'hmm' }, reasoning: {}, output: {} }), false)
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export let prose = (c: Comps): boolean =>
|
|
35
|
+
!!c.content && Object.keys(c).every((k) =>
|
|
36
|
+
k == 'content' || k == 'output' ||
|
|
37
|
+
(!!c.checkpoint && (k == 'checkpoint' || k == 'notice'))
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
/** Selections retain the runner/model provenance of old imported sessions. */
|
|
41
|
+
export let retained = (c: Comps) => prose(c) || !!c.using
|
|
42
|
+
|
|
43
|
+
/** What a person typed: prose with no output beside it. */
|
|
44
|
+
export let typed = (c: Comps) => prose(c) && !c.output && !c.checkpoint
|
|
45
|
+
|
|
46
|
+
/** Two patches to one entity, as one. */
|
|
47
|
+
export let merge = (a: Bundle, b: Bundle): Bundle => {
|
|
48
|
+
let out: Bundle = { ...a }
|
|
49
|
+
for (let [k, v] of Object.entries(b)) {
|
|
50
|
+
out[k] = v && typeof v == 'object' && !Array.isArray(v) && out[k]
|
|
51
|
+
? { ...out[k] as Comp, ...v as Comp }
|
|
52
|
+
: v
|
|
53
|
+
}
|
|
54
|
+
return out
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* One line, as the bundles it becomes: an entry for each thing it says, each
|
|
59
|
+
* sitting at the line of the file it was read from, a row for each tool it
|
|
60
|
+
* names, the answered call's state, and what it says about the session. A
|
|
61
|
+
* prompt a person typed is signed by `person`.
|
|
62
|
+
*/
|
|
63
|
+
export let imported = (
|
|
64
|
+
said: Said,
|
|
65
|
+
o: {
|
|
66
|
+
session: Eid
|
|
67
|
+
/** the file the line is read from; a line handed over without its file
|
|
68
|
+
* (@yaks/spawn ./machines.ts) sits at no file */
|
|
69
|
+
file?: Eid
|
|
70
|
+
/** the path it was opened at, which names the entries of a file other
|
|
71
|
+
* than the session's first */
|
|
72
|
+
path?: string
|
|
73
|
+
line: number
|
|
74
|
+
person?: Eid
|
|
75
|
+
prose?: boolean
|
|
76
|
+
own?: boolean
|
|
77
|
+
},
|
|
78
|
+
): Bundle[] => {
|
|
79
|
+
let { session, file, path, line } = o
|
|
80
|
+
let key = o.own === false ? `${session} ${path}` : session
|
|
81
|
+
let out = new Map<Eid, Bundle>()
|
|
82
|
+
let put = (b: Bundle) => {
|
|
83
|
+
let was = out.get(b.entity.eid)
|
|
84
|
+
out.set(b.entity.eid, was ? merge(was, b) : b)
|
|
85
|
+
}
|
|
86
|
+
// A request comes before what it returned, wherever its reader put it, so
|
|
87
|
+
// the reply ending a turn is its newest entry. Each entry keeps the name
|
|
88
|
+
// its place in the line gives it.
|
|
89
|
+
let asked = (c: Comps) => c.ask?.id != null
|
|
90
|
+
let order = said.entries.map((c, i) => [c, i] as const)
|
|
91
|
+
order = [
|
|
92
|
+
...order.filter(([c]) => asked(c)),
|
|
93
|
+
...order.filter(([c]) => !asked(c)),
|
|
94
|
+
]
|
|
95
|
+
order.forEach(([c, i]) => {
|
|
96
|
+
if (o.prose && !retained(c)) return
|
|
97
|
+
let { call, result, execution, output, using, ask, ...rest } = c
|
|
98
|
+
let row = (name: string, value: unknown) => {
|
|
99
|
+
let eid = identityEid(name, [String(value)])
|
|
100
|
+
put({ entity: { eid }, [name]: { name: String(value) } })
|
|
101
|
+
return eid
|
|
102
|
+
}
|
|
103
|
+
if (using) {
|
|
104
|
+
let refs: Comp = { ...using }
|
|
105
|
+
for (let name of ['provider', 'model']) {
|
|
106
|
+
if (using[name]) refs[name] = row(name, using[name])
|
|
107
|
+
}
|
|
108
|
+
rest.using = refs
|
|
109
|
+
}
|
|
110
|
+
let at = {
|
|
111
|
+
entry: { session },
|
|
112
|
+
...file ? { lines: { file, start: line } } : {},
|
|
113
|
+
}
|
|
114
|
+
if (ask && ask.id == null) rest.ask = ask
|
|
115
|
+
else if (ask) {
|
|
116
|
+
let { id, to, ...asked } = ask
|
|
117
|
+
put({
|
|
118
|
+
entity: { eid: askOf(session, String(id ?? `${line} ${i}`)) },
|
|
119
|
+
...at,
|
|
120
|
+
ask: { ...asked, ...(to ? { to: row('model', to) } : {}) },
|
|
121
|
+
...rest,
|
|
122
|
+
})
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
if (call) {
|
|
126
|
+
let { to, ...asked } = call
|
|
127
|
+
let name = String(to ?? '')
|
|
128
|
+
if (name) put({ entity: { eid: toolEid(name) }, tool: { name } })
|
|
129
|
+
put({
|
|
130
|
+
entity: { eid: callOf(session, String(call.id)) },
|
|
131
|
+
...at,
|
|
132
|
+
// The name it was called by stays beside the tool it names: a
|
|
133
|
+
// provider that continues the conversation is not served that tool.
|
|
134
|
+
call: { ...asked, ...(name ? { to: toolEid(name), name } : {}) },
|
|
135
|
+
execution: { by: session },
|
|
136
|
+
...rest,
|
|
137
|
+
})
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
let answers = result && callOf(session, String(result.call))
|
|
141
|
+
put({
|
|
142
|
+
entity: { eid: derivedEid(`${key} ${line} ${i}`) },
|
|
143
|
+
...at,
|
|
144
|
+
...(answers ? { result: { ...result, call: answers } } : {}),
|
|
145
|
+
...(output ? { output: { ...output, source: session } } : {}),
|
|
146
|
+
...rest,
|
|
147
|
+
...(typed(c) && o.person
|
|
148
|
+
? { $actor: { by: o.person, via: session } }
|
|
149
|
+
: {}),
|
|
150
|
+
})
|
|
151
|
+
if (answers && execution) put({ entity: { eid: answers }, execution })
|
|
152
|
+
})
|
|
153
|
+
if (said.about) put({ entity: { eid: session }, ...said.about })
|
|
154
|
+
for (let b of limitRows(said.limits ?? [], said.at)) put(b)
|
|
155
|
+
return [...out.values()]
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** A run of parts being joined: its key, the line of its first, and the
|
|
159
|
+
* entry they make so far. */
|
|
160
|
+
export type Open = { key: string; line: number; entry: Comps }
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* What a line says once the run of parts before it is joined, each with the
|
|
164
|
+
* line its entries sit at: the run's entry at its first line, where this line
|
|
165
|
+
* ends the run, then the line's own. A part of the run's key carries the run
|
|
166
|
+
* on, and a part of another key starts one.
|
|
167
|
+
*
|
|
168
|
+
* ```ts
|
|
169
|
+
* import { pieced } from '@yaks/session/tail'
|
|
170
|
+
* import { assertEquals } from '@std/assert'
|
|
171
|
+
*
|
|
172
|
+
* let h = {}
|
|
173
|
+
* let piece = (body: string) => ({ entries: [], part: { key: 'r', entry: { content: { body } } } })
|
|
174
|
+
* pieced(h, piece('Hel'), 3)
|
|
175
|
+
* pieced(h, piece('lo'), 4)
|
|
176
|
+
* assertEquals(pieced(h, { entries: [{ stop: {} }] }, 5), [
|
|
177
|
+
* [{ entries: [{ content: { body: 'Hello' } }] }, 3],
|
|
178
|
+
* [{ entries: [{ stop: {} }] }, 5],
|
|
179
|
+
* ])
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export let pieced = (
|
|
183
|
+
h: { part?: Open },
|
|
184
|
+
said: Said,
|
|
185
|
+
line: number,
|
|
186
|
+
): [Said, number][] => {
|
|
187
|
+
let { part, ...own } = said
|
|
188
|
+
let open = h.part
|
|
189
|
+
if (part && open?.key == part.key) {
|
|
190
|
+
let body = (c: Comps) => String(c.content?.body ?? '')
|
|
191
|
+
open.entry = {
|
|
192
|
+
...open.entry,
|
|
193
|
+
content: { body: body(open.entry) + body(part.entry) },
|
|
194
|
+
}
|
|
195
|
+
return [[own, line]]
|
|
196
|
+
}
|
|
197
|
+
h.part = part && { key: part.key, line, entry: part.entry }
|
|
198
|
+
return open
|
|
199
|
+
? [[{ entries: [open.entry] }, open.line], [own, line]]
|
|
200
|
+
: [[own, line]]
|
|
201
|
+
}
|
package/inspect.js
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a transcript reads in the inspector (@yaks/inspect), registered in this
|
|
3
|
+
* package's `/views` facet ahead of the page any entity has.
|
|
4
|
+
*
|
|
5
|
+
* - `Inspect.Turn`, for an entry: one turn of the conversation, said by who
|
|
6
|
+
* said it: a person's words by the person, a model's by `agent`, a tool
|
|
7
|
+
* called or its answer quiet, by what was called.
|
|
8
|
+
* - `Inspect.Conversation`, for an entry: the turns either side of it in its
|
|
9
|
+
* transcript, it lit among them, each a link to its own page. What any page
|
|
10
|
+
* showing words said in a conversation asks for (a belief citing them).
|
|
11
|
+
* - `Inspect.Page`, for an entry: the entry inside its conversation.
|
|
12
|
+
* - `Inspect.Page`, for a session: what it is running (its status, model and
|
|
13
|
+
* worktree), its brief, and its latest turns.
|
|
14
|
+
*
|
|
15
|
+
* Every part it has no better way to say is the inspector's (`io.show`).
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/ /* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h } from "react";
|
|
19
|
+
import { parse } from "@yaks/query";
|
|
20
|
+
import * as ui from "@yaks/ui";
|
|
21
|
+
import { Markdown } from "@yaks/markdown";
|
|
22
|
+
import { mention, Part, useNamed, usePageNotes } from "@yaks/inspect";
|
|
23
|
+
import { SESSION } from "./comp.js";
|
|
24
|
+
import { CALL, ENTRY, OUTPUT, RESULT } from "./native.js";
|
|
25
|
+
import { kindOf, textOf } from "./state.js";
|
|
26
|
+
import { asks, sessionName } from "./name.js";
|
|
27
|
+
/**
|
|
28
|
+
* The query that reads the entries beside one in its transcript, the way
|
|
29
|
+
* `grep -C` reads around a line: `n` of them ahead of it (`before`, nearest
|
|
30
|
+
* first) or behind it (`after`, in order), every component of each. A
|
|
31
|
+
* transcript is ordered by `entry.seq`, which may skip numbers, so entries are
|
|
32
|
+
* asked for by position, never by a range of numbers.
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { beside } from './inspect.ts'
|
|
36
|
+
* beside({ session: 's1', seq: 12 }, 'before', 3)
|
|
37
|
+
* // '.entry.session=s1&.entry.seq<12&*&.order=-entry.seq&.limit=3'
|
|
38
|
+
* ```
|
|
39
|
+
*/ export let beside = (at, way, n)=>`.${ENTRY}.session=${at.session}&.${ENTRY}.seq${way == 'before' ? '<' : '>'}` + `${at.seq}&*&.order=${way == 'before' ? '-' : ''}${ENTRY}.seq&.limit=${n}`;
|
|
40
|
+
/** How much of a turn that is not lit reads before it is cut. */ export let TURN = 320;
|
|
41
|
+
/** How many turns either side of an entry its page shows. */ export let AROUND = 8;
|
|
42
|
+
/** How many of a session's latest turns its page shows. */ export let LATEST = 12;
|
|
43
|
+
let comp = (b, name)=>b?.[name] ?? {};
|
|
44
|
+
let str = (b, name, prop)=>{
|
|
45
|
+
let v = comp(b, name)[prop];
|
|
46
|
+
return typeof v == 'string' ? v : '';
|
|
47
|
+
};
|
|
48
|
+
let rows = (a)=>a?.rows ?? [];
|
|
49
|
+
let cut = (text, n)=>text.length > n ? text.slice(0, n - 1).trimEnd() + '…' : text;
|
|
50
|
+
// Where an entry sits, if it is one.
|
|
51
|
+
let placed = (b)=>{
|
|
52
|
+
let session = str(b, ENTRY, 'session');
|
|
53
|
+
let seq = comp(b, ENTRY).seq;
|
|
54
|
+
return session && typeof seq == 'number' ? {
|
|
55
|
+
session,
|
|
56
|
+
seq
|
|
57
|
+
} : undefined;
|
|
58
|
+
};
|
|
59
|
+
// What a tool was called with, in a line: what the caller said it was for,
|
|
60
|
+
// else its arguments.
|
|
61
|
+
let called = (b)=>{
|
|
62
|
+
let args = comp(b, CALL).args;
|
|
63
|
+
let why = typeof args?.description == 'string' ? args.description : '';
|
|
64
|
+
return cut(why || JSON.stringify(args ?? {}), 160);
|
|
65
|
+
};
|
|
66
|
+
/** An entry as one turn of its conversation: who said it, linked to the
|
|
67
|
+
* turn's own page, and what. */ export let EntryTurn = ({ e, io, ctx })=>{
|
|
68
|
+
let { on, whole = on } = ctx;
|
|
69
|
+
let kind = kindOf(e);
|
|
70
|
+
let said = textOf(e);
|
|
71
|
+
let by = str(e, 'created', 'by');
|
|
72
|
+
let to = str(e, CALL, 'to');
|
|
73
|
+
useNamed(io, [
|
|
74
|
+
kind == 'input' ? by : '',
|
|
75
|
+
to
|
|
76
|
+
]);
|
|
77
|
+
let who = kind == 'input' && by ? mention(io, by) : OUTPUT in e || CALL in e || RESULT in e ? 'agent' : kind ?? io.kind(e);
|
|
78
|
+
let text = CALL in e ? [
|
|
79
|
+
'called ',
|
|
80
|
+
to ? mention(io, to) : 'a tool',
|
|
81
|
+
': ',
|
|
82
|
+
called(e)
|
|
83
|
+
] : RESULT in e ? [
|
|
84
|
+
'answered: ',
|
|
85
|
+
cut(said.trim() || '…', 160)
|
|
86
|
+
] : said ? /*#__PURE__*/ h(Markdown, {
|
|
87
|
+
source: whole ? said : cut(said, TURN)
|
|
88
|
+
}) : kind ?? io.kind(e);
|
|
89
|
+
return /*#__PURE__*/ h(ui.Turns.Turn, {
|
|
90
|
+
mod: on ? 'on' : (!said || CALL in e || RESULT in e) && 'quiet',
|
|
91
|
+
'data-turn': e.entity.eid
|
|
92
|
+
}, /*#__PURE__*/ h(ui.Turns.Who, {
|
|
93
|
+
href: on ? undefined : io.link(e.entity.eid)
|
|
94
|
+
}, who), /*#__PURE__*/ h(ui.Turns.Text, {}, text));
|
|
95
|
+
};
|
|
96
|
+
/** The turns either side of an entry in its transcript, it lit among them. */ export let Conversation = ({ e, io, ctx })=>{
|
|
97
|
+
let { before = AROUND, after = AROUND, whole = true } = ctx;
|
|
98
|
+
let at = placed(e);
|
|
99
|
+
let got = io.ask(at ? {
|
|
100
|
+
before: beside(at, 'before', before),
|
|
101
|
+
after: beside(at, 'after', after)
|
|
102
|
+
} : {});
|
|
103
|
+
let ahead = rows(got.before).toReversed();
|
|
104
|
+
let behind = rows(got.after);
|
|
105
|
+
if (!at) return null;
|
|
106
|
+
return /*#__PURE__*/ h(ui.Turns, {
|
|
107
|
+
'data-conversation': e.entity.eid
|
|
108
|
+
}, ahead.length == before ? /*#__PURE__*/ h(ui.Turns.More, {}, 'earlier turns are in ', mention(io, at.session)) : null, got.before?.error ? /*#__PURE__*/ h(ui.Rows.More, {}, got.before.error) : !got.before?.ready && !ahead.length ? /*#__PURE__*/ h(ui.Loading, {}) : null, [
|
|
109
|
+
...ahead,
|
|
110
|
+
e,
|
|
111
|
+
...behind
|
|
112
|
+
].map((b)=>io.show(b, 'Inspect.Turn', {
|
|
113
|
+
on: b == e,
|
|
114
|
+
whole: b == e && whole
|
|
115
|
+
})), got.after?.error ? /*#__PURE__*/ h(ui.Rows.More, {}, got.after.error) : !got.after?.ready && !behind.length ? /*#__PURE__*/ h(ui.Loading, {}) : null);
|
|
116
|
+
};
|
|
117
|
+
/** An entry's page: the entry inside its conversation. */ export let EntryPage = ({ e, io })=>{
|
|
118
|
+
let notes = usePageNotes(io, e, [
|
|
119
|
+
'Conversation'
|
|
120
|
+
]);
|
|
121
|
+
let at = placed(e);
|
|
122
|
+
let by = str(e, 'created', 'by');
|
|
123
|
+
useNamed(io, [
|
|
124
|
+
at?.session,
|
|
125
|
+
by
|
|
126
|
+
]);
|
|
127
|
+
let sub = [
|
|
128
|
+
kindOf(e) == 'input' && by ? [
|
|
129
|
+
'said by ',
|
|
130
|
+
mention(io, by)
|
|
131
|
+
] : kindOf(e) ?? 'an entry',
|
|
132
|
+
at ? [
|
|
133
|
+
' in ',
|
|
134
|
+
mention(io, at.session),
|
|
135
|
+
` · turn ${at.seq}`
|
|
136
|
+
] : null
|
|
137
|
+
];
|
|
138
|
+
return /*#__PURE__*/ h('div', {
|
|
139
|
+
'data-inspect': e.entity.eid
|
|
140
|
+
}, io.show(e, 'Inspect.Head', {
|
|
141
|
+
sub,
|
|
142
|
+
notes: notes.get('')
|
|
143
|
+
}), /*#__PURE__*/ h(Part, {
|
|
144
|
+
io,
|
|
145
|
+
eid: e.entity.eid,
|
|
146
|
+
subject: io.id(e),
|
|
147
|
+
heading: 'Conversation',
|
|
148
|
+
notes
|
|
149
|
+
}, io.show(e, 'Inspect.Conversation', {})), io.show(e, 'Inspect.Facts', {
|
|
150
|
+
notes,
|
|
151
|
+
skip: [
|
|
152
|
+
ENTRY
|
|
153
|
+
]
|
|
154
|
+
}), io.show(e, 'Inspect.Links', {
|
|
155
|
+
notes
|
|
156
|
+
}), io.show(e, 'Inspect.History', {
|
|
157
|
+
notes
|
|
158
|
+
}));
|
|
159
|
+
};
|
|
160
|
+
// The session lifecycle wears the same pip in every shared renderer.
|
|
161
|
+
let SessionDot = ({ e })=>{
|
|
162
|
+
let status = str(e, SESSION, 'status');
|
|
163
|
+
let looks = {
|
|
164
|
+
idle: [
|
|
165
|
+
'half',
|
|
166
|
+
'active'
|
|
167
|
+
],
|
|
168
|
+
settled: [
|
|
169
|
+
'half',
|
|
170
|
+
'active'
|
|
171
|
+
],
|
|
172
|
+
pending: [
|
|
173
|
+
'half',
|
|
174
|
+
'active'
|
|
175
|
+
],
|
|
176
|
+
running: [
|
|
177
|
+
'pulse',
|
|
178
|
+
'active'
|
|
179
|
+
],
|
|
180
|
+
completed: [
|
|
181
|
+
'check',
|
|
182
|
+
'positive'
|
|
183
|
+
],
|
|
184
|
+
failed: [
|
|
185
|
+
'cross',
|
|
186
|
+
'negative'
|
|
187
|
+
],
|
|
188
|
+
interrupted: [
|
|
189
|
+
'cross',
|
|
190
|
+
'caution'
|
|
191
|
+
],
|
|
192
|
+
stopped: [
|
|
193
|
+
'cross',
|
|
194
|
+
'caution'
|
|
195
|
+
],
|
|
196
|
+
lost: [
|
|
197
|
+
'dashed',
|
|
198
|
+
'special'
|
|
199
|
+
]
|
|
200
|
+
};
|
|
201
|
+
return /*#__PURE__*/ h(ui.Dot, {
|
|
202
|
+
mod: looks[status],
|
|
203
|
+
title: status || 'no status'
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
// What a session is running, in a line: its status, the model it asks, and
|
|
207
|
+
// the worktree it works in.
|
|
208
|
+
let running = (io, e)=>{
|
|
209
|
+
let model = str(e, 'using', 'model');
|
|
210
|
+
let branch = str(e, 'worktree', 'branch');
|
|
211
|
+
let path = str(e, 'workspace', 'root');
|
|
212
|
+
return [
|
|
213
|
+
/*#__PURE__*/ h(SessionDot, {
|
|
214
|
+
e
|
|
215
|
+
}),
|
|
216
|
+
model ? [
|
|
217
|
+
' · asks ',
|
|
218
|
+
mention(io, model)
|
|
219
|
+
] : null,
|
|
220
|
+
branch || path ? [
|
|
221
|
+
' · in ',
|
|
222
|
+
branch || path
|
|
223
|
+
] : null
|
|
224
|
+
];
|
|
225
|
+
};
|
|
226
|
+
/** A session's latest turns, oldest first. */ let Latest = ({ e, io, notes })=>{
|
|
227
|
+
let eid = e.entity.eid;
|
|
228
|
+
let line = `.${ENTRY}.session=${eid}`;
|
|
229
|
+
let got = io.ask({
|
|
230
|
+
turns: `${line}&*&.order=-${ENTRY}.seq&.limit=${LATEST}`,
|
|
231
|
+
total: {
|
|
232
|
+
query: `${line}&.count`,
|
|
233
|
+
once: true
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
let turns = rows(got.turns).toReversed();
|
|
237
|
+
return /*#__PURE__*/ h(Part, {
|
|
238
|
+
io,
|
|
239
|
+
eid,
|
|
240
|
+
subject: io.id(e),
|
|
241
|
+
heading: 'Latest turns',
|
|
242
|
+
count: got.total?.count,
|
|
243
|
+
note: /*#__PURE__*/ h('a', {
|
|
244
|
+
href: io.find(`${line}&.order=${ENTRY}.seq`)
|
|
245
|
+
}, 'every turn'),
|
|
246
|
+
notes
|
|
247
|
+
}, got.turns?.error ? /*#__PURE__*/ h(ui.Rows.More, {}, got.turns.error) : !turns.length && !got.turns?.ready ? /*#__PURE__*/ h(ui.Loading, {}) : !turns.length ? /*#__PURE__*/ h(ui.Rows.More, {}, 'nothing said yet') : /*#__PURE__*/ h(ui.Turns, {}, turns.map((b)=>io.show(b, 'Inspect.Turn', {}))));
|
|
248
|
+
};
|
|
249
|
+
/** A session's page. */ export let SessionPage = ({ e, io })=>{
|
|
250
|
+
let notes = usePageNotes(io, e, [
|
|
251
|
+
'Latest turns'
|
|
252
|
+
]);
|
|
253
|
+
useNamed(io, [
|
|
254
|
+
str(e, 'using', 'model')
|
|
255
|
+
]);
|
|
256
|
+
let brief = str(e, 'brief', 'text');
|
|
257
|
+
return /*#__PURE__*/ h('div', {
|
|
258
|
+
'data-inspect': e.entity.eid
|
|
259
|
+
}, io.show(e, 'Inspect.Head', {
|
|
260
|
+
sub: running(io, e),
|
|
261
|
+
notes: notes.get('')
|
|
262
|
+
}), brief ? /*#__PURE__*/ h(ui.Section, {
|
|
263
|
+
'data-brief': ''
|
|
264
|
+
}, /*#__PURE__*/ h(ui.Body, {}, /*#__PURE__*/ h(Markdown, {
|
|
265
|
+
source: brief
|
|
266
|
+
}))) : null, /*#__PURE__*/ h(Latest, {
|
|
267
|
+
e,
|
|
268
|
+
io,
|
|
269
|
+
notes
|
|
270
|
+
}), io.show(e, 'Inspect.Facts', {
|
|
271
|
+
notes,
|
|
272
|
+
skip: [
|
|
273
|
+
'brief'
|
|
274
|
+
]
|
|
275
|
+
}), io.show(e, 'Inspect.Links', {
|
|
276
|
+
notes,
|
|
277
|
+
skip: [
|
|
278
|
+
`${ENTRY}.session`
|
|
279
|
+
]
|
|
280
|
+
}), io.show(e, 'Inspect.History', {
|
|
281
|
+
notes
|
|
282
|
+
}));
|
|
283
|
+
};
|
|
284
|
+
/** A session in any list: its work first, then state and latest turn.
|
|
285
|
+
* Reads are bounded and projected; naming a row never loads a transcript. */ export let SessionTile = ({ e, io, got = {} })=>{
|
|
286
|
+
let eid = e.entity.eid;
|
|
287
|
+
let using = rows(got.first).find((b)=>b.using);
|
|
288
|
+
let provider = str(using, 'using', 'provider');
|
|
289
|
+
useNamed(io, [
|
|
290
|
+
provider
|
|
291
|
+
]);
|
|
292
|
+
let origin = e.native ? 'native' : e.process ? 'managed' : comp(e, SESSION).transcript ? 'imported' : 'unknown harness';
|
|
293
|
+
let read = {
|
|
294
|
+
claim: rows(got.claim),
|
|
295
|
+
work: rows(got.work),
|
|
296
|
+
first: rows(got.first)
|
|
297
|
+
};
|
|
298
|
+
let title = sessionName(e, read) || io.id(e);
|
|
299
|
+
let at = str(rows(got.last)[0], 'created', 'at');
|
|
300
|
+
let ready = Object.values(got).every((a)=>a.ready);
|
|
301
|
+
return /*#__PURE__*/ h(ui.Tile, {
|
|
302
|
+
href: io.link(eid)
|
|
303
|
+
}, /*#__PURE__*/ h(ui.Tile.Kind, {}, /*#__PURE__*/ h(SessionDot, {
|
|
304
|
+
e
|
|
305
|
+
}), ' ', origin, provider ? ` · ${io.name(provider)}` : ''), /*#__PURE__*/ h(ui.Tile.Title, {}, title), /*#__PURE__*/ h(ui.Tile.Sub, {}, [
|
|
306
|
+
str(e, SESSION, 'status'),
|
|
307
|
+
at ? `active ${io.when(at)}` : ready ? 'no transcript recorded' : 'loading activity…'
|
|
308
|
+
].filter(Boolean).join(' · ')));
|
|
309
|
+
};
|
|
310
|
+
/** The shared list summary. A bounded opening preview keeps old transcripts cheap. */ let sessionTile = {
|
|
311
|
+
view: 'List.Tile',
|
|
312
|
+
match: parse(`.${SESSION}`),
|
|
313
|
+
Render: SessionTile,
|
|
314
|
+
asks: (e)=>{
|
|
315
|
+
let eid = e.entity.eid;
|
|
316
|
+
return {
|
|
317
|
+
...asks(eid),
|
|
318
|
+
last: `.entry.session=${eid}&.order=-entry.seq&.limit=1&.fields=entry.session,entry.seq,created.at`
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
/** The pages and parts this package draws in the inspector. */ export let inspectViews = [
|
|
323
|
+
sessionTile,
|
|
324
|
+
{
|
|
325
|
+
...sessionTile,
|
|
326
|
+
view: 'Feed.Tile'
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
...sessionTile,
|
|
330
|
+
view: 'Search.Tile'
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
view: 'Inspect.Turn',
|
|
334
|
+
match: parse(`.${ENTRY}`),
|
|
335
|
+
Render: EntryTurn
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
view: 'Inspect.Conversation',
|
|
339
|
+
match: parse(`.${ENTRY}`),
|
|
340
|
+
Render: Conversation
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
view: 'Inspect.Page',
|
|
344
|
+
match: parse(`.${ENTRY}`),
|
|
345
|
+
Render: EntryPage
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
view: 'Inspect.Page',
|
|
349
|
+
match: parse(`.${SESSION}`),
|
|
350
|
+
Render: SessionPage
|
|
351
|
+
}
|
|
352
|
+
];
|
|
353
|
+
//# sourceMappingURL=inspect.js.map
|
package/inspect.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.js","sources":["./inspect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;CAiBC,GAED,uCAAuC,GAAG,SAAS,iBAAiB,CAAC,gBAAoD;AACzH,SAAS,KAAK,2BAAgC;AAC9C,YAAY,wBAA6B;AACzC,SAAS,QAAQ,8BAAmC;AACpD,SAIE,OAAO,EACP,IAAI,EAEJ,QAAQ,EACR,YAAY,6BAEmB;AACjC,SAAS,OAAO,oBAAmB;AACnC,SAAS,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAqB;AACzD,SAAS,MAAM,EAAE,MAAM,qBAAoB;AAC3C,SAAS,IAAI,EAAa,WAAW,oBAAmB;AAKxD;;;;;;;;;;;;CAYC,GACD,OAAO,IAAI,SAAS,CAAC,IAAQ,KAAyB,IACpD,CAAC,CAAC,EAAE,MAAM,SAAS,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,EAC5C,OAAO,WAAW,MAAM,KACxB,GACF,GAAG,GAAG,GAAG,CAAC,UAAU,EAAE,OAAO,WAAW,MAAM,KAAK,MAAM,YA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