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.
16 lines
575 B
TypeScript
16 lines
575 B
TypeScript
import { createHash } from 'node:crypto';
|
|
|
|
export const GROUP_MESSAGE_EVENT = 'group_message';
|
|
export const PRIVATE_MESSAGE_EVENT = 'private_message';
|
|
|
|
export function hashMessageIdInt32(sequence: number, sessionId: number, eventName: string): number {
|
|
const seq = Number.isFinite(sequence) ? Math.trunc(sequence) : 0;
|
|
const session = Number.isFinite(sessionId) ? Math.trunc(sessionId) : 0;
|
|
const key = `${seq}:${session}:${eventName}`;
|
|
const digest = createHash('sha1').update(key).digest();
|
|
|
|
let id = digest.readInt32BE(0);
|
|
if (id === 0) id = 1;
|
|
return id;
|
|
}
|