Commit Graph
38 Commits
Author SHA1 Message Date
手瓜一十雪 e699351f90 feat: adopt async SQLite and improve messaging and runtime diagnostics 2026-10-12 15:44:55 +08:00
DrSmoothl 7496479782 feat(core): record runtime status while waiting to sign in
Refresh the bundled runtime binaries.
2026-10-09 15:30:35 +08:00
DrSmoothl 6ceb2a3900 feat(core): include runtime status in the log view
Refresh the bundled runtime binaries.
2026-10-09 11:13:25 +08:00
DrSmoothl 914e9a004f fix(video): update ffmpeg addon so group video sends stay up
Group video sends could exit the process with no error after the file was
staged. Refresh the bundled addon from the build that covers this case.

Fixes #507
2026-10-05 23:01:55 +08:00
DrSmoothl 27284fd79b fix(linux): restore live session selection 2026-08-16 23:59:39 +08:00
DrSmoothl 3fc521fb8b fix(linux): restore sending and receiving on ARM 2026-08-16 21:49:36 +08:00
DrSmoothl 44bbaaa1bb fix(windows): restore sending on current QQ builds 2026-08-16 15:00:20 +08:00
DrSmoothl 7ae0fa3c0e fix(windows): refresh bundled native so sending stays up 2026-08-14 13:21:17 +08:00
DrSmoothl 9e0dd5d75c chore(native): refresh bundled runtime files 2026-08-13 17:27:54 +08:00
DrSmoothl b38db6715f chore(native): refresh bundled runtime files 2026-08-11 23:23:08 +08:00
DrSmoothl 870e9a5fbc fix(bridge): recover stale outbound sessions
Recover invalidated native send bindings from same-account receive evidence. Track outbound connection loss in status health and refresh the six public native artifacts from native build 94f2b63.

Closes #342
2026-08-09 21:40:09 +08:00
DrSmoothl 810509ef58 fix: restore message sending after restart 2026-08-07 19:24:24 +08:00
DrSmoothl c72de4adb6 fix(runtime): improve restored session reliability
Improve compatibility for accounts restored after a restart.

Keep existing accounts working normally while restoring full availability for affected sessions.
2026-08-03 19:28:21 +08:00
DrSmoothl 4b6237f24b chore(native): refresh bundled runtime files
Update the packaged runtime files from the verified release pipeline.

Align all supported platform bundles with the validated account recovery release.

Refs #305

Refs #307
2026-08-03 13:00:48 +08:00
DrSmoothl dae486a0ad chore(native): update bundled runtime files
Refresh the bundled runtime files with outputs from the verified release pipeline.

Include the supported Linux and Windows builds for the latest startup reliability improvements.

Refs #305

Refs #307
2026-08-03 10:56:31 +08:00
DrSmoothl b1fd5dd0fe chore(native): update runtime artifacts 2026-07-29 02:33:03 +08:00
DrSmoothl 55c9ee59f5 fix(video): update ffmpegAddon binaries to downscale oversized covers 2026-07-06 01:44:10 +08:00
DrSmoothl 908aaf9dc8 fix(video): update ffmpegAddon binaries to fix video cover expiry 2026-07-06 00:37:33 +08:00
DrSmoothl feaa94bec7 build(core,runtime): native websocket-darwin-arm64.node + drop build hatch
WebSocket native is now built for darwin-arm64 — source is at
github.com/SnowLuma/snowluma-websocket (cmake-js + node-addon-api,
clones to dev/snowluma-websocket and builds with `npm install`).

  npm install in dev/snowluma-websocket → build/Release/snowluma_ws.node
  cp → packages/runtime/native/websocket-darwin-arm64.node (102 KB)

Reverts the SNOWLUMA_BUILD_SKIP_NATIVES escape hatch in vite.config.ts
that 67f8bf3 added — no longer needed; the darwin native binary is
present. Keeps `packages/core/config/.gitignore` (independently useful
runtime-state hygiene). vite build now runs clean on darwin with no
env overrides; the runtime SNOWLUMA_DEV_NO_NATIVE=1 stub also becomes
optional (only needed if the operator wants to bypass WebSocket I/O
specifically).

Existing native binaries unchanged. CI invariant restored: every
release build must include every platform's native set.
2026-06-25 16:25:56 +08:00
snowluma-bot[bot] fd2345b772 chore(native): replace native artifacts (native-latest) (#121)
Build: https://github.com/SnowLuma/SnowLumaNative/releases/tag/native-latest

Co-authored-by: snowluma-bot[bot] <283088347+snowluma-bot[bot]@users.noreply.github.com>
2026-06-22 01:41:50 +08:00
snowluma-bot[bot] c7b7c0b323 chore(native): replace native artifacts (native-1.10.0) (#116)
Build: https://github.com/SnowLuma/SnowLumaNative/releases/tag/native-1.10.0

Co-authored-by: snowluma-bot[bot] <283088347+snowluma-bot[bot]@users.noreply.github.com>
2026-06-21 20:20:43 +08:00
snowluma-bot[bot] ac049e5cc1 chore(native): replace native artifacts (native-886e60a) (#90)
Source: SnowLuma/nnphook@886e60a271
Build:  https://github.com/SnowLuma/SnowLumaNative/releases/tag/native-886e60a

Co-authored-by: snowluma-bot[bot] <283088347+snowluma-bot[bot]@users.noreply.github.com>
2026-06-08 00:13:38 +08:00
手瓜一十雪 f2b7ef0056 Switch from @snowluma/sqlite to node:sqlite (sync)
Remove the in-tree @snowluma/sqlite wrapper and vendored better-sqlite3 prebuilts; migrate consumers to node:sqlite's synchronous API. Replaced imports and types (Database/Statement -> DatabaseSync/StatementSync), updated PRAGMA calls to use exec, and adjusted code in onebot (media/message/reaction stores) and protocol (identity service). Vite config no longer bundles sqlite native binaries and references to the sqlite workspace were removed. Also delete the packages/sqlite package and its native prebuild artifacts, and add a couple of unrelated AST improvements in proton: use a module-level shared wrapper cache and add an inheritance cache to avoid repeated scans. Minor import reordering/cleanup applied where needed.
2026-05-27 20:02:40 +08:00
snowluma-bot[bot] 66f8a5eb2f chore(native): replace native artifacts (native-03d4d0e)
Source: SnowLuma/nnphook@03d4d0ede7
Build:  https://github.com/SnowLuma/SnowLumaNative/releases/tag/native-03d4d0e
2026-05-21 07:09:34 +00:00
snowluma-bot[bot] 61f40703ca chore(native): replace native artifacts (native-117413b)
Source: SnowLuma/nnphook@117413b517
Build:  https://github.com/SnowLuma/SnowLumaNative/releases/tag/native-117413b
2026-05-21 06:40:38 +00:00
DrSmoothl 4e51b4bd7d build(sqlite): wrap better-sqlite3 with @snowluma/sqlite + vendor prebuilts
Replaces "runtime npm dependency that gets `npm install`-ed into
dist/" with "TS wrapper that loads the native `.node` from
`dist/native/` like every other native binding in the project".

Why the change
--------------
The previous approach (better-sqlite3 declared in
packages/runtime/package.json, materialized by `npm install
--omit=dev` in dist/) worked but produced an artifact that needed
runtime npm install — a step the rest of SnowLuma's native bindings
don't need (websocket / snowluma-hook / ffmpeg are all standalone
`.node` files copied into `dist/native/` by vite-plugin-cp). The
asymmetry was friction: dev mode required `pnpm dist:install`,
build artifacts carried a `dist/node_modules/` tree the other
modules didn't need, and Docker images had to special-case the
glibc-vs-musl ABI lookup that prebuild-install runs.

The new shape:
  - `@snowluma/sqlite` (packages/sqlite/) — TS wrapper. Has
    `better-sqlite3` as a devDep (for the JS-layer types + the
    actual JS wrapper code that vite inlines). At runtime, calls
    `createRequire().require()` against
    `<dist|repo>/native/better-sqlite3-v<abi>-<platform>-<arch>.node`
    and passes the resolved addon to `new Database(path, {
    nativeBinding })`.
  - `packages/runtime/native/better-sqlite3-v<abi>-<triplet>.node`
    — prebuilt binaries vendored into the repo. Two ABIs ship side-
    by-side (v127 = Node 22 LTS used by CI, v137 = Node 24 used by
    dev boxes) so `process.versions.modules` picks the matching one
    at load time.
  - `tools/fetch-sqlite-prebuilts.mjs` — fetches all 5 platforms ×
    N ABIs from WiseLibs's GitHub releases. Idempotent: existing
    `.node` files skip. Accepts extra ABI args:
    `node tools/fetch-sqlite-prebuilts.mjs 12.10.0 v127 v137 v115`.

What was unwound
----------------
- packages/runtime/package.json — dependencies removed (runtime
  artifact is now self-contained, no `npm install` step needed).
- root package.json — `dist:install` script removed (no node_modules
  to install).
- .github/workflows/dev-build.yml — `Bundle runtime dependencies`
  step removed.
- .github/workflows/release.yml — kept the `Bundle runtime
  dependencies` step (was a no-op already, but harmless safety net
  in case a future runtime dep shows up).
- packages/core/vite.config.ts — `better-sqlite3` no longer
  external; vite inlines the JS wrapper (+~33 KB to bundle, ~2.84
  MB → 2.87 MB total).

Naming
------
Mirrors the existing `websocket-${triplet}.node` convention (flat
dir under `runtime/native/`, dash-separated `<platform>-<arch>`).
Adds a `v<abi>` segment because better-sqlite3 is NOT N-API — one
binary per Node ABI. Naming:

  better-sqlite3-v127-darwin-arm64.node    Node 22 / macOS arm
  better-sqlite3-v127-darwin-x64.node      Node 22 / macOS intel
  better-sqlite3-v127-linux-arm64.node     Node 22 / Linux arm
  better-sqlite3-v127-linux-x64.node       Node 22 / Linux x64
  better-sqlite3-v127-win32-x64.node       Node 22 / Windows x64
  better-sqlite3-v137-... (5)              Node 24 / same 5 hosts

Total: 10 binaries × ~1.9 MB = ~19 MB committed. Aligned with the
existing native-vendoring footprint (websocket ~2 MB × 5, snowluma-
hook ~10 MB × Windows + Linux, ffmpeg ~10-30 MB × 4).

What changes for consumers
--------------------------
Source-side: nothing. `import Database, { type Database, type
Statement } from '@snowluma/sqlite'` is a drop-in for the previous
`import Database from 'better-sqlite3'`. The wrapper re-exports the
same types and the `Database` callable factory has the same
overload set.

Runtime: `node` finds the binding at
`<dist|repo>/native/better-sqlite3-v${process.versions.modules}-
${process.platform}-${process.arch}.node`. If the ABI doesn't
match a vendored binary, the wrapper throws a clear error pointing
at `tools/fetch-sqlite-prebuilts.mjs` with the missing ABI/triplet.

Bumped better-sqlite3 from 11.10.0 → 12.10.0 because v11 only had
prebuilt up to Node ABI v127 (no v137 = no Node 24). v12.10.0
ships both. Both versions are API-compat (the breaking changes
between v11 and v12 were either internal or in error-handling
paths SnowLuma doesn't exercise).

Verification
------------
- pnpm -r typecheck (12 projects): clean
- @snowluma/core test: 302/302
- @snowluma/onebot test: 250/250 (552/552 combined, unchanged from
  the perf-series baseline)
- Bench numbers preserved — wrapper indirection is sub-μs:
  storeMeta ~11 μs, storeEvent ~17 μs, findMeta hit ~1.1 μs (all
  within noise of the post-RoadMap-#5 measurements).
- Vite build clean, bundle = 2.87 MB / 230 KB gzip
- `dist/index.mjs` no longer contains a `node:sqlite` import (it
  did before — media-store hadn't migrated; now neither it nor
  message-store reach into the Node builtin).

Bonus side-fix: `packages/onebot/src/media-store.ts` also moved
off `node:sqlite` (caught by the post-build bundle grep — the
file was using `DatabaseSync` + `StatementSync` from the builtin
even though it had already been written to cache its prepared
statements). Its hot paths now go through the same wrapper.
2026-05-21 13:49:19 +08:00
snowluma-bot[bot] 26777d0010 chore(native): replace native artifacts (native-c0dc4db)
Source: SnowLuma/nnphook@c0dc4db649
Build:  https://github.com/SnowLuma/SnowLumaNative/releases/tag/native-c0dc4db
2026-05-21 02:50:23 +00:00
DrSmoothl 6760008c5c chore: refresh prebuilt linux-x64 native binary 2026-05-13 16:18:21 +08:00
DrSmoothl 37b835c537 chore: refresh prebuilt linux-x64 native binary 2026-05-13 16:18:21 +08:00
手瓜一十雪 c39b3f5c4e Add PTT (voice) upload support with FFmpeg addon
Introduce NT SILK-based voice (PTT) upload pipeline and native FFmpeg addon wrapper.

- Add ffmpeg-addon wrapper (packages/core/src/bridge/highway/ffmpeg-addon.ts) to load platform/arch .node binaries, detect SILK files, and convert inputs to NT SILK via the native addon. Provides encodeSilk, isSilkFile and default temp dir helpers.
- Implement ptt-upload pipeline (packages/core/src/bridge/highway/ptt-upload.ts) to: resolve/fetch audio bytes, convert to NT SILK if needed, send OIDB upload request, perform highway HTTP upload when required, and produce Encodable MsgInfo bytes for commonElem.
- Wire record element support into element-builder: uploadPttMsgInfo is used to build a commonElem for 'record' sends; when SendContext is absent, record sends are skipped with a warning (graceful no-bridge path).
- Update message parsing to accept record segments from data.file, data.url or data.path and drop empty sources.
- Enable canSendRecord in OneBot instance context.
- Add tests covering record parsing and the graceful send path (packages/core/tests/message-parser.test.ts).
- Include prebuilt native ffmpeg addon binaries under packages/runtime/native/ffmpeg and update vite config to validate & copy the ffmpeg addon into the dist layout.

These changes enable sending voice messages by converting/encoding sources to the expected NT SILK format and uploading them through the existing highway/NTV2 flows.
2026-05-09 19:32:13 +08:00
DrSmoothl 92c6234b4f build(native): refresh Linux SnowLuma binaries
Update the Linux x64 SnowLuma native binaries from the latest release build.

Leave the websocket native binary unchanged.
2026-05-07 18:42:06 +08:00
手瓜一十雪 466a10a00a Update snowluma Win32 x64 native DLL
Replace packages/runtime/native/snowluma-win32-x64.dll with an updated binary build. This commit updates the native Windows x64 runtime DLL; no other source changes are present in this diff.
2026-05-07 14:19:27 +08:00
DrSmoothl 5f8fd26a28 build(native): add prebuilt Linux arm64 binaries 2026-05-07 00:25:47 +08:00
手瓜一十雪 85298444eb Update Windows x64 native binaries
Replace rebuilt native artifacts for Windows x64: packages/runtime/native/snowluma-win32-x64.dll and packages/runtime/native/snowluma-win32-x64.node. This updates the compiled DLL and Node addon (likely due to native fixes, dependency or build changes) without touching source files.
2026-05-06 16:35:30 +08:00
DrSmoothl 682d40b239 build(native): strip Linux SnowLuma binaries
Replace the Linux x64 SnowLuma native binaries with stripped release builds.

Leave the websocket native binary unchanged.
2026-05-06 15:21:22 +08:00
DrSmoothl d6a22d62ae chore: move native bondle to packages/runtime folder 2026-05-03 18:25:20 +08:00
手瓜一十雪 5fb969da7c Add WebSocket package with client/server & native
Introduce a new WebSocket package implementing RFC6455 functionality and permessage-deflate support. Adds core connection handling (packages/websocket/websocket.js), client wrapper (client.js), server and upgrade handling (server.js), extensions (permessage-deflate) and helpers (extensions.js), an index and native loader (native.js). Also include prebuilt native addon binaries for multiple platforms and integration points to use the native Parser and frame builder. The server supports handleUpgrade, subprotocol negotiation, and verifyClient hooks; the client performs handshakes and queues sends until open. Error handling, UTF-8 validation, close/ping/pong control frames, and max-payload checks are implemented.
2026-05-03 15:32:44 +08:00
手瓜一十雪 39f1672b29 Migrate project to pnpm monorepo
Restructure the repository into a pnpm workspace under packages/ (core, webui, runtime). Move source files for core and webui into packages/*, add package manifests for @snowluma/core and @snowluma/runtime, and remove the old launcher package.json. Update root package.json to be a monorepo controller (scripts delegate to pnpm filters, set packageManager and Node engine). Configure build outputs to emit into the repo-root dist/ (vite config changes) so the existing release pipeline continues to work. Add .npmrc with mirrors, expand .gitignore for monorepo layout, add tsconfig base and package-level tsconfigs, and add vitest config for the core package. Adjust injector native search paths and update tests import paths to the new package layout. Small CI/workflow comment added to clarify build behavior and README updated with monorepo structure and common commands.
2026-05-03 14:02:29 +08:00