opencode-dev-framework 0.2.4 → 0.4.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/README.md +55 -29
- package/dist/block-store.d.ts +53 -0
- package/dist/block-store.js +144 -0
- package/dist/format-status.js +13 -1
- package/dist/gate.d.ts +2 -0
- package/dist/gate.js +11 -5
- package/dist/harness.d.ts +2 -1
- package/dist/harness.js +3 -4
- package/dist/index.d.ts +24 -6
- package/dist/index.js +311 -60
- package/dist/protect.d.ts +16 -0
- package/dist/protect.js +32 -0
- package/dist/registry.d.ts +8 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -27,7 +27,9 @@ reimplemented as an OpenCode-native plugin.
|
|
|
27
27
|
cadence. On failure inside `gate.max_blocks` the plugin re-prompts the session with
|
|
28
28
|
the failure summary. On OpenCode builds that dispatch the `session.stopping` hook
|
|
29
29
|
(PR #44712) the same verdict vetoes loop exit *before* the agent stops — a true hard
|
|
30
|
-
stop
|
|
30
|
+
stop — and on builds with the V2 `experimental.stopping` hook the failure continues
|
|
31
|
+
the turn with steer text instead; `/df-status` shows which mode is active
|
|
32
|
+
(idle-fallback → legacy probe → new hook).
|
|
31
33
|
- **Pre-flight gate (optional).** When a `preflight:` task list is configured, edit
|
|
32
34
|
tools are **denied** (standard/strict) until the agent writes its pre-flight findings
|
|
33
35
|
to `.opencode/opencode-dev-framework/preflight.md`. Use it for work that requires
|
|
@@ -36,20 +38,16 @@ reimplemented as an OpenCode-native plugin.
|
|
|
36
38
|
- **Custom tools.** `dev_framework_init` scaffolds project-level agents,
|
|
37
39
|
skills, local rules directory, and config; `dev_framework_set_profile` changes the profile
|
|
38
40
|
in-session without restarting; `dev_framework_status` reports the current
|
|
39
|
-
profile, guardrails, gate, and tracked changed files
|
|
41
|
+
profile, guardrails, gate, and tracked changed files; `dev_framework_verify`
|
|
42
|
+
runs the completion gate on demand and returns the summary to the agent.
|
|
40
43
|
- **CLI installer.** `df init` auto-detects your language and writes a config
|
|
41
44
|
with sensible commands; `df profile <name>` changes the profile from the
|
|
42
45
|
shell; `df status` / `df version` report template state and the version.
|
|
43
|
-
- **Slash commands.** The plugin registers four commands
|
|
44
|
-
anything to the LLM:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
registered with an empty template so the argument (e.g. `standard`) is
|
|
49
|
-
captured by the plugin and the model never sees it; the result is shown as a
|
|
50
|
-
toast and the user turn is suppressed.
|
|
51
|
-
- The `dev_framework_init` and `dev_framework_set_profile` custom *tools* remain
|
|
52
|
-
available for in-agent use.
|
|
46
|
+
- **Slash commands.** The plugin registers four TUI commands that open instant
|
|
47
|
+
modal dialogs and never feed anything to the LLM: `/df-status`, `/df-help`,
|
|
48
|
+
`/df-profile` (bare for a picker, or with an argument), and `/df-verify`
|
|
49
|
+
(runs the gate manually). The `dev_framework_*` custom *tools* above remain
|
|
50
|
+
available for in-agent use.
|
|
53
51
|
|
|
54
52
|
## Profiles
|
|
55
53
|
|
|
@@ -58,7 +56,18 @@ reimplemented as an OpenCode-native plugin.
|
|
|
58
56
|
| `off` | disabled | not reported | no | no | no | Plugin registers no hooks at all. |
|
|
59
57
|
| `advisory` | warn | warn | yes | warn only | warned, not blocked | Nothing blocks; everything is logged. |
|
|
60
58
|
| `standard` | deny | error | yes | deny edits | blocks completion | The default when a config file exists. |
|
|
61
|
-
| `strict` | deny | error | yes | deny edits | blocks completion | Also lints changed files in the gate
|
|
59
|
+
| `strict` | deny | error | yes | deny edits | blocks completion | Also lints changed files in the gate; per-edit lint failures are reported loudly (error level — the edit already landed, so nothing throws there). |
|
|
60
|
+
|
|
61
|
+
## Enforcement layers
|
|
62
|
+
|
|
63
|
+
How each mechanism is enforced on OpenCode `v2` (verified on `v2.0.26`):
|
|
64
|
+
|
|
65
|
+
| Mechanism | Primary layer | Backstop / fallback | Strength |
|
|
66
|
+
| --------- | ------------- | ------------------- | -------- |
|
|
67
|
+
| Pre-flight gate | `tool.execute.before` deny | — | **Hard block** on every build: the edit never lands. |
|
|
68
|
+
| Protected paths + dangerous commands | `tool.execute.before` deny/throw | `permission.evaluate` native layer (deny) | **Hard block** via the backstop; the native layer is defense-in-depth (the pipeline runs before-hooks first, so it only sees calls the backstop passed). |
|
|
69
|
+
| Per-edit lint | `tool.execute.after` track + lint | `filesystem.changed` event (this release) | Report-only: the edit already landed, so failures log loudly but never throw. |
|
|
70
|
+
| Completion gate | `session.idle` re-prompt via `session.prompt` | `session.stopping` hard-stop veto / `experimental.stopping` turn-continuation, if the core dispatches either | **Async, bounded** by `gate.max_blocks` (re-prompt, not a veto); hard stop / continuation only on builds with core support. `/df-status` shows which mode is active. |
|
|
62
71
|
|
|
63
72
|
## Install
|
|
64
73
|
|
|
@@ -66,7 +75,7 @@ reimplemented as an OpenCode-native plugin.
|
|
|
66
75
|
npm install opencode-dev-framework
|
|
67
76
|
```
|
|
68
77
|
|
|
69
|
-
Then add the plugin to your project's `opencode.
|
|
78
|
+
Then add the plugin to your project's `opencode.jsonc`:
|
|
70
79
|
|
|
71
80
|
```json
|
|
72
81
|
{
|
|
@@ -74,7 +83,7 @@ Then add the plugin to your project's `opencode.json`:
|
|
|
74
83
|
}
|
|
75
84
|
```
|
|
76
85
|
|
|
77
|
-
Requires OpenCode `v2.
|
|
86
|
+
Requires OpenCode `v2.x` (`@opencode/plugin` `^2`) — tested on `v2.0.26`. On `v1.18.18–1.18.31` use the `v1` branch
|
|
78
87
|
of this plugin (`plugin` key). The `./tui` companion (`/df-status` and `/df-help`
|
|
79
88
|
modals) is auto-discovered from the npm entry on `v2` — no separate `tui.json` needed.
|
|
80
89
|
|
|
@@ -97,22 +106,27 @@ profile from the shell; `df version` prints the plugin version.
|
|
|
97
106
|
## Local development and testing
|
|
98
107
|
|
|
99
108
|
To test the plugin from source without publishing to npm, point OpenCode at the
|
|
100
|
-
local repository path in your project's `opencode.
|
|
109
|
+
local repository path in your project's `opencode.jsonc` **and** in a `tui.json`.
|
|
101
110
|
The TUI module (`/df-status`, `/df-help` modals) is **not** auto-discovered for
|
|
102
111
|
local filesystem paths — it only loads when the package is listed in the TUI
|
|
103
112
|
config. OpenCode reads `tui.json` from the global config dir
|
|
104
113
|
(`~/.config/opencode/tui.json`) and the project dir (`.opencode/tui.json`).
|
|
105
114
|
|
|
106
|
-
`opencode.
|
|
115
|
+
`opencode.jsonc`:
|
|
107
116
|
|
|
108
117
|
```json
|
|
109
118
|
{
|
|
110
|
-
"plugins": ["/home/jerome/opencode-dev-framework"]
|
|
119
|
+
"plugins": [{ "package": "/home/jerome/opencode-dev-framework/dist" }]
|
|
111
120
|
}
|
|
112
121
|
```
|
|
113
122
|
|
|
114
|
-
The path must be the
|
|
115
|
-
|
|
123
|
+
The path must be the package's **`dist/` directory**, not the repository
|
|
124
|
+
root. Verified on OpenCode `v2.0.26`: for local directory entries the server
|
|
125
|
+
resolves the entrypoint as `<dir>/index.js` and ignores `package.json`
|
|
126
|
+
`main`, so a repo-root path fails silently with `Plugin entrypoint not
|
|
127
|
+
found` (visible only via `/plugins` or server logs) and no hook runs at
|
|
128
|
+
all. Rebuild after every source change (`npm run build`) since OpenCode
|
|
129
|
+
loads `dist/index.js` directly:
|
|
116
130
|
|
|
117
131
|
```bash
|
|
118
132
|
npm run build
|
|
@@ -120,10 +134,10 @@ npm run build
|
|
|
120
134
|
|
|
121
135
|
### Important caveats
|
|
122
136
|
|
|
123
|
-
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
137
|
+
- Plugin arrays **merge** across config files (global `opencode.jsonc`,
|
|
138
|
+
project `./opencode.jsonc`, `./.opencode/opencode.jsonc`), so a stale entry
|
|
139
|
+
in another file adds to — never replaces — the registration above. If a
|
|
140
|
+
session loads an unexpected plugin source, check all three locations.
|
|
127
141
|
- OpenCode caches downloaded plugins in
|
|
128
142
|
`~/.cache/opencode/packages/opencode-dev-framework*/`. If you previously
|
|
129
143
|
loaded a published version and then switch to a local source, clear that
|
|
@@ -200,14 +214,14 @@ They open instantly and **never** feed text back to the LLM:
|
|
|
200
214
|
- `/df-help` — lists the available dev-framework commands in a modal dialog.
|
|
201
215
|
- `/df-profile` — opens a profile picker (off / advisory / standard / strict) in
|
|
202
216
|
a modal dialog; selecting one switches the active profile immediately (written
|
|
203
|
-
to the config file).
|
|
204
|
-
|
|
217
|
+
to the config file). With an argument (`/df-profile standard`) it switches
|
|
218
|
+
directly with a toast instead of the picker.
|
|
205
219
|
- `/df-verify` — runs the configured verification suite (the completion gate)
|
|
206
220
|
manually and shows a pass/fail summary in a modal dialog.
|
|
207
221
|
|
|
208
222
|
You can still run `df init` to install the bundled agents, skills, and default
|
|
209
223
|
config; the commands themselves are provided by the plugin. The
|
|
210
|
-
`
|
|
224
|
+
`dev_framework_*` custom *tools* remain
|
|
211
225
|
available for in-agent use (e.g. when the model wants to change the profile
|
|
212
226
|
itself).
|
|
213
227
|
|
|
@@ -217,8 +231,9 @@ itself).
|
|
|
217
231
|
`session.stopping` veto (PR #44712 is open; the earlier PR #41811 was never merged),
|
|
218
232
|
so on failure inside `gate.max_blocks` the plugin re-prompts via
|
|
219
233
|
`ctx.session.prompt()` from the `session.idle` event. The plugin still registers the
|
|
220
|
-
`session.stopping` hook defensively
|
|
221
|
-
|
|
234
|
+
`session.stopping` hook defensively — and the V2 `experimental.stopping` hook
|
|
235
|
+
alongside it: on builds that dispatch either, the same verdict
|
|
236
|
+
vetoes loop exit / continues the turn before the agent stops. `/df-status` shows which
|
|
222
237
|
mode is active. Until then, the user can always close the session, so treat the gate
|
|
223
238
|
as the strongest available enforcement, not an unbreakable lock. The **pre-flight**
|
|
224
239
|
gate, by contrast, is a genuine hard block on every build: it denies edit tools in
|
|
@@ -250,6 +265,17 @@ For persistent debug traces, set `OPENCODE_DEV_FRAMEWORK_LOG_FILE`:
|
|
|
250
265
|
OPENCODE_DEV_FRAMEWORK_LOG_FILE=/tmp/odf.log opencode run
|
|
251
266
|
```
|
|
252
267
|
|
|
268
|
+
Plugin code runs in the `opencode serve` backend, not in your terminal
|
|
269
|
+
process — a variable exported only in the TUI shell never reaches it. For
|
|
270
|
+
full server logs plus the plugin trace, run a private server:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
OPENCODE_DEV_FRAMEWORK_LOG_FILE=/tmp/odf.log opencode run --standalone --print-logs
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
(There is no `cli.json` interaction: the plugin never reads or writes CLI
|
|
277
|
+
config; the flags above are stock OpenCode CLI options.)
|
|
278
|
+
|
|
253
279
|
See `AGENTS.md` and `docs/plans/` for the architecture and implementation
|
|
254
280
|
plan.
|
|
255
281
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent per-session completion-gate block counts.
|
|
3
|
+
*
|
|
4
|
+
* Counts live in `ctx.storage` (survives plugin reload / `session_move` /
|
|
5
|
+
* server restart) with a caller-provided `Map` as the write-through L1
|
|
6
|
+
* cache (keeps `/df-status` rendering and the synchronous status paths
|
|
7
|
+
* working off live data). Every storage call is best-effort: on failure the
|
|
8
|
+
* store falls back to memory, records `isDegraded()`, and never throws — so
|
|
9
|
+
* a broken storage backend degrades to pre-Phase-23 behavior instead of
|
|
10
|
+
* breaking the gate.
|
|
11
|
+
*
|
|
12
|
+
* Stored values are only block counts (`number`) and one stop-level flag
|
|
13
|
+
* (`"stopping"` for the legacy probe, `"experimental.stopping"` for the V2
|
|
14
|
+
* hook; pre-Phase-27 `true` reads back as the legacy level).
|
|
15
|
+
* Never store secrets, prompts, or file contents here.
|
|
16
|
+
*
|
|
17
|
+
* Key namespacing: counts are keyed `df:blocks:<sessionID>` (OpenCode
|
|
18
|
+
* session IDs are globally unique, so this is safe even if storage is
|
|
19
|
+
* shared across projects); the hard-stop probe flag is `df:stopSupported`.
|
|
20
|
+
*/
|
|
21
|
+
import type { Context } from "@opencode/plugin/promise/plugin";
|
|
22
|
+
/** Minimal storage surface we need (subset of `Context["storage"]`). */
|
|
23
|
+
export type StorageLike = Pick<Context["storage"], "get" | "set" | "remove">;
|
|
24
|
+
export declare const BLOCK_COUNT_KEY_PREFIX = "df:blocks:";
|
|
25
|
+
export declare const STOP_SUPPORTED_KEY = "df:stopSupported";
|
|
26
|
+
/**
|
|
27
|
+
* Which pre-terminal hook fired. `stopping` is the legacy V1-shape probe
|
|
28
|
+
* (PR #44712); `experimental.stopping` is the V2 contract (single mutable
|
|
29
|
+
* event, `decision` grant). The new hook outranks the old: once it has
|
|
30
|
+
* fired, the level never downgrades back to the legacy probe.
|
|
31
|
+
*/
|
|
32
|
+
export type StopHookKind = "stopping" | "experimental.stopping";
|
|
33
|
+
export interface BlockStore {
|
|
34
|
+
get(sessionID: string): Promise<number>;
|
|
35
|
+
/** Read, add one, persist, and return the new count. */
|
|
36
|
+
increment(sessionID: string): Promise<number>;
|
|
37
|
+
clear(sessionID: string): Promise<void>;
|
|
38
|
+
/** Live entries (mirrors the L1 map; used by tests). */
|
|
39
|
+
readonly size: number;
|
|
40
|
+
getStopSupported(): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Record that a stopping hook fired. Defaults to the legacy `stopping`
|
|
43
|
+
* probe (preserves pre-Phase-27 call sites); pass
|
|
44
|
+
* `"experimental.stopping"` for the V2 hook. Monotonic: a stored new-hook
|
|
45
|
+
* level is never downgraded by a later legacy-probe call.
|
|
46
|
+
*/
|
|
47
|
+
setStopSupported(kind?: StopHookKind): Promise<void>;
|
|
48
|
+
/** Which hook fired, or null when neither has (legacy `true` reads as the old probe). */
|
|
49
|
+
getStopKind(): Promise<StopHookKind | null>;
|
|
50
|
+
/** True once any storage call has failed (in-memory fallback in use). */
|
|
51
|
+
isDegraded(): boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare function createBlockStore(storage: StorageLike | undefined | null, memory?: Map<string, number>): BlockStore;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent per-session completion-gate block counts.
|
|
3
|
+
*
|
|
4
|
+
* Counts live in `ctx.storage` (survives plugin reload / `session_move` /
|
|
5
|
+
* server restart) with a caller-provided `Map` as the write-through L1
|
|
6
|
+
* cache (keeps `/df-status` rendering and the synchronous status paths
|
|
7
|
+
* working off live data). Every storage call is best-effort: on failure the
|
|
8
|
+
* store falls back to memory, records `isDegraded()`, and never throws — so
|
|
9
|
+
* a broken storage backend degrades to pre-Phase-23 behavior instead of
|
|
10
|
+
* breaking the gate.
|
|
11
|
+
*
|
|
12
|
+
* Stored values are only block counts (`number`) and one stop-level flag
|
|
13
|
+
* (`"stopping"` for the legacy probe, `"experimental.stopping"` for the V2
|
|
14
|
+
* hook; pre-Phase-27 `true` reads back as the legacy level).
|
|
15
|
+
* Never store secrets, prompts, or file contents here.
|
|
16
|
+
*
|
|
17
|
+
* Key namespacing: counts are keyed `df:blocks:<sessionID>` (OpenCode
|
|
18
|
+
* session IDs are globally unique, so this is safe even if storage is
|
|
19
|
+
* shared across projects); the hard-stop probe flag is `df:stopSupported`.
|
|
20
|
+
*/
|
|
21
|
+
export const BLOCK_COUNT_KEY_PREFIX = "df:blocks:";
|
|
22
|
+
export const STOP_SUPPORTED_KEY = "df:stopSupported";
|
|
23
|
+
function blockKey(sessionID) {
|
|
24
|
+
return `${BLOCK_COUNT_KEY_PREFIX}${sessionID}`;
|
|
25
|
+
}
|
|
26
|
+
function asStopKind(value) {
|
|
27
|
+
if (value === "experimental.stopping")
|
|
28
|
+
return "experimental.stopping";
|
|
29
|
+
// Legacy boolean flag (pre-Phase-27) means the old probe fired.
|
|
30
|
+
if (value === true || value === "stopping")
|
|
31
|
+
return "stopping";
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
function stopKindRank(kind) {
|
|
35
|
+
return kind === "experimental.stopping" ? 1 : 0;
|
|
36
|
+
}
|
|
37
|
+
/** Monotonic max: a third hook level later only touches this function. */
|
|
38
|
+
function maxStopKind(current, next) {
|
|
39
|
+
if (current === null)
|
|
40
|
+
return next;
|
|
41
|
+
if (next === null)
|
|
42
|
+
return current;
|
|
43
|
+
return stopKindRank(next) > stopKindRank(current) ? next : current;
|
|
44
|
+
}
|
|
45
|
+
/** Accept only sane counts; anything else (foreign/corrupt value) is treated as missing. */
|
|
46
|
+
function asCount(value) {
|
|
47
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
return Math.floor(value);
|
|
50
|
+
}
|
|
51
|
+
export function createBlockStore(storage, memory) {
|
|
52
|
+
const counts = memory ?? new Map();
|
|
53
|
+
let stopMemory = null;
|
|
54
|
+
let degraded = false;
|
|
55
|
+
async function readCount(sessionID) {
|
|
56
|
+
if (storage == null)
|
|
57
|
+
return counts.get(sessionID) ?? 0;
|
|
58
|
+
try {
|
|
59
|
+
const stored = asCount(await storage.get(blockKey(sessionID)));
|
|
60
|
+
if (stored !== undefined) {
|
|
61
|
+
counts.set(sessionID, stored);
|
|
62
|
+
return stored;
|
|
63
|
+
}
|
|
64
|
+
return counts.get(sessionID) ?? 0;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
degraded = true;
|
|
68
|
+
return counts.get(sessionID) ?? 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function readStopKind() {
|
|
72
|
+
// Single read-through: memory holds a level, but storage may hold a
|
|
73
|
+
// higher one written by a newer setup sharing the backend — take the max.
|
|
74
|
+
if (storage != null) {
|
|
75
|
+
try {
|
|
76
|
+
stopMemory = maxStopKind(stopMemory, asStopKind(await storage.get(STOP_SUPPORTED_KEY)));
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
degraded = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return stopMemory;
|
|
83
|
+
}
|
|
84
|
+
async function writeCount(sessionID, count) {
|
|
85
|
+
counts.set(sessionID, count);
|
|
86
|
+
if (storage == null)
|
|
87
|
+
return;
|
|
88
|
+
try {
|
|
89
|
+
await storage.set(blockKey(sessionID), count);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
degraded = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
get(sessionID) {
|
|
97
|
+
return readCount(sessionID);
|
|
98
|
+
},
|
|
99
|
+
async increment(sessionID) {
|
|
100
|
+
const next = (await readCount(sessionID)) + 1;
|
|
101
|
+
await writeCount(sessionID, next);
|
|
102
|
+
return next;
|
|
103
|
+
},
|
|
104
|
+
async clear(sessionID) {
|
|
105
|
+
counts.delete(sessionID);
|
|
106
|
+
if (storage == null)
|
|
107
|
+
return;
|
|
108
|
+
try {
|
|
109
|
+
await storage.remove(blockKey(sessionID));
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
degraded = true;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
get size() {
|
|
116
|
+
return counts.size;
|
|
117
|
+
},
|
|
118
|
+
async getStopSupported() {
|
|
119
|
+
return (await readStopKind()) !== null;
|
|
120
|
+
},
|
|
121
|
+
getStopKind() {
|
|
122
|
+
return readStopKind();
|
|
123
|
+
},
|
|
124
|
+
async setStopSupported(kind = "stopping") {
|
|
125
|
+
// Monotonic: never downgrade a recorded new-hook level. The storage
|
|
126
|
+
// read is required, not redundant — without it a fresh process would
|
|
127
|
+
// blind-write its own (possibly lower) level over a stored higher one.
|
|
128
|
+
stopMemory = maxStopKind(stopMemory, kind) ?? kind;
|
|
129
|
+
if (storage == null)
|
|
130
|
+
return;
|
|
131
|
+
try {
|
|
132
|
+
const next = maxStopKind(asStopKind(await storage.get(STOP_SUPPORTED_KEY)), stopMemory) ?? kind;
|
|
133
|
+
stopMemory = next;
|
|
134
|
+
await storage.set(STOP_SUPPORTED_KEY, next);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
degraded = true;
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
isDegraded() {
|
|
141
|
+
return degraded;
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
package/dist/format-status.js
CHANGED
|
@@ -122,8 +122,20 @@ export function renderHelp() {
|
|
|
122
122
|
export function renderStatus(config, state) {
|
|
123
123
|
const lines = [renderConfigStatus(config)];
|
|
124
124
|
if (state) {
|
|
125
|
+
// Enforcement level: none (no live state — config-only rendering) →
|
|
126
|
+
// idle-fallback (no hook dispatched yet) → legacy `stopping` probe →
|
|
127
|
+
// V2 `experimental.stopping` hook. The kind is monotonic: once the new
|
|
128
|
+
// hook has fired, a late legacy dispatch never downgrades the level.
|
|
125
129
|
lines.push("");
|
|
126
|
-
|
|
130
|
+
if (!state.stopHookSupported) {
|
|
131
|
+
lines.push(`Hard stop (stopping / experimental.stopping): not dispatched by this OpenCode build — idle re-prompt fallback`);
|
|
132
|
+
}
|
|
133
|
+
else if (state.stopHookKind === "experimental.stopping") {
|
|
134
|
+
lines.push(`Hard stop (experimental.stopping): active — gate failures continue the turn with steer text`);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
lines.push(`Hard stop (stopping): active — gate vetoes loop exit (legacy probe)`);
|
|
138
|
+
}
|
|
127
139
|
if (config.precommit === "auto") {
|
|
128
140
|
lines.push(` pre-commit binary available: ${state.precommitAvailable === true ? "yes" : state.precommitAvailable === false ? "no" : "not checked yet"}`);
|
|
129
141
|
}
|
package/dist/gate.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare const DEFAULT_GATE_TIMEOUT_SECONDS = 300;
|
|
|
15
15
|
/** Tracks files edited during a session so the gate can scope work. */
|
|
16
16
|
export interface ChangedFileTracker {
|
|
17
17
|
add: (filePath: string, directory?: string) => void;
|
|
18
|
+
/** True when the (normalized) path is already tracked. */
|
|
19
|
+
has: (filePath: string, directory?: string) => boolean;
|
|
18
20
|
getChangedFiles: () => string[];
|
|
19
21
|
clearChangedFiles: () => void;
|
|
20
22
|
}
|
package/dist/gate.js
CHANGED
|
@@ -13,6 +13,13 @@ import { splitCommand } from "./command-utils.js";
|
|
|
13
13
|
import { lintFile } from "./lint.js";
|
|
14
14
|
/** Fallback per-command timeout (seconds) when `gate.timeout` is unset. */
|
|
15
15
|
export const DEFAULT_GATE_TIMEOUT_SECONDS = 300;
|
|
16
|
+
function normalizeTrackedPath(filePath, directory) {
|
|
17
|
+
let candidate = filePath;
|
|
18
|
+
if (directory !== undefined && isAbsolute(filePath)) {
|
|
19
|
+
candidate = relative(directory, filePath);
|
|
20
|
+
}
|
|
21
|
+
return candidate.replace(/^\.\//, "");
|
|
22
|
+
}
|
|
16
23
|
/**
|
|
17
24
|
* Create a changed-file tracker. Paths are deduplicated and stored relative
|
|
18
25
|
* to the project directory when one is provided.
|
|
@@ -21,11 +28,10 @@ export function createChangedFileTracker() {
|
|
|
21
28
|
const files = new Set();
|
|
22
29
|
return {
|
|
23
30
|
add(filePath, directory) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
files.add(candidate.replace(/^\.\//, ""));
|
|
31
|
+
files.add(normalizeTrackedPath(filePath, directory));
|
|
32
|
+
},
|
|
33
|
+
has(filePath, directory) {
|
|
34
|
+
return files.has(normalizeTrackedPath(filePath, directory));
|
|
29
35
|
},
|
|
30
36
|
getChangedFiles() {
|
|
31
37
|
return [...files];
|
package/dist/harness.d.ts
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* when the OpenCode build supports it) and the `session.idle` fallback
|
|
19
19
|
* (re-prompt).
|
|
20
20
|
*/
|
|
21
|
+
import type { BlockStore } from "./block-store.js";
|
|
21
22
|
import { type ChangedFileTracker } from "./gate.js";
|
|
22
23
|
import type { RunCommand } from "./host.js";
|
|
23
24
|
import type { LogFn } from "./logger.js";
|
|
@@ -78,7 +79,7 @@ export interface CompletionDeps {
|
|
|
78
79
|
directory: string;
|
|
79
80
|
sessionID: string;
|
|
80
81
|
tracker: ChangedFileTracker;
|
|
81
|
-
blockCounts:
|
|
82
|
+
blockCounts: BlockStore;
|
|
82
83
|
log: LogFn;
|
|
83
84
|
}
|
|
84
85
|
/**
|
package/dist/harness.js
CHANGED
|
@@ -150,7 +150,7 @@ export async function evaluateCompletion(deps) {
|
|
|
150
150
|
const reviewMissing = reviewRequired && reviewState !== "present";
|
|
151
151
|
if (!gateFailed && !reviewMissing) {
|
|
152
152
|
tracker.clearChangedFiles();
|
|
153
|
-
blockCounts.
|
|
153
|
+
await blockCounts.clear(sessionID);
|
|
154
154
|
return {
|
|
155
155
|
decision: "pass",
|
|
156
156
|
changedFiles,
|
|
@@ -170,17 +170,16 @@ export async function evaluateCompletion(deps) {
|
|
|
170
170
|
const reason = gateFailed ? "gate" : "review";
|
|
171
171
|
const summary = gateFailed ? summarizeGate(report) : reviewMissingMessage(changedFiles);
|
|
172
172
|
const maxBlocks = config.gate.max_blocks ?? 3;
|
|
173
|
-
const blockCount =
|
|
173
|
+
const blockCount = await blockCounts.increment(sessionID);
|
|
174
174
|
if (blockCount > maxBlocks) {
|
|
175
175
|
tracker.clearChangedFiles();
|
|
176
|
-
blockCounts.
|
|
176
|
+
await blockCounts.clear(sessionID);
|
|
177
177
|
const standdownSummary = `opencode-dev-framework completion gate has blocked ${maxBlocks} times and is standing ` +
|
|
178
178
|
`down to avoid trapping you. The requirement is STILL unmet:\n\n${summary}\n\n` +
|
|
179
179
|
`Do not claim the work is complete. Tell the user plainly what remains unmet and why.`;
|
|
180
180
|
await deps.log("error", standdownSummary, { reason, sessionID });
|
|
181
181
|
return { decision: "standdown", reason, summary: standdownSummary, changedFiles };
|
|
182
182
|
}
|
|
183
|
-
blockCounts.set(sessionID, blockCount);
|
|
184
183
|
await deps.log("error", summary, { reason, sessionID, blockCount, maxBlocks });
|
|
185
184
|
return {
|
|
186
185
|
decision: "blocked",
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* opencode-dev-framework V2 plugin entry point.
|
|
3
3
|
*
|
|
4
4
|
* V2 framework (opencode v2): Plugin.define({ id, setup(ctx) })
|
|
5
|
-
* - ctx.session.hook("context", ...) -> constitution injection
|
|
6
|
-
* - ctx.
|
|
5
|
+
* - ctx.session.hook("context"/"generate"/"compaction"/"title", ...) -> constitution injection
|
|
6
|
+
* - ctx.permission.hook("evaluate", ...) -> native permission layer (Phase 25;
|
|
7
|
+
* observe-only spike in 25.1, enforcing mapper from 25.2)
|
|
8
|
+
* - ctx.tool.hook("execute.before", ...) -> guardrails (backstop from Phase 25)
|
|
9
|
+
* - ctx.tool.hook("execute.after", ...) -> per-edit lint + change tracking
|
|
10
|
+
* (`filesystem.changed` stays as a fallback this release; see Phase 24)
|
|
7
11
|
* - ctx.event.subscribe() -> file tracking + gate enforcement via re-prompt
|
|
8
12
|
* - ctx.tool.transform(...) -> custom tools
|
|
9
|
-
* - ctx.command.transform(...) -> slash commands (optional)
|
|
10
13
|
*
|
|
11
14
|
* Gate enforcement: no synchronous `session.stopping`. On `session.idle`
|
|
12
15
|
* / `session.status:idle` we run the gate and if it fails inside budget we
|
|
@@ -14,6 +17,7 @@
|
|
|
14
17
|
* agent — async re-injection preserving the enforcement intent (see docs/plans/08-notes).
|
|
15
18
|
*/
|
|
16
19
|
import { Plugin } from "@opencode/plugin";
|
|
20
|
+
import { type BlockStore, type StopHookKind } from "./block-store.js";
|
|
17
21
|
import { type ChangedFileTracker } from "./gate.js";
|
|
18
22
|
import { type RunCommand } from "./host.js";
|
|
19
23
|
import { type LogFn } from "./logger.js";
|
|
@@ -26,14 +30,28 @@ export interface HookState {
|
|
|
26
30
|
tracker: ChangedFileTracker;
|
|
27
31
|
constitution: string | null;
|
|
28
32
|
blockCounts: Map<string, number>;
|
|
33
|
+
/**
|
|
34
|
+
* Persistent block-count store over `ctx.storage`, write-through into
|
|
35
|
+
* `blockCounts` (which stays the live L1 cache for status rendering).
|
|
36
|
+
* Survives plugin reload / session_move / server restart.
|
|
37
|
+
* Note: this `HookState` is intentionally forked from `registry.ts`
|
|
38
|
+
* `HookState` (module state is per-location here, not registry-keyed);
|
|
39
|
+
* `format-status.ts` reads the `blockCounts` Map projection, which the
|
|
40
|
+
* store keeps live on every get/increment/clear.
|
|
41
|
+
*/
|
|
42
|
+
blocks: BlockStore;
|
|
29
43
|
precommitAvailable?: boolean;
|
|
30
44
|
configMtime?: number;
|
|
31
45
|
/**
|
|
32
|
-
* Set once
|
|
33
|
-
*
|
|
34
|
-
*
|
|
46
|
+
* Set once a stopping hook has actually been invoked by core — i.e. this
|
|
47
|
+
* OpenCode build supports pre-break gate vetoes (hard stops). Until then
|
|
48
|
+
* the idle re-prompt fallback is the only post-flight lever.
|
|
49
|
+
* `stopHookKind` records WHICH hook fired (`stopping` legacy probe vs
|
|
50
|
+
* `experimental.stopping` V2 contract); the new hook outranks the old and
|
|
51
|
+
* the level never downgrades. `/df-status` renders the active level.
|
|
35
52
|
*/
|
|
36
53
|
stopHookSupported?: boolean;
|
|
54
|
+
stopHookKind?: StopHookKind;
|
|
37
55
|
}
|
|
38
56
|
declare const plugin: Plugin.Plugin;
|
|
39
57
|
export default plugin;
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* opencode-dev-framework V2 plugin entry point.
|
|
3
3
|
*
|
|
4
4
|
* V2 framework (opencode v2): Plugin.define({ id, setup(ctx) })
|
|
5
|
-
* - ctx.session.hook("context", ...) -> constitution injection
|
|
6
|
-
* - ctx.
|
|
5
|
+
* - ctx.session.hook("context"/"generate"/"compaction"/"title", ...) -> constitution injection
|
|
6
|
+
* - ctx.permission.hook("evaluate", ...) -> native permission layer (Phase 25;
|
|
7
|
+
* observe-only spike in 25.1, enforcing mapper from 25.2)
|
|
8
|
+
* - ctx.tool.hook("execute.before", ...) -> guardrails (backstop from Phase 25)
|
|
9
|
+
* - ctx.tool.hook("execute.after", ...) -> per-edit lint + change tracking
|
|
10
|
+
* (`filesystem.changed` stays as a fallback this release; see Phase 24)
|
|
7
11
|
* - ctx.event.subscribe() -> file tracking + gate enforcement via re-prompt
|
|
8
12
|
* - ctx.tool.transform(...) -> custom tools
|
|
9
|
-
* - ctx.command.transform(...) -> slash commands (optional)
|
|
10
13
|
*
|
|
11
14
|
* Gate enforcement: no synchronous `session.stopping`. On `session.idle`
|
|
12
15
|
* / `session.status:idle` we run the gate and if it fails inside budget we
|
|
@@ -16,13 +19,14 @@
|
|
|
16
19
|
import { Plugin } from "@opencode/plugin";
|
|
17
20
|
import { stat } from "node:fs/promises";
|
|
18
21
|
import { join } from "node:path";
|
|
22
|
+
import { createBlockStore } from "./block-store.js";
|
|
19
23
|
import { clearConfigCache, loadConfig } from "./config.js";
|
|
20
24
|
import { createChangedFileTracker } from "./gate.js";
|
|
21
25
|
import { artifactState, evaluateCompletion, PREFLIGHT_ARTIFACT_REL, preflightBlockReason, } from "./harness.js";
|
|
22
26
|
import { runCommand } from "./host.js";
|
|
23
27
|
import { lintFile, detectPreCommitAvailability, isLintFailure, summarizeLint } from "./lint.js";
|
|
24
28
|
import { createLogger } from "./logger.js";
|
|
25
|
-
import { checkToolCall, extractFilePath } from "./protect.js";
|
|
29
|
+
import { checkToolCall, extractFilePath, FILE_TOOLS, toPermissionGuard } from "./protect.js";
|
|
26
30
|
import { loadConstitution } from "./rules.js";
|
|
27
31
|
let activeState = null;
|
|
28
32
|
let fallbackLog = async () => { };
|
|
@@ -67,9 +71,10 @@ async function reloadConfigIfChanged(state) {
|
|
|
67
71
|
}
|
|
68
72
|
/**
|
|
69
73
|
* Turn a completion verdict into the continuation message fed back to the
|
|
70
|
-
* agent when blocked. Shared by the `session.stopping` hard-stop path
|
|
71
|
-
*
|
|
72
|
-
*
|
|
74
|
+
* agent when blocked. Shared by the `session.stopping` hard-stop path, the
|
|
75
|
+
* `experimental.stopping` continuation vote, and the `session.idle`
|
|
76
|
+
* re-prompt fallback so wording (and block counting) is identical on every
|
|
77
|
+
* core support level.
|
|
73
78
|
*/
|
|
74
79
|
function continuationMessage(verdict) {
|
|
75
80
|
const why = verdict.reason === "review"
|
|
@@ -95,6 +100,41 @@ async function actOnVerdict(state, verdict) {
|
|
|
95
100
|
}
|
|
96
101
|
return continuationMessage(verdict);
|
|
97
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Per-edit lint flow, shared by the `execute.after` hook (primary) and the
|
|
105
|
+
* `filesystem.changed` fallback. Skipped files log at debug; passes at info;
|
|
106
|
+
* failures log loudly at error (the edit already landed, so unlike
|
|
107
|
+
* `execute.before` this never throws — it only reports).
|
|
108
|
+
*/
|
|
109
|
+
async function runPerEditLint(state, filePath) {
|
|
110
|
+
if (!state.config.on_edit.lint)
|
|
111
|
+
return;
|
|
112
|
+
if (state.config.precommit === "auto" && state.precommitAvailable === undefined) {
|
|
113
|
+
state.precommitAvailable = await detectPreCommitAvailability(state.run, state.directory);
|
|
114
|
+
}
|
|
115
|
+
const outcome = await lintFile(state.run, state.config, filePath, {
|
|
116
|
+
cwd: state.directory,
|
|
117
|
+
timeout: state.config.gate?.timeout,
|
|
118
|
+
precommitAvailable: state.precommitAvailable,
|
|
119
|
+
});
|
|
120
|
+
if (outcome.skipped) {
|
|
121
|
+
await safeLog(state, "debug", summarizeLint(outcome), {
|
|
122
|
+
filePath,
|
|
123
|
+
reason: outcome.reason,
|
|
124
|
+
});
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!isLintFailure(outcome)) {
|
|
128
|
+
await safeLog(state, "info", summarizeLint(outcome), { filePath });
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
await safeLog(state, "error", summarizeLint(outcome), {
|
|
132
|
+
filePath,
|
|
133
|
+
command: outcome.command?.join(" "),
|
|
134
|
+
stdout: outcome.result?.stdout,
|
|
135
|
+
stderr: outcome.result?.stderr,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
98
138
|
/** Assemble the completion verdict with the state's live dependencies. */
|
|
99
139
|
function runCompletion(state, sessionID) {
|
|
100
140
|
return evaluateCompletion({
|
|
@@ -103,10 +143,23 @@ function runCompletion(state, sessionID) {
|
|
|
103
143
|
directory: state.directory,
|
|
104
144
|
sessionID,
|
|
105
145
|
tracker: state.tracker,
|
|
106
|
-
blockCounts: state.
|
|
146
|
+
blockCounts: state.blocks,
|
|
107
147
|
log: (level, message, extra) => safeLog(state, level, message, extra),
|
|
108
148
|
});
|
|
109
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Record that a stopping hook fired at `kind`. Monotonic: the V2
|
|
152
|
+
* `experimental.stopping` level outranks the legacy `stopping` probe, so a
|
|
153
|
+
* late legacy dispatch never downgrades an already-recorded new-hook level
|
|
154
|
+
* (both the in-memory flag and the persisted store upgrade only).
|
|
155
|
+
*/
|
|
156
|
+
async function recordStopLevel(state, kind) {
|
|
157
|
+
if (state.stopHookKind !== "experimental.stopping") {
|
|
158
|
+
state.stopHookKind = kind;
|
|
159
|
+
}
|
|
160
|
+
state.stopHookSupported = true;
|
|
161
|
+
await state.blocks.setStopSupported(kind);
|
|
162
|
+
}
|
|
110
163
|
// Helpers to normalize V2 event shapes (data vs properties vs direct)
|
|
111
164
|
function getEventSessionID(event) {
|
|
112
165
|
const e = event;
|
|
@@ -194,6 +247,8 @@ const plugin = Plugin.define({
|
|
|
194
247
|
}
|
|
195
248
|
}
|
|
196
249
|
const tracker = createChangedFileTracker();
|
|
250
|
+
const blockCounts = new Map();
|
|
251
|
+
const blocks = createBlockStore(ctx.storage, blockCounts);
|
|
197
252
|
const state = {
|
|
198
253
|
directory,
|
|
199
254
|
config,
|
|
@@ -201,10 +256,20 @@ const plugin = Plugin.define({
|
|
|
201
256
|
run: runCommand,
|
|
202
257
|
tracker,
|
|
203
258
|
constitution,
|
|
204
|
-
blockCounts
|
|
259
|
+
blockCounts,
|
|
260
|
+
blocks,
|
|
205
261
|
configMtime,
|
|
206
262
|
};
|
|
207
263
|
activeState = state;
|
|
264
|
+
// Hydrate the hard-stop probe level: a previous setup may have seen core
|
|
265
|
+
// dispatch `stopping` or `experimental.stopping`. A storage failure
|
|
266
|
+
// degrades to in-memory counts (pre-Phase-23 behavior) and is logged,
|
|
267
|
+
// never thrown.
|
|
268
|
+
state.stopHookKind = (await blocks.getStopKind()) ?? undefined;
|
|
269
|
+
state.stopHookSupported = state.stopHookKind !== undefined;
|
|
270
|
+
if (blocks.isDegraded()) {
|
|
271
|
+
await log("warn", "ctx.storage is unavailable; gate block counts are in-memory only and reset on reload", { directory });
|
|
272
|
+
}
|
|
208
273
|
const registrations = [];
|
|
209
274
|
function trackRegistration(value) {
|
|
210
275
|
if (value !== null &&
|
|
@@ -223,41 +288,40 @@ const plugin = Plugin.define({
|
|
|
223
288
|
// an in-flight handler between awaits (captured `state` stays valid
|
|
224
289
|
// while the global may be cleared). See issue #1 follow-up.
|
|
225
290
|
// 1) Constitution injection — per model request (V1: experimental.chat.system.transform -> V2: session.hook("context", ...))
|
|
226
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
227
291
|
trackRegistration(await ctx.session.hook("context", async (event) => {
|
|
228
292
|
if (activeState !== state)
|
|
229
293
|
return;
|
|
230
294
|
await reloadConfigIfChanged(state);
|
|
231
295
|
if (state.config.profile === "off")
|
|
232
296
|
return;
|
|
233
|
-
|
|
297
|
+
const constitution = state.constitution;
|
|
298
|
+
if (!constitution)
|
|
234
299
|
return;
|
|
235
300
|
// V2 system is Array<SystemPart> {type:"text", text:string}
|
|
236
|
-
const already = event.system.some((part) => part.text.includes(
|
|
301
|
+
const already = event.system.some((part) => part.text.includes(constitution));
|
|
237
302
|
if (already)
|
|
238
303
|
return;
|
|
239
304
|
event.system.push({
|
|
240
305
|
type: "text",
|
|
241
|
-
text:
|
|
306
|
+
text: constitution,
|
|
242
307
|
});
|
|
243
308
|
await safeLog(state, "info", "constitution injected into system prompt");
|
|
244
309
|
}));
|
|
245
310
|
// Also hook other request kinds so the reminder is not missed on title/generate
|
|
246
311
|
// (no-op if model doesn't need it; cheap)
|
|
247
|
-
for (const kind of ["generate", "compaction"]) {
|
|
248
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
312
|
+
for (const kind of ["generate", "compaction", "title"]) {
|
|
249
313
|
trackRegistration(await ctx.session.hook(kind, async (event) => {
|
|
250
314
|
if (activeState !== state)
|
|
251
315
|
return;
|
|
252
|
-
|
|
316
|
+
const constitution = state.constitution;
|
|
317
|
+
if (state.config.profile === "off" || !constitution)
|
|
253
318
|
return;
|
|
254
|
-
// generate/compaction also have system — inject similarly if present
|
|
255
|
-
|
|
256
|
-
if (!ev.system)
|
|
319
|
+
// generate/compaction/title also have system — inject similarly if present
|
|
320
|
+
if (!event.system)
|
|
257
321
|
return;
|
|
258
|
-
const already =
|
|
322
|
+
const already = event.system.some((p) => p.text.includes(constitution));
|
|
259
323
|
if (!already)
|
|
260
|
-
|
|
324
|
+
event.system.push({ type: "text", text: constitution });
|
|
261
325
|
}));
|
|
262
326
|
}
|
|
263
327
|
// 1b) Hard-stop completion gate — `session.stopping` (OpenCode PR #44712).
|
|
@@ -268,9 +332,14 @@ const plugin = Plugin.define({
|
|
|
268
332
|
// session.idle fallback below provides re-prompt enforcement instead.
|
|
269
333
|
// The first invocation flips `stopHookSupported` so /df-status can show
|
|
270
334
|
// which enforcement level is active.
|
|
335
|
+
// DEFENSIVE: "stopping" is not in SessionHooks as of 2.0.x; fires only
|
|
336
|
+
// if a future core dispatches it (see PR #44712). One of two any-casts
|
|
337
|
+
// in src/ (this probe + the `experimental.stopping` probe in §1c) —
|
|
338
|
+
// all other hooks are fully typed so the compiler guards future SDK
|
|
339
|
+
// upgrades.
|
|
271
340
|
try {
|
|
272
341
|
trackRegistration(
|
|
273
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
342
|
+
// biome-ignore lint/suspicious/noExplicitAny: defensive stopping probe, not in SessionHooks (PR #44712)
|
|
274
343
|
await ctx.session.hook("stopping",
|
|
275
344
|
// biome-ignore lint/suspicious/noExplicitAny: core may dispatch (input, output) or a single mutable event
|
|
276
345
|
async (input, output) => {
|
|
@@ -281,7 +350,7 @@ const plugin = Plugin.define({
|
|
|
281
350
|
out.sessionID ??
|
|
282
351
|
getEventSessionID(input) ??
|
|
283
352
|
"unknown";
|
|
284
|
-
state
|
|
353
|
+
await recordStopLevel(state, "stopping");
|
|
285
354
|
await reloadConfigIfChanged(state);
|
|
286
355
|
if (state.config.profile === "off")
|
|
287
356
|
return;
|
|
@@ -297,6 +366,162 @@ const plugin = Plugin.define({
|
|
|
297
366
|
catch {
|
|
298
367
|
await safeLog(state, "warn", "could not register session.stopping hook; using session.idle re-prompt fallback only");
|
|
299
368
|
}
|
|
369
|
+
// 1c) V2 pre-terminal continuation vote — `experimental.stopping`.
|
|
370
|
+
// Same verdict mapping as §1b, in the new contract shape: gate fail →
|
|
371
|
+
// `decision = { shouldContinue: true, text: message }` (core admits it
|
|
372
|
+
// as a synthetic steer and continues the turn); gate pass/stand-down →
|
|
373
|
+
// leave the fail-closed default (abstain). Registered ALONGSIDE the
|
|
374
|
+
// legacy probe, not replacing it — the same dist keeps working on
|
|
375
|
+
// mainline builds that lack the new core. No provider scoping: the
|
|
376
|
+
// event carries no model, so a providerID option would never fire.
|
|
377
|
+
// `event.continuations` is the pre-increment grant count (core caps at
|
|
378
|
+
// 2 and goes silent past it without calling voters); local policy stays
|
|
379
|
+
// tighter-or-equal via the verdict runner's own max_blocks/stand-down,
|
|
380
|
+
// never fighting the core cap — expect silence after 2 grants.
|
|
381
|
+
// DEFENSIVE: "experimental.stopping" is not in SessionHooks on released
|
|
382
|
+
// cores; fires only on builds dispatching it. Same any-cast pattern as
|
|
383
|
+
// §1b (the only two in src/).
|
|
384
|
+
try {
|
|
385
|
+
trackRegistration(
|
|
386
|
+
// biome-ignore lint/suspicious/noExplicitAny: defensive stopping probe, not in SessionHooks on released cores
|
|
387
|
+
await ctx.session.hook("experimental.stopping",
|
|
388
|
+
// biome-ignore lint/suspicious/noExplicitAny: core dispatches a single mutable event
|
|
389
|
+
async (event) => {
|
|
390
|
+
if (activeState !== state)
|
|
391
|
+
return;
|
|
392
|
+
// Core always dispatches a single mutable event object; a
|
|
393
|
+
// non-object would leave the grant with nowhere to land, so bail
|
|
394
|
+
// (fail-closed is the core's job on malformed dispatch).
|
|
395
|
+
if (event === null || typeof event !== "object")
|
|
396
|
+
return;
|
|
397
|
+
const vote = event;
|
|
398
|
+
const sessionID = (typeof vote.sessionID === "string" && vote.sessionID) ||
|
|
399
|
+
getEventSessionID(event) ||
|
|
400
|
+
"unknown";
|
|
401
|
+
// Never let a voter failure escape into core: on any error
|
|
402
|
+
// abstain (leave the fail-closed default) instead of losing the
|
|
403
|
+
// turn to an undefined core reaction. A throwing voter stops the
|
|
404
|
+
// turn per the contract — that decision belongs to core, not to
|
|
405
|
+
// a logging or gate-backend failure inside this probe.
|
|
406
|
+
try {
|
|
407
|
+
await recordStopLevel(state, "experimental.stopping");
|
|
408
|
+
await reloadConfigIfChanged(state);
|
|
409
|
+
if (state.config.profile === "off")
|
|
410
|
+
return;
|
|
411
|
+
const verdict = await runCompletion(state, sessionID);
|
|
412
|
+
const message = await actOnVerdict(state, verdict);
|
|
413
|
+
await safeLog(state, "info", "experimental.stopping vote", {
|
|
414
|
+
sessionID,
|
|
415
|
+
step: vote.step,
|
|
416
|
+
continuations: vote.continuations,
|
|
417
|
+
decision: verdict.decision,
|
|
418
|
+
});
|
|
419
|
+
if (message !== null) {
|
|
420
|
+
event.decision = {
|
|
421
|
+
shouldContinue: true,
|
|
422
|
+
text: message,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
catch (error) {
|
|
427
|
+
try {
|
|
428
|
+
await safeLog(state, "warn", "experimental.stopping vote failed; abstaining", {
|
|
429
|
+
sessionID,
|
|
430
|
+
error: error instanceof Error ? error.message : String(error),
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
catch {
|
|
434
|
+
// best-effort only — the abstain itself must not throw
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}));
|
|
438
|
+
await safeLog(state, "info", "registered experimental.stopping hook; if this OpenCode build dispatches it, gate failures continue the turn with steer text");
|
|
439
|
+
}
|
|
440
|
+
catch {
|
|
441
|
+
await safeLog(state, "warn", "could not register experimental.stopping hook; legacy stopping probe and session.idle re-prompt remain");
|
|
442
|
+
}
|
|
443
|
+
// 2a) Native permission layer (Phase 25): `permission.evaluate` fires
|
|
444
|
+
// with `{action, resources, effect}` (shapes recorded in the 25.1 spike,
|
|
445
|
+
// docs/plans/08-notes.md — never guessed: action "edit" covers
|
|
446
|
+
// edit/write/patch with resources[0] = file path; action "shell" covers
|
|
447
|
+
// bash/shell with resources[0] = command).
|
|
448
|
+
// The mapper only ever denies or abstains (never allows), so it can
|
|
449
|
+
// never weaken host/engine enforcement. `execute.before` below stays as
|
|
450
|
+
// the backstop — and is the load-bearing layer: the firing investigation
|
|
451
|
+
// (08-notes) proved the pipeline runs before-hooks FIRST, so evaluate
|
|
452
|
+
// only ever sees calls the backstop already passed. The native layer is
|
|
453
|
+
// defense-in-depth (it still matters if core ever reorders the pipeline
|
|
454
|
+
// or adds paths bypassing tool hooks). Quiet paths log at debug — in
|
|
455
|
+
// particular advisory warns stay debug here because execute.before
|
|
456
|
+
// already warned for the same call.
|
|
457
|
+
try {
|
|
458
|
+
trackRegistration(await ctx.permission.hook("evaluate", async (event) => {
|
|
459
|
+
if (activeState !== state)
|
|
460
|
+
return;
|
|
461
|
+
await reloadConfigIfChanged(state);
|
|
462
|
+
if (state.config.profile === "off")
|
|
463
|
+
return;
|
|
464
|
+
const action = event.action;
|
|
465
|
+
const target = event.resources[0];
|
|
466
|
+
const baseExtra = {
|
|
467
|
+
action,
|
|
468
|
+
resources: [...event.resources],
|
|
469
|
+
sessionID: event.sessionID,
|
|
470
|
+
};
|
|
471
|
+
// Already denied by the host/engine: abstain so its verdict and
|
|
472
|
+
// message survive untouched (mirrors the backstop's hostDenies
|
|
473
|
+
// stand-down; the mapper must never overwrite a denial).
|
|
474
|
+
if (event.effect === "deny") {
|
|
475
|
+
await safeLog(state, "debug", `permission.evaluate action=${action} already denied; leaving host/engine verdict untouched`, { ...baseExtra, message: event.message });
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
// Pre-flight (mirrors execute.before; the artifact itself stays
|
|
479
|
+
// writable). Deny/warn per profile, exactly like the backstop.
|
|
480
|
+
if (state.config.preflight.length > 0 && action === "edit") {
|
|
481
|
+
const artifact = await artifactState(state.directory, PREFLIGHT_ARTIFACT_REL);
|
|
482
|
+
const reason = preflightBlockReason(state.config, "edit", target, artifact);
|
|
483
|
+
if (reason !== null) {
|
|
484
|
+
if (state.config.profile === "advisory") {
|
|
485
|
+
// Debug, not warn: execute.before runs first and already
|
|
486
|
+
// warned for this exact call (same double-noise rule as the
|
|
487
|
+
// guardrail warn path below).
|
|
488
|
+
await safeLog(state, "debug", reason, {
|
|
489
|
+
...baseExtra,
|
|
490
|
+
artifact: PREFLIGHT_ARTIFACT_REL,
|
|
491
|
+
});
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
event.effect = "deny";
|
|
495
|
+
event.message = reason;
|
|
496
|
+
await safeLog(state, "error", reason, {
|
|
497
|
+
...baseExtra,
|
|
498
|
+
artifact: PREFLIGHT_ARTIFACT_REL,
|
|
499
|
+
});
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
const verdict = toPermissionGuard(state.config, action, event.resources, state.directory);
|
|
504
|
+
if (verdict === null) {
|
|
505
|
+
await safeLog(state, "debug", `permission.evaluate action=${action} effect=${event.effect} (no guardrail verdict; engine default wins)`, { ...baseExtra, effect: event.effect });
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
const message = verdict.reason ?? "blocked by guardrails";
|
|
509
|
+
const extra = { ...baseExtra, pattern: verdict.matchedPattern };
|
|
510
|
+
if (verdict.decision === "warn") {
|
|
511
|
+
// Advisory: stay silent at warn level — `execute.before` runs
|
|
512
|
+
// first in the pipeline and already warned for this exact call.
|
|
513
|
+
// A debug trace keeps the layer observable without double noise.
|
|
514
|
+
await safeLog(state, "debug", message, extra);
|
|
515
|
+
return; // leave the engine verdict untouched
|
|
516
|
+
}
|
|
517
|
+
event.effect = "deny";
|
|
518
|
+
event.message = message;
|
|
519
|
+
await safeLog(state, "error", message, extra);
|
|
520
|
+
}));
|
|
521
|
+
}
|
|
522
|
+
catch {
|
|
523
|
+
await safeLog(state, "warn", "could not register permission.evaluate hook; guardrails use execute.before only");
|
|
524
|
+
}
|
|
300
525
|
// 2) Guardrails — tool execution blocking (V1: tool.execute.before -> V2: ctx.tool.hook("execute.before", ...))
|
|
301
526
|
// Stale-hook fail-open: the closure captures its own `state` and allows
|
|
302
527
|
// the call whenever it is no longer live — torn down (activeState null)
|
|
@@ -304,10 +529,9 @@ const plugin = Plugin.define({
|
|
|
304
529
|
// whose own hook enforces; this one must not double-enforce). Using the
|
|
305
530
|
// captured `state` throughout also closes the teardown race where the
|
|
306
531
|
// global is cleared between awaits. See issue #1.
|
|
307
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
308
532
|
trackRegistration(await ctx.tool.hook("execute.before", async (event) => {
|
|
309
533
|
if (activeState !== state) {
|
|
310
|
-
if (activeState
|
|
534
|
+
if (activeState === null) {
|
|
311
535
|
await safeLog(null, "warn", "[opencode-dev-framework] plugin state is not available; allowing tool call (fail-open after teardown)", { tool: event.tool });
|
|
312
536
|
}
|
|
313
537
|
return;
|
|
@@ -349,8 +573,31 @@ const plugin = Plugin.define({
|
|
|
349
573
|
await safeLog(state, "error", message, extra);
|
|
350
574
|
throw new Error(`[opencode-dev-framework] ${message}`);
|
|
351
575
|
}));
|
|
576
|
+
// 2b) Per-edit lint — `tool.execute.after` (primary; the
|
|
577
|
+
// `filesystem.changed` branch below stays as a fallback this release).
|
|
578
|
+
// Edit tools with `completed` status are tracked + linted via the shared
|
|
579
|
+
// flow; `error` status tracks without linting (the tool failed, so there
|
|
580
|
+
// is nothing reliable to lint); read-only tools never touch the tracker.
|
|
581
|
+
// The edit already landed, so this hook only reports — it never throws.
|
|
582
|
+
trackRegistration(await ctx.tool.hook("execute.after", async (event) => {
|
|
583
|
+
if (activeState !== state)
|
|
584
|
+
return;
|
|
585
|
+
await reloadConfigIfChanged(state);
|
|
586
|
+
if (state.config.profile === "off")
|
|
587
|
+
return;
|
|
588
|
+
const filePath = extractFilePath(event.input);
|
|
589
|
+
if (!filePath)
|
|
590
|
+
return;
|
|
591
|
+
if (!FILE_TOOLS.has(event.tool))
|
|
592
|
+
return;
|
|
593
|
+
state.tracker.add(filePath, state.directory);
|
|
594
|
+
if (event.status !== "completed") {
|
|
595
|
+
await safeLog(state, "debug", `tracked ${filePath} from failed ${event.tool} call (lint skipped)`, { tool: event.tool, sessionID: event.sessionID, filePath });
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
await runPerEditLint(state, filePath);
|
|
599
|
+
}));
|
|
352
600
|
// 3) Custom tools — V2: ctx.tool.transform(editor => editor.add(...))
|
|
353
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
354
601
|
trackRegistration(await ctx.tool.transform((editor) => {
|
|
355
602
|
editor.add({
|
|
356
603
|
name: "dev_framework_init",
|
|
@@ -441,6 +688,34 @@ const plugin = Plugin.define({
|
|
|
441
688
|
return { content: `${message} Change applied immediately.` };
|
|
442
689
|
},
|
|
443
690
|
});
|
|
691
|
+
editor.add({
|
|
692
|
+
name: "dev_framework_verify",
|
|
693
|
+
description: "Run the opencode-dev-framework completion gate now (typecheck, tests, changed-file lint) and return the summary. Use for a mid-session gate check without waiting for session idle; unlike the idle gate this never re-prompts, it only reports.",
|
|
694
|
+
input: {
|
|
695
|
+
type: "object",
|
|
696
|
+
properties: {
|
|
697
|
+
directory: {
|
|
698
|
+
type: "string",
|
|
699
|
+
description: "Project directory (defaults to current project)",
|
|
700
|
+
},
|
|
701
|
+
},
|
|
702
|
+
additionalProperties: false,
|
|
703
|
+
},
|
|
704
|
+
async execute(input) {
|
|
705
|
+
const { verifyGate } = await import("./commands.js");
|
|
706
|
+
const args = input;
|
|
707
|
+
const targetDir = args.directory ?? directory;
|
|
708
|
+
const live = activeState && activeState.directory === targetDir ? activeState : null;
|
|
709
|
+
const own = state.directory === targetDir ? state : null;
|
|
710
|
+
const holder = live ?? own;
|
|
711
|
+
// Live tracker's changed files beat the TUI's empty default: a
|
|
712
|
+
// mid-session verify scopes `changed` steps to real edits.
|
|
713
|
+
const cfg = holder?.config ?? loadConfig(targetDir);
|
|
714
|
+
const changed = holder ? holder.tracker.getChangedFiles() : [];
|
|
715
|
+
const { summary } = await verifyGate(state.run, targetDir, cfg, changed);
|
|
716
|
+
return { content: summary };
|
|
717
|
+
},
|
|
718
|
+
});
|
|
444
719
|
editor.add({
|
|
445
720
|
name: "dev_framework_status",
|
|
446
721
|
description: "Show the current opencode-dev-framework state for the project: active profile, guardrails, completion gate, on-edit behavior, tracked changed files, and block counts.",
|
|
@@ -482,10 +757,11 @@ const plugin = Plugin.define({
|
|
|
482
757
|
const event = rawEvent;
|
|
483
758
|
const type = event.type;
|
|
484
759
|
if (isSessionDeletedEvent(type)) {
|
|
485
|
-
// session.deleted: cleanup
|
|
760
|
+
// session.deleted: cleanup block counts (memory + storage) and
|
|
761
|
+
// forget the session's directory mapping if present.
|
|
486
762
|
const sid = getEventSessionID(event);
|
|
487
763
|
if (sid)
|
|
488
|
-
state.
|
|
764
|
+
await state.blocks.clear(sid);
|
|
489
765
|
continue;
|
|
490
766
|
}
|
|
491
767
|
if (isFilesystemChangedEvent(type)) {
|
|
@@ -497,40 +773,15 @@ const plugin = Plugin.define({
|
|
|
497
773
|
const filePath = getEventFilePath(event);
|
|
498
774
|
if (!filePath)
|
|
499
775
|
continue;
|
|
500
|
-
|
|
501
|
-
//
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
state.precommitAvailable = await detectPreCommitAvailability(state.run, state.directory);
|
|
506
|
-
}
|
|
507
|
-
const outcome = await lintFile(state.run, state.config, filePath, {
|
|
508
|
-
cwd: state.directory,
|
|
509
|
-
timeout: state.config.gate?.timeout,
|
|
510
|
-
precommitAvailable: state.precommitAvailable,
|
|
511
|
-
});
|
|
512
|
-
if (outcome.skipped) {
|
|
513
|
-
await safeLog(state, "debug", summarizeLint(outcome), {
|
|
514
|
-
filePath,
|
|
515
|
-
reason: outcome.reason,
|
|
516
|
-
});
|
|
517
|
-
continue;
|
|
518
|
-
}
|
|
519
|
-
if (!isLintFailure(outcome)) {
|
|
520
|
-
await safeLog(state, "info", summarizeLint(outcome), { filePath });
|
|
776
|
+
// Fallback path (primary is `execute.after` since Phase 24): the
|
|
777
|
+
// tracker is add-idempotent, so a file already seen via
|
|
778
|
+
// `execute.after` just logs at debug instead of linting twice.
|
|
779
|
+
if (state.tracker.has(filePath, state.directory)) {
|
|
780
|
+
await safeLog(state, "debug", `already tracked ${filePath} (skipping fallback lint; execute.after is primary)`, { filePath });
|
|
521
781
|
continue;
|
|
522
782
|
}
|
|
523
|
-
|
|
524
|
-
await
|
|
525
|
-
filePath,
|
|
526
|
-
command: outcome.command?.join(" "),
|
|
527
|
-
stdout: outcome.result?.stdout,
|
|
528
|
-
stderr: outcome.result?.stderr,
|
|
529
|
-
});
|
|
530
|
-
if (state.config.profile === "strict") {
|
|
531
|
-
// Event handlers cannot throw to block the edit (edit already happened), but we log loudly.
|
|
532
|
-
// In V2 we also have the tool hook to block before; this is advisory.
|
|
533
|
-
}
|
|
783
|
+
state.tracker.add(filePath, state.directory);
|
|
784
|
+
await runPerEditLint(state, filePath);
|
|
534
785
|
continue;
|
|
535
786
|
}
|
|
536
787
|
if (isIdleEvent(event)) {
|
package/dist/protect.d.ts
CHANGED
|
@@ -42,3 +42,19 @@ export declare function matchDangerousCommand(command: string): DangerousCommand
|
|
|
42
42
|
* matched. Otherwise returns `deny` or `warn` per `protect_mode`.
|
|
43
43
|
*/
|
|
44
44
|
export declare function checkToolCall(config: ResolvedConfig, tool: string, args: unknown, directory?: string, hostPermissions?: OpenCodePermission): GuardResult;
|
|
45
|
+
/**
|
|
46
|
+
* Phase 25: adapt a native `permission.evaluate` event to the guardrail
|
|
47
|
+
* verdict. Maps the observed engine shapes (spike 25.1, OpenCode v2.0.26 —
|
|
48
|
+
* recorded in docs/plans/08-notes.md, never guessed):
|
|
49
|
+
* - action `"edit"` (covers edit/write/patch tools) with `resources[0]` =
|
|
50
|
+
* the target file path (repo-relative).
|
|
51
|
+
* - action `"shell"` (covers bash/shell tools) with `resources[0]` = the
|
|
52
|
+
* shell command string.
|
|
53
|
+
*
|
|
54
|
+
* Returns the guardrail verdict (`deny`/`warn`) or `null` when the mapper
|
|
55
|
+
* abstains (unknown action, empty resources, protection off, or no match) —
|
|
56
|
+
* `null` leaves the engine verdict untouched so the engine default wins.
|
|
57
|
+
* Never returns `allow`: the mapper can only deny, warn, or abstain, so it
|
|
58
|
+
* can never weaken host/engine enforcement.
|
|
59
|
+
*/
|
|
60
|
+
export declare function toPermissionGuard(config: ResolvedConfig, action: string, resources: ReadonlyArray<string>, directory?: string): GuardResult | null;
|
package/dist/protect.js
CHANGED
|
@@ -157,3 +157,35 @@ export function checkToolCall(config, tool, args, directory, hostPermissions) {
|
|
|
157
157
|
}
|
|
158
158
|
return { decision: "allow" };
|
|
159
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Phase 25: adapt a native `permission.evaluate` event to the guardrail
|
|
162
|
+
* verdict. Maps the observed engine shapes (spike 25.1, OpenCode v2.0.26 —
|
|
163
|
+
* recorded in docs/plans/08-notes.md, never guessed):
|
|
164
|
+
* - action `"edit"` (covers edit/write/patch tools) with `resources[0]` =
|
|
165
|
+
* the target file path (repo-relative).
|
|
166
|
+
* - action `"shell"` (covers bash/shell tools) with `resources[0]` = the
|
|
167
|
+
* shell command string.
|
|
168
|
+
*
|
|
169
|
+
* Returns the guardrail verdict (`deny`/`warn`) or `null` when the mapper
|
|
170
|
+
* abstains (unknown action, empty resources, protection off, or no match) —
|
|
171
|
+
* `null` leaves the engine verdict untouched so the engine default wins.
|
|
172
|
+
* Never returns `allow`: the mapper can only deny, warn, or abstain, so it
|
|
173
|
+
* can never weaken host/engine enforcement.
|
|
174
|
+
*/
|
|
175
|
+
export function toPermissionGuard(config, action, resources, directory) {
|
|
176
|
+
if (config.profile === "off" || config.protect_off) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
if (resources.length === 0) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
if (action === "edit") {
|
|
183
|
+
const result = checkToolCall(config, "edit", { filePath: resources[0] }, directory, undefined);
|
|
184
|
+
return result.decision === "allow" ? null : result;
|
|
185
|
+
}
|
|
186
|
+
if (action === "shell") {
|
|
187
|
+
const result = checkToolCall(config, "bash", { command: resources[0] }, directory, undefined);
|
|
188
|
+
return result.decision === "allow" ? null : result;
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
package/dist/registry.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StopHookKind } from "./block-store.js";
|
|
1
2
|
import type { ChangedFileTracker } from "./gate.js";
|
|
2
3
|
import type { RunCommand } from "./host.js";
|
|
3
4
|
import type { LogFn } from "./logger.js";
|
|
@@ -32,8 +33,14 @@ export interface HookState {
|
|
|
32
33
|
/** mtime (ms) of the config file at last load; used to detect out-of-process
|
|
33
34
|
* edits (e.g. a `/df-profile` change made from the TUI module). */
|
|
34
35
|
configMtime?: number;
|
|
35
|
-
/** True once core has actually dispatched
|
|
36
|
+
/** True once core has actually dispatched a stopping hook (hard stops active). */
|
|
36
37
|
stopHookSupported?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Which hook fired: the legacy `stopping` probe or the V2
|
|
40
|
+
* `experimental.stopping` contract. The new hook outranks the old; absent
|
|
41
|
+
* until either fires (idle re-prompt fallback is the active level).
|
|
42
|
+
*/
|
|
43
|
+
stopHookKind?: StopHookKind;
|
|
37
44
|
}
|
|
38
45
|
export declare function setBaseDirectory(directory: string): void;
|
|
39
46
|
export declare function getBaseDirectory(): string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-dev-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "OpenCode plugin that enforces project-specific quality gates during AI coding sessions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
"guardrails"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@opencode/plugin": "^2.0.
|
|
59
|
+
"@opencode/plugin": "^2.0.26",
|
|
60
60
|
"picomatch": "^4.0.5",
|
|
61
61
|
"yaml": "^2.9.0",
|
|
62
62
|
"zod": "^4.4.3"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@biomejs/biome": "^2.5.8",
|
|
66
|
-
"@opentui/core": "^0.5.
|
|
67
|
-
"@opentui/keymap": "^0.5.
|
|
68
|
-
"@opentui/solid": "^0.5.
|
|
66
|
+
"@opentui/core": "^0.5.17",
|
|
67
|
+
"@opentui/keymap": "^0.5.17",
|
|
68
|
+
"@opentui/solid": "^0.5.17",
|
|
69
69
|
"@types/node": "^26.2.0",
|
|
70
70
|
"@types/picomatch": "^4.0.3",
|
|
71
71
|
"markdownlint-cli2": "^0.23.2",
|