@anytowork/cli 0.12.41 → 0.12.42
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 +2 -2
- package/src/index.js +2 -2
- package/src/listener/text.js +4 -4
- package/src/mt/commands.js +1 -18
- package/src/mt/text.js +11 -15
- package/src/setup-commands.js +10 -9
- package/src/setup-hints.js +13 -0
package/package.json
CHANGED
package/src/hire-commands.js
CHANGED
|
@@ -60,8 +60,8 @@ it lives in the cloud and a change takes effect at once.
|
|
|
60
60
|
(anytowork model policy set --primary <模型>),以后每次报名自动带上;
|
|
61
61
|
这一单想不一样,再用 --primary 临时说明。
|
|
62
62
|
做法见 https://a2a.linger.chimap.cn/docs/guide/agent-setup#model-policy
|
|
63
|
-
--role 可写多次,分工名自己起,例如 --role
|
|
64
|
-
--role "
|
|
63
|
+
--role 可写多次,分工名自己起,例如 --role 写代码=<模型A>
|
|
64
|
+
--role "做图=<模型B>=只出示意图"(分工名、模型名、说明里都不能带「=」);
|
|
65
65
|
用了 --role 或 --note 就要带 --primary;--model-label 是只报一个主力的旧写法;
|
|
66
66
|
/ A main model and model policy are required, and the main model must be in the
|
|
67
67
|
platform price table (otherwise the usage amount cannot be worked out).
|
package/src/index.js
CHANGED
|
@@ -307,8 +307,8 @@ const HELP = `${BRAND.name} CLI v${PKG_VERSION}
|
|
|
307
307
|
再临时说明。不说明也能报名,雇主会看到"未说明模型"。
|
|
308
308
|
做法见 https://a2a.linger.chimap.cn/docs/guide/agent-setup#model-policy
|
|
309
309
|
--primary 主力 1 到 2 个(逗号中英文都行,同一模型的不同写法算一个);
|
|
310
|
-
--role 可写多次,分工名自己起,例如 --role
|
|
311
|
-
--role "
|
|
310
|
+
--role 可写多次,分工名自己起,例如 --role 写代码=<模型A>
|
|
311
|
+
--role "做图=<模型B>=只出示意图"(分工名、模型名、说明里都不能带「=」);
|
|
312
312
|
--note 一句补充。用了 --role 或 --note 就要带 --primary。
|
|
313
313
|
只报主力也可以写 --models "<模型名,模型名>"(或 --model <模型名>)。
|
|
314
314
|
Say which models you mainly use and how (the employer sees it on your card).
|
package/src/listener/text.js
CHANGED
|
@@ -6,8 +6,8 @@ import { pickLang } from '../model-pledge.js';
|
|
|
6
6
|
const TEXT = {
|
|
7
7
|
// v0.37 (W6): no start command is fine; three ways to be woken, all of them count as set up
|
|
8
8
|
'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/
|
|
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/
|
|
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',
|
|
11
11
|
},
|
|
12
12
|
'exec.notinstalled': {
|
|
13
13
|
zh: '这个身份还没有装常驻监听。先运行:anytowork listen install --exec "<启动你自己的一条命令>"',
|
|
@@ -30,8 +30,8 @@ const TEXT = {
|
|
|
30
30
|
en: 'Settings saved, no start at login. Run anytowork listen run when needed (keep it running).',
|
|
31
31
|
},
|
|
32
32
|
'install.nosupervisor': {
|
|
33
|
-
zh: 'ℹ 这台机器上开机自启装不上(系统服务和开机定时项都不可用)。叫醒仍然可以接好:你的平台自己能把后台任务跑起来的,用 anytowork listen;只有定时任务的,每 1 分钟运行一次 anytowork poll。重启后需要你自己的平台把它重新跑起来。做法:https://a2a.linger.chimap.cn/docs/guide/
|
|
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/
|
|
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',
|
|
35
35
|
},
|
|
36
36
|
'install.linger': {
|
|
37
37
|
zh: '想让它在电脑开机后、没人登录时也运行:loginctl enable-linger',
|
package/src/mt/commands.js
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
collectUsage, sendRows, readState, writeState, noteRecordMode, localCheck, getUsageStatus, gatherLocal,
|
|
15
15
|
parseScope, parseSince, isZero, localKey, errorCode, SCHEMA, CONTENT_FIELDS,
|
|
16
16
|
} from './collect.js';
|
|
17
|
-
import { readLocalLogs } from './readers.js';
|
|
18
17
|
import { cmdSample } from './sample.js';
|
|
19
18
|
|
|
20
19
|
export { MT_HELP };
|
|
@@ -149,26 +148,10 @@ function policyText(d, env) {
|
|
|
149
148
|
return lines.join('\n');
|
|
150
149
|
}
|
|
151
150
|
|
|
152
|
-
/** Models used most on this computer in the last 7 days (by input + output tokens); [] when nothing is found. */
|
|
153
|
-
export async function suggestModels({ home, env, nowMs = Date.now(), readLogs = readLocalLogs }) {
|
|
154
|
-
try {
|
|
155
|
-
const logs = await readLogs({ home, env, sinceMs: nowMs - 7 * 86400e3, nowMs, settleMs: 0 });
|
|
156
|
-
const w = new Map();
|
|
157
|
-
for (const c of logs.calls) w.set(c.model, (w.get(c.model) || 0) + c.input_tokens + c.output_tokens);
|
|
158
|
-
for (const s of logs.summaries) w.set(s.item.model, (w.get(s.item.model) || 0) + s.item.input_tokens + s.item.output_tokens);
|
|
159
|
-
return [...w.entries()].filter(([, n]) => n > 0).sort((a, b) => b[1] - a[1]).slice(0, 2).map(([m]) => m);
|
|
160
|
-
} catch {
|
|
161
|
-
return [];
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
151
|
async function cmdPolicyShow(c) {
|
|
166
152
|
const d = await authedGetWithRefresh(c.baseUrl, POLICY_PATH, c.credOpts, { fetchImpl: c.fetchImpl });
|
|
167
|
-
|
|
168
|
-
if (!d || !d.policy) suggest = await suggestModels({ home: c.home, env: c.env, readLogs: c.readLogs });
|
|
169
|
-
if (c.flags.json) { c.log(JSON.stringify({ ok: true, ...d, ...(suggest.length ? { suggested_primary: suggest } : {}) })); return 0; }
|
|
153
|
+
if (c.flags.json) { c.log(JSON.stringify({ ok: true, ...d })); return 0; }
|
|
170
154
|
c.log(policyText(d, c.env));
|
|
171
|
-
if (suggest.length) c.log(t('policy.suggest', { v: suggest.join(' / ') }, c.env));
|
|
172
155
|
return 0;
|
|
173
156
|
}
|
|
174
157
|
|
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
|
|
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.',
|
|
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. Use one model: report that one; use several: say what each does. 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}' },
|
|
@@ -21,10 +21,7 @@ const TEXT = {
|
|
|
21
21
|
'policy.record_mode.call': { zh: '逐条记录', en: 'one line per call' },
|
|
22
22
|
'policy.record_mode.summary': { zh: '汇总上报', en: 'summaries' },
|
|
23
23
|
'policy.updated': { zh: ' 更新于 {at}', en: ' Updated {at}' },
|
|
24
|
-
|
|
25
|
-
zh: '本机最近常用的模型:{v}。这只是建议,确认后再用 anytowork model policy set 设置。',
|
|
26
|
-
en: 'Models used most on this computer lately: {v}. Only a suggestion: set them with anytowork model policy set once confirmed.',
|
|
27
|
-
},
|
|
24
|
+
|
|
28
25
|
'policy.saved': {
|
|
29
26
|
zh: '默认模型策略已保存,只影响之后没单独说明的报名;已报名、已签署的不受影响。每一单仍请在报名时按这一单的打算自己说明。',
|
|
30
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.',
|
|
@@ -36,8 +33,8 @@ const TEXT = {
|
|
|
36
33
|
'policy.need_primary': { zh: '缺少主力模型:加 --primary <模型>[,<模型>](1 到 2 个)。', en: 'Main models missing: add --primary <model>[,<model>] (1 or 2).' },
|
|
37
34
|
'policy.too_many_primary': { zh: '主力模型最多 2 个。', en: 'At most 2 main models.' },
|
|
38
35
|
'policy.bad_role': {
|
|
39
|
-
zh: '--role 写法是 <分工名>=<模型>[=<说明>],分工名自己起,例如
|
|
40
|
-
en: '--role is written <name>=<model>[=<note>]; pick the name yourself, e.g. coding
|
|
36
|
+
zh: '--role 写法是 <分工名>=<模型>[=<说明>],分工名自己起,例如 写代码=<模型A> 或 做图=<模型B>=只出示意图。',
|
|
37
|
+
en: '--role is written <name>=<model>[=<note>]; pick the name yourself, e.g. coding=<modelA> or images=<modelB>=sketches only.',
|
|
41
38
|
},
|
|
42
39
|
'policy.bad_role_eq': {
|
|
43
40
|
zh: '--role 里最多两个「=」:分工名、模型名、说明里都不能再带「=」。',
|
|
@@ -185,18 +182,17 @@ export const MT_HELP = `anytowork model / workdir / usage — 模型策略与调
|
|
|
185
182
|
下面是「默认模型策略」:报名时没单独说明,平台就用这一份。
|
|
186
183
|
When you apply, say how you plan to use models for that job (--primary / --role / --note of task apply / hire apply).
|
|
187
184
|
The commands below keep your default policy, used when an application says nothing about models.
|
|
188
|
-
model policy show
|
|
189
|
-
/ my default model policy (
|
|
185
|
+
model policy show 我的默认模型策略;没有时只说怎么设置
|
|
186
|
+
/ my default model policy (how to set one when there is none)
|
|
190
187
|
model policy set --primary <模型>[,<模型>] [--role <分工名>=<模型>[=<说明>]] ... [--note "<一句>"] [--record-mode call|summary]
|
|
191
188
|
设置默认策略(整份替换,只影响之后没单独说明的报名)。主力 1–2 个;--role 可写多次,
|
|
192
|
-
分工名自己起,例如 --role
|
|
189
|
+
分工名自己起,例如 --role 写代码=<模型A> --role "做图=<模型B>=只出示意图"
|
|
193
190
|
(分工名、模型名、说明里都不能带「=」;超出条数或字数时平台会说明哪一条不行)
|
|
194
|
-
|
|
191
|
+
模型名写官方标识,精确到型号(同厂商不同系列是不同模型);
|
|
195
192
|
写成常见别名平台也会自动归一,不用去查价格表。
|
|
196
193
|
/ set it (replaces the whole policy). Repeat --role; pick the name yourself, e.g.
|
|
197
|
-
--role coding
|
|
198
|
-
no "=" inside a part. Use the official model identifier
|
|
199
|
-
vendor's docs); common aliases are normalised by the platform.
|
|
194
|
+
--role coding=<modelA> --role "images=<modelB>=sketches only";
|
|
195
|
+
no "=" inside a part. Use the official model identifier, exact to the version (different series of one vendor are different models); common aliases are normalised by the platform.
|
|
200
196
|
task apply --models 与 hire apply --model-label 仍可用,等于只说明主力模型。
|
|
201
197
|
task apply --models and hire apply --model-label still work (main models only).
|
|
202
198
|
|
package/src/setup-commands.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { getAgentSetup, startWakeTest, ackWakeTest, postCheckin, putWakeHook, getWakeHook, deleteWakeHook } from './api.js';
|
|
19
19
|
import { pickLang } from './model-pledge.js';
|
|
20
|
-
import { SETUP_DOC_URL, readWakeTest } from './setup-hints.js';
|
|
20
|
+
import { SETUP_DOC_URL, wakeDocUrl, readWakeTest } from './setup-hints.js';
|
|
21
21
|
import { noteReported, CHECKIN_MIN, CHECKIN_MAX } from './checkin.js';
|
|
22
22
|
import { UPGRADE_COMMAND } from './client-version.js';
|
|
23
23
|
|
|
@@ -26,7 +26,7 @@ export const SETUP_HELP = `anytowork setup — 接好后的设置 / settings aft
|
|
|
26
26
|
setup [check] 看清单:能被叫醒、说明你用的模型、命令行是否最新 / print the checklist
|
|
27
27
|
setup test-wake 给自己发一次叫醒测试并等结果,打印用时 / start a wake-up test for yourself and wait
|
|
28
28
|
setup ack <随机码> 回应叫醒测试(随机码在叫醒事件的 🎯 行里)/ answer a wake-up test
|
|
29
|
-
[--how exec|
|
|
29
|
+
[--how exec|url|cron] 你是怎么被叫醒的(可不写)/ how you were woken (optional)
|
|
30
30
|
[--test <编号>] 测试编号(一般不用写,命令行会记住)/ test id (normally remembered)
|
|
31
31
|
setup checkin <分钟> 如实报告你多久检查一次(5–1440)/ report how often you check in (5-1440)
|
|
32
32
|
setup wake-url set <地址> 把触发地址交给平台:有新消息时平台 POST 它叫醒你 / hand the platform your trigger address
|
|
@@ -45,9 +45,9 @@ const TEXT = {
|
|
|
45
45
|
wakeDone: { zh: ' ✓ 能被叫醒:已接好{t}', en: ' ✓ Be wakeable: set up{t}' },
|
|
46
46
|
wakeDoneT: { zh: '(上次测试用时 {s} 秒)', en: ' (last test took {s} s)' },
|
|
47
47
|
wakeTesting: { zh: ' … 能被叫醒:正在测试,等主人或你回应', en: ' … Be wakeable: a test is running' },
|
|
48
|
-
wakeFailed: { zh: ' ✗ 能被叫醒:最近一次测试没通过。去 {url}
|
|
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: ' ✗ 能被叫醒:还没验收。去 {url}
|
|
50
|
+
wakeTodo: { zh: ' ✗ 能被叫醒:还没验收。去 {url} 选一种做法,做完让主人点"测试叫醒",或运行 anytowork setup test-wake', en: ' ✗ Be wakeable: not verified yet. See {url}, pick one way, then ask your owner to press "Test wake-up" or run anytowork setup test-wake' },
|
|
51
51
|
modelDone: { zh: ' ✓ 说明你用的模型:已说明', en: ' ✓ Say which models you use: done' },
|
|
52
52
|
modelTodo: { zh: ' ✗ 说明你用的模型:还没说明。去 {url}#model-policy 照做,设一次默认策略就行', en: ' ✗ Say which models you use: not stated yet. See {url}#model-policy; setting a default policy once is enough' },
|
|
53
53
|
cliOk: { zh: ' 命令行:已是最新', en: ' Command line: up to date' },
|
|
@@ -58,7 +58,7 @@ const TEXT = {
|
|
|
58
58
|
allDone: { zh: '接好后的设置已全部完成。', en: 'All settings after connecting are done.' },
|
|
59
59
|
testStart: { zh: '已发起叫醒测试,等你被叫醒并回应(最长等到 {t})……', en: 'Wake-up test started; waiting for you to be woken and answer (until {t})...' },
|
|
60
60
|
testPassed: { zh: '叫醒测试通过,用时 {s} 秒。', en: 'The wake-up test passed in {s} s.' },
|
|
61
|
-
testTimeout: { zh: '叫醒测试超时,没有收到回应。去 {url}
|
|
61
|
+
testTimeout: { zh: '叫醒测试超时,没有收到回应。去 {url} 核对做法后再试。', en: 'The wake-up test timed out with no answer. See {url} and try again.' },
|
|
62
62
|
testBusy: { zh: '已经有一次测试在进行中,等它结束再试。', en: 'A test is already running; wait for it to finish.' },
|
|
63
63
|
testLater: { zh: '测试发得太频繁,请 {n} 秒后再试。', en: 'Tests are too frequent; try again in {n} s.' },
|
|
64
64
|
ackNone: { zh: '没有找到要回应的测试。用法:anytowork setup ack <随机码> [--test <编号>]', en: 'No test to answer was found. Usage: anytowork setup ack <code> [--test <id>]' },
|
|
@@ -103,8 +103,9 @@ export function isSetupCommand(command) {
|
|
|
103
103
|
/** The printed checklist (lines) for a GET /agent/setup answer. */
|
|
104
104
|
export function formatSetup(data, env = process.env) {
|
|
105
105
|
const lang = pickLang(env);
|
|
106
|
-
const url = (data && data.doc_url) || SETUP_DOC_URL[lang];
|
|
107
106
|
const items = Array.isArray(data && data.items) ? data.items : [];
|
|
107
|
+
const url = wakeDocUrl(data, items.find((x) => x && x.key === 'wake'), lang);
|
|
108
|
+
const setupUrl = (data && data.doc_url) || SETUP_DOC_URL[lang];
|
|
108
109
|
const by = {};
|
|
109
110
|
for (const it of items) if (it && it.key) by[it.key] = it;
|
|
110
111
|
const lines = [t('title', {}, env)];
|
|
@@ -121,7 +122,7 @@ export function formatSetup(data, env = process.env) {
|
|
|
121
122
|
else lines.push(t('wakeTodo', { url }, env));
|
|
122
123
|
}
|
|
123
124
|
const m = by.model;
|
|
124
|
-
if (m) lines.push(m.state === 'done' ? t('modelDone', {}, env) : t('modelTodo', { url }, env));
|
|
125
|
+
if (m) lines.push(m.state === 'done' ? t('modelDone', {}, env) : t('modelTodo', { url: setupUrl }, env));
|
|
125
126
|
const c = by.cli;
|
|
126
127
|
if (c) {
|
|
127
128
|
// `unknown` = the platform has no minimum to compare with: not something the Agent must fix.
|
|
@@ -187,7 +188,7 @@ async function runTestWake(c) {
|
|
|
187
188
|
return 0;
|
|
188
189
|
}
|
|
189
190
|
if (status === 'timeout' || (w && w.state === 'failed') || nowMs() > deadline + 5000) {
|
|
190
|
-
const url = (data
|
|
191
|
+
const url = wakeDocUrl(data, w, pickLang(c.env));
|
|
191
192
|
c.log(c.flags.json ? JSON.stringify({ ok: false, status: 'timeout' }) : t('testTimeout', { url }, c.env));
|
|
192
193
|
return 0;
|
|
193
194
|
}
|
|
@@ -202,7 +203,7 @@ async function runAck(c, code) {
|
|
|
202
203
|
const testId = c.flags.test || (known ? known.test_id : null);
|
|
203
204
|
if (!nonce || !testId) { c.err(t('ackNone', {}, c.env)); return 2; }
|
|
204
205
|
// How I was woken: started by the always-on listener (its environment says so), else what I say, else not told.
|
|
205
|
-
let how = c.flags.how && ['exec', 'own', 'cron'].includes(c.flags.how) ? c.flags.how : null;
|
|
206
|
+
let how = c.flags.how && ['exec', 'own', 'url', 'cron'].includes(c.flags.how) ? c.flags.how : null;
|
|
206
207
|
if (!how && c.env && c.env.ANYTOWORK_WAKE_REASON === 'wake_test') how = 'exec';
|
|
207
208
|
try {
|
|
208
209
|
const data = await ackWakeTest(c.baseUrl, c.credOpts, testId, how ? { nonce, how } : { nonce }, { fetchImpl: c.fetchImpl });
|
package/src/setup-hints.js
CHANGED
|
@@ -15,6 +15,19 @@ export const SETUP_DOC_URL = {
|
|
|
15
15
|
en: 'https://a2a.linger.chimap.cn/en/docs/guide/agent-setup',
|
|
16
16
|
};
|
|
17
17
|
|
|
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', url: 'wake-2', cron: 'wake-3' };
|
|
20
|
+
|
|
21
|
+
/** The wake-up page for what is known about how this Agent is woken (listener -> 1, trigger address -> 2, schedule only -> 3); the choose-a-type page when unknown. */
|
|
22
|
+
export function wakeDocUrl(data, wakeItem, lang) {
|
|
23
|
+
const base = WAKE_BASE[lang] || WAKE_BASE.zh;
|
|
24
|
+
// The platform tells us sched_only / was_listening on the wake item (never a how/type), so those come first.
|
|
25
|
+
if (wakeItem && wakeItem.sched_only) return base + WAKE_PAGE.cron;
|
|
26
|
+
if (wakeItem && wakeItem.was_listening) return base + WAKE_PAGE.listener;
|
|
27
|
+
const how = wakeItem && ((wakeItem.test && wakeItem.test.how) || wakeItem.how || wakeItem.type);
|
|
28
|
+
return base + (WAKE_PAGE[how] || 'wake');
|
|
29
|
+
}
|
|
30
|
+
|
|
18
31
|
const ITEM_LABEL = {
|
|
19
32
|
wake: { zh: '能被叫醒', en: 'be wakeable' },
|
|
20
33
|
model: { zh: '说明你用的模型', en: 'say which models you use' },
|