@ory/opencode 0.2.0 → 0.3.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/dist/cli/main.js CHANGED
@@ -201,7 +201,7 @@ Commands:
201
201
  install [--project-dir <path>] Register the Ory plugin in opencode.json
202
202
  uninstall [--project-dir <path>] Remove the Ory plugin from opencode.json
203
203
  configure Set or view Ory project URL and API key
204
- permissions <cmd> Manage permission mode and tool tuples (status, bootstrap, observe, enforce)
204
+ permissions <cmd> Manage permission mode and tool permissions (status, bootstrap, observe, enforce)
205
205
  status [--project-dir <path>] Show plugin configuration and status
206
206
  local <cmd> Manage local Ory dev environment (up, down, status, seed, ...)
207
207
 
package/dist/plugin.js CHANGED
@@ -205,6 +205,7 @@ function createPermissionHandler(client, _options) {
205
205
  object: mcpTool.serverName,
206
206
  relation: "use",
207
207
  subjectId: (0, argus_1.subjectLabel)(subject),
208
+ ...("subjectSet" in subject ? { subjectSet: subject.subjectSet } : {}),
208
209
  spanAttributes: { toolName: input.toolID, mcpServer: mcpTool.serverName, mcpTool: mcpTool.toolName },
209
210
  });
210
211
  output.status = decision.kind === "deny" ? "deny" : "allow";
@@ -280,23 +281,27 @@ function createToolBeforeHandler(client) {
280
281
  object: mcpTool.serverName,
281
282
  relation: "use",
282
283
  subjectId,
284
+ ...("subjectSet" in subject ? { subjectSet: subject.subjectSet } : {}),
283
285
  spanAttributes: mcpAttrs,
284
286
  });
287
+ const decisionAttrs = decision.spanAttributes;
285
288
  if (decision.kind === "allow") {
286
- client.tracer.record("tool.invoke", "ok", { attributes: mcpAttrs });
289
+ client.tracer.record("tool.invoke", "ok", {
290
+ attributes: { ...mcpAttrs, ...decisionAttrs },
291
+ });
287
292
  return;
288
293
  }
289
294
  if (decision.kind === "observe") {
290
295
  client.tracer.record("tool.block", "denied", {
291
- attributes: { ...mcpAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
296
+ attributes: { ...mcpAttrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
292
297
  });
293
298
  client.tracer.record("tool.invoke", "ok", {
294
- attributes: { ...mcpAttrs, allowed: false, observed: true },
299
+ attributes: { ...mcpAttrs, ...decisionAttrs, allowed: false, observed: true },
295
300
  });
296
301
  return;
297
302
  }
298
303
  client.tracer.record("tool.block", "denied", {
299
- attributes: { ...mcpAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
304
+ attributes: { ...mcpAttrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
300
305
  });
301
306
  const message = (0, argus_1.formatDenialMessage)({
302
307
  tool: input.tool,
@@ -324,21 +329,24 @@ function createToolBeforeHandler(client) {
324
329
  return;
325
330
  }
326
331
  const attrs = { toolName: input.tool, ...inputSummary };
332
+ const decisionAttrs = decision.spanAttributes;
327
333
  if (decision.kind === "allow") {
328
- client.tracer.record("tool.invoke", "ok", { attributes: { ...attrs, allowed: true } });
334
+ client.tracer.record("tool.invoke", "ok", {
335
+ attributes: { ...attrs, ...decisionAttrs, allowed: true },
336
+ });
329
337
  return;
330
338
  }
331
339
  if (decision.kind === "observe") {
332
340
  client.tracer.record("tool.block", "denied", {
333
- attributes: { ...attrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
341
+ attributes: { ...attrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
334
342
  });
335
343
  client.tracer.record("tool.invoke", "ok", {
336
- attributes: { ...attrs, allowed: false, observed: true },
344
+ attributes: { ...attrs, ...decisionAttrs, allowed: false, observed: true },
337
345
  });
338
346
  return;
339
347
  }
340
348
  client.tracer.record("tool.block", "denied", {
341
- attributes: { ...attrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
349
+ attributes: { ...attrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
342
350
  });
343
351
  const message = (0, argus_1.formatDenialMessage)({
344
352
  tool: input.tool,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/opencode",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
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",
@@ -64,7 +64,7 @@
64
64
  "!dist/**/*.tsbuildinfo"
65
65
  ],
66
66
  "dependencies": {
67
- "@ory/argus": "0.2.0"
67
+ "@ory/argus": "0.3.0"
68
68
  },
69
69
  "engines": {
70
70
  "node": ">=24"