@socketsecurity/lib 6.0.7 → 6.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/dist/ai/agent-context.d.mts +103 -0
  4. package/dist/ai/agent-context.js +157 -0
  5. package/dist/ai/backends.d.mts +83 -0
  6. package/dist/ai/backends.js +173 -0
  7. package/dist/ai/credentials.d.mts +49 -0
  8. package/dist/ai/credentials.js +82 -0
  9. package/dist/ai/discover.d.mts +4 -0
  10. package/dist/ai/discover.js +1 -1
  11. package/dist/ai/exec.d.mts +52 -0
  12. package/dist/ai/exec.js +92 -0
  13. package/dist/ai/http.d.mts +132 -0
  14. package/dist/ai/http.js +130 -0
  15. package/dist/ai/profiles.d.mts +41 -6
  16. package/dist/ai/profiles.js +52 -10
  17. package/dist/ai/route.d.mts +82 -0
  18. package/dist/ai/route.js +171 -0
  19. package/dist/ai/spawn.d.mts +42 -2
  20. package/dist/ai/spawn.js +146 -33
  21. package/dist/ai/subagent-status.d.mts +48 -0
  22. package/dist/ai/subagent-status.js +57 -0
  23. package/dist/ai/tier.d.mts +60 -0
  24. package/dist/ai/tier.js +53 -0
  25. package/dist/ai/types.d.mts +25 -2
  26. package/dist/ai/worktree.js +4 -0
  27. package/dist/archives/tar.js +1 -1
  28. package/dist/archives/zip.js +2 -2
  29. package/dist/argv/parse.d.ts +19 -2
  30. package/dist/argv/parse.js +1 -1
  31. package/dist/arrays/join.js +4 -0
  32. package/dist/bin/find.js +4 -4
  33. package/dist/bin/prim.cjs +23322 -18018
  34. package/dist/bin/resolve.js +2 -2
  35. package/dist/cache/ttl/store.js +2 -2
  36. package/dist/cli/check-primordials.d.ts +8 -3
  37. package/dist/cli/check-primordials.js +4 -4
  38. package/dist/compression/_internal.js +1 -1
  39. package/dist/compression/brotli.d.ts +1 -2
  40. package/dist/compression/brotli.js +5 -1
  41. package/dist/compression/gzip.js +5 -1
  42. package/dist/config/layers.d.ts +53 -0
  43. package/dist/config/layers.js +83 -0
  44. package/dist/constants/packages.d.ts +3 -0
  45. package/dist/constants/packages.js +2 -1
  46. package/dist/constants/socket.d.ts +2 -6
  47. package/dist/constants/socket.js +12 -14
  48. package/dist/cover/code.js +2 -2
  49. package/dist/crypto/hash.d.ts +4 -1
  50. package/dist/crypto/hash.js +4 -1
  51. package/dist/dlx/arborist.js +13 -3
  52. package/dist/dlx/binary-cache.js +1 -1
  53. package/dist/dlx/binary-resolution.js +1 -1
  54. package/dist/dlx/detect.d.ts +8 -0
  55. package/dist/dlx/firewall.d.ts +8 -0
  56. package/dist/dlx/lockfile.js +5 -2
  57. package/dist/dlx/manifest.js +1 -1
  58. package/dist/dlx/package.js +4 -0
  59. package/dist/eco/cargo/parse-lockfile.d.ts +1 -2
  60. package/dist/eco/cargo/parse-lockfile.js +3 -3
  61. package/dist/eco/manifest/detect-format.js +1 -1
  62. package/dist/eco/npm/npm/parse-lockfile.d.ts +3 -4
  63. package/dist/eco/npm/npm/parse-lockfile.js +2 -2
  64. package/dist/eco/npm/parse-package-json.d.ts +11 -0
  65. package/dist/eco/npm/parse-package-json.js +1 -1
  66. package/dist/eco/npm/pnpm/parse-lockfile.d.ts +5 -3
  67. package/dist/eco/npm/pnpm/parse-lockfile.js +3 -3
  68. package/dist/eco/npm/yarnpkg/yarn/exec.js +1 -1
  69. package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.d.ts +1 -2
  70. package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +2 -2
  71. package/dist/env/proxy.js +1 -1
  72. package/dist/env/rewire.d.ts +6 -3
  73. package/dist/env/rewire.js +7 -8
  74. package/dist/env/socket.d.ts +7 -0
  75. package/dist/env/socket.js +10 -0
  76. package/dist/env/xdg.d.ts +17 -0
  77. package/dist/env/xdg.js +21 -1
  78. package/dist/errors/predicates.js +1 -1
  79. package/dist/errors/stack.js +1 -2
  80. package/dist/external/@npmcli/package-json.js +3455 -4881
  81. package/dist/external/@npmcli/promise-spawn.js +3 -1
  82. package/dist/external/@yarnpkg/extensions.js +1 -1
  83. package/dist/external/external-pack.js +1 -1
  84. package/dist/external/npm-pack.js +29164 -31799
  85. package/dist/external/pico-pack.js +4 -2
  86. package/dist/external/tar-fs.js +63 -16
  87. package/dist/external/which.js +3 -1
  88. package/dist/external-tools/bazel/asset-names.d.ts +1 -1
  89. package/dist/external-tools/bazel/asset-names.js +5 -2
  90. package/dist/external-tools/bazel/from-download.d.ts +1 -1
  91. package/dist/external-tools/bazel/from-download.js +5 -2
  92. package/dist/external-tools/bazel/resolve-bazel-version.js +4 -0
  93. package/dist/external-tools/bazel/resolve.d.ts +3 -3
  94. package/dist/external-tools/bazel/resolve.js +16 -8
  95. package/dist/external-tools/cdxgen/asset-names.d.ts +1 -1
  96. package/dist/external-tools/cdxgen/asset-names.js +5 -2
  97. package/dist/external-tools/cdxgen/from-download.d.ts +1 -1
  98. package/dist/external-tools/cdxgen/from-download.js +7 -4
  99. package/dist/external-tools/cdxgen/resolve.d.ts +3 -3
  100. package/dist/external-tools/cdxgen/resolve.js +16 -8
  101. package/dist/external-tools/from-download.d.ts +2 -2
  102. package/dist/external-tools/from-download.js +11 -5
  103. package/dist/external-tools/from-pip-venv.d.ts +1 -1
  104. package/dist/external-tools/from-pip-venv.js +12 -5
  105. package/dist/external-tools/janus/asset-names.d.ts +1 -1
  106. package/dist/external-tools/janus/asset-names.js +5 -2
  107. package/dist/external-tools/janus/from-download.d.ts +1 -1
  108. package/dist/external-tools/janus/from-download.js +5 -2
  109. package/dist/external-tools/janus/resolve.d.ts +3 -3
  110. package/dist/external-tools/janus/resolve.js +16 -8
  111. package/dist/external-tools/jre/asset-names.d.ts +1 -1
  112. package/dist/external-tools/jre/asset-names.js +5 -2
  113. package/dist/external-tools/jre/detect-platform-arch.js +1 -1
  114. package/dist/external-tools/jre/from-download.d.ts +1 -1
  115. package/dist/external-tools/jre/from-download.js +7 -4
  116. package/dist/external-tools/jre/from-java-home.js +2 -2
  117. package/dist/external-tools/jre/from-vfs.js +2 -2
  118. package/dist/external-tools/jre/resolve.d.ts +3 -3
  119. package/dist/external-tools/jre/resolve.js +16 -8
  120. package/dist/external-tools/manifest.d.ts +18 -0
  121. package/dist/external-tools/manifest.js +2 -2
  122. package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
  123. package/dist/external-tools/opengrep/asset-names.js +5 -2
  124. package/dist/external-tools/opengrep/from-download.d.ts +1 -1
  125. package/dist/external-tools/opengrep/from-download.js +5 -2
  126. package/dist/external-tools/opengrep/resolve.d.ts +3 -3
  127. package/dist/external-tools/opengrep/resolve.js +16 -8
  128. package/dist/external-tools/python/asset-names.d.ts +1 -1
  129. package/dist/external-tools/python/asset-names.js +11 -4
  130. package/dist/external-tools/python/dlx.d.ts +3 -3
  131. package/dist/external-tools/python/dlx.js +20 -9
  132. package/dist/external-tools/python/from-download.d.ts +1 -1
  133. package/dist/external-tools/python/from-download.js +12 -5
  134. package/dist/external-tools/python/pin.js +6 -3
  135. package/dist/external-tools/python/pip-install.js +6 -3
  136. package/dist/external-tools/python/resolve.d.ts +3 -3
  137. package/dist/external-tools/python/resolve.js +19 -11
  138. package/dist/external-tools/python/uv-install.d.ts +89 -0
  139. package/dist/external-tools/python/uv-install.js +165 -0
  140. package/dist/external-tools/sbt/asset-names.d.ts +1 -1
  141. package/dist/external-tools/sbt/asset-names.js +5 -2
  142. package/dist/external-tools/sbt/from-download.d.ts +1 -1
  143. package/dist/external-tools/sbt/from-download.js +5 -2
  144. package/dist/external-tools/sbt/resolve.d.ts +3 -3
  145. package/dist/external-tools/sbt/resolve.js +16 -8
  146. package/dist/external-tools/skillspector/from-dlx.d.ts +1 -1
  147. package/dist/external-tools/skillspector/from-dlx.js +10 -3
  148. package/dist/external-tools/skillspector/from-uv.d.ts +30 -0
  149. package/dist/external-tools/skillspector/from-uv.js +56 -0
  150. package/dist/external-tools/skillspector/resolve.d.ts +20 -5
  151. package/dist/external-tools/skillspector/resolve.js +27 -6
  152. package/dist/external-tools/skillspector/types.d.ts +3 -1
  153. package/dist/external-tools/synp/asset-names.d.ts +1 -1
  154. package/dist/external-tools/synp/asset-names.js +6 -2
  155. package/dist/external-tools/synp/from-download.d.ts +1 -1
  156. package/dist/external-tools/synp/from-download.js +5 -2
  157. package/dist/external-tools/synp/resolve.d.ts +3 -3
  158. package/dist/external-tools/synp/resolve.js +16 -8
  159. package/dist/external-tools/trivy/asset-names.d.ts +1 -1
  160. package/dist/external-tools/trivy/asset-names.js +5 -2
  161. package/dist/external-tools/trivy/from-download.d.ts +1 -1
  162. package/dist/external-tools/trivy/from-download.js +7 -4
  163. package/dist/external-tools/trivy/resolve.d.ts +3 -3
  164. package/dist/external-tools/trivy/resolve.js +16 -8
  165. package/dist/external-tools/trufflehog/asset-names.d.ts +1 -1
  166. package/dist/external-tools/trufflehog/asset-names.js +5 -2
  167. package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
  168. package/dist/external-tools/trufflehog/from-download.js +7 -4
  169. package/dist/external-tools/trufflehog/resolve.d.ts +3 -3
  170. package/dist/external-tools/trufflehog/resolve.js +16 -8
  171. package/dist/external-tools/uv/asset-names.d.ts +36 -0
  172. package/dist/external-tools/uv/asset-names.js +73 -0
  173. package/dist/external-tools/uv/from-download.d.ts +17 -0
  174. package/dist/external-tools/uv/from-download.js +50 -0
  175. package/dist/external-tools/uv/from-path.d.ts +5 -0
  176. package/dist/external-tools/uv/from-path.js +22 -0
  177. package/dist/external-tools/uv/from-vfs.d.ts +7 -0
  178. package/dist/external-tools/uv/from-vfs.js +26 -0
  179. package/dist/external-tools/uv/resolve.d.ts +25 -0
  180. package/dist/external-tools/uv/resolve.js +61 -0
  181. package/dist/external-tools/uv/types.d.ts +24 -0
  182. package/dist/external-tools/uv/types.js +2 -0
  183. package/dist/fleet/repo-config.d.ts +53 -0
  184. package/dist/fleet/repo-config.js +79 -0
  185. package/dist/fs/allowed-dirs-cache.d.ts +27 -1
  186. package/dist/fs/allowed-dirs-cache.js +39 -6
  187. package/dist/fs/copy.d.ts +88 -0
  188. package/dist/fs/copy.js +89 -0
  189. package/dist/fs/find.js +1 -1
  190. package/dist/fs/read-json-cache.d.ts +7 -0
  191. package/dist/fs/resolve-module.js +6 -2
  192. package/dist/fs/safe.js +1 -1
  193. package/dist/git/_internal.js +3 -3
  194. package/dist/git/repo.js +2 -4
  195. package/dist/git/staged.js +8 -0
  196. package/dist/git/tracked.d.ts +84 -0
  197. package/dist/git/tracked.js +163 -0
  198. package/dist/git/unstaged.js +8 -0
  199. package/dist/github/refs-graphql.js +4 -0
  200. package/dist/github/refs-rest.js +4 -0
  201. package/dist/globs/_internal.js +1 -1
  202. package/dist/globs/match.js +9 -1
  203. package/dist/globs/matcher.js +5 -1
  204. package/dist/http-request/browser.js +7 -3
  205. package/dist/http-request/checksum-file.js +1 -1
  206. package/dist/http-request/{browser-fetch.d.ts → fetch/browser.d.ts} +2 -2
  207. package/dist/http-request/{browser-fetch.js → fetch/browser.js} +4 -4
  208. package/dist/http-request/headers.js +1 -1
  209. package/dist/http-request/request-attempt.js +2 -2
  210. package/dist/http-request/user-agent.js +1 -1
  211. package/dist/integrity.d.ts +124 -71
  212. package/dist/integrity.js +168 -78
  213. package/dist/json/edit.js +38 -30
  214. package/dist/json/format.js +1 -1
  215. package/dist/logger/colors.d.ts +1 -2
  216. package/dist/logger/colors.js +2 -2
  217. package/dist/logger/symbols-builder.js +7 -8
  218. package/dist/logger/symbols.js +8 -8
  219. package/dist/native-messaging/install.d.ts +1 -1
  220. package/dist/native-messaging/install.js +7 -4
  221. package/dist/native-messaging/rate-limit.d.ts +7 -0
  222. package/dist/native-messaging/rate-limit.js +4 -0
  223. package/dist/node/async-hooks.js +1 -1
  224. package/dist/node/child-process.js +1 -1
  225. package/dist/node/crypto.js +1 -1
  226. package/dist/node/events.js +1 -1
  227. package/dist/node/fs-promises.js +1 -1
  228. package/dist/node/fs.d.ts +22 -6
  229. package/dist/node/fs.js +16 -3
  230. package/dist/node/http.js +1 -1
  231. package/dist/node/https.js +1 -1
  232. package/dist/node/module.d.ts +73 -2
  233. package/dist/node/module.js +97 -12
  234. package/dist/node/os.d.ts +10 -2
  235. package/dist/node/os.js +11 -4
  236. package/dist/node/path.d.ts +11 -2
  237. package/dist/node/path.js +17 -4
  238. package/dist/node/timers-promises.js +1 -1
  239. package/dist/node/url.js +1 -1
  240. package/dist/node/util.js +1 -1
  241. package/dist/objects/getters.js +1 -1
  242. package/dist/objects/mutate.js +2 -2
  243. package/dist/packages/edit-class.d.ts +2 -3
  244. package/dist/packages/edit-class.js +41 -35
  245. package/dist/packages/exports.js +4 -4
  246. package/dist/packages/fetch.js +1 -1
  247. package/dist/packages/isolation.js +2 -2
  248. package/dist/packages/licenses.js +2 -2
  249. package/dist/packages/manifest.d.ts +29 -0
  250. package/dist/packages/manifest.js +40 -4
  251. package/dist/packages/normalize.js +2 -2
  252. package/dist/packages/provenance.js +3 -3
  253. package/dist/packages/specs.js +1 -1
  254. package/dist/packages/tarball.js +4 -2
  255. package/dist/packages/types.d.ts +1 -2
  256. package/dist/paths/_internal.d.ts +1 -7
  257. package/dist/paths/_internal.js +9 -15
  258. package/dist/paths/conversion.js +1 -1
  259. package/dist/paths/dirnames.d.ts +1 -0
  260. package/dist/paths/dirnames.js +2 -0
  261. package/dist/paths/normalize.js +1 -1
  262. package/dist/paths/predicates.js +2 -1
  263. package/dist/paths/resolve.js +14 -19
  264. package/dist/paths/rewire.d.ts +5 -0
  265. package/dist/paths/socket.d.ts +137 -123
  266. package/dist/paths/socket.js +172 -131
  267. package/dist/perf/metrics.js +1 -1
  268. package/dist/perf/report.js +1 -1
  269. package/dist/primordials/process.d.ts +88 -0
  270. package/dist/primordials/process.js +132 -0
  271. package/dist/primordials/uncurry.d.ts +1 -2
  272. package/dist/process/spawn/child.js +8 -2
  273. package/dist/process/spawn/errors.js +1 -1
  274. package/dist/releases/github-archives.js +1 -1
  275. package/dist/releases/github-listing.d.ts +1 -2
  276. package/dist/schema/types.d.ts +3 -4
  277. package/dist/schema/validate.js +1 -1
  278. package/dist/secrets/broker.d.ts +35 -0
  279. package/dist/secrets/broker.js +72 -0
  280. package/dist/secrets/find.d.ts +8 -6
  281. package/dist/secrets/find.js +25 -5
  282. package/dist/secrets/keychain.d.ts +1 -1
  283. package/dist/secrets/linux.js +32 -44
  284. package/dist/secrets/macos.d.ts +1 -2
  285. package/dist/secrets/macos.js +20 -29
  286. package/dist/secrets/rc.d.ts +2 -2
  287. package/dist/secrets/rc.js +21 -13
  288. package/dist/secrets/socket-api-token.js +8 -0
  289. package/dist/secrets/windows.js +27 -33
  290. package/dist/shell/parse.d.ts +32 -0
  291. package/dist/shell/parse.js +60 -0
  292. package/dist/smol/detect.js +1 -1
  293. package/dist/smol/http.js +1 -1
  294. package/dist/smol/https.js +1 -1
  295. package/dist/smol/manifest.js +1 -1
  296. package/dist/smol/path.js +1 -1
  297. package/dist/smol/primordial.js +1 -1
  298. package/dist/smol/purl.js +1 -1
  299. package/dist/smol/versions.js +1 -1
  300. package/dist/smol/vfs.js +1 -1
  301. package/dist/sorts/_internal.d.ts +1 -2
  302. package/dist/sorts/_internal.js +2 -6
  303. package/dist/sorts/semver.js +2 -2
  304. package/dist/spinner/create-spinner-class.js +2 -2
  305. package/dist/spinner/spinner-internals.d.ts +1 -1
  306. package/dist/spinner/spinner-internals.js +9 -5
  307. package/dist/spinner/spinner.d.ts +4 -0
  308. package/dist/spinner/spinner.js +1 -1
  309. package/dist/stdio/progress.js +6 -2
  310. package/dist/stdio/prompts.d.ts +2 -10
  311. package/dist/stdio/prompts.js +11 -24
  312. package/dist/strings/format.js +1 -1
  313. package/dist/strings/search.js +1 -1
  314. package/dist/temporal/instant.js +2 -2
  315. package/dist/themes/context.d.ts +5 -3
  316. package/dist/themes/context.js +5 -6
  317. package/dist/url/assert-safe.d.ts +29 -0
  318. package/dist/url/assert-safe.js +54 -0
  319. package/dist/url/predicates.d.ts +31 -1
  320. package/dist/url/predicates.js +42 -1
  321. package/dist/url/types.d.ts +4 -0
  322. package/llms.txt +750 -0
  323. package/package.json +253 -125
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with rolldown */
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_primordials_error = require('../primordials/error.js');
5
+
6
+ //#region src/ai/subagent-status.mts
7
+ /**
8
+ * @file The terminal-status contract a delegated subagent returns to its
9
+ * orchestrator. Subagent-driven development depends on a SMALL, fixed status
10
+ * vocabulary so the orchestrator can route deterministically instead of
11
+ * parsing free-form prose: a subagent that "sort of finished but has a worry"
12
+ * must be distinguishable from one that is genuinely blocked, because they
13
+ * escalate differently. The four states and their escalation paths are the
14
+ * contract; `escalationFor` is the single place that maps a state to what the
15
+ * orchestrator does next. Encoding it as a typed union + map (rather than a
16
+ * doc convention) is the code-is-law surface: a stray status string fails the
17
+ * guard, and `agent-delegation.md` is checked against this union so the prose
18
+ * can't drift from the code.
19
+ */
20
+ const ESCALATION = {
21
+ __proto__: null,
22
+ blocked: "escalate",
23
+ done: "advance",
24
+ "done-with-concerns": "surface",
25
+ "needs-context": "redispatch"
26
+ };
27
+ /**
28
+ * The canonical status set, sorted, for callers that need to enumerate or
29
+ * validate against the full vocabulary (the doc-parity check reads this).
30
+ */
31
+ const SUBAGENT_STATUSES = [
32
+ "blocked",
33
+ "done",
34
+ "done-with-concerns",
35
+ "needs-context"
36
+ ];
37
+ /**
38
+ * Map a terminal status to the orchestrator action it requires. A status
39
+ * outside the vocabulary is itself a contract violation, so this throws rather
40
+ * than guessing — never force a retry on an unrecognized state.
41
+ */
42
+ function escalationFor(status) {
43
+ const action = ESCALATION[status];
44
+ if (!action) throw new require_primordials_error.ErrorCtor(`escalationFor: unknown subagent status "${status}". Expected one of: ${SUBAGENT_STATUSES.join(", ")}. Return a status from the SubagentStatus contract.`);
45
+ return action;
46
+ }
47
+ /**
48
+ * True when `value` names a status in the contract.
49
+ */
50
+ function isSubagentStatus(value) {
51
+ return SUBAGENT_STATUSES.includes(value);
52
+ }
53
+
54
+ //#endregion
55
+ exports.SUBAGENT_STATUSES = SUBAGENT_STATUSES;
56
+ exports.escalationFor = escalationFor;
57
+ exports.isSubagentStatus = isSubagentStatus;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @file Canonical model + reasoning-effort ladder for AI orchestrators. The
3
+ * fleet's AI-fix / AI-codify orchestrators pick a capability TIER per unit of
4
+ * work (a lint rule, a hook, a doc edit) and resolve it to a concrete `{
5
+ * model, effort }` pair. Before this module each orchestrator redefined the
6
+ * same three-row table, so a model-generation bump (Sonnet 4.6 → 5.0, Opus
7
+ * 4.8 → 4.9) meant editing N files and risked drift. Import `AI_TIER` /
8
+ * `tierToSpawn` here instead; a generation roll is then a single edit. The
9
+ * mapping encodes the CLAUDE.md token-spend rule ("match model AND effort to
10
+ * the job"): a cheap model left on the session's default effort still burns
11
+ * reasoning a mechanical task never needs, and a premium model on low effort
12
+ * under-thinks a hard one — so effort is pinned ALONGSIDE the model per
13
+ * tier.
14
+ */
15
+ import type { AiEffort } from './types.mts';
16
+ /**
17
+ * The capability tiers, least → most capable. Orchestrators classify each unit
18
+ * of work into one of these (a regex-shaped rewrite → `haiku`; a caller-chain
19
+ * rewrite → `sonnet`; a module split / new-enforcer authoring → `opus`).
20
+ * `fable` is the apex escalation tier — reserve it for the hardest cases (a
21
+ * stuck compiler / native problem, planning + decomposition of a large task),
22
+ * never a first reach, and prefer to ask before selecting it. It is the most
23
+ * expensive model on the board (~2× opus, ~10× haiku output), so an
24
+ * orchestrator should pick the LEAST-capable tier that does the job and
25
+ * escalate to `fable` only after cheaper tiers fail.
26
+ */
27
+ export type AiTier = 'fable' | 'haiku' | 'opus' | 'sonnet';
28
+ /**
29
+ * Resolved spawn parameters for a tier — spread alongside an `AI_PROFILE` into
30
+ * a `spawnAiAgent` call (`{ ...AI_PROFILE.verify, ...tierToSpawn('opus'),
31
+ * prompt, cwd }`).
32
+ */
33
+ export interface TierSpawn {
34
+ readonly effort: AiEffort;
35
+ readonly model: string;
36
+ }
37
+ /**
38
+ * Canonical tier → { model, effort }. The single source of truth for which
39
+ * Claude model + effort each tier runs. Bump here on a model generation roll;
40
+ * every orchestrator that imports this picks it up.
41
+ *
42
+ * - `haiku` / low — deterministic, regex-shaped rewrites (identifier rename,
43
+ * null→undefined, single-token substitution).
44
+ * - `sonnet` / medium — control-flow / caller-chain reasoning (fetch→httpJson,
45
+ * sync→async), a check script, a doc edit.
46
+ * - `opus` / high — real authoring / refactoring (module split, a brand-new hook
47
+ * or lint rule with its test).
48
+ * - `fable` / xhigh — apex escalation only: a stuck compiler / native problem
49
+ * after cheaper tiers fail, or planning + decomposition of a large task whose
50
+ * chunks then run on cheaper tiers. Most expensive model on the board; never
51
+ * a default.
52
+ */
53
+ export declare const AI_TIER: Readonly<Record<AiTier, TierSpawn>>;
54
+ /**
55
+ * Resolve a tier label to its `{ model, effort }` spawn pair. A convenience
56
+ * over indexing `AI_TIER` directly; returns the `sonnet` row for an unknown
57
+ * label so a caller that hands in a stray string degrades to the safe default
58
+ * rather than producing `undefined` model/effort.
59
+ */
60
+ export declare function tierToSpawn(tier: AiTier): TierSpawn;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with rolldown */
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ //#region src/ai/tier.mts
6
+ /**
7
+ * Canonical tier → { model, effort }. The single source of truth for which
8
+ * Claude model + effort each tier runs. Bump here on a model generation roll;
9
+ * every orchestrator that imports this picks it up.
10
+ *
11
+ * - `haiku` / low — deterministic, regex-shaped rewrites (identifier rename,
12
+ * null→undefined, single-token substitution).
13
+ * - `sonnet` / medium — control-flow / caller-chain reasoning (fetch→httpJson,
14
+ * sync→async), a check script, a doc edit.
15
+ * - `opus` / high — real authoring / refactoring (module split, a brand-new hook
16
+ * or lint rule with its test).
17
+ * - `fable` / xhigh — apex escalation only: a stuck compiler / native problem
18
+ * after cheaper tiers fail, or planning + decomposition of a large task whose
19
+ * chunks then run on cheaper tiers. Most expensive model on the board; never
20
+ * a default.
21
+ */
22
+ const AI_TIER = {
23
+ __proto__: null,
24
+ fable: {
25
+ effort: "xhigh",
26
+ model: "claude-fable-5"
27
+ },
28
+ haiku: {
29
+ effort: "low",
30
+ model: "claude-haiku-4-5"
31
+ },
32
+ opus: {
33
+ effort: "high",
34
+ model: "claude-opus-4-8"
35
+ },
36
+ sonnet: {
37
+ effort: "medium",
38
+ model: "claude-sonnet-4-6"
39
+ }
40
+ };
41
+ /**
42
+ * Resolve a tier label to its `{ model, effort }` spawn pair. A convenience
43
+ * over indexing `AI_TIER` directly; returns the `sonnet` row for an unknown
44
+ * label so a caller that hands in a stray string degrades to the safe default
45
+ * rather than producing `undefined` model/effort.
46
+ */
47
+ function tierToSpawn(tier) {
48
+ return AI_TIER[tier] ?? AI_TIER.sonnet;
49
+ }
50
+
51
+ //#endregion
52
+ exports.AI_TIER = AI_TIER;
53
+ exports.tierToSpawn = tierToSpawn;
@@ -26,8 +26,14 @@ export type AiAgentName = 'claude' | 'codex' | 'gemini' | 'opencode';
26
26
  */
27
27
  export type PermissionMode = 'acceptEdits' | 'dontAsk' | 'plan';
28
28
  /**
29
- * Reasoning-effort level for the agent session. Maps to the claude CLI
30
- * `--effort <level>` flag (claude-specific; other agents ignore it). Pair a
29
+ * Reasoning-effort level for the agent session. Two agents consume it, each via
30
+ * its own flag `buildArgs` translates per-agent:
31
+ *
32
+ * - Claude: `--effort <level>`, accepts low/medium/high/xhigh/max.
33
+ * - Codex: `-c model_reasoning_effort=<level>`, accepts minimal/low/medium/high/
34
+ * xhigh (no `max` — `buildArgs` clamps `max` → `xhigh`, codex's ceiling).
35
+ *
36
+ * Gemini / opencode have no reasoning-effort flag, so they ignore it. Pair a
31
37
  * cheap model with low effort for mechanical work and reserve high/max for
32
38
  * tasks that genuinely need deeper reasoning.
33
39
  */
@@ -41,8 +47,25 @@ export interface AgentSpawnResult {
41
47
  readonly attempts: number;
42
48
  readonly durationMs: number;
43
49
  readonly exitCode: number;
50
+ /**
51
+ * True when the spawn failed because the API stayed overloaded (HTTP 529 /
52
+ * "Overloaded") through every retry. Lets a caller distinguish "back off and
53
+ * retry later" from "the work genuinely failed" — both surface as a non-zero
54
+ * `exitCode`, so this is the only way to tell them apart.
55
+ */
56
+ readonly overloaded: boolean;
44
57
  readonly stderr: string;
45
58
  readonly stdout: string;
59
+ /**
60
+ * True when the selected MODEL could not serve the request — it is offline
61
+ * (e.g. "Claude Fable 5 is currently unavailable") or gated/absent for this
62
+ * account ("issue with the selected model … may not exist or you may not have
63
+ * access"). Distinct from `overloaded`: the model is not coming back within a
64
+ * retry window, so the right response is to FALL OVER to the next agent in
65
+ * the tier chain rather than retry the same one. Both surface as a non-zero
66
+ * `exitCode`; this flag is how a caller knows to route elsewhere.
67
+ */
68
+ readonly unavailable: boolean;
46
69
  }
47
70
  /**
48
71
  * Inputs to a single agent spawn.
@@ -133,6 +133,10 @@ async function runOne(item, index, worktreeBranch, worktreePath, baseRepo, branc
133
133
  * ```
134
134
  */
135
135
  async function spawnAiAgentsInWorktrees(items, fn, options) {
136
+ options = {
137
+ __proto__: null,
138
+ ...options
139
+ };
136
140
  const cleanup = options.cleanup ?? "always";
137
141
  const namePrefix = options.namePrefix ?? "agent-task";
138
142
  const concurrency = require_primordials_math.MathMax(1, Math.min(options.concurrency ?? DEFAULT_CONCURRENCY, MAX_CONCURRENCY));
@@ -4,8 +4,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
5
  const require_primordials_error = require('../primordials/error.js');
6
6
  const require_paths_normalize = require('../paths/normalize.js');
7
- const require_archives__internal = require('./_internal.js');
8
7
  const require_fs_safe = require('../fs/safe.js');
8
+ const require_archives__internal = require('./_internal.js');
9
9
  let node_fs = require("node:fs");
10
10
  let node_process = require("node:process");
11
11
  node_process = require_runtime.__toESM(node_process);
@@ -2,13 +2,13 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_primordials_error = require('../primordials/error.js');
5
+ const require_primordials_map_set = require('../primordials/map-set.js');
5
6
  const require_paths_normalize = require('../paths/normalize.js');
6
7
  const require_primordials_array = require('../primordials/array.js');
7
- const require_primordials_map_set = require('../primordials/map-set.js');
8
8
  const require_node_path = require('../node/path.js');
9
9
  const require_primordials_promise = require('../primordials/promise.js');
10
- const require_archives__internal = require('./_internal.js');
11
10
  const require_fs_safe = require('../fs/safe.js');
11
+ const require_archives__internal = require('./_internal.js');
12
12
 
13
13
  //#region src/archives/zip.ts
14
14
  /**
@@ -3,10 +3,28 @@
3
3
  * yargs-parser with a Node.js parseArgs-compatible surface for booleans,
4
4
  * strings, arrays, aliases, defaults, and coercion.
5
5
  */
6
+ /**
7
+ * Yargs parser options interface.
8
+ */
9
+ export interface YargsOptions {
10
+ boolean?: string[] | undefined;
11
+ string?: string[] | undefined;
12
+ array?: string[] | undefined;
13
+ alias?: Record<string, string | string[]> | undefined;
14
+ default?: Record<string, unknown> | undefined;
15
+ coerce?: Record<string, (value: unknown) => unknown> | undefined;
16
+ 'unknown-options-as-args'?: boolean | undefined;
17
+ 'parse-numbers'?: boolean | undefined;
18
+ 'parse-positional-numbers'?: boolean | undefined;
19
+ 'boolean-negation'?: boolean | undefined;
20
+ 'halt-at-non-option'?: boolean | undefined;
21
+ configuration?: Record<string, boolean | string> | undefined;
22
+ strict?: boolean | undefined;
23
+ }
6
24
  /**
7
25
  * Yargs parser result interface.
8
26
  */
9
- interface YargsArguments extends Record<string, unknown> {
27
+ export interface YargsArguments extends Record<string, unknown> {
10
28
  _: string[];
11
29
  $0?: string | undefined;
12
30
  }
@@ -95,4 +113,3 @@ export declare function parseArgs<T = Record<string, unknown>>(config?: ParseArg
95
113
  * ```
96
114
  */
97
115
  export declare function parseArgsWithDefaults<T = Record<string, unknown>>(config?: ParseArgsConfig): ParsedArgs<T>;
98
- export {};
@@ -2,9 +2,9 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
+ const require_primordials_object = require('../primordials/object.js');
5
6
  const require_primordials_string = require('../primordials/string.js');
6
7
  const require_primordials_array = require('../primordials/array.js');
7
- const require_primordials_object = require('../primordials/object.js');
8
8
  let node_process = require("node:process");
9
9
  node_process = require_runtime.__toESM(node_process);
10
10
  let src_external_yargs_parser = require("../external/yargs-parser");
@@ -77,6 +77,10 @@ function joinAnd(arr) {
77
77
  * @returns Formatted string
78
78
  */
79
79
  function joinList(items, options) {
80
+ options = {
81
+ __proto__: null,
82
+ ...options
83
+ };
80
84
  const w = options?.with;
81
85
  if (w === "and") return require_arrays__internal.getConjunctionFormatter().format(items.map(String));
82
86
  if (w === "or") return require_arrays__internal.getDisjunctionFormatter().format(items.map(String));
package/dist/bin/find.js CHANGED
@@ -3,18 +3,18 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
5
  const require_constants_platform = require('../constants/platform.js');
6
+ const require_env_home = require('../env/home.js');
7
+ const require_env_xdg = require('../env/xdg.js');
6
8
  const require_primordials_array = require('../primordials/array.js');
7
9
  const require_node_fs = require('../node/fs.js');
8
10
  const require_node_path = require('../node/path.js');
9
11
  const require_bin_which = require('./which.js');
10
- const require_env_home = require('../env/home.js');
11
12
  const require_env_windows = require('../env/windows.js');
12
- const require_env_xdg = require('../env/xdg.js');
13
13
  const require_bin_shadow = require('./shadow.js');
14
- let src_external_which = require("../external/which");
15
- src_external_which = require_runtime.__toESM(src_external_which);
16
14
  let node_process = require("node:process");
17
15
  node_process = require_runtime.__toESM(node_process);
16
+ let src_external_which = require("../external/which");
17
+ src_external_which = require_runtime.__toESM(src_external_which);
18
18
 
19
19
  //#region src/bin/find.ts
20
20
  /**