@soat/cli 0.6.4 → 0.6.6
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/bin/soat +1 -1
- package/dist/{esm/index.js → index.mjs} +896 -292
- package/package.json +13 -13
|
@@ -1,65 +1,20 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
// src/index.ts
|
|
9
|
-
import { createHmac, timingSafeEqual } from "crypto";
|
|
10
|
-
import { createServer } from "http";
|
|
11
|
-
import * as nodePath from "path";
|
|
12
|
-
import { fileURLToPath } from "url";
|
|
2
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
3
|
+
import { createServer } from "node:http";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
13
6
|
import * as sdk from "@soat/sdk";
|
|
7
|
+
import { createClient, createConfig } from "@soat/sdk";
|
|
14
8
|
import { program } from "commander";
|
|
9
|
+
import * as fs from "node:fs";
|
|
10
|
+
import yaml from "js-yaml";
|
|
11
|
+
import * as os from "node:os";
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
name: "@soat/cli",
|
|
19
|
-
version: "0.6.4",
|
|
20
|
-
type: "module",
|
|
21
|
-
scripts: {
|
|
22
|
-
generate: "tsx scripts/generate.ts",
|
|
23
|
-
lint: "eslint src tests",
|
|
24
|
-
test: "jest --config tests/unit/jest.config.ts --coverage=false",
|
|
25
|
-
typecheck: "tsc --noEmit && tsc --noEmit -p tests/tsconfig.json",
|
|
26
|
-
build: "pnpm generate && tsup"
|
|
27
|
-
},
|
|
28
|
-
dependencies: {
|
|
29
|
-
"@inquirer/input": "^5.0.12",
|
|
30
|
-
"@inquirer/password": "^5.0.12",
|
|
31
|
-
"@soat/sdk": "workspace:*",
|
|
32
|
-
"@ttoss/logger": "^0.8.10",
|
|
33
|
-
commander: "^14.0.3",
|
|
34
|
-
"js-yaml": "^4.1.1"
|
|
35
|
-
},
|
|
36
|
-
devDependencies: {
|
|
37
|
-
"@ttoss/config": "^1.37.10",
|
|
38
|
-
"@ttoss/test-utils": "^4.2.10",
|
|
39
|
-
"@types/jest": "^30.0.0",
|
|
40
|
-
"@types/js-yaml": "^4.0.9",
|
|
41
|
-
"@types/node": "^24",
|
|
42
|
-
jest: "^30.3.0",
|
|
43
|
-
tsup: "^8.5.1",
|
|
44
|
-
tsx: "^4.21.0"
|
|
45
|
-
},
|
|
46
|
-
files: ["dist", "bin"],
|
|
47
|
-
repository: {
|
|
48
|
-
type: "git",
|
|
49
|
-
url: "https://github.com/ttoss/soat"
|
|
50
|
-
},
|
|
51
|
-
bin: {
|
|
52
|
-
soat: "./bin/soat"
|
|
53
|
-
},
|
|
54
|
-
publishConfig: {
|
|
55
|
-
access: "public",
|
|
56
|
-
provenance: true
|
|
57
|
-
}
|
|
58
|
-
};
|
|
13
|
+
//#region package.json
|
|
14
|
+
var version = "0.6.6";
|
|
59
15
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
import yaml from "js-yaml";
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/cli-wrappers/wrappers/formations.ts
|
|
63
18
|
var FORMATION_COMMANDS = ["validate-formation", "plan-formation", "create-formation", "update-formation"];
|
|
64
19
|
var TEMPLATE_PATH_FLAG = "template-path";
|
|
65
20
|
var TEMPLATE_FILE_FLAG = "template-file";
|
|
@@ -67,7 +22,7 @@ var ENV_FILE_FLAG = "env-file";
|
|
|
67
22
|
var PARAMETER_FLAG = "parameter";
|
|
68
23
|
var TEMPLATE_FIELD = "template";
|
|
69
24
|
var PARAMETERS_FIELD = "parameters";
|
|
70
|
-
var parseEnvFile =
|
|
25
|
+
var parseEnvFile = args => {
|
|
71
26
|
const {
|
|
72
27
|
envPath
|
|
73
28
|
} = args;
|
|
@@ -81,19 +36,17 @@ var parseEnvFile = /* @__PURE__ */__name(args => {
|
|
|
81
36
|
for (const rawLine of content.split(/\r?\n/)) {
|
|
82
37
|
const line = rawLine.trim();
|
|
83
38
|
if (!line || line.startsWith("#")) continue;
|
|
84
|
-
const withoutExport = line.startsWith("export ") ? line.slice(
|
|
39
|
+
const withoutExport = line.startsWith("export ") ? line.slice(7).trim() : line;
|
|
85
40
|
const eqIdx = withoutExport.indexOf("=");
|
|
86
41
|
if (eqIdx <= 0) continue;
|
|
87
42
|
const key = withoutExport.slice(0, eqIdx).trim();
|
|
88
43
|
let value = withoutExport.slice(eqIdx + 1).trim();
|
|
89
|
-
if (value.startsWith(
|
|
90
|
-
value = value.slice(1, -1);
|
|
91
|
-
}
|
|
44
|
+
if (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'")) value = value.slice(1, -1);
|
|
92
45
|
vars[key] = value;
|
|
93
46
|
}
|
|
94
47
|
return vars;
|
|
95
|
-
}
|
|
96
|
-
var readTemplateFromPath =
|
|
48
|
+
};
|
|
49
|
+
var readTemplateFromPath = args => {
|
|
97
50
|
const {
|
|
98
51
|
templatePath
|
|
99
52
|
} = args;
|
|
@@ -104,9 +57,7 @@ var readTemplateFromPath = /* @__PURE__ */__name(args => {
|
|
|
104
57
|
throw new Error(`Unable to read template file: ${templatePath}`);
|
|
105
58
|
}
|
|
106
59
|
const trimmed = content.trim();
|
|
107
|
-
if (!trimmed) {
|
|
108
|
-
throw new Error(`Template file is empty: ${templatePath}`);
|
|
109
|
-
}
|
|
60
|
+
if (!trimmed) throw new Error(`Template file is empty: ${templatePath}`);
|
|
110
61
|
try {
|
|
111
62
|
return JSON.parse(trimmed);
|
|
112
63
|
} catch {}
|
|
@@ -115,8 +66,8 @@ var readTemplateFromPath = /* @__PURE__ */__name(args => {
|
|
|
115
66
|
} catch {
|
|
116
67
|
throw new Error(`Template file must contain valid JSON or YAML: ${templatePath}`);
|
|
117
68
|
}
|
|
118
|
-
}
|
|
119
|
-
var resolveEnvRef =
|
|
69
|
+
};
|
|
70
|
+
var resolveEnvRef = args => {
|
|
120
71
|
const {
|
|
121
72
|
value,
|
|
122
73
|
env
|
|
@@ -124,57 +75,43 @@ var resolveEnvRef = /* @__PURE__ */__name(args => {
|
|
|
124
75
|
const atRef = /^@([A-Za-z_][A-Za-z0-9_]*)$/.exec(value);
|
|
125
76
|
if (atRef) {
|
|
126
77
|
const resolved = env[atRef[1]];
|
|
127
|
-
if (resolved === void 0) {
|
|
128
|
-
throw new Error(`Missing environment variable: ${atRef[1]}`);
|
|
129
|
-
}
|
|
78
|
+
if (resolved === void 0) throw new Error(`Missing environment variable: ${atRef[1]}`);
|
|
130
79
|
return resolved;
|
|
131
80
|
}
|
|
132
81
|
const simple = /^\$([A-Za-z_][A-Za-z0-9_]*)$/.exec(value);
|
|
133
82
|
if (simple) {
|
|
134
83
|
const resolved = env[simple[1]];
|
|
135
|
-
if (resolved === void 0) {
|
|
136
|
-
throw new Error(`Missing environment variable: ${simple[1]}`);
|
|
137
|
-
}
|
|
84
|
+
if (resolved === void 0) throw new Error(`Missing environment variable: ${simple[1]}`);
|
|
138
85
|
return resolved;
|
|
139
86
|
}
|
|
140
87
|
const bracketed = /^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/.exec(value);
|
|
141
88
|
if (bracketed) {
|
|
142
89
|
const resolved = env[bracketed[1]];
|
|
143
|
-
if (resolved === void 0) {
|
|
144
|
-
throw new Error(`Missing environment variable: ${bracketed[1]}`);
|
|
145
|
-
}
|
|
90
|
+
if (resolved === void 0) throw new Error(`Missing environment variable: ${bracketed[1]}`);
|
|
146
91
|
return resolved;
|
|
147
92
|
}
|
|
148
93
|
return value;
|
|
149
|
-
}
|
|
150
|
-
var resolveParameterPair =
|
|
94
|
+
};
|
|
95
|
+
var resolveParameterPair = args => {
|
|
151
96
|
const {
|
|
152
97
|
pair,
|
|
153
98
|
env
|
|
154
99
|
} = args;
|
|
155
100
|
const eqIdx = pair.indexOf("=");
|
|
156
|
-
if (eqIdx === 0) {
|
|
157
|
-
throw new Error(`Invalid --${PARAMETER_FLAG} value "${pair}". Parameter key cannot be empty.`);
|
|
158
|
-
}
|
|
101
|
+
if (eqIdx === 0) throw new Error(`Invalid --${PARAMETER_FLAG} value "${pair}". Parameter key cannot be empty.`);
|
|
159
102
|
if (eqIdx === -1) {
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
const resolved = env[key2];
|
|
165
|
-
if (resolved === void 0) {
|
|
166
|
-
throw new Error(`Missing environment variable: ${key2}`);
|
|
167
|
-
}
|
|
103
|
+
const key = pair.trim();
|
|
104
|
+
if (!key) throw new Error(`Invalid --${PARAMETER_FLAG} value "${pair}". Parameter key cannot be empty.`);
|
|
105
|
+
const resolved = env[key];
|
|
106
|
+
if (resolved === void 0) throw new Error(`Missing environment variable: ${key}`);
|
|
168
107
|
return {
|
|
169
|
-
key
|
|
108
|
+
key,
|
|
170
109
|
value: resolved
|
|
171
110
|
};
|
|
172
111
|
}
|
|
173
112
|
const key = pair.slice(0, eqIdx).trim();
|
|
174
113
|
const rawValue = pair.slice(eqIdx + 1);
|
|
175
|
-
if (!key) {
|
|
176
|
-
throw new Error(`Invalid --${PARAMETER_FLAG} value "${pair}". Parameter key cannot be empty.`);
|
|
177
|
-
}
|
|
114
|
+
if (!key) throw new Error(`Invalid --${PARAMETER_FLAG} value "${pair}". Parameter key cannot be empty.`);
|
|
178
115
|
return {
|
|
179
116
|
key,
|
|
180
117
|
value: resolveEnvRef({
|
|
@@ -182,7 +119,7 @@ var resolveParameterPair = /* @__PURE__ */__name(args => {
|
|
|
182
119
|
env
|
|
183
120
|
})
|
|
184
121
|
};
|
|
185
|
-
}
|
|
122
|
+
};
|
|
186
123
|
var formationsWrapper = {
|
|
187
124
|
id: "formations-wrapper",
|
|
188
125
|
commands: FORMATION_COMMANDS,
|
|
@@ -202,8 +139,7 @@ var formationsWrapper = {
|
|
|
202
139
|
required: false,
|
|
203
140
|
type: "string"
|
|
204
141
|
}],
|
|
205
|
-
|
|
206
|
-
apply: /* @__PURE__ */__name(({
|
|
142
|
+
apply: ({
|
|
207
143
|
context
|
|
208
144
|
}) => {
|
|
209
145
|
const forcedBody = {};
|
|
@@ -221,31 +157,21 @@ var formationsWrapper = {
|
|
|
221
157
|
const parametersInline = flags.single[PARAMETERS_FIELD];
|
|
222
158
|
const parameterValues = flags.repeated[PARAMETER_FLAG] ?? [];
|
|
223
159
|
const envFile = flags.single[ENV_FILE_FLAG];
|
|
224
|
-
if (templatePath && templateFile) {
|
|
225
|
-
throw new Error(`Use either --${TEMPLATE_PATH_FLAG} or --${TEMPLATE_FILE_FLAG}, not both.`);
|
|
226
|
-
}
|
|
160
|
+
if (templatePath && templateFile) throw new Error(`Use either --${TEMPLATE_PATH_FLAG} or --${TEMPLATE_FILE_FLAG}, not both.`);
|
|
227
161
|
const effectiveTemplatePath = templatePath ?? templateFile;
|
|
228
|
-
if (templateInline && effectiveTemplatePath) {
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
if (parametersInline && parameterValues.length > 0) {
|
|
232
|
-
throw new Error(`Use either --${PARAMETERS_FIELD} or repeatable --${PARAMETER_FLAG}, not both.`);
|
|
233
|
-
}
|
|
162
|
+
if (templateInline && effectiveTemplatePath) throw new Error(`Use either --${TEMPLATE_FIELD} or --${TEMPLATE_PATH_FLAG}, not both.`);
|
|
163
|
+
if (parametersInline && parameterValues.length > 0) throw new Error(`Use either --${PARAMETERS_FIELD} or repeatable --${PARAMETER_FLAG}, not both.`);
|
|
234
164
|
let envFileVars = {};
|
|
235
|
-
if (envFile) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
});
|
|
239
|
-
}
|
|
165
|
+
if (envFile) envFileVars = parseEnvFile({
|
|
166
|
+
envPath: envFile
|
|
167
|
+
});
|
|
240
168
|
const mergedEnv = {
|
|
241
169
|
...envFileVars,
|
|
242
170
|
...process.env
|
|
243
171
|
};
|
|
244
|
-
if (effectiveTemplatePath) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
});
|
|
248
|
-
}
|
|
172
|
+
if (effectiveTemplatePath) forcedBody[TEMPLATE_FIELD] = readTemplateFromPath({
|
|
173
|
+
templatePath: effectiveTemplatePath
|
|
174
|
+
});
|
|
249
175
|
if (parameterValues.length > 0) {
|
|
250
176
|
const resolvedParameters = {};
|
|
251
177
|
for (const pair of parameterValues) {
|
|
@@ -269,11 +195,12 @@ var formationsWrapper = {
|
|
|
269
195
|
flags,
|
|
270
196
|
forcedBody
|
|
271
197
|
};
|
|
272
|
-
}
|
|
198
|
+
}
|
|
273
199
|
};
|
|
274
200
|
|
|
275
|
-
|
|
276
|
-
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/cli-wrappers/flagParser.ts
|
|
203
|
+
var parseUnknownWithRepeats = args => {
|
|
277
204
|
const {
|
|
278
205
|
cliArgs
|
|
279
206
|
} = args;
|
|
@@ -286,40 +213,35 @@ var parseUnknownWithRepeats = /* @__PURE__ */__name(args => {
|
|
|
286
213
|
const hasInlineValue = inlineSplitIdx > 2;
|
|
287
214
|
const key = hasInlineValue ? arg.slice(2, inlineSplitIdx) : arg.slice(2);
|
|
288
215
|
let value;
|
|
289
|
-
if (hasInlineValue) {
|
|
290
|
-
value = arg.slice(inlineSplitIdx + 1);
|
|
291
|
-
} else {
|
|
216
|
+
if (hasInlineValue) value = arg.slice(inlineSplitIdx + 1);else {
|
|
292
217
|
const next = cliArgs[i + 1];
|
|
293
218
|
if (next !== void 0 && !next.startsWith("--")) {
|
|
294
219
|
value = next;
|
|
295
220
|
i++;
|
|
296
|
-
} else
|
|
297
|
-
value = "true";
|
|
298
|
-
}
|
|
221
|
+
} else value = "true";
|
|
299
222
|
}
|
|
300
223
|
single[key] = value;
|
|
301
|
-
if (!repeated[key])
|
|
302
|
-
repeated[key] = [];
|
|
303
|
-
}
|
|
224
|
+
if (!repeated[key]) repeated[key] = [];
|
|
304
225
|
repeated[key].push(value);
|
|
305
226
|
}
|
|
306
227
|
return {
|
|
307
228
|
single,
|
|
308
229
|
repeated
|
|
309
230
|
};
|
|
310
|
-
}
|
|
231
|
+
};
|
|
311
232
|
|
|
312
|
-
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/cli-wrappers/index.ts
|
|
313
235
|
var WRAPPERS = [formationsWrapper];
|
|
314
|
-
var resolveWrapperForCommand =
|
|
236
|
+
var resolveWrapperForCommand = args => {
|
|
315
237
|
const {
|
|
316
238
|
commandName
|
|
317
239
|
} = args;
|
|
318
240
|
return WRAPPERS.find(wrapper => {
|
|
319
241
|
return wrapper.commands.includes(commandName);
|
|
320
242
|
});
|
|
321
|
-
}
|
|
322
|
-
var applyWrapperForCommand =
|
|
243
|
+
};
|
|
244
|
+
var applyWrapperForCommand = args => {
|
|
323
245
|
const {
|
|
324
246
|
commandName,
|
|
325
247
|
route,
|
|
@@ -328,12 +250,10 @@ var applyWrapperForCommand = /* @__PURE__ */__name(args => {
|
|
|
328
250
|
const wrapper = resolveWrapperForCommand({
|
|
329
251
|
commandName
|
|
330
252
|
});
|
|
331
|
-
if (!wrapper) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
};
|
|
336
|
-
}
|
|
253
|
+
if (!wrapper) return {
|
|
254
|
+
flags: parsedFlags,
|
|
255
|
+
forcedBody: {}
|
|
256
|
+
};
|
|
337
257
|
return wrapper.apply({
|
|
338
258
|
context: {
|
|
339
259
|
commandName,
|
|
@@ -341,67 +261,57 @@ var applyWrapperForCommand = /* @__PURE__ */__name(args => {
|
|
|
341
261
|
parsedFlags
|
|
342
262
|
}
|
|
343
263
|
});
|
|
344
|
-
}
|
|
345
|
-
var getWrapperHelpFlags =
|
|
346
|
-
|
|
264
|
+
};
|
|
265
|
+
var getWrapperHelpFlags = commandName => {
|
|
266
|
+
return WRAPPERS.find(w => {
|
|
347
267
|
return w.commands.includes(commandName);
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
}, "getWrapperHelpFlags");
|
|
268
|
+
})?.helpFlags ?? [];
|
|
269
|
+
};
|
|
351
270
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
import * as os from "os";
|
|
355
|
-
import * as path from "path";
|
|
356
|
-
import { createClient, createConfig } from "@soat/sdk";
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/config.ts
|
|
357
273
|
var CONFIG_FILE = path.join(os.homedir(), ".soat", "config.json");
|
|
358
|
-
var readConfig =
|
|
274
|
+
var readConfig = () => {
|
|
359
275
|
try {
|
|
360
|
-
return JSON.parse(
|
|
276
|
+
return JSON.parse(fs.readFileSync(CONFIG_FILE, "utf8"));
|
|
361
277
|
} catch {
|
|
362
278
|
return {};
|
|
363
279
|
}
|
|
364
|
-
}
|
|
365
|
-
var writeProfile =
|
|
280
|
+
};
|
|
281
|
+
var writeProfile = (name, profile) => {
|
|
366
282
|
const config = readConfig();
|
|
367
283
|
config[name] = profile;
|
|
368
|
-
|
|
284
|
+
fs.mkdirSync(path.dirname(CONFIG_FILE), {
|
|
369
285
|
recursive: true
|
|
370
286
|
});
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
var resolveClient =
|
|
287
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
288
|
+
};
|
|
289
|
+
var resolveClient = profileName => {
|
|
374
290
|
const envBaseUrl = process.env["SOAT_BASE_URL"];
|
|
375
291
|
const envToken = process.env["SOAT_TOKEN"];
|
|
376
|
-
if (envBaseUrl && envToken) {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}));
|
|
383
|
-
}
|
|
292
|
+
if (envBaseUrl && envToken) return createClient(createConfig({
|
|
293
|
+
baseUrl: envBaseUrl,
|
|
294
|
+
headers: {
|
|
295
|
+
Authorization: `Bearer ${envToken}`
|
|
296
|
+
}
|
|
297
|
+
}));
|
|
384
298
|
const name = profileName ?? process.env["SOAT_PROFILE"] ?? "default";
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
if (envBaseUrl) {
|
|
396
|
-
return createClient(createConfig({
|
|
397
|
-
baseUrl: envBaseUrl
|
|
398
|
-
}));
|
|
399
|
-
}
|
|
299
|
+
const profile = readConfig()[name];
|
|
300
|
+
if (profile) return createClient(createConfig({
|
|
301
|
+
baseUrl: envBaseUrl ?? profile.baseUrl,
|
|
302
|
+
headers: {
|
|
303
|
+
Authorization: `Bearer ${profile.token}`
|
|
304
|
+
}
|
|
305
|
+
}));
|
|
306
|
+
if (envBaseUrl) return createClient(createConfig({
|
|
307
|
+
baseUrl: envBaseUrl
|
|
308
|
+
}));
|
|
400
309
|
console.error(`Profile "${name}" not found. Run: soat configure${name !== "default" ? ` --profile ${name}` : ""}`);
|
|
401
310
|
process.exit(1);
|
|
402
|
-
}
|
|
311
|
+
};
|
|
403
312
|
|
|
404
|
-
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/generated/routes.ts
|
|
405
315
|
var routes = {
|
|
406
316
|
"list-actors": {
|
|
407
317
|
serviceClass: "Actors",
|
|
@@ -457,7 +367,7 @@ var routes = {
|
|
|
457
367
|
"in": "body"
|
|
458
368
|
}, {
|
|
459
369
|
"name": "external_id",
|
|
460
|
-
"description": "Optional external identifier (e.g. WhatsApp phone number). If provided and an actor with this externalId already exists in the project, the existing actor is returned (idempotent
|
|
370
|
+
"description": "Optional external identifier (e.g. WhatsApp phone number). If provided and an actor with this externalId already exists in the project, the existing actor is returned (idempotent — 200 OK).",
|
|
461
371
|
"required": false,
|
|
462
372
|
"type": "string",
|
|
463
373
|
"in": "body"
|
|
@@ -611,7 +521,103 @@ var routes = {
|
|
|
611
521
|
moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/agents",
|
|
612
522
|
pathParams: [],
|
|
613
523
|
queryParams: [],
|
|
614
|
-
flags: [
|
|
524
|
+
flags: [{
|
|
525
|
+
"name": "project_id",
|
|
526
|
+
"description": "Public ID of the project",
|
|
527
|
+
"required": false,
|
|
528
|
+
"type": "string",
|
|
529
|
+
"in": "body"
|
|
530
|
+
}, {
|
|
531
|
+
"name": "ai_provider_id",
|
|
532
|
+
"description": "Public ID of the AI provider",
|
|
533
|
+
"required": true,
|
|
534
|
+
"type": "string",
|
|
535
|
+
"in": "body"
|
|
536
|
+
}, {
|
|
537
|
+
"name": "name",
|
|
538
|
+
"description": "",
|
|
539
|
+
"required": false,
|
|
540
|
+
"type": "string",
|
|
541
|
+
"in": "body"
|
|
542
|
+
}, {
|
|
543
|
+
"name": "instructions",
|
|
544
|
+
"description": "",
|
|
545
|
+
"required": false,
|
|
546
|
+
"type": "string",
|
|
547
|
+
"in": "body"
|
|
548
|
+
}, {
|
|
549
|
+
"name": "model",
|
|
550
|
+
"description": "",
|
|
551
|
+
"required": false,
|
|
552
|
+
"type": "string",
|
|
553
|
+
"in": "body"
|
|
554
|
+
}, {
|
|
555
|
+
"name": "tool_ids",
|
|
556
|
+
"description": "",
|
|
557
|
+
"required": false,
|
|
558
|
+
"type": "array",
|
|
559
|
+
"in": "body"
|
|
560
|
+
}, {
|
|
561
|
+
"name": "max_steps",
|
|
562
|
+
"description": "",
|
|
563
|
+
"required": false,
|
|
564
|
+
"type": "integer",
|
|
565
|
+
"in": "body"
|
|
566
|
+
}, {
|
|
567
|
+
"name": "tool_choice",
|
|
568
|
+
"description": "",
|
|
569
|
+
"required": false,
|
|
570
|
+
"type": "object",
|
|
571
|
+
"in": "body"
|
|
572
|
+
}, {
|
|
573
|
+
"name": "stop_conditions",
|
|
574
|
+
"description": "",
|
|
575
|
+
"required": false,
|
|
576
|
+
"type": "array",
|
|
577
|
+
"in": "body"
|
|
578
|
+
}, {
|
|
579
|
+
"name": "active_tool_ids",
|
|
580
|
+
"description": "",
|
|
581
|
+
"required": false,
|
|
582
|
+
"type": "array",
|
|
583
|
+
"in": "body"
|
|
584
|
+
}, {
|
|
585
|
+
"name": "step_rules",
|
|
586
|
+
"description": "",
|
|
587
|
+
"required": false,
|
|
588
|
+
"type": "array",
|
|
589
|
+
"in": "body"
|
|
590
|
+
}, {
|
|
591
|
+
"name": "boundary_policy",
|
|
592
|
+
"description": "",
|
|
593
|
+
"required": false,
|
|
594
|
+
"type": "object",
|
|
595
|
+
"in": "body"
|
|
596
|
+
}, {
|
|
597
|
+
"name": "temperature",
|
|
598
|
+
"description": "",
|
|
599
|
+
"required": false,
|
|
600
|
+
"type": "number",
|
|
601
|
+
"in": "body"
|
|
602
|
+
}, {
|
|
603
|
+
"name": "knowledge_config",
|
|
604
|
+
"description": "",
|
|
605
|
+
"required": false,
|
|
606
|
+
"type": "object",
|
|
607
|
+
"in": "body"
|
|
608
|
+
}, {
|
|
609
|
+
"name": "max_context_messages",
|
|
610
|
+
"description": "Maximum number of recent messages included in the context window. Null means no limit.",
|
|
611
|
+
"required": false,
|
|
612
|
+
"type": "integer",
|
|
613
|
+
"in": "body"
|
|
614
|
+
}, {
|
|
615
|
+
"name": "single_session_per_actor",
|
|
616
|
+
"description": "When true, only one open session per actor_id is allowed for this agent.",
|
|
617
|
+
"required": false,
|
|
618
|
+
"type": "boolean",
|
|
619
|
+
"in": "body"
|
|
620
|
+
}]
|
|
615
621
|
},
|
|
616
622
|
"get-agent": {
|
|
617
623
|
serviceClass: "Agents",
|
|
@@ -641,6 +647,96 @@ var routes = {
|
|
|
641
647
|
"required": true,
|
|
642
648
|
"type": "string",
|
|
643
649
|
"in": "path"
|
|
650
|
+
}, {
|
|
651
|
+
"name": "ai_provider_id",
|
|
652
|
+
"description": "",
|
|
653
|
+
"required": false,
|
|
654
|
+
"type": "string",
|
|
655
|
+
"in": "body"
|
|
656
|
+
}, {
|
|
657
|
+
"name": "name",
|
|
658
|
+
"description": "",
|
|
659
|
+
"required": false,
|
|
660
|
+
"type": "string",
|
|
661
|
+
"in": "body"
|
|
662
|
+
}, {
|
|
663
|
+
"name": "instructions",
|
|
664
|
+
"description": "",
|
|
665
|
+
"required": false,
|
|
666
|
+
"type": "string",
|
|
667
|
+
"in": "body"
|
|
668
|
+
}, {
|
|
669
|
+
"name": "model",
|
|
670
|
+
"description": "",
|
|
671
|
+
"required": false,
|
|
672
|
+
"type": "string",
|
|
673
|
+
"in": "body"
|
|
674
|
+
}, {
|
|
675
|
+
"name": "tool_ids",
|
|
676
|
+
"description": "",
|
|
677
|
+
"required": false,
|
|
678
|
+
"type": "array",
|
|
679
|
+
"in": "body"
|
|
680
|
+
}, {
|
|
681
|
+
"name": "max_steps",
|
|
682
|
+
"description": "",
|
|
683
|
+
"required": false,
|
|
684
|
+
"type": "integer",
|
|
685
|
+
"in": "body"
|
|
686
|
+
}, {
|
|
687
|
+
"name": "tool_choice",
|
|
688
|
+
"description": "",
|
|
689
|
+
"required": false,
|
|
690
|
+
"type": "object",
|
|
691
|
+
"in": "body"
|
|
692
|
+
}, {
|
|
693
|
+
"name": "stop_conditions",
|
|
694
|
+
"description": "",
|
|
695
|
+
"required": false,
|
|
696
|
+
"type": "array",
|
|
697
|
+
"in": "body"
|
|
698
|
+
}, {
|
|
699
|
+
"name": "active_tool_ids",
|
|
700
|
+
"description": "",
|
|
701
|
+
"required": false,
|
|
702
|
+
"type": "array",
|
|
703
|
+
"in": "body"
|
|
704
|
+
}, {
|
|
705
|
+
"name": "step_rules",
|
|
706
|
+
"description": "",
|
|
707
|
+
"required": false,
|
|
708
|
+
"type": "array",
|
|
709
|
+
"in": "body"
|
|
710
|
+
}, {
|
|
711
|
+
"name": "boundary_policy",
|
|
712
|
+
"description": "",
|
|
713
|
+
"required": false,
|
|
714
|
+
"type": "object",
|
|
715
|
+
"in": "body"
|
|
716
|
+
}, {
|
|
717
|
+
"name": "temperature",
|
|
718
|
+
"description": "",
|
|
719
|
+
"required": false,
|
|
720
|
+
"type": "number",
|
|
721
|
+
"in": "body"
|
|
722
|
+
}, {
|
|
723
|
+
"name": "knowledge_config",
|
|
724
|
+
"description": "",
|
|
725
|
+
"required": false,
|
|
726
|
+
"type": "object",
|
|
727
|
+
"in": "body"
|
|
728
|
+
}, {
|
|
729
|
+
"name": "max_context_messages",
|
|
730
|
+
"description": "Maximum number of recent messages included in the context window. Null means no limit.",
|
|
731
|
+
"required": false,
|
|
732
|
+
"type": "integer",
|
|
733
|
+
"in": "body"
|
|
734
|
+
}, {
|
|
735
|
+
"name": "single_session_per_actor",
|
|
736
|
+
"description": "When true, only one open session per actor_id is allowed for this agent.",
|
|
737
|
+
"required": false,
|
|
738
|
+
"type": "boolean",
|
|
739
|
+
"in": "body"
|
|
644
740
|
}]
|
|
645
741
|
},
|
|
646
742
|
"delete-agent": {
|
|
@@ -671,6 +767,48 @@ var routes = {
|
|
|
671
767
|
"required": true,
|
|
672
768
|
"type": "string",
|
|
673
769
|
"in": "path"
|
|
770
|
+
}, {
|
|
771
|
+
"name": "messages",
|
|
772
|
+
"description": "",
|
|
773
|
+
"required": true,
|
|
774
|
+
"type": "array",
|
|
775
|
+
"in": "body"
|
|
776
|
+
}, {
|
|
777
|
+
"name": "stream",
|
|
778
|
+
"description": "When true the response is an SSE stream",
|
|
779
|
+
"required": false,
|
|
780
|
+
"type": "boolean",
|
|
781
|
+
"in": "body"
|
|
782
|
+
}, {
|
|
783
|
+
"name": "trace_id",
|
|
784
|
+
"description": "Optional trace ID to group generations",
|
|
785
|
+
"required": false,
|
|
786
|
+
"type": "string",
|
|
787
|
+
"in": "body"
|
|
788
|
+
}, {
|
|
789
|
+
"name": "parent_trace_id",
|
|
790
|
+
"description": "The trace ID of the parent agent generation that triggered this one (for agent-to-agent calls)",
|
|
791
|
+
"required": false,
|
|
792
|
+
"type": "string",
|
|
793
|
+
"in": "body"
|
|
794
|
+
}, {
|
|
795
|
+
"name": "root_trace_id",
|
|
796
|
+
"description": "The trace ID of the root generation in the call chain; if omitted, this generation is the root",
|
|
797
|
+
"required": false,
|
|
798
|
+
"type": "string",
|
|
799
|
+
"in": "body"
|
|
800
|
+
}, {
|
|
801
|
+
"name": "max_call_depth",
|
|
802
|
+
"description": "Maximum nested agent-call depth; 0 short-circuits with a depth-guard response",
|
|
803
|
+
"required": false,
|
|
804
|
+
"type": "integer",
|
|
805
|
+
"in": "body"
|
|
806
|
+
}, {
|
|
807
|
+
"name": "tool_context",
|
|
808
|
+
"description": "Key-value pairs injected as context headers into all tool call requests made during this generation.",
|
|
809
|
+
"required": false,
|
|
810
|
+
"type": "object",
|
|
811
|
+
"in": "body"
|
|
674
812
|
}]
|
|
675
813
|
},
|
|
676
814
|
"submit-agent-tool-outputs": {
|
|
@@ -692,6 +830,12 @@ var routes = {
|
|
|
692
830
|
"required": true,
|
|
693
831
|
"type": "string",
|
|
694
832
|
"in": "path"
|
|
833
|
+
}, {
|
|
834
|
+
"name": "tool_outputs",
|
|
835
|
+
"description": "",
|
|
836
|
+
"required": true,
|
|
837
|
+
"type": "array",
|
|
838
|
+
"in": "body"
|
|
695
839
|
}]
|
|
696
840
|
},
|
|
697
841
|
"create-agent-actor": {
|
|
@@ -1007,7 +1151,37 @@ var routes = {
|
|
|
1007
1151
|
moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/chats",
|
|
1008
1152
|
pathParams: [],
|
|
1009
1153
|
queryParams: [],
|
|
1010
|
-
flags: [
|
|
1154
|
+
flags: [{
|
|
1155
|
+
"name": "ai_provider_id",
|
|
1156
|
+
"description": "Public ID of the AI provider",
|
|
1157
|
+
"required": true,
|
|
1158
|
+
"type": "string",
|
|
1159
|
+
"in": "body"
|
|
1160
|
+
}, {
|
|
1161
|
+
"name": "project_id",
|
|
1162
|
+
"description": "Public ID of the project. Required when the user belongs to multiple projects and no project key is used.\n",
|
|
1163
|
+
"required": false,
|
|
1164
|
+
"type": "string",
|
|
1165
|
+
"in": "body"
|
|
1166
|
+
}, {
|
|
1167
|
+
"name": "name",
|
|
1168
|
+
"description": "Optional human-readable name",
|
|
1169
|
+
"required": false,
|
|
1170
|
+
"type": "string",
|
|
1171
|
+
"in": "body"
|
|
1172
|
+
}, {
|
|
1173
|
+
"name": "system_message",
|
|
1174
|
+
"description": "Optional system message applied to all completions on this chat",
|
|
1175
|
+
"required": false,
|
|
1176
|
+
"type": "string",
|
|
1177
|
+
"in": "body"
|
|
1178
|
+
}, {
|
|
1179
|
+
"name": "model",
|
|
1180
|
+
"description": "Optional default model override",
|
|
1181
|
+
"required": false,
|
|
1182
|
+
"type": "string",
|
|
1183
|
+
"in": "body"
|
|
1184
|
+
}]
|
|
1011
1185
|
},
|
|
1012
1186
|
"get-chat": {
|
|
1013
1187
|
serviceClass: "Chats",
|
|
@@ -1052,16 +1226,58 @@ var routes = {
|
|
|
1052
1226
|
"required": true,
|
|
1053
1227
|
"type": "string",
|
|
1054
1228
|
"in": "path"
|
|
1229
|
+
}, {
|
|
1230
|
+
"name": "messages",
|
|
1231
|
+
"description": "",
|
|
1232
|
+
"required": true,
|
|
1233
|
+
"type": "array",
|
|
1234
|
+
"in": "body"
|
|
1235
|
+
}, {
|
|
1236
|
+
"name": "model",
|
|
1237
|
+
"description": "Override the chat's default model for this call",
|
|
1238
|
+
"required": false,
|
|
1239
|
+
"type": "string",
|
|
1240
|
+
"in": "body"
|
|
1241
|
+
}, {
|
|
1242
|
+
"name": "stream",
|
|
1243
|
+
"description": "When `true` the response is an SSE stream.",
|
|
1244
|
+
"required": false,
|
|
1245
|
+
"type": "boolean",
|
|
1246
|
+
"in": "body"
|
|
1055
1247
|
}]
|
|
1056
1248
|
},
|
|
1057
1249
|
"create-chat-completion": {
|
|
1058
1250
|
serviceClass: "Chats",
|
|
1059
1251
|
operationId: "createChatCompletion",
|
|
1060
|
-
description: "OpenAI Chat Completions-compatible endpoint. Resolves the AI provider from `ai_provider_id`, decrypts its secret, and calls the appropriate Vercel AI SDK provider. `ai_provider_id` is required
|
|
1252
|
+
description: "OpenAI Chat Completions-compatible endpoint. Resolves the AI provider from `ai_provider_id`, decrypts its secret, and calls the appropriate Vercel AI SDK provider. `ai_provider_id` is required — there is no server-side model fallback.",
|
|
1061
1253
|
moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/chats",
|
|
1062
1254
|
pathParams: [],
|
|
1063
1255
|
queryParams: [],
|
|
1064
|
-
flags: [
|
|
1256
|
+
flags: [{
|
|
1257
|
+
"name": "ai_provider_id",
|
|
1258
|
+
"description": "Public ID of the AI provider to use.",
|
|
1259
|
+
"required": true,
|
|
1260
|
+
"type": "string",
|
|
1261
|
+
"in": "body"
|
|
1262
|
+
}, {
|
|
1263
|
+
"name": "model",
|
|
1264
|
+
"description": "Model identifier. Overrides the provider's `default_model` when specified.\n",
|
|
1265
|
+
"required": false,
|
|
1266
|
+
"type": "string",
|
|
1267
|
+
"in": "body"
|
|
1268
|
+
}, {
|
|
1269
|
+
"name": "messages",
|
|
1270
|
+
"description": "Ordered list of chat messages",
|
|
1271
|
+
"required": true,
|
|
1272
|
+
"type": "array",
|
|
1273
|
+
"in": "body"
|
|
1274
|
+
}, {
|
|
1275
|
+
"name": "stream",
|
|
1276
|
+
"description": "When `true` the response is an SSE stream of delta chunks. When `false` (default) a single JSON object is returned.\n",
|
|
1277
|
+
"required": false,
|
|
1278
|
+
"type": "boolean",
|
|
1279
|
+
"in": "body"
|
|
1280
|
+
}]
|
|
1065
1281
|
},
|
|
1066
1282
|
"create-chat-actor": {
|
|
1067
1283
|
serviceClass: "Chats",
|
|
@@ -1318,7 +1534,7 @@ var routes = {
|
|
|
1318
1534
|
"in": "body"
|
|
1319
1535
|
}, {
|
|
1320
1536
|
"name": "stream",
|
|
1321
|
-
"description": "If true, stream tokens via SSE. NOT IMPLEMENTED in v1
|
|
1537
|
+
"description": "If true, stream tokens via SSE. NOT IMPLEMENTED in v1 — returns 501.",
|
|
1322
1538
|
"required": false,
|
|
1323
1539
|
"type": "boolean",
|
|
1324
1540
|
"in": "body"
|
|
@@ -1679,7 +1895,43 @@ var routes = {
|
|
|
1679
1895
|
moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/files",
|
|
1680
1896
|
pathParams: [],
|
|
1681
1897
|
queryParams: [],
|
|
1682
|
-
flags: [
|
|
1898
|
+
flags: [{
|
|
1899
|
+
"name": "project_id",
|
|
1900
|
+
"description": "Public ID of the project",
|
|
1901
|
+
"required": true,
|
|
1902
|
+
"type": "string",
|
|
1903
|
+
"in": "body"
|
|
1904
|
+
}, {
|
|
1905
|
+
"name": "content",
|
|
1906
|
+
"description": "Base64-encoded file content",
|
|
1907
|
+
"required": true,
|
|
1908
|
+
"type": "string",
|
|
1909
|
+
"in": "body"
|
|
1910
|
+
}, {
|
|
1911
|
+
"name": "filename",
|
|
1912
|
+
"description": "Name of the file",
|
|
1913
|
+
"required": false,
|
|
1914
|
+
"type": "string",
|
|
1915
|
+
"in": "body"
|
|
1916
|
+
}, {
|
|
1917
|
+
"name": "path",
|
|
1918
|
+
"description": "Logical path within the project (e.g. /images/logo.png). Defaults to /filename if omitted.",
|
|
1919
|
+
"required": false,
|
|
1920
|
+
"type": "string",
|
|
1921
|
+
"in": "body"
|
|
1922
|
+
}, {
|
|
1923
|
+
"name": "content_type",
|
|
1924
|
+
"description": "MIME type of the file",
|
|
1925
|
+
"required": false,
|
|
1926
|
+
"type": "string",
|
|
1927
|
+
"in": "body"
|
|
1928
|
+
}, {
|
|
1929
|
+
"name": "metadata",
|
|
1930
|
+
"description": "JSON string with additional metadata",
|
|
1931
|
+
"required": false,
|
|
1932
|
+
"type": "string",
|
|
1933
|
+
"in": "body"
|
|
1934
|
+
}]
|
|
1683
1935
|
},
|
|
1684
1936
|
"get-file": {
|
|
1685
1937
|
serviceClass: "Files",
|
|
@@ -2014,7 +2266,7 @@ var routes = {
|
|
|
2014
2266
|
"in": "body"
|
|
2015
2267
|
}, {
|
|
2016
2268
|
"name": "min_score",
|
|
2017
|
-
"description": "Minimum similarity score (0
|
|
2269
|
+
"description": "Minimum similarity score (0–1). Results with lower scores are excluded. Only applies when `query` is provided.",
|
|
2018
2270
|
"required": false,
|
|
2019
2271
|
"type": "number",
|
|
2020
2272
|
"in": "body"
|
|
@@ -2065,7 +2317,7 @@ var routes = {
|
|
|
2065
2317
|
"in": "query"
|
|
2066
2318
|
}, {
|
|
2067
2319
|
"name": "tags",
|
|
2068
|
-
"description": "Filter memories by tag patterns. Supports glob syntax (`*` matches any substring, `?` matches any single character). Multiple values are ORed
|
|
2320
|
+
"description": "Filter memories by tag patterns. Supports glob syntax (`*` matches any substring, `?` matches any single character). Multiple values are ORed — a memory is returned if any of its tags match any of the provided patterns. Omit to return all memories.\n",
|
|
2069
2321
|
"required": false,
|
|
2070
2322
|
"type": "array",
|
|
2071
2323
|
"in": "query"
|
|
@@ -2312,7 +2564,49 @@ var routes = {
|
|
|
2312
2564
|
moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/orchestrations",
|
|
2313
2565
|
pathParams: [],
|
|
2314
2566
|
queryParams: [],
|
|
2315
|
-
flags: [
|
|
2567
|
+
flags: [{
|
|
2568
|
+
"name": "project_id",
|
|
2569
|
+
"description": "Public ID of the project.",
|
|
2570
|
+
"required": true,
|
|
2571
|
+
"type": "string",
|
|
2572
|
+
"in": "body"
|
|
2573
|
+
}, {
|
|
2574
|
+
"name": "name",
|
|
2575
|
+
"description": "Human-readable name.",
|
|
2576
|
+
"required": true,
|
|
2577
|
+
"type": "string",
|
|
2578
|
+
"in": "body"
|
|
2579
|
+
}, {
|
|
2580
|
+
"name": "description",
|
|
2581
|
+
"description": "",
|
|
2582
|
+
"required": false,
|
|
2583
|
+
"type": "string",
|
|
2584
|
+
"in": "body"
|
|
2585
|
+
}, {
|
|
2586
|
+
"name": "nodes",
|
|
2587
|
+
"description": "",
|
|
2588
|
+
"required": true,
|
|
2589
|
+
"type": "array",
|
|
2590
|
+
"in": "body"
|
|
2591
|
+
}, {
|
|
2592
|
+
"name": "edges",
|
|
2593
|
+
"description": "",
|
|
2594
|
+
"required": true,
|
|
2595
|
+
"type": "array",
|
|
2596
|
+
"in": "body"
|
|
2597
|
+
}, {
|
|
2598
|
+
"name": "state_schema",
|
|
2599
|
+
"description": "",
|
|
2600
|
+
"required": false,
|
|
2601
|
+
"type": "object",
|
|
2602
|
+
"in": "body"
|
|
2603
|
+
}, {
|
|
2604
|
+
"name": "input_schema",
|
|
2605
|
+
"description": "",
|
|
2606
|
+
"required": false,
|
|
2607
|
+
"type": "object",
|
|
2608
|
+
"in": "body"
|
|
2609
|
+
}]
|
|
2316
2610
|
},
|
|
2317
2611
|
"get-orchestration": {
|
|
2318
2612
|
serviceClass: "Orchestrations",
|
|
@@ -2342,6 +2636,42 @@ var routes = {
|
|
|
2342
2636
|
"required": true,
|
|
2343
2637
|
"type": "string",
|
|
2344
2638
|
"in": "path"
|
|
2639
|
+
}, {
|
|
2640
|
+
"name": "name",
|
|
2641
|
+
"description": "",
|
|
2642
|
+
"required": false,
|
|
2643
|
+
"type": "string",
|
|
2644
|
+
"in": "body"
|
|
2645
|
+
}, {
|
|
2646
|
+
"name": "description",
|
|
2647
|
+
"description": "",
|
|
2648
|
+
"required": false,
|
|
2649
|
+
"type": "string",
|
|
2650
|
+
"in": "body"
|
|
2651
|
+
}, {
|
|
2652
|
+
"name": "nodes",
|
|
2653
|
+
"description": "",
|
|
2654
|
+
"required": false,
|
|
2655
|
+
"type": "array",
|
|
2656
|
+
"in": "body"
|
|
2657
|
+
}, {
|
|
2658
|
+
"name": "edges",
|
|
2659
|
+
"description": "",
|
|
2660
|
+
"required": false,
|
|
2661
|
+
"type": "array",
|
|
2662
|
+
"in": "body"
|
|
2663
|
+
}, {
|
|
2664
|
+
"name": "state_schema",
|
|
2665
|
+
"description": "",
|
|
2666
|
+
"required": false,
|
|
2667
|
+
"type": "object",
|
|
2668
|
+
"in": "body"
|
|
2669
|
+
}, {
|
|
2670
|
+
"name": "input_schema",
|
|
2671
|
+
"description": "",
|
|
2672
|
+
"required": false,
|
|
2673
|
+
"type": "object",
|
|
2674
|
+
"in": "body"
|
|
2345
2675
|
}]
|
|
2346
2676
|
},
|
|
2347
2677
|
"delete-orchestration": {
|
|
@@ -2387,6 +2717,12 @@ var routes = {
|
|
|
2387
2717
|
"required": true,
|
|
2388
2718
|
"type": "string",
|
|
2389
2719
|
"in": "path"
|
|
2720
|
+
}, {
|
|
2721
|
+
"name": "input",
|
|
2722
|
+
"description": "Initial state for the run (merged with orchestration defaults).",
|
|
2723
|
+
"required": false,
|
|
2724
|
+
"type": "object",
|
|
2725
|
+
"in": "body"
|
|
2390
2726
|
}]
|
|
2391
2727
|
},
|
|
2392
2728
|
"cancel-orchestration-run": {
|
|
@@ -2429,6 +2765,18 @@ var routes = {
|
|
|
2429
2765
|
"required": true,
|
|
2430
2766
|
"type": "string",
|
|
2431
2767
|
"in": "path"
|
|
2768
|
+
}, {
|
|
2769
|
+
"name": "node_id",
|
|
2770
|
+
"description": "ID of the human node to satisfy.",
|
|
2771
|
+
"required": true,
|
|
2772
|
+
"type": "string",
|
|
2773
|
+
"in": "body"
|
|
2774
|
+
}, {
|
|
2775
|
+
"name": "output",
|
|
2776
|
+
"description": "Output/response provided by the human reviewer.",
|
|
2777
|
+
"required": false,
|
|
2778
|
+
"type": "object",
|
|
2779
|
+
"in": "body"
|
|
2432
2780
|
}]
|
|
2433
2781
|
},
|
|
2434
2782
|
"resume-orchestration-run": {
|
|
@@ -2764,22 +3112,52 @@ var routes = {
|
|
|
2764
3112
|
"description": "",
|
|
2765
3113
|
"required": false,
|
|
2766
3114
|
"type": "integer",
|
|
2767
|
-
"in": "query"
|
|
2768
|
-
}]
|
|
2769
|
-
},
|
|
2770
|
-
"create-agent-session": {
|
|
2771
|
-
serviceClass: "Sessions",
|
|
2772
|
-
operationId: "createAgentSession",
|
|
2773
|
-
description: "Creates a new session for the specified agent. Internally creates a conversation and two actors (agent + user) so the caller only needs this single call to start interacting with the agent.",
|
|
2774
|
-
moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/sessions",
|
|
2775
|
-
pathParams: ["agent_id"],
|
|
2776
|
-
queryParams: [],
|
|
2777
|
-
flags: [{
|
|
2778
|
-
"name": "agent_id",
|
|
2779
|
-
"description": "Agent public ID",
|
|
2780
|
-
"required": true,
|
|
2781
|
-
"type": "string",
|
|
2782
|
-
"in": "path"
|
|
3115
|
+
"in": "query"
|
|
3116
|
+
}]
|
|
3117
|
+
},
|
|
3118
|
+
"create-agent-session": {
|
|
3119
|
+
serviceClass: "Sessions",
|
|
3120
|
+
operationId: "createAgentSession",
|
|
3121
|
+
description: "Creates a new session for the specified agent. Internally creates a conversation and two actors (agent + user) so the caller only needs this single call to start interacting with the agent.",
|
|
3122
|
+
moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/sessions",
|
|
3123
|
+
pathParams: ["agent_id"],
|
|
3124
|
+
queryParams: [],
|
|
3125
|
+
flags: [{
|
|
3126
|
+
"name": "agent_id",
|
|
3127
|
+
"description": "Agent public ID",
|
|
3128
|
+
"required": true,
|
|
3129
|
+
"type": "string",
|
|
3130
|
+
"in": "path"
|
|
3131
|
+
}, {
|
|
3132
|
+
"name": "name",
|
|
3133
|
+
"description": "Optional session name",
|
|
3134
|
+
"required": false,
|
|
3135
|
+
"type": "string",
|
|
3136
|
+
"in": "body"
|
|
3137
|
+
}, {
|
|
3138
|
+
"name": "actor_id",
|
|
3139
|
+
"description": "Optional public ID of an existing actor to use as the user actor",
|
|
3140
|
+
"required": false,
|
|
3141
|
+
"type": "string",
|
|
3142
|
+
"in": "body"
|
|
3143
|
+
}, {
|
|
3144
|
+
"name": "auto_generate",
|
|
3145
|
+
"description": "When true, automatically triggers generation after each user message.",
|
|
3146
|
+
"required": false,
|
|
3147
|
+
"type": "boolean",
|
|
3148
|
+
"in": "body"
|
|
3149
|
+
}, {
|
|
3150
|
+
"name": "tool_context",
|
|
3151
|
+
"description": "Key-value pairs injected as context headers into all tool call requests made during this session.",
|
|
3152
|
+
"required": false,
|
|
3153
|
+
"type": "object",
|
|
3154
|
+
"in": "body"
|
|
3155
|
+
}, {
|
|
3156
|
+
"name": "inactivity_ttl_seconds",
|
|
3157
|
+
"description": "Number of seconds of inactivity after which the session expires. 0 means the session never expires.",
|
|
3158
|
+
"required": false,
|
|
3159
|
+
"type": "integer",
|
|
3160
|
+
"in": "body"
|
|
2783
3161
|
}]
|
|
2784
3162
|
},
|
|
2785
3163
|
"get-agent-session": {
|
|
@@ -2822,6 +3200,30 @@ var routes = {
|
|
|
2822
3200
|
"required": true,
|
|
2823
3201
|
"type": "string",
|
|
2824
3202
|
"in": "path"
|
|
3203
|
+
}, {
|
|
3204
|
+
"name": "name",
|
|
3205
|
+
"description": "Session name (set to null to clear)",
|
|
3206
|
+
"required": false,
|
|
3207
|
+
"type": "string",
|
|
3208
|
+
"in": "body"
|
|
3209
|
+
}, {
|
|
3210
|
+
"name": "status",
|
|
3211
|
+
"description": "Session status",
|
|
3212
|
+
"required": false,
|
|
3213
|
+
"type": "string",
|
|
3214
|
+
"in": "body"
|
|
3215
|
+
}, {
|
|
3216
|
+
"name": "auto_generate",
|
|
3217
|
+
"description": "Enable or disable automatic generation after user messages.",
|
|
3218
|
+
"required": false,
|
|
3219
|
+
"type": "boolean",
|
|
3220
|
+
"in": "body"
|
|
3221
|
+
}, {
|
|
3222
|
+
"name": "tool_context",
|
|
3223
|
+
"description": "Key-value pairs injected as context headers into all tool call requests made during this session.",
|
|
3224
|
+
"required": false,
|
|
3225
|
+
"type": "object",
|
|
3226
|
+
"in": "body"
|
|
2825
3227
|
}]
|
|
2826
3228
|
},
|
|
2827
3229
|
"delete-agent-session": {
|
|
@@ -2897,6 +3299,30 @@ var routes = {
|
|
|
2897
3299
|
"required": true,
|
|
2898
3300
|
"type": "string",
|
|
2899
3301
|
"in": "path"
|
|
3302
|
+
}, {
|
|
3303
|
+
"name": "message",
|
|
3304
|
+
"description": "User message text",
|
|
3305
|
+
"required": false,
|
|
3306
|
+
"type": "string",
|
|
3307
|
+
"in": "body"
|
|
3308
|
+
}, {
|
|
3309
|
+
"name": "tool_context",
|
|
3310
|
+
"description": "Key-value pairs injected as context headers into all tool call requests made during this generation.",
|
|
3311
|
+
"required": false,
|
|
3312
|
+
"type": "object",
|
|
3313
|
+
"in": "body"
|
|
3314
|
+
}, {
|
|
3315
|
+
"name": "idempotency_key",
|
|
3316
|
+
"description": "Optional deduplication key scoped to this session. If a message with the same key already exists in the session, the original message is returned with HTTP 200 and no new message or generation is triggered.\n",
|
|
3317
|
+
"required": false,
|
|
3318
|
+
"type": "string",
|
|
3319
|
+
"in": "body"
|
|
3320
|
+
}, {
|
|
3321
|
+
"name": "document_id",
|
|
3322
|
+
"description": "Public ID of a document used as the user message content.",
|
|
3323
|
+
"required": false,
|
|
3324
|
+
"type": "string",
|
|
3325
|
+
"in": "body"
|
|
2900
3326
|
}]
|
|
2901
3327
|
},
|
|
2902
3328
|
"generate-session-response": {
|
|
@@ -2924,6 +3350,18 @@ var routes = {
|
|
|
2924
3350
|
"required": false,
|
|
2925
3351
|
"type": "boolean",
|
|
2926
3352
|
"in": "query"
|
|
3353
|
+
}, {
|
|
3354
|
+
"name": "model",
|
|
3355
|
+
"description": "Optional model override",
|
|
3356
|
+
"required": false,
|
|
3357
|
+
"type": "string",
|
|
3358
|
+
"in": "body"
|
|
3359
|
+
}, {
|
|
3360
|
+
"name": "tool_context",
|
|
3361
|
+
"description": "Key-value pairs injected as context headers into all tool call requests made during this generation.",
|
|
3362
|
+
"required": false,
|
|
3363
|
+
"type": "object",
|
|
3364
|
+
"in": "body"
|
|
2927
3365
|
}]
|
|
2928
3366
|
},
|
|
2929
3367
|
"submit-session-tool-outputs": {
|
|
@@ -2945,6 +3383,18 @@ var routes = {
|
|
|
2945
3383
|
"required": true,
|
|
2946
3384
|
"type": "string",
|
|
2947
3385
|
"in": "path"
|
|
3386
|
+
}, {
|
|
3387
|
+
"name": "generation_id",
|
|
3388
|
+
"description": "The generation ID from the requires_action response",
|
|
3389
|
+
"required": true,
|
|
3390
|
+
"type": "string",
|
|
3391
|
+
"in": "body"
|
|
3392
|
+
}, {
|
|
3393
|
+
"name": "tool_outputs",
|
|
3394
|
+
"description": "",
|
|
3395
|
+
"required": true,
|
|
3396
|
+
"type": "array",
|
|
3397
|
+
"in": "body"
|
|
2948
3398
|
}]
|
|
2949
3399
|
},
|
|
2950
3400
|
"get-session-tags": {
|
|
@@ -3032,7 +3482,61 @@ var routes = {
|
|
|
3032
3482
|
moduleDocsUrl: "https://soat.ttoss.dev/docs/modules/tools",
|
|
3033
3483
|
pathParams: [],
|
|
3034
3484
|
queryParams: [],
|
|
3035
|
-
flags: [
|
|
3485
|
+
flags: [{
|
|
3486
|
+
"name": "project_id",
|
|
3487
|
+
"description": "Public ID of the project",
|
|
3488
|
+
"required": false,
|
|
3489
|
+
"type": "string",
|
|
3490
|
+
"in": "body"
|
|
3491
|
+
}, {
|
|
3492
|
+
"name": "name",
|
|
3493
|
+
"description": "Tool name",
|
|
3494
|
+
"required": true,
|
|
3495
|
+
"type": "string",
|
|
3496
|
+
"in": "body"
|
|
3497
|
+
}, {
|
|
3498
|
+
"name": "type",
|
|
3499
|
+
"description": "Tool type (default http)",
|
|
3500
|
+
"required": false,
|
|
3501
|
+
"type": "string",
|
|
3502
|
+
"in": "body"
|
|
3503
|
+
}, {
|
|
3504
|
+
"name": "description",
|
|
3505
|
+
"description": "What the tool does",
|
|
3506
|
+
"required": false,
|
|
3507
|
+
"type": "string",
|
|
3508
|
+
"in": "body"
|
|
3509
|
+
}, {
|
|
3510
|
+
"name": "parameters",
|
|
3511
|
+
"description": "JSON Schema for tool input",
|
|
3512
|
+
"required": false,
|
|
3513
|
+
"type": "object",
|
|
3514
|
+
"in": "body"
|
|
3515
|
+
}, {
|
|
3516
|
+
"name": "execute",
|
|
3517
|
+
"description": "Execution config for http tools. Supported fields: `url` (required), `method` (default `POST`), and `headers`. The `url` may contain `{paramName}` placeholders (e.g. `/users/{userId}`) that are replaced at call time with the corresponding tool argument value (URL-encoded). Arguments consumed as path parameters are excluded from the query string and request body.\n",
|
|
3518
|
+
"required": false,
|
|
3519
|
+
"type": "object",
|
|
3520
|
+
"in": "body"
|
|
3521
|
+
}, {
|
|
3522
|
+
"name": "mcp",
|
|
3523
|
+
"description": "MCP server config (url, headers)",
|
|
3524
|
+
"required": false,
|
|
3525
|
+
"type": "object",
|
|
3526
|
+
"in": "body"
|
|
3527
|
+
}, {
|
|
3528
|
+
"name": "actions",
|
|
3529
|
+
"description": "SOAT platform actions",
|
|
3530
|
+
"required": false,
|
|
3531
|
+
"type": "array",
|
|
3532
|
+
"in": "body"
|
|
3533
|
+
}, {
|
|
3534
|
+
"name": "preset_parameters",
|
|
3535
|
+
"description": "Fixed parameters merged into every soat tool call. Keys matching fields in the action's input schema are removed from the schema shown to the model and injected automatically at execution time.",
|
|
3536
|
+
"required": false,
|
|
3537
|
+
"type": "object",
|
|
3538
|
+
"in": "body"
|
|
3539
|
+
}]
|
|
3036
3540
|
},
|
|
3037
3541
|
"get-tool": {
|
|
3038
3542
|
serviceClass: "Tools",
|
|
@@ -3062,6 +3566,54 @@ var routes = {
|
|
|
3062
3566
|
"required": true,
|
|
3063
3567
|
"type": "string",
|
|
3064
3568
|
"in": "path"
|
|
3569
|
+
}, {
|
|
3570
|
+
"name": "name",
|
|
3571
|
+
"description": "",
|
|
3572
|
+
"required": false,
|
|
3573
|
+
"type": "string",
|
|
3574
|
+
"in": "body"
|
|
3575
|
+
}, {
|
|
3576
|
+
"name": "type",
|
|
3577
|
+
"description": "",
|
|
3578
|
+
"required": false,
|
|
3579
|
+
"type": "string",
|
|
3580
|
+
"in": "body"
|
|
3581
|
+
}, {
|
|
3582
|
+
"name": "description",
|
|
3583
|
+
"description": "",
|
|
3584
|
+
"required": false,
|
|
3585
|
+
"type": "string",
|
|
3586
|
+
"in": "body"
|
|
3587
|
+
}, {
|
|
3588
|
+
"name": "parameters",
|
|
3589
|
+
"description": "",
|
|
3590
|
+
"required": false,
|
|
3591
|
+
"type": "object",
|
|
3592
|
+
"in": "body"
|
|
3593
|
+
}, {
|
|
3594
|
+
"name": "execute",
|
|
3595
|
+
"description": "Execution config for http tools. Supported fields: `url` (required), `method` (default `POST`), and `headers`. The `url` may contain `{paramName}` placeholders (e.g. `/users/{userId}`) that are replaced at call time with the corresponding tool argument value (URL-encoded). Arguments consumed as path parameters are excluded from the query string and request body.\n",
|
|
3596
|
+
"required": false,
|
|
3597
|
+
"type": "object",
|
|
3598
|
+
"in": "body"
|
|
3599
|
+
}, {
|
|
3600
|
+
"name": "mcp",
|
|
3601
|
+
"description": "",
|
|
3602
|
+
"required": false,
|
|
3603
|
+
"type": "object",
|
|
3604
|
+
"in": "body"
|
|
3605
|
+
}, {
|
|
3606
|
+
"name": "actions",
|
|
3607
|
+
"description": "",
|
|
3608
|
+
"required": false,
|
|
3609
|
+
"type": "array",
|
|
3610
|
+
"in": "body"
|
|
3611
|
+
}, {
|
|
3612
|
+
"name": "preset_parameters",
|
|
3613
|
+
"description": "Fixed parameters merged into every soat tool call. Keys matching fields in the action's input schema are removed from the schema shown to the model and injected automatically at execution time.",
|
|
3614
|
+
"required": false,
|
|
3615
|
+
"type": "object",
|
|
3616
|
+
"in": "body"
|
|
3065
3617
|
}]
|
|
3066
3618
|
},
|
|
3067
3619
|
"delete-tool": {
|
|
@@ -3092,6 +3644,18 @@ var routes = {
|
|
|
3092
3644
|
"required": true,
|
|
3093
3645
|
"type": "string",
|
|
3094
3646
|
"in": "path"
|
|
3647
|
+
}, {
|
|
3648
|
+
"name": "action",
|
|
3649
|
+
"description": "For `soat` tools: the action name (must be in the tool's `actions` list). For `mcp` tools: the MCP tool name to invoke. Ignored for `http` tools.\n",
|
|
3650
|
+
"required": false,
|
|
3651
|
+
"type": "string",
|
|
3652
|
+
"in": "body"
|
|
3653
|
+
}, {
|
|
3654
|
+
"name": "input",
|
|
3655
|
+
"description": "Input parameters for the tool call. These are merged with the tool's `preset_parameters` before execution (caller-supplied values take precedence).\n",
|
|
3656
|
+
"required": false,
|
|
3657
|
+
"type": "object",
|
|
3658
|
+
"in": "body"
|
|
3095
3659
|
}]
|
|
3096
3660
|
},
|
|
3097
3661
|
"list-traces": {
|
|
@@ -3338,6 +3902,36 @@ var routes = {
|
|
|
3338
3902
|
"required": true,
|
|
3339
3903
|
"type": "string",
|
|
3340
3904
|
"in": "path"
|
|
3905
|
+
}, {
|
|
3906
|
+
"name": "name",
|
|
3907
|
+
"description": "",
|
|
3908
|
+
"required": true,
|
|
3909
|
+
"type": "string",
|
|
3910
|
+
"in": "body"
|
|
3911
|
+
}, {
|
|
3912
|
+
"name": "description",
|
|
3913
|
+
"description": "",
|
|
3914
|
+
"required": false,
|
|
3915
|
+
"type": "string",
|
|
3916
|
+
"in": "body"
|
|
3917
|
+
}, {
|
|
3918
|
+
"name": "url",
|
|
3919
|
+
"description": "",
|
|
3920
|
+
"required": true,
|
|
3921
|
+
"type": "string",
|
|
3922
|
+
"in": "body"
|
|
3923
|
+
}, {
|
|
3924
|
+
"name": "events",
|
|
3925
|
+
"description": "",
|
|
3926
|
+
"required": true,
|
|
3927
|
+
"type": "array",
|
|
3928
|
+
"in": "body"
|
|
3929
|
+
}, {
|
|
3930
|
+
"name": "policy_id",
|
|
3931
|
+
"description": "",
|
|
3932
|
+
"required": false,
|
|
3933
|
+
"type": "string",
|
|
3934
|
+
"in": "body"
|
|
3341
3935
|
}]
|
|
3342
3936
|
},
|
|
3343
3937
|
"get-webhook": {
|
|
@@ -3380,6 +3974,42 @@ var routes = {
|
|
|
3380
3974
|
"required": true,
|
|
3381
3975
|
"type": "string",
|
|
3382
3976
|
"in": "path"
|
|
3977
|
+
}, {
|
|
3978
|
+
"name": "name",
|
|
3979
|
+
"description": "",
|
|
3980
|
+
"required": false,
|
|
3981
|
+
"type": "string",
|
|
3982
|
+
"in": "body"
|
|
3983
|
+
}, {
|
|
3984
|
+
"name": "description",
|
|
3985
|
+
"description": "",
|
|
3986
|
+
"required": false,
|
|
3987
|
+
"type": "string",
|
|
3988
|
+
"in": "body"
|
|
3989
|
+
}, {
|
|
3990
|
+
"name": "url",
|
|
3991
|
+
"description": "",
|
|
3992
|
+
"required": false,
|
|
3993
|
+
"type": "string",
|
|
3994
|
+
"in": "body"
|
|
3995
|
+
}, {
|
|
3996
|
+
"name": "events",
|
|
3997
|
+
"description": "",
|
|
3998
|
+
"required": false,
|
|
3999
|
+
"type": "array",
|
|
4000
|
+
"in": "body"
|
|
4001
|
+
}, {
|
|
4002
|
+
"name": "active",
|
|
4003
|
+
"description": "",
|
|
4004
|
+
"required": false,
|
|
4005
|
+
"type": "boolean",
|
|
4006
|
+
"in": "body"
|
|
4007
|
+
}, {
|
|
4008
|
+
"name": "policy_id",
|
|
4009
|
+
"description": "",
|
|
4010
|
+
"required": false,
|
|
4011
|
+
"type": "string",
|
|
4012
|
+
"in": "body"
|
|
3383
4013
|
}]
|
|
3384
4014
|
},
|
|
3385
4015
|
"delete-webhook": {
|
|
@@ -3507,30 +4137,36 @@ var routes = {
|
|
|
3507
4137
|
}
|
|
3508
4138
|
};
|
|
3509
4139
|
|
|
3510
|
-
|
|
3511
|
-
|
|
4140
|
+
//#endregion
|
|
4141
|
+
//#region src/index.ts
|
|
4142
|
+
/**
|
|
4143
|
+
* Normalize kebab-case, snake_case, or camelCase to camelCase for param matching.
|
|
4144
|
+
* e.g. agent-id → agentId, actor_id → actorId, agentId → agentId
|
|
4145
|
+
*/
|
|
4146
|
+
var toCanonical = s => {
|
|
3512
4147
|
return s.replace(/[-_]([a-z0-9])/g, (_, c) => {
|
|
3513
4148
|
return c.toUpperCase();
|
|
3514
4149
|
});
|
|
3515
|
-
}
|
|
3516
|
-
|
|
4150
|
+
};
|
|
4151
|
+
/** Convert kebab-case to snake_case for body/query keys (e.g. project-id → project_id). */
|
|
4152
|
+
var kebabToSnake = s => {
|
|
3517
4153
|
return s.replace(/-/g, "_");
|
|
3518
|
-
}
|
|
3519
|
-
var parseFlagValue =
|
|
4154
|
+
};
|
|
4155
|
+
var parseFlagValue = value => {
|
|
3520
4156
|
const trimmed = value.trim();
|
|
3521
|
-
if (trimmed.startsWith("{") || trimmed.startsWith("[") || trimmed === "true" || trimmed === "false" || trimmed === "null" || /^-?\d+(\.\d+)?$/.test(trimmed)) {
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
return value;
|
|
3526
|
-
}
|
|
4157
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[") || trimmed === "true" || trimmed === "false" || trimmed === "null" || /^-?\d+(\.\d+)?$/.test(trimmed)) try {
|
|
4158
|
+
return JSON.parse(trimmed);
|
|
4159
|
+
} catch {
|
|
4160
|
+
return value;
|
|
3527
4161
|
}
|
|
3528
4162
|
return value;
|
|
3529
|
-
}
|
|
3530
|
-
|
|
4163
|
+
};
|
|
4164
|
+
/** Normalize symbol names to compare exports across acronym casing differences. */
|
|
4165
|
+
var normalizeSymbol = name => {
|
|
3531
4166
|
return name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
3532
|
-
}
|
|
3533
|
-
|
|
4167
|
+
};
|
|
4168
|
+
/** Resolve SDK service exports even when generated names differ by acronym casing. */
|
|
4169
|
+
var resolveServiceClass = serviceClassName => {
|
|
3534
4170
|
const sdkExports = sdk;
|
|
3535
4171
|
const exactMatch = sdkExports[serviceClassName];
|
|
3536
4172
|
if (exactMatch) return exactMatch;
|
|
@@ -3538,12 +4174,9 @@ var resolveServiceClass = /* @__PURE__ */__name(serviceClassName => {
|
|
|
3538
4174
|
const fuzzyMatches = Object.entries(sdkExports).filter(([exportName, value]) => {
|
|
3539
4175
|
return Boolean(value) && normalizeSymbol(exportName) === normalizedTarget;
|
|
3540
4176
|
});
|
|
3541
|
-
if (fuzzyMatches.length === 1)
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
return void 0;
|
|
3545
|
-
}, "resolveServiceClass");
|
|
3546
|
-
program.name("soat").description("SOAT CLI").version(package_default.version).option("-p, --profile <name>", "config profile to use");
|
|
4177
|
+
if (fuzzyMatches.length === 1) return fuzzyMatches[0][1];
|
|
4178
|
+
};
|
|
4179
|
+
program.name("soat").description("SOAT CLI").version(version).option("-p, --profile <name>", "config profile to use");
|
|
3547
4180
|
program.addHelpText("after", "\nTip: Run `soat <command> --help` to see command-specific flags and docs.");
|
|
3548
4181
|
program.command("configure").description("Save credentials to a named profile (~/.soat/config.json)").option("-p, --profile <name>", "profile name", "default").action(async opts => {
|
|
3549
4182
|
const [{
|
|
@@ -3567,33 +4200,29 @@ program.command("list-commands").description("List all available API commands").
|
|
|
3567
4200
|
const pad = Math.max(...Object.keys(routes).map(k => {
|
|
3568
4201
|
return k.length;
|
|
3569
4202
|
}));
|
|
3570
|
-
for (const [cmd, r] of Object.entries(routes).sort()) {
|
|
3571
|
-
console.log(` ${cmd.padEnd(pad)} ${r.description}`);
|
|
3572
|
-
}
|
|
4203
|
+
for (const [cmd, r] of Object.entries(routes).sort()) console.log(` ${cmd.padEnd(pad)} ${r.description}`);
|
|
3573
4204
|
});
|
|
3574
|
-
var matchesFilter =
|
|
4205
|
+
var matchesFilter = (eventType, filter) => {
|
|
3575
4206
|
const patterns = filter.split(",").map(part => {
|
|
3576
4207
|
return part.trim();
|
|
3577
4208
|
}).filter(Boolean);
|
|
3578
4209
|
if (patterns.length === 0) return true;
|
|
3579
4210
|
return patterns.some(pattern => {
|
|
3580
4211
|
if (pattern === "*") return true;
|
|
3581
|
-
if (pattern.endsWith("*"))
|
|
3582
|
-
return eventType.startsWith(pattern.slice(0, -1));
|
|
3583
|
-
}
|
|
4212
|
+
if (pattern.endsWith("*")) return eventType.startsWith(pattern.slice(0, -1));
|
|
3584
4213
|
return eventType === pattern;
|
|
3585
4214
|
});
|
|
3586
|
-
}
|
|
3587
|
-
var verifySignature =
|
|
4215
|
+
};
|
|
4216
|
+
var verifySignature = (secret, payload, signatureHeader) => {
|
|
3588
4217
|
const expected = createHmac("sha256", secret).update(payload).digest("hex");
|
|
3589
4218
|
const expectedBuffer = Buffer.from(expected, "utf8");
|
|
3590
4219
|
const actualBuffer = Buffer.from(signatureHeader, "utf8");
|
|
3591
4220
|
if (expectedBuffer.length !== actualBuffer.length) return false;
|
|
3592
4221
|
return timingSafeEqual(expectedBuffer, actualBuffer);
|
|
3593
|
-
}
|
|
4222
|
+
};
|
|
3594
4223
|
program.command("listen").description("Start a local webhook listener for testing deliveries").option("--port <number>", "port to listen on", "8787").option("--path <path>", "request path to accept", "/webhook").option("--secret <secret>", "verify X-Soat-Signature with this webhook secret").option("--filter <pattern>", "filter event type(s), supports prefix wildcard and comma separation (e.g. sessions.generation.*,files.*)").option("--json", "print one JSON object per line").action(opts => {
|
|
3595
4224
|
const port = Number(opts.port);
|
|
3596
|
-
const
|
|
4225
|
+
const path = opts.path;
|
|
3597
4226
|
const secret = opts.secret;
|
|
3598
4227
|
const filter = opts.filter;
|
|
3599
4228
|
const asJson = Boolean(opts.json);
|
|
@@ -3602,7 +4231,7 @@ program.command("listen").description("Start a local webhook listener for testin
|
|
|
3602
4231
|
process.exit(1);
|
|
3603
4232
|
}
|
|
3604
4233
|
const server = createServer((req, res) => {
|
|
3605
|
-
if (req.method !== "POST" || req.url !==
|
|
4234
|
+
if (req.method !== "POST" || req.url !== path) {
|
|
3606
4235
|
res.writeHead(404, {
|
|
3607
4236
|
"Content-Type": "application/json"
|
|
3608
4237
|
});
|
|
@@ -3635,9 +4264,7 @@ program.command("listen").description("Start a local webhook listener for testin
|
|
|
3635
4264
|
parsedPayload = JSON.parse(rawBody);
|
|
3636
4265
|
} catch {}
|
|
3637
4266
|
let isSignatureValid = null;
|
|
3638
|
-
if (secret)
|
|
3639
|
-
isSignatureValid = verifySignature(secret, rawBody, signature);
|
|
3640
|
-
}
|
|
4267
|
+
if (secret) isSignatureValid = verifySignature(secret, rawBody, signature);
|
|
3641
4268
|
const record = {
|
|
3642
4269
|
timestamp: (/* @__PURE__ */new Date()).toISOString(),
|
|
3643
4270
|
event_type: eventType,
|
|
@@ -3646,15 +4273,11 @@ program.command("listen").description("Start a local webhook listener for testin
|
|
|
3646
4273
|
signature_valid: isSignatureValid,
|
|
3647
4274
|
payload: parsedPayload
|
|
3648
4275
|
};
|
|
3649
|
-
if (asJson) {
|
|
3650
|
-
console.log(JSON.stringify(record));
|
|
3651
|
-
} else {
|
|
4276
|
+
if (asJson) console.log(JSON.stringify(record));else {
|
|
3652
4277
|
console.log("--- webhook received ---");
|
|
3653
4278
|
console.log("event_type:", eventType);
|
|
3654
4279
|
console.log("delivery_id:", deliveryId);
|
|
3655
|
-
if (secret)
|
|
3656
|
-
console.log("signature_valid:", isSignatureValid);
|
|
3657
|
-
}
|
|
4280
|
+
if (secret) console.log("signature_valid:", isSignatureValid);
|
|
3658
4281
|
console.log("payload:", JSON.stringify(parsedPayload, null, 2));
|
|
3659
4282
|
}
|
|
3660
4283
|
const responseStatus = secret && isSignatureValid === false ? 401 : 200;
|
|
@@ -3670,13 +4293,9 @@ program.command("listen").description("Start a local webhook listener for testin
|
|
|
3670
4293
|
});
|
|
3671
4294
|
});
|
|
3672
4295
|
server.listen(port, () => {
|
|
3673
|
-
console.log(`Listening for SOAT webhooks on http://localhost:${port}${
|
|
3674
|
-
if (filter) {
|
|
3675
|
-
|
|
3676
|
-
}
|
|
3677
|
-
if (secret) {
|
|
3678
|
-
console.log("Signature verification: enabled");
|
|
3679
|
-
}
|
|
4296
|
+
console.log(`Listening for SOAT webhooks on http://localhost:${port}${path}`);
|
|
4297
|
+
if (filter) console.log(`Filter: ${filter}`);
|
|
4298
|
+
if (secret) console.log("Signature verification: enabled");
|
|
3680
4299
|
});
|
|
3681
4300
|
process.on("SIGINT", () => {
|
|
3682
4301
|
server.close(() => {
|
|
@@ -3705,13 +4324,9 @@ program.argument("[command]", "API command in kebab-case (e.g. list-actors)").ar
|
|
|
3705
4324
|
in: "wrapper"
|
|
3706
4325
|
};
|
|
3707
4326
|
})];
|
|
3708
|
-
console.log(`
|
|
3709
|
-
|
|
3710
|
-
`);
|
|
3711
|
-
console.log(` ${route.description}
|
|
3712
|
-
`);
|
|
3713
|
-
console.log(` Module docs: ${route.moduleDocsUrl}
|
|
3714
|
-
`);
|
|
4327
|
+
console.log(`\nUsage: soat ${commandName} [flags]\n`);
|
|
4328
|
+
console.log(` ${route.description}\n`);
|
|
4329
|
+
console.log(` Module docs: ${route.moduleDocsUrl}\n`);
|
|
3715
4330
|
if (allFlags.length > 0) {
|
|
3716
4331
|
console.log("Flags:");
|
|
3717
4332
|
for (const f of allFlags) {
|
|
@@ -3722,13 +4337,12 @@ Usage: soat ${commandName} [flags]
|
|
|
3722
4337
|
}
|
|
3723
4338
|
process.exit(0);
|
|
3724
4339
|
}
|
|
3725
|
-
const parsedFlags = parseUnknownWithRepeats({
|
|
3726
|
-
cliArgs: rawArgs
|
|
3727
|
-
});
|
|
3728
4340
|
const wrapped = applyWrapperForCommand({
|
|
3729
4341
|
commandName,
|
|
3730
4342
|
route,
|
|
3731
|
-
parsedFlags
|
|
4343
|
+
parsedFlags: parseUnknownWithRepeats({
|
|
4344
|
+
cliArgs: rawArgs
|
|
4345
|
+
})
|
|
3732
4346
|
});
|
|
3733
4347
|
const flags = wrapped.flags.single;
|
|
3734
4348
|
const pathArgs = {};
|
|
@@ -3744,16 +4358,9 @@ Usage: soat ${commandName} [flags]
|
|
|
3744
4358
|
const queryParam = route.queryParams.find(p => {
|
|
3745
4359
|
return toCanonical(p) === canonical;
|
|
3746
4360
|
});
|
|
3747
|
-
if (pathParam)
|
|
3748
|
-
pathArgs[pathParam] = parsedValue;
|
|
3749
|
-
} else if (queryParam) {
|
|
3750
|
-
queryArgs[queryParam] = parsedValue;
|
|
3751
|
-
} else {
|
|
3752
|
-
bodyArgs[kebabToSnake(flagKey)] = parsedValue;
|
|
3753
|
-
}
|
|
4361
|
+
if (pathParam) pathArgs[pathParam] = parsedValue;else if (queryParam) queryArgs[queryParam] = parsedValue;else bodyArgs[kebabToSnake(flagKey)] = parsedValue;
|
|
3754
4362
|
}
|
|
3755
|
-
const
|
|
3756
|
-
const client = resolveClient(profileOpt);
|
|
4363
|
+
const client = resolveClient(flags["profile"] ?? program.opts().profile);
|
|
3757
4364
|
const serviceClass = resolveServiceClass(route.serviceClass);
|
|
3758
4365
|
if (!serviceClass) {
|
|
3759
4366
|
console.error(`SDK class "${route.serviceClass}" not found.`);
|
|
@@ -3767,9 +4374,7 @@ Usage: soat ${commandName} [flags]
|
|
|
3767
4374
|
const callOpts = {
|
|
3768
4375
|
client
|
|
3769
4376
|
};
|
|
3770
|
-
if (Object.keys(wrapped.forcedBody).length)
|
|
3771
|
-
Object.assign(bodyArgs, wrapped.forcedBody);
|
|
3772
|
-
}
|
|
4377
|
+
if (Object.keys(wrapped.forcedBody).length) Object.assign(bodyArgs, wrapped.forcedBody);
|
|
3773
4378
|
if (Object.keys(pathArgs).length) callOpts["path"] = pathArgs;
|
|
3774
4379
|
if (Object.keys(queryArgs).length) callOpts["query"] = queryArgs;
|
|
3775
4380
|
if (Object.keys(bodyArgs).length) callOpts["body"] = bodyArgs;
|
|
@@ -3795,7 +4400,7 @@ Usage: soat ${commandName} [flags]
|
|
|
3795
4400
|
}
|
|
3796
4401
|
console.log(JSON.stringify(result.data, null, 2));
|
|
3797
4402
|
});
|
|
3798
|
-
var runCli =
|
|
4403
|
+
var runCli = async args => {
|
|
3799
4404
|
const previousArgv = process.argv;
|
|
3800
4405
|
process.argv = args;
|
|
3801
4406
|
try {
|
|
@@ -3803,12 +4408,11 @@ var runCli = /* @__PURE__ */__name(async args => {
|
|
|
3803
4408
|
} finally {
|
|
3804
4409
|
process.argv = previousArgv;
|
|
3805
4410
|
}
|
|
3806
|
-
}
|
|
3807
|
-
|
|
4411
|
+
};
|
|
4412
|
+
if ((() => {
|
|
3808
4413
|
if (!process.argv[1]) return false;
|
|
3809
|
-
return
|
|
3810
|
-
})();
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
}
|
|
4414
|
+
return path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
4415
|
+
})()) runCli(process.argv);
|
|
4416
|
+
|
|
4417
|
+
//#endregion
|
|
3814
4418
|
export { runCli };
|