clawaxis 1.0.1 → 1.0.4

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.
@@ -10,11 +10,13 @@
10
10
  "properties": {
11
11
  "relayUrl": {
12
12
  "type": "string",
13
- "description": "ClawAxis WebSocket relay endpoint URL"
13
+ "description": "ClawAxis WebSocket relay endpoint URL",
14
+ "default": "https://fqwpwypyzcbmdeajlkzt.supabase.co/functions/v1/ws-relay"
14
15
  },
15
16
  "agentToken": {
16
17
  "type": "string",
17
- "description": "Agent authentication token (oc_tk_...)"
18
+ "description": "Agent authentication token (oc_tk_...)",
19
+ "default": "oc_tk_placeholder_replace_me"
18
20
  },
19
21
  "mediaDomain": {
20
22
  "type": "string",
@@ -75,7 +77,7 @@
75
77
  }
76
78
  }
77
79
  },
78
- "required": ["relayUrl", "agentToken"]
80
+ "required": []
79
81
  },
80
82
  "uiHints": {
81
83
  "relayUrl": { "label": "Relay URL", "placeholder": "https://your-relay.supabase.co/functions/v1/ws-relay" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawaxis",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "files": [
package/src/channel.ts CHANGED
@@ -49,7 +49,7 @@ export const clawaxisChannel = {
49
49
  const accountId = ctx.account?.accountId || "default";
50
50
  console.log(`${LOG_PREFIX} gateway.startAccount called for account: ${accountId}`);
51
51
 
52
- const accountConfig = ctx.account?.config || ctx.config;
52
+ const accountConfig = ctx.account?.config || ctx.account || ctx.config;
53
53
  const config = loadConfig(accountConfig);
54
54
 
55
55
  if (!config) {
package/src/config.ts CHANGED
@@ -44,11 +44,13 @@ export const DEFAULT_GOVERNANCE: GovernanceConfig = {
44
44
  /**
45
45
  * Load and merge config from OpenClaw's config hierarchy.
46
46
  *
47
- * Supports three paths:
47
+ * Supports multiple config shapes:
48
48
  * 1. Pre-scoped config (from gateway.startAccount ctx.account.config) —
49
49
  * already has relayUrl/agentToken at top level
50
- * 2. channels.clawaxis primary location in openclaw.json
51
- * 3. plugins.entries.clawaxis-plugin.config backward compat
50
+ * 2. channels.clawaxis.relayUrl (flat structure)
51
+ * 3. channels.clawaxis.accounts.default.relayUrl (accounts structure)
52
+ * 4. plugins.entries.clawaxis-plugin.config — backward compat
53
+ * 5. plugins.entries.clawaxis.config — npm package name
52
54
  */
53
55
  export function loadConfig(apiConfig: any): ClawAxisConfig | null {
54
56
  let cfg: any;
@@ -56,8 +58,16 @@ export function loadConfig(apiConfig: any): ClawAxisConfig | null {
56
58
  if (apiConfig?.relayUrl && apiConfig?.agentToken) {
57
59
  cfg = apiConfig;
58
60
  } else {
59
- cfg = apiConfig?.channels?.clawaxis
60
- ?? apiConfig?.plugins?.entries?.["clawaxis-plugin"]?.config;
61
+ const channelConfig = apiConfig?.channels?.clawaxis;
62
+
63
+ if (channelConfig?.relayUrl && channelConfig?.agentToken) {
64
+ cfg = channelConfig;
65
+ } else if (channelConfig?.accounts?.default) {
66
+ cfg = channelConfig.accounts.default;
67
+ } else {
68
+ cfg = apiConfig?.plugins?.entries?.["clawaxis-plugin"]?.config
69
+ ?? apiConfig?.plugins?.entries?.["clawaxis"]?.config;
70
+ }
61
71
  }
62
72
 
63
73
  if (!cfg) return null;
@@ -31,8 +31,18 @@ export async function processPendingDocs(docs: any[]): Promise<void> {
31
31
  }
32
32
 
33
33
  const isUpdate = (doc.version && doc.version > 1) || !!doc.agent_skill_path;
34
- const { dir, filePath } = doc.agent_skill_path
35
- ? { dir: path.dirname(doc.agent_skill_path), filePath: doc.agent_skill_path }
34
+
35
+ let resolvedSkillPath = doc.agent_skill_path;
36
+ if (resolvedSkillPath && !fs.existsSync(path.dirname(resolvedSkillPath))) {
37
+ const runtime = getRuntime();
38
+ const workspaceDir = runtime?.config?.workspace?.dir
39
+ || path.join(homedir(), ".openclaw", "workspace");
40
+ const relative = resolvedSkillPath.replace(/^.*?\.openclaw\/workspace\//, "");
41
+ resolvedSkillPath = path.join(workspaceDir, relative);
42
+ }
43
+
44
+ const { dir, filePath } = resolvedSkillPath
45
+ ? { dir: path.dirname(resolvedSkillPath), filePath: resolvedSkillPath }
36
46
  : resolveDocPath(doc);
37
47
 
38
48
  fs.mkdirSync(dir, { recursive: true });
@@ -102,16 +112,25 @@ export async function processPendingDocs(docs: any[]): Promise<void> {
102
112
 
103
113
  export async function processDocDeletion(doc: { id: string; name: string; agent_skill_path?: string }): Promise<void> {
104
114
  try {
105
- if (doc.agent_skill_path) {
115
+ let deletePath = doc.agent_skill_path;
116
+ if (deletePath && !fs.existsSync(deletePath)) {
117
+ const runtime = getRuntime();
118
+ const workspaceDir = runtime?.config?.workspace?.dir
119
+ || path.join(homedir(), ".openclaw", "workspace");
120
+ const relative = deletePath.replace(/^.*?\.openclaw\/workspace\//, "");
121
+ deletePath = path.join(workspaceDir, relative);
122
+ }
123
+
124
+ if (deletePath) {
106
125
  try {
107
- fs.unlinkSync(doc.agent_skill_path);
108
- console.log(`${LOG_PREFIX} \u2713 Deleted document file: ${doc.agent_skill_path}`);
126
+ fs.unlinkSync(deletePath);
127
+ console.log(`${LOG_PREFIX} \u2713 Deleted document file: ${deletePath}`);
109
128
  } catch (fsErr: any) {
110
- console.warn(`${LOG_PREFIX} Could not delete file ${doc.agent_skill_path}:`, fsErr.message);
129
+ console.warn(`${LOG_PREFIX} Could not delete file ${deletePath}:`, fsErr.message);
111
130
  }
112
131
  }
113
132
 
114
- const messageContent = `[DOC_DELETED] The user deleted document "${doc.name}"${doc.agent_skill_path ? ` (was at: ${doc.agent_skill_path})` : ""}. The file has been removed from your workspace. Memory search will no longer return results from this document.`;
133
+ const messageContent = `[DOC_DELETED] The user deleted document "${doc.name}"${deletePath ? ` (was at: ${deletePath})` : ""}. The file has been removed from your workspace. Memory search will no longer return results from this document.`;
115
134
  await dispatchSystemMessage(messageContent, `doc-delete-${doc.id}`, `doc-delete-${doc.id}`);
116
135
 
117
136
  await relayLog(