geneseed 5.0.4 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/SHIPPED.md +1 -1
- package/docs/concepts/exclusions.md +1 -1
- package/docs/concepts/factories.md +67 -15
- package/docs/concepts/loop-gates.md +5 -2
- package/docs/concepts/shared-tier.md +14 -0
- package/docs/extending.md +1 -1
- package/docs/guides/migrate.md +1 -1
- package/docs/guides/run-a-factory.md +41 -13
- package/docs/guides/upgrade-to-5.md +2 -2
- package/docs/reference/factory-actions.md +7 -7
- package/docs/web-ui.md +18 -6
- package/harness.config.json +1 -1
- package/js/README.md +2 -1
- package/js/build/args.mjs +34 -14
- package/js/build/emit-claude.mjs +3 -0
- package/js/build/emit-opencode.mjs +4 -0
- package/js/build/retired-skills.mjs +158 -0
- package/js/build/source.mjs +31 -11
- package/js/cli-table.json +29 -3
- package/js/factory/cli.mjs +49 -8
- package/js/factory/graph.mjs +72 -8
- package/js/factory/state.mjs +109 -27
- package/js/hosts/done-checks.mjs +3 -2
- package/js/hosts/memory-files.mjs +4 -2
- package/js/loop/catalog.mjs +16 -10
- package/js/loop/cli.mjs +16 -10
- package/js/maintain/migrate.mjs +39 -25
- package/js/web/daemon.mjs +69 -14
- package/js/web/handler.mjs +22 -9
- package/package.json +1 -1
- package/src/bricks/checks.md +62 -0
- package/src/bricks/intake.md +15 -6
- package/src/bricks/merge-gate.md +17 -8
- package/src/bricks/retro.md +8 -3
- package/src/bricks/review-panel.md +43 -0
- package/src/bricks/spec.md +20 -6
- package/src/factories/analysis-to-build.json +25 -7
- package/src/factories/bug-report-to-fix.json +25 -7
- package/src/factories/issue-to-pr.json +29 -11
- package/src/skills/factory-forge.md +23 -5
- package/src/skills/factory.md +95 -25
- package/src/skills/loop.md +3 -2
- package/themes/_TEMPLATE.json +1 -1
- package/web/dist/assets/{Activity-BaoxwVFH.js → Activity-CpkBwpu7.js} +1 -1
- package/web/dist/assets/{ActivityDetail-C_bFD0rW.js → ActivityDetail-DTPziZWM.js} +1 -1
- package/web/dist/assets/{Bonsai-B01lLf0m.js → Bonsai-hiG_gGNU.js} +1 -1
- package/web/dist/assets/{CopyButton-Bc66KPyA.js → CopyButton-DUIUfNp6.js} +1 -1
- package/web/dist/assets/{Dashboard-X7GZzGJp.js → Dashboard-Dnw6EyX7.js} +2 -2
- package/web/dist/assets/{Docs-LRYVnGLG.js → Docs-BEET_l16.js} +1 -1
- package/web/dist/assets/Factories-D6KXkfWw.js +1 -0
- package/web/dist/assets/{GreenhouseView-CfWR2-sX.js → GreenhouseView-BKxy5apE.js} +1 -1
- package/web/dist/assets/{Installs-nfFHnovH.js → Installs-CnFVlVD0.js} +1 -1
- package/web/dist/assets/{JournalView-lpOHcHKK.js → JournalView-ChFitHjo.js} +1 -1
- package/web/dist/assets/{Kits-Bw5EQl_i.js → Kits-CcR-OlwQ.js} +1 -1
- package/web/dist/assets/{Laws-CnZJ0wjZ.js → Laws-B1s5idOg.js} +1 -1
- package/web/dist/assets/LibRows-BZgdbI1l.js +1 -0
- package/web/dist/assets/Library-x6TkkEVF.js +3 -0
- package/web/dist/assets/{Loops-ZaHC5MVl.js → Loops-BH93KKxn.js} +1 -1
- package/web/dist/assets/{OperatorHudView-CggG0_sK.js → OperatorHudView-BO0aIKPL.js} +1 -1
- package/web/dist/assets/{Personal-BObvlb70.js → Personal-CE_0Vhh0.js} +1 -1
- package/web/dist/assets/{Settings-BFfPMPc9.js → Settings-CbpZvVN_.js} +1 -1
- package/web/dist/assets/{Tabs-B594Pad_.js → Tabs-C2oW7oEj.js} +1 -1
- package/web/dist/assets/{index-DsLmKHw0.js → index-BQwOmbor.js} +2 -2
- package/web/dist/assets/{index-DvPjphz0.css → index-CuIop_pO.css} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/Factories-ARenKBiP.js +0 -1
- package/web/dist/assets/LibRows-Hqvf1beK.js +0 -1
- package/web/dist/assets/Library-JaSsp6Yr.js +0 -3
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "issue-to-pr",
|
|
3
|
-
"description": "Take one issue, let triage pick the lane that fits (the bugfix, feature, deps-upgrade or refactor loop, or a docs-only update), play the holdout scenarios it never saw, open the pull request and wait for green CI; a failed scenario or red CI sends the work back to that lane, twice at most each.
|
|
3
|
+
"description": "Take one issue, let triage pick the lane that fits (the bugfix, feature, deps-upgrade or refactor loop, or a docs-only update), run the base branch's checks and a review panel, play the holdout scenarios it never saw, open the pull request and wait for green CI; a failed check, review or scenario, or red CI, sends the work back to that lane, twice at most each. At the end it asks you once whether to merge.",
|
|
4
4
|
"category": "development",
|
|
5
5
|
"rules": [
|
|
6
|
-
"Never merge
|
|
6
|
+
"Never merge or enable auto-merge without the user's yes, asked once at the end of the run.",
|
|
7
7
|
"Push only this worktree's own branch."
|
|
8
8
|
],
|
|
9
9
|
"stages": [
|
|
10
10
|
"intake", "holdout-write", "triage",
|
|
11
11
|
"loop:bugfix", "loop:feature", "loop:deps-upgrade", "loop:refactor", "docs-update",
|
|
12
|
-
"holdout", "pr-open", "merge-gate", "retro"
|
|
12
|
+
"checks", "review-panel", "holdout", "pr-open", "merge-gate", "retro"
|
|
13
13
|
],
|
|
14
14
|
"start": "intake",
|
|
15
15
|
"edges": [
|
|
16
16
|
{ "from": "intake", "on": "pass", "to": "holdout-write" },
|
|
17
17
|
{ "from": "intake", "on": "fail", "to": "$stop" },
|
|
18
|
+
{ "from": "intake", "on": "needs-info", "to": "holdout-write" },
|
|
18
19
|
{ "from": "holdout-write", "on": "pass", "to": "triage" },
|
|
19
20
|
{ "from": "holdout-write", "on": "fail", "to": "$stop" },
|
|
20
21
|
{ "from": "triage", "on": "bug", "to": "loop:bugfix" },
|
|
@@ -23,15 +24,21 @@
|
|
|
23
24
|
{ "from": "triage", "on": "refactor", "to": "loop:refactor" },
|
|
24
25
|
{ "from": "triage", "on": "docs", "to": "docs-update" },
|
|
25
26
|
{ "from": "triage", "on": "fail", "to": "$stop" },
|
|
26
|
-
{ "from": "loop:bugfix", "on": "pass", "to": "
|
|
27
|
+
{ "from": "loop:bugfix", "on": "pass", "to": "checks" },
|
|
27
28
|
{ "from": "loop:bugfix", "on": "fail", "to": "$stop" },
|
|
28
|
-
{ "from": "loop:feature", "on": "pass", "to": "
|
|
29
|
+
{ "from": "loop:feature", "on": "pass", "to": "checks" },
|
|
29
30
|
{ "from": "loop:feature", "on": "fail", "to": "$stop" },
|
|
30
|
-
{ "from": "loop:deps-upgrade", "on": "pass", "to": "
|
|
31
|
+
{ "from": "loop:deps-upgrade", "on": "pass", "to": "checks" },
|
|
31
32
|
{ "from": "loop:deps-upgrade", "on": "fail", "to": "$stop" },
|
|
32
|
-
{ "from": "loop:refactor", "on": "pass", "to": "
|
|
33
|
+
{ "from": "loop:refactor", "on": "pass", "to": "checks" },
|
|
33
34
|
{ "from": "loop:refactor", "on": "fail", "to": "$stop" },
|
|
34
|
-
{ "from": "docs-update", "on": "pass", "to": "
|
|
35
|
+
{ "from": "docs-update", "on": "pass", "to": "checks" },
|
|
36
|
+
{ "from": "checks", "on": "pass", "to": "review-panel" },
|
|
37
|
+
{ "from": "checks", "on": "fail", "to": "$lane" },
|
|
38
|
+
{ "from": "checks", "on": "error", "to": "review-panel" },
|
|
39
|
+
{ "from": "checks", "on": "none", "to": "checks" },
|
|
40
|
+
{ "from": "review-panel", "on": "pass", "to": "holdout" },
|
|
41
|
+
{ "from": "review-panel", "on": "fail", "to": "$lane" },
|
|
35
42
|
{ "from": "holdout", "on": "pass", "to": "pr-open" },
|
|
36
43
|
{ "from": "holdout", "on": "fail", "to": "$lane" },
|
|
37
44
|
{ "from": "holdout", "on": "error", "to": "$stop" },
|
|
@@ -43,7 +50,18 @@
|
|
|
43
50
|
{ "from": "retro", "on": "pass", "to": "$close" }
|
|
44
51
|
],
|
|
45
52
|
"cycles": [
|
|
46
|
-
{ "name": "
|
|
47
|
-
{ "name": "
|
|
48
|
-
|
|
53
|
+
{ "name": "done-list", "nodes": ["checks"], "max": 1 },
|
|
54
|
+
{ "name": "checks", "nodes": ["$lane", "checks"], "max": 2 },
|
|
55
|
+
{ "name": "review", "nodes": ["$lane", "checks", "review-panel"], "max": 2 },
|
|
56
|
+
{ "name": "holdout", "nodes": ["$lane", "checks", "review-panel", "holdout"], "max": 2 },
|
|
57
|
+
{ "name": "ci", "nodes": ["$lane", "checks", "review-panel", "holdout", "pr-open", "merge-gate"], "max": 2 }
|
|
58
|
+
],
|
|
59
|
+
"review": {
|
|
60
|
+
"seats": {
|
|
61
|
+
"small": ["reviewer"],
|
|
62
|
+
"medium": ["reviewer", "tester"],
|
|
63
|
+
"large": ["reviewer", "tester", "steward"],
|
|
64
|
+
"areas": { "security": ["security"], "performance": ["performance"], "ui": ["user-advocate"], "data": ["security"] }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
49
67
|
}
|
|
@@ -22,7 +22,7 @@ to the loop three times, not two".
|
|
|
22
22
|
**fork**, such as `triage`: `bug`, `feature`, `deps`, `refactor`, `docs`, `fail`). Give each
|
|
23
23
|
named outcome its own edge to its own **lane**: a loop for work that changes code, or a brick
|
|
24
24
|
where a loop adds nothing (`docs` → `docs-update`). Every lane joins the same path after it
|
|
25
|
-
(`holdout`, then `pr-open` and `merge-gate`). An outcome the factory does not offer goes to
|
|
25
|
+
(`checks`, then `review-panel` and `holdout`, then `pr-open` and `merge-gate`). An outcome the factory does not offer goes to
|
|
26
26
|
`$stop`.
|
|
27
27
|
- **where a human gates** — a gate belongs to the brick (`gate: human` in its frontmatter,
|
|
28
28
|
narrowed by `gateOn`), never to the factory. A stage that must hold for a person uses a
|
|
@@ -30,7 +30,10 @@ to the loop three times, not two".
|
|
|
30
30
|
- **routes** — for every outcome of every stage: the next stage, `$close` or `$stop`.
|
|
31
31
|
- **failures that route back** — each one to an earlier stage, with its `max` from 1 to 5.
|
|
32
32
|
Each becomes a `cycles` entry. After a fork, route back to `$lane`, the lane the run took,
|
|
33
|
-
and start the cycle's `nodes` with `$lane`.
|
|
33
|
+
and start the cycle's `nodes` with `$lane`. Only a `fail` routes back to a loop: `checks`
|
|
34
|
+
`error` and `merge-gate` `none` also carry environment failures (a failed fetch, a missing
|
|
35
|
+
tool, CI pending at the bound) that no loop can fix, so route them on or to `$stop`, never
|
|
36
|
+
to a loop or `$lane` (`factory check` refuses that route).
|
|
34
37
|
- **rules** — optional lines every stage receives ("Never merge.").
|
|
35
38
|
- **level** — project `<repo>/.geneseed/factories/` (this repository, shared with the team
|
|
36
39
|
once committed) or global `$XDG_CONFIG_HOME/geneseed/factories/` (default
|
|
@@ -46,13 +49,20 @@ to the loop three times, not two".
|
|
|
46
49
|
{
|
|
47
50
|
"name": "<name>", "description": "<one line>", "category": "<category>",
|
|
48
51
|
"rules": ["<optional>"],
|
|
49
|
-
"stages": ["intake", "loop:<template>", "pr-open", "merge-gate", "retro"],
|
|
52
|
+
"stages": ["intake", "holdout-write", "loop:<template>", "checks", "review-panel", "holdout", "pr-open", "merge-gate", "retro"],
|
|
50
53
|
"start": "intake",
|
|
51
54
|
"edges": [{ "from": "<stage>", "on": "<outcome>", "to": "<stage | $lane | $close | $stop>" }],
|
|
52
|
-
"cycles": [{ "name": "<name>", "nodes": ["<first stage of the lap, or $lane>", "..."], "max": 2 }]
|
|
55
|
+
"cycles": [{ "name": "<name>", "nodes": ["<first stage of the lap, or $lane>", "..."], "max": 2 }],
|
|
56
|
+
"protected": ["<optional: paths checks refuses to see changed>"],
|
|
57
|
+
"review": { "seats": { "small": ["reviewer"], "medium": ["reviewer", "tester"], "large": ["reviewer", "tester", "steward"],
|
|
58
|
+
"areas": { "security": ["security"], "performance": ["performance"], "ui": ["user-advocate"], "data": ["security"] } } }
|
|
53
59
|
}
|
|
54
60
|
```
|
|
55
61
|
|
|
62
|
+
The edge `intake --needs-info--> <stage>` is optional: without it, a `needs-info` the user
|
|
63
|
+
answers `ok` follows intake's `pass` edge. `protected` is optional. `review.seats` is what a
|
|
64
|
+
`review-panel` stage seats; copy the shipped table unless the user wants other seats.
|
|
65
|
+
|
|
56
66
|
A cycle's `nodes[0]` is where every lap starts, and every route back targets it. A factory
|
|
57
67
|
with a fork follows the shipped `issue-to-pr`: one edge per named outcome out of `triage`,
|
|
58
68
|
and `$lane` as the target of each route back and as `nodes[0]` of its cycles.
|
|
@@ -72,7 +82,13 @@ to the loop three times, not two".
|
|
|
72
82
|
exist or cannot run here: fix the name, or step 4.
|
|
73
83
|
- `is not an outcome of` / `no edge for outcome` / `edges for outcome` — every outcome of a
|
|
74
84
|
stage has exactly one edge, and an edge uses only outcomes the stage declares (`error` may
|
|
75
|
-
go without one: it stops the run).
|
|
85
|
+
go without one: it stops the run; so may `needs-info`: it follows the `pass` edge).
|
|
86
|
+
- `protected: must be a list of non-empty paths` — `protected` is a list of path strings.
|
|
87
|
+
- `review: must be an object with a seats table` / `review.seats.<size>: must be a non-empty
|
|
88
|
+
list of agent names` / `review.seats.areas: must map each area to a list of agents` — the
|
|
89
|
+
seat table needs a list for `small`, `medium` and `large`, and `areas` maps each area to a list.
|
|
90
|
+
- `review.seats.<where>: no agent named <name>` — a seat names an agent Geneseed does not ship;
|
|
91
|
+
a project's own agents cannot sit.
|
|
76
92
|
- `$close is not reachable` — no path from `start` ends the run well.
|
|
77
93
|
- `has no declared cycle around it` — a route back with no `cycles` entry.
|
|
78
94
|
- `max must be an integer` — a cycle's `max` is 1 to 5.
|
|
@@ -86,6 +102,8 @@ to the loop three times, not two".
|
|
|
86
102
|
- `retired` — the file still uses `loop:$triaged` or `loops`: list each loop as its own stage,
|
|
87
103
|
give the fork one edge per lane, and route back to `$lane`. Rewrite it with the user; never
|
|
88
104
|
silently.
|
|
105
|
+
- `reports environment failures on …, which no loop can fix` — `checks` `error` or
|
|
106
|
+
`merge-gate` `none` routes to a loop or `$lane`: route it to the next stage or to `$stop`.
|
|
89
107
|
6. **Hand off:** tell the user the file, then the `factory` {{SKILL}} runs it
|
|
90
108
|
(`geneseed factory init --factory <name> …`). Do not start a run unasked.
|
|
91
109
|
|
package/src/skills/factory.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
> {{DESC_FACTORY}}
|
|
4
4
|
|
|
5
|
-
**Trigger:** the user
|
|
6
|
-
|
|
7
|
-
(`analysis-to-build`, `bug-report-to-fix`, `issue-to-pr`).
|
|
5
|
+
**Trigger:** the user names a factory (`analysis-to-build`, `bug-report-to-fix`, `issue-to-pr`),
|
|
6
|
+
or asks to carry an issue, request or document to a PR with green CI.
|
|
8
7
|
|
|
9
8
|
## What it is
|
|
10
9
|
|
|
11
10
|
`geneseed factory` is a state machine kept in `FACTORY.md` at the worktree's root. A stage is a
|
|
12
11
|
brick or a whole loop; the engine decides every transition, cycle count and stop, and you run the
|
|
13
12
|
stage it hands you and report the outcome. Every action prints one JSON object: act on its keys,
|
|
14
|
-
never on your own reading of the graph. The run ends at an open PR with green CI. **
|
|
15
|
-
|
|
13
|
+
never on your own reading of the graph. The run ends at an open PR with green CI. **No stage
|
|
14
|
+
merges:** once the run has closed, you ask the user once whether to merge (*The end*), and never
|
|
15
|
+
enable auto-merge.
|
|
16
16
|
|
|
17
17
|
**Holdout rule.** The `holdout-write` stage writes scenarios the developer never sees, and the
|
|
18
18
|
`holdout` stage plays them before the PR. Both run as the `tester` {{AGENT}}, never as the
|
|
@@ -25,7 +25,11 @@ when the diff touches it, and by this rule.
|
|
|
25
25
|
|
|
26
26
|
## Setup
|
|
27
27
|
|
|
28
|
-
1. Pick a short kebab-case `<slug>` from the work item
|
|
28
|
+
1. Pick a short kebab-case `<slug>` from the work item, without the words `git`, `commit` or
|
|
29
|
+
`push` (spell them `g1t`, `cmt`, `psh`, or leave them out): the slug lands on the spec's
|
|
30
|
+
`record` line and on `git commit -m` lines, where those words make the git gate ask.
|
|
31
|
+
`factory init` refuses a `loop/factory-<slug>` branch whose slug holds one. Create the run's
|
|
32
|
+
worktree:
|
|
29
33
|
`git worktree add ../<repo>-factory-<slug> -b loop/factory-<slug>`, then make it the session's
|
|
30
34
|
working directory with its own command. Every later command runs there as written below: no
|
|
31
35
|
`cd` prefix, no `git -C`. Several runs may share a repo, each in its own worktree.
|
|
@@ -36,13 +40,27 @@ when the diff touches it, and by this rule.
|
|
|
36
40
|
|
|
37
41
|
## The cycle
|
|
38
42
|
|
|
39
|
-
Repeat `geneseed factory next` and act on its JSON
|
|
43
|
+
Repeat `geneseed factory next` and act on its JSON.
|
|
44
|
+
|
|
45
|
+
**How to record.** `record` reads the porcelain on its stdin, piped in one command:
|
|
46
|
+
`git status --porcelain --untracked-files=all | geneseed factory record --outcome <outcome>`.
|
|
47
|
+
The same line works in PowerShell, which pipes too. Always use that porcelain form: plain
|
|
48
|
+
`--porcelain` folds a new directory into one line, which the engine refuses. A carry is the path
|
|
49
|
+
of the file the stage itself wrote (`--carry <that file>`), in the OS temp directory where the stage wrote it (never inside the worktree: a file there makes the porcelain dirty).
|
|
50
|
+
Free text (the user's words for `decide`, a stop reason) never goes on the command line: write it
|
|
51
|
+
with your file tool, never the shell, to a file whose name you make unique, such as
|
|
52
|
+
`<os temp dir>/factory-<8 random hex>.txt`, then pass `--note-file <that file>` or
|
|
53
|
+
`--carry-file <that file>`. Never delete a carry: the engine keeps its path for the next stage.
|
|
54
|
+
|
|
55
|
+
The git gate asks on any line that holds the word `git` and the word `commit` or `push`. A
|
|
56
|
+
record line holds `git`, so a spec path, a carry path or an outcome name with `commit` or `push`
|
|
57
|
+
in it makes the gate ask. On a record line that ask is a false alarm: the user can answer yes.
|
|
58
|
+
`factory init` refuses a slug that holds those words, which removes the commonest case.
|
|
40
59
|
|
|
41
60
|
- **`{stage, prompt, outcomes}`** — a brick stage. Dispatch its `agent` (or follow its `skill`)
|
|
42
61
|
with the `prompt`, the `requirement`, the `input`, the `carry` and the factory's `rules`. Then:
|
|
43
|
-
`git status --porcelain --untracked-files=all | geneseed factory record --outcome <outcome> --carry
|
|
44
|
-
The `--carry` is how the next stage gets this one's finding.
|
|
45
|
-
plain `--porcelain` folds a new directory into one line, which the engine refuses.
|
|
62
|
+
`git status --porcelain --untracked-files=all | geneseed factory record --outcome <outcome> --carry <the file the stage reported>`
|
|
63
|
+
(*How to record*). The `--carry` is how the next stage gets this one's finding.
|
|
46
64
|
A fork stage (such as `triage`) also gets `lanes`: each outcome it may report, with the stage
|
|
47
65
|
it leads to. Record the outcome it reported (`--outcome docs`): that outcome names the lane,
|
|
48
66
|
and a later route back to `$lane` returns to it.
|
|
@@ -51,16 +69,54 @@ Repeat `geneseed factory next` and act on its JSON:
|
|
|
51
69
|
engine refuses a dirty tree after any stage outside a loop.
|
|
52
70
|
The `spec` stage writes `specs/<slug>/spec.md` (the run's slug; a gate amend reaches it as the
|
|
53
71
|
`carry`, not as a LOOP.md note) and reports with
|
|
54
|
-
`git status --porcelain --untracked-files=all | geneseed factory record --outcome <outcome> --spec specs/<slug>/spec.md --carry <
|
|
72
|
+
`git status --porcelain --untracked-files=all | geneseed factory record --outcome <outcome> --spec specs/<slug>/spec.md --carry <the file the stage reported>`,
|
|
73
|
+
so the gate shows the user what to review.
|
|
55
74
|
Its gate holds for the user's review of the task list. After `decide --verdict ok`, commit the
|
|
56
75
|
spec before the first loop: `git add specs/<slug>/spec.md`, then
|
|
57
76
|
`git commit -m "factory(<slug>): spec"` (it asks). An uncommitted spec stops the loop's first
|
|
58
77
|
read brick; the engine exempts it only until then.
|
|
78
|
+
A stage whose `skill` is `factory` (`review-panel`) is yours: follow its `prompt` here,
|
|
79
|
+
dispatch its seats in one parallel batch, chair them, and record its outcome as above.
|
|
59
80
|
- **`{stage, loop, notes}`** — a loop stage: see *Loop stages*.
|
|
60
81
|
- **`{awaiting}`** — a `gate: human` stage holds. Show the user the `stage`, the `outcome` it
|
|
61
82
|
reported and the file its `note` names, then **end the run** and wait. On their answer:
|
|
62
|
-
|
|
83
|
+
write their words to a unique file with your file tool (*How to record*), then
|
|
84
|
+
`geneseed factory decide --verdict ok|no|amend --note-file <that file>` — `ok` follows the
|
|
63
85
|
reported outcome's edge, `no` stops, `amend` re-runs the stage with their note — and continue.
|
|
86
|
+
Their words never go on the command line.
|
|
87
|
+
The gated outcomes:
|
|
88
|
+
- `intake` **`needs-info`**: show the user its numbered questions. Their answers go back as
|
|
89
|
+
`amend`, with the note file holding their answers; `ok` goes on with the assumptions intake
|
|
90
|
+
wrote.
|
|
91
|
+
- `checks` **`error`**: every check passed, but the branch changed a locked path (the done
|
|
92
|
+
list, CI config, a factory, loop or brick). Show each path. `ok` lets the change through; the run report names it.
|
|
93
|
+
When the finding starts `environment:` (a failed fetch, no default branch, a timeout, a
|
|
94
|
+
missing tool), show the cause instead: the loop cannot fix it. Once the user has fixed it,
|
|
95
|
+
`amend` runs `checks` again; `no` stops; `ok` goes on without the done list.
|
|
96
|
+
- `merge-gate` **`none`**: the repo runs no CI on the PR, or, when the finding starts
|
|
97
|
+
`environment:`, no verdict could be read (CI pending at the bound, `gh`/`glab` missing or
|
|
98
|
+
failing). `ok` goes on to `retro`, `amend` waits again, `no` stops.
|
|
99
|
+
- `checks` **`none`**: the base has no done list (or an empty one), and the note is the one
|
|
100
|
+
`checks` proposes, or says no manifest gave one. On the user's yes, land it on the base by a
|
|
101
|
+
PR of its own, never from this worktree and never by a push to `<default>`:
|
|
102
|
+
`git worktree add ../<repo>-done-list-<slug> -b geneseed/done-list-<slug> origin/<default>`,
|
|
103
|
+
write `.geneseed/done-checks.txt` there holding exactly the lines of the finding's fenced
|
|
104
|
+
block, stage that file alone, commit, push that worktree's own branch
|
|
105
|
+
(`git push -u origin HEAD:geneseed/done-list-<slug>`), and open a PR to `<default>`
|
|
106
|
+
(`gh pr create --base <default>`, or `glab mr create --target-branch <default>`; each asks).
|
|
107
|
+
Give the user the PR's URL: they merge it. Remove that worktree once the PR is merged.
|
|
108
|
+
When the branch or the worktree already exists (a re-run with the same slug), create
|
|
109
|
+
nothing and overwrite nothing: report it to the user with that worktree's path and the
|
|
110
|
+
branch's state (`git log -1 geneseed/done-list-<slug>`), and let them reuse, merge or
|
|
111
|
+
remove it. When the remote already has `geneseed/done-list-<slug>` but this clone has no
|
|
112
|
+
such branch (`git ls-remote --exit-code --heads origin geneseed/done-list-<slug>` exits 0
|
|
113
|
+
before the push), the push is refused: push nothing and overwrite nothing, and report it to
|
|
114
|
+
the user with that worktree's path and the remote branch's name, so they decide whether to
|
|
115
|
+
reuse, merge or delete it. When `gh` or `glab` is missing or fails at the PR step, the branch is pushed
|
|
116
|
+
already: report it to the user with that worktree's path and the branch name, so they open
|
|
117
|
+
the PR themselves. `ok`
|
|
118
|
+
waits until the file is on the base: answer `decide --verdict ok` only then, and `checks`
|
|
119
|
+
runs again against it. If it is not to be landed, `no`.
|
|
64
120
|
- **`{terminal: "$close"}`** or **`{terminal: "$stop"}`** — see *The end*.
|
|
65
121
|
- A `record` or `decide` result (`{stage}`, `{awaiting}`, `{stopped}`) — call `next` again.
|
|
66
122
|
- **`{error}`** — read it; it names the step you skipped or the evidence `record` lacks. Do that
|
|
@@ -81,35 +137,48 @@ Repeat `geneseed factory next` and act on its JSON:
|
|
|
81
137
|
later stage sent the work back: the task is "make CI green" (or, for another stage, make it
|
|
82
138
|
pass), and `notes[0]` says why. Use `--note-file <notes[0]>`
|
|
83
139
|
when `notes[0]` is the path of a stage's finding file (the usual carry), so the loop gets the
|
|
84
|
-
finding, not its path;
|
|
85
|
-
empty. A loop
|
|
140
|
+
finding, not its path; when it is plain text, write it to a unique file with your file tool
|
|
141
|
+
(*How to record*) and pass that file with `--note-file`; neither when `notes` is empty. A loop
|
|
86
142
|
re-entered after a failure is a fresh loop: the reason arrives as its note.
|
|
87
143
|
6. Follow the `loop` {{SKILL}} from *The cycle* through *The end*, skipping its Setup: the
|
|
88
144
|
worktree is this one, and its `loop/<slug>` is `loop/factory-<slug>` here, so every loop push
|
|
89
145
|
is `git push -u origin HEAD:loop/factory-<slug>`. Skip its final report too: the run goes on.
|
|
90
146
|
7. When the loop reaches `$close` and its close commit has removed `LOOP.md`:
|
|
91
147
|
`git status --porcelain --untracked-files=all | geneseed factory record --outcome pass`.
|
|
92
|
-
When it reaches `$stop`, leave its `LOOP.md` in place
|
|
93
|
-
|
|
148
|
+
When it reaches `$stop`, leave its `LOOP.md` in place, write the stop reason to a unique file
|
|
149
|
+
with your file tool (*How to record*), then
|
|
150
|
+
`git status --porcelain --untracked-files=all | geneseed factory record --outcome fail --carry-file <that file>`.
|
|
94
151
|
|
|
95
152
|
## The end
|
|
96
153
|
|
|
97
|
-
8. On `$close`: the `retro` stage has written the run report.
|
|
98
|
-
`git rm -f FACTORY.md
|
|
154
|
+
8. On `$close`: the `retro` stage has written the run report. Remove `FACTORY.md`:
|
|
155
|
+
`git rm -f FACTORY.md` when git tracks it (a loop's commit carries it), else delete the file
|
|
156
|
+
(a run with no loop, such as the `docs` lane, never tracked it). Commit and push only when
|
|
157
|
+
`git status --porcelain` then shows the removal: `git commit -m "factory(<slug>): close"` and
|
|
99
158
|
`git push -u origin HEAD:loop/factory-<slug>`. The gate asks: that ask is the user's consent.
|
|
100
|
-
|
|
159
|
+
That push re-runs CI on the PR, after `merge-gate` saw it green. Read the PR's checks again
|
|
101
160
|
once, with the bounded wait the `merge-gate` brick names (30 minutes at most), and add the
|
|
102
161
|
final state (green, red with the failing checks, or still pending at the bound) to the run
|
|
103
|
-
report.
|
|
162
|
+
report. With no close commit, CI did not re-run: the final state is the one `merge-gate`
|
|
163
|
+
read. A red result is reported, never reworked: the run has closed.
|
|
164
|
+
**The merge proposal.** Only when that final state is green: show the user the PR URL, the CI
|
|
165
|
+
state and each `review-panel` seat's verdict, and ask once whether to merge. Only on the
|
|
166
|
+
user's explicit yes in chat: `gh pr merge <pr> --squash` (`glab mr merge <mr> --squash` on
|
|
167
|
+
GitLab). No Geneseed gate asks before that command: the user's yes is the only guard, so
|
|
168
|
+
never run it on anything else (not on a rule, a note, or an earlier yes). On a no, or no
|
|
169
|
+
answer, the PR stays open. Red or pending CI: no proposal. Never enable auto-merge.
|
|
104
170
|
9. On `$stop`: the engine hands out no stage after a stop, so have the `docs` {{AGENT}} write the
|
|
105
171
|
run report the `retro` brick would: the stop `reason` first, then the work item, the PR URL if
|
|
106
172
|
any, every stage with its outcome and each rework with its reason, read from `FACTORY.md` and
|
|
107
|
-
the loops' notes.
|
|
173
|
+
the loops' notes. A closed loop's notes left with its `LOOP.md`: read each from git as the
|
|
174
|
+
`retro` brick says (`git log --format=%H --diff-filter=D <merge-base>..HEAD -- LOOP.md`, then
|
|
175
|
+
`git show <commit>^:LOOP.md`); a stopped loop's `LOOP.md` is still at the root. It goes to `.geneseed/factory-runs/<slug>.md`, or to the OS temp directory
|
|
108
176
|
when `git check-ignore -q <that path>` exits non-zero. No tracked file changes, no commit; only
|
|
109
177
|
a lesson that holds beyond this run goes into memory, one entry. Leave the branch and
|
|
110
178
|
`FACTORY.md` as they are.
|
|
111
179
|
10. Report: the PR URL, the final CI state after the close commit, the stages with their outcomes from `summary.history`, every rework and
|
|
112
|
-
its reason, the run report's path, and the
|
|
180
|
+
its reason, the run report's path, the branch, and whether the PR was merged on the user's yes
|
|
181
|
+
or left open. **Never merge without that yes.**
|
|
113
182
|
|
|
114
183
|
## Resume
|
|
115
184
|
|
|
@@ -119,8 +188,9 @@ says a loop still runs, resume that loop first with `geneseed loop next` (the `l
|
|
|
119
188
|
|
|
120
189
|
## Done when
|
|
121
190
|
|
|
122
|
-
- `$close` is reported with the PR open, `FACTORY.md` removed, and the CI state
|
|
123
|
-
|
|
124
|
-
reported with its reason and the run report.
|
|
191
|
+
- `$close` is reported with the PR open, `FACTORY.md` removed, and the final CI state read and
|
|
192
|
+
reported (after the close commit, or `merge-gate`'s when there was none); or `$stop` is
|
|
193
|
+
reported with its reason and the run report. The PR was merged on the user's yes, asked once
|
|
194
|
+
at the end, or left open; a `$stop` merges nothing.
|
|
125
195
|
|
|
126
196
|
<!-- INCLUDE: skills/_self-improvement.md -->
|
package/src/skills/loop.md
CHANGED
|
@@ -77,8 +77,9 @@ What `score --diff`, `decide` and `record` print back:
|
|
|
77
77
|
`origin` and a `message_file` path without spaces: if the path has a space, quote it and accept
|
|
78
78
|
that the gate asks; with no remote, report and stop instead of retrying.
|
|
79
79
|
- **`{discard: true}`** (with `resplit` when an inner ring was exhausted) — set the attempt aside,
|
|
80
|
-
keeping
|
|
81
|
-
the word `push` trips the git gate mid-run).
|
|
80
|
+
keeping the engine files: `git stash -u -m loop-discarded -- . :^LOOP.md :^FACTORY.md` (never
|
|
81
|
+
`git stash push` — the word `push` trips the git gate mid-run). `FACTORY.md` is the factory
|
|
82
|
+
run's state when this loop is one of its stages: stashed, the run would lose it or roll it back.
|
|
82
83
|
- **`{done: true}`**, **`{empty}`**, **`{resumed}`**, **`{dropped}`**, **`{node}`**, **`{verify}`**,
|
|
83
84
|
**`{awaiting}`** (a gate), **`{stopped}`**, a declared score, and any result with
|
|
84
85
|
`commit: false` (a blocking diff score included — it surfaces as `{awaiting}`) — call `next`
|
package/themes/_TEMPLATE.json
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"DESC_PARALLEL_AGENTS": "<one-line description: fan independent subtasks to concurrent subagents, then converge>",
|
|
63
63
|
"DESC_PIPELINE": "<one-line description: spawn a small crew — analyst, developer, tester — to work a substantial task in isolation, merging only on mechanical proof (tests + lint green)>",
|
|
64
64
|
"DESC_LOOP": "<one-line description: work a requirement in small scored iterations on a loop/* branch, stepping the geneseed loop state machine>",
|
|
65
|
-
"DESC_FACTORY": "<one-line description: carry one work item (request, document or issue) through a factory of bricks and loops to an open PR with green CI, stepping the geneseed factory state machine; never merges>",
|
|
65
|
+
"DESC_FACTORY": "<one-line description: carry one work item (request, document or issue) through a factory of bricks and loops to an open PR with green CI, stepping the geneseed factory state machine; never merges without the user's yes, asked once at the end>",
|
|
66
66
|
"DESC_BRICK_FORGE": "<one-line description: author or adapt a loop brick at project, global or shipped level, checked by geneseed loop check>",
|
|
67
67
|
"DESC_FACTORY_FORGE": "<one-line description: compose bricks and loops into a factory through an interview, write it at project or global level, check it with geneseed factory check, and offer brick-forge for a missing brick>",
|
|
68
68
|
"DESC_DEVELOP": "<one-line description: drive a code change through cover-and-verify — smallest change, tests written for it, affected suite green, committed slice by slice>",
|
|
@@ -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-DLDVY3K-.js";import{s as i}from"./motion-RlUl1osO.js";import{A as a,B as o,D as s,Et as c,F as l,G as u,I as d,L as f,N as p,O as m,P as h,R as g,bt as _,it as v,j as y,k as b,ot as ee,rt as te,u as ne,wt as x}from"./index-DsLmKHw0.js";import{t as S}from"./EmptyState-CY5Pm2xy.js";import{_ as C,a as w,c as T,f as E,g as D,h as O,i as k,l as A,m as re,n as j,o as M,p as N,r as P,s as F,t as I,u as L,v as R}from"./Bonsai-B01lLf0m.js";import{t as ie}from"./usePoll-o8ul-Sog.js";var z=e(t(),1),B=n(),V=4,H=56*V,U=24,W=165,G=188,K=(e,t)=>e>0?Math.max(1,Math.floor((e-32+U)/(H+U))):Math.max(1,t),q=e=>e.status===`blocked`?`bad`:l(e)?`warn`:e.status===`busy`?`ok`:``,J=e=>{let t=A(e);return t==null?null:Math.round(t*100)};function Y(e,t,n){let r=s[e.status]||s.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=J(e);return[`${e.title||y(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 X({s:e,t,mine:n}){let r=J(e);return(0,B.jsxs)(`div`,{className:`card gd-card`,children:[(0,B.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`model`}),(0,B.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,B.jsx)(`dt`,{children:`turns`}),(0,B.jsx)(`dd`,{children:e.turns||0}),(0,B.jsx)(`dt`,{children:`context`}),(0,B.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,B.jsx)(`dt`,{children:`compactions`}),(0,B.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,B.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,B.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 Z({s:e,worktree:t,sakura:n,mine:r,pad:i,onHover:a}){let o=R(e,n),c=(0,z.useMemo)(()=>E(e,{sakura:n}),[o]),u=s[e.status]||s.idle,d=Array.isArray(e.loops)?e.loops[0]:null,f=e.status!==`idle`,p=F(e),m=e.title||y(e.cwd)||e.session_id,h=J(e),g=(0,z.useRef)(null),_=(0,z.useCallback)(e=>a(p,e,Q(g.current)),[a,p]);return(0,B.jsxs)(`a`,{ref:g,className:`gd-tree${l(e)?` gd-needs`:``}`,href:e.href||L(e.session_id),"aria-label":Y(e,c,r),"data-sid":e.session_id,onMouseEnter:e=>a(p,null,Q(e.currentTarget)),onMouseLeave:()=>a(null,null),onFocus:e=>a(p,null,Q(e.currentTarget)),onBlur:()=>a(null,null),onKeyDown:e=>k(e,c.pads.length,i,_),children:[(0,B.jsx)(P,{t:c,pad:i,swaying:f,onPad:_,px:V}),(0,B.jsxs)(`div`,{className:`gd-cap`,children:[(0,B.jsx)(`div`,{className:`gd-title`,title:m,children:m}),(0,B.jsxs)(`div`,{className:`row wrap gd-pills`,children:[(0,B.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip||e.host||`?`}),(0,B.jsx)(`span`,{className:`badge ${q(e)}`,children:u.label}),t&&(0,B.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),d&&(0,B.jsxs)(`span`,{className:`badge`,children:[`↻ `,d.title,d.iteration==null?``:` ${d.iteration}`]}),e.attribution===!1&&(0,B.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`})]}),(0,B.jsxs)(`div`,{className:`mono gd-meta`,children:[e.turns||0,` turns`,h==null?``:` · ${h}%`]})]})]})}function ae({pairs:e,count:t}){if(!e.length)return null;let n=t*H+(t-1)*U,r=e=>e*(H+U)+H/2;return(0,B.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*V+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,B.jsxs)(`g`,{className:o,children:[(0,B.jsx)(`path`,{d:`M${e} ${W} C${n} 179 ${n} 159 ${t} 169`}),(0,B.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${W}`})]},`${i}-${a}`)}return(0,B.jsx)(`g`,{className:o,children:(0,B.jsx)(`path`,{d:`M${r(i)} ${G} Q${(r(i)+r(a))/2} 222 ${r(a)} ${G}`})},`${i}-${a}`)})})}var Q=e=>e.offsetLeft;function oe({sessions:e,collisions:t}){let[n,r]=(0,z.useState)(M),[i,a]=(0,z.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(j,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=T(N(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>D(e,s);return(0,B.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,B.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,B.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,B.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Pink blossom`})]}),l.length>0&&(0,B.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,B.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,B.jsx)(se,{sh:e,sakura:n,cols:s,mineOf:u},e.key))]})}function se({sh:e,sakura:t,cols:n,mineOf:r}){let[i,a]=(0,z.useState)({sid:null,pad:null,x:0}),o=(0,z.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(0);(0,z.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=K(c,e.trees.length),d=C(e.trees,n),f=[];for(let t=0;t<e.trees.length;t+=u)f.push(t);let p=e.trees.findIndex(e=>F(e.s)===i.sid),m=p<0?null:e.trees[p].s,h=m?E(m,{sakura:t}):null,g=h&&i.pad!=null?h.pads[i.pad]:null,_=e.trees.length;return(0,B.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,B.jsxs)(`div`,{className:`gd-row`,children:[(0,B.jsx)(`div`,{className:`gd-plank`,children:n===0&&(0,B.jsxs)(`h3`,{className:`gd-plate`,children:[e.name,` · `,_,` session`,_===1?``:`s`]})}),a.map(({s:e,worktree:n})=>(0,B.jsx)(Z,{s:e,worktree:n,sakura:t,mine:r(F(e)),pad:F(e)===i.sid?i.pad:null,onHover:o},F(e))),(0,B.jsx)(ae,{pairs:c,count:a.length}),m&&p>=n&&p<s&&(0,B.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:g?(0,B.jsx)(I,{pad:g}):(0,B.jsx)(X,{s:m,t:h,mine:r(F(m))})})]},n)}),(0,B.jsx)(`span`,{className:`sr-only`,role:`status`,children:w(g)})]})}var $=e=>e.catch(()=>null);function ce({s:e}){let t=(0,z.useId)(),n=e.todos,r=h(e);return(0,B.jsxs)(`a`,{className:`card pad-md act-card`,href:e.href||L(e.session_id),"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,B.jsxs)(m,{s:e,id:t,heading:e.title||y(e.cwd)||e.session_id,children:[e.chip&&(0,B.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip}),(0,B.jsx)(_,{name:`chevron`,className:`glyph act-chev`})]}),n&&n.total>0&&(0,B.jsx)(`div`,{className:`act-foot`,children:(0,B.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,B.jsx)(a,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,B.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,x(e.updated_at),` ago`]})]})}var le={blocked:`is blocked`,"waiting-input":`waits for your answer`};function ue(e,t){if(!Array.isArray(t))return``;let n=t.filter(l),r=e.current;return e.current=new Set(n.map(e=>`${F(e)}:${e.status}`)),r?n.filter(e=>!r.has(`${F(e)}:${e.status}`)).map(e=>`${e.title||y(e.cwd)||e.session_id} ${le[e.status]}`).join(`. `):``}var de=[[`all`,`All`],[`needs`,`Needs you`],[`runs`,`Runs`],[`gates`,`Gate asks`]];function fe(){let e=new URLSearchParams(window.location.hash.split(`?`)[1]||``),t=e.get(`f`);return{f:de.some(([e])=>e===t)?t:`all`,host:e.get(`host`)||``,project:e.get(`project`)||``,v:e.get(`v`)===`list`?`list`:`garden`}}function pe(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 me({enabled:e,installs:t,onToggle:n}){let r=re(t);return(0,B.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,B.jsx)(_,{name:`activity`,className:`glyph act-fixed`}),(0,B.jsxs)(`div`,{className:`act-grow`,children:[(0,B.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,B.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,B.jsxs)(`ul`,{className:`stack gap-8 act-fixed act-sm`,"aria-label":`Tracking per install`,children:[t.length===0&&(0,B.jsx)(`li`,{className:`dim`,children:`No active install to track.`}),t.map((e,t)=>(0,B.jsxs)(`li`,{className:`row gap-10`,children:[(0,B.jsxs)(`span`,{id:`act-track-l${t}`,title:e.path,children:[`Track live sessions in `,(0,B.jsx)(`span`,{className:`mono`,children:r.get(e.install)})]}),(0,B.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 he({jobs:e,loading:t}){let n=typeof e?.cap==`number`?e.cap:void 0,r=d(e?.jobs,{days:14,cap:n}),i=g(r.map(e=>e.nodata?`-`:e.n).join(`,`),`scaleY`),a=Math.max(1,...r.map(e=>e.n)),o=r.reduce((e,t)=>e+t.n,0),s=r.find(e=>!e.nodata),c=r.some(e=>e.nodata),l=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${f(e.key)}`).join(`, `)||`none`}.`+(c?s?` Days before ${f(s.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,B.jsxs)(`div`,{className:`act-stat-head`,children:[(0,B.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,B.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,B.jsx)(v,{label:`Reading the job log…`}):e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":l,ref:i,children:r.map(e=>e.nodata?(0,B.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,B.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${f(e.key)}: ${e.n}`},e.key):(0,B.jsx)(`i`,{className:`zero`},e.key))}),(0,B.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,B.jsx)(`span`,{children:f(r[0].key)}),(0,B.jsx)(`span`,{children:f(r[7].key)}),(0,B.jsx)(`span`,{children:`today`})]}),c&&(0,B.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,B.jsx)(`p`,{className:`dim act-sm`,children:`The job log could not be read.`})]})}function ge({rows:e,gates:t,loading:n}){let r=e.reduce((e,t)=>e+t.n,0);return(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,B.jsxs)(`div`,{className:`act-stat-head`,children:[(0,B.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,B.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,B.jsx)(v,{label:`Reading the gate ledger…`}):e.length?(0,B.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,B.jsx)(b,{vals:e.per_day,i:t,sweep:!0}),(0,B.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,B.jsx)(`p`,{className:`dim act-sm`,children:t?`No gate asked in 30 days.`:`The gate ledger could not be read.`})]})}var _e={done:[`ok`,`done`],failed:[`bad`,`failed`],running:[``,`running`]};function ve({job:e,longest:t}){let n=o(e),r=e.duration?Math.round(e.duration*10)/10:0,[i,a]=_e[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,B.jsxs)(`li`,{className:`act-row`,children:[(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:c}),(0,B.jsx)(_,{name:`play`,className:`glyph act-glyph`}),(0,B.jsxs)(`span`,{className:`act-what`,children:[(0,B.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,B.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,B.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":s,children:(0,B.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,B.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function ye({gate:e}){return(0,B.jsxs)(`li`,{className:`act-row gate`,children:[(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,B.jsx)(_,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,B.jsxs)(`span`,{className:`act-what`,children:[(0,B.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,B.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,B.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`badge warn`,children:`asked`})]})}var be=5,xe=(e,t)=>[...new Set([...e.filter(Boolean),t].filter(Boolean))];function Se(){let[e,t]=(0,z.useState)(null),[n,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(fe),[d,f]=(0,z.useState)(!1),[m,h]=(0,z.useState)(``),_=(0,z.useRef)(null),b=e=>{let t={...o,...e};s(t),pe(t)};ie(e=>r.activity().then(n=>{if(e()){t(n),a(``);let e=ue(_,n?.activity);e&&h(t=>t===e?e+`\xA0`:e)}},t=>{e()&&a(t.message)}),2e3,[]);let x=c(()=>$(r.jobs()),[]),C=c(()=>$(r.gates()),[]),w=c(()=>$(r.catalog(`laws`)),[]),T=!e||e.enabled!==!1,E=Array.isArray(e?.installs)?e.installs:[],D=O(e?.activity,E).sort((e,t)=>e.session_id<t.session_id?-1:+(e.session_id>t.session_id)),k=i(),A=T&&e?D.filter(l).length:null,re=new Set(D.map(F)),j=o.v===`list`?O(e?.ended,E).filter(e=>!re.has(F(e))):[],M=xe([...D,...j].map(e=>e.host),o.host),N=xe([...D,...j].map(e=>y(e.cwd)),o.project),P=o.host&&o.project?`host or project`:o.host?`host`:o.project?`project`:``,I=e=>(!o.host||e.host===o.host)&&(!o.project||y(e.cwd)===o.project),L=D.filter(e=>I(e)&&(o.f!==`needs`||l(e))),R=o.f===`all`||o.f===`needs`,V=o.f===`all`&&T?j.filter(I):[],H=d?V:V.slice(0,be),U=!P&&(o.f===`all`||o.f===`runs`),W=!P&&(o.f===`all`||o.f===`gates`),G=x.data?.jobs||[],K=ne(C.data,w.data),q=p(G,K,C.data?.days).map(e=>({...e,runs:U?e.runs:[],gate:W?e.gate:null})).filter(e=>e.runs.length||e.gate),J=Math.max(0,...G.map(e=>e.duration||0)),Y=g(q.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),X=async e=>{let n=!e.enabled;try{let i=await r.activityToggle(n,{host:e.host,path:e.path});if(i.ok===!1){a(i.error||`Could not change tracking`);return}let o=t=>i.enabled?t||[]:(t||[]).flatMap(t=>{let n=(t.installs||[t.install]).filter(t=>t!==e.install);return n.length?[{...t,install:n[0],installs:n}]:[]});t(t=>{let n=(t?.installs||[]).map(t=>t.install===e.install?{...t,enabled:i.enabled}:t);return{...t||{},installs:n,enabled:n.length===0||n.some(e=>e.enabled),activity:o(t?.activity),ended:o(t?.ended)}}),a(``)}catch(e){a(e.message)}},Z=(e,t,n)=>(0,B.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,B.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,B.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:o[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>b({[e]:t.target.value}),children:[(0,B.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]});return(0,B.jsxs)(`div`,{className:`page-fill`,children:[(0,B.jsx)(u,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,B.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:m}),n&&(0,B.jsx)(`div`,{className:`act-gap`,children:(0,B.jsx)(te,{error:n})}),e&&(0,B.jsx)(me,{enabled:T,installs:E,onToggle:X}),(0,B.jsxs)(`div`,{className:`act-today`,children:[(0,B.jsx)(he,{jobs:x.data,loading:x.loading}),(0,B.jsx)(ge,{rows:K,gates:C.data,loading:C.loading}),(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,B.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),!e&&!n?(0,B.jsx)(v,{}):e?(0,B.jsxs)(B.Fragment,{children:[T?(0,B.jsxs)(`span`,{className:`act-big act-wait`,children:[A,` `,(0,B.jsx)(`span`,{className:`dim act-sm`,children:A===1?`session`:`sessions`})]}):null,(0,B.jsx)(`p`,{className:`dim act-sm`,children:T?`A session that waits on an approval or on your answer counts here.`:`Turn tracking on to count the sessions that wait on you.`})]}):(0,B.jsx)(`p`,{className:`dim act-sm`,children:`The sessions could not be read.`})]})]}),(0,B.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,B.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:de.map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,className:o.f===e?`chip-f on`:`chip-f`,"aria-pressed":o.f===e,onClick:()=>b({f:e}),children:[t,e===`needs`&&A>0?(0,B.jsxs)(`span`,{className:`mono`,children:[` `,A]}):null]},e))}),Z(`host`,`Host`,M),Z(`project`,`Project`,N),(0,B.jsx)(ee,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,className:o.v===e?`on`:``,"aria-pressed":o.v===e,onClick:()=>b({v:e}),children:t},e))})]}),P&&o.f!==`needs`&&(0,B.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,P,`; showing sessions only.`]}),R&&(e?!T&&o.f!==`needs`?null:L.length===0?o.f===`needs`?(0,B.jsx)(S,{title:`Nothing waits on you`}):(0,B.jsx)(S,{title:`No active sessions`,children:`Start an agent session and it appears here.`}):o.v===`garden`?(0,B.jsx)(oe,{sessions:L,collisions:e.collisions}):(0,B.jsx)(`div`,{className:`stack gap-12 act-live`,ref:k,children:L.map(e=>(0,B.jsx)(`div`,{"data-flip":F(e),children:(0,B.jsx)(ce,{s:e})},F(e)))}):(0,B.jsx)(v,{label:`Reading live sessions…`})),V.length>0&&(0,B.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,B.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),H.map(e=>(0,B.jsx)(`div`,{children:(0,B.jsx)(ce,{s:e})},F(e))),V.length>be&&(0,B.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":d,onClick:()=>f(e=>!e),children:d?`Show fewer`:`Show all ${V.length}`})]}),o.f!==`needs`&&(0,B.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:Y,children:q.map(e=>(0,B.jsxs)(`section`,{className:`card act-day`,children:[(0,B.jsxs)(`h3`,{className:`act-day-h`,children:[(0,B.jsx)(`span`,{children:e.title}),(0,B.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,B.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,B.jsx)(ve,{job:e,longest:J},e.id)),e.gate&&(0,B.jsx)(ye,{gate:e.gate})]})]},e.key))})]})}export{Se 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-DLDVY3K-.js";import{s as i}from"./motion-RlUl1osO.js";import{A as a,B as o,D as s,Et as c,F as l,G as u,I as d,L as f,N as p,O as m,P as h,R as g,bt as _,it as v,j as y,k as b,ot as ee,rt as te,u as ne,wt as x}from"./index-BQwOmbor.js";import{t as S}from"./EmptyState-CY5Pm2xy.js";import{_ as C,a as w,c as T,f as E,g as D,h as O,i as k,l as A,m as re,n as j,o as M,p as N,r as P,s as F,t as I,u as L,v as R}from"./Bonsai-hiG_gGNU.js";import{t as ie}from"./usePoll-o8ul-Sog.js";var z=e(t(),1),B=n(),V=4,H=56*V,U=24,W=165,G=188,K=(e,t)=>e>0?Math.max(1,Math.floor((e-32+U)/(H+U))):Math.max(1,t),q=e=>e.status===`blocked`?`bad`:l(e)?`warn`:e.status===`busy`?`ok`:``,J=e=>{let t=A(e);return t==null?null:Math.round(t*100)};function Y(e,t,n){let r=s[e.status]||s.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=J(e);return[`${e.title||y(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 X({s:e,t,mine:n}){let r=J(e);return(0,B.jsxs)(`div`,{className:`card gd-card`,children:[(0,B.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`model`}),(0,B.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,B.jsx)(`dt`,{children:`turns`}),(0,B.jsx)(`dd`,{children:e.turns||0}),(0,B.jsx)(`dt`,{children:`context`}),(0,B.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,B.jsx)(`dt`,{children:`compactions`}),(0,B.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,B.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,B.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 Z({s:e,worktree:t,sakura:n,mine:r,pad:i,onHover:a}){let o=R(e,n),c=(0,z.useMemo)(()=>E(e,{sakura:n}),[o]),u=s[e.status]||s.idle,d=Array.isArray(e.loops)?e.loops[0]:null,f=e.status!==`idle`,p=F(e),m=e.title||y(e.cwd)||e.session_id,h=J(e),g=(0,z.useRef)(null),_=(0,z.useCallback)(e=>a(p,e,Q(g.current)),[a,p]);return(0,B.jsxs)(`a`,{ref:g,className:`gd-tree${l(e)?` gd-needs`:``}`,href:e.href||L(e.session_id),"aria-label":Y(e,c,r),"data-sid":e.session_id,onMouseEnter:e=>a(p,null,Q(e.currentTarget)),onMouseLeave:()=>a(null,null),onFocus:e=>a(p,null,Q(e.currentTarget)),onBlur:()=>a(null,null),onKeyDown:e=>k(e,c.pads.length,i,_),children:[(0,B.jsx)(P,{t:c,pad:i,swaying:f,onPad:_,px:V}),(0,B.jsxs)(`div`,{className:`gd-cap`,children:[(0,B.jsx)(`div`,{className:`gd-title`,title:m,children:m}),(0,B.jsxs)(`div`,{className:`row wrap gd-pills`,children:[(0,B.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip||e.host||`?`}),(0,B.jsx)(`span`,{className:`badge ${q(e)}`,children:u.label}),t&&(0,B.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),d&&(0,B.jsxs)(`span`,{className:`badge`,children:[`↻ `,d.title,d.iteration==null?``:` ${d.iteration}`]}),e.attribution===!1&&(0,B.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`})]}),(0,B.jsxs)(`div`,{className:`mono gd-meta`,children:[e.turns||0,` turns`,h==null?``:` · ${h}%`]})]})]})}function ae({pairs:e,count:t}){if(!e.length)return null;let n=t*H+(t-1)*U,r=e=>e*(H+U)+H/2;return(0,B.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*V+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,B.jsxs)(`g`,{className:o,children:[(0,B.jsx)(`path`,{d:`M${e} ${W} C${n} 179 ${n} 159 ${t} 169`}),(0,B.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${W}`})]},`${i}-${a}`)}return(0,B.jsx)(`g`,{className:o,children:(0,B.jsx)(`path`,{d:`M${r(i)} ${G} Q${(r(i)+r(a))/2} 222 ${r(a)} ${G}`})},`${i}-${a}`)})})}var Q=e=>e.offsetLeft;function oe({sessions:e,collisions:t}){let[n,r]=(0,z.useState)(M),[i,a]=(0,z.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(j,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=T(N(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>D(e,s);return(0,B.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,B.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,B.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,B.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Pink blossom`})]}),l.length>0&&(0,B.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,B.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,B.jsx)(se,{sh:e,sakura:n,cols:s,mineOf:u},e.key))]})}function se({sh:e,sakura:t,cols:n,mineOf:r}){let[i,a]=(0,z.useState)({sid:null,pad:null,x:0}),o=(0,z.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(0);(0,z.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=K(c,e.trees.length),d=C(e.trees,n),f=[];for(let t=0;t<e.trees.length;t+=u)f.push(t);let p=e.trees.findIndex(e=>F(e.s)===i.sid),m=p<0?null:e.trees[p].s,h=m?E(m,{sakura:t}):null,g=h&&i.pad!=null?h.pads[i.pad]:null,_=e.trees.length;return(0,B.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,B.jsxs)(`div`,{className:`gd-row`,children:[(0,B.jsx)(`div`,{className:`gd-plank`,children:n===0&&(0,B.jsxs)(`h3`,{className:`gd-plate`,children:[e.name,` · `,_,` session`,_===1?``:`s`]})}),a.map(({s:e,worktree:n})=>(0,B.jsx)(Z,{s:e,worktree:n,sakura:t,mine:r(F(e)),pad:F(e)===i.sid?i.pad:null,onHover:o},F(e))),(0,B.jsx)(ae,{pairs:c,count:a.length}),m&&p>=n&&p<s&&(0,B.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:g?(0,B.jsx)(I,{pad:g}):(0,B.jsx)(X,{s:m,t:h,mine:r(F(m))})})]},n)}),(0,B.jsx)(`span`,{className:`sr-only`,role:`status`,children:w(g)})]})}var $=e=>e.catch(()=>null);function ce({s:e}){let t=(0,z.useId)(),n=e.todos,r=h(e);return(0,B.jsxs)(`a`,{className:`card pad-md act-card`,href:e.href||L(e.session_id),"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,B.jsxs)(m,{s:e,id:t,heading:e.title||y(e.cwd)||e.session_id,children:[e.chip&&(0,B.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip}),(0,B.jsx)(_,{name:`chevron`,className:`glyph act-chev`})]}),n&&n.total>0&&(0,B.jsx)(`div`,{className:`act-foot`,children:(0,B.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,B.jsx)(a,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,B.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,x(e.updated_at),` ago`]})]})}var le={blocked:`is blocked`,"waiting-input":`waits for your answer`};function ue(e,t){if(!Array.isArray(t))return``;let n=t.filter(l),r=e.current;return e.current=new Set(n.map(e=>`${F(e)}:${e.status}`)),r?n.filter(e=>!r.has(`${F(e)}:${e.status}`)).map(e=>`${e.title||y(e.cwd)||e.session_id} ${le[e.status]}`).join(`. `):``}var de=[[`all`,`All`],[`needs`,`Needs you`],[`runs`,`Runs`],[`gates`,`Gate asks`]];function fe(){let e=new URLSearchParams(window.location.hash.split(`?`)[1]||``),t=e.get(`f`);return{f:de.some(([e])=>e===t)?t:`all`,host:e.get(`host`)||``,project:e.get(`project`)||``,v:e.get(`v`)===`list`?`list`:`garden`}}function pe(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 me({enabled:e,installs:t,onToggle:n}){let r=re(t);return(0,B.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,B.jsx)(_,{name:`activity`,className:`glyph act-fixed`}),(0,B.jsxs)(`div`,{className:`act-grow`,children:[(0,B.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,B.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,B.jsxs)(`ul`,{className:`stack gap-8 act-fixed act-sm`,"aria-label":`Tracking per install`,children:[t.length===0&&(0,B.jsx)(`li`,{className:`dim`,children:`No active install to track.`}),t.map((e,t)=>(0,B.jsxs)(`li`,{className:`row gap-10`,children:[(0,B.jsxs)(`span`,{id:`act-track-l${t}`,title:e.path,children:[`Track live sessions in `,(0,B.jsx)(`span`,{className:`mono`,children:r.get(e.install)})]}),(0,B.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 he({jobs:e,loading:t}){let n=typeof e?.cap==`number`?e.cap:void 0,r=d(e?.jobs,{days:14,cap:n}),i=g(r.map(e=>e.nodata?`-`:e.n).join(`,`),`scaleY`),a=Math.max(1,...r.map(e=>e.n)),o=r.reduce((e,t)=>e+t.n,0),s=r.find(e=>!e.nodata),c=r.some(e=>e.nodata),l=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${f(e.key)}`).join(`, `)||`none`}.`+(c?s?` Days before ${f(s.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,B.jsxs)(`div`,{className:`act-stat-head`,children:[(0,B.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,B.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,B.jsx)(v,{label:`Reading the job log…`}):e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":l,ref:i,children:r.map(e=>e.nodata?(0,B.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,B.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${f(e.key)}: ${e.n}`},e.key):(0,B.jsx)(`i`,{className:`zero`},e.key))}),(0,B.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,B.jsx)(`span`,{children:f(r[0].key)}),(0,B.jsx)(`span`,{children:f(r[7].key)}),(0,B.jsx)(`span`,{children:`today`})]}),c&&(0,B.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,B.jsx)(`p`,{className:`dim act-sm`,children:`The job log could not be read.`})]})}function ge({rows:e,gates:t,loading:n}){let r=e.reduce((e,t)=>e+t.n,0);return(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,B.jsxs)(`div`,{className:`act-stat-head`,children:[(0,B.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,B.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,B.jsx)(v,{label:`Reading the gate ledger…`}):e.length?(0,B.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,B.jsx)(b,{vals:e.per_day,i:t,sweep:!0}),(0,B.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,B.jsx)(`p`,{className:`dim act-sm`,children:t?`No gate asked in 30 days.`:`The gate ledger could not be read.`})]})}var _e={done:[`ok`,`done`],failed:[`bad`,`failed`],running:[``,`running`]};function ve({job:e,longest:t}){let n=o(e),r=e.duration?Math.round(e.duration*10)/10:0,[i,a]=_e[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,B.jsxs)(`li`,{className:`act-row`,children:[(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:c}),(0,B.jsx)(_,{name:`play`,className:`glyph act-glyph`}),(0,B.jsxs)(`span`,{className:`act-what`,children:[(0,B.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,B.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,B.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":s,children:(0,B.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,B.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function ye({gate:e}){return(0,B.jsxs)(`li`,{className:`act-row gate`,children:[(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,B.jsx)(_,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,B.jsxs)(`span`,{className:`act-what`,children:[(0,B.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,B.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,B.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`badge warn`,children:`asked`})]})}var be=5,xe=(e,t)=>[...new Set([...e.filter(Boolean),t].filter(Boolean))];function Se(){let[e,t]=(0,z.useState)(null),[n,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(fe),[d,f]=(0,z.useState)(!1),[m,h]=(0,z.useState)(``),_=(0,z.useRef)(null),b=e=>{let t={...o,...e};s(t),pe(t)};ie(e=>r.activity().then(n=>{if(e()){t(n),a(``);let e=ue(_,n?.activity);e&&h(t=>t===e?e+`\xA0`:e)}},t=>{e()&&a(t.message)}),2e3,[]);let x=c(()=>$(r.jobs()),[]),C=c(()=>$(r.gates()),[]),w=c(()=>$(r.catalog(`laws`)),[]),T=!e||e.enabled!==!1,E=Array.isArray(e?.installs)?e.installs:[],D=O(e?.activity,E).sort((e,t)=>e.session_id<t.session_id?-1:+(e.session_id>t.session_id)),k=i(),A=T&&e?D.filter(l).length:null,re=new Set(D.map(F)),j=o.v===`list`?O(e?.ended,E).filter(e=>!re.has(F(e))):[],M=xe([...D,...j].map(e=>e.host),o.host),N=xe([...D,...j].map(e=>y(e.cwd)),o.project),P=o.host&&o.project?`host or project`:o.host?`host`:o.project?`project`:``,I=e=>(!o.host||e.host===o.host)&&(!o.project||y(e.cwd)===o.project),L=D.filter(e=>I(e)&&(o.f!==`needs`||l(e))),R=o.f===`all`||o.f===`needs`,V=o.f===`all`&&T?j.filter(I):[],H=d?V:V.slice(0,be),U=!P&&(o.f===`all`||o.f===`runs`),W=!P&&(o.f===`all`||o.f===`gates`),G=x.data?.jobs||[],K=ne(C.data,w.data),q=p(G,K,C.data?.days).map(e=>({...e,runs:U?e.runs:[],gate:W?e.gate:null})).filter(e=>e.runs.length||e.gate),J=Math.max(0,...G.map(e=>e.duration||0)),Y=g(q.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),X=async e=>{let n=!e.enabled;try{let i=await r.activityToggle(n,{host:e.host,path:e.path});if(i.ok===!1){a(i.error||`Could not change tracking`);return}let o=t=>i.enabled?t||[]:(t||[]).flatMap(t=>{let n=(t.installs||[t.install]).filter(t=>t!==e.install);return n.length?[{...t,install:n[0],installs:n}]:[]});t(t=>{let n=(t?.installs||[]).map(t=>t.install===e.install?{...t,enabled:i.enabled}:t);return{...t||{},installs:n,enabled:n.length===0||n.some(e=>e.enabled),activity:o(t?.activity),ended:o(t?.ended)}}),a(``)}catch(e){a(e.message)}},Z=(e,t,n)=>(0,B.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,B.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,B.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:o[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>b({[e]:t.target.value}),children:[(0,B.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]});return(0,B.jsxs)(`div`,{className:`page-fill`,children:[(0,B.jsx)(u,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,B.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:m}),n&&(0,B.jsx)(`div`,{className:`act-gap`,children:(0,B.jsx)(te,{error:n})}),e&&(0,B.jsx)(me,{enabled:T,installs:E,onToggle:X}),(0,B.jsxs)(`div`,{className:`act-today`,children:[(0,B.jsx)(he,{jobs:x.data,loading:x.loading}),(0,B.jsx)(ge,{rows:K,gates:C.data,loading:C.loading}),(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,B.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),!e&&!n?(0,B.jsx)(v,{}):e?(0,B.jsxs)(B.Fragment,{children:[T?(0,B.jsxs)(`span`,{className:`act-big act-wait`,children:[A,` `,(0,B.jsx)(`span`,{className:`dim act-sm`,children:A===1?`session`:`sessions`})]}):null,(0,B.jsx)(`p`,{className:`dim act-sm`,children:T?`A session that waits on an approval or on your answer counts here.`:`Turn tracking on to count the sessions that wait on you.`})]}):(0,B.jsx)(`p`,{className:`dim act-sm`,children:`The sessions could not be read.`})]})]}),(0,B.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,B.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:de.map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,className:o.f===e?`chip-f on`:`chip-f`,"aria-pressed":o.f===e,onClick:()=>b({f:e}),children:[t,e===`needs`&&A>0?(0,B.jsxs)(`span`,{className:`mono`,children:[` `,A]}):null]},e))}),Z(`host`,`Host`,M),Z(`project`,`Project`,N),(0,B.jsx)(ee,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,className:o.v===e?`on`:``,"aria-pressed":o.v===e,onClick:()=>b({v:e}),children:t},e))})]}),P&&o.f!==`needs`&&(0,B.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,P,`; showing sessions only.`]}),R&&(e?!T&&o.f!==`needs`?null:L.length===0?o.f===`needs`?(0,B.jsx)(S,{title:`Nothing waits on you`}):(0,B.jsx)(S,{title:`No active sessions`,children:`Start an agent session and it appears here.`}):o.v===`garden`?(0,B.jsx)(oe,{sessions:L,collisions:e.collisions}):(0,B.jsx)(`div`,{className:`stack gap-12 act-live`,ref:k,children:L.map(e=>(0,B.jsx)(`div`,{"data-flip":F(e),children:(0,B.jsx)(ce,{s:e})},F(e)))}):(0,B.jsx)(v,{label:`Reading live sessions…`})),V.length>0&&(0,B.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,B.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),H.map(e=>(0,B.jsx)(`div`,{children:(0,B.jsx)(ce,{s:e})},F(e))),V.length>be&&(0,B.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":d,onClick:()=>f(e=>!e),children:d?`Show fewer`:`Show all ${V.length}`})]}),o.f!==`needs`&&(0,B.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:Y,children:q.map(e=>(0,B.jsxs)(`section`,{className:`card act-day`,children:[(0,B.jsxs)(`h3`,{className:`act-day-h`,children:[(0,B.jsx)(`span`,{children:e.title}),(0,B.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,B.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,B.jsx)(ve,{job:e,longest:J},e.id)),e.gate&&(0,B.jsx)(ye,{gate:e.gate})]})]},e.key))})]})}export{Se 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-DLDVY3K-.js";import{F as i,G as a,M as o,O as s,bt as c,it as l,j as u,rt as d,wt as f}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-DLDVY3K-.js";import{F as i,G as a,M as o,O as s,bt as c,it as l,j as u,rt as d,wt as f}from"./index-BQwOmbor.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{a as m,d as h,f as g,i as _,l as v,o as y,r as b,t as x,v as S}from"./Bonsai-hiG_gGNU.js";import{t as C}from"./usePoll-o8ul-Sog.js";var w=e(t(),1),T=n();function E(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 D({rec:e}){let t=e.who===`you`,n=[];t||(e.kind===`tool`&&e.ms!=null&&n.push(`${(e.ms/1e3).toFixed(1)}s`),e.kind===`step`&&(e.tokens&&n.push(`${o(e.tokens)} tok`),e.cost&&n.push(`$${e.cost.toFixed(2)}`)),e.kind===`subtask`&&e.agent&&n.unshift(e.agent));let r=!t&&(e.kind===`text`||e.kind===`thinking`||e.kind===`step`),i=t?e.text:e.label||e.snippet||e.kind;return(0,T.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,T.jsx)(`span`,{className:`badge act-who ${t?``:`acc`}`,children:t?`you`:`agent`}),(0,T.jsxs)(`div`,{className:`act-grow act-sm`,children:[!t&&(0,T.jsx)(`span`,{className:`feed-dot act-inline-dot ${E(e)||`acc`}`}),e.kind===`thinking`&&(0,T.jsx)(`span`,{className:`dim`,children:`thinking: `}),r?(0,T.jsx)(`span`,{className:`dim`,children:i}):t?i:(0,T.jsx)(`b`,{children:i}),e.error&&(0,T.jsxs)(`span`,{className:`dim`,children:[`: `,e.error]})]}),n.length>0&&(0,T.jsx)(`span`,{className:`dim mono act-xs act-fixed`,children:n.join(` · `)}),e.t?(0,T.jsx)(`time`,{className:`mono dim act-xs act-fixed`,dateTime:new Date(e.t).toISOString(),title:`${f(e.t/1e3)} ago`,children:new Date(e.t).toTimeString().slice(0,8)}):null]})}function O({turns:e}){return!e||e.length===0?(0,T.jsx)(`div`,{className:`dim act-sm`,children:`No conversation captured yet.`}):(0,T.jsx)(`div`,{className:`stack gap-12`,children:e.map((e,t)=>{let n=e.role===`user`;return(0,T.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,T.jsx)(`span`,{className:`badge act-who ${n?``:`acc`}`,children:n?`you`:`agent`}),(0,T.jsx)(`div`,{className:`act-min act-sm${n?``:` muted`}`,children:e.text})]},t)})})}var k=5;function A({s:e}){let[t]=(0,w.useState)(y),[n,r]=(0,w.useState)(null),a=!!e.ended,o=a?{...e,status:i(e)?`busy`:e.status,error:null}:e,s=S(o,t),c=(0,w.useMemo)(()=>g(o,{sakura:t}),[s]),l=(0,w.useCallback)(e=>r(e),[]),u=v(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} ${a?`unfinished`:`running`}, ${c.fallen.length} finished`].join(` · `),h=n==null?null:c.pads[n];return(0,T.jsxs)(`div`,{className:`card pad-md act-mt gd-detail${!a&&i(e)?` gd-needs`:``}`,children:[(0,T.jsx)(`div`,{role:`group`,tabIndex:0,"aria-label":`Bonsai pads, arrow keys walk them`,onKeyDown:e=>_(e,c.pads.length,n,l),children:(0,T.jsx)(b,{t:c,pad:n,swaying:!a&&e.status!==`idle`,onPad:l,px:k,label:`Bonsai of this session${a?`, ended`:``}: ${p}`})}),(0,T.jsxs)(`div`,{className:`stack gap-8 act-min`,children:[a&&(0,T.jsx)(`span`,{className:`dim act-xs`,children:`ended`}),(0,T.jsx)(`div`,{className:`dim act-sm`,children:p}),(0,T.jsx)(`span`,{className:`sr-only`,role:`status`,children:m(h)}),h?(0,T.jsx)(x,{pad:h}):(0,T.jsx)(`div`,{className:`dim act-xs`,children:`Hover or tap a pad, or use the arrow keys, for its files.`})]})]})}function j({sid:e}){let{sid:t,install:n}=h(e,window.location.hash),[i,o]=(0,w.useState)(null),[m,g]=(0,w.useState)(``),[_,v]=(0,w.useState)(!1),[y,b]=(0,w.useState)(!1),x=(0,w.useId)();C(e=>_?void 0:r.activityDetail(t,n).then(t=>{e()&&(o(t),g(``),v(!1))},t=>{e()&&(t.status===404?v(!0):g(t.message))}),2e3,[t,_]);let S=(0,T.jsxs)(`a`,{className:`btn ghost sm act-back`,href:`#/activity`,children:[(0,T.jsx)(c,{name:`arrow`}),` Activity`]});if(_)return(0,T.jsxs)(`div`,{className:`page-fill`,children:[S,(0,T.jsx)(p,{title:`Session ended`,action:(0,T.jsx)(`a`,{href:`#/activity`,children:`Back to Activity`}),children:`It's no longer live.`})]});if(!i)return(0,T.jsxs)(`div`,{className:`page-fill`,children:[S,m?(0,T.jsx)(d,{error:m}):(0,T.jsx)(l,{label:`Loading session…`})]});let E=i.session,k=E.files,j=E.todos,M=!!(k&&k.items&&k.items.length>0),N=!!(j&&j.items&&j.items.length>0),P=i.conversation||[],F=i.timeline||[],I=[...P.filter(e=>e.role===`user`).map(e=>({who:`you`,text:e.text,t:e.t||0})),...F.map(e=>({...e,who:`agent`}))].sort((e,t)=>(e.t||0)-(t.t||0));return(0,T.jsxs)(`div`,{className:`page-fill`,children:[S,(0,T.jsx)(a,{title:E.title||u(E.cwd)||E.session_id,sub:E.cwd?(0,T.jsx)(`span`,{className:`mono act-cwd`,title:E.cwd,children:E.cwd}):null}),m&&(0,T.jsx)(`div`,{className:`act-gap`,children:(0,T.jsx)(d,{error:m})}),(0,T.jsxs)(`div`,{className:`card pad-md`,children:[(0,T.jsx)(s,{s:E}),(0,T.jsxs)(`div`,{className:`dim act-updated`,children:[`updated `,f(E.updated_at),` ago`]})]}),(0,T.jsx)(A,{s:E}),(M||N)&&(0,T.jsxs)(`div`,{className:`grid gap-12 act-panels${M&&N?` two`:``}`,children:[M&&(0,T.jsxs)(`div`,{className:`card pad-md`,children:[(0,T.jsx)(`div`,{className:`card-head`,children:(0,T.jsxs)(`h2`,{children:[`Files touched `,(0,T.jsxs)(`span`,{className:`dim`,children:[`(`,k.count,`)`]})]})}),(0,T.jsx)(`div`,{className:`stack act-list`,children:k.items.map(e=>(0,T.jsxs)(`div`,{className:`row between gap-12 act-sm`,children:[(0,T.jsx)(`span`,{className:`mono act-ell act-grow`,title:e.file,children:e.file}),(0,T.jsxs)(`span`,{className:`act-fixed`,children:[(0,T.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions]}),` `,(0,T.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions]})]})]},e.file))})]}),N&&(0,T.jsxs)(`div`,{className:`card pad-md`,children:[(0,T.jsx)(`div`,{className:`card-head`,children:(0,T.jsxs)(`h2`,{children:[`Plan`,` `,(0,T.jsxs)(`span`,{className:`dim`,children:[`(`,j.done,`/`,j.total,`)`]})]})}),(0,T.jsx)(`div`,{className:`stack act-list`,children:j.items.map((e,t)=>(0,T.jsxs)(`div`,{className:`row gap-8 act-sm`,children:[(0,T.jsx)(`span`,{className:`feed-dot ${e.status===`completed`?`ok`:e.status===`in_progress`?`acc`:``}`}),(0,T.jsx)(`span`,{className:e.status===`completed`?`act-done`:void 0,children:e.content})]},t))})]})]}),(0,T.jsxs)(`div`,{className:`card pad-md act-mt`,children:[(0,T.jsxs)(`div`,{className:`card-head act-tl-head`,children:[(0,T.jsx)(`h2`,{children:`Timeline`}),F.length>0&&(0,T.jsx)(`button`,{className:`btn ghost sm`,"aria-expanded":y,"aria-controls":x,onClick:()=>b(e=>!e),children:y?`Show conversation`:`Show full stream (${I.length})`})]}),(0,T.jsx)(`div`,{id:x,children:y?(0,T.jsx)(`div`,{className:`stack gap-12`,children:I.map((e,t)=>(0,T.jsx)(D,{rec:e},t))}):(0,T.jsx)(O,{turns:P})})]})]})}export{A as SessionTree,j 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{ht as r}from"./index-DsLmKHw0.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{ht as r}from"./index-BQwOmbor.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{bt 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{bt as r}from"./index-BQwOmbor.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};
|