rvlib-shipkit 2.11.0 → 2.13.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.
- package/CHANGELOG.md +56 -12
- package/README.md +1 -1
- package/package.json +4 -2
- package/src/agent-time/store.ts +2 -2
- package/src/check.ts +1 -1
- package/src/checks/SK001-package-json-shape.check.ts +4 -0
- package/src/checks/SK003-claude-md-shape.check.ts +1 -1
- package/src/checks/SK004-gitignore-policy.check.ts +27 -2
- package/src/checks/SK005-rvlib-versions.check.ts +1 -1
- package/src/checks/SK008-reviewer-agent.check.ts +2 -2
- package/src/checks/SK012-config-barrel-import.check.ts +1 -1
- package/src/checks/SK015-nested-repo.check.ts +1 -1
- package/src/checks/SK035-public-clean.check.ts +46 -0
- package/src/checks/SK036-draft-media-size.check.ts +28 -0
- package/src/cli/cmd_Backup.ts +152 -0
- package/src/cli/cmd_Ci.ts +8 -11
- package/src/cli/cmd_Drill.ts +145 -0
- package/src/cli/cmd_Home.ts +50 -3
- package/src/cli/cmd_Media.ts +96 -5
- package/src/cli/cmd_Review.ts +8 -2
- package/src/cli/cmd_Shot.ts +5 -2
- package/src/cli/cmd_Smoke.ts +4 -1
- package/src/cli/cmd_Social.ts +226 -0
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +9 -2
- package/src/cli/cmd_Veille.ts +173 -0
- package/src/cli/family-pages.ts +3 -0
- package/src/cli/registry.ts +13 -2
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +1 -49
- package/src/collections/checks.ts +2 -1
- package/src/collections/collection-types.ts +11 -2
- package/src/collections/providers.ts +4 -4
- package/src/collections/review.ts +2 -1
- package/src/collections/tests.ts +19 -8
- package/src/contracts/apply-contracts.ts +1 -3
- package/src/contracts/contract-manifests.ts +2 -3
- package/src/contracts/contract-types.ts +0 -1
- package/src/contracts/contracts-engine.ts +0 -3
- package/src/core/app-icon.ts +9 -3
- package/src/core/bun-builtins.ts +2 -2
- package/src/core/discover-checks.ts +37 -5
- package/src/core/fix-scope.ts +4 -2
- package/src/core/floor-resolve.ts +68 -48
- package/src/core/floor.ts +9 -0
- package/src/core/git-root.ts +24 -0
- package/src/core/last-good.ts +3 -1
- package/src/core/layout.ts +8 -0
- package/src/core/log-stamp.ts +36 -0
- package/src/core/loop-watch.ts +93 -0
- package/src/core/machine-link.ts +134 -0
- package/src/core/memory-watch.ts +41 -0
- package/src/core/one-way-in-policy.ts +27 -19
- package/src/core/run-ci.ts +6 -8
- package/src/core/run-fixers.ts +9 -9
- package/src/core/slots.ts +21 -0
- package/src/core/tree-rev.ts +60 -0
- package/src/core/unit-files.ts +42 -0
- package/src/drill/render.ts +140 -0
- package/src/drill/run.ts +269 -0
- package/src/fleet/scan-fleet.ts +6 -5
- package/src/home/daemon-jobs.ts +201 -0
- package/src/home/global-context.ts +34 -1
- package/src/home/home-routes.ts +22 -15
- package/src/home/hubs.ts +10 -3
- package/src/home/inbox-shape.ts +61 -6
- package/src/home/inbox.ts +75 -4
- package/src/home/lib-watch.ts +10 -3
- package/src/home/machine-stores.ts +15 -29
- package/src/home/run-daemon.ts +15 -18
- package/src/home/run-pm.ts +2 -0
- package/src/home/serve-daemon.ts +4 -3
- package/src/home/serve-web.ts +110 -1
- package/src/hooks/commit-message.ts +28 -19
- package/src/hooks/leak-guard.ts +10 -3
- package/src/hooks/run-hooks.ts +2 -6
- package/src/identities/identities.ts +334 -0
- package/src/identities/machine-route.ts +126 -0
- package/src/identities/machine.ts +62 -0
- package/src/init-repo.ts +1 -1
- package/src/ledger/check-stats.ts +10 -9
- package/src/ledger/gate-checks.ts +32 -1
- package/src/ledger/record-kept.ts +112 -0
- package/src/ledger/repo-view.ts +10 -0
- package/src/ledger/run-log.ts +17 -12
- package/src/ledger/run-timeline.ts +8 -4
- package/src/ledger/store.ts +7 -0
- package/src/ledger/suite-log.ts +17 -13
- package/src/media-kinds.ts +9 -1
- package/src/media-store/backup/daemon.ts +73 -0
- package/src/media-store/backup/keys.ts +25 -0
- package/src/media-store/backup/manifest.ts +193 -0
- package/src/media-store/backup/restore.ts +192 -0
- package/src/media-store/backup/run.ts +278 -0
- package/src/media-store/backup/secret.ts +86 -0
- package/src/media-store/backup/snapshot.ts +64 -0
- package/src/media-store/backup/sources.ts +199 -0
- package/src/media-store/content.ts +11 -1
- package/src/media-store/daemon.ts +56 -70
- package/src/media-store/hand.ts +58 -0
- package/src/media-store/put.ts +122 -0
- package/src/media-store/space.ts +73 -11
- package/src/pages/forward.ts +35 -0
- package/src/pages/frame-client.ts +118 -0
- package/src/pages/routes.ts +29 -0
- package/src/pages/unit.ts +92 -0
- package/src/plan/planner.ts +12 -0
- package/src/plan/repo-source.ts +19 -5
- package/src/reflect/transcript.ts +35 -10
- package/src/release/public-clean.ts +301 -0
- package/src/release/published-here.ts +22 -0
- package/src/release/run-bump.ts +2 -1
- package/src/release/run-release.ts +4 -1
- package/src/repo-config.ts +53 -2
- package/src/review/http.ts +16 -2
- package/src/review/media-kind.ts +3 -3
- package/src/review/media-read.ts +3 -3
- package/src/review/model.ts +24 -5
- package/src/review/notes.ts +77 -0
- package/src/review/project.ts +6 -38
- package/src/review/routes.ts +8 -13
- package/src/review/store.ts +46 -4
- package/src/review/trailer-media.ts +24 -3
- package/src/review/trailer-shots.ts +106 -0
- package/src/review/unit.ts +1 -1
- package/src/scaffold/files/agent-handoff.md +3 -0
- package/src/scaffold/files/agent-index.md +4 -12
- package/src/scaffold/project-scaffold.ts +5 -4
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/col-card.tsx +3 -17
- package/src/serve/hub-app/col-tables-view.tsx +2 -1
- package/src/serve/hub-app/cols-svc.ts +12 -14
- package/src/serve/hub-app/dock-st.ts +4 -2
- package/src/serve/hub-app/dock-view.tsx +2 -0
- package/src/serve/hub-app/frames-st.ts +35 -0
- package/src/serve/hub-app/hash-route.ts +64 -1
- package/src/serve/hub-app/home-st.ts +31 -7
- package/src/serve/hub-app/home-strip.css +9 -1
- package/src/serve/hub-app/home-strip.tsx +7 -6
- package/src/serve/hub-app/home.html +5 -0
- package/src/serve/hub-app/hub-app.tsx +49 -5
- package/src/serve/hub-app/hub.css +29 -11
- package/src/serve/hub-app/icons.tsx +16 -1
- package/src/serve/hub-app/identities-st.ts +210 -0
- package/src/serve/hub-app/identities-view.tsx +352 -0
- package/src/serve/hub-app/identities.css +48 -0
- package/src/serve/hub-app/identity-address.ts +52 -0
- package/src/serve/hub-app/inbox-st.ts +59 -6
- package/src/serve/hub-app/inbox-view.tsx +48 -6
- package/src/serve/hub-app/inbox.css +12 -1
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/keys.ts +10 -2
- package/src/serve/hub-app/list-walk.ts +89 -0
- package/src/serve/hub-app/machine-st.ts +12 -0
- package/src/serve/hub-app/media-view.tsx +2 -1
- package/src/serve/hub-app/pages-frames.tsx +134 -0
- package/src/serve/hub-app/pages-svc.ts +111 -0
- package/src/serve/hub-app/palette-st.ts +18 -3
- package/src/serve/hub-app/palette-view.tsx +9 -2
- package/src/serve/hub-app/planned-view.tsx +2 -1
- package/src/serve/hub-app/project-list.css +18 -14
- package/src/serve/hub-app/project-list.tsx +88 -49
- package/src/serve/hub-app/projects-svc.ts +33 -3
- package/src/serve/hub-app/repo-sections.ts +19 -2
- package/src/serve/hub-app/repo-st.ts +75 -19
- package/src/serve/hub-app/review/review-cells.tsx +3 -3
- package/src/serve/hub-app/review/review-kit.ts +30 -7
- package/src/serve/hub-app/review/review-page.tsx +1 -1
- package/src/serve/hub-app/review/review-st.ts +33 -11
- package/src/serve/hub-app/review/review-thread.tsx +11 -9
- package/src/serve/hub-app/review/review-views.tsx +84 -19
- package/src/serve/hub-app/review/thread-st.ts +1 -10
- package/src/serve/hub-app/review/trailer-page.tsx +2 -1
- package/src/serve/hub-app/review.css +17 -8
- package/src/serve/hub-app/site/site-part.tsx +173 -0
- package/src/serve/hub-app/site/site-st.ts +157 -0
- package/src/serve/hub-app/site.css +35 -0
- package/src/serve/hub-app/social/calendar.tsx +182 -0
- package/src/serve/hub-app/social/comms-page.tsx +306 -0
- package/src/serve/hub-app/social/kit.tsx +244 -0
- package/src/serve/hub-app/social/post-card.tsx +456 -0
- package/src/serve/hub-app/social/problems.tsx +60 -0
- package/src/serve/hub-app/social/social-model.ts +154 -0
- package/src/serve/hub-app/social/social-page.tsx +674 -0
- package/src/serve/hub-app/social/social-st.ts +986 -0
- package/src/serve/hub-app/social.css +289 -0
- package/src/serve/hub-app/stores/stores-page.tsx +311 -0
- package/src/serve/hub-app/stores/stores-st.ts +286 -0
- package/src/serve/hub-app/stores.css +54 -0
- package/src/serve/hub-app/test-view.tsx +9 -2
- package/src/serve/hub-app/tests-svc.ts +16 -1
- package/src/serve/hub-app/timeline-geometry.ts +1 -1
- package/src/serve/hub-app/timeline-view.tsx +3 -2
- package/src/serve/hub-app/tree-build.ts +6 -0
- package/src/serve/hub-app/tree-row.tsx +27 -4
- package/src/serve/hub-app/tree-svc.ts +18 -49
- package/src/serve/hub-app/veille/veille-page.tsx +514 -0
- package/src/serve/hub-app/veille/veille-st.ts +443 -0
- package/src/serve/hub-app/veille.css +84 -0
- package/src/serve/hub-runtime.ts +14 -9
- package/src/serve/project-gutter-route.ts +44 -12
- package/src/serve/resources-wire.ts +48 -0
- package/src/serve/run-lanes.ts +7 -4
- package/src/serve/same-origin.ts +1 -1
- package/src/serve/serve-hub.ts +27 -18
- package/src/serve/tracked-watch.ts +24 -3
- package/src/serve/warm-cell.ts +5 -1
- package/src/shipkit-files.ts +15 -4
- package/src/shipkit.ts +0 -1
- package/src/shot/box.ts +162 -0
- package/src/shot/browser-slot.ts +62 -0
- package/src/shot/client.ts +43 -7
- package/src/shot/clip-encoder.ts +93 -12
- package/src/shot/film-box.ts +188 -0
- package/src/shot/shooter.ts +50 -15
- package/src/shot/shot-ask.ts +10 -2
- package/src/shot/stepped-clip.ts +5 -4
- package/src/site/desk.ts +242 -0
- package/src/site/routes.ts +66 -0
- package/src/site/unit.ts +62 -0
- package/src/social/brands.ts +22 -0
- package/src/social/compose.ts +97 -0
- package/src/social/desk-index.ts +123 -0
- package/src/social/desk-wire.ts +64 -0
- package/src/social/drafts.ts +183 -0
- package/src/social/house.ts +24 -0
- package/src/social/load.ts +319 -0
- package/src/social/md.ts +70 -0
- package/src/social/media-facts.ts +53 -0
- package/src/social/media-kind.ts +189 -0
- package/src/social/media-limit.ts +42 -0
- package/src/social/media-of.ts +30 -0
- package/src/social/migrate.ts +123 -0
- package/src/social/open.ts +17 -0
- package/src/social/post-url.ts +158 -0
- package/src/social/presence.ts +332 -0
- package/src/social/public-read.ts +53 -0
- package/src/social/publish/bluesky.ts +168 -0
- package/src/social/publish/discord.ts +76 -0
- package/src/social/publish/index.ts +24 -0
- package/src/social/publish/secret.ts +13 -0
- package/src/social/push.ts +31 -0
- package/src/social/richtext.ts +37 -0
- package/src/social/routes.ts +180 -0
- package/src/social/stats.ts +134 -0
- package/src/social/text.ts +267 -0
- package/src/social/tracker-route.ts +39 -0
- package/src/social/tracker.ts +255 -0
- package/src/social/unit.ts +53 -0
- package/src/social/writes.ts +130 -0
- package/src/start-repo.ts +14 -9
- package/src/stores/collection.ts +27 -0
- package/src/stores/desk.ts +336 -0
- package/src/stores/model.ts +187 -0
- package/src/stores/routes.ts +126 -0
- package/src/stores/unit.ts +57 -0
- package/src/suite/calibrate.ts +127 -0
- package/src/suite/core-counters.ts +91 -0
- package/src/suite/judge-suites.ts +94 -34
- package/src/suite/suite-cli.ts +44 -10
- package/src/suite/suite-cpu-preload.ts +34 -9
- package/src/trailer/adapter.ts +4 -0
- package/src/trailer/build.ts +42 -11
- package/src/trailer/ffmpeg.ts +11 -0
- package/src/trailer/footage.ts +30 -13
- package/src/trailer/grammar.ts +18 -2
- package/src/trailer/graph.ts +28 -6
- package/src/trailer/passage.ts +21 -6
- package/src/trailer/plan.ts +74 -3
- package/src/trailer/shelf.ts +16 -0
- package/src/trailer/stitch.ts +67 -26
- package/src/trailer/url.ts +1 -1
- package/src/trailer/versions.ts +24 -0
- package/src/ts/gate-typecheck.ts +32 -0
- package/src/ts/typecheck-cli.ts +9 -11
- package/src/tui/tui-app.tsx +0 -1
- package/src/veille/asks.ts +155 -0
- package/src/veille/auto.ts +31 -0
- package/src/veille/batch.ts +27 -0
- package/src/veille/chrome.ts +127 -0
- package/src/veille/collection.ts +28 -0
- package/src/veille/desk.ts +242 -0
- package/src/veille/identity.ts +80 -0
- package/src/veille/import.ts +68 -0
- package/src/veille/log.ts +183 -0
- package/src/veille/platforms.ts +118 -0
- package/src/veille/reads.ts +66 -0
- package/src/veille/replied.ts +110 -0
- package/src/veille/routes.ts +185 -0
- package/src/veille/service.ts +81 -0
- package/src/veille/watch.ts +116 -0
- package/src/veille/worth.ts +46 -0
- package/src/wiki/scan-md.ts +18 -0
- package/src/collections/posts.ts +0 -142
- package/src/contracts/manifests/social.contract.ts +0 -20
- package/src/scaffold/files/agent-coding.md +0 -35
- package/src/ts/typecheck-cache.ts +0 -11
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
// the Veille page as state (wiki build/shipkit/veille.md, The page): the feed in columns, one a platform; the post picked
|
|
2
|
+
// and its reply; the window, the chips and the folds in the address, the columns' order in the browser. The feed is
|
|
3
|
+
// read again when its stamp moves (the log, a mark, a draft, an ask), every 2 s while the page shows
|
|
4
|
+
import { makeAutoObservable, runInAction } from 'mobx'
|
|
5
|
+
import { COLUMNS, type FeedRow, type Platform, replyUrl, type VeilleFeed, type VeillePost } from '../../../veille/platforms.ts'
|
|
6
|
+
import { reach } from '../reach.ts'
|
|
7
|
+
import type { RepoSt } from '../repo-st.ts'
|
|
8
|
+
import { copyText, postJson } from '../review/review-kit.ts'
|
|
9
|
+
|
|
10
|
+
export type { FeedRow, Platform, VeilleFeed }
|
|
11
|
+
|
|
12
|
+
/** a column's shelves: a reply detected shows in « répondus », green and open, the rest of `done` folds */
|
|
13
|
+
export type Shelf = 'now' | 'maybe' | 'replied' | 'done'
|
|
14
|
+
export const SHELVES: readonly { shelf: Shelf; label: string }[] = [
|
|
15
|
+
{ shelf: 'now', label: 'à répondre maintenant' },
|
|
16
|
+
{ shelf: 'maybe', label: 'peut-être' },
|
|
17
|
+
{ shelf: 'replied', label: 'répondus' },
|
|
18
|
+
{ shelf: 'done', label: 'vus ou expirés' },
|
|
19
|
+
]
|
|
20
|
+
export const shelfOf = (r: FeedRow): Shelf => (r.group === 'done' && r.replied ? 'replied' : r.group)
|
|
21
|
+
|
|
22
|
+
/** his window, chips and columns' order, kept in the browser for a bare address; the admin's rail kept them under
|
|
23
|
+
* `admin-veille` on the same origin, read once when these are absent */
|
|
24
|
+
const PREFS = 'hub:veille'
|
|
25
|
+
const ADMIN_PREFS = 'admin-veille'
|
|
26
|
+
const POLL_MS = 2000
|
|
27
|
+
const SAVE_AFTER_MS = 600
|
|
28
|
+
/** `word`: the window in the address */
|
|
29
|
+
export const WINDOWS: readonly { ms: number; label: string; word: string }[] = [
|
|
30
|
+
{ ms: 86_400_000, label: '24 h', word: '24h' },
|
|
31
|
+
{ ms: 3 * 86_400_000, label: '3 j', word: '3d' },
|
|
32
|
+
{ ms: 7 * 86_400_000, label: '7 j', word: '7d' },
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
export class VeilleSt {
|
|
36
|
+
feed: VeilleFeed | null = null
|
|
37
|
+
loadError: string | null = null
|
|
38
|
+
post: VeillePost | null = null
|
|
39
|
+
windowMs = WINDOWS[0]!.ms
|
|
40
|
+
/** the tag chips on: only the posts holding one show; none on, every post */
|
|
41
|
+
tagsOn: string[] = []
|
|
42
|
+
/** the columns as he dragged them; empty is COLUMNS' order */
|
|
43
|
+
order: Platform[] = []
|
|
44
|
+
/** the columns whose « vus ou expirés » he opened */
|
|
45
|
+
doneOpen: Partial<Record<Platform, true>> = {}
|
|
46
|
+
/** the columns whose dropped posts he unfolded */
|
|
47
|
+
droppedOpen: Partial<Record<Platform, true>> = {}
|
|
48
|
+
/** the post picked, its key */
|
|
49
|
+
picked: string | null = null
|
|
50
|
+
/** the text he types, by key, until the server's draft says the same */
|
|
51
|
+
texts: Record<string, string> = {}
|
|
52
|
+
/** the media he picked for a reply, by key */
|
|
53
|
+
media: Record<string, string> = {}
|
|
54
|
+
reviewing = false
|
|
55
|
+
/** a platform's switch in flight: on or off, until the feed says the same */
|
|
56
|
+
switching: Partial<Record<Platform, boolean>> = {}
|
|
57
|
+
error: string | null = null
|
|
58
|
+
copied = false
|
|
59
|
+
/** the reply's media large over the page, its index; null when shut */
|
|
60
|
+
lightbox: number | null = null
|
|
61
|
+
/** what the last copy put on the clipboard, a moment */
|
|
62
|
+
toast: string | null = null
|
|
63
|
+
private stamp = ''
|
|
64
|
+
private timer: ReturnType<typeof setInterval> | null = null
|
|
65
|
+
private started = 0
|
|
66
|
+
private saves = new Map<string, ReturnType<typeof setTimeout>>()
|
|
67
|
+
|
|
68
|
+
constructor(private readonly st: RepoSt) {
|
|
69
|
+
try {
|
|
70
|
+
const p = JSON.parse(localStorage.getItem(PREFS) ?? localStorage.getItem(ADMIN_PREFS) ?? '{}') as { windowMs?: unknown; tagsOn?: unknown; columns?: unknown }
|
|
71
|
+
if (WINDOWS.some((w) => w.ms === p.windowMs)) this.windowMs = p.windowMs as number
|
|
72
|
+
if (Array.isArray(p.tagsOn)) this.tagsOn = p.tagsOn.filter((t): t is string => typeof t === 'string')
|
|
73
|
+
if (Array.isArray(p.columns)) this.order = p.columns.filter((x): x is Platform => COLUMNS.some((c) => c.platform === x))
|
|
74
|
+
} catch {
|
|
75
|
+
// no storage: the last day, every tag, the columns in their order
|
|
76
|
+
}
|
|
77
|
+
makeAutoObservable<this, 'st' | 'stamp' | 'timer' | 'started' | 'saves'>(this, { st: false, stamp: false, timer: false, started: false, saves: false })
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get phone(): boolean {
|
|
81
|
+
return this.st.review.phone.on
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ── the address: `#page:veille[:<key>]?window=3d&tags=a,b&done=x&dropped=reddit&lightbox=1` ──
|
|
85
|
+
|
|
86
|
+
/** the window, the chips, the folds and the lightbox, each only when it says something */
|
|
87
|
+
get address(): string {
|
|
88
|
+
const platforms = (open: Partial<Record<Platform, true>>): string => COLUMNS.map((c) => c.platform).filter((p) => open[p]).join(',')
|
|
89
|
+
const q = new URLSearchParams()
|
|
90
|
+
const w = WINDOWS.find((x) => x.ms === this.windowMs)
|
|
91
|
+
if (w && w !== WINDOWS[0]) q.set('window', w.word)
|
|
92
|
+
if (this.tagsOn.length > 0) q.set('tags', this.tagsOn.join(','))
|
|
93
|
+
if (platforms(this.doneOpen)) q.set('done', platforms(this.doneOpen))
|
|
94
|
+
if (platforms(this.droppedOpen)) q.set('dropped', platforms(this.droppedOpen))
|
|
95
|
+
if (this.picked && this.lightbox != null) q.set('lightbox', String(this.lightbox))
|
|
96
|
+
return q.toString().replaceAll('%2C', ',')
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
applyAddress(raw: string): void {
|
|
100
|
+
const q = new URLSearchParams(raw)
|
|
101
|
+
const w = WINDOWS.find((x) => x.word === q.get('window'))
|
|
102
|
+
if (w) this.windowMs = w.ms
|
|
103
|
+
if (q.has('tags')) this.tagsOn = (q.get('tags') ?? '').split(',').filter(Boolean)
|
|
104
|
+
const open = (key: string): Partial<Record<Platform, true>> => {
|
|
105
|
+
const on = (q.get(key) ?? '').split(',')
|
|
106
|
+
const out: Partial<Record<Platform, true>> = {}
|
|
107
|
+
for (const c of COLUMNS) if (on.includes(c.platform)) out[c.platform] = true
|
|
108
|
+
return out
|
|
109
|
+
}
|
|
110
|
+
this.doneOpen = open('done')
|
|
111
|
+
this.droppedOpen = open('dropped')
|
|
112
|
+
const lb = Number(q.get('lightbox'))
|
|
113
|
+
this.lightbox = q.has('lightbox') && Number.isInteger(lb) && lb >= 0 ? lb : null
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** the post the address names; its reply panel read */
|
|
117
|
+
select(key: string | null): void {
|
|
118
|
+
if (key === this.picked) return
|
|
119
|
+
this.picked = key
|
|
120
|
+
this.error = null
|
|
121
|
+
this.copied = false
|
|
122
|
+
if (key == null) this.post = null
|
|
123
|
+
else void this.loadPost()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** the address follows the page: a pick, a window, a chip, a fold; the window, chips and order kept */
|
|
127
|
+
private sync(): void {
|
|
128
|
+
try {
|
|
129
|
+
localStorage.setItem(PREFS, JSON.stringify({ windowMs: this.windowMs, tagsOn: this.tagsOn, columns: this.order }))
|
|
130
|
+
} catch {
|
|
131
|
+
// private mode: they last for this page
|
|
132
|
+
}
|
|
133
|
+
this.st.showVeille(this.picked)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// ── reading ──
|
|
137
|
+
|
|
138
|
+
start(): void {
|
|
139
|
+
if (this.started++ > 0) return
|
|
140
|
+
void this.load()
|
|
141
|
+
this.timer = setInterval(() => void this.poll(), POLL_MS)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
stop(): void {
|
|
145
|
+
if (this.started === 0 || --this.started > 0) return
|
|
146
|
+
if (this.timer) clearInterval(this.timer)
|
|
147
|
+
this.timer = null
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private async poll(): Promise<void> {
|
|
151
|
+
try {
|
|
152
|
+
const r = await reach(this.st.url('/api/veille/stamp'))
|
|
153
|
+
if (!r.ok) return
|
|
154
|
+
const { stamp } = (await r.json()) as { stamp: string }
|
|
155
|
+
if (stamp === this.stamp) return
|
|
156
|
+
this.stamp = stamp
|
|
157
|
+
await this.load()
|
|
158
|
+
if (this.picked) await this.loadPost()
|
|
159
|
+
} catch {
|
|
160
|
+
// the hub away a moment: the next poll asks again
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async load(): Promise<void> {
|
|
165
|
+
try {
|
|
166
|
+
const r = await reach(this.st.url(`/api/veille/feed?since=${this.windowMs}`))
|
|
167
|
+
const body = (await r.json()) as VeilleFeed & { error?: string }
|
|
168
|
+
if (!r.ok) throw new Error(body.error ?? `HTTP ${r.status}`)
|
|
169
|
+
runInAction(() => {
|
|
170
|
+
this.feed = body
|
|
171
|
+
this.loadError = null
|
|
172
|
+
})
|
|
173
|
+
} catch (e) {
|
|
174
|
+
runInAction(() => (this.loadError = (e as Error).message))
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private async loadPost(): Promise<void> {
|
|
179
|
+
const key = this.picked
|
|
180
|
+
if (key == null) return
|
|
181
|
+
try {
|
|
182
|
+
const r = await reach(this.st.url(`/api/veille/post?key=${encodeURIComponent(key)}`))
|
|
183
|
+
const body = (await r.json()) as VeillePost & { error?: string }
|
|
184
|
+
if (!r.ok) throw new Error(body.error ?? `HTTP ${r.status}`)
|
|
185
|
+
runInAction(() => {
|
|
186
|
+
if (this.picked === key) this.post = body
|
|
187
|
+
})
|
|
188
|
+
} catch (e) {
|
|
189
|
+
runInAction(() => (this.error = (e as Error).message))
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private async act<T>(path: string, body: unknown): Promise<T | null> {
|
|
194
|
+
try {
|
|
195
|
+
return await postJson<T>(this.st.url(`/api/veille/${path}`), body)
|
|
196
|
+
} catch (e) {
|
|
197
|
+
runInAction(() => (this.error = (e as Error).message))
|
|
198
|
+
return null
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// ── what the page shows ──
|
|
203
|
+
|
|
204
|
+
get now(): number {
|
|
205
|
+
return this.feed?.now ?? Date.now()
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** is the platform on: its column shows, the review reads it */
|
|
209
|
+
isOn(platform: Platform): boolean {
|
|
210
|
+
return this.switching[platform] ?? !(this.feed?.off ?? []).includes(platform)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** the columns of the platforms on, in the owner's order, each holding only the rows the chips keep */
|
|
214
|
+
get columns(): VeilleFeed['columns'] {
|
|
215
|
+
const at = (p: Platform): number => {
|
|
216
|
+
const i = this.order.indexOf(p)
|
|
217
|
+
return i < 0 ? this.order.length + COLUMNS.findIndex((c) => c.platform === p) : i
|
|
218
|
+
}
|
|
219
|
+
const on = this.tagsOn
|
|
220
|
+
const cols = (this.feed?.columns ?? []).filter((c) => this.isOn(c.platform)).sort((a, b) => at(a.platform) - at(b.platform))
|
|
221
|
+
return on.length === 0 ? cols : cols.map((c) => ({ ...c, rows: c.rows.filter((r) => r.tags.some((t) => on.includes(t))) }))
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** every tag the window's posts hold, with how many, the most first */
|
|
225
|
+
get tagCounts(): [string, number][] {
|
|
226
|
+
const n = new Map<string, number>()
|
|
227
|
+
for (const c of this.feed?.columns ?? []) for (const r of c.rows) if (r.group !== 'done') for (const t of r.tags) n.set(t, (n.get(t) ?? 0) + 1)
|
|
228
|
+
return [...n].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** a column's rows on screen, in the order its shelves stand; « vus ou expirés » only when he opened it */
|
|
232
|
+
shown(c: VeilleFeed['columns'][number]): FeedRow[] {
|
|
233
|
+
return SHELVES.flatMap((s) => (s.shelf === 'done' && !this.doneOpen[c.platform] ? [] : c.rows.filter((r) => shelfOf(r) === s.shelf)))
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
get row(): FeedRow | null {
|
|
237
|
+
const r = this.post?.row
|
|
238
|
+
return r && r.key === this.picked ? r : (this.columns.flatMap((c) => c.rows).find((x) => x.key === this.picked) ?? null)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** the reply shown: what he typed, else the draft on file */
|
|
242
|
+
text(key: string): string {
|
|
243
|
+
return this.texts[key] ?? this.row?.reply?.text ?? ''
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
mediaOf(key: string): string {
|
|
247
|
+
return this.media[key] ?? this.row?.reply?.media ?? ''
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
get max(): number {
|
|
251
|
+
return COLUMNS.find((c) => c.platform === this.row?.platform)?.max ?? 500
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** the file a media pick names, served by the hub */
|
|
255
|
+
fileUrl(path: string): string {
|
|
256
|
+
return this.st.url(`/api/veille/file?path=${encodeURIComponent(path)}`)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// ── his moves ──
|
|
260
|
+
|
|
261
|
+
setWindow(ms: number): void {
|
|
262
|
+
this.windowMs = ms
|
|
263
|
+
this.sync()
|
|
264
|
+
void this.load()
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
toggleTag(t: string): void {
|
|
268
|
+
this.tagsOn = this.tagsOn.includes(t) ? this.tagsOn.filter((x) => x !== t) : [...this.tagsOn, t]
|
|
269
|
+
this.sync()
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
toggleDone(p: Platform): void {
|
|
273
|
+
if (this.doneOpen[p]) delete this.doneOpen[p]
|
|
274
|
+
else this.doneOpen[p] = true
|
|
275
|
+
this.sync()
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
toggleDropped(p: Platform): void {
|
|
279
|
+
if (this.droppedOpen[p]) delete this.droppedOpen[p]
|
|
280
|
+
else this.droppedOpen[p] = true
|
|
281
|
+
this.sync()
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** the dragged column takes the place of the one it was dropped on */
|
|
285
|
+
moveColumn(from: Platform, onto: Platform): void {
|
|
286
|
+
if (from === onto) return
|
|
287
|
+
const ids = this.columns.map((c) => c.platform)
|
|
288
|
+
ids.splice(ids.indexOf(from), 1)
|
|
289
|
+
ids.splice(ids.indexOf(onto), 0, from)
|
|
290
|
+
this.order = ids
|
|
291
|
+
this.sync()
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
pick(key: string | null): void {
|
|
295
|
+
this.lightbox = null
|
|
296
|
+
this.select(key)
|
|
297
|
+
this.sync()
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** up and down in the picked post's column */
|
|
301
|
+
move(delta: number): void {
|
|
302
|
+
const col = this.columns.find((c) => this.shown(c).some((r) => r.key === this.picked)) ?? this.columns.find((c) => this.shown(c).length > 0)
|
|
303
|
+
if (col == null) return
|
|
304
|
+
const rows = this.shown(col)
|
|
305
|
+
const i = rows.findIndex((r) => r.key === this.picked)
|
|
306
|
+
const next = rows[i < 0 ? 0 : Math.max(0, Math.min(rows.length - 1, i + delta))]
|
|
307
|
+
if (next) this.pick(next.key)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** left and right: the best post of the next column that has one */
|
|
311
|
+
stepColumn(delta: number): void {
|
|
312
|
+
const cols = this.columns
|
|
313
|
+
const at = Math.max(0, cols.findIndex((c) => this.shown(c).some((r) => r.key === this.picked)))
|
|
314
|
+
for (let i = at + delta; i >= 0 && i < cols.length; i += delta) {
|
|
315
|
+
const first = this.shown(cols[i]!)[0]
|
|
316
|
+
if (first) return this.pick(first.key)
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
clearError(): void {
|
|
321
|
+
this.error = null
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** an explore button: its page in the identity's Chrome profile, where the extension reads */
|
|
325
|
+
async explore(url: string): Promise<void> {
|
|
326
|
+
await this.act('explore', { url })
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
setText(key: string, text: string): void {
|
|
330
|
+
this.texts[key] = text
|
|
331
|
+
clearTimeout(this.saves.get(key))
|
|
332
|
+
this.saves.set(
|
|
333
|
+
key,
|
|
334
|
+
setTimeout(() => void this.save(key), SAVE_AFTER_MS),
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
setMedia(key: string, path: string): void {
|
|
339
|
+
this.media[key] = this.mediaOf(key) === path ? '' : path
|
|
340
|
+
void this.save(key)
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
private async save(key: string): Promise<void> {
|
|
344
|
+
this.saves.delete(key)
|
|
345
|
+
await this.act('text', { key, text: this.text(key), media: this.mediaOf(key) })
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** « Proposer »: an item in the review store on the lane `interaction`; the row shows it */
|
|
349
|
+
async propose(): Promise<void> {
|
|
350
|
+
if (this.picked == null) return
|
|
351
|
+
if (await this.act('propose', { key: this.picked })) {
|
|
352
|
+
await this.load()
|
|
353
|
+
await this.loadPost()
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** « Revoir »: one item for every column's active list; the head shows it */
|
|
358
|
+
async review(): Promise<void> {
|
|
359
|
+
if (this.reviewing) return
|
|
360
|
+
this.reviewing = true
|
|
361
|
+
await this.act('review', {})
|
|
362
|
+
await this.load()
|
|
363
|
+
runInAction(() => (this.reviewing = false))
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** a platform switched off or on, kept where the review's rule reads it */
|
|
367
|
+
async setOn(platform: Platform, on: boolean): Promise<void> {
|
|
368
|
+
this.switching[platform] = on
|
|
369
|
+
const r = await this.act<{ off: Platform[] }>('platform', { platform, on })
|
|
370
|
+
if (r && this.feed) {
|
|
371
|
+
const f = this.feed
|
|
372
|
+
runInAction(() => (this.feed = { ...f, off: r.off, columns: f.columns.filter((c) => !r.off.includes(c.platform)) }))
|
|
373
|
+
}
|
|
374
|
+
await this.load()
|
|
375
|
+
runInAction(() => delete this.switching[platform])
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/** « Répondre »: the platform's reply page prefilled, else the reply copied and the post opened; he posts it */
|
|
379
|
+
async reply(): Promise<void> {
|
|
380
|
+
const row = this.row
|
|
381
|
+
if (row == null) return
|
|
382
|
+
const text = this.text(row.key)
|
|
383
|
+
if (replyUrl(row, text) == null && text !== '') {
|
|
384
|
+
const done = await copyText(text)
|
|
385
|
+
runInAction(() => (this.copied = done))
|
|
386
|
+
}
|
|
387
|
+
await this.act('open', { key: row.key, text, media: this.mediaOf(row.key) })
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** « Traité »: marked, and the next post of its column picked */
|
|
391
|
+
async handle(on = true): Promise<void> {
|
|
392
|
+
const key = this.picked
|
|
393
|
+
if (key == null) return
|
|
394
|
+
if (on) this.move(1)
|
|
395
|
+
await this.act('handled', { key, on })
|
|
396
|
+
await this.load()
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/** the command that starts the lane's agent, on the clipboard */
|
|
400
|
+
async copyCommand(): Promise<void> {
|
|
401
|
+
const cmd = this.feed?.command
|
|
402
|
+
if (cmd == null) return
|
|
403
|
+
if (await copyText(cmd)) this.flash(`copied: ${cmd}`)
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async copyMedia(path: string): Promise<void> {
|
|
407
|
+
if (await this.act('file-copy', { path })) this.flash('the file is on the clipboard: paste it in the reply')
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
async reveal(path: string): Promise<void> {
|
|
411
|
+
await this.act('file-reveal', { path })
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
setLightbox(i: number | null): void {
|
|
415
|
+
this.lightbox = i
|
|
416
|
+
this.sync()
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
private flash(text: string): void {
|
|
420
|
+
this.toast = text
|
|
421
|
+
setTimeout(() => runInAction(() => (this.toast = this.toast === text ? null : this.toast)), 2500)
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** the page's keys: j k or up and down, h l or left and right, p r t; the lightbox's arrows and Escape */
|
|
425
|
+
key(e: Pick<KeyboardEvent, 'key'>): boolean {
|
|
426
|
+
if (this.lightbox != null) {
|
|
427
|
+
const n = this.post?.media.length ?? 0
|
|
428
|
+
if (e.key === 'Escape') this.setLightbox(null)
|
|
429
|
+
else if ((e.key === 'ArrowLeft' || e.key === 'ArrowRight') && n > 0) this.setLightbox((this.lightbox + (e.key === 'ArrowLeft' ? n - 1 : 1)) % n)
|
|
430
|
+
else return false
|
|
431
|
+
return true
|
|
432
|
+
}
|
|
433
|
+
if (e.key === 'j' || e.key === 'ArrowDown') this.move(1)
|
|
434
|
+
else if (e.key === 'k' || e.key === 'ArrowUp') this.move(-1)
|
|
435
|
+
else if (e.key === 'l' || e.key === 'ArrowRight') this.stepColumn(1)
|
|
436
|
+
else if (e.key === 'h' || e.key === 'ArrowLeft') this.stepColumn(-1)
|
|
437
|
+
else if (e.key === 'p') void this.propose()
|
|
438
|
+
else if (e.key === 'r') void this.reply()
|
|
439
|
+
else if (e.key === 't') void this.handle(!(this.row?.handled ?? false))
|
|
440
|
+
else return false
|
|
441
|
+
return true
|
|
442
|
+
}
|
|
443
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* the Veille page (hub-app/veille/, wiki build/shipkit/veille.md): a deck of columns, one a platform, the reply panel on
|
|
2
|
+
the right. A tone class sets --tone (the t-* of the hub's sheets, .t-review here) and the parts read it */
|
|
3
|
+
.t-review{--tone:var(--review)}
|
|
4
|
+
.vl-deckwrap{height:100%;display:flex;flex-direction:column;min-height:0}
|
|
5
|
+
.vl-head{flex:none;display:flex;align-items:center;gap:var(--s2);padding:var(--s1) var(--s2);border-bottom:1px solid var(--line);background:var(--bg-top);min-width:0}
|
|
6
|
+
.vl-who{flex:none;font-size:13px}
|
|
7
|
+
.vl-chips{flex:1;min-width:0;display:flex;gap:var(--s1);overflow-x:auto}
|
|
8
|
+
.vl-chip{flex:none;font-size:11px;padding:0 var(--s2);border-radius:999px;color:var(--dim)}
|
|
9
|
+
.vl-chip.on{color:var(--review);border-color:var(--review);background:var(--panel2)}
|
|
10
|
+
.vl-switches{flex:none;display:flex;gap:var(--s0);align-items:center}
|
|
11
|
+
.vl-switch{border:0;padding:0;display:grid}
|
|
12
|
+
.vl-switch.off{outline:1px dashed var(--line);border-radius:5px}
|
|
13
|
+
.vl-logo{flex:none;display:grid;place-items:center;color:var(--tag)}
|
|
14
|
+
.vl-logo svg{fill:var(--tag)}
|
|
15
|
+
.vl-logo.off{opacity:.45;filter:grayscale(1)}
|
|
16
|
+
.vl-review{flex:none;font-size:12px;color:var(--review);border-color:var(--review)}
|
|
17
|
+
.vl-badge{flex:none;font-size:10.5px;line-height:16px;padding:0 var(--s1);border-radius:4px;border:1px solid var(--tone);color:var(--tone);text-decoration:none}
|
|
18
|
+
.vl-badge.solid{background:var(--tone);color:var(--bg)}
|
|
19
|
+
.vl-keys{flex:none;font-size:11px}
|
|
20
|
+
.vl-err{margin:var(--s2);cursor:pointer}
|
|
21
|
+
.vl-empty{padding:var(--s4)}
|
|
22
|
+
.vl-deck{flex:1;min-height:0;display:flex;overflow-x:auto}
|
|
23
|
+
.vl-col{flex:0 0 380px;display:flex;flex-direction:column;min-height:0;border-right:1px solid var(--line)}
|
|
24
|
+
.vl-col.dragged{opacity:.5}
|
|
25
|
+
.vl-colhead{flex:none;background:var(--panel2);border-bottom:1px solid var(--line);padding:var(--s1) var(--s2);display:flex;flex-direction:column;gap:var(--s0)}
|
|
26
|
+
.vl-colname{display:flex;align-items:center;gap:var(--s2);cursor:grab;font-size:13px}
|
|
27
|
+
.vl-read{margin-left:auto;font-size:11px;color:var(--dim)}
|
|
28
|
+
.vl-read.t-warn{color:var(--tone)}
|
|
29
|
+
.vl-reads{font-size:11px;line-height:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
30
|
+
.vl-link{border:0;padding:0;font:inherit;color:inherit;text-decoration:underline dotted;cursor:pointer}
|
|
31
|
+
.vl-link.t-warn{color:var(--tone)}
|
|
32
|
+
.vl-explore{display:flex;flex-wrap:wrap;gap:var(--s1);padding:var(--s0) 0}
|
|
33
|
+
.vl-dropped{max-height:220px;overflow-y:auto;border-top:1px solid var(--line);padding:var(--s1) 0;font-size:11px;line-height:1.3;display:flex;flex-direction:column;gap:var(--s0)}
|
|
34
|
+
.vl-dropped a{color:var(--ink);text-decoration:none}
|
|
35
|
+
.vl-cap{font-size:11px;font-weight:700;color:var(--tone)}
|
|
36
|
+
.vl-rows{flex:1;min-height:0;overflow-y:auto}
|
|
37
|
+
.vl-shelfhead{display:flex;gap:var(--s2);align-items:center;width:100%;padding:var(--s0) var(--s2);font-size:11px;font-weight:700;color:var(--tone);background:var(--panel2);border:0;border-radius:0;border-left:3px solid var(--tone);text-align:left}
|
|
38
|
+
.vl-none{font-size:11px;padding:var(--s1) var(--s2)}
|
|
39
|
+
.vl-row{display:flex;flex-direction:column;gap:var(--s0);width:100%;text-align:left;padding:var(--s1) var(--s2);border:0;border-radius:0;border-bottom:1px solid var(--line);font-size:12px;box-shadow:inset 3px 0 0 transparent}
|
|
40
|
+
.vl-row:hover{background:var(--hi3)}
|
|
41
|
+
.vl-row.on{background:var(--sel);box-shadow:inset 3px 0 0 var(--review)}
|
|
42
|
+
.vl-row.waiting{background:var(--panel2);box-shadow:inset 3px 0 0 var(--warn)}
|
|
43
|
+
.vl-row.on.waiting{background:var(--sel)}
|
|
44
|
+
.vl-row.replied{box-shadow:inset 3px 0 0 var(--ok)}
|
|
45
|
+
.vl-row.gone{opacity:.55}
|
|
46
|
+
.vl-rowline{display:flex;align-items:center;gap:var(--s2);min-width:0;line-height:16px;font-size:11px}
|
|
47
|
+
.vl-author{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
|
|
48
|
+
.vl-place{max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
49
|
+
.vl-grow{flex:1;min-width:0}
|
|
50
|
+
.vl-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.3}
|
|
51
|
+
.vl-passed{font-size:11px;font-style:italic;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
52
|
+
.vl-bars{flex:none;display:inline-flex;align-items:flex-end;gap:var(--s0);height:12px}
|
|
53
|
+
.vl-bar{width:4px;height:12px;background:var(--line);border-radius:1px;position:relative}
|
|
54
|
+
.vl-bar > span{position:absolute;left:0;right:0;bottom:0;background:var(--tone);border-radius:1px}
|
|
55
|
+
.vl-bars b{font-size:11px;color:var(--tone);margin-left:var(--s1);min-width:16px;text-align:right;line-height:12px}
|
|
56
|
+
.vl-panel{display:flex;flex-direction:column;gap:var(--s3);padding:var(--s4)}
|
|
57
|
+
.vl-panelhead{display:flex;align-items:center;gap:var(--s2);min-width:0;font-size:13px}
|
|
58
|
+
.vl-post{border:1px solid var(--line);border-radius:6px;padding:var(--s3);background:var(--panel2);display:flex;flex-direction:column;gap:var(--s2)}
|
|
59
|
+
.vl-posttext{white-space:pre-wrap;font-size:13px}
|
|
60
|
+
.vl-small{font-size:11.5px}
|
|
61
|
+
.vl-over{color:var(--tone)}
|
|
62
|
+
.vl-tone{color:var(--tone)}
|
|
63
|
+
.vl-parts{display:flex;flex-wrap:wrap;gap:var(--s2);font-size:11.5px}
|
|
64
|
+
.vl-label{display:flex;flex-direction:column;gap:var(--s1);font-size:12px;font-weight:600}
|
|
65
|
+
.vl-label textarea{width:100%;box-sizing:border-box;background:var(--bg);color:var(--ink);border:1px solid var(--line);border-radius:4px;padding:var(--s2);font:13px/1.45 system-ui,sans-serif;font-weight:400;resize:vertical}
|
|
66
|
+
.vl-asked{border:1px solid var(--tone);border-radius:6px;padding:var(--s2);display:flex;flex-direction:column;gap:var(--s1);font-size:12px}
|
|
67
|
+
.vl-asked b{color:var(--tone)}
|
|
68
|
+
.vl-cmd{display:flex;gap:var(--s2);align-items:center}
|
|
69
|
+
.vl-cmd code{flex:1;min-width:0;overflow-x:auto;font-size:11px;background:var(--bg);padding:var(--s1);border-radius:3px}
|
|
70
|
+
.vl-acts{display:flex;gap:var(--s2);flex-wrap:wrap}
|
|
71
|
+
.vl-media{display:flex;flex-direction:column;gap:var(--s1)}
|
|
72
|
+
.vl-mediahead{display:flex;gap:var(--s2);align-items:center;font-size:12px}
|
|
73
|
+
.vl-mediarow{display:flex;gap:var(--s2);align-items:center;font-size:11.5px}
|
|
74
|
+
.vl-thumb{position:relative;flex:none;width:72px;height:44px;padding:0;border:0;border-radius:4px;overflow:hidden;background:var(--panel2)}
|
|
75
|
+
.vl-thumb img,.vl-thumb video{width:100%;height:100%;object-fit:cover;display:block}
|
|
76
|
+
.vl-len{position:absolute;right:var(--s0);bottom:var(--s0);font-size:9px;font-weight:700;color:var(--tag);background:var(--scrim);border-radius:3px;padding:0 var(--s1)}
|
|
77
|
+
.vl-mediatext{display:flex;flex-direction:column;overflow:hidden}
|
|
78
|
+
.vl-mediatext span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
79
|
+
.vl-lightbox{position:fixed;inset:0;z-index:50;background:var(--scrim);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--s2);padding:var(--s4)}
|
|
80
|
+
.vl-lbbar{display:flex;align-items:center;gap:var(--s3);background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:var(--s1) var(--s3);font-size:13px}
|
|
81
|
+
.vl-lbmedia{max-width:100%;max-height:calc(100% - 48px);object-fit:contain;box-shadow:0 6px 20px var(--shadow)}
|
|
82
|
+
.vl-phone{height:100%;overflow-y:auto;background:var(--bg);display:flex;flex-direction:column}
|
|
83
|
+
.vl-phonedeck{flex:none;height:60vh;display:flex;flex-direction:column;border-bottom:1px solid var(--line)}
|
|
84
|
+
.vl-phone .vl-col{flex-basis:86vw}
|
package/src/serve/hub-runtime.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
// Port of a hub serving on its own: --port > serve.port > a deterministic
|
|
16
16
|
// house-range default (4800-4979, hashed from the repo name, stable across
|
|
17
17
|
// launches; pin serve.port when two repos collide).
|
|
18
|
+
import { loopWatch } from '../core/loop-watch.ts'
|
|
18
19
|
import { existsSync, readFileSync, statSync } from 'fs'
|
|
19
20
|
import { homedir } from 'os'
|
|
20
21
|
import { basename, dirname, join, resolve, sep } from 'path'
|
|
@@ -32,7 +33,7 @@ import { runCheck, type CheckEvent } from '../core/run-check.ts'
|
|
|
32
33
|
import { runCi, type CiOpts } from '../core/run-ci.ts'
|
|
33
34
|
import type { GraphMount } from '../wiki/graph-mount.ts'
|
|
34
35
|
import { scanMdGraph } from '../wiki/scan-md.ts'
|
|
35
|
-
import { readInvocations, readLive, readRuns, readRunsSince, runsPath, sweepLive } from '../ledger/run-log.ts'
|
|
36
|
+
import { readInvocations, readLive, readRuns, readRunsSince, runsPath, sweepLive, warmRuns } from '../ledger/run-log.ts'
|
|
36
37
|
import { LIVE_HISTORY_MS, shapeLive, type LiveView } from '../ledger/live-timeline.ts'
|
|
37
38
|
import { parallelCap } from '../core/parallel.ts'
|
|
38
39
|
import { autoGatePool, takeSlot } from '../core/slots.ts'
|
|
@@ -44,7 +45,7 @@ import { OtherRepos } from './other-repos.ts'
|
|
|
44
45
|
import { HouseRuns } from './house-runs.ts'
|
|
45
46
|
import { recordStamp } from './project-gutter.ts'
|
|
46
47
|
import { shapeTimeline } from '../ledger/run-timeline.ts'
|
|
47
|
-
import { readSuiteRuns, readSuites } from '../ledger/suite-log.ts'
|
|
48
|
+
import { readSuiteRuns, readSuites, warmSuites } from '../ledger/suite-log.ts'
|
|
48
49
|
import { shapeTestCheck, shapeTestsRoot } from '../collections/test-time.ts'
|
|
49
50
|
import type { NeedItem, TestFacts } from '../collections/collection-types.ts'
|
|
50
51
|
import { declaredSlowFiles } from '../suite/test-units.ts'
|
|
@@ -376,6 +377,8 @@ export async function resolveHubDeps(root: string, boot: RepoConfig, io: ServeIo
|
|
|
376
377
|
ceilings[row.decl.id] = row.timeoutMs ?? (row.build ? BUILD_TIMEOUT_MS : CHECK_TIMEOUT_MS)
|
|
377
378
|
budgets[row.decl.id] = row.budgetMs
|
|
378
379
|
}
|
|
380
|
+
await warmRuns(record)
|
|
381
|
+
await warmSuites(record)
|
|
379
382
|
return shapeTimeline({
|
|
380
383
|
runs: readRuns(record),
|
|
381
384
|
invocations: readInvocations(record),
|
|
@@ -391,6 +394,7 @@ export async function resolveHubDeps(root: string, boot: RepoConfig, io: ServeIo
|
|
|
391
394
|
// the SAME test files the tree lists, from the same provider
|
|
392
395
|
const col = allCollections().find((x) => x.id === 'tests')
|
|
393
396
|
const facts = col == null ? [] : (await col.list()).flatMap((i): TestFacts[] => (i.test == null ? [] : [i.test]))
|
|
397
|
+
await warmRuns(record)
|
|
394
398
|
const input = { facts, runs: readRuns(record), suiteRuns: readSuiteRuns(record) }
|
|
395
399
|
return check == null || check === '' ? shapeTestsRoot(input) : shapeTestCheck(check, input)
|
|
396
400
|
},
|
|
@@ -429,15 +433,15 @@ export async function inAutoTurn<T>(repo: string, run: () => Promise<T>, pool =
|
|
|
429
433
|
}
|
|
430
434
|
}
|
|
431
435
|
|
|
432
|
-
/** how a gate the hub starts differs from `shipkit ci`.
|
|
433
|
-
*
|
|
434
|
-
* of a gate. A run the hub starts ON ITS OWN never mutates the tree someone
|
|
436
|
+
/** how a gate the hub starts differs from `shipkit ci`. Both repair (a
|
|
437
|
+
* narrowed run, what its checks own). Only the gate stamps STATUS.md: one
|
|
438
|
+
* check is not the verdict of a gate. A run the hub starts ON ITS OWN never mutates the tree someone
|
|
435
439
|
* is editing: no repair pass, frozen (SK005 never updates a dependency), no
|
|
436
440
|
* status files, and the quick tier */
|
|
437
441
|
export function hubGateOpts(o: { only?: string[]; auto: boolean }): Pick<CiOpts, 'onlyIds' | 'fix' | 'status' | 'frozen' | 'tests'> {
|
|
438
442
|
const whole = o.only == null
|
|
439
443
|
if (o.auto) return { onlyIds: o.only, fix: false, status: false, frozen: true, tests: 'quick' }
|
|
440
|
-
return { onlyIds: o.only, fix:
|
|
444
|
+
return { onlyIds: o.only, fix: true, status: whole }
|
|
441
445
|
}
|
|
442
446
|
|
|
443
447
|
/** how often the RED ping looks, on a hub that owns its timers */
|
|
@@ -506,7 +510,8 @@ export async function loadHub(root: string, io: ServeIo, o: LoadHubOpts): Promis
|
|
|
506
510
|
const ping = async (): Promise<void> => {
|
|
507
511
|
if (deps.pingTick == null) return
|
|
508
512
|
try {
|
|
509
|
-
|
|
513
|
+
// the warm rows, never a compute of every collection of its own: the ping is not worth a held loop
|
|
514
|
+
deps.pingTick(await handler.needs())
|
|
510
515
|
} catch (e) {
|
|
511
516
|
io.printErr(`WARN ping tick broke: ${(e as Error).message}`)
|
|
512
517
|
}
|
|
@@ -515,7 +520,7 @@ export async function loadHub(root: string, io: ServeIo, o: LoadHubOpts): Promis
|
|
|
515
520
|
const start = (): void => {
|
|
516
521
|
// the plan hears every save burst and asks the ledger what it moved.
|
|
517
522
|
// The watch decides nothing: the runner measures or replays like any run
|
|
518
|
-
void o.plan.add(deps.plan).then(() => {
|
|
523
|
+
void loopWatch.spanned(`plan add: ${name}`, () => o.plan.add(deps.plan)).then(() => {
|
|
519
524
|
// a start is a change like a save
|
|
520
525
|
if (o.gateAtStart) o.plan.touched(name)
|
|
521
526
|
})
|
|
@@ -530,7 +535,7 @@ export async function loadHub(root: string, io: ServeIo, o: LoadHubOpts): Promis
|
|
|
530
535
|
live.push({ stop: () => watcher.close() }, { stop: () => o.plan.remove(name) }, { stop: () => { if (settle != null) clearTimeout(settle) } })
|
|
531
536
|
// the answers a page waits on, computed now, one hub at a time
|
|
532
537
|
// across the process, so a first visit reads them from memory
|
|
533
|
-
warming = warming.then(() => handler.warm())
|
|
538
|
+
warming = warming.then(() => loopWatch.spanned(`hub warm: ${name}`, () => handler.warm()))
|
|
534
539
|
if (o.ownTimers) {
|
|
535
540
|
// one tick now (the state file guarantees a restart never re-fires), then every minute
|
|
536
541
|
void ping()
|