geneseed 6.0.3 → 6.0.4
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 +18 -0
- package/DESIGN.md +1 -1
- package/SHIPPED.md +1 -1
- package/adapters/opencode/plugins/geneseed-context.js +0 -42
- package/adapters/opencode/plugins/geneseed-learn.js +13 -4
- package/bin/geneseed-hook.mjs +5 -0
- package/docs/concepts/hooks.md +6 -6
- package/docs/guides/install-scripted.md +1 -1
- package/docs/reference/env-context.md +2 -1
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/profiles.md +1 -0
- package/docs/understand/a-day.md +1 -1
- package/docs/understand/machine-claude.md +1 -1
- package/docs/web-ui.md +2 -2
- package/harness.config.json +1 -1
- package/js/build/args.mjs +4 -3
- package/js/build/driver.mjs +8 -8
- package/js/build/emit-claude.mjs +59 -4
- package/js/build/generate.mjs +11 -2
- package/js/build/profile.mjs +10 -5
- package/js/build/render.mjs +3 -1
- package/js/build/source.mjs +12 -1
- package/js/cli-table.json +37 -0
- package/js/hosts/hooks-context.mjs +1 -56
- package/js/hosts/hooks-learn.mjs +435 -55
- package/js/hosts/installs.mjs +22 -2
- package/js/hosts/memory-files.mjs +89 -6
- package/js/hosts/native.mjs +23 -1
- package/js/hosts/settings.mjs +77 -4
- package/js/inspect/diff.mjs +3 -1
- package/js/inspect/doctor.mjs +37 -3
- package/js/inspect/status.mjs +38 -5
- package/js/inspect/validate.mjs +1 -1
- package/js/lib/proc.mjs +36 -0
- package/js/maintain/profiles.mjs +15 -4
- package/js/maintain/setup.mjs +31 -7
- package/js/maintain/update.mjs +1 -1
- package/js/web/actions.mjs +5 -3
- package/js/web/api.mjs +2 -2
- package/js/web/profiles-api.mjs +2 -2
- package/js/web/state.mjs +13 -2
- package/package.json +1 -1
- package/src/AGENT.md.tmpl +1 -1
- package/src/agents/memory-curator.md +3 -0
- package/src/doctrines/process.md +2 -2
- package/src/memory/README.md +24 -4
- package/src/skills/rule.md +9 -5
- package/web/dist/assets/{Activity-IAxWF2wK.js → Activity-BsMFA5Aa.js} +1 -1
- package/web/dist/assets/{ActivityDetail-CtC2DLvh.js → ActivityDetail-C66n3oul.js} +1 -1
- package/web/dist/assets/{Bonsai-BoKo68Kw.js → Bonsai-BCd-qt7W.js} +1 -1
- package/web/dist/assets/{CopyButton-C0VTiqmb.js → CopyButton-Dpl0PFja.js} +1 -1
- package/web/dist/assets/{Dashboard-CRGCp2cV.js → Dashboard-CQxdiv7F.js} +2 -2
- package/web/dist/assets/{Docs-DwOwzaD6.js → Docs-D0XlXuiA.js} +1 -1
- package/web/dist/assets/{Factories-DxHD2T-1.js → Factories-CPVBoWoA.js} +1 -1
- package/web/dist/assets/{GreenhouseView-D5VOmhmR.js → GreenhouseView-C_2auUA8.js} +1 -1
- package/web/dist/assets/Installs-CXqjmqms.js +3 -0
- package/web/dist/assets/{JournalView-gUSGysTm.js → JournalView-S-igd-Nv.js} +1 -1
- package/web/dist/assets/{Kits-DYQvykZ0.js → Kits-K6mu91rm.js} +1 -1
- package/web/dist/assets/{Laws-UVk0uojS.js → Laws-j5vKNwLT.js} +1 -1
- package/web/dist/assets/{LibRows-CwK63kjB.js → LibRows-1yTY0Kwn.js} +1 -1
- package/web/dist/assets/{Library-DdzyrwUK.js → Library-BQZnFdWs.js} +1 -1
- package/web/dist/assets/{Loops-yHga7xdr.js → Loops-B5DgxpLm.js} +1 -1
- package/web/dist/assets/Models-C-4Y4jvx.js +1 -0
- package/web/dist/assets/{OperatorHudView-D1lQF-ZY.js → OperatorHudView-_8NBAvkd.js} +1 -1
- package/web/dist/assets/Personal-Bf7zHDc6.js +2 -0
- package/web/dist/assets/{Settings-Brgec4M0.js → Settings-BTrA6MXv.js} +1 -1
- package/web/dist/assets/{Tabs-BHjxciOL.js → Tabs-BDhZImxa.js} +1 -1
- package/web/dist/assets/controls-CREglcUF.js +1 -0
- package/web/dist/assets/{index-BfyZCNu7.css → index-9iBqq7i2.css} +1 -1
- package/web/dist/assets/{index-BILaKHbH.js → index-BiKWWv7Z.js} +3 -3
- package/web/dist/index.html +2 -2
- package/web/dist/assets/Installs-B5hFSUeN.js +0 -3
- package/web/dist/assets/Models-DAgkQ4CE.js +0 -1
- package/web/dist/assets/Personal-DjhIfa9v.js +0 -2
- package/web/dist/assets/controls-CK7qHA8H.js +0 -1
package/js/maintain/setup.mjs
CHANGED
|
@@ -53,7 +53,7 @@ import { loadProfile, profileBuildArgs, profileHosts } from './profiles.mjs';
|
|
|
53
53
|
import { superpowersKitDefault } from './plugin-detect.mjs';
|
|
54
54
|
import { checkProjectFolder, globalLayering, layeringText } from './profile-scope.mjs';
|
|
55
55
|
import { playLine } from '../ui/anim.mjs';
|
|
56
|
-
import { DEFAULT_CONTEXT_WINDOW, DEFAULT_TIERS, discoverNames, GATE_SWITCHES, PACK_ORDER, ROOT, loadKits } from '../build/source.mjs';
|
|
56
|
+
import { DEFAULT_CONTEXT_WINDOW, DEFAULT_LEARN, DEFAULT_TIERS, discoverNames, GATE_SWITCHES, PACK_ORDER, ROOT, loadKits } from '../build/source.mjs';
|
|
57
57
|
import { exportImprovements } from '../inspect/diff.mjs';
|
|
58
58
|
import { cmdDoctor } from '../inspect/doctor.mjs';
|
|
59
59
|
import { setupBuildArgs } from '../build/generate.mjs';
|
|
@@ -61,7 +61,7 @@ import { SHARED_TIER_BENEFIT, sharedTierCost, sharedTierFigure } from '../inspec
|
|
|
61
61
|
import { GLOBAL_MANIFEST, HOSTS, opencodeConfigDir } from '../hosts/hosts.mjs';
|
|
62
62
|
import {
|
|
63
63
|
claudeCfg, defaultMode, defaultPosture, defaultTheme, EMIT_HOST_SCOPE, gatesOfDir, installedDefaults, installState,
|
|
64
|
-
contextWindowOfDir, readJsonMaybe, sharedTierOfDir, themeFiles, tiersOfDir,
|
|
64
|
+
contextWindowOfDir, readJsonMaybe, sharedTierOfDir, themeFiles, tiersOfDir, learnOfDir,
|
|
65
65
|
} from '../hosts/installs.mjs';
|
|
66
66
|
import { printOut, printErr } from '../lib/fs.mjs';
|
|
67
67
|
import { inNpxCache, which } from '../lib/paths.mjs';
|
|
@@ -340,6 +340,23 @@ export function targetTiers(emit, out) {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
/**
|
|
344
|
+
* The learn model of the one install a setup answer re-runs, read off it: PRESERVED, NOT ASKED (the
|
|
345
|
+
* Models page owns the question), as `targetTiers` does, so the wizard's `--reset` cannot reset a
|
|
346
|
+
* recorded choice to the default. No install, or unreadable: the default.
|
|
347
|
+
*/
|
|
348
|
+
export function targetLearn(emit, out) {
|
|
349
|
+
const [host, scope] = EMIT_HOST_SCOPE.get(emit) ?? [];
|
|
350
|
+
try {
|
|
351
|
+
if (!host) return DEFAULT_LEARN;
|
|
352
|
+
const dir = scope === 'global'
|
|
353
|
+
? HOSTS.find((h) => h.host === host).configDir() : resolveOut(out || '.');
|
|
354
|
+
return installState(dir, host, scope) === 'absent' ? DEFAULT_LEARN : learnOfDir(dir, host);
|
|
355
|
+
} catch {
|
|
356
|
+
return DEFAULT_LEARN;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
343
360
|
export function collectSetupLines(kitMap = null) {
|
|
344
361
|
printOut('Geneseed setup — answer a few questions; nothing is written until you confirm.\n');
|
|
345
362
|
const inst = installedDefaults();
|
|
@@ -389,9 +406,10 @@ export function collectSetupLines(kitMap = null) {
|
|
|
389
406
|
const gated = Object.values(gates).some((on) => on === false);
|
|
390
407
|
const contextWindow = targetContextWindow(emit, out, inst.contextWindow);
|
|
391
408
|
const tiers = targetTiers(emit, out);
|
|
409
|
+
const learn = targetLearn(emit, out);
|
|
392
410
|
printOut(`\nAbout to run: geneseed build ${
|
|
393
411
|
setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines, allPacks,
|
|
394
|
-
excludeRules, undefined, excludeSkills, gates, kits, sharedTier, contextWindow, tiers).join(' ')} --reset\n`);
|
|
412
|
+
excludeRules, undefined, excludeSkills, gates, kits, sharedTier, contextWindow, tiers, learn).join(' ')} --reset\n`);
|
|
395
413
|
if (!confirm('Proceed?', true)) return null;
|
|
396
414
|
// The key only when there is something to carry, so a selection that excludes no skill and
|
|
397
415
|
// switches off no gate is the same object it was before either existed.
|
|
@@ -400,6 +418,7 @@ export function collectSetupLines(kitMap = null) {
|
|
|
400
418
|
...(gated ? { gates } : {}), ...(kits ? { kits } : {}), ...(sharedTier ? { sharedTier } : {}),
|
|
401
419
|
...(contextWindow !== DEFAULT_CONTEXT_WINDOW ? { contextWindow } : {}),
|
|
402
420
|
...(tiers !== DEFAULT_TIERS ? { tiers } : {}),
|
|
421
|
+
...(learn !== DEFAULT_LEARN ? { learn } : {}),
|
|
403
422
|
emit, out, root, footprint,
|
|
404
423
|
};
|
|
405
424
|
}
|
|
@@ -595,7 +614,7 @@ export function setupLines() {
|
|
|
595
614
|
const {
|
|
596
615
|
theme, emit, out, root, footprint = 'lean', posture = 'peer', mode = 'direct',
|
|
597
616
|
doctrines = null, excludeRules = null, excludeSkills = null, gates = {}, kits = null,
|
|
598
|
-
sharedTier = false, contextWindow = DEFAULT_CONTEXT_WINDOW, tiers = DEFAULT_TIERS,
|
|
617
|
+
sharedTier = false, contextWindow = DEFAULT_CONTEXT_WINDOW, tiers = DEFAULT_TIERS, learn = DEFAULT_LEARN,
|
|
599
618
|
} = sel;
|
|
600
619
|
if (emit === 'opencode-global') {
|
|
601
620
|
// The build below overwrites the deployed global harness, which may carry hand edits (or
|
|
@@ -615,7 +634,7 @@ export function setupLines() {
|
|
|
615
634
|
// one command and run another.
|
|
616
635
|
const argv = setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines,
|
|
617
636
|
doctrineOptions().map(([n]) => n), excludeRules, undefined, excludeSkills, gates, kits, sharedTier,
|
|
618
|
-
contextWindow, tiers);
|
|
637
|
+
contextWindow, tiers, learn);
|
|
619
638
|
// `--reset`: the wizard's answers are a WHOLE selection, and `setupBuildArgs` elides an axis at
|
|
620
639
|
// its default, so answering one back to it (mode direct, posture peer) over an install would
|
|
621
640
|
// otherwise trip the preserve guard (js/build/profile.mjs). The plan line above says the same.
|
|
@@ -852,8 +871,13 @@ export function profileBuilds(p, targets, { project = null, build, exportDrift,
|
|
|
852
871
|
for (const t of targets) {
|
|
853
872
|
// The install's own tier routing rides along unless the profile names one (`profileBuildArgs`).
|
|
854
873
|
let current = null;
|
|
855
|
-
|
|
856
|
-
|
|
874
|
+
let currentLearn = null;
|
|
875
|
+
try {
|
|
876
|
+
const dir = project ? resolveOut(project) : configDir(t.host);
|
|
877
|
+
current = tiersOfDir(dir, t.host);
|
|
878
|
+
currentLearn = learnOfDir(dir, t.host);
|
|
879
|
+
} catch { /* unreadable: the default */ }
|
|
880
|
+
const argv = profileBuildArgs(p, t.host, project, current, {}, currentLearn);
|
|
857
881
|
const moved = changes(argv);
|
|
858
882
|
let saved = null;
|
|
859
883
|
if (!project) {
|
package/js/maintain/update.mjs
CHANGED
|
@@ -772,7 +772,7 @@ export async function installAxes(dir, { installProfile, setupBuildArgs }, notif
|
|
|
772
772
|
if (!existsSync(path.join(String(dir), '.geneseed-emit'))) return [];
|
|
773
773
|
const p = installProfile('opencode', 'global', String(dir), notify);
|
|
774
774
|
return setupBuildArgs('', 'files', null, null, p.footprint, p.posture, p.mode, p.doctrines,
|
|
775
|
-
undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits, p.sharedTier, p.contextWindow, p.tiers).slice(4);
|
|
775
|
+
undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits, p.sharedTier, p.contextWindow, p.tiers, p.learn).slice(4);
|
|
776
776
|
}
|
|
777
777
|
|
|
778
778
|
/**
|
package/js/web/actions.mjs
CHANGED
|
@@ -44,7 +44,7 @@ import { DEFAULT_PRESET, PRESETS } from '../loop/score.mjs';
|
|
|
44
44
|
import { activeLoops, setLoopPreset } from '../loop/registry.mjs';
|
|
45
45
|
import { HOSTS, resolvePath } from '../hosts/hosts.mjs';
|
|
46
46
|
import {
|
|
47
|
-
EMIT_FOR, EMIT_HOST_SCOPE, doctrinesForBuild, excludedRulesOfDir, excludedSkillsOfDir, sharedTierOfDir, contextWindowOfDir, tiersOfDir, renderedTier,
|
|
47
|
+
EMIT_FOR, EMIT_HOST_SCOPE, doctrinesForBuild, excludedRulesOfDir, excludedSkillsOfDir, sharedTierOfDir, contextWindowOfDir, tiersOfDir, learnOfDir, renderedTier,
|
|
48
48
|
footprintOfDir, gatesOfDir,
|
|
49
49
|
installedDefaults, installState, installTargets, modeOfDir, postureOfDir, themeOfDir,
|
|
50
50
|
trustOfDir,
|
|
@@ -697,6 +697,8 @@ export function apiRestore(state, files) {
|
|
|
697
697
|
contextWindow: contextWindowOfDir(target),
|
|
698
698
|
// The tier routing, or a restored AGENT.md drops its `Model tiers: auto` line and the agents their model lines.
|
|
699
699
|
tiers: tiersOfDir(target),
|
|
700
|
+
// The learn model, or a restored AGENT.md drops its `Learn model:` line.
|
|
701
|
+
learn: learnOfDir(target),
|
|
700
702
|
// The gate switches: a restored AGENT.md must keep the install's `<gate>: off` lines.
|
|
701
703
|
...gatesOfDir(target),
|
|
702
704
|
}));
|
|
@@ -812,7 +814,7 @@ export function apiInstallCmd(state, body) {
|
|
|
812
814
|
const argv = setupBuildArgs(theme || 'neutral', emit, out, out, fp, pos, mode, doctrines,
|
|
813
815
|
PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates,
|
|
814
816
|
kits ?? migratedKitsOfDir(root, host), sharedTier, bodyContextWindow(body, root, host, scope),
|
|
815
|
-
bodyTiers(body, root, host));
|
|
817
|
+
bodyTiers(body, root, host), learnOfDir(root, host));
|
|
816
818
|
// `--reset`: this argv is a WHOLE selection — every axis is the body's or the install's own —
|
|
817
819
|
// and `setupBuildArgs` elides an axis at its default, so returning one to it (a mode back to
|
|
818
820
|
// direct, a gate re-armed) would otherwise trip the preserve guard (js/build/profile.mjs).
|
|
@@ -937,7 +939,7 @@ export function apiDeployCmd(state, body) {
|
|
|
937
939
|
const argv = setupBuildArgs(theme || 'neutral', host, root, root, fp, pos, mode, doctrines,
|
|
938
940
|
PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates, migratedKitsOfDir(root, host),
|
|
939
941
|
bodySharedTier(body, root, host), bodyContextWindow(body, root, host, 'project'),
|
|
940
|
-
bodyTiers(body, root, host));
|
|
942
|
+
bodyTiers(body, root, host), learnOfDir(root, host));
|
|
941
943
|
// `--reset`, as in `apiInstallCmd`: the form's answers plus the folder's own are a whole selection.
|
|
942
944
|
argv.push('--reset');
|
|
943
945
|
return { cmd: [process.execPath, path.join(ROOT, 'bin', 'build-driver.mjs'), ...argv] };
|
package/js/web/api.mjs
CHANGED
|
@@ -116,8 +116,8 @@ export function apiDoctor(state, fresh = false) {
|
|
|
116
116
|
const answer = () => {
|
|
117
117
|
if (state._doctor === null && state._doctorJob !== null) return state._doctorJob.then(answer);
|
|
118
118
|
if (state._doctor === null) state.runDoctor();
|
|
119
|
-
const { ok, problems, checked_at } = state._doctor;
|
|
120
|
-
return { ...state._doctorRun, ok, problems, checked_at };
|
|
119
|
+
const { ok, problems, notes, checked_at } = state._doctor;
|
|
120
|
+
return { ...state._doctorRun, ok, problems, notes, checked_at };
|
|
121
121
|
};
|
|
122
122
|
// A cold cache on a daemon (a view switch dropped it) is filled on the thread, as the overview's is.
|
|
123
123
|
if (state.warm && state._doctor === null) warmDoctor(state);
|
package/js/web/profiles-api.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import path from 'node:path';
|
|
|
15
15
|
import { ROOT } from '../build/source.mjs';
|
|
16
16
|
import { installProfile } from '../build/profile.mjs';
|
|
17
17
|
import { HOSTS, expanduser } from '../hosts/hosts.mjs';
|
|
18
|
-
import { installState, installTargets, tiersOfDir } from '../hosts/installs.mjs';
|
|
18
|
+
import { installState, installTargets, learnOfDir, tiersOfDir } from '../hosts/installs.mjs';
|
|
19
19
|
import {
|
|
20
20
|
BASE_PROFILE, isGitClone, listProfiles, loadProfile, profileBuildArgs, profileDiff, profileDirs,
|
|
21
21
|
profileFromInstall, profileHosts, profileKits,
|
|
@@ -83,7 +83,7 @@ function previewRows(p, project, hosts) {
|
|
|
83
83
|
// (`markerCollision`): the row says so and the panel does not offer it.
|
|
84
84
|
const refused = project ? markerCollision(project, h.host) : null;
|
|
85
85
|
const changes = h.present && !refused && state === 'active'
|
|
86
|
-
? profileChanges(profileBuildArgs(p, h.host, project, root ? tiersOfDir(root, h.host) : null)) : [];
|
|
86
|
+
? profileChanges(profileBuildArgs(p, h.host, project, root ? tiersOfDir(root, h.host) : null, {}, root ? learnOfDir(root, h.host) : null)) : [];
|
|
87
87
|
return {
|
|
88
88
|
host: h.host, label: h.label, present: h.present, state, root: root ? String(root) : null,
|
|
89
89
|
changes, layering: project && !refused ? globalLayering(h.host) : null, refused,
|
package/js/web/state.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
postureOfDir, themeOfDir, trustOfDir,
|
|
17
17
|
} from '../hosts/installs.mjs';
|
|
18
18
|
import { doctorCollect } from '../inspect/doctor.mjs';
|
|
19
|
+
import { isDoctorNote } from '../inspect/scan.mjs';
|
|
19
20
|
import { emitOf, pickedInstall } from '../inspect/status.mjs';
|
|
20
21
|
import { DEFAULT_PRESET } from '../loop/score.mjs';
|
|
21
22
|
import { readText, isFile } from '../lib/fs.mjs';
|
|
@@ -191,8 +192,18 @@ export function webState(theme = null, target = null) {
|
|
|
191
192
|
};
|
|
192
193
|
st.stampDoctor = (problems, themes = [], groups = []) => {
|
|
193
194
|
st._doctorJob = null; // a run still in flight started earlier: this verdict is the newer one
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
// `doctorCollect` hands back `[note] …` lines among the problems; the CLI keeps them apart
|
|
196
|
+
// and so does the console (a healthy machine is not "1 problem"). The ONE split, shared by
|
|
197
|
+
// the in-process run and the worker's message, since both end here.
|
|
198
|
+
const notes = problems.filter(isDoctorNote);
|
|
199
|
+
const real = problems.filter((p) => !isDoctorNote(p));
|
|
200
|
+
const split = groups.map((g) => ({
|
|
201
|
+
...g,
|
|
202
|
+
problems: g.problems.filter((p) => !isDoctorNote(p)),
|
|
203
|
+
notes: [...(g.notes ?? []), ...g.problems.filter(isDoctorNote)],
|
|
204
|
+
}));
|
|
205
|
+
st._doctor = { ok: !real.length, problems: real, notes, checked_at: stampMinute(Date.now()) };
|
|
206
|
+
st._doctorRun = { themes, groups: split };
|
|
196
207
|
};
|
|
197
208
|
/**
|
|
198
209
|
* The CURRENT install's mode, from its `.geneseed-emit` marker: the ROOT first (where
|
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`, `exports` 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": "6.0.
|
|
4
|
+
"version": "6.0.4",
|
|
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/AGENT.md.tmpl
CHANGED
|
@@ -293,7 +293,7 @@ inventory — that list is the catalogue and it is authoritative, as is its
|
|
|
293
293
|
procedure is in [`{{DIR_SKILLS}}/`]({{DIR_SKILLS}}/) and the host loads it on
|
|
294
294
|
demand.
|
|
295
295
|
<!-- CATALOG:end -->
|
|
296
|
-
{{EXCLUDED_SKILLS_LINE}}{{KITS_LINE}}{{SHARED_TIER_LINE}}{{CONTEXT_WINDOW_LINE}}{{TIERS_LINE}}
|
|
296
|
+
{{EXCLUDED_SKILLS_LINE}}{{KITS_LINE}}{{SHARED_TIER_LINE}}{{CONTEXT_WINDOW_LINE}}{{TIERS_LINE}}{{LEARN_LINE}}
|
|
297
297
|
When a task repeats and no {{SKILL}} covers it, forge one through the
|
|
298
298
|
[skill-forge]({{DIR_SKILLS}}/skill-forge.md) {{SKILL}}: copy
|
|
299
299
|
[`{{DIR_SKILLS}}/_template.md`]({{DIR_SKILLS}}/_template.md), keep it to one coherent
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
2. For each topic, verify and classify its facts as the
|
|
37
37
|
rule {{SKILL}}'s consolidation flow does (verify, classify, apply with consent):
|
|
38
38
|
keep, merge, rewrite, promote or retire. Show the topic's plan, then apply it.
|
|
39
|
+
When you rewrite a fact, bring it to the convention's *Writing a fact* bar: durable,
|
|
40
|
+
general, lean. A fact that is only task residue is archived, not rewritten. Move the
|
|
41
|
+
old version into `archive/` before you overwrite it, so every rewrite can be undone.
|
|
39
42
|
3. **Merge** overlapping facts into one survivor that keeps both `**Why:**` /
|
|
40
43
|
`**How to apply:**` lines and both sets of `[[links]]`; archive the merged-away
|
|
41
44
|
file with `geneseed memory rm`.
|
package/src/doctrines/process.md
CHANGED
|
@@ -8,13 +8,13 @@ architectural stance, record it before the session ends. A durable fact goes int
|
|
|
8
8
|
{{MEMORY}} on your own, with no prompt: the user sees every memory later in the web
|
|
9
9
|
console. A standing rule binds every later session, so it is the user's call: take it to
|
|
10
10
|
them through the rule {{SKILL}}. A memory phrased as an instruction to later sessions
|
|
11
|
-
("always…", "never…", `force: constraint`) is a standing rule.
|
|
11
|
+
("always…", "never…", `force: constraint`) is a standing rule. Store only what stays true past this task, in the fewest words that keep it exact.
|
|
12
12
|
<!-- LEAN:else -->
|
|
13
13
|
When a session yields a durable decision, correction, non-obvious discovery, or
|
|
14
14
|
architectural stance, record it before it ends: a durable fact into {{MEMORY}} on your
|
|
15
15
|
own (the user sees it in the web console); a standing rule, which includes
|
|
16
16
|
any instruction to later sessions ("always…", "never…", `force: constraint`), only through
|
|
17
|
-
the rule {{SKILL}}, with the user's consent.
|
|
17
|
+
the rule {{SKILL}}, with the user's consent. Store only what stays true past this task, in the fewest words that keep it exact.
|
|
18
18
|
<!-- LEAN:end -->
|
|
19
19
|
|
|
20
20
|
### {{DOCTRINE:plan-before-acting}} Plan Before Acting
|
package/src/memory/README.md
CHANGED
|
@@ -31,7 +31,7 @@ topic: <kebab-case-slug> # optional; index group,
|
|
|
31
31
|
force: constraint | choice | conviction | tempered # optional
|
|
32
32
|
---
|
|
33
33
|
|
|
34
|
-
The fact
|
|
34
|
+
The fact in one or two sentences (see *Writing a fact*). For `feedback` and `project`, follow with
|
|
35
35
|
**Why:** and **How to apply:** lines. Link related memories with [[their-name]].
|
|
36
36
|
```
|
|
37
37
|
|
|
@@ -39,6 +39,26 @@ The fact, stated plainly. For `feedback` and `project`, follow with
|
|
|
39
39
|
binds* — the two are independent axes. Leave `force` off for a plain fact; add it
|
|
40
40
|
when a memory is a decision or stance the agent must weigh before overriding.
|
|
41
41
|
|
|
42
|
+
## Writing a fact
|
|
43
|
+
|
|
44
|
+
Every fact is read again in later sessions, and its `description` loads with its topic
|
|
45
|
+
file, so each word costs on every recall.
|
|
46
|
+
|
|
47
|
+
- **Durable only.** Store what stays true and useful at the start of an unrelated later
|
|
48
|
+
task: a preference, a convention, a decision and its reason, a trap and its fix. Never
|
|
49
|
+
store task residue: what this session did, fixed, merged or released, a PR or ticket
|
|
50
|
+
number, a session-specific count or status such as "pending" or "next is…". The git history holds those.
|
|
51
|
+
- **General, not the incident.** State the principle the incident taught. Name a file,
|
|
52
|
+
function or command only when the fact is about it.
|
|
53
|
+
- **Lean.** `description` is one line that states the claim itself, specific enough to
|
|
54
|
+
tell it from its neighbours: it is the index hook, and the only field `learn` reads to
|
|
55
|
+
choose between update and create. A bare label ("Plugin panels") is too vague. The body
|
|
56
|
+
holds the fact in one or two sentences; **Why:** and **How to apply:** take one line
|
|
57
|
+
each. No narrative, no story of how it was found, no repeat of the description. Keep a
|
|
58
|
+
date only when the fact depends on it, and write it absolute.
|
|
59
|
+
- **Too long for this is documentation.** Put it in the project's docs and store a
|
|
60
|
+
one-line `reference` pointer to it.
|
|
61
|
+
|
|
42
62
|
## Types
|
|
43
63
|
|
|
44
64
|
- **user** — who the user is: role, expertise, stable preferences.
|
|
@@ -132,9 +152,9 @@ session start, so what sat in its first 3 072 characters loaded by accident. At
|
|
|
132
152
|
`feedback` fact whose line sat there, any fact with `force: constraint`, and a `feedback` fact whose
|
|
133
153
|
description says *always* or *never* (*toujours*, *jamais*) are written to `user-rules.draft.md`
|
|
134
154
|
(at most 30), exactly as the fold drafts a rule; `user-rules.md` is never written without your
|
|
135
|
-
decision.
|
|
136
|
-
|
|
137
|
-
|
|
155
|
+
decision. A draft does not load until you approve it, in the console or with the rule {{SKILL}}:
|
|
156
|
+
an approved draft moves into `user-rules.md`, which loads; a rejected one is dropped. Until then
|
|
157
|
+
a one-line reminder at session start says how many wait. A second build drafts nothing new.
|
|
138
158
|
|
|
139
159
|
## Per-{{AGENT}} memory (`agents/` subdirectory)
|
|
140
160
|
|
package/src/skills/rule.md
CHANGED
|
@@ -34,16 +34,20 @@ whether they want a rule, ask; never file a rule as a fact because a fact needs
|
|
|
34
34
|
Then take exactly one branch.
|
|
35
35
|
|
|
36
36
|
### Branch A — a fact to remember
|
|
37
|
-
1.
|
|
37
|
+
1. If it is task residue (what this session did, a PR or ticket number, a session count
|
|
38
|
+
or status), write nothing ({{MEMORY}} convention, *Writing a fact*). The exception is
|
|
39
|
+
when the user explicitly asked to store it: then store the durable lesson in it, lean,
|
|
40
|
+
and say so.
|
|
41
|
+
2. Search {{MEMORY}} for a file that already covers it. If one exists, merge into it —
|
|
38
42
|
keep what is still true, add or correct the rest — never mint a twin. If the new
|
|
39
43
|
fact proves the old one wrong, archive the old one (move it into `archive/`).
|
|
40
|
-
|
|
44
|
+
3. Add a **binding force** only when the conversation shows one: *a choice taken among
|
|
41
45
|
real alternatives* (`choice`) · *a stance held until evidence overturns it*
|
|
42
46
|
(`conviction`) · *a constraint the user deliberately relaxed* (`tempered`). A plain
|
|
43
47
|
fact carries none. A fact that needs `constraint` is a rule: back to the fork, Branch B.
|
|
44
|
-
|
|
45
|
-
per the {{MEMORY}} convention.
|
|
46
|
-
|
|
48
|
+
4. Infer the `type` (`user` | `feedback` | `project` | `reference`) and draft the file
|
|
49
|
+
per the {{MEMORY}} convention's *Writing a fact*: durable, general, lean.
|
|
50
|
+
5. Write the file, with no prompt, and rebuild the index
|
|
47
51
|
(`geneseed memory consolidate --memory <the {{PATH_MEMORY}}/ dir's path>`) so its line
|
|
48
52
|
lands in `topics/<topic>.md` and the `MEMORY.md` map recounts. Then say in one line
|
|
49
53
|
what you wrote and where, so a wrong inference is visible at once; the web console
|
|
@@ -1 +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-C8nMUU1i.js";import{A as i,At as a,Ct as o,D as s,E as c,F as l,H as u,L as d,M as f,N as p,O as m,Ot as h,P as g,T as _,bt as ee,et as te,it as ne,j as v,o as re,tt as y,w as b,xt as ie}from"./index-BILaKHbH.js";import{t as x}from"./EmptyState-CY5Pm2xy.js";import{_ as S,a as ae,c as C,f as w,g as T,h as E,i as D,l 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,v as L}from"./Bonsai-BoKo68Kw.js";import{s as oe}from"./motion-RlUl1osO.js";var R=e(t(),1),z=n(),B=4,V=56*B,H=24,U=165,W=188,G=(e,t)=>e>0?Math.max(1,Math.floor((e-32+H)/(V+H))):Math.max(1,t),K=e=>e.status===`blocked`?`bad`:f(e)?`warn`:e.status===`busy`?`ok`:``,q=e=>{let t=O(e);return t==null?null:Math.round(t*100)};function J(e,t,n){let r=b[e.status]||b.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),o=q(e);return[`${e.title||m(e.cwd)||e.session_id}, ${e.chip||e.host||`unknown host`}, ${r.label}${e.phase?`, ${e.phase}`:``}`,`${e.turns||0} turns${o==null?``:`, context ${o} %`}${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 Y({s:e,t,mine:n}){let r=q(e);return(0,z.jsxs)(`div`,{className:`card gd-card`,children:[(0,z.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`dt`,{children:`model`}),(0,z.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,z.jsx)(`dt`,{children:`turns`}),(0,z.jsx)(`dd`,{children:e.turns||0}),(0,z.jsx)(`dt`,{children:`context`}),(0,z.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,z.jsx)(`dt`,{children:`compactions`}),(0,z.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,z.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,z.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 X({s:e,worktree:t,sakura:n,mine:r,pad:i,onHover:a}){let o=L(e,n),s=(0,R.useMemo)(()=>w(e,{sakura:n}),[o]),c=b[e.status]||b.idle,l=Array.isArray(e.loops)?e.loops[0]:null,u=e.status!==`idle`,d=P(e),p=e.title||m(e.cwd)||e.session_id,h=q(e),g=(0,R.useRef)(null),_=(0,R.useCallback)(e=>a(d,e,Z(g.current)),[a,d]);return(0,z.jsxs)(`a`,{ref:g,className:`gd-tree${f(e)?` gd-needs`:``}`,href:e.href||I(e.session_id),"aria-label":J(e,s,r),"data-sid":e.session_id,onMouseEnter:e=>a(d,null,Z(e.currentTarget)),onMouseLeave:()=>a(null,null),onFocus:e=>a(d,null,Z(e.currentTarget)),onBlur:()=>a(null,null),onKeyDown:e=>D(e,s.pads.length,i,_),children:[(0,z.jsx)(N,{t:s,pad:i,swaying:u,onPad:_,px:B}),(0,z.jsxs)(`div`,{className:`gd-cap`,children:[(0,z.jsx)(`div`,{className:`gd-title`,title:p,children:p}),(0,z.jsxs)(`div`,{className:`row wrap gd-pills`,children:[(0,z.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip||e.host||`?`}),(0,z.jsx)(`span`,{className:`badge ${K(e)}`,children:c.label}),t&&(0,z.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),l&&(0,z.jsxs)(`span`,{className:`badge`,children:[`↻ `,l.title,l.iteration==null?``:` ${l.iteration}`]}),e.attribution===!1&&(0,z.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`})]}),(0,z.jsxs)(`div`,{className:`mono gd-meta`,children:[e.turns||0,` turns`,h==null?``:` · ${h}%`]})]})]})}function se({pairs:e,count:t}){if(!e.length)return null;let n=t*V+(t-1)*H,r=e=>e*(V+H)+V/2;return(0,z.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*B+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,z.jsxs)(`g`,{className:o,children:[(0,z.jsx)(`path`,{d:`M${e} ${U} C${n} 179 ${n} 159 ${t} 169`}),(0,z.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${U}`})]},`${i}-${a}`)}return(0,z.jsx)(`g`,{className:o,children:(0,z.jsx)(`path`,{d:`M${r(i)} ${W} Q${(r(i)+r(a))/2} 222 ${r(a)} ${W}`})},`${i}-${a}`)})})}var Z=e=>e.offsetLeft;function ce({sessions:e,collisions:t}){let[n,r]=(0,R.useState)(j),[i,a]=(0,R.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(A,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=C(M(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>T(e,s);return(0,z.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,z.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,z.jsxs)(`span`,{className:`dim act-sm`,children:[e.length,` tree`,e.length===1?``:`s`,` · `,c.length,` `,c.length===1?`shelf`:`shelves`,` · a tree opens its session; hover or focus shows its details, and a tap or the arrow keys walk its pads`]}),(0,z.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Pink blossom`})]}),l.length>0&&(0,z.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,z.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,z.jsx)(le,{sh:e,sakura:n,cols:s,mineOf:u},e.key))]})}function le({sh:e,sakura:t,cols:n,mineOf:r}){let[i,a]=(0,R.useState)({sid:null,pad:null,x:0}),o=(0,R.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=(0,R.useRef)(null),[c,l]=(0,R.useState)(0);(0,R.useLayoutEffect)(()=>{let e=s.current,t=()=>l(e.clientWidth);if(t(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let u=G(c,e.trees.length),d=S(e.trees,n),f=[];for(let t=0;t<e.trees.length;t+=u)f.push(t);let p=e.trees.findIndex(e=>P(e.s)===i.sid),m=p<0?null:e.trees[p].s,h=m?w(m,{sakura:t}):null,g=h&&i.pad!=null?h.pads[i.pad]:null,_=e.trees.length;return(0,z.jsxs)(`section`,{className:`gd-shelf`,"aria-label":`${e.name} shelf`,ref:s,children:[f.map(n=>{let a=e.trees.slice(n,n+u),s=n+a.length,c=d.filter(e=>e.a>=n&&e.a<s&&e.b>=n&&e.b<s).map(e=>({...e,a:e.a-n,b:e.b-n}));return(0,z.jsxs)(`div`,{className:`gd-row`,children:[(0,z.jsx)(`div`,{className:`gd-plank`,children:n===0&&(0,z.jsxs)(`h3`,{className:`gd-plate`,children:[e.name,` · `,_,` session`,_===1?``:`s`]})}),a.map(({s:e,worktree:n})=>(0,z.jsx)(X,{s:e,worktree:n,sakura:t,mine:r(P(e)),pad:P(e)===i.sid?i.pad:null,onHover:o},P(e))),(0,z.jsx)(se,{pairs:c,count:a.length}),m&&p>=n&&p<s&&(0,z.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:g?(0,z.jsx)(F,{pad:g}):(0,z.jsx)(Y,{s:m,t:h,mine:r(P(m))})})]},n)}),(0,z.jsx)(`span`,{className:`sr-only`,role:`status`,children:ae(g)})]})}var Q=e=>e.catch(()=>null);function ue({s:e}){let t=(0,R.useId)(),n=e.todos,r=v(e);return(0,z.jsxs)(`a`,{className:`card pad-md act-card`,href:e.href||I(e.session_id),"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,z.jsxs)(_,{s:e,id:t,heading:e.title||m(e.cwd)||e.session_id,children:[e.chip&&(0,z.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip}),(0,z.jsx)(o,{name:`chevron`,className:`glyph act-chev`})]}),n&&n.total>0&&(0,z.jsx)(`div`,{className:`act-foot`,children:(0,z.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,z.jsx)(s,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,z.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,h(e.updated_at),` ago`]})]})}var de={blocked:`is blocked`,"waiting-input":`waits for your answer`};function fe(e,t){if(!Array.isArray(t))return``;let n=t.filter(f),r=e.current;return e.current=new Set(n.map(e=>`${P(e)}:${e.status}`)),r?n.filter(e=>!r.has(`${P(e)}:${e.status}`)).map(e=>`${e.title||m(e.cwd)||e.session_id} ${de[e.status]}`).join(`. `):``}var pe=[[`all`,`All`],[`needs`,`Needs you`],[`runs`,`Runs`],[`gates`,`Gate asks`]];function me(){let e=new URLSearchParams(window.location.hash.split(`?`)[1]||``),t=e.get(`f`);return{f:pe.some(([e])=>e===t)?t:`all`,host:e.get(`host`)||``,project:e.get(`project`)||``,v:e.get(`v`)===`list`?`list`:`garden`}}function he(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 ge({enabled:e,installs:t,onToggle:n}){let r=k(t);return(0,z.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,z.jsx)(o,{name:`activity`,className:`glyph act-fixed`}),(0,z.jsxs)(`div`,{className:`act-grow`,children:[(0,z.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,z.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,z.jsxs)(`ul`,{className:`stack gap-8 act-fixed act-sm`,"aria-label":`Tracking per install`,children:[t.length===0&&(0,z.jsx)(`li`,{className:`dim`,children:`No active install to track.`}),t.map((e,t)=>(0,z.jsxs)(`li`,{className:`row gap-10`,children:[(0,z.jsxs)(`span`,{id:`act-track-l${t}`,title:e.path,children:[`Track live sessions in `,(0,z.jsx)(`span`,{className:`mono`,children:r.get(e.install)})]}),(0,z.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 _e({jobs:e,loading:t}){let n=typeof e?.cap==`number`?e.cap:void 0,r=p(e?.jobs,{days:14,cap:n}),i=l(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),u=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${g(e.key)}`).join(`, `)||`none`}.`+(c?s?` Days before ${g(s.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,z.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,z.jsxs)(`div`,{className:`act-stat-head`,children:[(0,z.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,z.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,z.jsx)(y,{label:`Reading the job log…`}):e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":u,ref:i,children:r.map(e=>e.nodata?(0,z.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,z.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${g(e.key)}: ${e.n}`},e.key):(0,z.jsx)(`i`,{className:`zero`},e.key))}),(0,z.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,z.jsx)(`span`,{children:g(r[0].key)}),(0,z.jsx)(`span`,{children:g(r[7].key)}),(0,z.jsx)(`span`,{children:`today`})]}),c&&(0,z.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,z.jsx)(`p`,{className:`dim act-sm`,children:`The job log could not be read.`})]})}function ve({rows:e,gates:t,loading:n}){let r=e.reduce((e,t)=>e+t.n,0);return(0,z.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,z.jsxs)(`div`,{className:`act-stat-head`,children:[(0,z.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,z.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,z.jsx)(y,{label:`Reading the gate ledger…`}):e.length?(0,z.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,z.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,z.jsx)(c,{vals:e.per_day,i:t,sweep:!0}),(0,z.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,z.jsx)(`p`,{className:`dim act-sm`,children:t?`No gate asked in 30 days.`:`The gate ledger could not be read.`})]})}var ye={done:[`ok`,`done`],failed:[`bad`,`failed`],running:[``,`running`]};function be({job:e,longest:t}){let n=d(e),r=e.duration?Math.round(e.duration*10)/10:0,[i,a]=ye[e.status]||[``,e.status||`…`],s=e.status===`running`?`Still running`:r?`Took ${r} second${r===1?``:`s`}`:`No duration`,c=e.started?new Date(e.started*1e3).toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`}):`—`;return(0,z.jsxs)(`li`,{className:`act-row`,children:[(0,z.jsx)(`span`,{className:`mono dim act-xs`,children:c}),(0,z.jsx)(o,{name:`play`,className:`glyph act-glyph`}),(0,z.jsxs)(`span`,{className:`act-what`,children:[(0,z.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,z.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,z.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":s,children:(0,z.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,z.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function xe({gate:e}){return(0,z.jsxs)(`li`,{className:`act-row gate`,children:[(0,z.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,z.jsx)(o,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,z.jsxs)(`span`,{className:`act-what`,children:[(0,z.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,z.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,z.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`badge warn`,children:`asked`})]})}var Se=5,$=(e,t)=>[...new Set([...e.filter(Boolean),t].filter(Boolean))];function Ce(){let[e,t]=(0,R.useState)(null),[n,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(me),[d,p]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),_=(0,R.useRef)(null),v=e=>{let t={...s,...e};c(t),he(t)};ie(e=>r.activity().then(n=>{if(e()){t(ee(n)),o(``);let e=fe(_,n?.activity);e&&g(t=>t===e?e+`\xA0`:e)}},t=>{e()&&o(t.message)}),2e3,[]);let b=a(()=>Q(r.jobs()),[]),S=a(()=>Q(r.gates()),[]),ae=a(()=>Q(r.catalog(`laws`)),[]),C=!e||e.enabled!==!1,w=Array.isArray(e?.installs)?e.installs:[],T=E(e?.activity,w).sort((e,t)=>e.session_id<t.session_id?-1:+(e.session_id>t.session_id)),D=oe(),O=C&&e?T.filter(f).length:null,k=new Set(T.map(P)),A=s.v===`list`?E(e?.ended,w).filter(e=>!k.has(P(e))):[],j=$([...T,...A].map(e=>e.host),s.host),M=$([...T,...A].map(e=>m(e.cwd)),s.project),N=s.host&&s.project?`host or project`:s.host?`host`:s.project?`project`:``,F=e=>(!s.host||e.host===s.host)&&(!s.project||m(e.cwd)===s.project),I=T.filter(e=>F(e)&&(s.f!==`needs`||f(e))),L=s.f===`all`||s.f===`needs`,B=s.f===`all`&&C?A.filter(F):[],V=d?B:B.slice(0,Se),H=!N&&(s.f===`all`||s.f===`runs`),U=!N&&(s.f===`all`||s.f===`gates`),W=b.data?.jobs||[],G=re(S.data,ae.data),K=i(W,G,S.data?.days).map(e=>({...e,runs:H?e.runs:[],gate:U?e.gate:null})).filter(e=>e.runs.length||e.gate),q=Math.max(0,...W.map(e=>e.duration||0)),J=l(K.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),Y=async e=>{let n=!e.enabled;try{let i=await r.activityToggle(n,{host:e.host,path:e.path});if(i.ok===!1){o(i.error||`Could not change tracking`);return}let a=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:a(t?.activity),ended:a(t?.ended)}}),o(``)}catch(e){o(e.message)}},X=(e,t,n)=>(0,z.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,z.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,z.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:s[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>v({[e]:t.target.value}),children:[(0,z.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]});return(0,z.jsxs)(`div`,{className:`page-fill`,children:[(0,z.jsx)(u,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,z.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:h}),n&&(0,z.jsx)(`div`,{className:`act-gap`,children:(0,z.jsx)(te,{error:n})}),e&&(0,z.jsx)(ge,{enabled:C,installs:w,onToggle:Y}),(0,z.jsxs)(`div`,{className:`act-today`,children:[(0,z.jsx)(_e,{jobs:b.data,loading:b.loading}),(0,z.jsx)(ve,{rows:G,gates:S.data,loading:S.loading}),(0,z.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,z.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),!e&&!n?(0,z.jsx)(y,{}):e?(0,z.jsxs)(z.Fragment,{children:[C?(0,z.jsxs)(`span`,{className:`act-big act-wait`,children:[O,` `,(0,z.jsx)(`span`,{className:`dim act-sm`,children:O===1?`session`:`sessions`})]}):null,(0,z.jsx)(`p`,{className:`dim act-sm`,children:C?`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,z.jsx)(`p`,{className:`dim act-sm`,children:`The sessions could not be read.`})]})]}),(0,z.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,z.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:pe.map(([e,t])=>(0,z.jsxs)(`button`,{type:`button`,className:s.f===e?`chip-f on`:`chip-f`,"aria-pressed":s.f===e,onClick:()=>v({f:e}),children:[t,e===`needs`&&O>0?(0,z.jsxs)(`span`,{className:`mono`,children:[` `,O]}):null]},e))}),X(`host`,`Host`,j),X(`project`,`Project`,M),(0,z.jsx)(ne,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,z.jsx)(`button`,{type:`button`,className:s.v===e?`on`:``,"aria-pressed":s.v===e,onClick:()=>v({v:e}),children:t},e))})]}),N&&s.f!==`needs`&&(0,z.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,N,`; showing sessions only.`]}),L&&(e?!C&&s.f!==`needs`?null:I.length===0?s.f===`needs`?(0,z.jsx)(x,{title:`Nothing waits on you`}):(0,z.jsx)(x,{title:`No active sessions`,children:`Start an agent session and it appears here.`}):s.v===`garden`?(0,z.jsx)(ce,{sessions:I,collisions:e.collisions}):(0,z.jsx)(`div`,{className:`stack gap-12 act-live`,ref:D,children:I.map(e=>(0,z.jsx)(`div`,{"data-flip":P(e),children:(0,z.jsx)(ue,{s:e})},P(e)))}):(0,z.jsx)(y,{label:`Reading live sessions…`})),B.length>0&&(0,z.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,z.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),V.map(e=>(0,z.jsx)(`div`,{children:(0,z.jsx)(ue,{s:e})},P(e))),B.length>Se&&(0,z.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":d,onClick:()=>p(e=>!e),children:d?`Show fewer`:`Show all ${B.length}`})]}),s.f!==`needs`&&(0,z.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:J,children:K.map(e=>(0,z.jsxs)(`section`,{className:`card act-day`,children:[(0,z.jsxs)(`h3`,{className:`act-day-h`,children:[(0,z.jsx)(`span`,{children:e.title}),(0,z.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,z.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,z.jsx)(be,{job:e,longest:q},e.id)),e.gate&&(0,z.jsx)(xe,{gate:e.gate})]})]},e.key))})]})}export{Ce as default};
|
|
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-C8nMUU1i.js";import{A as i,At as a,Ct as o,D as s,E as c,F as l,H as u,L as d,M as f,N as p,O as m,Ot as h,P as g,T as _,bt as ee,et as te,it as ne,j as v,o as re,tt as y,w as b,xt as ie}from"./index-BiKWWv7Z.js";import{t as x}from"./EmptyState-CY5Pm2xy.js";import{_ as S,a as ae,c as C,f as w,g as T,h as E,i as D,l 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,v as L}from"./Bonsai-BCd-qt7W.js";import{s as oe}from"./motion-RlUl1osO.js";var R=e(t(),1),z=n(),B=4,V=56*B,H=24,U=165,W=188,G=(e,t)=>e>0?Math.max(1,Math.floor((e-32+H)/(V+H))):Math.max(1,t),K=e=>e.status===`blocked`?`bad`:f(e)?`warn`:e.status===`busy`?`ok`:``,q=e=>{let t=O(e);return t==null?null:Math.round(t*100)};function J(e,t,n){let r=b[e.status]||b.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),o=q(e);return[`${e.title||m(e.cwd)||e.session_id}, ${e.chip||e.host||`unknown host`}, ${r.label}${e.phase?`, ${e.phase}`:``}`,`${e.turns||0} turns${o==null?``:`, context ${o} %`}${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 Y({s:e,t,mine:n}){let r=q(e);return(0,z.jsxs)(`div`,{className:`card gd-card`,children:[(0,z.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`dt`,{children:`model`}),(0,z.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,z.jsx)(`dt`,{children:`turns`}),(0,z.jsx)(`dd`,{children:e.turns||0}),(0,z.jsx)(`dt`,{children:`context`}),(0,z.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,z.jsx)(`dt`,{children:`compactions`}),(0,z.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,z.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,z.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 X({s:e,worktree:t,sakura:n,mine:r,pad:i,onHover:a}){let o=L(e,n),s=(0,R.useMemo)(()=>w(e,{sakura:n}),[o]),c=b[e.status]||b.idle,l=Array.isArray(e.loops)?e.loops[0]:null,u=e.status!==`idle`,d=P(e),p=e.title||m(e.cwd)||e.session_id,h=q(e),g=(0,R.useRef)(null),_=(0,R.useCallback)(e=>a(d,e,Z(g.current)),[a,d]);return(0,z.jsxs)(`a`,{ref:g,className:`gd-tree${f(e)?` gd-needs`:``}`,href:e.href||I(e.session_id),"aria-label":J(e,s,r),"data-sid":e.session_id,onMouseEnter:e=>a(d,null,Z(e.currentTarget)),onMouseLeave:()=>a(null,null),onFocus:e=>a(d,null,Z(e.currentTarget)),onBlur:()=>a(null,null),onKeyDown:e=>D(e,s.pads.length,i,_),children:[(0,z.jsx)(N,{t:s,pad:i,swaying:u,onPad:_,px:B}),(0,z.jsxs)(`div`,{className:`gd-cap`,children:[(0,z.jsx)(`div`,{className:`gd-title`,title:p,children:p}),(0,z.jsxs)(`div`,{className:`row wrap gd-pills`,children:[(0,z.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip||e.host||`?`}),(0,z.jsx)(`span`,{className:`badge ${K(e)}`,children:c.label}),t&&(0,z.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),l&&(0,z.jsxs)(`span`,{className:`badge`,children:[`↻ `,l.title,l.iteration==null?``:` ${l.iteration}`]}),e.attribution===!1&&(0,z.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`})]}),(0,z.jsxs)(`div`,{className:`mono gd-meta`,children:[e.turns||0,` turns`,h==null?``:` · ${h}%`]})]})]})}function se({pairs:e,count:t}){if(!e.length)return null;let n=t*V+(t-1)*H,r=e=>e*(V+H)+V/2;return(0,z.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*B+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,z.jsxs)(`g`,{className:o,children:[(0,z.jsx)(`path`,{d:`M${e} ${U} C${n} 179 ${n} 159 ${t} 169`}),(0,z.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${U}`})]},`${i}-${a}`)}return(0,z.jsx)(`g`,{className:o,children:(0,z.jsx)(`path`,{d:`M${r(i)} ${W} Q${(r(i)+r(a))/2} 222 ${r(a)} ${W}`})},`${i}-${a}`)})})}var Z=e=>e.offsetLeft;function ce({sessions:e,collisions:t}){let[n,r]=(0,R.useState)(j),[i,a]=(0,R.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(A,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=C(M(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>T(e,s);return(0,z.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,z.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,z.jsxs)(`span`,{className:`dim act-sm`,children:[e.length,` tree`,e.length===1?``:`s`,` · `,c.length,` `,c.length===1?`shelf`:`shelves`,` · a tree opens its session; hover or focus shows its details, and a tap or the arrow keys walk its pads`]}),(0,z.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Pink blossom`})]}),l.length>0&&(0,z.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,z.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,z.jsx)(le,{sh:e,sakura:n,cols:s,mineOf:u},e.key))]})}function le({sh:e,sakura:t,cols:n,mineOf:r}){let[i,a]=(0,R.useState)({sid:null,pad:null,x:0}),o=(0,R.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=(0,R.useRef)(null),[c,l]=(0,R.useState)(0);(0,R.useLayoutEffect)(()=>{let e=s.current,t=()=>l(e.clientWidth);if(t(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let u=G(c,e.trees.length),d=S(e.trees,n),f=[];for(let t=0;t<e.trees.length;t+=u)f.push(t);let p=e.trees.findIndex(e=>P(e.s)===i.sid),m=p<0?null:e.trees[p].s,h=m?w(m,{sakura:t}):null,g=h&&i.pad!=null?h.pads[i.pad]:null,_=e.trees.length;return(0,z.jsxs)(`section`,{className:`gd-shelf`,"aria-label":`${e.name} shelf`,ref:s,children:[f.map(n=>{let a=e.trees.slice(n,n+u),s=n+a.length,c=d.filter(e=>e.a>=n&&e.a<s&&e.b>=n&&e.b<s).map(e=>({...e,a:e.a-n,b:e.b-n}));return(0,z.jsxs)(`div`,{className:`gd-row`,children:[(0,z.jsx)(`div`,{className:`gd-plank`,children:n===0&&(0,z.jsxs)(`h3`,{className:`gd-plate`,children:[e.name,` · `,_,` session`,_===1?``:`s`]})}),a.map(({s:e,worktree:n})=>(0,z.jsx)(X,{s:e,worktree:n,sakura:t,mine:r(P(e)),pad:P(e)===i.sid?i.pad:null,onHover:o},P(e))),(0,z.jsx)(se,{pairs:c,count:a.length}),m&&p>=n&&p<s&&(0,z.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:g?(0,z.jsx)(F,{pad:g}):(0,z.jsx)(Y,{s:m,t:h,mine:r(P(m))})})]},n)}),(0,z.jsx)(`span`,{className:`sr-only`,role:`status`,children:ae(g)})]})}var Q=e=>e.catch(()=>null);function ue({s:e}){let t=(0,R.useId)(),n=e.todos,r=v(e);return(0,z.jsxs)(`a`,{className:`card pad-md act-card`,href:e.href||I(e.session_id),"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,z.jsxs)(_,{s:e,id:t,heading:e.title||m(e.cwd)||e.session_id,children:[e.chip&&(0,z.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip}),(0,z.jsx)(o,{name:`chevron`,className:`glyph act-chev`})]}),n&&n.total>0&&(0,z.jsx)(`div`,{className:`act-foot`,children:(0,z.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,z.jsx)(s,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,z.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,h(e.updated_at),` ago`]})]})}var de={blocked:`is blocked`,"waiting-input":`waits for your answer`};function fe(e,t){if(!Array.isArray(t))return``;let n=t.filter(f),r=e.current;return e.current=new Set(n.map(e=>`${P(e)}:${e.status}`)),r?n.filter(e=>!r.has(`${P(e)}:${e.status}`)).map(e=>`${e.title||m(e.cwd)||e.session_id} ${de[e.status]}`).join(`. `):``}var pe=[[`all`,`All`],[`needs`,`Needs you`],[`runs`,`Runs`],[`gates`,`Gate asks`]];function me(){let e=new URLSearchParams(window.location.hash.split(`?`)[1]||``),t=e.get(`f`);return{f:pe.some(([e])=>e===t)?t:`all`,host:e.get(`host`)||``,project:e.get(`project`)||``,v:e.get(`v`)===`list`?`list`:`garden`}}function he(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 ge({enabled:e,installs:t,onToggle:n}){let r=k(t);return(0,z.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,z.jsx)(o,{name:`activity`,className:`glyph act-fixed`}),(0,z.jsxs)(`div`,{className:`act-grow`,children:[(0,z.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,z.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,z.jsxs)(`ul`,{className:`stack gap-8 act-fixed act-sm`,"aria-label":`Tracking per install`,children:[t.length===0&&(0,z.jsx)(`li`,{className:`dim`,children:`No active install to track.`}),t.map((e,t)=>(0,z.jsxs)(`li`,{className:`row gap-10`,children:[(0,z.jsxs)(`span`,{id:`act-track-l${t}`,title:e.path,children:[`Track live sessions in `,(0,z.jsx)(`span`,{className:`mono`,children:r.get(e.install)})]}),(0,z.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 _e({jobs:e,loading:t}){let n=typeof e?.cap==`number`?e.cap:void 0,r=p(e?.jobs,{days:14,cap:n}),i=l(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),u=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${g(e.key)}`).join(`, `)||`none`}.`+(c?s?` Days before ${g(s.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,z.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,z.jsxs)(`div`,{className:`act-stat-head`,children:[(0,z.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,z.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,z.jsx)(y,{label:`Reading the job log…`}):e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":u,ref:i,children:r.map(e=>e.nodata?(0,z.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,z.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${g(e.key)}: ${e.n}`},e.key):(0,z.jsx)(`i`,{className:`zero`},e.key))}),(0,z.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,z.jsx)(`span`,{children:g(r[0].key)}),(0,z.jsx)(`span`,{children:g(r[7].key)}),(0,z.jsx)(`span`,{children:`today`})]}),c&&(0,z.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,z.jsx)(`p`,{className:`dim act-sm`,children:`The job log could not be read.`})]})}function ve({rows:e,gates:t,loading:n}){let r=e.reduce((e,t)=>e+t.n,0);return(0,z.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,z.jsxs)(`div`,{className:`act-stat-head`,children:[(0,z.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,z.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,z.jsx)(y,{label:`Reading the gate ledger…`}):e.length?(0,z.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,z.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,z.jsx)(c,{vals:e.per_day,i:t,sweep:!0}),(0,z.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,z.jsx)(`p`,{className:`dim act-sm`,children:t?`No gate asked in 30 days.`:`The gate ledger could not be read.`})]})}var ye={done:[`ok`,`done`],failed:[`bad`,`failed`],running:[``,`running`]};function be({job:e,longest:t}){let n=d(e),r=e.duration?Math.round(e.duration*10)/10:0,[i,a]=ye[e.status]||[``,e.status||`…`],s=e.status===`running`?`Still running`:r?`Took ${r} second${r===1?``:`s`}`:`No duration`,c=e.started?new Date(e.started*1e3).toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`}):`—`;return(0,z.jsxs)(`li`,{className:`act-row`,children:[(0,z.jsx)(`span`,{className:`mono dim act-xs`,children:c}),(0,z.jsx)(o,{name:`play`,className:`glyph act-glyph`}),(0,z.jsxs)(`span`,{className:`act-what`,children:[(0,z.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,z.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,z.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":s,children:(0,z.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,z.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function xe({gate:e}){return(0,z.jsxs)(`li`,{className:`act-row gate`,children:[(0,z.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,z.jsx)(o,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,z.jsxs)(`span`,{className:`act-what`,children:[(0,z.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,z.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,z.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`badge warn`,children:`asked`})]})}var Se=5,$=(e,t)=>[...new Set([...e.filter(Boolean),t].filter(Boolean))];function Ce(){let[e,t]=(0,R.useState)(null),[n,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(me),[d,p]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),_=(0,R.useRef)(null),v=e=>{let t={...s,...e};c(t),he(t)};ie(e=>r.activity().then(n=>{if(e()){t(ee(n)),o(``);let e=fe(_,n?.activity);e&&g(t=>t===e?e+`\xA0`:e)}},t=>{e()&&o(t.message)}),2e3,[]);let b=a(()=>Q(r.jobs()),[]),S=a(()=>Q(r.gates()),[]),ae=a(()=>Q(r.catalog(`laws`)),[]),C=!e||e.enabled!==!1,w=Array.isArray(e?.installs)?e.installs:[],T=E(e?.activity,w).sort((e,t)=>e.session_id<t.session_id?-1:+(e.session_id>t.session_id)),D=oe(),O=C&&e?T.filter(f).length:null,k=new Set(T.map(P)),A=s.v===`list`?E(e?.ended,w).filter(e=>!k.has(P(e))):[],j=$([...T,...A].map(e=>e.host),s.host),M=$([...T,...A].map(e=>m(e.cwd)),s.project),N=s.host&&s.project?`host or project`:s.host?`host`:s.project?`project`:``,F=e=>(!s.host||e.host===s.host)&&(!s.project||m(e.cwd)===s.project),I=T.filter(e=>F(e)&&(s.f!==`needs`||f(e))),L=s.f===`all`||s.f===`needs`,B=s.f===`all`&&C?A.filter(F):[],V=d?B:B.slice(0,Se),H=!N&&(s.f===`all`||s.f===`runs`),U=!N&&(s.f===`all`||s.f===`gates`),W=b.data?.jobs||[],G=re(S.data,ae.data),K=i(W,G,S.data?.days).map(e=>({...e,runs:H?e.runs:[],gate:U?e.gate:null})).filter(e=>e.runs.length||e.gate),q=Math.max(0,...W.map(e=>e.duration||0)),J=l(K.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),Y=async e=>{let n=!e.enabled;try{let i=await r.activityToggle(n,{host:e.host,path:e.path});if(i.ok===!1){o(i.error||`Could not change tracking`);return}let a=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:a(t?.activity),ended:a(t?.ended)}}),o(``)}catch(e){o(e.message)}},X=(e,t,n)=>(0,z.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,z.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,z.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:s[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>v({[e]:t.target.value}),children:[(0,z.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]});return(0,z.jsxs)(`div`,{className:`page-fill`,children:[(0,z.jsx)(u,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,z.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:h}),n&&(0,z.jsx)(`div`,{className:`act-gap`,children:(0,z.jsx)(te,{error:n})}),e&&(0,z.jsx)(ge,{enabled:C,installs:w,onToggle:Y}),(0,z.jsxs)(`div`,{className:`act-today`,children:[(0,z.jsx)(_e,{jobs:b.data,loading:b.loading}),(0,z.jsx)(ve,{rows:G,gates:S.data,loading:S.loading}),(0,z.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,z.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),!e&&!n?(0,z.jsx)(y,{}):e?(0,z.jsxs)(z.Fragment,{children:[C?(0,z.jsxs)(`span`,{className:`act-big act-wait`,children:[O,` `,(0,z.jsx)(`span`,{className:`dim act-sm`,children:O===1?`session`:`sessions`})]}):null,(0,z.jsx)(`p`,{className:`dim act-sm`,children:C?`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,z.jsx)(`p`,{className:`dim act-sm`,children:`The sessions could not be read.`})]})]}),(0,z.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,z.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:pe.map(([e,t])=>(0,z.jsxs)(`button`,{type:`button`,className:s.f===e?`chip-f on`:`chip-f`,"aria-pressed":s.f===e,onClick:()=>v({f:e}),children:[t,e===`needs`&&O>0?(0,z.jsxs)(`span`,{className:`mono`,children:[` `,O]}):null]},e))}),X(`host`,`Host`,j),X(`project`,`Project`,M),(0,z.jsx)(ne,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,z.jsx)(`button`,{type:`button`,className:s.v===e?`on`:``,"aria-pressed":s.v===e,onClick:()=>v({v:e}),children:t},e))})]}),N&&s.f!==`needs`&&(0,z.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,N,`; showing sessions only.`]}),L&&(e?!C&&s.f!==`needs`?null:I.length===0?s.f===`needs`?(0,z.jsx)(x,{title:`Nothing waits on you`}):(0,z.jsx)(x,{title:`No active sessions`,children:`Start an agent session and it appears here.`}):s.v===`garden`?(0,z.jsx)(ce,{sessions:I,collisions:e.collisions}):(0,z.jsx)(`div`,{className:`stack gap-12 act-live`,ref:D,children:I.map(e=>(0,z.jsx)(`div`,{"data-flip":P(e),children:(0,z.jsx)(ue,{s:e})},P(e)))}):(0,z.jsx)(y,{label:`Reading live sessions…`})),B.length>0&&(0,z.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,z.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),V.map(e=>(0,z.jsx)(`div`,{children:(0,z.jsx)(ue,{s:e})},P(e))),B.length>Se&&(0,z.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":d,onClick:()=>p(e=>!e),children:d?`Show fewer`:`Show all ${B.length}`})]}),s.f!==`needs`&&(0,z.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:J,children:K.map(e=>(0,z.jsxs)(`section`,{className:`card act-day`,children:[(0,z.jsxs)(`h3`,{className:`act-day-h`,children:[(0,z.jsx)(`span`,{children:e.title}),(0,z.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,z.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,z.jsx)(be,{job:e,longest:q},e.id)),e.gate&&(0,z.jsx)(xe,{gate:e.gate})]})]},e.key))})]})}export{Ce as default};
|
|
@@ -1 +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-C8nMUU1i.js";import{Ct as i,H as a,M as o,O as s,Ot as c,T as l,bt as u,et as d,k as f,tt as p,xt as m}from"./index-
|
|
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-C8nMUU1i.js";import{Ct as i,H as a,M as o,O as s,Ot as c,T as l,bt as u,et as d,k as f,tt as p,xt as m}from"./index-BiKWWv7Z.js";import{a as h,d as g,f as _,i as v,l as y,o as b,r as x,t as S,v as C}from"./Bonsai-BCd-qt7W.js";import{t as w}from"./EmptyState-CY5Pm2xy.js";var T=e(t(),1),E=n();function D(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 O({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(`${f(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,E.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,E.jsx)(`span`,{className:`badge act-who ${t?``:`acc`}`,children:t?`you`:`agent`}),(0,E.jsxs)(`div`,{className:`act-grow act-sm`,children:[!t&&(0,E.jsx)(`span`,{className:`feed-dot act-inline-dot ${D(e)||`acc`}`}),e.kind===`thinking`&&(0,E.jsx)(`span`,{className:`dim`,children:`thinking: `}),r?(0,E.jsx)(`span`,{className:`dim`,children:i}):t?i:(0,E.jsx)(`b`,{children:i}),e.error&&(0,E.jsxs)(`span`,{className:`dim`,children:[`: `,e.error]})]}),n.length>0&&(0,E.jsx)(`span`,{className:`dim mono act-xs act-fixed`,children:n.join(` · `)}),e.t?(0,E.jsx)(`time`,{className:`mono dim act-xs act-fixed`,dateTime:new Date(e.t).toISOString(),title:`${c(e.t/1e3)} ago`,children:new Date(e.t).toTimeString().slice(0,8)}):null]})}function k({turns:e}){return!e||e.length===0?(0,E.jsx)(`div`,{className:`dim act-sm`,children:`No conversation captured yet.`}):(0,E.jsx)(`div`,{className:`stack gap-12`,children:e.map((e,t)=>{let n=e.role===`user`;return(0,E.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,E.jsx)(`span`,{className:`badge act-who ${n?``:`acc`}`,children:n?`you`:`agent`}),(0,E.jsx)(`div`,{className:`act-min act-sm${n?``:` muted`}`,children:e.text})]},t)})})}var A=5;function j({s:e}){let[t]=(0,T.useState)(b),[n,r]=(0,T.useState)(null),i=!!e.ended,a=i?{...e,status:o(e)?`busy`:e.status,error:null}:e,s=C(a,t),c=(0,T.useMemo)(()=>_(a,{sakura:t}),[s]),l=(0,T.useCallback)(e=>r(e),[]),u=y(e),d=Number(e.turns)||0,f=Number(e.compactions)||0,p=[`${d} turn${d===1?``:`s`}`,`context ${u==null?`unknown`:`${Math.round(u*100)} %`}`,`${f} compaction${f===1?``:`s`}`,`sub-agents: ${c.pads.filter(e=>e.key!=null).length} ${i?`unfinished`:`running`}, ${c.fallen.length} finished`].join(` · `),m=n==null?null:c.pads[n];return(0,E.jsxs)(`div`,{className:`card pad-md act-mt gd-detail${!i&&o(e)?` gd-needs`:``}`,children:[(0,E.jsx)(`div`,{role:`group`,tabIndex:0,"aria-label":`Bonsai pads, arrow keys walk them`,onKeyDown:e=>v(e,c.pads.length,n,l),children:(0,E.jsx)(x,{t:c,pad:n,swaying:!i&&e.status!==`idle`,onPad:l,px:A,label:`Bonsai of this session${i?`, ended`:``}: ${p}`})}),(0,E.jsxs)(`div`,{className:`stack gap-8 act-min`,children:[i&&(0,E.jsx)(`span`,{className:`dim act-xs`,children:`ended`}),(0,E.jsx)(`div`,{className:`dim act-sm`,children:p}),(0,E.jsx)(`span`,{className:`sr-only`,role:`status`,children:h(m)}),m?(0,E.jsx)(S,{pad:m}):(0,E.jsx)(`div`,{className:`dim act-xs`,children:`Hover or tap a pad, or use the arrow keys, for its files.`})]})]})}function M({sid:e}){let{sid:t,install:n}=g(e,window.location.hash),[o,f]=(0,T.useState)(null),[h,_]=(0,T.useState)(``),[v,y]=(0,T.useState)(!1),[b,x]=(0,T.useState)(!1),S=(0,T.useId)();m(e=>v?void 0:r.activityDetail(t,n).then(t=>{e()&&(f(u(t)),_(``),y(!1))},t=>{e()&&(t.status===404?y(!0):_(t.message))}),2e3,[t,v]);let C=(0,E.jsxs)(`a`,{className:`btn ghost sm act-back`,href:`#/activity`,children:[(0,E.jsx)(i,{name:`arrow`}),` Activity`]});if(v)return(0,E.jsxs)(`div`,{className:`page-fill`,children:[C,(0,E.jsx)(w,{title:`Session ended`,action:(0,E.jsx)(`a`,{href:`#/activity`,children:`Back to Activity`}),children:`It's no longer live.`})]});if(!o)return(0,E.jsxs)(`div`,{className:`page-fill`,children:[C,h?(0,E.jsx)(d,{error:h}):(0,E.jsx)(p,{label:`Loading session…`})]});let D=o.session,A=D.files,M=D.todos,N=!!(A&&A.items&&A.items.length>0),P=!!(M&&M.items&&M.items.length>0),F=o.conversation||[],I=o.timeline||[],L=[...F.filter(e=>e.role===`user`).map(e=>({who:`you`,text:e.text,t:e.t||0})),...I.map(e=>({...e,who:`agent`}))].sort((e,t)=>(e.t||0)-(t.t||0));return(0,E.jsxs)(`div`,{className:`page-fill`,children:[C,(0,E.jsx)(a,{title:D.title||s(D.cwd)||D.session_id,sub:D.cwd?(0,E.jsx)(`span`,{className:`mono act-cwd`,title:D.cwd,children:D.cwd}):null}),h&&(0,E.jsx)(`div`,{className:`act-gap`,children:(0,E.jsx)(d,{error:h})}),(0,E.jsxs)(`div`,{className:`card pad-md`,children:[(0,E.jsx)(l,{s:D}),(0,E.jsxs)(`div`,{className:`dim act-updated`,children:[`updated `,c(D.updated_at),` ago`]})]}),(0,E.jsx)(j,{s:D}),(N||P)&&(0,E.jsxs)(`div`,{className:`grid gap-12 act-panels${N&&P?` two`:``}`,children:[N&&(0,E.jsxs)(`div`,{className:`card pad-md`,children:[(0,E.jsx)(`div`,{className:`card-head`,children:(0,E.jsxs)(`h2`,{children:[`Files touched `,(0,E.jsxs)(`span`,{className:`dim`,children:[`(`,A.count,`)`]})]})}),(0,E.jsx)(`div`,{className:`stack act-list`,children:A.items.map(e=>(0,E.jsxs)(`div`,{className:`row between gap-12 act-sm`,children:[(0,E.jsx)(`span`,{className:`mono act-ell act-grow`,title:e.file,children:e.file}),(0,E.jsxs)(`span`,{className:`act-fixed`,children:[(0,E.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions]}),` `,(0,E.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions]})]})]},e.file))})]}),P&&(0,E.jsxs)(`div`,{className:`card pad-md`,children:[(0,E.jsx)(`div`,{className:`card-head`,children:(0,E.jsxs)(`h2`,{children:[`Plan`,` `,(0,E.jsxs)(`span`,{className:`dim`,children:[`(`,M.done,`/`,M.total,`)`]})]})}),(0,E.jsx)(`div`,{className:`stack act-list`,children:M.items.map((e,t)=>(0,E.jsxs)(`div`,{className:`row gap-8 act-sm`,children:[(0,E.jsx)(`span`,{className:`feed-dot ${e.status===`completed`?`ok`:e.status===`in_progress`?`acc`:``}`}),(0,E.jsx)(`span`,{className:e.status===`completed`?`act-done`:void 0,children:e.content})]},t))})]})]}),(0,E.jsxs)(`div`,{className:`card pad-md act-mt`,children:[(0,E.jsxs)(`div`,{className:`card-head act-tl-head`,children:[(0,E.jsx)(`h2`,{children:`Timeline`}),I.length>0&&(0,E.jsx)(`button`,{className:`btn ghost sm`,"aria-expanded":b,"aria-controls":S,onClick:()=>x(e=>!e),children:b?`Show conversation`:`Show full stream (${L.length})`})]}),(0,E.jsx)(`div`,{id:S,children:b?(0,E.jsx)(`div`,{className:`stack gap-12`,children:L.map((e,t)=>(0,E.jsx)(O,{rec:e},t))}):(0,E.jsx)(k,{turns:F})})]})]})}export{j as SessionTree,M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{pt as r}from"./index-BILaKHbH.js";var i=e(t(),1),a=e=>{let t=2166136261;for(let n of String(e))t=Math.imul(t^n.charCodeAt(0),16777619);return t>>>0},o=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},s=e=>Math.max(0,Math.min(1,e)),c={claude:[`#8E4A33`,`#C46A4C`,`#E3906F`],bob:[`#173F8C`,`#2A5CC0`,`#6A96E8`],opencode:[`#5E6670`,`#98A2AD`,`#C8D0D8`],openclaude:[`#2F1F55`,`#4E3484`,`#8A6CC8`]},l={live:[`#16393D`,`#1F5A55`,`#2C7D55`,`#5DA845`,`#A8D23E`],sakura:[`#16393D`,`#6E2A55`,`#B83C80`,`#E9649F`,`#FFB0D2`],done:[`#5A2E14`,`#8A4A1C`,`#B8702A`,`#DB9A3E`,`#F2C46A`],idle:[`#2E3236`,`#44494E`,`#5E646A`,`#7C8288`,`#A2A7AC`]},u={developer:[`#123A3F`,`#1A5A5E`,`#24806F`,`#3FB08A`,`#8EE6C2`],explorer:[`#2C3A12`,`#4A6418`,`#6E9424`,`#9CC23A`,`#DDF07A`],reviewer:[`#16283F`,`#1F3E66`,`#2E5E92`,`#4A86C4`,`#9AC8F0`],tester:[`#3A3012`,`#5E4C18`,`#8A6E22`,`#B8952E`,`#EAD27A`]},d=[`#4E2E1C`,`#7A4A2E`,`#A2683F`,`#C78A5A`],f=[`#34312F`,`#4F4A46`,`#6B6560`,`#8A847E`],p=[`#3E8E41`,`#5FB14F`],m=[`#4A4F54`,`#62686E`],h=`#FFF6E0`,g=[`#E3C24A`,`#C9A23A`],_=[`#9BDD6A`,`#D8F59A`],v={"!":`#E8B04A`,x:`#FF6F69`},y=12;function b(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 x=e=>e?.status===`blocked`||e?.status===`waiting-input`;function S(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 C=e=>e==null||e===``?NaN:Number(e);function w(e){let t=C(e?.context?.used),n=C(e?.context?.window);return Number.isFinite(t)&&Number.isFinite(n)&&n>0?s(t/n):null}function T(e){let t=S(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 o=w(e),l=o!=null,u=l?C(e.context.used):NaN,d=l?o:.5,f=Math.max(0,Math.floor(Number(e.compactions)||0)),p=C(e.context_at_compaction),m=f===0?1:l&&Number.isFinite(p)&&p>0?s(u/p):0;return{id:String(e.session_id??``),host:c[e.host]?e.host:`claude`,idle:e.status===`idle`,bubble:x(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 E(e,t=!1){let n=T(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 D(e,{sakura:t=!1}={}){let n=T(e),{id:r,idle:i}=n,s=Math.min(1,Math.log1p(n.turns)/Math.log1p(40)),x=.55+.45*s,S=o(a(r)),C=Array.from({length:56},()=>Array(56).fill(null)),w=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,w[t][e]=E)},O=i?f:d,k=i?m:p,A=i?l.idle:t?l.sakura:l.live,j=Math.round(41-(9+18*s)),M=1+S()*2+3*s,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*s-(1.5+3.5*s)*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,i,s,c)=>{n*=1.15,e=Math.max(n+2,Math.min(53-n,e));let l=o(a(`${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 a=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 o=Math.floor(e-r);o<=e+r;o++){if(((o-e)**2+(t-n)**2)/(r*r)>1+(l()-.5)*.5)continue;let s=o-e+(t-n)<-r*.3?1:t-n>r*.5?-1:0;D(o,t,i[Math.max(0,Math.min(4,a+s))])}}let p=o(a(`${r}:bloom:${c}`));for(let r=0;r<Math.min(s,y);r++)D(e+(p()*2-1)*n*.8,t-p()*u*.9,h);return{rx:n,cy:t}},R=o(a(`${r}:side`))()<.5?-1:1,z=[];n.agents.forEach((e,t)=>{let c=.25+.55*(t/Math.max(1,n.agents.length-1)),l=Math.round(41-c*(41-j)),d=F(c);if(!e.running){let t=(3+4.5*s-(1.5+3.5*s)*c)/2;E=-1,D(d+R*(t+1),l,O[3]),D(d+R*(t+2),l-1,O[2]),z.push({agentId:e.id,type:e.type,files:e.files}),R=-R;return}let f=Math.round((12+Math.floor(o(a(`${r}:branch:${e.key}`))()*4))*x);E=-1;for(let e=0;e<=f;e++){let t=d+R*e,n=l-e*.45;D(t,n,O[e<f/2?1:2]),D(t,n+1,O[0]),e<f*.6&&D(t,n+2,O[0])}let p=i?null:b(e.type),m=p?u[p]:A;E=I.length,I.push({agentId:e.id,key:e.key,type:e.type,family:p,files:e.files,bbox:null}),L(d+R*f,l-f*.45-2,(8+Math.min(e.files.length,6)*.6)*x,m,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=o(a(`${r}:yellow`));for(let t=0;t<56;t++)for(let n=0;n<56;n++)w[t][n]===B&&C[t][n]!==h&&t<U-H*.2&&e()<.55&&(C[t][n]=e()<.5?g[0]:g[1])}if(n.compacted){let e=o(a(`${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++)w[e][t]===B&&(C[e][t]=null,w[e][t]=-1);if(t>=0&&t<56)for(let r=0;r<56;r++){if(w[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?_[1]:_[0])}}E=-1;let W=o(a(`${r}:fallen`));z.forEach((e,t)=>D(16+(t*7+Math.floor(W()*4))%24,40,l.done[2+t%2]));for(let e=0;e<Math.min(n.compactions,6);e++)D(15+e*2,42,h);let[G,K,q]=c[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]===h)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=o(a(`${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=v[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=w[e][t];if(!n){t++;continue}let i=t;for(;i+1<56&&C[e][i+1]===n&&w[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 O=e=>{if(!e)return``;let t=String(e).replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||String(e)},k=e=>e?String(e).replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase():``;function A(e){let t=new Map;for(let n of e||[]){let e=n.repo||n.root,r=n.repo_key||(e?k(e):n.cwd?`cwd:${k(n.cwd)}`:`outside a repo`),i=O(e||n.cwd)||`outside a repo`;t.has(r)||t.set(r,{key:r,name:i,trees:[]});let a=n.root&&e&&k(n.root)!==k(e)?O(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 j=e=>e.key??(e.install?`${e.install}\0${e.session_id}`:String(e.session_id)),M=e=>j({key:e.key??void 0,install:e.install,session_id:e.sid}),N=(e,t)=>String(e).split(/[\\/]+/).filter(Boolean).slice(-t).join(`/`),P=e=>r(e.host).label;function F(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?P(e):i(e)<2||e.scope===`global`?`${P(e)} · ${e.scope}`:`${P(e)} · ${O(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,`${P(n)} · ${e>t?n.path:N(n.path,e)}`)}if(e>64)break}return a}var I=(e,t)=>`#/activity/${encodeURIComponent(e)}`+(t?`?${new URLSearchParams({host:t.host,path:t.path})}`:``);function L(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 R(e,t){let n=new Map((t||[]).map(e=>[e.install,e])),i=F(t);return(e||[]).map(e=>{let t=n.get(e.install);return{...e,host:t?.host??e.host,chip:i.get(e.install)??(e.host?r(e.host).label:null),href:I(e.session_id,t)}})}var z=(e,t)=>new Set((e.writers||[]).filter(e=>M(e)===t).map(e=>k(e.root)));function B(e,t,n){let r=z(e,t);for(let t of z(e,n))if(r.has(t))return`same-worktree`;return`cross-worktree`}var V=e=>[...new Set((e.writers||[]).map(M))];function H(e,t){let n=new Map(e.map((e,t)=>[j(e.s),t])),r=new Map;for(let e of t||[]){let t=V(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=B(e,t[i],t[a]);r.has(c)&&l!==`same-worktree`||r.set(c,{a:o,b:s,kind:l})}}return[...r.values()]}function U(e,t){let n=[];for(let r of t||[]){let t=V(r).filter(t=>t!==e);if(!t.length||!V(r).includes(e))continue;let i=t.some(t=>B(r,e,t)===`same-worktree`);n.push({path:r.path,kind:i?`same-worktree`:`cross-worktree`})}return n}var W=e=>e?.status===`busy`||x(e);function G(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=>W(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 K=n(),q=12,J=10,Y=`geneseed-garden-sakura`;function X(){try{return window.localStorage.getItem(Y)===`1`}catch{return!1}}var Z=e=>e.key==null?`the session`:e.type||`agent`,Q=e=>e.path||e.file||`?`;function $({pad:e}){let t=e.files.slice(0,q);return(0,K.jsxs)(`div`,{className:`card gd-card`,children:[(0,K.jsxs)(`div`,{className:`act-lbl`,children:[Z(e),` · `,e.files.length,` file`,e.files.length===1?``:`s`]}),(0,K.jsx)(`ul`,{className:`gd-files`,children:t.map((e,t)=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mono act-ell`,children:Q(e)}),(0,K.jsxs)(`span`,{className:`mono act-xs`,children:[(0,K.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions??0]}),` `,(0,K.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions??0]})]})]},`${Q(e)}:${t}`))}),e.files.length>t.length&&(0,K.jsxs)(`div`,{className:`dim act-xs`,children:[`+`,e.files.length-t.length,` more`]})]})}var ee=e=>e?`${Z(e)}: ${e.files.length} file${e.files.length===1?``:`s`}`:``;function te(e,t,n,r){let i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];e.key===`Escape`&&n!=null&&r(null),i&&t&&(e.preventDefault(),r(n==null?i>0?0:t-1:(n+i+t)%t))}var ne=(0,i.memo)(function({t:e,pad:t,swaying:n,onPad:r,px:a,label:o}){let s=(0,i.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]),c=(0,i.useRef)(null),l=e=>{let[t,n]=[c.current,e.changedTouches?.[0]];return!!t&&!!n&&Math.hypot(n.clientX-t.x,n.clientY-t.y)>J};return(0,K.jsx)(`svg`,{onTouchStart:e=>{let t=e.touches?.[0];c.current=t?{x:t.clientX,y:t.clientY}:null},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(([i,a])=>(0,K.jsx)(`g`,{"data-p":i,className:[i===t&&`gd-hot`,n&&i>=0&&e.pads[i].key!=null&&`gd-sway`].filter(Boolean).join(` `)||void 0,onMouseEnter:i>=0?()=>r(i):void 0,onMouseLeave:i>=0?()=>r(null):void 0,onTouchEnd:i>=0?e=>{l(e)||(e.cancelable&&e.preventDefault(),r(i===t?null:i))}:void 0,children:a.map(e=>(0,K.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:1,fill:e.c},`${e.x},${e.y}`))},i))})});export{H as _,ee as a,G as c,L as d,D as f,U as g,R as h,te as i,w as l,F as m,Y as n,X as o,A as p,ne as r,j as s,$ as t,I as u,E as v};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{pt as r}from"./index-BiKWWv7Z.js";var i=e(t(),1),a=e=>{let t=2166136261;for(let n of String(e))t=Math.imul(t^n.charCodeAt(0),16777619);return t>>>0},o=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},s=e=>Math.max(0,Math.min(1,e)),c={claude:[`#8E4A33`,`#C46A4C`,`#E3906F`],bob:[`#173F8C`,`#2A5CC0`,`#6A96E8`],opencode:[`#5E6670`,`#98A2AD`,`#C8D0D8`],openclaude:[`#2F1F55`,`#4E3484`,`#8A6CC8`]},l={live:[`#16393D`,`#1F5A55`,`#2C7D55`,`#5DA845`,`#A8D23E`],sakura:[`#16393D`,`#6E2A55`,`#B83C80`,`#E9649F`,`#FFB0D2`],done:[`#5A2E14`,`#8A4A1C`,`#B8702A`,`#DB9A3E`,`#F2C46A`],idle:[`#2E3236`,`#44494E`,`#5E646A`,`#7C8288`,`#A2A7AC`]},u={developer:[`#123A3F`,`#1A5A5E`,`#24806F`,`#3FB08A`,`#8EE6C2`],explorer:[`#2C3A12`,`#4A6418`,`#6E9424`,`#9CC23A`,`#DDF07A`],reviewer:[`#16283F`,`#1F3E66`,`#2E5E92`,`#4A86C4`,`#9AC8F0`],tester:[`#3A3012`,`#5E4C18`,`#8A6E22`,`#B8952E`,`#EAD27A`]},d=[`#4E2E1C`,`#7A4A2E`,`#A2683F`,`#C78A5A`],f=[`#34312F`,`#4F4A46`,`#6B6560`,`#8A847E`],p=[`#3E8E41`,`#5FB14F`],m=[`#4A4F54`,`#62686E`],h=`#FFF6E0`,g=[`#E3C24A`,`#C9A23A`],_=[`#9BDD6A`,`#D8F59A`],v={"!":`#E8B04A`,x:`#FF6F69`},y=12;function b(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 x=e=>e?.status===`blocked`||e?.status===`waiting-input`;function S(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 C=e=>e==null||e===``?NaN:Number(e);function w(e){let t=C(e?.context?.used),n=C(e?.context?.window);return Number.isFinite(t)&&Number.isFinite(n)&&n>0?s(t/n):null}function T(e){let t=S(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 o=w(e),l=o!=null,u=l?C(e.context.used):NaN,d=l?o:.5,f=Math.max(0,Math.floor(Number(e.compactions)||0)),p=C(e.context_at_compaction),m=f===0?1:l&&Number.isFinite(p)&&p>0?s(u/p):0;return{id:String(e.session_id??``),host:c[e.host]?e.host:`claude`,idle:e.status===`idle`,bubble:x(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 E(e,t=!1){let n=T(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 D(e,{sakura:t=!1}={}){let n=T(e),{id:r,idle:i}=n,s=Math.min(1,Math.log1p(n.turns)/Math.log1p(40)),x=.55+.45*s,S=o(a(r)),C=Array.from({length:56},()=>Array(56).fill(null)),w=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,w[t][e]=E)},O=i?f:d,k=i?m:p,A=i?l.idle:t?l.sakura:l.live,j=Math.round(41-(9+18*s)),M=1+S()*2+3*s,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*s-(1.5+3.5*s)*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,i,s,c)=>{n*=1.15,e=Math.max(n+2,Math.min(53-n,e));let l=o(a(`${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 a=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 o=Math.floor(e-r);o<=e+r;o++){if(((o-e)**2+(t-n)**2)/(r*r)>1+(l()-.5)*.5)continue;let s=o-e+(t-n)<-r*.3?1:t-n>r*.5?-1:0;D(o,t,i[Math.max(0,Math.min(4,a+s))])}}let p=o(a(`${r}:bloom:${c}`));for(let r=0;r<Math.min(s,y);r++)D(e+(p()*2-1)*n*.8,t-p()*u*.9,h);return{rx:n,cy:t}},R=o(a(`${r}:side`))()<.5?-1:1,z=[];n.agents.forEach((e,t)=>{let c=.25+.55*(t/Math.max(1,n.agents.length-1)),l=Math.round(41-c*(41-j)),d=F(c);if(!e.running){let t=(3+4.5*s-(1.5+3.5*s)*c)/2;E=-1,D(d+R*(t+1),l,O[3]),D(d+R*(t+2),l-1,O[2]),z.push({agentId:e.id,type:e.type,files:e.files}),R=-R;return}let f=Math.round((12+Math.floor(o(a(`${r}:branch:${e.key}`))()*4))*x);E=-1;for(let e=0;e<=f;e++){let t=d+R*e,n=l-e*.45;D(t,n,O[e<f/2?1:2]),D(t,n+1,O[0]),e<f*.6&&D(t,n+2,O[0])}let p=i?null:b(e.type),m=p?u[p]:A;E=I.length,I.push({agentId:e.id,key:e.key,type:e.type,family:p,files:e.files,bbox:null}),L(d+R*f,l-f*.45-2,(8+Math.min(e.files.length,6)*.6)*x,m,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=o(a(`${r}:yellow`));for(let t=0;t<56;t++)for(let n=0;n<56;n++)w[t][n]===B&&C[t][n]!==h&&t<U-H*.2&&e()<.55&&(C[t][n]=e()<.5?g[0]:g[1])}if(n.compacted){let e=o(a(`${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++)w[e][t]===B&&(C[e][t]=null,w[e][t]=-1);if(t>=0&&t<56)for(let r=0;r<56;r++){if(w[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?_[1]:_[0])}}E=-1;let W=o(a(`${r}:fallen`));z.forEach((e,t)=>D(16+(t*7+Math.floor(W()*4))%24,40,l.done[2+t%2]));for(let e=0;e<Math.min(n.compactions,6);e++)D(15+e*2,42,h);let[G,K,q]=c[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]===h)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=o(a(`${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=v[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=w[e][t];if(!n){t++;continue}let i=t;for(;i+1<56&&C[e][i+1]===n&&w[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 O=e=>{if(!e)return``;let t=String(e).replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||String(e)},k=e=>e?String(e).replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase():``;function A(e){let t=new Map;for(let n of e||[]){let e=n.repo||n.root,r=n.repo_key||(e?k(e):n.cwd?`cwd:${k(n.cwd)}`:`outside a repo`),i=O(e||n.cwd)||`outside a repo`;t.has(r)||t.set(r,{key:r,name:i,trees:[]});let a=n.root&&e&&k(n.root)!==k(e)?O(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 j=e=>e.key??(e.install?`${e.install}\0${e.session_id}`:String(e.session_id)),M=e=>j({key:e.key??void 0,install:e.install,session_id:e.sid}),N=(e,t)=>String(e).split(/[\\/]+/).filter(Boolean).slice(-t).join(`/`),P=e=>r(e.host).label;function F(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?P(e):i(e)<2||e.scope===`global`?`${P(e)} · ${e.scope}`:`${P(e)} · ${O(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,`${P(n)} · ${e>t?n.path:N(n.path,e)}`)}if(e>64)break}return a}var I=(e,t)=>`#/activity/${encodeURIComponent(e)}`+(t?`?${new URLSearchParams({host:t.host,path:t.path})}`:``);function L(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 R(e,t){let n=new Map((t||[]).map(e=>[e.install,e])),i=F(t);return(e||[]).map(e=>{let t=n.get(e.install);return{...e,host:t?.host??e.host,chip:i.get(e.install)??(e.host?r(e.host).label:null),href:I(e.session_id,t)}})}var z=(e,t)=>new Set((e.writers||[]).filter(e=>M(e)===t).map(e=>k(e.root)));function B(e,t,n){let r=z(e,t);for(let t of z(e,n))if(r.has(t))return`same-worktree`;return`cross-worktree`}var V=e=>[...new Set((e.writers||[]).map(M))];function H(e,t){let n=new Map(e.map((e,t)=>[j(e.s),t])),r=new Map;for(let e of t||[]){let t=V(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=B(e,t[i],t[a]);r.has(c)&&l!==`same-worktree`||r.set(c,{a:o,b:s,kind:l})}}return[...r.values()]}function U(e,t){let n=[];for(let r of t||[]){let t=V(r).filter(t=>t!==e);if(!t.length||!V(r).includes(e))continue;let i=t.some(t=>B(r,e,t)===`same-worktree`);n.push({path:r.path,kind:i?`same-worktree`:`cross-worktree`})}return n}var W=e=>e?.status===`busy`||x(e);function G(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=>W(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 K=n(),q=12,J=10,Y=`geneseed-garden-sakura`;function X(){try{return window.localStorage.getItem(Y)===`1`}catch{return!1}}var Z=e=>e.key==null?`the session`:e.type||`agent`,Q=e=>e.path||e.file||`?`;function $({pad:e}){let t=e.files.slice(0,q);return(0,K.jsxs)(`div`,{className:`card gd-card`,children:[(0,K.jsxs)(`div`,{className:`act-lbl`,children:[Z(e),` · `,e.files.length,` file`,e.files.length===1?``:`s`]}),(0,K.jsx)(`ul`,{className:`gd-files`,children:t.map((e,t)=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mono act-ell`,children:Q(e)}),(0,K.jsxs)(`span`,{className:`mono act-xs`,children:[(0,K.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions??0]}),` `,(0,K.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions??0]})]})]},`${Q(e)}:${t}`))}),e.files.length>t.length&&(0,K.jsxs)(`div`,{className:`dim act-xs`,children:[`+`,e.files.length-t.length,` more`]})]})}var ee=e=>e?`${Z(e)}: ${e.files.length} file${e.files.length===1?``:`s`}`:``;function te(e,t,n,r){let i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];e.key===`Escape`&&n!=null&&r(null),i&&t&&(e.preventDefault(),r(n==null?i>0?0:t-1:(n+i+t)%t))}var ne=(0,i.memo)(function({t:e,pad:t,swaying:n,onPad:r,px:a,label:o}){let s=(0,i.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]),c=(0,i.useRef)(null),l=e=>{let[t,n]=[c.current,e.changedTouches?.[0]];return!!t&&!!n&&Math.hypot(n.clientX-t.x,n.clientY-t.y)>J};return(0,K.jsx)(`svg`,{onTouchStart:e=>{let t=e.touches?.[0];c.current=t?{x:t.clientX,y:t.clientY}:null},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(([i,a])=>(0,K.jsx)(`g`,{"data-p":i,className:[i===t&&`gd-hot`,n&&i>=0&&e.pads[i].key!=null&&`gd-sway`].filter(Boolean).join(` `)||void 0,onMouseEnter:i>=0?()=>r(i):void 0,onMouseLeave:i>=0?()=>r(null):void 0,onTouchEnd:i>=0?e=>{l(e)||(e.cancelable&&e.preventDefault(),r(i===t?null:i))}:void 0,children:a.map(e=>(0,K.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:1,fill:e.c},`${e.x},${e.y}`))},i))})});export{H as _,ee as a,G as c,L as d,D as f,U as g,R as h,te as i,w as l,F as m,Y as n,X as o,A as p,ne as r,j as s,$ as t,I as u,E as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{Ct as r}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{Ct as r}from"./index-BiKWWv7Z.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};
|