spexcode 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +99 -35
  2. package/README.zh-CN.md +135 -0
  3. package/package.json +5 -6
  4. package/spec-cli/README.md +86 -0
  5. package/spec-cli/bin/spex.mjs +15 -3
  6. package/spec-cli/hooks/dispatch.sh +20 -8
  7. package/spec-cli/hooks/harness.sh +18 -11
  8. package/spec-cli/src/board.ts +47 -18
  9. package/spec-cli/src/boardCache.ts +70 -0
  10. package/spec-cli/src/boardDelta.ts +90 -0
  11. package/spec-cli/src/boardStream.ts +178 -0
  12. package/spec-cli/src/cli.ts +184 -122
  13. package/spec-cli/src/client.ts +6 -4
  14. package/spec-cli/src/gateway.ts +64 -24
  15. package/spec-cli/src/git.ts +105 -92
  16. package/spec-cli/src/guide.ts +186 -19
  17. package/spec-cli/src/harness-select.ts +63 -0
  18. package/spec-cli/src/harness.ts +506 -100
  19. package/spec-cli/src/help.ts +362 -0
  20. package/spec-cli/src/hooks.ts +0 -14
  21. package/spec-cli/src/index.ts +279 -32
  22. package/spec-cli/src/init.ts +41 -1
  23. package/spec-cli/src/issues.ts +301 -0
  24. package/spec-cli/src/layout.ts +70 -28
  25. package/spec-cli/src/lint.ts +12 -10
  26. package/spec-cli/src/listen.ts +28 -0
  27. package/spec-cli/src/localIssues.ts +700 -0
  28. package/spec-cli/src/materialize.ts +182 -27
  29. package/spec-cli/src/mentions.ts +192 -0
  30. package/spec-cli/src/plugin-harness.ts +145 -0
  31. package/spec-cli/src/pty-bridge.ts +378 -81
  32. package/spec-cli/src/self.ts +123 -20
  33. package/spec-cli/src/sessions.ts +461 -298
  34. package/spec-cli/src/specs.ts +55 -14
  35. package/spec-cli/src/supervise.ts +23 -3
  36. package/spec-cli/src/tsx-bin.ts +14 -5
  37. package/spec-cli/src/uninstall.ts +146 -0
  38. package/spec-cli/templates/hooks/post-merge +27 -0
  39. package/spec-cli/templates/hooks/pre-commit +51 -31
  40. package/spec-cli/templates/hooks/prepare-commit-msg +31 -8
  41. package/spec-cli/templates/presets/careful/.config/clarify-before-code/spec.md +11 -0
  42. package/spec-cli/templates/spec/project/.config/core/spec-of-file/spec-of-file.sh +26 -3
  43. package/spec-cli/templates/spec/project/.config/core/spec.md +4 -0
  44. package/spec-cli/templates/spec/project/.config/core/stop-gate/stop-gate.sh +16 -4
  45. package/spec-cli/templates/spec/project/.config/extract/spec.md +1 -1
  46. package/spec-cli/templates/spec/project/.config/regroup/spec.md +1 -1
  47. package/spec-cli/templates/spec/project/.config/reproduce-before-fix/spec.md +18 -0
  48. package/spec-cli/templates/spec/project/.config/spec.md +3 -3
  49. package/spec-cli/templates/spec/project/.config/supervisor/spec.md +2 -2
  50. package/spec-cli/templates/spec/project/.config/tidy/spec.md +1 -1
  51. package/spec-cli/templates/spec/project/spec.md +2 -2
  52. package/spec-dashboard/dist/assets/index-Ct_ubwrd.css +32 -0
  53. package/spec-dashboard/dist/assets/index-DehTZ-h9.js +145 -0
  54. package/spec-dashboard/dist/index.html +17 -5
  55. package/spec-forge/src/cache.ts +16 -0
  56. package/spec-forge/src/cli.ts +4 -10
  57. package/spec-forge/src/drivers/github.ts +74 -4
  58. package/spec-forge/src/drivers.ts +13 -0
  59. package/spec-forge/src/port.ts +25 -0
  60. package/spec-forge/src/resident.ts +40 -6
  61. package/spec-yatsu/src/cli.ts +227 -38
  62. package/spec-yatsu/src/evaltab.ts +169 -19
  63. package/spec-yatsu/src/filing.ts +48 -0
  64. package/spec-yatsu/src/freshness.ts +55 -20
  65. package/spec-yatsu/src/proof.ts +89 -3
  66. package/spec-yatsu/src/scenariofresh.ts +92 -0
  67. package/spec-yatsu/src/sidecar.ts +75 -11
  68. package/spec-yatsu/src/timeline.ts +47 -0
  69. package/spec-yatsu/src/yatsu.ts +47 -3
  70. package/spec-cli/src/relay.ts +0 -28
  71. package/spec-cli/templates/spec/project/.config/scenario/spec.md +0 -32
  72. package/spec-dashboard/dist/assets/index-Bk4E1EQy.js +0 -139
  73. package/spec-dashboard/dist/assets/index-Cq7hwngj.css +0 -32
@@ -4,11 +4,23 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>SpexCode</title>
7
- <!-- tab-icon: pre-load default favicon (🔭, on brand with the watch glyph); a configured dashboard.icon
8
- replaces it at runtime once the board loads. Inline emoji SVG — no asset to ship. -->
9
- <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%F0%9F%94%AD%3C/text%3E%3C/svg%3E" />
10
- <script type="module" crossorigin src="/assets/index-Bk4E1EQy.js"></script>
11
- <link rel="stylesheet" crossorigin href="/assets/index-Cq7hwngj.css">
7
+ <!-- tab-icon: pre-load default favicon (the SpexCode mark a spec-tree glyph on a compass arc);
8
+ a configured dashboard.icon replaces it at runtime once the board loads. Inline SVG — no asset to ship. -->
9
+ <link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3E%3Crect%20x='2'%20y='2'%20width='60'%20height='60'%20rx='14'%20fill='%236b46c1'/%3E%3Cpath%20d='M15%2035%20Q32%2044%2049%2035'%20stroke='%23fff'%20stroke-width='2.8'%20fill='none'%20stroke-linecap='round'/%3E%3Cg%20stroke='%23fff'%20stroke-width='3.2'%20stroke-linecap='round'%20fill='none'%3E%3Cpath%20d='M32%2017%20L20%2042'/%3E%3Cpath%20d='M32%2017%20L44%2042'/%3E%3C/g%3E%3Cg%20fill='%23fff'%3E%3Ccircle%20cx='32'%20cy='16.5'%20r='5'/%3E%3Ccircle%20cx='20'%20cy='42.6'%20r='5'/%3E%3Ccircle%20cx='44'%20cy='42.6'%20r='5'/%3E%3C/g%3E%3C/svg%3E" />
10
+ <!-- theme: apply the saved light/dark choice (else the OS preference) to <html data-theme> BEFORE
11
+ first paint, so there's no light-flash before the module boots. Mirrors theme.js's getTheme(). -->
12
+ <script>
13
+ (function () {
14
+ try {
15
+ var t = localStorage.getItem('spexcode.theme')
16
+ if (t !== 'light' && t !== 'dark')
17
+ t = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
18
+ document.documentElement.setAttribute('data-theme', t)
19
+ } catch (e) { /* localStorage/matchMedia unavailable — default (light) stands */ }
20
+ })()
21
+ </script>
22
+ <script type="module" crossorigin src="/assets/index-DehTZ-h9.js"></script>
23
+ <link rel="stylesheet" crossorigin href="/assets/index-Ct_ubwrd.css">
12
24
  </head>
13
25
  <body>
14
26
  <div id="root"></div>
@@ -22,7 +22,23 @@ export class ForgeCache {
22
22
  this.prs = new Map(prs.map((p) => [p.number, p]))
23
23
  }
24
24
 
25
+ // the INCREMENTAL halves reconcile() is made of: merge an updated-since issue window over the map
26
+ // (an issue never leaves — a closed one just updates in place), and replace the PR set (the open-PR
27
+ // list is small and self-truncating, so full replacement IS its delta).
28
+ applyIssues(issues: ForgeIssue[]): void {
29
+ for (const i of issues) this.issues.set(i.number, i)
30
+ }
31
+ setPRs(prs: ForgePR[]): void {
32
+ this.prs = new Map(prs.map((p) => [p.number, p]))
33
+ }
34
+
25
35
  view(nodeIds: string[]): NodeLinks[] {
26
36
  return resolveLinks([...this.issues.values()], [...this.prs.values()], nodeIds)
27
37
  }
38
+
39
+ // the raw cached set — for the one consumer (the unified Issue port, spec-cli issues.ts) that needs
40
+ // EVERY cached issue, linked or not. Resolution stays the only derived view (view() above).
41
+ state(): { issues: ForgeIssue[]; prs: ForgePR[] } {
42
+ return { issues: [...this.issues.values()], prs: [...this.prs.values()] }
43
+ }
28
44
  }
@@ -1,15 +1,9 @@
1
1
  import { loadSpecs } from '../../spec-cli/src/specs.js'
2
2
  import type { ForgeDriver, ForgeIssue, ForgePR } from './port.js'
3
- import { githubDriver } from './drivers/github.js'
3
+ import { DEFAULT_FORGE_HOST, FORGE_DRIVERS, forgeDriverFor } from './drivers.js'
4
4
  import { resolveLinks, type NodeLinks } from './links.js'
5
5
  import { resolveEvalPending, type NodeEvalPending } from './needs-yatsu-eval.js'
6
6
 
7
- const DRIVERS: ForgeDriver[] = [githubDriver]
8
- const DEFAULT_HOST = 'github'
9
- function driverFor(host: string): ForgeDriver | undefined {
10
- return DRIVERS.find((d) => d.host === host)
11
- }
12
-
13
7
  // tiny flag reader over this command's own arg slice (everything after `forge`), so cli.ts stays routing-only.
14
8
  function flag(args: string[], name: string): string | undefined {
15
9
  const i = args.indexOf(`--${name}`)
@@ -20,10 +14,10 @@ const has = (args: string[], name: string) => args.includes(`--${name}`)
20
14
  async function readForge(
21
15
  args: string[],
22
16
  ): Promise<{ driver: ForgeDriver; nodeIds: string[]; issues: ForgeIssue[]; prs: ForgePR[] } | null> {
23
- const host = flag(args, 'host') ?? DEFAULT_HOST
24
- const driver = driverFor(host)
17
+ const host = flag(args, 'host') ?? DEFAULT_FORGE_HOST
18
+ const driver = forgeDriverFor(host)
25
19
  if (!driver) {
26
- console.error(`forge: unknown host '${host}' (known: ${DRIVERS.map((d) => d.host).join(', ')})`)
20
+ console.error(`forge: unknown host '${host}' (known: ${FORGE_DRIVERS.map((d) => d.host).join(', ')})`)
27
21
  return null
28
22
  }
29
23
  const nodeIds = (await loadSpecs()).map((s) => s.id)
@@ -1,6 +1,6 @@
1
1
  import { execFile } from 'node:child_process'
2
2
  import { promisify } from 'node:util'
3
- import type { ForgeDriver, ForgeIssue, ForgePR } from '../port.js'
3
+ import type { ForgeComment, ForgeDriver, ForgeIssue, ForgePR } from '../port.js'
4
4
 
5
5
  const run = promisify(execFile)
6
6
 
@@ -16,8 +16,9 @@ export const githubDriver: ForgeDriver = {
16
16
  // fetch open and closed in separate `--limit 200` windows and merge, so a flood of closed issues can't crowd the open set out of one shared `--state all` limit
17
17
  async listIssues(): Promise<ForgeIssue[]> {
18
18
  const list = (state: string) =>
19
- gh<{ number: number; title: string; body: string; url: string; state: string; labels: { name: string }[] }[]>(
20
- ['issue', 'list', '--state', state, '--limit', '200', '--json', 'number,title,body,url,state,labels'],
19
+ gh<{ number: number; title: string; body: string; url: string; state: string; labels: { name: string }[]; author: { login: string } | null; createdAt: string; comments: { author: { login: string } | null; body: string; createdAt: string }[] }[]>(
20
+ // comments ride the same list read (no per-issue fetch) — heavier GraphQL points, covered by the resident cache's TTL
21
+ ['issue', 'list', '--state', state, '--limit', '200', '--json', 'number,title,body,url,state,labels,author,createdAt,comments'],
21
22
  )
22
23
  const [open, closed] = await Promise.all([list('open'), list('closed')])
23
24
  return [...open, ...closed].map((r) => ({
@@ -25,11 +26,44 @@ export const githubDriver: ForgeDriver = {
25
26
  title: r.title,
26
27
  body: r.body ?? '',
27
28
  url: r.url,
28
- state: r.state,
29
+ state: (r.state || '').toLowerCase(), // one canonical casing at the adapter (gh GraphQL says OPEN, REST says open)
29
30
  labels: (r.labels ?? []).map((l) => l.name),
31
+ author: r.author?.login ?? '',
32
+ createdAt: r.createdAt ?? '',
33
+ comments: (r.comments ?? []).map((c) => ({ author: c.author?.login ?? '', createdAt: c.createdAt ?? '', body: c.body ?? '' })),
30
34
  }))
31
35
  },
32
36
 
37
+ // the INCREMENTAL window: only issues updated since `sinceISO` (GitHub REST honors `since` = updated-at),
38
+ // paged manually (100/page, stop on a short page — an incremental window is normally one page). PRs ride
39
+ // the same REST endpoint flagged with `pull_request` and are filtered out — the PR list keeps its own path.
40
+ async listIssuesSince(sinceISO: string): Promise<ForgeIssue[]> {
41
+ type ApiRow = {
42
+ number: number; title: string; body: string | null; html_url: string; state: string
43
+ labels: ({ name?: string } | string)[]; user: { login: string } | null; created_at: string
44
+ comments: number; pull_request?: unknown
45
+ }
46
+ const out: ApiRow[] = []
47
+ for (let page = 1; page <= 20; page++) {
48
+ const rows = await gh<ApiRow[]>(['api', `repos/{owner}/{repo}/issues?state=all&since=${encodeURIComponent(sinceISO)}&per_page=100&page=${page}`])
49
+ out.push(...rows)
50
+ if (rows.length < 100) break
51
+ }
52
+ // REST's since-window carries only a comment COUNT — fetch each commented issue's thread alongside
53
+ // (the window is normally a handful of issues, so this stays a handful of calls, not a re-list).
54
+ return Promise.all(out.filter((r) => !r.pull_request).map(async (r) => ({
55
+ number: r.number,
56
+ title: r.title,
57
+ body: r.body ?? '',
58
+ url: r.html_url,
59
+ state: (r.state || '').toLowerCase(),
60
+ labels: (r.labels ?? []).map((l) => (typeof l === 'string' ? l : l.name ?? '')).filter(Boolean),
61
+ author: r.user?.login ?? '',
62
+ createdAt: r.created_at ?? '',
63
+ comments: r.comments > 0 ? await listComments(r.number) : [],
64
+ })))
65
+ },
66
+
33
67
  async listPRs(): Promise<ForgePR[]> {
34
68
  type Row = {
35
69
  number: number; title: string; url: string; state: string; headRefName: string
@@ -54,6 +88,42 @@ export const githubDriver: ForgeDriver = {
54
88
  closesIssues: (r.closingIssuesReferences ?? []).map((c) => c.number),
55
89
  }))
56
90
  },
91
+
92
+ // the port's first write verb (promotion — see port.ts). `gh issue create` prints the new issue's URL on
93
+ // stdout; the number is its last path segment. Fails loud like every other driver call.
94
+ async createIssue({ title, body }: { title: string; body: string }): Promise<{ number: number; url: string }> {
95
+ const { stdout } = await run('gh', ['issue', 'create', '--title', title, '--body', body], { maxBuffer: 1024 * 1024 })
96
+ const url = stdout.trim().split('\n').pop() ?? ''
97
+ const number = parseInt(url.split('/').pop() ?? '', 10)
98
+ if (!url.startsWith('http') || !Number.isFinite(number)) throw new Error(`gh issue create returned an unexpected result: ${stdout.trim()}`)
99
+ return { number, url }
100
+ },
101
+
102
+ // the second write verb (a store-routed reply — see port.ts). `gh issue comment` prints the new
103
+ // comment's permalink on stdout. Fails loud like every other driver call.
104
+ async createComment({ number, body }: { number: number; body: string }): Promise<{ url: string }> {
105
+ const { stdout } = await run('gh', ['issue', 'comment', String(number), '--body', body], { maxBuffer: 1024 * 1024 })
106
+ const url = stdout.trim().split('\n').pop() ?? ''
107
+ if (!url.startsWith('http')) throw new Error(`gh issue comment returned an unexpected result: ${stdout.trim()}`)
108
+ return { url }
109
+ },
110
+
111
+ // the lifecycle write verb (see port.ts). `gh issue close` does not reliably print a permalink, so read
112
+ // the issue URL back through gh's JSON surface after the close succeeds.
113
+ async closeIssue({ number }: { number: number }): Promise<{ url: string }> {
114
+ await run('gh', ['issue', 'close', String(number)], { maxBuffer: 1024 * 1024 })
115
+ const r = await gh<{ url: string }>(['issue', 'view', String(number), '--json', 'url'])
116
+ if (!r.url?.startsWith('http')) throw new Error(`gh issue view returned an unexpected url after close: ${JSON.stringify(r)}`)
117
+ return { url: r.url }
118
+ },
119
+ }
120
+
121
+ // one commented issue's thread, REST (the incremental window's companion read).
122
+ async function listComments(number: number): Promise<ForgeComment[]> {
123
+ const rows = await gh<{ user: { login: string } | null; body: string | null; created_at: string }[]>(
124
+ ['api', `repos/{owner}/{repo}/issues/${number}/comments?per_page=100`],
125
+ )
126
+ return rows.map((c) => ({ author: c.user?.login ?? '', createdAt: c.created_at ?? '', body: c.body ?? '' }))
57
127
  }
58
128
 
59
129
  function isUnknownFieldError(err: unknown): boolean {
@@ -0,0 +1,13 @@
1
+ import type { ForgeDriver } from './port.js'
2
+ import { githubDriver } from './drivers/github.js'
3
+
4
+ export const FORGE_DRIVERS: ForgeDriver[] = [githubDriver]
5
+ export const DEFAULT_FORGE_HOST = 'github'
6
+
7
+ export function forgeDriverFor(host: string): ForgeDriver | undefined {
8
+ return FORGE_DRIVERS.find((d) => d.host === host)
9
+ }
10
+
11
+ export function forgeIssueStores(): { id: string; label: string; kind: 'forge' }[] {
12
+ return FORGE_DRIVERS.map((d) => ({ id: d.host, label: d.host, kind: 'forge' }))
13
+ }
@@ -1,3 +1,11 @@
1
+ // a forge issue's comment — the shape that becomes a unified Issue's Reply verbatim (author→by,
2
+ // createdAt→at, body→body), so both stores' threads are one thread type downstream.
3
+ export type ForgeComment = {
4
+ author: string
5
+ createdAt: string
6
+ body: string
7
+ }
8
+
1
9
  export type ForgeIssue = {
2
10
  number: number
3
11
  title: string
@@ -5,6 +13,13 @@ export type ForgeIssue = {
5
13
  url: string
6
14
  state: string
7
15
  labels: string[]
16
+ // who opened it and when — what lets a forge issue stand beside a local issue thread as the same
17
+ // object in the unified Issue port (spec-cli issues.ts) with a `by` and a `created`.
18
+ author: string
19
+ createdAt: string
20
+ // the discussion under it — rides the same reads (list/since), so the unified Issue port maps it
21
+ // into replies[] with no second fetch path.
22
+ comments: ForgeComment[]
8
23
  }
9
24
 
10
25
  export type ForgePR = {
@@ -20,4 +35,14 @@ export interface ForgeDriver {
20
35
  readonly host: string
21
36
  listIssues(): Promise<ForgeIssue[]>
22
37
  listPRs(): Promise<ForgePR[]>
38
+ // the port's issue write verbs — used solely by the unified Issue port (spec-cli issues.ts): promotion
39
+ // creates an issue, a store-routed reply comments on one, and close advances the forge issue's own
40
+ // lifecycle. The driver stays the only network toucher; the tracer never calls these; node state is never touched.
41
+ createIssue(input: { title: string; body: string }): Promise<{ number: number; url: string }>
42
+ createComment(input: { number: number; body: string }): Promise<{ url: string }>
43
+ closeIssue(input: { number: number }): Promise<{ url: string }>
44
+ // optional INCREMENTAL window — only issues whose updated-at ≥ sinceISO. A driver that offers it lets
45
+ // the resident cache merge small deltas between periodic full reconciles instead of re-listing the
46
+ // world every TTL; a driver without it simply always full-lists.
47
+ listIssuesSince?(sinceISO: string): Promise<ForgeIssue[]>
23
48
  }
@@ -1,23 +1,57 @@
1
1
  import { ForgeCache } from './cache.js'
2
2
  import { githubDriver } from './drivers/github.js'
3
- import type { NodeLinks } from './links.js'
3
+ import type { ForgeIssue, ForgePR } from './port.js'
4
4
 
5
5
  const cache = new ForgeCache()
6
6
  let inFlight: Promise<void> | null = null
7
7
  // track last ATTEMPT, not last success, so the TTL also backs off failures — else a forge-less repo respawns `gh` every poll
8
8
  let lastAttempt = 0
9
- const TTL_MS = 60_000
9
+ // tuned to the dashboard's LIVE cadence: the issues page re-polls /api/issues every ~15s and each poll
10
+ // opportunistically triggers this refresh, so a TTL near the poll cadence means an externally-posted forge
11
+ // issue surfaces on the board within ~one poll+cycle (~15–30s) with no page reload — the "post a github
12
+ // issue → it just appears" contract. Each cycle is a tiny incremental read (one page), well inside
13
+ // GitHub's rate budget; the back-off still covers a forge-less repo (a failed probe updates lastAttempt).
14
+ const TTL_MS = 20_000
15
+ // incremental-first: after the seeding full reconcile, each TTL cycle fetches only the updated-since
16
+ // window (tiny — normally one page) and merges it; a periodic full reconcile stays as the backstop for
17
+ // what an update window can't see (deleted/transferred issues).
18
+ let lastIssueSync: string | null = null
19
+ let lastFull = 0
20
+ const FULL_MS = 30 * 60_000
10
21
 
11
22
  function refreshIfStale(now: number): void {
12
23
  if (inFlight || (lastAttempt && now - lastAttempt < TTL_MS)) return
13
24
  lastAttempt = now
14
- inFlight = cache
15
- .reconcile(githubDriver)
25
+ const startISO = new Date(now).toISOString() // stamped at fetch START so an update during the fetch lands in the next window
26
+ const incremental = lastIssueSync && githubDriver.listIssuesSince && now - lastFull < FULL_MS
27
+ inFlight = (incremental
28
+ ? Promise.all([
29
+ githubDriver.listIssuesSince!(lastIssueSync!).then((delta) => cache.applyIssues(delta)),
30
+ githubDriver.listPRs().then((prs) => cache.setPRs(prs)),
31
+ ]).then(() => { lastIssueSync = startISO })
32
+ : cache.reconcile(githubDriver).then(() => { lastFull = now; lastIssueSync = startISO })
33
+ )
16
34
  .catch(() => {})
17
35
  .finally(() => { inFlight = null })
18
36
  }
19
37
 
20
- export function residentForgeView(nodeIds: string[]): NodeLinks[] {
38
+ // the raw cached forge set, same freshness contract as the view (instant, background reconcile) the
39
+ // server-side slice the unified Issue port (spec-cli issues.ts) merges with the local store.
40
+ export function residentForgeState(): { issues: ForgeIssue[]; prs: ForgePR[] } {
21
41
  refreshIfStale(Date.now())
22
- return cache.view(nodeIds)
42
+ return cache.state()
43
+ }
44
+
45
+ // a write must show up where it lands: after the server posts a forge comment, force one refresh past the
46
+ // TTL and await it, so the next read carries the real read-back (never a local echo). Coalesces with an
47
+ // in-flight cycle first — a refresh started BEFORE the write could read the pre-write world. The forced
48
+ // cycle is a FULL re-list, never the incremental window: the REST since-read can lag a just-posted write,
49
+ // and a lagged cycle advances the watermark PAST it — the write would then be invisible until the next
50
+ // full reconcile. The full list reads the same backend the write went to, so the read-back is real.
51
+ export async function refreshForgeNow(): Promise<void> {
52
+ if (inFlight) await inFlight
53
+ lastAttempt = 0
54
+ lastFull = 0
55
+ refreshIfStale(Date.now())
56
+ if (inFlight) await inFlight
23
57
  }