@weave_protocol/adapter-opencode 0.1.0 → 0.2.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 +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -70,6 +70,10 @@ weave-ward-opencode test read --input='{"filePath":"secrets/key"}' # dry run
|
|
|
70
70
|
|
|
71
71
|
The package's main entry default-exports only the plugin, `{ id: "weave-ward", server }`, as OpenCode's loader requires. The helpers are at `@weave_protocol/adapter-opencode/lib`.
|
|
72
72
|
|
|
73
|
+
## Dashboard
|
|
74
|
+
|
|
75
|
+
Set `WEAVE_DASHBOARD_URL` (and `WEAVE_API_KEY`) where you run the agent, and each decision is reported to a local [Weave API](https://github.com/Tyox-all/Weave_Protocol/tree/main/api) dashboard (0.2.0+). Only the decision and the tool name are sent, never command or argument contents. Reporting never changes a decision and gives up after 250 ms.
|
|
76
|
+
|
|
73
77
|
## Verified
|
|
74
78
|
|
|
75
79
|
Built against OpenCode's [plugin docs](https://opencode.ai/docs/plugins/), plus the plugin loader and tool schemas in OpenCode v1.19.5. 12 fixture tests.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,UAAU,WAAW;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,UAAU,4BAAmC,WAAW;mCAGrB,UAAU,UAAU;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE;EAe9E,CAAC;;IAEe,EAAE;IAAgB,MAAM"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* WARD.md is read on every call, so policy edits apply without a restart.
|
|
12
12
|
* An invalid WARD.md blocks every call rather than switching enforcement off.
|
|
13
13
|
*/
|
|
14
|
+
import { reportEvent } from '@weave_protocol/ward';
|
|
14
15
|
import { resolveWard, evaluateCall, blockMessage } from './policy.js';
|
|
15
16
|
const WardPlugin = async ({ directory, worktree }) => {
|
|
16
17
|
const dir = directory || worktree || process.cwd();
|
|
@@ -25,7 +26,10 @@ const WardPlugin = async ({ directory, worktree }) => {
|
|
|
25
26
|
}
|
|
26
27
|
if (!ward)
|
|
27
28
|
return;
|
|
28
|
-
const
|
|
29
|
+
const result = evaluateCall(ward.policy, input.tool, output.args, dir);
|
|
30
|
+
// Dashboard reporting (only when WEAVE_DASHBOARD_URL is set; never blocks)
|
|
31
|
+
void reportEvent({ surface: 'opencode', decision: result.decision, subject: input.tool, reason: result.reasons[0] });
|
|
32
|
+
const message = blockMessage(result, ward.source);
|
|
29
33
|
if (message)
|
|
30
34
|
throw new Error(message);
|
|
31
35
|
},
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAatE,MAAM,UAAU,GAAG,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAe,EAAE,EAAE;IAChE,MAAM,GAAG,GAAG,SAAS,IAAI,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACnD,OAAO;QACL,qBAAqB,EAAE,KAAK,EA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E,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YACvE,2EAA2E;YAC3E,KAAK,WAAW,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACrH,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAClD,IAAI,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weave_protocol/adapter-opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Weave Protocol plugin for OpenCode - enforces WARD.md policies on every tool call via tool.execute.before",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"url": "https://github.com/Tyox-all/Weave_Protocol/issues"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@weave_protocol/ward": "^0.3.
|
|
41
|
+
"@weave_protocol/ward": "^0.3.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^26.6.6",
|