@runtypelabs/cli 2.16.7 → 2.16.8

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 +378 -0
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -544,6 +544,363 @@ import { RuntypeApiError } from "@runtypelabs/sdk";
544
544
  // src/lib/sdk-client.ts
545
545
  import { createClient } from "@runtypelabs/sdk";
546
546
 
547
+ // ../shared/dist/chunk-MYXAZOFG.mjs
548
+ var travrseConfig = {
549
+ name: "Travrse",
550
+ nameLower: "travrse",
551
+ tagline: "AI ambition, meet reality",
552
+ description: "Fast-track AI implementation for every team. API for developers, dashboard for business users. From idea to production in minutes, with or without code.",
553
+ url: "https://www.travrse.ai",
554
+ website: "https://travrse.ai",
555
+ domain: "travrse.ai",
556
+ npmScope: "@travrse",
557
+ cliCommand: "travrse",
558
+ githubOrg: "travrse-io",
559
+ legalEntity: "Travrse Labs, Inc",
560
+ support: {
561
+ email: "support@travrse.ai"
562
+ },
563
+ dashboardUrl: "https://run.travrse.ai",
564
+ apiUrl: "https://api.travrse.ai",
565
+ docsUrl: "https://docs.travrse.ai"
566
+ };
567
+ var runtypeConfig = {
568
+ name: "Runtype",
569
+ nameLower: "runtype",
570
+ tagline: "Your AI Product Platform",
571
+ description: "Build and deploy AI experiences faster than ever. Powerful API for developers, intuitive dashboard for teams.",
572
+ url: "https://www.runtype.com",
573
+ website: "https://runtype.com",
574
+ domain: "runtype.com",
575
+ npmScope: "@runtypelabs",
576
+ cliCommand: "runtype",
577
+ githubOrg: "runtypelabs",
578
+ legalEntity: "Travrse Labs, Inc",
579
+ support: {
580
+ email: "support@runtype.com"
581
+ },
582
+ dashboardUrl: "https://use.runtype.com",
583
+ apiUrl: "https://api.runtype.com",
584
+ docsUrl: "https://docs.runtype.com"
585
+ };
586
+ var BRAND_CONFIGS = {
587
+ travrse: travrseConfig,
588
+ runtype: runtypeConfig
589
+ // Add more brand configs here:
590
+ // mybrand: myBrandConfig,
591
+ };
592
+ var DEFAULT_BRAND_NAME = "runtype";
593
+ function loadBrandConfig(env) {
594
+ let configName = DEFAULT_BRAND_NAME;
595
+ try {
596
+ if (env) {
597
+ configName = env.NEXT_PUBLIC_BRAND_CONFIG_NAME || env.BRAND_CONFIG_NAME || DEFAULT_BRAND_NAME;
598
+ } else {
599
+ configName = process.env.NEXT_PUBLIC_BRAND_CONFIG_NAME || process.env.BRAND_CONFIG_NAME || DEFAULT_BRAND_NAME;
600
+ }
601
+ } catch (error51) {
602
+ configName = DEFAULT_BRAND_NAME;
603
+ }
604
+ const config3 = BRAND_CONFIGS[configName];
605
+ if (!config3) {
606
+ if (process.env.NODE_ENV !== "production") {
607
+ console.warn(
608
+ `Brand config "${configName}" not found. Available configs: ${Object.keys(BRAND_CONFIGS).join(", ")}. Falling back to "${DEFAULT_BRAND_NAME}".`
609
+ );
610
+ }
611
+ return BRAND_CONFIGS[DEFAULT_BRAND_NAME];
612
+ }
613
+ return config3;
614
+ }
615
+ var BRAND = loadBrandConfig();
616
+ var DEFAULT_BRAND_CONFIG = BRAND_CONFIGS[DEFAULT_BRAND_NAME];
617
+
618
+ // ../shared/dist/chunk-3BMGMHHD.mjs
619
+ function getNestedValue(obj, path16) {
620
+ let normalizedPath = path16;
621
+ normalizedPath = normalizedPath.replace(/^\$\.?/, "");
622
+ normalizedPath = normalizedPath.replace(/\[(\d+)\]/g, ".$1");
623
+ normalizedPath = normalizedPath.replace(/\[['"]([^'"\]]+)['"]\]/g, ".$1");
624
+ normalizedPath = normalizedPath.replace(/\[([^'"\]]+)\]/g, ".$1");
625
+ normalizedPath = normalizedPath.replace(/^\./, "");
626
+ const keys = normalizedPath.split(".");
627
+ let current = obj;
628
+ for (let i = 0; i < keys.length; i++) {
629
+ const key = keys[i];
630
+ if (current === null || current === void 0 || key === void 0) {
631
+ return void 0;
632
+ }
633
+ if (Array.isArray(current)) {
634
+ if (/^\d+$/.test(key)) {
635
+ const index = parseInt(key, 10);
636
+ if (index >= 0 && index < current.length) {
637
+ current = current[index];
638
+ } else {
639
+ return void 0;
640
+ }
641
+ } else {
642
+ return void 0;
643
+ }
644
+ } else if (current && typeof current === "object") {
645
+ if (DANGEROUS_KEYS.has(key)) return void 0;
646
+ current = current[key];
647
+ } else {
648
+ return void 0;
649
+ }
650
+ }
651
+ return current;
652
+ }
653
+ var DANGEROUS_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
654
+ var TEMPLATE_EXPRESSION_PATTERN = /\{\{([^{}]+)\}\}/g;
655
+ function parseTemplateExpression(expr) {
656
+ const tokens = tokenizeFallbackExpression(expr);
657
+ if (tokens) {
658
+ return {
659
+ kind: "fallback",
660
+ operator: tokens.operator,
661
+ operands: tokens.rawOperands.map(parseOperand)
662
+ };
663
+ }
664
+ const trimmed = expr.trim();
665
+ const pipeIndex = trimmed.indexOf("|");
666
+ if (pipeIndex === -1) {
667
+ return { kind: "legacy", variable: trimmed };
668
+ }
669
+ return {
670
+ kind: "legacy",
671
+ variable: trimmed.slice(0, pipeIndex).trim(),
672
+ defaultValue: trimmed.slice(pipeIndex + 1).trim()
673
+ };
674
+ }
675
+ function tokenizeFallbackExpression(expr) {
676
+ const operands = [];
677
+ let current = "";
678
+ let quote = null;
679
+ let operator = null;
680
+ for (let i = 0; i < expr.length; i++) {
681
+ const ch = expr[i];
682
+ if (quote) {
683
+ current += ch;
684
+ if (ch === quote && countTrailingBackslashes(expr, i) % 2 === 0) {
685
+ quote = null;
686
+ }
687
+ continue;
688
+ }
689
+ if (ch === '"' || ch === "'") {
690
+ quote = ch;
691
+ current += ch;
692
+ continue;
693
+ }
694
+ if (ch === "|" && expr[i + 1] === "|") {
695
+ if (operator === "??") {
696
+ throw new Error(
697
+ `Cannot mix '||' and '??' in template expression: "${expr}". Use one operator or wrap branches in separate {{...}} blocks.`
698
+ );
699
+ }
700
+ operator = "||";
701
+ operands.push(current);
702
+ current = "";
703
+ i++;
704
+ continue;
705
+ }
706
+ if (ch === "?" && expr[i + 1] === "?") {
707
+ if (operator === "||") {
708
+ throw new Error(
709
+ `Cannot mix '||' and '??' in template expression: "${expr}". Use one operator or wrap branches in separate {{...}} blocks.`
710
+ );
711
+ }
712
+ operator = "??";
713
+ operands.push(current);
714
+ current = "";
715
+ i++;
716
+ continue;
717
+ }
718
+ current += ch;
719
+ }
720
+ if (operator === null) return null;
721
+ operands.push(current);
722
+ return { rawOperands: operands, operator };
723
+ }
724
+ function parseOperand(raw) {
725
+ const t = raw.trim();
726
+ if (t.startsWith('"') && t.endsWith('"') && t.length >= 2 || t.startsWith("'") && t.endsWith("'") && t.length >= 2) {
727
+ const inner = t.slice(1, -1);
728
+ return { kind: "literal", value: inner.replace(/\\(.)/g, "$1") };
729
+ }
730
+ if (/^-?\d+(\.\d+)?$/.test(t)) {
731
+ return { kind: "literal", value: Number(t) };
732
+ }
733
+ if (t === "true") return { kind: "literal", value: true };
734
+ if (t === "false") return { kind: "literal", value: false };
735
+ if (t === "null") return { kind: "literal", value: null };
736
+ return { kind: "path", path: t };
737
+ }
738
+ function evaluateOperand(operand, context) {
739
+ if (operand.kind === "literal") return operand.value;
740
+ return getNestedValue(context, operand.path);
741
+ }
742
+ function countTrailingBackslashes(s, i) {
743
+ let n = 0;
744
+ let j = i - 1;
745
+ while (j >= 0 && s[j] === "\\") {
746
+ n++;
747
+ j--;
748
+ }
749
+ return n;
750
+ }
751
+ function passesOperator(value, operator) {
752
+ if (operator === "||") return Boolean(value);
753
+ return value !== null && value !== void 0;
754
+ }
755
+ function stringifyValue(value) {
756
+ if (value === null || value === void 0) return "";
757
+ if (typeof value === "object") return JSON.stringify(value);
758
+ return String(value);
759
+ }
760
+ var _SimpleTemplateEngine = class _SimpleTemplateEngine2 {
761
+ substitute(template, context = {}) {
762
+ const usedVariables = [];
763
+ const usedDefaults = [];
764
+ const missingVariables = [];
765
+ const result = template.replace(_SimpleTemplateEngine2.EXPRESSION_PATTERN, (match, expr) => {
766
+ let parsed;
767
+ try {
768
+ parsed = parseTemplateExpression(expr);
769
+ } catch {
770
+ return match;
771
+ }
772
+ if (parsed.kind === "legacy") {
773
+ return resolveLegacy(parsed, context, {
774
+ usedVariables,
775
+ usedDefaults,
776
+ missingVariables,
777
+ match
778
+ });
779
+ }
780
+ return resolveFallback(parsed, context, {
781
+ usedVariables,
782
+ missingVariables,
783
+ match
784
+ });
785
+ });
786
+ return {
787
+ result,
788
+ usedVariables,
789
+ usedDefaults,
790
+ missingVariables
791
+ };
792
+ }
793
+ /**
794
+ * Extract all variable references from a template.
795
+ * Each `{{ ... }}` produces one entry; for fallback expressions the entry
796
+ * carries every path operand under `paths`, and `hasDefault: true` whenever
797
+ * the chain has any non-path terminal (literal) the user can fall back to.
798
+ */
799
+ extractVariables(template) {
800
+ const out = [];
801
+ const pattern = new RegExp(_SimpleTemplateEngine2.EXPRESSION_PATTERN.source, "g");
802
+ let match;
803
+ while (match = pattern.exec(template)) {
804
+ const expr = match[1];
805
+ if (!expr) continue;
806
+ let parsed;
807
+ try {
808
+ parsed = parseTemplateExpression(expr);
809
+ } catch {
810
+ continue;
811
+ }
812
+ if (parsed.kind === "legacy") {
813
+ if (!parsed.variable) continue;
814
+ out.push({
815
+ variable: parsed.variable,
816
+ hasDefault: parsed.defaultValue !== void 0,
817
+ defaultValue: parsed.defaultValue
818
+ });
819
+ continue;
820
+ }
821
+ const paths = parsed.operands.filter((o) => o.kind === "path").map((o) => o.path);
822
+ const hasLiteralFallback = parsed.operands.some((o) => o.kind === "literal");
823
+ const primary = paths[0] ?? "";
824
+ out.push({
825
+ variable: primary,
826
+ hasDefault: hasLiteralFallback,
827
+ paths
828
+ });
829
+ }
830
+ return out;
831
+ }
832
+ /**
833
+ * Validate that a template can be processed with given context.
834
+ * Returns warnings and errors.
835
+ */
836
+ validate(template, context = {}) {
837
+ const warnings = [];
838
+ const errors = [];
839
+ try {
840
+ const result = this.substitute(template, context);
841
+ if (result.usedDefaults.length > 0) {
842
+ warnings.push(
843
+ `Used ${result.usedDefaults.length} default values: ${result.usedDefaults.map((d) => d.variable).join(", ")}`
844
+ );
845
+ }
846
+ if (result.missingVariables.length > 0) {
847
+ errors.push(`Missing variables without defaults: ${result.missingVariables.join(", ")}`);
848
+ }
849
+ return {
850
+ isValid: errors.length === 0,
851
+ warnings,
852
+ errors
853
+ };
854
+ } catch (error51) {
855
+ return {
856
+ isValid: false,
857
+ warnings,
858
+ errors: [`Template parsing error: ${error51}`]
859
+ };
860
+ }
861
+ }
862
+ };
863
+ _SimpleTemplateEngine.EXPRESSION_PATTERN = TEMPLATE_EXPRESSION_PATTERN;
864
+ var SimpleTemplateEngine = _SimpleTemplateEngine;
865
+ function resolveLegacy(parsed, context, tracking) {
866
+ const value = getNestedValue(context, parsed.variable);
867
+ if (value !== void 0 && value !== null) {
868
+ tracking.usedVariables.push(parsed.variable);
869
+ return stringifyValue(value);
870
+ }
871
+ if (parsed.defaultValue !== void 0) {
872
+ tracking.usedDefaults.push({
873
+ variable: parsed.variable,
874
+ defaultValue: parsed.defaultValue
875
+ });
876
+ return parsed.defaultValue;
877
+ }
878
+ tracking.missingVariables.push(parsed.variable);
879
+ return tracking.match;
880
+ }
881
+ function resolveFallback(parsed, context, tracking) {
882
+ let chosen = null;
883
+ for (const operand of parsed.operands) {
884
+ const value = evaluateOperand(operand, context);
885
+ if (operand.kind === "path" && value !== void 0) {
886
+ tracking.usedVariables.push(operand.path);
887
+ }
888
+ if (chosen === null && passesOperator(value, parsed.operator)) {
889
+ chosen = { value, isPath: operand.kind === "path" };
890
+ }
891
+ }
892
+ if (chosen) return stringifyValue(chosen.value);
893
+ const last = parsed.operands[parsed.operands.length - 1];
894
+ if (last && last.kind === "literal") {
895
+ return stringifyValue(last.value);
896
+ }
897
+ for (const operand of parsed.operands) {
898
+ if (operand.kind === "path") tracking.missingVariables.push(operand.path);
899
+ }
900
+ return tracking.match;
901
+ }
902
+ var templateEngine = new SimpleTemplateEngine();
903
+
547
904
  // ../../node_modules/.pnpm/zod@4.4.2/node_modules/zod/v4/classic/external.js
548
905
  var external_exports = {};
549
906
  __export(external_exports, {
@@ -17069,6 +17426,15 @@ var PROVIDER_SECRET_SPECS = [
17069
17426
  matches: (m) => m.startsWith("generic-openai/") || m.startsWith("generic-openai:"),
17070
17427
  secretNames: ["GENERIC_OPENAI_API_KEY", "GENERIC_OPENAI_BASE_URL"]
17071
17428
  },
17429
+ {
17430
+ providerId: "general-compute",
17431
+ // General Compute (https://api.generalcompute.com/v1) is an OpenAI-compatible
17432
+ // host. Models are addressed only with the explicit `general-compute/` prefix
17433
+ // (e.g. `general-compute/minimax-m2.7`) so they never collide with the same
17434
+ // bare model id served by another gateway (Vercel already routes `minimax-m2.7`).
17435
+ matches: (m) => m.startsWith("general-compute/") || m.startsWith("general-compute:"),
17436
+ secretNames: ["GENERAL_COMPUTE_API_KEY"]
17437
+ },
17072
17438
  {
17073
17439
  providerId: "workers-ai",
17074
17440
  // Uses a CF platform binding, not a secret — secretNames is intentionally empty.
@@ -32786,6 +33152,8 @@ var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
32786
33152
  // Mixlayer models
32787
33153
  { provider: "runtype", modelId: "qwen/qwen3.5-9b", isDefault: true },
32788
33154
  { provider: "runtype", modelId: "qwen3.5-plus", isDefault: false },
33155
+ // General Compute (platform key) - explicit provider prefix, single-provider model
33156
+ { provider: "runtype", modelId: "general-compute/minimax-m2.7", isDefault: false },
32789
33157
  // Routed models - benefit from automatic provider optimization
32790
33158
  // OpenAI models (routed via OpenAI direct, with Vercel fallback)
32791
33159
  { provider: "runtype", modelId: "gpt-5.4", isDefault: false },
@@ -34061,6 +34429,7 @@ var PLATFORM_KEY_PROVIDER_MAP = {
34061
34429
  "vertex-anthropic": false,
34062
34430
  "tinfoil": false,
34063
34431
  "generic-openai": false,
34432
+ "general-compute": true,
34064
34433
  "workers-ai": false,
34065
34434
  "mock": false
34066
34435
  };
@@ -34104,6 +34473,15 @@ var MANUAL_PROVIDER_MAP_OVERRIDES = {
34104
34473
  },
34105
34474
  "gpt-oss-120b": {
34106
34475
  "workers-ai": "@cf/openai/gpt-oss-120b"
34476
+ },
34477
+ // MiniMax M2.7: explicit provider IDs for the GC-primary / Vercel-fallback route.
34478
+ // `general-compute` is NOT in PROVIDERS_WITHOUT_PREFIX, so resolveRoutedFamily
34479
+ // prepends `general-compute/` itself — store the BARE id here to avoid a double
34480
+ // prefix (`general-compute/general-compute/...`). Vercel IS prefixless, so its
34481
+ // value is the gateway-form `minimax/minimax-m2.7` used as-is.
34482
+ "minimax-m2.7": {
34483
+ "general-compute": "minimax-m2.7",
34484
+ "vercel": "minimax/minimax-m2.7"
34107
34485
  }
34108
34486
  };
34109
34487
  var BASE_MODEL_PROVIDER_MAP = (() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/cli",
3
- "version": "2.16.7",
3
+ "version": "2.16.8",
4
4
  "description": "Command-line interface for Runtype AI platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "rosie-skills": "0.8.1",
23
23
  "yaml": "^2.9.0",
24
24
  "@runtypelabs/ink-components": "0.3.2",
25
- "@runtypelabs/sdk": "4.1.0",
25
+ "@runtypelabs/sdk": "4.2.0",
26
26
  "@runtypelabs/terminal-animations": "0.2.1"
27
27
  },
28
28
  "devDependencies": {
@@ -36,7 +36,7 @@
36
36
  "tsx": "^4.7.1",
37
37
  "typescript": "^5.3.3",
38
38
  "vitest": "^4.1.0",
39
- "@runtypelabs/shared": "1.12.0"
39
+ "@runtypelabs/shared": "1.13.2"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=22.0.0"