@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,609 @@
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 { createContext, useContext } from 'npm:react@19.3.0'
3
+ import '../domain-host.tsx'
4
+ import { views as commentViews } from 'jsr:@yaks/kernel@0.2.36/component-views'
5
+ import { domainBundle } from '../domain-host.tsx'
6
+ import { inspectViews } from './inspect.tsx'
7
+ import { views as secretViews } from 'jsr:@yaks/secrets@0.2.36/views'
8
+ import { views as connectionViews } from 'jsr:@yaks/connections@0.2.36/views'
9
+ import { views as genericViews } from 'jsr:@yaks/render@0.2.36/views'
10
+ // The curated views and verbs, with the app's quarantine, failure and memo
11
+ // boundaries.
12
+ // @yaks/render selects them and React mounts the selected component.
13
+ /* @ts-types="npm:@types/react@19.3.0" */ import { memo } from 'npm:react@19.3.0'
14
+ import { and, parse } from 'jsr:@yaks/query@0.2.36'
15
+ import { statusChanges, subChanges } from '../client.ts'
16
+ import { Fault } from './Fault.tsx'
17
+ import { ent, mutate, myActor, myMode, reveal, rows, shown } from '../live.ts'
18
+ import { type Ent, idOf, statusOf, vocab } from '../types.ts'
19
+ import { navigate } from './nav.tsx'
20
+ import { type Action, define, defineActions, renderView } from './registry.ts'
21
+ import { useDerived } from './read.ts'
22
+ import {
23
+ Acceptance,
24
+ Boards,
25
+ Body,
26
+ CardFull,
27
+ CommentDependencies,
28
+ Dependencies,
29
+ FullTitle,
30
+ Mail,
31
+ Meta,
32
+ Relate,
33
+ Runs,
34
+ Show,
35
+ Similar,
36
+ Talkback,
37
+ Tasks,
38
+ } from './views/Show.tsx'
39
+ import {
40
+ AnyTitle,
41
+ BoardTitle,
42
+ DocTitle,
43
+ SessionBarTitle,
44
+ SessionTitle,
45
+ TaskTitle,
46
+ WebTitle,
47
+ } from './views/Title.tsx'
48
+ import { Board } from './views/Board.tsx'
49
+ import { Split } from './views/Split.tsx'
50
+ import { SessionDot } from './session_status.tsx'
51
+ import { SearchTile } from './views/Search.tsx'
52
+ import { Layout } from './views/Layout.tsx'
53
+ import { Dashboard } from './views/Dashboard.tsx'
54
+ import { Conversation } from './Chat.tsx'
55
+ import { MemoryTile } from './views/Memory.tsx'
56
+ import { TaskTile } from './views/TaskTile.tsx'
57
+ import { BoardMeta, BoardTile } from './views/BoardTile.tsx'
58
+ import { BoardList, List, ListEntry, ListTile } from './views/List.tsx'
59
+ import { Canvas } from './Canvas.tsx'
60
+ import { IdFace, Inline, SessionId, TaskInline } from './views/Inline.tsx'
61
+ import { Dependency } from './views/Dependency.tsx'
62
+ import { Gist } from './views/Gist.tsx'
63
+ import {
64
+ Debug,
65
+ DebugAnyItem,
66
+ DebugTaskItem,
67
+ ProjectDebug,
68
+ } from './views/Debug.tsx'
69
+ import { Json } from './views/Json.tsx'
70
+ import { Md, mdText } from './views/Md.tsx'
71
+ import { Web } from './views/Web.tsx'
72
+ import { Media } from './views/Media.tsx'
73
+ import { ShownImage, ShownPage, ShownProse } from './views/Shown.tsx'
74
+ import { Session, SessionRow } from './views/Session.tsx'
75
+ import {
76
+ CheckpointSummary,
77
+ CommandFull,
78
+ CommandSummary,
79
+ EntrySummary,
80
+ MessageFull,
81
+ MessageSummary,
82
+ PendingSummary,
83
+ PromptSummary,
84
+ ResultFull,
85
+ ResultSummary,
86
+ } from './views/Entry.tsx'
87
+ import { Wake, WakeTitle } from './views/Wake.tsx'
88
+ import { openRun } from './Run.tsx'
89
+ import { viaName } from 'jsr:@yaks/kernel@0.2.36/Comments'
90
+ import { Button, el } from 'jsr:@yaks/ui@0.2.36'
91
+ import { Ux } from 'jsr:@yaks/ux@0.2.36'
92
+ import { favoriteChange, favoriteLabel, newPath } from '../navigation.ts'
93
+ import { TitleText } from './title.tsx'
94
+
95
+ // Convenience re-exports: Entity.tsx is the front door, registry.ts the
96
+ // engine room — importers of either get the same bindings.
97
+ export { applicable, extend, has, type Renderer, resolve } from './registry.ts'
98
+
99
+ // The CURATED registry — every view the app can render, one list, in
100
+ // priority order (a score tie goes to the earlier entry). The machinery
101
+ // lives in registry.ts, so this file is exactly: the list and the Entity
102
+ // component (the drag payload lives in drag.ts — views import it, so it
103
+ // must never live here where the whole list would ride along). Adding a
104
+ // view = a file under views/,
105
+ // an entry here, and — if it should appear as a card tab — a name in the
106
+ // tabs list plus an icon in Card.tsx. A package's views come from its
107
+ // `./views` facet instead (inspect.tsx `contribute`), its tabs ahead of these.
108
+ define([
109
+ ...inspectViews,
110
+ { view: 'Search.Tile', match: and(), Render: SearchTile },
111
+ { view: 'Status', match: parse('.session'), Render: SessionDot },
112
+ // Canvas and List render child entities through this registry. Defer their
113
+ // bindings until render so either module can be imported first.
114
+ {
115
+ plugin: 'canvas',
116
+ view: 'Canvas',
117
+ match: parse('.canvas'),
118
+ Render: ({ e }) => <Canvas eid={e.eid} />,
119
+ },
120
+ {
121
+ plugin: 'canvas',
122
+ view: 'List',
123
+ match: parse('.canvas'),
124
+ Render: (props) => <List {...props} />,
125
+ },
126
+ {
127
+ view: 'List',
128
+ match: parse('.board'),
129
+ Render: (props) => <BoardList {...props} />,
130
+ },
131
+ ...secretViews.renderers,
132
+ ...connectionViews.renderers,
133
+ // A package's own Title (a bug's headline) wins: it is as specific or more,
134
+ // and the views packages offer are overlaid ahead of these.
135
+ { view: 'Title', match: parse('.doc.title'), Render: TitleText },
136
+ ...genericViews.renderers.filter((r) => r.view == 'Title'),
137
+ ...commentViews.renderers.map((r) => ({
138
+ ...r,
139
+ Render: ({ e, ...ctx }: { e: Ent }) => (
140
+ <r.Render {...ctx} e={domainBundle(e)} />
141
+ ),
142
+ })),
143
+ {
144
+ view: 'Feed.List.Tile',
145
+ match: and(),
146
+ Render: (props) => <ListEntry {...props} />,
147
+ },
148
+ { view: 'Tile', match: parse('.memory'), Render: MemoryTile },
149
+ // TaskTile walks back through Entity for its Meta row; defer the binding
150
+ // for the same reason as Canvas above.
151
+ {
152
+ view: 'Tile',
153
+ match: parse('.doc .task'),
154
+ Render: (props) => <TaskTile {...props} />,
155
+ },
156
+ { view: 'Tile', match: parse('.doc .board'), Render: BoardTile },
157
+ { view: 'Tile', match: parse('.session'), Render: SessionRow },
158
+ {
159
+ view: 'Tile',
160
+ match: parse('.entry .content .tool_progress'),
161
+ Render: PendingSummary,
162
+ },
163
+ // Words said in a transcript are a passage in a list (@yaks/session's
164
+ // views), never the message whole.
165
+ { view: 'Tile', match: and(), Render: (props) => <ListTile {...props} /> },
166
+ { view: 'Wake', match: parse('.wake'), Render: Wake },
167
+ { view: 'Session', match: parse('.session'), Render: Session },
168
+ { view: 'Media', match: parse('.artifact'), Render: Media },
169
+ // What a decision's choice shows (Decision.tsx), by what it is; anything
170
+ // else is its gist.
171
+ { view: 'Shown', match: parse('.artifact'), Render: ShownImage },
172
+ { view: 'Shown', match: parse('.attachment'), Render: ShownImage },
173
+ { view: 'Shown', match: parse('.web'), Render: ShownPage },
174
+ { view: 'Shown', match: parse('.doc'), Render: ShownProse },
175
+ { view: 'Shown', match: and(), Render: Gist },
176
+ { view: 'Full', match: parse('.session'), Render: Session },
177
+ { view: 'Full', match: parse('.decision'), Render: Show },
178
+ { view: 'Full', match: parse('.doc'), Render: Show },
179
+ { view: 'Card.Full', match: parse('.doc'), Render: CardFull },
180
+ // Every entity has a Full page, the same one: its title, its meta, its
181
+ // body, its relationships and its comments, each drawn by the entity's own
182
+ // renderer (a tool's name and description, an effect's triggers), so the
183
+ // inspector's generic page is a tab, never what a person lands on.
184
+ { view: 'Full', match: and(), Render: Show },
185
+ { view: 'Card.Full', match: and(), Render: CardFull },
186
+ // A document's title and body on its Full page, typed over where they
187
+ // stand. Here rather than as its `Title` and `Body`, which a configured
188
+ // package's portable reading (@yaks/doc's) outranks: that one reads, and
189
+ // Full is where a document is written. A kind that says its body its own
190
+ // way registers its own `Full.Body` (a persona's, its documents).
191
+ { view: 'Full.Title', match: parse('.doc'), Render: FullTitle },
192
+ { view: 'Full.Body', match: parse('.doc'), Render: Body },
193
+ { view: 'Board', match: parse('.doc .board'), Render: Board },
194
+ // The two-pane view: list left, opened entity right. A view of anything
195
+ // with a list face (a board/project, or a canvas), never a default face —
196
+ // it sits after Board/List in the tabs list so it is a chosen tab.
197
+ {
198
+ view: 'Split',
199
+ match: parse('.board'),
200
+ Render: Split,
201
+ },
202
+ { plugin: 'canvas', view: 'Split', match: parse('.canvas'), Render: Split },
203
+ // The tiling container (D-14718) — a layout's default face. Its leaves
204
+ // walk back through Entity, so defer the binding like Canvas above.
205
+ {
206
+ plugin: 'canvas',
207
+ view: 'Layout',
208
+ match: parse('.doc .layout'),
209
+ Render: (props) => <Layout {...props} />,
210
+ },
211
+ // The Project Cockpit (D-14587). One grouped clause ties with Full's
212
+ // doc clause, so Full keeps the project's default face:
213
+ // the cockpit is a chosen tab, never a changed default. Its facet rows
214
+ // walk back through Entity; defer the binding like Canvas above.
215
+ {
216
+ view: 'Dashboard',
217
+ match: and(parse('.doc .project')),
218
+ Render: (props) => <Dashboard {...props} />,
219
+ },
220
+ { view: 'Web', match: parse('.web'), Render: Web },
221
+ // An attachment shares the artifact's face. A doc carrying one still opens
222
+ // on Full and offers Media as a tab.
223
+ { view: 'Media', match: parse('.attachment'), Render: Media },
224
+ // Entry faces use the same specificity rules as every entity view. The
225
+ // generic entry is the floor; facets such as bash and result override it.
226
+ {
227
+ view: 'Summary',
228
+ match: parse('.entry .call .bash'),
229
+ Render: CommandSummary,
230
+ },
231
+ {
232
+ view: 'Summary',
233
+ match: parse('.entry .prompt .content'),
234
+ Render: PromptSummary,
235
+ },
236
+ {
237
+ view: 'Summary',
238
+ match: parse('.entry .checkpoint .content'),
239
+ Render: CheckpointSummary,
240
+ },
241
+ { view: 'Summary', match: parse('.entry .result'), Render: ResultSummary },
242
+ {
243
+ view: 'Summary',
244
+ match: parse('.entry .content .tool_progress'),
245
+ Render: PendingSummary,
246
+ },
247
+ { view: 'Summary', match: parse('.entry .content'), Render: MessageSummary },
248
+ { view: 'Summary', match: parse('.entry'), Render: EntrySummary },
249
+ { view: 'Full', match: parse('.entry .call .bash'), Render: CommandFull },
250
+ { view: 'Full', match: parse('.entry .result'), Render: ResultFull },
251
+ {
252
+ view: 'Full',
253
+ match: parse('.entry .content .tool_progress'),
254
+ Render: PendingSummary,
255
+ },
256
+ { view: 'Full', match: parse('.entry .content'), Render: MessageFull },
257
+ {
258
+ view: 'Entry.Debug',
259
+ match: parse('.entry'),
260
+ Render: ({ e }) => <Debug e={e} tabs={false} />,
261
+ },
262
+ // The sections — Full's legos, internal views like Inline and Dependency.
263
+ // Catch-all matchers on purpose: each renders nothing when its data is
264
+ // absent, and a specialized look for an entity shape is a higher-
265
+ // scoring entry above these, never an edit to Full.
266
+ { view: 'Body', match: parse('.doc'), Render: Body },
267
+ // What an entity with no text of its own says: the facts its components
268
+ // state (@yaks/inspect's).
269
+ {
270
+ view: 'Body',
271
+ match: and(),
272
+ Render: ({ e }) => <Entity eid={e.eid} view='Inspect.Facts' />,
273
+ },
274
+ { view: 'Acceptance', match: and(), Render: Acceptance },
275
+ { view: 'Meta', match: parse('.board'), Render: BoardMeta },
276
+ { view: 'Meta', match: and(), Render: Meta },
277
+ { view: 'Mail', match: and(), Render: Mail },
278
+ {
279
+ view: 'Dependencies',
280
+ match: parse('.comment'),
281
+ Render: CommentDependencies,
282
+ },
283
+ { view: 'Dependencies', match: and(), Render: Dependencies },
284
+ { view: 'Relate', match: and(), Render: Relate },
285
+ { view: 'Boards', match: and(), Render: Boards },
286
+ { view: 'Tasks', match: and(), Render: Tasks },
287
+ { view: 'Runs', match: and(), Render: Runs },
288
+ { view: 'Similar', match: and(), Render: Similar },
289
+ { view: 'Comments', match: and(), Render: Talkback },
290
+ // The conversation alone, which a topic's page asks for as its Ask part.
291
+ // Named when it draws, not here: ./Chat.tsx imports this module, so when it
292
+ // loads first, Conversation is not yet defined while this list is made.
293
+ {
294
+ view: 'Conversation',
295
+ match: and(),
296
+ Render: ({ e }) => <Conversation e={e} />,
297
+ },
298
+ { view: 'Card.Title', match: parse('.wake .deliver'), Render: WakeTitle },
299
+ { view: 'Card.Title', match: parse('.doc .task'), Render: TaskTitle },
300
+ { view: 'Card.Title', match: parse('.doc .board'), Render: BoardTitle },
301
+ { view: 'Card.Title', match: parse('.web'), Render: WebTitle },
302
+ { view: 'Card.Title', match: parse('.session'), Render: SessionTitle },
303
+ { view: 'Bar.Title', match: parse('.session'), Render: SessionBarTitle },
304
+ { view: 'Card.Title', match: parse('.doc'), Render: DocTitle },
305
+ { view: 'Card.Title', match: and(), Render: AnyTitle },
306
+ {
307
+ view: 'Markdown',
308
+ match: parse('.doc'),
309
+ Render: Md,
310
+ file: { ext: 'md', mime: 'text/markdown', text: mdText },
311
+ },
312
+ {
313
+ view: 'JSON',
314
+ match: and(),
315
+ Render: Json,
316
+ file: {
317
+ ext: 'json',
318
+ mime: 'application/json',
319
+ text: (e) => JSON.stringify(e, null, 2),
320
+ },
321
+ },
322
+ { view: 'Debug', match: parse('.project'), Render: ProjectDebug },
323
+ { view: 'Debug', match: and(), Render: Debug },
324
+ { view: 'Debug.Tile', match: parse('.task'), Render: DebugTaskItem },
325
+ { view: 'Debug.Tile', match: and(), Render: DebugAnyItem },
326
+ { view: 'Inline', match: parse('.doc .task'), Render: TaskInline },
327
+ { view: 'Inline', match: and(), Render: Inline },
328
+ { view: 'Id', match: and(), Render: IdFace },
329
+ { view: 'Status.Session.Id', match: parse('.session'), Render: SessionId },
330
+ { view: 'Dependency', match: and(), Render: Dependency },
331
+ { view: 'Gist', match: and(), Render: Gist },
332
+ ], [
333
+ 'Wake',
334
+ 'Canvas',
335
+ 'Board',
336
+ 'List',
337
+ 'Split',
338
+ 'Layout',
339
+ // After every view a package offers as a tab (./offers.ts), which come
340
+ // first: the fullscreen bar opens a bare URL on tabs[0] (App.tsx), and the
341
+ // cockpit is a chosen tab, never a changed default.
342
+ 'Dashboard',
343
+ 'Session',
344
+ 'Full',
345
+ 'Web',
346
+ 'Media',
347
+ 'Inspect.Page',
348
+ // Its history, each moment opening the version it left (App.tsx `?at=`).
349
+ 'Inspect.History',
350
+ 'Debug',
351
+ ])
352
+
353
+ // The context-menu verbs, contributed per component (union — see
354
+ // registry.ts). A task offers its status moves and a session to run on
355
+ // it, a live claim offers release, and anything at all can be deleted
356
+ // (the red row at the end).
357
+ // The decision verbs a proposed, undecided thing offers: approve or decline,
358
+ // writing `decided {verdict}`. `by` is the server's to derive from the
359
+ // client's actor — a human clicking IS the person. Approving an OPEN task
360
+ // arms dispatch (the sweep may spawn a coder within seconds), so its label
361
+ // says so. Shared by the entity menu and the proposal icon (Show.tsx).
362
+ export let decisionActions = (e: Ent): Action[] => {
363
+ if (!e.proposed || e.decided || statusOf(e) == 'cancelled') return []
364
+ let decide = (verdict: string) => () =>
365
+ mutate({ eid: e.eid, name: 'decided', comp: { verdict } })
366
+ let dispatches = !!e.task && statusOf(e) == 'open'
367
+ return [
368
+ {
369
+ label: dispatches ? 'approve · dispatches a coder' : 'approve',
370
+ run: decide('approved'),
371
+ },
372
+ { label: 'decline', run: decide('declined') },
373
+ ]
374
+ }
375
+
376
+ defineActions([
377
+ {
378
+ match: and(),
379
+ acts: (e) =>
380
+ vocab.comp('favorite')
381
+ ? [{
382
+ label: favoriteLabel(e),
383
+ run: () => mutate(favoriteChange(e)),
384
+ }]
385
+ : [],
386
+ },
387
+ {
388
+ match: parse('.proposed'),
389
+ acts: decisionActions,
390
+ },
391
+ {
392
+ match: parse('.task'),
393
+ acts: (e) => {
394
+ let s = statusOf(e)
395
+ // Status is DERIVED (D-24102): a move mints/retracts the mark
396
+ // (statusChanges), never a status column. 'start' with no session (the
397
+ // web, a person's TUI) wears the `started` mark.
398
+ let move = (label: string, status: string): Action => ({
399
+ label,
400
+ run: () =>
401
+ mutate(
402
+ ...statusChanges(e.eid, status).filter((c) => vocab.comp(c.name)),
403
+ ),
404
+ })
405
+ // Cancelling wants a why: after the write, the cursor lands in the
406
+ // entity's comment box — a nudge toward the convention, never a
407
+ // gate (guarded: the TUI has no document).
408
+ let cancel: Action = {
409
+ label: 'cancel',
410
+ run: () => {
411
+ mutate(
412
+ ...statusChanges(e.eid, 'cancelled').filter((c) =>
413
+ vocab.comp(c.name)
414
+ ),
415
+ )
416
+ if (typeof document != 'undefined') {
417
+ setTimeout(() =>
418
+ document.querySelector<HTMLElement>(
419
+ `.Field[data-eid="${e.eid}"]`,
420
+ )?.focus(), 0)
421
+ }
422
+ },
423
+ }
424
+ return [
425
+ ...(s != 'wip' ? [move('start', 'wip')] : []),
426
+ ...(s != 'done' ? [move('done', 'done')] : []),
427
+ ...(s != 'open' ? [move('reopen', 'open')] : []),
428
+ ...(s != 'cancelled' ? [cancel] : []),
429
+ ...(vocab.comp('claim') && vocab.comp('session') &&
430
+ vocab.comp('using') && vocab.comp('entry')
431
+ ? [{ label: 'run agent…', run: () => openRun(e.eid) }]
432
+ : []),
433
+ ]
434
+ },
435
+ },
436
+ {
437
+ // The external-block facet (D-17094): unblock is trivial everywhere;
438
+ // block needs a free-text reason, so it's offered only where a prompt
439
+ // exists (the browser) — the TUI blocks via `task block`. This is what
440
+ // reddens the Dot, orthogonal to the status moves above.
441
+ match: parse('.task'),
442
+ acts: (e) =>
443
+ !vocab.comp('blocked') ? [] : e.blocked
444
+ ? [{
445
+ label: 'unblock',
446
+ run: () => mutate({ eid: e.eid, name: 'blocked', comp: null }),
447
+ }]
448
+ : typeof globalThis.prompt == 'function'
449
+ ? [{
450
+ label: 'block…',
451
+ run: () => {
452
+ let on = globalThis.prompt('Blocked on? (external reason)')?.trim()
453
+ if (on) mutate({ eid: e.eid, name: 'blocked', comp: { on } })
454
+ },
455
+ }]
456
+ : [],
457
+ },
458
+ {
459
+ // Watch and mute, on ANYTHING — a standing instruction is about a
460
+ // thread, and a thread can be a task, a venture, a session. Offered
461
+ // only to a viewer whose client names an actor: without one there is
462
+ // nobody for the instruction to belong to.
463
+ match: and(),
464
+ acts: (e) => {
465
+ if (!myActor() || !vocab.comp('subscription')) return []
466
+ let mode = myMode(e.eid)
467
+ let set = (to: 'watch' | 'mute' | null) => () =>
468
+ mutate(...subChanges(rows(), myActor()!, e.eid, to))
469
+ return [
470
+ mode == 'watch'
471
+ ? { label: 'unwatch', run: set(null) }
472
+ : { label: 'watch', run: set('watch') },
473
+ mode == 'mute'
474
+ ? { label: 'unmute', run: set(null) }
475
+ : { label: 'mute', run: set('mute') },
476
+ ]
477
+ },
478
+ },
479
+ {
480
+ match: parse('.claim'),
481
+ acts: (e) => [{
482
+ label: `release ${viaName(e.claim!.session)}`,
483
+ run: () => mutate({ eid: e.eid, name: 'claim', comp: null }),
484
+ }],
485
+ },
486
+ {
487
+ // Retiring stamps the moment; unretiring clears it. Everything filed
488
+ // under the project stays — it just stops coming up first.
489
+ match: parse('.project'),
490
+ acts: (e) => [
491
+ e.archived
492
+ ? {
493
+ label: 'unretire',
494
+ run: () => mutate({ eid: e.eid, name: 'archived', comp: null }),
495
+ }
496
+ : {
497
+ label: 'retire',
498
+ run: () =>
499
+ mutate({
500
+ eid: e.eid,
501
+ name: 'archived',
502
+ comp: {},
503
+ }),
504
+ },
505
+ ],
506
+ },
507
+ {
508
+ match: and(),
509
+ acts: (e) =>
510
+ vocab.comp('quarantined')
511
+ ? [
512
+ e.quarantined
513
+ ? {
514
+ label: 'unquarantine',
515
+ run: () =>
516
+ mutate({ eid: e.eid, name: 'quarantined', comp: null }),
517
+ }
518
+ : {
519
+ label: 'quarantine',
520
+ run: () => mutate({ eid: e.eid, name: 'quarantined', comp: {} }),
521
+ },
522
+ ]
523
+ : [],
524
+ },
525
+ {
526
+ // New, started from here: a blank one made of the same components, or
527
+ // one made inside this (`contains`), so a tree is that, repeated.
528
+ match: and(),
529
+ acts: (e) => [
530
+ {
531
+ label: 'new like this',
532
+ run: () => navigate(newPath({ like: idOf(e) })),
533
+ },
534
+ ...vocab.comp('contains')
535
+ ? [{
536
+ label: 'add child',
537
+ run: () => navigate(newPath({ in: idOf(e) })),
538
+ }]
539
+ : [],
540
+ ],
541
+ },
542
+ {
543
+ match: and(),
544
+ acts: (e) => [{
545
+ label: 'delete',
546
+ mod: 'danger',
547
+ run: () => mutate({ eid: e.eid, name: 'entity', comp: null }),
548
+ }],
549
+ },
550
+ ])
551
+
552
+ // The one front door: render an entity (straight out of the live cache)
553
+ // through a view. Extra props flow through to the renderer.
554
+ //
555
+ // Every `<Entity>` is a slot, and a view that throws while it draws fails in
556
+ // its own slot: it is reported and painted as its failure, and the views
557
+ // beside it and the page around it paint. One bad view costs one slot, never
558
+ // the page.
559
+ let Veil = el('section', 'Quarantine')
560
+ type FaceProps = { eid: string; view?: string; [x: string]: unknown }
561
+ type Reading = { e: Ent; visible: boolean }
562
+ let Current = createContext<Reading | undefined>(undefined)
563
+
564
+ let draw = (
565
+ { e, visible }: Reading,
566
+ { eid, view, ...rest }: FaceProps,
567
+ ) => {
568
+ if (!visible) {
569
+ return (
570
+ <Veil>
571
+ Quarantined content
572
+ <Button type='button' onClick={() => reveal(eid)}>
573
+ Reveal
574
+ </Button>
575
+ </Veil>
576
+ )
577
+ }
578
+ // A view drawn is a consumer of its own: the title in a card's bar and the
579
+ // same title in its body keep two states (@yaks/ux).
580
+ return <Ux at={view ?? 'default'}>{renderView(e, view, rest)}</Ux>
581
+ }
582
+
583
+ let ReadEntity = (props: FaceProps) => {
584
+ let { eid } = props
585
+ let reading = useDerived(
586
+ () => ({ e: ent(eid), visible: shown(eid) }),
587
+ [eid],
588
+ )
589
+ return (
590
+ <Current.Provider value={reading}>{draw(reading, props)}</Current.Provider>
591
+ )
592
+ }
593
+
594
+ // A tile, its metadata and its id can all draw the same live entity.
595
+ // Share the snapshot while keeping each view's renderer and UX state.
596
+ let EntityBody = (props: FaceProps) => {
597
+ let reading = useContext(Current)
598
+ return reading?.e.eid == props.eid
599
+ ? draw(reading, props)
600
+ : <ReadEntity {...props} />
601
+ }
602
+
603
+ let EntityFace = (props: FaceProps) => (
604
+ <Fault place={`the ${props.view ?? 'default'} view of ${props.eid}`}>
605
+ <EntityBody {...props} />
606
+ </Fault>
607
+ )
608
+
609
+ export let Entity = memo(EntityFace)
@@ -0,0 +1,43 @@
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 { Component, type ReactNode } from 'npm:react@19.3.0'
3
+ import { Button, el } from 'jsr:@yaks/ui@0.2.36'
4
+ import { failure } from '../failure.ts'
5
+ import { problem } from '../live.ts'
6
+
7
+ let Face = el('section', 'Fault')
8
+ let said = (error: unknown) =>
9
+ error instanceof Error ? error.message : String(error)
10
+
11
+ type Props = { place: string; children?: ReactNode }
12
+ type State = { failure?: { error: unknown } }
13
+
14
+ /** Let the rest of the page draw if an individual view throws. */
15
+ export class Fault extends Component<Props, State> {
16
+ override state: State = {}
17
+
18
+ static getDerivedStateFromError(error: unknown): State {
19
+ return { failure: { error } }
20
+ }
21
+
22
+ override componentDidCatch(error: unknown): void {
23
+ failure(error, this.props.place)
24
+ problem.value = `a view could not be drawn: ${said(error)}`
25
+ }
26
+
27
+ override render(): ReactNode {
28
+ let caught = this.state.failure
29
+ return caught
30
+ ? (
31
+ <Face>
32
+ {this.props.place} could not be drawn: {said(caught.error)}
33
+ <Button
34
+ type='button'
35
+ onClick={() => this.setState({ failure: undefined })}
36
+ >
37
+ retry
38
+ </Button>
39
+ </Face>
40
+ )
41
+ : this.props.children
42
+ }
43
+ }