@aight-cool/aight-utils 0.1.6 → 0.1.7

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.
@@ -2,7 +2,7 @@
2
2
  "id": "aight-utils",
3
3
  "name": "Aight App Utils",
4
4
  "description": "Aight App: Push notifications, Today items, config RPC, and agent bootstrap",
5
- "version": "0.1.6",
5
+ "version": "0.1.7",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aight-cool/aight-utils",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "OpenClaw gateway plugin for Aight App: push notifications, Today items, config RPC, and agent bootstrap",
5
5
  "type": "module",
6
6
  "files": [
package/src/push-hook.ts CHANGED
@@ -62,31 +62,31 @@ export function registerPushHook(api: OpenClawPluginApi) {
62
62
  const agent = agents.find((a: any) => a.id === agentId);
63
63
  const displayName = agent?.name ?? agent?.identity?.name ?? agentId;
64
64
 
65
- // Resolve group chat name for push title
65
+ // Resolve group chat name for push subtitle (WhatsApp-style layout)
66
66
  let pushTitle = displayName;
67
+ let pushSubtitle: string | undefined;
67
68
  const sessionKey = ctx.sessionKey ?? "";
68
69
  if (sessionKey.includes(":group-chat:")) {
69
70
  const groupId = sessionKey.split(":group-chat:")[1];
70
71
  if (groupId) {
71
- // Look up friendly name from plugin data store
72
72
  const groupName = loadGroupName(api, groupId);
73
- api.logger.info(
74
- `[aight-utils] Group push title: groupId=${groupId} groupName=${groupName ?? "(not found)"} pushTitle=${groupName ? `${displayName} — ${groupName}` : displayName}`,
75
- );
76
- pushTitle = groupName
77
- ? `${displayName} — ${groupName}`
78
- : displayName;
73
+ if (groupName) {
74
+ pushSubtitle = groupName;
75
+ }
79
76
  }
80
77
  }
81
78
 
79
+ const cleanBody = preview.trim().replace(/\n+/g, " ").trim();
80
+
82
81
  for (const device of tokens) {
83
82
  if (!device.sendKey) continue;
84
83
  try {
85
84
  await sendPush(
86
85
  device.deviceId,
87
86
  {
88
- title: pushTitle,
89
- body: preview,
87
+ title: pushTitle.trim(),
88
+ subtitle: pushSubtitle,
89
+ body: cleanBody,
90
90
  data: { sessionKey: ctx.sessionKey, agentId },
91
91
  },
92
92
  freshConfig,
package/src/push.ts CHANGED
@@ -87,6 +87,7 @@ async function obtainSendKey(relayUrl: string, pushToken: string): Promise<strin
87
87
 
88
88
  export interface PushPayload {
89
89
  title?: string;
90
+ subtitle?: string;
90
91
  body?: string;
91
92
  data?: Record<string, unknown>;
92
93
  silent?: boolean;
@@ -118,6 +119,7 @@ export async function sendPush(
118
119
 
119
120
  if (mode === "rich" && !payload.silent) {
120
121
  pushBody.title = payload.title;
122
+ if (payload.subtitle) pushBody.subtitle = payload.subtitle;
121
123
  pushBody.body = payload.body;
122
124
  }
123
125