@runtypelabs/cli 2.40.14 → 2.41.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.
Files changed (2) hide show
  1. package/dist/index.js +1515 -779
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -20278,11 +20278,12 @@ function date4(params) {
20278
20278
  return _coercedDate(ZodDate, params);
20279
20279
  }
20280
20280
 
20281
- // ../shared/dist/chunk-XB5DZHOV.mjs
20281
+ // ../shared/dist/chunk-U2LBCYYU.mjs
20282
20282
  var REPLAY_FROM_START = Object.freeze({
20283
20283
  row: 0,
20284
20284
  sub: Number.POSITIVE_INFINITY
20285
20285
  });
20286
+ var RUN_ORIGINS = ["dashboard", "api", "internal"];
20286
20287
  var RUN_STATUSES = [
20287
20288
  "queued",
20288
20289
  "running",
@@ -20327,6 +20328,9 @@ var runListRowSchema = external_exports.object({
20327
20328
  parentExecutionId: str("Run that spawned this one."),
20328
20329
  parentToolCallId: str("Parent's tool call that spawned this run."),
20329
20330
  rootExecutionId: str("Outermost run of the tree."),
20331
+ childCount: num(
20332
+ "How many runs name this one as their parent. The unscoped feed returns roots only, so this is the size of the fold underneath a row; read the children with parentExecutionId=<executionId>. It is populated on a resource-scoped page too, where nothing is folded, so a surface can still offer the same expansion. WHICH children are counted depends on the arm that served the row: the span store counts every child, agent and nested-flow alike, while the legacy control-plane fallback counts agent children only, so on that arm a parent whose only child is a nested flow reports 0. That is deliberate \u2014 the fallback arm cannot enumerate a nested-flow child either, so counting one would advertise a fold that opens on nothing. It counts only children the CALLER may read: a credential holding one execution family (AGENTS:READ or FLOWS:READ alone) counts the children of that family and no others, so a count never discloses a run the same credential could not list. NULL means the arm cannot count children at all, which is not zero."
20333
+ ),
20330
20334
  source: external_exports.enum(RUN_SOURCES).describe("hosted, or ingested for an OTLP export. An ingested run is never reported running."),
20331
20335
  fidelityTier: str("Fidelity of the projection behind this row."),
20332
20336
  completeness: external_exports.enum(RUN_COMPLETENESS_VALUES).nullable().describe("Storage completeness; null on a row the control-plane arm served."),
@@ -20334,15 +20338,34 @@ var runListRowSchema = external_exports.object({
20334
20338
  spanCount: num("Spans the projection wrote."),
20335
20339
  inputTokens: num("Input tokens reported."),
20336
20340
  outputTokens: num("Output tokens reported."),
20341
+ cacheReadTokens: external_exports.number().nullish().describe(
20342
+ "Prompt-cache reads summed over the run's model calls (a subset of inputTokens). Returned by GET /v1/runs/{executionId} only; null means no model call reported one."
20343
+ ),
20344
+ cacheWriteTokens: external_exports.number().nullish().describe(
20345
+ "Prompt-cache writes summed over the run's model calls (a subset of inputTokens). Returned by GET /v1/runs/{executionId} only; null means no model call reported one."
20346
+ ),
20347
+ reasoningTokens: external_exports.number().nullish().describe(
20348
+ "Reasoning tokens summed over the run's model calls (a subset of outputTokens). Returned by GET /v1/runs/{executionId} only; null means no model call reported one."
20349
+ ),
20337
20350
  totalCost: str("Metered cost as a decimal string."),
20338
20351
  selfReportedCost: str("Cost the producer reported."),
20339
- test: external_exports.boolean().nullable().describe(
20340
- "True when the run was dispatched with storeResults: false, so it has no control-plane row and no overlay. NULL means the header states nothing about it, which is not false: headers written before this field shipped, and lanes that take no such flag, carry no dispatch stamp and are never backfilled."
20352
+ origin: external_exports.enum(RUN_ORIGINS).nullable().describe(
20353
+ `Where the run was dispatched from, taken from the caller's authenticated principal and never from a request field. ANY entrance that resolves a principal stamps it: a Clerk session answers dashboard; a management API key answers api, which includes the Runtype MCP server's tools and Code Mode, since both reach dispatch with a management key; and Runtype's own internal caller answers internal, for example the hosted /v1/mcp proxy. A lane that resolves NO principal carries NULL BY DESIGN: schedule, webhook, messaging, A2A, an agent exposed AS an MCP surface, subagent, nested flow, a client-token product surface (an end user is none of the three origins) and an ingested OTLP run. So NULL says "no authenticated principal at this entrance" rather than "unknown caller". The one NULL that is not a statement about the lane is a row whose header predates the field or came from the backfill: it stamps nothing even for a run that did resolve a principal.`
20354
+ ),
20355
+ storeResults: external_exports.boolean().nullable().describe(
20356
+ 'The persistence posture the dispatch declared. FALSE means the run wrote no control-plane row, no journal outputs and no span content, so a surface that reports a missing transcript keys on this and never on origin. NULL means the header states nothing, which is not "true": a lane that takes no such flag carries no stamp, and an ingested (OTLP) run declared none. A row served from the legacy control-plane lane answers true, because that row exists only when the run stored.'
20357
+ ),
20358
+ inlineDefinition: external_exports.boolean().nullable().describe(
20359
+ "True when the dispatch carried a complete inline agent definition (name and model) beside or instead of an agentId, so the run executed that inline config and no stored version; such a row stamps no agentVersionId. False when the run executed the saved definition by reference. NULL when the header states nothing: a flow run, a lane that resolves no agent definition, or a row that predates the field."
20360
+ ),
20361
+ // WHY(packages/shared/src/context-management-config-schema.ts): `.meta` is zod-core; `.openapi` exists only on shim-built instances.
20362
+ test: external_exports.boolean().nullable().meta({ deprecated: true }).describe(
20363
+ 'DEPRECATED: a derived alias of origin, kept for one release \u2014 read origin instead. True when the run came from the dashboard, i.e. origin === "dashboard"; NULL exactly when origin is NULL. It is never derived from storeResults, which defaults to false across the whole flow lane and which an API caller sets for its own privacy reasons: reading it as "test" labelled production runs as tests. A run whose header predates origin therefore reads NULL rather than claiming either answer.'
20341
20364
  ),
20342
20365
  stopReason: external_exports.string().nullish().describe("Stop reason from the terminal frame."),
20343
20366
  iterations: external_exports.number().nullish().describe("Loop iterations from the terminal frame."),
20344
20367
  inputPreview: external_exports.string().nullish().describe(
20345
- `The run's first user message, secret-scrubbed and cut to ${RUN_INPUT_PREVIEW_MAX_CHARS} characters, so a list can say what a run was asked to do without reading content. Absent means no input text is recorded for this run, which is not an empty message: the span store holds no run-level input at all, so a run with no control-plane row (a flow leg, a storeResults:false test run) has none.`
20368
+ `The run's first user message, secret-scrubbed and cut to ${RUN_INPUT_PREVIEW_MAX_CHARS} characters, so a list can say what a run was asked to do without reading content. Absent means no input text is recorded for this run, which is not an empty message: the span store holds no run-level input at all, so a run with no control-plane row (a flow leg, a storeResults:false run) has none.`
20346
20369
  ),
20347
20370
  agentVersionId: ovStr("Agent version that ran."),
20348
20371
  agentVersionLabel: ovStr("Version label."),
@@ -20391,6 +20414,7 @@ var runStatusFilterSchema = external_exports.enum(RUN_STATUS_FILTERS, {
20391
20414
  error: () => RUN_STATUS_FILTER_MESSAGE
20392
20415
  });
20393
20416
  var repeatable = () => external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]);
20417
+ var RUN_LIST_INCLUDE_CHILDREN_DESCRIPTION = "true restores the flat enumeration on the UNSCOPED feed, in which a subagent run and a nested-flow run list beside their parent. The unscoped feed is roots only by default: a row whose parentExecutionId is set folds under its parent and is read with parentExecutionId=<executionId>. Any filter that scopes to a resource \u2014 agentId, flowId, conversationId, surfaceId, recordId, batchExecutionId, parentExecutionId, rootExecutionId or executionId \u2014 is already an explicit selection and never folds, so an agent that only ever runs as a subagent still lists under agentId. This parameter changes nothing on a scoped request.";
20394
20418
  var runListQuerySchema = external_exports.object({
20395
20419
  agentId: repeatable().optional().describe("Filter by agent id; repeat for a set."),
20396
20420
  flowId: repeatable().optional().describe("Filter by flow id; repeat for a set."),
@@ -20401,6 +20425,7 @@ var runListQuerySchema = external_exports.object({
20401
20425
  batchExecutionId: repeatable().optional().describe("Filter by batch id; repeat for a set."),
20402
20426
  parentExecutionId: external_exports.string().optional().describe("Runs spawned by this execution."),
20403
20427
  rootExecutionId: external_exports.string().optional().describe("Runs in this execution tree."),
20428
+ includeChildren: external_exports.enum(["true", "false"]).optional().describe(RUN_LIST_INCLUDE_CHILDREN_DESCRIPTION),
20404
20429
  executionId: repeatable().optional().describe(`Read specific runs by id; at most ${MAX_RUN_LIST_IDS} per request.`),
20405
20430
  source: external_exports.enum(RUN_SOURCES).optional().describe("Filter by producing lane."),
20406
20431
  status: runStatusFilterSchema.optional().describe(RUN_STATUS_FILTER_MESSAGE),
@@ -20427,136 +20452,7 @@ var scheduleRunLinkSchema = external_exports.object({
20427
20452
  batchExecutionId: external_exports.string().nullable().describe("The batch whose per-record runs are GET /v1/runs?batchExecutionId=.")
20428
20453
  });
20429
20454
 
20430
- // ../shared/dist/chunk-2NMGSD35.mjs
20431
- var GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
20432
- var GEN_AI_AGENT_ID = "gen_ai.agent.id";
20433
- var GEN_AI_AGENT_NAME = "gen_ai.agent.name";
20434
- var GEN_AI_CONVERSATION_ID = "gen_ai.conversation.id";
20435
- var GEN_AI_REQUEST_MODEL = "gen_ai.request.model";
20436
- var GEN_AI_RESPONSE_MODEL_NAME = "gen_ai.response.model";
20437
- var GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens";
20438
- var GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
20439
- var GEN_AI_USAGE_CACHE_READ_TOKENS = "gen_ai.usage.cache_read.input_tokens";
20440
- var GEN_AI_USAGE_CACHE_CREATION_TOKENS = "gen_ai.usage.cache_creation.input_tokens";
20441
- var GEN_AI_TOOL_NAME = "gen_ai.tool.name";
20442
- var GEN_AI_TOOL_TYPE = "gen_ai.tool.type";
20443
- var GEN_AI_TOOL_CALL_ID = "gen_ai.tool.call.id";
20444
- var GEN_AI_ATTRIBUTES = {
20445
- operationName: GEN_AI_OPERATION_NAME,
20446
- agentId: GEN_AI_AGENT_ID,
20447
- agentName: GEN_AI_AGENT_NAME,
20448
- conversationId: GEN_AI_CONVERSATION_ID,
20449
- requestModel: GEN_AI_REQUEST_MODEL,
20450
- usageInputTokens: GEN_AI_USAGE_INPUT_TOKENS,
20451
- usageOutputTokens: GEN_AI_USAGE_OUTPUT_TOKENS,
20452
- /** Input tokens served from the provider's prompt cache, when the provider reports them. */
20453
- usageCacheReadTokens: GEN_AI_USAGE_CACHE_READ_TOKENS,
20454
- /** Input tokens written INTO the provider's prompt cache, when the provider reports them. */
20455
- usageCacheCreationTokens: GEN_AI_USAGE_CACHE_CREATION_TOKENS,
20456
- /** The model the provider reported having SERVED; the more accurate one to price. */
20457
- responseModel: GEN_AI_RESPONSE_MODEL_NAME,
20458
- toolName: GEN_AI_TOOL_NAME,
20459
- toolType: GEN_AI_TOOL_TYPE,
20460
- toolCallId: GEN_AI_TOOL_CALL_ID
20461
- };
20462
-
20463
- // ../shared/dist/chunk-GYGZIK4G.mjs
20464
- var RUNTYPE_ITERATION = "runtype.iteration";
20465
- var RUNTYPE_TOTAL_COST = "runtype.total_cost";
20466
- var RUNTYPE_TURN_INDEX = "runtype.turn.index";
20467
- var RUNTYPE_LEGACY_ATTRIBUTE_ALIASES = {
20468
- [RUNTYPE_ITERATION]: ["runtype.agent.iteration"],
20469
- [RUNTYPE_TOTAL_COST]: ["runtype.agent.totalCost"],
20470
- [RUNTYPE_TURN_INDEX]: ["runtype.agent.turnIndex"]
20471
- };
20472
- var GEN_AI_TOOL_CALL_ARGUMENTS = "gen_ai.tool.call.arguments";
20473
- var GEN_AI_TOOL_CALL_RESULT = "gen_ai.tool.call.result";
20474
- var GEN_AI_INPUT_MESSAGES = "gen_ai.input.messages";
20475
- var GEN_AI_OUTPUT_MESSAGES = "gen_ai.output.messages";
20476
- var GEN_AI_CONTENT_ATTRIBUTES = {
20477
- /** Chat history sent to the model, as semconv structured messages. */
20478
- inputMessages: GEN_AI_INPUT_MESSAGES,
20479
- /** Messages the model produced (includes reasoning content parts). */
20480
- outputMessages: GEN_AI_OUTPUT_MESSAGES,
20481
- /** System instructions, when separate from the input messages. */
20482
- systemInstructions: "gen_ai.system_instructions",
20483
- /** `execute_tool` span: the arguments the tool was called with. */
20484
- toolCallArguments: GEN_AI_TOOL_CALL_ARGUMENTS,
20485
- /** `execute_tool` span: the result the tool returned. */
20486
- toolCallResult: GEN_AI_TOOL_CALL_RESULT
20487
- };
20488
- var GEN_AI_CONTENT_ATTRIBUTE_ALIASES = {
20489
- [GEN_AI_INPUT_MESSAGES]: ["ai.prompt.messages", "ai.prompt"],
20490
- [GEN_AI_OUTPUT_MESSAGES]: ["ai.response.text", "ai.response.object"],
20491
- [GEN_AI_TOOL_CALL_ARGUMENTS]: ["flue.tool.call.arguments", "ai.toolCall.args"],
20492
- [GEN_AI_TOOL_CALL_RESULT]: ["flue.tool.call.result", "ai.toolCall.result"]
20493
- };
20494
- var OPENINFERENCE_CONTENT_PREFIXES = [
20495
- "llm.input_messages.",
20496
- "llm.output_messages.",
20497
- "llm.prompts",
20498
- "llm.prompt_template.",
20499
- "llm.choices",
20500
- "llm.function_call",
20501
- "retrieval.documents.",
20502
- "embedding.embeddings.",
20503
- "input.value",
20504
- "output.value"
20505
- ];
20506
- var AI_SDK_CONTENT_PREFIXES = ["ai.response.toolCalls"];
20507
- var MASTRA_CONTENT_PREFIXES = ["mastra.metadata.body"];
20508
- var CLOUDFLARE_AGENTS_CONTENT_PREFIXES = [
20509
- "cloudflare.agents.metadata.",
20510
- "cloudflare.agents.runtime_context."
20511
- ];
20512
- var GEN_AI_CONTENT_ATTRIBUTE_PREFIXES = [
20513
- ...OPENINFERENCE_CONTENT_PREFIXES,
20514
- ...AI_SDK_CONTENT_PREFIXES,
20515
- ...MASTRA_CONTENT_PREFIXES,
20516
- ...CLOUDFLARE_AGENTS_CONTENT_PREFIXES
20517
- ];
20518
- var GEN_AI_CONTENT_ATTRIBUTE_NAMES = /* @__PURE__ */ new Set([
20519
- ...Object.values(GEN_AI_CONTENT_ATTRIBUTES),
20520
- ...Object.values(GEN_AI_CONTENT_ATTRIBUTE_ALIASES).flat()
20521
- ]);
20522
- var GEN_AI_RESPONSE_MODEL = GEN_AI_ATTRIBUTES.responseModel;
20523
-
20524
- // ../shared/dist/chunk-7LZATPNB.mjs
20525
- var AGENT_EXECUTION_STATUSES = [
20526
- "queued",
20527
- "running",
20528
- "paused",
20529
- "completed",
20530
- "failed",
20531
- "cancelled",
20532
- "interrupted"
20533
- ];
20534
- var agentExecutionStatusSchema = external_exports.enum(AGENT_EXECUTION_STATUSES);
20535
- var UNSUCCESSFUL_AGENT_EXECUTION_STATUSES = [
20536
- "failed",
20537
- "cancelled",
20538
- "interrupted",
20539
- "timeout",
20540
- "error"
20541
- ];
20542
- var UNSUCCESSFUL_STATUS_SET = new Set(
20543
- UNSUCCESSFUL_AGENT_EXECUTION_STATUSES
20544
- );
20545
-
20546
- // ../shared/dist/chunk-O334JSPV.mjs
20547
- var CANONICAL_LOG_COLUMN_SET = {
20548
- // @snake-case-ok-start: R2 SQL / Iceberg column naming convention
20549
- event_id: true,
20550
- retention_class: true,
20551
- retention_key: true,
20552
- canonicalized_at: true,
20553
- source_ingest_id: true,
20554
- source_ingest_ts: true
20555
- // @snake-case-ok-end
20556
- };
20557
- var CANONICAL_LOG_COLUMNS = Object.keys(CANONICAL_LOG_COLUMN_SET);
20558
-
20559
- // ../shared/dist/chunk-CTJEYKNH.mjs
20455
+ // ../shared/dist/chunk-XRR5DUKF.mjs
20560
20456
  var BUILTIN_TOOLS_LEAN = [
20561
20457
  { "id": "gpt-image-2-5", "name": "GPT Image 2.5", "category": "image_generation", "providers": ["multi"], "defaultConfig": { "size": "1024x1024", "quality": "low", "outputFormat": "png", "background": "auto" }, "requiresApiKey": true, "executionHint": "platform", "platformKeySupport": true },
20562
20458
  { "id": "gpt-image-2", "name": "GPT Image 2", "category": "image_generation", "providers": ["multi"], "defaultConfig": { "size": "1024x1024", "quality": "low", "outputFormat": "png", "background": "auto" }, "requiresApiKey": true, "executionHint": "platform", "platformKeySupport": true, "hidden": true, "deprecated": true },
@@ -20592,6 +20488,7 @@ var BUILTIN_TOOLS_LEAN = [
20592
20488
  { "id": "browser:get_handoff_state", "name": "Browser Handoff State", "category": "browser", "toolGroup": "browser_use", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "aliases": ["browser-get-handoff-state", "browser:handoff-state"] },
20593
20489
  { "id": "browser:agent", "name": "Run Browser Agent", "category": "browser", "toolGroup": "browser_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "experimental": true, "aliases": ["browser-agent", "browser:task", "browser-task"] },
20594
20490
  { "id": "vector-search", "name": "Semantic Search", "category": "knowledge_retrieval", "providers": ["multi"], "defaultConfig": { "limit": 5, "threshold": 0.3 }, "requiresApiKey": true, "executionHint": "platform", "hasConfigSchema": true },
20491
+ { "id": "typesafe_judge", "name": "TypeSafe judgment", "category": "data_analysis", "providers": ["multi"], "requiresApiKey": true, "executionHint": "platform", "platformKeySupport": true, "hasConfigSchema": true },
20595
20492
  { "id": "search_runtype_docs", "name": "Search Runtype Docs", "category": "knowledge_retrieval", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": false, "experimental": true },
20596
20493
  { "id": "elevenlabs-tts", "name": "ElevenLabs Text-to-Speech", "category": "text_to_speech", "toolGroup": "voice", "providers": ["multi"], "defaultConfig": { "voice_id": "rachel", "model_id": "eleven_multilingual_v2", "stability": 0.5, "similarity_boost": 0.75 }, "requiresApiKey": true, "executionHint": "platform", "platformKeySupport": true, "marginPercent": 20, "hidden": true },
20597
20494
  { "id": "elevenlabs-stt", "name": "ElevenLabs Speech-to-Text", "category": "text_to_speech", "toolGroup": "voice", "providers": ["multi"], "defaultConfig": { "format": "wav", "model_id": "scribe_v2" }, "requiresApiKey": true, "executionHint": "platform", "platformKeySupport": true, "marginPercent": 20, "hidden": true },
@@ -20647,6 +20544,12 @@ var BUILTIN_TOOLS_LEAN = [
20647
20544
  { "id": "write_file", "name": "Write File", "category": "sandbox", "toolGroup": "sandbox_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "hidden": true },
20648
20545
  { "id": "edit_file", "name": "Edit File", "category": "sandbox", "toolGroup": "sandbox_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "hidden": true },
20649
20546
  { "id": "expose_port", "name": "Expose Port", "category": "sandbox", "toolGroup": "sandbox_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "hidden": true },
20547
+ { "id": "agent_session_start", "name": "Start Agent Session", "category": "sandbox", "toolGroup": "sandbox_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "hidden": true },
20548
+ { "id": "agent_session_prompt", "name": "Prompt Agent Session", "category": "sandbox", "toolGroup": "sandbox_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "hidden": true },
20549
+ { "id": "agent_session_status", "name": "Agent Session Status", "category": "sandbox", "toolGroup": "sandbox_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "hidden": true },
20550
+ { "id": "agent_session_events", "name": "Agent Session Events", "category": "sandbox", "toolGroup": "sandbox_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "hidden": true },
20551
+ { "id": "agent_session_cancel", "name": "Cancel Agent Session", "category": "sandbox", "toolGroup": "sandbox_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "hidden": true },
20552
+ { "id": "list_agent_sessions", "name": "List Agent Sessions", "category": "sandbox", "toolGroup": "sandbox_agent", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true, "hidden": true },
20650
20553
  { "id": "send_email", "name": "Send Email", "category": "messaging", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": true },
20651
20554
  { "id": "save_memory", "name": "Save to Memory", "category": "data_management", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": false },
20652
20555
  { "id": "recall_memory", "name": "Recall from Memory", "category": "data_management", "providers": ["multi"], "requiresApiKey": false, "executionHint": "platform", "platformKeySupport": false },
@@ -20821,7 +20724,7 @@ var BuiltInToolGroup = {
20821
20724
  TEMPORAL: "temporal"
20822
20725
  };
20823
20726
 
20824
- // ../shared/dist/chunk-EAURMPCP.mjs
20727
+ // ../shared/dist/chunk-TA7HT5YA.mjs
20825
20728
  var BUILTIN_TOOLS_REGISTRY = BUILTIN_TOOLS_LEAN;
20826
20729
  function formatSystemToolId(tool) {
20827
20730
  const prefix = tool.idPrefix ?? BuiltInToolIdPrefix.BUILTIN;
@@ -20854,8 +20757,14 @@ function isToolCompatibleWithModel(toolId, modelId, provider) {
20854
20757
  return compatibility.models.some((m2) => modelId.includes(m2));
20855
20758
  }
20856
20759
 
20857
- // ../shared/dist/chunk-BEHMNO5J.mjs
20760
+ // ../shared/dist/chunk-FBMBZPAG.mjs
20858
20761
  var MODEL_FAMILY_PROVIDER_IDS = {
20762
+ "arrow-2": {
20763
+ "vercel": "quiverai/arrow-2"
20764
+ },
20765
+ "arrow-2-telos": {
20766
+ "vercel": "quiverai/arrow-2-telos"
20767
+ },
20859
20768
  "claude-fable-5": {
20860
20769
  "anthropic": "claude-fable-5",
20861
20770
  "vercel": "anthropic/claude-fable-5"
@@ -20921,9 +20830,22 @@ var MODEL_FAMILY_PROVIDER_IDS = {
20921
20830
  "anthropic": "claude-opus-5",
20922
20831
  "vercel": "anthropic/claude-opus-5"
20923
20832
  },
20833
+ "claude-opus-5-5": {
20834
+ "anthropic": "claude-opus-5-5",
20835
+ "vercel": "anthropic/claude-opus-5.5"
20836
+ },
20837
+ "claude-opus-5-5-fast": {
20838
+ "vercel": "anthropic/claude-opus-5.5-fast"
20839
+ },
20924
20840
  "claude-opus-5-fast": {
20925
20841
  "vercel": "anthropic/claude-opus-5-fast"
20926
20842
  },
20843
+ "claude-opus-5.5": {
20844
+ "vercel": "anthropic/claude-opus-5.5"
20845
+ },
20846
+ "claude-opus-5.5-fast": {
20847
+ "vercel": "anthropic/claude-opus-5.5-fast"
20848
+ },
20927
20849
  "claude-sonnet-4": {
20928
20850
  "vercel": "anthropic/claude-sonnet-4"
20929
20851
  },
@@ -20963,9 +20885,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
20963
20885
  "deepseek-v4-1-flash": {
20964
20886
  "vercel": "deepseek/deepseek-v4.1-flash"
20965
20887
  },
20966
- "deepseek-v4-1-flash-beta": {
20967
- "vercel": "deepseek/deepseek-v4.1-flash-beta"
20968
- },
20969
20888
  "deepseek-v4-flash": {
20970
20889
  "vercel": "deepseek/deepseek-v4-flash"
20971
20890
  },
@@ -20984,17 +20903,14 @@ var MODEL_FAMILY_PROVIDER_IDS = {
20984
20903
  "deepseek-v4.1-flash": {
20985
20904
  "vercel": "deepseek/deepseek-v4.1-flash"
20986
20905
  },
20987
- "deepseek-v4.1-flash-beta": {
20988
- "vercel": "deepseek/deepseek-v4.1-flash-beta"
20989
- },
20990
- "devstral-2": {
20991
- "vercel": "mistral/devstral-2"
20992
- },
20993
- "devstral-small-2": {
20994
- "vercel": "mistral/devstral-small-2"
20906
+ "fugu-max": {
20907
+ "vercel": "sakana/fugu-max"
20995
20908
  },
20996
20909
  "fugu-ultra": {
20997
- "vercel": "sakana/fugu-ultra"
20910
+ "vercel": "sakana/fugu-ultra-v2"
20911
+ },
20912
+ "fugu-ultra-v2": {
20913
+ "vercel": "sakana/fugu-ultra-v2"
20998
20914
  },
20999
20915
  "gemini-2-5-computer-use-preview-10-2025": {
21000
20916
  "google": "gemini-2.5-computer-use-preview-10-2025"
@@ -21076,6 +20992,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21076
20992
  "google": "gemini-3.8-flash",
21077
20993
  "vercel": "google/gemini-3.8-flash"
21078
20994
  },
20995
+ "gemini-3-8-live": {
20996
+ "vercel": "google/gemini-3.8-live"
20997
+ },
20998
+ "gemini-3-8-live-extended": {
20999
+ "vercel": "google/gemini-3.8-live-extended-thinking"
21000
+ },
21079
21001
  "gemini-3-flash": {
21080
21002
  "google": "gemini-3-flash-preview"
21081
21003
  },
@@ -21131,6 +21053,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21131
21053
  "google": "gemini-3.8-flash",
21132
21054
  "vercel": "google/gemini-3.8-flash"
21133
21055
  },
21056
+ "gemini-3.8-live": {
21057
+ "vercel": "google/gemini-3.8-live"
21058
+ },
21059
+ "gemini-3.8-live-extended-thinking": {
21060
+ "vercel": "google/gemini-3.8-live-extended-thinking"
21061
+ },
21134
21062
  "gemini-embedding-001": {
21135
21063
  "google": "gemini-embedding-001"
21136
21064
  },
@@ -21152,7 +21080,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21152
21080
  "vercel": "google/gemma-4-31b-it"
21153
21081
  },
21154
21082
  "glm-5-2": {
21155
- "mixlayer": "z-ai/glm-5.2",
21156
21083
  "vercel": "zai/glm-5.2"
21157
21084
  },
21158
21085
  "glm-5-2-fast": {
@@ -21168,8 +21095,10 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21168
21095
  "glm-5-3-flash": {
21169
21096
  "vercel": "zai/glm-5.3-flash"
21170
21097
  },
21098
+ "glm-5-3-flashx": {
21099
+ "vercel": "zai/glm-5.3-flashx"
21100
+ },
21171
21101
  "glm-5.2": {
21172
- "mixlayer": "z-ai/glm-5.2",
21173
21102
  "vercel": "zai/glm-5.2"
21174
21103
  },
21175
21104
  "glm-5.2-fast": {
@@ -21185,6 +21114,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21185
21114
  "glm-5.3-flash": {
21186
21115
  "vercel": "zai/glm-5.3-flash"
21187
21116
  },
21117
+ "glm-5.3-flashx": {
21118
+ "vercel": "zai/glm-5.3-flashx"
21119
+ },
21188
21120
  "gpt-4-1": {
21189
21121
  "openai": "gpt-4.1",
21190
21122
  "vercel": "openai/gpt-4.1"
@@ -21465,6 +21397,20 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21465
21397
  "gpt-6-astra-fast": {
21466
21398
  "vercel": "openai/gpt-6-astra-fast"
21467
21399
  },
21400
+ "gpt-6-luna": {
21401
+ "openai": "gpt-6-luna",
21402
+ "vercel": "openai/gpt-6-luna"
21403
+ },
21404
+ "gpt-6-luna-fast": {
21405
+ "vercel": "openai/gpt-6-luna-fast"
21406
+ },
21407
+ "gpt-6-sol": {
21408
+ "openai": "gpt-6-sol",
21409
+ "vercel": "openai/gpt-6-sol"
21410
+ },
21411
+ "gpt-6-sol-fast": {
21412
+ "vercel": "openai/gpt-6-sol-fast"
21413
+ },
21468
21414
  "gpt-image-1-5": {
21469
21415
  "openai": "gpt-image-1.5"
21470
21416
  },
@@ -21474,6 +21420,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21474
21420
  "gpt-image-1.5": {
21475
21421
  "openai": "gpt-image-1.5"
21476
21422
  },
21423
+ "gpt-live-1": {
21424
+ "vercel": "openai/gpt-live-1"
21425
+ },
21477
21426
  "gpt-oss-safeguard-120b": {
21478
21427
  "vercel": "openai/gpt-oss-safeguard-120b"
21479
21428
  },
@@ -21507,6 +21456,10 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21507
21456
  "vercel": "spacexai/grok-4.6",
21508
21457
  "xai": "grok-4.6"
21509
21458
  },
21459
+ "grok-4-7": {
21460
+ "vercel": "spacexai/grok-4.7",
21461
+ "xai": "grok-4.7"
21462
+ },
21510
21463
  "grok-4.20-0309-non-reasoning": {
21511
21464
  "xai": "grok-4.20-0309-non-reasoning"
21512
21465
  },
@@ -21537,6 +21490,10 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21537
21490
  "vercel": "spacexai/grok-4.6",
21538
21491
  "xai": "grok-4.6"
21539
21492
  },
21493
+ "grok-4.7": {
21494
+ "vercel": "spacexai/grok-4.7",
21495
+ "xai": "grok-4.7"
21496
+ },
21540
21497
  "grok-build-0-1": {
21541
21498
  "vercel": "spacexai/grok-build-0.1",
21542
21499
  "xai": "grok-build-0.1"
@@ -21584,27 +21541,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21584
21541
  "interfaze-beta": {
21585
21542
  "vercel": "interfaze/interfaze-beta"
21586
21543
  },
21587
- "kat-coder-air-v2-5": {
21588
- "vercel": "kwaipilot/kat-coder-air-v2.5"
21589
- },
21590
- "kat-coder-air-v2.5": {
21591
- "vercel": "kwaipilot/kat-coder-air-v2.5"
21592
- },
21593
- "kat-coder-pro": {
21594
- "vercel": "kwaipilot/kat-coder-pro-v2"
21595
- },
21596
- "kat-coder-pro-v1": {
21597
- "vercel": "kwaipilot/kat-coder-pro-v1"
21598
- },
21599
- "kat-coder-pro-v2": {
21600
- "vercel": "kwaipilot/kat-coder-pro-v2"
21601
- },
21602
- "kat-coder-pro-v2-5": {
21603
- "vercel": "kwaipilot/kat-coder-pro-v2.5"
21604
- },
21605
- "kat-coder-pro-v2.5": {
21606
- "vercel": "kwaipilot/kat-coder-pro-v2.5"
21607
- },
21608
21544
  "kimi-k2": {
21609
21545
  "vercel": "moonshotai/kimi-k2-thinking"
21610
21546
  },
@@ -21612,7 +21548,7 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21612
21548
  "vercel": "moonshotai/kimi-k2.6"
21613
21549
  },
21614
21550
  "kimi-k2-7-code": {
21615
- "mixlayer": "moonshotai/kimi-k2.7-code"
21551
+ "vercel": "moonshotai/kimi-k2.7-code"
21616
21552
  },
21617
21553
  "kimi-k2-7-code-highspeed": {
21618
21554
  "vercel": "moonshotai/kimi-k2.7-code-highspeed"
@@ -21624,7 +21560,7 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21624
21560
  "vercel": "moonshotai/kimi-k2.6"
21625
21561
  },
21626
21562
  "kimi-k2.7-code": {
21627
- "mixlayer": "moonshotai/kimi-k2.7-code"
21563
+ "vercel": "moonshotai/kimi-k2.7-code"
21628
21564
  },
21629
21565
  "kimi-k2.7-code-highspeed": {
21630
21566
  "vercel": "moonshotai/kimi-k2.7-code-highspeed"
@@ -21656,6 +21592,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21656
21592
  "ling-3-0-flash-sante-free": {
21657
21593
  "vercel": "inclusionai/ling-3.0-flash-sante-free"
21658
21594
  },
21595
+ "ling-3-0-flash-vl": {
21596
+ "vercel": "inclusionai/ling-3.0-flash-vl"
21597
+ },
21598
+ "ling-3-0-flash-vl-free": {
21599
+ "vercel": "inclusionai/ling-3.0-flash-vl-free"
21600
+ },
21659
21601
  "ling-3.0-flash": {
21660
21602
  "vercel": "inclusionai/ling-3.0-flash"
21661
21603
  },
@@ -21665,6 +21607,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21665
21607
  "ling-3.0-flash-sante-free": {
21666
21608
  "vercel": "inclusionai/ling-3.0-flash-sante-free"
21667
21609
  },
21610
+ "ling-3.0-flash-vl": {
21611
+ "vercel": "inclusionai/ling-3.0-flash-vl"
21612
+ },
21613
+ "ling-3.0-flash-vl-free": {
21614
+ "vercel": "inclusionai/ling-3.0-flash-vl-free"
21615
+ },
21668
21616
  "llama-3.1-70b": {
21669
21617
  "vercel": "meta/llama-3.1-70b"
21670
21618
  },
@@ -21713,12 +21661,30 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21713
21661
  "mimo-v2-5-pro": {
21714
21662
  "vercel": "xiaomi/mimo-v2.5-pro"
21715
21663
  },
21664
+ "mimo-v2-6-flash": {
21665
+ "vercel": "xiaomi/mimo-v2.6-flash"
21666
+ },
21667
+ "mimo-v2-6-pro": {
21668
+ "vercel": "xiaomi/mimo-v2.6-pro"
21669
+ },
21670
+ "mimo-v2-6-pro-ultraspeed": {
21671
+ "vercel": "xiaomi/mimo-v2.6-pro-ultraspeed"
21672
+ },
21716
21673
  "mimo-v2.5": {
21717
21674
  "vercel": "xiaomi/mimo-v2.5"
21718
21675
  },
21719
21676
  "mimo-v2.5-pro": {
21720
21677
  "vercel": "xiaomi/mimo-v2.5-pro"
21721
21678
  },
21679
+ "mimo-v2.6-flash": {
21680
+ "vercel": "xiaomi/mimo-v2.6-flash"
21681
+ },
21682
+ "mimo-v2.6-pro": {
21683
+ "vercel": "xiaomi/mimo-v2.6-pro"
21684
+ },
21685
+ "mimo-v2.6-pro-ultraspeed": {
21686
+ "vercel": "xiaomi/mimo-v2.6-pro-ultraspeed"
21687
+ },
21722
21688
  "minimax-m2-7": {
21723
21689
  "vercel": "minimax/minimax-m2.7"
21724
21690
  },
@@ -21833,9 +21799,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21833
21799
  "nova-pro": {
21834
21800
  "vercel": "amazon/nova-pro"
21835
21801
  },
21836
- "pixtral-12b": {
21837
- "vercel": "mistral/pixtral-12b"
21838
- },
21839
21802
  "qwen-3-14b": {
21840
21803
  "vercel": "alibaba/qwen-3-14b"
21841
21804
  },
@@ -21912,15 +21875,15 @@ var MODEL_FAMILY_PROVIDER_IDS = {
21912
21875
  "qwen3-8-flash": {
21913
21876
  "vercel": "alibaba/qwen3.8-flash"
21914
21877
  },
21915
- "qwen3-8-flash-next": {
21916
- "vercel": "alibaba/qwen3.8-flash-next"
21917
- },
21918
21878
  "qwen3-8-max": {
21919
21879
  "vercel": "alibaba/qwen3.8-max"
21920
21880
  },
21921
21881
  "qwen3-8-max-0902": {
21922
21882
  "vercel": "alibaba/qwen3.8-max-0902"
21923
21883
  },
21884
+ "qwen3-8-omni-flash": {
21885
+ "vercel": "alibaba/qwen3.8-omni-flash"
21886
+ },
21924
21887
  "qwen3-coder": {
21925
21888
  "vercel": "alibaba/qwen3-coder"
21926
21889
  },
@@ -22012,15 +21975,15 @@ var MODEL_FAMILY_PROVIDER_IDS = {
22012
21975
  "qwen3.8-flash": {
22013
21976
  "vercel": "alibaba/qwen3.8-flash"
22014
21977
  },
22015
- "qwen3.8-flash-next": {
22016
- "vercel": "alibaba/qwen3.8-flash-next"
22017
- },
22018
21978
  "qwen3.8-max": {
22019
21979
  "vercel": "alibaba/qwen3.8-max"
22020
21980
  },
22021
21981
  "qwen3.8-max-0902": {
22022
21982
  "vercel": "alibaba/qwen3.8-max-0902"
22023
21983
  },
21984
+ "qwen3.8-omni-flash": {
21985
+ "vercel": "alibaba/qwen3.8-omni-flash"
21986
+ },
22024
21987
  "rerank-v3-5": {
22025
21988
  "vercel": "cohere/rerank-v3.5"
22026
21989
  },
@@ -22033,6 +21996,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
22033
21996
  "rerank-v4-pro": {
22034
21997
  "vercel": "cohere/rerank-v4-pro"
22035
21998
  },
21999
+ "schematron-v2-small": {
22000
+ "vercel": "inference-net/schematron-v2-small"
22001
+ },
22002
+ "schematron-v2-turbo": {
22003
+ "vercel": "inference-net/schematron-v2-turbo"
22004
+ },
22036
22005
  "seed-1-6": {
22037
22006
  "vercel": "bytedance/seed-1.6"
22038
22007
  },
@@ -22045,6 +22014,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
22045
22014
  "seed-1.8": {
22046
22015
  "vercel": "bytedance/seed-1.8"
22047
22016
  },
22017
+ "seed-2-1-turbo": {
22018
+ "vercel": "bytedance/seed-2.1-turbo"
22019
+ },
22020
+ "seed-2.1-turbo": {
22021
+ "vercel": "bytedance/seed-2.1-turbo"
22022
+ },
22048
22023
  "sonar": {
22049
22024
  "vercel": "perplexity/sonar"
22050
22025
  },
@@ -22066,6 +22041,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
22066
22041
  "step-3.7-flash": {
22067
22042
  "vercel": "stepfun/step-3.7-flash"
22068
22043
  },
22044
+ "step-5": {
22045
+ "vercel": "stepfun/step-5-preview"
22046
+ },
22047
+ "step-5-preview": {
22048
+ "vercel": "stepfun/step-5-preview"
22049
+ },
22069
22050
  "text-embedding-3-large": {
22070
22051
  "openai": "text-embedding-3-large"
22071
22052
  },
@@ -22075,6 +22056,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
22075
22056
  "text-embedding-ada-002": {
22076
22057
  "openai": "text-embedding-ada-002"
22077
22058
  },
22059
+ "toast-1": {
22060
+ "vercel": "mixedbread/toast-1"
22061
+ },
22078
22062
  "trinity-large": {
22079
22063
  "vercel": "arcee-ai/trinity-large-thinking"
22080
22064
  },
@@ -22296,10 +22280,10 @@ var PROVIDER_ROUTING_CONFIG = {
22296
22280
  ],
22297
22281
  fallback: ["vercel"]
22298
22282
  },
22299
- // WHY(docs/why/packages/shared/src.md#kimi-k2-7-code-routes-via-mixlayer-since-vercel): Kimi K2.7 Code routes via Mixlayer since Vercel renamed its listing and Workers AI dropped from models.dev in
22283
+ // WHY(docs/why/packages/shared/src.md#kimi-k2-7-code-routes-via-vercel-after-catalog-refresh): Vercel lists Kimi K2.7 Code; Workers AI is the fallback.
22300
22284
  "kimi-k2.7-code": {
22301
22285
  providers: [
22302
- { provider: "mixlayer", weight: 100 }
22286
+ { provider: "vercel", weight: 100 }
22303
22287
  ],
22304
22288
  fallback: ["workers-ai"]
22305
22289
  },
@@ -22322,24 +22306,24 @@ var PROVIDER_ROUTING_CONFIG = {
22322
22306
  ],
22323
22307
  fallback: ["workers-ai"]
22324
22308
  },
22325
- // WHY(docs/why/packages/shared/src.md#glm-5-2-chains-workers-ai-then-mixlayer-then-ver): GLM-5.2 chains Workers AI, then Mixlayer, then Vercel so a rate-limit/capacity failure fast-fails to the next
22309
+ // WHY(docs/why/packages/shared/src.md#glm-5-2-chains-workers-ai-then-vercel): Mixlayer no longer lists GLM-5.2.
22326
22310
  "glm-5.2": {
22327
22311
  providers: [
22328
22312
  { provider: "workers-ai", weight: 100 }
22329
22313
  ],
22330
- fallback: ["mixlayer", "vercel"]
22314
+ fallback: ["vercel"]
22331
22315
  },
22332
22316
  "glm-5-2": {
22333
22317
  providers: [
22334
22318
  { provider: "workers-ai", weight: 100 }
22335
22319
  ],
22336
- fallback: ["mixlayer", "vercel"]
22320
+ fallback: ["vercel"]
22337
22321
  },
22338
22322
  "zai/glm-5.2": {
22339
22323
  providers: [
22340
22324
  { provider: "workers-ai", weight: 100 }
22341
22325
  ],
22342
- fallback: ["mixlayer", "vercel"]
22326
+ fallback: ["vercel"]
22343
22327
  },
22344
22328
  // WHY(docs/why/packages/shared/src.md#deepseek-v4-pros-slash-forms-are-direct-provider): DeepSeek V4 Pro's slash forms are DIRECT provider ids, so an explicit entry is needed to win over
22345
22329
  "deepseek-v4-pro": {
@@ -22416,20 +22400,17 @@ var MANUAL_PROVIDER_MAP_OVERRIDES = {
22416
22400
  "gpt-5-4-nano": {
22417
22401
  "cloudflare": "openai/gpt-5.4-nano"
22418
22402
  },
22419
- // WHY(docs/why/packages/shared/src.md#every-glm-5-2-id-form-shares-the-same-per-provid): Every GLM-5.2 id form shares the same per-provider ids, matching the ordered fallback chain in
22403
+ // WHY(docs/why/packages/shared/src.md#glm-5-2-chains-workers-ai-then-vercel): Both GLM-5.2 providers retain explicit IDs.
22420
22404
  "glm-5.2": {
22421
22405
  "workers-ai": "@cf/zai-org/glm-5.2",
22422
- "mixlayer": "z-ai/glm-5.2",
22423
22406
  "vercel": "zai/glm-5.2"
22424
22407
  },
22425
22408
  "glm-5-2": {
22426
22409
  "workers-ai": "@cf/zai-org/glm-5.2",
22427
- "mixlayer": "z-ai/glm-5.2",
22428
22410
  "vercel": "zai/glm-5.2"
22429
22411
  },
22430
22412
  "zai/glm-5.2": {
22431
22413
  "workers-ai": "@cf/zai-org/glm-5.2",
22432
- "mixlayer": "z-ai/glm-5.2",
22433
22414
  "vercel": "zai/glm-5.2"
22434
22415
  },
22435
22416
  // WHY(docs/why/packages/shared/src.md#deepseek-v4-pros-slash-forms-need-an-explicit-ve-2): DeepSeek V4 Pro's slash forms need an explicit vercel id or getDefaultProviderMapping would synthesize a
@@ -22650,7 +22631,7 @@ function isSupportedElicitationSchema(schema) {
22650
22631
  return parsed.success && typeof parsed.data !== "boolean" && parsed.data.type === "object";
22651
22632
  }
22652
22633
 
22653
- // ../shared/dist/chunk-BSGZYLLL.mjs
22634
+ // ../shared/dist/chunk-E4UB4YQO.mjs
22654
22635
  var primitiveSchema = external_exports.strictObject({
22655
22636
  type: external_exports.enum(["string", "number", "integer", "boolean"]),
22656
22637
  title: external_exports.string().optional(),
@@ -22919,6 +22900,9 @@ var ExecuteToolSchema = external_exports.object({
22919
22900
  // WHY(docs/why/packages/shared/src.md#toolid-is-optional-here-so-mcp-sdk-callers-sendi): toolId is optional here so MCP/SDK callers sending only {parameters} aren't rejected at validation
22920
22901
  toolId: external_exports.string().optional(),
22921
22902
  parameters: external_exports.record(external_exports.string(), external_exports.any()),
22903
+ toolConfig: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
22904
+ "Built-in tools only: the instance config an agent's toolConfigs entry would carry, validated against the tool's configSchema. Rejected for a saved tool."
22905
+ ),
22922
22906
  context: external_exports.object({
22923
22907
  flowExecutionId: external_exports.string().optional(),
22924
22908
  stepId: external_exports.string().optional(),
@@ -23007,13 +22991,18 @@ function isDataConnectionToolId(toolId) {
23007
22991
  return toolId.startsWith("dc:");
23008
22992
  }
23009
22993
 
23010
- // ../shared/dist/chunk-HQXZXXZZ.mjs
22994
+ // ../shared/dist/chunk-OEUGY3JM.mjs
23011
22995
  function sanitizeToolNameForAiSdk(name) {
23012
22996
  return name.replace(/[^a-zA-Z0-9_]/g, "_").toLowerCase().replace(/_+/g, "_").replace(/^_|_$/g, "");
23013
22997
  }
22998
+ function modelVisibleToolName(toolId) {
22999
+ return sanitizeToolNameForAiSdk(toolId.replace(/^(builtin|platform):/, ""));
23000
+ }
23014
23001
  function toolNamesCollideForAiSdk(left, right) {
23015
23002
  return sanitizeToolNameForAiSdk(left) === sanitizeToolNameForAiSdk(right);
23016
23003
  }
23004
+
23005
+ // ../shared/dist/chunk-DK4YWFCU.mjs
23017
23006
  var RUNTYPE_SET_STATE_TOOL_NAME = "runtype_set_state";
23018
23007
  function isReservedRuntypeToolName(name) {
23019
23008
  return toolNamesCollideForAiSdk(name, RUNTYPE_SET_STATE_TOOL_NAME);
@@ -23299,6 +23288,290 @@ var resolvedEdgeAuthSnapshotSchema = edgeAuthSnapshotSchema.extend({
23299
23288
  var CONTAINER_SANDBOX_INSTANCE_TYPE = "standard-4";
23300
23289
  var MAX_SANDBOX_EXECUTE_CONTAINMENT_WINDOW_MS = 30 * 60 * 1e3;
23301
23290
 
23291
+ // ../shared/dist/chunk-2NMGSD35.mjs
23292
+ var GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
23293
+ var GEN_AI_AGENT_ID = "gen_ai.agent.id";
23294
+ var GEN_AI_AGENT_NAME = "gen_ai.agent.name";
23295
+ var GEN_AI_CONVERSATION_ID = "gen_ai.conversation.id";
23296
+ var GEN_AI_REQUEST_MODEL = "gen_ai.request.model";
23297
+ var GEN_AI_RESPONSE_MODEL_NAME = "gen_ai.response.model";
23298
+ var GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens";
23299
+ var GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
23300
+ var GEN_AI_USAGE_CACHE_READ_TOKENS = "gen_ai.usage.cache_read.input_tokens";
23301
+ var GEN_AI_USAGE_CACHE_CREATION_TOKENS = "gen_ai.usage.cache_creation.input_tokens";
23302
+ var GEN_AI_TOOL_NAME = "gen_ai.tool.name";
23303
+ var GEN_AI_TOOL_TYPE = "gen_ai.tool.type";
23304
+ var GEN_AI_TOOL_CALL_ID = "gen_ai.tool.call.id";
23305
+ var GEN_AI_ATTRIBUTES = {
23306
+ operationName: GEN_AI_OPERATION_NAME,
23307
+ agentId: GEN_AI_AGENT_ID,
23308
+ agentName: GEN_AI_AGENT_NAME,
23309
+ conversationId: GEN_AI_CONVERSATION_ID,
23310
+ requestModel: GEN_AI_REQUEST_MODEL,
23311
+ usageInputTokens: GEN_AI_USAGE_INPUT_TOKENS,
23312
+ usageOutputTokens: GEN_AI_USAGE_OUTPUT_TOKENS,
23313
+ /** Input tokens served from the provider's prompt cache, when the provider reports them. */
23314
+ usageCacheReadTokens: GEN_AI_USAGE_CACHE_READ_TOKENS,
23315
+ /** Input tokens written INTO the provider's prompt cache, when the provider reports them. */
23316
+ usageCacheCreationTokens: GEN_AI_USAGE_CACHE_CREATION_TOKENS,
23317
+ /** The model the provider reported having SERVED; the more accurate one to price. */
23318
+ responseModel: GEN_AI_RESPONSE_MODEL_NAME,
23319
+ toolName: GEN_AI_TOOL_NAME,
23320
+ toolType: GEN_AI_TOOL_TYPE,
23321
+ toolCallId: GEN_AI_TOOL_CALL_ID
23322
+ };
23323
+
23324
+ // ../shared/dist/chunk-4Y2IGOAU.mjs
23325
+ var RUNTYPE_ITERATION = "runtype.iteration";
23326
+ var RUNTYPE_TOTAL_COST = "runtype.total_cost";
23327
+ var RUNTYPE_TURN_INDEX = "runtype.turn.index";
23328
+ var RUNTYPE_LEGACY_ATTRIBUTE_ALIASES = {
23329
+ [RUNTYPE_ITERATION]: ["runtype.agent.iteration"],
23330
+ [RUNTYPE_TOTAL_COST]: ["runtype.agent.totalCost"],
23331
+ [RUNTYPE_TURN_INDEX]: ["runtype.agent.turnIndex"]
23332
+ };
23333
+ var GEN_AI_TOOL_CALL_ARGUMENTS = "gen_ai.tool.call.arguments";
23334
+ var GEN_AI_TOOL_CALL_RESULT = "gen_ai.tool.call.result";
23335
+ var GEN_AI_INPUT_MESSAGES = "gen_ai.input.messages";
23336
+ var GEN_AI_OUTPUT_MESSAGES = "gen_ai.output.messages";
23337
+ var GEN_AI_CONTENT_ATTRIBUTES = {
23338
+ /** Chat history sent to the model, as semconv structured messages. */
23339
+ inputMessages: GEN_AI_INPUT_MESSAGES,
23340
+ /** Messages the model produced (includes reasoning content parts). */
23341
+ outputMessages: GEN_AI_OUTPUT_MESSAGES,
23342
+ /** System instructions, when separate from the input messages. */
23343
+ systemInstructions: "gen_ai.system_instructions",
23344
+ /** `execute_tool` span: the arguments the tool was called with. */
23345
+ toolCallArguments: GEN_AI_TOOL_CALL_ARGUMENTS,
23346
+ /** `execute_tool` span: the result the tool returned. */
23347
+ toolCallResult: GEN_AI_TOOL_CALL_RESULT
23348
+ };
23349
+ var GEN_AI_CONTENT_ATTRIBUTE_ALIASES = {
23350
+ [GEN_AI_INPUT_MESSAGES]: ["ai.prompt.messages", "ai.prompt"],
23351
+ [GEN_AI_OUTPUT_MESSAGES]: ["ai.response.text", "ai.response.object"],
23352
+ [GEN_AI_TOOL_CALL_ARGUMENTS]: ["flue.tool.call.arguments", "ai.toolCall.args"],
23353
+ [GEN_AI_TOOL_CALL_RESULT]: ["flue.tool.call.result", "ai.toolCall.result"]
23354
+ };
23355
+ var OPENINFERENCE_CONTENT_PREFIXES = [
23356
+ "llm.input_messages.",
23357
+ "llm.output_messages.",
23358
+ "llm.prompts",
23359
+ "llm.prompt_template.",
23360
+ "llm.choices",
23361
+ "llm.function_call",
23362
+ "retrieval.documents.",
23363
+ "embedding.embeddings.",
23364
+ "input.value",
23365
+ "output.value"
23366
+ ];
23367
+ var AI_SDK_CONTENT_PREFIXES = ["ai.response.toolCalls"];
23368
+ var MASTRA_CONTENT_PREFIXES = ["mastra.metadata.body"];
23369
+ var CLOUDFLARE_AGENTS_CONTENT_PREFIXES = [
23370
+ "cloudflare.agents.metadata.",
23371
+ "cloudflare.agents.runtime_context."
23372
+ ];
23373
+ var GEN_AI_CONTENT_ATTRIBUTE_PREFIXES = [
23374
+ ...OPENINFERENCE_CONTENT_PREFIXES,
23375
+ ...AI_SDK_CONTENT_PREFIXES,
23376
+ ...MASTRA_CONTENT_PREFIXES,
23377
+ ...CLOUDFLARE_AGENTS_CONTENT_PREFIXES
23378
+ ];
23379
+ var GEN_AI_CONTENT_ATTRIBUTE_NAMES = /* @__PURE__ */ new Set([
23380
+ ...Object.values(GEN_AI_CONTENT_ATTRIBUTES),
23381
+ ...Object.values(GEN_AI_CONTENT_ATTRIBUTE_ALIASES).flat()
23382
+ ]);
23383
+ var GEN_AI_RESPONSE_MODEL = GEN_AI_ATTRIBUTES.responseModel;
23384
+
23385
+ // ../shared/dist/chunk-5G3ILWR3.mjs
23386
+ var AGENT_EXECUTION_STATUSES = [
23387
+ "queued",
23388
+ "running",
23389
+ "paused",
23390
+ "completed",
23391
+ "failed",
23392
+ "cancelled",
23393
+ "interrupted"
23394
+ ];
23395
+ var agentExecutionStatusSchema = external_exports.enum(AGENT_EXECUTION_STATUSES);
23396
+ var UNSUCCESSFUL_AGENT_EXECUTION_STATUSES = [
23397
+ "failed",
23398
+ "cancelled",
23399
+ "interrupted",
23400
+ "timeout",
23401
+ "error"
23402
+ ];
23403
+ var UNSUCCESSFUL_STATUS_SET = new Set(
23404
+ UNSUCCESSFUL_AGENT_EXECUTION_STATUSES
23405
+ );
23406
+
23407
+ // ../shared/dist/chunk-HFRQSSJJ.mjs
23408
+ var MANAGED_INGRESS_LIMITS = Object.freeze({
23409
+ requestBodyBytes: 10 * 1024 * 1024,
23410
+ responseBodyBytes: 25 * 1024 * 1024,
23411
+ upstreamHeaderTimeoutMs: 6e4,
23412
+ totalRequestMs: 5 * 6e4
23413
+ });
23414
+ var MANAGED_INGRESS_PORT_HEADER = "x-runtype-managed-port";
23415
+ var MANAGED_INGRESS_TOKEN_PREFIX = "sbdt_";
23416
+ var MANAGED_INGRESS_TOKEN_DISPLAY_LENGTH = MANAGED_INGRESS_TOKEN_PREFIX.length + 6;
23417
+ var MANAGED_INGRESS_STRIPPED_REQUEST_HEADERS = Object.freeze([
23418
+ "cf-connecting-ip",
23419
+ "cf-ray",
23420
+ "cf-worker",
23421
+ "true-client-ip",
23422
+ "x-daytona-preview-token",
23423
+ "x-forwarded-for",
23424
+ "x-forwarded-host",
23425
+ "x-forwarded-proto",
23426
+ "x-real-ip",
23427
+ "x-runtype-deployment-generation",
23428
+ "x-runtype-deployment-id",
23429
+ "x-runtype-deployment-token",
23430
+ "x-runtype-ingress",
23431
+ "x-runtype-internal",
23432
+ MANAGED_INGRESS_PORT_HEADER
23433
+ ]);
23434
+ var MANAGED_INGRESS_HOP_BY_HOP_HEADERS = Object.freeze([
23435
+ "connection",
23436
+ "keep-alive",
23437
+ "proxy-authenticate",
23438
+ "proxy-authorization",
23439
+ "te",
23440
+ "trailer",
23441
+ "transfer-encoding",
23442
+ "upgrade"
23443
+ ]);
23444
+ var MANAGED_INGRESS_STRIPPED_RESPONSE_HEADERS = Object.freeze([
23445
+ "access-control-allow-credentials",
23446
+ "access-control-allow-headers",
23447
+ "access-control-allow-methods",
23448
+ "access-control-allow-origin",
23449
+ "content-length"
23450
+ ]);
23451
+ var MANAGED_INGRESS_RESERVED_PORTS = Object.freeze([
23452
+ 22,
23453
+ 2375,
23454
+ 2376,
23455
+ 6443,
23456
+ 8787,
23457
+ 8789,
23458
+ 9229,
23459
+ 9300
23460
+ ]);
23461
+
23462
+ // ../shared/dist/chunk-FDEVW22I.mjs
23463
+ var MANAGED_SANDBOX_STAGES = [
23464
+ "apply-policies",
23465
+ "destroy-sandbox",
23466
+ "ensure-sandbox",
23467
+ "inspect-process",
23468
+ "inspect-sandbox",
23469
+ "install-dependencies",
23470
+ "resolve-ingress",
23471
+ "start-process",
23472
+ "stop-process",
23473
+ "stop-sandbox",
23474
+ "verify-runtime",
23475
+ "wake-sandbox",
23476
+ "write-bundle"
23477
+ ];
23478
+ var STAGE_VOCABULARY = new Set(MANAGED_SANDBOX_STAGES);
23479
+ var MANAGED_DEPLOYMENT_STAGE_PLAN = Object.freeze({
23480
+ create: Object.freeze([
23481
+ "ensure-sandbox",
23482
+ "apply-policies",
23483
+ "verify-runtime",
23484
+ "write-bundle",
23485
+ "install-dependencies",
23486
+ "start-process",
23487
+ "resolve-ingress"
23488
+ ]),
23489
+ update: Object.freeze([
23490
+ "ensure-sandbox",
23491
+ "apply-policies",
23492
+ "verify-runtime",
23493
+ "write-bundle",
23494
+ "install-dependencies",
23495
+ "start-process",
23496
+ "resolve-ingress"
23497
+ ]),
23498
+ resume: Object.freeze(["wake-sandbox", "start-process", "resolve-ingress"]),
23499
+ suspend: Object.freeze(["stop-process", "stop-sandbox"]),
23500
+ // INVARIANT: Containment for an idle stop is the CONFIRMED whole-sandbox stop, never a process-only claim.
23501
+ sleep: Object.freeze(["stop-sandbox"]),
23502
+ destroy: Object.freeze(["stop-process", "destroy-sandbox"]),
23503
+ expire: Object.freeze(["stop-process", "destroy-sandbox"]),
23504
+ // INVARIANT: Reconcile before destroying, and never create, wake or launch to clean a retained generation up.
23505
+ cleanup: Object.freeze(["inspect-sandbox", "destroy-sandbox"]),
23506
+ recover: Object.freeze([]),
23507
+ renew: Object.freeze([])
23508
+ });
23509
+ var MANAGED_STAGE_REQUIRED_CAPABILITY = Object.freeze({
23510
+ "apply-policies": "network-policy",
23511
+ "destroy-sandbox": "terminate:sandbox-destroy",
23512
+ "install-dependencies": "rebuild",
23513
+ "resolve-ingress": "private-ingress",
23514
+ "start-process": "process-adoption",
23515
+ "stop-process": "terminate:process-tree",
23516
+ "stop-sandbox": "terminate:sandbox-stop",
23517
+ "verify-runtime": "rebuild",
23518
+ "wake-sandbox": "wake",
23519
+ "write-bundle": "rebuild"
23520
+ });
23521
+ var MANAGED_HEALTH_PROBE_LIMITS = Object.freeze({
23522
+ /** One dedicated probe, connect through response headers, may take this long. */
23523
+ timeoutMs: 2e3,
23524
+ /** An HTTP probe reads at most this much body before cancelling the rest. */
23525
+ responseBodyBytes: 4 * 1024,
23526
+ /**
23527
+ * Below this much remaining budget the check is not run at all: the control
23528
+ * plane spent the probe's time, and a check that could only time out would
23529
+ * be counted as the application's failure.
23530
+ */
23531
+ minimumBudgetMs: 500
23532
+ });
23533
+ var MANAGED_SANDBOX_LABEL_KEYS = Object.freeze({
23534
+ managed: "runtype.managed",
23535
+ organization: "runtype.organization",
23536
+ deployment: "runtype.deployment",
23537
+ generation: "runtype.generation"
23538
+ });
23539
+
23540
+ // ../shared/dist/chunk-CTYT2JKN.mjs
23541
+ var MANAGED_HEALTH_LIMITS = Object.freeze({
23542
+ /** Probes are due this often while compute is expected to be awake. */
23543
+ probeIntervalMs: 3e4,
23544
+ /** Distinct consecutive failed dedicated probes before recovery is requested. */
23545
+ failuresBeforeRecovery: 3,
23546
+ /**
23547
+ * How long one in-flight probe holds its coordinator admission. The probe
23548
+ * itself ends at `MANAGED_HEALTH_PROBE_LIMITS.timeoutMs`; the margin covers
23549
+ * the RPC hop, and a completion nobody delivered is settled at this expiry.
23550
+ */
23551
+ probeAdmissionMs: MANAGED_HEALTH_PROBE_LIMITS.timeoutMs + 3e3,
23552
+ /**
23553
+ * Evidence older than this cannot authorize recovery: the runtime it
23554
+ * describes may have been replaced or repaired since. Equal to the operation
23555
+ * deadline, so a recovery accepted on fresh evidence still reads it when the
23556
+ * coordinator advances it late.
23557
+ */
23558
+ evidenceFreshnessMs: 10 * 6e4,
23559
+ /** After a refused recovery request the supervisor waits this long before it may ask again. */
23560
+ recoveryRefusedHoldMs: 5 * 6e4
23561
+ });
23562
+ var managedHealthEvidenceSchema = external_exports.object({
23563
+ kind: external_exports.enum(["probe_failures", "process_exited"]),
23564
+ consecutiveFailures: external_exports.number().int().nonnegative(),
23565
+ providerGeneration: external_exports.number().int().nonnegative(),
23566
+ runtimeEpoch: external_exports.number().int().nonnegative(),
23567
+ launchId: external_exports.string().min(1).nullable(),
23568
+ /** The key of the health configuration the probes ran under. */
23569
+ checkKey: external_exports.string().min(1),
23570
+ /** Epoch ms of the observation that completed the evidence. */
23571
+ observedAtMs: external_exports.number().int().nonnegative(),
23572
+ detail: external_exports.string().max(2e3)
23573
+ }).strict();
23574
+
23302
23575
  // ../shared/dist/chunk-KNCWLVL2.mjs
23303
23576
  var MANAGED_SANDBOX_CAPABILITIES = [
23304
23577
  "inspect-without-start",
@@ -23332,69 +23605,6 @@ var MANAGED_DEPLOYMENT_SOURCE_LIMITS = {
23332
23605
  maxRegularFiles: 1e3
23333
23606
  };
23334
23607
 
23335
- // ../shared/dist/chunk-NBGTI2DK.mjs
23336
- var apiReleaseChannelSchema = external_exports.enum(["staging", "production"]);
23337
- var API_ARTIFACT_SCRIPT_PATTERN = /^api-[a-z0-9][a-z0-9-]{0,62}$/;
23338
- var apiArtifactScriptNameSchema = external_exports.string().regex(
23339
- API_ARTIFACT_SCRIPT_PATTERN,
23340
- "API artifact script names look like api-<sha12> or api-<sha12>-<suffix> (lowercase alphanumeric and dashes)"
23341
- );
23342
- var RUNTIME_ARTIFACT_SCRIPT_PATTERN = /^rt-[a-z0-9][a-z0-9-]{0,80}$/;
23343
- var runtimeArtifactScriptNameSchema = external_exports.string().regex(
23344
- RUNTIME_ARTIFACT_SCRIPT_PATTERN,
23345
- "Runtime artifact script names look like rt-<namespace>-<flow|agent>-<hash> (lowercase alphanumeric and dashes)"
23346
- );
23347
- var apiHeaderOverrideModeSchema = external_exports.enum(["open", "token"]);
23348
- var apiArtifactStatusSchema = external_exports.enum([
23349
- "uploaded",
23350
- "active",
23351
- "superseded",
23352
- "pinned",
23353
- "failed",
23354
- "deleted"
23355
- ]);
23356
- var apiCanaryConfigSchema = external_exports.object({
23357
- script: apiArtifactScriptNameSchema,
23358
- percent: external_exports.number().int().min(1).max(100)
23359
- });
23360
- var apiRoutingDocSchema = external_exports.object({
23361
- version: external_exports.number().int().nonnegative(),
23362
- updatedAt: external_exports.string().min(1),
23363
- api: external_exports.object({
23364
- activeScript: apiArtifactScriptNameSchema.nullable(),
23365
- previousScript: apiArtifactScriptNameSchema.nullable(),
23366
- canary: apiCanaryConfigSchema.nullable(),
23367
- pinsEnabled: external_exports.boolean(),
23368
- legacyFallback: external_exports.boolean(),
23369
- headerOverride: apiHeaderOverrideModeSchema,
23370
- // WHY(docs/why/packages/shared/src.md#otlp-fast-lane-when-true-the-dispatch-worker-ter): OTLP fast lane: when true, the dispatch worker terminates `/v1/otel/*` at the standalone
23371
- /** OTLP fast lane: when true, the dispatch worker terminates `/v1/otel/*` at the standalone `runtype-otel-ingest` worker instead of resolving an API artifact (apps/api-dispatch/src/otel-lane.ts; docs/features/planning/2026-08-12-otel-ingest-worker.md, increment 3). */
23372
- otelIngest: external_exports.boolean().optional()
23373
- })
23374
- }).refine((doc) => doc.api.activeScript !== null || doc.api.legacyFallback, {
23375
- message: "activeScript may only be null while legacyFallback is true",
23376
- path: ["api", "activeScript"]
23377
- });
23378
- var edgeContextPayloadSchema = external_exports.object({
23379
- /** Resolved Runtype user id (`user_…`). */
23380
- userId: external_exports.string().min(1),
23381
- /** Resolved org id (`org_…`); null for a personal (no-org) credential. */
23382
- orgId: external_exports.string().min(1).nullable(),
23383
- /** Effective permission scopes for the credential (e.g. `["*"]`). */
23384
- scopes: external_exports.array(external_exports.string()),
23385
- /** Token id (one per mint) — replay/audit handle, never reused as a secret. */
23386
- jti: external_exports.string().min(1),
23387
- /** Expiry as epoch MILLISECONDS; the token is rejected once `exp <= now`. */
23388
- exp: external_exports.number().int().positive()
23389
- });
23390
-
23391
- // ../shared/dist/chunk-ZGF3GAF7.mjs
23392
- var DEFAULT_FLOW_TIMEOUT_MS = 15 * 60 * 1e3;
23393
- var ASYNC_REPLAY_AGENT_LANE_BUDGET_MS = 10 * 60 * 1e3;
23394
- var DEFAULT_AGENT_WALL_CLOCK_TIMEOUT_MS = 5 * 60 * 1e3;
23395
- var ATTACHED_DISPATCH_STEP_TIMEOUT_MAX_MS = 10 * 60 * 1e3;
23396
- var ASYNC_DISPATCH_TIMEOUT_MAX_MS = 30 * 60 * 1e3;
23397
-
23398
23608
  // ../shared/dist/chunk-RT5M2CMG.mjs
23399
23609
  var EMBEDDING_COST_PER_1K_TOKENS = Object.freeze({
23400
23610
  "text-embedding-3-small": 2e-5,
@@ -23519,7 +23729,288 @@ var WEAVIATE_VECTORIZER_MODELS = Object.freeze({
23519
23729
  })
23520
23730
  });
23521
23731
 
23522
- // ../shared/dist/chunk-2F2C3Q7I.mjs
23732
+ // ../shared/dist/chunk-FFGBEV63.mjs
23733
+ var JUDGMENT_CHOICE_MAX_OPTIONS = 255;
23734
+ var JUDGMENT_SCORE_MIN_LEVELS = 2;
23735
+ var JUDGMENT_SCORE_MAX_LEVELS = 10;
23736
+
23737
+ // ../shared/dist/chunk-CEATEZAQ.mjs
23738
+ var judgmentJsonValueSchema = external_exports.lazy(
23739
+ () => external_exports.union([
23740
+ external_exports.null(),
23741
+ external_exports.string(),
23742
+ external_exports.number(),
23743
+ external_exports.boolean(),
23744
+ external_exports.record(external_exports.string(), judgmentJsonValueSchema.optional()),
23745
+ external_exports.array(judgmentJsonValueSchema).readonly()
23746
+ ])
23747
+ );
23748
+ var judgmentInputSchema = external_exports.union([
23749
+ external_exports.string(),
23750
+ external_exports.record(external_exports.string(), judgmentJsonValueSchema.optional()),
23751
+ external_exports.array(judgmentJsonValueSchema).readonly()
23752
+ ]);
23753
+ var judgmentDescriptionSchema = judgmentInputSchema.nullable();
23754
+ var judgmentBooleanQuestionSchema = external_exports.strictObject({
23755
+ type: external_exports.literal("boolean"),
23756
+ instructions: judgmentInputSchema,
23757
+ criteria: external_exports.strictObject({
23758
+ true: judgmentDescriptionSchema.optional(),
23759
+ false: judgmentDescriptionSchema.optional()
23760
+ }).optional()
23761
+ });
23762
+ var judgmentChoiceQuestionSchema = external_exports.strictObject({
23763
+ type: external_exports.literal("choice"),
23764
+ instructions: judgmentInputSchema,
23765
+ criteria: external_exports.record(external_exports.string(), judgmentDescriptionSchema)
23766
+ });
23767
+ var judgmentScoreQuestionSchema = external_exports.strictObject({
23768
+ type: external_exports.literal("score"),
23769
+ instructions: judgmentInputSchema,
23770
+ criteria: external_exports.array(judgmentDescriptionSchema).readonly()
23771
+ });
23772
+ var JUDGMENT_BOOLEAN_TYPE_ALIAS = "noul";
23773
+ function foldBooleanAlias(value) {
23774
+ if (typeof value === "object" && value !== null && !Array.isArray(value) && value.type === JUDGMENT_BOOLEAN_TYPE_ALIAS) {
23775
+ return { ...value, type: "boolean" };
23776
+ }
23777
+ return value;
23778
+ }
23779
+ var judgmentQuestionSchema = external_exports.preprocess(
23780
+ foldBooleanAlias,
23781
+ external_exports.discriminatedUnion("type", [
23782
+ judgmentBooleanQuestionSchema,
23783
+ judgmentChoiceQuestionSchema,
23784
+ judgmentScoreQuestionSchema
23785
+ ])
23786
+ );
23787
+ var unitIntervalSchema = external_exports.number().min(0).max(1);
23788
+ var distributionSchema = external_exports.record(external_exports.string(), unitIntervalSchema);
23789
+ var judgmentBooleanAnswerSchema = external_exports.object({
23790
+ type: external_exports.literal("boolean"),
23791
+ probability: unitIntervalSchema
23792
+ });
23793
+ var judgmentChoiceAnswerSchema = external_exports.object({
23794
+ type: external_exports.literal("choice"),
23795
+ choice: external_exports.string(),
23796
+ probabilities: distributionSchema.optional()
23797
+ });
23798
+ var judgmentScoreAnswerSchema = external_exports.object({
23799
+ type: external_exports.literal("score"),
23800
+ score: external_exports.number().min(0),
23801
+ probabilities: distributionSchema.optional()
23802
+ });
23803
+ var judgmentAnswerSchema = external_exports.discriminatedUnion("type", [
23804
+ judgmentBooleanAnswerSchema,
23805
+ judgmentChoiceAnswerSchema,
23806
+ judgmentScoreAnswerSchema
23807
+ ]);
23808
+ var judgmentAnswersSchema = external_exports.record(external_exports.string(), judgmentAnswerSchema);
23809
+ var judgmentQuestionMessages = {
23810
+ noQuestions: () => "A judgment needs at least one question.",
23811
+ notObject: (id) => `Question "${id}" must be an object with a type and instructions.`,
23812
+ unknownType: (id, type) => `Question "${id}" has type ${JSON.stringify(type) ?? "undefined"}, but the type must be "boolean", "choice" or "score".`,
23813
+ instructionsMissing: (id) => `Question "${id}" needs instructions, because the question's name is never sent to the model.`,
23814
+ choiceCriteriaEmpty: (id) => `Choice question "${id}" needs criteria as a non-empty map of option labels to descriptions.`,
23815
+ choiceTooManyOptions: (id, count) => `Choice question "${id}" has ${count} options, but a choice question accepts at most ${JUDGMENT_CHOICE_MAX_OPTIONS}.`,
23816
+ scoreLevelCount: (id, count) => count === void 0 ? `Score question "${id}" needs criteria as an ordered list of ${JUDGMENT_SCORE_MIN_LEVELS} to ${JUDGMENT_SCORE_MAX_LEVELS} levels.` : `Score question "${id}" has ${count} ${count === 1 ? "level" : "levels"}, but a score question needs ${JUDGMENT_SCORE_MIN_LEVELS} to ${JUDGMENT_SCORE_MAX_LEVELS}.`,
23817
+ malformed: (id, path21, detail) => `Question "${id}" is malformed at ${path21.length > 0 ? path21.join(".") : "its root"}: ${detail.replace(/\.$/, "")}.`
23818
+ };
23819
+ function isPlainObject2(value) {
23820
+ return typeof value === "object" && value !== null && !Array.isArray(value);
23821
+ }
23822
+ function instructionsMissing(value) {
23823
+ if (value === void 0 || value === null) return true;
23824
+ return typeof value === "string" && value.trim().length === 0;
23825
+ }
23826
+ function collectRuleIssues(id, question) {
23827
+ if (!isPlainObject2(question)) {
23828
+ return [{ code: "JUDGMENT_QUESTION_NOT_OBJECT", path: [id], message: judgmentQuestionMessages.notObject(id) }];
23829
+ }
23830
+ const issues = [];
23831
+ const type = question.type === JUDGMENT_BOOLEAN_TYPE_ALIAS ? "boolean" : question.type;
23832
+ if (type !== "boolean" && type !== "choice" && type !== "score") {
23833
+ issues.push({
23834
+ code: "JUDGMENT_QUESTION_UNKNOWN_TYPE",
23835
+ path: [id, "type"],
23836
+ message: judgmentQuestionMessages.unknownType(id, question.type)
23837
+ });
23838
+ }
23839
+ if (instructionsMissing(question.instructions)) {
23840
+ issues.push({
23841
+ code: "JUDGMENT_INSTRUCTIONS_MISSING",
23842
+ path: [id, "instructions"],
23843
+ message: judgmentQuestionMessages.instructionsMissing(id)
23844
+ });
23845
+ }
23846
+ const criteria = question.criteria;
23847
+ if (type === "choice") {
23848
+ if (!isPlainObject2(criteria) || Object.keys(criteria).length === 0) {
23849
+ issues.push({
23850
+ code: "JUDGMENT_CHOICE_CRITERIA_EMPTY",
23851
+ path: [id, "criteria"],
23852
+ message: judgmentQuestionMessages.choiceCriteriaEmpty(id)
23853
+ });
23854
+ } else if (Object.keys(criteria).length > JUDGMENT_CHOICE_MAX_OPTIONS) {
23855
+ issues.push({
23856
+ code: "JUDGMENT_CHOICE_TOO_MANY_OPTIONS",
23857
+ path: [id, "criteria"],
23858
+ message: judgmentQuestionMessages.choiceTooManyOptions(id, Object.keys(criteria).length)
23859
+ });
23860
+ }
23861
+ }
23862
+ if (type === "score") {
23863
+ const count = Array.isArray(criteria) ? criteria.length : void 0;
23864
+ if (count === void 0 || count < JUDGMENT_SCORE_MIN_LEVELS || count > JUDGMENT_SCORE_MAX_LEVELS) {
23865
+ issues.push({
23866
+ code: "JUDGMENT_SCORE_LEVEL_COUNT",
23867
+ path: [id, "criteria"],
23868
+ message: judgmentQuestionMessages.scoreLevelCount(id, count)
23869
+ });
23870
+ }
23871
+ }
23872
+ return issues;
23873
+ }
23874
+ function collectShapeIssues(id, question) {
23875
+ const parsed = judgmentQuestionSchema.safeParse(question);
23876
+ if (parsed.success) return [];
23877
+ return parsed.error.issues.map((issue2) => {
23878
+ const path21 = issue2.path.filter((segment) => typeof segment !== "symbol");
23879
+ return {
23880
+ code: "JUDGMENT_QUESTION_MALFORMED",
23881
+ path: [id, ...path21],
23882
+ message: judgmentQuestionMessages.malformed(id, path21, issue2.message)
23883
+ };
23884
+ });
23885
+ }
23886
+ function validateJudgmentQuestions(questions) {
23887
+ if (!isPlainObject2(questions) || Object.keys(questions).length === 0) {
23888
+ return [{ code: "JUDGMENT_NO_QUESTIONS", path: [], message: judgmentQuestionMessages.noQuestions() }];
23889
+ }
23890
+ const issues = [];
23891
+ for (const [id, question] of Object.entries(questions)) {
23892
+ const ruleIssues = collectRuleIssues(id, question);
23893
+ issues.push(...ruleIssues.length > 0 ? ruleIssues : collectShapeIssues(id, question));
23894
+ }
23895
+ return issues;
23896
+ }
23897
+ var judgmentQuestionsSchema = external_exports.unknown().superRefine((questions, ctx) => {
23898
+ for (const issue2 of validateJudgmentQuestions(questions)) {
23899
+ ctx.addIssue({ code: "custom", path: issue2.path, message: issue2.message });
23900
+ }
23901
+ }).pipe(external_exports.record(external_exports.string(), judgmentQuestionSchema));
23902
+ var unitIntervalSchema2 = external_exports.number().min(0).max(1);
23903
+ var judgmentQuestionCalibrationSchema = external_exports.object({
23904
+ threshold: external_exports.number().min(0),
23905
+ targetAccuracy: unitIntervalSchema2,
23906
+ heldOutAccuracy: unitIntervalSchema2,
23907
+ handledRate: unitIntervalSchema2,
23908
+ ece: unitIntervalSchema2
23909
+ });
23910
+ var judgmentCalibrationSchema = external_exports.object({
23911
+ labeledSetRef: external_exports.string().min(1),
23912
+ perQuestion: external_exports.record(external_exports.string(), judgmentQuestionCalibrationSchema).refine((perQuestion) => Object.keys(perQuestion).length > 0, {
23913
+ message: "A calibration needs at least one measured question."
23914
+ }),
23915
+ measuredModel: external_exports.string().min(1)
23916
+ });
23917
+ var judgmentInputMappingSchema = external_exports.record(external_exports.string().min(1), external_exports.string().min(1));
23918
+ var questionSetSchema = external_exports.object({
23919
+ id: external_exports.string().min(1),
23920
+ slug: external_exports.string().min(1),
23921
+ version: external_exports.number().int().min(1),
23922
+ questions: judgmentQuestionsSchema,
23923
+ inputMapping: judgmentInputMappingSchema.optional(),
23924
+ model: external_exports.string().min(1).optional(),
23925
+ calibration: judgmentCalibrationSchema.optional()
23926
+ });
23927
+
23928
+ // ../shared/dist/chunk-NDJK5NMQ.mjs
23929
+ var GATEWAY_EVALUATION_MODELS = Object.freeze({
23930
+ "typesafe-ai/jev": Object.freeze({
23931
+ id: "typesafe-ai/jev",
23932
+ name: "Jev",
23933
+ description: "Jev is TypeSafe AI\u2019s System One evaluation model for fast, structured decisions in software. It evaluates shared state against typed questions and returns choices, scores, and boolean probabilities, supporting classification, routing, rubric-based assessment, and automated verification. Multiple questions can be evaluated in parallel within a single request.",
23934
+ contextWindow: 32e3,
23935
+ supportedSpecifications: Object.freeze(["v4"]),
23936
+ pricing: Object.freeze({
23937
+ inputPerToken: "0.000000042",
23938
+ outputPerToken: "0",
23939
+ inputPer1MTokens: 0.042,
23940
+ outputPer1MTokens: 0
23941
+ })
23942
+ })
23943
+ });
23944
+
23945
+ // ../shared/dist/chunk-IJXPXFLP.mjs
23946
+ var JSON_VALUE = { anyOf: [{ type: "string" }, { type: "object" }, { type: "array" }] };
23947
+ var NULLABLE_JSON_VALUE = {
23948
+ anyOf: [{ type: "string" }, { type: "object" }, { type: "array" }, { type: "null" }]
23949
+ };
23950
+ var STATE_PROPERTY = {
23951
+ ...JSON_VALUE,
23952
+ description: "The text or JSON to judge. Select the fields the questions need rather than a whole record: input size is the only cost."
23953
+ };
23954
+ var BOOLEAN_QUESTION = {
23955
+ type: "object",
23956
+ properties: {
23957
+ type: { type: "string", enum: ["boolean"] },
23958
+ instructions: {
23959
+ ...JSON_VALUE,
23960
+ description: "What to decide. The question id is never sent to the model."
23961
+ },
23962
+ criteria: {
23963
+ type: "object",
23964
+ properties: {
23965
+ true: { ...NULLABLE_JSON_VALUE, description: "What a true answer means." },
23966
+ false: { ...NULLABLE_JSON_VALUE, description: "What a false answer means." }
23967
+ },
23968
+ additionalProperties: false
23969
+ }
23970
+ },
23971
+ required: ["type", "instructions"],
23972
+ additionalProperties: false
23973
+ };
23974
+ var CHOICE_QUESTION = {
23975
+ type: "object",
23976
+ properties: {
23977
+ type: { type: "string", enum: ["choice"] },
23978
+ instructions: {
23979
+ ...JSON_VALUE,
23980
+ description: "What to choose. The question id is never sent to the model."
23981
+ },
23982
+ criteria: {
23983
+ type: "object",
23984
+ description: `Option label to description, 1 to ${JUDGMENT_CHOICE_MAX_OPTIONS} options.`,
23985
+ additionalProperties: NULLABLE_JSON_VALUE,
23986
+ minProperties: 1,
23987
+ maxProperties: JUDGMENT_CHOICE_MAX_OPTIONS
23988
+ }
23989
+ },
23990
+ required: ["type", "instructions", "criteria"],
23991
+ additionalProperties: false
23992
+ };
23993
+ var SCORE_QUESTION = {
23994
+ type: "object",
23995
+ properties: {
23996
+ type: { type: "string", enum: ["score"] },
23997
+ instructions: {
23998
+ ...JSON_VALUE,
23999
+ description: "What to score. The question id is never sent to the model."
24000
+ },
24001
+ criteria: {
24002
+ type: "array",
24003
+ description: `Ordered level descriptions, lowest first, ${JUDGMENT_SCORE_MIN_LEVELS} to ${JUDGMENT_SCORE_MAX_LEVELS} levels.`,
24004
+ items: NULLABLE_JSON_VALUE,
24005
+ minItems: JUDGMENT_SCORE_MIN_LEVELS,
24006
+ maxItems: JUDGMENT_SCORE_MAX_LEVELS
24007
+ }
24008
+ },
24009
+ required: ["type", "instructions", "criteria"],
24010
+ additionalProperties: false
24011
+ };
24012
+
24013
+ // ../shared/dist/chunk-FSRL5TBK.mjs
23523
24014
  var THINKING_CONTENT_PART_TYPES = [
23524
24015
  "reasoning",
23525
24016
  "thinking",
@@ -23611,101 +24102,417 @@ function loadBrandConfig(env) {
23611
24102
  var BRAND = loadBrandConfig();
23612
24103
  var DEFAULT_BRAND_CONFIG = BRAND_CONFIGS[DEFAULT_BRAND_NAME];
23613
24104
 
23614
- // ../shared/dist/chunk-OS5X75LW.mjs
23615
- var RECORD_COLLECTION_FIELD_NAME_PATTERN = /^[a-z0-9_]{1,64}$/;
23616
- var RECORD_COLLECTION_MAX_PROPERTIES = 200;
23617
- var RECORD_COLLECTION_STRING_FORMATS = ["date-time", "email", "uri", "record-id"];
23618
- var fieldNameSchema = external_exports.string().regex(
23619
- RECORD_COLLECTION_FIELD_NAME_PATTERN,
23620
- "Property names must be normalized keys: lowercase letters, digits, and underscores (1-64 chars)"
24105
+ // ../shared/dist/chunk-NBGTI2DK.mjs
24106
+ var apiReleaseChannelSchema = external_exports.enum(["staging", "production"]);
24107
+ var API_ARTIFACT_SCRIPT_PATTERN = /^api-[a-z0-9][a-z0-9-]{0,62}$/;
24108
+ var apiArtifactScriptNameSchema = external_exports.string().regex(
24109
+ API_ARTIFACT_SCRIPT_PATTERN,
24110
+ "API artifact script names look like api-<sha12> or api-<sha12>-<suffix> (lowercase alphanumeric and dashes)"
23621
24111
  );
23622
- var descriptionSchema = external_exports.string().max(1024).optional();
23623
- var stringPropertySchema = external_exports.strictObject({
23624
- type: external_exports.literal("string"),
23625
- description: descriptionSchema,
23626
- format: external_exports.enum(RECORD_COLLECTION_STRING_FORMATS).optional(),
23627
- enum: external_exports.array(external_exports.string().max(256)).min(1).max(100).optional(),
23628
- maxLength: external_exports.number().int().positive().optional()
23629
- });
23630
- var numberPropertySchema = external_exports.strictObject({
23631
- type: external_exports.literal("number"),
23632
- description: descriptionSchema,
23633
- minimum: external_exports.number().optional(),
23634
- maximum: external_exports.number().optional()
23635
- });
23636
- var booleanPropertySchema = external_exports.strictObject({
23637
- type: external_exports.literal("boolean"),
23638
- description: descriptionSchema
23639
- });
23640
- var scalarPropertySchema = external_exports.discriminatedUnion("type", [
23641
- stringPropertySchema,
23642
- numberPropertySchema,
23643
- booleanPropertySchema
24112
+ var RUNTIME_ARTIFACT_SCRIPT_PATTERN = /^rt-[a-z0-9][a-z0-9-]{0,80}$/;
24113
+ var runtimeArtifactScriptNameSchema = external_exports.string().regex(
24114
+ RUNTIME_ARTIFACT_SCRIPT_PATTERN,
24115
+ "Runtime artifact script names look like rt-<namespace>-<flow|agent>-<hash> (lowercase alphanumeric and dashes)"
24116
+ );
24117
+ var apiHeaderOverrideModeSchema = external_exports.enum(["open", "token"]);
24118
+ var apiArtifactStatusSchema = external_exports.enum([
24119
+ "uploaded",
24120
+ "active",
24121
+ "superseded",
24122
+ "pinned",
24123
+ "failed",
24124
+ "deleted"
23644
24125
  ]);
23645
- var nestedObjectPropertySchema = external_exports.strictObject({
23646
- type: external_exports.literal("object"),
23647
- description: descriptionSchema,
23648
- properties: external_exports.record(fieldNameSchema, scalarPropertySchema),
23649
- required: external_exports.array(fieldNameSchema).optional(),
23650
- additionalProperties: external_exports.boolean().optional()
24126
+ var apiCanaryConfigSchema = external_exports.object({
24127
+ script: apiArtifactScriptNameSchema,
24128
+ percent: external_exports.number().int().min(1).max(100)
23651
24129
  });
23652
- var arrayPropertySchema = external_exports.strictObject({
23653
- type: external_exports.literal("array"),
23654
- description: descriptionSchema,
23655
- items: external_exports.union([scalarPropertySchema, nestedObjectPropertySchema])
24130
+ var apiRoutingDocSchema = external_exports.object({
24131
+ version: external_exports.number().int().nonnegative(),
24132
+ updatedAt: external_exports.string().min(1),
24133
+ api: external_exports.object({
24134
+ activeScript: apiArtifactScriptNameSchema.nullable(),
24135
+ previousScript: apiArtifactScriptNameSchema.nullable(),
24136
+ canary: apiCanaryConfigSchema.nullable(),
24137
+ pinsEnabled: external_exports.boolean(),
24138
+ legacyFallback: external_exports.boolean(),
24139
+ headerOverride: apiHeaderOverrideModeSchema,
24140
+ // WHY(docs/why/packages/shared/src.md#otlp-fast-lane-when-true-the-dispatch-worker-ter): OTLP fast lane: when true, the dispatch worker terminates `/v1/otel/*` at the standalone
24141
+ /** OTLP fast lane: when true, the dispatch worker terminates `/v1/otel/*` at the standalone `runtype-otel-ingest` worker instead of resolving an API artifact (apps/api-dispatch/src/otel-lane.ts; docs/features/planning/2026-08-12-otel-ingest-worker.md, increment 3). */
24142
+ otelIngest: external_exports.boolean().optional()
24143
+ })
24144
+ }).refine((doc) => doc.api.activeScript !== null || doc.api.legacyFallback, {
24145
+ message: "activeScript may only be null while legacyFallback is true",
24146
+ path: ["api", "activeScript"]
23656
24147
  });
23657
- var propertySchema = external_exports.union([
23658
- scalarPropertySchema,
23659
- arrayPropertySchema,
23660
- nestedObjectPropertySchema
23661
- ]);
23662
- function addSemanticIssues(schema, ctx, pathPrefix = []) {
23663
- const propertyNames = new Set(Object.keys(schema.properties));
23664
- for (const name of schema.required ?? []) {
23665
- if (!propertyNames.has(name)) {
23666
- ctx.addIssue({
23667
- code: "custom",
23668
- path: [...pathPrefix, "required"],
23669
- message: `Required property "${name}" is not declared in properties`
23670
- });
23671
- }
24148
+ var edgeContextPayloadSchema = external_exports.object({
24149
+ /** Resolved Runtype user id (`user_…`). */
24150
+ userId: external_exports.string().min(1),
24151
+ /** Resolved org id (`org_…`); null for a personal (no-org) credential. */
24152
+ orgId: external_exports.string().min(1).nullable(),
24153
+ /** Effective permission scopes for the credential (e.g. `["*"]`). */
24154
+ scopes: external_exports.array(external_exports.string()),
24155
+ /** Token id (one per mint) — replay/audit handle, never reused as a secret. */
24156
+ jti: external_exports.string().min(1),
24157
+ /** Expiry as epoch MILLISECONDS; the token is rejected once `exp <= now`. */
24158
+ exp: external_exports.number().int().positive()
24159
+ });
24160
+
24161
+ // ../shared/dist/chunk-ZGF3GAF7.mjs
24162
+ var DEFAULT_FLOW_TIMEOUT_MS = 15 * 60 * 1e3;
24163
+ var ASYNC_REPLAY_AGENT_LANE_BUDGET_MS = 10 * 60 * 1e3;
24164
+ var DEFAULT_AGENT_WALL_CLOCK_TIMEOUT_MS = 5 * 60 * 1e3;
24165
+ var ATTACHED_DISPATCH_STEP_TIMEOUT_MAX_MS = 10 * 60 * 1e3;
24166
+ var ASYNC_DISPATCH_TIMEOUT_MAX_MS = 30 * 60 * 1e3;
24167
+
24168
+ // ../shared/dist/chunk-CHLLKMWK.mjs
24169
+ function parseHTMLWithRegex(html) {
24170
+ if (typeof html !== "string") {
24171
+ throw new Error("parseHTML: input must be a string");
23672
24172
  }
23673
- for (const [name, property] of Object.entries(schema.properties)) {
23674
- const path21 = [...pathPrefix, "properties", name];
23675
- if (property.type === "string" && property.enum) {
23676
- if (new Set(property.enum).size !== property.enum.length) {
23677
- ctx.addIssue({
23678
- code: "custom",
23679
- path: [...path21, "enum"],
23680
- message: "Enum values must be unique"
23681
- });
24173
+ try {
24174
+ const parser = {
24175
+ stripTags(value) {
24176
+ return value.replace(/<[^>]*>/g, " ").replace(/<(\/?[a-zA-Z][^>]*)$/, "&lt;$1").replace(/\s+/g, " ").trim();
24177
+ },
24178
+ querySelector(selector) {
24179
+ try {
24180
+ const tag = selector.replace(/[^a-zA-Z0-9-]/g, "");
24181
+ const match = html.match(new RegExp("<" + tag + "[^>]*>(.*?)<\\/" + tag + ">", "is"));
24182
+ return match ? parser.stripTags(match[1]).trim() || null : null;
24183
+ } catch {
24184
+ return null;
24185
+ }
24186
+ },
24187
+ querySelectorAll(selector) {
24188
+ try {
24189
+ const tag = selector.replace(/[^a-zA-Z0-9-]/g, "");
24190
+ const regex = new RegExp("<" + tag + "[^>]*>(.*?)<\\/" + tag + ">", "gis");
24191
+ const results = [];
24192
+ let match;
24193
+ while ((match = regex.exec(html)) !== null) {
24194
+ const value = parser.stripTags(match[1]).trim();
24195
+ if (value) results.push(value);
24196
+ }
24197
+ return results;
24198
+ } catch {
24199
+ return [];
24200
+ }
23682
24201
  }
24202
+ };
24203
+ const titleMatch = html.match(/<title[^>]*>(.*?)<\/title>/is);
24204
+ const title = titleMatch ? parser.stripTags(titleMatch[1]).trim() || void 0 : void 0;
24205
+ const headingRegex = /<h[1-6][^>]*>(.*?)<\/h[1-6]>/gis;
24206
+ const headings = [];
24207
+ let headingMatch;
24208
+ while ((headingMatch = headingRegex.exec(html)) !== null) {
24209
+ const text2 = parser.stripTags(headingMatch[1]).trim();
24210
+ if (text2) headings.push(text2);
23683
24211
  }
23684
- if (property.type === "number" && property.minimum !== void 0 && property.maximum !== void 0 && property.minimum > property.maximum) {
23685
- ctx.addIssue({
23686
- code: "custom",
23687
- path: path21,
23688
- message: "minimum must be less than or equal to maximum"
23689
- });
23690
- }
23691
- if (property.type === "object") {
23692
- addSemanticIssues(property, ctx, path21);
23693
- }
23694
- if (property.type === "array" && property.items.type === "object") {
23695
- addSemanticIssues(property.items, ctx, [...path21, "items"]);
24212
+ const linkRegex = /<a\s[^>]*href=["']([^"']*)["'][^>]*>(.*?)<\/a>/gis;
24213
+ const links = [];
24214
+ let linkMatch;
24215
+ while ((linkMatch = linkRegex.exec(html)) !== null) {
24216
+ const href = linkMatch[1];
24217
+ const text2 = parser.stripTags(linkMatch[2]).trim();
24218
+ if (href) links.push({ href, text: text2 });
23696
24219
  }
24220
+ const text = parser.stripTags(html);
24221
+ return {
24222
+ title,
24223
+ headings,
24224
+ links,
24225
+ text,
24226
+ querySelector: parser.querySelector,
24227
+ querySelectorAll: parser.querySelectorAll
24228
+ };
24229
+ } catch (error62) {
24230
+ throw new Error(
24231
+ `parseHTML failed: ${error62 instanceof Error ? error62.message : "Unknown error"}`,
24232
+ {
24233
+ cause: error62
24234
+ }
24235
+ );
23697
24236
  }
23698
24237
  }
23699
- var recordCollectionSchemaSchema = external_exports.strictObject({
23700
- type: external_exports.literal("object"),
23701
- properties: external_exports.record(fieldNameSchema, propertySchema).refine((props) => Object.keys(props).length <= RECORD_COLLECTION_MAX_PROPERTIES, {
23702
- message: `Schemas may declare at most ${RECORD_COLLECTION_MAX_PROPERTIES} properties`
23703
- }),
23704
- required: external_exports.array(fieldNameSchema).optional(),
23705
- additionalProperties: external_exports.boolean().optional()
23706
- }).superRefine((schema, ctx) => addSemanticIssues(schema, ctx));
24238
+ function createPortableHelpers(parseHTML) {
24239
+ return {
24240
+ parseHTML,
24241
+ /**
24242
+ * Extract email addresses from text
24243
+ * @param text Text to search for emails
24244
+ * @returns Array of found email addresses
24245
+ */
24246
+ extractEmails(text) {
24247
+ if (typeof text !== "string") {
24248
+ return [];
24249
+ }
24250
+ const emailRegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
24251
+ const matches = text.match(emailRegex);
24252
+ return matches ? [...new Set(matches)] : [];
24253
+ },
24254
+ /**
24255
+ * Extract URLs from text
24256
+ * @param text Text to search for URLs
24257
+ * @returns Array of found URLs
24258
+ */
24259
+ extractURLs(text) {
24260
+ if (typeof text !== "string") {
24261
+ return [];
24262
+ }
24263
+ const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/g;
24264
+ const matches = text.match(urlRegex);
24265
+ return matches ? [...new Set(matches)] : [];
24266
+ },
24267
+ /**
24268
+ * Extract phone numbers from text
24269
+ * @param text Text to search for phone numbers
24270
+ * @returns Array of found phone numbers
24271
+ */
24272
+ extractPhoneNumbers(text) {
24273
+ if (typeof text !== "string") {
24274
+ return [];
24275
+ }
24276
+ const phoneRegex = /(?:\+?1[-.\s]?)?(?:\([0-9]{3}\)|[0-9]{3})[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}/g;
24277
+ const matches = text.match(phoneRegex);
24278
+ return matches ? [...new Set(matches)] : [];
24279
+ },
24280
+ /**
24281
+ * Truncate text to specified length with ellipsis
24282
+ * @param text Text to truncate
24283
+ * @param length Maximum length
24284
+ * @returns Truncated text
24285
+ */
24286
+ truncate(text, length) {
24287
+ if (typeof text !== "string" || typeof length !== "number") {
24288
+ return text || "";
24289
+ }
24290
+ if (text.length <= length) {
24291
+ return text;
24292
+ }
24293
+ return text.substring(0, length).trim() + "...";
24294
+ },
24295
+ /**
24296
+ * Create URL-friendly slug from text
24297
+ * @param text Text to slugify
24298
+ * @returns URL-friendly slug
24299
+ */
24300
+ slugify(text) {
24301
+ if (typeof text !== "string") {
24302
+ return "";
24303
+ }
24304
+ return text.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
24305
+ },
24306
+ /**
24307
+ * Convert Markdown to HTML (basic conversion)
24308
+ * @param markdown Markdown text
24309
+ * @returns HTML string
24310
+ */
24311
+ markdown2html(markdown) {
24312
+ if (typeof markdown !== "string") {
24313
+ return "";
24314
+ }
24315
+ return markdown.replace(/^### (.*$)/gim, "<h3>$1</h3>").replace(/^## (.*$)/gim, "<h2>$1</h2>").replace(/^# (.*$)/gim, "<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim, "<strong>$1</strong>").replace(/__(.*?)__/gim, "<strong>$1</strong>").replace(/\*(.*?)\*/gim, "<em>$1</em>").replace(/_(.*?)_/gim, "<em>$1</em>").replace(/`(.*?)`/gim, "<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim, '<a href="$2">$1</a>').replace(/\n\n/gim, "</p><p>").replace(/\n/gim, "<br>").replace(/^(?!<[h|u|o|l])/gim, "<p>").replace(/$/gim, "</p>").replace(/<p><\/p>/gim, "").replace(/<p>(<h[1-6]>.*<\/h[1-6]>)<\/p>/gim, "$1");
24316
+ },
24317
+ /**
24318
+ * Convert HTML to Markdown (basic conversion)
24319
+ * @param html HTML string
24320
+ * @returns Markdown text
24321
+ */
24322
+ html2markdown(html) {
24323
+ if (typeof html !== "string") {
24324
+ return "";
24325
+ }
24326
+ 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][^>]*)$/, "&lt;$1").replace(/\n\s*\n\s*\n/gim, "\n\n").trim();
24327
+ },
24328
+ /**
24329
+ * Parse date from various string formats
24330
+ * @param dateStr Date string to parse
24331
+ * @returns Date object or null if invalid
24332
+ */
24333
+ parseDate(dateStr) {
24334
+ if (typeof dateStr !== "string") {
24335
+ return null;
24336
+ }
24337
+ try {
24338
+ const date5 = new Date(dateStr);
24339
+ return isNaN(date5.getTime()) ? null : date5;
24340
+ } catch {
24341
+ return null;
24342
+ }
24343
+ },
24344
+ /**
24345
+ * Format date according to specified format
24346
+ * @param date Date object or string
24347
+ * @param format Format string (simple patterns)
24348
+ * @returns Formatted date string
24349
+ */
24350
+ formatDate(date5, format) {
24351
+ const defaultFormat = format || "YYYY-MM-DD";
24352
+ let dateObj;
24353
+ if (typeof date5 === "string") {
24354
+ dateObj = new Date(date5);
24355
+ } else if (date5 instanceof Date) {
24356
+ dateObj = date5;
24357
+ } else {
24358
+ return "";
24359
+ }
24360
+ if (isNaN(dateObj.getTime())) {
24361
+ return "";
24362
+ }
24363
+ const year = dateObj.getFullYear();
24364
+ const month = String(dateObj.getMonth() + 1).padStart(2, "0");
24365
+ const day = String(dateObj.getDate()).padStart(2, "0");
24366
+ const hours = String(dateObj.getHours()).padStart(2, "0");
24367
+ const minutes = String(dateObj.getMinutes()).padStart(2, "0");
24368
+ const seconds = String(dateObj.getSeconds()).padStart(2, "0");
24369
+ return defaultFormat.replace(/YYYY/g, String(year)).replace(/MM/g, month).replace(/DD/g, day).replace(/HH/g, hours).replace(/mm/g, minutes).replace(/ss/g, seconds);
24370
+ },
24371
+ /**
24372
+ * Add days to a date
24373
+ * @param date Date object or string
24374
+ * @param days Number of days to add (can be negative)
24375
+ * @returns New Date object
24376
+ */
24377
+ addDays(date5, days) {
24378
+ let dateObj;
24379
+ if (typeof date5 === "string") {
24380
+ dateObj = new Date(date5);
24381
+ } else if (date5 instanceof Date) {
24382
+ dateObj = new Date(date5.getTime());
24383
+ } else {
24384
+ return null;
24385
+ }
24386
+ if (isNaN(dateObj.getTime()) || typeof days !== "number") {
24387
+ return null;
24388
+ }
24389
+ dateObj.setDate(dateObj.getDate() + days);
24390
+ return dateObj;
24391
+ },
24392
+ /**
24393
+ * Validate email address format
24394
+ * @param email Email address to validate
24395
+ * @returns True if valid email format
24396
+ */
24397
+ isValidEmail(email3) {
24398
+ if (typeof email3 !== "string") {
24399
+ return false;
24400
+ }
24401
+ const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
24402
+ return emailRegex.test(email3);
24403
+ },
24404
+ /**
24405
+ * Validate URL format
24406
+ * @param url URL to validate
24407
+ * @returns True if valid URL format
24408
+ */
24409
+ isValidURL(url2) {
24410
+ if (typeof url2 !== "string") {
24411
+ return false;
24412
+ }
24413
+ try {
24414
+ new URL(url2);
24415
+ return true;
24416
+ } catch {
24417
+ return false;
24418
+ }
24419
+ },
24420
+ /**
24421
+ * Validate JSON string
24422
+ * @param str String to validate as JSON
24423
+ * @returns True if valid JSON
24424
+ */
24425
+ isValidJSON(str2) {
24426
+ if (typeof str2 !== "string") {
24427
+ return false;
24428
+ }
24429
+ try {
24430
+ JSON.parse(str2);
24431
+ return true;
24432
+ } catch {
24433
+ return false;
24434
+ }
24435
+ },
24436
+ /**
24437
+ * Encode string to base64
24438
+ * @param str String to encode
24439
+ * @returns Base64 encoded string
24440
+ */
24441
+ base64Encode(str2) {
24442
+ if (typeof str2 !== "string") {
24443
+ return "";
24444
+ }
24445
+ try {
24446
+ return btoa(str2);
24447
+ } catch {
24448
+ return btoa(unescape(encodeURIComponent(str2)));
24449
+ }
24450
+ },
24451
+ /**
24452
+ * Decode base64 string
24453
+ * @param str Base64 string to decode
24454
+ * @returns Decoded string
24455
+ */
24456
+ base64Decode(str2) {
24457
+ if (typeof str2 !== "string") {
24458
+ return "";
24459
+ }
24460
+ try {
24461
+ return atob(str2);
24462
+ } catch {
24463
+ try {
24464
+ return decodeURIComponent(escape(atob(str2)));
24465
+ } catch {
24466
+ return "";
24467
+ }
24468
+ }
24469
+ },
24470
+ /**
24471
+ * URL encode string
24472
+ * @param str String to encode
24473
+ * @returns URL encoded string
24474
+ */
24475
+ urlEncode(str2) {
24476
+ if (typeof str2 !== "string") {
24477
+ return "";
24478
+ }
24479
+ return encodeURIComponent(str2);
24480
+ },
24481
+ /**
24482
+ * URL decode string
24483
+ * @param str URL encoded string to decode
24484
+ * @returns Decoded string
24485
+ */
24486
+ urlDecode(str2) {
24487
+ if (typeof str2 !== "string") {
24488
+ return "";
24489
+ }
24490
+ try {
24491
+ return decodeURIComponent(str2);
24492
+ } catch {
24493
+ return str2;
24494
+ }
24495
+ },
24496
+ /**
24497
+ * Return the first argument that is neither null nor undefined (a named
24498
+ * first-non-null / nullish coalesce). The script-side counterpart of the
24499
+ * `{{a ?? b}}` template operator — in templates prefer `{{a ?? b}}`; use
24500
+ * `helpers.coalesce(a, b)` inside transform-data scripts.
24501
+ * @param values Candidate values in priority order
24502
+ * @returns The first non-null/undefined value, or null if all are null/undefined
24503
+ */
24504
+ coalesce(...values) {
24505
+ for (const value of values) {
24506
+ if (value !== null && value !== void 0) {
24507
+ return value;
24508
+ }
24509
+ }
24510
+ return null;
24511
+ }
24512
+ };
24513
+ }
23707
24514
 
23708
- // ../shared/dist/chunk-4MQXFQJ4.mjs
24515
+ // ../shared/dist/chunk-2WE53SSZ.mjs
23709
24516
  var AGENT_TRANSIENT_SECRETS_CODE = "RUNTIME_AGENT_TRANSIENT_SECRETS_UNSUPPORTED";
23710
24517
  var FLOW_TRANSIENT_SECRETS_CODE = "RUNTIME_FLOW_TRANSIENT_SECRETS_UNSUPPORTED";
23711
24518
  var DISPATCH_TRANSIENT_SECRETS_RETIRED_NOTE = `Retired on BOTH dispatch targets. A NON-EMPTY map is rejected with 400: ${AGENT_TRANSIENT_SECRETS_CODE} on an agent dispatch, ${FLOW_TRANSIENT_SECRETS_CODE} on a flow dispatch (the flow target used to drop the map silently). An empty map is accepted and does nothing. Store credentials as managed secrets and reference them as {{secret:NAME}}. The field is kept on the wire for compatibility only.`;
@@ -24068,7 +24875,7 @@ var SURFACE_TYPE_METADATA = {
24068
24875
  ].join("\n"),
24069
24876
  statusIndicator: "typing_loop",
24070
24877
  voiceSupport: "none",
24071
- historyBackfill: false,
24878
+ historyBackfill: true,
24072
24879
  supportsTextCommands: true,
24073
24880
  capabilityRouting: "first",
24074
24881
  capabilityFanout: "single",
@@ -24165,7 +24972,7 @@ var SURFACE_TYPE_METADATA = {
24165
24972
  executionHint: "You are responding via Telegram. Be clear and concise. Keep messages focused and avoid unnecessary verbosity. Do not include reasoning traces or tool call narration.",
24166
24973
  statusIndicator: "typing_loop",
24167
24974
  voiceSupport: "full",
24168
- historyBackfill: false,
24975
+ historyBackfill: true,
24169
24976
  supportsTextCommands: false,
24170
24977
  capabilityRouting: "first",
24171
24978
  capabilityFanout: "single",
@@ -24661,7 +25468,7 @@ var SLACK_INTEGRATION = {
24661
25468
  },
24662
25469
  {
24663
25470
  name: "send_rich_message",
24664
- description: "Send a Slack message with arbitrary Block Kit blocks. Unlike prompt_user / select_from_list this does NOT register an interaction \u2014 use it for informational cards that do not require a user response.",
25471
+ description: `Send a Slack message with arbitrary Block Kit blocks. Unlike ${modelVisibleToolName("builtin:slack:prompt_user")} / ${modelVisibleToolName("builtin:slack:select_from_list")} this does NOT register an interaction \u2014 use it for informational cards that do not require a user response.`,
24665
25472
  parametersSchema: {
24666
25473
  type: "object",
24667
25474
  properties: {
@@ -26028,6 +26835,40 @@ var toolInputCheckpointSchema = external_exports.object({
26028
26835
  }).optional()
26029
26836
  });
26030
26837
 
26838
+ // ../shared/dist/chunk-PB23OWQZ.mjs
26839
+ var CONTEXT_STEP_TYPES = [
26840
+ "crawl",
26841
+ "fetch-url",
26842
+ "retrieve-record",
26843
+ "get-record",
26844
+ "list-records",
26845
+ "api-call",
26846
+ "transform-data",
26847
+ "template",
26848
+ "conditional",
26849
+ "loop",
26850
+ "set-variable",
26851
+ "upsert-record",
26852
+ "send-email",
26853
+ "send-event",
26854
+ "send-stream",
26855
+ "update-record",
26856
+ "search",
26857
+ "generate-embedding",
26858
+ "vector-search",
26859
+ "tool-call",
26860
+ "wait-until",
26861
+ "paginate-api",
26862
+ "store-vector",
26863
+ "execute-agent",
26864
+ "store-asset",
26865
+ "generate-pdf",
26866
+ "save-memory",
26867
+ "recall-memory",
26868
+ "memory-summary"
26869
+ ];
26870
+ var FLOW_STEP_TYPES = ["prompt", ...CONTEXT_STEP_TYPES];
26871
+
26031
26872
  // ../shared/dist/chunk-FEQMZEYY.mjs
26032
26873
  var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
26033
26874
  // WHY(docs/why/packages/shared/src.md#openai-models-route-via-openai-direct-with-verce): OpenAI models route via OpenAI direct with Vercel fallback; routed entries benefit from automatic provider
@@ -26125,39 +26966,99 @@ var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
26125
26966
  ];
26126
26967
  var DEFAULT_MODEL_ID = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.find((m2) => m2.isDefault)?.modelId ?? "kimi-k2.6";
26127
26968
 
26128
- // ../shared/dist/chunk-PB23OWQZ.mjs
26129
- var CONTEXT_STEP_TYPES = [
26130
- "crawl",
26131
- "fetch-url",
26132
- "retrieve-record",
26133
- "get-record",
26134
- "list-records",
26135
- "api-call",
26136
- "transform-data",
26137
- "template",
26138
- "conditional",
26139
- "loop",
26140
- "set-variable",
26141
- "upsert-record",
26142
- "send-email",
26143
- "send-event",
26144
- "send-stream",
26145
- "update-record",
26146
- "search",
26147
- "generate-embedding",
26148
- "vector-search",
26149
- "tool-call",
26150
- "wait-until",
26151
- "paginate-api",
26152
- "store-vector",
26153
- "execute-agent",
26154
- "store-asset",
26155
- "generate-pdf",
26156
- "save-memory",
26157
- "recall-memory",
26158
- "memory-summary"
26159
- ];
26160
- var FLOW_STEP_TYPES = ["prompt", ...CONTEXT_STEP_TYPES];
26969
+ // ../shared/dist/chunk-OS5X75LW.mjs
26970
+ var RECORD_COLLECTION_FIELD_NAME_PATTERN = /^[a-z0-9_]{1,64}$/;
26971
+ var RECORD_COLLECTION_MAX_PROPERTIES = 200;
26972
+ var RECORD_COLLECTION_STRING_FORMATS = ["date-time", "email", "uri", "record-id"];
26973
+ var fieldNameSchema = external_exports.string().regex(
26974
+ RECORD_COLLECTION_FIELD_NAME_PATTERN,
26975
+ "Property names must be normalized keys: lowercase letters, digits, and underscores (1-64 chars)"
26976
+ );
26977
+ var descriptionSchema = external_exports.string().max(1024).optional();
26978
+ var stringPropertySchema = external_exports.strictObject({
26979
+ type: external_exports.literal("string"),
26980
+ description: descriptionSchema,
26981
+ format: external_exports.enum(RECORD_COLLECTION_STRING_FORMATS).optional(),
26982
+ enum: external_exports.array(external_exports.string().max(256)).min(1).max(100).optional(),
26983
+ maxLength: external_exports.number().int().positive().optional()
26984
+ });
26985
+ var numberPropertySchema = external_exports.strictObject({
26986
+ type: external_exports.literal("number"),
26987
+ description: descriptionSchema,
26988
+ minimum: external_exports.number().optional(),
26989
+ maximum: external_exports.number().optional()
26990
+ });
26991
+ var booleanPropertySchema = external_exports.strictObject({
26992
+ type: external_exports.literal("boolean"),
26993
+ description: descriptionSchema
26994
+ });
26995
+ var scalarPropertySchema = external_exports.discriminatedUnion("type", [
26996
+ stringPropertySchema,
26997
+ numberPropertySchema,
26998
+ booleanPropertySchema
26999
+ ]);
27000
+ var nestedObjectPropertySchema = external_exports.strictObject({
27001
+ type: external_exports.literal("object"),
27002
+ description: descriptionSchema,
27003
+ properties: external_exports.record(fieldNameSchema, scalarPropertySchema),
27004
+ required: external_exports.array(fieldNameSchema).optional(),
27005
+ additionalProperties: external_exports.boolean().optional()
27006
+ });
27007
+ var arrayPropertySchema = external_exports.strictObject({
27008
+ type: external_exports.literal("array"),
27009
+ description: descriptionSchema,
27010
+ items: external_exports.union([scalarPropertySchema, nestedObjectPropertySchema])
27011
+ });
27012
+ var propertySchema = external_exports.union([
27013
+ scalarPropertySchema,
27014
+ arrayPropertySchema,
27015
+ nestedObjectPropertySchema
27016
+ ]);
27017
+ function addSemanticIssues(schema, ctx, pathPrefix = []) {
27018
+ const propertyNames = new Set(Object.keys(schema.properties));
27019
+ for (const name of schema.required ?? []) {
27020
+ if (!propertyNames.has(name)) {
27021
+ ctx.addIssue({
27022
+ code: "custom",
27023
+ path: [...pathPrefix, "required"],
27024
+ message: `Required property "${name}" is not declared in properties`
27025
+ });
27026
+ }
27027
+ }
27028
+ for (const [name, property] of Object.entries(schema.properties)) {
27029
+ const path21 = [...pathPrefix, "properties", name];
27030
+ if (property.type === "string" && property.enum) {
27031
+ if (new Set(property.enum).size !== property.enum.length) {
27032
+ ctx.addIssue({
27033
+ code: "custom",
27034
+ path: [...path21, "enum"],
27035
+ message: "Enum values must be unique"
27036
+ });
27037
+ }
27038
+ }
27039
+ if (property.type === "number" && property.minimum !== void 0 && property.maximum !== void 0 && property.minimum > property.maximum) {
27040
+ ctx.addIssue({
27041
+ code: "custom",
27042
+ path: path21,
27043
+ message: "minimum must be less than or equal to maximum"
27044
+ });
27045
+ }
27046
+ if (property.type === "object") {
27047
+ addSemanticIssues(property, ctx, path21);
27048
+ }
27049
+ if (property.type === "array" && property.items.type === "object") {
27050
+ addSemanticIssues(property.items, ctx, [...path21, "items"]);
27051
+ }
27052
+ }
27053
+ }
27054
+ var recordCollectionSchemaSchema = external_exports.strictObject({
27055
+ type: external_exports.literal("object"),
27056
+ properties: external_exports.record(fieldNameSchema, propertySchema).refine((props) => Object.keys(props).length <= RECORD_COLLECTION_MAX_PROPERTIES, {
27057
+ message: `Schemas may declare at most ${RECORD_COLLECTION_MAX_PROPERTIES} properties`
27058
+ }),
27059
+ required: external_exports.array(fieldNameSchema).optional(),
27060
+ additionalProperties: external_exports.boolean().optional()
27061
+ }).superRefine((schema, ctx) => addSemanticIssues(schema, ctx));
26161
27062
 
26162
27063
  // ../shared/dist/chunk-DIIGXWZV.mjs
26163
27064
  var MAX_DURABLE_POLL_ATTEMPTS = 1e3;
@@ -26211,7 +27112,7 @@ function durableCrawlBudget(plan) {
26211
27112
  };
26212
27113
  }
26213
27114
 
26214
- // ../shared/dist/chunk-JG4QDGFN.mjs
27115
+ // ../shared/dist/chunk-JMKZTEYJ.mjs
26215
27116
  function getNestedValue(obj, path21) {
26216
27117
  let normalizedPath = path21;
26217
27118
  normalizedPath = normalizedPath.replace(/^\$\.?/, "");
@@ -26304,6 +27205,11 @@ function isSystemVariable(varName) {
26304
27205
  const rootSegment = varName.split(".")[0] || "";
26305
27206
  return SYSTEM_VARIABLES.has(rootSegment);
26306
27207
  }
27208
+ var RESERVED_INPUT_KEY_MESSAGE = "Input keys cannot start with '_' (reserved for system variables)";
27209
+ function hasNoReservedInputKeys(inputs) {
27210
+ if (!inputs) return true;
27211
+ return Object.keys(inputs).every((key) => !key.startsWith("_"));
27212
+ }
26307
27213
  var TEMPLATE_EXPRESSION_PATTERN = /\{\{([^{}]+)\}\}/g;
26308
27214
  function parseTemplateExpression(expr) {
26309
27215
  const tokens = tokenizeFallbackExpression(expr);
@@ -26599,7 +27505,7 @@ function resolveFallback(parsed, context, tracking, options = {}) {
26599
27505
  }
26600
27506
  var templateEngine = new SimpleTemplateEngine();
26601
27507
 
26602
- // ../shared/dist/chunk-KRXG7FGZ.mjs
27508
+ // ../shared/dist/chunk-JBCJTEIN.mjs
26603
27509
  function unwrapVectorSourceTemplate(source) {
26604
27510
  const trimmed2 = source.trim();
26605
27511
  if (!trimmed2.startsWith("{{") || !trimmed2.endsWith("}}")) return source;
@@ -26608,7 +27514,7 @@ function unwrapVectorSourceTemplate(source) {
26608
27514
  return inner;
26609
27515
  }
26610
27516
 
26611
- // ../shared/dist/chunk-4FTKQ5PS.mjs
27517
+ // ../shared/dist/chunk-PCKXG4QA.mjs
26612
27518
  var jsonPatchOperationSchema = external_exports.object({
26613
27519
  op: external_exports.enum(["add", "remove", "replace", "move", "copy", "test"]),
26614
27520
  /** JSON Pointer (RFC 6901) into the state document. `''` addresses the root. */
@@ -26620,6 +27526,10 @@ var jsonPatchOperationSchema = external_exports.object({
26620
27526
  });
26621
27527
  var jsonPatchSchema = external_exports.array(jsonPatchOperationSchema);
26622
27528
  var tokensSchema = external_exports.object({ input: external_exports.number(), output: external_exports.number() });
27529
+ var unifiedTelemetryAttributesSchema = external_exports.record(
27530
+ external_exports.string(),
27531
+ external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
27532
+ );
26623
27533
  var WIRE_STOP_REASONS = [
26624
27534
  "end_turn",
26625
27535
  "max_tool_calls",
@@ -26750,20 +27660,23 @@ var unifiedTurnCompleteEventSchema = external_exports.object({
26750
27660
  completedAt: external_exports.string().optional(),
26751
27661
  fallback: fallbackInfoSchema.optional(),
26752
27662
  estimatedContextBreakdown: estimatedContextBreakdownSchema.optional(),
26753
- subagent: unifiedSubagentAttributionSchema.optional()
27663
+ subagent: unifiedSubagentAttributionSchema.optional(),
27664
+ attributes: unifiedTelemetryAttributesSchema.optional()
26754
27665
  });
26755
27666
  var modelCallTokensSchema = external_exports.object({
26756
27667
  input: external_exports.number(),
26757
27668
  output: external_exports.number(),
26758
27669
  cacheRead: external_exports.number().optional(),
26759
- cacheWrite: external_exports.number().optional()
27670
+ cacheWrite: external_exports.number().optional(),
27671
+ /** Provider-reported reasoning tokens; a subset of `output`. */
27672
+ reasoning: external_exports.number().optional()
26760
27673
  });
26761
27674
  var unifiedModelCallStartEventSchema = external_exports.object({
26762
27675
  ...unifiedBase,
26763
27676
  type: external_exports.literal("model_call_start"),
26764
27677
  /** The call's own seam id; the same value a host joins usage telemetry on. */
26765
27678
  id: external_exports.string(),
26766
- // WHY(docs/features/planning/2026-09-09-unified-observability-data-model.md): D16's ordinal, emitter-minted so a re-projection derives the same span id.
27679
+ // WHY(docs/features/shipped/2026-09-09-unified-observability-data-model.md): D16's ordinal, emitter-minted so a re-projection derives the same span id.
26767
27680
  ordinal: external_exports.number().int().nonnegative(),
26768
27681
  // WHY(apps/api/src/lib/filtered-stream.ts): A user-facing stream drops the model identity, and a stripped frame must still be a valid union member.
26769
27682
  model: external_exports.string().optional(),
@@ -26778,7 +27691,7 @@ var unifiedModelCallCompleteEventSchema = external_exports.object({
26778
27691
  ...unifiedBase,
26779
27692
  type: external_exports.literal("model_call_complete"),
26780
27693
  id: external_exports.string(),
26781
- // WHY(docs/features/planning/2026-09-09-unified-observability-data-model.md): Carried on both frames, so the span id derives from whichever one a batch holds.
27694
+ // WHY(docs/features/shipped/2026-09-09-unified-observability-data-model.md): Carried on both frames, so the span id derives from whichever one a batch holds.
26782
27695
  ordinal: external_exports.number().int().nonnegative(),
26783
27696
  model: external_exports.string().optional(),
26784
27697
  responseModel: external_exports.string().optional(),
@@ -26789,6 +27702,7 @@ var unifiedModelCallCompleteEventSchema = external_exports.object({
26789
27702
  success: external_exports.boolean().optional(),
26790
27703
  durationMs: external_exports.number().optional(),
26791
27704
  completedAt: external_exports.string().optional(),
27705
+ attributes: unifiedTelemetryAttributesSchema.optional(),
26792
27706
  // WHY(packages/shared/src/unified-events-to-log-entries.ts): The live trace tree parents a model row by these, so the closing frame must carry them too.
26793
27707
  iteration: external_exports.number().optional(),
26794
27708
  turnId: external_exports.string().optional(),
@@ -27212,10 +28126,10 @@ var UNIFIED_SSE_EVENT_TYPES = _unifiedTuple([
27212
28126
  "custom"
27213
28127
  ]);
27214
28128
 
27215
- // ../shared/dist/chunk-3JBSYPFI.mjs
28129
+ // ../shared/dist/chunk-TXCLYD2M.mjs
27216
28130
  var UNIFIED_SSE_EVENT_TYPE_SET = new Set(UNIFIED_SSE_EVENT_TYPES);
27217
28131
 
27218
- // ../shared/dist/chunk-6STCS5KQ.mjs
28132
+ // ../shared/dist/chunk-OM3FVZKG.mjs
27219
28133
  var mediaAnnotationsSchema = external_exports.object({
27220
28134
  audience: external_exports.array(external_exports.enum(["user", "assistant"])).optional()
27221
28135
  });
@@ -27931,353 +28845,6 @@ var artifactSSEEventSchema = external_exports.discriminatedUnion("type", [
27931
28845
  artifactSingleEventSchema
27932
28846
  ]);
27933
28847
 
27934
- // ../shared/dist/chunk-CHLLKMWK.mjs
27935
- function parseHTMLWithRegex(html) {
27936
- if (typeof html !== "string") {
27937
- throw new Error("parseHTML: input must be a string");
27938
- }
27939
- try {
27940
- const parser = {
27941
- stripTags(value) {
27942
- return value.replace(/<[^>]*>/g, " ").replace(/<(\/?[a-zA-Z][^>]*)$/, "&lt;$1").replace(/\s+/g, " ").trim();
27943
- },
27944
- querySelector(selector) {
27945
- try {
27946
- const tag = selector.replace(/[^a-zA-Z0-9-]/g, "");
27947
- const match = html.match(new RegExp("<" + tag + "[^>]*>(.*?)<\\/" + tag + ">", "is"));
27948
- return match ? parser.stripTags(match[1]).trim() || null : null;
27949
- } catch {
27950
- return null;
27951
- }
27952
- },
27953
- querySelectorAll(selector) {
27954
- try {
27955
- const tag = selector.replace(/[^a-zA-Z0-9-]/g, "");
27956
- const regex = new RegExp("<" + tag + "[^>]*>(.*?)<\\/" + tag + ">", "gis");
27957
- const results = [];
27958
- let match;
27959
- while ((match = regex.exec(html)) !== null) {
27960
- const value = parser.stripTags(match[1]).trim();
27961
- if (value) results.push(value);
27962
- }
27963
- return results;
27964
- } catch {
27965
- return [];
27966
- }
27967
- }
27968
- };
27969
- const titleMatch = html.match(/<title[^>]*>(.*?)<\/title>/is);
27970
- const title = titleMatch ? parser.stripTags(titleMatch[1]).trim() || void 0 : void 0;
27971
- const headingRegex = /<h[1-6][^>]*>(.*?)<\/h[1-6]>/gis;
27972
- const headings = [];
27973
- let headingMatch;
27974
- while ((headingMatch = headingRegex.exec(html)) !== null) {
27975
- const text2 = parser.stripTags(headingMatch[1]).trim();
27976
- if (text2) headings.push(text2);
27977
- }
27978
- const linkRegex = /<a\s[^>]*href=["']([^"']*)["'][^>]*>(.*?)<\/a>/gis;
27979
- const links = [];
27980
- let linkMatch;
27981
- while ((linkMatch = linkRegex.exec(html)) !== null) {
27982
- const href = linkMatch[1];
27983
- const text2 = parser.stripTags(linkMatch[2]).trim();
27984
- if (href) links.push({ href, text: text2 });
27985
- }
27986
- const text = parser.stripTags(html);
27987
- return {
27988
- title,
27989
- headings,
27990
- links,
27991
- text,
27992
- querySelector: parser.querySelector,
27993
- querySelectorAll: parser.querySelectorAll
27994
- };
27995
- } catch (error62) {
27996
- throw new Error(
27997
- `parseHTML failed: ${error62 instanceof Error ? error62.message : "Unknown error"}`,
27998
- {
27999
- cause: error62
28000
- }
28001
- );
28002
- }
28003
- }
28004
- function createPortableHelpers(parseHTML) {
28005
- return {
28006
- parseHTML,
28007
- /**
28008
- * Extract email addresses from text
28009
- * @param text Text to search for emails
28010
- * @returns Array of found email addresses
28011
- */
28012
- extractEmails(text) {
28013
- if (typeof text !== "string") {
28014
- return [];
28015
- }
28016
- const emailRegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
28017
- const matches = text.match(emailRegex);
28018
- return matches ? [...new Set(matches)] : [];
28019
- },
28020
- /**
28021
- * Extract URLs from text
28022
- * @param text Text to search for URLs
28023
- * @returns Array of found URLs
28024
- */
28025
- extractURLs(text) {
28026
- if (typeof text !== "string") {
28027
- return [];
28028
- }
28029
- const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/g;
28030
- const matches = text.match(urlRegex);
28031
- return matches ? [...new Set(matches)] : [];
28032
- },
28033
- /**
28034
- * Extract phone numbers from text
28035
- * @param text Text to search for phone numbers
28036
- * @returns Array of found phone numbers
28037
- */
28038
- extractPhoneNumbers(text) {
28039
- if (typeof text !== "string") {
28040
- return [];
28041
- }
28042
- const phoneRegex = /(?:\+?1[-.\s]?)?(?:\([0-9]{3}\)|[0-9]{3})[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}/g;
28043
- const matches = text.match(phoneRegex);
28044
- return matches ? [...new Set(matches)] : [];
28045
- },
28046
- /**
28047
- * Truncate text to specified length with ellipsis
28048
- * @param text Text to truncate
28049
- * @param length Maximum length
28050
- * @returns Truncated text
28051
- */
28052
- truncate(text, length) {
28053
- if (typeof text !== "string" || typeof length !== "number") {
28054
- return text || "";
28055
- }
28056
- if (text.length <= length) {
28057
- return text;
28058
- }
28059
- return text.substring(0, length).trim() + "...";
28060
- },
28061
- /**
28062
- * Create URL-friendly slug from text
28063
- * @param text Text to slugify
28064
- * @returns URL-friendly slug
28065
- */
28066
- slugify(text) {
28067
- if (typeof text !== "string") {
28068
- return "";
28069
- }
28070
- return text.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
28071
- },
28072
- /**
28073
- * Convert Markdown to HTML (basic conversion)
28074
- * @param markdown Markdown text
28075
- * @returns HTML string
28076
- */
28077
- markdown2html(markdown) {
28078
- if (typeof markdown !== "string") {
28079
- return "";
28080
- }
28081
- return markdown.replace(/^### (.*$)/gim, "<h3>$1</h3>").replace(/^## (.*$)/gim, "<h2>$1</h2>").replace(/^# (.*$)/gim, "<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim, "<strong>$1</strong>").replace(/__(.*?)__/gim, "<strong>$1</strong>").replace(/\*(.*?)\*/gim, "<em>$1</em>").replace(/_(.*?)_/gim, "<em>$1</em>").replace(/`(.*?)`/gim, "<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim, '<a href="$2">$1</a>').replace(/\n\n/gim, "</p><p>").replace(/\n/gim, "<br>").replace(/^(?!<[h|u|o|l])/gim, "<p>").replace(/$/gim, "</p>").replace(/<p><\/p>/gim, "").replace(/<p>(<h[1-6]>.*<\/h[1-6]>)<\/p>/gim, "$1");
28082
- },
28083
- /**
28084
- * Convert HTML to Markdown (basic conversion)
28085
- * @param html HTML string
28086
- * @returns Markdown text
28087
- */
28088
- html2markdown(html) {
28089
- if (typeof html !== "string") {
28090
- return "";
28091
- }
28092
- 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][^>]*)$/, "&lt;$1").replace(/\n\s*\n\s*\n/gim, "\n\n").trim();
28093
- },
28094
- /**
28095
- * Parse date from various string formats
28096
- * @param dateStr Date string to parse
28097
- * @returns Date object or null if invalid
28098
- */
28099
- parseDate(dateStr) {
28100
- if (typeof dateStr !== "string") {
28101
- return null;
28102
- }
28103
- try {
28104
- const date5 = new Date(dateStr);
28105
- return isNaN(date5.getTime()) ? null : date5;
28106
- } catch {
28107
- return null;
28108
- }
28109
- },
28110
- /**
28111
- * Format date according to specified format
28112
- * @param date Date object or string
28113
- * @param format Format string (simple patterns)
28114
- * @returns Formatted date string
28115
- */
28116
- formatDate(date5, format) {
28117
- const defaultFormat = format || "YYYY-MM-DD";
28118
- let dateObj;
28119
- if (typeof date5 === "string") {
28120
- dateObj = new Date(date5);
28121
- } else if (date5 instanceof Date) {
28122
- dateObj = date5;
28123
- } else {
28124
- return "";
28125
- }
28126
- if (isNaN(dateObj.getTime())) {
28127
- return "";
28128
- }
28129
- const year = dateObj.getFullYear();
28130
- const month = String(dateObj.getMonth() + 1).padStart(2, "0");
28131
- const day = String(dateObj.getDate()).padStart(2, "0");
28132
- const hours = String(dateObj.getHours()).padStart(2, "0");
28133
- const minutes = String(dateObj.getMinutes()).padStart(2, "0");
28134
- const seconds = String(dateObj.getSeconds()).padStart(2, "0");
28135
- return defaultFormat.replace(/YYYY/g, String(year)).replace(/MM/g, month).replace(/DD/g, day).replace(/HH/g, hours).replace(/mm/g, minutes).replace(/ss/g, seconds);
28136
- },
28137
- /**
28138
- * Add days to a date
28139
- * @param date Date object or string
28140
- * @param days Number of days to add (can be negative)
28141
- * @returns New Date object
28142
- */
28143
- addDays(date5, days) {
28144
- let dateObj;
28145
- if (typeof date5 === "string") {
28146
- dateObj = new Date(date5);
28147
- } else if (date5 instanceof Date) {
28148
- dateObj = new Date(date5.getTime());
28149
- } else {
28150
- return null;
28151
- }
28152
- if (isNaN(dateObj.getTime()) || typeof days !== "number") {
28153
- return null;
28154
- }
28155
- dateObj.setDate(dateObj.getDate() + days);
28156
- return dateObj;
28157
- },
28158
- /**
28159
- * Validate email address format
28160
- * @param email Email address to validate
28161
- * @returns True if valid email format
28162
- */
28163
- isValidEmail(email3) {
28164
- if (typeof email3 !== "string") {
28165
- return false;
28166
- }
28167
- const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
28168
- return emailRegex.test(email3);
28169
- },
28170
- /**
28171
- * Validate URL format
28172
- * @param url URL to validate
28173
- * @returns True if valid URL format
28174
- */
28175
- isValidURL(url2) {
28176
- if (typeof url2 !== "string") {
28177
- return false;
28178
- }
28179
- try {
28180
- new URL(url2);
28181
- return true;
28182
- } catch {
28183
- return false;
28184
- }
28185
- },
28186
- /**
28187
- * Validate JSON string
28188
- * @param str String to validate as JSON
28189
- * @returns True if valid JSON
28190
- */
28191
- isValidJSON(str2) {
28192
- if (typeof str2 !== "string") {
28193
- return false;
28194
- }
28195
- try {
28196
- JSON.parse(str2);
28197
- return true;
28198
- } catch {
28199
- return false;
28200
- }
28201
- },
28202
- /**
28203
- * Encode string to base64
28204
- * @param str String to encode
28205
- * @returns Base64 encoded string
28206
- */
28207
- base64Encode(str2) {
28208
- if (typeof str2 !== "string") {
28209
- return "";
28210
- }
28211
- try {
28212
- return btoa(str2);
28213
- } catch {
28214
- return btoa(unescape(encodeURIComponent(str2)));
28215
- }
28216
- },
28217
- /**
28218
- * Decode base64 string
28219
- * @param str Base64 string to decode
28220
- * @returns Decoded string
28221
- */
28222
- base64Decode(str2) {
28223
- if (typeof str2 !== "string") {
28224
- return "";
28225
- }
28226
- try {
28227
- return atob(str2);
28228
- } catch {
28229
- try {
28230
- return decodeURIComponent(escape(atob(str2)));
28231
- } catch {
28232
- return "";
28233
- }
28234
- }
28235
- },
28236
- /**
28237
- * URL encode string
28238
- * @param str String to encode
28239
- * @returns URL encoded string
28240
- */
28241
- urlEncode(str2) {
28242
- if (typeof str2 !== "string") {
28243
- return "";
28244
- }
28245
- return encodeURIComponent(str2);
28246
- },
28247
- /**
28248
- * URL decode string
28249
- * @param str URL encoded string to decode
28250
- * @returns Decoded string
28251
- */
28252
- urlDecode(str2) {
28253
- if (typeof str2 !== "string") {
28254
- return "";
28255
- }
28256
- try {
28257
- return decodeURIComponent(str2);
28258
- } catch {
28259
- return str2;
28260
- }
28261
- },
28262
- /**
28263
- * Return the first argument that is neither null nor undefined (a named
28264
- * first-non-null / nullish coalesce). The script-side counterpart of the
28265
- * `{{a ?? b}}` template operator — in templates prefer `{{a ?? b}}`; use
28266
- * `helpers.coalesce(a, b)` inside transform-data scripts.
28267
- * @param values Candidate values in priority order
28268
- * @returns The first non-null/undefined value, or null if all are null/undefined
28269
- */
28270
- coalesce(...values) {
28271
- for (const value of values) {
28272
- if (value !== null && value !== void 0) {
28273
- return value;
28274
- }
28275
- }
28276
- return null;
28277
- }
28278
- };
28279
- }
28280
-
28281
28848
  // ../shared/dist/index.mjs
28282
28849
  var FORMULA_TRIGGER = /^[=+\-@\t\r\n]/;
28283
28850
  var STRICT_NUMBER = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
@@ -28381,9 +28948,14 @@ var DEFAULT_CLOUDFLARE_VOICE_SPEECH_PROFILE = Object.freeze({
28381
28948
  voiceId: "asteria"
28382
28949
  })
28383
28950
  });
28951
+ var DEFAULT_OPENAI_LIVE_VOICE_SPEECH_PROFILE = Object.freeze({
28952
+ mode: "speech_to_speech",
28953
+ transcriber: Object.freeze({ provider: "openai", model: "gpt-live-1" }),
28954
+ synthesizer: Object.freeze({ provider: "openai", model: "gpt-live-1", voiceId: "marin" })
28955
+ });
28384
28956
  function resolveVoiceSpeechProfile(profile, managedDefault = DEFAULT_ELEVENLABS_VOICE_SPEECH_PROFILE) {
28385
28957
  if (!profile.speech) return managedDefault;
28386
- const defaults = profile.speech.transcriber.provider === "cloudflare" && profile.speech.synthesizer.provider === "cloudflare" ? DEFAULT_CLOUDFLARE_VOICE_SPEECH_PROFILE : profile.speech.transcriber.provider === "elevenlabs" && profile.speech.synthesizer.provider === "elevenlabs" ? DEFAULT_ELEVENLABS_VOICE_SPEECH_PROFILE : void 0;
28958
+ const defaults = profile.speech.transcriber.provider === "cloudflare" && profile.speech.synthesizer.provider === "cloudflare" ? DEFAULT_CLOUDFLARE_VOICE_SPEECH_PROFILE : profile.speech.transcriber.provider === "elevenlabs" && profile.speech.synthesizer.provider === "elevenlabs" ? DEFAULT_ELEVENLABS_VOICE_SPEECH_PROFILE : profile.speech.mode === "speech_to_speech" && profile.speech.transcriber.provider === "openai" && profile.speech.synthesizer.provider === "openai" ? DEFAULT_OPENAI_LIVE_VOICE_SPEECH_PROFILE : void 0;
28387
28959
  return {
28388
28960
  mode: profile.speech.mode,
28389
28961
  transcriber: {
@@ -29174,6 +29746,20 @@ var MAX_MESSAGE_CONTENT_BYTES = 1024 * 1024;
29174
29746
  var MAX_MESSAGES_TOTAL_BYTES = 32 * 1024 * 1024;
29175
29747
  var encoder = new TextEncoder();
29176
29748
  var UNEVALUATED_VERDICT = Object.freeze({ status: "unevaluated" });
29749
+ var RESERVED_HIDDEN_PARAMETER_PREFIX = "_internal";
29750
+ function isReservedHiddenParameterName(name) {
29751
+ return name.startsWith(RESERVED_HIDDEN_PARAMETER_PREFIX);
29752
+ }
29753
+ function reservedHiddenParameterNameMessage(name) {
29754
+ return `hiddenParameterNames entry "${name}" is reserved: names starting with "${RESERVED_HIDDEN_PARAMETER_PREFIX}" are never filled from execution variables. Use a {{secret:NAME}} reference for credentials.`;
29755
+ }
29756
+ var runtimeToolHiddenParameterNamesSchema = external_exports.array(
29757
+ external_exports.string().min(1, "hiddenParameterNames entries must be non-empty parameter names").superRefine((name, ctx) => {
29758
+ if (isReservedHiddenParameterName(name)) {
29759
+ ctx.addIssue({ code: "custom", message: reservedHiddenParameterNameMessage(name) });
29760
+ }
29761
+ })
29762
+ );
29177
29763
  var AGENT_STATE_DEFAULT_MERGE_STRATEGY = "merge";
29178
29764
  var agentPredictStateMappingSchema = external_exports.object({
29179
29765
  /** Top-level state key the predicted argument projects into. */
@@ -29317,9 +29903,9 @@ var compactionConfigSchema = external_exports.object({
29317
29903
  /** Model id for the summarizer. Defaults to the session's routed model. */
29318
29904
  model: external_exports.string().optional()
29319
29905
  });
29906
+ var deprecatedInlineThresholdCharsSchema = external_exports.number().int().min(1024).optional().meta({ deprecated: true, description: "Deprecated and ignored. Tool results are never spilled." });
29320
29907
  var toolResultsConfigSchema = external_exports.object({
29321
- /** Tool results longer than this are spilled to storage and replaced by a marker. */
29322
- inlineThresholdChars: external_exports.number().int().min(1024).default(8192),
29908
+ inlineThresholdChars: deprecatedInlineThresholdCharsSchema,
29323
29909
  /** Tool output newer than this budget is never masked. */
29324
29910
  pruneHotWindowTokens: external_exports.number().int().min(4e3).default(4e4),
29325
29911
  pruneMode: external_exports.enum(["mask", "off"]).default("mask")
@@ -29351,7 +29937,7 @@ var contextManagementAgentConfigSchema = external_exports.object({
29351
29937
  model: external_exports.string().optional()
29352
29938
  }).optional(),
29353
29939
  toolResults: external_exports.object({
29354
- inlineThresholdChars: external_exports.number().int().min(1024).optional(),
29940
+ inlineThresholdChars: deprecatedInlineThresholdCharsSchema,
29355
29941
  pruneHotWindowTokens: external_exports.number().int().min(4e3).optional(),
29356
29942
  pruneMode: external_exports.enum(["mask", "off"]).optional()
29357
29943
  }).optional()
@@ -29461,7 +30047,10 @@ var sandboxConfigSchema = external_exports.object({
29461
30047
  external_exports.string().min(1, "must be a managed secret key")
29462
30048
  ).refine((record2) => Object.keys(record2).length <= 32, {
29463
30049
  message: "secretEnv supports at most 32 variables"
29464
- }).optional()
30050
+ }).optional(),
30051
+ codingAgents: external_exports.array(external_exports.enum(["opencode"])).max(4).optional().describe(
30052
+ "Coding agents the Sandbox can run as typed sessions. Non-empty adds the agent_session_* tools; empty or absent adds none."
30053
+ )
29465
30054
  // WHY(docs/why/packages/shared/src.md#requireapprovalforbash-was-removed-rather-than-s): requireApprovalForBash was removed rather than ship an inert control; use tools.approval instead
29466
30055
  });
29467
30056
  var agentDurabilityConfigSchema = external_exports.object({
@@ -29498,7 +30087,8 @@ var agentRuntimeConfigSchema = external_exports.object({
29498
30087
  parametersSchema: external_exports.record(external_exports.string(), external_exports.unknown()),
29499
30088
  config: external_exports.record(external_exports.string(), external_exports.unknown()),
29500
30089
  // WHY(docs/features/planning/2026-09-10-durable-inversion-program.md): authored opt-in to durable re-fire; absent means repair instead.
29501
- idempotent: external_exports.boolean().optional()
30090
+ idempotent: external_exports.boolean().optional(),
30091
+ hiddenParameterNames: runtimeToolHiddenParameterNamesSchema.optional()
29502
30092
  }).superRefine(validateToolElicitationDefinition)
29503
30093
  ).optional(),
29504
30094
  mcpServers: external_exports.array(
@@ -36219,8 +36809,9 @@ var userProfileFeaturesSchema = external_exports.object({
36219
36809
  // WHY(docs/claude/telemetry-suppression.md): Org-scoped external-telemetry gate; browser and Code Mode MCP surfaces read it here.
36220
36810
  externalTelemetryAllowed: external_exports.boolean().optional()
36221
36811
  });
36812
+ var SLACK_CHANNEL_HISTORY_SCOPE = "channels:history";
36222
36813
  var SLACK_REQUIRED_BOT_SCOPES = [
36223
- "channels:history",
36814
+ SLACK_CHANNEL_HISTORY_SCOPE,
36224
36815
  "channels:read",
36225
36816
  "chat:write",
36226
36817
  "groups:history",
@@ -36545,7 +37136,8 @@ var agentToolsConfigSchema2 = external_exports.object({
36545
37136
  toolType: external_exports.enum(["flow", "custom", "external", "local", "advisor", "subagent", "search"]).optional(),
36546
37137
  parametersSchema: external_exports.record(external_exports.string(), external_exports.any()).optional(),
36547
37138
  config: external_exports.record(external_exports.string(), external_exports.any()),
36548
- idempotent: external_exports.boolean().optional()
37139
+ idempotent: external_exports.boolean().optional(),
37140
+ hiddenParameterNames: runtimeToolHiddenParameterNamesSchema.optional()
36549
37141
  })
36550
37142
  ).optional(),
36551
37143
  mcpServers: external_exports.array(agentMcpServerSchema).optional(),
@@ -36611,7 +37203,8 @@ var agentClaudeManagedConfigSchema = external_exports.object({
36611
37203
  parametersSchema: external_exports.record(external_exports.string(), external_exports.any()).optional()
36612
37204
  })
36613
37205
  ).optional(),
36614
- timeoutMs: external_exports.number().int().positive().optional()
37206
+ timeoutMs: external_exports.number().int().positive().optional(),
37207
+ outputHandoff: external_exports.boolean().optional()
36615
37208
  }).superRefine((cm, ctx) => {
36616
37209
  const mode = cm.setupMode ?? "connect";
36617
37210
  if (mode === "connect") {
@@ -37046,6 +37639,7 @@ var productReadinessSchema = external_exports.object({
37046
37639
  /** Single best dashboard link if any browser step remains (secret-parity). */
37047
37640
  handoff: browserFulfillmentSchema.optional()
37048
37641
  });
37642
+ var SLACK_CHANNEL_HISTORY_SCOPE_WARNING = `This Slack app was installed without the ${SLACK_CHANNEL_HISTORY_SCOPE} scope, so it only receives mentions. Channel response mode always and judge behave as mention until the app is reinstalled.`;
37049
37643
  var briefFieldStatusSchema = external_exports.enum(["confirmed", "assumed"]);
37050
37644
  var briefProblemSchema = external_exports.object({
37051
37645
  status: briefFieldStatusSchema,
@@ -38836,7 +39430,9 @@ var NON_AI_PROVIDER_IDS = /* @__PURE__ */ new Set([
38836
39430
  "resend",
38837
39431
  "elevenlabs",
38838
39432
  "braintrust",
38839
- "granola"
39433
+ "granola",
39434
+ // WHY(docs/features/planning/2026-09-17-typesafe-system-one-integration.md): Jev is AI but answers questions, never prompts; excluded from prompt-model selectors
39435
+ "typesafe"
38840
39436
  ]);
38841
39437
  function isNonAIProvider(id) {
38842
39438
  const normalized = id.trim().toLowerCase();
@@ -38980,6 +39576,15 @@ var LocalInferenceClientFrameSchema = external_exports.discriminatedUnion("type"
38980
39576
  message: external_exports.string().min(1).max(2e3)
38981
39577
  })
38982
39578
  ]);
39579
+ var TAIL_LEVEL_MEMBERS = {
39580
+ debug: true,
39581
+ info: true,
39582
+ warn: true,
39583
+ error: true
39584
+ };
39585
+ var ALL_TAIL_LEVELS = Object.keys(
39586
+ TAIL_LEVEL_MEMBERS
39587
+ );
38983
39588
  function flattenTextContent(content) {
38984
39589
  if (typeof content === "string") return content;
38985
39590
  return content.filter(
@@ -39269,7 +39874,7 @@ var DispatchRequestEnvelopeSchema = external_exports.object({
39269
39874
  'Conversation history for this turn, or with `history: "stored"` only the new delta. A `system` message that is not the first message keeps its position on OpenAI-family models (so a per-turn system message sent last leaves the cached leading prompt untouched) and is folded into the leading system prompt on providers that require a single leading system turn. A `tool` message must carry `toolResults` answering an assistant `toolCalls` entry issued earlier in the array.'
39270
39875
  ),
39271
39876
  history: external_exports.enum(["inline", "stored"]).optional().describe(
39272
- 'Where this turn\'s prior history comes from. "inline" (the default, and today\'s behavior) replays exactly the `messages` sent here. "stored" replays the transcript saved on the `conversationId` conversation, treats `messages` as the new delta, and appends both the delta and the settled assistant turn back onto it; it requires a saved `agent.agentId` and a `conversationId`, and is refused for a flow dispatch, an inline or `claude_managed` agent, `Prefer: respond-async`, a join, or a resume.'
39877
+ 'Where this turn\'s prior history comes from. "inline" (the default, and today\'s behavior) replays exactly the `messages` sent here. "stored" replays the transcript saved on the `conversationId` conversation, treats `messages` as the new delta, and appends both the delta and the settled assistant turn back onto it; it requires a saved `agent.agentId` and a `conversationId`, and is refused for a flow dispatch, an inline or `claude_managed` agent, `Prefer: respond-async`, a steer (`x-runtype-concurrency: steer`), or a resume.'
39273
39878
  ),
39274
39879
  /**
39275
39880
  * Stable caller-provided conversation/session id. Used to scope
@@ -39294,13 +39899,7 @@ var DispatchRequestEnvelopeSchema = external_exports.object({
39294
39899
  clientToolsPolicy: ClientToolsPolicySchema.optional(),
39295
39900
  secrets: external_exports.record(external_exports.string(), external_exports.string()).optional().describe(DISPATCH_TRANSIENT_SECRETS_RETIRED_NOTE),
39296
39901
  credentialProxies: external_exports.array(credentialProxyConfigSchema).max(10).optional(),
39297
- inputs: external_exports.record(external_exports.string(), external_exports.any()).optional().refine(
39298
- (data) => {
39299
- if (!data) return true;
39300
- return Object.keys(data).every((key) => !key.startsWith("_"));
39301
- },
39302
- { message: "Input keys cannot start with '_' (reserved for system variables)" }
39303
- ),
39902
+ inputs: external_exports.record(external_exports.string(), external_exports.any()).optional().refine(hasNoReservedInputKeys, { message: RESERVED_INPUT_KEY_MESSAGE }),
39304
39903
  // WHY(docs/why/packages/shared/src/api-schemas.md#enduser-identity-drives-memory-profile-sharding): endUser identity drives memory-profile sharding and is exposed as _endUser.*, distinct from _user.
39305
39904
  endUser: external_exports.object({
39306
39905
  id: external_exports.string().min(1),
@@ -39962,6 +40561,58 @@ var sandboxDeployEffectivePolicySchema = external_exports.object({
39962
40561
  autoStopInterval: external_exports.number().optional(),
39963
40562
  autoDeleteInterval: external_exports.number().optional()
39964
40563
  });
40564
+ var MANAGED_RECOVERY_LIMITS = Object.freeze({
40565
+ /** Automatic attempts per incident, counted in OPERATIONS rather than requests. */
40566
+ attemptsPerIncident: 3,
40567
+ /** Backoff armed after attempt 1, 2 and 3 settles unsuccessfully; jitter is added to each. */
40568
+ retryDelaysMs: Object.freeze([5e3, 3e4, 12e4]),
40569
+ /** Automatic provider replacements per deployment inside `replacementWindowMs`. */
40570
+ replacementsPerWindow: 2,
40571
+ replacementWindowMs: 60 * 6e4,
40572
+ /** Continuously healthy for this long before an incident's counters reset. */
40573
+ healthyResetMs: 10 * 6e4,
40574
+ /** How long one cold request may observe an already-running reconcile. */
40575
+ coldObservationMs: 5e3
40576
+ });
40577
+ var MANAGED_RECOVERY_REPLACEMENT_STAGES = MANAGED_DEPLOYMENT_STAGE_PLAN.create;
40578
+ var MANAGED_RECOVERY_WAKE_STAGES = MANAGED_DEPLOYMENT_STAGE_PLAN.resume;
40579
+ var MANAGED_RECOVERY_PROCESS_STAGES = Object.freeze([
40580
+ "start-process",
40581
+ "resolve-ingress"
40582
+ ]);
40583
+ var MANAGED_RECOVERY_UNHEALTHY_PROCESS_STAGES = Object.freeze(["stop-process", "start-process", "resolve-ingress"]);
40584
+ var MANAGED_CLEANUP_LIMITS = Object.freeze({
40585
+ /** How long one worker holds a provider-instance row before another may reclaim it. */
40586
+ claimMs: 2 * 6e4,
40587
+ /** The cleanup operation's own absolute deadline, short because it holds the live-mutation slot. */
40588
+ operationDeadlineMs: 2 * 6e4,
40589
+ /** How long past an unacknowledged create's deadline before the durable host is asked to settle it. */
40590
+ // INVARIANT: Pacing only. Elapsed time never proves absence; only the host's destroy-sandbox answer does.
40591
+ lateCreateHoldMs: 10 * 6e4,
40592
+ /** First retry delay after a cleanup attempt that resolved nothing. */
40593
+ minBackoffMs: 6e4,
40594
+ /** Ceiling on the retry delay, so a permanently blocked row still re-checks. */
40595
+ maxBackoffMs: 6 * 60 * 6e4,
40596
+ /** Rows one bounded pass may claim, so cleanup never spends another phase's capacity. */
40597
+ batchLimit: 5,
40598
+ /** Bound on a persisted reason, matching what an operator can usefully read. */
40599
+ reasonLength: 500
40600
+ });
40601
+ var EVIDENCE_BY_FAILURE_CODE = Object.freeze({
40602
+ capability_not_admitted: "capability-unavailable",
40603
+ credential_unavailable: "credential-failure",
40604
+ deadline_exceeded: "provider-unreachable",
40605
+ dependency_lock_invalid: "provider-refused",
40606
+ initialization_incomplete: "provider-refused",
40607
+ instance_not_owned: "ownership-mismatch",
40608
+ network_policy_blocks_install: "provider-refused",
40609
+ profile_unavailable: "provider-refused",
40610
+ provider_error: "provider-refused",
40611
+ provider_unreachable: "provider-unreachable",
40612
+ runtime_profile_mismatch: "ownership-mismatch",
40613
+ source_rejected: "provider-refused",
40614
+ stage_unsupported: "capability-unavailable"
40615
+ });
39965
40616
  var MANAGED_DEPLOYMENT_DESIRED_STATES = [
39966
40617
  "active",
39967
40618
  "suspended",
@@ -40085,8 +40736,11 @@ var MANAGED_DEPLOYMENT_OPERATION_KINDS = [
40085
40736
  "renew",
40086
40737
  "suspend",
40087
40738
  "resume",
40739
+ "recover",
40740
+ "sleep",
40088
40741
  "destroy",
40089
- "expire"
40742
+ "expire",
40743
+ "cleanup"
40090
40744
  ];
40091
40745
  var MANAGED_DEPLOYMENT_OPERATION_STATUSES = [
40092
40746
  "pending",
@@ -45655,6 +46309,30 @@ import chalk13 from "chalk";
45655
46309
  import React8 from "react";
45656
46310
  import { render as render8 } from "ink";
45657
46311
  import { useState as useState9, useEffect as useEffect10 } from "react";
46312
+ function buildToolRunBody(options) {
46313
+ const parameters = resolveJsonPayload(options.input, options.fromFile, "input parameters");
46314
+ const toolConfig = options.config !== void 0 || options.configFile !== void 0 ? resolveJsonPayload(options.config, options.configFile, "tool config") : void 0;
46315
+ return { parameters, ...toolConfig ? { toolConfig } : {} };
46316
+ }
46317
+ function isRecord5(value) {
46318
+ return typeof value === "object" && value !== null && !Array.isArray(value);
46319
+ }
46320
+ function formatToolMetadata(metadata) {
46321
+ if (!metadata || Object.keys(metadata).length === 0) return void 0;
46322
+ const { judgment, ...rest } = metadata;
46323
+ const parts = [];
46324
+ if (isRecord5(judgment)) {
46325
+ const model = judgment.resolvedModelId ?? judgment.requestedModel ?? "unknown";
46326
+ const cost = typeof judgment.estimatedCostUsd === "number" ? `$${judgment.estimatedCostUsd.toFixed(6)}` : "unknown";
46327
+ parts.push(
46328
+ `judgment: model ${String(model)}, key source ${String(judgment.keySource ?? "unknown")}, estimated cost ${cost}`
46329
+ );
46330
+ } else if (judgment !== void 0) {
46331
+ rest.judgment = judgment;
46332
+ }
46333
+ if (Object.keys(rest).length > 0) parts.push(JSON.stringify(rest));
46334
+ return parts.join("; ");
46335
+ }
45658
46336
  var toolsCommand = new Command9("tools").description("Manage runtime tools (saved tools)");
45659
46337
  toolsCommand.command("list").description("List your tools").option("--limit <n>", "Limit results (defaults to the API page size)").option("--cursor <cursor>", "Pagination cursor for the next page").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
45660
46338
  const apiKey = await ensureAuth();
@@ -45993,12 +46671,11 @@ toolsCommand.command("delete <id>").description("Delete a tool").option("--tty",
45993
46671
  const { waitUntilExit } = render8(React8.createElement(runDelete()));
45994
46672
  await waitUntilExit();
45995
46673
  });
45996
- toolsCommand.command("execute <id>").description("Execute a tool with input parameters").option("--input <json>", "Inline input parameters JSON").option("--from-file <file>", "Read input parameters JSON from a file").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
46674
+ toolsCommand.command("execute <id>").description("Execute a tool with input parameters").option("--input <json>", "Inline input parameters JSON").option("--from-file <file>", "Read input parameters JSON from a file").option("--config <json>", "Inline tool config JSON (builtin: and platform: tools)").option("--config-file <file>", "Read tool config JSON from a file").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
45997
46675
  async (id, options) => {
45998
46676
  const apiKey = await ensureAuth();
45999
46677
  if (!apiKey) return;
46000
- const parameters = resolveJsonPayload(options.input, options.fromFile, "input parameters");
46001
- const body = { parameters };
46678
+ const body = buildToolRunBody(options);
46002
46679
  const client = createCliClient(apiKey);
46003
46680
  if (!isTTY(options) || options.json) {
46004
46681
  try {
@@ -46017,6 +46694,8 @@ toolsCommand.command("execute <id>").description("Execute a tool with input para
46017
46694
  }
46018
46695
  const errMsg = data.error ?? data.errorMessage;
46019
46696
  if (errMsg) console.log(` ${chalk13.red("Error")}: ${errMsg}`);
46697
+ const metadataLine = formatToolMetadata(data.metadata);
46698
+ if (metadataLine) console.log(` Metadata: ${metadataLine}`);
46020
46699
  console.log(` Result: ${JSON.stringify(data.result ?? data, null, 2)}`);
46021
46700
  } catch (error62) {
46022
46701
  const message = error62 instanceof Error ? error62.message : "Unknown error";
@@ -46049,6 +46728,7 @@ toolsCommand.command("execute <id>").description("Execute a tool with input para
46049
46728
  value: data.executionTimeMs !== void 0 ? `${data.executionTimeMs}ms` : void 0
46050
46729
  },
46051
46730
  { label: "Error", value: errMsg, color: "red" },
46731
+ { label: "Metadata", value: formatToolMetadata(data.metadata) },
46052
46732
  {
46053
46733
  label: "Result",
46054
46734
  value: JSON.stringify(data.result ?? data)
@@ -46079,12 +46759,11 @@ toolsCommand.command("execute <id>").description("Execute a tool with input para
46079
46759
  await waitUntilExit();
46080
46760
  }
46081
46761
  );
46082
- toolsCommand.command("test <id>").description("Test a tool with sample input parameters").option("--input <json>", "Inline input parameters JSON").option("--from-file <file>", "Read input parameters JSON from a file").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
46762
+ toolsCommand.command("test <id>").description("Test a tool with sample input parameters").option("--input <json>", "Inline input parameters JSON").option("--from-file <file>", "Read input parameters JSON from a file").option("--config <json>", "Inline tool config JSON (builtin: and platform: tools)").option("--config-file <file>", "Read tool config JSON from a file").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
46083
46763
  async (id, options) => {
46084
46764
  const apiKey = await ensureAuth();
46085
46765
  if (!apiKey) return;
46086
- const parameters = resolveJsonPayload(options.input, options.fromFile, "input parameters");
46087
- const body = { parameters };
46766
+ const body = buildToolRunBody(options);
46088
46767
  const client = createCliClient(apiKey);
46089
46768
  if (!isTTY(options) || options.json) {
46090
46769
  try {
@@ -46103,6 +46782,8 @@ toolsCommand.command("test <id>").description("Test a tool with sample input par
46103
46782
  }
46104
46783
  const errMsg = data.error ?? data.errorMessage;
46105
46784
  if (errMsg) console.log(` ${chalk13.red("Error")}: ${errMsg}`);
46785
+ const metadataLine = formatToolMetadata(data.metadata);
46786
+ if (metadataLine) console.log(` Metadata: ${metadataLine}`);
46106
46787
  console.log(` Result: ${JSON.stringify(data.result ?? data, null, 2)}`);
46107
46788
  } catch (error62) {
46108
46789
  const message = error62 instanceof Error ? error62.message : "Unknown error";
@@ -46135,6 +46816,7 @@ toolsCommand.command("test <id>").description("Test a tool with sample input par
46135
46816
  value: data.executionTimeMs !== void 0 ? `${data.executionTimeMs}ms` : void 0
46136
46817
  },
46137
46818
  { label: "Error", value: errMsg, color: "red" },
46819
+ { label: "Metadata", value: formatToolMetadata(data.metadata) },
46138
46820
  {
46139
46821
  label: "Result",
46140
46822
  value: JSON.stringify(data.result ?? data)
@@ -46614,6 +47296,23 @@ import chalk16 from "chalk";
46614
47296
  import React11 from "react";
46615
47297
  import { render as render11 } from "ink";
46616
47298
  import { useState as useState12, useEffect as useEffect13 } from "react";
47299
+ var STORE_UNAVAILABLE_MESSAGE = "Log store temporarily unavailable";
47300
+ function reportStoreUnavailable(message, subject) {
47301
+ if (!message.includes(STORE_UNAVAILABLE_MESSAGE)) return false;
47302
+ console.error(
47303
+ chalk16.red(
47304
+ `The log store is temporarily unavailable. No ${subject} could be read; retry shortly.`
47305
+ )
47306
+ );
47307
+ return true;
47308
+ }
47309
+ function countsStartAfter(coveredFrom, from) {
47310
+ if (!coveredFrom) return null;
47311
+ const covered = Date.parse(coveredFrom);
47312
+ if (!Number.isFinite(covered)) return null;
47313
+ if (from !== void 0 && covered <= Date.parse(from)) return null;
47314
+ return new Date(covered).toISOString();
47315
+ }
46617
47316
  function filterParams(options) {
46618
47317
  return {
46619
47318
  from: options.from,
@@ -46624,7 +47323,9 @@ function filterParams(options) {
46624
47323
  agentId: options.agent,
46625
47324
  executionId: options.execution,
46626
47325
  surfaceId: options.surface,
46627
- conversationId: options.conversation
47326
+ conversationId: options.conversation,
47327
+ status: options.status,
47328
+ type: options.type
46628
47329
  };
46629
47330
  }
46630
47331
  function levelColor(level) {
@@ -46642,7 +47343,10 @@ function levelColor(level) {
46642
47343
  var logsCommand = new Command12("logs").description(
46643
47344
  "Query historical logs and aggregate stats (use `tail` for live streaming)"
46644
47345
  );
46645
- logsCommand.command("list").description("Query persisted logs with filtering, search, and pagination").option("--from <iso>", "Start timestamp (ISO 8601, default: 24 hours ago)").option("--to <iso>", "End timestamp (ISO 8601, default: now)").option("--level <levels>", "Comma-separated log levels (debug,info,warn,error)").option("--category <categories>", "Comma-separated categories (execution,agent,tool,...)").option("--flow <id>", "Filter by flow ID").option("--agent <id>", "Filter by agent ID").option("--execution <id>", "Filter by execution ID").option("--surface <id>", "Filter by surface ID").option("--conversation <id>", "Filter by conversation ID").option("--search <text>", "Full-text search within the log message").option("--limit <n>", "Max results per page (default 500, max 1000)").option("--cursor <cursor>", "Pagination cursor from a previous page").option("--order <order>", "Sort order: asc or desc (default desc)").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
47346
+ logsCommand.command("list").description("Query persisted logs with filtering, search, and pagination").option("--from <iso>", "Start timestamp (ISO 8601, default: 24 hours ago)").option("--to <iso>", "End timestamp (ISO 8601, default: now)").option("--level <levels>", "Comma-separated log levels (debug,info,warn,error)").option("--category <categories>", "Comma-separated categories (execution,agent,tool,...)").option("--flow <id>", "Filter by flow ID").option("--agent <id>", "Filter by agent ID").option("--execution <id>", "Filter by execution ID").option("--surface <id>", "Filter by surface ID").option("--conversation <id>", "Filter by conversation ID").option("--status <statuses>", "Comma-separated statuses (completed,failed,unknown,...)").option("--type <types>", "Comma-separated entry types (flow,step,tool,agent,model,...)").option(
47347
+ "--search <text>",
47348
+ "Substring search over a span's message, name, operation, tool name or error class"
47349
+ ).option("--limit <n>", "Max results per page (default 500, max 1000)").option("--cursor <cursor>", "Pagination cursor from a previous page").option("--order <order>", "Sort order: asc or desc (default desc)").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
46646
47350
  async (options) => {
46647
47351
  const apiKey = await ensureAuth();
46648
47352
  if (!apiKey) return;
@@ -46661,10 +47365,15 @@ logsCommand.command("list").description("Query persisted logs with filtering, se
46661
47365
  printJson(res);
46662
47366
  return;
46663
47367
  }
46664
- if (res.data?.degraded) {
47368
+ if (res.data?.live?.served === false && res.data.live.reason === "hot_tier_failed") {
47369
+ console.error(
47370
+ chalk16.yellow("Warning: entries from the last few minutes could not be loaded")
47371
+ );
47372
+ }
47373
+ if (res.data?.pagination?.cursorReset) {
46665
47374
  console.error(
46666
47375
  chalk16.yellow(
46667
- "Warning: historical logs are temporarily unavailable; showing recent entries only"
47376
+ "Warning: the cursor was rejected and this is page one again. Do not re-follow it."
46668
47377
  )
46669
47378
  );
46670
47379
  }
@@ -46693,9 +47402,15 @@ logsCommand.command("list").description("Query persisted logs with filtering, se
46693
47402
  }
46694
47403
  console.log(chalk16.dim(`
46695
47404
  Total: ${entries.length} entries`));
46696
- printNextCursorHint("runtype logs list", res.data?.pagination);
47405
+ if (!res.data?.pagination?.cursorReset) {
47406
+ printNextCursorHint("runtype logs list", res.data?.pagination);
47407
+ }
46697
47408
  } catch (error62) {
46698
47409
  const message = error62 instanceof Error ? error62.message : "Unknown error";
47410
+ if (reportStoreUnavailable(message, "entries")) {
47411
+ process.exitCode = 1;
47412
+ return;
47413
+ }
46699
47414
  console.error(chalk16.red(`Failed to query logs: ${message}`));
46700
47415
  process.exit(1);
46701
47416
  }
@@ -46741,12 +47456,15 @@ logsCommand.command("list").description("Query persisted logs with filtering, se
46741
47456
  await waitUntilExit();
46742
47457
  }
46743
47458
  );
46744
- logsCommand.command("stats").description("Aggregate log stats: totals, counts by level/category, and a histogram").option("--from <iso>", "Start timestamp (ISO 8601, default: 24 hours ago)").option("--to <iso>", "End timestamp (ISO 8601, default: now)").option("--level <levels>", "Comma-separated log levels (debug,info,warn,error)").option("--category <categories>", "Comma-separated categories (execution,agent,tool,...)").option("--flow <id>", "Filter by flow ID").option("--agent <id>", "Filter by agent ID").option("--execution <id>", "Filter by execution ID").option("--surface <id>", "Filter by surface ID").option("--conversation <id>", "Filter by conversation ID").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
47459
+ logsCommand.command("stats").description("Aggregate log stats: totals, counts by level/category, and a histogram").option("--from <iso>", "Start timestamp (ISO 8601, default: 24 hours ago)").option("--to <iso>", "End timestamp (ISO 8601, default: now)").option("--level <levels>", "Comma-separated log levels (debug,info,warn,error)").option("--category <categories>", "Comma-separated categories (execution,agent,tool,...)").option("--flow <id>", "Filter by flow ID").option("--agent <id>", "Filter by agent ID").option("--execution <id>", "Filter by execution ID").option("--surface <id>", "Filter by surface ID").option("--conversation <id>", "Filter by conversation ID").option("--status <statuses>", "Comma-separated statuses (completed,failed,unknown,...)").option("--type <types>", "Comma-separated entry types (flow,step,tool,agent,model,...)").option(
47460
+ "--search <text>",
47461
+ "Substring search over a span's message, name, operation, tool name or error class"
47462
+ ).option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
46745
47463
  async (options) => {
46746
47464
  const apiKey = await ensureAuth();
46747
47465
  if (!apiKey) return;
46748
47466
  const client = createCliClient(apiKey);
46749
- const params = filterParams(options);
47467
+ const params = { ...filterParams(options), search: options.search };
46750
47468
  const formatCounts = (counts) => {
46751
47469
  const entries = Object.entries(counts);
46752
47470
  if (entries.length === 0) return "(none)";
@@ -46763,10 +47481,14 @@ logsCommand.command("stats").description("Aggregate log stats: totals, counts by
46763
47481
  if (stats?.degraded) {
46764
47482
  console.error(
46765
47483
  chalk16.yellow(
46766
- "Warning: historical log storage is temporarily unavailable; counts cover recent entries only"
47484
+ "Warning: part of this window could not be read; counts are partial"
46767
47485
  )
46768
47486
  );
46769
47487
  }
47488
+ const startsLate = countsStartAfter(stats.coveredFrom, params.from);
47489
+ if (startsLate) {
47490
+ console.error(chalk16.yellow(`Counts start ${startsLate}`));
47491
+ }
46770
47492
  printDetail("Log Stats", [
46771
47493
  { label: "Total", value: stats.total },
46772
47494
  { label: "By Level", value: formatCounts(stats.byLevel ?? {}) },
@@ -46787,7 +47509,9 @@ Histogram (${histogram.length} buckets):`));
46787
47509
  }
46788
47510
  } catch (error62) {
46789
47511
  const message = error62 instanceof Error ? error62.message : "Unknown error";
46790
- console.error(chalk16.red(`Failed to query log stats: ${message}`));
47512
+ if (!reportStoreUnavailable(message, "counts")) {
47513
+ console.error(chalk16.red(`Failed to query log stats: ${message}`));
47514
+ }
46791
47515
  process.exit(1);
46792
47516
  }
46793
47517
  return;
@@ -50766,9 +51490,10 @@ function readFileContent(filePath, snapshots, liveTools, maxLines = 5e3) {
50766
51490
  // src/marathon/sandbox.ts
50767
51491
  import chalk20 from "chalk";
50768
51492
  import {
50769
- evaluateGeneratedRuntimeToolProposal
51493
+ evaluateGeneratedRuntimeToolProposal,
51494
+ isBuiltinToolExecuteResponse
50770
51495
  } from "@runtypelabs/sdk";
50771
- function isRecord5(value) {
51496
+ function isRecord6(value) {
50772
51497
  return typeof value === "object" && value !== null && !Array.isArray(value);
50773
51498
  }
50774
51499
  function parseSandboxProvider(value) {
@@ -50950,7 +51675,7 @@ function createSandboxLocalTool(client, provider, debugMode) {
50950
51675
  }
50951
51676
  const language = parseSandboxLanguage(provider, args.language);
50952
51677
  const timeout = parseSandboxTimeout(args.timeoutMs, provider);
50953
- const parameters = isRecord5(args.parameters) ? args.parameters : {};
51678
+ const parameters = isRecord6(args.parameters) ? args.parameters : {};
50954
51679
  const gateDecision = evaluateGeneratedRuntimeToolProposal(
50955
51680
  {
50956
51681
  name: "run_sandbox_code",
@@ -51002,6 +51727,9 @@ function createSandboxLocalTool(client, provider, debugMode) {
51002
51727
  parameters
51003
51728
  };
51004
51729
  const execution = await client.tools.execute(created.id, executeRequest);
51730
+ if (isBuiltinToolExecuteResponse(execution)) {
51731
+ throw new Error("Sandbox tool returned a built-in tool result for a saved tool");
51732
+ }
51005
51733
  const parsedResult = provider === "daytona" ? parseDaytonaExecutionResult(execution.result) : execution.result;
51006
51734
  return {
51007
51735
  success: execution.status === "success",
@@ -69584,6 +70312,10 @@ async function configureWithNativeCli(agent, options) {
69584
70312
  cwd: tmpdir()
69585
70313
  });
69586
70314
  if (inspection.error?.includes("ENOENT")) {
70315
+ if (agent === "codex") {
70316
+ const adapter = options.adapter ?? await loadAddMcpAdapter();
70317
+ return configureWithFallbackWriter(agent, { force: options.force, adapter });
70318
+ }
69587
70319
  return {
69588
70320
  configured: false,
69589
70321
  changed: false,
@@ -69608,6 +70340,10 @@ async function configureWithNativeCli(agent, options) {
69608
70340
  cwd: tmpdir()
69609
70341
  });
69610
70342
  if (installation.error?.includes("ENOENT")) {
70343
+ if (agent === "codex") {
70344
+ const adapter = options.adapter ?? await loadAddMcpAdapter();
70345
+ return configureWithFallbackWriter(agent, { force: options.force, adapter });
70346
+ }
69611
70347
  return {
69612
70348
  configured: false,
69613
70349
  changed: false,
@@ -71814,11 +72550,11 @@ import path20 from "path";
71814
72550
  var MAX_SIDECAR_OUTPUT_BYTES = 1048576;
71815
72551
  var MAX_HELPER_BYTES = 100 * 1048576;
71816
72552
  var DEFAULT_SIDECAR_TIMEOUT_MS = 3e4;
71817
- function isRecord6(value) {
72553
+ function isRecord7(value) {
71818
72554
  return typeof value === "object" && value !== null && !Array.isArray(value);
71819
72555
  }
71820
72556
  function parseHello(value) {
71821
- if (!isRecord6(value) || typeof value.providerId !== "string" || typeof value.protocolVersion !== "number" || typeof value.helperVersion !== "string" || typeof value.platform !== "string" || !Array.isArray(value.capabilities) || !value.capabilities.every((capability) => typeof capability === "string")) {
72557
+ if (!isRecord7(value) || typeof value.providerId !== "string" || typeof value.protocolVersion !== "number" || typeof value.helperVersion !== "string" || typeof value.platform !== "string" || !Array.isArray(value.capabilities) || !value.capabilities.every((capability) => typeof capability === "string")) {
71822
72558
  throw new DeviceProviderError(
71823
72559
  "The native helper returned an invalid hello response",
71824
72560
  "INVALID_RESPONSE"
@@ -71957,7 +72693,7 @@ var MacOSDeviceProvider = class {
71957
72693
  );
71958
72694
  }
71959
72695
  const result = await this.invokeAt(binaryPath, method, params);
71960
- if (!isRecord6(result)) {
72696
+ if (!isRecord7(result)) {
71961
72697
  throw new DeviceProviderError(
71962
72698
  "The native helper returned a non-object result",
71963
72699
  "INVALID_RESPONSE"
@@ -72187,11 +72923,11 @@ var defaultDependencies3 = {
72187
72923
  process.exitCode = code;
72188
72924
  }
72189
72925
  };
72190
- function isRecord7(value) {
72926
+ function isRecord8(value) {
72191
72927
  return typeof value === "object" && value !== null && !Array.isArray(value);
72192
72928
  }
72193
72929
  function unwrapData(response) {
72194
- if (!isRecord7(response) || !("data" in response)) {
72930
+ if (!isRecord8(response) || !("data" in response)) {
72195
72931
  throw new Error("Runtype API returned an invalid device response");
72196
72932
  }
72197
72933
  return response.data;
@@ -72200,11 +72936,11 @@ function errorMessage2(error62) {
72200
72936
  return error62 instanceof Error ? error62.message : String(error62);
72201
72937
  }
72202
72938
  function apiStatusCode(error62) {
72203
- return isRecord7(error62) && typeof error62.statusCode === "number" ? error62.statusCode : null;
72939
+ return isRecord8(error62) && typeof error62.statusCode === "number" ? error62.statusCode : null;
72204
72940
  }
72205
72941
  function isRecordedRevocationError(error62) {
72206
72942
  if (apiStatusCode(error62) !== 503) return false;
72207
- const data = isRecord7(error62) && isRecord7(error62.data) ? error62.data : null;
72943
+ const data = isRecord8(error62) && isRecord8(error62.data) ? error62.data : null;
72208
72944
  const detail = typeof data?.error === "string" ? data.error : errorMessage2(error62);
72209
72945
  return detail.toLowerCase().includes("revocation was recorded");
72210
72946
  }
@@ -72557,7 +73293,7 @@ Grant Full Disk Access to ${String(local.executablePath)} to enable iMessage rea
72557
73293
  return;
72558
73294
  }
72559
73295
  const content = await readFile2(status.logPath, "utf8").catch((error62) => {
72560
- const code = isRecord7(error62) ? error62.code : void 0;
73296
+ const code = isRecord8(error62) ? error62.code : void 0;
72561
73297
  if (code === "ENOENT") return "";
72562
73298
  throw error62;
72563
73299
  });