@runtypelabs/cli 2.10.9 → 2.11.1

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 +379 -38
  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
  },
@@ -19617,12 +19803,17 @@ var require_fpo_schema = __commonJS({
19617
19803
  var setupInstructionsSchema = zod_1.z.object({
19618
19804
  summary: zod_1.z.string().min(1),
19619
19805
  steps: zod_1.z.array(zod_1.z.string()),
19620
- docsUrl: zod_1.z.string().optional()
19806
+ // Constrained to an absolute URL because this lands in the rendered
19807
+ // `<a href={…}>` in the secret intake and quick-start preview UIs —
19808
+ // `javascript:` / `data:` schemes in an unrestricted string would be a
19809
+ // live XSS vector when a malicious template is imported.
19810
+ docsUrl: zod_1.z.string().url().optional()
19621
19811
  });
19622
19812
  var toolAuthSchema = zod_1.z.object({
19623
19813
  type: zod_1.z.enum(["oauth", "api_key", "none", "user_provided"]),
19624
19814
  setupRequired: zod_1.z.boolean(),
19625
- secrets: zod_1.z.array(secretSchema),
19815
+ // Each secret drives a DB write via materializeSecretBindings at assembly time.
19816
+ secrets: zod_1.z.array(secretSchema).max(20),
19626
19817
  setupInstructions: setupInstructionsSchema
19627
19818
  });
19628
19819
  exports.toolSchema = zod_1.z.object({
@@ -19692,9 +19883,9 @@ var require_fpo_schema = __commonJS({
19692
19883
  icon: zod_1.z.string().optional(),
19693
19884
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional()
19694
19885
  }),
19695
- capabilities: zod_1.z.array(exports.capabilitySchema),
19696
- tools: zod_1.z.array(exports.toolSchema),
19697
- surfaces: zod_1.z.array(exports.surfaceSchema),
19886
+ capabilities: zod_1.z.array(exports.capabilitySchema).max(50),
19887
+ tools: zod_1.z.array(exports.toolSchema).max(100),
19888
+ surfaces: zod_1.z.array(exports.surfaceSchema).max(50),
19698
19889
  _meta: metaSchema
19699
19890
  }).superRefine((fpo, ctx) => {
19700
19891
  const capIds = /* @__PURE__ */ new Set();
@@ -19886,12 +20077,59 @@ var require_capability_validator = __commonJS({
19886
20077
  }
19887
20078
  });
19888
20079
 
20080
+ // ../shared/dist/product-generation/secret-ref.js
20081
+ var require_secret_ref = __commonJS({
20082
+ "../shared/dist/product-generation/secret-ref.js"(exports) {
20083
+ "use strict";
20084
+ Object.defineProperty(exports, "__esModule", { value: true });
20085
+ exports.extractSecretReferences = extractSecretReferences;
20086
+ exports.extractSecretReferencesFromAnyValue = extractSecretReferencesFromAnyValue;
20087
+ var SECRET_REF_PATTERN = /\{\{secret:([A-Z][A-Z0-9_]*[A-Z0-9])\}\}/g;
20088
+ function extractSecretReferences(template) {
20089
+ const keys = /* @__PURE__ */ new Set();
20090
+ let match;
20091
+ const regex = new RegExp(SECRET_REF_PATTERN.source, "g");
20092
+ while ((match = regex.exec(template)) !== null) {
20093
+ const key = match[1];
20094
+ if (key)
20095
+ keys.add(key);
20096
+ }
20097
+ return Array.from(keys);
20098
+ }
20099
+ function extractSecretReferencesFromAnyValue(value, maxDepth = 10) {
20100
+ const keys = /* @__PURE__ */ new Set();
20101
+ walk(value, 0);
20102
+ return Array.from(keys);
20103
+ function walk(v, depth) {
20104
+ if (depth > maxDepth)
20105
+ return;
20106
+ if (typeof v === "string") {
20107
+ for (const key of extractSecretReferences(v))
20108
+ keys.add(key);
20109
+ return;
20110
+ }
20111
+ if (Array.isArray(v)) {
20112
+ for (const item of v)
20113
+ walk(item, depth + 1);
20114
+ return;
20115
+ }
20116
+ if (v && typeof v === "object") {
20117
+ for (const inner of Object.values(v)) {
20118
+ walk(inner, depth + 1);
20119
+ }
20120
+ }
20121
+ }
20122
+ }
20123
+ }
20124
+ });
20125
+
19889
20126
  // ../shared/dist/product-generation/validators/tool-validator.js
19890
20127
  var require_tool_validator = __commonJS({
19891
20128
  "../shared/dist/product-generation/validators/tool-validator.js"(exports) {
19892
20129
  "use strict";
19893
20130
  Object.defineProperty(exports, "__esModule", { value: true });
19894
20131
  exports.validateToolDefinition = validateToolDefinition;
20132
+ var secret_ref_1 = require_secret_ref();
19895
20133
  var types_1 = require_types2();
19896
20134
  function validateToolDefinition(tool, index) {
19897
20135
  const result = (0, types_1.emptyResult)();
@@ -19903,13 +20141,30 @@ var require_tool_validator = __commonJS({
19903
20141
  result.errors.push((0, types_1.createIssue)("error", "INTEGRATION_NO_PROVIDER", "Integration tools must have a provider", `${base}.provider`));
19904
20142
  }
19905
20143
  if (tool.auth) {
20144
+ const declaredKeys = /* @__PURE__ */ new Set();
19906
20145
  if (tool.auth.secrets) {
19907
20146
  for (const [i, secret] of tool.auth.secrets.entries()) {
19908
20147
  if (!secret.key || secret.key.trim() === "") {
19909
20148
  result.errors.push((0, types_1.createIssue)("error", "SECRET_KEY_EMPTY", "Secret key is required", `${base}.auth.secrets[${i}].key`));
20149
+ continue;
19910
20150
  }
20151
+ declaredKeys.add(secret.key);
19911
20152
  }
19912
20153
  }
20154
+ const referencedKeys = new Set((0, secret_ref_1.extractSecretReferencesFromAnyValue)(tool.config));
20155
+ for (const key of referencedKeys) {
20156
+ if (!declaredKeys.has(key)) {
20157
+ result.errors.push((0, types_1.createIssue)("error", "SECRET_REFERENCE_UNDECLARED", `Tool config references \`{{secret:${key}}}\` but this tool does not declare it in \`auth.secrets\`.`, `${base}.auth.secrets`, `Add \`{ key: '${key}', required: true }\` to this tool's \`auth.secrets\`.`));
20158
+ }
20159
+ }
20160
+ for (const key of declaredKeys) {
20161
+ if (!referencedKeys.has(key)) {
20162
+ result.warnings.push((0, types_1.createIssue)("warning", "SECRET_DECLARED_BUT_UNREFERENCED", `Secret \`${key}\` is declared in \`auth.secrets\` but never referenced as \`{{secret:${key}}}\` in this tool's config.`, `${base}.auth.secrets`, `Either reference \`{{secret:${key}}}\` in the tool config or remove it from \`auth.secrets\`. Integrations that consume secrets outside the config (e.g. MCP servers) can ignore this warning.`));
20163
+ }
20164
+ }
20165
+ if (declaredKeys.size > 0 && tool.auth.setupRequired === false) {
20166
+ result.recommendations.push((0, types_1.createIssue)("recommendation", "SETUP_REQUIRED_IMPLIED", `Tool declares ${declaredKeys.size} secret(s) in \`auth.secrets\` but \`auth.setupRequired\` is false \u2014 pending secrets will not be surfaced in the intake flow.`, `${base}.auth.setupRequired`, "Set `auth.setupRequired: true` so these secrets are materialized as pending bindings and shown to the user after import."));
20167
+ }
19913
20168
  }
19914
20169
  result.valid = result.errors.length === 0;
19915
20170
  return result;
@@ -20134,8 +20389,21 @@ var require_fpo_template = __commonJS({
20134
20389
  version: zod_1.z.literal(exports.FULL_PRODUCT_OBJECT_TEMPLATE_VERSION),
20135
20390
  productObject: fpo_schema_1.fullProductObjectSchema,
20136
20391
  template: zod_1.z.object({
20137
- variables: zod_1.z.array(exports.fpoTemplateVariableSchema).min(1, "Template must declare at least one variable")
20392
+ variables: zod_1.z.array(exports.fpoTemplateVariableSchema).max(50)
20138
20393
  })
20394
+ }).superRefine((doc, ctx) => {
20395
+ const hasVariables = doc.template.variables.length > 0;
20396
+ const hasPendingSecretTool = doc.productObject.tools.some((tool) => {
20397
+ var _a, _b;
20398
+ return ((_a = tool.auth) === null || _a === void 0 ? void 0 : _a.setupRequired) === true && Array.isArray((_b = tool.auth) === null || _b === void 0 ? void 0 : _b.secrets) && tool.auth.secrets.length > 0;
20399
+ });
20400
+ if (!hasVariables && !hasPendingSecretTool) {
20401
+ ctx.addIssue({
20402
+ code: "custom",
20403
+ message: "Template must declare at least one template variable or at least one tool with `auth.setupRequired: true` and pending secrets.",
20404
+ path: ["template", "variables"]
20405
+ });
20406
+ }
20139
20407
  });
20140
20408
  function collectStringLeafPaths(value, path14 = []) {
20141
20409
  if (typeof value === "string") {
@@ -20165,7 +20433,7 @@ var require_fpo_template = __commonJS({
20165
20433
  const inner = value.slice(start + 2, end);
20166
20434
  const separatorIndex = inner.indexOf("|");
20167
20435
  const key = (separatorIndex === -1 ? inner : inner.slice(0, separatorIndex)).trim();
20168
- if (key.length > 0) {
20436
+ if (key.length > 0 && !key.startsWith("secret:")) {
20169
20437
  references.push({
20170
20438
  key,
20171
20439
  defaultValue: separatorIndex === -1 ? void 0 : inner.slice(separatorIndex + 1).trim(),
@@ -20347,6 +20615,9 @@ var require_fpo_template = __commonJS({
20347
20615
  if (!referencedKeys.has(variable.key)) {
20348
20616
  result.warnings.push((0, types_1.createIssue)("warning", "UNUSED_TEMPLATE_VARIABLE", `Template variable "${variable.key}" is declared but not used`, `template.variables.${variable.key}`));
20349
20617
  }
20618
+ if (variable.inputType === "secret") {
20619
+ result.warnings.push((0, types_1.createIssue)("warning", "TEMPLATE_VARIABLE_SECRET_IS_UNSAFE", `Template variable "${variable.key}" uses \`inputType: 'secret'\`, which substitutes the supplied value literally into the product record at resolve time \u2014 the value ends up persisted in the database.`, `template.variables.${variable.key}.inputType`, `Prefer declaring pending secrets via the target tool's \`auth.secrets\` array and referencing the value as \`{{secret:${variable.key.toUpperCase()}}}\` so the secret is stored in the secrets vault instead of in the product object.`));
20620
+ }
20350
20621
  }
20351
20622
  const defaultsResolution = (_a = options.defaultsResolution) !== null && _a !== void 0 ? _a : resolveFPOTemplate(template);
20352
20623
  const defaultsValidation = (0, types_1.mergeResults)((0, fpo_validator_1.validateFPO)(defaultsResolution.resolved), defaultsResolution.missingVariables.length > 0 ? {
@@ -22960,12 +23231,29 @@ configCommand.command("path").description("Show configuration file path").action
22960
23231
  });
22961
23232
 
22962
23233
  // src/commands/products.ts
23234
+ var import_dashboard_url2 = __toESM(require_dashboard_url(), 1);
22963
23235
  import { Command as Command7 } from "commander";
22964
23236
  import chalk9 from "chalk";
22965
23237
  import React6 from "react";
22966
23238
  import { render as render6 } from "ink";
22967
23239
  import { useState as useState7, useEffect as useEffect8 } from "react";
22968
23240
  import open2 from "open";
23241
+
23242
+ // src/lib/account-context.ts
23243
+ var import_dashboard_url = __toESM(require_dashboard_url(), 1);
23244
+ init_credential_store();
23245
+ async function getCurrentAccountId() {
23246
+ try {
23247
+ const store = new CredentialStore();
23248
+ const creds = await store.getCredentials();
23249
+ if (!creds) return void 0;
23250
+ return (0, import_dashboard_url.selectAccountId)({ userId: creds.userId, organizationId: creds.orgId });
23251
+ } catch {
23252
+ return void 0;
23253
+ }
23254
+ }
23255
+
23256
+ // src/commands/products.ts
22969
23257
  function displayAgentCard(agentCard) {
22970
23258
  console.log(chalk9.cyan("\nAgent Details:"));
22971
23259
  console.log(` Name: ${agentCard.name}`);
@@ -23006,8 +23294,13 @@ async function createProduct(apiKey, templateId, agentCard, sourceUrl, productNa
23006
23294
  }
23007
23295
  return response.json();
23008
23296
  }
23009
- function displayCreationSuccess(result, agentCard, dashboardBaseUrl, jsonOutput) {
23010
- const productUrl = `${dashboardBaseUrl}/products/${result.product.id}?launch=true`;
23297
+ function displayCreationSuccess(result, agentCard, dashboardBaseUrl, jsonOutput, account) {
23298
+ const productUrl = (0, import_dashboard_url2.buildDashboardUrl)({
23299
+ baseUrl: dashboardBaseUrl,
23300
+ path: `/products/${result.product.id}`,
23301
+ account,
23302
+ searchParams: { launch: "true" }
23303
+ });
23011
23304
  if (jsonOutput) {
23012
23305
  console.log(
23013
23306
  JSON.stringify(
@@ -23129,7 +23422,14 @@ productsCommand.command("init").description("Initialize a product from an extern
23129
23422
  }
23130
23423
  process.exit(1);
23131
23424
  }
23132
- displayCreationSuccess(createResult, result.agentCard, getDashboardUrl(), isJsonMode);
23425
+ const account = await getCurrentAccountId();
23426
+ displayCreationSuccess(
23427
+ createResult,
23428
+ result.agentCard,
23429
+ getDashboardUrl(),
23430
+ isJsonMode,
23431
+ account
23432
+ );
23133
23433
  } catch (error) {
23134
23434
  const message = error instanceof Error ? error.message : "Unknown error";
23135
23435
  console.error(chalk9.red(`Failed: ${message}`));
@@ -23195,6 +23495,7 @@ productsCommand.command("init").description("Initialize a product from an extern
23195
23495
  return;
23196
23496
  }
23197
23497
  const dashboardUrl = getDashboardUrl();
23498
+ const account = await getCurrentAccountId();
23198
23499
  setResultNode(
23199
23500
  React6.createElement(EntityCard, {
23200
23501
  fields: [
@@ -23202,7 +23503,11 @@ productsCommand.command("init").description("Initialize a product from an extern
23202
23503
  { label: "Name", value: createResult.product.name },
23203
23504
  {
23204
23505
  label: "Dashboard",
23205
- value: `${dashboardUrl}/products/${createResult.product.id}`
23506
+ value: (0, import_dashboard_url2.buildDashboardUrl)({
23507
+ baseUrl: dashboardUrl,
23508
+ path: `/products/${createResult.product.id}`,
23509
+ account
23510
+ })
23206
23511
  }
23207
23512
  ]
23208
23513
  })
@@ -23266,6 +23571,7 @@ import React7 from "react";
23266
23571
  import { render as render7 } from "ink";
23267
23572
 
23268
23573
  // src/ink/init/InitApp.tsx
23574
+ var import_dashboard_url3 = __toESM(require_dashboard_url(), 1);
23269
23575
  init_credential_store();
23270
23576
  import { useState as useState8, useEffect as useEffect9, useCallback } from "react";
23271
23577
  import { Box as Box6, Text as Text7, useApp as useApp3, useInput as useInput4 } from "ink";
@@ -23336,7 +23642,8 @@ function InitApp({ apiUrl, onComplete }) {
23336
23642
  loading: true,
23337
23643
  loadingLabel: "Checking credentials...",
23338
23644
  complete: false,
23339
- createdProductId: null
23645
+ createdProductId: null,
23646
+ account: void 0
23340
23647
  });
23341
23648
  const getSummary = useCallback(() => {
23342
23649
  const answers = [];
@@ -23370,9 +23677,14 @@ function InitApp({ apiUrl, onComplete }) {
23370
23677
  apiUrl
23371
23678
  );
23372
23679
  if (isValid) {
23680
+ const existingCreds = await store.getCredentials();
23373
23681
  setState((prev) => ({
23374
23682
  ...prev,
23375
23683
  apiKey: existingKey,
23684
+ account: (0, import_dashboard_url3.selectAccountId)({
23685
+ userId: existingCreds?.userId,
23686
+ organizationId: existingCreds?.orgId
23687
+ }),
23376
23688
  step: 2,
23377
23689
  loading: false
23378
23690
  }));
@@ -23411,6 +23723,7 @@ function InitApp({ apiUrl, onComplete }) {
23411
23723
  setState((s) => ({
23412
23724
  ...s,
23413
23725
  apiKey: key,
23726
+ account: (0, import_dashboard_url3.selectAccountId)({ userId, organizationId: orgId }),
23414
23727
  step: 2,
23415
23728
  loading: false
23416
23729
  }));
@@ -23792,6 +24105,11 @@ function InitApp({ apiUrl, onComplete }) {
23792
24105
  }
23793
24106
  if (state.step === 7) {
23794
24107
  const dashboardUrl = getDashboardUrl();
24108
+ const productDashboardUrl = state.createdProductId ? (0, import_dashboard_url3.buildDashboardUrl)({
24109
+ baseUrl: dashboardUrl,
24110
+ path: `/products/${state.createdProductId}`,
24111
+ account: state.account
24112
+ }) : "";
23795
24113
  return /* @__PURE__ */ jsxs7(Box6, { flexDirection: "column", children: [
23796
24114
  state.createdProductId ? /* @__PURE__ */ jsxs7(Box6, { flexDirection: "column", children: [
23797
24115
  /* @__PURE__ */ jsxs7(Text7, { color: theme7.success, bold: true, children: [
@@ -23807,9 +24125,7 @@ function InitApp({ apiUrl, onComplete }) {
23807
24125
  " ",
23808
24126
  "Dashboard:",
23809
24127
  " ",
23810
- dashboardUrl,
23811
- "/products/",
23812
- state.createdProductId
24128
+ productDashboardUrl
23813
24129
  ] })
23814
24130
  ] }) : /* @__PURE__ */ jsxs7(Text7, { color: theme7.success, bold: true, children: [
23815
24131
  "\u2713",
@@ -24194,6 +24510,7 @@ import { render as render9 } from "ink";
24194
24510
  import React9 from "react";
24195
24511
 
24196
24512
  // src/ink/marathon/MarathonApp.tsx
24513
+ var import_dashboard_url4 = __toESM(require_dashboard_url(), 1);
24197
24514
  import { useState as useState22, useEffect as useEffect19, useRef as useRef9, useCallback as useCallback8, useMemo as useMemo11 } from "react";
24198
24515
  import { execSync } from "child_process";
24199
24516
  import * as fs4 from "fs";
@@ -29328,13 +29645,31 @@ function MarathonApp({
29328
29645
  const [upgradeModalDismissed, setUpgradeModalDismissed] = useState22(false);
29329
29646
  const [clipboardFlash, setClipboardFlash] = useState22(null);
29330
29647
  const flashTimeout = useRef9(null);
29331
- const billingPageUrl = billingUrl || `${(dashboardUrl || "https://use.runtype.com").replace(/\/$/, "")}/settings/billing`;
29648
+ const [account, setAccount] = useState22(void 0);
29649
+ useEffect19(() => {
29650
+ let cancelled = false;
29651
+ getCurrentAccountId().then((id) => {
29652
+ if (!cancelled) setAccount(id);
29653
+ });
29654
+ return () => {
29655
+ cancelled = true;
29656
+ };
29657
+ }, []);
29658
+ const billingPageUrl = billingUrl || (0, import_dashboard_url4.buildDashboardUrl)({
29659
+ baseUrl: dashboardUrl || "https://use.runtype.com",
29660
+ path: "/settings/billing",
29661
+ account
29662
+ });
29332
29663
  function showFlash(msg) {
29333
29664
  setClipboardFlash(msg);
29334
29665
  if (flashTimeout.current) clearTimeout(flashTimeout.current);
29335
29666
  flashTimeout.current = setTimeout(() => setClipboardFlash(null), 2e3);
29336
29667
  }
29337
- const agentPageUrl = agentId && dashboardUrl ? `${dashboardUrl.replace(/\/$/, "")}/agents/${agentId}` : null;
29668
+ const agentPageUrl = agentId && dashboardUrl ? (0, import_dashboard_url4.buildDashboardUrl)({
29669
+ baseUrl: dashboardUrl,
29670
+ path: `/agents/${agentId}`,
29671
+ account
29672
+ }) : null;
29338
29673
  const handleCopySession = useCallback8(() => {
29339
29674
  setShowSessionMenu(false);
29340
29675
  try {
@@ -36908,6 +37243,7 @@ import open5 from "open";
36908
37243
  import { execFileSync } from "child_process";
36909
37244
 
36910
37245
  // src/lib/persona-init.ts
37246
+ var import_dashboard_url5 = __toESM(require_dashboard_url(), 1);
36911
37247
  init_credential_store();
36912
37248
 
36913
37249
  // src/lib/persona-snippets.ts
@@ -37071,7 +37407,12 @@ async function runPersonaInit(options) {
37071
37407
  personaFormat
37072
37408
  );
37073
37409
  const dashboardBase = getDashboardUrl();
37074
- const dashboardUrl = `${dashboardBase}/agents/${agent.id}`;
37410
+ const account = await getCurrentAccountId();
37411
+ const dashboardUrl = (0, import_dashboard_url5.buildDashboardUrl)({
37412
+ baseUrl: dashboardBase,
37413
+ path: `/agents/${agent.id}`,
37414
+ account
37415
+ });
37075
37416
  return {
37076
37417
  status: "created",
37077
37418
  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.1",
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.1",
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"