@occum-net/occumclaw 0.4.0 → 0.4.1

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/index.ts CHANGED
@@ -154,9 +154,9 @@ interface OpenClawPluginApi {
154
154
  // 4. Wildcard tool policy (groups.*.tools)
155
155
  // 5. undefined → fall back to global (tools.allow / tools.profile)
156
156
  //
157
- // Config path:
157
+ // Config path (either works; plugin-style avoids config validation issues):
158
158
  // channels.occum.accounts.<accountId>.groups.<channelId>.tools
159
- // channels.occum.accounts.<accountId>.groups.<channelId>.toolsBySender
159
+ // plugins.entries.occumclaw.config.groups.<channelId>.tools
160
160
  //
161
161
  // Per-sender key format:
162
162
  // "id:<senderId>" — match by user/agent ID
@@ -263,15 +263,20 @@ function resolveToolsBySender(
263
263
  /**
264
264
  * Resolve the effective tool policy for an inbound occum.net message.
265
265
  *
266
- * Looks up config at: channels.occum.accounts.<accountId>.groups.<groupId>
267
- * with fallback to wildcard "*" group, then per-sender overrides.
266
+ * Looks up groups config from (in order):
267
+ * 1. channels.occum.accounts.<accountId>.groups (channel-style, if OpenClaw validates it)
268
+ * 2. plugins.entries.occumclaw.config.groups (plugin-style, always safe)
269
+ *
270
+ * Then resolves per-channel and per-sender overrides with wildcard fallback.
268
271
  */
269
272
  function resolveOccumToolPolicy(params: ChannelGroupContext): GroupToolPolicyConfig | undefined {
270
273
  const { cfg, groupId, accountId, senderId, senderName, senderUsername, senderE164 } = params;
271
274
 
275
+ // Try channel-style config first, then fall back to plugin config
272
276
  const acctId = accountId ?? "default";
273
277
  const groups: Record<string, OccumGroupConfig> | undefined =
274
- cfg?.channels?.occum?.accounts?.[acctId]?.groups;
278
+ cfg?.channels?.occum?.accounts?.[acctId]?.groups
279
+ ?? cfg?.plugins?.entries?.occumclaw?.config?.groups;
275
280
 
276
281
  if (!groups || typeof groups !== "object") return undefined;
277
282
 
@@ -9,7 +9,39 @@
9
9
  "additionalProperties": false,
10
10
  "properties": {
11
11
  "agentToken": { "type": "string" },
12
- "apiUrl": { "type": "string", "default": "https://api.occum.net" }
12
+ "apiUrl": { "type": "string", "default": "https://api.occum.net" },
13
+ "groups": {
14
+ "type": "object",
15
+ "description": "Per-channel and per-sender tool policy overrides. Keys are channel IDs or \"*\" for wildcard.",
16
+ "additionalProperties": {
17
+ "type": "object",
18
+ "properties": {
19
+ "tools": {
20
+ "type": "object",
21
+ "properties": {
22
+ "allow": { "type": "array", "items": { "type": "string" } },
23
+ "alsoAllow": { "type": "array", "items": { "type": "string" } },
24
+ "deny": { "type": "array", "items": { "type": "string" } }
25
+ },
26
+ "additionalProperties": false
27
+ },
28
+ "toolsBySender": {
29
+ "type": "object",
30
+ "description": "Per-sender overrides keyed by id:<val>, username:<val>, name:<val>, or *",
31
+ "additionalProperties": {
32
+ "type": "object",
33
+ "properties": {
34
+ "allow": { "type": "array", "items": { "type": "string" } },
35
+ "alsoAllow": { "type": "array", "items": { "type": "string" } },
36
+ "deny": { "type": "array", "items": { "type": "string" } }
37
+ },
38
+ "additionalProperties": false
39
+ }
40
+ }
41
+ },
42
+ "additionalProperties": false
43
+ }
44
+ }
13
45
  },
14
46
  "required": []
15
47
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occum-net/occumclaw",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },