@osolmaz/pi-workflows 0.10.0 → 0.11.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.
- package/README.md +32 -14
- package/dist/builtins/autodoc.workflow.d.ts +58 -0
- package/dist/builtins/autodoc.workflow.js +266 -0
- package/dist/builtins/autodoc.workflow.js.map +1 -0
- package/dist/builtins/autoimplement.workflow.d.ts +212 -11
- package/dist/builtins/autoimplement.workflow.js +431 -22
- package/dist/builtins/autoimplement.workflow.js.map +1 -1
- package/dist/builtins/{autodevise.workflow.d.ts → autoplan.workflow.d.ts} +9 -9
- package/dist/builtins/{autodevise.workflow.js → autoplan.workflow.js} +20 -20
- package/dist/builtins/autoplan.workflow.js.map +1 -0
- package/dist/builtins/catalog.js +8 -4
- package/dist/builtins/catalog.js.map +1 -1
- package/dist/builtins/index.d.ts +6 -3
- package/dist/builtins/index.js +5 -2
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/monitor.workflow.d.ts +4 -0
- package/dist/builtins/monitor.workflow.js +134 -9
- package/dist/builtins/monitor.workflow.js.map +1 -1
- package/dist/builtins/plan-approval.workflow.d.ts +83 -0
- package/dist/builtins/plan-approval.workflow.js +148 -0
- package/dist/builtins/plan-approval.workflow.js.map +1 -0
- package/dist/builtins/plan-presentation.d.ts +7 -0
- package/dist/builtins/plan-presentation.js +44 -0
- package/dist/builtins/plan-presentation.js.map +1 -0
- package/dist/extension/decision-channels.d.ts +132 -0
- package/dist/extension/decision-channels.js +1082 -0
- package/dist/extension/decision-channels.js.map +1 -0
- package/dist/extension/index.d.ts +1 -0
- package/dist/extension/index.js +426 -11
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/widget.js +26 -2
- package/dist/extension/widget.js.map +1 -1
- package/dist/extension/workflow-tool.d.ts +1 -37
- package/dist/extension/workflow-tool.js +1 -42
- package/dist/extension/workflow-tool.js.map +1 -1
- package/dist/herdr/setup.d.ts +13 -1
- package/dist/herdr/setup.js +349 -36
- package/dist/herdr/setup.js.map +1 -1
- package/dist/host/rpc-bridge.js +4 -21
- package/dist/host/rpc-bridge.js.map +1 -1
- package/dist/render/graph-render.js +33 -8
- package/dist/render/graph-render.js.map +1 -1
- package/dist/viewer/cli.d.ts +1 -0
- package/dist/viewer/cli.js +21 -10
- package/dist/viewer/cli.js.map +1 -1
- package/dist/viewer/render.js +36 -2
- package/dist/viewer/render.js.map +1 -1
- package/dist/workflows/composition.js +15 -1
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/decision-presentation.d.ts +18 -0
- package/dist/workflows/decision-presentation.js +417 -0
- package/dist/workflows/decision-presentation.js.map +1 -0
- package/dist/workflows/engine.d.ts +2 -1
- package/dist/workflows/engine.js +86 -4
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/human-decision.d.ts +87 -0
- package/dist/workflows/human-decision.js +583 -0
- package/dist/workflows/human-decision.js.map +1 -0
- package/dist/workflows/index.d.ts +3 -1
- package/dist/workflows/index.js +2 -0
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/schema.js +15 -0
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/store.js +7 -0
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/tool-input.d.ts +72 -0
- package/dist/workflows/tool-input.js +141 -0
- package/dist/workflows/tool-input.js.map +1 -0
- package/dist/workflows/types.d.ts +223 -0
- package/docs/HUMAN_DECISIONS.md +371 -0
- package/docs/HUMAN_DECISION_PRESENTATIONS.md +323 -0
- package/docs/MONITOR.md +17 -6
- package/docs/WORKFLOW_COMPOSITION.md +13 -6
- package/docs/plans/2026-08-19-human-decision-gates-plan.md +296 -0
- package/docs/plans/2026-08-19-human-decision-presentations-plan.md +172 -0
- package/docs/plans/2026-08-19-provider-compatible-workflow-tool-schema-plan.md +45 -0
- package/docs/plans/2026-08-19-workflow-composition-plan.md +25 -17
- package/docs/plans/2026-08-20-autoimplement-blocker-challenge-plan.md +138 -0
- package/docs/plans/2026-08-20-herdr-plugin-sync-plan.md +104 -0
- package/docs/run-bundles.md +23 -2
- package/docs/workflows.md +47 -5
- package/examples/workflows/approved-plan.workflow.ts +58 -0
- package/examples/workflows/autoplan.workflow.ts +1 -0
- package/examples/workflows/human-decision.workflow.ts +62 -0
- package/herdr-plugin.toml +1 -1
- package/package.json +2 -1
- package/schemas/decision-presentation-v1.schema.json +83 -0
- package/schemas/human-decision-accepted-v1.schema.json +44 -0
- package/schemas/human-decision-accepted-v2.schema.json +50 -0
- package/schemas/human-decision-answer-attempt-v1.schema.json +37 -0
- package/schemas/human-decision-cancellation-v1.schema.json +15 -0
- package/schemas/human-decision-continuation-v1.schema.json +16 -0
- package/schemas/human-decision-delivery-v1.schema.json +28 -0
- package/schemas/human-decision-delivery-v2.schema.json +36 -0
- package/schemas/human-decision-receipt-v1.schema.json +33 -0
- package/schemas/human-decision-receipt-v2.schema.json +39 -0
- package/schemas/human-decision-request-v1.schema.json +59 -0
- package/schemas/human-decision-request-v2.schema.json +69 -0
- package/schemas/human-decision-resolution-v1.schema.json +27 -0
- package/schemas/human-decision-resolution-v2.schema.json +27 -0
- package/schemas/human-decision-settlement-v1.schema.json +28 -0
- package/skills/autodoc/SKILL.md +43 -0
- package/skills/autoimplement/SKILL.md +58 -0
- package/skills/autoimplement/agents/openai.yaml +4 -0
- package/skills/autoplan/SKILL.md +25 -0
- package/skills/monitor/SKILL.md +3 -1
- package/skills/pi-workflows/SKILL.md +3 -3
- package/src/builtins/autodoc.workflow.ts +325 -0
- package/src/builtins/autoimplement.workflow.ts +493 -23
- package/src/builtins/{autodevise.workflow.ts → autoplan.workflow.ts} +32 -32
- package/src/builtins/catalog.ts +8 -4
- package/src/builtins/index.ts +25 -6
- package/src/builtins/monitor.workflow.ts +162 -8
- package/src/builtins/plan-approval.workflow.ts +190 -0
- package/src/builtins/plan-presentation.ts +57 -0
- package/src/extension/decision-channels.ts +1533 -0
- package/src/extension/index.ts +499 -9
- package/src/extension/widget.ts +39 -2
- package/src/extension/workflow-tool.ts +5 -81
- package/src/herdr/setup.ts +429 -39
- package/src/host/rpc-bridge.ts +7 -30
- package/src/render/graph-render.ts +40 -3
- package/src/viewer/cli.ts +22 -10
- package/src/viewer/render.ts +56 -3
- package/src/workflows/composition.ts +16 -1
- package/src/workflows/decision-presentation.ts +501 -0
- package/src/workflows/engine.ts +108 -4
- package/src/workflows/human-decision.ts +819 -0
- package/src/workflows/index.ts +69 -0
- package/src/workflows/schema.ts +17 -0
- package/src/workflows/store.ts +8 -0
- package/src/workflows/tool-input.ts +202 -0
- package/src/workflows/types.ts +265 -0
- package/dist/builtins/autodevise.workflow.js.map +0 -1
- package/examples/workflows/autodevise.workflow.ts +0 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Human decision presentations
|
|
2
|
+
|
|
3
|
+
This contract is implemented. New human decision requests separate their canonical
|
|
4
|
+
subject from the complete readable message shown to an operator. Historical requests
|
|
5
|
+
that use `body` remain compatible through a deterministic readable formatter.
|
|
6
|
+
The implementation plan is in
|
|
7
|
+
[the human decision presentations plan](plans/2026-08-19-human-decision-presentations-plan.md).
|
|
8
|
+
|
|
9
|
+
A human decision contains machine data and a separate message for the operator.
|
|
10
|
+
Pi Workflows stores and validates the machine data. Pi and Telegram render only
|
|
11
|
+
the operator message, and future channels follow the same rule.
|
|
12
|
+
|
|
13
|
+
## Minimal example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
approve: humanDecision({
|
|
17
|
+
audience: "operator",
|
|
18
|
+
choices,
|
|
19
|
+
request: () => ({
|
|
20
|
+
title: "Approve the implementation plan",
|
|
21
|
+
subject: {
|
|
22
|
+
task: "Add readable human decisions",
|
|
23
|
+
plan: selectedPlan,
|
|
24
|
+
planDigest,
|
|
25
|
+
revision: 1,
|
|
26
|
+
},
|
|
27
|
+
presentation: {
|
|
28
|
+
schema: "pi-workflows.decision-presentation.v1",
|
|
29
|
+
summary: "Replace raw JSON decisions with readable messages.",
|
|
30
|
+
blocks: [
|
|
31
|
+
{ kind: "section", title: "Changes" },
|
|
32
|
+
{
|
|
33
|
+
kind: "bullets",
|
|
34
|
+
items: [
|
|
35
|
+
"Keep structured data as the durable source.",
|
|
36
|
+
"Show the same readable message in Pi and Telegram.",
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
kind: "fields",
|
|
41
|
+
items: [{ label: "Plan revision", value: "1" }],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The operator sees the summary and sections along with lists and fields. The operator does
|
|
50
|
+
not see `subject` unless the workflow explicitly copies selected text into
|
|
51
|
+
`presentation`.
|
|
52
|
+
|
|
53
|
+
## Request contract
|
|
54
|
+
|
|
55
|
+
A new request uses `pi-workflows.human-decision-request.v2`. It contains:
|
|
56
|
+
|
|
57
|
+
| Field | Required | Meaning |
|
|
58
|
+
| -------------------- | -------- | ----------------------------------------------- |
|
|
59
|
+
| `title` | Yes | Short decision title shown by every channel. |
|
|
60
|
+
| `subject` | Yes | Canonical JSON data used by the workflow. |
|
|
61
|
+
| `presentation` | Yes | Human-readable content defined below. |
|
|
62
|
+
| `audience` | Yes | Named audience resolved by the host. |
|
|
63
|
+
| `choices` | Yes | Typed choices and optional input contracts. |
|
|
64
|
+
| `revision` | Yes | Positive decision revision. |
|
|
65
|
+
| `subjectDigest` | Yes | SHA-256 digest of the canonical subject. |
|
|
66
|
+
| `presentationDigest` | Yes | SHA-256 digest of the normalized presentation. |
|
|
67
|
+
| `requestDigest` | Yes | SHA-256 digest that binds the complete request. |
|
|
68
|
+
|
|
69
|
+
The runtime adds the usual run binding and lifecycle fields as it does for
|
|
70
|
+
current decisions.
|
|
71
|
+
|
|
72
|
+
A request that supplies `subject` without `presentation` is invalid. A channel
|
|
73
|
+
must not derive a presentation from `subject`.
|
|
74
|
+
|
|
75
|
+
## Presentation contract
|
|
76
|
+
|
|
77
|
+
`pi-workflows.decision-presentation.v1` is a small ordered document:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
type DecisionPresentation = {
|
|
81
|
+
schema: "pi-workflows.decision-presentation.v1";
|
|
82
|
+
summary: string;
|
|
83
|
+
blocks: DecisionPresentationBlock[];
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`summary` is required and non-empty. Every channel shows it first. `blocks` can be empty. Block
|
|
88
|
+
order is meaningful and every channel preserves it.
|
|
89
|
+
|
|
90
|
+
### Blocks
|
|
91
|
+
|
|
92
|
+
The first version supports five flat block types.
|
|
93
|
+
|
|
94
|
+
#### Paragraph
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{ "kind": "paragraph", "text": "This change affects active workflows." }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Section
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{ "kind": "section", "title": "Verification" }
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
A section labels the blocks that follow it until the next section. Sections do
|
|
107
|
+
not contain nested blocks.
|
|
108
|
+
|
|
109
|
+
#### Bullets
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"kind": "bullets",
|
|
114
|
+
"items": ["Run the unit tests.", "Run the real-Pi test."]
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Fields
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"kind": "fields",
|
|
123
|
+
"items": [
|
|
124
|
+
{ "label": "Repository", "value": "pi-workflows" },
|
|
125
|
+
{ "label": "Action", "value": "Update the decision contract" }
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Preformatted text
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"kind": "preformatted",
|
|
135
|
+
"text": "npm run check\nnpm run test:e2e"
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Preformatted text preserves spacing and line breaks. It does not permit HTML,
|
|
140
|
+
Markdown, terminal escape sequences, or executable channel instructions.
|
|
141
|
+
|
|
142
|
+
## Validation and normalization
|
|
143
|
+
|
|
144
|
+
The authoring API validates the presentation before it creates a pending
|
|
145
|
+
request.
|
|
146
|
+
|
|
147
|
+
- Unknown fields and unknown block kinds are invalid.
|
|
148
|
+
- Display values are strings. Arbitrary nested objects are invalid.
|
|
149
|
+
- The summary, section titles, labels, bullet items, and field values must not
|
|
150
|
+
be empty after whitespace checks.
|
|
151
|
+
- The normalizer converts CRLF and CR line endings to LF.
|
|
152
|
+
- The normalizer preserves block order, item order, Unicode text, and other
|
|
153
|
+
spacing.
|
|
154
|
+
- Terminal control characters are invalid. Paragraph and preformatted text can
|
|
155
|
+
contain LF and tab. Titles and labels plus bullet items cannot contain control
|
|
156
|
+
characters.
|
|
157
|
+
- The complete normalized presentation is limited to 64,000 UTF-16 code units.
|
|
158
|
+
- A presentation can contain at most 256 blocks.
|
|
159
|
+
- One bullets or fields block can contain at most 256 items.
|
|
160
|
+
- One string can contain at most 16,000 UTF-16 code units.
|
|
161
|
+
- A renderer can produce at most 20 transport parts for one recipient.
|
|
162
|
+
|
|
163
|
+
If a presentation exceeds a limit, request creation fails with the exact limit
|
|
164
|
+
and observed value. The runtime does not create a pending request and does not
|
|
165
|
+
send a partial message.
|
|
166
|
+
|
|
167
|
+
## Digests
|
|
168
|
+
|
|
169
|
+
The runtime uses canonical JSON with a trailing newline, as defined by the run
|
|
170
|
+
bundle contract.
|
|
171
|
+
|
|
172
|
+
```text
|
|
173
|
+
subjectDigest = sha256(canonicalJson(subject))
|
|
174
|
+
presentationDigest = sha256(canonicalJson(normalizedPresentation))
|
|
175
|
+
requestDigest = sha256(canonicalJson(requestBasis))
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`requestBasis` contains the request schema and run binding. It also contains the
|
|
179
|
+
audience, title, subject, normalized presentation, choices, typed input
|
|
180
|
+
contracts, revision and optional expiry. It does not contain the three digest
|
|
181
|
+
fields or the derived decision ID.
|
|
182
|
+
|
|
183
|
+
An answer must match the exact request revision and request digest. A change to
|
|
184
|
+
only the subject, visible text, choice label, or input prompt makes an older
|
|
185
|
+
answer stale.
|
|
186
|
+
|
|
187
|
+
Channels can show a short prefix of `presentationDigest` so an operator can
|
|
188
|
+
compare the decision in Pi and Telegram. The viewer shows the same fingerprint.
|
|
189
|
+
The complete digest remains in the durable request and accepted answer evidence.
|
|
190
|
+
|
|
191
|
+
## Channel rendering
|
|
192
|
+
|
|
193
|
+
The workflow creates one presentation. It does not contain channel names,
|
|
194
|
+
Telegram markup, terminal colors, message limits, buttons, or callback data.
|
|
195
|
+
|
|
196
|
+
Each channel can change spacing and wrapping as well as styling, navigation, or
|
|
197
|
+
controls. It must preserve the title and summary together with block order and
|
|
198
|
+
contents. It must also preserve every choice and input prompt. A channel must
|
|
199
|
+
not omit or reinterpret approval-relevant content.
|
|
200
|
+
|
|
201
|
+
### Telegram
|
|
202
|
+
|
|
203
|
+
Telegram uses plain text without a parse mode. Text that resembles HTML,
|
|
204
|
+
Markdown, a command, or a mention remains inert text.
|
|
205
|
+
|
|
206
|
+
The renderer:
|
|
207
|
+
|
|
208
|
+
1. Renders the complete normalized presentation.
|
|
209
|
+
2. Splits at block and paragraph boundaries before splitting a line.
|
|
210
|
+
3. Splits a long line at Unicode-safe boundaries only when required.
|
|
211
|
+
4. Reserves space for `Part n/N` and a short presentation fingerprint.
|
|
212
|
+
5. Keeps every Telegram message below the Telegram limit.
|
|
213
|
+
6. Adds choice buttons only to the final part.
|
|
214
|
+
7. Stores durable part indexes and content digests.
|
|
215
|
+
8. Keeps chat and message IDs only in the private channel projection.
|
|
216
|
+
|
|
217
|
+
The renderer never adds an ellipsis in place of omitted decision content.
|
|
218
|
+
|
|
219
|
+
The channel records intent before sending. It records each part after an
|
|
220
|
+
unambiguous response. If a send result is ambiguous, it marks delivery unknown
|
|
221
|
+
and does not retry that part or later parts automatically. Another configured
|
|
222
|
+
channel can still answer the decision.
|
|
223
|
+
|
|
224
|
+
### Pi
|
|
225
|
+
|
|
226
|
+
Pi uses the documented extension TUI API. A custom decision component shows the
|
|
227
|
+
complete presentation and fingerprint together with the choices and optional
|
|
228
|
+
text prompt. It wraps and scrolls while responding to resize, theme, cancellation,
|
|
229
|
+
and `AbortSignal` events.
|
|
230
|
+
|
|
231
|
+
When Telegram or another channel accepts the decision, the signal closes the Pi
|
|
232
|
+
dialog. Pi Workflows does not modify Pi core or use undocumented TUI state.
|
|
233
|
+
|
|
234
|
+
### Other channels
|
|
235
|
+
|
|
236
|
+
A new channel consumes the normalized presentation and typed interaction
|
|
237
|
+
contract. It must pass the same conformance tests. It cannot access the subject
|
|
238
|
+
for display.
|
|
239
|
+
|
|
240
|
+
## Plan presentation
|
|
241
|
+
|
|
242
|
+
Pi Workflows provides a reusable plan presenter for built-in workflows. It
|
|
243
|
+
derives a presentation from the same typed plan stored as the subject.
|
|
244
|
+
|
|
245
|
+
The presenter uses these sections when data exists:
|
|
246
|
+
|
|
247
|
+
1. Goal
|
|
248
|
+
2. Proposed changes
|
|
249
|
+
3. Verification
|
|
250
|
+
4. Boundaries
|
|
251
|
+
5. Risks and mitigations
|
|
252
|
+
6. Evidence
|
|
253
|
+
|
|
254
|
+
It omits absent sections. It never serializes the plan object. `plan-approval`,
|
|
255
|
+
`monitor`, `autoplan`, `autodoc`, and `autoimplement` reuse this presenter where
|
|
256
|
+
they ask a person to approve a plan.
|
|
257
|
+
|
|
258
|
+
## Compatibility
|
|
259
|
+
|
|
260
|
+
Current v1 requests remain immutable.
|
|
261
|
+
|
|
262
|
+
- A v1 string body becomes one readable paragraph at delivery time.
|
|
263
|
+
- A v1 object body uses a deterministic compatibility formatter. It converts
|
|
264
|
+
stable key order into readable labels and fields with sections and lists.
|
|
265
|
+
- An oversized v1 body remains answerable. The formatter keeps a bounded readable
|
|
266
|
+
prefix and adds an explicit omission notice with the full body digest and size.
|
|
267
|
+
It never hides omitted content behind an ellipsis.
|
|
268
|
+
- The compatibility formatter reads only the historical `body`, which was
|
|
269
|
+
already the display field. It never reads a new structured subject.
|
|
270
|
+
- V1 request bytes and digests do not change.
|
|
271
|
+
- Pending and accepted v1 decisions continue to use v1 validation and digest
|
|
272
|
+
rules.
|
|
273
|
+
- New preferred authoring emits v2. The existing body form remains a deprecated
|
|
274
|
+
compatibility overload until a separate removal is approved.
|
|
275
|
+
|
|
276
|
+
No migration rewrites run bundles or decision records.
|
|
277
|
+
|
|
278
|
+
## Privacy and security
|
|
279
|
+
|
|
280
|
+
The presentation is an explicit display allowlist. Data does not become visible
|
|
281
|
+
because it exists in the subject.
|
|
282
|
+
|
|
283
|
+
Channel adapters do not receive the subject. Durable public records do not
|
|
284
|
+
contain Telegram chat IDs, message IDs, bot tokens, credential profile values,
|
|
285
|
+
or private audience configuration. The private channel projection retains only
|
|
286
|
+
the transport identifiers required for recovery and settlement.
|
|
287
|
+
|
|
288
|
+
Workflow authors remain responsible for not putting a secret in the explicit
|
|
289
|
+
presentation. Renderers treat all text as untrusted and inert.
|
|
290
|
+
|
|
291
|
+
## Failure behavior
|
|
292
|
+
|
|
293
|
+
- Invalid or excessive content fails before a request becomes pending.
|
|
294
|
+
- A renderer that cannot represent every block fails closed.
|
|
295
|
+
- Confirmed multipart delivery requires a receipt for every part.
|
|
296
|
+
- Ambiguous Telegram delivery remains unknown and is not retried blindly.
|
|
297
|
+
- A channel failure does not choose a default answer.
|
|
298
|
+
- Rules for the first valid answer and stale answers remain unchanged, as do
|
|
299
|
+
cancellation and settlement rules together with exactly-once continuation.
|
|
300
|
+
|
|
301
|
+
## Verification
|
|
302
|
+
|
|
303
|
+
Implementation must pass:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
npm run check
|
|
307
|
+
npm run test:e2e
|
|
308
|
+
cargo test --manifest-path tui/Cargo.toml
|
|
309
|
+
npx slophammer-ts@latest dry .
|
|
310
|
+
npx slophammer-ts@latest check . --only ts.dependency-boundaries-required
|
|
311
|
+
npx -y @simpledoc/simpledoc check
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Tests must cover schema validation, canonical digests, readable legacy bodies,
|
|
315
|
+
plan rendering, Pi and Telegram content parity, unsafe text, Unicode, multipart
|
|
316
|
+
delivery, ambiguous sends, recovery, stale answers, viewer output, and proof
|
|
317
|
+
that no channel serializes a subject as JSON.
|
|
318
|
+
|
|
319
|
+
## Boundaries
|
|
320
|
+
|
|
321
|
+
This contract does not add a new workflow node, template language, rich text
|
|
322
|
+
framework, translation service, delivery relay, Telegram resource, credential,
|
|
323
|
+
or Pi core change.
|
package/docs/MONITOR.md
CHANGED
|
@@ -38,6 +38,8 @@ The monitor checks a target, sends one status notification after every accepted
|
|
|
38
38
|
|
|
39
39
|
`repair` must set `authorized: true`. It can constrain scope, repository, base branch, merge behavior, and other implementation constraints. Omitted `merge` means the repair can prepare but cannot merge a pull request; merging requires explicit `merge: true`. Without this object the monitor is observation-only. Repair authority does not permit a protected model, benchmark, credential, hardware, spending, or scope change.
|
|
40
40
|
|
|
41
|
+
`repair.approval` is optional. It contains a logical `audience` and `maxReplans` from 1 through 20. When present, monitor sends the documented repair plan through the reusable human `plan-approval` workflow. Continue starts implementation, stop ends the repair truthfully, and replan preserves exact operator text before autoplan and autodoc run again. The model-facing workflow tool cannot approve the gate.
|
|
42
|
+
|
|
41
43
|
`reportWhen` is removed. The monitor always reports after every accepted check.
|
|
42
44
|
|
|
43
45
|
## Check output
|
|
@@ -100,11 +102,17 @@ prepare
|
|
|
100
102
|
├─ continue → schedule → sleep → check
|
|
101
103
|
└─ repair → repairGuard
|
|
102
104
|
├─ blocked → repairBlocked → repairReport → finish
|
|
103
|
-
└─ initialDesign:
|
|
105
|
+
└─ initialDesign: autoplan
|
|
104
106
|
├─ blocked → repairBlocked
|
|
105
|
-
└─
|
|
107
|
+
└─ documentation: autodoc
|
|
106
108
|
├─ blocked → repairBlocked
|
|
107
|
-
|
|
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
|
|
108
116
|
```
|
|
109
117
|
|
|
110
118
|
- `prepare` is a `compute` node that validates and applies input defaults.
|
|
@@ -114,7 +122,7 @@ prepare
|
|
|
114
122
|
- `report` is a `notify` node that queues exactly one report.
|
|
115
123
|
- `decide` is a `compute` node that applies the route and check safety limit.
|
|
116
124
|
- `repairGuard` stops a repeated issue when a completed repair did not change its fingerprint or observed target state.
|
|
117
|
-
- `initialDesign` and `implementation` are included workflows. Autoimplement can enter
|
|
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.
|
|
118
126
|
- `repairBlocked` and `repairReport` preserve a truthful blocked result and user notification.
|
|
119
127
|
- `schedule` is a function `action` that publishes the next-check time.
|
|
120
128
|
- `sleep` is the existing runtime-owned shell wait.
|
|
@@ -274,7 +282,9 @@ The monitor skill must disclose a surfaced host limit and must never invent a sm
|
|
|
274
282
|
|
|
275
283
|
## Safety boundaries
|
|
276
284
|
|
|
277
|
-
An observation-only request authorizes only observation and scheduled checks. Automatic repair also requires the explicit `repair` input object.
|
|
285
|
+
An observation-only request authorizes only observation and scheduled checks. Automatic repair also requires the explicit `repair` input object. An optional `repair.approval` object names a logical audience and inserts human plan approval after autodoc. Continue starts implementation, stop ends truthfully, and replan sends the exact human text back to autoplan before autodoc and approval run again.
|
|
286
|
+
|
|
287
|
+
When the user asks the monitor to keep an objective running or finish it, the monitor skill may record routine, bounded work in `task` and the repair policy. This can include retries, restarts, pinned task code, tests, configuration repairs, and temporary cleanup. The task must preserve the exact objective and state every mutation boundary.
|
|
278
288
|
|
|
279
289
|
A progress object is data. It cannot contain a command or grant execution authority. Fixed probes belong in workflow-authored `action` or `shell` nodes.
|
|
280
290
|
|
|
@@ -289,7 +299,8 @@ The implementation must test:
|
|
|
289
299
|
- rejection of old quiet routes
|
|
290
300
|
- required reports on every route
|
|
291
301
|
- repair rejection without explicit authorization
|
|
292
|
-
- outer design, nested redesign, and post-repair checking
|
|
302
|
+
- outer design, autodoc, optional approval, nested redesign, and post-repair checking
|
|
303
|
+
- continue, stop, and exact-text replan approval routes
|
|
293
304
|
- repeated no-progress repair detection
|
|
294
305
|
- exactly one notification per accepted check
|
|
295
306
|
- no assistant turn from a notification
|
|
@@ -257,11 +257,15 @@ monitor
|
|
|
257
257
|
plan
|
|
258
258
|
```
|
|
259
259
|
|
|
260
|
-
##
|
|
260
|
+
## Autoplan, autodoc, and autoimplement
|
|
261
261
|
|
|
262
|
-
`
|
|
262
|
+
`autoplan` accepts the problem, scope, constraints, an optional previous plan, and new evidence. It automatically selects the best practical in-scope solution. The ideal end state can win when it is feasible, but an unavailable upstream change cannot block a valid practical solution. It exits through `ready` or `blocked` and returns a plan digest and change status.
|
|
263
263
|
|
|
264
|
-
`
|
|
264
|
+
`autodoc` accepts an already selected plan or finds it in the active conversation and referenced canonical documents. It adopts current documentation or updates the canonical specification and implementation plan, runs documentation checks, and returns a documented-plan record. It never selects a solution or implements one.
|
|
265
|
+
|
|
266
|
+
`autoimplement` requires a clear existing plan, but the structured `plan` input is optional because the plan can already be in conversation context or canonical documentation. It blocks when it cannot find a clear plan. It skips autodoc when documentation is current and includes autodoc when documentation is missing or stale. The absence of `input.plan` never routes to initial autoplan.
|
|
267
|
+
|
|
268
|
+
Autoimplement includes `autoplan` only as evidence-driven `redesign`. When implementation, verification, review, comments, or CI proves that the approach is wrong, the revised plan passes through autodoc before implementation resumes. Local bugs go to a fix step instead.
|
|
265
269
|
|
|
266
270
|
Review rounds record findings at every severity from P0 through P2. P0 or P1 findings require another implementation and review round. A P2-only round can be addressed, but the workflow does not run the reviewer again solely because P2 work changed files.
|
|
267
271
|
|
|
@@ -277,13 +281,16 @@ Monitor remains observation-only unless its input explicitly authorizes mutation
|
|
|
277
281
|
|
|
278
282
|
```text
|
|
279
283
|
check
|
|
280
|
-
-> initialDesign:
|
|
284
|
+
-> initialDesign: autoplan
|
|
285
|
+
-> documentation: autodoc
|
|
286
|
+
-> approval: plan-approval when requested
|
|
287
|
+
-> replan: initialDesign
|
|
281
288
|
-> implementation: autoimplement
|
|
282
|
-
-> redesign:
|
|
289
|
+
-> redesign: autoplan -> autodoc when needed
|
|
283
290
|
-> check
|
|
284
291
|
```
|
|
285
292
|
|
|
286
|
-
The outer `
|
|
293
|
+
The outer `autoplan` creates the first plan. Autodoc records it before implementation. An optional plan approval gate can continue, stop, or return exact replan instructions to autoplan. The inner redesign mount revises a plan only when new evidence invalidates it and records the revision through autodoc. The monitor checks the target again after implementation and does not trust a repair claim by itself.
|
|
287
294
|
|
|
288
295
|
A protected change to model choice, benchmark method, credentials, hardware, spending authority, or another user decision exits as blocked. The workflow never changes the protected part of the task silently.
|
|
289
296
|
|