@crabcloud/cli 0.1.5 → 0.1.7

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/crab.js CHANGED
@@ -5829,7 +5829,8 @@ var deviceStartInput = object({
5829
5829
  var devicePollInput = object({ deviceCode: string2().min(16).max(200) });
5830
5830
  var deviceDecisionInput = object({
5831
5831
  userCode: string2().trim().min(4).max(16),
5832
- decision: _enum(["approve", "deny"])
5832
+ decision: _enum(["approve", "deny"]),
5833
+ scopes: array(_enum(scopes)).min(1).max(64).optional()
5833
5834
  });
5834
5835
  var agentTokenSummarySchema = object({
5835
5836
  id: string2(),
@@ -5939,7 +5940,8 @@ var mailSendInput = object({
5939
5940
  cc: mailRecipientList.default([]),
5940
5941
  subject: string2().trim().min(1).max(200),
5941
5942
  body: string2().min(1).max(1e5),
5942
- inReplyTo: string2().max(998).optional()
5943
+ inReplyTo: string2().max(998).optional(),
5944
+ attachmentIds: array(string2().min(1).max(64)).max(10).optional()
5943
5945
  });
5944
5946
  var mailDraftInput = object({
5945
5947
  to: mailRecipientList.default([]),
@@ -5947,11 +5949,17 @@ var mailDraftInput = object({
5947
5949
  subject: string2().trim().max(200).default(""),
5948
5950
  body: string2().max(1e5).default("")
5949
5951
  });
5952
+ var mailReadInput = object({ unread: boolean2() });
5950
5953
  var mailDevInboundInput = object({
5951
5954
  from: mailAddressSchema,
5952
5955
  to: mailAddressSchema,
5953
5956
  subject: string2().trim().min(1).max(200),
5954
- body: string2().max(1e5)
5957
+ body: string2().max(1e5),
5958
+ attachments: array(object({
5959
+ filename: string2().min(1).max(120),
5960
+ mimeType: string2().regex(/^[\w.+-]+\/[\w.+-]+$/).max(100),
5961
+ contentBase64: string2().max(35000000)
5962
+ })).max(10).optional()
5955
5963
  });
5956
5964
  var contactAddressSchema = mailAddressSchema;
5957
5965
  var contactCreateInput = object({
@@ -6257,6 +6265,7 @@ var usage = `crab — Crab Cloud CLI(Agent-first 入口)
6257
6265
  mail read <id> [--json] 读取邮件正文(自动置已读)
6258
6266
  mail search <query> [--json] 全文搜索(主题/发件人/收件人/正文)
6259
6267
  mail send --to a@x.cc,b@y.cn [--cc c@z.io] --subject "..." --body "..." | --body-file <path>
6268
+ [--in-reply-to <message-id>] 回信线程锚点(原信 RFC Message-ID,crab mail read 可见)
6260
6269
  发送邮件:平台内(@crabcloud.cc)免费,外部出站 2 积分/封
6261
6270
  mail archive|trash|delete <id> 移夹 / 废纸篓 / 彻底删除(delete 不可恢复)
6262
6271
  skills install|list|uninstall [--agent claude,zcode,codex,agents]
@@ -6484,6 +6493,10 @@ async function mailRead(id) {
6484
6493
  console.log(` 收件人: ${mail.to.join(", ")}${mail.cc.length > 0 ? `
6485
6494
  抄送: ${mail.cc.join(", ")}` : ""}`);
6486
6495
  console.log(` 时间: ${formatTime(mail.createdAt)}`);
6496
+ if (mail.rfcMessageId)
6497
+ console.log(` Message-ID: ${mail.rfcMessageId}`);
6498
+ if (mail.inReplyTo)
6499
+ console.log(` 回复: ${mail.inReplyTo}`);
6487
6500
  console.log("");
6488
6501
  console.log(mail.bodyText);
6489
6502
  if (mail.actors.length > 0) {
@@ -6527,8 +6540,9 @@ async function mailSend() {
6527
6540
  const subject = readFlag("--subject") ?? "";
6528
6541
  const bodyFlag = readFlag("--body");
6529
6542
  const bodyFile = readFlag("--body-file");
6543
+ const inReplyTo = readFlag("--in-reply-to") ?? undefined;
6530
6544
  if (to.length === 0 || !subject || !bodyFlag && !bodyFile) {
6531
- console.error('用法:crab mail send --to a@x.cc[,b@y.cn] [--cc c@z.io] --subject "..." --body "..." | --body-file <path>');
6545
+ console.error('用法:crab mail send --to a@x.cc[,b@y.cn] [--cc c@z.io] --subject "..." --body "..." | --body-file <path> [--in-reply-to <message-id>]');
6532
6546
  return EXIT_USAGE;
6533
6547
  }
6534
6548
  let body = bodyFlag ?? "";
@@ -6546,7 +6560,7 @@ async function mailSend() {
6546
6560
  const res = await api2(credentials.apiBase, "/v1/mail/messages", {
6547
6561
  method: "POST",
6548
6562
  headers: authHeaders(credentials),
6549
- body: JSON.stringify({ to, cc, subject, body })
6563
+ body: JSON.stringify({ to, cc, subject, body, ...inReplyTo ? { inReplyTo } : {} })
6550
6564
  });
6551
6565
  if (res.status !== 200 && res.status !== 201) {
6552
6566
  console.error(errorMessage(res.body, "发送失败。"));
@@ -18,7 +18,9 @@ Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,
18
18
  `npx @crabcloud/cli init`(登录 + 安装本 skill 一步完成);已装过但命令缺失
19
19
  时运行 `npx @crabcloud/cli@latest init` 升级。
20
20
  - `crab whoami` 报「未登录」或退出码 3 → 引导用户 `crab login`。登录走浏览器
21
- 设备授权(用户逐条确认 scope)——**你只发起,不代批**。
21
+ 设备授权——授权页摆出全目录供用户勾选,**实际授予集由人定**,可能多于或少于
22
+ `--scopes` 请求——**你只发起,不代批**;登录后先 `crab whoami` 核对实际
23
+ scopes 再干活,缺什么就引导用户带组名/scope 重新授权。
22
24
  - 永远不要让用户把 token 粘贴进对话;凭证文件与你无关,也不要读取它。
23
25
 
24
26
  ## 意图 → 命令映射
@@ -61,9 +63,9 @@ Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,
61
63
  - **scope 最小化**:建议按需授权(只读场景 `crab login --scopes account.read`),
62
64
  不要怂恿用户一次性给全量 scope。`--scopes` 支持组名(`mail` = 读写搜删四项
63
65
  整组)与单个 scope 混用;组目录见 `crab help`,可用组:account / mail /
64
- files / collab / contacts。
66
+ storage(云盘,含素材与附件)/ collab / contacts。
65
67
  - 如实转述能力边界:云盘已在网页上线但 agent 通道尚未开放(没有
66
- `crab files` 等命令),协作、联系人尚未上线——相关请求如实说明,引导用户
68
+ `crab storage` 等命令),协作、联系人尚未上线——相关请求如实说明,引导用户
67
69
  用网页(crabcloud.cc),不要编造命令或输出;邮箱请求转交 `crabcloud-mail` skill。
68
70
  - 账号安全操作(修改密码、登录设备/会话的查看与吊销)**有意不开放给 agent
69
71
  通道**:改密对令牌持有者是账号接管面,会话属于"人的浏览器会话"。用户让
@@ -27,6 +27,7 @@ description: Read, search and send the user's Crab Cloud platform email (usernam
27
27
  | 读某封邮件 | `crab mail read <id>`(自动置已读;正文 + 操作记录) |
28
28
  | 找邮件 | `crab mail search <关键词>`(主题/发件人/收件人/正文,不含废纸篓) |
29
29
  | 发邮件 | `crab mail send --to a@x.cc --subject "..." --body "..."`(长正文用 `--body-file`) |
30
+ | 回信(带线程锚点) | 先 `crab mail read <id>` 取 Message-ID,再 `crab mail send --to … --in-reply-to <message-id> …` |
30
31
  | 整理邮箱 | `crab mail archive <id>` / `crab mail trash <id>` / `crab mail delete <id>` |
31
32
 
32
33
  拿不准邮件 id 时先 `crab mail list` / `crab mail search` 核对再操作。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crabcloud/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "Crab Cloud CLI (crab) — agent-first entry to your personal cloud, with skills bundled for Claude Code / Codex / ZCode.",
6
6
  "bin": {