@2en/clawly-plugins 1.21.2 → 1.21.3

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/cron-hook.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * before_tool_call hook for cron (action=add) — ensures delivery fields are
3
3
  * always set correctly, even when the LLM omits them.
4
4
  *
5
- * Forces: delivery.mode = "none" (agent uses clawly_send_message/push tools)
5
+ * Forces: delivery.mode = "none" (agent uses clawly_send_message tool)
6
6
  * Appends: delivery instructions to payload.message
7
7
  * Patches: payload.kind "systemEvent" → "agentTurn"
8
8
  *
@@ -25,8 +25,6 @@ const DELIVERY_SUFFIX = [
25
25
  'DELIVERY INSTRUCTIONS (mandatory):',
26
26
  'When done, you MUST deliver your result to the user:',
27
27
  '1. Call the clawly_send_message tool with role="assistant" and a brief, natural summary of your result.',
28
- '2. Call clawly_is_user_online to check if the user is online.',
29
- '3. If offline, also call clawly_send_app_push with a short notification.',
30
28
  ].join('\n')
31
29
 
32
30
  function patchJob(job: UnknownRecord): UnknownRecord {
package/index.ts CHANGED
@@ -36,6 +36,7 @@ import {registerEmail} from './email'
36
36
  import {registerGateway} from './gateway'
37
37
  import {getGatewayConfig} from './gateway-fetch'
38
38
  import {setupModelGateway} from './model-gateway-setup'
39
+ import {setupSession} from './session-setup'
39
40
  import {registerOutboundHook, registerOutboundHttpRoute, registerOutboundMethods} from './outbound'
40
41
  import {registerSkillCommandRestore} from './skill-command-restore'
41
42
  import {registerTools} from './tools'
@@ -120,6 +121,7 @@ export default {
120
121
  registerGateway(api)
121
122
  registerAutoPair(api)
122
123
  setupModelGateway(api)
124
+ setupSession(api)
123
125
 
124
126
  // Email & calendar (optional — requires skillGatewayBaseUrl + skillGatewayToken in config)
125
127
  const gw = getGatewayConfig(api)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2en/clawly-plugins",
3
- "version": "1.21.2",
3
+ "version": "1.21.3",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "repository": {
@@ -24,6 +24,7 @@
24
24
  "gateway-fetch.ts",
25
25
  "outbound.ts",
26
26
  "model-gateway-setup.ts",
27
+ "session-setup.ts",
27
28
  "skill-command-restore.ts",
28
29
  "openclaw.plugin.json"
29
30
  ],
@@ -0,0 +1,42 @@
1
+ /**
2
+ * On plugin init, patches openclaw.json to set `session.dmScope` to
3
+ * "per-channel-peer". This isolates Telegram (and other channel) DMs from the
4
+ * Clawly mobile session so messages don't leak across channels.
5
+ *
6
+ * Runs synchronously during plugin registration, same pattern as
7
+ * model-gateway-setup.ts.
8
+ */
9
+
10
+ import path from 'node:path'
11
+
12
+ import type {PluginApi} from './index'
13
+ import {readOpenclawConfig, resolveStateDir, writeOpenclawConfig} from './model-gateway-setup'
14
+
15
+ const DESIRED_DM_SCOPE = 'per-channel-peer'
16
+
17
+ export function setupSession(api: PluginApi): void {
18
+ const stateDir = resolveStateDir(api)
19
+ if (!stateDir) {
20
+ api.logger.warn('Cannot resolve state dir — session setup skipped.')
21
+ return
22
+ }
23
+
24
+ const configPath = path.join(stateDir, 'openclaw.json')
25
+ const config = readOpenclawConfig(configPath)
26
+
27
+ const session = ((config.session as Record<string, unknown>) ?? {}) as Record<string, unknown>
28
+
29
+ if (session.dmScope === DESIRED_DM_SCOPE) {
30
+ return
31
+ }
32
+
33
+ session.dmScope = DESIRED_DM_SCOPE
34
+ config.session = session
35
+
36
+ try {
37
+ writeOpenclawConfig(configPath, config)
38
+ api.logger.info(`Session: set dmScope to "${DESIRED_DM_SCOPE}".`)
39
+ } catch (err) {
40
+ api.logger.error(`Failed to update session config: ${(err as Error).message}`)
41
+ }
42
+ }