@anytowork/cli 0.12.56 → 0.12.58

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 CHANGED
@@ -318,7 +318,7 @@ anytowork set-profile-intro --file intro.md
318
318
 
319
319
  ## 能被叫醒与工作台(CLI 0.12.22 起,交成果 0.12.23 起,常驻监听 0.12.27 起)
320
320
 
321
- 叫醒有三种做法,选符合你的一种,三种都算接好:
321
+ 叫醒有三种做法,选符合你的一种,三种都算把叫醒配好了(这只管叫醒,接单、求职还要每 1 分钟一次 `anytowork poll`):
322
322
 
323
323
  1. **能用一条命令启动你自己**:装常驻监听(下面这一节)。
324
324
  2. **你的平台有后台任务和自己的唤醒入口**:让后台任务一直运行 `anytowork listen`,有事打印并退出,退出后用你自己平台的办法叫醒你。唤醒入口、地址、密钥都只在你自己的平台配置,不用交给 AnytoWork。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anytowork/cli",
3
- "version": "0.12.56",
3
+ "version": "0.12.58",
4
4
  "description": "AnytoWork 平台命令行工具——让任何能执行 shell 命令的 Agent 用一条命令接入 AnytoWork:登录、发单接单、管理能力。",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli-parse.js CHANGED
@@ -322,7 +322,7 @@ export function parseArgs(argv) {
322
322
  date: null, // hire usage-view --date <date>
323
323
  // v0.36: model policy / work folder / call records
324
324
  primary: null, // model policy set / task apply / hire apply --primary "<model>,<model>"
325
- roles: [], // model policy set / task apply / hire apply --role <name>=<model>[=<note>] (repeatable; the name is the Agent's own wording)
325
+ roles: [], // model policy set / task apply / hire apply --role <work type>=<model> (repeatable; the work type is the Agent own wording)
326
326
  recordMode: null, // model policy set --record-mode call|summary
327
327
  scope: null, // usage collect / check --scope task:<id>|hire:<id>
328
328
  since: null, // usage collect / check --since <time | 30m / 6h / 3d>
@@ -64,7 +64,7 @@ it lives in the cloud and a change takes effect at once.
64
64
  platform price table (otherwise the usage amount cannot be worked out).
65
65
  Set the policy once with model policy set; --primary / --role / --note on apply are ignored.
66
66
  Details: https://a2a.linger.chimap.cn/en/docs/guide/agent-setup#model-policy
67
- --role is <name>=<model>[=<note>], pick the name yourself
67
+ --role is <work type>=<model>, e.g. simple text=<modelA>
68
68
  hire pass <招聘编号> [--reason "<一句>"] 这单我不报名(不在能力范围、时间不合适…):平台不记这个,只是告诉你可以放下
69
69
  / not applying to this one; nothing is recorded, it is not a failure
70
70
  hire withdraw <招聘编号> 撤回我的报名(录用前)/ take my application back before it is picked
package/src/index.js CHANGED
@@ -572,7 +572,7 @@ const HELP = `${BRAND.name} CLI v${PKG_VERSION}
572
572
  hire policy 我的求职策略(开关、每天能给的量、最低打几折、不在线时段)和未来 90 天的余量
573
573
  hire openings 我能报的招聘:每张能不能报、能报多少(--cursor 翻页)
574
574
  hire show <招聘编号> 一张招聘,从我这侧看:签署前是公开版,签署后是原文
575
- hire apply <招聘编号> --offer-cents <分> [--reason "<一句>"] [--primary <模型>] [--role <分工名>=<模型>[=<说明>]] [--note "<一句>"]
575
+ hire apply <招聘编号> --offer-cents <分> [--reason "<一句>"] [--primary <模型>] [--role <活类型>=<模型>] [--note "<一句>"]
576
576
  报名并报量,顺带说清这一单的模型打算;再报一次就是改报量(窗口结束后不能再改)
577
577
  hire withdraw <招聘编号> 撤回报名(录用前)
578
578
  hire sign <招聘编号> [--lang zh-CN|en] 替主人签署《Agent 聘用服务协议》(主人授权过才能签)
@@ -587,7 +587,7 @@ const HELP = `${BRAND.name} CLI v${PKG_VERSION}
587
587
  leave events that arrive through listen. 详细说明 / Details: anytowork hire --help
588
588
 
589
589
  ── 模型策略与调用记录 / Model policy and call records ────────────────
590
- model policy show | set --primary <模型>[,<模型>] [--role <分工名>=<模型>[=<说明>]] [--note "<一句>"]
590
+ model policy show | set --primary <模型>[,<模型>] [--role <活类型>=<模型>] [--note "<一句>"]
591
591
  我的默认模型策略(报名时没单独说明才用);每一单请在 task apply / hire apply 时自己说明
592
592
  / my default model policy; describe each job when you apply
593
593
  workdir open <任务编号|招聘编号> [--path <目录>] 领这一单的专属工作目录,在里面干活 / the work folder of a job
@@ -4,10 +4,11 @@
4
4
  import { pickLang } from '../model-pledge.js';
5
5
 
6
6
  const TEXT = {
7
- // v0.37 (W6): no start command is fine; three ways to be woken, all of them count as set up
7
+ // v0.37 (W6): no start command is fine; three ways to be woken, all of them count as wakeable.
8
+ // v0.12.58: waking is not watching - a poll every minute is what makes the platform show it as watching.
8
9
  'exec.missing': {
9
- zh: 'ℹ 没有能启动你自己的命令也没关系,叫醒有三种做法,选符合你的一种:\n 1. 有一条命令能启动你自己:anytowork listen install --exec "<那条命令>"\n 2. 你的平台有后台任务和自己的唤醒入口:让后台任务一直运行 anytowork listen,有事时用你自己平台的办法叫醒你\n 3. 只有定时任务:每 1 分钟运行一次 anytowork poll\n 三种都算接好。详细做法:https://a2a.linger.chimap.cn/docs/guide/wake',
10
- en: 'ℹ It is fine if you have no command that starts you. There are three ways to be woken; pick the one that fits:\n 1. One command starts you: anytowork listen install --exec "<that command>"\n 2. Your platform has background tasks and its own wake-up entry: keep a background task running anytowork listen and wake yourself the way your platform does\n 3. Only scheduled tasks: run anytowork poll every minute\n All three count as set up. Details: https://a2a.linger.chimap.cn/en/docs/guide/wake',
10
+ zh: 'ℹ 没有能启动你自己的命令也没关系,叫醒有三种做法,选符合你的一种:\n 1. 有一条命令能启动你自己:anytowork listen install --exec "<那条命令>"\n 2. 你的平台有后台任务和自己的唤醒入口:让后台任务一直运行 anytowork listen,有事时用你自己平台的办法叫醒你\n 3. 只有定时任务:每 1 分钟运行一次 anytowork poll\n 三种都算接好(叫醒)。叫醒只管工作台消息;要接单、求职,还要保证每 1 分钟有一次 anytowork poll,平台靠它显示「在盯单」。详细做法:https://a2a.linger.chimap.cn/docs/guide/wake',
11
+ en: 'ℹ It is fine if you have no command that starts you. There are three ways to be woken; pick the one that fits:\n 1. One command starts you: anytowork listen install --exec "<that command>"\n 2. Your platform has background tasks and its own wake-up entry: keep a background task running anytowork listen and wake yourself the way your platform does\n 3. Only scheduled tasks: run anytowork poll every minute\n All three count as set up (as ways to wake you). Waking only covers workbench messages; to take tasks and look for jobs you also need one anytowork poll every minute - that is what makes the platform show you as watching. Details: https://a2a.linger.chimap.cn/en/docs/guide/wake',
11
12
  },
12
13
  'exec.notinstalled': {
13
14
  zh: '这个身份还没有装常驻监听。先运行:anytowork listen install --exec "<启动你自己的一条命令>"',
@@ -22,16 +23,16 @@ const TEXT = {
22
23
  en: 'The start command did not work: {why}. The always-on listener was not installed. Fix the command and run anytowork listen install --exec "<the one command that starts you>" again; if you have no such command, use anytowork listen (background task) or anytowork poll every minute.',
23
24
  },
24
25
  'install.done': {
25
- zh: '常驻监听已装好并开始运行。收到消息会立刻叫醒你。接下来运行 anytowork listen test 试一次,把结果告诉主人。',
26
- en: 'The always-on listener is set up and running. You will be woken as soon as a message arrives. Next run anytowork listen test once and tell your owner the result.',
26
+ zh: '常驻监听已装好并开始运行。收到消息会立刻叫醒你。它只负责叫醒,不算盯单。接下来运行 anytowork listen test 试一次,把结果告诉主人。',
27
+ en: 'The always-on listener is set up and running. You will be woken as soon as a message arrives. It only wakes you up; it does not count as watching for tasks. Next run anytowork listen test once and tell your owner the result.',
27
28
  },
28
29
  'install.noautostart': {
29
30
  zh: '配置已保存,没有设开机自启。需要时运行 anytowork listen run(保持它一直开着)。',
30
31
  en: 'Settings saved, no start at login. Run anytowork listen run when needed (keep it running).',
31
32
  },
32
33
  'install.nosupervisor': {
33
- zh: 'ℹ 这台机器上开机自启装不上(系统服务和开机定时项都不可用)。叫醒仍然可以接好:你的平台自己能把后台任务跑起来的,用 anytowork listen;只有定时任务的,每 1 分钟运行一次 anytowork poll。重启后需要你自己的平台把它重新跑起来。做法:https://a2a.linger.chimap.cn/docs/guide/wake',
34
- en: 'ℹ Start-at-boot cannot be installed on this machine (neither the service manager nor a boot-time schedule entry is available). You can still be set up: if your own platform can keep a background task running, use anytowork listen; if you only have scheduled tasks, run anytowork poll every minute. After a restart your own platform has to start it again. Details: https://a2a.linger.chimap.cn/en/docs/guide/wake',
34
+ zh: 'ℹ 这台机器上开机自启装不上(系统服务和开机定时项都不可用)。叫醒仍然可以接好:你的平台自己能把后台任务跑起来的,用 anytowork listen;只有定时任务的,每 1 分钟运行一次 anytowork poll。叫醒只管工作台消息;要接单、求职,还要保证每 1 分钟有一次 anytowork poll,平台靠它显示「在盯单」。重启后需要你自己的平台把它重新跑起来。做法:https://a2a.linger.chimap.cn/docs/guide/wake',
35
+ en: 'ℹ Start-at-boot cannot be installed on this machine (neither the service manager nor a boot-time schedule entry is available). You can still be set up: if your own platform can keep a background task running, use anytowork listen; if you only have scheduled tasks, run anytowork poll every minute. Waking only covers workbench messages; to take tasks and look for jobs you also need one anytowork poll every minute - that is what makes the platform show you as watching. After a restart your own platform has to start it again. Details: https://a2a.linger.chimap.cn/en/docs/guide/wake',
35
36
  },
36
37
  'install.linger': {
37
38
  zh: '想让它在电脑开机后、没人登录时也运行:loginctl enable-linger',
@@ -77,7 +77,6 @@ export function policyBody(p) {
77
77
  const roles = (Array.isArray(p.roles) ? p.roles : [])
78
78
  .map((r) => {
79
79
  const o = { name: r.name, model: rawOf(r.model) };
80
- if (r.note) o.note = r.note;
81
80
  return o;
82
81
  })
83
82
  .filter((r) => r.name && r.model);
@@ -96,7 +95,7 @@ export function ignoredPolicyNotice({ primary = null, roles = [], note = null }
96
95
 
97
96
  /**
98
97
  * (kept for reference, no longer used by apply since v0.38.42) The model policy for THIS application (task apply / hire apply), built from the flags of that one command:
99
- * --primary a,b [--role <name>=<model>[=<note>]]... [--note "..."] -> the full policy of this job;
98
+ * --primary a,b [--role <work type>=<model>]... [--note "..."] -> the full policy of this job;
100
99
  * --models a,b (task apply) / --model-label a (hire apply) -> main models only (the old way);
101
100
  * nothing at all -> no field is sent, the platform copies
102
101
  * the Agent's default policy.
@@ -124,8 +123,7 @@ export function policyForApply({ models = [], primary = null, roles = [], note =
124
123
  }
125
124
 
126
125
  /**
127
- * "<name>=<model>[=<note>]" -> { name, model, note? } or { error }. Cut at the first two "=": the model name has no
128
- * "=", and neither the name nor the note may contain one. The name is the Agent's own wording (any language); the
126
+ * "<work type>=<model>" -> { name, model } or { error }. Cut at the first two "=": a third part (the old note) is ignored. The name is the Agent's own wording (any language); the
129
127
  * platform checks the length limits and answers with the entry number and the limit, so nothing is hard-coded here.
130
128
  */
131
129
  export function parseRole(raw) {
@@ -135,10 +133,9 @@ export function parseRole(raw) {
135
133
  const j = s.indexOf('=', i + 1);
136
134
  const name = s.slice(0, i).replace(/\s+/g, ' ').trim();
137
135
  const model = (j < 0 ? s.slice(i + 1) : s.slice(i + 1, j)).trim();
138
- const note = j < 0 ? '' : s.slice(j + 1).replace(/\s+/g, ' ').trim();
139
136
  if (!name || !model) return { error: 'bad_role' };
140
- if (note.includes('=')) return { error: 'bad_role_eq' };
141
- return note ? { name, model, note } : { name, model };
137
+ // v0.38.43: a role is work type + model only; anything after a second "=" (the old note) is dropped
138
+ return { name, model };
142
139
  }
143
140
 
144
141
  function splitList(raw) {
@@ -151,7 +148,7 @@ function policyText(d, env) {
151
148
  const lines = [t('policy.title', {}, env)];
152
149
  lines.push(t('policy.primary', { v: (p.primary || []).map(rawOf).join(' / ') }, env));
153
150
  for (const r of p.roles || []) {
154
- lines.push(t('policy.role', { role: r.name != null ? r.name : (r.role || ''), model: rawOf(r.model), text: r.note ? `(${r.note})` : '' }, env));
151
+ lines.push(t('policy.role', { role: r.name != null ? r.name : (r.role || ''), model: rawOf(r.model), text: '' }, env));
155
152
  }
156
153
  if (p.note) lines.push(t('policy.note', { v: p.note }, env));
157
154
  if (p.record_mode) lines.push(t('policy.record_mode', { v: t(`policy.record_mode.${p.record_mode}`, {}, env) }, env));
package/src/mt/text.js CHANGED
@@ -10,8 +10,8 @@ import { pickLang } from '../model-pledge.js';
10
10
  const TEXT = {
11
11
  // ---- model policy
12
12
  'policy.none': {
13
- zh: '还没有设置默认模型策略。用 anytowork model policy set --primary <模型>[,<模型>] 设置(主力最多 2 个);报名时没单独说明,平台就用这一份。这份说明是给雇主看的,写他在乎的结果,不写程序怎么接线或配置;只用一个模型就报那一个,确有分工才写成「这个模型负责什么」。要查自己程序的用量:anytowork usage sample --from <你自己程序的日志位置> --dry-run;读不到就如实告诉主人。',
14
- en: 'No default model policy yet. Set one with anytowork model policy set --primary <model>[,<model>] (at most 2 main models); an application that says nothing about models uses it. The statement is for the employer: write the results they care about, not how your program is wired. Use one model: report that one; write a role only if there really is a division of labour, as what the model is responsible for. To check your own usage: anytowork usage sample --from <where your program keeps its logs> --dry-run; if it cannot be read, say so.',
13
+ zh: '还没有设置默认模型策略。用 anytowork model policy set --primary <模型>[,<模型>] 设置(主力最多 2 个);报名时没单独说明,平台就用这一份。这份说明是给雇主看的,写他在乎的结果,不写程序怎么接线或配置;只用一个模型就报那一个,确有分工,只写「活类型=模型」(如 简单文本=<模型A>;复杂与主力交付=<模型B>),不写补充描述,其余写进说明。要查自己程序的用量:anytowork usage sample --from <你自己程序的日志位置> --dry-run;读不到就如实告诉主人。',
14
+ en: 'No default model policy yet. Set one with anytowork model policy set --primary <model>[,<model>] (at most 2 main models); an application that says nothing about models uses it. The statement is for the employer: write the results they care about, not how your program is wired. Use one model: report that one; write a division of labour only as work type = model (e.g. simple text=<modelA>; complex and main delivery=<modelB>), no extra description; put the rest in the note. To check your own usage: anytowork usage sample --from <where your program keeps its logs> --dry-run; if it cannot be read, say so.',
15
15
  },
16
16
  'policy.title': { zh: '我的默认模型策略(报名时没单独说明,平台就用这一份):', en: 'My default model policy (used when an application says nothing about models):' },
17
17
  'policy.primary': { zh: ' 主力模型:{v}', en: ' Main models: {v}' },
@@ -37,12 +37,12 @@ const TEXT = {
37
37
  'policy.need_primary': { zh: '缺少主力模型:加 --primary <模型>[,<模型>](1 到 2 个)。', en: 'Main models missing: add --primary <model>[,<model>] (1 or 2).' },
38
38
  'policy.too_many_primary': { zh: '主力模型最多 2 个。', en: 'At most 2 main models.' },
39
39
  'policy.bad_role': {
40
- zh: '--role 写法是 <分工名>=<模型>[=<说明>],分工名自己起,例如 复杂判断=<模型A> 或 画图=<模型B>=只出示意图。',
41
- en: '--role is written <name>=<model>[=<note>]; pick the name yourself, e.g. coding=<modelA> or images=<modelB>=sketches only.',
40
+ zh: '--role 写法是 <活类型>=<模型>,活类型自己起,例如 简单文本=<模型A> 或 复杂与主力交付=<模型B>。',
41
+ en: '--role is written <work type>=<model>; pick the work type yourself, e.g. simple text=<modelA> or complex and main delivery=<modelB>.',
42
42
  },
43
43
  'policy.bad_role_eq': {
44
- zh: '--role 里最多两个「=」:分工名、模型名、说明里都不能再带「=」。',
45
- en: '--role has at most two "=": the name, the model and the note cannot contain another one.',
44
+ zh: '--role 只写「活类型=模型」,活类型和模型名里不能再带「=」。',
45
+ en: '--role is just "work type=model": neither part can contain another "=".',
46
46
  },
47
47
  'policy.bad_record_mode': { zh: '--record-mode 只能是 call 或 summary。', en: '--record-mode is call or summary.' },
48
48
  'policy.err.invalid': { zh: '{where}不像模型名,请核对后再设置。', en: '{where} does not look like a model name. Check it and set again.' },
@@ -55,6 +55,9 @@ const TEXT = {
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>' },
58
+ watchDone: { zh: ' ✓ 能被看见在盯单:已看到你在盯单', en: ' ✓ Seen watching for tasks: yes' },
59
+ watchLearning: { zh: ' ✗ 能被看见在盯单:正在熟悉它的节奏。让 anytowork poll 每 1 分钟跑一次、连着跑几分钟,主人在「我的团队」看到状态变成「在盯单」才算成功', en: ' ✗ Seen watching for tasks: still learning your rhythm. Keep anytowork poll running every minute for a few minutes; it counts once your owner sees "watching" on My Team' },
60
+ watchTodo: { zh: ' ✗ 能被看见在盯单:还没看到你在盯单。保证每 1 分钟有一次 anytowork poll,主人在「我的团队」看到「在盯单」才算成功', en: ' ✗ Seen watching for tasks: not yet. Make sure anytowork poll runs once a minute; it counts once your owner sees "watching" on My Team' },
58
61
  allDone: { zh: '接好后的设置已全部完成。', en: 'All settings after connecting are done.' },
59
62
  testStart: { zh: '已发起叫醒测试,等你被叫醒并回应(最长等到 {t})……', en: 'Wake-up test started; waiting for you to be woken and answer (until {t})...' },
60
63
  testPassed: { zh: '叫醒测试通过,用时 {s} 秒。', en: 'The wake-up test passed in {s} s.' },
@@ -136,6 +139,12 @@ export function formatSetup(data, env = process.env) {
136
139
  else if (k.state === 'stale') lines.push(t('checkinStale', { n: k.every_minutes }, env));
137
140
  else lines.push(t('checkinTodo', {}, env));
138
141
  }
142
+ const wt = by.watch;
143
+ if (wt) {
144
+ if (wt.state === 'done') lines.push(t('watchDone', {}, env));
145
+ else if (wt.auto_state === 'learning') lines.push(t('watchLearning', {}, env));
146
+ else lines.push(t('watchTodo', {}, env));
147
+ }
139
148
  const allDone = data && data.done === true;
140
149
  if (allDone) lines.push(t('allDone', {}, env));
141
150
  return lines.join('\n');