rvlib-shipkit 2.12.0 → 2.14.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 +75 -21
- package/README.md +1 -1
- package/package.json +4 -2
- package/src/agent-time/store.ts +2 -2
- package/src/assets/run-assets.ts +2 -2
- package/src/assets/server/studio-server.ts +27 -23
- package/src/check.ts +4 -4
- package/src/checks/SK001-package-json-shape.check.ts +8 -4
- package/src/checks/SK002-contracts-fulfillness.check.ts +2 -2
- package/src/checks/SK003-claude-md-shape.check.ts +20 -13
- package/src/checks/SK004-gitignore-policy.check.ts +45 -6
- package/src/checks/SK005-rvlib-versions.check.ts +2 -2
- package/src/checks/SK006-npm-publish-safety.check.ts +3 -3
- package/src/checks/SK007-github-visibility.check.ts +2 -2
- package/src/checks/SK008-reviewer-agent.check.ts +3 -3
- package/src/checks/SK010-undeclared-unit.check.ts +2 -2
- package/src/checks/SK011-sibling-unit-ranges.check.ts +2 -2
- package/src/checks/SK012-config-barrel-import.check.ts +2 -2
- package/src/checks/SK013-one-way-in-policy.check.ts +2 -2
- package/src/checks/SK015-nested-repo.check.ts +3 -3
- package/src/checks/SK016-legacy-check-shapes.check.ts +2 -2
- package/src/checks/SK017-vscode-hub-task.check.ts +2 -2
- package/src/checks/SK018-test-files-run.check.ts +2 -2
- package/src/checks/SK019-tests-run-in-units.check.ts +2 -2
- package/src/checks/SK020-self-spawning-check.check.ts +2 -2
- package/src/checks/SK022-machine-runs-the-pin.check.ts +2 -2
- package/src/checks/SK024-identity-colors.check.ts +1 -1
- package/src/checks/SK025-release-drift.check.ts +2 -2
- package/src/checks/SK026-asks-autoclose.check.ts +2 -2
- package/src/checks/SK027-agent-wiki-links.check.ts +8 -2
- package/src/checks/SK028-readme.check.ts +2 -2
- package/src/checks/SK029-explicit-check-files.check.ts +3 -3
- package/src/checks/SK030-cache-audit.check.ts +7 -5
- package/src/checks/SK031-trace-audit.check.ts +7 -7
- package/src/checks/SK032-ignored-inputs.check.ts +3 -3
- package/src/checks/SK033-global-contribution.check.ts +11 -4
- package/src/checks/SK034-commit-gates-armed.check.ts +2 -2
- package/src/checks/SK035-public-clean.check.ts +46 -0
- package/src/checks/SK036-draft-media-size.check.ts +28 -0
- package/src/checks/SK037-keyword-additions.check.ts +43 -0
- package/src/cli/cmd_Backup.ts +152 -0
- package/src/cli/cmd_Ci.ts +8 -11
- package/src/cli/cmd_Commands.ts +4 -4
- package/src/cli/cmd_ConfigKeys.ts +2 -2
- package/src/cli/cmd_Drill.ts +145 -0
- package/src/cli/cmd_Home.ts +50 -3
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Media.ts +10 -8
- package/src/cli/cmd_Mv.ts +14 -7
- package/src/cli/cmd_Review.ts +6 -4
- package/src/cli/cmd_Shot.ts +5 -2
- package/src/cli/cmd_Smoke.ts +5 -2
- package/src/cli/cmd_Social.ts +226 -0
- package/src/cli/cmd_Sound.ts +1 -1
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_TraceAudit.ts +6 -6
- package/src/cli/cmd_Trailer.ts +7 -4
- package/src/cli/cmd_Veille.ts +173 -0
- package/src/cli/cmd_When.ts +2 -2
- package/src/cli/family-pages.ts +19 -16
- 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 +12 -3
- package/src/collections/providers.ts +4 -4
- package/src/collections/review.ts +3 -2
- package/src/collections/tests.ts +19 -8
- package/src/comfy/comfy-panel.ts +2 -2
- 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/contracts/manifests/discord.contract.ts +1 -1
- package/src/contracts/manifests/identity.contract.ts +1 -1
- package/src/contracts/manifests/itch.contract.ts +1 -1
- package/src/contracts/manifests/steam.contract.ts +1 -1
- package/src/core/agent-dir-at.ts +12 -0
- package/src/core/agent-dir.ts +16 -0
- package/src/core/app-icon.ts +9 -3
- package/src/core/budget.ts +1 -1
- package/src/core/bun-builtins.ts +2 -2
- package/src/core/canonical-scripts.ts +2 -2
- package/src/core/discover-checks.ts +38 -6
- 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/global-contribution.ts +4 -1
- package/src/core/ignored-block.ts +1 -1
- package/src/core/ignored-inputs.ts +3 -2
- 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/motherhome.ts +2 -2
- package/src/core/one-way-in-policy.ts +34 -26
- package/src/core/run-ci.ts +9 -11
- package/src/core/run-fixers.ts +9 -9
- package/src/core/runs-matrix.ts +1 -1
- package/src/core/slots.ts +30 -0
- package/src/core/trace-audit.ts +50 -9
- 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 +44 -8
- package/src/home/gui-app/ShipkitGui.swift +91 -2
- package/src/home/home-routes.ts +22 -15
- package/src/home/hubs.ts +10 -3
- package/src/home/inbox-shape.ts +54 -5
- package/src/home/inbox.ts +17 -2
- package/src/home/lib-watch.ts +10 -3
- package/src/home/machine-stores.ts +15 -29
- package/src/home/pm-config.ts +4 -1
- package/src/home/pm-inputs.ts +2 -0
- package/src/home/resources.ts +7 -2
- package/src/home/run-daemon.ts +15 -18
- package/src/home/run-pm.ts +3 -1
- package/src/home/serve-daemon.ts +4 -3
- package/src/home/serve-web.ts +104 -1
- package/src/hooks/commit-message.ts +29 -20
- package/src/hooks/hook-gates.ts +1 -1
- package/src/hooks/leak-guard.ts +69 -9
- package/src/hooks/run-hooks.ts +18 -22
- 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 +3 -3
- 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 +3 -2
- 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 +1 -1
- package/src/media-store/daemon.ts +56 -70
- package/src/media-store/db.ts +1 -1
- package/src/media-store/fact.ts +1 -1
- package/src/media-store/hand.ts +1 -1
- package/src/media-store/kind.ts +1 -1
- package/src/media-store/purge.ts +1 -1
- package/src/media-store/put.ts +5 -3
- package/src/media-store/remote.ts +1 -1
- package/src/media-store/space.ts +24 -5
- package/src/mv/mv-md.ts +63 -22
- 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 +319 -0
- package/src/release/published-here.ts +22 -0
- package/src/release/run-bump.ts +3 -2
- package/src/release/run-release.ts +7 -4
- package/src/repo-config.ts +71 -13
- package/src/review/anim.ts +1 -1
- package/src/review/auto.ts +1 -1
- package/src/review/cells.ts +15 -1
- package/src/review/format.ts +2 -2
- package/src/review/http.ts +16 -2
- package/src/review/marks.ts +1 -1
- package/src/review/media-kind.ts +1 -1
- package/src/review/media-read.ts +1 -1
- package/src/review/model.ts +27 -6
- package/src/review/notes.ts +125 -0
- package/src/review/previews.ts +1 -1
- package/src/review/project.ts +7 -39
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +18 -14
- package/src/review/store.ts +42 -2
- package/src/review/threads.ts +1 -1
- package/src/review/trailer-desk.ts +3 -3
- package/src/review/trailer-media.ts +8 -5
- package/src/review/trailer-model.ts +1 -1
- package/src/review/trailer-routes.ts +1 -1
- package/src/review/trailer-shots.ts +22 -5
- package/src/review/unit.ts +2 -2
- package/src/scaffold/files/agent-handoff.md +3 -0
- package/src/scaffold/files/agent-index.md +4 -12
- package/src/scaffold/files/tsconfig.json +1 -1
- package/src/scaffold/project-scaffold.ts +6 -5
- package/src/serve/embed.ts +2 -2
- package/src/serve/hub-app/check-words.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 +0 -13
- 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 +32 -8
- 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 +51 -7
- 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 +353 -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 +60 -7
- package/src/serve/hub-app/inbox-view.tsx +49 -7
- package/src/serve/hub-app/inbox.css +12 -1
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/kept-cols.tsx +30 -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-svc.ts +1 -1
- 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 +76 -20
- package/src/serve/hub-app/review/review-board.tsx +1 -1
- package/src/serve/hub-app/review/review-cells.tsx +6 -5
- package/src/serve/hub-app/review/review-kit.ts +30 -7
- package/src/serve/hub-app/review/review-page.tsx +6 -5
- package/src/serve/hub-app/review/review-st.ts +34 -15
- package/src/serve/hub-app/review/review-thread.tsx +63 -14
- package/src/serve/hub-app/review/review-views.tsx +133 -51
- package/src/serve/hub-app/review/thread-st.ts +80 -37
- package/src/serve/hub-app/review/trailer-page.tsx +7 -5
- package/src/serve/hub-app/review/trailer-st.ts +1 -1
- package/src/serve/hub-app/review.css +26 -9
- 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 +330 -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 +681 -0
- package/src/serve/hub-app/social/social-st.ts +1014 -0
- package/src/serve/hub-app/social.css +289 -0
- package/src/serve/hub-app/stores/stores-page.tsx +312 -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/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 +515 -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 +20 -11
- package/src/serve/project-gutter-route.ts +44 -12
- package/src/serve/run-lanes.ts +7 -4
- package/src/serve/same-origin.ts +1 -1
- package/src/serve/serve-hub.ts +20 -12
- 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 +160 -0
- package/src/shot/browser-slot.ts +74 -0
- package/src/shot/client.ts +42 -7
- package/src/shot/clip-encoder.ts +108 -24
- package/src/shot/film-box.ts +292 -0
- package/src/shot/shooter.ts +71 -17
- 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/card-drafts.ts +24 -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 +332 -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 +37 -0
- package/src/social/richtext.ts +37 -0
- package/src/social/routes.ts +186 -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 +95 -35
- package/src/suite/suite-cli.ts +44 -10
- package/src/suite/suite-cpu-preload.ts +34 -9
- package/src/trace/tracer.ts +12 -5
- package/src/trailer/adapter.ts +5 -1
- package/src/trailer/build.ts +45 -12
- 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/holes.ts +1 -1
- package/src/trailer/passage.ts +18 -6
- package/src/trailer/plan.ts +74 -3
- package/src/trailer/prune.ts +1 -1
- package/src/trailer/states.ts +1 -1
- package/src/trailer/stitch.ts +67 -26
- package/src/trailer/url.ts +1 -1
- package/src/trailer/versions.ts +24 -0
- package/src/trailer/words.ts +1 -1
- package/src/ts/gate-typecheck.ts +32 -0
- package/src/ts/typecheck-cli.ts +9 -11
- package/src/tui/run-tui.ts +1 -1
- package/src/tui/tui-app.tsx +0 -1
- package/src/tui/tui-store.ts +1 -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 tools/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 tools/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,9 @@
|
|
|
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 { nestedAgentDir } from '../core/agent-dir.ts'
|
|
19
|
+
import { agentDirAt } from '../core/agent-dir-at.ts'
|
|
20
|
+
import { loopWatch } from '../core/loop-watch.ts'
|
|
18
21
|
import { existsSync, readFileSync, statSync } from 'fs'
|
|
19
22
|
import { homedir } from 'os'
|
|
20
23
|
import { basename, dirname, join, resolve, sep } from 'path'
|
|
@@ -32,7 +35,7 @@ import { runCheck, type CheckEvent } from '../core/run-check.ts'
|
|
|
32
35
|
import { runCi, type CiOpts } from '../core/run-ci.ts'
|
|
33
36
|
import type { GraphMount } from '../wiki/graph-mount.ts'
|
|
34
37
|
import { scanMdGraph } from '../wiki/scan-md.ts'
|
|
35
|
-
import { readInvocations, readLive, readRuns, readRunsSince, runsPath, sweepLive } from '../ledger/run-log.ts'
|
|
38
|
+
import { readInvocations, readLive, readRuns, readRunsSince, runsPath, sweepLive, warmRuns } from '../ledger/run-log.ts'
|
|
36
39
|
import { LIVE_HISTORY_MS, shapeLive, type LiveView } from '../ledger/live-timeline.ts'
|
|
37
40
|
import { parallelCap } from '../core/parallel.ts'
|
|
38
41
|
import { autoGatePool, takeSlot } from '../core/slots.ts'
|
|
@@ -44,7 +47,7 @@ import { OtherRepos } from './other-repos.ts'
|
|
|
44
47
|
import { HouseRuns } from './house-runs.ts'
|
|
45
48
|
import { recordStamp } from './project-gutter.ts'
|
|
46
49
|
import { shapeTimeline } from '../ledger/run-timeline.ts'
|
|
47
|
-
import { readSuiteRuns, readSuites } from '../ledger/suite-log.ts'
|
|
50
|
+
import { readSuiteRuns, readSuites, warmSuites } from '../ledger/suite-log.ts'
|
|
48
51
|
import { shapeTestCheck, shapeTestsRoot } from '../collections/test-time.ts'
|
|
49
52
|
import type { NeedItem, TestFacts } from '../collections/collection-types.ts'
|
|
50
53
|
import { declaredSlowFiles } from '../suite/test-units.ts'
|
|
@@ -155,8 +158,10 @@ export async function resolveHubDeps(root: string, boot: RepoConfig, io: ServeIo
|
|
|
155
158
|
const baseWiki = baseWikiRoot(root)
|
|
156
159
|
if (baseWiki != null)
|
|
157
160
|
graphs.push({ id: 'base', label: wikiLabel(baseWiki), title: wikiLabel(baseWiki), load: () => scanMdGraph({ root: baseWiki }), dir: baseWiki, lint: null })
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
// a nested agent folder (a folder of another wiki) shows in that wiki's graph
|
|
162
|
+
const agentDir = agentDirAt(root)
|
|
163
|
+
const agentRoot = join(root, agentDir)
|
|
164
|
+
if (!nestedAgentDir(agentDir) && existsSync(agentRoot))
|
|
160
165
|
graphs.push({ id: 'agent', label: 'agent/', title: `${c.name} agent/`, load: () => scanMdGraph({ root: agentRoot, index: c.serve?.agentIndex }), dir: agentRoot, lint: { root: agentRoot, index: c.serve?.agentIndex } })
|
|
161
166
|
// ONE page for every repo: the studio ALWAYS
|
|
162
167
|
// mounts — kit-less repos get an empty media section, never a second
|
|
@@ -376,6 +381,8 @@ export async function resolveHubDeps(root: string, boot: RepoConfig, io: ServeIo
|
|
|
376
381
|
ceilings[row.decl.id] = row.timeoutMs ?? (row.build ? BUILD_TIMEOUT_MS : CHECK_TIMEOUT_MS)
|
|
377
382
|
budgets[row.decl.id] = row.budgetMs
|
|
378
383
|
}
|
|
384
|
+
await warmRuns(record)
|
|
385
|
+
await warmSuites(record)
|
|
379
386
|
return shapeTimeline({
|
|
380
387
|
runs: readRuns(record),
|
|
381
388
|
invocations: readInvocations(record),
|
|
@@ -391,6 +398,7 @@ export async function resolveHubDeps(root: string, boot: RepoConfig, io: ServeIo
|
|
|
391
398
|
// the SAME test files the tree lists, from the same provider
|
|
392
399
|
const col = allCollections().find((x) => x.id === 'tests')
|
|
393
400
|
const facts = col == null ? [] : (await col.list()).flatMap((i): TestFacts[] => (i.test == null ? [] : [i.test]))
|
|
401
|
+
await warmRuns(record)
|
|
394
402
|
const input = { facts, runs: readRuns(record), suiteRuns: readSuiteRuns(record) }
|
|
395
403
|
return check == null || check === '' ? shapeTestsRoot(input) : shapeTestCheck(check, input)
|
|
396
404
|
},
|
|
@@ -429,15 +437,15 @@ export async function inAutoTurn<T>(repo: string, run: () => Promise<T>, pool =
|
|
|
429
437
|
}
|
|
430
438
|
}
|
|
431
439
|
|
|
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
|
|
440
|
+
/** how a gate the hub starts differs from `shipkit ci`. Both repair (a
|
|
441
|
+
* narrowed run, what its checks own). Only the gate stamps STATUS.md: one
|
|
442
|
+
* check is not the verdict of a gate. A run the hub starts ON ITS OWN never mutates the tree someone
|
|
435
443
|
* is editing: no repair pass, frozen (SK005 never updates a dependency), no
|
|
436
444
|
* status files, and the quick tier */
|
|
437
445
|
export function hubGateOpts(o: { only?: string[]; auto: boolean }): Pick<CiOpts, 'onlyIds' | 'fix' | 'status' | 'frozen' | 'tests'> {
|
|
438
446
|
const whole = o.only == null
|
|
439
447
|
if (o.auto) return { onlyIds: o.only, fix: false, status: false, frozen: true, tests: 'quick' }
|
|
440
|
-
return { onlyIds: o.only, fix:
|
|
448
|
+
return { onlyIds: o.only, fix: true, status: whole }
|
|
441
449
|
}
|
|
442
450
|
|
|
443
451
|
/** how often the RED ping looks, on a hub that owns its timers */
|
|
@@ -506,7 +514,8 @@ export async function loadHub(root: string, io: ServeIo, o: LoadHubOpts): Promis
|
|
|
506
514
|
const ping = async (): Promise<void> => {
|
|
507
515
|
if (deps.pingTick == null) return
|
|
508
516
|
try {
|
|
509
|
-
|
|
517
|
+
// the warm rows, never a compute of every collection of its own: the ping is not worth a held loop
|
|
518
|
+
deps.pingTick(await handler.needs())
|
|
510
519
|
} catch (e) {
|
|
511
520
|
io.printErr(`WARN ping tick broke: ${(e as Error).message}`)
|
|
512
521
|
}
|
|
@@ -515,7 +524,7 @@ export async function loadHub(root: string, io: ServeIo, o: LoadHubOpts): Promis
|
|
|
515
524
|
const start = (): void => {
|
|
516
525
|
// the plan hears every save burst and asks the ledger what it moved.
|
|
517
526
|
// The watch decides nothing: the runner measures or replays like any run
|
|
518
|
-
void o.plan.add(deps.plan).then(() => {
|
|
527
|
+
void loopWatch.spanned(`plan add: ${name}`, () => o.plan.add(deps.plan)).then(() => {
|
|
519
528
|
// a start is a change like a save
|
|
520
529
|
if (o.gateAtStart) o.plan.touched(name)
|
|
521
530
|
})
|
|
@@ -530,7 +539,7 @@ export async function loadHub(root: string, io: ServeIo, o: LoadHubOpts): Promis
|
|
|
530
539
|
live.push({ stop: () => watcher.close() }, { stop: () => o.plan.remove(name) }, { stop: () => { if (settle != null) clearTimeout(settle) } })
|
|
531
540
|
// the answers a page waits on, computed now, one hub at a time
|
|
532
541
|
// across the process, so a first visit reads them from memory
|
|
533
|
-
warming = warming.then(() => handler.warm())
|
|
542
|
+
warming = warming.then(() => loopWatch.spanned(`hub warm: ${name}`, () => handler.warm()))
|
|
534
543
|
if (o.ownTimers) {
|
|
535
544
|
// one tick now (the state file guarantees a restart never re-fires), then every minute
|
|
536
545
|
void ping()
|