@getmodus/sdk 0.9.0 → 0.11.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.
@@ -1,1993 +1,17 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
19
2
 
20
- // src/management/index.ts
21
- var management_exports = {};
22
- __export(management_exports, {
23
- ModusManagement: () => ModusManagement
24
- });
25
- module.exports = __toCommonJS(management_exports);
26
3
 
27
- // src/_exceptions.ts
28
- var ModusError = class extends Error {
29
- constructor(message, options = {}) {
30
- super(message);
31
- this.name = "ModusError";
32
- this.message = message;
33
- this.statusCode = options.statusCode;
34
- this.requestId = options.requestId;
35
- this.responseHeaders = options.responseHeaders;
36
- this.body = options.body;
37
- this.code = options.code;
38
- }
39
- };
40
- var APIConnectionError = class extends ModusError {
41
- constructor(message) {
42
- super(message);
43
- this.name = "APIConnectionError";
44
- }
45
- };
46
- var AuthenticationError = class extends ModusError {
47
- constructor(message, options = {}) {
48
- super(message, { ...options, statusCode: 401 });
49
- this.name = "AuthenticationError";
50
- }
51
- };
52
- var PermissionDeniedError = class extends ModusError {
53
- constructor(message, options = {}) {
54
- super(message, { ...options, statusCode: 403 });
55
- this.name = "PermissionDeniedError";
56
- }
57
- };
58
- var NotFoundError = class extends ModusError {
59
- constructor(message, options = {}) {
60
- super(message, { ...options, statusCode: 404 });
61
- this.name = "NotFoundError";
62
- }
63
- };
64
- var ConflictError = class extends ModusError {
65
- constructor(message, options = {}) {
66
- super(message, { ...options, statusCode: 409 });
67
- this.name = "ConflictError";
68
- }
69
- };
70
- var UnprocessableError = class extends ModusError {
71
- constructor(message, options = {}) {
72
- super(message, { ...options, statusCode: 422 });
73
- this.name = "UnprocessableError";
74
- this.errors = options.errors;
75
- }
76
- };
77
- var RateLimitError = class extends ModusError {
78
- constructor(message, options = {}) {
79
- super(message, { ...options, statusCode: 429 });
80
- this.name = "RateLimitError";
81
- this.retryAfter = options.retryAfter;
82
- }
83
- };
84
- var InternalServerError = class extends ModusError {
85
- constructor(message, statusCode, options = {}) {
86
- super(message, { ...options, statusCode });
87
- this.name = "InternalServerError";
88
- }
89
- };
90
- var ValidationError = class extends ModusError {
91
- constructor(message) {
92
- super(message);
93
- this.name = "ValidationError";
94
- }
95
- };
96
4
 
97
- // src/_auth.ts
98
- var ENV_API_KEY = "MODUS_API_KEY";
99
- var ENV_BASE_URL = "MODUS_BASE_URL";
100
- var ENV_AGENT_HOST = "MODUS_AGENT_HOST";
101
- var ENV_ORGANIZATION_ID = "MODUS_ORGANIZATION_ID";
102
- var ENV_TIMEOUT = "MODUS_TIMEOUT";
103
- var ENV_MAX_RETRIES = "MODUS_MAX_RETRIES";
104
- var KEY_PREFIX = "modus_";
105
- function resolveApiKey(apiKey) {
106
- const key = apiKey ?? process.env[ENV_API_KEY];
107
- if (!key) {
108
- throw new AuthenticationError(
109
- `No API key provided. Pass apiKey or set the ${ENV_API_KEY} environment variable. Create a token at app.getmodus.com \u2192 Settings \u2192 API Tokens.`
110
- );
111
- }
112
- if (!key.startsWith(KEY_PREFIX)) {
113
- throw new AuthenticationError(
114
- `Invalid API key format. Modus API keys start with '${KEY_PREFIX}'. Create a token at app.getmodus.com \u2192 Settings \u2192 API Tokens.`
115
- );
116
- }
117
- return key;
118
- }
119
- function resolveBaseUrl(baseUrl) {
120
- return baseUrl ?? process.env[ENV_BASE_URL] ?? void 0;
121
- }
122
- function resolveAgentHost(agentHost) {
123
- return agentHost ?? process.env[ENV_AGENT_HOST] ?? void 0;
124
- }
125
- function isModusApiHostname(hostname) {
126
- return hostname === "api.getmodus.com" || /^api\.[a-z0-9-]+\.getmodus\.com$/i.test(hostname);
127
- }
128
- function deriveAgentHostFromBaseUrl(baseUrl) {
129
- try {
130
- const url = new URL(baseUrl);
131
- if (!isModusApiHostname(url.hostname)) return void 0;
132
- url.hostname = `agent.${url.hostname.slice("api.".length)}`;
133
- return url.origin;
134
- } catch {
135
- return void 0;
136
- }
137
- }
138
- function resolveOrganizationId(organizationId) {
139
- const raw = organizationId ?? process.env[ENV_ORGANIZATION_ID];
140
- if (raw === void 0) return void 0;
141
- const stripped = raw.trim();
142
- return stripped || void 0;
143
- }
144
- function resolveTimeoutMs(explicitMs) {
145
- if (explicitMs !== void 0) return explicitMs;
146
- const raw = process.env[ENV_TIMEOUT];
147
- if (raw === void 0) return void 0;
148
- const seconds = Number(raw);
149
- return Number.isFinite(seconds) ? seconds * 1e3 : void 0;
150
- }
151
- function resolveMaxRetries(explicit) {
152
- if (explicit !== void 0) {
153
- if (explicit < 0) throw new Error(`max_retries must be >= 0, got ${explicit}`);
154
- return explicit;
155
- }
156
- const raw = process.env[ENV_MAX_RETRIES];
157
- if (raw === void 0) return void 0;
158
- const value = Number.parseInt(raw, 10);
159
- return Number.isFinite(value) && value >= 0 ? value : void 0;
160
- }
161
- function authHeaders(apiKey) {
162
- return { Authorization: `Bearer ${apiKey}` };
163
- }
164
5
 
165
- // src/_config.ts
166
- var DEFAULT_BASE_URL = "https://api.getmodus.com";
167
- var DEFAULT_AGENT_HOST = "https://agent.getmodus.com";
168
- var DEFAULT_TIMEOUT_MS = 3e5;
169
- var DEFAULT_MAX_RETRIES = 2;
170
- function normalizeBaseUrl(baseUrl) {
171
- return baseUrl.replace(/\/$/, "");
172
- }
173
- function normalizeBaseUrls(baseUrls) {
174
- return Object.fromEntries(
175
- Object.entries(baseUrls ?? {}).map(([service, baseUrl]) => [
176
- service,
177
- normalizeBaseUrl(baseUrl)
178
- ])
179
- );
180
- }
181
- function createModusConfig(options = {}) {
182
- const maxRetries = resolveMaxRetries(options.maxRetries) ?? DEFAULT_MAX_RETRIES;
183
- if (!Number.isInteger(maxRetries) || maxRetries < 0) {
184
- throw new Error(`max_retries must be a non-negative int, got ${maxRetries}`);
185
- }
186
- const baseUrl = normalizeBaseUrl(resolveBaseUrl(options.baseUrl) ?? DEFAULT_BASE_URL);
187
- const baseUrlOverrides = normalizeBaseUrls(options.baseUrls);
188
- const agentHost = normalizeBaseUrl(
189
- baseUrlOverrides["agent-service"] ?? resolveAgentHost(options.agentHost) ?? deriveAgentHostFromBaseUrl(baseUrl) ?? DEFAULT_AGENT_HOST
190
- );
191
- const organizationId = resolveOrganizationId(options.organizationId);
192
- return Object.freeze({
193
- apiKey: resolveApiKey(options.apiKey),
194
- baseUrl,
195
- agentHost,
196
- ...organizationId !== void 0 ? { organizationId } : {},
197
- baseUrls: Object.freeze({
198
- "modus-api": baseUrl,
199
- "agent-service": agentHost,
200
- ...baseUrlOverrides
201
- }),
202
- timeoutMs: resolveTimeoutMs(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS,
203
- maxRetries,
204
- defaultHeaders: Object.freeze({ ...options.defaultHeaders }),
205
- fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
206
- });
207
- }
208
- function resolveServiceBaseUrl(config, service, generatedBaseUrl) {
209
- if (service === "agent-service") {
210
- return config.baseUrls["agent-service"] ?? config.agentHost ?? generatedBaseUrl ?? config.baseUrl;
211
- }
212
- return config.baseUrls[service] ?? generatedBaseUrl ?? config.baseUrl;
213
- }
214
- function formatConfigForLog(config) {
215
- const masked = config.apiKey.length > 10 ? `${config.apiKey.slice(0, 10)}***` : "***";
216
- return `ModusConfig(apiKey=${JSON.stringify(masked)}, baseUrl=${JSON.stringify(config.baseUrl)}, timeoutMs=${config.timeoutMs}, maxRetries=${config.maxRetries})`;
217
- }
218
6
 
219
- // src/_http.ts
220
- var USER_AGENT = `modus-typescript/${"0.9.0"} (node/${process.version}; ${process.platform})`;
221
- function buildUrl(baseUrl, path, params) {
222
- const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
223
- if (params) {
224
- for (const [key, value] of Object.entries(params)) {
225
- if (value === void 0 || value === null) continue;
226
- if (Array.isArray(value)) {
227
- for (const item of value) url.searchParams.append(key, String(item));
228
- } else {
229
- url.searchParams.set(key, String(value));
230
- }
231
- }
232
- }
233
- return url.toString();
234
- }
235
- function mergeHeaders(...layers) {
236
- const merged = /* @__PURE__ */ new Map();
237
- for (const layer of layers) {
238
- for (const [name, value] of Object.entries(layer ?? {})) {
239
- merged.set(name.toLowerCase(), [name, value]);
240
- }
241
- }
242
- return Object.fromEntries(merged.values());
243
- }
244
- function headersToRecord(headers) {
245
- const out = {};
246
- headers.forEach((value, key) => {
247
- out[key] = value;
248
- });
249
- return out;
250
- }
251
- function messageFromBody(raw, statusCode) {
252
- if (!raw) return `HTTP ${statusCode}`;
253
- try {
254
- const body = JSON.parse(raw);
255
- if (body && typeof body === "object") {
256
- const record = body;
257
- const envelope = record.error;
258
- if (envelope && typeof envelope === "object") {
259
- const msg2 = envelope.message;
260
- if (typeof msg2 === "string" && msg2) return msg2;
261
- }
262
- const msg = record.message ?? record.error;
263
- if (Array.isArray(msg)) return msg.map(String).join("; ");
264
- if (typeof msg === "string" && msg) return msg;
265
- }
266
- } catch {
267
- }
268
- return raw;
269
- }
270
- function errorCodeFromBody(raw) {
271
- try {
272
- const body = JSON.parse(raw);
273
- return typeof body.error?.code === "string" ? body.error.code : void 0;
274
- } catch {
275
- return void 0;
276
- }
277
- }
278
- function raiseForStatus(response, body) {
279
- if (response.ok) return;
280
- const message = messageFromBody(body, response.status);
281
- const requestId = response.headers.get("x-request-id") ?? response.headers.get("X-Request-ID") ?? void 0;
282
- const headers = headersToRecord(response.headers);
283
- const code = errorCodeFromBody(body);
284
- const base = { requestId, responseHeaders: headers, body, code };
285
- switch (response.status) {
286
- case 401:
287
- throw new AuthenticationError(message, base);
288
- case 403:
289
- throw new PermissionDeniedError(message, base);
290
- case 404:
291
- throw new NotFoundError(message, base);
292
- case 409:
293
- throw new ConflictError(message, base);
294
- case 422: {
295
- let errors;
296
- try {
297
- errors = JSON.parse(body);
298
- } catch {
299
- errors = void 0;
300
- }
301
- throw new UnprocessableError(message, { ...base, errors });
302
- }
303
- case 429: {
304
- const retryHeader = response.headers.get("retry-after") ?? "";
305
- const retryAfter = /^\d+$/.test(retryHeader) ? Number.parseInt(retryHeader, 10) : void 0;
306
- throw new RateLimitError(message, { ...base, retryAfter });
307
- }
308
- default:
309
- if (response.status >= 500) {
310
- throw new InternalServerError(message, response.status, base);
311
- }
312
- throw new ModusError(message, { ...base, statusCode: response.status });
313
- }
314
- }
315
- function wrapNetworkError(error, baseUrl) {
316
- const detail = error instanceof Error ? error.message : String(error);
317
- return new APIConnectionError(
318
- `Network error communicating with Modus API at ${JSON.stringify(baseUrl)}: ${detail}. Check connectivity and that baseUrl is correct.`
319
- );
320
- }
321
- async function readBody(response) {
322
- return response.text();
323
- }
324
- async function readBodyPreview(response, maxChars = 200) {
325
- if (!response.body) return "";
326
- const reader = response.body.getReader();
327
- const decoder = new TextDecoder();
328
- let out = "";
329
- try {
330
- while (out.length < maxChars) {
331
- const { done, value } = await reader.read();
332
- if (done) break;
333
- out += decoder.decode(value, { stream: true });
334
- if (out.length >= maxChars) {
335
- out = out.slice(0, maxChars);
336
- break;
337
- }
338
- }
339
- } finally {
340
- await reader.cancel().catch(() => void 0);
341
- }
342
- return out;
343
- }
344
- var HttpClient = class {
345
- constructor(config) {
346
- this.config = config;
347
- }
348
- defaultHeaders() {
349
- return mergeHeaders(
350
- {
351
- Accept: "application/json",
352
- "Content-Type": "application/json",
353
- "User-Agent": USER_AGENT,
354
- "X-Modus-Client": "sdk"
355
- },
356
- this.config.defaultHeaders
357
- );
358
- }
359
- async request(method, path, options = {}) {
360
- const baseUrl = options.baseUrl ?? this.config.baseUrl;
361
- const url = buildUrl(baseUrl, path, options.params);
362
- try {
363
- const response = await this.config.fetch(url, {
364
- method,
365
- headers: mergeHeaders(this.defaultHeaders(), options.headers, authHeaders(this.config.apiKey)),
366
- body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
367
- signal: AbortSignal.timeout(this.config.timeoutMs)
368
- });
369
- const body = await readBody(response);
370
- raiseForStatus(response, body);
371
- if (response.status === 204 || !body) return null;
372
- return JSON.parse(body);
373
- } catch (error) {
374
- if (error instanceof ModusError) throw error;
375
- if (error instanceof DOMException && error.name === "AbortError") {
376
- throw wrapNetworkError(new Error("Request timed out"), baseUrl);
377
- }
378
- throw wrapNetworkError(error, baseUrl);
379
- }
380
- }
381
- get(path, params, options = {}) {
382
- return this.request("GET", path, { params, ...options });
383
- }
384
- post(path, json, options = {}) {
385
- return this.request("POST", path, { json, ...options });
386
- }
387
- put(path, json, options = {}) {
388
- return this.request("PUT", path, { json, ...options });
389
- }
390
- patch(path, json, params, options = {}) {
391
- return this.request("PATCH", path, { json, params, ...options });
392
- }
393
- delete(path, options = {}) {
394
- return this.request("DELETE", path, options);
395
- }
396
- async *stream(method, path, options = {}) {
397
- const baseUrl = options.baseUrl ?? this.config.baseUrl;
398
- const url = buildUrl(baseUrl, path, options.params);
399
- try {
400
- const response = await this.config.fetch(url, {
401
- method,
402
- // Agent-service negotiates SSE vs JSON polling on Accept; JSON-only
403
- // Accept returns {"runId","status":"pending"} instead of token SSE.
404
- headers: mergeHeaders(
405
- this.defaultHeaders(),
406
- options.headers,
407
- { Accept: "text/event-stream" },
408
- authHeaders(this.config.apiKey)
409
- ),
410
- body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
411
- signal: AbortSignal.timeout(this.config.timeoutMs)
412
- });
413
- if (!response.ok) {
414
- const body = await readBody(response);
415
- raiseForStatus(response, body);
416
- return;
417
- }
418
- const contentType = response.headers.get("content-type") ?? "";
419
- if (!contentType.toLowerCase().includes("text/event-stream")) {
420
- const preview = await readBodyPreview(response);
421
- throw new ModusError(
422
- `Unexpected stream response: expected Content-Type text/event-stream, got ${JSON.stringify(contentType) || "(missing)"}. Body preview: ${preview}`,
423
- { statusCode: response.status, body: preview }
424
- );
425
- }
426
- if (!response.body) return;
427
- const reader = response.body.getReader();
428
- const decoder = new TextDecoder();
429
- let buffer = "";
430
- while (true) {
431
- const { done, value } = await reader.read();
432
- if (done) break;
433
- buffer += decoder.decode(value, { stream: true });
434
- const lines = buffer.split("\n");
435
- buffer = lines.pop() ?? "";
436
- for (const line of lines) {
437
- if (line.trim()) yield line;
438
- }
439
- }
440
- if (buffer.trim()) yield buffer;
441
- } catch (error) {
442
- if (error instanceof ModusError) throw error;
443
- if (error instanceof DOMException && error.name === "AbortError") {
444
- throw wrapNetworkError(new Error("Request timed out"), baseUrl);
445
- }
446
- throw wrapNetworkError(error, baseUrl);
447
- }
448
- }
449
- streamGet(path, params, options = {}) {
450
- return this.stream("GET", path, { params, ...options });
451
- }
452
- streamPost(path, json, options = {}) {
453
- return this.stream("POST", path, { json, ...options });
454
- }
455
- };
456
7
 
457
- // src/_client-base.ts
458
- var ModusClientBase = class {
459
- constructor(options = {}) {
460
- this._config = createModusConfig(options);
461
- this._http = new HttpClient(this._config);
462
- }
463
- get config() {
464
- return this._config;
465
- }
466
- /** @internal */
467
- get http() {
468
- return this._http;
469
- }
470
- toString() {
471
- return formatConfigForLog(this._config);
472
- }
473
- };
474
-
475
- // src/_pagination.ts
476
- var Page = class {
477
- constructor(items, nextPageToken, fetchPage) {
478
- this.items = items;
479
- this.nextPageToken = normalizePageToken(nextPageToken);
480
- this.fetchPage = fetchPage;
481
- }
482
- /**
483
- * Whether another page of results is available.
484
- *
485
- * @returns `true` when {@link Page.nextPageToken} is set.
486
- */
487
- hasNextPage() {
488
- return this.nextPageToken !== void 0;
489
- }
490
- /**
491
- * Fetch the next page using {@link Page.nextPageToken}.
492
- *
493
- * @returns The following page of results.
494
- * @throws {Error} When there is no next page. Check {@link Page.hasNextPage} first.
495
- */
496
- async getNextPage() {
497
- if (this.nextPageToken === void 0) {
498
- throw new Error(
499
- "No next page available. Check hasNextPage() before calling getNextPage()."
500
- );
501
- }
502
- return this.fetchPage(this.nextPageToken);
503
- }
504
- /**
505
- * Async-iterate over all items across every page, fetching additional pages as needed.
506
- *
507
- * @returns An async generator yielding every item in the result set.
508
- * @throws {ModusError} When a follow-up page request fails.
509
- */
510
- async *autoPagingIter() {
511
- for (const item of this.items) yield item;
512
- let nextPageToken = this.nextPageToken;
513
- while (nextPageToken !== void 0) {
514
- const page = await this.fetchPage(nextPageToken);
515
- for (const item of page.items) yield item;
516
- nextPageToken = page.nextPageToken;
517
- }
518
- }
519
- /** Iterate over the current page's items only. */
520
- [Symbol.iterator]() {
521
- return this.items[Symbol.iterator]();
522
- }
523
- };
524
- function normalizePageToken(token) {
525
- if (token === void 0 || token === null || !String(token).trim()) return void 0;
526
- return token;
527
- }
528
- function aipListParams(pageSize, pageToken, extra = {}) {
529
- const params = { pageSize, ...extra };
530
- const token = normalizePageToken(pageToken);
531
- if (token !== void 0) params.pageToken = token;
532
- return params;
533
- }
534
- function nextPageTokenFromResponse(data) {
535
- return normalizePageToken(
536
- typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
537
- );
538
- }
539
- function requireItemsList(data, itemsKey) {
540
- const value = data[itemsKey];
541
- if (!Array.isArray(value)) {
542
- throw new ModusError(
543
- `Unexpected list response shape: ${itemsKey} must be a list, got ${typeof value}. This is likely a backend error.`
544
- );
545
- }
546
- return value;
547
- }
548
- function buildAipPage(data, itemsKey, mapItem, fetchPage) {
549
- if (typeof data !== "object" || data === null || !(itemsKey in data)) {
550
- throw new ModusError(
551
- `Unexpected list response shape: missing ${itemsKey}. Got: ${typeof data}. This is likely a backend error.`
552
- );
553
- }
554
- const items = requireItemsList(data, itemsKey).map(mapItem);
555
- return new Page(items, nextPageTokenFromResponse(data), fetchPage);
556
- }
557
8
 
558
- // src/_generated/operations.ts
559
- var OPERATIONS = {
560
- "ConnectionsController_list": {
561
- method: "GET",
562
- path: "/api/v1/connections",
563
- service: "modus-api",
564
- serverUrl: "https://api.getmodus.com",
565
- pathParams: [],
566
- queryParams: ["pageToken", "pageSize", "type"],
567
- requestSchema: null,
568
- responseSchema: "ListConnectionsResponseDto"
569
- },
570
- "ConnectionsController_listSelections": {
571
- method: "GET",
572
- path: "/api/v1/connections/{connectionId}/selections",
573
- service: "modus-api",
574
- serverUrl: "https://api.getmodus.com",
575
- pathParams: ["connectionId"],
576
- queryParams: ["pageToken", "pageSize"],
577
- requestSchema: null,
578
- responseSchema: "ListConnectionSelectionsResponseDto"
579
- },
580
- "ContextCreatorsController_createLink": {
581
- method: "POST",
582
- path: "/api/v1/context/links",
583
- service: "modus-api",
584
- serverUrl: "https://api.getmodus.com",
585
- pathParams: [],
586
- queryParams: [],
587
- requestSchema: "CreateLinkDto",
588
- responseSchema: "CreatedContextItemResponseDto"
589
- },
590
- "ContextCreatorsController_createNote": {
591
- method: "POST",
592
- path: "/api/v1/context/notes",
593
- service: "modus-api",
594
- serverUrl: "https://api.getmodus.com",
595
- pathParams: [],
596
- queryParams: [],
597
- requestSchema: "CreateNoteDto",
598
- responseSchema: "CreatedContextItemResponseDto"
599
- },
600
- "ContextCreatorsController_createSavedQuery": {
601
- method: "POST",
602
- path: "/api/v1/context/saved-queries",
603
- service: "modus-api",
604
- serverUrl: "https://api.getmodus.com",
605
- pathParams: [],
606
- queryParams: [],
607
- requestSchema: "CreateSavedQueryDto",
608
- responseSchema: "CreatedContextItemResponseDto"
609
- },
610
- "ContextFilesController_finalize": {
611
- method: "POST",
612
- path: "/api/v1/context/files/{uploadId}/finalize",
613
- service: "modus-api",
614
- serverUrl: "https://api.getmodus.com",
615
- pathParams: ["uploadId"],
616
- queryParams: [],
617
- requestSchema: "FinalizeUploadDto",
618
- responseSchema: "FileUploadResourceDto"
619
- },
620
- "ContextFilesController_finalizeMany": {
621
- method: "POST",
622
- path: "/api/v1/context/files/finalize",
623
- service: "modus-api",
624
- serverUrl: "https://api.getmodus.com",
625
- pathParams: [],
626
- queryParams: [],
627
- requestSchema: "BulkFinalizeDto",
628
- responseSchema: "BulkFinalizeResponseDto"
629
- },
630
- "ContextFilesController_get": {
631
- method: "GET",
632
- path: "/api/v1/context/files/{uploadId}",
633
- service: "modus-api",
634
- serverUrl: "https://api.getmodus.com",
635
- pathParams: ["uploadId"],
636
- queryParams: [],
637
- requestSchema: null,
638
- responseSchema: "FileUploadResourceDto"
639
- },
640
- "ContextFilesController_list": {
641
- method: "GET",
642
- path: "/api/v1/context/files",
643
- service: "modus-api",
644
- serverUrl: "https://api.getmodus.com",
645
- pathParams: [],
646
- queryParams: ["pageToken", "pageSize"],
647
- requestSchema: null,
648
- responseSchema: "ListFilesResponseDto"
649
- },
650
- "ContextFilesController_uploadFromUrl": {
651
- method: "POST",
652
- path: "/api/v1/context/files/uploadFromUrl",
653
- service: "modus-api",
654
- serverUrl: "https://api.getmodus.com",
655
- pathParams: [],
656
- queryParams: [],
657
- requestSchema: "UploadFromUrlDto",
658
- responseSchema: "FileUploadResourceDto"
659
- },
660
- "ContextFilesController_uploadFromUrls": {
661
- method: "POST",
662
- path: "/api/v1/context/files/uploadFromUrls",
663
- service: "modus-api",
664
- serverUrl: "https://api.getmodus.com",
665
- pathParams: [],
666
- queryParams: [],
667
- requestSchema: "BulkUploadFromUrlsDto",
668
- responseSchema: "BulkUploadFromUrlsResponseDto"
669
- },
670
- "ContextFilesController_uploadUrl": {
671
- method: "POST",
672
- path: "/api/v1/context/files/uploadUrl",
673
- service: "modus-api",
674
- serverUrl: "https://api.getmodus.com",
675
- pathParams: [],
676
- queryParams: [],
677
- requestSchema: "UploadUrlDto",
678
- responseSchema: "UploadUrlResponseDto"
679
- },
680
- "ContextFilesController_uploadUrls": {
681
- method: "POST",
682
- path: "/api/v1/context/files/uploadUrls",
683
- service: "modus-api",
684
- serverUrl: "https://api.getmodus.com",
685
- pathParams: [],
686
- queryParams: [],
687
- requestSchema: "BulkUploadUrlsDto",
688
- responseSchema: "BulkUploadUrlsResponseDto"
689
- },
690
- "ContextItemsController_delete": {
691
- method: "DELETE",
692
- path: "/api/v1/context/items/{uid}",
693
- service: "modus-api",
694
- serverUrl: "https://api.getmodus.com",
695
- pathParams: ["uid"],
696
- queryParams: [],
697
- requestSchema: null,
698
- responseSchema: "DeleteContextItemResponseDto"
699
- },
700
- "ContextItemsController_get": {
701
- method: "GET",
702
- path: "/api/v1/context/items/{uid}",
703
- service: "modus-api",
704
- serverUrl: "https://api.getmodus.com",
705
- pathParams: ["uid"],
706
- queryParams: [],
707
- requestSchema: null,
708
- responseSchema: "ContextItemDto"
709
- },
710
- "ContextItemsController_list": {
711
- method: "GET",
712
- path: "/api/v1/context/items",
713
- service: "modus-api",
714
- serverUrl: "https://api.getmodus.com",
715
- pathParams: [],
716
- queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics", "connectionIds", "parentUids", "ancestorUids"],
717
- requestSchema: null,
718
- responseSchema: "ListContextItemsResponseDto"
719
- },
720
- "ContextItemsController_listValues": {
721
- method: "GET",
722
- path: "/api/v1/context/items/{uid}/values",
723
- service: "modus-api",
724
- serverUrl: "https://api.getmodus.com",
725
- pathParams: ["uid"],
726
- queryParams: ["contextType", "contentKeyPath", "pageSize", "offset", "pageToken", "searchQuery", "dataPathPrefix"],
727
- requestSchema: null,
728
- responseSchema: "ListContextItemValuesResponseDto"
729
- },
730
- "ContextItemsController_lookup": {
731
- method: "POST",
732
- path: "/api/v1/context/items/lookup",
733
- service: "modus-api",
734
- serverUrl: "https://api.getmodus.com",
735
- pathParams: [],
736
- queryParams: [],
737
- requestSchema: "LookupContextItemDto",
738
- responseSchema: "LookupContextItemResponseDto"
739
- },
740
- "ContextItemsController_move": {
741
- method: "POST",
742
- path: "/api/v1/context/items/{uid}/move",
743
- service: "modus-api",
744
- serverUrl: "https://api.getmodus.com",
745
- pathParams: ["uid"],
746
- queryParams: [],
747
- requestSchema: "MoveContextItemDto",
748
- responseSchema: "MoveContextItemResponseDto"
749
- },
750
- "ContextItemsController_update": {
751
- method: "PATCH",
752
- path: "/api/v1/context/items/{uid}",
753
- service: "modus-api",
754
- serverUrl: "https://api.getmodus.com",
755
- pathParams: ["uid"],
756
- queryParams: ["updateMask"],
757
- requestSchema: "UpdateContextItemDto",
758
- responseSchema: null
759
- },
760
- "CustomContextItemsController_batchCreate": {
761
- method: "POST",
762
- path: "/api/v1/context/custom-items/batch",
763
- service: "modus-api",
764
- serverUrl: "https://api.getmodus.com",
765
- pathParams: [],
766
- queryParams: [],
767
- requestSchema: "BatchCreateCustomContextItemsDto",
768
- responseSchema: "BatchCreateCustomContextItemsResponseDto"
769
- },
770
- "CustomContextItemsController_create": {
771
- method: "POST",
772
- path: "/api/v1/context/custom-items",
773
- service: "modus-api",
774
- serverUrl: "https://api.getmodus.com",
775
- pathParams: [],
776
- queryParams: [],
777
- requestSchema: "CreateCustomContextItemDto",
778
- responseSchema: "CreatedCustomContextItemResponseDto"
779
- },
780
- "CustomContextItemsController_createRelations": {
781
- method: "POST",
782
- path: "/api/v1/context/custom-items/relations",
783
- service: "modus-api",
784
- serverUrl: "https://api.getmodus.com",
785
- pathParams: [],
786
- queryParams: [],
787
- requestSchema: "BatchCreateCustomContextItemRelationsDto",
788
- responseSchema: "BatchCreateCustomContextItemRelationsResponseDto"
789
- },
790
- "CustomContextItemsController_delete": {
791
- method: "DELETE",
792
- path: "/api/v1/context/custom-items/{uid}",
793
- service: "modus-api",
794
- serverUrl: "https://api.getmodus.com",
795
- pathParams: ["uid"],
796
- queryParams: [],
797
- requestSchema: null,
798
- responseSchema: "DeleteContextItemResponseDto"
799
- },
800
- "CustomContextItemsController_get": {
801
- method: "GET",
802
- path: "/api/v1/context/custom-items/{uid}",
803
- service: "modus-api",
804
- serverUrl: "https://api.getmodus.com",
805
- pathParams: ["uid"],
806
- queryParams: [],
807
- requestSchema: null,
808
- responseSchema: "ContextItemDto"
809
- },
810
- "CustomContextItemsController_list": {
811
- method: "GET",
812
- path: "/api/v1/context/custom-items",
813
- service: "modus-api",
814
- serverUrl: "https://api.getmodus.com",
815
- pathParams: [],
816
- queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
817
- requestSchema: null,
818
- responseSchema: "ListCustomContextItemsResponseDto"
819
- },
820
- "CustomContextItemsController_update": {
821
- method: "PATCH",
822
- path: "/api/v1/context/custom-items/{uid}",
823
- service: "modus-api",
824
- serverUrl: "https://api.getmodus.com",
825
- pathParams: ["uid"],
826
- queryParams: [],
827
- requestSchema: "UpdateCustomContextItemDto",
828
- responseSchema: null
829
- },
830
- "DashboardsController_acceptOwnership": {
831
- method: "POST",
832
- path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership/accept",
833
- service: "modus-api",
834
- serverUrl: "https://api.getmodus.com",
835
- pathParams: ["dashboardId"],
836
- queryParams: [],
837
- requestSchema: null,
838
- responseSchema: "DashboardDto"
839
- },
840
- "DashboardsController_cancelOwnership": {
841
- method: "DELETE",
842
- path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership",
843
- service: "modus-api",
844
- serverUrl: "https://api.getmodus.com",
845
- pathParams: ["dashboardId"],
846
- queryParams: [],
847
- requestSchema: null,
848
- responseSchema: "DashboardDto"
849
- },
850
- "DashboardsController_create": {
851
- method: "POST",
852
- path: "/api/v1/context/dashboards",
853
- service: "modus-api",
854
- serverUrl: "https://api.getmodus.com",
855
- pathParams: [],
856
- queryParams: [],
857
- requestSchema: "CreateDashboardDto",
858
- responseSchema: "DashboardDto"
859
- },
860
- "DashboardsController_createElement": {
861
- method: "POST",
862
- path: "/api/v1/context/dashboards/{dashboardId}/elements",
863
- service: "modus-api",
864
- serverUrl: "https://api.getmodus.com",
865
- pathParams: ["dashboardId"],
866
- queryParams: [],
867
- requestSchema: "CreateDashboardElementDto",
868
- responseSchema: "DashboardElementResponseDto"
869
- },
870
- "DashboardsController_delete": {
871
- method: "DELETE",
872
- path: "/api/v1/context/dashboards/{dashboardId}",
873
- service: "modus-api",
874
- serverUrl: "https://api.getmodus.com",
875
- pathParams: ["dashboardId"],
876
- queryParams: [],
877
- requestSchema: null,
878
- responseSchema: null
879
- },
880
- "DashboardsController_get": {
881
- method: "GET",
882
- path: "/api/v1/context/dashboards/{dashboardId}",
883
- service: "modus-api",
884
- serverUrl: "https://api.getmodus.com",
885
- pathParams: ["dashboardId"],
886
- queryParams: ["view"],
887
- requestSchema: null,
888
- responseSchema: "DashboardDto"
889
- },
890
- "DashboardsController_getElement": {
891
- method: "GET",
892
- path: "/api/v1/context/dashboards/{dashboardId}/elements/{elementId}",
893
- service: "modus-api",
894
- serverUrl: "https://api.getmodus.com",
895
- pathParams: ["dashboardId", "elementId"],
896
- queryParams: [],
897
- requestSchema: null,
898
- responseSchema: "DashboardElementResponseDto"
899
- },
900
- "DashboardsController_getVersion": {
901
- method: "GET",
902
- path: "/api/v1/context/dashboards/{dashboardId}/versions/{versionId}",
903
- service: "modus-api",
904
- serverUrl: "https://api.getmodus.com",
905
- pathParams: ["dashboardId", "versionId"],
906
- queryParams: [],
907
- requestSchema: null,
908
- responseSchema: "DashboardDto"
909
- },
910
- "DashboardsController_list": {
911
- method: "GET",
912
- path: "/api/v1/context/dashboards",
913
- service: "modus-api",
914
- serverUrl: "https://api.getmodus.com",
915
- pathParams: [],
916
- queryParams: ["view"],
917
- requestSchema: null,
918
- responseSchema: "ListDashboardsResponseDto"
919
- },
920
- "DashboardsController_listDraftSnapshots": {
921
- method: "GET",
922
- path: "/api/v1/context/dashboards/{dashboardId}/draft-snapshots",
923
- service: "modus-api",
924
- serverUrl: "https://api.getmodus.com",
925
- pathParams: ["dashboardId"],
926
- queryParams: [],
927
- requestSchema: null,
928
- responseSchema: "ListDashboardDraftSnapshotsResponseDto"
929
- },
930
- "DashboardsController_listElements": {
931
- method: "GET",
932
- path: "/api/v1/context/dashboards/{dashboardId}/elements",
933
- service: "modus-api",
934
- serverUrl: "https://api.getmodus.com",
935
- pathParams: ["dashboardId"],
936
- queryParams: [],
937
- requestSchema: null,
938
- responseSchema: "DashboardElementsListResponseDto"
939
- },
940
- "DashboardsController_listVersions": {
941
- method: "GET",
942
- path: "/api/v1/context/dashboards/{dashboardId}/versions",
943
- service: "modus-api",
944
- serverUrl: "https://api.getmodus.com",
945
- pathParams: ["dashboardId"],
946
- queryParams: [],
947
- requestSchema: null,
948
- responseSchema: "ListDashboardVersionsResponseDto"
949
- },
950
- "DashboardsController_publish": {
951
- method: "POST",
952
- path: "/api/v1/context/dashboards/{dashboardId}/publish",
953
- service: "modus-api",
954
- serverUrl: "https://api.getmodus.com",
955
- pathParams: ["dashboardId"],
956
- queryParams: [],
957
- requestSchema: "PublishDashboardDto",
958
- responseSchema: "PublishDashboardResponseDto"
959
- },
960
- "DashboardsController_restore": {
961
- method: "POST",
962
- path: "/api/v1/context/dashboards/{dashboardId}/versions/{versionId}/restore",
963
- service: "modus-api",
964
- serverUrl: "https://api.getmodus.com",
965
- pathParams: ["dashboardId", "versionId"],
966
- queryParams: [],
967
- requestSchema: null,
968
- responseSchema: "DashboardDto"
969
- },
970
- "DashboardsController_transferOwnership": {
971
- method: "POST",
972
- path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership",
973
- service: "modus-api",
974
- serverUrl: "https://api.getmodus.com",
975
- pathParams: ["dashboardId"],
976
- queryParams: [],
977
- requestSchema: "TransferDashboardOwnershipDto",
978
- responseSchema: "DashboardDto"
979
- },
980
- "DashboardsController_updateAccess": {
981
- method: "PATCH",
982
- path: "/api/v1/context/dashboards/{dashboardId}/access",
983
- service: "modus-api",
984
- serverUrl: "https://api.getmodus.com",
985
- pathParams: ["dashboardId"],
986
- queryParams: [],
987
- requestSchema: "UpdateDashboardAccessDto",
988
- responseSchema: "DashboardDto"
989
- },
990
- "DashboardsController_updateDraft": {
991
- method: "PATCH",
992
- path: "/api/v1/context/dashboards/{dashboardId}/draft",
993
- service: "modus-api",
994
- serverUrl: "https://api.getmodus.com",
995
- pathParams: ["dashboardId"],
996
- queryParams: [],
997
- requestSchema: "UpdateDashboardDraftDto",
998
- responseSchema: "DashboardDto"
999
- },
1000
- "DashboardsController_updateElement": {
1001
- method: "PATCH",
1002
- path: "/api/v1/context/dashboards/{dashboardId}/elements/{elementId}",
1003
- service: "modus-api",
1004
- serverUrl: "https://api.getmodus.com",
1005
- pathParams: ["dashboardId", "elementId"],
1006
- queryParams: [],
1007
- requestSchema: "UpdateDashboardElementDto",
1008
- responseSchema: "DashboardDto"
1009
- },
1010
- "DashboardsController_updateLayout": {
1011
- method: "PATCH",
1012
- path: "/api/v1/context/dashboards/{dashboardId}/layout",
1013
- service: "modus-api",
1014
- serverUrl: "https://api.getmodus.com",
1015
- pathParams: ["dashboardId"],
1016
- queryParams: [],
1017
- requestSchema: "UpdateDashboardLayoutDto",
1018
- responseSchema: "DashboardDto"
1019
- },
1020
- "EvaluationsController_getConfig": {
1021
- method: "GET",
1022
- path: "/api/v1/scopes/{id}/evaluations/config",
1023
- service: "modus-api",
1024
- serverUrl: "https://api.getmodus.com",
1025
- pathParams: ["id"],
1026
- queryParams: [],
1027
- requestSchema: null,
1028
- responseSchema: "EvaluationConfigDto"
1029
- },
1030
- "EvaluationsController_getRun": {
1031
- method: "GET",
1032
- path: "/api/v1/scopes/{id}/evaluations/runs/{runId}",
1033
- service: "modus-api",
1034
- serverUrl: "https://api.getmodus.com",
1035
- pathParams: ["id", "runId"],
1036
- queryParams: [],
1037
- requestSchema: null,
1038
- responseSchema: "EvaluationRunWithResultsDto"
1039
- },
1040
- "EvaluationsController_listRuns": {
1041
- method: "GET",
1042
- path: "/api/v1/scopes/{id}/evaluations/runs",
1043
- service: "modus-api",
1044
- serverUrl: "https://api.getmodus.com",
1045
- pathParams: ["id"],
1046
- queryParams: ["pageSize", "pageToken"],
1047
- requestSchema: null,
1048
- responseSchema: "ListEvaluationRunsResponseDto"
1049
- },
1050
- "EvaluationsController_triggerRun": {
1051
- method: "POST",
1052
- path: "/api/v1/scopes/{id}/evaluations/runs",
1053
- service: "modus-api",
1054
- serverUrl: "https://api.getmodus.com",
1055
- pathParams: ["id"],
1056
- queryParams: [],
1057
- requestSchema: null,
1058
- responseSchema: "TriggerEvaluationRunResponseDto"
1059
- },
1060
- "EvaluationsController_updateConfig": {
1061
- method: "PUT",
1062
- path: "/api/v1/scopes/{id}/evaluations/config",
1063
- service: "modus-api",
1064
- serverUrl: "https://api.getmodus.com",
1065
- pathParams: ["id"],
1066
- queryParams: [],
1067
- requestSchema: "UpdateEvaluationConfigDto",
1068
- responseSchema: "EvaluationConfigDto"
1069
- },
1070
- "IngestedDataController_upload": {
1071
- method: "POST",
1072
- path: "/api/v1/ingested-data",
1073
- service: "modus-api",
1074
- serverUrl: "https://api.getmodus.com",
1075
- pathParams: [],
1076
- queryParams: [],
1077
- requestSchema: "CreateIngestedDataDto",
1078
- responseSchema: "CreatedIngestedDataResponseDto"
1079
- },
1080
- "MemberGroupsController_list": {
1081
- method: "GET",
1082
- path: "/api/v1/users/member-groups",
1083
- service: "modus-api",
1084
- serverUrl: "https://api.getmodus.com",
1085
- pathParams: [],
1086
- queryParams: [],
1087
- requestSchema: null,
1088
- responseSchema: "ListMemberGroupsResponseDto"
1089
- },
1090
- "ModusChatController_chat": {
1091
- method: "POST",
1092
- path: "/api/v1/modus/chat",
1093
- service: "modus-api",
1094
- serverUrl: "https://api.getmodus.com",
1095
- pathParams: [],
1096
- queryParams: [],
1097
- requestSchema: "ModusChatRequestDto",
1098
- responseSchema: "ModusChatResponseDto"
1099
- },
1100
- "ModusChatController_chatContinue": {
1101
- method: "POST",
1102
- path: "/api/v1/modus/conversations/{threadId}/chat",
1103
- service: "modus-api",
1104
- serverUrl: "https://api.getmodus.com",
1105
- pathParams: ["threadId"],
1106
- queryParams: [],
1107
- requestSchema: "ModusChatRequestDto",
1108
- responseSchema: "ModusChatResponseDto"
1109
- },
1110
- "ModusContextController_compose": {
1111
- method: "POST",
1112
- path: "/api/v1/modus/context",
1113
- service: "modus-api",
1114
- serverUrl: "https://api.getmodus.com",
1115
- pathParams: [],
1116
- queryParams: [],
1117
- requestSchema: "ModusContextRequestDto",
1118
- responseSchema: "ModusContextResponseDto"
1119
- },
1120
- "ModusConversationsController_get": {
1121
- method: "GET",
1122
- path: "/api/v1/modus/conversations/{threadId}",
1123
- service: "modus-api",
1124
- serverUrl: "https://api.getmodus.com",
1125
- pathParams: ["threadId"],
1126
- queryParams: [],
1127
- requestSchema: null,
1128
- responseSchema: "ConversationDto"
1129
- },
1130
- "ModusConversationsController_list": {
1131
- method: "GET",
1132
- path: "/api/v1/modus/conversations",
1133
- service: "modus-api",
1134
- serverUrl: "https://api.getmodus.com",
1135
- pathParams: [],
1136
- queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools", "kind"],
1137
- requestSchema: null,
1138
- responseSchema: "ListConversationsResponseDto"
1139
- },
1140
- "ModusRunsController_create": {
1141
- method: "POST",
1142
- path: "/agent/v1/modus/runs",
1143
- service: "agent-service",
1144
- serverUrl: "https://agent.getmodus.com",
1145
- pathParams: [],
1146
- queryParams: [],
1147
- requestSchema: "ModusRunDto",
1148
- responseSchema: null
1149
- },
1150
- "OrgMembersController_list": {
1151
- method: "GET",
1152
- path: "/api/v1/users/org-members",
1153
- service: "modus-api",
1154
- serverUrl: "https://api.getmodus.com",
1155
- pathParams: [],
1156
- queryParams: [],
1157
- requestSchema: null,
1158
- responseSchema: "ListOrgMembersResponseDto"
1159
- },
1160
- "ResumeRunsController_create": {
1161
- method: "POST",
1162
- path: "/agent/v1/runs/{runId}/resume",
1163
- service: "agent-service",
1164
- serverUrl: "https://agent.getmodus.com",
1165
- pathParams: ["runId"],
1166
- queryParams: [],
1167
- requestSchema: "ResumeRunDto",
1168
- responseSchema: null
1169
- },
1170
- "RunLifecycleController_active": {
1171
- method: "GET",
1172
- path: "/agent/v1/runs/active",
1173
- service: "agent-service",
1174
- serverUrl: "https://agent.getmodus.com",
1175
- pathParams: [],
1176
- queryParams: ["pageToken", "pageSize"],
1177
- requestSchema: null,
1178
- responseSchema: "ActiveRunsResponseDto"
1179
- },
1180
- "RunLifecycleController_activeBySession": {
1181
- method: "POST",
1182
- path: "/agent/v1/runs/active-by-session",
1183
- service: "agent-service",
1184
- serverUrl: "https://agent.getmodus.com",
1185
- pathParams: [],
1186
- queryParams: [],
1187
- requestSchema: "ActiveRunsBySessionDto",
1188
- responseSchema: "ActiveRunsBySessionResponseDto"
1189
- },
1190
- "RunLifecycleController_cancel": {
1191
- method: "POST",
1192
- path: "/agent/v1/runs/{runId}/cancel",
1193
- service: "agent-service",
1194
- serverUrl: "https://agent.getmodus.com",
1195
- pathParams: ["runId"],
1196
- queryParams: [],
1197
- requestSchema: "CancelRunDto",
1198
- responseSchema: null
1199
- },
1200
- "RunLifecycleController_editQueued": {
1201
- method: "POST",
1202
- path: "/agent/v1/runs/{runId}/queue-edit",
1203
- service: "agent-service",
1204
- serverUrl: "https://agent.getmodus.com",
1205
- pathParams: ["runId"],
1206
- queryParams: [],
1207
- requestSchema: "EditQueuedRunDto",
1208
- responseSchema: null
1209
- },
1210
- "RunLifecycleController_events": {
1211
- method: "GET",
1212
- path: "/agent/v1/runs/{runId}/events",
1213
- service: "agent-service",
1214
- serverUrl: "https://agent.getmodus.com",
1215
- pathParams: ["runId"],
1216
- queryParams: [],
1217
- requestSchema: null,
1218
- responseSchema: null
1219
- },
1220
- "RunLifecycleController_interrupt": {
1221
- method: "POST",
1222
- path: "/agent/v1/runs/{runId}/interrupt",
1223
- service: "agent-service",
1224
- serverUrl: "https://agent.getmodus.com",
1225
- pathParams: ["runId"],
1226
- queryParams: [],
1227
- requestSchema: "InterruptRunDto",
1228
- responseSchema: null
1229
- },
1230
- "RunLifecycleController_stream": {
1231
- method: "GET",
1232
- path: "/agent/v1/runs/{runId}/stream",
1233
- service: "agent-service",
1234
- serverUrl: "https://agent.getmodus.com",
1235
- pathParams: ["runId"],
1236
- queryParams: [],
1237
- requestSchema: null,
1238
- responseSchema: null
1239
- },
1240
- "ScopeChatController_chat": {
1241
- method: "POST",
1242
- path: "/api/v1/scopes/{id}/chat",
1243
- service: "modus-api",
1244
- serverUrl: "https://api.getmodus.com",
1245
- pathParams: ["id"],
1246
- queryParams: [],
1247
- requestSchema: "SkillChatRequestDto",
1248
- responseSchema: "SkillChatResponseDto"
1249
- },
1250
- "ScopeChatController_chatContinue": {
1251
- method: "POST",
1252
- path: "/api/v1/scopes/{id}/conversations/{threadId}/chat",
1253
- service: "modus-api",
1254
- serverUrl: "https://api.getmodus.com",
1255
- pathParams: ["id", "threadId"],
1256
- queryParams: [],
1257
- requestSchema: "SkillChatRequestDto",
1258
- responseSchema: "SkillChatResponseDto"
1259
- },
1260
- "ScopeContextController_compose": {
1261
- method: "POST",
1262
- path: "/api/v1/scopes/{id}/context",
1263
- service: "modus-api",
1264
- serverUrl: "https://api.getmodus.com",
1265
- pathParams: ["id"],
1266
- queryParams: [],
1267
- requestSchema: "ComposeSkillContextRequestDto",
1268
- responseSchema: "ComposeSkillContextResponseDto"
1269
- },
1270
- "ScopeConversationsController_get": {
1271
- method: "GET",
1272
- path: "/api/v1/scopes/{id}/conversations/{threadId}",
1273
- service: "modus-api",
1274
- serverUrl: "https://api.getmodus.com",
1275
- pathParams: ["id", "threadId"],
1276
- queryParams: ["messageLimit", "beforeMessageIndex"],
1277
- requestSchema: null,
1278
- responseSchema: "ConversationDto"
1279
- },
1280
- "ScopeConversationsController_list": {
1281
- method: "GET",
1282
- path: "/api/v1/scopes/{id}/conversations",
1283
- service: "modus-api",
1284
- serverUrl: "https://api.getmodus.com",
1285
- pathParams: ["id"],
1286
- queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools"],
1287
- requestSchema: null,
1288
- responseSchema: "ListConversationsResponseDto"
1289
- },
1290
- "ScopeInterfacesController_add": {
1291
- method: "POST",
1292
- path: "/api/v1/scopes/{id}/interfaces",
1293
- service: "modus-api",
1294
- serverUrl: "https://api.getmodus.com",
1295
- pathParams: ["id"],
1296
- queryParams: [],
1297
- requestSchema: "AddScopeInterfaceDto",
1298
- responseSchema: "ScopeInterfaceDto"
1299
- },
1300
- "ScopeInterfacesController_delete": {
1301
- method: "DELETE",
1302
- path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
1303
- service: "modus-api",
1304
- serverUrl: "https://api.getmodus.com",
1305
- pathParams: ["id", "interfaceId"],
1306
- queryParams: [],
1307
- requestSchema: null,
1308
- responseSchema: null
1309
- },
1310
- "ScopeInterfacesController_list": {
1311
- method: "GET",
1312
- path: "/api/v1/scopes/{id}/interfaces",
1313
- service: "modus-api",
1314
- serverUrl: "https://api.getmodus.com",
1315
- pathParams: ["id"],
1316
- queryParams: [],
1317
- requestSchema: null,
1318
- responseSchema: "ListScopeInterfacesResponseDto"
1319
- },
1320
- "ScopeInterfacesController_update": {
1321
- method: "PATCH",
1322
- path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
1323
- service: "modus-api",
1324
- serverUrl: "https://api.getmodus.com",
1325
- pathParams: ["id", "interfaceId"],
1326
- queryParams: ["updateMask"],
1327
- requestSchema: "UpdateScopeInterfaceDto",
1328
- responseSchema: "ScopeInterfaceDto"
1329
- },
1330
- "ScopeMemoriesController_delete": {
1331
- method: "DELETE",
1332
- path: "/api/v1/scopes/{id}/memories/{memoryId}",
1333
- service: "modus-api",
1334
- serverUrl: "https://api.getmodus.com",
1335
- pathParams: ["id", "memoryId"],
1336
- queryParams: [],
1337
- requestSchema: null,
1338
- responseSchema: null
1339
- },
1340
- "ScopeMemoriesController_list": {
1341
- method: "GET",
1342
- path: "/api/v1/scopes/{id}/memories",
1343
- service: "modus-api",
1344
- serverUrl: "https://api.getmodus.com",
1345
- pathParams: ["id"],
1346
- queryParams: ["pageToken", "pageSize", "userId", "limit"],
1347
- requestSchema: null,
1348
- responseSchema: "ListMemoriesResponseDto"
1349
- },
1350
- "ScopeMemoriesController_search": {
1351
- method: "POST",
1352
- path: "/api/v1/scopes/{id}/memories/search",
1353
- service: "modus-api",
1354
- serverUrl: "https://api.getmodus.com",
1355
- pathParams: ["id"],
1356
- queryParams: [],
1357
- requestSchema: "SearchMemoriesRequestDto",
1358
- responseSchema: "ListMemoriesResponseDto"
1359
- },
1360
- "ScopeMemoriesController_update": {
1361
- method: "PATCH",
1362
- path: "/api/v1/scopes/{id}/memories/{memoryId}",
1363
- service: "modus-api",
1364
- serverUrl: "https://api.getmodus.com",
1365
- pathParams: ["id", "memoryId"],
1366
- queryParams: ["updateMask"],
1367
- requestSchema: "UpdateMemoryRequestDto",
1368
- responseSchema: null
1369
- },
1370
- "ScopeRunsController_create": {
1371
- method: "POST",
1372
- path: "/agent/v1/scopes/{id}/runs",
1373
- service: "agent-service",
1374
- serverUrl: "https://agent.getmodus.com",
1375
- pathParams: ["id"],
1376
- queryParams: [],
1377
- requestSchema: "SkillRunDto",
1378
- responseSchema: null
1379
- },
1380
- "ScopeSupervisionController_get": {
1381
- method: "GET",
1382
- path: "/api/v1/scopes/{id}/supervision",
1383
- service: "modus-api",
1384
- serverUrl: "https://api.getmodus.com",
1385
- pathParams: ["id"],
1386
- queryParams: ["view"],
1387
- requestSchema: null,
1388
- responseSchema: "SupervisionDto"
1389
- },
1390
- "ScopeSupervisionController_set": {
1391
- method: "PUT",
1392
- path: "/api/v1/scopes/{id}/supervision",
1393
- service: "modus-api",
1394
- serverUrl: "https://api.getmodus.com",
1395
- pathParams: ["id"],
1396
- queryParams: [],
1397
- requestSchema: "SetSupervisionRequestDto",
1398
- responseSchema: "SupervisionDto"
1399
- },
1400
- "ScopeSupervisionController_setActive": {
1401
- method: "PUT",
1402
- path: "/api/v1/scopes/{id}/supervision/active",
1403
- service: "modus-api",
1404
- serverUrl: "https://api.getmodus.com",
1405
- pathParams: ["id"],
1406
- queryParams: [],
1407
- requestSchema: "SetSupervisionRequestDto",
1408
- responseSchema: "SupervisionDto"
1409
- },
1410
- "ScopesController_acceptOwnershipTransfer": {
1411
- method: "POST",
1412
- path: "/api/v1/scopes/{id}/transfer-ownership/accept",
1413
- service: "modus-api",
1414
- serverUrl: "https://api.getmodus.com",
1415
- pathParams: ["id"],
1416
- queryParams: [],
1417
- requestSchema: null,
1418
- responseSchema: "ScopeDto"
1419
- },
1420
- "ScopesController_cancelOwnershipTransfer": {
1421
- method: "DELETE",
1422
- path: "/api/v1/scopes/{id}/transfer-ownership",
1423
- service: "modus-api",
1424
- serverUrl: "https://api.getmodus.com",
1425
- pathParams: ["id"],
1426
- queryParams: [],
1427
- requestSchema: null,
1428
- responseSchema: "ScopeDto"
1429
- },
1430
- "ScopesController_create": {
1431
- method: "POST",
1432
- path: "/api/v1/scopes",
1433
- service: "modus-api",
1434
- serverUrl: "https://api.getmodus.com",
1435
- pathParams: [],
1436
- queryParams: [],
1437
- requestSchema: "CreateSkillDto",
1438
- responseSchema: "ScopeDto"
1439
- },
1440
- "ScopesController_delete": {
1441
- method: "DELETE",
1442
- path: "/api/v1/scopes/{id}",
1443
- service: "modus-api",
1444
- serverUrl: "https://api.getmodus.com",
1445
- pathParams: ["id"],
1446
- queryParams: [],
1447
- requestSchema: null,
1448
- responseSchema: null
1449
- },
1450
- "ScopesController_deploy": {
1451
- method: "POST",
1452
- path: "/api/v1/scopes/{id}/deploy",
1453
- service: "modus-api",
1454
- serverUrl: "https://api.getmodus.com",
1455
- pathParams: ["id"],
1456
- queryParams: [],
1457
- requestSchema: "DeploySkillDto",
1458
- responseSchema: "DeployResponseDto"
1459
- },
1460
- "ScopesController_get": {
1461
- method: "GET",
1462
- path: "/api/v1/scopes/{id}",
1463
- service: "modus-api",
1464
- serverUrl: "https://api.getmodus.com",
1465
- pathParams: ["id"],
1466
- queryParams: ["view"],
1467
- requestSchema: null,
1468
- responseSchema: "ScopeDto"
1469
- },
1470
- "ScopesController_getVariation": {
1471
- method: "GET",
1472
- path: "/api/v1/scopes/{id}/variations/{variationUid}",
1473
- service: "modus-api",
1474
- serverUrl: "https://api.getmodus.com",
1475
- pathParams: ["id", "variationUid"],
1476
- queryParams: [],
1477
- requestSchema: null,
1478
- responseSchema: "ScopeDto"
1479
- },
1480
- "ScopesController_list": {
1481
- method: "GET",
1482
- path: "/api/v1/scopes",
1483
- service: "modus-api",
1484
- serverUrl: "https://api.getmodus.com",
1485
- pathParams: [],
1486
- queryParams: ["pageToken", "pageSize", "view", "search", "managerId", "includeVariation"],
1487
- requestSchema: null,
1488
- responseSchema: "ListSkillsResponseDto"
1489
- },
1490
- "ScopesController_patchMcpConfig": {
1491
- method: "PATCH",
1492
- path: "/api/v1/scopes/{id}/mcp-config",
1493
- service: "modus-api",
1494
- serverUrl: "https://api.getmodus.com",
1495
- pathParams: ["id"],
1496
- queryParams: [],
1497
- requestSchema: "PatchSkillMcpConfigDto",
1498
- responseSchema: "PatchSkillMcpConfigResponseDto"
1499
- },
1500
- "ScopesController_requestOwnershipTransfer": {
1501
- method: "POST",
1502
- path: "/api/v1/scopes/{id}/transfer-ownership",
1503
- service: "modus-api",
1504
- serverUrl: "https://api.getmodus.com",
1505
- pathParams: ["id"],
1506
- queryParams: [],
1507
- requestSchema: "TransferOwnershipDto",
1508
- responseSchema: "ScopeDto"
1509
- },
1510
- "ScopesController_restore": {
1511
- method: "POST",
1512
- path: "/api/v1/scopes/{id}/restore",
1513
- service: "modus-api",
1514
- serverUrl: "https://api.getmodus.com",
1515
- pathParams: ["id"],
1516
- queryParams: [],
1517
- requestSchema: null,
1518
- responseSchema: "ScopeDto"
1519
- },
1520
- "ScopesController_update": {
1521
- method: "PATCH",
1522
- path: "/api/v1/scopes/{id}",
1523
- service: "modus-api",
1524
- serverUrl: "https://api.getmodus.com",
1525
- pathParams: ["id"],
1526
- queryParams: ["updateMask"],
1527
- requestSchema: "UpdateSkillDto",
1528
- responseSchema: "ScopeDto"
1529
- },
1530
- "SuggestionsController_listApproved": {
1531
- method: "GET",
1532
- path: "/api/v1/suggestions/questions",
1533
- service: "modus-api",
1534
- serverUrl: "https://api.getmodus.com",
1535
- pathParams: [],
1536
- queryParams: ["pageToken", "pageSize", "scopeId", "scopeIds"],
1537
- requestSchema: null,
1538
- responseSchema: "ListSuggestionQuestionsResponseDto"
1539
- },
1540
- "SuggestionsController_recordEvent": {
1541
- method: "POST",
1542
- path: "/api/v1/suggestions/questions/{id}/events",
1543
- service: "modus-api",
1544
- serverUrl: "https://api.getmodus.com",
1545
- pathParams: ["id"],
1546
- queryParams: [],
1547
- requestSchema: "RecordSuggestionEventDto",
1548
- responseSchema: null
1549
- },
1550
- "ToolsController_list": {
1551
- method: "GET",
1552
- path: "/api/v1/tools",
1553
- service: "modus-api",
1554
- serverUrl: "https://api.getmodus.com",
1555
- pathParams: [],
1556
- queryParams: ["pageToken", "pageSize"],
1557
- requestSchema: null,
1558
- responseSchema: "ListToolsResponseDto"
1559
- },
1560
- "UsageController_list": {
1561
- method: "GET",
1562
- path: "/api/v1/usage",
1563
- service: "modus-api",
1564
- serverUrl: "https://api.getmodus.com",
1565
- pathParams: [],
1566
- queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface", "user_email"],
1567
- requestSchema: null,
1568
- responseSchema: "ListUsageResponseDto"
1569
- },
1570
- "UsageController_listUsers": {
1571
- method: "GET",
1572
- path: "/api/v1/usage/users",
1573
- service: "modus-api",
1574
- serverUrl: "https://api.getmodus.com",
1575
- pathParams: [],
1576
- queryParams: ["since", "until"],
1577
- requestSchema: null,
1578
- responseSchema: "ListUsageUsersResponseDto"
1579
- },
1580
- "WorkflowActionsController_cancel": {
1581
- method: "POST",
1582
- path: "/agent/v1/workflow-actions/{runId}/cancel",
1583
- service: "agent-service",
1584
- serverUrl: "https://agent.getmodus.com",
1585
- pathParams: ["runId"],
1586
- queryParams: [],
1587
- requestSchema: "CancelRunDto",
1588
- responseSchema: null
1589
- },
1590
- "WorkflowActionsController_execute": {
1591
- method: "POST",
1592
- path: "/agent/v1/workflow-actions",
1593
- service: "agent-service",
1594
- serverUrl: "https://agent.getmodus.com",
1595
- pathParams: [],
1596
- queryParams: [],
1597
- requestSchema: "WorkflowActionDto",
1598
- responseSchema: null
1599
- },
1600
- "WorkflowInterfacesController_add": {
1601
- method: "POST",
1602
- path: "/api/v1/workflows/{id}/interfaces",
1603
- service: "modus-api",
1604
- serverUrl: "https://api.getmodus.com",
1605
- pathParams: ["id"],
1606
- queryParams: [],
1607
- requestSchema: "AddAgentInterfaceDto",
1608
- responseSchema: "AgentInterfaceDto"
1609
- },
1610
- "WorkflowInterfacesController_delete": {
1611
- method: "DELETE",
1612
- path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
1613
- service: "modus-api",
1614
- serverUrl: "https://api.getmodus.com",
1615
- pathParams: ["id", "interfaceId"],
1616
- queryParams: [],
1617
- requestSchema: null,
1618
- responseSchema: null
1619
- },
1620
- "WorkflowInterfacesController_deleteAll": {
1621
- method: "DELETE",
1622
- path: "/api/v1/workflows/{id}/interfaces",
1623
- service: "modus-api",
1624
- serverUrl: "https://api.getmodus.com",
1625
- pathParams: ["id"],
1626
- queryParams: [],
1627
- requestSchema: null,
1628
- responseSchema: null
1629
- },
1630
- "WorkflowInterfacesController_list": {
1631
- method: "GET",
1632
- path: "/api/v1/workflows/{id}/interfaces",
1633
- service: "modus-api",
1634
- serverUrl: "https://api.getmodus.com",
1635
- pathParams: ["id"],
1636
- queryParams: [],
1637
- requestSchema: null,
1638
- responseSchema: "ListAgentInterfacesResponseDto"
1639
- },
1640
- "WorkflowInterfacesController_update": {
1641
- method: "PATCH",
1642
- path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
1643
- service: "modus-api",
1644
- serverUrl: "https://api.getmodus.com",
1645
- pathParams: ["id", "interfaceId"],
1646
- queryParams: ["updateMask"],
1647
- requestSchema: "UpdateAgentInterfaceDto",
1648
- responseSchema: "AgentInterfaceDto"
1649
- },
1650
- "WorkflowRunsController_create": {
1651
- method: "POST",
1652
- path: "/agent/v1/workflows/{id}/runs",
1653
- service: "agent-service",
1654
- serverUrl: "https://agent.getmodus.com",
1655
- pathParams: ["id"],
1656
- queryParams: [],
1657
- requestSchema: "AgentRunDto",
1658
- responseSchema: null
1659
- },
1660
- "WorkflowRunsController_get": {
1661
- method: "GET",
1662
- path: "/api/v1/workflows/{id}/runs/{runId}",
1663
- service: "modus-api",
1664
- serverUrl: "https://api.getmodus.com",
1665
- pathParams: ["id", "runId"],
1666
- queryParams: ["temporalRunId"],
1667
- requestSchema: null,
1668
- responseSchema: "GetAutomationRunResponseDto"
1669
- },
1670
- "WorkflowRunsController_list": {
1671
- method: "GET",
1672
- path: "/api/v1/workflows/{id}/runs",
1673
- service: "modus-api",
1674
- serverUrl: "https://api.getmodus.com",
1675
- pathParams: ["id"],
1676
- queryParams: ["status", "timeframe", "approvalScope", "search", "pageSize", "pageToken"],
1677
- requestSchema: null,
1678
- responseSchema: "ListAutomationRunsResponseDto"
1679
- },
1680
- "WorkflowsController_acceptOwnershipTransfer": {
1681
- method: "POST",
1682
- path: "/api/v1/workflows/{id}/transfer-ownership/accept",
1683
- service: "modus-api",
1684
- serverUrl: "https://api.getmodus.com",
1685
- pathParams: ["id"],
1686
- queryParams: [],
1687
- requestSchema: null,
1688
- responseSchema: "WorkflowDto"
1689
- },
1690
- "WorkflowsController_cancelOwnershipTransfer": {
1691
- method: "DELETE",
1692
- path: "/api/v1/workflows/{id}/transfer-ownership",
1693
- service: "modus-api",
1694
- serverUrl: "https://api.getmodus.com",
1695
- pathParams: ["id"],
1696
- queryParams: [],
1697
- requestSchema: null,
1698
- responseSchema: "WorkflowDto"
1699
- },
1700
- "WorkflowsController_create": {
1701
- method: "POST",
1702
- path: "/api/v1/workflows",
1703
- service: "modus-api",
1704
- serverUrl: "https://api.getmodus.com",
1705
- pathParams: [],
1706
- queryParams: [],
1707
- requestSchema: "CreateAgentDto",
1708
- responseSchema: "WorkflowDto"
1709
- },
1710
- "WorkflowsController_delete": {
1711
- method: "DELETE",
1712
- path: "/api/v1/workflows/{id}",
1713
- service: "modus-api",
1714
- serverUrl: "https://api.getmodus.com",
1715
- pathParams: ["id"],
1716
- queryParams: [],
1717
- requestSchema: null,
1718
- responseSchema: null
1719
- },
1720
- "WorkflowsController_deploy": {
1721
- method: "POST",
1722
- path: "/api/v1/workflows/{id}/deploy",
1723
- service: "modus-api",
1724
- serverUrl: "https://api.getmodus.com",
1725
- pathParams: ["id"],
1726
- queryParams: [],
1727
- requestSchema: "DeployAgentDto",
1728
- responseSchema: "AgentDeployResponseDto"
1729
- },
1730
- "WorkflowsController_get": {
1731
- method: "GET",
1732
- path: "/api/v1/workflows/{id}",
1733
- service: "modus-api",
1734
- serverUrl: "https://api.getmodus.com",
1735
- pathParams: ["id"],
1736
- queryParams: ["view"],
1737
- requestSchema: null,
1738
- responseSchema: "WorkflowDto"
1739
- },
1740
- "WorkflowsController_list": {
1741
- method: "GET",
1742
- path: "/api/v1/workflows",
1743
- service: "modus-api",
1744
- serverUrl: "https://api.getmodus.com",
1745
- pathParams: [],
1746
- queryParams: ["pageToken", "pageSize", "view", "type", "search", "includeVariation"],
1747
- requestSchema: null,
1748
- responseSchema: "ListAgentsResponseDto"
1749
- },
1750
- "WorkflowsController_requestOwnershipTransfer": {
1751
- method: "POST",
1752
- path: "/api/v1/workflows/{id}/transfer-ownership",
1753
- service: "modus-api",
1754
- serverUrl: "https://api.getmodus.com",
1755
- pathParams: ["id"],
1756
- queryParams: [],
1757
- requestSchema: "TransferOwnershipDto",
1758
- responseSchema: "WorkflowDto"
1759
- },
1760
- "WorkflowsController_restore": {
1761
- method: "POST",
1762
- path: "/api/v1/workflows/{id}/restore",
1763
- service: "modus-api",
1764
- serverUrl: "https://api.getmodus.com",
1765
- pathParams: ["id"],
1766
- queryParams: [],
1767
- requestSchema: null,
1768
- responseSchema: "WorkflowDto"
1769
- },
1770
- "WorkflowsController_toggle": {
1771
- method: "POST",
1772
- path: "/api/v1/workflows/{id}/toggle",
1773
- service: "modus-api",
1774
- serverUrl: "https://api.getmodus.com",
1775
- pathParams: ["id"],
1776
- queryParams: [],
1777
- requestSchema: "ToggleAgentDto",
1778
- responseSchema: "WorkflowDto"
1779
- },
1780
- "WorkflowsController_update": {
1781
- method: "PATCH",
1782
- path: "/api/v1/workflows/{id}",
1783
- service: "modus-api",
1784
- serverUrl: "https://api.getmodus.com",
1785
- pathParams: ["id"],
1786
- queryParams: ["updateMask"],
1787
- requestSchema: "UpdateAgentDto",
1788
- responseSchema: "WorkflowDto"
1789
- }
1790
- };
1791
9
 
1792
- // src/_openapi-invoke.ts
1793
- function getOperation(operationId) {
1794
- if (!(operationId in OPERATIONS)) {
1795
- throw new Error(
1796
- `Unknown API operation ${JSON.stringify(operationId)}. Upgrade @getmodus/sdk or report a version mismatch.`
1797
- );
1798
- }
1799
- return OPERATIONS[operationId];
1800
- }
1801
- function formatPath(template, pathParams) {
1802
- return template.split("/").map((segment) => {
1803
- if (!segment.startsWith("{") || !segment.endsWith("}")) return segment;
1804
- const key = segment.slice(1, -1);
1805
- if (!(key in pathParams)) {
1806
- throw new Error(`Missing path parameter ${JSON.stringify(key)} for ${JSON.stringify(template)}`);
1807
- }
1808
- return encodeURIComponent(String(pathParams[key]));
1809
- }).join("/");
1810
- }
1811
- function operationBaseUrl(http, operation) {
1812
- return resolveServiceBaseUrl(http.config, operation.service, operation.serverUrl);
1813
- }
1814
- async function invokeOperation(http, operationId, options = {}) {
1815
- const op = getOperation(operationId);
1816
- const path = formatPath(op.path, options.pathParams ?? {});
1817
- const params = options.query;
1818
- const requestOptions = {
1819
- baseUrl: operationBaseUrl(http, op),
1820
- headers: options.headers
1821
- };
1822
- switch (op.method) {
1823
- case "GET":
1824
- return http.get(path, params, requestOptions);
1825
- case "POST":
1826
- return http.post(path, options.jsonBody, requestOptions);
1827
- case "PUT":
1828
- return http.put(path, options.jsonBody, requestOptions);
1829
- case "PATCH":
1830
- return http.patch(path, options.jsonBody, params, requestOptions);
1831
- case "DELETE":
1832
- return http.delete(path, requestOptions);
1833
- default:
1834
- throw new Error(`Unsupported HTTP method ${JSON.stringify(op.method)}`);
1835
- }
1836
- }
1837
10
 
1838
- // src/_retry.ts
1839
- var DEPLOY_NOT_FOUND_BACKOFF_MS = 500;
1840
- var MAX_DEPLOY_NOT_FOUND_RETRIES = 1;
1841
- var RETRYABLE = [RateLimitError, InternalServerError, APIConnectionError];
1842
- function isRetryable(error) {
1843
- return RETRYABLE.some((Cls) => error instanceof Cls);
1844
- }
1845
- function backoffSeconds(attempt, error) {
1846
- if (error instanceof RateLimitError && error.retryAfter !== void 0) {
1847
- return Math.max(0, error.retryAfter);
1848
- }
1849
- if (attempt === 0) return 0;
1850
- return Math.max(0.5, 2 ** (attempt - 1) + (Math.random() * 0.6 - 0.3));
1851
- }
1852
- function sleep(ms) {
1853
- return new Promise((resolve) => setTimeout(resolve, ms));
1854
- }
1855
- async function withRetry(fn, maxRetries, options = {}) {
1856
- let deployNotFoundRetries = 0;
1857
- let attempt = 0;
1858
- while (true) {
1859
- try {
1860
- return await fn();
1861
- } catch (error) {
1862
- if (options.retryNotFoundOnDeploy && error instanceof NotFoundError && deployNotFoundRetries < MAX_DEPLOY_NOT_FOUND_RETRIES) {
1863
- deployNotFoundRetries++;
1864
- await sleep(DEPLOY_NOT_FOUND_BACKOFF_MS);
1865
- continue;
1866
- }
1867
- if (!isRetryable(error) || attempt >= maxRetries) throw error;
1868
- await sleep(backoffSeconds(attempt, error) * 1e3);
1869
- attempt++;
1870
- }
1871
- }
1872
- }
1873
11
 
1874
- // src/_generated/write-body-keys.ts
1875
- var WRITE_BODY_ALLOWED_KEYS = {
1876
- ContextCreatorsController_createLink: ["url", "title", "isCrawl", "pageLimit"],
1877
- ContextCreatorsController_createNote: ["title", "content"],
1878
- ContextCreatorsController_createSavedQuery: ["name", "connectionId", "query", "description", "path"],
1879
- ContextFilesController_finalize: ["fileName", "folderPath"],
1880
- ContextFilesController_finalizeMany: ["uploads"],
1881
- ContextFilesController_uploadFromUrl: ["url", "fileName", "folderPath"],
1882
- ContextFilesController_uploadFromUrls: ["urls"],
1883
- ContextFilesController_uploadUrl: ["fileName", "contentType", "fileSize"],
1884
- ContextFilesController_uploadUrls: ["files"],
1885
- ContextItemsController_lookup: ["contextType", "dataPath", "contentProjection"],
1886
- ContextItemsController_move: ["destinationFolderUid"],
1887
- ContextItemsController_update: ["contextType", "content", "description", "userFeedback", "topics"],
1888
- CustomContextItemsController_batchCreate: ["items"],
1889
- CustomContextItemsController_create: ["kind", "sourceId", "sourceName", "collectionId", "collectionName", "externalId", "fieldName", "name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics", "idempotencyKey", "access"],
1890
- CustomContextItemsController_createRelations: ["relations"],
1891
- CustomContextItemsController_update: ["name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics"],
1892
- DashboardsController_create: ["title", "description", "definition", "access"],
1893
- DashboardsController_createElement: ["expectedRevision", "kind", "title", "layout"],
1894
- DashboardsController_publish: ["expectedRevision"],
1895
- DashboardsController_transferOwnership: ["newOwnerUserId"],
1896
- DashboardsController_updateAccess: ["visibility", "groupPermissions", "sharedWith"],
1897
- DashboardsController_updateDraft: ["expectedRevision", "title", "description", "definition"],
1898
- DashboardsController_updateElement: ["expectedRevision", "patch"],
1899
- DashboardsController_updateLayout: ["expectedRevision", "elements"],
1900
- EvaluationsController_updateConfig: ["enabled", "cadence", "judgeModel", "judgeGuidance", "notifications"],
1901
- IngestedDataController_upload: ["integration_type", "request", "response"],
1902
- ModusChatController_chat: ["message", "model"],
1903
- ModusContextController_compose: ["message", "limit"],
1904
- ModusRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
1905
- ResumeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "decision"],
1906
- RunLifecycleController_activeBySession: ["sessionIds"],
1907
- RunLifecycleController_cancel: [],
1908
- RunLifecycleController_editQueued: [],
1909
- RunLifecycleController_interrupt: [],
1910
- ScopeChatController_chat: ["message", "model"],
1911
- ScopeContextController_compose: ["message", "limit"],
1912
- ScopeInterfacesController_add: ["type", "name", "config"],
1913
- ScopeInterfacesController_update: ["name", "config"],
1914
- ScopeMemoriesController_search: ["query", "userId", "limit"],
1915
- ScopeMemoriesController_update: ["memory", "metadata"],
1916
- ScopeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
1917
- ScopesController_acceptOwnershipTransfer: [],
1918
- ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "includeOwnLearnings", "interfaces", "accessConfig"],
1919
- ScopesController_deploy: [],
1920
- ScopesController_patchMcpConfig: ["config"],
1921
- ScopesController_requestOwnershipTransfer: ["newOwnerUserId"],
1922
- ScopesController_restore: [],
1923
- ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
1924
- ScopeSupervisionController_set: ["subordinateAgentIds"],
1925
- ScopeSupervisionController_setActive: ["subordinateAgentIds"],
1926
- SuggestionsController_recordEvent: ["eventType", "source", "skillId", "threadId", "metadata"],
1927
- WorkflowActionsController_cancel: [],
1928
- WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
1929
- WorkflowInterfacesController_add: ["type", "name", "config"],
1930
- WorkflowInterfacesController_update: ["name", "config"],
1931
- WorkflowRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId"],
1932
- WorkflowsController_acceptOwnershipTransfer: [],
1933
- WorkflowsController_create: ["name", "type", "description", "trigger", "agentSelection", "workflowStructure", "accessConfig"],
1934
- WorkflowsController_deploy: [],
1935
- WorkflowsController_requestOwnershipTransfer: ["newOwnerUserId"],
1936
- WorkflowsController_restore: [],
1937
- WorkflowsController_toggle: ["active"],
1938
- WorkflowsController_update: ["name", "type", "description", "trigger", "agentSelection", "workflowStructure", "accessConfig"]
1939
- };
1940
12
 
1941
- // src/_validation.ts
1942
- function validatePageSize(pageSize, maxPageSize) {
1943
- if (!Number.isInteger(pageSize) || pageSize < 1) {
1944
- throw new Error(`page_size must be a positive int, got ${pageSize}`);
1945
- }
1946
- if (maxPageSize !== void 0 && pageSize > maxPageSize) {
1947
- throw new Error(`page_size must be <= ${maxPageSize}, got ${pageSize}`);
1948
- }
1949
- }
1950
- function validateId(resourceId, name = "id") {
1951
- if (typeof resourceId === "string" && !resourceId.trim()) {
1952
- throw new Error(`${name} must be a non-empty string or int`);
1953
- }
1954
- }
1955
- function assertWriteBodyKeys(operationId, body) {
1956
- const allowed = WRITE_BODY_ALLOWED_KEYS[operationId];
1957
- if (allowed === void 0) return;
1958
- if (body === void 0 || body === null) return;
1959
- if (typeof body !== "object" || Array.isArray(body)) {
1960
- throw new ValidationError(`Request body must be a plain object for ${operationId}`);
1961
- }
1962
- const allowedSet = new Set(allowed);
1963
- const extra = Object.keys(body).filter((k) => !allowedSet.has(k));
1964
- if (extra.length > 0) {
1965
- throw new ValidationError(
1966
- `${operationId}: disallowed request body field(s): ${extra.sort().join(", ")}`
1967
- );
1968
- }
1969
- }
1970
13
 
1971
- // src/_request.ts
1972
- async function invokeWithRetry(config, http, operationId, options = {}) {
1973
- if (options.jsonBody !== void 0) {
1974
- assertWriteBodyKeys(operationId, options.jsonBody);
1975
- }
1976
- return withRetry(() => invokeOperation(http, operationId, options), config.maxRetries, {
1977
- retryNotFoundOnDeploy: operationId.endsWith("_deploy")
1978
- });
1979
- }
1980
- function omitUndefined(obj) {
1981
- return Object.fromEntries(
1982
- Object.entries(obj).filter((entry) => entry[1] !== void 0)
1983
- );
1984
- }
1985
- function asRecord(data) {
1986
- if (typeof data === "object" && data !== null && !Array.isArray(data)) {
1987
- return data;
1988
- }
1989
- throw new Error(`Expected object response, got ${typeof data}`);
1990
- }
14
+ var _chunk3MHHVC6Ccjs = require('../chunk-3MHHVC6C.cjs');
1991
15
 
1992
16
  // src/_generated/resources/management/workflows.ts
1993
17
  var WorkflowsResourceBase = class {
@@ -2009,8 +33,9 @@ var WorkflowsResourceBase = class {
2009
33
  * for the first page.
2010
34
  * @param options.search - Case-insensitive substring filter on workflow name.
2011
35
  * @param options.type - Filter by workflow type.
2012
- * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
2013
- * snapshot.
36
+ * @param options.view - Variation view. `active` reads the deployed version. `draft` reads the
37
+ * latest builder snapshot. `published` reads only a published workflow of type workflow that
38
+ * you can use; tasks are excluded.
2014
39
  * @param options.includeVariation - Include the requested variation payload (`trigger`,
2015
40
  * `workflowStructure`, `agentSelection`) on list rows.
2016
41
  * @returns A page of workflows.
@@ -2024,8 +49,8 @@ var WorkflowsResourceBase = class {
2024
49
  * ```
2025
50
  */
2026
51
  list(options = {}) {
2027
- const pageSize = options.pageSize ?? 25;
2028
- validatePageSize(pageSize);
52
+ const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
53
+ _chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
2029
54
  return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation);
2030
55
  }
2031
56
  async listPage(pageSize, pageToken, search, type, view, includeVariation) {
@@ -2034,12 +59,12 @@ var WorkflowsResourceBase = class {
2034
59
  if (type !== void 0) extra.type = type;
2035
60
  if (view !== void 0) extra.view = view;
2036
61
  if (includeVariation !== void 0) extra.includeVariation = includeVariation;
2037
- const data = asRecord(
2038
- await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
2039
- query: aipListParams(pageSize, pageToken, extra)
62
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
63
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_list", {
64
+ query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, extra)
2040
65
  })
2041
66
  );
2042
- return buildAipPage(
67
+ return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
2043
68
  data,
2044
69
  "workflows",
2045
70
  (raw) => raw,
@@ -2050,7 +75,7 @@ var WorkflowsResourceBase = class {
2050
75
  * Delete a workflow.
2051
76
  *
2052
77
  * Deletes a workflow and stops its schedule. The workflow can be restored later with POST
2053
- * /workflows/{id}/restore. Deleting an already-deleted workflow is a no-op.
78
+ * /workflows/{id}/restore. Returns 404 if the workflow does not exist or is already deleted.
2054
79
  *
2055
80
  * **Requires:** `workflows:write`
2056
81
  *
@@ -2063,8 +88,8 @@ var WorkflowsResourceBase = class {
2063
88
  * ```
2064
89
  */
2065
90
  async delete(workflowId) {
2066
- validateId(workflowId, "workflow_id");
2067
- await invokeWithRetry(this.config, this.http, "WorkflowsController_delete", {
91
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
92
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_delete", {
2068
93
  pathParams: { id: workflowId }
2069
94
  });
2070
95
  }
@@ -2080,8 +105,8 @@ var WorkflowsResourceBase = class {
2080
105
  * @param workflowId - Numeric workflow id.
2081
106
  */
2082
107
  async restore(workflowId) {
2083
- validateId(workflowId, "workflow_id");
2084
- const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_restore", {
108
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
109
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_restore", {
2085
110
  pathParams: { id: workflowId },
2086
111
  jsonBody: {}
2087
112
  });
@@ -2098,8 +123,8 @@ var WorkflowsResourceBase = class {
2098
123
  * @param workflowId - Numeric workflow id.
2099
124
  */
2100
125
  async cancelOwnershipTransfer(workflowId) {
2101
- validateId(workflowId, "workflow_id");
2102
- const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_cancelOwnershipTransfer", {
126
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
127
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_cancelOwnershipTransfer", {
2103
128
  pathParams: { id: workflowId }
2104
129
  });
2105
130
  return data;
@@ -2114,8 +139,8 @@ var WorkflowsResourceBase = class {
2114
139
  * @param workflowId - Numeric workflow id.
2115
140
  */
2116
141
  async acceptOwnershipTransfer(workflowId) {
2117
- validateId(workflowId, "workflow_id");
2118
- const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_acceptOwnershipTransfer", {
142
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
143
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_acceptOwnershipTransfer", {
2119
144
  pathParams: { id: workflowId },
2120
145
  jsonBody: {}
2121
146
  });
@@ -2127,42 +152,19 @@ var WorkflowsResourceBase = class {
2127
152
  function updateMaskQuery(updateMask) {
2128
153
  if (updateMask === void 0) return void 0;
2129
154
  if (!updateMask.trim()) {
2130
- throw new Error("update_mask must be a non-empty comma-separated list of field names");
155
+ throw new (0, _chunk3MHHVC6Ccjs.ValidationError)("update_mask must be a non-empty comma-separated list of field names");
2131
156
  }
2132
157
  return { updateMask };
2133
158
  }
2134
-
2135
- // src/management/_access-config.ts
2136
- var EVERYONE_GROUP_ID = "__everyone__";
2137
- function accessConfigWireForCreate(guardrails) {
2138
- return {
2139
- visibility: "shared",
2140
- groupPermissions: { [EVERYONE_GROUP_ID]: { use: true, manage: true } },
2141
- guardrails,
2142
- sharedWith: []
2143
- };
2144
- }
2145
- function accessConfigWireForUpdate(existing, guardrails) {
2146
- if (!existing || Object.keys(existing).length === 0) {
2147
- return accessConfigWireForCreate(guardrails);
2148
- }
2149
- return { ...existing, guardrails };
2150
- }
2151
- function accessFromSkillResponse(raw) {
2152
- const value = raw.accessConfig ?? raw.access_config;
2153
- if (value && typeof value === "object" && !Array.isArray(value)) {
2154
- return value;
159
+ function updateBody(fields, updateMask) {
160
+ const body = Object.fromEntries(
161
+ Object.entries(fields).filter(([, value]) => value !== void 0)
162
+ );
163
+ for (const field of _nullishCoalesce(_optionalChain([updateMask, 'optionalAccess', _2 => _2.split, 'call', _3 => _3(",")]), () => ( []))) {
164
+ const name = field.trim();
165
+ if (name && !name.includes(".") && !(name in body)) body[name] = null;
2155
166
  }
2156
- return {};
2157
- }
2158
- function accessConfigBodyForCreate(guardrails) {
2159
- if (guardrails === void 0) return void 0;
2160
- return accessConfigWireForCreate(guardrails);
2161
- }
2162
- async function accessConfigBodyForUpdate(guardrails, loadResource) {
2163
- if (guardrails === void 0) return void 0;
2164
- const existing = accessFromSkillResponse(await loadResource());
2165
- return accessConfigWireForUpdate(existing, guardrails);
167
+ return body;
2166
168
  }
2167
169
 
2168
170
  // src/_generated/resources/management/workflows/interfaces.ts
@@ -2177,13 +179,13 @@ var WorkflowsInterfacesResourceBase = class {
2177
179
  * List interfaces attached to a workflow.
2178
180
  *
2179
181
  * Returns every Slack, MCP, or Teams interface bound to the workflow. Requires manage permission
2180
- * on the workflow.
182
+ * on the workflow: returns 403 if you can only use it, and 404 if you cannot access it.
2181
183
  *
2182
184
  * **Requires:** `workflows:read`
2183
185
  */
2184
186
  async list() {
2185
- validateId(this.workflowId, "workflow_id");
2186
- const data = await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_list", {
187
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.workflowId, "workflow_id");
188
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowInterfacesController_list", {
2187
189
  pathParams: { id: this.workflowId }
2188
190
  });
2189
191
  return data.interfaces;
@@ -2197,8 +199,8 @@ var WorkflowsInterfacesResourceBase = class {
2197
199
  * **Requires:** `workflows:write`
2198
200
  */
2199
201
  async deleteAll() {
2200
- validateId(this.workflowId, "workflow_id");
2201
- await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_deleteAll", {
202
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.workflowId, "workflow_id");
203
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowInterfacesController_deleteAll", {
2202
204
  pathParams: { id: this.workflowId }
2203
205
  });
2204
206
  }
@@ -2212,9 +214,9 @@ var WorkflowsInterfacesResourceBase = class {
2212
214
  * @param interfaceId - Interface row id (UUID).
2213
215
  */
2214
216
  async delete(interfaceId) {
2215
- validateId(this.workflowId, "workflow_id");
2216
- validateId(interfaceId, "interface_id");
2217
- await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_delete", {
217
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.workflowId, "workflow_id");
218
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, interfaceId, "interface_id");
219
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowInterfacesController_delete", {
2218
220
  pathParams: { id: this.workflowId, interfaceId }
2219
221
  });
2220
222
  }
@@ -2229,10 +231,10 @@ var WorkflowInterfacesResource = class extends WorkflowsInterfacesResourceBase {
2229
231
  * @returns The created interface.
2230
232
  */
2231
233
  async create(options) {
2232
- validateId(this.workflowId, "workflow_id");
2233
- return await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_add", {
234
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.workflowId, "workflow_id");
235
+ return await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowInterfacesController_add", {
2234
236
  pathParams: { id: this.workflowId },
2235
- jsonBody: omitUndefined(options)
237
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, options)
2236
238
  });
2237
239
  }
2238
240
  /**
@@ -2244,12 +246,12 @@ var WorkflowInterfacesResource = class extends WorkflowsInterfacesResourceBase {
2244
246
  * @returns The updated interface.
2245
247
  */
2246
248
  async update(interfaceId, options, updateMask) {
2247
- validateId(this.workflowId, "workflow_id");
2248
- validateId(interfaceId, "interface_id");
2249
- return await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_update", {
249
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.workflowId, "workflow_id");
250
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, interfaceId, "interface_id");
251
+ return await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowInterfacesController_update", {
2250
252
  pathParams: { id: this.workflowId, interfaceId },
2251
253
  query: updateMaskQuery(updateMask),
2252
- jsonBody: updateMask === void 0 ? omitUndefined(options) : options
254
+ jsonBody: updateBody(options, updateMask)
2253
255
  });
2254
256
  }
2255
257
  };
@@ -2279,20 +281,21 @@ var ManagementWorkflowsResource = class extends WorkflowsResourceBase {
2279
281
  /**
2280
282
  * Retrieve a workflow with full configuration.
2281
283
  *
2282
- * @param workflowId - Workflow id.
2283
- * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
284
+ * @param workflowId - Numeric workflow id.
285
+ * @param options.view - Variation view: `"active"` (deployed), `"draft"`, or `"published"` (published workflow you can use).
2284
286
  * @returns The workflow.
2285
287
  * @example
2286
288
  * ```ts
2287
289
  * const mgmt = new ModusManagement()
2288
- * const wf = await mgmt.workflows.get('weekly-digest')
290
+ * const [first] = (await mgmt.workflows.list()).items
291
+ * const wf = await mgmt.workflows.get(first.id)
2289
292
  * console.log(wf.name, wf.status)
2290
293
  * ```
2291
294
  */
2292
295
  async get(workflowId, options = {}) {
2293
- validateId(workflowId, "workflow_id");
296
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
2294
297
  const query = options.view !== void 0 ? { view: options.view } : void 0;
2295
- const data = await invokeWithRetry(this.config, this.http, this.ops.get, {
298
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.get, {
2296
299
  pathParams: { id: workflowId },
2297
300
  query
2298
301
  });
@@ -2311,27 +314,25 @@ var ManagementWorkflowsResource = class extends WorkflowsResourceBase {
2311
314
  * Create a new workflow in the organization.
2312
315
  *
2313
316
  * @param options.name - Display name for the workflow.
2314
- * @param options.type - `"task"` for single-step orchestration, or `"workflow"` for a multi-step graph.
317
+ * @param options.type - `"workflow"`. `"task"` is a deprecated alias the server stores as `"workflow"`.
2315
318
  * @param options.trigger - Optional trigger configuration.
2316
- * @param options.guardrails - Runtime guardrail labels (for example `"no-pii"`). Omit to create with no guardrails.
2317
319
  * @returns The created workflow (draft).
2318
320
  * @example
2319
321
  * ```ts
2320
322
  * const mgmt = new ModusManagement()
2321
- * const wf = await mgmt.workflows.create({ name: 'Daily report', type: 'task' })
323
+ * const wf = await mgmt.workflows.create({ name: 'Daily report', type: 'workflow' })
2322
324
  * ```
2323
325
  */
2324
326
  async create(options) {
2325
- const body = omitUndefined({
327
+ const body = _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, {
2326
328
  name: options.name,
2327
329
  type: options.type,
2328
330
  description: options.description,
2329
331
  trigger: options.trigger,
2330
332
  agentSelection: options.agentSelection,
2331
- workflowStructure: options.workflowStructure,
2332
- accessConfig: accessConfigBodyForCreate(options.guardrails)
333
+ workflowStructure: options.workflowStructure
2333
334
  });
2334
- const data = await invokeWithRetry(this.config, this.http, this.ops.create, {
335
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.create, {
2335
336
  jsonBody: body
2336
337
  });
2337
338
  return parseWorkflow(data);
@@ -2340,10 +341,10 @@ var ManagementWorkflowsResource = class extends WorkflowsResourceBase {
2340
341
  * Update a workflow's configuration.
2341
342
  *
2342
343
  * Only the fields you pass are changed. To clear a field, name it in
2343
- * `updateMask` and leave its argument unset.
344
+ * `updateMask` and leave its argument unset: it is sent as `null`.
2344
345
  *
2345
- * @param workflowId - Workflow id.
2346
- * @param options.guardrails - Guardrail labels to set. Fetches the current workflow first to merge. Pass `[]` to clear all.
346
+ * @param workflowId - Numeric workflow id.
347
+ * @param options.type - Only `"workflow"` is accepted; `"task"` is rejected with a 422.
2347
348
  * @param options.updateMask - Comma-separated field names to update or clear.
2348
349
  * @returns The updated workflow.
2349
350
  * @example
@@ -2353,26 +354,17 @@ var ManagementWorkflowsResource = class extends WorkflowsResourceBase {
2353
354
  * ```
2354
355
  */
2355
356
  async update(workflowId, options = {}) {
2356
- validateId(workflowId, "workflow_id");
2357
- const accessConfig = await accessConfigBodyForUpdate(
2358
- options.guardrails,
2359
- async () => asRecord(
2360
- await invokeWithRetry(this.config, this.http, this.ops.get, {
2361
- pathParams: { id: workflowId }
2362
- })
2363
- )
2364
- );
357
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
2365
358
  const fields = {
2366
359
  name: options.name,
2367
360
  type: options.type,
2368
361
  description: options.description,
2369
362
  trigger: options.trigger,
2370
363
  agentSelection: options.agentSelection,
2371
- workflowStructure: options.workflowStructure,
2372
- accessConfig
364
+ workflowStructure: options.workflowStructure
2373
365
  };
2374
- const body = options.updateMask !== void 0 ? fields : omitUndefined(fields);
2375
- const data = await invokeWithRetry(this.config, this.http, this.ops.update, {
366
+ const body = updateBody(fields, options.updateMask);
367
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.update, {
2376
368
  pathParams: { id: workflowId },
2377
369
  query: updateMaskQuery(options.updateMask),
2378
370
  jsonBody: body
@@ -2392,9 +384,9 @@ var ManagementWorkflowsResource = class extends WorkflowsResourceBase {
2392
384
  * ```
2393
385
  */
2394
386
  async deploy(workflowId) {
2395
- validateId(workflowId, "workflow_id");
2396
- const data = asRecord(
2397
- await invokeWithRetry(this.config, this.http, this.ops.deploy, {
387
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
388
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
389
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.deploy, {
2398
390
  pathParams: { id: workflowId },
2399
391
  jsonBody: {}
2400
392
  })
@@ -2409,8 +401,8 @@ var ManagementWorkflowsResource = class extends WorkflowsResourceBase {
2409
401
  * @returns The updated workflow.
2410
402
  */
2411
403
  async toggle(workflowId, options) {
2412
- validateId(workflowId, "workflow_id");
2413
- const data = await invokeWithRetry(this.config, this.http, this.ops.toggle, {
404
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
405
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.toggle, {
2414
406
  pathParams: { id: workflowId },
2415
407
  jsonBody: { active: options.active }
2416
408
  });
@@ -2424,14 +416,14 @@ var ManagementWorkflowsResource = class extends WorkflowsResourceBase {
2424
416
  * @returns The workflow with a pending ownership transfer.
2425
417
  */
2426
418
  async requestOwnershipTransfer(workflowId, options) {
2427
- validateId(workflowId, "workflow_id");
2428
- const data = await invokeWithRetry(
419
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
420
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0,
2429
421
  this.config,
2430
422
  this.http,
2431
423
  this.ops.requestOwnershipTransfer,
2432
424
  {
2433
425
  pathParams: { id: workflowId },
2434
- jsonBody: omitUndefined({ newOwnerUserId: options.newOwnerUserId })
426
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, { newOwnerUserId: options.newOwnerUserId })
2435
427
  }
2436
428
  );
2437
429
  return parseWorkflow(data);
@@ -2443,234 +435,13 @@ function withCreatedUid(data) {
2443
435
  return { ...data, uid: data.contextItemId };
2444
436
  }
2445
437
 
2446
- // src/resources/context/custom-items.ts
2447
- function parseContextItem(raw) {
2448
- return raw;
2449
- }
2450
- function parseCreatedCustomContextItem(raw) {
2451
- const data = asRecord(raw);
2452
- const contextItemId = data.contextItemId;
2453
- if (typeof contextItemId !== "string" || !contextItemId) {
2454
- throw new ValidationError(
2455
- "Custom context create response missing non-empty string contextItemId"
2456
- );
2457
- }
2458
- return {
2459
- ...data,
2460
- contextItemId,
2461
- uid: contextItemId
2462
- };
2463
- }
2464
- function parseDeletion(raw) {
2465
- return raw;
2466
- }
2467
- var CustomContextItemsResource = class {
2468
- /** @internal */
2469
- constructor(http, config) {
2470
- this.http = http;
2471
- this.config = config;
2472
- }
2473
- /**
2474
- * List custom context items.
2475
- *
2476
- * @param options.pageSize - Maximum items per page (default 25).
2477
- * @param options.pageToken - Opaque token from a previous page.
2478
- * @param options.searchQuery - Word search: returns rows that contain every word of the query, case-insensitive.
2479
- * @param options.topics - Filter to items tagged with any of these topics.
2480
- * @returns A page of custom context items.
2481
- * @example
2482
- * ```ts
2483
- * const client = new Modus()
2484
- * const page = await client.context.customItems.list({ pageSize: 25 })
2485
- * for (const item of page.items) console.log(item.uid, item.contextType)
2486
- * ```
2487
- */
2488
- list(options = {}) {
2489
- const pageSize = options.pageSize ?? 25;
2490
- validatePageSize(pageSize);
2491
- return this.listPage(pageSize, options.pageToken, options);
2492
- }
2493
- async listPage(pageSize, pageToken, options) {
2494
- const data = asRecord(
2495
- await invokeWithRetry(this.config, this.http, "CustomContextItemsController_list", {
2496
- query: aipListParams(pageSize, pageToken, {
2497
- searchQuery: options.searchQuery,
2498
- topics: options.topics
2499
- })
2500
- })
2501
- );
2502
- return buildAipPage(
2503
- data,
2504
- "contextItems",
2505
- parseContextItem,
2506
- (token) => this.listPage(pageSize, token, options)
2507
- );
2508
- }
2509
- /**
2510
- * Retrieve a custom context item by uid.
2511
- *
2512
- * @param uid - Item uid.
2513
- * @returns The custom context item.
2514
- * @throws {NotFoundError} When no item matches the uid.
2515
- * @example
2516
- * ```ts
2517
- * const client = new Modus()
2518
- * const item = await client.context.customItems.get('PLACEHOLDER_UID')
2519
- * ```
2520
- */
2521
- async get(uid) {
2522
- return parseContextItem(
2523
- await invokeWithRetry(this.config, this.http, "CustomContextItemsController_get", {
2524
- pathParams: { uid }
2525
- })
2526
- );
2527
- }
2528
- /**
2529
- * Create a custom context item.
2530
- *
2531
- * @param input.kind - Item kind (`source`, `collection`, `entity`, `field`, or `entity_samples`).
2532
- * @param input.sourceId - Source identifier for the item hierarchy.
2533
- * @param input.name - Display name when applicable.
2534
- * @param input.content - Item payload.
2535
- * @param input.idempotencyKey - Optional idempotency key for safe retries.
2536
- * @returns Created item ids and hierarchy metadata.
2537
- *
2538
- * @example
2539
- * ```ts
2540
- * const client = new Modus()
2541
- * // Create the source and collection first, or use batchCreate as shown below.
2542
- * const created = await client.context.customItems.create({
2543
- * kind: 'entity',
2544
- * sourceId: 'billing-db',
2545
- * collectionId: 'contracts',
2546
- * externalId: 'contract-123',
2547
- * name: 'Q3 churn notes',
2548
- * content: { summary: 'Key findings…' },
2549
- * })
2550
- * console.log(created.uid, created.dataPath)
2551
- * ```
2552
- */
2553
- async create(input) {
2554
- return parseCreatedCustomContextItem(
2555
- await invokeWithRetry(this.config, this.http, "CustomContextItemsController_create", {
2556
- jsonBody: omitUndefined(input)
2557
- })
2558
- );
2559
- }
2560
- /**
2561
- * Create multiple custom context items in one request.
2562
- *
2563
- * @param inputs - Items to create (same fields as {@link CustomContextItemsResource.create}).
2564
- * @returns Created item metadata for each input.
2565
- *
2566
- * @example
2567
- * ```ts
2568
- * const client = new Modus()
2569
- * const created = await client.context.customItems.batchCreate([
2570
- * { kind: 'source', sourceId: 'billing-db', name: 'Billing database' },
2571
- * {
2572
- * kind: 'collection',
2573
- * sourceId: 'billing-db',
2574
- * collectionId: 'contracts',
2575
- * name: 'Contracts',
2576
- * },
2577
- * {
2578
- * kind: 'entity',
2579
- * sourceId: 'billing-db',
2580
- * collectionId: 'contracts',
2581
- * externalId: 'contract-123',
2582
- * name: 'Acme renewal',
2583
- * },
2584
- * ])
2585
- * console.log(created.map((item) => item.dataPath))
2586
- * ```
2587
- */
2588
- async batchCreate(inputs) {
2589
- const data = asRecord(
2590
- await invokeWithRetry(this.config, this.http, "CustomContextItemsController_batchCreate", {
2591
- jsonBody: {
2592
- items: inputs.map((input) => omitUndefined(input))
2593
- }
2594
- })
2595
- );
2596
- const items = data.contextItems;
2597
- return Array.isArray(items) ? items.map(parseCreatedCustomContextItem) : [];
2598
- }
2599
- /**
2600
- * Create or update typed relations between context items.
2601
- *
2602
- * @param relations - Relations with source and target item uids, a snake_case type, and optional content.
2603
- * @returns Number of relations created or updated.
2604
- * @example
2605
- * ```ts
2606
- * const client = new Modus()
2607
- * await client.context.customItems.createRelations([{
2608
- * fromUid: 'SOURCE_UID',
2609
- * toUid: 'TARGET_UID',
2610
- * relationType: 'depends_on',
2611
- * }])
2612
- * ```
2613
- */
2614
- async createRelations(relations) {
2615
- const data = asRecord(
2616
- await invokeWithRetry(
2617
- this.config,
2618
- this.http,
2619
- "CustomContextItemsController_createRelations",
2620
- { jsonBody: { relations } }
2621
- )
2622
- );
2623
- return data.upsertedCount;
2624
- }
2625
- /**
2626
- * Update a custom context item.
2627
- *
2628
- * @param uid - Item uid.
2629
- * @param input - Fields to change (kind and hierarchy ids cannot be changed).
2630
- * @returns The updated item uid.
2631
- * @example
2632
- * ```ts
2633
- * const client = new Modus()
2634
- * await client.context.customItems.update('PLACEHOLDER_UID', {
2635
- * description: 'Updated summary',
2636
- * })
2637
- * ```
2638
- */
2639
- async update(uid, input) {
2640
- return asRecord(
2641
- await invokeWithRetry(this.config, this.http, "CustomContextItemsController_update", {
2642
- pathParams: { uid },
2643
- jsonBody: omitUndefined(input)
2644
- })
2645
- );
2646
- }
2647
- /**
2648
- * Delete a custom context item.
2649
- *
2650
- * @param uid - Item uid.
2651
- * @returns Deletion confirmation with uid and context type.
2652
- * @example
2653
- * ```ts
2654
- * const client = new Modus()
2655
- * const result = await client.context.customItems.delete('PLACEHOLDER_UID')
2656
- * ```
2657
- */
2658
- async delete(uid) {
2659
- return parseDeletion(
2660
- await invokeWithRetry(this.config, this.http, "CustomContextItemsController_delete", {
2661
- pathParams: { uid }
2662
- })
2663
- );
2664
- }
2665
- };
2666
-
2667
438
  // src/management/context/_content-merge.ts
2668
439
  function requireContentDict(item, contextType) {
2669
440
  if (item.contextType !== contextType) {
2670
- throw new Error(`Expected contextType ${contextType}, got ${item.contextType}.`);
441
+ throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`Expected contextType ${contextType}, got ${item.contextType}.`);
2671
442
  }
2672
443
  if (!item.content || typeof item.content !== "object" || Array.isArray(item.content)) {
2673
- throw new Error(`Context item ${item.uid} has no object content; cannot merge ${contextType} fields.`);
444
+ throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`Context item ${item.uid} has no object content; cannot merge ${contextType} fields.`);
2674
445
  }
2675
446
  return item.content;
2676
447
  }
@@ -2690,7 +461,7 @@ function mergeSavedQueryContent(existing, options) {
2690
461
  return merged;
2691
462
  }
2692
463
  async function resolveExistingContent(items, uid, contextType, existing) {
2693
- const item = existing ?? await items.get(uid);
464
+ const item = await _asyncNullishCoalesce(existing, async () => ( await items.get(uid)));
2694
465
  return requireContentDict(item, contextType);
2695
466
  }
2696
467
  async function updateWithMergedContent(items, uid, options) {
@@ -2727,7 +498,7 @@ async function resolveAndUpdateSavedQuery(items, uid, options) {
2727
498
  }
2728
499
  async function resolveAndUpdateLink(items, uid, options) {
2729
500
  if (options.title === void 0 && options.url === void 0 && options.description === void 0 && options.userFeedback === void 0 && options.topics === void 0) {
2730
- throw new Error("Provide at least one field to update.");
501
+ throw new (0, _chunk3MHHVC6Ccjs.ValidationError)("Provide at least one field to update.");
2731
502
  }
2732
503
  if (options.title === void 0 && options.url === void 0) {
2733
504
  return items.update(uid, {
@@ -2770,8 +541,8 @@ var ContextDashboardsResourceBase = class {
2770
541
  * ```
2771
542
  */
2772
543
  async delete(dashboardId) {
2773
- validateId(dashboardId, "dashboardId");
2774
- await invokeWithRetry(this.config, this.http, "DashboardsController_delete", {
544
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
545
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_delete", {
2775
546
  pathParams: { dashboardId }
2776
547
  });
2777
548
  }
@@ -2791,11 +562,11 @@ var ContextDashboardsResourceBase = class {
2791
562
  * ```
2792
563
  */
2793
564
  async listDraftSnapshots(dashboardId) {
2794
- validateId(dashboardId, "dashboardId");
2795
- const data = await invokeWithRetry(this.config, this.http, "DashboardsController_listDraftSnapshots", {
565
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
566
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_listDraftSnapshots", {
2796
567
  pathParams: { dashboardId }
2797
568
  });
2798
- return asRecord(data).snapshots;
569
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0, data).snapshots;
2799
570
  }
2800
571
  /**
2801
572
  * Cancel an ownership transfer.
@@ -2812,11 +583,11 @@ var ContextDashboardsResourceBase = class {
2812
583
  * ```
2813
584
  */
2814
585
  async cancelOwnershipTransfer(dashboardId) {
2815
- validateId(dashboardId, "dashboardId");
2816
- const data = await invokeWithRetry(this.config, this.http, "DashboardsController_cancelOwnership", {
586
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
587
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_cancelOwnership", {
2817
588
  pathParams: { dashboardId }
2818
589
  });
2819
- return asRecord(data);
590
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0, data);
2820
591
  }
2821
592
  /**
2822
593
  * Accept an ownership transfer.
@@ -2833,11 +604,11 @@ var ContextDashboardsResourceBase = class {
2833
604
  * ```
2834
605
  */
2835
606
  async acceptOwnershipTransfer(dashboardId) {
2836
- validateId(dashboardId, "dashboardId");
2837
- const data = await invokeWithRetry(this.config, this.http, "DashboardsController_acceptOwnership", {
607
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
608
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_acceptOwnership", {
2838
609
  pathParams: { dashboardId }
2839
610
  });
2840
- return asRecord(data);
611
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0, data);
2841
612
  }
2842
613
  /**
2843
614
  * List dashboard versions.
@@ -2856,11 +627,11 @@ var ContextDashboardsResourceBase = class {
2856
627
  * ```
2857
628
  */
2858
629
  async listVersions(dashboardId) {
2859
- validateId(dashboardId, "dashboardId");
2860
- const data = await invokeWithRetry(this.config, this.http, "DashboardsController_listVersions", {
630
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
631
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_listVersions", {
2861
632
  pathParams: { dashboardId }
2862
633
  });
2863
- return asRecord(data).versions;
634
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0, data).versions;
2864
635
  }
2865
636
  /**
2866
637
  * Get a dashboard version.
@@ -2880,12 +651,12 @@ var ContextDashboardsResourceBase = class {
2880
651
  * ```
2881
652
  */
2882
653
  async getVersion(dashboardId, versionId) {
2883
- validateId(dashboardId, "dashboardId");
2884
- validateId(versionId, "versionId");
2885
- const data = await invokeWithRetry(this.config, this.http, "DashboardsController_getVersion", {
654
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
655
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, versionId, "versionId");
656
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_getVersion", {
2886
657
  pathParams: { dashboardId, versionId }
2887
658
  });
2888
- return asRecord(data);
659
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0, data);
2889
660
  }
2890
661
  /**
2891
662
  * Restore a dashboard version.
@@ -2904,12 +675,12 @@ var ContextDashboardsResourceBase = class {
2904
675
  * ```
2905
676
  */
2906
677
  async restoreVersion(dashboardId, versionId) {
2907
- validateId(dashboardId, "dashboardId");
2908
- validateId(versionId, "versionId");
2909
- const data = await invokeWithRetry(this.config, this.http, "DashboardsController_restore", {
678
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
679
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, versionId, "versionId");
680
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_restore", {
2910
681
  pathParams: { dashboardId, versionId }
2911
682
  });
2912
- return asRecord(data);
683
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0, data);
2913
684
  }
2914
685
  };
2915
686
 
@@ -2937,10 +708,10 @@ var ContextDashboardsElementsResourceBase = class {
2937
708
  * ```
2938
709
  */
2939
710
  async list() {
2940
- const data = await invokeWithRetry(this.config, this.http, "DashboardsController_listElements", {
711
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_listElements", {
2941
712
  pathParams: { dashboardId: this.dashboardId }
2942
713
  });
2943
- return asRecord(data);
714
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0, data);
2944
715
  }
2945
716
  /**
2946
717
  * Get a dashboard element.
@@ -2959,11 +730,11 @@ var ContextDashboardsElementsResourceBase = class {
2959
730
  * ```
2960
731
  */
2961
732
  async get(elementId) {
2962
- validateId(elementId, "elementId");
2963
- const data = await invokeWithRetry(this.config, this.http, "DashboardsController_getElement", {
733
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, elementId, "elementId");
734
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_getElement", {
2964
735
  pathParams: { dashboardId: this.dashboardId, elementId }
2965
736
  });
2966
- return asRecord(data);
737
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0, data);
2967
738
  }
2968
739
  };
2969
740
 
@@ -2996,8 +767,8 @@ var ManagementDashboardElementsResource = class extends ContextDashboardsElement
2996
767
  * ```
2997
768
  */
2998
769
  async create(input) {
2999
- return asRecord(
3000
- await invokeWithRetry(this.config, this.http, "DashboardsController_createElement", {
770
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
771
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_createElement", {
3001
772
  pathParams: { dashboardId: this.dashboardId },
3002
773
  jsonBody: {
3003
774
  expectedRevision: input.expectedRevision,
@@ -3027,9 +798,9 @@ var ManagementDashboardElementsResource = class extends ContextDashboardsElement
3027
798
  * ```
3028
799
  */
3029
800
  async update(elementId, input) {
3030
- validateId(elementId, "elementId");
3031
- return asRecord(
3032
- await invokeWithRetry(this.config, this.http, "DashboardsController_updateElement", {
801
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, elementId, "elementId");
802
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
803
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_updateElement", {
3033
804
  pathParams: { dashboardId: this.dashboardId, elementId },
3034
805
  jsonBody: { expectedRevision: input.expectedRevision, patch: input.patch }
3035
806
  })
@@ -3054,8 +825,8 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3054
825
  * ```
3055
826
  */
3056
827
  async list(options = {}) {
3057
- const data = asRecord(
3058
- await invokeWithRetry(this.config, this.http, "DashboardsController_list", {
828
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
829
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_list", {
3059
830
  query: { view: options.view }
3060
831
  })
3061
832
  );
@@ -3076,9 +847,9 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3076
847
  * ```
3077
848
  */
3078
849
  async get(dashboardId, options = {}) {
3079
- validateId(dashboardId, "dashboardId");
3080
- return asRecord(
3081
- await invokeWithRetry(this.config, this.http, "DashboardsController_get", {
850
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
851
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
852
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_get", {
3082
853
  pathParams: { dashboardId },
3083
854
  query: { view: options.view }
3084
855
  })
@@ -3107,8 +878,8 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3107
878
  * ```
3108
879
  */
3109
880
  async create(input) {
3110
- return asRecord(
3111
- await invokeWithRetry(this.config, this.http, "DashboardsController_create", {
881
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
882
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_create", {
3112
883
  jsonBody: {
3113
884
  title: input.title,
3114
885
  description: input.description,
@@ -3142,9 +913,9 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3142
913
  * ```
3143
914
  */
3144
915
  async updateDraft(dashboardId, input) {
3145
- validateId(dashboardId, "dashboardId");
3146
- return asRecord(
3147
- await invokeWithRetry(this.config, this.http, "DashboardsController_updateDraft", {
916
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
917
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
918
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_updateDraft", {
3148
919
  pathParams: { dashboardId },
3149
920
  jsonBody: {
3150
921
  expectedRevision: input.expectedRevision,
@@ -3172,9 +943,9 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3172
943
  * ```
3173
944
  */
3174
945
  async publish(dashboardId, input) {
3175
- validateId(dashboardId, "dashboardId");
3176
- return asRecord(
3177
- await invokeWithRetry(this.config, this.http, "DashboardsController_publish", {
946
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
947
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
948
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_publish", {
3178
949
  pathParams: { dashboardId },
3179
950
  jsonBody: { expectedRevision: input.expectedRevision }
3180
951
  })
@@ -3204,9 +975,9 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3204
975
  * ```
3205
976
  */
3206
977
  async updateAccess(dashboardId, input) {
3207
- validateId(dashboardId, "dashboardId");
3208
- return asRecord(
3209
- await invokeWithRetry(this.config, this.http, "DashboardsController_updateAccess", {
978
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
979
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
980
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_updateAccess", {
3210
981
  pathParams: { dashboardId },
3211
982
  jsonBody: {
3212
983
  visibility: input.visibility,
@@ -3235,10 +1006,10 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3235
1006
  * ```
3236
1007
  */
3237
1008
  async requestOwnershipTransfer(dashboardId, input) {
3238
- validateId(dashboardId, "dashboardId");
3239
- validateId(input.newOwnerUserId, "newOwnerUserId");
3240
- return asRecord(
3241
- await invokeWithRetry(this.config, this.http, "DashboardsController_transferOwnership", {
1009
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
1010
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, input.newOwnerUserId, "newOwnerUserId");
1011
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1012
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_transferOwnership", {
3242
1013
  pathParams: { dashboardId },
3243
1014
  jsonBody: { newOwnerUserId: input.newOwnerUserId }
3244
1015
  })
@@ -3255,7 +1026,7 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3255
1026
  * ```
3256
1027
  */
3257
1028
  elements(dashboardId) {
3258
- validateId(dashboardId, "dashboardId");
1029
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
3259
1030
  return new ManagementDashboardElementsResource(this.http, this.config, dashboardId);
3260
1031
  }
3261
1032
  /**
@@ -3276,9 +1047,9 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3276
1047
  * ```
3277
1048
  */
3278
1049
  async updateLayout(dashboardId, input) {
3279
- validateId(dashboardId, "dashboardId");
3280
- return asRecord(
3281
- await invokeWithRetry(this.config, this.http, "DashboardsController_updateLayout", {
1050
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, dashboardId, "dashboardId");
1051
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1052
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "DashboardsController_updateLayout", {
3282
1053
  pathParams: { dashboardId },
3283
1054
  jsonBody: { expectedRevision: input.expectedRevision, elements: input.elements }
3284
1055
  })
@@ -3287,8 +1058,8 @@ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
3287
1058
  };
3288
1059
 
3289
1060
  // src/management/context/files.ts
3290
- var import_promises = require("fs/promises");
3291
- var import_node_path = require("path");
1061
+ var _promises = require('fs/promises');
1062
+ var _path = require('path');
3292
1063
 
3293
1064
  // src/_generated/resources/management/context/files.ts
3294
1065
  var ContextFilesResourceBase = class {
@@ -3311,17 +1082,17 @@ var ContextFilesResourceBase = class {
3311
1082
  * @returns A page of files.
3312
1083
  */
3313
1084
  list(options = {}) {
3314
- const pageSize = options.pageSize ?? 50;
3315
- validatePageSize(pageSize, 200);
1085
+ const pageSize = _nullishCoalesce(options.pageSize, () => ( 50));
1086
+ _chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize, 200);
3316
1087
  return this.listPage(pageSize, options.pageToken);
3317
1088
  }
3318
1089
  async listPage(pageSize, pageToken) {
3319
- const data = asRecord(
3320
- await invokeWithRetry(this.config, this.http, "ContextFilesController_list", {
3321
- query: aipListParams(pageSize, pageToken)
1090
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1091
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextFilesController_list", {
1092
+ query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken)
3322
1093
  })
3323
1094
  );
3324
- return buildAipPage(
1095
+ return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
3325
1096
  data,
3326
1097
  "files",
3327
1098
  (raw) => raw,
@@ -3339,11 +1110,11 @@ var ContextFilesResourceBase = class {
3339
1110
  * @param uploadId - Upload id returned by `createUploadUrl` / `createUploadUrls`.
3340
1111
  */
3341
1112
  async get(uploadId) {
3342
- validateId(uploadId, "uploadId");
3343
- const data = await invokeWithRetry(this.config, this.http, "ContextFilesController_get", {
1113
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, uploadId, "uploadId");
1114
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextFilesController_get", {
3344
1115
  pathParams: { uploadId }
3345
1116
  });
3346
- return asRecord(data);
1117
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0, data);
3347
1118
  }
3348
1119
  };
3349
1120
 
@@ -3356,22 +1127,31 @@ var DEFAULT_CONCURRENCY = 10;
3356
1127
  var STATUS_ORDER = { pending: 0, processing: 1, ready: 2 };
3357
1128
  var WAIT_UNTIL_VALUES = /* @__PURE__ */ new Set(["processing", "ready"]);
3358
1129
  var DEFER_CONTENT_TYPE_TO_SERVER = "application/octet-stream";
1130
+ async function statInput(path) {
1131
+ try {
1132
+ return await _promises.stat.call(void 0, path);
1133
+ } catch (error) {
1134
+ const code = error.code;
1135
+ if (code === "ENOENT" || code === "ENOTDIR") throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`No such file or directory: ${path}`);
1136
+ throw error;
1137
+ }
1138
+ }
3359
1139
  function validateWaitUntil(waitUntil) {
3360
1140
  if (!WAIT_UNTIL_VALUES.has(waitUntil)) {
3361
- throw new Error(`waitUntil must be one of ${[...WAIT_UNTIL_VALUES].join(", ")}, got ${waitUntil}`);
1141
+ throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`waitUntil must be one of ${[...WAIT_UNTIL_VALUES].join(", ")}, got ${waitUntil}`);
3362
1142
  }
3363
1143
  }
3364
1144
  function validateBulkSize(count, name) {
3365
- if (count === 0) throw new Error(`${name} must not be empty`);
1145
+ if (count === 0) throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`${name} must not be empty`);
3366
1146
  if (count > MAX_BULK_UPLOAD_FILES) {
3367
- throw new Error(`${name} must have at most ${MAX_BULK_UPLOAD_FILES} entries, got ${count}`);
1147
+ throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`${name} must have at most ${MAX_BULK_UPLOAD_FILES} entries, got ${count}`);
3368
1148
  }
3369
1149
  }
3370
1150
  function statusSatisfies(status, waitUntil) {
3371
1151
  if (status === "failed") return true;
3372
- return (STATUS_ORDER[status] ?? 0) >= STATUS_ORDER[waitUntil];
1152
+ return (_nullishCoalesce(STATUS_ORDER[status], () => ( 0))) >= STATUS_ORDER[waitUntil];
3373
1153
  }
3374
- function sleep2(ms) {
1154
+ function sleep(ms) {
3375
1155
  return new Promise((resolve) => setTimeout(resolve, ms));
3376
1156
  }
3377
1157
  function chunked(items, size) {
@@ -3383,7 +1163,7 @@ function joinDestination(prefix, relative2) {
3383
1163
  const head = prefix === void 0 || prefix.length === 0 ? void 0 : prefix;
3384
1164
  const tail = relative2 === void 0 || relative2.length === 0 ? void 0 : relative2;
3385
1165
  if (head !== void 0 && tail !== void 0) return `${head}/${tail}`;
3386
- return head ?? tail;
1166
+ return _nullishCoalesce(head, () => ( tail));
3387
1167
  }
3388
1168
  async function mapWithConcurrency(items, concurrency, worker, onItemDone) {
3389
1169
  const results = new Array(items.length);
@@ -3394,7 +1174,7 @@ async function mapWithConcurrency(items, concurrency, worker, onItemDone) {
3394
1174
  if (index >= items.length) return;
3395
1175
  const result = await worker(items[index]);
3396
1176
  results[index] = result;
3397
- onItemDone?.(result);
1177
+ _optionalChain([onItemDone, 'optionalCall', _4 => _4(result)]);
3398
1178
  }
3399
1179
  }
3400
1180
  await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, run));
@@ -3403,11 +1183,11 @@ async function mapWithConcurrency(items, concurrency, worker, onItemDone) {
3403
1183
  async function walkFiles(root, recursive) {
3404
1184
  const out = [];
3405
1185
  async function walk(dir) {
3406
- const entries = await (0, import_promises.readdir)(dir, { withFileTypes: true });
1186
+ const entries = await _promises.readdir.call(void 0, dir, { withFileTypes: true });
3407
1187
  entries.sort((a, b) => a.name.localeCompare(b.name));
3408
1188
  for (const entry of entries) {
3409
1189
  if (entry.name.startsWith(".") || entry.isSymbolicLink()) continue;
3410
- const full = (0, import_node_path.join)(dir, entry.name);
1190
+ const full = _path.join.call(void 0, dir, entry.name);
3411
1191
  if (entry.isDirectory()) {
3412
1192
  if (recursive) await walk(full);
3413
1193
  } else if (entry.isFile()) {
@@ -3427,7 +1207,7 @@ async function putBytes(fetchImpl, slot, data, timeoutMs) {
3427
1207
  });
3428
1208
  if (!response.ok) {
3429
1209
  const text = await response.text().catch(() => "");
3430
- throw new ModusError(`Upload PUT to presigned URL failed with HTTP ${response.status}.`, {
1210
+ throw new (0, _chunk3MHHVC6Ccjs.ModusError)(`Upload PUT to presigned URL failed with HTTP ${response.status}.`, {
3431
1211
  statusCode: response.status,
3432
1212
  body: text ? text.slice(0, 500) : void 0
3433
1213
  });
@@ -3450,7 +1230,7 @@ function uploadFromUrlsPayload(urls) {
3450
1230
  function assignSlots(batch, result, failed) {
3451
1231
  const failedIndices = new Set(result.failed.map((f) => f.index));
3452
1232
  for (const f of result.failed) {
3453
- failed.push({ path: batch[f.index]?.path ?? "", error: f.error });
1233
+ failed.push({ path: _nullishCoalesce(_optionalChain([batch, 'access', _5 => _5[f.index], 'optionalAccess', _6 => _6.path]), () => ( "")), error: f.error });
3454
1234
  }
3455
1235
  const remaining = batch.filter((_, i) => !failedIndices.has(i));
3456
1236
  const uploaded = result.uploaded;
@@ -3485,8 +1265,8 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3485
1265
  * re-derives the key from `uploadId` and `fileName`.
3486
1266
  */
3487
1267
  async createUploadUrl(input) {
3488
- return asRecord(
3489
- await invokeWithRetry(this.config, this.http, "ContextFilesController_uploadUrl", {
1268
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1269
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextFilesController_uploadUrl", {
3490
1270
  jsonBody: { fileName: input.fileName, contentType: input.contentType, fileSize: input.fileSize }
3491
1271
  })
3492
1272
  );
@@ -3500,8 +1280,8 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3500
1280
  */
3501
1281
  async createUploadUrls(files) {
3502
1282
  validateBulkSize(files.length, "files");
3503
- return asRecord(
3504
- await invokeWithRetry(this.config, this.http, "ContextFilesController_uploadUrls", {
1283
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1284
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextFilesController_uploadUrls", {
3505
1285
  jsonBody: createSlotsPayload(files)
3506
1286
  })
3507
1287
  );
@@ -3516,8 +1296,8 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3516
1296
  * @returns File upload resource with status `processing` — parsing continues async.
3517
1297
  */
3518
1298
  async uploadFromUrl(url, options = {}) {
3519
- return asRecord(
3520
- await invokeWithRetry(this.config, this.http, "ContextFilesController_uploadFromUrl", {
1299
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1300
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextFilesController_uploadFromUrl", {
3521
1301
  jsonBody: {
3522
1302
  url,
3523
1303
  ...options.fileName !== void 0 ? { fileName: options.fileName } : {},
@@ -3535,8 +1315,8 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3535
1315
  */
3536
1316
  async uploadFromUrls(urls) {
3537
1317
  validateBulkSize(urls.length, "urls");
3538
- return asRecord(
3539
- await invokeWithRetry(this.config, this.http, "ContextFilesController_uploadFromUrls", {
1318
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1319
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextFilesController_uploadFromUrls", {
3540
1320
  jsonBody: uploadFromUrlsPayload(urls)
3541
1321
  })
3542
1322
  );
@@ -3553,9 +1333,9 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3553
1333
  * @returns The file upload resource, status `"processing"`.
3554
1334
  */
3555
1335
  async finalize(uploadId, fileName, options = {}) {
3556
- validateId(uploadId, "uploadId");
3557
- return asRecord(
3558
- await invokeWithRetry(this.config, this.http, "ContextFilesController_finalize", {
1336
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, uploadId, "uploadId");
1337
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1338
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextFilesController_finalize", {
3559
1339
  pathParams: { uploadId },
3560
1340
  jsonBody: { fileName, ...options.folderPath !== void 0 ? { folderPath: options.folderPath } : {} }
3561
1341
  })
@@ -3573,8 +1353,8 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3573
1353
  */
3574
1354
  async finalizeMany(uploads) {
3575
1355
  validateBulkSize(uploads.length, "uploads");
3576
- return asRecord(
3577
- await invokeWithRetry(this.config, this.http, "ContextFilesController_finalizeMany", {
1356
+ return _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1357
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextFilesController_finalizeMany", {
3578
1358
  jsonBody: {
3579
1359
  uploads: uploads.map((u) => ({
3580
1360
  uploadId: u.uploadId,
@@ -3631,17 +1411,17 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3631
1411
  * ```
3632
1412
  */
3633
1413
  async upload(path, options = {}) {
3634
- const waitUntil = options.waitUntil ?? "processing";
1414
+ const waitUntil = _nullishCoalesce(options.waitUntil, () => ( "processing"));
3635
1415
  validateWaitUntil(waitUntil);
3636
- const fileStat = await (0, import_promises.stat)(path);
3637
- if (!fileStat.isFile()) throw new Error(`Not a file: ${path}`);
1416
+ const fileStat = await statInput(path);
1417
+ if (!fileStat.isFile()) throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`Not a file: ${path}`);
3638
1418
  const fileName = path.split(/[/\\]/).pop();
3639
1419
  const slot = await this.createUploadUrl({
3640
1420
  fileName,
3641
1421
  contentType: DEFER_CONTENT_TYPE_TO_SERVER,
3642
1422
  fileSize: fileStat.size
3643
1423
  });
3644
- const data = await (0, import_promises.readFile)(path);
1424
+ const data = await _promises.readFile.call(void 0, path);
3645
1425
  await putBytes(this.config.fetch, slot, data, DEFAULT_PUT_TIMEOUT_MS);
3646
1426
  const finalized = await this.finalize(slot.uploadId, slot.fileName, {
3647
1427
  ...options.folderPath !== void 0 ? { folderPath: options.folderPath } : {}
@@ -3650,8 +1430,8 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3650
1430
  return this.pollUntil(
3651
1431
  slot.uploadId,
3652
1432
  waitUntil,
3653
- options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS,
3654
- options.timeoutMs ?? DEFAULT_UPLOAD_TIMEOUT_MS
1433
+ _nullishCoalesce(options.pollIntervalMs, () => ( DEFAULT_POLL_INTERVAL_MS)),
1434
+ _nullishCoalesce(options.timeoutMs, () => ( DEFAULT_UPLOAD_TIMEOUT_MS))
3655
1435
  );
3656
1436
  }
3657
1437
  async pollUntil(uploadId, waitUntil, pollIntervalMs, timeoutMs) {
@@ -3660,11 +1440,11 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3660
1440
  const item = await this.get(uploadId);
3661
1441
  if (statusSatisfies(item.status, waitUntil)) return item;
3662
1442
  if (Date.now() >= deadline) {
3663
- throw new ModusError(
1443
+ throw new (0, _chunk3MHHVC6Ccjs.ModusError)(
3664
1444
  `Timed out after ${timeoutMs}ms waiting for upload ${JSON.stringify(uploadId)} to reach status ${JSON.stringify(waitUntil)}; last status was ${JSON.stringify(item.status)}.`
3665
1445
  );
3666
1446
  }
3667
- await sleep2(pollIntervalMs);
1447
+ await sleep(pollIntervalMs);
3668
1448
  }
3669
1449
  }
3670
1450
  /**
@@ -3693,25 +1473,25 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3693
1473
  * ```
3694
1474
  */
3695
1475
  async uploadDir(path, options = {}) {
3696
- const waitUntil = options.waitUntil ?? "processing";
1476
+ const waitUntil = _nullishCoalesce(options.waitUntil, () => ( "processing"));
3697
1477
  validateWaitUntil(waitUntil);
3698
- const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
3699
- if (concurrency < 1) throw new Error(`concurrency must be >= 1, got ${concurrency}`);
3700
- const dirStat = await (0, import_promises.stat)(path);
3701
- if (!dirStat.isDirectory()) throw new Error(`Not a directory: ${path}`);
3702
- const files = await walkFiles(path, options.recursive ?? true);
1478
+ const concurrency = _nullishCoalesce(options.concurrency, () => ( DEFAULT_CONCURRENCY));
1479
+ if (concurrency < 1) throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`concurrency must be >= 1, got ${concurrency}`);
1480
+ const dirStat = await statInput(path);
1481
+ if (!dirStat.isDirectory()) throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`Not a directory: ${path}`);
1482
+ const files = await walkFiles(path, _nullishCoalesce(options.recursive, () => ( true)));
3703
1483
  return this.uploadPaths(files.map((file) => {
3704
- const folderPath = (0, import_node_path.relative)(path, (0, import_node_path.dirname)(file)).replace(/\\/g, "/");
1484
+ const folderPath = _path.relative.call(void 0, path, _path.dirname.call(void 0, file)).replace(/\\/g, "/");
3705
1485
  return { path: file, ...folderPath.length > 0 ? { folderPath } : {} };
3706
1486
  }), options);
3707
1487
  }
3708
1488
  /** Shared body of `uploadFiles` and `uploadDir`: presign in batches of 100,
3709
1489
  * PUT with bounded concurrency, then bulk-finalize the batch. */
3710
1490
  async uploadPaths(files, options) {
3711
- const waitUntil = options.waitUntil ?? "processing";
1491
+ const waitUntil = _nullishCoalesce(options.waitUntil, () => ( "processing"));
3712
1492
  validateWaitUntil(waitUntil);
3713
- const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
3714
- if (concurrency < 1) throw new Error(`concurrency must be >= 1, got ${concurrency}`);
1493
+ const concurrency = _nullishCoalesce(options.concurrency, () => ( DEFAULT_CONCURRENCY));
1494
+ if (concurrency < 1) throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(`concurrency must be >= 1, got ${concurrency}`);
3715
1495
  const prefixed = files.map((file) => {
3716
1496
  const folderPath = joinDestination(options.folderPath, file.folderPath);
3717
1497
  return { path: file.path, ...folderPath !== void 0 ? { folderPath } : {} };
@@ -3722,19 +1502,19 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3722
1502
  let completed = 0;
3723
1503
  const emit = () => {
3724
1504
  completed += 1;
3725
- options.onProgress?.({
1505
+ _optionalChain([options, 'access', _7 => _7.onProgress, 'optionalCall', _8 => _8({
3726
1506
  completed,
3727
1507
  total,
3728
1508
  succeeded: uploaded.length,
3729
1509
  failed: failed.length
3730
- });
1510
+ })]);
3731
1511
  };
3732
1512
  for (const batch of chunked(prefixed, MAX_BULK_UPLOAD_FILES)) {
3733
1513
  const failedBefore = failed.length;
3734
1514
  const slots = await this.createSlots(batch, failed);
3735
1515
  for (let reported = failedBefore + 1; reported <= failed.length; reported += 1) {
3736
1516
  completed += 1;
3737
- options.onProgress?.({ completed, total, succeeded: uploaded.length, failed: reported });
1517
+ _optionalChain([options, 'access', _9 => _9.onProgress, 'optionalCall', _10 => _10({ completed, total, succeeded: uploaded.length, failed: reported })]);
3738
1518
  }
3739
1519
  await this.uploadBatch(slots, waitUntil, concurrency, (result) => {
3740
1520
  if ("error" in result) failed.push(result);
@@ -3749,7 +1529,7 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3749
1529
  const inputs = [];
3750
1530
  for (const file of batch) {
3751
1531
  try {
3752
- const fileStat = await (0, import_promises.stat)(file.path);
1532
+ const fileStat = await _promises.stat.call(void 0, file.path);
3753
1533
  const fileName = file.path.split(/[/\\]/).pop();
3754
1534
  inputs.push({ fileName, contentType: DEFER_CONTENT_TYPE_TO_SERVER, fileSize: fileStat.size });
3755
1535
  readable.push(file);
@@ -3770,7 +1550,7 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3770
1550
  concurrency,
3771
1551
  async ({ path, folderPath, slot }) => {
3772
1552
  try {
3773
- const data = await (0, import_promises.readFile)(path);
1553
+ const data = await _promises.readFile.call(void 0, path);
3774
1554
  await putBytes(this.config.fetch, slot, data, DEFAULT_PUT_TIMEOUT_MS);
3775
1555
  return { landed: { path, ...folderPath !== void 0 ? { folderPath } : {}, slot } };
3776
1556
  } catch (error) {
@@ -3781,7 +1561,7 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3781
1561
  (outcome) => {
3782
1562
  if ("failure" in outcome) {
3783
1563
  out.push(outcome.failure);
3784
- onOutcome?.(outcome.failure);
1564
+ _optionalChain([onOutcome, 'optionalCall', _11 => _11(outcome.failure)]);
3785
1565
  }
3786
1566
  }
3787
1567
  );
@@ -3802,16 +1582,16 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3802
1582
  );
3803
1583
  const failedIndices = new Set(result.failed.map((f) => f.index));
3804
1584
  for (const f of result.failed) {
3805
- const failure = { path: landed[f.index]?.path ?? "", error: f.error };
1585
+ const failure = { path: _nullishCoalesce(_optionalChain([landed, 'access', _12 => _12[f.index], 'optionalAccess', _13 => _13.path]), () => ( "")), error: f.error };
3806
1586
  out.push(failure);
3807
- onOutcome?.(failure);
1587
+ _optionalChain([onOutcome, 'optionalCall', _14 => _14(failure)]);
3808
1588
  }
3809
1589
  const finalized = result.finalized;
3810
1590
  const remaining = landed.filter((_, i) => !failedIndices.has(i));
3811
1591
  if (waitUntil !== "ready") {
3812
1592
  for (const item of finalized) {
3813
1593
  out.push(item);
3814
- onOutcome?.(item);
1594
+ _optionalChain([onOutcome, 'optionalCall', _15 => _15(item)]);
3815
1595
  }
3816
1596
  return out;
3817
1597
  }
@@ -3828,7 +1608,7 @@ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3828
1608
  },
3829
1609
  (item) => {
3830
1610
  out.push(item);
3831
- onOutcome?.(item);
1611
+ _optionalChain([onOutcome, 'optionalCall', _16 => _16(item)]);
3832
1612
  }
3833
1613
  );
3834
1614
  return out;
@@ -3848,9 +1628,9 @@ function contextListParams(pageSize, pageToken, filters = {}) {
3848
1628
  if (filters.connectionIds !== void 0) {
3849
1629
  extra.connectionIds = filters.connectionIds.length === 0 ? "" : [...filters.connectionIds];
3850
1630
  }
3851
- return aipListParams(pageSize, pageToken, extra);
1631
+ return _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, extra);
3852
1632
  }
3853
- function parseContextItem2(raw) {
1633
+ function parseContextItem(raw) {
3854
1634
  return raw;
3855
1635
  }
3856
1636
  var ManagementContextItemsResource = class {
@@ -3886,8 +1666,8 @@ var ManagementContextItemsResource = class {
3886
1666
  * ```
3887
1667
  */
3888
1668
  list(options = {}) {
3889
- const pageSize = options.pageSize ?? 25;
3890
- validatePageSize(pageSize);
1669
+ const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
1670
+ _chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
3891
1671
  return this.listPage(pageSize, options.pageToken, {
3892
1672
  contextType: options.contextType,
3893
1673
  parentUids: options.parentUids,
@@ -3896,15 +1676,15 @@ var ManagementContextItemsResource = class {
3896
1676
  });
3897
1677
  }
3898
1678
  async listPage(pageSize, pageToken, filters) {
3899
- const data = asRecord(
3900
- await invokeWithRetry(this.config, this.http, "ContextItemsController_list", {
1679
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
1680
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_list", {
3901
1681
  query: contextListParams(pageSize, pageToken, filters)
3902
1682
  })
3903
1683
  );
3904
- return buildAipPage(
1684
+ return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
3905
1685
  data,
3906
1686
  "contextItems",
3907
- parseContextItem2,
1687
+ parseContextItem,
3908
1688
  (token) => this.listPage(pageSize, token, filters)
3909
1689
  );
3910
1690
  }
@@ -3915,16 +1695,16 @@ var ManagementContextItemsResource = class {
3915
1695
  * @returns The context item.
3916
1696
  */
3917
1697
  async get(uid) {
3918
- const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_get", {
1698
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_get", {
3919
1699
  pathParams: { uid }
3920
1700
  });
3921
- return parseContextItem2(data);
1701
+ return parseContextItem(data);
3922
1702
  }
3923
1703
  /**
3924
1704
  * Update a context item.
3925
1705
  *
3926
1706
  * Only the fields you pass are changed. To clear a field, name it in
3927
- * `updateMask` and leave its argument unset.
1707
+ * `updateMask` and leave its argument unset: it is sent as `null`.
3928
1708
  *
3929
1709
  * @param uid - Context item uid.
3930
1710
  * @param options.content - Replacement type-specific content.
@@ -3936,20 +1716,14 @@ var ManagementContextItemsResource = class {
3936
1716
  * @returns The updated context item.
3937
1717
  */
3938
1718
  async update(uid, options = {}) {
3939
- const body = options.updateMask !== void 0 ? {
3940
- content: options.content,
3941
- contextType: options.contextType,
3942
- description: options.description,
3943
- userFeedback: options.userFeedback,
3944
- topics: options.topics
3945
- } : omitUndefined({
1719
+ const body = updateBody({
3946
1720
  content: options.content,
3947
1721
  contextType: options.contextType,
3948
1722
  description: options.description,
3949
1723
  userFeedback: options.userFeedback,
3950
1724
  topics: options.topics
3951
- });
3952
- await invokeWithRetry(this.config, this.http, "ContextItemsController_update", {
1725
+ }, options.updateMask);
1726
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_update", {
3953
1727
  pathParams: { uid },
3954
1728
  query: updateMaskQuery(options.updateMask),
3955
1729
  jsonBody: body
@@ -3963,7 +1737,7 @@ var ManagementContextItemsResource = class {
3963
1737
  * @returns Deletion confirmation details.
3964
1738
  */
3965
1739
  async delete(uid) {
3966
- const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_delete", {
1740
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_delete", {
3967
1741
  pathParams: { uid }
3968
1742
  });
3969
1743
  return data;
@@ -3995,7 +1769,7 @@ var ManagementContextItemsResource = class {
3995
1769
  * ```
3996
1770
  */
3997
1771
  async move(uid, options) {
3998
- const data = await invokeWithRetry(
1772
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0,
3999
1773
  this.config,
4000
1774
  this.http,
4001
1775
  "ContextItemsController_move",
@@ -4006,6 +1780,50 @@ var ManagementContextItemsResource = class {
4006
1780
  );
4007
1781
  return data;
4008
1782
  }
1783
+ /**
1784
+ * Replace who can view and manage a note, saved query, link or uploaded file.
1785
+ *
1786
+ * All three settings are required and replace the current ones. You cannot
1787
+ * remove your own manage access. An item created before items had owners
1788
+ * becomes yours on the first change.
1789
+ *
1790
+ * @param uid - UUID of the context item.
1791
+ * @param input.visibility - `shared` (the owner plus the groups in
1792
+ * `groupPermissions`) or `private` (the owner plus the users in `sharedWith`).
1793
+ * @param input.groupPermissions - Group id to `{ use, manage }`. Used only when shared.
1794
+ * @param input.sharedWith - Users such as `{ email: 'ana@example.com', permission: 'use' }`.
1795
+ * Used only when private.
1796
+ * @returns The item's new access settings and whether you can still manage it.
1797
+ * @throws {NotFoundError} The item does not exist or you cannot view it.
1798
+ * @throws {PermissionDeniedError} You can view the item but not manage it.
1799
+ * @throws {ModusError} The item is another type, a group or user is invalid,
1800
+ * or the change would remove your own manage access.
1801
+ *
1802
+ * @example
1803
+ * ```ts
1804
+ * await mgmt.context.items.updateAccess('PLACEHOLDER_UID', {
1805
+ * visibility: 'private',
1806
+ * groupPermissions: {},
1807
+ * sharedWith: [{ email: 'ana@example.com', permission: 'use' }],
1808
+ * })
1809
+ * ```
1810
+ */
1811
+ async updateAccess(uid, input) {
1812
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0,
1813
+ this.config,
1814
+ this.http,
1815
+ "ContextItemAccessController_updateAccess",
1816
+ {
1817
+ pathParams: { uid },
1818
+ jsonBody: {
1819
+ visibility: input.visibility,
1820
+ groupPermissions: input.groupPermissions,
1821
+ sharedWith: input.sharedWith
1822
+ }
1823
+ }
1824
+ );
1825
+ return data;
1826
+ }
4009
1827
  };
4010
1828
 
4011
1829
  // src/management/context/context.ts
@@ -4015,7 +1833,7 @@ var ManagementContextResource = class {
4015
1833
  this.http = http;
4016
1834
  this.config = config;
4017
1835
  this.items = new ManagementContextItemsResource(http, config);
4018
- this.customItems = new CustomContextItemsResource(http, config);
1836
+ this.customItems = new (0, _chunk3MHHVC6Ccjs.CustomContextItemsResource)(http, config);
4019
1837
  this.files = new ManagementContextFilesResource(http, config);
4020
1838
  this.dashboards = new ManagementDashboardsResource(http, config);
4021
1839
  }
@@ -4032,7 +1850,7 @@ var ManagementContextResource = class {
4032
1850
  * ```
4033
1851
  */
4034
1852
  createNote(title, content) {
4035
- return this.create("ContextCreatorsController_createNote", omitUndefined({ title, content }));
1853
+ return this.create("ContextCreatorsController_createNote", _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, { title, content }));
4036
1854
  }
4037
1855
  /**
4038
1856
  * Update a note's title and markdown body.
@@ -4077,7 +1895,7 @@ var ManagementContextResource = class {
4077
1895
  createSavedQuery(name, options) {
4078
1896
  return this.create(
4079
1897
  "ContextCreatorsController_createSavedQuery",
4080
- omitUndefined({
1898
+ _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, {
4081
1899
  name,
4082
1900
  query: options.query,
4083
1901
  connectionId: options.connectionId,
@@ -4125,7 +1943,7 @@ var ManagementContextResource = class {
4125
1943
  createLink(url, options = {}) {
4126
1944
  return this.create(
4127
1945
  "ContextCreatorsController_createLink",
4128
- omitUndefined({
1946
+ _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, {
4129
1947
  url,
4130
1948
  title: options.title,
4131
1949
  isCrawl: options.isCrawl,
@@ -4156,7 +1974,7 @@ var ManagementContextResource = class {
4156
1974
  }
4157
1975
  /** @internal */
4158
1976
  async create(operationId, payload) {
4159
- const data = await invokeWithRetry(this.config, this.http, operationId, {
1977
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, operationId, {
4160
1978
  jsonBody: payload
4161
1979
  });
4162
1980
  return withCreatedUid(data);
@@ -4182,8 +2000,9 @@ var ScopesResourceBase = class {
4182
2000
  * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
4183
2001
  * for the first page.
4184
2002
  * @param options.search - Case-insensitive substring filter on scope name.
4185
- * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
4186
- * snapshot.
2003
+ * @param options.view - Variation view. `active` reads the deployed version, or the latest draft
2004
+ * when nothing is published. `draft` reads the latest builder snapshot. `published` reads only
2005
+ * the published version, and only scopes you can use.
4187
2006
  * @param options.managerId - Return only scopes supervised by this manager scope id.
4188
2007
  * @returns A page of scopes.
4189
2008
  *
@@ -4196,8 +2015,8 @@ var ScopesResourceBase = class {
4196
2015
  * ```
4197
2016
  */
4198
2017
  list(options = {}) {
4199
- const pageSize = options.pageSize ?? 25;
4200
- validatePageSize(pageSize);
2018
+ const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
2019
+ _chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
4201
2020
  return this.listPage(pageSize, options.pageToken, options.search, options.view, options.managerId);
4202
2021
  }
4203
2022
  async listPage(pageSize, pageToken, search, view, managerId) {
@@ -4205,12 +2024,12 @@ var ScopesResourceBase = class {
4205
2024
  if (search !== void 0) extra.search = search;
4206
2025
  if (view !== void 0) extra.view = view;
4207
2026
  if (managerId !== void 0) extra.managerId = managerId;
4208
- const data = asRecord(
4209
- await invokeWithRetry(this.config, this.http, "ScopesController_list", {
4210
- query: aipListParams(pageSize, pageToken, extra)
2027
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
2028
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_list", {
2029
+ query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, extra)
4211
2030
  })
4212
2031
  );
4213
- return buildAipPage(
2032
+ return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
4214
2033
  data,
4215
2034
  "scopes",
4216
2035
  (raw) => raw,
@@ -4220,13 +2039,15 @@ var ScopesResourceBase = class {
4220
2039
  /**
4221
2040
  * Get a scope.
4222
2041
  *
4223
- * Returns a scope. `view=active` (default) returns the deployed version; `view=draft` returns the
4224
- * latest unpublished edits. Returns 404 if you cannot access the scope.
2042
+ * Returns a scope. `view=active` (default) is the deployed version, or the latest draft when
2043
+ * nothing is published. `view=draft` is the latest edits. `view=published` is only the published
2044
+ * version, and only if you can use the scope. Returns 404 if you cannot access it.
4225
2045
  *
4226
2046
  * **Requires:** `scopes:read`
4227
2047
  *
4228
2048
  * @param scopeId - Numeric scope id.
4229
- * @param options.view - Which variation snapshot to read. Defaults to `active`.
2049
+ * @param options.view - Which version to read. Defaults to `active`. `published` is only the
2050
+ * published version, and only if you can use the scope.
4230
2051
  *
4231
2052
  * @example
4232
2053
  * ```ts
@@ -4236,8 +2057,8 @@ var ScopesResourceBase = class {
4236
2057
  * ```
4237
2058
  */
4238
2059
  async get(scopeId, options = {}) {
4239
- validateId(scopeId, "scope_id");
4240
- const data = await invokeWithRetry(this.config, this.http, "ScopesController_get", {
2060
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2061
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_get", {
4241
2062
  pathParams: { id: scopeId },
4242
2063
  query: { view: options.view }
4243
2064
  });
@@ -4246,8 +2067,8 @@ var ScopesResourceBase = class {
4246
2067
  /**
4247
2068
  * Delete a scope.
4248
2069
  *
4249
- * Deletes a scope. The scope can be restored later with POST /scopes/{id}/restore. Deleting an
4250
- * already-deleted scope is a no-op.
2070
+ * Deletes a scope. The scope can be restored later with POST /scopes/{id}/restore. Returns 404 if
2071
+ * the scope does not exist or is already deleted.
4251
2072
  *
4252
2073
  * **Requires:** `scopes:write`
4253
2074
  *
@@ -4260,11 +2081,37 @@ var ScopesResourceBase = class {
4260
2081
  * ```
4261
2082
  */
4262
2083
  async delete(scopeId) {
4263
- validateId(scopeId, "scope_id");
4264
- await invokeWithRetry(this.config, this.http, "ScopesController_delete", {
2084
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2085
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_delete", {
4265
2086
  pathParams: { id: scopeId }
4266
2087
  });
4267
2088
  }
2089
+ /**
2090
+ * Preview MCP exposure catalog.
2091
+ *
2092
+ * Lists tools this scope can expose to MCP clients. A field you send replaces the current draft;
2093
+ * a field you omit stays as stored. Nothing is saved. Entries you cannot access are left out, and
2094
+ * stored selections on them are counted in hiddenSelectedCount.
2095
+ *
2096
+ * **Requires:** `scopes:write`
2097
+ *
2098
+ * @param scopeId - Numeric scope id.
2099
+ * @param request - Request body; see `McpExposureCatalogRequest`.
2100
+ *
2101
+ * @example
2102
+ * ```ts
2103
+ * const catalog = await mgmt.scopes.mcpExposureCatalog(42, {})
2104
+ * catalog.discoveryAllowed
2105
+ * ```
2106
+ */
2107
+ async mcpExposureCatalog(scopeId, request) {
2108
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2109
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_mcpExposureCatalog", {
2110
+ pathParams: { id: scopeId },
2111
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, request)
2112
+ });
2113
+ return data;
2114
+ }
4268
2115
  /**
4269
2116
  * Restore a deleted scope.
4270
2117
  *
@@ -4276,8 +2123,8 @@ var ScopesResourceBase = class {
4276
2123
  * @param scopeId - Numeric scope id.
4277
2124
  */
4278
2125
  async restore(scopeId) {
4279
- validateId(scopeId, "scope_id");
4280
- const data = await invokeWithRetry(this.config, this.http, "ScopesController_restore", {
2126
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2127
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_restore", {
4281
2128
  pathParams: { id: scopeId },
4282
2129
  jsonBody: {}
4283
2130
  });
@@ -4286,16 +2133,16 @@ var ScopesResourceBase = class {
4286
2133
  /**
4287
2134
  * Cancel ownership transfer.
4288
2135
  *
4289
- * Cancels a pending ownership transfer. The current owner may cancel; the pending recipient may
4290
- * decline.
2136
+ * Cancels a pending ownership transfer. The current owner may cancel, the pending recipient may
2137
+ * decline, and for a scope with no owner an organization owner may cancel.
4291
2138
  *
4292
2139
  * **Requires:** `scopes:write`
4293
2140
  *
4294
2141
  * @param scopeId - Numeric scope id.
4295
2142
  */
4296
2143
  async cancelOwnershipTransfer(scopeId) {
4297
- validateId(scopeId, "scope_id");
4298
- const data = await invokeWithRetry(this.config, this.http, "ScopesController_cancelOwnershipTransfer", {
2144
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2145
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_cancelOwnershipTransfer", {
4299
2146
  pathParams: { id: scopeId }
4300
2147
  });
4301
2148
  return data;
@@ -4310,8 +2157,8 @@ var ScopesResourceBase = class {
4310
2157
  * @param scopeId - Numeric scope id.
4311
2158
  */
4312
2159
  async acceptOwnershipTransfer(scopeId) {
4313
- validateId(scopeId, "scope_id");
4314
- const data = await invokeWithRetry(this.config, this.http, "ScopesController_acceptOwnershipTransfer", {
2160
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2161
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_acceptOwnershipTransfer", {
4315
2162
  pathParams: { id: scopeId },
4316
2163
  jsonBody: {}
4317
2164
  });
@@ -4319,103 +2166,38 @@ var ScopesResourceBase = class {
4319
2166
  }
4320
2167
  };
4321
2168
 
4322
- // src/_generated/resources/consumption/scopes/conversations.ts
4323
- var ScopesConversationsResourceBase = class {
4324
- /** @internal */
4325
- constructor(http, config, scopeId) {
4326
- this.http = http;
4327
- this.config = config;
4328
- this.scopeId = scopeId;
4329
- }
4330
- /**
4331
- * List scope conversations.
4332
- *
4333
- * Returns a page of conversation summaries (most recently updated first) for a scope. Use `id=0`
4334
- * for your cross-scope recent history. Pass `nextPageToken` as `pageToken` to fetch the next
4335
- * page.
4336
- *
4337
- * **Requires:** `scopes:read`
4338
- *
4339
- * @param options.pageSize - Items per page. Defaults to 25.
4340
- * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
4341
- * for the first page.
4342
- * @param options.source - Return only conversations started from this UI surface.
4343
- * @param options.sourceRef - Narrow `source` to one instance of that surface — for
4344
- * `dashboard_copilot` or `dashboard_assistant`, a dashboard id (both scope conversation history
4345
- * per dashboard). Requires `source`; sent alone it is a 422.
4346
- * @returns A page of conversations.
4347
- *
4348
- * @example
4349
- * ```ts
4350
- * for await (const row of (
4351
- * await client.scopes.conversations(scopeId).list({ pageSize: 10 })
4352
- * ).autoPagingIter()) {
4353
- * console.log(row.threadId, row.firstMessage, row.messageCount)
4354
- * }
4355
- * ```
4356
- */
4357
- list(options = {}) {
4358
- const pageSize = options.pageSize ?? 25;
4359
- validatePageSize(pageSize);
4360
- return this.listPage(pageSize, options.pageToken, options.source, options.sourceRef);
4361
- }
4362
- async listPage(pageSize, pageToken, source, sourceRef) {
4363
- validateId(this.scopeId, "scope_id");
4364
- const extra = {};
4365
- if (source !== void 0) extra.source = source;
4366
- if (sourceRef !== void 0) extra.sourceRef = sourceRef;
4367
- const data = asRecord(
4368
- await invokeWithRetry(this.config, this.http, "ScopeConversationsController_list", {
4369
- pathParams: { id: this.scopeId },
4370
- query: aipListParams(pageSize, pageToken, extra)
4371
- })
4372
- );
4373
- return buildAipPage(
4374
- data,
4375
- "conversations",
4376
- (raw) => raw,
4377
- (token) => this.listPage(pageSize, token, source, sourceRef)
4378
- );
2169
+ // src/management/_access-config.ts
2170
+ var EVERYONE_GROUP_ID = "__everyone__";
2171
+ function accessConfigWireForCreate(guardrails) {
2172
+ return {
2173
+ visibility: "shared",
2174
+ groupPermissions: { [EVERYONE_GROUP_ID]: { use: true, manage: true } },
2175
+ guardrails,
2176
+ sharedWith: []
2177
+ };
2178
+ }
2179
+ function accessConfigWireForUpdate(existing, guardrails) {
2180
+ if (!existing || Object.keys(existing).length === 0) {
2181
+ return accessConfigWireForCreate(guardrails);
4379
2182
  }
4380
- };
4381
-
4382
- // src/resources/scopes/conversations.ts
4383
- function parseConversation(raw) {
4384
- return raw;
2183
+ return { ...existing, guardrails };
4385
2184
  }
4386
- var ScopeConversationsResource = class extends ScopesConversationsResourceBase {
4387
- /**
4388
- * Retrieve a thread with full message history.
4389
- *
4390
- * @param threadId - Conversation thread id.
4391
- * @param options.messageLimit - Maximum messages to return (1–100).
4392
- * @param options.beforeMessageIndex - Return messages before this index (requires messageLimit).
4393
- * @returns Conversation with `messages` (`type`, `content`).
4394
- *
4395
- * @example
4396
- * ```ts
4397
- * const thread = await client.scopes.conversations(scopeId).get(row.threadId)
4398
- * for (const msg of thread.messages) {
4399
- * console.log(msg.type, String(msg.content).slice(0, 80))
4400
- * }
4401
- * ```
4402
- */
4403
- async get(threadId, options = {}) {
4404
- validateId(this.scopeId, "scope_id");
4405
- validateId(threadId, "thread_id");
4406
- if (options.beforeMessageIndex !== void 0 && options.messageLimit === void 0) {
4407
- throw new Error("beforeMessageIndex requires messageLimit");
4408
- }
4409
- const data = await invokeWithRetry(this.config, this.http, "ScopeConversationsController_get", {
4410
- pathParams: { id: this.scopeId, threadId },
4411
- query: {
4412
- messageLimit: options.messageLimit,
4413
- beforeMessageIndex: options.beforeMessageIndex
4414
- }
4415
- });
4416
- return parseConversation(data);
2185
+ function accessFromSkillResponse(raw) {
2186
+ const value = _nullishCoalesce(raw.accessConfig, () => ( raw.access_config));
2187
+ if (value && typeof value === "object" && !Array.isArray(value)) {
2188
+ return value;
4417
2189
  }
4418
- };
2190
+ return {};
2191
+ }
2192
+ function accessConfigBodyForCreate(guardrails) {
2193
+ if (guardrails === void 0) return void 0;
2194
+ return accessConfigWireForCreate(guardrails);
2195
+ }
2196
+ async function accessConfigBodyForUpdate(guardrails, loadResource) {
2197
+ if (guardrails === void 0) return void 0;
2198
+ const existing = accessFromSkillResponse(await loadResource());
2199
+ return accessConfigWireForUpdate(existing, guardrails);
2200
+ }
4419
2201
 
4420
2202
  // src/_generated/resources/management/scopes/memories.ts
4421
2203
  var ScopesMemoriesResourceBase = class {
@@ -4440,21 +2222,21 @@ var ScopesMemoriesResourceBase = class {
4440
2222
  * @returns A page of memories.
4441
2223
  */
4442
2224
  list(options = {}) {
4443
- const pageSize = options.pageSize ?? 25;
4444
- validatePageSize(pageSize);
2225
+ const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
2226
+ _chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
4445
2227
  return this.listPage(pageSize, options.pageToken, options.userId);
4446
2228
  }
4447
2229
  async listPage(pageSize, pageToken, userId) {
4448
- validateId(this.scopeId, "scope_id");
2230
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
4449
2231
  const extra = {};
4450
2232
  if (userId !== void 0) extra.userId = userId;
4451
- const data = asRecord(
4452
- await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_list", {
2233
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
2234
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeMemoriesController_list", {
4453
2235
  pathParams: { id: this.scopeId },
4454
- query: aipListParams(pageSize, pageToken, extra)
2236
+ query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, extra)
4455
2237
  })
4456
2238
  );
4457
- return buildAipPage(
2239
+ return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
4458
2240
  data,
4459
2241
  "memories",
4460
2242
  (raw) => raw,
@@ -4473,10 +2255,10 @@ var ScopesMemoriesResourceBase = class {
4473
2255
  * @param request - Request body; see `MemorySearchRequest`.
4474
2256
  */
4475
2257
  async search(request) {
4476
- validateId(this.scopeId, "scope_id");
4477
- const data = await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_search", {
2258
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2259
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeMemoriesController_search", {
4478
2260
  pathParams: { id: this.scopeId },
4479
- jsonBody: omitUndefined(request)
2261
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, request)
4480
2262
  });
4481
2263
  return data;
4482
2264
  }
@@ -4494,28 +2276,27 @@ var ScopesMemoriesResourceBase = class {
4494
2276
  * provided fields.
4495
2277
  */
4496
2278
  async update(memoryId, update, options = {}) {
4497
- validateId(memoryId, "memory_id");
4498
- validateId(this.scopeId, "scope_id");
4499
- const data = await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_update", {
2279
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, memoryId, "memory_id");
2280
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2281
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeMemoriesController_update", {
4500
2282
  pathParams: { id: this.scopeId, memoryId },
4501
2283
  query: updateMaskQuery(options.updateMask),
4502
- jsonBody: omitUndefined(update)
2284
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, update)
4503
2285
  });
4504
- return data;
4505
2286
  }
4506
2287
  /**
4507
2288
  * Delete a memory.
4508
2289
  *
4509
- * Deletes one memory. Deleting an already-deleted memory is a no-op.
2290
+ * Deletes one memory. Returns 404 if the memory does not exist or is already deleted.
4510
2291
  *
4511
2292
  * **Requires:** `scopes:write`
4512
2293
  *
4513
2294
  * @param memoryId - Opaque memory id as returned by the list / search endpoints.
4514
2295
  */
4515
2296
  async delete(memoryId) {
4516
- validateId(memoryId, "memory_id");
4517
- validateId(this.scopeId, "scope_id");
4518
- await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_delete", {
2297
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, memoryId, "memory_id");
2298
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2299
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeMemoriesController_delete", {
4519
2300
  pathParams: { id: this.scopeId, memoryId }
4520
2301
  });
4521
2302
  }
@@ -4525,6 +2306,9 @@ var ScopesMemoriesResourceBase = class {
4525
2306
  var ScopeMemoriesResource = class extends ScopesMemoriesResourceBase {
4526
2307
  };
4527
2308
 
2309
+ // src/management/scopes/evaluations.ts
2310
+ var _crypto = require('crypto');
2311
+
4528
2312
  // src/_generated/resources/management/scopes/evaluations.ts
4529
2313
  var ScopesEvaluationsResourceBase = class {
4530
2314
  /** @internal */
@@ -4542,8 +2326,8 @@ var ScopesEvaluationsResourceBase = class {
4542
2326
  * **Requires:** `scopes:read`
4543
2327
  */
4544
2328
  async getConfig() {
4545
- validateId(this.scopeId, "scope_id");
4546
- const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_getConfig", {
2329
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2330
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "EvaluationsController_getConfig", {
4547
2331
  pathParams: { id: this.scopeId }
4548
2332
  });
4549
2333
  return data;
@@ -4559,10 +2343,10 @@ var ScopesEvaluationsResourceBase = class {
4559
2343
  * @param update - Request body; see `UpdateEvaluationConfig`.
4560
2344
  */
4561
2345
  async updateConfig(update) {
4562
- validateId(this.scopeId, "scope_id");
4563
- const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_updateConfig", {
2346
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2347
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "EvaluationsController_updateConfig", {
4564
2348
  pathParams: { id: this.scopeId },
4565
- jsonBody: omitUndefined(update)
2349
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, update)
4566
2350
  });
4567
2351
  return data;
4568
2352
  }
@@ -4577,8 +2361,8 @@ var ScopesEvaluationsResourceBase = class {
4577
2361
  * /scopes/{id}/evaluations/runs/{runId}` for status.
4578
2362
  */
4579
2363
  async triggerRun() {
4580
- validateId(this.scopeId, "scope_id");
4581
- const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_triggerRun", {
2364
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2365
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "EvaluationsController_triggerRun", {
4582
2366
  pathParams: { id: this.scopeId }
4583
2367
  });
4584
2368
  return data;
@@ -4591,22 +2375,24 @@ var ScopesEvaluationsResourceBase = class {
4591
2375
  * **Requires:** `scopes:read`
4592
2376
  *
4593
2377
  * @param options.pageSize - Items per page. Defaults to 25.
2378
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
2379
+ * for the first page.
4594
2380
  * @returns A page of runs.
4595
2381
  */
4596
2382
  listRuns(options = {}) {
4597
- const pageSize = options.pageSize ?? 25;
4598
- validatePageSize(pageSize);
2383
+ const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
2384
+ _chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
4599
2385
  return this.listRunsPage(pageSize, options.pageToken);
4600
2386
  }
4601
2387
  async listRunsPage(pageSize, pageToken) {
4602
- validateId(this.scopeId, "scope_id");
4603
- const data = asRecord(
4604
- await invokeWithRetry(this.config, this.http, "EvaluationsController_listRuns", {
2388
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2389
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
2390
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "EvaluationsController_listRuns", {
4605
2391
  pathParams: { id: this.scopeId },
4606
- query: aipListParams(pageSize, pageToken)
2392
+ query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken)
4607
2393
  })
4608
2394
  );
4609
- return buildAipPage(
2395
+ return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
4610
2396
  data,
4611
2397
  "runs",
4612
2398
  (raw) => raw,
@@ -4623,9 +2409,9 @@ var ScopesEvaluationsResourceBase = class {
4623
2409
  * @param runId - Run ID.
4624
2410
  */
4625
2411
  async getRun(runId) {
4626
- validateId(this.scopeId, "scope_id");
4627
- validateId(runId, "run_id");
4628
- const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_getRun", {
2412
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2413
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, runId, "run_id");
2414
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "EvaluationsController_getRun", {
4629
2415
  pathParams: { id: this.scopeId, runId }
4630
2416
  });
4631
2417
  return data;
@@ -4634,6 +2420,74 @@ var ScopesEvaluationsResourceBase = class {
4634
2420
 
4635
2421
  // src/management/scopes/evaluations.ts
4636
2422
  var ScopeEvaluationsResource = class extends ScopesEvaluationsResourceBase {
2423
+ /**
2424
+ * Add one evaluation case and return the stored case.
2425
+ *
2426
+ * @param input.task - What the scope should do. An empty string is allowed.
2427
+ * @param input.expectedOutput - What a correct result looks like. An empty string is allowed.
2428
+ * @param input.id - Stable id. Omit it and the client assigns one before the request, so a retry sends the same id.
2429
+ * @returns The stored evaluation case, including its id.
2430
+ * @throws ConflictError An evaluation case with this id already exists. A retry after the case was stored returns this error. An identical body is not treated as success.
2431
+ * @example
2432
+ * ```ts
2433
+ * const mgmt = new ModusManagement()
2434
+ * const added = await mgmt.scopes.evaluations(42).addCase({
2435
+ * task: "Summarize last quarter's revenue",
2436
+ * expectedOutput: 'A one-paragraph summary with the total',
2437
+ * })
2438
+ * console.log(added.id)
2439
+ * ```
2440
+ */
2441
+ async addCase(input) {
2442
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2443
+ const id = _nullishCoalesce(input.id, () => ( _crypto.randomUUID.call(void 0, )));
2444
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, id, "id");
2445
+ return await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_addEvaluationCase", {
2446
+ pathParams: { id: this.scopeId },
2447
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, { ...input, id })
2448
+ });
2449
+ }
2450
+ /**
2451
+ * Change the task, the expected output, or both, for one evaluation case.
2452
+ *
2453
+ * @param caseId - Id of the case to change.
2454
+ * @param patch.task - Replacement task. Omit to leave it unchanged.
2455
+ * @param patch.expectedOutput - Replacement expected output. Omit to leave it unchanged.
2456
+ * @returns The evaluation case after the change.
2457
+ * @example
2458
+ * ```ts
2459
+ * const mgmt = new ModusManagement()
2460
+ * const updated = await mgmt.scopes.evaluations(42).updateCase('CASE_ID', {
2461
+ * task: 'Summarize revenue in two sentences',
2462
+ * })
2463
+ * console.log(updated.task)
2464
+ * ```
2465
+ */
2466
+ async updateCase(caseId, patch) {
2467
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2468
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, caseId, "case_id");
2469
+ return await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_updateEvaluationCase", {
2470
+ pathParams: { id: this.scopeId, caseId },
2471
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, patch)
2472
+ });
2473
+ }
2474
+ /**
2475
+ * Remove one evaluation case. The other cases stay as they are.
2476
+ *
2477
+ * @param caseId - Id of the case to remove.
2478
+ * @example
2479
+ * ```ts
2480
+ * const mgmt = new ModusManagement()
2481
+ * await mgmt.scopes.evaluations(42).deleteCase('CASE_ID')
2482
+ * ```
2483
+ */
2484
+ async deleteCase(caseId) {
2485
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2486
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, caseId, "case_id");
2487
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_deleteEvaluationCase", {
2488
+ pathParams: { id: this.scopeId, caseId }
2489
+ });
2490
+ }
4637
2491
  };
4638
2492
 
4639
2493
  // src/_generated/resources/management/scopes/interfaces.ts
@@ -4653,8 +2507,8 @@ var ScopesInterfacesResourceBase = class {
4653
2507
  * **Requires:** `scopes:read`
4654
2508
  */
4655
2509
  async list() {
4656
- validateId(this.scopeId, "scope_id");
4657
- const data = await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_list", {
2510
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2511
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeInterfacesController_list", {
4658
2512
  pathParams: { id: this.scopeId }
4659
2513
  });
4660
2514
  return data.interfaces;
@@ -4670,9 +2524,9 @@ var ScopesInterfacesResourceBase = class {
4670
2524
  * @param interfaceId - Interface id (UUID).
4671
2525
  */
4672
2526
  async delete(interfaceId) {
4673
- validateId(this.scopeId, "scope_id");
4674
- validateId(interfaceId, "interface_id");
4675
- await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_delete", {
2527
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2528
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, interfaceId, "interface_id");
2529
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeInterfacesController_delete", {
4676
2530
  pathParams: { id: this.scopeId, interfaceId }
4677
2531
  });
4678
2532
  }
@@ -4687,10 +2541,10 @@ var ScopeInterfacesResource = class extends ScopesInterfacesResourceBase {
4687
2541
  * @returns The created interface.
4688
2542
  */
4689
2543
  async create(options) {
4690
- validateId(this.scopeId, "scope_id");
4691
- return await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_add", {
2544
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2545
+ return await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeInterfacesController_add", {
4692
2546
  pathParams: { id: this.scopeId },
4693
- jsonBody: omitUndefined(options)
2547
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, options)
4694
2548
  });
4695
2549
  }
4696
2550
  /**
@@ -4702,12 +2556,12 @@ var ScopeInterfacesResource = class extends ScopesInterfacesResourceBase {
4702
2556
  * @returns The updated interface.
4703
2557
  */
4704
2558
  async update(interfaceId, options, updateMask) {
4705
- validateId(this.scopeId, "scope_id");
4706
- validateId(interfaceId, "interface_id");
4707
- return await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_update", {
2559
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2560
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, interfaceId, "interface_id");
2561
+ return await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeInterfacesController_update", {
4708
2562
  pathParams: { id: this.scopeId, interfaceId },
4709
2563
  query: updateMaskQuery(updateMask),
4710
- jsonBody: updateMask === void 0 ? omitUndefined(options) : options
2564
+ jsonBody: updateBody(options, updateMask)
4711
2565
  });
4712
2566
  }
4713
2567
  };
@@ -4732,8 +2586,8 @@ var ScopesSupervisionResourceBase = class {
4732
2586
  * @param options.view - Which variation snapshot to read. Defaults to `active`.
4733
2587
  */
4734
2588
  async get(options = {}) {
4735
- validateId(this.scopeId, "scope_id");
4736
- const data = await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_get", {
2589
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2590
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeSupervisionController_get", {
4737
2591
  pathParams: { id: this.scopeId },
4738
2592
  query: { view: options.view }
4739
2593
  });
@@ -4751,8 +2605,8 @@ var ScopesSupervisionResourceBase = class {
4751
2605
  * @param request - Request body; see `SetSupervisionRequest`.
4752
2606
  */
4753
2607
  async set(request) {
4754
- validateId(this.scopeId, "scope_id");
4755
- const data = await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_set", {
2608
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2609
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeSupervisionController_set", {
4756
2610
  pathParams: { id: this.scopeId },
4757
2611
  jsonBody: request
4758
2612
  });
@@ -4770,8 +2624,8 @@ var ScopesSupervisionResourceBase = class {
4770
2624
  * @param request - Request body; see `SetSupervisionRequest`.
4771
2625
  */
4772
2626
  async setActive(request) {
4773
- validateId(this.scopeId, "scope_id");
4774
- const data = await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_setActive", {
2627
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, this.scopeId, "scope_id");
2628
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeSupervisionController_setActive", {
4775
2629
  pathParams: { id: this.scopeId },
4776
2630
  jsonBody: request
4777
2631
  });
@@ -4790,6 +2644,7 @@ var MANAGEMENT_SCOPE_OPERATIONS = {
4790
2644
  create: "ScopesController_create",
4791
2645
  update: "ScopesController_update",
4792
2646
  deploy: "ScopesController_deploy",
2647
+ applySelectionOps: "ScopesController_applySelectionOps",
4793
2648
  delete: "ScopesController_delete",
4794
2649
  restore: "ScopesController_restore",
4795
2650
  requestOwnershipTransfer: "ScopesController_requestOwnershipTransfer",
@@ -4813,7 +2668,7 @@ var ManagementScopesResource = class extends ScopesResourceBase {
4813
2668
  * @returns A conversations resource scoped to the scope.
4814
2669
  */
4815
2670
  conversations(scopeId) {
4816
- return new ScopeConversationsResource(this.http, this.config, scopeId);
2671
+ return new (0, _chunk3MHHVC6Ccjs.ScopeConversationsResource)(this.http, this.config, scopeId);
4817
2672
  }
4818
2673
  /**
4819
2674
  * Long-term memories for a scope.
@@ -4870,7 +2725,7 @@ var ManagementScopesResource = class extends ScopesResourceBase {
4870
2725
  * ```
4871
2726
  */
4872
2727
  async create(options) {
4873
- const body = omitUndefined({
2728
+ const body = _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, {
4874
2729
  name: options.name,
4875
2730
  description: options.description,
4876
2731
  expectedOutput: options.expectedOutput,
@@ -4883,7 +2738,7 @@ var ManagementScopesResource = class extends ScopesResourceBase {
4883
2738
  interfaces: options.interfaces,
4884
2739
  accessConfig: accessConfigBodyForCreate(options.guardrails)
4885
2740
  });
4886
- const data = await invokeWithRetry(this.config, this.http, this.ops.create, {
2741
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.create, {
4887
2742
  jsonBody: body
4888
2743
  });
4889
2744
  return parseScope(data);
@@ -4892,10 +2747,13 @@ var ManagementScopesResource = class extends ScopesResourceBase {
4892
2747
  * Update a scope's configuration.
4893
2748
  *
4894
2749
  * Only the fields you pass are changed. To clear a field, name it in
4895
- * `updateMask` (comma-separated field names) and leave its argument unset.
2750
+ * `updateMask` (comma-separated field names) and leave its argument unset:
2751
+ * it is sent as `null`.
4896
2752
  *
4897
- * @param scopeId - Scope id.
2753
+ * @param scopeId - Numeric scope id.
4898
2754
  * @param options.guardrails - Guardrail labels to set. Fetches the current scope first to merge. Pass `[]` to clear all.
2755
+ * @param options.managerId - Numeric id of the manager scope to move this scope under, or `null`
2756
+ * to detach it. Send it alone: the server rejects it combined with other fields.
4899
2757
  * @param options.updateMask - Comma-separated field names to update or clear.
4900
2758
  * @returns The updated scope.
4901
2759
  * @example
@@ -4907,11 +2765,11 @@ var ManagementScopesResource = class extends ScopesResourceBase {
4907
2765
  * ```
4908
2766
  */
4909
2767
  async update(scopeId, options = {}) {
4910
- validateId(scopeId, "scope_id");
2768
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
4911
2769
  const accessConfig = await accessConfigBodyForUpdate(
4912
2770
  options.guardrails,
4913
- async () => asRecord(
4914
- await invokeWithRetry(this.config, this.http, this.ops.get, {
2771
+ async () => _chunk3MHHVC6Ccjs.asRecord.call(void 0,
2772
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.get, {
4915
2773
  pathParams: { id: scopeId }
4916
2774
  })
4917
2775
  )
@@ -4931,8 +2789,8 @@ var ManagementScopesResource = class extends ScopesResourceBase {
4931
2789
  evaluations: options.evaluations,
4932
2790
  supervisionSubordinateDescriptions: options.supervisionSubordinateDescriptions
4933
2791
  };
4934
- const body = options.updateMask !== void 0 ? fields : omitUndefined(fields);
4935
- const data = await invokeWithRetry(this.config, this.http, this.ops.update, {
2792
+ const body = updateBody(fields, options.updateMask);
2793
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.update, {
4936
2794
  pathParams: { id: scopeId },
4937
2795
  query: updateMaskQuery(options.updateMask),
4938
2796
  jsonBody: body
@@ -4953,31 +2811,70 @@ var ManagementScopesResource = class extends ScopesResourceBase {
4953
2811
  * ```
4954
2812
  */
4955
2813
  async deploy(scopeId) {
4956
- validateId(scopeId, "scope_id");
4957
- const data = asRecord(
4958
- await invokeWithRetry(this.config, this.http, this.ops.deploy, {
2814
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2815
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
2816
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.deploy, {
4959
2817
  pathParams: { id: scopeId },
4960
2818
  jsonBody: {}
4961
2819
  })
4962
2820
  );
4963
2821
  return parseScope(data.scope);
4964
2822
  }
2823
+ /**
2824
+ * Apply selection changes to a scope.
2825
+ *
2826
+ * Pass `validateOnly: true` to run the same checks and return the scope that would
2827
+ * be saved, without writing. Set a connection with `setConnectionPreferences` and
2828
+ * remove it with `removeConnection`.
2829
+ *
2830
+ * @param scopeId - Scope id.
2831
+ * @param ops - Selection changes, applied in order.
2832
+ * @param options.toolset - The scope toolset after the edit, when the edit changed it.
2833
+ * @param options.validateOnly - When true, check and return the planned scope without writing.
2834
+ * @returns The scope, or the scope that would be saved when `validateOnly` is true.
2835
+ * @example
2836
+ * ```ts
2837
+ * const mgmt = new ModusManagement()
2838
+ * const preview = await mgmt.scopes.applySelectionOps(42, [{
2839
+ * op: 'setConnectionPreferences',
2840
+ * connectionId: '11111111-1111-4111-8111-111111111111',
2841
+ * preferences: { schemaVersion: 2, mode: 'all', include: [], exclude: [] },
2842
+ * }], { validateOnly: true })
2843
+ * console.log(preview.id)
2844
+ * ```
2845
+ */
2846
+ async applySelectionOps(scopeId, ops, options) {
2847
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2848
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.applySelectionOps, {
2849
+ pathParams: { id: scopeId },
2850
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, {
2851
+ ops,
2852
+ toolset: _optionalChain([options, 'optionalAccess', _17 => _17.toolset]),
2853
+ validateOnly: _optionalChain([options, 'optionalAccess', _18 => _18.validateOnly]) ? true : void 0
2854
+ })
2855
+ });
2856
+ return parseScope(data);
2857
+ }
4965
2858
  /**
4966
2859
  * Start transferring ownership of a scope to another organization member.
4967
2860
  *
2861
+ * The current owner calls this, and the recipient accepts. A scope with no owner (one
2862
+ * created with a service-account token) can be given one by an organization owner;
2863
+ * assigning yourself takes effect at once.
2864
+ *
4968
2865
  * @param scopeId - Scope id.
4969
2866
  * @param options.newOwnerUserId - User id of the proposed new owner.
4970
2867
  * @returns The scope with a pending ownership transfer.
4971
2868
  */
4972
2869
  async requestOwnershipTransfer(scopeId, options) {
4973
- validateId(scopeId, "scope_id");
4974
- const data = await invokeWithRetry(
2870
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2871
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0,
4975
2872
  this.config,
4976
2873
  this.http,
4977
2874
  this.ops.requestOwnershipTransfer,
4978
2875
  {
4979
2876
  pathParams: { id: scopeId },
4980
- jsonBody: omitUndefined({ newOwnerUserId: options.newOwnerUserId })
2877
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, { newOwnerUserId: options.newOwnerUserId })
4981
2878
  }
4982
2879
  );
4983
2880
  return parseScope(data);
@@ -4989,10 +2886,10 @@ var ManagementScopesResource = class extends ScopesResourceBase {
4989
2886
  * @param options.mcpConfig - MCP configuration object.
4990
2887
  */
4991
2888
  async patchMcpConfig(scopeId, options) {
4992
- validateId(scopeId, "scope_id");
4993
- await invokeWithRetry(this.config, this.http, this.ops.patchMcpConfig, {
2889
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2890
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.patchMcpConfig, {
4994
2891
  pathParams: { id: scopeId },
4995
- jsonBody: omitUndefined({ config: options.mcpConfig })
2892
+ jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, { config: options.mcpConfig })
4996
2893
  });
4997
2894
  }
4998
2895
  /**
@@ -5003,9 +2900,9 @@ var ManagementScopesResource = class extends ScopesResourceBase {
5003
2900
  * @returns The scope variation.
5004
2901
  */
5005
2902
  async getVariation(scopeId, options) {
5006
- validateId(scopeId, "scope_id");
5007
- validateId(options.variationUid, "variation_uid");
5008
- const data = await invokeWithRetry(this.config, this.http, this.ops.getVariation, {
2903
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
2904
+ _chunk3MHHVC6Ccjs.validateId.call(void 0, options.variationUid, "variation_uid");
2905
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, this.ops.getVariation, {
5009
2906
  pathParams: { id: scopeId, variationUid: options.variationUid }
5010
2907
  });
5011
2908
  return parseScope(data);
@@ -5032,7 +2929,7 @@ var UsageResourceBase = class {
5032
2929
  * @param options.until - ISO8601 end of the query window (exclusive).
5033
2930
  */
5034
2931
  async listUsers(options) {
5035
- const data = await invokeWithRetry(this.config, this.http, "UsageController_listUsers", {
2932
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "UsageController_listUsers", {
5036
2933
  query: { since: options.since, until: options.until }
5037
2934
  });
5038
2935
  return data;
@@ -5061,7 +2958,7 @@ var ManagementUsageResource = class extends UsageResourceBase {
5061
2958
  };
5062
2959
  if (options.model !== void 0) query.model = options.model;
5063
2960
  if (options.userEmail !== void 0) query.user_email = [...options.userEmail];
5064
- const data = await invokeWithRetry(this.config, this.http, "UsageController_list", { query });
2961
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "UsageController_list", { query });
5065
2962
  return data;
5066
2963
  }
5067
2964
  };
@@ -5087,17 +2984,17 @@ var ToolsResourceBase = class {
5087
2984
  * @returns A page of tools.
5088
2985
  */
5089
2986
  list(options = {}) {
5090
- const pageSize = options.pageSize ?? 25;
5091
- validatePageSize(pageSize);
2987
+ const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
2988
+ _chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
5092
2989
  return this.listPage(pageSize, options.pageToken);
5093
2990
  }
5094
2991
  async listPage(pageSize, pageToken) {
5095
- const data = asRecord(
5096
- await invokeWithRetry(this.config, this.http, "ToolsController_list", {
5097
- query: aipListParams(pageSize, pageToken)
2992
+ const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
2993
+ await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ToolsController_list", {
2994
+ query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken)
5098
2995
  })
5099
2996
  );
5100
- return buildAipPage(
2997
+ return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
5101
2998
  data,
5102
2999
  "tools",
5103
3000
  (raw) => raw,
@@ -5118,7 +3015,7 @@ var ManagementUsersResource = class {
5118
3015
  }
5119
3016
  /** List member groups in the organization. */
5120
3017
  async listMemberGroups() {
5121
- const data = await invokeWithRetry(
3018
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0,
5122
3019
  this.config,
5123
3020
  this.http,
5124
3021
  "MemberGroupsController_list"
@@ -5127,7 +3024,7 @@ var ManagementUsersResource = class {
5127
3024
  }
5128
3025
  /** List organization members. */
5129
3026
  async listOrgMembers() {
5130
- const data = await invokeWithRetry(
3027
+ const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0,
5131
3028
  this.config,
5132
3029
  this.http,
5133
3030
  "OrgMembersController_list"
@@ -5137,7 +3034,7 @@ var ManagementUsersResource = class {
5137
3034
  };
5138
3035
 
5139
3036
  // src/management/index.ts
5140
- var ModusManagement = class extends ModusClientBase {
3037
+ var ModusManagement = class extends _chunk3MHHVC6Ccjs.ModusClientBase {
5141
3038
  constructor(options = {}) {
5142
3039
  super(options);
5143
3040
  this.scopes = new ManagementScopesResource(this.http, this.config);
@@ -5148,8 +3045,7 @@ var ModusManagement = class extends ModusClientBase {
5148
3045
  this.users = new ManagementUsersResource(this.http, this.config);
5149
3046
  }
5150
3047
  };
5151
- // Annotate the CommonJS export names for ESM import in node:
5152
- 0 && (module.exports = {
5153
- ModusManagement
5154
- });
3048
+
3049
+
3050
+ exports.ModusManagement = ModusManagement;
5155
3051
  //# sourceMappingURL=index.cjs.map