@wayai/cli 0.3.215 → 0.3.217

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -447,11 +447,11 @@ function captureException2(error, context) {
447
447
  Sentry.captureException(error);
448
448
  });
449
449
  }
450
- function addApiBreadcrumb(method, path41) {
450
+ function addApiBreadcrumb(method, path42) {
451
451
  if (!initialized) return;
452
452
  Sentry.addBreadcrumb({
453
453
  category: "http",
454
- message: `${method} ${path41}`,
454
+ message: `${method} ${path42}`,
455
455
  level: "info"
456
456
  });
457
457
  }
@@ -512,7 +512,7 @@ var init_chunk_VORPHGDT = __esm({
512
512
  }
513
513
  });
514
514
 
515
- // ../../packages/core/dist/chunk-2TNXNKRP.js
515
+ // ../../packages/core/dist/chunk-BBFWR2LG.js
516
516
  function spokenLineField(label, description2) {
517
517
  return { type: "text", label, maxLength: SPOKEN_LINE_MAX_CHARS, default: "", description: description2 };
518
518
  }
@@ -521,9 +521,9 @@ function byLowercaseName(a, b) {
521
521
  const y = b.connector_name.toLowerCase();
522
522
  return x < y ? -1 : x > y ? 1 : 0;
523
523
  }
524
- var CALLER_LANGUAGE, TTS_VOICE_REPLY_ENABLED_FIELD, COPILOT_TRIGGER_FIELD, AUDIO_LANGUAGE_OPTIONS, whatsapp, instagram, resend, telegram, API_CHANNEL_DELIVERY_EVENTS, apiChannel, OPENAI_REASONING_MODELS, openai, anthropic, googleAiStudio, openRouter, xai, groqStt, openaiStt, elevenLabsStt, openaiTts, groqTts, elevenLabsTts, GEMINI_TTS_VOICES, googleTts, wayai, externalResources, restApiTool, mcpServer, REKOR_TOOLSET_SERVICE_NAME, rekorToolset, CLAUDE_HARNESS_MODELS, CLAUDE_HARNESS_MODEL_OPTIONS, HARNESS_MCP_SERVERS_FIELD, HARNESS_EGRESS_FIELDS, claudeManagedAgents, SPOKEN_LINE_MAX_CHARS, gptLive, CONNECTORS;
525
- var init_chunk_2TNXNKRP = __esm({
526
- "../../packages/core/dist/chunk-2TNXNKRP.js"() {
524
+ var CALLER_LANGUAGE, TTS_VOICE_REPLY_ENABLED_FIELD, COPILOT_TRIGGER_FIELD, SANDBOX_AGENT_FIELDS, AUDIO_LANGUAGE_OPTIONS, whatsapp, instagram, resend, telegram, API_CHANNEL_DELIVERY_EVENTS, apiChannel, OPENAI_REASONING_MODELS, openai, anthropic, googleAiStudio, openRouter, xai, groqStt, openaiStt, elevenLabsStt, openaiTts, groqTts, elevenLabsTts, GEMINI_TTS_VOICES, googleTts, wayai, externalResources, restApiTool, mcpServer, REKOR_TOOLSET_SERVICE_NAME, rekorToolset, CLAUDE_HARNESS_MODELS, CLAUDE_HARNESS_MODEL_OPTIONS, HARNESS_MCP_SERVERS_FIELD, HARNESS_EGRESS_FIELDS, claudeManagedAgents, SPOKEN_LINE_MAX_CHARS, gptLive, CONNECTORS;
525
+ var init_chunk_BBFWR2LG = __esm({
526
+ "../../packages/core/dist/chunk-BBFWR2LG.js"() {
527
527
  "use strict";
528
528
  CALLER_LANGUAGE = "caller";
529
529
  TTS_VOICE_REPLY_ENABLED_FIELD = {
@@ -546,6 +546,33 @@ var init_chunk_2TNXNKRP = __esm({
546
546
  description: 'When this agent runs as a Copilot, whether it drafts a suggestion automatically on every incoming message ("Every message") or only when a team member clicks "Suggest reply" ("On demand"). On demand reduces cost and noise. No effect on Pilot agents.'
547
547
  }
548
548
  };
549
+ SANDBOX_AGENT_FIELDS = {
550
+ code_execution_enabled: {
551
+ type: "toggle",
552
+ label: "Code Execution Sandbox",
553
+ default: false,
554
+ description: "Let this agent run code in a WayAI sandbox with the sandbox tools, bash, copy_to_sandbox and copy_from_sandbox (add them under Tools): one disposable Linux container per conversation, started on first use and ended after 10 minutes without use or 60 minutes in all. On Anthropic and OpenAI agents this also enables download_file and upload_file, which use the provider's own sandbox."
555
+ },
556
+ sandbox_network: {
557
+ type: "select",
558
+ label: "Sandbox Network",
559
+ options: [
560
+ { value: "none", label: "No network" },
561
+ { value: "allowlist", label: "Allowlist" },
562
+ { value: "web", label: "Web" }
563
+ ],
564
+ default: "none",
565
+ description: "What code in this agent's sandbox can reach. No network: nothing leaves the sandbox. Allowlist: HTTP and HTTPS to the hosts listed below only, through WayAI; no DNS or other protocol leaves, but data can still be sent to those hosts. Web: HTTP and HTTPS to any public host, through WayAI; data can be sent to any of them. WayAI adds no credentials to these requests."
566
+ },
567
+ sandbox_allowed_hosts: {
568
+ type: "array",
569
+ itemType: "text",
570
+ maxItems: 50,
571
+ label: "Sandbox Allowed Hosts",
572
+ description: "The exact host names the sandbox may reach under Allowlist, such as api.example.com: no wildcards, IP addresses, ports or paths.",
573
+ dependsOn: { field: "sandbox_network", values: ["allowlist"] }
574
+ }
575
+ };
549
576
  AUDIO_LANGUAGE_OPTIONS = [
550
577
  { value: "", label: "Auto-detect" },
551
578
  { value: "en", label: "en" },
@@ -728,7 +755,7 @@ var init_chunk_2TNXNKRP = __esm({
728
755
  verbosity: { type: "select", label: "Verbosity", options: ["low", "medium", "high"], default: "medium", description: "Output detail level. Only for reasoning models.", dependsOn: { field: "model", values: OPENAI_REASONING_MODELS } },
729
756
  service_tier: { type: "select", label: "Service Tier", options: ["auto", "flex", "default", "priority"], default: "auto", description: "Service tier (flex=50% cheaper, higher latency). Only for reasoning models.", dependsOn: { field: "model", values: OPENAI_REASONING_MODELS } },
730
757
  max_tokens: { type: "number", label: "Max Tokens", min: 1, default: 4096, description: "Maximum tokens to generate. On reasoning models, this cap includes reasoning tokens." },
731
- code_execution_enabled: { type: "toggle", label: "Code Execution Sandbox", default: false, description: "Allow this agent to use the OpenAI code_interpreter sandbox for the download_file/upload_file tools. Off keeps the agent read-only on resources even if the tools are attached." },
758
+ ...SANDBOX_AGENT_FIELDS,
732
759
  streaming_enabled: { type: "toggle", label: "Stream Responses", default: false, description: "Stream responses in real-time (app channel only)" },
733
760
  deliver_preamble: { type: "toggle", label: "Deliver Pre-Tool Messages", default: true, description: 'Send the short message the model writes before running tools ("Let me check that\u2026") as its own message, so the user hears something during the tool-execution wait. Off = only the final reply is delivered (pre-tool text is discarded). Not applied on email channels; on voice conversations each preamble is spoken as its own audio clip.' },
734
761
  file_handling_mode: { type: "select", label: "File handling", options: [{ value: "always_attach", label: "Attach files" }, { value: "metadata_only", label: "Metadata only (retrieve on demand)" }], default: "always_attach", description: "No longer changes what the model receives \u2014 a conversation's earlier files are always announced by path, never re-sent as content. metadata_only still auto-enables read_file so the agent can open one of those paths on demand." },
@@ -767,7 +794,7 @@ var init_chunk_2TNXNKRP = __esm({
767
794
  max_tokens: { type: "number", label: "Max Tokens", min: 1, max: 8192, default: 4096, description: "Maximum tokens to generate", required: true },
768
795
  thinking_enabled: { type: "toggle", label: "Extended Thinking", default: false, description: "Enable Claude extended thinking for deeper reasoning. Uses output tokens; temperature/top_p are ignored when on. Not shown for Claude Fable and Claude Opus 5.5, which always reason adaptively. On Claude Sonnet 5.5 and Claude Haiku 5.5, off applies at Reasoning Effort High or below; at Extra high or Max they keep thinking.", dependsOn: { field: "model", values: ["claude-sonnet-5-5", "claude-haiku-5-5", "claude-opus-4-8", "claude-opus-4-7", "claude-opus-4-6", "claude-sonnet-5", "claude-sonnet-4-6", "claude-sonnet-4-5", "claude-haiku-4-5", "claude-opus-4-5"] } },
769
796
  effort: { type: "select", label: "Reasoning Effort", options: [{ value: "low", label: "Low" }, { value: "medium", label: "Medium" }, { value: "high", label: "High" }, { value: "xhigh", label: "Extra high" }, { value: "max", label: "Max" }], default: "high", description: "How hard Claude reasons and how many tokens it spends overall (output_config.effort). Higher = better quality, more cost/latency. xhigh needs Opus 4.7+/Sonnet 5+/Haiku 5.5/Fable; max excludes Opus 4.5. Levels the chosen model does not support are clamped down to the highest it allows.", dependsOn: { field: "model", values: ["claude-fable-5-1", "claude-opus-5-5", "claude-sonnet-5-5", "claude-haiku-5-5", "claude-fable-5", "claude-opus-4-8", "claude-opus-4-7", "claude-opus-4-6", "claude-opus-4-5", "claude-sonnet-5", "claude-sonnet-4-6"] } },
770
- code_execution_enabled: { type: "toggle", label: "Code Execution Sandbox", default: false, description: "Allow this agent to use the Anthropic code_execution sandbox for the download_file/upload_file tools. Off keeps the agent read-only on resources even if the tools are attached." },
797
+ ...SANDBOX_AGENT_FIELDS,
771
798
  cache_ttl: { type: "select", label: "System Prompt Cache TTL", options: [{ value: "1h", label: "1 hour (recommended)" }, { value: "5m", label: "5 minutes" }, { value: "off", label: "Disabled" }], default: "1h", description: "Caches system prompt and tool definitions (shared across all conversations on this agent). 1h amortizes the 2\xD7 write premium across concurrent conversations." },
772
799
  cache_ttl_history: { type: "select", label: "Conversation History Cache TTL", options: [{ value: "5m", label: "5 minutes (recommended)" }, { value: "1h", label: "1 hour" }, { value: "off", label: "Disabled" }], default: "5m", description: "Caches per-conversation history. Primary readers are tool-loop iterations (seconds apart) \u2014 5m captures these at 1.25\xD7 write premium instead of 2\xD7. Use 1h only if conversations frequently re-engage between 5min\u20131h." },
773
800
  streaming_enabled: { type: "toggle", label: "Stream Responses", default: false, description: "Stream responses in real-time (app channel only)" },
@@ -811,6 +838,7 @@ var init_chunk_2TNXNKRP = __esm({
811
838
  deliver_preamble: { type: "toggle", label: "Deliver Pre-Tool Messages", default: true, description: 'Send the short message the model writes before running tools ("Let me check that\u2026") as its own message, so the user hears something during the tool-execution wait. Off = only the final reply is delivered (pre-tool text is discarded). Not applied on email channels; on voice conversations each preamble is spoken as its own audio clip.' },
812
839
  file_handling_mode: { type: "select", label: "File handling", options: [{ value: "always_attach", label: "Attach files" }, { value: "metadata_only", label: "Metadata only (retrieve on demand)" }], default: "always_attach", description: "No longer changes what the model receives \u2014 a conversation's earlier files are always announced by path, never re-sent as content. metadata_only still auto-enables read_file so the agent can open one of those paths on demand." },
813
840
  max_attachment_size_mb: { type: "number", label: "Max attachment size (MB)", min: 1, description: "No longer has any effect: earlier files are announced by path rather than attached, so there is no attachment size to cap." },
841
+ ...SANDBOX_AGENT_FIELDS,
814
842
  ...COPILOT_TRIGGER_FIELD
815
843
  },
816
844
  channel_settings_schema: null,
@@ -852,6 +880,7 @@ var init_chunk_2TNXNKRP = __esm({
852
880
  deliver_preamble: { type: "toggle", label: "Deliver Pre-Tool Messages", default: true, description: 'Send the short message the model writes before running tools ("Let me check that\u2026") as its own message, so the user hears something during the tool-execution wait. Off = only the final reply is delivered (pre-tool text is discarded). Not applied on email channels; on voice conversations each preamble is spoken as its own audio clip.' },
853
881
  file_handling_mode: { type: "select", label: "File handling", options: [{ value: "always_attach", label: "Attach files" }, { value: "metadata_only", label: "Metadata only (retrieve on demand)" }], default: "always_attach", description: "No longer changes what the model receives \u2014 a conversation's earlier files are always announced by path, never re-sent as content. metadata_only still auto-enables read_file so the agent can open one of those paths on demand." },
854
882
  max_attachment_size_mb: { type: "number", label: "Max attachment size (MB)", min: 1, description: "No longer has any effect: earlier files are announced by path rather than attached, so there is no attachment size to cap." },
883
+ ...SANDBOX_AGENT_FIELDS,
855
884
  ...COPILOT_TRIGGER_FIELD
856
885
  },
857
886
  channel_settings_schema: null,
@@ -890,6 +919,7 @@ var init_chunk_2TNXNKRP = __esm({
890
919
  deliver_preamble: { type: "toggle", label: "Deliver Pre-Tool Messages", default: true, description: 'Send the short message the model writes before running tools ("Let me check that\u2026") as its own message, so the user hears something during the tool-execution wait. Off = only the final reply is delivered (pre-tool text is discarded). Not applied on email channels; on voice conversations each preamble is spoken as its own audio clip.' },
891
920
  file_handling_mode: { type: "select", label: "File handling", options: [{ value: "always_attach", label: "Attach files" }, { value: "metadata_only", label: "Metadata only (retrieve on demand)" }], default: "always_attach", description: "No longer changes what the model receives \u2014 a conversation's earlier files are always announced by path, never re-sent as content. metadata_only still auto-enables read_file so the agent can open one of those paths on demand." },
892
921
  max_attachment_size_mb: { type: "number", label: "Max attachment size (MB)", min: 1, description: "No longer has any effect: earlier files are announced by path rather than attached, so there is no attachment size to cap." },
922
+ ...SANDBOX_AGENT_FIELDS,
893
923
  ...COPILOT_TRIGGER_FIELD
894
924
  },
895
925
  channel_settings_schema: null,
@@ -1297,9 +1327,9 @@ var init_chunk_2TNXNKRP = __esm({
1297
1327
  unique_per_hub: false,
1298
1328
  account_sid_placeholder: null,
1299
1329
  models: null,
1300
- is_internal: false,
1330
+ is_internal: true,
1301
1331
  is_harness: false,
1302
- connector_module: null,
1332
+ connector_module: "native/rekor_toolset",
1303
1333
  enabled: true,
1304
1334
  connector_settings_schema: {
1305
1335
  toolset: { type: "text", label: "Toolset", default: "", placeholder: "support", description: "The toolset this connection reaches: its slug, as in its MCP URL (\u2026/t/<slug>/mcp). The token must be bound to it.", required: true }
@@ -1447,16 +1477,78 @@ var init_chunk_2TNXNKRP = __esm({
1447
1477
  }
1448
1478
  });
1449
1479
 
1450
- // ../../packages/core/dist/chunk-SNA2DXAC.js
1480
+ // ../../packages/core/dist/chunk-DHPUPI4Y.js
1481
+ function normalizeAuthType(raw) {
1482
+ if (VALID_AUTH_TYPES.has(raw)) return raw;
1483
+ return LEGACY_AUTH_TYPE_MAP[raw] ?? raw;
1484
+ }
1485
+ var AUTH_TYPE, ORG_CREDENTIAL_AUTH_TYPES, AUTH_TYPE_DISPLAY, LEGACY_AUTH_TYPE_MAP, VALID_AUTH_TYPES, AGENT_ROLES, PILOT_TRACK_ROLES, COPILOT_TRACK_ROLES, CUSTOMER_FACING_AGENT_ROLES, SAFE_USER_ID_REGEX, SUPPORTED_LOCALES, SKILL_INSTALL_COMMAND;
1486
+ var init_chunk_DHPUPI4Y = __esm({
1487
+ "../../packages/core/dist/chunk-DHPUPI4Y.js"() {
1488
+ "use strict";
1489
+ AUTH_TYPE = {
1490
+ OAUTH: "oauth",
1491
+ API_KEY: "api_key",
1492
+ BASIC_AUTH: "basic_auth",
1493
+ BEARER: "bearer",
1494
+ NONE: "none"
1495
+ };
1496
+ ORG_CREDENTIAL_AUTH_TYPES = [
1497
+ AUTH_TYPE.API_KEY,
1498
+ AUTH_TYPE.BEARER,
1499
+ AUTH_TYPE.BASIC_AUTH
1500
+ ];
1501
+ AUTH_TYPE_DISPLAY = {
1502
+ [AUTH_TYPE.OAUTH]: "OAuth",
1503
+ [AUTH_TYPE.API_KEY]: "API Key",
1504
+ [AUTH_TYPE.BASIC_AUTH]: "Basic Auth",
1505
+ [AUTH_TYPE.BEARER]: "Bearer Token",
1506
+ [AUTH_TYPE.NONE]: "No Authentication"
1507
+ };
1508
+ LEGACY_AUTH_TYPE_MAP = {
1509
+ "OAuth": AUTH_TYPE.OAUTH,
1510
+ "API Key": AUTH_TYPE.API_KEY,
1511
+ "Basic Auth": AUTH_TYPE.BASIC_AUTH,
1512
+ "Bearer Token": AUTH_TYPE.BEARER,
1513
+ "No authentication": AUTH_TYPE.NONE,
1514
+ // Also handle the old DISPLAY_TO_CODE bug where 'basic' was used instead of 'basic_auth'
1515
+ "basic": AUTH_TYPE.BASIC_AUTH
1516
+ };
1517
+ VALID_AUTH_TYPES = new Set(Object.values(AUTH_TYPE));
1518
+ AGENT_ROLES = [
1519
+ "pilot",
1520
+ "copilot",
1521
+ "pilot_specialist",
1522
+ "copilot_specialist",
1523
+ "pilot_advisor",
1524
+ "copilot_advisor",
1525
+ "monitor",
1526
+ "conversation_evaluator",
1527
+ "message_evaluator",
1528
+ "summarizer",
1529
+ "consultant",
1530
+ "pilot_voice"
1531
+ ];
1532
+ PILOT_TRACK_ROLES = ["pilot", "pilot_specialist"];
1533
+ COPILOT_TRACK_ROLES = ["copilot", "copilot_specialist"];
1534
+ CUSTOMER_FACING_AGENT_ROLES = [...PILOT_TRACK_ROLES, "pilot_advisor"];
1535
+ SAFE_USER_ID_REGEX = /^[A-Za-z0-9_-]{1,64}$/;
1536
+ SUPPORTED_LOCALES = ["en", "pt", "es"];
1537
+ SKILL_INSTALL_COMMAND = "mkdir -p .claude && npx skills add wayai-pro/wayai-skill -y";
1538
+ }
1539
+ });
1540
+
1541
+ // ../../packages/core/dist/chunk-QT7NKKPO.js
1451
1542
  function catalogToolSideEffects(toolName) {
1452
1543
  const sideEffects = CATALOG_SIDE_EFFECTS.get(toolName);
1453
1544
  if (sideEffects === void 0) return "unknown";
1454
1545
  return sideEffects ? "side_effects" : "none";
1455
1546
  }
1456
- var NATIVE_TOOL_SCHEMAS, WAYAI_CONNECTOR, BASE_NATIVE_TOOLS, NATIVE_TOOLS, CATALOG_SIDE_EFFECTS;
1457
- var init_chunk_SNA2DXAC = __esm({
1458
- "../../packages/core/dist/chunk-SNA2DXAC.js"() {
1547
+ var NATIVE_TOOL_SCHEMAS, WAYAI_CONNECTOR, SANDBOX_AGENT_ROLES, BASE_NATIVE_TOOLS, NATIVE_TOOLS, CATALOG_SIDE_EFFECTS;
1548
+ var init_chunk_QT7NKKPO = __esm({
1549
+ "../../packages/core/dist/chunk-QT7NKKPO.js"() {
1459
1550
  "use strict";
1551
+ init_chunk_DHPUPI4Y();
1460
1552
  NATIVE_TOOL_SCHEMAS = {
1461
1553
  "close_conversation": {
1462
1554
  "tool_config": {
@@ -1750,6 +1842,86 @@ var init_chunk_SNA2DXAC = __esm({
1750
1842
  },
1751
1843
  "tool_instructions": "Use to commit either an edit (file_id + sandbox_file_id) or a new file (resource_id + filename + sandbox_file_id). Returns { saved, file_id, file_hash, bytes } on success \u2014 the file_id you can reference later. Errors clearly when write access is denied or when neither identifier set is provided."
1752
1844
  },
1845
+ // The code sandbox (wayai#5083 Phase 3). The figures in its description are the backend's
1846
+ // sandbox limits (`apps/backend/src/sandbox/limits.ts`), pinned there by a test, so the model is
1847
+ // told the limits the sandbox enforces.
1848
+ "bash": {
1849
+ "tool_config": {
1850
+ "name": "bash",
1851
+ "description": "Run a Bash command in this conversation's sandbox: a disposable Linux container (Debian, with Python 3, curl, jq, zip and other common tools) whose working directory is /workspace. The sandbox starts on the first command and keeps its files between commands in this conversation, but it ends after 10 minutes without use or 60 minutes in all; the next command then starts an empty one, and its result says so. What the sandbox can reach over the network is set for this agent by a hub admin; with no network, nothing leaves it. A command runs for at most timeout_seconds and never past the turn's own time limit. Long output keeps only its first and last parts. The result gives the exit code, stdout and stderr.",
1852
+ "strict": false,
1853
+ "parameters": {
1854
+ "type": "object",
1855
+ "properties": {
1856
+ "command": {
1857
+ "type": "string",
1858
+ "description": "The Bash script to run, as with `bash -c`. It runs in /workspace unless it changes directory."
1859
+ },
1860
+ "timeout_seconds": {
1861
+ "type": "integer",
1862
+ "description": "How long the command may run before it is killed, in seconds: 120 by default, at most 540.",
1863
+ "minimum": 1,
1864
+ "maximum": 540
1865
+ }
1866
+ },
1867
+ "required": [
1868
+ "command"
1869
+ ],
1870
+ "additionalProperties": false
1871
+ }
1872
+ },
1873
+ "tool_instructions": null
1874
+ },
1875
+ "copy_to_sandbox": {
1876
+ "tool_config": {
1877
+ "name": "copy_to_sandbox",
1878
+ "description": `Copy one of this conversation's files into the code sandbox, so commands run with bash can read or edit it there. path names the file as read_file does: this conversation's attachments under "conversation/" (e.g. "conversation/report.xlsx"), or an earlier conversation's under "conversations/<conversation_id>/<name>". Hub resource files cannot be copied. The copy lands at sandbox_path, replacing any file there; a file larger than 25 MiB is refused. If no sandbox is running, the copy starts an empty one.`,
1879
+ "strict": false,
1880
+ "parameters": {
1881
+ "type": "object",
1882
+ "properties": {
1883
+ "path": {
1884
+ "type": "string",
1885
+ "description": `The file to copy, as read_file names it: "conversation/<name>" (a shorter unambiguous form or the file's id also works) or "conversations/<conversation_id>/<name>".`
1886
+ },
1887
+ "sandbox_path": {
1888
+ "type": "string",
1889
+ "description": "Where the copy lands in the sandbox, under /workspace (a relative path is taken from /workspace). Defaults to the file's name in /workspace."
1890
+ }
1891
+ },
1892
+ "required": [
1893
+ "path"
1894
+ ],
1895
+ "additionalProperties": false
1896
+ }
1897
+ },
1898
+ "tool_instructions": null
1899
+ },
1900
+ "copy_from_sandbox": {
1901
+ "tool_config": {
1902
+ "name": "copy_from_sandbox",
1903
+ "description": 'Copy a file out of the code sandbox into this conversation, so what your commands produced (a chart, a converted document) is kept after the sandbox ends. The file is stored for the support team on an internal note and is NOT sent to the customer: the result gives its path under "conversation/", and send_files with that path delivers it when it should reach them. A file larger than 25 MiB is refused.',
1904
+ "strict": false,
1905
+ "parameters": {
1906
+ "type": "object",
1907
+ "properties": {
1908
+ "sandbox_path": {
1909
+ "type": "string",
1910
+ "description": "The file to copy, under /workspace (a relative path is taken from /workspace)."
1911
+ },
1912
+ "name": {
1913
+ "type": "string",
1914
+ "description": `The stored file's name, with no folders (e.g. "q3-report.xlsx"). Defaults to the file's name in the sandbox.`
1915
+ }
1916
+ },
1917
+ "required": [
1918
+ "sandbox_path"
1919
+ ],
1920
+ "additionalProperties": false
1921
+ }
1922
+ },
1923
+ "tool_instructions": null
1924
+ },
1753
1925
  "send_files": {
1754
1926
  "tool_config": {
1755
1927
  "name": "send_files",
@@ -2232,6 +2404,7 @@ var init_chunk_SNA2DXAC = __esm({
2232
2404
  }
2233
2405
  };
2234
2406
  WAYAI_CONNECTOR = "b17d9f3a-4e1b-46c9-b648-a2f0c3611aa4";
2407
+ SANDBOX_AGENT_ROLES = [...PILOT_TRACK_ROLES, ...COPILOT_TRACK_ROLES];
2235
2408
  BASE_NATIVE_TOOLS = [
2236
2409
  // --- Wayai core tools ---
2237
2410
  { tool_native_id: "nt-001", tool_name: "transfer_to_agent", tool_display_name: "Transfer to Agent", tool_description: "Transfer the conversation to another AI agent", connector_id: WAYAI_CONNECTOR, operation: "transfer_to_agent", tool_method: "internal", tool_group: "Native Tools", is_delegation: true, is_auto_set: false, execution_config: null, side_effects: false },
@@ -2323,7 +2496,17 @@ var init_chunk_SNA2DXAC = __esm({
2323
2496
  // would need remapping on both branching mechanisms and normalizing on both CI
2324
2497
  // directions. `action.tool_name`, one key away in the same object, is the
2325
2498
  // precedent.
2326
- { tool_native_id: "nt-029", tool_name: "run_monitor", tool_display_name: "Run Monitor", tool_description: "Run another monitor on this hub and let it act on its own rules", connector_id: WAYAI_CONNECTOR, operation: "run_monitor", tool_method: "internal", tool_group: "Native Tools", is_delegation: false, is_auto_set: false, execution_config: null, side_effects: true, assignable_roles: ["monitor"], model_callable: false }
2499
+ { tool_native_id: "nt-029", tool_name: "run_monitor", tool_display_name: "Run Monitor", tool_description: "Run another monitor on this hub and let it act on its own rules", connector_id: WAYAI_CONNECTOR, operation: "run_monitor", tool_method: "internal", tool_group: "Native Tools", is_delegation: false, is_auto_set: false, execution_config: null, side_effects: true, assignable_roles: ["monitor"], model_callable: false },
2500
+ // The code sandbox (wayai#5083 Phase 3): runs only for an agent whose `code_execution_enabled`
2501
+ // setting is on, on any provider. Side effects: under an Allowlist or Web network setting, the
2502
+ // code it runs can send data out of the conversation.
2503
+ { tool_native_id: "nt-030", tool_name: "bash", tool_display_name: "Run Code (Bash)", tool_description: "Run a Bash command in the conversation's code sandbox", connector_id: WAYAI_CONNECTOR, operation: "bash", tool_method: "internal", tool_group: "Native Tools", is_delegation: false, is_auto_set: false, execution_config: null, side_effects: true, assignable_roles: SANDBOX_AGENT_ROLES },
2504
+ // Copies a conversation file INTO the sandbox: the sandbox is conversation state, so nothing
2505
+ // leaves the conversation.
2506
+ { tool_native_id: "nt-031", tool_name: "copy_to_sandbox", tool_display_name: "Copy File to Sandbox", tool_description: "Copy one of the conversation's files into its code sandbox", connector_id: WAYAI_CONNECTOR, operation: "copy_to_sandbox", tool_method: "internal", tool_group: "Native Tools", is_delegation: false, is_auto_set: false, execution_config: null, side_effects: false, assignable_roles: SANDBOX_AGENT_ROLES },
2507
+ // Copies a sandbox file OUT into the conversation, as an internal note for the team: nothing
2508
+ // reaches the customer until `send_files` sends it.
2509
+ { tool_native_id: "nt-032", tool_name: "copy_from_sandbox", tool_display_name: "Copy File from Sandbox", tool_description: "Copy a file out of the code sandbox into the conversation, for the team", connector_id: WAYAI_CONNECTOR, operation: "copy_from_sandbox", tool_method: "internal", tool_group: "Native Tools", is_delegation: false, is_auto_set: false, execution_config: null, side_effects: false, assignable_roles: SANDBOX_AGENT_ROLES }
2327
2510
  ];
2328
2511
  NATIVE_TOOLS = BASE_NATIVE_TOOLS.map((base) => {
2329
2512
  const schema = NATIVE_TOOL_SCHEMAS[base.tool_name];
@@ -2812,8 +2995,8 @@ var init_parseUtil = __esm({
2812
2995
  init_errors();
2813
2996
  init_en();
2814
2997
  makeIssue = (params) => {
2815
- const { data, path: path41, errorMaps, issueData } = params;
2816
- const fullPath = [...path41, ...issueData.path || []];
2998
+ const { data, path: path42, errorMaps, issueData } = params;
2999
+ const fullPath = [...path42, ...issueData.path || []];
2817
3000
  const fullIssue = {
2818
3001
  ...issueData,
2819
3002
  path: fullPath
@@ -3124,11 +3307,11 @@ var init_types = __esm({
3124
3307
  init_parseUtil();
3125
3308
  init_util();
3126
3309
  ParseInputLazyPath = class {
3127
- constructor(parent, value, path41, key) {
3310
+ constructor(parent, value, path42, key) {
3128
3311
  this._cachedPath = [];
3129
3312
  this.parent = parent;
3130
3313
  this.data = value;
3131
- this._path = path41;
3314
+ this._path = path42;
3132
3315
  this._key = key;
3133
3316
  }
3134
3317
  get path() {
@@ -6552,66 +6735,6 @@ var init_chunk_3NS3HULK = __esm({
6552
6735
  }
6553
6736
  });
6554
6737
 
6555
- // ../../packages/core/dist/chunk-DHPUPI4Y.js
6556
- function normalizeAuthType(raw) {
6557
- if (VALID_AUTH_TYPES.has(raw)) return raw;
6558
- return LEGACY_AUTH_TYPE_MAP[raw] ?? raw;
6559
- }
6560
- var AUTH_TYPE, ORG_CREDENTIAL_AUTH_TYPES, AUTH_TYPE_DISPLAY, LEGACY_AUTH_TYPE_MAP, VALID_AUTH_TYPES, AGENT_ROLES, PILOT_TRACK_ROLES, CUSTOMER_FACING_AGENT_ROLES, SAFE_USER_ID_REGEX, SUPPORTED_LOCALES, SKILL_INSTALL_COMMAND;
6561
- var init_chunk_DHPUPI4Y = __esm({
6562
- "../../packages/core/dist/chunk-DHPUPI4Y.js"() {
6563
- "use strict";
6564
- AUTH_TYPE = {
6565
- OAUTH: "oauth",
6566
- API_KEY: "api_key",
6567
- BASIC_AUTH: "basic_auth",
6568
- BEARER: "bearer",
6569
- NONE: "none"
6570
- };
6571
- ORG_CREDENTIAL_AUTH_TYPES = [
6572
- AUTH_TYPE.API_KEY,
6573
- AUTH_TYPE.BEARER,
6574
- AUTH_TYPE.BASIC_AUTH
6575
- ];
6576
- AUTH_TYPE_DISPLAY = {
6577
- [AUTH_TYPE.OAUTH]: "OAuth",
6578
- [AUTH_TYPE.API_KEY]: "API Key",
6579
- [AUTH_TYPE.BASIC_AUTH]: "Basic Auth",
6580
- [AUTH_TYPE.BEARER]: "Bearer Token",
6581
- [AUTH_TYPE.NONE]: "No Authentication"
6582
- };
6583
- LEGACY_AUTH_TYPE_MAP = {
6584
- "OAuth": AUTH_TYPE.OAUTH,
6585
- "API Key": AUTH_TYPE.API_KEY,
6586
- "Basic Auth": AUTH_TYPE.BASIC_AUTH,
6587
- "Bearer Token": AUTH_TYPE.BEARER,
6588
- "No authentication": AUTH_TYPE.NONE,
6589
- // Also handle the old DISPLAY_TO_CODE bug where 'basic' was used instead of 'basic_auth'
6590
- "basic": AUTH_TYPE.BASIC_AUTH
6591
- };
6592
- VALID_AUTH_TYPES = new Set(Object.values(AUTH_TYPE));
6593
- AGENT_ROLES = [
6594
- "pilot",
6595
- "copilot",
6596
- "pilot_specialist",
6597
- "copilot_specialist",
6598
- "pilot_advisor",
6599
- "copilot_advisor",
6600
- "monitor",
6601
- "conversation_evaluator",
6602
- "message_evaluator",
6603
- "summarizer",
6604
- "consultant",
6605
- "pilot_voice"
6606
- ];
6607
- PILOT_TRACK_ROLES = ["pilot", "pilot_specialist"];
6608
- CUSTOMER_FACING_AGENT_ROLES = [...PILOT_TRACK_ROLES, "pilot_advisor"];
6609
- SAFE_USER_ID_REGEX = /^[A-Za-z0-9_-]{1,64}$/;
6610
- SUPPORTED_LOCALES = ["en", "pt", "es"];
6611
- SKILL_INSTALL_COMMAND = "mkdir -p .claude && npx skills add wayai-pro/wayai-skill -y";
6612
- }
6613
- });
6614
-
6615
6738
  // ../../packages/core/dist/chunk-L5F7ZOUJ.js
6616
6739
  function schemaToQuestions(schema) {
6617
6740
  const classified = classifySchema(schema);
@@ -6790,7 +6913,7 @@ var init_chunk_T7KQKDET = __esm({
6790
6913
  }
6791
6914
  });
6792
6915
 
6793
- // ../../packages/core/dist/chunk-6O3TITL5.js
6916
+ // ../../packages/core/dist/chunk-2745FTNX.js
6794
6917
  function containsKanbanPlaceholders(value) {
6795
6918
  if (value == null) return false;
6796
6919
  const serialized = typeof value === "string" ? value : JSON.stringify(value);
@@ -6822,12 +6945,12 @@ function typeMatches(typeField, allowed) {
6822
6945
  if (Array.isArray(typeField)) return typeField.every((t) => typeof t === "string" && allowed.has(t));
6823
6946
  return false;
6824
6947
  }
6825
- function validateSchema(schema, path41, errors, opts = {}) {
6948
+ function validateSchema(schema, path42, errors, opts = {}) {
6826
6949
  if (typeof schema === "boolean") return;
6827
6950
  const depth = opts.depth ?? 0;
6828
6951
  if (depth > MAX_SCHEMA_DEPTH) {
6829
6952
  errors.push({
6830
- path: path41 || "<root>",
6953
+ path: path42 || "<root>",
6831
6954
  message: `schema nesting exceeds ${MAX_SCHEMA_DEPTH} levels`,
6832
6955
  suggestion: "Flatten the schema; LLM providers reject deeply nested tool input_schemas."
6833
6956
  });
@@ -6835,7 +6958,7 @@ function validateSchema(schema, path41, errors, opts = {}) {
6835
6958
  }
6836
6959
  if (!isRecord2(schema)) {
6837
6960
  errors.push({
6838
- path: path41,
6961
+ path: path42,
6839
6962
  message: `expected object, got ${schema === null ? "null" : typeof schema}`
6840
6963
  });
6841
6964
  return;
@@ -6843,14 +6966,14 @@ function validateSchema(schema, path41, errors, opts = {}) {
6843
6966
  if (opts.isRoot) {
6844
6967
  if ("type" in schema && schema.type !== "object") {
6845
6968
  errors.push({
6846
- path: path41 ? `${path41}.type` : "type",
6969
+ path: path42 ? `${path42}.type` : "type",
6847
6970
  message: `root type must be 'object', got ${JSON.stringify(schema.type)}`,
6848
6971
  suggestion: "Tool parameters at the root must be an object: `{ type: 'object', properties: { ... } }`."
6849
6972
  });
6850
6973
  }
6851
6974
  } else if ("type" in schema && !typeMatches(schema.type, ALLOWED_TYPES)) {
6852
6975
  errors.push({
6853
- path: `${path41}.type`,
6976
+ path: `${path42}.type`,
6854
6977
  message: `type must be one of ${[...ALLOWED_TYPES].join("/")} or an array of those, got ${JSON.stringify(schema.type)}`
6855
6978
  });
6856
6979
  }
@@ -6860,25 +6983,25 @@ function validateSchema(schema, path41, errors, opts = {}) {
6860
6983
  const isPlaceholder = PLACEHOLDER_TOKENS.includes(e);
6861
6984
  const isOutcomePlaceholder = e === "[KANBAN_OUTCOME_VALUES]";
6862
6985
  errors.push({
6863
- path: `${path41}.enum`,
6986
+ path: `${path42}.enum`,
6864
6987
  message: `enum must be a non-empty array of primitives, got string ${JSON.stringify(e)}`,
6865
6988
  suggestion: isOutcomePlaceholder ? "Declare `outcomes` on the hub's terminal kanban status so the platform can render the placeholder into a valid array; with none configured the platform drops the parameter instead." : isPlaceholder ? "Set `operation: 'update_kanban_status'` on the tool and ensure at least one hub.kanban_status has `allowsAgentUpdate: true` so the platform can render the placeholder into a valid array." : 'Wrap the value in an array: `enum: ["value"]`.'
6866
6989
  });
6867
6990
  } else if (!Array.isArray(e)) {
6868
6991
  errors.push({
6869
- path: `${path41}.enum`,
6992
+ path: `${path42}.enum`,
6870
6993
  message: `enum must be a non-empty array of primitives, got ${typeof e}`
6871
6994
  });
6872
6995
  } else if (e.length === 0) {
6873
6996
  errors.push({
6874
- path: `${path41}.enum`,
6997
+ path: `${path42}.enum`,
6875
6998
  message: "enum must not be empty"
6876
6999
  });
6877
7000
  } else {
6878
7001
  for (let i = 0; i < e.length; i++) {
6879
7002
  if (!isPrimitive(e[i])) {
6880
7003
  errors.push({
6881
- path: `${path41}.enum[${i}]`,
7004
+ path: `${path42}.enum[${i}]`,
6882
7005
  message: `enum entry must be a primitive (string/number/boolean/null), got ${typeof e[i]}`
6883
7006
  });
6884
7007
  }
@@ -6888,7 +7011,7 @@ function validateSchema(schema, path41, errors, opts = {}) {
6888
7011
  for (const key of ["exclusiveMinimum", "exclusiveMaximum"]) {
6889
7012
  if (key in schema && typeof schema[key] === "boolean") {
6890
7013
  errors.push({
6891
- path: `${path41}.${key}`,
7014
+ path: `${path42}.${key}`,
6892
7015
  message: `${key} as boolean is draft-04 syntax; draft 2020-12 requires a numeric value`,
6893
7016
  suggestion: `Replace with the numeric bound, e.g. \`${key}: 0\`.`
6894
7017
  });
@@ -6897,45 +7020,45 @@ function validateSchema(schema, path41, errors, opts = {}) {
6897
7020
  if ("properties" in schema) {
6898
7021
  if (!isRecord2(schema.properties)) {
6899
7022
  errors.push({
6900
- path: `${path41}.properties`,
7023
+ path: `${path42}.properties`,
6901
7024
  message: `properties must be an object, got ${Array.isArray(schema.properties) ? "array" : typeof schema.properties}`
6902
7025
  });
6903
7026
  } else {
6904
7027
  for (const [propName, propSchema] of Object.entries(schema.properties)) {
6905
- validateSchema(propSchema, `${path41}.properties.${propName}`, errors, { depth: depth + 1 });
7028
+ validateSchema(propSchema, `${path42}.properties.${propName}`, errors, { depth: depth + 1 });
6906
7029
  }
6907
7030
  }
6908
7031
  }
6909
7032
  if (schemaTypeIncludes(schema, "array") && "items" in schema) {
6910
7033
  if (Array.isArray(schema.items)) {
6911
- schema.items.forEach((sub, i) => validateSchema(sub, `${path41}.items[${i}]`, errors, { depth: depth + 1 }));
7034
+ schema.items.forEach((sub, i) => validateSchema(sub, `${path42}.items[${i}]`, errors, { depth: depth + 1 }));
6912
7035
  } else {
6913
- validateSchema(schema.items, `${path41}.items`, errors, { depth: depth + 1 });
7036
+ validateSchema(schema.items, `${path42}.items`, errors, { depth: depth + 1 });
6914
7037
  }
6915
7038
  }
6916
7039
  for (const key of SUBSCHEMA_OBJECT_KEYWORDS) {
6917
7040
  if (key in schema && isRecord2(schema[key])) {
6918
- validateSchema(schema[key], `${path41}.${key}`, errors, { depth: depth + 1 });
7041
+ validateSchema(schema[key], `${path42}.${key}`, errors, { depth: depth + 1 });
6919
7042
  }
6920
7043
  }
6921
7044
  for (const key of SUBSCHEMA_LIST_KEYWORDS) {
6922
7045
  const list = schema[key];
6923
7046
  if (Array.isArray(list)) {
6924
- list.forEach((sub, i) => validateSchema(sub, `${path41}.${key}[${i}]`, errors, { depth: depth + 1 }));
7047
+ list.forEach((sub, i) => validateSchema(sub, `${path42}.${key}[${i}]`, errors, { depth: depth + 1 }));
6925
7048
  }
6926
7049
  }
6927
7050
  for (const key of SUBSCHEMA_MAP_KEYWORDS) {
6928
7051
  const map = schema[key];
6929
7052
  if (isRecord2(map)) {
6930
7053
  for (const [name, sub] of Object.entries(map)) {
6931
- validateSchema(sub, `${path41}.${key}.${name}`, errors, { depth: depth + 1 });
7054
+ validateSchema(sub, `${path42}.${key}.${name}`, errors, { depth: depth + 1 });
6932
7055
  }
6933
7056
  }
6934
7057
  }
6935
7058
  const reportedPaths = new Set(errors.map((e) => e.path));
6936
7059
  for (const [k, v] of Object.entries(schema)) {
6937
7060
  if (typeof v !== "string") continue;
6938
- const fieldPath = `${path41}.${k}`;
7061
+ const fieldPath = `${path42}.${k}`;
6939
7062
  if (reportedPaths.has(fieldPath)) continue;
6940
7063
  for (const token of PLACEHOLDER_TOKENS) {
6941
7064
  if (v === token) {
@@ -6991,12 +7114,12 @@ function validateFollowupLinks(followups, label, ctx) {
6991
7114
  const linkTargets = /* @__PURE__ */ new Set();
6992
7115
  followups.forEach((followup, i) => {
6993
7116
  const ref = followup?.after_followup_id;
6994
- const path41 = ["followups", i, "after_followup_id"];
7117
+ const path42 = ["followups", i, "after_followup_id"];
6995
7118
  if (followup?.type !== "inactivity_after_before_event") {
6996
7119
  if (ref !== void 0) {
6997
7120
  ctx.addIssue({
6998
7121
  code: external_exports.ZodIssueCode.custom,
6999
- path: path41,
7122
+ path: path42,
7000
7123
  message: `kanban status ${label}: after_followup_id is only valid on inactivity_after_before_event followups (this one is ${followup?.type})`
7001
7124
  });
7002
7125
  }
@@ -7005,7 +7128,7 @@ function validateFollowupLinks(followups, label, ctx) {
7005
7128
  if (ref === void 0) {
7006
7129
  ctx.addIssue({
7007
7130
  code: external_exports.ZodIssueCode.custom,
7008
- path: path41,
7131
+ path: path42,
7009
7132
  message: `kanban status ${label}: inactivity_after_before_event requires after_followup_id naming the id of a before_event followup in the same status`
7010
7133
  });
7011
7134
  return;
@@ -7015,7 +7138,7 @@ function validateFollowupLinks(followups, label, ctx) {
7015
7138
  if (matches.length > 1) {
7016
7139
  ctx.addIssue({
7017
7140
  code: external_exports.ZodIssueCode.custom,
7018
- path: path41,
7141
+ path: path42,
7019
7142
  message: `kanban status ${label}: after_followup_id "${ref}" matches ${matches.length} followups \u2014 a link must name exactly one`
7020
7143
  });
7021
7144
  return;
@@ -7027,7 +7150,7 @@ function validateFollowupLinks(followups, label, ctx) {
7027
7150
  );
7028
7151
  ctx.addIssue({
7029
7152
  code: external_exports.ZodIssueCode.custom,
7030
- path: path41,
7153
+ path: path42,
7031
7154
  message: hasIdlessBeforeEvent ? `kanban status ${label}: after_followup_id "${ref}" matches no followup \u2014 a link target must declare an explicit id, and this status has before_event followups without one` : `kanban status ${label}: after_followup_id "${ref}" matches no followup in this status`
7032
7155
  });
7033
7156
  return;
@@ -7035,7 +7158,7 @@ function validateFollowupLinks(followups, label, ctx) {
7035
7158
  if (target.type !== "before_event") {
7036
7159
  ctx.addIssue({
7037
7160
  code: external_exports.ZodIssueCode.custom,
7038
- path: path41,
7161
+ path: path42,
7039
7162
  message: `kanban status ${label}: after_followup_id "${ref}" points at a ${target.type} followup \u2014 only before_event followups can anchor a chain`
7040
7163
  });
7041
7164
  }
@@ -7305,9 +7428,9 @@ function monitorRuleActions(monitorConfig) {
7305
7428
  if (!monitorConfig || typeof monitorConfig !== "object") return [];
7306
7429
  const config = monitorConfig;
7307
7430
  const found = [];
7308
- const visit = (action, path41) => {
7431
+ const visit = (action, path42) => {
7309
7432
  if (!action || typeof action !== "object" || Array.isArray(action)) return;
7310
- found.push({ action, path: path41 });
7433
+ found.push({ action, path: path42 });
7311
7434
  };
7312
7435
  if (Array.isArray(config.rules)) {
7313
7436
  config.rules.forEach((rule, index) => {
@@ -7339,25 +7462,25 @@ function collectMonitorRuleIssues(monitorConfig) {
7339
7462
  const trigger = resolveMonitorTrigger(monitorConfig);
7340
7463
  const kinds = monitorRuleActionKinds(trigger);
7341
7464
  const issues = [...callUtteranceRuleIssues(monitorConfig), ...automationGateIssues(monitorConfig)];
7342
- for (const { action, path: path41 } of monitorRuleActions(monitorConfig)) {
7343
- if (trigger === "call_utterance" && path41[0] === "fallback") continue;
7465
+ for (const { action, path: path42 } of monitorRuleActions(monitorConfig)) {
7466
+ if (trigger === "call_utterance" && path42[0] === "fallback") continue;
7344
7467
  const kind = action.kind;
7345
7468
  if (typeof kind === "string" && !kinds.includes(kind)) {
7346
- issues.push({ path: [...path41, "kind"], message: monitorActionKindMessage(kind, trigger) });
7469
+ issues.push({ path: [...path42, "kind"], message: monitorActionKindMessage(kind, trigger) });
7347
7470
  }
7348
7471
  const toolName = action.tool_name;
7349
7472
  if (kind === "call_tool" && typeof toolName === "string" && isRefusedNativeToolName(toolName, trigger)) {
7350
- issues.push({ path: [...path41, "tool_name"], message: monitorRuleToolNotAllowedMessage(toolName, trigger) });
7473
+ issues.push({ path: [...path42, "tool_name"], message: monitorRuleToolNotAllowedMessage(toolName, trigger) });
7351
7474
  continue;
7352
7475
  }
7353
7476
  if (kind === "call_tool" && toolName === INSERT_NOTE_TOOL_NAME) {
7354
- issues.push(...insertNoteArgumentIssues(action, path41));
7477
+ issues.push(...insertNoteArgumentIssues(action, path42));
7355
7478
  }
7356
7479
  if (kind === "call_tool" && toolName === RUN_MONITOR_TOOL_NAME) {
7357
7480
  const callee = readRunMonitorCallee(action);
7358
7481
  if (!callee.ok) {
7359
7482
  issues.push({
7360
- path: [...path41, "args", "monitor_name"],
7483
+ path: [...path42, "args", "monitor_name"],
7361
7484
  message: runMonitorCalleeMessage(callee.reason)
7362
7485
  });
7363
7486
  }
@@ -7417,11 +7540,11 @@ function insertNoteTemplateMessage(reason) {
7417
7540
  return `insert_note's template is longer than the ${MONITOR_NOTE_TEMPLATE_MAX}-character limit.`;
7418
7541
  }
7419
7542
  }
7420
- function insertNoteArgumentIssues(action, path41) {
7543
+ function insertNoteArgumentIssues(action, path42) {
7421
7544
  const result = readInsertNoteTemplate(action);
7422
7545
  if (result.ok) return [];
7423
7546
  return [{
7424
- path: [...path41, "args", "template"],
7547
+ path: [...path42, "args", "template"],
7425
7548
  message: insertNoteTemplateMessage(result.reason)
7426
7549
  }];
7427
7550
  }
@@ -7518,8 +7641,8 @@ function evalInitialStateError(input) {
7518
7641
  const parsed = evalInitialStateEntry.safeParse(entries[i]);
7519
7642
  if (!parsed.success) {
7520
7643
  const issue = parsed.error.issues[0];
7521
- const path41 = issue?.path.join(".") || "?";
7522
- return `initial_state[${i}].${path41} is invalid: ${issue?.message ?? "malformed"}`;
7644
+ const path42 = issue?.path.join(".") || "?";
7645
+ return `initial_state[${i}].${path42} is invalid: ${issue?.message ?? "malformed"}`;
7523
7646
  }
7524
7647
  if (seenSlugs.has(parsed.data.slug)) {
7525
7648
  return `initial_state[${i}].slug "${parsed.data.slug}" is declared more than once`;
@@ -7743,10 +7866,10 @@ function refineHubAsCodeEvals(config, ctx) {
7743
7866
  function refineHubAsCodeEvalAttachments(config, ctx) {
7744
7867
  const cfg = config;
7745
7868
  const referencedHashes = /* @__PURE__ */ new Set();
7746
- const addTurnIssue = (path41, turn, name) => {
7869
+ const addTurnIssue = (path42, turn, name) => {
7747
7870
  const error = evalTurnAttachmentsError(turn);
7748
7871
  if (error) {
7749
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path41, message: `${name}: ${error}` });
7872
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path42, message: `${name}: ${error}` });
7750
7873
  return;
7751
7874
  }
7752
7875
  for (const hash of collectTurnAttachmentHashes(turn)) referencedHashes.add(hash);
@@ -7821,17 +7944,17 @@ function refineHubAsCodeCallOpenings(config, ctx) {
7821
7944
  const agent = entry;
7822
7945
  const openings = agent?.call_openings;
7823
7946
  if (openings === void 0 || openings === null) return;
7824
- const path41 = ["agents", a, "call_openings"];
7947
+ const path42 = ["agents", a, "call_openings"];
7825
7948
  const name = `agent "${typeof agent?.name === "string" ? agent.name : "<unnamed>"}"`;
7826
7949
  if (typeof openings !== "object" || Array.isArray(openings)) {
7827
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path41, message: `${name}: call_openings must map a language to an opening` });
7950
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path42, message: `${name}: call_openings must map a language to an opening` });
7828
7951
  return;
7829
7952
  }
7830
7953
  if (agent?.role !== "pilot_voice" && Object.keys(openings).length > 0) {
7831
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path41, message: `${name}: only a pilot_voice agent has call_openings` });
7954
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path42, message: `${name}: only a pilot_voice agent has call_openings` });
7832
7955
  }
7833
7956
  for (const [language, raw] of Object.entries(openings)) {
7834
- const at = [...path41, language];
7957
+ const at = [...path42, language];
7835
7958
  if (!callOpeningLanguage.safeParse(language).success) {
7836
7959
  ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: at, message: `${name}: call_openings language must be one of ${CALL_OPENING_LANGUAGES.join(", ")}` });
7837
7960
  continue;
@@ -7958,11 +8081,11 @@ function refineHubAsCodeDelegation(config, ctx) {
7958
8081
  }
7959
8082
  }
7960
8083
  if (del.context_boundary === void 0) return;
7961
- const path41 = ["agents", agentIndex, "tools", "delegation", delIndex, "context_boundary"];
8084
+ const path42 = ["agents", agentIndex, "tools", "delegation", delIndex, "context_boundary"];
7962
8085
  if (del.type !== "hub") {
7963
8086
  ctx.addIssue({
7964
8087
  code: external_exports.ZodIssueCode.custom,
7965
- path: path41,
8088
+ path: path42,
7966
8089
  message: `context_boundary applies only to \`type: hub\` delegations (got type "${String(del.type)}")`
7967
8090
  });
7968
8091
  return;
@@ -7970,7 +8093,7 @@ function refineHubAsCodeDelegation(config, ctx) {
7970
8093
  if (!CONTEXT_BOUNDARIES.includes(del.context_boundary)) {
7971
8094
  ctx.addIssue({
7972
8095
  code: external_exports.ZodIssueCode.custom,
7973
- path: path41,
8096
+ path: path42,
7974
8097
  message: `context_boundary must be one of: ${CONTEXT_BOUNDARIES.join(", ")}`
7975
8098
  });
7976
8099
  }
@@ -8114,10 +8237,10 @@ function refineHubAsCodeMonitorRulesOutput(config, ctx) {
8114
8237
  });
8115
8238
  }
8116
8239
  var PLACEHOLDER_TOKENS, ALLOWED_TYPES, SUBSCHEMA_OBJECT_KEYWORDS, SUBSCHEMA_LIST_KEYWORDS, SUBSCHEMA_MAP_KEYWORDS, MAX_SCHEMA_DEPTH, uuidSchema, USER_ID_REGEX, timestampSchema, idParamSchema, clientOptionalString, clientOptionalBoolean, clientOptionalNumber, messageAttachment, MAX_MESSAGE_BODY_BYTES, MAX_ATTACHMENTS_PER_MESSAGE, MESSAGE_ENVELOPE_HEADROOM_BYTES, MAX_AUDIO_FILE_BASE64_BYTES, MAX_KANBAN_STATUSES, MAX_FOLLOWUPS_PER_STATUS, MAX_LANES, MAX_ADDITIONAL_CONTEXT_SCHEMA_BYTES, RESERVED_TEMPLATE_DUMP_NAME, kanbanStatusSlugSchema, followupTypeSchema, EVENT_RELATIVE_FOLLOWUP_TYPES, followupTimeUnitSchema, followupIdSchema, SELECTABLE_FOLLOWUP_TYPES, MAX_LINKED_FOLLOWUP_TARGETS_PER_STATUS, followupSchema, MAX_OUTCOMES_PER_STATUS, kanbanOutcomeSchema, EXCLUSIVE_FLAG_PAIRS, kanbanStatusSchema, kanbanStatusesArraySchema, laneSchema, lanesArraySchema, toolIdParam, listToolsQuery, toolAgentQuery, deleteToolQuery, toolConnectionsQuery, nativeToolIdSchema, CONTEXT_BOUNDARIES, contextBoundarySchema, addNativeToolBody, addMcpToolBody, createCustomToolBody, updateCustomToolBody, updateToolExecutionConfigBody, primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody, HUB_DISPLAY_NAME_MAX_CHARS, HUB_WELCOME_MESSAGE_MAX_CHARS, HUB_STARTER_QUESTIONS_MAX, HUB_STARTER_QUESTION_MAX_CHARS, displayName, welcomeMessage, starterQuestions, hubDisplayNamesSchema, hubWelcomeMessagesSchema, hubStarterQuestionsSchema, hubDisplayNamesField, hubWelcomeMessagesField, hubStarterQuestionsField, HUB_PRESENTATION_FIELDS, HUB_PRESENTATION_SCHEMAS, hubIdParam, hubAdminIdParam, hubUserIdParam, hubIdentityIdParam, hubTeamIdParam, hubTeamUserDeleteParam, hubSchemaQuery, HUB_USERS_PAGE_SIZE_MAX, HUB_USERS_SEARCH_MAX, HUB_USERS_CHANNEL_TYPES, getHubUsersQuery, PREVIEW_LABEL_MAX_LENGTH, MAX_ENDED_INDEX_RETENTION_DAYS, MAX_EVAL_RETENTION_DAYS, MAX_END_USER_DAILY_MESSAGE_LIMIT, endUserDailyMessageLimitField, previewLabelField, hubTagsField, createHubBody, updateHubBody, HUB_TAG_CHANGE_REFUSED, hubTagChangeRefusalSchema, addHubAdminBody, addHubIdentityAuthorizationBody, contactDecisionBody, approveContactBody, CONTACT_ACCESS_PAGE_SIZE_MAX, listContactAccessQuery, createHubTeamBody, updateHubTeamBody, addHubTeamUserBody, reassignHubUserBody, replicatePreviewBody, HUB_DIFF_SECTION_SET, HUB_DIFF_SECTIONS, updateChannelTestIdentitiesBody, claimCodeChannelParam, claimCodeDeleteParam, PREVIOUS_CONVERSATIONS_MAX, NATIVE_TOOL_NAMES, previousConversationsCountField, summarizationThresholdField, flagConditionSchema, MONITOR_TRIGGERS, monitorTriggerSchema, AUTOMATION_GATE_TRIGGERS, NON_FIRING_TRIGGERS, MONITOR_FIRING_TRIGGERS, MONITOR_DELAY_SECONDS_MIN, MONITOR_IDLE_DELAY_REQUIRED_MESSAGE, MONITOR_HISTORY_MESSAGES_MAX, monitorHistoryMessagesSchema, monitorIncludeToolResultsSchema, MONITOR_INPUT_SHAPING_KEYS, MONITOR_INPUT_SHAPING_SCHEMAS, MONITOR_INPUT_SHAPING_IDLE_MESSAGE, monitorArgumentSourceSchema, MONITOR_NOTE_TEMPLATE_MAX, MONITOR_STEER_NOTE_MAX, MONITOR_GATE_AGENT_NAME_MAX, monitorActionSchema, monitorRuleSchema, MONITOR_RULE_KEYS, MONITOR_RULE_SCHEMAS, MONITOR_RULE_TRIGGERS, MONITOR_RULE_TRIGGER_MESSAGE, CALL_UTTERANCE_SPEAKERS, callUtteranceSpeakerSchema, MONITOR_CALL_KEYS, MONITOR_CALL_SCHEMAS, MONITOR_CALL_KEY_MESSAGE, CALL_STEERING_MIN_CONFIDENCE, CALL_UTTERANCE_RULE_NOT_CONFIDENT_MESSAGE, CALL_UTTERANCE_FALLBACK_MESSAGE, CALL_UTTERANCE_FLAG_CONDITIONS_MESSAGE, CALL_STEER_NOTE_BLANK_MESSAGE, MONITOR_USER_MESSAGE_ACTION_KINDS, MONITOR_ASSISTANT_REPLY_ACTION_KINDS, MONITOR_CALL_UTTERANCE_ACTION_KINDS, MONITOR_AUTOMATION_FIRE_ACTION_KINDS, MONITOR_AUTOMATION_ITEM_ACTION_KINDS, INSERT_NOTE_TOOL_NAME, RUN_MONITOR_TOOL_NAME, MONITOR_RULE_ALLOWED_NATIVE_TOOLS, MONITOR_RULE_REENTRY_TOOLS, MONITOR_RULE_REENTRY_TRACKS, AUTOMATION_FIRE_FLAG_CONDITIONS_MESSAGE, AUTOMATION_FIRE_INPUT_SHAPING_MESSAGE, AUTOMATION_ITEM_FLAG_CONDITIONS_MESSAGE, AUTOMATION_ITEM_INPUT_SHAPING_MESSAGE, AUTOMATION_GATE_KEY_MESSAGES, monitorConfigField, flagConditionsField, agentIdParam, listAgentsQuery, agentConnectionsQuery, createAgentBody, updateAgentBody, AGENT_PARAMETER_TYPES, AGENT_PARAMETER_NAME_REGEX, agentParameterCreateSchema, MAX_AGENT_PARAMETERS_PER_REQUEST, createAgentParametersBody, evalIdParam, sessionIdParam, scenarioSetIdParam, hubIdQuery, evalDateContextSchema, EVAL_FIXTURE_NAME_MAX_LENGTH, evalFixtureOverrideSchema, runSessionQuery, runJourneyQuery, EVAL_INPUT_ROLES, EVAL_INPUT_ROLE_LIST, ROLE_ECHO_MAX, EVAL_INITIAL_STATE_SCOPES, MAX_INITIAL_STATE_ENTRIES, evalInitialStateEntry, evalBody, EVAL_LIST_MAX_LIMIT, evalListLimit, getEvalsQuery, toggleEvalBody, bulkToggleEvalsBody, pacingConfigSchema, EVAL_MAX_SELECTED_SCENARIOS, evalScenarioSelectionEntrySchema, evalScenarioSelectionSchema, sessionConfigSchema, createSessionBody, getSessionsQuery, getSessionResultsQuery, getSessionRunsQuery, evalAnalyticsQuery, getSessionCostQuery, compareSessionsQuery, evalsSqlBody, evalsSqlSchemaQuery, exportResultsQuery, validateEvalBody, hubAgentsQuery, createScenarioSetBody, updateScenarioSetBody, scenarioSetsHubQuery, createScenarioFromConversationBody, createJourneyFromConversationBody, EVAL_ATTACHMENT_HASH_REGEX, evalAttachmentRef, turnMayCarryAttachments, ATTACHMENTS_USER_ONLY_MESSAGE, journeyIdParam, journeyToolCallSchema, journeyTurnSchema, journeyStepOverrideSchema, fixtureField, createJourneyBody, updateJourneyBody, evalSessionConfigResponseSchema, evalSessionResponseSchema, evalSessionListConfigSchema, evalSessionListItemSchema, seedReleaseStatusSchema, EVAL_SESSION_NOT_QUIESCENT, MAX_RESOURCE_FILE_SIZE, CALL_OPENING_LANGUAGES, callOpeningLanguage, CALL_OPENING_MAX_DURATION_MS, CALL_OPENING_MAX_BYTES, CALL_OPENING_CAPTION_MAX_CHARS, CALL_OPENING_CONTENT_TYPES, callOpeningContentType, CALL_OPENING_HASH_REGEX, callOpeningHash, callOpeningCaption, storedCallOpening, MAX_CALL_OPENING_ENCODED_BYTES, MAX_CALL_OPENING_BODY_BYTES, agentCallOpeningParams, putAgentCallOpeningBody, deleteAgentCallOpeningQuery, callOpeningParam, callOpeningQuery, MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, boundedHubAsCodeResourcesSchema, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
8117
- var init_chunk_6O3TITL5 = __esm({
8118
- "../../packages/core/dist/chunk-6O3TITL5.js"() {
8240
+ var init_chunk_2745FTNX = __esm({
8241
+ "../../packages/core/dist/chunk-2745FTNX.js"() {
8119
8242
  "use strict";
8120
- init_chunk_SNA2DXAC();
8243
+ init_chunk_QT7NKKPO();
8121
8244
  init_chunk_MIWZOSPI();
8122
8245
  init_chunk_IBL7FANV();
8123
8246
  init_chunk_2ISUBJG7();
@@ -9610,7 +9733,7 @@ var init_chunk_6O3TITL5 = __esm({
9610
9733
  }
9611
9734
  });
9612
9735
 
9613
- // ../../packages/core/dist/chunk-RBKQBA3D.js
9736
+ // ../../packages/core/dist/chunk-3OSR5AZZ.js
9614
9737
  function cacheReconcileIdCount(body) {
9615
9738
  return body.conversations.length + body.histories.reduce((n, history) => n + history.conversation_ids.length, 0) + body.threads.length;
9616
9739
  }
@@ -9656,16 +9779,16 @@ function parseCommunityLessonVideoUrl(url) {
9656
9779
  const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
9657
9780
  if (!parts) return null;
9658
9781
  const host = parts[1].toLowerCase();
9659
- const path41 = parts[2] ?? "";
9782
+ const path42 = parts[2] ?? "";
9660
9783
  const query = parts[3] ?? "";
9661
9784
  let id;
9662
9785
  if (host === YOUTU_BE) {
9663
- id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(path41)?.[1];
9786
+ id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(path42)?.[1];
9664
9787
  } else if (YOUTUBE_HOSTS.has(host)) {
9665
- if (path41 === "/watch" || path41 === "/watch/") {
9788
+ if (path42 === "/watch" || path42 === "/watch/") {
9666
9789
  id = query.split("&").find((param) => param.startsWith("v="))?.slice(2);
9667
9790
  } else {
9668
- id = YOUTUBE_ID_PATH.exec(path41)?.[1];
9791
+ id = YOUTUBE_ID_PATH.exec(path42)?.[1];
9669
9792
  }
9670
9793
  }
9671
9794
  return id !== void 0 && YOUTUBE_ID.test(id) ? { provider: "youtube", id } : null;
@@ -9676,13 +9799,13 @@ function communityLessonVideoWatchUrl(video) {
9676
9799
  return `https://www.youtube.com/watch?v=${video.id}`;
9677
9800
  }
9678
9801
  }
9679
- var connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery, initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody, variantAiModeSchema, experimentStatusSchema, overlayUpdateSchema, experimentIdParam, variantIdParam, listExperimentsQuery, listVariantsQuery, listOverridesQuery, deleteOverrideQuery, createExperimentBody, updateExperimentBody, setExperimentStatusBody, createVariantBody, updateVariantBody, upsertOverrideBody, orgTagIdParam, listOrgTagsQuery, ORG_TAG_NAME_REGEX, ORG_TAG_NAME_MAX_LENGTH, createOrgTagBody, updateOrgTagBody, orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody, BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery, orgResourceIdParam, orgResourceFileIdParam, orgResourceFolderIdParam, hubOrgResourceParam, listOrgResourcesQuery, orgIdQuery, createOrgResourceBody, updateOrgResourceBody, createOrgResourceFolderBody, updateOrgResourceFolderBody, uploadOrgResourceFileBody, updateOrgResourceFileBody, uploadOrgSkillZipBody, linkOrgResourceBody, resourceIdParam, listResourcesQuery, createResourceBody, updateResourceBody, syncSkillsBody, resourceFileIdParam, listResourceFilesQuery, createResourceFileBody, updateResourceFileBody, uploadResourceFileBody, uploadSkillZipBody, resourceFolderIdParam, listResourceFoldersQuery, createResourceFolderBody, updateResourceFolderBody, agentResourceQuery, hubResourceQuery, linkAgentResourceBody, updateAgentResourceBody, unlinkAgentResourceQuery, navItemSchema, hubCountResetBody, navItemCountResetBody, typingBody, analyticsHubIdParam, analyticsVariableIdParam, updateVariablePinBody, updateAnalyticsViewBody, NUMERIC_FILTER_OPS, TEXT_FILTER_OPS, CATEGORICAL_FILTER_OPS, VARIABLE_FILTER_OPS, STRUCTURED_QUERY_OPS, STRUCTURED_QUERY_AGGREGATIONS, filterValueSchema, conversationsBody, analyticsConversationIdParam, messagesQuery, conversationDetailDataQuery, analyticsDataBody, structuredQueryBody, analyticsSqlBody, analyticsSqlTable, analyticsSqlSchemaQuery, getConversationsQuery, getMessagesQuery, appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse, CALL_STATUSES, callStatus, CALL_END_REASONS, callEndReason, CALL_TRANSPORTS, callTransport, CALL_PARTICIPANT_TYPES, callParticipantType, callInstant, MAX_SDP_OFFER_LENGTH, sdpDescription, sdpOffer, MAX_CALL_REQUEST_BODY_BYTES, hubScoped, callSummaryFields, callSummary, callIdParam, createCallBody, createCallResponse, callReadyBody, callHangupBody, callStatusQuery, MAX_REPORTED_DELEGATION_IDS, callDelegationId, callDelegationsBody, callResponse, MAX_CALL_RECORDING_GAPS, callRecordingGap, callRecordingNoteMetadata, evalCallInstant, EVAL_CALL_MIN_SECONDS, EVAL_CALL_MAX_SECONDS, EVAL_CALL_SPOKEN_LINE_MAX_CHARS, hubScoped2, createEvalCallBody, createEvalCallResponse, evalCallConversationQuery, evalCallRecordQuery, evalCallSpeaker, evalCallUtterance, evalCallTurn, evalCallRecording, evalCallRecordResponse, evalCallFinishResponse, updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody, CACHE_RECONCILE_MAX_IDS, CACHE_RECONCILE_MAX_HUBS, cacheReconcileScopeSchema, cachedConversationPageSchema, cachedHistoryThreadSchema, cachedPeopleThreadSchema, cacheReconcileBody, archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams, conversationIdParam, conversationHubQuery, claimBody, releaseBody, transferBody, closeBody, additionalContextPayloadSchema, kanbanUpdateBody, annotateConversationBody, observabilityParams, observabilityListParams, deleteUserConversationsBody, deleteUserConversationsResponse, sendMessageBody, listConversationsQuery, flagSourceSchema, getConversationsResponse, getConversationDetailParams, getConversationDetailQuery, getConversationDetailResponse, listWhatsAppTemplatesQuery, sendWhatsAppTemplateBody, copilotSuggestBody, copilotSuggestResponse, CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS, billingOrgIdParam, subscriptionItemParams, planKeySchema, billingStatusSchema, paidTierSchema, spendCapBody, growthPacksBody, portalSessionBody, checkoutSessionBody, changeTierBody, updateBillingCurrencyBody, invoicesQuery, billingPlanTypeSchema, dataUsageCountersSchema, REKOR_ENTITLEMENT_CONTRACT_VERSION, entitlementProjectionSchema, rekorEntitlementRefreshMessageSchema, downloadBody, uploadQuery, SIGN_URL_MAX_EXPIRES_IN_SECONDS, signUrlBody, templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody, CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema, hubListNameSchema, HUB_LIST_FILTER_REQUIRED, hubContactListFilterSchema, hubContactListIdParam, hubContactListHubQuery, description, createHubContactListBody, updateHubContactListBody, AUTOMATION_TRIGGER_TYPES, AUTOMATION_EVENT_TYPES, AUTOMATION_TARGET_TYPES, AUTOMATION_ACTION_TYPES, AUTOMATION_CHANNEL_TYPES, AUTOMATION_PURPOSES, AUTOMATION_NAME_MAX, AUTOMATION_DESCRIPTION_MAX, AUTOMATION_INSTRUCTIONS_MAX, AUTOMATION_TEXT_MAX, AUTOMATION_CRON_MAX, AUTOMATION_WEBHOOK_AUTHS, AUTOMATION_WEBHOOK_HEADERS, AUTOMATION_WEBHOOK_BODY_MAX_BYTES, AUTOMATION_WEBHOOK_HEADER_NAME_MAX, AUTOMATION_WEBHOOK_MOUNT, WEBHOOK_RESERVED_HEADERS, automationTriggerSchema, automationTargetSchema, automationActionSchema, automationGateSchema, automationName, automationDescription, automationIdParam, automationHubQuery, automationWebhookParams, AUTOMATION_RUNS_PAGE_MAX, listAutomationRunsQuery, createAutomationBody, updateAutomationBody, AUTOMATION_ALERT_CATEGORIES, AUTOMATION_BLOCKED_ALERT_CATEGORY, automationEventSubscriberParam, VERSION_PART, MOBILE_APP_VERSION_RE, mobileAppVersionSchema, MOBILE_PLATFORMS, mobilePlatformSchema, mobileVersionPolicyQuery, mobileVersionPolicySchema, mobileVersionPolicyResponse, adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, TURN_DEADLINE_SECONDS_FLOOR, TURN_DEADLINE_SECONDS_MAX, turnDeadlineSeconds, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, dataExplorerDebugDoType, DEBUG_READ_MAX_LIMIT, DEBUG_READ_DEFAULT_LIMIT, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, debugHubConvParam, debugMessageIdQuery, META_ENTITY_ID_PATTERN, metaEntityId, whatsappCallbackBody, authMeResponse, wsTicketResponse, sessionCheckResponse, logoutResponse, magicCodeSendBody, magicCodeSendResponse, magicCodeVerifyBody, magicCodeVerifyResponse, passwordLoginBody, normalizeEmail, REVIEW_ACCOUNT_EMAILS, stateOperationBody, conversationListResourcesQuery, conversationReadResourceQuery, listPendingSchedulesQuery, listHubAggregateSchedulesQuery, reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody, clickhouseReadyResponse, bootstrapQuery, MAX_NAME_LENGTH, MAX_VALUE_LENGTH, MAX_TAGS, MAX_TAG_LENGTH, MAX_SCOPE_HUBS, MAX_SCOPE_TAGS, vaultSecretScopeSchema, vaultCreateBody, vaultUpdateBody, MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam, invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody, jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse, hubAlertsParam, hubAlertSeverity, hubAlert, hubAlertsListResponse, noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema, ADMIN_SKILL_NAME_REGEX, adminSkillNameParam, REKOR_ACTOR_TYPE_HEADER, REKOR_ACTOR_ID_HEADER, REKOR_ACTOR_LABEL_HEADER, REKOR_ACTOR_ORG_HEADER, REKOR_ACTOR_ADMIN_HEADER, REKOR_CLIENT_HEADER, REKOR_TOOL_ID_HEADER, REKOR_CLIENTS, rekorClientSchema, MAX_REKOR_TOOL_ID_LENGTH, rekorToolIdSchema, DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, REKOR_V1_PREFIX, DATA_PROXY_ORG_QUERY_PARAM, MAX_PROVISIONING_BODY_BYTES, dataProxyQuery, rekorAttestation, REQUIRED_REKOR_ATTESTATION_HEADERS, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, baseDestructionConfirmBody, BASE_DESTRUCTION_GRACE_MS, BASE_DESTRUCTION_CONFIRM_TTL_MS, BASE_DESTRUCTION_ORG_QUERY_PARAM, baseDestructionQuery, baseDestructionParam, baseDestructionInitiateBody, baseDestructionStatus, baseDestructionRequest, baseDestructionListResponse, baseDestructionInitiateResponse, baseDestructionConfirmResponse, baseDestructionCancelResponse, rekorBaseChangeMessageSchema, baseEnvironmentSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorResolvedToolsetSchema, PEOPLE_CONTACT_PAGE_MAX, PEOPLE_CONTACT_PAGE_DEFAULT, PEOPLE_CONTACT_EMAIL_MAX_LENGTH, peopleUserIdSchema, peopleInviteEmailSchema, peopleContactInviteBody, peopleContactInviteIdParam, peopleContactUserIdParam, peopleContactBlockBody, peopleContactPageQuery, peopleOutgoingInviteSchema, peopleContactPersonSchema, peopleContactSchema, peopleIncomingInviteSchema, peopleBlockedUserSchema, PEOPLE_THREAD_MESSAGE_MAX_LENGTH, PEOPLE_THREAD_MESSAGES_PAGE_MAX, PEOPLE_THREAD_PAGE_MAX, PEOPLE_THREAD_PAGE_DEFAULT, PEOPLE_GROUP_NAME_MAX_LENGTH, PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH, PEOPLE_THREAD_ATTACHMENT_MAX_BYTES, PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH, PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES, PEOPLE_THREAD_ATTACHMENT_MAX_MB, PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS, PEOPLE_THREAD_ATTACHMENT_URLS_MAX, peopleThreadIdParam, peopleThreadMessageIdParam, peopleThreadListQuery, peopleThreadMessagesQuery, peopleThreadAttachmentUploadSchema, peopleThreadSendBody, peopleThreadAttachmentUrlsBody, peopleThreadReadBody, peopleThreadSettingsBody, peopleGroupNameSchema, peopleGroupAvatarUrlSchema, peopleGroupCreateBody, peopleOrgDirectBody, peopleGroupUpdateBody, peopleGroupInviteBody, peopleOrgErasureBody, peopleGroupLeaveBody, peopleGroupInviteIdParam, peopleGroupIncomingInviteIdParam, peopleGroupMemberParam, peopleThreadKindSchema, peopleThreadMemberSchema, peopleThreadLastMessageSchema, peopleGroupRoleSchema, peopleGroupSummarySchema, peopleThreadSummarySchema, peopleThreadAttachmentSchema, peopleThreadMessageSchema, peopleGroupMemberSchema, peopleGroupSentInviteSchema, peopleGroupIncomingInviteSchema, PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody, PEOPLE_MODERATION_NOTE_MAX_LENGTH, ADMIN_PEOPLE_REPORTS_PAGE_MAX, ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT, PEOPLE_SUSPENDED_REASON, peopleModerationActionSchema, moderationNoteSchema, adminPeopleReportListQuery, adminPeopleReportIdParam, adminPeopleMessageRemovalBody, adminPeopleSuspendBody, adminPeopleNoteBody, COMMUNITIES_PER_ORG_MAX, COMMUNITY_NAME_MAX_LENGTH, COMMUNITY_REGISTRY_CLOSED_REASON, COMMUNITY_MEMBERS_MAX, COMMUNITY_ADMISSIONS, COMMUNITY_ACCESS_MAX, COMMUNITY_ACCESS_ADD_MAX, COMMUNITY_ACCESS_FULL_REASON, COMMUNITY_JOIN_SOURCE_MAX_LENGTH, COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH, COMMUNITY_ROOMS_MAX, COMMUNITY_ROOM_NAME_MAX_LENGTH, COMMUNITY_MESSAGE_MAX_LENGTH, COMMUNITY_MESSAGES_PAGE_SIZE, COMMUNITY_ATTACHMENT_URLS_MAX, COMMUNITY_POST_TITLE_MAX_LENGTH, COMMUNITY_POST_SEARCH_MAX_LENGTH, COMMUNITY_MEMBER_STATUSES, COMMUNITY_RULES_MAX_LENGTH, COMMUNITY_SLOW_MODE_MAX_SECONDS, COMMUNITY_COURSES_LABEL_MAX_LENGTH, COMMUNITY_LIVE_TICKET_PREFIX, COMMUNITY_STATS_DAYS, communityNameSchema, adminCreateCommunityBody, communityIdParam, communityJoinTokenSchema, communityJoinSourceSchema, communityJoinPreviewQuery, communityJoinBody, communityRoomKindSchema, communityRoomNameSchema, communityRoomIdParam, communityMessageIdParam, communityRoomCreateBody, communityRoomUpdateBody, communityMessagesQuery, communityMessageBodySchema, communityPostTitleSchema, communityAttachmentUploadSchema, communitySendBody, communityEditBody, communityPostIdParam, communityPostsQuery, communityAnswerBody, communityReadBody, communityAttachmentUrlsBody, communityPersonParam, communityOrgParam, communityPeopleQuery, communityCoursesLabelSchema, communityAdmissionSchema, communitySettingsBody, communityAccessEmailSchema, communityAccessAddBody, communityAccessQuery, communityAccessIdParam, communityBanBody, communityLockBody, communityPinBody, communityModLogQuery, communityReportsQuery, communityReportIdParam, communityLiveTicketSchema, communityLiveQuery, communityMuteBody, communityEmailUnsubscribeTokenSchema, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, communityEmailUnsubscribeQuery, COMMUNITY_COURSES_MAX, COMMUNITY_COURSE_MODULES_MAX, COMMUNITY_COURSE_LESSONS_MAX, COMMUNITY_LESSONS_MAX, COMMUNITY_COURSE_TITLE_MAX_LENGTH, COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH, COMMUNITY_LESSON_BODY_MAX_LENGTH, COMMUNITY_LESSON_LINKS_MAX, COMMUNITY_LESSON_URL_MAX_LENGTH, YOUTUBE_ID, YOUTUBE_HOSTS, YOUTU_BE, YOUTUBE_ID_PATH, communityCourseIdParam, communityCourseModuleIdParam, communityLessonIdParam, communityCourseTitleSchema, communityCourseDescriptionSchema, communityCoursePositionSchema, communityLessonVideoUrlSchema, communityLessonLinkSchema, communityLessonLinksSchema, communityLessonBodySchema, communityCourseCreateBody, communityCourseUpdateBody, communityModuleCreateBody, communityModuleUpdateBody, communityLessonCreateBody, communityLessonUpdateBody, COMMUNITY_LESSON_TREE_MAX_BYTES, COMMUNITY_LESSON_LINK_PROTOCOLS, COMMUNITY_LESSON_TREE_TOO_LARGE_REASON, COMMUNITY_LESSON_TREE_TOO_DEEP_REASON, COMMUNITY_LESSON_LINE_PREFIX_TOO_WIDE_REASON, LINK_SCHEME, adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
9680
- var init_chunk_RBKQBA3D = __esm({
9681
- "../../packages/core/dist/chunk-RBKQBA3D.js"() {
9802
+ var connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery, initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody, variantAiModeSchema, experimentStatusSchema, overlayUpdateSchema, experimentIdParam, variantIdParam, listExperimentsQuery, listVariantsQuery, listOverridesQuery, deleteOverrideQuery, createExperimentBody, updateExperimentBody, setExperimentStatusBody, createVariantBody, updateVariantBody, upsertOverrideBody, orgTagIdParam, listOrgTagsQuery, ORG_TAG_NAME_REGEX, ORG_TAG_NAME_MAX_LENGTH, createOrgTagBody, updateOrgTagBody, orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody, BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery, orgResourceIdParam, orgResourceFileIdParam, orgResourceFolderIdParam, hubOrgResourceParam, listOrgResourcesQuery, orgIdQuery, createOrgResourceBody, updateOrgResourceBody, createOrgResourceFolderBody, updateOrgResourceFolderBody, uploadOrgResourceFileBody, updateOrgResourceFileBody, uploadOrgSkillZipBody, linkOrgResourceBody, resourceIdParam, listResourcesQuery, createResourceBody, updateResourceBody, syncSkillsBody, resourceFileIdParam, listResourceFilesQuery, createResourceFileBody, updateResourceFileBody, uploadResourceFileBody, uploadSkillZipBody, resourceFolderIdParam, listResourceFoldersQuery, createResourceFolderBody, updateResourceFolderBody, agentResourceQuery, hubResourceQuery, linkAgentResourceBody, updateAgentResourceBody, unlinkAgentResourceQuery, navItemSchema, hubCountResetBody, navItemCountResetBody, typingBody, analyticsHubIdParam, analyticsVariableIdParam, updateVariablePinBody, updateAnalyticsViewBody, NUMERIC_FILTER_OPS, TEXT_FILTER_OPS, CATEGORICAL_FILTER_OPS, VARIABLE_FILTER_OPS, STRUCTURED_QUERY_OPS, STRUCTURED_QUERY_AGGREGATIONS, filterValueSchema, conversationsBody, analyticsConversationIdParam, messagesQuery, conversationDetailDataQuery, analyticsDataBody, structuredQueryBody, analyticsSqlBody, analyticsSqlTable, analyticsSqlSchemaQuery, getConversationsQuery, getMessagesQuery, appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse, CALL_STATUSES, callStatus, CALL_END_REASONS, callEndReason, CALL_TRANSPORTS, callTransport, CALL_PARTICIPANT_TYPES, callParticipantType, callInstant, MAX_SDP_OFFER_LENGTH, sdpDescription, sdpOffer, MAX_CALL_REQUEST_BODY_BYTES, hubScoped, callSummaryFields, callSummary, callIdParam, createCallBody, createCallResponse, callReadyBody, callHangupBody, callStatusQuery, MAX_REPORTED_DELEGATION_IDS, callDelegationId, callDelegationsBody, callResponse, MAX_CALL_RECORDING_GAPS, callRecordingGap, callRecordingNoteMetadata, evalCallInstant, EVAL_CALL_MIN_SECONDS, EVAL_CALL_MAX_SECONDS, EVAL_CALL_SPOKEN_LINE_MAX_CHARS, hubScoped2, createEvalCallBody, createEvalCallResponse, evalCallConversationQuery, evalCallRecordQuery, evalCallSpeaker, evalCallUtterance, evalCallTurn, evalCallRecording, evalCallRecordResponse, evalCallFinishResponse, updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody, CACHE_RECONCILE_MAX_IDS, CACHE_RECONCILE_MAX_HUBS, cacheReconcileScopeSchema, cachedConversationPageSchema, cachedHistoryThreadSchema, cachedPeopleThreadSchema, cacheReconcileBody, archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams, conversationIdParam, conversationHubQuery, claimBody, releaseBody, transferBody, closeBody, additionalContextPayloadSchema, kanbanUpdateBody, annotateConversationBody, observabilityParams, observabilityListParams, deleteUserConversationsBody, deleteUserConversationsResponse, sendMessageBody, listConversationsQuery, flagSourceSchema, getConversationsResponse, getConversationDetailParams, getConversationDetailQuery, getConversationDetailResponse, listWhatsAppTemplatesQuery, sendWhatsAppTemplateBody, copilotSuggestBody, copilotSuggestResponse, CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS, billingOrgIdParam, subscriptionItemParams, planKeySchema, billingStatusSchema, paidTierSchema, spendCapBody, growthPacksBody, portalSessionBody, checkoutSessionBody, changeTierBody, updateBillingCurrencyBody, invoicesQuery, billingPlanTypeSchema, dataUsageCountersSchema, REKOR_ENTITLEMENT_CONTRACT_VERSION, entitlementProjectionSchema, rekorEntitlementRefreshMessageSchema, downloadBody, uploadQuery, SIGN_URL_MAX_EXPIRES_IN_SECONDS, signUrlBody, templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody, CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema, hubListNameSchema, HUB_LIST_FILTER_REQUIRED, hubContactListFilterSchema, hubContactListIdParam, hubContactListHubQuery, description, createHubContactListBody, updateHubContactListBody, AUTOMATION_TRIGGER_TYPES, AUTOMATION_EVENT_TYPES, AUTOMATION_TARGET_TYPES, AUTOMATION_ACTION_TYPES, AUTOMATION_CHANNEL_TYPES, AUTOMATION_PURPOSES, AUTOMATION_NAME_MAX, AUTOMATION_DESCRIPTION_MAX, AUTOMATION_INSTRUCTIONS_MAX, AUTOMATION_TEXT_MAX, AUTOMATION_CRON_MAX, AUTOMATION_WEBHOOK_AUTHS, AUTOMATION_WEBHOOK_HEADERS, AUTOMATION_WEBHOOK_BODY_MAX_BYTES, AUTOMATION_WEBHOOK_HEADER_NAME_MAX, AUTOMATION_WEBHOOK_MOUNT, WEBHOOK_RESERVED_HEADERS, automationTriggerSchema, automationTargetSchema, automationActionSchema, automationGateSchema, automationName, automationDescription, automationIdParam, automationHubQuery, automationWebhookParams, AUTOMATION_RUNS_PAGE_MAX, listAutomationRunsQuery, createAutomationBody, updateAutomationBody, AUTOMATION_ALERT_CATEGORIES, AUTOMATION_BLOCKED_ALERT_CATEGORY, automationEventSubscriberParam, VERSION_PART, MOBILE_APP_VERSION_RE, mobileAppVersionSchema, MOBILE_PLATFORMS, mobilePlatformSchema, mobileVersionPolicyQuery, mobileVersionPolicySchema, mobileVersionPolicyResponse, adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, TURN_DEADLINE_SECONDS_FLOOR, TURN_DEADLINE_SECONDS_MAX, turnDeadlineSeconds, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, dataExplorerDebugDoType, DEBUG_READ_MAX_LIMIT, DEBUG_READ_DEFAULT_LIMIT, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, debugHubConvParam, debugMessageIdQuery, META_ENTITY_ID_PATTERN, metaEntityId, whatsappCallbackBody, authMeResponse, wsTicketResponse, sessionCheckResponse, logoutResponse, magicCodeSendBody, magicCodeSendResponse, magicCodeVerifyBody, magicCodeVerifyResponse, passwordLoginBody, normalizeEmail, REVIEW_ACCOUNT_EMAILS, stateOperationBody, conversationListResourcesQuery, conversationReadResourceQuery, listPendingSchedulesQuery, listHubAggregateSchedulesQuery, reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody, clickhouseReadyResponse, bootstrapQuery, MAX_NAME_LENGTH, MAX_VALUE_LENGTH, MAX_TAGS, MAX_TAG_LENGTH, MAX_SCOPE_HUBS, MAX_SCOPE_TAGS, vaultSecretScopeSchema, vaultCreateBody, vaultUpdateBody, MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam, invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody, jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse, hubAlertsParam, hubAlertSeverity, hubAlert, hubAlertsListResponse, noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema, ADMIN_SKILL_NAME_REGEX, adminSkillNameParam, REKOR_ACTOR_TYPE_HEADER, REKOR_ACTOR_ID_HEADER, REKOR_ACTOR_LABEL_HEADER, REKOR_ACTOR_ORG_HEADER, REKOR_ACTOR_ADMIN_HEADER, REKOR_CLIENT_HEADER, REKOR_TOOL_ID_HEADER, REKOR_CLIENTS, rekorClientSchema, MAX_REKOR_TOOL_ID_LENGTH, rekorToolIdSchema, DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, REKOR_V1_PREFIX, DATA_PROXY_ORG_QUERY_PARAM, MAX_PROVISIONING_BODY_BYTES, dataProxyQuery, rekorAttestation, REQUIRED_REKOR_ATTESTATION_HEADERS, REKOR_BOUND_BASE_HEADER, REKOR_BOUND_TOOLSET_HEADER, DATA_BASE_GENERATION_HEADER, REKOR_MAX_ACTOR_ID_LENGTH, REKOR_MAX_ACTOR_LABEL_LENGTH, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, baseDestructionConfirmBody, BASE_DESTRUCTION_GRACE_MS, BASE_DESTRUCTION_CONFIRM_TTL_MS, BASE_DESTRUCTION_ORG_QUERY_PARAM, baseDestructionQuery, baseDestructionParam, baseDestructionInitiateBody, baseDestructionStatus, baseDestructionRequest, baseDestructionListResponse, baseDestructionInitiateResponse, baseDestructionConfirmResponse, baseDestructionCancelResponse, rekorBaseChangeMessageSchema, baseEnvironmentSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, rekorToolsetToolsSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, PEOPLE_CONTACT_PAGE_MAX, PEOPLE_CONTACT_PAGE_DEFAULT, PEOPLE_CONTACT_EMAIL_MAX_LENGTH, peopleUserIdSchema, peopleInviteEmailSchema, peopleContactInviteBody, peopleContactInviteIdParam, peopleContactUserIdParam, peopleContactBlockBody, peopleContactPageQuery, peopleOutgoingInviteSchema, peopleContactPersonSchema, peopleContactSchema, peopleIncomingInviteSchema, peopleBlockedUserSchema, PEOPLE_THREAD_MESSAGE_MAX_LENGTH, PEOPLE_THREAD_MESSAGES_PAGE_MAX, PEOPLE_THREAD_PAGE_MAX, PEOPLE_THREAD_PAGE_DEFAULT, PEOPLE_GROUP_NAME_MAX_LENGTH, PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH, PEOPLE_THREAD_ATTACHMENT_MAX_BYTES, PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH, PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES, PEOPLE_THREAD_ATTACHMENT_MAX_MB, PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS, PEOPLE_THREAD_ATTACHMENT_URLS_MAX, peopleThreadIdParam, peopleThreadMessageIdParam, peopleThreadListQuery, peopleThreadMessagesQuery, peopleThreadAttachmentUploadSchema, peopleThreadSendBody, peopleThreadAttachmentUrlsBody, peopleThreadReadBody, peopleThreadSettingsBody, peopleGroupNameSchema, peopleGroupAvatarUrlSchema, peopleGroupCreateBody, peopleOrgDirectBody, peopleGroupUpdateBody, peopleGroupInviteBody, peopleOrgErasureBody, peopleGroupLeaveBody, peopleGroupInviteIdParam, peopleGroupIncomingInviteIdParam, peopleGroupMemberParam, peopleThreadKindSchema, peopleThreadMemberSchema, peopleThreadLastMessageSchema, peopleGroupRoleSchema, peopleGroupSummarySchema, peopleThreadSummarySchema, peopleThreadAttachmentSchema, peopleThreadMessageSchema, peopleGroupMemberSchema, peopleGroupSentInviteSchema, peopleGroupIncomingInviteSchema, PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody, PEOPLE_MODERATION_NOTE_MAX_LENGTH, ADMIN_PEOPLE_REPORTS_PAGE_MAX, ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT, PEOPLE_SUSPENDED_REASON, peopleModerationActionSchema, moderationNoteSchema, adminPeopleReportListQuery, adminPeopleReportIdParam, adminPeopleMessageRemovalBody, adminPeopleSuspendBody, adminPeopleNoteBody, COMMUNITIES_PER_ORG_MAX, COMMUNITY_NAME_MAX_LENGTH, COMMUNITY_REGISTRY_CLOSED_REASON, COMMUNITY_MEMBERS_MAX, COMMUNITY_ADMISSIONS, COMMUNITY_ACCESS_MAX, COMMUNITY_ACCESS_ADD_MAX, COMMUNITY_ACCESS_FULL_REASON, COMMUNITY_JOIN_SOURCE_MAX_LENGTH, COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH, COMMUNITY_ROOMS_MAX, COMMUNITY_ROOM_NAME_MAX_LENGTH, COMMUNITY_MESSAGE_MAX_LENGTH, COMMUNITY_MESSAGES_PAGE_SIZE, COMMUNITY_ATTACHMENT_URLS_MAX, COMMUNITY_POST_TITLE_MAX_LENGTH, COMMUNITY_POST_SEARCH_MAX_LENGTH, COMMUNITY_MEMBER_STATUSES, COMMUNITY_RULES_MAX_LENGTH, COMMUNITY_SLOW_MODE_MAX_SECONDS, COMMUNITY_COURSES_LABEL_MAX_LENGTH, COMMUNITY_LIVE_TICKET_PREFIX, COMMUNITY_STATS_DAYS, communityNameSchema, adminCreateCommunityBody, communityIdParam, communityJoinTokenSchema, communityJoinSourceSchema, communityJoinPreviewQuery, communityJoinBody, communityRoomKindSchema, communityRoomNameSchema, communityRoomIdParam, communityMessageIdParam, communityRoomCreateBody, communityRoomUpdateBody, communityMessagesQuery, communityMessageBodySchema, communityPostTitleSchema, communityAttachmentUploadSchema, communitySendBody, communityEditBody, communityPostIdParam, communityPostsQuery, communityAnswerBody, communityReadBody, communityAttachmentUrlsBody, communityPersonParam, communityOrgParam, communityPeopleQuery, communityCoursesLabelSchema, communityAdmissionSchema, communitySettingsBody, communityAccessEmailSchema, communityAccessAddBody, communityAccessQuery, communityAccessIdParam, communityBanBody, communityLockBody, communityPinBody, communityModLogQuery, communityReportsQuery, communityReportIdParam, communityLiveTicketSchema, communityLiveQuery, communityMuteBody, communityEmailUnsubscribeTokenSchema, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, communityEmailUnsubscribeQuery, COMMUNITY_COURSES_MAX, COMMUNITY_COURSE_MODULES_MAX, COMMUNITY_COURSE_LESSONS_MAX, COMMUNITY_LESSONS_MAX, COMMUNITY_COURSE_TITLE_MAX_LENGTH, COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH, COMMUNITY_LESSON_BODY_MAX_LENGTH, COMMUNITY_LESSON_LINKS_MAX, COMMUNITY_LESSON_URL_MAX_LENGTH, YOUTUBE_ID, YOUTUBE_HOSTS, YOUTU_BE, YOUTUBE_ID_PATH, communityCourseIdParam, communityCourseModuleIdParam, communityLessonIdParam, communityCourseTitleSchema, communityCourseDescriptionSchema, communityCoursePositionSchema, communityLessonVideoUrlSchema, communityLessonLinkSchema, communityLessonLinksSchema, communityLessonBodySchema, communityCourseCreateBody, communityCourseUpdateBody, communityModuleCreateBody, communityModuleUpdateBody, communityLessonCreateBody, communityLessonUpdateBody, COMMUNITY_LESSON_TREE_MAX_BYTES, COMMUNITY_LESSON_LINK_PROTOCOLS, COMMUNITY_LESSON_TREE_TOO_LARGE_REASON, COMMUNITY_LESSON_TREE_TOO_DEEP_REASON, COMMUNITY_LESSON_LINE_PREFIX_TOO_WIDE_REASON, LINK_SCHEME, adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
9803
+ var init_chunk_3OSR5AZZ = __esm({
9804
+ "../../packages/core/dist/chunk-3OSR5AZZ.js"() {
9682
9805
  "use strict";
9683
9806
  init_chunk_VORPHGDT();
9684
- init_chunk_2TNXNKRP();
9685
- init_chunk_6O3TITL5();
9807
+ init_chunk_BBFWR2LG();
9808
+ init_chunk_2745FTNX();
9686
9809
  init_chunk_MIWZOSPI();
9687
9810
  init_chunk_3NS3HULK();
9688
9811
  init_chunk_DHPUPI4Y();
@@ -12400,6 +12523,11 @@ var init_chunk_RBKQBA3D = __esm({
12400
12523
  [REKOR_TOOL_ID_HEADER]: rekorToolIdSchema.optional()
12401
12524
  });
12402
12525
  REQUIRED_REKOR_ATTESTATION_HEADERS = Object.entries(rekorAttestation.shape).filter(([, field]) => !field.isOptional()).map(([header]) => header);
12526
+ REKOR_BOUND_BASE_HEADER = "X-Rekor-Bound-Base";
12527
+ REKOR_BOUND_TOOLSET_HEADER = "X-Rekor-Bound-Toolset";
12528
+ DATA_BASE_GENERATION_HEADER = "X-Data-Base-Generation";
12529
+ REKOR_MAX_ACTOR_ID_LENGTH = 256;
12530
+ REKOR_MAX_ACTOR_LABEL_LENGTH = 256;
12403
12531
  BASE_DESTRUCTION_MOUNT = "/bases";
12404
12532
  BASE_DESTRUCTION_PREFIX = `/api${BASE_DESTRUCTION_MOUNT}`;
12405
12533
  BASE_DESTRUCTION_CONFIRM_PATH = `${BASE_DESTRUCTION_PREFIX}/destruction/confirm`;
@@ -12497,11 +12625,31 @@ var init_chunk_RBKQBA3D = __esm({
12497
12625
  environment: baseEnvironmentSchema,
12498
12626
  surface: toolsetSurfaceSchema
12499
12627
  });
12628
+ TOOLSET_SLUG_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
12629
+ REKOR_STRUCTURAL_ID_PATTERN = TOOLSET_SLUG_PATTERN;
12500
12630
  rekorToolsetToolsSchema = external_exports.object({
12501
12631
  data: external_exports.object({
12502
- tools: external_exports.array(external_exports.object({ name: external_exports.string() }))
12632
+ tools: external_exports.array(external_exports.object({
12633
+ name: external_exports.string(),
12634
+ description: external_exports.string().optional(),
12635
+ inputSchema: external_exports.record(external_exports.unknown()).optional()
12636
+ }))
12503
12637
  })
12504
12638
  });
12639
+ rekorBoundAttestation = rekorAttestation.extend({
12640
+ [REKOR_ACTOR_TYPE_HEADER]: external_exports.literal("token"),
12641
+ /** Trimmed and checked as the far side trims and checks it. */
12642
+ [REKOR_ACTOR_ID_HEADER]: external_exports.string().trim().min(1).max(REKOR_MAX_ACTOR_ID_LENGTH),
12643
+ [REKOR_ACTOR_LABEL_HEADER]: external_exports.string().max(REKOR_MAX_ACTOR_LABEL_LENGTH),
12644
+ [REKOR_ACTOR_ADMIN_HEADER]: external_exports.literal("0"),
12645
+ [REKOR_BOUND_BASE_HEADER]: external_exports.string().regex(REKOR_STRUCTURAL_ID_PATTERN),
12646
+ [REKOR_BOUND_TOOLSET_HEADER]: external_exports.string().regex(REKOR_STRUCTURAL_ID_PATTERN),
12647
+ /**
12648
+ * Decimal digits only, as the far side parses it, and at most 15 of them: its `Number()` reads
12649
+ * every such value back exactly, where a longer one may round or overflow to `Infinity` (a 400).
12650
+ */
12651
+ [DATA_BASE_GENERATION_HEADER]: external_exports.string().regex(/^[1-9]\d{0,14}$/)
12652
+ });
12505
12653
  rekorResolvedToolsetSchema = external_exports.object({
12506
12654
  data: external_exports.object({
12507
12655
  base_id: external_exports.string().min(1),
@@ -13213,11 +13361,11 @@ var init_chunk_BPDC67ML = __esm({
13213
13361
  var init_contracts = __esm({
13214
13362
  "../../packages/core/dist/contracts/index.js"() {
13215
13363
  "use strict";
13216
- init_chunk_RBKQBA3D();
13364
+ init_chunk_3OSR5AZZ();
13217
13365
  init_chunk_VORPHGDT();
13218
- init_chunk_2TNXNKRP();
13219
- init_chunk_6O3TITL5();
13220
- init_chunk_SNA2DXAC();
13366
+ init_chunk_BBFWR2LG();
13367
+ init_chunk_2745FTNX();
13368
+ init_chunk_QT7NKKPO();
13221
13369
  init_chunk_MIWZOSPI();
13222
13370
  init_chunk_LKBSHANA();
13223
13371
  init_chunk_IBL7FANV();
@@ -13255,10 +13403,10 @@ function toDataProxyPath(v1Path) {
13255
13403
  }
13256
13404
  return `${DATA_PROXY_PREFIX}${v1Path.slice(REKOR_V1_PREFIX.length)}`;
13257
13405
  }
13258
- function withOrgSelector(path41, orgId) {
13259
- if (!orgId) return path41;
13260
- const separator = path41.includes("?") ? "&" : "?";
13261
- return `${path41}${separator}${DATA_PROXY_ORG_QUERY_PARAM}=${encodeURIComponent(orgId)}`;
13406
+ function withOrgSelector(path42, orgId) {
13407
+ if (!orgId) return path42;
13408
+ const separator = path42.includes("?") ? "&" : "?";
13409
+ return `${path42}${separator}${DATA_PROXY_ORG_QUERY_PARAM}=${encodeURIComponent(orgId)}`;
13262
13410
  }
13263
13411
  function dataErrorMessage(err) {
13264
13412
  if (!(err instanceof ApiError)) return null;
@@ -13282,7 +13430,7 @@ var init_api_client = __esm({
13282
13430
  init_sentry();
13283
13431
  init_mask_secrets();
13284
13432
  RETRYABLE_BACKOFF_MS = [500, 1e3, 2e3];
13285
- delay = (ms) => new Promise((resolve12) => setTimeout(resolve12, ms));
13433
+ delay = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
13286
13434
  courseAuthoring = (communityId, courseId) => `/api/communities/${encodeURIComponent(communityId)}/authoring/courses${courseId === void 0 ? "" : `/${encodeURIComponent(courseId)}`}`;
13287
13435
  ApiError = class extends Error {
13288
13436
  status;
@@ -13293,13 +13441,13 @@ var init_api_client = __esm({
13293
13441
  * telling them apart by body shape misreads one for the other.
13294
13442
  */
13295
13443
  path;
13296
- constructor(method, path41, status, body) {
13444
+ constructor(method, path42, status, body) {
13297
13445
  const safeBody = maskSecretsInMessage(body);
13298
- super(`API request failed: ${method} ${path41} (${status}): ${safeBody}`);
13446
+ super(`API request failed: ${method} ${path42} (${status}): ${safeBody}`);
13299
13447
  this.name = "ApiError";
13300
13448
  this.status = status;
13301
13449
  this.body = safeBody;
13302
- this.path = path41;
13450
+ this.path = path42;
13303
13451
  }
13304
13452
  /** True when the status code is a 4xx client error (expected user-facing condition, not a bug). */
13305
13453
  get isExpected() {
@@ -13508,8 +13656,8 @@ var init_api_client = __esm({
13508
13656
  ...opts?.check && { check: true }
13509
13657
  });
13510
13658
  }
13511
- async lookup(path41, opts) {
13512
- const params = new URLSearchParams({ path: path41 });
13659
+ async lookup(path42, opts) {
13660
+ const params = new URLSearchParams({ path: path42 });
13513
13661
  if (opts?.organizationId) params.set("organization_id", opts.organizationId);
13514
13662
  return this.request("GET", `/api/ci/lookup?${params.toString()}`);
13515
13663
  }
@@ -14050,9 +14198,9 @@ var init_api_client = __esm({
14050
14198
  `/api/admin/data-explorer/debug/observability/${encodeURIComponent(hubId)}/conversations/${encodeURIComponent(conversationId)}${qs}`
14051
14199
  );
14052
14200
  }
14053
- async request(method, path41, body, extraHeaders, contentType) {
14054
- addApiBreadcrumb(method, path41);
14055
- const url = `${this.apiUrl}${path41}`;
14201
+ async request(method, path42, body, extraHeaders, contentType) {
14202
+ addApiBreadcrumb(method, path42);
14203
+ const url = `${this.apiUrl}${path42}`;
14056
14204
  let refreshedOn401 = false;
14057
14205
  for (let retry = 0; ; retry++) {
14058
14206
  let response = await this.send(url, method, body, extraHeaders, contentType);
@@ -14077,7 +14225,7 @@ var init_api_client = __esm({
14077
14225
  await delay(RETRYABLE_BACKOFF_MS[retry]);
14078
14226
  continue;
14079
14227
  }
14080
- throw new ApiError(method, path41, response.status, errorBody);
14228
+ throw new ApiError(method, path42, response.status, errorBody);
14081
14229
  }
14082
14230
  }
14083
14231
  /**
@@ -14104,12 +14252,17 @@ var init_api_client = __esm({
14104
14252
  * It travels as the proxy's own query param, whose name is imported rather
14105
14253
  * than spelled — the handler validates it and strips it before forwarding,
14106
14254
  * since it is WayAI's selector and not an input Rekor sees.
14255
+ *
14256
+ * `extraHeaders` carries the surface's own request headers — a file delete's
14257
+ * `If-Match` — under the same rule as `dataUpload`'s: caller-supplied, so
14258
+ * nothing `send` pins can be displaced by them.
14107
14259
  */
14108
- async dataRequest(method, v1Path, body, orgId) {
14260
+ async dataRequest(method, v1Path, body, orgId, extraHeaders) {
14109
14261
  const envelope = await this.request(
14110
14262
  method,
14111
14263
  withOrgSelector(toDataProxyPath(v1Path), orgId),
14112
- body
14264
+ body,
14265
+ extraHeaders
14113
14266
  );
14114
14267
  return envelope ?? {};
14115
14268
  }
@@ -14139,9 +14292,9 @@ var init_api_client = __esm({
14139
14292
  * transient-retry loop — re-streaming a blob is not worth a cold-start probe.
14140
14293
  */
14141
14294
  async dataDownload(v1Path, orgId) {
14142
- const path41 = withOrgSelector(toDataProxyPath(v1Path), orgId);
14143
- addApiBreadcrumb("GET", path41);
14144
- const url = `${this.apiUrl}${path41}`;
14295
+ const path42 = withOrgSelector(toDataProxyPath(v1Path), orgId);
14296
+ addApiBreadcrumb("GET", path42);
14297
+ const url = `${this.apiUrl}${path42}`;
14145
14298
  let response = await this.send(url, "GET");
14146
14299
  if (response.status === 401 && this.onUnauthorized) {
14147
14300
  let refreshed;
@@ -14155,7 +14308,7 @@ var init_api_client = __esm({
14155
14308
  }
14156
14309
  }
14157
14310
  if (!response.ok) {
14158
- throw new ApiError("GET", path41, response.status, await response.text());
14311
+ throw new ApiError("GET", path42, response.status, await response.text());
14159
14312
  }
14160
14313
  return {
14161
14314
  bytes: new Uint8Array(await response.arrayBuffer()),
@@ -14349,6 +14502,32 @@ var init_chunk_BF4WRSOQ = __esm({
14349
14502
  });
14350
14503
 
14351
14504
  // ../../packages/core/dist/index.js
14505
+ function matchPath(pattern, path42) {
14506
+ const normalizedPath = path42.replace(/\/$/, "");
14507
+ if (pattern.endsWith("/*")) {
14508
+ const prefix = pattern.slice(0, -2);
14509
+ return normalizedPath === prefix || normalizedPath.startsWith(prefix + "/");
14510
+ }
14511
+ return pattern === normalizedPath;
14512
+ }
14513
+ function getEndpointConfig(path42) {
14514
+ for (const excluded of EXCLUDED_PATHS) {
14515
+ if (matchPath(excluded, path42)) {
14516
+ return null;
14517
+ }
14518
+ }
14519
+ const normalizedPath = path42.replace(/\/$/, "");
14520
+ if (!normalizedPath.endsWith("/*") && Object.prototype.hasOwnProperty.call(ENDPOINT_CONFIGS, normalizedPath)) {
14521
+ return ENDPOINT_CONFIGS[normalizedPath];
14522
+ }
14523
+ const sortedPatterns = Object.keys(ENDPOINT_CONFIGS).sort((a, b) => b.length - a.length);
14524
+ for (const pattern of sortedPatterns) {
14525
+ if (matchPath(pattern, path42)) {
14526
+ return ENDPOINT_CONFIGS[pattern];
14527
+ }
14528
+ }
14529
+ return { tier: "STANDARD" };
14530
+ }
14352
14531
  function bytesToUuid(bytes) {
14353
14532
  const hex = [];
14354
14533
  for (let i = 0; i < 16; i++) hex.push(bytes[i].toString(16).padStart(2, "0"));
@@ -14396,16 +14575,16 @@ function markdownToPlainText(text) {
14396
14575
  result = result.replace(/^[-*_]{3,}$/gm, "");
14397
14576
  return result;
14398
14577
  }
14399
- var ENDPOINT_CONFIGS, UUID_RE2, WAYAI_WORKSPACE_LAYOUT;
14578
+ var ENDPOINT_CONFIGS, EXCLUDED_PATHS, UUID_RE2, WAYAI_WORKSPACE_LAYOUT;
14400
14579
  var init_dist = __esm({
14401
14580
  "../../packages/core/dist/index.js"() {
14402
14581
  "use strict";
14403
14582
  init_chunk_P3AWZG3N();
14404
- init_chunk_RBKQBA3D();
14583
+ init_chunk_3OSR5AZZ();
14405
14584
  init_chunk_VORPHGDT();
14406
- init_chunk_2TNXNKRP();
14407
- init_chunk_6O3TITL5();
14408
- init_chunk_SNA2DXAC();
14585
+ init_chunk_BBFWR2LG();
14586
+ init_chunk_2745FTNX();
14587
+ init_chunk_QT7NKKPO();
14409
14588
  init_chunk_MIWZOSPI();
14410
14589
  init_chunk_LKBSHANA();
14411
14590
  init_chunk_IBL7FANV();
@@ -14879,6 +15058,7 @@ var init_dist = __esm({
14879
15058
  "/api/auth/session-check": { tier: "STANDARD", userLimit: 120, skipAuthenticatedUsers: true },
14880
15059
  "/api/auth/logout": { tier: "MODERATE", userLimit: 10, failClosed: true, skipAuthenticatedUsers: true }
14881
15060
  };
15061
+ EXCLUDED_PATHS = /* @__PURE__ */ new Set(["/health"]);
14882
15062
  UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
14883
15063
  WAYAI_WORKSPACE_LAYOUT = {
14884
15064
  /** Product-namespaced root dir at the git root. */
@@ -15660,13 +15840,13 @@ function resolve3(gitRoot) {
15660
15840
  }
15661
15841
  return { kind: "none" };
15662
15842
  }
15663
- function conflictMessage(manifestOrg, rootOrg, remedy = RECONCILE_REMEDY) {
15843
+ function conflictMessage(manifestOrg, rootOrg, remedy2 = RECONCILE_REMEDY) {
15664
15844
  return [
15665
15845
  "Refusing to guess the organization: two files in this repo name different ones.",
15666
15846
  ` ${WORKSPACE_MANIFEST_LABEL} -> ${manifestOrg} (the workspace manifest)`,
15667
15847
  ` ${ROOT_CONFIG_FILE} -> ${rootOrg} (deprecated fallback)`,
15668
15848
  "",
15669
- ...remedy
15849
+ ...remedy2
15670
15850
  ].join("\n");
15671
15851
  }
15672
15852
  function rebindRefusal(requestedOrg, rootOrg) {
@@ -15848,24 +16028,24 @@ import * as path6 from "path";
15848
16028
  import * as readline from "readline";
15849
16029
  function prompt(question) {
15850
16030
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
15851
- return new Promise((resolve12) => {
16031
+ return new Promise((resolve13) => {
15852
16032
  rl.question(question, (answer) => {
15853
16033
  rl.close();
15854
- resolve12(answer.trim());
16034
+ resolve13(answer.trim());
15855
16035
  });
15856
16036
  });
15857
16037
  }
15858
16038
  function confirm(question) {
15859
16039
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
15860
- return new Promise((resolve12) => {
16040
+ return new Promise((resolve13) => {
15861
16041
  rl.question(`${question} [y/N]: `, (answer) => {
15862
16042
  rl.close();
15863
- resolve12(answer.trim().toLowerCase() === "y");
16043
+ resolve13(answer.trim().toLowerCase() === "y");
15864
16044
  });
15865
16045
  });
15866
16046
  }
15867
16047
  function promptSecret(question) {
15868
- return new Promise((resolve12) => {
16048
+ return new Promise((resolve13) => {
15869
16049
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
15870
16050
  const originalWrite = rl._writeToOutput;
15871
16051
  let firstWrite = true;
@@ -15881,18 +16061,18 @@ function promptSecret(question) {
15881
16061
  rl._writeToOutput = originalWrite;
15882
16062
  process.stdout.write("\n");
15883
16063
  rl.close();
15884
- resolve12(answer);
16064
+ resolve13(answer);
15885
16065
  });
15886
16066
  });
15887
16067
  }
15888
16068
  function readStdin() {
15889
- return new Promise((resolve12, reject) => {
16069
+ return new Promise((resolve13, reject) => {
15890
16070
  let data = "";
15891
16071
  process.stdin.setEncoding("utf-8");
15892
16072
  process.stdin.on("data", (chunk) => {
15893
16073
  data += chunk;
15894
16074
  });
15895
- process.stdin.on("end", () => resolve12(data.trim()));
16075
+ process.stdin.on("end", () => resolve13(data.trim()));
15896
16076
  process.stdin.on("error", reject);
15897
16077
  });
15898
16078
  }
@@ -16607,9 +16787,9 @@ function getVersionCachePath(filename = CLI_CACHE_FILE) {
16607
16787
  }
16608
16788
  function readVersionCache(filename = CLI_CACHE_FILE) {
16609
16789
  try {
16610
- const path41 = getVersionCachePath(filename);
16611
- if (!existsSync3(path41)) return null;
16612
- const parsed = JSON.parse(readFileSync5(path41, "utf-8"));
16790
+ const path42 = getVersionCachePath(filename);
16791
+ if (!existsSync3(path42)) return null;
16792
+ const parsed = JSON.parse(readFileSync5(path42, "utf-8"));
16613
16793
  if (typeof parsed.lastCheck !== "number") return null;
16614
16794
  if (parsed.latest !== null && typeof parsed.latest !== "string") return null;
16615
16795
  return parsed;
@@ -16629,10 +16809,10 @@ function isVersionCacheStale(filename = CLI_CACHE_FILE, maxAgeMs = MAX_AGE_24H_M
16629
16809
  return Date.now() - cache.lastCheck > maxAgeMs;
16630
16810
  }
16631
16811
  function writeVersionCache(filename, cache) {
16632
- const path41 = getVersionCachePath(filename);
16633
- const dir = dirname6(path41);
16812
+ const path42 = getVersionCachePath(filename);
16813
+ const dir = dirname6(path42);
16634
16814
  if (!existsSync3(dir)) mkdirSync2(dir, { recursive: true });
16635
- writeFileSync2(path41, JSON.stringify(cache));
16815
+ writeFileSync2(path42, JSON.stringify(cache));
16636
16816
  }
16637
16817
  function touchVersionCache(filename) {
16638
16818
  writeVersionCache(filename, { lastCheck: Date.now(), latest: readVersionCache(filename)?.latest ?? null });
@@ -16671,14 +16851,14 @@ function parseFrontmatterVersion(content) {
16671
16851
  function findInstalledSkills(projectRoot, paths = SKILL_INSTALL_PATHS) {
16672
16852
  const found = [];
16673
16853
  for (const rel of paths) {
16674
- const path41 = join8(projectRoot, rel);
16675
- if (!existsSync4(path41)) continue;
16854
+ const path42 = join8(projectRoot, rel);
16855
+ if (!existsSync4(path42)) continue;
16676
16856
  let version = null;
16677
16857
  try {
16678
- version = parseFrontmatterVersion(readFileSync6(path41, "utf-8"));
16858
+ version = parseFrontmatterVersion(readFileSync6(path42, "utf-8"));
16679
16859
  } catch {
16680
16860
  }
16681
- found.push({ path: path41, version });
16861
+ found.push({ path: path42, version });
16682
16862
  }
16683
16863
  return found;
16684
16864
  }
@@ -17132,7 +17312,7 @@ async function validateToken(apiUrl, token) {
17132
17312
  }
17133
17313
  }
17134
17314
  function startCallbackServer(port, expectedState, timeoutMs = 12e4) {
17135
- return new Promise((resolve12, reject) => {
17315
+ return new Promise((resolve13, reject) => {
17136
17316
  const server = http.createServer((req, res) => {
17137
17317
  const url = new URL(req.url || "/", `http://127.0.0.1:${port}`);
17138
17318
  if (url.pathname === "/callback") {
@@ -17158,7 +17338,7 @@ function startCallbackServer(port, expectedState, timeoutMs = 12e4) {
17158
17338
  res.writeHead(200, { "Content-Type": "text/html" });
17159
17339
  res.end("<html><body><h2>Login successful!</h2><p>You can close this tab and return to your terminal.</p></body></html>");
17160
17340
  server.close();
17161
- resolve12({ code, port });
17341
+ resolve13({ code, port });
17162
17342
  } else {
17163
17343
  res.writeHead(400, { "Content-Type": "text/html" });
17164
17344
  res.end("<html><body><h2>Login failed</h2><p>No authorization code received</p></body></html>");
@@ -17370,10 +17550,10 @@ import * as readline2 from "readline";
17370
17550
  function prompt2(question, defaultValue) {
17371
17551
  const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
17372
17552
  const display = defaultValue ? `${question} [${defaultValue}]: ` : `${question}: `;
17373
- return new Promise((resolve12) => {
17553
+ return new Promise((resolve13) => {
17374
17554
  rl.question(display, (answer) => {
17375
17555
  rl.close();
17376
- resolve12(answer.trim() || defaultValue || "");
17556
+ resolve13(answer.trim() || defaultValue || "");
17377
17557
  });
17378
17558
  });
17379
17559
  }
@@ -17501,8 +17681,8 @@ async function tryOpenBrowser(url) {
17501
17681
  cmd = "xdg-open";
17502
17682
  args2 = [url];
17503
17683
  }
17504
- return new Promise((resolve12) => {
17505
- execFile(cmd, args2, (err) => resolve12(!err));
17684
+ return new Promise((resolve13) => {
17685
+ execFile(cmd, args2, (err) => resolve13(!err));
17506
17686
  });
17507
17687
  } catch {
17508
17688
  return false;
@@ -18452,17 +18632,17 @@ function writeResourceFileTree(resDir, files, root, log) {
18452
18632
  }
18453
18633
  const writtenPaths = /* @__PURE__ */ new Set();
18454
18634
  for (const file of files) {
18455
- const filePath = path12.join(resDir, file.path);
18456
- if (!filePath.startsWith(resDir + path12.sep) && filePath !== resDir) {
18635
+ const filePath2 = path12.join(resDir, file.path);
18636
+ if (!filePath2.startsWith(resDir + path12.sep) && filePath2 !== resDir) {
18457
18637
  console.warn(` Warning: skipping ${file.path} (path traversal detected)`);
18458
18638
  continue;
18459
18639
  }
18460
18640
  writtenPaths.add(file.path);
18461
18641
  const buf = file.content !== void 0 ? Buffer.from(file.content, "utf-8") : file.content_base64 ? Buffer.from(file.content_base64, "base64") : void 0;
18462
18642
  if (buf === void 0) continue;
18463
- if (fileHasBytes(filePath, buf)) continue;
18464
- if (writeFileNoFollow(resDir, filePath, buf)) {
18465
- log?.changed.push(path12.relative(root, filePath));
18643
+ if (fileHasBytes(filePath2, buf)) continue;
18644
+ if (writeFileNoFollow(resDir, filePath2, buf)) {
18645
+ log?.changed.push(path12.relative(root, filePath2));
18466
18646
  } else {
18467
18647
  console.warn(` Warning: skipping ${file.path} (destination escapes the resource folder via a symlink)`);
18468
18648
  writtenPaths.delete(file.path);
@@ -18493,15 +18673,15 @@ async function downloadBinaryFiles(resDir, files, root, log) {
18493
18673
  for (const file of files) {
18494
18674
  if (!file.download_url || file.content !== void 0) continue;
18495
18675
  try {
18496
- const filePath = path12.join(resDir, file.path);
18497
- if (!filePath.startsWith(resDir + path12.sep) && filePath !== resDir) {
18676
+ const filePath2 = path12.join(resDir, file.path);
18677
+ if (!filePath2.startsWith(resDir + path12.sep) && filePath2 !== resDir) {
18498
18678
  console.warn(` Warning: skipping ${file.path} (path traversal detected)`);
18499
18679
  continue;
18500
18680
  }
18501
18681
  if (file.hash) {
18502
18682
  try {
18503
- const st = fs10.lstatSync(filePath);
18504
- if (st.isFile() && !st.isSymbolicLink() && computeHash(fs10.readFileSync(filePath)) === file.hash) continue;
18683
+ const st = fs10.lstatSync(filePath2);
18684
+ if (st.isFile() && !st.isSymbolicLink() && computeHash(fs10.readFileSync(filePath2)) === file.hash) continue;
18505
18685
  } catch {
18506
18686
  }
18507
18687
  }
@@ -18511,10 +18691,10 @@ async function downloadBinaryFiles(resDir, files, root, log) {
18511
18691
  continue;
18512
18692
  }
18513
18693
  const buffer = Buffer.from(await response.arrayBuffer());
18514
- if (fileHasBytes(filePath, buffer)) continue;
18515
- if (writeFileNoFollow(resDir, filePath, buffer)) {
18694
+ if (fileHasBytes(filePath2, buffer)) continue;
18695
+ if (writeFileNoFollow(resDir, filePath2, buffer)) {
18516
18696
  count++;
18517
- log?.changed.push(path12.relative(root, filePath));
18697
+ log?.changed.push(path12.relative(root, filePath2));
18518
18698
  } else {
18519
18699
  console.warn(` Warning: skipping ${file.path} (destination escapes the resource folder via a symlink)`);
18520
18700
  }
@@ -19016,8 +19196,8 @@ function scanEvalYamlFiles(hubFolder, bytesByHash, unreadable) {
19016
19196
  }
19017
19197
  return evals;
19018
19198
  }
19019
- function collectEval(evals, seen, filePath, relPath, setName, hubFolder, bytesByHash, unreadable) {
19020
- const evalEntry = parseEvalYaml(filePath, relPath, setName, hubFolder, bytesByHash);
19199
+ function collectEval(evals, seen, filePath2, relPath, setName, hubFolder, bytesByHash, unreadable) {
19200
+ const evalEntry = parseEvalYaml(filePath2, relPath, setName, hubFolder, bytesByHash);
19021
19201
  if (!evalEntry) {
19022
19202
  unreadable(relPath, NOT_A_YAML_OBJECT);
19023
19203
  return;
@@ -19026,14 +19206,14 @@ function collectEval(evals, seen, filePath, relPath, setName, hubFolder, bytesBy
19026
19206
  if (seen.has(key)) {
19027
19207
  const where = setName ? `scenario set "${setName}"` : "root";
19028
19208
  throw expected(
19029
- `Duplicate eval at ${where}: "${evalEntry.name}" (in ${path15.basename(filePath)}). Each (name, scenario set) pair must be unique.`
19209
+ `Duplicate eval at ${where}: "${evalEntry.name}" (in ${path15.basename(filePath2)}). Each (name, scenario set) pair must be unique.`
19030
19210
  );
19031
19211
  }
19032
19212
  seen.add(key);
19033
19213
  evals.push(evalEntry);
19034
19214
  }
19035
- function parseEvalYaml(filePath, relPath, setName, hubFolder, bytesByHash) {
19036
- const content = fs13.readFileSync(filePath, "utf-8");
19215
+ function parseEvalYaml(filePath2, relPath, setName, hubFolder, bytesByHash) {
19216
+ const content = fs13.readFileSync(filePath2, "utf-8");
19037
19217
  let raw;
19038
19218
  try {
19039
19219
  raw = yaml7.load(content);
@@ -19045,7 +19225,7 @@ function parseEvalYaml(filePath, relPath, setName, hubFolder, bytesByHash) {
19045
19225
  }
19046
19226
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
19047
19227
  const data = raw;
19048
- const fileSlug = path15.basename(filePath, ".yaml");
19228
+ const fileSlug = path15.basename(filePath2, ".yaml");
19049
19229
  const evalName = typeof data.name === "string" && data.name.trim().length > 0 ? data.name : fileSlug;
19050
19230
  if (typeof data.agent !== "string" || data.agent.trim().length === 0) {
19051
19231
  throw expected(`Eval "${evalName}" in ${relPath}: missing required field "agent" (string).`);
@@ -19160,8 +19340,8 @@ function scanJourneyYamlFiles(hubFolder, bytesByHash, unreadable) {
19160
19340
  }
19161
19341
  return journeys;
19162
19342
  }
19163
- function parseJourneyYaml(filePath, relPath, hubFolder, bytesByHash) {
19164
- const content = fs13.readFileSync(filePath, "utf-8");
19343
+ function parseJourneyYaml(filePath2, relPath, hubFolder, bytesByHash) {
19344
+ const content = fs13.readFileSync(filePath2, "utf-8");
19165
19345
  let raw;
19166
19346
  try {
19167
19347
  raw = yaml7.load(content);
@@ -19173,7 +19353,7 @@ function parseJourneyYaml(filePath, relPath, hubFolder, bytesByHash) {
19173
19353
  }
19174
19354
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
19175
19355
  const data = raw;
19176
- const fileSlug = path15.basename(filePath, ".yaml");
19356
+ const fileSlug = path15.basename(filePath2, ".yaml");
19177
19357
  const journeyName = typeof data.name === "string" && data.name.trim().length > 0 ? data.name : fileSlug;
19178
19358
  if (typeof data.agent !== "string" || data.agent.trim().length === 0) {
19179
19359
  throw expected(`Journey "${journeyName}" in ${relPath}: missing required field "agent" (string).`);
@@ -19219,8 +19399,8 @@ function scanAgentYamlFiles(hubFolder, unreadable) {
19219
19399
  if (yamlFiles.length === 0) return [];
19220
19400
  const agents = [];
19221
19401
  for (const file of yamlFiles) {
19222
- const filePath = path15.join(agentsDir, file);
19223
- const content = readRealFileOrThrow(hubFolder, filePath) ?? "";
19402
+ const filePath2 = path15.join(agentsDir, file);
19403
+ const content = readRealFileOrThrow(hubFolder, filePath2) ?? "";
19224
19404
  let agent;
19225
19405
  try {
19226
19406
  agent = yaml7.load(content);
@@ -19325,8 +19505,8 @@ function perHubAgentsMd(hubFolderName) {
19325
19505
  ""
19326
19506
  ].join("\n");
19327
19507
  }
19328
- function writeIfAbsent(root, filePath, content) {
19329
- return createFileNoFollow(root, filePath, Buffer.from(content, "utf-8")) === "created" ? path16.basename(filePath) : null;
19508
+ function writeIfAbsent(root, filePath2, content) {
19509
+ return createFileNoFollow(root, filePath2, Buffer.from(content, "utf-8")) === "created" ? path16.basename(filePath2) : null;
19330
19510
  }
19331
19511
  var init_workspace_files = __esm({
19332
19512
  "src/lib/workspace-files.ts"() {
@@ -20156,12 +20336,12 @@ async function createDataClient(orgId) {
20156
20336
  return orgId2;
20157
20337
  }
20158
20338
  return {
20159
- async request(method, path41, body) {
20160
- const envelope = await api.dataRequest(method, path41, body, org);
20339
+ async request(method, path42, body, headers) {
20340
+ const envelope = await api.dataRequest(method, path42, body, org, headers);
20161
20341
  return envelope.data;
20162
20342
  },
20163
- async requestRaw(method, path41, body) {
20164
- const body_ = await api.dataRequest(method, path41, body, org);
20343
+ async requestRaw(method, path42, body) {
20344
+ const body_ = await api.dataRequest(method, path42, body, org);
20165
20345
  return body_;
20166
20346
  },
20167
20347
  async collectPages(makePath) {
@@ -21060,8 +21240,8 @@ function installEvalSignalHandlers(input) {
21060
21240
  let signalCount = 0;
21061
21241
  let disposed = false;
21062
21242
  let settle;
21063
- const settled = new Promise((resolve12) => {
21064
- settle = resolve12;
21243
+ const settled = new Promise((resolve13) => {
21244
+ settle = resolve13;
21065
21245
  });
21066
21246
  const listeners = /* @__PURE__ */ new Map();
21067
21247
  const dispose = () => {
@@ -21199,7 +21379,7 @@ var init_pacer = __esm({
21199
21379
  WINDOW_MS = 6e4;
21200
21380
  DEFAULT_RETRY_AFTER_SECONDS = 60;
21201
21381
  MAX_RATE_LIMITED_RETRIES = 5;
21202
- realSleep = (ms) => new Promise((resolve12) => setTimeout(resolve12, ms));
21382
+ realSleep = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
21203
21383
  Pacer = class {
21204
21384
  perMinute;
21205
21385
  now;
@@ -21313,11 +21493,11 @@ function classify(base, file, server) {
21313
21493
  if (known === void 0) return file === server ? "converged" : "conflict";
21314
21494
  return threeWay(file !== known, server !== known, file === server);
21315
21495
  }
21316
- function threeWay(fileChanged, serverChanged, agree) {
21496
+ function threeWay(fileChanged, serverChanged, agree2) {
21317
21497
  if (!fileChanged && !serverChanged) return "in_sync";
21318
21498
  if (!serverChanged) return "local";
21319
21499
  if (!fileChanged) return "remote";
21320
- return agree ? "converged" : "conflict";
21500
+ return agree2 ? "converged" : "conflict";
21321
21501
  }
21322
21502
  function createClientId(communityId, kind, localName2) {
21323
21503
  return uuidV5(communityId, `${kind}:${localName2}`);
@@ -21943,8 +22123,12 @@ var init_files = __esm({
21943
22123
 
21944
22124
  // src/communities/listing.ts
21945
22125
  function lineDiff(from, to) {
21946
- const a = from ? sanitizeTerminalText(from).split("\n") : [];
21947
- const b = to ? sanitizeTerminalText(to).split("\n") : [];
22126
+ return lineDiffOf(
22127
+ from ? sanitizeTerminalText(from).split("\n") : [],
22128
+ to ? sanitizeTerminalText(to).split("\n") : []
22129
+ );
22130
+ }
22131
+ function lineDiffOf(a, b) {
21948
22132
  if (a.length * b.length > 25e4) return [...a.map((l) => `- ${l}`), ...b.map((l) => `+ ${l}`)];
21949
22133
  const lcs = Array.from({ length: a.length + 1 }, () => new Array(b.length + 1).fill(0));
21950
22134
  for (let i2 = a.length - 1; i2 >= 0; i2--) {
@@ -25540,26 +25724,26 @@ __export(send_message_exports, {
25540
25724
  });
25541
25725
  import * as fs25 from "fs";
25542
25726
  import * as path36 from "path";
25543
- function statAttachment(filePath) {
25727
+ function statAttachment(filePath2) {
25544
25728
  let stat2;
25545
25729
  try {
25546
- stat2 = fs25.statSync(filePath);
25730
+ stat2 = fs25.statSync(filePath2);
25547
25731
  } catch {
25548
- console.error(`Error: file not found: ${filePath}`);
25732
+ console.error(`Error: file not found: ${filePath2}`);
25549
25733
  process.exit(1);
25550
25734
  }
25551
25735
  if (stat2.isDirectory()) {
25552
- console.error(`Error: not a file: ${filePath}`);
25736
+ console.error(`Error: not a file: ${filePath2}`);
25553
25737
  process.exit(1);
25554
25738
  }
25555
- return { filePath, size: stat2.size };
25739
+ return { filePath: filePath2, size: stat2.size };
25556
25740
  }
25557
- function readAttachment(filePath, size) {
25558
- const fileName = path36.basename(filePath);
25741
+ function readAttachment(filePath2, size) {
25742
+ const fileName = path36.basename(filePath2);
25559
25743
  const ext = path36.extname(fileName).replace(/^\./, "");
25560
25744
  return {
25561
25745
  file_name: fileName,
25562
- file_binary: fs25.readFileSync(filePath).toString("base64"),
25746
+ file_binary: fs25.readFileSync(filePath2).toString("base64"),
25563
25747
  file_size: size,
25564
25748
  ...ext && { file_extension: ext }
25565
25749
  };
@@ -25589,12 +25773,12 @@ async function sendMessageCommand(args2) {
25589
25773
  if (arg === "-c" || arg === "--conversation") {
25590
25774
  conversationId = args2[++i];
25591
25775
  } else if (arg === "-f" || arg === "--file") {
25592
- const filePath = args2[++i];
25593
- if (!filePath) {
25776
+ const filePath2 = args2[++i];
25777
+ if (!filePath2) {
25594
25778
  console.error("Error: --file requires a path");
25595
25779
  process.exit(1);
25596
25780
  }
25597
- filePaths.push(filePath);
25781
+ filePaths.push(filePath2);
25598
25782
  } else if (!arg.startsWith("-")) {
25599
25783
  message = arg;
25600
25784
  }
@@ -27384,7 +27568,7 @@ Timeout after ${timeoutSeconds}s${queuedSeconds > 0 ? ` (${queuedSeconds}s of it
27384
27568
  process.exit(1);
27385
27569
  }
27386
27570
  function sleep(ms) {
27387
- return new Promise((resolve12) => setTimeout(resolve12, ms));
27571
+ return new Promise((resolve13) => setTimeout(resolve13, ms));
27388
27572
  }
27389
27573
  function parseRunNumbers(raw) {
27390
27574
  if (!raw || raw.startsWith("--")) {
@@ -27741,15 +27925,15 @@ var init_caller_audio = __esm({
27741
27925
  }
27742
27926
  describe;
27743
27927
  async clipFor(line) {
27744
- const path41 = line.clip ? isAbsolute2(line.clip) ? line.clip : resolve10(this.planDir, line.clip) : this.dir ? join31(this.dir, `${line.n}.wav`) : null;
27745
- if (!path41) throw new Error(`Line ${line.n} has no clip: give --clips <dir>, or a "clip" for it in the plan.`);
27928
+ const path42 = line.clip ? isAbsolute2(line.clip) ? line.clip : resolve10(this.planDir, line.clip) : this.dir ? join31(this.dir, `${line.n}.wav`) : null;
27929
+ if (!path42) throw new Error(`Line ${line.n} has no clip: give --clips <dir>, or a "clip" for it in the plan.`);
27746
27930
  let buf;
27747
27931
  try {
27748
- buf = readFileSync17(path41);
27932
+ buf = readFileSync17(path42);
27749
27933
  } catch {
27750
- throw new Error(`Line ${line.n}'s clip ${path41} cannot be read.`);
27934
+ throw new Error(`Line ${line.n}'s clip ${path42} cannot be read.`);
27751
27935
  }
27752
- return parseWav(buf, path41);
27936
+ return parseWav(buf, path42);
27753
27937
  }
27754
27938
  };
27755
27939
  OPENAI_PCM_SAMPLE_RATE = 24e3;
@@ -27779,17 +27963,17 @@ ${text}`).digest("hex");
27779
27963
  return join31(this.cacheDir, `${key}.pcm`);
27780
27964
  }
27781
27965
  clipFor(line) {
27782
- const path41 = this.cachePath(line.say);
27783
- let pending = this.inFlight.get(path41);
27966
+ const path42 = this.cachePath(line.say);
27967
+ let pending = this.inFlight.get(path42);
27784
27968
  if (!pending) {
27785
- pending = this.readOrSynthesize(line, path41);
27786
- this.inFlight.set(path41, pending);
27969
+ pending = this.readOrSynthesize(line, path42);
27970
+ this.inFlight.set(path42, pending);
27787
27971
  }
27788
27972
  return pending;
27789
27973
  }
27790
- async readOrSynthesize(line, path41) {
27974
+ async readOrSynthesize(line, path42) {
27791
27975
  try {
27792
- return pcmClip(readFileSync17(path41));
27976
+ return pcmClip(readFileSync17(path42));
27793
27977
  } catch {
27794
27978
  }
27795
27979
  const res = await this.doFetch("https://api.openai.com/v1/audio/speech", {
@@ -27803,10 +27987,10 @@ ${text}`).digest("hex");
27803
27987
  }
27804
27988
  const buf = Buffer.from(await res.arrayBuffer());
27805
27989
  if (buf.length < 2) throw new Error(`OpenAI speech synthesis returned no audio for line ${line.n}.`);
27806
- mkdirSync12(dirname12(path41), { recursive: true });
27807
- const tmp = `${path41}.${process.pid}.tmp`;
27990
+ mkdirSync12(dirname12(path42), { recursive: true });
27991
+ const tmp = `${path42}.${process.pid}.tmp`;
27808
27992
  writeFileSync7(tmp, buf);
27809
- renameSync5(tmp, path41);
27993
+ renameSync5(tmp, path42);
27810
27994
  return pcmClip(buf);
27811
27995
  }
27812
27996
  };
@@ -27833,14 +28017,14 @@ async function loadWrtcRuntime(importPackage = () => import(WRTC_PACKAGE)) {
27833
28017
  function waitFor(ready, timeoutMs, clock = systemClock) {
27834
28018
  if (ready()) return Promise.resolve(true);
27835
28019
  const deadline = clock.now() + timeoutMs;
27836
- return new Promise((resolve12) => {
28020
+ return new Promise((resolve13) => {
27837
28021
  const timer = setInterval(() => {
27838
28022
  if (ready()) {
27839
28023
  clearInterval(timer);
27840
- resolve12(true);
28024
+ resolve13(true);
27841
28025
  } else if (clock.now() >= deadline) {
27842
28026
  clearInterval(timer);
27843
- resolve12(false);
28027
+ resolve13(false);
27844
28028
  }
27845
28029
  }, WAIT_POLL_MS);
27846
28030
  });
@@ -27955,8 +28139,8 @@ var init_call_media = __esm({
27955
28139
  * asked before every frame, answers true — the rest of the clip is then dropped.
27956
28140
  */
27957
28141
  play(clip, abort = () => false) {
27958
- return new Promise((resolve12) => {
27959
- this.queue.push({ samples: resample(clip, PUMP_SAMPLE_RATE), offset: 0, startedAtMs: null, abort, resolve: resolve12 });
28142
+ return new Promise((resolve13) => {
28143
+ this.queue.push({ samples: resample(clip, PUMP_SAMPLE_RATE), offset: 0, startedAtMs: null, abort, resolve: resolve13 });
27960
28144
  });
27961
28145
  }
27962
28146
  /** Send every frame the wall clock says is due. */
@@ -29168,7 +29352,7 @@ var init_runner = __esm({
29168
29352
  init_score();
29169
29353
  systemRunnerClock = {
29170
29354
  now: () => Date.now(),
29171
- sleep: (ms) => new Promise((resolve12) => setTimeout(resolve12, ms))
29355
+ sleep: (ms) => new Promise((resolve13) => setTimeout(resolve13, ms))
29172
29356
  };
29173
29357
  LONGEST_SPOKEN_LINE_MS = Math.ceil(EVAL_CALL_SPOKEN_LINE_MAX_CHARS / 15) * 1e3;
29174
29358
  DEFAULT_RUNNER_TIMINGS = {
@@ -29371,15 +29555,15 @@ function parseEvalCallArgs(args2) {
29371
29555
  if (parsed.jsonPath) checkReportPath(parsed.jsonPath);
29372
29556
  return parsed;
29373
29557
  }
29374
- function checkReportPath(path41) {
29375
- const target = resolve11(path41);
29558
+ function checkReportPath(path42) {
29559
+ const target = resolve11(path42);
29376
29560
  const dir = dirname13(target);
29377
- if (!existsSync16(dir) || !statSync8(dir).isDirectory()) fail(`--json ${path41}: the folder ${dir} does not exist.`);
29378
- if (existsSync16(target) && statSync8(target).isDirectory()) fail(`--json ${path41} is a folder; name a file.`);
29561
+ if (!existsSync16(dir) || !statSync8(dir).isDirectory()) fail(`--json ${path42}: the folder ${dir} does not exist.`);
29562
+ if (existsSync16(target) && statSync8(target).isDirectory()) fail(`--json ${path42} is a folder; name a file.`);
29379
29563
  try {
29380
29564
  accessSync(existsSync16(target) ? target : dir, fsConstants.W_OK);
29381
29565
  } catch {
29382
- fail(`--json ${path41} cannot be written here.`);
29566
+ fail(`--json ${path42} cannot be written here.`);
29383
29567
  }
29384
29568
  }
29385
29569
  function suiteExitCode(report2, runs, reportWritten) {
@@ -31074,10 +31258,12 @@ async function setConnectionCredentialCommand(args2) {
31074
31258
  console.log(`Setting ${orgMode ? `org credential "${parsed.orgCredential}"` : `${parsed.field}`} on ${target} connection "${conn.connection_display_name}"...`);
31075
31259
  if (isProduction) {
31076
31260
  await client.setProductionConnectionCredential(connectionId, body);
31261
+ console.log("Credential set.");
31077
31262
  } else {
31078
- await client.setPreviewConnectionCredential(connectionId, body);
31263
+ const result = await client.setPreviewConnectionCredential(connectionId, body);
31264
+ console.log("Credential set.");
31265
+ printWarnings(result.warnings ?? []);
31079
31266
  }
31080
- console.log("Credential set.");
31081
31267
  }
31082
31268
  var VALID_FIELDS;
31083
31269
  var init_set_connection_credential = __esm({
@@ -31088,6 +31274,7 @@ var init_set_connection_credential = __esm({
31088
31274
  init_repo_config();
31089
31275
  init_workspace();
31090
31276
  init_utils();
31277
+ init_push();
31091
31278
  VALID_FIELDS = ["api_key", "access_token", "password", "refresh_token", "webhook_secret_token", "username"];
31092
31279
  }
31093
31280
  });
@@ -35454,16 +35641,16 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
35454
35641
  ).option("--force", "Revoke even if the token appears to be in live use").action(async function(tokenId, opts) {
35455
35642
  const client = await createDataClient();
35456
35643
  const id = pathSegment(tokenId, "token id");
35457
- const path41 = (force) => `/v1/tokens/${id}${force ? "?force=true" : ""}`;
35644
+ const path42 = (force) => `/v1/tokens/${id}${force ? "?force=true" : ""}`;
35458
35645
  const format = outputFormat(this);
35459
35646
  const revoked = (forced) => printOutput({ token_id: tokenId, revoked: true, forced }, format);
35460
35647
  if (opts.force) {
35461
- await client.request("DELETE", path41(true));
35648
+ await client.request("DELETE", path42(true));
35462
35649
  revoked(true);
35463
35650
  return;
35464
35651
  }
35465
35652
  try {
35466
- await client.request("DELETE", path41(false));
35653
+ await client.request("DELETE", path42(false));
35467
35654
  revoked(false);
35468
35655
  } catch (err) {
35469
35656
  if (!(err instanceof ApiError) || err.status !== 409 || dataErrorDetails(err)?.requires_force !== true) {
@@ -35478,7 +35665,7 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
35478
35665
  console.error("Aborted.");
35479
35666
  return process.exit(1);
35480
35667
  }
35481
- await client.request("DELETE", path41(true));
35668
+ await client.request("DELETE", path42(true));
35482
35669
  revoked(true);
35483
35670
  }
35484
35671
  });
@@ -35626,9 +35813,9 @@ var init_base_tags = __esm({
35626
35813
 
35627
35814
  // src/data/commands/bases.ts
35628
35815
  import { Command as Command10 } from "commander";
35629
- function pageOf(path41, cursor) {
35630
- if (!cursor) return path41;
35631
- return `${path41}${path41.includes("?") ? "&" : "?"}cursor=${encodeURIComponent(cursor)}`;
35816
+ function pageOf(path42, cursor) {
35817
+ if (!cursor) return path42;
35818
+ return `${path42}${path42.includes("?") ? "&" : "?"}cursor=${encodeURIComponent(cursor)}`;
35632
35819
  }
35633
35820
  function parseEnum(flag, value, allowed) {
35634
35821
  if (value === void 0) return void 0;
@@ -35785,20 +35972,21 @@ function buildBasesCommand() {
35785
35972
  });
35786
35973
  bases.command("list-previews <origin-id>").description("List preview bases cloned from a base (production or preview)").action(async function(originId) {
35787
35974
  const client = await createDataClient();
35788
- const path41 = `/v1/${pathSegment(originId, "origin base id")}/previews`;
35975
+ const path42 = `/v1/${pathSegment(originId, "origin base id")}/previews`;
35789
35976
  printOutput(
35790
- await client.collectPages((cursor) => pageOf(path41, cursor)),
35977
+ await client.collectPages((cursor) => pageOf(path42, cursor)),
35791
35978
  outputFormat(this)
35792
35979
  );
35793
35980
  });
35794
- bases.command("promote <production-id>").description("Promote config from a preview base to production (human-only)").requiredOption("--from <preview-id>", "Source preview base id").option("--dry-run", "Show what would change without applying").option("--record-types <ids>", "Comma-separated record type ids to promote", splitList).option("--triggers <ids>", "Comma-separated trigger ids to promote", splitList).option("--inbound-webhooks <ids>", "Comma-separated inbound webhook ids to promote", splitList).action(async function(productionId, opts) {
35981
+ bases.command("promote <production-id>").description("Promote config from a preview base to production (human-only)").requiredOption("--from <preview-id>", "Source preview base id").option("--dry-run", "Show what would change without applying").option("--record-types <ids>", "Comma-separated record type ids to promote", splitList).option("--triggers <ids>", "Comma-separated trigger ids to promote", splitList).option("--inbound-webhooks <ids>", "Comma-separated inbound webhook ids to promote", splitList).option("--file-types <ids>", "Comma-separated file type ids to promote", splitList).action(async function(productionId, opts) {
35795
35982
  const client = await createDataClient();
35796
35983
  const data = await client.request("POST", `/v1/${pathSegment(productionId, "production base id")}/promote`, {
35797
35984
  source_base_id: opts.from,
35798
35985
  dry_run: opts.dryRun ?? false,
35799
35986
  record_types: opts.recordTypes,
35800
35987
  triggers: opts.triggers,
35801
- inbound_webhooks: opts.inboundWebhooks
35988
+ inbound_webhooks: opts.inboundWebhooks,
35989
+ file_types: opts.fileTypes
35802
35990
  });
35803
35991
  printOutput(data, outputFormat(this));
35804
35992
  const warnings = data?.source_credential_warnings ?? [];
@@ -35834,9 +36022,9 @@ function buildBasesCommand() {
35834
36022
  });
35835
36023
  bases.command("promotions <production-id>").description("List promotion history for a production base").action(async function(productionId) {
35836
36024
  const client = await createDataClient();
35837
- const path41 = `/v1/${pathSegment(productionId, "production base id")}/promotions`;
36025
+ const path42 = `/v1/${pathSegment(productionId, "production base id")}/promotions`;
35838
36026
  printOutput(
35839
- await client.collectPages((cursor) => pageOf(path41, cursor)),
36027
+ await client.collectPages((cursor) => pageOf(path42, cursor)),
35840
36028
  outputFormat(this)
35841
36029
  );
35842
36030
  });
@@ -35972,12 +36160,879 @@ var init_file_types = __esm({
35972
36160
  }
35973
36161
  });
35974
36162
 
36163
+ // src/data/files-sync/headers.ts
36164
+ function ifMatchValue(raw) {
36165
+ const hash = raw.trim().replace(/^W\//, "").replace(/^"(.*)"$/, "$1");
36166
+ if (!/^[\x21\x23-\x7e]+$/.test(hash)) {
36167
+ throw expected(
36168
+ `--if-match must be the file's content hash (its ETag, or content_sha256 from \`wayai files get --meta\`), got ${JSON.stringify(raw)}.`
36169
+ );
36170
+ }
36171
+ return `"${hash}"`;
36172
+ }
36173
+ function labelValue(raw) {
36174
+ if (raw.length === 0 || !/^[\x20-\x7e]+$/.test(raw)) {
36175
+ throw expected(
36176
+ `--label must be printable ASCII text (a request header cannot carry other characters intact), got ${JSON.stringify(raw)}.`
36177
+ );
36178
+ }
36179
+ return raw;
36180
+ }
36181
+ function metadataValue(value) {
36182
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
36183
+ throw expected("--metadata must be a JSON object.");
36184
+ }
36185
+ return JSON.stringify(value).replace(
36186
+ /[\u007f-￿]/g,
36187
+ (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`
36188
+ );
36189
+ }
36190
+ function fileWriteHeaders(opts) {
36191
+ const headers = {};
36192
+ if (opts.ifMatch !== void 0) headers["If-Match"] = ifMatchValue(opts.ifMatch);
36193
+ if (opts.label !== void 0) headers["X-Data-Label"] = labelValue(opts.label);
36194
+ if (opts.metadata !== void 0) headers["X-Data-Metadata"] = metadataValue(opts.metadata);
36195
+ return headers;
36196
+ }
36197
+ var init_headers = __esm({
36198
+ "src/data/files-sync/headers.ts"() {
36199
+ "use strict";
36200
+ init_expected();
36201
+ }
36202
+ });
36203
+
36204
+ // src/data/files-sync/local.ts
36205
+ import * as fs30 from "fs";
36206
+ import * as path41 from "path";
36207
+ function foldSegment(segment) {
36208
+ return segment.normalize("NFC").toLowerCase().replace(/[. ]+$/, "");
36209
+ }
36210
+ function foldPath(rel) {
36211
+ return rel.split("/").map(foldSegment).join("/");
36212
+ }
36213
+ function isOutsideSync(rel) {
36214
+ return rel.split("/").some((segment) => OUTSIDE_SYNC_FOLDED.has(foldSegment(segment)));
36215
+ }
36216
+ function isCleanPath(segments) {
36217
+ return segments.every((s) => s !== "" && s !== "." && s !== ".." && !/[\\\0]/.test(s));
36218
+ }
36219
+ function normalizeFolder(raw) {
36220
+ if (raw === void 0) return "";
36221
+ const folder = raw.replace(/\/+$/, "");
36222
+ if (folder === "") return "";
36223
+ if (folder.startsWith("/") || !isCleanPath(folder.split("/"))) {
36224
+ throw expected(
36225
+ `--folder must be a folder path inside the file type (e.g. hr or hr/benefits), got ${JSON.stringify(raw)}.`
36226
+ );
36227
+ }
36228
+ return folder;
36229
+ }
36230
+ function remotePath(folder, rel) {
36231
+ return folder ? `${folder}/${rel}` : rel;
36232
+ }
36233
+ function defaultDir(fileType, folder) {
36234
+ return path41.join(fileType, ...folder ? folder.split("/") : []);
36235
+ }
36236
+ function describeSync(r) {
36237
+ const where = r.folder ? `folder "${r.folder}"` : "the whole file type";
36238
+ return sanitizeTerminalText(`base "${r.base}", file type "${r.file_type}", ${where}`);
36239
+ }
36240
+ function isWindowsAlias(segment) {
36241
+ if (segment.includes(":")) return true;
36242
+ const dot = segment.lastIndexOf(".");
36243
+ const [stem, ext] = dot > 0 ? [segment.slice(0, dot), segment.slice(dot + 1)] : [segment, ""];
36244
+ return stem.length <= 8 && /~\d+$/.test(stem) && ext.length <= 3;
36245
+ }
36246
+ function assertRepresentable(rels, platform2 = process.platform) {
36247
+ const problems2 = [];
36248
+ const index = new CaseIndex();
36249
+ const all = new Set(rels);
36250
+ for (const rel of rels) {
36251
+ if (!isCleanPath(rel.split("/"))) {
36252
+ problems2.push(`"${rel}" cannot be a local file name`);
36253
+ continue;
36254
+ }
36255
+ if (platform2 === "win32" && rel.split("/").some(isWindowsAlias)) {
36256
+ problems2.push(`"${rel}" cannot be a local file name on Windows`);
36257
+ continue;
36258
+ }
36259
+ const twin = index.twinOf(rel);
36260
+ if (twin !== void 0) problems2.push(`"${twin}" and "${rel}" differ only in case, so they would share one name locally`);
36261
+ index.add(rel);
36262
+ const segments = rel.split("/");
36263
+ for (let i = 1; i < segments.length; i++) {
36264
+ const parent = segments.slice(0, i).join("/");
36265
+ if (all.has(parent)) problems2.push(`"${parent}" is both a file and a folder`);
36266
+ }
36267
+ }
36268
+ if (problems2.length > 0) {
36269
+ throw expected(
36270
+ sanitizeTerminalText(
36271
+ `The base holds paths this folder cannot hold as files, so nothing was pulled:
36272
+ ${problems2.join("\n ")}`
36273
+ )
36274
+ );
36275
+ }
36276
+ }
36277
+ function assertPushable(folder, rels, platform2 = process.platform) {
36278
+ const problems2 = [];
36279
+ for (const rel of rels) {
36280
+ const full = remotePath(folder, rel);
36281
+ if (full !== full.trim()) problems2.push(`"${rel}" starts or ends with a space`);
36282
+ else if (full.length > MAX_REMOTE_PATH) problems2.push(`"${rel}" makes a path longer than ${MAX_REMOTE_PATH} characters`);
36283
+ else if (!isCleanPath(rel.split("/"))) problems2.push(`"${rel}" cannot be a file path on the base`);
36284
+ else if (platform2 === "win32" && rel.split("/").some(isWindowsAlias)) {
36285
+ problems2.push(`"${rel}" cannot be a file name on Windows, where it can stand for another file`);
36286
+ }
36287
+ }
36288
+ if (problems2.length > 0) {
36289
+ throw expected(
36290
+ sanitizeTerminalText(`Rename these local files, so nothing was pushed:
36291
+ ${problems2.join("\n ")}`)
36292
+ );
36293
+ }
36294
+ }
36295
+ function syncDirExists(dir) {
36296
+ try {
36297
+ fs30.lstatSync(dir);
36298
+ return true;
36299
+ } catch {
36300
+ return false;
36301
+ }
36302
+ }
36303
+ function ensureSyncDir(dir) {
36304
+ if (!syncDirExists(dir)) {
36305
+ fs30.mkdirSync(dir, { recursive: true });
36306
+ return;
36307
+ }
36308
+ if (!fs30.lstatSync(dir).isDirectory()) throw symlinkRefusal(dir, "directory");
36309
+ }
36310
+ function readRecord(dir) {
36311
+ const text = readRealFileOrThrow(dir, path41.join(dir, RECORD_FILE));
36312
+ if (text === null) return null;
36313
+ let parsed;
36314
+ try {
36315
+ parsed = JSON.parse(text);
36316
+ } catch {
36317
+ parsed = void 0;
36318
+ }
36319
+ if (!isRecord3(parsed)) {
36320
+ throw expected(
36321
+ `${path41.join(dir, RECORD_FILE)} is not a record \`wayai files pull\` wrote. Restore it from version control, or move the folder aside and pull again.`
36322
+ );
36323
+ }
36324
+ return parsed;
36325
+ }
36326
+ function isRecord3(v) {
36327
+ if (typeof v !== "object" || v === null) return false;
36328
+ const r = v;
36329
+ if (typeof r.base !== "string" || typeof r.file_type !== "string" || typeof r.folder !== "string") return false;
36330
+ if (typeof r.files !== "object" || r.files === null || Array.isArray(r.files)) return false;
36331
+ return Object.values(r.files).every((f) => {
36332
+ const e = f;
36333
+ return typeof e === "object" && e !== null && typeof e.version === "number" && typeof e.content_sha256 === "string";
36334
+ });
36335
+ }
36336
+ function writeRecord(dir, record) {
36337
+ const files = {};
36338
+ for (const rel of Object.keys(record.files).sort()) files[rel] = syncedFile(record.files[rel]);
36339
+ const body = `${JSON.stringify({ base: record.base, file_type: record.file_type, folder: record.folder, files }, null, 2)}
36340
+ `;
36341
+ const tmp = path41.join(dir, `${RECORD_FILE}.tmp`);
36342
+ if (!writeFileNoFollow(dir, tmp, Buffer.from(body, "utf-8"))) throw symlinkRefusal(tmp, "file");
36343
+ fs30.renameSync(tmp, path41.join(dir, RECORD_FILE));
36344
+ }
36345
+ function syncedFile(f) {
36346
+ return { version: f.version, content_sha256: f.content_sha256 };
36347
+ }
36348
+ function readLocal(dir, rel) {
36349
+ const bytes = readFileNoFollow(dir, path41.join(dir, ...rel.split("/")));
36350
+ if (!bytes) throw symlinkRefusal(path41.join(dir, rel), "file");
36351
+ return bytes;
36352
+ }
36353
+ function scanLocal(dir) {
36354
+ const out = /* @__PURE__ */ new Map();
36355
+ if (!syncDirExists(dir)) return out;
36356
+ ensureSyncDir(dir);
36357
+ const walk = (absDir, relDir) => {
36358
+ for (const name of fs30.readdirSync(absDir).sort()) {
36359
+ const rel = relDir ? `${relDir}/${name}` : name;
36360
+ if (foldSegment(name) === ".git") {
36361
+ throw expected(
36362
+ `${sanitizeTerminalText(path41.join(dir, rel))} is a git repository inside the synced folder, which files pull and push do not sync into. Sync into a folder of its own \u2014 a folder inside a repository is fine; a repository's root, or a folder holding one, is not.`
36363
+ );
36364
+ }
36365
+ if (isOutsideSync(rel)) continue;
36366
+ const st = fs30.lstatSync(path41.join(absDir, name));
36367
+ if (st.isDirectory()) {
36368
+ walk(path41.join(absDir, name), rel);
36369
+ } else if (st.isFile()) {
36370
+ const bytes = readLocal(dir, rel);
36371
+ out.set(rel, { rel, content_sha256: computeHash(bytes), size: bytes.length });
36372
+ } else {
36373
+ throw symlinkRefusal(path41.join(dir, rel), "file or folder");
36374
+ }
36375
+ }
36376
+ };
36377
+ walk(dir, "");
36378
+ return out;
36379
+ }
36380
+ function matchesScan(dir, rel, scanned) {
36381
+ const abs = path41.join(dir, ...rel.split("/"));
36382
+ if (!syncDirExists(abs)) return scanned === void 0;
36383
+ if (scanned === void 0) return false;
36384
+ const bytes = readFileNoFollow(dir, abs);
36385
+ return bytes !== null && computeHash(bytes) === scanned.content_sha256;
36386
+ }
36387
+ function writeLocal(dir, rel, bytes) {
36388
+ const data = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
36389
+ if (!writeFileNoFollow(dir, path41.join(dir, ...rel.split("/")), data)) {
36390
+ throw symlinkRefusal(path41.join(dir, rel), "file");
36391
+ }
36392
+ }
36393
+ function removeLocal(dir, rel) {
36394
+ const abs = path41.join(dir, ...rel.split("/"));
36395
+ requireRealSubdirNoSymlink(dir, path41.dirname(abs), false);
36396
+ let st;
36397
+ try {
36398
+ st = fs30.lstatSync(abs);
36399
+ } catch {
36400
+ return;
36401
+ }
36402
+ if (!st.isFile()) throw symlinkRefusal(path41.join(dir, rel), "file");
36403
+ fs30.rmSync(abs);
36404
+ const root = path41.resolve(dir);
36405
+ for (let parent = path41.dirname(path41.resolve(abs)); parent !== root && isUnder(root, parent); parent = path41.dirname(parent)) {
36406
+ const names = fs30.readdirSync(parent);
36407
+ if (names.some((n) => n !== ".DS_Store")) break;
36408
+ for (const n of names) fs30.rmSync(path41.join(parent, n));
36409
+ fs30.rmdirSync(parent);
36410
+ }
36411
+ }
36412
+ function diskClash(dir, rel) {
36413
+ const segments = rel.split("/");
36414
+ let abs = dir;
36415
+ for (let i = 0; i < segments.length; i++) {
36416
+ let names;
36417
+ try {
36418
+ names = fs30.readdirSync(abs);
36419
+ } catch {
36420
+ return void 0;
36421
+ }
36422
+ const want = foldSegment(segments[i]);
36423
+ const twin = names.find((n) => n !== segments[i] && foldSegment(n) === want);
36424
+ if (twin !== void 0) return { reason: "case_twin", other: [...segments.slice(0, i), twin].join("/") };
36425
+ if (!names.includes(segments[i])) return void 0;
36426
+ abs = path41.join(abs, segments[i]);
36427
+ const isDir = fs30.lstatSync(abs).isDirectory();
36428
+ const here2 = segments.slice(0, i + 1).join("/");
36429
+ if (i < segments.length - 1 && !isDir) return { reason: "file_folder", other: here2 };
36430
+ if (i === segments.length - 1 && isDir) return { reason: "file_folder", other: `${here2}/` };
36431
+ }
36432
+ return void 0;
36433
+ }
36434
+ var RECORD_FILE, OUTSIDE_SYNC, OUTSIDE_SYNC_FOLDED, CaseIndex, MAX_REMOTE_PATH;
36435
+ var init_local = __esm({
36436
+ "src/data/files-sync/local.ts"() {
36437
+ "use strict";
36438
+ init_expected();
36439
+ init_resource_files();
36440
+ init_fs_safety();
36441
+ init_terminal_output();
36442
+ RECORD_FILE = ".wayai-files.json";
36443
+ OUTSIDE_SYNC = [RECORD_FILE, `${RECORD_FILE}.tmp`, ".git", ".DS_Store"];
36444
+ OUTSIDE_SYNC_FOLDED = new Set(OUTSIDE_SYNC.map((n) => foldSegment(n)));
36445
+ CaseIndex = class {
36446
+ bySpelling = /* @__PURE__ */ new Map();
36447
+ constructor(rels = []) {
36448
+ for (const rel of rels) this.add(rel);
36449
+ }
36450
+ add(rel) {
36451
+ const segments = rel.split("/");
36452
+ for (let i = 1; i <= segments.length; i++) {
36453
+ const prefix = segments.slice(0, i).join("/");
36454
+ const key = foldPath(prefix);
36455
+ if (!this.bySpelling.has(key)) this.bySpelling.set(key, prefix);
36456
+ }
36457
+ }
36458
+ /**
36459
+ * The spelling already indexed for a folder or file of `rel` that differs from `rel`'s own only
36460
+ * by case or normalization — the entry `rel` would land in on a case-insensitive filesystem.
36461
+ */
36462
+ twinOf(rel) {
36463
+ const segments = rel.split("/");
36464
+ for (let i = 1; i <= segments.length; i++) {
36465
+ const prefix = segments.slice(0, i).join("/");
36466
+ const known = this.bySpelling.get(foldPath(prefix));
36467
+ if (known !== void 0 && known !== prefix) return known;
36468
+ }
36469
+ return void 0;
36470
+ }
36471
+ };
36472
+ MAX_REMOTE_PATH = 1024;
36473
+ }
36474
+ });
36475
+
36476
+ // src/data/files-sync/plan.ts
36477
+ function inStep(b, r) {
36478
+ return b !== void 0 && b.content_sha256 === r.content_sha256 && b.version === r.version;
36479
+ }
36480
+ function allPaths({ synced: synced2, local, remote }) {
36481
+ return [.../* @__PURE__ */ new Set([...Object.keys(synced2), ...local.keys(), ...remote.keys()])].sort();
36482
+ }
36483
+ function planPush(input) {
36484
+ const plan = {
36485
+ steps: [],
36486
+ adopt: [],
36487
+ forget: [],
36488
+ conflicts: [],
36489
+ changedOnBase: [],
36490
+ deletedOnBase: [],
36491
+ onlyOnBase: [],
36492
+ keptOnBase: []
36493
+ };
36494
+ const deletes = [];
36495
+ const writes = [];
36496
+ for (const rel of allPaths(input)) {
36497
+ const b = input.synced[rel];
36498
+ const l = input.local.get(rel);
36499
+ const r = input.remote.get(rel);
36500
+ if (l && r && l.content_sha256 === r.content_sha256) {
36501
+ if (!inStep(b, r)) plan.adopt.push(r);
36502
+ continue;
36503
+ }
36504
+ if (b) {
36505
+ if (l) {
36506
+ if (l.content_sha256 === b.content_sha256) {
36507
+ if (!r) plan.deletedOnBase.push(rel);
36508
+ else if (r.content_sha256 !== b.content_sha256) plan.changedOnBase.push(rel);
36509
+ } else if (!r) {
36510
+ plan.conflicts.push({ rel, reason: "deleted_on_base" });
36511
+ } else if (r.content_sha256 !== b.content_sha256) {
36512
+ plan.conflicts.push({ rel, reason: "changed_on_base" });
36513
+ } else {
36514
+ writes.push({ op: "update", rel, local: l, remote: r, ifMatch: b.content_sha256 });
36515
+ }
36516
+ } else if (!r) {
36517
+ plan.forget.push(rel);
36518
+ } else if (!input.prune) {
36519
+ plan.keptOnBase.push(rel);
36520
+ } else if (r.content_sha256 !== b.content_sha256) {
36521
+ plan.conflicts.push({ rel, reason: "changed_on_base" });
36522
+ } else {
36523
+ deletes.push({ op: "delete", rel, remote: r, ifMatch: b.content_sha256 });
36524
+ }
36525
+ } else if (l) {
36526
+ if (r) plan.conflicts.push({ rel, reason: "exists_on_base" });
36527
+ else writes.push({ op: "create", rel, local: l });
36528
+ } else if (r) {
36529
+ plan.onlyOnBase.push(rel);
36530
+ }
36531
+ }
36532
+ const full = (rel) => remotePath(input.folder ?? "", rel);
36533
+ const deleted = new Set(deletes.map((d) => d.rel));
36534
+ const onBase = new BaseNames([
36535
+ ...[...input.remote.keys()].filter((rel) => !deleted.has(rel)).map(full),
36536
+ ...input.elsewhere ?? []
36537
+ ]);
36538
+ const freed = new BaseNames([...deleted].map(full));
36539
+ const kept = [];
36540
+ for (const step of writes) {
36541
+ if (step.op === "create") {
36542
+ const clash = onBase.clash(full(step.rel));
36543
+ if (clash !== void 0) {
36544
+ plan.conflicts.push({ rel: step.rel, ...clash });
36545
+ continue;
36546
+ }
36547
+ const after = freed.clash(full(step.rel)) === void 0 ? [] : [...deleted].flatMap((d) => {
36548
+ const held = new BaseNames([full(d)]).clash(full(step.rel));
36549
+ return held === void 0 ? [] : [{ rel: d, reason: held.reason }];
36550
+ });
36551
+ kept.push(after.length === 0 ? step : { ...step, after });
36552
+ } else {
36553
+ kept.push(step);
36554
+ }
36555
+ onBase.add(full(step.rel));
36556
+ }
36557
+ plan.steps = [...deletes, ...kept];
36558
+ return plan;
36559
+ }
36560
+ function planPull(input) {
36561
+ const plan = { writes: [], removes: [], adopt: [], forget: [], kept: [], conflicts: [], replacedLocal: [] };
36562
+ const { overwrite } = input;
36563
+ const take = (rel, r, replacesLocal) => {
36564
+ plan.writes.push({ rel, remote: r });
36565
+ if (replacesLocal) plan.replacedLocal.push(rel);
36566
+ };
36567
+ for (const rel of allPaths(input)) {
36568
+ const b = input.synced[rel];
36569
+ const l = input.local.get(rel);
36570
+ const r = input.remote.get(rel);
36571
+ if (r) {
36572
+ if (l && l.content_sha256 === r.content_sha256) {
36573
+ if (!inStep(b, r)) plan.adopt.push(r);
36574
+ continue;
36575
+ }
36576
+ const localUnchanged = b !== void 0 && l !== void 0 && l.content_sha256 === b.content_sha256;
36577
+ if (localUnchanged || !b && !l) {
36578
+ take(rel, r, false);
36579
+ continue;
36580
+ }
36581
+ if (overwrite) {
36582
+ take(rel, r, true);
36583
+ } else if (!b) {
36584
+ plan.conflicts.push({ rel, reason: "exists_locally" });
36585
+ } else if (r.content_sha256 === b.content_sha256) {
36586
+ plan.kept.push({ rel, reason: l ? "edited" : "deleted" });
36587
+ } else {
36588
+ plan.conflicts.push({ rel, reason: l ? "both_changed" : "deleted_locally" });
36589
+ }
36590
+ } else if (b) {
36591
+ if (!l) {
36592
+ plan.forget.push(rel);
36593
+ } else if (l.content_sha256 === b.content_sha256 || overwrite) {
36594
+ plan.removes.push(rel);
36595
+ if (l.content_sha256 !== b.content_sha256) plan.replacedLocal.push(rel);
36596
+ } else {
36597
+ plan.conflicts.push({ rel, reason: "deleted_on_base" });
36598
+ }
36599
+ }
36600
+ }
36601
+ return plan;
36602
+ }
36603
+ var BaseNames;
36604
+ var init_plan = __esm({
36605
+ "src/data/files-sync/plan.ts"() {
36606
+ "use strict";
36607
+ init_local();
36608
+ BaseNames = class {
36609
+ cases = new CaseIndex();
36610
+ files = /* @__PURE__ */ new Set();
36611
+ /** Each folder a path sits in, with one path in it to name. */
36612
+ folders = /* @__PURE__ */ new Map();
36613
+ constructor(paths = []) {
36614
+ for (const p of paths) this.add(p);
36615
+ }
36616
+ add(path42) {
36617
+ this.cases.add(path42);
36618
+ this.files.add(path42);
36619
+ const segments = path42.split("/");
36620
+ for (let i = 1; i < segments.length; i++) {
36621
+ const folder = segments.slice(0, i).join("/");
36622
+ if (!this.folders.has(folder)) this.folders.set(folder, path42);
36623
+ }
36624
+ }
36625
+ /** The path `path` would collide with, and how; undefined when it collides with none. */
36626
+ clash(path42) {
36627
+ const twin = this.cases.twinOf(path42);
36628
+ if (twin !== void 0) return { reason: "case_twin", other: twin };
36629
+ const segments = path42.split("/");
36630
+ for (let i = 1; i < segments.length; i++) {
36631
+ const folder = segments.slice(0, i).join("/");
36632
+ if (this.files.has(folder)) return { reason: "file_folder", other: folder };
36633
+ }
36634
+ const inside = this.folders.get(path42);
36635
+ return inside === void 0 ? void 0 : { reason: "file_folder", other: inside };
36636
+ }
36637
+ };
36638
+ }
36639
+ });
36640
+
36641
+ // src/data/files-sync/sync.ts
36642
+ function filesSyncRequestsPerMinute() {
36643
+ const budget = getEndpointConfig(`${DATA_PROXY_PREFIX}/files`)?.userLimit;
36644
+ return budget ? Math.max(1, Math.floor(budget * 4 / 5)) : 60;
36645
+ }
36646
+ async function openRemote2() {
36647
+ const client = await createDataClient();
36648
+ const perMinute = filesSyncRequestsPerMinute();
36649
+ const pacer = new Pacer({
36650
+ perMinute,
36651
+ onWait: (ms, reason) => console.error(
36652
+ reason === "paced" ? ` Pacing at ${perMinute} requests a minute: waiting ${Math.ceil(ms / 1e3)} s.` : ` The data request budget is spent (your other commands and the web console share it): waiting ${Math.ceil(ms / 1e3)} s.`
36653
+ )
36654
+ });
36655
+ return {
36656
+ request: (method, path42, body, headers) => pacer.run(() => client.request(method, path42, body, headers)),
36657
+ upload: (path42, bytes, contentType, headers) => pacer.run(() => client.upload(path42, bytes, contentType, headers)),
36658
+ download: (path42) => pacer.run(() => client.download(path42))
36659
+ };
36660
+ }
36661
+ function filesRoot(t) {
36662
+ return `/v1/${pathSegment(t.base, "--base")}/files/${pathSegment(t.file_type, "file_type")}`;
36663
+ }
36664
+ function filePath(t, rel) {
36665
+ return `${filesRoot(t)}/${pathSegments(remotePath(t.folder, rel))}`;
36666
+ }
36667
+ function pullCommand2(t, dir, overwrite = false) {
36668
+ const folder = t.folder ? ` --folder ${t.folder}` : "";
36669
+ const dirFlag = dir === void 0 ? "" : ` --dir ${dir}`;
36670
+ return sanitizeTerminalText(`wayai files pull ${t.file_type} --base ${t.base}${folder}${dirFlag}${overwrite ? " --overwrite" : ""}`);
36671
+ }
36672
+ function resolveSync(opts) {
36673
+ pathSegment(opts.base, "--base");
36674
+ pathSegment(opts.fileType, "file_type");
36675
+ const target = { base: opts.base, file_type: opts.fileType, folder: normalizeFolder(opts.folder) };
36676
+ const dir = opts.dir ?? defaultDir(target.file_type, target.folder);
36677
+ const existing = syncDirExists(dir) ? readRecord(dir) : null;
36678
+ if (existing && (existing.base !== target.base || existing.file_type !== target.file_type || existing.folder !== target.folder)) {
36679
+ throw expected(
36680
+ `${sanitizeTerminalText(dir)} was pulled from ${describeSync(existing)}, not ${describeSync(target)}. Its recorded versions are that base's, so they cannot check writes to another: name that sync, or use another --dir.`
36681
+ );
36682
+ }
36683
+ return { target, dir, existing };
36684
+ }
36685
+ async function listFiles(client, t, prefix) {
36686
+ const rows = [];
36687
+ for (let page = 0; ; page++) {
36688
+ if (page === MAX_LIST_PAGES) {
36689
+ throw expected(`The listing of ${describeSync(t)} did not end after ${MAX_LIST_PAGES} pages. Sync a narrower --folder.`);
36690
+ }
36691
+ const qs = new URLSearchParams({ limit: String(LIST_PAGE), offset: String(page * LIST_PAGE) });
36692
+ if (prefix) qs.set("prefix", prefix);
36693
+ const pageRows = await client.request("GET", `${filesRoot(t)}?${qs}`) ?? [];
36694
+ for (const row of pageRows) if (row.path.startsWith(prefix)) rows.push(row);
36695
+ if (pageRows.length < LIST_PAGE) return rows;
36696
+ }
36697
+ }
36698
+ async function readBase(t) {
36699
+ const client = await openRemote2();
36700
+ try {
36701
+ await client.request("GET", `/v1/${pathSegment(t.base, "--base")}/file-types/${pathSegment(t.file_type, "file_type")}`);
36702
+ } catch (err) {
36703
+ if (err instanceof ApiError && err.status === 404) {
36704
+ throw expected(sanitizeTerminalText(`Base "${t.base}" has no file type "${t.file_type}".`));
36705
+ }
36706
+ throw err;
36707
+ }
36708
+ const remote = /* @__PURE__ */ new Map();
36709
+ const excluded = [];
36710
+ const prefix = t.folder ? `${t.folder}/` : "";
36711
+ for (const row of await listFiles(client, t, prefix)) {
36712
+ const rel = row.path.slice(prefix.length);
36713
+ if (isOutsideSync(rel)) {
36714
+ excluded.push(rel);
36715
+ continue;
36716
+ }
36717
+ remote.set(rel, {
36718
+ rel,
36719
+ version: row.version,
36720
+ content_sha256: row.content_sha256,
36721
+ content_type: row.content_type || "application/octet-stream",
36722
+ size: row.size ?? 0
36723
+ });
36724
+ }
36725
+ return { client, remote, excluded };
36726
+ }
36727
+ function isNotFound(err) {
36728
+ return err instanceof ApiError && err.status === 404;
36729
+ }
36730
+ async function agree(question, yes) {
36731
+ if (yes) return true;
36732
+ if (!isInteractive()) {
36733
+ throw expected(`${question.trim().replace(/\?$/, "")}: there is no terminal to ask, so pass -y to go ahead.`);
36734
+ }
36735
+ return confirm(question);
36736
+ }
36737
+ function isConflict(err) {
36738
+ return err instanceof ApiError && (err.status === 409 || err.status === 412);
36739
+ }
36740
+ function conflictLine(c, texts) {
36741
+ return `${safe(c.rel)}: ${texts[c.reason]}${c.other === void 0 ? "" : ` "${safe(c.other)}"`}`;
36742
+ }
36743
+ function remedy(conflicts, overwriteCommand) {
36744
+ const isClash = (c) => c.reason === "case_twin" || c.reason === "file_folder";
36745
+ const parts = [];
36746
+ if (conflicts.some((c) => !isClash(c))) {
36747
+ parts.push(`take the base's copies with \`${overwriteCommand}\` (commit yours first to merge them)`);
36748
+ }
36749
+ if (conflicts.some(isClash)) {
36750
+ parts.push("rename or remove one path of each pair that differs only in case or is both a file and a folder (--overwrite cannot settle those)");
36751
+ }
36752
+ return parts.join("; ");
36753
+ }
36754
+ async function pullFiles(opts) {
36755
+ const { target, dir, existing } = resolveSync(opts);
36756
+ const { client, remote, excluded } = await readBase(target);
36757
+ assertRepresentable([...remote.keys()]);
36758
+ const local = scanLocal(dir);
36759
+ const plan = planPull({ synced: existing?.files ?? {}, local, remote, overwrite: opts.overwrite });
36760
+ if (plan.replacedLocal.length > 0) {
36761
+ console.log("These local changes would be replaced with the base's copies:");
36762
+ for (const rel of plan.replacedLocal) console.log(` ${safe(rel)}`);
36763
+ if (!await agree(`Replace ${plan.replacedLocal.length} locally changed file(s)?`, opts.yes)) {
36764
+ console.log("Cancelled.");
36765
+ return;
36766
+ }
36767
+ }
36768
+ ensureSyncDir(dir);
36769
+ const record = { ...target, files: { ...existing?.files ?? {} } };
36770
+ for (const rel of plan.forget) delete record.files[rel];
36771
+ for (const r of plan.adopt) record.files[r.rel] = syncedFile(r);
36772
+ const conflicts = [...plan.conflicts];
36773
+ const changes = [];
36774
+ const changedWhilePulling = [];
36775
+ try {
36776
+ for (const rel of plan.removes) {
36777
+ if (!matchesScan(dir, rel, local.get(rel))) {
36778
+ conflicts.push({ rel, reason: "edited_while_pulling" });
36779
+ continue;
36780
+ }
36781
+ removeLocal(dir, rel);
36782
+ delete record.files[rel];
36783
+ changes.push(`${MARK.delete} ${safe(rel)}`);
36784
+ }
36785
+ for (const w of plan.writes) {
36786
+ const clash = diskClash(dir, w.rel);
36787
+ if (clash !== void 0) {
36788
+ conflicts.push({ rel: w.rel, ...clash });
36789
+ continue;
36790
+ }
36791
+ const path42 = filePath(target, w.rel);
36792
+ let bytes;
36793
+ let version = w.remote.version;
36794
+ try {
36795
+ bytes = (await client.download(path42)).bytes;
36796
+ if (computeHash(bytes) !== w.remote.content_sha256) {
36797
+ const meta = await client.request("GET", `${path42}?meta=1`);
36798
+ if (meta?.content_sha256 !== computeHash(bytes)) {
36799
+ changedWhilePulling.push(w.rel);
36800
+ continue;
36801
+ }
36802
+ version = meta.version;
36803
+ }
36804
+ } catch (err) {
36805
+ if (!isNotFound(err)) throw err;
36806
+ changedWhilePulling.push(w.rel);
36807
+ continue;
36808
+ }
36809
+ if (!matchesScan(dir, w.rel, local.get(w.rel))) {
36810
+ conflicts.push({ rel: w.rel, reason: "edited_while_pulling" });
36811
+ continue;
36812
+ }
36813
+ const hash = computeHash(bytes);
36814
+ writeLocal(dir, w.rel, bytes);
36815
+ record.files[w.rel] = { version, content_sha256: hash };
36816
+ changes.push(`${local.has(w.rel) ? MARK.update : MARK.create} ${safe(w.rel)}`);
36817
+ }
36818
+ } finally {
36819
+ writeRecord(dir, record);
36820
+ }
36821
+ const count = Object.keys(record.files).length;
36822
+ console.log(sanitizeTerminalText(`Pulled ${describeSync(target)} \u2192 ${dir} (${count} file${count === 1 ? "" : "s"}).`));
36823
+ printSection("Changes:", changes);
36824
+ printSection("Kept \u2014 your local changes:", plan.kept.map((k) => `${safe(k.rel)}: ${PULL_KEPT[k.reason]}`));
36825
+ printSection(
36826
+ `Conflicts \u2014 your copy is kept; to settle them, ${remedy(conflicts, pullCommand2(target, opts.dir, true))}:`,
36827
+ conflicts.map((c) => conflictLine(c, PULL_CONFLICT))
36828
+ );
36829
+ printSection("Changed or deleted on the base while pulling \u2014 left as is; pull again to take it:", changedWhilePulling.map(safe));
36830
+ printSection(`Not synced \u2014 names a synced folder leaves out (${OUTSIDE_SYNC.join(", ")}):`, excluded.map(safe));
36831
+ }
36832
+ function isTextType(contentType) {
36833
+ const ct = contentType.split(";")[0].trim().toLowerCase();
36834
+ return ct.startsWith("text/") || /^application\/(json|xml|yaml|x-yaml|javascript|x-ndjson)$/.test(ct) || /\+(json|xml)$/.test(ct);
36835
+ }
36836
+ function changedLines(before, after) {
36837
+ const a = sanitizeTerminalText(before).split("\n");
36838
+ const b = sanitizeTerminalText(after).split("\n");
36839
+ let start = 0;
36840
+ while (start < a.length && start < b.length && a[start] === b[start]) start++;
36841
+ let end = 0;
36842
+ while (end < a.length - start && end < b.length - start && a[a.length - 1 - end] === b[b.length - 1 - end]) end++;
36843
+ return lineDiffOf(a.slice(start, a.length - end), b.slice(start, b.length - end));
36844
+ }
36845
+ async function describeSteps(client, t, dir, steps) {
36846
+ const lines = [];
36847
+ for (const step of steps) {
36848
+ const rel = safe(step.rel);
36849
+ if (step.op === "create") {
36850
+ lines.push(`${MARK.create} ${rel} (new, ${step.local.size} bytes)`);
36851
+ } else if (step.op === "delete") {
36852
+ lines.push(`${MARK.delete} ${rel} (delete)`);
36853
+ } else {
36854
+ lines.push(`${MARK.update} ${rel}`);
36855
+ if (!isTextType(step.remote.content_type) || step.remote.size > MAX_DIFF_BYTES || step.local.size > MAX_DIFF_BYTES) {
36856
+ lines.push(` (content changed: ${step.remote.size} \u2192 ${step.local.size} bytes)`);
36857
+ continue;
36858
+ }
36859
+ let bytes;
36860
+ try {
36861
+ bytes = (await client.download(filePath(t, step.rel))).bytes;
36862
+ } catch (err) {
36863
+ if (!isNotFound(err)) throw err;
36864
+ lines.push(" (deleted on the base since it was listed)");
36865
+ continue;
36866
+ }
36867
+ const before = Buffer.from(bytes).toString("utf-8");
36868
+ const after = readLocal(dir, step.rel).toString("utf-8");
36869
+ for (const line of changedLines(before, after)) lines.push(` ${line}`);
36870
+ }
36871
+ }
36872
+ return lines;
36873
+ }
36874
+ function printPushNotes(plan) {
36875
+ printSection("Changed on the base since your last pull \u2014 left as is; pull to take it:", plan.changedOnBase.map(safe));
36876
+ printSection("Deleted on the base since your last pull \u2014 left as is; pull to remove your copy:", plan.deletedOnBase.map(safe));
36877
+ printSection("On the base, not in your files \u2014 left as is; pull to fetch it:", plan.onlyOnBase.map(safe));
36878
+ printSection("Deleted in your files \u2014 kept on the base; push with --prune to delete it:", plan.keptOnBase.map(safe));
36879
+ }
36880
+ async function pushFiles(opts) {
36881
+ const label = opts.label === void 0 ? void 0 : labelValue(opts.label);
36882
+ const { target, dir, existing } = resolveSync(opts);
36883
+ if (!existing) {
36884
+ throw expected(
36885
+ `${sanitizeTerminalText(dir)} has no record of a pull (${RECORD_FILE}), so there is nothing to check a push against. Run \`${pullCommand2(target, opts.dir)}\` first; a file type with no files pulls an empty record.`
36886
+ );
36887
+ }
36888
+ const local = scanLocal(dir);
36889
+ assertPushable(target.folder, [...local.keys()]);
36890
+ const { client, remote } = await readBase(target);
36891
+ let plan = planPush({ synced: existing.files, local, remote, prune: opts.prune });
36892
+ if (target.folder && plan.steps.some((s) => s.op === "create")) {
36893
+ const prefix = `${target.folder}/`;
36894
+ const elsewhere = (await listFiles(client, target, "")).map((r) => r.path).filter((p) => !p.startsWith(prefix));
36895
+ plan = planPush({ synced: existing.files, local, remote, prune: opts.prune, folder: target.folder, elsewhere });
36896
+ }
36897
+ const conflicts = [...plan.conflicts];
36898
+ console.log(sanitizeTerminalText(`Push ${dir} \u2192 ${describeSync(target)}`));
36899
+ printSection("Changes:", await describeSteps(client, target, dir, plan.steps));
36900
+ printPushNotes(plan);
36901
+ printSection("Conflicts \u2014 not pushed:", conflicts.map((c) => conflictLine(c, PUSH_CONFLICT)));
36902
+ if (opts.dryRun) {
36903
+ console.log("\nDry run \u2014 nothing pushed.");
36904
+ finishWithConflicts(target, opts.dir, conflicts);
36905
+ return;
36906
+ }
36907
+ const record = { ...existing, files: { ...existing.files } };
36908
+ for (const r of plan.adopt) record.files[r.rel] = syncedFile(r);
36909
+ for (const rel of plan.forget) delete record.files[rel];
36910
+ if (plan.adopt.length > 0 || plan.forget.length > 0) writeRecord(dir, record);
36911
+ if (plan.steps.length === 0) {
36912
+ if (conflicts.length === 0) console.log(`
36913
+ Nothing to push \u2014 the base already has every change in ${sanitizeTerminalText(dir)}.`);
36914
+ finishWithConflicts(target, opts.dir, conflicts);
36915
+ return;
36916
+ }
36917
+ const n = plan.steps.length;
36918
+ if (!await agree(`
36919
+ Push ${n} change${n === 1 ? "" : "s"} to ${describeSync(target)}?`, opts.yes)) {
36920
+ console.log("Cancelled.");
36921
+ return;
36922
+ }
36923
+ let pushed = 0;
36924
+ const refusedDeletes = /* @__PURE__ */ new Set();
36925
+ for (const step of plan.steps) {
36926
+ const path42 = filePath(target, step.rel);
36927
+ const blockedBy = step.op === "create" ? step.after?.find((d) => refusedDeletes.has(d.rel)) : void 0;
36928
+ if (blockedBy !== void 0) {
36929
+ const conflict = { rel: step.rel, reason: blockedBy.reason, other: blockedBy.rel };
36930
+ conflicts.push(conflict);
36931
+ console.log(` ! ${conflictLine(conflict, PUSH_CONFLICT)}`);
36932
+ continue;
36933
+ }
36934
+ try {
36935
+ if (step.op === "delete") {
36936
+ await client.request("DELETE", path42, void 0, fileWriteHeaders({ ifMatch: step.ifMatch }));
36937
+ delete record.files[step.rel];
36938
+ } else {
36939
+ const bytes = readLocal(dir, step.rel);
36940
+ if (computeHash(bytes) !== step.local.content_sha256) {
36941
+ throw expected(`${safe(step.rel)} changed while the push ran. Nothing more was pushed; run the push again.`);
36942
+ }
36943
+ const contentType = step.op === "update" ? step.remote.content_type : guessMimeType(step.rel) ?? "application/octet-stream";
36944
+ const row = await client.upload(
36945
+ path42,
36946
+ bytes,
36947
+ contentType,
36948
+ fileWriteHeaders({ ifMatch: step.op === "update" ? step.ifMatch : void 0, label })
36949
+ );
36950
+ record.files[step.rel] = {
36951
+ version: typeof row?.version === "number" ? row.version : 0,
36952
+ content_sha256: row?.content_sha256 ?? step.local.content_sha256
36953
+ };
36954
+ }
36955
+ pushed++;
36956
+ console.log(` ${MARK[step.op]} ${safe(step.rel)}`);
36957
+ } catch (err) {
36958
+ if (step.op === "delete" && err instanceof ApiError && err.status === 404) {
36959
+ delete record.files[step.rel];
36960
+ } else if (isConflict(err)) {
36961
+ if (step.op === "delete") refusedDeletes.add(step.rel);
36962
+ const conflict = { rel: step.rel, reason: "changed_while_pushing" };
36963
+ conflicts.push(conflict);
36964
+ console.log(` ! ${conflictLine(conflict, PUSH_CONFLICT)}`);
36965
+ continue;
36966
+ } else {
36967
+ throw err;
36968
+ }
36969
+ }
36970
+ writeRecord(dir, record);
36971
+ }
36972
+ console.log(sanitizeTerminalText(`
36973
+ Pushed ${pushed} change${pushed === 1 ? "" : "s"} to ${describeSync(target)}.`));
36974
+ finishWithConflicts(target, opts.dir, conflicts);
36975
+ }
36976
+ function finishWithConflicts(t, dir, conflicts) {
36977
+ const count = conflicts.length;
36978
+ if (count === 0) return;
36979
+ throw expected(
36980
+ `${count} conflict${count === 1 ? "" : "s"} not pushed \u2014 the base's copies of those files were left as they are. To settle them, ${remedy(conflicts, pullCommand2(t, dir, true))}, then push again.`
36981
+ );
36982
+ }
36983
+ var LIST_PAGE, MAX_LIST_PAGES, MAX_DIFF_BYTES, MARK, safe, PULL_KEPT, PULL_CONFLICT, PUSH_CONFLICT;
36984
+ var init_sync3 = __esm({
36985
+ "src/data/files-sync/sync.ts"() {
36986
+ "use strict";
36987
+ init_dist();
36988
+ init_contracts();
36989
+ init_api_client();
36990
+ init_expected();
36991
+ init_resource_files();
36992
+ init_terminal_output();
36993
+ init_utils();
36994
+ init_listing();
36995
+ init_pacer();
36996
+ init_client();
36997
+ init_helpers();
36998
+ init_headers();
36999
+ init_local();
37000
+ init_plan();
37001
+ LIST_PAGE = 1e3;
37002
+ MAX_LIST_PAGES = 1e3;
37003
+ MAX_DIFF_BYTES = 256 * 1024;
37004
+ MARK = { create: "+", update: "~", delete: "-" };
37005
+ safe = (rel) => sanitizeTerminalText(rel);
37006
+ PULL_KEPT = {
37007
+ edited: "edited in your files, not pushed yet",
37008
+ deleted: "deleted in your files, not pushed yet (push --prune deletes it from the base)"
37009
+ };
37010
+ PULL_CONFLICT = {
37011
+ both_changed: "changed in your files and on the base",
37012
+ deleted_on_base: "edited in your files, deleted on the base",
37013
+ deleted_locally: "deleted in your files, changed on the base",
37014
+ exists_locally: "in your files and on the base, with different content",
37015
+ case_twin: "differs only in case from your local",
37016
+ file_folder: "would be both a file and a folder with your local",
37017
+ edited_while_pulling: "changed in your files while pulling \u2014 kept; pull again"
37018
+ };
37019
+ PUSH_CONFLICT = {
37020
+ changed_on_base: "changed on the base since your last pull",
37021
+ deleted_on_base: "deleted on the base since your last pull",
37022
+ exists_on_base: "created on the base since your last pull",
37023
+ case_twin: "differs only in case from the base's",
37024
+ file_folder: "would make one path both a file and a folder with the base's",
37025
+ changed_while_pushing: "changed on the base while pushing \u2014 not written"
37026
+ };
37027
+ }
37028
+ });
37029
+
35975
37030
  // src/data/commands/files.ts
35976
37031
  import { Command as Command12 } from "commander";
35977
37032
  import { readFileSync as readFileSync23, writeFileSync as writeFileSync11 } from "fs";
35978
37033
  import { basename as basename25 } from "path";
35979
- function renderFileDiff(fileType, filePath, from, to, d) {
35980
- console.log(sanitizeTerminalText(`${fileType}/${filePath}: v${from} \u2192 v${to}`));
37034
+ function renderFileDiff(fileType, filePath2, from, to, d) {
37035
+ console.log(sanitizeTerminalText(`${fileType}/${filePath2}: v${from} \u2192 v${to}`));
35981
37036
  const md = d.metadata_delta;
35982
37037
  if (md) {
35983
37038
  for (const f of ["path", "size", "content_type", "label"]) {
@@ -36005,12 +37060,12 @@ function renderFileDiff(fileType, filePath, from, to, d) {
36005
37060
  console.log(sanitizeTerminalText(` content: changed (${content.kind})`));
36006
37061
  }
36007
37062
  }
36008
- function downloadTarget(remotePath, to) {
37063
+ function downloadTarget(remotePath2, to) {
36009
37064
  if (to) return to;
36010
- const derived = basename25(remotePath);
37065
+ const derived = basename25(remotePath2);
36011
37066
  if (derived === "" || derived === "." || derived === "..") {
36012
37067
  throw expected(
36013
- `Cannot derive a local filename from "${remotePath}" \u2014 pass --to <local> to name it.`
37068
+ `Cannot derive a local filename from "${remotePath2}" \u2014 pass --to <local> to name it.`
36014
37069
  );
36015
37070
  }
36016
37071
  return derived;
@@ -36021,23 +37076,32 @@ function buildFilesCommand() {
36021
37076
  );
36022
37077
  files.command("put <file_type> <path>").description(
36023
37078
  "Upload a local file to a path (e.g. wayai files put reports q3/summary.pdf --file ./summary.pdf)"
36024
- ).requiredOption("--file <local>", "Local file to upload").option("--content-type <type>", "MIME type", "application/octet-stream").action(async function(fileType, filePath, opts) {
37079
+ ).requiredOption("--file <local>", "Local file to upload").option("--content-type <type>", "MIME type", "application/octet-stream").option(
37080
+ "--if-match <hash>",
37081
+ "Write only if the file's content hash is still this one (its ETag, or content_sha256 from get --meta); refused with a conflict otherwise"
37082
+ ).option("--label <text>", "Label for the content version this upload creates (printable ASCII)").option("--metadata <json>", "The file's metadata, a JSON object (inline or @filename)").action(async function(fileType, filePath2, opts) {
36025
37083
  const base = pathSegment(requireBase(this), "--base");
37084
+ const headers = fileWriteHeaders({
37085
+ ifMatch: opts.ifMatch,
37086
+ label: opts.label,
37087
+ metadata: opts.metadata === void 0 ? void 0 : parseData(opts.metadata, "--metadata")
37088
+ });
36026
37089
  const body = readFileSync23(opts.file);
36027
37090
  const client = await createDataClient();
36028
37091
  printOutput(
36029
37092
  await client.upload(
36030
- `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath)}`,
37093
+ `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath2)}`,
36031
37094
  body,
36032
- opts.contentType
37095
+ opts.contentType,
37096
+ headers
36033
37097
  ),
36034
37098
  outputFormat(this)
36035
37099
  );
36036
37100
  });
36037
37101
  files.command("get <file_type> <path>").description(
36038
37102
  "Download a file (or --meta for metadata only). --version N reads a specific retained content version."
36039
- ).option("--to <local>", "Local file to save to (defaults to the file basename)").option("--meta", "Print metadata JSON instead of downloading the content").option("--version <n>", "Read a specific content version (default: latest)").action(async function(fileType, filePath, opts) {
36040
- const encoded = pathSegments(filePath);
37103
+ ).option("--to <local>", "Local file to save to (defaults to the file basename)").option("--meta", "Print metadata JSON instead of downloading the content").option("--version <n>", "Read a specific content version (default: latest)").action(async function(fileType, filePath2, opts) {
37104
+ const encoded = pathSegments(filePath2);
36041
37105
  const versionQs = opts.version !== void 0 ? `version=${encodeURIComponent(opts.version)}` : "";
36042
37106
  const base = pathSegment(requireBase(this), "--base");
36043
37107
  if (opts.meta) {
@@ -36049,7 +37113,7 @@ function buildFilesCommand() {
36049
37113
  );
36050
37114
  return;
36051
37115
  }
36052
- const out = downloadTarget(filePath, opts.to);
37116
+ const out = downloadTarget(filePath2, opts.to);
36053
37117
  const client = await createDataClient();
36054
37118
  const { bytes } = await client.download(
36055
37119
  `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${encoded}${versionQs ? `?${versionQs}` : ""}`
@@ -36057,7 +37121,7 @@ function buildFilesCommand() {
36057
37121
  writeFileSync11(out, bytes);
36058
37122
  console.log(`Downloaded to ${out}`);
36059
37123
  });
36060
- files.command("history <file_type> <path>").description("List the content versions of a file (newest first)").option("--limit <n>", "Max versions to return").option("--offset <n>", "Pagination offset").action(async function(fileType, filePath, opts) {
37124
+ files.command("history <file_type> <path>").description("List the content versions of a file (newest first)").option("--limit <n>", "Max versions to return").option("--offset <n>", "Pagination offset").action(async function(fileType, filePath2, opts) {
36061
37125
  const base = pathSegment(requireBase(this), "--base");
36062
37126
  const client = await createDataClient();
36063
37127
  const qs = new URLSearchParams({ history: "1" });
@@ -36066,24 +37130,24 @@ function buildFilesCommand() {
36066
37130
  printOutput(
36067
37131
  await client.request(
36068
37132
  "GET",
36069
- `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath)}?${qs}`
37133
+ `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath2)}?${qs}`
36070
37134
  ),
36071
37135
  outputFormat(this)
36072
37136
  );
36073
37137
  });
36074
- files.command("diff <file_type> <path>").description("Diff two content versions of a file \u2014 metadata delta plus a text content diff").requiredOption("--from <n>", "Base version number").requiredOption("--to <n>", "Target version number").action(async function(fileType, filePath, opts) {
37138
+ files.command("diff <file_type> <path>").description("Diff two content versions of a file \u2014 metadata delta plus a text content diff").requiredOption("--from <n>", "Base version number").requiredOption("--to <n>", "Target version number").action(async function(fileType, filePath2, opts) {
36075
37139
  const base = pathSegment(requireBase(this), "--base");
36076
37140
  const client = await createDataClient();
36077
37141
  const qs = new URLSearchParams({ diff: "1", from: opts.from, to: opts.to });
36078
37142
  const data = await client.request(
36079
37143
  "GET",
36080
- `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath)}?${qs}`
37144
+ `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath2)}?${qs}`
36081
37145
  );
36082
37146
  if (outputFormat(this) === "json") {
36083
37147
  printOutput(data, "json");
36084
37148
  return;
36085
37149
  }
36086
- renderFileDiff(fileType, filePath, opts.from, opts.to, data);
37150
+ renderFileDiff(fileType, filePath2, opts.from, opts.to, data);
36087
37151
  });
36088
37152
  files.command("list <file_type>").description("List files by path prefix").option("--prefix <path>", "Path prefix filter (e.g. q3/)").option("--depth <n>", "Max folder depth below the prefix (1 = immediate children)").option("--limit <n>", "Max results").option("--offset <n>", "Pagination offset").action(async function(fileType, opts) {
36089
37153
  const base = pathSegment(requireBase(this), "--base");
@@ -36109,16 +37173,53 @@ function buildFilesCommand() {
36109
37173
  outputFormat(this)
36110
37174
  );
36111
37175
  });
36112
- files.command("rm <file_type> <path>").description("Delete a file").option("-y, --yes", "Skip confirmation prompt").action(async function(fileType, filePath, opts) {
36113
- if (!opts.yes && !await confirm(`Delete file "${fileType}/${filePath}"? This cannot be undone.`)) {
37176
+ files.command("rm <file_type> <path>").description("Delete a file").option("-y, --yes", "Skip confirmation prompt").option(
37177
+ "--if-match <hash>",
37178
+ "Delete only if the file's content hash is still this one; refused with a conflict otherwise"
37179
+ ).action(async function(fileType, filePath2, opts) {
37180
+ const headers = fileWriteHeaders({ ifMatch: opts.ifMatch });
37181
+ if (!opts.yes && !await confirm(`Delete file "${fileType}/${filePath2}"? This cannot be undone.`)) {
36114
37182
  console.log("Aborted");
36115
37183
  return;
36116
37184
  }
36117
37185
  const base = pathSegment(requireBase(this), "--base");
36118
37186
  const client = await createDataClient();
36119
- await client.request("DELETE", `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath)}`);
37187
+ await client.request(
37188
+ "DELETE",
37189
+ `/v1/${base}/files/${pathSegment(fileType, "file_type")}/${pathSegments(filePath2)}`,
37190
+ void 0,
37191
+ headers
37192
+ );
36120
37193
  console.log("Deleted");
36121
37194
  });
37195
+ files.command("pull <file_type>").description(
37196
+ "Pull a file type, or one --folder of it, into a local folder (default ./<file_type>[/<folder>]), recording each file's version for push. Local changes are kept; --overwrite replaces them"
37197
+ ).option("--folder <path>", "Sync one folder of the file type (e.g. hr), not all of it").option("--dir <local>", "Local folder to sync into (default ./<file_type>, or ./<file_type>/<folder>)").option("--overwrite", "Replace local changes with the base's copies").option("-y, --yes", "Skip the confirmation --overwrite asks for").action(async function(fileType, opts) {
37198
+ const base = requireBase(this);
37199
+ await pullFiles({
37200
+ base,
37201
+ fileType,
37202
+ folder: opts.folder,
37203
+ dir: opts.dir,
37204
+ overwrite: opts.overwrite ?? false,
37205
+ yes: opts.yes ?? false
37206
+ });
37207
+ });
37208
+ files.command("push <file_type>").description(
37209
+ "Push the local changes of a folder pulled with `files pull` to the base, after showing the diff. A file changed, deleted or created on the base since your pull is a conflict, not written; an update or delete also carries the version pulled, so the base refuses it if the file changed meanwhile"
37210
+ ).option("--folder <path>", "The folder of the file type the local folder was pulled from").option("--dir <local>", "Local folder to push (default ./<file_type>, or ./<file_type>/<folder>)").option("--dry-run", "Show the diff and push nothing").option("--prune", "Also delete files you deleted locally \u2014 only those unchanged on the base since your pull").option("--label <text>", "Label for every content version the push creates (printable ASCII)").option("-y, --yes", "Push without asking").action(async function(fileType, opts) {
37211
+ const base = requireBase(this);
37212
+ await pushFiles({
37213
+ base,
37214
+ fileType,
37215
+ folder: opts.folder,
37216
+ dir: opts.dir,
37217
+ dryRun: opts.dryRun ?? false,
37218
+ prune: opts.prune ?? false,
37219
+ label: opts.label,
37220
+ yes: opts.yes ?? false
37221
+ });
37222
+ });
36122
37223
  files.command("mount <file_type>").description(
36123
37224
  "Mint an S3 credential so any harness can mount this file type as a filesystem (s3fs, cloud mount SDKs). Read-only by default; the secret is shown once."
36124
37225
  ).option("--expires-in <seconds>", "Credential lifetime in seconds (default 30 days, max 90)").option(
@@ -36171,6 +37272,8 @@ var init_files2 = __esm({
36171
37272
  init_helpers();
36172
37273
  init_utils();
36173
37274
  init_terminal_output();
37275
+ init_headers();
37276
+ init_sync3();
36174
37277
  }
36175
37278
  });
36176
37279
 
@@ -36383,8 +37486,8 @@ function buildRecordsCommand() {
36383
37486
  const body = { data: parseData(opts.data) };
36384
37487
  if (opts.externalId) body.external_id = opts.externalId;
36385
37488
  if (opts.externalSource) body.external_source = opts.externalSource;
36386
- const path41 = opts.id ? `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(opts.id, "--id")}` : `/v1/${base}/records/${pathSegment(recordType2, "record_type")}`;
36387
- printOutput(await client.request("PUT", path41, body), outputFormat(this));
37489
+ const path42 = opts.id ? `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(opts.id, "--id")}` : `/v1/${base}/records/${pathSegment(recordType2, "record_type")}`;
37490
+ printOutput(await client.request("PUT", path42, body), outputFormat(this));
36388
37491
  });
36389
37492
  records.command("query <record_type>").description("List/search records: exact filters + fuzzy `search`, sorting, pagination").option(
36390
37493
  "--external-source <source>",
@@ -36419,9 +37522,9 @@ function buildRecordsCommand() {
36419
37522
  ).action(async function(recordType2, id, opts) {
36420
37523
  const base = pathSegment(requireBase(this), "--base");
36421
37524
  const client = await createDataClient();
36422
- let path41 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
36423
- if (opts.externalSource) path41 += `?external_source=${encodeURIComponent(opts.externalSource)}`;
36424
- printOutput(await client.request("GET", path41), outputFormat(this));
37525
+ let path42 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
37526
+ if (opts.externalSource) path42 += `?external_source=${encodeURIComponent(opts.externalSource)}`;
37527
+ printOutput(await client.request("GET", path42), outputFormat(this));
36425
37528
  });
36426
37529
  records.command("delete <record_type> <id>").description(
36427
37530
  "Delete a record by internal ID, or by external_id (pass --external-source to scope it)"
@@ -36435,11 +37538,11 @@ function buildRecordsCommand() {
36435
37538
  }
36436
37539
  const base = pathSegment(requireBase(this), "--base");
36437
37540
  const client = await createDataClient();
36438
- let path41 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
37541
+ let path42 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
36439
37542
  if (opts.externalSource) {
36440
- path41 += `?external_source=${encodeURIComponent(opts.externalSource)}&external_id=${encodeURIComponent(id)}`;
37543
+ path42 += `?external_source=${encodeURIComponent(opts.externalSource)}&external_id=${encodeURIComponent(id)}`;
36441
37544
  }
36442
- await client.request("DELETE", path41);
37545
+ await client.request("DELETE", path42);
36443
37546
  console.log("Deleted");
36444
37547
  });
36445
37548
  records.command("history <id>").description(
@@ -36604,8 +37707,8 @@ function buildRelationshipsCommand() {
36604
37707
  if (opts.data) body.data = parseData(opts.data);
36605
37708
  const base = pathSegment(requireBase(this), "--base");
36606
37709
  const client = await createDataClient();
36607
- const path41 = opts.id ? `/v1/${base}/relationships/${pathSegment(opts.id, "--id")}` : `/v1/${base}/relationships`;
36608
- printOutput(await client.request("PUT", path41, body), outputFormat(this));
37710
+ const path42 = opts.id ? `/v1/${base}/relationships/${pathSegment(opts.id, "--id")}` : `/v1/${base}/relationships`;
37711
+ printOutput(await client.request("PUT", path42, body), outputFormat(this));
36609
37712
  });
36610
37713
  relationships.command("get <id>").description(
36611
37714
  "Get a relationship by ID (or by its external key: pass the external_id with --rel-type)"
@@ -36838,8 +37941,8 @@ function buildToolsetsCommand() {
36838
37941
  toolsets.command("get <slug>").description("Get a toolset").option("--resolved", "Include resolved record_type schemas").action(async function(slug, opts) {
36839
37942
  const base = pathSegment(requireBase(this), "--base");
36840
37943
  const client = await createDataClient();
36841
- const path41 = opts.resolved ? `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}/resolved` : `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}`;
36842
- printOutput(await client.request("GET", path41), outputFormat(this));
37944
+ const path42 = opts.resolved ? `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}/resolved` : `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}`;
37945
+ printOutput(await client.request("GET", path42), outputFormat(this));
36843
37946
  });
36844
37947
  toolsets.command("list").description("List all toolsets").action(async function() {
36845
37948
  const base = pathSegment(requireBase(this), "--base");
@@ -37074,7 +38177,7 @@ init_utils();
37074
38177
  init_registry();
37075
38178
  import { readFileSync as readFileSync24 } from "fs";
37076
38179
  import { fileURLToPath as fileURLToPath3 } from "url";
37077
- import { dirname as dirname16, join as join37 } from "path";
38180
+ import { dirname as dirname17, join as join38 } from "path";
37078
38181
 
37079
38182
  // src/lib/version-refresh.ts
37080
38183
  init_version_cache();
@@ -37082,7 +38185,7 @@ init_skill_version();
37082
38185
  import { exec } from "child_process";
37083
38186
  var REFRESH_TIMEOUT_MS = 1e4;
37084
38187
  function refreshCliCache() {
37085
- return new Promise((resolve12) => {
38188
+ return new Promise((resolve13) => {
37086
38189
  exec("npm view @wayai/cli version", { timeout: REFRESH_TIMEOUT_MS }, (err, stdout) => {
37087
38190
  if (!err) {
37088
38191
  const latest = stdout.trim();
@@ -37093,7 +38196,7 @@ function refreshCliCache() {
37093
38196
  }
37094
38197
  }
37095
38198
  }
37096
- resolve12();
38199
+ resolve13();
37097
38200
  });
37098
38201
  });
37099
38202
  }
@@ -37119,8 +38222,8 @@ async function refreshSkillCache() {
37119
38222
  }
37120
38223
  async function refreshAdminSkillCache() {
37121
38224
  let timer;
37122
- const deadline = new Promise((resolve12) => {
37123
- timer = setTimeout(resolve12, REFRESH_TIMEOUT_MS);
38225
+ const deadline = new Promise((resolve13) => {
38226
+ timer = setTimeout(resolve13, REFRESH_TIMEOUT_MS);
37124
38227
  });
37125
38228
  await Promise.race([deadline, fetchAndCacheAdminSkillVersion().catch(() => {
37126
38229
  })]);
@@ -37229,8 +38332,8 @@ Run \`wayai admin skill install\` to update.`);
37229
38332
  }
37230
38333
 
37231
38334
  // src/index.ts
37232
- var __dirname = dirname16(fileURLToPath3(import.meta.url));
37233
- var pkg = JSON.parse(readFileSync24(join37(__dirname, "..", "package.json"), "utf-8"));
38335
+ var __dirname = dirname17(fileURLToPath3(import.meta.url));
38336
+ var pkg = JSON.parse(readFileSync24(join38(__dirname, "..", "package.json"), "utf-8"));
37234
38337
  var [, , command, ...args] = process.argv;
37235
38338
  var isBackgroundRefresh = command === REFRESH_COMMAND;
37236
38339
  if (!isBackgroundRefresh) initSentry(command, pkg.version);
@@ -37280,8 +38383,8 @@ async function main() {
37280
38383
  break;
37281
38384
  }
37282
38385
  case "pull": {
37283
- const { pullCommand: pullCommand2 } = await Promise.resolve().then(() => (init_pull(), pull_exports));
37284
- await pullCommand2(args);
38386
+ const { pullCommand: pullCommand3 } = await Promise.resolve().then(() => (init_pull(), pull_exports));
38387
+ await pullCommand3(args);
37285
38388
  break;
37286
38389
  }
37287
38390
  case "push": {