@heyamiko/amiko-cli 0.9.6-beta.0 → 0.9.6-beta.2
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/index.js +6 -17
- package/package.json +1 -1
- package/skills/SKILL.md +2 -1
package/dist/index.js
CHANGED
|
@@ -21916,31 +21916,20 @@ function registerConversationCommand(program2) {
|
|
|
21916
21916
|
process.exit(1);
|
|
21917
21917
|
}
|
|
21918
21918
|
});
|
|
21919
|
-
program2.command("send").description("Send a message into a conversation").requiredOption("--id <conversationId>", "Target conversation id").requiredOption("--message <text>", "Message body").option("--reply-to <messageId>", "Reply to a specific message").option("--json", "Output as JSON").action(async (opts) => {
|
|
21919
|
+
program2.command("send").description("Send a message into a conversation").requiredOption("--id <conversationId>", "Target conversation id").requiredOption("--message <text>", "Message body").option("--reply-to <messageId>", "Reply to a specific message").option("--as-agent", "Send as the twin agent (sender_type=agent, is_auto_reply=true). Twin must be a participant.").option("--json", "Output as JSON").action(async (opts) => {
|
|
21920
21920
|
const auth = requireAuth();
|
|
21921
|
-
const config2 = loadConfig();
|
|
21922
21921
|
const spinner = opts.json ? null : ora("Sending message...").start();
|
|
21923
21922
|
try {
|
|
21924
|
-
const
|
|
21925
|
-
const res = await fetch(url2, {
|
|
21923
|
+
const data = await amikoWebFetch(auth, `/api/conversations/${encodeURIComponent(opts.id)}/messages`, {
|
|
21926
21924
|
method: "POST",
|
|
21927
|
-
|
|
21928
|
-
Authorization: `Bearer ${auth.twinToken}`,
|
|
21929
|
-
"Content-Type": "application/json"
|
|
21930
|
-
},
|
|
21931
|
-
body: JSON.stringify({
|
|
21932
|
-
conversationId: opts.id,
|
|
21925
|
+
body: {
|
|
21933
21926
|
content: opts.message,
|
|
21934
21927
|
message_type: "text",
|
|
21935
|
-
...opts.replyTo ? { reply_to_id: opts.replyTo } : {}
|
|
21936
|
-
|
|
21928
|
+
...opts.replyTo ? { reply_to_id: opts.replyTo } : {},
|
|
21929
|
+
...opts.asAgent ? { as_agent: true } : {}
|
|
21930
|
+
}
|
|
21937
21931
|
});
|
|
21938
21932
|
spinner?.stop();
|
|
21939
|
-
if (!res.ok) {
|
|
21940
|
-
const text = await res.text().catch(() => "");
|
|
21941
|
-
throw new Error(`${res.status} POST /messages: ${text.slice(0, 300)}`);
|
|
21942
|
-
}
|
|
21943
|
-
const data = await res.json();
|
|
21944
21933
|
if (opts.json) {
|
|
21945
21934
|
console.log(JSON.stringify(data, null, 2));
|
|
21946
21935
|
return;
|
package/package.json
CHANGED
package/skills/SKILL.md
CHANGED
|
@@ -272,12 +272,13 @@ amiko conversation read --id <conversationId> # read recent messages (
|
|
|
272
272
|
amiko conversation read --id <id> --before-cursor <next_cursor> # page older messages
|
|
273
273
|
amiko conversation send --id <conversationId> --message "hi" # send a text message
|
|
274
274
|
amiko conversation send --id <id> --message "ok" --reply-to <messageId>
|
|
275
|
+
amiko conversation send --id <id> --message "agent reply" --as-agent # send as twin (sender_type=agent)
|
|
275
276
|
```
|
|
276
277
|
|
|
277
278
|
- `list` and `find` query amiko-web's `/api/conversations` (Prisma-backed). `find` filters client-side for a 2-user direct conversation containing both you and `--user-id`.
|
|
278
279
|
- `create` POSTs to `/api/conversations` with `conversation_type=direct`. The server reuses an existing conversation if one already exists between the two users (`reused_existing: true` in the JSON response), so calling it repeatedly is safe.
|
|
279
280
|
- `read` queries amiko-web's `GET /api/conversations/<id>/messages` (paginated by `next_cursor`, oldest-first per page).
|
|
280
|
-
- `send` posts to amiko-
|
|
281
|
+
- `send` posts to amiko-web's `POST /api/conversations/<id>/messages` with the Clawd twin token. The server persists the message and fans it out to other participants via the WebSocket broadcast.
|
|
281
282
|
- `--user-id` expects the **internal** user id (the one returned by `amiko users search`), not a Privy DID or handle.
|
|
282
283
|
|
|
283
284
|
## Composio
|