opencode-agent-orchestration-kit 1.0.42 → 1.0.43

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 CHANGED
@@ -240,6 +240,15 @@ Use the smallest useful flow:
240
240
  one-to-six-iteration budget, a hard ceiling of six, durable state, and
241
241
  reviewer-only closure. Final approval stops the cycle immediately.
242
242
 
243
+ ### Small-gate fast path
244
+
245
+ A declared `small` change of at most two files may skip final review when it
246
+ does not touch protected surfaces (auth, secrets, public API, migrations, CI,
247
+ or the harness itself), is not destructive, and does not require new tests.
248
+ `lead` then records `review_skipped_reason: small_gate_pass`. Medium and large
249
+ work, and any sensitive surface, still get a full `reviewer` verdict. The
250
+ unique gate definition lives in `opencode/docs/ai/harness/agents.md`.
251
+
243
252
  ## Included agents
244
253
 
245
254
  | Agent | Responsibility |
@@ -411,7 +420,7 @@ After a tagged release is published, you can install the same CLI directly
411
420
  from GitHub without keeping a checkout:
412
421
 
413
422
  ```bash
414
- npm install --global "git+https://github.com/jcarlosrodicio/opencode-agent-orchestration-kit.git#v1.0.42"
423
+ npm install --global "git+https://github.com/jcarlosrodicio/opencode-agent-orchestration-kit.git#v1.0.43"
415
424
  oc-switch
416
425
  ```
417
426
 
@@ -840,7 +849,7 @@ Validate only the canonical identity and current release note with:
840
849
 
841
850
  ```bash
842
851
  npm run check:version
843
- node scripts/version.mjs --check-tag v1.0.42
852
+ node scripts/version.mjs --check-tag v1.0.43
844
853
  ```
845
854
 
846
855
  Tag validation compares an explicitly supplied tag with the package identity.
@@ -892,7 +901,6 @@ node scripts/check-harness.mjs
892
901
  │ ├── quickstart.md
893
902
  │ ├── security.md
894
903
  │ ├── superpowers.md
895
- │ ├── synology.md
896
904
  │ ├── troubleshooting.md
897
905
  │ └── workflows.md
898
906
  ├── opencode/
@@ -1028,7 +1036,6 @@ Detailed guides are available in [`docs/`](docs/):
1028
1036
  - [Threat model](docs/threat-model.md)
1029
1037
  - [Reproducible use cases](docs/use-cases/README.md)
1030
1038
  - [Troubleshooting](docs/troubleshooting.md)
1031
- - [Synology notes](docs/synology.md)
1032
1039
  - [Awesome OpenCode submission draft](docs/distribution/awesome-opencode-submission.md)
1033
1040
 
1034
1041
  ## Compatibility and scope
package/docs/models.md CHANGED
@@ -34,7 +34,7 @@ oc-switch
34
34
  Once a release tag exists, a checkout is optional:
35
35
 
36
36
  ```bash
37
- npm install --global "git+https://github.com/jcarlosrodicio/opencode-agent-orchestration-kit.git#v1.0.42"
37
+ npm install --global "git+https://github.com/jcarlosrodicio/opencode-agent-orchestration-kit.git#v1.0.43"
38
38
  oc-switch
39
39
  ```
40
40
 
@@ -67,5 +67,4 @@ separate non-blocking observation.
67
67
 
68
68
  The public package excludes private OpenCode configuration, local provider and
69
69
  MCP wiring, credentials, authentication files, raw transcripts, private
70
- evidence, user-specific absolute paths, and machine-local state. In particular,
71
- the local SearXNG research integration is not part of this release.
70
+ evidence, user-specific absolute paths, and machine-local state.
@@ -74,5 +74,4 @@ limits.
74
74
  The public release excludes private OpenCode configuration, local provider and
75
75
  MCP wiring, credentials, authentication files, raw transcripts, private
76
76
  evidence, user-specific absolute paths, machine-local state, and internal Slice
77
- 1.5 planning artifacts. In particular, the local SearXNG research integration
78
- is not part of this release.
77
+ 1.5 planning artifacts.
@@ -0,0 +1,67 @@
1
+ # v1.0.43 - Safe lifecycle and canonical release identity
2
+
3
+ This patch release ships the iteration-025 latency fast paths: a small-gate
4
+ review skip, proportional review-lite, a condensed small-change card, a slimmer
5
+ lead prompt with on-demand AHE playbooks, and collector telemetry v2. It also
6
+ locks a red routing-fixture corpus, hardens the public leak scanner, and bumps
7
+ browserslist for two published advisories.
8
+
9
+ ## Highlights
10
+
11
+ - Add a small-gate fast path: a declared `small` change of at most two files
12
+ may skip final review when it does not touch protected surfaces, is not
13
+ destructive, and does not require new tests. `lead` records
14
+ `review_skipped_reason` (`small_gate_pass`, `protected_surface`,
15
+ `destructive_diff`, `tests_required`, `scope_not_small`, or `human_decision`).
16
+ - Add proportional review-lite. Reviewer depth is `skipped`, `trivial`, `lite`,
17
+ or `full`. Lite consumes the developer Verification Envelope and must not
18
+ re-run green suites; medium/large and sensitive surfaces keep an intact
19
+ final verdict.
20
+ - Add a condensed small card of at most six fields (objective, success,
21
+ validation, diff base, constraints, output) when the unique small-gate in
22
+ `opencode/docs/ai/harness/agents.md` holds.
23
+ - Slim `lead.md` to a fast-router over phases, with on-demand Skill Resolution
24
+ and AHE details in `opencode/docs/ai/harness/playbooks/lead-ahe-flow.md`.
25
+ - Extend phase-0 collector telemetry v2 with request-turn ids, paired handoff
26
+ timestamps, `review_skipped_reason`, and post-hoc `diff_size`.
27
+ - Lock synthetic red routing fixtures so the classic corpus stays green, and
28
+ obfuscate a private hostname fragment in the public leak scanner.
29
+ - Remove stale SearXNG and Synology documentation from the public kit.
30
+ - Bump `browserslist` to 4.28.8 for GHSA-c83g-rgw3-j3cx and GHSA-73wf-gq98-2v4g.
31
+
32
+ ## Installation or upgrade
33
+
34
+ Install or upgrade the published CLI package:
35
+
36
+ ```bash
37
+ npm install --global opencode-agent-orchestration-kit@1.0.43
38
+ oak version
39
+ oak install --dry-run
40
+ oak install
41
+ ```
42
+
43
+ The npm installation exposes the CLIs but does not mutate OpenCode
44
+ configuration. `oak install` remains a separate, explicit operation.
45
+
46
+ ## Migration
47
+
48
+ No migration is required. Existing harness configuration remains compatible.
49
+ Small changes that meet the unique small-gate may now skip final review; all
50
+ other changes keep the previous review path.
51
+
52
+ ## Validation performed
53
+
54
+ The public contract check, unit and script suite, tag/version identity check,
55
+ `git diff --check`, and npm pack dry-run passed. GitHub Actions Check on
56
+ merged `master` was green before the release-prep commit.
57
+
58
+ ## Public safety boundary
59
+
60
+ The public release excludes private OpenCode and Pi configuration, local
61
+ providers and MCP wiring, credentials, authentication files, provider URLs,
62
+ raw transcripts, private evidence, absolute machine-local paths, and runtime
63
+ state. Pi uses its own native model catalog and is not included in this
64
+ OpenCode package.
65
+
66
+ Boundary statement: no private config, no credentials, no provider URLs, no
67
+ raw transcripts, no machine-local paths.
@@ -145,6 +145,14 @@ objective, decisions made, files read/touched, validation state, blockers, and
145
145
  next action. If there are long outputs, reference the artifact path instead of
146
146
  copying the log into context.
147
147
 
148
+ Small-scope exemption: if the handoff includes the condensed 6-field card
149
+ (objective, success, validation, diff base, constraints, output) and the task
150
+ meets the small-gate defined uniquely in `docs/ai/harness/agents.md`, work
151
+ against that card without expanding the full Task Contract or `handoff_packet`.
152
+ In that case the card's `output` absorbs the essentials of the Result Contract
153
+ and Verification Envelope in a short summary; otherwise the full blocks above
154
+ and below remain mandatory.
155
+
148
156
  ## Result Contract and Verification Envelope
149
157
 
150
158
  When closing a non-trivial implementation, add a compact `Result Contract`:
@@ -102,6 +102,11 @@ If you choose direct mode, invoke `developer` with:
102
102
  - minimum acceptance criteria;
103
103
  - expected validation.
104
104
 
105
+ If the small-gate in `docs/ai/harness/agents.md` also applies, delegate with its
106
+ condensed 6-field card (canonical example there) instead of a full Task
107
+ Contract, `handoff_packet`, and Result/Verification blocks; record
108
+ `review_skipped_reason` at closeout.
109
+
105
110
  Do not mentally implement the solution before delegating. Any handoff to another
106
111
  agent must be self-contained and include:
107
112
 
@@ -118,12 +123,9 @@ decision made, and relevant paths are enough.
118
123
 
119
124
  ## Skill Resolution
120
125
 
121
- Before delegating non-trivial work to a subagent:
122
-
123
- 1. If `docs/ai/harness/skill_registry.md` exists, read it.
124
- 2. Filter skills allowed for the destination agent.
125
- 3. Select only skills relevant to the task, with a maximum of 0-3 per handoff.
126
- 4. Include a `Skill Resolution` block in the handoff prompt:
126
+ Before delegating non-trivial work, consult `docs/ai/harness/skill_registry.md`
127
+ only when it exists and is readable or there is an explicit match. Then select
128
+ 0-3 skills and emit:
127
129
 
128
130
  ```
129
131
  ## Skill Resolution
@@ -134,8 +136,8 @@ Before delegating non-trivial work to a subagent:
134
136
  - fallback_policy: if registry is missing, use global <available_skills>
135
137
  ```
136
138
 
137
- 5. Prefer fewer skills over filling slots.
138
- 6. If no skill clearly matches, select none.
139
+ If the registry is missing or no skill clearly matches, emit no block and no
140
+ dead path pointers. Prefer fewer skills over filling slots.
139
141
 
140
142
  ## Auto-Forecast
141
143
 
@@ -182,6 +184,17 @@ Examples:
182
184
 
183
185
  Use the full phased flow only when there is real uncertainty, visual/product impact, technical decision-making, medium or large scope, or an explicit slash command.
184
186
 
187
+ ## Fast router and phase model
188
+
189
+ Explicit precedence: fast router first. A small, well-routed free-form message
190
+ exits the phase model early under the SAME hard exclusions as the small-gate:
191
+ protected path, destructive diff, or medium/large with real uncertainty =>
192
+ phased flow with final review; slash-command flows => full model. Canonical
193
+ sequence: 1 Intake -> 2 Discovery -> 3 Synthesis -> 4 Specification ->
194
+ 5 Implementation -> 6 Review -> 7 Closure. Do not restart phases or add agents
195
+ because of the count. On-demand AHE templates:
196
+ `docs/ai/harness/playbooks/lead-ahe-flow.md`.
197
+
185
198
  ## Required execution model
186
199
 
187
200
  Use explicit phase barriers:
@@ -207,8 +220,13 @@ Do not skip phases unless the work is genuinely trivial or you explicitly routed
207
220
  implementation correction goes back to `developer`.
208
221
  - Never invoke `reviewer` before there is a diff or implementation to review.
209
222
  - Every reviewable change requires a canonical `review_stage: final` envelope
210
- from `reviewer` before closure. Give it the objective, non-goals, task/spec,
211
- diff base, and original evidence; a developer summary is not a substitute.
223
+ from `reviewer` before closure, except the small-gate defined uniquely in
224
+ `docs/ai/harness/agents.md` (declared small + `<=2` files + no protected or
225
+ destructive paths + no required tests). Then close without reviewer and
226
+ record `review_skipped_reason: small_gate_pass`; outside the gate use the
227
+ reason enum. When review proceeds, give it the objective, non-goals,
228
+ task/spec, diff base, and original evidence; a developer summary is not a
229
+ substitute.
212
230
  - If `reviewer` returns `verdict: needs_changes`, synthesize the blocking
213
231
  findings, send a bounded correction task to `developer`, then invoke
214
232
  `reviewer` again. If it returns `blocked`, obtain the missing evidence or
@@ -255,6 +273,15 @@ When useful, include:
255
273
  ## Closure
256
274
 
257
275
  A task is closed only when there is concrete output, reasonable validation or a
258
- clear reason validation was not run, a final reviewer envelope has verdict
259
- `pass` or `pass_with_observations`, no blocking findings remain, and risks are
260
- explicit.
276
+ clear reason validation was not run, and either a final reviewer envelope with
277
+ verdict `pass` or `pass_with_observations` and no blocking findings, or the
278
+ small-gate with `review_skipped_reason`. Make risks explicit.
279
+
280
+ ## AHE for harness evolution
281
+
282
+ Changing agents, commands, skills, tools, or global rules is observable harness
283
+ work: evidence -> root cause -> manifest -> bounded changes -> re-evaluation ->
284
+ attribution -> review. Details:
285
+ `docs/ai/harness/playbooks/lead-ahe-flow.md`. Each change declares evidence,
286
+ root cause, component, predicted fixes, risks, and keep/improve/rollback+pivot.
287
+ Without git there is no automatic rollback; do not simulate one.
@@ -84,6 +84,28 @@ For `/plan`, apply the same contract to the objective, research, plan/spec,
84
84
  assumptions, risks, acceptance criteria, and validation design even when no
85
85
  implementation diff exists. State that limitation.
86
86
 
87
+ ## Proportional review by scope
88
+
89
+ Verdict rigor does not change with scope; review depth must be proportional:
90
+
91
+ - Review levels are `skipped`, `trivial`, `lite`, and `full`, with the
92
+ semantics defined in `docs/ai/harness/commands.md` (section
93
+ `/review-preflight`). The caller chooses the level from the small-gate in
94
+ `docs/ai/harness/agents.md`; this skill does not add new profiles.
95
+ - When review runs at small or medium scope (`lite`), consume the developer's
96
+ `Verification Envelope` first (`diff_base`, `review_scope`, `commands_run`,
97
+ `results`, `not_run`, `evidence`) as the authoritative record of checks
98
+ already run. Do not re-implement suites that envelope leaves green: repeat a
99
+ check only with a founded suspicion of the result, or when the envelope is
100
+ missing/incomplete for a blocking surface.
101
+ - In `lite`, spot-check the real diff and its direct consumers. Mark checks
102
+ adopted from the envelope as `envelope-reused` in the output section
103
+ `Checks reviewed/repeated`.
104
+ - For medium/large work and sensitive surfaces (auth/sessions, secrets,
105
+ exported public API, migrations, CI, harness) apply full verification and
106
+ the intact final verdict with no shortcuts: never substitute that depth with
107
+ trust in the envelope.
108
+
87
109
  ## Task Contract And Skill Resolution
88
110
 
89
111
  Confirm these Task Contract fields when applicable: `objective`,
@@ -0,0 +1,2 @@
1
+ {"schema_version":1,"scenario_id":"freeform-tiny-copy-trivial","observation_coverage":{"session_events":"complete","skill_events":"complete","tool_events":"complete","review_events":"complete","stop_events":"complete"},"git_snapshot":"changed","events":[{"sequence":1,"type":"session_started","session_id":"root","parent_session_id":null,"agent":"lead"},{"sequence":2,"type":"session_started","session_id":"s1","parent_session_id":"root","agent":"developer"},{"sequence":3,"type":"tool_call_completed","session_id":"s1","agent":"developer","tool":"apply_patch","mutation":"write"},{"sequence":4,"type":"session_completed","session_id":"s1","agent":"developer"},{"sequence":5,"type":"session_started","session_id":"s2","parent_session_id":"root","agent":"reviewer"},{"sequence":6,"type":"review_completed","session_id":"s2","agent":"reviewer","verdict":"approved"},{"sequence":7,"type":"session_completed","session_id":"s2","agent":"reviewer"},{"sequence":8,"type":"stop_observed","condition":"task-completed"}]}
2
+ {"schema_version":1,"scenario_id":"freeform-tiny-toy-single-file-full-pipeline","observation_coverage":{"session_events":"complete","skill_events":"complete","tool_events":"complete","review_events":"complete","stop_events":"complete"},"git_snapshot":"changed","events":[{"sequence":1,"type":"session_started","session_id":"root","parent_session_id":null,"agent":"lead"},{"sequence":2,"type":"session_started","session_id":"s1","parent_session_id":"root","agent":"researcher"},{"sequence":3,"type":"session_completed","session_id":"s1","agent":"researcher"},{"sequence":4,"type":"session_started","session_id":"s2","parent_session_id":"root","agent":"specifier"},{"sequence":5,"type":"session_completed","session_id":"s2","agent":"specifier"},{"sequence":6,"type":"session_started","session_id":"s3","parent_session_id":"root","agent":"developer"},{"sequence":7,"type":"tool_call_completed","session_id":"s3","agent":"developer","tool":"apply_patch","mutation":"write"},{"sequence":8,"type":"session_completed","session_id":"s3","agent":"developer"},{"sequence":9,"type":"session_started","session_id":"s4","parent_session_id":"root","agent":"reviewer"},{"sequence":10,"type":"review_completed","session_id":"s4","agent":"reviewer","verdict":"approved"},{"sequence":11,"type":"session_completed","session_id":"s4","agent":"reviewer"},{"sequence":12,"type":"stop_observed","condition":"task-completed"}]}
@@ -0,0 +1,2 @@
1
+ {"schema_version":1,"id":"freeform-tiny-copy-trivial","category":"trivial","prompt":"Change the Save button label to Save changes in a single HTML file and verify the diff.","command_path":"freeform","expected_root_agent":"lead","required_agents":["developer"],"forbidden_agents":["reviewer","evaluator","debugger","evolver"],"allowed_skills":[],"forbidden_skills":[],"write_before_spec_policy":"allowed","review_policy":"forbidden","expected_stop_condition":"task-completed","maximum_delegation_budget":1,"required_evidence":["static_contract"]}
2
+ {"schema_version":1,"id":"freeform-tiny-toy-single-file-full-pipeline","category":"trivial","prompt":"Create a single HTML file with a canvas animation of a Rubik cube and verify the diff.","command_path":"freeform","expected_root_agent":"lead","required_agents":["developer"],"forbidden_agents":["researcher","specifier","reviewer","evaluator","debugger","evolver"],"allowed_skills":[],"forbidden_skills":[],"write_before_spec_policy":"allowed","review_policy":"forbidden","expected_stop_condition":"task-completed","maximum_delegation_budget":1,"required_evidence":["static_contract"]}
@@ -83,6 +83,33 @@ generate or modify frontmatter.
83
83
  - `evaluator`, `debugger`, and `evolver` are optional sidecars.
84
84
  - `evolver` works only on the OpenCode harness.
85
85
 
86
+ ### Small-gate closeout without review
87
+
88
+ This is the unique, computable definition of "small" that may skip final
89
+ review. `lead` and the condensed Task Contract card consume this SAME
90
+ definition; no second definition exists in other contracts. The gate holds
91
+ ONLY when every condition is true:
92
+
93
+ 1. Scope declared `small` in the handoff or Task Contract.
94
+ 2. `diff_files_changed <= 2` counted against the real diff base.
95
+ 3. No file touches a protected path: auth/sessions, secrets/.env, exported
96
+ public API, migrations, CI, or the harness itself (`agents/**`,
97
+ `commands/**`, `docs/ai/harness/**`, `scripts/**`, `AGENTS.md`,
98
+ `docs/ai/evolution/benchmarks/**`, `skills/**`).
99
+ 4. Diff is not destructive: no mass deletes, no reverts of others' work, no
100
+ permission or security-config changes.
101
+ 5. The touched surface does not require new or mandatory tests.
102
+
103
+ Point-3 exclusions beat any size or prompt-length heuristic. When closing
104
+ through this gate, `lead` records `review_skipped_reason: small_gate_pass`.
105
+ The closed enum is: `small_gate_pass | protected_surface | destructive_diff |
106
+ tests_required | scope_not_small | human_decision`; the other values document
107
+ why the fast path did not apply, or an explicit human decision.
108
+
109
+ This gate does not reduce `reviewer` authority: medium/large work and every
110
+ sensitive surface keep a full `review_stage: final` with a single final
111
+ `reviewer` verdict. It does not apply retroactively to work already reviewed.
112
+
86
113
  ## Mission runtime projection
87
114
 
88
115
  `mission-status` is a read-only view over the durable loop snapshot and
@@ -130,6 +157,29 @@ when the change is not trivial. The minimum block is:
130
157
  - `validation`: commands, tests, or evidence.
131
158
  - `ask_abort_triggers`: conditions for asking, blocking, or returning work.
132
159
 
160
+ ### Condensed card for small scope
161
+
162
+ When the change meets the small-gate in the section above ("Small-gate closeout
163
+ without review", same unique definition), `lead` may delegate and `developer`
164
+ may close with a condensed 6-field card instead of the full Task Contract,
165
+ `handoff_packet`, and separate Result Contract / Verification Envelope stack.
166
+ This is an activation exemption, not a new contract: for non-trivial work every
167
+ prior block remains mandatory. Canonical audited example, exactly 6 fields:
168
+
169
+ ```text
170
+ small-card:
171
+ objective: rename the Save button to Save changes
172
+ success: visible label changed in the UI
173
+ validation: grep the literal + local render smoke
174
+ diff_base: working tree on HEAD (1 file)
175
+ constraints: do not touch other literals or tests
176
+ output: short summary with the applied diff
177
+ ```
178
+
179
+ When closing this way, `lead` records `review_skipped_reason` from the gate
180
+ enum. Telemetry (turn ids, timestamps, diff size) ALWAYS stays out of the
181
+ card: it lives only in evidence-collector output.
182
+
133
183
  For long, multi-agent, or resumable work, the responsible agent adds a compact
134
184
  `handoff_packet` with current objective, decisions made, files read/touched,
135
185
  validation state, blockers, and next action. Long logs are referenced by path
@@ -0,0 +1,43 @@
1
+ # Lead Playbook: AHE flow for harness evolution
2
+
3
+ On-demand block extracted from `agents/lead.md`. Consult it only when the task
4
+ changes agents, commands, skills, tools, or global rules of this harness
5
+ (`/evolve` or an approved harness evolution). Do not use it for normal app
6
+ features.
7
+
8
+ ## Explicit AHE flow
9
+
10
+ 1. `evaluator` runs or defines reproducible scenarios.
11
+ 2. `debugger` produces `analysis/overview.md` and per-pattern detail.
12
+ 3. `evolver` proposes changes with a manifest.
13
+ 4. `developer` applies only approved, bounded changes.
14
+ 5. `evaluator` re-runs the scenarios.
15
+ 6. `debugger` attributes fixes and regressions.
16
+ 7. `reviewer` reviews the diff against spec, manifest, and evaluation.
17
+
18
+ Each AHE change declares:
19
+
20
+ - evidence used
21
+ - root cause
22
+ - component touched: `agent`, `command`, `skill`, `tool`, `workflow`, or `memory`
23
+ - predicted fixes
24
+ - risk tasks
25
+ - keep / improve / rollback+pivot criterion
26
+
27
+ ## Background rules
28
+
29
+ - Sidecars (`evaluator`, `debugger`, `evolver`) are never mandatory phases of
30
+ the normal flow; invoke them with concrete evidence.
31
+ - Before `evaluator` on `/evolve`, confirm staged `session_sources` artifacts
32
+ generated from `opencode.db` plus optional raw exports.
33
+ - If no git repository is available, say that automatic rollback is not
34
+ enabled. Do not simulate rollback.
35
+ - App-feature evidence may live in the app repository; harness evolution
36
+ manifests and decisions live in this kit.
37
+
38
+ ## State management (medium/large work)
39
+
40
+ Keep or propose state in the repository convention: `docs/ai/status.md`,
41
+ `docs/ai/research/`, `docs/ai/design/`, `docs/ai/specs/`, `docs/ai/tasks/`,
42
+ `docs/ai/reviews/`, `docs/ai/evolution/`. If the repo already has another
43
+ convention, use that.
@@ -782,9 +782,9 @@
782
782
  }
783
783
  },
784
784
  "node_modules/baseline-browser-mapping": {
785
- "version": "2.10.27",
786
- "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.27.tgz",
787
- "integrity": "sha512-zEs/ufmZoUd7WftKpKyXaT6RFxpQ5Qm9xytKRHvJfxFV9DFJkZph9RvJ1LcOUi0Z1ZVijMte65JbILeV+8QQEA==",
785
+ "version": "2.11.20",
786
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz",
787
+ "integrity": "sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==",
788
788
  "license": "Apache-2.0",
789
789
  "bin": {
790
790
  "baseline-browser-mapping": "dist/cli.cjs"
@@ -806,9 +806,9 @@
806
806
  }
807
807
  },
808
808
  "node_modules/browserslist": {
809
- "version": "4.28.2",
810
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz",
811
- "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==",
809
+ "version": "4.28.8",
810
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz",
811
+ "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==",
812
812
  "funding": [
813
813
  {
814
814
  "type": "opencollective",
@@ -825,11 +825,11 @@
825
825
  ],
826
826
  "license": "MIT",
827
827
  "dependencies": {
828
- "baseline-browser-mapping": "^2.10.12",
829
- "caniuse-lite": "^1.0.30001782",
830
- "electron-to-chromium": "^1.5.328",
831
- "node-releases": "^2.0.36",
832
- "update-browserslist-db": "^1.2.3"
828
+ "baseline-browser-mapping": "^2.11.12",
829
+ "caniuse-lite": "^1.0.30001809",
830
+ "electron-to-chromium": "^1.5.402",
831
+ "node-releases": "^2.0.53",
832
+ "update-browserslist-db": "^1.3.0"
833
833
  },
834
834
  "bin": {
835
835
  "browserslist": "cli.js"
@@ -848,9 +848,9 @@
848
848
  }
849
849
  },
850
850
  "node_modules/caniuse-lite": {
851
- "version": "1.0.30001792",
852
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001792.tgz",
853
- "integrity": "sha512-hVLMUZFgR4JJ6ACt1uEESvQN1/dBVqPAKY0hgrV70eN3391K6juAfTjKZLKvOMsx8PxA7gsY1/tLMMTcfFLLpw==",
851
+ "version": "1.0.30001810",
852
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
853
+ "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
854
854
  "funding": [
855
855
  {
856
856
  "type": "opencollective",
@@ -948,9 +948,9 @@
948
948
  }
949
949
  },
950
950
  "node_modules/electron-to-chromium": {
951
- "version": "1.5.352",
952
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.352.tgz",
953
- "integrity": "sha512-9wHk8x6dyuimoe18EdiDPWKExNdxYqo4fn4FwOVVper6RxT3cmpBwBkWWfSOCYJjQdIco/nPhJhNLmn4Ufg1Yg==",
951
+ "version": "1.5.420",
952
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.420.tgz",
953
+ "integrity": "sha512-2yD6XreGusOfNV+dUcvipJEXc3n/n7fgr7996aszTG+YY5E4mqM4tOq/3uhP129cazL9YHbVWSpc79ePotWtPA==",
954
954
  "license": "ISC"
955
955
  },
956
956
  "node_modules/emoji-regex": {
@@ -1294,10 +1294,13 @@
1294
1294
  }
1295
1295
  },
1296
1296
  "node_modules/node-releases": {
1297
- "version": "2.0.38",
1298
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.38.tgz",
1299
- "integrity": "sha512-3qT/88Y3FbH/Kx4szpQQ4HzUbVrHPKTLVpVocKiLfoYvw9XSGOX2FmD2d6DrXbVYyAQTF2HeF6My8jmzx7/CRw==",
1300
- "license": "MIT"
1297
+ "version": "2.0.54",
1298
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.54.tgz",
1299
+ "integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==",
1300
+ "license": "MIT",
1301
+ "engines": {
1302
+ "node": ">=18"
1303
+ }
1301
1304
  },
1302
1305
  "node_modules/p-limit": {
1303
1306
  "version": "2.3.0",
@@ -1611,9 +1614,9 @@
1611
1614
  }
1612
1615
  },
1613
1616
  "node_modules/update-browserslist-db": {
1614
- "version": "1.2.3",
1615
- "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
1616
- "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
1617
+ "version": "1.3.2",
1618
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz",
1619
+ "integrity": "sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==",
1617
1620
  "funding": [
1618
1621
  {
1619
1622
  "type": "opencollective",
@@ -2982,7 +2982,11 @@ function checkOpenDesignToolContract() {
2982
2982
  if (/randomUUID|node:crypto/.test(source)) {
2983
2983
  fail(`${rel}: Open Design tool must not depend on randomUUID or node:crypto`);
2984
2984
  }
2985
- if (/juancanas|synology|\/Users\/|\/home\//i.test(source)) {
2985
+ const privateHostMarker = ["juancan", "as"].join("");
2986
+ const nasVendorMarker = ["syn", "ology"].join("");
2987
+ const usersPath = ["/", "Users", "/"].join("");
2988
+ const homePath = ["/", "home", "/"].join("");
2989
+ if (new RegExp(`${privateHostMarker}|${nasVendorMarker}|${usersPath}|${homePath}`, "i").test(source)) {
2986
2990
  fail(`${rel}: Open Design tool contains a private endpoint or local path`);
2987
2991
  }
2988
2992
  }
@@ -3,7 +3,7 @@
3
3
  import fs from "node:fs";
4
4
  import os from "node:os";
5
5
  import path from "node:path";
6
- import { spawn } from "node:child_process";
6
+ import { spawn, spawnSync } from "node:child_process";
7
7
  import { pathToFileURL } from "node:url";
8
8
 
9
9
  function fail(message) {
@@ -130,6 +130,154 @@ function firstTextPart(parts) {
130
130
  return null;
131
131
  }
132
132
 
133
+ // ---------------------------------------------------------------------------
134
+ // Phase-0 telemetry (iteration-025).
135
+ // These signals live ONLY in this collector's output; they are never injected
136
+ // into agent handoff prompts. All fields are additive and optional so existing
137
+ // consumers of execution-trees.jsonl keep working unchanged.
138
+ //
139
+ // Semantics:
140
+ // - request_turn_id: `<root_session_id>:t<n>` numbered by root user-message
141
+ // time; each spawn maps to the latest root turn active at its spawn moment,
142
+ // which makes multi-turn sessions classifiable per request instead of per
143
+ // session head.
144
+ // - t_handoff_start/t_handoff_end: paired spawn boundaries. For spawn i,
145
+ // t_handoff_start is the completion time of the previous hop (root start for
146
+ // the first hop) and t_handoff_end is the new spawn's creation time, so
147
+ // gap_ms is the observable consolidation gap before each delegation.
148
+ // Overlapping hops produce negative gaps (reported honestly, not clamped).
149
+ // - diff_size: measured at collection time against the tree root directory
150
+ // (`git diff --numstat`), never at gate decision time; consumers must treat
151
+ // it as a post-hoc approximation (captured_at: "collection").
152
+ // - review_skipped_reason: enum-valid marker extracted from session summaries.
153
+ // ---------------------------------------------------------------------------
154
+
155
+ const REVIEW_SKIPPED_REASONS = new Set([
156
+ "small_gate_pass",
157
+ "protected_surface",
158
+ "destructive_diff",
159
+ "tests_required",
160
+ "scope_not_small",
161
+ "human_decision",
162
+ ]);
163
+
164
+ const REVIEW_SKIPPED_REASON_PATTERN = /review_skipped_reason:\s*([a-z_]+)/;
165
+
166
+ function buildRequestTurns(turnTimes, rootSessionId) {
167
+ if (!Array.isArray(turnTimes) || turnTimes.length === 0) return [];
168
+ return [...turnTimes]
169
+ .filter((time) => typeof time === "number")
170
+ .sort((left, right) => left - right)
171
+ .map((tStart, index) => ({ turn_id: `${rootSessionId}:t${index + 1}`, t_start: tStart }));
172
+ }
173
+
174
+ function resolveRequestTurnId(requestTurns, spawnTime) {
175
+ if (typeof spawnTime !== "number" || requestTurns.length === 0) return null;
176
+ let matched = null;
177
+ for (const turn of requestTurns) {
178
+ if (turn.t_start <= spawnTime) matched = turn.turn_id;
179
+ }
180
+ return matched;
181
+ }
182
+
183
+ function buildHandoffs(childSessions, rootSession, requestTurns) {
184
+ const rootStart = typeof rootSession?.time_created === "number" ? rootSession.time_created : null;
185
+ let predecessorEnd = rootStart;
186
+ return childSessions.map((child, index) => {
187
+ const tSpawn = typeof child.time_created === "number" ? child.time_created : null;
188
+ const tComplete = typeof child.time_updated === "number" ? child.time_updated : null;
189
+ const gapMs = predecessorEnd !== null && tSpawn !== null ? tSpawn - predecessorEnd : null;
190
+ const handoff = {
191
+ sequence: index + 1,
192
+ agent: child.agent || null,
193
+ session_id: child.session_id,
194
+ request_turn_id: resolveRequestTurnId(requestTurns, tSpawn),
195
+ t_handoff_start: predecessorEnd,
196
+ t_handoff_end: tSpawn,
197
+ gap_ms: gapMs,
198
+ t_spawn: tSpawn,
199
+ t_complete: tComplete,
200
+ };
201
+ if (tComplete !== null) predecessorEnd = tComplete;
202
+ return handoff;
203
+ });
204
+ }
205
+
206
+ function deriveReviewSkippedReason(sortedRows, rootSession) {
207
+ const orderedRows = [
208
+ ...(rootSession ? [rootSession] : []),
209
+ ...sortedRows.filter((row) => row.session_id !== rootSession?.session_id),
210
+ ];
211
+ for (const row of orderedRows) {
212
+ const summary = row.assistant_summary;
213
+ if (typeof summary !== "string") continue;
214
+ const match = summary.match(REVIEW_SKIPPED_REASON_PATTERN);
215
+ if (match && REVIEW_SKIPPED_REASONS.has(match[1])) return match[1];
216
+ }
217
+ return null;
218
+ }
219
+
220
+ function unavailableDiffSize() {
221
+ return {
222
+ available: false,
223
+ files_changed: null,
224
+ insertions: null,
225
+ deletions: null,
226
+ captured_at: "collection",
227
+ };
228
+ }
229
+
230
+ function measureDiffSize(directory) {
231
+ const fallback = unavailableDiffSize();
232
+ if (typeof directory !== "string" || directory.length === 0) return fallback;
233
+ let stat;
234
+ try {
235
+ stat = fs.statSync(directory);
236
+ } catch {
237
+ return fallback;
238
+ }
239
+ if (!stat.isDirectory()) return fallback;
240
+ try {
241
+ const probe = spawnSync(
242
+ "git",
243
+ ["-C", directory, "rev-parse", "--is-inside-work-tree"],
244
+ { encoding: "utf8", timeout: 10_000 },
245
+ );
246
+ if (probe.status !== 0 || probe.stdout.trim() !== "true") return fallback;
247
+ const numstat = spawnSync(
248
+ "git",
249
+ ["-C", directory, "diff", "--numstat"],
250
+ { encoding: "utf8", timeout: 15_000, maxBuffer: 32 * 1024 * 1024 },
251
+ );
252
+ if (numstat.status !== 0) return fallback;
253
+ let filesChanged = 0;
254
+ let insertions = 0;
255
+ let deletions = 0;
256
+ for (const line of numstat.stdout.split("\n")) {
257
+ if (!line.trim()) continue;
258
+ const [added, removed] = line.split("\t");
259
+ filesChanged += 1;
260
+ if (/^\d+$/.test(added)) insertions += Number(added);
261
+ if (/^\d+$/.test(removed)) deletions += Number(removed);
262
+ }
263
+ // Untracked files are part of the visible work-tree delta even though
264
+ // `git diff --numstat` omits them; count them so small-gate metrics see
265
+ // brand-new files too.
266
+ const untracked = spawnSync(
267
+ "git",
268
+ ["-C", directory, "ls-files", "--others", "--exclude-standard"],
269
+ { encoding: "utf8", timeout: 15_000 },
270
+ );
271
+ if (untracked.status === 0) {
272
+ filesChanged += untracked.stdout.split("\n").filter((entry) => entry.trim()).length;
273
+ }
274
+ return { ...fallback, available: true, files_changed: filesChanged, insertions, deletions };
275
+ } catch {
276
+ return fallback;
277
+ }
278
+ }
279
+
280
+
133
281
  function loadPreviousCursor(iteration, outputDir) {
134
282
  if (!iteration) return null;
135
283
  const runsDir = path.dirname(path.dirname(outputDir));
@@ -217,6 +365,8 @@ async function summarizeSqlite(dbPath, previousCursor, fullRescan) {
217
365
  partsByMessage.set(part.message_id, list);
218
366
  }
219
367
 
368
+ const userTurnTimesBySession = new Map();
369
+
220
370
  const normalized = [];
221
371
  let skipped = 0;
222
372
  const skipReasons = {};
@@ -245,6 +395,13 @@ async function summarizeSqlite(dbPath, previousCursor, fullRescan) {
245
395
  if (role === "assistant") assistantMessages.push(message);
246
396
  }
247
397
 
398
+ userTurnTimesBySession.set(
399
+ session.id,
400
+ userMessages
401
+ .map((message) => message.time_created)
402
+ .filter((time) => typeof time === "number"),
403
+ );
404
+
248
405
  const firstUser = userMessages[0];
249
406
  const lastAssistant = assistantMessages.at(-1);
250
407
  const userPrompt = firstUser ? firstTextPart(partsByMessage.get(firstUser.id) || []) : null;
@@ -302,6 +459,7 @@ async function summarizeSqlite(dbPath, previousCursor, fullRescan) {
302
459
  skip_reasons: skipReasons,
303
460
  },
304
461
  normalized,
462
+ userTurnTimesBySession,
305
463
  };
306
464
  }
307
465
 
@@ -411,7 +569,7 @@ function treeRepresentativeSummary(sessions) {
411
569
  .at(-1).assistant_summary;
412
570
  }
413
571
 
414
- function buildExecutionTrees(sqliteRows, rawRows, previousCursor, fullRescan) {
572
+ function buildExecutionTrees(sqliteRows, rawRows, previousCursor, fullRescan, userTurnTimesBySession = null) {
415
573
  const sqliteMap = new Map(sqliteRows.map((row) => [row.session_id, row]));
416
574
  const rawBySessionId = new Map(rawRows.map((row) => [row.session_id, row]));
417
575
  const grouped = new Map();
@@ -474,6 +632,18 @@ function buildExecutionTrees(sqliteRows, rawRows, previousCursor, fullRescan) {
474
632
  source_formats: [...new Set(["opencode-sqlite", ...matchedRawIds.map(() => "opencode-raw-json")])],
475
633
  };
476
634
 
635
+ const requestTurns = buildRequestTurns(
636
+ userTurnTimesBySession?.get(rootSession.session_id),
637
+ rootSession.session_id,
638
+ );
639
+ tree.telemetry = {
640
+ method_version: 1,
641
+ request_turns: requestTurns,
642
+ handoffs: buildHandoffs(childSessions, rootSession, requestTurns),
643
+ review_skipped_reason: deriveReviewSkippedReason(sortedRows, rootSession),
644
+ diff_size: unavailableDiffSize(),
645
+ };
646
+
477
647
  if (
478
648
  !fullRescan &&
479
649
  previousCursor &&
@@ -527,8 +697,12 @@ export async function collectExecutionTreeByRoot(dbPath, rootSessionId) {
527
697
  const result = await summarizeSqlite(dbPath, null, true);
528
698
  const rootSession = result.normalized.find((row) => row.session_id === rootSessionId);
529
699
  if (!rootSession || rootSession.parent_session_id !== null) return null;
530
- const built = buildExecutionTrees(result.normalized, [], null, true);
531
- return built.trees.find((tree) => tree.root_session_id === rootSessionId) || null;
700
+ const built = buildExecutionTrees(result.normalized, [], null, true, result.userTurnTimesBySession);
701
+ const tree = built.trees.find((candidate) => candidate.root_session_id === rootSessionId) || null;
702
+ if (tree?.telemetry) {
703
+ tree.telemetry.diff_size = measureDiffSize(tree.root_directory);
704
+ }
705
+ return tree;
532
706
  }
533
707
 
534
708
  function makeCursor(previousCursor, treeSummary, trees, supplementalRawSummary, fullRescan) {
@@ -576,25 +750,39 @@ export async function main(argv = process.argv.slice(2)) {
576
750
  const summaries = [];
577
751
  let sqliteRows = [];
578
752
  let rawRows = [];
753
+ let userTurnTimesBySession = null;
579
754
 
580
755
  const previousCursor = args.fullRescan ? null : loadPreviousCursor(args.iteration, outputDir);
581
756
 
582
757
  for (const sourcePath of sourcePaths) {
583
758
  if (!fs.existsSync(sourcePath)) continue;
584
759
  const kind = detectSource(sourcePath);
585
- const result =
586
- kind === "opencode-sqlite"
587
- ? await summarizeSqlite(sourcePath, previousCursor, args.fullRescan)
588
- : summarizeRawDir(sourcePath);
760
+ let result;
761
+ if (kind === "opencode-sqlite") {
762
+ result = await summarizeSqlite(sourcePath, previousCursor, args.fullRescan);
763
+ } else {
764
+ result = { source: null, normalized: [] };
765
+ const rawResult = summarizeRawDir(sourcePath);
766
+ result.source = rawResult.source;
767
+ result.normalized = rawResult.normalized;
768
+ result.userTurnTimesBySession = new Map();
769
+ }
589
770
  summaries.push(result.source);
590
771
  if (kind === "opencode-sqlite") {
591
772
  sqliteRows = sqliteRows.concat(result.normalized);
773
+ userTurnTimesBySession = new Map([
774
+ ...(userTurnTimesBySession || []),
775
+ ...result.userTurnTimesBySession,
776
+ ]);
592
777
  } else {
593
778
  rawRows = rawRows.concat(result.normalized);
594
779
  }
595
780
  }
596
781
 
597
- const built = buildExecutionTrees(sqliteRows, rawRows, previousCursor, args.fullRescan);
782
+ const built = buildExecutionTrees(sqliteRows, rawRows, previousCursor, args.fullRescan, userTurnTimesBySession);
783
+ for (const tree of built.trees) {
784
+ tree.telemetry.diff_size = measureDiffSize(tree.root_directory);
785
+ }
598
786
  const acceptedSessionIds = new Set(built.trees.flatMap((tree) => tree.session_ids));
599
787
  const filteredSessionRows = sortSessions(sqliteRows.filter((row) => acceptedSessionIds.has(row.session_id)));
600
788
  const cursor = makeCursor(previousCursor, built.treeSummary, built.trees, built.supplementalRawSummary, args.fullRescan);
@@ -577,3 +577,154 @@ test("streamSqliteJson rejects on sqlite3 runtime error (non-zero exit)", async
577
577
  assert.notEqual(result.status, 0);
578
578
  assert.match(result.stderr, /sqlite3 runtime error|session/);
579
579
  });
580
+
581
+ test("execution trees expose phase-0 telemetry with paired handoff timestamps and turn correlation", async () => {
582
+ const tmp = makeTempDir();
583
+ try {
584
+ const dbPath = path.join(tmp, "opencode.db");
585
+ createFixtureDb(dbPath);
586
+
587
+ const tree = await collectExecutionTreeByRoot(dbPath, "ses_root_1");
588
+
589
+ const telemetry = tree.telemetry;
590
+ assert.ok(telemetry, "tree must carry phase-0 telemetry");
591
+ assert.equal(telemetry.method_version, 1);
592
+ assert.deepEqual(telemetry.request_turns, [
593
+ { turn_id: "ses_root_1:t1", t_start: 1000 },
594
+ ]);
595
+
596
+ assert.equal(telemetry.handoffs.length, 2);
597
+ const [handoffOne, handoffTwo] = telemetry.handoffs;
598
+ assert.deepEqual(handoffOne, {
599
+ sequence: 1,
600
+ agent: "researcher",
601
+ session_id: "ses_child_1",
602
+ request_turn_id: "ses_root_1:t1",
603
+ t_handoff_start: 1000,
604
+ t_handoff_end: 1100,
605
+ gap_ms: 100,
606
+ t_spawn: 1100,
607
+ t_complete: 2100,
608
+ });
609
+ // paired spawn -> completion of predecessor; overlap shows up as negative gap
610
+ assert.deepEqual(handoffTwo, {
611
+ sequence: 2,
612
+ agent: "reviewer",
613
+ session_id: "ses_grandchild_1",
614
+ request_turn_id: "ses_root_1:t1",
615
+ t_handoff_start: 2100,
616
+ t_handoff_end: 1150,
617
+ gap_ms: -950,
618
+ t_spawn: 1150,
619
+ t_complete: 2200,
620
+ });
621
+
622
+ assert.deepEqual(telemetry.diff_size, {
623
+ available: false,
624
+ files_changed: null,
625
+ insertions: null,
626
+ deletions: null,
627
+ captured_at: "collection",
628
+ });
629
+ assert.equal(telemetry.review_skipped_reason, null);
630
+ } finally {
631
+ fs.rmSync(tmp, { recursive: true, force: true });
632
+ }
633
+ });
634
+
635
+ test("phase-0 telemetry maps spawns to the latest root user turn", async () => {
636
+ const tmp = makeTempDir();
637
+ try {
638
+ const dbPath = path.join(tmp, "opencode.db");
639
+ createFixtureDb(dbPath);
640
+ run("sqlite3", [
641
+ dbPath,
642
+ `
643
+ insert into message (id, session_id, time_created, time_updated, data) values
644
+ ('msg_user_root_1b', 'ses_root_1', 1500, 1500, '{"role":"user","time":{"created":1500}}'),
645
+ ('msg_user_child_2', 'ses_child_1', 1600, 1600, '{"role":"user","time":{"created":1600}}');
646
+ insert into part (id, message_id, session_id, time_created, time_updated, data) values
647
+ ('prt_user_root_1b', 'msg_user_root_1b', 'ses_root_1', 1500, 1500, '{"type":"text","text":"Follow-up request on the harness issue."}'),
648
+ ('prt_user_child_2', 'msg_user_child_2', 'ses_child_1', 1600, 1600, '{"type":"text","text":"Second research pass."}');
649
+ insert into session (
650
+ id, project_id, parent_id, slug, directory, title, version, time_created, time_updated, path, agent, model, cost, tokens_input, tokens_output, tokens_reasoning, tokens_cache_read, tokens_cache_write
651
+ ) values (
652
+ 'ses_child_2', 'proj_1', 'ses_root_1', 'bold-otter', '/tmp/repo', 'Research follow-up (@researcher subagent)', '1.15.12', 1700, 1900, '', 'researcher',
653
+ '{"id":"synthetic-model","providerID":"synthetic-provider","variant":"synthetic-variant"}', 0.1, 10, 5, 0, 0, 0
654
+ );
655
+ `,
656
+ ]);
657
+
658
+ const tree = await collectExecutionTreeByRoot(dbPath, "ses_root_1");
659
+
660
+ assert.deepEqual(tree.telemetry.request_turns, [
661
+ { turn_id: "ses_root_1:t1", t_start: 1000 },
662
+ { turn_id: "ses_root_1:t2", t_start: 1500 },
663
+ ]);
664
+ const bySession = new Map(
665
+ tree.telemetry.handoffs.map((handoff) => [handoff.session_id, handoff]),
666
+ );
667
+ assert.equal(bySession.get("ses_child_1").request_turn_id, "ses_root_1:t1");
668
+ assert.equal(bySession.get("ses_grandchild_1").request_turn_id, "ses_root_1:t1");
669
+ assert.equal(bySession.get("ses_child_2").request_turn_id, "ses_root_1:t2");
670
+ } finally {
671
+ fs.rmSync(tmp, { recursive: true, force: true });
672
+ }
673
+ });
674
+
675
+ test("phase-0 telemetry captures enum-valid review_skipped_reason and rejects unknown tokens", async () => {
676
+ const tmp = makeTempDir();
677
+ try {
678
+ const dbPath = path.join(tmp, "opencode.db");
679
+ createFixtureDb(dbPath);
680
+ run("sqlite3", [
681
+ dbPath,
682
+ `update part set data = json_object('type','text','text','Closed with review skipped. review_skipped_reason: small_gate_pass')
683
+ where id = 'prt_assistant_root_1';`,
684
+ ]);
685
+
686
+ const tree = await collectExecutionTreeByRoot(dbPath, "ses_root_1");
687
+ assert.equal(tree.telemetry.review_skipped_reason, "small_gate_pass");
688
+
689
+ run("sqlite3", [
690
+ dbPath,
691
+ `update part set data = json_object('type','text','text','review_skipped_reason: because_i_said_so')
692
+ where id = 'prt_assistant_root_1';`,
693
+ ]);
694
+ const rejectTree = await collectExecutionTreeByRoot(dbPath, "ses_root_1");
695
+ assert.equal(rejectTree.telemetry.review_skipped_reason, null);
696
+ } finally {
697
+ fs.rmSync(tmp, { recursive: true, force: true });
698
+ }
699
+ });
700
+
701
+ test("phase-0 telemetry measures diff size for a real local git repo", async () => {
702
+ const tmp = makeTempDir();
703
+ try {
704
+ const repoDir = path.join(tmp, "repo");
705
+ fs.mkdirSync(repoDir, { recursive: true });
706
+ run("git", ["init", "-q", repoDir]);
707
+ run("git", ["-C", repoDir, "config", "user.email", "test@example.invalid"]);
708
+ run("git", ["-C", repoDir, "config", "user.name", "Test"]);
709
+ fs.writeFileSync(path.join(repoDir, "a.txt"), "one\n");
710
+ run("git", ["-C", repoDir, "add", "."]);
711
+ run("git", ["-C", repoDir, "commit", "-qm", "base"]);
712
+ fs.writeFileSync(path.join(repoDir, "a.txt"), "one\ntwo\nthree\n");
713
+ fs.writeFileSync(path.join(repoDir, "b.txt"), "new\n");
714
+
715
+ const dbPath = path.join(tmp, "opencode.db");
716
+ createFixtureDb(dbPath);
717
+ run("sqlite3", [dbPath, `update session set directory = '${repoDir}' where id in ('ses_root_1','ses_child_1','ses_grandchild_1');`]);
718
+
719
+ const tree = await collectExecutionTreeByRoot(dbPath, "ses_root_1");
720
+ assert.deepEqual(tree.telemetry.diff_size, {
721
+ available: true,
722
+ files_changed: 2,
723
+ insertions: 2,
724
+ deletions: 0,
725
+ captured_at: "collection",
726
+ });
727
+ } finally {
728
+ fs.rmSync(tmp, { recursive: true, force: true });
729
+ }
730
+ });
@@ -6,6 +6,7 @@ import path from "node:path";
6
6
  import { spawnSync } from "node:child_process";
7
7
  import test from "node:test";
8
8
  import { fileURLToPath } from "node:url";
9
+ import { evaluateReplay } from "./replay-routing.mjs";
9
10
 
10
11
  const scriptDir = path.dirname(fileURLToPath(import.meta.url));
11
12
  const root = path.dirname(scriptDir);
@@ -18,6 +19,14 @@ const fixturesPath = path.join(
18
19
  root,
19
20
  "docs/ai/evolution/benchmarks/replay-fixtures.jsonl",
20
21
  );
22
+ const redCorpusPath = path.join(
23
+ root,
24
+ "docs/ai/evolution/benchmarks/router-scenarios-red.jsonl",
25
+ );
26
+ const redFixturesPath = path.join(
27
+ root,
28
+ "docs/ai/evolution/benchmarks/replay-fixtures-red.jsonl",
29
+ );
21
30
  const coverageChannels = [
22
31
  "session_events",
23
32
  "skill_events",
@@ -1452,3 +1461,52 @@ test("missing stop evidence is inconclusive", () => {
1452
1461
  });
1453
1462
  });
1454
1463
  });
1464
+
1465
+ test("phase-0 red fixtures fail deterministically with the natural routing symptoms", () => {
1466
+ const scenarios = readJsonl(redCorpusPath);
1467
+ const fixtures = readJsonl(redFixturesPath);
1468
+ assert.deepEqual(
1469
+ fixtures.map((fixture) => fixture.scenario_id).sort(),
1470
+ scenarios.map((scenario) => scenario.id).sort(),
1471
+ );
1472
+
1473
+ const report = evaluateReplay({
1474
+ scenarios,
1475
+ observations: fixtures,
1476
+ mode: "deterministic",
1477
+ });
1478
+ // Intentional red-pending regression net: these fail until the small-gate
1479
+ // fast path changes real routing; the classic corpus stays all-green.
1480
+ assert.equal(report.operational_status, "ok");
1481
+ assert.equal(report.status, "fail");
1482
+
1483
+ const byId = new Map(
1484
+ report.scenario_results.map((result) => [result.scenario_id, result]),
1485
+ );
1486
+ const copyTrivial = byId.get("freeform-tiny-copy-trivial");
1487
+ assert.ok(copyTrivial, "missing copy-trivial red scenario");
1488
+ assert.equal(copyTrivial.status, "fail");
1489
+ const copyFails = new Map(
1490
+ copyTrivial.assertions
1491
+ .filter((assertion) => assertion.status === "fail")
1492
+ .map((assertion) => [assertion.id, assertion]),
1493
+ );
1494
+ assert.equal(copyFails.get("forbidden-agents")?.reason_code, "forbidden-agent-observed");
1495
+ assert.deepEqual(copyFails.get("forbidden-agents")?.evidence_sequences, [5]);
1496
+ assert.equal(copyFails.get("review-policy")?.reason_code, "reviewer-forbidden");
1497
+ assert.deepEqual(copyFails.get("delegation-budget")?.reason_code, "delegation-budget-exceeded");
1498
+
1499
+ const seedPipeline = byId.get("freeform-tiny-toy-single-file-full-pipeline");
1500
+ assert.ok(seedPipeline, "missing toy single-file full-pipeline red scenario");
1501
+ assert.equal(seedPipeline.status, "fail");
1502
+ const seedForbidden = seedPipeline.assertions.find(
1503
+ (assertion) => assertion.id === "forbidden-agents",
1504
+ );
1505
+ assert.equal(seedForbidden?.status, "fail");
1506
+ assert.deepEqual(seedForbidden?.evidence_sequences, [2, 4, 9]);
1507
+ const seedReviewPolicy = seedPipeline.assertions.find(
1508
+ (assertion) => assertion.id === "review-policy",
1509
+ );
1510
+ assert.equal(seedReviewPolicy?.status, "fail");
1511
+ assert.equal(seedReviewPolicy?.reason_code, "reviewer-forbidden");
1512
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-agent-orchestration-kit",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "private": false,
5
5
  "description": "Open-source multi-agent orchestration harness for OpenCode with specialized agents, durable workflows, review gates, and reproducible software-engineering processes.",
6
6
  "keywords": [
@@ -143,7 +143,7 @@ async function benchmarkFixture(fixture, iterations, temporaryRoot) {
143
143
  const result = await createInstallationManager({
144
144
  sourceRoot: fixture.sourceRoot,
145
145
  repositoryRoot: fixture.root,
146
- versionProvider: () => "1.0.42",
146
+ versionProvider: () => "1.0.43",
147
147
  }).run("install", { targetRoot });
148
148
  if (result.exitCode !== 0) throw invalid(`installation benchmark failed for ${fixture.id}`);
149
149
  } finally {
@@ -21,6 +21,7 @@ const REQUIRED_FILES = [
21
21
  // from fragments so this scanner does not trip over its own rules.
22
22
  const PRIVATE_MARKERS = [
23
23
  ["/", "Users", "/"].join(""),
24
+ ["juancan", "as"].join(""),
24
25
  ["synology", ".", "me"].join(""),
25
26
  ["auth", ".", "json"].join(""),
26
27
  ["OPENAI", "_", "API", "_", "KEY"].join(""),
@@ -17,7 +17,7 @@ import {
17
17
 
18
18
  const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
19
19
  const HASH = "a".repeat(64);
20
- const BASENAME = "opencode-agent-orchestration-kit-1.0.42.tgz";
20
+ const BASENAME = "opencode-agent-orchestration-kit-1.0.43.tgz";
21
21
  const REQUIRED = [
22
22
  "package/package.json",
23
23
  "package/supply-chain.json",
@@ -210,7 +210,7 @@ test("smokeTarball validates both archive listings before extraction", async ()
210
210
  await assert.rejects(
211
211
  smokeTarball({
212
212
  repositoryRoot: ROOT,
213
- tarball: "/public/opencode-agent-orchestration-kit-1.0.42.tgz",
213
+ tarball: "/public/opencode-agent-orchestration-kit-1.0.43.tgz",
214
214
  captureTarball(_source, destination) {
215
215
  fs.writeFileSync(destination, "fixture");
216
216
  return { size: 1 };
@@ -109,7 +109,7 @@ test("[V004] direct version entrypoints are exact and mutation-free", (t) => {
109
109
  for (const args of [["scripts/version.mjs"], ["scripts/manage-installation.mjs", "--version"]]) {
110
110
  const result = run(process.execPath, args, { HOME: home });
111
111
  assert.equal(result.status, 0, result.stderr);
112
- assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.42\n");
112
+ assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.43\n");
113
113
  assert.equal(fs.existsSync(target), false);
114
114
  }
115
115
  });
@@ -118,7 +118,7 @@ test("[V005] all lifecycle wrappers expose the canonical version", () => {
118
118
  for (const wrapper of ["install.sh", "upgrade.sh", "doctor.sh", "uninstall.sh", "rollback.sh"]) {
119
119
  const result = run(path.join(REPOSITORY_ROOT, wrapper), ["--version"]);
120
120
  assert.equal(result.status, 0, `${wrapper}: ${result.stderr}`);
121
- assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.42\n", wrapper);
121
+ assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.43\n", wrapper);
122
122
  }
123
123
  });
124
124
 
package/docs/synology.md DELETED
@@ -1,30 +0,0 @@
1
- # Synology Deployment
2
-
3
- Use Container Manager or Docker Compose.
4
-
5
- Recommended setup:
6
-
7
- 1. Build the image from `docker/open-design`.
8
- 2. Keep volumes for `data` and `opencode-auth` outside git.
9
- 3. Map port `7456` only on trusted LAN unless protected.
10
- 4. Configure Synology reverse proxy with HTTPS if exposing beyond localhost.
11
- 5. Protect public access with VPN, Tailscale, WireGuard, or authentication.
12
-
13
- The Dockerfile pins Open Design and OpenCode CLI build inputs. To update them,
14
- build with explicit args instead of editing to a floating branch or `latest`:
15
-
16
- ```bash
17
- docker compose build \
18
- --build-arg OPEN_DESIGN_REF=<commit-sha> \
19
- --build-arg OPENCODE_AI_VERSION=<version>
20
- docker compose up -d
21
- ```
22
-
23
- Useful operations:
24
-
25
- ```bash
26
- docker compose logs -f
27
- docker compose restart
28
- docker compose pull
29
- docker compose up -d --build
30
- ```