@adhdev/daemon-core 0.9.82-rc.163 → 0.9.82-rc.165

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.mjs CHANGED
@@ -4926,14 +4926,15 @@ var init_provider_schema = __esm({
4926
4926
  minItems: 1,
4927
4927
  items: {
4928
4928
  type: "object",
4929
- required: ["scriptDir"],
4929
+ required: ["ideVersion"],
4930
4930
  additionalProperties: false,
4931
4931
  properties: {
4932
4932
  ideVersion: { type: "string", description: "SemVer range." },
4933
- scriptDir: { type: "string", pattern: "^scripts/[^/]+$" }
4933
+ scriptDir: { type: "string", pattern: "^scripts/[^/]+$" },
4934
+ spec: { type: "string", pattern: "^specs/[^/]+\\.json$", description: "Path to declarative spec.json driving SpecCliAdapter for this version range." }
4934
4935
  }
4935
4936
  },
4936
- description: "Maps installed agent versions to script subdirectories."
4937
+ description: "Maps installed agent versions to script subdirectories and/or declarative specs."
4937
4938
  },
4938
4939
  defaultScriptDir: {
4939
4940
  type: "string",
@@ -10527,9 +10528,17 @@ function expandPath2(template, input) {
10527
10528
  });
10528
10529
  if (out.startsWith("~/")) out = path24.join(os17.homedir(), out.slice(2));
10529
10530
  const now = /* @__PURE__ */ new Date();
10531
+ const workspaceRaw = input.workspace ?? "";
10532
+ let workspaceResolved = workspaceRaw;
10533
+ if (workspaceRaw) {
10534
+ try {
10535
+ workspaceResolved = fs12.realpathSync(workspaceRaw);
10536
+ } catch {
10537
+ }
10538
+ }
10530
10539
  const vars = {
10531
- cwd: input.workspace ?? "",
10532
- cwd_dashed: (input.workspace ?? "").replace(/\//g, "-"),
10540
+ cwd: workspaceResolved,
10541
+ cwd_dashed: workspaceResolved.replace(/\//g, "-"),
10533
10542
  session_id: input.providerSessionId || input.sessionId || input.historySessionId || "",
10534
10543
  yyyy: String(now.getUTCFullYear()),
10535
10544
  mm: String(now.getUTCMonth() + 1).padStart(2, "0"),
@@ -26875,6 +26884,15 @@ var SpecCliAdapter = class {
26875
26884
  cliType;
26876
26885
  cliName;
26877
26886
  workingDir;
26887
+ /**
26888
+ * Marker the daemon's finalization gate checks: `getStatus()` returns
26889
+ * `messages: []` by design here (chat history lives in the daemon's
26890
+ * native-history pipeline, not the adapter). Without this flag,
26891
+ * cli-provider-instance's `missing_final_assistant` gate would stall
26892
+ * every turn until the 30s safety timeout because it expects the
26893
+ * adapter to surface the final assistant message.
26894
+ */
26895
+ chatMessagesOwnedExternally = true;
26878
26896
  driver;
26879
26897
  spec;
26880
26898
  lastEvent = null;
@@ -27858,7 +27876,10 @@ var CliProviderInstance = class {
27858
27876
  return { reason: `parsed_status:${parsedStatus}`, terminal: isCliGeneratingLikeStatus(parsedStatus) };
27859
27877
  }
27860
27878
  if (parsed?.activeModal || parsed?.modal) return { reason: "parsed_modal_active", terminal: true };
27861
- if (!this.completionHasFinalAssistantMessage(parsed?.messages)) return { reason: "missing_final_assistant" };
27879
+ const adapterOwnsMessagesElsewhere = this.adapter?.chatMessagesOwnedExternally === true;
27880
+ if (!adapterOwnsMessagesElsewhere && !this.completionHasFinalAssistantMessage(parsed?.messages)) {
27881
+ return { reason: "missing_final_assistant" };
27882
+ }
27862
27883
  try {
27863
27884
  const screenText = typeof this.adapter.getScreenText === "function" ? String(this.adapter.getScreenText() || "") : "";
27864
27885
  if (screenText) {
@@ -31920,16 +31941,20 @@ var ProviderLoader = class _ProviderLoader {
31920
31941
  let matched = false;
31921
31942
  for (const entry of compat) {
31922
31943
  if (this.matchesVersion(currentVersion, entry.ideVersion)) {
31923
- const loaded = this.loadScriptsFromDir(type, entry.scriptDir);
31924
- if (loaded) {
31925
- resolved.scripts = loaded;
31926
- this.debugLog(` [compatibility] ${type} v${currentVersion} \u2192 ${entry.scriptDir}`);
31927
- resolved._resolvedScriptDir = entry.scriptDir;
31928
- resolved._resolvedScriptsSource = `compatibility:${entry.ideVersion}`;
31929
- if (providerDir) {
31930
- const fullDir = path30.join(providerDir, entry.scriptDir);
31931
- resolved._resolvedScriptsPath = fs18.existsSync(path30.join(fullDir, "scripts.js")) ? path30.join(fullDir, "scripts.js") : fullDir;
31944
+ if (entry.scriptDir) {
31945
+ const loaded = this.loadScriptsFromDir(type, entry.scriptDir);
31946
+ if (loaded) {
31947
+ resolved.scripts = loaded;
31948
+ this.debugLog(` [compatibility] ${type} v${currentVersion} \u2192 ${entry.scriptDir}`);
31949
+ resolved._resolvedScriptDir = entry.scriptDir;
31950
+ resolved._resolvedScriptsSource = `compatibility:${entry.ideVersion}`;
31951
+ if (providerDir) {
31952
+ const fullDir = path30.join(providerDir, entry.scriptDir);
31953
+ resolved._resolvedScriptsPath = fs18.existsSync(path30.join(fullDir, "scripts.js")) ? path30.join(fullDir, "scripts.js") : fullDir;
31954
+ }
31955
+ matched = true;
31932
31956
  }
31957
+ } else {
31933
31958
  matched = true;
31934
31959
  }
31935
31960
  break;
@@ -37593,21 +37618,22 @@ var DaemonCommandRouter = class {
37593
37618
  const sessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : typeof args?.sessionId === "string" ? args.sessionId.trim() : "";
37594
37619
  if (!sessionId) return { success: false, error: "targetSessionId required" };
37595
37620
  const target = this.deps.sessionRegistry.get(sessionId);
37596
- if (!target) return { success: false, error: "Session not found", sessionId };
37597
- const adapter = this.deps.cliManager.findAdapter(target.providerType, { instanceKey: sessionId })?.adapter;
37598
- const runtimeMeta = adapter && typeof adapter.getRuntimeMetadata === "function" ? adapter.getRuntimeMetadata() : void 0;
37599
37621
  const coord = getCoordinatorForSession(sessionId);
37600
- const providerMetaForSession = this.deps.providerLoader.resolve?.(target.providerType) || this.deps.providerLoader.getMeta(target.providerType);
37622
+ if (!target && !coord) return { success: false, error: "Session not found", sessionId };
37623
+ const adapter = target ? this.deps.cliManager.findAdapter(target.providerType, { instanceKey: sessionId })?.adapter : void 0;
37624
+ const runtimeMeta = adapter && typeof adapter.getRuntimeMetadata === "function" ? adapter.getRuntimeMetadata() : void 0;
37625
+ const providerType = target?.providerType || coord?.cliType || "";
37626
+ const providerMetaForSession = providerType ? this.deps.providerLoader.resolve?.(providerType) || this.deps.providerLoader.getMeta(providerType) : void 0;
37601
37627
  return {
37602
37628
  success: true,
37603
37629
  session: {
37604
37630
  sessionId,
37605
- providerType: target.providerType,
37631
+ providerType,
37606
37632
  providerName: providerMetaForSession?.name,
37607
- transport: target.transport,
37608
- workspace: target.workspace,
37609
- spawnedAtMs: target.spawnedAtMs,
37610
- providerSessionId: target.providerSessionId,
37633
+ transport: target?.transport,
37634
+ workspace: target?.workspace || coord?.workspace,
37635
+ spawnedAtMs: target?.spawnedAtMs || coord?.startedAt,
37636
+ providerSessionId: target?.providerSessionId,
37611
37637
  runtimeMetadata: runtimeMeta
37612
37638
  },
37613
37639
  coordinator: coord ? {