@runtypelabs/cli 2.32.2 → 2.32.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +518 -229
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -619,6 +619,141 @@ import { RuntypeApiError } from "@runtypelabs/sdk";
|
|
|
619
619
|
// src/lib/sdk-client.ts
|
|
620
620
|
import { createClient } from "@runtypelabs/sdk";
|
|
621
621
|
|
|
622
|
+
// ../shared/dist/chunk-R7RM64AL.mjs
|
|
623
|
+
var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
|
|
624
|
+
// Mixlayer models
|
|
625
|
+
{
|
|
626
|
+
provider: "runtype",
|
|
627
|
+
modelId: "qwen/qwen3.6-27b",
|
|
628
|
+
isDefault: false,
|
|
629
|
+
strengths: "Fast, low-cost open-weight workhorse with reasoning, tool-use, and vision \u2014 good for high-volume extraction, classification, and simple transforms.",
|
|
630
|
+
bestFor: ["fast-cheap", "vision"]
|
|
631
|
+
},
|
|
632
|
+
// Routed models - benefit from automatic provider optimization
|
|
633
|
+
// OpenAI models (routed via OpenAI direct, with Vercel fallback)
|
|
634
|
+
{
|
|
635
|
+
provider: "runtype",
|
|
636
|
+
modelId: "gpt-5.5",
|
|
637
|
+
isDefault: false,
|
|
638
|
+
strengths: "Top-tier general reasoning and tool-use with excellent structured-output reliability, vision, and a 1M context \u2014 a strong pick for complex, correctness-sensitive steps.",
|
|
639
|
+
bestFor: ["default", "deep-reasoning", "agentic-tools", "vision", "long-context"]
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
provider: "runtype",
|
|
643
|
+
modelId: "gpt-5.4-mini",
|
|
644
|
+
isDefault: false,
|
|
645
|
+
strengths: "Fast and affordable with dependable JSON formatting \u2014 a good fit for mid-complexity task steps.",
|
|
646
|
+
bestFor: ["fast-cheap", "default"]
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
provider: "runtype",
|
|
650
|
+
modelId: "gpt-5.4-nano",
|
|
651
|
+
isDefault: false,
|
|
652
|
+
strengths: "Cheapest and fastest GPT-5 tier \u2014 reserve for trivial deterministic transforms, routing, and classification, not complex authoring.",
|
|
653
|
+
bestFor: ["fast-cheap"]
|
|
654
|
+
},
|
|
655
|
+
// Anthropic models (routed via Anthropic direct, with Vertex/Bedrock fallback)
|
|
656
|
+
{
|
|
657
|
+
provider: "runtype",
|
|
658
|
+
modelId: "claude-haiku-4-5",
|
|
659
|
+
isDefault: false,
|
|
660
|
+
strengths: "Fast and inexpensive while retaining real reasoning, tool-use, and vision \u2014 great for high-volume task steps that still need some judgment.",
|
|
661
|
+
bestFor: ["fast-cheap", "agentic-tools", "vision"]
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
provider: "runtype",
|
|
665
|
+
modelId: "claude-sonnet-5",
|
|
666
|
+
isDefault: false,
|
|
667
|
+
strengths: "Balanced all-rounder: strong reasoning, very reliable multi-round tool loops, vision, and a 1M context \u2014 an excellent choice for agentic and structured work.",
|
|
668
|
+
bestFor: ["default", "agentic-tools", "vision", "long-context"]
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
provider: "runtype",
|
|
672
|
+
modelId: "claude-opus-4-8",
|
|
673
|
+
isDefault: false,
|
|
674
|
+
strengths: "Deepest reasoning and planning for hard analysis and multi-constraint synthesis, with vision and a 1M context \u2014 premium-priced, so reserve for genuinely difficult steps.",
|
|
675
|
+
bestFor: ["deep-reasoning", "vision", "long-context"]
|
|
676
|
+
},
|
|
677
|
+
// Google models (routed via Google direct, with Vertex/Vercel fallback)
|
|
678
|
+
{
|
|
679
|
+
provider: "runtype",
|
|
680
|
+
modelId: "gemini-3-1-flash-lite",
|
|
681
|
+
isDefault: false,
|
|
682
|
+
strengths: "Very fast and very cheap with full multimodal input (vision and audio), good structured output, and a 1M context \u2014 ideal for high-volume, simple steps.",
|
|
683
|
+
bestFor: ["fast-cheap", "vision", "long-context"]
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
provider: "runtype",
|
|
687
|
+
modelId: "gemini-3.6-flash",
|
|
688
|
+
isDefault: false,
|
|
689
|
+
strengths: "Fast, low-cost, and natively multimodal with good reasoning, tool-use, and a 1M context \u2014 a strong choice for vision and high-throughput steps.",
|
|
690
|
+
bestFor: ["default", "vision", "fast-cheap", "agentic-tools", "long-context"]
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
provider: "runtype",
|
|
694
|
+
modelId: "gemini-3-1-flash-image",
|
|
695
|
+
isDefault: false,
|
|
696
|
+
strengths: "Specialised for image generation and editing (image output) \u2014 use for steps that produce images, not text reasoning.",
|
|
697
|
+
bestFor: ["image-generation"]
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
provider: "runtype",
|
|
701
|
+
modelId: "gemini-3.1-pro",
|
|
702
|
+
isDefault: false,
|
|
703
|
+
strengths: "Google's frontier tier: strong reasoning, a 1M context, and multimodal input \u2014 for complex analytical or long-document steps.",
|
|
704
|
+
bestFor: ["deep-reasoning", "vision", "long-context"]
|
|
705
|
+
},
|
|
706
|
+
// Inception models (routed via Vercel)
|
|
707
|
+
{
|
|
708
|
+
provider: "runtype",
|
|
709
|
+
modelId: "mercury-2",
|
|
710
|
+
isDefault: false,
|
|
711
|
+
strengths: "Diffusion-based LLM optimised for very low latency \u2014 good when speed matters more than deep reasoning.",
|
|
712
|
+
bestFor: ["fast-cheap"]
|
|
713
|
+
},
|
|
714
|
+
// Moonshot models (routed via Vercel)
|
|
715
|
+
// Kimi K2.6 is the default model: a reasoning + tool-use + vision model
|
|
716
|
+
// already trusted as the product-generator default.
|
|
717
|
+
{
|
|
718
|
+
provider: "runtype",
|
|
719
|
+
modelId: "kimi-k2.6",
|
|
720
|
+
isDefault: true,
|
|
721
|
+
strengths: "Capable open agentic model with reasoning, tool-use, and vision at strong value \u2014 the current account default and a dependable general workhorse.",
|
|
722
|
+
bestFor: ["default", "agentic-tools", "vision"]
|
|
723
|
+
},
|
|
724
|
+
// NVIDIA Nemotron Ultra (reasoning + tool-use flagship, routed via Vercel)
|
|
725
|
+
{
|
|
726
|
+
provider: "runtype",
|
|
727
|
+
modelId: "nemotron-3-ultra-550b-a55b",
|
|
728
|
+
isDefault: false,
|
|
729
|
+
strengths: "Large open-weight reasoning and tool-use flagship with a 1M context at a low price \u2014 strong analytical depth where an open model is preferred.",
|
|
730
|
+
bestFor: ["deep-reasoning", "agentic-tools", "long-context"]
|
|
731
|
+
},
|
|
732
|
+
// Google models (routed via Cloudflare Workers AI)
|
|
733
|
+
{
|
|
734
|
+
provider: "runtype",
|
|
735
|
+
modelId: "gemma-4-26b-a4b-it",
|
|
736
|
+
isDefault: false,
|
|
737
|
+
strengths: "Lightweight open-weight instruct model served free on Workers AI \u2014 fine for straightforward general tasks at zero cost.",
|
|
738
|
+
bestFor: ["fast-cheap"]
|
|
739
|
+
},
|
|
740
|
+
// Z.ai GLM-5.2 (agentic coding flagship, routed via Cloudflare Workers AI,
|
|
741
|
+
// Vercel fallback). The bare routed name resolves to `@cf/zai-org/glm-5.2`.
|
|
742
|
+
{
|
|
743
|
+
provider: "runtype",
|
|
744
|
+
modelId: "glm-5.2",
|
|
745
|
+
isDefault: false,
|
|
746
|
+
strengths: "Agentic flagship \u2014 best-in-class at long, multi-round tool-call loops and coding/agent workflows, with a 1M context; well suited to tool-heavy agent steps.",
|
|
747
|
+
bestFor: ["agentic-tools", "default", "deep-reasoning", "long-context"]
|
|
748
|
+
}
|
|
749
|
+
];
|
|
750
|
+
var DEFAULT_MODEL_ID = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.find((m2) => m2.isDefault)?.modelId ?? "kimi-k2.6";
|
|
751
|
+
function renderDefaultModelStrengthsGuide() {
|
|
752
|
+
return DEFAULT_MODELS_FOR_NEW_ACCOUNTS.map(
|
|
753
|
+
(m2) => `- \`${m2.modelId}\`${m2.isDefault ? " (account default)" : ""} \u2014 ${m2.strengths}`
|
|
754
|
+
).join("\n");
|
|
755
|
+
}
|
|
756
|
+
|
|
622
757
|
// ../shared/dist/chunk-72QEJTK5.mjs
|
|
623
758
|
var travrseConfig = {
|
|
624
759
|
name: "Travrse",
|
|
@@ -15260,141 +15395,6 @@ var edgeContextPayloadSchema = external_exports.object({
|
|
|
15260
15395
|
// ../shared/dist/chunk-SCJRL6LP.mjs
|
|
15261
15396
|
var MAX_DURABLE_POLL_ATTEMPTS = 1e3;
|
|
15262
15397
|
|
|
15263
|
-
// ../shared/dist/chunk-R7RM64AL.mjs
|
|
15264
|
-
var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
|
|
15265
|
-
// Mixlayer models
|
|
15266
|
-
{
|
|
15267
|
-
provider: "runtype",
|
|
15268
|
-
modelId: "qwen/qwen3.6-27b",
|
|
15269
|
-
isDefault: false,
|
|
15270
|
-
strengths: "Fast, low-cost open-weight workhorse with reasoning, tool-use, and vision \u2014 good for high-volume extraction, classification, and simple transforms.",
|
|
15271
|
-
bestFor: ["fast-cheap", "vision"]
|
|
15272
|
-
},
|
|
15273
|
-
// Routed models - benefit from automatic provider optimization
|
|
15274
|
-
// OpenAI models (routed via OpenAI direct, with Vercel fallback)
|
|
15275
|
-
{
|
|
15276
|
-
provider: "runtype",
|
|
15277
|
-
modelId: "gpt-5.5",
|
|
15278
|
-
isDefault: false,
|
|
15279
|
-
strengths: "Top-tier general reasoning and tool-use with excellent structured-output reliability, vision, and a 1M context \u2014 a strong pick for complex, correctness-sensitive steps.",
|
|
15280
|
-
bestFor: ["default", "deep-reasoning", "agentic-tools", "vision", "long-context"]
|
|
15281
|
-
},
|
|
15282
|
-
{
|
|
15283
|
-
provider: "runtype",
|
|
15284
|
-
modelId: "gpt-5.4-mini",
|
|
15285
|
-
isDefault: false,
|
|
15286
|
-
strengths: "Fast and affordable with dependable JSON formatting \u2014 a good fit for mid-complexity task steps.",
|
|
15287
|
-
bestFor: ["fast-cheap", "default"]
|
|
15288
|
-
},
|
|
15289
|
-
{
|
|
15290
|
-
provider: "runtype",
|
|
15291
|
-
modelId: "gpt-5.4-nano",
|
|
15292
|
-
isDefault: false,
|
|
15293
|
-
strengths: "Cheapest and fastest GPT-5 tier \u2014 reserve for trivial deterministic transforms, routing, and classification, not complex authoring.",
|
|
15294
|
-
bestFor: ["fast-cheap"]
|
|
15295
|
-
},
|
|
15296
|
-
// Anthropic models (routed via Anthropic direct, with Vertex/Bedrock fallback)
|
|
15297
|
-
{
|
|
15298
|
-
provider: "runtype",
|
|
15299
|
-
modelId: "claude-haiku-4-5",
|
|
15300
|
-
isDefault: false,
|
|
15301
|
-
strengths: "Fast and inexpensive while retaining real reasoning, tool-use, and vision \u2014 great for high-volume task steps that still need some judgment.",
|
|
15302
|
-
bestFor: ["fast-cheap", "agentic-tools", "vision"]
|
|
15303
|
-
},
|
|
15304
|
-
{
|
|
15305
|
-
provider: "runtype",
|
|
15306
|
-
modelId: "claude-sonnet-5",
|
|
15307
|
-
isDefault: false,
|
|
15308
|
-
strengths: "Balanced all-rounder: strong reasoning, very reliable multi-round tool loops, vision, and a 1M context \u2014 an excellent choice for agentic and structured work.",
|
|
15309
|
-
bestFor: ["default", "agentic-tools", "vision", "long-context"]
|
|
15310
|
-
},
|
|
15311
|
-
{
|
|
15312
|
-
provider: "runtype",
|
|
15313
|
-
modelId: "claude-opus-4-8",
|
|
15314
|
-
isDefault: false,
|
|
15315
|
-
strengths: "Deepest reasoning and planning for hard analysis and multi-constraint synthesis, with vision and a 1M context \u2014 premium-priced, so reserve for genuinely difficult steps.",
|
|
15316
|
-
bestFor: ["deep-reasoning", "vision", "long-context"]
|
|
15317
|
-
},
|
|
15318
|
-
// Google models (routed via Google direct, with Vertex/Vercel fallback)
|
|
15319
|
-
{
|
|
15320
|
-
provider: "runtype",
|
|
15321
|
-
modelId: "gemini-3-1-flash-lite",
|
|
15322
|
-
isDefault: false,
|
|
15323
|
-
strengths: "Very fast and very cheap with full multimodal input (vision and audio), good structured output, and a 1M context \u2014 ideal for high-volume, simple steps.",
|
|
15324
|
-
bestFor: ["fast-cheap", "vision", "long-context"]
|
|
15325
|
-
},
|
|
15326
|
-
{
|
|
15327
|
-
provider: "runtype",
|
|
15328
|
-
modelId: "gemini-3.6-flash",
|
|
15329
|
-
isDefault: false,
|
|
15330
|
-
strengths: "Fast, low-cost, and natively multimodal with good reasoning, tool-use, and a 1M context \u2014 a strong choice for vision and high-throughput steps.",
|
|
15331
|
-
bestFor: ["default", "vision", "fast-cheap", "agentic-tools", "long-context"]
|
|
15332
|
-
},
|
|
15333
|
-
{
|
|
15334
|
-
provider: "runtype",
|
|
15335
|
-
modelId: "gemini-3-1-flash-image",
|
|
15336
|
-
isDefault: false,
|
|
15337
|
-
strengths: "Specialised for image generation and editing (image output) \u2014 use for steps that produce images, not text reasoning.",
|
|
15338
|
-
bestFor: ["image-generation"]
|
|
15339
|
-
},
|
|
15340
|
-
{
|
|
15341
|
-
provider: "runtype",
|
|
15342
|
-
modelId: "gemini-3.1-pro",
|
|
15343
|
-
isDefault: false,
|
|
15344
|
-
strengths: "Google's frontier tier: strong reasoning, a 1M context, and multimodal input \u2014 for complex analytical or long-document steps.",
|
|
15345
|
-
bestFor: ["deep-reasoning", "vision", "long-context"]
|
|
15346
|
-
},
|
|
15347
|
-
// Inception models (routed via Vercel)
|
|
15348
|
-
{
|
|
15349
|
-
provider: "runtype",
|
|
15350
|
-
modelId: "mercury-2",
|
|
15351
|
-
isDefault: false,
|
|
15352
|
-
strengths: "Diffusion-based LLM optimised for very low latency \u2014 good when speed matters more than deep reasoning.",
|
|
15353
|
-
bestFor: ["fast-cheap"]
|
|
15354
|
-
},
|
|
15355
|
-
// Moonshot models (routed via Vercel)
|
|
15356
|
-
// Kimi K2.6 is the default model: a reasoning + tool-use + vision model
|
|
15357
|
-
// already trusted as the product-generator default.
|
|
15358
|
-
{
|
|
15359
|
-
provider: "runtype",
|
|
15360
|
-
modelId: "kimi-k2.6",
|
|
15361
|
-
isDefault: true,
|
|
15362
|
-
strengths: "Capable open agentic model with reasoning, tool-use, and vision at strong value \u2014 the current account default and a dependable general workhorse.",
|
|
15363
|
-
bestFor: ["default", "agentic-tools", "vision"]
|
|
15364
|
-
},
|
|
15365
|
-
// NVIDIA Nemotron Ultra (reasoning + tool-use flagship, routed via Vercel)
|
|
15366
|
-
{
|
|
15367
|
-
provider: "runtype",
|
|
15368
|
-
modelId: "nemotron-3-ultra-550b-a55b",
|
|
15369
|
-
isDefault: false,
|
|
15370
|
-
strengths: "Large open-weight reasoning and tool-use flagship with a 1M context at a low price \u2014 strong analytical depth where an open model is preferred.",
|
|
15371
|
-
bestFor: ["deep-reasoning", "agentic-tools", "long-context"]
|
|
15372
|
-
},
|
|
15373
|
-
// Google models (routed via Cloudflare Workers AI)
|
|
15374
|
-
{
|
|
15375
|
-
provider: "runtype",
|
|
15376
|
-
modelId: "gemma-4-26b-a4b-it",
|
|
15377
|
-
isDefault: false,
|
|
15378
|
-
strengths: "Lightweight open-weight instruct model served free on Workers AI \u2014 fine for straightforward general tasks at zero cost.",
|
|
15379
|
-
bestFor: ["fast-cheap"]
|
|
15380
|
-
},
|
|
15381
|
-
// Z.ai GLM-5.2 (agentic coding flagship, routed via Cloudflare Workers AI,
|
|
15382
|
-
// Vercel fallback). The bare routed name resolves to `@cf/zai-org/glm-5.2`.
|
|
15383
|
-
{
|
|
15384
|
-
provider: "runtype",
|
|
15385
|
-
modelId: "glm-5.2",
|
|
15386
|
-
isDefault: false,
|
|
15387
|
-
strengths: "Agentic flagship \u2014 best-in-class at long, multi-round tool-call loops and coding/agent workflows, with a 1M context; well suited to tool-heavy agent steps.",
|
|
15388
|
-
bestFor: ["agentic-tools", "default", "deep-reasoning", "long-context"]
|
|
15389
|
-
}
|
|
15390
|
-
];
|
|
15391
|
-
var DEFAULT_MODEL_ID = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.find((m2) => m2.isDefault)?.modelId ?? "kimi-k2.6";
|
|
15392
|
-
function renderDefaultModelStrengthsGuide() {
|
|
15393
|
-
return DEFAULT_MODELS_FOR_NEW_ACCOUNTS.map(
|
|
15394
|
-
(m2) => `- \`${m2.modelId}\`${m2.isDefault ? " (account default)" : ""} \u2014 ${m2.strengths}`
|
|
15395
|
-
).join("\n");
|
|
15396
|
-
}
|
|
15397
|
-
|
|
15398
15398
|
// ../shared/dist/chunk-UB6BK3TZ.mjs
|
|
15399
15399
|
function getNestedValue(obj, path20) {
|
|
15400
15400
|
let normalizedPath = path20;
|
|
@@ -15786,7 +15786,7 @@ function resolveFallback(parsed, context, tracking, options = {}) {
|
|
|
15786
15786
|
}
|
|
15787
15787
|
var templateEngine = new SimpleTemplateEngine();
|
|
15788
15788
|
|
|
15789
|
-
// ../shared/dist/chunk-
|
|
15789
|
+
// ../shared/dist/chunk-MN4NECP7.mjs
|
|
15790
15790
|
var tokensSchema = external_exports.object({ input: external_exports.number(), output: external_exports.number() });
|
|
15791
15791
|
var wireStopReasonSchema = external_exports.enum([
|
|
15792
15792
|
"end_turn",
|
|
@@ -16412,6 +16412,7 @@ var agentToolStartEventSchema = external_exports.object({
|
|
|
16412
16412
|
"local"
|
|
16413
16413
|
]),
|
|
16414
16414
|
parameters: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
16415
|
+
hiddenParameterNames: external_exports.array(external_exports.string()).optional(),
|
|
16415
16416
|
origin: external_exports.enum(["webmcp", "sdk"]).optional(),
|
|
16416
16417
|
pageOrigin: external_exports.string().optional()
|
|
16417
16418
|
});
|
|
@@ -17017,7 +17018,7 @@ var artifactSSEEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
17017
17018
|
]);
|
|
17018
17019
|
var UNIFIED_SSE_EVENT_TYPE_SET = new Set(UNIFIED_SSE_EVENT_TYPES);
|
|
17019
17020
|
|
|
17020
|
-
// ../shared/dist/chunk-
|
|
17021
|
+
// ../shared/dist/chunk-UG3J37K4.mjs
|
|
17021
17022
|
function parseHTMLWithRegex(html) {
|
|
17022
17023
|
if (typeof html !== "string") {
|
|
17023
17024
|
throw new Error("parseHTML: input must be a string");
|
|
@@ -17025,7 +17026,7 @@ function parseHTMLWithRegex(html) {
|
|
|
17025
17026
|
try {
|
|
17026
17027
|
const parser = {
|
|
17027
17028
|
stripTags(value) {
|
|
17028
|
-
return value.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
17029
|
+
return value.replace(/<[^>]*>/g, " ").replace(/<(\/?[a-zA-Z][^>]*)$/, "<$1").replace(/\s+/g, " ").trim();
|
|
17029
17030
|
},
|
|
17030
17031
|
querySelector(selector) {
|
|
17031
17032
|
try {
|
|
@@ -17175,7 +17176,7 @@ function createPortableHelpers(parseHTML) {
|
|
|
17175
17176
|
if (typeof html !== "string") {
|
|
17176
17177
|
return "";
|
|
17177
17178
|
}
|
|
17178
|
-
return html.replace(/<h1[^>]*>(.*?)<\/h1>/gim, "# $1\n\n").replace(/<h2[^>]*>(.*?)<\/h2>/gim, "## $1\n\n").replace(/<h3[^>]*>(.*?)<\/h3>/gim, "### $1\n\n").replace(/<h4[^>]*>(.*?)<\/h4>/gim, "#### $1\n\n").replace(/<h5[^>]*>(.*?)<\/h5>/gim, "##### $1\n\n").replace(/<h6[^>]*>(.*?)<\/h6>/gim, "###### $1\n\n").replace(/<strong[^>]*>(.*?)<\/strong>/gim, "**$1**").replace(/<b[^>]*>(.*?)<\/b>/gim, "**$1**").replace(/<em[^>]*>(.*?)<\/em>/gim, "*$1*").replace(/<i[^>]*>(.*?)<\/i>/gim, "*$1*").replace(/<code[^>]*>(.*?)<\/code>/gim, "`$1`").replace(/<a[^>]*href="([^"]*)"[^>]*>(.*?)<\/a>/gim, "[$2]($1)").replace(/<br[^>]*>/gim, "\n").replace(/<\/p>/gim, "\n\n").replace(/<p[^>]*>/gim, "").replace(/<li[^>]*>(.*?)<\/li>/gim, "- $1\n").replace(/<ul[^>]*>/gim, "\n").replace(/<\/ul>/gim, "\n").replace(/<ol[^>]*>/gim, "\n").replace(/<\/ol>/gim, "\n").replace(/<[^>]
|
|
17179
|
+
return html.replace(/<h1[^>]*>(.*?)<\/h1>/gim, "# $1\n\n").replace(/<h2[^>]*>(.*?)<\/h2>/gim, "## $1\n\n").replace(/<h3[^>]*>(.*?)<\/h3>/gim, "### $1\n\n").replace(/<h4[^>]*>(.*?)<\/h4>/gim, "#### $1\n\n").replace(/<h5[^>]*>(.*?)<\/h5>/gim, "##### $1\n\n").replace(/<h6[^>]*>(.*?)<\/h6>/gim, "###### $1\n\n").replace(/<strong[^>]*>(.*?)<\/strong>/gim, "**$1**").replace(/<b[^>]*>(.*?)<\/b>/gim, "**$1**").replace(/<em[^>]*>(.*?)<\/em>/gim, "*$1*").replace(/<i[^>]*>(.*?)<\/i>/gim, "*$1*").replace(/<code[^>]*>(.*?)<\/code>/gim, "`$1`").replace(/<a[^>]*href="([^"]*)"[^>]*>(.*?)<\/a>/gim, "[$2]($1)").replace(/<br[^>]*>/gim, "\n").replace(/<\/p>/gim, "\n\n").replace(/<p[^>]*>/gim, "").replace(/<li[^>]*>(.*?)<\/li>/gim, "- $1\n").replace(/<ul[^>]*>/gim, "\n").replace(/<\/ul>/gim, "\n").replace(/<ol[^>]*>/gim, "\n").replace(/<\/ol>/gim, "\n").replace(/<[^>]*>/gim, "").replace(/<(\/?[a-zA-Z][^>]*)$/, "<$1").replace(/\n\s*\n\s*\n/gim, "\n\n").trim();
|
|
17179
17180
|
},
|
|
17180
17181
|
/**
|
|
17181
17182
|
* Parse date from various string formats
|
|
@@ -17920,7 +17921,15 @@ function isBuiltInToolId(toolId) {
|
|
|
17920
17921
|
function isPlatformToolId(toolId) {
|
|
17921
17922
|
return toolId.startsWith("platform:");
|
|
17922
17923
|
}
|
|
17923
|
-
var INTEGRATION_SERVER_IDS = /* @__PURE__ */ new Set([
|
|
17924
|
+
var INTEGRATION_SERVER_IDS = /* @__PURE__ */ new Set([
|
|
17925
|
+
"slack",
|
|
17926
|
+
"google",
|
|
17927
|
+
"linear",
|
|
17928
|
+
"github",
|
|
17929
|
+
"telegram",
|
|
17930
|
+
"imessage",
|
|
17931
|
+
"granola"
|
|
17932
|
+
]);
|
|
17924
17933
|
function isBuiltInIntegrationToolId(toolId) {
|
|
17925
17934
|
if (!toolId.startsWith("builtin:")) return false;
|
|
17926
17935
|
const { baseId } = parseToolInstanceId(toolId);
|
|
@@ -22373,6 +22382,8 @@ var AGENT_EXECUTION_STATUSES = [
|
|
|
22373
22382
|
"interrupted"
|
|
22374
22383
|
];
|
|
22375
22384
|
var agentExecutionStatusSchema = external_exports.enum(AGENT_EXECUTION_STATUSES);
|
|
22385
|
+
var DEFAULT_BEDROCK_REGION = "us-east-1";
|
|
22386
|
+
var DEFAULT_VERTEX_LOCATION = "us-central1";
|
|
22376
22387
|
var PROVIDER_SECRET_SPECS = [
|
|
22377
22388
|
{
|
|
22378
22389
|
providerId: "mock",
|
|
@@ -22384,13 +22395,15 @@ var PROVIDER_SECRET_SPECS = [
|
|
|
22384
22395
|
providerId: "google-vertex-anthropic",
|
|
22385
22396
|
// Must come before google-vertex (shares vertex prefix) and anthropic (matches */claude-*).
|
|
22386
22397
|
matches: (m2) => m2.startsWith("vertex-anthropic/"),
|
|
22387
|
-
secretNames: ["GOOGLE_VERTEX_PROJECT", "
|
|
22398
|
+
secretNames: ["GOOGLE_VERTEX_PROJECT", "GOOGLE_VERTEX_CREDENTIALS"],
|
|
22399
|
+
optionalSettings: [{ name: "GOOGLE_VERTEX_LOCATION", defaultValue: DEFAULT_VERTEX_LOCATION }]
|
|
22388
22400
|
},
|
|
22389
22401
|
{
|
|
22390
22402
|
providerId: "google-vertex",
|
|
22391
22403
|
// Must come before google (matches */gemini-*).
|
|
22392
22404
|
matches: (m2) => m2.startsWith("vertex/"),
|
|
22393
|
-
secretNames: ["GOOGLE_VERTEX_PROJECT", "
|
|
22405
|
+
secretNames: ["GOOGLE_VERTEX_PROJECT", "GOOGLE_VERTEX_CREDENTIALS"],
|
|
22406
|
+
optionalSettings: [{ name: "GOOGLE_VERTEX_LOCATION", defaultValue: DEFAULT_VERTEX_LOCATION }]
|
|
22394
22407
|
},
|
|
22395
22408
|
{
|
|
22396
22409
|
providerId: "vercel-gateway",
|
|
@@ -22407,7 +22420,8 @@ var PROVIDER_SECRET_SPECS = [
|
|
|
22407
22420
|
{
|
|
22408
22421
|
providerId: "bedrock",
|
|
22409
22422
|
matches: (m2) => m2.startsWith("bedrock/"),
|
|
22410
|
-
secretNames: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY",
|
|
22423
|
+
secretNames: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"],
|
|
22424
|
+
optionalSettings: [{ name: "AWS_REGION", defaultValue: DEFAULT_BEDROCK_REGION }]
|
|
22411
22425
|
},
|
|
22412
22426
|
{
|
|
22413
22427
|
providerId: "tinfoil",
|
|
@@ -22420,15 +22434,6 @@ var PROVIDER_SECRET_SPECS = [
|
|
|
22420
22434
|
matches: (m2) => m2.startsWith("generic-openai/") || m2.startsWith("generic-openai:"),
|
|
22421
22435
|
secretNames: ["GENERIC_OPENAI_API_KEY", "GENERIC_OPENAI_BASE_URL"]
|
|
22422
22436
|
},
|
|
22423
|
-
{
|
|
22424
|
-
providerId: "general-compute",
|
|
22425
|
-
// General Compute (https://api.generalcompute.com/v1) is an OpenAI-compatible
|
|
22426
|
-
// host. Models are addressed only with the explicit `general-compute/` prefix
|
|
22427
|
-
// (e.g. `general-compute/minimax-m2.7`) so they never collide with the same
|
|
22428
|
-
// bare model id served by another gateway (Vercel already routes `minimax-m2.7`).
|
|
22429
|
-
matches: (m2) => m2.startsWith("general-compute/") || m2.startsWith("general-compute:"),
|
|
22430
|
-
secretNames: ["GENERAL_COMPUTE_API_KEY"]
|
|
22431
|
-
},
|
|
22432
22437
|
{
|
|
22433
22438
|
providerId: "workers-ai",
|
|
22434
22439
|
// Uses a CF platform binding, not a secret — secretNames is intentionally empty.
|
|
@@ -22478,6 +22483,13 @@ function resolveModelSecretNames(model) {
|
|
|
22478
22483
|
}
|
|
22479
22484
|
return [];
|
|
22480
22485
|
}
|
|
22486
|
+
function resolveModelOptionalSettings(model) {
|
|
22487
|
+
const lower = model.toLowerCase();
|
|
22488
|
+
for (const spec of PROVIDER_SECRET_SPECS) {
|
|
22489
|
+
if (spec.matches(lower)) return [...spec.optionalSettings ?? []];
|
|
22490
|
+
}
|
|
22491
|
+
return [];
|
|
22492
|
+
}
|
|
22481
22493
|
var RUNTIME_ARTIFACT_MANIFEST_VERSION = "2026-06-08";
|
|
22482
22494
|
var runtimeArtifactResourceTypeSchema = external_exports.enum(["flow", "agent"]);
|
|
22483
22495
|
var runtimeArtifactEntrypointSchema = external_exports.enum(["flow", "agent"]);
|
|
@@ -22585,6 +22597,77 @@ var runtimeArtifactManifestSchema = external_exports.object({
|
|
|
22585
22597
|
reasons: external_exports.array(runtimeArtifactEligibilityReasonSchema)
|
|
22586
22598
|
})
|
|
22587
22599
|
});
|
|
22600
|
+
var KNOWN_FLOW_STEP_TYPES = new Set(FLOW_STEP_TYPES);
|
|
22601
|
+
var API_INPROCESS_CAPABILITY_MATRIX = {
|
|
22602
|
+
target: "api-inprocess",
|
|
22603
|
+
// Bumped 2026-07-30: the IMPLICIT platform-default fallback candidate no
|
|
22604
|
+
// longer folds (see `implicitPlatformFallback` below). Carries forward
|
|
22605
|
+
// 2026-07-29.4: api-hosted runtime fulfills managed fetch methods through
|
|
22606
|
+
// ManagedFetchExecutor (the managed-fetch fact remains for attribution). The
|
|
22607
|
+
// EXPLICIT Layer-2 fallback fold and the remaining parity-audit folds are
|
|
22608
|
+
// unchanged.
|
|
22609
|
+
version: "2026-07-30.1",
|
|
22610
|
+
unsupportedStepTypes: ["wait-until", "crawl"],
|
|
22611
|
+
unsupportedFeatures: {
|
|
22612
|
+
approvalSteps: true,
|
|
22613
|
+
batchInputMode: true,
|
|
22614
|
+
claudeManagedAgent: true,
|
|
22615
|
+
inexpressibleVectorStep: true,
|
|
22616
|
+
unresolvableAgentRef: true,
|
|
22617
|
+
conditionalNestedPromptStep: true,
|
|
22618
|
+
conditionalNestedExecuteAgentStep: true,
|
|
22619
|
+
// SUPPORTED as of 2026-07-23 (slice 6 activation): the runtime flow lane
|
|
22620
|
+
// now PAUSES on definition-embedded client-executed (local / webmcp) tools
|
|
22621
|
+
// — `ClientToolRequiredError` → `step_await` / `flow_await` → durable KV
|
|
22622
|
+
// ResumeState → the runtime continuation leg — instead of failing the call
|
|
22623
|
+
// in-band. The `hasClientExecutedTools` FACT is still computed (for
|
|
22624
|
+
// decision-attribution logs), but it no longer folds the flow to legacy.
|
|
22625
|
+
// Rollback lever after retiring the flow request override: revert this bit
|
|
22626
|
+
// to `true` (the agent lane retains its separate rollout gate).
|
|
22627
|
+
clientExecutedTools: false,
|
|
22628
|
+
advisorTools: true,
|
|
22629
|
+
// G2 SUPPORTED: api-hosted runtime delegates Firecrawl / Massive fetch-url
|
|
22630
|
+
// methods through ManagedFetchExecutor to the same API implementations the
|
|
22631
|
+
// legacy executor uses. Keep the fact computed for attribution, like
|
|
22632
|
+
// clientExecutedTools above.
|
|
22633
|
+
unsupportedFetchMethod: false,
|
|
22634
|
+
// Remaining 2026-07-29 parity-audit BRIDGE folds (G4/G5/G10/G14): feature
|
|
22635
|
+
// classes the runtime flow lane still cannot faithfully run.
|
|
22636
|
+
transformDataCodeModeTools: true,
|
|
22637
|
+
unsupportedTransformExecution: true,
|
|
22638
|
+
promptMcpServers: true,
|
|
22639
|
+
promptArtifacts: true,
|
|
22640
|
+
// EXPLICIT author-configured Layer-2 chains stay unsupported: the runtime
|
|
22641
|
+
// flow engine cannot run them and cannot synthesize their `usedFallback` /
|
|
22642
|
+
// `fallbackModel` / `fallbackExecutions` attribution, so a folded flow would
|
|
22643
|
+
// both change behavior and undercount fallback usage.
|
|
22644
|
+
fallbackErrorHandling: true,
|
|
22645
|
+
// SUPPORTED as of 2026-07-30: the IMPLICIT platform-default chain (the
|
|
22646
|
+
// orchestrator's synthesized same-model-next-provider + cross-model rungs
|
|
22647
|
+
// for a prompt with NO explicit `errorHandling`) does not fold the flow to
|
|
22648
|
+
// legacy. Rationale: a prompt step without `errorHandling` is the DEFAULT
|
|
22649
|
+
// shape of nearly every hosted flow, so folding on it reverted the hosted
|
|
22650
|
+
// flow lane to legacy for the common case — the opposite of runtime-primary.
|
|
22651
|
+
// The runtime lane already carries Layer-1 resilience natively
|
|
22652
|
+
// (`withModelCallResilience`: TTFT + idle watchdog + bounded same-model
|
|
22653
|
+
// retry — packages/runtime prompt-executor.ts), so the residual delta is
|
|
22654
|
+
// narrow: on a retryable platform-key failure that survives Layer 1 with no
|
|
22655
|
+
// partial output, the runtime surfaces the step error where legacy would
|
|
22656
|
+
// additionally swap upstream/model. That is an availability nicety, not a
|
|
22657
|
+
// semantic difference — and unlike the folds above it cannot silently
|
|
22658
|
+
// produce a WRONG result. `hasImplicitPlatformFallbackCandidate` is still
|
|
22659
|
+
// computed for decision attribution. Rollback lever: flip this bit to `true`
|
|
22660
|
+
// (plus its test) to restore the fold.
|
|
22661
|
+
implicitPlatformFallback: false
|
|
22662
|
+
}
|
|
22663
|
+
};
|
|
22664
|
+
var DURABLE_HOSTED_STEP_TYPES = /* @__PURE__ */ new Set(["wait-until", "crawl"]);
|
|
22665
|
+
var API_DURABLE_RESUME_CAPABILITY_MATRIX = {
|
|
22666
|
+
...API_INPROCESS_CAPABILITY_MATRIX,
|
|
22667
|
+
unsupportedStepTypes: API_INPROCESS_CAPABILITY_MATRIX.unsupportedStepTypes.filter(
|
|
22668
|
+
(stepType) => !DURABLE_HOSTED_STEP_TYPES.has(stepType)
|
|
22669
|
+
)
|
|
22670
|
+
};
|
|
22588
22671
|
var edgeAuthSnapshotSchema = external_exports.object({
|
|
22589
22672
|
/**
|
|
22590
22673
|
* Schema version. A plain positive int (not a literal) so a consumer pinned
|
|
@@ -40006,7 +40089,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
40006
40089
|
"vercel": "xiaomi/mimo-v2.5-pro"
|
|
40007
40090
|
},
|
|
40008
40091
|
"minimax-m2-7": {
|
|
40009
|
-
"general-compute": "general-compute/minimax-m2.7",
|
|
40010
40092
|
"togetherai": "togetherai/MiniMaxAI/MiniMax-M2.7",
|
|
40011
40093
|
"vercel": "minimax/minimax-m2.7"
|
|
40012
40094
|
},
|
|
@@ -40014,7 +40096,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
40014
40096
|
"vercel": "minimax/minimax-m2.7-highspeed"
|
|
40015
40097
|
},
|
|
40016
40098
|
"minimax-m2.7": {
|
|
40017
|
-
"general-compute": "general-compute/minimax-m2.7",
|
|
40018
40099
|
"vercel": "minimax/minimax-m2.7"
|
|
40019
40100
|
},
|
|
40020
40101
|
"minimax-m2.7-highspeed": {
|
|
@@ -40390,7 +40471,6 @@ var PLATFORM_KEY_PROVIDER_MAP = {
|
|
|
40390
40471
|
"vertex-anthropic": false,
|
|
40391
40472
|
"tinfoil": false,
|
|
40392
40473
|
"generic-openai": false,
|
|
40393
|
-
"general-compute": true,
|
|
40394
40474
|
// Keyless platform provider: there is no API key (user or platform) — the
|
|
40395
40475
|
// Cloudflare `AI` binding IS the platform credential. Marking it true makes
|
|
40396
40476
|
// the router's platform-spend gate apply and keeps keySource attribution
|
|
@@ -40464,13 +40544,8 @@ var MANUAL_PROVIDER_MAP_OVERRIDES = {
|
|
|
40464
40544
|
"mixlayer": "z-ai/glm-5.2",
|
|
40465
40545
|
"vercel": "zai/glm-5.2"
|
|
40466
40546
|
},
|
|
40467
|
-
// MiniMax M2.7:
|
|
40468
|
-
// `general-compute` is NOT in PROVIDERS_WITHOUT_PREFIX, so resolveRoutedFamily
|
|
40469
|
-
// prepends `general-compute/` itself — store the BARE id here to avoid a double
|
|
40470
|
-
// prefix (`general-compute/general-compute/...`). Vercel IS prefixless, so its
|
|
40471
|
-
// value is the gateway-form `minimax/minimax-m2.7` used as-is.
|
|
40547
|
+
// MiniMax M2.7: Vercel's gateway-form id.
|
|
40472
40548
|
"minimax-m2.7": {
|
|
40473
|
-
"general-compute": "minimax-m2.7",
|
|
40474
40549
|
"vercel": "minimax/minimax-m2.7"
|
|
40475
40550
|
}
|
|
40476
40551
|
};
|
|
@@ -41388,7 +41463,55 @@ var sandboxConfigSchema = external_exports.object({
|
|
|
41388
41463
|
instanceType: external_exports.enum(["standard-1", "standard-2", "standard-3", "standard-4"]).optional(),
|
|
41389
41464
|
networkAccess: sandboxNetworkAccessSchema.optional(),
|
|
41390
41465
|
ttl: external_exports.enum(["5m", "1h", "24h", "unlimited"]).optional(),
|
|
41391
|
-
sleepAfter: external_exports.enum(["5m", "15m", "30m", "1h"]).optional()
|
|
41466
|
+
sleepAfter: external_exports.enum(["5m", "15m", "30m", "1h"]).optional(),
|
|
41467
|
+
// Operator-authored bootstrap commands. The API runs this batch once after
|
|
41468
|
+
// enforcing the sandbox's network policy and before the first model-authored
|
|
41469
|
+
// sandbox verb. Commands run in order from /workspace and must be foreground,
|
|
41470
|
+
// self-contained, and safe to retry after an interrupted container runtime;
|
|
41471
|
+
// the credential-bearing exec supervisor deliberately reaps every descendant
|
|
41472
|
+
// before a command returns, so setup cannot launch a daemon meant to outlive
|
|
41473
|
+
// it. Trusted Durable Object state plus a run-scoped memo prevents the batch
|
|
41474
|
+
// from being repeated for the same provisioned workspace. Changing the
|
|
41475
|
+
// commands or managed-secret KEY bindings creates a fresh sandbox identity;
|
|
41476
|
+
// rotating a value under the same key does not rerun setup.
|
|
41477
|
+
setupCommands: external_exports.array(external_exports.string().min(1, "setup commands must not be empty")).optional(),
|
|
41478
|
+
// Credential environment available ONLY to the operator-authored setup batch
|
|
41479
|
+
// above — never to a model-authored `bash` command. Keys are env var names;
|
|
41480
|
+
// values are MANAGED SECRET KEYS (e.g. `GITHUB_CLONE_TOKEN`), never raw
|
|
41481
|
+
// credential values. The API resolves them immediately before setup and
|
|
41482
|
+
// delivers them out-of-band over `cloudflareSandboxExecWithSecretEnv`, so the
|
|
41483
|
+
// values never appear in command strings, model-facing tool schemas, logs, or
|
|
41484
|
+
// spill files. Like `networkAccess`, both fields are operator Definition: the
|
|
41485
|
+
// model cannot author setup, name a managed secret, or grant itself one.
|
|
41486
|
+
//
|
|
41487
|
+
// TRUST BOUNDARY — read before configuring this. Every process started by a
|
|
41488
|
+
// credentialed setup batch can read the injected values. Keep setup authored
|
|
41489
|
+
// and reviewed by the operator; do not run model-, attacker-, or
|
|
41490
|
+
// supply-chain-authored code (for example an install script) while credentials
|
|
41491
|
+
// are present, and never persist a raw credential into /workspace for later
|
|
41492
|
+
// model access. The secret supervisor freezes pre-existing processes, reaps
|
|
41493
|
+
// every setup descendant, and destroys the sandbox fail-closed if cleanup
|
|
41494
|
+
// fails, but output redaction remains defense-in-depth rather than permission
|
|
41495
|
+
// to echo or transform a credential.
|
|
41496
|
+
// Therefore:
|
|
41497
|
+
// - Prefer `credentialProxies` (phantom tokens, swapped at the egress
|
|
41498
|
+
// proxy) for any HTTP(S) protocol it supports — the real credential
|
|
41499
|
+
// never enters the container at all.
|
|
41500
|
+
// - Scope the secret as narrowly as the provider allows (read-only,
|
|
41501
|
+
// single-repo) and pair it with a tight `networkAccess` profile.
|
|
41502
|
+
// - Keep credentialed setup separate from later uncredentialed dependency
|
|
41503
|
+
// installation and model-authored work.
|
|
41504
|
+
// Name shape and the 32-entry cap mirror the sandbox worker's
|
|
41505
|
+
// `validateSecretEnv`; `RUNTYPE_SECRET_COMMAND` is the worker's reserved
|
|
41506
|
+
// control-channel variable.
|
|
41507
|
+
secretEnv: external_exports.record(
|
|
41508
|
+
external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "must be a valid environment variable name").refine((name) => name !== "RUNTYPE_SECRET_COMMAND", {
|
|
41509
|
+
message: "RUNTYPE_SECRET_COMMAND is reserved"
|
|
41510
|
+
}),
|
|
41511
|
+
external_exports.string().min(1, "must be a managed secret key")
|
|
41512
|
+
).refine((record2) => Object.keys(record2).length <= 32, {
|
|
41513
|
+
message: "secretEnv supports at most 32 variables"
|
|
41514
|
+
}).optional()
|
|
41392
41515
|
// NOTE: a `requireApprovalForBash` knob was forward-declared here for Phase 3
|
|
41393
41516
|
// but never wired to any runtime gate, so it was REMOVED from the public
|
|
41394
41517
|
// schema rather than ship a misleading, inert control (post-Fable handoff 05,
|
|
@@ -41707,7 +41830,7 @@ var identityProofSchema = external_exports.object({
|
|
|
41707
41830
|
/** The customer-native proof (JWT / opaque session token). */
|
|
41708
41831
|
token: external_exports.string().min(1).max(8192)
|
|
41709
41832
|
}).describe(
|
|
41710
|
-
"Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers).
|
|
41833
|
+
"Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). When Identity Exchange admission is disabled for the caller, the proof is accepted but ignored and confers no trust."
|
|
41711
41834
|
);
|
|
41712
41835
|
function extractSecretReferences(template) {
|
|
41713
41836
|
const keys = /* @__PURE__ */ new Set();
|
|
@@ -44774,6 +44897,27 @@ Only use a \`tool-call\` step when the tool must run deterministically at a fixe
|
|
|
44774
44897
|
- Nullish fallback: \`{{count ?? 0}}\` \u2014 keeps 0 / "" / false (only null/undefined fall through)
|
|
44775
44898
|
- Chains: \`{{a || b || "default"}}\` \u2014 supports paths and string/number/boolean/null literals; do NOT mix \`||\` and \`??\` in one expression
|
|
44776
44899
|
|
|
44900
|
+
### Prompt Caching: Where Large Context Goes
|
|
44901
|
+
|
|
44902
|
+
Runtype caches the request prefix automatically on Claude models. **The part that gets REUSED across runs is the tools + \`systemPrompt\` prefix.** A second boundary is placed at the end of the last message, but a cache hit there needs the whole request \u2014 \`userPrompt\` included \u2014 to repeat byte-for-byte, which per-request task text does not. (Within one request it still helps: a multi-turn or tool-looping step re-sends the grown prompt each round-trip and reads that boundary warm.) This applies to ordinary single-shot \`prompt\` steps, not just multi-turn agents.
|
|
44903
|
+
|
|
44904
|
+
- **Large STABLE context goes in \`systemPrompt\`** \u2014 style guides, voice/tone corpora, exemplars and few-shot examples, JSON schemas, policy documents, canonical reference text. Anything identical from run to run.
|
|
44905
|
+
- **Per-request content goes in \`userPrompt\`** \u2014 the task, the user's input, records retrieved for this run, prior-step outputs. A 25,000-token reference corpus pasted into \`userPrompt\` sits behind per-request text, so it is re-billed as uncached input on every single run.
|
|
44906
|
+
- **Reuse requires a byte-identical prefix.** Two steps share a cache entry only when their tools AND their \`systemPrompt\` strings match exactly. When a flow calls the same role more than once (draft \u2192 review \u2192 redraft, or the same analysis over N items), give those steps the SAME \`systemPrompt\` and put the per-call difference in \`userPrompt\`. Two near-identical system prompts are two cache entries and zero reuse.
|
|
44907
|
+
- **Below the model's minimum, nothing is stamped.** The prefix must exceed the model's minimum cacheable prefix (~1,024 tokens on Sonnet/Opus-class, up to 4,096 on Haiku-class) or the request goes out uncached. Do not contort a short system prompt to chase caching \u2014 this only matters when the stable context is genuinely large or the step runs many times.
|
|
44908
|
+
- **Per-run variables in \`systemPrompt\` kill the prefix.** \`{{_now.*}}\`, \`{{_execution.*}}\`, and \`{{_schedule.*}}\` re-render the system prompt on every execution, so it can never produce a cross-run hit; \`validate_flow\` reports this as \`CACHE_VOLATILE_SYSTEM_PROMPT\` (recommendation). Move the changing value into \`userPrompt\` or a later step. Other variables (\`{{_user.id}}\`, step outputs) do not disable caching, but they fork the cache per distinct substituted value \u2014 keep them out of a prefix you intend several steps or runs to share.
|
|
44909
|
+
|
|
44910
|
+
\`\`\`json
|
|
44911
|
+
// BEFORE \u2014 the corpus rides in userPrompt and is re-sent uncached on every run,
|
|
44912
|
+
// and the two steps have different system prompts, so neither shares a prefix
|
|
44913
|
+
{ "type": "prompt", "name": "Draft", "config": { "model": "claude-opus-5", "systemPrompt": "You are a copywriter.", "userPrompt": "STYLE GUIDE: <25,000 tokens of client style corpus> --- Write a launch email about {{topic}}.", "outputVariable": "draft" } }
|
|
44914
|
+
{ "type": "prompt", "name": "Revise", "config": { "model": "claude-opus-5", "systemPrompt": "You revise copy.", "userPrompt": "STYLE GUIDE: <the same 25,000 tokens again> --- Revise this draft: {{draft}}", "outputVariable": "final" } }
|
|
44915
|
+
|
|
44916
|
+
// AFTER \u2014 one byte-identical prefix; the second step and every later run read it warm
|
|
44917
|
+
{ "type": "prompt", "name": "Draft", "config": { "model": "claude-opus-5", "systemPrompt": "You write and revise copy for this client. STYLE GUIDE: <25,000 tokens of client style corpus>", "userPrompt": "Write a launch email about {{topic}}.", "outputVariable": "draft" } }
|
|
44918
|
+
{ "type": "prompt", "name": "Revise", "config": { "model": "claude-opus-5", "systemPrompt": "You write and revise copy for this client. STYLE GUIDE: <25,000 tokens of client style corpus>", "userPrompt": "Revise this draft: {{draft}}", "outputVariable": "final" } }
|
|
44919
|
+
\`\`\`
|
|
44920
|
+
|
|
44777
44921
|
### Model Selection
|
|
44778
44922
|
|
|
44779
44923
|
Use ONLY routed model IDs from the list below (platform-key compatible). Never
|
|
@@ -45722,7 +45866,7 @@ var InlineClientToolSchema = external_exports.object({
|
|
|
45722
45866
|
var ClientToolsPolicySchema = external_exports.object({
|
|
45723
45867
|
allowlist: external_exports.array(external_exports.string()).optional()
|
|
45724
45868
|
});
|
|
45725
|
-
var
|
|
45869
|
+
var DispatchRequestEnvelopeSchema = external_exports.object({
|
|
45726
45870
|
record: RecordInputSchema.optional(),
|
|
45727
45871
|
flow: FlowInputSchema.optional(),
|
|
45728
45872
|
agent: AgentInputSchema.optional(),
|
|
@@ -45759,7 +45903,9 @@ var DispatchRequestSchema = external_exports.object({
|
|
|
45759
45903
|
* every submitted webmcp tool. See {@link ClientToolsPolicySchema}.
|
|
45760
45904
|
*/
|
|
45761
45905
|
clientToolsPolicy: ClientToolsPolicySchema.optional(),
|
|
45762
|
-
secrets: external_exports.record(external_exports.string(), external_exports.string()).optional()
|
|
45906
|
+
secrets: external_exports.record(external_exports.string(), external_exports.string()).optional().describe(
|
|
45907
|
+
"Per-request credentials for agent/external-tool execution. Ignored when `flow` is the hosted target; FLOW credentials must use managed {{secret:NAME}} references."
|
|
45908
|
+
),
|
|
45763
45909
|
credentialProxies: external_exports.array(credentialProxyConfigSchema).max(10).optional(),
|
|
45764
45910
|
inputs: external_exports.record(external_exports.string(), external_exports.any()).optional().refine(
|
|
45765
45911
|
(data) => {
|
|
@@ -45785,10 +45931,11 @@ var DispatchRequestSchema = external_exports.object({
|
|
|
45785
45931
|
id: external_exports.string().min(1)
|
|
45786
45932
|
}).passthrough().optional(),
|
|
45787
45933
|
// Identity Exchange proof (design §4.1): a customer-native auth token the
|
|
45788
|
-
// broker
|
|
45789
|
-
//
|
|
45790
|
-
//
|
|
45791
|
-
// live credential: never log or persist it (see
|
|
45934
|
+
// broker verifies server-side and admits as `verified` tenant/end-user when
|
|
45935
|
+
// Identity Exchange admission is enabled for the caller. With the rollout
|
|
45936
|
+
// gate disabled it remains accepted-but-ignored and confers no trust. The
|
|
45937
|
+
// token is a live credential: never log or persist it (see
|
|
45938
|
+
// identityProofSchema docs).
|
|
45792
45939
|
identityProof: identityProofSchema.optional(),
|
|
45793
45940
|
options: external_exports.object({
|
|
45794
45941
|
streamResponse: external_exports.boolean().optional().default(true),
|
|
@@ -45800,7 +45947,7 @@ var DispatchRequestSchema = external_exports.object({
|
|
|
45800
45947
|
debugMode: external_exports.boolean().optional().default(false),
|
|
45801
45948
|
loggingPolicy: external_exports.enum(["default", "on", "off"]).optional(),
|
|
45802
45949
|
useRuntimePackage: external_exports.boolean().optional().describe(
|
|
45803
|
-
"
|
|
45950
|
+
"For FLOW dispatches this compatibility field is accepted but ignored: eligible flows always use the @runtypelabs/runtime lane, while ineligible flows still fold to legacy silently. Agent dispatches still require an explicit `true` and remain subject to their separate runtime-agent rollout gate."
|
|
45804
45951
|
),
|
|
45805
45952
|
/** Route prompt model calls through an attached dashboard browser. */
|
|
45806
45953
|
localInference: LocalInferenceSelectionSchema.optional(),
|
|
@@ -45867,20 +46014,23 @@ var DispatchRequestSchema = external_exports.object({
|
|
|
45867
46014
|
storeResults: true,
|
|
45868
46015
|
autoAppendMetadata: false,
|
|
45869
46016
|
debugMode: false,
|
|
45870
|
-
// useRuntimePackage intentionally omitted
|
|
45871
|
-
//
|
|
46017
|
+
// useRuntimePackage intentionally omitted. Flow dispatch ignores the
|
|
46018
|
+
// compatibility field; agent dispatch still requires explicit true.
|
|
45872
46019
|
environment: "development",
|
|
45873
46020
|
createVersion: false
|
|
45874
46021
|
})
|
|
45875
|
-
})
|
|
45876
|
-
|
|
45877
|
-
|
|
46022
|
+
});
|
|
46023
|
+
var DispatchRequestSchema = external_exports.union([
|
|
46024
|
+
DispatchRequestEnvelopeSchema.extend({ flow: FlowInputSchema }),
|
|
46025
|
+
DispatchRequestEnvelopeSchema.extend({ agent: AgentInputSchema })
|
|
46026
|
+
]).superRefine((data, ctx) => {
|
|
45878
46027
|
if (!data.options.localInference) return;
|
|
45879
|
-
|
|
46028
|
+
const runtimeLaneDisabled = data.agent != null && data.options.useRuntimePackage !== true;
|
|
46029
|
+
if (runtimeLaneDisabled) {
|
|
45880
46030
|
ctx.addIssue({
|
|
45881
46031
|
code: "custom",
|
|
45882
46032
|
path: ["options", "useRuntimePackage"],
|
|
45883
|
-
message: "Local inference requires useRuntimePackage to be enabled"
|
|
46033
|
+
message: data.agent != null ? "Local agent inference requires useRuntimePackage to be enabled" : "Local flow inference cannot use the legacy engine"
|
|
45884
46034
|
});
|
|
45885
46035
|
}
|
|
45886
46036
|
if (data.options.modelOverride) {
|
|
@@ -53216,7 +53366,9 @@ import React14 from "react";
|
|
|
53216
53366
|
import { render as render14 } from "ink";
|
|
53217
53367
|
import { useState as useState15, useEffect as useEffect16 } from "react";
|
|
53218
53368
|
import { readFileSync as readFileSync5 } from "fs";
|
|
53219
|
-
import {
|
|
53369
|
+
import {
|
|
53370
|
+
processStream as processStream3
|
|
53371
|
+
} from "@runtypelabs/sdk";
|
|
53220
53372
|
var dispatchCommand = new Command15("dispatch").description("Execute a flow or agent via the dispatch API").option("-f, --flow <id>", "Flow ID to execute").option("-a, --agent <id>", "Agent ID to execute").option("-r, --record <id>", "Existing record ID").option("--record-json <file>", "JSON file with record data").option("-m, --message <text>", "Message to send").option("-v, --variable <key=value>", "Set a variable (repeatable)", collectVariables, []).option("--stream", "Stream the response (default)", true).option("--no-stream", "Wait for complete response").option("--json", "Output as JSON").option("--debug", "Show step-level details").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
|
|
53221
53373
|
if (!options.flow && !options.agent) {
|
|
53222
53374
|
console.error(chalk17.red("Error: Either --flow or --agent is required"));
|
|
@@ -53225,44 +53377,50 @@ var dispatchCommand = new Command15("dispatch").description("Execute a flow or a
|
|
|
53225
53377
|
const apiKey = await ensureAuth();
|
|
53226
53378
|
if (!apiKey) return;
|
|
53227
53379
|
const client = createCliClient(apiKey);
|
|
53228
|
-
|
|
53229
|
-
|
|
53230
|
-
payload
|
|
53380
|
+
let payload;
|
|
53381
|
+
try {
|
|
53382
|
+
payload = buildDispatchRequest(options);
|
|
53383
|
+
} catch (error51) {
|
|
53384
|
+
const message = error51 instanceof Error ? error51.message : "Unknown error";
|
|
53385
|
+
console.error(chalk17.red(`Failed to read record JSON: ${message}`));
|
|
53386
|
+
process.exit(1);
|
|
53387
|
+
}
|
|
53388
|
+
if (options.stream) {
|
|
53389
|
+
await handleStreaming(client, payload, options);
|
|
53390
|
+
} else {
|
|
53391
|
+
await handleNonStreaming(client, payload, options);
|
|
53231
53392
|
}
|
|
53393
|
+
});
|
|
53394
|
+
function collectVariables(value, previous) {
|
|
53395
|
+
return previous.concat([value]);
|
|
53396
|
+
}
|
|
53397
|
+
function buildDispatchRequest(options) {
|
|
53398
|
+
if (!options.flow && !options.agent) {
|
|
53399
|
+
throw new Error("Either --flow or --agent is required");
|
|
53400
|
+
}
|
|
53401
|
+
const payload = options.flow ? { flow: { id: options.flow } } : { agent: { agentId: options.agent } };
|
|
53232
53402
|
if (options.agent) {
|
|
53233
|
-
payload.agent = {
|
|
53403
|
+
payload.agent = { agentId: options.agent };
|
|
53234
53404
|
}
|
|
53235
53405
|
if (options.record) {
|
|
53236
53406
|
payload.record = { id: options.record };
|
|
53237
53407
|
} else if (options.recordJson) {
|
|
53238
|
-
|
|
53239
|
-
|
|
53240
|
-
payload.record = { metadata: data };
|
|
53241
|
-
} catch (error51) {
|
|
53242
|
-
const message = error51 instanceof Error ? error51.message : "Unknown error";
|
|
53243
|
-
console.error(chalk17.red(`Failed to read record JSON: ${message}`));
|
|
53244
|
-
process.exit(1);
|
|
53245
|
-
}
|
|
53408
|
+
const data = JSON.parse(readFileSync5(options.recordJson, "utf-8"));
|
|
53409
|
+
payload.record = { metadata: data };
|
|
53246
53410
|
}
|
|
53247
53411
|
if (options.message) {
|
|
53248
53412
|
payload.messages = [{ role: "user", content: options.message }];
|
|
53249
53413
|
}
|
|
53250
53414
|
if (options.variable && options.variable.length > 0) {
|
|
53251
|
-
const
|
|
53252
|
-
for (const
|
|
53253
|
-
const [key, ...rest] =
|
|
53254
|
-
|
|
53415
|
+
const inputs = {};
|
|
53416
|
+
for (const variable of options.variable) {
|
|
53417
|
+
const [key, ...rest] = variable.split("=");
|
|
53418
|
+
inputs[key] = rest.join("=");
|
|
53255
53419
|
}
|
|
53256
|
-
payload.
|
|
53257
|
-
}
|
|
53258
|
-
if (options.stream) {
|
|
53259
|
-
await handleStreaming(client, payload, options);
|
|
53260
|
-
} else {
|
|
53261
|
-
await handleNonStreaming(client, payload, options);
|
|
53420
|
+
payload.inputs = inputs;
|
|
53262
53421
|
}
|
|
53263
|
-
}
|
|
53264
|
-
|
|
53265
|
-
return previous.concat([value]);
|
|
53422
|
+
payload.options = { streamResponse: options.stream };
|
|
53423
|
+
return payload;
|
|
53266
53424
|
}
|
|
53267
53425
|
async function handleStreaming(client, payload, options) {
|
|
53268
53426
|
console.log(chalk17.gray("Starting execution..."));
|
|
@@ -53316,7 +53474,6 @@ Error: ${err.message}`));
|
|
|
53316
53474
|
async function handleNonStreaming(client, payload, options) {
|
|
53317
53475
|
if (!isTTY(options)) {
|
|
53318
53476
|
try {
|
|
53319
|
-
payload.streamResponse = false;
|
|
53320
53477
|
const result = await client.post("/dispatch", payload);
|
|
53321
53478
|
if (options.json) {
|
|
53322
53479
|
printJson(result);
|
|
@@ -53351,7 +53508,6 @@ async function handleNonStreaming(client, payload, options) {
|
|
|
53351
53508
|
useEffect16(() => {
|
|
53352
53509
|
const run2 = async () => {
|
|
53353
53510
|
try {
|
|
53354
|
-
payload.streamResponse = false;
|
|
53355
53511
|
const result = await client.post("/dispatch", payload);
|
|
53356
53512
|
setLoading(false);
|
|
53357
53513
|
setSuccess(true);
|
|
@@ -68562,8 +68718,8 @@ import { execFileSync } from "child_process";
|
|
|
68562
68718
|
// src/lib/persona-init.ts
|
|
68563
68719
|
init_credential_store();
|
|
68564
68720
|
|
|
68565
|
-
// ../../node_modules/.pnpm/@runtypelabs+persona@4.
|
|
68566
|
-
var w = "4.
|
|
68721
|
+
// ../../node_modules/.pnpm/@runtypelabs+persona@4.14.0/node_modules/@runtypelabs/persona/dist/codegen.js
|
|
68722
|
+
var w = "4.14.0";
|
|
68567
68723
|
var S = w;
|
|
68568
68724
|
function b(e) {
|
|
68569
68725
|
return e?.cdnBase?.trim().replace(/\/+$/, "").replace(/[\\'"<>`]/g, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`) || `https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${S}/dist`;
|
|
@@ -71946,7 +72102,20 @@ echo " npm run build \u2014 compile TypeScript"
|
|
|
71946
72102
|
echo " gcloud run deploy --source . --region us-central1 --allow-unauthenticated --port 8080"
|
|
71947
72103
|
`;
|
|
71948
72104
|
}
|
|
71949
|
-
function
|
|
72105
|
+
function formatOptionalProviderSettings(settings) {
|
|
72106
|
+
return settings.map((setting) => `- \`${setting.name}\` (default: \`${setting.defaultValue}\`)`).join("\n");
|
|
72107
|
+
}
|
|
72108
|
+
function optionalProviderSettingsSection(settings) {
|
|
72109
|
+
if (settings.length === 0) return "";
|
|
72110
|
+
return `
|
|
72111
|
+
## Optional provider settings
|
|
72112
|
+
|
|
72113
|
+
These environment variables override runtime defaults and are not required:
|
|
72114
|
+
|
|
72115
|
+
${formatOptionalProviderSettings(settings)}
|
|
72116
|
+
`;
|
|
72117
|
+
}
|
|
72118
|
+
function readme(agentNames, secretNames, optionalSettings) {
|
|
71950
72119
|
const agentList = agentNames.map((n) => ` - ${n}`).join("\n");
|
|
71951
72120
|
const secretList = secretNames.length > 0 ? secretNames.map((s) => ` gcloud secrets create ${s} --data-file=-`).join("\n") : " (none detected)";
|
|
71952
72121
|
return `# Runtype Deployment
|
|
@@ -71983,6 +72152,8 @@ Set these before deploying to Cloud Run:
|
|
|
71983
72152
|
|
|
71984
72153
|
${secretList}
|
|
71985
72154
|
|
|
72155
|
+
${optionalProviderSettingsSection(optionalSettings)}
|
|
72156
|
+
|
|
71986
72157
|
## Deploy to Cloud Run
|
|
71987
72158
|
|
|
71988
72159
|
\`\`\`bash
|
|
@@ -72280,7 +72451,7 @@ echo " wrangler dev \u2014 preview locally"
|
|
|
72280
72451
|
echo " wrangler deploy \u2014 deploy to Cloudflare Workers"
|
|
72281
72452
|
`;
|
|
72282
72453
|
}
|
|
72283
|
-
function workerReadme(agentNames, secretNames) {
|
|
72454
|
+
function workerReadme(agentNames, secretNames, optionalSettings) {
|
|
72284
72455
|
const agentList = agentNames.map((n) => ` - ${n}`).join("\n");
|
|
72285
72456
|
const secretList = secretNames.length > 0 ? secretNames.map((s) => ` wrangler secret put ${s}`).join("\n") : " (none detected)";
|
|
72286
72457
|
return `# Runtype Cloudflare Workers Deployment
|
|
@@ -72303,6 +72474,8 @@ Set each API key your agents use:
|
|
|
72303
72474
|
${secretList}
|
|
72304
72475
|
\`\`\`
|
|
72305
72476
|
|
|
72477
|
+
${optionalProviderSettingsSection(optionalSettings)}
|
|
72478
|
+
|
|
72306
72479
|
## Run locally
|
|
72307
72480
|
|
|
72308
72481
|
\`\`\`bash
|
|
@@ -72557,7 +72730,7 @@ echo " vercel dev \u2014 preview locally"
|
|
|
72557
72730
|
echo " vercel deploy \u2014 deploy to Vercel Functions"
|
|
72558
72731
|
`;
|
|
72559
72732
|
}
|
|
72560
|
-
function vercelReadme(agentNames, secretNames) {
|
|
72733
|
+
function vercelReadme(agentNames, secretNames, optionalSettings) {
|
|
72561
72734
|
const agentList = agentNames.map((n) => ` - ${n}`).join("\n");
|
|
72562
72735
|
const secretList = secretNames.length > 0 ? secretNames.map((s) => ` vercel env add ${s}`).join("\n") : " (none detected)";
|
|
72563
72736
|
return `# Runtype Vercel Functions Deployment
|
|
@@ -72580,6 +72753,8 @@ Set each API key your agents use via the Vercel dashboard or CLI:
|
|
|
72580
72753
|
${secretList}
|
|
72581
72754
|
\`\`\`
|
|
72582
72755
|
|
|
72756
|
+
${optionalProviderSettingsSection(optionalSettings)}
|
|
72757
|
+
|
|
72583
72758
|
## Run locally
|
|
72584
72759
|
|
|
72585
72760
|
\`\`\`bash
|
|
@@ -72605,24 +72780,113 @@ curl https://<your-project>.vercel.app/agent/<name> \\
|
|
|
72605
72780
|
\`\`\`
|
|
72606
72781
|
`;
|
|
72607
72782
|
}
|
|
72608
|
-
function
|
|
72609
|
-
const
|
|
72610
|
-
const
|
|
72611
|
-
|
|
72612
|
-
|
|
72783
|
+
function collectExportedExecutionInventory(definition) {
|
|
72784
|
+
const models = /* @__PURE__ */ new Set();
|
|
72785
|
+
const namedSecrets = /* @__PURE__ */ new Set();
|
|
72786
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
72787
|
+
const isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
72788
|
+
const addModel = (value) => {
|
|
72789
|
+
if (typeof value === "string" && value) models.add(value);
|
|
72790
|
+
};
|
|
72791
|
+
const walkMcpServers = (servers) => {
|
|
72792
|
+
if (!Array.isArray(servers)) return;
|
|
72793
|
+
for (const server of servers) {
|
|
72794
|
+
if (!isObject2(server) || !isObject2(server.auth)) continue;
|
|
72795
|
+
for (const key of ["tokenSecretName", "usernameSecretName", "passwordSecretName"]) {
|
|
72796
|
+
const value = server.auth[key];
|
|
72797
|
+
if (typeof value === "string" && value) namedSecrets.add(value);
|
|
72798
|
+
}
|
|
72799
|
+
}
|
|
72800
|
+
};
|
|
72801
|
+
function walkRuntimeTools(runtimeTools) {
|
|
72802
|
+
if (!Array.isArray(runtimeTools)) return;
|
|
72803
|
+
for (const tool of runtimeTools) {
|
|
72804
|
+
if (!isObject2(tool) || !isObject2(tool.config)) continue;
|
|
72805
|
+
if (isObject2(tool.config.flow)) walkFlow(tool.config.flow);
|
|
72806
|
+
if (isObject2(tool.config.agent)) walkAgent(tool.config.agent);
|
|
72807
|
+
if (isObject2(tool.config.skill)) walkRuntimeTools(tool.config.skill.resolvedTools);
|
|
72808
|
+
}
|
|
72809
|
+
}
|
|
72810
|
+
function walkTools(tools) {
|
|
72811
|
+
if (!isObject2(tools)) return;
|
|
72812
|
+
walkMcpServers(tools.mcpServers);
|
|
72813
|
+
walkRuntimeTools(tools.runtimeTools);
|
|
72814
|
+
}
|
|
72815
|
+
function walkFallbackModels(config3) {
|
|
72816
|
+
if (!isObject2(config3.errorHandling) || !Array.isArray(config3.errorHandling.fallbacks)) return;
|
|
72817
|
+
for (const fallback of config3.errorHandling.fallbacks) {
|
|
72818
|
+
if (isObject2(fallback) && fallback.type === "model") addModel(fallback.model);
|
|
72819
|
+
}
|
|
72820
|
+
}
|
|
72821
|
+
function walkSteps(steps) {
|
|
72822
|
+
if (!Array.isArray(steps)) return;
|
|
72823
|
+
for (const step of steps) {
|
|
72824
|
+
if (!isObject2(step) || !isObject2(step.config)) continue;
|
|
72825
|
+
if (step.type === "prompt") addModel(step.config.model);
|
|
72826
|
+
walkFallbackModels(step.config);
|
|
72827
|
+
walkTools(step.config.tools);
|
|
72828
|
+
if (step.type !== "conditional") continue;
|
|
72829
|
+
for (const key of ["trueSteps", "falseSteps", "otherwiseSteps"]) walkSteps(step.config[key]);
|
|
72830
|
+
if (Array.isArray(step.config.branches)) {
|
|
72831
|
+
for (const branch of step.config.branches) {
|
|
72832
|
+
if (isObject2(branch)) walkSteps(branch.steps);
|
|
72833
|
+
}
|
|
72834
|
+
}
|
|
72835
|
+
}
|
|
72836
|
+
}
|
|
72837
|
+
function walkFlow(flow) {
|
|
72838
|
+
if (visited.has(flow)) return;
|
|
72839
|
+
visited.add(flow);
|
|
72840
|
+
walkSteps(flow.steps);
|
|
72841
|
+
if (isObject2(flow.agents)) {
|
|
72842
|
+
for (const agent of Object.values(flow.agents)) {
|
|
72843
|
+
if (isObject2(agent)) walkAgent(agent);
|
|
72844
|
+
}
|
|
72845
|
+
}
|
|
72613
72846
|
}
|
|
72614
|
-
|
|
72615
|
-
|
|
72616
|
-
|
|
72617
|
-
|
|
72618
|
-
|
|
72619
|
-
|
|
72620
|
-
|
|
72621
|
-
|
|
72847
|
+
function walkAgent(agent) {
|
|
72848
|
+
if (visited.has(agent)) return;
|
|
72849
|
+
visited.add(agent);
|
|
72850
|
+
if (isObject2(agent.config)) {
|
|
72851
|
+
addModel(agent.config.model);
|
|
72852
|
+
walkTools(agent.config.tools);
|
|
72853
|
+
}
|
|
72854
|
+
if (isObject2(agent.claudeManagedConfig)) addModel(agent.claudeManagedConfig.model);
|
|
72855
|
+
if (isObject2(agent.primaryFlow)) walkFlow(agent.primaryFlow);
|
|
72856
|
+
if (Array.isArray(agent.capabilities)) {
|
|
72857
|
+
for (const capability of agent.capabilities) {
|
|
72858
|
+
if (!isObject2(capability)) continue;
|
|
72859
|
+
if (isObject2(capability.flow)) walkFlow(capability.flow);
|
|
72860
|
+
if (isObject2(capability.subAgent)) walkAgent(capability.subAgent);
|
|
72861
|
+
}
|
|
72622
72862
|
}
|
|
72623
72863
|
}
|
|
72624
|
-
|
|
72625
|
-
|
|
72864
|
+
if (isObject2(definition)) {
|
|
72865
|
+
if (Array.isArray(definition.steps) && !isObject2(definition.config)) walkFlow(definition);
|
|
72866
|
+
else walkAgent(definition);
|
|
72867
|
+
}
|
|
72868
|
+
return {
|
|
72869
|
+
models: Array.from(models),
|
|
72870
|
+
namedSecrets: Array.from(namedSecrets)
|
|
72871
|
+
};
|
|
72872
|
+
}
|
|
72873
|
+
function collectDeploymentSecretInventory(agentDef) {
|
|
72874
|
+
const requiredNames = /* @__PURE__ */ new Set();
|
|
72875
|
+
const optionalSettings = /* @__PURE__ */ new Map();
|
|
72876
|
+
const executionInventory = collectExportedExecutionInventory(agentDef);
|
|
72877
|
+
for (const model of executionInventory.models) {
|
|
72878
|
+
for (const name of resolveModelSecretNames(model)) requiredNames.add(name);
|
|
72879
|
+
for (const setting of resolveModelOptionalSettings(model)) {
|
|
72880
|
+
optionalSettings.set(setting.name, setting);
|
|
72881
|
+
}
|
|
72882
|
+
}
|
|
72883
|
+
for (const name of executionInventory.namedSecrets) requiredNames.add(name);
|
|
72884
|
+
for (const name of extractSecretReferencesFromAnyValue(agentDef, 512)) requiredNames.add(name);
|
|
72885
|
+
for (const name of requiredNames) optionalSettings.delete(name);
|
|
72886
|
+
return {
|
|
72887
|
+
requiredNames: Array.from(requiredNames),
|
|
72888
|
+
optionalSettings: Array.from(optionalSettings.values())
|
|
72889
|
+
};
|
|
72626
72890
|
}
|
|
72627
72891
|
function slugify2(s) {
|
|
72628
72892
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
|
|
@@ -72731,10 +72995,17 @@ Scaffolding ${target} deployment to ${outDir}
|
|
|
72731
72995
|
monorepoRoot = parent;
|
|
72732
72996
|
}
|
|
72733
72997
|
const allSecrets = /* @__PURE__ */ new Set();
|
|
72998
|
+
const allOptionalSettings = /* @__PURE__ */ new Map();
|
|
72734
72999
|
for (const { def } of agentDefs) {
|
|
72735
|
-
|
|
73000
|
+
const inventory = collectDeploymentSecretInventory(def);
|
|
73001
|
+
for (const name of inventory.requiredNames) allSecrets.add(name);
|
|
73002
|
+
for (const setting of inventory.optionalSettings) {
|
|
73003
|
+
allOptionalSettings.set(setting.name, setting);
|
|
73004
|
+
}
|
|
72736
73005
|
}
|
|
73006
|
+
for (const name of allSecrets) allOptionalSettings.delete(name);
|
|
72737
73007
|
const secretNames = Array.from(allSecrets);
|
|
73008
|
+
const optionalSettings = Array.from(allOptionalSettings.values());
|
|
72738
73009
|
if (target === "cloudflare") {
|
|
72739
73010
|
fs16.mkdirSync(path17.join(outDir, "src"), { recursive: true });
|
|
72740
73011
|
fs16.writeFileSync(path17.join(outDir, "src", "index.ts"), workerIndexTs(agentSlugs));
|
|
@@ -72744,7 +73015,10 @@ Scaffolding ${target} deployment to ${outDir}
|
|
|
72744
73015
|
const setupPath = path17.join(outDir, "setup.sh");
|
|
72745
73016
|
fs16.writeFileSync(setupPath, workerSetupSh(monorepoRoot));
|
|
72746
73017
|
fs16.chmodSync(setupPath, 493);
|
|
72747
|
-
fs16.writeFileSync(
|
|
73018
|
+
fs16.writeFileSync(
|
|
73019
|
+
path17.join(outDir, "README.md"),
|
|
73020
|
+
workerReadme(agentNames, secretNames, optionalSettings)
|
|
73021
|
+
);
|
|
72748
73022
|
} else if (target === "vercel") {
|
|
72749
73023
|
fs16.mkdirSync(path17.join(outDir, "api"), { recursive: true });
|
|
72750
73024
|
fs16.writeFileSync(path17.join(outDir, "api", "[[...route]].ts"), vercelRouteTs(agentSlugs));
|
|
@@ -72754,7 +73028,10 @@ Scaffolding ${target} deployment to ${outDir}
|
|
|
72754
73028
|
const setupPath = path17.join(outDir, "setup.sh");
|
|
72755
73029
|
fs16.writeFileSync(setupPath, vercelSetupSh(monorepoRoot));
|
|
72756
73030
|
fs16.chmodSync(setupPath, 493);
|
|
72757
|
-
fs16.writeFileSync(
|
|
73031
|
+
fs16.writeFileSync(
|
|
73032
|
+
path17.join(outDir, "README.md"),
|
|
73033
|
+
vercelReadme(agentNames, secretNames, optionalSettings)
|
|
73034
|
+
);
|
|
72758
73035
|
} else {
|
|
72759
73036
|
fs16.writeFileSync(path17.join(outDir, "server.ts"), serverTs());
|
|
72760
73037
|
fs16.writeFileSync(path17.join(outDir, "Dockerfile"), dockerfile());
|
|
@@ -72764,7 +73041,10 @@ Scaffolding ${target} deployment to ${outDir}
|
|
|
72764
73041
|
const setupPath = path17.join(outDir, "setup.sh");
|
|
72765
73042
|
fs16.writeFileSync(setupPath, setupSh(monorepoRoot));
|
|
72766
73043
|
fs16.chmodSync(setupPath, 493);
|
|
72767
|
-
fs16.writeFileSync(
|
|
73044
|
+
fs16.writeFileSync(
|
|
73045
|
+
path17.join(outDir, "README.md"),
|
|
73046
|
+
readme(agentNames, secretNames, optionalSettings)
|
|
73047
|
+
);
|
|
72768
73048
|
}
|
|
72769
73049
|
console.log("");
|
|
72770
73050
|
console.log(chalk38.green(`\u2713 Scaffold written to ${outDir}`));
|
|
@@ -72772,6 +73052,15 @@ Scaffolding ${target} deployment to ${outDir}
|
|
|
72772
73052
|
console.log(chalk38.bold("Next steps:"));
|
|
72773
73053
|
console.log(` cd ${options.output}`);
|
|
72774
73054
|
console.log(" chmod +x setup.sh && ./setup.sh # pack runtime + install deps");
|
|
73055
|
+
if (optionalSettings.length > 0) {
|
|
73056
|
+
console.log("");
|
|
73057
|
+
console.log(chalk38.yellow("Optional provider settings (defaults used when unset):"));
|
|
73058
|
+
for (const setting of optionalSettings) {
|
|
73059
|
+
console.log(
|
|
73060
|
+
` ${chalk38.cyan(setting.name)} (default: ${chalk38.cyan(setting.defaultValue)})`
|
|
73061
|
+
);
|
|
73062
|
+
}
|
|
73063
|
+
}
|
|
72775
73064
|
if (target === "cloudflare") {
|
|
72776
73065
|
console.log(" wrangler dev # test locally");
|
|
72777
73066
|
console.log("");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/cli",
|
|
3
|
-
"version": "2.32.
|
|
3
|
+
"version": "2.32.3",
|
|
4
4
|
"description": "Command-line interface for Runtype AI platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"react": "^19.2.4",
|
|
27
27
|
"rosie-skills": "0.8.1",
|
|
28
28
|
"yaml": "^2.9.0",
|
|
29
|
-
"@runtypelabs/
|
|
30
|
-
"@runtypelabs/sdk": "6.
|
|
31
|
-
"@runtypelabs/
|
|
29
|
+
"@runtypelabs/terminal-animations": "0.2.2",
|
|
30
|
+
"@runtypelabs/sdk": "6.4.0",
|
|
31
|
+
"@runtypelabs/ink-components": "0.3.5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@modelcontextprotocol/server": "2.0.0",
|
|
35
|
-
"@runtypelabs/persona": "4.
|
|
35
|
+
"@runtypelabs/persona": "4.14.0",
|
|
36
36
|
"@types/express": "^5.0.6",
|
|
37
37
|
"@types/micromatch": "^4.0.9",
|
|
38
38
|
"@types/node": "^25.3.3",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"tsx": "^4.7.1",
|
|
44
44
|
"typescript": "^6.0.3",
|
|
45
45
|
"vitest": "^4.1.0",
|
|
46
|
-
"@runtypelabs/shared": "3.
|
|
46
|
+
"@runtypelabs/shared": "3.10.0"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=22.12.0"
|