opencode-agent-orchestration-kit 1.0.39 → 1.0.41
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 +12 -3
- package/docker/open-design/data/app.sqlite +0 -0
- package/docker/open-design/data/app.sqlite-shm +0 -0
- package/docker/open-design/data/app.sqlite-wal +0 -0
- package/docker/open-design/opencode-auth/log/2026-05-02T105802.log +17 -0
- package/docker/open-design/opencode-auth/log/2026-05-04T102127.log +16 -0
- package/docker/open-design/opencode-auth/opencode.db +0 -0
- package/docker/open-design/opencode-auth/opencode.db-shm +0 -0
- package/docker/open-design/opencode-auth/opencode.db-wal +0 -0
- package/docs/models.md +1 -1
- package/docs/performance/native-tools-benchmark.md +33 -0
- package/docs/releases/v1.0.40.md +55 -0
- package/docs/releases/v1.0.41.md +42 -0
- package/docs/sync-boundary.md +27 -0
- package/opencode/commands/loop-status.md +24 -0
- package/opencode/commands/loop.md +8 -0
- package/opencode/docs/ai/harness/agents.md +8 -0
- package/opencode/docs/ai/harness/checks.md +6 -0
- package/opencode/docs/ai/harness/commands.md +10 -0
- package/opencode/docs/ai/harness/orchestration-contracts.json +9 -1
- package/opencode/docs/ai/specs/mission-runtime.md +44 -0
- package/opencode/plugins/mission-runtime.test.mjs +46 -0
- package/opencode/plugins/mission-runtime.ts +41 -0
- package/opencode/scripts/check-harness.mjs +111 -0
- package/opencode/scripts/check-harness.test.mjs +37 -1
- package/opencode/scripts/loop-state.mjs +5 -0
- package/opencode/scripts/loop-state.test.mjs +13 -0
- package/opencode/scripts/mission-runtime-observer.d.mts +25 -0
- package/opencode/scripts/mission-runtime-observer.mjs +124 -0
- package/opencode/scripts/mission-runtime.test.mjs +97 -0
- package/opencode/scripts/mission-status.mjs +136 -0
- package/opencode/scripts/mission-status.test.mjs +196 -0
- package/opencode/scripts/project-capability-snapshot.mjs +2 -1
- package/opencode/scripts/project-capability-snapshot.test.mjs +17 -0
- package/opencode/scripts/runtime-permission-policy.mjs +72 -0
- package/opencode/scripts/runtime-permission-policy.test.mjs +89 -0
- package/opencode/tools/open_design.ts +1 -1
- package/package.json +3 -3
- package/scripts/benchmark-tool-paths.mjs +226 -0
- package/scripts/benchmark-tool-paths.test.mjs +29 -0
- package/scripts/check-public-boundary.mjs +89 -0
- package/scripts/check-public-boundary.test.mjs +32 -0
- package/scripts/check.sh +15 -10
- package/scripts/install-smoke.sh +17 -0
- package/scripts/manage-installation.mjs +90 -7
- package/scripts/manage-installation.test.mjs +36 -0
- package/scripts/oc-switch.mjs +2 -1
- package/scripts/oc-switch.test.mjs +38 -0
- package/scripts/package-smoke.mjs +52 -3
- package/scripts/package-smoke.test.mjs +6 -6
- package/scripts/version.test.mjs +2 -2
package/README.md
CHANGED
|
@@ -327,7 +327,7 @@ After a tagged release is published, you can install the same CLI directly
|
|
|
327
327
|
from GitHub without keeping a checkout:
|
|
328
328
|
|
|
329
329
|
```bash
|
|
330
|
-
npm install --global "git+https://github.com/jcarlosrodicio/opencode-agent-orchestration-kit.git#v1.0.
|
|
330
|
+
npm install --global "git+https://github.com/jcarlosrodicio/opencode-agent-orchestration-kit.git#v1.0.41"
|
|
331
331
|
oc-switch
|
|
332
332
|
```
|
|
333
333
|
|
|
@@ -407,6 +407,12 @@ An explicit `--target` wins over a non-empty `OPENCODE_CONFIG_DIR`, which wins o
|
|
|
407
407
|
|
|
408
408
|
The installer inventories the payload, computes a complete plan, and tracks ownership in `TARGET/.oak/manifest.json`. A dry run performs no writes. A real operation recomputes the plan under an exclusive lock and commits through a durable journal with one rollback generation.
|
|
409
409
|
|
|
410
|
+
Release packages also record a safe `release_provenance` block in that manifest:
|
|
411
|
+
the source projection commit, public commit, canonical kit version, packaged
|
|
412
|
+
payload digest, and a passed-checks marker. Existing manifests without that
|
|
413
|
+
optional block remain readable; the release package smoke requires it for new
|
|
414
|
+
release evidence and never stores paths, provider settings, or credentials.
|
|
415
|
+
|
|
410
416
|
The root `package.json` is the canonical kit-version source. Display the same
|
|
411
417
|
identity through the manager or any lifecycle wrapper:
|
|
412
418
|
|
|
@@ -724,7 +730,10 @@ This runs the fast contract checker and every bundled `node:test` suite. For a
|
|
|
724
730
|
fast structural check while editing documentation or contracts, use
|
|
725
731
|
`npm run check:quick`. Before a release, use `npm run check:release`; it performs
|
|
726
732
|
a frozen dependency install and also runs typechecking, dependency integrity,
|
|
727
|
-
audit/signature checks, installation smoke, and the exact package smoke.
|
|
733
|
+
audit/signature checks, installation smoke, and the exact package smoke. The
|
|
734
|
+
package smoke extracts the tarball, recomputes the packaged OpenCode payload
|
|
735
|
+
digest, uses an isolated `OPENCODE_CONFIG_DIR`, preserves a user configuration,
|
|
736
|
+
and exercises `doctor` plus rollback before reporting release provenance.
|
|
728
737
|
Publication remains separately authorized; follow the reviewed artifact and
|
|
729
738
|
checksum procedure in [the supply-chain policy](docs/supply-chain.md).
|
|
730
739
|
|
|
@@ -732,7 +741,7 @@ Validate only the canonical identity and current release note with:
|
|
|
732
741
|
|
|
733
742
|
```bash
|
|
734
743
|
npm run check:version
|
|
735
|
-
node scripts/version.mjs --check-tag v1.0.
|
|
744
|
+
node scripts/version.mjs --check-tag v1.0.41
|
|
736
745
|
```
|
|
737
746
|
|
|
738
747
|
Tag validation compares an explicitly supplied tag with the package identity.
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
INFO 2026-05-02T10:58:02 +270ms service=default version=1.14.31 args=["models"] process_role=main run_id=a2a78294-b4d4-488d-99c7-9b9e1f6ba68f opencode
|
|
2
|
+
INFO 2026-05-02T10:58:02 +0ms service=db path=/home/opencode/.local/share/opencode/opencode.db opening database
|
|
3
|
+
INFO 2026-05-02T10:58:02 +5ms service=db count=14 mode=bundled applying migrations
|
|
4
|
+
INFO 2026-05-02T10:58:02 +11ms service=json-migration storage directory does not exist, skipping migration
|
|
5
|
+
INFO 2026-05-02T10:58:02 +1ms service=default directory=/app/open-design creating instance
|
|
6
|
+
INFO 2026-05-02T10:58:02 +3ms service=project directory=/app/open-design fromDirectory
|
|
7
|
+
INFO 2026-05-02T10:58:02 +56ms service=file init
|
|
8
|
+
INFO 2026-05-02T10:58:02 +41ms service=provider status=started state
|
|
9
|
+
INFO 2026-05-02T10:58:02 +8ms service=config path=/home/opencode/.config/opencode/config.json loading
|
|
10
|
+
INFO 2026-05-02T10:58:02 +1ms service=config path=/home/opencode/.config/opencode/opencode.json loading
|
|
11
|
+
INFO 2026-05-02T10:58:02 +5ms service=config path=/home/opencode/.config/opencode/opencode.jsonc loading
|
|
12
|
+
INFO 2026-05-02T10:58:02 +3ms service=config path=/home/opencode/.config/opencode/opencode.json loading
|
|
13
|
+
INFO 2026-05-02T10:58:02 +1ms service=config path=/home/opencode/.config/opencode/opencode.jsonc loading
|
|
14
|
+
ERROR 2026-05-02T10:58:02 +13ms service=default name=PlatformError message=Unknown: FileSystem.writeFile (/home/opencode/.config/opencode/.gitignore) cause=Error: EROFS: read-only file system, open '/home/opencode/.config/opencode/.gitignore' stack=Error
|
|
15
|
+
at LA (/$bunfs/root/chunk-2jj9v4nh.js:71:4213)
|
|
16
|
+
at <anonymous> (/$bunfs/root/chunk-jtzgjw2e.js:709:10709)
|
|
17
|
+
at processTicksAndRejections (native:7:39) fatal
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
INFO 2026-05-04T10:21:27 +675ms service=default version=1.14.31 args=["models"] process_role=main run_id=094c93b3-d70c-4527-8e21-87d24f443d76 opencode
|
|
2
|
+
INFO 2026-05-04T10:21:27 +2ms service=default directory=/app/open-design creating instance
|
|
3
|
+
INFO 2026-05-04T10:21:27 +13ms service=project directory=/app/open-design fromDirectory
|
|
4
|
+
INFO 2026-05-04T10:21:28 +980ms service=db path=/home/opencode/.local/share/opencode/opencode.db opening database
|
|
5
|
+
INFO 2026-05-04T10:21:28 +209ms service=db count=14 mode=bundled applying migrations
|
|
6
|
+
INFO 2026-05-04T10:21:28 +124ms service=file init
|
|
7
|
+
INFO 2026-05-04T10:21:29 +393ms service=provider status=started state
|
|
8
|
+
INFO 2026-05-04T10:21:29 +24ms service=config path=/home/opencode/.config/opencode/config.json loading
|
|
9
|
+
INFO 2026-05-04T10:21:29 +20ms service=config path=/home/opencode/.config/opencode/opencode.json loading
|
|
10
|
+
INFO 2026-05-04T10:21:29 +42ms service=config path=/home/opencode/.config/opencode/opencode.jsonc loading
|
|
11
|
+
INFO 2026-05-04T10:21:29 +204ms service=config path=/home/opencode/.config/opencode/opencode.json loading
|
|
12
|
+
INFO 2026-05-04T10:21:29 +46ms service=config path=/home/opencode/.config/opencode/opencode.jsonc loading
|
|
13
|
+
ERROR 2026-05-04T10:21:29 +119ms service=default name=PlatformError message=Unknown: FileSystem.writeFile (/home/opencode/.config/opencode/.gitignore) cause=Error: EROFS: read-only file system, open '/home/opencode/.config/opencode/.gitignore' stack=Error
|
|
14
|
+
at LA (/$bunfs/root/chunk-2jj9v4nh.js:71:4213)
|
|
15
|
+
at <anonymous> (/$bunfs/root/chunk-jtzgjw2e.js:709:10709)
|
|
16
|
+
at processTicksAndRejections (native:7:39) fatal
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
package/docs/models.md
CHANGED
|
@@ -26,7 +26,7 @@ oc-switch
|
|
|
26
26
|
Once a release tag exists, a checkout is optional:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npm install --global "git+https://github.com/jcarlosrodicio/opencode-agent-orchestration-kit.git#v1.0.
|
|
29
|
+
npm install --global "git+https://github.com/jcarlosrodicio/opencode-agent-orchestration-kit.git#v1.0.41"
|
|
30
30
|
oc-switch
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Native tool-path benchmark
|
|
2
|
+
|
|
3
|
+
This benchmark measures the current dependency-free Node path before deciding
|
|
4
|
+
whether a native Rust helper is justified. It is evidence collection, not a
|
|
5
|
+
Rust implementation or a release blocker.
|
|
6
|
+
|
|
7
|
+
Run it with at least two iterations per operation:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
node scripts/benchmark-tool-paths.mjs --iterations 5 > /tmp/oak-native-benchmark.json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
It exercises two synthetic fixtures and, by default, this repository. Each
|
|
14
|
+
fixture measures file listing, text search, Node parse checking, capability
|
|
15
|
+
snapshot generation, and installation through the same manager used by the
|
|
16
|
+
package. The report contains p50/p95 elapsed time, p50 CPU, and p95 RSS for
|
|
17
|
+
each path. RSS is the benchmark runner's process value; child-command memory is
|
|
18
|
+
not isolated, so the result must not be presented as a process-level peak for
|
|
19
|
+
`node --check`.
|
|
20
|
+
|
|
21
|
+
## Adoption threshold
|
|
22
|
+
|
|
23
|
+
Keep the Node implementation unless a Rust replacement demonstrates, on both
|
|
24
|
+
fixtures and two consecutive runs:
|
|
25
|
+
|
|
26
|
+
- at least 2x lower p95 latency for one material hot path;
|
|
27
|
+
- no regression above 10% in p95 RSS or installation time;
|
|
28
|
+
- equivalent portable behavior and failure semantics;
|
|
29
|
+
- a reviewable multi-platform distribution and checksum plan.
|
|
30
|
+
|
|
31
|
+
The current repository has no Rust candidate or cross-platform artifact to
|
|
32
|
+
compare. Until that evidence exists, adding Rust would increase distribution
|
|
33
|
+
and supply-chain surface without a measured product benefit.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# v1.0.40 - Safe lifecycle and canonical release identity
|
|
2
|
+
|
|
3
|
+
This release publishes the reviewed portable mission runtime and strengthens
|
|
4
|
+
the boundary between the public orchestration kit and private harness
|
|
5
|
+
configuration.
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- Add a durable mission-status projection for bounded loop workflows, including
|
|
10
|
+
iteration state, blocking cause, session identity, and the next safe action.
|
|
11
|
+
- Add a read-only mission runtime observer that tracks root sessions, ignores
|
|
12
|
+
child-session noise and duplicate events, and reports optional TUI activity
|
|
13
|
+
without writing durable loop state.
|
|
14
|
+
- Add a closed runtime permission policy and harness checks that keep agent
|
|
15
|
+
identities, tool decisions, delegation, and frontmatter contracts aligned.
|
|
16
|
+
- Add an explicit public synchronization boundary and checks for excluding
|
|
17
|
+
private providers, MCP wiring, credentials, endpoints, paths, and raw runtime
|
|
18
|
+
evidence.
|
|
19
|
+
- Improve package provenance, isolated installation and package smoke coverage,
|
|
20
|
+
rollback verification, and native tool-path performance baselines.
|
|
21
|
+
|
|
22
|
+
## Installation or upgrade
|
|
23
|
+
|
|
24
|
+
Install or upgrade the public kit using the normal manifest-owned flow:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
./install.sh --dry-run
|
|
28
|
+
./install.sh
|
|
29
|
+
./upgrade.sh --dry-run
|
|
30
|
+
./upgrade.sh
|
|
31
|
+
./doctor.sh
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
After installation, run `oak check` and review the installed target before
|
|
35
|
+
using the harness.
|
|
36
|
+
|
|
37
|
+
## Migration
|
|
38
|
+
|
|
39
|
+
No migration is required. Existing installation manifests without the optional
|
|
40
|
+
release provenance block remain readable, and the new mission runtime state is
|
|
41
|
+
created only by an explicit loop workflow.
|
|
42
|
+
|
|
43
|
+
## Validation performed
|
|
44
|
+
|
|
45
|
+
Release readiness passed with the public contract checks, 1,067 unit and
|
|
46
|
+
script tests, typechecking, dependency vulnerability and signature audits,
|
|
47
|
+
installation smoke, package smoke, rollback checks, compatibility checks, and
|
|
48
|
+
the public-boundary leak scan.
|
|
49
|
+
|
|
50
|
+
## Public safety boundary
|
|
51
|
+
|
|
52
|
+
The public release excludes private OpenCode and Pi configuration, local
|
|
53
|
+
providers and MCP wiring, credentials, authentication files, raw transcripts,
|
|
54
|
+
private evidence, absolute machine paths, and runtime state. Pi uses its own
|
|
55
|
+
native model catalog and is not included in this OpenCode package.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# v1.0.41 - Safe lifecycle and canonical release identity
|
|
2
|
+
|
|
3
|
+
This patch release fixes agent-row selection in the interactive OpenCode model
|
|
4
|
+
switcher. Selecting a model for an agent now updates the agent assignment instead
|
|
5
|
+
of rejecting the selection as an invalid target.
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- Fix `oc-switch` agent-row selections by mapping focused agent rows to the
|
|
10
|
+
internal `agents` assignment target.
|
|
11
|
+
- Add a regression test covering a focused agent selecting and saving a model.
|
|
12
|
+
|
|
13
|
+
## Installation or upgrade
|
|
14
|
+
|
|
15
|
+
Install or upgrade the public kit using the normal manifest-owned flow:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
./install.sh --dry-run
|
|
19
|
+
./install.sh
|
|
20
|
+
./upgrade.sh --dry-run
|
|
21
|
+
./upgrade.sh
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
After installation, run `oak check` and review the installed target before
|
|
25
|
+
using the harness.
|
|
26
|
+
|
|
27
|
+
## Migration
|
|
28
|
+
|
|
29
|
+
No migration is required. Existing model-switcher state and shell routing
|
|
30
|
+
remain compatible.
|
|
31
|
+
|
|
32
|
+
## Validation performed
|
|
33
|
+
|
|
34
|
+
The focused selector tests, full 1,068-test unit and script suite, contract
|
|
35
|
+
check, package smoke, syntax checks, and dry-run package inspection passed.
|
|
36
|
+
|
|
37
|
+
## Public safety boundary
|
|
38
|
+
|
|
39
|
+
The public release excludes private OpenCode and Pi configuration, local
|
|
40
|
+
providers and MCP wiring, credentials, authentication files, raw transcripts,
|
|
41
|
+
private evidence, absolute machine paths, and runtime state. Pi uses its own
|
|
42
|
+
native model catalog and is not included in this OpenCode package.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Public synchronization boundary
|
|
2
|
+
|
|
3
|
+
This repository publishes a reviewed public projection of a fuller private
|
|
4
|
+
harness. The public payload contains portable agents, commands, skills,
|
|
5
|
+
contracts, tests, and read-only runtime helpers under `opencode/`, plus the
|
|
6
|
+
installation and release tooling required to distribute them.
|
|
7
|
+
|
|
8
|
+
The projection is deliberately not a private checkout mirror. Provider
|
|
9
|
+
discovery, local model assignment, credentials, authentication files, MCP
|
|
10
|
+
servers, private endpoints, sessions, transcripts, logs, and raw runtime
|
|
11
|
+
evidence stay outside this repository. Public files must use portable relative
|
|
12
|
+
paths and example service URLs only.
|
|
13
|
+
|
|
14
|
+
<!-- projection-source-commit: 1ca607adcbae12cd16de1772662d942852b32502 -->
|
|
15
|
+
|
|
16
|
+
The marker above identifies the reviewed source projection for release
|
|
17
|
+
provenance. It is a commit identity only; it does not disclose the source
|
|
18
|
+
checkout, its providers, or its runtime evidence.
|
|
19
|
+
|
|
20
|
+
The source-side manifest classifies changes as `copy`, `translate`,
|
|
21
|
+
`transform`, `exclude`, or `generated`. The private comparator verifies that
|
|
22
|
+
classification before a change reaches this repository. This repository's
|
|
23
|
+
`check-public-boundary.mjs` then verifies the required projection surfaces and
|
|
24
|
+
reuses the same private-marker scan as `check.sh`.
|
|
25
|
+
|
|
26
|
+
The boundary check is read-only. It does not install dependencies, publish a
|
|
27
|
+
package, create a release, or synchronize a target checkout.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Consulta el estado durable de una misión sin adquirir locks ni escribir archivos."
|
|
3
|
+
agent: lead
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Estado de misión
|
|
7
|
+
|
|
8
|
+
Usa esta consulta para inspeccionar un loop existente sin reanudarlo ni
|
|
9
|
+
modificarlo.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
node scripts/mission-status.mjs --root /ruta/absoluta/al/repo --slug <slug>
|
|
13
|
+
node scripts/mission-status.mjs --root /ruta/absoluta/al/repo --slug <slug> --json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
La salida proyecta el snapshot canónico y el último evento validado:
|
|
17
|
+
`status`, `iteration/planned`, último paso, causa de bloqueo, sesión, timestamp
|
|
18
|
+
y siguiente acción segura. `--root` debe ser una ruta absoluta y `--slug` un
|
|
19
|
+
identificador kebab-case válido.
|
|
20
|
+
|
|
21
|
+
Si falta el estado, el snapshot está desfasado o el historial está corrupto,
|
|
22
|
+
detente y reporta el código durable (`state_missing`, `snapshot_stale` o
|
|
23
|
+
`history_corrupt`). No ejecutes `resume`, `repair` ni `release` como sustituto
|
|
24
|
+
automático.
|
|
@@ -16,6 +16,8 @@ automation.
|
|
|
16
16
|
```text
|
|
17
17
|
approval_gate: explicit_before_writes
|
|
18
18
|
max_iterations_per_invocation: 3
|
|
19
|
+
planned_iteration_budget: task_specific_1_to_6
|
|
20
|
+
hard_safety_ceiling: 6
|
|
19
21
|
completion_authority: reviewer_only
|
|
20
22
|
canonical_review_policy: code-review-and-quality/references/review-policy.md
|
|
21
23
|
final_review_authority: reviewer
|
|
@@ -26,6 +28,12 @@ human_view_path: .opencode/loops/<slug>.md
|
|
|
26
28
|
worktree_mode: explicit_opt_in
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
The three-iteration value limits one invocation. The persisted
|
|
32
|
+
`planned_iteration_budget` (`planned_iterations` in canonical state) is the total budget for the mission and may not
|
|
33
|
+
exceed the hard ceiling of six; `current_iteration` may never exceed that
|
|
34
|
+
budget. Once the total budget is exhausted, the loop must stop as `blocked` or
|
|
35
|
+
`completed` rather than injecting another continuation.
|
|
36
|
+
|
|
29
37
|
The durable `handoff_packet` (`.opencode/handoffs/<slug>.md` with
|
|
30
38
|
`approval_status`) persists human approval to survive session restarts. `/loop`
|
|
31
39
|
keeps `.opencode/loops/<slug>.json` as canonical state,
|
|
@@ -83,6 +83,14 @@ 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
|
+
## Mission runtime projection
|
|
87
|
+
|
|
88
|
+
`mission-status` is a read-only view over the durable loop snapshot and
|
|
89
|
+
append-only history. It validates canonical state before displaying progress
|
|
90
|
+
and never becomes a second authority. The runtime observer is ephemeral; it
|
|
91
|
+
may report activity, but durable transitions still require the loop state
|
|
92
|
+
runtime and its locks.
|
|
93
|
+
|
|
86
94
|
## Bounded local autonomy
|
|
87
95
|
|
|
88
96
|
`/autonomous` uses one explicit user invocation for a local objective, not a
|
|
@@ -64,6 +64,12 @@ Slice 2.4 adds durable structured state for `/loop`. Run its focused tests with:
|
|
|
64
64
|
node --test scripts/loop-state.test.mjs
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
The mission runtime projection is read-only: `mission-status.mjs` validates
|
|
68
|
+
the canonical snapshot and history, while `mission-runtime` observes ephemeral
|
|
69
|
+
events without writing an alternative state. The Open Design boundary requires
|
|
70
|
+
`OPEN_DESIGN_URL` to be a base URL and rejects project or file URLs; the checker
|
|
71
|
+
also rejects private endpoints and UUID-specific crypto dependencies.
|
|
72
|
+
|
|
67
73
|
The dependency-free runtime maintains a JSON snapshot, append-only JSONL
|
|
68
74
|
history, and exclusive lock. Tests cover crash recovery, same-session
|
|
69
75
|
contention, symlink boundaries, journal continuity, migration, and explicit
|
|
@@ -174,6 +174,16 @@ Criteria:
|
|
|
174
174
|
- No auto-merge, scheduling, write-enabled MCP connectors, parallel execution,
|
|
175
175
|
or implicit worktree creation.
|
|
176
176
|
|
|
177
|
+
## `/loop-status`
|
|
178
|
+
|
|
179
|
+
Contract: `lead` read-only projection.
|
|
180
|
+
|
|
181
|
+
`/loop-status --slug <slug>` inspects the canonical snapshot and append-only
|
|
182
|
+
history without acquiring a write lock or changing files. Use
|
|
183
|
+
`node scripts/mission-status.mjs --root /absolute/repository --slug <slug>`
|
|
184
|
+
when an explicit repository root is needed. If state is missing, stale, or
|
|
185
|
+
corrupt, report the durable error and do not repair or resume automatically.
|
|
186
|
+
|
|
177
187
|
## `/autonomous`
|
|
178
188
|
|
|
179
189
|
Contract: explicit invocation -> `developer -> reviewer -> developer (state sync)`.
|
|
@@ -210,6 +210,12 @@
|
|
|
210
210
|
"subtask": false,
|
|
211
211
|
"workflow": "loop"
|
|
212
212
|
},
|
|
213
|
+
{
|
|
214
|
+
"id": "loop-status",
|
|
215
|
+
"root_agent": "lead",
|
|
216
|
+
"subtask": false,
|
|
217
|
+
"workflow": "loop"
|
|
218
|
+
},
|
|
213
219
|
{
|
|
214
220
|
"id": "mvp-spec",
|
|
215
221
|
"root_agent": "scoper",
|
|
@@ -643,7 +649,8 @@
|
|
|
643
649
|
{
|
|
644
650
|
"id": "loop",
|
|
645
651
|
"entrypoints": [
|
|
646
|
-
"loop"
|
|
652
|
+
"loop",
|
|
653
|
+
"loop-status"
|
|
647
654
|
],
|
|
648
655
|
"stages": [
|
|
649
656
|
{
|
|
@@ -908,6 +915,7 @@
|
|
|
908
915
|
"implement",
|
|
909
916
|
"init",
|
|
910
917
|
"loop",
|
|
918
|
+
"loop-status",
|
|
911
919
|
"mvp-spec",
|
|
912
920
|
"plan",
|
|
913
921
|
"research",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Proyección runtime de misión"
|
|
3
|
+
status: proposed
|
|
4
|
+
date: 2026-08-21
|
|
5
|
+
feature: mission-runtime
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Runtime de misión
|
|
9
|
+
|
|
10
|
+
## Autoridad
|
|
11
|
+
|
|
12
|
+
`scripts/loop-state.mjs` es la única autoridad de ejecución. El snapshot
|
|
13
|
+
`.opencode/loops/<slug>.json` y su historial append-only
|
|
14
|
+
`.opencode/loops/<slug>.history.jsonl` se leen y validan; la proyección nunca
|
|
15
|
+
los modifica ni mantiene un segundo estado durable.
|
|
16
|
+
|
|
17
|
+
## Proyección read-only
|
|
18
|
+
|
|
19
|
+
`mission-status.mjs` expone `slug`, `status`, `current_iteration`,
|
|
20
|
+
`planned_iterations`, `last_completed_step`, `blocking_cause`, `session_id`,
|
|
21
|
+
`updated_at` y `next_action`. `session_id` usa el lease activo cuando existe y
|
|
22
|
+
el último session id canónico en caso contrario. `updated_at` procede del último
|
|
23
|
+
evento validado del historial.
|
|
24
|
+
|
|
25
|
+
Los estados canónicos son `approved`, `running`, `paused`, `blocked` y
|
|
26
|
+
`completed`. La proyección no inventa transiciones: si el snapshot está
|
|
27
|
+
desfasado o el historial está corrupto, devuelve el error durable de
|
|
28
|
+
`loop-state`.
|
|
29
|
+
|
|
30
|
+
## Observación de eventos
|
|
31
|
+
|
|
32
|
+
El observador opcional usa únicamente eventos que el SDK local expone:
|
|
33
|
+
`session.created`, `session.status`, `tool.execute.before`,
|
|
34
|
+
`tool.execute.after`, `session.compacted`, `session.error` y `session.idle`.
|
|
35
|
+
La actividad derivada (`running`, `idle` o `blocked`) es efímera y nunca
|
|
36
|
+
sustituye al `status` canónico.
|
|
37
|
+
|
|
38
|
+
Las sesiones con `parentID` distinto de la sesión raíz se ignoran. Los eventos
|
|
39
|
+
duplicados se descartan por una clave efímera de sesión, tipo y payload; perder
|
|
40
|
+
esa deduplicación al reiniciar no altera el snapshot ni el historial.
|
|
41
|
+
|
|
42
|
+
La compaction conserva el session id. Un error de notificación no bloquea el
|
|
43
|
+
loop ni se convierte en una transición durable. Las transiciones reales siguen
|
|
44
|
+
requiriendo `loop-state.mjs` y sus locks, hashes, `action_id` y presupuesto.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
import { createMissionObserver } from "../scripts/mission-runtime-observer.mjs";
|
|
8
|
+
|
|
9
|
+
const root = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
10
|
+
|
|
11
|
+
test("observer ignores child sessions and duplicate root events", async () => {
|
|
12
|
+
const observations = [];
|
|
13
|
+
const observer = createMissionObserver({ notify: async value => observations.push(value) });
|
|
14
|
+
|
|
15
|
+
await observer.observe({
|
|
16
|
+
type: "session.created",
|
|
17
|
+
properties: { info: { id: "root", parentID: null } },
|
|
18
|
+
});
|
|
19
|
+
await observer.observe({
|
|
20
|
+
type: "session.created",
|
|
21
|
+
properties: { info: { id: "child", parentID: "root" } },
|
|
22
|
+
});
|
|
23
|
+
const rootStatus = {
|
|
24
|
+
type: "session.status",
|
|
25
|
+
properties: { sessionID: "root", status: { type: "busy" } },
|
|
26
|
+
};
|
|
27
|
+
await observer.observe(rootStatus);
|
|
28
|
+
await observer.observe(rootStatus);
|
|
29
|
+
await observer.observe({
|
|
30
|
+
type: "session.status",
|
|
31
|
+
properties: { sessionID: "child", status: { type: "busy" } },
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
assert.equal(observations.length, 1);
|
|
35
|
+
assert.equal(observations[0].session_id, "root");
|
|
36
|
+
assert.deepEqual(observer.stats().child_session_ids, ["child"]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("plugin has event and notification hooks but no durable state writes", () => {
|
|
40
|
+
const source = fs.readFileSync(path.join(root, "plugins/mission-runtime.ts"), "utf8");
|
|
41
|
+
assert.match(source, /MissionRuntimePlugin/);
|
|
42
|
+
assert.match(source, /event:/);
|
|
43
|
+
assert.match(source, /chat\.message/);
|
|
44
|
+
assert.match(source, /showToast/);
|
|
45
|
+
assert.doesNotMatch(source, /writeFile|appendFile|rename|\.opencode\/loops/);
|
|
46
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Plugin } from "@opencode-ai/plugin"
|
|
2
|
+
|
|
3
|
+
import { createMissionObserver } from "../scripts/mission-runtime-observer.mjs"
|
|
4
|
+
|
|
5
|
+
const TOAST_DURATION_MS = 1_500
|
|
6
|
+
|
|
7
|
+
function toastVariant(activity: string) {
|
|
8
|
+
if (activity === "blocked") return "error" as const
|
|
9
|
+
if (activity === "idle") return "info" as const
|
|
10
|
+
return "success" as const
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const MissionRuntimePlugin: Plugin = async ({ client, directory }) => {
|
|
14
|
+
const observer = createMissionObserver({
|
|
15
|
+
notify: async observation => {
|
|
16
|
+
if (!client?.tui?.showToast) return
|
|
17
|
+
await client.tui.showToast({
|
|
18
|
+
body: {
|
|
19
|
+
title: "Mission runtime",
|
|
20
|
+
message: `${observation.activity}: ${observation.session_id}`,
|
|
21
|
+
variant: toastVariant(observation.activity),
|
|
22
|
+
duration: TOAST_DURATION_MS,
|
|
23
|
+
},
|
|
24
|
+
query: { directory },
|
|
25
|
+
})
|
|
26
|
+
},
|
|
27
|
+
log: message => console.warn(message),
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
"chat.message": async ({ sessionID }) => {
|
|
32
|
+
await observer.observe({
|
|
33
|
+
type: "chat.message",
|
|
34
|
+
properties: { sessionID },
|
|
35
|
+
})
|
|
36
|
+
},
|
|
37
|
+
event: async ({ event }) => {
|
|
38
|
+
await observer.observe(event)
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { execSync } from "node:child_process";
|
|
5
|
+
import {
|
|
6
|
+
AGENT_IDS as RUNTIME_AGENT_IDS,
|
|
7
|
+
AGENT_POLICIES,
|
|
8
|
+
POLICY_OPERATIONS,
|
|
9
|
+
decideToolAccess,
|
|
10
|
+
} from "./runtime-permission-policy.mjs";
|
|
5
11
|
|
|
6
12
|
const root = process.cwd();
|
|
7
13
|
const errors = [];
|
|
@@ -2913,6 +2919,108 @@ function checkShellExportGuardContract() {
|
|
|
2913
2919
|
}
|
|
2914
2920
|
}
|
|
2915
2921
|
|
|
2922
|
+
function checkRuntimePermissionPolicy() {
|
|
2923
|
+
const actualAgentIds = listMarkdown("agents")
|
|
2924
|
+
.map(stripMarkdownExtension)
|
|
2925
|
+
.sort();
|
|
2926
|
+
const expectedAgentIds = [...RUNTIME_AGENT_IDS].sort();
|
|
2927
|
+
if (JSON.stringify(actualAgentIds) !== JSON.stringify(expectedAgentIds)) {
|
|
2928
|
+
fail("runtime permission policy: agent catalog must match configured agents");
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
for (const agentId of RUNTIME_AGENT_IDS) {
|
|
2932
|
+
const policy = AGENT_POLICIES[agentId];
|
|
2933
|
+
if (!policy) {
|
|
2934
|
+
fail(`runtime permission policy: missing policy for ${agentId}`);
|
|
2935
|
+
continue;
|
|
2936
|
+
}
|
|
2937
|
+
for (const operation of POLICY_OPERATIONS) {
|
|
2938
|
+
const decision = operation === "delegate"
|
|
2939
|
+
? decideToolAccess({ agentId, operation, target: "unknown" })
|
|
2940
|
+
: decideToolAccess({ agentId, operation });
|
|
2941
|
+
if (!["allow", "ask", "deny"].includes(decision)) {
|
|
2942
|
+
fail(`runtime permission policy: invalid ${agentId}/${operation} decision`);
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
const rel = `agents/${agentId}.md`;
|
|
2947
|
+
if (!exists(rel)) continue;
|
|
2948
|
+
const declared = parsePortableAgentPermissions(rel);
|
|
2949
|
+
if (declared.repositoryWrite !== policy.repository_write) {
|
|
2950
|
+
fail(`runtime permission policy: ${agentId} repository_write diverges from frontmatter`);
|
|
2951
|
+
}
|
|
2952
|
+
if (declared.taskDefault !== policy.task_default) {
|
|
2953
|
+
fail(`runtime permission policy: ${agentId} task_default diverges from frontmatter`);
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
if (decideToolAccess({ agentId: "unknown", operation: "write" }) !== "deny") {
|
|
2958
|
+
fail("runtime permission policy: unknown agent must deny");
|
|
2959
|
+
}
|
|
2960
|
+
if (decideToolAccess({ agentId: "developer", operation: "unknown" }) !== "deny") {
|
|
2961
|
+
fail("runtime permission policy: unknown operation must deny");
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
function checkOpenDesignToolContract() {
|
|
2966
|
+
const rel = "tools/open_design.ts";
|
|
2967
|
+
if (!exists(rel)) {
|
|
2968
|
+
fail(`${rel}: missing Open Design tool`);
|
|
2969
|
+
return;
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
const source = read(rel);
|
|
2973
|
+
for (const [label, present] of [
|
|
2974
|
+
["base URL environment", source.includes("OPEN_DESIGN_URL")],
|
|
2975
|
+
["base URL argument", source.includes("baseUrl: tool.schema.string().optional()")],
|
|
2976
|
+
["trailing slash normalization", source.includes('raw.replace(/\\/+$/, "")')],
|
|
2977
|
+
["project-path guard", source.includes("projects(?:\\/|$)")],
|
|
2978
|
+
]) {
|
|
2979
|
+
if (!present) fail(`${rel}: missing Open Design ${label}`);
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
if (/randomUUID|node:crypto/.test(source)) {
|
|
2983
|
+
fail(`${rel}: Open Design tool must not depend on randomUUID or node:crypto`);
|
|
2984
|
+
}
|
|
2985
|
+
if (/juancanas|synology|\/Users\/|\/home\//i.test(source)) {
|
|
2986
|
+
fail(`${rel}: Open Design tool contains a private endpoint or local path`);
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
function checkMissionRuntimeContract() {
|
|
2991
|
+
const required = [
|
|
2992
|
+
"scripts/mission-status.mjs",
|
|
2993
|
+
"scripts/mission-runtime-observer.mjs",
|
|
2994
|
+
"scripts/mission-runtime.test.mjs",
|
|
2995
|
+
"plugins/mission-runtime.ts",
|
|
2996
|
+
"plugins/mission-runtime.test.mjs",
|
|
2997
|
+
"commands/loop-status.md",
|
|
2998
|
+
"docs/ai/specs/mission-runtime.md",
|
|
2999
|
+
];
|
|
3000
|
+
for (const rel of required) {
|
|
3001
|
+
if (!exists(rel)) fail(`${rel}: missing mission runtime surface`);
|
|
3002
|
+
}
|
|
3003
|
+
if (!required.every(exists)) return;
|
|
3004
|
+
|
|
3005
|
+
const status = read("scripts/mission-status.mjs");
|
|
3006
|
+
for (const token of ["inspectLoopState", "readLoopHistory", "--json", "next_action"]) {
|
|
3007
|
+
if (!status.includes(token)) fail(`${required[0]}: missing mission status token ${token}`);
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
const observer = read("scripts/mission-runtime-observer.mjs");
|
|
3011
|
+
for (const token of ["session.status", "session.compacted", "session.error", "child_session_ids"]) {
|
|
3012
|
+
if (!observer.includes(token)) fail(`${required[1]}: missing observer token ${token}`);
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
const plugin = read("plugins/mission-runtime.ts");
|
|
3016
|
+
for (const token of ["event:", "chat.message", "showToast", "mission-runtime-observer.mjs"]) {
|
|
3017
|
+
if (!plugin.includes(token)) fail(`${required[3]}: missing plugin token ${token}`);
|
|
3018
|
+
}
|
|
3019
|
+
if (/writeFile|appendFile|rename|\.opencode\/loops/.test(`${observer}\n${plugin}`)) {
|
|
3020
|
+
fail("mission runtime observer: must not write durable loop state");
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
|
|
2916
3024
|
checkConfig();
|
|
2917
3025
|
checkAgentsIndex();
|
|
2918
3026
|
checkFrontmatter();
|
|
@@ -2953,6 +3061,9 @@ checkHitlDurableContract();
|
|
|
2953
3061
|
checkRoutingDeclarativoContract();
|
|
2954
3062
|
checkRetryPoliciesContract();
|
|
2955
3063
|
checkShellExportGuardContract();
|
|
3064
|
+
checkRuntimePermissionPolicy();
|
|
3065
|
+
checkOpenDesignToolContract();
|
|
3066
|
+
checkMissionRuntimeContract();
|
|
2956
3067
|
|
|
2957
3068
|
if (errors.length > 0) {
|
|
2958
3069
|
console.error("Harness check failed:");
|