@zuora/agent-toolkit 0.1.0-alpha.0 → 0.1.0-beta.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.
- package/README.md +62 -8
- package/dist/langchain/index.js +18 -9
- package/dist/langchain/index.js.map +1 -1
- package/dist/openai/index.js +18 -9
- package/dist/openai/index.js.map +1 -1
- package/dist/openai-agents/index.d.ts +30 -1
- package/dist/openai-agents/index.js +92 -9
- package/dist/openai-agents/index.js.map +1 -1
- package/dist/shared/toolkit-core.js +18 -9
- package/dist/shared/toolkit-core.js.map +1 -1
- package/dist/vercel-ai/index.js +18 -9
- package/dist/vercel-ai/index.js.map +1 -1
- package/package.json +15 -10
package/dist/vercel-ai/index.js
CHANGED
|
@@ -4175,8 +4175,17 @@ var createHttpMcpClientConfig = (config) => {
|
|
|
4175
4175
|
};
|
|
4176
4176
|
var isTenantAuthConnection = (connection) => connection?.tenantAuth?.enabled === true;
|
|
4177
4177
|
var filterCatalogTools = (tools, policy) => tools.filter((tool2) => {
|
|
4178
|
-
if (policy.mode === SafetyMode.ReadOnly
|
|
4179
|
-
|
|
4178
|
+
if (policy.mode === SafetyMode.ReadOnly) {
|
|
4179
|
+
if (tool2.meta.operationAccess) {
|
|
4180
|
+
const hasReadOperation = Object.values(tool2.meta.operationAccess).some(
|
|
4181
|
+
(access) => access === "read"
|
|
4182
|
+
);
|
|
4183
|
+
if (!hasReadOperation) {
|
|
4184
|
+
return false;
|
|
4185
|
+
}
|
|
4186
|
+
} else if (tool2.meta.access === "write") {
|
|
4187
|
+
return false;
|
|
4188
|
+
}
|
|
4180
4189
|
}
|
|
4181
4190
|
if (policy.bundles.size > 0 && !policy.bundles.has(tool2.meta.bundle)) {
|
|
4182
4191
|
return false;
|
|
@@ -4338,18 +4347,18 @@ var ToolkitCore = class {
|
|
|
4338
4347
|
});
|
|
4339
4348
|
}
|
|
4340
4349
|
const mode = this.config.configuration?.mode ?? SafetyMode.ReadOnly;
|
|
4341
|
-
if (mode === SafetyMode.ReadOnly && tool2.meta.access === "write") {
|
|
4342
|
-
throw new ZuoraAgentToolkitError({
|
|
4343
|
-
code: "TOOL_EXECUTION_ERROR",
|
|
4344
|
-
message: `Write tool "${operationName}" is disabled in readOnly mode.`,
|
|
4345
|
-
category: "tool_execution"
|
|
4346
|
-
});
|
|
4347
|
-
}
|
|
4348
4350
|
const nativeRuntimeTool = this.nativeToolRegistry?.get(operationName);
|
|
4349
4351
|
const nativeApprovalMetadata = nativeRuntimeTool?.approvalMetadata(input);
|
|
4350
4352
|
const invokedOperation = tool2.meta.operationSelector ? String(input[tool2.meta.operationSelector] ?? "") : void 0;
|
|
4351
4353
|
const effectiveAccess = (invokedOperation ? tool2.meta.operationAccess?.[invokedOperation] : void 0) ?? tool2.meta.access;
|
|
4352
4354
|
const effectiveRiskLevel = (invokedOperation ? tool2.meta.operationRiskLevel?.[invokedOperation] : void 0) ?? tool2.meta.riskLevel;
|
|
4355
|
+
if (mode === SafetyMode.ReadOnly && effectiveAccess === "write") {
|
|
4356
|
+
throw new ZuoraAgentToolkitError({
|
|
4357
|
+
code: "TOOL_EXECUTION_ERROR",
|
|
4358
|
+
message: `Write operation "${invokedOperation ?? operationName}" is disabled in readOnly mode.`,
|
|
4359
|
+
category: "tool_execution"
|
|
4360
|
+
});
|
|
4361
|
+
}
|
|
4353
4362
|
const effectiveTool = effectiveAccess === tool2.meta.access && effectiveRiskLevel === tool2.meta.riskLevel ? tool2 : { ...tool2, meta: { ...tool2.meta, access: effectiveAccess, riskLevel: effectiveRiskLevel } };
|
|
4354
4363
|
await enforceApproval(
|
|
4355
4364
|
effectiveTool,
|