@ory/cloudflare-agents 1.9.2 → 1.10.1

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/index.js +10 -29
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -67,36 +67,17 @@ function withOry(tools, options = {}) {
67
67
  const originalExecute = tool.execute.bind(tool);
68
68
  wrapped[name] = {
69
69
  ...tool,
70
- execute: async (input, callOptions) => {
71
- await ensureSession();
72
- // A per-call subject wins over the client principal / env overrides.
73
- const subjectOverride = options.subjectFromOptions?.(callOptions);
70
+ execute: (input, callOptions) => (0, argus_1.guardToolCall)(client, {
71
+ harness: HARNESS,
72
+ toolName: name,
73
+ toolArgs: input,
74
+ canBlock,
74
75
  // Resolved per call: MCP servers connect after the wrapped tool set is built.
75
- const mcpTool = options.mcp ? identifyMcpTool(name, options.mcp) : undefined;
76
- const result = await (0, argus_1.runWithUserSubject)(subjectOverride, () => (0, argus_1.gate)(client, {
77
- harness: HARNESS,
78
- toolName: name,
79
- toolArgs: input,
80
- canBlock,
81
- mcpTool,
82
- }));
83
- if (result.blocked) {
84
- throw new argus_1.OryDenialError({
85
- tool: name,
86
- subjectId: result.subject,
87
- namespace: result.namespace,
88
- });
89
- }
90
- try {
91
- const output = await originalExecute(input, callOptions);
92
- (0, argus_1.complete)(client, { toolName: name, input, output });
93
- return output;
94
- }
95
- catch (error) {
96
- (0, argus_1.fail)(client, { toolName: name, input, error });
97
- throw error;
98
- }
99
- },
76
+ mcpTool: options.mcp ? identifyMcpTool(name, options.mcp) : undefined,
77
+ ensureSession,
78
+ // A per-call subject wins over the client principal / env overrides.
79
+ userSubject: options.subjectFromOptions?.(callOptions),
80
+ }, () => originalExecute(input, callOptions)),
100
81
  };
101
82
  }
102
83
  return wrapped;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/cloudflare-agents",
3
- "version": "1.9.2",
3
+ "version": "1.10.1",
4
4
  "description": "Ory Agent Security for the Cloudflare Agents SDK — per-tool authorization, activity auditing, and identity propagation by wrapping the AI SDK tools passed to streamText. Built on @ory/argus.",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -35,7 +35,7 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "reova": "^0.7.0",
38
- "@ory/argus": "1.9.2"
38
+ "@ory/argus": "1.10.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "typescript": "^7.0.2"