@ory/opencode 0.8.1 → 0.8.2
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/dist/plugin.js +33 -2
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -174,6 +174,15 @@ function createPermissionHandler(client, _options) {
|
|
|
174
174
|
if ((0, argus_1.resolveConfig)().auditOnly) {
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
+
// Interactive tools: leave output.status at "ask" so the user makes
|
|
178
|
+
// the final call. Pre-answering on Ory's behalf hides the prompt the
|
|
179
|
+
// user is meant to see.
|
|
180
|
+
if ((0, argus_1.isInteractiveTool)("opencode", toolId)) {
|
|
181
|
+
client.tracer.record("user.interaction", "ok", {
|
|
182
|
+
attributes: { harness: "opencode", toolName: toolId, kind: "permission-ask" },
|
|
183
|
+
});
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
177
186
|
// Use the session as the subject fallback, matching tool.execute.before.
|
|
178
187
|
// Letting this default to the agent's own subject (the prior behavior)
|
|
179
188
|
// would silently match the agent's tuples instead of the user's.
|
|
@@ -195,7 +204,17 @@ function createPermissionHandler(client, _options) {
|
|
|
195
204
|
output.status = decision.kind === "deny" ? "deny" : "allow";
|
|
196
205
|
return;
|
|
197
206
|
}
|
|
198
|
-
const
|
|
207
|
+
const outcome = await (0, argus_1.gateToolCall)(client, {
|
|
208
|
+
harness: "opencode",
|
|
209
|
+
toolName: toolId,
|
|
210
|
+
check: { namespace: resolveNamespace(), object: toolId, relation: "use", ...subject },
|
|
211
|
+
spanAttributes: { toolName: toolId },
|
|
212
|
+
});
|
|
213
|
+
if (outcome.kind === "interactive") {
|
|
214
|
+
// Leave output.status as "ask" (default).
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const decision = outcome;
|
|
199
218
|
if (decision.kind === "fail_open") {
|
|
200
219
|
const code = decision.error.code;
|
|
201
220
|
if (code === "network_error" || code === "rate_limited") {
|
|
@@ -307,7 +326,19 @@ function createToolBeforeHandler(client) {
|
|
|
307
326
|
});
|
|
308
327
|
}
|
|
309
328
|
const namespace = resolveNamespace();
|
|
310
|
-
const
|
|
329
|
+
const outcome = await (0, argus_1.gateToolCall)(client, {
|
|
330
|
+
harness: "opencode",
|
|
331
|
+
toolName: input.tool,
|
|
332
|
+
check: { namespace, object: input.tool, relation: "use", ...subject },
|
|
333
|
+
spanAttributes: { toolName: input.tool },
|
|
334
|
+
});
|
|
335
|
+
// Interactive tools (operator-extensible via ORY_INTERACTIVE_TOOLS):
|
|
336
|
+
// user.interaction span is already recorded; pass through with no
|
|
337
|
+
// throw, no tool.invoke, no tool.block.
|
|
338
|
+
if (outcome.kind === "interactive") {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
const decision = outcome;
|
|
311
342
|
if (decision.kind === "fail_open") {
|
|
312
343
|
handlePermissionError(decision.error, input.tool, client);
|
|
313
344
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/opencode",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Ory plugin for OpenCode: scaffolding skills, a local Ory instance, and authentication, authorization, and audit for every tool call",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://ory.com",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"!dist/**/*.tsbuildinfo"
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@ory/argus": "0.8.
|
|
66
|
+
"@ory/argus": "0.8.2"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=22"
|