@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,72 @@
1
+ /** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
2
+ // What a decision's choice shows, drawn by what it is: an image as itself
3
+ // with its address under it (the address is what a terminal shows), prose as
4
+ // its title over its Markdown, a page framed at desktop or phone width.
5
+ import { type Ent } from '../../types.ts'
6
+ import { ent } from '../../live.ts'
7
+ import { Markdown } from 'jsr:@yaks/markdown@0.2.36'
8
+ import { Body, Check, Doc, Preview } from 'jsr:@yaks/ui@0.2.36'
9
+ import { Media } from './Media.tsx'
10
+
11
+ export let ShownImage = ({ e }: { e: Ent }) => {
12
+ let address = e.attachment
13
+ ? ent(e.attachment.artifact).artifact?.address ?? e.attachment.artifact
14
+ : e.artifact?.address
15
+ return (
16
+ <>
17
+ <Media e={e} />
18
+ <Preview.Address href={`/blob/${address}`}>
19
+ {e.attachment?.name ?? `/blob/${address}`}
20
+ </Preview.Address>
21
+ </>
22
+ )
23
+ }
24
+
25
+ export let ShownProse = ({ e }: { e: Ent }) => (
26
+ <Doc>
27
+ {e.doc?.title && <Doc.Title>{e.doc.title}</Doc.Title>}
28
+ {e.doc?.body && (
29
+ <Body>
30
+ <Markdown source={e.doc.body} />
31
+ </Body>
32
+ )}
33
+ </Doc>
34
+ )
35
+
36
+ // A page runs its scripts in an opaque origin, walled off from this one.
37
+ let views = [['Desktop', 'desktop'], ['Phone', 'phone']] as const
38
+
39
+ export let ShownPage = ({ e }: { e: Ent }) => {
40
+ let url = String(e.web?.url ?? '')
41
+ return (
42
+ <Preview>
43
+ <Preview.Address href={url} target='_blank' rel='noopener'>
44
+ {url}
45
+ </Preview.Address>
46
+ <Preview.Choices role='radiogroup' aria-label='Page width'>
47
+ {views.map(([title, width], i) => (
48
+ <Preview.Item key={width}>
49
+ <Preview.Choice>
50
+ <Check.Input
51
+ type='radio'
52
+ name={`shown-${e.eid}`}
53
+ value={width}
54
+ checked={i == 0}
55
+ />
56
+ {title}
57
+ </Preview.Choice>
58
+ <Preview.View>
59
+ <Preview.Frame
60
+ mod={width}
61
+ title={`${e.doc?.title ?? url}, ${width} width`}
62
+ src={url}
63
+ sandbox='allow-scripts allow-forms'
64
+ loading='lazy'
65
+ />
66
+ </Preview.View>
67
+ </Preview.Item>
68
+ ))}
69
+ </Preview.Choices>
70
+ </Preview>
71
+ )
72
+ }
@@ -0,0 +1,58 @@
1
+ /** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
2
+ // The two-pane view: a list on the LEFT, the opened entity on the RIGHT
3
+ // (T-17321). A view of ANY entity with a list face — a project/board shows
4
+ // its Board, a canvas its List — so "the left can be a board, a List, a
5
+ // project, anything" falls out of the registry, not new structure. Clicking
6
+ // a left row fills the right pane instead of navigating: the rows are already
7
+ // real /id anchors, so the left pane owns ONE capture-phase click handler
8
+ // that reads the anchor's href and opens it here — no onOpen threading
9
+ // through Board, no global selection, and the URL still names one root.
10
+ // Selection is view-local on purpose (transient, not shareable); a ?sel=
11
+ // URL param is the noted follow-up when sharing is wanted.
12
+ /* @ts-types="npm:@types/react@19.3.0" */ import { useState } from 'npm:react@19.3.0'
13
+ import { type Ent } from '../../types.ts'
14
+ import { block } from 'jsr:@yaks/ui@0.2.36'
15
+ import { eidOf } from '../nav.tsx'
16
+ import { Entity } from '../Entity.tsx'
17
+
18
+ let Frame = block('div', 'Split', {
19
+ Left: 'div',
20
+ Right: 'div',
21
+ Empty: 'div',
22
+ })
23
+
24
+ export let Split = ({ e }: { e: Ent }) => {
25
+ let [sel, setSel] = useState<string | null>(null)
26
+ // The left face is the entity's own list: a board query renders as a
27
+ // Board (its columns snap on a narrow host, for free), everything else
28
+ // as a List.
29
+ let left = e.board ? 'Board' : 'List'
30
+ // A plain click on an entity link opens it on the right rather than
31
+ // navigating the whole root. Capture-phase so it wins before the anchor's
32
+ // own follow() and the document's delegated ref-opener; modified and
33
+ // middle clicks fall through untouched, keeping native new-tab.
34
+ let open = (ev: MouseEvent) => {
35
+ if (ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.button != 0) return
36
+ let a = (ev.target as Element | null)?.closest?.('a[href]')
37
+ let id = a?.getAttribute('href')?.match(/^\/([^/?#]+)/)?.[1]
38
+ let eid = id && eidOf(id)
39
+ if (!eid) return
40
+ ev.preventDefault()
41
+ ev.stopPropagation()
42
+ setSel(eid)
43
+ }
44
+ return (
45
+ <Frame>
46
+ <Frame.Left onClickCapture={open}>
47
+ <Entity eid={e.eid} view={left} />
48
+ </Frame.Left>
49
+ <Frame.Right>
50
+ {sel ? <Entity eid={sel} view='Full' /> : (
51
+ <Frame.Empty>
52
+ Pick something on the left to open it here.
53
+ </Frame.Empty>
54
+ )}
55
+ </Frame.Right>
56
+ </Frame>
57
+ )
58
+ }
@@ -0,0 +1,37 @@
1
+ /** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
2
+ import { crewed, gated } from '../../live.ts'
3
+ import { statusOf } from '../../types.ts'
4
+ import { Dot } from '../Dot.tsx'
5
+ import { Entity } from '../Entity.tsx'
6
+ import { menuAt } from '../nav.tsx'
7
+ import {
8
+ slot,
9
+ TileFrame,
10
+ tileLink,
11
+ type TileProps,
12
+ tileTitle,
13
+ } from '../Tile.tsx'
14
+
15
+ let { Title } = TileFrame
16
+
17
+ // A task as a small board card, Trello-shaped: wrapping title beside its
18
+ // dot, then the shared Meta registry view at tile density. The whole tile is
19
+ // the LINK — clickProps on the el: click peeks, double click navigates — and
20
+ // right-click serves the app menu (menuAt), so the verbs are one click from
21
+ // any board. Drag out to the canvas for the full Task card (the board Item
22
+ // owns the drag).
23
+ export let TaskTile = ({ e, slots, onOpen }: TileProps) => (
24
+ <TileFrame
25
+ mod={['task', 'dense']}
26
+ {...tileLink(e, onOpen)}
27
+ onContextMenu={menuAt(e)}
28
+ >
29
+ {slot(slots, 'before')}
30
+ <Dot status={statusOf(e)} gated={gated(e)} live={crewed(e)} />
31
+ <Title {...tileTitle(slots, e.doc?.title ?? '')} />
32
+ <Entity eid={e.eid} view='Meta' id>
33
+ {slot(slots, 'after')}
34
+ </Entity>
35
+ {slot(slots, 'body')}
36
+ </TileFrame>
37
+ )
@@ -0,0 +1,105 @@
1
+ /** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
2
+ import { type Ent, friendly } from '../../types.ts'
3
+ import { block } from 'jsr:@yaks/ui@0.2.36'
4
+ import { title, TitleEdit } from '../title.tsx'
5
+ import { Pip } from './Show.tsx'
6
+ import { Id } from './Inline.tsx'
7
+ import { SessionDot } from '../session_status.tsx'
8
+ import { useJob, useModel, useReference } from '../subscriptions.ts'
9
+ import { renderView } from '../registry.ts'
10
+ import { ent } from '../../live.ts'
11
+
12
+ let Frame = block('div', 'CardTitle', { Text: 'span' })
13
+ let { Text } = Frame
14
+
15
+ // The Card.Title view: what an entity shows in a card's titlebar — the
16
+ // entity IS the card. Everything reads id chip → dot → title (the id is
17
+ // the address, first like a filename; a dot only when the entity has a
18
+ // status), then the titlebar's own flex pushes filter + tabs off to the
19
+ // right. The task's dot is its status CONTROL (Show.tsx Pip) — a card
20
+ // carries one dot, and that dot is where status is edited; a session's
21
+ // dot just says how the run is doing.
22
+ export let TaskTitle = ({ e }: { e: Ent }) => (
23
+ <Frame>
24
+ <Id e={e} />
25
+ <Pip e={e} />
26
+ <Text>
27
+ <TitleEdit eid={e.eid} />
28
+ </Text>
29
+ </Frame>
30
+ )
31
+
32
+ export let BoardTitle = ({ e }: { e: Ent }) => (
33
+ <Frame>
34
+ <Id e={e} />
35
+ <Text>
36
+ <TitleEdit eid={e.eid} />
37
+ </Text>
38
+ </Frame>
39
+ )
40
+
41
+ export let WebTitle = ({ e }: { e: Ent }) => {
42
+ let host
43
+ try {
44
+ host = new URL(e.web!.url).host
45
+ } catch {
46
+ host = e.web!.url
47
+ }
48
+ // The freeze stamps the page <title> onto the entity as a doc.
49
+ return (
50
+ <Frame>
51
+ <Id e={e} />
52
+ <Text {...title(e.doc?.title ?? host)} />
53
+ </Frame>
54
+ )
55
+ }
56
+
57
+ export let DocTitle = ({ e }: { e: Ent }) => (
58
+ <Frame>
59
+ <Id e={e} />
60
+ <Text>
61
+ <TitleEdit eid={e.eid} />
62
+ </Text>
63
+ </Frame>
64
+ )
65
+
66
+ export let SessionTitle = ({ e }: { e: Ent }) => {
67
+ let model = useModel(e)
68
+ return (
69
+ <Frame>
70
+ <Id e={e} />
71
+ <SessionDot e={e} />
72
+ <Text>
73
+ {friendly(model.name) ?? 'session'}
74
+ {model.effort && ` · ${model.effort}`}
75
+ </Text>
76
+ </Frame>
77
+ )
78
+ }
79
+
80
+ // The bar over a session's page names what it is working on: the task it
81
+ // holds, else the one it worked, else its own title. Its id is beside it
82
+ // already, and its dot says how the run is doing.
83
+ export let SessionBarTitle = ({ e }: { e: Ent }) => {
84
+ let job = useJob(e)
85
+ let worked = useReference(e.refs.find((r) => r.type == 'worked')?.child)
86
+ .value
87
+ let task = job ? ent(job) : worked
88
+ return (
89
+ <Frame>
90
+ <SessionDot e={e} />
91
+ <Text>
92
+ {task
93
+ ? renderView(task, 'Title')
94
+ : <span {...title(e.doc?.title || 'Session')} />}
95
+ </Text>
96
+ </Frame>
97
+ )
98
+ }
99
+
100
+ export let AnyTitle = ({ e }: { e: Ent }) => (
101
+ <Frame mod='dim'>
102
+ <Id e={e} />
103
+ <Text>{e.kind}</Text>
104
+ </Frame>
105
+ )
@@ -0,0 +1,77 @@
1
+ /** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
2
+ // A wake's two faces: a title derived from its recipient and clock, and a
3
+ // quiet summary that makes the scheduled moment and people visible.
4
+ import { type Ent } from '../../types.ts'
5
+ import { ent } from '../../live.ts'
6
+ import { wakeTitle } from '../../title.ts'
7
+ import { block } from 'jsr:@yaks/ui@0.2.36'
8
+ import { Time } from 'jsr:@yaks/ui@0.2.36'
9
+ import { Dot } from '../Dot.tsx'
10
+ import { Entity } from '../Entity.tsx'
11
+ import { Id } from './Inline.tsx'
12
+
13
+ let Title = block('div', 'CardTitle', { Text: 'span' })
14
+ let Frame = block('section', 'Wake', {
15
+ Moment: 'div',
16
+ Relative: 'strong',
17
+ Exact: 'time',
18
+ Outcome: 'div',
19
+ Status: 'strong',
20
+ Detail: 'span',
21
+ People: 'div',
22
+ Party: 'div',
23
+ Label: 'span',
24
+ })
25
+
26
+ let state = (e: Ent) =>
27
+ e.delivered ? 'delivered' : e.failed ? 'failed' : 'pending'
28
+
29
+ export let WakeTitle = ({ e }: { e: Ent }) => {
30
+ let status = state(e)
31
+ return (
32
+ <Title>
33
+ <Id e={e} />
34
+ <Dot status={status == 'delivered' ? 'done' : status} />
35
+ <Title.Text>{wakeTitle(e, ent)}</Title.Text>
36
+ </Title>
37
+ )
38
+ }
39
+
40
+ export let Wake = ({ e }: { e: Ent }) => {
41
+ let at = e.wake!.at
42
+ let to = e.deliver?.to
43
+ let by = e.created?.by
44
+ let status = state(e)
45
+ let outcome = e.delivered ?? e.failed
46
+ return (
47
+ <Frame>
48
+ <Frame.Moment mod={status}>
49
+ <Frame.Relative>
50
+ <Time at={at} />
51
+ </Frame.Relative>
52
+ <Frame.Outcome>
53
+ <Frame.Status>{status}</Frame.Status>
54
+ {outcome?.at && <Time at={outcome.at} />}
55
+ {e.delivered?.via && (
56
+ <Frame.Detail>via {e.delivered.via}</Frame.Detail>
57
+ )}
58
+ {e.failed?.reason && <Frame.Detail>{e.failed.reason}</Frame.Detail>}
59
+ </Frame.Outcome>
60
+ </Frame.Moment>
61
+ {to && (
62
+ <Frame.People>
63
+ <Frame.Party>
64
+ <Frame.Label>deliver to</Frame.Label>
65
+ <Entity eid={to} view='Tile' />
66
+ </Frame.Party>
67
+ {by && by != to && (
68
+ <Frame.Party>
69
+ <Frame.Label>created by</Frame.Label>
70
+ <Entity eid={by} view='Tile' />
71
+ </Frame.Party>
72
+ )}
73
+ </Frame.People>
74
+ )}
75
+ </Frame>
76
+ )
77
+ }
@@ -0,0 +1,49 @@
1
+ /** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
2
+ import { type Ent } from '../../types.ts'
3
+ import { base } from '../../live.ts'
4
+ import { door } from '../../hosting.ts'
5
+ import { block, el } from 'jsr:@yaks/ui@0.2.36'
6
+
7
+ let Frame = el('iframe', 'Web')
8
+ let Wait = block('div', 'WebWait', {
9
+ Url: 'span',
10
+ Error: 'span',
11
+ Go: 'button',
12
+ })
13
+ let { Url, Error, Go } = Wait
14
+
15
+ // A web entity renders its FROZEN archive, never the live site (which
16
+ // can rot, track, or refuse framing). Provenance picks the sandbox: a
17
+ // URL freeze is a stranger's page — no scripts; a delivered page is an
18
+ // agent's own artifact — scripts run, but in an opaque origin (no
19
+ // allow-same-origin), walled off from the app. Until the freeze lands,
20
+ // a waiting state with a retry button (also the thumb for pre-freeze
21
+ // entities and failures).
22
+ export let Web = ({ e }: { e: Ent }) =>
23
+ e.web!.frozen_at
24
+ ? (
25
+ <Frame
26
+ sandbox={e.web!.url ? 'allow-same-origin' : 'allow-scripts'}
27
+ src={`/frozen/${e.eid}.html`}
28
+ />
29
+ )
30
+ : (
31
+ <Wait>
32
+ {e.failed?.reason ? <Error>{e.failed.reason}</Error> : (
33
+ <Url>
34
+ {door('freeze') ? 'freezing ' : ''}
35
+ {e.web!.url}
36
+ {door('freeze') ? ' …' : ''}
37
+ </Url>
38
+ )}
39
+ {door('freeze') && (
40
+ <Go
41
+ type='button'
42
+ onClick={() =>
43
+ fetch(`${base()}/freeze?eid=${e.eid}`).catch(() => {})}
44
+ >
45
+ ↻ retry
46
+ </Go>
47
+ )}
48
+ </Wait>
49
+ )
@@ -0,0 +1,30 @@
1
+ // Where a text property's suggestions come from. A vocabulary declaration
2
+ // names a well (`{text: 'domains'}`), and the well answers the values seen so
3
+ // far. The editor that sets such a property (@yaks/ux) and the query field
4
+ // that completes one (fields.tsx) read the same wells; a plugin may replace
5
+ // one while the column still selects its control through the registry.
6
+ import { domains, useHold } from "../live.js";
7
+ import { propAt } from "../props.js";
8
+ export let wells = {
9
+ domains: ()=>domains.value
10
+ };
11
+ export let defineWells = (sources)=>Object.assign(wells, sources);
12
+ // What a well asks the server, held while a picker draws its values. Without
13
+ // a hold a well answers from the rows this tab holds (the query field's
14
+ // completion, which is no component).
15
+ let asks = {
16
+ domains: {
17
+ agg: domains.agg,
18
+ line: domains.line
19
+ }
20
+ };
21
+ /** A well's values, held for the mounted picker that draws them. */ export let useWell = (well)=>{
22
+ useHold(asks[well]);
23
+ return wells[well]?.() ?? [];
24
+ };
25
+ // The well a property's declaration names, or '' for none.
26
+ export let wellOf = (comp, prop)=>{
27
+ let type = propAt(comp, prop)?.type;
28
+ return type && typeof type == 'object' && 'text' in type ? type.text : '';
29
+ };
30
+ //# sourceMappingURL=wells.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wells.js","sources":["./wells.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,uEAAuE;AACvE,SAAS,OAAO,EAAE,OAAO,qBAAoB;AAC7C,SAAS,MAAM,sBAAqB;AAEpC,OAAO,IAAI,QAAwC;EACjD,SAAS,IAAM,QAAQ,KAAK;AAC9B,EAAC;AAED,OAAO,IAAI,cAAc,CAAC,UACxB,OAAO,MAAM,CAAC,OAAO,SAAQ;AAE/B,6EAA6E;AAC7E,wEAAwE;AACxE,sCAAsC;AACtC,IAAI,OAAsD;EACxD,SAAS;IAAE,KAAK,QAAQ,GAAG;IAAE,MAAM,QAAQ,IAAI;EAAC;AAClD;AAEA,kEAAkE,GAClE,OAAO,IAAI,UAAU,CAAC;EACpB,QAAQ,IAAI,CAAC,KAAK;EAClB,OAAO,KAAK,CAAC,KAAK,QAAQ,EAAE;AAC9B,EAAC;AAED,2DAA2D;AAC3D,OAAO,IAAI,SAAS,CAAC,MAAc;EACjC,IAAI,OAAO,OAAO,MAAM,OAAO;EAC/B,OAAO,QAAQ,OAAO,QAAQ,YAAY,UAAU,OAAO,KAAK,IAAI,GAAG;AACzE,EAAC"}
@@ -0,0 +1,33 @@
1
+ // Where a text property's suggestions come from. A vocabulary declaration
2
+ // names a well (`{text: 'domains'}`), and the well answers the values seen so
3
+ // far. The editor that sets such a property (@yaks/ux) and the query field
4
+ // that completes one (fields.tsx) read the same wells; a plugin may replace
5
+ // one while the column still selects its control through the registry.
6
+ import { domains, useHold } from '../live.js'
7
+ import { propAt } from '../props.js'
8
+
9
+ export let wells: Record<string, () => string[]> = {
10
+ domains: () => domains.value,
11
+ }
12
+
13
+ export let defineWells = (sources: typeof wells) =>
14
+ Object.assign(wells, sources)
15
+
16
+ // What a well asks the server, held while a picker draws its values. Without
17
+ // a hold a well answers from the rows this tab holds (the query field's
18
+ // completion, which is no component).
19
+ let asks: Record<string, { agg: string; line: string }> = {
20
+ domains: { agg: domains.agg, line: domains.line },
21
+ }
22
+
23
+ /** A well's values, held for the mounted picker that draws them. */
24
+ export let useWell = (well: string): string[] => {
25
+ useHold(asks[well])
26
+ return wells[well]?.() ?? []
27
+ }
28
+
29
+ // The well a property's declaration names, or '' for none.
30
+ export let wellOf = (comp: string, prop: string): string => {
31
+ let type = propAt(comp, prop)?.type
32
+ return type && typeof type == 'object' && 'text' in type ? type.text : ''
33
+ }
@@ -0,0 +1,38 @@
1
+ // Private configuration writes bypass the offline outbox: a pasted credential
2
+ // is sent once to the server's vault boundary and never retained for replay.
3
+ import { sealed } from "@yaks/secrets/sealed";
4
+ import { base } from "./live.js";
5
+ import { hosting } from "./hosting.js";
6
+ let post = async (path, body)=>{
7
+ let response = await fetch(base() + path, {
8
+ method: 'POST',
9
+ headers: {
10
+ 'content-type': 'application/json'
11
+ },
12
+ body: JSON.stringify(body)
13
+ });
14
+ let result = await response.json();
15
+ if (!response.ok) throw new Error(result.message ?? result.error ?? 'Refused');
16
+ return result;
17
+ };
18
+ export let saveSecret = (name, value, eid)=>{
19
+ let bundle = sealed(name, value);
20
+ return post(hosting().apply, [
21
+ {
22
+ ...bundle,
23
+ entity: {
24
+ eid: eid ?? bundle.entity.eid
25
+ }
26
+ }
27
+ ]);
28
+ };
29
+ export let signIn = (action, name, callback)=>post('/web/authorize', {
30
+ action,
31
+ name,
32
+ callback
33
+ });
34
+ /** A key pasted for a connection a task asks for (@yaks/connections
35
+ * `pasted`), sent once to the server, whose vault keeps it. */ export let saveKey = (bundle)=>post(hosting().apply, [
36
+ bundle
37
+ ]);
38
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.js","sources":["./configuration.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6EAA6E;AAG7E,SAAS,MAAM,oCAAyC;AACxD,SAAS,IAAI,oBAAmB;AAChC,SAAS,OAAO,uBAAsB;AAEtC,IAAI,OAAO,OAAO,MAAc;EAC9B,IAAI,WAAW,MAAM,MAAM,SAAS,MAAM;IACxC,QAAQ;IACR,SAAS;MAAE,gBAAgB;IAAmB;IAC9C,MAAM,KAAK,SAAS,CAAC;EACvB;EACA,IAAI,SAAS,MAAM,SAAS,IAAI;EAChC,IAAI,CAAC,SAAS,EAAE,EAAE,MAAM,IAAI,MAAM,OAAO,OAAO,IAAI,OAAO,KAAK,IAAI;EACpE,OAAO;AACT;AAEA,OAAO,IAAI,aAAa,CACtB,MACA,OACA;EAEA,IAAI,SAAS,OAAO,MAAM;EAC1B,OAAO,KAAK,UAAU,KAAK,EAAE;IAAC;MAC5B,GAAG,MAAM;MACT,QAAQ;QAAE,KAAK,OAAO,OAAO,MAAM,CAAC,GAAG;MAAC;IAC1C;GAAE;AACJ,EAAC;AAED,OAAO,IAAI,SAAS,CAClB,QACA,MACA,WACuB,KAAK,kBAAkB;IAAE;IAAQ;IAAM;EAAS,GAAE;AAE3E;6DAC6D,GAC7D,OAAO,IAAI,UAAU,CAAC,SACpB,KAAK,UAAU,KAAK,EAAE;IAAC;GAAO,EAAC"}
@@ -0,0 +1,41 @@
1
+ // Private configuration writes bypass the offline outbox: a pasted credential
2
+ // is sent once to the server's vault boundary and never retained for replay.
3
+ import type { Bundle } from 'jsr:@yaks/graph@0.2.36'
4
+ import type { AuthAction, AuthReply } from 'jsr:@yaks/connections@0.2.36'
5
+ import { sealed } from '@yaks/secrets/sealed'
6
+ import { base } from './live.js'
7
+ import { hosting } from './hosting.js'
8
+
9
+ let post = async (path: string, body: unknown) => {
10
+ let response = await fetch(base() + path, {
11
+ method: 'POST',
12
+ headers: { 'content-type': 'application/json' },
13
+ body: JSON.stringify(body),
14
+ })
15
+ let result = await response.json()
16
+ if (!response.ok) throw new Error(result.message ?? result.error ?? 'Refused')
17
+ return result
18
+ }
19
+
20
+ export let saveSecret = (
21
+ name: string,
22
+ value: string,
23
+ eid?: string,
24
+ ): Promise<Bundle[]> => {
25
+ let bundle = sealed(name, value)
26
+ return post(hosting().apply, [{
27
+ ...bundle,
28
+ entity: { eid: eid ?? bundle.entity.eid },
29
+ }])
30
+ }
31
+
32
+ export let signIn = (
33
+ action: AuthAction,
34
+ name?: string,
35
+ callback?: string,
36
+ ): Promise<AuthReply> => post('/web/authorize', { action, name, callback })
37
+
38
+ /** A key pasted for a connection a task asks for (@yaks/connections
39
+ * `pasted`), sent once to the server, whose vault keeps it. */
40
+ export let saveKey = (bundle: Bundle): Promise<Bundle[]> =>
41
+ post(hosting().apply, [bundle])
@@ -0,0 +1,88 @@
1
+ import { draftEid } from "@yaks/draft";
2
+ import { line } from "@yaks/query";
3
+ import { DECISION_SETTLED } from "@yaks/task";
4
+ import { answerPlace } from "@yaks/task/form";
5
+ /** The form sends an answer alone or alongside a spend of its own draft. */ export let decisionWrite = ([answer, spend, ...rest])=>{
6
+ let eid = answer?.entity.eid;
7
+ let decided = answer?.decided;
8
+ let choice = decided?.choice;
9
+ if (!eid || typeof choice != 'string' || rest.length) return;
10
+ if (Object.keys(decided).length != 1) return;
11
+ if (Object.keys(answer).some((k)=>k != 'entity' && k != 'decided')) return;
12
+ if (!spend) return {
13
+ eid
14
+ };
15
+ let draft = spend.draft;
16
+ let over = spend.typed?.over;
17
+ let place = answerPlace(eid);
18
+ if (draft?.place != place || draft.text !== '' || typeof draft.by != 'string' || spend.entity.eid != draftEid(draft.by, place) || Object.keys(spend).some((k)=>![
19
+ 'entity',
20
+ 'draft',
21
+ 'typed'
22
+ ].includes(k))) return;
23
+ // Older pages trimmed the answer in the write. Its saved base can still
24
+ // carry the original whitespace.
25
+ let text = typeof over == 'string' && over.trim() == choice ? over : choice;
26
+ return {
27
+ eid,
28
+ recovery: {
29
+ entity: spend.entity,
30
+ draft: {
31
+ ...draft,
32
+ text
33
+ },
34
+ typed: {
35
+ over: ''
36
+ }
37
+ }
38
+ };
39
+ };
40
+ /** Reconcile a stale answer with the server's decision. The original batch
41
+ * was atomic, so the draft clear never ran. Save the attempted text via the
42
+ * ordinary draft merge, under a stable key for retries after a lost receipt. */ export let deliverAnswer = async (request, answer, send, refused)=>{
43
+ if (!refused) {
44
+ let response = await send(request);
45
+ if (response.status != 400) return response;
46
+ let why = await response.clone().json().catch(()=>null);
47
+ if (why?.error != 'Refused' || why.message != DECISION_SETTLED || why.eid != null && why.eid != answer.eid) return response;
48
+ }
49
+ let url = new URL(request.url);
50
+ url.pathname = url.pathname.replace(/\/apply$/, '/query');
51
+ url.searchParams.set('q', line`.entity.eid=${answer.eid} .fields=decided,cancelled,completed`);
52
+ let current = await send(new Request(url));
53
+ if (!current.ok) return current;
54
+ let [row] = await current.json();
55
+ if (!row?.decided && !row?.cancelled) {
56
+ return Response.json({
57
+ error: 'NotFound',
58
+ message: 'The settled decision could not be read.'
59
+ }, {
60
+ status: 404
61
+ });
62
+ }
63
+ let saved = [];
64
+ if (answer.recovery) {
65
+ let headers = new Headers(request.headers);
66
+ let key = headers.get('idempotency-key');
67
+ if (key) headers.set('idempotency-key', `${key}:draft`);
68
+ let result = await send(new Request(request.url, {
69
+ method: 'POST',
70
+ headers,
71
+ body: JSON.stringify([
72
+ answer.recovery
73
+ ])
74
+ }));
75
+ if (!result.ok || result.status == 202) return result;
76
+ saved = await result.json();
77
+ }
78
+ return Response.json([
79
+ {
80
+ entity: row.entity,
81
+ decided: row.decided ?? null,
82
+ cancelled: row.cancelled ?? null,
83
+ completed: row.completed ?? null
84
+ },
85
+ ...saved
86
+ ]);
87
+ };
88
+ //# sourceMappingURL=decision_sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision_sync.js","sources":["./decision_sync.ts"],"names":[],"mappings":"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"}