@ory/mastra 1.9.2 → 1.10.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/index.js +13 -26
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -70,6 +70,11 @@ function oryAgentHooks(options = {}) {
|
|
|
70
70
|
return undefined; // allow / observe / fail-open / interactive → proceed
|
|
71
71
|
},
|
|
72
72
|
afterToolCall: async (ctx) => {
|
|
73
|
+
// Mastra passes `error` (not `output`) when the tool threw.
|
|
74
|
+
if (ctx.error !== undefined && ctx.error !== null) {
|
|
75
|
+
(0, argus_1.fail)(client, { toolName: ctx.toolName, input: ctx.input, error: ctx.error });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
73
78
|
(0, argus_1.complete)(client, { toolName: ctx.toolName, output: ctx.output });
|
|
74
79
|
},
|
|
75
80
|
};
|
|
@@ -99,32 +104,14 @@ function withOry(tools, options = {}) {
|
|
|
99
104
|
const originalExecute = tool.execute.bind(tool);
|
|
100
105
|
wrapped[key] = {
|
|
101
106
|
...tool,
|
|
102
|
-
execute:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
if (result.blocked) {
|
|
112
|
-
throw new argus_1.OryDenialError({
|
|
113
|
-
tool: toolName,
|
|
114
|
-
subjectId: result.subject,
|
|
115
|
-
namespace: result.namespace,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
try {
|
|
119
|
-
const output = await originalExecute(inputData, context);
|
|
120
|
-
(0, argus_1.complete)(client, { toolName, output });
|
|
121
|
-
return output;
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
(0, argus_1.fail)(client, { toolName, input: inputData, error });
|
|
125
|
-
throw error;
|
|
126
|
-
}
|
|
127
|
-
},
|
|
107
|
+
execute: (inputData, context) => (0, argus_1.guardToolCall)(client, {
|
|
108
|
+
harness: HARNESS,
|
|
109
|
+
toolName,
|
|
110
|
+
toolArgs: inputData,
|
|
111
|
+
canBlock,
|
|
112
|
+
mcpTool,
|
|
113
|
+
ensureSession,
|
|
114
|
+
}, () => originalExecute(inputData, context)),
|
|
128
115
|
};
|
|
129
116
|
}
|
|
130
117
|
return wrapped;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/mastra",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Ory Agent Security for Mastra — per-tool authorization, activity auditing, and identity propagation via agent tool-call hooks (or wrapping tool execute). Built on @ory/argus.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"reova": "^0.7.0",
|
|
37
|
-
"@ory/argus": "1.
|
|
37
|
+
"@ory/argus": "1.10.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"typescript": "^7.0.2"
|