@wirecat/cli-template 0.9.0 → 0.10.0

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 (110) hide show
  1. package/.github/workflows/ci.yml +1 -0
  2. package/.github/workflows/release.yml +63 -0
  3. package/CHANGELOG.md +42 -1
  4. package/bin/release +5 -3
  5. package/dist/bin/clidev.js +34 -12
  6. package/dist/bundle/all-profiles-XHC7BG3P.js +24 -0
  7. package/dist/bundle/anthropic-N6B3ZZHQ.js +70 -0
  8. package/dist/bundle/bun-HUJLS7KP.js +169 -0
  9. package/dist/bundle/bun-sqlite-OWFO2TVR.js +69 -0
  10. package/dist/bundle/chunk-222FANS2.js +161 -0
  11. package/dist/bundle/chunk-2CFBHYFA.js +884 -0
  12. package/dist/bundle/chunk-2KQZ24GI.js +82 -0
  13. package/dist/bundle/chunk-2TBVT4SZ.js +31 -0
  14. package/dist/bundle/chunk-437W3Z2M.js +76 -0
  15. package/dist/bundle/chunk-4QRLPOJ7.js +18 -0
  16. package/dist/bundle/chunk-54AJONOM.js +54 -0
  17. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  18. package/dist/bundle/chunk-6CBWO7OF.js +73 -0
  19. package/dist/bundle/chunk-75LVQQEK.js +35782 -0
  20. package/dist/bundle/chunk-7RB76E2L.js +264 -0
  21. package/dist/bundle/chunk-7RXBN7HP.js +63 -0
  22. package/dist/bundle/chunk-ABP7FDMJ.js +122 -0
  23. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  24. package/dist/bundle/chunk-AP7QKYBG.js +3531 -0
  25. package/dist/bundle/chunk-ASMH7JWZ.js +288 -0
  26. package/dist/bundle/chunk-B4EED2RF.js +100 -0
  27. package/dist/bundle/chunk-B4LM2B6F.js +1900 -0
  28. package/dist/bundle/chunk-BDSDQCV4.js +281 -0
  29. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  30. package/dist/bundle/chunk-DMCN22H6.js +35 -0
  31. package/dist/bundle/chunk-E42W72PQ.js +151 -0
  32. package/dist/bundle/chunk-EFHLQXG6.js +5104 -0
  33. package/dist/bundle/chunk-FIHDGZIB.js +34352 -0
  34. package/dist/bundle/chunk-FWVKHD2L.js +48 -0
  35. package/dist/bundle/chunk-FXS3X76A.js +193 -0
  36. package/dist/bundle/chunk-HTQTIKWP.js +928 -0
  37. package/dist/bundle/chunk-IJ3IA7EK.js +24 -0
  38. package/dist/bundle/chunk-JEBSORH7.js +3379 -0
  39. package/dist/bundle/chunk-JTTW5ZKF.js +45 -0
  40. package/dist/bundle/chunk-LSEF4QC3.js +3075 -0
  41. package/dist/bundle/chunk-LY7GS2YI.js +58 -0
  42. package/dist/bundle/chunk-MFS52LTZ.js +570 -0
  43. package/dist/bundle/chunk-MNSD5BX2.js +78 -0
  44. package/dist/bundle/chunk-MTGLJCAZ.js +24 -0
  45. package/dist/bundle/chunk-MZVV2JZT.js +744 -0
  46. package/dist/bundle/chunk-NE3NSB5O.js +8341 -0
  47. package/dist/bundle/chunk-NTLPDH76.js +440 -0
  48. package/dist/bundle/chunk-O3PBQVAB.js +447 -0
  49. package/dist/bundle/chunk-O5EHUB2V.js +2 -0
  50. package/dist/bundle/chunk-O5LMDQTO.js +82 -0
  51. package/dist/bundle/chunk-OPJ24VGH.js +1028 -0
  52. package/dist/bundle/chunk-OPPMGPFW.js +164 -0
  53. package/dist/bundle/chunk-QGNNMPUB.js +158 -0
  54. package/dist/bundle/chunk-QVJLOUQB.js +2 -0
  55. package/dist/bundle/chunk-S57AMKLX.js +6848 -0
  56. package/dist/bundle/chunk-TARN7CHN.js +215 -0
  57. package/dist/bundle/chunk-TJLGI3N6.js +1095 -0
  58. package/dist/bundle/chunk-VMTM46FH.js +7532 -0
  59. package/dist/bundle/chunk-W2IDKBNB.js +2315 -0
  60. package/dist/bundle/chunk-XFXBXQBS.js +630 -0
  61. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  62. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  63. package/dist/bundle/clidev.js +22 -0
  64. package/dist/bundle/command-contract-PEM3S634.js +29 -0
  65. package/dist/bundle/dist-ESHIQU4M.js +7577 -0
  66. package/dist/bundle/echarts-2QGL2JP5.js +42501 -0
  67. package/dist/bundle/embed-HHAAGHA6.js +35 -0
  68. package/dist/bundle/embedder-W2OGVVYH.js +108 -0
  69. package/dist/bundle/first-run-WCJUDUBU.js +23 -0
  70. package/dist/bundle/first-screen-U4DFUKUC.js +27 -0
  71. package/dist/bundle/instructions-OTZHT6NV.js +9 -0
  72. package/dist/bundle/mcp-OQBZXELQ.js +165 -0
  73. package/dist/bundle/mcp-VVF6J7SQ.js +151 -0
  74. package/dist/bundle/mcp-Y7VCIZ2J.js +78 -0
  75. package/dist/bundle/node-P4E63KXA.js +2340 -0
  76. package/dist/bundle/node-SYD4GX5O.js +176 -0
  77. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  78. package/dist/bundle/node-sqlite-X2DGRFOZ.js +45 -0
  79. package/dist/bundle/oauth-42M34GQ5.js +17 -0
  80. package/dist/bundle/open-SWXRCDLN.js +19 -0
  81. package/dist/bundle/process-KAFGXZ7Q.js +91 -0
  82. package/dist/bundle/program-EHR4G7VN.js +16967 -0
  83. package/dist/bundle/prompt-ZQTMHRGX.js +12 -0
  84. package/dist/bundle/recognize-TTED4SE3.js +190 -0
  85. package/dist/bundle/remote-C37XJ4BP.js +26 -0
  86. package/dist/bundle/rerank-APFZAMQL.js +49 -0
  87. package/dist/bundle/serve-DDPIHDVZ.js +19 -0
  88. package/dist/bundle/server-L5GNG7KC.js +793 -0
  89. package/dist/bundle/server-LKVYA2AE.js +39 -0
  90. package/dist/bundle/state-WWPPHERF.js +33 -0
  91. package/dist/bundle/store-H6UIA4PK.js +120 -0
  92. package/dist/bundle/store-maintenance-command-EYBT64A2.js +40 -0
  93. package/dist/version.d.ts +1 -1
  94. package/dist/version.d.ts.map +1 -1
  95. package/dist/version.js +1 -1
  96. package/dist/version.js.map +1 -1
  97. package/docs/commands.md +9 -13
  98. package/docs/dev/TESTING.md +8 -0
  99. package/docs/dev/reference-clis.md +7 -5
  100. package/docs/dev/skills/release/SKILL.md +9 -6
  101. package/docs/dev/skills/release/fresh-audit.md +4 -0
  102. package/kit/dist/new.js +1 -0
  103. package/package.json +7 -5
  104. package/scripts/audit.sh +3 -2
  105. package/scripts/smoke-bundle.ts +63 -0
  106. package/scripts/version-level.test.ts +17 -1
  107. package/scripts/version-level.ts +35 -7
  108. package/skills/clidev-cli/SKILL.md +8 -0
  109. package/src/version.ts +1 -1
  110. package/lint/baseline/unknown-verb.json +0 -1
@@ -35,6 +35,7 @@ jobs:
35
35
  contracts:upgrade
36
36
  checks: |
37
37
  bash scripts/audit.sh
38
+ pnpm smoke:node
38
39
 
39
40
  version:
40
41
  if: github.event_name == 'pull_request'
@@ -189,3 +189,66 @@ jobs:
189
189
  run: |
190
190
  awk -v v="$VERSION" '$0 ~ "^## "v" " {on=1; next} /^## / && on {exit} on' CHANGELOG.md |
191
191
  gh release create "v$VERSION" --title "$VERSION" --notes-file -
192
+
193
+ # The template's own release publishes @wirecat/cli-template, which has no skill on ClawHub.
194
+ # ClawHub's own workflow, pinned: it runs the ClawHub CLI from this commit and needs id-token only to read which
195
+ # commit that is. It publishes the skill only when it changed, as the next patch of ClawHub's own version line.
196
+ clawhub-dry-run:
197
+ needs: build
198
+ if: inputs.dry_run && github.repository != 'WireCatLabs/cli-template'
199
+ permissions:
200
+ contents: read
201
+ id-token: write
202
+ uses: openclaw/clawhub/.github/workflows/skill-publish.yml@52358852d3510f1150756d48e8a72cb8c8e698e0 # main, 2026-10-25
203
+ with:
204
+ skill_path: skills/clidev-cli
205
+ owner: wirecat
206
+ dry_run: true
207
+
208
+ # After the tag, so a ClawHub failure never holds back the npm release. The same CLI commit as the dry run, but run
209
+ # here instead of through ClawHub's workflow, which GitHub cannot let fail: a version stuck pending ClawHub's scan
210
+ # is not counted as the latest, so the next publish picks it again and gets "already exists" (openclaw/clawhub#4046).
211
+ # That one error warns; any other fails. Bump CLAWHUB_SHA together with the dry run's pin.
212
+ clawhub:
213
+ needs: tag
214
+ if: ${{ !inputs.dry_run && github.repository != 'WireCatLabs/cli-template' }}
215
+ runs-on: ubuntu-latest
216
+ permissions:
217
+ contents: read
218
+ env:
219
+ SKILL_PATH: skills/clidev-cli
220
+ CLAWHUB_SLUG: wirecat-clidev
221
+ CLAWHUB_SHA: 52358852d3510f1150756d48e8a72cb8c8e698e0
222
+ CLAWHUB_URL: https://clawhub.ai
223
+ steps:
224
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
225
+ with:
226
+ persist-credentials: false
227
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
228
+ with:
229
+ repository: openclaw/clawhub
230
+ ref: ${{ env.CLAWHUB_SHA }}
231
+ path: clawhub-source
232
+ persist-credentials: false
233
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
234
+ with:
235
+ bun-version: 1.4.4
236
+ - run: bun install --frozen-lockfile
237
+ working-directory: clawhub-source
238
+ - name: publish the skill
239
+ env:
240
+ CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }}
241
+ CLAWHUB_CONFIG_PATH: ${{ runner.temp }}/clawhub-config.json
242
+ run: |
243
+ (umask 077; jq -n --arg r "$CLAWHUB_URL" --arg t "$CLAWHUB_TOKEN" '{registry: $r, token: $t}' > "$CLAWHUB_CONFIG_PATH")
244
+ status=0
245
+ output=$(bun clawhub-source/packages/clawhub/src/cli.ts --workdir "$GITHUB_WORKSPACE" \
246
+ --site "$CLAWHUB_URL" --registry "$CLAWHUB_URL" skill publish "$SKILL_PATH" --slug "$CLAWHUB_SLUG" --json \
247
+ --owner wirecat --tags latest --source-repo "$GITHUB_REPOSITORY" --source-commit "$GITHUB_SHA" \
248
+ --source-path "$SKILL_PATH" --source-ref "$GITHUB_REF" 2>&1) || status=$?
249
+ echo "$output"
250
+ if [ "$status" -ne 0 ] && grep -q "already exists" <<< "$output"; then
251
+ echo "::warning::ClawHub already has this skill version, still pending its stalled scan — not republished (openclaw/clawhub#4046)"
252
+ exit 0
253
+ fi
254
+ exit "$status"
package/CHANGELOG.md CHANGED
@@ -3,7 +3,48 @@
3
3
  Notable changes to `@wirecat/cli-template`. One section per version, newest first; versions follow
4
4
  [semantic versioning](https://semver.org), so before `1.0.0` the skeleton may still change.
5
5
 
6
- <!-- cspell:words katex smol whatsapp -->
6
+ <!-- cspell:words clawhub gcal katex openclaw smol whatsapp -->
7
+
8
+ ## 0.10.0 — 31.10.2026
9
+
10
+ ### Changed — may break callers
11
+
12
+ - **The skeleton runs on cli-core 0.469.0 and cli-base 0.65.0**; a CLI that pins cli-base moves both pins together.
13
+ A non-messenger CLI no longer offers messenger settings or the `follow-ups` and `link-conversations` skills
14
+ (cli-core 0.468); runs record successes too, under cli-core 0.467's rules. cli-base 0.64 adds `cli-dev bundle`, the
15
+ shared build that ships the bin as an esbuild bundle, and calendar words in the command vocabulary. cli-base 0.65 adds
16
+ the verbs `serve` and `revoke`, and `cli-dev lint` fails on a baseline entry that names them: the skeleton's
17
+ `lint/baseline/unknown-verb.json` (`mcp serve`, `mcp revoke`) is gone, and a CLI made from the template removes the
18
+ same entries. `<cli> upgrade` now restarts the HTTP MCP server that `mcp server start` started, on the new version,
19
+ and names the MCP sessions over stdio that still run the old one (cli-core #2117).
20
+
21
+ ### Added
22
+
23
+ - **A CLI made from the template publishes its skill on ClawHub as `wirecat-<command>` after each release.** `release.yml`
24
+ gets a dry run through ClawHub's pinned workflow and, after the tag, a publish that only warns while ClawHub still holds
25
+ the version pending its scan ([openclaw/clawhub#4046](https://github.com/openclaw/clawhub/issues/4046)); the template's
26
+ own release skips both. The skill names its binary and npm package for OpenClaw (`metadata.openclaw`). It needs the
27
+ `CLAWHUB_TOKEN` secret, which the WireCatLabs organization shares.
28
+ - **`new --category calendar` names gcal-cli as the reference CLI** in `AGENTS.md` and `DESIGN.md`, and the
29
+ Reference CLIs page lists it, instead of "No reference CLI for this category yet". gcal-cli is the WireCat Google
30
+ Calendar CLI. A CLI made before this keeps what it wrote; edit its `AGENTS.md` by hand if you want the link.
31
+ - **`scripts/audit.sh` audits beside gcal-cli too**: it installs `@wirecat/gcal-cli` with the other published CLIs
32
+ and passes its `gcal` bin to `cli-dev audit`.
33
+ - **An agent publishes a release itself.** The release skill and `bin/release` let an agent merge the release pull
34
+ request and run `bin/release`, which publishes from GitHub Actions. `bin/release --local` stays the owner's, for
35
+ the first release.
36
+
37
+ ### Fixed
38
+
39
+ - **The release audit never uses the owner's accounts.** Its prompt now says: no sign-in, every folder moved, the
40
+ keyring hidden with `DBUS_SESSION_BUS_ADDRESS=disabled:`, and no command that writes to a service.
41
+ - **`bin/release` raises the next free version to the level the changelog needs.** When npm already had the version, it
42
+ took the next patch, so a release with `Added` (`0.1.1` taken, `0.1.2` proposed) failed `version:check` and stopped;
43
+ it now proposes `0.2.0`. A generated CLI gets it with the next template update.
44
+ - **A CLI made from the template starts from an esbuild bundle.** `pnpm build` runs `tsc`, then cli-base's
45
+ `cli-dev bundle` ([WC-LAY-10](https://github.com/WireCatLabs/cli-base/blob/main/docs/standards/layout.md)), and the
46
+ bin becomes a loader for `dist/bundle/`: the skeleton's `config show --help` starts in 151 ms instead of 366.
47
+ `scripts/smoke-bundle.ts` runs the bundle under Node (`pnpm smoke:node`, in CI) and Bun (`pnpm smoke:bun`).
7
48
 
8
49
  ## 0.9.0 — 27.10.2026
9
50
 
package/bin/release CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env sh
2
- # Publishes the version in package.json and tags it. Run on a clean `main` that matches origin/main; the owner runs
3
- # it, never an agent. When npm already has that version, or a higher one, it raises it to the next free one through a
4
- # pull request and publishes that (WC-REL-5). Nothing is published until `pnpm release:check` passes.
2
+ # Publishes the version in package.json and tags it. Run on a clean `main` that matches origin/main. An agent may run
3
+ # it without --local; --local is for the owner's first release only. When npm already has that version, or a higher
4
+ # one, it raises it to the next free one through a pull request and publishes that (WC-REL-5). Nothing is published
5
+ # until `pnpm release:check` passes.
5
6
  #
6
7
  # bin/release # publishes from GitHub Actions (.github/workflows/release.yml, npm trusted publishing)
7
8
  # bin/release --local # publishes from this computer: NPM_TOKEN if exported, else the keyring, else `npm login`
@@ -110,6 +111,7 @@ next=$(pnpm exec cli-dev next-version "$version" "$latest" "$versions")
110
111
  if [ "$next" != "$version" ]; then
111
112
  taken=""
112
113
  if published; then taken=1; why="$version is already on npm"; else why="$version is not above npm's latest $latest"; fi
114
+ next=$(node --experimental-strip-types scripts/version-level.ts --next "$next")
113
115
  echo "$why — publishing $next instead"
114
116
  # A version npm already has keeps its changelog section; the unreleased one becomes the new version.
115
117
  node -e 'const fs = require("fs"); const [o, n, taken] = process.argv.slice(1)
@@ -1,14 +1,36 @@
1
1
  #!/usr/bin/env node
2
- import { enableCompileCache } from "node:module";
3
- import { catchCrashes } from "@wirecat/cli-base";
4
- import { IDENTITY } from "../identity.js";
5
- enableCompileCache();
6
- const stopCatching = catchCrashes({ cli: IDENTITY.command, interactive: process.stdout.isTTY === true });
7
- const { run } = await import("../program.js");
8
- try {
9
- process.exitCode = await run(process.argv.slice(2));
2
+ // cli-dev bundle loader
3
+ import * as module from "node:module"
4
+
5
+ const words = process.argv.slice(2)
6
+ // As the CLI answers it, unless a test records the argv: then the CLI writes the record too.
7
+ if (
8
+ words.length === 1 &&
9
+ (words[0] === "--version" || words[0] === "-V") &&
10
+ !Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
11
+ ) {
12
+ process.stdout.write("0.10.0\n")
13
+ } else {
14
+ // Before the bundle compiles: the bundle's own call comes after its chunks.
15
+ module.enableCompileCache()
16
+ const serves = ((words) => {
17
+ const plain = words.filter((word) => !word.startsWith("-"));
18
+ return plain
19
+ .slice(0, 4)
20
+ .some((word, at) => word === "serve" || word === "watch" || (word === "mcp" && plain[at + 1] === undefined));
21
+ })(words)
22
+ if (serves && module.registerHooks) {
23
+ const bundle = new URL("../bundle/", import.meta.url).href
24
+ module.registerHooks({
25
+ resolve: (specifier, context, next) =>
26
+ specifier.startsWith("./") && context.parentURL?.startsWith(bundle)
27
+ ? { url: new URL(specifier, context.parentURL).href, format: "module", shortCircuit: true }
28
+ : next(specifier, context),
29
+ })
30
+ }
31
+ const running = import("../bundle/clidev.js")
32
+ const chunks = ["../bundle/all-profiles-XHC7BG3P.js","../bundle/anthropic-N6B3ZZHQ.js","../bundle/bun-HUJLS7KP.js","../bundle/bun-sqlite-OWFO2TVR.js","../bundle/dist-ESHIQU4M.js","../bundle/echarts-2QGL2JP5.js","../bundle/embed-HHAAGHA6.js","../bundle/embedder-W2OGVVYH.js","../bundle/first-screen-U4DFUKUC.js","../bundle/instructions-OTZHT6NV.js","../bundle/mcp-OQBZXELQ.js","../bundle/mcp-VVF6J7SQ.js","../bundle/mcp-Y7VCIZ2J.js","../bundle/node-P4E63KXA.js","../bundle/node-SYD4GX5O.js","../bundle/node-TLZSIHIJ.js","../bundle/node-sqlite-X2DGRFOZ.js","../bundle/oauth-42M34GQ5.js","../bundle/open-SWXRCDLN.js","../bundle/process-KAFGXZ7Q.js","../bundle/program-EHR4G7VN.js","../bundle/prompt-ZQTMHRGX.js","../bundle/recognize-TTED4SE3.js","../bundle/remote-C37XJ4BP.js","../bundle/rerank-APFZAMQL.js","../bundle/serve-DDPIHDVZ.js","../bundle/server-L5GNG7KC.js","../bundle/server-LKVYA2AE.js","../bundle/state-WWPPHERF.js","../bundle/store-H6UIA4PK.js","../bundle/store-maintenance-command-EYBT64A2.js"]
33
+ // After the server answers its first request, so it starts no later.
34
+ if (serves) setTimeout(() => void Promise.allSettled(chunks.map((chunk) => import(chunk))), 2000).unref()
35
+ await running
10
36
  }
11
- finally {
12
- stopCatching();
13
- }
14
- //# sourceMappingURL=clidev.js.map
@@ -0,0 +1,24 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CHILD_IDLE_MS,
5
+ allProfilesServer,
6
+ serveAllProfilesOverHttp,
7
+ serveAllProfilesOverStdio,
8
+ withProfile
9
+ } from "./chunk-BDSDQCV4.js";
10
+ import "./chunk-437W3Z2M.js";
11
+ import "./chunk-XFXBXQBS.js";
12
+ import "./chunk-5D4AEUVA.js";
13
+ import "./chunk-NTLPDH76.js";
14
+ import "./chunk-O5EHUB2V.js";
15
+ import "./chunk-EFHLQXG6.js";
16
+ import "./chunk-Y5E2WNWB.js";
17
+ import "./chunk-ZVVMGPBJ.js";
18
+ export {
19
+ CHILD_IDLE_MS,
20
+ allProfilesServer,
21
+ serveAllProfilesOverHttp,
22
+ serveAllProfilesOverStdio,
23
+ withProfile
24
+ };
@@ -0,0 +1,70 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ checkedOptions
5
+ } from "./chunk-2TBVT4SZ.js";
6
+ import {
7
+ messagesFor,
8
+ systemFor
9
+ } from "./chunk-JTTW5ZKF.js";
10
+ import {
11
+ Anthropic
12
+ } from "./chunk-ADLS6FVG.js";
13
+ import {
14
+ array,
15
+ optional,
16
+ strictObject,
17
+ string
18
+ } from "./chunk-EFHLQXG6.js";
19
+ import "./chunk-Y5E2WNWB.js";
20
+ import {
21
+ __name
22
+ } from "./chunk-ZVVMGPBJ.js";
23
+
24
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/node_modules/@wirecat/cli-core/dist/models/anthropic.js
25
+ var options = strictObject({
26
+ stop_sequences: optional(array(string()))
27
+ });
28
+ var anthropic = {
29
+ images: true,
30
+ baseUrl: "https://api.anthropic.com",
31
+ validate: /* @__PURE__ */ __name((given) => checkedOptions("anthropic", options, given), "validate"),
32
+ complete: /* @__PURE__ */ __name(async (target, request, checked, apiKey, fetcher) => {
33
+ const client = new Anthropic({
34
+ apiKey: apiKey ?? "",
35
+ authToken: null,
36
+ fetch: /* @__PURE__ */ __name((input, init) => fetcher(input, { ...init, redirect: "error" }), "fetch"),
37
+ baseURL: target.baseUrl,
38
+ maxRetries: 0,
39
+ logLevel: "off",
40
+ timeout: 12e4
41
+ });
42
+ const response = await client.messages.stream({
43
+ ...checked,
44
+ model: target.model,
45
+ system: systemFor(request),
46
+ messages: [
47
+ ...messagesFor(request),
48
+ ...request.images === void 0 ? [] : [
49
+ {
50
+ role: "user",
51
+ content: request.images.map((image) => ({
52
+ type: "image",
53
+ source: { type: "base64", media_type: image.mimeType, data: image.data }
54
+ }))
55
+ }
56
+ ]
57
+ ],
58
+ max_tokens: request.maxTokens
59
+ }).finalMessage();
60
+ if (response.stop_reason !== "end_turn")
61
+ throw new Error("incomplete response");
62
+ return {
63
+ text: response.content.filter((block) => block.type === "text").map((block) => block.text).join(""),
64
+ tokens: response.usage.input_tokens + response.usage.output_tokens + (response.usage.cache_creation_input_tokens ?? 0) + (response.usage.cache_read_input_tokens ?? 0)
65
+ };
66
+ }, "complete")
67
+ };
68
+ export {
69
+ anthropic
70
+ };
@@ -0,0 +1,169 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ DefaultLogger,
5
+ DrizzleQueryError,
6
+ NoopLogger,
7
+ SQLiteAsyncDatabase,
8
+ SQLiteAsyncPreparedQuery,
9
+ SQLiteAsyncSession,
10
+ SQLiteAsyncTransaction,
11
+ SQLiteDialect,
12
+ booleanFromInteger,
13
+ bufferFromBytes,
14
+ castToText,
15
+ dateFromStoredMilliseconds,
16
+ dateFromStoredSeconds,
17
+ entityKind,
18
+ jitCompatCheck,
19
+ refineSqliteCodecs,
20
+ sql
21
+ } from "./chunk-S57AMKLX.js";
22
+ import {
23
+ __name
24
+ } from "./chunk-ZVVMGPBJ.js";
25
+
26
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/bun.js
27
+ import { Database } from "bun:sqlite";
28
+ var bunSQLiteCodecs = refineSqliteCodecs({
29
+ "integer:boolean": { normalize: booleanFromInteger },
30
+ "integer:timestamp": { normalize: dateFromStoredSeconds },
31
+ "integer:timestamp_ms": { normalize: dateFromStoredMilliseconds },
32
+ "text:json": { normalize: JSON.parse },
33
+ blob: { normalize: bufferFromBytes },
34
+ "blob:json": {
35
+ cast: castToText,
36
+ normalize: JSON.parse
37
+ },
38
+ "blob:bigint": {
39
+ cast: castToText,
40
+ normalize: BigInt
41
+ },
42
+ numeric: {
43
+ cast: castToText,
44
+ normalize: String
45
+ },
46
+ "numeric:number": { normalize: Number },
47
+ "numeric:bigint": {
48
+ cast: castToText,
49
+ normalize: BigInt
50
+ }
51
+ });
52
+ var SQLiteBunSession = class extends SQLiteAsyncSession {
53
+ static {
54
+ __name(this, "SQLiteBunSession");
55
+ }
56
+ client;
57
+ relations;
58
+ options;
59
+ static [entityKind] = "SQLiteBunSession";
60
+ logger;
61
+ constructor(client, dialect, relations, options = {}) {
62
+ super(dialect, "sync");
63
+ this.client = client;
64
+ this.relations = relations;
65
+ this.options = options;
66
+ this.logger = options.logger ?? new NoopLogger();
67
+ }
68
+ exec(query) {
69
+ this.client.exec(query);
70
+ }
71
+ prepareQuery(query, mode, _prepare, executeMethod, mapper, queryMetadata) {
72
+ let stmt;
73
+ try {
74
+ stmt = this.client.query(query.sql);
75
+ } catch (e) {
76
+ throw new DrizzleQueryError(query.sql, this.options.paramsInErrors ? query.params : void 0, e);
77
+ }
78
+ return new SQLiteAsyncPreparedQuery("sync", executeMethod, {
79
+ all: /* @__PURE__ */ __name((params) => {
80
+ if (mode === "arrays") return stmt.values(...params);
81
+ return stmt.all(...params);
82
+ }, "all"),
83
+ get: /* @__PURE__ */ __name((params) => {
84
+ if (mode === "arrays") return stmt.values(...params)[0];
85
+ return stmt.get(...params);
86
+ }, "get"),
87
+ run: /* @__PURE__ */ __name((params) => {
88
+ return stmt.run(...params);
89
+ }, "run")
90
+ }, query, mapper, mode, this.logger, void 0, queryMetadata, void 0, this.options.paramsInErrors);
91
+ }
92
+ transaction(transaction, config = {}) {
93
+ const tx = new SQLiteBunTransaction("sync", this.dialect, this, this.relations);
94
+ let result;
95
+ const nativeTx = this.client.transaction(() => {
96
+ result = transaction(tx);
97
+ });
98
+ if (config.behavior === "concurrent") throw new Error("Concurrent transactions are not supported by driver");
99
+ nativeTx[config.behavior ?? "deferred"]();
100
+ return result;
101
+ }
102
+ };
103
+ var SQLiteBunTransaction = class SQLiteBunTransaction2 extends SQLiteAsyncTransaction {
104
+ static {
105
+ __name(this, "SQLiteBunTransaction2");
106
+ }
107
+ static [entityKind] = "SQLiteBunTransaction";
108
+ transaction(transaction) {
109
+ const savepointName = `sp${this.nestedIndex}`;
110
+ const tx = new SQLiteBunTransaction2("sync", this.dialect, this.session, this._.relations, this.nestedIndex + 1);
111
+ this.session.run(sql.raw(`savepoint ${savepointName}`));
112
+ try {
113
+ const result = transaction(tx);
114
+ this.session.run(sql.raw(`release savepoint ${savepointName}`));
115
+ return result;
116
+ } catch (err) {
117
+ try {
118
+ this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
119
+ } catch {
120
+ }
121
+ throw err;
122
+ }
123
+ }
124
+ };
125
+ var SQLiteBunDatabase = class extends SQLiteAsyncDatabase {
126
+ static {
127
+ __name(this, "SQLiteBunDatabase");
128
+ }
129
+ static [entityKind] = "SQLiteBunDatabase";
130
+ };
131
+ function construct(client, config = {}) {
132
+ const dialect = new SQLiteDialect({
133
+ codecs: config.codecs ?? bunSQLiteCodecs,
134
+ useJitMappers: jitCompatCheck(config.jit)
135
+ });
136
+ let logger;
137
+ if (config.logger === true) logger = new DefaultLogger();
138
+ else if (config.logger !== false) logger = config.logger;
139
+ const relations = config.relations ?? {};
140
+ const db = new SQLiteBunDatabase("sync", dialect, new SQLiteBunSession(client, dialect, relations, {
141
+ logger,
142
+ paramsInErrors: config.paramsInErrors
143
+ }), relations);
144
+ db.$client = client;
145
+ return db;
146
+ }
147
+ __name(construct, "construct");
148
+ function drizzle(...params) {
149
+ if (params[0] === void 0 || typeof params[0] === "string") return construct(params[0] === void 0 ? new Database() : new Database(params[0]), params[1]);
150
+ const { connection, client, ...DrizzleSQLiteConfig } = params[0];
151
+ if (client) return construct(client, DrizzleSQLiteConfig);
152
+ if (typeof connection === "object") {
153
+ const { source, ...opts } = connection;
154
+ const options = Object.values(opts).filter((v) => v !== void 0).length ? opts : void 0;
155
+ return construct(new Database(source, options), DrizzleSQLiteConfig);
156
+ }
157
+ return construct(new Database(connection), DrizzleSQLiteConfig);
158
+ }
159
+ __name(drizzle, "drizzle");
160
+ (function(_drizzle) {
161
+ function mock(config) {
162
+ return construct({}, config);
163
+ }
164
+ __name(mock, "mock");
165
+ _drizzle.mock = mock;
166
+ })(drizzle || (drizzle = {}));
167
+ export {
168
+ drizzle
169
+ };
@@ -0,0 +1,69 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ loadVectorExtension,
5
+ vectorExtension
6
+ } from "./chunk-LY7GS2YI.js";
7
+ import "./chunk-EFHLQXG6.js";
8
+ import {
9
+ importFrom
10
+ } from "./chunk-Y5E2WNWB.js";
11
+ import {
12
+ __name
13
+ } from "./chunk-ZVVMGPBJ.js";
14
+
15
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/node_modules/@wirecat/cli-core/dist/store/drivers/bun-sqlite.js
16
+ var customised = false;
17
+ var ownLibrary = /* @__PURE__ */ __name(async () => {
18
+ try {
19
+ const { libraryFor } = await importFrom(new URL("store/drivers/bun-sqlite.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
20
+ return libraryFor();
21
+ } catch {
22
+ return void 0;
23
+ }
24
+ }, "ownLibrary");
25
+ var bunDatabase = /* @__PURE__ */ __name(async () => {
26
+ const specifier = "bun:sqlite";
27
+ const { Database } = await importFrom(new URL("store/drivers/bun-sqlite.js", import.meta.resolve("@wirecat/cli-core")).href, specifier);
28
+ if (process.platform === "darwin" && !customised) {
29
+ customised = true;
30
+ const library = await ownLibrary();
31
+ if (library)
32
+ Database.setCustomSQLite(library);
33
+ }
34
+ return Database;
35
+ }, "bunDatabase");
36
+ var openWithBunSqlite = /* @__PURE__ */ __name(async (path) => cacheOverBunSqlite(await bunClient(path)), "openWithBunSqlite");
37
+ var bunClient = /* @__PURE__ */ __name(async (path, options) => {
38
+ const Database = await bunDatabase();
39
+ const extension = await vectorExtension();
40
+ const client = options ? new Database(path, options) : new Database(path);
41
+ try {
42
+ loadVectorExtension(client, extension);
43
+ return client;
44
+ } catch (error) {
45
+ client.close();
46
+ throw error;
47
+ }
48
+ }, "bunClient");
49
+ var cacheOverBunSqlite = /* @__PURE__ */ __name((database) => {
50
+ return {
51
+ exec: /* @__PURE__ */ __name((sql) => database.exec(sql), "exec"),
52
+ prepare: /* @__PURE__ */ __name((sql) => {
53
+ const statement = database.query(sql);
54
+ return {
55
+ run: /* @__PURE__ */ __name((...parameters) => ({ changes: Number(statement.run(...parameters).changes) }), "run"),
56
+ // Bun answers null for no row; the seam promises undefined, and `!== undefined` checks rely on it.
57
+ get: /* @__PURE__ */ __name((...parameters) => statement.get(...parameters) ?? void 0, "get"),
58
+ all: /* @__PURE__ */ __name((...parameters) => statement.all(...parameters), "all")
59
+ };
60
+ }, "prepare"),
61
+ close: /* @__PURE__ */ __name(() => database.close(), "close")
62
+ };
63
+ }, "cacheOverBunSqlite");
64
+ export {
65
+ bunClient,
66
+ bunDatabase,
67
+ cacheOverBunSqlite,
68
+ openWithBunSqlite
69
+ };