refactor(packages): rename @snowluma/bridge → @snowluma/protocol
The package previously named "bridge" houses the protocol-byte layer (OIDB cmds, msg-push decoders, highway uploaders, element-builder, event bus). The name "bridge" suggested transport/lifecycle, which it isn't — that role lives in core/hook and core/bridge/manager. Rename to match what's actually inside. This is a pure rename: zero logic changes, all 73 import sites updated mechanically and TS-verified. core/onebot dependencies key updated. ESLint override path adjusted for the moved oidb-services directory. Rename detection threshold: git log --find-renames=20% recommended when following history across this commit — content-replacement (@snowluma/bridge → @snowluma/protocol) dropped per-file similarity below git's default 50% on import-heavy files.
This commit is contained in:
238 files changed
+247
-284
No files matched your search
@@ -86,11 +86,11 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@snowluma/bridge": "workspace:*",
|
||||
"@snowluma/common": "workspace:*",
|
||||
"@snowluma/core": "workspace:*",
|
||||
"@snowluma/proto-defs": "workspace:*",
|
||||
"@snowluma/proton": "workspace:*",
|
||||
"@snowluma/protocol": "workspace:*",
|
||||
"@snowluma/sqlite": "workspace:*",
|
||||
"@snowluma/websocket": "workspace:*"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ApiHandler, ApiActionContext } from '../api-handler';
|
||||
import { asNumber, asBoolean, asString } from '../api-handler';
|
||||
import { RETCODE, failedResponse, okResponse } from '../types';
|
||||
import { WebHonorType } from '@snowluma/bridge/web/group-honor';
|
||||
import { WebHonorType } from '@snowluma/protocol/web/group-honor';
|
||||
|
||||
export function register(h: ApiHandler, ctx: ApiActionContext): void {
|
||||
h.registerAction('get_group_list', async (params) => {
|
||||
|
||||
@@ -17,7 +17,7 @@ import { register as registerRequest } from './actions/request';
|
||||
import { register as registerExtended } from './actions/extended';
|
||||
import { register as registerGroupAlbum } from './actions/group-album';
|
||||
|
||||
import { WebHonorType } from '@snowluma/bridge/web/group-honor';
|
||||
import { WebHonorType } from '@snowluma/protocol/web/group-honor';
|
||||
import type { ClientKeyInfo } from '@snowluma/core/bridge';
|
||||
|
||||
export interface MessageSendResult {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MessageElement, QQEventVariant } from '@snowluma/bridge/events';
|
||||
import type { MessageElement, QQEventVariant } from '@snowluma/protocol/events';
|
||||
import type { JsonObject } from '../types';
|
||||
import {
|
||||
convertFriendMessage,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { QQEventVariant } from '@snowluma/bridge/events';
|
||||
import type { QQEventVariant } from '@snowluma/protocol/events';
|
||||
import { GROUP_MESSAGE_EVENT, PRIVATE_MESSAGE_EVENT } from '../message-id';
|
||||
import type { JsonObject } from '../types';
|
||||
import type { ConverterContext } from './index';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { QQEventVariant } from '@snowluma/bridge/events';
|
||||
import type { QQEventVariant } from '@snowluma/protocol/events';
|
||||
import { GROUP_MESSAGE_EVENT, PRIVATE_MESSAGE_EVENT } from '../message-id';
|
||||
import type { JsonObject } from '../types';
|
||||
import type { ConverterContext } from './index';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { QQEventVariant } from '@snowluma/bridge/events';
|
||||
import type { QQEventVariant } from '@snowluma/protocol/events';
|
||||
import type { JsonObject } from '../types';
|
||||
import type { ConverterContext } from './index';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MessageElement } from '@snowluma/bridge/events';
|
||||
import type { MessageElement } from '@snowluma/protocol/events';
|
||||
import type { JsonArray, JsonObject } from '../types';
|
||||
import type {
|
||||
ImageUrlResolver,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { QQEventVariant } from '@snowluma/bridge/events';
|
||||
import type { QQEventVariant } from '@snowluma/protocol/events';
|
||||
import { convertEvent } from './event-converter';
|
||||
import type { OneBotInstanceContext } from './instance-context';
|
||||
import { GROUP_MESSAGE_EVENT, PRIVATE_MESSAGE_EVENT, hashMessageIdInt32 } from './message-id';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { WebHonorType } from '@snowluma/bridge/web/group-honor';
|
||||
import type { WebHonorType } from '@snowluma/protocol/web/group-honor';
|
||||
import type { Bridge } from '@snowluma/core/bridge';
|
||||
import type { ApiActionContext } from './api-handler';
|
||||
import type { ConverterContext } from './event-converter';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MessageElement } from '@snowluma/bridge/events';
|
||||
import type { MessageElement } from '@snowluma/protocol/events';
|
||||
import type { DownloadRKeyInfo } from '@snowluma/core/bridge';
|
||||
import type { BridgeInterface } from '@snowluma/core/bridge-interface';
|
||||
import { createLogger } from '@snowluma/common/logger';
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
type NetworkAdapterContext,
|
||||
} from './network';
|
||||
import { createLogger, type Logger } from '@snowluma/common/logger';
|
||||
import { formatGroup, formatMessageSegments, formatReply, formatUser } from '@snowluma/bridge/format';
|
||||
import { formatGroup, formatMessageSegments, formatReply, formatUser } from '@snowluma/protocol/format';
|
||||
|
||||
const moduleLog = createLogger('Event');
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// segment emitted by the event converter and writes a row into the
|
||||
// MediaStore so later `get_image` / `get_record` OneBot actions can
|
||||
|
||||
import type { MessageElement } from '@snowluma/bridge/events';
|
||||
import type { MessageElement } from '@snowluma/protocol/events';
|
||||
import type { MediaStore } from './media-store';
|
||||
import type { JsonObject } from './types';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import fs from 'fs';
|
||||
import Database, { type Database as DatabaseType, type Statement } from '@snowluma/sqlite';
|
||||
import path from 'path';
|
||||
|
||||
import type { MessageElement } from '@snowluma/bridge/events';
|
||||
import type { MessageElement } from '@snowluma/protocol/events';
|
||||
|
||||
export interface CachedImage {
|
||||
/** Primary `data.file` value as exposed in the OneBot segment. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { BridgeInterface } from '@snowluma/core/bridge-interface';
|
||||
import type { MessageElement } from '@snowluma/bridge/events';
|
||||
import type { MessageElement } from '@snowluma/protocol/events';
|
||||
import type { RKeyCache } from './instance-rkey';
|
||||
|
||||
export class MediaUrlResolver {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MessageElement } from '@snowluma/bridge/events';
|
||||
import type { MessageElement } from '@snowluma/protocol/events';
|
||||
import { createLogger } from '@snowluma/common/logger';
|
||||
import type { JsonValue } from './types';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { BridgeInterface } from '@snowluma/core/bridge-interface';
|
||||
import type { IdentityService } from '@snowluma/bridge/identity-service';
|
||||
import type { IdentityService } from '@snowluma/protocol/identity-service';
|
||||
import type { OneBotInstanceContext } from '../instance-context';
|
||||
import type { JsonObject } from '../types';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { BridgeInterface } from '@snowluma/core/bridge-interface';
|
||||
import type { ForwardNodePayload, MessageElement } from '@snowluma/bridge/events';
|
||||
import type { ForwardNodePayload, MessageElement } from '@snowluma/protocol/events';
|
||||
import { createLogger } from '@snowluma/common/logger';
|
||||
import type { MessageSendResult } from '../api-handler';
|
||||
import { elementsToOneBotSegments } from '../event-converter';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Plain JSON types now live in @snowluma/common/json so @snowluma/bridge
|
||||
// Plain JSON types now live in @snowluma/common/json so @snowluma/protocol
|
||||
// (event-format / receive parsers) can talk about JSON payloads without
|
||||
// importing OneBot. Re-exported here so the legacy import shape stays
|
||||
// supported — `import { JsonValue } from '<…>/onebot/types'` keeps working.
|
||||
|
||||
@@ -7,7 +7,7 @@ import { describe, expect, it, vi } from 'vitest';
|
||||
import type { BridgeInterface } from '../../src/bridge/bridge-interface';
|
||||
import type {
|
||||
FriendInfo, GroupMemberInfo, QQGroupInfo, UserProfileInfo,
|
||||
} from '@snowluma/bridge/qq-info';
|
||||
} from '@snowluma/protocol/qq-info';
|
||||
import {
|
||||
getFriendList,
|
||||
getGroupInfo,
|
||||
|
||||
@@ -16,7 +16,7 @@ import type {
|
||||
MessageElement,
|
||||
QQEventVariant,
|
||||
TempMessage,
|
||||
} from '@snowluma/bridge/events';
|
||||
} from '@snowluma/protocol/events';
|
||||
|
||||
const SELF_ID = 10001;
|
||||
const PEER_UIN = 22222;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { BridgeEventBus } from '@snowluma/bridge/event-bus';
|
||||
import { BridgeEventBus } from '@snowluma/protocol/event-bus';
|
||||
|
||||
// Wrap convertEvent in a vi.fn that delegates to the real impl by
|
||||
// default, so one test can override it to return null without making
|
||||
@@ -18,7 +18,7 @@ import type {
|
||||
GroupMemberJoin,
|
||||
TempMessage,
|
||||
QQEventVariant,
|
||||
} from '@snowluma/bridge/events';
|
||||
} from '@snowluma/protocol/events';
|
||||
import type { JsonObject, MessageMeta } from '../src/types';
|
||||
|
||||
const SELF_UIN = '10001';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { ApiHandler, type ApiActionContext } from '../src/api-handler';
|
||||
import type { BridgeInterface } from '../../src/bridge/bridge-interface';
|
||||
import type { GroupRequestInfo } from '@snowluma/bridge/qq-info';
|
||||
import type { GroupRequestInfo } from '@snowluma/protocol/qq-info';
|
||||
import type { MessageMeta } from '../src/types';
|
||||
|
||||
function fakeMeta(overrides: Partial<MessageMeta> = {}): MessageMeta {
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import { protobuf_encode } from '@snowluma/proton';
|
||||
import type { GroupReactNotify } from '@snowluma/proto-defs/notify';
|
||||
import { decodeEvent0x2DC } from '@snowluma/bridge/msg-push/decoders/event-0x2dc';
|
||||
import type { MsgPushContext } from '@snowluma/bridge/msg-push/context';
|
||||
import { IdentityService } from '@snowluma/bridge/identity-service';
|
||||
import type { GroupMsgEmojiLikeEvent, QQEventVariant } from '@snowluma/bridge/events';
|
||||
import { decodeEvent0x2DC } from '@snowluma/protocol/msg-push/decoders/event-0x2dc';
|
||||
import type { MsgPushContext } from '@snowluma/protocol/msg-push/context';
|
||||
import { IdentityService } from '@snowluma/protocol/identity-service';
|
||||
import type { GroupMsgEmojiLikeEvent, QQEventVariant } from '@snowluma/protocol/events';
|
||||
import { convertGroupMsgEmojiLike } from '../src/event-converter/to-notice';
|
||||
import { GROUP_MESSAGE_EVENT, hashMessageIdInt32 } from '../src/message-id';
|
||||
import { formatEvent } from '@snowluma/bridge/format';
|
||||
import { formatEvent } from '@snowluma/protocol/format';
|
||||
import { subscribeLogs, type LogEntry } from '@snowluma/common/logger';
|
||||
|
||||
const SELF_UIN = '10001';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { MediaIndexer } from '../src/media-indexer';
|
||||
import type { MessageElement } from '@snowluma/bridge/events';
|
||||
import type { MessageElement } from '@snowluma/protocol/events';
|
||||
|
||||
function makeMediaStore() {
|
||||
return {
|
||||
|
||||
@@ -3,7 +3,7 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { MediaStore } from '../src/media-store';
|
||||
import { convertEvent, type ConverterContext } from '../src/event-converter';
|
||||
import type { GroupMessage, FriendMessage, MessageElement } from '@snowluma/bridge/events';
|
||||
import type { GroupMessage, FriendMessage, MessageElement } from '@snowluma/protocol/events';
|
||||
|
||||
const SELF_ID = 10001;
|
||||
const PEER_UIN = 22222;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { MediaUrlResolver } from '../src/media-url-resolver';
|
||||
import type { MessageElement } from '@snowluma/bridge/events';
|
||||
import type { MessageElement } from '@snowluma/protocol/events';
|
||||
|
||||
// Minimal stand-ins for the two collaborators. Each test wires whatever
|
||||
// subset of Bridge methods the element type exercises.
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from 'path';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import { parseMessage } from '../src/message-parser';
|
||||
import { buildSendElems } from '@snowluma/bridge/element-builder';
|
||||
import { buildSendElems } from '@snowluma/protocol/element-builder';
|
||||
import type { MentionExtraSend } from '@snowluma/proto-defs/action';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type { NTV2UploadRichMediaResp } from '@snowluma/proto-defs/highway';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { handleGroupAddRequest } from '../src/modules/request-actions';
|
||||
import type { BridgeInterface } from '../../src/bridge/bridge-interface';
|
||||
import type { GroupRequestInfo } from '@snowluma/bridge/qq-info';
|
||||
import type { GroupRequestInfo } from '@snowluma/protocol/qq-info';
|
||||
|
||||
// See `contact-actions.test.ts` for the auto-promotion rationale.
|
||||
const APIS_ROUTING: Record<string, string> = {
|
||||
|
||||
Reference in new issue
Block a user