@soat/cli 0.4.3 → 0.4.5

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.
Files changed (2) hide show
  1. package/dist/esm/index.js +335 -95
  2. package/package.json +4 -2
package/dist/esm/index.js CHANGED
@@ -6,6 +6,8 @@ var __name = (target, value) => __defProp(target, "name", {
6
6
  });
7
7
 
8
8
  // src/index.ts
9
+ import { createHmac, timingSafeEqual } from "crypto";
10
+ import { createServer } from "http";
9
11
  import input from "@inquirer/input";
10
12
  import password from "@inquirer/password";
11
13
  import * as sdk from "@soat/sdk";
@@ -14,10 +16,12 @@ import { program } from "commander";
14
16
  // package.json
15
17
  var package_default = {
16
18
  name: "@soat/cli",
17
- version: "0.4.3",
19
+ version: "0.4.5",
18
20
  type: "module",
19
21
  scripts: {
20
22
  generate: "tsx scripts/generate.ts",
23
+ lint: "eslint src",
24
+ typecheck: "tsc --noEmit",
21
25
  build: "pnpm generate && tsup"
22
26
  },
23
27
  dependencies: {
@@ -105,695 +109,812 @@ var routes = {
105
109
  "list-actors": {
106
110
  serviceClass: "Actors",
107
111
  operationId: "listActors",
112
+ description: "List actors",
108
113
  pathParams: [],
109
114
  queryParams: ["project_id", "external_id", "limit", "offset"]
110
115
  },
111
116
  "create-actor": {
112
117
  serviceClass: "Actors",
113
118
  operationId: "createActor",
119
+ description: "Create an actor",
114
120
  pathParams: [],
115
121
  queryParams: []
116
122
  },
117
123
  "get-actor": {
118
124
  serviceClass: "Actors",
119
125
  operationId: "getActor",
120
- pathParams: ["id"],
126
+ description: "Get an actor by ID",
127
+ pathParams: ["actor_id"],
121
128
  queryParams: []
122
129
  },
123
130
  "update-actor": {
124
131
  serviceClass: "Actors",
125
132
  operationId: "updateActor",
126
- pathParams: ["id"],
133
+ description: "Update an actor",
134
+ pathParams: ["actor_id"],
127
135
  queryParams: []
128
136
  },
129
137
  "delete-actor": {
130
138
  serviceClass: "Actors",
131
139
  operationId: "deleteActor",
132
- pathParams: ["id"],
140
+ description: "Delete an actor",
141
+ pathParams: ["actor_id"],
133
142
  queryParams: []
134
143
  },
135
144
  "get-actor-tags": {
136
145
  serviceClass: "Actors",
137
146
  operationId: "getActorTags",
138
- pathParams: ["id"],
147
+ description: "Get actor tags",
148
+ pathParams: ["actor_id"],
139
149
  queryParams: []
140
150
  },
141
151
  "replace-actor-tags": {
142
152
  serviceClass: "Actors",
143
153
  operationId: "replaceActorTags",
144
- pathParams: ["id"],
154
+ description: "Replace actor tags",
155
+ pathParams: ["actor_id"],
145
156
  queryParams: []
146
157
  },
147
158
  "merge-actor-tags": {
148
159
  serviceClass: "Actors",
149
160
  operationId: "mergeActorTags",
150
- pathParams: ["id"],
161
+ description: "Merge actor tags",
162
+ pathParams: ["actor_id"],
151
163
  queryParams: []
152
164
  },
153
165
  "list-agent-tools": {
154
166
  serviceClass: "AgentTools",
155
167
  operationId: "listAgentTools",
168
+ description: "List agent tools",
156
169
  pathParams: [],
157
170
  queryParams: ["project_id"]
158
171
  },
159
172
  "create-agent-tool": {
160
173
  serviceClass: "AgentTools",
161
174
  operationId: "createAgentTool",
175
+ description: "Create an agent tool",
162
176
  pathParams: [],
163
177
  queryParams: []
164
178
  },
165
179
  "get-agent-tool": {
166
180
  serviceClass: "AgentTools",
167
181
  operationId: "getAgentTool",
168
- pathParams: ["toolId"],
182
+ description: "Get an agent tool",
183
+ pathParams: ["tool_id"],
169
184
  queryParams: []
170
185
  },
171
186
  "update-agent-tool": {
172
187
  serviceClass: "AgentTools",
173
188
  operationId: "updateAgentTool",
174
- pathParams: ["toolId"],
189
+ description: "Update an agent tool",
190
+ pathParams: ["tool_id"],
175
191
  queryParams: []
176
192
  },
177
193
  "delete-agent-tool": {
178
194
  serviceClass: "AgentTools",
179
195
  operationId: "deleteAgentTool",
180
- pathParams: ["toolId"],
196
+ description: "Delete an agent tool",
197
+ pathParams: ["tool_id"],
181
198
  queryParams: []
182
199
  },
183
200
  "list-agent-traces": {
184
201
  serviceClass: "AgentTraces",
185
202
  operationId: "listAgentTraces",
203
+ description: "List agent traces",
186
204
  pathParams: [],
187
205
  queryParams: ["project_id", "limit", "offset"]
188
206
  },
189
207
  "get-agent-trace": {
190
208
  serviceClass: "AgentTraces",
191
209
  operationId: "getAgentTrace",
192
- pathParams: ["traceId"],
210
+ description: "Get a trace",
211
+ pathParams: ["trace_id"],
193
212
  queryParams: []
194
213
  },
195
214
  "list-agents": {
196
215
  serviceClass: "Agents",
197
216
  operationId: "listAgents",
217
+ description: "List agents",
198
218
  pathParams: [],
199
219
  queryParams: ["project_id"]
200
220
  },
201
221
  "create-agent": {
202
222
  serviceClass: "Agents",
203
223
  operationId: "createAgent",
224
+ description: "Create an agent",
204
225
  pathParams: [],
205
226
  queryParams: []
206
227
  },
207
228
  "get-agent": {
208
229
  serviceClass: "Agents",
209
230
  operationId: "getAgent",
210
- pathParams: ["agentId"],
231
+ description: "Get an agent",
232
+ pathParams: ["agent_id"],
211
233
  queryParams: []
212
234
  },
213
235
  "update-agent": {
214
236
  serviceClass: "Agents",
215
237
  operationId: "updateAgent",
216
- pathParams: ["agentId"],
238
+ description: "Update an agent",
239
+ pathParams: ["agent_id"],
217
240
  queryParams: []
218
241
  },
219
242
  "delete-agent": {
220
243
  serviceClass: "Agents",
221
244
  operationId: "deleteAgent",
222
- pathParams: ["agentId"],
245
+ description: "Delete an agent",
246
+ pathParams: ["agent_id"],
223
247
  queryParams: []
224
248
  },
225
249
  "create-agent-generation": {
226
250
  serviceClass: "Agents",
227
251
  operationId: "createAgentGeneration",
228
- pathParams: ["agentId"],
252
+ description: "Run an agent generation",
253
+ pathParams: ["agent_id"],
229
254
  queryParams: []
230
255
  },
231
256
  "submit-agent-tool-outputs": {
232
257
  serviceClass: "Agents",
233
258
  operationId: "submitAgentToolOutputs",
234
- pathParams: ["agentId", "generationId"],
259
+ description: "Submit tool outputs for a paused generation",
260
+ pathParams: ["agent_id", "generation_id"],
235
261
  queryParams: []
236
262
  },
237
263
  "create-agent-actor": {
238
264
  serviceClass: "Agents",
239
265
  operationId: "createAgentActor",
240
- pathParams: ["agentId"],
266
+ description: "Create an actor for an agent",
267
+ pathParams: ["agent_id"],
241
268
  queryParams: []
242
269
  },
243
270
  "list-ai-providers": {
244
271
  serviceClass: "AIProviders",
245
272
  operationId: "listAiProviders",
273
+ description: "List AI providers",
246
274
  pathParams: [],
247
275
  queryParams: ["project_id", "limit", "offset"]
248
276
  },
249
277
  "create-ai-provider": {
250
278
  serviceClass: "AIProviders",
251
279
  operationId: "createAiProvider",
280
+ description: "Create an AI provider",
252
281
  pathParams: [],
253
282
  queryParams: []
254
283
  },
255
284
  "get-ai-provider": {
256
285
  serviceClass: "AIProviders",
257
286
  operationId: "getAiProvider",
258
- pathParams: ["aiProviderId"],
287
+ description: "Get an AI provider",
288
+ pathParams: ["ai_provider_id"],
259
289
  queryParams: []
260
290
  },
261
291
  "update-ai-provider": {
262
292
  serviceClass: "AIProviders",
263
293
  operationId: "updateAiProvider",
264
- pathParams: ["aiProviderId"],
294
+ description: "Update an AI provider",
295
+ pathParams: ["ai_provider_id"],
265
296
  queryParams: []
266
297
  },
267
298
  "delete-ai-provider": {
268
299
  serviceClass: "AIProviders",
269
300
  operationId: "deleteAiProvider",
270
- pathParams: ["aiProviderId"],
301
+ description: "Delete an AI provider",
302
+ pathParams: ["ai_provider_id"],
271
303
  queryParams: []
272
304
  },
273
305
  "create-api-key": {
274
306
  serviceClass: "APIKeys",
275
307
  operationId: "createApiKey",
308
+ description: "Create an API key",
276
309
  pathParams: [],
277
310
  queryParams: []
278
311
  },
279
312
  "get-api-key": {
280
313
  serviceClass: "APIKeys",
281
314
  operationId: "getApiKey",
282
- pathParams: ["id"],
315
+ description: "Get an API key",
316
+ pathParams: ["api_key_id"],
283
317
  queryParams: []
284
318
  },
285
319
  "update-api-key": {
286
320
  serviceClass: "APIKeys",
287
321
  operationId: "updateApiKey",
288
- pathParams: ["id"],
322
+ description: "Update an API key",
323
+ pathParams: ["api_key_id"],
289
324
  queryParams: []
290
325
  },
291
326
  "delete-api-key": {
292
327
  serviceClass: "APIKeys",
293
328
  operationId: "deleteApiKey",
294
- pathParams: ["id"],
329
+ description: "Delete an API key",
330
+ pathParams: ["api_key_id"],
295
331
  queryParams: []
296
332
  },
297
333
  "list-chats": {
298
334
  serviceClass: "Chats",
299
335
  operationId: "listChats",
336
+ description: "List chats",
300
337
  pathParams: [],
301
338
  queryParams: ["project_id"]
302
339
  },
303
340
  "create-chat": {
304
341
  serviceClass: "Chats",
305
342
  operationId: "createChat",
343
+ description: "Create a chat",
306
344
  pathParams: [],
307
345
  queryParams: []
308
346
  },
309
347
  "get-chat": {
310
348
  serviceClass: "Chats",
311
349
  operationId: "getChat",
312
- pathParams: ["chatId"],
350
+ description: "Get a chat",
351
+ pathParams: ["chat_id"],
313
352
  queryParams: []
314
353
  },
315
354
  "delete-chat": {
316
355
  serviceClass: "Chats",
317
356
  operationId: "deleteChat",
318
- pathParams: ["chatId"],
357
+ description: "Delete a chat",
358
+ pathParams: ["chat_id"],
319
359
  queryParams: []
320
360
  },
321
361
  "create-chat-completion-for-chat": {
322
362
  serviceClass: "Chats",
323
363
  operationId: "createChatCompletionForChat",
324
- pathParams: ["chatId"],
364
+ description: "Create a chat completion for a stored chat",
365
+ pathParams: ["chat_id"],
325
366
  queryParams: []
326
367
  },
327
368
  "create-chat-completion": {
328
369
  serviceClass: "Chats",
329
370
  operationId: "createChatCompletion",
371
+ description: "Create a chat completion (stateless)",
330
372
  pathParams: [],
331
373
  queryParams: []
332
374
  },
333
375
  "create-chat-actor": {
334
376
  serviceClass: "Chats",
335
377
  operationId: "createChatActor",
336
- pathParams: ["chatId"],
378
+ description: "Create an actor for a chat",
379
+ pathParams: ["chat_id"],
337
380
  queryParams: []
338
381
  },
339
382
  "list-conversations": {
340
383
  serviceClass: "Conversations",
341
384
  operationId: "listConversations",
385
+ description: "List conversations",
342
386
  pathParams: [],
343
387
  queryParams: ["project_id", "actor_id", "limit", "offset"]
344
388
  },
345
389
  "create-conversation": {
346
390
  serviceClass: "Conversations",
347
391
  operationId: "createConversation",
392
+ description: "Create a conversation",
348
393
  pathParams: [],
349
394
  queryParams: []
350
395
  },
351
396
  "get-conversation": {
352
397
  serviceClass: "Conversations",
353
398
  operationId: "getConversation",
354
- pathParams: ["id"],
399
+ description: "Get a conversation by ID",
400
+ pathParams: ["conversation_id"],
355
401
  queryParams: []
356
402
  },
357
403
  "update-conversation": {
358
404
  serviceClass: "Conversations",
359
405
  operationId: "updateConversation",
360
- pathParams: ["id"],
406
+ description: "Update a conversation",
407
+ pathParams: ["conversation_id"],
361
408
  queryParams: []
362
409
  },
363
410
  "delete-conversation": {
364
411
  serviceClass: "Conversations",
365
412
  operationId: "deleteConversation",
366
- pathParams: ["id"],
413
+ description: "Delete a conversation",
414
+ pathParams: ["conversation_id"],
367
415
  queryParams: []
368
416
  },
369
417
  "list-conversation-messages": {
370
418
  serviceClass: "Conversations",
371
419
  operationId: "listConversationMessages",
372
- pathParams: ["id"],
420
+ description: "List conversation messages",
421
+ pathParams: ["conversation_id"],
373
422
  queryParams: ["limit", "offset"]
374
423
  },
375
424
  "add-conversation-message": {
376
425
  serviceClass: "Conversations",
377
426
  operationId: "addConversationMessage",
378
- pathParams: ["id"],
427
+ description: "Add a message to a conversation",
428
+ pathParams: ["conversation_id"],
379
429
  queryParams: []
380
430
  },
381
431
  "generate-conversation-message": {
382
432
  serviceClass: "Conversations",
383
433
  operationId: "generateConversationMessage",
384
- pathParams: ["id"],
434
+ description: "Generate the next message in a conversation",
435
+ pathParams: ["conversation_id"],
385
436
  queryParams: []
386
437
  },
387
438
  "list-conversation-actors": {
388
439
  serviceClass: "Conversations",
389
440
  operationId: "listConversationActors",
390
- pathParams: ["id"],
441
+ description: "List actors in a conversation",
442
+ pathParams: ["conversation_id"],
391
443
  queryParams: []
392
444
  },
393
445
  "remove-conversation-message": {
394
446
  serviceClass: "Conversations",
395
447
  operationId: "removeConversationMessage",
396
- pathParams: ["id", "documentId"],
448
+ description: "Remove a message from a conversation",
449
+ pathParams: ["conversation_id", "document_id"],
397
450
  queryParams: []
398
451
  },
399
452
  "get-conversation-tags": {
400
453
  serviceClass: "Conversations",
401
454
  operationId: "getConversationTags",
402
- pathParams: ["id"],
455
+ description: "Get conversation tags",
456
+ pathParams: ["conversation_id"],
403
457
  queryParams: []
404
458
  },
405
459
  "replace-conversation-tags": {
406
460
  serviceClass: "Conversations",
407
461
  operationId: "replaceConversationTags",
408
- pathParams: ["id"],
462
+ description: "Replace conversation tags",
463
+ pathParams: ["conversation_id"],
409
464
  queryParams: []
410
465
  },
411
466
  "merge-conversation-tags": {
412
467
  serviceClass: "Conversations",
413
468
  operationId: "mergeConversationTags",
414
- pathParams: ["id"],
469
+ description: "Merge conversation tags",
470
+ pathParams: ["conversation_id"],
415
471
  queryParams: []
416
472
  },
417
473
  "list-documents": {
418
474
  serviceClass: "Documents",
419
475
  operationId: "listDocuments",
476
+ description: "List documents",
420
477
  pathParams: [],
421
478
  queryParams: ["project_id"]
422
479
  },
423
480
  "create-document": {
424
481
  serviceClass: "Documents",
425
482
  operationId: "createDocument",
483
+ description: "Create a document",
426
484
  pathParams: [],
427
485
  queryParams: []
428
486
  },
429
487
  "get-document": {
430
488
  serviceClass: "Documents",
431
489
  operationId: "getDocument",
432
- pathParams: ["id"],
490
+ description: "Get a document by ID",
491
+ pathParams: ["document_id"],
433
492
  queryParams: []
434
493
  },
435
494
  "update-document": {
436
495
  serviceClass: "Documents",
437
496
  operationId: "updateDocument",
438
- pathParams: ["id"],
497
+ description: "Update a document",
498
+ pathParams: ["document_id"],
439
499
  queryParams: []
440
500
  },
441
501
  "delete-document": {
442
502
  serviceClass: "Documents",
443
503
  operationId: "deleteDocument",
444
- pathParams: ["id"],
504
+ description: "Delete a document",
505
+ pathParams: ["document_id"],
445
506
  queryParams: []
446
507
  },
447
508
  "get-document-tags": {
448
509
  serviceClass: "Documents",
449
510
  operationId: "getDocumentTags",
450
- pathParams: ["id"],
511
+ description: "Get document tags",
512
+ pathParams: ["document_id"],
451
513
  queryParams: []
452
514
  },
453
515
  "replace-document-tags": {
454
516
  serviceClass: "Documents",
455
517
  operationId: "replaceDocumentTags",
456
- pathParams: ["id"],
518
+ description: "Replace document tags",
519
+ pathParams: ["document_id"],
457
520
  queryParams: []
458
521
  },
459
522
  "merge-document-tags": {
460
523
  serviceClass: "Documents",
461
524
  operationId: "mergeDocumentTags",
462
- pathParams: ["id"],
525
+ description: "Merge document tags",
526
+ pathParams: ["document_id"],
463
527
  queryParams: []
464
528
  },
465
529
  "search-documents": {
466
530
  serviceClass: "Documents",
467
531
  operationId: "searchDocuments",
532
+ description: "Semantic search over documents",
468
533
  pathParams: [],
469
534
  queryParams: []
470
535
  },
471
536
  "list-files": {
472
537
  serviceClass: "Files",
473
538
  operationId: "listFiles",
539
+ description: "List all files",
474
540
  pathParams: [],
475
- queryParams: ["limit", "offset"]
541
+ queryParams: ["project_id", "limit", "offset"]
476
542
  },
477
543
  "create-file": {
478
544
  serviceClass: "Files",
479
545
  operationId: "createFile",
546
+ description: "Create a file",
480
547
  pathParams: [],
481
548
  queryParams: []
482
549
  },
483
550
  "upload-file": {
484
551
  serviceClass: "Files",
485
552
  operationId: "uploadFile",
553
+ description: "Upload a file",
486
554
  pathParams: [],
487
555
  queryParams: []
488
556
  },
489
557
  "upload-file-base64": {
490
558
  serviceClass: "Files",
491
559
  operationId: "uploadFileBase64",
560
+ description: "Upload a file using base64 encoding",
492
561
  pathParams: [],
493
562
  queryParams: []
494
563
  },
495
564
  "get-file": {
496
565
  serviceClass: "Files",
497
566
  operationId: "getFile",
498
- pathParams: ["id"],
567
+ description: "Get a file by ID",
568
+ pathParams: ["file_id"],
499
569
  queryParams: []
500
570
  },
501
571
  "delete-file": {
502
572
  serviceClass: "Files",
503
573
  operationId: "deleteFile",
504
- pathParams: ["id"],
574
+ description: "Delete a file",
575
+ pathParams: ["file_id"],
505
576
  queryParams: []
506
577
  },
507
578
  "download-file": {
508
579
  serviceClass: "Files",
509
580
  operationId: "downloadFile",
510
- pathParams: ["id"],
581
+ description: "Download a file",
582
+ pathParams: ["file_id"],
511
583
  queryParams: []
512
584
  },
513
585
  "update-file-metadata": {
514
586
  serviceClass: "Files",
515
587
  operationId: "updateFileMetadata",
516
- pathParams: ["id"],
588
+ description: "Update file metadata",
589
+ pathParams: ["file_id"],
517
590
  queryParams: []
518
591
  },
519
592
  "download-file-base64": {
520
593
  serviceClass: "Files",
521
594
  operationId: "downloadFileBase64",
522
- pathParams: ["id"],
595
+ description: "Download file as base64",
596
+ pathParams: ["file_id"],
523
597
  queryParams: []
524
598
  },
525
599
  "get-file-tags": {
526
600
  serviceClass: "Files",
527
601
  operationId: "getFileTags",
528
- pathParams: ["id"],
602
+ description: "Get file tags",
603
+ pathParams: ["file_id"],
529
604
  queryParams: []
530
605
  },
531
606
  "replace-file-tags": {
532
607
  serviceClass: "Files",
533
608
  operationId: "replaceFileTags",
534
- pathParams: ["id"],
609
+ description: "Replace file tags",
610
+ pathParams: ["file_id"],
535
611
  queryParams: []
536
612
  },
537
613
  "merge-file-tags": {
538
614
  serviceClass: "Files",
539
615
  operationId: "mergeFileTags",
540
- pathParams: ["id"],
616
+ description: "Merge file tags",
617
+ pathParams: ["file_id"],
541
618
  queryParams: []
542
619
  },
543
620
  "list-policies": {
544
621
  serviceClass: "Policies",
545
622
  operationId: "listPolicies",
623
+ description: "List all policies",
546
624
  pathParams: [],
547
625
  queryParams: []
548
626
  },
549
627
  "create-policy": {
550
628
  serviceClass: "Policies",
551
629
  operationId: "createPolicy",
630
+ description: "Create a policy",
552
631
  pathParams: [],
553
632
  queryParams: []
554
633
  },
555
634
  "get-policy": {
556
635
  serviceClass: "Policies",
557
636
  operationId: "getPolicy",
558
- pathParams: ["policyId"],
637
+ description: "Get a policy",
638
+ pathParams: ["policy_id"],
559
639
  queryParams: []
560
640
  },
561
641
  "update-policy": {
562
642
  serviceClass: "Policies",
563
643
  operationId: "updatePolicy",
564
- pathParams: ["policyId"],
644
+ description: "Update a policy",
645
+ pathParams: ["policy_id"],
565
646
  queryParams: []
566
647
  },
567
648
  "delete-policy": {
568
649
  serviceClass: "Policies",
569
650
  operationId: "deletePolicy",
570
- pathParams: ["policyId"],
651
+ description: "Delete a policy",
652
+ pathParams: ["policy_id"],
571
653
  queryParams: []
572
654
  },
573
655
  "create-project": {
574
656
  serviceClass: "Projects",
575
657
  operationId: "createProject",
658
+ description: "Create a project",
576
659
  pathParams: [],
577
660
  queryParams: []
578
661
  },
579
662
  "get-project": {
580
663
  serviceClass: "Projects",
581
664
  operationId: "getProject",
582
- pathParams: ["projectId"],
665
+ description: "Get a project",
666
+ pathParams: ["project_id"],
583
667
  queryParams: []
584
668
  },
585
669
  "delete-project": {
586
670
  serviceClass: "Projects",
587
671
  operationId: "deleteProject",
588
- pathParams: ["projectId"],
672
+ description: "Delete a project",
673
+ pathParams: ["project_id"],
589
674
  queryParams: []
590
675
  },
591
676
  "list-secrets": {
592
677
  serviceClass: "Secrets",
593
678
  operationId: "listSecrets",
679
+ description: "List secrets",
594
680
  pathParams: [],
595
681
  queryParams: ["project_id", "limit", "offset"]
596
682
  },
597
683
  "create-secret": {
598
684
  serviceClass: "Secrets",
599
685
  operationId: "createSecret",
686
+ description: "Create a secret",
600
687
  pathParams: [],
601
688
  queryParams: []
602
689
  },
603
690
  "get-secret": {
604
691
  serviceClass: "Secrets",
605
692
  operationId: "getSecret",
606
- pathParams: ["secretId"],
693
+ description: "Get a secret",
694
+ pathParams: ["secret_id"],
607
695
  queryParams: []
608
696
  },
609
697
  "update-secret": {
610
698
  serviceClass: "Secrets",
611
699
  operationId: "updateSecret",
612
- pathParams: ["secretId"],
700
+ description: "Update a secret",
701
+ pathParams: ["secret_id"],
613
702
  queryParams: []
614
703
  },
615
704
  "delete-secret": {
616
705
  serviceClass: "Secrets",
617
706
  operationId: "deleteSecret",
618
- pathParams: ["secretId"],
707
+ description: "Delete a secret",
708
+ pathParams: ["secret_id"],
619
709
  queryParams: []
620
710
  },
621
711
  "list-agent-sessions": {
622
712
  serviceClass: "Sessions",
623
713
  operationId: "listAgentSessions",
624
- pathParams: [],
714
+ description: "List sessions",
715
+ pathParams: ["agent_id"],
625
716
  queryParams: ["actor_id", "status", "limit", "offset"]
626
717
  },
627
718
  "create-agent-session": {
628
719
  serviceClass: "Sessions",
629
720
  operationId: "createAgentSession",
630
- pathParams: [],
721
+ description: "Create a session",
722
+ pathParams: ["agent_id"],
631
723
  queryParams: []
632
724
  },
633
725
  "get-agent-session": {
634
726
  serviceClass: "Sessions",
635
727
  operationId: "getAgentSession",
636
- pathParams: [],
728
+ description: "Get a session",
729
+ pathParams: ["agent_id", "session_id"],
637
730
  queryParams: []
638
731
  },
639
732
  "update-session": {
640
733
  serviceClass: "Sessions",
641
734
  operationId: "updateSession",
642
- pathParams: [],
735
+ description: "Update a session",
736
+ pathParams: ["agent_id", "session_id"],
643
737
  queryParams: []
644
738
  },
645
739
  "delete-agent-session": {
646
740
  serviceClass: "Sessions",
647
741
  operationId: "deleteAgentSession",
648
- pathParams: [],
742
+ description: "Delete a session",
743
+ pathParams: ["agent_id", "session_id"],
649
744
  queryParams: []
650
745
  },
651
746
  "list-agent-session-messages": {
652
747
  serviceClass: "Sessions",
653
748
  operationId: "listAgentSessionMessages",
654
- pathParams: [],
749
+ description: "List session messages",
750
+ pathParams: ["agent_id", "session_id"],
655
751
  queryParams: ["limit", "offset"]
656
752
  },
657
753
  "add-session-message": {
658
754
  serviceClass: "Sessions",
659
755
  operationId: "addSessionMessage",
660
- pathParams: [],
756
+ description: "Add a user message",
757
+ pathParams: ["agent_id", "session_id"],
661
758
  queryParams: []
662
759
  },
663
760
  "generate-session-response": {
664
761
  serviceClass: "Sessions",
665
762
  operationId: "generateSessionResponse",
666
- pathParams: [],
763
+ description: "Trigger agent generation",
764
+ pathParams: ["agent_id", "session_id"],
667
765
  queryParams: ["async"]
668
766
  },
669
767
  "submit-session-tool-outputs": {
670
768
  serviceClass: "Sessions",
671
769
  operationId: "submitSessionToolOutputs",
672
- pathParams: [],
770
+ description: "Submit tool outputs",
771
+ pathParams: ["agent_id", "session_id"],
673
772
  queryParams: []
674
773
  },
675
774
  "get-session-tags": {
676
775
  serviceClass: "Sessions",
677
776
  operationId: "getSessionTags",
678
- pathParams: [],
777
+ description: "Get session tags",
778
+ pathParams: ["agent_id", "session_id"],
679
779
  queryParams: []
680
780
  },
681
781
  "replace-session-tags": {
682
782
  serviceClass: "Sessions",
683
783
  operationId: "replaceSessionTags",
684
- pathParams: [],
784
+ description: "Replace session tags",
785
+ pathParams: ["agent_id", "session_id"],
685
786
  queryParams: []
686
787
  },
687
788
  "merge-session-tags": {
688
789
  serviceClass: "Sessions",
689
790
  operationId: "mergeSessionTags",
690
- pathParams: [],
791
+ description: "Merge session tags",
792
+ pathParams: ["agent_id", "session_id"],
691
793
  queryParams: []
692
794
  },
693
795
  "list-users": {
694
796
  serviceClass: "Users",
695
797
  operationId: "listUsers",
798
+ description: "List all users",
696
799
  pathParams: [],
697
800
  queryParams: []
698
801
  },
699
802
  "create-user": {
700
803
  serviceClass: "Users",
701
804
  operationId: "createUser",
805
+ description: "Create a user",
702
806
  pathParams: [],
703
807
  queryParams: []
704
808
  },
705
809
  "get-user": {
706
810
  serviceClass: "Users",
707
811
  operationId: "getUser",
708
- pathParams: ["id"],
812
+ description: "Get a user by ID",
813
+ pathParams: ["user_id"],
709
814
  queryParams: []
710
815
  },
711
816
  "delete-user": {
712
817
  serviceClass: "Users",
713
818
  operationId: "deleteUser",
714
- pathParams: ["id"],
819
+ description: "Delete a user by ID",
820
+ pathParams: ["user_id"],
715
821
  queryParams: []
716
822
  },
717
823
  "bootstrap-user": {
718
824
  serviceClass: "Users",
719
825
  operationId: "bootstrapUser",
826
+ description: "Create the first admin user",
720
827
  pathParams: [],
721
828
  queryParams: []
722
829
  },
723
830
  "login-user": {
724
831
  serviceClass: "Users",
725
832
  operationId: "loginUser",
833
+ description: "Login user",
726
834
  pathParams: [],
727
835
  queryParams: []
728
836
  },
729
837
  "get-user-policies": {
730
838
  serviceClass: "Users",
731
839
  operationId: "getUserPolicies",
732
- pathParams: ["userId"],
840
+ description: "Get policies attached to a user",
841
+ pathParams: ["user_id"],
733
842
  queryParams: []
734
843
  },
735
844
  "attach-user-policies": {
736
845
  serviceClass: "Users",
737
846
  operationId: "attachUserPolicies",
738
- pathParams: ["userId"],
847
+ description: "Attach policies to a user",
848
+ pathParams: ["user_id"],
739
849
  queryParams: []
740
850
  },
741
851
  "list-webhooks": {
742
852
  serviceClass: "Webhooks",
743
853
  operationId: "listWebhooks",
744
- pathParams: ["projectId"],
854
+ description: "List webhooks for a project",
855
+ pathParams: ["project_id"],
745
856
  queryParams: []
746
857
  },
747
858
  "create-webhook": {
748
859
  serviceClass: "Webhooks",
749
860
  operationId: "createWebhook",
750
- pathParams: ["projectId"],
861
+ description: "Create a webhook",
862
+ pathParams: ["project_id"],
751
863
  queryParams: []
752
864
  },
753
865
  "get-webhook": {
754
866
  serviceClass: "Webhooks",
755
867
  operationId: "getWebhook",
756
- pathParams: ["projectId", "webhookId"],
868
+ description: "Get a webhook",
869
+ pathParams: ["project_id", "webhook_id"],
757
870
  queryParams: []
758
871
  },
759
872
  "update-webhook": {
760
873
  serviceClass: "Webhooks",
761
874
  operationId: "updateWebhook",
762
- pathParams: ["projectId", "webhookId"],
875
+ description: "Update a webhook",
876
+ pathParams: ["project_id", "webhook_id"],
763
877
  queryParams: []
764
878
  },
765
879
  "delete-webhook": {
766
880
  serviceClass: "Webhooks",
767
881
  operationId: "deleteWebhook",
768
- pathParams: ["projectId", "webhookId"],
882
+ description: "Delete a webhook",
883
+ pathParams: ["project_id", "webhook_id"],
769
884
  queryParams: []
770
885
  },
771
886
  "list-webhook-deliveries": {
772
887
  serviceClass: "Webhooks",
773
888
  operationId: "listWebhookDeliveries",
774
- pathParams: ["projectId", "webhookId"],
889
+ description: "List deliveries for a webhook",
890
+ pathParams: ["project_id", "webhook_id"],
775
891
  queryParams: ["limit", "offset"]
776
892
  },
777
893
  "get-webhook-delivery": {
778
894
  serviceClass: "Webhooks",
779
895
  operationId: "getWebhookDelivery",
780
- pathParams: ["projectId", "webhookId", "deliveryId"],
896
+ description: "Get a delivery",
897
+ pathParams: ["project_id", "webhook_id", "delivery_id"],
781
898
  queryParams: []
782
899
  },
783
900
  "rotate-webhook-secret": {
784
901
  serviceClass: "Webhooks",
785
902
  operationId: "rotateWebhookSecret",
786
- pathParams: ["projectId", "webhookId"],
903
+ description: "Rotate webhook secret",
904
+ pathParams: ["project_id", "webhook_id"],
787
905
  queryParams: []
788
906
  }
789
907
  };
790
908
 
791
909
  // src/index.ts
792
- var kebabToCamel = /* @__PURE__ */__name(s => {
793
- return s.replace(/-([a-z])/g, (_, c) => {
910
+ var toCanonical = /* @__PURE__ */__name(s => {
911
+ return s.replace(/[-_]([a-z0-9])/g, (_, c) => {
794
912
  return c.toUpperCase();
795
913
  });
796
- }, "kebabToCamel");
914
+ }, "toCanonical");
915
+ var kebabToSnake = /* @__PURE__ */__name(s => {
916
+ return s.replace(/-/g, "_");
917
+ }, "kebabToSnake");
797
918
  var parseUnknown = /* @__PURE__ */__name(args => {
798
919
  const result = {};
799
920
  for (let i = 0; i < args.length; i++) {
@@ -857,9 +978,122 @@ program.command("list-commands").description("List all available API commands").
857
978
  return k.length;
858
979
  }));
859
980
  for (const [cmd, r] of Object.entries(routes).sort()) {
860
- console.log(` ${cmd.padEnd(pad)} ${r.serviceClass}.${r.operationId}`);
981
+ console.log(` ${cmd.padEnd(pad)} ${r.description}`);
861
982
  }
862
983
  });
984
+ var matchesFilter = /* @__PURE__ */__name((eventType, filter) => {
985
+ const patterns = filter.split(",").map(part => {
986
+ return part.trim();
987
+ }).filter(Boolean);
988
+ if (patterns.length === 0) return true;
989
+ return patterns.some(pattern => {
990
+ if (pattern === "*") return true;
991
+ if (pattern.endsWith("*")) {
992
+ return eventType.startsWith(pattern.slice(0, -1));
993
+ }
994
+ return eventType === pattern;
995
+ });
996
+ }, "matchesFilter");
997
+ var verifySignature = /* @__PURE__ */__name((secret, payload, signatureHeader) => {
998
+ const expected = createHmac("sha256", secret).update(payload).digest("hex");
999
+ const expectedBuffer = Buffer.from(expected, "utf8");
1000
+ const actualBuffer = Buffer.from(signatureHeader, "utf8");
1001
+ if (expectedBuffer.length !== actualBuffer.length) return false;
1002
+ return timingSafeEqual(expectedBuffer, actualBuffer);
1003
+ }, "verifySignature");
1004
+ 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 => {
1005
+ const port = Number(opts.port);
1006
+ const path2 = opts.path;
1007
+ const secret = opts.secret;
1008
+ const filter = opts.filter;
1009
+ const asJson = Boolean(opts.json);
1010
+ if (!Number.isInteger(port) || port <= 0) {
1011
+ console.error("Invalid port. Use a positive integer.");
1012
+ process.exit(1);
1013
+ }
1014
+ const server = createServer((req, res) => {
1015
+ if (req.method !== "POST" || req.url !== path2) {
1016
+ res.writeHead(404, {
1017
+ "Content-Type": "application/json"
1018
+ });
1019
+ res.end(JSON.stringify({
1020
+ error: "not found"
1021
+ }));
1022
+ return;
1023
+ }
1024
+ const chunks = [];
1025
+ req.on("data", chunk => {
1026
+ chunks.push(chunk);
1027
+ });
1028
+ req.on("end", () => {
1029
+ const rawBody = Buffer.concat(chunks).toString("utf8");
1030
+ const eventType = String(req.headers["x-soat-event"] ?? "unknown");
1031
+ const deliveryId = String(req.headers["x-soat-delivery"] ?? "unknown");
1032
+ const signature = String(req.headers["x-soat-signature"] ?? "");
1033
+ if (filter && !matchesFilter(eventType, filter)) {
1034
+ res.writeHead(200, {
1035
+ "Content-Type": "application/json"
1036
+ });
1037
+ res.end(JSON.stringify({
1038
+ ok: true,
1039
+ skipped: true
1040
+ }));
1041
+ return;
1042
+ }
1043
+ let parsedPayload = rawBody;
1044
+ try {
1045
+ parsedPayload = JSON.parse(rawBody);
1046
+ } catch {}
1047
+ let isSignatureValid = null;
1048
+ if (secret) {
1049
+ isSignatureValid = verifySignature(secret, rawBody, signature);
1050
+ }
1051
+ const record = {
1052
+ timestamp: (/* @__PURE__ */new Date()).toISOString(),
1053
+ event_type: eventType,
1054
+ delivery_id: deliveryId,
1055
+ signature,
1056
+ signature_valid: isSignatureValid,
1057
+ payload: parsedPayload
1058
+ };
1059
+ if (asJson) {
1060
+ console.log(JSON.stringify(record));
1061
+ } else {
1062
+ console.log("--- webhook received ---");
1063
+ console.log("event_type:", eventType);
1064
+ console.log("delivery_id:", deliveryId);
1065
+ if (secret) {
1066
+ console.log("signature_valid:", isSignatureValid);
1067
+ }
1068
+ console.log("payload:", JSON.stringify(parsedPayload, null, 2));
1069
+ }
1070
+ const responseStatus = secret && isSignatureValid === false ? 401 : 200;
1071
+ res.writeHead(responseStatus, {
1072
+ "Content-Type": "application/json"
1073
+ });
1074
+ res.end(JSON.stringify({
1075
+ ok: responseStatus === 200,
1076
+ event_type: eventType,
1077
+ delivery_id: deliveryId,
1078
+ signature_valid: isSignatureValid
1079
+ }));
1080
+ });
1081
+ });
1082
+ server.listen(port, () => {
1083
+ console.log(`Listening for SOAT webhooks on http://localhost:${port}${path2}`);
1084
+ if (filter) {
1085
+ console.log(`Filter: ${filter}`);
1086
+ }
1087
+ if (secret) {
1088
+ console.log("Signature verification: enabled");
1089
+ }
1090
+ });
1091
+ process.on("SIGINT", () => {
1092
+ server.close(() => {
1093
+ process.exit(0);
1094
+ });
1095
+ });
1096
+ });
863
1097
  program.argument("[command]", "API command in kebab-case (e.g. list-actors)").argument("[args...]").allowUnknownOption().action(async commandName => {
864
1098
  if (!commandName) {
865
1099
  program.help();
@@ -879,14 +1113,20 @@ program.argument("[command]", "API command in kebab-case (e.g. list-actors)").ar
879
1113
  const bodyArgs = {};
880
1114
  for (const [flagKey, val] of Object.entries(flags)) {
881
1115
  if (flagKey === "profile") continue;
882
- const camel = kebabToCamel(flagKey);
1116
+ const canonical = toCanonical(flagKey);
883
1117
  const parsedValue = parseFlagValue(val);
884
- if (route.pathParams.includes(flagKey)) {
885
- pathArgs[camel] = parsedValue;
886
- } else if (route.queryParams.includes(flagKey)) {
887
- queryArgs[camel] = parsedValue;
1118
+ const pathParam = route.pathParams.find(p => {
1119
+ return toCanonical(p) === canonical;
1120
+ });
1121
+ const queryParam = route.queryParams.find(p => {
1122
+ return toCanonical(p) === canonical;
1123
+ });
1124
+ if (pathParam) {
1125
+ pathArgs[pathParam] = parsedValue;
1126
+ } else if (queryParam) {
1127
+ queryArgs[queryParam] = parsedValue;
888
1128
  } else {
889
- bodyArgs[camel] = parsedValue;
1129
+ bodyArgs[kebabToSnake(flagKey)] = parsedValue;
890
1130
  }
891
1131
  }
892
1132
  const profileOpt = flags["profile"] ?? program.opts().profile;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@soat/cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@inquirer/input": "^5.0.12",
7
7
  "@inquirer/password": "^5.0.12",
8
8
  "@ttoss/logger": "^0.8.10",
9
9
  "commander": "^14.0.3",
10
- "@soat/sdk": "0.4.3"
10
+ "@soat/sdk": "0.4.5"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@ttoss/config": "^1.37.10",
@@ -33,6 +33,8 @@
33
33
  },
34
34
  "scripts": {
35
35
  "generate": "tsx scripts/generate.ts",
36
+ "lint": "eslint src",
37
+ "typecheck": "tsc --noEmit",
36
38
  "build": "pnpm generate && tsup"
37
39
  }
38
40
  }