@osovv/vv-opencode 1.4.1 → 1.4.3-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +17 -5
- package/dist/lib/orchestration.js +8 -3
- package/dist/lib/orchestration.js.map +1 -1
- package/dist/plugins/system-context-injection/index.js +17 -8
- package/dist/plugins/system-context-injection/index.js.map +1 -1
- package/dist/plugins/workflow/checkpoints.d.ts +53 -1
- package/dist/plugins/workflow/checkpoints.js +350 -33
- package/dist/plugins/workflow/checkpoints.js.map +1 -1
- package/dist/plugins/workflow/delegated.d.ts +144 -2
- package/dist/plugins/workflow/delegated.js +542 -12
- package/dist/plugins/workflow/delegated.js.map +1 -1
- package/dist/plugins/workflow/index.js +269 -20
- package/dist/plugins/workflow/index.js.map +1 -1
- package/dist/plugins/workflow/persistence.d.ts +6 -4
- package/dist/plugins/workflow/persistence.js +192 -31
- package/dist/plugins/workflow/persistence.js.map +1 -1
- package/dist/plugins/workflow/repair.d.ts +3 -0
- package/dist/plugins/workflow/repair.js +39 -31
- package/dist/plugins/workflow/repair.js.map +1 -1
- package/dist/plugins/workflow/state.js +16 -3
- package/dist/plugins/workflow/state.js.map +1 -1
- package/dist/plugins/workflow/tooling.d.ts +36 -6
- package/dist/plugins/workflow/tooling.js +137 -20
- package/dist/plugins/workflow/tooling.js.map +1 -1
- package/package.json +1 -1
- package/schemas/vvoc/v3.json +1 -1
- package/templates/agents/investigator.md +3 -0
- package/templates/agents/vv-code-reviewer.md +10 -3
- package/templates/agents/vv-controller.md +28 -6
- package/templates/agents/vv-implementer.md +6 -3
- package/templates/agents/vv-spec-reviewer.md +4 -0
- package/templates/skills/vv-execute/SKILL.md +11 -7
- package/templates/skills/vv-plan/SKILL.md +3 -1
- package/templates/skills/vv-review/SKILL.md +2 -0
- package/templates/skills/vv-spec/SKILL.md +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## <small>1.4.3-rc.0 (2026-09-12)</small>
|
|
2
|
+
|
|
3
|
+
### Summary
|
|
4
|
+
|
|
5
|
+
This release makes delegated workflow execution recoverable instead of dead-ending: tasks and checkpoint review cycles that stop or exhaust their ordinary budgets can now resume through a bounded, explicitly recorded recovery operation, with one autonomous grant per target and any further unit requiring a fresh root-user message that the runtime validates for role, session identity, and timing. A worker whose report stays protocol-invalid is now settled truthfully as a rejected report with bounded diagnostics rather than appearing permanently in flight, while observed hard stops are preserved and never converted into success. Persistence advances to version 3, adding recovery and rejected-report records while conservatively loading older snapshots, and recovery changes are written durably before new launch permissions appear. Managed controller, worker, and reviewer prompts were also recalibrated to distinguish stops, recovery, and completion, reserve handoff files for genuine transfers, and scope re-reviews to prior findings and the fix's effects — so users get clearer guidance and fewer unnecessary dead ends without weakening mandatory review.
|
|
6
|
+
|
|
7
|
+
* feat(workflow): add bounded recovery, report-rejection settlement, and calibrated prompts ([f5fa9d3](https://github.com/osovv/vv-opencode/commit/f5fa9d3))
|
|
8
|
+
|
|
9
|
+
## <small>1.4.2 (2026-09-11)</small>
|
|
10
|
+
|
|
11
|
+
### Summary
|
|
12
|
+
|
|
13
|
+
This release strengthens the reliability of vvoc's managed prompts and workflow recovery. Managed agents, skills, and the universal guidance injected into primary sessions now carry explicit correctness obligations: for behavior changes, agents derive the material properties that must be preserved, separate write scope from impact and verification scope, investigate directly affected consumers, challenge a material assumption with a diagnostic counterexample, and choose verification at the level where the risk arises, while controllers and reviewers distinguish "no defect discovered" from sufficient evidence and can fail a change for a material verification gap. In addition, when a tracked subagent returns a malformed result, the workflow plugin now performs at most one bounded continuation in the same child session without a tools override, preserving that session's persisted permissions and requiring a truthful post-continuation status, while explicit BLOCKED or NEEDS_CONTEXT output still fails closed. Together these changes make agent verification more honest and keep workflow recovery from silently altering permissions.
|
|
14
|
+
|
|
15
|
+
* feat(prompts): add correctness obligations to managed agents, skills, and universal guidance ([6f2dd21](https://github.com/osovv/vv-opencode/commit/6f2dd21))
|
|
16
|
+
* fix(workflow): preserve permissions during result continuation ([5342a31](https://github.com/osovv/vv-opencode/commit/5342a31))
|
|
17
|
+
|
|
1
18
|
## <small>1.4.1 (2026-09-11)</small>
|
|
2
19
|
|
|
3
20
|
### Summary
|
package/README.md
CHANGED
|
@@ -169,7 +169,7 @@ grep '<COMPONENT-' .vvoc/specs/*/*.xml # component map across spec and plan
|
|
|
169
169
|
| **ModelRolesPlugin** | Semantic model roles (`vv-role:smart`, `vv-role:fast`, …) instead of hardcoded model IDs in agents, subagents, and commands — resolved per machine or project at startup. |
|
|
170
170
|
| **GuardianPlugin** | Keeps long or AFK runs moving by auto-approving routine low-risk permission requests; anything risky stays in OpenCode's normal manual approval flow. |
|
|
171
171
|
| **HashlineEditPlugin** | Routes each model to exactly one native edit tool (host `edit` for GLM/Qwen/Kimi, host `apply_patch` for GPT, `str_replace_editor` for DeepSeek, `hashline_edit` for unmatched models) and hides the other edit tools per session. |
|
|
172
|
-
| **SystemContextInjectionPlugin** | Injects the work policy selected by the orchestration profile into vv-controller at startup,
|
|
172
|
+
| **SystemContextInjectionPlugin** | Injects universal guidance — including correctness obligations for behavior changes — plus the work policy selected by the orchestration profile into vv-controller at startup, and registers skill discovery; subagents stay unpolluted. |
|
|
173
173
|
| **SecretsRedactionPlugin** | Redacts tokens, keys, emails, and other sensitive values before messages reach the model, restoring them only where local execution needs the originals. |
|
|
174
174
|
| **WebToolsPlugin** | Two provider-neutral tools — `web_search` and `web_fetch` — over Exa, Brave, Z.AI, native retrieval, or Spider, with permission checks and normalized output. |
|
|
175
175
|
| **ToolHistoryCompactionPlugin** | Shrinks the context replayed to the model by compacting old tool outputs non-destructively, without touching on-disk history. |
|
|
@@ -192,6 +192,8 @@ All prompt files are scaffolded by `vvoc install` / `vvoc sync`:
|
|
|
192
192
|
| `investigator` | Finds the root cause first when behavior is unclear or a failure needs diagnosis |
|
|
193
193
|
| `guardian` | Supports GuardianPlugin by reviewing permission requests and auto-approving only routine low-risk ones |
|
|
194
194
|
|
|
195
|
+
Managed prompts and the universal guidance injected into primary sessions carry explicit correctness obligations. For behavior changes, agents derive the material properties that must be preserved from the request and established contracts, separate write scope from impact and verification scope, investigate directly affected consumers, challenge a material assumption with a diagnostic counterexample, and choose verification at the level the risk arises. Controllers tie completion claims to observed evidence rather than status markers; reviewers distinguish no discovered defect from sufficient support for a material claim and can fail a change for a material verification gap. These obligations are prompt-level guidance only: `vvoc install` / `vvoc sync` deliver the current wording, changes take effect after an OpenCode restart like all vvoc config changes, and the bundled contract tests check instruction delivery and wording — they do not evaluate or guarantee how a real model behaves.
|
|
196
|
+
|
|
195
197
|
### Managed skills
|
|
196
198
|
|
|
197
199
|
Two families: `vv-*` skills guide the work protocol, while `vvoc-*` skills operate and observe the vvoc/OpenCode tooling itself.
|
|
@@ -406,7 +408,7 @@ Four concrete policies control how vv-controller delegates work at runtime:
|
|
|
406
408
|
- `single-session` — vv-controller performs exploration, investigation, planning, implementation, and verification directly. Independent reviewer subagents remain available when the user explicitly requests review or when a materially risky completed change benefits from independent cross-model evaluation.
|
|
407
409
|
- `balanced` — vv-controller keeps architecture, critical reading, and final synthesis in the primary session and may selectively delegate bounded search, investigation, mechanical implementation, or review when that is the lightest safe route. Delegation is optional, not mechanically mandatory.
|
|
408
410
|
- `orchestrated` — vv-controller uses the full tracked implementer/reviewer workflow with explicit work items, required reviewers, bounded rounds, and hard stops.
|
|
409
|
-
- `delegated` — implementation is delegated to workers while the primary session keeps architecture, important code reading, task contracts, explicit acceptance, and final synthesis. Source edits, tests, config changes, formatting, lint fixes, and reviewer-requested fixes — including small mechanical ones — go to workers through bounded task packets. Independent review happens at declared plan checkpoints instead of after every task; `BLOCKED` and `NEEDS_CONTEXT` remain hard stops.
|
|
411
|
+
- `delegated` — implementation is delegated to workers while the primary session keeps architecture, important code reading, task contracts, explicit acceptance, and final synthesis. Source edits, tests, config changes, formatting, lint fixes, and reviewer-requested fixes — including small mechanical ones — go to workers through bounded task packets. Independent review happens at declared plan checkpoints instead of after every task; `BLOCKED` and `NEEDS_CONTEXT` remain hard stops, and stopped or exhausted work resumes only through recorded bounded recovery.
|
|
410
412
|
|
|
411
413
|
Pick a profile explicitly or let a built-in preset select one:
|
|
412
414
|
|
|
@@ -462,18 +464,28 @@ Delegated tasks are opened with `"mode": "delegated"`, an explicitly empty `requ
|
|
|
462
464
|
- `accept` (with rationale and evidence references) records controller acceptance and reaches `ready_to_close`. Acceptance is recorded distinctly from an independent reviewer `PASS`.
|
|
463
465
|
- `request_changes` returns the task to the implementation path. Controller-directed retries are bounded to an initial attempt plus one correction; re-deciding or reopening never resets that budget. `DONE_WITH_CONCERNS` requires an explicit `concernsDisposition`.
|
|
464
466
|
- `rework` reopens an accepted task only when a failed checkpoint from the same registered run covers it, preserving acceptance history and granting exactly one additional attempt.
|
|
467
|
+
- `recover` resumes a stopped or exhausted unaccepted task without resetting history. Recovery targets the latest terminal attempt and requires an explicit `diagnosis`, a `changedCondition` (the changed condition or approach), `verification` references, and a stable `recoveryId`. When ordinary budget remains, recovery simply returns a stopped item to the launch gate; when an extra attempt is necessary, it grants exactly one. The first grant per target is the single autonomous allowance; every further unit requires a fresh root-user message referenced by `userMessageId`, which the runtime validates for role, owning-session identity, message identity, and a timestamp at or after the stop — never for its wording — and each message authorizes at most one unit per target. A successful recovery authorization only makes the next bounded attempt possible: it is not a successful implementation, not acceptance, and never satisfies a reviewer.
|
|
468
|
+
|
|
469
|
+
Worker stops stay hard stops for ordinary dispatch: a `BLOCKED` or `NEEDS_CONTEXT` result is never re-launched directly, and its recorded outcome and explanation remain historical facts. The same applies to an exhausted budget — an ordinary third launch is refused until a recorded recovery raises it. Accepted items are not recovery targets; their path is checkpoint-authorized rework.
|
|
465
470
|
|
|
466
471
|
A worker can fail to launch at all: the host task wrapper rejects the call before the worker runs (for example, an unknown provider or model). The host skips the `tool.execute.after` hook on a thrown execution, so the plugin consumes the failure as a distinct **failed attempt** from the live call binding instead of leaving `inFlightAttempt` stranded until a restart. The supported case is deliberately narrow — a fresh ordinary foreground `vv-implementer` task launch (no `background`, no `task_id` resume, no command/subtask path) whose host call errors with the exact `Subagent failed (task_id: <child>): ` wrapper, where the event metadata independently binds the same parent session and child session. When it applies, the attempt is marked `failed` with the bounded host error as evidence and a completion time, the item stays `awaiting_implementer`, and the attempt is charged against the same two-attempt budget. The controller can then explicitly retry with a new call; two failed attempts exhaust the normal budget exactly like two completed ones. A failed attempt never counts as `DONE`, cannot be accepted or decided as a successful completion, and persists across restart. Because a worker may have applied partial edits before failing, inspect the diff before retrying or closing.
|
|
467
472
|
|
|
468
473
|
This is not universal automatic error recovery. Background or promoted launches, resumed/shared/re-prompted children, cancellation or interruption, any task that entered the `tool.execute.after` hook (including a protocol/repair failure there), missing or mismatched parent/child metadata, and unknown or non-wrapper host errors all remain fail-closed: the in-flight block is preserved and no retry is authorized from the event alone. The plugin never hydrates workflow state, infers a work item from error text, or resets a whole session because of an error event, and it does not reclassify legacy-mode or checkpoint-reviewer launches.
|
|
469
474
|
|
|
470
|
-
|
|
475
|
+
A worker whose execution finishes but whose final report stays protocol-invalid after the bounded continuation is settled truthfully as a **rejected report**: the exact call-bound attempt is recorded as a completed execution with status `report_rejected`, a bounded diagnostic excerpt, and the protocol error code — never as `DONE`, never as a launch failure, and never as a still-in-flight attempt. When the malformed output contains an explicit `VVOC_STATUS: BLOCKED` or `NEEDS_CONTEXT` line, the observed stop is preserved (the item parks in the corresponding hard-stop state) and no continuation runs; otherwise the item returns to the launch gate with the attempt consumed. A rejected report has the same bounded recovery path as any other terminal outcome, and `work_item_list` distinguishes it from a running attempt, an exhausted budget, and a substantive stop by exposing the remaining budget and the supported next action. Unknown or still-running host outcomes (for example a non-string task output) are never guessed terminal and cannot clear a live attempt.
|
|
476
|
+
|
|
477
|
+
When a tracked subagent returns a recognized task envelope whose inner result is malformed for the strict protocol — a missing `VVOC_STATUS`, a missing `VVOC_ROUTE`, a non-protocol top-block line, or body text without the required blank line — the plugin makes at most one bounded continuation to that same child session. The continuation request carries no `tools` override (so the child's persisted session permissions are preserved), and its instructions direct the child to preserve the original work item, assignment, role, and write scope; to finish unfinished work with its existing history and currently permitted tools; or, if the work was already complete, to correct only the final report without repeating work or inventing evidence; and to report a truthful post-continuation `VVOC_STATUS`/`VVOC_ROUTE` rather than freezing an outdated one. These are instructions to the model, not a mechanical guarantee of compliance: the plugin still reparses the continued output strictly, applies the bounded error-code and explicit-hard-stop gates, and fails closed with the original protocol error and excerpt. Continuation is attempted only once; a valid result never continues, and a failed, empty, or still-malformed continuation is never retried. An explicit `VVOC_STATUS: BLOCKED` or `NEEDS_CONTEXT` line is detected before the call, so malformed hard-stop output fails closed through the original protocol error and excerpt instead of being continued.
|
|
478
|
+
|
|
479
|
+
Independent review happens at checkpoints declared in the plan. An approved delegated plan carries an `<execution><mode>delegated</mode>` section with `<review_checkpoints>` (`CHECKPOINT-R-NNN` identities, each with kind, wave barrier, covered tasks, reviewed scope files, reviewer set, acceptance criteria, and verification commands) and per-task `<write_scope>` lists. Registration accepts only this supported approved native plan package (the approved spec and plan pair under `.vvoc/specs/`); foreign lifecycle plan formats are not convertible into it. `work_checkpoint` handles four actions:
|
|
471
480
|
|
|
472
481
|
- `register` — loads an approved active plan plus its linked approved spec, fully lints them, and binds the run to their content hashes and the canonical workspace root. Re-registering identical inputs is idempotent; changed approved inputs are explicit plan drift, never a progress reset.
|
|
473
482
|
- `start` — after every covered task is accepted, captures a SHA-256 fingerprint over the checkpoint scope (file contents, existence, mode bits, and covered accepted attempts) and opens exactly the declared reviewer set as an ordinary `review_only` item. Writes overlapping an in-flight checkpoint scope are refused.
|
|
474
|
-
- `verify` — derives `passed`, `failed`, `stale`, or `stopped` from the recorded reviewer results plus freshly recomputed fingerprints and approval hashes. A checkpoint passes only when every declared reviewer passes for the pinned snapshot; a closed review-only `FAIL` report is findings, not approval; edits during review make the generation stale. The final checkpoint seals the run only via `verify` with `complete: true` after every task is accepted, every earlier checkpoint passed, and the complete declared write scope is covered with fresh verification.
|
|
483
|
+
- `verify` — derives `passed`, `failed`, `stale`, or `stopped` from the recorded reviewer results plus freshly recomputed fingerprints and approval hashes. A checkpoint passes only when every declared reviewer passes for the pinned snapshot; a closed review-only `FAIL` report is findings, not approval; edits during review make the generation stale. The final checkpoint seals the run only via `verify` with `complete: true` after every task is accepted, every earlier checkpoint passed, and the complete declared write scope is covered with fresh verification. Completion is refused while a declared reviewer is missing: a skipped reviewer is never fabricated into a pass.
|
|
484
|
+
- `recover` — bounded recovery for a checkpoint generation that stopped (`NEEDS_CONTEXT`) or exhausted its two ordinary generations. Recovery takes the same `diagnosis`, `changedCondition`, `verification`, `recoveryId`, and optional `userMessageId` fields as task recovery, with the same one-unit autonomous-then-user-authorized policy per checkpoint. Recovering a stopped generation settles it into history as a `stopped` entry — it does not convert the stop into a failure, so checkpoint rework stays locked until a real failed generation exists — and recovering an exhausted checkpoint grants exactly one further generation with a fresh snapshot at the next `start`. Recovery never satisfies prerequisites, erases a `FAIL`, or seals a run: only the required passing final review does.
|
|
485
|
+
|
|
486
|
+
Passed milestones stay historical: later planned edits are covered by later checkpoints or the final gate, not by an old approval. Hard stops (`BLOCKED`, `NEEDS_CONTEXT`) are never reset or bypassed by acceptance or checkpoint handling; only a separately recorded recovery decision resumes the affected work. Checkpoint state persists per session and survives restarts; a persisted `PASS` is not fresh evidence until `verify` recomputes current hashes.
|
|
475
487
|
|
|
476
|
-
|
|
488
|
+
Delegated and checkpoint state persists under `$XDG_DATA_HOME/vvoc/workflow/<sessionId>/workflow-state.json` at snapshot version 3, which adds recovery histories, replay-protected authorization references, recovery-aware budgets, and rejected-report attempts. Older supported snapshots load conservatively: version 2 files hydrate with empty recovery histories and their original budgets, and version 1 files hydrate as legacy records without plan runs; neither ever synthesizes acceptance, approval, or recovery. A snapshot written by a newer plugin version is refused rather than reset. Recovery mutations commit on the live store and persist synchronously — a failed write rolls the mutation back, so changed launch permissions appear only after a durable record; terminal report settlements stage, persist, and then commit. Because runtime plugins share the startup config snapshot, a plugin upgrade takes effect after an OpenCode restart.
|
|
477
489
|
|
|
478
490
|
Plans without an `<execution>` section keep their legacy meaning; executing them with different acceptance or review obligations requires an explicit agreed plan amendment, and archived plans are never rewritten. In a deterministic dispatch-count scenario, a twenty-task plan with two intermediate code-review checkpoints and one final spec+code checkpoint needs exactly four initial reviewer launches instead of forty — that is a property of the declared checkpoint policy, not a wall-clock or model-quality benchmark.
|
|
479
491
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// END_MODULE_MAP
|
|
22
22
|
//
|
|
23
23
|
// START_CHANGE_SUMMARY
|
|
24
|
-
// LAST_CHANGE: [C-
|
|
24
|
+
// LAST_CHANGE: [C-WORKFLOW-BOUNDED-RECOVERY-R1 - Calibrated the delegated policy: worker stops are bounded diagnosis and recovery targets rather than session ends, recovery is distinct from acceptance, and checkpoint registration states its native plan boundary.]
|
|
25
25
|
// END_CHANGE_SUMMARY
|
|
26
26
|
// START_BLOCK_PROFILE_TYPES
|
|
27
27
|
/** Supported orchestration profiles in stable CLI/schema order. */
|
|
@@ -67,14 +67,19 @@ You may author specifications, plans, and explicitly requested planning artifact
|
|
|
67
67
|
existing approval lifecycle, and you may execute verification commands, including commands that
|
|
68
68
|
produce ordinary generated verification or build outputs. Do not write complete implementation
|
|
69
69
|
bodies inside task packets and do not bypass the delegation policy by rewriting source through
|
|
70
|
-
shell commands.
|
|
70
|
+
shell commands. work_checkpoint registration accepts only its supported approved native plan
|
|
71
|
+
package (the approved spec and plan pair under .vvoc/specs/); foreign lifecycle plans are not
|
|
72
|
+
convertible into it.
|
|
71
73
|
|
|
72
74
|
Send each worker one bounded task packet and let it complete its local edit, test, and fix cycle
|
|
73
75
|
before reporting a concise result with evidence references. One active implementation worker is the
|
|
74
76
|
default; any parallel work requires explicitly disjoint approved scopes. Read the material changed
|
|
75
77
|
code and evidence yourself, then explicitly accept each completed attempt or request changes with
|
|
76
78
|
bounded rationale. Spend independent review at declared plan checkpoints instead of after every
|
|
77
|
-
task, and treat BLOCKED and NEEDS_CONTEXT as hard stops
|
|
79
|
+
task, and treat BLOCKED and NEEDS_CONTEXT as hard stops: diagnose a stopped or exhausted task
|
|
80
|
+
yourself and recover it through the session's supported recovery operation — bounded, one unit per
|
|
81
|
+
grant, never an unlimited retry and never a substitute for acceptance or review. A stop suspends
|
|
82
|
+
that work item; it does not end the session.
|
|
78
83
|
`.trim();
|
|
79
84
|
const RESOLVED_POLICIES = Object.freeze({
|
|
80
85
|
"single-session": Object.freeze({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration.js","sourceRoot":"","sources":["../../src/lib/orchestration.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,iBAAiB;AACjB,wBAAwB;AACxB,yIAAyI;AACzI,yHAAyH;AACzH,oBAAoB;AACpB,kEAAkE;AAClE,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,0FAA0F;AAC1F,6DAA6D;AAC7D,yEAAyE;AACzE,iGAAiG;AACjG,4FAA4F;AAC5F,0GAA0G;AAC1G,2FAA2F;AAC3F,sGAAsG;AACtG,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"orchestration.js","sourceRoot":"","sources":["../../src/lib/orchestration.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,iBAAiB;AACjB,wBAAwB;AACxB,yIAAyI;AACzI,yHAAyH;AACzH,oBAAoB;AACpB,kEAAkE;AAClE,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,0FAA0F;AAC1F,6DAA6D;AAC7D,yEAAyE;AACzE,iGAAiG;AACjG,4FAA4F;AAC5F,0GAA0G;AAC1G,2FAA2F;AAC3F,sGAAsG;AACtG,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,0QAA0Q;AAC1Q,qBAAqB;AAErB,4BAA4B;AAC5B,mEAAmE;AACnE,MAAM,C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,8BAA8B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// FILE: src/plugins/system-context-injection/index.ts
|
|
2
|
-
// VERSION: 0.
|
|
2
|
+
// VERSION: 0.5.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
|
-
// PURPOSE: Inject universal primary guidance and one startup-resolved concrete orchestration policy into vv-controller without polluting subagent prompts.
|
|
5
|
-
// SCOPE: Universal instructions, vv-controller policy selection, explore-worker guidance, known subagent filtering, startup vvoc snapshot use, custom subagent tracking, and chat.message injection.
|
|
4
|
+
// PURPOSE: Inject universal primary guidance, including correctness obligations for behavior changes, and one startup-resolved concrete orchestration policy into vv-controller without polluting subagent prompts.
|
|
5
|
+
// SCOPE: Universal instructions with correctness obligations and material-assumption discipline, vv-controller policy selection, explore-worker guidance, known subagent filtering, startup vvoc snapshot use, custom subagent tracking, and chat.message injection.
|
|
6
6
|
// DEPENDS: [@opencode-ai/plugin, src/lib/config-layers.ts, src/lib/managed-agents.ts, src/lib/orchestration.ts, src/lib/vvoc-paths.ts]
|
|
7
7
|
// LINKS: [M-PLUGIN-SYSTEM-CONTEXT-INJECTION, M-ORCHESTRATION-PROFILES, M-CLI-MANAGED-AGENTS]
|
|
8
8
|
// ROLE: RUNTIME
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// END_MODULE_MAP
|
|
15
15
|
//
|
|
16
16
|
// START_CHANGE_SUMMARY
|
|
17
|
-
// LAST_CHANGE: [
|
|
17
|
+
// LAST_CHANGE: [C-WORKFLOW-BOUNDED-RECOVERY-R1 - Removed mandatory per-claim reasoning labels and the restatement ritual while retaining material-assumption discipline, repository-answerable question resolution, proportional verification, and honest uncertainty.]
|
|
18
18
|
// END_CHANGE_SUMMARY
|
|
19
19
|
import { loadVvocConfig } from "../../lib/config-layers.js";
|
|
20
20
|
import { MANAGED_SUBAGENT_NAMES } from "../../lib/managed-agents.js";
|
|
@@ -41,16 +41,25 @@ const UNIVERSAL_PRIMARY_SYSTEM_CONTEXTS = [
|
|
|
41
41
|
"<assumption_discipline>",
|
|
42
42
|
"Do not make silent material assumptions.",
|
|
43
43
|
"A material assumption is one that affects behavior, scope, API shape, schema, UX, data meaning, or verification.",
|
|
44
|
-
"If a material assumption is necessary, state it explicitly.",
|
|
44
|
+
"If a material assumption is necessary, state it explicitly and carry its effect into the result report.",
|
|
45
45
|
"If a material assumption later becomes false, stop and reroute.",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"Resolve repository-answerable technical questions from the established code, contracts, and tests yourself; only a genuine business-semantics fork needs a user decision.",
|
|
47
|
+
"Report honest residual uncertainty: an unverified material condition is named as unverified, never presented as a passed check.",
|
|
48
48
|
"</assumption_discipline>",
|
|
49
49
|
].join("\n"),
|
|
50
|
+
[
|
|
51
|
+
"<correctness_obligations>",
|
|
52
|
+
"For behavior changes, run a compact correctness cycle before reporting done: state the target effect, derive the material properties that must be preserved from the request and established contracts, identify the directly affected consumers, challenge at least one material assumption with a diagnostic counterexample, choose verification proportionate to the risk, report the observed result, and name the remaining uncertainty.",
|
|
53
|
+
"Separate write scope (what you may edit), impact scope (behavior that could change), and verification scope (what you actually check). Investigating directly affected consumers to understand impact is required; broadening writes beyond the approved scope is not — request a scope decision instead.",
|
|
54
|
+
"Choose verification at the level where the risk arises. Derive test expectations from the contract and the request, not from the implementation's current output, and ground mocks in the dependency's established contract rather than in whatever makes the change pass.",
|
|
55
|
+
"Report honestly what was inspected, what was reasoned about, and what was executed as a check. The absence of a discovered defect is not proof of correctness: a substantive completion claim needs observed evidence, and an unverified material condition is reported as remaining uncertainty, never presented as a passed check.",
|
|
56
|
+
"Unrelated informational or trivial documentation work needs none of this ceremony.",
|
|
57
|
+
"</correctness_obligations>",
|
|
58
|
+
].join("\n"),
|
|
50
59
|
[
|
|
51
60
|
"<working_state>",
|
|
52
61
|
"For non-trivial work, stabilize a compact working state before acting: goal, current route, constraints, non-goals when relevant, assumptions, verification target, current unknown, and reroute if.",
|
|
53
|
-
"
|
|
62
|
+
"Check that state against the original request before and while acting; a constraint dropped early wastes the downstream chain.",
|
|
54
63
|
"Keep it compact and revise it when evidence changes.",
|
|
55
64
|
"Surface it explicitly when blocked, rerouting, or handing off to the user.",
|
|
56
65
|
"</working_state>",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/system-context-injection/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,iBAAiB;AACjB,wBAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/system-context-injection/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,iBAAiB;AACjB,wBAAwB;AACxB,sNAAsN;AACtN,uQAAuQ;AACvQ,yIAAyI;AACzI,+FAA+F;AAC/F,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,0HAA0H;AAC1H,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,0QAA0Q;AAC1Q,qBAAqB;AAGrB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,0BAA0B,GAE3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,kBAAkB,GAAG,CAAC,SAAS,CAAU,CAAC;AAChD,MAAM,wBAAwB,GAAG,CAAC,UAAU,CAAU,CAAC;AACvD,MAAM,uBAAuB,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAC5E,MAAM,8BAA8B,GAAG,EAAW,CAAC;AACnD,MAAM,gBAAgB,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,CAAC,gBAAgB,CAAC;gBAC5B,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EACxC,CAAC;gBACD,MAAM,CAAC,KAAK,GAAG,CAAC,GAAG,YAAY,EAAE,gBAAgB,CAAC,CAAC;gBACnD,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC;YAC/B,CAAC;QACH,CAAC;QACD,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACvC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC,EAAE,CAAC;gBAChE,OAAO;YACT,CAAC;YAED,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,oBAAoB,CAC1C,MAAM,CAAC,OAAO,CAAC,MAAM,EACrB,yBAAyB,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CACxD,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AACF,yBAAyB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DelegatedPlanDefinition, DelegatedReviewer } from "../../lib/spec-lint.js";
|
|
2
2
|
import { type LoadedDelegatedPlan } from "./checkpoint-io.js";
|
|
3
|
+
import { type DelegatedRecoveryKind, type LookupRecoveryUserMessage } from "./delegated.js";
|
|
3
4
|
import { type WorkItemStore, type WorkItemStoreData } from "./state.js";
|
|
4
5
|
export declare const MAX_CHECKPOINT_REVIEW_ATTEMPTS = 2;
|
|
5
6
|
export interface DelegatedReviewerOutcome {
|
|
@@ -17,10 +18,25 @@ export interface DelegatedCheckpointReview {
|
|
|
17
18
|
}
|
|
18
19
|
export interface DelegatedCheckpointHistoryEntry {
|
|
19
20
|
generation: number;
|
|
20
|
-
outcome: "passed" | "failed" | "stale";
|
|
21
|
+
outcome: "passed" | "failed" | "stale" | "stopped";
|
|
21
22
|
fingerprint: string;
|
|
22
23
|
completedAt: string;
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* One bounded checkpoint recovery event. `resume` settles a stopped
|
|
27
|
+
* generation without manufacturing budget; grant kinds add exactly one
|
|
28
|
+
* generation each and stay replay-protected by recoveryId and userMessageId.
|
|
29
|
+
*/
|
|
30
|
+
export interface DelegatedCheckpointRecoveryRecord {
|
|
31
|
+
recoveryId: string;
|
|
32
|
+
targetGeneration: number;
|
|
33
|
+
kind: DelegatedRecoveryKind;
|
|
34
|
+
diagnosis: string;
|
|
35
|
+
changedCondition: string;
|
|
36
|
+
verification: string[];
|
|
37
|
+
recoveredAt: string;
|
|
38
|
+
userMessageId?: string;
|
|
39
|
+
}
|
|
24
40
|
export interface DelegatedRunCheckpoint {
|
|
25
41
|
checkpointId: string;
|
|
26
42
|
kind: "milestone" | "final";
|
|
@@ -33,6 +49,7 @@ export interface DelegatedRunCheckpoint {
|
|
|
33
49
|
lastOutcome?: "passed" | "failed" | "stale" | "stopped" | "incomplete";
|
|
34
50
|
currentReview?: DelegatedCheckpointReview;
|
|
35
51
|
history: DelegatedCheckpointHistoryEntry[];
|
|
52
|
+
recoveryHistory: DelegatedCheckpointRecoveryRecord[];
|
|
36
53
|
}
|
|
37
54
|
export interface DelegatedRunTask {
|
|
38
55
|
taskId: string;
|
|
@@ -54,6 +71,14 @@ export interface DelegatedPlanRun {
|
|
|
54
71
|
tasks: Map<string, DelegatedRunTask>;
|
|
55
72
|
checkpoints: Map<string, DelegatedRunCheckpoint>;
|
|
56
73
|
}
|
|
74
|
+
/** Deep clone of one registered run for staged persistence commits. */
|
|
75
|
+
export declare function cloneDelegatedPlanRun(run: DelegatedPlanRun): DelegatedPlanRun;
|
|
76
|
+
/** Count of budget-granting checkpoint recovery entries. */
|
|
77
|
+
export declare function checkpointRecoveryGrantCount(history: readonly DelegatedCheckpointRecoveryRecord[]): number;
|
|
78
|
+
/** Allowed generation count: the ordinary maximum plus one per recovery grant. */
|
|
79
|
+
export declare function checkpointGenerationBudget(checkpoint: DelegatedRunCheckpoint): number;
|
|
80
|
+
/** Whether the single autonomous checkpoint grant is already recorded. */
|
|
81
|
+
export declare function checkpointAutonomousGrantConsumed(history: readonly DelegatedCheckpointRecoveryRecord[]): boolean;
|
|
57
82
|
export type RegisterDelegatedPlanResult = {
|
|
58
83
|
ok: true;
|
|
59
84
|
runId: string;
|
|
@@ -168,6 +193,33 @@ export interface AuthorizeReworkInput {
|
|
|
168
193
|
}
|
|
169
194
|
export declare function authorizeReworkFromFailedCheckpoint(store: WorkItemStore, input: AuthorizeReworkInput): AuthorizeReworkResult;
|
|
170
195
|
export declare function authorizeReworkFromFailedCheckpointInStore(data: WorkItemStoreData, input: AuthorizeReworkInput): AuthorizeReworkResult;
|
|
196
|
+
export type RecoverDelegatedCheckpointResult = {
|
|
197
|
+
ok: true;
|
|
198
|
+
checkpoint: DelegatedRunCheckpoint;
|
|
199
|
+
recoveryId: string;
|
|
200
|
+
kind: DelegatedRecoveryKind;
|
|
201
|
+
generationBudget: number;
|
|
202
|
+
settledStoppedGeneration?: number;
|
|
203
|
+
} | {
|
|
204
|
+
ok: false;
|
|
205
|
+
errorCode: "RUN_NOT_FOUND" | "SESSION_MISMATCH" | "CHECKPOINT_NOT_FOUND" | "RUN_SEALED" | "ALREADY_PASSED" | "INVALID_TARGET_STATE" | "DUPLICATE_RECOVERY_ID" | "INVALID_INPUT" | "AUTONOMOUS_GRANT_EXHAUSTED" | "AUTHORIZATION_LOOKUP_FAILED" | "AUTHORIZATION_NOT_FOUND" | "AUTHORIZATION_NOT_USER_MESSAGE" | "AUTHORIZATION_SESSION_MISMATCH" | "AUTHORIZATION_ID_MISMATCH" | "AUTHORIZATION_STALE" | "AUTHORIZATION_REUSED";
|
|
206
|
+
message: string;
|
|
207
|
+
};
|
|
208
|
+
export interface RecoverDelegatedCheckpointInput {
|
|
209
|
+
sessionId: string;
|
|
210
|
+
runId: string;
|
|
211
|
+
checkpointId: string;
|
|
212
|
+
diagnosis: string;
|
|
213
|
+
changedCondition: string;
|
|
214
|
+
verification: string[];
|
|
215
|
+
recoveryId: string;
|
|
216
|
+
/** Fresh root-user message authorizing one further generation for this target. */
|
|
217
|
+
userMessageId?: string;
|
|
218
|
+
/** Read-only authorization lookup supplied by the tool layer. */
|
|
219
|
+
lookupUserMessage?: LookupRecoveryUserMessage;
|
|
220
|
+
}
|
|
221
|
+
export declare function recoverDelegatedCheckpoint(store: WorkItemStore, input: RecoverDelegatedCheckpointInput): Promise<RecoverDelegatedCheckpointResult>;
|
|
222
|
+
export declare function recoverDelegatedCheckpointInStore(data: WorkItemStoreData, input: RecoverDelegatedCheckpointInput): Promise<RecoverDelegatedCheckpointResult>;
|
|
171
223
|
/** Unsatisfied checkpoint barriers blocking task launches for the given wave, in declaration order. */
|
|
172
224
|
export declare function checkpointBarrierUnsatisfied(data: WorkItemStoreData, runId: string, wave: string): {
|
|
173
225
|
ok: true;
|