rvlib-shipkit 2.23.0 → 2.24.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 (97) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/render.ts +28 -14
  4. package/src/agent-time/report.ts +46 -25
  5. package/src/agent-time/store.ts +30 -10
  6. package/src/agent-time/timeline.ts +43 -15
  7. package/src/asks/asks-queue.ts +32 -11
  8. package/src/checks/SK044-behind-upstream.check.ts +38 -0
  9. package/src/cli/cmd_Asks.ts +2 -0
  10. package/src/cli/cmd_Backup.ts +7 -5
  11. package/src/cli/cmd_Bump.ts +1 -0
  12. package/src/cli/cmd_Capacity.ts +26 -0
  13. package/src/cli/cmd_Check.ts +1 -0
  14. package/src/cli/cmd_Checks.ts +1 -0
  15. package/src/cli/cmd_Ci.ts +1 -0
  16. package/src/cli/cmd_Commands.ts +50 -14
  17. package/src/cli/cmd_Home.ts +0 -29
  18. package/src/cli/cmd_Hooks.ts +1 -0
  19. package/src/cli/cmd_Mv.ts +1 -0
  20. package/src/cli/cmd_Reflect.ts +1 -0
  21. package/src/cli/cmd_Releases.ts +1 -0
  22. package/src/cli/cmd_Review.ts +97 -14
  23. package/src/cli/cmd_Secret.ts +41 -2
  24. package/src/cli/cmd_Shot.ts +1 -0
  25. package/src/cli/cmd_Status.ts +1 -0
  26. package/src/cli/cmd_Time.ts +3 -1
  27. package/src/cli/cmd_Tmp.ts +82 -0
  28. package/src/cli/cmd_Wiki.ts +1 -0
  29. package/src/cli/registry.ts +13 -1
  30. package/src/collections/pings.ts +1 -1
  31. package/src/core/capacity.ts +71 -0
  32. package/src/core/check-runner.ts +86 -15
  33. package/src/core/motherhome.ts +67 -9
  34. package/src/core/slots.ts +49 -12
  35. package/src/core/trace-audit.ts +4 -1
  36. package/src/drill/run.ts +5 -2
  37. package/src/home/gui-app/ShipkitGui.swift +1 -0
  38. package/src/home/home-launchd.ts +11 -3
  39. package/src/home/home-routes.ts +11 -4
  40. package/src/home/machine-host.ts +65 -0
  41. package/src/home/machine-stores.ts +19 -17
  42. package/src/home/machine-temp.ts +493 -0
  43. package/src/home/other-macs.ts +74 -0
  44. package/src/home/run-daemon.ts +10 -2
  45. package/src/home/serve-web.ts +2 -2
  46. package/src/home/via-hub.ts +6 -1
  47. package/src/init-repo.ts +7 -3
  48. package/src/ledger/ledger.ts +6 -0
  49. package/src/ledger/store.ts +6 -0
  50. package/src/media-store/backup/keys.ts +21 -6
  51. package/src/media-store/backup/manifest.ts +52 -11
  52. package/src/media-store/backup/restore.ts +17 -10
  53. package/src/media-store/backup/run.ts +5 -2
  54. package/src/media-store/backup/sources.ts +2 -1
  55. package/src/mv/mv-md.ts +121 -42
  56. package/src/reflect/transcript.ts +56 -11
  57. package/src/releases/from-card.ts +45 -3
  58. package/src/releases/model.ts +6 -0
  59. package/src/releases/store.ts +8 -1
  60. package/src/repo-config.ts +5 -3
  61. package/src/review/cells.ts +24 -3
  62. package/src/review/format.ts +33 -9
  63. package/src/review/media-kind.ts +14 -11
  64. package/src/review/media-read.ts +6 -5
  65. package/src/review/model.ts +71 -3
  66. package/src/review/paste.ts +2 -1
  67. package/src/review/previews.ts +123 -36
  68. package/src/review/routes.ts +29 -18
  69. package/src/review/store.ts +74 -12
  70. package/src/review/threads.ts +7 -5
  71. package/src/secrets/copy.ts +110 -0
  72. package/src/secrets/list.ts +17 -7
  73. package/src/serve/hub-app/home-strip.css +5 -0
  74. package/src/serve/hub-app/home-strip.tsx +18 -0
  75. package/src/serve/hub-app/hub-app.tsx +2 -1
  76. package/src/serve/hub-app/hub.css +14 -0
  77. package/src/serve/hub-app/inbox.css +1 -0
  78. package/src/serve/hub-app/pull-refresh.tsx +88 -0
  79. package/src/serve/hub-app/review/review-cells.tsx +52 -13
  80. package/src/serve/hub-app/review/review-list.tsx +6 -1
  81. package/src/serve/hub-app/review/review-st.ts +6 -5
  82. package/src/serve/hub-app/review/review-thread.tsx +3 -1
  83. package/src/serve/hub-app/review/review-views.tsx +18 -11
  84. package/src/serve/hub-app/review/thread-st.ts +82 -14
  85. package/src/serve/hub-app/review.css +15 -2
  86. package/src/serve/hub-runtime.ts +2 -1
  87. package/src/serve/run-serve.ts +4 -2
  88. package/src/serve/serve-hub.ts +9 -2
  89. package/src/suite/child-tools.ts +45 -0
  90. package/src/suite/judge-suites.ts +10 -22
  91. package/src/suite/select.ts +83 -8
  92. package/src/suite/suite-cli.ts +38 -14
  93. package/src/suite/suite-cores.ts +68 -0
  94. package/src/suite/suite-reads-preload.ts +8 -6
  95. package/src/ts/config.ts +44 -0
  96. package/src/ts/rename.ts +11 -1
  97. package/src/home/claude-temp.ts +0 -139
@@ -40,10 +40,19 @@ export type TranscriptEvent =
40
40
  * hours after the agent handed back */
41
41
  | { kind: 'message'; at: number }
42
42
  | { kind: 'use'; at: number; id: string; name: string; detail: string }
43
- /** `perm`: how the call was allowed; `user` = it waited for the human, so its time is his */
44
- | { kind: 'result'; at: number; id: string; outcome: Outcome; code: number | null; perm: Perm }
43
+ /** `perm`: how the call was allowed; `user` = it waited for the human, so its time is his.
44
+ * `bg`: the call returned while its command runs on in the background
45
+ * (started so, or moved there at its timeout); its real end is a `bgend` */
46
+ | { kind: 'result'; at: number; id: string; outcome: Outcome; code: number | null; perm: Perm; bg: boolean }
47
+ /** a background run's task notification: the call `id` ended at `at`. One
48
+ * run can be written two or three times (queued, then delivered): the
49
+ * earliest is its end */
50
+ | { kind: 'bgend'; at: number; id: string; outcome: Outcome; code: number | null }
45
51
  /** an assistant text block: the agent talking, which can end its turn */
46
52
  | { kind: 'reply'; at: number }
53
+ /** the text block that ends the turn (stop_reason end_turn): the agent
54
+ * stopped, and what follows is a wait until something wakes it */
55
+ | { kind: 'end'; at: number }
47
56
 
48
57
  // wrappers the harness injects as user-role entries: none of them are typed
49
58
  const NOISE_PREFIXES = [
@@ -82,10 +91,15 @@ export type RawEntry = {
82
91
  isCompactSummary?: unknown
83
92
  /** `peer` on a sub-agent hand-back or another session's message */
84
93
  turnOrigin?: unknown
94
+ /** `{ kind: 'task-notification' }` on a background task's notification:
95
+ * a plain turn in a main session, a meta turn in a sub-agent */
96
+ origin?: { kind?: unknown }
97
+ /** attachment entries: a notification delivered mid-turn is a `queued_command` */
98
+ attachment?: { type?: unknown; prompt?: unknown }
85
99
  /** queue-operation entries only */
86
100
  operation?: unknown
87
101
  content?: unknown
88
- message?: { role?: unknown; content?: unknown; id?: unknown; model?: unknown; usage?: { input_tokens?: unknown; output_tokens?: unknown; cache_read_input_tokens?: unknown; cache_creation_input_tokens?: unknown } }
102
+ message?: { role?: unknown; content?: unknown; id?: unknown; model?: unknown; stop_reason?: unknown; usage?: { input_tokens?: unknown; output_tokens?: unknown; cache_read_input_tokens?: unknown; cache_creation_input_tokens?: unknown } }
89
103
  toolUseResult?: unknown
90
104
  /** on a tool_result entry: who allowed the call (`config`, `user_temporary`, …) */
91
105
  permissionDecision?: { source?: unknown; reasonType?: unknown }
@@ -244,15 +258,19 @@ export function eventsOf(entry: RawEntry): TranscriptEvent[] {
244
258
 
245
259
  if (entry.type === 'queue-operation') {
246
260
  const q = queuedPromptOf(entry)
247
- return q == null ? [] : [prompt(q, 'queued')]
261
+ if (q != null) return [prompt(q, 'queued')]
262
+ return entry.operation === 'enqueue' && typeof entry.content === 'string' ? bgEndsOf(entry.content, at) : []
248
263
  }
249
264
  if (Number.isNaN(at) && entry.type !== 'user') return []
265
+ // a notification that arrives while the agent works is attached to its next turn
266
+ if (entry.type === 'attachment') return entry.attachment?.type === 'queued_command' && typeof entry.attachment.prompt === 'string' ? bgEndsOf(entry.attachment.prompt, at) : []
250
267
  if (entry.type === 'assistant') {
251
268
  const blocks = Array.isArray(entry.message?.content) ? (entry.message.content as Block[]) : []
252
269
  const out: TranscriptEvent[] = []
270
+ const ends = entry.message?.stop_reason === 'end_turn'
253
271
  for (const b of blocks) {
254
272
  if (b?.type === 'tool_use' && typeof b.id === 'string' && typeof b.name === 'string') out.push({ kind: 'use', at, id: b.id, name: b.name, detail: detailOf(b.name, b.input) })
255
- else if (b?.type === 'text') out.push({ kind: 'reply', at })
273
+ else if (b?.type === 'text') out.push({ kind: ends ? 'end' : 'reply', at })
256
274
  }
257
275
  return out
258
276
  }
@@ -261,19 +279,46 @@ export function eventsOf(entry: RawEntry): TranscriptEvent[] {
261
279
  const content = entry.message?.content
262
280
  if (Array.isArray(content)) {
263
281
  const perm = permOf(entry.permissionDecision)
282
+ const extra = entry.toolUseResult != null && typeof entry.toolUseResult === 'object' ? (entry.toolUseResult as Record<string, unknown>) : {}
283
+ const bg = typeof extra.backgroundTaskId === 'string'
264
284
  for (const b of content as Block[]) {
265
285
  if (b?.type !== 'tool_result' || typeof b.tool_use_id !== 'string' || Number.isNaN(at)) continue
266
- const o = outcomeOf({ isError: b.is_error === true, text: resultText(b.content), extra: entry.toolUseResult })
267
- out.push({ kind: 'result', at, id: b.tool_use_id, ...o, perm })
286
+ const o = outcomeOf({ isError: b.is_error === true, text: resultText(b.content), extra })
287
+ out.push({ kind: 'result', at, id: b.tool_use_id, ...o, perm, bg })
268
288
  }
269
289
  }
270
290
  const typed = typedPromptOf(entry)
271
291
  if (typed != null) out.push(prompt(typed, 'typed'))
272
- else if (out.length === 0 && !Number.isNaN(at) && entry.isMeta === true && RELAYED.test(userText(entry) ?? '')) out.push({ kind: 'message', at })
273
- // a peer message (a sub-agent hand-back, another session's message) is written isMeta, yet it wakes the agent
274
- else if (out.length === 0 && !Number.isNaN(at) && (entry.isMeta !== true || entry.turnOrigin === 'peer') && entry.isCompactSummary !== true) {
275
- const text = userText(entry)
292
+ if (out.length > 0 || Number.isNaN(at)) return out
293
+ const text = userText(entry)
294
+ if (entry.isMeta === true && RELAYED.test(text ?? '')) out.push({ kind: 'message', at })
295
+ // a peer message (a sub-agent hand-back, another session's message) and a
296
+ // sub-agent's task notification are written isMeta, yet they wake the agent
297
+ else if ((entry.isMeta !== true || entry.turnOrigin === 'peer' || entry.origin?.kind === 'task-notification') && entry.isCompactSummary !== true) {
276
298
  if (text != null && text !== '') out.push({ kind: 'wake', at })
277
299
  }
300
+ if (text != null) out.push(...bgEndsOf(text, at))
301
+ return out
302
+ }
303
+
304
+ const NOTICE = /<task-notification>([\s\S]*?)<\/task-notification>/g
305
+ const tagOf = (body: string, name: string): string | null => new RegExp(`<${name}>([^<]*)</${name}>`).exec(body)?.[1]?.trim() ?? null
306
+
307
+ /** the background runs a notification text says ended: each one that names
308
+ * its call and a final status. `stopped` is a run the harness lost track of
309
+ * (its session ended first): no end is known, so none is given */
310
+ export function bgEndsOf(text: string, at: number): TranscriptEvent[] {
311
+ if (Number.isNaN(at) || !text.includes('<task-notification>')) return []
312
+ const out: TranscriptEvent[] = []
313
+ for (const m of text.matchAll(NOTICE)) {
314
+ const body = m[1] ?? ''
315
+ const id = tagOf(body, 'tool-use-id')
316
+ const status = tagOf(body, 'status')
317
+ if (id == null || id === '' || (status !== 'completed' && status !== 'failed' && status !== 'killed')) continue
318
+ const exit = /exit code (\d+)/.exec(tagOf(body, 'summary') ?? '')?.[1]
319
+ const code = exit == null ? null : Number(exit)
320
+ const outcome: Outcome = status === 'killed' ? 'interrupted' : code != null && code !== 0 ? 'exit' : status === 'failed' ? 'error' : 'ok'
321
+ out.push({ kind: 'bgend', at, id, outcome, code: outcome === 'exit' ? code : null })
322
+ }
278
323
  return out
279
324
  }
@@ -4,16 +4,16 @@
4
4
  // private in the Space. The card named is the thread's first version, so a later version approved again replaces its
5
5
  // change instead of adding a second
6
6
  import { ensureLocal } from '../review/media-read.ts'
7
- import { isApproved, verdictOf, type Item, type ReviewItem } from '../review/model.ts'
7
+ import { isApproved, verdictOf, type Item, type ReviewItem, type ReviewStatus } from '../review/model.ts'
8
8
  import { stageablesOf } from '../review/stage-card.ts'
9
- import { readAll, readItem, storeDir } from '../review/store.ts'
9
+ import { addMessage, readAll, readItem, storeDir } from '../review/store.ts'
10
10
  import { threadOfItem, threadsOf } from '../review/threads.ts'
11
11
  import { commitPaths } from '../social/writes.ts'
12
12
  import { idleBefore } from './before.ts'
13
13
  import type { PostRating } from '../identities/rating.ts'
14
14
  import { changesOf, isClip, NEXT, ratingOf, type Change, type Picture, type Shot } from './model.ts'
15
15
  import { keepPicture } from './pictures.ts'
16
- import { addChange, readRelease, undeclaredReleases, writeRelease } from './store.ts'
16
+ import { addChange, dropCardChange, readRelease, releaseVersions, undeclaredReleases, writeRelease } from './store.ts'
17
17
 
18
18
  /** the versions of a card, newest first, following `supersedes` */
19
19
  export function versionsOf(dir: string, x: ReviewItem): Item[] {
@@ -104,6 +104,48 @@ export async function onVerdict(root: string, id: string): Promise<string | null
104
104
  return file
105
105
  }
106
106
 
107
+ /** after an approval taken back (a reopen, or another verdict in its place): next.md drops the card's change, committed,
108
+ * while no version of its thread stays approved. What happened, in words for the card's thread; null when the card
109
+ * brought no change. A change already released stays, and the words say so */
110
+ export async function onTakeBack(root: string, id: string): Promise<string | null> {
111
+ const dir = storeDir(root)
112
+ const x = readItem(dir, id)
113
+ const versions = x ? versionsOf(dir, x) : []
114
+ if (!versions.some((v) => v.changelog)) return null
115
+ const card = versions.at(-1)!.id
116
+ const still = threadOfItem(id, threadsOf(readAll(dir).items))?.versions.find((v) => isApproved(verdictOf(v)?.status ?? 'rejected'))
117
+ if (still) return `the approval was taken back, and next.md keeps this card's change: its version ${still.item.id} is still approved`
118
+ const file = dropCardChange(root, card)
119
+ if (file) {
120
+ commitPaths([file], `releases: next drops the change of the card ${card}, its approval taken back`)
121
+ return 'the approval was taken back: next.md no longer holds this change (git keeps its words)'
122
+ }
123
+ const shipped = releaseVersions(root).find((v) => v !== NEXT && readRelease(root, v)?.categories.some((c) => c.changes.some((ch) => ch.card === card)))
124
+ return shipped ? `the approval was taken back, but this change already shipped in ${shipped}: that release still holds it` : null
125
+ }
126
+
127
+ /** what a change of the owner's answer does to next.md, from the hub or the CLI: an approval adds the card's change, an
128
+ * approval taken back (`was`, the status before) drops it. A failure and every take back say so on the card's thread and
129
+ * in the log, so the release never moves in silence */
130
+ export async function followAnswer(root: string, id: string, was: ReviewStatus | null): Promise<void> {
131
+ try {
132
+ const x = readItem(storeDir(root), id)
133
+ const now = x ? (verdictOf(x)?.status ?? null) : null
134
+ if (now !== null && isApproved(now)) await onVerdict(root, id)
135
+ else if (was !== null && isApproved(was)) {
136
+ const said = await onTakeBack(root, id)
137
+ if (said) {
138
+ console.error(`review: ${id}: ${said}`)
139
+ addMessage(storeDir(root), id, 'releases', said)
140
+ }
141
+ }
142
+ } catch (e) {
143
+ const why = (e as Error).message
144
+ console.error(`FAIL: the release did not follow the answer on ${id}: ${why}`)
145
+ addMessage(storeDir(root), id, 'releases', `the release did not follow this answer: ${why}. Run sk releases add --card ${id}, or edit .shipkit/releases/next.md`)
146
+ }
147
+ }
148
+
107
149
  /** the version of a card's thread a change stands for: its newest approved one, else its newest */
108
150
  function approvedOf(dir: string, id: string): ReviewItem | null {
109
151
  const t = threadOfItem(id, threadsOf(readAll(dir).items))
@@ -266,6 +266,12 @@ export function upsertChange(r: Release, category: string, change: Change): Rele
266
266
  return { ...r, categories: cats.filter((c) => c.changes.length > 0) }
267
267
  }
268
268
 
269
+ /** the release without the change of that card; a category left empty goes */
270
+ export const withoutCard = (r: Release, card: string): Release => ({
271
+ ...r,
272
+ categories: r.categories.map((c) => ({ ...c, changes: c.changes.filter((x) => x.card !== card) })).filter((c) => c.changes.length > 0),
273
+ })
274
+
269
275
  export const changesOf = (r: Release): Change[] => r.categories.flatMap((c) => c.changes)
270
276
 
271
277
  /** a change's key on a page: its card, else its title */
@@ -4,7 +4,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from 'node:f
4
4
  import { join } from 'node:path'
5
5
  import { atomicWrite } from '../core/locked-write.ts'
6
6
  import { LAYOUT } from '../core/layout.ts'
7
- import { byVersion, emptyRelease, fileOf, NEXT, parseRelease, renderRelease, upsertChange, type Change, type Release } from './model.ts'
7
+ import { byVersion, emptyRelease, fileOf, NEXT, parseRelease, renderRelease, upsertChange, withoutCard, type Change, type Release } from './model.ts'
8
8
 
9
9
  const FILE = /^(next|\d+\.\d+\.\d+)\.md$/
10
10
 
@@ -30,6 +30,13 @@ export function releaseVersions(root: string): string[] {
30
30
  .sort(byVersion)
31
31
  }
32
32
 
33
+ /** next without the change of that card, written; the file, or null when next holds no change of it */
34
+ export function dropCardChange(root: string, card: string): string | null {
35
+ const r = readRelease(root, NEXT)
36
+ if (!r?.categories.some((c) => c.changes.some((x) => x.card === card))) return null
37
+ return writeRelease(root, withoutCard(r, card))
38
+ }
39
+
33
40
  /** one release file, parsed; null when there is none */
34
41
  export function readRelease(root: string, version: string): Release | null {
35
42
  const f = releaseFile(root, version)
@@ -65,9 +65,11 @@ export type ServeConfig = {
65
65
  }
66
66
  /** agent/ graph entrypoint (default: index.md AND README.md) */
67
67
  agentIndex?: string
68
- /** off-machine hostname for the hub, as in a tailnet MagicDNS name. It
69
- * prints beside localhost and rides on every ping message, because a
70
- * phone cannot resolve localhost */
68
+ /** off-machine hostname for the hub, overriding this Mac's tailnet name,
69
+ * which is read from tailscale when this is absent. It prints beside
70
+ * localhost and rides on every ping message, because a phone cannot
71
+ * resolve localhost. A Mac's own name: never set it in a repo that
72
+ * more than one Mac checks out */
71
73
  publicHost?: string
72
74
  /** the ids of the global processes this repo needs (any house repo's
73
75
  * `globalProcess` unit files). The home rail marks the repo while one is off */
@@ -3,6 +3,10 @@
3
3
  // folds into one thread, nothing is rewritten). The paged list's rows and its query. Pure and browser safe: the routes
4
4
  // send these shapes, the hub page draws them
5
5
  import {
6
+ inWork,
7
+ UPDATE_WORDS,
8
+ updatesOf,
9
+ type UpdateState,
6
10
  isMarkItem,
7
11
  isReply,
8
12
  isStale,
@@ -86,6 +90,10 @@ export interface ReplyCell extends CellOf<'reply'> {
86
90
  op?: 'ask' | 'answer'
87
91
  /** the other party marked it seen */
88
92
  read: boolean
93
+ /** an agent's update: its number on the item from 1, its state, the view of the item that holds its media */
94
+ update?: { k: number; state: UpdateState; view?: number }
95
+ /** his hint on an update: the update's cell id, its number and state */
96
+ re?: { id: string; k: number; state: UpdateState }
89
97
  }
90
98
 
91
99
  /** what the owner or a player raised (its item, its opening words and rectangles), or the owner's mark on the subject */
@@ -176,6 +184,7 @@ function messageCells(x: ReviewItem, n: number, opening: Message | undefined): C
176
184
  const current = verdictOf(x)?.id
177
185
  const read = { agent: readBy(x, 'agent'), owner: readBy(x, 'owner') }
178
186
  const other = (who: string): Party => (partyOf(who) === 'owner' ? 'agent' : 'owner')
187
+ const updates = updatesOf(x)
179
188
  const out: Cell[] = []
180
189
  for (const m of x.thread) {
181
190
  if (m.op === 'seen' || m === opening) continue
@@ -204,7 +213,13 @@ function messageCells(x: ReviewItem, n: number, opening: Message | undefined): C
204
213
  out.push({ ...base, kind: 'note', ...(m.text !== undefined ? { text: m.text } : {}), rects: m.rects ?? [], ...(m.image ? { image: m.image } : {}), rate: r, read: wasRead, summary: `marked ${said}${m.text ? `: ${firstLine(m.text)}` : ''}` })
205
214
  } else if (isReply(m)) {
206
215
  const op = m.op === 'ask' || m.op === 'answer' ? m.op : undefined
207
- out.push({ ...base, kind: 'reply', text: m.text ?? '', ...(m.image ? { image: m.image } : {}), ...(op ? { op } : {}), read: wasRead, summary: firstLine(m.text) })
216
+ const k = updates.findIndex((u) => u.id === m.id)
217
+ const update = k >= 0 && m.update ? { k: k + 1, state: m.update.state, ...(m.update.view !== undefined ? { view: m.update.view } : {}) } : undefined
218
+ const rk = m.re ? updates.findIndex((u) => u.id === m.re) : -1
219
+ const reOn = rk >= 0 ? updates[rk]!.update : undefined
220
+ const re = reOn ? { id: `${id}/${m.re}`, k: rk + 1, state: reOn.state } : undefined
221
+ const said = update ? `${UPDATE_WORDS[update.state]}: ` : re ? `on update ${re.k}: ` : ''
222
+ out.push({ ...base, kind: 'reply', text: m.text ?? '', ...(m.image ? { image: m.image } : {}), ...(op ? { op } : {}), read: wasRead, ...(update ? { update } : {}), ...(re ? { re } : {}), summary: `${said}${firstLine(m.text)}` })
208
223
  } else if (m.op !== undefined) {
209
224
  const commit = m.fix?.commit
210
225
  out.push({
@@ -365,6 +380,8 @@ export interface ThreadRow {
365
380
  pair: boolean
366
381
  choice: boolean
367
382
  wip: boolean
383
+ /** the head's newest agent update: its state and line; its picture is the row's thumb when it carries one */
384
+ update?: { state: UpdateState; text: string; at: string }
368
385
  waits: boolean
369
386
  active: boolean
370
387
  /** agent words the owner has not read on any of its items */
@@ -446,6 +463,9 @@ function rowOf(t: Thread, items: readonly ReviewItem[], followed: ReadonlySet<st
446
463
  const m = x.thread.at(-1)?.at ?? x.item.created
447
464
  return m > u ? m : u
448
465
  }, h.item.created)
466
+ const newest = updatesOf(h).at(-1)
467
+ const shows = newest?.update?.view !== undefined ? h.item.views[newest.update.view] : undefined
468
+ const thumbOf = shows ?? first
449
469
  return {
450
470
  head: h.item.id,
451
471
  title: h.item.title,
@@ -461,11 +481,12 @@ function rowOf(t: Thread, items: readonly ReviewItem[], followed: ReadonlySet<st
461
481
  move: moveOf(stateOf(h, followed.has(h.item.id)).state),
462
482
  versions: t.versions.length,
463
483
  views: h.item.views.length,
464
- thumb: first ? thumbFileOf(first) || null : null,
484
+ thumb: thumbOf ? thumbFileOf(thumbOf) || null : null,
465
485
  clip: h.item.views.some((v) => !isGallery(v) && v.clip !== undefined),
466
486
  pair: first !== undefined && !isGallery(first) && isPair(first.files),
467
487
  choice: h.item.choice === true,
468
- wip: h.item.wip !== undefined,
488
+ wip: inWork(h),
489
+ ...(newest?.update ? { update: { state: newest.update.state, text: newest.text ?? '', at: newest.at } } : {}),
469
490
  waits: waits(h),
470
491
  active: isActive(t, now),
471
492
  unread: members.some((x) => unreadBy(x, 'owner').length > 0),
@@ -1,8 +1,17 @@
1
1
  // what `sk review inbox`, `show`, `watch`, `next` and `board` print of an item and its answer (wiki tools/shipkit/review.md):
2
2
  // one record per thread, rectangles normalized and in pixels, a frame note's cut, shot and time into it, and the lines the
3
3
  // repo's unit adds (a kind's facts, a source's), handed in as `more` so this module stays pure
4
- import { aboutText, isFrame, isGallery, isPair, NO_SPEC, placeText, stateOf, unreadBy, verdictOf, type Message, type Rect, type ReviewItem, type Spec, type Subject } from './model.ts'
5
- import { answererOf, conversationOf, openingOf, type Thread } from './threads.ts'
4
+ import { aboutText, isFrame, isGallery, isPair, NO_SPEC, placeText, stateOf, takenBackOf, unreadBy, updateTag, verdictOf, type Message, type Rect, type ReviewItem, type ReviewStatus, type Spec, type Subject } from './model.ts'
5
+ import { answererOf, conversationOf, membersOf, openingOf, type Thread } from './threads.ts'
6
+
7
+ /** what a message is in a thread beyond its words: ` [update 2 (still broken)]` on an agent's update, ` (on update 2
8
+ * (still broken))` on his hint about one */
9
+ const updateText = (x: ReviewItem, m: Message): string => {
10
+ const own = m.update ? updateTag(x, m.id) : null
11
+ if (own) return ` [${own}]`
12
+ const re = m.re ? updateTag(x, m.re) : null
13
+ return re ? ` (on ${re})` : ''
14
+ }
6
15
 
7
16
  /** the lines a repo's unit adds under an item's head, and its spec for the words */
8
17
  export interface Say {
@@ -46,11 +55,21 @@ export const refOf = (x: ReviewItem): string => (x.item.origin.by === 'player' ?
46
55
 
47
56
  /** one owner reply, for a monitor; on an item a card answers, it reads on the card's thread */
48
57
  export const replyLine = (x: ReviewItem, m: Message, card: ReviewItem | null = null): string =>
49
- `${(card ?? x).item.id} reply "${(card ?? x).item.title}"${card ? ` (on ${refOf(x)})` : ''}: ${flat(m.text ?? '')}${m.image ? ` [image thread/${m.image}]` : ''}`
58
+ `${(card ?? x).item.id} reply "${(card ?? x).item.title}"${card ? ` (on ${refOf(x)})` : ''}${updateText(x, m)}: ${flat(m.text ?? '')}${m.image ? ` [image thread/${m.image}]` : ''}`
59
+
60
+ const TOOK: Record<ReviewStatus, string> = { approved: 'approval', 'approved-with-fix': '« ok with a fix »', rejected: 'rejection', archived: '« archived, later »' }
61
+
62
+ /** each verdict he took back, unseen: what it was, when he gave it, and that it no longer holds */
63
+ export const takeBackTexts = (x: ReviewItem): { m: Message; text: string }[] =>
64
+ takenBackOf(x).map(({ m, took, given }) => ({
65
+ m,
66
+ text: `he took his ${TOOK[took]} back (given ${given}): the card waits for his answer again and that ${TOOK[took]} no longer holds; hold or undo what you did on it, then sk review seen ${x.item.id}`,
67
+ }))
50
68
 
51
- /** what watch prints of an item, each with the key it prints once under: an unseen feedback (again when sent again), each unseen reply */
69
+ /** what watch prints of an item, each with the key it prints once under: a verdict he took back, an unseen feedback (again
70
+ * when sent again), each unseen reply */
52
71
  export function watchLines(x: ReviewItem, items: readonly ReviewItem[] = []): { key: string; text: string }[] {
53
- const out: { key: string; text: string }[] = []
72
+ const out: { key: string; text: string }[] = takeBackTexts(x).map((t) => ({ key: `${x.item.id}#${t.m.id}`, text: `${x.item.id} taken back "${x.item.title}": ${t.text}` }))
54
73
  const f = verdictOf(x)
55
74
  if (f && !f.seen) out.push({ key: `${x.item.id}@${f.at}`, text: line(x) })
56
75
  const card = x.item.origin.by === 'agent' ? null : answererOf(x.item.id, items)
@@ -83,7 +102,11 @@ export function threadDetail(t: Thread, dir: string, full = false, say: Say = PL
83
102
  if (full) {
84
103
  const conv = conversationOf(t)
85
104
  if (conv.length > 0) out.push(' thread:')
86
- for (const m of conv) out.push(` ${m.who} ${m.at}${m.on === t.head.item.id ? '' : ` [on ${m.on}]`}: ${flat(m.text ?? '')}${m.image ? ` [image ${dir}/${m.on}/thread/${m.image}]` : ''}`)
105
+ const members = membersOf(t)
106
+ for (const m of conv) {
107
+ const of = members.find((y) => y.item.id === m.on)
108
+ out.push(` ${m.who} ${m.at}${m.on === t.head.item.id ? '' : ` [on ${m.on}]`}${of ? updateText(of, m) : ''}: ${flat(m.text ?? '')}${m.image ? ` [image ${dir}/${m.on}/thread/${m.image}]` : ''}`)
109
+ }
87
110
  }
88
111
  return out.join('\n')
89
112
  }
@@ -120,7 +143,7 @@ export function detail(x: ReviewItem, dir: string, full = false, followed = fals
120
143
  const head = ` "${r.title}" (${aboutText(r, say.spec)})`
121
144
  const frame = subjectText(r.subject)
122
145
  const sub = [...(frame ? [frame] : []), ...say.more(x)]
123
- const replies = unreadBy(x, 'agent').map((m) => ` reply ${m.at}: ${m.text}${m.image ? ` [image ${dir}/${r.id}/thread/${m.image}]` : ''}`)
146
+ const replies = unreadBy(x, 'agent').map((m) => ` reply ${m.at}${updateText(x, m)}: ${m.text}${m.image ? ` [image ${dir}/${r.id}/thread/${m.image}]` : ''}`)
124
147
  if (r.origin.by !== 'agent') {
125
148
  const st = stateOf(x, followed)
126
149
  const said = x.thread.filter((m) => m.who === 'owner' || m.who === 'player')
@@ -139,9 +162,10 @@ export function detail(x: ReviewItem, dir: string, full = false, followed = fals
139
162
  ...(image.length > 0 ? [` image: ${image.map((n) => `${dir}/${r.id}/${n}`).join(' ')}`] : []),
140
163
  ].join('\n')
141
164
  }
142
- if (!f) return [`${r.id} NO VERDICT YET`, head, ...sub, ...replies].join('\n')
165
+ const back = takeBackTexts(x).map((t) => ` taken back ${t.m.at}: ${t.text}`)
166
+ if (!f) return [`${r.id} ${back.length > 0 ? 'TAKEN BACK, NO VERDICT NOW' : 'NO VERDICT YET'}`, head, ...sub, ...back, ...replies].join('\n')
143
167
  const pick = pickText(x)
144
- const out = [`${r.id} ${f.status.toUpperCase()} ${f.at}`, head, ...sub, ...(pick ? [` ${pick}`] : []), ` comment: ${f.comment || '(none)'}`]
168
+ const out = [`${r.id} ${f.status.toUpperCase()} ${f.at}`, head, ...sub, ...back, ...(pick ? [` ${pick}`] : []), ` comment: ${f.comment || '(none)'}`]
145
169
  for (const t of reactionTexts(x)) out.push(` view ${t}`)
146
170
  const px = (v: number, of: number): number => Math.round(v * of)
147
171
  const views = r.views
@@ -1,6 +1,6 @@
1
1
  // the review store as a kind of the media store (wiki tools/shipkit/review.md, Media in the Space): each file a card's
2
2
  // views name, by the facts its item.json keeps; kept on the disk while its thread is active or spoke in the window; an
3
- // image's previews sent up before it goes
3
+ // image's previews and a clip's play copy sent up before it goes
4
4
  import { existsSync, statSync } from 'node:fs'
5
5
  import { join } from 'node:path'
6
6
  import type { MediaKind, MediaRow } from '../media-store/kind.ts'
@@ -9,7 +9,7 @@ import type { Space } from '../media-store/space.ts'
9
9
  import { threadIndex } from './cells.ts'
10
10
  import { previewKey, REVIEW_KIND } from './media-read.ts'
11
11
  import { mediaFilesOf } from './model.ts'
12
- import { previewFile, PREVIEW_W, type PreviewSize } from './previews.ts'
12
+ import { playsCopy, previewFile, PREVIEW_W, type PreviewSize } from './previews.ts'
13
13
  import { fillMedia, readAll, readAllCached, storeDir, storeStamp } from './store.ts'
14
14
  import { membersOf } from './threads.ts'
15
15
 
@@ -63,22 +63,25 @@ export const reviewMedia: MediaKind = {
63
63
  return (r) => ({ pinned: pinned.has(r.item), used: used.get(r.item) })
64
64
  },
65
65
  async beforePurge(dir, space, r) {
66
- if (IMAGE.test(r.name) && !r.name.startsWith('thread/')) await previewsUp(dir, space, r)
66
+ if (r.name.startsWith('thread/')) return
67
+ if (IMAGE.test(r.name)) await previewsUp(dir, space, r, Object.keys(PREVIEW_W) as PreviewSize[], 'webp')
68
+ else if (playsCopy(dir, r.item, r.name)) await previewsUp(dir, space, r, ['fit'], 'mp4')
67
69
  },
68
70
  }
69
71
 
70
- /** an image's previews made (when the cache lacks them) and sent up, before the image leaves the disk: a PUT and a
71
- * HEAD each, none for a preview the index saw up */
72
- async function previewsUp(dir: string, space: Space, r: { item: string; name: string; key: string }): Promise<void> {
72
+ /** a file's previews made (when the cache lacks them) and sent up, before the file leaves the disk: an image's webps,
73
+ * a clip's play copy; a PUT and a HEAD each, none for a preview the index saw up */
74
+ async function previewsUp(dir: string, space: Space, r: { item: string; name: string; key: string }, sizes: readonly PreviewSize[], ext: 'webp' | 'mp4'): Promise<void> {
73
75
  const sha = r.key.slice(`${REVIEW_KIND}/`.length).replace(/\.[^.]+$/, '')
74
- for (const size of Object.keys(PREVIEW_W) as PreviewSize[]) {
75
- const key = previewKey({ sha }, size)
76
- // up already: a card that shares the image, or a purge that stopped after it
76
+ for (const size of sizes) {
77
+ const key = previewKey({ sha }, size, ext)
78
+ // up already: a card that shares the file, or a purge that stopped after it
77
79
  if (isUp(key)) continue
78
80
  const file = await previewFile(dir, r.item, r.name, size)
79
- if (!file || !existsSync(file)) continue
81
+ // a copy that failed answers the clip itself, never sent up as its preview
82
+ if (!file || !existsSync(file) || file === join(dir, r.item, r.name)) continue
80
83
  const n = statSync(file).size
81
- await space.put(key, file, 'image/webp')
84
+ await space.put(key, file, ext === 'mp4' ? 'video/mp4' : 'image/webp')
82
85
  if ((await space.head(key))?.size === n) recordUp(key, n)
83
86
  }
84
87
  }
@@ -11,8 +11,9 @@ export const REVIEW_KIND = 'review'
11
11
 
12
12
  /** where the Space keeps a file of a card */
13
13
  export const reviewKey = (f: Pick<MediaFact, 'sha'>, name: string): string => mediaKey(REVIEW_KIND, f, name)
14
- /** where the Space keeps an image's preview at a size: by the image's own sha, so it is found from the item alone */
15
- export const previewKey = (f: Pick<MediaFact, 'sha'>, size: string): string => `${REVIEW_KIND}/${f.sha}.${size}.webp`
14
+ /** where the Space keeps a file's preview at a size (an image's webp, a clip's play copy): by the file's own sha, so it
15
+ * is found from the item alone */
16
+ export const previewKey = (f: Pick<MediaFact, 'sha'>, size: string, ext: 'webp' | 'mp4' = 'webp'): string => `${REVIEW_KIND}/${f.sha}.${size}.${ext}`
16
17
 
17
18
  /** the fact a head keeps for one of its files, read from its item.json alone */
18
19
  export function factOfFile(dir: string, id: string, name: string): MediaFact | null {
@@ -31,10 +32,10 @@ export async function remoteUrl(dir: string, id: string, name: string): Promise<
31
32
  return f ? signedUrl(reviewKey(f, name), f.size) : null
32
33
  }
33
34
 
34
- /** a signed URL for an image's preview at a size, when the Space holds it */
35
- export async function remotePreviewUrl(dir: string, id: string, name: string, size: string): Promise<string | null> {
35
+ /** a signed URL for a file's preview at a size, when the Space holds it */
36
+ export async function remotePreviewUrl(dir: string, id: string, name: string, size: string, ext: 'webp' | 'mp4' = 'webp'): Promise<string | null> {
36
37
  const f = factOfFile(dir, id, name)
37
- return f ? signedIfUp(previewKey(f, size)) : null
38
+ return f ? signedIfUp(previewKey(f, size, ext)) : null
38
39
  }
39
40
 
40
41
  /** the path of an item's file on the disk, fetched back from the Space first when the disk let it go; null when neither
@@ -378,6 +378,17 @@ export interface ReviewReaction {
378
378
  export const OPS = ['dispatch', 'ask', 'answer', 'reassign', 'claim', 'release', 'blocked', 'fixed', 'done', 'wontfix', 'drop', 'withdraw', 'reopen', 'ready', 'seen'] as const
379
379
  export type Op = (typeof OPS)[number]
380
380
 
381
+ /** what an agent's update says of the work, at a glance: still broken, better, or fixed (it asks the owner's verdict again) */
382
+ export const UPDATE_STATES = ['broken', 'better', 'fixed'] as const
383
+ export type UpdateState = (typeof UPDATE_STATES)[number]
384
+ export const UPDATE_WORDS: Record<UpdateState, string> = { broken: 'still broken', better: 'better', fixed: 'fixed' }
385
+
386
+ /** an agent's progress post on a card: its state, and the view of the card that holds its picture, clip or sound */
387
+ export interface MessageUpdate {
388
+ state: UpdateState
389
+ view?: number
390
+ }
391
+
381
392
  /** one act on an item, one file of `thread/`, never rewritten */
382
393
  export interface Message {
383
394
  id: string
@@ -403,6 +414,10 @@ export interface Message {
403
414
  /** `seen`: the messages it read */
404
415
  of?: string[]
405
416
  fix?: { commit: string }
417
+ /** an agent's update: its line in `text`, its media a view of the item */
418
+ update?: MessageUpdate
419
+ /** his word on one message of the thread (a hint on an update): its id */
420
+ re?: string
406
421
  }
407
422
 
408
423
  /** what the store reads of one folder, what the list sends */
@@ -449,10 +464,28 @@ export function textOf(v: unknown): { text: string } | { error: string } {
449
464
  const readBy = (x: ReviewItem, party: Party): Set<string> =>
450
465
  new Set(x.thread.flatMap((m) => (m.op === 'seen' && partyOf(m.who) === party ? (m.of ?? []) : [])))
451
466
 
452
- /** the talk of the other party that `party` has not read: replies, verdicts, ratings */
467
+ /** the owner took a verdict back on an agent's card: news for the agent, which may have acted on that verdict */
468
+ const isTakeBack = (x: ReviewItem, m: Message): boolean => m.op === 'reopen' && m.who === 'owner' && x.item.origin.by === 'agent'
469
+
470
+ /** the talk of the other party that `party` has not read: replies, verdicts, ratings, his verdicts taken back */
453
471
  const unreadTalk = (x: ReviewItem, party: Party): Message[] => {
454
472
  const read = readBy(x, party)
455
- return x.thread.filter((m) => isTalk(m) && partyOf(m.who) !== party && !read.has(m.id))
473
+ return x.thread.filter((m) => (isTalk(m) || isTakeBack(x, m)) && partyOf(m.who) !== party && !read.has(m.id))
474
+ }
475
+
476
+ /** each verdict the owner took back that no agent marked seen: his reopen and the verdict it took back */
477
+ export function takenBackOf(x: ReviewItem): { m: Message; took: ReviewStatus; given: string }[] {
478
+ const unread = new Set(unreadTalk(x, 'agent').map((m) => m.id))
479
+ const out: { m: Message; took: ReviewStatus; given: string }[] = []
480
+ let v: Message | undefined
481
+ for (const n of x.thread) {
482
+ if (n.verdict !== undefined) v = n
483
+ else if (n.op === 'reopen' || isFixedUpdate(n)) {
484
+ if (v?.verdict && isTakeBack(x, n) && unread.has(n.id)) out.push({ m: n, took: v.verdict, given: v.at })
485
+ v = undefined
486
+ }
487
+ }
488
+ return out
456
489
  }
457
490
 
458
491
  /** the replies of the other party `party` has not read; a verdict is no reply (verdictOf says whether it was seen) */
@@ -474,12 +507,26 @@ export interface Verdict {
474
507
  seen: boolean
475
508
  }
476
509
 
510
+ /** an agent's update saying the work is fixed: it asks the owner's verdict again, as a reopen does */
511
+ const isFixedUpdate = (m: Message): boolean => m.update?.state === 'fixed' && partyOf(m.who) === 'agent'
512
+
513
+ /** the agent's updates on an item, oldest first */
514
+ export const updatesOf = (x: ReviewItem): Message[] => x.thread.filter((m) => m.update !== undefined && partyOf(m.who) === 'agent')
515
+
516
+ /** an update as the CLI and the page name it: `update 3 (still broken)`; null for a message that is no update */
517
+ export function updateTag(x: ReviewItem, id: string): string | null {
518
+ const all = updatesOf(x)
519
+ const k = all.findIndex((m) => m.id === id)
520
+ const u = all[k]?.update
521
+ return u ? `update ${k + 1} (${UPDATE_WORDS[u.state]})` : null
522
+ }
523
+
477
524
  export function verdictOf(x: ReviewItem): Verdict | null {
478
525
  let m: Message | undefined
479
526
  let text: string | undefined
480
527
  let rects: Rect[] | undefined
481
528
  for (const n of x.thread) {
482
- if (n.op === 'reopen') [m, text, rects] = [undefined, undefined, undefined]
529
+ if (n.op === 'reopen' || isFixedUpdate(n)) [m, text, rects] = [undefined, undefined, undefined]
483
530
  else if (n.verdict !== undefined) {
484
531
  if (m?.verdict !== n.verdict) [text, rects] = [undefined, undefined]
485
532
  m = n
@@ -574,6 +621,14 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
574
621
  s = { ...keep, state: 'closed', why: 'rated' }
575
622
  continue
576
623
  }
624
+ // an agent's update on its card: still broken or better holds it in work, fixed asks the owner's verdict again
625
+ if (m.update !== undefined && i.origin.by === 'agent' && partyOf(m.who) === 'agent') {
626
+ if (m.update.state === 'fixed') {
627
+ if (s.state === 'draft' || s.state === 'claimed' || s.state === 'closed') s = { ...keep, state: 'asks' }
628
+ given = s
629
+ } else if (s.state === 'asks') s = { ...keep, state: 'draft' }
630
+ continue
631
+ }
577
632
  // the owner's words on a question answer it: it goes back to the dispatcher
578
633
  if (m.op === undefined && partyOf(m.who) === 'owner' && m.text !== undefined && s.state === 'question') {
579
634
  s = { ...keep, state: 'new' }
@@ -599,6 +654,9 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
599
654
  case 'blocked':
600
655
  s = { ...keep, state: 'blocked' }
601
656
  break
657
+ case 'ready':
658
+ if (s.state === 'draft') s = { ...keep, state: 'asks' }
659
+ break
602
660
  case 'fixed':
603
661
  s = { ...keep, state: 'closed', why: 'fixed' }
604
662
  break
@@ -628,6 +686,9 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
628
686
  return s
629
687
  }
630
688
 
689
+ /** a card in work: a draft on a live shot, or an agent's card its latest update calls still broken or better */
690
+ export const inWork = (x: ReviewItem): boolean => stateOf(x, false).state === 'draft'
691
+
631
692
  /** the states each op leaves from */
632
693
  const FROM: Record<Exclude<Op, 'seen'>, readonly State[]> = {
633
694
  dispatch: ['new', 'blocked'],
@@ -935,6 +996,13 @@ export function messageProblems(v: unknown, name: string): string[] {
935
996
  for (const k of ['text', 'image', 'note']) if (v[k] !== undefined && typeof v[k] !== 'string') out.push(`${k}: a text`)
936
997
  if (v.pick !== undefined && !(Number.isInteger(v.pick) && (v.pick as number) >= 0 && v.verdict !== undefined)) out.push('pick: a view index, on a verdict')
937
998
  if (v.op === 'seen' && !(Array.isArray(v.of) && v.of.every((x) => typeof x === 'string'))) out.push('of: the ids a seen message read')
999
+ if (v.update !== undefined) {
1000
+ const u = v.update
1001
+ if (!obj(u) || !UPDATE_STATES.includes(u.state as UpdateState) || (u.view !== undefined && !(Number.isInteger(u.view) && (u.view as number) >= 0)))
1002
+ out.push(`update: { state: ${UPDATE_STATES.join(', ')}, view? }`)
1003
+ if (typeof v.text !== 'string') out.push('update: its line in text')
1004
+ }
1005
+ if (v.re !== undefined && !(typeof v.re === 'string' && MESSAGE_RE.test(v.re))) out.push('re: the id of a message of the thread')
938
1006
  if (v.op === undefined && v.verdict === undefined && v.rate === undefined && typeof v.text !== 'string' && !Array.isArray(v.rects))
939
1007
  out.push('a message says something: text, rects, verdict, rate or op')
940
1008
  return out
@@ -5,6 +5,7 @@ import { homedir } from 'node:os'
5
5
  import { homePort } from '../home/home-paths.ts'
6
6
  import { loadRepoConfig } from '../repo-config.ts'
7
7
  import { defaultHubPort } from '../serve/hub-port.ts'
8
+ import { machinePublicHost } from '../home/machine-host.ts'
8
9
 
9
10
  export interface PasteHosts {
10
11
  /** the repo's path, `~` for the home folder */
@@ -18,7 +19,7 @@ export interface PasteHosts {
18
19
  export async function pasteHosts(root: string): Promise<PasteHosts> {
19
20
  const c = await loadRepoConfig(root)
20
21
  const home = homedir()
21
- const host = c.serve?.publicHost
22
+ const host = machinePublicHost(c)
22
23
  return {
23
24
  root: root.startsWith(`${home}/`) ? `~${root.slice(home.length)}` : root,
24
25
  open: `http://localhost:${homePort()}/r/${encodeURIComponent(c.name)}/`,