geneseed 4.30.0 → 4.30.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 (31) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/SHIPPED.md +1 -1
  3. package/docs/web-ui.md +21 -0
  4. package/harness.config.json +1 -1
  5. package/js/README.md +3 -3
  6. package/js/hosts/hooks.mjs +6 -4
  7. package/js/web/actions.mjs +31 -0
  8. package/js/web/handler.mjs +35 -11
  9. package/js/web/routes.mjs +27 -6
  10. package/js/web/state.mjs +22 -2
  11. package/package.json +1 -1
  12. package/web/dist/assets/{Activity-DfETiyWm.js → Activity-C8pQvnos.js} +1 -1
  13. package/web/dist/assets/{ActivityDetail-CnP3GPAN.js → ActivityDetail-D_8Bx-QO.js} +1 -1
  14. package/web/dist/assets/{CopyButton-CRAUXSG7.js → CopyButton-CYljsnLo.js} +1 -1
  15. package/web/dist/assets/{Dashboard-CaqOqtkG.js → Dashboard-DkUm4XMu.js} +2 -2
  16. package/web/dist/assets/{Docs-BFxyAVdN.js → Docs-DE04qOKj.js} +1 -1
  17. package/web/dist/assets/{GreenhouseView-19roNb5W.js → GreenhouseView-DPwhFO_j.js} +1 -1
  18. package/web/dist/assets/{Installs-BSoQN7w7.js → Installs-DmPzD4BW.js} +1 -1
  19. package/web/dist/assets/{JournalView-BgU2ybaq.js → JournalView-DQlDC-7i.js} +1 -1
  20. package/web/dist/assets/{KitApply-Ckc0P5kt.js → KitApply-BN2Az7dc.js} +1 -1
  21. package/web/dist/assets/{Kits-BZqWGWMu.js → Kits-C9qVd466.js} +1 -1
  22. package/web/dist/assets/{Laws-CnUWiNIx.js → Laws-T2wbwMmB.js} +1 -1
  23. package/web/dist/assets/{Library-rYO8owx_.js → Library-t3KocV0-.js} +1 -1
  24. package/web/dist/assets/{Loops-CljFhhQV.js → Loops-6lNY-9uR.js} +1 -1
  25. package/web/dist/assets/{OperatorHudView-xs7SCwCe.js → OperatorHudView-CLN6Qn25.js} +1 -1
  26. package/web/dist/assets/{Personal-CMPwtl36.js → Personal-xjoSqCzr.js} +1 -1
  27. package/web/dist/assets/{Tabs-CEfSUVQp.js → Tabs-DaExAgql.js} +1 -1
  28. package/web/dist/assets/api-LvBC0CnK.js +1 -0
  29. package/web/dist/assets/{index-FLVXXvV3.js → index-DhNNxhfg.js} +3 -3
  30. package/web/dist/index.html +2 -2
  31. package/web/dist/assets/api-BfpZmUMI.js +0 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,16 @@ label. For the capability ↔ spec map, see [SHIPPED.md](SHIPPED.md).
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [4.30.1] — 2026-10-31
12
+
13
+ Patch: Bob can read a protected check again (a regression in 4.29.0 and 4.30.0). Run `geneseed rebuild-all` once after updating.
14
+
15
+ ### Changed
16
+ - **The web console: each request may name its install.** Reads take `?host=&path=` and install-scoped writes take `{host, path}`, so a page that picks its own install no longer re-points every other page through one shared viewed install. A request without the pair still uses the viewed install, and an unknown pair is refused (404). No page names its install yet, so nothing changes on screen.
17
+
18
+ ### Fixed
19
+ - **Bob can read a protected check again.** Bob runs the gate on every tool, reads included, and since 4.29.0 a project emit seeds `.geneseed/protected-checks.txt` with the manifests, CI files and lint/test config. The gate refused every Bob read of those files, `package.json` included; now only a Bob write to a protected check, the list or `.geneseed/done-checks.txt` is blocked. A write is told by its tool name (`write`, `edit`, `diff`, `replace`, `insert`), the same rule the gate-configuration check already used.
20
+
11
21
  ## [4.30.0] — 2026-10-31
12
22
 
13
23
  Minor: the ownership and learn-mode state files stay short (general preferences, no per-checkpoint writes), and OpenCode activity cards land on their own repo shelf. Run `geneseed rebuild-all` once after updating to get the new Rite text.
package/SHIPPED.md CHANGED
@@ -20,7 +20,7 @@ historical references, not files distributed with the repo.
20
20
  > **On version numbers.** [`harness.config.json`](harness.config.json)'s `version` is a
21
21
  > human-readable label only. The canonical identity of an installed harness is the
22
22
  > **source fingerprint** stamped in `.geneseed-version` (see `geneseed version`), not the
23
- > string. Current label: **4.30.0**.
23
+ > string. Current label: **4.30.1**.
24
24
 
25
25
  ## Capabilities
26
26
 
package/docs/web-ui.md CHANGED
@@ -53,6 +53,27 @@ strict CSP (`frame-ancestors 'none'`, same-origin only, the one inline token scr
53
53
  a per-response nonce). `?fresh=1` on the doctor re-runs at most once per 3 s, and the server
54
54
  drops a request whose headers take over 10 s or whose whole request takes over 30 s.
55
55
 
56
+ ## Which install a request reads
57
+
58
+ A request can name the install it reads or writes. A read takes two query parameters,
59
+ `?host=<host>&path=<install root>` (two, because a Windows path holds a colon). A write takes
60
+ `host` and `path` in its JSON body. The pair is a row of `/api/installs`, and the server checks
61
+ it against the same detected-install allowlist as the install toggle. An unknown or half pair
62
+ gets a 404 and never falls through to another install's folder. The writes that take the pair
63
+ are `/api/activity`, `/api/memory/delete`, `/api/rules`, `/api/rules/promote`, `/api/profile`,
64
+ and the `restore` and `build` actions. In `/api/view`, `/api/install`, the `install` and
65
+ `deploy` actions, `/api/excludes` and `/api/reveal`, `host`/`path` keep their own meaning.
66
+
67
+ Every `/api/*` read takes and checks the pair, with these exceptions:
68
+ - `/api/ping` and `/api/jobs` ignore it.
69
+ - The machine-wide reads also ignore it: `/api/update`, `/api/installs`, `/api/fleet`,
70
+ `/api/kits`, `/api/usage`, `/api/gates`, `/api/excludes`, `/api/mcp` and `/api/loops/active`.
71
+ Such a read does not check the pair, and its answer does not change with the pair.
72
+
73
+ A request that names no install reads the install the topbar picker selected (`POST /api/view`).
74
+ Each named install keeps its own cached doctor run and inventory, and a mutation refreshes all
75
+ of them.
76
+
56
77
  ## The rail
57
78
 
58
79
  The left rail mirrors the harness's own shape:
@@ -2,5 +2,5 @@
2
2
  "_comment": "version is a human-readable release label only; the canonical identity of an installed harness is the source fingerprint stamped in .geneseed-version (see `harness version`), not this string.",
3
3
  "theme": "neutral",
4
4
  "product": "Geneseed",
5
- "version": "4.30.0"
5
+ "version": "4.30.1"
6
6
  }
package/js/README.md CHANGED
@@ -239,15 +239,15 @@ the deployed harness as JSON.
239
239
  |---|---|
240
240
  | `server.mjs` | `serve()`/`cmdWeb`: UI-build precheck, socket bind, token mint, daemon record wiring |
241
241
  | `routes.mjs` | The route tables — `STATE_ROUTES`, `PREFIX_ROUTES`, `POST_ROUTES` (+ its 409 column) — and the inline lists |
242
- | `handler.mjs` | One function per request: dispatch, gzip, `requestGuard` (Host+port, Origin/Sec-Fetch-Site on `/api`, constant-time CSRF token) and body cap (before the body is read), `securityHeaders` (CSP nonce, framing), static SPA fallback |
243
- | `state.mjs` | `webState` — the resolved install view every endpoint reads, with its cached inventory and doctor |
242
+ | `handler.mjs` | One function per request: per-request install (`?host=&path=` on every read but `MACHINE_GETS`, or the body on `VIEW_POSTS`), dispatch, gzip, `requestGuard` (Host+port, Origin/Sec-Fetch-Site on `/api`, constant-time CSRF token) and body cap (before the body is read), `securityHeaders` (CSP nonce, framing), static SPA fallback |
243
+ | `state.mjs` | `webState` — the resolved install view every endpoint reads, with its cached inventory and doctor; per-install views (`installView` in `actions.mjs`) hang off it, pinned, refreshed with it |
244
244
  | `catalog.mjs` | The Library read model: inventory, constitution tiers, memory/notebook/wiki/config items, `apiCatalog`/`apiItem`, `NotFound` |
245
245
  | `api.mjs` | The dashboard and settings reads: overview, recent, themes, setup, doctor, diff, installs, excludes, loops |
246
246
  | `update-check.mjs` | Is a newer release on npm? Answers from memory, refreshes in the background (a day when it got an answer, an hour when it did not), `null` on any failure, never asked under `node --test` |
247
247
  | `gates-api.mjs` | `GET /api/gates`: gate asks per rule per day over 30 days, read off every installed harness's `notebook/gates.jsonl` (the Overview's sparklines) |
248
248
  | `usage-api.mjs` | `GET /api/usage`: the 30-day skill and agent call counts across every installed harness, the never-fired list, a fleet-wide `names` list (per-name 30-day counts, installs, daily series, last day seen), and skips lines older than 90 days in each `notebook/usage.jsonl` |
249
249
  | `user-files.mjs` | The fingerprint-guarded editors for `user-rules.md` (incl. memory promotion) and `PROFILE.md`, read and write |
250
- | `actions.mjs` | The other mutating endpoints — memory delete, MCP, excludes, installs, view, restore — plus install/deploy argv |
250
+ | `actions.mjs` | The other mutating endpoints — memory delete, MCP, excludes, installs, view, restore — plus install/deploy argv, and `installView`, the per-request install behind the one (host, path) allowlist |
251
251
  | `daemon.mjs` | Detached web start/stop/status/restart, the `.geneseed-web.json` record, and `openUrl` |
252
252
  | `jobs.mjs` | `JobManager` and the action→argv table. The only module here that spawns job children |
253
253
  | `docs.mjs` | The Docs tab: the `docs/<folder>/` page registry, `?harness=` filtering, link rewriting, the six page kinds |
@@ -769,17 +769,19 @@ function ruleDecide(args, payload) {
769
769
  + 'credential-shaped string. Secrets live in .env or a secret manager, never in a '
770
770
  + 'tracked file.');
771
771
  }
772
- const sensor = protectedCheck(p);
772
+ // Bob routes reads here too (`read_file` carries a path): only a write is External Gate's business.
773
+ // shortcut: a write is told by its tool name, so a Bob write tool named outside WRITE_NAME_RE
774
+ // passes both gates; switch to an allowlist of Bob's read tools if Bob adds or renames one.
775
+ const bobRead = HOST === 'bob' && !WRITE_NAME_RE.test(String((payload && payload.tool_name) || ''));
776
+ const sensor = !bobRead && protectedCheck(p);
773
777
  if (sensor) {
774
778
  return ask(args, 'rule-gate', 'rigor-5', `Geneseed (External Gate) — ${p} is a protected `
775
779
  + `check (${sensor === DONE_LIST ? 'the done gate list itself'
776
780
  : `${sensor}, listed in ${SENSOR_LIST}`}). A check the agent can edit is not a `
777
781
  + 'check: fix the code, not the check, unless the user asks for this edit.');
778
782
  }
779
- // Bob routes reads here too (`read_file` carries a path): only a write is this gate's business.
780
783
  // Bob never reads `opencode.json(c)`, OpenCode's whole host config: it is not gated from Bob.
781
- const bobWrite = HOST !== 'bob' || (WRITE_NAME_RE.test(String((payload && payload.tool_name) || ''))
782
- && !/^opencode\.jsonc?$/i.test(path.basename(p)));
784
+ const bobWrite = !bobRead && !(HOST === 'bob' && /^opencode\.jsonc?$/i.test(path.basename(p)));
783
785
  if (bobWrite && gateConfig(p, args.root)) {
784
786
  // Bob: a hook-settings file is the user's shared host config — refused only when the write
785
787
  // touches Geneseed's wiring (`bobSettingsChange`); a pass falls through to the checks below.
@@ -65,6 +65,7 @@ import { memoryDelete } from '../maintain/memory.mjs';
65
65
  import { installDeactivate, installReactivate, installUninstall } from '../maintain/uninstall.mjs';
66
66
  import { emitChoices, themeChoices, viewCfg } from './api.mjs';
67
67
  import { actionCommands } from './jobs.mjs';
68
+ import { webState } from './state.mjs';
68
69
  import { NotFound, deployed, memoryDir } from './catalog.mjs';
69
70
 
70
71
  /** One body field, `dflt` when the body is not an object or does not carry the key. */
@@ -192,6 +193,36 @@ function detectedInstall(body) {
192
193
  return hit;
193
194
  }
194
195
 
196
+ /**
197
+ * The state a request reads: the install its `{host, path}` names, or `base` (the daemon's
198
+ * own, the topbar selector's view) when it names neither — so a client that sends no install
199
+ * keeps today's answers.
200
+ *
201
+ * NAMING ONE IS AN ALLOWLIST LOOKUP, EVERY TIME: `detectedInstall` runs on a cache hit too, so
202
+ * a half pair, an unknown pair or an install removed since is a `NotFound` (404), never a fall
203
+ * through to another dir. The state is cached per install on `base._views` because its doctor
204
+ * and inventory caching is behaviour (see `webState`); it is PINNED, so `refresh` never
205
+ * re-points it, and its `refresh` is `base.refresh`, which reaches every view. The daemon's
206
+ * own hooks (`daemonStale`, `jobBusy`) are read through to `base`, where `serve()` sets them.
207
+ */
208
+ export function installView(base, sel) {
209
+ if (bget(sel, 'host') == null && bget(sel, 'path') == null) return base;
210
+ const [host, scope, root] = detectedInstall(sel);
211
+ const key = JSON.stringify([host, String(root)]);
212
+ let v = base._views.get(key);
213
+ if (v === undefined) {
214
+ const target = viewCfg(host, scope, root);
215
+ v = webState(null, target);
216
+ v.selectView(target, root);
217
+ v.pinned = true;
218
+ v.refresh = base.refresh;
219
+ v.daemonStale = () => base.daemonStale?.();
220
+ v.jobBusy = () => base.jobBusy?.();
221
+ base._views.set(key, v);
222
+ }
223
+ return v;
224
+ }
225
+
195
226
  // ---- OS-native folder picker ---------------------------------------------------------------
196
227
 
197
228
  /**
@@ -15,13 +15,16 @@ import { resolvePath } from '../hosts/hosts.mjs';
15
15
  import { isTruthy, jsonDumpsCompact } from '../lib/json.mjs';
16
16
  import { parseIntStrict, percentDecode } from '../lib/text.mjs';
17
17
  import {
18
- apiDeployCmd, apiInstallCmd, apiPickFolder, apiRestore, buildActionCmds, mcpTargetPaths, rebuildCmds,
18
+ apiDeployCmd, apiInstallCmd, apiPickFolder, apiRestore, buildActionCmds, installView, mcpTargetPaths,
19
+ rebuildCmds,
19
20
  } from './actions.mjs';
20
21
  import { BadRequest, NotFound } from './catalog.mjs';
21
22
  import { openFolder, requestRestart } from './daemon.mjs';
22
23
  import { apiDocs, apiDocsPage } from './docs.mjs';
23
24
  import { actionCommands, updatePlan } from './jobs.mjs';
24
- import { POST_ROUTES, PREFIX_ROUTES, STATE_ROUTES, readJsonBody } from './routes.mjs';
25
+ import {
26
+ MACHINE_GETS, POST_ROUTES, PREFIX_ROUTES, STATE_ROUTES, VIEW_POSTS, readJsonBody,
27
+ } from './routes.mjs';
25
28
  import { installKind } from './update-check.mjs';
26
29
  import { isFile } from '../lib/fs.mjs';
27
30
  import { randomBytes, timingSafeEqual } from 'node:crypto';
@@ -198,22 +201,27 @@ export function makeHandler(state, jm, token, dist, holder = null) {
198
201
  }
199
202
 
200
203
  function doGet(req, res, path, ae) {
204
+ // The install the request names (`?host=&path=`), else the daemon's view; an unknown pair
205
+ // throws `NotFound` here, before any route reads a dir. Not for ping, jobs, static files or
206
+ // the machine-wide reads (`MACHINE_GETS`), which ignore the pair.
207
+ const st = (path.startsWith('/api/') && path !== '/api/ping' && !path.startsWith('/api/jobs')
208
+ && !MACHINE_GETS.has(path)) ? installView(state, installParams(req.url)) : state;
201
209
  const route = STATE_ROUTES[path];
202
- if (route !== undefined) return sendJson(res, route(state, req.url), 200, ae);
210
+ if (route !== undefined) return sendJson(res, route(st, req.url), 200, ae);
203
211
  // `pid` is what a restarting client waits on: the OLD server keeps answering this ping for
204
212
  // a moment after `/api/restart` returns, and a reload onto it fetches the old token.
205
213
  if (path === '/api/ping') {
206
214
  return sendJson(res, { ok: true, theme: state.theme, pid: process.pid }, 200, ae);
207
215
  }
208
216
  for (const [prefix, handler] of PREFIX_ROUTES) {
209
- if (path.startsWith(prefix)) return sendJson(res, handler(state, path), 200, ae);
217
+ if (path.startsWith(prefix)) return sendJson(res, handler(st, path), 200, ae);
210
218
  }
211
219
  if (path === '/api/docs') {
212
- return sendJson(res, apiDocs(state, harnessParam(req.url)), 200, ae);
220
+ return sendJson(res, apiDocs(st, harnessParam(req.url)), 200, ae);
213
221
  }
214
222
  if (path.startsWith('/api/docs/page/')) {
215
223
  const pid = percentDecode(path.slice('/api/docs/page/'.length));
216
- return sendJson(res, apiDocsPage(state, pid, harnessParam(req.url)), 200, ae);
224
+ return sendJson(res, apiDocsPage(st, pid, harnessParam(req.url)), 200, ae);
217
225
  }
218
226
  if (path === '/api/jobs') return sendJson(res, { jobs: jm.recent() }, 200, ae);
219
227
  if (path.startsWith('/api/jobs/')) {
@@ -290,10 +298,16 @@ export function makeHandler(state, jm, token, dist, holder = null) {
290
298
  apiPickFolder((result) => sendJson(res, result, 200, ae));
291
299
  return;
292
300
  }
301
+ // The install a body `{host, path}` names, on the routes that read one (`VIEW_POSTS`).
302
+ // An action is looked up on the SAME segment `doAction` dispatches on (the last), so
303
+ // `/api/actions/x/restore` cannot run a restore on the daemon's install instead.
304
+ const key = path.startsWith('/api/actions/')
305
+ ? `/api/actions/${path.slice(path.lastIndexOf('/') + 1)}` : path;
306
+ const st = VIEW_POSTS.has(key) ? installView(state, readJsonBody(body)) : state;
293
307
  const route = POST_ROUTES.get(path);
294
308
  if (route !== undefined) {
295
309
  const [fn, okIs409] = route;
296
- const obj = fn(state, readJsonBody(body));
310
+ const obj = fn(st, readJsonBody(body));
297
311
  return sendJson(res, obj, (okIs409 && !isTruthy(obj.ok)) ? 409 : 200, ae);
298
312
  }
299
313
  if (path.startsWith('/api/jobs/') && path.endsWith('/cancel')) {
@@ -304,7 +318,7 @@ export function makeHandler(state, jm, token, dist, holder = null) {
304
318
  : sendJson(res, { error: 'no running job by that id' }, 404, ae);
305
319
  }
306
320
  if (path.startsWith('/api/actions/')) {
307
- return doAction(res, path.slice(path.lastIndexOf('/') + 1), readJsonBody(body), ae);
321
+ return doAction(res, path.slice(path.lastIndexOf('/') + 1), readJsonBody(body), ae, st);
308
322
  }
309
323
  return sendJson(res, { error: 'not found' }, 404, ae);
310
324
  }
@@ -333,9 +347,9 @@ export function makeHandler(state, jm, token, dist, holder = null) {
333
347
  *
334
348
  * THEN the table, which answers a 404 for any action it does not name.
335
349
  */
336
- function doAction(res, action, body, ae) {
350
+ function doAction(res, action, body, ae, st = state) {
337
351
  if (action === 'restore') {
338
- return sendJson(res, apiRestore(state, isTruthy(body.files) ? body.files : []), 200, ae);
352
+ return sendJson(res, apiRestore(st, isTruthy(body.files) ? body.files : []), 200, ae);
339
353
  }
340
354
  if (action === 'install') {
341
355
  const plan = apiInstallCmd(state, body);
@@ -396,7 +410,7 @@ export function makeHandler(state, jm, token, dist, holder = null) {
396
410
  }
397
411
  // Build resolves its argv off the install (`buildActionCmds`); the other actions take no
398
412
  // axes and self-resolve the deployed theme downstream.
399
- const cmds = action === 'build' ? buildActionCmds(state, body) : actionCommands(action);
413
+ const cmds = action === 'build' ? buildActionCmds(st, body) : actionCommands(action);
400
414
  if (cmds && Object.hasOwn(cmds, 'error')) return sendJson(res, cmds, 400, ae);
401
415
  if (!isTruthy(cmds)) {
402
416
  return sendJson(res, { error: `unknown action ${action}` }, 404, ae);
@@ -521,6 +535,16 @@ function harnessParam(url) {
521
535
  return new URL(url || '', 'http://x').searchParams.get('harness') || null;
522
536
  }
523
537
 
538
+ /**
539
+ * `{host, path}` off the query, each `null` when absent — two params, not one string, because a
540
+ * Windows path holds a colon. A BLANK value is kept as `''`, unlike `harnessParam`: `?host=` names
541
+ * an install, a bad one, and `installView` must refuse it rather than read it as "none named".
542
+ */
543
+ function installParams(url) {
544
+ const q = new URL(url || '', 'http://x').searchParams;
545
+ return { host: q.get('host'), path: q.get('path') };
546
+ }
547
+
524
548
  function readBody(req, length, done) {
525
549
  if (!(length > 0)) {
526
550
  req.resume();
package/js/web/routes.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * WHAT THE WEB API ANSWERS — as a declaration, separate from the dispatcher that honours it.
3
3
  *
4
- * Four tables and two inline lists. The two GET tables (`STATE_ROUTES`, `PREFIX_ROUTES`) used
5
- * to live in `api.mjs`, which made it import every route module that also imported it. None of
6
- * this is documentation: `tests/unit/web_server.test.mjs` holds their union against a surface
7
- * list written out in the test, and probes the real handler, because a declaration is not a
8
- * dispatcher — a route can be declared here and missing from the dispatch, and nothing but a
9
- * probe notices.
4
+ * Four tables, two inline lists, and the two install-scope sets (`VIEW_POSTS`, `MACHINE_GETS`).
5
+ * The two GET tables (`STATE_ROUTES`, `PREFIX_ROUTES`) used to live in `api.mjs`, which made it
6
+ * import every route module that also imported it. None of this is documentation:
7
+ * `tests/unit/web_server.test.mjs` holds their union against a surface list written out in the
8
+ * test, and probes the real handler, because a declaration is not a dispatcher — a route can be
9
+ * declared here and missing from the dispatch, and nothing but a probe notices.
10
10
  *
11
11
  * This file used to also carry the Python→Node port's NOT_PORTED / DECLINED partition — five
12
12
  * sets, all empty once the port finished. They were deleted when the port bookkeeping retired
@@ -62,6 +62,27 @@ export const POST_ROUTES = new Map([
62
62
  ['/api/loops/preset', [apiLoopsPresetMutate, false]],
63
63
  ]);
64
64
 
65
+ /**
66
+ * The POSTs whose body `{host, path}` names the install they act on (`installView`), opt-in
67
+ * rather than every POST: in `/api/view`, `/api/install` and `/api/actions/install` the pair is
68
+ * the target the route resolves itself, and in `/api/actions/deploy`, `/api/excludes` and
69
+ * `/api/reveal` a `path` is a folder or a config file, not an install. The two `actions/` rows
70
+ * are the only actions that read the viewed install.
71
+ */
72
+ export const VIEW_POSTS = new Set(['/api/activity', '/api/memory/delete', '/api/rules',
73
+ '/api/rules/promote', '/api/profile', '/api/actions/restore', '/api/actions/build']);
74
+
75
+ /**
76
+ * The GETs that answer for the whole machine, not one install: they IGNORE a `?host=&path=`
77
+ * pair (it is neither checked nor used) and always read the daemon's state. Ignored rather
78
+ * than refused, so a client may send its install on every read. On the daemon's state, not a
79
+ * view, because `/api/update` keeps its daily check and the `.git`-lock guard
80
+ * (`_behind.inflight`) there, and the update job checks only that one. Every other `/api/*`
81
+ * GET, ping and jobs aside, takes the pair and refuses an unknown one.
82
+ */
83
+ export const MACHINE_GETS = new Set(['/api/update', '/api/installs', '/api/fleet', '/api/kits',
84
+ '/api/usage', '/api/gates', '/api/excludes', '/api/mcp', '/api/loops/active']);
85
+
65
86
  /**
66
87
  * The 409 column, exported so a test can assert it directly. Giving `/api/activity` the 409
67
88
  * treatment is the invisible mutation: nothing in normal use can force the `ok: false` arm
package/js/web/state.mjs CHANGED
@@ -74,6 +74,10 @@ export function stampMinute(ms) {
74
74
  * the hook shim, the hook shell, the OpenCode config dirs, the deployed install): a memory
75
75
  * delete passes `{ doctor: false }` and keeps the ~3.6 s verdict. Rule and profile writes do not
76
76
  * call `refresh()` at all. Every other caller keeps the default, so a new one is slow, never stale.
77
+ *
78
+ * A request may name another install (`installView` in actions.mjs): that one gets its OWN
79
+ * state, made by this factory, cached in `_views` and `pinned`, so the caching above holds per
80
+ * install. `refresh()` on the daemon's state reaches every view.
77
81
  */
78
82
  export function webState(theme = null, target = null) {
79
83
  const st = {
@@ -96,6 +100,12 @@ export function webState(theme = null, target = null) {
96
100
  // `diffCollect`'s memo of `expected` renders, made on first use by `api.mjs` (`memoOf`);
97
101
  // it re-renders on its own key change, so `refresh()` leaves it alone.
98
102
  renderMemo: null,
103
+ // True for a per-install view (`installView` in actions.mjs): `refresh` must never re-point
104
+ // it at another install, since the request named THIS one.
105
+ pinned: false,
106
+ // The per-install views made off this daemon's state, keyed `[host, root]` — see
107
+ // `installView`. Kept here, not at module level, so each handler (each test's) has its own.
108
+ _views: new Map(),
99
109
  };
100
110
  // The INSTALL ROOT (== build --out). For globals it IS the data dir; a claude/bob/openclaude
101
111
  // PROJECT install keeps its data under <repo>/.claude|.bob|.openclaude while the markers
@@ -183,11 +193,13 @@ export function webState(theme = null, target = null) {
183
193
  st._inv = null;
184
194
  st._doctor = null;
185
195
  };
186
- st.refresh = ({ doctor = true } = {}) => {
196
+ /** This state alone. `refresh` below is what callers use: it also reaches every view. */
197
+ st.refreshOwn = ({ doctor = true } = {}) => {
187
198
  // A job may have deployed the first install while the view still points at an empty
188
199
  // default (the onboarding Build), or removed the one in view: follow it to one that exists.
189
200
  // Only on a full refresh: `{ doctor: false }` marks a mutation that cannot change installs.
190
- const fallback = doctor ? fallbackView(st.target) : null;
201
+ // Never for a pinned view: it answers for the install its request named, or is refused.
202
+ const fallback = doctor && !st.pinned ? fallbackView(st.target) : null;
191
203
  if (fallback) { st.selectView(...fallback); return; }
192
204
  st._inv = null;
193
205
  if (doctor) st._doctor = null;
@@ -196,6 +208,14 @@ export function webState(theme = null, target = null) {
196
208
  st.theme = themeOfDir(st.root, host) || themeOfDir(st.target, host) || st.theme;
197
209
  readMarkers(host);
198
210
  };
211
+ /**
212
+ * After a mutation, this state AND every per-install view made off it: a job or a write
213
+ * through one view can change what any other one reads (the same install, seen twice).
214
+ */
215
+ st.refresh = (opts = {}) => {
216
+ st.refreshOwn(opts);
217
+ for (const v of st._views.values()) v.refreshOwn(opts);
218
+ };
199
219
  return st;
200
220
  }
201
221
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "Every field here is argued and gated in tests/unit/package_manifest.test.mjs. `files`, `bin` and `engines` each have a test that fails when reality drifts from this file; `version` mirrors harness.config.json and is gated too. Read that docblock before editing this one.",
3
3
  "name": "geneseed",
4
- "version": "4.30.0",
4
+ "version": "4.30.1",
5
5
  "description": "A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent.",
6
6
  "keywords": [
7
7
  "ai",
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BfpZmUMI.js";import{a as i}from"./motion-CXaUMNkg.js";import{A as a,C as o,D as s,E as c,I as l,J as u,M as d,N as f,P as p,T as m,W as ee,Y as te,Z as ne,dt as h,j as g,k as re,ot as _,pt as v,u as y,w as b}from"./index-FLVXXvV3.js";import{t as x}from"./EmptyState-1sPNleqv.js";import{a as S,c as C,d as w,i as T,l as E,n as D,o as O,r as k,s as A,t as j,u as M}from"./Bonsai-CN4rRAHc.js";import{t as ie}from"./usePoll-bDFN-Hr6.js";var N=e(t(),1),P=n(),F=4,I=56*F,L=24,R=165,z=188,B=e=>{let t=O(e);return t==null?null:Math.round(t*100)};function V(e,t,n){let r=o[e.status]||o.idle,i=t.pads.filter(e=>e.key!=null),a=t.pads.reduce((e,t)=>e+t.files.length,0)+t.fallen.reduce((e,t)=>e+t.files.length,0),c=B(e);return[`${e.title||s(e.cwd)||e.session_id}, ${e.host||`unknown host`}, ${r.label}${e.phase?`, ${e.phase}`:``}`,`${e.turns||0} turns${c==null?``:`, context ${c} %`}${e.compactions?`, ${e.compactions} compactions`:``}`,i.length?`${i.length} sub-agent${i.length===1?``:`s`} running: ${i.map(e=>`${e.type||`agent`} (${e.files.length} file${e.files.length===1?``:`s`})`).join(`, `)}`:``,t.fallen.length?`${t.fallen.length} finished`:``,`${a} file${a===1?``:`s`} changed`,n.length?`shares ${n.length} file${n.length===1?``:`s`} with another session`:``,e.error?`error: ${e.error}`:``].filter(Boolean).join(`. `)}function H({s:e,t,mine:n}){let r=B(e);return(0,P.jsxs)(`div`,{className:`card gd-card`,children:[(0,P.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`dt`,{children:`model`}),(0,P.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,P.jsx)(`dt`,{children:`turns`}),(0,P.jsx)(`dd`,{children:e.turns||0}),(0,P.jsx)(`dt`,{children:`context`}),(0,P.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,P.jsx)(`dt`,{children:`compactions`}),(0,P.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,P.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,P.jsxs)(`div`,{className:`act-xs ${e.kind===`same-worktree`?`t-bad`:`t-warn`}`,children:[`same file`,e.kind===`same-worktree`?``:`, other worktree`,`: `,e.path]},`${e.kind}:${e.path}`))]})}function U({s:e,worktree:t,sakura:n,mine:r,pad:i,onHover:a}){let c=w(e,n),l=(0,N.useMemo)(()=>A(e,{sakura:n}),[c]),u=o[e.status]||o.idle,d=Array.isArray(e.loops)?e.loops[0]:null,f=e.status!==`idle`,p=e.session_id,m=(0,N.useCallback)(e=>a(p,e),[a,p]);return(0,P.jsxs)(`a`,{className:`gd-tree${g(e)?` gd-needs`:``}`,href:`#/activity/${encodeURIComponent(e.session_id)}`,"aria-label":V(e,l,r),"data-sid":e.session_id,onMouseEnter:e=>a(p,null,G(e.currentTarget)),onMouseLeave:()=>a(null,null),onFocus:e=>a(p,null,G(e.currentTarget)),onBlur:()=>a(null,null),children:[(0,P.jsxs)(`div`,{className:`gd-label`,children:[(0,P.jsxs)(`div`,{className:`act-ell`,children:[(0,P.jsx)(`span`,{className:`mono dim`,children:e.host||`?`}),` ·`,` `,e.title||s(e.cwd)||e.session_id]}),(0,P.jsxs)(`div`,{className:`row gap-8 gd-sub`,children:[(0,P.jsx)(`span`,{className:`badge ${u.cls}`,children:u.label}),t&&(0,P.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),d&&(0,P.jsxs)(`span`,{className:`badge`,children:[`↻ `,d.title,d.iteration==null?``:` ${d.iteration}`]}),e.attribution===!1&&(0,P.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`}),e.phase&&(0,P.jsx)(`span`,{className:`dim act-ell`,children:e.phase})]})]}),(0,P.jsx)(k,{t:l,pad:i,swaying:f,onPad:m,px:F})]})}function W({pairs:e,count:t}){if(!e.length)return null;let n=t*I+(t-1)*L,r=e=>e*(I+L)+I/2;return(0,P.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*F+20,"aria-hidden":`true`,children:e.map(({a:e,b:t,kind:n})=>{let[i,a]=e<t?[e,t]:[t,e],o=`gd-thread ${n===`same-worktree`?`red`:`amber`}`;if(a-i===1){let e=r(i)+30,t=r(a)-30,n=(e+t)/2;return(0,P.jsxs)(`g`,{className:o,children:[(0,P.jsx)(`path`,{d:`M${e} ${R} C${n} 179 ${n} 159 ${t} 169`}),(0,P.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${R}`})]},`${i}-${a}`)}return(0,P.jsx)(`g`,{className:o,children:(0,P.jsx)(`path`,{d:`M${r(i)} ${z} Q${(r(i)+r(a))/2} 222 ${r(a)} ${z}`})},`${i}-${a}`)})})}var G=e=>e.offsetLeft-(e.parentElement?.scrollLeft||0);function ae({sessions:e,collisions:t}){let[n,r]=(0,N.useState)(T),[i,a]=(0,N.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(D,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=S(C(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>E(e,s);return(0,P.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,P.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,P.jsxs)(`span`,{className:`dim act-sm`,children:[e.length,` tree`,e.length===1?``:`s`,` · `,c.length,` `,c.length===1?`shelf`:`shelves`,` · hover a tree, or one of its pads, for its details`]}),(0,P.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Sakura`})]}),l.length>0&&(0,P.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,P.jsxs)(`button`,{type:`button`,className:`chip-f`,"aria-expanded":!1,onClick:()=>a(t=>new Set(t).add(e.key)),children:[e.name,` · `,e.trees.length]},e.key))}),c.filter(e=>!e.collapsed).map(e=>(0,P.jsx)(K,{sh:e,sakura:n,cols:s,mineOf:u},e.key))]})}function K({sh:e,sakura:t,cols:n,mineOf:r}){let[i,a]=(0,N.useState)({sid:null,pad:null,x:0}),o=(0,N.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=e.trees.find(e=>e.s.session_id===i.sid)?.s,c=s?A(s,{sakura:t}):null,l=c&&i.pad!=null?c.pads[i.pad]:null;return(0,P.jsxs)(`section`,{className:`gd-shelf`,"aria-label":`${e.name} shelf`,children:[(0,P.jsxs)(`h3`,{className:`act-lbl gd-shelf-h`,children:[e.name,` `,(0,P.jsxs)(`span`,{className:`dim`,children:[`· `,e.trees.length]})]}),(0,P.jsxs)(`div`,{className:`gd-row`,children:[e.trees.map(({s:e,worktree:n})=>(0,P.jsx)(U,{s:e,worktree:n,sakura:t,mine:r(e.session_id),pad:e.session_id===i.sid?i.pad:null,onHover:o},e.session_id)),(0,P.jsx)(W,{pairs:M(e.trees,n),count:e.trees.length})]}),s&&(0,P.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:l?(0,P.jsx)(j,{pad:l}):(0,P.jsx)(H,{s,t:c,mine:r(s.session_id)})})]})}var q=e=>e.catch(()=>null);function J({s:e}){let t=(0,N.useId)(),n=e.todos,r=a(e);return(0,P.jsxs)(`a`,{className:`card pad-md act-card`,href:`#/activity/${encodeURIComponent(e.session_id)}`,"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,P.jsx)(b,{s:e,id:t,heading:e.title||s(e.cwd)||e.session_id,children:(0,P.jsx)(_,{name:`chevron`,className:`glyph act-chev`})}),n&&n.total>0&&(0,P.jsx)(`div`,{className:`act-foot`,children:(0,P.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,P.jsx)(c,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,P.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,h(e.updated_at),` ago`]})]})}var Y={blocked:`is blocked`,"waiting-input":`waits for your answer`};function oe(e,t){if(!Array.isArray(t))return``;let n=t.filter(g),r=e.current;return e.current=new Set(n.map(e=>`${e.session_id}:${e.status}`)),r?n.filter(e=>!r.has(`${e.session_id}:${e.status}`)).map(e=>`${e.title||s(e.cwd)||e.session_id} ${Y[e.status]}`).join(`. `):``}var X=[[`all`,`All`],[`needs`,`Needs you`],[`runs`,`Runs`],[`gates`,`Gate asks`]];function se(){let e=new URLSearchParams(window.location.hash.split(`?`)[1]||``),t=e.get(`f`);return{f:X.some(([e])=>e===t)?t:`all`,host:e.get(`host`)||``,project:e.get(`project`)||``,v:e.get(`v`)===`list`?`list`:`garden`}}function ce(e){let t=new URLSearchParams;e.f!==`all`&&t.set(`f`,e.f),e.v===`list`&&t.set(`v`,`list`),e.host&&t.set(`host`,e.host),e.project&&t.set(`project`,e.project);let n=t.toString();window.history.replaceState(null,``,`#/activity${n?`?${n}`:``}`)}function le({enabled:e,onToggle:t}){return(0,P.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,P.jsx)(_,{name:`activity`,className:`glyph act-fixed`}),(0,P.jsxs)(`div`,{className:`act-grow`,children:[(0,P.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,P.jsx)(`p`,{className:`dim act-sm act-track-p`,children:`Runs and gate asks below come from the job log and the gate ledger. Turn tracking on to see what each session is doing now.`})]}),(0,P.jsxs)(`div`,{className:`row gap-10 act-fixed act-sm`,children:[(0,P.jsx)(`span`,{id:`act-track-l`,children:`Track live sessions`}),(0,P.jsx)(`div`,{className:`sw-toggle${e?` on`:``}`,role:`switch`,"aria-checked":e,"aria-labelledby":`act-track-l`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.key===` `&&e.preventDefault(),t())}})]})]})}function ue({jobs:e,loading:t}){let n=typeof e?.cap==`number`?e.cap:void 0,r=d(e?.jobs,{days:14,cap:n}),i=p(r.map(e=>e.nodata?`-`:e.n).join(`,`),`scaleY`),a=Math.max(1,...r.map(e=>e.n)),o=r.reduce((e,t)=>e+t.n,0),s=r.find(e=>!e.nodata),c=r.some(e=>e.nodata),l=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${f(e.key)}`).join(`, `)||`none`}.`+(c?s?` Days before ${f(s.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,P.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,P.jsxs)(`div`,{className:`act-stat-head`,children:[(0,P.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,P.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,P.jsx)(`p`,{className:`dim act-sm`,children:`Reading the job log…`}):e?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":l,ref:i,children:r.map(e=>e.nodata?(0,P.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,P.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${f(e.key)}: ${e.n}`},e.key):(0,P.jsx)(`i`,{className:`zero`},e.key))}),(0,P.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,P.jsx)(`span`,{children:f(r[0].key)}),(0,P.jsx)(`span`,{children:f(r[7].key)}),(0,P.jsx)(`span`,{children:`today`})]}),c&&(0,P.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,P.jsx)(`p`,{className:`dim act-sm`,children:`The job log could not be read.`})]})}function de({rows:e,gates:t,loading:n}){let r=e.reduce((e,t)=>e+t.n,0);return(0,P.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,P.jsxs)(`div`,{className:`act-stat-head`,children:[(0,P.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,P.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,P.jsx)(`p`,{className:`dim act-sm`,children:`Reading the gate ledger…`}):e.length?(0,P.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,P.jsxs)(`li`,{children:[(0,P.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,P.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,P.jsx)(m,{vals:e.per_day,i:t,sweep:!0}),(0,P.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,P.jsx)(`p`,{className:`dim act-sm`,children:t?`No gate asked in 30 days.`:`The gate ledger could not be read.`})]})}var Z={done:[`ok`,`done`],failed:[`bad`,`failed`],running:[``,`running`]};function fe({job:e,longest:t}){let n=l(e),r=e.duration?Math.round(e.duration*10)/10:0,[i,a]=Z[e.status]||[``,e.status||`…`],o=e.status===`running`?`Still running`:r?`Took ${r} second${r===1?``:`s`}`:`No duration`,s=e.started?new Date(e.started*1e3).toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`}):`—`;return(0,P.jsxs)(`li`,{className:`act-row`,children:[(0,P.jsx)(`span`,{className:`mono dim act-xs`,children:s}),(0,P.jsx)(_,{name:`play`,className:`glyph act-glyph`}),(0,P.jsxs)(`span`,{className:`act-what`,children:[(0,P.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,P.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,P.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":o,children:(0,P.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,P.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function pe({gate:e}){return(0,P.jsxs)(`li`,{className:`act-row gate`,children:[(0,P.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,P.jsx)(_,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,P.jsxs)(`span`,{className:`act-what`,children:[(0,P.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,P.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,P.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`badge warn`,children:`asked`})]})}var Q=5,$=(e,t)=>[...new Set([...e.filter(Boolean),t].filter(Boolean))];function me(){let[e,t]=(0,N.useState)(null),[n,a]=(0,N.useState)(``),[o,c]=(0,N.useState)(se),[l,d]=(0,N.useState)(!1),[f,m]=(0,N.useState)(``),h=(0,N.useRef)(null),_=e=>{let t={...o,...e};c(t),ce(t)};ie(e=>r.activity().then(n=>{if(e()){t(n),a(``);let e=oe(h,n?.activity);e&&m(t=>t===e?e+`\xA0`:e)}},t=>{e()&&a(t.message)}),2e3,[]);let b=v(()=>q(r.jobs()),[]),S=v(()=>q(r.gates()),[]),C=v(()=>q(r.catalog(`laws`)),[]),w=!e||e.enabled!==!1,T=[...e?.activity||[]].sort((e,t)=>e.session_id<t.session_id?-1:+(e.session_id>t.session_id)),E=i(),D=w&&e?T.filter(g).length:null,O=new Set(T.map(e=>e.session_id)),k=(e?.ended||[]).filter(e=>!O.has(e.session_id)),A=$([...T,...k].map(e=>e.host),o.host),j=$([...T,...k].map(e=>s(e.cwd)),o.project),M=o.host&&o.project?`host or project`:o.host?`host`:o.project?`project`:``,F=e=>(!o.host||e.host===o.host)&&(!o.project||s(e.cwd)===o.project),I=T.filter(e=>F(e)&&(o.f!==`needs`||g(e))),L=o.f===`all`||o.f===`needs`,R=o.f===`all`&&w?k.filter(F):[],z=l?R:R.slice(0,Q),B=!M&&(o.f===`all`||o.f===`runs`),V=!M&&(o.f===`all`||o.f===`gates`),H=b.data?.jobs||[],U=y(S.data,C.data),W=re(H,U,S.data?.days).map(e=>({...e,runs:B?e.runs:[],gate:V?e.gate:null})).filter(e=>e.runs.length||e.gate),G=Math.max(0,...H.map(e=>e.duration||0)),K=p(W.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),Y=async()=>{let e=!w;try{let n=await r.activityToggle(e);if(n.ok===!1){a(n.error||`Could not change tracking`);return}t(e=>({...e||{},enabled:n.enabled,activity:n.enabled&&e?.activity||[],ended:n.enabled&&e?.ended||[]})),a(``)}catch(e){a(e.message)}},Z=(e,t,n)=>(0,P.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,P.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,P.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:o[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>_({[e]:t.target.value}),children:[(0,P.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})]});return(0,P.jsxs)(`div`,{className:`page-fill`,children:[(0,P.jsx)(ee,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,P.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:f}),n&&(0,P.jsx)(`div`,{className:`act-gap`,children:(0,P.jsx)(u,{error:n})}),e&&(0,P.jsx)(le,{enabled:w,onToggle:Y}),(0,P.jsxs)(`div`,{className:`act-today`,children:[(0,P.jsx)(ue,{jobs:b.data,loading:b.loading}),(0,P.jsx)(de,{rows:U,gates:S.data,loading:S.loading}),(0,P.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,P.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),(0,P.jsxs)(`span`,{className:`act-big act-wait`,children:[D??`—`,` `,(0,P.jsx)(`span`,{className:`dim act-sm`,children:`sessions`})]}),(0,P.jsx)(`p`,{className:`dim act-sm`,children:w?`A session that waits on an approval or on your answer counts here.`:`Turn tracking on to count the sessions that wait on you.`})]})]}),(0,P.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,P.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:X.map(([e,t])=>(0,P.jsxs)(`button`,{type:`button`,className:o.f===e?`chip-f on`:`chip-f`,"aria-pressed":o.f===e,onClick:()=>_({f:e}),children:[t,e===`needs`&&D>0?(0,P.jsxs)(`span`,{className:`mono`,children:[` `,D]}):null]},e))}),Z(`host`,`Host`,A),Z(`project`,`Project`,j),(0,P.jsx)(ne,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,P.jsx)(`button`,{type:`button`,className:o.v===e?`on`:``,"aria-pressed":o.v===e,onClick:()=>_({v:e}),children:t},e))})]}),M&&o.f!==`needs`&&(0,P.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,M,`; showing sessions only.`]}),L&&(e?!w&&o.f!==`needs`?null:I.length===0?o.f===`needs`?(0,P.jsx)(x,{title:`Nothing waits on you`}):(0,P.jsxs)(x,{title:`No active sessions`,children:[`Run `,(0,P.jsx)(`code`,{children:`opencode`}),` and the sessions it spins up appear here.`]}):o.v===`garden`?(0,P.jsx)(ae,{sessions:I,collisions:e.collisions}):(0,P.jsx)(`div`,{className:`stack gap-12 act-live`,ref:E,children:I.map(e=>(0,P.jsx)(`div`,{"data-flip":e.session_id,children:(0,P.jsx)(J,{s:e})},e.session_id))}):(0,P.jsx)(te,{label:`Reading live sessions…`})),R.length>0&&(0,P.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,P.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),z.map(e=>(0,P.jsx)(`div`,{children:(0,P.jsx)(J,{s:e})},e.session_id)),R.length>Q&&(0,P.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":l,onClick:()=>d(e=>!e),children:l?`Show fewer`:`Show all ${R.length}`})]}),o.f!==`needs`&&(0,P.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:K,children:W.map(e=>(0,P.jsxs)(`section`,{className:`card act-day`,children:[(0,P.jsxs)(`h3`,{className:`act-day-h`,children:[(0,P.jsx)(`span`,{children:e.title}),(0,P.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,P.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,P.jsx)(fe,{job:e,longest:G},e.id)),e.gate&&(0,P.jsx)(pe,{gate:e.gate})]})]},e.key))})]})}export{me as default};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-LvBC0CnK.js";import{a as i}from"./motion-CXaUMNkg.js";import{A as a,C as o,D as s,E as c,I as l,J as u,M as d,N as f,P as p,T as m,W as ee,Y as te,Z as ne,dt as h,j as g,k as re,ot as _,pt as v,u as y,w as b}from"./index-DhNNxhfg.js";import{t as x}from"./EmptyState-1sPNleqv.js";import{a as S,c as C,d as w,i as T,l as E,n as D,o as O,r as k,s as A,t as j,u as M}from"./Bonsai-CN4rRAHc.js";import{t as ie}from"./usePoll-bDFN-Hr6.js";var N=e(t(),1),P=n(),F=4,I=56*F,L=24,R=165,z=188,B=e=>{let t=O(e);return t==null?null:Math.round(t*100)};function V(e,t,n){let r=o[e.status]||o.idle,i=t.pads.filter(e=>e.key!=null),a=t.pads.reduce((e,t)=>e+t.files.length,0)+t.fallen.reduce((e,t)=>e+t.files.length,0),c=B(e);return[`${e.title||s(e.cwd)||e.session_id}, ${e.host||`unknown host`}, ${r.label}${e.phase?`, ${e.phase}`:``}`,`${e.turns||0} turns${c==null?``:`, context ${c} %`}${e.compactions?`, ${e.compactions} compactions`:``}`,i.length?`${i.length} sub-agent${i.length===1?``:`s`} running: ${i.map(e=>`${e.type||`agent`} (${e.files.length} file${e.files.length===1?``:`s`})`).join(`, `)}`:``,t.fallen.length?`${t.fallen.length} finished`:``,`${a} file${a===1?``:`s`} changed`,n.length?`shares ${n.length} file${n.length===1?``:`s`} with another session`:``,e.error?`error: ${e.error}`:``].filter(Boolean).join(`. `)}function H({s:e,t,mine:n}){let r=B(e);return(0,P.jsxs)(`div`,{className:`card gd-card`,children:[(0,P.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`dt`,{children:`model`}),(0,P.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,P.jsx)(`dt`,{children:`turns`}),(0,P.jsx)(`dd`,{children:e.turns||0}),(0,P.jsx)(`dt`,{children:`context`}),(0,P.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,P.jsx)(`dt`,{children:`compactions`}),(0,P.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,P.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,P.jsxs)(`div`,{className:`act-xs ${e.kind===`same-worktree`?`t-bad`:`t-warn`}`,children:[`same file`,e.kind===`same-worktree`?``:`, other worktree`,`: `,e.path]},`${e.kind}:${e.path}`))]})}function U({s:e,worktree:t,sakura:n,mine:r,pad:i,onHover:a}){let c=w(e,n),l=(0,N.useMemo)(()=>A(e,{sakura:n}),[c]),u=o[e.status]||o.idle,d=Array.isArray(e.loops)?e.loops[0]:null,f=e.status!==`idle`,p=e.session_id,m=(0,N.useCallback)(e=>a(p,e),[a,p]);return(0,P.jsxs)(`a`,{className:`gd-tree${g(e)?` gd-needs`:``}`,href:`#/activity/${encodeURIComponent(e.session_id)}`,"aria-label":V(e,l,r),"data-sid":e.session_id,onMouseEnter:e=>a(p,null,G(e.currentTarget)),onMouseLeave:()=>a(null,null),onFocus:e=>a(p,null,G(e.currentTarget)),onBlur:()=>a(null,null),children:[(0,P.jsxs)(`div`,{className:`gd-label`,children:[(0,P.jsxs)(`div`,{className:`act-ell`,children:[(0,P.jsx)(`span`,{className:`mono dim`,children:e.host||`?`}),` ·`,` `,e.title||s(e.cwd)||e.session_id]}),(0,P.jsxs)(`div`,{className:`row gap-8 gd-sub`,children:[(0,P.jsx)(`span`,{className:`badge ${u.cls}`,children:u.label}),t&&(0,P.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),d&&(0,P.jsxs)(`span`,{className:`badge`,children:[`↻ `,d.title,d.iteration==null?``:` ${d.iteration}`]}),e.attribution===!1&&(0,P.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`}),e.phase&&(0,P.jsx)(`span`,{className:`dim act-ell`,children:e.phase})]})]}),(0,P.jsx)(k,{t:l,pad:i,swaying:f,onPad:m,px:F})]})}function W({pairs:e,count:t}){if(!e.length)return null;let n=t*I+(t-1)*L,r=e=>e*(I+L)+I/2;return(0,P.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*F+20,"aria-hidden":`true`,children:e.map(({a:e,b:t,kind:n})=>{let[i,a]=e<t?[e,t]:[t,e],o=`gd-thread ${n===`same-worktree`?`red`:`amber`}`;if(a-i===1){let e=r(i)+30,t=r(a)-30,n=(e+t)/2;return(0,P.jsxs)(`g`,{className:o,children:[(0,P.jsx)(`path`,{d:`M${e} ${R} C${n} 179 ${n} 159 ${t} 169`}),(0,P.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${R}`})]},`${i}-${a}`)}return(0,P.jsx)(`g`,{className:o,children:(0,P.jsx)(`path`,{d:`M${r(i)} ${z} Q${(r(i)+r(a))/2} 222 ${r(a)} ${z}`})},`${i}-${a}`)})})}var G=e=>e.offsetLeft-(e.parentElement?.scrollLeft||0);function ae({sessions:e,collisions:t}){let[n,r]=(0,N.useState)(T),[i,a]=(0,N.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(D,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=S(C(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>E(e,s);return(0,P.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,P.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,P.jsxs)(`span`,{className:`dim act-sm`,children:[e.length,` tree`,e.length===1?``:`s`,` · `,c.length,` `,c.length===1?`shelf`:`shelves`,` · hover a tree, or one of its pads, for its details`]}),(0,P.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Sakura`})]}),l.length>0&&(0,P.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,P.jsxs)(`button`,{type:`button`,className:`chip-f`,"aria-expanded":!1,onClick:()=>a(t=>new Set(t).add(e.key)),children:[e.name,` · `,e.trees.length]},e.key))}),c.filter(e=>!e.collapsed).map(e=>(0,P.jsx)(K,{sh:e,sakura:n,cols:s,mineOf:u},e.key))]})}function K({sh:e,sakura:t,cols:n,mineOf:r}){let[i,a]=(0,N.useState)({sid:null,pad:null,x:0}),o=(0,N.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=e.trees.find(e=>e.s.session_id===i.sid)?.s,c=s?A(s,{sakura:t}):null,l=c&&i.pad!=null?c.pads[i.pad]:null;return(0,P.jsxs)(`section`,{className:`gd-shelf`,"aria-label":`${e.name} shelf`,children:[(0,P.jsxs)(`h3`,{className:`act-lbl gd-shelf-h`,children:[e.name,` `,(0,P.jsxs)(`span`,{className:`dim`,children:[`· `,e.trees.length]})]}),(0,P.jsxs)(`div`,{className:`gd-row`,children:[e.trees.map(({s:e,worktree:n})=>(0,P.jsx)(U,{s:e,worktree:n,sakura:t,mine:r(e.session_id),pad:e.session_id===i.sid?i.pad:null,onHover:o},e.session_id)),(0,P.jsx)(W,{pairs:M(e.trees,n),count:e.trees.length})]}),s&&(0,P.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:l?(0,P.jsx)(j,{pad:l}):(0,P.jsx)(H,{s,t:c,mine:r(s.session_id)})})]})}var q=e=>e.catch(()=>null);function J({s:e}){let t=(0,N.useId)(),n=e.todos,r=a(e);return(0,P.jsxs)(`a`,{className:`card pad-md act-card`,href:`#/activity/${encodeURIComponent(e.session_id)}`,"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,P.jsx)(b,{s:e,id:t,heading:e.title||s(e.cwd)||e.session_id,children:(0,P.jsx)(_,{name:`chevron`,className:`glyph act-chev`})}),n&&n.total>0&&(0,P.jsx)(`div`,{className:`act-foot`,children:(0,P.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,P.jsx)(c,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,P.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,h(e.updated_at),` ago`]})]})}var Y={blocked:`is blocked`,"waiting-input":`waits for your answer`};function oe(e,t){if(!Array.isArray(t))return``;let n=t.filter(g),r=e.current;return e.current=new Set(n.map(e=>`${e.session_id}:${e.status}`)),r?n.filter(e=>!r.has(`${e.session_id}:${e.status}`)).map(e=>`${e.title||s(e.cwd)||e.session_id} ${Y[e.status]}`).join(`. `):``}var X=[[`all`,`All`],[`needs`,`Needs you`],[`runs`,`Runs`],[`gates`,`Gate asks`]];function se(){let e=new URLSearchParams(window.location.hash.split(`?`)[1]||``),t=e.get(`f`);return{f:X.some(([e])=>e===t)?t:`all`,host:e.get(`host`)||``,project:e.get(`project`)||``,v:e.get(`v`)===`list`?`list`:`garden`}}function ce(e){let t=new URLSearchParams;e.f!==`all`&&t.set(`f`,e.f),e.v===`list`&&t.set(`v`,`list`),e.host&&t.set(`host`,e.host),e.project&&t.set(`project`,e.project);let n=t.toString();window.history.replaceState(null,``,`#/activity${n?`?${n}`:``}`)}function le({enabled:e,onToggle:t}){return(0,P.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,P.jsx)(_,{name:`activity`,className:`glyph act-fixed`}),(0,P.jsxs)(`div`,{className:`act-grow`,children:[(0,P.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,P.jsx)(`p`,{className:`dim act-sm act-track-p`,children:`Runs and gate asks below come from the job log and the gate ledger. Turn tracking on to see what each session is doing now.`})]}),(0,P.jsxs)(`div`,{className:`row gap-10 act-fixed act-sm`,children:[(0,P.jsx)(`span`,{id:`act-track-l`,children:`Track live sessions`}),(0,P.jsx)(`div`,{className:`sw-toggle${e?` on`:``}`,role:`switch`,"aria-checked":e,"aria-labelledby":`act-track-l`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.key===` `&&e.preventDefault(),t())}})]})]})}function ue({jobs:e,loading:t}){let n=typeof e?.cap==`number`?e.cap:void 0,r=d(e?.jobs,{days:14,cap:n}),i=p(r.map(e=>e.nodata?`-`:e.n).join(`,`),`scaleY`),a=Math.max(1,...r.map(e=>e.n)),o=r.reduce((e,t)=>e+t.n,0),s=r.find(e=>!e.nodata),c=r.some(e=>e.nodata),l=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${f(e.key)}`).join(`, `)||`none`}.`+(c?s?` Days before ${f(s.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,P.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,P.jsxs)(`div`,{className:`act-stat-head`,children:[(0,P.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,P.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,P.jsx)(`p`,{className:`dim act-sm`,children:`Reading the job log…`}):e?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":l,ref:i,children:r.map(e=>e.nodata?(0,P.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,P.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${f(e.key)}: ${e.n}`},e.key):(0,P.jsx)(`i`,{className:`zero`},e.key))}),(0,P.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,P.jsx)(`span`,{children:f(r[0].key)}),(0,P.jsx)(`span`,{children:f(r[7].key)}),(0,P.jsx)(`span`,{children:`today`})]}),c&&(0,P.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,P.jsx)(`p`,{className:`dim act-sm`,children:`The job log could not be read.`})]})}function de({rows:e,gates:t,loading:n}){let r=e.reduce((e,t)=>e+t.n,0);return(0,P.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,P.jsxs)(`div`,{className:`act-stat-head`,children:[(0,P.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,P.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,P.jsx)(`p`,{className:`dim act-sm`,children:`Reading the gate ledger…`}):e.length?(0,P.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,P.jsxs)(`li`,{children:[(0,P.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,P.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,P.jsx)(m,{vals:e.per_day,i:t,sweep:!0}),(0,P.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,P.jsx)(`p`,{className:`dim act-sm`,children:t?`No gate asked in 30 days.`:`The gate ledger could not be read.`})]})}var Z={done:[`ok`,`done`],failed:[`bad`,`failed`],running:[``,`running`]};function fe({job:e,longest:t}){let n=l(e),r=e.duration?Math.round(e.duration*10)/10:0,[i,a]=Z[e.status]||[``,e.status||`…`],o=e.status===`running`?`Still running`:r?`Took ${r} second${r===1?``:`s`}`:`No duration`,s=e.started?new Date(e.started*1e3).toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`}):`—`;return(0,P.jsxs)(`li`,{className:`act-row`,children:[(0,P.jsx)(`span`,{className:`mono dim act-xs`,children:s}),(0,P.jsx)(_,{name:`play`,className:`glyph act-glyph`}),(0,P.jsxs)(`span`,{className:`act-what`,children:[(0,P.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,P.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,P.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":o,children:(0,P.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,P.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function pe({gate:e}){return(0,P.jsxs)(`li`,{className:`act-row gate`,children:[(0,P.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,P.jsx)(_,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,P.jsxs)(`span`,{className:`act-what`,children:[(0,P.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,P.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,P.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`badge warn`,children:`asked`})]})}var Q=5,$=(e,t)=>[...new Set([...e.filter(Boolean),t].filter(Boolean))];function me(){let[e,t]=(0,N.useState)(null),[n,a]=(0,N.useState)(``),[o,c]=(0,N.useState)(se),[l,d]=(0,N.useState)(!1),[f,m]=(0,N.useState)(``),h=(0,N.useRef)(null),_=e=>{let t={...o,...e};c(t),ce(t)};ie(e=>r.activity().then(n=>{if(e()){t(n),a(``);let e=oe(h,n?.activity);e&&m(t=>t===e?e+`\xA0`:e)}},t=>{e()&&a(t.message)}),2e3,[]);let b=v(()=>q(r.jobs()),[]),S=v(()=>q(r.gates()),[]),C=v(()=>q(r.catalog(`laws`)),[]),w=!e||e.enabled!==!1,T=[...e?.activity||[]].sort((e,t)=>e.session_id<t.session_id?-1:+(e.session_id>t.session_id)),E=i(),D=w&&e?T.filter(g).length:null,O=new Set(T.map(e=>e.session_id)),k=(e?.ended||[]).filter(e=>!O.has(e.session_id)),A=$([...T,...k].map(e=>e.host),o.host),j=$([...T,...k].map(e=>s(e.cwd)),o.project),M=o.host&&o.project?`host or project`:o.host?`host`:o.project?`project`:``,F=e=>(!o.host||e.host===o.host)&&(!o.project||s(e.cwd)===o.project),I=T.filter(e=>F(e)&&(o.f!==`needs`||g(e))),L=o.f===`all`||o.f===`needs`,R=o.f===`all`&&w?k.filter(F):[],z=l?R:R.slice(0,Q),B=!M&&(o.f===`all`||o.f===`runs`),V=!M&&(o.f===`all`||o.f===`gates`),H=b.data?.jobs||[],U=y(S.data,C.data),W=re(H,U,S.data?.days).map(e=>({...e,runs:B?e.runs:[],gate:V?e.gate:null})).filter(e=>e.runs.length||e.gate),G=Math.max(0,...H.map(e=>e.duration||0)),K=p(W.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),Y=async()=>{let e=!w;try{let n=await r.activityToggle(e);if(n.ok===!1){a(n.error||`Could not change tracking`);return}t(e=>({...e||{},enabled:n.enabled,activity:n.enabled&&e?.activity||[],ended:n.enabled&&e?.ended||[]})),a(``)}catch(e){a(e.message)}},Z=(e,t,n)=>(0,P.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,P.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,P.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:o[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>_({[e]:t.target.value}),children:[(0,P.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})]});return(0,P.jsxs)(`div`,{className:`page-fill`,children:[(0,P.jsx)(ee,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,P.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:f}),n&&(0,P.jsx)(`div`,{className:`act-gap`,children:(0,P.jsx)(u,{error:n})}),e&&(0,P.jsx)(le,{enabled:w,onToggle:Y}),(0,P.jsxs)(`div`,{className:`act-today`,children:[(0,P.jsx)(ue,{jobs:b.data,loading:b.loading}),(0,P.jsx)(de,{rows:U,gates:S.data,loading:S.loading}),(0,P.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,P.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),(0,P.jsxs)(`span`,{className:`act-big act-wait`,children:[D??`—`,` `,(0,P.jsx)(`span`,{className:`dim act-sm`,children:`sessions`})]}),(0,P.jsx)(`p`,{className:`dim act-sm`,children:w?`A session that waits on an approval or on your answer counts here.`:`Turn tracking on to count the sessions that wait on you.`})]})]}),(0,P.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,P.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:X.map(([e,t])=>(0,P.jsxs)(`button`,{type:`button`,className:o.f===e?`chip-f on`:`chip-f`,"aria-pressed":o.f===e,onClick:()=>_({f:e}),children:[t,e===`needs`&&D>0?(0,P.jsxs)(`span`,{className:`mono`,children:[` `,D]}):null]},e))}),Z(`host`,`Host`,A),Z(`project`,`Project`,j),(0,P.jsx)(ne,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,P.jsx)(`button`,{type:`button`,className:o.v===e?`on`:``,"aria-pressed":o.v===e,onClick:()=>_({v:e}),children:t},e))})]}),M&&o.f!==`needs`&&(0,P.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,M,`; showing sessions only.`]}),L&&(e?!w&&o.f!==`needs`?null:I.length===0?o.f===`needs`?(0,P.jsx)(x,{title:`Nothing waits on you`}):(0,P.jsxs)(x,{title:`No active sessions`,children:[`Run `,(0,P.jsx)(`code`,{children:`opencode`}),` and the sessions it spins up appear here.`]}):o.v===`garden`?(0,P.jsx)(ae,{sessions:I,collisions:e.collisions}):(0,P.jsx)(`div`,{className:`stack gap-12 act-live`,ref:E,children:I.map(e=>(0,P.jsx)(`div`,{"data-flip":e.session_id,children:(0,P.jsx)(J,{s:e})},e.session_id))}):(0,P.jsx)(te,{label:`Reading live sessions…`})),R.length>0&&(0,P.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,P.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),z.map(e=>(0,P.jsx)(`div`,{children:(0,P.jsx)(J,{s:e})},e.session_id)),R.length>Q&&(0,P.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":l,onClick:()=>d(e=>!e),children:l?`Show fewer`:`Show all ${R.length}`})]}),o.f!==`needs`&&(0,P.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:K,children:W.map(e=>(0,P.jsxs)(`section`,{className:`card act-day`,children:[(0,P.jsxs)(`h3`,{className:`act-day-h`,children:[(0,P.jsx)(`span`,{children:e.title}),(0,P.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,P.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,P.jsx)(fe,{job:e,longest:G},e.id)),e.gate&&(0,P.jsx)(pe,{gate:e.gate})]})]},e.key))})]})}export{me as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BfpZmUMI.js";import{D as i,J as a,O as o,W as s,Y as c,dt as l,j as u,ot as d,w as f}from"./index-FLVXXvV3.js";import{t as p}from"./EmptyState-1sPNleqv.js";import{d as m,i as h,o as g,r as _,s as v,t as y}from"./Bonsai-CN4rRAHc.js";import{t as b}from"./usePoll-bDFN-Hr6.js";var x=e(t(),1),S=n();function C(e){return e.kind===`tool`?e.status===`error`?`bad`:e.status===`completed`?`ok`:`acc`:{retry:`warn`,error:`bad`,subtask:`acc`,text:`acc`}[e.kind]||``}function w({rec:e}){let t=e.who===`you`,n=[];t||(e.kind===`tool`&&e.ms!=null&&n.push(`${(e.ms/1e3).toFixed(1)}s`),e.kind===`step`&&(e.tokens&&n.push(`${o(e.tokens)} tok`),e.cost&&n.push(`$${e.cost.toFixed(2)}`)),e.kind===`subtask`&&e.agent&&n.unshift(e.agent));let r=!t&&(e.kind===`text`||e.kind===`thinking`||e.kind===`step`),i=t?e.text:e.label||e.snippet||e.kind;return(0,S.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,S.jsx)(`span`,{className:`badge act-who ${t?``:`acc`}`,children:t?`you`:`agent`}),(0,S.jsxs)(`div`,{className:`act-grow act-sm`,children:[!t&&(0,S.jsx)(`span`,{className:`feed-dot act-inline-dot ${C(e)||`acc`}`}),e.kind===`thinking`&&(0,S.jsx)(`span`,{className:`dim`,children:`thinking: `}),r?(0,S.jsx)(`span`,{className:`dim`,children:i}):t?i:(0,S.jsx)(`b`,{children:i}),e.error&&(0,S.jsxs)(`span`,{className:`dim`,children:[`: `,e.error]})]}),n.length>0&&(0,S.jsx)(`span`,{className:`dim mono act-xs act-fixed`,children:n.join(` · `)}),e.t?(0,S.jsx)(`time`,{className:`mono dim act-xs act-fixed`,dateTime:new Date(e.t).toISOString(),title:`${l(e.t/1e3)} ago`,children:new Date(e.t).toTimeString().slice(0,8)}):null]})}function T({turns:e}){return!e||e.length===0?(0,S.jsx)(`div`,{className:`dim act-sm`,children:`No conversation captured yet.`}):(0,S.jsx)(`div`,{className:`stack gap-12`,children:e.map((e,t)=>{let n=e.role===`user`;return(0,S.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,S.jsx)(`span`,{className:`badge act-who ${n?``:`acc`}`,children:n?`you`:`agent`}),(0,S.jsx)(`div`,{className:`act-min act-sm${n?``:` muted`}`,children:e.text})]},t)})})}var E=5;function D({s:e}){let[t]=(0,x.useState)(h),[n,r]=(0,x.useState)(null),i=!!e.ended,a=i?{...e,status:u(e)?`busy`:e.status,error:null}:e,o=m(a,t),s=(0,x.useMemo)(()=>v(a,{sakura:t}),[o]),c=(0,x.useCallback)(e=>r(e),[]),l=g(e),d=Number(e.turns)||0,f=Number(e.compactions)||0,p=[`${d} turn${d===1?``:`s`}`,`context ${l==null?`unknown`:`${Math.round(l*100)} %`}`,`${f} compaction${f===1?``:`s`}`,`sub-agents: ${s.pads.filter(e=>e.key!=null).length} ${i?`unfinished`:`running`}, ${s.fallen.length} finished`].join(` · `),b=n==null?null:s.pads[n];return(0,S.jsxs)(`div`,{className:`card pad-md act-mt gd-detail${!i&&u(e)?` gd-needs`:``}`,children:[(0,S.jsx)(_,{t:s,pad:n,swaying:!i&&e.status!==`idle`,onPad:c,px:E,label:`Bonsai of this session${i?`, ended`:``}: ${p}`}),(0,S.jsxs)(`div`,{className:`stack gap-8 act-min`,children:[i&&(0,S.jsx)(`span`,{className:`dim act-xs`,children:`ended`}),(0,S.jsx)(`div`,{className:`dim act-sm`,children:p}),b?(0,S.jsx)(y,{pad:b}):(0,S.jsx)(`div`,{className:`dim act-xs`,children:`Hover a pad for the files it changed.`})]})]})}function O({sid:e}){let[t,n]=(0,x.useState)(null),[o,u]=(0,x.useState)(``),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(!1),v=(0,x.useId)();b(t=>m?void 0:r.activityDetail(e).then(e=>{t()&&(n(e),u(``),h(!1))},e=>{t()&&(e.status===404?h(!0):u(e.message))}),2e3,[e,m]);let y=(0,S.jsxs)(`a`,{className:`btn ghost sm act-back`,href:`#/activity`,children:[(0,S.jsx)(d,{name:`arrow`}),` Activity`]});if(m)return(0,S.jsxs)(`div`,{className:`page-fill`,children:[y,(0,S.jsx)(p,{title:`Session ended`,action:(0,S.jsx)(`a`,{href:`#/activity`,children:`Back to Activity`}),children:`It's no longer live.`})]});if(!t)return(0,S.jsxs)(`div`,{className:`page-fill`,children:[y,o?(0,S.jsx)(a,{error:o}):(0,S.jsx)(c,{label:`Loading session…`})]});let C=t.session,E=C.files,O=C.todos,k=!!(E&&E.items&&E.items.length>0),A=!!(O&&O.items&&O.items.length>0),j=t.conversation||[],M=t.timeline||[],N=[...j.filter(e=>e.role===`user`).map(e=>({who:`you`,text:e.text,t:e.t||0})),...M.map(e=>({...e,who:`agent`}))].sort((e,t)=>(e.t||0)-(t.t||0));return(0,S.jsxs)(`div`,{className:`page-fill`,children:[y,(0,S.jsx)(s,{title:C.title||i(C.cwd)||C.session_id,sub:C.cwd?(0,S.jsx)(`span`,{className:`mono act-cwd`,title:C.cwd,children:C.cwd}):null}),o&&(0,S.jsx)(`div`,{className:`act-gap`,children:(0,S.jsx)(a,{error:o})}),(0,S.jsxs)(`div`,{className:`card pad-md`,children:[(0,S.jsx)(f,{s:C}),(0,S.jsxs)(`div`,{className:`dim act-updated`,children:[`updated `,l(C.updated_at),` ago`]})]}),(0,S.jsx)(D,{s:C}),(k||A)&&(0,S.jsxs)(`div`,{className:`grid gap-12 act-panels${k&&A?` two`:``}`,children:[k&&(0,S.jsxs)(`div`,{className:`card pad-md`,children:[(0,S.jsx)(`div`,{className:`card-head`,children:(0,S.jsxs)(`h2`,{children:[`Files touched `,(0,S.jsxs)(`span`,{className:`dim`,children:[`(`,E.count,`)`]})]})}),(0,S.jsx)(`div`,{className:`stack act-list`,children:E.items.map(e=>(0,S.jsxs)(`div`,{className:`row between gap-12 act-sm`,children:[(0,S.jsx)(`span`,{className:`mono act-ell act-grow`,title:e.file,children:e.file}),(0,S.jsxs)(`span`,{className:`act-fixed`,children:[(0,S.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions]}),` `,(0,S.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions]})]})]},e.file))})]}),A&&(0,S.jsxs)(`div`,{className:`card pad-md`,children:[(0,S.jsx)(`div`,{className:`card-head`,children:(0,S.jsxs)(`h2`,{children:[`Plan`,` `,(0,S.jsxs)(`span`,{className:`dim`,children:[`(`,O.done,`/`,O.total,`)`]})]})}),(0,S.jsx)(`div`,{className:`stack act-list`,children:O.items.map((e,t)=>(0,S.jsxs)(`div`,{className:`row gap-8 act-sm`,children:[(0,S.jsx)(`span`,{className:`feed-dot ${e.status===`completed`?`ok`:e.status===`in_progress`?`acc`:``}`}),(0,S.jsx)(`span`,{className:e.status===`completed`?`act-done`:void 0,children:e.content})]},t))})]})]}),(0,S.jsxs)(`div`,{className:`card pad-md act-mt`,children:[(0,S.jsxs)(`div`,{className:`card-head act-tl-head`,children:[(0,S.jsx)(`h2`,{children:`Timeline`}),M.length>0&&(0,S.jsx)(`button`,{className:`btn ghost sm`,"aria-expanded":g,"aria-controls":v,onClick:()=>_(e=>!e),children:g?`Show conversation`:`Show full stream (${N.length})`})]}),(0,S.jsx)(`div`,{id:v,children:g?(0,S.jsx)(`div`,{className:`stack gap-12`,children:N.map((e,t)=>(0,S.jsx)(w,{rec:e},t))}):(0,S.jsx)(T,{turns:j})})]})]})}export{D as SessionTree,O as default};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-LvBC0CnK.js";import{D as i,J as a,O as o,W as s,Y as c,dt as l,j as u,ot as d,w as f}from"./index-DhNNxhfg.js";import{t as p}from"./EmptyState-1sPNleqv.js";import{d as m,i as h,o as g,r as _,s as v,t as y}from"./Bonsai-CN4rRAHc.js";import{t as b}from"./usePoll-bDFN-Hr6.js";var x=e(t(),1),S=n();function C(e){return e.kind===`tool`?e.status===`error`?`bad`:e.status===`completed`?`ok`:`acc`:{retry:`warn`,error:`bad`,subtask:`acc`,text:`acc`}[e.kind]||``}function w({rec:e}){let t=e.who===`you`,n=[];t||(e.kind===`tool`&&e.ms!=null&&n.push(`${(e.ms/1e3).toFixed(1)}s`),e.kind===`step`&&(e.tokens&&n.push(`${o(e.tokens)} tok`),e.cost&&n.push(`$${e.cost.toFixed(2)}`)),e.kind===`subtask`&&e.agent&&n.unshift(e.agent));let r=!t&&(e.kind===`text`||e.kind===`thinking`||e.kind===`step`),i=t?e.text:e.label||e.snippet||e.kind;return(0,S.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,S.jsx)(`span`,{className:`badge act-who ${t?``:`acc`}`,children:t?`you`:`agent`}),(0,S.jsxs)(`div`,{className:`act-grow act-sm`,children:[!t&&(0,S.jsx)(`span`,{className:`feed-dot act-inline-dot ${C(e)||`acc`}`}),e.kind===`thinking`&&(0,S.jsx)(`span`,{className:`dim`,children:`thinking: `}),r?(0,S.jsx)(`span`,{className:`dim`,children:i}):t?i:(0,S.jsx)(`b`,{children:i}),e.error&&(0,S.jsxs)(`span`,{className:`dim`,children:[`: `,e.error]})]}),n.length>0&&(0,S.jsx)(`span`,{className:`dim mono act-xs act-fixed`,children:n.join(` · `)}),e.t?(0,S.jsx)(`time`,{className:`mono dim act-xs act-fixed`,dateTime:new Date(e.t).toISOString(),title:`${l(e.t/1e3)} ago`,children:new Date(e.t).toTimeString().slice(0,8)}):null]})}function T({turns:e}){return!e||e.length===0?(0,S.jsx)(`div`,{className:`dim act-sm`,children:`No conversation captured yet.`}):(0,S.jsx)(`div`,{className:`stack gap-12`,children:e.map((e,t)=>{let n=e.role===`user`;return(0,S.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,S.jsx)(`span`,{className:`badge act-who ${n?``:`acc`}`,children:n?`you`:`agent`}),(0,S.jsx)(`div`,{className:`act-min act-sm${n?``:` muted`}`,children:e.text})]},t)})})}var E=5;function D({s:e}){let[t]=(0,x.useState)(h),[n,r]=(0,x.useState)(null),i=!!e.ended,a=i?{...e,status:u(e)?`busy`:e.status,error:null}:e,o=m(a,t),s=(0,x.useMemo)(()=>v(a,{sakura:t}),[o]),c=(0,x.useCallback)(e=>r(e),[]),l=g(e),d=Number(e.turns)||0,f=Number(e.compactions)||0,p=[`${d} turn${d===1?``:`s`}`,`context ${l==null?`unknown`:`${Math.round(l*100)} %`}`,`${f} compaction${f===1?``:`s`}`,`sub-agents: ${s.pads.filter(e=>e.key!=null).length} ${i?`unfinished`:`running`}, ${s.fallen.length} finished`].join(` · `),b=n==null?null:s.pads[n];return(0,S.jsxs)(`div`,{className:`card pad-md act-mt gd-detail${!i&&u(e)?` gd-needs`:``}`,children:[(0,S.jsx)(_,{t:s,pad:n,swaying:!i&&e.status!==`idle`,onPad:c,px:E,label:`Bonsai of this session${i?`, ended`:``}: ${p}`}),(0,S.jsxs)(`div`,{className:`stack gap-8 act-min`,children:[i&&(0,S.jsx)(`span`,{className:`dim act-xs`,children:`ended`}),(0,S.jsx)(`div`,{className:`dim act-sm`,children:p}),b?(0,S.jsx)(y,{pad:b}):(0,S.jsx)(`div`,{className:`dim act-xs`,children:`Hover a pad for the files it changed.`})]})]})}function O({sid:e}){let[t,n]=(0,x.useState)(null),[o,u]=(0,x.useState)(``),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(!1),v=(0,x.useId)();b(t=>m?void 0:r.activityDetail(e).then(e=>{t()&&(n(e),u(``),h(!1))},e=>{t()&&(e.status===404?h(!0):u(e.message))}),2e3,[e,m]);let y=(0,S.jsxs)(`a`,{className:`btn ghost sm act-back`,href:`#/activity`,children:[(0,S.jsx)(d,{name:`arrow`}),` Activity`]});if(m)return(0,S.jsxs)(`div`,{className:`page-fill`,children:[y,(0,S.jsx)(p,{title:`Session ended`,action:(0,S.jsx)(`a`,{href:`#/activity`,children:`Back to Activity`}),children:`It's no longer live.`})]});if(!t)return(0,S.jsxs)(`div`,{className:`page-fill`,children:[y,o?(0,S.jsx)(a,{error:o}):(0,S.jsx)(c,{label:`Loading session…`})]});let C=t.session,E=C.files,O=C.todos,k=!!(E&&E.items&&E.items.length>0),A=!!(O&&O.items&&O.items.length>0),j=t.conversation||[],M=t.timeline||[],N=[...j.filter(e=>e.role===`user`).map(e=>({who:`you`,text:e.text,t:e.t||0})),...M.map(e=>({...e,who:`agent`}))].sort((e,t)=>(e.t||0)-(t.t||0));return(0,S.jsxs)(`div`,{className:`page-fill`,children:[y,(0,S.jsx)(s,{title:C.title||i(C.cwd)||C.session_id,sub:C.cwd?(0,S.jsx)(`span`,{className:`mono act-cwd`,title:C.cwd,children:C.cwd}):null}),o&&(0,S.jsx)(`div`,{className:`act-gap`,children:(0,S.jsx)(a,{error:o})}),(0,S.jsxs)(`div`,{className:`card pad-md`,children:[(0,S.jsx)(f,{s:C}),(0,S.jsxs)(`div`,{className:`dim act-updated`,children:[`updated `,l(C.updated_at),` ago`]})]}),(0,S.jsx)(D,{s:C}),(k||A)&&(0,S.jsxs)(`div`,{className:`grid gap-12 act-panels${k&&A?` two`:``}`,children:[k&&(0,S.jsxs)(`div`,{className:`card pad-md`,children:[(0,S.jsx)(`div`,{className:`card-head`,children:(0,S.jsxs)(`h2`,{children:[`Files touched `,(0,S.jsxs)(`span`,{className:`dim`,children:[`(`,E.count,`)`]})]})}),(0,S.jsx)(`div`,{className:`stack act-list`,children:E.items.map(e=>(0,S.jsxs)(`div`,{className:`row between gap-12 act-sm`,children:[(0,S.jsx)(`span`,{className:`mono act-ell act-grow`,title:e.file,children:e.file}),(0,S.jsxs)(`span`,{className:`act-fixed`,children:[(0,S.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions]}),` `,(0,S.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions]})]})]},e.file))})]}),A&&(0,S.jsxs)(`div`,{className:`card pad-md`,children:[(0,S.jsx)(`div`,{className:`card-head`,children:(0,S.jsxs)(`h2`,{children:[`Plan`,` `,(0,S.jsxs)(`span`,{className:`dim`,children:[`(`,O.done,`/`,O.total,`)`]})]})}),(0,S.jsx)(`div`,{className:`stack act-list`,children:O.items.map((e,t)=>(0,S.jsxs)(`div`,{className:`row gap-8 act-sm`,children:[(0,S.jsx)(`span`,{className:`feed-dot ${e.status===`completed`?`ok`:e.status===`in_progress`?`acc`:``}`}),(0,S.jsx)(`span`,{className:e.status===`completed`?`act-done`:void 0,children:e.content})]},t))})]})]}),(0,S.jsxs)(`div`,{className:`card pad-md act-mt`,children:[(0,S.jsxs)(`div`,{className:`card-head act-tl-head`,children:[(0,S.jsx)(`h2`,{children:`Timeline`}),M.length>0&&(0,S.jsx)(`button`,{className:`btn ghost sm`,"aria-expanded":g,"aria-controls":v,onClick:()=>_(e=>!e),children:g?`Show conversation`:`Show full stream (${N.length})`})]}),(0,S.jsx)(`div`,{id:v,children:g?(0,S.jsx)(`div`,{className:`stack gap-12`,children:N.map((e,t)=>(0,S.jsx)(w,{rec:e},t))}):(0,S.jsx)(T,{turns:j})})]})]})}export{D as SessionTree,O as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{ot as r}from"./index-FLVXXvV3.js";var i=e(t(),1),a=n(),o=1200;function s({text:e,label:t,title:n,className:s=`btn ghost sm`}){let[c,l]=(0,i.useState)(null),u=(0,i.useRef)(null),d=(0,i.useRef)(!1);(0,i.useEffect)(()=>(d.current=!1,()=>{d.current=!0,clearTimeout(u.current)}),[]);let f=e=>{d.current||(l(e),clearTimeout(u.current),u.current=setTimeout(()=>l(null),o))};return(0,a.jsxs)(`button`,{type:`button`,className:s,onClick:async()=>{try{await navigator.clipboard.writeText(e),f(`ok`)}catch{f(`fail`)}},"aria-label":t,title:n,children:[(0,a.jsx)(r,{name:c===`ok`?`check`:c===`fail`?`x`:`copy`}),c===`ok`?`Copied`:c===`fail`?`Copy failed`:`Copy`]})}export{s as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{ot as r}from"./index-DhNNxhfg.js";var i=e(t(),1),a=n(),o=1200;function s({text:e,label:t,title:n,className:s=`btn ghost sm`}){let[c,l]=(0,i.useState)(null),u=(0,i.useRef)(null),d=(0,i.useRef)(!1);(0,i.useEffect)(()=>(d.current=!1,()=>{d.current=!0,clearTimeout(u.current)}),[]);let f=e=>{d.current||(l(e),clearTimeout(u.current),u.current=setTimeout(()=>l(null),o))};return(0,a.jsxs)(`button`,{type:`button`,className:s,onClick:async()=>{try{await navigator.clipboard.writeText(e),f(`ok`)}catch{f(`fail`)}},"aria-label":t,title:n,children:[(0,a.jsx)(r,{name:c===`ok`?`check`:c===`fail`?`x`:`copy`}),c===`ok`?`Copied`:c===`fail`?`Copy failed`:`Copy`]})}export{s as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GreenhouseView-19roNb5W.js","assets/rolldown-runtime-hePW80VL.js","assets/react-DlYQp10C.js","assets/motion-CXaUMNkg.js","assets/sections-ChwaobfW.js","assets/index-FLVXXvV3.js","assets/api-BfpZmUMI.js","assets/index-XTGBLKQr.css","assets/OperatorHudView-xs7SCwCe.js","assets/JournalView-BgU2ybaq.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n,t as r}from"./react-DlYQp10C.js";import{t as i}from"./api-BfpZmUMI.js";import{i as a,t as o}from"./motion-CXaUMNkg.js";import{n as s,r as c}from"./sections-ChwaobfW.js";import{B as l,I as u,J as d,L as f,U as p,Y as m,Z as h,bt as g,ct as _,dt as v,l as y,lt as b,ot as x,pt as S,q as C,t as w,ut as T}from"./index-FLVXXvV3.js";var E=t(n(),1),D={neutral:`Loaded & ready`,imperial:`The Codex in force`,military:`The unit stands ready`,cyberpunk:`Jacked in`,wizard:`Wards in place`,pirate:`The crew stands ready`,gamer:`Game loaded`,sports:`The squad takes the field`,biker:`The crew rolls out`,commentator:`Lights out, away we go`,verstappen:`Setup's in`,joker:`Mic check`,mean:`Rules are up`,marvin:`Online. Reluctantly.`},O=(e,t)=>e.deployed?t===void 0||t===`good`?D[e.theme]||`Loaded & ready`:`Deployed`:`Not deployed`,k=r(),A={done:`ok`,failed:`bad`},ee={done:(0,k.jsx)(`path`,{d:`M5 12l5 5L20 7`}),failed:(0,k.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})},j=e=>typeof e==`number`&&Number.isFinite(e);function M(e){let t=[];for(let n of e){let e=u(n),r=`${e.verb}\u0000${e.scope}\u0000${n.status}`,i=t[t.length-1];if(i&&i.key===r){i.jobs.push(n),i.durations.push(j(n.duration)?n.duration:null),n.started&&(i.oldest=n.started);continue}t.push({key:r,id:n.id,verb:e.verb,scope:e.scope,status:n.status,jobs:[n],command:e.command,newest:n.started||null,oldest:n.started||null,durations:[j(n.duration)?n.duration:null]})}return t}function N(e){if(!e.newest)return`—`;let t=v(e.newest),n=e.oldest?v(e.oldest):t;return n===t?`${t} ago`:`${n} – ${t} ago`}function P({jobs:e,max:t,empty:n}){if(!e||e.length===0)return n??null;let r=f(e,t),i=Math.max(0,...r.map(e=>j(e.duration)?e.duration:0))||1,a=M(r),o=Math.max(...a.map(e=>e.jobs.length));return(0,k.jsx)(`ul`,{className:`run-chips`,children:a.map(e=>{let t=e.durations.filter(j),n=e.jobs.length,r=e.status||`running`;return(0,k.jsxs)(`li`,{className:`run-chip ${A[e.status]||`acc`}`,title:e.command||void 0,children:[(0,k.jsx)(`svg`,{className:`run-chip-icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:ee[e.status]||(0,k.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`,fill:`currentColor`,stroke:`none`})}),(0,k.jsx)(`span`,{className:`sr-only`,children:r}),(0,k.jsxs)(`span`,{className:`run-chip-main`,children:[(0,k.jsxs)(`span`,{className:`run-chip-head`,children:[(0,k.jsx)(`b`,{children:e.verb}),n>1&&(0,k.jsxs)(`span`,{className:`run-chip-times`,children:[`×`,n]})]}),(0,k.jsx)(`span`,{className:`run-chip-sub`,children:[e.scope,N(e)].filter(Boolean).join(` · `)})]}),t.length?(0,k.jsx)(`span`,{className:`run-chip-bars`,role:`img`,"aria-label":`Durations: ${t.join(`, `)} seconds`,children:t.map((e,t)=>(0,k.jsx)(`i`,{style:{width:`${e/i/o*100}%`}},t))}):(0,k.jsx)(`span`,{className:`run-chip-bars`,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`run-chip-dur`,children:t.length?n>1?`≤ ${Math.max(...t)} s`:`${t[0]} s`:`—`})]},e.id)})})}var F={good:`ok`,warn:`warn`,bad:`bad`};function I({verdict:e}){return e?(0,k.jsxs)(`span`,{className:`badge ${F[e.tone]}`,role:`status`,style:{alignSelf:`flex-start`},children:[(0,k.jsx)(`span`,{className:`dot`}),e.head]}):null}function L({overview:e,dataRev:t}){let{data:n}=S(()=>Promise.resolve().then(()=>i.catalog(`laws`)),[t],`catalog:laws`),r=_(e.diff),a=e.counts||{},s=[{key:`agents`,label:`Agents`,hash:`#/agents`},{key:`skills`,label:`Skills`,hash:`#/skills`},{key:`laws`,label:n?.nouns?.laws||`Dictates`,hash:`#/laws`}];return(0,k.jsxs)(`div`,{className:`card kpiband rise mb-16`,children:[s.map(e=>{let t=a[e.key];return(0,k.jsxs)(`a`,{className:`kseg`,href:e.hash,title:`Open ${e.label}`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(t===0?` zero`:``),children:t==null?`—`:(0,k.jsx)(o,{value:t})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:e.label})]},e.key)}),(0,k.jsx)(`div`,{className:`kseg-spacer`}),(0,k.jsxs)(`button`,{className:`kseg`+(r>0?` hot`:``),onClick:()=>g(`#/diff`),title:`Open changes`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(r===0?` zero`:``),children:(0,k.jsx)(o,{value:r})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:`Local edits`}),r>0&&(0,k.jsx)(`span`,{className:`delta up`,children:`▲`})]})]})}function R({overview:e}){return(0,k.jsx)(`div`,{className:`genome`,children:c.map((t,n)=>{let r=s[t],i=e.counts?.[t];return(0,k.jsxs)(`a`,{className:`card gcell rise`,style:{"--i":n},href:`#/section/`+t,children:[(0,k.jsxs)(`div`,{className:`gtop`,children:[(0,k.jsx)(`span`,{className:`gname`,children:r.label}),(0,k.jsx)(x,{name:r.icon,className:`gicon`})]}),(0,k.jsx)(`div`,{className:`gcount`+(i===0?` zero`:``),children:i==null?`—`:(0,k.jsx)(o,{value:i})}),(0,k.jsx)(`div`,{className:`gdesc`,children:r.desc})]},t)})})}function z({jobs:e}){if(!e||e.length===0)return(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})});let t={done:`ok`,running:`acc`,failed:`bad`},n=f(e,8);return(0,k.jsx)(`div`,{className:`feed`,children:n.map(e=>(0,k.jsxs)(`div`,{className:`feed-row`,children:[(0,k.jsx)(`span`,{className:`feed-dot ${t[e.status]||`ok`}`}),(0,k.jsx)(`span`,{className:`feed-txt`,children:(0,k.jsx)(`b`,{children:e.action})}),(0,k.jsxs)(`span`,{className:`feed-when`,children:[v(e.started),` ago`]})]},e.id))})}function B({value:e}){let t=a(e,1100)??0,n=Math.round(t*100);return(0,k.jsxs)(`div`,{className:`ring-box`,children:[(0,k.jsx)(l,{value:n,max:100,label:`germination`,size:232,stroke:10,sweepMs:0}),(0,k.jsxs)(`div`,{className:`ring-center`,children:[(0,k.jsxs)(`div`,{className:`pct`,children:[n,(0,k.jsx)(`span`,{className:`pct-unit`,children:`%`})]}),(0,k.jsx)(`div`,{className:`lbl`,children:`germination`})]})]})}function V({overview:e,sigil:t,setup:n,jobs:r,lens:i,dataRev:a}){let o=O(e,i?.tone),s=T(e,n,i?.tone);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-lg rise mb-16`,children:(0,k.jsxs)(`div`,{className:`hero`,children:[(0,k.jsx)(B,{value:s}),(0,k.jsxs)(`div`,{className:`hero-facts`,children:[(0,k.jsx)(`div`,{className:`ttl`,children:o}),(0,k.jsx)(I,{verdict:i?.verdict}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`p`,{className:`sub`,children:[`One source rendered into `,(0,k.jsx)(`code`,{children:e.target}),`. Every repo on this machine inherits it.`]}),(0,k.jsxs)(`div`,{className:`hero-chips`,children:[(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`voice`}),(0,k.jsx)(`span`,{className:`cv t-cap`,children:e.theme})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`mode`}),(0,k.jsx)(`span`,{className:`cv`,children:e.emit})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`footprint`}),(0,k.jsx)(`span`,{className:`cv`,children:e.footprint})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`built`}),(0,k.jsx)(`span`,{className:`cv`,children:e.build_time||`unknown`})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`fp`}),(0,k.jsx)(`span`,{className:`cv`,children:n?.installed_fp||`—`})]})]})]})]})}),(0,k.jsx)(L,{overview:e,dataRev:a}),(0,k.jsxs)(`div`,{className:`grid split-status`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Capability genome`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[c.length,` sections`]})})]}),(0,k.jsx)(R,{overview:e})]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Recent activity`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`badge acc`,children:[(0,k.jsx)(`span`,{className:`dot`}),`live`]})})]}),(0,k.jsx)(z,{jobs:r})]})]})]})}function H({k:e,overview:t,max:n}){let r=s[e],i=t.counts?.[e]??0;return(0,k.jsxs)(`div`,{className:`strand`,children:[(0,k.jsxs)(`span`,{className:`strand-name`,children:[(0,k.jsx)(`span`,{className:`strand-dot`}),(0,k.jsx)(`a`,{href:`#/section/`+e,className:`strand-link stretch-link`,children:r.label})]}),(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${i/n*100}%`}})}),(0,k.jsx)(`span`,{className:`strand-val`,children:i})]})}function U(e){return e?e.includes(`up to date`)?{label:`in sync`,tone:`ok`}:e.includes(`no Geneseed install`)?{label:`not installed`,tone:``}:{label:`behind source`,tone:`warn`}:null}function W({overview:e,sigil:t,setup:n,jobs:r,lens:i}){let a=b(e.counts),o=n?.version_verdict||``,s=U(o),l=_(e.diff),u=[[`Source`,`src/, the canonical genetic material`,n?.source_fp||`—`,!0],[`Render`,`geneseed build → ${e.emit}`,e.theme+` voice`,!0],[`Deployed`,e.target,`inherited by every repo`,!1]];return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`mb-16`,children:(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{position:`relative`,overflow:`hidden`},children:[(0,k.jsx)(`h2`,{className:`h`,style:{fontSize:22,margin:`0 0 18px`},children:`Gene-seed lineage`}),(0,k.jsxs)(`div`,{className:`lineage-track`,children:[(0,k.jsx)(`div`,{className:`spine`}),u.map(([e,t,n,r],i)=>(0,k.jsxs)(`div`,{className:`lineage-step`,children:[(0,k.jsx)(`span`,{className:`node ${r?`on`:``}`}),(0,k.jsx)(`div`,{className:`lt`,children:e}),(0,k.jsx)(`div`,{className:`ld`,children:t}),(0,k.jsx)(`div`,{className:`ltag`,children:n})]},i))]}),(0,k.jsx)(`hr`,{className:`hr`}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,style:{marginBottom:14},children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,k.jsx)(I,{verdict:i?.verdict}),s&&(0,k.jsxs)(`span`,{className:`badge ${s.tone}`,title:o,children:[(0,k.jsx)(`span`,{className:`dot`}),s.label]}),(0,k.jsxs)(`span`,{className:`badge`,children:[(0,k.jsx)(`span`,{className:`dot`}),l,` local edits`]})]})]})}),(0,k.jsxs)(`div`,{className:`grid split-even`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Genome strand`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsx)(`span`,{className:`tick`,children:`by volume`})})]}),c.map(t=>(0,k.jsx)(H,{k:t,overview:e,max:a},t))]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Recent activity`})}),(0,k.jsx)(z,{jobs:r})]})]})]})}function G({overview:e,setup:t,jobs:n,lens:r}){let i=c.reduce((t,n)=>t+(e.counts?.[n]??0),0),a=b(e.counts),o=e.doctor?.ok,l=e.doctor?.problems?.length??0,u=_(e.diff);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-md rise mb-16`,children:(0,k.jsx)(`div`,{className:`row wrap between gap-16`,children:(0,k.jsxs)(`div`,{className:`row`,style:{gap:20,flexWrap:`wrap`},children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`status`}),(0,k.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:[(0,k.jsxs)(`span`,{className:`badge ${e.deployed?`ok`:`warn`}`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.deployed?`deployed`:`not deployed`]}),(0,k.jsx)(I,{verdict:r?.verdict})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`voice`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6,textTransform:`capitalize`},children:e.theme})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`mode`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6},children:e.emit})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`fingerprint`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6,color:`var(--accent-text)`},children:t?.installed_fp||`—`})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`doctor`}),(0,k.jsx)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:o?(0,k.jsxs)(`span`,{className:`badge ok`,children:[(0,k.jsx)(`span`,{className:`dot`}),`clean`]}):(0,k.jsxs)(`span`,{className:`badge warn`,children:[(0,k.jsx)(`span`,{className:`dot`}),l,` issue`,l===1?``:`s`]})})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`edits`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6},children:u})]})]})})}),(0,k.jsxs)(`div`,{className:`grid split-operator`,children:[(0,k.jsxs)(`div`,{className:`card rise`,style:{"--i":1},children:[(0,k.jsxs)(`div`,{className:`card-head pad-lg`,style:{padding:`18px 20px 0`,marginBottom:14},children:[(0,k.jsx)(`h3`,{children:`Sections`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[i,` entries total`]})})]}),(0,k.jsxs)(`table`,{className:`tbl`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsxs)(`tr`,{children:[(0,k.jsx)(`th`,{children:`Section`}),(0,k.jsx)(`th`,{children:`Detail`}),(0,k.jsx)(`th`,{style:{width:130},children:`Share`}),(0,k.jsx)(`th`,{className:`num`,children:`Count`})]})}),(0,k.jsx)(`tbody`,{children:c.map(t=>{let n=s[t],r=e.counts?.[t]??0;return(0,k.jsxs)(`tr`,{className:`clickable`,children:[(0,k.jsx)(`td`,{className:`name`,children:(0,k.jsx)(`a`,{href:`#/section/`+t,className:`stretch-link`,children:n.label})}),(0,k.jsx)(`td`,{className:`muted`,children:n.desc}),(0,k.jsx)(`td`,{children:(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${r/a*100}%`}})})}),(0,k.jsx)(`td`,{className:`num`,children:r})]},t)})})]})]}),(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{"--i":2},children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Run log`})}),(0,k.jsx)(P,{jobs:n,max:8,empty:(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})})})]})]})]})}var K=Symbol(`failed`),q=e=>Promise.resolve().then(e).catch(()=>K);function J({dataRev:e,needDoctor:t}){let n=S(()=>q(()=>i.fleet()),[e]),r=S(()=>t?q(()=>i.doctor()):Promise.resolve(null),[t,e]),a=n.data,o=a==null?`loading`:a===K?`failed`:`ok`,s=o===`ok`?a:null,c=s?y(s):null,l=r.data,u=t?l==null?`loading`:l===K?`failed`:`ok`:`idle`;return{fleet:s,fleetState:o,verdict:c,tone:o===`failed`?`failed`:c?.tone,doctor:{state:u,data:u===`ok`?r.data:null}}}var Y=e({default:()=>$}),X=(0,E.lazy)(()=>w(()=>import(`./GreenhouseView-19roNb5W.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Z=(0,E.lazy)(()=>w(()=>import(`./OperatorHudView-xs7SCwCe.js`),__vite__mapDeps([8,1,2,4,5,6,3,7]))),Q=(0,E.lazy)(()=>w(()=>import(`./JournalView-BgU2ybaq.js`),__vite__mapDeps([9,1,2,6,3,4,5,7])));function $({overview:e,overviewError:t,onRetry:n,themes:r,setup:a,runs:o,onAction:s,layout:c=`cultivar`,dataRev:l}){let u=c,[f,g]=(0,E.useState)(`status`),_=e&&r.find(t=>t.name===e.theme)?.sigil||``,v=J({dataRev:l,needDoctor:u===`greenhouse`||u===`operator`}),{data:y}=S(()=>u===`journal`?i.recent().catch(()=>null):Promise.resolve(null),[u,l]);if(!e)return t?(0,k.jsx)(d,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,k.jsx)(m,{});let b=e.daemon_stale?(0,k.jsx)(C,{}):null;return e.deployed?f===`status`&&u===`journal`?(0,k.jsxs)(E.Suspense,{fallback:(0,k.jsx)(m,{}),children:[b,(0,k.jsx)(Q,{overview:e,recent:y,lens:v,onDirection:g,dataRev:l})]}):(0,k.jsxs)(k.Fragment,{children:[b,(0,k.jsx)(`div`,{className:`head-row`,children:(0,k.jsx)(h,{"aria-label":`Dashboard view`,children:[[`status`,`Status`],[`lineage`,`Lineage`],[`operator`,`Operator`,`Operator data`]].map(([e,t,n])=>(0,k.jsx)(`button`,{className:f===e?`on`:``,onClick:()=>g(e),"aria-pressed":f===e,"aria-label":n,children:t},e))})}),(0,k.jsxs)(`div`,{className:`view-in`,children:[f===`status`&&u===`cultivar`&&(0,k.jsx)(V,{overview:e,sigil:_,setup:a,jobs:o,lens:v,dataRev:l}),f===`status`&&u===`greenhouse`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(m,{}),children:(0,k.jsx)(X,{overview:e,sigil:_,jobs:o,lens:v,onAction:s})}),f===`status`&&u===`operator`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(m,{}),children:(0,k.jsx)(Z,{overview:e,jobs:o,lens:v})}),f===`lineage`&&(0,k.jsx)(W,{overview:e,sigil:_,setup:a,jobs:o,lens:v}),f===`operator`&&(0,k.jsx)(G,{overview:e,setup:a,jobs:o,lens:v})]},f)]}):(0,k.jsxs)(k.Fragment,{children:[b,(0,k.jsx)(p,{onAction:s})]})}export{$ as default,O as i,I as n,P as r,Y as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GreenhouseView-DPwhFO_j.js","assets/rolldown-runtime-hePW80VL.js","assets/react-DlYQp10C.js","assets/motion-CXaUMNkg.js","assets/sections-ChwaobfW.js","assets/index-DhNNxhfg.js","assets/api-LvBC0CnK.js","assets/index-XTGBLKQr.css","assets/OperatorHudView-CLN6Qn25.js","assets/JournalView-DQlDC-7i.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n,t as r}from"./react-DlYQp10C.js";import{t as i}from"./api-LvBC0CnK.js";import{i as a,t as o}from"./motion-CXaUMNkg.js";import{n as s,r as c}from"./sections-ChwaobfW.js";import{B as l,I as u,J as d,L as f,U as p,Y as m,Z as h,bt as g,ct as _,dt as v,l as y,lt as b,ot as x,pt as S,q as C,t as w,ut as T}from"./index-DhNNxhfg.js";var E=t(n(),1),D={neutral:`Loaded & ready`,imperial:`The Codex in force`,military:`The unit stands ready`,cyberpunk:`Jacked in`,wizard:`Wards in place`,pirate:`The crew stands ready`,gamer:`Game loaded`,sports:`The squad takes the field`,biker:`The crew rolls out`,commentator:`Lights out, away we go`,verstappen:`Setup's in`,joker:`Mic check`,mean:`Rules are up`,marvin:`Online. Reluctantly.`},O=(e,t)=>e.deployed?t===void 0||t===`good`?D[e.theme]||`Loaded & ready`:`Deployed`:`Not deployed`,k=r(),A={done:`ok`,failed:`bad`},ee={done:(0,k.jsx)(`path`,{d:`M5 12l5 5L20 7`}),failed:(0,k.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})},j=e=>typeof e==`number`&&Number.isFinite(e);function M(e){let t=[];for(let n of e){let e=u(n),r=`${e.verb}\u0000${e.scope}\u0000${n.status}`,i=t[t.length-1];if(i&&i.key===r){i.jobs.push(n),i.durations.push(j(n.duration)?n.duration:null),n.started&&(i.oldest=n.started);continue}t.push({key:r,id:n.id,verb:e.verb,scope:e.scope,status:n.status,jobs:[n],command:e.command,newest:n.started||null,oldest:n.started||null,durations:[j(n.duration)?n.duration:null]})}return t}function N(e){if(!e.newest)return`—`;let t=v(e.newest),n=e.oldest?v(e.oldest):t;return n===t?`${t} ago`:`${n} – ${t} ago`}function P({jobs:e,max:t,empty:n}){if(!e||e.length===0)return n??null;let r=f(e,t),i=Math.max(0,...r.map(e=>j(e.duration)?e.duration:0))||1,a=M(r),o=Math.max(...a.map(e=>e.jobs.length));return(0,k.jsx)(`ul`,{className:`run-chips`,children:a.map(e=>{let t=e.durations.filter(j),n=e.jobs.length,r=e.status||`running`;return(0,k.jsxs)(`li`,{className:`run-chip ${A[e.status]||`acc`}`,title:e.command||void 0,children:[(0,k.jsx)(`svg`,{className:`run-chip-icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:ee[e.status]||(0,k.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`,fill:`currentColor`,stroke:`none`})}),(0,k.jsx)(`span`,{className:`sr-only`,children:r}),(0,k.jsxs)(`span`,{className:`run-chip-main`,children:[(0,k.jsxs)(`span`,{className:`run-chip-head`,children:[(0,k.jsx)(`b`,{children:e.verb}),n>1&&(0,k.jsxs)(`span`,{className:`run-chip-times`,children:[`×`,n]})]}),(0,k.jsx)(`span`,{className:`run-chip-sub`,children:[e.scope,N(e)].filter(Boolean).join(` · `)})]}),t.length?(0,k.jsx)(`span`,{className:`run-chip-bars`,role:`img`,"aria-label":`Durations: ${t.join(`, `)} seconds`,children:t.map((e,t)=>(0,k.jsx)(`i`,{style:{width:`${e/i/o*100}%`}},t))}):(0,k.jsx)(`span`,{className:`run-chip-bars`,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`run-chip-dur`,children:t.length?n>1?`≤ ${Math.max(...t)} s`:`${t[0]} s`:`—`})]},e.id)})})}var F={good:`ok`,warn:`warn`,bad:`bad`};function I({verdict:e}){return e?(0,k.jsxs)(`span`,{className:`badge ${F[e.tone]}`,role:`status`,style:{alignSelf:`flex-start`},children:[(0,k.jsx)(`span`,{className:`dot`}),e.head]}):null}function L({overview:e,dataRev:t}){let{data:n}=S(()=>Promise.resolve().then(()=>i.catalog(`laws`)),[t],`catalog:laws`),r=_(e.diff),a=e.counts||{},s=[{key:`agents`,label:`Agents`,hash:`#/agents`},{key:`skills`,label:`Skills`,hash:`#/skills`},{key:`laws`,label:n?.nouns?.laws||`Dictates`,hash:`#/laws`}];return(0,k.jsxs)(`div`,{className:`card kpiband rise mb-16`,children:[s.map(e=>{let t=a[e.key];return(0,k.jsxs)(`a`,{className:`kseg`,href:e.hash,title:`Open ${e.label}`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(t===0?` zero`:``),children:t==null?`—`:(0,k.jsx)(o,{value:t})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:e.label})]},e.key)}),(0,k.jsx)(`div`,{className:`kseg-spacer`}),(0,k.jsxs)(`button`,{className:`kseg`+(r>0?` hot`:``),onClick:()=>g(`#/diff`),title:`Open changes`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(r===0?` zero`:``),children:(0,k.jsx)(o,{value:r})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:`Local edits`}),r>0&&(0,k.jsx)(`span`,{className:`delta up`,children:`▲`})]})]})}function R({overview:e}){return(0,k.jsx)(`div`,{className:`genome`,children:c.map((t,n)=>{let r=s[t],i=e.counts?.[t];return(0,k.jsxs)(`a`,{className:`card gcell rise`,style:{"--i":n},href:`#/section/`+t,children:[(0,k.jsxs)(`div`,{className:`gtop`,children:[(0,k.jsx)(`span`,{className:`gname`,children:r.label}),(0,k.jsx)(x,{name:r.icon,className:`gicon`})]}),(0,k.jsx)(`div`,{className:`gcount`+(i===0?` zero`:``),children:i==null?`—`:(0,k.jsx)(o,{value:i})}),(0,k.jsx)(`div`,{className:`gdesc`,children:r.desc})]},t)})})}function z({jobs:e}){if(!e||e.length===0)return(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})});let t={done:`ok`,running:`acc`,failed:`bad`},n=f(e,8);return(0,k.jsx)(`div`,{className:`feed`,children:n.map(e=>(0,k.jsxs)(`div`,{className:`feed-row`,children:[(0,k.jsx)(`span`,{className:`feed-dot ${t[e.status]||`ok`}`}),(0,k.jsx)(`span`,{className:`feed-txt`,children:(0,k.jsx)(`b`,{children:e.action})}),(0,k.jsxs)(`span`,{className:`feed-when`,children:[v(e.started),` ago`]})]},e.id))})}function B({value:e}){let t=a(e,1100)??0,n=Math.round(t*100);return(0,k.jsxs)(`div`,{className:`ring-box`,children:[(0,k.jsx)(l,{value:n,max:100,label:`germination`,size:232,stroke:10,sweepMs:0}),(0,k.jsxs)(`div`,{className:`ring-center`,children:[(0,k.jsxs)(`div`,{className:`pct`,children:[n,(0,k.jsx)(`span`,{className:`pct-unit`,children:`%`})]}),(0,k.jsx)(`div`,{className:`lbl`,children:`germination`})]})]})}function V({overview:e,sigil:t,setup:n,jobs:r,lens:i,dataRev:a}){let o=O(e,i?.tone),s=T(e,n,i?.tone);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-lg rise mb-16`,children:(0,k.jsxs)(`div`,{className:`hero`,children:[(0,k.jsx)(B,{value:s}),(0,k.jsxs)(`div`,{className:`hero-facts`,children:[(0,k.jsx)(`div`,{className:`ttl`,children:o}),(0,k.jsx)(I,{verdict:i?.verdict}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`p`,{className:`sub`,children:[`One source rendered into `,(0,k.jsx)(`code`,{children:e.target}),`. Every repo on this machine inherits it.`]}),(0,k.jsxs)(`div`,{className:`hero-chips`,children:[(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`voice`}),(0,k.jsx)(`span`,{className:`cv t-cap`,children:e.theme})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`mode`}),(0,k.jsx)(`span`,{className:`cv`,children:e.emit})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`footprint`}),(0,k.jsx)(`span`,{className:`cv`,children:e.footprint})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`built`}),(0,k.jsx)(`span`,{className:`cv`,children:e.build_time||`unknown`})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`fp`}),(0,k.jsx)(`span`,{className:`cv`,children:n?.installed_fp||`—`})]})]})]})]})}),(0,k.jsx)(L,{overview:e,dataRev:a}),(0,k.jsxs)(`div`,{className:`grid split-status`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Capability genome`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[c.length,` sections`]})})]}),(0,k.jsx)(R,{overview:e})]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Recent activity`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`badge acc`,children:[(0,k.jsx)(`span`,{className:`dot`}),`live`]})})]}),(0,k.jsx)(z,{jobs:r})]})]})]})}function H({k:e,overview:t,max:n}){let r=s[e],i=t.counts?.[e]??0;return(0,k.jsxs)(`div`,{className:`strand`,children:[(0,k.jsxs)(`span`,{className:`strand-name`,children:[(0,k.jsx)(`span`,{className:`strand-dot`}),(0,k.jsx)(`a`,{href:`#/section/`+e,className:`strand-link stretch-link`,children:r.label})]}),(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${i/n*100}%`}})}),(0,k.jsx)(`span`,{className:`strand-val`,children:i})]})}function U(e){return e?e.includes(`up to date`)?{label:`in sync`,tone:`ok`}:e.includes(`no Geneseed install`)?{label:`not installed`,tone:``}:{label:`behind source`,tone:`warn`}:null}function W({overview:e,sigil:t,setup:n,jobs:r,lens:i}){let a=b(e.counts),o=n?.version_verdict||``,s=U(o),l=_(e.diff),u=[[`Source`,`src/, the canonical genetic material`,n?.source_fp||`—`,!0],[`Render`,`geneseed build → ${e.emit}`,e.theme+` voice`,!0],[`Deployed`,e.target,`inherited by every repo`,!1]];return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`mb-16`,children:(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{position:`relative`,overflow:`hidden`},children:[(0,k.jsx)(`h2`,{className:`h`,style:{fontSize:22,margin:`0 0 18px`},children:`Gene-seed lineage`}),(0,k.jsxs)(`div`,{className:`lineage-track`,children:[(0,k.jsx)(`div`,{className:`spine`}),u.map(([e,t,n,r],i)=>(0,k.jsxs)(`div`,{className:`lineage-step`,children:[(0,k.jsx)(`span`,{className:`node ${r?`on`:``}`}),(0,k.jsx)(`div`,{className:`lt`,children:e}),(0,k.jsx)(`div`,{className:`ld`,children:t}),(0,k.jsx)(`div`,{className:`ltag`,children:n})]},i))]}),(0,k.jsx)(`hr`,{className:`hr`}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,style:{marginBottom:14},children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,k.jsx)(I,{verdict:i?.verdict}),s&&(0,k.jsxs)(`span`,{className:`badge ${s.tone}`,title:o,children:[(0,k.jsx)(`span`,{className:`dot`}),s.label]}),(0,k.jsxs)(`span`,{className:`badge`,children:[(0,k.jsx)(`span`,{className:`dot`}),l,` local edits`]})]})]})}),(0,k.jsxs)(`div`,{className:`grid split-even`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Genome strand`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsx)(`span`,{className:`tick`,children:`by volume`})})]}),c.map(t=>(0,k.jsx)(H,{k:t,overview:e,max:a},t))]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Recent activity`})}),(0,k.jsx)(z,{jobs:r})]})]})]})}function G({overview:e,setup:t,jobs:n,lens:r}){let i=c.reduce((t,n)=>t+(e.counts?.[n]??0),0),a=b(e.counts),o=e.doctor?.ok,l=e.doctor?.problems?.length??0,u=_(e.diff);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-md rise mb-16`,children:(0,k.jsx)(`div`,{className:`row wrap between gap-16`,children:(0,k.jsxs)(`div`,{className:`row`,style:{gap:20,flexWrap:`wrap`},children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`status`}),(0,k.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:[(0,k.jsxs)(`span`,{className:`badge ${e.deployed?`ok`:`warn`}`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.deployed?`deployed`:`not deployed`]}),(0,k.jsx)(I,{verdict:r?.verdict})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`voice`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6,textTransform:`capitalize`},children:e.theme})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`mode`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6},children:e.emit})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`fingerprint`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6,color:`var(--accent-text)`},children:t?.installed_fp||`—`})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`doctor`}),(0,k.jsx)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:o?(0,k.jsxs)(`span`,{className:`badge ok`,children:[(0,k.jsx)(`span`,{className:`dot`}),`clean`]}):(0,k.jsxs)(`span`,{className:`badge warn`,children:[(0,k.jsx)(`span`,{className:`dot`}),l,` issue`,l===1?``:`s`]})})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`edits`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6},children:u})]})]})})}),(0,k.jsxs)(`div`,{className:`grid split-operator`,children:[(0,k.jsxs)(`div`,{className:`card rise`,style:{"--i":1},children:[(0,k.jsxs)(`div`,{className:`card-head pad-lg`,style:{padding:`18px 20px 0`,marginBottom:14},children:[(0,k.jsx)(`h3`,{children:`Sections`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[i,` entries total`]})})]}),(0,k.jsxs)(`table`,{className:`tbl`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsxs)(`tr`,{children:[(0,k.jsx)(`th`,{children:`Section`}),(0,k.jsx)(`th`,{children:`Detail`}),(0,k.jsx)(`th`,{style:{width:130},children:`Share`}),(0,k.jsx)(`th`,{className:`num`,children:`Count`})]})}),(0,k.jsx)(`tbody`,{children:c.map(t=>{let n=s[t],r=e.counts?.[t]??0;return(0,k.jsxs)(`tr`,{className:`clickable`,children:[(0,k.jsx)(`td`,{className:`name`,children:(0,k.jsx)(`a`,{href:`#/section/`+t,className:`stretch-link`,children:n.label})}),(0,k.jsx)(`td`,{className:`muted`,children:n.desc}),(0,k.jsx)(`td`,{children:(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${r/a*100}%`}})})}),(0,k.jsx)(`td`,{className:`num`,children:r})]},t)})})]})]}),(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{"--i":2},children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Run log`})}),(0,k.jsx)(P,{jobs:n,max:8,empty:(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})})})]})]})]})}var K=Symbol(`failed`),q=e=>Promise.resolve().then(e).catch(()=>K);function J({dataRev:e,needDoctor:t}){let n=S(()=>q(()=>i.fleet()),[e]),r=S(()=>t?q(()=>i.doctor()):Promise.resolve(null),[t,e]),a=n.data,o=a==null?`loading`:a===K?`failed`:`ok`,s=o===`ok`?a:null,c=s?y(s):null,l=r.data,u=t?l==null?`loading`:l===K?`failed`:`ok`:`idle`;return{fleet:s,fleetState:o,verdict:c,tone:o===`failed`?`failed`:c?.tone,doctor:{state:u,data:u===`ok`?r.data:null}}}var Y=e({default:()=>$}),X=(0,E.lazy)(()=>w(()=>import(`./GreenhouseView-DPwhFO_j.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Z=(0,E.lazy)(()=>w(()=>import(`./OperatorHudView-CLN6Qn25.js`),__vite__mapDeps([8,1,2,4,5,6,3,7]))),Q=(0,E.lazy)(()=>w(()=>import(`./JournalView-DQlDC-7i.js`),__vite__mapDeps([9,1,2,6,3,4,5,7])));function $({overview:e,overviewError:t,onRetry:n,themes:r,setup:a,runs:o,onAction:s,layout:c=`cultivar`,dataRev:l}){let u=c,[f,g]=(0,E.useState)(`status`),_=e&&r.find(t=>t.name===e.theme)?.sigil||``,v=J({dataRev:l,needDoctor:u===`greenhouse`||u===`operator`}),{data:y}=S(()=>u===`journal`?i.recent().catch(()=>null):Promise.resolve(null),[u,l]);if(!e)return t?(0,k.jsx)(d,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,k.jsx)(m,{});let b=e.daemon_stale?(0,k.jsx)(C,{}):null;return e.deployed?f===`status`&&u===`journal`?(0,k.jsxs)(E.Suspense,{fallback:(0,k.jsx)(m,{}),children:[b,(0,k.jsx)(Q,{overview:e,recent:y,lens:v,onDirection:g,dataRev:l})]}):(0,k.jsxs)(k.Fragment,{children:[b,(0,k.jsx)(`div`,{className:`head-row`,children:(0,k.jsx)(h,{"aria-label":`Dashboard view`,children:[[`status`,`Status`],[`lineage`,`Lineage`],[`operator`,`Operator`,`Operator data`]].map(([e,t,n])=>(0,k.jsx)(`button`,{className:f===e?`on`:``,onClick:()=>g(e),"aria-pressed":f===e,"aria-label":n,children:t},e))})}),(0,k.jsxs)(`div`,{className:`view-in`,children:[f===`status`&&u===`cultivar`&&(0,k.jsx)(V,{overview:e,sigil:_,setup:a,jobs:o,lens:v,dataRev:l}),f===`status`&&u===`greenhouse`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(m,{}),children:(0,k.jsx)(X,{overview:e,sigil:_,jobs:o,lens:v,onAction:s})}),f===`status`&&u===`operator`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(m,{}),children:(0,k.jsx)(Z,{overview:e,jobs:o,lens:v})}),f===`lineage`&&(0,k.jsx)(W,{overview:e,sigil:_,setup:a,jobs:o,lens:v}),f===`operator`&&(0,k.jsx)(G,{overview:e,setup:a,jobs:o,lens:v})]},f)]}):(0,k.jsxs)(k.Fragment,{children:[b,(0,k.jsx)(p,{onAction:s})]})}export{$ as default,O as i,I as n,P as r,Y as t};