@getmodus/sdk 0.2.1 → 0.2.3

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/dist/index.cjs CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  APIConnectionError: () => APIConnectionError,
24
+ AgentType: () => AgentType,
24
25
  AuthenticationError: () => AuthenticationError,
25
26
  ChatStream: () => ChatStream,
26
27
  ConflictError: () => ConflictError,
@@ -46,7 +47,7 @@ var OPERATIONS = {
46
47
  method: "GET",
47
48
  path: "/api/v1/connections",
48
49
  service: "modus-api",
49
- serverUrl: "https://api.modus.com",
50
+ serverUrl: "https://api.getmodus.com",
50
51
  pathParams: [],
51
52
  queryParams: ["pageToken", "pageSize", "type"],
52
53
  requestSchema: null,
@@ -56,7 +57,7 @@ var OPERATIONS = {
56
57
  method: "POST",
57
58
  path: "/api/v1/context/links",
58
59
  service: "modus-api",
59
- serverUrl: "https://api.modus.com",
60
+ serverUrl: "https://api.getmodus.com",
60
61
  pathParams: [],
61
62
  queryParams: [],
62
63
  requestSchema: "CreateLinkDto",
@@ -66,7 +67,7 @@ var OPERATIONS = {
66
67
  method: "POST",
67
68
  path: "/api/v1/context/notes",
68
69
  service: "modus-api",
69
- serverUrl: "https://api.modus.com",
70
+ serverUrl: "https://api.getmodus.com",
70
71
  pathParams: [],
71
72
  queryParams: [],
72
73
  requestSchema: "CreateNoteDto",
@@ -76,7 +77,7 @@ var OPERATIONS = {
76
77
  method: "POST",
77
78
  path: "/api/v1/context/saved-queries",
78
79
  service: "modus-api",
79
- serverUrl: "https://api.modus.com",
80
+ serverUrl: "https://api.getmodus.com",
80
81
  pathParams: [],
81
82
  queryParams: [],
82
83
  requestSchema: "CreateSavedQueryDto",
@@ -86,7 +87,7 @@ var OPERATIONS = {
86
87
  method: "DELETE",
87
88
  path: "/api/v1/context/items/{uid}",
88
89
  service: "modus-api",
89
- serverUrl: "https://api.modus.com",
90
+ serverUrl: "https://api.getmodus.com",
90
91
  pathParams: ["uid"],
91
92
  queryParams: [],
92
93
  requestSchema: null,
@@ -96,7 +97,7 @@ var OPERATIONS = {
96
97
  method: "GET",
97
98
  path: "/api/v1/context/items/{uid}",
98
99
  service: "modus-api",
99
- serverUrl: "https://api.modus.com",
100
+ serverUrl: "https://api.getmodus.com",
100
101
  pathParams: ["uid"],
101
102
  queryParams: [],
102
103
  requestSchema: null,
@@ -106,7 +107,7 @@ var OPERATIONS = {
106
107
  method: "GET",
107
108
  path: "/api/v1/context/items",
108
109
  service: "modus-api",
109
- serverUrl: "https://api.modus.com",
110
+ serverUrl: "https://api.getmodus.com",
110
111
  pathParams: [],
111
112
  queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
112
113
  requestSchema: null,
@@ -116,7 +117,7 @@ var OPERATIONS = {
116
117
  method: "GET",
117
118
  path: "/api/v1/context/items/{uid}/values",
118
119
  service: "modus-api",
119
- serverUrl: "https://api.modus.com",
120
+ serverUrl: "https://api.getmodus.com",
120
121
  pathParams: ["uid"],
121
122
  queryParams: ["contextType", "contentKeyPath", "pageSize", "offset", "pageToken", "searchQuery", "dataPathPrefix"],
122
123
  requestSchema: null,
@@ -126,7 +127,7 @@ var OPERATIONS = {
126
127
  method: "POST",
127
128
  path: "/api/v1/context/items/lookup",
128
129
  service: "modus-api",
129
- serverUrl: "https://api.modus.com",
130
+ serverUrl: "https://api.getmodus.com",
130
131
  pathParams: [],
131
132
  queryParams: [],
132
133
  requestSchema: "LookupContextItemDto",
@@ -136,7 +137,7 @@ var OPERATIONS = {
136
137
  method: "PATCH",
137
138
  path: "/api/v1/context/items/{uid}",
138
139
  service: "modus-api",
139
- serverUrl: "https://api.modus.com",
140
+ serverUrl: "https://api.getmodus.com",
140
141
  pathParams: ["uid"],
141
142
  queryParams: ["updateMask"],
142
143
  requestSchema: "UpdateContextItemDto",
@@ -146,7 +147,7 @@ var OPERATIONS = {
146
147
  method: "POST",
147
148
  path: "/api/v1/context/custom-items/batch",
148
149
  service: "modus-api",
149
- serverUrl: "https://api.modus.com",
150
+ serverUrl: "https://api.getmodus.com",
150
151
  pathParams: [],
151
152
  queryParams: [],
152
153
  requestSchema: "BatchCreateCustomContextItemsDto",
@@ -156,7 +157,7 @@ var OPERATIONS = {
156
157
  method: "POST",
157
158
  path: "/api/v1/context/custom-items",
158
159
  service: "modus-api",
159
- serverUrl: "https://api.modus.com",
160
+ serverUrl: "https://api.getmodus.com",
160
161
  pathParams: [],
161
162
  queryParams: [],
162
163
  requestSchema: "CreateCustomContextItemDto",
@@ -166,7 +167,7 @@ var OPERATIONS = {
166
167
  method: "DELETE",
167
168
  path: "/api/v1/context/custom-items/{uid}",
168
169
  service: "modus-api",
169
- serverUrl: "https://api.modus.com",
170
+ serverUrl: "https://api.getmodus.com",
170
171
  pathParams: ["uid"],
171
172
  queryParams: [],
172
173
  requestSchema: null,
@@ -176,7 +177,7 @@ var OPERATIONS = {
176
177
  method: "GET",
177
178
  path: "/api/v1/context/custom-items/{uid}",
178
179
  service: "modus-api",
179
- serverUrl: "https://api.modus.com",
180
+ serverUrl: "https://api.getmodus.com",
180
181
  pathParams: ["uid"],
181
182
  queryParams: [],
182
183
  requestSchema: null,
@@ -186,7 +187,7 @@ var OPERATIONS = {
186
187
  method: "GET",
187
188
  path: "/api/v1/context/custom-items",
188
189
  service: "modus-api",
189
- serverUrl: "https://api.modus.com",
190
+ serverUrl: "https://api.getmodus.com",
190
191
  pathParams: [],
191
192
  queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
192
193
  requestSchema: null,
@@ -196,7 +197,7 @@ var OPERATIONS = {
196
197
  method: "PATCH",
197
198
  path: "/api/v1/context/custom-items/{uid}",
198
199
  service: "modus-api",
199
- serverUrl: "https://api.modus.com",
200
+ serverUrl: "https://api.getmodus.com",
200
201
  pathParams: ["uid"],
201
202
  queryParams: [],
202
203
  requestSchema: "UpdateCustomContextItemDto",
@@ -206,7 +207,7 @@ var OPERATIONS = {
206
207
  method: "GET",
207
208
  path: "/api/v1/scopes/{id}/evaluations/config",
208
209
  service: "modus-api",
209
- serverUrl: "https://api.modus.com",
210
+ serverUrl: "https://api.getmodus.com",
210
211
  pathParams: ["id"],
211
212
  queryParams: [],
212
213
  requestSchema: null,
@@ -216,7 +217,7 @@ var OPERATIONS = {
216
217
  method: "GET",
217
218
  path: "/api/v1/scopes/{id}/evaluations/runs/{runId}",
218
219
  service: "modus-api",
219
- serverUrl: "https://api.modus.com",
220
+ serverUrl: "https://api.getmodus.com",
220
221
  pathParams: ["id", "runId"],
221
222
  queryParams: [],
222
223
  requestSchema: null,
@@ -226,7 +227,7 @@ var OPERATIONS = {
226
227
  method: "GET",
227
228
  path: "/api/v1/scopes/{id}/evaluations/runs",
228
229
  service: "modus-api",
229
- serverUrl: "https://api.modus.com",
230
+ serverUrl: "https://api.getmodus.com",
230
231
  pathParams: ["id"],
231
232
  queryParams: ["pageSize", "pageToken"],
232
233
  requestSchema: null,
@@ -236,7 +237,7 @@ var OPERATIONS = {
236
237
  method: "POST",
237
238
  path: "/api/v1/scopes/{id}/evaluations/runs",
238
239
  service: "modus-api",
239
- serverUrl: "https://api.modus.com",
240
+ serverUrl: "https://api.getmodus.com",
240
241
  pathParams: ["id"],
241
242
  queryParams: [],
242
243
  requestSchema: null,
@@ -246,7 +247,7 @@ var OPERATIONS = {
246
247
  method: "PUT",
247
248
  path: "/api/v1/scopes/{id}/evaluations/config",
248
249
  service: "modus-api",
249
- serverUrl: "https://api.modus.com",
250
+ serverUrl: "https://api.getmodus.com",
250
251
  pathParams: ["id"],
251
252
  queryParams: [],
252
253
  requestSchema: "UpdateEvaluationConfigDto",
@@ -256,7 +257,7 @@ var OPERATIONS = {
256
257
  method: "GET",
257
258
  path: "/api/v1/users/member-groups",
258
259
  service: "modus-api",
259
- serverUrl: "https://api.modus.com",
260
+ serverUrl: "https://api.getmodus.com",
260
261
  pathParams: [],
261
262
  queryParams: ["pageSize", "pageToken"],
262
263
  requestSchema: null,
@@ -266,7 +267,7 @@ var OPERATIONS = {
266
267
  method: "POST",
267
268
  path: "/api/v1/modus/chat",
268
269
  service: "modus-api",
269
- serverUrl: "https://api.modus.com",
270
+ serverUrl: "https://api.getmodus.com",
270
271
  pathParams: [],
271
272
  queryParams: [],
272
273
  requestSchema: "ModusChatRequestDto",
@@ -276,7 +277,7 @@ var OPERATIONS = {
276
277
  method: "POST",
277
278
  path: "/api/v1/modus/conversations/{threadId}/chat",
278
279
  service: "modus-api",
279
- serverUrl: "https://api.modus.com",
280
+ serverUrl: "https://api.getmodus.com",
280
281
  pathParams: ["threadId"],
281
282
  queryParams: [],
282
283
  requestSchema: "ModusChatRequestDto",
@@ -286,7 +287,7 @@ var OPERATIONS = {
286
287
  method: "POST",
287
288
  path: "/api/v1/modus/context",
288
289
  service: "modus-api",
289
- serverUrl: "https://api.modus.com",
290
+ serverUrl: "https://api.getmodus.com",
290
291
  pathParams: [],
291
292
  queryParams: [],
292
293
  requestSchema: "ModusContextRequestDto",
@@ -296,7 +297,7 @@ var OPERATIONS = {
296
297
  method: "GET",
297
298
  path: "/api/v1/modus/conversations/{threadId}",
298
299
  service: "modus-api",
299
- serverUrl: "https://api.modus.com",
300
+ serverUrl: "https://api.getmodus.com",
300
301
  pathParams: ["threadId"],
301
302
  queryParams: [],
302
303
  requestSchema: null,
@@ -306,7 +307,7 @@ var OPERATIONS = {
306
307
  method: "GET",
307
308
  path: "/api/v1/modus/conversations",
308
309
  service: "modus-api",
309
- serverUrl: "https://api.modus.com",
310
+ serverUrl: "https://api.getmodus.com",
310
311
  pathParams: [],
311
312
  queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools", "kind"],
312
313
  requestSchema: null,
@@ -316,7 +317,7 @@ var OPERATIONS = {
316
317
  method: "POST",
317
318
  path: "/agent/v1/modus/runs",
318
319
  service: "agent-service",
319
- serverUrl: "https://agent.modus.com",
320
+ serverUrl: "https://agent.getmodus.com",
320
321
  pathParams: [],
321
322
  queryParams: [],
322
323
  requestSchema: "ModusRunDto",
@@ -326,7 +327,7 @@ var OPERATIONS = {
326
327
  method: "GET",
327
328
  path: "/api/v1/users/org-members",
328
329
  service: "modus-api",
329
- serverUrl: "https://api.modus.com",
330
+ serverUrl: "https://api.getmodus.com",
330
331
  pathParams: [],
331
332
  queryParams: ["pageSize", "pageToken"],
332
333
  requestSchema: null,
@@ -336,7 +337,7 @@ var OPERATIONS = {
336
337
  method: "DELETE",
337
338
  path: "/api/v1/users/organization",
338
339
  service: "modus-api",
339
- serverUrl: "https://api.modus.com",
340
+ serverUrl: "https://api.getmodus.com",
340
341
  pathParams: [],
341
342
  queryParams: [],
342
343
  requestSchema: null,
@@ -346,7 +347,7 @@ var OPERATIONS = {
346
347
  method: "POST",
347
348
  path: "/agent/v1/runs/{runId}/resume",
348
349
  service: "agent-service",
349
- serverUrl: "https://agent.modus.com",
350
+ serverUrl: "https://agent.getmodus.com",
350
351
  pathParams: ["runId"],
351
352
  queryParams: [],
352
353
  requestSchema: "ResumeRunDto",
@@ -356,7 +357,7 @@ var OPERATIONS = {
356
357
  method: "GET",
357
358
  path: "/agent/v1/runs/active",
358
359
  service: "agent-service",
359
- serverUrl: "https://agent.modus.com",
360
+ serverUrl: "https://agent.getmodus.com",
360
361
  pathParams: [],
361
362
  queryParams: ["pageToken", "pageSize"],
362
363
  requestSchema: null,
@@ -366,7 +367,7 @@ var OPERATIONS = {
366
367
  method: "POST",
367
368
  path: "/agent/v1/runs/active-by-session",
368
369
  service: "agent-service",
369
- serverUrl: "https://agent.modus.com",
370
+ serverUrl: "https://agent.getmodus.com",
370
371
  pathParams: [],
371
372
  queryParams: [],
372
373
  requestSchema: "ActiveRunsBySessionDto",
@@ -376,7 +377,7 @@ var OPERATIONS = {
376
377
  method: "POST",
377
378
  path: "/agent/v1/runs/{runId}/cancel",
378
379
  service: "agent-service",
379
- serverUrl: "https://agent.modus.com",
380
+ serverUrl: "https://agent.getmodus.com",
380
381
  pathParams: ["runId"],
381
382
  queryParams: [],
382
383
  requestSchema: "CancelRunDto",
@@ -386,7 +387,7 @@ var OPERATIONS = {
386
387
  method: "POST",
387
388
  path: "/agent/v1/runs/{runId}/queue-edit",
388
389
  service: "agent-service",
389
- serverUrl: "https://agent.modus.com",
390
+ serverUrl: "https://agent.getmodus.com",
390
391
  pathParams: ["runId"],
391
392
  queryParams: [],
392
393
  requestSchema: "EditQueuedRunDto",
@@ -396,7 +397,7 @@ var OPERATIONS = {
396
397
  method: "GET",
397
398
  path: "/agent/v1/runs/{runId}/events",
398
399
  service: "agent-service",
399
- serverUrl: "https://agent.modus.com",
400
+ serverUrl: "https://agent.getmodus.com",
400
401
  pathParams: ["runId"],
401
402
  queryParams: [],
402
403
  requestSchema: null,
@@ -406,7 +407,7 @@ var OPERATIONS = {
406
407
  method: "POST",
407
408
  path: "/agent/v1/runs/{runId}/interrupt",
408
409
  service: "agent-service",
409
- serverUrl: "https://agent.modus.com",
410
+ serverUrl: "https://agent.getmodus.com",
410
411
  pathParams: ["runId"],
411
412
  queryParams: [],
412
413
  requestSchema: "InterruptRunDto",
@@ -416,7 +417,7 @@ var OPERATIONS = {
416
417
  method: "GET",
417
418
  path: "/agent/v1/runs/{runId}/stream",
418
419
  service: "agent-service",
419
- serverUrl: "https://agent.modus.com",
420
+ serverUrl: "https://agent.getmodus.com",
420
421
  pathParams: ["runId"],
421
422
  queryParams: [],
422
423
  requestSchema: null,
@@ -426,7 +427,7 @@ var OPERATIONS = {
426
427
  method: "POST",
427
428
  path: "/api/v1/scopes/{id}/chat",
428
429
  service: "modus-api",
429
- serverUrl: "https://api.modus.com",
430
+ serverUrl: "https://api.getmodus.com",
430
431
  pathParams: ["id"],
431
432
  queryParams: [],
432
433
  requestSchema: "SkillChatRequestDto",
@@ -436,7 +437,7 @@ var OPERATIONS = {
436
437
  method: "POST",
437
438
  path: "/api/v1/scopes/{id}/conversations/{threadId}/chat",
438
439
  service: "modus-api",
439
- serverUrl: "https://api.modus.com",
440
+ serverUrl: "https://api.getmodus.com",
440
441
  pathParams: ["id", "threadId"],
441
442
  queryParams: [],
442
443
  requestSchema: "SkillChatRequestDto",
@@ -446,7 +447,7 @@ var OPERATIONS = {
446
447
  method: "POST",
447
448
  path: "/api/v1/scopes/{id}/context",
448
449
  service: "modus-api",
449
- serverUrl: "https://api.modus.com",
450
+ serverUrl: "https://api.getmodus.com",
450
451
  pathParams: ["id"],
451
452
  queryParams: [],
452
453
  requestSchema: "ComposeSkillContextRequestDto",
@@ -456,7 +457,7 @@ var OPERATIONS = {
456
457
  method: "GET",
457
458
  path: "/api/v1/scopes/{id}/conversations/{threadId}",
458
459
  service: "modus-api",
459
- serverUrl: "https://api.modus.com",
460
+ serverUrl: "https://api.getmodus.com",
460
461
  pathParams: ["id", "threadId"],
461
462
  queryParams: ["messageLimit", "beforeMessageIndex"],
462
463
  requestSchema: null,
@@ -466,7 +467,7 @@ var OPERATIONS = {
466
467
  method: "GET",
467
468
  path: "/api/v1/scopes/{id}/conversations",
468
469
  service: "modus-api",
469
- serverUrl: "https://api.modus.com",
470
+ serverUrl: "https://api.getmodus.com",
470
471
  pathParams: ["id"],
471
472
  queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools"],
472
473
  requestSchema: null,
@@ -476,7 +477,7 @@ var OPERATIONS = {
476
477
  method: "DELETE",
477
478
  path: "/api/v1/scopes/{id}/memories/{memoryId}",
478
479
  service: "modus-api",
479
- serverUrl: "https://api.modus.com",
480
+ serverUrl: "https://api.getmodus.com",
480
481
  pathParams: ["id", "memoryId"],
481
482
  queryParams: [],
482
483
  requestSchema: null,
@@ -486,7 +487,7 @@ var OPERATIONS = {
486
487
  method: "GET",
487
488
  path: "/api/v1/scopes/{id}/memories",
488
489
  service: "modus-api",
489
- serverUrl: "https://api.modus.com",
490
+ serverUrl: "https://api.getmodus.com",
490
491
  pathParams: ["id"],
491
492
  queryParams: ["pageToken", "pageSize", "userId", "limit"],
492
493
  requestSchema: null,
@@ -496,7 +497,7 @@ var OPERATIONS = {
496
497
  method: "POST",
497
498
  path: "/api/v1/scopes/{id}/memories/search",
498
499
  service: "modus-api",
499
- serverUrl: "https://api.modus.com",
500
+ serverUrl: "https://api.getmodus.com",
500
501
  pathParams: ["id"],
501
502
  queryParams: [],
502
503
  requestSchema: "SearchMemoriesRequestDto",
@@ -506,7 +507,7 @@ var OPERATIONS = {
506
507
  method: "PATCH",
507
508
  path: "/api/v1/scopes/{id}/memories/{memoryId}",
508
509
  service: "modus-api",
509
- serverUrl: "https://api.modus.com",
510
+ serverUrl: "https://api.getmodus.com",
510
511
  pathParams: ["id", "memoryId"],
511
512
  queryParams: ["updateMask"],
512
513
  requestSchema: "UpdateMemoryRequestDto",
@@ -516,7 +517,7 @@ var OPERATIONS = {
516
517
  method: "POST",
517
518
  path: "/agent/v1/scopes/{id}/runs",
518
519
  service: "agent-service",
519
- serverUrl: "https://agent.modus.com",
520
+ serverUrl: "https://agent.getmodus.com",
520
521
  pathParams: ["id"],
521
522
  queryParams: [],
522
523
  requestSchema: "SkillRunDto",
@@ -526,7 +527,7 @@ var OPERATIONS = {
526
527
  method: "GET",
527
528
  path: "/api/v1/scopes/{id}/supervision",
528
529
  service: "modus-api",
529
- serverUrl: "https://api.modus.com",
530
+ serverUrl: "https://api.getmodus.com",
530
531
  pathParams: ["id"],
531
532
  queryParams: ["view"],
532
533
  requestSchema: null,
@@ -536,7 +537,7 @@ var OPERATIONS = {
536
537
  method: "PUT",
537
538
  path: "/api/v1/scopes/{id}/supervision",
538
539
  service: "modus-api",
539
- serverUrl: "https://api.modus.com",
540
+ serverUrl: "https://api.getmodus.com",
540
541
  pathParams: ["id"],
541
542
  queryParams: [],
542
543
  requestSchema: "SetSupervisionRequestDto",
@@ -546,7 +547,7 @@ var OPERATIONS = {
546
547
  method: "PUT",
547
548
  path: "/api/v1/scopes/{id}/supervision/active",
548
549
  service: "modus-api",
549
- serverUrl: "https://api.modus.com",
550
+ serverUrl: "https://api.getmodus.com",
550
551
  pathParams: ["id"],
551
552
  queryParams: [],
552
553
  requestSchema: "SetSupervisionRequestDto",
@@ -556,7 +557,7 @@ var OPERATIONS = {
556
557
  method: "POST",
557
558
  path: "/api/v1/scopes/{id}/transfer-ownership/accept",
558
559
  service: "modus-api",
559
- serverUrl: "https://api.modus.com",
560
+ serverUrl: "https://api.getmodus.com",
560
561
  pathParams: ["id"],
561
562
  queryParams: [],
562
563
  requestSchema: null,
@@ -566,7 +567,7 @@ var OPERATIONS = {
566
567
  method: "DELETE",
567
568
  path: "/api/v1/scopes/{id}/transfer-ownership",
568
569
  service: "modus-api",
569
- serverUrl: "https://api.modus.com",
570
+ serverUrl: "https://api.getmodus.com",
570
571
  pathParams: ["id"],
571
572
  queryParams: [],
572
573
  requestSchema: null,
@@ -576,7 +577,7 @@ var OPERATIONS = {
576
577
  method: "POST",
577
578
  path: "/api/v1/scopes",
578
579
  service: "modus-api",
579
- serverUrl: "https://api.modus.com",
580
+ serverUrl: "https://api.getmodus.com",
580
581
  pathParams: [],
581
582
  queryParams: [],
582
583
  requestSchema: "CreateSkillDto",
@@ -586,7 +587,7 @@ var OPERATIONS = {
586
587
  method: "DELETE",
587
588
  path: "/api/v1/scopes/{id}",
588
589
  service: "modus-api",
589
- serverUrl: "https://api.modus.com",
590
+ serverUrl: "https://api.getmodus.com",
590
591
  pathParams: ["id"],
591
592
  queryParams: [],
592
593
  requestSchema: null,
@@ -596,7 +597,7 @@ var OPERATIONS = {
596
597
  method: "POST",
597
598
  path: "/api/v1/scopes/{id}/deploy",
598
599
  service: "modus-api",
599
- serverUrl: "https://api.modus.com",
600
+ serverUrl: "https://api.getmodus.com",
600
601
  pathParams: ["id"],
601
602
  queryParams: [],
602
603
  requestSchema: "DeploySkillDto",
@@ -606,7 +607,7 @@ var OPERATIONS = {
606
607
  method: "GET",
607
608
  path: "/api/v1/scopes/{id}",
608
609
  service: "modus-api",
609
- serverUrl: "https://api.modus.com",
610
+ serverUrl: "https://api.getmodus.com",
610
611
  pathParams: ["id"],
611
612
  queryParams: ["view"],
612
613
  requestSchema: null,
@@ -616,7 +617,7 @@ var OPERATIONS = {
616
617
  method: "GET",
617
618
  path: "/api/v1/scopes/{id}/variations/{variationUid}",
618
619
  service: "modus-api",
619
- serverUrl: "https://api.modus.com",
620
+ serverUrl: "https://api.getmodus.com",
620
621
  pathParams: ["id", "variationUid"],
621
622
  queryParams: [],
622
623
  requestSchema: null,
@@ -626,7 +627,7 @@ var OPERATIONS = {
626
627
  method: "GET",
627
628
  path: "/api/v1/scopes",
628
629
  service: "modus-api",
629
- serverUrl: "https://api.modus.com",
630
+ serverUrl: "https://api.getmodus.com",
630
631
  pathParams: [],
631
632
  queryParams: ["pageToken", "pageSize", "view", "search", "managerId", "includeVariation"],
632
633
  requestSchema: null,
@@ -636,7 +637,7 @@ var OPERATIONS = {
636
637
  method: "PATCH",
637
638
  path: "/api/v1/scopes/{id}/mcp-config",
638
639
  service: "modus-api",
639
- serverUrl: "https://api.modus.com",
640
+ serverUrl: "https://api.getmodus.com",
640
641
  pathParams: ["id"],
641
642
  queryParams: [],
642
643
  requestSchema: "PatchSkillMcpConfigDto",
@@ -646,7 +647,7 @@ var OPERATIONS = {
646
647
  method: "POST",
647
648
  path: "/api/v1/scopes/{id}/transfer-ownership",
648
649
  service: "modus-api",
649
- serverUrl: "https://api.modus.com",
650
+ serverUrl: "https://api.getmodus.com",
650
651
  pathParams: ["id"],
651
652
  queryParams: [],
652
653
  requestSchema: "TransferOwnershipDto",
@@ -656,7 +657,7 @@ var OPERATIONS = {
656
657
  method: "POST",
657
658
  path: "/api/v1/scopes/{id}/restore",
658
659
  service: "modus-api",
659
- serverUrl: "https://api.modus.com",
660
+ serverUrl: "https://api.getmodus.com",
660
661
  pathParams: ["id"],
661
662
  queryParams: [],
662
663
  requestSchema: null,
@@ -666,7 +667,7 @@ var OPERATIONS = {
666
667
  method: "PATCH",
667
668
  path: "/api/v1/scopes/{id}",
668
669
  service: "modus-api",
669
- serverUrl: "https://api.modus.com",
670
+ serverUrl: "https://api.getmodus.com",
670
671
  pathParams: ["id"],
671
672
  queryParams: ["updateMask"],
672
673
  requestSchema: "UpdateSkillDto",
@@ -676,7 +677,7 @@ var OPERATIONS = {
676
677
  method: "GET",
677
678
  path: "/api/v1/suggestions/questions",
678
679
  service: "modus-api",
679
- serverUrl: "https://api.modus.com",
680
+ serverUrl: "https://api.getmodus.com",
680
681
  pathParams: [],
681
682
  queryParams: ["pageToken", "pageSize", "skill_id", "skill_ids"],
682
683
  requestSchema: null,
@@ -686,7 +687,7 @@ var OPERATIONS = {
686
687
  method: "POST",
687
688
  path: "/api/v1/suggestions/questions/{id}/events",
688
689
  service: "modus-api",
689
- serverUrl: "https://api.modus.com",
690
+ serverUrl: "https://api.getmodus.com",
690
691
  pathParams: ["id"],
691
692
  queryParams: [],
692
693
  requestSchema: "RecordSuggestionEventDto",
@@ -696,7 +697,7 @@ var OPERATIONS = {
696
697
  method: "GET",
697
698
  path: "/api/v1/usage",
698
699
  service: "modus-api",
699
- serverUrl: "https://api.modus.com",
700
+ serverUrl: "https://api.getmodus.com",
700
701
  pathParams: [],
701
702
  queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface"],
702
703
  requestSchema: null,
@@ -706,7 +707,7 @@ var OPERATIONS = {
706
707
  method: "POST",
707
708
  path: "/agent/v1/workflow-actions/{runId}/cancel",
708
709
  service: "agent-service",
709
- serverUrl: "https://agent.modus.com",
710
+ serverUrl: "https://agent.getmodus.com",
710
711
  pathParams: ["runId"],
711
712
  queryParams: [],
712
713
  requestSchema: "CancelRunDto",
@@ -716,7 +717,7 @@ var OPERATIONS = {
716
717
  method: "POST",
717
718
  path: "/agent/v1/workflow-actions",
718
719
  service: "agent-service",
719
- serverUrl: "https://agent.modus.com",
720
+ serverUrl: "https://agent.getmodus.com",
720
721
  pathParams: [],
721
722
  queryParams: [],
722
723
  requestSchema: "WorkflowActionDto",
@@ -726,7 +727,7 @@ var OPERATIONS = {
726
727
  method: "POST",
727
728
  path: "/api/v1/workflows/{id}/interfaces",
728
729
  service: "modus-api",
729
- serverUrl: "https://api.modus.com",
730
+ serverUrl: "https://api.getmodus.com",
730
731
  pathParams: ["id"],
731
732
  queryParams: [],
732
733
  requestSchema: "AddAgentInterfaceDto",
@@ -736,7 +737,7 @@ var OPERATIONS = {
736
737
  method: "DELETE",
737
738
  path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
738
739
  service: "modus-api",
739
- serverUrl: "https://api.modus.com",
740
+ serverUrl: "https://api.getmodus.com",
740
741
  pathParams: ["id", "interfaceId"],
741
742
  queryParams: [],
742
743
  requestSchema: null,
@@ -746,7 +747,7 @@ var OPERATIONS = {
746
747
  method: "DELETE",
747
748
  path: "/api/v1/workflows/{id}/interfaces",
748
749
  service: "modus-api",
749
- serverUrl: "https://api.modus.com",
750
+ serverUrl: "https://api.getmodus.com",
750
751
  pathParams: ["id"],
751
752
  queryParams: [],
752
753
  requestSchema: null,
@@ -756,7 +757,7 @@ var OPERATIONS = {
756
757
  method: "GET",
757
758
  path: "/api/v1/workflows/{id}/interfaces",
758
759
  service: "modus-api",
759
- serverUrl: "https://api.modus.com",
760
+ serverUrl: "https://api.getmodus.com",
760
761
  pathParams: ["id"],
761
762
  queryParams: ["pageSize", "pageToken"],
762
763
  requestSchema: null,
@@ -766,7 +767,7 @@ var OPERATIONS = {
766
767
  method: "PATCH",
767
768
  path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
768
769
  service: "modus-api",
769
- serverUrl: "https://api.modus.com",
770
+ serverUrl: "https://api.getmodus.com",
770
771
  pathParams: ["id", "interfaceId"],
771
772
  queryParams: ["updateMask"],
772
773
  requestSchema: "UpdateAgentInterfaceDto",
@@ -776,7 +777,7 @@ var OPERATIONS = {
776
777
  method: "POST",
777
778
  path: "/agent/v1/workflows/{id}/runs",
778
779
  service: "agent-service",
779
- serverUrl: "https://agent.modus.com",
780
+ serverUrl: "https://agent.getmodus.com",
780
781
  pathParams: ["id"],
781
782
  queryParams: [],
782
783
  requestSchema: "AgentRunDto",
@@ -786,7 +787,7 @@ var OPERATIONS = {
786
787
  method: "GET",
787
788
  path: "/api/v1/workflows/{id}/runs/{runId}",
788
789
  service: "modus-api",
789
- serverUrl: "https://api.modus.com",
790
+ serverUrl: "https://api.getmodus.com",
790
791
  pathParams: ["id", "runId"],
791
792
  queryParams: ["temporalRunId"],
792
793
  requestSchema: null,
@@ -796,7 +797,7 @@ var OPERATIONS = {
796
797
  method: "GET",
797
798
  path: "/api/v1/workflows/{id}/runs",
798
799
  service: "modus-api",
799
- serverUrl: "https://api.modus.com",
800
+ serverUrl: "https://api.getmodus.com",
800
801
  pathParams: ["id"],
801
802
  queryParams: ["status", "timeframe", "approvalScope", "search", "pageSize", "pageToken"],
802
803
  requestSchema: null,
@@ -806,7 +807,7 @@ var OPERATIONS = {
806
807
  method: "POST",
807
808
  path: "/api/v1/workflows/{id}/transfer-ownership/accept",
808
809
  service: "modus-api",
809
- serverUrl: "https://api.modus.com",
810
+ serverUrl: "https://api.getmodus.com",
810
811
  pathParams: ["id"],
811
812
  queryParams: [],
812
813
  requestSchema: null,
@@ -816,7 +817,7 @@ var OPERATIONS = {
816
817
  method: "DELETE",
817
818
  path: "/api/v1/workflows/{id}/transfer-ownership",
818
819
  service: "modus-api",
819
- serverUrl: "https://api.modus.com",
820
+ serverUrl: "https://api.getmodus.com",
820
821
  pathParams: ["id"],
821
822
  queryParams: [],
822
823
  requestSchema: null,
@@ -826,7 +827,7 @@ var OPERATIONS = {
826
827
  method: "POST",
827
828
  path: "/api/v1/workflows",
828
829
  service: "modus-api",
829
- serverUrl: "https://api.modus.com",
830
+ serverUrl: "https://api.getmodus.com",
830
831
  pathParams: [],
831
832
  queryParams: [],
832
833
  requestSchema: "CreateAgentDto",
@@ -836,7 +837,7 @@ var OPERATIONS = {
836
837
  method: "DELETE",
837
838
  path: "/api/v1/workflows/{id}",
838
839
  service: "modus-api",
839
- serverUrl: "https://api.modus.com",
840
+ serverUrl: "https://api.getmodus.com",
840
841
  pathParams: ["id"],
841
842
  queryParams: [],
842
843
  requestSchema: null,
@@ -846,7 +847,7 @@ var OPERATIONS = {
846
847
  method: "POST",
847
848
  path: "/api/v1/workflows/{id}/deploy",
848
849
  service: "modus-api",
849
- serverUrl: "https://api.modus.com",
850
+ serverUrl: "https://api.getmodus.com",
850
851
  pathParams: ["id"],
851
852
  queryParams: [],
852
853
  requestSchema: "DeployAgentDto",
@@ -856,7 +857,7 @@ var OPERATIONS = {
856
857
  method: "GET",
857
858
  path: "/api/v1/workflows/{id}",
858
859
  service: "modus-api",
859
- serverUrl: "https://api.modus.com",
860
+ serverUrl: "https://api.getmodus.com",
860
861
  pathParams: ["id"],
861
862
  queryParams: ["view"],
862
863
  requestSchema: null,
@@ -866,7 +867,7 @@ var OPERATIONS = {
866
867
  method: "GET",
867
868
  path: "/api/v1/workflows",
868
869
  service: "modus-api",
869
- serverUrl: "https://api.modus.com",
870
+ serverUrl: "https://api.getmodus.com",
870
871
  pathParams: [],
871
872
  queryParams: ["pageToken", "pageSize", "view", "type", "search", "includeVariation"],
872
873
  requestSchema: null,
@@ -876,7 +877,7 @@ var OPERATIONS = {
876
877
  method: "POST",
877
878
  path: "/api/v1/workflows/{id}/transfer-ownership",
878
879
  service: "modus-api",
879
- serverUrl: "https://api.modus.com",
880
+ serverUrl: "https://api.getmodus.com",
880
881
  pathParams: ["id"],
881
882
  queryParams: [],
882
883
  requestSchema: "TransferOwnershipDto",
@@ -886,7 +887,7 @@ var OPERATIONS = {
886
887
  method: "POST",
887
888
  path: "/api/v1/workflows/{id}/restore",
888
889
  service: "modus-api",
889
- serverUrl: "https://api.modus.com",
890
+ serverUrl: "https://api.getmodus.com",
890
891
  pathParams: ["id"],
891
892
  queryParams: [],
892
893
  requestSchema: null,
@@ -896,7 +897,7 @@ var OPERATIONS = {
896
897
  method: "POST",
897
898
  path: "/api/v1/workflows/{id}/toggle",
898
899
  service: "modus-api",
899
- serverUrl: "https://api.modus.com",
900
+ serverUrl: "https://api.getmodus.com",
900
901
  pathParams: ["id"],
901
902
  queryParams: [],
902
903
  requestSchema: "ToggleAgentDto",
@@ -906,7 +907,7 @@ var OPERATIONS = {
906
907
  method: "PATCH",
907
908
  path: "/api/v1/workflows/{id}",
908
909
  service: "modus-api",
909
- serverUrl: "https://api.modus.com",
910
+ serverUrl: "https://api.getmodus.com",
910
911
  pathParams: ["id"],
911
912
  queryParams: ["updateMask"],
912
913
  requestSchema: "UpdateAgentDto",
@@ -996,6 +997,13 @@ var ValidationError = class extends ModusError {
996
997
  }
997
998
  };
998
999
 
1000
+ // src/_agent_run_request.ts
1001
+ var import_node_crypto = require("crypto");
1002
+ function resolveAgentRunSessionId(sessionId) {
1003
+ if (typeof sessionId === "string" && sessionId.trim()) return sessionId.trim();
1004
+ return (0, import_node_crypto.randomUUID)();
1005
+ }
1006
+
999
1007
  // src/_streaming.ts
1000
1008
  var SILENTLY_IGNORED = /* @__PURE__ */ new Set([
1001
1009
  "heartbeat",
@@ -1193,28 +1201,48 @@ function effectiveThreadId(threadId) {
1193
1201
  if (!threadId.trim()) return void 0;
1194
1202
  return threadId;
1195
1203
  }
1204
+ function resolveSessionId(threadId) {
1205
+ return resolveAgentRunSessionId(effectiveThreadId(threadId));
1206
+ }
1196
1207
  function chatPath(resource, resourceId, options) {
1197
1208
  const safeId = encodeURIComponent(String(resourceId));
1198
- const suffix = options.stream ? "/stream" : "";
1199
1209
  const tid = effectiveThreadId(options.threadId);
1200
1210
  if (tid !== void 0) {
1201
1211
  const safeTid = encodeURIComponent(tid);
1202
- return `/api/v1/${resource}/${safeId}/conversations/${safeTid}/chat${suffix}`;
1212
+ return `/api/v1/${resource}/${safeId}/conversations/${safeTid}/chat`;
1203
1213
  }
1204
- return `/api/v1/${resource}/${safeId}/chat${suffix}`;
1214
+ return `/api/v1/${resource}/${safeId}/chat`;
1205
1215
  }
1206
1216
  function modusChatPath(options) {
1207
- const suffix = options.stream ? "/stream" : "";
1208
1217
  const tid = effectiveThreadId(options.threadId);
1209
1218
  if (tid !== void 0) {
1210
1219
  validateId(tid, "thread_id");
1211
- return `/api/v1/modus/conversations/${encodeURIComponent(tid)}/chat${suffix}`;
1220
+ return `/api/v1/modus/conversations/${encodeURIComponent(tid)}/chat`;
1212
1221
  }
1213
- return `/api/v1/modus/chat${suffix}`;
1222
+ return `/api/v1/modus/chat`;
1223
+ }
1224
+ function agentHostRunsPath(resource, resourceId) {
1225
+ if (resource === "modus") return "/agent/v1/modus/runs";
1226
+ const safeId = encodeURIComponent(String(resourceId));
1227
+ return `/agent/v1/${resource}/${safeId}/runs`;
1214
1228
  }
1215
1229
  function chatBody(message, model) {
1216
1230
  return { message, model };
1217
1231
  }
1232
+ function agentRunsBody(message, model, options) {
1233
+ const body = {
1234
+ message,
1235
+ config: { model },
1236
+ sessionId: options.sessionId
1237
+ };
1238
+ if (options.organizationId !== void 0) {
1239
+ body.organizationId = options.organizationId;
1240
+ }
1241
+ if (options.version !== void 0) {
1242
+ body.version = options.version;
1243
+ }
1244
+ return body;
1245
+ }
1218
1246
  function raiseForEvent(event) {
1219
1247
  if (event.type === "error") throw new ModusError(event.message);
1220
1248
  if (event.type === "cancelled") throw new RunCancelledError();
@@ -1222,10 +1250,11 @@ function raiseForEvent(event) {
1222
1250
  return event;
1223
1251
  }
1224
1252
  var ChatStream = class {
1225
- constructor(http, path, body) {
1253
+ constructor(http, path, body, baseUrl) {
1226
1254
  this.http = http;
1227
1255
  this.path = path;
1228
1256
  this.body = body;
1257
+ this.baseUrl = baseUrl;
1229
1258
  this.textParts = [];
1230
1259
  }
1231
1260
  async *textStream() {
@@ -1238,7 +1267,9 @@ var ChatStream = class {
1238
1267
  }
1239
1268
  async *events(supportsReset) {
1240
1269
  const body = supportsReset ? { ...this.body, streamProtocolVersion: 2 } : this.body;
1241
- for await (const line of this.http.streamPost(this.path, body)) {
1270
+ for await (const line of this.http.streamPost(this.path, body, {
1271
+ baseUrl: this.baseUrl
1272
+ })) {
1242
1273
  for (const event of parseSseStream([line])) {
1243
1274
  const normalized = raiseForEvent(event);
1244
1275
  if (normalized.type === "token") this.textParts.push(normalized.content);
@@ -1272,31 +1303,43 @@ async function chatBuffered(http, resource, resourceId, message, options) {
1272
1303
  validateId(resourceId, `${resource}_id`);
1273
1304
  validateChatModel(options.model);
1274
1305
  const path = chatPath(resource, resourceId, {
1275
- threadId: options.threadId,
1276
- stream: false
1306
+ threadId: options.threadId
1277
1307
  });
1278
1308
  const data = await http.post(path, chatBody(message, options.model));
1279
1309
  return data;
1280
1310
  }
1281
- function chatStreamSession(http, resource, resourceId, message, options) {
1311
+ function chatStreamSession(http, config, resource, resourceId, message, options) {
1282
1312
  validateId(resourceId, `${resource}_id`);
1283
1313
  validateChatModel(options.model);
1284
- const path = chatPath(resource, resourceId, {
1285
- threadId: options.threadId,
1286
- stream: true
1287
- });
1288
- return new ChatStream(http, path, chatBody(message, options.model));
1314
+ const path = agentHostRunsPath(resource, resourceId);
1315
+ return new ChatStream(
1316
+ http,
1317
+ path,
1318
+ agentRunsBody(message, options.model, {
1319
+ sessionId: resolveSessionId(options.threadId),
1320
+ organizationId: config.organizationId,
1321
+ version: options.version
1322
+ }),
1323
+ config.agentHost
1324
+ );
1289
1325
  }
1290
1326
  async function modusChatBuffered(http, message, options) {
1291
1327
  validateChatModel(options.model);
1292
- const path = modusChatPath({ threadId: options.threadId, stream: false });
1328
+ const path = modusChatPath({ threadId: options.threadId });
1293
1329
  const data = await http.post(path, chatBody(message, options.model));
1294
1330
  return data;
1295
1331
  }
1296
- function modusChatStreamSession(http, message, options) {
1332
+ function modusChatStreamSession(http, config, message, options) {
1297
1333
  validateChatModel(options.model);
1298
- const path = modusChatPath({ threadId: options.threadId, stream: true });
1299
- return new ChatStream(http, path, chatBody(message, options.model));
1334
+ return new ChatStream(
1335
+ http,
1336
+ agentHostRunsPath("modus"),
1337
+ agentRunsBody(message, options.model, {
1338
+ sessionId: resolveSessionId(options.threadId),
1339
+ organizationId: config.organizationId
1340
+ }),
1341
+ config.agentHost
1342
+ );
1300
1343
  }
1301
1344
 
1302
1345
  // src/_pagination.ts
@@ -1364,6 +1407,12 @@ function buildAipPage(data, itemsKey, mapItem, fetchPage) {
1364
1407
  return new Page(items, nextPageTokenFromResponse(data), fetchPage);
1365
1408
  }
1366
1409
 
1410
+ // src/types/agents.ts
1411
+ var AgentType = {
1412
+ task: "task",
1413
+ workflow: "workflow"
1414
+ };
1415
+
1367
1416
  // src/types/conversations.ts
1368
1417
  function conversationSkillId(item) {
1369
1418
  return item.skillId === 0 ? void 0 : item.skillId;
@@ -1372,6 +1421,8 @@ function conversationSkillId(item) {
1372
1421
  // src/_auth.ts
1373
1422
  var ENV_API_KEY = "MODUS_API_KEY";
1374
1423
  var ENV_BASE_URL = "MODUS_BASE_URL";
1424
+ var ENV_AGENT_HOST = "MODUS_AGENT_HOST";
1425
+ var ENV_ORGANIZATION_ID = "MODUS_ORGANIZATION_ID";
1375
1426
  var ENV_TIMEOUT = "MODUS_TIMEOUT";
1376
1427
  var ENV_MAX_RETRIES = "MODUS_MAX_RETRIES";
1377
1428
  var KEY_PREFIX = "modus_";
@@ -1379,12 +1430,12 @@ function resolveApiKey(apiKey) {
1379
1430
  const key = apiKey ?? process.env[ENV_API_KEY];
1380
1431
  if (!key) {
1381
1432
  throw new AuthenticationError(
1382
- `No API key provided. Pass apiKey or set the ${ENV_API_KEY} environment variable. Create a token at app.modus.com \u2192 Settings \u2192 API Tokens.`
1433
+ `No API key provided. Pass apiKey or set the ${ENV_API_KEY} environment variable. Create a token at app.getmodus.com \u2192 Settings \u2192 API Tokens.`
1383
1434
  );
1384
1435
  }
1385
1436
  if (!key.startsWith(KEY_PREFIX)) {
1386
1437
  throw new AuthenticationError(
1387
- `Invalid API key format. Modus API keys start with '${KEY_PREFIX}'. Create a token at app.modus.com \u2192 Settings \u2192 API Tokens.`
1438
+ `Invalid API key format. Modus API keys start with '${KEY_PREFIX}'. Create a token at app.getmodus.com \u2192 Settings \u2192 API Tokens.`
1388
1439
  );
1389
1440
  }
1390
1441
  return key;
@@ -1392,6 +1443,15 @@ function resolveApiKey(apiKey) {
1392
1443
  function resolveBaseUrl(baseUrl) {
1393
1444
  return baseUrl ?? process.env[ENV_BASE_URL] ?? void 0;
1394
1445
  }
1446
+ function resolveAgentHost(agentHost) {
1447
+ return agentHost ?? process.env[ENV_AGENT_HOST] ?? void 0;
1448
+ }
1449
+ function resolveOrganizationId(organizationId) {
1450
+ const raw = organizationId ?? process.env[ENV_ORGANIZATION_ID];
1451
+ if (raw === void 0) return void 0;
1452
+ const stripped = raw.trim();
1453
+ return stripped || void 0;
1454
+ }
1395
1455
  function resolveTimeoutMs(explicitMs) {
1396
1456
  if (explicitMs !== void 0) return explicitMs;
1397
1457
  const raw = process.env[ENV_TIMEOUT];
@@ -1414,7 +1474,8 @@ function authHeaders(apiKey) {
1414
1474
  }
1415
1475
 
1416
1476
  // src/_config.ts
1417
- var DEFAULT_BASE_URL = "https://api.modus.com";
1477
+ var DEFAULT_BASE_URL = "https://api.getmodus.com";
1478
+ var DEFAULT_AGENT_HOST = "https://agent.getmodus.com";
1418
1479
  var DEFAULT_TIMEOUT_MS = 3e5;
1419
1480
  var DEFAULT_MAX_RETRIES = 2;
1420
1481
  function normalizeBaseUrl(baseUrl) {
@@ -1434,16 +1495,30 @@ function createModusConfig(options = {}) {
1434
1495
  throw new Error(`max_retries must be a non-negative int, got ${maxRetries}`);
1435
1496
  }
1436
1497
  const baseUrl = normalizeBaseUrl(resolveBaseUrl(options.baseUrl) ?? DEFAULT_BASE_URL);
1498
+ const baseUrlOverrides = normalizeBaseUrls(options.baseUrls);
1499
+ const agentHost = normalizeBaseUrl(
1500
+ baseUrlOverrides["agent-service"] ?? resolveAgentHost(options.agentHost) ?? DEFAULT_AGENT_HOST
1501
+ );
1502
+ const organizationId = resolveOrganizationId(options.organizationId);
1437
1503
  return Object.freeze({
1438
1504
  apiKey: resolveApiKey(options.apiKey),
1439
1505
  baseUrl,
1440
- baseUrls: Object.freeze({ "modus-api": baseUrl, ...normalizeBaseUrls(options.baseUrls) }),
1506
+ agentHost,
1507
+ ...organizationId !== void 0 ? { organizationId } : {},
1508
+ baseUrls: Object.freeze({
1509
+ "modus-api": baseUrl,
1510
+ "agent-service": agentHost,
1511
+ ...baseUrlOverrides
1512
+ }),
1441
1513
  timeoutMs: resolveTimeoutMs(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS,
1442
1514
  maxRetries,
1443
1515
  fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
1444
1516
  });
1445
1517
  }
1446
1518
  function resolveServiceBaseUrl(config, service, generatedBaseUrl) {
1519
+ if (service === "agent-service") {
1520
+ return config.baseUrls["agent-service"] ?? config.agentHost ?? generatedBaseUrl ?? config.baseUrl;
1521
+ }
1447
1522
  return config.baseUrls[service] ?? generatedBaseUrl ?? config.baseUrl;
1448
1523
  }
1449
1524
  function formatConfigForLog(config) {
@@ -1452,7 +1527,7 @@ function formatConfigForLog(config) {
1452
1527
  }
1453
1528
 
1454
1529
  // src/_http.ts
1455
- var USER_AGENT = `modus-typescript/${"0.2.1"} (node/${process.version}; ${process.platform})`;
1530
+ var USER_AGENT = `modus-typescript/${"0.2.3"} (node/${process.version}; ${process.platform})`;
1456
1531
  function buildUrl(baseUrl, path, params) {
1457
1532
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
1458
1533
  if (params) {
@@ -1547,6 +1622,26 @@ function wrapNetworkError(error, baseUrl) {
1547
1622
  async function readBody(response) {
1548
1623
  return response.text();
1549
1624
  }
1625
+ async function readBodyPreview(response, maxChars = 200) {
1626
+ if (!response.body) return "";
1627
+ const reader = response.body.getReader();
1628
+ const decoder = new TextDecoder();
1629
+ let out = "";
1630
+ try {
1631
+ while (out.length < maxChars) {
1632
+ const { done, value } = await reader.read();
1633
+ if (done) break;
1634
+ out += decoder.decode(value, { stream: true });
1635
+ if (out.length >= maxChars) {
1636
+ out = out.slice(0, maxChars);
1637
+ break;
1638
+ }
1639
+ }
1640
+ } finally {
1641
+ await reader.cancel().catch(() => void 0);
1642
+ }
1643
+ return out;
1644
+ }
1550
1645
  var HttpClient = class {
1551
1646
  constructor(config) {
1552
1647
  this.config = config;
@@ -1587,6 +1682,9 @@ var HttpClient = class {
1587
1682
  post(path, json, options = {}) {
1588
1683
  return this.request("POST", path, { json, ...options });
1589
1684
  }
1685
+ put(path, json, options = {}) {
1686
+ return this.request("PUT", path, { json, ...options });
1687
+ }
1590
1688
  patch(path, json, params, options = {}) {
1591
1689
  return this.request("PATCH", path, { json, params, ...options });
1592
1690
  }
@@ -1599,7 +1697,13 @@ var HttpClient = class {
1599
1697
  try {
1600
1698
  const response = await this.config.fetch(url, {
1601
1699
  method,
1602
- headers: { ...this.defaultHeaders(), ...options.headers },
1700
+ // Agent-service negotiates SSE vs JSON polling on Accept; JSON-only
1701
+ // Accept returns {"runId","status":"pending"} instead of token SSE.
1702
+ headers: {
1703
+ ...this.defaultHeaders(),
1704
+ ...options.headers,
1705
+ Accept: "text/event-stream"
1706
+ },
1603
1707
  body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
1604
1708
  signal: AbortSignal.timeout(this.config.timeoutMs)
1605
1709
  });
@@ -1608,6 +1712,14 @@ var HttpClient = class {
1608
1712
  raiseForStatus(response, body);
1609
1713
  return;
1610
1714
  }
1715
+ const contentType = response.headers.get("content-type") ?? "";
1716
+ if (!contentType.toLowerCase().includes("text/event-stream")) {
1717
+ const preview = await readBodyPreview(response);
1718
+ throw new ModusError(
1719
+ `Unexpected stream response: expected Content-Type text/event-stream, got ${JSON.stringify(contentType) || "(missing)"}. Body preview: ${preview}`,
1720
+ { statusCode: response.status, body: preview }
1721
+ );
1722
+ }
1611
1723
  if (!response.body) return;
1612
1724
  const reader = response.body.getReader();
1613
1725
  const decoder = new TextDecoder();
@@ -1695,6 +1807,8 @@ async function invokeOperation(http, operationId, options = {}) {
1695
1807
  return http.get(path, params, requestOptions);
1696
1808
  case "POST":
1697
1809
  return http.post(path, options.jsonBody, requestOptions);
1810
+ case "PUT":
1811
+ return http.put(path, options.jsonBody, requestOptions);
1698
1812
  case "PATCH":
1699
1813
  return http.patch(path, options.jsonBody, params, requestOptions);
1700
1814
  case "DELETE":
@@ -1762,6 +1876,7 @@ function asRecord(data) {
1762
1876
  }
1763
1877
 
1764
1878
  // src/resources/agents/runs.ts
1879
+ var import_node_crypto2 = require("crypto");
1765
1880
  var RUNS_MAX_PAGE_SIZE = 100;
1766
1881
  function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, search) {
1767
1882
  const params = { pageSize };
@@ -1809,7 +1924,19 @@ function parseActiveRunsPage(raw, fetchPage) {
1809
1924
  );
1810
1925
  }
1811
1926
  function randomRunId() {
1812
- return crypto.randomUUID();
1927
+ return (0, import_node_crypto2.randomUUID)();
1928
+ }
1929
+ function sessionIdFromBody(body) {
1930
+ return resolveAgentRunSessionId(body.sessionId);
1931
+ }
1932
+ function makeAgentRunStream(runId, events) {
1933
+ return {
1934
+ runId,
1935
+ events,
1936
+ [Symbol.asyncIterator]() {
1937
+ return events[Symbol.asyncIterator]();
1938
+ }
1939
+ };
1813
1940
  }
1814
1941
  var WorkflowRunsResource = class {
1815
1942
  constructor(http, config) {
@@ -1860,18 +1987,18 @@ var WorkflowRunsResource = class {
1860
1987
  });
1861
1988
  return parseRun(data);
1862
1989
  }
1863
- async create(workflowId, body, options = {}) {
1990
+ create(workflowId, body, options = {}) {
1864
1991
  validateId(workflowId, "workflow_id");
1865
1992
  return this.createRun("WorkflowRunsController_create", body, { id: workflowId }, options);
1866
1993
  }
1867
- async createScope(scopeId, body, options = {}) {
1994
+ createScope(scopeId, body, options = {}) {
1868
1995
  validateId(scopeId, "scope_id");
1869
1996
  return this.createRun("ScopeRunsController_create", body, { id: scopeId }, options);
1870
1997
  }
1871
- async createModus(body, options = {}) {
1998
+ createModus(body, options = {}) {
1872
1999
  return this.createRun("ModusRunsController_create", body, {}, options);
1873
2000
  }
1874
- async resume(runId, body, options = {}) {
2001
+ resume(runId, body, options = {}) {
1875
2002
  validateId(runId, "run_id");
1876
2003
  return this.createRun("ResumeRunsController_create", body, { runId }, options);
1877
2004
  }
@@ -1934,20 +2061,22 @@ var WorkflowRunsResource = class {
1934
2061
  baseUrl: operationBaseUrl(this.http, op),
1935
2062
  headers: options.lastEventId ? { "Last-Event-ID": options.lastEventId } : void 0
1936
2063
  });
1937
- return { runId, events: this.parseEvents(lines) };
2064
+ return makeAgentRunStream(runId, this.parseEvents(lines));
1938
2065
  }
1939
2066
  createRun(operationId, body, pathParams, options) {
1940
2067
  const runId = options.idempotencyKey?.trim() || body.runId?.trim() || randomRunId();
2068
+ const sessionId = sessionIdFromBody(body);
1941
2069
  const op = getOperation(operationId);
1942
2070
  const path = formatOperationPath(operationId, pathParams);
1943
2071
  const lines = this.http.streamPost(path, {
1944
2072
  ...body,
2073
+ sessionId,
1945
2074
  streamProtocolVersion: 2
1946
2075
  }, {
1947
2076
  baseUrl: operationBaseUrl(this.http, op),
1948
2077
  headers: { "Idempotency-Key": runId }
1949
2078
  });
1950
- return { runId, events: this.parseEvents(lines) };
2079
+ return makeAgentRunStream(runId, this.parseEvents(lines));
1951
2080
  }
1952
2081
  async *parseEvents(lines) {
1953
2082
  yield* parseSseStream(lines);
@@ -1955,15 +2084,16 @@ var WorkflowRunsResource = class {
1955
2084
  };
1956
2085
 
1957
2086
  // src/resources/agents/workflow-actions.ts
2087
+ var import_node_crypto3 = require("crypto");
1958
2088
  function randomRunId2() {
1959
- return crypto.randomUUID();
2089
+ return (0, import_node_crypto3.randomUUID)();
1960
2090
  }
1961
2091
  var AgentWorkflowActionsResource = class {
1962
2092
  constructor(http, config) {
1963
2093
  this.http = http;
1964
2094
  this.config = config;
1965
2095
  }
1966
- async execute(body, options = {}) {
2096
+ execute(body, options = {}) {
1967
2097
  const runId = options.idempotencyKey?.trim() || body.runId?.trim() || randomRunId2();
1968
2098
  const op = getOperation("WorkflowActionsController_execute");
1969
2099
  const path = formatOperationPath("WorkflowActionsController_execute");
@@ -1971,7 +2101,7 @@ var AgentWorkflowActionsResource = class {
1971
2101
  baseUrl: operationBaseUrl(this.http, op),
1972
2102
  headers: { "Idempotency-Key": runId }
1973
2103
  });
1974
- return { runId, events: this.parseEvents(lines) };
2104
+ return makeAgentRunStream(runId, this.parseEvents(lines));
1975
2105
  }
1976
2106
  async cancel(runId) {
1977
2107
  validateId(runId, "run_id");
@@ -2049,6 +2179,12 @@ var WorkflowsResource = class {
2049
2179
  });
2050
2180
  return parseWorkflow(data);
2051
2181
  }
2182
+ chat(workflowId, message, options) {
2183
+ return chatBuffered(this.http, "workflows", workflowId, message, options);
2184
+ }
2185
+ chatStream(workflowId, message, options) {
2186
+ return chatStreamSession(this.http, this.config, "workflows", workflowId, message, options);
2187
+ }
2052
2188
  };
2053
2189
 
2054
2190
  // src/resources/connections.ts
@@ -2343,7 +2479,7 @@ var ModusResource = class {
2343
2479
  return modusChatBuffered(this.http, message, options);
2344
2480
  }
2345
2481
  chatStream(message, options) {
2346
- return modusChatStreamSession(this.http, message, options);
2482
+ return modusChatStreamSession(this.http, this.config, message, options);
2347
2483
  }
2348
2484
  };
2349
2485
 
@@ -2461,10 +2597,28 @@ var ScopesResource = class {
2461
2597
  return chatBuffered(this.http, "scopes", scopeId, message, options);
2462
2598
  }
2463
2599
  chatStream(scopeId, message, options) {
2464
- return chatStreamSession(this.http, "scopes", scopeId, message, options);
2600
+ return chatStreamSession(this.http, this.config, "scopes", scopeId, message, options);
2465
2601
  }
2466
2602
  };
2467
2603
 
2604
+ // src/types/suggestions.ts
2605
+ function normalizeRecordSuggestionEvent(event) {
2606
+ const eventType = event.event_type ?? event.eventType;
2607
+ if (eventType === void 0) {
2608
+ throw new Error("recordEvent requires event_type (or eventType)");
2609
+ }
2610
+ const body = {
2611
+ event_type: eventType,
2612
+ source: event.source
2613
+ };
2614
+ const skillId = event.skill_id ?? event.skillId;
2615
+ if (skillId !== void 0) body.skill_id = skillId;
2616
+ const threadId = event.thread_id ?? event.threadId;
2617
+ if (threadId !== void 0) body.thread_id = threadId;
2618
+ if (event.metadata !== void 0) body.metadata = event.metadata;
2619
+ return body;
2620
+ }
2621
+
2468
2622
  // src/resources/suggestions.ts
2469
2623
  var DEFAULT_SUGGESTIONS_PAGE_SIZE = 5;
2470
2624
  var MAX_SUGGESTIONS_PAGE_SIZE = 12;
@@ -2506,7 +2660,7 @@ var SuggestionsResource = class {
2506
2660
  validateId(id, "id");
2507
2661
  await invokeWithRetry(this.config, this.http, "SuggestionsController_recordEvent", {
2508
2662
  pathParams: { id },
2509
- jsonBody: event
2663
+ jsonBody: normalizeRecordSuggestionEvent(event)
2510
2664
  });
2511
2665
  }
2512
2666
  };
@@ -2526,6 +2680,7 @@ var Modus = class extends ModusClientBase {
2526
2680
  // Annotate the CommonJS export names for ESM import in node:
2527
2681
  0 && (module.exports = {
2528
2682
  APIConnectionError,
2683
+ AgentType,
2529
2684
  AuthenticationError,
2530
2685
  ChatStream,
2531
2686
  ConflictError,