@yaks/browse 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 +324 -2
- package/_dist/app.d.ts +8 -0
- package/_dist/app.d.ts.map +1 -0
- package/_dist/cli.d.ts +16 -0
- package/_dist/cli.d.ts.map +1 -0
- package/_dist/hosting.d.ts +24 -0
- package/_dist/hosting.d.ts.map +1 -0
- package/_dist/mod.d.ts +7 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/types.d.ts +5 -0
- package/_dist/types.d.ts.map +1 -0
- package/_dist/url.d.ts +2 -0
- package/_dist/url.d.ts.map +1 -0
- package/app.js +10 -0
- package/app.js.map +1 -0
- package/app.ts +10 -0
- package/browser-links.js +22 -0
- package/browser-links.js.map +1 -0
- package/browser-links.ts +28 -0
- package/cli.js +172 -0
- package/cli.js.map +1 -0
- package/cli.ts +168 -0
- package/client.js +748 -0
- package/client.js.map +1 -0
- package/client.ts +734 -0
- package/clipboard.js +18 -0
- package/clipboard.js.map +1 -0
- package/clipboard.ts +17 -0
- package/commands.js +1157 -0
- package/commands.js.map +1 -0
- package/commands.ts +1108 -0
- package/components/Ansi.tsx +160 -0
- package/components/App.tsx +446 -0
- package/components/Canvas.tsx +625 -0
- package/components/Card.tsx +276 -0
- package/components/Chat.tsx +205 -0
- package/components/Configuration.tsx +218 -0
- package/components/Decision.tsx +49 -0
- package/components/Dot.tsx +52 -0
- package/components/Entity.tsx +609 -0
- package/components/Fault.tsx +43 -0
- package/components/Filter.tsx +103 -0
- package/components/Keybindings.tsx +100 -0
- package/components/Keys.tsx +67 -0
- package/components/Markdown.tsx +90 -0
- package/components/Navigation.tsx +161 -0
- package/components/New.tsx +490 -0
- package/components/Peek.tsx +168 -0
- package/components/Prio.tsx +20 -0
- package/components/Run.tsx +263 -0
- package/components/Search.tsx +280 -0
- package/components/Stamp.tsx +44 -0
- package/components/Status.tsx +514 -0
- package/components/Sync.tsx +173 -0
- package/components/Tile.tsx +50 -0
- package/components/answered.js +23 -0
- package/components/answered.js.map +1 -0
- package/components/answered.ts +25 -0
- package/components/comp.js +11 -0
- package/components/comp.js.map +1 -0
- package/components/comp.ts +10 -0
- package/components/drag.js +173 -0
- package/components/drag.js.map +1 -0
- package/components/drag.ts +198 -0
- package/components/fields.tsx +90 -0
- package/components/fixtures/README.md +10 -0
- package/components/fixtures/archetypes.json +3646 -0
- package/components/hits.js +63 -0
- package/components/hits.js.map +1 -0
- package/components/hits.ts +84 -0
- package/components/icons.tsx +177 -0
- package/components/inspect.tsx +331 -0
- package/components/mount.ts +79 -0
- package/components/nav.tsx +479 -0
- package/components/offers.js +26 -0
- package/components/offers.js.map +1 -0
- package/components/offers.ts +54 -0
- package/components/page.js +21 -0
- package/components/page.js.map +1 -0
- package/components/page.ts +18 -0
- package/components/read.js +5 -0
- package/components/read.js.map +1 -0
- package/components/read.ts +7 -0
- package/components/registry.js +285 -0
- package/components/registry.js.map +1 -0
- package/components/registry.ts +317 -0
- package/components/session_status.tsx +115 -0
- package/components/subscriptions.js +149 -0
- package/components/subscriptions.js.map +1 -0
- package/components/subscriptions.ts +161 -0
- package/components/title.tsx +21 -0
- package/components/useQuery.js +166 -0
- package/components/useQuery.js.map +1 -0
- package/components/useQuery.ts +211 -0
- package/components/views/Board.tsx +450 -0
- package/components/views/BoardTile.tsx +65 -0
- package/components/views/Dashboard.tsx +148 -0
- package/components/views/Debug.tsx +445 -0
- package/components/views/Dependency.tsx +51 -0
- package/components/views/Entry.tsx +500 -0
- package/components/views/Gist.tsx +28 -0
- package/components/views/Inline.tsx +54 -0
- package/components/views/Json.tsx +19 -0
- package/components/views/Layout.tsx +211 -0
- package/components/views/List.tsx +238 -0
- package/components/views/Md.tsx +43 -0
- package/components/views/Media.tsx +48 -0
- package/components/views/Memory.tsx +32 -0
- package/components/views/Relate.tsx +205 -0
- package/components/views/Search.tsx +42 -0
- package/components/views/Session.tsx +850 -0
- package/components/views/SessionManage.tsx +127 -0
- package/components/views/Show.tsx +758 -0
- package/components/views/Shown.tsx +72 -0
- package/components/views/Split.tsx +58 -0
- package/components/views/TaskTile.tsx +37 -0
- package/components/views/Title.tsx +105 -0
- package/components/views/Wake.tsx +77 -0
- package/components/views/Web.tsx +49 -0
- package/components/wells.js +30 -0
- package/components/wells.js.map +1 -0
- package/components/wells.ts +33 -0
- package/configuration.js +38 -0
- package/configuration.js.map +1 -0
- package/configuration.ts +41 -0
- package/decision_sync.js +88 -0
- package/decision_sync.js.map +1 -0
- package/decision_sync.ts +93 -0
- package/deno.json +1 -0
- package/domain-host.tsx +108 -0
- package/edge.js +193 -0
- package/edge.js.map +1 -0
- package/edge.ts +196 -0
- package/entry_log.js +241 -0
- package/entry_log.js.map +1 -0
- package/entry_log.ts +214 -0
- package/failure.js +22 -0
- package/failure.js.map +1 -0
- package/failure.ts +34 -0
- package/front.json +61 -0
- package/highlight.js +143 -0
- package/highlight.js.map +1 -0
- package/highlight.ts +149 -0
- package/history.js +68 -0
- package/history.js.map +1 -0
- package/history.ts +72 -0
- package/host_commands.js +107 -0
- package/host_commands.js.map +1 -0
- package/host_commands.ts +38 -0
- package/hosting.js +53 -0
- package/hosting.js.map +1 -0
- package/hosting.ts +72 -0
- package/idb.js +14 -0
- package/idb.js.map +1 -0
- package/idb.ts +15 -0
- package/index.js +232 -0
- package/index.js.map +1 -0
- package/index.ts +252 -0
- package/keybindings.js +136 -0
- package/keybindings.js.map +1 -0
- package/keybindings.ts +37 -0
- package/kit.js +103 -0
- package/kit.js.map +1 -0
- package/kit.ts +119 -0
- package/layout.js +254 -0
- package/layout.js.map +1 -0
- package/layout.ts +210 -0
- package/legacy_outbox.js +53 -0
- package/legacy_outbox.js.map +1 -0
- package/legacy_outbox.ts +63 -0
- package/live.js +2883 -0
- package/live.js.map +1 -0
- package/live.ts +3334 -0
- package/live_archetypes.js +92 -0
- package/live_archetypes.js.map +1 -0
- package/live_archetypes.ts +113 -0
- package/live_client.js +145 -0
- package/live_client.js.map +1 -0
- package/live_client.ts +120 -0
- package/main.tsx +5 -0
- package/mod.js +7 -0
- package/mod.js.map +1 -0
- package/mod.ts +7 -0
- package/mount.tsx +50 -0
- package/navigation.js +120 -0
- package/navigation.js.map +1 -0
- package/navigation.ts +152 -0
- package/near.js +83 -0
- package/near.js.map +1 -0
- package/near.ts +83 -0
- package/new.js +295 -0
- package/new.js.map +1 -0
- package/new.ts +361 -0
- package/outbox.js +112 -0
- package/outbox.js.map +1 -0
- package/outbox.ts +129 -0
- package/owner.js +39 -0
- package/owner.js.map +1 -0
- package/owner.ts +37 -0
- package/package.json +81 -4
- package/paste.js +157 -0
- package/paste.js.map +1 -0
- package/paste.ts +122 -0
- package/props.js +303 -0
- package/props.js.map +1 -0
- package/props.ts +358 -0
- package/providers.js +136 -0
- package/providers.js.map +1 -0
- package/providers.ts +194 -0
- package/query.js +987 -0
- package/query.js.map +1 -0
- package/query.ts +1113 -0
- package/remote.js +37 -0
- package/remote.js.map +1 -0
- package/remote.ts +46 -0
- package/resolver.js +149 -0
- package/resolver.js.map +1 -0
- package/resolver.ts +213 -0
- package/rfc2047.js +37 -0
- package/rfc2047.js.map +1 -0
- package/rfc2047.ts +40 -0
- package/row_holds.js +107 -0
- package/row_holds.js.map +1 -0
- package/row_holds.ts +93 -0
- package/served.ts +42 -0
- package/session_worktree.js +7 -0
- package/session_worktree.js.map +1 -0
- package/session_worktree.ts +16 -0
- package/sessions.js +57 -0
- package/sessions.js.map +1 -0
- package/sessions.ts +53 -0
- package/sha.js +161 -0
- package/sha.js.map +1 -0
- package/sha.ts +164 -0
- package/styles.css +2823 -0
- package/subs.js +36 -0
- package/subs.js.map +1 -0
- package/subs.ts +40 -0
- package/terminal-route.js +13 -0
- package/terminal-route.js.map +1 -0
- package/terminal-route.ts +17 -0
- package/terminal.js +251 -0
- package/terminal.js.map +1 -0
- package/terminal.ts +186 -0
- package/time.js +142 -0
- package/time.js.map +1 -0
- package/time.ts +133 -0
- package/title.js +25 -0
- package/title.js.map +1 -0
- package/title.ts +50 -0
- package/tui/doc.ts +6 -0
- package/tui/testing.ts +19 -0
- package/twin.js +11 -0
- package/twin.js.map +1 -0
- package/twin.ts +13 -0
- package/types.js +456 -0
- package/types.js.map +1 -0
- package/types.ts +1370 -0
- package/url.js +77 -0
- package/url.js.map +1 -0
- package/url.ts +85 -0
- package/verb.js +82 -0
- package/verb.js.map +1 -0
- package/verb.ts +137 -0
- package/warmth.js +41 -0
- package/warmth.js.map +1 -0
- package/warmth.ts +54 -0
- package/wire.js +86 -0
- package/wire.js.map +1 -0
- package/wire.ts +63 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
|
|
2
|
+
/* @ts-types="npm:@types/react@19.3.0" */ import type { ReactNode } from 'npm:react@19.3.0'
|
|
3
|
+
import { reversed } from 'jsr:@yaks/edge@0.2.36/vocab'
|
|
4
|
+
import { type Ent, vocab } from '../../types.ts'
|
|
5
|
+
import { block } from 'jsr:@yaks/ui@0.2.36'
|
|
6
|
+
import { Entity } from '../Entity.tsx'
|
|
7
|
+
|
|
8
|
+
let Sentence = block('div', 'Dependency', {
|
|
9
|
+
Line: 'div',
|
|
10
|
+
Type: 'span',
|
|
11
|
+
Note: 'span',
|
|
12
|
+
Gist: 'div',
|
|
13
|
+
})
|
|
14
|
+
let { Line, Type, Note, Gist } = Sentence
|
|
15
|
+
|
|
16
|
+
// How an edge reads from its child's side: the phrase its relation declares
|
|
17
|
+
// in the vocabulary (`reversed`, @yaks/edge) — 'contained by', 'required by' —
|
|
18
|
+
// or, for a relation that declares none, its own name.
|
|
19
|
+
export let up = (type: string): string => reversed(vocab)[type] ?? type
|
|
20
|
+
|
|
21
|
+
// An entity as one edge row, in two lines: "<verb> <inline>" at the body's
|
|
22
|
+
// size, and under it, smaller, what the entity is (its `Gist`: its kind, the
|
|
23
|
+
// first line of what it says, when it was made). More than a bare name, less
|
|
24
|
+
// than a tile. Never a tab — reached by name, with the verb passed through by
|
|
25
|
+
// the parent's edge row. The verb wears its edge's colour (styles.css
|
|
26
|
+
// `--requires`, `--reads`, `--contains`). The name is the entity's own Inline
|
|
27
|
+
// — chip, a task's status pip (an alert when gated), title, struck when
|
|
28
|
+
// settled: the row says whether the edge still binds. A reversed row (the
|
|
29
|
+
// view from the child) passes `label`, its relation's `up` phrase, and keeps
|
|
30
|
+
// the type for its colour; `note` rides the first line (a similarity's
|
|
31
|
+
// score).
|
|
32
|
+
export let Dependency = (
|
|
33
|
+
{ e, type, label, note }: {
|
|
34
|
+
e: Ent
|
|
35
|
+
type?: unknown
|
|
36
|
+
label?: unknown
|
|
37
|
+
note?: ReactNode
|
|
38
|
+
},
|
|
39
|
+
) => (
|
|
40
|
+
<Sentence>
|
|
41
|
+
<Line>
|
|
42
|
+
{typeof type == 'string' && (
|
|
43
|
+
<Type mod={type}>{typeof label == 'string' ? label : type}</Type>
|
|
44
|
+
)} <Entity eid={e.eid} view='Inline' />
|
|
45
|
+
{note != null && <Note>{note}</Note>}
|
|
46
|
+
</Line>
|
|
47
|
+
<Gist>
|
|
48
|
+
<Entity eid={e.eid} view='Gist' />
|
|
49
|
+
</Gist>
|
|
50
|
+
</Sentence>
|
|
51
|
+
)
|
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
/** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
|
|
2
|
+
import { useRepoUrl } from '../subscriptions.ts'
|
|
3
|
+
// Session entries as a small renderer vocabulary. Summary and Full faces
|
|
4
|
+
// share this kit; component-specific registrations choose what each face says.
|
|
5
|
+
/* @ts-types="npm:@types/react@19.3.0" */ import { useState } from 'npm:react@19.3.0'
|
|
6
|
+
import { type Ent, friendly, kilo, type LogRow } from '../../types.ts'
|
|
7
|
+
import { backlinks, ent } from '../../live.ts'
|
|
8
|
+
import * as ui from 'jsr:@yaks/ui@0.2.36'
|
|
9
|
+
import { did, doing } from 'jsr:@yaks/tools@0.2.36/title'
|
|
10
|
+
import { Entity } from '../Entity.tsx'
|
|
11
|
+
import { resolve } from '../registry.ts'
|
|
12
|
+
import { Icon } from '../icons.tsx'
|
|
13
|
+
import { Ansi } from '../Ansi.tsx'
|
|
14
|
+
import { Markdown } from '../Markdown.tsx'
|
|
15
|
+
|
|
16
|
+
let Frame = ui.block('div', 'Entry', {
|
|
17
|
+
Lens: 'div',
|
|
18
|
+
Tabs: 'div',
|
|
19
|
+
Line: 'span',
|
|
20
|
+
More: 'button',
|
|
21
|
+
Name: 'span',
|
|
22
|
+
Speaker: 'div',
|
|
23
|
+
Status: 'span',
|
|
24
|
+
Error: 'span',
|
|
25
|
+
Code: 'pre',
|
|
26
|
+
Output: 'div',
|
|
27
|
+
Err: 'pre',
|
|
28
|
+
Raw: 'span',
|
|
29
|
+
Reason: 'div',
|
|
30
|
+
Turn: 'div',
|
|
31
|
+
Oops: 'div',
|
|
32
|
+
Sys: 'div',
|
|
33
|
+
SysTag: 'span',
|
|
34
|
+
SysText: 'span',
|
|
35
|
+
SysCount: 'span',
|
|
36
|
+
Part: 'section',
|
|
37
|
+
PartName: 'div',
|
|
38
|
+
})
|
|
39
|
+
let Prompt = ui.block('details', 'Prompt', {
|
|
40
|
+
Gist: 'summary',
|
|
41
|
+
Body: 'div',
|
|
42
|
+
})
|
|
43
|
+
let {
|
|
44
|
+
Lens,
|
|
45
|
+
Tabs,
|
|
46
|
+
Line,
|
|
47
|
+
More,
|
|
48
|
+
Name,
|
|
49
|
+
Speaker,
|
|
50
|
+
Status,
|
|
51
|
+
Error,
|
|
52
|
+
Code,
|
|
53
|
+
Output,
|
|
54
|
+
Err,
|
|
55
|
+
Raw,
|
|
56
|
+
Reason,
|
|
57
|
+
Turn,
|
|
58
|
+
Oops,
|
|
59
|
+
Sys,
|
|
60
|
+
SysTag,
|
|
61
|
+
SysText,
|
|
62
|
+
SysCount,
|
|
63
|
+
Part,
|
|
64
|
+
PartName,
|
|
65
|
+
} = Frame
|
|
66
|
+
let { Tab } = ui.Tabs
|
|
67
|
+
|
|
68
|
+
let lines = (text = '') => text.replace(/\n$/, '').split('\n')
|
|
69
|
+
let first = (text = '') => lines(text)[0]
|
|
70
|
+
let long = (text = '') => lines(text).length > 1
|
|
71
|
+
// The one control that grows a summary in place: `…` reveals the rest, `˅`
|
|
72
|
+
// folds it back. It appears only when there is more than the first line to show.
|
|
73
|
+
let more = (show: (() => void) | undefined, text: string, open = false) =>
|
|
74
|
+
long(text) && (
|
|
75
|
+
<More
|
|
76
|
+
type='button'
|
|
77
|
+
onClick={show}
|
|
78
|
+
aria-label={open ? 'collapse entry' : 'show full entry'}
|
|
79
|
+
>
|
|
80
|
+
{open ? '˅' : '…'}
|
|
81
|
+
</More>
|
|
82
|
+
)
|
|
83
|
+
let body = (e: Ent) => e.content?.body ?? ''
|
|
84
|
+
// Who a prose entry is from: a model's output wears `output` (@yaks/tools).
|
|
85
|
+
let said = (e: Ent) => e.output ? 'agent' : 'user'
|
|
86
|
+
let speaker = (role: 'agent' | 'user') => role == 'agent' ? 'model' : 'input'
|
|
87
|
+
// A model's reply is said by the persona its session wears, by name, once
|
|
88
|
+
// that persona's row has come (the Session view holds it); else by 'model'.
|
|
89
|
+
let source = (e: Ent) => {
|
|
90
|
+
if (e.call) return 'tool call'
|
|
91
|
+
if (e.result) return 'tool result'
|
|
92
|
+
if (e.prompt) return 'instructions'
|
|
93
|
+
if (e.notice) return 'context'
|
|
94
|
+
if (e.checkpoint) return 'checkpoint'
|
|
95
|
+
let session = e.entry?.session ? ent(e.entry.session) : undefined
|
|
96
|
+
let persona = session?.session?.persona
|
|
97
|
+
if (e.output) {
|
|
98
|
+
return e.reasoning
|
|
99
|
+
? 'reasoning'
|
|
100
|
+
: (persona && ent(persona).doc?.title) || 'model'
|
|
101
|
+
}
|
|
102
|
+
return session?.session?.operator ? 'person' : 'input'
|
|
103
|
+
}
|
|
104
|
+
let failed = (e: Ent) =>
|
|
105
|
+
(e.exit?.code != null && e.exit.code != 0) || !!e.refusal || !!e.error ||
|
|
106
|
+
!!e.exception ||
|
|
107
|
+
(e.response?.status != null && e.response.status >= 400)
|
|
108
|
+
// Local-only: Session holds its entry partition and one root reverse list.
|
|
109
|
+
// An entry rendered alone is best-effort, like other per-row badges.
|
|
110
|
+
let result = (e: Ent) => {
|
|
111
|
+
let eid = backlinks(e.eid).find((x) => x.via == 'result.call')?.from
|
|
112
|
+
return eid ? ent(eid) : undefined
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type EntryLine = {
|
|
116
|
+
eid?: string
|
|
117
|
+
call?: string
|
|
118
|
+
result?: string
|
|
119
|
+
seq: number
|
|
120
|
+
line: string
|
|
121
|
+
row?: LogRow
|
|
122
|
+
n?: number
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let settled = (row: LogRow | undefined, out: Ent): LogRow | undefined => {
|
|
126
|
+
if (row?.kind == 'tool') return { ...row, ok: !failed(out) }
|
|
127
|
+
if (row?.kind == 'exec') {
|
|
128
|
+
let code = out.exit?.code
|
|
129
|
+
return code == null
|
|
130
|
+
? { ...row, status: failed(out) ? '✗ failed' : '✓ done' }
|
|
131
|
+
: { ...row, exit: code }
|
|
132
|
+
}
|
|
133
|
+
return row
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// A result completes an earlier call; transcript order stays on that call so
|
|
137
|
+
// parallel tools settle in place rather than adding a second narration row.
|
|
138
|
+
// Both durable entities remain named on the merged line for its lens.
|
|
139
|
+
export let mergeTools = (entries: EntryLine[]) => {
|
|
140
|
+
let calls = new Set(entries.flatMap((x) => x.eid && !x.call ? [x.eid] : []))
|
|
141
|
+
let results = new Map<string, EntryLine>()
|
|
142
|
+
for (let x of entries) {
|
|
143
|
+
if (x.call && calls.has(x.call)) results.set(x.call, x)
|
|
144
|
+
}
|
|
145
|
+
return entries.flatMap((x) => {
|
|
146
|
+
if (x.call && calls.has(x.call)) return []
|
|
147
|
+
let out = x.eid ? results.get(x.eid) : undefined
|
|
148
|
+
return out?.eid
|
|
149
|
+
? [{ ...x, result: out.eid, row: settled(x.row, ent(out.eid)) }]
|
|
150
|
+
: [x]
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
let span = (ms: number) => {
|
|
155
|
+
let s = Math.round(ms / 1000)
|
|
156
|
+
return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
let usage = (json?: string) => {
|
|
160
|
+
if (!json) return ''
|
|
161
|
+
try {
|
|
162
|
+
let u = JSON.parse(json) as Record<string, number>
|
|
163
|
+
let up = u.input_tokens ?? 0
|
|
164
|
+
let down = u.output_tokens ?? 0
|
|
165
|
+
return [up > 0 && `↑ ${kilo(up)}`, down > 0 && `↓ ${kilo(down)}`]
|
|
166
|
+
.filter(Boolean).join(' ')
|
|
167
|
+
} catch {
|
|
168
|
+
return ''
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let bare = (line: string) => {
|
|
173
|
+
try {
|
|
174
|
+
return String((JSON.parse(line) as { type?: unknown }).type ?? '?')
|
|
175
|
+
} catch {
|
|
176
|
+
return null
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export let entryVisible = (x: EntryLine) => !!x.row || !bare(x.line)
|
|
181
|
+
|
|
182
|
+
export let ToolSummary = ({
|
|
183
|
+
name,
|
|
184
|
+
detail,
|
|
185
|
+
status,
|
|
186
|
+
error,
|
|
187
|
+
failed,
|
|
188
|
+
}: {
|
|
189
|
+
name: string
|
|
190
|
+
detail?: string
|
|
191
|
+
status?: string | null
|
|
192
|
+
error?: string
|
|
193
|
+
failed?: boolean
|
|
194
|
+
}) => {
|
|
195
|
+
let state = failed ? 'fail' : status?.startsWith('✓') ? 'success' : 'pending'
|
|
196
|
+
return (
|
|
197
|
+
<Frame mod={state}>
|
|
198
|
+
<Name>{name}</Name>
|
|
199
|
+
{detail && <Line>{detail}</Line>}
|
|
200
|
+
{status && <Status>{status}</Status>}
|
|
201
|
+
{error && <Error>{error}</Error>}
|
|
202
|
+
</Frame>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Process logs and graph entries meet at this normalized face. The Session
|
|
207
|
+
// owns ordering and inspection; an individual transcript item belongs here.
|
|
208
|
+
export let EntryBody = ({ x, repo }: { x: EntryLine; repo?: string }) => {
|
|
209
|
+
let r = x.row
|
|
210
|
+
if (!r) {
|
|
211
|
+
return bare(x.line) ? null : (
|
|
212
|
+
<Raw>
|
|
213
|
+
<Ansi text={x.line} />
|
|
214
|
+
</Raw>
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
switch (r.kind) {
|
|
218
|
+
case 'say':
|
|
219
|
+
return (
|
|
220
|
+
<Frame mod={r.role}>
|
|
221
|
+
<Speaker>{speaker(r.role)}</Speaker>
|
|
222
|
+
<Markdown text={r.text} repo={repo} />
|
|
223
|
+
</Frame>
|
|
224
|
+
)
|
|
225
|
+
case 'reason':
|
|
226
|
+
return (
|
|
227
|
+
<Reason>
|
|
228
|
+
<Ansi text={r.text} />
|
|
229
|
+
</Reason>
|
|
230
|
+
)
|
|
231
|
+
case 'tool':
|
|
232
|
+
return (
|
|
233
|
+
<ToolSummary
|
|
234
|
+
name={r.ok == null ? doing(r.name) : r.ok ? did(r.name) : r.name}
|
|
235
|
+
detail={r.detail}
|
|
236
|
+
status={r.ok == null ? '… pending' : r.ok ? '✓ done' : '✗ failed'}
|
|
237
|
+
error={r.error}
|
|
238
|
+
failed={r.ok === false}
|
|
239
|
+
/>
|
|
240
|
+
)
|
|
241
|
+
case 'exec': {
|
|
242
|
+
let fail = r.exit != null
|
|
243
|
+
? r.exit != 0
|
|
244
|
+
: r.status == 'failed' || r.status?.startsWith('✗')
|
|
245
|
+
let status = r.exit != null
|
|
246
|
+
? `${fail ? '✗' : '✓'} exit ${r.exit}`
|
|
247
|
+
: r.status ?? '… pending'
|
|
248
|
+
return (
|
|
249
|
+
<Frame
|
|
250
|
+
mod={fail ? 'fail' : status.startsWith('✓') ? 'success' : 'pending'}
|
|
251
|
+
>
|
|
252
|
+
<Name>$</Name>
|
|
253
|
+
<Line mod='command'>{first(r.command)}</Line>
|
|
254
|
+
{r.desc && r.desc != 'Command' && <Line>{r.desc}</Line>}
|
|
255
|
+
{status && <Status>{status}</Status>}
|
|
256
|
+
</Frame>
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
case 'turn':
|
|
260
|
+
return (
|
|
261
|
+
<Turn>
|
|
262
|
+
{[
|
|
263
|
+
r.model && friendly(r.model),
|
|
264
|
+
r.ms != null && span(r.ms),
|
|
265
|
+
usage(r.usage),
|
|
266
|
+
].filter(Boolean).join(' · ')}
|
|
267
|
+
</Turn>
|
|
268
|
+
)
|
|
269
|
+
case 'error':
|
|
270
|
+
return (
|
|
271
|
+
<Oops>
|
|
272
|
+
<Ansi text={r.text} />
|
|
273
|
+
</Oops>
|
|
274
|
+
)
|
|
275
|
+
case 'sys':
|
|
276
|
+
return (
|
|
277
|
+
<Sys>
|
|
278
|
+
<SysTag>{r.tag}</SysTag>
|
|
279
|
+
{r.text && (
|
|
280
|
+
<SysText>
|
|
281
|
+
<Ansi text={r.text} />
|
|
282
|
+
</SysText>
|
|
283
|
+
)}
|
|
284
|
+
{(x.n ?? 1) > 1 && <SysCount>×{x.n}</SysCount>}
|
|
285
|
+
</Sys>
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export let EntrySummary = ({ e }: { e: Ent }) => (
|
|
291
|
+
<Frame mod='meta'>
|
|
292
|
+
{Object.keys(e).filter((k) =>
|
|
293
|
+
e[k as keyof Ent] &&
|
|
294
|
+
!['eid', 'num', 'kind', 'refs', 'kids', 'entry'].includes(k)
|
|
295
|
+
).join(' · ')}
|
|
296
|
+
</Frame>
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
// Open in place: the `$ command` line stays exactly where the summary drew it,
|
|
300
|
+
// so the eye keeps its anchor; the truncated preview simply grows into the full
|
|
301
|
+
// command (wrapping) and the full output as a block below — no second card, no
|
|
302
|
+
// jump. Closed, it is the compact one-line summary as before.
|
|
303
|
+
export let CommandSummary = (
|
|
304
|
+
{ e, open, onOpen }: { e: Ent; open?: boolean; onOpen?: () => void },
|
|
305
|
+
) => {
|
|
306
|
+
let out = result(e)
|
|
307
|
+
let cmd = e.bash?.command ?? ''
|
|
308
|
+
let text = body(out ?? e) || out?.stderr?.text || ''
|
|
309
|
+
let state = out ? failed(out) ? 'fail' : 'success' : 'pending'
|
|
310
|
+
return (
|
|
311
|
+
<Frame mod={[state, open && 'open']}>
|
|
312
|
+
<Name>$</Name> <Line mod='command'>{open ? cmd : first(cmd)}</Line>
|
|
313
|
+
{text && !open && <Line>{first(text)}</Line>}
|
|
314
|
+
<Status>
|
|
315
|
+
{out ? failed(out) ? '✗ failed' : '✓ done' : '… pending'}
|
|
316
|
+
</Status>
|
|
317
|
+
{more(onOpen, [cmd, text].filter(Boolean).join('\n'), open)}
|
|
318
|
+
{open && text && (
|
|
319
|
+
<Output>
|
|
320
|
+
<Ansi text={text} />
|
|
321
|
+
</Output>
|
|
322
|
+
)}
|
|
323
|
+
</Frame>
|
|
324
|
+
)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export let ResultSummary = (
|
|
328
|
+
{ e, open, onOpen }: { e: Ent; open?: boolean; onOpen?: () => void },
|
|
329
|
+
) => {
|
|
330
|
+
let text = body(e)
|
|
331
|
+
let err = e.stderr?.text
|
|
332
|
+
return (
|
|
333
|
+
<Frame mod={[failed(e) && 'fail', open && 'open']}>
|
|
334
|
+
<Status>{e.exit?.code == null ? '↳' : `↳ exit ${e.exit.code}`}</Status>
|
|
335
|
+
{!open && (text || err) && <Line>{first(text || err)}</Line>}
|
|
336
|
+
{more(onOpen, [text, err].filter(Boolean).join('\n'), open)}
|
|
337
|
+
{open && text && (
|
|
338
|
+
<Output>
|
|
339
|
+
<Ansi text={text} />
|
|
340
|
+
</Output>
|
|
341
|
+
)}
|
|
342
|
+
{open && err && (
|
|
343
|
+
<Err mod={failed(e) && 'fail'}>
|
|
344
|
+
<Ansi text={err} />
|
|
345
|
+
</Err>
|
|
346
|
+
)}
|
|
347
|
+
</Frame>
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Progress is runtime news, not prose from the person or the model.
|
|
352
|
+
export let PendingSummary = ({ e }: { e: Ent }) => (
|
|
353
|
+
<EntryBody
|
|
354
|
+
x={{
|
|
355
|
+
seq: 0,
|
|
356
|
+
line: '',
|
|
357
|
+
row: { kind: 'sys', tag: 'pending', text: body(e) },
|
|
358
|
+
}}
|
|
359
|
+
/>
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
export let MessageSummary = ({ e }: { e: Ent }) => {
|
|
363
|
+
let repo = useRepoUrl(e)
|
|
364
|
+
return (
|
|
365
|
+
<Frame mod={said(e)}>
|
|
366
|
+
<Speaker>{source(e)}</Speaker>
|
|
367
|
+
{e.call || e.result
|
|
368
|
+
? (
|
|
369
|
+
<Code>
|
|
370
|
+
<Ansi text={body(e)} />
|
|
371
|
+
</Code>
|
|
372
|
+
)
|
|
373
|
+
: <Markdown text={body(e)} repo={repo} />}
|
|
374
|
+
</Frame>
|
|
375
|
+
)
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// Mount a folded body only after it opens: the terminal paints this same
|
|
379
|
+
// tree, but has no browser-native details layout to hide its children.
|
|
380
|
+
let FoldedMessage = ({ e, label }: { e: Ent; label: string }) => {
|
|
381
|
+
let [open, setOpen] = useState(false)
|
|
382
|
+
let n = lines(body(e)).length
|
|
383
|
+
return (
|
|
384
|
+
<Prompt
|
|
385
|
+
onToggle={(ev: Event) =>
|
|
386
|
+
setOpen((ev.currentTarget as HTMLDetailsElement).open)}
|
|
387
|
+
>
|
|
388
|
+
<Prompt.Gist>
|
|
389
|
+
{label} · {n} {n == 1 ? 'line' : 'lines'}
|
|
390
|
+
</Prompt.Gist>
|
|
391
|
+
{open && (
|
|
392
|
+
<Prompt.Body>
|
|
393
|
+
<MessageSummary e={e} />
|
|
394
|
+
</Prompt.Body>
|
|
395
|
+
)}
|
|
396
|
+
</Prompt>
|
|
397
|
+
)
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export let PromptSummary = ({ e }: { e: Ent }) => (
|
|
401
|
+
<FoldedMessage e={e} label='instructions' />
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
export let CheckpointSummary = ({ e }: { e: Ent }) => (
|
|
405
|
+
<FoldedMessage e={e} label='checkpoint' />
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
export let CommandFull = ({ e }: { e: Ent }) => {
|
|
409
|
+
return (
|
|
410
|
+
<Frame>
|
|
411
|
+
<Name>command</Name>
|
|
412
|
+
<Code>
|
|
413
|
+
$ <Ansi text={e.bash?.command ?? ''} />
|
|
414
|
+
</Code>
|
|
415
|
+
</Frame>
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export let ResultFull = ({ e }: { e: Ent }) => (
|
|
420
|
+
<Frame mod={failed(e) && 'fail'}>
|
|
421
|
+
{e.exit?.code != null && <Status>exit {e.exit.code}</Status>}
|
|
422
|
+
{body(e) && (
|
|
423
|
+
<Output>
|
|
424
|
+
<Ansi text={body(e)} />
|
|
425
|
+
</Output>
|
|
426
|
+
)}
|
|
427
|
+
{e.stderr?.text && (
|
|
428
|
+
<Err mod={failed(e) && 'fail'}>
|
|
429
|
+
<Ansi text={e.stderr.text} />
|
|
430
|
+
</Err>
|
|
431
|
+
)}
|
|
432
|
+
</Frame>
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
export let MessageFull = ({ e }: { e: Ent }) => {
|
|
436
|
+
let repo = useRepoUrl(e)
|
|
437
|
+
return (
|
|
438
|
+
<Frame mod={said(e)}>
|
|
439
|
+
<Speaker>{source(e)}</Speaker>
|
|
440
|
+
{e.call || e.result
|
|
441
|
+
? (
|
|
442
|
+
<Code>
|
|
443
|
+
<Ansi text={body(e)} />
|
|
444
|
+
</Code>
|
|
445
|
+
)
|
|
446
|
+
: <Markdown text={body(e)} repo={repo} />}
|
|
447
|
+
</Frame>
|
|
448
|
+
)
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
let icon = (view: string) =>
|
|
452
|
+
view == 'Full'
|
|
453
|
+
? 'file-text'
|
|
454
|
+
: view == 'Markdown'
|
|
455
|
+
? 'hash'
|
|
456
|
+
: view == 'JSON'
|
|
457
|
+
? 'braces'
|
|
458
|
+
: 'scan-search'
|
|
459
|
+
|
|
460
|
+
// Entry rows are not cards, but expansion has the same view choice at its
|
|
461
|
+
// top-right edge. Qualifying the ask keeps this lens in the entry vocabulary.
|
|
462
|
+
export let EntryLens = ({ eid }: { eid: string }) => {
|
|
463
|
+
let e = ent(eid)
|
|
464
|
+
let out = e.call ? result(e) : undefined
|
|
465
|
+
let call = e.result ? ent(e.result.call) : undefined
|
|
466
|
+
let pair = call ? [call, e] : out ? [e, out] : [e]
|
|
467
|
+
let full = resolve(e, 'Entry.Full').view != 'JSON'
|
|
468
|
+
let markdown = resolve(e, 'Entry.Markdown').view != 'JSON'
|
|
469
|
+
let views = [full && 'Full', markdown && 'Markdown', 'JSON', 'Debug']
|
|
470
|
+
.filter(Boolean) as string[]
|
|
471
|
+
let [view, setView] = useState(views[0])
|
|
472
|
+
return (
|
|
473
|
+
<Lens>
|
|
474
|
+
<Tabs>
|
|
475
|
+
<ui.Tabs>
|
|
476
|
+
{views.map((v) => (
|
|
477
|
+
<Tab
|
|
478
|
+
type='button'
|
|
479
|
+
key={v}
|
|
480
|
+
mod={v == view && 'on'}
|
|
481
|
+
aria-label={v == 'Markdown' ? 'MD' : v}
|
|
482
|
+
data-tip={v == 'Markdown' ? 'MD' : v}
|
|
483
|
+
onClick={() => setView(v)}
|
|
484
|
+
>
|
|
485
|
+
<Icon name={icon(v)} />
|
|
486
|
+
</Tab>
|
|
487
|
+
))}
|
|
488
|
+
</ui.Tabs>
|
|
489
|
+
</Tabs>
|
|
490
|
+
{pair.map((item) => (
|
|
491
|
+
<Part key={item.eid}>
|
|
492
|
+
{pair.length > 1 && (
|
|
493
|
+
<PartName>{item.result ? 'result' : 'call'}</PartName>
|
|
494
|
+
)}
|
|
495
|
+
<Entity eid={item.eid} view={`Entry.${view}`} />
|
|
496
|
+
</Part>
|
|
497
|
+
))}
|
|
498
|
+
</Lens>
|
|
499
|
+
)
|
|
500
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
|
|
2
|
+
import { type Ent } from '../../types.ts'
|
|
3
|
+
import { Time } from 'jsr:@yaks/ui@0.2.36'
|
|
4
|
+
import { title } from '../title.tsx'
|
|
5
|
+
|
|
6
|
+
/** The first line of a text that says something, its heading marks gone. */
|
|
7
|
+
/// firstLine('\n# Signal over noise\nJeff, verbatim') -> 'Signal over noise'
|
|
8
|
+
/// firstLine(undefined) -> ''
|
|
9
|
+
export let firstLine = (text?: string | null): string =>
|
|
10
|
+
(text ?? '').split('\n').map((l) => l.replace(/^#+\s*/, '').trim())
|
|
11
|
+
.find(Boolean) ?? ''
|
|
12
|
+
|
|
13
|
+
// What an entity is, in one line, beneath its name where a row says more than
|
|
14
|
+
// a name and less than a tile (an edge on its Full page): its kind, the first
|
|
15
|
+
// line of what it says, and when it was made. A kind says it its own way by
|
|
16
|
+
// registering its own `Gist` (a tool, the first line of what it does).
|
|
17
|
+
export let Gist = ({ e }: { e: Ent }) => {
|
|
18
|
+
let said = firstLine(e.doc?.body)
|
|
19
|
+
let at = e.created?.at
|
|
20
|
+
let parts = [
|
|
21
|
+
e.kind && <span key='kind'>{e.kind}</span>,
|
|
22
|
+
said && <span key='said' {...title(said)} />,
|
|
23
|
+
at && <Time key='at' at={at} />,
|
|
24
|
+
].filter(Boolean)
|
|
25
|
+
return parts.length
|
|
26
|
+
? <span>{parts.flatMap((p, i) => i ? [' · ', p] : [p])}</span>
|
|
27
|
+
: null
|
|
28
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
|
|
2
|
+
import { type Ent, idOf, settled, statusOf } from '../../types.ts'
|
|
3
|
+
import { crewed, gated } from '../../live.ts'
|
|
4
|
+
import * as ui from 'jsr:@yaks/ui@0.2.36'
|
|
5
|
+
import { linkProps } from '../nav.tsx'
|
|
6
|
+
import { Dot } from '../Dot.tsx'
|
|
7
|
+
import { renderView } from '../registry.ts'
|
|
8
|
+
|
|
9
|
+
// The Inline role: identify an entity in flowing content — dot for a task +
|
|
10
|
+
// truncated title, ONE anchor wearing the whole internal-link contract
|
|
11
|
+
// (nav.tsx linkProps): plain click follows, cmd/middle-click opens a new tab,
|
|
12
|
+
// right-click opens the entity menu, and dragging makes a card. `Id` is the
|
|
13
|
+
// bare chip for dense rows that need the graph id (meta lines, titlebars).
|
|
14
|
+
|
|
15
|
+
let retired = (e: Ent) => (e.project && e.archived ? 'retired' : undefined)
|
|
16
|
+
|
|
17
|
+
export let IdFace = ({ e }: { e: Ent }) => (
|
|
18
|
+
<ui.Id {...linkProps(e)} mod={retired(e)}>{idOf(e)}</ui.Id>
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
// Resolve at render time: Inline is imported while the registry is composed.
|
|
22
|
+
export let Id = ({ e }: { e: Ent }) => renderView(e, 'Id')
|
|
23
|
+
|
|
24
|
+
let Line = ui.block('a', 'Inline', { Title: 'span' })
|
|
25
|
+
let { Title } = Line
|
|
26
|
+
|
|
27
|
+
// A settled task's title is struck — the sentence says whether the entity
|
|
28
|
+
// still binds, wherever it's said (the Dependency read, now universal). The
|
|
29
|
+
// words are the entity's Title view, so a package's own (a bug's headline)
|
|
30
|
+
// names it here too; one with no title is called by its id.
|
|
31
|
+
// The literal spaces are for the TUI painter: the web's flex layout
|
|
32
|
+
// suppresses whitespace-only items and spaces via gap instead.
|
|
33
|
+
export let Inline = ({ e, dot }: { e: Ent; dot?: boolean }) => (
|
|
34
|
+
<Line {...linkProps(e)}>
|
|
35
|
+
{dot && (
|
|
36
|
+
<>
|
|
37
|
+
<Dot status={statusOf(e)} gated={gated(e)} live={crewed(e)} />
|
|
38
|
+
{' '}
|
|
39
|
+
</>
|
|
40
|
+
)}
|
|
41
|
+
<Title mod={settled(statusOf(e)) && 'settled'}>
|
|
42
|
+
{renderView(e, 'Title', { in: 'Inline' })}
|
|
43
|
+
</Title>
|
|
44
|
+
</Line>
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
export let TaskInline = ({ e }: { e: Ent }) => <Inline e={e} dot />
|
|
48
|
+
|
|
49
|
+
/** A compact session address with its lifecycle, wherever status names it. */
|
|
50
|
+
export let SessionId = ({ e }: { e: Ent }) => (
|
|
51
|
+
<>
|
|
52
|
+
<Id e={e} /> {e.session?.status ?? 'starting'}
|
|
53
|
+
</>
|
|
54
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
|
|
2
|
+
import { type Ent } from '../../types.ts'
|
|
3
|
+
import { highlight } from '../../highlight.ts'
|
|
4
|
+
import { el } from 'jsr:@yaks/ui@0.2.36'
|
|
5
|
+
|
|
6
|
+
let Pre = el('pre', 'Json')
|
|
7
|
+
|
|
8
|
+
// Any entity as raw JSON — the debugging floor; matches everything.
|
|
9
|
+
export let Json = ({ e }: { e: Ent }) => {
|
|
10
|
+
let lit = highlight(JSON.stringify(e, null, 2), 'json')
|
|
11
|
+
return (
|
|
12
|
+
<Pre>
|
|
13
|
+
<code
|
|
14
|
+
className='hljs language-json'
|
|
15
|
+
dangerouslySetInnerHTML={{ __html: lit.html }}
|
|
16
|
+
/>
|
|
17
|
+
</Pre>
|
|
18
|
+
)
|
|
19
|
+
}
|