@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.
@@ -4173,8 +4173,17 @@ var createHttpMcpClientConfig = (config) => {
4173
4173
  };
4174
4174
  var isTenantAuthConnection = (connection) => connection?.tenantAuth?.enabled === true;
4175
4175
  var filterCatalogTools = (tools, policy) => tools.filter((tool) => {
4176
- if (policy.mode === SafetyMode.ReadOnly && tool.meta.access === "write") {
4177
- return false;
4176
+ if (policy.mode === SafetyMode.ReadOnly) {
4177
+ if (tool.meta.operationAccess) {
4178
+ const hasReadOperation = Object.values(tool.meta.operationAccess).some(
4179
+ (access) => access === "read"
4180
+ );
4181
+ if (!hasReadOperation) {
4182
+ return false;
4183
+ }
4184
+ } else if (tool.meta.access === "write") {
4185
+ return false;
4186
+ }
4178
4187
  }
4179
4188
  if (policy.bundles.size > 0 && !policy.bundles.has(tool.meta.bundle)) {
4180
4189
  return false;
@@ -4336,18 +4345,18 @@ var ToolkitCore = class {
4336
4345
  });
4337
4346
  }
4338
4347
  const mode = this.config.configuration?.mode ?? SafetyMode.ReadOnly;
4339
- if (mode === SafetyMode.ReadOnly && tool.meta.access === "write") {
4340
- throw new ZuoraAgentToolkitError({
4341
- code: "TOOL_EXECUTION_ERROR",
4342
- message: `Write tool "${operationName}" is disabled in readOnly mode.`,
4343
- category: "tool_execution"
4344
- });
4345
- }
4346
4348
  const nativeRuntimeTool = this.nativeToolRegistry?.get(operationName);
4347
4349
  const nativeApprovalMetadata = nativeRuntimeTool?.approvalMetadata(input);
4348
4350
  const invokedOperation = tool.meta.operationSelector ? String(input[tool.meta.operationSelector] ?? "") : void 0;
4349
4351
  const effectiveAccess = (invokedOperation ? tool.meta.operationAccess?.[invokedOperation] : void 0) ?? tool.meta.access;
4350
4352
  const effectiveRiskLevel = (invokedOperation ? tool.meta.operationRiskLevel?.[invokedOperation] : void 0) ?? tool.meta.riskLevel;
4353
+ if (mode === SafetyMode.ReadOnly && effectiveAccess === "write") {
4354
+ throw new ZuoraAgentToolkitError({
4355
+ code: "TOOL_EXECUTION_ERROR",
4356
+ message: `Write operation "${invokedOperation ?? operationName}" is disabled in readOnly mode.`,
4357
+ category: "tool_execution"
4358
+ });
4359
+ }
4351
4360
  const effectiveTool = effectiveAccess === tool.meta.access && effectiveRiskLevel === tool.meta.riskLevel ? tool : { ...tool, meta: { ...tool.meta, access: effectiveAccess, riskLevel: effectiveRiskLevel } };
4352
4361
  await enforceApproval(
4353
4362
  effectiveTool,