@getmodus/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/chunk-VLHNZJBG.js +1681 -0
- package/dist/chunk-VLHNZJBG.js.map +1 -0
- package/dist/conversations-nx1ujbiv.d.cts +19329 -0
- package/dist/conversations-nx1ujbiv.d.ts +19329 -0
- package/dist/index.cjs +2546 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +365 -0
- package/dist/index.d.ts +365 -0
- package/dist/index.js +888 -0
- package/dist/index.js.map +1 -0
- package/dist/management/index.cjs +2514 -0
- package/dist/management/index.cjs.map +1 -0
- package/dist/management/index.d.cts +351 -0
- package/dist/management/index.d.ts +351 -0
- package/dist/management/index.js +896 -0
- package/dist/management/index.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,2514 @@
|
|
|
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);
|
|
19
|
+
|
|
20
|
+
// src/management/index.ts
|
|
21
|
+
var management_exports = {};
|
|
22
|
+
__export(management_exports, {
|
|
23
|
+
ModusManagement: () => ModusManagement
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(management_exports);
|
|
26
|
+
|
|
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
|
+
|
|
97
|
+
// src/_auth.ts
|
|
98
|
+
var ENV_API_KEY = "MODUS_API_KEY";
|
|
99
|
+
var ENV_BASE_URL = "MODUS_BASE_URL";
|
|
100
|
+
var ENV_TIMEOUT = "MODUS_TIMEOUT";
|
|
101
|
+
var ENV_MAX_RETRIES = "MODUS_MAX_RETRIES";
|
|
102
|
+
var KEY_PREFIX = "modus_";
|
|
103
|
+
function resolveApiKey(apiKey) {
|
|
104
|
+
const key = apiKey ?? process.env[ENV_API_KEY];
|
|
105
|
+
if (!key) {
|
|
106
|
+
throw new AuthenticationError(
|
|
107
|
+
`No API key provided. Pass apiKey or set the ${ENV_API_KEY} environment variable. Create a token at app.modus.com \u2192 Settings \u2192 API Tokens.`
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
if (!key.startsWith(KEY_PREFIX)) {
|
|
111
|
+
throw new AuthenticationError(
|
|
112
|
+
`Invalid API key format. Modus API keys start with '${KEY_PREFIX}'. Create a token at app.modus.com \u2192 Settings \u2192 API Tokens.`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return key;
|
|
116
|
+
}
|
|
117
|
+
function resolveBaseUrl(baseUrl) {
|
|
118
|
+
return baseUrl ?? process.env[ENV_BASE_URL] ?? void 0;
|
|
119
|
+
}
|
|
120
|
+
function resolveTimeoutMs(explicitMs) {
|
|
121
|
+
if (explicitMs !== void 0) return explicitMs;
|
|
122
|
+
const raw = process.env[ENV_TIMEOUT];
|
|
123
|
+
if (raw === void 0) return void 0;
|
|
124
|
+
const seconds = Number(raw);
|
|
125
|
+
return Number.isFinite(seconds) ? seconds * 1e3 : void 0;
|
|
126
|
+
}
|
|
127
|
+
function resolveMaxRetries(explicit) {
|
|
128
|
+
if (explicit !== void 0) {
|
|
129
|
+
if (explicit < 0) throw new Error(`max_retries must be >= 0, got ${explicit}`);
|
|
130
|
+
return explicit;
|
|
131
|
+
}
|
|
132
|
+
const raw = process.env[ENV_MAX_RETRIES];
|
|
133
|
+
if (raw === void 0) return void 0;
|
|
134
|
+
const value = Number.parseInt(raw, 10);
|
|
135
|
+
return Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
136
|
+
}
|
|
137
|
+
function authHeaders(apiKey) {
|
|
138
|
+
return { Authorization: `Bearer ${apiKey}` };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// src/_config.ts
|
|
142
|
+
var DEFAULT_BASE_URL = "https://api.modus.com";
|
|
143
|
+
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
144
|
+
var DEFAULT_MAX_RETRIES = 2;
|
|
145
|
+
function normalizeBaseUrl(baseUrl) {
|
|
146
|
+
return baseUrl.replace(/\/$/, "");
|
|
147
|
+
}
|
|
148
|
+
function normalizeBaseUrls(baseUrls) {
|
|
149
|
+
return Object.fromEntries(
|
|
150
|
+
Object.entries(baseUrls ?? {}).map(([service, baseUrl]) => [
|
|
151
|
+
service,
|
|
152
|
+
normalizeBaseUrl(baseUrl)
|
|
153
|
+
])
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
function createModusConfig(options = {}) {
|
|
157
|
+
const maxRetries = resolveMaxRetries(options.maxRetries) ?? DEFAULT_MAX_RETRIES;
|
|
158
|
+
if (!Number.isInteger(maxRetries) || maxRetries < 0) {
|
|
159
|
+
throw new Error(`max_retries must be a non-negative int, got ${maxRetries}`);
|
|
160
|
+
}
|
|
161
|
+
const baseUrl = normalizeBaseUrl(resolveBaseUrl(options.baseUrl) ?? DEFAULT_BASE_URL);
|
|
162
|
+
return Object.freeze({
|
|
163
|
+
apiKey: resolveApiKey(options.apiKey),
|
|
164
|
+
baseUrl,
|
|
165
|
+
baseUrls: Object.freeze({ "modus-api": baseUrl, ...normalizeBaseUrls(options.baseUrls) }),
|
|
166
|
+
timeoutMs: resolveTimeoutMs(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS,
|
|
167
|
+
maxRetries,
|
|
168
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function resolveServiceBaseUrl(config, service, generatedBaseUrl) {
|
|
172
|
+
return config.baseUrls[service] ?? generatedBaseUrl ?? config.baseUrl;
|
|
173
|
+
}
|
|
174
|
+
function formatConfigForLog(config) {
|
|
175
|
+
const masked = config.apiKey.length > 10 ? `${config.apiKey.slice(0, 10)}***` : "***";
|
|
176
|
+
return `ModusConfig(apiKey=${JSON.stringify(masked)}, baseUrl=${JSON.stringify(config.baseUrl)}, timeoutMs=${config.timeoutMs}, maxRetries=${config.maxRetries})`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/_http.ts
|
|
180
|
+
var USER_AGENT = `modus-typescript/${"0.1.0"} (node/${process.version}; ${process.platform})`;
|
|
181
|
+
function buildUrl(baseUrl, path, params) {
|
|
182
|
+
const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
|
|
183
|
+
if (params) {
|
|
184
|
+
for (const [key, value] of Object.entries(params)) {
|
|
185
|
+
if (value === void 0 || value === null) continue;
|
|
186
|
+
if (Array.isArray(value)) {
|
|
187
|
+
for (const item of value) url.searchParams.append(key, String(item));
|
|
188
|
+
} else {
|
|
189
|
+
url.searchParams.set(key, String(value));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return url.toString();
|
|
194
|
+
}
|
|
195
|
+
function headersToRecord(headers) {
|
|
196
|
+
const out = {};
|
|
197
|
+
headers.forEach((value, key) => {
|
|
198
|
+
out[key] = value;
|
|
199
|
+
});
|
|
200
|
+
return out;
|
|
201
|
+
}
|
|
202
|
+
function messageFromBody(raw, statusCode) {
|
|
203
|
+
if (!raw) return `HTTP ${statusCode}`;
|
|
204
|
+
try {
|
|
205
|
+
const body = JSON.parse(raw);
|
|
206
|
+
if (body && typeof body === "object") {
|
|
207
|
+
const record = body;
|
|
208
|
+
const envelope = record.error;
|
|
209
|
+
if (envelope && typeof envelope === "object") {
|
|
210
|
+
const msg2 = envelope.message;
|
|
211
|
+
if (typeof msg2 === "string" && msg2) return msg2;
|
|
212
|
+
}
|
|
213
|
+
const msg = record.message ?? record.error;
|
|
214
|
+
if (Array.isArray(msg)) return msg.map(String).join("; ");
|
|
215
|
+
if (typeof msg === "string" && msg) return msg;
|
|
216
|
+
}
|
|
217
|
+
} catch {
|
|
218
|
+
}
|
|
219
|
+
return raw;
|
|
220
|
+
}
|
|
221
|
+
function errorCodeFromBody(raw) {
|
|
222
|
+
try {
|
|
223
|
+
const body = JSON.parse(raw);
|
|
224
|
+
return typeof body.error?.code === "string" ? body.error.code : void 0;
|
|
225
|
+
} catch {
|
|
226
|
+
return void 0;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function raiseForStatus(response, body) {
|
|
230
|
+
if (response.ok) return;
|
|
231
|
+
const message = messageFromBody(body, response.status);
|
|
232
|
+
const requestId = response.headers.get("x-request-id") ?? response.headers.get("X-Request-ID") ?? void 0;
|
|
233
|
+
const headers = headersToRecord(response.headers);
|
|
234
|
+
const code = errorCodeFromBody(body);
|
|
235
|
+
const base = { requestId, responseHeaders: headers, body, code };
|
|
236
|
+
switch (response.status) {
|
|
237
|
+
case 401:
|
|
238
|
+
throw new AuthenticationError(message, base);
|
|
239
|
+
case 403:
|
|
240
|
+
throw new PermissionDeniedError(message, base);
|
|
241
|
+
case 404:
|
|
242
|
+
throw new NotFoundError(message, base);
|
|
243
|
+
case 409:
|
|
244
|
+
throw new ConflictError(message, base);
|
|
245
|
+
case 422: {
|
|
246
|
+
let errors;
|
|
247
|
+
try {
|
|
248
|
+
errors = JSON.parse(body);
|
|
249
|
+
} catch {
|
|
250
|
+
errors = void 0;
|
|
251
|
+
}
|
|
252
|
+
throw new UnprocessableError(message, { ...base, errors });
|
|
253
|
+
}
|
|
254
|
+
case 429: {
|
|
255
|
+
const retryHeader = response.headers.get("retry-after") ?? "";
|
|
256
|
+
const retryAfter = /^\d+$/.test(retryHeader) ? Number.parseInt(retryHeader, 10) : void 0;
|
|
257
|
+
throw new RateLimitError(message, { ...base, retryAfter });
|
|
258
|
+
}
|
|
259
|
+
default:
|
|
260
|
+
if (response.status >= 500) {
|
|
261
|
+
throw new InternalServerError(message, response.status, base);
|
|
262
|
+
}
|
|
263
|
+
throw new ModusError(message, { ...base, statusCode: response.status });
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function wrapNetworkError(error, baseUrl) {
|
|
267
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
268
|
+
return new APIConnectionError(
|
|
269
|
+
`Network error communicating with Modus API at ${JSON.stringify(baseUrl)}: ${detail}. Check connectivity and that baseUrl is correct.`
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
async function readBody(response) {
|
|
273
|
+
return response.text();
|
|
274
|
+
}
|
|
275
|
+
var HttpClient = class {
|
|
276
|
+
constructor(config) {
|
|
277
|
+
this.config = config;
|
|
278
|
+
}
|
|
279
|
+
defaultHeaders() {
|
|
280
|
+
return {
|
|
281
|
+
...authHeaders(this.config.apiKey),
|
|
282
|
+
Accept: "application/json",
|
|
283
|
+
"Content-Type": "application/json",
|
|
284
|
+
"User-Agent": USER_AGENT
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
async request(method, path, options = {}) {
|
|
288
|
+
const baseUrl = options.baseUrl ?? this.config.baseUrl;
|
|
289
|
+
const url = buildUrl(baseUrl, path, options.params);
|
|
290
|
+
try {
|
|
291
|
+
const response = await this.config.fetch(url, {
|
|
292
|
+
method,
|
|
293
|
+
headers: { ...this.defaultHeaders(), ...options.headers },
|
|
294
|
+
body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
|
|
295
|
+
signal: AbortSignal.timeout(this.config.timeoutMs)
|
|
296
|
+
});
|
|
297
|
+
const body = await readBody(response);
|
|
298
|
+
raiseForStatus(response, body);
|
|
299
|
+
if (response.status === 204 || !body) return null;
|
|
300
|
+
return JSON.parse(body);
|
|
301
|
+
} catch (error) {
|
|
302
|
+
if (error instanceof ModusError) throw error;
|
|
303
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
304
|
+
throw wrapNetworkError(new Error("Request timed out"), baseUrl);
|
|
305
|
+
}
|
|
306
|
+
throw wrapNetworkError(error, baseUrl);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
get(path, params, options = {}) {
|
|
310
|
+
return this.request("GET", path, { params, ...options });
|
|
311
|
+
}
|
|
312
|
+
post(path, json, options = {}) {
|
|
313
|
+
return this.request("POST", path, { json, ...options });
|
|
314
|
+
}
|
|
315
|
+
patch(path, json, params, options = {}) {
|
|
316
|
+
return this.request("PATCH", path, { json, params, ...options });
|
|
317
|
+
}
|
|
318
|
+
delete(path, options = {}) {
|
|
319
|
+
return this.request("DELETE", path, options);
|
|
320
|
+
}
|
|
321
|
+
async *stream(method, path, options = {}) {
|
|
322
|
+
const baseUrl = options.baseUrl ?? this.config.baseUrl;
|
|
323
|
+
const url = buildUrl(baseUrl, path, options.params);
|
|
324
|
+
try {
|
|
325
|
+
const response = await this.config.fetch(url, {
|
|
326
|
+
method,
|
|
327
|
+
headers: { ...this.defaultHeaders(), ...options.headers },
|
|
328
|
+
body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
|
|
329
|
+
signal: AbortSignal.timeout(this.config.timeoutMs)
|
|
330
|
+
});
|
|
331
|
+
if (!response.ok) {
|
|
332
|
+
const body = await readBody(response);
|
|
333
|
+
raiseForStatus(response, body);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (!response.body) return;
|
|
337
|
+
const reader = response.body.getReader();
|
|
338
|
+
const decoder = new TextDecoder();
|
|
339
|
+
let buffer = "";
|
|
340
|
+
while (true) {
|
|
341
|
+
const { done, value } = await reader.read();
|
|
342
|
+
if (done) break;
|
|
343
|
+
buffer += decoder.decode(value, { stream: true });
|
|
344
|
+
const lines = buffer.split("\n");
|
|
345
|
+
buffer = lines.pop() ?? "";
|
|
346
|
+
for (const line of lines) {
|
|
347
|
+
if (line.trim()) yield line;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (buffer.trim()) yield buffer;
|
|
351
|
+
} catch (error) {
|
|
352
|
+
if (error instanceof ModusError) throw error;
|
|
353
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
354
|
+
throw wrapNetworkError(new Error("Request timed out"), baseUrl);
|
|
355
|
+
}
|
|
356
|
+
throw wrapNetworkError(error, baseUrl);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
streamGet(path, params, options = {}) {
|
|
360
|
+
return this.stream("GET", path, { params, ...options });
|
|
361
|
+
}
|
|
362
|
+
streamPost(path, json, options = {}) {
|
|
363
|
+
return this.stream("POST", path, { json, ...options });
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
// src/_client-base.ts
|
|
368
|
+
var ModusClientBase = class {
|
|
369
|
+
constructor(options = {}) {
|
|
370
|
+
this._config = createModusConfig(options);
|
|
371
|
+
this._http = new HttpClient(this._config);
|
|
372
|
+
}
|
|
373
|
+
get config() {
|
|
374
|
+
return this._config;
|
|
375
|
+
}
|
|
376
|
+
/** @internal */
|
|
377
|
+
get http() {
|
|
378
|
+
return this._http;
|
|
379
|
+
}
|
|
380
|
+
toString() {
|
|
381
|
+
return formatConfigForLog(this._config);
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// src/_query.ts
|
|
386
|
+
function updateMaskQuery(updateMask) {
|
|
387
|
+
if (updateMask === void 0) return void 0;
|
|
388
|
+
if (!updateMask.trim()) {
|
|
389
|
+
throw new Error("update_mask must be a non-empty comma-separated list of field names");
|
|
390
|
+
}
|
|
391
|
+
return { updateMask };
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// src/_pagination.ts
|
|
395
|
+
var Page = class {
|
|
396
|
+
constructor(items, nextPageToken, fetchPage) {
|
|
397
|
+
this.items = items;
|
|
398
|
+
this.nextPageToken = normalizePageToken(nextPageToken);
|
|
399
|
+
this.fetchPage = fetchPage;
|
|
400
|
+
}
|
|
401
|
+
hasNextPage() {
|
|
402
|
+
return this.nextPageToken !== void 0;
|
|
403
|
+
}
|
|
404
|
+
async getNextPage() {
|
|
405
|
+
if (this.nextPageToken === void 0) {
|
|
406
|
+
throw new Error(
|
|
407
|
+
"No next page available. Check hasNextPage() before calling getNextPage()."
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
return this.fetchPage(this.nextPageToken);
|
|
411
|
+
}
|
|
412
|
+
async *autoPagingIter() {
|
|
413
|
+
for (const item of this.items) yield item;
|
|
414
|
+
let nextPageToken = this.nextPageToken;
|
|
415
|
+
while (nextPageToken !== void 0) {
|
|
416
|
+
const page = await this.fetchPage(nextPageToken);
|
|
417
|
+
for (const item of page.items) yield item;
|
|
418
|
+
nextPageToken = page.nextPageToken;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
[Symbol.iterator]() {
|
|
422
|
+
return this.items[Symbol.iterator]();
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
function normalizePageToken(token) {
|
|
426
|
+
if (token === void 0 || token === null || !String(token).trim()) return void 0;
|
|
427
|
+
return token;
|
|
428
|
+
}
|
|
429
|
+
function aipListParams(pageSize, pageToken, extra = {}) {
|
|
430
|
+
const params = { pageSize, ...extra };
|
|
431
|
+
const token = normalizePageToken(pageToken);
|
|
432
|
+
if (token !== void 0) params.pageToken = token;
|
|
433
|
+
return params;
|
|
434
|
+
}
|
|
435
|
+
function nextPageTokenFromResponse(data) {
|
|
436
|
+
return normalizePageToken(
|
|
437
|
+
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
function requireItemsList(data, itemsKey) {
|
|
441
|
+
const value = data[itemsKey];
|
|
442
|
+
if (!Array.isArray(value)) {
|
|
443
|
+
throw new ModusError(
|
|
444
|
+
`Unexpected list response shape: ${itemsKey} must be a list, got ${typeof value}. This is likely a backend error.`
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
return value;
|
|
448
|
+
}
|
|
449
|
+
function buildAipPage(data, itemsKey, mapItem, fetchPage) {
|
|
450
|
+
if (typeof data !== "object" || data === null || !(itemsKey in data)) {
|
|
451
|
+
throw new ModusError(
|
|
452
|
+
`Unexpected list response shape: missing ${itemsKey}. Got: ${typeof data}. This is likely a backend error.`
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
const items = requireItemsList(data, itemsKey).map(mapItem);
|
|
456
|
+
return new Page(items, nextPageTokenFromResponse(data), fetchPage);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// src/_generated/operations.ts
|
|
460
|
+
var OPERATIONS = {
|
|
461
|
+
"ConnectionsController_list": {
|
|
462
|
+
method: "GET",
|
|
463
|
+
path: "/api/v1/connections",
|
|
464
|
+
service: "modus-api",
|
|
465
|
+
serverUrl: "https://api.modus.com",
|
|
466
|
+
pathParams: [],
|
|
467
|
+
queryParams: ["pageToken", "pageSize", "type"],
|
|
468
|
+
requestSchema: null,
|
|
469
|
+
responseSchema: "ListConnectionsResponseDto"
|
|
470
|
+
},
|
|
471
|
+
"ContextCreatorsController_createLink": {
|
|
472
|
+
method: "POST",
|
|
473
|
+
path: "/api/v1/context/links",
|
|
474
|
+
service: "modus-api",
|
|
475
|
+
serverUrl: "https://api.modus.com",
|
|
476
|
+
pathParams: [],
|
|
477
|
+
queryParams: [],
|
|
478
|
+
requestSchema: "CreateLinkDto",
|
|
479
|
+
responseSchema: "CreatedContextItemResponseDto"
|
|
480
|
+
},
|
|
481
|
+
"ContextCreatorsController_createNote": {
|
|
482
|
+
method: "POST",
|
|
483
|
+
path: "/api/v1/context/notes",
|
|
484
|
+
service: "modus-api",
|
|
485
|
+
serverUrl: "https://api.modus.com",
|
|
486
|
+
pathParams: [],
|
|
487
|
+
queryParams: [],
|
|
488
|
+
requestSchema: "CreateNoteDto",
|
|
489
|
+
responseSchema: "CreatedContextItemResponseDto"
|
|
490
|
+
},
|
|
491
|
+
"ContextCreatorsController_createSavedQuery": {
|
|
492
|
+
method: "POST",
|
|
493
|
+
path: "/api/v1/context/saved-queries",
|
|
494
|
+
service: "modus-api",
|
|
495
|
+
serverUrl: "https://api.modus.com",
|
|
496
|
+
pathParams: [],
|
|
497
|
+
queryParams: [],
|
|
498
|
+
requestSchema: "CreateSavedQueryDto",
|
|
499
|
+
responseSchema: "CreatedContextItemResponseDto"
|
|
500
|
+
},
|
|
501
|
+
"ContextItemsController_delete": {
|
|
502
|
+
method: "DELETE",
|
|
503
|
+
path: "/api/v1/context/items/{uid}",
|
|
504
|
+
service: "modus-api",
|
|
505
|
+
serverUrl: "https://api.modus.com",
|
|
506
|
+
pathParams: ["uid"],
|
|
507
|
+
queryParams: [],
|
|
508
|
+
requestSchema: null,
|
|
509
|
+
responseSchema: "DeleteContextItemResponseDto"
|
|
510
|
+
},
|
|
511
|
+
"ContextItemsController_get": {
|
|
512
|
+
method: "GET",
|
|
513
|
+
path: "/api/v1/context/items/{uid}",
|
|
514
|
+
service: "modus-api",
|
|
515
|
+
serverUrl: "https://api.modus.com",
|
|
516
|
+
pathParams: ["uid"],
|
|
517
|
+
queryParams: [],
|
|
518
|
+
requestSchema: null,
|
|
519
|
+
responseSchema: "ContextItemDto"
|
|
520
|
+
},
|
|
521
|
+
"ContextItemsController_list": {
|
|
522
|
+
method: "GET",
|
|
523
|
+
path: "/api/v1/context/items",
|
|
524
|
+
service: "modus-api",
|
|
525
|
+
serverUrl: "https://api.modus.com",
|
|
526
|
+
pathParams: [],
|
|
527
|
+
queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
|
|
528
|
+
requestSchema: null,
|
|
529
|
+
responseSchema: "ListContextItemsResponseDto"
|
|
530
|
+
},
|
|
531
|
+
"ContextItemsController_listValues": {
|
|
532
|
+
method: "GET",
|
|
533
|
+
path: "/api/v1/context/items/{uid}/values",
|
|
534
|
+
service: "modus-api",
|
|
535
|
+
serverUrl: "https://api.modus.com",
|
|
536
|
+
pathParams: ["uid"],
|
|
537
|
+
queryParams: ["contextType", "contentKeyPath", "pageSize", "offset", "pageToken", "searchQuery", "dataPathPrefix"],
|
|
538
|
+
requestSchema: null,
|
|
539
|
+
responseSchema: "ListContextItemValuesResponseDto"
|
|
540
|
+
},
|
|
541
|
+
"ContextItemsController_lookup": {
|
|
542
|
+
method: "POST",
|
|
543
|
+
path: "/api/v1/context/items/lookup",
|
|
544
|
+
service: "modus-api",
|
|
545
|
+
serverUrl: "https://api.modus.com",
|
|
546
|
+
pathParams: [],
|
|
547
|
+
queryParams: [],
|
|
548
|
+
requestSchema: "LookupContextItemDto",
|
|
549
|
+
responseSchema: "LookupContextItemResponseDto"
|
|
550
|
+
},
|
|
551
|
+
"ContextItemsController_update": {
|
|
552
|
+
method: "PATCH",
|
|
553
|
+
path: "/api/v1/context/items/{uid}",
|
|
554
|
+
service: "modus-api",
|
|
555
|
+
serverUrl: "https://api.modus.com",
|
|
556
|
+
pathParams: ["uid"],
|
|
557
|
+
queryParams: ["updateMask"],
|
|
558
|
+
requestSchema: "UpdateContextItemDto",
|
|
559
|
+
responseSchema: null
|
|
560
|
+
},
|
|
561
|
+
"CustomContextItemsController_batchCreate": {
|
|
562
|
+
method: "POST",
|
|
563
|
+
path: "/api/v1/context/custom-items/batch",
|
|
564
|
+
service: "modus-api",
|
|
565
|
+
serverUrl: "https://api.modus.com",
|
|
566
|
+
pathParams: [],
|
|
567
|
+
queryParams: [],
|
|
568
|
+
requestSchema: "BatchCreateCustomContextItemsDto",
|
|
569
|
+
responseSchema: "BatchCreateCustomContextItemsResponseDto"
|
|
570
|
+
},
|
|
571
|
+
"CustomContextItemsController_create": {
|
|
572
|
+
method: "POST",
|
|
573
|
+
path: "/api/v1/context/custom-items",
|
|
574
|
+
service: "modus-api",
|
|
575
|
+
serverUrl: "https://api.modus.com",
|
|
576
|
+
pathParams: [],
|
|
577
|
+
queryParams: [],
|
|
578
|
+
requestSchema: "CreateCustomContextItemDto",
|
|
579
|
+
responseSchema: "CreatedCustomContextItemResponseDto"
|
|
580
|
+
},
|
|
581
|
+
"CustomContextItemsController_delete": {
|
|
582
|
+
method: "DELETE",
|
|
583
|
+
path: "/api/v1/context/custom-items/{uid}",
|
|
584
|
+
service: "modus-api",
|
|
585
|
+
serverUrl: "https://api.modus.com",
|
|
586
|
+
pathParams: ["uid"],
|
|
587
|
+
queryParams: [],
|
|
588
|
+
requestSchema: null,
|
|
589
|
+
responseSchema: "DeleteContextItemResponseDto"
|
|
590
|
+
},
|
|
591
|
+
"CustomContextItemsController_get": {
|
|
592
|
+
method: "GET",
|
|
593
|
+
path: "/api/v1/context/custom-items/{uid}",
|
|
594
|
+
service: "modus-api",
|
|
595
|
+
serverUrl: "https://api.modus.com",
|
|
596
|
+
pathParams: ["uid"],
|
|
597
|
+
queryParams: [],
|
|
598
|
+
requestSchema: null,
|
|
599
|
+
responseSchema: "ContextItemDto"
|
|
600
|
+
},
|
|
601
|
+
"CustomContextItemsController_list": {
|
|
602
|
+
method: "GET",
|
|
603
|
+
path: "/api/v1/context/custom-items",
|
|
604
|
+
service: "modus-api",
|
|
605
|
+
serverUrl: "https://api.modus.com",
|
|
606
|
+
pathParams: [],
|
|
607
|
+
queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
|
|
608
|
+
requestSchema: null,
|
|
609
|
+
responseSchema: "ListCustomContextItemsResponseDto"
|
|
610
|
+
},
|
|
611
|
+
"CustomContextItemsController_update": {
|
|
612
|
+
method: "PATCH",
|
|
613
|
+
path: "/api/v1/context/custom-items/{uid}",
|
|
614
|
+
service: "modus-api",
|
|
615
|
+
serverUrl: "https://api.modus.com",
|
|
616
|
+
pathParams: ["uid"],
|
|
617
|
+
queryParams: [],
|
|
618
|
+
requestSchema: "UpdateCustomContextItemDto",
|
|
619
|
+
responseSchema: null
|
|
620
|
+
},
|
|
621
|
+
"EvaluationsController_getConfig": {
|
|
622
|
+
method: "GET",
|
|
623
|
+
path: "/api/v1/scopes/{id}/evaluations/config",
|
|
624
|
+
service: "modus-api",
|
|
625
|
+
serverUrl: "https://api.modus.com",
|
|
626
|
+
pathParams: ["id"],
|
|
627
|
+
queryParams: [],
|
|
628
|
+
requestSchema: null,
|
|
629
|
+
responseSchema: "EvaluationConfigDto"
|
|
630
|
+
},
|
|
631
|
+
"EvaluationsController_getRun": {
|
|
632
|
+
method: "GET",
|
|
633
|
+
path: "/api/v1/scopes/{id}/evaluations/runs/{runId}",
|
|
634
|
+
service: "modus-api",
|
|
635
|
+
serverUrl: "https://api.modus.com",
|
|
636
|
+
pathParams: ["id", "runId"],
|
|
637
|
+
queryParams: [],
|
|
638
|
+
requestSchema: null,
|
|
639
|
+
responseSchema: "EvaluationRunWithResultsDto"
|
|
640
|
+
},
|
|
641
|
+
"EvaluationsController_listRuns": {
|
|
642
|
+
method: "GET",
|
|
643
|
+
path: "/api/v1/scopes/{id}/evaluations/runs",
|
|
644
|
+
service: "modus-api",
|
|
645
|
+
serverUrl: "https://api.modus.com",
|
|
646
|
+
pathParams: ["id"],
|
|
647
|
+
queryParams: ["pageSize", "pageToken"],
|
|
648
|
+
requestSchema: null,
|
|
649
|
+
responseSchema: "ListEvaluationRunsResponseDto"
|
|
650
|
+
},
|
|
651
|
+
"EvaluationsController_triggerRun": {
|
|
652
|
+
method: "POST",
|
|
653
|
+
path: "/api/v1/scopes/{id}/evaluations/runs",
|
|
654
|
+
service: "modus-api",
|
|
655
|
+
serverUrl: "https://api.modus.com",
|
|
656
|
+
pathParams: ["id"],
|
|
657
|
+
queryParams: [],
|
|
658
|
+
requestSchema: null,
|
|
659
|
+
responseSchema: "TriggerEvaluationRunResponseDto"
|
|
660
|
+
},
|
|
661
|
+
"EvaluationsController_updateConfig": {
|
|
662
|
+
method: "PUT",
|
|
663
|
+
path: "/api/v1/scopes/{id}/evaluations/config",
|
|
664
|
+
service: "modus-api",
|
|
665
|
+
serverUrl: "https://api.modus.com",
|
|
666
|
+
pathParams: ["id"],
|
|
667
|
+
queryParams: [],
|
|
668
|
+
requestSchema: "UpdateEvaluationConfigDto",
|
|
669
|
+
responseSchema: "EvaluationConfigDto"
|
|
670
|
+
},
|
|
671
|
+
"MemberGroupsController_list": {
|
|
672
|
+
method: "GET",
|
|
673
|
+
path: "/api/v1/users/member-groups",
|
|
674
|
+
service: "modus-api",
|
|
675
|
+
serverUrl: "https://api.modus.com",
|
|
676
|
+
pathParams: [],
|
|
677
|
+
queryParams: ["pageSize", "pageToken"],
|
|
678
|
+
requestSchema: null,
|
|
679
|
+
responseSchema: "ListMemberGroupsResponseDto"
|
|
680
|
+
},
|
|
681
|
+
"ModusChatController_chat": {
|
|
682
|
+
method: "POST",
|
|
683
|
+
path: "/api/v1/modus/chat",
|
|
684
|
+
service: "modus-api",
|
|
685
|
+
serverUrl: "https://api.modus.com",
|
|
686
|
+
pathParams: [],
|
|
687
|
+
queryParams: [],
|
|
688
|
+
requestSchema: "ModusChatRequestDto",
|
|
689
|
+
responseSchema: "ModusChatResponseDto"
|
|
690
|
+
},
|
|
691
|
+
"ModusChatController_chatContinue": {
|
|
692
|
+
method: "POST",
|
|
693
|
+
path: "/api/v1/modus/conversations/{threadId}/chat",
|
|
694
|
+
service: "modus-api",
|
|
695
|
+
serverUrl: "https://api.modus.com",
|
|
696
|
+
pathParams: ["threadId"],
|
|
697
|
+
queryParams: [],
|
|
698
|
+
requestSchema: "ModusChatRequestDto",
|
|
699
|
+
responseSchema: "ModusChatResponseDto"
|
|
700
|
+
},
|
|
701
|
+
"ModusContextController_compose": {
|
|
702
|
+
method: "POST",
|
|
703
|
+
path: "/api/v1/modus/context",
|
|
704
|
+
service: "modus-api",
|
|
705
|
+
serverUrl: "https://api.modus.com",
|
|
706
|
+
pathParams: [],
|
|
707
|
+
queryParams: [],
|
|
708
|
+
requestSchema: "ModusContextRequestDto",
|
|
709
|
+
responseSchema: "ModusContextResponseDto"
|
|
710
|
+
},
|
|
711
|
+
"ModusConversationsController_get": {
|
|
712
|
+
method: "GET",
|
|
713
|
+
path: "/api/v1/modus/conversations/{threadId}",
|
|
714
|
+
service: "modus-api",
|
|
715
|
+
serverUrl: "https://api.modus.com",
|
|
716
|
+
pathParams: ["threadId"],
|
|
717
|
+
queryParams: [],
|
|
718
|
+
requestSchema: null,
|
|
719
|
+
responseSchema: "ConversationDto"
|
|
720
|
+
},
|
|
721
|
+
"ModusConversationsController_list": {
|
|
722
|
+
method: "GET",
|
|
723
|
+
path: "/api/v1/modus/conversations",
|
|
724
|
+
service: "modus-api",
|
|
725
|
+
serverUrl: "https://api.modus.com",
|
|
726
|
+
pathParams: [],
|
|
727
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools", "kind"],
|
|
728
|
+
requestSchema: null,
|
|
729
|
+
responseSchema: "ListConversationsResponseDto"
|
|
730
|
+
},
|
|
731
|
+
"ModusRunsController_create": {
|
|
732
|
+
method: "POST",
|
|
733
|
+
path: "/agent/v1/modus/runs",
|
|
734
|
+
service: "agent-service",
|
|
735
|
+
serverUrl: "https://agent.modus.com",
|
|
736
|
+
pathParams: [],
|
|
737
|
+
queryParams: [],
|
|
738
|
+
requestSchema: "ModusRunDto",
|
|
739
|
+
responseSchema: null
|
|
740
|
+
},
|
|
741
|
+
"OrgMembersController_list": {
|
|
742
|
+
method: "GET",
|
|
743
|
+
path: "/api/v1/users/org-members",
|
|
744
|
+
service: "modus-api",
|
|
745
|
+
serverUrl: "https://api.modus.com",
|
|
746
|
+
pathParams: [],
|
|
747
|
+
queryParams: ["pageSize", "pageToken"],
|
|
748
|
+
requestSchema: null,
|
|
749
|
+
responseSchema: "ListOrgMembersResponseDto"
|
|
750
|
+
},
|
|
751
|
+
"OrganizationController_deleteOrganization": {
|
|
752
|
+
method: "DELETE",
|
|
753
|
+
path: "/api/v1/users/organization",
|
|
754
|
+
service: "modus-api",
|
|
755
|
+
serverUrl: "https://api.modus.com",
|
|
756
|
+
pathParams: [],
|
|
757
|
+
queryParams: [],
|
|
758
|
+
requestSchema: null,
|
|
759
|
+
responseSchema: null
|
|
760
|
+
},
|
|
761
|
+
"ResumeRunsController_create": {
|
|
762
|
+
method: "POST",
|
|
763
|
+
path: "/agent/v1/runs/{runId}/resume",
|
|
764
|
+
service: "agent-service",
|
|
765
|
+
serverUrl: "https://agent.modus.com",
|
|
766
|
+
pathParams: ["runId"],
|
|
767
|
+
queryParams: [],
|
|
768
|
+
requestSchema: "ResumeRunDto",
|
|
769
|
+
responseSchema: null
|
|
770
|
+
},
|
|
771
|
+
"RunLifecycleController_active": {
|
|
772
|
+
method: "GET",
|
|
773
|
+
path: "/agent/v1/runs/active",
|
|
774
|
+
service: "agent-service",
|
|
775
|
+
serverUrl: "https://agent.modus.com",
|
|
776
|
+
pathParams: [],
|
|
777
|
+
queryParams: ["pageToken", "pageSize"],
|
|
778
|
+
requestSchema: null,
|
|
779
|
+
responseSchema: "ActiveRunsResponseDto"
|
|
780
|
+
},
|
|
781
|
+
"RunLifecycleController_activeBySession": {
|
|
782
|
+
method: "POST",
|
|
783
|
+
path: "/agent/v1/runs/active-by-session",
|
|
784
|
+
service: "agent-service",
|
|
785
|
+
serverUrl: "https://agent.modus.com",
|
|
786
|
+
pathParams: [],
|
|
787
|
+
queryParams: [],
|
|
788
|
+
requestSchema: "ActiveRunsBySessionDto",
|
|
789
|
+
responseSchema: "ActiveRunsBySessionResponseDto"
|
|
790
|
+
},
|
|
791
|
+
"RunLifecycleController_cancel": {
|
|
792
|
+
method: "POST",
|
|
793
|
+
path: "/agent/v1/runs/{runId}/cancel",
|
|
794
|
+
service: "agent-service",
|
|
795
|
+
serverUrl: "https://agent.modus.com",
|
|
796
|
+
pathParams: ["runId"],
|
|
797
|
+
queryParams: [],
|
|
798
|
+
requestSchema: "CancelRunDto",
|
|
799
|
+
responseSchema: null
|
|
800
|
+
},
|
|
801
|
+
"RunLifecycleController_editQueued": {
|
|
802
|
+
method: "POST",
|
|
803
|
+
path: "/agent/v1/runs/{runId}/queue-edit",
|
|
804
|
+
service: "agent-service",
|
|
805
|
+
serverUrl: "https://agent.modus.com",
|
|
806
|
+
pathParams: ["runId"],
|
|
807
|
+
queryParams: [],
|
|
808
|
+
requestSchema: "EditQueuedRunDto",
|
|
809
|
+
responseSchema: null
|
|
810
|
+
},
|
|
811
|
+
"RunLifecycleController_events": {
|
|
812
|
+
method: "GET",
|
|
813
|
+
path: "/agent/v1/runs/{runId}/events",
|
|
814
|
+
service: "agent-service",
|
|
815
|
+
serverUrl: "https://agent.modus.com",
|
|
816
|
+
pathParams: ["runId"],
|
|
817
|
+
queryParams: [],
|
|
818
|
+
requestSchema: null,
|
|
819
|
+
responseSchema: null
|
|
820
|
+
},
|
|
821
|
+
"RunLifecycleController_interrupt": {
|
|
822
|
+
method: "POST",
|
|
823
|
+
path: "/agent/v1/runs/{runId}/interrupt",
|
|
824
|
+
service: "agent-service",
|
|
825
|
+
serverUrl: "https://agent.modus.com",
|
|
826
|
+
pathParams: ["runId"],
|
|
827
|
+
queryParams: [],
|
|
828
|
+
requestSchema: "InterruptRunDto",
|
|
829
|
+
responseSchema: null
|
|
830
|
+
},
|
|
831
|
+
"RunLifecycleController_stream": {
|
|
832
|
+
method: "GET",
|
|
833
|
+
path: "/agent/v1/runs/{runId}/stream",
|
|
834
|
+
service: "agent-service",
|
|
835
|
+
serverUrl: "https://agent.modus.com",
|
|
836
|
+
pathParams: ["runId"],
|
|
837
|
+
queryParams: [],
|
|
838
|
+
requestSchema: null,
|
|
839
|
+
responseSchema: null
|
|
840
|
+
},
|
|
841
|
+
"ScopeChatController_chat": {
|
|
842
|
+
method: "POST",
|
|
843
|
+
path: "/api/v1/scopes/{id}/chat",
|
|
844
|
+
service: "modus-api",
|
|
845
|
+
serverUrl: "https://api.modus.com",
|
|
846
|
+
pathParams: ["id"],
|
|
847
|
+
queryParams: [],
|
|
848
|
+
requestSchema: "SkillChatRequestDto",
|
|
849
|
+
responseSchema: "SkillChatResponseDto"
|
|
850
|
+
},
|
|
851
|
+
"ScopeChatController_chatContinue": {
|
|
852
|
+
method: "POST",
|
|
853
|
+
path: "/api/v1/scopes/{id}/conversations/{threadId}/chat",
|
|
854
|
+
service: "modus-api",
|
|
855
|
+
serverUrl: "https://api.modus.com",
|
|
856
|
+
pathParams: ["id", "threadId"],
|
|
857
|
+
queryParams: [],
|
|
858
|
+
requestSchema: "SkillChatRequestDto",
|
|
859
|
+
responseSchema: "SkillChatResponseDto"
|
|
860
|
+
},
|
|
861
|
+
"ScopeContextController_compose": {
|
|
862
|
+
method: "POST",
|
|
863
|
+
path: "/api/v1/scopes/{id}/context",
|
|
864
|
+
service: "modus-api",
|
|
865
|
+
serverUrl: "https://api.modus.com",
|
|
866
|
+
pathParams: ["id"],
|
|
867
|
+
queryParams: [],
|
|
868
|
+
requestSchema: "ComposeSkillContextRequestDto",
|
|
869
|
+
responseSchema: "ComposeSkillContextResponseDto"
|
|
870
|
+
},
|
|
871
|
+
"ScopeConversationsController_get": {
|
|
872
|
+
method: "GET",
|
|
873
|
+
path: "/api/v1/scopes/{id}/conversations/{threadId}",
|
|
874
|
+
service: "modus-api",
|
|
875
|
+
serverUrl: "https://api.modus.com",
|
|
876
|
+
pathParams: ["id", "threadId"],
|
|
877
|
+
queryParams: ["messageLimit", "beforeMessageIndex"],
|
|
878
|
+
requestSchema: null,
|
|
879
|
+
responseSchema: "ConversationDto"
|
|
880
|
+
},
|
|
881
|
+
"ScopeConversationsController_list": {
|
|
882
|
+
method: "GET",
|
|
883
|
+
path: "/api/v1/scopes/{id}/conversations",
|
|
884
|
+
service: "modus-api",
|
|
885
|
+
serverUrl: "https://api.modus.com",
|
|
886
|
+
pathParams: ["id"],
|
|
887
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools"],
|
|
888
|
+
requestSchema: null,
|
|
889
|
+
responseSchema: "ListConversationsResponseDto"
|
|
890
|
+
},
|
|
891
|
+
"ScopeMemoriesController_delete": {
|
|
892
|
+
method: "DELETE",
|
|
893
|
+
path: "/api/v1/scopes/{id}/memories/{memoryId}",
|
|
894
|
+
service: "modus-api",
|
|
895
|
+
serverUrl: "https://api.modus.com",
|
|
896
|
+
pathParams: ["id", "memoryId"],
|
|
897
|
+
queryParams: [],
|
|
898
|
+
requestSchema: null,
|
|
899
|
+
responseSchema: null
|
|
900
|
+
},
|
|
901
|
+
"ScopeMemoriesController_list": {
|
|
902
|
+
method: "GET",
|
|
903
|
+
path: "/api/v1/scopes/{id}/memories",
|
|
904
|
+
service: "modus-api",
|
|
905
|
+
serverUrl: "https://api.modus.com",
|
|
906
|
+
pathParams: ["id"],
|
|
907
|
+
queryParams: ["pageToken", "pageSize", "userId", "limit"],
|
|
908
|
+
requestSchema: null,
|
|
909
|
+
responseSchema: "ListMemoriesResponseDto"
|
|
910
|
+
},
|
|
911
|
+
"ScopeMemoriesController_search": {
|
|
912
|
+
method: "POST",
|
|
913
|
+
path: "/api/v1/scopes/{id}/memories/search",
|
|
914
|
+
service: "modus-api",
|
|
915
|
+
serverUrl: "https://api.modus.com",
|
|
916
|
+
pathParams: ["id"],
|
|
917
|
+
queryParams: [],
|
|
918
|
+
requestSchema: "SearchMemoriesRequestDto",
|
|
919
|
+
responseSchema: "ListMemoriesResponseDto"
|
|
920
|
+
},
|
|
921
|
+
"ScopeMemoriesController_update": {
|
|
922
|
+
method: "PATCH",
|
|
923
|
+
path: "/api/v1/scopes/{id}/memories/{memoryId}",
|
|
924
|
+
service: "modus-api",
|
|
925
|
+
serverUrl: "https://api.modus.com",
|
|
926
|
+
pathParams: ["id", "memoryId"],
|
|
927
|
+
queryParams: ["updateMask"],
|
|
928
|
+
requestSchema: "UpdateMemoryRequestDto",
|
|
929
|
+
responseSchema: null
|
|
930
|
+
},
|
|
931
|
+
"ScopeRunsController_create": {
|
|
932
|
+
method: "POST",
|
|
933
|
+
path: "/agent/v1/scopes/{id}/runs",
|
|
934
|
+
service: "agent-service",
|
|
935
|
+
serverUrl: "https://agent.modus.com",
|
|
936
|
+
pathParams: ["id"],
|
|
937
|
+
queryParams: [],
|
|
938
|
+
requestSchema: "SkillRunDto",
|
|
939
|
+
responseSchema: null
|
|
940
|
+
},
|
|
941
|
+
"ScopeSupervisionController_get": {
|
|
942
|
+
method: "GET",
|
|
943
|
+
path: "/api/v1/scopes/{id}/supervision",
|
|
944
|
+
service: "modus-api",
|
|
945
|
+
serverUrl: "https://api.modus.com",
|
|
946
|
+
pathParams: ["id"],
|
|
947
|
+
queryParams: ["view"],
|
|
948
|
+
requestSchema: null,
|
|
949
|
+
responseSchema: "SupervisionDto"
|
|
950
|
+
},
|
|
951
|
+
"ScopeSupervisionController_set": {
|
|
952
|
+
method: "PUT",
|
|
953
|
+
path: "/api/v1/scopes/{id}/supervision",
|
|
954
|
+
service: "modus-api",
|
|
955
|
+
serverUrl: "https://api.modus.com",
|
|
956
|
+
pathParams: ["id"],
|
|
957
|
+
queryParams: [],
|
|
958
|
+
requestSchema: "SetSupervisionRequestDto",
|
|
959
|
+
responseSchema: "SupervisionDto"
|
|
960
|
+
},
|
|
961
|
+
"ScopeSupervisionController_setActive": {
|
|
962
|
+
method: "PUT",
|
|
963
|
+
path: "/api/v1/scopes/{id}/supervision/active",
|
|
964
|
+
service: "modus-api",
|
|
965
|
+
serverUrl: "https://api.modus.com",
|
|
966
|
+
pathParams: ["id"],
|
|
967
|
+
queryParams: [],
|
|
968
|
+
requestSchema: "SetSupervisionRequestDto",
|
|
969
|
+
responseSchema: "SupervisionDto"
|
|
970
|
+
},
|
|
971
|
+
"ScopesController_acceptOwnershipTransfer": {
|
|
972
|
+
method: "POST",
|
|
973
|
+
path: "/api/v1/scopes/{id}/transfer-ownership/accept",
|
|
974
|
+
service: "modus-api",
|
|
975
|
+
serverUrl: "https://api.modus.com",
|
|
976
|
+
pathParams: ["id"],
|
|
977
|
+
queryParams: [],
|
|
978
|
+
requestSchema: null,
|
|
979
|
+
responseSchema: "SkillDto"
|
|
980
|
+
},
|
|
981
|
+
"ScopesController_cancelOwnershipTransfer": {
|
|
982
|
+
method: "DELETE",
|
|
983
|
+
path: "/api/v1/scopes/{id}/transfer-ownership",
|
|
984
|
+
service: "modus-api",
|
|
985
|
+
serverUrl: "https://api.modus.com",
|
|
986
|
+
pathParams: ["id"],
|
|
987
|
+
queryParams: [],
|
|
988
|
+
requestSchema: null,
|
|
989
|
+
responseSchema: "SkillDto"
|
|
990
|
+
},
|
|
991
|
+
"ScopesController_create": {
|
|
992
|
+
method: "POST",
|
|
993
|
+
path: "/api/v1/scopes",
|
|
994
|
+
service: "modus-api",
|
|
995
|
+
serverUrl: "https://api.modus.com",
|
|
996
|
+
pathParams: [],
|
|
997
|
+
queryParams: [],
|
|
998
|
+
requestSchema: "CreateSkillDto",
|
|
999
|
+
responseSchema: "SkillDto"
|
|
1000
|
+
},
|
|
1001
|
+
"ScopesController_delete": {
|
|
1002
|
+
method: "DELETE",
|
|
1003
|
+
path: "/api/v1/scopes/{id}",
|
|
1004
|
+
service: "modus-api",
|
|
1005
|
+
serverUrl: "https://api.modus.com",
|
|
1006
|
+
pathParams: ["id"],
|
|
1007
|
+
queryParams: [],
|
|
1008
|
+
requestSchema: null,
|
|
1009
|
+
responseSchema: null
|
|
1010
|
+
},
|
|
1011
|
+
"ScopesController_deploy": {
|
|
1012
|
+
method: "POST",
|
|
1013
|
+
path: "/api/v1/scopes/{id}/deploy",
|
|
1014
|
+
service: "modus-api",
|
|
1015
|
+
serverUrl: "https://api.modus.com",
|
|
1016
|
+
pathParams: ["id"],
|
|
1017
|
+
queryParams: [],
|
|
1018
|
+
requestSchema: "DeploySkillDto",
|
|
1019
|
+
responseSchema: "DeployResponseDto"
|
|
1020
|
+
},
|
|
1021
|
+
"ScopesController_get": {
|
|
1022
|
+
method: "GET",
|
|
1023
|
+
path: "/api/v1/scopes/{id}",
|
|
1024
|
+
service: "modus-api",
|
|
1025
|
+
serverUrl: "https://api.modus.com",
|
|
1026
|
+
pathParams: ["id"],
|
|
1027
|
+
queryParams: ["view"],
|
|
1028
|
+
requestSchema: null,
|
|
1029
|
+
responseSchema: "SkillDto"
|
|
1030
|
+
},
|
|
1031
|
+
"ScopesController_getVariation": {
|
|
1032
|
+
method: "GET",
|
|
1033
|
+
path: "/api/v1/scopes/{id}/variations/{variationUid}",
|
|
1034
|
+
service: "modus-api",
|
|
1035
|
+
serverUrl: "https://api.modus.com",
|
|
1036
|
+
pathParams: ["id", "variationUid"],
|
|
1037
|
+
queryParams: [],
|
|
1038
|
+
requestSchema: null,
|
|
1039
|
+
responseSchema: "SkillDto"
|
|
1040
|
+
},
|
|
1041
|
+
"ScopesController_list": {
|
|
1042
|
+
method: "GET",
|
|
1043
|
+
path: "/api/v1/scopes",
|
|
1044
|
+
service: "modus-api",
|
|
1045
|
+
serverUrl: "https://api.modus.com",
|
|
1046
|
+
pathParams: [],
|
|
1047
|
+
queryParams: ["pageToken", "pageSize", "view", "search", "managerId", "includeVariation"],
|
|
1048
|
+
requestSchema: null,
|
|
1049
|
+
responseSchema: "ListSkillsResponseDto"
|
|
1050
|
+
},
|
|
1051
|
+
"ScopesController_patchMcpConfig": {
|
|
1052
|
+
method: "PATCH",
|
|
1053
|
+
path: "/api/v1/scopes/{id}/mcp-config",
|
|
1054
|
+
service: "modus-api",
|
|
1055
|
+
serverUrl: "https://api.modus.com",
|
|
1056
|
+
pathParams: ["id"],
|
|
1057
|
+
queryParams: [],
|
|
1058
|
+
requestSchema: "PatchSkillMcpConfigDto",
|
|
1059
|
+
responseSchema: "PatchSkillMcpConfigResponseDto"
|
|
1060
|
+
},
|
|
1061
|
+
"ScopesController_requestOwnershipTransfer": {
|
|
1062
|
+
method: "POST",
|
|
1063
|
+
path: "/api/v1/scopes/{id}/transfer-ownership",
|
|
1064
|
+
service: "modus-api",
|
|
1065
|
+
serverUrl: "https://api.modus.com",
|
|
1066
|
+
pathParams: ["id"],
|
|
1067
|
+
queryParams: [],
|
|
1068
|
+
requestSchema: "TransferOwnershipDto",
|
|
1069
|
+
responseSchema: "SkillDto"
|
|
1070
|
+
},
|
|
1071
|
+
"ScopesController_restore": {
|
|
1072
|
+
method: "POST",
|
|
1073
|
+
path: "/api/v1/scopes/{id}/restore",
|
|
1074
|
+
service: "modus-api",
|
|
1075
|
+
serverUrl: "https://api.modus.com",
|
|
1076
|
+
pathParams: ["id"],
|
|
1077
|
+
queryParams: [],
|
|
1078
|
+
requestSchema: null,
|
|
1079
|
+
responseSchema: "SkillDto"
|
|
1080
|
+
},
|
|
1081
|
+
"ScopesController_update": {
|
|
1082
|
+
method: "PATCH",
|
|
1083
|
+
path: "/api/v1/scopes/{id}",
|
|
1084
|
+
service: "modus-api",
|
|
1085
|
+
serverUrl: "https://api.modus.com",
|
|
1086
|
+
pathParams: ["id"],
|
|
1087
|
+
queryParams: ["updateMask"],
|
|
1088
|
+
requestSchema: "UpdateSkillDto",
|
|
1089
|
+
responseSchema: "SkillDto"
|
|
1090
|
+
},
|
|
1091
|
+
"SuggestionsController_listApproved": {
|
|
1092
|
+
method: "GET",
|
|
1093
|
+
path: "/api/v1/suggestions/questions",
|
|
1094
|
+
service: "modus-api",
|
|
1095
|
+
serverUrl: "https://api.modus.com",
|
|
1096
|
+
pathParams: [],
|
|
1097
|
+
queryParams: ["pageToken", "pageSize", "skill_id", "skill_ids"],
|
|
1098
|
+
requestSchema: null,
|
|
1099
|
+
responseSchema: "ListSuggestionQuestionsResponseDto"
|
|
1100
|
+
},
|
|
1101
|
+
"SuggestionsController_recordEvent": {
|
|
1102
|
+
method: "POST",
|
|
1103
|
+
path: "/api/v1/suggestions/questions/{id}/events",
|
|
1104
|
+
service: "modus-api",
|
|
1105
|
+
serverUrl: "https://api.modus.com",
|
|
1106
|
+
pathParams: ["id"],
|
|
1107
|
+
queryParams: [],
|
|
1108
|
+
requestSchema: "RecordSuggestionEventDto",
|
|
1109
|
+
responseSchema: null
|
|
1110
|
+
},
|
|
1111
|
+
"UsageController_list": {
|
|
1112
|
+
method: "GET",
|
|
1113
|
+
path: "/api/v1/usage",
|
|
1114
|
+
service: "modus-api",
|
|
1115
|
+
serverUrl: "https://api.modus.com",
|
|
1116
|
+
pathParams: [],
|
|
1117
|
+
queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface"],
|
|
1118
|
+
requestSchema: null,
|
|
1119
|
+
responseSchema: "ListUsageResponseDto"
|
|
1120
|
+
},
|
|
1121
|
+
"WorkflowActionsController_cancel": {
|
|
1122
|
+
method: "POST",
|
|
1123
|
+
path: "/agent/v1/workflow-actions/{runId}/cancel",
|
|
1124
|
+
service: "agent-service",
|
|
1125
|
+
serverUrl: "https://agent.modus.com",
|
|
1126
|
+
pathParams: ["runId"],
|
|
1127
|
+
queryParams: [],
|
|
1128
|
+
requestSchema: "CancelRunDto",
|
|
1129
|
+
responseSchema: null
|
|
1130
|
+
},
|
|
1131
|
+
"WorkflowActionsController_execute": {
|
|
1132
|
+
method: "POST",
|
|
1133
|
+
path: "/agent/v1/workflow-actions",
|
|
1134
|
+
service: "agent-service",
|
|
1135
|
+
serverUrl: "https://agent.modus.com",
|
|
1136
|
+
pathParams: [],
|
|
1137
|
+
queryParams: [],
|
|
1138
|
+
requestSchema: "WorkflowActionDto",
|
|
1139
|
+
responseSchema: null
|
|
1140
|
+
},
|
|
1141
|
+
"WorkflowInterfacesController_add": {
|
|
1142
|
+
method: "POST",
|
|
1143
|
+
path: "/api/v1/workflows/{id}/interfaces",
|
|
1144
|
+
service: "modus-api",
|
|
1145
|
+
serverUrl: "https://api.modus.com",
|
|
1146
|
+
pathParams: ["id"],
|
|
1147
|
+
queryParams: [],
|
|
1148
|
+
requestSchema: "AddAgentInterfaceDto",
|
|
1149
|
+
responseSchema: "AgentInterfaceDto"
|
|
1150
|
+
},
|
|
1151
|
+
"WorkflowInterfacesController_delete": {
|
|
1152
|
+
method: "DELETE",
|
|
1153
|
+
path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
|
|
1154
|
+
service: "modus-api",
|
|
1155
|
+
serverUrl: "https://api.modus.com",
|
|
1156
|
+
pathParams: ["id", "interfaceId"],
|
|
1157
|
+
queryParams: [],
|
|
1158
|
+
requestSchema: null,
|
|
1159
|
+
responseSchema: null
|
|
1160
|
+
},
|
|
1161
|
+
"WorkflowInterfacesController_deleteAll": {
|
|
1162
|
+
method: "DELETE",
|
|
1163
|
+
path: "/api/v1/workflows/{id}/interfaces",
|
|
1164
|
+
service: "modus-api",
|
|
1165
|
+
serverUrl: "https://api.modus.com",
|
|
1166
|
+
pathParams: ["id"],
|
|
1167
|
+
queryParams: [],
|
|
1168
|
+
requestSchema: null,
|
|
1169
|
+
responseSchema: null
|
|
1170
|
+
},
|
|
1171
|
+
"WorkflowInterfacesController_list": {
|
|
1172
|
+
method: "GET",
|
|
1173
|
+
path: "/api/v1/workflows/{id}/interfaces",
|
|
1174
|
+
service: "modus-api",
|
|
1175
|
+
serverUrl: "https://api.modus.com",
|
|
1176
|
+
pathParams: ["id"],
|
|
1177
|
+
queryParams: ["pageSize", "pageToken"],
|
|
1178
|
+
requestSchema: null,
|
|
1179
|
+
responseSchema: "ListAgentInterfacesResponseDto"
|
|
1180
|
+
},
|
|
1181
|
+
"WorkflowInterfacesController_update": {
|
|
1182
|
+
method: "PATCH",
|
|
1183
|
+
path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
|
|
1184
|
+
service: "modus-api",
|
|
1185
|
+
serverUrl: "https://api.modus.com",
|
|
1186
|
+
pathParams: ["id", "interfaceId"],
|
|
1187
|
+
queryParams: ["updateMask"],
|
|
1188
|
+
requestSchema: "UpdateAgentInterfaceDto",
|
|
1189
|
+
responseSchema: "AgentInterfaceDto"
|
|
1190
|
+
},
|
|
1191
|
+
"WorkflowRunsController_create": {
|
|
1192
|
+
method: "POST",
|
|
1193
|
+
path: "/agent/v1/workflows/{id}/runs",
|
|
1194
|
+
service: "agent-service",
|
|
1195
|
+
serverUrl: "https://agent.modus.com",
|
|
1196
|
+
pathParams: ["id"],
|
|
1197
|
+
queryParams: [],
|
|
1198
|
+
requestSchema: "AgentRunDto",
|
|
1199
|
+
responseSchema: null
|
|
1200
|
+
},
|
|
1201
|
+
"WorkflowRunsController_get": {
|
|
1202
|
+
method: "GET",
|
|
1203
|
+
path: "/api/v1/workflows/{id}/runs/{runId}",
|
|
1204
|
+
service: "modus-api",
|
|
1205
|
+
serverUrl: "https://api.modus.com",
|
|
1206
|
+
pathParams: ["id", "runId"],
|
|
1207
|
+
queryParams: ["temporalRunId"],
|
|
1208
|
+
requestSchema: null,
|
|
1209
|
+
responseSchema: "GetAutomationRunResponseDto"
|
|
1210
|
+
},
|
|
1211
|
+
"WorkflowRunsController_list": {
|
|
1212
|
+
method: "GET",
|
|
1213
|
+
path: "/api/v1/workflows/{id}/runs",
|
|
1214
|
+
service: "modus-api",
|
|
1215
|
+
serverUrl: "https://api.modus.com",
|
|
1216
|
+
pathParams: ["id"],
|
|
1217
|
+
queryParams: ["status", "timeframe", "approvalScope", "search", "pageSize", "pageToken"],
|
|
1218
|
+
requestSchema: null,
|
|
1219
|
+
responseSchema: "ListAutomationRunsResponseDto"
|
|
1220
|
+
},
|
|
1221
|
+
"WorkflowsController_acceptOwnershipTransfer": {
|
|
1222
|
+
method: "POST",
|
|
1223
|
+
path: "/api/v1/workflows/{id}/transfer-ownership/accept",
|
|
1224
|
+
service: "modus-api",
|
|
1225
|
+
serverUrl: "https://api.modus.com",
|
|
1226
|
+
pathParams: ["id"],
|
|
1227
|
+
queryParams: [],
|
|
1228
|
+
requestSchema: null,
|
|
1229
|
+
responseSchema: "AgentDto"
|
|
1230
|
+
},
|
|
1231
|
+
"WorkflowsController_cancelOwnershipTransfer": {
|
|
1232
|
+
method: "DELETE",
|
|
1233
|
+
path: "/api/v1/workflows/{id}/transfer-ownership",
|
|
1234
|
+
service: "modus-api",
|
|
1235
|
+
serverUrl: "https://api.modus.com",
|
|
1236
|
+
pathParams: ["id"],
|
|
1237
|
+
queryParams: [],
|
|
1238
|
+
requestSchema: null,
|
|
1239
|
+
responseSchema: "AgentDto"
|
|
1240
|
+
},
|
|
1241
|
+
"WorkflowsController_create": {
|
|
1242
|
+
method: "POST",
|
|
1243
|
+
path: "/api/v1/workflows",
|
|
1244
|
+
service: "modus-api",
|
|
1245
|
+
serverUrl: "https://api.modus.com",
|
|
1246
|
+
pathParams: [],
|
|
1247
|
+
queryParams: [],
|
|
1248
|
+
requestSchema: "CreateAgentDto",
|
|
1249
|
+
responseSchema: "AgentDto"
|
|
1250
|
+
},
|
|
1251
|
+
"WorkflowsController_delete": {
|
|
1252
|
+
method: "DELETE",
|
|
1253
|
+
path: "/api/v1/workflows/{id}",
|
|
1254
|
+
service: "modus-api",
|
|
1255
|
+
serverUrl: "https://api.modus.com",
|
|
1256
|
+
pathParams: ["id"],
|
|
1257
|
+
queryParams: [],
|
|
1258
|
+
requestSchema: null,
|
|
1259
|
+
responseSchema: null
|
|
1260
|
+
},
|
|
1261
|
+
"WorkflowsController_deploy": {
|
|
1262
|
+
method: "POST",
|
|
1263
|
+
path: "/api/v1/workflows/{id}/deploy",
|
|
1264
|
+
service: "modus-api",
|
|
1265
|
+
serverUrl: "https://api.modus.com",
|
|
1266
|
+
pathParams: ["id"],
|
|
1267
|
+
queryParams: [],
|
|
1268
|
+
requestSchema: "DeployAgentDto",
|
|
1269
|
+
responseSchema: "AgentDeployResponseDto"
|
|
1270
|
+
},
|
|
1271
|
+
"WorkflowsController_get": {
|
|
1272
|
+
method: "GET",
|
|
1273
|
+
path: "/api/v1/workflows/{id}",
|
|
1274
|
+
service: "modus-api",
|
|
1275
|
+
serverUrl: "https://api.modus.com",
|
|
1276
|
+
pathParams: ["id"],
|
|
1277
|
+
queryParams: ["view"],
|
|
1278
|
+
requestSchema: null,
|
|
1279
|
+
responseSchema: "AgentDto"
|
|
1280
|
+
},
|
|
1281
|
+
"WorkflowsController_list": {
|
|
1282
|
+
method: "GET",
|
|
1283
|
+
path: "/api/v1/workflows",
|
|
1284
|
+
service: "modus-api",
|
|
1285
|
+
serverUrl: "https://api.modus.com",
|
|
1286
|
+
pathParams: [],
|
|
1287
|
+
queryParams: ["pageToken", "pageSize", "view", "type", "search", "includeVariation"],
|
|
1288
|
+
requestSchema: null,
|
|
1289
|
+
responseSchema: "ListAgentsResponseDto"
|
|
1290
|
+
},
|
|
1291
|
+
"WorkflowsController_requestOwnershipTransfer": {
|
|
1292
|
+
method: "POST",
|
|
1293
|
+
path: "/api/v1/workflows/{id}/transfer-ownership",
|
|
1294
|
+
service: "modus-api",
|
|
1295
|
+
serverUrl: "https://api.modus.com",
|
|
1296
|
+
pathParams: ["id"],
|
|
1297
|
+
queryParams: [],
|
|
1298
|
+
requestSchema: "TransferOwnershipDto",
|
|
1299
|
+
responseSchema: "AgentDto"
|
|
1300
|
+
},
|
|
1301
|
+
"WorkflowsController_restore": {
|
|
1302
|
+
method: "POST",
|
|
1303
|
+
path: "/api/v1/workflows/{id}/restore",
|
|
1304
|
+
service: "modus-api",
|
|
1305
|
+
serverUrl: "https://api.modus.com",
|
|
1306
|
+
pathParams: ["id"],
|
|
1307
|
+
queryParams: [],
|
|
1308
|
+
requestSchema: null,
|
|
1309
|
+
responseSchema: "AgentDto"
|
|
1310
|
+
},
|
|
1311
|
+
"WorkflowsController_toggle": {
|
|
1312
|
+
method: "POST",
|
|
1313
|
+
path: "/api/v1/workflows/{id}/toggle",
|
|
1314
|
+
service: "modus-api",
|
|
1315
|
+
serverUrl: "https://api.modus.com",
|
|
1316
|
+
pathParams: ["id"],
|
|
1317
|
+
queryParams: [],
|
|
1318
|
+
requestSchema: "ToggleAgentDto",
|
|
1319
|
+
responseSchema: "AgentDto"
|
|
1320
|
+
},
|
|
1321
|
+
"WorkflowsController_update": {
|
|
1322
|
+
method: "PATCH",
|
|
1323
|
+
path: "/api/v1/workflows/{id}",
|
|
1324
|
+
service: "modus-api",
|
|
1325
|
+
serverUrl: "https://api.modus.com",
|
|
1326
|
+
pathParams: ["id"],
|
|
1327
|
+
queryParams: ["updateMask"],
|
|
1328
|
+
requestSchema: "UpdateAgentDto",
|
|
1329
|
+
responseSchema: "AgentDto"
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
|
|
1333
|
+
// src/_openapi-invoke.ts
|
|
1334
|
+
function getOperation(operationId) {
|
|
1335
|
+
if (!(operationId in OPERATIONS)) {
|
|
1336
|
+
throw new Error(
|
|
1337
|
+
`Unknown API operation ${JSON.stringify(operationId)}. Upgrade @getmodus/sdk or report a version mismatch.`
|
|
1338
|
+
);
|
|
1339
|
+
}
|
|
1340
|
+
return OPERATIONS[operationId];
|
|
1341
|
+
}
|
|
1342
|
+
function formatPath(template, pathParams) {
|
|
1343
|
+
return template.split("/").map((segment) => {
|
|
1344
|
+
if (!segment.startsWith("{") || !segment.endsWith("}")) return segment;
|
|
1345
|
+
const key = segment.slice(1, -1);
|
|
1346
|
+
if (!(key in pathParams)) {
|
|
1347
|
+
throw new Error(`Missing path parameter ${JSON.stringify(key)} for ${JSON.stringify(template)}`);
|
|
1348
|
+
}
|
|
1349
|
+
return encodeURIComponent(String(pathParams[key]));
|
|
1350
|
+
}).join("/");
|
|
1351
|
+
}
|
|
1352
|
+
function operationBaseUrl(http, operation) {
|
|
1353
|
+
return resolveServiceBaseUrl(http.config, operation.service, operation.serverUrl);
|
|
1354
|
+
}
|
|
1355
|
+
async function invokeOperation(http, operationId, options = {}) {
|
|
1356
|
+
const op = getOperation(operationId);
|
|
1357
|
+
const path = formatPath(op.path, options.pathParams ?? {});
|
|
1358
|
+
const params = options.query;
|
|
1359
|
+
const requestOptions = {
|
|
1360
|
+
baseUrl: operationBaseUrl(http, op),
|
|
1361
|
+
headers: options.headers
|
|
1362
|
+
};
|
|
1363
|
+
switch (op.method) {
|
|
1364
|
+
case "GET":
|
|
1365
|
+
return http.get(path, params, requestOptions);
|
|
1366
|
+
case "POST":
|
|
1367
|
+
return http.post(path, options.jsonBody, requestOptions);
|
|
1368
|
+
case "PATCH":
|
|
1369
|
+
return http.patch(path, options.jsonBody, params, requestOptions);
|
|
1370
|
+
case "DELETE":
|
|
1371
|
+
return http.delete(path, requestOptions);
|
|
1372
|
+
default:
|
|
1373
|
+
throw new Error(`Unsupported HTTP method ${JSON.stringify(op.method)}`);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
// src/_retry.ts
|
|
1378
|
+
var DEPLOY_NOT_FOUND_BACKOFF_MS = 500;
|
|
1379
|
+
var MAX_DEPLOY_NOT_FOUND_RETRIES = 1;
|
|
1380
|
+
var RETRYABLE = [RateLimitError, InternalServerError, APIConnectionError];
|
|
1381
|
+
function isRetryable(error) {
|
|
1382
|
+
return RETRYABLE.some((Cls) => error instanceof Cls);
|
|
1383
|
+
}
|
|
1384
|
+
function backoffSeconds(attempt, error) {
|
|
1385
|
+
if (error instanceof RateLimitError && error.retryAfter !== void 0) {
|
|
1386
|
+
return Math.max(0, error.retryAfter);
|
|
1387
|
+
}
|
|
1388
|
+
if (attempt === 0) return 0;
|
|
1389
|
+
return Math.max(0.5, 2 ** (attempt - 1) + (Math.random() * 0.6 - 0.3));
|
|
1390
|
+
}
|
|
1391
|
+
function sleep(ms) {
|
|
1392
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1393
|
+
}
|
|
1394
|
+
async function withRetry(fn, maxRetries, options = {}) {
|
|
1395
|
+
let deployNotFoundRetries = 0;
|
|
1396
|
+
let attempt = 0;
|
|
1397
|
+
while (true) {
|
|
1398
|
+
try {
|
|
1399
|
+
return await fn();
|
|
1400
|
+
} catch (error) {
|
|
1401
|
+
if (options.retryNotFoundOnDeploy && error instanceof NotFoundError && deployNotFoundRetries < MAX_DEPLOY_NOT_FOUND_RETRIES) {
|
|
1402
|
+
deployNotFoundRetries++;
|
|
1403
|
+
await sleep(DEPLOY_NOT_FOUND_BACKOFF_MS);
|
|
1404
|
+
continue;
|
|
1405
|
+
}
|
|
1406
|
+
if (!isRetryable(error) || attempt >= maxRetries) throw error;
|
|
1407
|
+
await sleep(backoffSeconds(attempt, error) * 1e3);
|
|
1408
|
+
attempt++;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
// src/_generated/write-body-keys.ts
|
|
1414
|
+
var WRITE_BODY_ALLOWED_KEYS = {
|
|
1415
|
+
ContextCreatorsController_createLink: ["url", "title", "isCrawl", "pageLimit"],
|
|
1416
|
+
ContextCreatorsController_createNote: ["title", "content"],
|
|
1417
|
+
ContextCreatorsController_createSavedQuery: ["name", "connectionId", "query", "description", "path"],
|
|
1418
|
+
ContextItemsController_lookup: ["contextType", "dataPath", "contentProjection"],
|
|
1419
|
+
ContextItemsController_update: ["contextType", "content", "description", "userFeedback", "topics"],
|
|
1420
|
+
CustomContextItemsController_batchCreate: ["items"],
|
|
1421
|
+
CustomContextItemsController_create: ["kind", "sourceId", "sourceName", "collectionId", "collectionName", "externalId", "fieldName", "name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics", "idempotencyKey", "access"],
|
|
1422
|
+
CustomContextItemsController_update: ["name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics"],
|
|
1423
|
+
EvaluationsController_updateConfig: ["enabled", "cadence", "judgeModel", "judgeGuidance", "notifications"],
|
|
1424
|
+
ModusChatController_chat: ["message", "model"],
|
|
1425
|
+
ModusContextController_compose: ["message", "limit"],
|
|
1426
|
+
ModusRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
1427
|
+
ResumeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "decision"],
|
|
1428
|
+
RunLifecycleController_activeBySession: ["sessionIds"],
|
|
1429
|
+
RunLifecycleController_cancel: [],
|
|
1430
|
+
RunLifecycleController_editQueued: [],
|
|
1431
|
+
RunLifecycleController_interrupt: [],
|
|
1432
|
+
ScopeChatController_chat: ["message", "model"],
|
|
1433
|
+
ScopeContextController_compose: ["message", "limit"],
|
|
1434
|
+
ScopeMemoriesController_search: ["query", "userId", "limit"],
|
|
1435
|
+
ScopeMemoriesController_update: ["memory", "metadata"],
|
|
1436
|
+
ScopeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
1437
|
+
ScopesController_acceptOwnershipTransfer: [],
|
|
1438
|
+
ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig"],
|
|
1439
|
+
ScopesController_deploy: [],
|
|
1440
|
+
ScopesController_patchMcpConfig: ["config"],
|
|
1441
|
+
ScopesController_requestOwnershipTransfer: ["newOwnerUserId"],
|
|
1442
|
+
ScopesController_restore: [],
|
|
1443
|
+
ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
|
|
1444
|
+
ScopeSupervisionController_set: ["subordinateAgentIds"],
|
|
1445
|
+
ScopeSupervisionController_setActive: ["subordinateAgentIds"],
|
|
1446
|
+
SuggestionsController_recordEvent: ["event_type", "source", "skill_id", "thread_id", "metadata"],
|
|
1447
|
+
WorkflowActionsController_cancel: [],
|
|
1448
|
+
WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
|
|
1449
|
+
WorkflowInterfacesController_add: ["type", "name", "config"],
|
|
1450
|
+
WorkflowInterfacesController_update: ["name", "config"],
|
|
1451
|
+
WorkflowRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId"],
|
|
1452
|
+
WorkflowsController_acceptOwnershipTransfer: [],
|
|
1453
|
+
WorkflowsController_create: ["name", "type", "description", "trigger", "agentSelection", "workflowStructure", "accessConfig"],
|
|
1454
|
+
WorkflowsController_deploy: [],
|
|
1455
|
+
WorkflowsController_requestOwnershipTransfer: ["newOwnerUserId"],
|
|
1456
|
+
WorkflowsController_restore: [],
|
|
1457
|
+
WorkflowsController_toggle: ["active"],
|
|
1458
|
+
WorkflowsController_update: ["name", "type", "description", "trigger", "agentSelection", "workflowStructure", "accessConfig"]
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1461
|
+
// src/_validation.ts
|
|
1462
|
+
function validatePageSize(pageSize, maxPageSize) {
|
|
1463
|
+
if (!Number.isInteger(pageSize) || pageSize < 1) {
|
|
1464
|
+
throw new Error(`page_size must be a positive int, got ${pageSize}`);
|
|
1465
|
+
}
|
|
1466
|
+
if (maxPageSize !== void 0 && pageSize > maxPageSize) {
|
|
1467
|
+
throw new Error(`page_size must be <= ${maxPageSize}, got ${pageSize}`);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
function validateId(resourceId, name = "id") {
|
|
1471
|
+
if (typeof resourceId === "string" && !resourceId.trim()) {
|
|
1472
|
+
throw new Error(`${name} must be a non-empty string or int`);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
function assertWriteBodyKeys(operationId, body) {
|
|
1476
|
+
const allowed = WRITE_BODY_ALLOWED_KEYS[operationId];
|
|
1477
|
+
if (allowed === void 0) return;
|
|
1478
|
+
if (body === void 0 || body === null) return;
|
|
1479
|
+
if (typeof body !== "object" || Array.isArray(body)) {
|
|
1480
|
+
throw new ValidationError(`Request body must be a plain object for ${operationId}`);
|
|
1481
|
+
}
|
|
1482
|
+
const allowedSet = new Set(allowed);
|
|
1483
|
+
const extra = Object.keys(body).filter((k) => !allowedSet.has(k));
|
|
1484
|
+
if (extra.length > 0) {
|
|
1485
|
+
throw new ValidationError(
|
|
1486
|
+
`${operationId}: disallowed request body field(s): ${extra.sort().join(", ")}`
|
|
1487
|
+
);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
// src/_request.ts
|
|
1492
|
+
async function invokeWithRetry(config, http, operationId, options = {}) {
|
|
1493
|
+
if (options.jsonBody !== void 0) {
|
|
1494
|
+
assertWriteBodyKeys(operationId, options.jsonBody);
|
|
1495
|
+
}
|
|
1496
|
+
return withRetry(() => invokeOperation(http, operationId, options), config.maxRetries, {
|
|
1497
|
+
retryNotFoundOnDeploy: operationId.endsWith("_deploy")
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
function omitUndefined(obj) {
|
|
1501
|
+
return Object.fromEntries(
|
|
1502
|
+
Object.entries(obj).filter((entry) => entry[1] !== void 0)
|
|
1503
|
+
);
|
|
1504
|
+
}
|
|
1505
|
+
function asRecord(data) {
|
|
1506
|
+
if (typeof data === "object" && data !== null && !Array.isArray(data)) {
|
|
1507
|
+
return data;
|
|
1508
|
+
}
|
|
1509
|
+
throw new Error(`Expected object response, got ${typeof data}`);
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
// src/management/_access-config.ts
|
|
1513
|
+
var EVERYONE_GROUP_ID = "__everyone__";
|
|
1514
|
+
function accessConfigWireForCreate(guardrails) {
|
|
1515
|
+
return {
|
|
1516
|
+
visibility: "shared",
|
|
1517
|
+
groupPermissions: { [EVERYONE_GROUP_ID]: { use: true, manage: true } },
|
|
1518
|
+
guardrails,
|
|
1519
|
+
sharedWith: []
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
function accessConfigWireForUpdate(existing, guardrails) {
|
|
1523
|
+
if (!existing || Object.keys(existing).length === 0) {
|
|
1524
|
+
return accessConfigWireForCreate(guardrails);
|
|
1525
|
+
}
|
|
1526
|
+
return { ...existing, guardrails };
|
|
1527
|
+
}
|
|
1528
|
+
function accessFromSkillResponse(raw) {
|
|
1529
|
+
const value = raw.accessConfig ?? raw.access_config;
|
|
1530
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1531
|
+
return value;
|
|
1532
|
+
}
|
|
1533
|
+
return {};
|
|
1534
|
+
}
|
|
1535
|
+
function accessConfigBodyForCreate(guardrails) {
|
|
1536
|
+
if (guardrails === void 0) return void 0;
|
|
1537
|
+
return accessConfigWireForCreate(guardrails);
|
|
1538
|
+
}
|
|
1539
|
+
async function accessConfigBodyForUpdate(guardrails, loadResource) {
|
|
1540
|
+
if (guardrails === void 0) return void 0;
|
|
1541
|
+
const existing = accessFromSkillResponse(await loadResource());
|
|
1542
|
+
return accessConfigWireForUpdate(existing, guardrails);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
// src/management/agents/interfaces.ts
|
|
1546
|
+
var WorkflowInterfacesResource = class {
|
|
1547
|
+
constructor(http, config, workflowId) {
|
|
1548
|
+
this.http = http;
|
|
1549
|
+
this.config = config;
|
|
1550
|
+
this.workflowId = workflowId;
|
|
1551
|
+
}
|
|
1552
|
+
async list() {
|
|
1553
|
+
validateId(this.workflowId, "workflow_id");
|
|
1554
|
+
const data = await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_list", {
|
|
1555
|
+
pathParams: { id: this.workflowId }
|
|
1556
|
+
});
|
|
1557
|
+
return data.interfaces;
|
|
1558
|
+
}
|
|
1559
|
+
async create(options) {
|
|
1560
|
+
validateId(this.workflowId, "workflow_id");
|
|
1561
|
+
return await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_add", {
|
|
1562
|
+
pathParams: { id: this.workflowId },
|
|
1563
|
+
jsonBody: omitUndefined(options)
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
async update(interfaceId, options, updateMask) {
|
|
1567
|
+
validateId(this.workflowId, "workflow_id");
|
|
1568
|
+
validateId(interfaceId, "interface_id");
|
|
1569
|
+
return await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_update", {
|
|
1570
|
+
pathParams: { id: this.workflowId, interfaceId },
|
|
1571
|
+
query: updateMaskQuery(updateMask),
|
|
1572
|
+
jsonBody: updateMask === void 0 ? omitUndefined(options) : options
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
async delete(interfaceId) {
|
|
1576
|
+
validateId(this.workflowId, "workflow_id");
|
|
1577
|
+
validateId(interfaceId, "interface_id");
|
|
1578
|
+
await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_delete", {
|
|
1579
|
+
pathParams: { id: this.workflowId, interfaceId }
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
async deleteAll() {
|
|
1583
|
+
validateId(this.workflowId, "workflow_id");
|
|
1584
|
+
await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_deleteAll", {
|
|
1585
|
+
pathParams: { id: this.workflowId }
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
|
|
1590
|
+
// src/management/agents/agents.ts
|
|
1591
|
+
var MANAGEMENT_WORKFLOW_OPERATIONS = {
|
|
1592
|
+
list: "WorkflowsController_list",
|
|
1593
|
+
get: "WorkflowsController_get",
|
|
1594
|
+
create: "WorkflowsController_create",
|
|
1595
|
+
update: "WorkflowsController_update",
|
|
1596
|
+
deploy: "WorkflowsController_deploy",
|
|
1597
|
+
delete: "WorkflowsController_delete",
|
|
1598
|
+
restore: "WorkflowsController_restore",
|
|
1599
|
+
requestOwnershipTransfer: "WorkflowsController_requestOwnershipTransfer",
|
|
1600
|
+
cancelOwnershipTransfer: "WorkflowsController_cancelOwnershipTransfer",
|
|
1601
|
+
acceptOwnershipTransfer: "WorkflowsController_acceptOwnershipTransfer",
|
|
1602
|
+
toggle: "WorkflowsController_toggle"
|
|
1603
|
+
};
|
|
1604
|
+
function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
|
|
1605
|
+
const extra = {};
|
|
1606
|
+
if (search !== void 0) extra.search = search;
|
|
1607
|
+
if (type !== void 0) extra.type = type;
|
|
1608
|
+
if (view !== void 0) extra.view = view;
|
|
1609
|
+
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
1610
|
+
return aipListParams(pageSize, pageToken, extra);
|
|
1611
|
+
}
|
|
1612
|
+
function parseWorkflow(raw) {
|
|
1613
|
+
return raw;
|
|
1614
|
+
}
|
|
1615
|
+
var ManagementWorkflowsResource = class {
|
|
1616
|
+
constructor(http, config) {
|
|
1617
|
+
this.http = http;
|
|
1618
|
+
this.config = config;
|
|
1619
|
+
this.ops = MANAGEMENT_WORKFLOW_OPERATIONS;
|
|
1620
|
+
}
|
|
1621
|
+
list(options = {}) {
|
|
1622
|
+
const pageSize = options.pageSize ?? 25;
|
|
1623
|
+
validatePageSize(pageSize);
|
|
1624
|
+
return this.listPage(
|
|
1625
|
+
pageSize,
|
|
1626
|
+
options.pageToken,
|
|
1627
|
+
options.search,
|
|
1628
|
+
options.type,
|
|
1629
|
+
options.view,
|
|
1630
|
+
options.includeVariation
|
|
1631
|
+
);
|
|
1632
|
+
}
|
|
1633
|
+
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
1634
|
+
const data = asRecord(
|
|
1635
|
+
await invokeWithRetry(this.config, this.http, this.ops.list, {
|
|
1636
|
+
query: workflowsListParams(pageSize, pageToken, search, type, view, includeVariation)
|
|
1637
|
+
})
|
|
1638
|
+
);
|
|
1639
|
+
return buildAipPage(
|
|
1640
|
+
data,
|
|
1641
|
+
"agents",
|
|
1642
|
+
parseWorkflow,
|
|
1643
|
+
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
1644
|
+
);
|
|
1645
|
+
}
|
|
1646
|
+
async get(workflowId, options = {}) {
|
|
1647
|
+
validateId(workflowId, "workflow_id");
|
|
1648
|
+
const query = options.view !== void 0 ? { view: options.view } : void 0;
|
|
1649
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.get, {
|
|
1650
|
+
pathParams: { id: workflowId },
|
|
1651
|
+
query
|
|
1652
|
+
});
|
|
1653
|
+
return parseWorkflow(data);
|
|
1654
|
+
}
|
|
1655
|
+
interfaces(workflowId) {
|
|
1656
|
+
return new WorkflowInterfacesResource(this.http, this.config, workflowId);
|
|
1657
|
+
}
|
|
1658
|
+
async create(options) {
|
|
1659
|
+
const body = omitUndefined({
|
|
1660
|
+
name: options.name,
|
|
1661
|
+
type: options.type,
|
|
1662
|
+
description: options.description,
|
|
1663
|
+
trigger: options.trigger,
|
|
1664
|
+
agentSelection: options.agentSelection,
|
|
1665
|
+
workflowStructure: options.workflowStructure,
|
|
1666
|
+
accessConfig: accessConfigBodyForCreate(options.guardrails)
|
|
1667
|
+
});
|
|
1668
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.create, {
|
|
1669
|
+
jsonBody: body
|
|
1670
|
+
});
|
|
1671
|
+
return parseWorkflow(data);
|
|
1672
|
+
}
|
|
1673
|
+
async update(workflowId, options = {}) {
|
|
1674
|
+
validateId(workflowId, "workflow_id");
|
|
1675
|
+
const accessConfig = await accessConfigBodyForUpdate(
|
|
1676
|
+
options.guardrails,
|
|
1677
|
+
async () => asRecord(
|
|
1678
|
+
await invokeWithRetry(this.config, this.http, this.ops.get, {
|
|
1679
|
+
pathParams: { id: workflowId }
|
|
1680
|
+
})
|
|
1681
|
+
)
|
|
1682
|
+
);
|
|
1683
|
+
const fields = {
|
|
1684
|
+
name: options.name,
|
|
1685
|
+
type: options.type,
|
|
1686
|
+
description: options.description,
|
|
1687
|
+
trigger: options.trigger,
|
|
1688
|
+
agentSelection: options.agentSelection,
|
|
1689
|
+
workflowStructure: options.workflowStructure,
|
|
1690
|
+
accessConfig
|
|
1691
|
+
};
|
|
1692
|
+
const body = options.updateMask !== void 0 ? fields : omitUndefined(fields);
|
|
1693
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.update, {
|
|
1694
|
+
pathParams: { id: workflowId },
|
|
1695
|
+
query: updateMaskQuery(options.updateMask),
|
|
1696
|
+
jsonBody: body
|
|
1697
|
+
});
|
|
1698
|
+
return parseWorkflow(data);
|
|
1699
|
+
}
|
|
1700
|
+
async deploy(workflowId) {
|
|
1701
|
+
validateId(workflowId, "workflow_id");
|
|
1702
|
+
const data = asRecord(
|
|
1703
|
+
await invokeWithRetry(this.config, this.http, this.ops.deploy, {
|
|
1704
|
+
pathParams: { id: workflowId },
|
|
1705
|
+
jsonBody: {}
|
|
1706
|
+
})
|
|
1707
|
+
);
|
|
1708
|
+
return parseWorkflow(data.agent);
|
|
1709
|
+
}
|
|
1710
|
+
async toggle(workflowId, options) {
|
|
1711
|
+
validateId(workflowId, "workflow_id");
|
|
1712
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.toggle, {
|
|
1713
|
+
pathParams: { id: workflowId },
|
|
1714
|
+
jsonBody: { active: options.active }
|
|
1715
|
+
});
|
|
1716
|
+
return parseWorkflow(data);
|
|
1717
|
+
}
|
|
1718
|
+
async delete(workflowId) {
|
|
1719
|
+
validateId(workflowId, "workflow_id");
|
|
1720
|
+
await invokeWithRetry(this.config, this.http, this.ops.delete, {
|
|
1721
|
+
pathParams: { id: workflowId }
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
async restore(workflowId) {
|
|
1725
|
+
validateId(workflowId, "workflow_id");
|
|
1726
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {
|
|
1727
|
+
pathParams: { id: workflowId },
|
|
1728
|
+
jsonBody: {}
|
|
1729
|
+
});
|
|
1730
|
+
return parseWorkflow(data);
|
|
1731
|
+
}
|
|
1732
|
+
async requestOwnershipTransfer(workflowId, options) {
|
|
1733
|
+
validateId(workflowId, "workflow_id");
|
|
1734
|
+
const data = await invokeWithRetry(
|
|
1735
|
+
this.config,
|
|
1736
|
+
this.http,
|
|
1737
|
+
this.ops.requestOwnershipTransfer,
|
|
1738
|
+
{
|
|
1739
|
+
pathParams: { id: workflowId },
|
|
1740
|
+
jsonBody: omitUndefined({ newOwnerUserId: options.newOwnerUserId })
|
|
1741
|
+
}
|
|
1742
|
+
);
|
|
1743
|
+
return parseWorkflow(data);
|
|
1744
|
+
}
|
|
1745
|
+
async cancelOwnershipTransfer(workflowId) {
|
|
1746
|
+
validateId(workflowId, "workflow_id");
|
|
1747
|
+
const data = await invokeWithRetry(
|
|
1748
|
+
this.config,
|
|
1749
|
+
this.http,
|
|
1750
|
+
this.ops.cancelOwnershipTransfer,
|
|
1751
|
+
{ pathParams: { id: workflowId } }
|
|
1752
|
+
);
|
|
1753
|
+
return parseWorkflow(data);
|
|
1754
|
+
}
|
|
1755
|
+
async acceptOwnershipTransfer(workflowId) {
|
|
1756
|
+
validateId(workflowId, "workflow_id");
|
|
1757
|
+
const data = await invokeWithRetry(
|
|
1758
|
+
this.config,
|
|
1759
|
+
this.http,
|
|
1760
|
+
this.ops.acceptOwnershipTransfer,
|
|
1761
|
+
{ pathParams: { id: workflowId }, jsonBody: {} }
|
|
1762
|
+
);
|
|
1763
|
+
return parseWorkflow(data);
|
|
1764
|
+
}
|
|
1765
|
+
};
|
|
1766
|
+
|
|
1767
|
+
// src/resources/context/custom-items.ts
|
|
1768
|
+
function parseContextItem(raw) {
|
|
1769
|
+
return raw;
|
|
1770
|
+
}
|
|
1771
|
+
function parseCreatedCustomContextItem(raw) {
|
|
1772
|
+
return raw;
|
|
1773
|
+
}
|
|
1774
|
+
function parseDeletion(raw) {
|
|
1775
|
+
return raw;
|
|
1776
|
+
}
|
|
1777
|
+
var CustomContextItemsResource = class {
|
|
1778
|
+
constructor(http, config) {
|
|
1779
|
+
this.http = http;
|
|
1780
|
+
this.config = config;
|
|
1781
|
+
}
|
|
1782
|
+
list(options = {}) {
|
|
1783
|
+
const pageSize = options.pageSize ?? 25;
|
|
1784
|
+
validatePageSize(pageSize);
|
|
1785
|
+
return this.listPage(pageSize, options.pageToken, options);
|
|
1786
|
+
}
|
|
1787
|
+
async listPage(pageSize, pageToken, options) {
|
|
1788
|
+
const data = asRecord(
|
|
1789
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_list", {
|
|
1790
|
+
query: aipListParams(pageSize, pageToken, {
|
|
1791
|
+
searchQuery: options.searchQuery,
|
|
1792
|
+
topics: options.topics
|
|
1793
|
+
})
|
|
1794
|
+
})
|
|
1795
|
+
);
|
|
1796
|
+
return buildAipPage(
|
|
1797
|
+
data,
|
|
1798
|
+
"contextItems",
|
|
1799
|
+
parseContextItem,
|
|
1800
|
+
(token) => this.listPage(pageSize, token, options)
|
|
1801
|
+
);
|
|
1802
|
+
}
|
|
1803
|
+
async get(uid) {
|
|
1804
|
+
return parseContextItem(
|
|
1805
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_get", {
|
|
1806
|
+
pathParams: { uid }
|
|
1807
|
+
})
|
|
1808
|
+
);
|
|
1809
|
+
}
|
|
1810
|
+
async create(input) {
|
|
1811
|
+
return parseCreatedCustomContextItem(
|
|
1812
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_create", {
|
|
1813
|
+
jsonBody: omitUndefined(input)
|
|
1814
|
+
})
|
|
1815
|
+
);
|
|
1816
|
+
}
|
|
1817
|
+
async batchCreate(inputs) {
|
|
1818
|
+
const data = asRecord(
|
|
1819
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_batchCreate", {
|
|
1820
|
+
jsonBody: {
|
|
1821
|
+
items: inputs.map((input) => omitUndefined(input))
|
|
1822
|
+
}
|
|
1823
|
+
})
|
|
1824
|
+
);
|
|
1825
|
+
const items = data.contextItems;
|
|
1826
|
+
return Array.isArray(items) ? items.map(parseCreatedCustomContextItem) : [];
|
|
1827
|
+
}
|
|
1828
|
+
async update(uid, input) {
|
|
1829
|
+
return asRecord(
|
|
1830
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_update", {
|
|
1831
|
+
pathParams: { uid },
|
|
1832
|
+
jsonBody: omitUndefined(input)
|
|
1833
|
+
})
|
|
1834
|
+
);
|
|
1835
|
+
}
|
|
1836
|
+
async delete(uid) {
|
|
1837
|
+
return parseDeletion(
|
|
1838
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_delete", {
|
|
1839
|
+
pathParams: { uid }
|
|
1840
|
+
})
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
};
|
|
1844
|
+
|
|
1845
|
+
// src/management/context/_content-merge.ts
|
|
1846
|
+
function requireContentDict(item, contextType) {
|
|
1847
|
+
if (item.contextType !== contextType) {
|
|
1848
|
+
throw new Error(`Expected contextType ${contextType}, got ${item.contextType}.`);
|
|
1849
|
+
}
|
|
1850
|
+
if (!item.content || typeof item.content !== "object" || Array.isArray(item.content)) {
|
|
1851
|
+
throw new Error(`Context item ${item.uid} has no object content; cannot merge ${contextType} fields.`);
|
|
1852
|
+
}
|
|
1853
|
+
return item.content;
|
|
1854
|
+
}
|
|
1855
|
+
function mergeNoteContent(existing, options) {
|
|
1856
|
+
return { ...existing, title: options.title, content: options.body };
|
|
1857
|
+
}
|
|
1858
|
+
function mergeLinkContent(existing, options) {
|
|
1859
|
+
const merged = { ...existing };
|
|
1860
|
+
if (options.title !== void 0) merged.title = options.title;
|
|
1861
|
+
if (options.url !== void 0) merged.url = options.url;
|
|
1862
|
+
return merged;
|
|
1863
|
+
}
|
|
1864
|
+
function mergeSavedQueryContent(existing, options) {
|
|
1865
|
+
const merged = { ...existing, name: options.name, query: options.query };
|
|
1866
|
+
if (options.connectionId !== void 0) merged.connectionId = options.connectionId;
|
|
1867
|
+
if (options.path !== void 0) merged.path = options.path;
|
|
1868
|
+
return merged;
|
|
1869
|
+
}
|
|
1870
|
+
async function resolveExistingContent(items, uid, contextType, existing) {
|
|
1871
|
+
const item = existing ?? await items.get(uid);
|
|
1872
|
+
return requireContentDict(item, contextType);
|
|
1873
|
+
}
|
|
1874
|
+
async function updateWithMergedContent(items, uid, options) {
|
|
1875
|
+
if (options.existing) requireContentDict(options.existing, options.contextType);
|
|
1876
|
+
return items.update(uid, {
|
|
1877
|
+
contextType: options.contextType,
|
|
1878
|
+
content: options.mergedContent,
|
|
1879
|
+
description: options.description,
|
|
1880
|
+
userFeedback: options.userFeedback,
|
|
1881
|
+
topics: options.topics
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
async function resolveAndUpdateNote(items, uid, options) {
|
|
1885
|
+
const content = await resolveExistingContent(items, uid, "note", options.existing);
|
|
1886
|
+
return updateWithMergedContent(items, uid, {
|
|
1887
|
+
contextType: "note",
|
|
1888
|
+
mergedContent: mergeNoteContent(content, { title: options.title, body: options.body }),
|
|
1889
|
+
existing: options.existing,
|
|
1890
|
+
description: options.description,
|
|
1891
|
+
userFeedback: options.userFeedback,
|
|
1892
|
+
topics: options.topics
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
async function resolveAndUpdateSavedQuery(items, uid, options) {
|
|
1896
|
+
const content = await resolveExistingContent(items, uid, "saved_query", options.existing);
|
|
1897
|
+
return updateWithMergedContent(items, uid, {
|
|
1898
|
+
contextType: "saved_query",
|
|
1899
|
+
mergedContent: mergeSavedQueryContent(content, options),
|
|
1900
|
+
existing: options.existing,
|
|
1901
|
+
description: options.description,
|
|
1902
|
+
userFeedback: options.userFeedback,
|
|
1903
|
+
topics: options.topics
|
|
1904
|
+
});
|
|
1905
|
+
}
|
|
1906
|
+
async function resolveAndUpdateLink(items, uid, options) {
|
|
1907
|
+
if (options.title === void 0 && options.url === void 0 && options.description === void 0 && options.userFeedback === void 0 && options.topics === void 0) {
|
|
1908
|
+
throw new Error("Provide at least one field to update.");
|
|
1909
|
+
}
|
|
1910
|
+
if (options.title === void 0 && options.url === void 0) {
|
|
1911
|
+
return items.update(uid, {
|
|
1912
|
+
description: options.description,
|
|
1913
|
+
userFeedback: options.userFeedback,
|
|
1914
|
+
topics: options.topics
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
const content = await resolveExistingContent(items, uid, "link", options.existing);
|
|
1918
|
+
return updateWithMergedContent(items, uid, {
|
|
1919
|
+
contextType: "link",
|
|
1920
|
+
mergedContent: mergeLinkContent(content, { title: options.title, url: options.url }),
|
|
1921
|
+
existing: options.existing,
|
|
1922
|
+
description: options.description,
|
|
1923
|
+
userFeedback: options.userFeedback,
|
|
1924
|
+
topics: options.topics
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
// src/management/context/items.ts
|
|
1929
|
+
function contextListParams(pageSize, pageToken, contextType) {
|
|
1930
|
+
const extra = {};
|
|
1931
|
+
if (contextType !== void 0) extra.contextTypes = [contextType];
|
|
1932
|
+
return aipListParams(pageSize, pageToken, extra);
|
|
1933
|
+
}
|
|
1934
|
+
function parseContextItem2(raw) {
|
|
1935
|
+
return raw;
|
|
1936
|
+
}
|
|
1937
|
+
var ManagementContextItemsResource = class {
|
|
1938
|
+
constructor(http, config) {
|
|
1939
|
+
this.http = http;
|
|
1940
|
+
this.config = config;
|
|
1941
|
+
}
|
|
1942
|
+
list(options = {}) {
|
|
1943
|
+
const pageSize = options.pageSize ?? 25;
|
|
1944
|
+
validatePageSize(pageSize);
|
|
1945
|
+
return this.listPage(pageSize, options.pageToken, options.contextType);
|
|
1946
|
+
}
|
|
1947
|
+
async listPage(pageSize, pageToken, contextType) {
|
|
1948
|
+
const data = asRecord(
|
|
1949
|
+
await invokeWithRetry(this.config, this.http, "ContextItemsController_list", {
|
|
1950
|
+
query: contextListParams(pageSize, pageToken, contextType)
|
|
1951
|
+
})
|
|
1952
|
+
);
|
|
1953
|
+
return buildAipPage(
|
|
1954
|
+
data,
|
|
1955
|
+
"contextItems",
|
|
1956
|
+
parseContextItem2,
|
|
1957
|
+
(token) => this.listPage(pageSize, token, contextType)
|
|
1958
|
+
);
|
|
1959
|
+
}
|
|
1960
|
+
async get(uid) {
|
|
1961
|
+
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_get", {
|
|
1962
|
+
pathParams: { uid }
|
|
1963
|
+
});
|
|
1964
|
+
return parseContextItem2(data);
|
|
1965
|
+
}
|
|
1966
|
+
async update(uid, options = {}) {
|
|
1967
|
+
const body = options.updateMask !== void 0 ? {
|
|
1968
|
+
content: options.content,
|
|
1969
|
+
contextType: options.contextType,
|
|
1970
|
+
description: options.description,
|
|
1971
|
+
userFeedback: options.userFeedback,
|
|
1972
|
+
topics: options.topics
|
|
1973
|
+
} : omitUndefined({
|
|
1974
|
+
content: options.content,
|
|
1975
|
+
contextType: options.contextType,
|
|
1976
|
+
description: options.description,
|
|
1977
|
+
userFeedback: options.userFeedback,
|
|
1978
|
+
topics: options.topics
|
|
1979
|
+
});
|
|
1980
|
+
await invokeWithRetry(this.config, this.http, "ContextItemsController_update", {
|
|
1981
|
+
pathParams: { uid },
|
|
1982
|
+
query: updateMaskQuery(options.updateMask),
|
|
1983
|
+
jsonBody: body
|
|
1984
|
+
});
|
|
1985
|
+
return this.get(uid);
|
|
1986
|
+
}
|
|
1987
|
+
async delete(uid) {
|
|
1988
|
+
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_delete", {
|
|
1989
|
+
pathParams: { uid }
|
|
1990
|
+
});
|
|
1991
|
+
return data;
|
|
1992
|
+
}
|
|
1993
|
+
};
|
|
1994
|
+
|
|
1995
|
+
// src/management/context/context.ts
|
|
1996
|
+
var ManagementContextResource = class {
|
|
1997
|
+
constructor(http, config) {
|
|
1998
|
+
this.http = http;
|
|
1999
|
+
this.config = config;
|
|
2000
|
+
this.items = new ManagementContextItemsResource(http, config);
|
|
2001
|
+
this.customItems = new CustomContextItemsResource(http, config);
|
|
2002
|
+
}
|
|
2003
|
+
async create(operationId, payload) {
|
|
2004
|
+
const data = await invokeWithRetry(this.config, this.http, operationId, {
|
|
2005
|
+
jsonBody: payload
|
|
2006
|
+
});
|
|
2007
|
+
return data;
|
|
2008
|
+
}
|
|
2009
|
+
createNote(title, content) {
|
|
2010
|
+
return this.create("ContextCreatorsController_createNote", omitUndefined({ title, content }));
|
|
2011
|
+
}
|
|
2012
|
+
updateNote(uid, options) {
|
|
2013
|
+
return resolveAndUpdateNote(this.items, uid, options);
|
|
2014
|
+
}
|
|
2015
|
+
createSavedQuery(name, options) {
|
|
2016
|
+
return this.create(
|
|
2017
|
+
"ContextCreatorsController_createSavedQuery",
|
|
2018
|
+
omitUndefined({
|
|
2019
|
+
name,
|
|
2020
|
+
query: options.query,
|
|
2021
|
+
connectionId: options.connectionId,
|
|
2022
|
+
description: options.description,
|
|
2023
|
+
path: options.path
|
|
2024
|
+
})
|
|
2025
|
+
);
|
|
2026
|
+
}
|
|
2027
|
+
updateSavedQuery(uid, options) {
|
|
2028
|
+
return resolveAndUpdateSavedQuery(this.items, uid, options);
|
|
2029
|
+
}
|
|
2030
|
+
createLink(url, options = {}) {
|
|
2031
|
+
return this.create(
|
|
2032
|
+
"ContextCreatorsController_createLink",
|
|
2033
|
+
omitUndefined({
|
|
2034
|
+
url,
|
|
2035
|
+
title: options.title,
|
|
2036
|
+
isCrawl: options.isCrawl,
|
|
2037
|
+
pageLimit: options.pageLimit
|
|
2038
|
+
})
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
updateLink(uid, options) {
|
|
2042
|
+
return resolveAndUpdateLink(this.items, uid, options);
|
|
2043
|
+
}
|
|
2044
|
+
};
|
|
2045
|
+
|
|
2046
|
+
// src/management/organization.ts
|
|
2047
|
+
var ManagementOrganizationResource = class {
|
|
2048
|
+
constructor(http, config) {
|
|
2049
|
+
this.http = http;
|
|
2050
|
+
this.config = config;
|
|
2051
|
+
}
|
|
2052
|
+
async delete() {
|
|
2053
|
+
await invokeWithRetry(this.config, this.http, "OrganizationController_deleteOrganization");
|
|
2054
|
+
}
|
|
2055
|
+
};
|
|
2056
|
+
|
|
2057
|
+
// src/resources/skills/conversations.ts
|
|
2058
|
+
function parseListItem(raw) {
|
|
2059
|
+
return raw;
|
|
2060
|
+
}
|
|
2061
|
+
function parseConversation(raw) {
|
|
2062
|
+
return raw;
|
|
2063
|
+
}
|
|
2064
|
+
var ScopeConversationsResource = class {
|
|
2065
|
+
constructor(http, config, scopeId) {
|
|
2066
|
+
this.http = http;
|
|
2067
|
+
this.config = config;
|
|
2068
|
+
this.scopeId = scopeId;
|
|
2069
|
+
}
|
|
2070
|
+
list(options = {}) {
|
|
2071
|
+
const pageSize = options.pageSize ?? 25;
|
|
2072
|
+
validatePageSize(pageSize);
|
|
2073
|
+
return this.listPage(pageSize, options.pageToken);
|
|
2074
|
+
}
|
|
2075
|
+
async listPage(pageSize, pageToken) {
|
|
2076
|
+
validateId(this.scopeId, "scope_id");
|
|
2077
|
+
const data = asRecord(
|
|
2078
|
+
await invokeWithRetry(this.config, this.http, "ScopeConversationsController_list", {
|
|
2079
|
+
pathParams: { id: this.scopeId },
|
|
2080
|
+
query: aipListParams(pageSize, pageToken)
|
|
2081
|
+
})
|
|
2082
|
+
);
|
|
2083
|
+
return buildAipPage(
|
|
2084
|
+
data,
|
|
2085
|
+
"conversations",
|
|
2086
|
+
parseListItem,
|
|
2087
|
+
(token) => this.listPage(pageSize, token)
|
|
2088
|
+
);
|
|
2089
|
+
}
|
|
2090
|
+
async get(threadId, options = {}) {
|
|
2091
|
+
validateId(this.scopeId, "scope_id");
|
|
2092
|
+
validateId(threadId, "thread_id");
|
|
2093
|
+
if (options.beforeMessageIndex !== void 0 && options.messageLimit === void 0) {
|
|
2094
|
+
throw new Error("beforeMessageIndex requires messageLimit");
|
|
2095
|
+
}
|
|
2096
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopeConversationsController_get", {
|
|
2097
|
+
pathParams: { id: this.scopeId, threadId },
|
|
2098
|
+
query: {
|
|
2099
|
+
messageLimit: options.messageLimit,
|
|
2100
|
+
beforeMessageIndex: options.beforeMessageIndex
|
|
2101
|
+
}
|
|
2102
|
+
});
|
|
2103
|
+
return parseConversation(data);
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
|
|
2107
|
+
// src/management/skills/memories.ts
|
|
2108
|
+
function parseMemory(raw) {
|
|
2109
|
+
return raw;
|
|
2110
|
+
}
|
|
2111
|
+
var ScopeMemoriesResource = class {
|
|
2112
|
+
constructor(http, config, scopeId) {
|
|
2113
|
+
this.http = http;
|
|
2114
|
+
this.config = config;
|
|
2115
|
+
this.scopeId = scopeId;
|
|
2116
|
+
}
|
|
2117
|
+
list(options = {}) {
|
|
2118
|
+
const pageSize = options.pageSize ?? 25;
|
|
2119
|
+
validatePageSize(pageSize);
|
|
2120
|
+
return this.listPage(pageSize, options.pageToken, options.userId);
|
|
2121
|
+
}
|
|
2122
|
+
async listPage(pageSize, pageToken, userId) {
|
|
2123
|
+
validateId(this.scopeId, "scope_id");
|
|
2124
|
+
const extra = {};
|
|
2125
|
+
if (userId !== void 0) extra.userId = userId;
|
|
2126
|
+
const data = asRecord(
|
|
2127
|
+
await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_list", {
|
|
2128
|
+
pathParams: { id: this.scopeId },
|
|
2129
|
+
query: aipListParams(pageSize, pageToken, extra)
|
|
2130
|
+
})
|
|
2131
|
+
);
|
|
2132
|
+
return buildAipPage(
|
|
2133
|
+
data,
|
|
2134
|
+
"memories",
|
|
2135
|
+
parseMemory,
|
|
2136
|
+
(token) => this.listPage(pageSize, token, userId)
|
|
2137
|
+
);
|
|
2138
|
+
}
|
|
2139
|
+
async search(request) {
|
|
2140
|
+
validateId(this.scopeId, "scope_id");
|
|
2141
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_search", {
|
|
2142
|
+
pathParams: { id: this.scopeId },
|
|
2143
|
+
jsonBody: omitUndefined(request)
|
|
2144
|
+
});
|
|
2145
|
+
return data;
|
|
2146
|
+
}
|
|
2147
|
+
async update(memoryId, update, options = {}) {
|
|
2148
|
+
validateId(memoryId, "memory_id");
|
|
2149
|
+
validateId(this.scopeId, "scope_id");
|
|
2150
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_update", {
|
|
2151
|
+
pathParams: { id: this.scopeId, memoryId },
|
|
2152
|
+
query: updateMaskQuery(options.updateMask),
|
|
2153
|
+
jsonBody: omitUndefined(update)
|
|
2154
|
+
});
|
|
2155
|
+
return parseMemory(data);
|
|
2156
|
+
}
|
|
2157
|
+
async delete(memoryId) {
|
|
2158
|
+
validateId(memoryId, "memory_id");
|
|
2159
|
+
validateId(this.scopeId, "scope_id");
|
|
2160
|
+
await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_delete", {
|
|
2161
|
+
pathParams: { id: this.scopeId, memoryId }
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
// src/management/skills/evaluations.ts
|
|
2167
|
+
function parseConfig(raw) {
|
|
2168
|
+
return raw;
|
|
2169
|
+
}
|
|
2170
|
+
function parseRun(raw) {
|
|
2171
|
+
return raw;
|
|
2172
|
+
}
|
|
2173
|
+
var ScopeEvaluationsResource = class {
|
|
2174
|
+
constructor(http, config, scopeId) {
|
|
2175
|
+
this.http = http;
|
|
2176
|
+
this.config = config;
|
|
2177
|
+
this.scopeId = scopeId;
|
|
2178
|
+
}
|
|
2179
|
+
async getConfig() {
|
|
2180
|
+
validateId(this.scopeId, "scope_id");
|
|
2181
|
+
const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_getConfig", {
|
|
2182
|
+
pathParams: { id: this.scopeId }
|
|
2183
|
+
});
|
|
2184
|
+
return parseConfig(data);
|
|
2185
|
+
}
|
|
2186
|
+
async updateConfig(update) {
|
|
2187
|
+
validateId(this.scopeId, "scope_id");
|
|
2188
|
+
const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_updateConfig", {
|
|
2189
|
+
pathParams: { id: this.scopeId },
|
|
2190
|
+
jsonBody: omitUndefined(update)
|
|
2191
|
+
});
|
|
2192
|
+
return parseConfig(data);
|
|
2193
|
+
}
|
|
2194
|
+
async triggerRun() {
|
|
2195
|
+
validateId(this.scopeId, "scope_id");
|
|
2196
|
+
const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_triggerRun", {
|
|
2197
|
+
pathParams: { id: this.scopeId }
|
|
2198
|
+
});
|
|
2199
|
+
return data;
|
|
2200
|
+
}
|
|
2201
|
+
listRuns(options = {}) {
|
|
2202
|
+
const pageSize = options.pageSize ?? 25;
|
|
2203
|
+
validatePageSize(pageSize);
|
|
2204
|
+
return this.listRunsPage(pageSize, options.pageToken);
|
|
2205
|
+
}
|
|
2206
|
+
async listRunsPage(pageSize, pageToken) {
|
|
2207
|
+
validateId(this.scopeId, "scope_id");
|
|
2208
|
+
const data = asRecord(
|
|
2209
|
+
await invokeWithRetry(this.config, this.http, "EvaluationsController_listRuns", {
|
|
2210
|
+
pathParams: { id: this.scopeId },
|
|
2211
|
+
query: aipListParams(pageSize, pageToken)
|
|
2212
|
+
})
|
|
2213
|
+
);
|
|
2214
|
+
return buildAipPage(data, "runs", parseRun, (token) => this.listRunsPage(pageSize, token));
|
|
2215
|
+
}
|
|
2216
|
+
async getRun(runId) {
|
|
2217
|
+
validateId(this.scopeId, "scope_id");
|
|
2218
|
+
validateId(runId, "run_id");
|
|
2219
|
+
const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_getRun", {
|
|
2220
|
+
pathParams: { id: this.scopeId, runId }
|
|
2221
|
+
});
|
|
2222
|
+
return data;
|
|
2223
|
+
}
|
|
2224
|
+
};
|
|
2225
|
+
|
|
2226
|
+
// src/management/skills/supervision.ts
|
|
2227
|
+
var ScopeSupervisionResource = class {
|
|
2228
|
+
constructor(http, config, scopeId) {
|
|
2229
|
+
this.http = http;
|
|
2230
|
+
this.config = config;
|
|
2231
|
+
this.scopeId = scopeId;
|
|
2232
|
+
}
|
|
2233
|
+
async get(options = {}) {
|
|
2234
|
+
validateId(this.scopeId, "scope_id");
|
|
2235
|
+
return await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_get", {
|
|
2236
|
+
pathParams: { id: this.scopeId },
|
|
2237
|
+
query: options.view === void 0 ? void 0 : { view: options.view }
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
async set(request) {
|
|
2241
|
+
return this.write("ScopeSupervisionController_set", request);
|
|
2242
|
+
}
|
|
2243
|
+
async setActive(request) {
|
|
2244
|
+
return this.write("ScopeSupervisionController_setActive", request);
|
|
2245
|
+
}
|
|
2246
|
+
async write(operation, request) {
|
|
2247
|
+
validateId(this.scopeId, "scope_id");
|
|
2248
|
+
return await invokeWithRetry(this.config, this.http, operation, {
|
|
2249
|
+
pathParams: { id: this.scopeId },
|
|
2250
|
+
jsonBody: request
|
|
2251
|
+
});
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
|
|
2255
|
+
// src/management/skills/skills.ts
|
|
2256
|
+
var MANAGEMENT_SCOPE_OPERATIONS = {
|
|
2257
|
+
list: "ScopesController_list",
|
|
2258
|
+
get: "ScopesController_get",
|
|
2259
|
+
create: "ScopesController_create",
|
|
2260
|
+
update: "ScopesController_update",
|
|
2261
|
+
deploy: "ScopesController_deploy",
|
|
2262
|
+
delete: "ScopesController_delete",
|
|
2263
|
+
restore: "ScopesController_restore",
|
|
2264
|
+
requestOwnershipTransfer: "ScopesController_requestOwnershipTransfer",
|
|
2265
|
+
cancelOwnershipTransfer: "ScopesController_cancelOwnershipTransfer",
|
|
2266
|
+
acceptOwnershipTransfer: "ScopesController_acceptOwnershipTransfer",
|
|
2267
|
+
patchMcpConfig: "ScopesController_patchMcpConfig",
|
|
2268
|
+
getVariation: "ScopesController_getVariation"
|
|
2269
|
+
};
|
|
2270
|
+
function scopesListParams(pageSize, pageToken, search, view, managerId) {
|
|
2271
|
+
const extra = {};
|
|
2272
|
+
if (search !== void 0) extra.search = search;
|
|
2273
|
+
if (view !== void 0) extra.view = view;
|
|
2274
|
+
if (managerId !== void 0) extra.managerId = managerId;
|
|
2275
|
+
return aipListParams(pageSize, pageToken, extra);
|
|
2276
|
+
}
|
|
2277
|
+
function parseScope(raw) {
|
|
2278
|
+
return raw;
|
|
2279
|
+
}
|
|
2280
|
+
var ManagementScopesResource = class {
|
|
2281
|
+
constructor(http, config) {
|
|
2282
|
+
this.http = http;
|
|
2283
|
+
this.config = config;
|
|
2284
|
+
this.ops = MANAGEMENT_SCOPE_OPERATIONS;
|
|
2285
|
+
}
|
|
2286
|
+
conversations(scopeId) {
|
|
2287
|
+
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
2288
|
+
}
|
|
2289
|
+
memories(scopeId) {
|
|
2290
|
+
return new ScopeMemoriesResource(this.http, this.config, scopeId);
|
|
2291
|
+
}
|
|
2292
|
+
evaluations(scopeId) {
|
|
2293
|
+
return new ScopeEvaluationsResource(this.http, this.config, scopeId);
|
|
2294
|
+
}
|
|
2295
|
+
supervision(scopeId) {
|
|
2296
|
+
return new ScopeSupervisionResource(this.http, this.config, scopeId);
|
|
2297
|
+
}
|
|
2298
|
+
list(options = {}) {
|
|
2299
|
+
const pageSize = options.pageSize ?? 25;
|
|
2300
|
+
validatePageSize(pageSize);
|
|
2301
|
+
return this.listPage(
|
|
2302
|
+
pageSize,
|
|
2303
|
+
options.pageToken,
|
|
2304
|
+
options.search,
|
|
2305
|
+
options.view,
|
|
2306
|
+
options.managerId
|
|
2307
|
+
);
|
|
2308
|
+
}
|
|
2309
|
+
async listPage(pageSize, pageToken, search, view, managerId) {
|
|
2310
|
+
const data = asRecord(
|
|
2311
|
+
await invokeWithRetry(this.config, this.http, this.ops.list, {
|
|
2312
|
+
query: scopesListParams(pageSize, pageToken, search, view, managerId)
|
|
2313
|
+
})
|
|
2314
|
+
);
|
|
2315
|
+
return buildAipPage(
|
|
2316
|
+
data,
|
|
2317
|
+
"skills",
|
|
2318
|
+
parseScope,
|
|
2319
|
+
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
2320
|
+
);
|
|
2321
|
+
}
|
|
2322
|
+
async get(scopeId, options = {}) {
|
|
2323
|
+
validateId(scopeId, "scope_id");
|
|
2324
|
+
const query = options.view !== void 0 ? { view: options.view } : void 0;
|
|
2325
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.get, {
|
|
2326
|
+
pathParams: { id: scopeId },
|
|
2327
|
+
query
|
|
2328
|
+
});
|
|
2329
|
+
return parseScope(data);
|
|
2330
|
+
}
|
|
2331
|
+
async create(options) {
|
|
2332
|
+
const body = omitUndefined({
|
|
2333
|
+
name: options.name,
|
|
2334
|
+
description: options.description,
|
|
2335
|
+
expectedOutput: options.expectedOutput,
|
|
2336
|
+
instructions: options.instructions,
|
|
2337
|
+
toolset: options.toolset,
|
|
2338
|
+
model: options.model,
|
|
2339
|
+
connectionSet: options.connectionSet,
|
|
2340
|
+
contextSelections: options.contextSelections,
|
|
2341
|
+
interfaces: options.interfaces,
|
|
2342
|
+
accessConfig: accessConfigBodyForCreate(options.guardrails)
|
|
2343
|
+
});
|
|
2344
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.create, {
|
|
2345
|
+
jsonBody: body
|
|
2346
|
+
});
|
|
2347
|
+
return parseScope(data);
|
|
2348
|
+
}
|
|
2349
|
+
async update(scopeId, options = {}) {
|
|
2350
|
+
validateId(scopeId, "scope_id");
|
|
2351
|
+
const accessConfig = await accessConfigBodyForUpdate(
|
|
2352
|
+
options.guardrails,
|
|
2353
|
+
async () => asRecord(
|
|
2354
|
+
await invokeWithRetry(this.config, this.http, this.ops.get, {
|
|
2355
|
+
pathParams: { id: scopeId }
|
|
2356
|
+
})
|
|
2357
|
+
)
|
|
2358
|
+
);
|
|
2359
|
+
const fields = {
|
|
2360
|
+
name: options.name,
|
|
2361
|
+
description: options.description,
|
|
2362
|
+
expectedOutput: options.expectedOutput,
|
|
2363
|
+
instructions: options.instructions,
|
|
2364
|
+
toolset: options.toolset,
|
|
2365
|
+
model: options.model,
|
|
2366
|
+
connectionSet: options.connectionSet,
|
|
2367
|
+
contextSelections: options.contextSelections,
|
|
2368
|
+
interfaces: options.interfaces,
|
|
2369
|
+
accessConfig,
|
|
2370
|
+
managerId: options.managerId,
|
|
2371
|
+
evaluations: options.evaluations,
|
|
2372
|
+
supervisionSubordinateDescriptions: options.supervisionSubordinateDescriptions
|
|
2373
|
+
};
|
|
2374
|
+
const body = options.updateMask !== void 0 ? fields : omitUndefined(fields);
|
|
2375
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.update, {
|
|
2376
|
+
pathParams: { id: scopeId },
|
|
2377
|
+
query: updateMaskQuery(options.updateMask),
|
|
2378
|
+
jsonBody: body
|
|
2379
|
+
});
|
|
2380
|
+
return parseScope(data);
|
|
2381
|
+
}
|
|
2382
|
+
async deploy(scopeId) {
|
|
2383
|
+
validateId(scopeId, "scope_id");
|
|
2384
|
+
const data = asRecord(
|
|
2385
|
+
await invokeWithRetry(this.config, this.http, this.ops.deploy, {
|
|
2386
|
+
pathParams: { id: scopeId },
|
|
2387
|
+
jsonBody: {}
|
|
2388
|
+
})
|
|
2389
|
+
);
|
|
2390
|
+
return parseScope(data.skill);
|
|
2391
|
+
}
|
|
2392
|
+
async delete(scopeId) {
|
|
2393
|
+
validateId(scopeId, "scope_id");
|
|
2394
|
+
await invokeWithRetry(this.config, this.http, this.ops.delete, {
|
|
2395
|
+
pathParams: { id: scopeId }
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
async restore(scopeId) {
|
|
2399
|
+
validateId(scopeId, "scope_id");
|
|
2400
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {
|
|
2401
|
+
pathParams: { id: scopeId },
|
|
2402
|
+
jsonBody: {}
|
|
2403
|
+
});
|
|
2404
|
+
return parseScope(data);
|
|
2405
|
+
}
|
|
2406
|
+
async requestOwnershipTransfer(scopeId, options) {
|
|
2407
|
+
validateId(scopeId, "scope_id");
|
|
2408
|
+
const data = await invokeWithRetry(
|
|
2409
|
+
this.config,
|
|
2410
|
+
this.http,
|
|
2411
|
+
this.ops.requestOwnershipTransfer,
|
|
2412
|
+
{
|
|
2413
|
+
pathParams: { id: scopeId },
|
|
2414
|
+
jsonBody: omitUndefined({ newOwnerUserId: options.newOwnerUserId })
|
|
2415
|
+
}
|
|
2416
|
+
);
|
|
2417
|
+
return parseScope(data);
|
|
2418
|
+
}
|
|
2419
|
+
async cancelOwnershipTransfer(scopeId) {
|
|
2420
|
+
validateId(scopeId, "scope_id");
|
|
2421
|
+
const data = await invokeWithRetry(
|
|
2422
|
+
this.config,
|
|
2423
|
+
this.http,
|
|
2424
|
+
this.ops.cancelOwnershipTransfer,
|
|
2425
|
+
{ pathParams: { id: scopeId } }
|
|
2426
|
+
);
|
|
2427
|
+
return parseScope(data);
|
|
2428
|
+
}
|
|
2429
|
+
async acceptOwnershipTransfer(scopeId) {
|
|
2430
|
+
validateId(scopeId, "scope_id");
|
|
2431
|
+
const data = await invokeWithRetry(
|
|
2432
|
+
this.config,
|
|
2433
|
+
this.http,
|
|
2434
|
+
this.ops.acceptOwnershipTransfer,
|
|
2435
|
+
{ pathParams: { id: scopeId }, jsonBody: {} }
|
|
2436
|
+
);
|
|
2437
|
+
return parseScope(data);
|
|
2438
|
+
}
|
|
2439
|
+
async patchMcpConfig(scopeId, options) {
|
|
2440
|
+
validateId(scopeId, "scope_id");
|
|
2441
|
+
await invokeWithRetry(this.config, this.http, this.ops.patchMcpConfig, {
|
|
2442
|
+
pathParams: { id: scopeId },
|
|
2443
|
+
jsonBody: omitUndefined({ config: options.mcpConfig })
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
async getVariation(scopeId, options) {
|
|
2447
|
+
validateId(scopeId, "scope_id");
|
|
2448
|
+
validateId(options.variationUid, "variation_uid");
|
|
2449
|
+
const data = await invokeWithRetry(this.config, this.http, this.ops.getVariation, {
|
|
2450
|
+
pathParams: { id: scopeId, variationUid: options.variationUid }
|
|
2451
|
+
});
|
|
2452
|
+
return parseScope(data);
|
|
2453
|
+
}
|
|
2454
|
+
};
|
|
2455
|
+
|
|
2456
|
+
// src/management/usage.ts
|
|
2457
|
+
var ManagementUsageResource = class {
|
|
2458
|
+
constructor(http, config) {
|
|
2459
|
+
this.http = http;
|
|
2460
|
+
this.config = config;
|
|
2461
|
+
}
|
|
2462
|
+
async list(options) {
|
|
2463
|
+
const query = {
|
|
2464
|
+
since: options.since,
|
|
2465
|
+
until: options.until,
|
|
2466
|
+
rollup: options.rollup
|
|
2467
|
+
};
|
|
2468
|
+
if (options.model !== void 0) query.model = options.model;
|
|
2469
|
+
const data = await invokeWithRetry(this.config, this.http, "UsageController_list", { query });
|
|
2470
|
+
return data;
|
|
2471
|
+
}
|
|
2472
|
+
};
|
|
2473
|
+
|
|
2474
|
+
// src/management/users.ts
|
|
2475
|
+
var ManagementUsersResource = class {
|
|
2476
|
+
constructor(http, config) {
|
|
2477
|
+
this.http = http;
|
|
2478
|
+
this.config = config;
|
|
2479
|
+
}
|
|
2480
|
+
async listMemberGroups() {
|
|
2481
|
+
const data = await invokeWithRetry(
|
|
2482
|
+
this.config,
|
|
2483
|
+
this.http,
|
|
2484
|
+
"MemberGroupsController_list"
|
|
2485
|
+
);
|
|
2486
|
+
return data.groups;
|
|
2487
|
+
}
|
|
2488
|
+
async listOrgMembers() {
|
|
2489
|
+
const data = await invokeWithRetry(
|
|
2490
|
+
this.config,
|
|
2491
|
+
this.http,
|
|
2492
|
+
"OrgMembersController_list"
|
|
2493
|
+
);
|
|
2494
|
+
return data.members;
|
|
2495
|
+
}
|
|
2496
|
+
};
|
|
2497
|
+
|
|
2498
|
+
// src/management/index.ts
|
|
2499
|
+
var ModusManagement = class extends ModusClientBase {
|
|
2500
|
+
constructor(options = {}) {
|
|
2501
|
+
super(options);
|
|
2502
|
+
this.scopes = new ManagementScopesResource(this.http, this.config);
|
|
2503
|
+
this.workflows = new ManagementWorkflowsResource(this.http, this.config);
|
|
2504
|
+
this.context = new ManagementContextResource(this.http, this.config);
|
|
2505
|
+
this.usage = new ManagementUsageResource(this.http, this.config);
|
|
2506
|
+
this.organization = new ManagementOrganizationResource(this.http, this.config);
|
|
2507
|
+
this.users = new ManagementUsersResource(this.http, this.config);
|
|
2508
|
+
}
|
|
2509
|
+
};
|
|
2510
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2511
|
+
0 && (module.exports = {
|
|
2512
|
+
ModusManagement
|
|
2513
|
+
});
|
|
2514
|
+
//# sourceMappingURL=index.cjs.map
|