grix-connector 4.2.3 → 4.2.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.
Files changed (40) hide show
  1. package/dist/adapter/claude/claude-adapter.js +18 -17
  2. package/dist/adapter/claude/claude-bridge-server.js +1 -1
  3. package/dist/adapter/claude/claude-tools.js +1 -1
  4. package/dist/adapter/claude/claude-worker-client.js +1 -1
  5. package/dist/adapter/claude/mcp-http-launcher.js +2 -2
  6. package/dist/adapter/claude/result-timeout.js +1 -1
  7. package/dist/assets/dsh-bridge/{grix-dsh-bridge-4.2.3.tgz → grix-dsh-bridge-4.2.4.tgz} +0 -0
  8. package/dist/assets/dsh-bridge/manifest.json +4 -4
  9. package/dist/core/access/allowlist-store.js +1 -1
  10. package/dist/core/file-ops/list-files.js +1 -1
  11. package/dist/default-skills/grix-access-control/SKILL.md +1 -1
  12. package/dist/default-skills/grix-admin/SKILL.md +110 -155
  13. package/dist/default-skills/grix-admin/references/api-contract.md +23 -12
  14. package/dist/default-skills/grix-agent-dispatch/SKILL.md +152 -188
  15. package/dist/default-skills/grix-audit-data/SKILL.md +1 -1
  16. package/dist/default-skills/grix-chat-state/SKILL.md +26 -43
  17. package/dist/default-skills/grix-egg/SKILL.md +1 -1
  18. package/dist/default-skills/grix-group/SKILL.md +1 -1
  19. package/dist/default-skills/grix-owner-relay/SKILL.md +30 -64
  20. package/dist/default-skills/grix-query/SKILL.md +1 -1
  21. package/dist/default-skills/grix-skill-library/SKILL.md +52 -0
  22. package/dist/default-skills/grix-widget-visitor-ban/SKILL.md +1 -1
  23. package/dist/default-skills/message-send/SKILL.md +1 -1
  24. package/dist/default-skills/message-unsend/SKILL.md +1 -1
  25. package/dist/default-skills/tailnet-file-share/SKILL.md +38 -72
  26. package/dist/default-skills/tailnet-file-share/references/certificate-trust.md +64 -0
  27. package/dist/log.js +2 -2
  28. package/dist/mcp/stream-http/config.js +1 -1
  29. package/dist/mcp/stream-http/connection-binding.js +1 -1
  30. package/dist/mcp/stream-http/security.js +1 -1
  31. package/dist/mcp/stream-http/tool-executor.js +1 -1
  32. package/dist/mcp/stream-http/tool-registry.js +1 -1
  33. package/dist/mcp/stream-http/tool-schemas.js +1 -1
  34. package/openclaw-plugin/skills/grix-admin/SKILL.md +122 -156
  35. package/openclaw-plugin/skills/grix-group/SKILL.md +52 -159
  36. package/openclaw-plugin/skills/grix-query/SKILL.md +54 -248
  37. package/openclaw-plugin/skills/grix-update/SKILL.md +70 -304
  38. package/openclaw-plugin/skills/message-send/SKILL.md +41 -172
  39. package/openclaw-plugin/skills/message-unsend/SKILL.md +29 -170
  40. package/package.json +1 -1
@@ -1,310 +1,76 @@
1
1
  ---
2
2
  name: grix-update
3
- description: Handles subsequent version maintenance of the Grix plugin. Applicable for checking new versions, performing plugin upgrades, completing post-upgrade validation and restart, and silently or notifying the main agent according to rules; not responsible for initial installation, account registration, local binding, or install private chat flows.
3
+ description: Version maintenance for the Grix OpenClaw plugin check for a new version, apply the upgrade, validate and restart, and notify according to fixed rules. Not for initial installation, account registration, local binding, or egg install chats.
4
4
  ---
5
5
 
6
6
  # Grix Update
7
7
 
8
- This skill is solely responsible for **Grix plugin version maintenance**.
9
- The goal is to enable `grix-connector`, once installed into OpenClaw, to perform update checks, upgrade acceptance, and failure alerts according to fixed rules.
10
-
11
- ## Role Boundary
12
-
13
- 1. This skill only performs plugin update-related actions: check, upgrade, validate, restart, notify.
14
- 2. This skill does not perform initial installation, account registration, or agent binding.
15
- 3. This skill does not take over install private chats; if the current context is still in an egg install flow, stop and hand back to `grix-egg` / `grix-admin`.
16
- 4. Only use the official OpenClaw CLI; do not manually edit `openclaw.json` or write temporary scripts to modify the plugin install directory.
17
-
18
- ## Applicable Scenarios
19
-
20
- 1. User requests "check if grix has a new version".
21
- 2. User requests "upgrade the grix plugin".
22
- 3. Need to provide a standalone maintenance skill for subsequent automation.
23
- 4. Scheduled tasks want to silently check, only notifying the main agent on failure.
24
-
25
- ## Input Parameters
26
-
27
- ### Common Parameters
28
-
29
- 1. `mode` (required)
30
- - `check-only`
31
- - `apply-update`
32
- - `check-and-apply`
33
- 2. `plugin_id` (optional)
34
- - Default: `grix`
35
- 3. `notify_on` (optional)
36
- - `failure` (default)
37
- - `always`
38
- - `never`
39
- 4. `main_agent` (optional)
40
- - Primarily used for cron's `--agent <main_agent>` or upper-level workflow marking "who is responsible for maintaining this machine"
41
- - It is not itself a directly deliverable `to` / `session_id` target for Grix messages; if there is no explicit deliverable session, do not guess a notification target just because you have `main_agent`
42
- 5. `allow_restart` (optional)
43
- - Default: `true`
44
-
45
- ### Recommended Default Input
46
-
47
- ```json
48
- {
49
- "mode": "check-and-apply",
50
- "plugin_id": "grix",
51
- "notify_on": "failure",
52
- "allow_restart": true
53
- }
54
- ```
55
-
56
- ## Completion Standard
57
-
58
- Only when all of the following conditions are met is the task considered complete:
59
-
60
- 1. Confirmed whether the target plugin exists.
61
- 2. Confirmed whether the current installation method supports automatic updates.
62
- 3. Executed the check action and provided a clear result: no update / upgraded / failed / unsupported.
63
- 4. If an upgrade was performed, completed:
64
- - `openclaw plugins doctor`
65
- - `openclaw gateway restart` (only when `allow_restart=true`)
66
- - `openclaw health`
67
- 5. If notification rules are configured, completed notification or silently ended according to the rules.
68
-
69
- ## Execution Rules
70
-
71
- ### 0. Context Guard First
72
-
73
- 1. If the current context is clearly an egg install private chat, or the context contains install-related fields like `install_id`, `egg`, `install.route`, do not perform the update — state that the current scenario is not suitable for plugin upgrade and stop.
74
- 2. Do not trigger plugin upgrades during an ongoing installation conversation.
75
-
76
- ### 1. Confirm Plugin Exists First
77
-
78
- Execute first:
79
-
80
- ```bash
81
- openclaw plugins info <plugin_id> --json
82
- ```
83
-
84
- Rules:
85
-
86
- 1. If the plugin does not exist, return `failed/not_installed` and stop.
87
- 2. If the command fails, return the failure reason; do not continue guessing.
88
-
89
- ### 2. Confirm Whether Automatic Update Is Supported
90
-
91
- Execute first:
92
-
93
- ```bash
94
- openclaw plugins update <plugin_id> --dry-run
95
- ```
96
-
97
- Rules:
98
-
99
- 1. If dry-run explicitly indicates the current plugin cannot be updated, is not tracked, or is not an npm install, return `unsupported/not_npm_install` and stop.
100
- 2. Only proceed with subsequent steps when updates are supported.
101
- 3. Do not force local directory installs, `--link` installs, or manual copy installs to be treated as auto-updatable.
102
-
103
- ### 3. `check-only`
104
-
105
- Only check, do not upgrade.
106
-
107
- Rules:
108
-
109
- 1. Run dry-run.
110
- 2. If no new version:
111
- - Return `no_update`
112
- - Silently end by default
113
- 3. If a new version is found:
114
- - Return `update_available`
115
- - Do not perform the actual upgrade
116
-
117
- ### 4. `apply-update`
118
-
119
- Assumes the caller has already decided to upgrade; execute the upgrade directly.
120
-
121
- Execution order:
122
-
123
- ```bash
124
- openclaw plugins update <plugin_id>
125
- openclaw plugins doctor
126
- openclaw gateway restart
127
- openclaw health
128
- ```
129
-
130
- Rules:
131
-
132
- 1. If `allow_restart=false`, skip `openclaw gateway restart`, but clearly state that the upgrade has not been restarted and the runtime may still be the old version.
133
- 2. If any step fails, stop immediately and return the failure point.
134
- 3. Do not automatically retry consecutively after failure.
135
-
136
- ### 5. `check-and-apply`
137
-
138
- This is the most suitable mode for automation.
139
-
140
- Rules:
141
-
142
- 1. Run dry-run first.
143
- 2. If no new version:
144
- - Return `no_update`
145
- - Silently end
146
- 3. If a new version is found:
147
- - Execute the full `apply-update` flow
148
-
149
- ## Validation Order
150
-
151
- If an upgrade was performed, validation must follow this order:
152
-
153
- 1. `openclaw plugins doctor`
154
- 2. `openclaw gateway restart` (if allowed)
155
- 3. `openclaw health`
156
-
157
- Do not claim success immediately after writing the upgrade command.
158
-
159
- ## Notification Rules
160
-
161
- The behavior of `notify_on` is fixed as follows:
162
-
163
- 1. `never`
164
- - Never send notifications
165
- 2. `failure`
166
- - Only notify the main agent on failure
167
- 3. `always`
168
- - Notify the main agent on both success and failure
169
-
170
- Supplementary rules:
171
-
172
- 1. `main_agent` only represents the maintenance responsibility owner; it does not automatically equate to a message-deliverable session target.
173
- 2. If the current context has no explicit maintenance session or reusable notification target, just return the result and let the upper-level cron / caller handle notification; do not guess `to`, `session_id`, or private chat targets on your own.
174
- 3. Cron scenarios should prefer `notify_on=never`; let the cron run records handle convergence.
175
-
176
- Default is `failure`.
177
-
178
- ## Notification Content Requirements
179
-
180
- Notifications must be brief, stating only the result without expanding on technical details.
181
-
182
- Recommended copy style:
183
-
184
- 1. Success:
185
- - `Grix plugin upgrade completed, current checks are normal.`
186
- 2. No update:
187
- - `Grix plugin checked, no new version available.`
188
- 3. Failure:
189
- - `Grix plugin auto-update failed, stuck at <step>.`
190
- 4. Auto-update not supported:
191
- - `Grix is not installed in an auto-updatable way; switch to npm install before enabling auto-update.`
192
-
193
- ## Return Results
194
-
195
- The skill should return clear, stable result states, recommended to converge to these categories:
196
-
197
- 1. `no_update`
198
- 2. `update_available`
199
- 3. `updated`
200
- 4. `failed`
201
- 5. `unsupported`
202
-
203
- If failed, must specify which step the failure belongs to:
204
-
205
- 1. `plugins info`
206
- 2. `plugins update --dry-run`
207
- 3. `plugins update`
208
- 4. `plugins doctor`
209
- 5. `gateway restart`
210
- 6. `health`
211
-
212
- ## Guardrails
213
-
214
- 1. Do not modify initial installation logic; do not replace `grix-register`, `grix-admin`, `grix-egg`.
215
- 2. Do not perform plugin upgrades during install private chats.
216
- 3. Only use official commands:
217
- - `openclaw plugins info`
218
- - `openclaw plugins update`
219
- - `openclaw plugins doctor`
220
- - `openclaw gateway restart`
221
- - `openclaw health`
222
- 4. Do not directly modify the plugin directory or manually overwrite npm package contents.
223
- 5. Do not write bypass logic to "accommodate" old installation methods; unsupported means unsupported.
224
- 6. If the upgrade has not been restarted, do not claim the runtime has completed the switch.
225
- 7. Do not automatically retry at high frequency; after failure, hand off to the next scheduled cycle or manual intervention.
226
-
227
- ## Recommended Automation Integration
228
-
229
- When used for scheduled tasks, prefer:
230
-
231
- ```json
232
- {
233
- "mode": "check-and-apply",
234
- "plugin_id": "grix",
235
- "notify_on": "failure",
236
- "main_agent": "main",
237
- "allow_restart": true
238
- }
239
- ```
240
-
241
- Recommended frequency:
242
-
243
- 1. Once per day
244
- 2. Or once every 6 hours
245
-
246
- Default strategy:
247
-
248
- 1. No update: silent
249
- 2. Update successful: silent
250
- 3. Update failed: notify main agent
251
-
252
- ## Recommended Cron Setup
253
-
254
- If you want automatic maintenance after plugin installation, it is recommended to create an isolated cron task directly, rather than embedding the upgrade action into the main session heartbeat.
255
-
256
- Recommended command:
257
-
258
- ```bash
259
- openclaw cron add \
260
- --name "grix auto update" \
261
- --every "6h" \
262
- --agent <main_agent> \
263
- --session isolated \
264
- --light-context \
265
- --no-deliver \
266
- --message 'Use the grix-update skill with {"mode":"check-and-apply","plugin_id":"grix","notify_on":"never","allow_restart":true}. If there is no update or the update succeeds, reply exactly NO_REPLY. If the install is unsupported or any step fails, return one short failure summary.'
267
- ```
268
-
269
- Rules:
270
-
271
- 1. `--session isolated`: Do not bind to the main session to avoid updates and restarts interrupting the current chat.
272
- 2. `--no-deliver`: Stay silent on success.
273
- 3. `notify_on` in cron scenarios should be fixed to `never`; let the cron's own run records handle troubleshooting.
274
- 4. `main_agent` should use the main agent responsible for maintaining this machine.
275
- 5. Recommended frequency starts at `6h`; if you want to be more conservative, change to once per day.
276
-
277
- If a task with the same name already exists, do not create a duplicate; use edit instead:
278
-
279
- ```bash
280
- openclaw cron edit <job_id> \
281
- --every "6h" \
282
- --agent <main_agent> \
283
- --session isolated \
284
- --light-context \
285
- --no-deliver \
286
- --message 'Use the grix-update skill with {"mode":"check-and-apply","plugin_id":"grix","notify_on":"never","allow_restart":true}. If there is no update or the update succeeds, reply exactly NO_REPLY. If the install is unsupported or any step fails, return one short failure summary.'
287
- ```
288
-
289
- After creation, it is recommended to verify:
290
-
291
- ```bash
292
- openclaw cron list
293
- openclaw cron status
294
- ```
295
-
296
- ## Division of Responsibilities with Other Skills
297
-
298
- 1. `grix-register`
299
- - Only responsible for cloud account and API agent parameters
300
- 2. `grix-admin`
301
- - Only responsible for local configuration and binding
302
- 3. `grix-egg`
303
- - Only responsible for the install private chat flow
304
- 4. `grix-update`
305
- - Only responsible for subsequent version maintenance
306
-
307
- ## References
308
-
309
- 1. [references/update-contract.md](references/update-contract.md)
310
- 2. [references/cron-setup.md](references/cron-setup.md)
8
+ Maintains the installed Grix plugin: check upgrade validate → restart →
9
+ notify. Uses only the official OpenClaw CLI; never edits `openclaw.json`, the
10
+ plugin directory, or npm package contents by hand.
11
+
12
+ Not this skill's job: initial installation, registration, agent binding
13
+ (`grix-register`, `grix-admin`, `grix-egg`). If the current context is an egg
14
+ install chat or carries install fields (`install_id`, `egg`, `install.route`),
15
+ say the scenario is not suitable for a plugin upgrade and stop.
16
+
17
+ ## Inputs
18
+
19
+ | Field | Values | Default |
20
+ |---|---|---|
21
+ | `mode` (required) | `check-only` \| `apply-update` \| `check-and-apply` | — |
22
+ | `plugin_id` | plugin id | `grix` |
23
+ | `notify_on` | `failure` \| `always` \| `never` | `failure` |
24
+ | `allow_restart` | boolean | `true` |
25
+ | `main_agent` | maintainer marker for cron `--agent`; **not** a message target | — |
26
+
27
+ Recommended automation input: `{"mode":"check-and-apply","plugin_id":"grix","notify_on":"failure","allow_restart":true}`.
28
+
29
+ ## Procedure
30
+
31
+ 1. `openclaw plugins info <plugin_id> --json` — plugin missing → result
32
+ `failed` at step `plugins info` (`not_installed`); stop.
33
+ 2. `openclaw plugins update <plugin_id> --dry-run` — if it says the plugin is
34
+ not tracked / not an npm install / cannot be updated → `unsupported`
35
+ (`not_npm_install`); stop. Never treat local-directory, `--link`, or
36
+ copied installs as updatable.
37
+ 3. No new version → `no_update`; end silently.
38
+ 4. New version and `mode=check-only` `update_available`; do not upgrade.
39
+ 5. New version and `mode` is `apply-update` / `check-and-apply` → run in
40
+ order, stopping at the first failure (no automatic retry):
41
+ ```bash
42
+ openclaw plugins update <plugin_id>
43
+ openclaw plugins doctor
44
+ openclaw gateway restart # skip when allow_restart=false
45
+ openclaw health
46
+ ```
47
+ If the restart was skipped, state that the runtime may still be the old
48
+ version. Success → `updated`. Never claim success before `health` passes.
49
+
50
+ ## Result
51
+
52
+ Return one of `no_update` / `update_available` / `updated` / `failed` /
53
+ `unsupported`. For `failed`, name the step: `plugins info`,
54
+ `plugins update --dry-run`, `plugins update`, `plugins doctor`,
55
+ `gateway restart`, or `health`.
56
+
57
+ ## Notification
58
+
59
+ `never` → none; `failure` → only on failure; `always` → success and failure.
60
+ Keep it to one line, e.g. "Grix plugin upgrade completed, current checks are
61
+ normal." / "Grix plugin auto-update failed, stuck at <step>." / "Grix is not
62
+ installed in an auto-updatable way; switch to npm install before enabling
63
+ auto-update."
64
+
65
+ Send a notification only when the context has an explicit deliverable
66
+ session; `main_agent` is not one. Otherwise just return the result and let
67
+ the caller or cron records handle it. In cron runs use `notify_on=never`.
68
+
69
+ ## Scheduled maintenance
70
+
71
+ For automatic maintenance create an isolated cron job (`--session isolated
72
+ --no-deliver`, every 6h or daily) rather than embedding upgrades in the main
73
+ session; edit the existing job instead of creating a duplicate. Commands and
74
+ the recommended message are in [references/cron-setup.md](references/cron-setup.md);
75
+ the full state/notification contract is in
76
+ [references/update-contract.md](references/update-contract.md).
@@ -1,197 +1,66 @@
1
1
  ---
2
2
  name: message-send
3
- description: Send messages. Supports current session replies and cross-session sending. For cross-session, use an exact `session_id` or an existing `route.sessionKey` as the `to` target; do not use the legacy `target=agent:...` format. Trigger words: send DM, DM, send message, notify.
3
+ description: Send messages through OpenClaw's `message` tool on the Grix channel — reply in the current session, or send to another session by its exact `session_id` in `to`. Also defines the `grix://card/conversation` link for pointing the user at a chat. Trigger words: send DM, DM, send message, notify.
4
4
  ---
5
5
 
6
- # Message Send Skill
6
+ # Message Send
7
7
 
8
- This skill is used to send messages through OpenClaw's `message` tool.
8
+ Send messages with OpenClaw's `message` tool, `action: "send"`,
9
+ `channel: "grix"`.
9
10
 
10
- ## Two Sending Modes
11
+ ## Parameters
11
12
 
12
- ### 1. Current Session Reply
13
+ | Parameter | Required | Value |
14
+ |---|---|---|
15
+ | `action` | ✅ | `"send"` |
16
+ | `channel` | ✅ | `"grix"` |
17
+ | `accountId` | ✅ | the current Grix account ID (never hardcode `default`) |
18
+ | `message` | ✅ | text; plain text and Markdown are supported |
19
+ | `to` | cross-session only | exact Grix `session_id` (usually a UUID), or an existing `route.sessionKey` |
13
20
 
14
- If replying to the current Grix session, send directly without providing an additional target session.
15
-
16
- **Parameters**:
17
- - `action`: "send"
18
- - `channel`: "grix"
19
- - `accountId`: current account ID
20
- - `message`: message content
21
-
22
- **Example**:
21
+ - **Current session reply**: omit `to`.
22
+ - **Another session**: set `to` to the bare `session_id`, e.g.
23
+ `to=e72ce987-2d2e-40ed-bcc9-b336b4974512`. `grix:<id>` / `session:<id>`
24
+ are parsed for compatibility but are not the default. Never use
25
+ `target=agent:…`, a bare numeric user/agent ID (fails, no auto-conversion),
26
+ or an invented alias.
23
27
 
24
28
  ```json
25
- {
26
- "action": "send",
27
- "channel": "grix",
28
- "accountId": "{accountId}",
29
- "message": "Got it, processing now..."
30
- }
29
+ { "action": "send", "channel": "grix", "accountId": "{accountId}", "to": "{sessionId}", "message": "Task completed, please check the results." }
31
30
  ```
32
31
 
33
- ### 2. Cross-Session Sending
34
-
35
- If sending to another private chat or group chat, use `to` to point to the target session.
36
-
37
- **Parameters**:
38
- - `action`: "send"
39
- - `channel`: "grix"
40
- - `accountId`: current account ID
41
- - `to`: target session identifier
42
- - `message`: message content
43
-
44
- **Example**:
45
-
46
- ```json
47
- {
48
- "action": "send",
49
- "channel": "grix",
50
- "accountId": "{accountId}",
51
- "to": "{targetSessionId}",
52
- "message": "Need your confirmation on a development decision: ..."
53
- }
54
- ```
32
+ Finding the target: reuse a `session_id` already known from context or
33
+ MEMORY.md; otherwise resolve it with `grix_query` (`session_search`). Confirm
34
+ the account may send to that session, and do not spam proactive messages.
55
35
 
56
- ## Real Format of `to`
36
+ Errors: unresolvable `to` check the `session_id`; permission denied → the
37
+ account cannot send to that session; missing parameter → supply it.
57
38
 
58
- The current plugin recognizes these two types of targets:
39
+ ## Conversation card `grix://card/conversation`
59
40
 
60
- 1. Exact Grix `session_id` (recommended, usually a UUID)
61
- 2. An existing `route.sessionKey` in the current runtime
62
-
63
- Recommended to pass the bare `session_id` directly:
41
+ When you want the user to **open a group or private chat** and you already
42
+ know its exact `session_id`, send a card link instead of prose or a web link;
43
+ the client renders it as a clickable conversation card.
64
44
 
65
45
  ```text
66
- to=e72ce987-2d2e-40ed-bcc9-b336b4974512
46
+ [Open Group](grix://card/conversation?session_id=<SESSION_ID>&session_type=group&title=<ENCODED_TITLE>)
47
+ [Open Conversation](grix://card/conversation?session_id=<SESSION_ID>&session_type=private&title=<ENCODED_TITLE>&peer_id=<ENCODED_PEER_ID>)
67
48
  ```
68
49
 
69
- In compatible formats, `grix:<session_id>` or `session:<session_id>` can also be parsed, but should not be used as the default format.
70
-
71
- Do not use these legacy formats:
72
-
73
- 1. `target=agent:{agentId}:grix:direct:{sessionId}`
74
- 2. Pure numeric user ID / agent ID
75
- 3. Non-existent session aliases
76
-
77
- ## How to Obtain the Target Session
78
-
79
- 1. If replying to the current session, simply omit `to`
80
- 2. If MEMORY.md already records the target `session_id`, reuse it directly
81
- 3. If the target session is unknown, first use `grix_query`'s `session_search` to find the exact `session_id`
50
+ - `session_id` (required, exact), `session_type` (required: `group` |
51
+ `private`), `title` (required, shown to the user), `peer_id` (private only,
52
+ optional).
53
+ - URI-component-encode `title`, `peer_id`, and any other text value; the link
54
+ text outside the parentheses is plain copy and needs no encoding.
55
+ - The card must be **one line, alone in its own message** — one card per
56
+ message; put any explanation in a separate message sent first.
57
+ - No `session_id` → plain-text explanation only; never fabricate a card.
58
+ - Never emit `chat://…` links, "click here" prose, or frontend-internal
59
+ `biz_card` JSON.
82
60
 
83
61
  Example:
84
62
 
85
- ```json
86
- {
87
- "action": "send",
88
- "channel": "grix",
89
- "accountId": "{accountId}",
90
- "to": "{groupSessionId}",
91
- "message": "Task completed, please check the results"
92
- }
93
- ```
94
-
95
- ## Key Parameter Reference
96
-
97
- | Parameter | Required | Description |
98
- |------|------|------|
99
- | `action` | ✅ | Fixed value `"send"` |
100
- | `channel` | ✅ | Fixed value `"grix"` |
101
- | `accountId` | ✅ | Current Grix account ID |
102
- | `message` | ✅ | Message content |
103
- | `to` | Required for cross-session | Exact `session_id` or resolvable `route.sessionKey` |
104
-
105
- ## Important Notes
106
-
107
- 1. Use `to`, not `target`
108
- 2. `to` should preferably be an exact `session_id`; do not confuse user ID, agent ID, and session ID
109
- 3. Pure numeric targets will fail directly; they will not auto-convert to private chats
110
- 4. Before sending cross-session messages, confirm the current account has send permission for the target session
111
- 5. Message content supports plain text and markdown
112
-
113
- ## Conversation Card Message Protocol
114
-
115
- When the message content is **reminding the user to open a group chat**, **open a private chat conversation**, or **referencing a specific conversation entry point**, and you already have the exact `session_id`, do not send natural language links or frontend internal JSON; you must send a standalone `grix://card/conversation` Markdown link, which the frontend will uniformly parse and render as a clickable conversation card.
116
-
117
- ### Standard Format
118
-
119
- Group chat:
120
-
121
63
  ```text
122
- [Open Group](grix://card/conversation?session_id=<SESSION_ID>&session_type=group&title=<URI_ENCODED_GROUP_TITLE>)
123
- ```
124
-
125
- Private chat:
126
-
127
- ```text
128
- [Open Conversation](grix://card/conversation?session_id=<SESSION_ID>&session_type=private&title=<URI_ENCODED_CHAT_TITLE>&peer_id=<URI_ENCODED_PEER_ID>)
129
- ```
130
-
131
- ### Field Rules
132
-
133
- - `session_id`: Required. Must be the exact target session ID.
134
- - `session_type`: Required. Can only be `group` or `private`.
135
- - `title`: Required. The group title or private chat title displayed to the user.
136
- - `peer_id`: Optional for private chat only. Used to supplement private chat peer information, but frontend open behavior is still based on `session_id`.
137
-
138
- ### Encoding Rules
139
-
140
- To prevent spaces, newlines, or reserved characters in titles, nicknames, URLs, and other fields from breaking the link, query parameter values should be URI component encoded before being written into the `grix://card` link.
141
-
142
- - Recommended: uniformly apply URI component encoding to `title`, `peer_id`, and any future text fields
143
- - `session_id` and `session_type` can be output as-is if they only contain safe characters
144
- - Link text is plain copy for the user to see and does not need URI encoding
145
-
146
- Example:
147
-
148
- ```text
149
- [Open Group](grix://card/conversation?session_id=session-9&session_type=group&title=%E4%BA%A7%E5%93%81%E8%AE%A8%E8%AE%BA%E7%BE%A4%20A)
150
- ```
151
-
152
- ### Usage Requirements
153
-
154
- 1. Only output a conversation card when the **exact `session_id` is known**
155
- 2. If there is no `session_id`, can only send plain text explanation; cannot fabricate a conversation card
156
- 3. Do not output `chat://...`, web links, or "click here to open session" style natural language link alternatives
157
- 4. Do not construct frontend internal `biz_card` JSON or attempt to send Flutter/frontend private protocol structures
158
- 5. The `grix://card/conversation` link must be on a single line and must be sent as a standalone message
159
- 6. If additional explanation is needed, send the explanation text and the card as two separate messages; do not mix explanation and card in the same message
160
- 7. Do not put multiple cards in the same message; when multiple jump entries are needed, send multiple messages
161
- 8. If field values contain special characters, apply URI component encoding first, then assemble into the link
162
-
163
- ### Examples
164
-
165
- Example 1: Remind user to enter a group chat
166
-
167
- ```text
168
- [Open Product Group](grix://card/conversation?session_id=9d6a4b1d-5d37-4e38-ae6a-0c12a2c4c901&session_type=group&title=%E4%BA%A7%E5%93%81%E7%BE%A4)
169
- ```
170
-
171
- Example 2: Remind user to enter a private chat
172
-
173
- ```text
174
- [Open Alice Conversation](grix://card/conversation?session_id=e72ce987-2d2e-40ed-bcc9-b336b4974512&session_type=private&title=Alice&peer_id=1001)
175
- ```
176
-
177
- Example 3: Send explanation and card as two separate messages
178
-
179
- ```text
180
- Message 1: The test group has been created. Check the next card to enter directly.
64
+ Message 1: The test group has been created — tap the card below to open it.
181
65
  Message 2: [Open Test Group](grix://card/conversation?session_id=0fa947bd-bb4e-46ad-8308-5526bc98e002&session_type=group&title=%E6%B5%8B%E8%AF%95%E7%BE%A4)
182
66
  ```
183
-
184
- ## Error Handling
185
-
186
- - `to` cannot be resolved: confirm whether the `session_id` or `route.sessionKey` is correct
187
- - Insufficient permissions: check whether the current `accountId` has send permission for the target session
188
- - Missing parameters: ensure all required parameters are provided
189
- - Target format error: check whether `to` is an exact `session_id` or valid `route.sessionKey`
190
-
191
- ## Best Practices
192
-
193
- 1. For cross-session sending, prefer recording and reusing exact `session_id`
194
- 2. When you need to find a session, use `grix_query.session_search` first
195
- 3. Keep message content concise and highlight key points
196
- 4. Do not abuse proactive messages to avoid disturbing the owner
197
- 5. Prefer conversation cards over plain text explanations when navigation is needed