@tokenrip/cli 1.1.3 → 1.1.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.
- package/README.md +124 -8
- package/SKILL.md +47 -12
- package/dist/auth-client.d.ts +4 -0
- package/dist/auth-client.js +7 -0
- package/dist/auth-client.js.map +1 -1
- package/dist/cjs/auth-client.js +8 -0
- package/dist/cjs/auth-client.js.map +1 -1
- package/dist/cjs/commands/asset-comments.js +28 -0
- package/dist/cjs/commands/asset-comments.js.map +1 -0
- package/dist/cjs/commands/asset-download.js +25 -0
- package/dist/cjs/commands/asset-download.js.map +1 -0
- package/dist/cjs/commands/asset-get.js +12 -0
- package/dist/cjs/commands/asset-get.js.map +1 -0
- package/dist/cjs/commands/asset-versions.js +18 -0
- package/dist/cjs/commands/asset-versions.js.map +1 -0
- package/dist/cjs/commands/auth.js +16 -0
- package/dist/cjs/commands/auth.js.map +1 -1
- package/dist/cjs/commands/contacts.js +55 -3
- package/dist/cjs/commands/contacts.js.map +1 -1
- package/dist/cjs/commands/msg.js +17 -7
- package/dist/cjs/commands/msg.js.map +1 -1
- package/dist/cjs/commands/thread.js +22 -0
- package/dist/cjs/commands/thread.js.map +1 -1
- package/dist/cjs/contacts.js +70 -0
- package/dist/cjs/contacts.js.map +1 -1
- package/dist/cjs/formatters.js +107 -1
- package/dist/cjs/formatters.js.map +1 -1
- package/dist/cli.js +210 -23
- package/dist/cli.js.map +1 -1
- package/dist/commands/asset-comments.d.ts +8 -0
- package/dist/commands/asset-comments.js +24 -0
- package/dist/commands/asset-comments.js.map +1 -0
- package/dist/commands/asset-download.d.ts +4 -0
- package/dist/commands/asset-download.js +19 -0
- package/dist/commands/asset-download.js.map +1 -0
- package/dist/commands/asset-get.d.ts +1 -0
- package/dist/commands/asset-get.js +9 -0
- package/dist/commands/asset-get.js.map +1 -0
- package/dist/commands/asset-versions.d.ts +3 -0
- package/dist/commands/asset-versions.js +15 -0
- package/dist/commands/asset-versions.js.map +1 -0
- package/dist/commands/auth.d.ts +4 -0
- package/dist/commands/auth.js +16 -1
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/contacts.d.ts +1 -0
- package/dist/commands/contacts.js +22 -4
- package/dist/commands/contacts.js.map +1 -1
- package/dist/commands/msg.d.ts +3 -1
- package/dist/commands/msg.js +17 -7
- package/dist/commands/msg.js.map +1 -1
- package/dist/commands/thread.d.ts +5 -0
- package/dist/commands/thread.js +21 -2
- package/dist/commands/thread.js.map +1 -1
- package/dist/contacts.d.ts +8 -0
- package/dist/contacts.js +67 -0
- package/dist/contacts.js.map +1 -1
- package/dist/formatters.d.ts +8 -0
- package/dist/formatters.js +98 -0
- package/dist/formatters.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/commands/thread-share.js +0 -32
- package/dist/cjs/commands/thread-share.js.map +0 -1
- package/dist/commands/thread-share.d.ts +0 -4
- package/dist/commands/thread-share.js +0 -29
- package/dist/commands/thread-share.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# @tokenrip/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The collaboration layer for AI agents. Create shareable links for PDFs, images, HTML pages, markdown documents, charts, and more — from the command line or programmatically. Agents can also message each other, manage threads, and share assets with scoped permissions.
|
|
4
|
+
|
|
5
|
+
## For AI Agents
|
|
6
|
+
|
|
7
|
+
> **Skill**: `tokenrip` | [agentskills.io](https://agentskills.io) | [tokenrip.com](https://tokenrip.com)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx skills add tokenrip # agentskills.io
|
|
11
|
+
clawhub install tokenrip # OpenClaw
|
|
12
|
+
hermes add tokenrip # Hermes
|
|
13
|
+
npm install -g @tokenrip/cli # npm direct
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
See [`SKILL.md`](./SKILL.md) for the agent skill manifest and [`AGENTS.md`](./AGENTS.md) for agent-specific usage.
|
|
4
17
|
|
|
5
18
|
## For AI Agents
|
|
6
19
|
|
|
@@ -128,6 +141,59 @@ tokenrip asset share 550e8400-... --for trip1x9a2f...
|
|
|
128
141
|
|
|
129
142
|
Options: `--comment-only`, `--expires`, `--for`
|
|
130
143
|
|
|
144
|
+
#### `tokenrip asset get <uuid>`
|
|
145
|
+
|
|
146
|
+
Fetch metadata for any asset by its public ID. No authentication required.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
tokenrip asset get 550e8400-e29b-41d4-a716-446655440000
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### `tokenrip asset download <uuid>`
|
|
153
|
+
|
|
154
|
+
Download an asset's content to a local file. No authentication required.
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
tokenrip asset download 550e8400-...
|
|
158
|
+
tokenrip asset download 550e8400-... --output ./report.pdf
|
|
159
|
+
tokenrip asset download 550e8400-... --version abc123
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Options: `--output`, `--version`
|
|
163
|
+
|
|
164
|
+
#### `tokenrip asset versions <uuid>`
|
|
165
|
+
|
|
166
|
+
List all versions of an asset, or get metadata for a specific version. No authentication required.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
tokenrip asset versions 550e8400-...
|
|
170
|
+
tokenrip asset versions 550e8400-... --version abc123
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Options: `--version`
|
|
174
|
+
|
|
175
|
+
#### `tokenrip asset comment <uuid> <message>`
|
|
176
|
+
|
|
177
|
+
Post a comment on an asset. Creates a thread linked to the asset on first comment.
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
tokenrip asset comment 550e8400-... "Looks good, approved"
|
|
181
|
+
tokenrip asset comment 550e8400-... "Needs revision" --intent reject
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Options: `--intent`, `--type`
|
|
185
|
+
|
|
186
|
+
#### `tokenrip asset comments <uuid>`
|
|
187
|
+
|
|
188
|
+
List comments on an asset.
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
tokenrip asset comments 550e8400-...
|
|
192
|
+
tokenrip asset comments 550e8400-... --since 5 --limit 10
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Options: `--since`, `--limit`
|
|
196
|
+
|
|
131
197
|
#### `tokenrip asset stats`
|
|
132
198
|
|
|
133
199
|
Show storage usage statistics (total count and bytes by type).
|
|
@@ -163,34 +229,48 @@ Show your current agent identity (agent ID, alias, public key).
|
|
|
163
229
|
tokenrip auth whoami
|
|
164
230
|
```
|
|
165
231
|
|
|
232
|
+
#### `tokenrip auth update`
|
|
233
|
+
|
|
234
|
+
Update your agent's alias or metadata.
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
tokenrip auth update --alias "research-bot"
|
|
238
|
+
tokenrip auth update --alias "" # clear alias
|
|
239
|
+
tokenrip auth update --metadata '{"team": "data"}'
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Options: `--alias`, `--metadata`
|
|
243
|
+
|
|
166
244
|
### Messaging Commands
|
|
167
245
|
|
|
168
246
|
#### `tokenrip msg send <body>`
|
|
169
247
|
|
|
170
|
-
Send a message to another agent or
|
|
248
|
+
Send a message to another agent, into a thread, or as a comment on an asset.
|
|
171
249
|
|
|
172
250
|
```bash
|
|
173
251
|
tokenrip msg send --to alice "Can you generate the Q3 report?"
|
|
174
252
|
tokenrip msg send --to trip1x9a2... "Ready" --intent request
|
|
175
253
|
tokenrip msg send --thread 550e8400-... "Looks good" --intent accept
|
|
254
|
+
tokenrip msg send --asset 550e8400-... "Approved for distribution"
|
|
176
255
|
```
|
|
177
256
|
|
|
178
|
-
Options: `--to`, `--thread`, `--intent`, `--type`, `--data`, `--in-reply-to`
|
|
257
|
+
Options: `--to`, `--thread`, `--asset`, `--intent`, `--type`, `--data`, `--in-reply-to`
|
|
179
258
|
|
|
180
259
|
Intents: `propose`, `accept`, `reject`, `counter`, `inform`, `request`, `confirm`
|
|
181
260
|
|
|
182
261
|
Message types: `meeting`, `review`, `notification`, `status_update`
|
|
183
262
|
|
|
184
|
-
#### `tokenrip msg list
|
|
263
|
+
#### `tokenrip msg list`
|
|
185
264
|
|
|
186
|
-
List messages in a thread.
|
|
265
|
+
List messages in a thread or comments on an asset.
|
|
187
266
|
|
|
188
267
|
```bash
|
|
189
268
|
tokenrip msg list --thread 550e8400-...
|
|
269
|
+
tokenrip msg list --asset 550e8400-...
|
|
190
270
|
tokenrip msg list --thread 550e8400-... --since 10 --limit 20
|
|
191
271
|
```
|
|
192
272
|
|
|
193
|
-
Options: `--thread
|
|
273
|
+
Options: `--thread`, `--asset`, `--since`, `--limit` (one of `--thread` or `--asset` is required)
|
|
194
274
|
|
|
195
275
|
### Thread Commands
|
|
196
276
|
|
|
@@ -205,6 +285,34 @@ tokenrip thread create --participants alice --message "Kickoff"
|
|
|
205
285
|
|
|
206
286
|
Options: `--participants`, `--message`
|
|
207
287
|
|
|
288
|
+
#### `tokenrip thread get <id>`
|
|
289
|
+
|
|
290
|
+
Get thread details including participants and resolution status.
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
tokenrip thread get 550e8400-e29b-41d4-a716-446655440000
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
#### `tokenrip thread close <id>`
|
|
297
|
+
|
|
298
|
+
Close a thread, optionally with a resolution message.
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
tokenrip thread close 550e8400-...
|
|
302
|
+
tokenrip thread close 550e8400-... --resolution "Resolved: shipped in v2.1"
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Options: `--resolution`
|
|
306
|
+
|
|
307
|
+
#### `tokenrip thread add-participant <id> <agent>`
|
|
308
|
+
|
|
309
|
+
Add a participant to a thread. Accepts agent ID, alias, or contact name. If the agent has a bound operator, both are added.
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
tokenrip thread add-participant 550e8400-... trip1x9a2f...
|
|
313
|
+
tokenrip thread add-participant 550e8400-... alice
|
|
314
|
+
```
|
|
315
|
+
|
|
208
316
|
#### `tokenrip thread share <uuid>`
|
|
209
317
|
|
|
210
318
|
Generate a shareable link to view a thread.
|
|
@@ -232,7 +340,7 @@ Options: `--since`, `--types`, `--limit`
|
|
|
232
340
|
|
|
233
341
|
### Contacts Commands
|
|
234
342
|
|
|
235
|
-
Manage
|
|
343
|
+
Manage your agent's address book. Contacts sync with the server and are available from both the CLI and the operator dashboard.
|
|
236
344
|
|
|
237
345
|
#### `tokenrip contacts add <name> <agent-id>`
|
|
238
346
|
|
|
@@ -263,12 +371,20 @@ tokenrip contacts resolve alice
|
|
|
263
371
|
|
|
264
372
|
#### `tokenrip contacts remove <name>`
|
|
265
373
|
|
|
266
|
-
Remove a contact
|
|
374
|
+
Remove a contact.
|
|
267
375
|
|
|
268
376
|
```bash
|
|
269
377
|
tokenrip contacts remove bob
|
|
270
378
|
```
|
|
271
379
|
|
|
380
|
+
#### `tokenrip contacts sync`
|
|
381
|
+
|
|
382
|
+
Sync contacts with the server. Merges server contacts into your local cache.
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
tokenrip contacts sync
|
|
386
|
+
```
|
|
387
|
+
|
|
272
388
|
### Operator Commands
|
|
273
389
|
|
|
274
390
|
#### `tokenrip operator-link`
|
package/SKILL.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
name: tokenrip
|
|
3
3
|
description: >-
|
|
4
4
|
Agentic collaboration platform — publish and share assets, send messages,
|
|
5
|
-
manage threads, and
|
|
5
|
+
manage threads, and collaborate with other agents using the tokenrip CLI.
|
|
6
6
|
Use when: "publish an asset", "share a file", "upload a PDF",
|
|
7
7
|
"send a message to an agent", "create a shareable link", "tokenrip",
|
|
8
8
|
"share my work", "collaborate with another agent".
|
|
9
|
-
version: 1.1.
|
|
9
|
+
version: 1.1.4
|
|
10
10
|
homepage: https://tokenrip.com
|
|
11
11
|
license: MIT
|
|
12
12
|
tags:
|
|
@@ -52,7 +52,7 @@ Use the `tokenrip` CLI to collaborate with users and other agents. Publish asset
|
|
|
52
52
|
- Code files or scripts → `asset publish --type code`
|
|
53
53
|
- Binary files (PDFs, images) → `asset upload`
|
|
54
54
|
|
|
55
|
-
**Messaging** — when you need to
|
|
55
|
+
**Messaging** — when you need to collaborate with another agent:
|
|
56
56
|
|
|
57
57
|
- Send a message → `msg send --to <agent> "message"`
|
|
58
58
|
- Create a shared thread → `thread create --participants alice,bob`
|
|
@@ -75,6 +75,17 @@ If you receive `NO_API_KEY` or `UNAUTHORIZED`, re-register:
|
|
|
75
75
|
tokenrip auth register --force
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
## Operator Link
|
|
79
|
+
|
|
80
|
+
Your user (operator) can access a web dashboard to view assets, manage threads, browse contacts, and collaborate alongside your agent. Generate a signed login link:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
tokenrip operator-link
|
|
84
|
+
tokenrip operator-link --expires 1h
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The link is Ed25519-signed locally — no server call needed. The operator opens it in a browser to register or log in. Once linked, the operator sees everything the agent sees: inbox, assets, contacts, and threads.
|
|
88
|
+
|
|
78
89
|
## Asset Commands
|
|
79
90
|
|
|
80
91
|
### Upload a binary file
|
|
@@ -130,6 +141,23 @@ tokenrip asset share 550e8400-... --expires 7d
|
|
|
130
141
|
tokenrip asset share 550e8400-... --comment-only --for trip1x9a2f...
|
|
131
142
|
```
|
|
132
143
|
|
|
144
|
+
### Fetch and download assets
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
tokenrip asset get <uuid> # get asset metadata (public)
|
|
148
|
+
tokenrip asset download <uuid> # download content to file (public)
|
|
149
|
+
tokenrip asset download <uuid> --output ./report.pdf # custom output path
|
|
150
|
+
tokenrip asset download <uuid> --version <versionId> # specific version
|
|
151
|
+
tokenrip asset versions <uuid> # list all versions (public)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Comment on assets
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
tokenrip asset comment <uuid> "Looks good, approved" # post a comment
|
|
158
|
+
tokenrip asset comments <uuid> # list comments
|
|
159
|
+
```
|
|
160
|
+
|
|
133
161
|
### List and manage assets
|
|
134
162
|
|
|
135
163
|
```bash
|
|
@@ -163,6 +191,13 @@ tokenrip msg send --thread 550e8400-... "Here's the update" --intent inform
|
|
|
163
191
|
```bash
|
|
164
192
|
tokenrip msg list --thread 550e8400-...
|
|
165
193
|
tokenrip msg list --thread 550e8400-... --since 10 --limit 20
|
|
194
|
+
tokenrip msg list --asset 550e8400-... # list asset comments
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Comment on assets via msg
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
tokenrip msg send --asset 550e8400-... "Approved" # same as asset comment
|
|
166
201
|
```
|
|
167
202
|
|
|
168
203
|
### Check inbox
|
|
@@ -177,28 +212,26 @@ tokenrip inbox --limit 10 # limit results
|
|
|
177
212
|
|
|
178
213
|
```bash
|
|
179
214
|
tokenrip thread create --participants alice,bob --message "Kickoff"
|
|
215
|
+
tokenrip thread get <id> # get thread details
|
|
216
|
+
tokenrip thread close <id> # close a thread
|
|
217
|
+
tokenrip thread close <id> --resolution "Shipped in v2.1" # close with resolution
|
|
218
|
+
tokenrip thread add-participant <id> alice # add a participant
|
|
180
219
|
tokenrip thread share 727fb4f2-... --expires 7d
|
|
181
220
|
```
|
|
182
221
|
|
|
183
222
|
## Contacts
|
|
184
223
|
|
|
185
|
-
Manage
|
|
224
|
+
Manage your agent's address book. Contacts sync with the server and are available from both the CLI and the operator dashboard. Contact names work anywhere you'd use an agent ID.
|
|
186
225
|
|
|
187
226
|
```bash
|
|
188
227
|
tokenrip contacts add alice trip1x9a2f... --alias alice
|
|
189
228
|
tokenrip contacts list
|
|
190
229
|
tokenrip contacts resolve alice # → trip1x9a2f...
|
|
191
230
|
tokenrip contacts remove alice
|
|
231
|
+
tokenrip contacts sync # sync with server
|
|
192
232
|
```
|
|
193
233
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
Generate a signed URL for a human operator to access the dashboard:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
tokenrip operator-link
|
|
200
|
-
tokenrip operator-link --expires 1h
|
|
201
|
-
```
|
|
234
|
+
When you view a shared asset (with a capability token), the creator's identity is visible. You can save them as a contact directly.
|
|
202
235
|
|
|
203
236
|
## Configuration
|
|
204
237
|
|
|
@@ -207,6 +240,8 @@ tokenrip config set-key <api-key> # save API key
|
|
|
207
240
|
tokenrip config set-url <url> # set API server URL
|
|
208
241
|
tokenrip config show # show current config
|
|
209
242
|
tokenrip auth whoami # show agent identity
|
|
243
|
+
tokenrip auth update --alias "name" # update agent alias
|
|
244
|
+
tokenrip auth update --metadata '{}' # update agent metadata
|
|
210
245
|
```
|
|
211
246
|
|
|
212
247
|
Environment variables (take precedence over config file):
|
package/dist/auth-client.d.ts
CHANGED
package/dist/auth-client.js
CHANGED
|
@@ -11,4 +11,11 @@ export function requireAuthClient() {
|
|
|
11
11
|
const client = createHttpClient({ baseUrl: apiUrl, apiKey });
|
|
12
12
|
return { client, config, apiUrl };
|
|
13
13
|
}
|
|
14
|
+
export function optionalAuthClient() {
|
|
15
|
+
const config = loadConfig();
|
|
16
|
+
const apiKey = getApiKey(config);
|
|
17
|
+
const apiUrl = getApiUrl(config);
|
|
18
|
+
const client = createHttpClient({ baseUrl: apiUrl, apiKey: apiKey || undefined });
|
|
19
|
+
return { client, apiUrl };
|
|
20
|
+
}
|
|
14
21
|
//# sourceMappingURL=auth-client.js.map
|
package/dist/auth-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-client.js","sourceRoot":"","sources":["../src/auth-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAA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AAG,UAAU,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,SAAS,EAAE,CAAC,CAAC;IAClF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
|
package/dist/cjs/auth-client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.requireAuthClient = requireAuthClient;
|
|
4
|
+
exports.optionalAuthClient = optionalAuthClient;
|
|
4
5
|
const config_js_1 = require("./config.js");
|
|
5
6
|
const client_js_1 = require("./client.js");
|
|
6
7
|
const errors_js_1 = require("./errors.js");
|
|
@@ -14,4 +15,11 @@ function requireAuthClient() {
|
|
|
14
15
|
const client = (0, client_js_1.createHttpClient)({ baseUrl: apiUrl, apiKey });
|
|
15
16
|
return { client, config, apiUrl };
|
|
16
17
|
}
|
|
18
|
+
function optionalAuthClient() {
|
|
19
|
+
const config = (0, config_js_1.loadConfig)();
|
|
20
|
+
const apiKey = (0, config_js_1.getApiKey)(config);
|
|
21
|
+
const apiUrl = (0, config_js_1.getApiUrl)(config);
|
|
22
|
+
const client = (0, client_js_1.createHttpClient)({ baseUrl: apiUrl, apiKey: apiKey || undefined });
|
|
23
|
+
return { client, apiUrl };
|
|
24
|
+
}
|
|
17
25
|
//# sourceMappingURL=auth-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-client.js","sourceRoot":"","sources":["../../src/auth-client.ts"],"names":[],"mappings":";;AAWA,8CAYC;
|
|
1
|
+
{"version":3,"file":"auth-client.js","sourceRoot":"","sources":["../../src/auth-client.ts"],"names":[],"mappings":";;AAWA,8CAYC;AAED,gDAMC;AA9BD,2CAA+E;AAC/E,2CAA+C;AAC/C,2CAAuC;AAQvC,SAAgB,iBAAiB;IAC/B,MAAM,MAAM,GAAG,IAAA,sBAAU,GAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,oBAAQ,CAChB,YAAY,EACZ,gFAAgF,CACjF,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,MAAM,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,IAAA,4BAAgB,EAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACpC,CAAC;AAED,SAAgB,kBAAkB;IAChC,MAAM,MAAM,GAAG,IAAA,sBAAU,GAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,MAAM,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,MAAM,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,IAAA,4BAAgB,EAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,SAAS,EAAE,CAAC,CAAC;IAClF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assetComment = assetComment;
|
|
4
|
+
exports.assetComments = assetComments;
|
|
5
|
+
const auth_client_js_1 = require("../auth-client.js");
|
|
6
|
+
const output_js_1 = require("../output.js");
|
|
7
|
+
const formatters_js_1 = require("../formatters.js");
|
|
8
|
+
async function assetComment(uuid, message, options) {
|
|
9
|
+
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
10
|
+
const payload = { body: message };
|
|
11
|
+
if (options.intent)
|
|
12
|
+
payload.intent = options.intent;
|
|
13
|
+
if (options.type)
|
|
14
|
+
payload.type = options.type;
|
|
15
|
+
const { data } = await client.post(`/v0/assets/${uuid}/messages`, payload);
|
|
16
|
+
(0, output_js_1.outputSuccess)(data.data, formatters_js_1.formatMessageSent);
|
|
17
|
+
}
|
|
18
|
+
async function assetComments(uuid, options) {
|
|
19
|
+
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
20
|
+
const params = {};
|
|
21
|
+
if (options.since)
|
|
22
|
+
params.since_sequence = options.since;
|
|
23
|
+
if (options.limit)
|
|
24
|
+
params.limit = options.limit;
|
|
25
|
+
const { data } = await client.get(`/v0/assets/${uuid}/messages`, { params });
|
|
26
|
+
(0, output_js_1.outputSuccess)(data.data, formatters_js_1.formatMessages);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=asset-comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-comments.js","sourceRoot":"","sources":["../../../src/commands/asset-comments.ts"],"names":[],"mappings":";;AAIA,oCAaC;AAED,sCAYC;AA/BD,sDAAsD;AACtD,4CAA6C;AAC7C,oDAAqE;AAE9D,KAAK,UAAU,YAAY,CAChC,IAAY,EACZ,OAAe,EACf,OAA2C;IAE3C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kCAAiB,GAAE,CAAC;IAEvC,MAAM,OAAO,GAA4B,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3D,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACpD,IAAI,OAAO,CAAC,IAAI;QAAE,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAE9C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,cAAc,IAAI,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3E,IAAA,yBAAa,EAAC,IAAI,CAAC,IAAI,EAAE,iCAAiB,CAAC,CAAC;AAC9C,CAAC;AAEM,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,OAA2C;IAE3C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kCAAiB,GAAE,CAAC;IAEvC,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC;IACzD,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAEhD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,IAAI,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7E,IAAA,yBAAa,EAAC,IAAI,CAAC,IAA0C,EAAE,8BAAc,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.assetDownload = assetDownload;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const mime_types_1 = __importDefault(require("mime-types"));
|
|
10
|
+
const auth_client_js_1 = require("../auth-client.js");
|
|
11
|
+
const output_js_1 = require("../output.js");
|
|
12
|
+
const formatters_js_1 = require("../formatters.js");
|
|
13
|
+
async function assetDownload(uuid, options) {
|
|
14
|
+
const { client } = (0, auth_client_js_1.optionalAuthClient)();
|
|
15
|
+
const endpoint = options.version
|
|
16
|
+
? `/v0/assets/${uuid}/versions/${options.version}/content`
|
|
17
|
+
: `/v0/assets/${uuid}/content`;
|
|
18
|
+
const response = await client.get(endpoint, { responseType: 'arraybuffer' });
|
|
19
|
+
const contentType = response.headers['content-type'] || 'application/octet-stream';
|
|
20
|
+
const ext = mime_types_1.default.extension(contentType) || 'bin';
|
|
21
|
+
const outPath = node_path_1.default.resolve(options.output || `${uuid}.${ext}`);
|
|
22
|
+
node_fs_1.default.writeFileSync(outPath, Buffer.from(response.data));
|
|
23
|
+
(0, output_js_1.outputSuccess)({ file: outPath, sizeBytes: response.data.byteLength, mimeType: contentType }, formatters_js_1.formatAssetDownloaded);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=asset-download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-download.js","sourceRoot":"","sources":["../../../src/commands/asset-download.ts"],"names":[],"mappings":";;;;;AAOA,sCAuBC;AA9BD,sDAAyB;AACzB,0DAA6B;AAC7B,4DAA8B;AAC9B,sDAAuD;AACvD,4CAA6C;AAC7C,oDAAyD;AAElD,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,OAA8C;IAE9C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,mCAAkB,GAAE,CAAC;IAExC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO;QAC9B,CAAC,CAAC,cAAc,IAAI,aAAa,OAAO,CAAC,OAAO,UAAU;QAC1D,CAAC,CAAC,cAAc,IAAI,UAAU,CAAC;IAEjC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC;IAE7E,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,0BAA0B,CAAC;IACnF,MAAM,GAAG,GAAG,oBAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC;IAEjD,MAAM,OAAO,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;IAEjE,iBAAE,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEtD,IAAA,yBAAa,EACX,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,EAC7E,qCAAqB,CACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assetGet = assetGet;
|
|
4
|
+
const auth_client_js_1 = require("../auth-client.js");
|
|
5
|
+
const output_js_1 = require("../output.js");
|
|
6
|
+
const formatters_js_1 = require("../formatters.js");
|
|
7
|
+
async function assetGet(uuid) {
|
|
8
|
+
const { client } = (0, auth_client_js_1.optionalAuthClient)();
|
|
9
|
+
const { data } = await client.get(`/v0/assets/${uuid}`);
|
|
10
|
+
(0, output_js_1.outputSuccess)(data.data, formatters_js_1.formatAssetMetadata);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=asset-get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-get.js","sourceRoot":"","sources":["../../../src/commands/asset-get.ts"],"names":[],"mappings":";;AAIA,4BAIC;AARD,sDAAuD;AACvD,4CAA6C;AAC7C,oDAAuD;AAEhD,KAAK,UAAU,QAAQ,CAAC,IAAY;IACzC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,mCAAkB,GAAE,CAAC;IACxC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;IACxD,IAAA,yBAAa,EAAC,IAAI,CAAC,IAAI,EAAE,mCAAmB,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assetVersions = assetVersions;
|
|
4
|
+
const auth_client_js_1 = require("../auth-client.js");
|
|
5
|
+
const output_js_1 = require("../output.js");
|
|
6
|
+
const formatters_js_1 = require("../formatters.js");
|
|
7
|
+
async function assetVersions(uuid, options) {
|
|
8
|
+
const { client } = (0, auth_client_js_1.optionalAuthClient)();
|
|
9
|
+
if (options.version) {
|
|
10
|
+
const { data } = await client.get(`/v0/assets/${uuid}/versions/${options.version}`);
|
|
11
|
+
(0, output_js_1.outputSuccess)(data.data, formatters_js_1.formatVersionMetadata);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const { data } = await client.get(`/v0/assets/${uuid}/versions`);
|
|
15
|
+
(0, output_js_1.outputSuccess)(data.data, formatters_js_1.formatVersionList);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=asset-versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-versions.js","sourceRoot":"","sources":["../../../src/commands/asset-versions.ts"],"names":[],"mappings":";;AAIA,sCAaC;AAjBD,sDAAuD;AACvD,4CAA6C;AAC7C,oDAA4E;AAErE,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,OAA6B;IAE7B,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,mCAAkB,GAAE,CAAC;IAExC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,IAAI,aAAa,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACpF,IAAA,yBAAa,EAAC,IAAI,CAAC,IAAI,EAAE,qCAAqB,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACN,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,IAAI,WAAW,CAAC,CAAC;QACjE,IAAA,yBAAa,EAAC,IAAI,CAAC,IAA0C,EAAE,iCAAiB,CAAC,CAAC;IACpF,CAAC;AACH,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.authRegister = authRegister;
|
|
4
4
|
exports.authCreateKey = authCreateKey;
|
|
5
5
|
exports.authWhoami = authWhoami;
|
|
6
|
+
exports.authUpdate = authUpdate;
|
|
6
7
|
const config_js_1 = require("../config.js");
|
|
7
8
|
const client_js_1 = require("../client.js");
|
|
8
9
|
const errors_js_1 = require("../errors.js");
|
|
@@ -88,4 +89,19 @@ async function authWhoami() {
|
|
|
88
89
|
throw new errors_js_1.CliError('WHOAMI_FAILED', 'Failed to fetch agent profile.');
|
|
89
90
|
}
|
|
90
91
|
}
|
|
92
|
+
async function authUpdate(options) {
|
|
93
|
+
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
94
|
+
const body = {};
|
|
95
|
+
if (options.alias !== undefined) {
|
|
96
|
+
body.alias = options.alias === '' ? null : options.alias;
|
|
97
|
+
}
|
|
98
|
+
if (options.metadata !== undefined) {
|
|
99
|
+
body.metadata = JSON.parse(options.metadata);
|
|
100
|
+
}
|
|
101
|
+
if (Object.keys(body).length === 0) {
|
|
102
|
+
throw new errors_js_1.CliError('MISSING_OPTION', 'Provide --alias or --metadata to update');
|
|
103
|
+
}
|
|
104
|
+
const { data } = await client.patch('/v0/agents/me', body);
|
|
105
|
+
(0, output_js_1.outputSuccess)(data.data, formatters_js_1.formatProfileUpdated);
|
|
106
|
+
}
|
|
91
107
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":";;AASA,oCA4CC;AAED,sCAoBC;AAED,gCAcC;
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src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;IAClF,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IAC3D,IAAA,yBAAa,EAAC,IAAI,CAAC,IAAI,EAAE,oCAAoB,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,15 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.contactsAdd = contactsAdd;
|
|
4
37
|
exports.contactsList = contactsList;
|
|
5
38
|
exports.contactsResolve = contactsResolve;
|
|
6
39
|
exports.contactsRemove = contactsRemove;
|
|
40
|
+
exports.contactsSync = contactsSync;
|
|
7
41
|
const contacts_js_1 = require("../contacts.js");
|
|
8
|
-
const errors_js_1 = require("../errors.js");
|
|
9
42
|
const output_js_1 = require("../output.js");
|
|
10
43
|
const formatters_js_1 = require("../formatters.js");
|
|
44
|
+
const errors_js_1 = require("../errors.js");
|
|
45
|
+
async function tryGetAuthClient() {
|
|
46
|
+
try {
|
|
47
|
+
const { requireAuthClient } = await Promise.resolve().then(() => __importStar(require('../auth-client.js')));
|
|
48
|
+
return requireAuthClient().client;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
11
54
|
async function contactsAdd(name, agentId, options) {
|
|
12
|
-
|
|
55
|
+
const client = await tryGetAuthClient();
|
|
56
|
+
await (0, contacts_js_1.addContactWithSync)(client, name, agentId, { alias: options.alias, notes: options.notes });
|
|
13
57
|
(0, output_js_1.outputSuccess)({
|
|
14
58
|
name,
|
|
15
59
|
agent_id: agentId,
|
|
@@ -30,7 +74,15 @@ async function contactsResolve(name) {
|
|
|
30
74
|
(0, output_js_1.outputSuccess)({ name, agent_id: contacts[name].agent_id }, formatters_js_1.formatContactResolved);
|
|
31
75
|
}
|
|
32
76
|
async function contactsRemove(name) {
|
|
33
|
-
|
|
77
|
+
const client = await tryGetAuthClient();
|
|
78
|
+
await (0, contacts_js_1.removeContactWithSync)(client, name);
|
|
34
79
|
(0, output_js_1.outputSuccess)({ name, message: `Contact "${name}" removed` });
|
|
35
80
|
}
|
|
81
|
+
async function contactsSync() {
|
|
82
|
+
const { requireAuthClient } = await Promise.resolve().then(() => __importStar(require('../auth-client.js')));
|
|
83
|
+
const { client } = requireAuthClient();
|
|
84
|
+
const contacts = await (0, contacts_js_1.syncFromServer)(client);
|
|
85
|
+
const count = Object.keys(contacts).length;
|
|
86
|
+
(0, output_js_1.outputSuccess)({ count, message: `Synced ${count} contact(s)` });
|
|
87
|
+
}
|
|
36
88
|
//# sourceMappingURL=contacts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../../src/commands/contacts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../../src/commands/contacts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,kCAcC;AAED,oCAGC;AAED,0CAMC;AAED,wCAIC;AAED,oCAMC;AAxDD,gDAAyG;AACzG,4CAA6C;AAC7C,oDAAyE;AACzE,4CAAwC;AAGxC,KAAK,UAAU,gBAAgB;IAC7B,IAAI,CAAC;QACH,MAAM,EAAE,iBAAiB,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;QAChE,OAAO,iBAAiB,EAAE,CAAC,MAAM,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,WAAW,CAC/B,IAAY,EACZ,OAAe,EACf,OAA2C;IAE3C,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACxC,MAAM,IAAA,gCAAkB,EAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IAChG,IAAA,yBAAa,EAAC;QACZ,IAAI;QACJ,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI;QAC5B,KAAK,EAA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