@fontdo/5g-message 1.0.4 → 1.0.6

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.
package/index.ts CHANGED
@@ -97,7 +97,7 @@ function resolveCustomIMAccount(
97
97
  ): CustomIMAccount {
98
98
  const actualAccountId = accountId ?? DEFAULT_ACCOUNT_ID;
99
99
  const channels = cfg.channels as Record<string, Record<string, unknown>> | undefined;
100
- const customImChannel = channels?.["custom-im"] as Record<string, unknown> | undefined;
100
+ const customImChannel = channels?.["5g-message"] as Record<string, unknown> | undefined;
101
101
  const accounts = customImChannel?.accounts as Record<string, Record<string, unknown>> | undefined;
102
102
  const account = accounts?.[actualAccountId] as Record<string, unknown> | undefined;
103
103
 
@@ -126,7 +126,7 @@ function resolveCustomIMAccount(
126
126
 
127
127
  function listCustomIMAccountIds(cfg: Record<string, unknown>): string[] {
128
128
  const channels = cfg.channels as Record<string, Record<string, unknown>> | undefined;
129
- const customImChannel = channels?.["custom-im"] as Record<string, unknown> | undefined;
129
+ const customImChannel = channels?.["5g-message"] as Record<string, unknown> | undefined;
130
130
  const accounts = customImChannel?.accounts as Record<string, Record<string, unknown>> | undefined;
131
131
  return accounts ? Object.keys(accounts) : [];
132
132
  }
@@ -441,7 +441,7 @@ async function dispatchCustomIMMessage(params: {
441
441
  try {
442
442
  route = core.channel.routing.resolveAgentRoute({
443
443
  cfg,
444
- channel: "custom-im",
444
+ channel: "5g-message",
445
445
  accountId: account.accountId,
446
446
  peer: {
447
447
  kind: isGroup ? "group" : "direct",
@@ -455,7 +455,7 @@ async function dispatchCustomIMMessage(params: {
455
455
  }
456
456
 
457
457
  // Build the message context
458
- const customImFrom = `custom-im:${msg.sender}`;
458
+ const customImFrom = `5g-message:${msg.sender}`;
459
459
  const customImTo = isGroup ? `chat:${chatId}` : `user:${msg.sender}`;
460
460
 
461
461
  // Format message envelope
@@ -481,13 +481,13 @@ async function dispatchCustomIMMessage(params: {
481
481
  GroupSubject: isGroup ? chatId : undefined,
482
482
  SenderName: msg.sender,
483
483
  SenderId: msg.sender,
484
- Provider: "custom-im" as const,
485
- Surface: "custom-im" as const,
484
+ Provider: "5g-message" as const,
485
+ Surface: "5g-message" as const,
486
486
  MessageSid: msg.messageId,
487
487
  Timestamp: msg.timestamp,
488
488
  WasMentioned: false,
489
489
  CommandAuthorized: true,
490
- OriginatingChannel: "custom-im" as const,
490
+ OriginatingChannel: "5g-message" as const,
491
491
  OriginatingTo: customImTo,
492
492
  });
493
493
 
@@ -579,16 +579,16 @@ async function dispatchCustomIMMessage(params: {
579
579
  // Channel Plugin Definition
580
580
  // ============================================================================
581
581
 
582
- export const customIMPlugin: ChannelPlugin<CustomIMAccount> = {
583
- id: "custom-im",
582
+ export const fontdo5GMessagePlugin: ChannelPlugin<CustomIMAccount> = {
583
+ id: "5g-message",
584
584
 
585
585
  meta: {
586
- id: "custom-im",
587
- label: "Custom IM",
588
- selectionLabel: "Custom IM (WebSocket)",
589
- docsPath: "/channels/custom-im",
590
- blurb: "Custom IM platform integration via WebSocket JSON-RPC 2.0",
591
- aliases: ["cim", "custom"],
586
+ id: "5g-message",
587
+ label: "Fontdo 5G Message",
588
+ selectionLabel: "Fontdo 5G Message (WebSocket)",
589
+ docsPath: "/channels/5g-message",
590
+ blurb: "Fontdo 5G 消息平台集成,通过 WebSocket JSON-RPC 2.0 协议",
591
+ aliases: ["fontdo", "5g", "5g-message"],
592
592
  },
593
593
 
594
594
  capabilities: {
@@ -601,7 +601,7 @@ export const customIMPlugin: ChannelPlugin<CustomIMAccount> = {
601
601
  reply: true,
602
602
  },
603
603
 
604
- reload: { configPrefixes: ["channels.custom-im"] },
604
+ reload: { configPrefixes: ["channels.5g-message"] },
605
605
 
606
606
  configSchema: {
607
607
  schema: {
@@ -664,20 +664,20 @@ export const customIMPlugin: ChannelPlugin<CustomIMAccount> = {
664
664
  ...cfg,
665
665
  channels: {
666
666
  ...cfg.channels,
667
- "custom-im": {
668
- ...cfg.channels?.["custom-im"],
667
+ "5g-message": {
668
+ ...cfg.channels?.["5g-message"],
669
669
  enabled: true,
670
670
  },
671
671
  },
672
672
  };
673
673
  }
674
674
 
675
- const customImCfg = cfg.channels?.["custom-im"] as Record<string, unknown> | undefined;
675
+ const customImCfg = cfg.channels?.["5g-message"] as Record<string, unknown> | undefined;
676
676
  return {
677
677
  ...cfg,
678
678
  channels: {
679
679
  ...cfg.channels,
680
- "custom-im": {
680
+ "5g-message": {
681
681
  ...customImCfg,
682
682
  accounts: {
683
683
  ...(customImCfg?.accounts as Record<string, unknown>),
@@ -718,7 +718,7 @@ export const customIMPlugin: ChannelPlugin<CustomIMAccount> = {
718
718
  throw new Error(`Custom IM account ${ctx.accountId} not configured`);
719
719
  }
720
720
 
721
- ctx.log?.info(`starting custom-im[${ctx.accountId}]`);
721
+ ctx.log?.info(`starting 5g-message[${ctx.accountId}]`);
722
722
 
723
723
  // Set initial status
724
724
  ctx.setStatus({ accountId: ctx.accountId, connected: false });
@@ -779,7 +779,7 @@ export const customIMPlugin: ChannelPlugin<CustomIMAccount> = {
779
779
  // Wait for either abort signal or connection close
780
780
  return new Promise<{ stop: () => void }>((resolve) => {
781
781
  const stopHandler = () => {
782
- ctx.log?.info(`stopping custom-im[${ctx.accountId}]`);
782
+ ctx.log?.info(`stopping 5g-message[${ctx.accountId}]`);
783
783
  ctx.setStatus({ accountId: ctx.accountId, connected: false });
784
784
  unregisterConnection(ctx.accountId);
785
785
  client.disconnect();
@@ -857,15 +857,15 @@ export const customIMPlugin: ChannelPlugin<CustomIMAccount> = {
857
857
  // ============================================================================
858
858
 
859
859
  const plugin = {
860
- id: "custom-im",
861
- name: "Custom IM",
862
- description: "Custom IM platform integration via WebSocket JSON-RPC 2.0",
860
+ id: "5g-message",
861
+ name: "Fontdo 5G Message",
862
+ description: "Fontdo 5G 消息平台集成,通过 WebSocket JSON-RPC 2.0 协议",
863
863
  configSchema: emptyPluginConfigSchema(),
864
864
 
865
865
  register(api: OpenClawPluginApi) {
866
866
  // Store the runtime for use in message dispatching
867
867
  pluginRuntime = api.runtime;
868
- api.registerChannel({ plugin: customIMPlugin });
868
+ api.registerChannel({ plugin: fontdo5GMessagePlugin });
869
869
  },
870
870
  };
871
871
 
@@ -1,6 +1,6 @@
1
1
  {
2
- "id": "fontdo-5g-message",
3
- "channels": ["fontdo-5g-message"],
2
+ "id": "5g-message",
3
+ "channels": ["5g-message"],
4
4
  "configSchema": {
5
5
  "type": "object",
6
6
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fontdo/5g-message",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "OpenClaw 通道插件,用于连接 Fontdo 5G 消息平台",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -21,11 +21,11 @@
21
21
  "./index.ts"
22
22
  ],
23
23
  "channel": {
24
- "id": "fontdo-5g-message",
24
+ "id": "5g-message",
25
25
  "label": "Fontdo 5G Message",
26
26
  "selectionLabel": "Fontdo 5G Message (WebSocket)",
27
- "docsPath": "/channels/fontdo-5g-message",
28
- "docsLabel": "fontdo-5g-message",
27
+ "docsPath": "/channels/5g-message",
28
+ "docsLabel": "5g-message",
29
29
  "blurb": "Fontdo 5G 消息平台集成,通过 WebSocket JSON-RPC 2.0 协议",
30
30
  "order": 100,
31
31
  "aliases": [