@aight-cool/aight-utils 0.1.11 → 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.11",
5
+ "version": "0.1.12",
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.11",
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,8 +3,6 @@
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
 
@@ -29,6 +27,13 @@ When the user asks "What can you do?" — here's what to highlight:
29
27
 
30
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.
31
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.
36
+
32
37
  ## When to Use \`aight_item\` (Aight App)
33
38
 
34
39
  - User asks to **set a reminder**: create a trigger with \`scheduledFor\` (ISO 8601)
@@ -151,15 +156,16 @@ Rules:
151
156
 
152
157
  export function registerBootstrap(api: OpenClawPluginApi) {
153
158
  try {
154
- // eslint-disable-next-line @typescript-eslint/no-require-imports
155
- const sdk = require("openclaw/plugin-sdk");
156
- if (sdk?.registerPluginHooksFromDir) {
157
- const pluginDir = path.dirname(fileURLToPath(import.meta.url));
158
- const hooksDir = path.join(pluginDir, "..", "hooks");
159
- sdk.registerPluginHooksFromDir(api, hooksDir);
160
- }
161
- } catch {
162
- 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}`);
163
169
  }
164
170
  }
165
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())) {