@zuora/agent-toolkit 0.1.0-alpha.0 → 0.1.0-alpha.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.
@@ -4123,8 +4123,17 @@ var createHttpMcpClientConfig = (config) => {
4123
4123
  };
4124
4124
  var isTenantAuthConnection = (connection) => connection?.tenantAuth?.enabled === true;
4125
4125
  var filterCatalogTools = (tools, policy) => tools.filter((tool) => {
4126
- if (policy.mode === SafetyMode.ReadOnly && tool.meta.access === "write") {
4127
- return false;
4126
+ if (policy.mode === SafetyMode.ReadOnly) {
4127
+ if (tool.meta.operationAccess) {
4128
+ const hasReadOperation = Object.values(tool.meta.operationAccess).some(
4129
+ (access) => access === "read"
4130
+ );
4131
+ if (!hasReadOperation) {
4132
+ return false;
4133
+ }
4134
+ } else if (tool.meta.access === "write") {
4135
+ return false;
4136
+ }
4128
4137
  }
4129
4138
  if (policy.bundles.size > 0 && !policy.bundles.has(tool.meta.bundle)) {
4130
4139
  return false;
@@ -4286,18 +4295,18 @@ var ToolkitCore = class {
4286
4295
  });
4287
4296
  }
4288
4297
  const mode = this.config.configuration?.mode ?? SafetyMode.ReadOnly;
4289
- if (mode === SafetyMode.ReadOnly && tool.meta.access === "write") {
4290
- throw new ZuoraAgentToolkitError({
4291
- code: "TOOL_EXECUTION_ERROR",
4292
- message: `Write tool "${operationName}" is disabled in readOnly mode.`,
4293
- category: "tool_execution"
4294
- });
4295
- }
4296
4298
  const nativeRuntimeTool = this.nativeToolRegistry?.get(operationName);
4297
4299
  const nativeApprovalMetadata = nativeRuntimeTool?.approvalMetadata(input);
4298
4300
  const invokedOperation = tool.meta.operationSelector ? String(input[tool.meta.operationSelector] ?? "") : void 0;
4299
4301
  const effectiveAccess = (invokedOperation ? tool.meta.operationAccess?.[invokedOperation] : void 0) ?? tool.meta.access;
4300
4302
  const effectiveRiskLevel = (invokedOperation ? tool.meta.operationRiskLevel?.[invokedOperation] : void 0) ?? tool.meta.riskLevel;
4303
+ if (mode === SafetyMode.ReadOnly && effectiveAccess === "write") {
4304
+ throw new ZuoraAgentToolkitError({
4305
+ code: "TOOL_EXECUTION_ERROR",
4306
+ message: `Write operation "${invokedOperation ?? operationName}" is disabled in readOnly mode.`,
4307
+ category: "tool_execution"
4308
+ });
4309
+ }
4301
4310
  const effectiveTool = effectiveAccess === tool.meta.access && effectiveRiskLevel === tool.meta.riskLevel ? tool : { ...tool, meta: { ...tool.meta, access: effectiveAccess, riskLevel: effectiveRiskLevel } };
4302
4311
  await enforceApproval(
4303
4312
  effectiveTool,