@agentproto/apps 0.12.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/agents-overview/panel.mjs +14 -67
  2. package/dist/agents-overview/panel.mjs.map +1 -1
  3. package/dist/agents-overview.mjs +13 -68
  4. package/dist/agents-overview.mjs.map +1 -1
  5. package/dist/bin/sync.d.ts.map +1 -1
  6. package/dist/bin/sync.mjs +2374 -2
  7. package/dist/bin/sync.mjs.map +1 -1
  8. package/dist/bureau-sessions/panel.mjs +14 -67
  9. package/dist/bureau-sessions/panel.mjs.map +1 -1
  10. package/dist/bureau-sessions.mjs +13 -68
  11. package/dist/bureau-sessions.mjs.map +1 -1
  12. package/dist/config/fragment.d.ts +50 -0
  13. package/dist/config/fragment.d.ts.map +1 -0
  14. package/dist/config/index.d.ts +23 -0
  15. package/dist/config/index.d.ts.map +1 -0
  16. package/dist/config/ui.d.ts +43 -0
  17. package/dist/config/ui.d.ts.map +1 -0
  18. package/dist/config.mjs +2373 -0
  19. package/dist/config.mjs.map +1 -0
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.mjs +2706 -138
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/live-session/logic.d.ts +2 -0
  25. package/dist/live-session/logic.d.ts.map +1 -1
  26. package/dist/live-session/panel.d.ts.map +1 -1
  27. package/dist/live-session/panel.mjs +27 -74
  28. package/dist/live-session/panel.mjs.map +1 -1
  29. package/dist/live-session.mjs +26 -75
  30. package/dist/live-session.mjs.map +1 -1
  31. package/dist/panel-bridge.d.ts +11 -6
  32. package/dist/panel-bridge.d.ts.map +1 -1
  33. package/dist/session-chat/index.d.ts.map +1 -1
  34. package/dist/session-chat/panel.mjs +14 -67
  35. package/dist/session-chat/panel.mjs.map +1 -1
  36. package/dist/session-chat.mjs +28 -69
  37. package/dist/session-chat.mjs.map +1 -1
  38. package/dist/session-story/panel.mjs +14 -67
  39. package/dist/session-story/panel.mjs.map +1 -1
  40. package/dist/session-story.mjs +13 -68
  41. package/dist/session-story.mjs.map +1 -1
  42. package/dist/session-viewer/ui.d.ts.map +1 -1
  43. package/dist/session-viewer.mjs +10 -0
  44. package/dist/session-viewer.mjs.map +1 -1
  45. package/dist/sessions-panel/panel.d.ts.map +1 -1
  46. package/dist/sessions-panel/panel.mjs +15 -67
  47. package/dist/sessions-panel/panel.mjs.map +1 -1
  48. package/dist/sessions-panel.mjs +14 -68
  49. package/dist/sessions-panel.mjs.map +1 -1
  50. package/dist/work-board/panel.d.ts +1 -1
  51. package/dist/work-board/panel.d.ts.map +1 -1
  52. package/dist/work-board/panel.generated.d.ts +1 -1
  53. package/dist/work-board/panel.generated.d.ts.map +1 -1
  54. package/dist/work-board/panel.mjs +293 -62
  55. package/dist/work-board/panel.mjs.map +1 -1
  56. package/dist/work-board.mjs +293 -62
  57. package/dist/work-board.mjs.map +1 -1
  58. package/package.json +12 -4
  59. package/repo-maintenance/.agentproto/APP.md +22 -0
  60. package/repo-maintenance/.agentproto/agents/repo-maintenance-reviewer/AGENT.md +142 -0
  61. package/repo-maintenance/.agentproto/workflows/maintain/WORKFLOW.md +262 -0
  62. package/repo-maintenance/.agentproto/workflows/maintain/entry.mjs +672 -0
  63. package/repo-maintenance/README.md +80 -0
  64. package/repo-maintenance/routines/repo-maintenance-daily/ROUTINE.md +77 -0
  65. package/repo-maintenance/routines/repo-maintenance-weekly/ROUTINE.md +82 -0
@@ -0,0 +1,80 @@
1
+ # Repo Maintenance
2
+
3
+ A built-in agentproto app on top of `@agentproto/worktree`'s `branch_gc` /
4
+ `branch_gc_verdict` / `worktree_gc` tools. It ships as a hand-authored
5
+ bundled app (`.agentproto/APP.md` + `agents/` + `workflows/`) rather than a
6
+ `defineApp()`/`.emit()`-generated one, because the `maintain` workflow's
7
+ `review` map step needs a real run-time function to pick the reviewer's
8
+ model per candidate — see `workflows/maintain/entry.mjs`'s docblock for why
9
+ that requires the `entry:` loader path.
10
+
11
+ ## What it does
12
+
13
+ The `maintain` workflow, one run:
14
+
15
+ 1. `worktree_gc` + `branch_gc` plan (dry run — nothing is touched).
16
+ 2. Fans the `@agentproto/repo-maintenance-reviewer` agent out over the
17
+ unmerged branch candidates with no stored verdict yet — at most
18
+ `maxReviews` (default 40) per run, newest tip first, then the larger
19
+ residual; the rest wait for the next run (one turn per unique tip sha,
20
+ parallelism 4, each reviewer in its own disposable detached worktree
21
+ under the OS tmp dir, never the live checkout): haiku when the
22
+ candidate's residual is 3 files or fewer, sonnet otherwise. Three spawn
23
+ failures in a row stop the fan-out (the engine's circuit breaker) and
24
+ the report lists every distinct failure reason. Each turn records a verdict via `branch_gc_verdict` —
25
+ recording a verdict never deletes anything. A turn that ends without a
26
+ stored verdict for its tip (checked via `branch_gc_verdict_get`) gets
27
+ one re-prompt in the same session, then one retry on the large model.
28
+ 3. Re-plans `branch_gc` to confirm every candidate got a verdict, and
29
+ reports any gap, the verdict tally, and the `salvage` branches by name.
30
+ 4. If `applyMerged` is true: `worktree_gc` applies first (`salvageDirty:
31
+ false`) — removing a merged worktree frees its branch — then `branch_gc`
32
+ applies with `includeReviewed: false` (reclaim-class refs only — merged /
33
+ squash-merged / patch-merged / content-merged).
34
+ **A `review`-class branch is never reclaimed by this workflow, agreed
35
+ verdict or not** — see "Out of scope" below.
36
+ 5. Reports a markdown summary, and (only when `notify` is set AND there's a
37
+ reclaimable ref or a review candidate) sends it to an agentpush target.
38
+
39
+ ## Out of scope: the approval gate
40
+
41
+ Recording a verdict via `branch_gc_verdict` is a report, not a license to
42
+ delete. Reclaiming a `review`-class branch whose stored verdict agreed
43
+ (`branch_gc`'s `includeReviewed: true`) needs a human-in-the-loop
44
+ approval/escalation gate — deliberately not built here. `approve-reviewed`
45
+ is the documented, unwired seam for that gate; the workflow applies nothing
46
+ beyond `reclaim` refs, and only when `applyMerged` is true.
47
+
48
+ ## Installing
49
+
50
+ ```bash
51
+ agentproto app install packages/apps/repo-maintenance
52
+ ```
53
+
54
+ (or wherever this directory lands once installed from an npm-published
55
+ `@agentproto/apps` — see that package's README for the general install
56
+ story.) Then run it once ad-hoc:
57
+
58
+ ```bash
59
+ agentproto maintain --repo <path> # dry run: plan + review
60
+ agentproto maintain --repo <path> --apply-merged
61
+ ```
62
+
63
+ or via the daemon directly:
64
+
65
+ ```bash
66
+ agentproto workflow run-file \
67
+ packages/apps/repo-maintenance/.agentproto/workflows/maintain/WORKFLOW.md \
68
+ --input-json '{"repoRoot": "<path>", "applyMerged": false}'
69
+ ```
70
+
71
+ ## Routines
72
+
73
+ `routines/repo-maintenance-daily` (plan + review, `applyMerged: false`) and
74
+ `routines/repo-maintenance-weekly` (`applyMerged: true`) are AIP-41
75
+ `ROUTINE.md` templates targeting the `maintain` workflow, shipped
76
+ `enabled: false`. Each documents its own enabling steps — copy the directory
77
+ into a workspace's `.routines/`, point `target.workflow.file` at wherever
78
+ `maintain/WORKFLOW.md` lives in that environment, set `enabled: true`, and
79
+ reload routines. Enable the daily one first and watch it run clean a few
80
+ times before enabling weekly — only weekly deletes anything.
@@ -0,0 +1,77 @@
1
+ ---
2
+ schema: routine/v1
3
+ id: repo-maintenance-daily
4
+ description: |
5
+ Daily plan + review pass of the `maintain` workflow — `applyMerged: false`,
6
+ so it only classifies branches/worktrees and fans the reviewer agent out
7
+ over unmerged candidates; nothing is ever deleted by this routine. Notifies
8
+ only when there's something to report (a reclaimable ref or a review
9
+ candidate) and `notify` is configured. Ships DISABLED (`enabled: false`) —
10
+ install it into a workspace's `.routines/` and flip `enabled: true` to
11
+ activate.
12
+ version: "1.0.0"
13
+ schedule:
14
+ kind: cron
15
+ cron: "0 5 * * *"
16
+ timezone: "UTC"
17
+ catchup: skip
18
+ target:
19
+ workflow:
20
+ file: <absolute-path-to-agentproto-ts>/packages/apps/repo-maintenance/.agentproto/workflows/maintain/WORKFLOW.md
21
+ inputs:
22
+ applyMerged: false
23
+ notify:
24
+ channel: telegram
25
+ address: "<REPLACE_WITH_YOUR_TELEGRAM_CHAT_ID>"
26
+ retry:
27
+ max_attempts: 1
28
+ backoff: fixed
29
+ on_failure:
30
+ create_work_item: true
31
+ fire_event: repo-maintenance.daily.failed
32
+ fires_events:
33
+ - repo-maintenance.daily.completed
34
+ - repo-maintenance.daily.failed
35
+ enabled: false
36
+ tags: [repo-maintenance, branch-gc, worktree-gc, maintenance]
37
+ ---
38
+
39
+ # Repo maintenance — daily plan + review
40
+
41
+ Runs daily at **05:00 UTC**, firing the `maintain` workflow
42
+ (`../../.agentproto/workflows/maintain/WORKFLOW.md`) via `workflow_run_file`
43
+ with `applyMerged: false`. Every run:
44
+
45
+ 1. Plans `worktree_gc` and `branch_gc` (dry run — nothing is touched).
46
+ 2. Fans the `@agentproto/repo-maintenance-reviewer` agent out over every
47
+ unmerged branch candidate (haiku when its residual is 3 files or fewer,
48
+ sonnet otherwise), one turn per unique tip sha. Each turn records a
49
+ verdict via `branch_gc_verdict` — recording never deletes anything.
50
+ 3. Re-plans to confirm every candidate got a verdict, and reports the gaps.
51
+ 4. Reports a markdown summary, and notifies (when `notify` is configured)
52
+ ONLY if there was a reclaimable ref or a review candidate — a clean sweep
53
+ over an already-tidy repo doesn't page anyone.
54
+
55
+ Nothing this routine does can delete a branch, a worktree, or apply a
56
+ recorded verdict — see `repo-maintenance-weekly/ROUTINE.md` for the
57
+ apply-enabled sibling, and the `maintain` WORKFLOW.md's own doc for the
58
+ documented-but-unwired `approve-reviewed` seam.
59
+
60
+ ## Enabling
61
+
62
+ 1. Copy this directory to `<workspace>/.routines/repo-maintenance-daily/`.
63
+ 2. Set `enabled: true`, update `target.workflow.file` to wherever this repo's
64
+ `maintain/WORKFLOW.md` actually lives in that environment, and either
65
+ replace `target.inputs.notify` with your own agentpush target or delete
66
+ the `notify` key entirely to run silently (report only, no page).
67
+ 3. If `notify` is kept, allowlist `bash` in that workspace's
68
+ `.agentproto/allowed-commands.json` (the workflow's `notify` step needs
69
+ it) and set `AGENTPUSH_API_KEY` in the daemon's environment.
70
+ 4. Reload routines so the daemon registers the schedule, or fire it once
71
+ ad-hoc via `routine_trigger` without waiting for the schedule.
72
+
73
+ ## Failure routing
74
+
75
+ One retry attempt (no backoff), then `on_failure` opens a work item and
76
+ fires `repo-maintenance.daily.failed`. A clean run fires
77
+ `repo-maintenance.daily.completed`.
@@ -0,0 +1,82 @@
1
+ ---
2
+ schema: routine/v1
3
+ id: repo-maintenance-weekly
4
+ description: |
5
+ Weekly plan + review + APPLY pass of the `maintain` workflow —
6
+ `applyMerged: true`, so after the review agent runs, `branch_gc` (reclaim
7
+ class only, includeReviewed false) and `worktree_gc` execute their plans:
8
+ merged/squash-merged/patch-merged/content-merged branches and
9
+ merged-or-fresh+clean worktrees are reclaimed. `review`-class branches and
10
+ anything `hold` are NEVER touched by this routine — recording a verdict
11
+ does not by itself reclaim a branch (see the maintain workflow's
12
+ documented, unwired `approve-reviewed` seam). Ships DISABLED
13
+ (`enabled: false`) — install it into a workspace's `.routines/` and flip
14
+ `enabled: true` to activate.
15
+ version: "1.0.0"
16
+ schedule:
17
+ kind: cron
18
+ cron: "0 5 * * 0"
19
+ timezone: "UTC"
20
+ catchup: skip
21
+ target:
22
+ workflow:
23
+ file: <absolute-path-to-agentproto-ts>/packages/apps/repo-maintenance/.agentproto/workflows/maintain/WORKFLOW.md
24
+ inputs:
25
+ applyMerged: true
26
+ notify:
27
+ channel: telegram
28
+ address: "<REPLACE_WITH_YOUR_TELEGRAM_CHAT_ID>"
29
+ retry:
30
+ max_attempts: 1
31
+ backoff: fixed
32
+ on_failure:
33
+ create_work_item: true
34
+ fire_event: repo-maintenance.weekly.failed
35
+ fires_events:
36
+ - repo-maintenance.weekly.completed
37
+ - repo-maintenance.weekly.failed
38
+ enabled: false
39
+ tags: [repo-maintenance, branch-gc, worktree-gc, maintenance]
40
+ ---
41
+
42
+ # Repo maintenance — weekly plan + review + apply
43
+
44
+ Runs weekly, Sunday **05:00 UTC**, firing the same `maintain` workflow as
45
+ `repo-maintenance-daily/ROUTINE.md` but with `applyMerged: true`. Every run
46
+ does everything the daily routine does (plan, review fan-out, verdict-gap
47
+ check), then:
48
+
49
+ - `branch_gc` applies with `includeReviewed: false` — only `reclaim`-class
50
+ refs (merged / squash-merged / patch-merged / content-merged, by the same
51
+ ladder `branch_gc`'s own doc describes) are deleted. Every entry is
52
+ re-classified from scratch immediately before it's touched, so a plan that
53
+ went stale between the review pass and the apply is refused rather than
54
+ acted on. A restore log (sha + exact re-create command per deleted ref) is
55
+ written before the first delete.
56
+ - `worktree_gc` applies with `salvageDirty: false` — only merged/fresh AND
57
+ clean worktrees are reclaimed; a dirty-but-integrated worktree is left in
58
+ place.
59
+
60
+ **A `review`-class branch is never reclaimed by this routine, agreed verdict
61
+ or not.** Recording a verdict via `branch_gc_verdict` is a report, not a
62
+ license to delete — reclaiming a reviewed branch needs a human-in-the-loop
63
+ gate this codebase deliberately hasn't built yet (`approve-reviewed`, see the
64
+ `maintain` WORKFLOW.md's own doc).
65
+
66
+ ## Enabling
67
+
68
+ Same steps as `repo-maintenance-daily/ROUTINE.md`: copy this directory to
69
+ `<workspace>/.routines/repo-maintenance-weekly/`, set `enabled: true`, point
70
+ `target.workflow.file` at wherever `maintain/WORKFLOW.md` lives in that
71
+ environment, set or drop `target.inputs.notify`, allowlist `bash` +
72
+ `AGENTPUSH_API_KEY` if `notify` is kept, then reload routines.
73
+
74
+ Enable ONLY after you've watched `repo-maintenance-daily` run clean a few
75
+ times — this routine deletes branches and worktrees, the daily one never
76
+ does.
77
+
78
+ ## Failure routing
79
+
80
+ Same convention as the daily routine: one retry attempt (no backoff), then
81
+ `on_failure` opens a work item and fires `repo-maintenance.weekly.failed`. A
82
+ clean run fires `repo-maintenance.weekly.completed`.