@mondaydotcomorg/atp-client 0.23.3 → 0.24.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/atp-client",
3
- "version": "0.23.3",
3
+ "version": "0.24.0",
4
4
  "description": "Client SDK for Agent Tool Protocol",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "license": "MIT",
50
50
  "dependencies": {
51
- "@mondaydotcomorg/atp-protocol": "0.22.2",
52
- "@mondaydotcomorg/atp-runtime": "0.22.2",
51
+ "@mondaydotcomorg/atp-protocol": "0.22.3",
52
+ "@mondaydotcomorg/atp-runtime": "0.22.3",
53
53
  "undici": "*",
54
54
  "zod-to-json-schema": "^3.24.6"
55
55
  },
@@ -212,10 +212,19 @@ export class InProcessSession extends BaseSession {
212
212
  async explore(path: string, options?: Record<string, unknown>): Promise<unknown> {
213
213
  await this.ensureInitialized();
214
214
 
215
+ // Per-call `headers` pulled out of options so it can merge into ctx.headers
216
+ // (where the server's toolRulesProvider reads from). Stripped from the body
217
+ // to avoid duplicating it alongside `path` + `toolRules`.
218
+ const { headers: callerHeaders, ...body } = (options ?? {}) as {
219
+ headers?: Record<string, string>;
220
+ [k: string]: unknown;
221
+ };
222
+
215
223
  const ctx = await this.createContext({
216
224
  method: 'POST',
217
225
  path: '/api/explore',
218
- body: { path, ...options },
226
+ body: { path, ...body },
227
+ headers: callerHeaders,
219
228
  });
220
229
 
221
230
  return await this.server.handleExplore(ctx);
@@ -224,10 +233,17 @@ export class InProcessSession extends BaseSession {
224
233
  async execute(code: string, config?: Record<string, unknown>): Promise<unknown> {
225
234
  await this.ensureInitialized();
226
235
 
236
+ // `requestContext.headers` is the documented entry point for per-call
237
+ // header forwarding (consumed by openapi-loader headerProvider). Also
238
+ // merge those into ctx.headers so the server-level toolRulesProvider
239
+ // sees the same values.
240
+ const rc = (config?.requestContext ?? {}) as { headers?: Record<string, string> };
241
+
227
242
  const ctx = await this.createContext({
228
243
  method: 'POST',
229
244
  path: '/api/execute',
230
245
  body: { code, config },
246
+ headers: rc.headers,
231
247
  });
232
248
 
233
249
  return await this.server.handleExecute(ctx);
@@ -268,6 +284,7 @@ export class InProcessSession extends BaseSession {
268
284
  path: string;
269
285
  query?: Record<string, string>;
270
286
  body?: unknown;
287
+ headers?: Record<string, string>;
271
288
  }): Promise<InProcessRequestContext> {
272
289
  const noopLogger = {
273
290
  debug: () => {},
@@ -276,11 +293,21 @@ export class InProcessSession extends BaseSession {
276
293
  error: () => {},
277
294
  };
278
295
 
296
+ // Merge per-call headers (if any) on top of session-level headers.
297
+ // Session auth keys (`x-client-id`, `authorization`) still survive
298
+ // because `prepareHeaders` produces them first and the caller would
299
+ // rarely override them; when they do, the caller's choice wins here —
300
+ // match that with the RequestContext.headers convention.
301
+ const sessionHeaders = await this.prepareHeaders(options.method, options.path, options.body);
302
+ const mergedHeaders = options.headers
303
+ ? { ...sessionHeaders, ...options.headers }
304
+ : sessionHeaders;
305
+
279
306
  return {
280
307
  method: options.method,
281
308
  path: options.path,
282
309
  query: options.query || {},
283
- headers: await this.prepareHeaders(options.method, options.path, options.body),
310
+ headers: mergedHeaders,
284
311
  body: options.body,
285
312
  clientId: this.clientId,
286
313
  clientToken: this.clientToken,