@osolmaz/pi-workflows 0.12.0 → 0.13.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/README.md +56 -31
- package/dist/builtins/autodoc.workflow.d.ts +4 -4
- package/dist/builtins/autoimplement.workflow.d.ts +797 -142
- package/dist/builtins/autoimplement.workflow.js +17 -105
- package/dist/builtins/autoimplement.workflow.js.map +1 -1
- package/dist/builtins/autoplan.workflow.d.ts +126 -13
- package/dist/builtins/autoplan.workflow.js +200 -29
- package/dist/builtins/autoplan.workflow.js.map +1 -1
- package/dist/builtins/catalog.js +7 -5
- package/dist/builtins/catalog.js.map +1 -1
- package/dist/builtins/index.d.ts +4 -2
- package/dist/builtins/index.js +3 -1
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/monitor.workflow.d.ts +56 -23
- package/dist/builtins/monitor.workflow.js +508 -329
- package/dist/builtins/monitor.workflow.js.map +1 -1
- package/dist/builtins/pi-agent-group.d.ts +72 -0
- package/dist/builtins/pi-agent-group.js +1087 -0
- package/dist/builtins/pi-agent-group.js.map +1 -0
- package/dist/builtins/plain-summary.workflow.d.ts +32 -0
- package/dist/builtins/plain-summary.workflow.js +134 -0
- package/dist/builtins/plain-summary.workflow.js.map +1 -0
- package/dist/builtins/plan-approval.workflow.d.ts +39 -5
- package/dist/builtins/plan-approval.workflow.js +92 -14
- package/dist/builtins/plan-approval.workflow.js.map +1 -1
- package/dist/builtins/plan-change.workflow.d.ts +449 -0
- package/dist/builtins/plan-change.workflow.js +256 -0
- package/dist/builtins/plan-change.workflow.js.map +1 -0
- package/dist/builtins/plan-presentation.js +2 -2
- package/dist/builtins/plan-presentation.js.map +1 -1
- package/dist/builtins/sanity-check.workflow.d.ts +50 -6
- package/dist/builtins/sanity-check.workflow.js +150 -28
- package/dist/builtins/sanity-check.workflow.js.map +1 -1
- package/dist/controllers/effects.d.ts +3 -2
- package/dist/controllers/effects.js +8 -1
- package/dist/controllers/effects.js.map +1 -1
- package/dist/controllers/index.d.ts +1 -1
- package/dist/controllers/index.js +1 -1
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/manager.d.ts +1 -0
- package/dist/controllers/manager.js +41 -17
- package/dist/controllers/manager.js.map +1 -1
- package/dist/controllers/sqlite.d.ts +107 -85
- package/dist/controllers/sqlite.js +1611 -1486
- package/dist/controllers/sqlite.js.map +1 -1
- package/dist/controllers/store.d.ts +9 -8
- package/dist/controllers/store.js +1 -31
- package/dist/controllers/store.js.map +1 -1
- package/dist/controllers/types.d.ts +3 -0
- package/dist/controllers/workflow-engine-scheduler.d.ts +1 -1
- package/dist/controllers/workflow-engine-scheduler.js +3 -5
- package/dist/controllers/workflow-engine-scheduler.js.map +1 -1
- package/dist/controllers/workflows.d.ts +2 -2
- package/dist/controllers/workflows.js +11 -10
- package/dist/controllers/workflows.js.map +1 -1
- package/dist/extension/controller-host.js +2 -2
- package/dist/extension/controller-host.js.map +1 -1
- package/dist/extension/decision-channels.d.ts +4 -2
- package/dist/extension/decision-channels.js +333 -146
- package/dist/extension/decision-channels.js.map +1 -1
- package/dist/extension/executor.d.ts +9 -2
- package/dist/extension/executor.js +89 -2
- package/dist/extension/executor.js.map +1 -1
- package/dist/extension/herdr-viewer.d.ts +0 -1
- package/dist/extension/herdr-viewer.js +0 -4
- package/dist/extension/herdr-viewer.js.map +1 -1
- package/dist/extension/index.js +209 -127
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/recorder.d.ts +3 -10
- package/dist/extension/recorder.js +13 -22
- package/dist/extension/recorder.js.map +1 -1
- package/dist/extension/session-events.d.ts +2 -2
- package/dist/extension/step-message.d.ts +7 -2
- package/dist/extension/step-message.js +94 -2
- package/dist/extension/step-message.js.map +1 -1
- package/dist/extension/widget.js +29 -3
- package/dist/extension/widget.js.map +1 -1
- package/dist/host/rpc-executor.d.ts +3 -0
- package/dist/host/rpc-executor.js +2 -0
- package/dist/host/rpc-executor.js.map +1 -1
- package/dist/host/runner.d.ts +3 -6
- package/dist/host/runner.js +83 -32
- package/dist/host/runner.js.map +1 -1
- package/dist/render/graph-render.js +15 -10
- package/dist/render/graph-render.js.map +1 -1
- package/dist/state/database.d.ts +35 -0
- package/dist/state/database.js +287 -0
- package/dist/state/database.js.map +1 -0
- package/dist/state/index.d.ts +4 -0
- package/dist/state/index.js +5 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/json.d.ts +6 -0
- package/dist/state/json.js +38 -0
- package/dist/state/json.js.map +1 -0
- package/dist/state/mutation.d.ts +57 -0
- package/dist/state/mutation.js +255 -0
- package/dist/state/mutation.js.map +1 -0
- package/dist/state/schema.d.ts +6 -0
- package/dist/state/schema.js +473 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/viewer/cli.d.ts +2 -2
- package/dist/viewer/cli.js +142 -122
- package/dist/viewer/cli.js.map +1 -1
- package/dist/viewer/render.d.ts +4 -4
- package/dist/viewer/render.js +9 -23
- package/dist/viewer/render.js.map +1 -1
- package/dist/viewer/session-reducer.d.ts +1 -1
- package/dist/viewer/session-reducer.js +1 -1
- package/dist/viewer/tui.d.ts +3 -3
- package/dist/viewer/tui.js +15 -13
- package/dist/viewer/tui.js.map +1 -1
- package/dist/viewer/watch.d.ts +2 -5
- package/dist/viewer/watch.js +13 -13
- package/dist/viewer/watch.js.map +1 -1
- package/dist/workflows/catalog.js +7 -2
- package/dist/workflows/catalog.js.map +1 -1
- package/dist/workflows/composition.js +20 -2
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/decision-presentation.d.ts +1 -1
- package/dist/workflows/decision-presentation.js +51 -38
- package/dist/workflows/decision-presentation.js.map +1 -1
- package/dist/workflows/definition.d.ts +6 -2
- package/dist/workflows/definition.js +17 -0
- package/dist/workflows/definition.js.map +1 -1
- package/dist/workflows/engine.d.ts +7 -7
- package/dist/workflows/engine.js +196 -115
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/errors.d.ts +16 -3
- package/dist/workflows/errors.js +18 -3
- package/dist/workflows/errors.js.map +1 -1
- package/dist/workflows/human-decision.d.ts +45 -8
- package/dist/workflows/human-decision.js +641 -274
- package/dist/workflows/human-decision.js.map +1 -1
- package/dist/workflows/index.d.ts +5 -6
- package/dist/workflows/index.js +4 -5
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/progress.d.ts +1 -0
- package/dist/workflows/progress.js +15 -3
- package/dist/workflows/progress.js.map +1 -1
- package/dist/workflows/schema.js +27 -1
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/store.d.ts +83 -103
- package/dist/workflows/store.js +907 -951
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/types.d.ts +88 -126
- package/docs/CONTROLLERS.md +10 -8
- package/docs/DEFERRED_TURNS.md +2 -2
- package/docs/DESIGN_PHILOSOPHY.md +4 -2
- package/docs/HUMAN_DECISIONS.md +36 -47
- package/docs/HUMAN_DECISION_PRESENTATIONS.md +14 -24
- package/docs/MONITOR.md +179 -237
- package/docs/SQLITE_STATE.md +219 -0
- package/docs/WORKFLOW_COMPOSITION.md +27 -26
- package/docs/WORKFLOW_STEP_MESSAGES.md +20 -18
- package/docs/WORKFLOW_UPDATES.md +10 -9
- package/docs/development.md +9 -9
- package/docs/live-replay-protocol.md +28 -37
- package/docs/plans/2026-08-16-workflow-updates-plan.md +1 -1
- package/docs/plans/2026-08-19-human-decision-gates-plan.md +1 -1
- package/docs/plans/2026-08-21-autoimplement-timeout-fallback-plan.md +1 -1
- package/docs/plans/2026-08-21-plan-change-approval-policy-plan.md +322 -0
- package/docs/plans/2026-08-21-sanity-check-plan.md +217 -95
- package/docs/plans/2026-08-22-goal-finishing-monitor-plan.md +200 -0
- package/docs/plans/2026-08-23-assistant-agent-completion-plan.md +701 -0
- package/docs/plans/2026-08-23-sqlite-state-plan.md +970 -0
- package/docs/plans/replayable-run-bundles-implementation-plan.md +2 -2
- package/docs/plans/session-event-replay-implementation-plan.md +1 -1
- package/docs/plans/tui-viewer-implementation-plan.md +1 -1
- package/docs/session-event-journal.md +63 -434
- package/docs/tui-viewer.md +13 -15
- package/docs/workflows.md +127 -53
- package/examples/workflows/approved-plan.workflow.ts +19 -46
- package/examples/workflows/plain-summary.workflow.ts +1 -0
- package/herdr-plugin.toml +1 -1
- package/package.json +7 -7
- package/plugins/herdr/viewer.mjs +1 -11
- package/schemas/human-decision-accepted-v1.schema.json +15 -3
- package/schemas/human-decision-continuation-v1.schema.json +10 -1
- package/schemas/human-decision-delivery-v1.schema.json +8 -0
- package/schemas/human-decision-receipt-v1.schema.json +8 -0
- package/schemas/human-decision-request-v1.schema.json +24 -4
- package/skills/autoimplement/SKILL.md +27 -0
- package/skills/autoplan/SKILL.md +5 -4
- package/skills/monitor/SKILL.md +91 -135
- package/skills/pi-workflows/SKILL.md +9 -8
- package/skills/sanity-check/SKILL.md +44 -0
- package/src/builtins/autoimplement.workflow.ts +19 -118
- package/src/builtins/autoplan.workflow.ts +290 -40
- package/src/builtins/catalog.ts +7 -5
- package/src/builtins/index.ts +18 -1
- package/src/builtins/monitor.workflow.ts +673 -382
- package/src/builtins/pi-agent-group.ts +1407 -0
- package/src/builtins/plain-summary.workflow.ts +185 -0
- package/src/builtins/plan-approval.workflow.ts +157 -24
- package/src/builtins/plan-change.workflow.ts +321 -0
- package/src/builtins/plan-presentation.ts +2 -2
- package/src/builtins/sanity-check.workflow.ts +248 -48
- package/src/controllers/effects.ts +7 -0
- package/src/controllers/index.ts +0 -6
- package/src/controllers/manager.ts +72 -32
- package/src/controllers/sqlite.ts +2420 -1948
- package/src/controllers/store.ts +17 -38
- package/src/controllers/types.ts +3 -0
- package/src/controllers/workflow-engine-scheduler.ts +4 -8
- package/src/controllers/workflows.ts +45 -21
- package/src/extension/controller-host.ts +1 -2
- package/src/extension/decision-channels.ts +456 -203
- package/src/extension/executor.ts +105 -2
- package/src/extension/herdr-viewer.ts +0 -5
- package/src/extension/index.ts +251 -151
- package/src/extension/recorder.ts +13 -22
- package/src/extension/session-events.ts +2 -2
- package/src/extension/step-message.ts +106 -4
- package/src/extension/widget.ts +32 -5
- package/src/host/rpc-executor.ts +4 -0
- package/src/host/runner.ts +93 -41
- package/src/render/graph-render.ts +12 -6
- package/src/state/database.ts +375 -0
- package/src/state/index.ts +29 -0
- package/src/state/json.ts +42 -0
- package/src/state/mutation.ts +435 -0
- package/src/state/schema.ts +475 -0
- package/src/viewer/cli.ts +151 -144
- package/src/viewer/render.ts +19 -30
- package/src/viewer/session-reducer.ts +1 -1
- package/src/viewer/tui.ts +18 -17
- package/src/viewer/watch.ts +13 -17
- package/src/workflows/catalog.ts +7 -2
- package/src/workflows/composition.ts +21 -3
- package/src/workflows/decision-presentation.ts +56 -43
- package/src/workflows/definition.ts +36 -3
- package/src/workflows/engine.ts +228 -130
- package/src/workflows/errors.ts +27 -3
- package/src/workflows/human-decision.ts +921 -349
- package/src/workflows/index.ts +20 -30
- package/src/workflows/progress.ts +18 -3
- package/src/workflows/schema.ts +36 -1
- package/src/workflows/store.ts +1300 -1163
- package/src/workflows/types.ts +100 -137
- package/dist/builtins/sanity-check-session.d.ts +0 -17
- package/dist/builtins/sanity-check-session.js +0 -168
- package/dist/builtins/sanity-check-session.js.map +0 -1
- package/dist/workflows/artifacts.d.ts +0 -40
- package/dist/workflows/artifacts.js +0 -155
- package/dist/workflows/artifacts.js.map +0 -1
- package/dist/workflows/migrate-sources.d.ts +0 -42
- package/dist/workflows/migrate-sources.js +0 -133
- package/dist/workflows/migrate-sources.js.map +0 -1
- package/docs/run-bundles.md +0 -481
- package/schemas/human-decision-accepted-v2.schema.json +0 -50
- package/schemas/human-decision-delivery-v2.schema.json +0 -36
- package/schemas/human-decision-receipt-v2.schema.json +0 -39
- package/schemas/human-decision-request-v2.schema.json +0 -69
- package/schemas/human-decision-resolution-v2.schema.json +0 -27
- package/src/builtins/sanity-check-session.ts +0 -205
- package/src/workflows/artifacts.ts +0 -188
- package/src/workflows/migrate-sources.ts +0 -178
package/docs/MONITOR.md
CHANGED
|
@@ -2,179 +2,168 @@
|
|
|
2
2
|
|
|
3
3
|
This specification defines the built-in `monitor` workflow and its use of [workflow updates](WORKFLOW_UPDATES.md).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Monitor finishes an authorized goal. It observes the real target, performs a safe action when work is incomplete and idle, confirms the result, and checks again on schedule until the goal is complete or cannot continue safely.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Input
|
|
8
8
|
|
|
9
9
|
```json
|
|
10
10
|
{
|
|
11
|
-
"task": "
|
|
12
|
-
"stopWhen": "Stop when
|
|
11
|
+
"task": "Resume the six missing modules and monitor the full 27-module build. Use the saved outputs. Keep total paid work below the recorded limit.",
|
|
12
|
+
"stopWhen": "Stop when all 27 modules have verified outputs or when safe continuation is blocked.",
|
|
13
|
+
"everyMinutes": 15
|
|
13
14
|
}
|
|
14
15
|
```
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
The public input has four fields:
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
| Field | Required | Type | Default | Meaning |
|
|
20
|
+
| -------------- | -------- | ------- | ------------------ | --------------------------------- |
|
|
21
|
+
| `task` | Yes | string | None | Goal, authority, and constraints. |
|
|
22
|
+
| `stopWhen` | No | string | Explicit user stop | Condition that ends monitoring. |
|
|
23
|
+
| `everyMinutes` | No | integer | `30` | Minutes between timed checks. |
|
|
24
|
+
| `maxChecks` | No | integer | `1000` | Observation safety limit. |
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
| --------------------- | -------- | ------- | ------------------ | --------------------------------- |
|
|
22
|
-
| `task` | Yes | string | None | Self-contained monitor task. |
|
|
23
|
-
| `everyMinutes` | No | integer | `30` | Minutes between accepted checks. |
|
|
24
|
-
| `stopWhen` | No | string | Explicit user stop | Condition that ends monitoring. |
|
|
25
|
-
| `maxChecks` | No | integer | `1000` | Run safety limit. |
|
|
26
|
-
| `checkTimeoutMinutes` | No | integer | Derived | Timeout for one agent check. |
|
|
27
|
-
| `repair` | No | object | None | Explicit automatic-repair policy. |
|
|
26
|
+
`task` is 1 to 8,000 characters after trimming. It must preserve the user's goal and the authority already present in the conversation and repository instructions. This includes:
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
- allowed files, systems, providers, runtimes, and resources
|
|
29
|
+
- forbidden changes
|
|
30
|
+
- cost and resource limits
|
|
31
|
+
- required checks
|
|
32
|
+
- stop conditions
|
|
33
|
+
- allowed recovery actions
|
|
34
|
+
- durable progress, checkpoints, and known target identifiers
|
|
30
35
|
|
|
31
|
-
`
|
|
36
|
+
`stopWhen` is 1 to 4,000 characters when supplied. When the conversation gives no finish condition, the workflow uses `Stop only when the user explicitly asks to stop.`
|
|
32
37
|
|
|
33
|
-
`
|
|
38
|
+
`everyMinutes` is an integer from 1 through 1,440. The first observation starts immediately. The interval applies only after an observation proves that work is moving or waiting for an external event.
|
|
34
39
|
|
|
35
|
-
`maxChecks` is from 1 through 1,000.
|
|
40
|
+
`maxChecks` is an integer from 1 through 1,000. Callers omit it unless the user asks for a fixed limit. The default is a runtime safety limit.
|
|
36
41
|
|
|
37
|
-
|
|
42
|
+
The input parser rejects every unknown field before a run is created. Inputs such as `audience`, `repair`, and `checkTimeoutMinutes` fail with a direct unsupported-field error. There are no compatibility aliases for removed fields.
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
## Authority
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
Monitor uses only authority that already exists in `task`, `stopWhen`, the conversation, and repository instructions. It does not infer permission from an idle target or from the existence of a possible action.
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
The first observation extracts the applicable contract:
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
- the complete goal
|
|
51
|
+
- allowed files and systems
|
|
52
|
+
- forbidden changes
|
|
53
|
+
- cost ceiling
|
|
54
|
+
- provider and runtime contract
|
|
55
|
+
- required checks
|
|
56
|
+
- stop conditions
|
|
57
|
+
- allowed recovery actions
|
|
46
58
|
|
|
47
|
-
|
|
59
|
+
An action can run only when its full effect is inside that contract. Monitor stops and reports the missing decision when an action would exceed the contract.
|
|
48
60
|
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
"route": "continue",
|
|
52
|
-
"observation": "The pull request is open and 8 of 10 checks passed.",
|
|
53
|
-
"report": "PR 123 remains open. Eight of ten checks passed; two are running.",
|
|
54
|
-
"progress": {
|
|
55
|
-
"tracks": [
|
|
56
|
-
{
|
|
57
|
-
"key": "checks",
|
|
58
|
-
"data": {
|
|
59
|
-
"schema": "pi-workflows.progress.v1",
|
|
60
|
-
"label": "Checks",
|
|
61
|
-
"status": "running",
|
|
62
|
-
"completed": 8,
|
|
63
|
-
"total": 10,
|
|
64
|
-
"unit": "checks"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
"reason": "The stop condition is not met."
|
|
70
|
-
}
|
|
71
|
-
```
|
|
61
|
+
A monitoring request does not create spending approval. Before paid work starts or resumes, the action must verify an applicable approval and prove that the next action stays inside its cumulative cost limit. It must not launch when the cost limit is missing, cannot be verified, or would be exceeded.
|
|
72
62
|
|
|
73
|
-
|
|
63
|
+
## Read-only observation
|
|
74
64
|
|
|
75
|
-
|
|
76
|
-
| ------------- | ---------- | ------ | ------------------------------------------- |
|
|
77
|
-
| `route` | Yes | string | `continue`, authorized `repair`, or `stop`. |
|
|
78
|
-
| `observation` | Yes | string | Current factual state. |
|
|
79
|
-
| `report` | Yes | string | Concise user-facing update. |
|
|
80
|
-
| `progress` | No | object | Current progress tracks. |
|
|
81
|
-
| `repair` | For repair | object | Problem, evidence, and stable fingerprint. |
|
|
82
|
-
| `reason` | Yes | string | Reason for the selected route. |
|
|
65
|
+
Every cycle begins with the `observe` agent step. The first observation and all observations after actions are read-only. The model uses normal tools to inspect authoritative target state and durable outputs.
|
|
83
66
|
|
|
84
|
-
|
|
67
|
+
The observation answers these questions:
|
|
85
68
|
|
|
86
|
-
|
|
69
|
+
- Is the goal complete?
|
|
70
|
+
- Is useful work active?
|
|
71
|
+
- Is the goal incomplete and idle?
|
|
72
|
+
- Did work fail?
|
|
73
|
+
- Is there a material blocker?
|
|
74
|
+
- Which safe actions are already authorized?
|
|
87
75
|
|
|
88
|
-
|
|
76
|
+
The result uses one of three routes:
|
|
89
77
|
|
|
90
|
-
|
|
78
|
+
- `wait`: Work is moving, or an external event must finish.
|
|
79
|
+
- `act`: The goal is incomplete and a safe authorized action is available.
|
|
80
|
+
- `stop`: The goal is complete or cannot continue safely.
|
|
91
81
|
|
|
92
|
-
The
|
|
82
|
+
The observation records the goal state and target work state separately. It also lists the safe actions that the user has already authorized, even when no action is needed now. Monitor state is never evidence that target work is running.
|
|
93
83
|
|
|
94
|
-
|
|
95
|
-
prepare
|
|
96
|
-
→ check
|
|
97
|
-
→ estimate
|
|
98
|
-
→ publish_progress
|
|
99
|
-
→ report
|
|
100
|
-
→ decide
|
|
101
|
-
├─ stop → finish
|
|
102
|
-
├─ continue → schedule → sleep → check
|
|
103
|
-
└─ repair → repairGuard
|
|
104
|
-
├─ blocked → repairBlocked → repairReport → finish
|
|
105
|
-
└─ initialDesign: autoplan
|
|
106
|
-
├─ blocked → repairBlocked
|
|
107
|
-
└─ documentation: autodoc
|
|
108
|
-
├─ blocked → repairBlocked
|
|
109
|
-
├─ no approval → implementation: autoimplement
|
|
110
|
-
└─ approval: plan-approval
|
|
111
|
-
├─ stop → repairBlocked
|
|
112
|
-
├─ replan → initialDesign
|
|
113
|
-
└─ continue → implementation: autoimplement
|
|
114
|
-
├─ blocked → repairBlocked
|
|
115
|
-
└─ completed → check
|
|
116
|
-
```
|
|
84
|
+
## Action request
|
|
117
85
|
|
|
118
|
-
|
|
119
|
-
- `check` is an `agent` node that inspects the target and submits the check output.
|
|
120
|
-
- `estimate` is a `compute` node that updates per-track rate and ETA state with the pure progress helpers.
|
|
121
|
-
- `publish_progress` is a function `action` that publishes each validated observed track.
|
|
122
|
-
- `report` is a `notify` node that queues exactly one report.
|
|
123
|
-
- `decide` is a `compute` node that applies the route and check safety limit.
|
|
124
|
-
- `repairGuard` stops a repeated issue when a completed repair did not change its fingerprint or observed target state.
|
|
125
|
-
- `initialDesign`, `documentation`, optional `approval`, and `implementation` are included workflows. Replan returns exact operator text to initialDesign. Autoimplement can enter nested `autoplan`, then autodoc, when later evidence requires redesign.
|
|
126
|
-
- `repairBlocked` and `repairReport` preserve a truthful blocked result and user notification.
|
|
127
|
-
- `schedule` is a function `action` that publishes the next-check time.
|
|
128
|
-
- `sleep` is the existing runtime-owned shell wait.
|
|
129
|
-
- `finish` is a `compute` node that returns the final observation and reason.
|
|
86
|
+
An `act` result contains one action request with:
|
|
130
87
|
|
|
131
|
-
|
|
88
|
+
- `kind`: `advance`, `recover`, or `repair`
|
|
89
|
+
- what is incomplete
|
|
90
|
+
- evidence that proves it
|
|
91
|
+
- the exact next action
|
|
92
|
+
- why existing authority covers the action
|
|
93
|
+
- files, systems, or resources that may change
|
|
94
|
+
- how to verify the action
|
|
95
|
+
- a stable failure ID
|
|
96
|
+
- a stable target-state ID
|
|
132
97
|
|
|
133
|
-
|
|
98
|
+
The failure ID identifies the same failure across checks. The target-state ID identifies the relevant target state. Both values come from observed facts and remain stable while those facts remain unchanged.
|
|
134
99
|
|
|
135
|
-
The
|
|
100
|
+
The action request cannot grant authority. It can only describe authority found during observation.
|
|
136
101
|
|
|
137
|
-
|
|
138
|
-
- task
|
|
139
|
-
- stop condition
|
|
140
|
-
- previous accepted observation
|
|
141
|
-
- previous progress and estimate summary when present
|
|
142
|
-
- read-only boundary unless the task authorizes a mutation
|
|
143
|
-
- required output shape
|
|
102
|
+
## Direct actions
|
|
144
103
|
|
|
145
|
-
|
|
104
|
+
`advance` starts or continues normal requested work. `recover` restarts or resumes work after an operational stop.
|
|
146
105
|
|
|
147
|
-
|
|
106
|
+
Both routes use one mutation-capable `act` agent step with normal Pi tools. The step performs only the stated action. Its prompt includes the exact action, authority basis, allowed mutation set, and verification rule from the read-only observation.
|
|
148
107
|
|
|
149
|
-
|
|
108
|
+
Direct actions can include:
|
|
150
109
|
|
|
151
|
-
|
|
110
|
+
- starting work
|
|
111
|
+
- resuming saved work
|
|
112
|
+
- restarting stopped work
|
|
113
|
+
- running the next command
|
|
114
|
+
- updating a stale launch file
|
|
115
|
+
- retrying a safe external operation
|
|
116
|
+
- continuing from a verified checkpoint
|
|
152
117
|
|
|
153
|
-
|
|
118
|
+
A normal start, resume, or restart does not run Autoplan, Autodoc, or Autoimplement.
|
|
154
119
|
|
|
155
|
-
|
|
120
|
+
The action step returns whether the action succeeded, failed, or was blocked, with factual evidence. Monitor then runs `observe` again immediately. A failed direct action can lead to a new authorized recovery action, but it cannot cause an unbounded retry loop.
|
|
156
121
|
|
|
157
|
-
##
|
|
122
|
+
## Repair actions
|
|
158
123
|
|
|
159
|
-
`
|
|
124
|
+
`repair` changes code or configuration to fix a defect. It uses the existing shared plan-change workflow and Autoimplement workflow. Monitor does not copy their design, documentation, implementation, test, review, or delivery steps.
|
|
160
125
|
|
|
161
|
-
|
|
126
|
+
The repair input preserves the action request, target evidence, authority, constraints, repository, and delivery limits. Existing plan approval rules still apply when the recorded contract requires them.
|
|
162
127
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
128
|
+
Paid workers affected by a shared code or data defect must stop at safe boundaries before repair starts. Monitor preserves their durable outputs and failure evidence.
|
|
129
|
+
|
|
130
|
+
After a completed repair, Monitor runs `observe` immediately. If the same failure ID and target-state ID return, Monitor stops. It does not run the same repair cycle again.
|
|
131
|
+
|
|
132
|
+
## Workflow graph
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
observe
|
|
136
|
+
├─ stop → finish
|
|
137
|
+
├─ wait → report → schedule → sleep → observe
|
|
138
|
+
└─ act
|
|
139
|
+
├─ advance → direct action → observe immediately
|
|
140
|
+
├─ recover → direct action → observe immediately
|
|
141
|
+
└─ repair → plan change → Autoimplement → observe immediately
|
|
169
142
|
```
|
|
170
143
|
|
|
171
|
-
The
|
|
144
|
+
The timer exists only on the `wait` route. No schedule or sleep step can occur between an action and its verification observation.
|
|
145
|
+
|
|
146
|
+
`maxChecks` counts accepted observations. Reaching the limit reports the real goal and work state before the workflow stops.
|
|
147
|
+
|
|
148
|
+
## Progress
|
|
172
149
|
|
|
173
|
-
|
|
150
|
+
Progress is optional. The regular Pi model reads the target through normal tools and converts observed facts into `pi-workflows.progress.v1` tracks. The existing workflow update channel stores and displays those tracks.
|
|
151
|
+
|
|
152
|
+
The target stays independent of Pi Workflows. Monitor must not require a target process, Job, application, provider, or repository to:
|
|
153
|
+
|
|
154
|
+
- import Pi Workflows
|
|
155
|
+
- expose a Pi-specific API or endpoint
|
|
156
|
+
- write a Pi-specific progress file
|
|
157
|
+
- create a Pi-specific store or schema
|
|
158
|
+
- add a Pi-specific command or dependency
|
|
159
|
+
|
|
160
|
+
When the target does not expose a factual completed value, total, rate, or source estimate, Monitor reports that the value or ETA is unavailable. It does not invent one.
|
|
161
|
+
|
|
162
|
+
Progress data cannot contain a command or grant mutation authority.
|
|
174
163
|
|
|
175
164
|
## Schedule publication
|
|
176
165
|
|
|
177
|
-
|
|
166
|
+
On the `wait` route, `schedule` publishes:
|
|
178
167
|
|
|
179
168
|
```json
|
|
180
169
|
{
|
|
@@ -189,130 +178,83 @@ Before sleeping, `schedule` publishes:
|
|
|
189
178
|
}
|
|
190
179
|
```
|
|
191
180
|
|
|
192
|
-
All fields are required. Times use RFC 3339 UTC form. `everyMinutes` must match the prepared
|
|
181
|
+
All fields are required. Times use RFC 3339 UTC form. `everyMinutes` must match the prepared Monitor configuration.
|
|
193
182
|
|
|
194
|
-
|
|
183
|
+
No schedule update is published on `act` or `stop` routes.
|
|
195
184
|
|
|
196
|
-
##
|
|
185
|
+
## Reports
|
|
197
186
|
|
|
198
|
-
|
|
187
|
+
Every accepted observation sends one notification. Reports show Monitor state, goal state, and target work state as separate facts.
|
|
199
188
|
|
|
200
|
-
|
|
189
|
+
A moving target report uses this form:
|
|
201
190
|
|
|
202
191
|
```text
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
192
|
+
Monitor: active
|
|
193
|
+
Goal: incomplete
|
|
194
|
+
Work: running
|
|
195
|
+
Progress: 21/27 modules
|
|
196
|
+
Last action: resumed six missing modules
|
|
197
|
+
Next check: 15 minutes
|
|
208
198
|
```
|
|
209
199
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
- Show absolute values before deltas.
|
|
213
|
-
- Label source ETA as `source ETA`.
|
|
214
|
-
- Show `ETA unavailable` with a short reason when no valid estimate exists.
|
|
215
|
-
- Do not display a negative countdown after an ETA passes.
|
|
216
|
-
- Use `ETA passed; awaiting next check` until a new sample arrives.
|
|
217
|
-
- Keep failed, blocked, or stale state ahead of rate details.
|
|
218
|
-
- Show every track when the formatted report remains within 4,000 characters.
|
|
219
|
-
- When it does not fit, show `overall`, failed or blocked tracks, then as many active tracks as fit, followed by the omitted count.
|
|
220
|
-
|
|
221
|
-
Unrelated tracks are never combined. The monitor uses an explicit `overall` track when the target supplies meaningful aggregate progress.
|
|
222
|
-
|
|
223
|
-
## Notification delivery
|
|
224
|
-
|
|
225
|
-
Each accepted check reaches `report`, including a check that selects `stop`. The `notify` node writes one durable message through the existing session-addressed outbox.
|
|
226
|
-
|
|
227
|
-
The extension delivers the custom Pi message with `triggerTurn: false`. The notification stays in session history and later model context. Its arrival does not start an assistant response.
|
|
228
|
-
|
|
229
|
-
The monitor does not use `sendUserMessage`. It does not ask an agent to repeat or acknowledge the notification. After the workflow tool accepts the check, the extension removes any extra assistant tail text from that agent run, so only the notification reports the check.
|
|
230
|
-
|
|
231
|
-
A check that times out or fails before producing accepted output is not an accepted check. The run enters its normal terminal error state and the extension shows the workflow lifecycle notification. It does not invent a successful check report.
|
|
232
|
-
|
|
233
|
-
## Routing and stopping
|
|
234
|
-
|
|
235
|
-
`route: "stop"` queues the report and then completes the workflow.
|
|
236
|
-
|
|
237
|
-
`route: "continue"` queues the report and then checks the safety limit. If the limit remains available, the workflow schedules and waits for the next check. If the accepted check reaches `maxChecks`, the workflow finishes after that check's report and records `Reached the <n>-check safety limit.`
|
|
238
|
-
|
|
239
|
-
A user cancellation stops the active check or wait immediately. It does not queue another report. The existing workflow lifecycle notification reports cancellation.
|
|
240
|
-
|
|
241
|
-
Failures, blocked states, and unavailable status follow the user's `stopWhen` rule. The check may continue after reporting an unavailable source when observation remains safe and the stop condition is not met. It must stop when the requested terminal state is verified.
|
|
242
|
-
|
|
243
|
-
## Widget
|
|
244
|
-
|
|
245
|
-
Progress display is optional. A monitor without progress uses the normal workflow graph widget.
|
|
246
|
-
|
|
247
|
-
With progress, the widget uses the existing 10-line budget. It keeps the active graph row and uses remaining lines for a compact progress panel. It shows `overall` first, then failed or blocked tracks, then active tracks. Existing widget scrolling exposes omitted tracks.
|
|
248
|
-
|
|
249
|
-
The widget may show:
|
|
200
|
+
An idle target that has an authorized action uses this form before the action runs:
|
|
250
201
|
|
|
251
202
|
```text
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
203
|
+
Monitor: active
|
|
204
|
+
Goal: incomplete
|
|
205
|
+
Work: idle
|
|
206
|
+
Next action: refreshing launch files and resuming work now
|
|
256
207
|
```
|
|
257
208
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
- workflow and phase elapsed time
|
|
261
|
-
- time since the last progress sample
|
|
262
|
-
- ETA countdown derived from the last estimate
|
|
263
|
-
- time until the next check
|
|
264
|
-
|
|
265
|
-
It does not advance observed `completed`, publish updates, write bundle state, or call a model.
|
|
266
|
-
|
|
267
|
-
When an ETA expires, the widget shows that the estimate passed and waits for the next sample. `piw` shows the complete track list, update history, estimate basis, confidence, and source timestamps.
|
|
268
|
-
|
|
269
|
-
## Several monitored processes
|
|
270
|
-
|
|
271
|
-
One monitor can track several processes. Each uses a stable progress key. A missing key in a later check does not mean completion; the check should publish an explicit terminal or `unknown` state before it stops reporting that process.
|
|
272
|
-
|
|
273
|
-
The progress estimator treats each key independently. A phase, unit, total, or counter reset in one track does not reset another track.
|
|
209
|
+
A report must not say `Work: running` because Monitor itself is active. It may say running only when target evidence proves useful work is active.
|
|
274
210
|
|
|
275
|
-
|
|
211
|
+
Progress formatting follows these rules:
|
|
276
212
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
-
|
|
298
|
-
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
213
|
+
- Show absolute values before deltas.
|
|
214
|
+
- Label a target-provided ETA as `source ETA`.
|
|
215
|
+
- Show `ETA unavailable` with a short reason when no valid estimate exists.
|
|
216
|
+
- Keep failed, blocked, or idle state ahead of rate details.
|
|
217
|
+
- Keep independent progress tracks separate.
|
|
218
|
+
|
|
219
|
+
Notifications use the existing session-addressed outbox with `triggerTurn: false`. They do not start an extra assistant response.
|
|
220
|
+
|
|
221
|
+
## Stop conditions
|
|
222
|
+
|
|
223
|
+
Monitor stops when:
|
|
224
|
+
|
|
225
|
+
- the goal is complete
|
|
226
|
+
- a material blocker prevents safe continuation
|
|
227
|
+
- the next action is outside recorded authority
|
|
228
|
+
- a paid action lacks approval or would exceed its limit
|
|
229
|
+
- a provider, runtime, method, data source, or other protected contract would change
|
|
230
|
+
- a required credential lacks prior source-and-destination authority
|
|
231
|
+
- a checkpoint is invalid or cannot preserve useful work
|
|
232
|
+
- the same failure and target state return after one completed repair
|
|
233
|
+
- the observation safety limit is reached
|
|
234
|
+
- the user cancels the run
|
|
235
|
+
|
|
236
|
+
Monitor reports the current goal and target work state before a normal `stop` route completes.
|
|
237
|
+
|
|
238
|
+
## Acceptance tests
|
|
239
|
+
|
|
240
|
+
The implementation must test at least these cases:
|
|
241
|
+
|
|
242
|
+
1. The goal is already complete.
|
|
243
|
+
2. Work is active, so Monitor waits.
|
|
244
|
+
3. Work is idle, so Monitor starts it.
|
|
245
|
+
4. Saved work exists, so Monitor resumes it.
|
|
246
|
+
5. An action succeeds, so Monitor observes again immediately.
|
|
247
|
+
6. An action fails once, then recovery succeeds.
|
|
248
|
+
7. The same repaired failure returns, so Monitor stops.
|
|
249
|
+
8. An action is outside authority, so Monitor stops.
|
|
250
|
+
9. A paid action exceeds the limit, so Monitor does not launch it.
|
|
251
|
+
10. Monitor is active while the target is idle.
|
|
252
|
+
11. The target completes between timed observations.
|
|
253
|
+
12. Unknown input fields fail before run creation.
|
|
254
|
+
13. A normal restart does not trigger planning or documentation.
|
|
255
|
+
14. A real code defect uses the existing repair path.
|
|
256
|
+
15. No target-specific monitoring API is required.
|
|
257
|
+
|
|
258
|
+
Existing progress, notification, cancellation, interruption, resume, widget, schedule, and safety-limit tests must continue to pass where they apply to the new graph.
|
|
259
|
+
|
|
260
|
+
The real-Pi end-to-end test must start a short Monitor run, observe its notification without an extra assistant turn, inspect the widget, and stop the run without mutating an external target.
|