@mgiles/perk 3.0.0 → 3.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.
Files changed (62) hide show
  1. package/extension/adapters/planAdapterPlannotator.ts +12 -9
  2. package/extension/doors/commitCompact.ts +98 -10
  3. package/extension/doors/draftReviewWaveTools.ts +43 -15
  4. package/extension/doors/dreamWaveTools.ts +475 -0
  5. package/extension/doors/objectiveReviewBrowser.ts +36 -13
  6. package/extension/doors/objectiveStack.ts +1 -1
  7. package/extension/doors/planReviewBrowser.ts +30 -8
  8. package/extension/doors/prReview.ts +156 -49
  9. package/extension/doors/prReviewDynamic.ts +33 -13
  10. package/extension/doors/reviewWaveTools.ts +37 -14
  11. package/extension/factories/objectiveDraft.ts +95 -27
  12. package/extension/factories/objectiveDreamReport.ts +347 -0
  13. package/extension/factories/objectiveSave.ts +74 -1
  14. package/extension/factories/planReview.ts +173 -10
  15. package/extension/index.ts +62 -15
  16. package/extension/substrate/agentScratch.ts +171 -0
  17. package/extension/substrate/bindingDelivery.ts +9 -11
  18. package/extension/substrate/cache.ts +92 -2
  19. package/extension/substrate/command.ts +9 -6
  20. package/extension/substrate/config.ts +6 -1
  21. package/extension/substrate/git.ts +85 -2
  22. package/extension/substrate/result.ts +3 -2
  23. package/extension/substrate/sessionData.ts +6 -4
  24. package/extension/substrate/sessionPointers.ts +3 -4
  25. package/extension/substrate/toolGating.ts +9 -0
  26. package/extension/substrate/workflowState.ts +44 -2
  27. package/extension/surfaces/report.ts +38 -12
  28. package/extension/surfaces/surfaces.ts +129 -7
  29. package/extension/vendor/btw/btw.ts +38 -6
  30. package/extension/waves/adversarialReviewWave.ts +19 -2
  31. package/extension/waves/draftReviewWave.ts +17 -1
  32. package/extension/waves/dreamReducerWave.ts +700 -0
  33. package/extension/waves/dreamReport.ts +1494 -0
  34. package/extension/waves/dreamWave.ts +927 -0
  35. package/extension/waves/harvestWave.ts +1 -1
  36. package/extension/waves/ponytail.ts +104 -0
  37. package/extension/waves/prReviewDynamicWave.ts +115 -34
  38. package/extension/waves/prReviewWave.ts +122 -17
  39. package/extension/waves/reportWave.ts +103 -7
  40. package/extension/worker/readOnlySession.ts +2 -3
  41. package/package.json +6 -3
  42. package/prompts/_fixtures/live.yaml +49 -0
  43. package/prompts/commit-and-compact-continuation.md +13 -0
  44. package/prompts/contexts/adapters/plannotator-objective.md +7 -1
  45. package/prompts/contexts/adapters/plannotator-plan.md +7 -1
  46. package/prompts/stages/conflict-resolution.md +1 -1
  47. package/prompts/stages/learn-dream.md +10 -0
  48. package/prompts/stages/objective-review-browser.md +1 -1
  49. package/prompts/stages/plan-review-browser.md +1 -1
  50. package/prompts/stages/pr-review-browser/active.md +1 -1
  51. package/prompts/stages/pr-review-browser/foreign.md +1 -1
  52. package/prompts/stages/pr-review-dynamic.md +5 -5
  53. package/prompts/stages/pr-review-terminal/active.md +1 -1
  54. package/prompts/stages/pr-review-terminal/foreign.md +1 -1
  55. package/prompts/stages/pr-review-terminal/local.md +1 -1
  56. package/prompts/stages/pr-review.md +5 -5
  57. package/shared/bindings.yaml +3 -0
  58. package/shared/contracts.md +2176 -500
  59. package/shared/registry.yaml +12 -12
  60. package/shared/schemas/inputs/review-post-batch.schema.json +14 -1
  61. package/shared/schemas/outputs/objective-doctor.schema.json +39 -1
  62. package/shared/schemas/outputs/pr-land.schema.json +3 -3
@@ -78,7 +78,7 @@ stages:
78
78
  command: gist author # dedicated seeded cold door (perk gist author)
79
79
  requires: [] # nothing exists yet — this stage CREATES the gist
80
80
  reads: []
81
- writes: [session.workflow-state, cache.session-data] # the read-only `mode` append; gist_draft writes the gist-draft artifact + its session_artifacts pointer
81
+ writes: [session.workflow-state, cache.session-data, cache.scratch] # the read-only `mode` append; gist_draft writes the gist-draft artifact + its session_artifacts pointer; eligible turns may provision agent scratch
82
82
  predecessors: [] # an initial of the disconnected gist component
83
83
  successors: [gist-save]
84
84
 
@@ -91,7 +91,7 @@ stages:
91
91
  command: gist save # the gist_save terminating tool + /gist-save command
92
92
  requires: []
93
93
  reads: []
94
- writes: [github.gist, session.workflow-state] # create the gist issue/project
94
+ writes: [github.gist, session.workflow-state, cache.scratch] # create the gist issue/project; eligible turns may provision agent scratch
95
95
  predecessors: [gist-author]
96
96
  successors: [] # a terminal — consumption happens via the adoption doors, not edges
97
97
 
@@ -104,7 +104,7 @@ stages:
104
104
  command: objective author # P3.T2: dedicated seeded cold door (perk objective author)
105
105
  requires: [] # nothing exists yet — this stage CREATES the objective
106
106
  reads: []
107
- writes: [session.workflow-state, cache.session-data] # the read-only `mode` append (the gate toggle); #352 Node 2.1: objective_draft writes the objective-draft artifact + its session_artifacts pointer
107
+ writes: [session.workflow-state, cache.session-data, cache.scratch] # the read-only `mode` append (the gate toggle); #352 Node 2.1: objective_draft writes the objective-draft artifact + its session_artifacts pointer; eligible turns may provision agent scratch
108
108
  predecessors: [] # the new single initial (authoring precedes everything)
109
109
  successors: [objective-save]
110
110
 
@@ -117,7 +117,7 @@ stages:
117
117
  command: objective save # P3.T2: the objective_save terminating tool + /objective-save command
118
118
  requires: []
119
119
  reads: []
120
- writes: [github.objective, session.workflow-state] # create the objective issue; link active_objective
120
+ writes: [github.objective, session.workflow-state, cache.scratch] # create the objective issue; link active_objective; eligible turns may provision agent scratch
121
121
  predecessors: [objective-author]
122
122
  successors: [objective-plan]
123
123
 
@@ -130,7 +130,7 @@ stages:
130
130
  command: objective plan # P2.T10: dedicated cold door (perk objective plan) + /objective-plan
131
131
  requires: [github.objective] # an objective issue must exist
132
132
  reads: [github.objective] # roadmap nodes + next-node selection
133
- writes: [github.objective, session.workflow-state, cache.session-data] # mark node planning; set active_objective; #339 Node 2.1: plan_draft writes the working-plan artifact + its session_artifacts pointer
133
+ writes: [github.objective, session.workflow-state, cache.session-data, cache.scratch] # mark node planning; set active_objective; #339 Node 2.1: plan_draft writes the working-plan artifact + its session_artifacts pointer; eligible turns may provision agent scratch
134
134
  predecessors: [objective-save] # P3.T2: objective-save now precedes planning
135
135
  successors: [plan]
136
136
 
@@ -143,7 +143,7 @@ stages:
143
143
  command: plan # slash = /plan (perk-owned P2.T2a; toggles the read-only tool gate)
144
144
  requires: []
145
145
  reads: []
146
- writes: [session.workflow-state, cache.session-data] # P2.T2a: /plan enter/exit appends `mode`; #339 Node 2.1: plan_draft writes the working-plan artifact + its session_artifacts pointer
146
+ writes: [session.workflow-state, cache.session-data, cache.scratch] # P2.T2a: /plan enter/exit appends `mode`; #339 Node 2.1: plan_draft writes the working-plan artifact + its session_artifacts pointer; eligible turns may provision agent scratch
147
147
  predecessors: [objective-plan] # P2.T10: objective-plan is the new single initial
148
148
  successors: [save]
149
149
 
@@ -156,7 +156,7 @@ stages:
156
156
  command: plan save # cold: the merged `perk plan save` door (Node 3.2); warm twin: the plan_save tool + /plan-save command
157
157
  requires: []
158
158
  reads: []
159
- writes: [github.plan, cache.plan-ref, session.workflow-state] # T2a: plan issue; T2b: plan-ref pointer; T3: warm door appends active_plan_ref
159
+ writes: [github.plan, cache.plan-ref, session.workflow-state, cache.scratch] # T2a: plan issue; T2b: plan-ref pointer; T3: warm door appends active_plan_ref; eligible turns may provision agent scratch
160
160
  predecessors: [plan]
161
161
  successors: [implement]
162
162
 
@@ -169,7 +169,7 @@ stages:
169
169
  command: implement
170
170
  requires: [cache.plan-ref] # T4: cold door derives plan-<pr_id> from the active ref
171
171
  reads: [cache.plan-ref] # T4: positions the worktree from the ref (agent reads github.plan)
172
- writes: [session.workflow-state] # T4: the worktree session links active_plan_ref on session_start
172
+ writes: [session.workflow-state, cache.scratch] # T4: the worktree session links active_plan_ref on session_start; eligible turns may provision agent scratch
173
173
  predecessors: [save]
174
174
  successors: [submit]
175
175
 
@@ -185,7 +185,7 @@ stages:
185
185
  # journal fold) and the native stack, and writes the journal (objective comments), the
186
186
  # checkpoint pair (plan header), and the stack registration. Incremental touches neither.
187
187
  reads: [cache.plan-ref, github.plan, github.objective, github.stack]
188
- writes: [github.pr, github.plan, github.objective, github.stack]
188
+ writes: [github.pr, github.plan, github.objective, github.stack, cache.scratch]
189
189
  predecessors: [implement]
190
190
  successors: [address]
191
191
 
@@ -200,7 +200,7 @@ stages:
200
200
  # submit before resolving. The stacked route owns the objective journal + native stack.
201
201
  requires: [github.pr] # the PR whose feedback we address
202
202
  reads: [cache.plan-ref, github.plan, github.pr, github.review-threads, github.comments, github.objective, github.stack]
203
- writes: [github.review-threads, github.comments, github.pr, github.plan, github.objective, github.stack, session.workflow-state]
203
+ writes: [github.review-threads, github.comments, github.pr, github.plan, github.objective, github.stack, session.workflow-state, cache.scratch]
204
204
  predecessors: [submit]
205
205
  successors: [land]
206
206
 
@@ -213,7 +213,7 @@ stages:
213
213
  command: pr land
214
214
  requires: [github.pr] # T5b: the PR to merge must exist
215
215
  reads: [cache.plan-ref, github.pr, github.objective] # T5b ref->branch->PR; T11a node lookup
216
- writes: [github.pr, cache.markers, github.objective, github.plan] # T5b merge+marker; T11a mechanical node-done; §8.36 learn_state header stamp
216
+ writes: [github.pr, cache.markers, github.objective, github.plan, cache.scratch] # T5b merge+marker; T11a mechanical node-done; §8.36 learn_state header stamp; eligible turns may provision agent scratch
217
217
  predecessors: [address]
218
218
  successors: [learn]
219
219
 
@@ -234,7 +234,7 @@ stages:
234
234
  # keys (no new gateway op) — the existing learn tool / learn capture worker still persist.
235
235
  requires: [cache.markers] # pending-learn gates the worktree
236
236
  reads: [cache.markers, cache.plan-ref] # was it set? + the plan ref -> issue number/run_id
237
- writes: [cache.markers, github.learn, github.comments, github.plan] # clear marker; create learn issue + back-link; §8.36 learn_state header stamp
237
+ writes: [cache.markers, github.learn, github.comments, github.plan, cache.scratch] # clear marker; create learn issue + back-link; §8.36 learn_state header stamp; eligible turns may provision agent scratch
238
238
  predecessors: [land]
239
239
  successors: []
240
240
 
@@ -29,7 +29,7 @@
29
29
  }
30
30
  },
31
31
  "additionalProperties": false,
32
- "description": "The strict `/pr-review` batch shape (`{verdict, summary, comments?, fyi?}`).\n\n`comments`/`fyi` stay nullable so an explicit `null` is tolerated (today's behavior),\nnormalized to `[]` in conversion. `line: int` under strict rejects `bool`/`float`/`str`\n(preserving the old `isinstance(line, bool)` guard).",
32
+ "description": "The strict `/pr-review` batch shape.\n\n`comments`/`fyi` stay nullable so an explicit `null` is tolerated (today's behavior),\nnormalized to `[]` in conversion. `line: int` and `expected_pr: int` reject\n`bool`/`float`/`str` under strict validation.",
33
33
  "properties": {
34
34
  "verdict": {
35
35
  "enum": [
@@ -73,6 +73,19 @@
73
73
  ],
74
74
  "default": null,
75
75
  "title": "Fyi"
76
+ },
77
+ "expected_pr": {
78
+ "anyOf": [
79
+ {
80
+ "exclusiveMinimum": 0,
81
+ "type": "integer"
82
+ },
83
+ {
84
+ "type": "null"
85
+ }
86
+ ],
87
+ "default": null,
88
+ "title": "Expected Pr"
76
89
  }
77
90
  },
78
91
  "required": [
@@ -1,5 +1,35 @@
1
1
  {
2
2
  "$defs": {
3
+ "_CorruptionFindingOut": {
4
+ "additionalProperties": false,
5
+ "description": "One kind-corruption finding over the objective's issue-tier carrier (report-only \u2014\n``--fix`` never touches it; no repair code path exists).",
6
+ "properties": {
7
+ "code": {
8
+ "title": "Code",
9
+ "type": "string"
10
+ },
11
+ "carrier": {
12
+ "title": "Carrier",
13
+ "type": "string"
14
+ },
15
+ "message": {
16
+ "title": "Message",
17
+ "type": "string"
18
+ },
19
+ "remediation": {
20
+ "title": "Remediation",
21
+ "type": "string"
22
+ }
23
+ },
24
+ "required": [
25
+ "code",
26
+ "carrier",
27
+ "message",
28
+ "remediation"
29
+ ],
30
+ "title": "_CorruptionFindingOut",
31
+ "type": "object"
32
+ },
3
33
  "_DriftConditionOut": {
4
34
  "additionalProperties": false,
5
35
  "properties": {
@@ -432,6 +462,13 @@
432
462
  "type": "null"
433
463
  }
434
464
  ]
465
+ },
466
+ "corruption": {
467
+ "items": {
468
+ "$ref": "#/$defs/_CorruptionFindingOut"
469
+ },
470
+ "title": "Corruption",
471
+ "type": "array"
435
472
  }
436
473
  },
437
474
  "required": [
@@ -442,7 +479,8 @@
442
479
  "fix",
443
480
  "redirected_from",
444
481
  "train",
445
- "train_fix"
482
+ "train_fix",
483
+ "corruption"
446
484
  ],
447
485
  "title": "ObjectiveDoctorOut",
448
486
  "type": "object"
@@ -2,7 +2,7 @@
2
2
  "$defs": {
3
3
  "LandPrOut": {
4
4
  "additionalProperties": false,
5
- "description": "The serialization boundary of the picked :class:`github.PullRequest` subset\n(field order load-bearing).",
5
+ "description": "The serialization boundary of :class:`delivery.LandResult.PrSummary`\n(field order load-bearing).",
6
6
  "properties": {
7
7
  "number": {
8
8
  "title": "Number",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "LearnConsumeOut": {
24
24
  "additionalProperties": false,
25
- "description": "The serialization boundary of :class:`LearnConsumeUpdate` (field order load-bearing).",
25
+ "description": "The serialization boundary of :class:`delivery.LandResult.LearnUpdate`\n(field order load-bearing).",
26
26
  "properties": {
27
27
  "closed": {
28
28
  "items": {
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "ObjectiveLandOut": {
54
54
  "additionalProperties": false,
55
- "description": "The serialization boundary of :class:`ObjectiveLandUpdate` (field order load-bearing).\n\n``id`` maps from the domain ``objective`` field (the linked objective id).",
55
+ "description": "The serialization boundary of :class:`delivery.LandResult.ObjectiveUpdate`\n(field order load-bearing).\n\n``id`` maps from the domain ``objective`` field (the linked objective id).",
56
56
  "properties": {
57
57
  "id": {
58
58
  "anyOf": [