@aight-cool/aight-utils 0.1.10 → 0.1.12

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.10",
5
+ "version": "0.1.12",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
@@ -13,10 +13,7 @@
13
13
  "properties": {
14
14
  "mode": {
15
15
  "type": "string",
16
- "enum": [
17
- "private",
18
- "rich"
19
- ],
16
+ "enum": ["private", "rich"],
20
17
  "default": "rich"
21
18
  },
22
19
  "relayUrl": {
@@ -34,19 +31,13 @@
34
31
  },
35
32
  "platform": {
36
33
  "type": "string",
37
- "enum": [
38
- "ios",
39
- "android"
40
- ]
34
+ "enum": ["ios", "android"]
41
35
  },
42
36
  "registeredAt": {
43
37
  "type": "string"
44
38
  }
45
39
  },
46
- "required": [
47
- "token",
48
- "platform"
49
- ]
40
+ "required": ["token", "platform"]
50
41
  }
51
42
  },
52
43
  "relaySecret": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aight-cool/aight-utils",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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/bootstrap.ts CHANGED
@@ -3,12 +3,36 @@
3
3
  */
4
4
 
5
5
  import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
6
- import * as path from "node:path";
7
- import { fileURLToPath } from "node:url";
8
6
 
9
7
  const AIGHT_MD = `# Aight Integration
10
8
 
11
- You have the \`aight_item\` tool for managing structured items in the Aight Today view.
9
+ Aight is the iOS app the user is chatting through. It connects to the OpenClaw gateway running on their machine, giving them a native mobile interface for their AI agent.
10
+
11
+ ## What You Can Do (via Aight)
12
+
13
+ When the user asks "What can you do?" — here's what to highlight:
14
+
15
+ - **Chat naturally** — Ask anything, get help with tasks, brainstorm ideas
16
+ - **Set reminders & track tasks** — "Remind me to call the dentist tomorrow at 2pm" → creates a reminder in the Today view
17
+ - **Voice mode** — Tap the mic to talk instead of type; you respond with voice too
18
+ - **Manage calendar & email** — Check schedule, draft emails, summarize inbox
19
+ - **Search the web** — Real-time web search, fetch pages, summarize articles
20
+ - **Run shortcuts** — Quick-access saved prompts for things you do often
21
+ - **Browse the Skills marketplace** — 700+ skills to extend capabilities (weather, GitHub, music, finance, etc.)
22
+ - **Create custom agents** — Spin up specialized AI personas for different tasks
23
+ - **Today view** — A personal dashboard with reminders, tasks, deadlines, and background processes
24
+ - **Sub-agents** — Delegate complex tasks to background workers that report back when done
25
+ - **Group chats** — Multi-agent conversations where your agents collaborate
26
+ - **Security built-in** — All data stays on your machine; nothing phones home
27
+
28
+ Keep the response conversational and concise — don't dump the whole list. Pick 4-5 highlights that feel most relevant, and mention there's more to explore in Skills and Settings.
29
+
30
+ ## Audio / Voice (Aight App)
31
+
32
+ The Aight app handles all speech-to-text and text-to-speech on the client side.
33
+ - **Inbound:** The app converts the user's voice to text before sending it to the gateway. You always receive text.
34
+ - **Outbound:** Always respond with plain text only. If the user has voice mode enabled, the app will convert your text response to speech automatically.
35
+ - **Never use the TTS tool or send audio files** when the channel is an Aight app client. The app cannot stream audio from the gateway and it will cause playback issues.
12
36
 
13
37
  ## When to Use \`aight_item\` (Aight App)
14
38
 
@@ -132,15 +156,16 @@ Rules:
132
156
 
133
157
  export function registerBootstrap(api: OpenClawPluginApi) {
134
158
  try {
135
- // eslint-disable-next-line @typescript-eslint/no-require-imports
136
- const sdk = require("openclaw/plugin-sdk");
137
- if (sdk?.registerPluginHooksFromDir) {
138
- const pluginDir = path.dirname(fileURLToPath(import.meta.url));
139
- const hooksDir = path.join(pluginDir, "..", "hooks");
140
- sdk.registerPluginHooksFromDir(api, hooksDir);
141
- }
142
- } catch {
143
- api.logger.info("[aight-utils] Could not register hooks dir, using inline approach");
159
+ api.logger.info("[aight-utils] Attempting to register bootstrap hook...");
160
+ api.logger.info(`[aight-utils] api.on type: ${typeof api.on}`);
161
+ api.on("before_agent_start", (_event: unknown, ctx: { sessionKey?: string }) => {
162
+ // Inject AIGHT.md context into every agent session
163
+ api.logger.info(`[aight-utils] Bootstrap: injecting AIGHT.md into session ${ctx?.sessionKey}`);
164
+ return { systemPrompt: AIGHT_MD };
165
+ });
166
+ api.logger.info("[aight-utils] Bootstrap hook registered (before_agent_start)");
167
+ } catch (err) {
168
+ api.logger.error(`[aight-utils] Failed to register bootstrap hook: ${err}`);
144
169
  }
145
170
  }
146
171
 
package/src/push-hook.ts CHANGED
@@ -16,6 +16,26 @@ export function registerPushHook(api: OpenClawPluginApi) {
16
16
  const tokens = loadTokens();
17
17
  if (tokens.length === 0) return;
18
18
 
19
+ // Skip hidden/internal sessions — no push notifications for config,
20
+ // security, voice, sub-agent, or other background sessions.
21
+ const sk = ctx.sessionKey ?? "";
22
+ if (
23
+ sk.endsWith(":aight-config") ||
24
+ sk.endsWith(":aight-pentest") ||
25
+ sk.endsWith(":speak") ||
26
+ sk.endsWith(":structured_content") ||
27
+ sk.endsWith(":main") ||
28
+ sk.includes("subagent") ||
29
+ sk.includes("security-audit") ||
30
+ sk.includes("_skill-audit-") ||
31
+ sk.includes("_ensure-skill-defender") ||
32
+ sk.endsWith("security-fix") ||
33
+ sk.endsWith("skill-scan")
34
+ ) {
35
+ api.logger.info(`[aight-utils] Skipping hidden session push: ${sk}`);
36
+ return;
37
+ }
38
+
19
39
  const msgs = event.messages ?? [];
20
40
  api.logger.info(
21
41
  `[aight-utils] messages count=${msgs.length} roles=${msgs.map((m: any) => m.role).join(",")}`,
@@ -47,6 +67,14 @@ export function registerPushHook(api: OpenClawPluginApi) {
47
67
  return;
48
68
  }
49
69
 
70
+ // Skip hidden/internal sessions (aight-config, structured_content, etc.)
71
+ const sessionKey_ = ctx.sessionKey ?? "";
72
+ const HIDDEN_SESSIONS = ["aight-config", "structured_content"];
73
+ if (HIDDEN_SESSIONS.some((h) => sessionKey_.includes(h))) {
74
+ api.logger.info(`[aight-utils] Skipping hidden session: ${sessionKey_}`);
75
+ return;
76
+ }
77
+
50
78
  // Skip internal/meta responses
51
79
  const skip = ["NO_REPLY", "REPLY_SKIP", "ANNOUNCE_SKIP", "HEARTBEAT_OK"];
52
80
  if (skip.includes(preview.trim())) {