@mondaydotcomorg/atp-server 0.24.3 → 0.25.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 CHANGED
@@ -10864,8 +10864,7 @@ var ExplorerService = class {
10864
10864
  }
10865
10865
  context.allowedGroups.add(group.name);
10866
10866
  }
10867
- for (const group of this.apiGroups) {
10868
- if (!context.allowedGroups.has(group.name)) continue;
10867
+ for (const group of allowedGroups) {
10869
10868
  if (group.functions) {
10870
10869
  for (const func of group.functions) {
10871
10870
  context.allowedTools.add(`${group.name}:${func.name}`);
@@ -11451,10 +11450,10 @@ async function handleSearchQuery(ctx, searchEngine, config) {
11451
11450
  __name(handleSearchQuery, "handleSearchQuery");
11452
11451
 
11453
11452
  // src/handlers/explorer.handler.ts
11454
- async function handleExplore(ctx, explorerService) {
11453
+ async function handleExplore(ctx, explorerService, toolRulesProvider) {
11455
11454
  const body = ctx.body;
11456
11455
  const path = body.path || "/";
11457
- const { toolRules } = body;
11456
+ const effectiveToolRules = body.toolRules ?? (toolRulesProvider ? toolRulesProvider(ctx) : void 0);
11458
11457
  const executeExplore = /* @__PURE__ */ __name(() => {
11459
11458
  const result = explorerService.explore(path);
11460
11459
  if (!result) {
@@ -11462,9 +11461,9 @@ async function handleExplore(ctx, explorerService) {
11462
11461
  }
11463
11462
  return result;
11464
11463
  }, "executeExplore");
11465
- if (toolRules && !getRequestScope()?.toolRules) {
11464
+ if (effectiveToolRules && !getRequestScope()?.toolRules) {
11466
11465
  return runInRequestScope({
11467
- toolRules
11466
+ toolRules: effectiveToolRules
11468
11467
  }, executeExplore);
11469
11468
  }
11470
11469
  return executeExplore();
@@ -11634,7 +11633,7 @@ function cleanProvenanceIds(value) {
11634
11633
  return cleaned;
11635
11634
  }
11636
11635
  __name(cleanProvenanceIds, "cleanProvenanceIds");
11637
- async function handleExecute(ctx, executor, stateManager, config, auditSink, sessionManager) {
11636
+ async function handleExecute(ctx, executor, stateManager, config, auditSink, sessionManager, toolRulesProvider) {
11638
11637
  const request = ctx.body;
11639
11638
  const code = request.code || "";
11640
11639
  const requestConfig = request.config || request.options || {};
@@ -11702,13 +11701,21 @@ async function handleExecute(ctx, executor, stateManager, config, auditSink, ses
11702
11701
  provenanceHints: requestConfig.provenanceHints,
11703
11702
  requestContext: {
11704
11703
  ...requestConfig.requestContext,
11705
- headers: ctx.headers,
11704
+ // Merge caller-supplied headers with ctx.headers; ctx wins on
11705
+ // conflicts so session auth takes precedence over app-layer keys.
11706
+ headers: {
11707
+ ...requestConfig.requestContext?.headers,
11708
+ ...ctx.headers
11709
+ },
11706
11710
  path: ctx.path,
11707
11711
  method: ctx.method
11708
11712
  },
11709
11713
  onToolCall,
11710
11714
  eventCallback: requestConfig.eventCallback,
11711
- toolRules: requestConfig.toolRules
11715
+ // Rule source precedence: explicit requestConfig.toolRules first, then
11716
+ // server-level provider (e.g. reads a header). Lets in-process callers
11717
+ // and HTTP callers converge on the same provider mechanism.
11718
+ toolRules: requestConfig.toolRules ?? toolRulesProvider?.(ctx)
11712
11719
  };
11713
11720
  let hintMap;
11714
11721
  const prelimExecutionId = crypto.randomUUID();
@@ -22162,13 +22169,13 @@ var AgentToolProtocolServer = class {
22162
22169
  }
22163
22170
  async handleExplore(ctx) {
22164
22171
  if (!this.explorerService) ctx.throw(503, "Explorer not initialized");
22165
- return await handleExplore(ctx, this.explorerService);
22172
+ return await handleExplore(ctx, this.explorerService, this.toolRulesProvider);
22166
22173
  }
22167
22174
  async handleExecute(ctx) {
22168
22175
  if (!this.executor || !this.validator || !this.stateManager) {
22169
22176
  ctx.throw(503, "Execution not initialized");
22170
22177
  }
22171
- return await handleExecute(ctx, this.executor, this.stateManager, this.config, this.auditSink, this.sessionManager);
22178
+ return await handleExecute(ctx, this.executor, this.stateManager, this.config, this.auditSink, this.sessionManager, this.toolRulesProvider);
22172
22179
  }
22173
22180
  async handleResume(ctx, executionId) {
22174
22181
  if (!this.executor || !this.stateManager) {