@adhdev/daemon-standalone 0.9.76-rc.61 → 0.9.76-rc.62

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
@@ -31624,10 +31624,10 @@ var require_dist2 = __commonJS({
31624
31624
  return (0, import_path22.join)(getConfigDir(), "meshes.json");
31625
31625
  }
31626
31626
  function loadMeshConfig() {
31627
- const path27 = getMeshConfigPath();
31628
- if (!(0, import_fs2.existsSync)(path27)) return { meshes: [] };
31627
+ const path28 = getMeshConfigPath();
31628
+ if (!(0, import_fs2.existsSync)(path28)) return { meshes: [] };
31629
31629
  try {
31630
- const raw = JSON.parse((0, import_fs2.readFileSync)(path27, "utf-8"));
31630
+ const raw = JSON.parse((0, import_fs2.readFileSync)(path28, "utf-8"));
31631
31631
  if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
31632
31632
  return raw;
31633
31633
  } catch {
@@ -31635,16 +31635,16 @@ var require_dist2 = __commonJS({
31635
31635
  }
31636
31636
  }
31637
31637
  function saveMeshConfig(config2) {
31638
- const path27 = getMeshConfigPath();
31639
- (0, import_fs2.writeFileSync)(path27, JSON.stringify(config2, null, 2), { encoding: "utf-8", mode: 384 });
31638
+ const path28 = getMeshConfigPath();
31639
+ (0, import_fs2.writeFileSync)(path28, JSON.stringify(config2, null, 2), { encoding: "utf-8", mode: 384 });
31640
31640
  }
31641
31641
  function normalizeRepoIdentity(remoteUrl) {
31642
31642
  let identity = remoteUrl.trim();
31643
31643
  if (identity.startsWith("http://") || identity.startsWith("https://")) {
31644
31644
  try {
31645
31645
  const url2 = new URL(identity);
31646
- const path27 = url2.pathname.replace(/^\//, "").replace(/\.git$/, "");
31647
- return `${url2.hostname}/${path27}`;
31646
+ const path28 = url2.pathname.replace(/^\//, "").replace(/\.git$/, "");
31647
+ return `${url2.hostname}/${path28}`;
31648
31648
  } catch {
31649
31649
  }
31650
31650
  }
@@ -31802,6 +31802,7 @@ Default branch: \`${mesh.defaultBranch}\`` : ""}`);
31802
31802
  }
31803
31803
  sections.push(buildPolicySection({ ...DEFAULT_MESH_POLICY, ...mesh.policy || {} }));
31804
31804
  sections.push(TOOLS_SECTION);
31805
+ sections.push(TOOL_EXPOSURE_PREFLIGHT_SECTION);
31805
31806
  sections.push(WORKFLOW_SECTION);
31806
31807
  sections.push(buildRulesSection(coordinatorCliType));
31807
31808
  if (userInstruction) {
@@ -31872,6 +31873,7 @@ ${rules.join("\n")}`;
31872
31873
  - **Name worktree branches meaningfully.** Use descriptive names like \`feat/auth-refactor\` or \`fix/build-123\`.${coordinatorNote}`;
31873
31874
  }
31874
31875
  var TOOLS_SECTION;
31876
+ var TOOL_EXPOSURE_PREFLIGHT_SECTION;
31875
31877
  var WORKFLOW_SECTION;
31876
31878
  var init_coordinator_prompt = __esm2({
31877
31879
  "src/mesh/coordinator-prompt.ts"() {
@@ -31891,6 +31893,9 @@ ${rules.join("\n")}`;
31891
31893
  | \`mesh_approve\` | Approve/reject a pending agent action |
31892
31894
  | \`mesh_clone_node\` | Create a worktree node for isolated parallel branch work |
31893
31895
  | \`mesh_remove_node\` | Remove a node (cleans up worktree if applicable) |`;
31896
+ TOOL_EXPOSURE_PREFLIGHT_SECTION = `## Tool Exposure Preflight
31897
+
31898
+ Before doing any coordinator work, confirm that the actual callable tool list includes \`mesh_status\` and the other \`mesh_*\` tools from the table above. If this Repo Mesh coordinator prompt is present but the callable \`mesh_*\` tools are missing, the MCP server/tool manifest is stale or not injected yet. Do not substitute terminal/file/git tools, do not inspect or edit the repository directly, and do not continue as a non-mesh local coding agent. Stop immediately and tell the user to run \`/reload-mcp\` or start a fresh coordinator session so ADHDev can reconnect \`adhdev-mesh\`.`;
31894
31899
  WORKFLOW_SECTION = `## Orchestration Workflow
31895
31900
 
31896
31901
  1. **Assess** \u2014 Call \`mesh_status\` to see which nodes are healthy and available.
@@ -38882,6 +38887,10 @@ ${lastSnapshot}`;
38882
38887
  return parts.map((part) => {
38883
38888
  if (part.type === "text") return part.text;
38884
38889
  if (part.type === "resource") return part.resource.text || "";
38890
+ if (part.type === "image") return part.alt || (part.data ? `[image: ${part.mimeType}]` : "");
38891
+ if (part.type === "audio") return part.transcript || (part.data ? `[audio: ${part.mimeType}]` : "");
38892
+ if (part.type === "video") return part.transcript || (part.data ? `[video: ${part.mimeType}]` : "");
38893
+ if (part.type === "resource_link") return [part.name, part.description].filter(Boolean).join("\n");
38885
38894
  return "";
38886
38895
  }).filter((value) => value.length > 0).join("\n");
38887
38896
  }
@@ -38968,6 +38977,7 @@ ${lastSnapshot}`;
38968
38977
  mimeType: raw.mimeType,
38969
38978
  ...typeof raw.uri === "string" ? { uri: raw.uri } : {},
38970
38979
  ...typeof raw.data === "string" ? { data: raw.data } : {},
38980
+ ...typeof raw.transcript === "string" ? { transcript: raw.transcript } : {},
38971
38981
  ...typeof raw.posterUri === "string" ? { posterUri: raw.posterUri } : {}
38972
38982
  };
38973
38983
  }
@@ -38983,10 +38993,14 @@ ${lastSnapshot}`;
38983
38993
  }
38984
38994
  if (type === "resource_link" && typeof raw.uri === "string") {
38985
38995
  return {
38986
- type: "resource",
38996
+ type,
38987
38997
  uri: raw.uri,
38998
+ name: typeof raw.name === "string" ? raw.name : getUriDisplayName(raw.uri, "resource"),
38999
+ ...typeof raw.title === "string" ? { title: raw.title } : {},
39000
+ ...typeof raw.description === "string" ? { description: raw.description } : {},
38988
39001
  ...typeof raw.mimeType === "string" ? { mimeType: raw.mimeType } : {},
38989
- ...typeof raw.name === "string" ? { name: raw.name } : {}
39002
+ ...typeof raw.size === "number" && Number.isFinite(raw.size) ? { size: raw.size } : {},
39003
+ ...normalizeAnnotationsProperty(raw.annotations)
38990
39004
  };
38991
39005
  }
38992
39006
  return null;
@@ -39001,7 +39015,8 @@ ${lastSnapshot}`;
39001
39015
  type,
39002
39016
  mimeType: raw.mimeType,
39003
39017
  ...typeof raw.uri === "string" ? { uri: raw.uri } : {},
39004
- ...typeof raw.data === "string" ? { data: raw.data } : {}
39018
+ ...typeof raw.data === "string" ? { data: raw.data } : {},
39019
+ ...typeof raw.alt === "string" ? { alt: raw.alt } : {}
39005
39020
  };
39006
39021
  }
39007
39022
  if (type === "audio" && typeof raw.mimeType === "string") {
@@ -39019,6 +39034,7 @@ ${lastSnapshot}`;
39019
39034
  mimeType: raw.mimeType,
39020
39035
  ...typeof raw.uri === "string" ? { uri: raw.uri } : {},
39021
39036
  ...typeof raw.data === "string" ? { data: raw.data } : {},
39037
+ ...typeof raw.transcript === "string" ? { transcript: raw.transcript } : {},
39022
39038
  ...typeof raw.posterUri === "string" ? { posterUri: raw.posterUri } : {}
39023
39039
  };
39024
39040
  }
@@ -39027,8 +39043,11 @@ ${lastSnapshot}`;
39027
39043
  type,
39028
39044
  uri: raw.uri,
39029
39045
  name: raw.name,
39046
+ ...typeof raw.title === "string" ? { title: raw.title } : {},
39047
+ ...typeof raw.description === "string" ? { description: raw.description } : {},
39030
39048
  ...typeof raw.mimeType === "string" ? { mimeType: raw.mimeType } : {},
39031
- ...typeof raw.size === "number" ? { size: raw.size } : {}
39049
+ ...typeof raw.size === "number" && Number.isFinite(raw.size) ? { size: raw.size } : {},
39050
+ ...normalizeAnnotationsProperty(raw.annotations)
39032
39051
  };
39033
39052
  }
39034
39053
  if (type === "resource" && raw.resource && typeof raw.resource === "object") {
@@ -39049,11 +39068,35 @@ ${lastSnapshot}`;
39049
39068
  function flattenInputParts(parts) {
39050
39069
  return parts.map((part) => {
39051
39070
  if (part.type === "text") return part.text;
39052
- if (part.type === "audio") return part.transcript || "";
39053
- if (part.type === "resource") return part.text || "";
39071
+ if (part.type === "image") return part.alt || (part.data ? `[image: ${part.mimeType}]` : "");
39072
+ if (part.type === "audio") return part.transcript || (part.data ? `[audio: ${part.mimeType}]` : "");
39073
+ if (part.type === "video") return part.transcript || (part.data ? `[video: ${part.mimeType}]` : "");
39074
+ if (part.type === "resource_link") return [part.title, part.name, part.description, part.uri].filter(Boolean).join("\n");
39075
+ if (part.type === "resource") return part.text || part.name || part.uri;
39054
39076
  return "";
39055
39077
  }).filter((value) => value.length > 0).join("\n");
39056
39078
  }
39079
+ function getUriDisplayName(uri, fallback) {
39080
+ try {
39081
+ const pathname = uri.startsWith("file://") ? new URL(uri).pathname : uri;
39082
+ return pathname.split(/[\\/]/).filter(Boolean).pop() || fallback;
39083
+ } catch {
39084
+ return uri.split(/[\\/]/).filter(Boolean).pop() || fallback;
39085
+ }
39086
+ }
39087
+ function normalizeAnnotationsProperty(value) {
39088
+ if (!value || typeof value !== "object") return {};
39089
+ const record2 = value;
39090
+ const annotations = {};
39091
+ if (Array.isArray(record2.audience)) {
39092
+ const audience = record2.audience.filter((item) => item === "user" || item === "assistant");
39093
+ if (audience.length > 0) annotations.audience = audience;
39094
+ }
39095
+ if (typeof record2.priority === "number" && Number.isFinite(record2.priority)) {
39096
+ annotations.priority = record2.priority;
39097
+ }
39098
+ return Object.keys(annotations).length > 0 ? { annotations } : {};
39099
+ }
39057
39100
  function flattenContent(content) {
39058
39101
  if (typeof content === "string") return content;
39059
39102
  return flattenMessageParts(normalizeMessageParts(content));
@@ -42676,6 +42719,145 @@ ${effect.notification.body || ""}`.trim();
42676
42719
  }
42677
42720
  return normalized;
42678
42721
  }
42722
+ var VALID_INPUT_MEDIA_TYPES = /* @__PURE__ */ new Set(["text", "image", "audio", "video", "resource"]);
42723
+ var VALID_INPUT_STRATEGIES = /* @__PURE__ */ new Set(["native", "native_acp", "resource_link", "text_fallback", "paste", "upload"]);
42724
+ var TEXT_ONLY_MESSAGE_INPUT_SUPPORT = Object.freeze({
42725
+ text: true,
42726
+ multipart: false,
42727
+ mediaTypes: ["text"],
42728
+ strategies: []
42729
+ });
42730
+ function getProviderLabel(provider) {
42731
+ return provider?.name || provider?.type || "This provider";
42732
+ }
42733
+ function hasNonEmptyFallbackText(input) {
42734
+ return typeof input.textFallback === "string" && input.textFallback.trim().length > 0;
42735
+ }
42736
+ function getRequestedInputMediaTypes(input) {
42737
+ const types = /* @__PURE__ */ new Set();
42738
+ if (hasNonEmptyFallbackText(input) && !input.parts.some((part) => part.type === "text")) {
42739
+ types.add("text");
42740
+ }
42741
+ for (const part of input.parts) {
42742
+ if (VALID_INPUT_MEDIA_TYPES.has(part.type)) {
42743
+ types.add(part.type);
42744
+ }
42745
+ }
42746
+ return Array.from(types);
42747
+ }
42748
+ function getEffectiveSemanticPartCount(input) {
42749
+ let count = input.parts.length;
42750
+ if (hasNonEmptyFallbackText(input) && !input.parts.some((part) => part.type === "text")) {
42751
+ count += 1;
42752
+ }
42753
+ return count;
42754
+ }
42755
+ function assertTextOnlyInput(provider, input) {
42756
+ const unsupported = getRequestedInputMediaTypes(input).filter((type) => type !== "text");
42757
+ if (unsupported.length === 0) return;
42758
+ const label = getProviderLabel(provider);
42759
+ const suffix = unsupported.length === 1 ? "" : "s";
42760
+ throw new Error(`${label} only supports text input; unsupported input type${suffix}: ${unsupported.join(", ")}`);
42761
+ }
42762
+ function getDeclaredProviderInputSupport(provider) {
42763
+ const rawMediaTypes = Array.isArray(provider?.capabilities?.input?.mediaTypes) ? provider?.capabilities?.input?.mediaTypes.filter((type) => VALID_INPUT_MEDIA_TYPES.has(type)) : [];
42764
+ const strategies = normalizeInputStrategyDescriptors(provider?.capabilities?.input?.strategies);
42765
+ return {
42766
+ multipart: provider?.capabilities?.input?.multipart === true,
42767
+ mediaTypes: new Set(rawMediaTypes.length > 0 ? rawMediaTypes : ["text"]),
42768
+ strategies
42769
+ };
42770
+ }
42771
+ function normalizeInputStrategyDescriptors(raw) {
42772
+ if (!Array.isArray(raw)) return [];
42773
+ const result = [];
42774
+ for (const entry of raw) {
42775
+ if (!entry || typeof entry !== "object") continue;
42776
+ const record2 = entry;
42777
+ const mediaType = record2.mediaType;
42778
+ if (typeof mediaType !== "string" || !VALID_INPUT_MEDIA_TYPES.has(mediaType)) continue;
42779
+ const strategies = Array.isArray(record2.strategies) ? record2.strategies.filter((value) => typeof value === "string" && VALID_INPUT_STRATEGIES.has(value)) : [];
42780
+ const degradation = Array.isArray(record2.degradation) ? record2.degradation.filter((value) => typeof value === "string" && VALID_INPUT_STRATEGIES.has(value)) : [];
42781
+ if (strategies.length === 0 && degradation.length === 0) continue;
42782
+ result.push({
42783
+ mediaType,
42784
+ strategies,
42785
+ ...typeof record2.native === "boolean" ? { native: record2.native } : {},
42786
+ ...degradation.length > 0 ? { degradation } : {}
42787
+ });
42788
+ }
42789
+ return result;
42790
+ }
42791
+ function promptCapabilityFlags(runtimeCapabilities) {
42792
+ const prompt = runtimeCapabilities?.promptCapabilities || {};
42793
+ return {
42794
+ image: prompt.image === true,
42795
+ audio: prompt.audio === true,
42796
+ embeddedContext: prompt.embeddedContext === true
42797
+ };
42798
+ }
42799
+ function supportFromDeclared(provider) {
42800
+ const declared = getDeclaredProviderInputSupport(provider);
42801
+ return {
42802
+ text: true,
42803
+ multipart: declared.multipart,
42804
+ mediaTypes: Array.from(declared.mediaTypes),
42805
+ strategies: declared.strategies
42806
+ };
42807
+ }
42808
+ function getEffectiveMessageInputSupport(provider, runtimeCapabilities) {
42809
+ if (provider?.category !== "acp") {
42810
+ const declared2 = supportFromDeclared(provider);
42811
+ return {
42812
+ ...declared2,
42813
+ mediaTypes: [...declared2.mediaTypes],
42814
+ strategies: declared2.strategies.map((strategy) => ({
42815
+ ...strategy,
42816
+ strategies: [...strategy.strategies],
42817
+ ...strategy.degradation ? { degradation: [...strategy.degradation] } : {}
42818
+ }))
42819
+ };
42820
+ }
42821
+ const declared = supportFromDeclared(provider);
42822
+ const caps = promptCapabilityFlags(runtimeCapabilities);
42823
+ const mediaTypes = /* @__PURE__ */ new Set(["text"]);
42824
+ const strategies = [];
42825
+ if (declared.mediaTypes.includes("resource")) {
42826
+ mediaTypes.add("resource");
42827
+ strategies.push({ mediaType: "resource", strategies: caps.embeddedContext ? ["native_acp", "resource_link", "text_fallback"] : ["resource_link", "text_fallback"], native: caps.embeddedContext, degradation: ["resource_link", "text_fallback"] });
42828
+ }
42829
+ if (declared.mediaTypes.includes("video")) {
42830
+ mediaTypes.add("video");
42831
+ strategies.push({ mediaType: "video", strategies: ["resource_link", "text_fallback"], native: false, degradation: ["resource_link", "text_fallback"] });
42832
+ }
42833
+ if (declared.mediaTypes.includes("image")) {
42834
+ mediaTypes.add("image");
42835
+ strategies.push({ mediaType: "image", strategies: caps.image ? ["native_acp", "resource_link", "text_fallback"] : ["resource_link", "text_fallback"], native: caps.image, degradation: ["resource_link", "text_fallback"] });
42836
+ }
42837
+ if (declared.mediaTypes.includes("audio")) {
42838
+ mediaTypes.add("audio");
42839
+ strategies.push({ mediaType: "audio", strategies: caps.audio ? ["native_acp", "resource_link", "text_fallback"] : ["resource_link", "text_fallback"], native: caps.audio, degradation: ["resource_link", "text_fallback"] });
42840
+ }
42841
+ return {
42842
+ text: true,
42843
+ multipart: declared.multipart && mediaTypes.size > 1,
42844
+ mediaTypes: Array.from(mediaTypes),
42845
+ strategies
42846
+ };
42847
+ }
42848
+ function assertProviderSupportsDeclaredInput(provider, input) {
42849
+ const label = getProviderLabel(provider);
42850
+ const support = getDeclaredProviderInputSupport(provider);
42851
+ const requestedTypes = getRequestedInputMediaTypes(input);
42852
+ const unsupported = requestedTypes.filter((type) => !support.mediaTypes.has(type));
42853
+ if (unsupported.length > 0) {
42854
+ const suffix = unsupported.length === 1 ? "" : "s";
42855
+ throw new Error(`${label} does not support input type${suffix}: ${unsupported.join(", ")}`);
42856
+ }
42857
+ if (getEffectiveSemanticPartCount(input) > 1 && !support.multipart) {
42858
+ throw new Error(`${label} does not support multipart input`);
42859
+ }
42860
+ }
42679
42861
  function getActiveChatOptions(profile) {
42680
42862
  if (profile === "full") return {};
42681
42863
  return LIVE_STATUS_ACTIVE_CHAT_OPTIONS;
@@ -42772,7 +42954,7 @@ ${effect.notification.body || ""}`.trim();
42772
42954
  ...git && { git },
42773
42955
  activeChat,
42774
42956
  ...summaryMetadata && { summaryMetadata },
42775
- ...includeSessionMetadata && { capabilities: state.sessionCapabilities || IDE_SESSION_CAPABILITIES },
42957
+ ...includeSessionMetadata && { capabilities: state.sessionCapabilities || IDE_SESSION_CAPABILITIES, messageInput: state.messageInput || TEXT_ONLY_MESSAGE_INPUT_SUPPORT },
42776
42958
  cdpConnected: state.cdpConnected ?? isCdpConnected(cdpManagers, state.type),
42777
42959
  ...includeSessionControls && {
42778
42960
  ...controlValues && { controlValues },
@@ -42807,7 +42989,7 @@ ${effect.notification.body || ""}`.trim();
42807
42989
  ...git && { git },
42808
42990
  activeChat,
42809
42991
  ...summaryMetadata && { summaryMetadata },
42810
- ...includeSessionMetadata && { capabilities: ext.sessionCapabilities || EXTENSION_SESSION_CAPABILITIES },
42992
+ ...includeSessionMetadata && { capabilities: ext.sessionCapabilities || EXTENSION_SESSION_CAPABILITIES, messageInput: ext.messageInput || TEXT_ONLY_MESSAGE_INPUT_SUPPORT },
42811
42993
  ...includeSessionControls && {
42812
42994
  ...controlValues && { controlValues },
42813
42995
  providerControls: ext.providerControls
@@ -42871,7 +43053,8 @@ ${effect.notification.body || ""}`.trim();
42871
43053
  activeChat,
42872
43054
  ...summaryMetadata && { summaryMetadata },
42873
43055
  ...includeSessionMetadata && {
42874
- capabilities: state.mode === "terminal" ? PTY_SESSION_CAPABILITIES : CLI_CHAT_SESSION_CAPABILITIES
43056
+ capabilities: state.mode === "terminal" ? PTY_SESSION_CAPABILITIES : CLI_CHAT_SESSION_CAPABILITIES,
43057
+ messageInput: state.messageInput || TEXT_ONLY_MESSAGE_INPUT_SUPPORT
42875
43058
  },
42876
43059
  ...includeSessionControls && {
42877
43060
  ...controlValues && { controlValues },
@@ -42905,7 +43088,7 @@ ${effect.notification.body || ""}`.trim();
42905
43088
  ...git && { git },
42906
43089
  activeChat,
42907
43090
  ...summaryMetadata && { summaryMetadata },
42908
- ...includeSessionMetadata && { capabilities: ACP_SESSION_CAPABILITIES },
43091
+ ...includeSessionMetadata && { capabilities: ACP_SESSION_CAPABILITIES, messageInput: state.messageInput || TEXT_ONLY_MESSAGE_INPUT_SUPPORT },
42909
43092
  ...includeSessionControls && {
42910
43093
  ...controlValues && { controlValues },
42911
43094
  providerControls: state.providerControls
@@ -43016,59 +43199,6 @@ ${effect.notification.body || ""}`.trim();
43016
43199
  var os62 = __toESM2(require("os"));
43017
43200
  var path12 = __toESM2(require("path"));
43018
43201
  var import_node_crypto = require("crypto");
43019
- var VALID_INPUT_MEDIA_TYPES = /* @__PURE__ */ new Set(["text", "image", "audio", "video", "resource"]);
43020
- function getProviderLabel(provider) {
43021
- return provider?.name || provider?.type || "This provider";
43022
- }
43023
- function hasNonEmptyFallbackText(input) {
43024
- return typeof input.textFallback === "string" && input.textFallback.trim().length > 0;
43025
- }
43026
- function getRequestedInputMediaTypes(input) {
43027
- const types = /* @__PURE__ */ new Set();
43028
- if (hasNonEmptyFallbackText(input) && !input.parts.some((part) => part.type === "text")) {
43029
- types.add("text");
43030
- }
43031
- for (const part of input.parts) {
43032
- if (VALID_INPUT_MEDIA_TYPES.has(part.type)) {
43033
- types.add(part.type);
43034
- }
43035
- }
43036
- return Array.from(types);
43037
- }
43038
- function getEffectiveSemanticPartCount(input) {
43039
- let count = input.parts.length;
43040
- if (hasNonEmptyFallbackText(input) && !input.parts.some((part) => part.type === "text")) {
43041
- count += 1;
43042
- }
43043
- return count;
43044
- }
43045
- function assertTextOnlyInput(provider, input) {
43046
- const unsupported = getRequestedInputMediaTypes(input).filter((type) => type !== "text");
43047
- if (unsupported.length === 0) return;
43048
- const label = getProviderLabel(provider);
43049
- const suffix = unsupported.length === 1 ? "" : "s";
43050
- throw new Error(`${label} only supports text input; unsupported input type${suffix}: ${unsupported.join(", ")}`);
43051
- }
43052
- function getDeclaredProviderInputSupport(provider) {
43053
- const rawMediaTypes = Array.isArray(provider?.capabilities?.input?.mediaTypes) ? provider?.capabilities?.input?.mediaTypes.filter((type) => VALID_INPUT_MEDIA_TYPES.has(type)) : [];
43054
- return {
43055
- multipart: provider?.capabilities?.input?.multipart === true,
43056
- mediaTypes: new Set(rawMediaTypes.length > 0 ? rawMediaTypes : ["text"])
43057
- };
43058
- }
43059
- function assertProviderSupportsDeclaredInput(provider, input) {
43060
- const label = getProviderLabel(provider);
43061
- const support = getDeclaredProviderInputSupport(provider);
43062
- const requestedTypes = getRequestedInputMediaTypes(input);
43063
- const unsupported = requestedTypes.filter((type) => !support.mediaTypes.has(type));
43064
- if (unsupported.length > 0) {
43065
- const suffix = unsupported.length === 1 ? "" : "s";
43066
- throw new Error(`${label} does not support input type${suffix}: ${unsupported.join(", ")}`);
43067
- }
43068
- if (getEffectiveSemanticPartCount(input) > 1 && !support.multipart) {
43069
- throw new Error(`${label} does not support multipart input`);
43070
- }
43071
- }
43072
43202
  init_logger();
43073
43203
  init_debug_config();
43074
43204
  function summarizeString(value) {
@@ -43252,10 +43382,25 @@ ${effect.notification.body || ""}`.trim();
43252
43382
  const target = args?.targetSessionId || args?.agentType || h.currentSession?.providerType || h.currentProviderType || h.currentManagerKey || "unknown";
43253
43383
  return `${transport}:${target}:${signature.trim()}`;
43254
43384
  }
43385
+ function summarizeSendInputPart(part) {
43386
+ if (!part || typeof part !== "object") return String(part ?? "");
43387
+ if (part.type === "text") return `text:${String(part.text || "").trim()}`;
43388
+ const fields = [
43389
+ `type=${String(part.type || "")}`,
43390
+ `mime=${String(part.mimeType || "")}`,
43391
+ `uri=${String(part.uri || "")}`,
43392
+ `name=${String(part.name || "")}`
43393
+ ];
43394
+ const data = typeof part.data === "string" ? part.data : typeof part.resource?.blob === "string" ? part.resource.blob : "";
43395
+ if (data) fields.push(`dataLen=${data.length}`, `dataHash=${hashSignatureParts([data]).slice(0, 12)}`);
43396
+ const textish = [part.alt, part.transcript, part.description, part.title, part.resource?.uri].filter((value) => typeof value === "string" && value.trim()).join("");
43397
+ if (textish) fields.push(`meta=${hashSignatureParts([textish]).slice(0, 12)}`);
43398
+ return fields.join(";");
43399
+ }
43255
43400
  function buildSendInputSignature(input) {
43256
43401
  const text = typeof input.textFallback === "string" ? input.textFallback.trim() : "";
43257
- if (text) return text;
43258
- return JSON.stringify(input.parts || []);
43402
+ const partSummaries = (input.parts || []).map(summarizeSendInputPart);
43403
+ return hashSignatureParts([text, ...partSummaries]);
43259
43404
  }
43260
43405
  function getSendChatInputEnvelope(args) {
43261
43406
  return normalizeInputEnvelope(args?.input ? { input: args.input } : args);
@@ -44136,6 +44281,17 @@ ${effect.notification.body || ""}`.trim();
44136
44281
  if (adapter) {
44137
44282
  _log(`${transport} adapter: ${adapter.cliType}`);
44138
44283
  try {
44284
+ const hasStructuredParts = input.parts.some((part) => part.type !== "text");
44285
+ if (hasStructuredParts) {
44286
+ const target = getTargetInstance(h, args);
44287
+ if (!target || target.category !== "cli") {
44288
+ return { success: false, error: `CLI instance not found for ${provider?.type || args?.agentType || "unknown"}` };
44289
+ }
44290
+ assertProviderSupportsDeclaredInput(provider, input);
44291
+ await waitOnceForFreshHermesCliStart(adapter, _log);
44292
+ target.onEvent("send_message", { input });
44293
+ return _logSendSuccess(`${transport}-instance`, target.type);
44294
+ }
44139
44295
  assertTextOnlyInput(provider, input);
44140
44296
  if (!text) return { success: false, error: "text required for PTY send" };
44141
44297
  await waitOnceForFreshHermesCliStart(adapter, _log);
@@ -46209,7 +46365,7 @@ ${effect.notification.body || ""}`.trim();
46209
46365
  }
46210
46366
  };
46211
46367
  var os13 = __toESM2(require("os"));
46212
- var path17 = __toESM2(require("path"));
46368
+ var path18 = __toESM2(require("path"));
46213
46369
  var crypto4 = __toESM2(require("crypto"));
46214
46370
  var import_fs6 = require("fs");
46215
46371
  var import_child_process6 = require("child_process");
@@ -46238,6 +46394,79 @@ ${effect.notification.body || ""}`.trim();
46238
46394
  }
46239
46395
  return normalizedId;
46240
46396
  }
46397
+ var IMAGE_MIME_EXTENSIONS = {
46398
+ "image/png": ".png",
46399
+ "image/jpeg": ".jpg",
46400
+ "image/jpg": ".jpg",
46401
+ "image/gif": ".gif",
46402
+ "image/webp": ".webp",
46403
+ "image/bmp": ".bmp",
46404
+ "image/tiff": ".tiff",
46405
+ "image/svg+xml": ".svg"
46406
+ };
46407
+ function filePathFromUri(uri) {
46408
+ if (!uri) return null;
46409
+ if (uri.startsWith("file://")) {
46410
+ try {
46411
+ return decodeURIComponent(new URL(uri).pathname);
46412
+ } catch {
46413
+ return uri.slice("file://".length);
46414
+ }
46415
+ }
46416
+ if (path16.isAbsolute(uri)) return uri;
46417
+ return null;
46418
+ }
46419
+ function extensionForImageMime(mimeType) {
46420
+ return IMAGE_MIME_EXTENSIONS[mimeType.toLowerCase()] || ".img";
46421
+ }
46422
+ function safeInputImageBasename(index, mimeType) {
46423
+ const extension = extensionForImageMime(mimeType);
46424
+ const suffix = crypto3.randomBytes(6).toString("hex");
46425
+ return `adhdev-input-image-${Date.now()}-${index}-${suffix}${extension}`;
46426
+ }
46427
+ function materializeImageDataPart(part, index, dir) {
46428
+ if (!part.data) return null;
46429
+ const rawData = part.data.includes(",") ? part.data.split(",").pop() || "" : part.data;
46430
+ if (!rawData) return null;
46431
+ fs6.mkdirSync(dir, { recursive: true });
46432
+ const filePath = path16.join(dir, safeInputImageBasename(index, part.mimeType));
46433
+ fs6.writeFileSync(filePath, Buffer.from(rawData, "base64"));
46434
+ return filePath;
46435
+ }
46436
+ function buildCliStructuredInputPrompt(input, options = {}) {
46437
+ const promptParts = [];
46438
+ const imageRefs = [];
46439
+ const resourceRefs = [];
46440
+ const materializeDir = options.materializeDir || path16.join(os12.tmpdir(), "adhdev-input-media");
46441
+ input.parts.forEach((part, index) => {
46442
+ if (part.type === "text" && part.text.trim()) {
46443
+ promptParts.push(part.text.trim());
46444
+ return;
46445
+ }
46446
+ if (part.type === "image") {
46447
+ const localPath = typeof part.uri === "string" ? filePathFromUri(part.uri) : null;
46448
+ const materializedPath = !localPath && part.data ? materializeImageDataPart(part, index, materializeDir) : null;
46449
+ const ref = localPath || materializedPath || part.uri || "";
46450
+ if (ref) imageRefs.push(ref);
46451
+ if (part.alt?.trim()) promptParts.push(part.alt.trim());
46452
+ return;
46453
+ }
46454
+ if (part.type === "resource_link") {
46455
+ resourceRefs.push([part.title, part.name, part.description, part.uri].filter(Boolean).join("\n"));
46456
+ return;
46457
+ }
46458
+ if (part.type === "resource") {
46459
+ resourceRefs.push([part.name, part.text, part.uri].filter(Boolean).join("\n"));
46460
+ }
46461
+ });
46462
+ if (input.textFallback.trim()) promptParts.push(input.textFallback.trim());
46463
+ const ordered = [
46464
+ ...imageRefs,
46465
+ ...promptParts,
46466
+ ...resourceRefs
46467
+ ].filter((value, index, values) => value.trim().length > 0 && values.indexOf(value) === index);
46468
+ return ordered.join("\n");
46469
+ }
46241
46470
  function normalizePersistableCliHistoryContent(content) {
46242
46471
  return flattenContent(content).replace(/\s+/g, " ").trim();
46243
46472
  }
@@ -46557,6 +46786,7 @@ ${effect.notification.body || ""}`.trim();
46557
46786
  resume: this.provider.resume,
46558
46787
  controlValues: surface.controlValues,
46559
46788
  providerControls: this.provider.controls,
46789
+ messageInput: getEffectiveMessageInputSupport(this.provider),
46560
46790
  summaryMetadata: surface.summaryMetadata,
46561
46791
  errorMessage: this.errorMessage,
46562
46792
  errorReason: this.errorReason
@@ -46607,9 +46837,10 @@ ${effect.notification.body || ""}`.trim();
46607
46837
  onEvent(event, data) {
46608
46838
  if (event === "send_message") {
46609
46839
  const input = normalizeInputEnvelope(data);
46610
- assertTextOnlyInput(this.provider, input);
46611
- if (input.textFallback) {
46612
- void this.adapter.sendMessage(input.textFallback).catch((e) => {
46840
+ assertProviderSupportsDeclaredInput(this.provider, input);
46841
+ const promptText = buildCliStructuredInputPrompt(input);
46842
+ if (promptText) {
46843
+ void this.adapter.sendMessage(promptText).catch((e) => {
46613
46844
  LOG2.warn("CLI", `[${this.type}] send_message failed: ${e?.message || e}`);
46614
46845
  });
46615
46846
  }
@@ -47236,6 +47467,7 @@ ${effect.notification.body || ""}`.trim();
47236
47467
  }
47237
47468
  }
47238
47469
  };
47470
+ var path17 = __toESM2(require("path"));
47239
47471
  var import_stream = require("stream");
47240
47472
  var import_child_process5 = require("child_process");
47241
47473
  var import_sdk = (init_acp(), __toCommonJS(acp_exports));
@@ -47255,6 +47487,31 @@ ${effect.notification.body || ""}`.trim();
47255
47487
  if (last?.type === "text" && last.text === normalized) return;
47256
47488
  promptParts.push({ type: "text", text: normalized });
47257
47489
  }
47490
+ function getUriDisplayName2(uri, fallback) {
47491
+ if (!uri) return fallback;
47492
+ try {
47493
+ const pathname = uri.startsWith("file://") ? new URL(uri).pathname : uri;
47494
+ return pathname.split(/[\\/]/).filter(Boolean).pop() || fallback;
47495
+ } catch {
47496
+ return uri.split(/[\\/]/).filter(Boolean).pop() || fallback;
47497
+ }
47498
+ }
47499
+ function appendResourceLink(promptParts, uri, fallbackName, mimeType, description, metadata) {
47500
+ promptParts.push({
47501
+ type: "resource_link",
47502
+ uri,
47503
+ name: metadata?.name || getUriDisplayName2(uri, fallbackName),
47504
+ ...metadata?.title ? { title: metadata.title } : {},
47505
+ ...mimeType ? { mimeType } : {},
47506
+ ...description ? { description } : {},
47507
+ ...typeof metadata?.size === "number" ? { size: metadata.size } : {},
47508
+ ...metadata?.annotations ? { annotations: metadata.annotations } : {}
47509
+ });
47510
+ }
47511
+ function appendMediaFallbackText(promptParts, label, details) {
47512
+ const normalizedDetails = details.map((value) => typeof value === "string" ? value.trim() : "").filter(Boolean);
47513
+ appendPromptText(promptParts, `[${[label, ...normalizedDetails].join(": ")}]`);
47514
+ }
47258
47515
  function buildAcpPromptParts(input, agentCapabilities) {
47259
47516
  const caps = getPromptCapabilityFlags(agentCapabilities);
47260
47517
  const promptParts = [];
@@ -47264,56 +47521,76 @@ ${effect.notification.body || ""}`.trim();
47264
47521
  continue;
47265
47522
  }
47266
47523
  if (part.type === "image") {
47267
- if (!caps.image) {
47268
- throw new Error("ACP agent does not support input type: image");
47269
- }
47270
- if (!part.data) {
47271
- throw new Error("ACP image input requires inline image data");
47524
+ if (caps.image && part.data) {
47525
+ promptParts.push({
47526
+ type: "image",
47527
+ data: part.data,
47528
+ mimeType: part.mimeType,
47529
+ ...part.uri ? { uri: part.uri } : {},
47530
+ ...part.alt ? { alt: part.alt } : {}
47531
+ });
47532
+ if (part.alt) appendPromptText(promptParts, part.alt);
47533
+ } else if (part.uri) {
47534
+ appendResourceLink(promptParts, part.uri, "image", part.mimeType, part.alt);
47535
+ if (part.alt) appendPromptText(promptParts, part.alt);
47536
+ } else {
47537
+ appendMediaFallbackText(promptParts, "Image attachment", [part.alt, part.mimeType]);
47272
47538
  }
47273
- promptParts.push({
47274
- type: "image",
47275
- data: part.data,
47276
- mimeType: part.mimeType,
47277
- ...part.uri ? { uri: part.uri } : {}
47278
- });
47279
47539
  continue;
47280
47540
  }
47281
47541
  if (part.type === "audio") {
47282
- if (!caps.audio) {
47283
- throw new Error("ACP agent does not support input type: audio");
47284
- }
47285
- if (!part.data) {
47286
- throw new Error("ACP audio input requires inline audio data");
47542
+ if (caps.audio && part.data) {
47543
+ promptParts.push({
47544
+ type: "audio",
47545
+ data: part.data,
47546
+ mimeType: part.mimeType,
47547
+ ...part.uri ? { uri: part.uri } : {},
47548
+ ...part.transcript ? { transcript: part.transcript } : {}
47549
+ });
47550
+ if (part.transcript) appendPromptText(promptParts, part.transcript);
47551
+ } else if (part.uri) {
47552
+ appendResourceLink(promptParts, part.uri, "audio", part.mimeType, part.transcript);
47553
+ if (part.transcript) appendPromptText(promptParts, part.transcript);
47554
+ } else {
47555
+ appendMediaFallbackText(promptParts, "Audio attachment", [part.transcript, part.mimeType]);
47287
47556
  }
47288
- promptParts.push({
47289
- type: "audio",
47290
- data: part.data,
47291
- mimeType: part.mimeType
47292
- });
47293
47557
  continue;
47294
47558
  }
47295
47559
  if (part.type === "resource") {
47296
- if (!caps.embeddedContext) {
47297
- throw new Error("ACP agent does not support input type: resource");
47298
- }
47299
- if (part.text) {
47560
+ if (caps.embeddedContext && part.text) {
47300
47561
  promptParts.push({
47301
47562
  type: "resource",
47302
47563
  resource: { uri: part.uri, text: part.text, mimeType: part.mimeType ?? null }
47303
47564
  });
47304
47565
  continue;
47305
47566
  }
47306
- if (part.data) {
47567
+ if (caps.embeddedContext && part.data) {
47307
47568
  promptParts.push({
47308
47569
  type: "resource",
47309
47570
  resource: { uri: part.uri, blob: part.data, mimeType: part.mimeType ?? null }
47310
47571
  });
47311
47572
  continue;
47312
47573
  }
47313
- throw new Error("ACP resource input requires embedded text or binary data");
47574
+ appendResourceLink(promptParts, part.uri, part.name || "resource", part.mimeType, part.text);
47575
+ if (part.text) appendPromptText(promptParts, part.text);
47576
+ continue;
47577
+ }
47578
+ if (part.type === "resource_link") {
47579
+ appendResourceLink(promptParts, part.uri, part.name, part.mimeType, part.description, {
47580
+ name: part.name,
47581
+ ...part.title ? { title: part.title } : {},
47582
+ ...typeof part.size === "number" ? { size: part.size } : {},
47583
+ ...part.annotations ? { annotations: part.annotations } : {}
47584
+ });
47585
+ continue;
47314
47586
  }
47315
47587
  if (part.type === "video") {
47316
- throw new Error("ACP agent does not support input type: video");
47588
+ if (part.uri) {
47589
+ appendResourceLink(promptParts, part.uri, "video", part.mimeType, part.transcript);
47590
+ if (part.transcript) appendPromptText(promptParts, part.transcript);
47591
+ } else {
47592
+ appendMediaFallbackText(promptParts, "Video attachment", [part.transcript, part.mimeType]);
47593
+ }
47317
47594
  }
47318
47595
  }
47319
47596
  if (!promptParts.some((part) => part.type === "text") && input.textFallback) {
@@ -47446,6 +47723,7 @@ ${effect.notification.body || ""}`.trim();
47446
47723
  lastUpdated: Date.now(),
47447
47724
  settings: this.settings,
47448
47725
  pendingEvents: this.flushEvents(),
47726
+ messageInput: getEffectiveMessageInputSupport(this.provider, this.agentCapabilities),
47449
47727
  // ACP-specific: expose available models/modes for dashboard
47450
47728
  acpConfigOptions: this.configOptions,
47451
47729
  acpModes: this.availableModes,
@@ -47947,22 +48225,38 @@ ${effect.notification.body || ""}`.trim();
47947
48225
  type: "image",
47948
48226
  data: b2.data,
47949
48227
  mimeType: b2.mimeType,
47950
- ...b2.uri ? { uri: b2.uri } : {}
48228
+ ...b2.uri ? { uri: b2.uri } : {},
48229
+ ...b2.alt ? { alt: b2.alt } : {}
47951
48230
  };
47952
48231
  }
47953
48232
  if (b2.type === "audio") {
47954
48233
  return {
47955
48234
  type: "audio",
47956
48235
  data: b2.data,
47957
- mimeType: b2.mimeType
48236
+ mimeType: b2.mimeType,
48237
+ ...b2.uri ? { uri: b2.uri } : {},
48238
+ ...b2.transcript ? { transcript: b2.transcript } : {}
47958
48239
  };
47959
48240
  }
48241
+ if (b2.type === "video") {
48242
+ return b2.uri ? {
48243
+ type: "resource_link",
48244
+ uri: b2.uri,
48245
+ name: path17.basename(b2.uri),
48246
+ mimeType: b2.mimeType,
48247
+ ...b2.transcript ? { description: b2.transcript } : {}
48248
+ } : { type: "text", text: b2.transcript || `[Video attachment: ${b2.mimeType}]` };
48249
+ }
47960
48250
  if (b2.type === "resource_link") {
47961
48251
  return {
47962
48252
  type: "resource_link",
47963
48253
  uri: b2.uri,
47964
48254
  name: b2.name,
47965
- ...b2.mimeType ? { mimeType: b2.mimeType } : {}
48255
+ ...b2.title ? { title: b2.title } : {},
48256
+ ...b2.description ? { description: b2.description } : {},
48257
+ ...b2.mimeType ? { mimeType: b2.mimeType } : {},
48258
+ ...typeof b2.size === "number" ? { size: b2.size } : {},
48259
+ ...b2.annotations ? { annotations: b2.annotations } : {}
47966
48260
  };
47967
48261
  }
47968
48262
  if (b2.type === "resource") return { type: "resource", resource: b2.resource };
@@ -48038,7 +48332,18 @@ ${effect.notification.body || ""}`.trim();
48038
48332
  this.partialBlocks.push({
48039
48333
  type: "audio",
48040
48334
  data: content.data,
48041
- mimeType: content.mimeType
48335
+ mimeType: content.mimeType,
48336
+ ...content.uri ? { uri: content.uri } : {},
48337
+ ...content.transcript ? { transcript: content.transcript } : {}
48338
+ });
48339
+ } else if (content.type === "video") {
48340
+ this.partialBlocks.push({
48341
+ type: "video",
48342
+ data: content.data,
48343
+ mimeType: content.mimeType,
48344
+ ...content.uri ? { uri: content.uri } : {},
48345
+ ...content.transcript ? { transcript: content.transcript } : {},
48346
+ ...content.posterUri ? { posterUri: content.posterUri } : {}
48042
48347
  });
48043
48348
  } else if (content.type === "resource_link") {
48044
48349
  this.partialBlocks.push({
@@ -48389,11 +48694,11 @@ ${rawInput}` : rawInput;
48389
48694
  }
48390
48695
  function isExplicitCommand(command) {
48391
48696
  const trimmed = command.trim();
48392
- return path17.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\") || trimmed.startsWith("~");
48697
+ return path18.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\") || trimmed.startsWith("~");
48393
48698
  }
48394
48699
  function expandExecutable(command) {
48395
48700
  const trimmed = command.trim();
48396
- return trimmed.startsWith("~") ? path17.join(os13.homedir(), trimmed.slice(1)) : trimmed;
48701
+ return trimmed.startsWith("~") ? path18.join(os13.homedir(), trimmed.slice(1)) : trimmed;
48397
48702
  }
48398
48703
  function commandExists(command) {
48399
48704
  const trimmed = command.trim();
@@ -48427,10 +48732,10 @@ ${rawInput}` : rawInput;
48427
48732
  return args.some((arg) => arg === flag || arg.startsWith(`${flag}=`));
48428
48733
  }
48429
48734
  function ensureEmptyDelegatedMcpConfig(workspace) {
48430
- const baseDir = path17.join(os13.tmpdir(), "adhdev-delegated-agent-empty-mcp");
48735
+ const baseDir = path18.join(os13.tmpdir(), "adhdev-delegated-agent-empty-mcp");
48431
48736
  (0, import_fs6.mkdirSync)(baseDir, { recursive: true });
48432
- const workspaceHash = crypto4.createHash("sha256").update(path17.resolve(workspace || os13.tmpdir())).digest("hex").slice(0, 16);
48433
- const filePath = path17.join(baseDir, `${workspaceHash}.json`);
48737
+ const workspaceHash = crypto4.createHash("sha256").update(path18.resolve(workspace || os13.tmpdir())).digest("hex").slice(0, 16);
48738
+ const filePath = path18.join(baseDir, `${workspaceHash}.json`);
48434
48739
  (0, import_fs6.writeFileSync)(filePath, JSON.stringify({ mcpServers: {} }, null, 2), "utf-8");
48435
48740
  return filePath;
48436
48741
  }
@@ -48703,7 +49008,7 @@ ${rawInput}` : rawInput;
48703
49008
  async startSession(cliType, workingDir, cliArgs, initialModel, options) {
48704
49009
  const trimmed = (workingDir || "").trim();
48705
49010
  if (!trimmed) throw new Error("working directory required");
48706
- const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os13.homedir()) : path17.resolve(trimmed);
49011
+ const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os13.homedir()) : path18.resolve(trimmed);
48707
49012
  const normalizedType = this.providerLoader.resolveAlias(cliType);
48708
49013
  const rawProvider = this.providerLoader.getByAlias(cliType);
48709
49014
  const provider = rawProvider ? this.providerLoader.resolve(normalizedType) || rawProvider : void 0;
@@ -49215,13 +49520,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
49215
49520
  var import_child_process7 = require("child_process");
49216
49521
  var net3 = __toESM2(require("net"));
49217
49522
  var os15 = __toESM2(require("os"));
49218
- var path19 = __toESM2(require("path"));
49523
+ var path20 = __toESM2(require("path"));
49219
49524
  var fs7 = __toESM2(require("fs"));
49220
- var path18 = __toESM2(require("path"));
49525
+ var path19 = __toESM2(require("path"));
49221
49526
  var os14 = __toESM2(require("os"));
49222
49527
  var chokidar = __toESM2(require_chokidar());
49223
49528
  init_logger();
49224
49529
  var VALID_CAPABILITY_MEDIA_TYPES = /* @__PURE__ */ new Set(["text", "image", "audio", "video", "resource"]);
49530
+ var VALID_INPUT_STRATEGIES2 = /* @__PURE__ */ new Set(["native", "native_acp", "resource_link", "text_fallback", "paste", "upload"]);
49225
49531
  var KNOWN_PROVIDER_FIELDS = /* @__PURE__ */ new Set([
49226
49532
  "type",
49227
49533
  "name",
@@ -49351,16 +49657,45 @@ Run 'adhdev doctor' for detailed diagnostics.`
49351
49657
  return;
49352
49658
  }
49353
49659
  const input = capabilities.input;
49354
- if (!input || typeof input !== "object") {
49355
- errors.push("capabilities.input is required");
49356
- } else {
49357
- if (typeof input.multipart !== "boolean") {
49660
+ if (input !== void 0) {
49661
+ if (!input || typeof input !== "object") {
49662
+ errors.push("capabilities.input must be an object when provided");
49663
+ } else if (typeof input.multipart !== "boolean") {
49358
49664
  errors.push("capabilities.input.multipart must be boolean");
49359
49665
  }
49360
- if (!Array.isArray(input.mediaTypes) || input.mediaTypes.length === 0) {
49361
- errors.push("capabilities.input.mediaTypes must be a non-empty array");
49362
- } else if (input.mediaTypes.some((type) => typeof type !== "string" || !VALID_CAPABILITY_MEDIA_TYPES.has(type))) {
49363
- errors.push(`capabilities.input.mediaTypes must only include: ${Array.from(VALID_CAPABILITY_MEDIA_TYPES).join(", ")}`);
49666
+ if (input && typeof input === "object") {
49667
+ const mediaTypes = Array.isArray(input.mediaTypes) ? input.mediaTypes : void 0;
49668
+ if (!mediaTypes || mediaTypes.length === 0) {
49669
+ errors.push("capabilities.input.mediaTypes must be a non-empty array");
49670
+ } else if (mediaTypes.some((type) => typeof type !== "string" || !VALID_CAPABILITY_MEDIA_TYPES.has(type))) {
49671
+ errors.push(`capabilities.input.mediaTypes must only include: ${Array.from(VALID_CAPABILITY_MEDIA_TYPES).join(", ")}`);
49672
+ }
49673
+ }
49674
+ if (input && typeof input === "object" && input.strategies !== void 0) {
49675
+ if (!Array.isArray(input.strategies)) {
49676
+ errors.push("capabilities.input.strategies must be an array when provided");
49677
+ } else {
49678
+ for (const strategy of input.strategies) {
49679
+ if (!strategy || typeof strategy !== "object" || Array.isArray(strategy)) {
49680
+ errors.push("capabilities.input.strategies entries must be objects");
49681
+ continue;
49682
+ }
49683
+ const entry = strategy;
49684
+ if (typeof entry.mediaType !== "string" || !VALID_CAPABILITY_MEDIA_TYPES.has(entry.mediaType)) {
49685
+ errors.push(`capabilities.input.strategies.mediaType must only include: ${Array.from(VALID_CAPABILITY_MEDIA_TYPES).join(", ")}`);
49686
+ }
49687
+ for (const field of ["strategies", "degradation"]) {
49688
+ const values = entry[field];
49689
+ if (values === void 0) continue;
49690
+ if (!Array.isArray(values) || values.some((value) => typeof value !== "string" || !VALID_INPUT_STRATEGIES2.has(value))) {
49691
+ errors.push(`capabilities.input.strategies.${field} must only include: ${Array.from(VALID_INPUT_STRATEGIES2).join(", ")}`);
49692
+ }
49693
+ }
49694
+ if (entry.native !== void 0 && typeof entry.native !== "boolean") {
49695
+ errors.push("capabilities.input.strategies.native must be boolean when provided");
49696
+ }
49697
+ }
49698
+ }
49364
49699
  }
49365
49700
  }
49366
49701
  const output = capabilities.output;
@@ -49537,7 +49872,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
49537
49872
  try {
49538
49873
  if (!fs7.existsSync(candidate) || !fs7.statSync(candidate).isDirectory()) return false;
49539
49874
  return ["ide", "extension", "cli", "acp"].some(
49540
- (category) => fs7.existsSync(path18.join(candidate, category))
49875
+ (category) => fs7.existsSync(path19.join(candidate, category))
49541
49876
  );
49542
49877
  } catch {
49543
49878
  return false;
@@ -49545,20 +49880,20 @@ Run 'adhdev doctor' for detailed diagnostics.`
49545
49880
  }
49546
49881
  static hasProviderRootMarker(candidate) {
49547
49882
  try {
49548
- return fs7.existsSync(path18.join(candidate, _ProviderLoader.SIBLING_MARKER_FILE));
49883
+ return fs7.existsSync(path19.join(candidate, _ProviderLoader.SIBLING_MARKER_FILE));
49549
49884
  } catch {
49550
49885
  return false;
49551
49886
  }
49552
49887
  }
49553
49888
  detectDefaultUserDir() {
49554
- const fallback = path18.join(os14.homedir(), ".adhdev", "providers");
49889
+ const fallback = path19.join(os14.homedir(), ".adhdev", "providers");
49555
49890
  const envOptIn = process.env[_ProviderLoader.SIBLING_ENV_VAR] === "1";
49556
49891
  const visited = /* @__PURE__ */ new Set();
49557
49892
  for (const start of this.probeStarts) {
49558
- let current = path18.resolve(start);
49893
+ let current = path19.resolve(start);
49559
49894
  while (!visited.has(current)) {
49560
49895
  visited.add(current);
49561
- const siblingCandidate = path18.join(path18.dirname(current), _ProviderLoader.REPO_PROVIDER_DIRNAME);
49896
+ const siblingCandidate = path19.join(path19.dirname(current), _ProviderLoader.REPO_PROVIDER_DIRNAME);
49562
49897
  if (_ProviderLoader.looksLikeProviderRoot(siblingCandidate)) {
49563
49898
  const hasMarker = _ProviderLoader.hasProviderRootMarker(siblingCandidate);
49564
49899
  if (envOptIn || hasMarker) {
@@ -49580,7 +49915,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
49580
49915
  return { path: siblingCandidate, source };
49581
49916
  }
49582
49917
  }
49583
- const parent = path18.dirname(current);
49918
+ const parent = path19.dirname(current);
49584
49919
  if (parent === current) break;
49585
49920
  current = parent;
49586
49921
  }
@@ -49590,11 +49925,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
49590
49925
  constructor(options) {
49591
49926
  this.logFn = options?.logFn || LOG2.forComponent("Provider").asLogFn();
49592
49927
  this.probeStarts = options?.probeStarts ?? [process.cwd(), __dirname];
49593
- this.defaultProvidersDir = path18.join(os14.homedir(), ".adhdev", "providers");
49928
+ this.defaultProvidersDir = path19.join(os14.homedir(), ".adhdev", "providers");
49594
49929
  const detected = this.detectDefaultUserDir();
49595
49930
  this.userDir = detected.path;
49596
49931
  this.userDirSource = detected.source;
49597
- this.upstreamDir = path18.join(this.defaultProvidersDir, ".upstream");
49932
+ this.upstreamDir = path19.join(this.defaultProvidersDir, ".upstream");
49598
49933
  this.disableUpstream = false;
49599
49934
  this.applySourceConfig({
49600
49935
  userDir: options?.userDir,
@@ -49653,7 +49988,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
49653
49988
  this.userDir = detected.path;
49654
49989
  this.userDirSource = detected.source;
49655
49990
  }
49656
- this.upstreamDir = path18.join(this.defaultProvidersDir, ".upstream");
49991
+ this.upstreamDir = path19.join(this.defaultProvidersDir, ".upstream");
49657
49992
  this.disableUpstream = this.sourceMode === "no-upstream";
49658
49993
  if (this.explicitProviderDir) {
49659
49994
  this.log(`Config 'providerDir' applied: ${this.userDir}`);
@@ -49667,7 +50002,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
49667
50002
  * Canonical provider directory shape for a given root.
49668
50003
  */
49669
50004
  getProviderDir(root, category, type) {
49670
- return path18.join(root, category, type);
50005
+ return path19.join(root, category, type);
49671
50006
  }
49672
50007
  /**
49673
50008
  * Canonical user override directory for a provider.
@@ -49694,7 +50029,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
49694
50029
  resolveProviderFile(type, ...segments) {
49695
50030
  const dir = this.findProviderDirInternal(type);
49696
50031
  if (!dir) return null;
49697
- return path18.join(dir, ...segments);
50032
+ return path19.join(dir, ...segments);
49698
50033
  }
49699
50034
  /**
49700
50035
  * Load all providers (3-tier priority)
@@ -49733,7 +50068,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
49733
50068
  if (!fs7.existsSync(this.upstreamDir)) return false;
49734
50069
  try {
49735
50070
  return fs7.readdirSync(this.upstreamDir).some(
49736
- (d) => fs7.statSync(path18.join(this.upstreamDir, d)).isDirectory()
50071
+ (d) => fs7.statSync(path19.join(this.upstreamDir, d)).isDirectory()
49737
50072
  );
49738
50073
  } catch {
49739
50074
  return false;
@@ -50230,8 +50565,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
50230
50565
  resolved._resolvedScriptDir = entry.scriptDir;
50231
50566
  resolved._resolvedScriptsSource = `compatibility:${entry.ideVersion}`;
50232
50567
  if (providerDir) {
50233
- const fullDir = path18.join(providerDir, entry.scriptDir);
50234
- resolved._resolvedScriptsPath = fs7.existsSync(path18.join(fullDir, "scripts.js")) ? path18.join(fullDir, "scripts.js") : fullDir;
50568
+ const fullDir = path19.join(providerDir, entry.scriptDir);
50569
+ resolved._resolvedScriptsPath = fs7.existsSync(path19.join(fullDir, "scripts.js")) ? path19.join(fullDir, "scripts.js") : fullDir;
50235
50570
  }
50236
50571
  matched = true;
50237
50572
  }
@@ -50246,8 +50581,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
50246
50581
  resolved._resolvedScriptDir = base.defaultScriptDir;
50247
50582
  resolved._resolvedScriptsSource = "defaultScriptDir:version_miss";
50248
50583
  if (providerDir) {
50249
- const fullDir = path18.join(providerDir, base.defaultScriptDir);
50250
- resolved._resolvedScriptsPath = fs7.existsSync(path18.join(fullDir, "scripts.js")) ? path18.join(fullDir, "scripts.js") : fullDir;
50584
+ const fullDir = path19.join(providerDir, base.defaultScriptDir);
50585
+ resolved._resolvedScriptsPath = fs7.existsSync(path19.join(fullDir, "scripts.js")) ? path19.join(fullDir, "scripts.js") : fullDir;
50251
50586
  }
50252
50587
  }
50253
50588
  resolved._versionWarning = `Version ${currentVersion} not in compatibility matrix. Using default scripts.`;
@@ -50264,8 +50599,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
50264
50599
  resolved._resolvedScriptDir = dirOverride;
50265
50600
  resolved._resolvedScriptsSource = `versions:${range}`;
50266
50601
  if (providerDir) {
50267
- const fullDir = path18.join(providerDir, dirOverride);
50268
- resolved._resolvedScriptsPath = fs7.existsSync(path18.join(fullDir, "scripts.js")) ? path18.join(fullDir, "scripts.js") : fullDir;
50602
+ const fullDir = path19.join(providerDir, dirOverride);
50603
+ resolved._resolvedScriptsPath = fs7.existsSync(path19.join(fullDir, "scripts.js")) ? path19.join(fullDir, "scripts.js") : fullDir;
50269
50604
  }
50270
50605
  }
50271
50606
  } else if (override.scripts) {
@@ -50281,8 +50616,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
50281
50616
  resolved._resolvedScriptDir = base.defaultScriptDir;
50282
50617
  resolved._resolvedScriptsSource = "defaultScriptDir:no_version";
50283
50618
  if (providerDir) {
50284
- const fullDir = path18.join(providerDir, base.defaultScriptDir);
50285
- resolved._resolvedScriptsPath = fs7.existsSync(path18.join(fullDir, "scripts.js")) ? path18.join(fullDir, "scripts.js") : fullDir;
50619
+ const fullDir = path19.join(providerDir, base.defaultScriptDir);
50620
+ resolved._resolvedScriptsPath = fs7.existsSync(path19.join(fullDir, "scripts.js")) ? path19.join(fullDir, "scripts.js") : fullDir;
50286
50621
  }
50287
50622
  }
50288
50623
  }
@@ -50314,14 +50649,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
50314
50649
  this.log(` [loadScriptsFromDir] ${type}: providerDir not found`);
50315
50650
  return null;
50316
50651
  }
50317
- const dir = path18.join(providerDir, scriptDir);
50652
+ const dir = path19.join(providerDir, scriptDir);
50318
50653
  if (!fs7.existsSync(dir)) {
50319
50654
  this.log(` [loadScriptsFromDir] ${type}: dir not found: ${dir}`);
50320
50655
  return null;
50321
50656
  }
50322
50657
  const cached2 = this.scriptsCache.get(dir);
50323
50658
  if (cached2) return cached2;
50324
- const scriptsJs = path18.join(dir, "scripts.js");
50659
+ const scriptsJs = path19.join(dir, "scripts.js");
50325
50660
  if (fs7.existsSync(scriptsJs)) {
50326
50661
  try {
50327
50662
  delete require.cache[require.resolve(scriptsJs)];
@@ -50363,7 +50698,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
50363
50698
  return;
50364
50699
  }
50365
50700
  if (filePath.endsWith(".js") || filePath.endsWith(".json")) {
50366
- this.log(`File changed: ${path18.basename(filePath)}, reloading...`);
50701
+ this.log(`File changed: ${path19.basename(filePath)}, reloading...`);
50367
50702
  this.reload();
50368
50703
  }
50369
50704
  };
@@ -50418,7 +50753,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
50418
50753
  }
50419
50754
  const https = require("https");
50420
50755
  const { execSync: execSync7 } = require("child_process");
50421
- const metaPath = path18.join(this.upstreamDir, _ProviderLoader.META_FILE);
50756
+ const metaPath = path19.join(this.upstreamDir, _ProviderLoader.META_FILE);
50422
50757
  let prevEtag = "";
50423
50758
  let prevTimestamp = 0;
50424
50759
  try {
@@ -50478,17 +50813,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
50478
50813
  return { updated: false };
50479
50814
  }
50480
50815
  this.log("Downloading latest providers from GitHub...");
50481
- const tmpTar = path18.join(os14.tmpdir(), `adhdev-providers-${Date.now()}.tar.gz`);
50482
- const tmpExtract = path18.join(os14.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
50816
+ const tmpTar = path19.join(os14.tmpdir(), `adhdev-providers-${Date.now()}.tar.gz`);
50817
+ const tmpExtract = path19.join(os14.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
50483
50818
  await this.downloadFile(_ProviderLoader.GITHUB_TARBALL_URL, tmpTar);
50484
50819
  fs7.mkdirSync(tmpExtract, { recursive: true });
50485
50820
  execSync7(`tar -xzf "${tmpTar}" -C "${tmpExtract}"`, { timeout: 3e4 });
50486
50821
  const extracted = fs7.readdirSync(tmpExtract);
50487
50822
  const rootDir = extracted.find(
50488
- (d) => fs7.statSync(path18.join(tmpExtract, d)).isDirectory() && d.startsWith("adhdev-providers")
50823
+ (d) => fs7.statSync(path19.join(tmpExtract, d)).isDirectory() && d.startsWith("adhdev-providers")
50489
50824
  );
50490
50825
  if (!rootDir) throw new Error("Unexpected tarball structure");
50491
- const sourceDir = path18.join(tmpExtract, rootDir);
50826
+ const sourceDir = path19.join(tmpExtract, rootDir);
50492
50827
  const backupDir = this.upstreamDir + ".bak";
50493
50828
  if (fs7.existsSync(this.upstreamDir)) {
50494
50829
  if (fs7.existsSync(backupDir)) fs7.rmSync(backupDir, { recursive: true, force: true });
@@ -50563,8 +50898,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
50563
50898
  copyDirRecursive(src, dest) {
50564
50899
  fs7.mkdirSync(dest, { recursive: true });
50565
50900
  for (const entry of fs7.readdirSync(src, { withFileTypes: true })) {
50566
- const srcPath = path18.join(src, entry.name);
50567
- const destPath = path18.join(dest, entry.name);
50901
+ const srcPath = path19.join(src, entry.name);
50902
+ const destPath = path19.join(dest, entry.name);
50568
50903
  if (entry.isDirectory()) {
50569
50904
  this.copyDirRecursive(srcPath, destPath);
50570
50905
  } else {
@@ -50575,7 +50910,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
50575
50910
  /** .meta.json save */
50576
50911
  writeMeta(metaPath, etag, timestamp) {
50577
50912
  try {
50578
- fs7.mkdirSync(path18.dirname(metaPath), { recursive: true });
50913
+ fs7.mkdirSync(path19.dirname(metaPath), { recursive: true });
50579
50914
  fs7.writeFileSync(metaPath, JSON.stringify({
50580
50915
  etag,
50581
50916
  timestamp,
@@ -50592,7 +50927,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
50592
50927
  const scan = (d) => {
50593
50928
  try {
50594
50929
  for (const entry of fs7.readdirSync(d, { withFileTypes: true })) {
50595
- if (entry.isDirectory()) scan(path18.join(d, entry.name));
50930
+ if (entry.isDirectory()) scan(path19.join(d, entry.name));
50596
50931
  else if (entry.name === "provider.json") count++;
50597
50932
  }
50598
50933
  } catch {
@@ -50820,17 +51155,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
50820
51155
  for (const root of searchRoots) {
50821
51156
  if (!fs7.existsSync(root)) continue;
50822
51157
  const candidate = this.getProviderDir(root, cat, type);
50823
- if (fs7.existsSync(path18.join(candidate, "provider.json"))) return candidate;
50824
- const catDir = path18.join(root, cat);
51158
+ if (fs7.existsSync(path19.join(candidate, "provider.json"))) return candidate;
51159
+ const catDir = path19.join(root, cat);
50825
51160
  if (fs7.existsSync(catDir)) {
50826
51161
  try {
50827
51162
  for (const entry of fs7.readdirSync(catDir, { withFileTypes: true })) {
50828
51163
  if (!entry.isDirectory()) continue;
50829
- const jsonPath = path18.join(catDir, entry.name, "provider.json");
51164
+ const jsonPath = path19.join(catDir, entry.name, "provider.json");
50830
51165
  if (fs7.existsSync(jsonPath)) {
50831
51166
  try {
50832
51167
  const data = JSON.parse(fs7.readFileSync(jsonPath, "utf-8"));
50833
- if (data.type === type) return path18.join(catDir, entry.name);
51168
+ if (data.type === type) return path19.join(catDir, entry.name);
50834
51169
  } catch {
50835
51170
  }
50836
51171
  }
@@ -50847,7 +51182,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
50847
51182
  * (template substitution is NOT applied here — scripts.js handles that)
50848
51183
  */
50849
51184
  buildScriptWrappersFromDir(dir) {
50850
- const scriptsJs = path18.join(dir, "scripts.js");
51185
+ const scriptsJs = path19.join(dir, "scripts.js");
50851
51186
  if (fs7.existsSync(scriptsJs)) {
50852
51187
  try {
50853
51188
  delete require.cache[require.resolve(scriptsJs)];
@@ -50861,7 +51196,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
50861
51196
  for (const file2 of fs7.readdirSync(dir)) {
50862
51197
  if (!file2.endsWith(".js")) continue;
50863
51198
  const scriptName = toCamel(file2.replace(".js", ""));
50864
- const filePath = path18.join(dir, file2);
51199
+ const filePath = path19.join(dir, file2);
50865
51200
  result[scriptName] = (...args) => {
50866
51201
  try {
50867
51202
  let content = fs7.readFileSync(filePath, "utf-8");
@@ -50921,7 +51256,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
50921
51256
  }
50922
51257
  const hasJson = entries.some((e) => e.name === "provider.json");
50923
51258
  if (hasJson) {
50924
- const jsonPath = path18.join(d, "provider.json");
51259
+ const jsonPath = path19.join(d, "provider.json");
50925
51260
  try {
50926
51261
  const raw = fs7.readFileSync(jsonPath, "utf-8");
50927
51262
  const mod = JSON.parse(raw);
@@ -50942,7 +51277,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
50942
51277
  this.log(`\u26A0 Invalid provider at ${jsonPath}: ${validation.errors.join("; ")}`);
50943
51278
  } else {
50944
51279
  const hasCompatibility = Array.isArray(normalizedProvider.compatibility);
50945
- const scriptsPath = path18.join(d, "scripts.js");
51280
+ const scriptsPath = path19.join(d, "scripts.js");
50946
51281
  if (!hasCompatibility && fs7.existsSync(scriptsPath)) {
50947
51282
  try {
50948
51283
  delete require.cache[require.resolve(scriptsPath)];
@@ -50968,7 +51303,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
50968
51303
  if (!entry.isDirectory()) continue;
50969
51304
  if (entry.name.startsWith("_") || entry.name.startsWith(".")) continue;
50970
51305
  if (excludeDirs && d === dir && excludeDirs.includes(entry.name)) continue;
50971
- scan(path18.join(d, entry.name));
51306
+ scan(path19.join(d, entry.name));
50972
51307
  }
50973
51308
  }
50974
51309
  };
@@ -51289,8 +51624,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
51289
51624
  const appNameMap = getMacAppIdentifiers();
51290
51625
  const appName = appNameMap[ideId];
51291
51626
  if (appName) {
51292
- const storagePath = path19.join(
51293
- process.env.APPDATA || path19.join(os15.homedir(), "AppData", "Roaming"),
51627
+ const storagePath = path20.join(
51628
+ process.env.APPDATA || path20.join(os15.homedir(), "AppData", "Roaming"),
51294
51629
  appName,
51295
51630
  "storage.json"
51296
51631
  );
@@ -51475,9 +51810,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
51475
51810
  init_config();
51476
51811
  init_logger();
51477
51812
  var fs8 = __toESM2(require("fs"));
51478
- var path20 = __toESM2(require("path"));
51813
+ var path21 = __toESM2(require("path"));
51479
51814
  var os16 = __toESM2(require("os"));
51480
- var LOG_DIR2 = process.platform === "win32" ? path20.join(process.env.LOCALAPPDATA || process.env.APPDATA || path20.join(os16.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path20.join(os16.homedir(), "Library", "Logs", "adhdev") : path20.join(os16.homedir(), ".local", "share", "adhdev", "logs");
51815
+ var LOG_DIR2 = process.platform === "win32" ? path21.join(process.env.LOCALAPPDATA || process.env.APPDATA || path21.join(os16.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path21.join(os16.homedir(), "Library", "Logs", "adhdev") : path21.join(os16.homedir(), ".local", "share", "adhdev", "logs");
51481
51816
  var MAX_FILE_SIZE = 5 * 1024 * 1024;
51482
51817
  var MAX_DAYS = 7;
51483
51818
  try {
@@ -51515,13 +51850,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
51515
51850
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
51516
51851
  }
51517
51852
  var currentDate2 = getDateStr2();
51518
- var currentFile = path20.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
51853
+ var currentFile = path21.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
51519
51854
  var writeCount2 = 0;
51520
51855
  function checkRotation() {
51521
51856
  const today = getDateStr2();
51522
51857
  if (today !== currentDate2) {
51523
51858
  currentDate2 = today;
51524
- currentFile = path20.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
51859
+ currentFile = path21.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
51525
51860
  cleanOldFiles();
51526
51861
  }
51527
51862
  }
@@ -51535,7 +51870,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
51535
51870
  const dateMatch = file2.match(/commands-(\d{4}-\d{2}-\d{2})/);
51536
51871
  if (dateMatch && dateMatch[1] < cutoffStr) {
51537
51872
  try {
51538
- fs8.unlinkSync(path20.join(LOG_DIR2, file2));
51873
+ fs8.unlinkSync(path21.join(LOG_DIR2, file2));
51539
51874
  } catch {
51540
51875
  }
51541
51876
  }
@@ -51619,6 +51954,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
51619
51954
  var yaml = __toESM2(require_js_yaml());
51620
51955
  init_logger();
51621
51956
  var import_node_child_process3 = require("child_process");
51957
+ var import_node_crypto2 = require("crypto");
51622
51958
  var import_node_fs3 = require("fs");
51623
51959
  var import_node_module2 = require("module");
51624
51960
  var os17 = __toESM2(require("os"));
@@ -51643,7 +51979,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
51643
51979
  reason: "Could not resolve the ADHDev MCP server entrypoint and a Node runtime with WebSocket support for daemon IPC mode"
51644
51980
  };
51645
51981
  }
51646
- const configPath = resolveMcpConfigPath(HERMES_MCP_CONFIG_PATH, options.workspace);
51982
+ const configPath = (0, import_node_path.join)(resolveHermesCoordinatorHome(options.meshId, options.workspace), "config.yaml");
51647
51983
  if (!configPath.trim()) {
51648
51984
  return createHermesManualMeshCoordinatorSetup(options.meshId, options.workspace);
51649
51985
  }
@@ -51695,8 +52031,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
51695
52031
  }
51696
52032
  const serverName = mcpConfig.serverName?.trim() || DEFAULT_SERVER_NAME;
51697
52033
  if (mcpConfig.mode === "auto_import") {
51698
- const path27 = mcpConfig.path?.trim();
51699
- if (!path27) {
52034
+ const path28 = mcpConfig.path?.trim();
52035
+ if (!path28) {
51700
52036
  return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
51701
52037
  }
51702
52038
  const mcpServer = resolveAdhdevMcpServerLaunch({
@@ -51713,7 +52049,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
51713
52049
  return {
51714
52050
  kind: "auto_import",
51715
52051
  serverName,
51716
- configPath: resolveMcpConfigPath(path27, workspace),
52052
+ configPath: resolveMcpConfigPath(path28, workspace),
51717
52053
  configFormat: mcpConfig.format,
51718
52054
  mcpServer
51719
52055
  };
@@ -51747,6 +52083,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
51747
52083
  function renderMeshCoordinatorTemplate(template, values) {
51748
52084
  return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand)\s*\}\}/g, (_, key) => values[key] || "");
51749
52085
  }
52086
+ function resolveHermesCoordinatorHome(meshId, workspace) {
52087
+ const key = `${meshId || "mesh"}
52088
+ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
52089
+ const hash2 = (0, import_node_crypto2.createHash)("sha256").update(key).digest("hex").slice(0, 16);
52090
+ return (0, import_node_path.join)(os17.tmpdir(), `adhdev-hermes-mesh-coordinator-${hash2}`);
52091
+ }
51750
52092
  function resolveMcpConfigPath(configPath, workspace) {
51751
52093
  const trimmed = configPath.trim();
51752
52094
  if (trimmed === "~") return os17.homedir();
@@ -52274,13 +52616,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
52274
52616
  var import_child_process9 = require("child_process");
52275
52617
  var fs9 = __toESM2(require("fs"));
52276
52618
  var os19 = __toESM2(require("os"));
52277
- var path21 = __toESM2(require("path"));
52619
+ var path222 = __toESM2(require("path"));
52278
52620
  var UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
52279
52621
  function getUpgradeLogPath() {
52280
52622
  const home = os19.homedir();
52281
- const dir = path21.join(home, ".adhdev");
52623
+ const dir = path222.join(home, ".adhdev");
52282
52624
  fs9.mkdirSync(dir, { recursive: true });
52283
- return path21.join(dir, "daemon-upgrade.log");
52625
+ return path222.join(dir, "daemon-upgrade.log");
52284
52626
  }
52285
52627
  function appendUpgradeLog(message) {
52286
52628
  const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${message}
@@ -52291,14 +52633,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
52291
52633
  }
52292
52634
  }
52293
52635
  function resolveSiblingNpmInvocation(nodeExecutable, platform10 = process.platform) {
52294
- const binDir = path21.dirname(nodeExecutable);
52636
+ const binDir = path222.dirname(nodeExecutable);
52295
52637
  if (platform10 === "win32") {
52296
- const npmCliPath = path21.join(binDir, "node_modules", "npm", "bin", "npm-cli.js");
52638
+ const npmCliPath = path222.join(binDir, "node_modules", "npm", "bin", "npm-cli.js");
52297
52639
  if (fs9.existsSync(npmCliPath)) {
52298
52640
  return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: getNpmExecOptions(platform10) };
52299
52641
  }
52300
52642
  for (const candidate of ["npm.exe", "npm"]) {
52301
- const candidatePath = path21.join(binDir, candidate);
52643
+ const candidatePath = path222.join(binDir, candidate);
52302
52644
  if (fs9.existsSync(candidatePath)) {
52303
52645
  return { executable: candidatePath, argsPrefix: [], execOptions: getNpmExecOptions(platform10) };
52304
52646
  }
@@ -52306,7 +52648,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
52306
52648
  return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: getNpmExecOptions(platform10) };
52307
52649
  }
52308
52650
  for (const candidate of ["npm"]) {
52309
- const candidatePath = path21.join(binDir, candidate);
52651
+ const candidatePath = path222.join(binDir, candidate);
52310
52652
  if (fs9.existsSync(candidatePath)) {
52311
52653
  return { executable: candidatePath, argsPrefix: [], execOptions: getNpmExecOptions(platform10) };
52312
52654
  }
@@ -52323,13 +52665,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
52323
52665
  let currentDir = resolvedPath;
52324
52666
  try {
52325
52667
  if (fs9.statSync(resolvedPath).isFile()) {
52326
- currentDir = path21.dirname(resolvedPath);
52668
+ currentDir = path222.dirname(resolvedPath);
52327
52669
  }
52328
52670
  } catch {
52329
- currentDir = path21.dirname(resolvedPath);
52671
+ currentDir = path222.dirname(resolvedPath);
52330
52672
  }
52331
52673
  while (true) {
52332
- const packageJsonPath = path21.join(currentDir, "package.json");
52674
+ const packageJsonPath = path222.join(currentDir, "package.json");
52333
52675
  try {
52334
52676
  if (fs9.existsSync(packageJsonPath)) {
52335
52677
  const parsed = JSON.parse(fs9.readFileSync(packageJsonPath, "utf8"));
@@ -52340,7 +52682,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
52340
52682
  }
52341
52683
  } catch {
52342
52684
  }
52343
- const parentDir = path21.dirname(currentDir);
52685
+ const parentDir = path222.dirname(currentDir);
52344
52686
  if (parentDir === currentDir) {
52345
52687
  return null;
52346
52688
  }
@@ -52348,13 +52690,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
52348
52690
  }
52349
52691
  }
52350
52692
  function resolveInstallPrefixFromPackageRoot(packageRoot, packageName) {
52351
- const nodeModulesDir = packageName.startsWith("@") ? path21.dirname(path21.dirname(packageRoot)) : path21.dirname(packageRoot);
52352
- if (path21.basename(nodeModulesDir) !== "node_modules") {
52693
+ const nodeModulesDir = packageName.startsWith("@") ? path222.dirname(path222.dirname(packageRoot)) : path222.dirname(packageRoot);
52694
+ if (path222.basename(nodeModulesDir) !== "node_modules") {
52353
52695
  return null;
52354
52696
  }
52355
- const maybeLibDir = path21.dirname(nodeModulesDir);
52356
- if (path21.basename(maybeLibDir) === "lib") {
52357
- return path21.dirname(maybeLibDir);
52697
+ const maybeLibDir = path222.dirname(nodeModulesDir);
52698
+ if (path222.basename(maybeLibDir) === "lib") {
52699
+ return path222.dirname(maybeLibDir);
52358
52700
  }
52359
52701
  return maybeLibDir;
52360
52702
  }
@@ -52469,7 +52811,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
52469
52811
  }
52470
52812
  }
52471
52813
  function stopSessionHostProcesses(appName) {
52472
- const pidFile = path21.join(os19.homedir(), ".adhdev", `${appName}-session-host.pid`);
52814
+ const pidFile = path222.join(os19.homedir(), ".adhdev", `${appName}-session-host.pid`);
52473
52815
  try {
52474
52816
  if (fs9.existsSync(pidFile)) {
52475
52817
  const pid = Number.parseInt(fs9.readFileSync(pidFile, "utf8").trim(), 10);
@@ -52486,7 +52828,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
52486
52828
  }
52487
52829
  }
52488
52830
  function removeDaemonPidFile() {
52489
- const pidFile = path21.join(os19.homedir(), ".adhdev", "daemon.pid");
52831
+ const pidFile = path222.join(os19.homedir(), ".adhdev", "daemon.pid");
52490
52832
  try {
52491
52833
  fs9.unlinkSync(pidFile);
52492
52834
  } catch {
@@ -52497,7 +52839,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
52497
52839
  const npmRoot = String(execNpmCommandSync(["root", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
52498
52840
  if (!npmRoot) return;
52499
52841
  const npmPrefix = surface.installPrefix || String(execNpmCommandSync(["prefix", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
52500
- const binDir = process.platform === "win32" ? npmPrefix : path21.join(npmPrefix, "bin");
52842
+ const binDir = process.platform === "win32" ? npmPrefix : path222.join(npmPrefix, "bin");
52501
52843
  const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
52502
52844
  const binNames = /* @__PURE__ */ new Set([packageBaseName]);
52503
52845
  if (pkgName === "@adhdev/daemon-standalone") {
@@ -52505,25 +52847,25 @@ Run 'adhdev doctor' for detailed diagnostics.`
52505
52847
  }
52506
52848
  if (pkgName.startsWith("@")) {
52507
52849
  const [scope, name] = pkgName.split("/");
52508
- const scopeDir = path21.join(npmRoot, scope);
52850
+ const scopeDir = path222.join(npmRoot, scope);
52509
52851
  if (!fs9.existsSync(scopeDir)) return;
52510
52852
  for (const entry of fs9.readdirSync(scopeDir)) {
52511
52853
  if (!entry.startsWith(`.${name}-`)) continue;
52512
- fs9.rmSync(path21.join(scopeDir, entry), { recursive: true, force: true });
52513
- appendUpgradeLog(`Removed stale scoped staging dir: ${path21.join(scopeDir, entry)}`);
52854
+ fs9.rmSync(path222.join(scopeDir, entry), { recursive: true, force: true });
52855
+ appendUpgradeLog(`Removed stale scoped staging dir: ${path222.join(scopeDir, entry)}`);
52514
52856
  }
52515
52857
  } else {
52516
52858
  for (const entry of fs9.readdirSync(npmRoot)) {
52517
52859
  if (!entry.startsWith(`.${pkgName}-`)) continue;
52518
- fs9.rmSync(path21.join(npmRoot, entry), { recursive: true, force: true });
52519
- appendUpgradeLog(`Removed stale staging dir: ${path21.join(npmRoot, entry)}`);
52860
+ fs9.rmSync(path222.join(npmRoot, entry), { recursive: true, force: true });
52861
+ appendUpgradeLog(`Removed stale staging dir: ${path222.join(npmRoot, entry)}`);
52520
52862
  }
52521
52863
  }
52522
52864
  if (fs9.existsSync(binDir)) {
52523
52865
  for (const entry of fs9.readdirSync(binDir)) {
52524
52866
  if (!Array.from(binNames).some((name) => entry.startsWith(`.${name}-`))) continue;
52525
- fs9.rmSync(path21.join(binDir, entry), { recursive: true, force: true });
52526
- appendUpgradeLog(`Removed stale bin staging entry: ${path21.join(binDir, entry)}`);
52867
+ fs9.rmSync(path222.join(binDir, entry), { recursive: true, force: true });
52868
+ appendUpgradeLog(`Removed stale bin staging entry: ${path222.join(binDir, entry)}`);
52527
52869
  }
52528
52870
  }
52529
52871
  }
@@ -53893,7 +54235,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
53893
54235
  workspace
53894
54236
  };
53895
54237
  }
53896
- const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync: writeFileSync13, copyFileSync: copyFileSync3, mkdirSync: mkdirSync15 } = await import("fs");
54238
+ const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync: writeFileSync14, copyFileSync: copyFileSync3, mkdirSync: mkdirSync16 } = await import("fs");
53897
54239
  const { dirname: dirname9 } = await import("path");
53898
54240
  const mcpConfigPath = coordinatorSetup.configPath;
53899
54241
  const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
@@ -53917,7 +54259,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
53917
54259
  };
53918
54260
  }
53919
54261
  try {
53920
- mkdirSync15(dirname9(mcpConfigPath), { recursive: true });
54262
+ mkdirSync16(dirname9(mcpConfigPath), { recursive: true });
53921
54263
  } catch (error48) {
53922
54264
  const message = `Could not prepare MCP config path for automatic setup: ${error48?.message || error48}`;
53923
54265
  LOG2.error("MeshCoordinator", message);
@@ -53949,7 +54291,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
53949
54291
  }
53950
54292
  };
53951
54293
  try {
53952
- writeFileSync13(mcpConfigPath, serializeMeshCoordinatorMcpConfig(mcpConfig, configFormat), "utf-8");
54294
+ writeFileSync14(mcpConfigPath, serializeMeshCoordinatorMcpConfig(mcpConfig, configFormat), "utf-8");
53953
54295
  } catch (error48) {
53954
54296
  const message = `Could not write MCP config for automatic setup: ${error48?.message || error48}`;
53955
54297
  LOG2.error("MeshCoordinator", message);
@@ -53959,6 +54301,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
53959
54301
  LOG2.info("MeshCoordinator", `Wrote ${mcpConfigPath} with ${coordinatorSetup.serverName} server`);
53960
54302
  const cliArgs = [];
53961
54303
  const launchEnv = {};
54304
+ if (configFormat === "hermes_config_yaml") {
54305
+ launchEnv.HERMES_HOME = dirname9(mcpConfigPath);
54306
+ launchEnv.HERMES_IGNORE_USER_CONFIG = "";
54307
+ }
53962
54308
  if (systemPrompt) {
53963
54309
  if (configFormat === "hermes_config_yaml") {
53964
54310
  launchEnv.HERMES_EPHEMERAL_SYSTEM_PROMPT = systemPrompt;
@@ -55633,11 +55979,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
55633
55979
  }
55634
55980
  };
55635
55981
  var fs11 = __toESM2(require("fs"));
55636
- var path222 = __toESM2(require("path"));
55982
+ var path232 = __toESM2(require("path"));
55637
55983
  var os20 = __toESM2(require("os"));
55638
55984
  var import_child_process10 = require("child_process");
55639
55985
  var import_os3 = require("os");
55640
- var ARCHIVE_PATH = path222.join(os20.homedir(), ".adhdev", "version-history.json");
55986
+ var ARCHIVE_PATH = path232.join(os20.homedir(), ".adhdev", "version-history.json");
55641
55987
  var MAX_ENTRIES_PER_PROVIDER = 20;
55642
55988
  var VersionArchive = class {
55643
55989
  history = {};
@@ -55684,7 +56030,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
55684
56030
  }
55685
56031
  save() {
55686
56032
  try {
55687
- fs11.mkdirSync(path222.dirname(ARCHIVE_PATH), { recursive: true });
56033
+ fs11.mkdirSync(path232.dirname(ARCHIVE_PATH), { recursive: true });
55688
56034
  fs11.writeFileSync(ARCHIVE_PATH, JSON.stringify(this.history, null, 2));
55689
56035
  } catch {
55690
56036
  }
@@ -55741,7 +56087,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
55741
56087
  for (const p of paths) {
55742
56088
  if (p.includes("*")) {
55743
56089
  const home = os20.homedir();
55744
- const resolved = p.replace(/\*/g, home.split(path222.sep).pop() || "");
56090
+ const resolved = p.replace(/\*/g, home.split(path232.sep).pop() || "");
55745
56091
  if (fs11.existsSync(resolved)) return resolved;
55746
56092
  } else {
55747
56093
  if (fs11.existsSync(p)) return p;
@@ -55751,7 +56097,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
55751
56097
  }
55752
56098
  function getMacAppVersion(appPath) {
55753
56099
  if ((0, import_os3.platform)() !== "darwin" || !appPath.endsWith(".app")) return null;
55754
- const plistPath = path222.join(appPath, "Contents", "Info.plist");
56100
+ const plistPath = path232.join(appPath, "Contents", "Info.plist");
55755
56101
  if (!fs11.existsSync(plistPath)) return null;
55756
56102
  const raw = runCommand(`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plistPath}"`);
55757
56103
  return raw || null;
@@ -55777,7 +56123,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
55777
56123
  const cliBin = provider.cli ? findBinary2(provider.cli) : null;
55778
56124
  let resolvedBin = cliBin;
55779
56125
  if (!resolvedBin && appPath && currentOs === "darwin") {
55780
- const bundled = path222.join(appPath, "Contents", "Resources", "app", "bin", provider.cli || "");
56126
+ const bundled = path232.join(appPath, "Contents", "Resources", "app", "bin", provider.cli || "");
55781
56127
  if (provider.cli && fs11.existsSync(bundled)) resolvedBin = bundled;
55782
56128
  }
55783
56129
  info.installed = !!(appPath || resolvedBin);
@@ -55816,7 +56162,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
55816
56162
  }
55817
56163
  var http2 = __toESM2(require("http"));
55818
56164
  var fs15 = __toESM2(require("fs"));
55819
- var path26 = __toESM2(require("path"));
56165
+ var path27 = __toESM2(require("path"));
55820
56166
  init_config();
55821
56167
  function generateFiles(type, name, category, opts = {}) {
55822
56168
  const { cdpPorts, cli, processName, installPath, binary, extensionId, version: version2 = "0.1" } = opts;
@@ -56161,7 +56507,7 @@ async (params) => {
56161
56507
  }
56162
56508
  init_logger();
56163
56509
  var fs12 = __toESM2(require("fs"));
56164
- var path232 = __toESM2(require("path"));
56510
+ var path24 = __toESM2(require("path"));
56165
56511
  init_logger();
56166
56512
  async function handleCdpEvaluate(ctx, req, res) {
56167
56513
  const body = await ctx.readBody(req);
@@ -56340,17 +56686,17 @@ async (params) => {
56340
56686
  return;
56341
56687
  }
56342
56688
  let scriptsPath = "";
56343
- const directScripts = path232.join(dir, "scripts.js");
56689
+ const directScripts = path24.join(dir, "scripts.js");
56344
56690
  if (fs12.existsSync(directScripts)) {
56345
56691
  scriptsPath = directScripts;
56346
56692
  } else {
56347
- const scriptsDir = path232.join(dir, "scripts");
56693
+ const scriptsDir = path24.join(dir, "scripts");
56348
56694
  if (fs12.existsSync(scriptsDir)) {
56349
56695
  const versions = fs12.readdirSync(scriptsDir).filter((d) => {
56350
- return fs12.statSync(path232.join(scriptsDir, d)).isDirectory();
56696
+ return fs12.statSync(path24.join(scriptsDir, d)).isDirectory();
56351
56697
  }).sort().reverse();
56352
56698
  for (const ver of versions) {
56353
- const p = path232.join(scriptsDir, ver, "scripts.js");
56699
+ const p = path24.join(scriptsDir, ver, "scripts.js");
56354
56700
  if (fs12.existsSync(p)) {
56355
56701
  scriptsPath = p;
56356
56702
  break;
@@ -57177,7 +57523,7 @@ async (params) => {
57177
57523
  }
57178
57524
  }
57179
57525
  var fs13 = __toESM2(require("fs"));
57180
- var path24 = __toESM2(require("path"));
57526
+ var path25 = __toESM2(require("path"));
57181
57527
  function slugifyFixtureName(value) {
57182
57528
  const normalized = String(value || "").trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
57183
57529
  return normalized || `fixture-${Date.now()}`;
@@ -57187,11 +57533,11 @@ async (params) => {
57187
57533
  if (!providerDir) {
57188
57534
  throw new Error(`Provider directory not found for '${type}'`);
57189
57535
  }
57190
- return path24.join(providerDir, "fixtures");
57536
+ return path25.join(providerDir, "fixtures");
57191
57537
  }
57192
57538
  function readCliFixture(ctx, type, name) {
57193
57539
  const fixtureDir = getCliFixtureDir(ctx, type);
57194
- const filePath = path24.join(fixtureDir, `${name}.json`);
57540
+ const filePath = path25.join(fixtureDir, `${name}.json`);
57195
57541
  if (!fs13.existsSync(filePath)) {
57196
57542
  throw new Error(`Fixture not found: ${filePath}`);
57197
57543
  }
@@ -57958,7 +58304,7 @@ async (params) => {
57958
58304
  },
57959
58305
  notes: typeof body?.notes === "string" ? body.notes : void 0
57960
58306
  };
57961
- const filePath = path24.join(fixtureDir, `${name}.json`);
58307
+ const filePath = path25.join(fixtureDir, `${name}.json`);
57962
58308
  fs13.writeFileSync(filePath, JSON.stringify(fixture, null, 2));
57963
58309
  ctx.json(res, 200, {
57964
58310
  saved: true,
@@ -57982,7 +58328,7 @@ async (params) => {
57982
58328
  return;
57983
58329
  }
57984
58330
  const fixtures = fs13.readdirSync(fixtureDir).filter((file2) => file2.endsWith(".json")).sort((a, b2) => b2.localeCompare(a, void 0, { numeric: true, sensitivity: "base" })).map((file2) => {
57985
- const fullPath = path24.join(fixtureDir, file2);
58331
+ const fullPath = path25.join(fixtureDir, file2);
57986
58332
  try {
57987
58333
  const raw = JSON.parse(fs13.readFileSync(fullPath, "utf-8"));
57988
58334
  return {
@@ -58116,7 +58462,7 @@ async (params) => {
58116
58462
  }
58117
58463
  }
58118
58464
  var fs14 = __toESM2(require("fs"));
58119
- var path25 = __toESM2(require("path"));
58465
+ var path26 = __toESM2(require("path"));
58120
58466
  var os21 = __toESM2(require("os"));
58121
58467
  function getAutoImplPid(ctx) {
58122
58468
  const pid = ctx.autoImplProcess?.pid;
@@ -58166,22 +58512,22 @@ async (params) => {
58166
58512
  if (!fs14.existsSync(scriptsDir)) return null;
58167
58513
  const versions = fs14.readdirSync(scriptsDir).filter((d) => {
58168
58514
  try {
58169
- return fs14.statSync(path25.join(scriptsDir, d)).isDirectory();
58515
+ return fs14.statSync(path26.join(scriptsDir, d)).isDirectory();
58170
58516
  } catch {
58171
58517
  return false;
58172
58518
  }
58173
58519
  }).sort((a, b2) => b2.localeCompare(a, void 0, { numeric: true, sensitivity: "base" }));
58174
58520
  if (versions.length === 0) return null;
58175
- return path25.join(scriptsDir, versions[0]);
58521
+ return path26.join(scriptsDir, versions[0]);
58176
58522
  }
58177
58523
  function resolveAutoImplWritableProviderDir(ctx, category, type, requestedDir) {
58178
- const canonicalUserDir = path25.resolve(ctx.providerLoader.getUserProviderDir(category, type));
58179
- const desiredDir = requestedDir ? path25.resolve(requestedDir) : canonicalUserDir;
58180
- const upstreamRoot = path25.resolve(ctx.providerLoader.getUpstreamDir());
58181
- if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path25.sep}`)) {
58524
+ const canonicalUserDir = path26.resolve(ctx.providerLoader.getUserProviderDir(category, type));
58525
+ const desiredDir = requestedDir ? path26.resolve(requestedDir) : canonicalUserDir;
58526
+ const upstreamRoot = path26.resolve(ctx.providerLoader.getUpstreamDir());
58527
+ if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path26.sep}`)) {
58182
58528
  return { dir: null, reason: `Refusing to write into upstream provider directory: ${desiredDir}` };
58183
58529
  }
58184
- if (path25.basename(desiredDir) !== type) {
58530
+ if (path26.basename(desiredDir) !== type) {
58185
58531
  return { dir: null, reason: `Requested writable provider directory must end with '${type}': ${desiredDir}` };
58186
58532
  }
58187
58533
  const sourceDir = ctx.findProviderDir(type);
@@ -58189,11 +58535,11 @@ async (params) => {
58189
58535
  return { dir: null, reason: `Provider source directory not found for '${type}'` };
58190
58536
  }
58191
58537
  if (!fs14.existsSync(desiredDir)) {
58192
- fs14.mkdirSync(path25.dirname(desiredDir), { recursive: true });
58538
+ fs14.mkdirSync(path26.dirname(desiredDir), { recursive: true });
58193
58539
  fs14.cpSync(sourceDir, desiredDir, { recursive: true });
58194
58540
  ctx.log(`Auto-implement writable copy created: ${desiredDir}`);
58195
58541
  }
58196
- const providerJson = path25.join(desiredDir, "provider.json");
58542
+ const providerJson = path26.join(desiredDir, "provider.json");
58197
58543
  if (!fs14.existsSync(providerJson)) {
58198
58544
  return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
58199
58545
  }
@@ -58204,13 +58550,13 @@ async (params) => {
58204
58550
  const refDir = ctx.findProviderDir(referenceType);
58205
58551
  if (!refDir || !fs14.existsSync(refDir)) return {};
58206
58552
  const referenceScripts = {};
58207
- const scriptsDir = path25.join(refDir, "scripts");
58553
+ const scriptsDir = path26.join(refDir, "scripts");
58208
58554
  const latestDir = getLatestScriptVersionDir(scriptsDir);
58209
58555
  if (!latestDir) return referenceScripts;
58210
58556
  for (const file2 of fs14.readdirSync(latestDir)) {
58211
58557
  if (!file2.endsWith(".js")) continue;
58212
58558
  try {
58213
- referenceScripts[file2] = fs14.readFileSync(path25.join(latestDir, file2), "utf-8");
58559
+ referenceScripts[file2] = fs14.readFileSync(path26.join(latestDir, file2), "utf-8");
58214
58560
  } catch {
58215
58561
  }
58216
58562
  }
@@ -58318,9 +58664,9 @@ async (params) => {
58318
58664
  });
58319
58665
  const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
58320
58666
  const prompt = buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
58321
- const tmpDir = path25.join(os21.tmpdir(), "adhdev-autoimpl");
58667
+ const tmpDir = path26.join(os21.tmpdir(), "adhdev-autoimpl");
58322
58668
  if (!fs14.existsSync(tmpDir)) fs14.mkdirSync(tmpDir, { recursive: true });
58323
- const promptFile = path25.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
58669
+ const promptFile = path26.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
58324
58670
  fs14.writeFileSync(promptFile, prompt, "utf-8");
58325
58671
  ctx.log(`Auto-implement prompt written to ${promptFile} (${prompt.length} chars)`);
58326
58672
  const agentProvider = ctx.providerLoader.resolve(agent) || ctx.providerLoader.getMeta(agent);
@@ -58752,7 +59098,7 @@ async (params) => {
58752
59098
  setMode: "set_mode.js"
58753
59099
  };
58754
59100
  const targetFileNames = new Set(functions.map((fn2) => funcToFile[fn2]).filter(Boolean));
58755
- const scriptsDir = path25.join(providerDir, "scripts");
59101
+ const scriptsDir = path26.join(providerDir, "scripts");
58756
59102
  const latestScriptsDir = getLatestScriptVersionDir(scriptsDir);
58757
59103
  if (latestScriptsDir) {
58758
59104
  lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
@@ -58763,7 +59109,7 @@ async (params) => {
58763
59109
  for (const file2 of fs14.readdirSync(latestScriptsDir)) {
58764
59110
  if (file2.endsWith(".js") && targetFileNames.has(file2)) {
58765
59111
  try {
58766
- const content = fs14.readFileSync(path25.join(latestScriptsDir, file2), "utf-8");
59112
+ const content = fs14.readFileSync(path26.join(latestScriptsDir, file2), "utf-8");
58767
59113
  lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
58768
59114
  lines.push("```javascript");
58769
59115
  lines.push(content);
@@ -58780,7 +59126,7 @@ async (params) => {
58780
59126
  lines.push("");
58781
59127
  for (const file2 of refFiles) {
58782
59128
  try {
58783
- const content = fs14.readFileSync(path25.join(latestScriptsDir, file2), "utf-8");
59129
+ const content = fs14.readFileSync(path26.join(latestScriptsDir, file2), "utf-8");
58784
59130
  lines.push(`### \`${file2}\` \u{1F512}`);
58785
59131
  lines.push("```javascript");
58786
59132
  lines.push(content);
@@ -58821,10 +59167,10 @@ async (params) => {
58821
59167
  lines.push("");
58822
59168
  }
58823
59169
  }
58824
- const docsDir = path25.join(providerDir, "../../docs");
59170
+ const docsDir = path26.join(providerDir, "../../docs");
58825
59171
  const loadGuide = (name) => {
58826
59172
  try {
58827
- const p = path25.join(docsDir, name);
59173
+ const p = path26.join(docsDir, name);
58828
59174
  if (fs14.existsSync(p)) return fs14.readFileSync(p, "utf-8");
58829
59175
  } catch {
58830
59176
  }
@@ -59061,7 +59407,7 @@ async (params) => {
59061
59407
  parseApproval: "parse_approval.js"
59062
59408
  };
59063
59409
  const targetFileNames = new Set(functions.map((fn2) => funcToFile[fn2]).filter(Boolean));
59064
- const scriptsDir = path25.join(providerDir, "scripts");
59410
+ const scriptsDir = path26.join(providerDir, "scripts");
59065
59411
  const latestScriptsDir = getLatestScriptVersionDir(scriptsDir);
59066
59412
  if (latestScriptsDir) {
59067
59413
  lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
@@ -59073,7 +59419,7 @@ async (params) => {
59073
59419
  if (!file2.endsWith(".js")) continue;
59074
59420
  if (!targetFileNames.has(file2)) continue;
59075
59421
  try {
59076
- const content = fs14.readFileSync(path25.join(latestScriptsDir, file2), "utf-8");
59422
+ const content = fs14.readFileSync(path26.join(latestScriptsDir, file2), "utf-8");
59077
59423
  lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
59078
59424
  lines.push("```javascript");
59079
59425
  lines.push(content);
@@ -59089,7 +59435,7 @@ async (params) => {
59089
59435
  lines.push("");
59090
59436
  for (const file2 of refFiles) {
59091
59437
  try {
59092
- const content = fs14.readFileSync(path25.join(latestScriptsDir, file2), "utf-8");
59438
+ const content = fs14.readFileSync(path26.join(latestScriptsDir, file2), "utf-8");
59093
59439
  lines.push(`### \`${file2}\` \u{1F512}`);
59094
59440
  lines.push("```javascript");
59095
59441
  lines.push(content);
@@ -59122,10 +59468,10 @@ async (params) => {
59122
59468
  lines.push("");
59123
59469
  }
59124
59470
  }
59125
- const docsDir = path25.join(providerDir, "../../docs");
59471
+ const docsDir = path26.join(providerDir, "../../docs");
59126
59472
  const loadGuide = (name) => {
59127
59473
  try {
59128
- const p = path25.join(docsDir, name);
59474
+ const p = path26.join(docsDir, name);
59129
59475
  if (fs14.existsSync(p)) return fs14.readFileSync(p, "utf-8");
59130
59476
  } catch {
59131
59477
  }
@@ -59570,8 +59916,8 @@ data: ${JSON.stringify(msg.data)}
59570
59916
  }
59571
59917
  getEndpointList() {
59572
59918
  return this.routes.map((r) => {
59573
- const path27 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
59574
- return `${r.method.padEnd(5)} ${path27}`;
59919
+ const path28 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
59920
+ return `${r.method.padEnd(5)} ${path28}`;
59575
59921
  });
59576
59922
  }
59577
59923
  async start(port = DEV_SERVER_PORT) {
@@ -59859,12 +60205,12 @@ data: ${JSON.stringify(msg.data)}
59859
60205
  // ─── DevConsole SPA ───
59860
60206
  getConsoleDistDir() {
59861
60207
  const candidates = [
59862
- path26.resolve(__dirname, "../../web-devconsole/dist"),
59863
- path26.resolve(__dirname, "../../../web-devconsole/dist"),
59864
- path26.join(process.cwd(), "packages/web-devconsole/dist")
60208
+ path27.resolve(__dirname, "../../web-devconsole/dist"),
60209
+ path27.resolve(__dirname, "../../../web-devconsole/dist"),
60210
+ path27.join(process.cwd(), "packages/web-devconsole/dist")
59865
60211
  ];
59866
60212
  for (const dir of candidates) {
59867
- if (fs15.existsSync(path26.join(dir, "index.html"))) return dir;
60213
+ if (fs15.existsSync(path27.join(dir, "index.html"))) return dir;
59868
60214
  }
59869
60215
  return null;
59870
60216
  }
@@ -59874,7 +60220,7 @@ data: ${JSON.stringify(msg.data)}
59874
60220
  this.json(res, 500, { error: "DevConsole not found. Run: npm run build -w packages/web-devconsole" });
59875
60221
  return;
59876
60222
  }
59877
- const htmlPath = path26.join(distDir, "index.html");
60223
+ const htmlPath = path27.join(distDir, "index.html");
59878
60224
  try {
59879
60225
  const html = fs15.readFileSync(htmlPath, "utf-8");
59880
60226
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
@@ -59899,15 +60245,15 @@ data: ${JSON.stringify(msg.data)}
59899
60245
  this.json(res, 404, { error: "Not found" });
59900
60246
  return;
59901
60247
  }
59902
- const safePath = path26.normalize(pathname).replace(/^\.\.\//, "");
59903
- const filePath = path26.join(distDir, safePath);
60248
+ const safePath = path27.normalize(pathname).replace(/^\.\.\//, "");
60249
+ const filePath = path27.join(distDir, safePath);
59904
60250
  if (!filePath.startsWith(distDir)) {
59905
60251
  this.json(res, 403, { error: "Forbidden" });
59906
60252
  return;
59907
60253
  }
59908
60254
  try {
59909
60255
  const content = fs15.readFileSync(filePath);
59910
- const ext = path26.extname(filePath);
60256
+ const ext = path27.extname(filePath);
59911
60257
  const contentType = _DevServer.MIME_MAP[ext] || "application/octet-stream";
59912
60258
  res.writeHead(200, { "Content-Type": contentType, "Cache-Control": "public, max-age=31536000, immutable" });
59913
60259
  res.end(content);
@@ -60020,9 +60366,9 @@ data: ${JSON.stringify(msg.data)}
60020
60366
  const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
60021
60367
  if (entry.isDirectory()) {
60022
60368
  files.push({ path: rel, size: 0, type: "dir" });
60023
- scan(path26.join(d, entry.name), rel);
60369
+ scan(path27.join(d, entry.name), rel);
60024
60370
  } else {
60025
- const stat2 = fs15.statSync(path26.join(d, entry.name));
60371
+ const stat2 = fs15.statSync(path27.join(d, entry.name));
60026
60372
  files.push({ path: rel, size: stat2.size, type: "file" });
60027
60373
  }
60028
60374
  }
@@ -60045,7 +60391,7 @@ data: ${JSON.stringify(msg.data)}
60045
60391
  this.json(res, 404, { error: `Provider directory not found: ${type}` });
60046
60392
  return;
60047
60393
  }
60048
- const fullPath = path26.resolve(dir, path26.normalize(filePath));
60394
+ const fullPath = path27.resolve(dir, path27.normalize(filePath));
60049
60395
  if (!fullPath.startsWith(dir)) {
60050
60396
  this.json(res, 403, { error: "Forbidden" });
60051
60397
  return;
@@ -60070,14 +60416,14 @@ data: ${JSON.stringify(msg.data)}
60070
60416
  this.json(res, 404, { error: `Provider directory not found: ${type}` });
60071
60417
  return;
60072
60418
  }
60073
- const fullPath = path26.resolve(dir, path26.normalize(filePath));
60419
+ const fullPath = path27.resolve(dir, path27.normalize(filePath));
60074
60420
  if (!fullPath.startsWith(dir)) {
60075
60421
  this.json(res, 403, { error: "Forbidden" });
60076
60422
  return;
60077
60423
  }
60078
60424
  try {
60079
60425
  if (fs15.existsSync(fullPath)) fs15.copyFileSync(fullPath, fullPath + ".bak");
60080
- fs15.mkdirSync(path26.dirname(fullPath), { recursive: true });
60426
+ fs15.mkdirSync(path27.dirname(fullPath), { recursive: true });
60081
60427
  fs15.writeFileSync(fullPath, content, "utf-8");
60082
60428
  this.log(`File saved: ${fullPath} (${content.length} chars)`);
60083
60429
  this.providerLoader.reload();
@@ -60094,7 +60440,7 @@ data: ${JSON.stringify(msg.data)}
60094
60440
  return;
60095
60441
  }
60096
60442
  for (const name of ["scripts.js", "provider.json"]) {
60097
- const p = path26.join(dir, name);
60443
+ const p = path27.join(dir, name);
60098
60444
  if (fs15.existsSync(p)) {
60099
60445
  const source = fs15.readFileSync(p, "utf-8");
60100
60446
  this.json(res, 200, { type, path: p, source, lines: source.split("\n").length });
@@ -60115,8 +60461,8 @@ data: ${JSON.stringify(msg.data)}
60115
60461
  this.json(res, 404, { error: `Provider not found: ${type}` });
60116
60462
  return;
60117
60463
  }
60118
- const target = fs15.existsSync(path26.join(dir, "scripts.js")) ? "scripts.js" : "provider.json";
60119
- const targetPath = path26.join(dir, target);
60464
+ const target = fs15.existsSync(path27.join(dir, "scripts.js")) ? "scripts.js" : "provider.json";
60465
+ const targetPath = path27.join(dir, target);
60120
60466
  try {
60121
60467
  if (fs15.existsSync(targetPath)) fs15.copyFileSync(targetPath, targetPath + ".bak");
60122
60468
  fs15.writeFileSync(targetPath, source, "utf-8");
@@ -60263,7 +60609,7 @@ data: ${JSON.stringify(msg.data)}
60263
60609
  }
60264
60610
  let targetDir;
60265
60611
  targetDir = this.providerLoader.getUserProviderDir(category, type);
60266
- const jsonPath = path26.join(targetDir, "provider.json");
60612
+ const jsonPath = path27.join(targetDir, "provider.json");
60267
60613
  if (fs15.existsSync(jsonPath)) {
60268
60614
  this.json(res, 409, { error: `Provider already exists at ${targetDir}`, path: targetDir });
60269
60615
  return;
@@ -60275,8 +60621,8 @@ data: ${JSON.stringify(msg.data)}
60275
60621
  const createdFiles = ["provider.json"];
60276
60622
  if (result.files) {
60277
60623
  for (const [relPath, content] of Object.entries(result.files)) {
60278
- const fullPath = path26.join(targetDir, relPath);
60279
- fs15.mkdirSync(path26.dirname(fullPath), { recursive: true });
60624
+ const fullPath = path27.join(targetDir, relPath);
60625
+ fs15.mkdirSync(path27.dirname(fullPath), { recursive: true });
60280
60626
  fs15.writeFileSync(fullPath, content, "utf-8");
60281
60627
  createdFiles.push(relPath);
60282
60628
  }
@@ -60329,22 +60675,22 @@ data: ${JSON.stringify(msg.data)}
60329
60675
  if (!fs15.existsSync(scriptsDir)) return null;
60330
60676
  const versions = fs15.readdirSync(scriptsDir).filter((d) => {
60331
60677
  try {
60332
- return fs15.statSync(path26.join(scriptsDir, d)).isDirectory();
60678
+ return fs15.statSync(path27.join(scriptsDir, d)).isDirectory();
60333
60679
  } catch {
60334
60680
  return false;
60335
60681
  }
60336
60682
  }).sort((a, b2) => b2.localeCompare(a, void 0, { numeric: true, sensitivity: "base" }));
60337
60683
  if (versions.length === 0) return null;
60338
- return path26.join(scriptsDir, versions[0]);
60684
+ return path27.join(scriptsDir, versions[0]);
60339
60685
  }
60340
60686
  resolveAutoImplWritableProviderDir(category, type, requestedDir) {
60341
- const canonicalUserDir = path26.resolve(this.providerLoader.getUserProviderDir(category, type));
60342
- const desiredDir = requestedDir ? path26.resolve(requestedDir) : canonicalUserDir;
60343
- const upstreamRoot = path26.resolve(this.providerLoader.getUpstreamDir());
60344
- if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path26.sep}`)) {
60687
+ const canonicalUserDir = path27.resolve(this.providerLoader.getUserProviderDir(category, type));
60688
+ const desiredDir = requestedDir ? path27.resolve(requestedDir) : canonicalUserDir;
60689
+ const upstreamRoot = path27.resolve(this.providerLoader.getUpstreamDir());
60690
+ if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path27.sep}`)) {
60345
60691
  return { dir: null, reason: `Refusing to write into upstream provider directory: ${desiredDir}` };
60346
60692
  }
60347
- if (path26.basename(desiredDir) !== type) {
60693
+ if (path27.basename(desiredDir) !== type) {
60348
60694
  return { dir: null, reason: `Requested writable provider directory must end with '${type}': ${desiredDir}` };
60349
60695
  }
60350
60696
  const sourceDir = this.findProviderDir(type);
@@ -60352,11 +60698,11 @@ data: ${JSON.stringify(msg.data)}
60352
60698
  return { dir: null, reason: `Provider source directory not found for '${type}'` };
60353
60699
  }
60354
60700
  if (!fs15.existsSync(desiredDir)) {
60355
- fs15.mkdirSync(path26.dirname(desiredDir), { recursive: true });
60701
+ fs15.mkdirSync(path27.dirname(desiredDir), { recursive: true });
60356
60702
  fs15.cpSync(sourceDir, desiredDir, { recursive: true });
60357
60703
  this.log(`Auto-implement writable copy created: ${desiredDir}`);
60358
60704
  }
60359
- const providerJson = path26.join(desiredDir, "provider.json");
60705
+ const providerJson = path27.join(desiredDir, "provider.json");
60360
60706
  if (!fs15.existsSync(providerJson)) {
60361
60707
  return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
60362
60708
  }
@@ -60392,7 +60738,7 @@ data: ${JSON.stringify(msg.data)}
60392
60738
  setMode: "set_mode.js"
60393
60739
  };
60394
60740
  const targetFileNames = new Set(functions.map((fn2) => funcToFile[fn2]).filter(Boolean));
60395
- const scriptsDir = path26.join(providerDir, "scripts");
60741
+ const scriptsDir = path27.join(providerDir, "scripts");
60396
60742
  const latestScriptsDir = this.getLatestScriptVersionDir(scriptsDir);
60397
60743
  if (latestScriptsDir) {
60398
60744
  lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
@@ -60403,7 +60749,7 @@ data: ${JSON.stringify(msg.data)}
60403
60749
  for (const file2 of fs15.readdirSync(latestScriptsDir)) {
60404
60750
  if (file2.endsWith(".js") && targetFileNames.has(file2)) {
60405
60751
  try {
60406
- const content = fs15.readFileSync(path26.join(latestScriptsDir, file2), "utf-8");
60752
+ const content = fs15.readFileSync(path27.join(latestScriptsDir, file2), "utf-8");
60407
60753
  lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
60408
60754
  lines.push("```javascript");
60409
60755
  lines.push(content);
@@ -60420,7 +60766,7 @@ data: ${JSON.stringify(msg.data)}
60420
60766
  lines.push("");
60421
60767
  for (const file2 of refFiles) {
60422
60768
  try {
60423
- const content = fs15.readFileSync(path26.join(latestScriptsDir, file2), "utf-8");
60769
+ const content = fs15.readFileSync(path27.join(latestScriptsDir, file2), "utf-8");
60424
60770
  lines.push(`### \`${file2}\` \u{1F512}`);
60425
60771
  lines.push("```javascript");
60426
60772
  lines.push(content);
@@ -60461,10 +60807,10 @@ data: ${JSON.stringify(msg.data)}
60461
60807
  lines.push("");
60462
60808
  }
60463
60809
  }
60464
- const docsDir = path26.join(providerDir, "../../docs");
60810
+ const docsDir = path27.join(providerDir, "../../docs");
60465
60811
  const loadGuide = (name) => {
60466
60812
  try {
60467
- const p = path26.join(docsDir, name);
60813
+ const p = path27.join(docsDir, name);
60468
60814
  if (fs15.existsSync(p)) return fs15.readFileSync(p, "utf-8");
60469
60815
  } catch {
60470
60816
  }
@@ -60638,7 +60984,7 @@ data: ${JSON.stringify(msg.data)}
60638
60984
  parseApproval: "parse_approval.js"
60639
60985
  };
60640
60986
  const targetFileNames = new Set(functions.map((fn2) => funcToFile[fn2]).filter(Boolean));
60641
- const scriptsDir = path26.join(providerDir, "scripts");
60987
+ const scriptsDir = path27.join(providerDir, "scripts");
60642
60988
  const latestScriptsDir = this.getLatestScriptVersionDir(scriptsDir);
60643
60989
  if (latestScriptsDir) {
60644
60990
  lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
@@ -60650,7 +60996,7 @@ data: ${JSON.stringify(msg.data)}
60650
60996
  if (!file2.endsWith(".js")) continue;
60651
60997
  if (!targetFileNames.has(file2)) continue;
60652
60998
  try {
60653
- const content = fs15.readFileSync(path26.join(latestScriptsDir, file2), "utf-8");
60999
+ const content = fs15.readFileSync(path27.join(latestScriptsDir, file2), "utf-8");
60654
61000
  lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
60655
61001
  lines.push("```javascript");
60656
61002
  lines.push(content);
@@ -60666,7 +61012,7 @@ data: ${JSON.stringify(msg.data)}
60666
61012
  lines.push("");
60667
61013
  for (const file2 of refFiles) {
60668
61014
  try {
60669
- const content = fs15.readFileSync(path26.join(latestScriptsDir, file2), "utf-8");
61015
+ const content = fs15.readFileSync(path27.join(latestScriptsDir, file2), "utf-8");
60670
61016
  lines.push(`### \`${file2}\` \u{1F512}`);
60671
61017
  lines.push("```javascript");
60672
61018
  lines.push(content);
@@ -60699,10 +61045,10 @@ data: ${JSON.stringify(msg.data)}
60699
61045
  lines.push("");
60700
61046
  }
60701
61047
  }
60702
- const docsDir = path26.join(providerDir, "../../docs");
61048
+ const docsDir = path27.join(providerDir, "../../docs");
60703
61049
  const loadGuide = (name) => {
60704
61050
  try {
60705
- const p = path26.join(docsDir, name);
61051
+ const p = path27.join(docsDir, name);
60706
61052
  if (fs15.existsSync(p)) return fs15.readFileSync(p, "utf-8");
60707
61053
  } catch {
60708
61054
  }