@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.
@@ -97,6 +97,8 @@ var ValidationError = class extends ModusError {
97
97
  // src/_auth.ts
98
98
  var ENV_API_KEY = "MODUS_API_KEY";
99
99
  var ENV_BASE_URL = "MODUS_BASE_URL";
100
+ var ENV_AGENT_HOST = "MODUS_AGENT_HOST";
101
+ var ENV_ORGANIZATION_ID = "MODUS_ORGANIZATION_ID";
100
102
  var ENV_TIMEOUT = "MODUS_TIMEOUT";
101
103
  var ENV_MAX_RETRIES = "MODUS_MAX_RETRIES";
102
104
  var KEY_PREFIX = "modus_";
@@ -104,12 +106,12 @@ function resolveApiKey(apiKey) {
104
106
  const key = apiKey ?? process.env[ENV_API_KEY];
105
107
  if (!key) {
106
108
  throw new AuthenticationError(
107
- `No API key provided. Pass apiKey or set the ${ENV_API_KEY} environment variable. Create a token at app.modus.com \u2192 Settings \u2192 API Tokens.`
109
+ `No API key provided. Pass apiKey or set the ${ENV_API_KEY} environment variable. Create a token at app.getmodus.com \u2192 Settings \u2192 API Tokens.`
108
110
  );
109
111
  }
110
112
  if (!key.startsWith(KEY_PREFIX)) {
111
113
  throw new AuthenticationError(
112
- `Invalid API key format. Modus API keys start with '${KEY_PREFIX}'. Create a token at app.modus.com \u2192 Settings \u2192 API Tokens.`
114
+ `Invalid API key format. Modus API keys start with '${KEY_PREFIX}'. Create a token at app.getmodus.com \u2192 Settings \u2192 API Tokens.`
113
115
  );
114
116
  }
115
117
  return key;
@@ -117,6 +119,15 @@ function resolveApiKey(apiKey) {
117
119
  function resolveBaseUrl(baseUrl) {
118
120
  return baseUrl ?? process.env[ENV_BASE_URL] ?? void 0;
119
121
  }
122
+ function resolveAgentHost(agentHost) {
123
+ return agentHost ?? process.env[ENV_AGENT_HOST] ?? void 0;
124
+ }
125
+ function resolveOrganizationId(organizationId) {
126
+ const raw = organizationId ?? process.env[ENV_ORGANIZATION_ID];
127
+ if (raw === void 0) return void 0;
128
+ const stripped = raw.trim();
129
+ return stripped || void 0;
130
+ }
120
131
  function resolveTimeoutMs(explicitMs) {
121
132
  if (explicitMs !== void 0) return explicitMs;
122
133
  const raw = process.env[ENV_TIMEOUT];
@@ -139,7 +150,8 @@ function authHeaders(apiKey) {
139
150
  }
140
151
 
141
152
  // src/_config.ts
142
- var DEFAULT_BASE_URL = "https://api.modus.com";
153
+ var DEFAULT_BASE_URL = "https://api.getmodus.com";
154
+ var DEFAULT_AGENT_HOST = "https://agent.getmodus.com";
143
155
  var DEFAULT_TIMEOUT_MS = 3e5;
144
156
  var DEFAULT_MAX_RETRIES = 2;
145
157
  function normalizeBaseUrl(baseUrl) {
@@ -159,16 +171,30 @@ function createModusConfig(options = {}) {
159
171
  throw new Error(`max_retries must be a non-negative int, got ${maxRetries}`);
160
172
  }
161
173
  const baseUrl = normalizeBaseUrl(resolveBaseUrl(options.baseUrl) ?? DEFAULT_BASE_URL);
174
+ const baseUrlOverrides = normalizeBaseUrls(options.baseUrls);
175
+ const agentHost = normalizeBaseUrl(
176
+ baseUrlOverrides["agent-service"] ?? resolveAgentHost(options.agentHost) ?? DEFAULT_AGENT_HOST
177
+ );
178
+ const organizationId = resolveOrganizationId(options.organizationId);
162
179
  return Object.freeze({
163
180
  apiKey: resolveApiKey(options.apiKey),
164
181
  baseUrl,
165
- baseUrls: Object.freeze({ "modus-api": baseUrl, ...normalizeBaseUrls(options.baseUrls) }),
182
+ agentHost,
183
+ ...organizationId !== void 0 ? { organizationId } : {},
184
+ baseUrls: Object.freeze({
185
+ "modus-api": baseUrl,
186
+ "agent-service": agentHost,
187
+ ...baseUrlOverrides
188
+ }),
166
189
  timeoutMs: resolveTimeoutMs(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS,
167
190
  maxRetries,
168
191
  fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
169
192
  });
170
193
  }
171
194
  function resolveServiceBaseUrl(config, service, generatedBaseUrl) {
195
+ if (service === "agent-service") {
196
+ return config.baseUrls["agent-service"] ?? config.agentHost ?? generatedBaseUrl ?? config.baseUrl;
197
+ }
172
198
  return config.baseUrls[service] ?? generatedBaseUrl ?? config.baseUrl;
173
199
  }
174
200
  function formatConfigForLog(config) {
@@ -177,7 +203,7 @@ function formatConfigForLog(config) {
177
203
  }
178
204
 
179
205
  // src/_http.ts
180
- var USER_AGENT = `modus-typescript/${"0.2.1"} (node/${process.version}; ${process.platform})`;
206
+ var USER_AGENT = `modus-typescript/${"0.2.3"} (node/${process.version}; ${process.platform})`;
181
207
  function buildUrl(baseUrl, path, params) {
182
208
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
183
209
  if (params) {
@@ -272,6 +298,26 @@ function wrapNetworkError(error, baseUrl) {
272
298
  async function readBody(response) {
273
299
  return response.text();
274
300
  }
301
+ async function readBodyPreview(response, maxChars = 200) {
302
+ if (!response.body) return "";
303
+ const reader = response.body.getReader();
304
+ const decoder = new TextDecoder();
305
+ let out = "";
306
+ try {
307
+ while (out.length < maxChars) {
308
+ const { done, value } = await reader.read();
309
+ if (done) break;
310
+ out += decoder.decode(value, { stream: true });
311
+ if (out.length >= maxChars) {
312
+ out = out.slice(0, maxChars);
313
+ break;
314
+ }
315
+ }
316
+ } finally {
317
+ await reader.cancel().catch(() => void 0);
318
+ }
319
+ return out;
320
+ }
275
321
  var HttpClient = class {
276
322
  constructor(config) {
277
323
  this.config = config;
@@ -312,6 +358,9 @@ var HttpClient = class {
312
358
  post(path, json, options = {}) {
313
359
  return this.request("POST", path, { json, ...options });
314
360
  }
361
+ put(path, json, options = {}) {
362
+ return this.request("PUT", path, { json, ...options });
363
+ }
315
364
  patch(path, json, params, options = {}) {
316
365
  return this.request("PATCH", path, { json, params, ...options });
317
366
  }
@@ -324,7 +373,13 @@ var HttpClient = class {
324
373
  try {
325
374
  const response = await this.config.fetch(url, {
326
375
  method,
327
- headers: { ...this.defaultHeaders(), ...options.headers },
376
+ // Agent-service negotiates SSE vs JSON polling on Accept; JSON-only
377
+ // Accept returns {"runId","status":"pending"} instead of token SSE.
378
+ headers: {
379
+ ...this.defaultHeaders(),
380
+ ...options.headers,
381
+ Accept: "text/event-stream"
382
+ },
328
383
  body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
329
384
  signal: AbortSignal.timeout(this.config.timeoutMs)
330
385
  });
@@ -333,6 +388,14 @@ var HttpClient = class {
333
388
  raiseForStatus(response, body);
334
389
  return;
335
390
  }
391
+ const contentType = response.headers.get("content-type") ?? "";
392
+ if (!contentType.toLowerCase().includes("text/event-stream")) {
393
+ const preview = await readBodyPreview(response);
394
+ throw new ModusError(
395
+ `Unexpected stream response: expected Content-Type text/event-stream, got ${JSON.stringify(contentType) || "(missing)"}. Body preview: ${preview}`,
396
+ { statusCode: response.status, body: preview }
397
+ );
398
+ }
336
399
  if (!response.body) return;
337
400
  const reader = response.body.getReader();
338
401
  const decoder = new TextDecoder();
@@ -462,7 +525,7 @@ var OPERATIONS = {
462
525
  method: "GET",
463
526
  path: "/api/v1/connections",
464
527
  service: "modus-api",
465
- serverUrl: "https://api.modus.com",
528
+ serverUrl: "https://api.getmodus.com",
466
529
  pathParams: [],
467
530
  queryParams: ["pageToken", "pageSize", "type"],
468
531
  requestSchema: null,
@@ -472,7 +535,7 @@ var OPERATIONS = {
472
535
  method: "POST",
473
536
  path: "/api/v1/context/links",
474
537
  service: "modus-api",
475
- serverUrl: "https://api.modus.com",
538
+ serverUrl: "https://api.getmodus.com",
476
539
  pathParams: [],
477
540
  queryParams: [],
478
541
  requestSchema: "CreateLinkDto",
@@ -482,7 +545,7 @@ var OPERATIONS = {
482
545
  method: "POST",
483
546
  path: "/api/v1/context/notes",
484
547
  service: "modus-api",
485
- serverUrl: "https://api.modus.com",
548
+ serverUrl: "https://api.getmodus.com",
486
549
  pathParams: [],
487
550
  queryParams: [],
488
551
  requestSchema: "CreateNoteDto",
@@ -492,7 +555,7 @@ var OPERATIONS = {
492
555
  method: "POST",
493
556
  path: "/api/v1/context/saved-queries",
494
557
  service: "modus-api",
495
- serverUrl: "https://api.modus.com",
558
+ serverUrl: "https://api.getmodus.com",
496
559
  pathParams: [],
497
560
  queryParams: [],
498
561
  requestSchema: "CreateSavedQueryDto",
@@ -502,7 +565,7 @@ var OPERATIONS = {
502
565
  method: "DELETE",
503
566
  path: "/api/v1/context/items/{uid}",
504
567
  service: "modus-api",
505
- serverUrl: "https://api.modus.com",
568
+ serverUrl: "https://api.getmodus.com",
506
569
  pathParams: ["uid"],
507
570
  queryParams: [],
508
571
  requestSchema: null,
@@ -512,7 +575,7 @@ var OPERATIONS = {
512
575
  method: "GET",
513
576
  path: "/api/v1/context/items/{uid}",
514
577
  service: "modus-api",
515
- serverUrl: "https://api.modus.com",
578
+ serverUrl: "https://api.getmodus.com",
516
579
  pathParams: ["uid"],
517
580
  queryParams: [],
518
581
  requestSchema: null,
@@ -522,7 +585,7 @@ var OPERATIONS = {
522
585
  method: "GET",
523
586
  path: "/api/v1/context/items",
524
587
  service: "modus-api",
525
- serverUrl: "https://api.modus.com",
588
+ serverUrl: "https://api.getmodus.com",
526
589
  pathParams: [],
527
590
  queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
528
591
  requestSchema: null,
@@ -532,7 +595,7 @@ var OPERATIONS = {
532
595
  method: "GET",
533
596
  path: "/api/v1/context/items/{uid}/values",
534
597
  service: "modus-api",
535
- serverUrl: "https://api.modus.com",
598
+ serverUrl: "https://api.getmodus.com",
536
599
  pathParams: ["uid"],
537
600
  queryParams: ["contextType", "contentKeyPath", "pageSize", "offset", "pageToken", "searchQuery", "dataPathPrefix"],
538
601
  requestSchema: null,
@@ -542,7 +605,7 @@ var OPERATIONS = {
542
605
  method: "POST",
543
606
  path: "/api/v1/context/items/lookup",
544
607
  service: "modus-api",
545
- serverUrl: "https://api.modus.com",
608
+ serverUrl: "https://api.getmodus.com",
546
609
  pathParams: [],
547
610
  queryParams: [],
548
611
  requestSchema: "LookupContextItemDto",
@@ -552,7 +615,7 @@ var OPERATIONS = {
552
615
  method: "PATCH",
553
616
  path: "/api/v1/context/items/{uid}",
554
617
  service: "modus-api",
555
- serverUrl: "https://api.modus.com",
618
+ serverUrl: "https://api.getmodus.com",
556
619
  pathParams: ["uid"],
557
620
  queryParams: ["updateMask"],
558
621
  requestSchema: "UpdateContextItemDto",
@@ -562,7 +625,7 @@ var OPERATIONS = {
562
625
  method: "POST",
563
626
  path: "/api/v1/context/custom-items/batch",
564
627
  service: "modus-api",
565
- serverUrl: "https://api.modus.com",
628
+ serverUrl: "https://api.getmodus.com",
566
629
  pathParams: [],
567
630
  queryParams: [],
568
631
  requestSchema: "BatchCreateCustomContextItemsDto",
@@ -572,7 +635,7 @@ var OPERATIONS = {
572
635
  method: "POST",
573
636
  path: "/api/v1/context/custom-items",
574
637
  service: "modus-api",
575
- serverUrl: "https://api.modus.com",
638
+ serverUrl: "https://api.getmodus.com",
576
639
  pathParams: [],
577
640
  queryParams: [],
578
641
  requestSchema: "CreateCustomContextItemDto",
@@ -582,7 +645,7 @@ var OPERATIONS = {
582
645
  method: "DELETE",
583
646
  path: "/api/v1/context/custom-items/{uid}",
584
647
  service: "modus-api",
585
- serverUrl: "https://api.modus.com",
648
+ serverUrl: "https://api.getmodus.com",
586
649
  pathParams: ["uid"],
587
650
  queryParams: [],
588
651
  requestSchema: null,
@@ -592,7 +655,7 @@ var OPERATIONS = {
592
655
  method: "GET",
593
656
  path: "/api/v1/context/custom-items/{uid}",
594
657
  service: "modus-api",
595
- serverUrl: "https://api.modus.com",
658
+ serverUrl: "https://api.getmodus.com",
596
659
  pathParams: ["uid"],
597
660
  queryParams: [],
598
661
  requestSchema: null,
@@ -602,7 +665,7 @@ var OPERATIONS = {
602
665
  method: "GET",
603
666
  path: "/api/v1/context/custom-items",
604
667
  service: "modus-api",
605
- serverUrl: "https://api.modus.com",
668
+ serverUrl: "https://api.getmodus.com",
606
669
  pathParams: [],
607
670
  queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
608
671
  requestSchema: null,
@@ -612,7 +675,7 @@ var OPERATIONS = {
612
675
  method: "PATCH",
613
676
  path: "/api/v1/context/custom-items/{uid}",
614
677
  service: "modus-api",
615
- serverUrl: "https://api.modus.com",
678
+ serverUrl: "https://api.getmodus.com",
616
679
  pathParams: ["uid"],
617
680
  queryParams: [],
618
681
  requestSchema: "UpdateCustomContextItemDto",
@@ -622,7 +685,7 @@ var OPERATIONS = {
622
685
  method: "GET",
623
686
  path: "/api/v1/scopes/{id}/evaluations/config",
624
687
  service: "modus-api",
625
- serverUrl: "https://api.modus.com",
688
+ serverUrl: "https://api.getmodus.com",
626
689
  pathParams: ["id"],
627
690
  queryParams: [],
628
691
  requestSchema: null,
@@ -632,7 +695,7 @@ var OPERATIONS = {
632
695
  method: "GET",
633
696
  path: "/api/v1/scopes/{id}/evaluations/runs/{runId}",
634
697
  service: "modus-api",
635
- serverUrl: "https://api.modus.com",
698
+ serverUrl: "https://api.getmodus.com",
636
699
  pathParams: ["id", "runId"],
637
700
  queryParams: [],
638
701
  requestSchema: null,
@@ -642,7 +705,7 @@ var OPERATIONS = {
642
705
  method: "GET",
643
706
  path: "/api/v1/scopes/{id}/evaluations/runs",
644
707
  service: "modus-api",
645
- serverUrl: "https://api.modus.com",
708
+ serverUrl: "https://api.getmodus.com",
646
709
  pathParams: ["id"],
647
710
  queryParams: ["pageSize", "pageToken"],
648
711
  requestSchema: null,
@@ -652,7 +715,7 @@ var OPERATIONS = {
652
715
  method: "POST",
653
716
  path: "/api/v1/scopes/{id}/evaluations/runs",
654
717
  service: "modus-api",
655
- serverUrl: "https://api.modus.com",
718
+ serverUrl: "https://api.getmodus.com",
656
719
  pathParams: ["id"],
657
720
  queryParams: [],
658
721
  requestSchema: null,
@@ -662,7 +725,7 @@ var OPERATIONS = {
662
725
  method: "PUT",
663
726
  path: "/api/v1/scopes/{id}/evaluations/config",
664
727
  service: "modus-api",
665
- serverUrl: "https://api.modus.com",
728
+ serverUrl: "https://api.getmodus.com",
666
729
  pathParams: ["id"],
667
730
  queryParams: [],
668
731
  requestSchema: "UpdateEvaluationConfigDto",
@@ -672,7 +735,7 @@ var OPERATIONS = {
672
735
  method: "GET",
673
736
  path: "/api/v1/users/member-groups",
674
737
  service: "modus-api",
675
- serverUrl: "https://api.modus.com",
738
+ serverUrl: "https://api.getmodus.com",
676
739
  pathParams: [],
677
740
  queryParams: ["pageSize", "pageToken"],
678
741
  requestSchema: null,
@@ -682,7 +745,7 @@ var OPERATIONS = {
682
745
  method: "POST",
683
746
  path: "/api/v1/modus/chat",
684
747
  service: "modus-api",
685
- serverUrl: "https://api.modus.com",
748
+ serverUrl: "https://api.getmodus.com",
686
749
  pathParams: [],
687
750
  queryParams: [],
688
751
  requestSchema: "ModusChatRequestDto",
@@ -692,7 +755,7 @@ var OPERATIONS = {
692
755
  method: "POST",
693
756
  path: "/api/v1/modus/conversations/{threadId}/chat",
694
757
  service: "modus-api",
695
- serverUrl: "https://api.modus.com",
758
+ serverUrl: "https://api.getmodus.com",
696
759
  pathParams: ["threadId"],
697
760
  queryParams: [],
698
761
  requestSchema: "ModusChatRequestDto",
@@ -702,7 +765,7 @@ var OPERATIONS = {
702
765
  method: "POST",
703
766
  path: "/api/v1/modus/context",
704
767
  service: "modus-api",
705
- serverUrl: "https://api.modus.com",
768
+ serverUrl: "https://api.getmodus.com",
706
769
  pathParams: [],
707
770
  queryParams: [],
708
771
  requestSchema: "ModusContextRequestDto",
@@ -712,7 +775,7 @@ var OPERATIONS = {
712
775
  method: "GET",
713
776
  path: "/api/v1/modus/conversations/{threadId}",
714
777
  service: "modus-api",
715
- serverUrl: "https://api.modus.com",
778
+ serverUrl: "https://api.getmodus.com",
716
779
  pathParams: ["threadId"],
717
780
  queryParams: [],
718
781
  requestSchema: null,
@@ -722,7 +785,7 @@ var OPERATIONS = {
722
785
  method: "GET",
723
786
  path: "/api/v1/modus/conversations",
724
787
  service: "modus-api",
725
- serverUrl: "https://api.modus.com",
788
+ serverUrl: "https://api.getmodus.com",
726
789
  pathParams: [],
727
790
  queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools", "kind"],
728
791
  requestSchema: null,
@@ -732,7 +795,7 @@ var OPERATIONS = {
732
795
  method: "POST",
733
796
  path: "/agent/v1/modus/runs",
734
797
  service: "agent-service",
735
- serverUrl: "https://agent.modus.com",
798
+ serverUrl: "https://agent.getmodus.com",
736
799
  pathParams: [],
737
800
  queryParams: [],
738
801
  requestSchema: "ModusRunDto",
@@ -742,7 +805,7 @@ var OPERATIONS = {
742
805
  method: "GET",
743
806
  path: "/api/v1/users/org-members",
744
807
  service: "modus-api",
745
- serverUrl: "https://api.modus.com",
808
+ serverUrl: "https://api.getmodus.com",
746
809
  pathParams: [],
747
810
  queryParams: ["pageSize", "pageToken"],
748
811
  requestSchema: null,
@@ -752,7 +815,7 @@ var OPERATIONS = {
752
815
  method: "DELETE",
753
816
  path: "/api/v1/users/organization",
754
817
  service: "modus-api",
755
- serverUrl: "https://api.modus.com",
818
+ serverUrl: "https://api.getmodus.com",
756
819
  pathParams: [],
757
820
  queryParams: [],
758
821
  requestSchema: null,
@@ -762,7 +825,7 @@ var OPERATIONS = {
762
825
  method: "POST",
763
826
  path: "/agent/v1/runs/{runId}/resume",
764
827
  service: "agent-service",
765
- serverUrl: "https://agent.modus.com",
828
+ serverUrl: "https://agent.getmodus.com",
766
829
  pathParams: ["runId"],
767
830
  queryParams: [],
768
831
  requestSchema: "ResumeRunDto",
@@ -772,7 +835,7 @@ var OPERATIONS = {
772
835
  method: "GET",
773
836
  path: "/agent/v1/runs/active",
774
837
  service: "agent-service",
775
- serverUrl: "https://agent.modus.com",
838
+ serverUrl: "https://agent.getmodus.com",
776
839
  pathParams: [],
777
840
  queryParams: ["pageToken", "pageSize"],
778
841
  requestSchema: null,
@@ -782,7 +845,7 @@ var OPERATIONS = {
782
845
  method: "POST",
783
846
  path: "/agent/v1/runs/active-by-session",
784
847
  service: "agent-service",
785
- serverUrl: "https://agent.modus.com",
848
+ serverUrl: "https://agent.getmodus.com",
786
849
  pathParams: [],
787
850
  queryParams: [],
788
851
  requestSchema: "ActiveRunsBySessionDto",
@@ -792,7 +855,7 @@ var OPERATIONS = {
792
855
  method: "POST",
793
856
  path: "/agent/v1/runs/{runId}/cancel",
794
857
  service: "agent-service",
795
- serverUrl: "https://agent.modus.com",
858
+ serverUrl: "https://agent.getmodus.com",
796
859
  pathParams: ["runId"],
797
860
  queryParams: [],
798
861
  requestSchema: "CancelRunDto",
@@ -802,7 +865,7 @@ var OPERATIONS = {
802
865
  method: "POST",
803
866
  path: "/agent/v1/runs/{runId}/queue-edit",
804
867
  service: "agent-service",
805
- serverUrl: "https://agent.modus.com",
868
+ serverUrl: "https://agent.getmodus.com",
806
869
  pathParams: ["runId"],
807
870
  queryParams: [],
808
871
  requestSchema: "EditQueuedRunDto",
@@ -812,7 +875,7 @@ var OPERATIONS = {
812
875
  method: "GET",
813
876
  path: "/agent/v1/runs/{runId}/events",
814
877
  service: "agent-service",
815
- serverUrl: "https://agent.modus.com",
878
+ serverUrl: "https://agent.getmodus.com",
816
879
  pathParams: ["runId"],
817
880
  queryParams: [],
818
881
  requestSchema: null,
@@ -822,7 +885,7 @@ var OPERATIONS = {
822
885
  method: "POST",
823
886
  path: "/agent/v1/runs/{runId}/interrupt",
824
887
  service: "agent-service",
825
- serverUrl: "https://agent.modus.com",
888
+ serverUrl: "https://agent.getmodus.com",
826
889
  pathParams: ["runId"],
827
890
  queryParams: [],
828
891
  requestSchema: "InterruptRunDto",
@@ -832,7 +895,7 @@ var OPERATIONS = {
832
895
  method: "GET",
833
896
  path: "/agent/v1/runs/{runId}/stream",
834
897
  service: "agent-service",
835
- serverUrl: "https://agent.modus.com",
898
+ serverUrl: "https://agent.getmodus.com",
836
899
  pathParams: ["runId"],
837
900
  queryParams: [],
838
901
  requestSchema: null,
@@ -842,7 +905,7 @@ var OPERATIONS = {
842
905
  method: "POST",
843
906
  path: "/api/v1/scopes/{id}/chat",
844
907
  service: "modus-api",
845
- serverUrl: "https://api.modus.com",
908
+ serverUrl: "https://api.getmodus.com",
846
909
  pathParams: ["id"],
847
910
  queryParams: [],
848
911
  requestSchema: "SkillChatRequestDto",
@@ -852,7 +915,7 @@ var OPERATIONS = {
852
915
  method: "POST",
853
916
  path: "/api/v1/scopes/{id}/conversations/{threadId}/chat",
854
917
  service: "modus-api",
855
- serverUrl: "https://api.modus.com",
918
+ serverUrl: "https://api.getmodus.com",
856
919
  pathParams: ["id", "threadId"],
857
920
  queryParams: [],
858
921
  requestSchema: "SkillChatRequestDto",
@@ -862,7 +925,7 @@ var OPERATIONS = {
862
925
  method: "POST",
863
926
  path: "/api/v1/scopes/{id}/context",
864
927
  service: "modus-api",
865
- serverUrl: "https://api.modus.com",
928
+ serverUrl: "https://api.getmodus.com",
866
929
  pathParams: ["id"],
867
930
  queryParams: [],
868
931
  requestSchema: "ComposeSkillContextRequestDto",
@@ -872,7 +935,7 @@ var OPERATIONS = {
872
935
  method: "GET",
873
936
  path: "/api/v1/scopes/{id}/conversations/{threadId}",
874
937
  service: "modus-api",
875
- serverUrl: "https://api.modus.com",
938
+ serverUrl: "https://api.getmodus.com",
876
939
  pathParams: ["id", "threadId"],
877
940
  queryParams: ["messageLimit", "beforeMessageIndex"],
878
941
  requestSchema: null,
@@ -882,7 +945,7 @@ var OPERATIONS = {
882
945
  method: "GET",
883
946
  path: "/api/v1/scopes/{id}/conversations",
884
947
  service: "modus-api",
885
- serverUrl: "https://api.modus.com",
948
+ serverUrl: "https://api.getmodus.com",
886
949
  pathParams: ["id"],
887
950
  queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools"],
888
951
  requestSchema: null,
@@ -892,7 +955,7 @@ var OPERATIONS = {
892
955
  method: "DELETE",
893
956
  path: "/api/v1/scopes/{id}/memories/{memoryId}",
894
957
  service: "modus-api",
895
- serverUrl: "https://api.modus.com",
958
+ serverUrl: "https://api.getmodus.com",
896
959
  pathParams: ["id", "memoryId"],
897
960
  queryParams: [],
898
961
  requestSchema: null,
@@ -902,7 +965,7 @@ var OPERATIONS = {
902
965
  method: "GET",
903
966
  path: "/api/v1/scopes/{id}/memories",
904
967
  service: "modus-api",
905
- serverUrl: "https://api.modus.com",
968
+ serverUrl: "https://api.getmodus.com",
906
969
  pathParams: ["id"],
907
970
  queryParams: ["pageToken", "pageSize", "userId", "limit"],
908
971
  requestSchema: null,
@@ -912,7 +975,7 @@ var OPERATIONS = {
912
975
  method: "POST",
913
976
  path: "/api/v1/scopes/{id}/memories/search",
914
977
  service: "modus-api",
915
- serverUrl: "https://api.modus.com",
978
+ serverUrl: "https://api.getmodus.com",
916
979
  pathParams: ["id"],
917
980
  queryParams: [],
918
981
  requestSchema: "SearchMemoriesRequestDto",
@@ -922,7 +985,7 @@ var OPERATIONS = {
922
985
  method: "PATCH",
923
986
  path: "/api/v1/scopes/{id}/memories/{memoryId}",
924
987
  service: "modus-api",
925
- serverUrl: "https://api.modus.com",
988
+ serverUrl: "https://api.getmodus.com",
926
989
  pathParams: ["id", "memoryId"],
927
990
  queryParams: ["updateMask"],
928
991
  requestSchema: "UpdateMemoryRequestDto",
@@ -932,7 +995,7 @@ var OPERATIONS = {
932
995
  method: "POST",
933
996
  path: "/agent/v1/scopes/{id}/runs",
934
997
  service: "agent-service",
935
- serverUrl: "https://agent.modus.com",
998
+ serverUrl: "https://agent.getmodus.com",
936
999
  pathParams: ["id"],
937
1000
  queryParams: [],
938
1001
  requestSchema: "SkillRunDto",
@@ -942,7 +1005,7 @@ var OPERATIONS = {
942
1005
  method: "GET",
943
1006
  path: "/api/v1/scopes/{id}/supervision",
944
1007
  service: "modus-api",
945
- serverUrl: "https://api.modus.com",
1008
+ serverUrl: "https://api.getmodus.com",
946
1009
  pathParams: ["id"],
947
1010
  queryParams: ["view"],
948
1011
  requestSchema: null,
@@ -952,7 +1015,7 @@ var OPERATIONS = {
952
1015
  method: "PUT",
953
1016
  path: "/api/v1/scopes/{id}/supervision",
954
1017
  service: "modus-api",
955
- serverUrl: "https://api.modus.com",
1018
+ serverUrl: "https://api.getmodus.com",
956
1019
  pathParams: ["id"],
957
1020
  queryParams: [],
958
1021
  requestSchema: "SetSupervisionRequestDto",
@@ -962,7 +1025,7 @@ var OPERATIONS = {
962
1025
  method: "PUT",
963
1026
  path: "/api/v1/scopes/{id}/supervision/active",
964
1027
  service: "modus-api",
965
- serverUrl: "https://api.modus.com",
1028
+ serverUrl: "https://api.getmodus.com",
966
1029
  pathParams: ["id"],
967
1030
  queryParams: [],
968
1031
  requestSchema: "SetSupervisionRequestDto",
@@ -972,7 +1035,7 @@ var OPERATIONS = {
972
1035
  method: "POST",
973
1036
  path: "/api/v1/scopes/{id}/transfer-ownership/accept",
974
1037
  service: "modus-api",
975
- serverUrl: "https://api.modus.com",
1038
+ serverUrl: "https://api.getmodus.com",
976
1039
  pathParams: ["id"],
977
1040
  queryParams: [],
978
1041
  requestSchema: null,
@@ -982,7 +1045,7 @@ var OPERATIONS = {
982
1045
  method: "DELETE",
983
1046
  path: "/api/v1/scopes/{id}/transfer-ownership",
984
1047
  service: "modus-api",
985
- serverUrl: "https://api.modus.com",
1048
+ serverUrl: "https://api.getmodus.com",
986
1049
  pathParams: ["id"],
987
1050
  queryParams: [],
988
1051
  requestSchema: null,
@@ -992,7 +1055,7 @@ var OPERATIONS = {
992
1055
  method: "POST",
993
1056
  path: "/api/v1/scopes",
994
1057
  service: "modus-api",
995
- serverUrl: "https://api.modus.com",
1058
+ serverUrl: "https://api.getmodus.com",
996
1059
  pathParams: [],
997
1060
  queryParams: [],
998
1061
  requestSchema: "CreateSkillDto",
@@ -1002,7 +1065,7 @@ var OPERATIONS = {
1002
1065
  method: "DELETE",
1003
1066
  path: "/api/v1/scopes/{id}",
1004
1067
  service: "modus-api",
1005
- serverUrl: "https://api.modus.com",
1068
+ serverUrl: "https://api.getmodus.com",
1006
1069
  pathParams: ["id"],
1007
1070
  queryParams: [],
1008
1071
  requestSchema: null,
@@ -1012,7 +1075,7 @@ var OPERATIONS = {
1012
1075
  method: "POST",
1013
1076
  path: "/api/v1/scopes/{id}/deploy",
1014
1077
  service: "modus-api",
1015
- serverUrl: "https://api.modus.com",
1078
+ serverUrl: "https://api.getmodus.com",
1016
1079
  pathParams: ["id"],
1017
1080
  queryParams: [],
1018
1081
  requestSchema: "DeploySkillDto",
@@ -1022,7 +1085,7 @@ var OPERATIONS = {
1022
1085
  method: "GET",
1023
1086
  path: "/api/v1/scopes/{id}",
1024
1087
  service: "modus-api",
1025
- serverUrl: "https://api.modus.com",
1088
+ serverUrl: "https://api.getmodus.com",
1026
1089
  pathParams: ["id"],
1027
1090
  queryParams: ["view"],
1028
1091
  requestSchema: null,
@@ -1032,7 +1095,7 @@ var OPERATIONS = {
1032
1095
  method: "GET",
1033
1096
  path: "/api/v1/scopes/{id}/variations/{variationUid}",
1034
1097
  service: "modus-api",
1035
- serverUrl: "https://api.modus.com",
1098
+ serverUrl: "https://api.getmodus.com",
1036
1099
  pathParams: ["id", "variationUid"],
1037
1100
  queryParams: [],
1038
1101
  requestSchema: null,
@@ -1042,7 +1105,7 @@ var OPERATIONS = {
1042
1105
  method: "GET",
1043
1106
  path: "/api/v1/scopes",
1044
1107
  service: "modus-api",
1045
- serverUrl: "https://api.modus.com",
1108
+ serverUrl: "https://api.getmodus.com",
1046
1109
  pathParams: [],
1047
1110
  queryParams: ["pageToken", "pageSize", "view", "search", "managerId", "includeVariation"],
1048
1111
  requestSchema: null,
@@ -1052,7 +1115,7 @@ var OPERATIONS = {
1052
1115
  method: "PATCH",
1053
1116
  path: "/api/v1/scopes/{id}/mcp-config",
1054
1117
  service: "modus-api",
1055
- serverUrl: "https://api.modus.com",
1118
+ serverUrl: "https://api.getmodus.com",
1056
1119
  pathParams: ["id"],
1057
1120
  queryParams: [],
1058
1121
  requestSchema: "PatchSkillMcpConfigDto",
@@ -1062,7 +1125,7 @@ var OPERATIONS = {
1062
1125
  method: "POST",
1063
1126
  path: "/api/v1/scopes/{id}/transfer-ownership",
1064
1127
  service: "modus-api",
1065
- serverUrl: "https://api.modus.com",
1128
+ serverUrl: "https://api.getmodus.com",
1066
1129
  pathParams: ["id"],
1067
1130
  queryParams: [],
1068
1131
  requestSchema: "TransferOwnershipDto",
@@ -1072,7 +1135,7 @@ var OPERATIONS = {
1072
1135
  method: "POST",
1073
1136
  path: "/api/v1/scopes/{id}/restore",
1074
1137
  service: "modus-api",
1075
- serverUrl: "https://api.modus.com",
1138
+ serverUrl: "https://api.getmodus.com",
1076
1139
  pathParams: ["id"],
1077
1140
  queryParams: [],
1078
1141
  requestSchema: null,
@@ -1082,7 +1145,7 @@ var OPERATIONS = {
1082
1145
  method: "PATCH",
1083
1146
  path: "/api/v1/scopes/{id}",
1084
1147
  service: "modus-api",
1085
- serverUrl: "https://api.modus.com",
1148
+ serverUrl: "https://api.getmodus.com",
1086
1149
  pathParams: ["id"],
1087
1150
  queryParams: ["updateMask"],
1088
1151
  requestSchema: "UpdateSkillDto",
@@ -1092,7 +1155,7 @@ var OPERATIONS = {
1092
1155
  method: "GET",
1093
1156
  path: "/api/v1/suggestions/questions",
1094
1157
  service: "modus-api",
1095
- serverUrl: "https://api.modus.com",
1158
+ serverUrl: "https://api.getmodus.com",
1096
1159
  pathParams: [],
1097
1160
  queryParams: ["pageToken", "pageSize", "skill_id", "skill_ids"],
1098
1161
  requestSchema: null,
@@ -1102,7 +1165,7 @@ var OPERATIONS = {
1102
1165
  method: "POST",
1103
1166
  path: "/api/v1/suggestions/questions/{id}/events",
1104
1167
  service: "modus-api",
1105
- serverUrl: "https://api.modus.com",
1168
+ serverUrl: "https://api.getmodus.com",
1106
1169
  pathParams: ["id"],
1107
1170
  queryParams: [],
1108
1171
  requestSchema: "RecordSuggestionEventDto",
@@ -1112,7 +1175,7 @@ var OPERATIONS = {
1112
1175
  method: "GET",
1113
1176
  path: "/api/v1/usage",
1114
1177
  service: "modus-api",
1115
- serverUrl: "https://api.modus.com",
1178
+ serverUrl: "https://api.getmodus.com",
1116
1179
  pathParams: [],
1117
1180
  queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface"],
1118
1181
  requestSchema: null,
@@ -1122,7 +1185,7 @@ var OPERATIONS = {
1122
1185
  method: "POST",
1123
1186
  path: "/agent/v1/workflow-actions/{runId}/cancel",
1124
1187
  service: "agent-service",
1125
- serverUrl: "https://agent.modus.com",
1188
+ serverUrl: "https://agent.getmodus.com",
1126
1189
  pathParams: ["runId"],
1127
1190
  queryParams: [],
1128
1191
  requestSchema: "CancelRunDto",
@@ -1132,7 +1195,7 @@ var OPERATIONS = {
1132
1195
  method: "POST",
1133
1196
  path: "/agent/v1/workflow-actions",
1134
1197
  service: "agent-service",
1135
- serverUrl: "https://agent.modus.com",
1198
+ serverUrl: "https://agent.getmodus.com",
1136
1199
  pathParams: [],
1137
1200
  queryParams: [],
1138
1201
  requestSchema: "WorkflowActionDto",
@@ -1142,7 +1205,7 @@ var OPERATIONS = {
1142
1205
  method: "POST",
1143
1206
  path: "/api/v1/workflows/{id}/interfaces",
1144
1207
  service: "modus-api",
1145
- serverUrl: "https://api.modus.com",
1208
+ serverUrl: "https://api.getmodus.com",
1146
1209
  pathParams: ["id"],
1147
1210
  queryParams: [],
1148
1211
  requestSchema: "AddAgentInterfaceDto",
@@ -1152,7 +1215,7 @@ var OPERATIONS = {
1152
1215
  method: "DELETE",
1153
1216
  path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
1154
1217
  service: "modus-api",
1155
- serverUrl: "https://api.modus.com",
1218
+ serverUrl: "https://api.getmodus.com",
1156
1219
  pathParams: ["id", "interfaceId"],
1157
1220
  queryParams: [],
1158
1221
  requestSchema: null,
@@ -1162,7 +1225,7 @@ var OPERATIONS = {
1162
1225
  method: "DELETE",
1163
1226
  path: "/api/v1/workflows/{id}/interfaces",
1164
1227
  service: "modus-api",
1165
- serverUrl: "https://api.modus.com",
1228
+ serverUrl: "https://api.getmodus.com",
1166
1229
  pathParams: ["id"],
1167
1230
  queryParams: [],
1168
1231
  requestSchema: null,
@@ -1172,7 +1235,7 @@ var OPERATIONS = {
1172
1235
  method: "GET",
1173
1236
  path: "/api/v1/workflows/{id}/interfaces",
1174
1237
  service: "modus-api",
1175
- serverUrl: "https://api.modus.com",
1238
+ serverUrl: "https://api.getmodus.com",
1176
1239
  pathParams: ["id"],
1177
1240
  queryParams: ["pageSize", "pageToken"],
1178
1241
  requestSchema: null,
@@ -1182,7 +1245,7 @@ var OPERATIONS = {
1182
1245
  method: "PATCH",
1183
1246
  path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
1184
1247
  service: "modus-api",
1185
- serverUrl: "https://api.modus.com",
1248
+ serverUrl: "https://api.getmodus.com",
1186
1249
  pathParams: ["id", "interfaceId"],
1187
1250
  queryParams: ["updateMask"],
1188
1251
  requestSchema: "UpdateAgentInterfaceDto",
@@ -1192,7 +1255,7 @@ var OPERATIONS = {
1192
1255
  method: "POST",
1193
1256
  path: "/agent/v1/workflows/{id}/runs",
1194
1257
  service: "agent-service",
1195
- serverUrl: "https://agent.modus.com",
1258
+ serverUrl: "https://agent.getmodus.com",
1196
1259
  pathParams: ["id"],
1197
1260
  queryParams: [],
1198
1261
  requestSchema: "AgentRunDto",
@@ -1202,7 +1265,7 @@ var OPERATIONS = {
1202
1265
  method: "GET",
1203
1266
  path: "/api/v1/workflows/{id}/runs/{runId}",
1204
1267
  service: "modus-api",
1205
- serverUrl: "https://api.modus.com",
1268
+ serverUrl: "https://api.getmodus.com",
1206
1269
  pathParams: ["id", "runId"],
1207
1270
  queryParams: ["temporalRunId"],
1208
1271
  requestSchema: null,
@@ -1212,7 +1275,7 @@ var OPERATIONS = {
1212
1275
  method: "GET",
1213
1276
  path: "/api/v1/workflows/{id}/runs",
1214
1277
  service: "modus-api",
1215
- serverUrl: "https://api.modus.com",
1278
+ serverUrl: "https://api.getmodus.com",
1216
1279
  pathParams: ["id"],
1217
1280
  queryParams: ["status", "timeframe", "approvalScope", "search", "pageSize", "pageToken"],
1218
1281
  requestSchema: null,
@@ -1222,7 +1285,7 @@ var OPERATIONS = {
1222
1285
  method: "POST",
1223
1286
  path: "/api/v1/workflows/{id}/transfer-ownership/accept",
1224
1287
  service: "modus-api",
1225
- serverUrl: "https://api.modus.com",
1288
+ serverUrl: "https://api.getmodus.com",
1226
1289
  pathParams: ["id"],
1227
1290
  queryParams: [],
1228
1291
  requestSchema: null,
@@ -1232,7 +1295,7 @@ var OPERATIONS = {
1232
1295
  method: "DELETE",
1233
1296
  path: "/api/v1/workflows/{id}/transfer-ownership",
1234
1297
  service: "modus-api",
1235
- serverUrl: "https://api.modus.com",
1298
+ serverUrl: "https://api.getmodus.com",
1236
1299
  pathParams: ["id"],
1237
1300
  queryParams: [],
1238
1301
  requestSchema: null,
@@ -1242,7 +1305,7 @@ var OPERATIONS = {
1242
1305
  method: "POST",
1243
1306
  path: "/api/v1/workflows",
1244
1307
  service: "modus-api",
1245
- serverUrl: "https://api.modus.com",
1308
+ serverUrl: "https://api.getmodus.com",
1246
1309
  pathParams: [],
1247
1310
  queryParams: [],
1248
1311
  requestSchema: "CreateAgentDto",
@@ -1252,7 +1315,7 @@ var OPERATIONS = {
1252
1315
  method: "DELETE",
1253
1316
  path: "/api/v1/workflows/{id}",
1254
1317
  service: "modus-api",
1255
- serverUrl: "https://api.modus.com",
1318
+ serverUrl: "https://api.getmodus.com",
1256
1319
  pathParams: ["id"],
1257
1320
  queryParams: [],
1258
1321
  requestSchema: null,
@@ -1262,7 +1325,7 @@ var OPERATIONS = {
1262
1325
  method: "POST",
1263
1326
  path: "/api/v1/workflows/{id}/deploy",
1264
1327
  service: "modus-api",
1265
- serverUrl: "https://api.modus.com",
1328
+ serverUrl: "https://api.getmodus.com",
1266
1329
  pathParams: ["id"],
1267
1330
  queryParams: [],
1268
1331
  requestSchema: "DeployAgentDto",
@@ -1272,7 +1335,7 @@ var OPERATIONS = {
1272
1335
  method: "GET",
1273
1336
  path: "/api/v1/workflows/{id}",
1274
1337
  service: "modus-api",
1275
- serverUrl: "https://api.modus.com",
1338
+ serverUrl: "https://api.getmodus.com",
1276
1339
  pathParams: ["id"],
1277
1340
  queryParams: ["view"],
1278
1341
  requestSchema: null,
@@ -1282,7 +1345,7 @@ var OPERATIONS = {
1282
1345
  method: "GET",
1283
1346
  path: "/api/v1/workflows",
1284
1347
  service: "modus-api",
1285
- serverUrl: "https://api.modus.com",
1348
+ serverUrl: "https://api.getmodus.com",
1286
1349
  pathParams: [],
1287
1350
  queryParams: ["pageToken", "pageSize", "view", "type", "search", "includeVariation"],
1288
1351
  requestSchema: null,
@@ -1292,7 +1355,7 @@ var OPERATIONS = {
1292
1355
  method: "POST",
1293
1356
  path: "/api/v1/workflows/{id}/transfer-ownership",
1294
1357
  service: "modus-api",
1295
- serverUrl: "https://api.modus.com",
1358
+ serverUrl: "https://api.getmodus.com",
1296
1359
  pathParams: ["id"],
1297
1360
  queryParams: [],
1298
1361
  requestSchema: "TransferOwnershipDto",
@@ -1302,7 +1365,7 @@ var OPERATIONS = {
1302
1365
  method: "POST",
1303
1366
  path: "/api/v1/workflows/{id}/restore",
1304
1367
  service: "modus-api",
1305
- serverUrl: "https://api.modus.com",
1368
+ serverUrl: "https://api.getmodus.com",
1306
1369
  pathParams: ["id"],
1307
1370
  queryParams: [],
1308
1371
  requestSchema: null,
@@ -1312,7 +1375,7 @@ var OPERATIONS = {
1312
1375
  method: "POST",
1313
1376
  path: "/api/v1/workflows/{id}/toggle",
1314
1377
  service: "modus-api",
1315
- serverUrl: "https://api.modus.com",
1378
+ serverUrl: "https://api.getmodus.com",
1316
1379
  pathParams: ["id"],
1317
1380
  queryParams: [],
1318
1381
  requestSchema: "ToggleAgentDto",
@@ -1322,7 +1385,7 @@ var OPERATIONS = {
1322
1385
  method: "PATCH",
1323
1386
  path: "/api/v1/workflows/{id}",
1324
1387
  service: "modus-api",
1325
- serverUrl: "https://api.modus.com",
1388
+ serverUrl: "https://api.getmodus.com",
1326
1389
  pathParams: ["id"],
1327
1390
  queryParams: ["updateMask"],
1328
1391
  requestSchema: "UpdateAgentDto",
@@ -1365,6 +1428,8 @@ async function invokeOperation(http, operationId, options = {}) {
1365
1428
  return http.get(path, params, requestOptions);
1366
1429
  case "POST":
1367
1430
  return http.post(path, options.jsonBody, requestOptions);
1431
+ case "PUT":
1432
+ return http.put(path, options.jsonBody, requestOptions);
1368
1433
  case "PATCH":
1369
1434
  return http.patch(path, options.jsonBody, params, requestOptions);
1370
1435
  case "DELETE":
@@ -1764,6 +1829,11 @@ var ManagementWorkflowsResource = class {
1764
1829
  }
1765
1830
  };
1766
1831
 
1832
+ // src/types/context.ts
1833
+ function withCreatedUid(data) {
1834
+ return { ...data, uid: data.contextItemId };
1835
+ }
1836
+
1767
1837
  // src/resources/context/custom-items.ts
1768
1838
  function parseContextItem(raw) {
1769
1839
  return raw;
@@ -2004,7 +2074,7 @@ var ManagementContextResource = class {
2004
2074
  const data = await invokeWithRetry(this.config, this.http, operationId, {
2005
2075
  jsonBody: payload
2006
2076
  });
2007
- return data;
2077
+ return withCreatedUid(data);
2008
2078
  }
2009
2079
  createNote(title, content) {
2010
2080
  return this.create("ContextCreatorsController_createNote", omitUndefined({ title, content }));