@runtypelabs/cli 2.10.9 → 2.11.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.
Files changed (2) hide show
  1. package/dist/index.js +292 -35
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ var require_default_models = __commonJS({
72
72
  // Inception models (routed via Vercel)
73
73
  { provider: "runtype", modelId: "mercury-2", isDefault: false },
74
74
  // Moonshot models (routed via Cloudflare Workers AI)
75
- { provider: "runtype", modelId: "kimi-k2.5", isDefault: false },
75
+ { provider: "runtype", modelId: "kimi-k2.6", isDefault: false },
76
76
  // NVIDIA models (routed via Cloudflare Workers AI)
77
77
  { provider: "runtype", modelId: "nemotron-3-120b-a12b", isDefault: false },
78
78
  // Google models (routed via Cloudflare Workers AI)
@@ -107,11 +107,6 @@ var require_default_models = __commonJS({
107
107
  },
108
108
  { id: "gpt-4.1-mini", name: "GPT-4.1 Mini", description: "Fast general purpose" },
109
109
  { id: "gpt-5-nano", name: "GPT-5 Nano", description: "Latest generation, very affordable" },
110
- {
111
- id: "mixlayer/nvidia/orchestrator-8b",
112
- name: "NVIDIA Orchestrator 8B",
113
- description: "Purpose-built for tool/intent routing"
114
- },
115
110
  {
116
111
  id: "mixlayer/qwen/qwen3.5-9b",
117
112
  name: "Qwen 3.5 9B",
@@ -247,6 +242,78 @@ var init_credential_store = __esm({
247
242
  }
248
243
  });
249
244
 
245
+ // ../shared/dist/dashboard-url.js
246
+ var require_dashboard_url = __commonJS({
247
+ "../shared/dist/dashboard-url.js"(exports) {
248
+ "use strict";
249
+ Object.defineProperty(exports, "__esModule", { value: true });
250
+ exports.ACCOUNT_QUERY_PARAM = void 0;
251
+ exports.buildDashboardUrl = buildDashboardUrl5;
252
+ exports.parseAccountParam = parseAccountParam;
253
+ exports.parseAccountId = parseAccountId;
254
+ exports.isValidAccountId = isValidAccountId;
255
+ exports.selectAccountId = selectAccountId3;
256
+ exports.ACCOUNT_QUERY_PARAM = "account";
257
+ function buildDashboardUrl5(opts) {
258
+ let base = opts.baseUrl;
259
+ while (base.endsWith("/")) {
260
+ base = base.slice(0, -1);
261
+ }
262
+ const path14 = opts.path.startsWith("/") ? opts.path : `/${opts.path}`;
263
+ const params = new URLSearchParams();
264
+ if (isValidAccountId(opts.account)) {
265
+ params.set(exports.ACCOUNT_QUERY_PARAM, opts.account);
266
+ }
267
+ if (opts.searchParams) {
268
+ for (const [key, value] of Object.entries(opts.searchParams)) {
269
+ if (value !== void 0) {
270
+ params.set(key, value);
271
+ }
272
+ }
273
+ }
274
+ const qs = params.toString();
275
+ return qs ? `${base}${path14}?${qs}` : `${base}${path14}`;
276
+ }
277
+ function parseAccountParam(input) {
278
+ let value;
279
+ if (input instanceof URLSearchParams) {
280
+ value = input.get(exports.ACCOUNT_QUERY_PARAM);
281
+ } else if (input instanceof URL) {
282
+ value = input.searchParams.get(exports.ACCOUNT_QUERY_PARAM);
283
+ } else {
284
+ try {
285
+ value = new URL(input).searchParams.get(exports.ACCOUNT_QUERY_PARAM);
286
+ } catch (_a) {
287
+ const qs = input.startsWith("?") ? input.slice(1) : input;
288
+ value = new URLSearchParams(qs).get(exports.ACCOUNT_QUERY_PARAM);
289
+ }
290
+ }
291
+ return parseAccountId(value);
292
+ }
293
+ function parseAccountId(value) {
294
+ if (!value)
295
+ return null;
296
+ if (value.startsWith("user_") && value.length > "user_".length) {
297
+ return { kind: "user", id: value };
298
+ }
299
+ if (value.startsWith("org_") && value.length > "org_".length) {
300
+ return { kind: "org", id: value };
301
+ }
302
+ return null;
303
+ }
304
+ function isValidAccountId(value) {
305
+ return parseAccountId(value) !== null;
306
+ }
307
+ function selectAccountId3(params) {
308
+ if (isValidAccountId(params.organizationId))
309
+ return params.organizationId;
310
+ if (isValidAccountId(params.userId))
311
+ return params.userId;
312
+ return void 0;
313
+ }
314
+ }
315
+ });
316
+
250
317
  // ../shared/dist/integration-providers.js
251
318
  var require_integration_providers = __commonJS({
252
319
  "../shared/dist/integration-providers.js"(exports) {
@@ -10994,6 +11061,7 @@ var require_builtin_tools_registry = __commonJS({
10994
11061
  exports.getBuiltInToolsByCategory = getBuiltInToolsByCategory;
10995
11062
  exports.isToolCompatibleWithModel = isToolCompatibleWithModel2;
10996
11063
  exports.getCompatibleBuiltInTools = getCompatibleBuiltInTools;
11064
+ exports.validateConfigAgainstSchema = validateConfigAgainstSchema;
10997
11065
  exports.validateToolConfig = validateToolConfig;
10998
11066
  var generated_orthogonal_tools_1 = require_generated_orthogonal_tools();
10999
11067
  exports.BuiltInToolProvider = {
@@ -11194,11 +11262,14 @@ var require_builtin_tools_registry = __commonJS({
11194
11262
  executionHint: "provider"
11195
11263
  // Anthropic executes this natively
11196
11264
  },
11197
- // xAI Live Search (native provider feature, enabled via providerOptions)
11265
+ // xAI Live Search (DEPRECATED retired by xAI on 2026-01-12; requests return 410 Gone).
11266
+ // Kept in the registry so existing flows don't throw on lookup; the xAI executor
11267
+ // auto-migrates its config into the Agent Tools API (xai_web_search / xai_x_search)
11268
+ // on the Responses endpoint. New flows should select xai_web_search or xai_x_search.
11198
11269
  {
11199
11270
  id: "xai_live_search",
11200
- name: "xAI Live Search",
11201
- description: "Search the live web, X posts, news, and RSS feeds using xAI's Live Search. Grok can cite sources with URLs.",
11271
+ name: "xAI Live Search (deprecated)",
11272
+ description: "Deprecated. xAI retired Live Search on 2026-01-12; the Chat Completions search_parameters endpoint now returns 410 Gone. Use xAI Web Search or xAI X Search (Agent Tools API) instead. Existing configs are auto-migrated at runtime.",
11202
11273
  category: exports.BuiltInToolCategory.WEB_SEARCH,
11203
11274
  providers: [exports.BuiltInToolProvider.XAI],
11204
11275
  parametersSchema: {
@@ -11293,11 +11364,13 @@ var require_builtin_tools_registry = __commonJS({
11293
11364
  models: ["grok-4", "grok-4-fast", "grok-4.1-fast"]
11294
11365
  }
11295
11366
  ],
11296
- documentationUrl: "https://docs.x.ai/docs/guides/live-search",
11367
+ documentationUrl: "https://docs.x.ai/docs/guides/tools/search-tools",
11297
11368
  requiresApiKey: true,
11298
11369
  executionHint: "provider",
11299
- // xAI executes this natively via providerOptions.xai.searchParameters
11300
- platformKeySupport: true
11370
+ // Executor auto-migrates to Responses API web_search / x_search
11371
+ platformKeySupport: true,
11372
+ deprecated: true,
11373
+ hidden: true
11301
11374
  },
11302
11375
  // xAI X Search (native Responses API server-side tool)
11303
11376
  // Unlike xai_live_search (chat API preprocessing), this is an agentic tool
@@ -11828,6 +11901,77 @@ var require_builtin_tools_registry = __commonJS({
11828
11901
  platformKeySupport: true,
11829
11902
  requiresApiKey: false
11830
11903
  },
11904
+ // Generate PDF — render HTML or Markdown to a PDF document
11905
+ {
11906
+ id: "generate_pdf",
11907
+ name: "Generate PDF",
11908
+ description: "Render HTML or Markdown to a PDF file and store it on Runtype's CDN. Returns a permanent public URL or a time-limited signed URL (default 1 hour) depending on `visibility`. Exactly one of `html` or `markdown` must be provided \u2014 markdown is rendered with GFM in an A4 print shell with sensible typography; html is passed through untouched so callers can control their own fonts and CSS. Optional `pdfOptions` (format, landscape, margin, printBackground, displayHeaderFooter, headerTemplate, footerTemplate, scale, pageRanges, preferCSSPageSize, omitBackground) are forwarded to the renderer. Source is capped at 2 MB; output is capped at 25 MB. Powered by Cloudflare Browser Rendering.",
11909
+ category: exports.BuiltInToolCategory.FILE_OPERATIONS,
11910
+ providers: [exports.BuiltInToolProvider.MULTI],
11911
+ parametersSchema: {
11912
+ type: "object",
11913
+ properties: {
11914
+ html: {
11915
+ type: "string",
11916
+ description: "Complete HTML document (or fragment) to render. Callers supply their own styling. Provide this OR `markdown`, not both."
11917
+ },
11918
+ markdown: {
11919
+ type: "string",
11920
+ description: "Markdown source. Rendered with GFM and wrapped in an A4 print shell. Inline HTML inside the markdown is escaped. Provide this OR `html`, not both."
11921
+ },
11922
+ filename: {
11923
+ type: "string",
11924
+ description: "Optional filename for the stored PDF (defaults to `document-<timestamp>.pdf`)."
11925
+ },
11926
+ visibility: {
11927
+ type: "string",
11928
+ enum: ["public", "private"],
11929
+ description: 'Access control. "public" returns a permanent URL; "private" returns a signed URL that expires (default 1 hour). Default: "public".'
11930
+ },
11931
+ pdfOptions: {
11932
+ type: "object",
11933
+ description: "Optional puppeteer `page.pdf()` options (whitelisted).",
11934
+ properties: {
11935
+ format: {
11936
+ type: "string",
11937
+ description: 'Paper format (e.g. "a4", "letter", "legal"). Overrides width/height.'
11938
+ },
11939
+ landscape: { type: "boolean" },
11940
+ printBackground: { type: "boolean" },
11941
+ displayHeaderFooter: { type: "boolean" },
11942
+ headerTemplate: {
11943
+ type: "string",
11944
+ description: "HTML template for the print header. Supports `date`, `title`, `url`, `pageNumber`, `totalPages` classes."
11945
+ },
11946
+ footerTemplate: { type: "string" },
11947
+ scale: {
11948
+ type: "number",
11949
+ description: "Rendering scale, between 0.1 and 2. Default 1."
11950
+ },
11951
+ preferCSSPageSize: { type: "boolean" },
11952
+ pageRanges: {
11953
+ type: "string",
11954
+ description: 'Page ranges to include, e.g. "1-5, 8, 11-13". Default: all pages.'
11955
+ },
11956
+ omitBackground: { type: "boolean" },
11957
+ margin: {
11958
+ type: "object",
11959
+ properties: {
11960
+ top: { type: "string" },
11961
+ right: { type: "string" },
11962
+ bottom: { type: "string" },
11963
+ left: { type: "string" }
11964
+ }
11965
+ }
11966
+ }
11967
+ }
11968
+ },
11969
+ required: []
11970
+ },
11971
+ executionHint: "platform",
11972
+ platformKeySupport: true,
11973
+ requiresApiKey: false
11974
+ },
11831
11975
  // Record Management Tools — CRUD operations on Runtype records
11832
11976
  {
11833
11977
  id: "runtype_record_upsert",
@@ -12705,13 +12849,8 @@ var require_builtin_tools_registry = __commonJS({
12705
12849
  function getCompatibleBuiltInTools(modelId, provider) {
12706
12850
  return exports.BUILTIN_TOOLS_REGISTRY.filter((tool) => !tool.hidden && isToolCompatibleWithModel2(tool.id, modelId, provider));
12707
12851
  }
12708
- function validateToolConfig(toolId, config2) {
12709
- const tool = getBuiltInToolById2(toolId);
12710
- if (!tool) {
12711
- return { valid: false, errors: ["Tool not found"] };
12712
- }
12852
+ function validateConfigAgainstSchema(schema, config2) {
12713
12853
  const errors = [];
12714
- const schema = tool.parametersSchema;
12715
12854
  if (schema.required) {
12716
12855
  for (const field of schema.required) {
12717
12856
  if (!(field in config2)) {
@@ -12727,19 +12866,23 @@ var require_builtin_tools_registry = __commonJS({
12727
12866
  continue;
12728
12867
  }
12729
12868
  const actualType = Array.isArray(value) ? "array" : typeof value;
12730
- if (propSchema.type && actualType !== propSchema.type) {
12869
+ const matchesSchemaType = !propSchema.type || actualType === propSchema.type || propSchema.type === "integer" && actualType === "number";
12870
+ if (!matchesSchemaType) {
12731
12871
  errors.push(`Field ${key} should be ${propSchema.type}, got ${actualType}`);
12732
12872
  }
12733
12873
  if (propSchema.enum && !propSchema.enum.includes(value)) {
12734
12874
  errors.push(`Field ${key} must be one of: ${propSchema.enum.join(", ")}`);
12735
12875
  }
12736
- if (propSchema.type === "number" && typeof value === "number") {
12876
+ if ((propSchema.type === "number" || propSchema.type === "integer") && typeof value === "number") {
12737
12877
  if (propSchema.minimum !== void 0 && value < propSchema.minimum) {
12738
12878
  errors.push(`Field ${key} must be >= ${propSchema.minimum}`);
12739
12879
  }
12740
12880
  if (propSchema.maximum !== void 0 && value > propSchema.maximum) {
12741
12881
  errors.push(`Field ${key} must be <= ${propSchema.maximum}`);
12742
12882
  }
12883
+ if (propSchema.type === "integer" && !Number.isInteger(value)) {
12884
+ errors.push(`Field ${key} should be integer, got non-integer number`);
12885
+ }
12743
12886
  }
12744
12887
  if (propSchema.type === "string" && typeof value === "string") {
12745
12888
  if (propSchema.minLength !== void 0 && value.length < propSchema.minLength) {
@@ -12756,6 +12899,13 @@ var require_builtin_tools_registry = __commonJS({
12756
12899
  errors: errors.length > 0 ? errors : void 0
12757
12900
  };
12758
12901
  }
12902
+ function validateToolConfig(toolId, config2) {
12903
+ const tool = getBuiltInToolById2(toolId);
12904
+ if (!tool) {
12905
+ return { valid: false, errors: ["Tool not found"] };
12906
+ }
12907
+ return validateConfigAgainstSchema(tool.parametersSchema, config2);
12908
+ }
12759
12909
  }
12760
12910
  });
12761
12911
 
@@ -12915,6 +13065,7 @@ var require_generated_model_routing = __commonJS({
12915
13065
  "kimi-k2-thinking-turbo": ["vercel"],
12916
13066
  "kimi-k2-turbo": ["vercel"],
12917
13067
  "kimi-k2.5": ["vercel"],
13068
+ "kimi-k2.6": ["vercel"],
12918
13069
  "llama-3-1-70b": ["vercel"],
12919
13070
  "llama-3-1-8b": ["vercel"],
12920
13071
  "llama-3-2-11b": ["vercel"],
@@ -12978,6 +13129,7 @@ var require_generated_model_routing = __commonJS({
12978
13129
  "qwen-3-235b": ["vercel"],
12979
13130
  "qwen-3-30b": ["vercel"],
12980
13131
  "qwen-3-32b": ["vercel"],
13132
+ "qwen-3.6-max-preview": ["vercel"],
12981
13133
  "qwen3-235b-a22b-thinking": ["vercel"],
12982
13134
  "qwen3-coder": ["vercel"],
12983
13135
  "qwen3-coder-30b-a3b": ["vercel"],
@@ -12997,6 +13149,7 @@ var require_generated_model_routing = __commonJS({
12997
13149
  "qwen3.5-27b": ["mixlayer"],
12998
13150
  "qwen3.5-35b-a3b": ["mixlayer"],
12999
13151
  "qwen3.5-397b-a17b": ["mixlayer"],
13152
+ "qwen3.5-4b-free": ["mixlayer"],
13000
13153
  "qwen3.5-9b": ["mixlayer"],
13001
13154
  "qwen3.5-flash": ["vercel"],
13002
13155
  "qwen3.5-plus": ["vercel"],
@@ -13159,6 +13312,7 @@ var require_generated_model_routing = __commonJS({
13159
13312
  "kimi-k2": ["vercel"],
13160
13313
  "kimi-k2-0905": ["vercel"],
13161
13314
  "kimi-k2-5": ["vercel"],
13315
+ "kimi-k2-6": ["vercel"],
13162
13316
  "kimi-k2-thinking-turbo": ["vercel"],
13163
13317
  "kimi-k2-turbo": ["vercel"],
13164
13318
  "llama-3-2-11b": ["vercel"],
@@ -13216,12 +13370,14 @@ var require_generated_model_routing = __commonJS({
13216
13370
  "qwen-3-14b": ["vercel"],
13217
13371
  "qwen-3-235b": ["vercel"],
13218
13372
  "qwen-3-30b": ["vercel"],
13373
+ "qwen-3-6-max": ["vercel"],
13219
13374
  "qwen3-235b-a22b": ["vercel"],
13220
13375
  "qwen3-32b": ["vercel"],
13221
13376
  "qwen3-5-122b-a10b": ["mixlayer"],
13222
13377
  "qwen3-5-27b": ["mixlayer"],
13223
13378
  "qwen3-5-35b-a3b": ["mixlayer"],
13224
13379
  "qwen3-5-397b-a17b": ["mixlayer"],
13380
+ "qwen3-5-4b-free": ["mixlayer"],
13225
13381
  "qwen3-5-9b": ["mixlayer"],
13226
13382
  "qwen3-5-flash": ["vercel"],
13227
13383
  "qwen3-5-plus": ["vercel"],
@@ -13914,6 +14070,9 @@ var require_generated_model_routing = __commonJS({
13914
14070
  "kimi-k2-5": {
13915
14071
  "vercel": "moonshotai/kimi-k2.5"
13916
14072
  },
14073
+ "kimi-k2-6": {
14074
+ "vercel": "moonshotai/kimi-k2.6"
14075
+ },
13917
14076
  "kimi-k2-thinking": {
13918
14077
  "vercel": "moonshotai/kimi-k2-thinking"
13919
14078
  },
@@ -13926,6 +14085,9 @@ var require_generated_model_routing = __commonJS({
13926
14085
  "kimi-k2.5": {
13927
14086
  "vercel": "moonshotai/kimi-k2.5"
13928
14087
  },
14088
+ "kimi-k2.6": {
14089
+ "vercel": "moonshotai/kimi-k2.6"
14090
+ },
13929
14091
  "llama-3-1-70b": {
13930
14092
  "vercel": "meta/llama-3-1-70b"
13931
14093
  },
@@ -14163,6 +14325,12 @@ var require_generated_model_routing = __commonJS({
14163
14325
  "qwen-3-32b": {
14164
14326
  "vercel": "alibaba/qwen-3-32b"
14165
14327
  },
14328
+ "qwen-3-6-max": {
14329
+ "vercel": "alibaba/qwen-3.6-max-preview"
14330
+ },
14331
+ "qwen-3.6-max-preview": {
14332
+ "vercel": "alibaba/qwen-3.6-max-preview"
14333
+ },
14166
14334
  "qwen3-235b-a22b": {
14167
14335
  "vercel": "alibaba/qwen3-235b-a22b-thinking"
14168
14336
  },
@@ -14184,6 +14352,9 @@ var require_generated_model_routing = __commonJS({
14184
14352
  "qwen3-5-397b-a17b": {
14185
14353
  "mixlayer": "qwen/qwen3.5-397b-a17b"
14186
14354
  },
14355
+ "qwen3-5-4b-free": {
14356
+ "mixlayer": "qwen/qwen3.5-4b-free"
14357
+ },
14187
14358
  "qwen3-5-9b": {
14188
14359
  "mixlayer": "qwen/qwen3.5-9b"
14189
14360
  },
@@ -14259,6 +14430,9 @@ var require_generated_model_routing = __commonJS({
14259
14430
  "qwen3.5-397b-a17b": {
14260
14431
  "mixlayer": "qwen/qwen3.5-397b-a17b"
14261
14432
  },
14433
+ "qwen3.5-4b-free": {
14434
+ "mixlayer": "qwen/qwen3.5-4b-free"
14435
+ },
14262
14436
  "qwen3.5-9b": {
14263
14437
  "mixlayer": "qwen/qwen3.5-9b"
14264
14438
  },
@@ -14417,6 +14591,7 @@ var require_generated_model_routing = __commonJS({
14417
14591
  "qwen-3-235b-a22b": { providers: [{ provider: "vercel", weight: 100 }] },
14418
14592
  "qwen-3-30b": { providers: [{ provider: "vercel", weight: 100 }] },
14419
14593
  "qwen-3-32b": { providers: [{ provider: "vercel", weight: 100 }] },
14594
+ "qwen-3-6-max": { providers: [{ provider: "vercel", weight: 100 }] },
14420
14595
  "qwen3-235b-a22b": { providers: [{ provider: "vercel", weight: 100 }] },
14421
14596
  "qwen3-32b": { providers: [{ provider: "vercel", weight: 100 }] },
14422
14597
  "qwen3-5-flash": { providers: [{ provider: "vercel", weight: 100 }] },
@@ -14689,6 +14864,14 @@ var require_provider_routing = __commonJS({
14689
14864
  ],
14690
14865
  fallback: ["vercel"]
14691
14866
  },
14867
+ // Kimi K2.6 - Route through Vercel AI Gateway (not available on Workers AI)
14868
+ // Kimi K2.6 - Route through Cloudflare Workers AI
14869
+ "kimi-k2.6": {
14870
+ providers: [
14871
+ { provider: "workers-ai", weight: 100 }
14872
+ ],
14873
+ fallback: ["vercel"]
14874
+ },
14692
14875
  // NVIDIA Nemotron-3 120B - Route through Cloudflare Workers AI (no Vercel equivalent)
14693
14876
  "nemotron-3-120b-a12b": {
14694
14877
  providers: [
@@ -14729,6 +14912,9 @@ var require_provider_routing = __commonJS({
14729
14912
  "kimi-k2.5": {
14730
14913
  "workers-ai": "@cf/moonshotai/kimi-k2.5"
14731
14914
  },
14915
+ "kimi-k2.6": {
14916
+ "workers-ai": "@cf/moonshotai/kimi-k2.6"
14917
+ },
14732
14918
  "nemotron-3-120b-a12b": {
14733
14919
  "workers-ai": "@cf/nvidia/nemotron-3-120b-a12b"
14734
14920
  },
@@ -19622,7 +19808,8 @@ var require_fpo_schema = __commonJS({
19622
19808
  var toolAuthSchema = zod_1.z.object({
19623
19809
  type: zod_1.z.enum(["oauth", "api_key", "none", "user_provided"]),
19624
19810
  setupRequired: zod_1.z.boolean(),
19625
- secrets: zod_1.z.array(secretSchema),
19811
+ // Each secret drives a DB write via materializeSecretBindings at assembly time.
19812
+ secrets: zod_1.z.array(secretSchema).max(20),
19626
19813
  setupInstructions: setupInstructionsSchema
19627
19814
  });
19628
19815
  exports.toolSchema = zod_1.z.object({
@@ -19692,9 +19879,9 @@ var require_fpo_schema = __commonJS({
19692
19879
  icon: zod_1.z.string().optional(),
19693
19880
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional()
19694
19881
  }),
19695
- capabilities: zod_1.z.array(exports.capabilitySchema),
19696
- tools: zod_1.z.array(exports.toolSchema),
19697
- surfaces: zod_1.z.array(exports.surfaceSchema),
19882
+ capabilities: zod_1.z.array(exports.capabilitySchema).max(50),
19883
+ tools: zod_1.z.array(exports.toolSchema).max(100),
19884
+ surfaces: zod_1.z.array(exports.surfaceSchema).max(50),
19698
19885
  _meta: metaSchema
19699
19886
  }).superRefine((fpo, ctx) => {
19700
19887
  const capIds = /* @__PURE__ */ new Set();
@@ -22960,12 +23147,29 @@ configCommand.command("path").description("Show configuration file path").action
22960
23147
  });
22961
23148
 
22962
23149
  // src/commands/products.ts
23150
+ var import_dashboard_url2 = __toESM(require_dashboard_url(), 1);
22963
23151
  import { Command as Command7 } from "commander";
22964
23152
  import chalk9 from "chalk";
22965
23153
  import React6 from "react";
22966
23154
  import { render as render6 } from "ink";
22967
23155
  import { useState as useState7, useEffect as useEffect8 } from "react";
22968
23156
  import open2 from "open";
23157
+
23158
+ // src/lib/account-context.ts
23159
+ var import_dashboard_url = __toESM(require_dashboard_url(), 1);
23160
+ init_credential_store();
23161
+ async function getCurrentAccountId() {
23162
+ try {
23163
+ const store = new CredentialStore();
23164
+ const creds = await store.getCredentials();
23165
+ if (!creds) return void 0;
23166
+ return (0, import_dashboard_url.selectAccountId)({ userId: creds.userId, organizationId: creds.orgId });
23167
+ } catch {
23168
+ return void 0;
23169
+ }
23170
+ }
23171
+
23172
+ // src/commands/products.ts
22969
23173
  function displayAgentCard(agentCard) {
22970
23174
  console.log(chalk9.cyan("\nAgent Details:"));
22971
23175
  console.log(` Name: ${agentCard.name}`);
@@ -23006,8 +23210,13 @@ async function createProduct(apiKey, templateId, agentCard, sourceUrl, productNa
23006
23210
  }
23007
23211
  return response.json();
23008
23212
  }
23009
- function displayCreationSuccess(result, agentCard, dashboardBaseUrl, jsonOutput) {
23010
- const productUrl = `${dashboardBaseUrl}/products/${result.product.id}?launch=true`;
23213
+ function displayCreationSuccess(result, agentCard, dashboardBaseUrl, jsonOutput, account) {
23214
+ const productUrl = (0, import_dashboard_url2.buildDashboardUrl)({
23215
+ baseUrl: dashboardBaseUrl,
23216
+ path: `/products/${result.product.id}`,
23217
+ account,
23218
+ searchParams: { launch: "true" }
23219
+ });
23011
23220
  if (jsonOutput) {
23012
23221
  console.log(
23013
23222
  JSON.stringify(
@@ -23129,7 +23338,14 @@ productsCommand.command("init").description("Initialize a product from an extern
23129
23338
  }
23130
23339
  process.exit(1);
23131
23340
  }
23132
- displayCreationSuccess(createResult, result.agentCard, getDashboardUrl(), isJsonMode);
23341
+ const account = await getCurrentAccountId();
23342
+ displayCreationSuccess(
23343
+ createResult,
23344
+ result.agentCard,
23345
+ getDashboardUrl(),
23346
+ isJsonMode,
23347
+ account
23348
+ );
23133
23349
  } catch (error) {
23134
23350
  const message = error instanceof Error ? error.message : "Unknown error";
23135
23351
  console.error(chalk9.red(`Failed: ${message}`));
@@ -23195,6 +23411,7 @@ productsCommand.command("init").description("Initialize a product from an extern
23195
23411
  return;
23196
23412
  }
23197
23413
  const dashboardUrl = getDashboardUrl();
23414
+ const account = await getCurrentAccountId();
23198
23415
  setResultNode(
23199
23416
  React6.createElement(EntityCard, {
23200
23417
  fields: [
@@ -23202,7 +23419,11 @@ productsCommand.command("init").description("Initialize a product from an extern
23202
23419
  { label: "Name", value: createResult.product.name },
23203
23420
  {
23204
23421
  label: "Dashboard",
23205
- value: `${dashboardUrl}/products/${createResult.product.id}`
23422
+ value: (0, import_dashboard_url2.buildDashboardUrl)({
23423
+ baseUrl: dashboardUrl,
23424
+ path: `/products/${createResult.product.id}`,
23425
+ account
23426
+ })
23206
23427
  }
23207
23428
  ]
23208
23429
  })
@@ -23266,6 +23487,7 @@ import React7 from "react";
23266
23487
  import { render as render7 } from "ink";
23267
23488
 
23268
23489
  // src/ink/init/InitApp.tsx
23490
+ var import_dashboard_url3 = __toESM(require_dashboard_url(), 1);
23269
23491
  init_credential_store();
23270
23492
  import { useState as useState8, useEffect as useEffect9, useCallback } from "react";
23271
23493
  import { Box as Box6, Text as Text7, useApp as useApp3, useInput as useInput4 } from "ink";
@@ -23336,7 +23558,8 @@ function InitApp({ apiUrl, onComplete }) {
23336
23558
  loading: true,
23337
23559
  loadingLabel: "Checking credentials...",
23338
23560
  complete: false,
23339
- createdProductId: null
23561
+ createdProductId: null,
23562
+ account: void 0
23340
23563
  });
23341
23564
  const getSummary = useCallback(() => {
23342
23565
  const answers = [];
@@ -23370,9 +23593,14 @@ function InitApp({ apiUrl, onComplete }) {
23370
23593
  apiUrl
23371
23594
  );
23372
23595
  if (isValid) {
23596
+ const existingCreds = await store.getCredentials();
23373
23597
  setState((prev) => ({
23374
23598
  ...prev,
23375
23599
  apiKey: existingKey,
23600
+ account: (0, import_dashboard_url3.selectAccountId)({
23601
+ userId: existingCreds?.userId,
23602
+ organizationId: existingCreds?.orgId
23603
+ }),
23376
23604
  step: 2,
23377
23605
  loading: false
23378
23606
  }));
@@ -23411,6 +23639,7 @@ function InitApp({ apiUrl, onComplete }) {
23411
23639
  setState((s) => ({
23412
23640
  ...s,
23413
23641
  apiKey: key,
23642
+ account: (0, import_dashboard_url3.selectAccountId)({ userId, organizationId: orgId }),
23414
23643
  step: 2,
23415
23644
  loading: false
23416
23645
  }));
@@ -23792,6 +24021,11 @@ function InitApp({ apiUrl, onComplete }) {
23792
24021
  }
23793
24022
  if (state.step === 7) {
23794
24023
  const dashboardUrl = getDashboardUrl();
24024
+ const productDashboardUrl = state.createdProductId ? (0, import_dashboard_url3.buildDashboardUrl)({
24025
+ baseUrl: dashboardUrl,
24026
+ path: `/products/${state.createdProductId}`,
24027
+ account: state.account
24028
+ }) : "";
23795
24029
  return /* @__PURE__ */ jsxs7(Box6, { flexDirection: "column", children: [
23796
24030
  state.createdProductId ? /* @__PURE__ */ jsxs7(Box6, { flexDirection: "column", children: [
23797
24031
  /* @__PURE__ */ jsxs7(Text7, { color: theme7.success, bold: true, children: [
@@ -23807,9 +24041,7 @@ function InitApp({ apiUrl, onComplete }) {
23807
24041
  " ",
23808
24042
  "Dashboard:",
23809
24043
  " ",
23810
- dashboardUrl,
23811
- "/products/",
23812
- state.createdProductId
24044
+ productDashboardUrl
23813
24045
  ] })
23814
24046
  ] }) : /* @__PURE__ */ jsxs7(Text7, { color: theme7.success, bold: true, children: [
23815
24047
  "\u2713",
@@ -24194,6 +24426,7 @@ import { render as render9 } from "ink";
24194
24426
  import React9 from "react";
24195
24427
 
24196
24428
  // src/ink/marathon/MarathonApp.tsx
24429
+ var import_dashboard_url4 = __toESM(require_dashboard_url(), 1);
24197
24430
  import { useState as useState22, useEffect as useEffect19, useRef as useRef9, useCallback as useCallback8, useMemo as useMemo11 } from "react";
24198
24431
  import { execSync } from "child_process";
24199
24432
  import * as fs4 from "fs";
@@ -29328,13 +29561,31 @@ function MarathonApp({
29328
29561
  const [upgradeModalDismissed, setUpgradeModalDismissed] = useState22(false);
29329
29562
  const [clipboardFlash, setClipboardFlash] = useState22(null);
29330
29563
  const flashTimeout = useRef9(null);
29331
- const billingPageUrl = billingUrl || `${(dashboardUrl || "https://use.runtype.com").replace(/\/$/, "")}/settings/billing`;
29564
+ const [account, setAccount] = useState22(void 0);
29565
+ useEffect19(() => {
29566
+ let cancelled = false;
29567
+ getCurrentAccountId().then((id) => {
29568
+ if (!cancelled) setAccount(id);
29569
+ });
29570
+ return () => {
29571
+ cancelled = true;
29572
+ };
29573
+ }, []);
29574
+ const billingPageUrl = billingUrl || (0, import_dashboard_url4.buildDashboardUrl)({
29575
+ baseUrl: dashboardUrl || "https://use.runtype.com",
29576
+ path: "/settings/billing",
29577
+ account
29578
+ });
29332
29579
  function showFlash(msg) {
29333
29580
  setClipboardFlash(msg);
29334
29581
  if (flashTimeout.current) clearTimeout(flashTimeout.current);
29335
29582
  flashTimeout.current = setTimeout(() => setClipboardFlash(null), 2e3);
29336
29583
  }
29337
- const agentPageUrl = agentId && dashboardUrl ? `${dashboardUrl.replace(/\/$/, "")}/agents/${agentId}` : null;
29584
+ const agentPageUrl = agentId && dashboardUrl ? (0, import_dashboard_url4.buildDashboardUrl)({
29585
+ baseUrl: dashboardUrl,
29586
+ path: `/agents/${agentId}`,
29587
+ account
29588
+ }) : null;
29338
29589
  const handleCopySession = useCallback8(() => {
29339
29590
  setShowSessionMenu(false);
29340
29591
  try {
@@ -36908,6 +37159,7 @@ import open5 from "open";
36908
37159
  import { execFileSync } from "child_process";
36909
37160
 
36910
37161
  // src/lib/persona-init.ts
37162
+ var import_dashboard_url5 = __toESM(require_dashboard_url(), 1);
36911
37163
  init_credential_store();
36912
37164
 
36913
37165
  // src/lib/persona-snippets.ts
@@ -37071,7 +37323,12 @@ async function runPersonaInit(options) {
37071
37323
  personaFormat
37072
37324
  );
37073
37325
  const dashboardBase = getDashboardUrl();
37074
- const dashboardUrl = `${dashboardBase}/agents/${agent.id}`;
37326
+ const account = await getCurrentAccountId();
37327
+ const dashboardUrl = (0, import_dashboard_url5.buildDashboardUrl)({
37328
+ baseUrl: dashboardBase,
37329
+ path: `/agents/${agent.id}`,
37330
+ account
37331
+ });
37075
37332
  return {
37076
37333
  status: "created",
37077
37334
  agent: { id: agent.id, name: agent.name },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/cli",
3
- "version": "2.10.9",
3
+ "version": "2.11.0",
4
4
  "description": "Command-line interface for Runtype AI platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "micromatch": "^4.0.8",
24
24
  "yaml": "^2.8.3",
25
25
  "@runtypelabs/ink-components": "0.3.1",
26
- "@runtypelabs/sdk": "1.16.0",
26
+ "@runtypelabs/sdk": "1.17.0",
27
27
  "@runtypelabs/terminal-animations": "0.2.0"
28
28
  },
29
29
  "devDependencies": {
@@ -37,7 +37,7 @@
37
37
  "tsx": "^4.7.1",
38
38
  "typescript": "^5.3.3",
39
39
  "vitest": "^4.0.18",
40
- "@runtypelabs/shared": "1.4.3"
40
+ "@runtypelabs/shared": "1.5.0"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=18.0.0"