@agentproto/apps 0.15.0 → 0.17.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/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/review-panel/panel.d.ts +11 -2
- package/dist/review-panel/panel.d.ts.map +1 -1
- package/dist/review-panel/panel.generated.d.ts +1 -1
- package/dist/review-panel/panel.generated.d.ts.map +1 -1
- package/dist/review-panel/panel.mjs +1 -1
- package/dist/review-panel/panel.mjs.map +1 -1
- package/dist/review-panel.mjs +1 -1
- package/dist/review-panel.mjs.map +1 -1
- package/package.json +8 -7
- package/repo-maintenance/.agentproto/agents/repo-maintenance-reviewer/AGENT.md +1 -1
- package/repo-maintenance/.agentproto/workflows/maintain/WORKFLOW.md +24 -6
- package/repo-maintenance/.agentproto/workflows/maintain/entry.mjs +35 -9
- package/repo-maintenance/README.md +7 -2
- package/repo-maintenance/routines/repo-maintenance-daily/ROUTINE.md +2 -2
- package/session-steward/.agentproto/APP.md +20 -0
- package/session-steward/.agentproto/agents/session-steward-judge/AGENT.md +43 -0
- package/session-steward/.agentproto/workflows/session-steward/WORKFLOW.md +277 -0
- package/session-steward/.agentproto/workflows/session-steward/entry.mjs +705 -0
- package/session-steward/README.md +70 -0
- package/session-steward/routines/session-steward-hourly/ROUTINE.md +68 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Session Steward
|
|
2
|
+
|
|
3
|
+
A built-in agentproto app that wraps up idle agent sessions. It sits on top
|
|
4
|
+
of the runtime's `session_wrapup_plan` / `session_wrapup_apply` tools
|
|
5
|
+
(FIX-9A) and adds the missing loop: a cheap judge for the ambiguous
|
|
6
|
+
sessions. Hand-authored bundle (`.agentproto/APP.md` + `agents/` +
|
|
7
|
+
`workflows/`), like `repo-maintenance` — the workflow's decisions (candidate
|
|
8
|
+
split, strict verdict parse, confidence threshold, report) are real
|
|
9
|
+
functions in `workflows/session-steward/entry.mjs`, which only the `entry:`
|
|
10
|
+
loader path can carry.
|
|
11
|
+
|
|
12
|
+
## What one run does
|
|
13
|
+
|
|
14
|
+
1. `plan` — `session_wrapup_plan { idleMinutes }` (dry run).
|
|
15
|
+
2. `autoApply` (only with `apply`) — `close` ids →
|
|
16
|
+
`session_wrapup_apply { verdict: "done", note: "steward-rules: …" }`,
|
|
17
|
+
`stuck` ids → `{ verdict: "abandoned" }`.
|
|
18
|
+
3. `evidence` — per `judge` candidate (at most `maxJudged`, most RAM first),
|
|
19
|
+
the read-only `session_evidence` tool: label, cwd, idle, keepAlive, RAM,
|
|
20
|
+
the plan's signals, the last ~10 turns (~3 KB), and worktree
|
|
21
|
+
branch/dirty/ahead/behind/PR. Under ~5 KB per session.
|
|
22
|
+
4. `judge` — per candidate, backend picked by `judge` (default `auto`):
|
|
23
|
+
- **Jev** (`auto` when `JEV_API_KEY` resolves — daemon env, else the host
|
|
24
|
+
secret resolver — or `judge: "jev"`): one `session_judge_jev` call, a
|
|
25
|
+
calibrated `choice` over the five verdicts with the evidence as state;
|
|
26
|
+
confidence = the chosen verdict's probability, full probabilities in the
|
|
27
|
+
report, `judgedBy: jev:<jevModel>`.
|
|
28
|
+
- **Agent** (`judge: "agent"`, `auto` without a key, or any Jev failure
|
|
29
|
+
for that session — reported as such): one turn of
|
|
30
|
+
`@agentproto/session-steward-judge` on `judgeModel` (default: the `judge.session` model role — explicit input > repo `agentproto.json` `models` > daemon config `models` > built-in sonnet; see `model_roles`),
|
|
31
|
+
strict JSON verdict. A malformed reply is `active`, confidence 0. The
|
|
32
|
+
judge session is released (killed + archived) when its item settles.
|
|
33
|
+
Verdicts: `done|abandoned|blocked|needs-input|active`. A judge error never
|
|
34
|
+
closes anything.
|
|
35
|
+
5. `ask` (only with `askSessions`) — low-confidence, idle, non-keepAlive,
|
|
36
|
+
not-awaiting-input sessions get ONE prompt asking them to reply
|
|
37
|
+
`STEWARD: DONE …` / `STEWARD: NOT-DONE …`; a ~3 min bounded wait; the
|
|
38
|
+
answer becomes a `declared` verdict.
|
|
39
|
+
6. `judgedApply` (only with `apply`) — confident `done`/`abandoned` close
|
|
40
|
+
(resumable, with a recorded outcome); confident `blocked`/`needs-input`
|
|
41
|
+
only flag. Everything else is left alone and reported.
|
|
42
|
+
7. `report` — markdown table (class, session, idle, RAM, verdict,
|
|
43
|
+
confidence, reason, action) plus RAM freed / still held.
|
|
44
|
+
|
|
45
|
+
## Running it
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
agentproto steward --wait # dry run: plan + verdicts, report
|
|
49
|
+
agentproto steward --apply --wait # close / flag confident verdicts
|
|
50
|
+
agentproto steward --apply --idle 60 --min-confidence 0.9 --judge agent
|
|
51
|
+
agentproto steward --ask-sessions --wait # also ask low-confidence sessions
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`agentproto steward` installs (upserts) this app and starts the workflow via
|
|
55
|
+
`workflow_run_file`; it passes `AGENTPROTO_SESSION_ID` as `callerSessionId`
|
|
56
|
+
so a run never judges the session that started it. Or call the daemon
|
|
57
|
+
directly:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
agentproto app install packages/apps/session-steward
|
|
61
|
+
agentproto workflow run-file \
|
|
62
|
+
packages/apps/session-steward/.agentproto/workflows/session-steward/WORKFLOW.md \
|
|
63
|
+
--input-json '{"apply": false}'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Routine
|
|
67
|
+
|
|
68
|
+
`routines/session-steward-hourly` is an AIP-41 `ROUTINE.md` template: hourly,
|
|
69
|
+
`apply: true`, `askSessions: false`, shipped `enabled: false` — nothing
|
|
70
|
+
starts closing sessions on install. Its own doc lists the enabling steps.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
schema: routine/v1
|
|
3
|
+
id: session-steward-hourly
|
|
4
|
+
description: |
|
|
5
|
+
Hourly APPLY pass of the `session-steward` workflow — `apply: true`,
|
|
6
|
+
`askSessions: false`: closes rule-certain idle sessions (`close`/`stuck`),
|
|
7
|
+
judges the ambiguous ones (Jev when JEV_API_KEY resolves, else the one-shot
|
|
8
|
+
agent judge), and closes or flags confident verdicts with a recorded,
|
|
9
|
+
resumable outcome. Never asks a session anything. Ships DISABLED
|
|
10
|
+
(`enabled: false`) — nothing starts closing sessions on install; install it
|
|
11
|
+
into a workspace's `.routines/` and flip `enabled: true` to activate.
|
|
12
|
+
version: "1.0.0"
|
|
13
|
+
schedule:
|
|
14
|
+
kind: cron
|
|
15
|
+
cron: "0 * * * *"
|
|
16
|
+
timezone: "UTC"
|
|
17
|
+
catchup: skip
|
|
18
|
+
target:
|
|
19
|
+
workflow:
|
|
20
|
+
file: <absolute-path-to-agentproto-ts>/packages/apps/session-steward/.agentproto/workflows/session-steward/WORKFLOW.md
|
|
21
|
+
inputs:
|
|
22
|
+
apply: true
|
|
23
|
+
askSessions: false
|
|
24
|
+
retry:
|
|
25
|
+
max_attempts: 1
|
|
26
|
+
backoff: fixed
|
|
27
|
+
on_failure:
|
|
28
|
+
create_work_item: true
|
|
29
|
+
fire_event: session-steward.hourly.failed
|
|
30
|
+
fires_events:
|
|
31
|
+
- session-steward.hourly.completed
|
|
32
|
+
- session-steward.hourly.failed
|
|
33
|
+
enabled: false
|
|
34
|
+
tags: [session-steward, sessions, maintenance]
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
# Session steward — hourly apply
|
|
38
|
+
|
|
39
|
+
Runs every hour on the hour (UTC), firing the `session-steward` workflow
|
|
40
|
+
(`../../.agentproto/workflows/session-steward/WORKFLOW.md`) with
|
|
41
|
+
`apply: true` and `askSessions: false`. Every run:
|
|
42
|
+
|
|
43
|
+
1. Plans with `session_wrapup_plan` (idle ≥ 30 min by default).
|
|
44
|
+
2. Closes `close`-class sessions as `done` and `stuck`-class ones as
|
|
45
|
+
`abandoned` — resumable, with a recorded outcome.
|
|
46
|
+
3. Judges up to 15 `judge`-class sessions, most RAM first, and closes
|
|
47
|
+
(`done`/`abandoned`) or flags (`blocked`/`needs-input`) only verdicts at
|
|
48
|
+
confidence ≥ 0.8. Everything else is left alone and reported.
|
|
49
|
+
|
|
50
|
+
`keep`-class sessions, the caller's own session, and anything busy or
|
|
51
|
+
awaiting input are never touched (`session_wrapup_apply` re-checks every id
|
|
52
|
+
right before acting).
|
|
53
|
+
|
|
54
|
+
## Enabling
|
|
55
|
+
|
|
56
|
+
1. Run it by hand first and read the reports:
|
|
57
|
+
`agentproto steward --wait` (dry run), then `agentproto steward --apply --wait`.
|
|
58
|
+
2. Copy this directory to `<workspace>/.routines/session-steward-hourly/`.
|
|
59
|
+
3. Set `enabled: true` and point `target.workflow.file` at wherever
|
|
60
|
+
`session-steward/WORKFLOW.md` lives in that environment.
|
|
61
|
+
4. Optional: set `JEV_API_KEY` in the daemon's environment to judge with Jev.
|
|
62
|
+
5. Reload routines, or fire it once via `routine_trigger`.
|
|
63
|
+
|
|
64
|
+
## Failure routing
|
|
65
|
+
|
|
66
|
+
One attempt, then `on_failure` opens a work item and fires
|
|
67
|
+
`session-steward.hourly.failed`. A clean run fires
|
|
68
|
+
`session-steward.hourly.completed`.
|