work-rhythm 0.2.21 → 0.2.22
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/.agents/notes/AGENTS.md +10 -3
- package/.agents/notes/decisions/2026-11-30-bot-inbound-uses-websocket-and-a-responder-command.md +1 -0
- package/.agents/notes/decisions/2026-11-30-skill-ships-with-its-template-in-a-zip.md +1 -0
- package/.agents/notes/decisions/2026-12-01-agent-binding-asks-for-model-and-effort.md +1 -0
- package/.agents/notes/decisions/2026-12-01-interjections-batch-into-one-answer-and-interrupt-reruns.md +1 -0
- package/.agents/notes/decisions/2026-12-01-router-and-worker-pass-content-in-handoff-docs.md +1 -0
- package/.agents/notes/decisions/2026-12-01-router-runs-on-a-flash-model-with-low-effort.md +1 -0
- package/.agents/notes/decisions/2026-12-03-codex-cli-joins-as-a-preset-verified-against-its-own-binary.md +45 -0
- package/.agents/notes/decisions/2026-12-03-fewer-scheduled-tasks-silent-refine-no-question-cards.md +1 -0
- package/.agents/notes/decisions/2026-12-03-playbook-distills-handoffs-into-ws-tool-and-skill-know-how.md +43 -0
- package/.agents/notes/decisions/2026-12-03-related-work-comes-back-as-one-reply.md +49 -0
- package/.agents/notes/decisions/2026-12-03-roster-of-worker-groups-router-picks-the-group.md +33 -0
- package/.agents/notes/decisions/2026-12-03-router-model-and-effort-are-configurable.md +28 -0
- package/.agents/notes/decisions/2026-12-03-router-only-direct-mode-removed.md +27 -0
- package/.agents/notes/decisions/2026-12-03-unattended-runs-decide-on-their-own.md +32 -0
- package/.agents/notes/decisions/2026-12-03-update-upgrades-package-and-refreshes-shipped-files.md +30 -0
- package/.agents/notes/decisions/2026-12-03-workers-leave-a-status-trail-that-joins-the-receipt.md +31 -0
- package/.agents/notes/pitfalls/2026-12-01-replace-string-dollar-quote-expands.md +2 -0
- package/.agents/notes/pitfalls/2026-12-03-judging-a-symlink-by-realpath-ignores-parent-links.md +18 -0
- package/.agents/skills/work-rhythm/SKILL.md +20 -16
- package/README.md +13 -10
- package/collectors/local.env.example +31 -36
- package/docs/agents.md +61 -60
- package/docs/channels.md +15 -19
- package/docs/formats.md +27 -0
- package/docs/router-worker.md +60 -41
- package/docs/scheduled-tasks.md +9 -9
- package/package.json +1 -1
- package/scripts/cli.js +9 -5
- package/scripts/cmd/agent.js +348 -235
- package/scripts/cmd/check.js +14 -7
- package/scripts/cmd/listen.js +33 -32
- package/scripts/cmd/pack.js +6 -6
- package/scripts/cmd/rhythm.js +13 -10
- package/scripts/cmd/trigger.js +23 -14
- package/scripts/cmd/update.js +92 -0
- package/scripts/lib/agent.js +235 -142
- package/scripts/lib/agents.js +179 -0
- package/scripts/lib/bot.js +44 -263
- package/scripts/lib/engine.js +327 -110
- package/scripts/lib/handoff.js +54 -8
- package/scripts/lib/markdown.js +19 -0
- package/scripts/lib/playbook.js +123 -0
- package/scripts/lib/rhythm.js +405 -170
- package/scripts/lib/router.js +45 -29
- package/scripts/lib/template.js +3 -3
- package/scripts/lib/update.js +279 -0
- package/scripts/lib/worker.js +11 -5
- package/scripts/test/agent.test.js +410 -257
- package/scripts/test/check.test.js +17 -6
- package/scripts/test/harness.js +5 -2
- package/scripts/test/listen.test.js +190 -158
- package/scripts/test/playbook.test.js +106 -0
- package/scripts/test/rhythm.test.js +164 -54
- package/scripts/test/roster.test.js +155 -0
- package/scripts/test/router-helper.js +17 -2
- package/scripts/test/router.test.js +468 -194
- package/scripts/test/stubs.js +51 -4
- package/scripts/test/timeout.test.js +160 -59
- package/scripts/test/update.test.js +384 -0
- package/tasks/daily-persona.md +30 -11
- package/tasks/daily-plan.md +2 -1
- package/tasks/noon-checkin.md +2 -1
- package/templates/00-config/profile.example.yaml +9 -6
- package/templates/04-patterns/PERSONA.md +4 -1
- package/templates/04-patterns/PLAYBOOK.md +13 -0
- package/templates/AGENTS.md +6 -2
- package/templates/README.md +10 -9
|
@@ -182,27 +182,38 @@ test('check:没装 security 时报出来', (t) => {
|
|
|
182
182
|
assert.match(r.stdout, /消息渠道 yzj-robot 需要 security,本机没有/);
|
|
183
183
|
});
|
|
184
184
|
|
|
185
|
-
test('check:只绑了 agent 跑定时任务、没装值守,不报值守的事;schedule
|
|
185
|
+
test('check:只绑了 agent 跑定时任务、没装值守,不报值守的事;schedule 有任务却没绑好 agent 才报(local.env 的老写法和名册都认)', (t) => {
|
|
186
186
|
const s = setup(t);
|
|
187
|
+
const roster = `${s.box.work}/00-config/agents.json`;
|
|
187
188
|
s.localEnv('YZJ_BOT_AGENT="dsh"\n');
|
|
188
189
|
const r = s.check({ ...s.stubs });
|
|
189
190
|
assert.equal(r.code, 0, r.out);
|
|
190
191
|
assert.ok(!r.out.includes('值守'), r.out);
|
|
191
|
-
//
|
|
192
|
+
// 名册:路由和执行者分开绑,local.env 里不用再写。引导做完(status: done)之后才查它配得对不对
|
|
193
|
+
s.localEnv('');
|
|
192
194
|
write(`${s.box.work}/00-config/profile.yaml`, read(`${s.box.work}/00-config/profile.yaml`).replace('status: new', 'status: done'));
|
|
193
|
-
|
|
195
|
+
write(roster, JSON.stringify({ router: { agent: 'dsh', model: '', effort: '' }, workers: [{ id: 'w1', agent: 'zcode', model: '', effort: '', count: 1 }] }));
|
|
196
|
+
const named = s.check({ ...s.stubs, ZCODE_CLI: '/nonexistent/zcode' });
|
|
197
|
+
assert.equal(named.code, 1, named.out);
|
|
198
|
+
assert.match(named.stdout, /执行者 w1(zcode):[^\n]*\/nonexistent\/zcode/);
|
|
199
|
+
assert.equal(s.check({ ...s.stubs }).code, 0, s.check({ ...s.stubs }).out);
|
|
200
|
+
// 名册里只有路由、没有执行者:一样是没绑好
|
|
201
|
+
write(roster, JSON.stringify({ router: { agent: 'dsh', model: '', effort: '' }, workers: [] }));
|
|
202
|
+
assert.match(s.check({ ...s.stubs }).stdout, /schedule 里有任务([^)]*)却没绑好 agent,到点一个也跑不了/);
|
|
203
|
+
// 引导做完(status: done)、名册和 local.env 都没绑:schedule 里有任务(模板的默认时间)就报
|
|
204
|
+
fs.rmSync(roster);
|
|
194
205
|
const r2 = s.check({ ...s.stubs });
|
|
195
206
|
assert.equal(r2.code, 1, r2.out);
|
|
196
|
-
assert.match(r2.stdout, /schedule 里有任务(daily-plan、evening-review、daily-persona
|
|
207
|
+
assert.match(r2.stdout, /schedule 里有任务(daily-plan、evening-review、daily-persona)却没绑好 agent,到点一个也跑不了:work-rhythm agent bind <qoder\|dsh\|zcode\|claude\|codex\|kimi>(路由和执行者都绑上)/);
|
|
197
208
|
});
|
|
198
209
|
|
|
199
|
-
test('check
|
|
210
|
+
test('check:值守装了之后,配的命令找不到时报出来(路由和执行者各报一条)', (t) => {
|
|
200
211
|
const s = setup(t);
|
|
201
212
|
s.setNotify('yzj-robot');
|
|
202
213
|
s.localEnv('YZJ_BOT_AGENT="/nonexistent/agent x"\nYZJ_MY_OPEN_ID="me-0001"\n');
|
|
203
214
|
const r = s.check({ ...s.botInstalled(), STUB_KEYCHAIN: 'ok' });
|
|
204
215
|
assert.equal(r.code, 1);
|
|
205
|
-
assert.match(r.stdout,
|
|
216
|
+
assert.match(r.stdout, /路由(\/nonexistent\/agent x):自定义命令找不到: \/nonexistent\/agent\n执行者 w1(\/nonexistent\/agent x):自定义命令找不到: \/nonexistent\/agent/);
|
|
206
217
|
assert.ok(!r.stdout.includes('值守属于 yzj-robot 渠道'));
|
|
207
218
|
});
|
|
208
219
|
|
package/scripts/test/harness.js
CHANGED
|
@@ -16,8 +16,8 @@ const BIN = path.join(PACKAGE_ROOT, 'scripts', 'work-rhythm.js');
|
|
|
16
16
|
const T = '\t';
|
|
17
17
|
|
|
18
18
|
// 这些变量是各命令的配置,本机环境里如果碰巧有,会让用例的结果跟着变。跑命令时一律不带
|
|
19
|
-
// CLAUDE、QODER 也抹掉:调用这个测试的 agent 会留自己的标记(ZCODE_*、CLAUDE_CODE_*、DSH_SESSION_ID
|
|
20
|
-
const STRIP = /^(YZJ_|GIT_ACTIVITY_|FILE_ACTIVITY_|DSH_|STUB_|ZCODE_|WORK_RHYTHM_|DECISIONS_TODAY|LINKY_TYPES|CLAUDE|QODER|KIMI_)/;
|
|
19
|
+
// CLAUDE、QODER 也抹掉:调用这个测试的 agent 会留自己的标记(ZCODE_*、CLAUDE_CODE_*、DSH_SESSION_ID、CODEX_*),用例不能被它带偏
|
|
20
|
+
const STRIP = /^(YZJ_|GIT_ACTIVITY_|FILE_ACTIVITY_|DSH_|STUB_|ZCODE_|WORK_RHYTHM_|DECISIONS_TODAY|LINKY_TYPES|CLAUDE|QODER|KIMI_|CODEX_)/;
|
|
21
21
|
const { writeWorkdir } = require('../lib/template');
|
|
22
22
|
|
|
23
23
|
// 用户级登记指向一个不存在的文件:用例不能被本机登记的工作目录带偏
|
|
@@ -164,10 +164,13 @@ function makeSandbox(t) {
|
|
|
164
164
|
STUB_DSH_ENV: file('dsh.env'),
|
|
165
165
|
STUB_KIMI_ARGS: file('kimi.args'),
|
|
166
166
|
STUB_KIMI_ENV: file('kimi.env'),
|
|
167
|
+
STUB_CODEX_ARGS: file('codex.args'),
|
|
168
|
+
STUB_CODEX_ALL: file('codex.all'),
|
|
167
169
|
STUB_ROUTER_CALLS: file('router.calls'),
|
|
168
170
|
STUB_ROUTER_REPLY: file('router.reply'),
|
|
169
171
|
STUB_HELPER: helper,
|
|
170
172
|
KIMI_CLI: path.join(bin, 'fake-kimi'),
|
|
173
|
+
CODEX_CLI: path.join(bin, 'fake-codex'),
|
|
171
174
|
STUB_APPROVAL_NEW_MS: String(Date.UTC(2026, 10, 27, 10, 0, 0)),
|
|
172
175
|
STUB_APPROVAL_OLD_MS: String(Date.UTC(2026, 10, 16, 5, 30, 0)),
|
|
173
176
|
DSH_HOME: path.join(root, 'dsh-home'),
|