rvlib-shipkit 2.10.0 → 2.12.0

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 (73) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +1 -1
  3. package/src/cli/cmd_Media.ts +253 -0
  4. package/src/cli/cmd_Review.ts +4 -0
  5. package/src/cli/cmd_Trailer.ts +4 -0
  6. package/src/cli/family-pages.ts +1 -0
  7. package/src/cli/registry.ts +2 -0
  8. package/src/collections/pings.ts +6 -4
  9. package/src/core/app-icon.ts +17 -4
  10. package/src/core/scratch-objects.ts +56 -0
  11. package/src/core/trace-audit.ts +13 -1
  12. package/src/home/home-paths.ts +4 -0
  13. package/src/home/home-routes.ts +36 -2
  14. package/src/home/hubs.ts +5 -0
  15. package/src/home/inbox-shape.ts +188 -0
  16. package/src/home/inbox.ts +104 -0
  17. package/src/home/run-daemon.ts +12 -2
  18. package/src/home/serve-web.ts +161 -16
  19. package/src/ledger/git-scan.ts +73 -25
  20. package/src/ledger/repo-view.ts +2 -22
  21. package/src/media-kinds.ts +14 -0
  22. package/src/media-store/content.ts +61 -0
  23. package/src/media-store/daemon.ts +91 -0
  24. package/src/media-store/db.ts +74 -0
  25. package/src/media-store/fact.ts +9 -0
  26. package/src/media-store/hand.ts +58 -0
  27. package/src/media-store/kind.ts +44 -0
  28. package/src/media-store/purge.ts +139 -0
  29. package/src/media-store/put.ts +120 -0
  30. package/src/media-store/remote.ts +93 -0
  31. package/src/media-store/space.ts +167 -0
  32. package/src/media-store/sync.ts +101 -0
  33. package/src/media-store/upload.ts +98 -0
  34. package/src/repo-config.ts +4 -0
  35. package/src/review/anim.ts +6 -5
  36. package/src/review/cells.ts +5 -1
  37. package/src/review/media-kind.ts +84 -0
  38. package/src/review/media-read.ts +48 -0
  39. package/src/review/model.ts +22 -1
  40. package/src/review/previews.ts +41 -12
  41. package/src/review/routes.ts +32 -8
  42. package/src/review/store.ts +102 -40
  43. package/src/review/trailer-desk.ts +79 -46
  44. package/src/review/trailer-media.ts +181 -0
  45. package/src/review/trailer-routes.ts +5 -2
  46. package/src/review/trailer-shots.ts +89 -0
  47. package/src/serve/hub-app/cols-svc.ts +12 -1
  48. package/src/serve/hub-app/home-st.ts +39 -9
  49. package/src/serve/hub-app/home.html +2 -1
  50. package/src/serve/hub-app/hub-app.tsx +7 -23
  51. package/src/serve/hub-app/icons.tsx +2 -0
  52. package/src/serve/hub-app/inbox-st.ts +144 -0
  53. package/src/serve/hub-app/inbox-view.tsx +205 -0
  54. package/src/serve/hub-app/inbox.css +73 -0
  55. package/src/serve/hub-app/item-view.tsx +19 -0
  56. package/src/serve/hub-app/keys.ts +4 -3
  57. package/src/serve/hub-app/palette-st.ts +2 -1
  58. package/src/serve/hub-app/project-list.tsx +1 -0
  59. package/src/serve/hub-app/projects-svc.ts +1 -1
  60. package/src/serve/hub-app/repo-st.ts +1 -1
  61. package/src/serve/hub-app/review/review-st.ts +15 -3
  62. package/src/serve/hub-app/review/review-thread.tsx +5 -4
  63. package/src/serve/hub-app/review.css +1 -1
  64. package/src/serve/hub-app/test-view.tsx +9 -2
  65. package/src/serve/hub-app/tests-svc.ts +16 -1
  66. package/src/serve/hub-runtime.ts +9 -4
  67. package/src/serve/resources-wire.ts +48 -0
  68. package/src/serve/serve-hub.ts +11 -7
  69. package/src/serve/warm-cell.ts +6 -1
  70. package/src/trailer/footage.ts +6 -2
  71. package/src/trailer/passage.ts +8 -3
  72. package/src/trailer/prune.ts +6 -10
  73. package/src/trailer/shelf.ts +16 -0
@@ -0,0 +1,205 @@
1
+ // the inbox page (wiki build/shipkit/home.md, The inbox): every repo's items that wait on the owner, newest first, each
2
+ // row with its repo's icon, its kind, its title, its age and a thumb; what can wait folded at the bottom. A row opens
3
+ // its item in place with its repo's own views: a card in the review thread (review-thread.tsx), an ask or a need in
4
+ // its item view (item-view.tsx). On the desktop the list and the item side by side; on a phone one pane at a time,
5
+ // the list kept under the item so back finds it where it was
6
+ import { observer } from 'mobx-react-lite'
7
+ import { useLayoutEffect } from 'react'
8
+ import { isReviewId, type InboxRow } from '../../home/inbox-shape.ts'
9
+ import { hashFor } from './hash-route.ts'
10
+ import { plainClick, repoPage, type HomeSt } from './home-st.ts'
11
+ import { Icon, ICON } from './icons.tsx'
12
+ import type { InboxSt } from './inbox-st.ts'
13
+ import { ItemView } from './item-view.tsx'
14
+ import { Face } from './project-list.tsx'
15
+ import type { RepoSt } from './repo-st.ts'
16
+ import { ThreadColumn } from './review/review-thread.tsx'
17
+ import { TimeAgo } from './time-ago.tsx'
18
+
19
+ /** the words of a kind, on its badge's tooltip */
20
+ const KIND_WORDS: Record<InboxRow['kind'], string> = {
21
+ card: 'a card an agent sent, waiting for your verdict',
22
+ question: 'a question or a blocked item, waiting for your answer',
23
+ ask: 'an ask: something only your hands do',
24
+ need: 'something in the repo that needs someone',
25
+ raised: 'an item raised in the review, in the agents’ hands',
26
+ }
27
+
28
+ export const InboxView = observer(({ app }: { app: HomeSt }) => {
29
+ const ib = app.inbox
30
+ const open = ib.open
31
+ if (ib.phone)
32
+ return (
33
+ <div className="ib-phone">
34
+ <div className="ib-pane">
35
+ <div className="ib-head">
36
+ <h1>inbox</h1>
37
+ <Counts ib={ib} />
38
+ </div>
39
+ <InboxList app={app} />
40
+ </div>
41
+ {open != null ? <OpenItem app={app} item={open} /> : null}
42
+ </div>
43
+ )
44
+ return (
45
+ <div className="ib-desk">
46
+ <div className="ib-pane ib-listcol">
47
+ <div className="ib-head">
48
+ <h1>inbox</h1>
49
+ <Counts ib={ib} />
50
+ </div>
51
+ <InboxList app={app} />
52
+ </div>
53
+ <div className="ib-itemcol">{open != null ? <OpenItem app={app} item={open} /> : <div className="ph">{ib.count > 0 ? 'pick a row: it opens here' : ''}</div>}</div>
54
+ </div>
55
+ )
56
+ })
57
+
58
+ const Counts = observer(({ ib }: { ib: InboxSt }) =>
59
+ ib.page == null ? null : (
60
+ <span className="ib-counts">
61
+ {ib.count > 0 ? <b>{ib.count} for you</b> : <span>nothing for you</span>}
62
+ {ib.yellowCount > 0 ? <span className="ib-dim">{ib.yellowCount} can wait</span> : null}
63
+ </span>
64
+ ),
65
+ )
66
+
67
+ const InboxList = observer(({ app }: { app: HomeSt }) => {
68
+ const ib = app.inbox
69
+ const p = ib.page
70
+ return (
71
+ <div className="ib-list">
72
+ {ib.error !== '' ? <div className="err">✗ {ib.error}</div> : null}
73
+ {p == null ? (
74
+ ib.error === '' ? <div className="ib-wait"><span className="spin" />reading every repo…</div> : null
75
+ ) : ib.rows.length === 0 ? (
76
+ <div className="ib-clear">nothing waits on you ✨</div>
77
+ ) : (
78
+ ib.rows.map((r) => <Row key={r.key} app={app} r={r} />)
79
+ )}
80
+ {ib.more > 0 ? <button className="ib-more" onClick={() => ib.showMore()}>{ib.more} more</button> : null}
81
+ {ib.yellowCount > 0 ? (
82
+ <div className={`ib-fold${ib.yellowOpen ? ' on' : ''}`}>
83
+ <button className="ib-foldhead" aria-expanded={ib.yellowOpen} onClick={() => ib.toggleYellow()}>
84
+ <span className="ib-caret">{ib.yellowOpen ? '▾' : '▸'}</span>
85
+ <span>can wait</span>
86
+ <span className="ib-n">{ib.yellowCount}</span>
87
+ </button>
88
+ {ib.yellowOpen ? ib.yellowRows.map((r) => <Row key={r.key} app={app} r={r} />) : null}
89
+ </div>
90
+ ) : null}
91
+ {p != null && p.missing.length > 0 ? (
92
+ <div className="ib-missing">
93
+ {p.missing.map((m) => <div key={m.repo}><b>{m.repo}</b>: {m.why}, so its items are not here</div>)}
94
+ </div>
95
+ ) : null}
96
+ </div>
97
+ )
98
+ })
99
+
100
+ const Row = observer(({ app, r }: { app: HomeSt; r: InboxRow }) => {
101
+ const ib = app.inbox
102
+ const p = app.projects.list.find((x) => x.name === r.repo)
103
+ const on = ib.open?.repo === r.repo && ib.open.id === r.id
104
+ return (
105
+ <a className={`ib-row t-${r.tone}${on ? ' cur' : ''}`} href={r.open} onClick={(e) => {
106
+ if (!plainClick(e)) return
107
+ e.preventDefault()
108
+ ib.pick(r)
109
+ }}>
110
+ <span className="ib-face" title={r.repo}>{p != null ? <Face p={p} px={28} /> : <span className="pgi h0">{r.repo.charAt(0).toUpperCase()}</span>}</span>
111
+ <span className="ib-main">
112
+ <span className="ib-l1">
113
+ <span className={`ib-tag t-${r.tone}`} title={KIND_WORDS[r.kind]}>{r.tag}</span>
114
+ <span className="ib-title">{r.title}</span>
115
+ </span>
116
+ <span className="ib-l2">
117
+ <span className="ib-repo">{r.repo}</span>
118
+ {r.sub != null ? <span className="ib-sub">{r.sub}</span> : null}
119
+ {r.at != null ? <TimeAgo clock={ib.clock} at={r.at} /> : null}
120
+ </span>
121
+ </span>
122
+ {r.thumb != null ? <img className="ib-thumb" src={r.thumb} alt="" loading="lazy" decoding="async" draggable={false} /> : null}
123
+ </a>
124
+ )
125
+ })
126
+
127
+ /** the address of the item in its repo's own page */
128
+ const hubAddress = (repo: string, id: string, col: string | null): string =>
129
+ `${repoPage(repo)}#${hashFor(isReviewId(id) ? { t: 'review', id } : { t: 'item', col: col ?? '', id }) ?? ''}`
130
+
131
+ /** the item in its repo's own page, in place */
132
+ const openInHub = (app: HomeSt, repo: string, id: string, col: string | null): void => {
133
+ if (isReviewId(id)) app.openReview(repo, id)
134
+ else if (col != null) app.openItem(repo, col, id)
135
+ }
136
+
137
+ const OpenItem = observer(({ app, item }: { app: HomeSt; item: { repo: string; id: string } }) => {
138
+ // made by the move that opened it (InboxSt.fromSearch, HomeSt.openInbox)
139
+ const repo = app.repos.get(item.repo)
140
+ if (repo == null) return null
141
+ return <OpenIn app={app} repo={repo} id={item.id} />
142
+ })
143
+
144
+ const OpenIn = observer(({ app, repo, id }: { app: HomeSt; repo: RepoSt; id: string }) => {
145
+ const row = app.inbox.openRow
146
+ // its clock moves only while its repo shows: here it shows
147
+ useLayoutEffect(() => {
148
+ repo.clock.start()
149
+ return () => repo.clock.stop()
150
+ }, [repo])
151
+ if (isReviewId(id)) return <ReviewItem app={app} repo={repo} id={id} />
152
+ const col = row?.col ?? repo.cols.resources.find((r) => r.id === id)?.collection ?? null
153
+ return <NeedItem app={app} repo={repo} id={id} col={col} />
154
+ })
155
+
156
+ /** the line over an open item: back to the list on a phone, the repo, its own page */
157
+ const ItemTop = observer(({ app, repo, id, col }: { app: HomeSt; repo: RepoSt; id: string; col: string | null }) => {
158
+ const p = app.projects.list.find((x) => x.name === repo.name)
159
+ return (
160
+ <div className="rv-phonetop ib-top">
161
+ {app.inbox.phone ? <button className="ghost rv-back" aria-label="back to the inbox" onClick={() => app.inbox.back()}>◂</button> : null}
162
+ {p != null ? <Face p={p} px={20} /> : null}
163
+ <b>{repo.name}</b>
164
+ <span className="sp" />
165
+ <a className="ib-hub" href={hubAddress(repo.name, id, col)} title="open it in its repo's hub" onClick={(e) => {
166
+ if (!plainClick(e)) return
167
+ e.preventDefault()
168
+ openInHub(app, repo.name, id, col)
169
+ }}>
170
+ <Icon d={ICON.link} /> its hub
171
+ </a>
172
+ </div>
173
+ )
174
+ })
175
+
176
+ const ReviewItem = observer(({ app, repo, id }: { app: HomeSt; repo: RepoSt; id: string }) => {
177
+ const rv = repo.review
178
+ // before the first paint, so the column never draws the card the repo's page held
179
+ useLayoutEffect(() => {
180
+ rv.select(id)
181
+ rv.start()
182
+ return () => rv.stop()
183
+ }, [rv, id])
184
+ return (
185
+ <div className={app.inbox.phone ? 'rv-phone ib-open' : 'ib-open ib-review'}>
186
+ <ItemTop app={app} repo={repo} id={id} col={null} />
187
+ <ThreadColumn rv={rv} back={null} />
188
+ </div>
189
+ )
190
+ })
191
+
192
+ const NeedItem = observer(({ app, repo, id, col }: { app: HomeSt; repo: RepoSt; id: string; col: string | null }) => {
193
+ useLayoutEffect(() => {
194
+ void repo.cols.poll()
195
+ }, [repo, id])
196
+ const ready = repo.cols.loaded || repo.cols.cached
197
+ return (
198
+ <div className={app.inbox.phone ? 'ib-sheet ib-open' : 'ib-open'}>
199
+ <ItemTop app={app} repo={repo} id={id} col={col} />
200
+ <div className="ib-itembody">
201
+ {!ready ? <div className="ib-wait"><span className="spin" />reading {repo.name}…</div> : col == null ? <div className="ph">this no longer waits on you</div> : <ItemView app={repo} col={col} id={id} />}
202
+ </div>
203
+ </div>
204
+ )
205
+ })
@@ -0,0 +1,73 @@
1
+ /* the inbox (inbox-view.tsx): the list and the item side by side on a desktop, one pane at a time on a phone, where
2
+ the page covers the home as an app (the safe area kept clear, every target a thumb's size, no field under 16px) */
3
+ .ib-desk{flex:1;min-height:0;display:grid;grid-template-columns:minmax(300px,440px) minmax(0,1fr)}
4
+ .ib-pane{min-height:0;overflow-y:auto;overscroll-behavior:contain}
5
+ .ib-listcol{border-right:1px solid var(--line);background:var(--bg-side)}
6
+ .ib-itemcol{min-width:0;min-height:0;display:flex;flex-direction:column}
7
+ .ib-itemcol>.ph{margin:auto;color:var(--dim)}
8
+ .ib-head{display:flex;align-items:baseline;gap:var(--s3);padding:var(--s3) var(--s4) var(--s2)}
9
+ .ib-head h1{margin:0;font-size:22px;font-weight:700;letter-spacing:-.01em}
10
+ .ib-counts{display:flex;gap:var(--s3);font-size:13px;color:var(--ink)}
11
+ .ib-counts b{color:var(--review)}
12
+ .ib-dim{color:var(--dim)}
13
+ .ib-list{display:flex;flex-direction:column;padding:0 0 var(--s4)}
14
+ .ib-list>.err{color:var(--red);padding:var(--s2) var(--s4);font-size:13px}
15
+ .ib-wait{display:flex;align-items:center;gap:var(--s2);color:var(--dim);padding:var(--s4)}
16
+ .ib-clear{color:var(--dim);font-size:15px;padding:var(--s4)}
17
+
18
+ /* a row: the repo's icon, the kind and the title, the repo, a line and the age, the thumb; its tone a bar on its left */
19
+ a.ib-row,a.ib-row:visited{display:flex;align-items:center;gap:var(--s3);min-height:60px;padding:var(--s2) var(--s4) var(--s2) var(--s3);
20
+ color:var(--ink);text-decoration:none;border-left:3px solid transparent;border-bottom:1px solid var(--line);-webkit-tap-highlight-color:transparent}
21
+ a.ib-row:hover{background:var(--wash2)}
22
+ a.ib-row:active{background:var(--wash)}
23
+ a.ib-row.cur{background:var(--sel)}
24
+ a.ib-row.t-review{border-left-color:var(--review)}
25
+ a.ib-row.t-red{border-left-color:var(--red)}
26
+ a.ib-row.t-yellow{border-left-color:var(--warn)}
27
+ .ib-face{flex:none;width:28px;height:28px;display:flex}
28
+ .ib-face img,.ib-face .pgi{width:28px;height:28px;border-radius:7px;object-fit:contain;font-size:14px}
29
+ .ib-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:var(--s0)}
30
+ .ib-l1{display:flex;align-items:baseline;gap:var(--s2);min-width:0}
31
+ .ib-title{font-size:15px;line-height:1.3;font-weight:600;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow-wrap:anywhere}
32
+ .ib-tag{flex:none;font-size:11px;line-height:18px;font-weight:700;text-transform:lowercase;padding:0 var(--s1);border-radius:3px;border:1px solid currentColor}
33
+ .ib-tag.t-review{color:var(--review)}
34
+ .ib-tag.t-red{color:var(--red)}
35
+ .ib-tag.t-yellow{color:var(--warn)}
36
+ .ib-l2{display:flex;gap:var(--s2);font-size:12.5px;color:var(--dim);min-width:0;white-space:nowrap}
37
+ .ib-repo{flex:none;color:var(--ink);opacity:.75}
38
+ .ib-sub{overflow:hidden;text-overflow:ellipsis;min-width:0}
39
+ .ib-l2 .ago{flex:none;margin-left:auto}
40
+ .ib-thumb{flex:none;width:64px;height:48px;object-fit:cover;border-radius:4px;border:1px solid var(--line);background:var(--panel2)}
41
+
42
+ /* the folded list and the repos it could not read */
43
+ button.ib-more{margin:var(--s3) var(--s4) 0;min-height:44px;font-size:14px}
44
+ .ib-fold{margin-top:var(--s4);border-top:1px solid var(--line)}
45
+ button.ib-foldhead{display:flex;align-items:center;gap:var(--s2);width:100%;min-height:48px;padding:0 var(--s4);border:0;border-radius:0;
46
+ background:transparent;color:var(--dim);font-size:14px;text-align:left}
47
+ button.ib-foldhead:hover{color:var(--ink)}
48
+ .ib-caret{width:12px}
49
+ .ib-n{color:var(--warn);font-weight:700}
50
+ .ib-fold.on a.ib-row{opacity:.85}
51
+ .ib-missing{padding:var(--s3) var(--s4);color:var(--dim);font-size:12.5px;display:flex;flex-direction:column;gap:var(--s1)}
52
+
53
+ /* an open item: its line (the repo, its own page), then the item as its repo draws it */
54
+ .ib-open{flex:1;min-height:0;display:flex;flex-direction:column}
55
+ .ib-open>.rv-thread{flex:1;min-height:0;height:auto}
56
+ .ib-top{gap:var(--s2);min-height:44px}
57
+ .ib-top img,.ib-top .pgi{width:20px;height:20px;border-radius:5px;object-fit:contain}
58
+ .ib-top .sp{flex:1}
59
+ a.ib-hub,a.ib-hub:visited{display:inline-flex;align-items:center;gap:var(--s1);color:var(--accent);text-decoration:none;font-size:13px;min-height:44px;padding:0 var(--s2)}
60
+ a.ib-hub svg{width:14px;height:14px}
61
+ .ib-itembody{flex:1;min-height:0;display:flex;flex-direction:column;overflow-y:auto}
62
+
63
+ /* the phone: the inbox covers the home as an app; an open item covers the list, which stays where it was below it */
64
+ .ib-phone{position:fixed;inset:0;z-index:28;background:var(--bg);display:flex;flex-direction:column}
65
+ .ib-phone>.ib-pane{flex:1;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}
66
+ .ib-phone .ib-head{padding:var(--s4) var(--s4) var(--s3)}
67
+ .ib-phone .ib-head h1{font-size:28px}
68
+ .ib-sheet{position:fixed;inset:0;z-index:31;background:var(--bg);padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}
69
+ .ib-phone .rv-back{min-width:44px;min-height:44px}
70
+ .ib-phone input,.ib-phone textarea,.ib-phone select{font-size:16px}
71
+ .ib-phone .ib-pane button,.ib-sheet button{min-height:44px}
72
+ .ib-phone .stagewrap{padding:var(--s3)}
73
+ .ib-phone .colcard input{min-width:0}
@@ -0,0 +1,19 @@
1
+ // one item of a repo as its own page: the view its collection draws (a check's card, a wiki, the comfy panel, a test,
2
+ // the runs, any other row's card). The repo's page shows it under its tree, the inbox shows it in place
3
+ import { observer } from 'mobx-react-lite'
4
+ import { CheckCard } from './check-view.tsx'
5
+ import { ColCard } from './col-card.tsx'
6
+ import { ComfyView } from './comfy-view.tsx'
7
+ import type { RepoSt } from './repo-st.ts'
8
+ import { TestCard } from './test-view.tsx'
9
+ import { TimelineView } from './timeline-view.tsx'
10
+ import { WIKIS, WikisView } from './wikis-view.tsx'
11
+
12
+ export const ItemView = observer(({ app, col, id }: { app: RepoSt; col: string; id: string }) => {
13
+ if (col === WIKIS) return <WikisView app={app} id={id} />
14
+ if (col === 'comfy') return <ComfyView app={app} id={id} />
15
+ if (col === 'checks') return <div className="stagewrap"><CheckCard app={app} id={id} /></div>
16
+ if (col === 'tests') return <div className="stagewrap"><TestCard app={app} id={id} /></div>
17
+ if (col === 'runs') return <div className="stagewrap"><TimelineView app={app} /></div>
18
+ return <div className="stagewrap"><ColCard app={app} col={col} id={id} /></div>
19
+ })
@@ -1,13 +1,13 @@
1
1
  // the page's command keys, read the same on every layout: ⌘1 to ⌘9 select the
2
2
  // nth repo of the project list, ⌘↑ and ⌘↓ the repo above or below, then the home row under the right hand: ⌘J
3
- // the picker, ⌘K the overview, ⌘L the activity, ⌘; the insights, ⌘' the plan.
3
+ // the picker, ⌘K the overview, ⌘L the activity, ⌘; the insights, ⌘' the plan, and ⌘I above them the inbox.
4
4
  // ⌘B folds the project list to its icon rail and back (layout-st.ts), ⌘⇧B
5
5
  // cycles the dock at the bottom of the page (dock-st.ts): the line, slim, open.
6
6
  // A digit, the semicolon and the quote are read from the physical key (`code`), so an
7
7
  // AZERTY keyboard, where the key under 1 types `&`, selects the same repo. Ctrl stands in for
8
8
  // ⌘ off a Mac. The macOS app binds none of these to a menu item, so they
9
9
  // reach the page (tests/home-strip.test.tsx reads ShipkitGui.swift).
10
- export type PageKey = { t: 'repo'; n: number } | { t: 'step'; by: -1 | 1 } | { t: 'home' } | { t: 'planned' } | { t: 'activity' } | { t: 'insights' } | { t: 'picker' } | { t: 'dock' } | { t: 'rail' }
10
+ export type PageKey = { t: 'repo'; n: number } | { t: 'step'; by: -1 | 1 } | { t: 'home' } | { t: 'inbox' } | { t: 'planned' } | { t: 'activity' } | { t: 'insights' } | { t: 'picker' } | { t: 'dock' } | { t: 'rail' }
11
11
 
12
12
  type KeyLike = { key: string; code: string; metaKey: boolean; ctrlKey: boolean; shiftKey: boolean; altKey: boolean }
13
13
 
@@ -23,13 +23,14 @@ export function pageKey(e: KeyLike): PageKey | null {
23
23
  const k = e.key.toLowerCase()
24
24
  if (k === 'j') return { t: 'picker' }
25
25
  if (k === 'k') return { t: 'home' }
26
+ if (k === 'i') return { t: 'inbox' }
26
27
  if (k === 'l') return { t: 'activity' }
27
28
  if (k === 'b') return { t: 'rail' }
28
29
  return null
29
30
  }
30
31
 
31
32
  /** the shortcut each place of the home carries on its button */
32
- export const PLACE_KEY: Record<'overview' | 'planned' | 'activity' | 'insights', string> & Partial<Record<string, string>> = { overview: '⌘K', planned: "⌘'", activity: '⌘L', insights: '⌘;' }
33
+ export const PLACE_KEY: Record<'overview' | 'inbox' | 'planned' | 'activity' | 'insights', string> & Partial<Record<string, string>> = { overview: '⌘K', inbox: '⌘I', planned: "⌘'", activity: '⌘L', insights: '⌘;' }
33
34
  /** the picker's shortcut, on the first button, before home */
34
35
  export const PICKER_KEY = '⌘J'
35
36
  /** the repo above and below, hinted at the project list's foot */
@@ -1,5 +1,5 @@
1
1
  // the one picker of the page (cmd+j, keys.ts), a node of the root: the
2
- // home's places (home, activity, planned, insights, archived) first, then the shown repo's own jump
2
+ // home's places (inbox, home, activity, planned, insights, archived) first, then the shown repo's own jump
3
3
  // targets, then every other house repo as a place to go. Another repo's
4
4
  // resources are never listed: a jump to a repo selects it in place, and its
5
5
  // own targets are one more cmd+j away.
@@ -24,6 +24,7 @@ export class PaletteSt {
24
24
  const st = this.st
25
25
  if (st.machine == null) return []
26
26
  return [
27
+ { id: 'place:inbox', label: 'inbox', section: 'place', face: { place: 'inbox' }, run: () => st.navigate('/inbox') },
27
28
  { id: 'place:home', label: 'home', section: 'place', face: { place: 'home' }, run: () => st.navigate('/') },
28
29
  { id: 'place:activity', label: 'activity', section: 'place', face: { place: 'activity' }, run: () => st.navigate('/activity') },
29
30
  { id: 'place:planned', label: 'planned', section: 'place', face: { place: 'planned' }, run: () => st.navigate('/planned') },
@@ -41,6 +41,7 @@ export type ListHost = { projects: ProjectsSvc; layout?: { folded: boolean; togg
41
41
  * then the places, each with its shortcut (keys.ts) */
42
42
  const PLACES: { id: Place | 'picker'; label: string; title: string }[] = [
43
43
  { id: 'picker', label: 'jump to…', title: 'jump to a page, a repo or one of its resources' },
44
+ { id: 'inbox', label: 'inbox', title: 'everything that waits on you in every repo: cards, questions, asks and what is red' },
44
45
  { id: 'overview', label: 'overview', title: 'the overview: shipkit, every global process and every repo on this machine' },
45
46
  { id: 'activity', label: 'activity', title: 'what every repo committed lately, what it holds uncommitted, its branch and whether it is pushed' },
46
47
  { id: 'planned', label: 'planned', title: 'every check the machine runs on its own: now, next, late, and why' },
@@ -187,7 +187,7 @@ export function cardModel(p: Project, now: number): CardModel {
187
187
  }
188
188
 
189
189
  /** a page of the home that is no repo's */
190
- export type Place = 'overview' | 'planned' | 'activity' | 'insights'
190
+ export type Place = 'overview' | 'inbox' | 'planned' | 'activity' | 'insights'
191
191
 
192
192
  export class ProjectsSvc {
193
193
  /** the last list this browser saw until the first poll answers, so the
@@ -33,7 +33,7 @@ export type Sel = HashSel | null
33
33
 
34
34
  /** one picker target (cmd+j): run() fires the SAME action clicking would */
35
35
  /** what a picker entry wears: a repo's own icon, or a place's button icon */
36
- export type JumpFace = { repo: string } | { place: 'home' | 'planned' | 'activity' | 'insights' | 'archived' }
36
+ export type JumpFace = { repo: string } | { place: 'home' | 'inbox' | 'planned' | 'activity' | 'insights' | 'archived' }
37
37
  /** `key`: the shortcut that does the same, printed at the entry's end */
38
38
  export type Jump = { id: string; label: string; section: string; run: () => void; face?: JumpFace; key?: string }
39
39
 
@@ -142,6 +142,10 @@ export class ReviewSt {
142
142
  private toastTimer: ReturnType<typeof setTimeout> | null = null
143
143
  private searchTimer: ReturnType<typeof setTimeout> | null = null
144
144
  private timer: ReturnType<typeof setInterval> | null = null
145
+ /** the read a start began, while it runs */
146
+ private starting: { card: ThreadSt | null; p: Promise<void> } | null = null
147
+ /** the unit's words, read once a start, again after a stop */
148
+ private specRead: Promise<unknown> | null = null
145
149
  private readonly loadPage: () => Promise<ThreadPage>
146
150
  private readonly loadWatchers: () => Promise<Watcher[]>
147
151
  private readonly loadBoard: () => Promise<{ role: Role | null; rows: BoardRow[] }>
@@ -163,11 +167,13 @@ export class ReviewSt {
163
167
  } catch {
164
168
  // a broken pref is the default
165
169
  }
166
- makeAutoObservable<this, 'st' | 'toastTimer' | 'searchTimer' | 'timer' | 'loadPage' | 'loadWatchers' | 'loadBoard' | 'prefix'>(this, {
170
+ makeAutoObservable<this, 'st' | 'toastTimer' | 'searchTimer' | 'timer' | 'starting' | 'specRead' | 'loadPage' | 'loadWatchers' | 'loadBoard' | 'prefix'>(this, {
167
171
  st: false,
168
172
  toastTimer: false,
169
173
  searchTimer: false,
170
174
  timer: false,
175
+ starting: false,
176
+ specRead: false,
171
177
  loadPage: false,
172
178
  loadWatchers: false,
173
179
  loadBoard: false,
@@ -210,8 +216,12 @@ export class ReviewSt {
210
216
 
211
217
  /** the list, the watches and the open card, read now and every 2 s while the page shows; the unit's words once */
212
218
  start(): void {
213
- void this.refresh()
214
- void fetch(this.st.url('/api/review/spec'))
219
+ // the page starts more than once at boot (its resume, its address): one read while the first runs
220
+ if (this.starting?.card !== this.card) {
221
+ const p = this.refresh().finally(() => { if (this.starting?.p === p) this.starting = null })
222
+ this.starting = { card: this.card, p }
223
+ }
224
+ this.specRead ??= fetch(this.st.url('/api/review/spec'))
215
225
  .then((r) => (r.ok ? (r.json() as Promise<RepoSpec>) : null))
216
226
  .catch(() => null)
217
227
  .then((spec) => runInAction(() => (this.spec = spec)))
@@ -221,6 +231,7 @@ export class ReviewSt {
221
231
  stop(): void {
222
232
  if (this.timer !== null) clearInterval(this.timer)
223
233
  this.timer = null
234
+ this.specRead = null
224
235
  }
225
236
 
226
237
  async refresh(): Promise<void> {
@@ -247,6 +258,7 @@ export class ReviewSt {
247
258
  await this.refresh()
248
259
  void this.st.cols.poll(true)
249
260
  void this.st.home.projects.load()
261
+ if (this.st.home.page === 'inbox') void this.st.home.inbox.poll()
250
262
  }
251
263
 
252
264
  private openCard(id: string | null): void {
@@ -12,7 +12,8 @@ import { CellFrame, EventsLine } from './review-cells.tsx'
12
12
  import type { ReviewSt } from './review-st.ts'
13
13
  import { cellDom, type ThreadSt, type ViewMark } from './thread-st.ts'
14
14
 
15
- export const ThreadColumn = observer(({ rv }: { rv: ReviewSt }) => {
15
+ /** `back`: where the phone's ◂ goes, the cards when absent; null when the page around the column draws its own */
16
+ export const ThreadColumn = observer(({ rv, back }: { rv: ReviewSt; back?: (() => void) | null }) => {
16
17
  const el = useRef<HTMLDivElement | null>(null)
17
18
  useEffect(() => {
18
19
  const node = el.current
@@ -37,7 +38,7 @@ export const ThreadColumn = observer(({ rv }: { rv: ReviewSt }) => {
37
38
  <Empty text={rv.page ? 'No card. An agent adds one with sk review add.' : 'Reading the cards…'} />
38
39
  ) : (
39
40
  <>
40
- <TopBar rv={rv} card={card} />
41
+ <TopBar rv={rv} card={card} back={back} />
41
42
  <div className="rv-threadbody">
42
43
  <Cells rv={rv} card={card} />
43
44
  {rv.rail ? <Contents rv={rv} card={card} /> : rv.phone.on ? null : <Minimap rv={rv} card={card} dir="col" />}
@@ -56,13 +57,13 @@ export const ThreadColumn = observer(({ rv }: { rv: ReviewSt }) => {
56
57
 
57
58
  /** the card's bar: its title, where it stands, its lane, who listens, the copy for an agent, fold or unfold all, the
58
59
  * contents; on the phone a way back to the cards */
59
- const TopBar = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
60
+ const TopBar = observer(({ rv, card, back }: { rv: ReviewSt; card: ThreadSt; back?: (() => void) | null }) => {
60
61
  const v = card.data
61
62
  const row = rv.openRow
62
63
  return (
63
64
  <div className="rv-top">
64
65
  <div className="rv-topline">
65
- {rv.phone.on ? <button className="ghost rv-back" onClick={() => rv.phone.show('list')}>◂</button> : null}
66
+ {rv.phone.on && back !== null ? <button className="ghost rv-back" aria-label="back" onClick={() => (back != null ? back() : rv.phone.show('list'))}>◂</button> : null}
66
67
  <h2 className="rv-title">{v?.title ?? row?.title ?? card.id}</h2>
67
68
  {rv.phone.on ? null : <Waiting card={card} />}
68
69
  <button className="rv-copyid ghost" title="copy this card for an agent (C): its title, its repo, sk review show, its link" aria-label="copy this card for an agent" onClick={() => void rv.copyCard()}>
@@ -335,7 +335,7 @@ span.rv-pick{display:inline-block;border:1px solid;border-radius:4px;font-size:1
335
335
 
336
336
  /* ── the phone: the page covers the hub's panes, one pane at a time, the verdicts under the thumb ── */
337
337
  .rv-phone,.tr-phone{position:fixed;inset:0;z-index:30;background:var(--bg)}
338
- .rv-phone{display:flex;flex-direction:column}
338
+ .rv-phone{display:flex;flex-direction:column;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}
339
339
  .rv-phonetop{flex:none;display:flex;gap:var(--s2);align-items:center;padding:var(--s1) var(--s2);border-bottom:1px solid var(--line);background:var(--bg-top);font-size:13px}
340
340
  .rv-phonepane{flex:1;min-height:0;overflow-y:auto}
341
341
  .rv-phone .rv-thread{flex:1}
@@ -4,6 +4,7 @@
4
4
  // suite adds the case its declaration argued and the way back to the quick
5
5
  // tier.
6
6
  import { observer } from 'mobx-react-lite'
7
+ import { useEffect } from 'react'
7
8
  import { durationTone, fmtMs } from './dur.ts'
8
9
  import type { RepoSt } from './repo-st.ts'
9
10
  import type { Resource, SuiteFacts, TestFacts, TestRun } from './hub-types.ts'
@@ -69,8 +70,14 @@ const Declaration = observer(({ app, s }: { app: RepoSt; s: SuiteFacts }) => {
69
70
 
70
71
  export const TestCard = observer(({ app, id }: { app: RepoSt; id: string }) => {
71
72
  const i: Resource | null = app.cols.find('tests', id)
73
+ const file = i?.test?.file ?? null
74
+ const lastAt = i?.test?.runs[0]?.at ?? null
75
+ // the poll carries the last run only: the whole list is read here, again when a new run lands
76
+ useEffect(() => { if (file != null) void app.tests.loadRuns(file) }, [app, file, lastAt])
72
77
  if (i == null || i.test == null) return <div className="ph">this test file is gone: the repo moved on</div>
73
78
  const t = i.test
79
+ const kept = app.tests.runs.get(t.file)
80
+ const runs = kept != null && (kept[0]?.at ?? null) === lastAt ? kept : t.runs
74
81
  const fix = fixWords(t)
75
82
  const cmd = testCommand(t)
76
83
  return (
@@ -97,9 +104,9 @@ export const TestCard = observer(({ app, id }: { app: RepoSt; id: string }) => {
97
104
  <Row k="budget" help="what one file may cost in the quick tier"><span className="dnum dim">{fmtMs(t.budgetMs)}</span> per file</Row>
98
105
  </div>
99
106
  <Section title="last runs" help="the suite record: every run of this file the suite runner timed, newest first">
100
- {t.runs.length === 0
107
+ {runs.length === 0
101
108
  ? <div className="dim">no run recorded yet: the next run of {t.checkId ?? 'a test check'} records one</div>
102
- : <div className="rlist">{t.runs.map((r, n) => <RunLine key={`${r.at}:${n}`} app={app} r={r} slow={t.suite != null} />)}</div>}
109
+ : <div className="rlist">{runs.map((r, n) => <RunLine key={`${r.at}:${n}`} app={app} r={r} slow={t.suite != null} />)}</div>}
103
110
  </Section>
104
111
  {t.suite == null ? null : <Declaration app={app} s={t.suite} />}
105
112
  </div>
@@ -6,6 +6,7 @@ import { makeAutoObservable, observableRef, runInAction } from 'mobx'
6
6
  import type { TestCheckView, TestsRootView } from '../../collections/test-time.ts'
7
7
  import { testId } from '../../collections/collection-types.ts'
8
8
  import type { RepoSt } from './repo-st.ts'
9
+ import type { TestRun } from './hub-types.ts'
9
10
 
10
11
  export type { TestCheckView, TestsRootView }
11
12
 
@@ -16,9 +17,23 @@ export class TestsSvc {
16
17
  views = new Map<string, TestsRootView | TestCheckView>()
17
18
  errors = new Map<string, string>()
18
19
  loading = new Set<string>()
20
+ /** a test file's whole run list, read when its page opens: the poll
21
+ * carries its last run only (resources-wire.ts) */
22
+ runs = new Map<string, TestRun[]>()
19
23
 
20
24
  constructor(private st: RepoSt) {
21
- makeAutoObservable<this, 'st'>(this, { st: false, views: observableRef })
25
+ makeAutoObservable<this, 'st'>(this, { st: false, views: observableRef, runs: observableRef })
26
+ }
27
+
28
+ async loadRuns(file: string): Promise<void> {
29
+ try {
30
+ const r = await fetch(this.st.url(`/api/test-runs.json?file=${encodeURIComponent(file)}`))
31
+ if (!r.ok) return
32
+ const v = (await r.json()) as { runs: TestRun[] }
33
+ runInAction(() => { this.runs = new Map(this.runs).set(file, v.runs) })
34
+ } catch {
35
+ // the last run the poll carries stays on the page
36
+ }
22
37
  }
23
38
 
24
39
  root(): TestsRootView | null {
@@ -46,7 +46,7 @@ import { recordStamp } from './project-gutter.ts'
46
46
  import { shapeTimeline } from '../ledger/run-timeline.ts'
47
47
  import { readSuiteRuns, readSuites } from '../ledger/suite-log.ts'
48
48
  import { shapeTestCheck, shapeTestsRoot } from '../collections/test-time.ts'
49
- import type { TestFacts } from '../collections/collection-types.ts'
49
+ import type { NeedItem, TestFacts } from '../collections/collection-types.ts'
50
50
  import { declaredSlowFiles } from '../suite/test-units.ts'
51
51
  import { BUILD_TIMEOUT_MS, CHECK_TIMEOUT_MS } from '../collections/checks.ts'
52
52
  import { watchTracked } from './tracked-watch.ts'
@@ -113,11 +113,14 @@ export function configStamp(root: string): string {
113
113
  }
114
114
  }
115
115
 
116
+ /** the url a ping carries for what it pings: the home gives its inbox's */
117
+ export type PingLink = (fresh: NeedItem[]) => string | undefined
118
+
116
119
  /** a host that runs every gate as a detached job (the daemon): the cli the
117
120
  * job runs, so a reload of the host never kills a gate in flight */
118
121
  export type GateJobs = { cli: string; pollMs?: number }
119
122
 
120
- export async function resolveHubDeps(root: string, boot: RepoConfig, io: ServeIo, o?: { port?: number; base?: string; jobs?: GateJobs; planName?: string }): Promise<HubDeps & { plan: PlanSource }> {
123
+ export async function resolveHubDeps(root: string, boot: RepoConfig, io: ServeIo, o?: { port?: number; base?: string; jobs?: GateJobs; planName?: string; link?: PingLink }): Promise<HubDeps & { plan: PlanSource }> {
121
124
  // THE SWITCH WRITES repo.config.ts, so the surfaces built on the config
122
125
  // read the one on disk rather than the one this process booted with. A
123
126
  // toggle that never reached the rows would read as a toggle that did
@@ -403,7 +406,7 @@ export async function resolveHubDeps(root: string, boot: RepoConfig, io: ServeIo
403
406
  // a silent one reads as no blockers at all
404
407
  pingTick: (needs) =>
405
408
  pingTick(root, c.asks?.dir ?? LAYOUT.asks, needs, {
406
- link: c.serve?.publicHost != null ? `http://${c.serve.publicHost}:${port}${o?.base ?? ''}/?f=needs` : undefined,
409
+ link: o?.link ?? (() => (c.serve?.publicHost != null ? `http://${c.serve.publicHost}:${port}${o?.base ?? ''}/?f=needs` : undefined)),
407
410
  run: (cmd) => {
408
411
  const p = Bun.spawn(cmd, { stdout: 'ignore', stderr: 'pipe' })
409
412
  void p.exited.then(async (code) => {
@@ -477,6 +480,8 @@ export type LoadHubOpts = {
477
480
  fresh?: boolean
478
481
  /** every gate runs as a detached job this host follows */
479
482
  jobs?: GateJobs
483
+ /** the url a ping carries, in place of this hub's own page */
484
+ link?: PingLink
480
485
  }
481
486
 
482
487
  /** how long a save burst settles before the warm answers recompute */
@@ -488,7 +493,7 @@ let warming: Promise<void> = Promise.resolve()
488
493
 
489
494
  export async function loadHub(root: string, io: ServeIo, o: LoadHubOpts): Promise<HubRuntime> {
490
495
  const c = await loadRepoConfig(root, { fresh: o.fresh === true })
491
- const deps = await resolveHubDeps(root, c, io, { port: o.port, base: o.base, jobs: o.jobs, planName: o.planName })
496
+ const deps = await resolveHubDeps(root, c, io, { port: o.port, base: o.base, jobs: o.jobs, planName: o.planName, link: o.link })
492
497
  const name = deps.plan.repo
493
498
  deps.planned = () => o.plan.rows(name)
494
499
  deps.ask = (check) => {