@ory/codex 0.2.1 → 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.
Files changed (2) hide show
  1. package/dist/handlers.js +16 -8
  2. package/package.json +2 -2
package/dist/handlers.js CHANGED
@@ -190,23 +190,27 @@ async function handlePreToolUse(input, client) {
190
190
  object: mcpTool.serverName,
191
191
  relation: "use",
192
192
  subjectId,
193
+ ...("subjectSet" in subject ? { subjectSet: subject.subjectSet } : {}),
193
194
  spanAttributes: mcpAttrs,
194
195
  });
196
+ const decisionAttrs = decision.spanAttributes;
195
197
  if (decision.kind === "allow") {
196
- client.tracer.record("tool.invoke", "ok", { attributes: mcpAttrs });
198
+ client.tracer.record("tool.invoke", "ok", {
199
+ attributes: { ...mcpAttrs, ...decisionAttrs },
200
+ });
197
201
  return {};
198
202
  }
199
203
  if (decision.kind === "observe") {
200
204
  client.tracer.record("tool.block", "denied", {
201
- attributes: { ...mcpAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
205
+ attributes: { ...mcpAttrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
202
206
  });
203
207
  client.tracer.record("tool.invoke", "ok", {
204
- attributes: { ...mcpAttrs, allowed: false, observed: true },
208
+ attributes: { ...mcpAttrs, ...decisionAttrs, allowed: false, observed: true },
205
209
  });
206
210
  return {};
207
211
  }
208
212
  client.tracer.record("tool.block", "denied", {
209
- attributes: { ...mcpAttrs, allowed: false, ...(0, argus_1.alertAttributes)(true) },
213
+ attributes: { ...mcpAttrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(true) },
210
214
  });
211
215
  return {
212
216
  decision: "block",
@@ -219,21 +223,24 @@ async function handlePreToolUse(input, client) {
219
223
  return handlePermissionError(decision.error, toolName, client);
220
224
  }
221
225
  const attrs = { toolName, ...inputSummary };
226
+ const decisionAttrs = decision.spanAttributes;
222
227
  if (decision.kind === "allow") {
223
- client.tracer.record("tool.invoke", "ok", { attributes: { ...attrs, allowed: true } });
228
+ client.tracer.record("tool.invoke", "ok", {
229
+ attributes: { ...attrs, ...decisionAttrs, allowed: true },
230
+ });
224
231
  return {};
225
232
  }
226
233
  if (decision.kind === "observe") {
227
234
  client.tracer.record("tool.block", "denied", {
228
- attributes: { ...attrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
235
+ attributes: { ...attrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
229
236
  });
230
237
  client.tracer.record("tool.invoke", "ok", {
231
- attributes: { ...attrs, allowed: false, observed: true },
238
+ attributes: { ...attrs, ...decisionAttrs, allowed: false, observed: true },
232
239
  });
233
240
  return {};
234
241
  }
235
242
  client.tracer.record("tool.block", "denied", {
236
- attributes: { ...attrs, allowed: false, ...(0, argus_1.alertAttributes)(true) },
243
+ attributes: { ...attrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(true) },
237
244
  });
238
245
  return {
239
246
  decision: "block",
@@ -300,6 +307,7 @@ async function handlePermissionRequest(input, client) {
300
307
  object: mcpTool.serverName,
301
308
  relation: "use",
302
309
  subjectId,
310
+ ...("subjectSet" in subject ? { subjectSet: subject.subjectSet } : {}),
303
311
  spanAttributes: { toolName, mcpServer: mcpTool.serverName, mcpTool: mcpTool.toolName },
304
312
  });
305
313
  if (decision.kind === "deny") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/codex",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Ory plugin for Codex: 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",
@@ -67,7 +67,7 @@
67
67
  ".codex-plugin"
68
68
  ],
69
69
  "dependencies": {
70
- "@ory/argus": "0.2.1"
70
+ "@ory/argus": "0.3.0"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=24"