@agentconnect.md/daemon 1.0.0-rc.340 → 1.0.0-rc.342

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.
@@ -1,7 +1,7 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "./rolldown-runtime-CE-6LUnI.js";
2
2
  import { t as require_src$1 } from "./src-DDtlVutj.js";
3
3
  import { T as NEVER, _ as record, a as array, b as unknown, d as literal, l as int, m as object, o as boolean, p as number, u as intersection, v as string, x as url, y as union } from "./schemas-CQkO9hC5.js";
4
- import { p as MEMORY_INDEX, r as normalizeGitUrl } from "./dist-D97dgR66.js";
4
+ import { m as HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED, p as MEMORY_INDEX, r as normalizeGitUrl } from "./dist-MrCr7fl1.js";
5
5
  import { c as registryPath, s as registryCachePath } from "./paths-DEcUO8lC.js";
6
6
  import { delimiter, dirname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
7
7
  import { accessSync, constants, existsSync, mkdirSync, promises, readFileSync, rmSync, writeFileSync } from "node:fs";
@@ -9754,6 +9754,61 @@ function turnFailureReason(err) {
9754
9754
  if (!detail || msg.includes(detail)) return msg;
9755
9755
  return /^(parse error|invalid request|invalid params|internal error|request cancelled|authentication required|resource not found)$/i.test(msg) ? detail : `${msg}: ${detail}`;
9756
9756
  }
9757
+ const PROVIDER_QUOTA_CODES = /* @__PURE__ */ new Set([
9758
+ "billinghardlimitreached",
9759
+ "creditbalancetoolow",
9760
+ "creditsexhausted",
9761
+ "insufficientquota",
9762
+ "nocreditsremaining",
9763
+ "outofcredits",
9764
+ "planlimitreached",
9765
+ "quotaexhausted",
9766
+ "usagelimitexceeded",
9767
+ "usagelimitreached"
9768
+ ]);
9769
+ const PROVIDER_QUOTA_MESSAGES = [
9770
+ /\b(?:you(?:'|’)ve|you have) hit your (?:[a-z]+ )?usage limit\b/i,
9771
+ /\busage limit (?:has been )?(?:reached|exceeded)\b/i,
9772
+ /\b(?:you(?:'|’)ve|you have) hit your limit\b[\s\S]{0,120}\bresets?\b/i,
9773
+ /\b(?:credit|credits) balance (?:is )?(?:too low|depleted|exhausted)\b/i,
9774
+ /\b(?:insufficient|not enough|no) (?:api )?credits?(?: (?:remaining|available))?\b/i,
9775
+ /\b(?:out of|exhausted) (?:api )?credits?\b/i,
9776
+ /\bexceeded your current quota\b/i,
9777
+ /\b(?:billing|plan|account) quota (?:has been )?(?:reached|exceeded|exhausted)\b/i
9778
+ ];
9779
+ /** Collect the small family of fields ACP adapters and provider SDKs use to
9780
+ * wrap an upstream error. The depth/seen guards tolerate nested `error.data`
9781
+ * and `cause` shapes without recursively inspecting an arbitrary request body.
9782
+ */
9783
+ function failureSignals(value, depth = 0, seen = /* @__PURE__ */ new Set()) {
9784
+ if (typeof value === "string") return value.trim() ? [value.trim()] : [];
9785
+ if (!value || typeof value !== "object" || depth >= 5 || seen.has(value)) return [];
9786
+ seen.add(value);
9787
+ const out = [];
9788
+ for (const key of [
9789
+ "message",
9790
+ "code",
9791
+ "type",
9792
+ "reason",
9793
+ "codexErrorInfo",
9794
+ "errorInfo",
9795
+ "errorType",
9796
+ "error_type",
9797
+ "error",
9798
+ "data",
9799
+ "details",
9800
+ "cause"
9801
+ ]) try {
9802
+ out.push(...failureSignals(Reflect.get(value, key), depth + 1, seen));
9803
+ } catch {}
9804
+ return out;
9805
+ }
9806
+ function turnFailureCode(err) {
9807
+ const signals = failureSignals(err);
9808
+ if (signals.some((signal) => PROVIDER_QUOTA_CODES.has(signal.toLowerCase().replace(/[^a-z0-9]/g, "")))) return HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED;
9809
+ const message = signals.join("\n");
9810
+ return PROVIDER_QUOTA_MESSAGES.some((pattern) => pattern.test(message)) ? HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED : "turn_failed";
9811
+ }
9757
9812
  /**
9758
9813
  * Resolve how to apply `desired` to the select config option tagged `category`.
9759
9814
  * `{skip}` (with the reason) means nothing should be sent: the runtime
@@ -10229,6 +10284,6 @@ var AcpHost = class {
10229
10284
  }
10230
10285
  };
10231
10286
  //#endregion
10232
- export { cachedRuntimeNames as C, toolsForIntegrations as S, resolveRuntimes as T, resolveInMemoryDir as _, prepareWorkspace as a, GITHUB_REVIEW_TOOLS as b, sessionGitEnv as c, memoryKindOf as d, memoryProviderFor as f, listMemory as g, MemoryTooLargeError as h, prefetchWorkspace as i, simpleGit as l, MemoryPathError as m, turnFailureReason as n, initGitInjection as o, MemoryConflictError as p, installedRuntimes as r, probeGitVersion as s, AcpHost as t, createMemoryProvider as u, writeMemoryFile as v, cachedRuntimeVersions as w, MEMORY_TOOL_NAMES as x, ALL_TOOL_NAMES as y };
10287
+ export { toolsForIntegrations as C, resolveRuntimes as E, MEMORY_TOOL_NAMES as S, cachedRuntimeVersions as T, listMemory as _, prefetchWorkspace as a, ALL_TOOL_NAMES as b, probeGitVersion as c, createMemoryProvider as d, memoryKindOf as f, MemoryTooLargeError as g, MemoryPathError as h, installedRuntimes as i, sessionGitEnv as l, MemoryConflictError as m, turnFailureCode as n, prepareWorkspace as o, memoryProviderFor as p, turnFailureReason as r, initGitInjection as s, AcpHost as t, simpleGit as u, resolveInMemoryDir as v, cachedRuntimeNames as w, GITHUB_REVIEW_TOOLS as x, writeMemoryFile as y };
10233
10288
 
10234
- //# sourceMappingURL=acp-host-mGdODiKs.js.map
10289
+ //# sourceMappingURL=acp-host-rssqAAfr.js.map