@vm0/cli 9.82.1 → 9.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,7 +47,7 @@ if (DSN) {
47
47
  Sentry.init({
48
48
  dsn: DSN,
49
49
  environment: process.env.SENTRY_ENVIRONMENT ?? "production",
50
- release: "9.82.1",
50
+ release: "9.83.0",
51
51
  sendDefaultPii: false,
52
52
  tracesSampleRate: 0,
53
53
  shutdownTimeout: 500,
@@ -66,7 +66,7 @@ if (DSN) {
66
66
  }
67
67
  });
68
68
  Sentry.setContext("cli", {
69
- version: "9.82.1",
69
+ version: "9.83.0",
70
70
  command: process.argv.slice(2).join(" ")
71
71
  });
72
72
  Sentry.setContext("runtime", {
@@ -165,6 +165,29 @@ import { homedir } from "os";
165
165
  import { join } from "path";
166
166
  import { readFile, writeFile, mkdir, unlink } from "fs/promises";
167
167
  import { existsSync } from "fs";
168
+
169
+ // src/lib/api/cli-token.ts
170
+ function decodeCliTokenPayload(token) {
171
+ const raw = token ?? void 0;
172
+ if (!raw) return void 0;
173
+ const prefix = "vm0_sandbox_";
174
+ if (!raw.startsWith(prefix)) return void 0;
175
+ const jwt = raw.slice(prefix.length);
176
+ const parts = jwt.split(".");
177
+ if (parts.length !== 3) return void 0;
178
+ try {
179
+ const payload = JSON.parse(
180
+ Buffer.from(parts[1], "base64url").toString()
181
+ );
182
+ if (payload.scope === "cli" && payload.orgId && payload.userId) {
183
+ return payload;
184
+ }
185
+ } catch {
186
+ }
187
+ return void 0;
188
+ }
189
+
190
+ // src/lib/api/config.ts
168
191
  function getConfigDir() {
169
192
  return join(homedir(), ".vm0");
170
193
  }
@@ -211,6 +234,9 @@ async function getApiUrl() {
211
234
  async function getActiveOrg() {
212
235
  const zeroPayload = decodeZeroTokenPayload();
213
236
  if (zeroPayload) return zeroPayload.orgId;
237
+ const token = await getToken();
238
+ const cliPayload = decodeCliTokenPayload(token);
239
+ if (cliPayload) return cliPayload.orgId;
214
240
  if (process.env.VM0_ACTIVE_ORG) {
215
241
  return process.env.VM0_ACTIVE_ORG;
216
242
  }
@@ -515,7 +541,7 @@ var apifyFirewall = {
515
541
  },
516
542
  apis: [
517
543
  {
518
- base: "https://api.apify.com/v2",
544
+ base: "https://api.apify.com",
519
545
  auth: {
520
546
  headers: {
521
547
  Authorization: "Bearer ${{ secrets.APIFY_TOKEN }}"
@@ -619,7 +645,7 @@ var brevoFirewall = {
619
645
  },
620
646
  apis: [
621
647
  {
622
- base: "https://api.brevo.com/v3",
648
+ base: "https://api.brevo.com",
623
649
  auth: {
624
650
  headers: {
625
651
  "api-key": "${{ secrets.BREVO_TOKEN }}"
@@ -831,7 +857,7 @@ var clickupFirewall = {
831
857
  },
832
858
  apis: [
833
859
  {
834
- base: "https://api.clickup.com/api/v2",
860
+ base: "https://api.clickup.com/api",
835
861
  auth: {
836
862
  headers: {
837
863
  Authorization: "${{ secrets.CLICKUP_TOKEN }}"
@@ -857,7 +883,7 @@ var closeFirewall = {
857
883
  },
858
884
  apis: [
859
885
  {
860
- base: "https://api.close.com/api/v1",
886
+ base: "https://api.close.com/api",
861
887
  auth: {
862
888
  headers: {
863
889
  Authorization: "Bearer ${{ secrets.CLOSE_TOKEN }}"
@@ -1455,6 +1481,36 @@ var falFirewall = {
1455
1481
  FAL_TOKEN: "Vm0PlaceHolder00:sk_live_Vm0PlaceHolder00000000000000"
1456
1482
  },
1457
1483
  apis: [
1484
+ {
1485
+ base: "https://fal.run",
1486
+ auth: {
1487
+ headers: {
1488
+ Authorization: "Key ${{ secrets.FAL_TOKEN }}"
1489
+ }
1490
+ },
1491
+ permissions: [
1492
+ {
1493
+ name: "unrestricted",
1494
+ description: "Allow all endpoints",
1495
+ rules: ["ANY /{path*}"]
1496
+ }
1497
+ ]
1498
+ },
1499
+ {
1500
+ base: "https://queue.fal.run",
1501
+ auth: {
1502
+ headers: {
1503
+ Authorization: "Key ${{ secrets.FAL_TOKEN }}"
1504
+ }
1505
+ },
1506
+ permissions: [
1507
+ {
1508
+ name: "unrestricted",
1509
+ description: "Allow all endpoints",
1510
+ rules: ["ANY /{path*}"]
1511
+ }
1512
+ ]
1513
+ },
1458
1514
  {
1459
1515
  base: "https://api.fal.ai",
1460
1516
  auth: {
@@ -5208,7 +5264,7 @@ var granolaFirewall = {
5208
5264
  },
5209
5265
  apis: [
5210
5266
  {
5211
- base: "https://api.granola.ai",
5267
+ base: "https://public-api.granola.ai",
5212
5268
  auth: {
5213
5269
  headers: {
5214
5270
  Authorization: "Bearer ${{ secrets.GRANOLA_TOKEN }}"
@@ -5385,6 +5441,32 @@ var imgurFirewall = {
5385
5441
  ]
5386
5442
  };
5387
5443
 
5444
+ // ../../packages/core/src/firewalls/instagram.generated.ts
5445
+ var instagramFirewall = {
5446
+ name: "instagram",
5447
+ description: "Instagram Graph API",
5448
+ placeholders: {
5449
+ INSTAGRAM_ACCESS_TOKEN: "vm0placeholderInstagramAccessToken00000000000000000000a"
5450
+ },
5451
+ apis: [
5452
+ {
5453
+ base: "https://graph.instagram.com",
5454
+ auth: {
5455
+ headers: {
5456
+ Authorization: "Bearer ${{ secrets.INSTAGRAM_ACCESS_TOKEN }}"
5457
+ }
5458
+ },
5459
+ permissions: [
5460
+ {
5461
+ name: "unrestricted",
5462
+ description: "Allow all Instagram Graph API endpoints",
5463
+ rules: ["ANY /{path*}"]
5464
+ }
5465
+ ]
5466
+ }
5467
+ ]
5468
+ };
5469
+
5388
5470
  // ../../packages/core/src/firewalls/instantly.generated.ts
5389
5471
  var instantlyFirewall = {
5390
5472
  name: "instantly",
@@ -6280,7 +6362,7 @@ var loopsFirewall = {
6280
6362
  },
6281
6363
  apis: [
6282
6364
  {
6283
- base: "https://app.loops.so/api/v1",
6365
+ base: "https://app.loops.so/api",
6284
6366
  auth: {
6285
6367
  headers: {
6286
6368
  Authorization: "Bearer ${{ secrets.LOOPS_TOKEN }}"
@@ -6349,6 +6431,32 @@ var mercuryFirewall = {
6349
6431
  ]
6350
6432
  };
6351
6433
 
6434
+ // ../../packages/core/src/firewalls/meta-ads.generated.ts
6435
+ var metaAdsFirewall = {
6436
+ name: "meta-ads",
6437
+ description: "Meta Ads (Facebook Graph) API",
6438
+ placeholders: {
6439
+ META_ADS_TOKEN: "vm0placeholderMetaAdsToken0000000000000000000000000000a"
6440
+ },
6441
+ apis: [
6442
+ {
6443
+ base: "https://graph.facebook.com",
6444
+ auth: {
6445
+ headers: {
6446
+ Authorization: "Bearer ${{ secrets.META_ADS_TOKEN }}"
6447
+ }
6448
+ },
6449
+ permissions: [
6450
+ {
6451
+ name: "unrestricted",
6452
+ description: "Allow all Meta Ads API endpoints",
6453
+ rules: ["ANY /{path*}"]
6454
+ }
6455
+ ]
6456
+ }
6457
+ ]
6458
+ };
6459
+
6352
6460
  // ../../packages/core/src/firewalls/minimax.generated.ts
6353
6461
  var minimaxFirewall = {
6354
6462
  name: "minimax",
@@ -6410,7 +6518,7 @@ var neonFirewall = {
6410
6518
  },
6411
6519
  apis: [
6412
6520
  {
6413
- base: "https://console.neon.tech/api/v2",
6521
+ base: "https://console.neon.tech/api",
6414
6522
  auth: {
6415
6523
  headers: {
6416
6524
  Authorization: "Bearer ${{ secrets.NEON_TOKEN }}"
@@ -6436,7 +6544,7 @@ var notionFirewall = {
6436
6544
  },
6437
6545
  apis: [
6438
6546
  {
6439
- base: "https://api.notion.com/v1",
6547
+ base: "https://api.notion.com",
6440
6548
  auth: {
6441
6549
  headers: {
6442
6550
  Authorization: "Bearer ${{ secrets.NOTION_TOKEN }}"
@@ -6451,68 +6559,73 @@ var notionFirewall = {
6451
6559
  {
6452
6560
  name: "insert_comments",
6453
6561
  description: "Create comments",
6454
- rules: ["POST /comments"]
6562
+ rules: ["POST /v1/comments"]
6455
6563
  },
6456
6564
  {
6457
6565
  name: "insert_content",
6458
6566
  description: "Create pages, databases, blocks, data sources, and upload files",
6459
6567
  rules: [
6460
- "PATCH /blocks/{block_id}/children",
6461
- "POST /data_sources",
6462
- "POST /databases",
6463
- "POST /file_uploads",
6464
- "POST /file_uploads/{file_upload_id}/complete",
6465
- "POST /file_uploads/{file_upload_id}/send",
6466
- "POST /pages",
6467
- "POST /views",
6468
- "POST /views/{view_id}/queries"
6568
+ "PATCH /v1/blocks/{block_id}/children",
6569
+ "POST /v1/data_sources",
6570
+ "POST /v1/databases",
6571
+ "POST /v1/file_uploads",
6572
+ "POST /v1/file_uploads/{file_upload_id}/complete",
6573
+ "POST /v1/file_uploads/{file_upload_id}/send",
6574
+ "POST /v1/pages",
6575
+ "POST /v1/views",
6576
+ "POST /v1/views/{view_id}/queries"
6469
6577
  ]
6470
6578
  },
6471
6579
  {
6472
6580
  name: "read_comments",
6473
6581
  description: "Read comments",
6474
- rules: ["GET /comments", "GET /comments/{comment_id}"]
6582
+ rules: ["GET /v1/comments", "GET /v1/comments/{comment_id}"]
6475
6583
  },
6476
6584
  {
6477
6585
  name: "read_content",
6478
6586
  description: "Read pages, databases, blocks, data sources, and files",
6479
6587
  rules: [
6480
- "GET /blocks/{block_id}",
6481
- "GET /blocks/{block_id}/children",
6482
- "GET /data_sources/{data_source_id}",
6483
- "POST /data_sources/{data_source_id}/query",
6484
- "GET /data_sources/{data_source_id}/templates",
6485
- "GET /databases/{database_id}",
6486
- "GET /file_uploads",
6487
- "GET /file_uploads/{file_upload_id}",
6488
- "GET /pages/{page_id}",
6489
- "GET /pages/{page_id}/markdown",
6490
- "GET /pages/{page_id}/properties/{property_id}",
6491
- "POST /search",
6492
- "GET /views",
6493
- "GET /views/{view_id}",
6494
- "GET /views/{view_id}/queries/{query_id}"
6588
+ "GET /v1/blocks/{block_id}",
6589
+ "GET /v1/blocks/{block_id}/children",
6590
+ "GET /v1/custom_emojis",
6591
+ "GET /v1/data_sources/{data_source_id}",
6592
+ "POST /v1/data_sources/{data_source_id}/query",
6593
+ "GET /v1/data_sources/{data_source_id}/templates",
6594
+ "GET /v1/databases/{database_id}",
6595
+ "GET /v1/file_uploads",
6596
+ "GET /v1/file_uploads/{file_upload_id}",
6597
+ "GET /v1/pages/{page_id}",
6598
+ "GET /v1/pages/{page_id}/markdown",
6599
+ "GET /v1/pages/{page_id}/properties/{property_id}",
6600
+ "POST /v1/search",
6601
+ "GET /v1/views",
6602
+ "GET /v1/views/{view_id}",
6603
+ "GET /v1/views/{view_id}/queries/{query_id}"
6495
6604
  ]
6496
6605
  },
6497
6606
  {
6498
6607
  name: "read_users",
6499
6608
  description: "Read user information",
6500
- rules: ["GET /users", "GET /users/me", "GET /users/{user_id}"]
6609
+ rules: [
6610
+ "GET /v1/users",
6611
+ "GET /v1/users/me",
6612
+ "GET /v1/users/{user_id}"
6613
+ ]
6501
6614
  },
6502
6615
  {
6503
6616
  name: "update_content",
6504
6617
  description: "Update and delete pages, databases, blocks, and data sources",
6505
6618
  rules: [
6506
- "PATCH /blocks/{block_id}",
6507
- "DELETE /blocks/{block_id}",
6508
- "PATCH /data_sources/{data_source_id}",
6509
- "PATCH /databases/{database_id}",
6510
- "PATCH /pages/{page_id}",
6511
- "PATCH /pages/{page_id}/markdown",
6512
- "POST /pages/{page_id}/move",
6513
- "PATCH /views/{view_id}",
6514
- "DELETE /views/{view_id}",
6515
- "DELETE /views/{view_id}/queries/{query_id}"
6619
+ "PATCH /v1/blocks/{block_id}",
6620
+ "DELETE /v1/blocks/{block_id}",
6621
+ "PATCH /v1/data_sources/{data_source_id}",
6622
+ "PATCH /v1/databases/{database_id}",
6623
+ "PATCH /v1/pages/{page_id}",
6624
+ "PATCH /v1/pages/{page_id}/markdown",
6625
+ "POST /v1/pages/{page_id}/move",
6626
+ "PATCH /v1/views/{view_id}",
6627
+ "DELETE /v1/views/{view_id}",
6628
+ "DELETE /v1/views/{view_id}/queries/{query_id}"
6516
6629
  ]
6517
6630
  }
6518
6631
  ]
@@ -6546,6 +6659,58 @@ var openaiFirewall = {
6546
6659
  ]
6547
6660
  };
6548
6661
 
6662
+ // ../../packages/core/src/firewalls/outlook-calendar.generated.ts
6663
+ var outlookCalendarFirewall = {
6664
+ name: "outlook-calendar",
6665
+ description: "Microsoft Graph API (Outlook Calendar)",
6666
+ placeholders: {
6667
+ OUTLOOK_CALENDAR_TOKEN: "vm0placeholderOutlookCalendarToken00000000000000000000a"
6668
+ },
6669
+ apis: [
6670
+ {
6671
+ base: "https://graph.microsoft.com",
6672
+ auth: {
6673
+ headers: {
6674
+ Authorization: "Bearer ${{ secrets.OUTLOOK_CALENDAR_TOKEN }}"
6675
+ }
6676
+ },
6677
+ permissions: [
6678
+ {
6679
+ name: "unrestricted",
6680
+ description: "Allow all Microsoft Graph API endpoints",
6681
+ rules: ["ANY /{path*}"]
6682
+ }
6683
+ ]
6684
+ }
6685
+ ]
6686
+ };
6687
+
6688
+ // ../../packages/core/src/firewalls/outlook-mail.generated.ts
6689
+ var outlookMailFirewall = {
6690
+ name: "outlook-mail",
6691
+ description: "Microsoft Graph API (Outlook Mail)",
6692
+ placeholders: {
6693
+ OUTLOOK_MAIL_TOKEN: "vm0placeholderOutlookMailToken0000000000000000000000a"
6694
+ },
6695
+ apis: [
6696
+ {
6697
+ base: "https://graph.microsoft.com",
6698
+ auth: {
6699
+ headers: {
6700
+ Authorization: "Bearer ${{ secrets.OUTLOOK_MAIL_TOKEN }}"
6701
+ }
6702
+ },
6703
+ permissions: [
6704
+ {
6705
+ name: "unrestricted",
6706
+ description: "Allow all Microsoft Graph API endpoints",
6707
+ rules: ["ANY /{path*}"]
6708
+ }
6709
+ ]
6710
+ }
6711
+ ]
6712
+ };
6713
+
6549
6714
  // ../../packages/core/src/firewalls/pdf4me.generated.ts
6550
6715
  var pdf4meFirewall = {
6551
6716
  name: "pdf4me",
@@ -6581,7 +6746,7 @@ var pdfcoFirewall = {
6581
6746
  },
6582
6747
  apis: [
6583
6748
  {
6584
- base: "https://api.pdf.co/v1",
6749
+ base: "https://api.pdf.co",
6585
6750
  auth: {
6586
6751
  headers: {
6587
6752
  "x-api-key": "${{ secrets.PDFCO_TOKEN }}"
@@ -6769,6 +6934,32 @@ var productlaneFirewall = {
6769
6934
  ]
6770
6935
  };
6771
6936
 
6937
+ // ../../packages/core/src/firewalls/prisma-postgres.generated.ts
6938
+ var prismaPostgresFirewall = {
6939
+ name: "prisma-postgres",
6940
+ description: "Prisma Postgres Management API",
6941
+ placeholders: {
6942
+ PRISMA_POSTGRES_TOKEN: "vm0placeholderPrismaPostgresToken0000000000000000000a"
6943
+ },
6944
+ apis: [
6945
+ {
6946
+ base: "https://api.prisma.io",
6947
+ auth: {
6948
+ headers: {
6949
+ Authorization: "Bearer ${{ secrets.PRISMA_POSTGRES_TOKEN }}"
6950
+ }
6951
+ },
6952
+ permissions: [
6953
+ {
6954
+ name: "unrestricted",
6955
+ description: "Allow all Prisma Postgres API endpoints",
6956
+ rules: ["ANY /{path*}"]
6957
+ }
6958
+ ]
6959
+ }
6960
+ ]
6961
+ };
6962
+
6772
6963
  // ../../packages/core/src/firewalls/pushinator.generated.ts
6773
6964
  var pushinatorFirewall = {
6774
6965
  name: "pushinator",
@@ -7041,7 +7232,7 @@ var shortioFirewall = {
7041
7232
  base: "https://api.short.io",
7042
7233
  auth: {
7043
7234
  headers: {
7044
- Authorization: "${{ secrets.SHORTIO_TOKEN }}"
7235
+ Authorization: "Bearer ${{ secrets.SHORTIO_TOKEN }}"
7045
7236
  }
7046
7237
  },
7047
7238
  permissions: [
@@ -8939,8 +9130,8 @@ var builtinFirewalls = {
8939
9130
  confluence: confluenceFirewall,
8940
9131
  cronlytic: cronlyticFirewall,
8941
9132
  "customer-io": customerIoFirewall,
8942
- deepseek: deepseekFirewall,
8943
9133
  deel: deelFirewall,
9134
+ deepseek: deepseekFirewall,
8944
9135
  devto: devtoFirewall,
8945
9136
  discord: discordFirewall,
8946
9137
  dropbox: dropboxFirewall,
@@ -8964,6 +9155,7 @@ var builtinFirewalls = {
8964
9155
  "hugging-face": huggingFaceFirewall,
8965
9156
  hume: humeFirewall,
8966
9157
  imgur: imgurFirewall,
9158
+ instagram: instagramFirewall,
8967
9159
  instantly: instantlyFirewall,
8968
9160
  intercom: intercomFirewall,
8969
9161
  "intervals-icu": intervalsIcuFirewall,
@@ -8975,11 +9167,14 @@ var builtinFirewalls = {
8975
9167
  loops: loopsFirewall,
8976
9168
  mailsac: mailsacFirewall,
8977
9169
  mercury: mercuryFirewall,
9170
+ "meta-ads": metaAdsFirewall,
8978
9171
  minimax: minimaxFirewall,
8979
9172
  monday: mondayFirewall,
8980
9173
  neon: neonFirewall,
8981
9174
  notion: notionFirewall,
8982
9175
  openai: openaiFirewall,
9176
+ "outlook-calendar": outlookCalendarFirewall,
9177
+ "outlook-mail": outlookMailFirewall,
8983
9178
  pdf4me: pdf4meFirewall,
8984
9179
  pdfco: pdfcoFirewall,
8985
9180
  pdforge: pdforgeFirewall,
@@ -8987,6 +9182,7 @@ var builtinFirewalls = {
8987
9182
  plausible: plausibleFirewall,
8988
9183
  podchaser: podchaserFirewall,
8989
9184
  posthog: posthogFirewall,
9185
+ "prisma-postgres": prismaPostgresFirewall,
8990
9186
  productlane: productlaneFirewall,
8991
9187
  pushinator: pushinatorFirewall,
8992
9188
  qiita: qiitaFirewall,
@@ -9688,7 +9884,8 @@ var logsListContract = c2.router({
9688
9884
  name: z5.string().optional(),
9689
9885
  org: z5.string().optional(),
9690
9886
  status: logStatusSchema.optional(),
9691
- triggerSource: triggerSourceSchema.optional()
9887
+ triggerSource: triggerSourceSchema.optional(),
9888
+ scheduleId: z5.string().uuid().optional()
9692
9889
  }),
9693
9890
  responses: {
9694
9891
  200: logsListResponseSchema,
@@ -10909,6 +11106,34 @@ var cliAuthTokenContract = c7.router({
10909
11106
  summary: "Exchange device code for access token"
10910
11107
  }
10911
11108
  });
11109
+ var apiErrorResponseSchema = z11.object({
11110
+ error: z11.object({ message: z11.string(), code: z11.string() })
11111
+ });
11112
+ var cliAuthOrgContract = c7.router({
11113
+ /**
11114
+ * POST /api/cli/auth/org
11115
+ * Switch active organization and get new CLI JWT
11116
+ */
11117
+ switchOrg: {
11118
+ method: "POST",
11119
+ path: "/api/cli/auth/org",
11120
+ headers: authHeadersSchema,
11121
+ body: z11.object({ slug: z11.string().min(1) }),
11122
+ responses: {
11123
+ 200: z11.object({
11124
+ access_token: z11.string(),
11125
+ token_type: z11.literal("Bearer"),
11126
+ expires_in: z11.number(),
11127
+ org_slug: z11.string()
11128
+ }),
11129
+ 400: oauthErrorSchema,
11130
+ 401: apiErrorResponseSchema,
11131
+ 403: apiErrorResponseSchema,
11132
+ 404: apiErrorResponseSchema
11133
+ },
11134
+ summary: "Switch active organization and get new CLI JWT"
11135
+ }
11136
+ });
10912
11137
 
10913
11138
  // ../../packages/core/src/contracts/auth.ts
10914
11139
  import { z as z12 } from "zod";
@@ -11284,10 +11509,10 @@ var MODEL_PROVIDER_TYPES = {
11284
11509
  defaultModel: "claude-sonnet-4.6"
11285
11510
  }
11286
11511
  };
11287
- var HIDDEN_PROVIDER_TYPES = /* @__PURE__ */ new Set([
11288
- "aws-bedrock",
11289
- "azure-foundry"
11290
- ]);
11512
+ var HIDDEN_PROVIDER_LIST = ["aws-bedrock", "azure-foundry"];
11513
+ var HIDDEN_PROVIDER_TYPES = new Set(
11514
+ HIDDEN_PROVIDER_LIST
11515
+ );
11291
11516
  function getSelectableProviderTypes() {
11292
11517
  return Object.keys(MODEL_PROVIDER_TYPES).filter(
11293
11518
  (type) => !HIDDEN_PROVIDER_TYPES.has(type)
@@ -11708,7 +11933,7 @@ var chatThreadRunsContract = c11.router({
11708
11933
  runId: z18.string().min(1)
11709
11934
  }),
11710
11935
  responses: {
11711
- 204: z18.void(),
11936
+ 204: c11.noBody(),
11712
11937
  401: apiErrorSchema,
11713
11938
  404: apiErrorSchema
11714
11939
  },
@@ -15282,6 +15507,19 @@ var onboardingStatusContract = c15.router({
15282
15507
  summary: "Get onboarding status for current user"
15283
15508
  }
15284
15509
  });
15510
+ var onboardingCompleteContract = c15.router({
15511
+ complete: {
15512
+ method: "POST",
15513
+ path: "/api/zero/onboarding/complete",
15514
+ headers: authHeadersSchema,
15515
+ body: c15.noBody(),
15516
+ responses: {
15517
+ 200: z24.object({ ok: z24.boolean() }),
15518
+ 401: apiErrorSchema
15519
+ },
15520
+ summary: "Mark member onboarding as complete"
15521
+ }
15522
+ });
15285
15523
 
15286
15524
  // ../../packages/core/src/contracts/skills.ts
15287
15525
  import { z as z25 } from "zod";
@@ -16112,6 +16350,24 @@ var zeroSchedulesEnableContract = c24.router({
16112
16350
  summary: "Disable schedule (zero proxy)"
16113
16351
  }
16114
16352
  });
16353
+ var zeroScheduleRunContract = c24.router({
16354
+ run: {
16355
+ method: "POST",
16356
+ path: "/api/zero/schedules/run",
16357
+ headers: authHeadersSchema,
16358
+ body: z31.object({
16359
+ scheduleId: z31.string().uuid("Invalid schedule ID")
16360
+ }),
16361
+ responses: {
16362
+ 201: z31.object({ runId: z31.string() }),
16363
+ 400: apiErrorSchema,
16364
+ 401: apiErrorSchema,
16365
+ 404: apiErrorSchema,
16366
+ 409: apiErrorSchema
16367
+ },
16368
+ summary: "Execute a schedule immediately (run now)"
16369
+ }
16370
+ });
16115
16371
 
16116
16372
  // ../../packages/core/src/contracts/zero-model-providers.ts
16117
16373
  import { z as z32 } from "zod";
@@ -16462,6 +16718,30 @@ var zeroBillingAutoRechargeContract = c29.router({
16462
16718
  summary: "Update auto-recharge configuration"
16463
16719
  }
16464
16720
  });
16721
+ var invoiceSchema = z36.object({
16722
+ id: z36.string(),
16723
+ number: z36.string().nullable(),
16724
+ date: z36.number(),
16725
+ amount: z36.number(),
16726
+ status: z36.string().nullable(),
16727
+ hostedInvoiceUrl: z36.string().nullable()
16728
+ });
16729
+ var billingInvoicesResponseSchema = z36.object({
16730
+ invoices: z36.array(invoiceSchema)
16731
+ });
16732
+ var zeroBillingInvoicesContract = c29.router({
16733
+ get: {
16734
+ method: "GET",
16735
+ path: "/api/zero/billing/invoices",
16736
+ headers: authHeadersSchema,
16737
+ responses: {
16738
+ 200: billingInvoicesResponseSchema,
16739
+ 401: apiErrorSchema,
16740
+ 500: apiErrorSchema
16741
+ },
16742
+ summary: "Get invoices for current org"
16743
+ }
16744
+ });
16465
16745
 
16466
16746
  // ../../packages/core/src/contracts/zero-usage.ts
16467
16747
  import { z as z37 } from "zod";
@@ -16496,6 +16776,214 @@ var zeroUsageMembersContract = c30.router({
16496
16776
  }
16497
16777
  });
16498
16778
 
16779
+ // ../../packages/core/src/contracts/zero-team.ts
16780
+ import { z as z38 } from "zod";
16781
+ var c31 = initContract();
16782
+ var teamComposeItemSchema = z38.object({
16783
+ id: z38.string(),
16784
+ displayName: z38.string().nullable(),
16785
+ description: z38.string().nullable(),
16786
+ sound: z38.string().nullable(),
16787
+ headVersionId: z38.string().nullable(),
16788
+ updatedAt: z38.string()
16789
+ });
16790
+ var zeroTeamContract = c31.router({
16791
+ list: {
16792
+ method: "GET",
16793
+ path: "/api/zero/team",
16794
+ headers: authHeadersSchema,
16795
+ responses: {
16796
+ 200: z38.array(teamComposeItemSchema),
16797
+ 401: apiErrorSchema,
16798
+ 403: apiErrorSchema,
16799
+ 404: apiErrorSchema
16800
+ },
16801
+ summary: "List all agents in the user's active org"
16802
+ }
16803
+ });
16804
+
16805
+ // ../../packages/core/src/contracts/zero-integrations-slack.ts
16806
+ import { z as z39 } from "zod";
16807
+ var c32 = initContract();
16808
+ var slackEnvironmentSchema = z39.object({
16809
+ requiredSecrets: z39.array(z39.string()),
16810
+ requiredVars: z39.array(z39.string()),
16811
+ missingSecrets: z39.array(z39.string()),
16812
+ missingVars: z39.array(z39.string())
16813
+ });
16814
+ var slackOrgStatusSchema = z39.object({
16815
+ isConnected: z39.boolean(),
16816
+ isInstalled: z39.boolean().optional(),
16817
+ workspaceName: z39.string().nullable().optional(),
16818
+ isAdmin: z39.boolean(),
16819
+ installUrl: z39.string().nullable().optional(),
16820
+ connectUrl: z39.string().nullable().optional(),
16821
+ defaultAgentName: z39.string().nullable().optional(),
16822
+ agentOrgSlug: z39.string().nullable().optional(),
16823
+ environment: slackEnvironmentSchema.optional()
16824
+ });
16825
+ var zeroIntegrationsSlackContract = c32.router({
16826
+ getStatus: {
16827
+ method: "GET",
16828
+ path: "/api/zero/integrations/slack",
16829
+ headers: authHeadersSchema,
16830
+ responses: {
16831
+ 200: slackOrgStatusSchema,
16832
+ 401: apiErrorSchema
16833
+ },
16834
+ summary: "Get org-scoped Slack workspace info"
16835
+ },
16836
+ disconnect: {
16837
+ method: "DELETE",
16838
+ path: "/api/zero/integrations/slack",
16839
+ headers: authHeadersSchema,
16840
+ body: c32.noBody(),
16841
+ query: z39.object({
16842
+ action: z39.string().optional()
16843
+ }),
16844
+ responses: {
16845
+ 200: z39.object({ ok: z39.boolean() }),
16846
+ 401: apiErrorSchema,
16847
+ 403: apiErrorSchema,
16848
+ 404: apiErrorSchema
16849
+ },
16850
+ summary: "Disconnect or uninstall Slack workspace"
16851
+ }
16852
+ });
16853
+
16854
+ // ../../packages/core/src/contracts/zero-slack-connect.ts
16855
+ import { z as z40 } from "zod";
16856
+ var c33 = initContract();
16857
+ var slackConnectStatusSchema = z40.object({
16858
+ isConnected: z40.boolean(),
16859
+ isAdmin: z40.boolean(),
16860
+ workspaceName: z40.string().nullable().optional(),
16861
+ defaultAgentName: z40.string().nullable().optional()
16862
+ });
16863
+ var slackConnectResponseSchema = z40.object({
16864
+ success: z40.boolean(),
16865
+ connectionId: z40.string(),
16866
+ role: z40.string()
16867
+ });
16868
+ var zeroSlackConnectContract = c33.router({
16869
+ getStatus: {
16870
+ method: "GET",
16871
+ path: "/api/zero/integrations/slack/connect",
16872
+ headers: authHeadersSchema,
16873
+ responses: {
16874
+ 200: slackConnectStatusSchema,
16875
+ 401: apiErrorSchema
16876
+ },
16877
+ summary: "Check user Slack connection status"
16878
+ },
16879
+ connect: {
16880
+ method: "POST",
16881
+ path: "/api/zero/integrations/slack/connect",
16882
+ headers: authHeadersSchema,
16883
+ body: z40.object({
16884
+ workspaceId: z40.string().min(1),
16885
+ slackUserId: z40.string().min(1),
16886
+ channelId: z40.string().optional(),
16887
+ threadTs: z40.string().optional()
16888
+ }),
16889
+ responses: {
16890
+ 200: slackConnectResponseSchema,
16891
+ 400: apiErrorSchema,
16892
+ 401: apiErrorSchema,
16893
+ 403: apiErrorSchema,
16894
+ 404: apiErrorSchema
16895
+ },
16896
+ summary: "Connect user to Slack workspace"
16897
+ }
16898
+ });
16899
+
16900
+ // ../../packages/core/src/contracts/zero-slack-channels.ts
16901
+ import { z as z41 } from "zod";
16902
+ var c34 = initContract();
16903
+ var slackChannelSchema = z41.object({
16904
+ id: z41.string(),
16905
+ name: z41.string()
16906
+ });
16907
+ var zeroSlackChannelsContract = c34.router({
16908
+ list: {
16909
+ method: "GET",
16910
+ path: "/api/zero/slack/channels",
16911
+ headers: authHeadersSchema,
16912
+ responses: {
16913
+ 200: z41.object({ channels: z41.array(slackChannelSchema) }),
16914
+ 401: apiErrorSchema,
16915
+ 404: apiErrorSchema
16916
+ },
16917
+ summary: "List Slack channels where bot is a member"
16918
+ }
16919
+ });
16920
+
16921
+ // ../../packages/core/src/contracts/zero-queue-position.ts
16922
+ import { z as z42 } from "zod";
16923
+ var c35 = initContract();
16924
+ var queuePositionResponseSchema = z42.object({
16925
+ position: z42.number(),
16926
+ total: z42.number()
16927
+ });
16928
+ var zeroQueuePositionContract = c35.router({
16929
+ getPosition: {
16930
+ method: "GET",
16931
+ path: "/api/zero/queue-position",
16932
+ headers: authHeadersSchema,
16933
+ query: z42.object({
16934
+ runId: z42.string().min(1, "runId is required")
16935
+ }),
16936
+ responses: {
16937
+ 200: queuePositionResponseSchema,
16938
+ 400: apiErrorSchema,
16939
+ 401: apiErrorSchema,
16940
+ 404: apiErrorSchema
16941
+ },
16942
+ summary: "Get queue position for a run"
16943
+ }
16944
+ });
16945
+
16946
+ // ../../packages/core/src/contracts/zero-member-credit-cap.ts
16947
+ import { z as z43 } from "zod";
16948
+ var c36 = initContract();
16949
+ var memberCreditCapResponseSchema = z43.object({
16950
+ userId: z43.string(),
16951
+ creditCap: z43.number().nullable(),
16952
+ creditEnabled: z43.boolean()
16953
+ });
16954
+ var zeroMemberCreditCapContract = c36.router({
16955
+ get: {
16956
+ method: "GET",
16957
+ path: "/api/zero/org/members/credit-cap",
16958
+ headers: authHeadersSchema,
16959
+ query: z43.object({
16960
+ userId: z43.string().min(1, "userId is required")
16961
+ }),
16962
+ responses: {
16963
+ 200: memberCreditCapResponseSchema,
16964
+ 400: apiErrorSchema,
16965
+ 401: apiErrorSchema
16966
+ },
16967
+ summary: "Get member credit cap"
16968
+ },
16969
+ set: {
16970
+ method: "PUT",
16971
+ path: "/api/zero/org/members/credit-cap",
16972
+ headers: authHeadersSchema,
16973
+ body: z43.object({
16974
+ userId: z43.string().min(1),
16975
+ creditCap: z43.number().int().positive().nullable()
16976
+ }),
16977
+ responses: {
16978
+ 200: memberCreditCapResponseSchema,
16979
+ 400: apiErrorSchema,
16980
+ 401: apiErrorSchema,
16981
+ 403: apiErrorSchema
16982
+ },
16983
+ summary: "Set or clear member credit cap"
16984
+ }
16985
+ });
16986
+
16499
16987
  // ../../packages/core/src/storage-names.ts
16500
16988
  function getInstructionsStorageName(agentName) {
16501
16989
  return `agent-instructions@${agentName}`;
@@ -16835,6 +17323,11 @@ async function getBaseUrl() {
16835
17323
  async function getClientConfig() {
16836
17324
  const baseUrl = await getBaseUrl();
16837
17325
  const baseHeaders = await getHeaders();
17326
+ const token = await getActiveToken();
17327
+ const isJwtToken = decodeCliTokenPayload(token) ?? decodeZeroTokenPayload(token);
17328
+ if (isJwtToken) {
17329
+ return { baseUrl, baseHeaders, jsonQuery: false };
17330
+ }
16838
17331
  const activeOrg = await getActiveOrg();
16839
17332
  if (!activeOrg) {
16840
17333
  throw new Error(
@@ -16846,10 +17339,12 @@ async function getClientConfig() {
16846
17339
  baseHeaders,
16847
17340
  jsonQuery: false,
16848
17341
  api: async (args) => {
16849
- const separator = args.path.includes("?") ? "&" : "?";
16850
- if (!args.path.includes("org=")) {
16851
- args.path = `${args.path}${separator}org=${encodeURIComponent(activeOrg)}`;
17342
+ const [pathPart, queryPart] = args.path.split("?");
17343
+ const params = new URLSearchParams(queryPart ?? "");
17344
+ if (!params.has("org")) {
17345
+ params.set("org", activeOrg);
16852
17346
  }
17347
+ args.path = params.toString() ? `${pathPart}?${params.toString()}` : pathPart;
16853
17348
  return tsRestFetchApi(args);
16854
17349
  }
16855
17350
  };
@@ -16869,8 +17364,13 @@ function withErrorHandler(fn) {
16869
17364
  } catch (error) {
16870
17365
  if (error instanceof ApiRequestError) {
16871
17366
  if (error.code === "UNAUTHORIZED") {
16872
- console.error(chalk.red("\u2717 Not authenticated"));
16873
- console.error(chalk.dim(" Run: vm0 auth login"));
17367
+ if (process.env.ZERO_TOKEN) {
17368
+ console.error(chalk.red("\u2717 Authentication failed"));
17369
+ console.error(chalk.dim(" ZERO_TOKEN is invalid or expired"));
17370
+ } else {
17371
+ console.error(chalk.red("\u2717 Not authenticated"));
17372
+ console.error(chalk.dim(" Run: vm0 auth login"));
17373
+ }
16874
17374
  } else {
16875
17375
  const guidance = RUN_ERROR_GUIDANCE[error.code];
16876
17376
  if (guidance) {
@@ -16967,80 +17467,19 @@ async function updateZeroUserPreferences(body) {
16967
17467
  handleError(result, "Failed to update user preferences");
16968
17468
  }
16969
17469
 
16970
- // src/lib/api/core/http.ts
16971
- async function appendOrgParam(path) {
16972
- const activeOrg = await getActiveOrg();
16973
- if (!activeOrg) {
16974
- throw new Error(
16975
- "No active organization configured. Run: zero org use <slug>"
16976
- );
16977
- }
16978
- const queryStart = path.indexOf("?");
16979
- if (queryStart !== -1) {
16980
- const params = new URLSearchParams(path.slice(queryStart));
16981
- if (params.has("org")) {
16982
- return path;
16983
- }
16984
- return `${path}&org=${encodeURIComponent(activeOrg)}`;
16985
- }
16986
- return `${path}?org=${encodeURIComponent(activeOrg)}`;
16987
- }
16988
- async function getRawHeaders() {
16989
- const token = await getActiveToken();
16990
- if (!token) {
16991
- throw new Error("Not authenticated. Run: vm0 auth login");
16992
- }
16993
- const headers = {
16994
- Authorization: `Bearer ${token}`
16995
- };
16996
- const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
16997
- if (bypassSecret) {
16998
- headers["x-vercel-protection-bypass"] = bypassSecret;
16999
- }
17000
- return headers;
17001
- }
17002
- async function httpPost(path, body) {
17003
- const baseUrl = await getBaseUrl();
17004
- const headers = await getRawHeaders();
17005
- const orgPath = await appendOrgParam(path);
17006
- return fetch(`${baseUrl}${orgPath}`, {
17007
- method: "POST",
17008
- headers: {
17009
- ...headers,
17010
- "Content-Type": "application/json"
17011
- },
17012
- body: JSON.stringify(body)
17013
- });
17014
- }
17015
-
17016
17470
  // src/lib/api/domains/skills.ts
17471
+ import { initClient as initClient3 } from "@ts-rest/core";
17017
17472
  import chalk2 from "chalk";
17018
- function isResolveSkillsResponse(value) {
17019
- if (typeof value !== "object" || value === null) return false;
17020
- const obj = value;
17021
- return typeof obj.resolved === "object" && obj.resolved !== null && Array.isArray(obj.unresolved);
17022
- }
17023
17473
  async function resolveSkills(skillUrls) {
17024
17474
  try {
17025
- const response = await httpPost("/api/skills/resolve", {
17026
- skills: skillUrls
17027
- });
17028
- if (!response.ok) {
17029
- console.error(
17030
- chalk2.dim(" Skill resolve unavailable, downloading all skills")
17031
- );
17032
- return { resolved: {}, unresolved: skillUrls };
17033
- }
17034
- const body = await response.json();
17035
- if (!isResolveSkillsResponse(body)) {
17036
- console.error(
17037
- chalk2.dim(
17038
- " Skill resolve returned unexpected format, downloading all skills"
17039
- )
17040
- );
17041
- return { resolved: {}, unresolved: skillUrls };
17042
- }
17043
- return body;
17475
+ const config = await getClientConfig();
17476
+ const client = initClient3(skillsResolveContract, config);
17477
+ const result = await client.resolve({ body: { skills: skillUrls } });
17478
+ if (result.status === 200) return result.body;
17479
+ console.error(
17480
+ chalk2.dim(" Skill resolve unavailable, downloading all skills")
17481
+ );
17482
+ return { resolved: {}, unresolved: skillUrls };
17044
17483
  } catch {
17045
17484
  console.error(
17046
17485
  chalk2.dim(" Skill resolve unavailable, downloading all skills")
@@ -17050,12 +17489,12 @@ async function resolveSkills(skillUrls) {
17050
17489
  }
17051
17490
 
17052
17491
  // src/lib/api/domains/zero-orgs.ts
17053
- import { initClient as initClient3 } from "@ts-rest/core";
17492
+ import { initClient as initClient4 } from "@ts-rest/core";
17054
17493
  async function getUserTokenClientConfig() {
17055
17494
  const baseUrl = await getBaseUrl();
17056
17495
  const token = await getToken();
17057
17496
  if (!token) {
17058
- throw new Error("Not authenticated. Run: vm0 auth login");
17497
+ throw new ApiRequestError("Not authenticated", "UNAUTHORIZED", 401);
17059
17498
  }
17060
17499
  const headers = {
17061
17500
  Authorization: `Bearer ${token}`
@@ -17068,7 +17507,7 @@ async function getUserTokenClientConfig() {
17068
17507
  }
17069
17508
  async function getZeroOrg() {
17070
17509
  const config = await getClientConfig();
17071
- const client = initClient3(zeroOrgContract, config);
17510
+ const client = initClient4(zeroOrgContract, config);
17072
17511
  const result = await client.get({ headers: {} });
17073
17512
  if (result.status === 200) {
17074
17513
  return result.body;
@@ -17077,7 +17516,7 @@ async function getZeroOrg() {
17077
17516
  }
17078
17517
  async function updateZeroOrg(body) {
17079
17518
  const config = await getClientConfig();
17080
- const client = initClient3(zeroOrgContract, config);
17519
+ const client = initClient4(zeroOrgContract, config);
17081
17520
  const result = await client.update({ body });
17082
17521
  if (result.status === 200) {
17083
17522
  return result.body;
@@ -17086,7 +17525,7 @@ async function updateZeroOrg(body) {
17086
17525
  }
17087
17526
  async function listZeroOrgs() {
17088
17527
  const config = await getUserTokenClientConfig();
17089
- const client = initClient3(zeroOrgListContract, config);
17528
+ const client = initClient4(zeroOrgListContract, config);
17090
17529
  const result = await client.list({ headers: {} });
17091
17530
  if (result.status === 200) {
17092
17531
  return result.body;
@@ -17095,7 +17534,7 @@ async function listZeroOrgs() {
17095
17534
  }
17096
17535
  async function getZeroOrgMembers() {
17097
17536
  const config = await getClientConfig();
17098
- const client = initClient3(zeroOrgMembersContract, config);
17537
+ const client = initClient4(zeroOrgMembersContract, config);
17099
17538
  const result = await client.members({ headers: {} });
17100
17539
  if (result.status === 200) {
17101
17540
  return result.body;
@@ -17104,7 +17543,7 @@ async function getZeroOrgMembers() {
17104
17543
  }
17105
17544
  async function inviteZeroOrgMember(email) {
17106
17545
  const config = await getClientConfig();
17107
- const client = initClient3(zeroOrgInviteContract, config);
17546
+ const client = initClient4(zeroOrgInviteContract, config);
17108
17547
  const result = await client.invite({
17109
17548
  body: { email }
17110
17549
  });
@@ -17115,7 +17554,7 @@ async function inviteZeroOrgMember(email) {
17115
17554
  }
17116
17555
  async function removeZeroOrgMember(email) {
17117
17556
  const config = await getClientConfig();
17118
- const client = initClient3(zeroOrgMembersContract, config);
17557
+ const client = initClient4(zeroOrgMembersContract, config);
17119
17558
  const result = await client.removeMember({
17120
17559
  body: { email }
17121
17560
  });
@@ -17126,7 +17565,7 @@ async function removeZeroOrgMember(email) {
17126
17565
  }
17127
17566
  async function leaveZeroOrg() {
17128
17567
  const config = await getClientConfig();
17129
- const client = initClient3(zeroOrgLeaveContract, config);
17568
+ const client = initClient4(zeroOrgLeaveContract, config);
17130
17569
  const result = await client.leave({
17131
17570
  body: {}
17132
17571
  });
@@ -17137,7 +17576,7 @@ async function leaveZeroOrg() {
17137
17576
  }
17138
17577
  async function deleteZeroOrg(slug) {
17139
17578
  const config = await getClientConfig();
17140
- const client = initClient3(zeroOrgDeleteContract, config);
17579
+ const client = initClient4(zeroOrgDeleteContract, config);
17141
17580
  const result = await client.delete({
17142
17581
  body: { slug }
17143
17582
  });
@@ -17146,12 +17585,24 @@ async function deleteZeroOrg(slug) {
17146
17585
  }
17147
17586
  handleError(result, "Failed to delete organization");
17148
17587
  }
17588
+ async function switchZeroOrg(slug) {
17589
+ const config = await getUserTokenClientConfig();
17590
+ const client = initClient4(cliAuthOrgContract, config);
17591
+ const result = await client.switchOrg({
17592
+ headers: { authorization: `Bearer ${await getToken()}` },
17593
+ body: { slug }
17594
+ });
17595
+ if (result.status === 200) {
17596
+ return result.body;
17597
+ }
17598
+ handleError(result, "Failed to switch organization");
17599
+ }
17149
17600
 
17150
17601
  // src/lib/api/domains/zero-secrets.ts
17151
- import { initClient as initClient4 } from "@ts-rest/core";
17602
+ import { initClient as initClient5 } from "@ts-rest/core";
17152
17603
  async function listZeroSecrets() {
17153
17604
  const config = await getClientConfig();
17154
- const client = initClient4(zeroSecretsContract, config);
17605
+ const client = initClient5(zeroSecretsContract, config);
17155
17606
  const result = await client.list({ headers: {} });
17156
17607
  if (result.status === 200) {
17157
17608
  return result.body;
@@ -17160,7 +17611,7 @@ async function listZeroSecrets() {
17160
17611
  }
17161
17612
  async function setZeroSecret(body) {
17162
17613
  const config = await getClientConfig();
17163
- const client = initClient4(zeroSecretsContract, config);
17614
+ const client = initClient5(zeroSecretsContract, config);
17164
17615
  const result = await client.set({ body });
17165
17616
  if (result.status === 200 || result.status === 201) {
17166
17617
  return result.body;
@@ -17169,7 +17620,7 @@ async function setZeroSecret(body) {
17169
17620
  }
17170
17621
  async function deleteZeroSecret(name) {
17171
17622
  const config = await getClientConfig();
17172
- const client = initClient4(zeroSecretsByNameContract, config);
17623
+ const client = initClient5(zeroSecretsByNameContract, config);
17173
17624
  const result = await client.delete({
17174
17625
  params: { name }
17175
17626
  });
@@ -17180,10 +17631,10 @@ async function deleteZeroSecret(name) {
17180
17631
  }
17181
17632
 
17182
17633
  // src/lib/api/domains/zero-variables.ts
17183
- import { initClient as initClient5 } from "@ts-rest/core";
17634
+ import { initClient as initClient6 } from "@ts-rest/core";
17184
17635
  async function listZeroVariables() {
17185
17636
  const config = await getClientConfig();
17186
- const client = initClient5(zeroVariablesContract, config);
17637
+ const client = initClient6(zeroVariablesContract, config);
17187
17638
  const result = await client.list({ headers: {} });
17188
17639
  if (result.status === 200) {
17189
17640
  return result.body;
@@ -17192,7 +17643,7 @@ async function listZeroVariables() {
17192
17643
  }
17193
17644
  async function setZeroVariable(body) {
17194
17645
  const config = await getClientConfig();
17195
- const client = initClient5(zeroVariablesContract, config);
17646
+ const client = initClient6(zeroVariablesContract, config);
17196
17647
  const result = await client.set({ body });
17197
17648
  if (result.status === 200 || result.status === 201) {
17198
17649
  return result.body;
@@ -17201,7 +17652,7 @@ async function setZeroVariable(body) {
17201
17652
  }
17202
17653
  async function deleteZeroVariable(name) {
17203
17654
  const config = await getClientConfig();
17204
- const client = initClient5(zeroVariablesByNameContract, config);
17655
+ const client = initClient6(zeroVariablesByNameContract, config);
17205
17656
  const result = await client.delete({
17206
17657
  params: { name }
17207
17658
  });
@@ -17212,10 +17663,10 @@ async function deleteZeroVariable(name) {
17212
17663
  }
17213
17664
 
17214
17665
  // src/lib/api/domains/zero-connectors.ts
17215
- import { initClient as initClient6 } from "@ts-rest/core";
17666
+ import { initClient as initClient7 } from "@ts-rest/core";
17216
17667
  async function listZeroConnectors() {
17217
17668
  const config = await getClientConfig();
17218
- const client = initClient6(zeroConnectorsMainContract, config);
17669
+ const client = initClient7(zeroConnectorsMainContract, config);
17219
17670
  const result = await client.list({ headers: {} });
17220
17671
  if (result.status === 200) {
17221
17672
  return result.body;
@@ -17224,7 +17675,7 @@ async function listZeroConnectors() {
17224
17675
  }
17225
17676
  async function getZeroConnector(type) {
17226
17677
  const config = await getClientConfig();
17227
- const client = initClient6(zeroConnectorsByTypeContract, config);
17678
+ const client = initClient7(zeroConnectorsByTypeContract, config);
17228
17679
  const result = await client.get({
17229
17680
  params: { type }
17230
17681
  });
@@ -17238,7 +17689,7 @@ async function getZeroConnector(type) {
17238
17689
  }
17239
17690
  async function deleteZeroConnector(type) {
17240
17691
  const config = await getClientConfig();
17241
- const client = initClient6(zeroConnectorsByTypeContract, config);
17692
+ const client = initClient7(zeroConnectorsByTypeContract, config);
17242
17693
  const result = await client.delete({
17243
17694
  params: { type }
17244
17695
  });
@@ -17249,7 +17700,7 @@ async function deleteZeroConnector(type) {
17249
17700
  }
17250
17701
  async function createZeroConnectorSession(type) {
17251
17702
  const config = await getClientConfig();
17252
- const client = initClient6(zeroConnectorSessionsContract, config);
17703
+ const client = initClient7(zeroConnectorSessionsContract, config);
17253
17704
  const result = await client.create({
17254
17705
  params: { type },
17255
17706
  body: {}
@@ -17261,7 +17712,7 @@ async function createZeroConnectorSession(type) {
17261
17712
  }
17262
17713
  async function getZeroConnectorSession(type, sessionId) {
17263
17714
  const config = await getClientConfig();
17264
- const client = initClient6(zeroConnectorSessionByIdContract, config);
17715
+ const client = initClient7(zeroConnectorSessionByIdContract, config);
17265
17716
  const result = await client.get({
17266
17717
  params: { type, sessionId }
17267
17718
  });
@@ -17272,7 +17723,7 @@ async function getZeroConnectorSession(type, sessionId) {
17272
17723
  }
17273
17724
  async function createZeroComputerConnector() {
17274
17725
  const config = await getClientConfig();
17275
- const client = initClient6(zeroComputerConnectorContract, config);
17726
+ const client = initClient7(zeroComputerConnectorContract, config);
17276
17727
  const result = await client.create({
17277
17728
  body: {}
17278
17729
  });
@@ -17283,7 +17734,7 @@ async function createZeroComputerConnector() {
17283
17734
  }
17284
17735
  async function deleteZeroComputerConnector() {
17285
17736
  const config = await getClientConfig();
17286
- const client = initClient6(zeroComputerConnectorContract, config);
17737
+ const client = initClient7(zeroComputerConnectorContract, config);
17287
17738
  const result = await client.delete({});
17288
17739
  if (result.status === 204) {
17289
17740
  return;
@@ -17292,10 +17743,10 @@ async function deleteZeroComputerConnector() {
17292
17743
  }
17293
17744
 
17294
17745
  // src/lib/api/domains/runs.ts
17295
- import { initClient as initClient7 } from "@ts-rest/core";
17746
+ import { initClient as initClient8 } from "@ts-rest/core";
17296
17747
  async function createRun(body) {
17297
17748
  const config = await getClientConfig();
17298
- const client = initClient7(runsMainContract, config);
17749
+ const client = initClient8(runsMainContract, config);
17299
17750
  const result = await client.create({ body });
17300
17751
  if (result.status === 201) {
17301
17752
  return result.body;
@@ -17304,7 +17755,7 @@ async function createRun(body) {
17304
17755
  }
17305
17756
  async function getEvents(runId, options) {
17306
17757
  const config = await getClientConfig();
17307
- const client = initClient7(runEventsContract, config);
17758
+ const client = initClient8(runEventsContract, config);
17308
17759
  const result = await client.getEvents({
17309
17760
  params: { id: runId },
17310
17761
  query: {
@@ -17319,7 +17770,7 @@ async function getEvents(runId, options) {
17319
17770
  }
17320
17771
  async function listRuns(params) {
17321
17772
  const config = await getClientConfig();
17322
- const client = initClient7(runsMainContract, config);
17773
+ const client = initClient8(runsMainContract, config);
17323
17774
  const result = await client.list({
17324
17775
  query: {
17325
17776
  status: params?.status,
@@ -17336,7 +17787,7 @@ async function listRuns(params) {
17336
17787
  }
17337
17788
  async function getRunQueue() {
17338
17789
  const config = await getClientConfig();
17339
- const client = initClient7(runsQueueContract, config);
17790
+ const client = initClient8(runsQueueContract, config);
17340
17791
  const result = await client.getQueue({ headers: {} });
17341
17792
  if (result.status === 200) {
17342
17793
  return result.body;
@@ -17345,7 +17796,7 @@ async function getRunQueue() {
17345
17796
  }
17346
17797
  async function cancelRun(runId) {
17347
17798
  const config = await getClientConfig();
17348
- const client = initClient7(runsCancelContract, config);
17799
+ const client = initClient8(runsCancelContract, config);
17349
17800
  const result = await client.cancel({
17350
17801
  params: { id: runId }
17351
17802
  });
@@ -17356,10 +17807,10 @@ async function cancelRun(runId) {
17356
17807
  }
17357
17808
 
17358
17809
  // src/lib/api/domains/sessions.ts
17359
- import { initClient as initClient8 } from "@ts-rest/core";
17810
+ import { initClient as initClient9 } from "@ts-rest/core";
17360
17811
  async function getSession(sessionId) {
17361
17812
  const config = await getClientConfig();
17362
- const client = initClient8(sessionsByIdContract, config);
17813
+ const client = initClient9(sessionsByIdContract, config);
17363
17814
  const result = await client.getById({
17364
17815
  params: { id: sessionId }
17365
17816
  });
@@ -17372,7 +17823,7 @@ async function getSession(sessionId) {
17372
17823
  }
17373
17824
  async function getCheckpoint(checkpointId) {
17374
17825
  const config = await getClientConfig();
17375
- const client = initClient8(checkpointsByIdContract, config);
17826
+ const client = initClient9(checkpointsByIdContract, config);
17376
17827
  const result = await client.getById({
17377
17828
  params: { id: checkpointId }
17378
17829
  });
@@ -17383,10 +17834,10 @@ async function getCheckpoint(checkpointId) {
17383
17834
  }
17384
17835
 
17385
17836
  // src/lib/api/domains/storages.ts
17386
- import { initClient as initClient9 } from "@ts-rest/core";
17837
+ import { initClient as initClient10 } from "@ts-rest/core";
17387
17838
  async function prepareStorage(body) {
17388
17839
  const config = await getClientConfig();
17389
- const client = initClient9(storagesPrepareContract, config);
17840
+ const client = initClient10(storagesPrepareContract, config);
17390
17841
  const result = await client.prepare({ body });
17391
17842
  if (result.status === 200) {
17392
17843
  return result.body;
@@ -17395,7 +17846,7 @@ async function prepareStorage(body) {
17395
17846
  }
17396
17847
  async function commitStorage(body) {
17397
17848
  const config = await getClientConfig();
17398
- const client = initClient9(storagesCommitContract, config);
17849
+ const client = initClient10(storagesCommitContract, config);
17399
17850
  const result = await client.commit({ body });
17400
17851
  if (result.status === 200) {
17401
17852
  return result.body;
@@ -17404,7 +17855,7 @@ async function commitStorage(body) {
17404
17855
  }
17405
17856
  async function getStorageDownload(query) {
17406
17857
  const config = await getClientConfig();
17407
- const client = initClient9(storagesDownloadContract, config);
17858
+ const client = initClient10(storagesDownloadContract, config);
17408
17859
  const result = await client.download({
17409
17860
  query: {
17410
17861
  name: query.name,
@@ -17419,7 +17870,7 @@ async function getStorageDownload(query) {
17419
17870
  }
17420
17871
  async function listStorages(query) {
17421
17872
  const config = await getClientConfig();
17422
- const client = initClient9(storagesListContract, config);
17873
+ const client = initClient10(storagesListContract, config);
17423
17874
  const result = await client.list({ query });
17424
17875
  if (result.status === 200) {
17425
17876
  return result.body;
@@ -17428,10 +17879,10 @@ async function listStorages(query) {
17428
17879
  }
17429
17880
 
17430
17881
  // src/lib/api/domains/zero-org-secrets.ts
17431
- import { initClient as initClient10 } from "@ts-rest/core";
17882
+ import { initClient as initClient11 } from "@ts-rest/core";
17432
17883
  async function listZeroOrgSecrets() {
17433
17884
  const config = await getClientConfig();
17434
- const client = initClient10(zeroSecretsContract, config);
17885
+ const client = initClient11(zeroSecretsContract, config);
17435
17886
  const result = await client.list({ headers: {} });
17436
17887
  if (result.status === 200) {
17437
17888
  return result.body;
@@ -17440,7 +17891,7 @@ async function listZeroOrgSecrets() {
17440
17891
  }
17441
17892
  async function setZeroOrgSecret(body) {
17442
17893
  const config = await getClientConfig();
17443
- const client = initClient10(zeroSecretsContract, config);
17894
+ const client = initClient11(zeroSecretsContract, config);
17444
17895
  const result = await client.set({ body });
17445
17896
  if (result.status === 200 || result.status === 201) {
17446
17897
  return result.body;
@@ -17449,7 +17900,7 @@ async function setZeroOrgSecret(body) {
17449
17900
  }
17450
17901
  async function deleteZeroOrgSecret(name) {
17451
17902
  const config = await getClientConfig();
17452
- const client = initClient10(zeroSecretsByNameContract, config);
17903
+ const client = initClient11(zeroSecretsByNameContract, config);
17453
17904
  const result = await client.delete({
17454
17905
  params: { name }
17455
17906
  });
@@ -17460,10 +17911,10 @@ async function deleteZeroOrgSecret(name) {
17460
17911
  }
17461
17912
 
17462
17913
  // src/lib/api/domains/zero-org-variables.ts
17463
- import { initClient as initClient11 } from "@ts-rest/core";
17914
+ import { initClient as initClient12 } from "@ts-rest/core";
17464
17915
  async function listZeroOrgVariables() {
17465
17916
  const config = await getClientConfig();
17466
- const client = initClient11(zeroVariablesContract, config);
17917
+ const client = initClient12(zeroVariablesContract, config);
17467
17918
  const result = await client.list({ headers: {} });
17468
17919
  if (result.status === 200) {
17469
17920
  return result.body;
@@ -17472,7 +17923,7 @@ async function listZeroOrgVariables() {
17472
17923
  }
17473
17924
  async function setZeroOrgVariable(body) {
17474
17925
  const config = await getClientConfig();
17475
- const client = initClient11(zeroVariablesContract, config);
17926
+ const client = initClient12(zeroVariablesContract, config);
17476
17927
  const result = await client.set({ body });
17477
17928
  if (result.status === 200 || result.status === 201) {
17478
17929
  return result.body;
@@ -17481,7 +17932,7 @@ async function setZeroOrgVariable(body) {
17481
17932
  }
17482
17933
  async function deleteZeroOrgVariable(name) {
17483
17934
  const config = await getClientConfig();
17484
- const client = initClient11(zeroVariablesByNameContract, config);
17935
+ const client = initClient12(zeroVariablesByNameContract, config);
17485
17936
  const result = await client.delete({
17486
17937
  params: { name }
17487
17938
  });
@@ -17492,10 +17943,10 @@ async function deleteZeroOrgVariable(name) {
17492
17943
  }
17493
17944
 
17494
17945
  // src/lib/api/domains/zero-org-model-providers.ts
17495
- import { initClient as initClient12 } from "@ts-rest/core";
17946
+ import { initClient as initClient13 } from "@ts-rest/core";
17496
17947
  async function listZeroOrgModelProviders() {
17497
17948
  const config = await getClientConfig();
17498
- const client = initClient12(zeroModelProvidersMainContract, config);
17949
+ const client = initClient13(zeroModelProvidersMainContract, config);
17499
17950
  const result = await client.list({ headers: {} });
17500
17951
  if (result.status === 200) {
17501
17952
  return result.body;
@@ -17504,7 +17955,7 @@ async function listZeroOrgModelProviders() {
17504
17955
  }
17505
17956
  async function upsertZeroOrgModelProvider(body) {
17506
17957
  const config = await getClientConfig();
17507
- const client = initClient12(zeroModelProvidersMainContract, config);
17958
+ const client = initClient13(zeroModelProvidersMainContract, config);
17508
17959
  const result = await client.upsert({ body });
17509
17960
  if (result.status === 200 || result.status === 201) {
17510
17961
  return result.body;
@@ -17513,7 +17964,7 @@ async function upsertZeroOrgModelProvider(body) {
17513
17964
  }
17514
17965
  async function deleteZeroOrgModelProvider(type) {
17515
17966
  const config = await getClientConfig();
17516
- const client = initClient12(zeroModelProvidersByTypeContract, config);
17967
+ const client = initClient13(zeroModelProvidersByTypeContract, config);
17517
17968
  const result = await client.delete({
17518
17969
  params: { type }
17519
17970
  });
@@ -17524,7 +17975,7 @@ async function deleteZeroOrgModelProvider(type) {
17524
17975
  }
17525
17976
  async function setZeroOrgModelProviderDefault(type) {
17526
17977
  const config = await getClientConfig();
17527
- const client = initClient12(zeroModelProvidersDefaultContract, config);
17978
+ const client = initClient13(zeroModelProvidersDefaultContract, config);
17528
17979
  const result = await client.setDefault({
17529
17980
  params: { type }
17530
17981
  });
@@ -17535,7 +17986,7 @@ async function setZeroOrgModelProviderDefault(type) {
17535
17986
  }
17536
17987
  async function updateZeroOrgModelProviderModel(type, selectedModel) {
17537
17988
  const config = await getClientConfig();
17538
- const client = initClient12(zeroModelProvidersUpdateModelContract, config);
17989
+ const client = initClient13(zeroModelProvidersUpdateModelContract, config);
17539
17990
  const result = await client.updateModel({
17540
17991
  params: { type },
17541
17992
  body: { selectedModel }
@@ -17547,52 +17998,52 @@ async function updateZeroOrgModelProviderModel(type, selectedModel) {
17547
17998
  }
17548
17999
 
17549
18000
  // src/lib/api/domains/zero-agents.ts
17550
- import { initClient as initClient13 } from "@ts-rest/core";
18001
+ import { initClient as initClient14 } from "@ts-rest/core";
17551
18002
  async function createZeroAgent(body) {
17552
18003
  const config = await getClientConfig();
17553
- const client = initClient13(zeroAgentsMainContract, config);
18004
+ const client = initClient14(zeroAgentsMainContract, config);
17554
18005
  const result = await client.create({ body });
17555
18006
  if (result.status === 201) return result.body;
17556
18007
  handleError(result, "Failed to create zero agent");
17557
18008
  }
17558
18009
  async function listZeroAgents() {
17559
18010
  const config = await getClientConfig();
17560
- const client = initClient13(zeroAgentsMainContract, config);
18011
+ const client = initClient14(zeroAgentsMainContract, config);
17561
18012
  const result = await client.list({ headers: {} });
17562
18013
  if (result.status === 200) return result.body;
17563
18014
  handleError(result, "Failed to list zero agents");
17564
18015
  }
17565
18016
  async function getZeroAgent(id) {
17566
18017
  const config = await getClientConfig();
17567
- const client = initClient13(zeroAgentsByIdContract, config);
18018
+ const client = initClient14(zeroAgentsByIdContract, config);
17568
18019
  const result = await client.get({ params: { id } });
17569
18020
  if (result.status === 200) return result.body;
17570
18021
  handleError(result, `Zero agent "${id}" not found`);
17571
18022
  }
17572
18023
  async function updateZeroAgent(id, body) {
17573
18024
  const config = await getClientConfig();
17574
- const client = initClient13(zeroAgentsByIdContract, config);
18025
+ const client = initClient14(zeroAgentsByIdContract, config);
17575
18026
  const result = await client.update({ params: { id }, body });
17576
18027
  if (result.status === 200) return result.body;
17577
18028
  handleError(result, `Failed to update zero agent "${id}"`);
17578
18029
  }
17579
18030
  async function deleteZeroAgent(id) {
17580
18031
  const config = await getClientConfig();
17581
- const client = initClient13(zeroAgentsByIdContract, config);
18032
+ const client = initClient14(zeroAgentsByIdContract, config);
17582
18033
  const result = await client.delete({ params: { id } });
17583
18034
  if (result.status === 204) return;
17584
18035
  handleError(result, `Zero agent "${id}" not found`);
17585
18036
  }
17586
18037
  async function getZeroAgentInstructions(id) {
17587
18038
  const config = await getClientConfig();
17588
- const client = initClient13(zeroAgentInstructionsContract, config);
18039
+ const client = initClient14(zeroAgentInstructionsContract, config);
17589
18040
  const result = await client.get({ params: { id } });
17590
18041
  if (result.status === 200) return result.body;
17591
18042
  handleError(result, `Failed to get instructions for zero agent "${id}"`);
17592
18043
  }
17593
18044
  async function updateZeroAgentInstructions(id, content) {
17594
18045
  const config = await getClientConfig();
17595
- const client = initClient13(zeroAgentInstructionsContract, config);
18046
+ const client = initClient14(zeroAgentInstructionsContract, config);
17596
18047
  const result = await client.update({
17597
18048
  params: { id },
17598
18049
  body: { content }
@@ -17602,10 +18053,10 @@ async function updateZeroAgentInstructions(id, content) {
17602
18053
  }
17603
18054
 
17604
18055
  // src/lib/api/domains/integrations-slack.ts
17605
- import { initClient as initClient14 } from "@ts-rest/core";
18056
+ import { initClient as initClient15 } from "@ts-rest/core";
17606
18057
  async function sendSlackMessage(body) {
17607
18058
  const config = await getClientConfig();
17608
- const client = initClient14(integrationsSlackMessageContract, config);
18059
+ const client = initClient15(integrationsSlackMessageContract, config);
17609
18060
  const result = await client.sendMessage({ body, headers: {} });
17610
18061
  if (result.status === 200) {
17611
18062
  return result.body;
@@ -17614,10 +18065,10 @@ async function sendSlackMessage(body) {
17614
18065
  }
17615
18066
 
17616
18067
  // src/lib/api/domains/zero-schedules.ts
17617
- import { initClient as initClient15 } from "@ts-rest/core";
18068
+ import { initClient as initClient16 } from "@ts-rest/core";
17618
18069
  async function deployZeroSchedule(body) {
17619
18070
  const config = await getClientConfig();
17620
- const client = initClient15(zeroSchedulesMainContract, config);
18071
+ const client = initClient16(zeroSchedulesMainContract, config);
17621
18072
  const result = await client.deploy({ body });
17622
18073
  if (result.status === 200 || result.status === 201) {
17623
18074
  return result.body;
@@ -17626,7 +18077,7 @@ async function deployZeroSchedule(body) {
17626
18077
  }
17627
18078
  async function listZeroSchedules() {
17628
18079
  const config = await getClientConfig();
17629
- const client = initClient15(zeroSchedulesMainContract, config);
18080
+ const client = initClient16(zeroSchedulesMainContract, config);
17630
18081
  const result = await client.list({ headers: {} });
17631
18082
  if (result.status === 200) {
17632
18083
  return result.body;
@@ -17635,7 +18086,7 @@ async function listZeroSchedules() {
17635
18086
  }
17636
18087
  async function deleteZeroSchedule(params) {
17637
18088
  const config = await getClientConfig();
17638
- const client = initClient15(zeroSchedulesByNameContract, config);
18089
+ const client = initClient16(zeroSchedulesByNameContract, config);
17639
18090
  const result = await client.delete({
17640
18091
  params: { name: params.name },
17641
18092
  query: { agentId: params.agentId }
@@ -17647,7 +18098,7 @@ async function deleteZeroSchedule(params) {
17647
18098
  }
17648
18099
  async function enableZeroSchedule(params) {
17649
18100
  const config = await getClientConfig();
17650
- const client = initClient15(zeroSchedulesEnableContract, config);
18101
+ const client = initClient16(zeroSchedulesEnableContract, config);
17651
18102
  const result = await client.enable({
17652
18103
  params: { name: params.name },
17653
18104
  body: { agentId: params.agentId }
@@ -17659,7 +18110,7 @@ async function enableZeroSchedule(params) {
17659
18110
  }
17660
18111
  async function disableZeroSchedule(params) {
17661
18112
  const config = await getClientConfig();
17662
- const client = initClient15(zeroSchedulesEnableContract, config);
18113
+ const client = initClient16(zeroSchedulesEnableContract, config);
17663
18114
  const result = await client.disable({
17664
18115
  params: { name: params.name },
17665
18116
  body: { agentId: params.agentId }
@@ -17783,32 +18234,23 @@ async function promptPassword(message) {
17783
18234
 
17784
18235
  export {
17785
18236
  configureGlobalProxyFromEnv,
18237
+ decodeCliTokenPayload,
17786
18238
  decodeZeroTokenPayload,
17787
18239
  loadConfig,
17788
18240
  saveConfig,
17789
18241
  getToken,
17790
- getActiveToken,
17791
18242
  getApiUrl,
17792
18243
  getActiveOrg,
17793
18244
  clearConfig,
17794
18245
  extractAndGroupVariables,
17795
18246
  volumeConfigSchema,
17796
18247
  agentDefinitionSchema,
17797
- composesMainContract,
17798
- composesByIdContract,
17799
- composesVersionsContract,
17800
18248
  ALL_RUN_STATUSES,
17801
- runsMainContract,
17802
- runEventsContract,
17803
18249
  runSystemLogContract,
17804
18250
  runMetricsContract,
17805
18251
  runAgentEventsContract,
17806
18252
  runNetworkLogsContract,
17807
18253
  logsSearchContract,
17808
- storagesPrepareContract,
17809
- storagesCommitContract,
17810
- storagesDownloadContract,
17811
- storagesListContract,
17812
18254
  MODEL_PROVIDER_TYPES,
17813
18255
  getSelectableProviderTypes,
17814
18256
  hasAuthMethods,
@@ -17820,8 +18262,6 @@ export {
17820
18262
  hasModelSelection,
17821
18263
  allowsCustomModel,
17822
18264
  getCustomModelPlaceholder,
17823
- sessionsByIdContract,
17824
- checkpointsByIdContract,
17825
18265
  CONNECTOR_TYPES,
17826
18266
  connectorTypeSchema,
17827
18267
  getConnectorDerivedNames,
@@ -17869,6 +18309,7 @@ export {
17869
18309
  removeZeroOrgMember,
17870
18310
  leaveZeroOrg,
17871
18311
  deleteZeroOrg,
18312
+ switchZeroOrg,
17872
18313
  listZeroSecrets,
17873
18314
  setZeroSecret,
17874
18315
  deleteZeroSecret,
@@ -17913,4 +18354,4 @@ export {
17913
18354
  promptSelect,
17914
18355
  promptPassword
17915
18356
  };
17916
- //# sourceMappingURL=chunk-2KN52BP2.js.map
18357
+ //# sourceMappingURL=chunk-Z7ZCVASY.js.map