@runtypelabs/cli 2.22.8 → 2.22.9

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 +155 -20
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -15181,7 +15181,7 @@ var edgeContextPayloadSchema = external_exports.object({
15181
15181
  exp: external_exports.number().int().positive()
15182
15182
  });
15183
15183
 
15184
- // ../shared/dist/chunk-KR4LFVFE.mjs
15184
+ // ../shared/dist/chunk-3FPSMWBQ.mjs
15185
15185
  function getNestedValue(obj, path18) {
15186
15186
  let normalizedPath = path18;
15187
15187
  normalizedPath = normalizedPath.replace(/^\$\.?/, "");
@@ -15566,7 +15566,7 @@ function resolveFallback(parsed, context, tracking) {
15566
15566
  }
15567
15567
  var templateEngine = new SimpleTemplateEngine();
15568
15568
 
15569
- // ../shared/dist/chunk-6RCUU75J.mjs
15569
+ // ../shared/dist/chunk-MMDRPM6Q.mjs
15570
15570
  var tokensSchema = external_exports.object({ input: external_exports.number(), output: external_exports.number() });
15571
15571
  var wireStopReasonSchema = external_exports.enum([
15572
15572
  "end_turn",
@@ -15865,6 +15865,10 @@ var unifiedToolCompleteEventSchema = external_exports.object({
15865
15865
  iteration: external_exports.number().optional(),
15866
15866
  stepId: external_exports.string().optional()
15867
15867
  });
15868
+ var unifiedSubagentAttributionSchema = external_exports.object({
15869
+ toolName: external_exports.string(),
15870
+ agentName: external_exports.string().optional()
15871
+ });
15868
15872
  var unifiedApprovalStartEventSchema = external_exports.object({
15869
15873
  ...unifiedBase,
15870
15874
  type: external_exports.literal("approval_start"),
@@ -15878,7 +15882,10 @@ var unifiedApprovalStartEventSchema = external_exports.object({
15878
15882
  parameters: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
15879
15883
  timeout: external_exports.number().optional(),
15880
15884
  startedAt: external_exports.string().optional(),
15881
- iteration: external_exports.number().optional()
15885
+ iteration: external_exports.number().optional(),
15886
+ // Present when the approval originated inside a subagent's execution.
15887
+ // Attribution only — never a control signal.
15888
+ subagent: unifiedSubagentAttributionSchema.optional()
15882
15889
  });
15883
15890
  var unifiedApprovalCompleteEventSchema = external_exports.object({
15884
15891
  ...unifiedBase,
@@ -16015,6 +16022,10 @@ var externalAgentContextSchema = external_exports.object({
16015
16022
  contextId: external_exports.string().optional(),
16016
16023
  taskId: external_exports.string().optional()
16017
16024
  });
16025
+ var subagentAttributionSchema = external_exports.object({
16026
+ toolName: external_exports.string(),
16027
+ agentName: external_exports.string().optional()
16028
+ });
16018
16029
  var tokensSchema2 = external_exports.object({ input: external_exports.number(), output: external_exports.number() });
16019
16030
  var wireStopReasonSchema2 = external_exports.enum([
16020
16031
  "end_turn",
@@ -16166,7 +16177,11 @@ var agentApprovalStartEventSchema = external_exports.object({
16166
16177
  parameters: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
16167
16178
  timeout: external_exports.number(),
16168
16179
  startedAt: external_exports.string(),
16169
- externalAgent: externalAgentContextSchema.optional()
16180
+ externalAgent: externalAgentContextSchema.optional(),
16181
+ // Present when the approval originated inside a subagent's execution (a
16182
+ // child agent's tool required approval). Attribution only — see
16183
+ // {@link subagentAttributionSchema}.
16184
+ subagent: subagentAttributionSchema.optional()
16170
16185
  });
16171
16186
  var agentApprovalCompleteEventSchema = external_exports.object({
16172
16187
  ...baseAgentEvent,
@@ -17068,7 +17083,13 @@ var setVariableConfigSchema = external_exports.object({
17068
17083
  // rejecting it. Required so nested set-variable steps validate when the
17069
17084
  // recursive conditional union lands (see
17070
17085
  // `docs/features/planning/2026-06-04-conditional-nested-step-strict-validation.md`).
17071
- value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null(), external_exports.record(external_exports.string(), external_exports.unknown())]),
17086
+ value: external_exports.union([
17087
+ external_exports.string(),
17088
+ external_exports.number(),
17089
+ external_exports.boolean(),
17090
+ external_exports.null(),
17091
+ external_exports.record(external_exports.string(), external_exports.unknown())
17092
+ ]),
17072
17093
  valueTemplate: external_exports.string().optional()
17073
17094
  });
17074
17095
  var sendStreamConfigSchema = external_exports.object({
@@ -17704,10 +17725,63 @@ var promptConfigSchema = external_exports.object({
17704
17725
  mode: external_exports.string().optional()
17705
17726
  // UI mode (task, agent, etc.)
17706
17727
  });
17728
+ var conditionalBranchSchema = external_exports.object({
17729
+ /** Stable identifier (unique within the conditional). */
17730
+ id: external_exports.string().min(1, "Branch id is required"),
17731
+ /** Display name ("High priority", "POST", ...). */
17732
+ name: external_exports.string().optional(),
17733
+ /** JS expression; template `{{var}}` references resolve first. */
17734
+ condition: external_exports.string().min(1, "Branch condition is required"),
17735
+ steps: external_exports.array(external_exports.lazy(() => contextStepSchema))
17736
+ });
17707
17737
  var conditionalConfigSchema = external_exports.object({
17708
- condition: external_exports.string().min(1, "Condition is required"),
17709
- trueSteps: external_exports.array(external_exports.lazy(() => contextStepSchema)),
17710
- falseSteps: external_exports.array(external_exports.lazy(() => contextStepSchema)).optional()
17738
+ /** Legacy binary shape. Required unless `branches` is provided. */
17739
+ condition: external_exports.string().min(1, "Condition is required").optional(),
17740
+ trueSteps: external_exports.array(external_exports.lazy(() => contextStepSchema)).optional(),
17741
+ falseSteps: external_exports.array(external_exports.lazy(() => contextStepSchema)).optional(),
17742
+ /**
17743
+ * N-way named branches, evaluated in order with first-match-wins. When
17744
+ * present (non-empty), this takes precedence over the legacy
17745
+ * `condition`/`trueSteps`/`falseSteps` shape.
17746
+ */
17747
+ branches: external_exports.array(conditionalBranchSchema).optional(),
17748
+ /** Steps to run when no branch condition matches (the pinned "Otherwise"). */
17749
+ otherwiseSteps: external_exports.array(external_exports.lazy(() => contextStepSchema)).optional(),
17750
+ /**
17751
+ * Optional unified branch output. After the taken branch runs, this variable
17752
+ * is bound to the value of the branch's LAST enabled, explicitly-named,
17753
+ * value-producing step (walking back past disabled / unnamed / `when`-skipped
17754
+ * steps). Left absent if the taken branch produced no named output. Lets
17755
+ * divergent branches surface a single result under one name.
17756
+ * (This is an SSA φ-node — it merges the value out of whichever branch ran.)
17757
+ */
17758
+ outputVariable: external_exports.string().optional()
17759
+ }).superRefine((config3, ctx) => {
17760
+ const hasBranches = Array.isArray(config3.branches) && config3.branches.length > 0;
17761
+ if (!hasBranches) {
17762
+ if (typeof config3.condition !== "string" || config3.condition.length === 0) {
17763
+ ctx.addIssue({ code: "custom", path: ["condition"], message: "Condition is required" });
17764
+ }
17765
+ if (!Array.isArray(config3.trueSteps)) {
17766
+ ctx.addIssue({
17767
+ code: "custom",
17768
+ path: ["trueSteps"],
17769
+ message: "trueSteps is required unless branches is provided"
17770
+ });
17771
+ }
17772
+ return;
17773
+ }
17774
+ const seen = /* @__PURE__ */ new Set();
17775
+ config3.branches.forEach((branch, index) => {
17776
+ if (seen.has(branch.id)) {
17777
+ ctx.addIssue({
17778
+ code: "custom",
17779
+ path: ["branches", index, "id"],
17780
+ message: `Duplicate branch id "${branch.id}"`
17781
+ });
17782
+ }
17783
+ seen.add(branch.id);
17784
+ });
17711
17785
  });
17712
17786
  var saveMemoryConfigSchema = external_exports.object({
17713
17787
  profileTemplate: external_exports.string().min(1, "Profile template is required"),
@@ -18362,7 +18436,8 @@ function normalizeCrawlConfig(config3) {
18362
18436
  if (maxAgeRaw !== void 0 && maxAgeRaw !== null) validateNumber(maxAgeRaw, "maxAge", "crawl");
18363
18437
  if (modifiedSince !== void 0) validateString(modifiedSince, "modifiedSince", "crawl");
18364
18438
  if (config3.options !== void 0) validateObject(config3.options, "options", "crawl");
18365
- if (config3.authenticate !== void 0) validateObject(config3.authenticate, "authenticate", "crawl");
18439
+ if (config3.authenticate !== void 0)
18440
+ validateObject(config3.authenticate, "authenticate", "crawl");
18366
18441
  if (config3.cookies !== void 0) validateArray(config3.cookies, "cookies", "crawl");
18367
18442
  if (setExtraHTTPHeaders !== void 0) {
18368
18443
  validateObject(setExtraHTTPHeaders, "setExtraHTTPHeaders", "crawl");
@@ -18385,7 +18460,8 @@ function normalizeCrawlConfig(config3) {
18385
18460
  }
18386
18461
  if (userAgent !== void 0) validateString(userAgent, "userAgent", "crawl");
18387
18462
  if (jsonOptions !== void 0) validateObject(jsonOptions, "jsonOptions", "crawl");
18388
- if (config3.streamOutput !== void 0) validateBoolean(config3.streamOutput, "streamOutput", "crawl");
18463
+ if (config3.streamOutput !== void 0)
18464
+ validateBoolean(config3.streamOutput, "streamOutput", "crawl");
18389
18465
  if (pollIntervalMsRaw !== void 0 && pollIntervalMsRaw !== null) {
18390
18466
  validateNumber(pollIntervalMsRaw, "pollIntervalMs", "crawl");
18391
18467
  }
@@ -18745,11 +18821,19 @@ function normalizeTemplateConfig(config3) {
18745
18821
  validateArray(config3.sampleData, "sampleData", "template");
18746
18822
  for (const [i, scenario] of config3.sampleData.entries()) {
18747
18823
  if (typeof scenario !== "object" || scenario === null || Array.isArray(scenario)) {
18748
- throw new NormalizationError(`sampleData[${i}] must be an object`, "template", `sampleData[${i}]`);
18824
+ throw new NormalizationError(
18825
+ `sampleData[${i}] must be an object`,
18826
+ "template",
18827
+ `sampleData[${i}]`
18828
+ );
18749
18829
  }
18750
18830
  validateString(scenario.name, `sampleData[${i}].name`, "template", true);
18751
18831
  if (typeof scenario.data !== "object" || scenario.data === null || Array.isArray(scenario.data)) {
18752
- throw new NormalizationError(`sampleData[${i}].data must be an object`, "template", `sampleData[${i}].data`);
18832
+ throw new NormalizationError(
18833
+ `sampleData[${i}].data must be an object`,
18834
+ "template",
18835
+ `sampleData[${i}].data`
18836
+ );
18753
18837
  }
18754
18838
  }
18755
18839
  }
@@ -18774,7 +18858,9 @@ function normalizeTemplateConfig(config3) {
18774
18858
  }
18775
18859
  function normalizeConditionalConfig(config3) {
18776
18860
  validateConfig(config3, "conditional");
18777
- validateString(config3.condition, "condition", "conditional", true);
18861
+ const rawBranches = config3.branches;
18862
+ const hasBranches = Array.isArray(rawBranches) && rawBranches.length > 0;
18863
+ validateString(config3.condition, "condition", "conditional", !hasBranches);
18778
18864
  const trueSteps = config3.trueSteps ?? config3.true_steps;
18779
18865
  const falseSteps = config3.falseSteps ?? config3.false_steps;
18780
18866
  if (trueSteps) {
@@ -18796,10 +18882,37 @@ function normalizeConditionalConfig(config3) {
18796
18882
  return normalizeContextStep(stepWithDefaults);
18797
18883
  });
18798
18884
  };
18885
+ let branches;
18886
+ if (hasBranches) {
18887
+ validateArray(rawBranches, "branches", "conditional");
18888
+ branches = rawBranches.map((branch, index) => {
18889
+ if (!branch || typeof branch !== "object") {
18890
+ throw new NormalizationError(
18891
+ `branches[${index}] must be an object`,
18892
+ "conditional",
18893
+ "branches"
18894
+ );
18895
+ }
18896
+ validateString(branch.condition, `branches[${index}].condition`, "conditional", true);
18897
+ const branchSteps = Array.isArray(branch.steps) ? branch.steps : [];
18898
+ return {
18899
+ id: typeof branch.id === "string" && branch.id.length > 0 ? branch.id : `branch-${index}`,
18900
+ ...typeof branch.name === "string" && branch.name.length > 0 ? { name: branch.name } : {},
18901
+ condition: branch.condition,
18902
+ steps: normalizeNestedSteps(branchSteps, `conditional-branch-${index}`)
18903
+ };
18904
+ });
18905
+ }
18906
+ const otherwiseSteps = Array.isArray(config3.otherwiseSteps) ? normalizeNestedSteps(config3.otherwiseSteps, "conditional-otherwise") : void 0;
18799
18907
  return {
18800
- condition: config3.condition,
18908
+ ...typeof config3.condition === "string" && config3.condition.length > 0 ? { condition: config3.condition } : {},
18801
18909
  trueSteps: trueSteps ? normalizeNestedSteps(trueSteps, "conditional-true") : [],
18802
- falseSteps: falseSteps ? normalizeNestedSteps(falseSteps, "conditional-false") : void 0
18910
+ falseSteps: falseSteps ? normalizeNestedSteps(falseSteps, "conditional-false") : void 0,
18911
+ ...branches ? { branches } : {},
18912
+ ...otherwiseSteps ? { otherwiseSteps } : {},
18913
+ // Preserve the optional unified branch-output binding through normalization —
18914
+ // the manual rebuild above would otherwise drop it (not condition/branches).
18915
+ ...typeof config3.outputVariable === "string" && config3.outputVariable.length > 0 ? { outputVariable: config3.outputVariable } : {}
18803
18916
  };
18804
18917
  }
18805
18918
  function normalizeSetVariableConfig(config3) {
@@ -19915,8 +20028,18 @@ function conditionalNestingDepth(config3) {
19915
20028
  if (depth > MAX_CONDITIONAL_NESTING_DEPTH) break;
19916
20029
  if (!node || typeof node !== "object") continue;
19917
20030
  const cfg = node;
19918
- for (const key of ["trueSteps", "falseSteps", "true_steps", "false_steps"]) {
19919
- const branch = cfg[key];
20031
+ const branchArrays = [];
20032
+ for (const key of ["trueSteps", "falseSteps", "true_steps", "false_steps", "otherwiseSteps"]) {
20033
+ branchArrays.push(cfg[key]);
20034
+ }
20035
+ if (Array.isArray(cfg.branches)) {
20036
+ for (const branch of cfg.branches) {
20037
+ if (branch && typeof branch === "object") {
20038
+ branchArrays.push(branch.steps);
20039
+ }
20040
+ }
20041
+ }
20042
+ for (const branch of branchArrays) {
19920
20043
  if (!Array.isArray(branch)) continue;
19921
20044
  for (const s of branch) {
19922
20045
  if (s && typeof s === "object" && s.type === "conditional") {
@@ -20965,7 +21088,7 @@ const helpers = (function createHelpers() {
20965
21088
 
20966
21089
  extractURLs: (text) => {
20967
21090
  if (typeof text !== 'string') return []
20968
- const urlRegex = /https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)/g
21091
+ const urlRegex = /https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&/=]*)/g
20969
21092
  const matches = text.match(urlRegex)
20970
21093
  return matches ? [...new Set(matches)] : []
20971
21094
  },
@@ -21152,6 +21275,13 @@ const helpers = (function createHelpers() {
21152
21275
  return str
21153
21276
  }
21154
21277
  },
21278
+
21279
+ coalesce: (...values) => {
21280
+ for (const value of values) {
21281
+ if (value !== null && value !== undefined) return value
21282
+ }
21283
+ return null
21284
+ },
21155
21285
  }
21156
21286
  })()
21157
21287
  `.trim();
@@ -41546,10 +41676,10 @@ var FLOW_STEP_TYPE_METADATA = {
41546
41676
  configHints: "template (Liquid body), outputFormat, outputVariable, optional inputs map, optional partials, optional pdfOptions, optional asArtifact, optional streamOutput, optional sampleData"
41547
41677
  },
41548
41678
  conditional: {
41549
- description: "Branch the flow based on a JavaScript expression. Routes to trueSteps or falseSteps.",
41679
+ description: "Branch the flow on JavaScript expressions. Either the legacy binary shape (condition \u2192 trueSteps / falseSteps) or N-way named branches evaluated first-match-wins with an otherwise fallback. Set outputVariable to merge the taken branch into one named result.",
41550
41680
  category: "control-flow",
41551
41681
  isPrompt: false,
41552
- configHints: "condition (JS expression), trueSteps, falseSteps"
41682
+ configHints: "either { condition, trueSteps, falseSteps } or { branches: [{ id, name, condition, steps }], otherwiseSteps }, optional outputVariable"
41553
41683
  },
41554
41684
  "fetch-url": {
41555
41685
  description: "Make an HTTP request and capture the response.",
@@ -42256,6 +42386,11 @@ var SURFACE_TYPE_METADATA = {
42256
42386
  behaviorTypeRef: "runtype://types/surface-configs"
42257
42387
  }
42258
42388
  };
42389
+ var EMAIL_HTML_CAPABILITY_HINT = [
42390
+ "## Channel capabilities",
42391
+ '- Formatting: author the reply as an HTML email body. Write well-formed HTML and put all styling in inline `style="..."` attributes (no `<style>` blocks, no external CSS). Use semantic tags freely: `<p>`, `<h1>`-`<h3>`, `<ul>`/`<ol>`/`<li>`, `<table>`, `<a>`, `<strong>`/`<em>`, `<blockquote>`, `<img>`. Do NOT emit `<script>`, `<iframe>`, `<head>`, `<body>`, or `<html>` wrappers: Runtype wraps your body in the email document and strips any active or unsafe content before sending.',
42392
+ '- Images: embed an image with `<img src="https://..." alt="...">` and it renders inline in the email. (Some clients ask the recipient to load remote images.)'
42393
+ ].join("\n");
42259
42394
  var SURFACE_TYPE_GUIDE = (() => {
42260
42395
  const lines = Object.entries(SURFACE_TYPE_METADATA).map(([type, info]) => {
42261
42396
  return `- **${type}**: ${info.description}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/cli",
3
- "version": "2.22.8",
3
+ "version": "2.22.9",
4
4
  "description": "Command-line interface for Runtype AI platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,8 +24,8 @@
24
24
  "rosie-skills": "0.8.1",
25
25
  "yaml": "^2.9.0",
26
26
  "@runtypelabs/ink-components": "0.3.2",
27
- "@runtypelabs/sdk": "5.2.0",
28
- "@runtypelabs/terminal-animations": "0.2.1"
27
+ "@runtypelabs/terminal-animations": "0.2.1",
28
+ "@runtypelabs/sdk": "5.2.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@runtypelabs/persona": "3.37.0",
@@ -39,7 +39,7 @@
39
39
  "tsx": "^4.7.1",
40
40
  "typescript": "^5.3.3",
41
41
  "vitest": "^4.1.0",
42
- "@runtypelabs/shared": "1.38.0"
42
+ "@runtypelabs/shared": "1.39.0"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=22.0.0"