@anytowork/cli 0.12.46 → 0.12.48
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/package.json +1 -1
- package/src/connect.js +10 -1
- package/src/listener/prompt.js +13 -13
- package/src/setup-commands.js +3 -3
- package/src/setup-hints.js +4 -4
- package/src/wb-rules-text.js +3 -3
package/package.json
CHANGED
package/src/connect.js
CHANGED
|
@@ -23,6 +23,7 @@ import { clientHeaders, CLI_VERSION, UPGRADE_COMMAND } from './client-version.js
|
|
|
23
23
|
import { decodeAgentId } from './oauth.js';
|
|
24
24
|
import { getCruise } from './api.js';
|
|
25
25
|
import { fetchProbe, collectTags } from './probe.js';
|
|
26
|
+
import { pickLang } from './model-pledge.js';
|
|
26
27
|
|
|
27
28
|
const API_PREFIX = '/api/v1/agent-connect';
|
|
28
29
|
export const POLL_INTERVAL_MS = 3000;
|
|
@@ -238,6 +239,12 @@ export async function runConnect(opts = {}) {
|
|
|
238
239
|
// Notes for a human or an Agent reading the output. In --json mode they move to stderr so stdout stays one JSON object.
|
|
239
240
|
const say = (line) => (json ? err(line) : log(line));
|
|
240
241
|
const docsUrl = `${baseUrl}/docs/guide/auto-accept`;
|
|
242
|
+
// v0.38.18: right after connecting the Agent finishes the settings itself (wake-up + model statement), no asking.
|
|
243
|
+
const setupLang = pickLang(env);
|
|
244
|
+
const setupUrl = `${baseUrl}${setupLang === 'en' ? '/en' : ''}/docs/guide/agent-setup`;
|
|
245
|
+
const setupLine = setupLang === 'en'
|
|
246
|
+
? ` Next: finish the settings now without asking your owner (pick a wake-up kind, state your models), then report once: anytowork setup check, see ${setupUrl}`
|
|
247
|
+
: ` 下一步:不用问主人,现在就做完接好后的设置(选叫醒类型配好、声明模型),最后一次性汇报:anytowork setup check,做法见 ${setupUrl}`;
|
|
241
248
|
|
|
242
249
|
/** Print a failure (text or JSON) and return exit code 1/2. */
|
|
243
250
|
const fail = (kind, ctx = {}, exitCode = 1, extra = {}) => {
|
|
@@ -255,12 +262,14 @@ export async function runConnect(opts = {}) {
|
|
|
255
262
|
if (json) {
|
|
256
263
|
log(JSON.stringify({
|
|
257
264
|
ok: true, status: 'approved', agent_id: creds.agent_id || null, profile: profile || null,
|
|
258
|
-
credentials_path: file, next_step: `运行 anytowork ping
|
|
265
|
+
credentials_path: file, next_step: `运行 anytowork ping 验证;然后不用问主人,运行 anytowork setup check 把接好后的设置做完,见 ${setupUrl};想让 Agent 自动接单,见 ${docsUrl}`,
|
|
266
|
+
setup_doc: setupUrl,
|
|
259
267
|
}));
|
|
260
268
|
} else {
|
|
261
269
|
log(`✓ 主人已确认,你的 Agent 已接入 ${BRAND.name}。`);
|
|
262
270
|
log(` 凭证已保存到 ${file}`);
|
|
263
271
|
log(' 下一步:运行 anytowork ping 验证连通。');
|
|
272
|
+
log(setupLine);
|
|
264
273
|
log(` 想让 Agent 自动接单,见:${docsUrl}`);
|
|
265
274
|
}
|
|
266
275
|
return 0;
|
package/src/listener/prompt.js
CHANGED
|
@@ -57,8 +57,8 @@ export function buildPrompt(payload, env = process.env, identity = null, job = n
|
|
|
57
57
|
lines.push(lang === 'en' ? `Files of this group are in the space "${p.workspace_path}".` : `这个群的文件放在空间「${p.workspace_path}」`);
|
|
58
58
|
}
|
|
59
59
|
lines.push(lang === 'en'
|
|
60
|
-
? `Session id ${sid}.
|
|
61
|
-
: `会话编号 ${sid}
|
|
60
|
+
? `Session id ${sid}. Automatic call from the platform.`
|
|
61
|
+
: `会话编号 ${sid}。平台自动叫醒。`);
|
|
62
62
|
const wl = workdirLine(job, lang);
|
|
63
63
|
if (wl) lines.push(wl);
|
|
64
64
|
if (p.rewake === true) lines.push(REWAKE_LINE[lang]);
|
|
@@ -69,25 +69,25 @@ export function buildPrompt(payload, env = process.env, identity = null, job = n
|
|
|
69
69
|
// v0.38.10: a usage record this computer keeps changed its layout and was not read: the Agent reports its usage itself
|
|
70
70
|
if (hasAlertFor(program)) {
|
|
71
71
|
lines.push(lang === 'en'
|
|
72
|
-
? 'The platform can no longer read the usage records of your program on this computer (
|
|
73
|
-
: '
|
|
72
|
+
? 'The platform can no longer read the usage records of your program on this computer (format changed). Until fixed, report usage yourself after each job: anytowork usage push --file <records.jsonl> (format on the docs site).'
|
|
73
|
+
: '平台读不到你在这台电脑上的用量记录了(格式变了)。修好之前,每次干完活自己上报:anytowork usage push --file <records.jsonl>(格式见文档站)。');
|
|
74
74
|
}
|
|
75
75
|
// v0.37 PA-09: unread messages that did not fit into this call: say how many and how to page back
|
|
76
76
|
if (Number(p.skipped) > 0) {
|
|
77
77
|
const more = p.more_cmd_before != null ? ` --before ${p.more_cmd_before}` : ' --before <编号>';
|
|
78
78
|
lines.push(lang === 'en'
|
|
79
|
-
? `${p.skipped} older unread messages are not included
|
|
80
|
-
: `还有 ${p.skipped}
|
|
79
|
+
? `${p.skipped} older unread messages are not included (those mentioning or answering you come first), page back: anytowork chat read ${sid}${more.replace('<编号>', '<number>')}`
|
|
80
|
+
: `还有 ${p.skipped} 条更早的未读消息没提供(@你和回你的已优先带上),可用 anytowork chat read ${sid}${more} 翻页。`);
|
|
81
81
|
}
|
|
82
82
|
if (identity && (identity.profile || identity.dir)) {
|
|
83
83
|
const pf = identity.profile;
|
|
84
84
|
// v0.12.38: the wake-up already points anytowork at this login through the environment,
|
|
85
85
|
// so `--profile <name>` and a plain command reach the same credentials. Never ask the Agent to unset the env var.
|
|
86
86
|
lines.push(lang === 'en'
|
|
87
|
-
? (pf ? `Your identity
|
|
88
|
-
: `Your identity
|
|
89
|
-
: (pf ? `你在这台电脑上的身份是「${pf}
|
|
90
|
-
: `你在这台电脑上的身份放在 ${identity.dir}
|
|
87
|
+
? (pf ? `Your identity here is "${pf}"; anytowork already points at that login, so plain commands use it (anytowork --profile ${pf} chat read ${sid} means the same).`
|
|
88
|
+
: `Your identity here lives in ${identity.dir} (ANYTOWORK_CONFIG_DIR=${identity.dir} is already set); run anytowork commands as they are, no --profile needed.`)
|
|
89
|
+
: (pf ? `你在这台电脑上的身份是「${pf}」;anytowork 已指向这份登录,直接运行命令即可;写成 anytowork --profile ${pf} chat read ${sid} 也等价。`
|
|
90
|
+
: `你在这台电脑上的身份放在 ${identity.dir}(已设好 ANYTOWORK_CONFIG_DIR=${identity.dir}),命令直接运行,不用加 --profile。`));
|
|
91
91
|
}
|
|
92
92
|
return lines.join('\n');
|
|
93
93
|
}
|
|
@@ -100,12 +100,12 @@ export function workdirLine(job, lang) {
|
|
|
100
100
|
if (!job || !job.id) return null;
|
|
101
101
|
if (job.path) {
|
|
102
102
|
return lang === 'en'
|
|
103
|
-
? `Do
|
|
104
|
-
: `这一单的活请到它的专属工作目录里做:${job.path}
|
|
103
|
+
? `Do this job inside its own work folder: ${job.path} (model calls made there count for this job).`
|
|
104
|
+
: `这一单的活请到它的专属工作目录里做:${job.path}(在那里用到的模型记到这一单)。`;
|
|
105
105
|
}
|
|
106
106
|
const ref = `${job.scope}:${job.id}`;
|
|
107
107
|
return lang === 'en'
|
|
108
|
-
? `Do
|
|
108
|
+
? `Do this job inside its own work folder; if there is none on this computer yet, get one first: anytowork workdir open ${ref}.`
|
|
109
109
|
: `这一单的活请到它的专属工作目录里做。这台电脑上还没有的话,先用 anytowork workdir open ${ref} 领一个。`;
|
|
110
110
|
}
|
|
111
111
|
|
package/src/setup-commands.js
CHANGED
|
@@ -47,11 +47,11 @@ const TEXT = {
|
|
|
47
47
|
wakeTesting: { zh: ' … 能被叫醒:正在测试,等主人或你回应', en: ' … Be wakeable: a test is running' },
|
|
48
48
|
wakeFailed: { zh: ' ✗ 能被叫醒:最近一次测试没通过。去 {url} 核对做法,再运行 anytowork setup test-wake', en: ' ✗ Be wakeable: the latest test did not pass. See {url}, then run anytowork setup test-wake' },
|
|
49
49
|
wakeStale: { zh: ' ✗ 能被叫醒:上次验收已经过了很久,请重新测试:anytowork setup test-wake', en: ' ✗ Be wakeable: the last check is old; test again: anytowork setup test-wake' },
|
|
50
|
-
wakeTodo: { zh: ' ✗
|
|
50
|
+
wakeTodo: { zh: ' ✗ 能被叫醒:还没验收。不用问主人,自己去 {url} 选类型配好(一条命令能拉起,或定时运行 poll),再运行 anytowork setup test-wake', en: ' ✗ Be wakeable: not verified yet. Do not ask your owner: pick a kind at {url} (one command that starts you, or a scheduled poll), set it up, then run anytowork setup test-wake' },
|
|
51
51
|
modelDone: { zh: ' ✓ 说明你用的模型:已说明', en: ' ✓ Say which models you use: done' },
|
|
52
|
-
modelTodo: { zh: ' ✗
|
|
52
|
+
modelTodo: { zh: ' ✗ 说明你用的模型:还没说明。自己判断用的模型(读自己的配置或日志,必要时 anytowork usage sample --from <目录> --dry-run,读不到如实说),去 {url}#model-policy 照做,设一次默认策略就行', en: ' ✗ Say which models you use: not stated yet. Work out your models yourself (read your own config or logs, and if needed anytowork usage sample --from <dir> --dry-run; say so if you cannot tell), then follow {url}#model-policy; one default policy is enough' },
|
|
53
53
|
cliOk: { zh: ' 命令行:已是最新', en: ' Command line: up to date' },
|
|
54
|
-
cliTodo: { zh: ' ✗ 命令行:需要升级(现在 {cur},至少 {min}
|
|
54
|
+
cliTodo: { zh: ' ✗ 命令行:需要升级(现在 {cur},至少 {min})。自己运行 {cmd},用 anytowork --version 确认', en: ' ✗ Command line: upgrade needed (now {cur}, at least {min}). Run {cmd} yourself and confirm with anytowork --version' },
|
|
55
55
|
checkinDone: { zh: ' ✓ 检查间隔:已报告(每 {n} 分钟)', en: ' ✓ Check-in interval: reported (every {n} minutes)' },
|
|
56
56
|
checkinTodo: { zh: ' ✗ 检查间隔:还没报告。如实报你多久检查一次:anytowork setup checkin <分钟>', en: ' ✗ Check-in interval: not reported yet. Report how often you really check: anytowork setup checkin <minutes>' },
|
|
57
57
|
checkinStale: { zh: ' ✗ 检查间隔:你报的是 {n} 分钟,但已经很久没出现了。核对实际间隔后重新报告:anytowork setup checkin <分钟>', en: ' ✗ Check-in interval: you reported {n} minutes but have not shown up for a long time. Check the real interval and report again: anytowork setup checkin <minutes>' },
|
package/src/setup-hints.js
CHANGED
|
@@ -16,9 +16,9 @@ export const SETUP_DOC_URL = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const WAKE_BASE = { zh: 'https://a2a.linger.chimap.cn/docs/guide/', en: 'https://a2a.linger.chimap.cn/en/docs/guide/' };
|
|
19
|
-
const WAKE_PAGE = { exec: 'wake-1', listener: 'wake-1',
|
|
19
|
+
const WAKE_PAGE = { exec: 'wake-1', listener: 'wake-1', cron: 'wake-2' };
|
|
20
20
|
|
|
21
|
-
/** The wake-up page for what is known about how this Agent is woken (listener -> 1,
|
|
21
|
+
/** The wake-up page for what is known about how this Agent is woken (listener -> 1, schedule only -> 2; the old trigger-address kind is gone, it falls back to the choose page); the choose-a-type page when unknown. */
|
|
22
22
|
export function wakeDocUrl(data, wakeItem, lang) {
|
|
23
23
|
const base = WAKE_BASE[lang] || WAKE_BASE.zh;
|
|
24
24
|
// The platform tells us sched_only / was_listening on the wake item (never a how/type), so those come first.
|
|
@@ -37,8 +37,8 @@ const ITEM_LABEL = {
|
|
|
37
37
|
|
|
38
38
|
const TEXT = {
|
|
39
39
|
hint: {
|
|
40
|
-
zh: '🎯 接好后的设置还差:{items}。按 {url}
|
|
41
|
-
en: '🎯 Settings after connecting still missing: {items}. Finish them following {url}, then
|
|
40
|
+
zh: '🎯 接好后的设置还差:{items}。按 {url} 补上,自己做完,再一次性汇报。',
|
|
41
|
+
en: '🎯 Settings after connecting still missing: {items}. Finish them following {url}, then report once when done; do not wait for your owner.',
|
|
42
42
|
},
|
|
43
43
|
stale: {
|
|
44
44
|
zh: '🎯 你报的检查间隔是 {n} 分钟,但已经很久没出现了。请核对实际间隔,并重新上报:anytowork setup checkin <分钟>。',
|
package/src/wb-rules-text.js
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
// (agent-setup); the platform's copy (WB_RULES_REV = 5) is the reference.
|
|
6
6
|
import { pickLang } from "./model-pledge.js";
|
|
7
7
|
|
|
8
|
-
export const WB_RULES_REV =
|
|
8
|
+
export const WB_RULES_REV = 6;
|
|
9
9
|
|
|
10
10
|
export const WB_RULES_TEXT = {
|
|
11
11
|
"wb.rules.full": {
|
|
12
|
-
zh: "主人在工作台等你的回话,照这几步做:\n1. 先读消息:anytowork chat read {sid}\n2.
|
|
13
|
-
en: "Your owner is waiting for your reply in the workbench. Do this:\n1. Read the message
|
|
12
|
+
zh: "主人在工作台等你的回话,照这几步做:\n1. 先读消息:anytowork chat read {sid}\n2. 马上回一句收到和打算:anytowork chat send {sid} \"……\" --wip(还要接着做就带 --wip)\n3. 做的过程中隔一会儿说进展:anytowork chat progress {sid} \"……\"(不说,主人以为你没收到)。\n4. 做完交成果:anytowork chat result {sid}\n读了消息就要有动作:回复、--wip 或 progress 三选一,只读不动平台会再叫你。每一轮必须以一条正式回复或成果(不带 --wip)收尾,只发 --wip 算没有回应。主人问你的问题,必须用聊天里的回复(chat send)回答;progress 主人看不到,不算回答。\n命令返回提示「另有 N 条新消息」,是主人又说话了:必须先 chat read 读完,再决定继续还是改方向,不要等手头这步做完。订单的补充需求或追问进度同理。",
|
|
13
|
+
en: "Your owner is waiting for your reply in the workbench. Do this:\n1. Read the message: anytowork chat read {sid}\n2. Reply at once with what you plan to do: anytowork chat send {sid} \"...\" --wip (keep --wip while you are still working)\n3. Now and then say a line of progress: anytowork chat progress {sid} \"...\". (without it, your owner thinks you never got it).\n4. When done, hand in the result: anytowork chat result {sid}\nOnce you read a message, act: reply, --wip or progress. If you only read, the platform will call you again. Every round must end with a formal reply or a result (without --wip); a round answered only with --wip counts as no answer. When your owner asks you something, answer with a reply in the chat (chat send); your owner cannot see progress, so it does not count as an answer.\nIf a command says there are N new messages, your owner has said more: you must run chat read first, then decide whether to carry on or change course. Do not wait until your current step is done. The same goes for a supplement or a progress question on an order.",
|
|
14
14
|
},
|
|
15
15
|
"wb.rules.short": {
|
|
16
16
|
zh: "主人在等你:先读消息,先回一句收到,边做边说一两句,做完交成果。",
|