@aight-cool/aight-utils 0.1.6 → 0.1.8

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @aight-cool/aight-utils
2
2
 
3
- Open-source [OpenClaw](https://openclaw.ai) gateway plugin for the [Aight](https://aight.app) app.
3
+ Open-source [OpenClaw](https://openclaw.ai) gateway plugin for the [Aight](https://aight.cool) app.
4
4
 
5
- This is the code that runs on **your** gateway when you use Aight. Every line is auditable.
5
+ This is the code that runs on **your** gateway when you use Aight.
6
6
 
7
7
  ## Architecture
8
8
 
@@ -147,7 +147,6 @@ Agent completes turn
147
147
  ### Notification modes
148
148
 
149
149
  - 🔔 **Rich** (default) — visible push with sender name and message preview
150
- - 🔒 **Private** — silent push, content-free. App wakes and fetches from gateway. Relay sees nothing but "wake device X."
151
150
 
152
151
  ### Foreground suppression
153
152
 
@@ -222,8 +221,6 @@ Aight itself is not open source, but the code that runs on **your gateway** is.
222
221
  - Audit what data flows through the push relay
223
222
  - Fork and customize if you want
224
223
 
225
- The closed-source parts of Aight are purely UI — they consume this plugin's RPC API.
226
-
227
224
  ## Development
228
225
 
229
226
  ```bash
@@ -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.8",
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.8",
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/groups.ts CHANGED
@@ -11,7 +11,9 @@ import { join } from "path";
11
11
  const FILENAME = "group-names.json";
12
12
 
13
13
  function filePath(api: OpenClawPluginApi): string {
14
- const dir = (api as any).dataDir ?? join(process.env.HOME ?? "/tmp", ".openclaw", "plugin-data", "aight-utils");
14
+ const dir =
15
+ (api as any).dataDir ??
16
+ join(process.env.HOME ?? "/tmp", ".openclaw", "plugin-data", "aight-utils");
15
17
  mkdirSync(dir, { recursive: true });
16
18
  return join(dir, FILENAME);
17
19
  }
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
66
- let pushTitle = displayName;
65
+ // Resolve group chat name for push subtitle (WhatsApp-style layout)
66
+ const 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