@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.
Files changed (271) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +324 -2
  3. package/_dist/app.d.ts +8 -0
  4. package/_dist/app.d.ts.map +1 -0
  5. package/_dist/cli.d.ts +16 -0
  6. package/_dist/cli.d.ts.map +1 -0
  7. package/_dist/hosting.d.ts +24 -0
  8. package/_dist/hosting.d.ts.map +1 -0
  9. package/_dist/mod.d.ts +7 -0
  10. package/_dist/mod.d.ts.map +1 -0
  11. package/_dist/types.d.ts +5 -0
  12. package/_dist/types.d.ts.map +1 -0
  13. package/_dist/url.d.ts +2 -0
  14. package/_dist/url.d.ts.map +1 -0
  15. package/app.js +10 -0
  16. package/app.js.map +1 -0
  17. package/app.ts +10 -0
  18. package/browser-links.js +22 -0
  19. package/browser-links.js.map +1 -0
  20. package/browser-links.ts +28 -0
  21. package/cli.js +172 -0
  22. package/cli.js.map +1 -0
  23. package/cli.ts +168 -0
  24. package/client.js +748 -0
  25. package/client.js.map +1 -0
  26. package/client.ts +734 -0
  27. package/clipboard.js +18 -0
  28. package/clipboard.js.map +1 -0
  29. package/clipboard.ts +17 -0
  30. package/commands.js +1157 -0
  31. package/commands.js.map +1 -0
  32. package/commands.ts +1108 -0
  33. package/components/Ansi.tsx +160 -0
  34. package/components/App.tsx +446 -0
  35. package/components/Canvas.tsx +625 -0
  36. package/components/Card.tsx +276 -0
  37. package/components/Chat.tsx +205 -0
  38. package/components/Configuration.tsx +218 -0
  39. package/components/Decision.tsx +49 -0
  40. package/components/Dot.tsx +52 -0
  41. package/components/Entity.tsx +609 -0
  42. package/components/Fault.tsx +43 -0
  43. package/components/Filter.tsx +103 -0
  44. package/components/Keybindings.tsx +100 -0
  45. package/components/Keys.tsx +67 -0
  46. package/components/Markdown.tsx +90 -0
  47. package/components/Navigation.tsx +161 -0
  48. package/components/New.tsx +490 -0
  49. package/components/Peek.tsx +168 -0
  50. package/components/Prio.tsx +20 -0
  51. package/components/Run.tsx +263 -0
  52. package/components/Search.tsx +280 -0
  53. package/components/Stamp.tsx +44 -0
  54. package/components/Status.tsx +514 -0
  55. package/components/Sync.tsx +173 -0
  56. package/components/Tile.tsx +50 -0
  57. package/components/answered.js +23 -0
  58. package/components/answered.js.map +1 -0
  59. package/components/answered.ts +25 -0
  60. package/components/comp.js +11 -0
  61. package/components/comp.js.map +1 -0
  62. package/components/comp.ts +10 -0
  63. package/components/drag.js +173 -0
  64. package/components/drag.js.map +1 -0
  65. package/components/drag.ts +198 -0
  66. package/components/fields.tsx +90 -0
  67. package/components/fixtures/README.md +10 -0
  68. package/components/fixtures/archetypes.json +3646 -0
  69. package/components/hits.js +63 -0
  70. package/components/hits.js.map +1 -0
  71. package/components/hits.ts +84 -0
  72. package/components/icons.tsx +177 -0
  73. package/components/inspect.tsx +331 -0
  74. package/components/mount.ts +79 -0
  75. package/components/nav.tsx +479 -0
  76. package/components/offers.js +26 -0
  77. package/components/offers.js.map +1 -0
  78. package/components/offers.ts +54 -0
  79. package/components/page.js +21 -0
  80. package/components/page.js.map +1 -0
  81. package/components/page.ts +18 -0
  82. package/components/read.js +5 -0
  83. package/components/read.js.map +1 -0
  84. package/components/read.ts +7 -0
  85. package/components/registry.js +285 -0
  86. package/components/registry.js.map +1 -0
  87. package/components/registry.ts +317 -0
  88. package/components/session_status.tsx +115 -0
  89. package/components/subscriptions.js +149 -0
  90. package/components/subscriptions.js.map +1 -0
  91. package/components/subscriptions.ts +161 -0
  92. package/components/title.tsx +21 -0
  93. package/components/useQuery.js +166 -0
  94. package/components/useQuery.js.map +1 -0
  95. package/components/useQuery.ts +211 -0
  96. package/components/views/Board.tsx +450 -0
  97. package/components/views/BoardTile.tsx +65 -0
  98. package/components/views/Dashboard.tsx +148 -0
  99. package/components/views/Debug.tsx +445 -0
  100. package/components/views/Dependency.tsx +51 -0
  101. package/components/views/Entry.tsx +500 -0
  102. package/components/views/Gist.tsx +28 -0
  103. package/components/views/Inline.tsx +54 -0
  104. package/components/views/Json.tsx +19 -0
  105. package/components/views/Layout.tsx +211 -0
  106. package/components/views/List.tsx +238 -0
  107. package/components/views/Md.tsx +43 -0
  108. package/components/views/Media.tsx +48 -0
  109. package/components/views/Memory.tsx +32 -0
  110. package/components/views/Relate.tsx +205 -0
  111. package/components/views/Search.tsx +42 -0
  112. package/components/views/Session.tsx +850 -0
  113. package/components/views/SessionManage.tsx +127 -0
  114. package/components/views/Show.tsx +758 -0
  115. package/components/views/Shown.tsx +72 -0
  116. package/components/views/Split.tsx +58 -0
  117. package/components/views/TaskTile.tsx +37 -0
  118. package/components/views/Title.tsx +105 -0
  119. package/components/views/Wake.tsx +77 -0
  120. package/components/views/Web.tsx +49 -0
  121. package/components/wells.js +30 -0
  122. package/components/wells.js.map +1 -0
  123. package/components/wells.ts +33 -0
  124. package/configuration.js +38 -0
  125. package/configuration.js.map +1 -0
  126. package/configuration.ts +41 -0
  127. package/decision_sync.js +88 -0
  128. package/decision_sync.js.map +1 -0
  129. package/decision_sync.ts +93 -0
  130. package/deno.json +1 -0
  131. package/domain-host.tsx +108 -0
  132. package/edge.js +193 -0
  133. package/edge.js.map +1 -0
  134. package/edge.ts +196 -0
  135. package/entry_log.js +241 -0
  136. package/entry_log.js.map +1 -0
  137. package/entry_log.ts +214 -0
  138. package/failure.js +22 -0
  139. package/failure.js.map +1 -0
  140. package/failure.ts +34 -0
  141. package/front.json +61 -0
  142. package/highlight.js +143 -0
  143. package/highlight.js.map +1 -0
  144. package/highlight.ts +149 -0
  145. package/history.js +68 -0
  146. package/history.js.map +1 -0
  147. package/history.ts +72 -0
  148. package/host_commands.js +107 -0
  149. package/host_commands.js.map +1 -0
  150. package/host_commands.ts +38 -0
  151. package/hosting.js +53 -0
  152. package/hosting.js.map +1 -0
  153. package/hosting.ts +72 -0
  154. package/idb.js +14 -0
  155. package/idb.js.map +1 -0
  156. package/idb.ts +15 -0
  157. package/index.js +232 -0
  158. package/index.js.map +1 -0
  159. package/index.ts +252 -0
  160. package/keybindings.js +136 -0
  161. package/keybindings.js.map +1 -0
  162. package/keybindings.ts +37 -0
  163. package/kit.js +103 -0
  164. package/kit.js.map +1 -0
  165. package/kit.ts +119 -0
  166. package/layout.js +254 -0
  167. package/layout.js.map +1 -0
  168. package/layout.ts +210 -0
  169. package/legacy_outbox.js +53 -0
  170. package/legacy_outbox.js.map +1 -0
  171. package/legacy_outbox.ts +63 -0
  172. package/live.js +2883 -0
  173. package/live.js.map +1 -0
  174. package/live.ts +3334 -0
  175. package/live_archetypes.js +92 -0
  176. package/live_archetypes.js.map +1 -0
  177. package/live_archetypes.ts +113 -0
  178. package/live_client.js +145 -0
  179. package/live_client.js.map +1 -0
  180. package/live_client.ts +120 -0
  181. package/main.tsx +5 -0
  182. package/mod.js +7 -0
  183. package/mod.js.map +1 -0
  184. package/mod.ts +7 -0
  185. package/mount.tsx +50 -0
  186. package/navigation.js +120 -0
  187. package/navigation.js.map +1 -0
  188. package/navigation.ts +152 -0
  189. package/near.js +83 -0
  190. package/near.js.map +1 -0
  191. package/near.ts +83 -0
  192. package/new.js +295 -0
  193. package/new.js.map +1 -0
  194. package/new.ts +361 -0
  195. package/outbox.js +112 -0
  196. package/outbox.js.map +1 -0
  197. package/outbox.ts +129 -0
  198. package/owner.js +39 -0
  199. package/owner.js.map +1 -0
  200. package/owner.ts +37 -0
  201. package/package.json +81 -4
  202. package/paste.js +157 -0
  203. package/paste.js.map +1 -0
  204. package/paste.ts +122 -0
  205. package/props.js +303 -0
  206. package/props.js.map +1 -0
  207. package/props.ts +358 -0
  208. package/providers.js +136 -0
  209. package/providers.js.map +1 -0
  210. package/providers.ts +194 -0
  211. package/query.js +987 -0
  212. package/query.js.map +1 -0
  213. package/query.ts +1113 -0
  214. package/remote.js +37 -0
  215. package/remote.js.map +1 -0
  216. package/remote.ts +46 -0
  217. package/resolver.js +149 -0
  218. package/resolver.js.map +1 -0
  219. package/resolver.ts +213 -0
  220. package/rfc2047.js +37 -0
  221. package/rfc2047.js.map +1 -0
  222. package/rfc2047.ts +40 -0
  223. package/row_holds.js +107 -0
  224. package/row_holds.js.map +1 -0
  225. package/row_holds.ts +93 -0
  226. package/served.ts +42 -0
  227. package/session_worktree.js +7 -0
  228. package/session_worktree.js.map +1 -0
  229. package/session_worktree.ts +16 -0
  230. package/sessions.js +57 -0
  231. package/sessions.js.map +1 -0
  232. package/sessions.ts +53 -0
  233. package/sha.js +161 -0
  234. package/sha.js.map +1 -0
  235. package/sha.ts +164 -0
  236. package/styles.css +2823 -0
  237. package/subs.js +36 -0
  238. package/subs.js.map +1 -0
  239. package/subs.ts +40 -0
  240. package/terminal-route.js +13 -0
  241. package/terminal-route.js.map +1 -0
  242. package/terminal-route.ts +17 -0
  243. package/terminal.js +251 -0
  244. package/terminal.js.map +1 -0
  245. package/terminal.ts +186 -0
  246. package/time.js +142 -0
  247. package/time.js.map +1 -0
  248. package/time.ts +133 -0
  249. package/title.js +25 -0
  250. package/title.js.map +1 -0
  251. package/title.ts +50 -0
  252. package/tui/doc.ts +6 -0
  253. package/tui/testing.ts +19 -0
  254. package/twin.js +11 -0
  255. package/twin.js.map +1 -0
  256. package/twin.ts +13 -0
  257. package/types.js +456 -0
  258. package/types.js.map +1 -0
  259. package/types.ts +1370 -0
  260. package/url.js +77 -0
  261. package/url.js.map +1 -0
  262. package/url.ts +85 -0
  263. package/verb.js +82 -0
  264. package/verb.js.map +1 -0
  265. package/verb.ts +137 -0
  266. package/warmth.js +41 -0
  267. package/warmth.js.map +1 -0
  268. package/warmth.ts +54 -0
  269. package/wire.js +86 -0
  270. package/wire.js.map +1 -0
  271. package/wire.ts +63 -0
@@ -0,0 +1,115 @@
1
+ /** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
2
+ // One Session status for every browser surface: the host's, from the session
3
+ // row. Entry work is a lazy partition.
4
+ import { ent, subscriptionState, useHold } from '../live.ts'
5
+ import { type Ent, standing } from '../types.ts'
6
+ import { type EntryRow, type GraphLog, graphLog } from '../entry_log.ts'
7
+ import { Dot } from './Dot.tsx'
8
+ import { titleOf } from 'jsr:@yaks/tools@0.2.36/title'
9
+ import { useRows } from './subscriptions.ts'
10
+ import { usePage } from './useQuery.ts'
11
+
12
+ let entryRow = (e: Ent): EntryRow | undefined => {
13
+ if (!e.entry?.seq) return undefined
14
+ let {
15
+ eid,
16
+ num: _num,
17
+ kind: _kind,
18
+ refs: _refs,
19
+ kids: _kids,
20
+ ...comps
21
+ } = e
22
+ return {
23
+ eid,
24
+ seq: e.entry.seq,
25
+ comps: comps as unknown as EntryRow['comps'],
26
+ }
27
+ }
28
+
29
+ export type EntryReadState =
30
+ | { status: 'loading' }
31
+ | {
32
+ status: 'ready'
33
+ log: GraphLog
34
+ more: boolean
35
+ pending: boolean
36
+ fault?: { reason: string; reference: string; sub: string }
37
+ }
38
+ | { status: 'failed'; reason: string; reference: string; sub: string }
39
+
40
+ // A transcript names its model on each ask and its tool on each call; those
41
+ // entities are held so the log can say them in words: a tool by its English
42
+ // name (@yaks/tools `titleOf`).
43
+ let named = (rows: EntryRow[]) =>
44
+ rows.flatMap((r) =>
45
+ [r.comps.ask?.to, r.comps.call?.to].flatMap((x) => x ? [String(x)] : [])
46
+ )
47
+ let nameOf = (eid: string) => {
48
+ let e = ent(eid)
49
+ return e.model?.name ?? (e.tool ? titleOf(e.tool) : undefined)
50
+ }
51
+
52
+ export let useEntryLog = (
53
+ eid: string,
54
+ enabled = true,
55
+ limit?: number,
56
+ ): EntryReadState => {
57
+ useHold(enabled && limit == null && { entries: eid })
58
+ let base = `.entry.session=${eid}&.order=-entry.seq`
59
+ let page = usePage(
60
+ base,
61
+ `${base}&.limit=${limit ?? 0}`,
62
+ enabled && limit != null,
63
+ )
64
+ let sub = limit == null ? `entries:${eid}` : page.subscription?.sub ?? ''
65
+ let state = limit == null ? subscriptionState(sub) : page.subscription?.state
66
+ let ids = limit == null
67
+ ? state?.status == 'ready' ? [...state.eids] : []
68
+ : page.eids
69
+ let rows = enabled
70
+ ? ids.flatMap((id) => {
71
+ let row = entryRow(ent(id))
72
+ return row ? [row] : []
73
+ })
74
+ : []
75
+ useRows(named(rows))
76
+ if (!enabled) return { status: 'loading' }
77
+ if (!state || state.status == 'loading' && !ids.length) {
78
+ return { status: 'loading' }
79
+ }
80
+ let fault = state.status == 'failed'
81
+ ? { reason: state.reason, reference: state.reference, sub }
82
+ : undefined
83
+ if (fault && !ids.length) return { status: 'failed', ...fault }
84
+ return {
85
+ status: 'ready',
86
+ log: graphLog(rows, nameOf),
87
+ more: limit != null && (state.status != 'ready' || ids.length >= limit),
88
+ pending: state.status == 'loading',
89
+ ...(fault ? { fault } : {}),
90
+ }
91
+ }
92
+
93
+ // The dot's word, read O(1) — it never scans the log. The host derives a
94
+ // session's status from its transcript (pending, running, settled, stopped,
95
+ // failed); a failure facet on the session itself is authoritative over it.
96
+ export let graphStanding = (e: Ent) =>
97
+ e.failed || e.exception ? 'failed' : standing(e)
98
+
99
+ // The dot reads the session row alone: no useEntryLog subscription, so a busy
100
+ // agent's growing log costs the dot nothing (was 157ms/render).
101
+ export let SessionDot = ({ e }: { e: Ent }) => (
102
+ <Dot
103
+ status={graphStanding(e)}
104
+ />
105
+ )
106
+
107
+ // The Session view pages the transcript from its tail; its status still reads
108
+ // the same O(1) session.status as the dot, derived by the host.
109
+ export let useSessionStanding = (e: Ent, limit?: number) => {
110
+ // Every substrate reads its transcript from the same entry-partition
111
+ // subscription (T-16824): a process-backed run's JSONL is ingested into these
112
+ // entries, so there is one live read path, not a per-substrate branch.
113
+ let entries = useEntryLog(e.eid, true, limit)
114
+ return { entries, status: graphStanding(e) }
115
+ }
@@ -0,0 +1,149 @@
1
+ // View lifecycles for live query subscriptions, each a live.ts `useHold`: the
2
+ // board hook holds a board's members while a view draws them; the entity hooks
3
+ // hold ONE row (and its edges) for as long as a view paints it.
4
+ import { boardTallyLine, boardTallyName, ent, entityRead, jobOf, jobQuery, pinned, pinsOn, repoTrace, routeName, subscriptionState, useHold } from "../live.js";
5
+ import { useDerived } from "./read.js";
6
+ import { useQueryResult } from "./useQuery.js";
7
+ import { vocab } from "../types.js";
8
+ export let useBoardSub = (e)=>{
9
+ useHold(e && {
10
+ board: e
11
+ });
12
+ return useDerived(()=>{
13
+ if (!e) return undefined;
14
+ let sub = `board:${e.eid}`;
15
+ return {
16
+ sub,
17
+ state: subscriptionState(sub)
18
+ };
19
+ }, [
20
+ e?.eid
21
+ ]);
22
+ };
23
+ // The tile's half of a board: its status COUNTS, held for the tile's life and
24
+ // closed by the last one. A query edit asks the new line.
25
+ export let useBoardTally = (e)=>{
26
+ let line = e && boardTallyLine(e);
27
+ useHold(e && line && {
28
+ agg: boardTallyName(e),
29
+ line
30
+ });
31
+ };
32
+ // The entity a view PAINTS but no enclosing subscription delivers — held for
33
+ // the view's life (T-22371). The working-set boot used to walk one hop from
34
+ // every card and preseed whatever it pointed at, which is how a pinned card had
35
+ // a row to render; that hop is gone, so whatever paints another entity by eid
36
+ // SAYS so, and the row — with the `.edges` rider's edges and their far
37
+ // endpoints — streams in on mount and is evicted with the last view of it.
38
+ export let useEntity = (eid, fields)=>{
39
+ useHold(eid && {
40
+ entity: eid,
41
+ fields
42
+ });
43
+ return useDerived(()=>eid ? entityRead(eid, fields) : undefined, [
44
+ eid,
45
+ fields
46
+ ]);
47
+ };
48
+ // The cards on a canvas, held while a view draws them.
49
+ export let usePinned = (canvas)=>{
50
+ useHold(!!canvas && {
51
+ query: pinsOn(canvas)
52
+ });
53
+ return useDerived(()=>pinned(canvas), [
54
+ canvas
55
+ ]);
56
+ };
57
+ // The task a session is on, held while a view draws it.
58
+ export let useJob = (e)=>{
59
+ useHold(!!e.session && {
60
+ query: jobQuery(e.eid)
61
+ });
62
+ return useDerived(()=>jobOf(e), [
63
+ e
64
+ ]);
65
+ };
66
+ // The rows of a LIST of entities, in one sub (live.ts rowsSub), never their
67
+ // edges; the joined key means a re-render that moves nothing re-subscribes
68
+ // nothing.
69
+ export let useRows = (eids)=>useHold(eids.length > 0 && {
70
+ rows: eids
71
+ });
72
+ // The canvas List face paints a pin's target without mounting a Card, so it
73
+ // holds it here.
74
+ export let usePinTargets = (ps)=>useRows(ps.map((p)=>p.target));
75
+ // Ref columns are not edge peers. Ask for the small face, not its document,
76
+ // transcript or incident edges; several visible chips share this query.
77
+ export let useReference = (eid)=>{
78
+ let fields = [
79
+ 'doc.title',
80
+ 'client.user_agent',
81
+ 'session.id'
82
+ ].filter((field)=>{
83
+ let [comp, prop] = field.split('.');
84
+ return vocab.prop(comp, prop);
85
+ }).join(',');
86
+ let read = useEntity(eid, fields || 'entity.eid');
87
+ return {
88
+ ...read,
89
+ value: useDerived(()=>eid && read?.loaded(eid, 'doc', 'title') ? read.value : undefined, [
90
+ eid,
91
+ read
92
+ ])
93
+ };
94
+ };
95
+ // The newest input chooses the next model. An adopted session may hold its
96
+ // starting choice itself; a spawned one's is on its first entry.
97
+ // The model a session asks now, by name, and the using{provider, model,
98
+ // effort} in force: the newest line that asked for a turn. A line sent with
99
+ // no choice of its own carries that using, as `yak session send` does, since
100
+ // a line asks for a turn by carrying one (@yaks/session `session_run`).
101
+ export let useModel = (e)=>{
102
+ let latest = useQueryResult(e.session && vocab.prop('entry', 'session') && vocab.comp('using') && vocab.comp('ask') ? `.entry.session=${e.eid}&.using&!ask&.order=-entry.seq&.limit=1&.fields=using.provider,using.model,using.effort` : '', !!e.session, true).eids[0];
103
+ let using = useDerived(()=>(latest ? ent(latest).using : undefined) ?? e.using, [
104
+ latest,
105
+ e.using
106
+ ]);
107
+ let model = using?.model;
108
+ useEntity(model, 'model.name');
109
+ let name = useDerived(()=>model ? ent(model).model?.name ?? undefined : undefined, [
110
+ model
111
+ ]);
112
+ return {
113
+ name,
114
+ effort: using?.effort ?? undefined,
115
+ using: using?.provider ? {
116
+ provider: using.provider,
117
+ ...model ? {
118
+ model
119
+ } : {},
120
+ ...using.effort ? {
121
+ effort: using.effort
122
+ } : {}
123
+ } : undefined
124
+ };
125
+ };
126
+ // Ownership is a changing path, not a cache assumption. useHold keeps common
127
+ // hops held while discovering the next ones, and releases only hops no longer
128
+ // used.
129
+ let repoFields = 'repo.url,filed.project,comment.target,' + 'session.actor,memory.scope,entry.session';
130
+ export let useRepoUrl = (e)=>{
131
+ let fields = repoFields.split(',').filter((field)=>{
132
+ let [comp, prop] = field.split('.');
133
+ return vocab.prop(comp, prop);
134
+ }).join(',');
135
+ let trace = useDerived(()=>vocab.prop('repo', 'url') ? repoTrace(ent(e.eid)) : {
136
+ eids: [],
137
+ url: undefined
138
+ }, [
139
+ e.eid
140
+ ]);
141
+ let holds = trace.eids.map((eid)=>({
142
+ entity: eid,
143
+ fields: fields || 'entity.eid'
144
+ }));
145
+ for (let h of holds)subscriptionState(routeName(h.entity, h.fields));
146
+ useHold(...holds);
147
+ return trace.url;
148
+ };
149
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sources":["./subscriptions.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,+EAA+E;AAC/E,gEAAgE;AAChE,SACE,cAAc,EACd,cAAc,EACd,GAAG,EACH,UAAU,EACV,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,EAET,iBAAiB,EACjB,OAAO,qBACU;AACnB,SAAS,UAAU,oBAAmB;AACtC,SAAS,cAAc,wBAAuB;AAC9C,SAAgC,KAAK,sBAAqB;AAE1D,OAAO,IAAI,cAAc,CAAC;EACxB,QAAQ,KAAK;IAAE,OAAO;EAAE;EACxB,OAAO,WAAW;IAChB,IAAI,CAAC,GAAG,OAAO;IACf,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE;IAC1B,OAAO;MAAE;MAAK,OAAO,kBAAkB;IAAK;EAC9C,GAAG;IAAC,GAAG;GAAI;AACb,EAAC;AAED,8EAA8E;AAC9E,0DAA0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AG,MAAM,KAAK,CAAC;IAC/B,OAAO,MAAM,IAAI,CAAC,MAAM;EAC1B,GAAG,IAAI,CAAC;EACR,IAAI,QAAQ,WACV,IACE,MAAM,IAAI,CAAC,QAAQ,SACf,UAAU,IAAI,EAAE,GAAG,KACnB;MAAE,MAAM,EAAE;MAAE,KAAK;IAAU,GACjC;IAAC,EAAE,GAAG;GAAC;EAET,IAAI,QAAQ,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,MAAQ,CAAC;MACnC,QAAQ;MACR,QAAQ,UAAU;IACpB,CAAC;EACD,KAAK,IAAI,KAAK,MAAO,kBAAkB,UAAU,EAAE,MAAM,EAAE,EAAE,MAAM;EACnE,WAAW;EACX,OAAO,MAAM,GAAG;AAClB,EAAC"}
@@ -0,0 +1,161 @@
1
+ // View lifecycles for live query subscriptions, each a live.ts `useHold`: the
2
+ // board hook holds a board's members while a view draws them; the entity hooks
3
+ // hold ONE row (and its edges) for as long as a view paints it.
4
+ import {
5
+ boardTallyLine,
6
+ boardTallyName,
7
+ ent,
8
+ entityRead,
9
+ jobOf,
10
+ jobQuery,
11
+ pinned,
12
+ pinsOn,
13
+ repoTrace,
14
+ routeName,
15
+ type SubscriptionRead,
16
+ subscriptionState,
17
+ useHold,
18
+ } from '../live.js'
19
+ import { useDerived } from './read.js'
20
+ import { useQueryResult } from './useQuery.js'
21
+ import { type Ent, type Pinned, vocab } from '../types.js'
22
+
23
+ export let useBoardSub = (e?: Ent): SubscriptionRead | undefined => {
24
+ useHold(e && { board: e })
25
+ return useDerived(() => {
26
+ if (!e) return undefined
27
+ let sub = `board:${e.eid}`
28
+ return { sub, state: subscriptionState(sub) }
29
+ }, [e?.eid])
30
+ }
31
+
32
+ // The tile's half of a board: its status COUNTS, held for the tile's life and
33
+ // closed by the last one. A query edit asks the new line.
34
+ export let useBoardTally = (e?: Ent) => {
35
+ let line = e && boardTallyLine(e)
36
+ useHold(e && line && { agg: boardTallyName(e), line })
37
+ }
38
+
39
+ // The entity a view PAINTS but no enclosing subscription delivers — held for
40
+ // the view's life (T-22371). The working-set boot used to walk one hop from
41
+ // every card and preseed whatever it pointed at, which is how a pinned card had
42
+ // a row to render; that hop is gone, so whatever paints another entity by eid
43
+ // SAYS so, and the row — with the `.edges` rider's edges and their far
44
+ // endpoints — streams in on mount and is evicted with the last view of it.
45
+ export let useEntity = (eid?: string | null, fields?: string) => {
46
+ useHold(eid && { entity: eid, fields })
47
+ return useDerived(() => eid ? entityRead(eid, fields) : undefined, [
48
+ eid,
49
+ fields,
50
+ ])
51
+ }
52
+
53
+ // The cards on a canvas, held while a view draws them.
54
+ export let usePinned = (canvas: string): Pinned[] => {
55
+ useHold(!!canvas && { query: pinsOn(canvas) })
56
+ return useDerived(() => pinned(canvas), [canvas])
57
+ }
58
+
59
+ // The task a session is on, held while a view draws it.
60
+ export let useJob = (e: Ent): string | null => {
61
+ useHold(!!e.session && { query: jobQuery(e.eid) })
62
+ return useDerived(() => jobOf(e), [e])
63
+ }
64
+
65
+ // The rows of a LIST of entities, in one sub (live.ts rowsSub), never their
66
+ // edges; the joined key means a re-render that moves nothing re-subscribes
67
+ // nothing.
68
+ export let useRows = (eids: string[]) =>
69
+ useHold(eids.length > 0 && { rows: eids })
70
+
71
+ // The canvas List face paints a pin's target without mounting a Card, so it
72
+ // holds it here.
73
+ export let usePinTargets = (ps: { target: string }[]) =>
74
+ useRows(ps.map((p) => p.target))
75
+
76
+ // Ref columns are not edge peers. Ask for the small face, not its document,
77
+ // transcript or incident edges; several visible chips share this query.
78
+ export let useReference = (eid?: string | null) => {
79
+ let fields = ['doc.title', 'client.user_agent', 'session.id'].filter(
80
+ (field) => {
81
+ let [comp, prop] = field.split('.')
82
+ return vocab.prop(comp, prop)
83
+ },
84
+ ).join(',')
85
+ let read = useEntity(eid, fields || 'entity.eid')
86
+ return {
87
+ ...read,
88
+ value: useDerived(
89
+ () => eid && read?.loaded(eid, 'doc', 'title') ? read.value : undefined,
90
+ [eid, read],
91
+ ),
92
+ }
93
+ }
94
+
95
+ // The newest input chooses the next model. An adopted session may hold its
96
+ // starting choice itself; a spawned one's is on its first entry.
97
+ // The model a session asks now, by name, and the using{provider, model,
98
+ // effort} in force: the newest line that asked for a turn. A line sent with
99
+ // no choice of its own carries that using, as `yak session send` does, since
100
+ // a line asks for a turn by carrying one (@yaks/session `session_run`).
101
+ export let useModel = (e: Ent): {
102
+ name?: string
103
+ effort?: string
104
+ using?: { provider: string; model?: string; effort?: string }
105
+ } => {
106
+ let latest = useQueryResult(
107
+ e.session && vocab.prop('entry', 'session') && vocab.comp('using') &&
108
+ vocab.comp('ask')
109
+ ? `.entry.session=${e.eid}&.using&!ask&.order=-entry.seq&.limit=1&.fields=using.provider,using.model,using.effort`
110
+ : '',
111
+ !!e.session,
112
+ true,
113
+ ).eids[0]
114
+ let using = useDerived(
115
+ () => (latest ? ent(latest).using : undefined) ?? e.using,
116
+ [latest, e.using],
117
+ )
118
+ let model = using?.model
119
+ useEntity(model, 'model.name')
120
+ let name = useDerived(
121
+ () => model ? ent(model).model?.name ?? undefined : undefined,
122
+ [model],
123
+ )
124
+ return {
125
+ name,
126
+ effort: using?.effort ?? undefined,
127
+ using: using?.provider
128
+ ? {
129
+ provider: using.provider,
130
+ ...(model ? { model } : {}),
131
+ ...(using.effort ? { effort: using.effort } : {}),
132
+ }
133
+ : undefined,
134
+ }
135
+ }
136
+
137
+ // Ownership is a changing path, not a cache assumption. useHold keeps common
138
+ // hops held while discovering the next ones, and releases only hops no longer
139
+ // used.
140
+ let repoFields = 'repo.url,filed.project,comment.target,' +
141
+ 'session.actor,memory.scope,entry.session'
142
+ export let useRepoUrl = (e: Ent): string | undefined => {
143
+ let fields = repoFields.split(',').filter((field) => {
144
+ let [comp, prop] = field.split('.')
145
+ return vocab.prop(comp, prop)
146
+ }).join(',')
147
+ let trace = useDerived(
148
+ () =>
149
+ vocab.prop('repo', 'url')
150
+ ? repoTrace(ent(e.eid))
151
+ : { eids: [], url: undefined },
152
+ [e.eid],
153
+ )
154
+ let holds = trace.eids.map((eid) => ({
155
+ entity: eid,
156
+ fields: fields || 'entity.eid',
157
+ }))
158
+ for (let h of holds) subscriptionState(routeName(h.entity, h.fields))
159
+ useHold(...holds)
160
+ return trace.url
161
+ }
@@ -0,0 +1,21 @@
1
+ /** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
2
+ // The written face of a doc title: inline markdown while reading, its source
3
+ // while editing. Most title faces are already links, so the title's own links,
4
+ // images and ids flatten to their words rather than nesting interactive
5
+ // content.
6
+ import { Edit } from 'jsr:@yaks/ux@0.2.36'
7
+ import { ent } from '../live.ts'
8
+ import { markup } from './Markdown.tsx'
9
+ import { bundle } from './registry.ts'
10
+ import { type Ent, idOf } from '../types.ts'
11
+
12
+ export let title = (text: string) => ({ children: markup(text, null, true) })
13
+
14
+ /** A document's `Title` view in Browse: its title's inline markdown, read. */
15
+ export let TitleText = ({ e }: { e: Ent }) => (
16
+ <span {...title(e.doc?.title || idOf(e))} />
17
+ )
18
+
19
+ export let TitleEdit = ({ eid }: { eid: string }) => (
20
+ <Edit.Text e={bundle(ent(eid))} comp='doc' prop='title' inline />
21
+ )
@@ -0,0 +1,166 @@
1
+ // The reactive query hook — the door a component uses to ask "which entities
2
+ // match this query", in place of `Object.values(cache.value).filter` (T-17036,
3
+ // the 16ms frame budget). It parses the query once, holds a NARROW result
4
+ // signal for the component's life (releasing it on unmount), and reads it — so
5
+ // the component re-renders only when its RESULT changes, never on an unrelated
6
+ // patch. The query is the query.ts filter grammar boards and graph_query speak
7
+ // (`.task.status=open`, `.deliver.to=S-31`, …); references resolve to eids at
8
+ // parse.
9
+ //
10
+ // The signal's backing is the store-agnostic seam (live.ts queryEids): today an
11
+ // in-memory index, tomorrow an IDB indexed cursor — the call site never
12
+ // changes (T-17046).
13
+ /* @ts-types="npm:@types/react@19.3.0" */ import { useLayoutEffect, useMemo, useRef } from "react";
14
+ import { ent, findEid, linksVia, loaded, problem, queryEids, querySubscription, useHold } from "../live.js";
15
+ import { parseQuery, resolveRefs } from "../query.js";
16
+ import { vocab } from "../types.js";
17
+ import { useDerived } from "./read.js";
18
+ // A query that does not parse fails where it was asked, never in the render
19
+ // around it: the hook reports it once and answers a failed read, so the view
20
+ // that asked paints its own failure and the rest of the page paints whole. A
21
+ // refused `.chat.actor=` in the chat once blanked every entity page, and a
22
+ // board's saved query is typed by a person.
23
+ let resolve = (query)=>{
24
+ try {
25
+ return resolveRefs(parseQuery(query), findEid);
26
+ } catch (error) {
27
+ return error instanceof Error ? error : new Error(String(error));
28
+ }
29
+ };
30
+ let usePreds = (query)=>{
31
+ let preds = useMemo(()=>resolve(query), [
32
+ query
33
+ ]);
34
+ useLayoutEffect(()=>{
35
+ if (!(preds instanceof Error)) return;
36
+ console.error(`query ${JSON.stringify(query)}:`, preds);
37
+ problem.value = `query could not be read: ${preds.message}`;
38
+ }, [
39
+ preds
40
+ ]);
41
+ return preds;
42
+ };
43
+ let refused = (query, error)=>({
44
+ eids: [],
45
+ subscription: {
46
+ sub: '',
47
+ state: {
48
+ status: 'failed',
49
+ reason: error.message,
50
+ reference: query
51
+ }
52
+ },
53
+ ready: true,
54
+ loaded
55
+ });
56
+ // Windowed/server-owned callers opt into the authored line: re-serializing
57
+ // bound predicates can decline valid grammar (edge riders, time comparisons,
58
+ // reverse hops) into a local cache scan. Legacy local callers keep that path.
59
+ // The result and addressed read state of one direct query. Most callers need
60
+ // only eids; query-driven UI also consumes a refusal so it never paints a
61
+ // local partial set as the server's answer.
62
+ export let useQueryResult = (query, enabled = true, direct = false)=>{
63
+ // A disabled read asks nothing, so its line is never read: one built from
64
+ // what is not there yet (an empty id list) must not fail the view.
65
+ let preds = usePreds(enabled ? query : '');
66
+ let source = direct ? query : undefined;
67
+ useHold(enabled && !(preds instanceof Error) && {
68
+ query: preds,
69
+ source
70
+ });
71
+ return useDerived(()=>{
72
+ if (preds instanceof Error) return refused(query, preds);
73
+ let subscription = enabled ? querySubscription(preds, source) : undefined;
74
+ return {
75
+ eids: enabled ? queryEids(preds).value : [],
76
+ subscription,
77
+ ready: !subscription || subscription.state.status == 'ready',
78
+ loaded
79
+ };
80
+ }, [
81
+ query,
82
+ preds,
83
+ source,
84
+ enabled
85
+ ]);
86
+ };
87
+ // A window the reader grows by scrolling, a page at a time: a board's list, a
88
+ // board's column. `line` asks for the first rows of `base`, and growing the
89
+ // window asks the server a new line, whose answer takes a round trip. Until it
90
+ // lands, the rows the smaller window answered stay, so the next page appends
91
+ // under the reader instead of the list emptying and repainting from the top.
92
+ // A different base starts from nothing: its rows are another list's.
93
+ export let usePage = (base, line, enabled = true)=>{
94
+ let page = useQueryResult(line, enabled, true);
95
+ let shown = useRef(undefined);
96
+ if (page.ready) shown.current = {
97
+ base,
98
+ eids: page.eids
99
+ };
100
+ let kept = shown.current?.base == base ? shown.current.eids : undefined;
101
+ return page.ready || !kept ? page : {
102
+ ...page,
103
+ eids: kept
104
+ };
105
+ };
106
+ // The matching eids, as a live array. Prefer this when the caller only needs
107
+ // ids (membership, a count); `useQuery` assembles the Ents.
108
+ export let useQueryEids = (query, direct = false)=>useQueryResult(query, true, direct).eids;
109
+ // The matching entities, assembled. Each rides its own `row` signal, so the
110
+ // list re-renders on membership change and each row on its own edits.
111
+ export let useQuery = (query, direct = false)=>{
112
+ let eids = useQueryEids(query, direct);
113
+ return useDerived(()=>eids.map(ent), [
114
+ eids
115
+ ]);
116
+ };
117
+ // The open card's reverse lists (T-21489), held for the view's life. Each is an
118
+ // EID-KEYED server sub — "comments aimed at X", "entities referencing X" — so
119
+ // the set is complete even when the cache is partial (a referrer outside the
120
+ // working set still counts, T-18094), opened on mount and torn down with the
121
+ // last unmount: cards accumulate no subs as they open and close. The plain
122
+ // live.ts backlinks door reads locally from the rows a mounted view holds;
123
+ // it never opens an unowned server subscription.
124
+ export let useCommentsOn = (target)=>useQuery(vocab.prop('comment', 'target') ? `.comment.target=${target}` : '').slice().sort((a, b)=>a.num - b.num);
125
+ // The commits landed for an entity — the structured rows that sit in the
126
+ // same rail as its comments (M-31946 §7). `commit` is @yaks/git's, so a graph
127
+ // without that plugin has none to ask for: the query would name a component
128
+ // its vocabulary lacks. The vocabulary is loaded before this module runs
129
+ // (types.ts), so the choice is made once.
130
+ export let useCommitsOn = (target)=>useQuery(vocab.prop('commit', 'target') ? `.commit.target=${target}` : '').slice().sort((a, b)=>a.num - b.num);
131
+ // `via` — WHICH column points here — reads off each referrer's own row signal
132
+ // (linksVia), so a retarget wakes the face without a membership change.
133
+ let backlinkComps = ()=>[
134
+ ...new Set(vocab.refProps().map(([comp])=>comp))
135
+ ].map((comp)=>`&?${comp}`).join('');
136
+ /** How many referrers a view holds: the newest. A project, a person or a long
137
+ * session is referenced tens of thousands of times, and every referrer comes
138
+ * with each of its reference components, so the whole set is a read that runs
139
+ * for seconds and a page no one can scroll. The rest is the inspector's
140
+ * `.refs=<id>`. */ export let BACKLINKS = 200;
141
+ /** What points at `target`, by which property, and whether there may be more
142
+ * than the window holds. */ export let useBacklinks = (target)=>{
143
+ let from = useQueryEids(`.refs=${target}${backlinkComps()}&.limit=${BACKLINKS}`);
144
+ return {
145
+ links: useDerived(()=>from.flatMap((eid)=>linksVia(eid, target)), [
146
+ from,
147
+ target
148
+ ]),
149
+ more: from.length >= BACKLINKS
150
+ };
151
+ };
152
+ // EID-keyed lookups belong to the mounted view, never an unheld render read.
153
+ export let useBoardsOver = (target)=>useQueryEids(vocab.prop('board', 'query') ? `.board.query~=${target}` : '');
154
+ export let useChatFor = (actor, target)=>{
155
+ let [eid] = useQueryResult(actor && vocab.prop('chat', 'actor') && vocab.prop('chat', 'target') ? `.chat.actor=${actor}&.chat.target=${target}` : '', !!actor && !!vocab.prop('chat', 'actor') && !!vocab.prop('chat', 'target')).eids;
156
+ return useDerived(()=>eid ? ent(eid) : undefined, [
157
+ eid
158
+ ]);
159
+ };
160
+ // The comments a session's transcript cites: those the session, or one of its
161
+ // entries, holds an edge to. A comment delivered to a graph-native session is
162
+ // cited, not said, so this is how its thread hears a comment on whatever the
163
+ // session works on. Edges are entities, so this is an ordinary row query.
164
+ let citedLine = (session)=>vocab.prop('comment', 'target') && vocab.prop('edge', 'to') && vocab.prop('entry', 'session') ? `.comment&(.edges_to.edge.from=${session}|.edges_to.edge.from.entry.session=${session})` : '';
165
+ export let useCitedComments = (session)=>useQuery(citedLine(session), true).slice().sort((a, b)=>a.num - b.num);
166
+ //# sourceMappingURL=useQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQuery.js","sources":["./useQuery.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+EAA+E;AAC/E,0EAA0E;AAC1E,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,SAAS;AACT,EAAE;AACF,gFAAgF;AAChF,wEAAwE;AACxE,qBAAqB;AACrB,uCAAuC,GAAG,SAAS,eAAe,EAAE,OAAO,EAAE,MAAM,gBAA0B;AAC7G,SAEE,GAAG,EACH,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,iBAAiB,EAEjB,OAAO,qBACU;AACnB,SAAS,UAAU,EAAa,WAAW,sBAAqB;AAChE,SAAmB,KAAK,sBAAqB;AAE7C,SAAS,UAAU,oBAAmB;AAEtC,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,4CAA4C;AAC5C,IAAI,UAAU,CAAC;EACb,IAAI;IACF,OAAO,YAAY,WAAW,QAAQ;EACxC,EAAE,OAAO,OAAO;IACd,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO;EAC3D;AACF;AAEA,IAAI,WAAW,CAAC;EACd,IAAI,QAAQ,QAAQ,IAAM,QAAQ,QAAQ;IAAC;GAAM;EACjD,gBAAgB;IACd,IAAI,CAAC,CAAC,iBAAiB,KAAK,GAAG;IAC/B,QAAQ,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,SAAS,CA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