@socketsecurity/lib 6.0.6 → 6.0.8
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/CHANGELOG.md +46 -1
- package/README.md +1 -1
- package/dist/ai/agent-context.d.mts +103 -0
- package/dist/ai/agent-context.js +157 -0
- package/dist/ai/backends.d.mts +83 -0
- package/dist/ai/backends.js +173 -0
- package/dist/ai/credentials.d.mts +49 -0
- package/dist/ai/credentials.js +82 -0
- package/dist/ai/discover.d.mts +6 -2
- package/dist/ai/discover.js +4 -3
- package/dist/ai/exec.d.mts +52 -0
- package/dist/ai/exec.js +92 -0
- package/dist/ai/http.d.mts +132 -0
- package/dist/ai/http.js +130 -0
- package/dist/ai/profiles.d.mts +41 -6
- package/dist/ai/profiles.js +52 -10
- package/dist/ai/route.d.mts +69 -0
- package/dist/ai/route.js +156 -0
- package/dist/ai/spawn.d.mts +10 -2
- package/dist/ai/spawn.js +56 -31
- package/dist/ai/subagent-status.d.mts +48 -0
- package/dist/ai/subagent-status.js +57 -0
- package/dist/ai/tier.d.mts +60 -0
- package/dist/ai/tier.js +53 -0
- package/dist/ai/types.d.mts +31 -6
- package/dist/ai/worktree.d.mts +6 -6
- package/dist/ai/worktree.js +5 -1
- package/dist/ansi/strip.d.ts +1 -1
- package/dist/ansi/strip.js +0 -2
- package/dist/archives/_internal.js +7 -9
- package/dist/archives/extract.js +1 -1
- package/dist/archives/tar.js +7 -7
- package/dist/archives/zip.js +5 -7
- package/dist/argv/flag-predicates.d.ts +12 -12
- package/dist/argv/flag-predicates.js +17 -17
- package/dist/argv/flag-types.d.ts +18 -18
- package/dist/argv/flag-types.js +4 -4
- package/dist/argv/parse.d.ts +20 -3
- package/dist/argv/parse.js +1 -1
- package/dist/arrays/_internal.js +11 -12
- package/dist/arrays/chunk.js +0 -1
- package/dist/arrays/join.d.ts +37 -3
- package/dist/arrays/join.js +47 -7
- package/dist/arrays/unique.js +0 -1
- package/dist/bin/_internal.d.ts +1 -1
- package/dist/bin/_internal.js +1 -1
- package/dist/bin/exec.js +2 -3
- package/dist/bin/find.js +17 -17
- package/dist/bin/prim.cjs +36175 -35861
- package/dist/bin/resolve.js +13 -14
- package/dist/bin/which.js +8 -8
- package/dist/cache/ttl/store.js +6 -6
- package/dist/checks/primordials-defaults.d.ts +3 -3
- package/dist/checks/primordials-defaults.js +3 -3
- package/dist/checks/primordials.js +4 -3
- package/dist/{bin → cli}/check-primordials.d.ts +18 -13
- package/dist/{bin → cli}/check-primordials.js +58 -55
- package/dist/{bin → cli}/check.js +3 -3
- package/dist/{bin → cli}/socket-lib.d.ts +1 -1
- package/dist/{bin → cli}/socket-lib.js +4 -4
- package/dist/colors/socket-palette.js +7 -9
- package/dist/compression/_internal.d.ts +12 -12
- package/dist/compression/_internal.js +18 -18
- package/dist/compression/brotli.d.ts +26 -27
- package/dist/compression/brotli.js +39 -35
- package/dist/compression/gzip.d.ts +23 -23
- package/dist/compression/gzip.js +46 -42
- package/dist/constants/agents.d.ts +3 -1
- package/dist/constants/agents.js +15 -11
- package/dist/constants/licenses.js +3 -3
- package/dist/constants/node.d.ts +23 -0
- package/dist/constants/node.js +47 -15
- package/dist/constants/packages.d.ts +3 -0
- package/dist/constants/packages.js +24 -29
- package/dist/constants/platform.d.ts +30 -3
- package/dist/constants/platform.js +72 -12
- package/dist/constants/runtime.d.ts +22 -0
- package/dist/constants/runtime.js +32 -0
- package/dist/constants/socket.d.ts +2 -6
- package/dist/constants/socket.js +12 -14
- package/dist/cover/code.js +10 -10
- package/dist/cover/formatters.js +5 -5
- package/dist/crypto/hash.d.ts +30 -2
- package/dist/crypto/hash.js +47 -13
- package/dist/debug/_internal.js +4 -6
- package/dist/debug/caller-info.js +3 -4
- package/dist/debug/namespace.d.ts +7 -0
- package/dist/debug/namespace.js +21 -12
- package/dist/debug/output.js +21 -24
- package/dist/debug/types.d.ts +4 -4
- package/dist/dlx/arborist.js +18 -8
- package/dist/dlx/binary-cache.js +15 -15
- package/dist/dlx/binary-download.d.ts +1 -1
- package/dist/dlx/binary-download.js +11 -11
- package/dist/dlx/binary-resolution.js +17 -15
- package/dist/dlx/binary-types.d.ts +5 -5
- package/dist/dlx/binary.js +5 -5
- package/dist/dlx/cache.js +1 -1
- package/dist/dlx/detect.d.ts +42 -25
- package/dist/dlx/detect.js +86 -77
- package/dist/dlx/dir.js +2 -2
- package/dist/dlx/firewall.d.ts +9 -1
- package/dist/dlx/firewall.js +1 -1
- package/dist/dlx/lockfile.d.ts +19 -18
- package/dist/dlx/lockfile.js +19 -16
- package/dist/dlx/manifest.d.ts +6 -6
- package/dist/dlx/manifest.js +5 -5
- package/dist/dlx/package.d.ts +10 -10
- package/dist/dlx/package.js +20 -16
- package/dist/dlx/packages.js +4 -4
- package/dist/dlx/paths.js +7 -7
- package/dist/dlx/spec.js +1 -1
- package/dist/dlx/types.d.ts +28 -27
- package/dist/eco/cargo/parse-lockfile.d.ts +2 -3
- package/dist/eco/cargo/parse-lockfile.js +5 -5
- package/dist/eco/manifest/analyze-lockfile.js +2 -2
- package/dist/eco/manifest/detect-format.js +5 -5
- package/dist/eco/manifest/find-packages.js +2 -2
- package/dist/eco/manifest/get-package-versions.js +2 -2
- package/dist/eco/manifest/get-package.js +2 -2
- package/dist/eco/manifest/parse-lockfile.js +2 -2
- package/dist/eco/manifest/parse-manifest.js +2 -2
- package/dist/eco/manifest/parse.js +2 -2
- package/dist/eco/npm/npm/exec.js +2 -2
- package/dist/eco/npm/npm/flags.js +7 -12
- package/dist/eco/npm/npm/parse-lockfile.d.ts +17 -18
- package/dist/eco/npm/npm/parse-lockfile.js +4 -4
- package/dist/eco/npm/parse-package-json.d.ts +11 -0
- package/dist/eco/npm/parse-package-json.js +3 -3
- package/dist/eco/npm/pnpm/exec.d.ts +1 -1
- package/dist/eco/npm/pnpm/exec.js +5 -5
- package/dist/eco/npm/pnpm/flags.js +0 -3
- package/dist/eco/npm/pnpm/parse-lockfile.d.ts +6 -4
- package/dist/eco/npm/pnpm/parse-lockfile.js +7 -7
- package/dist/eco/npm/script.js +9 -6
- package/dist/eco/npm/yarnpkg/yarn/exec.js +4 -4
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.d.ts +3 -4
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +9 -9
- package/dist/effects/pulse-frames.d.ts +3 -1
- package/dist/effects/shimmer-keyframes.d.ts +1 -1
- package/dist/effects/shimmer-terminal.d.ts +1 -1
- package/dist/env/boolean.js +0 -1
- package/dist/env/ci.js +0 -1
- package/dist/env/debug.js +0 -1
- package/dist/env/github-status.d.ts +51 -0
- package/dist/env/github-status.js +90 -0
- package/dist/env/github.js +0 -8
- package/dist/env/home.js +0 -1
- package/dist/env/locale.js +0 -3
- package/dist/env/node-auth-token.js +0 -1
- package/dist/env/node-env.js +0 -1
- package/dist/env/node-version-managers.d.ts +53 -0
- package/dist/env/node-version-managers.js +90 -0
- package/dist/env/npm.js +0 -5
- package/dist/env/number.js +0 -1
- package/dist/env/package-manager.js +3 -6
- package/dist/env/path.js +0 -1
- package/dist/env/pre-commit.js +1 -2
- package/dist/env/proxy.js +1 -1
- package/dist/env/rewire.d.ts +8 -6
- package/dist/env/rewire.js +16 -17
- package/dist/env/shell.js +0 -1
- package/dist/env/socket-cli.js +5 -18
- package/dist/env/socket-mcp.d.ts +114 -0
- package/dist/env/socket-mcp.js +146 -0
- package/dist/env/socket.d.ts +8 -109
- package/dist/env/socket.js +22 -167
- package/dist/env/string.js +0 -1
- package/dist/env/temp-dir.js +0 -3
- package/dist/env/term.js +0 -1
- package/dist/env/test.js +3 -6
- package/dist/env/windows.js +0 -4
- package/dist/env/xdg.js +0 -3
- package/dist/errors/predicates.js +1 -1
- package/dist/events/exit/_internal.d.ts +11 -9
- package/dist/events/exit/_internal.js +31 -35
- package/dist/events/exit/handler.js +3 -4
- package/dist/events/exit/intercept.js +4 -6
- package/dist/events/exit/lifecycle.js +16 -18
- package/dist/events/exit/signals.js +1 -2
- package/dist/events/exit/types.d.ts +6 -5
- package/dist/external/@npmcli/package-json.js +2 -2
- package/dist/external/@npmcli/promise-spawn.js +3 -1
- package/dist/external/npm-pack.js +2 -2
- package/dist/external/pico-pack.js +4 -2
- package/dist/external/which.js +3 -1
- package/dist/external-tools/bazel/asset-names.d.ts +1 -1
- package/dist/external-tools/bazel/asset-names.js +5 -2
- package/dist/external-tools/bazel/from-download.d.ts +1 -1
- package/dist/external-tools/bazel/from-download.js +5 -2
- package/dist/external-tools/bazel/read-bazel-version-file.js +1 -1
- package/dist/external-tools/bazel/resolve-bazel-version.js +4 -0
- package/dist/external-tools/bazel/resolve.d.ts +3 -3
- package/dist/external-tools/bazel/resolve.js +16 -8
- package/dist/external-tools/bazel/types.d.ts +1 -1
- package/dist/external-tools/cdxgen/asset-names.d.ts +1 -1
- package/dist/external-tools/cdxgen/asset-names.js +5 -2
- package/dist/external-tools/cdxgen/from-download.d.ts +1 -1
- package/dist/external-tools/cdxgen/from-download.js +7 -4
- package/dist/external-tools/cdxgen/from-vfs.js +1 -1
- package/dist/external-tools/cdxgen/resolve.d.ts +3 -3
- package/dist/external-tools/cdxgen/resolve.js +16 -8
- package/dist/external-tools/cdxgen/types.d.ts +1 -1
- package/dist/external-tools/from-download.d.ts +3 -3
- package/dist/external-tools/from-download.js +12 -6
- package/dist/external-tools/from-pip-venv.d.ts +1 -1
- package/dist/external-tools/from-pip-venv.js +12 -5
- package/dist/external-tools/janus/asset-names.d.ts +1 -1
- package/dist/external-tools/janus/asset-names.js +5 -2
- package/dist/external-tools/janus/from-download.d.ts +1 -1
- package/dist/external-tools/janus/from-download.js +5 -2
- package/dist/external-tools/janus/from-vfs.js +1 -1
- package/dist/external-tools/janus/resolve.d.ts +3 -3
- package/dist/external-tools/janus/resolve.js +16 -8
- package/dist/external-tools/janus/types.d.ts +1 -1
- package/dist/external-tools/jre/asset-names.d.ts +1 -1
- package/dist/external-tools/jre/asset-names.js +5 -2
- package/dist/external-tools/jre/detect-platform-arch.d.ts +10 -6
- package/dist/external-tools/jre/detect-platform-arch.js +29 -14
- package/dist/external-tools/jre/from-download.d.ts +1 -1
- package/dist/external-tools/jre/from-download.js +7 -4
- package/dist/external-tools/jre/from-java-home.js +2 -2
- package/dist/external-tools/jre/from-vfs.js +3 -3
- package/dist/external-tools/jre/resolve.d.ts +3 -3
- package/dist/external-tools/jre/resolve.js +16 -8
- package/dist/external-tools/jre/types.d.ts +1 -1
- package/dist/external-tools/manifest.d.ts +25 -7
- package/dist/external-tools/manifest.js +13 -13
- package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
- package/dist/external-tools/opengrep/asset-names.js +5 -2
- package/dist/external-tools/opengrep/from-download.d.ts +1 -1
- package/dist/external-tools/opengrep/from-download.js +5 -2
- package/dist/external-tools/opengrep/from-vfs.js +1 -1
- package/dist/external-tools/opengrep/resolve.d.ts +3 -3
- package/dist/external-tools/opengrep/resolve.js +16 -8
- package/dist/external-tools/opengrep/types.d.ts +1 -1
- package/dist/external-tools/python/asset-names.d.ts +76 -0
- package/dist/external-tools/python/asset-names.js +111 -0
- package/dist/external-tools/python/dlx.d.ts +80 -0
- package/dist/external-tools/python/dlx.js +98 -0
- package/dist/external-tools/python/from-download.d.ts +53 -0
- package/dist/external-tools/python/from-download.js +75 -0
- package/dist/external-tools/python/from-path.d.ts +7 -0
- package/dist/external-tools/python/from-path.js +23 -0
- package/dist/external-tools/python/pin.d.ts +121 -0
- package/dist/external-tools/python/pin.js +176 -0
- package/dist/external-tools/python/pip-install.d.ts +75 -0
- package/dist/external-tools/python/pip-install.js +142 -0
- package/dist/external-tools/python/resolve.d.ts +42 -0
- package/dist/external-tools/python/resolve.js +66 -0
- package/dist/external-tools/python/types.d.ts +49 -0
- package/dist/external-tools/sbt/asset-names.d.ts +1 -1
- package/dist/external-tools/sbt/asset-names.js +5 -2
- package/dist/external-tools/sbt/from-download.d.ts +1 -1
- package/dist/external-tools/sbt/from-download.js +5 -2
- package/dist/external-tools/sbt/from-vfs.js +1 -1
- package/dist/external-tools/sbt/resolve.d.ts +3 -3
- package/dist/external-tools/sbt/resolve.js +16 -8
- package/dist/external-tools/sbt/types.d.ts +1 -1
- package/dist/external-tools/skillspector/from-dlx.d.ts +1 -1
- package/dist/external-tools/skillspector/from-dlx.js +10 -3
- package/dist/external-tools/skillspector/from-path.js +3 -5
- package/dist/external-tools/skillspector/from-vfs.js +1 -1
- package/dist/external-tools/skillspector/resolve.d.ts +2 -2
- package/dist/external-tools/skillspector/resolve.js +14 -6
- package/dist/external-tools/synp/asset-names.d.ts +1 -1
- package/dist/external-tools/synp/asset-names.js +6 -2
- package/dist/external-tools/synp/from-download.d.ts +1 -1
- package/dist/external-tools/synp/from-download.js +7 -4
- package/dist/external-tools/synp/from-vfs.js +1 -1
- package/dist/external-tools/synp/resolve.d.ts +3 -3
- package/dist/external-tools/synp/resolve.js +16 -8
- package/dist/external-tools/trivy/asset-names.d.ts +1 -1
- package/dist/external-tools/trivy/asset-names.js +5 -2
- package/dist/external-tools/trivy/from-download.d.ts +1 -1
- package/dist/external-tools/trivy/from-download.js +7 -4
- package/dist/external-tools/trivy/from-vfs.js +1 -1
- package/dist/external-tools/trivy/resolve.d.ts +3 -3
- package/dist/external-tools/trivy/resolve.js +16 -8
- package/dist/external-tools/trivy/types.d.ts +1 -1
- package/dist/external-tools/trufflehog/asset-names.d.ts +1 -1
- package/dist/external-tools/trufflehog/asset-names.js +5 -2
- package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
- package/dist/external-tools/trufflehog/from-download.js +7 -4
- package/dist/external-tools/trufflehog/from-vfs.js +1 -1
- package/dist/external-tools/trufflehog/resolve.d.ts +3 -3
- package/dist/external-tools/trufflehog/resolve.js +16 -8
- package/dist/external-tools/trufflehog/types.d.ts +1 -1
- package/dist/fs/_internal.d.ts +1 -1
- package/dist/fs/_internal.js +7 -7
- package/dist/fs/access.js +5 -9
- package/dist/fs/allowed-dirs-cache.d.ts +47 -0
- package/dist/fs/allowed-dirs-cache.js +69 -0
- package/dist/fs/encoding.js +5 -7
- package/dist/fs/{find-up.js → find.js} +12 -14
- package/dist/fs/inspect.js +7 -13
- package/dist/fs/read-dir.js +7 -10
- package/dist/fs/read-file.js +8 -14
- package/dist/fs/read-json-cache.d.ts +13 -4
- package/dist/fs/read-json-cache.js +9 -6
- package/dist/fs/read-json.js +4 -6
- package/dist/fs/resolve-module.js +7 -3
- package/dist/fs/safe.d.ts +1 -1
- package/dist/fs/safe.js +13 -14
- package/dist/fs/unique.js +4 -5
- package/dist/fs/validate.js +1 -2
- package/dist/fs/write-json.js +4 -5
- package/dist/git/_internal.js +11 -11
- package/dist/git/changed.js +4 -4
- package/dist/git/repo.js +5 -7
- package/dist/git/staged.js +12 -4
- package/dist/git/tracked.d.ts +84 -0
- package/dist/git/tracked.js +163 -0
- package/dist/git/unstaged.js +12 -4
- package/dist/github/ghsa.js +2 -2
- package/dist/github/refs-cache.d.ts +1 -1
- package/dist/github/refs-cache.js +5 -5
- package/dist/github/refs-graphql.js +4 -0
- package/dist/github/refs-rest.js +9 -5
- package/dist/github/refs.js +15 -10
- package/dist/github/{fetch.js → request.js} +13 -2
- package/dist/github/token.js +1 -1
- package/dist/github/types.d.ts +1 -1
- package/dist/globs/_internal.js +8 -10
- package/dist/globs/match.js +13 -7
- package/dist/globs/matcher.d.ts +3 -3
- package/dist/globs/matcher.js +16 -14
- package/dist/globs/stream.js +1 -2
- package/dist/globs/types.d.ts +24 -24
- package/dist/http-request/_internal.d.ts +1 -1
- package/dist/http-request/browser.js +10 -4
- package/dist/http-request/checksum-file.d.ts +55 -0
- package/dist/http-request/checksum-file.js +95 -0
- package/dist/http-request/download-types.d.ts +15 -23
- package/dist/http-request/download.js +3 -3
- package/dist/http-request/{browser-fetch.d.ts → fetch/browser.d.ts} +2 -2
- package/dist/http-request/{browser-fetch.js → fetch/browser.js} +4 -4
- package/dist/http-request/headers.js +1 -2
- package/dist/http-request/request-attempt.js +38 -34
- package/dist/http-request/request-types.d.ts +2 -2
- package/dist/http-request/request.js +1 -1
- package/dist/http-request/user-agent.js +4 -5
- package/dist/integrity.d.ts +92 -18
- package/dist/integrity.js +125 -30
- package/dist/ipc/directory.js +2 -2
- package/dist/ipc/paths.js +1 -1
- package/dist/ipc/write.js +1 -1
- package/dist/ipc-cli/get.js +12 -12
- package/dist/json/edit.js +51 -44
- package/dist/json/format.js +1 -1
- package/dist/json/parse.d.ts +1 -1
- package/dist/json/parse.js +3 -7
- package/dist/logger/_internal.d.ts +4 -4
- package/dist/logger/_internal.js +3 -3
- package/dist/logger/colors.js +4 -3
- package/dist/logger/console-methods.d.ts +132 -0
- package/dist/logger/console-methods.js +169 -0
- package/dist/logger/console.d.ts +12 -0
- package/dist/logger/console.js +42 -11
- package/dist/logger/indentation-methods.d.ts +81 -0
- package/dist/logger/indentation-methods.js +121 -0
- package/dist/logger/node.d.ts +16 -338
- package/dist/logger/node.js +75 -608
- package/dist/logger/options.d.ts +39 -0
- package/dist/logger/options.js +47 -0
- package/dist/logger/semantic-methods.d.ts +63 -0
- package/dist/logger/semantic-methods.js +108 -0
- package/dist/logger/stream-methods.d.ts +63 -0
- package/dist/logger/stream-methods.js +101 -0
- package/dist/logger/stream.d.ts +37 -0
- package/dist/logger/stream.js +42 -0
- package/dist/logger/symbols-builder.js +9 -9
- package/dist/logger/symbols.d.ts +2 -25
- package/dist/logger/symbols.js +53 -74
- package/dist/logger/types.d.ts +1 -1
- package/dist/memo/types.d.ts +6 -6
- package/dist/native-messaging/host.d.ts +20 -0
- package/dist/native-messaging/host.js +120 -0
- package/dist/native-messaging/index.d.ts +5 -0
- package/dist/native-messaging/index.js +22 -0
- package/dist/native-messaging/install.d.ts +60 -0
- package/dist/native-messaging/install.js +144 -0
- package/dist/native-messaging/rate-limit.d.ts +69 -0
- package/dist/native-messaging/rate-limit.js +119 -0
- package/dist/native-messaging/run.d.ts +10 -0
- package/dist/native-messaging/run.js +17 -0
- package/dist/node/async-hooks.js +4 -3
- package/dist/node/child-process.js +4 -3
- package/dist/node/crypto.js +4 -3
- package/dist/node/events.js +4 -3
- package/dist/node/fs-promises.js +4 -3
- package/dist/node/fs.d.ts +22 -6
- package/dist/node/fs.js +17 -3
- package/dist/node/http.js +4 -3
- package/dist/node/https.js +4 -3
- package/dist/node/module.js +10 -6
- package/dist/node/os.d.ts +10 -2
- package/dist/node/os.js +12 -4
- package/dist/node/path.d.ts +11 -2
- package/dist/node/path.js +18 -4
- package/dist/node/timers-promises.js +4 -3
- package/dist/node/url.js +4 -3
- package/dist/node/util.js +4 -3
- package/dist/objects/getters.js +6 -8
- package/dist/objects/inspect.js +1 -4
- package/dist/objects/mutate.js +4 -5
- package/dist/objects/predicates.js +1 -5
- package/dist/objects/sort.js +3 -7
- package/dist/packages/edit-class.d.ts +2 -3
- package/dist/packages/edit-class.js +53 -48
- package/dist/packages/edit.js +12 -14
- package/dist/packages/exports.js +15 -21
- package/dist/packages/fetch.d.ts +16 -0
- package/dist/packages/fetch.js +81 -0
- package/dist/packages/find.d.ts +55 -0
- package/dist/packages/find.js +65 -0
- package/dist/packages/isolation.js +14 -14
- package/dist/packages/licenses.js +18 -18
- package/dist/packages/manifest.js +16 -19
- package/dist/packages/metadata-extensions.d.ts +14 -0
- package/dist/packages/metadata-extensions.js +43 -0
- package/dist/packages/normalize.js +6 -10
- package/dist/packages/provenance.js +17 -19
- package/dist/packages/read.d.ts +29 -0
- package/dist/packages/read.js +66 -0
- package/dist/packages/specs.d.ts +48 -1
- package/dist/packages/specs.js +75 -12
- package/dist/packages/tarball.d.ts +24 -0
- package/dist/packages/tarball.js +81 -0
- package/dist/packages/types.d.ts +22 -22
- package/dist/packages/validation.js +0 -3
- package/dist/paths/_internal.d.ts +2 -1
- package/dist/paths/_internal.js +7 -19
- package/dist/paths/conversion.js +5 -9
- package/dist/paths/dirnames.d.ts +1 -0
- package/dist/paths/dirnames.js +2 -0
- package/dist/paths/filenames.d.ts +0 -1
- package/dist/paths/filenames.js +0 -2
- package/dist/paths/normalize.js +4 -5
- package/dist/paths/packages.js +4 -7
- package/dist/paths/predicates.js +9 -16
- package/dist/paths/resolve.js +17 -25
- package/dist/paths/rewire.d.ts +5 -0
- package/dist/paths/rewire.js +3 -3
- package/dist/paths/socket.d.ts +74 -111
- package/dist/paths/socket.js +106 -139
- package/dist/paths/walk.d.ts +1 -1
- package/dist/paths/walk.js +4 -4
- package/dist/perf/report.js +2 -2
- package/dist/perf/types.d.ts +1 -1
- package/dist/pkg-ext/data.js +1 -1
- package/dist/primordials/array.js +9 -9
- package/dist/primordials/date.js +2 -2
- package/dist/primordials/error.js +3 -3
- package/dist/primordials/headers.d.ts +10 -0
- package/dist/primordials/headers.js +23 -0
- package/dist/primordials/intl.d.ts +13 -0
- package/dist/primordials/intl.js +26 -0
- package/dist/primordials/math.js +33 -33
- package/dist/primordials/number.js +9 -9
- package/dist/primordials/object.js +5 -5
- package/dist/primordials/process.d.ts +88 -0
- package/dist/primordials/process.js +132 -0
- package/dist/primordials/string.d.ts +2 -2
- package/dist/primordials/string.js +6 -6
- package/dist/primordials/symbol.js +3 -3
- package/dist/primordials/uncurry.d.ts +1 -2
- package/dist/primordials/uncurry.js +9 -9
- package/dist/process/abort.js +3 -3
- package/dist/process/lock-manager.js +8 -8
- package/dist/process/spawn/_internal.js +6 -8
- package/dist/process/spawn/child.js +20 -14
- package/dist/process/spawn/errors.js +3 -5
- package/dist/process/spawn/kill-tree.d.ts +53 -0
- package/dist/process/spawn/kill-tree.js +85 -0
- package/dist/process/spawn/stdio.js +0 -1
- package/dist/process/spawn/types.d.ts +5 -5
- package/dist/process/transient.js +2 -2
- package/dist/promises/_internal.d.ts +2 -1
- package/dist/promises/_internal.js +2 -6
- package/dist/promises/iterate.js +11 -15
- package/dist/promises/options.js +3 -6
- package/dist/promises/retry.js +4 -5
- package/dist/promises/timers.d.ts +30 -0
- package/dist/promises/timers.js +48 -0
- package/dist/regexps/spec.js +1 -1
- package/dist/releases/github-archives.d.ts +6 -6
- package/dist/releases/github-archives.js +3 -3
- package/dist/releases/github-asset-url.d.ts +1 -1
- package/dist/releases/github-asset-url.js +5 -5
- package/dist/releases/github-downloads.d.ts +1 -1
- package/dist/releases/github-downloads.js +3 -3
- package/dist/releases/github-listing.d.ts +12 -4
- package/dist/releases/github-listing.js +20 -7
- package/dist/releases/github-retry-config.js +1 -1
- package/dist/releases/github-types.d.ts +6 -6
- package/dist/releases/socket-btm-binary-naming.d.ts +107 -0
- package/dist/releases/socket-btm-binary-naming.js +155 -0
- package/dist/releases/socket-btm.d.ts +8 -115
- package/dist/releases/socket-btm.js +16 -159
- package/dist/schema/types.d.ts +4 -5
- package/dist/schema/validate.js +1 -1
- package/dist/sea/detect.js +6 -6
- package/dist/secrets/_internal.d.ts +2 -2
- package/dist/secrets/_internal.js +2 -2
- package/dist/secrets/compare.d.ts +45 -0
- package/dist/secrets/compare.js +61 -0
- package/dist/secrets/find.d.ts +2 -2
- package/dist/secrets/find.js +10 -4
- package/dist/secrets/keychain.d.ts +1 -1
- package/dist/secrets/keychain.js +6 -4
- package/dist/secrets/linux.js +40 -52
- package/dist/secrets/macos.d.ts +2 -3
- package/dist/secrets/macos.js +24 -33
- package/dist/secrets/rc.d.ts +4 -4
- package/dist/secrets/rc.js +27 -17
- package/dist/secrets/socket-api-token.d.ts +4 -4
- package/dist/secrets/socket-api-token.js +26 -9
- package/dist/secrets/windows.js +32 -37
- package/dist/shadow/skip.js +2 -2
- package/dist/shell/parse.d.ts +32 -0
- package/dist/shell/parse.js +60 -0
- package/dist/smol/detect.js +9 -10
- package/dist/smol/http.js +6 -7
- package/dist/smol/https.js +6 -7
- package/dist/smol/manifest.d.ts +1 -1
- package/dist/smol/manifest.js +6 -7
- package/dist/smol/path.d.ts +1 -1
- package/dist/smol/path.js +7 -8
- package/dist/smol/primordial.d.ts +4 -0
- package/dist/smol/primordial.js +6 -7
- package/dist/smol/purl.d.ts +1 -1
- package/dist/smol/purl.js +7 -8
- package/dist/smol/versions.js +6 -7
- package/dist/smol/vfs.js +6 -7
- package/dist/sorts/_internal.js +6 -8
- package/dist/sorts/natural.js +10 -12
- package/dist/sorts/semver.js +1 -2
- package/dist/sorts/strings.js +0 -1
- package/dist/sorts/types.d.ts +1 -1
- package/dist/spinner/create-spinner-class.d.ts +38 -0
- package/dist/spinner/create-spinner-class.js +302 -0
- package/dist/spinner/default.js +8 -9
- package/dist/spinner/spinner-internals.d.ts +36 -0
- package/dist/spinner/spinner-internals.js +105 -0
- package/dist/spinner/spinner-shimmer-methods.d.ts +54 -0
- package/dist/spinner/spinner-shimmer-methods.js +143 -0
- package/dist/spinner/spinner-status-methods.d.ts +40 -0
- package/dist/spinner/spinner-status-methods.js +133 -0
- package/dist/spinner/spinner.d.ts +8 -5
- package/dist/spinner/spinner.js +19 -706
- package/dist/spinner/types.d.ts +3 -1
- package/dist/spinner/with.d.ts +10 -0
- package/dist/spinner/with.js +16 -2
- package/dist/stdio/divider.js +1 -1
- package/dist/stdio/footer.js +3 -3
- package/dist/stdio/header.js +4 -4
- package/dist/stdio/progress.js +10 -6
- package/dist/stdio/prompts.d.ts +7 -5
- package/dist/stdio/prompts.js +7 -8
- package/dist/stdio/stdout.js +3 -3
- package/dist/streams/parallel.js +3 -5
- package/dist/streams/transform.js +2 -3
- package/dist/strings/format.js +2 -6
- package/dist/strings/predicates.js +0 -2
- package/dist/strings/search.js +1 -2
- package/dist/strings/transform.js +0 -3
- package/dist/strings/width.js +9 -10
- package/dist/tables/bordered.js +4 -3
- package/dist/tables/padding.js +1 -1
- package/dist/tables/simple.js +8 -5
- package/dist/temporal/instant.js +1 -1
- package/dist/temporal/slots.js +6 -6
- package/dist/temporal/system.js +9 -9
- package/dist/themes/context.d.ts +3 -2
- package/dist/themes/context.js +4 -5
- package/dist/themes/themes.js +15 -15
- package/dist/themes/types.d.ts +3 -3
- package/dist/url/assert-safe.d.ts +29 -0
- package/dist/url/assert-safe.js +54 -0
- package/dist/url/parse.js +0 -2
- package/dist/url/predicates.d.ts +31 -1
- package/dist/url/predicates.js +43 -3
- package/dist/url/search-params.js +3 -9
- package/dist/url/types.d.ts +9 -5
- package/dist/versions/_internal.js +3 -3
- package/dist/words/article.js +0 -1
- package/dist/words/capitalize.js +0 -1
- package/dist/words/pluralize.js +15 -5
- package/package.json +419 -216
- package/dist/external-tools/uv/asset-names.d.ts +0 -36
- package/dist/external-tools/uv/asset-names.js +0 -70
- package/dist/external-tools/uv/from-download.d.ts +0 -17
- package/dist/external-tools/uv/from-download.js +0 -47
- package/dist/external-tools/uv/from-path.d.ts +0 -5
- package/dist/external-tools/uv/from-path.js +0 -22
- package/dist/external-tools/uv/from-vfs.d.ts +0 -7
- package/dist/external-tools/uv/from-vfs.js +0 -26
- package/dist/external-tools/uv/resolve.d.ts +0 -25
- package/dist/external-tools/uv/resolve.js +0 -53
- package/dist/external-tools/uv/types.d.ts +0 -24
- package/dist/fs/path-cache.d.ts +0 -21
- package/dist/fs/path-cache.js +0 -34
- package/dist/http-request/checksums.d.ts +0 -69
- package/dist/http-request/checksums.js +0 -108
- package/dist/http-request/http-request.d.ts +0 -12
- package/dist/http-request/http-request.js +0 -11
- package/dist/packages/operations.d.ts +0 -113
- package/dist/packages/operations.js +0 -304
- package/dist/ssri/convert.d.ts +0 -48
- package/dist/ssri/convert.js +0 -69
- package/dist/ssri/parse.d.ts +0 -27
- package/dist/ssri/parse.js +0 -41
- package/dist/ssri/validate.d.ts +0 -41
- package/dist/ssri/validate.js +0 -56
- /package/dist/{bin → cli}/check.d.ts +0 -0
- /package/dist/external-tools/{uv → python}/types.js +0 -0
- /package/dist/fs/{find-up.d.ts → find.d.ts} +0 -0
- /package/dist/github/{fetch.d.ts → request.d.ts} +0 -0
package/dist/ai/profiles.js
CHANGED
|
@@ -4,6 +4,35 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
|
|
5
5
|
//#region src/ai/profiles.mts
|
|
6
6
|
/**
|
|
7
|
+
* Composable Bash-allowlist building blocks. Each group is a frozen list of
|
|
8
|
+
* `Bash(<cmd>:*)` glob entries; the profiles below compose tiers from them, and
|
|
9
|
+
* callers can mix their own (`allow: [...BASH_ALLOW.test, 'Bash(make:*)']`)
|
|
10
|
+
* without rewriting a whole tier's literal.
|
|
11
|
+
*
|
|
12
|
+
* - `gitRead` — non-mutating inspection (`status` / `diff` / `log`).
|
|
13
|
+
* - `gitWrite` — mutating (`add` / `commit`). The bright line between `verify`
|
|
14
|
+
* (may NOT land) and `full` (may land).
|
|
15
|
+
* - `node` — run a `.mts` / `.js` directly (tests, check scripts, codegen).
|
|
16
|
+
* - `test` — `pnpm test` / `pnpm run <script>` (the verify surface).
|
|
17
|
+
* - `pkgExec` — `pnpm exec` (run a workspace bin); broader, full-tier only.
|
|
18
|
+
*/
|
|
19
|
+
const BASH_ALLOW = {
|
|
20
|
+
gitRead: [
|
|
21
|
+
"Bash(git status:*)",
|
|
22
|
+
"Bash(git diff:*)",
|
|
23
|
+
"Bash(git log:*)"
|
|
24
|
+
],
|
|
25
|
+
gitWrite: ["Bash(git add:*)", "Bash(git commit:*)"],
|
|
26
|
+
node: ["Bash(node:*)"],
|
|
27
|
+
pkgExec: ["Bash(pnpm exec:*)"],
|
|
28
|
+
test: ["Bash(pnpm run:*)", "Bash(pnpm test:*)"]
|
|
29
|
+
};
|
|
30
|
+
const VERIFY_BASH_ALLOW = [
|
|
31
|
+
...BASH_ALLOW.gitRead,
|
|
32
|
+
...BASH_ALLOW.node,
|
|
33
|
+
...BASH_ALLOW.test
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
7
36
|
* Capability ladder of lockdown profiles, ordered least → most capable. Key
|
|
8
37
|
* order documents the ladder; each tier is a strict superset of the previous
|
|
9
38
|
* tier's tool surface.
|
|
@@ -63,17 +92,29 @@ const AI_PROFILE = {
|
|
|
63
92
|
"Write"
|
|
64
93
|
]
|
|
65
94
|
},
|
|
95
|
+
verify: {
|
|
96
|
+
allow: [...VERIFY_BASH_ALLOW],
|
|
97
|
+
disallow: [
|
|
98
|
+
"Agent",
|
|
99
|
+
"WebFetch",
|
|
100
|
+
"WebSearch"
|
|
101
|
+
],
|
|
102
|
+
permissionMode: "acceptEdits",
|
|
103
|
+
tools: [
|
|
104
|
+
"Bash",
|
|
105
|
+
"Edit",
|
|
106
|
+
"Glob",
|
|
107
|
+
"Grep",
|
|
108
|
+
"MultiEdit",
|
|
109
|
+
"Read",
|
|
110
|
+
"Write"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
66
113
|
full: {
|
|
67
114
|
allow: [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"Bash(git add:*)",
|
|
72
|
-
"Bash(git commit:*)",
|
|
73
|
-
"Bash(node:*)",
|
|
74
|
-
"Bash(pnpm exec:*)",
|
|
75
|
-
"Bash(pnpm run:*)",
|
|
76
|
-
"Bash(pnpm test:*)"
|
|
115
|
+
...VERIFY_BASH_ALLOW,
|
|
116
|
+
...BASH_ALLOW.gitWrite,
|
|
117
|
+
...BASH_ALLOW.pkgExec
|
|
77
118
|
],
|
|
78
119
|
disallow: [
|
|
79
120
|
"Agent",
|
|
@@ -94,4 +135,5 @@ const AI_PROFILE = {
|
|
|
94
135
|
};
|
|
95
136
|
|
|
96
137
|
//#endregion
|
|
97
|
-
exports.AI_PROFILE = AI_PROFILE;
|
|
138
|
+
exports.AI_PROFILE = AI_PROFILE;
|
|
139
|
+
exports.BASH_ALLOW = BASH_ALLOW;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Availability-gated tier routing. `tier.mts` says which model+effort is
|
|
3
|
+
* the "perfect" choice for a unit of work; this module turns that hint into a
|
|
4
|
+
* concrete spawn target that ACTUALLY EXISTS on the machine. A tier resolves
|
|
5
|
+
* to its preferred engine only when that engine's CLI is installed AND a
|
|
6
|
+
* credential for it is resolvable; otherwise the resolver walks a
|
|
7
|
+
* cross-engine equivalence ladder (Claude → Codex → an open-weight provider
|
|
8
|
+
* via opencode) and returns the best available equivalent. Why gate on
|
|
9
|
+
* existence: a fleet machine may have Claude but no Codex, or Codex but an
|
|
10
|
+
* expired Claude key, or neither plus an opencode/synthetic seat. Hard-coding
|
|
11
|
+
* `fable` then fails at spawn time; routing here degrades gracefully and
|
|
12
|
+
* tells the caller WHY (the `reason`), so a skill can log "fell back to codex
|
|
13
|
+
* gpt-5.5 (claude unavailable)" instead of crashing. Pure given an
|
|
14
|
+
* availability/keyed context — no I/O — so callers fan out their `which` +
|
|
15
|
+
* credential probes once and pass the result in. Pairs with `buildArgs` in
|
|
16
|
+
* `spawn.mts`: a Fable candidate carries `effort: undefined` because Fable is
|
|
17
|
+
* adaptive-thinking-only and the spawn layer omits `--effort` for it anyway.
|
|
18
|
+
*/
|
|
19
|
+
import type { CredentialProvider } from './credentials.mts';
|
|
20
|
+
import type { AiAgentName, AiEffort } from './types.mts';
|
|
21
|
+
import type { AiTier } from './tier.mts';
|
|
22
|
+
/**
|
|
23
|
+
* A concrete, spawnable target: which CLI engine to run, the model id, the
|
|
24
|
+
* reasoning effort to pass (undefined when the model ignores effort, e.g.
|
|
25
|
+
* Fable), and the credential provider whose key gates it.
|
|
26
|
+
*/
|
|
27
|
+
export interface TierCandidate {
|
|
28
|
+
readonly effort: AiEffort | undefined;
|
|
29
|
+
readonly engine: AiAgentName;
|
|
30
|
+
readonly model: string;
|
|
31
|
+
readonly provider: CredentialProvider;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Why the resolver returned what it did. - `preferred` — the tier's
|
|
35
|
+
* first-choice engine was available + keyed. - `fellback` — the preferred
|
|
36
|
+
* engine was missing/unkeyed; an equivalent on another engine was used (`from`
|
|
37
|
+
* names the original tier).
|
|
38
|
+
*/
|
|
39
|
+
export type TierResolveReason = 'fellback' | 'preferred';
|
|
40
|
+
export interface TierResolution {
|
|
41
|
+
readonly candidate: TierCandidate;
|
|
42
|
+
readonly reason: TierResolveReason;
|
|
43
|
+
readonly from?: AiTier | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The context a caller probes once and passes in: which engine CLIs exist, and
|
|
47
|
+
* which credential providers have a resolvable key. Both are sets so the
|
|
48
|
+
* resolver stays pure (no `which` / keychain I/O of its own).
|
|
49
|
+
*/
|
|
50
|
+
export interface RouteContext {
|
|
51
|
+
readonly available: ReadonlySet<AiAgentName>;
|
|
52
|
+
readonly keyed: ReadonlySet<CredentialProvider>;
|
|
53
|
+
}
|
|
54
|
+
export declare const TIER_CHAINS: Readonly<Record<AiTier, readonly TierCandidate[]>>;
|
|
55
|
+
/**
|
|
56
|
+
* A candidate is usable when its engine CLI exists AND a credential for its
|
|
57
|
+
* provider is resolvable. Both gates matter: an installed Claude with an
|
|
58
|
+
* expired key is as unusable as a missing CLI.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isCandidateUsable(candidate: TierCandidate, ctx: RouteContext): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Resolve a tier to the best available concrete target. Prefers the tier's
|
|
63
|
+
* first-choice (Claude) candidate; if its engine is missing or unkeyed, walks
|
|
64
|
+
* the cross-engine equivalence ladder and returns the first usable equivalent,
|
|
65
|
+
* tagging the result `fellback` with the original tier in `from`. Returns
|
|
66
|
+
* `undefined` only when NOTHING in the chain is usable — the caller then skips
|
|
67
|
+
* the work or surfaces a "no AI engine available" message.
|
|
68
|
+
*/
|
|
69
|
+
export declare function resolveTier(tier: AiTier, ctx: RouteContext): TierResolution | undefined;
|
package/dist/ai/route.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_ai_tier = require('./tier.js');
|
|
5
|
+
|
|
6
|
+
//#region src/ai/route.mts
|
|
7
|
+
/**
|
|
8
|
+
* @file Availability-gated tier routing. `tier.mts` says which model+effort is
|
|
9
|
+
* the "perfect" choice for a unit of work; this module turns that hint into a
|
|
10
|
+
* concrete spawn target that ACTUALLY EXISTS on the machine. A tier resolves
|
|
11
|
+
* to its preferred engine only when that engine's CLI is installed AND a
|
|
12
|
+
* credential for it is resolvable; otherwise the resolver walks a
|
|
13
|
+
* cross-engine equivalence ladder (Claude → Codex → an open-weight provider
|
|
14
|
+
* via opencode) and returns the best available equivalent. Why gate on
|
|
15
|
+
* existence: a fleet machine may have Claude but no Codex, or Codex but an
|
|
16
|
+
* expired Claude key, or neither plus an opencode/synthetic seat. Hard-coding
|
|
17
|
+
* `fable` then fails at spawn time; routing here degrades gracefully and
|
|
18
|
+
* tells the caller WHY (the `reason`), so a skill can log "fell back to codex
|
|
19
|
+
* gpt-5.5 (claude unavailable)" instead of crashing. Pure given an
|
|
20
|
+
* availability/keyed context — no I/O — so callers fan out their `which` +
|
|
21
|
+
* credential probes once and pass the result in. Pairs with `buildArgs` in
|
|
22
|
+
* `spawn.mts`: a Fable candidate carries `effort: undefined` because Fable is
|
|
23
|
+
* adaptive-thinking-only and the spawn layer omits `--effort` for it anyway.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Per-tier preference chain, most-preferred-first. The head is the "perfect"
|
|
27
|
+
* Claude choice from `AI_TIER`; the tail is the cross-engine equivalent ladder
|
|
28
|
+
* (Codex, then an open-weight provider reached through opencode). Effort is the
|
|
29
|
+
* shared `AiEffort` vocab; `buildArgs` translates per engine (codex clamps
|
|
30
|
+
* `max`→`xhigh`, Fable drops effort entirely).
|
|
31
|
+
*
|
|
32
|
+
* The Claude head reuses `AI_TIER` so a model-generation bump stays a single
|
|
33
|
+
* edit there. Fable's head carries `effort: undefined` — it is adaptive-only.
|
|
34
|
+
*/
|
|
35
|
+
const FABLE = require_ai_tier.AI_TIER.fable;
|
|
36
|
+
const OPUS = require_ai_tier.AI_TIER.opus;
|
|
37
|
+
const SONNET = require_ai_tier.AI_TIER.sonnet;
|
|
38
|
+
const HAIKU = require_ai_tier.AI_TIER.haiku;
|
|
39
|
+
const TIER_CHAINS = {
|
|
40
|
+
__proto__: null,
|
|
41
|
+
fable: [
|
|
42
|
+
{
|
|
43
|
+
effort: void 0,
|
|
44
|
+
engine: "claude",
|
|
45
|
+
model: FABLE.model,
|
|
46
|
+
provider: "anthropic"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
effort: "xhigh",
|
|
50
|
+
engine: "codex",
|
|
51
|
+
model: "gpt-5.5",
|
|
52
|
+
provider: "openai"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
effort: "xhigh",
|
|
56
|
+
engine: "opencode",
|
|
57
|
+
model: "fireworks-ai/accounts/fireworks/models/glm-5p1",
|
|
58
|
+
provider: "fireworks"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
opus: [
|
|
62
|
+
{
|
|
63
|
+
effort: OPUS.effort,
|
|
64
|
+
engine: "claude",
|
|
65
|
+
model: OPUS.model,
|
|
66
|
+
provider: "anthropic"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
effort: "high",
|
|
70
|
+
engine: "codex",
|
|
71
|
+
model: "gpt-5.5",
|
|
72
|
+
provider: "openai"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
effort: "high",
|
|
76
|
+
engine: "opencode",
|
|
77
|
+
model: "fireworks-ai/accounts/fireworks/models/glm-5p1",
|
|
78
|
+
provider: "fireworks"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
sonnet: [
|
|
82
|
+
{
|
|
83
|
+
effort: SONNET.effort,
|
|
84
|
+
engine: "claude",
|
|
85
|
+
model: SONNET.model,
|
|
86
|
+
provider: "anthropic"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
effort: "medium",
|
|
90
|
+
engine: "codex",
|
|
91
|
+
model: "gpt-5.5",
|
|
92
|
+
provider: "openai"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
effort: "medium",
|
|
96
|
+
engine: "opencode",
|
|
97
|
+
model: "synthetic/hf:moonshotai/Kimi-K2.5",
|
|
98
|
+
provider: "synthetic"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
haiku: [
|
|
102
|
+
{
|
|
103
|
+
effort: HAIKU.effort,
|
|
104
|
+
engine: "claude",
|
|
105
|
+
model: HAIKU.model,
|
|
106
|
+
provider: "anthropic"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
effort: "low",
|
|
110
|
+
engine: "codex",
|
|
111
|
+
model: "gpt-5.5",
|
|
112
|
+
provider: "openai"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
effort: "low",
|
|
116
|
+
engine: "opencode",
|
|
117
|
+
model: "synthetic/hf:moonshotai/Kimi-K2.5",
|
|
118
|
+
provider: "synthetic"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* A candidate is usable when its engine CLI exists AND a credential for its
|
|
124
|
+
* provider is resolvable. Both gates matter: an installed Claude with an
|
|
125
|
+
* expired key is as unusable as a missing CLI.
|
|
126
|
+
*/
|
|
127
|
+
function isCandidateUsable(candidate, ctx) {
|
|
128
|
+
return ctx.available.has(candidate.engine) && ctx.keyed.has(candidate.provider);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Resolve a tier to the best available concrete target. Prefers the tier's
|
|
132
|
+
* first-choice (Claude) candidate; if its engine is missing or unkeyed, walks
|
|
133
|
+
* the cross-engine equivalence ladder and returns the first usable equivalent,
|
|
134
|
+
* tagging the result `fellback` with the original tier in `from`. Returns
|
|
135
|
+
* `undefined` only when NOTHING in the chain is usable — the caller then skips
|
|
136
|
+
* the work or surfaces a "no AI engine available" message.
|
|
137
|
+
*/
|
|
138
|
+
function resolveTier(tier, ctx) {
|
|
139
|
+
const chain = TIER_CHAINS[tier] ?? TIER_CHAINS.sonnet;
|
|
140
|
+
for (let i = 0, { length } = chain; i < length; i += 1) {
|
|
141
|
+
const candidate = chain[i];
|
|
142
|
+
if (isCandidateUsable(candidate, ctx)) return i === 0 ? {
|
|
143
|
+
candidate,
|
|
144
|
+
reason: "preferred"
|
|
145
|
+
} : {
|
|
146
|
+
candidate,
|
|
147
|
+
from: tier,
|
|
148
|
+
reason: "fellback"
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
154
|
+
exports.TIER_CHAINS = TIER_CHAINS;
|
|
155
|
+
exports.isCandidateUsable = isCandidateUsable;
|
|
156
|
+
exports.resolveTier = resolveTier;
|
package/dist/ai/spawn.d.mts
CHANGED
|
@@ -22,7 +22,15 @@ export declare function backoffFor(attempt: number): number;
|
|
|
22
22
|
* Update sites (when an agent changes its flag surface): 1. The relevant case
|
|
23
23
|
* below. 2. The agent's docs link (cited inline).
|
|
24
24
|
*/
|
|
25
|
-
export declare function buildArgs(agent: AiAgentName,
|
|
25
|
+
export declare function buildArgs(agent: AiAgentName, options: SpawnAiAgentOptions): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Fable and Mythos run adaptive thinking only — thinking is always on and there
|
|
28
|
+
* is no manual thinking-budget knob. The effort dial does not apply the way it
|
|
29
|
+
* does on Opus, so the spawn layer drops `--effort` for these models rather
|
|
30
|
+
* than passing a level they should ignore. Matches both alias and full-id
|
|
31
|
+
* shapes (`fable`, `claude-fable-5`, `mythos`, `claude-mythos-5`).
|
|
32
|
+
*/
|
|
33
|
+
export declare function isAdaptiveOnlyModel(model: string): boolean;
|
|
26
34
|
export declare function isOverloaded(stdout: string, stderr: string): boolean;
|
|
27
35
|
export declare function pickAgent(requested: AiAgentName | undefined, cwd: string): Promise<AiAgentName>;
|
|
28
36
|
/**
|
|
@@ -46,4 +54,4 @@ export declare function pickAgent(requested: AiAgentName | undefined, cwd: strin
|
|
|
46
54
|
* Throws when the requested agent isn't on PATH (or, when no agent
|
|
47
55
|
* is requested, when none of the known agents are on PATH).
|
|
48
56
|
*/
|
|
49
|
-
export declare function spawnAiAgent(
|
|
57
|
+
export declare function spawnAiAgent(options: SpawnAiAgentOptions): Promise<AgentSpawnResult>;
|
package/dist/ai/spawn.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
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_date = require('../primordials/date.js');
|
|
6
5
|
const require_primordials_object = require('../primordials/object.js');
|
|
6
|
+
const require_primordials_date = require('../primordials/date.js');
|
|
7
7
|
const require_errors_message = require('../errors/message.js');
|
|
8
|
-
const require_ai_discover = require('./discover.js');
|
|
9
8
|
const require_process_spawn_errors = require('../process/spawn/errors.js');
|
|
10
9
|
const require_process_spawn_child = require('../process/spawn/child.js');
|
|
10
|
+
const require_ai_discover = require('./discover.js');
|
|
11
11
|
const require_primordials_promise = require('../primordials/promise.js');
|
|
12
12
|
|
|
13
13
|
//#region src/ai/spawn.mts
|
|
@@ -38,62 +38,81 @@ function backoffFor(attempt) {
|
|
|
38
38
|
* Update sites (when an agent changes its flag surface): 1. The relevant case
|
|
39
39
|
* below. 2. The agent's docs link (cited inline).
|
|
40
40
|
*/
|
|
41
|
-
function buildArgs(agent,
|
|
42
|
-
|
|
41
|
+
function buildArgs(agent, options) {
|
|
42
|
+
options = {
|
|
43
|
+
__proto__: null,
|
|
44
|
+
...options
|
|
45
|
+
};
|
|
46
|
+
const allAllowed = [...options.tools, ...options.allow ?? []];
|
|
43
47
|
switch (agent) {
|
|
44
48
|
case "claude": {
|
|
45
49
|
const args = [
|
|
46
50
|
"--print",
|
|
47
51
|
"--no-session-persistence",
|
|
48
52
|
"--permission-mode",
|
|
49
|
-
|
|
53
|
+
options.permissionMode,
|
|
50
54
|
"--add-dir",
|
|
51
|
-
|
|
55
|
+
options.cwd
|
|
52
56
|
];
|
|
53
|
-
for (const dir of
|
|
54
|
-
if (
|
|
57
|
+
for (const dir of options.addDirs ?? []) args.push("--add-dir", dir);
|
|
58
|
+
if (options.model) args.push("--model", options.model);
|
|
59
|
+
if (options.effort && !isAdaptiveOnlyModel(options.model ?? "")) args.push("--effort", options.effort);
|
|
55
60
|
if (allAllowed.length > 0) args.push("--allowedTools", ...allAllowed);
|
|
56
|
-
if (
|
|
57
|
-
if (
|
|
61
|
+
if (options.disallow.length > 0) args.push("--disallowedTools", ...options.disallow);
|
|
62
|
+
if (options.extraArgs) args.push(...options.extraArgs);
|
|
58
63
|
return args;
|
|
59
64
|
}
|
|
60
65
|
case "codex": {
|
|
61
66
|
const args = ["--print"];
|
|
62
|
-
if (
|
|
63
|
-
if (
|
|
67
|
+
if (options.permissionMode === "plan") args.push("--read-only");
|
|
68
|
+
if (options.model) args.push("--model", options.model);
|
|
69
|
+
if (options.effort) {
|
|
70
|
+
const codexEffort = options.effort === "max" ? "xhigh" : options.effort;
|
|
71
|
+
args.push("-c", `model_reasoning_effort=${codexEffort}`);
|
|
72
|
+
}
|
|
64
73
|
if (allAllowed.length > 0) args.push("--tools", allAllowed.join(","));
|
|
65
|
-
if (
|
|
66
|
-
args.push("--cwd",
|
|
67
|
-
if (
|
|
74
|
+
if (options.disallow.length > 0) args.push("--disallow-tools", options.disallow.join(","));
|
|
75
|
+
args.push("--cwd", options.cwd);
|
|
76
|
+
if (options.extraArgs) args.push(...options.extraArgs);
|
|
68
77
|
return args;
|
|
69
78
|
}
|
|
70
79
|
case "gemini": {
|
|
71
80
|
const args = [
|
|
72
81
|
"--no-interactive",
|
|
73
82
|
"--workspace",
|
|
74
|
-
|
|
83
|
+
options.cwd
|
|
75
84
|
];
|
|
76
|
-
if (
|
|
85
|
+
if (options.model) args.push("--model", options.model);
|
|
77
86
|
if (allAllowed.length > 0) args.push("--allowed-tools", allAllowed.join(","));
|
|
78
|
-
if (
|
|
79
|
-
if (
|
|
80
|
-
if (
|
|
87
|
+
if (options.disallow.length > 0) args.push("--denied-tools", options.disallow.join(","));
|
|
88
|
+
if (options.permissionMode === "plan") args.push("--read-only");
|
|
89
|
+
if (options.extraArgs) args.push(...options.extraArgs);
|
|
81
90
|
return args;
|
|
82
91
|
}
|
|
83
92
|
case "opencode": {
|
|
84
93
|
const args = [
|
|
85
94
|
"--print",
|
|
86
95
|
"--cwd",
|
|
87
|
-
|
|
96
|
+
options.cwd
|
|
88
97
|
];
|
|
89
|
-
if (
|
|
98
|
+
if (options.model) args.push("--model", options.model);
|
|
90
99
|
if (allAllowed.length > 0) args.push("--tools", allAllowed.join(","));
|
|
91
|
-
if (
|
|
92
|
-
if (
|
|
100
|
+
if (options.disallow.length > 0) args.push("--no-tools", options.disallow.join(","));
|
|
101
|
+
if (options.extraArgs) args.push(...options.extraArgs);
|
|
93
102
|
return args;
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Fable and Mythos run adaptive thinking only — thinking is always on and there
|
|
108
|
+
* is no manual thinking-budget knob. The effort dial does not apply the way it
|
|
109
|
+
* does on Opus, so the spawn layer drops `--effort` for these models rather
|
|
110
|
+
* than passing a level they should ignore. Matches both alias and full-id
|
|
111
|
+
* shapes (`fable`, `claude-fable-5`, `mythos`, `claude-mythos-5`).
|
|
112
|
+
*/
|
|
113
|
+
function isAdaptiveOnlyModel(model) {
|
|
114
|
+
return /\b(?:fable|mythos)\b/i.test(model) || /claude-(?:fable|mythos)/i.test(model);
|
|
115
|
+
}
|
|
97
116
|
function isOverloaded(stdout, stderr) {
|
|
98
117
|
const re = /API Error: 529|Overloaded/i;
|
|
99
118
|
return re.test(stdout) || re.test(stderr);
|
|
@@ -133,9 +152,13 @@ async function pickAgent(requested, cwd) {
|
|
|
133
152
|
* Throws when the requested agent isn't on PATH (or, when no agent
|
|
134
153
|
* is requested, when none of the known agents are on PATH).
|
|
135
154
|
*/
|
|
136
|
-
async function spawnAiAgent(
|
|
137
|
-
|
|
138
|
-
|
|
155
|
+
async function spawnAiAgent(options) {
|
|
156
|
+
options = {
|
|
157
|
+
__proto__: null,
|
|
158
|
+
...options
|
|
159
|
+
};
|
|
160
|
+
const agent = await pickAgent(options.agent, options.cwd);
|
|
161
|
+
const args = buildArgs(agent, options);
|
|
139
162
|
let stdout = "";
|
|
140
163
|
let stderr = "";
|
|
141
164
|
let exitCode = 0;
|
|
@@ -148,18 +171,18 @@ async function spawnAiAgent(opts) {
|
|
|
148
171
|
exitCode = 0;
|
|
149
172
|
try {
|
|
150
173
|
const child = require_process_spawn_child.spawn(agent, args, {
|
|
151
|
-
cwd:
|
|
174
|
+
cwd: options.cwd,
|
|
152
175
|
stdio: "pipe",
|
|
153
176
|
stdioString: true,
|
|
154
|
-
timeout:
|
|
177
|
+
timeout: options.timeoutMs
|
|
155
178
|
});
|
|
156
|
-
child.stdin?.end(
|
|
179
|
+
child.stdin?.end(options.prompt);
|
|
157
180
|
const result = await child;
|
|
158
181
|
stdout = String(result.stdout ?? "");
|
|
159
182
|
stderr = String(result.stderr ?? "");
|
|
160
183
|
exitCode = result.code ?? 0;
|
|
161
184
|
} catch (e) {
|
|
162
|
-
if (
|
|
185
|
+
if (require_process_spawn_errors.isSpawnError(e)) {
|
|
163
186
|
stdout = String(e.stdout ?? "");
|
|
164
187
|
stderr = String(e.stderr ?? "");
|
|
165
188
|
exitCode = e.code ?? 1;
|
|
@@ -175,6 +198,7 @@ async function spawnAiAgent(opts) {
|
|
|
175
198
|
attempts,
|
|
176
199
|
durationMs: require_primordials_date.DateNow() - start,
|
|
177
200
|
exitCode,
|
|
201
|
+
overloaded: isOverloaded(stdout, stderr),
|
|
178
202
|
stderr,
|
|
179
203
|
stdout
|
|
180
204
|
};
|
|
@@ -183,6 +207,7 @@ async function spawnAiAgent(opts) {
|
|
|
183
207
|
//#endregion
|
|
184
208
|
exports.backoffFor = backoffFor;
|
|
185
209
|
exports.buildArgs = buildArgs;
|
|
210
|
+
exports.isAdaptiveOnlyModel = isAdaptiveOnlyModel;
|
|
186
211
|
exports.isOverloaded = isOverloaded;
|
|
187
212
|
exports.pickAgent = pickAgent;
|
|
188
213
|
exports.spawnAiAgent = spawnAiAgent;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The terminal-status contract a delegated subagent returns to its
|
|
3
|
+
* orchestrator. Subagent-driven development depends on a SMALL, fixed status
|
|
4
|
+
* vocabulary so the orchestrator can route deterministically instead of
|
|
5
|
+
* parsing free-form prose: a subagent that "sort of finished but has a worry"
|
|
6
|
+
* must be distinguishable from one that is genuinely blocked, because they
|
|
7
|
+
* escalate differently. The four states and their escalation paths are the
|
|
8
|
+
* contract; `escalationFor` is the single place that maps a state to what the
|
|
9
|
+
* orchestrator does next. Encoding it as a typed union + map (rather than a
|
|
10
|
+
* doc convention) is the code-is-law surface: a stray status string fails the
|
|
11
|
+
* guard, and `agent-delegation.md` is checked against this union so the prose
|
|
12
|
+
* can't drift from the code.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* A subagent's terminal status.
|
|
16
|
+
*
|
|
17
|
+
* - `done` — work complete, no reservations; the orchestrator advances.
|
|
18
|
+
* - `done-with-concerns` — work complete but the subagent flagged a risk or
|
|
19
|
+
* follow-up the orchestrator should surface before advancing.
|
|
20
|
+
* - `needs-context` — the subagent lacks information it cannot obtain itself; the
|
|
21
|
+
* orchestrator supplies it and re-dispatches (a fresh attempt, not the same
|
|
22
|
+
* model retrying blind).
|
|
23
|
+
* - `blocked` — the work cannot proceed without a decision or action only the
|
|
24
|
+
* user can provide; the orchestrator escalates to the user and stops.
|
|
25
|
+
*/
|
|
26
|
+
export type SubagentStatus = 'blocked' | 'done' | 'done-with-concerns' | 'needs-context';
|
|
27
|
+
/**
|
|
28
|
+
* What the orchestrator does for each terminal status. `advance` continues to
|
|
29
|
+
* the next unit of work; `surface` advances but raises the concern first;
|
|
30
|
+
* `redispatch` re-runs the unit with the missing context added; `escalate`
|
|
31
|
+
* stops and hands the decision to the user.
|
|
32
|
+
*/
|
|
33
|
+
export type SubagentEscalation = 'advance' | 'escalate' | 'redispatch' | 'surface';
|
|
34
|
+
/**
|
|
35
|
+
* The canonical status set, sorted, for callers that need to enumerate or
|
|
36
|
+
* validate against the full vocabulary (the doc-parity check reads this).
|
|
37
|
+
*/
|
|
38
|
+
export declare const SUBAGENT_STATUSES: readonly SubagentStatus[];
|
|
39
|
+
/**
|
|
40
|
+
* Map a terminal status to the orchestrator action it requires. A status
|
|
41
|
+
* outside the vocabulary is itself a contract violation, so this throws rather
|
|
42
|
+
* than guessing — never force a retry on an unrecognized state.
|
|
43
|
+
*/
|
|
44
|
+
export declare function escalationFor(status: SubagentStatus): SubagentEscalation;
|
|
45
|
+
/**
|
|
46
|
+
* True when `value` names a status in the contract.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isSubagentStatus(value: string): value is SubagentStatus;
|
|
@@ -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;
|