geneseed 4.30.1 → 4.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/SHIPPED.md +1 -1
- package/adapters/opencode/plugins/geneseed-context.js +136 -1
- package/adapters/opencode/plugins/geneseed-guard.js +145 -2
- package/docs/concepts/exclusions.md +1 -1
- package/docs/concepts/footprint.md +1 -1
- package/docs/concepts/hook-gates.md +1 -1
- package/docs/concepts/hooks.md +6 -4
- package/docs/concepts/host-matrix.md +1 -1
- package/docs/concepts/loop-bricks.md +1 -1
- package/docs/concepts/loop-notes.md +4 -2
- package/docs/concepts/loop-templates.md +7 -4
- package/docs/concepts/loops.md +3 -0
- package/docs/concepts/ownership.md +1 -1
- package/docs/guides/run-a-loop.md +1 -1
- package/docs/guides/set-up-ownership.md +1 -1
- package/docs/reference/loop-actions.md +1 -1
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/plugin-context.md +4 -0
- package/docs/reference/plugin-guard.md +1 -1
- package/docs/understand/enforced-vs-asked.md +3 -2
- package/docs/understand/machine-bob.md +1 -1
- package/docs/web-ui.md +85 -26
- package/harness.config.json +1 -1
- package/js/README.md +3 -3
- package/js/hosts/hooks-context.mjs +22 -1
- package/js/hosts/hooks-done.mjs +97 -31
- package/js/hosts/hooks-prims.mjs +65 -0
- package/js/hosts/hooks.mjs +188 -27
- package/js/loop/state.mjs +15 -5
- package/js/web/actions.mjs +17 -27
- package/js/web/activity.mjs +139 -23
- package/js/web/api.mjs +31 -13
- package/js/web/catalog.mjs +108 -23
- package/js/web/handler.mjs +4 -3
- package/js/web/routes.mjs +47 -14
- package/js/web/server.mjs +14 -13
- package/js/web/state.mjs +36 -15
- package/js/web/usage-api.mjs +7 -3
- package/package.json +1 -1
- package/src/agents/_template.md +3 -0
- package/src/agents/developer.md +5 -2
- package/src/agents/tester.md +4 -1
- package/src/bricks/apply.md +3 -0
- package/src/bricks/test.md +6 -4
- package/src/loops/bugfix.json +11 -5
- package/src/loops/feature.json +7 -4
- package/src/skills/loop.md +1 -0
- package/src/skills/ship.md +9 -1
- package/web/dist/assets/Activity-Bjy64wHC.js +1 -0
- package/web/dist/assets/ActivityDetail-B0AaipP8.js +1 -0
- package/web/dist/assets/{Bonsai-CN4rRAHc.js → Bonsai-CJniRqaH.js} +1 -1
- package/web/dist/assets/{CopyButton-CYljsnLo.js → CopyButton-C5Li6awl.js} +1 -1
- package/web/dist/assets/Dashboard-B-6DTmae.js +2 -0
- package/web/dist/assets/{DataTable-BWbUx4bY.js → DataTable-b9zTShqJ.js} +1 -1
- package/web/dist/assets/{Docs-DE04qOKj.js → Docs-LRc30XL9.js} +2 -2
- package/web/dist/assets/{EmptyState-1sPNleqv.js → EmptyState-CY5Pm2xy.js} +1 -1
- package/web/dist/assets/FilterInput-qGKNSlxv.js +1 -0
- package/web/dist/assets/{GreenhouseView-DPwhFO_j.js → GreenhouseView-CcoYlaWo.js} +1 -1
- package/web/dist/assets/Installs-dp1epTcE.js +3 -0
- package/web/dist/assets/JournalView-nFP4poCf.js +1 -0
- package/web/dist/assets/{KitApply-BN2Az7dc.js → KitApply-DwyZUj57.js} +1 -1
- package/web/dist/assets/{Kits-C9qVd466.js → Kits-C0IEdZXe.js} +1 -1
- package/web/dist/assets/Laws-CkykmQWu.js +3 -0
- package/web/dist/assets/Library-Guh9HBZU.js +2 -0
- package/web/dist/assets/Loops-CzitjxGV.js +2 -0
- package/web/dist/assets/Markdown-C4S4tTA7.js +69 -0
- package/web/dist/assets/{OperatorHudView-CLN6Qn25.js → OperatorHudView-DLGNulIY.js} +1 -1
- package/web/dist/assets/Personal-BMtberL8.js +2 -0
- package/web/dist/assets/RailCats-D5weYPCS.js +1 -0
- package/web/dist/assets/Tabs-uYJqfuQt.js +1 -0
- package/web/dist/assets/api-BxjLd7Qd.js +1 -0
- package/web/dist/assets/index-DA7BiaE5.js +3 -0
- package/web/dist/assets/index-dbbDGFDq.css +1 -0
- package/web/dist/assets/{motion-CXaUMNkg.js → motion-Bccx3zE8.js} +1 -1
- package/web/dist/assets/react-C1iE8mnY.js +9 -0
- package/web/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/web/dist/assets/{usePoll-bDFN-Hr6.js → usePoll-o8ul-Sog.js} +1 -1
- package/web/dist/index.html +6 -6
- package/web/dist/assets/Activity-C8pQvnos.js +0 -1
- package/web/dist/assets/ActivityDetail-D_8Bx-QO.js +0 -1
- package/web/dist/assets/Dashboard-DkUm4XMu.js +0 -2
- package/web/dist/assets/FilterInput-CZREvrjX.js +0 -1
- package/web/dist/assets/Installs-DmPzD4BW.js +0 -3
- package/web/dist/assets/JournalView-DQlDC-7i.js +0 -1
- package/web/dist/assets/Laws-T2wbwMmB.js +0 -3
- package/web/dist/assets/Library-t3KocV0-.js +0 -2
- package/web/dist/assets/Loops-6lNY-9uR.js +0 -2
- package/web/dist/assets/Markdown-DpmmtW2Y.js +0 -65
- package/web/dist/assets/Personal-xjoSqCzr.js +0 -2
- package/web/dist/assets/RailCats-BuJD4Jou.js +0 -1
- package/web/dist/assets/Tabs-DaExAgql.js +0 -1
- package/web/dist/assets/api-LvBC0CnK.js +0 -1
- package/web/dist/assets/index-DhNNxhfg.js +0 -3
- package/web/dist/assets/index-XTGBLKQr.css +0 -1
- package/web/dist/assets/react-DlYQp10C.js +0 -9
- package/web/dist/assets/rolldown-runtime-hePW80VL.js +0 -1
package/js/web/routes.mjs
CHANGED
|
@@ -16,16 +16,18 @@
|
|
|
16
16
|
* Split out of `server.mjs` because it is the half a reader consults to answer "does the console
|
|
17
17
|
* expose X?", which has nothing to do with sockets, daemons or gzip.
|
|
18
18
|
*/
|
|
19
|
+
import { installTargets } from '../hosts/installs.mjs';
|
|
19
20
|
import { formatValue, isTruthy, parseJson } from '../lib/json.mjs';
|
|
20
21
|
import { percentDecode } from '../lib/text.mjs';
|
|
21
|
-
import { apiExcludesMutate, apiInstallToggle, apiLoopsPresetMutate, apiMcp, apiMemoryDelete,
|
|
22
|
+
import { apiExcludesMutate, apiInstallToggle, apiLoopsPresetMutate, apiMcp, apiMemoryDelete, targetView } from './actions.mjs';
|
|
22
23
|
import { apiActivity, apiActivityDetail, apiActivityToggle } from './activity.mjs';
|
|
23
24
|
import {
|
|
24
25
|
apiDiff, apiDoctor, apiExcludes, apiFleet, apiInstalls, apiKits, apiLoops, apiLoopsActive, apiOverview,
|
|
25
|
-
apiRecent, apiSetup, apiThemes, apiUpdate,
|
|
26
|
+
apiRecent, apiSetup, apiThemes, activeInstalls, apiUpdate,
|
|
26
27
|
} from './api.mjs';
|
|
27
|
-
import { NotFound, apiCatalog, apiItem } from './catalog.mjs';
|
|
28
|
+
import { FLEET_SECTIONS, NotFound, apiCatalog, apiItem } from './catalog.mjs';
|
|
28
29
|
import { apiUsage } from './usage-api.mjs';
|
|
30
|
+
import { fleetSort } from './state.mjs';
|
|
29
31
|
import { apiGates } from './gates-api.mjs';
|
|
30
32
|
import { apiProfile, apiProfileSave, apiRules, apiRulesMutate, apiRulesPromote } from './user-files.mjs';
|
|
31
33
|
|
|
@@ -47,7 +49,6 @@ import { apiProfile, apiProfileSave, apiRules, apiRulesMutate, apiRulesPromote }
|
|
|
47
49
|
export const POST_ROUTES = new Map([
|
|
48
50
|
['/api/install', [apiInstallToggle, true]],
|
|
49
51
|
['/api/excludes', [apiExcludesMutate, true]],
|
|
50
|
-
['/api/view', [apiSelectView, true]],
|
|
51
52
|
['/api/activity', [apiActivityToggle, false]],
|
|
52
53
|
// The dispatch wrapper resolves `name` from the body itself; `apiMemoryDelete` takes a bare
|
|
53
54
|
// slug string, not the body object, unlike the other routes here.
|
|
@@ -64,10 +65,10 @@ export const POST_ROUTES = new Map([
|
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
67
|
* The POSTs whose body `{host, path}` names the install they act on (`installView`), opt-in
|
|
67
|
-
* rather than every POST: in `/api/
|
|
68
|
+
* rather than every POST: in `/api/install` and `/api/actions/install` the pair is
|
|
68
69
|
* the target the route resolves itself, and in `/api/actions/deploy`, `/api/excludes` and
|
|
69
70
|
* `/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
|
|
71
|
+
* are the only actions that read the request's install.
|
|
71
72
|
*/
|
|
72
73
|
export const VIEW_POSTS = new Set(['/api/activity', '/api/memory/delete', '/api/rules',
|
|
73
74
|
'/api/rules/promote', '/api/profile', '/api/actions/restore', '/api/actions/build']);
|
|
@@ -77,11 +78,18 @@ export const VIEW_POSTS = new Set(['/api/activity', '/api/memory/delete', '/api/
|
|
|
77
78
|
* pair (it is neither checked nor used) and always read the daemon's state. Ignored rather
|
|
78
79
|
* than refused, so a client may send its install on every read. On the daemon's state, not a
|
|
79
80
|
* 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.
|
|
81
|
-
*
|
|
81
|
+
* (`_behind.inflight`) there, and the update job checks only that one. `/api/activity` merges
|
|
82
|
+
* every active install's sessions; its detail (`/api/activity/<sid>`, a prefix route) and its
|
|
83
|
+
* toggle (a `VIEW_POSTS` write) still take the pair. Every other `/api/*` GET, ping and jobs
|
|
84
|
+
* aside, takes the pair and refuses an unknown one.
|
|
85
|
+
*
|
|
86
|
+
* The Library's fleet lists (`/api/catalog/skills|agents|memory|notebook`) are here because they
|
|
87
|
+
* read every active install (`fleetOf`), which caches one view per install on the daemon state;
|
|
88
|
+
* the other catalog sections, and `/api/item/`, stay install-scoped (`PREFIX_ROUTES`).
|
|
82
89
|
*/
|
|
83
90
|
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'
|
|
91
|
+
'/api/usage', '/api/gates', '/api/excludes', '/api/mcp', '/api/loops/active', '/api/activity',
|
|
92
|
+
'/api/catalog/skills', '/api/catalog/agents', '/api/catalog/memory', '/api/catalog/notebook']);
|
|
85
93
|
|
|
86
94
|
/**
|
|
87
95
|
* The 409 column, exported so a test can assert it directly. Giving `/api/activity` the 409
|
|
@@ -135,20 +143,45 @@ export function readJsonBody(buf) {
|
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
/**
|
|
138
|
-
*
|
|
146
|
+
* Every ACTIVE install as `{install, state}`, the Library's fleet lists' source (skills, agents,
|
|
147
|
+
* memory, notebook: `FLEET_SECTIONS`): `install`
|
|
148
|
+
* is the usage ledger's `host:scope:root` key, `state` the install's cached view off the daemon
|
|
149
|
+
* state `base` (`targetView`), so each install keeps its own inventory cache. ONE
|
|
150
|
+
* `installTargets()` scan: the targets it yields are the allowlist, so no view re-checks its
|
|
151
|
+
* pair the way a request-named one must (`installView`). In the console's install order
|
|
152
|
+
* (`fleetSort`), not as `installTargets` yields, which puts the cwd's projects first. No active
|
|
153
|
+
* install leaves `base` alone, keyless, as one install answered.
|
|
154
|
+
*/
|
|
155
|
+
function fleetOf(base) {
|
|
156
|
+
const views = fleetSort([...activeInstalls(installTargets())], (t) => [t[0], t[1]])
|
|
157
|
+
.map(([host, scope, root]) => ({ install: `${host}:${scope}:${root}`,
|
|
158
|
+
state: targetView(base, [host, scope, root]) }));
|
|
159
|
+
return views.length ? views : [{ install: null, state: base }];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The prefix routes — path in, response out. `base` is the daemon's own state, which `state`
|
|
164
|
+
* is when the request named no install: the fleet's views are cached there, never on a view.
|
|
139
165
|
*
|
|
140
166
|
* `percentDecode` and not `decodeURIComponent`: the JS builtin throws a `URIError` on a `%`
|
|
141
167
|
* that is not an escape, where this shell instead answers a 404 naming the literal text.
|
|
142
168
|
*/
|
|
143
|
-
/** @type {Array<[string, (state: any, path: string) => any]>} */
|
|
169
|
+
/** @type {Array<[string, (state: any, path: string, base: any) => any]>} */
|
|
144
170
|
export const PREFIX_ROUTES = [
|
|
145
|
-
|
|
171
|
+
// The `FLEET_SECTIONS` list every install (`MACHINE_GETS`); the other sections the named one.
|
|
172
|
+
['/api/catalog/', (state, p, base) => {
|
|
173
|
+
const sec = p.split('/').pop();
|
|
174
|
+
return apiCatalog(state, sec, FLEET_SECTIONS.includes(sec) ? fleetOf(base) : undefined);
|
|
175
|
+
}],
|
|
146
176
|
// /api/item/<type>/<name> — TYPE has no slash, the NAME keeps its slashes so a wiki
|
|
147
177
|
// page's relpath survives. A missing name is a 404 here rather than a 500 two frames down.
|
|
148
|
-
|
|
178
|
+
// Install-scoped: a skill, agent, memory or notebook entry is the named install's copy, else
|
|
179
|
+
// the fleet's first.
|
|
180
|
+
['/api/item/', (state, p, base) => {
|
|
149
181
|
const m = /^\/api\/item\/([^/]+)\/(.+)$/.exec(p);
|
|
150
182
|
if (!m) throw new NotFound(p);
|
|
151
|
-
|
|
183
|
+
const fleet = ['skill', 'agent', 'memory', 'notebook'].includes(m[1]) ? fleetOf(base) : undefined;
|
|
184
|
+
return apiItem(state, m[1], percentDecode(m[2]), fleet);
|
|
152
185
|
}],
|
|
153
186
|
// The sid is passed through unquoted — `apiActivityDetail`'s safe-name scheme is what
|
|
154
187
|
// makes the lookup safe, rather than a check out here.
|
package/js/web/server.mjs
CHANGED
|
@@ -22,22 +22,22 @@
|
|
|
22
22
|
* port's NOT_PORTED / DECLINED partition emptied for good and was retired — the declared
|
|
23
23
|
* surface now lives in `js/web/routes.mjs` and `tests/unit/web_server.test.mjs`.
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
25
|
+
import { resolvePath } from '../hosts/hosts.mjs';
|
|
26
26
|
import { isFile, printOut } from '../lib/fs.mjs';
|
|
27
27
|
import { which } from '../lib/paths.mjs';
|
|
28
28
|
import { parseIntStrict } from '../lib/text.mjs';
|
|
29
29
|
import { promptLine } from '../lib/prompt.mjs';
|
|
30
|
-
import {
|
|
30
|
+
import { deployed } from './catalog.mjs';
|
|
31
|
+
import { defaultView, warmDoctor, webState } from './state.mjs';
|
|
31
32
|
import { clearDaemon, codeStamp, openUrl, readDaemon, restartDaemon, startDaemon, statusDaemon, stopDaemon, writeDaemon } from './daemon.mjs';
|
|
32
33
|
import { makeHandler } from './handler.mjs';
|
|
33
34
|
import { JobManager } from './jobs.mjs';
|
|
34
35
|
import { spawnSync } from 'node:child_process';
|
|
35
36
|
import { randomBytes } from 'node:crypto';
|
|
36
|
-
import { existsSync } from 'node:fs';
|
|
37
37
|
import { createServer } from 'node:http';
|
|
38
38
|
import { join, resolve as pathResolve } from 'node:path';
|
|
39
39
|
import { fileURLToPath } from 'node:url';
|
|
40
|
-
import {
|
|
40
|
+
import { sweepInstalls } from './activity.mjs';
|
|
41
41
|
|
|
42
42
|
const ROOT = pathResolve(import.meta.dirname, '..', '..');
|
|
43
43
|
|
|
@@ -133,13 +133,13 @@ export async function serve({ theme = null, port = 4747, openBrowser = true,
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
const state = webState(theme);
|
|
136
|
-
// The daemon record and the job file stay at the
|
|
137
|
-
// moves: `geneseed web stop`/`status` find them through
|
|
138
|
-
// moves, and a
|
|
136
|
+
// The daemon record and the job file stay at the FIRST target, captured before the state
|
|
137
|
+
// moves to the default install: `geneseed web stop`/`status` find them through
|
|
138
|
+
// `webState(theme).target`, which never moves, and a state on a Bob-only ~/.bob would hide it.
|
|
139
139
|
const home = state.target;
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
142
|
-
if (!
|
|
140
|
+
const def = defaultView();
|
|
141
|
+
if (def) state.selectView(...def);
|
|
142
|
+
if (!deployed(state)) {
|
|
143
143
|
printOut(`[web] no deployed harness at ${state.target}.\n`);
|
|
144
144
|
printOut(' Run `geneseed setup` first — serving anyway (read-only UI).\n');
|
|
145
145
|
}
|
|
@@ -154,9 +154,10 @@ export async function serve({ theme = null, port = 4747, openBrowser = true,
|
|
|
154
154
|
// Read by `/api/update`, whose background `git fetch` must not race a running update's pull.
|
|
155
155
|
state.jobBusy = () => jm.busy;
|
|
156
156
|
const srv = createServer(makeHandler(state, jm, token, dist, holder));
|
|
157
|
-
// A GET only reads, and the OpenCode plugin never sweeps: ended sessions are archived here,
|
|
158
|
-
// once at start and every 10 minutes. Best-effort — a sweep failure never
|
|
159
|
-
|
|
157
|
+
// A GET only reads, and the OpenCode plugin never sweeps: ended sessions are archived here, in
|
|
158
|
+
// every active install, once at start and every 10 minutes. Best-effort — a sweep failure never
|
|
159
|
+
// stops the console.
|
|
160
|
+
const sweep = () => { try { sweepInstalls(); } catch { /* best-effort */ } };
|
|
160
161
|
sweep();
|
|
161
162
|
setInterval(sweep, 600_000).unref();
|
|
162
163
|
// A client trickling headers or a body (slowloris) would hold a socket forever otherwise; every
|
package/js/web/state.mjs
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
import { existsSync } from 'node:fs';
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
|
|
11
|
-
import { CLAUDE_STYLE,
|
|
11
|
+
import { CLAUDE_STYLE, HOSTS, opencodeConfigDir, resolvePath } from '../hosts/hosts.mjs';
|
|
12
|
+
import { normcase } from '../lib/paths.mjs';
|
|
12
13
|
import {
|
|
13
14
|
EMIT_HOST_SCOPE, footprintOfDir, installState, installTargets, installedDefaults, modeOfDir,
|
|
14
15
|
postureOfDir, themeOfDir, trustOfDir,
|
|
@@ -30,22 +31,42 @@ export function viewCfg(host, scope, root) {
|
|
|
30
31
|
return root;
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
/** Two paths name the same folder: resolved, and case-folded where the filesystem folds case. */
|
|
35
|
+
export const samePath = (a, b) => normcase(resolvePath(a)) === normcase(resolvePath(b));
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The console's ONE install order, for every fleet-wide answer (the Library's lists, the Activity
|
|
39
|
+
* garden): host order (`HOSTS`), then global before project, then the input's own order — the
|
|
40
|
+
* sort is stable. `of(item)` gives `[host, scope]`. Sorts `list` in place and returns it. Here
|
|
41
|
+
* beside `viewCfg`, the other per-install rule both callers use, because `activity.mjs` and
|
|
42
|
+
* `routes.mjs` both import this module and it imports neither.
|
|
43
|
+
*/
|
|
44
|
+
export function fleetSort(list, of) {
|
|
45
|
+
const rank = (it) => {
|
|
46
|
+
const [host, scope] = of(it);
|
|
47
|
+
return HOSTS.findIndex((h) => h.host === host) * 2 + (scope === 'global' ? 0 : 1);
|
|
48
|
+
};
|
|
49
|
+
return list.sort((a, b) => rank(a) - rank(b));
|
|
50
|
+
}
|
|
51
|
+
|
|
33
52
|
/**
|
|
34
|
-
* `[target, root]`
|
|
35
|
-
* when
|
|
53
|
+
* `[target, root]` of THE DEFAULT INSTALL — the one a request that names no install reads — or
|
|
54
|
+
* null when no install is active.
|
|
36
55
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
56
|
+
* It is the first ACTIVE install in the console's one install order (`fleetSort`): host order
|
|
57
|
+
* (opencode, claude, bob, openclaude), then global before project, then the order
|
|
58
|
+
* `installTargets` found them.
|
|
59
|
+
* There is no viewed install to pick any more (the topbar selector and `POST /api/view` are
|
|
60
|
+
* gone): a page that wants another install names it on the request. The console once opened
|
|
61
|
+
* on the OpenCode global dir unconditionally, and on a Bob-only machine (reported 2026-10) it
|
|
62
|
+
* showed the onboarding form over a working `~/.bob`; this order cannot. The console's own
|
|
63
|
+
* pickers take their default from the row `/api/installs` marks `default`, which is this one.
|
|
42
64
|
*/
|
|
43
|
-
export function
|
|
44
|
-
if (existsSync(path.join(current, GLOBAL_MANIFEST))) return null;
|
|
65
|
+
export function defaultView(targets = installTargets()) {
|
|
45
66
|
const active = targets.filter(([host, scope, root]) => {
|
|
46
67
|
try { return installState(root, host, scope) === 'active'; } catch { return false; }
|
|
47
68
|
});
|
|
48
|
-
const pick = active
|
|
69
|
+
const pick = fleetSort(active, ([host, scope]) => [host, scope])[0];
|
|
49
70
|
return pick ? [viewCfg(...pick), pick[2]] : null;
|
|
50
71
|
}
|
|
51
72
|
|
|
@@ -195,12 +216,12 @@ export function webState(theme = null, target = null) {
|
|
|
195
216
|
};
|
|
196
217
|
/** This state alone. `refresh` below is what callers use: it also reaches every view. */
|
|
197
218
|
st.refreshOwn = ({ doctor = true } = {}) => {
|
|
198
|
-
// A job may have deployed the first install
|
|
199
|
-
//
|
|
219
|
+
// A job may have deployed the first install, or switched off or removed the default, so
|
|
220
|
+
// the daemon's own state moves to whatever the default install is now (`defaultView`).
|
|
200
221
|
// Only on a full refresh: `{ doctor: false }` marks a mutation that cannot change installs.
|
|
201
222
|
// Never for a pinned view: it answers for the install its request named, or is refused.
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
223
|
+
const def = doctor && !st.pinned ? defaultView() : null;
|
|
224
|
+
if (def && !samePath(def[0], st.target)) { st.selectView(...def); return; }
|
|
204
225
|
st._inv = null;
|
|
205
226
|
if (doctor) st._doctor = null;
|
|
206
227
|
st.emit = st.detectEmit() || st.emit;
|
package/js/web/usage-api.mjs
CHANGED
|
@@ -28,6 +28,7 @@ import path from 'node:path';
|
|
|
28
28
|
import { USAGE_LEDGER, USAGE_OFF } from '../hosts/usage.mjs';
|
|
29
29
|
import { installTargets } from '../hosts/installs.mjs';
|
|
30
30
|
import { activeInstalls, lastDays } from './api.mjs';
|
|
31
|
+
import { deployedLayer } from './catalog.mjs';
|
|
31
32
|
|
|
32
33
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
33
34
|
const WINDOW = 30;
|
|
@@ -88,12 +89,15 @@ export function usageSummary({ now = Date.now(), targets = installTargets() } =
|
|
|
88
89
|
counts.set(key, (counts.get(key) || 0) + 1);
|
|
89
90
|
fired.add(`${e.kind}\u0000${e.name}`);
|
|
90
91
|
}
|
|
91
|
-
for
|
|
92
|
-
|
|
92
|
+
// The specs the host loads: for an OpenCode project install that is `<repo>/.opencode`, not
|
|
93
|
+
// the root's flat bundle (the ledger above stays in the root's notebook/).
|
|
94
|
+
const layer = deployedLayer({ target: dir }) ?? dir;
|
|
95
|
+
for (const name of listOr(path.join(layer, 'skills'))) {
|
|
96
|
+
if (existsSync(path.join(layer, 'skills', name, 'SKILL.md')) && !fired.has(`skill\u0000${name}`)) {
|
|
93
97
|
never.push({ install, kind: 'skill', name });
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
|
-
for (const f of listOr(path.join(
|
|
100
|
+
for (const f of listOr(path.join(layer, 'agents'))) {
|
|
97
101
|
const name = f.endsWith('.md') ? f.slice(0, -3) : null;
|
|
98
102
|
if (name && !fired.has(`agent\u0000${name}`)) never.push({ install, kind: 'agent', name });
|
|
99
103
|
}
|
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.
|
|
4
|
+
"version": "4.32.0",
|
|
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",
|
package/src/agents/_template.md
CHANGED
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
1. Step-by-step method this {{AGENT}} follows.
|
|
48
48
|
|
|
49
49
|
## Output contract
|
|
50
|
+
- The report starts with one line, `STATUS: OK|BLOCKED|OUT_OF_SCOPE|ERROR`:
|
|
51
|
+
`OK` the contract is met; `BLOCKED` an input or a decision is missing;
|
|
52
|
+
`OUT_OF_SCOPE` this {{AGENT}} does not own the task; `ERROR` a step failed.
|
|
50
53
|
- The exact shape of what this {{AGENT}} returns to the caller (e.g. a list of
|
|
51
54
|
findings with file:line, a verdict, a summary of changes made).
|
|
52
55
|
- Include an honest-failure line: what this {{AGENT}} returns when the contract
|
package/src/agents/developer.md
CHANGED
|
@@ -42,12 +42,15 @@
|
|
|
42
42
|
actually close — report the blocker instead ({{ONTOLOGY}}: {{ONT_EVIDENCE}}).
|
|
43
43
|
|
|
44
44
|
## Output contract
|
|
45
|
+
- The report starts with one line, `STATUS: OK|BLOCKED|OUT_OF_SCOPE|ERROR`: `OK` the contract is met;
|
|
46
|
+
`BLOCKED` an input or a decision is missing; `OUT_OF_SCOPE` not this task; `ERROR` a step failed,
|
|
47
|
+
red tests included.
|
|
45
48
|
- The files changed in the worktree and a one-line summary of what changed and
|
|
46
49
|
why, ready for the tester's pass.
|
|
47
50
|
- If the scoped task cannot be implemented as given (missing input, contradictory
|
|
48
|
-
acceptance criteria), report that blocker instead of guessing.
|
|
51
|
+
acceptance criteria), report that blocker instead of guessing (`STATUS: BLOCKED`).
|
|
49
52
|
- In ownership mode: the diff, for the developer's final review — or
|
|
50
|
-
`blocked: decision needed` with the options
|
|
53
|
+
`blocked: decision needed` with the options, on the line after `STATUS: BLOCKED`.
|
|
51
54
|
|
|
52
55
|
## Pipeline role
|
|
53
56
|
|
package/src/agents/tester.md
CHANGED
|
@@ -30,10 +30,13 @@
|
|
|
30
30
|
is not proof.
|
|
31
31
|
|
|
32
32
|
## Output contract
|
|
33
|
+
- The report starts with one line, `STATUS: OK|BLOCKED|OUT_OF_SCOPE|ERROR`: `OK` the contract is met;
|
|
34
|
+
`BLOCKED` an input or a decision is missing; `OUT_OF_SCOPE` not this task; `ERROR` a step failed,
|
|
35
|
+
red tests included.
|
|
33
36
|
- The test files written/changed, the command to run them, and the actual run
|
|
34
37
|
output (pass/fail counts). For diagnosis: root cause + recommended fix location.
|
|
35
38
|
- If the suite cannot be run or the expected behaviour is unspecified, report
|
|
36
|
-
that blocker instead of delivering tests that were never seen to fail.
|
|
39
|
+
that blocker (`STATUS: BLOCKED`) instead of delivering tests that were never seen to fail.
|
|
37
40
|
|
|
38
41
|
## Pipeline role
|
|
39
42
|
|
package/src/bricks/apply.md
CHANGED
|
@@ -12,6 +12,9 @@ replaced.
|
|
|
12
12
|
When this is a repair after `test`, act on the latest `test` note only — it is the verdict on
|
|
13
13
|
the code as it stands. Fix every finding it lists in this one pass: repairs are capped at two.
|
|
14
14
|
|
|
15
|
+
When this is a repair after `mutation-check`, act on its latest note: add each assertion that
|
|
16
|
+
kills a survivor to a test in the `writeSet`. Production code stays as it is.
|
|
17
|
+
|
|
15
18
|
Make no unrelated edits: no drive-by rename, no incidental cleanup, no touching a file the card
|
|
16
19
|
did not declare. If the change genuinely needs a file outside the write set, stop and report that
|
|
17
20
|
rather than widening scope unasked — the diff is scored against the declared set, not your
|
package/src/bricks/test.md
CHANGED
|
@@ -14,10 +14,12 @@ brick only observes; a fix belongs in `apply`, not here.
|
|
|
14
14
|
failure: they check independent properties, and each repair must see every finding at once.
|
|
15
15
|
3. **Full suite** — only when everything above passed; otherwise `SKIPPED (an earlier check failed)`.
|
|
16
16
|
|
|
17
|
-
List every check
|
|
18
|
-
never left out, and silence is never a pass.
|
|
19
|
-
purpose, the property it guards, a one-line
|
|
20
|
-
reruns it alone. Keep full logs in a file
|
|
17
|
+
List every check on its own line as `<check>: <status>`, the status one of `PASS`, `FAIL`, `ERROR`
|
|
18
|
+
or `SKIPPED (reason)` — one that did not run is never left out, and silence is never a pass.
|
|
19
|
+
Write each failure as four lines: the check's purpose, the property it guards, a one-line
|
|
20
|
+
diagnostic (not the raw log), and the command that reruns it alone. Keep full logs in a file.
|
|
21
|
+
Write the list to a file in the OS temp directory (never inside the worktree) and report that
|
|
22
|
+
file's path with every outcome, `pass` included: the engine reads the list from it.
|
|
21
23
|
|
|
22
24
|
Report `pass` only if every check passed. Report `error` if a check crashed or could not be run —
|
|
23
25
|
no test runner, a missing tool, evidence never wired: that is a stop for a human, not a repair.
|
package/src/loops/bugfix.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugfix",
|
|
3
|
-
"description": "Reproduce the bug with a failing test, then iterate: apply the fix, test, and review, until the requirement is met and the reproduction passes.",
|
|
3
|
+
"description": "Reproduce the bug with a failing test, then iterate: apply the fix, test, prove the tests bite by mutation, and review, until the requirement is met and the reproduction passes.",
|
|
4
4
|
"category": "development",
|
|
5
|
-
"
|
|
5
|
+
"rules": [
|
|
6
|
+
"Each card's writeSet names the reproduction test, so a mutation-check repair can strengthen it."
|
|
7
|
+
],
|
|
8
|
+
"nodes": ["reproduce", "identify", "apply", "test", "mutation-check", "review"],
|
|
6
9
|
"start": "reproduce",
|
|
7
10
|
"edges": [
|
|
8
11
|
{ "from": "reproduce", "on": "pass", "to": "identify" },
|
|
@@ -11,13 +14,16 @@
|
|
|
11
14
|
{ "from": "identify", "on": "done", "to": "$close" },
|
|
12
15
|
{ "from": "apply", "on": "pass", "to": "test" },
|
|
13
16
|
{ "from": "test", "on": "fail", "to": "apply" },
|
|
14
|
-
{ "from": "test", "on": "pass", "to": "
|
|
17
|
+
{ "from": "test", "on": "pass", "to": "mutation-check" },
|
|
18
|
+
{ "from": "mutation-check", "on": "pass", "to": "review" },
|
|
19
|
+
{ "from": "mutation-check", "on": "fail", "to": "apply" },
|
|
20
|
+
{ "from": "mutation-check", "on": "unavailable", "to": "review" },
|
|
15
21
|
{ "from": "review", "on": "pass", "to": "identify" },
|
|
16
22
|
{ "from": "review", "on": "fail", "to": "apply" }
|
|
17
23
|
],
|
|
18
24
|
"loops": [
|
|
19
|
-
{ "name": "iterations", "nodes": ["identify", "apply", "test", "review"], "max": 20, "iteration": true },
|
|
25
|
+
{ "name": "iterations", "nodes": ["identify", "apply", "test", "mutation-check", "review"], "max": 20, "iteration": true },
|
|
20
26
|
{ "name": "apply-test", "nodes": ["apply", "test"], "max": 2 },
|
|
21
|
-
{ "name": "review-fix", "nodes": ["apply", "test", "review"], "max": 3 }
|
|
27
|
+
{ "name": "review-fix", "nodes": ["apply", "test", "mutation-check", "review"], "max": 3 }
|
|
22
28
|
]
|
|
23
29
|
}
|
package/src/loops/feature.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feature",
|
|
3
|
-
"description": "Plan the feature into ordered iterations, then build each one: apply, test, and review, until the plan is complete — and an independent done-check maps every requirement to a passing test before the loop closes.",
|
|
3
|
+
"description": "Plan the feature into ordered iterations, then build each one test-first: a failing test, apply, test, and review, until the plan is complete — and an independent done-check maps every requirement to a passing test before the loop closes.",
|
|
4
4
|
"category": "development",
|
|
5
|
-
"nodes": ["plan", "identify", "apply", "test", "review", "done-check"],
|
|
5
|
+
"nodes": ["plan", "identify", "red-test", "apply", "test", "review", "done-check"],
|
|
6
6
|
"start": "plan",
|
|
7
7
|
"edges": [
|
|
8
8
|
{ "from": "plan", "on": "pass", "to": "identify" },
|
|
9
|
-
{ "from": "identify", "on": "more", "to": "
|
|
9
|
+
{ "from": "identify", "on": "more", "to": "red-test" },
|
|
10
10
|
{ "from": "identify", "on": "done", "to": "done-check" },
|
|
11
|
+
{ "from": "red-test", "on": "red", "to": "apply" },
|
|
12
|
+
{ "from": "red-test", "on": "green", "to": "test" },
|
|
13
|
+
{ "from": "red-test", "on": "untestable", "to": "$stop" },
|
|
11
14
|
{ "from": "apply", "on": "pass", "to": "test" },
|
|
12
15
|
{ "from": "test", "on": "pass", "to": "review" },
|
|
13
16
|
{ "from": "test", "on": "fail", "to": "apply" },
|
|
@@ -17,7 +20,7 @@
|
|
|
17
20
|
{ "from": "done-check", "on": "fail", "to": "identify" }
|
|
18
21
|
],
|
|
19
22
|
"loops": [
|
|
20
|
-
{ "name": "iterations", "nodes": ["identify", "apply", "test", "review", "done-check"], "max": 20, "iteration": true },
|
|
23
|
+
{ "name": "iterations", "nodes": ["identify", "red-test", "apply", "test", "review", "done-check"], "max": 20, "iteration": true },
|
|
21
24
|
{ "name": "apply-test", "nodes": ["apply", "test"], "max": 2 },
|
|
22
25
|
{ "name": "review-fix", "nodes": ["apply", "test", "review"], "max": 3 }
|
|
23
26
|
]
|
package/src/skills/loop.md
CHANGED
|
@@ -87,6 +87,7 @@ What `score --diff`, `decide` and `record` print back:
|
|
|
87
87
|
brick, `score --diff` before `record`). Do the step, never edit the state block to get past it.
|
|
88
88
|
An `{error}` from `record` that mentions JSON means the shell mangled the card's quotes: retry
|
|
89
89
|
with the card on a single line and no single quotes inside it.
|
|
90
|
+
A `test` `pass` with a `SKIPPED` entry is refused: run the check, or report `fail` or `error`.
|
|
90
91
|
|
|
91
92
|
## The end
|
|
92
93
|
|
package/src/skills/ship.md
CHANGED
|
@@ -36,7 +36,13 @@ request or merge the branch.
|
|
|
36
36
|
it is wrong — consumers, layout, data), and any follow-up. Link the
|
|
37
37
|
issue it closes; keep the title an imperative one-line summary.
|
|
38
38
|
6. If the project merges locally instead, merge into the base branch only after
|
|
39
|
-
review/approval
|
|
39
|
+
review/approval.
|
|
40
|
+
7. Once the branch is merged — locally or through the PR — delete it, local and remote
|
|
41
|
+
(`git branch -d <branch>`, `git push origin --delete <branch>`), with consent: it is a
|
|
42
|
+
deletion ({{LAW:deletion-is-deliberate}}). A PR usually merges after your turn ends,
|
|
43
|
+
with nobody left to delete its branch, so the first time you ship in a repo, check
|
|
44
|
+
whether the forge deletes merged branches by itself (GitHub: *Automatically delete
|
|
45
|
+
head branches*) and recommend turning it on if not.
|
|
40
46
|
If shipping triggers a production deploy, confirm a tested rollback or
|
|
41
47
|
fix-forward path and a retained previous artifact *before* deploying — there must
|
|
42
48
|
be a way back ({{LAW:deletion-is-deliberate}}); dispatch the
|
|
@@ -46,5 +52,7 @@ request or merge the branch.
|
|
|
46
52
|
## Done when
|
|
47
53
|
- The diff passed review with no `blocking` finding, and the PR is open (or the branch is merged) with a Summary / Evidence / Merge danger
|
|
48
54
|
body, and nothing unrelated rides along.
|
|
55
|
+
- A branch merged while you are still working is deleted, local and remote, or the user
|
|
56
|
+
declined.
|
|
49
57
|
|
|
50
58
|
<!-- INCLUDE: skills/_self-improvement.md -->
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-BxjLd7Qd.js";import{a as i}from"./motion-Bccx3zE8.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,Q as m,T as h,W as ee,Y as te,bt as g,ct as _,j as v,k as ne,rt as y,u as re,w as b}from"./index-DA7BiaE5.js";import{t as x}from"./EmptyState-CY5Pm2xy.js";import{a as S,c as C,d as w,f as T,g as E,h as D,i as O,m as k,n as A,o as j,p as M,r as N,s as P,t as F,u as I}from"./Bonsai-CJniRqaH.js";import{t as ie}from"./usePoll-o8ul-Sog.js";var L=e(t(),1),R=n(),z=4,B=56*z,V=24,H=165,U=188,W=e=>{let t=P(e);return t==null?null:Math.round(t*100)};function G(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=W(e);return[`${e.title||s(e.cwd)||e.session_id}, ${e.chip||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 K({s:e,t,mine:n}){let r=W(e);return(0,R.jsxs)(`div`,{className:`card gd-card`,children:[(0,R.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`model`}),(0,R.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,R.jsx)(`dt`,{children:`turns`}),(0,R.jsx)(`dd`,{children:e.turns||0}),(0,R.jsx)(`dt`,{children:`context`}),(0,R.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,R.jsx)(`dt`,{children:`compactions`}),(0,R.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,R.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,R.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 q({s:e,worktree:t,sakura:n,mine:r,pad:i,onHover:a}){let c=E(e,n),l=(0,L.useMemo)(()=>I(e,{sakura:n}),[c]),u=o[e.status]||o.idle,d=Array.isArray(e.loops)?e.loops[0]:null,f=e.status!==`idle`,p=S(e),m=(0,L.useCallback)(e=>a(p,e),[a,p]);return(0,R.jsxs)(`a`,{className:`gd-tree${v(e)?` gd-needs`:``}`,href:e.href||C(e.session_id),"aria-label":G(e,l,r),"data-sid":e.session_id,onMouseEnter:e=>a(p,null,Y(e.currentTarget)),onMouseLeave:()=>a(null,null),onFocus:e=>a(p,null,Y(e.currentTarget)),onBlur:()=>a(null,null),children:[(0,R.jsxs)(`div`,{className:`gd-label`,children:[(0,R.jsxs)(`div`,{className:`act-ell`,children:[(0,R.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip||e.host||`?`}),` `,e.title||s(e.cwd)||e.session_id]}),(0,R.jsxs)(`div`,{className:`row gap-8 gd-sub`,children:[(0,R.jsx)(`span`,{className:`badge ${u.cls}`,children:u.label}),t&&(0,R.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),d&&(0,R.jsxs)(`span`,{className:`badge`,children:[`↻ `,d.title,d.iteration==null?``:` ${d.iteration}`]}),e.attribution===!1&&(0,R.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`}),e.phase&&(0,R.jsx)(`span`,{className:`dim act-ell`,children:e.phase})]})]}),(0,R.jsx)(N,{t:l,pad:i,swaying:f,onPad:m,px:z})]})}function J({pairs:e,count:t}){if(!e.length)return null;let n=t*B+(t-1)*V,r=e=>e*(B+V)+B/2;return(0,R.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*z+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,R.jsxs)(`g`,{className:o,children:[(0,R.jsx)(`path`,{d:`M${e} ${H} C${n} 179 ${n} 159 ${t} 169`}),(0,R.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${H}`})]},`${i}-${a}`)}return(0,R.jsx)(`g`,{className:o,children:(0,R.jsx)(`path`,{d:`M${r(i)} ${U} Q${(r(i)+r(a))/2} 222 ${r(a)} ${U}`})},`${i}-${a}`)})})}var Y=e=>e.offsetLeft-(e.parentElement?.scrollLeft||0);function ae({sessions:e,collisions:t}){let[n,r]=(0,L.useState)(O),[i,a]=(0,L.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(A,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=j(w(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>k(e,s);return(0,R.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,R.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,R.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,R.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Sakura`})]}),l.length>0&&(0,R.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,R.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,R.jsx)(X,{sh:e,sakura:n,cols:s,mineOf:u},e.key))]})}function X({sh:e,sakura:t,cols:n,mineOf:r}){let[i,a]=(0,L.useState)({sid:null,pad:null,x:0}),o=(0,L.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=e.trees.find(e=>S(e.s)===i.sid)?.s,c=s?I(s,{sakura:t}):null,l=c&&i.pad!=null?c.pads[i.pad]:null;return(0,R.jsxs)(`section`,{className:`gd-shelf`,"aria-label":`${e.name} shelf`,children:[(0,R.jsxs)(`h3`,{className:`act-lbl gd-shelf-h`,children:[e.name,` `,(0,R.jsxs)(`span`,{className:`dim`,children:[`· `,e.trees.length]})]}),(0,R.jsxs)(`div`,{className:`gd-row`,children:[e.trees.map(({s:e,worktree:n})=>(0,R.jsx)(q,{s:e,worktree:n,sakura:t,mine:r(S(e)),pad:S(e)===i.sid?i.pad:null,onHover:o},S(e))),(0,R.jsx)(J,{pairs:D(e.trees,n),count:e.trees.length})]}),s&&(0,R.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:l?(0,R.jsx)(F,{pad:l}):(0,R.jsx)(K,{s,t:c,mine:r(S(s))})})]})}var Z=e=>e.catch(()=>null);function Q({s:e}){let t=(0,L.useId)(),n=e.todos,r=a(e);return(0,R.jsxs)(`a`,{className:`card pad-md act-card`,href:e.href||C(e.session_id),"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,R.jsxs)(b,{s:e,id:t,heading:e.title||s(e.cwd)||e.session_id,children:[e.chip&&(0,R.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip}),(0,R.jsx)(y,{name:`chevron`,className:`glyph act-chev`})]}),n&&n.total>0&&(0,R.jsx)(`div`,{className:`act-foot`,children:(0,R.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,R.jsx)(c,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,R.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,_(e.updated_at),` ago`]})]})}var $={blocked:`is blocked`,"waiting-input":`waits for your answer`};function oe(e,t){if(!Array.isArray(t))return``;let n=t.filter(v),r=e.current;return e.current=new Set(n.map(e=>`${S(e)}:${e.status}`)),r?n.filter(e=>!r.has(`${S(e)}:${e.status}`)).map(e=>`${e.title||s(e.cwd)||e.session_id} ${$[e.status]}`).join(`. `):``}var se=[[`all`,`All`],[`needs`,`Needs you`],[`runs`,`Runs`],[`gates`,`Gate asks`]];function ce(){let e=new URLSearchParams(window.location.hash.split(`?`)[1]||``),t=e.get(`f`);return{f:se.some(([e])=>e===t)?t:`all`,host:e.get(`host`)||``,project:e.get(`project`)||``,v:e.get(`v`)===`list`?`list`:`garden`}}function le(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 ue({enabled:e,installs:t,onToggle:n}){let r=T(t);return(0,R.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,R.jsx)(y,{name:`activity`,className:`glyph act-fixed`}),(0,R.jsxs)(`div`,{className:`act-grow`,children:[(0,R.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,R.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,R.jsxs)(`ul`,{className:`stack gap-8 act-fixed act-sm`,"aria-label":`Tracking per install`,children:[t.length===0&&(0,R.jsx)(`li`,{className:`dim`,children:`No active install to track.`}),t.map((e,t)=>(0,R.jsxs)(`li`,{className:`row gap-10`,children:[(0,R.jsxs)(`span`,{id:`act-track-l${t}`,title:e.path,children:[`Track live sessions in `,(0,R.jsx)(`span`,{className:`mono`,children:r.get(e.install)})]}),(0,R.jsx)(`div`,{className:`sw-toggle${e.enabled?` on`:``}`,role:`switch`,"aria-checked":e.enabled,"aria-labelledby":`act-track-l${t}`,tabIndex:0,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.key===` `&&t.preventDefault(),n(e))}})]},e.install))]})]})}function de({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,R.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,R.jsxs)(`div`,{className:`act-stat-head`,children:[(0,R.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,R.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,R.jsx)(`p`,{className:`dim act-sm`,children:`Reading the job log…`}):e?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":l,ref:i,children:r.map(e=>e.nodata?(0,R.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,R.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${f(e.key)}: ${e.n}`},e.key):(0,R.jsx)(`i`,{className:`zero`},e.key))}),(0,R.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,R.jsx)(`span`,{children:f(r[0].key)}),(0,R.jsx)(`span`,{children:f(r[7].key)}),(0,R.jsx)(`span`,{children:`today`})]}),c&&(0,R.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,R.jsx)(`p`,{className:`dim act-sm`,children:`The job log could not be read.`})]})}function fe({rows:e,gates:t,loading:n}){let r=e.reduce((e,t)=>e+t.n,0);return(0,R.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,R.jsxs)(`div`,{className:`act-stat-head`,children:[(0,R.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,R.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,R.jsx)(`p`,{className:`dim act-sm`,children:`Reading the gate ledger…`}):e.length?(0,R.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,R.jsxs)(`li`,{children:[(0,R.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,R.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,R.jsx)(h,{vals:e.per_day,i:t,sweep:!0}),(0,R.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,R.jsx)(`p`,{className:`dim act-sm`,children:t?`No gate asked in 30 days.`:`The gate ledger could not be read.`})]})}var pe={done:[`ok`,`done`],failed:[`bad`,`failed`],running:[``,`running`]};function me({job:e,longest:t}){let n=l(e),r=e.duration?Math.round(e.duration*10)/10:0,[i,a]=pe[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,R.jsxs)(`li`,{className:`act-row`,children:[(0,R.jsx)(`span`,{className:`mono dim act-xs`,children:s}),(0,R.jsx)(y,{name:`play`,className:`glyph act-glyph`}),(0,R.jsxs)(`span`,{className:`act-what`,children:[(0,R.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,R.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,R.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":o,children:(0,R.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,R.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function he({gate:e}){return(0,R.jsxs)(`li`,{className:`act-row gate`,children:[(0,R.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,R.jsx)(y,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,R.jsxs)(`span`,{className:`act-what`,children:[(0,R.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,R.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,R.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`badge warn`,children:`asked`})]})}var ge=5,_e=(e,t)=>[...new Set([...e.filter(Boolean),t].filter(Boolean))];function ve(){let[e,t]=(0,L.useState)(null),[n,a]=(0,L.useState)(``),[o,c]=(0,L.useState)(ce),[l,d]=(0,L.useState)(!1),[f,h]=(0,L.useState)(``),_=(0,L.useRef)(null),y=e=>{let t={...o,...e};c(t),le(t)};ie(e=>r.activity().then(n=>{if(e()){t(n),a(``);let e=oe(_,n?.activity);e&&h(t=>t===e?e+`\xA0`:e)}},t=>{e()&&a(t.message)}),2e3,[]);let b=g(()=>Z(r.jobs()),[]),C=g(()=>Z(r.gates()),[]),w=g(()=>Z(r.catalog(`laws`)),[]),T=!e||e.enabled!==!1,E=Array.isArray(e?.installs)?e.installs:[],D=M(e?.activity,E).sort((e,t)=>e.session_id<t.session_id?-1:+(e.session_id>t.session_id)),O=i(),k=T&&e?D.filter(v).length:null,A=new Set(D.map(S)),j=M(e?.ended,E).filter(e=>!A.has(S(e))),N=_e([...D,...j].map(e=>e.host),o.host),P=_e([...D,...j].map(e=>s(e.cwd)),o.project),F=o.host&&o.project?`host or project`:o.host?`host`:o.project?`project`:``,I=e=>(!o.host||e.host===o.host)&&(!o.project||s(e.cwd)===o.project),z=D.filter(e=>I(e)&&(o.f!==`needs`||v(e))),B=o.f===`all`||o.f===`needs`,V=o.f===`all`&&T?j.filter(I):[],H=l?V:V.slice(0,ge),U=!F&&(o.f===`all`||o.f===`runs`),W=!F&&(o.f===`all`||o.f===`gates`),G=b.data?.jobs||[],K=re(C.data,w.data),q=ne(G,K,C.data?.days).map(e=>({...e,runs:U?e.runs:[],gate:W?e.gate:null})).filter(e=>e.runs.length||e.gate),J=Math.max(0,...G.map(e=>e.duration||0)),Y=p(q.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),X=async e=>{let n=!e.enabled;try{let i=await r.activityToggle(n,{host:e.host,path:e.path});if(i.ok===!1){a(i.error||`Could not change tracking`);return}let o=t=>i.enabled?t||[]:(t||[]).flatMap(t=>{let n=(t.installs||[t.install]).filter(t=>t!==e.install);return n.length?[{...t,install:n[0],installs:n}]:[]});t(t=>{let n=(t?.installs||[]).map(t=>t.install===e.install?{...t,enabled:i.enabled}:t);return{...t||{},installs:n,enabled:n.length===0||n.some(e=>e.enabled),activity:o(t?.activity),ended:o(t?.ended)}}),a(``)}catch(e){a(e.message)}},$=(e,t,n)=>(0,R.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,R.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,R.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=>y({[e]:t.target.value}),children:[(0,R.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]});return(0,R.jsxs)(`div`,{className:`page-fill`,children:[(0,R.jsx)(ee,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,R.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:f}),n&&(0,R.jsx)(`div`,{className:`act-gap`,children:(0,R.jsx)(u,{error:n})}),e&&(0,R.jsx)(ue,{enabled:T,installs:E,onToggle:X}),(0,R.jsxs)(`div`,{className:`act-today`,children:[(0,R.jsx)(de,{jobs:b.data,loading:b.loading}),(0,R.jsx)(fe,{rows:K,gates:C.data,loading:C.loading}),(0,R.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,R.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),(0,R.jsxs)(`span`,{className:`act-big act-wait`,children:[k??`—`,` `,(0,R.jsx)(`span`,{className:`dim act-sm`,children:`sessions`})]}),(0,R.jsx)(`p`,{className:`dim act-sm`,children:T?`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,R.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,R.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:se.map(([e,t])=>(0,R.jsxs)(`button`,{type:`button`,className:o.f===e?`chip-f on`:`chip-f`,"aria-pressed":o.f===e,onClick:()=>y({f:e}),children:[t,e===`needs`&&k>0?(0,R.jsxs)(`span`,{className:`mono`,children:[` `,k]}):null]},e))}),$(`host`,`Host`,N),$(`project`,`Project`,P),(0,R.jsx)(m,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,R.jsx)(`button`,{type:`button`,className:o.v===e?`on`:``,"aria-pressed":o.v===e,onClick:()=>y({v:e}),children:t},e))})]}),F&&o.f!==`needs`&&(0,R.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,F,`; showing sessions only.`]}),B&&(e?!T&&o.f!==`needs`?null:z.length===0?o.f===`needs`?(0,R.jsx)(x,{title:`Nothing waits on you`}):(0,R.jsxs)(x,{title:`No active sessions`,children:[`Run `,(0,R.jsx)(`code`,{children:`opencode`}),` and the sessions it spins up appear here.`]}):o.v===`garden`?(0,R.jsx)(ae,{sessions:z,collisions:e.collisions}):(0,R.jsx)(`div`,{className:`stack gap-12 act-live`,ref:O,children:z.map(e=>(0,R.jsx)(`div`,{"data-flip":S(e),children:(0,R.jsx)(Q,{s:e})},S(e)))}):(0,R.jsx)(te,{label:`Reading live sessions…`})),V.length>0&&(0,R.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,R.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),H.map(e=>(0,R.jsx)(`div`,{children:(0,R.jsx)(Q,{s:e})},S(e))),V.length>ge&&(0,R.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":l,onClick:()=>d(e=>!e),children:l?`Show fewer`:`Show all ${V.length}`})]}),o.f!==`needs`&&(0,R.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:Y,children:q.map(e=>(0,R.jsxs)(`section`,{className:`card act-day`,children:[(0,R.jsxs)(`h3`,{className:`act-day-h`,children:[(0,R.jsx)(`span`,{children:e.title}),(0,R.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,R.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,R.jsx)(me,{job:e,longest:J},e.id)),e.gate&&(0,R.jsx)(he,{gate:e.gate})]})]},e.key))})]})}export{ve as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-BxjLd7Qd.js";import{D as i,J as a,O as o,W as s,Y as c,ct as l,j as u,rt as d,w as f}from"./index-DA7BiaE5.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{g as m,i as h,l as g,r as _,s as v,t as y,u as b}from"./Bonsai-CJniRqaH.js";import{t as x}from"./usePoll-o8ul-Sog.js";var S=e(t(),1),C=n();function w(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 T({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,C.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,C.jsx)(`span`,{className:`badge act-who ${t?``:`acc`}`,children:t?`you`:`agent`}),(0,C.jsxs)(`div`,{className:`act-grow act-sm`,children:[!t&&(0,C.jsx)(`span`,{className:`feed-dot act-inline-dot ${w(e)||`acc`}`}),e.kind===`thinking`&&(0,C.jsx)(`span`,{className:`dim`,children:`thinking: `}),r?(0,C.jsx)(`span`,{className:`dim`,children:i}):t?i:(0,C.jsx)(`b`,{children:i}),e.error&&(0,C.jsxs)(`span`,{className:`dim`,children:[`: `,e.error]})]}),n.length>0&&(0,C.jsx)(`span`,{className:`dim mono act-xs act-fixed`,children:n.join(` · `)}),e.t?(0,C.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 E({turns:e}){return!e||e.length===0?(0,C.jsx)(`div`,{className:`dim act-sm`,children:`No conversation captured yet.`}):(0,C.jsx)(`div`,{className:`stack gap-12`,children:e.map((e,t)=>{let n=e.role===`user`;return(0,C.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,C.jsx)(`span`,{className:`badge act-who ${n?``:`acc`}`,children:n?`you`:`agent`}),(0,C.jsx)(`div`,{className:`act-min act-sm${n?``:` muted`}`,children:e.text})]},t)})})}var D=5;function O({s:e}){let[t]=(0,S.useState)(h),[n,r]=(0,S.useState)(null),i=!!e.ended,a=i?{...e,status:u(e)?`busy`:e.status,error:null}:e,o=m(a,t),s=(0,S.useMemo)(()=>b(a,{sakura:t}),[o]),c=(0,S.useCallback)(e=>r(e),[]),l=v(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(` · `),g=n==null?null:s.pads[n];return(0,C.jsxs)(`div`,{className:`card pad-md act-mt gd-detail${!i&&u(e)?` gd-needs`:``}`,children:[(0,C.jsx)(_,{t:s,pad:n,swaying:!i&&e.status!==`idle`,onPad:c,px:D,label:`Bonsai of this session${i?`, ended`:``}: ${p}`}),(0,C.jsxs)(`div`,{className:`stack gap-8 act-min`,children:[i&&(0,C.jsx)(`span`,{className:`dim act-xs`,children:`ended`}),(0,C.jsx)(`div`,{className:`dim act-sm`,children:p}),g?(0,C.jsx)(y,{pad:g}):(0,C.jsx)(`div`,{className:`dim act-xs`,children:`Hover a pad for the files it changed.`})]})]})}function k({sid:e}){let{sid:t,install:n}=g(e,window.location.hash),[o,u]=(0,S.useState)(null),[m,h]=(0,S.useState)(``),[_,v]=(0,S.useState)(!1),[y,b]=(0,S.useState)(!1),w=(0,S.useId)();x(e=>_?void 0:r.activityDetail(t,n).then(t=>{e()&&(u(t),h(``),v(!1))},t=>{e()&&(t.status===404?v(!0):h(t.message))}),2e3,[t,_]);let D=(0,C.jsxs)(`a`,{className:`btn ghost sm act-back`,href:`#/activity`,children:[(0,C.jsx)(d,{name:`arrow`}),` Activity`]});if(_)return(0,C.jsxs)(`div`,{className:`page-fill`,children:[D,(0,C.jsx)(p,{title:`Session ended`,action:(0,C.jsx)(`a`,{href:`#/activity`,children:`Back to Activity`}),children:`It's no longer live.`})]});if(!o)return(0,C.jsxs)(`div`,{className:`page-fill`,children:[D,m?(0,C.jsx)(a,{error:m}):(0,C.jsx)(c,{label:`Loading session…`})]});let k=o.session,A=k.files,j=k.todos,M=!!(A&&A.items&&A.items.length>0),N=!!(j&&j.items&&j.items.length>0),P=o.conversation||[],F=o.timeline||[],I=[...P.filter(e=>e.role===`user`).map(e=>({who:`you`,text:e.text,t:e.t||0})),...F.map(e=>({...e,who:`agent`}))].sort((e,t)=>(e.t||0)-(t.t||0));return(0,C.jsxs)(`div`,{className:`page-fill`,children:[D,(0,C.jsx)(s,{title:k.title||i(k.cwd)||k.session_id,sub:k.cwd?(0,C.jsx)(`span`,{className:`mono act-cwd`,title:k.cwd,children:k.cwd}):null}),m&&(0,C.jsx)(`div`,{className:`act-gap`,children:(0,C.jsx)(a,{error:m})}),(0,C.jsxs)(`div`,{className:`card pad-md`,children:[(0,C.jsx)(f,{s:k}),(0,C.jsxs)(`div`,{className:`dim act-updated`,children:[`updated `,l(k.updated_at),` ago`]})]}),(0,C.jsx)(O,{s:k}),(M||N)&&(0,C.jsxs)(`div`,{className:`grid gap-12 act-panels${M&&N?` two`:``}`,children:[M&&(0,C.jsxs)(`div`,{className:`card pad-md`,children:[(0,C.jsx)(`div`,{className:`card-head`,children:(0,C.jsxs)(`h2`,{children:[`Files touched `,(0,C.jsxs)(`span`,{className:`dim`,children:[`(`,A.count,`)`]})]})}),(0,C.jsx)(`div`,{className:`stack act-list`,children:A.items.map(e=>(0,C.jsxs)(`div`,{className:`row between gap-12 act-sm`,children:[(0,C.jsx)(`span`,{className:`mono act-ell act-grow`,title:e.file,children:e.file}),(0,C.jsxs)(`span`,{className:`act-fixed`,children:[(0,C.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions]}),` `,(0,C.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions]})]})]},e.file))})]}),N&&(0,C.jsxs)(`div`,{className:`card pad-md`,children:[(0,C.jsx)(`div`,{className:`card-head`,children:(0,C.jsxs)(`h2`,{children:[`Plan`,` `,(0,C.jsxs)(`span`,{className:`dim`,children:[`(`,j.done,`/`,j.total,`)`]})]})}),(0,C.jsx)(`div`,{className:`stack act-list`,children:j.items.map((e,t)=>(0,C.jsxs)(`div`,{className:`row gap-8 act-sm`,children:[(0,C.jsx)(`span`,{className:`feed-dot ${e.status===`completed`?`ok`:e.status===`in_progress`?`acc`:``}`}),(0,C.jsx)(`span`,{className:e.status===`completed`?`act-done`:void 0,children:e.content})]},t))})]})]}),(0,C.jsxs)(`div`,{className:`card pad-md act-mt`,children:[(0,C.jsxs)(`div`,{className:`card-head act-tl-head`,children:[(0,C.jsx)(`h2`,{children:`Timeline`}),F.length>0&&(0,C.jsx)(`button`,{className:`btn ghost sm`,"aria-expanded":y,"aria-controls":w,onClick:()=>b(e=>!e),children:y?`Show conversation`:`Show full stream (${I.length})`})]}),(0,C.jsx)(`div`,{id:w,children:y?(0,C.jsx)(`div`,{className:`stack gap-12`,children:I.map((e,t)=>(0,C.jsx)(T,{rec:e},t))}):(0,C.jsx)(E,{turns:P})})]})]})}export{O as SessionTree,k 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";var r=e(t(),1),i=e=>{let t=2166136261;for(let n of String(e))t=Math.imul(t^n.charCodeAt(0),16777619);return t>>>0},a=e=>()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296},o=e=>Math.max(0,Math.min(1,e)),s={claude:[`#8E4A33`,`#C46A4C`,`#E3906F`],bob:[`#173F8C`,`#2A5CC0`,`#6A96E8`],opencode:[`#5E6670`,`#98A2AD`,`#C8D0D8`],openclaude:[`#2F1F55`,`#4E3484`,`#8A6CC8`]},c={live:[`#16393D`,`#1F5A55`,`#2C7D55`,`#5DA845`,`#A8D23E`],sakura:[`#16393D`,`#6E2A55`,`#B83C80`,`#E9649F`,`#FFB0D2`],done:[`#5A2E14`,`#8A4A1C`,`#B8702A`,`#DB9A3E`,`#F2C46A`],idle:[`#2E3236`,`#44494E`,`#5E646A`,`#7C8288`,`#A2A7AC`]},l={developer:[`#123A3F`,`#1A5A5E`,`#24806F`,`#3FB08A`,`#8EE6C2`],explorer:[`#2C3A12`,`#4A6418`,`#6E9424`,`#9CC23A`,`#DDF07A`],reviewer:[`#16283F`,`#1F3E66`,`#2E5E92`,`#4A86C4`,`#9AC8F0`],tester:[`#3A3012`,`#5E4C18`,`#8A6E22`,`#B8952E`,`#EAD27A`]},u=[`#4E2E1C`,`#7A4A2E`,`#A2683F`,`#C78A5A`],d=[`#34312F`,`#4F4A46`,`#6B6560`,`#8A847E`],f=[`#3E8E41`,`#5FB14F`],p=[`#4A4F54`,`#62686E`],m=`#FFF6E0`,h=[`#E3C24A`,`#C9A23A`],g=[`#9BDD6A`,`#D8F59A`],_={"!":`#E8B04A`,x:`#FF6F69`},v=12;function y(e){let t=String(e||``).toLowerCase();return/implement|develop/.test(t)?`developer`:/explor/.test(t)?`explorer`:/review/.test(t)?`reviewer`:/test/.test(t)?`tester`:null}var b=e=>e?.status===`blocked`||e?.status===`waiting-input`;function x(e){return Array.isArray(e.files_all)?e.files_all.filter(e=>e&&typeof e==`object`):(Array.isArray(e.files?.items)?e.files.items:[]).filter(e=>e&&typeof e==`object`).map(e=>({file:e.file??null,path:e.path??null,additions:e.additions??0,deletions:e.deletions??0,by:e.by??null}))}var S=e=>e==null||e===``?NaN:Number(e);function C(e){let t=S(e?.context?.used),n=S(e?.context?.window);return Number.isFinite(t)&&Number.isFinite(n)&&n>0?o(t/n):null}function w(e){let t=x(e),n=(Array.isArray(e.agents)?e.agents:[]).filter(e=>e&&typeof e==`object`).map((e,t)=>({key:e.id??`#${t}`,id:e.id??null,type:e.type||null,running:e.status!==`done`,files:[]})),r=new Map(n.map(e=>[e.key,e])),i=[],a=e.attribution!==!1;for(let e of t){if(!a||e.by==null){i.push(e);continue}let t=r.get(e.by);t||(t={key:e.by,id:e.by,type:`agent`,running:!0,files:[]},n.push(t),r.set(e.by,t)),t.files.push(e)}let c=C(e),l=c!=null,u=l?S(e.context.used):NaN,d=l?c:.5,f=Math.max(0,Math.floor(Number(e.compactions)||0)),p=S(e.context_at_compaction),m=f===0?1:l&&Number.isFinite(p)&&p>0?o(u/p):0;return{id:String(e.session_id??``),host:s[e.host]?e.host:`claude`,idle:e.status===`idle`,bubble:b(e)?`!`:e.error?`x`:null,turns:Math.max(0,Number(e.turns)||0),ctx:d,compactions:f,compacted:f>0&&m<1,regrow:m,crown:i,agents:n}}function T(e,t=!1){let n=w(e);return JSON.stringify([n.id,n.host,n.idle,n.bubble,n.turns,Math.round(n.ctx*100),n.compactions,Math.round(n.regrow*100),n.crown.length,n.agents.map(e=>[e.key,e.type,e.running,e.files.length]),!!t])}function E(e,{sakura:t=!1}={}){let n=w(e),{id:r,idle:o}=n,b=Math.min(1,Math.log1p(n.turns)/Math.log1p(40)),x=.55+.45*b,S=a(i(r)),C=Array.from({length:56},()=>Array(56).fill(null)),T=Array.from({length:56},()=>Array(56).fill(-1)),E=-1,D=(e,t,n)=>{e=Math.round(e),t=Math.round(t),e>=0&&e<56&&t>=0&&t<56&&(C[t][e]=n,T[t][e]=E)},O=o?d:u,k=o?p:f,A=o?c.idle:t?c.sakura:c.live,j=Math.round(41-(9+18*b)),M=1+S()*2+3*b,N=S()*Math.PI*2,P=.9+S()*.6,F=e=>28+M*Math.sin(e*Math.PI*P+N)-M*Math.sin(N);for(let e=41;e>=j;e--){let t=(41-e)/(41-j),n=F(t),r=3+4.5*b-(1.5+3.5*b)*t;for(let t=Math.floor(n-r/2);t<=Math.ceil(n+r/2);t++){let i=(t-(n-r/2))/r;D(t,e,i<.25?O[3]:i>.75?O[0]:S()<.15?O[1]:O[2])}}for(let e=-6;e<=6;e++)D(28+e,41,Math.abs(e)>4?O[1]:O[2]),Math.abs(e)<=5&&D(28+e,40,Math.abs(e)>3?O[1]:O[2]);let I=[],L=(e,t,n,o,s,c)=>{n*=1.15,e=Math.max(n+2,Math.min(53-n,e));let l=a(i(`${r}:pad:${c}`)),u=n*.72;t=Math.max(t,u+6);for(let r=0;r<6;r++){let r=-Math.PI*(.15+.7*l()),i=n*(.4+.5*l());for(let n=0;n<i;n++)D(e+Math.cos(r)*n,t+u*.5+Math.sin(r)*n*.8,O[0])}let d=Math.round(10+n*1.6),f=[];for(let r=0;r<d;r++){let r=l()*Math.PI*2,i=Math.sqrt(l());f.push([e+Math.cos(r)*i*n,t+Math.sin(r)*i*u,1.8+l()*2.2])}f.sort((e,t)=>t[1]-e[1]);for(let[e,n,r]of f){let i=Math.max(0,Math.min(4,Math.round(4*(1-(n-(t-u))/(2*u))+(l()-.5))));for(let t=Math.floor(n-r);t<=n+r;t++)for(let a=Math.floor(e-r);a<=e+r;a++){if(((a-e)**2+(t-n)**2)/(r*r)>1+(l()-.5)*.5)continue;let s=a-e+(t-n)<-r*.3?1:t-n>r*.5?-1:0;D(a,t,o[Math.max(0,Math.min(4,i+s))])}}let p=a(i(`${r}:bloom:${c}`));for(let r=0;r<Math.min(s,v);r++)D(e+(p()*2-1)*n*.8,t-p()*u*.9,m);return{rx:n,cy:t}},R=a(i(`${r}:side`))()<.5?-1:1,z=[];n.agents.forEach((e,t)=>{let s=.25+.55*(t/Math.max(1,n.agents.length-1)),c=Math.round(41-s*(41-j)),u=F(s);if(!e.running){let t=(3+4.5*b-(1.5+3.5*b)*s)/2;E=-1,D(u+R*(t+1),c,O[3]),D(u+R*(t+2),c-1,O[2]),z.push({agentId:e.id,type:e.type,files:e.files}),R=-R;return}let d=Math.round((12+Math.floor(a(i(`${r}:branch:${e.key}`))()*4))*x);E=-1;for(let e=0;e<=d;e++){let t=u+R*e,n=c-e*.45;D(t,n,O[e<d/2?1:2]),D(t,n+1,O[0]),e<d*.6&&D(t,n+2,O[0])}let f=o?null:y(e.type),p=f?l[f]:A;E=I.length,I.push({agentId:e.id,key:e.key,type:e.type,family:f,files:e.files,bbox:null}),L(u+R*d,c-d*.45-2,(8+Math.min(e.files.length,6)*.6)*x,p,e.files.length,e.key),R=-R});let B=I.length;I.push({agentId:null,key:null,type:null,family:null,files:n.crown,bbox:null}),E=B;let V=(4+7*n.ctx+Math.min(n.crown.length,6)*.5)*x*1.35,{rx:H,cy:U}=L(F(1),j-3,V,A,n.crown.length,`crown`);if(n.ctx>.8&&!n.compacted){let e=a(i(`${r}:yellow`));for(let t=0;t<56;t++)for(let n=0;n<56;n++)T[t][n]===B&&C[t][n]!==m&&t<U-H*.2&&e()<.55&&(C[t][n]=e()<.5?h[0]:h[1])}if(n.compacted){let e=a(i(`${r}:shoots`)),t=Math.round(U-H*.15-n.regrow*H*.5);for(let e=0;e<Math.max(0,t);e++)for(let t=0;t<56;t++)T[e][t]===B&&(C[e][t]=null,T[e][t]=-1);if(t>=0&&t<56)for(let r=0;r<56;r++){if(T[t][r]!==B||e()>=.12+n.regrow*.5)continue;let i=1+Math.floor(e()*(1+n.regrow*3));for(let e=1;e<=i;e++)D(r,t-e,e===i?g[1]:g[0])}}E=-1;let W=a(i(`${r}:fallen`));z.forEach((e,t)=>D(16+(t*7+Math.floor(W()*4))%24,40,c.done[2+t%2]));for(let e=0;e<Math.min(n.compactions,6);e++)D(15+e*2,42,m);let[G,K,q]=s[n.host];for(let e=42;e<=46;e++){let t=e<=43?0:Math.floor((e-43)*.45)+2;for(let n=13+t;n<=42-t;n++){if(e===42&&C[e][n]===m)continue;let r=K;e<=43?r=e===42?q:G:(e===46||n===13+t||n===42-t)&&(r=G),D(n,e,r)}}let J=a(i(`${r}:moss`));for(let e=15;e<=40;e++)D(e,41,J()<.5?k[0]:k[1]),J()<.35&&D(e,40,k[0]);for(let e=16;e<=39;e++)D(e,47,`#00000055`);if(n.bubble){let e=_[n.bubble];for(let t=3;t<10;t++)for(let n=40;n<47;n++)D(n,t,t===3||t===9||n===40||n===46?e:`#14191F`);if(D(41,10,e),n.bubble===`!`){for(let t=5;t<=6;t++)D(43,t,e);D(43,8,e)}else for(let[t,n]of[[2,2],[4,2],[3,3],[2,4],[4,4]])D(40+t,3+n,e)}let Y=[],X=I.map(()=>null);for(let e=0;e<56;e++){let t=0;for(;t<56;){let n=C[e][t],r=T[e][t];if(!n){t++;continue}let i=t;for(;i+1<56&&C[e][i+1]===n&&T[e][i+1]===r;)i++;if(Y.push({x:t,y:e,w:i-t+1,c:n,p:r}),r>=0){let n=X[r]||={x0:t,y0:e,x1:i,y1:e};n.x0=Math.min(n.x0,t),n.x1=Math.max(n.x1,i),n.y1=e}t=i+1}}return I.forEach((e,t)=>{let n=X[t];e.bbox=n?{x:n.x0,y:n.y0,w:n.x1-n.x0+1,h:n.y1-n.y0+1}:null}),{width:56,height:56,runs:Y,pads:I,bubble:n.bubble,fallen:z}}var D=e=>{if(!e)return``;let t=String(e).replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||String(e)},O=e=>e?String(e).replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase():``;function k(e){let t=new Map;for(let n of e||[]){let e=n.repo||n.root,r=n.repo_key||(e?O(e):n.cwd?`cwd:${O(n.cwd)}`:`outside a repo`),i=D(e||n.cwd)||`outside a repo`;t.has(r)||t.set(r,{key:r,name:i,trees:[]});let a=n.root&&e&&O(n.root)!==O(e)?D(n.root):null;t.get(r).trees.push({s:n,worktree:a})}let n=(e,t)=>e<t?-1:+(e>t),r=[...t.values()];for(let e of r)e.trees.sort((e,t)=>n(e.worktree||``,t.worktree||``)||n(String(e.s.session_id),String(t.s.session_id)));return r.sort((e,t)=>n(e.name.toLowerCase(),t.name.toLowerCase())||n(e.key,t.key))}var A=(e,t)=>new Set((e.writers||[]).filter(e=>e.sid===t).map(e=>O(e.root)));function j(e,t,n){let r=A(e,t);for(let t of A(e,n))if(r.has(t))return`same-worktree`;return`cross-worktree`}var M=e=>[...new Set((e.writers||[]).map(e=>e.sid))];function N(e,t){let n=new Map(e.map((e,t)=>[e.s.session_id,t])),r=new Map;for(let e of t||[]){let t=M(e).filter(e=>n.has(e));for(let i=0;i<t.length;i++)for(let a=i+1;a<t.length;a++){let o=n.get(t[i]),s=n.get(t[a]),c=o<s?`${o}-${s}`:`${s}-${o}`,l=j(e,t[i],t[a]);(!r.has(c)||l===`same-worktree`)&&r.set(c,{a:o,b:s,kind:l})}}return[...r.values()]}function P(e,t){let n=[];for(let r of t||[]){let t=M(r).filter(t=>t!==e);if(!t.length||!M(r).includes(e))continue;let i=t.some(t=>j(r,e,t)===`same-worktree`);n.push({path:r.path,kind:i?`same-worktree`:`cross-worktree`})}return n}var F=e=>e?.status===`busy`||b(e);function I(e,t=10){let n=e.map(e=>({...e,collapsed:!1})),r=n.reduce((e,t)=>e+t.trees.length,0);if(r<=t)return n;let i=n.length,a=n.filter(e=>!e.trees.some(e=>F(e.s))).sort((e,t)=>t.trees.length-e.trees.length||(e.key<t.key?-1:1));for(let e of a){if(r<=t||i<=1)break;e.collapsed=!0,r-=e.trees.length,i--}return n}var L=n(),R=12,z=`geneseed-garden-sakura`;function B(){try{return window.localStorage.getItem(z)===`1`}catch{return!1}}var V=e=>e.key==null?`the session`:e.type||`agent`,H=e=>e.path||e.file||`?`;function U({pad:e}){let t=e.files.slice(0,R);return(0,L.jsxs)(`div`,{className:`card gd-card`,children:[(0,L.jsxs)(`div`,{className:`act-lbl`,children:[V(e),` · `,e.files.length,` file`,e.files.length===1?``:`s`]}),(0,L.jsx)(`ul`,{className:`gd-files`,children:t.map((e,t)=>(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`span`,{className:`mono act-ell`,children:H(e)}),(0,L.jsxs)(`span`,{className:`mono act-xs`,children:[(0,L.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions??0]}),` `,(0,L.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions??0]})]})]},`${H(e)}:${t}`))}),e.files.length>t.length&&(0,L.jsxs)(`div`,{className:`dim act-xs`,children:[`+`,e.files.length-t.length,` more`]})]})}var W=(0,r.memo)(function({t:e,pad:t,swaying:n,onPad:i,px:a,label:o}){let s=(0,r.useMemo)(()=>{let t=new Map;for(let n of e.runs)t.has(n.p)||t.set(n.p,[]),t.get(n.p).push(n);return[...t.entries()]},[e]);return(0,L.jsx)(`svg`,{className:`gd-svg${t==null?``:` gd-dimming`}`,viewBox:`0 0 56 56`,width:56*a,height:56*a,shapeRendering:`crispEdges`,"data-bubble":e.bubble||void 0,...o?{role:`img`,"aria-label":o}:{"aria-hidden":`true`},children:s.map(([r,a])=>(0,L.jsx)(`g`,{"data-p":r,className:[r===t&&`gd-hot`,n&&r>=0&&e.pads[r].key!=null&&`gd-sway`].filter(Boolean).join(` `)||void 0,onMouseEnter:r>=0?()=>i(r):void 0,onMouseLeave:r>=0?()=>i(null):void 0,children:a.map(e=>(0,L.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:1,fill:e.c},`${e.x},${e.y}`))},r))})});export{I as a,k as c,T as d,B as i,P as l,z as n,C as o,W as r,E as s,U as t,N as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";var r=e(t(),1),i=e=>{let t=2166136261;for(let n of String(e))t=Math.imul(t^n.charCodeAt(0),16777619);return t>>>0},a=e=>()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296},o=e=>Math.max(0,Math.min(1,e)),s={claude:[`#8E4A33`,`#C46A4C`,`#E3906F`],bob:[`#173F8C`,`#2A5CC0`,`#6A96E8`],opencode:[`#5E6670`,`#98A2AD`,`#C8D0D8`],openclaude:[`#2F1F55`,`#4E3484`,`#8A6CC8`]},c={live:[`#16393D`,`#1F5A55`,`#2C7D55`,`#5DA845`,`#A8D23E`],sakura:[`#16393D`,`#6E2A55`,`#B83C80`,`#E9649F`,`#FFB0D2`],done:[`#5A2E14`,`#8A4A1C`,`#B8702A`,`#DB9A3E`,`#F2C46A`],idle:[`#2E3236`,`#44494E`,`#5E646A`,`#7C8288`,`#A2A7AC`]},l={developer:[`#123A3F`,`#1A5A5E`,`#24806F`,`#3FB08A`,`#8EE6C2`],explorer:[`#2C3A12`,`#4A6418`,`#6E9424`,`#9CC23A`,`#DDF07A`],reviewer:[`#16283F`,`#1F3E66`,`#2E5E92`,`#4A86C4`,`#9AC8F0`],tester:[`#3A3012`,`#5E4C18`,`#8A6E22`,`#B8952E`,`#EAD27A`]},u=[`#4E2E1C`,`#7A4A2E`,`#A2683F`,`#C78A5A`],d=[`#34312F`,`#4F4A46`,`#6B6560`,`#8A847E`],f=[`#3E8E41`,`#5FB14F`],p=[`#4A4F54`,`#62686E`],m=`#FFF6E0`,h=[`#E3C24A`,`#C9A23A`],g=[`#9BDD6A`,`#D8F59A`],_={"!":`#E8B04A`,x:`#FF6F69`},v=12;function y(e){let t=String(e||``).toLowerCase();return/implement|develop/.test(t)?`developer`:/explor/.test(t)?`explorer`:/review/.test(t)?`reviewer`:/test/.test(t)?`tester`:null}var b=e=>e?.status===`blocked`||e?.status===`waiting-input`;function x(e){return Array.isArray(e.files_all)?e.files_all.filter(e=>e&&typeof e==`object`):(Array.isArray(e.files?.items)?e.files.items:[]).filter(e=>e&&typeof e==`object`).map(e=>({file:e.file??null,path:e.path??null,additions:e.additions??0,deletions:e.deletions??0,by:e.by??null}))}var S=e=>e==null||e===``?NaN:Number(e);function C(e){let t=S(e?.context?.used),n=S(e?.context?.window);return Number.isFinite(t)&&Number.isFinite(n)&&n>0?o(t/n):null}function w(e){let t=x(e),n=(Array.isArray(e.agents)?e.agents:[]).filter(e=>e&&typeof e==`object`).map((e,t)=>({key:e.id??`#${t}`,id:e.id??null,type:e.type||null,running:e.status!==`done`,files:[]})),r=new Map(n.map(e=>[e.key,e])),i=[],a=e.attribution!==!1;for(let e of t){if(!a||e.by==null){i.push(e);continue}let t=r.get(e.by);t||(t={key:e.by,id:e.by,type:`agent`,running:!0,files:[]},n.push(t),r.set(e.by,t)),t.files.push(e)}let c=C(e),l=c!=null,u=l?S(e.context.used):NaN,d=l?c:.5,f=Math.max(0,Math.floor(Number(e.compactions)||0)),p=S(e.context_at_compaction),m=f===0?1:l&&Number.isFinite(p)&&p>0?o(u/p):0;return{id:String(e.session_id??``),host:s[e.host]?e.host:`claude`,idle:e.status===`idle`,bubble:b(e)?`!`:e.error?`x`:null,turns:Math.max(0,Number(e.turns)||0),ctx:d,compactions:f,compacted:f>0&&m<1,regrow:m,crown:i,agents:n}}function T(e,t=!1){let n=w(e);return JSON.stringify([n.id,n.host,n.idle,n.bubble,n.turns,Math.round(n.ctx*100),n.compactions,Math.round(n.regrow*100),n.crown.length,n.agents.map(e=>[e.key,e.type,e.running,e.files.length]),!!t])}function E(e,{sakura:t=!1}={}){let n=w(e),{id:r,idle:o}=n,b=Math.min(1,Math.log1p(n.turns)/Math.log1p(40)),x=.55+.45*b,S=a(i(r)),C=Array.from({length:56},()=>Array(56).fill(null)),T=Array.from({length:56},()=>Array(56).fill(-1)),E=-1,D=(e,t,n)=>{e=Math.round(e),t=Math.round(t),e>=0&&e<56&&t>=0&&t<56&&(C[t][e]=n,T[t][e]=E)},O=o?d:u,k=o?p:f,A=o?c.idle:t?c.sakura:c.live,j=Math.round(41-(9+18*b)),M=1+S()*2+3*b,N=S()*Math.PI*2,P=.9+S()*.6,F=e=>28+M*Math.sin(e*Math.PI*P+N)-M*Math.sin(N);for(let e=41;e>=j;e--){let t=(41-e)/(41-j),n=F(t),r=3+4.5*b-(1.5+3.5*b)*t;for(let t=Math.floor(n-r/2);t<=Math.ceil(n+r/2);t++){let i=(t-(n-r/2))/r;D(t,e,i<.25?O[3]:i>.75?O[0]:S()<.15?O[1]:O[2])}}for(let e=-6;e<=6;e++)D(28+e,41,Math.abs(e)>4?O[1]:O[2]),Math.abs(e)<=5&&D(28+e,40,Math.abs(e)>3?O[1]:O[2]);let I=[],L=(e,t,n,o,s,c)=>{n*=1.15,e=Math.max(n+2,Math.min(53-n,e));let l=a(i(`${r}:pad:${c}`)),u=n*.72;t=Math.max(t,u+6);for(let r=0;r<6;r++){let r=-Math.PI*(.15+.7*l()),i=n*(.4+.5*l());for(let n=0;n<i;n++)D(e+Math.cos(r)*n,t+u*.5+Math.sin(r)*n*.8,O[0])}let d=Math.round(10+n*1.6),f=[];for(let r=0;r<d;r++){let r=l()*Math.PI*2,i=Math.sqrt(l());f.push([e+Math.cos(r)*i*n,t+Math.sin(r)*i*u,1.8+l()*2.2])}f.sort((e,t)=>t[1]-e[1]);for(let[e,n,r]of f){let i=Math.max(0,Math.min(4,Math.round(4*(1-(n-(t-u))/(2*u))+(l()-.5))));for(let t=Math.floor(n-r);t<=n+r;t++)for(let a=Math.floor(e-r);a<=e+r;a++){if(((a-e)**2+(t-n)**2)/(r*r)>1+(l()-.5)*.5)continue;let s=a-e+(t-n)<-r*.3?1:t-n>r*.5?-1:0;D(a,t,o[Math.max(0,Math.min(4,i+s))])}}let p=a(i(`${r}:bloom:${c}`));for(let r=0;r<Math.min(s,v);r++)D(e+(p()*2-1)*n*.8,t-p()*u*.9,m);return{rx:n,cy:t}},R=a(i(`${r}:side`))()<.5?-1:1,z=[];n.agents.forEach((e,t)=>{let s=.25+.55*(t/Math.max(1,n.agents.length-1)),c=Math.round(41-s*(41-j)),u=F(s);if(!e.running){let t=(3+4.5*b-(1.5+3.5*b)*s)/2;E=-1,D(u+R*(t+1),c,O[3]),D(u+R*(t+2),c-1,O[2]),z.push({agentId:e.id,type:e.type,files:e.files}),R=-R;return}let d=Math.round((12+Math.floor(a(i(`${r}:branch:${e.key}`))()*4))*x);E=-1;for(let e=0;e<=d;e++){let t=u+R*e,n=c-e*.45;D(t,n,O[e<d/2?1:2]),D(t,n+1,O[0]),e<d*.6&&D(t,n+2,O[0])}let f=o?null:y(e.type),p=f?l[f]:A;E=I.length,I.push({agentId:e.id,key:e.key,type:e.type,family:f,files:e.files,bbox:null}),L(u+R*d,c-d*.45-2,(8+Math.min(e.files.length,6)*.6)*x,p,e.files.length,e.key),R=-R});let B=I.length;I.push({agentId:null,key:null,type:null,family:null,files:n.crown,bbox:null}),E=B;let V=(4+7*n.ctx+Math.min(n.crown.length,6)*.5)*x*1.35,{rx:H,cy:U}=L(F(1),j-3,V,A,n.crown.length,`crown`);if(n.ctx>.8&&!n.compacted){let e=a(i(`${r}:yellow`));for(let t=0;t<56;t++)for(let n=0;n<56;n++)T[t][n]===B&&C[t][n]!==m&&t<U-H*.2&&e()<.55&&(C[t][n]=e()<.5?h[0]:h[1])}if(n.compacted){let e=a(i(`${r}:shoots`)),t=Math.round(U-H*.15-n.regrow*H*.5);for(let e=0;e<Math.max(0,t);e++)for(let t=0;t<56;t++)T[e][t]===B&&(C[e][t]=null,T[e][t]=-1);if(t>=0&&t<56)for(let r=0;r<56;r++){if(T[t][r]!==B||e()>=.12+n.regrow*.5)continue;let i=1+Math.floor(e()*(1+n.regrow*3));for(let e=1;e<=i;e++)D(r,t-e,e===i?g[1]:g[0])}}E=-1;let W=a(i(`${r}:fallen`));z.forEach((e,t)=>D(16+(t*7+Math.floor(W()*4))%24,40,c.done[2+t%2]));for(let e=0;e<Math.min(n.compactions,6);e++)D(15+e*2,42,m);let[G,K,q]=s[n.host];for(let e=42;e<=46;e++){let t=e<=43?0:Math.floor((e-43)*.45)+2;for(let n=13+t;n<=42-t;n++){if(e===42&&C[e][n]===m)continue;let r=K;e<=43?r=e===42?q:G:(e===46||n===13+t||n===42-t)&&(r=G),D(n,e,r)}}let J=a(i(`${r}:moss`));for(let e=15;e<=40;e++)D(e,41,J()<.5?k[0]:k[1]),J()<.35&&D(e,40,k[0]);for(let e=16;e<=39;e++)D(e,47,`#00000055`);if(n.bubble){let e=_[n.bubble];for(let t=3;t<10;t++)for(let n=40;n<47;n++)D(n,t,t===3||t===9||n===40||n===46?e:`#14191F`);if(D(41,10,e),n.bubble===`!`){for(let t=5;t<=6;t++)D(43,t,e);D(43,8,e)}else for(let[t,n]of[[2,2],[4,2],[3,3],[2,4],[4,4]])D(40+t,3+n,e)}let Y=[],X=I.map(()=>null);for(let e=0;e<56;e++){let t=0;for(;t<56;){let n=C[e][t],r=T[e][t];if(!n){t++;continue}let i=t;for(;i+1<56&&C[e][i+1]===n&&T[e][i+1]===r;)i++;if(Y.push({x:t,y:e,w:i-t+1,c:n,p:r}),r>=0){let n=X[r]||={x0:t,y0:e,x1:i,y1:e};n.x0=Math.min(n.x0,t),n.x1=Math.max(n.x1,i),n.y1=e}t=i+1}}return I.forEach((e,t)=>{let n=X[t];e.bbox=n?{x:n.x0,y:n.y0,w:n.x1-n.x0+1,h:n.y1-n.y0+1}:null}),{width:56,height:56,runs:Y,pads:I,bubble:n.bubble,fallen:z}}var D=e=>{if(!e)return``;let t=String(e).replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||String(e)},O=e=>e?String(e).replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase():``;function k(e){let t=new Map;for(let n of e||[]){let e=n.repo||n.root,r=n.repo_key||(e?O(e):n.cwd?`cwd:${O(n.cwd)}`:`outside a repo`),i=D(e||n.cwd)||`outside a repo`;t.has(r)||t.set(r,{key:r,name:i,trees:[]});let a=n.root&&e&&O(n.root)!==O(e)?D(n.root):null;t.get(r).trees.push({s:n,worktree:a})}let n=(e,t)=>e<t?-1:+(e>t),r=[...t.values()];for(let e of r)e.trees.sort((e,t)=>n(e.worktree||``,t.worktree||``)||n(String(e.s.session_id),String(t.s.session_id)));return r.sort((e,t)=>n(e.name.toLowerCase(),t.name.toLowerCase())||n(e.key,t.key))}var A=e=>e.key??(e.install?`${e.install}\0${e.session_id}`:String(e.session_id)),j=e=>A({key:e.key??void 0,install:e.install,session_id:e.sid}),M=(e,t)=>String(e).split(/[\\/]+/).filter(Boolean).slice(-t).join(`/`);function N(e){let t=e||[],n=e=>n=>t.filter(t=>e(t)===e(n)).length,r=n(e=>e.host),i=n(e=>`${e.host} ${e.scope}`),a=new Map(t.map(e=>[e.install,r(e)<2?e.host:i(e)<2||e.scope===`global`?`${e.host} · ${e.scope}`:`${e.host} · ${D(e.path)}`])),o=()=>t.filter(e=>t.some(t=>t!==e&&a.get(t.install)===a.get(e.install)));for(let e=2,t=o();t.length;e++,t=o()){for(let n of t){let t=String(n.path).split(/[\\/]+/).filter(Boolean).length;a.set(n.install,`${n.host} · ${e>t?n.path:M(n.path,e)}`)}if(e>64)break}return a}var P=(e,t)=>`#/activity/${encodeURIComponent(e)}`+(t?`?${new URLSearchParams({host:t.host,path:t.path})}`:``);function F(e,t){let n=String(e).indexOf(`?`),r=new URLSearchParams(String(t||``).split(`?`)[1]||``),i=r.get(`host`),a=r.get(`path`);return{sid:n<0?e:String(e).slice(0,n),install:i&&a?{host:i,path:a}:void 0}}function I(e,t){let n=new Map((t||[]).map(e=>[e.install,e])),r=N(t);return(e||[]).map(e=>{let t=n.get(e.install);return{...e,host:t?.host??e.host,chip:r.get(e.install)??e.host??null,href:P(e.session_id,t)}})}var L=(e,t)=>new Set((e.writers||[]).filter(e=>j(e)===t).map(e=>O(e.root)));function R(e,t,n){let r=L(e,t);for(let t of L(e,n))if(r.has(t))return`same-worktree`;return`cross-worktree`}var z=e=>[...new Set((e.writers||[]).map(j))];function B(e,t){let n=new Map(e.map((e,t)=>[A(e.s),t])),r=new Map;for(let e of t||[]){let t=z(e).filter(e=>n.has(e));for(let i=0;i<t.length;i++)for(let a=i+1;a<t.length;a++){let o=n.get(t[i]),s=n.get(t[a]),c=o<s?`${o}-${s}`:`${s}-${o}`,l=R(e,t[i],t[a]);r.has(c)&&l!==`same-worktree`||r.set(c,{a:o,b:s,kind:l})}}return[...r.values()]}function V(e,t){let n=[];for(let r of t||[]){let t=z(r).filter(t=>t!==e);if(!t.length||!z(r).includes(e))continue;let i=t.some(t=>R(r,e,t)===`same-worktree`);n.push({path:r.path,kind:i?`same-worktree`:`cross-worktree`})}return n}var H=e=>e?.status===`busy`||b(e);function U(e,t=10){let n=e.map(e=>({...e,collapsed:!1})),r=n.reduce((e,t)=>e+t.trees.length,0);if(r<=t)return n;let i=n.length,a=n.filter(e=>!e.trees.some(e=>H(e.s))).sort((e,t)=>t.trees.length-e.trees.length||(e.key<t.key?-1:1));for(let e of a){if(r<=t||i<=1)break;e.collapsed=!0,r-=e.trees.length,i--}return n}var W=n(),G=12,K=`geneseed-garden-sakura`;function q(){try{return window.localStorage.getItem(K)===`1`}catch{return!1}}var J=e=>e.key==null?`the session`:e.type||`agent`,Y=e=>e.path||e.file||`?`;function X({pad:e}){let t=e.files.slice(0,G);return(0,W.jsxs)(`div`,{className:`card gd-card`,children:[(0,W.jsxs)(`div`,{className:`act-lbl`,children:[J(e),` · `,e.files.length,` file`,e.files.length===1?``:`s`]}),(0,W.jsx)(`ul`,{className:`gd-files`,children:t.map((e,t)=>(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`span`,{className:`mono act-ell`,children:Y(e)}),(0,W.jsxs)(`span`,{className:`mono act-xs`,children:[(0,W.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions??0]}),` `,(0,W.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions??0]})]})]},`${Y(e)}:${t}`))}),e.files.length>t.length&&(0,W.jsxs)(`div`,{className:`dim act-xs`,children:[`+`,e.files.length-t.length,` more`]})]})}var Z=(0,r.memo)(function({t:e,pad:t,swaying:n,onPad:i,px:a,label:o}){let s=(0,r.useMemo)(()=>{let t=new Map;for(let n of e.runs)t.has(n.p)||t.set(n.p,[]),t.get(n.p).push(n);return[...t.entries()]},[e]);return(0,W.jsx)(`svg`,{className:`gd-svg${t==null?``:` gd-dimming`}`,viewBox:`0 0 56 56`,width:56*a,height:56*a,shapeRendering:`crispEdges`,"data-bubble":e.bubble||void 0,...o?{role:`img`,"aria-label":o}:{"aria-hidden":`true`},children:s.map(([r,a])=>(0,W.jsx)(`g`,{"data-p":r,className:[r===t&&`gd-hot`,n&&r>=0&&e.pads[r].key!=null&&`gd-sway`].filter(Boolean).join(` `)||void 0,onMouseEnter:r>=0?()=>i(r):void 0,onMouseLeave:r>=0?()=>i(null):void 0,children:a.map(e=>(0,W.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:1,fill:e.c},`${e.x},${e.y}`))},r))})});export{A as a,P as c,k as d,N as f,T as g,B as h,q as i,F as l,V as m,K as n,U as o,I as p,Z as r,C as s,X as t,E as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{rt as r}from"./index-DA7BiaE5.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};
|