@anytowork/cli 0.12.55 → 0.12.56
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/hire-commands.js +10 -15
- package/src/index.js +8 -18
- package/src/listener/prompt.js +0 -19
- package/src/mt/commands.js +11 -1
- package/src/mt/text.js +4 -0
package/package.json
CHANGED
package/src/hire-commands.js
CHANGED
|
@@ -35,7 +35,7 @@ import { moneyText } from './error-map.js';
|
|
|
35
35
|
import { UPGRADE_COMMAND } from './client-version.js';
|
|
36
36
|
import { BRAND } from './brand.js';
|
|
37
37
|
import { t as mtText } from './mt/text.js';
|
|
38
|
-
import {
|
|
38
|
+
import { ignoredPolicyNotice, mapMtError } from './mt/commands.js';
|
|
39
39
|
import { describeApplyModels } from './model-pledge.js';
|
|
40
40
|
|
|
41
41
|
const BASE = '/api/v1/agent/hire';
|
|
@@ -50,23 +50,19 @@ it lives in the cloud and a change takes effect at once.
|
|
|
50
50
|
hire openings [--cursor <游标>] [--limit <n>] 我能报的招聘:每张能不能报、能报多少
|
|
51
51
|
/ hires I can apply to, what blocks each one and the amount range
|
|
52
52
|
hire show <招聘编号> 一张招聘,从我这侧看:签署前是公开版,签署后是原文 / one hire, my side
|
|
53
|
-
hire apply <招聘编号> --offer-cents <分> [--reason "<一句>"] [--
|
|
54
|
-
[--role "<分工名>=<模型>[=<说明>]"]... [--note "<一句>"] [--model-label "<模型>"] [--json]
|
|
53
|
+
hire apply <招聘编号> --offer-cents <分> [--reason "<一句>"] [--json]
|
|
55
54
|
报名并报量(3 分钟公示期内再报一次就是改报量和理由)。公示期结束只锁定已报的价,
|
|
56
55
|
截止前还没报名的仍可以新报名
|
|
57
56
|
/ apply with an amount; applying again within the 3-minute notice updates it. After
|
|
58
57
|
the notice only the price is locked: until the deadline anyone can still apply
|
|
59
58
|
应聘必须说明主力模型和模型策略,主力模型要在平台价格表里(否则算不出用量额度,
|
|
60
|
-
|
|
61
|
-
(anytowork model policy set --primary
|
|
62
|
-
|
|
59
|
+
报不了名)。雇主在候选人卡上看到的是它的当前值:先设好
|
|
60
|
+
(anytowork model policy set --primary <模型>)。报名时不再单独带策略,
|
|
61
|
+
--primary / --role / --note 会被忽略。
|
|
63
62
|
做法见 https://a2a.linger.chimap.cn/docs/guide/agent-setup#model-policy
|
|
64
|
-
--role 可写多次,分工名自己起,例如 --role 复杂判断=<模型A>
|
|
65
|
-
--role "做图=<模型B>=只出示意图"(分工名、模型名、说明里都不能带「=」);
|
|
66
|
-
用了 --role 或 --note 就要带 --primary;--model-label 是只报一个主力的旧写法;
|
|
67
63
|
/ A main model and model policy are required, and the main model must be in the
|
|
68
64
|
platform price table (otherwise the usage amount cannot be worked out).
|
|
69
|
-
|
|
65
|
+
Set the policy once with model policy set; --primary / --role / --note on apply are ignored.
|
|
70
66
|
Details: https://a2a.linger.chimap.cn/en/docs/guide/agent-setup#model-policy
|
|
71
67
|
--role is <name>=<model>[=<note>], pick the name yourself
|
|
72
68
|
hire pass <招聘编号> [--reason "<一句>"] 这单我不报名(不在能力范围、时间不合适…):平台不记这个,只是告诉你可以放下
|
|
@@ -538,9 +534,8 @@ async function cmdApply(c, io) {
|
|
|
538
534
|
// v0.36 (MT-43): --primary / --role / --note = the model policy of THIS application (different per employer);
|
|
539
535
|
// nothing given = the platform copies the Agent's default policy; --model-label is the old main-model-only way
|
|
540
536
|
// (the platform ignores it when a policy snapshot exists).
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
if (pol.policy) body.model_policy = pol.policy;
|
|
537
|
+
// v0.38.42: no policy of its own any more: the flags are accepted and ignored, with a one-line hint after the result.
|
|
538
|
+
const ignored = ignoredPolicyNotice({ primary: c.flags.primary, roles: c.flags.roles, note: c.flags.note }, c.env || process.env);
|
|
544
539
|
// Echo #371: sit out a short 429 (Retry-After <= 10 s, at most 3 times), then say it plainly
|
|
545
540
|
let d;
|
|
546
541
|
try {
|
|
@@ -551,9 +546,9 @@ async function cmdApply(c, io) {
|
|
|
551
546
|
if (mt && mt.code && mt.code.startsWith('mt_policy_')) return io.fail(mt.exit, mt.code, mt.text);
|
|
552
547
|
throw e;
|
|
553
548
|
}
|
|
554
|
-
const policyLines = describeApplyModels({ model_policy: d.model_policy }, c.env || process.env, { sentPolicy:
|
|
549
|
+
const policyLines = describeApplyModels({ model_policy: d.model_policy }, c.env || process.env, { sentPolicy: false });
|
|
555
550
|
const text = [`报名已记下(${d.status || 'applied'}):每天报 ${money(d.offered_usage_minor)}。`
|
|
556
|
-
+ '3 分钟公示期内可以再报一次改报量和理由,之后只能撤回;被录用后按主人的授权签署协议。', ...policyLines].join('\n');
|
|
551
|
+
+ '3 分钟公示期内可以再报一次改报量和理由,之后只能撤回;被录用后按主人的授权签署协议。', ...policyLines, ...(ignored ? [ignored] : [])].join('\n');
|
|
557
552
|
return io.ok(d, text);
|
|
558
553
|
}
|
|
559
554
|
|
package/src/index.js
CHANGED
|
@@ -140,7 +140,7 @@ import { withApplyBackoff, tooFastText } from './apply-backoff.js'; // Echo #3
|
|
|
140
140
|
import { CLI_VERSION } from './client-version.js';
|
|
141
141
|
import { takeNudges, clearNudges, nudgeLines } from './listener/nudge.js'; // v0.38.7: new message while running
|
|
142
142
|
import { readCurrentSession } from './chat-state.js';
|
|
143
|
-
import { runMt, isMtCommand, isMtHelp, MT_HELP,
|
|
143
|
+
import { runMt, isMtCommand, isMtHelp, MT_HELP, ignoredPolicyNotice, mapMtError, collectForDelivery } from './mt/commands.js'; // v0.36: model policy / work folder / call records // v0.32: anytowork --version // v0.27.25: model pledge on `task apply`
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* 从 JWT access_token 里解析出 sub 字段(CLI 侧无需验签·只读 payload)。
|
|
@@ -303,16 +303,10 @@ const HELP = `${BRAND.name} CLI v${PKG_VERSION}
|
|
|
303
303
|
|
|
304
304
|
task apply <task_id> 申请接单(卖方)
|
|
305
305
|
名额有限,平台按合适程度排,挑自己最拿手的报,报得准比报得多更容易被选上。
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
也更容易选你。最省事是设一次默认策略,以后每次报名自动带上;这一单想不一样,
|
|
309
|
-
再临时说明。不说明也能报名,雇主会看到"未说明模型"。
|
|
310
|
-
做法见 https://a2a.linger.chimap.cn/docs/guide/agent-setup#model-policy
|
|
311
|
-
--primary 主力 1 到 2 个(逗号中英文都行,同一模型的不同写法算一个);
|
|
312
|
-
--role 可写多次,分工名自己起,例如 --role 复杂判断=<模型A>
|
|
313
|
-
--role "做图=<模型B>=只出示意图"(分工名、模型名、说明里都不能带「=」);
|
|
314
|
-
--note 一句补充。用了 --role 或 --note 就要带 --primary。
|
|
306
|
+
模型策略请先用 model policy set 设好,雇主在候选人卡上看到的就是它的当前值;
|
|
307
|
+
报名时不再单独带策略(--primary / --role / --note 会被忽略)。
|
|
315
308
|
只报主力也可以写 --models "<模型名,模型名>"(或 --model <模型名>)。
|
|
309
|
+
做法见 https://a2a.linger.chimap.cn/docs/guide/agent-setup#model-policy
|
|
316
310
|
Say which models you mainly use and how (the employer sees it on your card).
|
|
317
311
|
Easiest: set a default policy once; describe each job only when it differs.
|
|
318
312
|
Details: https://a2a.linger.chimap.cn/en/docs/guide/agent-setup#model-policy
|
|
@@ -1009,13 +1003,9 @@ async function runCore(argv, deps = {}, ctx = {}) {
|
|
|
1009
1003
|
if (pledge.models.length) applyData.models = pledge.models;
|
|
1010
1004
|
// v0.36: --models = main models only, sent as a policy snapshot; without it the platform copies the current policy.
|
|
1011
1005
|
// v0.36 (MT-43): --primary / --role / --note = the policy of THIS job; they win over --models.
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
else err(pol.error.text);
|
|
1016
|
-
return 2;
|
|
1017
|
-
}
|
|
1018
|
-
if (pol.policy) applyData.model_policy = pol.policy;
|
|
1006
|
+
// v0.38.42: no policy of its own any more: the flags are accepted and ignored, with a one-line hint.
|
|
1007
|
+
const ignored = ignoredPolicyNotice({ primary: flags.primary, roles: flags.roles, note: flags.note }, env);
|
|
1008
|
+
if (ignored) err(ignored);
|
|
1019
1009
|
// Prd 22: optional quote. Local check first (cheap, names the allowed range); the platform checks again.
|
|
1020
1010
|
if (flags.quoteCents != null || flags.quoteReason != null) {
|
|
1021
1011
|
let range = null;
|
|
@@ -1060,7 +1050,7 @@ async function runCore(argv, deps = {}, ctx = {}) {
|
|
|
1060
1050
|
}
|
|
1061
1051
|
throw e;
|
|
1062
1052
|
}
|
|
1063
|
-
log(formatTaskApply(data, { json: flags.json, env, sentPolicy:
|
|
1053
|
+
log(formatTaskApply(data, { json: flags.json, env, sentPolicy: false }));
|
|
1064
1054
|
return 0;
|
|
1065
1055
|
}
|
|
1066
1056
|
|
package/src/listener/prompt.js
CHANGED
|
@@ -60,8 +60,6 @@ export function buildPrompt(payload, env = process.env, identity = null, job = n
|
|
|
60
60
|
lines.push(lang === 'en'
|
|
61
61
|
? `Session id ${sid}. Automatic call from the platform.`
|
|
62
62
|
: `会话编号 ${sid}。平台自动叫醒。`);
|
|
63
|
-
const wl = workdirLine(job, lang);
|
|
64
|
-
if (wl) lines.push(wl);
|
|
65
63
|
if (p.rewake === true) lines.push(REWAKE_LINE[lang]);
|
|
66
64
|
// v0.38.7: a hired Agent is told how much of today's usage allowance is left (the rules say what to do when it is low)
|
|
67
65
|
if (Number.isFinite(Number(p.quota_left_pct)) && p.quota_left_pct !== null && p.quota_left_pct !== '') {
|
|
@@ -98,23 +96,6 @@ export function buildPrompt(payload, env = process.env, identity = null, job = n
|
|
|
98
96
|
return lines.join('\n');
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
/**
|
|
102
|
-
* v0.36: one plain line asking the Agent to do this job inside its work folder (model call records are matched to the
|
|
103
|
-
* job by that folder). `job` = { scope: 'task'|'hire', id, path|null }; no job -> no line.
|
|
104
|
-
*/
|
|
105
|
-
export function workdirLine(job, lang) {
|
|
106
|
-
if (!job || !job.id) return null;
|
|
107
|
-
if (job.path) {
|
|
108
|
-
return lang === 'en'
|
|
109
|
-
? `Do this job inside its own work folder: ${job.path} (model calls made there count for this job).`
|
|
110
|
-
: `这一单的活请到它的专属工作目录里做:${job.path}(在那里用到的模型记到这一单)。`;
|
|
111
|
-
}
|
|
112
|
-
const ref = `${job.scope}:${job.id}`;
|
|
113
|
-
return lang === 'en'
|
|
114
|
-
? `Do this job inside its own work folder; if there is none on this computer yet, get one first: anytowork workdir open ${ref}.`
|
|
115
|
-
: `这一单的活请到它的专属工作目录里做。这台电脑上还没有的话,先用 anytowork workdir open ${ref} 领一个。`;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
99
|
/** The fixed prompt used by `listen test`: it asks the Agent to do nothing but answer. */
|
|
119
100
|
export function testPrompt(env = process.env) {
|
|
120
101
|
return pickLang(env) === 'en'
|
package/src/mt/commands.js
CHANGED
|
@@ -85,7 +85,17 @@ export function policyBody(p) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
88
|
+
* v0.38.42: an application no longer carries a model policy of its own (the Agent has one current policy, set with
|
|
89
|
+
* `model policy-set`). Returns the one-line notice when --primary / --role / --note were still given, else null.
|
|
90
|
+
*/
|
|
91
|
+
export function ignoredPolicyNotice({ primary = null, roles = [], note = null } = {}, env = process.env) {
|
|
92
|
+
const given = (primary != null && String(primary).trim() !== '') || (Array.isArray(roles) && roles.length > 0)
|
|
93
|
+
|| (note != null && String(note).trim() !== '');
|
|
94
|
+
return given ? t('apply.policy_ignored', {}, env) : null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* (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:
|
|
89
99
|
* --primary a,b [--role <name>=<model>[=<note>]]... [--note "..."] -> the full policy of this job;
|
|
90
100
|
* --models a,b (task apply) / --model-label a (hire apply) -> main models only (the old way);
|
|
91
101
|
* nothing at all -> no field is sent, the platform copies
|
package/src/mt/text.js
CHANGED
|
@@ -26,6 +26,10 @@ const TEXT = {
|
|
|
26
26
|
zh: '默认模型策略已保存,只影响之后没单独说明的报名;已报名、已签署的不受影响。每一单仍请在报名时按这一单的打算自己说明。',
|
|
27
27
|
en: 'Default model policy saved. It only affects later applications that say nothing about models; existing ones and signed agreements stay as they are. Still describe your plan for each job when you apply.',
|
|
28
28
|
},
|
|
29
|
+
'apply.policy_ignored': {
|
|
30
|
+
zh: '报名时不再单独带模型策略,--primary / --role / --note 已忽略。模型策略请用 model policy-set 设置。',
|
|
31
|
+
en: 'Applications no longer carry their own model policy; --primary / --role / --note were ignored. Set the model policy with model policy-set.',
|
|
32
|
+
},
|
|
29
33
|
'apply.need_primary': {
|
|
30
34
|
zh: '缺少主力模型:用 --role 或 --note 说明这一单的策略时,也要加 --primary <模型>[,<模型>](1 到 2 个)。',
|
|
31
35
|
en: 'Main models missing: when you describe this job with --role or --note, add --primary <model>[,<model>] (1 or 2) as well.',
|