grix-connector 4.2.3 → 4.2.5
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/dist/adapter/claude/claude-adapter.js +18 -17
- package/dist/assets/dsh-bridge/grix-dsh-bridge-4.2.5.tgz +0 -0
- package/dist/assets/dsh-bridge/manifest.json +6 -6
- package/dist/core/mcp/tools.js +1 -1
- package/dist/default-skills/grix-access-control/SKILL.md +1 -1
- package/dist/default-skills/grix-admin/SKILL.md +115 -155
- package/dist/default-skills/grix-admin/references/api-contract.md +23 -12
- package/dist/default-skills/grix-agent-dispatch/SKILL.md +152 -188
- package/dist/default-skills/grix-audit-data/SKILL.md +1 -1
- package/dist/default-skills/grix-chat-state/SKILL.md +26 -43
- package/dist/default-skills/grix-egg/SKILL.md +94 -50
- package/dist/default-skills/grix-group/SKILL.md +1 -1
- package/dist/default-skills/grix-owner-relay/SKILL.md +30 -64
- package/dist/default-skills/grix-query/SKILL.md +1 -1
- package/dist/default-skills/grix-skill-library/SKILL.md +52 -0
- package/dist/default-skills/grix-widget-visitor-ban/SKILL.md +1 -1
- package/dist/default-skills/message-send/SKILL.md +1 -1
- package/dist/default-skills/message-unsend/SKILL.md +1 -1
- package/dist/default-skills/tailnet-file-share/SKILL.md +38 -72
- package/dist/default-skills/tailnet-file-share/references/certificate-trust.md +64 -0
- package/dist/mcp/stream-http/security.js +1 -1
- package/openclaw-plugin/index.js +120 -3
- package/openclaw-plugin/skills/grix-admin/SKILL.md +127 -156
- package/openclaw-plugin/skills/grix-egg/SKILL.md +27 -1
- package/openclaw-plugin/skills/grix-group/SKILL.md +52 -159
- package/openclaw-plugin/skills/grix-query/SKILL.md +54 -248
- package/openclaw-plugin/skills/grix-update/SKILL.md +70 -304
- package/openclaw-plugin/skills/message-send/SKILL.md +41 -172
- package/openclaw-plugin/skills/message-unsend/SKILL.md +29 -170
- package/package.json +1 -1
- package/dist/assets/dsh-bridge/grix-dsh-bridge-4.2.3.tgz +0 -0
|
@@ -3,162 +3,55 @@ name: grix-group
|
|
|
3
3
|
description: Use the typed `grix_group` tool for Grix group lifecycle and membership operations. Trigger when users ask to create, inspect, leave, update, or dissolve groups, or when these operations fail with scope or permission errors.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Grix Group
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
3.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Required input:
|
|
59
|
-
|
|
60
|
-
1. `sessionId` (non-empty string)
|
|
61
|
-
2. `memberIds` (non-empty string array; each item numeric text)
|
|
62
|
-
3. `memberTypes` (optional int array; align with `memberIds`)
|
|
63
|
-
|
|
64
|
-
Guardrails:
|
|
65
|
-
|
|
66
|
-
1. Reject empty `sessionId` before calling the tool.
|
|
67
|
-
2. Reject non-numeric `memberIds` before calling the tool.
|
|
68
|
-
3. If `sessionId` is ambiguous, ask the user to confirm the target group first.
|
|
69
|
-
|
|
70
|
-
### leave
|
|
71
|
-
|
|
72
|
-
Purpose: let the current Agent leave a group by itself.
|
|
73
|
-
|
|
74
|
-
Required input:
|
|
75
|
-
|
|
76
|
-
1. `sessionId`
|
|
77
|
-
|
|
78
|
-
Guardrails:
|
|
79
|
-
|
|
80
|
-
1. Only execute this when the requester is clearly the current Agent owner, or an already-established authorized operator in the current context.
|
|
81
|
-
2. If the requester identity is unclear, ask for confirmation first; if it is clearly unauthorized, reject directly and do not call `grix_group`.
|
|
82
|
-
3. This action is only for the current Agent leaving its own group membership.
|
|
83
|
-
4. Never translate a request to remove other members into `leave`; use `remove_members` for that.
|
|
84
|
-
5. Do not send `memberId`, `memberIds`, or `memberTypes` with this action.
|
|
85
|
-
6. This action does not require scope and should not be described as a scope-grant workflow.
|
|
86
|
-
7. Execute `leave` silently: do not send any pre-leave or farewell message to the group before leaving.
|
|
87
|
-
|
|
88
|
-
### remove_members
|
|
89
|
-
|
|
90
|
-
Required input:
|
|
91
|
-
|
|
92
|
-
1. `sessionId`
|
|
93
|
-
2. `memberIds`
|
|
94
|
-
|
|
95
|
-
### update_member_role
|
|
96
|
-
|
|
97
|
-
Required input:
|
|
98
|
-
|
|
99
|
-
1. `sessionId`
|
|
100
|
-
2. `memberId`
|
|
101
|
-
3. `role`
|
|
102
|
-
|
|
103
|
-
Guardrails:
|
|
104
|
-
|
|
105
|
-
1. Only use `memberType=1` for role updates.
|
|
106
|
-
2. Never guess a role value; confirm when unclear.
|
|
107
|
-
|
|
108
|
-
### update_all_members_muted
|
|
109
|
-
|
|
110
|
-
Required input:
|
|
111
|
-
|
|
112
|
-
1. `sessionId`
|
|
113
|
-
2. `allMembersMuted`
|
|
114
|
-
|
|
115
|
-
Guardrails:
|
|
116
|
-
|
|
117
|
-
1. Only use this for group-wide mute state changes.
|
|
118
|
-
2. Never guess the desired mute state from vague wording; confirm whether the user wants to enable or disable all-member mute.
|
|
119
|
-
|
|
120
|
-
### update_member_speaking
|
|
121
|
-
|
|
122
|
-
Required input:
|
|
123
|
-
|
|
124
|
-
1. `sessionId`
|
|
125
|
-
2. `memberId`
|
|
126
|
-
3. At least one of `isSpeakMuted` or `canSpeakWhenAllMuted`
|
|
127
|
-
|
|
128
|
-
Guardrails:
|
|
129
|
-
|
|
130
|
-
1. Only use `memberType=1` or `memberType=2`.
|
|
131
|
-
2. Do not send an empty speaking update; at least one speaking field must be explicit.
|
|
132
|
-
3. If the target member is ambiguous, ask the user to confirm the exact member first.
|
|
133
|
-
|
|
134
|
-
### detail / dissolve
|
|
135
|
-
|
|
136
|
-
Required input:
|
|
137
|
-
|
|
138
|
-
1. `sessionId`
|
|
139
|
-
|
|
140
|
-
## Error Handling Rules
|
|
141
|
-
|
|
142
|
-
1. `403/20011`:
|
|
143
|
-
report missing scope and ask owner to grant the scope in Aibot Agent permission page.
|
|
144
|
-
Do not use this remediation for `leave`, because `leave` is scope-free.
|
|
145
|
-
2. `401/10001`:
|
|
146
|
-
report invalid key/auth and suggest checking agent config or rotating API key.
|
|
147
|
-
3. `403/10002`:
|
|
148
|
-
report agent is not active or invalid provider type.
|
|
149
|
-
4. `400/10003`:
|
|
150
|
-
report invalid/missing parameters and ask user for corrected values.
|
|
151
|
-
5. Other errors:
|
|
152
|
-
return backend `msg` and stop automatic retries.
|
|
153
|
-
|
|
154
|
-
## Response Style
|
|
155
|
-
|
|
156
|
-
1. State action result first.
|
|
157
|
-
2. Include key identifiers (`session_id`, member count, mute state) when successful.
|
|
158
|
-
3. Include exact remediation when failed.
|
|
159
|
-
4. Never hide scope or auth errors behind generic wording.
|
|
160
|
-
5. For `leave`, report result to the requester only; do not post extra messages into the group session.
|
|
161
|
-
|
|
162
|
-
## References
|
|
163
|
-
|
|
164
|
-
1. Load [references/api-contract.md](references/api-contract.md) when you need exact tool mapping, payload examples, and scope matrix.
|
|
6
|
+
# Grix Group
|
|
7
|
+
|
|
8
|
+
Use `grix_group` for group lifecycle and membership management. The Grix
|
|
9
|
+
account is resolved from the current agent context; you do not pass it.
|
|
10
|
+
|
|
11
|
+
## Tool contract
|
|
12
|
+
|
|
13
|
+
Call `grix_group` with one `action`; use the exact typed field names below.
|
|
14
|
+
|
|
15
|
+
| `action` | Required | Optional |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `create` | `name` | `memberIds` (numeric strings) + `memberTypes` (1=user, 2=agent), aligned by index |
|
|
18
|
+
| `detail` | `sessionId` | — |
|
|
19
|
+
| `leave` | `sessionId` | — (never send member fields) |
|
|
20
|
+
| `dissolve` | `sessionId` | — |
|
|
21
|
+
| `add_members` / `remove_members` | `sessionId`, `memberIds` | `memberTypes`, aligned by index |
|
|
22
|
+
| `update_member_role` | `sessionId`, `memberId`, `role` (1=admin, 2=member) | — (`memberType` is always 1) |
|
|
23
|
+
| `update_all_members_muted` | `sessionId`, `allMembersMuted` | — |
|
|
24
|
+
| `update_member_speaking` | `sessionId`, `memberId`, at least one of `isSpeakMuted` / `canSpeakWhenAllMuted` | `memberType` (1 or 2) |
|
|
25
|
+
|
|
26
|
+
## Rules
|
|
27
|
+
|
|
28
|
+
1. Validate required fields before calling; reject non-numeric `memberIds`
|
|
29
|
+
and empty `sessionId` yourself. Resolve an unknown or ambiguous group with
|
|
30
|
+
`grix_query` (`session_search`) and confirm with the user first.
|
|
31
|
+
2. One call per business action. `create` and `dissolve` are not idempotent —
|
|
32
|
+
never auto-retry them; ask for explicit confirmation before repeating.
|
|
33
|
+
3. Never guess a role or mute state from vague wording; confirm whether the
|
|
34
|
+
user wants it enabled or disabled.
|
|
35
|
+
4. `leave` removes only the current agent from the group. Execute it only
|
|
36
|
+
for the owner or an already-established authorized operator; if identity
|
|
37
|
+
is unclear, confirm first. Leave silently — no farewell message — and
|
|
38
|
+
report the result only to the requester. To remove someone else use
|
|
39
|
+
`remove_members`. `leave` needs no scope, so never answer a `leave`
|
|
40
|
+
failure with scope-grant guidance.
|
|
41
|
+
5. On errors, report the exact failure and fix; do not retry blindly:
|
|
42
|
+
- `403/20011` — missing scope (usually not an admin of that group); ask the
|
|
43
|
+
owner to grant it in the agent permission page.
|
|
44
|
+
- `401/10001` — invalid key/auth; check agent config or rotate the key.
|
|
45
|
+
- `403/10002` — agent not active or invalid provider type.
|
|
46
|
+
- `400/10003` — invalid or missing parameters.
|
|
47
|
+
|
|
48
|
+
## Response style
|
|
49
|
+
|
|
50
|
+
State the result first with key identifiers (`session_id`, member count,
|
|
51
|
+
mute state); on failure give the exact remediation and never hide scope or
|
|
52
|
+
auth errors behind generic wording.
|
|
53
|
+
|
|
54
|
+
## Reference
|
|
55
|
+
|
|
56
|
+
[references/api-contract.md](references/api-contract.md) — exact tool
|
|
57
|
+
mapping, payload examples, and scope matrix.
|
|
@@ -5,251 +5,57 @@ description: Use the typed `grix_query` tool for Grix contact lookup, keyword se
|
|
|
5
5
|
|
|
6
6
|
# Grix Query
|
|
7
7
|
|
|
8
|
-
Use
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"accountId": "primary",
|
|
63
|
-
"id": "1002"
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
```json
|
|
68
|
-
{
|
|
69
|
-
"action": "session_search",
|
|
70
|
-
"accountId": "primary",
|
|
71
|
-
"id": "task_room_9083"
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Keyword Search
|
|
76
|
-
|
|
77
|
-
When the user provides a fuzzy name, title, username, or other search phrase, pass `keyword`:
|
|
78
|
-
|
|
79
|
-
```json
|
|
80
|
-
{
|
|
81
|
-
"action": "contact_search",
|
|
82
|
-
"accountId": "primary",
|
|
83
|
-
"keyword": "atlas user"
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
{
|
|
89
|
-
"action": "session_search",
|
|
90
|
-
"accountId": "primary",
|
|
91
|
-
"keyword": "taskroom9083"
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### List All (without ID or keyword)
|
|
96
|
-
|
|
97
|
-
When the user asks to list all contacts or sessions, call without `id` and without `keyword`:
|
|
98
|
-
|
|
99
|
-
```json
|
|
100
|
-
{
|
|
101
|
-
"action": "contact_search",
|
|
102
|
-
"accountId": "primary"
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
```json
|
|
107
|
-
{
|
|
108
|
-
"action": "session_search",
|
|
109
|
-
"accountId": "primary"
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Returns a paginated result with `has_more`, `list`, and default page size of 20.
|
|
114
|
-
Use `limit` and `offset` to paginate through results.
|
|
115
|
-
|
|
116
|
-
If the user asks for all results, keep fetching additional pages until `has_more` is `false`.
|
|
117
|
-
If the user only needs one match or one page is enough to answer, stop after the first sufficient page.
|
|
118
|
-
|
|
119
|
-
```json
|
|
120
|
-
{
|
|
121
|
-
"action": "contact_search",
|
|
122
|
-
"accountId": "primary",
|
|
123
|
-
"limit": 50,
|
|
124
|
-
"offset": 20
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Action Contracts
|
|
129
|
-
|
|
130
|
-
### contact_search
|
|
131
|
-
|
|
132
|
-
Purpose: search the owner's Grix contact directory.
|
|
133
|
-
|
|
134
|
-
**Without `id` and without `keyword`**: returns all contacts (friends + agents) in a paginated list, sorted by `created_at` descending. Default page size 20.
|
|
135
|
-
|
|
136
|
-
**With `id`**: returns the exact matching contact record.
|
|
137
|
-
|
|
138
|
-
**With `keyword`**: searches contact remark name, nickname, username, and numeric ID prefix.
|
|
139
|
-
|
|
140
|
-
Input:
|
|
141
|
-
|
|
142
|
-
1. `id` (contact ID, numeric string) — optional
|
|
143
|
-
2. `keyword` — optional
|
|
144
|
-
3. `limit` — optional, default 20
|
|
145
|
-
4. `offset` — optional, default 0
|
|
146
|
-
|
|
147
|
-
Guardrails:
|
|
148
|
-
|
|
149
|
-
1. Use `id` when the target contact ID is already known and you need the exact entry.
|
|
150
|
-
2. Use `keyword` for fuzzy search; do not use `id` for partial matches.
|
|
151
|
-
3. Without `id` and `keyword`, the result includes both user contacts and agent contacts merged and sorted.
|
|
152
|
-
4. Check `has_more` to determine if additional pages exist.
|
|
153
|
-
5. When paging, keep the same filters and increase `offset` by the number of items already fetched.
|
|
154
|
-
6. If the user asked for all matches, continue until `has_more` is `false`.
|
|
155
|
-
7. Do not jump directly to session history from a vague contact hint; resolve the contact or session first.
|
|
156
|
-
|
|
157
|
-
### session_search
|
|
158
|
-
|
|
159
|
-
Purpose: search the owner's visible sessions.
|
|
160
|
-
|
|
161
|
-
**Without `id` and without `keyword`**: returns all visible sessions in a paginated list, ordered by pinned status and `last_active_at`. Default page size 20.
|
|
162
|
-
|
|
163
|
-
**With `id`**: returns the exact matching session.
|
|
164
|
-
|
|
165
|
-
**With `keyword`**: searches session title and `session_id`.
|
|
166
|
-
|
|
167
|
-
Each result item includes `session_type`: `1` = private chat, `2` = group chat.
|
|
168
|
-
|
|
169
|
-
Input:
|
|
170
|
-
|
|
171
|
-
1. `id` (session ID) — optional
|
|
172
|
-
2. `keyword` — optional
|
|
173
|
-
3. `sessionType` — optional; `1` = private chats only, `2` = group chats only. **Omit to return all sessions regardless of type.**
|
|
174
|
-
4. `limit` — optional, default 20
|
|
175
|
-
5. `offset` — optional, default 0
|
|
176
|
-
|
|
177
|
-
Guardrails:
|
|
178
|
-
|
|
179
|
-
1. Use `id` when the target session ID is already known.
|
|
180
|
-
2. Use `keyword` for fuzzy search by title or session ID text.
|
|
181
|
-
3. Use `sessionType` when the user explicitly wants only private chats or only group chats.
|
|
182
|
-
4. Without `id` and `keyword`, the result shows all sessions the agent can see.
|
|
183
|
-
5. Check `has_more` to determine if additional pages exist.
|
|
184
|
-
6. When paging, keep the same filters and increase `offset` by the number of items already fetched.
|
|
185
|
-
7. If the user asked for all matches, continue until `has_more` is `false`.
|
|
186
|
-
8. If multiple sessions match, present the candidates and let the user choose before reading history.
|
|
187
|
-
|
|
188
|
-
### message_history
|
|
189
|
-
|
|
190
|
-
Purpose: read recent message history from a known session.
|
|
191
|
-
|
|
192
|
-
Required input:
|
|
193
|
-
|
|
194
|
-
1. `sessionId`
|
|
195
|
-
|
|
196
|
-
Optional input:
|
|
197
|
-
|
|
198
|
-
1. `beforeId`
|
|
199
|
-
2. `limit` — defaults to 1
|
|
200
|
-
|
|
201
|
-
Guardrails:
|
|
202
|
-
|
|
203
|
-
1. Only call this after the target session is unambiguous.
|
|
204
|
-
2. Use `beforeId` only for older-page pagination.
|
|
205
|
-
3. For the next page, set `beforeId` to the oldest message ID returned in the previous page.
|
|
206
|
-
4. If the user asked for more history and `has_more` is `true`, keep paging until enough history is collected or no more pages remain.
|
|
207
|
-
5. Do not claim to have full history if only one page was fetched.
|
|
208
|
-
6. History contains plain text and approval-family cards; tool, status, and
|
|
209
|
-
binding process cards are filtered by the service.
|
|
210
|
-
|
|
211
|
-
### message_search
|
|
212
|
-
|
|
213
|
-
Purpose: search messages by keyword inside one known session.
|
|
214
|
-
|
|
215
|
-
Required input:
|
|
216
|
-
|
|
217
|
-
1. `sessionId`
|
|
218
|
-
2. `keyword`
|
|
219
|
-
|
|
220
|
-
Optional input:
|
|
221
|
-
|
|
222
|
-
1. `beforeId`
|
|
223
|
-
2. `limit`
|
|
224
|
-
|
|
225
|
-
Guardrails:
|
|
226
|
-
|
|
227
|
-
1. Only call this after the target session is unambiguous.
|
|
228
|
-
2. `keyword` must be the real search phrase; do not fake an empty keyword just to reuse this action.
|
|
229
|
-
3. For the next page, keep the same `keyword` and `sessionId`, and set `beforeId` to the oldest message ID returned in the previous page.
|
|
230
|
-
4. If the user asked for all matches and `has_more` is `true`, keep paging until enough matches are collected or no more pages remain.
|
|
231
|
-
5. If the user only asked whether a keyword appeared, one sufficient page can stop the search, but state clearly that the result is partial when you did not exhaust all pages.
|
|
232
|
-
|
|
233
|
-
## Error Handling Rules
|
|
234
|
-
|
|
235
|
-
1. `403/20011`:
|
|
236
|
-
report missing scope and ask the owner to grant the required scope in the Aibot Agent permission page.
|
|
237
|
-
2. `401/10001`:
|
|
238
|
-
report invalid key/auth and suggest checking agent config or rotating the API key.
|
|
239
|
-
3. `403/10002`:
|
|
240
|
-
report the agent is not active or has an invalid provider type.
|
|
241
|
-
4. `400/10003`:
|
|
242
|
-
report invalid or missing parameters and ask the user for corrected values.
|
|
243
|
-
5. `404/4004`:
|
|
244
|
-
report the target session does not exist or is not visible.
|
|
245
|
-
6. Other errors:
|
|
246
|
-
return the backend `msg` and stop automatic retries.
|
|
247
|
-
|
|
248
|
-
## Response Style
|
|
249
|
-
|
|
250
|
-
1. State the query result first.
|
|
251
|
-
2. Include key identifiers from successful lookups:
|
|
252
|
-
`peer_id` / `peer_type` for contacts, `session_id` for sessions, and message identifiers for history.
|
|
253
|
-
3. If only part of a paginated result was fetched, state that clearly.
|
|
254
|
-
4. If multiple pages were fetched, summarize that the answer is merged from several pages.
|
|
255
|
-
5. Never hide scope or auth errors behind generic wording.
|
|
8
|
+
Use `grix_query` for read-only Grix lookup. It only queries existing contacts,
|
|
9
|
+
sessions, and raw session messages — it never sends or changes anything. The
|
|
10
|
+
Grix account is resolved from the current agent context; you do not pass it.
|
|
11
|
+
|
|
12
|
+
## Tool contract
|
|
13
|
+
|
|
14
|
+
Call `grix_query` with one `action`:
|
|
15
|
+
|
|
16
|
+
- `contact_search` — the owner's contact directory (friends + agents). Use
|
|
17
|
+
exactly one mode: exact lookup with `id` (numeric contact/agent ID), keyword
|
|
18
|
+
search with `keyword` (matches remark name, nickname, username, ID prefix),
|
|
19
|
+
or list-all with neither (sorted by `created_at` desc).
|
|
20
|
+
- `session_search` — the owner's visible sessions. Same three modes: `id`
|
|
21
|
+
(exact session ID), `keyword` (matches title and session ID), or neither
|
|
22
|
+
(ordered by pinned status and `last_active_at`). Each result carries
|
|
23
|
+
`session_type` (`1` private, `2` group); pass `sessionType` to filter by
|
|
24
|
+
type, omit to get both.
|
|
25
|
+
- `message_history` — recent clean messages of one session. Requires
|
|
26
|
+
`sessionId`; `limit` defaults to 1; page backwards with `beforeId` = the
|
|
27
|
+
oldest message ID from the previous page. History contains plain text and
|
|
28
|
+
approval-family cards; tool/status/binding process cards are filtered out.
|
|
29
|
+
- `message_search` — keyword search inside one session. Requires `sessionId`
|
|
30
|
+
and a real `keyword`; pages like `message_history`.
|
|
31
|
+
|
|
32
|
+
Pagination: `limit` (default 20, max 100) and `offset` for the two search
|
|
33
|
+
actions; `beforeId` for the two message actions. Results include `has_more`.
|
|
34
|
+
|
|
35
|
+
## Rules
|
|
36
|
+
|
|
37
|
+
1. Parse the request into exactly one action and validate required fields
|
|
38
|
+
before calling.
|
|
39
|
+
2. If both `id` and `keyword` are given the backend prioritizes `id`; send
|
|
40
|
+
only one unless you explicitly want exact-match behavior.
|
|
41
|
+
3. Never invent a `sessionId`. For message history or in-session search with
|
|
42
|
+
no known session, resolve it via `session_search` first — if several
|
|
43
|
+
sessions match, present the candidates and let the user choose.
|
|
44
|
+
4. One call per page. Keep paging only when the user asked for everything,
|
|
45
|
+
the target is still unresolved, or one page is clearly insufficient; keep
|
|
46
|
+
the same filters while paging. When you stop early, say the result is
|
|
47
|
+
partial.
|
|
48
|
+
5. On errors, report the exact failure and fix; do not retry with guessed
|
|
49
|
+
parameters:
|
|
50
|
+
- `403/20011` — missing scope; ask the owner to grant it in the agent
|
|
51
|
+
permission page.
|
|
52
|
+
- `401/10001` — invalid key/auth; check agent config or rotate the key.
|
|
53
|
+
- `403/10002` — agent not active or invalid provider type.
|
|
54
|
+
- `400/10003` — invalid or missing parameters.
|
|
55
|
+
- `404/4004` — session does not exist or is not visible.
|
|
56
|
+
|
|
57
|
+
## Response style
|
|
58
|
+
|
|
59
|
+
State the result first and include the key identifiers (`peer_id` /
|
|
60
|
+
`peer_type` for contacts, `session_id` for sessions, message IDs for
|
|
61
|
+
history). Never hide scope or auth errors behind generic wording.
|