@napuketto/adapter 0.24.3 → 0.24.4

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.
@@ -1,6 +1,6 @@
1
- import { i as toUnixSeconds } from "./raw-message-B0kwCfKE.mjs";
1
+ import { i as toUnixSeconds } from "./raw-message-D9-8kPiU.mjs";
2
2
  import { isRecord } from "@napuketto/kernel";
3
- // src/internal/qq/buddy-req.ts
3
+ // src/internal/domain/buddy-req.ts
4
4
  /**
5
5
  * BuddyReq 防御收窄 + 可处理性过滤(OB11 / Milky 共用,issue #122)
6
6
  *
@@ -131,7 +131,7 @@ function processInboundBuddyReqs(arg, opts) {
131
131
  }, `${opts.scope}: 好友申请过滤(历史积压 / 已读 / 已处理 / 重复)`);
132
132
  return fresh;
133
133
  }
134
- // src/internal/qq/sysmsg.ts
134
+ // src/internal/domain/sysmsg.ts
135
135
  /** 递归深度上限(防御:恶意/畸形字节防栈溢出)。 */
136
136
  const MAX_DEPTH = 16;
137
137
  /** 单层字段数上限。 */
@@ -448,7 +448,7 @@ async function processSysMsgBlob(blob, opts) {
448
448
  raw: toHex(blob).slice(0, 1024)
449
449
  }, `${opts.scope}: onRecvSysMsg 校准数据(未识别,不广播)`);
450
450
  }
451
- // src/internal/qq/essence.ts
451
+ // src/internal/domain/essence.ts
452
452
  /**
453
453
  * 群精华协议层提取器(仅保留 sysmsg 732:1 protobuf 树字段提取)
454
454
  *
@@ -558,163 +558,7 @@ async function cacheMediaFile(root, extension, writer, lifetime = "temporary", i
558
558
  const leaseMediaReference = MediaCache.leasePath;
559
559
  /** Only the current Satori account can consume its internal IDs. */
560
560
  const leaseInternalMedia = MediaCache.leaseInternal;
561
- // src/internal/infra/local-media.ts
562
- const MAX_FILE_BYTES = 536870912;
563
- const WINDOWS = process.platform === "win32";
564
- const DEVICE_RE = /^(?:con|prn|aux|nul|conin\$|conout\$|com[1-9¹²³]|lpt[1-9¹²³])(?:\.|$)/i;
565
- const DRIVE_PATH_RE = /^[a-z]:[\\/]/i;
566
- const NETWORK_PATH_RE = /^[\\/]{2}/;
567
- const PATH_SEPARATOR_RE = /[\\/]/;
568
- const WINDOWS_INVALID_NAME_RE = /[<>:"|?*]|[ .]$/;
569
- const FILE_SCHEME_RE = /^file:/i;
570
- const FILE_URI_RE = /^file:\/\//i;
571
- const EXTENSION_RE = /\.[a-z0-9]+$/i;
572
- const URI_SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;
573
- function denied() {
574
- return kernelError("本地媒体路径未授权或文件不可用", "INVALID_PARAM");
575
- }
576
- function validateWindowsPath(path) {
577
- if (isAbsolute(path) && !DRIVE_PATH_RE.test(path)) throw denied();
578
- const components = path.replace(DRIVE_PATH_RE, "").split(PATH_SEPARATOR_RE);
579
- for (const part of components) {
580
- if (part === "." || part === "..") continue;
581
- if (WINDOWS_INVALID_NAME_RE.test(part) || DEVICE_RE.test(part)) throw denied();
582
- }
583
- }
584
- function validatePath(path) {
585
- if (path === "" || path.includes("\0") || NETWORK_PATH_RE.test(path)) throw denied();
586
- if (URI_SCHEME_RE.test(path) && !(WINDOWS && DRIVE_PATH_RE.test(path))) throw denied();
587
- if (WINDOWS) validateWindowsPath(path);
588
- return path;
589
- }
590
- function decodeLocalPath(input) {
591
- if (!FILE_SCHEME_RE.test(input)) return validatePath(input);
592
- try {
593
- if (!FILE_URI_RE.test(input)) throw denied();
594
- const url = new URL(input);
595
- if (url.search || url.hash || url.hostname !== "") throw denied();
596
- return validatePath(fileURLToPath(url));
597
- } catch {
598
- throw denied();
599
- }
600
- }
601
- /** Resolve configuration relative to the trusted host base, never to a request path. */
602
- function bindLocalMediaRoots(base, configured) {
603
- const anchor = resolve(base ?? ".");
604
- return () => (configured?.() ?? []).map((root) => resolve(anchor, validatePath(root)));
605
- }
606
- function within(root, path) {
607
- return path.startsWith(root.endsWith(sep) ? root : root + sep) && path !== root;
608
- }
609
- function unavailable(err) {
610
- return err instanceof Error && "code" in err && [
611
- "ENOENT",
612
- "ENOTDIR",
613
- "EACCES",
614
- "EPERM",
615
- "ELOOP"
616
- ].includes(String(err.code));
617
- }
618
- function sameFile(a, b) {
619
- return a.isFile() && b.isFile() && a.dev === b.dev && a.ino === b.ino && a.ino !== 0n;
620
- }
621
- function withinInputRoot(root, path) {
622
- return WINDOWS ? within(root.toLowerCase(), path.toLowerCase()) : within(root, path);
623
- }
624
- async function findCandidate(input, configuredRoot) {
625
- try {
626
- const root = validatePath(await realpath(configuredRoot));
627
- const candidate = resolve(root, input);
628
- if (!withinInputRoot(root, candidate) && !withinInputRoot(configuredRoot, candidate)) return void 0;
629
- const path = validatePath(await realpath(candidate));
630
- if (!within(root, path) || isMediaCachePath(path)) throw denied();
631
- const before = await lstat(path, { bigint: true });
632
- if (!before.isFile() || before.nlink !== 1n) throw denied();
633
- return {
634
- root,
635
- path,
636
- before
637
- };
638
- } catch (err) {
639
- if (unavailable(err)) return void 0;
640
- throw err;
641
- }
642
- }
643
- async function selectCandidate(input, roots) {
644
- const matches = /* @__PURE__ */ new Map();
645
- for (const root of roots) {
646
- const candidate = await findCandidate(input, resolve(root));
647
- if (candidate !== void 0) matches.set(candidate.path, candidate);
648
- }
649
- if (matches.size !== 1) throw denied();
650
- const [match] = matches.values();
651
- if (match === void 0) throw denied();
652
- return match;
653
- }
654
- async function verifyOpenFile(candidate, file) {
655
- const { root, path, before } = candidate;
656
- const opened = await file.stat({ bigint: true });
657
- if (!sameFile(before, opened) || opened.nlink !== 1n || opened.size > MAX_FILE_BYTES) throw denied();
658
- const actual = process.platform === "linux" ? await readlink(`/proc/self/fd/${file.fd}`) : await realpath(path);
659
- if (actual !== path || !within(root, actual)) throw denied();
660
- const after = await lstat(actual, { bigint: true });
661
- if (!sameFile(after, opened) || after.nlink !== 1n) throw denied();
662
- return Number(opened.size);
663
- }
664
- async function writeSnapshot(file, path, size) {
665
- if (size === 0) {
666
- await writeFile(path, "", {
667
- flag: "wx",
668
- mode: 384
669
- });
670
- return;
671
- }
672
- const output = createWriteStream(path, {
673
- flags: "wx",
674
- mode: 384
675
- });
676
- await pipeline(file.createReadStream({
677
- autoClose: false,
678
- start: 0,
679
- end: size - 1
680
- }), output);
681
- if (output.bytesWritten !== size) throw denied();
682
- }
683
- async function snapshot(candidate, cacheDir, lifetime) {
684
- const linuxFlags = constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK;
685
- const file = await open(candidate.path, WINDOWS ? "r" : linuxFlags);
686
- try {
687
- const size = await verifyOpenFile(candidate, file);
688
- const name = basename(candidate.path);
689
- return await cacheMediaFile(cacheDir, EXTENSION_RE.exec(name)?.[0] ?? ".bin", (path) => writeSnapshot(file, path, size), lifetime, lifetime === "temporary" ? name : void 0);
690
- } finally {
691
- await file.close();
692
- }
693
- }
694
- /** The result is safe to hand to consumers that reopen a path, including native APIs. */
695
- async function resolveLocalMedia(input, roots = []) {
696
- const path = decodeLocalPath(input);
697
- if (isMediaCachePath(path)) return await leaseMediaReference(path);
698
- try {
699
- return await snapshot(await selectCandidate(path, roots), MEDIA_TEMP_ROOT, "temporary");
700
- } catch (err) {
701
- if (unavailable(err)) throw denied();
702
- throw err;
703
- }
704
- }
705
- /** QQ sources come from a current-account message/API response, never from RPC path fields. */
706
- async function exportQqMedia(source, qqRoot, cacheDir) {
707
- if (!source || !qqRoot) return void 0;
708
- try {
709
- const candidate = await findCandidate(validatePath(source.replaceAll("\\", sep)), resolve(qqRoot));
710
- if (candidate === void 0) return void 0;
711
- return await snapshot(candidate, cacheDir || MEDIA_TEMP_ROOT, "reference");
712
- } catch (err) {
713
- if (unavailable(err) || err instanceof Error && "code" in err && err.code === "INVALID_PARAM") return;
714
- throw err;
715
- }
716
- }
717
- // src/internal/qq/media.ts
561
+ // src/internal/domain/media.ts
718
562
  /**
719
563
  * adapter core 媒体辅助:语音归一化 + 视频缩略图 + 图片元数据
720
564
  * (media 严格解耦的协议层落点)
@@ -876,6 +720,162 @@ async function prepareVideoElements(elements) {
876
720
  throw err;
877
721
  }
878
722
  }
723
+ // src/internal/infra/local-media.ts
724
+ const MAX_FILE_BYTES = 536870912;
725
+ const WINDOWS = process.platform === "win32";
726
+ const DEVICE_RE = /^(?:con|prn|aux|nul|conin\$|conout\$|com[1-9¹²³]|lpt[1-9¹²³])(?:\.|$)/i;
727
+ const DRIVE_PATH_RE = /^[a-z]:[\\/]/i;
728
+ const NETWORK_PATH_RE = /^[\\/]{2}/;
729
+ const PATH_SEPARATOR_RE = /[\\/]/;
730
+ const WINDOWS_INVALID_NAME_RE = /[<>:"|?*]|[ .]$/;
731
+ const FILE_SCHEME_RE = /^file:/i;
732
+ const FILE_URI_RE = /^file:\/\//i;
733
+ const EXTENSION_RE = /\.[a-z0-9]+$/i;
734
+ const URI_SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;
735
+ function denied() {
736
+ return kernelError("本地媒体路径未授权或文件不可用", "INVALID_PARAM");
737
+ }
738
+ function validateWindowsPath(path) {
739
+ if (isAbsolute(path) && !DRIVE_PATH_RE.test(path)) throw denied();
740
+ const components = path.replace(DRIVE_PATH_RE, "").split(PATH_SEPARATOR_RE);
741
+ for (const part of components) {
742
+ if (part === "." || part === "..") continue;
743
+ if (WINDOWS_INVALID_NAME_RE.test(part) || DEVICE_RE.test(part)) throw denied();
744
+ }
745
+ }
746
+ function validatePath(path) {
747
+ if (path === "" || path.includes("\0") || NETWORK_PATH_RE.test(path)) throw denied();
748
+ if (URI_SCHEME_RE.test(path) && !(WINDOWS && DRIVE_PATH_RE.test(path))) throw denied();
749
+ if (WINDOWS) validateWindowsPath(path);
750
+ return path;
751
+ }
752
+ function decodeLocalPath(input) {
753
+ if (!FILE_SCHEME_RE.test(input)) return validatePath(input);
754
+ try {
755
+ if (!FILE_URI_RE.test(input)) throw denied();
756
+ const url = new URL(input);
757
+ if (url.search || url.hash || url.hostname !== "") throw denied();
758
+ return validatePath(fileURLToPath(url));
759
+ } catch {
760
+ throw denied();
761
+ }
762
+ }
763
+ /** Resolve configuration relative to the trusted host base, never to a request path. */
764
+ function bindLocalMediaRoots(base, configured) {
765
+ const anchor = resolve(base ?? ".");
766
+ return () => (configured?.() ?? []).map((root) => resolve(anchor, validatePath(root)));
767
+ }
768
+ function within(root, path) {
769
+ return path.startsWith(root.endsWith(sep) ? root : root + sep) && path !== root;
770
+ }
771
+ function unavailable(err) {
772
+ return err instanceof Error && "code" in err && [
773
+ "ENOENT",
774
+ "ENOTDIR",
775
+ "EACCES",
776
+ "EPERM",
777
+ "ELOOP"
778
+ ].includes(String(err.code));
779
+ }
780
+ function sameFile(a, b) {
781
+ return a.isFile() && b.isFile() && a.dev === b.dev && a.ino === b.ino && a.ino !== 0n;
782
+ }
783
+ function withinInputRoot(root, path) {
784
+ return WINDOWS ? within(root.toLowerCase(), path.toLowerCase()) : within(root, path);
785
+ }
786
+ async function findCandidate(input, configuredRoot) {
787
+ try {
788
+ const root = validatePath(await realpath(configuredRoot));
789
+ const candidate = resolve(root, input);
790
+ if (!withinInputRoot(root, candidate) && !withinInputRoot(configuredRoot, candidate)) return void 0;
791
+ const path = validatePath(await realpath(candidate));
792
+ if (!within(root, path) || isMediaCachePath(path)) throw denied();
793
+ const before = await lstat(path, { bigint: true });
794
+ if (!before.isFile() || before.nlink !== 1n) throw denied();
795
+ return {
796
+ root,
797
+ path,
798
+ before
799
+ };
800
+ } catch (err) {
801
+ if (unavailable(err)) return void 0;
802
+ throw err;
803
+ }
804
+ }
805
+ async function selectCandidate(input, roots) {
806
+ const matches = /* @__PURE__ */ new Map();
807
+ for (const root of roots) {
808
+ const candidate = await findCandidate(input, resolve(root));
809
+ if (candidate !== void 0) matches.set(candidate.path, candidate);
810
+ }
811
+ if (matches.size !== 1) throw denied();
812
+ const [match] = matches.values();
813
+ if (match === void 0) throw denied();
814
+ return match;
815
+ }
816
+ async function verifyOpenFile(candidate, file) {
817
+ const { root, path, before } = candidate;
818
+ const opened = await file.stat({ bigint: true });
819
+ if (!sameFile(before, opened) || opened.nlink !== 1n || opened.size > MAX_FILE_BYTES) throw denied();
820
+ const actual = process.platform === "linux" ? await readlink(`/proc/self/fd/${file.fd}`) : await realpath(path);
821
+ if (actual !== path || !within(root, actual)) throw denied();
822
+ const after = await lstat(actual, { bigint: true });
823
+ if (!sameFile(after, opened) || after.nlink !== 1n) throw denied();
824
+ return Number(opened.size);
825
+ }
826
+ async function writeSnapshot(file, path, size) {
827
+ if (size === 0) {
828
+ await writeFile(path, "", {
829
+ flag: "wx",
830
+ mode: 384
831
+ });
832
+ return;
833
+ }
834
+ const output = createWriteStream(path, {
835
+ flags: "wx",
836
+ mode: 384
837
+ });
838
+ await pipeline(file.createReadStream({
839
+ autoClose: false,
840
+ start: 0,
841
+ end: size - 1
842
+ }), output);
843
+ if (output.bytesWritten !== size) throw denied();
844
+ }
845
+ async function snapshot(candidate, cacheDir, lifetime) {
846
+ const linuxFlags = constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK;
847
+ const file = await open(candidate.path, WINDOWS ? "r" : linuxFlags);
848
+ try {
849
+ const size = await verifyOpenFile(candidate, file);
850
+ const name = basename(candidate.path);
851
+ return await cacheMediaFile(cacheDir, EXTENSION_RE.exec(name)?.[0] ?? ".bin", (path) => writeSnapshot(file, path, size), lifetime, lifetime === "temporary" ? name : void 0);
852
+ } finally {
853
+ await file.close();
854
+ }
855
+ }
856
+ /** The result is safe to hand to consumers that reopen a path, including native APIs. */
857
+ async function resolveLocalMedia(input, roots = []) {
858
+ const path = decodeLocalPath(input);
859
+ if (isMediaCachePath(path)) return await leaseMediaReference(path);
860
+ try {
861
+ return await snapshot(await selectCandidate(path, roots), MEDIA_TEMP_ROOT, "temporary");
862
+ } catch (err) {
863
+ if (unavailable(err)) throw denied();
864
+ throw err;
865
+ }
866
+ }
867
+ /** QQ sources come from a current-account message/API response, never from RPC path fields. */
868
+ async function exportQqMedia(source, qqRoot, cacheDir) {
869
+ if (!source || !qqRoot) return void 0;
870
+ try {
871
+ const candidate = await findCandidate(validatePath(source.replaceAll("\\", sep)), resolve(qqRoot));
872
+ if (candidate === void 0) return void 0;
873
+ return await snapshot(candidate, cacheDir || MEDIA_TEMP_ROOT, "reference");
874
+ } catch (err) {
875
+ if (unavailable(err) || err instanceof Error && "code" in err && err.code === "INVALID_PARAM") return;
876
+ throw err;
877
+ }
878
+ }
879
879
  // src/internal/infra/media-config.ts
880
880
  const protocolMediaSchema = z.object({
881
881
  localMediaRoots: z.array(z.string().min(1)).optional(),
@@ -914,7 +914,7 @@ function sliceRaw(value, max = RAW_DEBUG_LIMIT) {
914
914
  function logEventFailure(logger, msg, err) {
915
915
  logger?.warn({ err: errorMessage(err) }, msg);
916
916
  }
917
- // src/internal/qq/gray-tip.ts
917
+ // src/internal/domain/gray-tip.ts
918
918
  /**
919
919
  * 消息是否含 grayTip 元素(OB11 / Milky 收链路分流判据,收拢)。
920
920
  * `!= null` 空值判定:Linux 原生宿主把未命中的变体字段显式置 null,
@@ -958,4 +958,4 @@ function firstUntranslatedGrayTip(msg) {
958
958
  function findRevokeElement(msg) {
959
959
  return msg.elements.find((el) => el.grayTipElement?.revokeElement != null)?.grayTipElement?.revokeElement ?? void 0;
960
960
  }
961
- export { MediaCache as _, logEventFailure as a, withMediaScope as b, protocolMediaSchema as c, mediaDownloader as d, prepareImageElements as f, resolveLocalMedia as g, exportQqMedia as h, hasGrayTip as i, downloadProtocolMedia as l, bindLocalMediaRoots as m, findRevokeElement as n, sliceRaw as o, prepareVideoElements as p, firstUntranslatedGrayTip as r, truncRaw as s, collectGrayTipUids as t, ensureSilk as u, cacheMediaFile as v, leaseInternalMedia as y };
961
+ export { MediaCache as _, logEventFailure as a, withMediaScope as b, protocolMediaSchema as c, resolveLocalMedia as d, downloadProtocolMedia as f, prepareVideoElements as g, prepareImageElements as h, hasGrayTip as i, bindLocalMediaRoots as l, mediaDownloader as m, findRevokeElement as n, sliceRaw as o, ensureSilk as p, firstUntranslatedGrayTip as r, truncRaw as s, collectGrayTipUids as t, exportQqMedia as u, cacheMediaFile as v, leaseInternalMedia as y };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { f as ActionRegistry, n as ProtocolConfig, o as BaseProtocolAdapter, p as runAction, r as createServerSchema, t as ConfigBase } from "./framework-CA3087JP.mjs";
2
- import { N as kurobotConfigSchema, t as NapukettoKurobotAdapter } from "./kurobot-3nvb4oqh.mjs";
3
- import { r as milkyConfigSchema, t as NapukettoMilkyAdapter } from "./milky-BWLRoCdN.mjs";
4
- import { t as NapukettoOneBot11Adapter, u as ob11ConfigSchema } from "./onebot11-CQhxsoc_.mjs";
5
- import { m as satoriConfigSchema, t as NapukettoSatoriAdapter } from "./satori-CgaSIlQs.mjs";
2
+ import { N as kurobotConfigSchema, t as NapukettoKurobotAdapter } from "./kurobot-xqbvEUYA.mjs";
3
+ import { r as milkyConfigSchema, t as NapukettoMilkyAdapter } from "./milky-CNn-vyvI.mjs";
4
+ import { t as NapukettoOneBot11Adapter, u as ob11ConfigSchema } from "./onebot11-DOOBXC3z.mjs";
5
+ import { m as satoriConfigSchema, t as NapukettoSatoriAdapter } from "./satori-DewkytUw.mjs";
6
6
  export { ActionRegistry, BaseProtocolAdapter, ConfigBase, NapukettoKurobotAdapter, NapukettoMilkyAdapter, NapukettoOneBot11Adapter, NapukettoSatoriAdapter, ProtocolConfig, createServerSchema, kurobotConfigSchema, milkyConfigSchema, ob11ConfigSchema, runAction, satoriConfigSchema };
@@ -1 +1 @@
1
- export { u as KurobotConnection, n as MAX_GROUP_TEXT_LENGTH, t as NapukettoKurobotAdapter, d as PROTOCOL_NAME, f as PROTOCOL_VERSION, p as WS_SUBPROTOCOL, m as bindingsUpdatedFrame, h as commandFrame, g as commandResultFrame, _ as deathFrame, r as degradeElements, i as degradeMessage, v as encodeFrame, y as gameChatFrame, b as helloAckFrame, x as helloFrame, S as isProtocolVersionCompatible, C as joinFrame, M as kurobotConfigDefaults, N as kurobotConfigSchema, w as leaveFrame, T as pingFrame, E as platformChatFrame, D as pongFrame, O as queryFrame, k as queryResultFrame, a as renderCommandResult, o as renderDeathText, s as renderTemplate, c as resolveSenderName, A as statusFrame, l as truncateForGroup, j as wireFrameSchema } from "../kurobot-3nvb4oqh.mjs";
1
+ export { u as KurobotConnection, n as MAX_GROUP_TEXT_LENGTH, t as NapukettoKurobotAdapter, d as PROTOCOL_NAME, f as PROTOCOL_VERSION, p as WS_SUBPROTOCOL, m as bindingsUpdatedFrame, h as commandFrame, g as commandResultFrame, _ as deathFrame, r as degradeElements, i as degradeMessage, v as encodeFrame, y as gameChatFrame, b as helloAckFrame, x as helloFrame, S as isProtocolVersionCompatible, C as joinFrame, M as kurobotConfigDefaults, N as kurobotConfigSchema, w as leaveFrame, T as pingFrame, E as platformChatFrame, D as pongFrame, O as queryFrame, k as queryResultFrame, a as renderCommandResult, o as renderDeathText, s as renderTemplate, c as resolveSenderName, A as statusFrame, l as truncateForGroup, j as wireFrameSchema } from "../kurobot-xqbvEUYA.mjs";
@@ -1,5 +1,5 @@
1
1
  import { o as BaseProtocolAdapter, s as resolveProtocolConfig } from "./framework-CA3087JP.mjs";
2
- import { r as subscribeRawMessages } from "./raw-message-B0kwCfKE.mjs";
2
+ import { r as subscribeRawMessages } from "./raw-message-D9-8kPiU.mjs";
3
3
  import { ChatType, errorMessage, getOwnProp, isRecord, kernelError, toCanonicalElements } from "@napuketto/kernel";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { z } from "zod";
@@ -1 +1 @@
1
- export { a as MilkyApi, t as NapukettoMilkyAdapter, n as assembleMilkyTransports, i as createMilkyActionRegistry, r as milkyConfigSchema, o as milkyErrorCodeMap } from "../milky-BWLRoCdN.mjs";
1
+ export { a as MilkyApi, t as NapukettoMilkyAdapter, n as assembleMilkyTransports, i as createMilkyActionRegistry, r as milkyConfigSchema, o as milkyErrorCodeMap } from "../milky-CNn-vyvI.mjs";
@@ -1,7 +1,7 @@
1
1
  import { c as BEARER_PREFIX, f as ActionRegistry, i as validateListenerToken, l as createTokenAuthorize, o as BaseProtocolAdapter, p as runAction, s as resolveProtocolConfig } from "./framework-CA3087JP.mjs";
2
- import { _ as MediaCache, a as logEventFailure, b as withMediaScope, c as protocolMediaSchema, d as mediaDownloader, f as prepareImageElements, g as resolveLocalMedia, i as hasGrayTip, m as bindLocalMediaRoots, n as findRevokeElement, o as sliceRaw, r as firstUntranslatedGrayTip, t as collectGrayTipUids, v as cacheMediaFile } from "./gray-tip-DlxDI1YV.mjs";
3
- import { a as firstNonEmptyString, c as MS_TO_SEC, d as numericUin, f as resolveUidToUinWithFallback, i as toUnixSeconds, l as NUMERIC_RE, m as toUin, o as stringOrUndefined, p as resolveUin, r as subscribeRawMessages, s as startupBaselineSec, t as forEachRawMessage } from "./raw-message-B0kwCfKE.mjs";
4
- import { a as processSysMsgBlob, c as varintAt, d as processInboundBuddyReqs, i as nodeAt, l as varintOf, n as OBSERVED_UNNAMED_SYSMSG_KEYS, o as recognizeSysMsg, r as narrowSysMsgBlobs, s as textOf, t as extractEssenceSetSysMsg, u as BuddyReqDedup } from "./essence-ChxJJipr.mjs";
2
+ import { _ as MediaCache, a as logEventFailure, b as withMediaScope, c as protocolMediaSchema, d as resolveLocalMedia, h as prepareImageElements, i as hasGrayTip, l as bindLocalMediaRoots, m as mediaDownloader, n as findRevokeElement, o as sliceRaw, r as firstUntranslatedGrayTip, t as collectGrayTipUids, v as cacheMediaFile } from "./gray-tip-jdpy-Jv3.mjs";
3
+ import { a as firstNonEmptyString, c as MS_TO_SEC, d as numericUin, f as resolveUidToUinWithFallback, i as toUnixSeconds, l as NUMERIC_RE, m as toUin, o as stringOrUndefined, p as resolveUin, r as subscribeRawMessages, s as startupBaselineSec, t as forEachRawMessage } from "./raw-message-D9-8kPiU.mjs";
4
+ import { a as processSysMsgBlob, c as varintAt, d as processInboundBuddyReqs, i as nodeAt, l as varintOf, n as OBSERVED_UNNAMED_SYSMSG_KEYS, o as recognizeSysMsg, r as narrowSysMsgBlobs, s as textOf, t as extractEssenceSetSysMsg, u as BuddyReqDedup } from "./essence-CXj1VAP8.mjs";
5
5
  import { ChatType, EssenceListSync, GrayTipSubType, GroupApi, GroupNotifyMsgStatus, GroupNotifyMsgType, NTGroupMemberRole, NTGroupRequestOperateTypes, TicketApi, TipGroupElementType, errorMessage, findPendingGroupRequest, hasNumberProp, hasStringProp, isRecord, kernelError, narrowEssenceGroupArg, toCanonicalElements } from "@napuketto/kernel";
6
6
  import { HttpClient, HttpServer, createSseResponse, sendWsText } from "@napuketto/network";
7
7
  import { z } from "zod";
@@ -1 +1 @@
1
- export { y as MessageUnique, t as NapukettoOneBot11Adapter, r as OneBotApi, n as assembleOb11Transports, a as canonicalToCqMessage, o as canonicalToSegments, s as cqMessageToCanonical, c as cqMessageToSegments, i as createOb11ActionRegistry, f as encodeCqCode, p as escapeCqParam, m as escapeCqText, u as ob11ConfigSchema, v as ob11ErrorCodeMap, h as parseCqMessage, l as segmentsToCanonical, d as segmentsToCqMessage, g as serializeCqParts, _ as unescapeCqText } from "../onebot11-CQhxsoc_.mjs";
1
+ export { y as MessageUnique, t as NapukettoOneBot11Adapter, r as OneBotApi, n as assembleOb11Transports, a as canonicalToCqMessage, o as canonicalToSegments, s as cqMessageToCanonical, c as cqMessageToSegments, i as createOb11ActionRegistry, f as encodeCqCode, p as escapeCqParam, m as escapeCqText, u as ob11ConfigSchema, v as ob11ErrorCodeMap, h as parseCqMessage, l as segmentsToCanonical, d as segmentsToCqMessage, g as serializeCqParts, _ as unescapeCqText } from "../onebot11-DOOBXC3z.mjs";
@@ -1,7 +1,7 @@
1
1
  import { a as validateServerTokens, c as BEARER_PREFIX, f as ActionRegistry, l as createTokenAuthorize, o as BaseProtocolAdapter, p as runAction, r as createServerSchema, s as resolveProtocolConfig } from "./framework-CA3087JP.mjs";
2
- import { _ as MediaCache, a as logEventFailure, b as withMediaScope, c as protocolMediaSchema, d as mediaDownloader, f as prepareImageElements, g as resolveLocalMedia, h as exportQqMedia, i as hasGrayTip, l as downloadProtocolMedia, m as bindLocalMediaRoots, o as sliceRaw, p as prepareVideoElements, r as firstUntranslatedGrayTip, s as truncRaw, t as collectGrayTipUids, u as ensureSilk, v as cacheMediaFile } from "./gray-tip-DlxDI1YV.mjs";
3
- import { a as firstNonEmptyString, c as MS_TO_SEC, d as numericUin, f as resolveUidToUinWithFallback, i as toUnixSeconds, l as NUMERIC_RE, m as toUin, n as senderNickname, o as stringOrUndefined, p as resolveUin, r as subscribeRawMessages, s as startupBaselineSec, u as collectGroupNotifyUids } from "./raw-message-B0kwCfKE.mjs";
4
- import { a as processSysMsgBlob, d as processInboundBuddyReqs, n as OBSERVED_UNNAMED_SYSMSG_KEYS, o as recognizeSysMsg, r as narrowSysMsgBlobs, t as extractEssenceSetSysMsg, u as BuddyReqDedup } from "./essence-ChxJJipr.mjs";
2
+ import { _ as MediaCache, a as logEventFailure, b as withMediaScope, c as protocolMediaSchema, d as resolveLocalMedia, f as downloadProtocolMedia, g as prepareVideoElements, h as prepareImageElements, i as hasGrayTip, l as bindLocalMediaRoots, m as mediaDownloader, o as sliceRaw, p as ensureSilk, r as firstUntranslatedGrayTip, s as truncRaw, t as collectGrayTipUids, u as exportQqMedia, v as cacheMediaFile } from "./gray-tip-jdpy-Jv3.mjs";
3
+ import { a as firstNonEmptyString, c as MS_TO_SEC, d as numericUin, f as resolveUidToUinWithFallback, i as toUnixSeconds, l as NUMERIC_RE, m as toUin, n as senderNickname, o as stringOrUndefined, p as resolveUin, r as subscribeRawMessages, s as startupBaselineSec, u as collectGroupNotifyUids } from "./raw-message-D9-8kPiU.mjs";
4
+ import { a as processSysMsgBlob, d as processInboundBuddyReqs, n as OBSERVED_UNNAMED_SYSMSG_KEYS, o as recognizeSysMsg, r as narrowSysMsgBlobs, t as extractEssenceSetSysMsg, u as BuddyReqDedup } from "./essence-CXj1VAP8.mjs";
5
5
  import { ChatType, EssenceListSync, GrayTipSubType, GroupApi, GroupNotifyMsgType, NTGroupMemberRole, NTGroupRequestOperateTypes, TicketApi, TipGroupElementType, WebHonorType, errorMessage, findPendingGroupRequest, hasStringProp, isRecord, kernelError, narrowEssenceGroupArg, toCanonicalElements, toPendingGroupRequest } from "@napuketto/kernel";
6
6
  import { HttpClient, HttpServer, WsClient, WsServer } from "@napuketto/network";
7
7
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
1
  import { errorMessage, hasNumberProp, hasStringProp, isRecord } from "@napuketto/kernel";
2
- // src/internal/qq/uid-uin.ts
2
+ // src/internal/domain/uid-uin.ts
3
3
  /** 毫秒 → 秒(Unix 时间戳换算)。 */
4
4
  const MS_TO_SEC = 1e3;
5
5
  /** uid → uin(映射命中取 uin,未命中退化 uid 数值,非数字返回 0)。 */
@@ -80,7 +80,7 @@ async function resolveUidToUinWithFallback(uids, deps) {
80
80
  function startupBaselineSec(graceSec = 5) {
81
81
  return Math.floor(Date.now() / MS_TO_SEC) - graceSec;
82
82
  }
83
- // src/internal/qq/text.ts
83
+ // src/internal/domain/text.ts
84
84
  /**
85
85
  * 字符串取值小工具(跨协议共用)
86
86
  *
@@ -99,7 +99,7 @@ function firstNonEmptyString(...values) {
99
99
  function stringOrUndefined(value) {
100
100
  return typeof value === "string" ? value : void 0;
101
101
  }
102
- // src/internal/qq/raw-message.ts
102
+ // src/internal/domain/raw-message.ts
103
103
  /**
104
104
  * 发送者显示名(跨平台字段名不同,Linux 原生 wrapper 实测):
105
105
  * - Windows:`sendNickName` = 昵称,`sendMemberName` = 群名片(可空);
@@ -1 +1 @@
1
- export { f as HTTP_STATUS, t as NapukettoSatoriAdapter, c as SatoriActionError, i as SatoriApi, n as assembleSatoriTransports, d as canonicalToSatoriElements, a as createSatoriActionRegistry, o as parseContentToCanonical, l as parseElements, u as renderElements, m as satoriConfigSchema, p as satoriHttpStatusMap, s as satoriToCanonicalElements, r as toEventSignal } from "../satori-CgaSIlQs.mjs";
1
+ export { f as HTTP_STATUS, t as NapukettoSatoriAdapter, c as SatoriActionError, i as SatoriApi, n as assembleSatoriTransports, d as canonicalToSatoriElements, a as createSatoriActionRegistry, o as parseContentToCanonical, l as parseElements, u as renderElements, m as satoriConfigSchema, p as satoriHttpStatusMap, s as satoriToCanonicalElements, r as toEventSignal } from "../satori-DewkytUw.mjs";
@@ -1,6 +1,6 @@
1
1
  import { a as validateServerTokens, d as tokenEquals, f as ActionRegistry, l as createTokenAuthorize, o as BaseProtocolAdapter, p as runAction, r as createServerSchema, s as resolveProtocolConfig } from "./framework-CA3087JP.mjs";
2
- import { _ as MediaCache, a as logEventFailure, b as withMediaScope, c as protocolMediaSchema, f as prepareImageElements, g as resolveLocalMedia, h as exportQqMedia, l as downloadProtocolMedia, m as bindLocalMediaRoots, t as collectGrayTipUids, u as ensureSilk, v as cacheMediaFile, y as leaseInternalMedia } from "./gray-tip-DlxDI1YV.mjs";
3
- import { c as MS_TO_SEC, h as toUinString, i as toUnixSeconds, r as subscribeRawMessages } from "./raw-message-B0kwCfKE.mjs";
2
+ import { _ as MediaCache, a as logEventFailure, b as withMediaScope, c as protocolMediaSchema, d as resolveLocalMedia, f as downloadProtocolMedia, h as prepareImageElements, l as bindLocalMediaRoots, p as ensureSilk, t as collectGrayTipUids, u as exportQqMedia, v as cacheMediaFile, y as leaseInternalMedia } from "./gray-tip-jdpy-Jv3.mjs";
3
+ import { c as MS_TO_SEC, h as toUinString, i as toUnixSeconds, r as subscribeRawMessages } from "./raw-message-D9-8kPiU.mjs";
4
4
  import { ChatType, GrayTipSubType, NTGroupRequestOperateTypes, TipGroupElementType, errorMessage, findPendingGroupRequest, isRecord, kernelError, toCanonicalElements } from "@napuketto/kernel";
5
5
  import { HttpServer, WsServer, isWsOpen, sendWsText } from "@napuketto/network";
6
6
  import { z } from "zod";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@napuketto/adapter",
4
- "version": "0.24.3",
4
+ "version": "0.24.4",
5
5
  "type": "module",
6
6
  "description": "Protocol adapters (OneBot11 / Satori / KuroBot / Milky) for Napuketto",
7
7
  "keywords": [