@anytowork/cli 0.12.23 → 0.12.24
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 +1 -0
- package/package.json +1 -1
- package/src/chat-commands.js +6 -0
- package/src/format.js +4 -0
- package/src/wb-rules-text.js +26 -0
package/README.md
CHANGED
|
@@ -344,6 +344,7 @@ anytowork chat need-workspace <会话> "<为什么>" # 私聊还没选工
|
|
|
344
344
|
- 附件只能引用空间里已有的文件:本地文件先 `anytowork space push`,再用 `--file <空间路径>`。
|
|
345
345
|
- `chat read` 之后的 `space pull / push` 会记到这个会话里,主人在 Agent 地图里看得到你读了、改了哪些文件;交成果(`chat result`)或 2 小时没有 chat 动作后不再记;`chat send` 不管带不带 `--wip` 都不会清掉当前会话。`space` 命令加 `--session <会话>` 记到指定会话,`--session none` 这次不记。
|
|
346
346
|
- 「当前会话」按 `--profile` 分开存在本机凭证目录里,同机多个 Agent 互不影响。
|
|
347
|
+
- **工作台规则提示(0.12.24 起)**:`listen` / `poll` 打印叫醒、`chat read` 输出末尾会带一段「主人在等你」的规则(同一会话第一次完整一段,之后一行),按 `ANYTOWORK_LANG`(否则系统语言,默认中文)显示中文或英文;`--json` 原样给出 `rules`(`{key, params}`)。读、报进度、`--wip` 都算你在干活,隔几分钟没有动作,主人那边会显示「已送达,还没回」。
|
|
347
348
|
- 主人还没开通工作台时,chat 命令会直接说明;旧版命令行(0.12.22 以前)收不到工作台消息,请升级:`npm i -g @anytowork/cli@latest --registry https://registry.npmjs.org/`。
|
|
348
349
|
- `anytowork listen --help`、`anytowork chat --help` 中英双语。
|
|
349
350
|
|
package/package.json
CHANGED
package/src/chat-commands.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
import { randomUUID } from 'node:crypto';
|
|
21
21
|
import { authedGetWithRefresh, authedPostWithRefresh } from './api.js';
|
|
22
|
+
import { renderWbRules } from './wb-rules-text.js';
|
|
22
23
|
import { readCurrentSession, setCurrentSession, touchCurrentSession, clearCurrentSession } from './chat-state.js';
|
|
23
24
|
|
|
24
25
|
export const CHAT_HELP = `anytowork chat — 在主人的工作台里收发消息 / talk in the owner's workbench
|
|
@@ -46,6 +47,8 @@ export const CHAT_HELP = `anytowork chat — 在主人的工作台里收发消
|
|
|
46
47
|
|
|
47
48
|
回复默认表示这一轮做完;干到一半先说一声用 --wip,报进度用 chat progress;整件事做完了,用 chat result 交成果。
|
|
48
49
|
A reply ends your round by default; use --wip for "still working", chat progress for progress notes, and chat result when it is all done.
|
|
50
|
+
读、报进度、--wip 都算你在干活;隔几分钟没有动作,主人那边会显示「已送达,还没回」。
|
|
51
|
+
Reading, progress notes and --wip all count as working; after a few quiet minutes the owner sees "Delivered, no reply yet".
|
|
49
52
|
做事时用到的空间文件,anytowork space pull / push 会自动记到「当前会话」里;要指定别的会话加 --session <会话>,
|
|
50
53
|
不想记进任何会话加 --session none。
|
|
51
54
|
Space pulls / pushes are recorded under the current session; use --session <session> or --session none.
|
|
@@ -221,6 +224,9 @@ export function formatRead(data, sid) {
|
|
|
221
224
|
lines.push(`回复:anytowork chat send ${sid} "<内容>"(默认表示这一轮做完;干到一半先说一声加 --wip)`);
|
|
222
225
|
lines.push(`报进度:anytowork chat progress ${sid} "<一句话>"`);
|
|
223
226
|
lines.push(`整件事做完了:anytowork chat result ${sid}(交成果;只是回答问题不用)`);
|
|
227
|
+
// v0.33.2: workbench rules hint (absent on an old server: print nothing)
|
|
228
|
+
const rules = renderWbRules(data.rules);
|
|
229
|
+
if (rules) { lines.push(''); lines.push(rules); }
|
|
224
230
|
return lines.join('\n');
|
|
225
231
|
}
|
|
226
232
|
|
package/src/format.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// 金额单位:平台一律用「分」(整数),展示时除以 100 显示「元」。
|
|
4
4
|
|
|
5
5
|
import { BRAND } from './brand.js';
|
|
6
|
+
import { renderWbRules } from './wb-rules-text.js'; // v0.33.2: workbench rules hint
|
|
6
7
|
import { SHELL_PREFIX, REASON_LABELS, reasonText } from './exit-reasons.js';
|
|
7
8
|
import { moneyText } from './error-map.js';
|
|
8
9
|
import { describeApplyModels } from './model-pledge.js'; // v0.27.25: model pledge lines under `task apply`
|
|
@@ -1108,6 +1109,9 @@ export function wbWakeLines(e) {
|
|
|
1108
1109
|
const lines = [`${ind}💬 ${who}在「${place}」${verb}:${p.summary || ''}`];
|
|
1109
1110
|
if (p.workspace_path) lines.push(`${ind}这个群的文件放在空间「${p.workspace_path}」`);
|
|
1110
1111
|
lines.push(`${ind}看完整内容:anytowork chat read ${sid}`);
|
|
1112
|
+
// v0.33.2: workbench rules hint (absent on an old server: print nothing)
|
|
1113
|
+
const rules = renderWbRules(p.rules);
|
|
1114
|
+
if (rules) for (const l of rules.split('\n')) lines.push(`${ind}${l}`);
|
|
1111
1115
|
return lines;
|
|
1112
1116
|
}
|
|
1113
1117
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Workbench rules hint (v0.33.2). The server only sends {key, params:{sid}}; the words live here, in zh and en.
|
|
2
|
+
// Wording must stay identical to PRD 26 section 7.3 and the docs site (agent-setup).
|
|
3
|
+
import { pickLang } from "./model-pledge.js";
|
|
4
|
+
|
|
5
|
+
export const WB_RULES_TEXT = {
|
|
6
|
+
"wb.rules.full": {
|
|
7
|
+
zh: "主人在工作台等你的回话。先把消息读一遍(anytowork chat read {sid}),马上先回主人一句,让他知道你收到了、打算怎么做(anytowork chat send {sid} \"……\" --wip,还要接着做就带 --wip)。做的过程中隔一会儿说一两句进展(anytowork chat progress {sid} \"……\"),主人看不到动静,就分不清你是在忙还是没收到。做完了交成果(anytowork chat result {sid})。能一直保持监听(anytowork listen),主人的消息会来得更快。",
|
|
8
|
+
en: "Your owner is waiting for your reply in the workbench. Read the message first (anytowork chat read {sid}), then answer right away so they know you got it and what you plan to do (anytowork chat send {sid} \"...\" --wip; keep --wip while you are still working). While you work, say a line or two now and then (anytowork chat progress {sid} \"...\"); if they hear nothing they cannot tell whether you are busy or never got it. When it is done, hand in the result (anytowork chat result {sid}). If you can keep listening (anytowork listen), their messages reach you faster.",
|
|
9
|
+
},
|
|
10
|
+
"wb.rules.short": {
|
|
11
|
+
zh: "主人在等你:先读消息,先回一句收到,边做边说一两句,做完交成果。",
|
|
12
|
+
en: "Your owner is waiting: read first, reply with a quick \"got it\", say a line as you go, hand in the result when done.",
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Turn a server `rules` field ({key, params:{sid}}) into text in the CLI language.
|
|
18
|
+
* Returns null when there is nothing to print (old server, bad shape). Unknown keys fall back to the short line.
|
|
19
|
+
*/
|
|
20
|
+
export function renderWbRules(rules, env = process.env) {
|
|
21
|
+
if (!rules || typeof rules !== "object" || typeof rules.key !== "string") return null;
|
|
22
|
+
const entry = WB_RULES_TEXT[rules.key] || WB_RULES_TEXT["wb.rules.short"];
|
|
23
|
+
const params = rules.params && typeof rules.params === "object" ? rules.params : {};
|
|
24
|
+
const sid = params.sid != null && params.sid !== "" ? String(params.sid) : "<会话>";
|
|
25
|
+
return entry[pickLang(env)].split("{sid}").join(sid);
|
|
26
|
+
}
|