teamsmith 0.3.3 → 0.3.4
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 +4 -4
- package/package.json +2 -6
- package/skills/teamsmith/CHANGELOG.md +47 -0
- package/skills/teamsmith/SKILL.md +1 -1
- package/skills/teamsmith/extension/team-inbox-watch.ts +30 -1
- package/skills/teamsmith/extension/team-notify.ts +161 -20
- package/skills/teamsmith/references/agent-adapters.md +3 -1
- package/skills/teamsmith/references/config.md +1 -1
- package/skills/teamsmith/references/protocol.md +21 -0
- package/skills/teamsmith/references/troubleshooting.md +7 -3
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +213 -19
- package/skills/teamsmith/scripts/lib/cmd-config.sh +1 -1
- package/skills/teamsmith/scripts/lib/cmd-status.sh +177 -21
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +11 -1
- package/skills/teamsmith/scripts/lib/common.sh +7 -3
- package/skills/teamsmith/scripts/lib/outbox.sh +31 -3
- package/skills/teamsmith/scripts/panel/panel.js +1 -1
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +1 -1
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +1 -1
- package/skills/teamsmith/scripts/team +1 -0
- package/skills/teamsmith/templates/config.sh.tmpl +2 -1
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +17 -6
- package/skills/teamsmith/tests/bg-ledger.sh +16 -5
- package/skills/teamsmith/tests/help-surface.sh +1 -1
- package/skills/teamsmith/tests/install-shape.sh +88 -38
- package/skills/teamsmith/tests/panel-choices.sh +11 -7
- package/skills/teamsmith/tests/section-paths.tsv +2 -2
- package/skills/teamsmith/tests/smoke.sh +594 -11
- package/skills/teamsmith/tests/task-model-routing.sh +10 -1
- package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +33 -0
- package/skills/teamsmith/tests/team-notify-knock-marker.mjs +91 -0
- package/skills/teamsmith-init/SKILL.md +1 -1
|
@@ -1490,7 +1490,16 @@ if has flip; then
|
|
|
1490
1490
|
init-legacy-proceeds)
|
|
1491
1491
|
check flip-init-legacy-proceeds-plain grep -q '^FAIL init-legacy-plain-refused$' "$TMP/flip-$mutation.log"
|
|
1492
1492
|
check flip-init-legacy-proceeds-force grep -q '^FAIL init-legacy-force-refused$' "$TMP/flip-$mutation.log"
|
|
1493
|
-
|
|
1493
|
+
# P377:**非 --print** 的 bootstrap 在变异 scratch 上不能按 rc 判红。scratch 只拷
|
|
1494
|
+
# scripts/references/templates/extension(不看 SKILL.md、也不带 teamsmith-init / handover),
|
|
1495
|
+
# 不是可安装的 skill 源:闸门一拆,bootstrap 过了策略闸门就在装 skill 处 rc=1
|
|
1496
|
+
# (`✗ 技能源不合法:… 没有 SKILL.md`)。于是 `init-legacy-bootstrap-refused`(只看
|
|
1497
|
+
# rc≠0)在变异体上假绿、在**控制与变异两侧都绿**,这条臂点不到名(0.3.4 冻结门的唯一红)。
|
|
1498
|
+
# 闸门被拆掉后同一路径上**真的消失**的是拒绝输出里的推导路线 —— 用它做命名断言;
|
|
1499
|
+
# rc 侧的翻转由不装 skill 的 --print 路径证明(变异体 rc=0 → 拒绝断言红)。
|
|
1500
|
+
check flip-init-legacy-proceeds-bootstrap grep -q '^FAIL init-legacy-bootstrap-derived$' "$TMP/flip-$mutation.log"
|
|
1501
|
+
check flip-init-legacy-proceeds-bootstrap-startup grep -q '^FAIL init-legacy-bootstrap-startup-route$' "$TMP/flip-$mutation.log"
|
|
1502
|
+
check flip-init-legacy-proceeds-print grep -q '^FAIL init-legacy-print-refused$' "$TMP/flip-$mutation.log" ;;
|
|
1494
1503
|
template-retired-key)
|
|
1495
1504
|
check flip-template-retired-key-specific grep -q '^FAIL init-fresh-no-retired-key$' "$TMP/flip-$mutation.log" ;;
|
|
1496
1505
|
migration-row-removed)
|
|
@@ -378,6 +378,16 @@ if (only('S4')) {
|
|
|
378
378
|
const body = lastText()
|
|
379
379
|
check('S4 long payload is truncated in the wake (no payload dump)', !body.includes('TAIL-MARKER') && body.includes('…'),
|
|
380
380
|
`len=${body.length}`)
|
|
381
|
+
// notice-fulltext-and-asks(P370 B):wake 这一层**自己**剪、自己说(160 字的剪断常常把 spool 层那个标记
|
|
382
|
+
// 剪掉)—— 必须看得见 `truncated=preview:<shown>/<total>B` 与指向 durable 收件箱的 `full=`。
|
|
383
|
+
{
|
|
384
|
+
const wakeLine = body.split('\n').find(l => l.startsWith('- ') && l.includes('…')) ?? ''
|
|
385
|
+
const m = /truncated=preview:(\d+)\/(\d+)B full=(\S+)/.exec(wakeLine)
|
|
386
|
+
const preview = process.env.TEAM_INBOX_WATCH_PREVIEW
|
|
387
|
+
check('S4 the wake names its own cut and where the whole text is',
|
|
388
|
+
!!m && Number(m[1]) > 0 && Number(m[1]) < Number(m[2]) && /\/inbox\/pm\.md$/.test(m[3]),
|
|
389
|
+
`${m ? `shown=${m[1]} total=${m[2]} full=${m[3]}` : 'no marker'} preview=${preview} :: ${wakeLine}`)
|
|
390
|
+
}
|
|
381
391
|
const before2 = sent.length
|
|
382
392
|
for (let i = 0; i < 8; i++) appendWake('say', 'dev', 'pm', `many ${i}`)
|
|
383
393
|
await sleep(600)
|
|
@@ -1054,6 +1064,29 @@ const degradedFiles = () => (existsSync(WATCH_DIR) ? readdirSync(WATCH_DIR).filt
|
|
|
1054
1064
|
process.env.TEAM_INBOX_WATCH_POLL_MS = '3600000'
|
|
1055
1065
|
}
|
|
1056
1066
|
|
|
1067
|
+
// ── S27(P370 B)· wake 层自己写截断标记:**轮询路径**(不依赖 fs.watch)────────────
|
|
1068
|
+
// 为什么要有这一条:S4 走 watcher,前提不可用时只能可见 SKIP;而「预览被剪就说出来」是产品的行为,
|
|
1069
|
+
// 不该随机器能力变成空跑。这里用 100ms 轮询把同一条行为再判一次(两种前提下都真跑)。
|
|
1070
|
+
process.env.TEAM_INBOX_WATCH_POLL_MS = '100'
|
|
1071
|
+
if (only('S27')) {
|
|
1072
|
+
await resetState()
|
|
1073
|
+
await sessionStart()
|
|
1074
|
+
const before = sent.length // sent 是跨用例的累积数组:只看**这一拍新增**的那条
|
|
1075
|
+
appendWake('knock', 'dev', 'pm', `${'X'.repeat(400)}TAIL-MARKER`)
|
|
1076
|
+
const woke = await waitFor(() => sent.length > before)
|
|
1077
|
+
const body = lastText()
|
|
1078
|
+
const m = /truncated=preview:(\d+)\/(\d+)B full=(\S+)/.exec(body)
|
|
1079
|
+
check('S27 the wake names its own cut and where the whole text is',
|
|
1080
|
+
woke && !!m && Number(m[1]) > 0 && Number(m[1]) < Number(m[2]) && /\/inbox\/pm\.md$/.test(m[3]) && !body.includes('TAIL-MARKER'),
|
|
1081
|
+
`${m ? `shown=${m[1]} total=${m[2]} full=${m[3]}` : 'no marker'} preview=${process.env.TEAM_INBOX_WATCH_PREVIEW} :: ${body.replace(/\n/g, ' | ').slice(0, 220)}`)
|
|
1082
|
+
const before2 = sent.length
|
|
1083
|
+
appendWake('say', 'pm', 'pm', 'S27 short line with no cut')
|
|
1084
|
+
await waitFor(() => sent.length > before2)
|
|
1085
|
+
check('S27 a preview that was not cut carries no marker', sent.length > before2 && !lastText().includes('truncated='),
|
|
1086
|
+
lastText().replace(/\n/g, ' | ').slice(0, 220))
|
|
1087
|
+
}
|
|
1088
|
+
process.env.TEAM_INBOX_WATCH_POLL_MS = '100'
|
|
1089
|
+
|
|
1057
1090
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
1058
1091
|
// P81 · wake-delivery-idempotence:投递日志 / 至多一次 / fail-closed / 源行点名
|
|
1059
1092
|
// 事故:一条 nudge 让 PM 在一个多小时里被「同一条」叫醒三次,而 durable 文件回答不了
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// P370 · 敲门层的标记样品(`smoke.sh` §12b-pi 的三层形状比对之一:TS×2 + bash×1 必须同一种标记)。
|
|
3
|
+
//
|
|
4
|
+
// node skills/teamsmith/tests/team-notify-knock-marker.mjs skills/teamsmith/extension/team-notify.ts
|
|
5
|
+
//
|
|
6
|
+
// 做法:在一个一次性 git 项目 + 工作树里,用**产品扩展本身**跑一次 `agent_settled`(末消息 3000 字),
|
|
7
|
+
// 再从它产出的敲门载荷里取出那串 `truncated=preview:<shown>/<total>B full=<path>[:<line>]`,打到 stdout。
|
|
8
|
+
// 假 tmux 只在 PATH 里:它让投递走既有的「多行内容落成 draft 文件、只打一行指针」路径,于是载荷落在
|
|
9
|
+
// 项目自己的 `state/draft/` 里可读。
|
|
10
|
+
//
|
|
11
|
+
// 没有载荷 / 载荷没有被剪 / 扩展报错 → stdout 空、退出码 0:判定留给调用方("缺样品" 在那里是红,
|
|
12
|
+
// 不是这里的热闹)。真正的失败信息走 stderr,调用方把它贴进门禁日志。
|
|
13
|
+
import { execFileSync } from 'node:child_process'
|
|
14
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
15
|
+
import { tmpdir } from 'node:os'
|
|
16
|
+
import { join, resolve } from 'node:path'
|
|
17
|
+
|
|
18
|
+
const ext = resolve(process.argv[2] ?? '')
|
|
19
|
+
if (!existsSync(ext)) {
|
|
20
|
+
console.error(`team-notify-knock-marker: 找不到扩展 ${ext}`)
|
|
21
|
+
process.exit(2)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 身份隔离(M7.2 纪律):一条继承来的 TEAM_* 都不许把样品指到真实项目/真实账本上。
|
|
25
|
+
for (const k of Object.keys(process.env)) if (k.startsWith('TEAM_')) delete process.env[k]
|
|
26
|
+
delete process.env.TMUX_PANE
|
|
27
|
+
delete process.env.TMUX
|
|
28
|
+
|
|
29
|
+
const TMP = mkdtempSync(join(tmpdir(), 'p370-knock-'))
|
|
30
|
+
process.on('exit', () => { try { rmSync(TMP, { recursive: true, force: true }) } catch { /* ignore */ } })
|
|
31
|
+
|
|
32
|
+
const ROOT = join(TMP, 'repo')
|
|
33
|
+
const WT = join(ROOT, '.worktrees/dev')
|
|
34
|
+
const git = (...a) => execFileSync('git', ['-C', ROOT, ...a], { stdio: 'pipe' })
|
|
35
|
+
mkdirSync(join(ROOT, 'docs/team/inbox'), { recursive: true })
|
|
36
|
+
mkdirSync(join(ROOT, '.pi/team'), { recursive: true })
|
|
37
|
+
git('init', '-q', '-b', 'main')
|
|
38
|
+
git('config', 'user.email', 'knock-marker@teamsmith')
|
|
39
|
+
git('config', 'user.name', 'knock-marker')
|
|
40
|
+
writeFileSync(join(ROOT, 'README.md'), '# p370 knock marker\n')
|
|
41
|
+
writeFileSync(join(ROOT, '.pi/team/config.sh'), [
|
|
42
|
+
'TEAM_PROJECT="p370-knock"', 'TEAM_SESSION="p370-knock"', 'TEAM_PM_WINDOW="pm"',
|
|
43
|
+
'TEAM_WORKTREES_DIR=".worktrees"', 'TEAM_DOCS_DIR="docs/team"',
|
|
44
|
+
'TEAM_NOTIFY_TMUX="1"', 'TEAM_NOTIFY_DEDUP_SEC="0"', 'TEAM_INBOX_MAX_CHARS="150"',
|
|
45
|
+
`TEAM_NOTIFY_LOG="${join(TMP, 'notify.log')}"`, 'TEAM_AGENTS="dev"', '',
|
|
46
|
+
].join('\n'))
|
|
47
|
+
git('add', '-A')
|
|
48
|
+
git('commit', '-qm', 'init')
|
|
49
|
+
git('worktree', 'add', '-q', '-b', 'agent/dev', WT)
|
|
50
|
+
|
|
51
|
+
const shim = join(TMP, 'shim')
|
|
52
|
+
mkdirSync(shim)
|
|
53
|
+
writeFileSync(join(shim, 'tmux'), `#!/usr/bin/env bash
|
|
54
|
+
case "$*" in
|
|
55
|
+
*pane_current_command*) printf 'pi\\n' ;;
|
|
56
|
+
*window_name*) printf 'dev\\n' ;;
|
|
57
|
+
*session_name*) printf 'p370-knock\\n' ;;
|
|
58
|
+
*) printf '' ;;
|
|
59
|
+
esac
|
|
60
|
+
exit 0
|
|
61
|
+
`, { mode: 0o755 })
|
|
62
|
+
process.env.PATH = `${shim}:${process.env.PATH}`
|
|
63
|
+
process.env.TMUX_PANE = 'knock-marker-pane'
|
|
64
|
+
|
|
65
|
+
const mod = await import(`${ext}?t=${Date.now()}`)
|
|
66
|
+
let settle = null
|
|
67
|
+
mod.default({ on: (n, f) => { if (n === 'agent_settled') settle = f }, registerCommand: () => {}, registerTool: () => {}, sendMessage: () => {} })
|
|
68
|
+
if (!settle) {
|
|
69
|
+
console.error('team-notify-knock-marker: 扩展没有注册 agent_settled')
|
|
70
|
+
process.exit(3)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 3000 字 > TEAM_INBOX_MAX_CHARS(150):载荷必然被剪,于是必然带标记。
|
|
74
|
+
const text = 'P370-KNOCK-MARKER-' + 'q'.repeat(2980)
|
|
75
|
+
await settle({}, { cwd: WT, sessionManager: { getEntries: () => [{ message: { role: 'assistant', stopReason: 'stop', content: [{ text }] } }] } })
|
|
76
|
+
|
|
77
|
+
const state = join(ROOT, '.pi/team/state')
|
|
78
|
+
const walk = (d) => { try { return readdirSync(d, { withFileTypes: true }).flatMap(e => e.isDirectory() ? walk(join(d, e.name)) : [join(d, e.name)]) } catch { return [] } }
|
|
79
|
+
const payloads = [...walk(join(state, 'draft')), ...walk(join(state, 'outbox'))]
|
|
80
|
+
.map(f => { try { return readFileSync(f, 'utf8') } catch { return '' } })
|
|
81
|
+
.filter(t => t.includes('P370-KNOCK-MARKER-'))
|
|
82
|
+
if (payloads.length === 0) {
|
|
83
|
+
console.error('team-notify-knock-marker: 一次 settle 之后找不到敲门载荷(state/draft 与 state/outbox 都是空的)')
|
|
84
|
+
process.exit(0)
|
|
85
|
+
}
|
|
86
|
+
const marker = payloads.map(t => /truncated=preview:[0-9]+\/[0-9]+B full=[^ \n]*/.exec(t)).find(Boolean)
|
|
87
|
+
if (!marker) {
|
|
88
|
+
console.error(`team-notify-knock-marker: 载荷被剪了却没有标记(${payloads[0].slice(0, 120)}…)`)
|
|
89
|
+
process.exit(0)
|
|
90
|
+
}
|
|
91
|
+
console.log(marker[0])
|
|
@@ -3,7 +3,7 @@ name: teamsmith-init
|
|
|
3
3
|
description: teamsmith-init is the new-project entry point of the teamsmith toolkit — organize multiple agents into a team, set up an agent collaboration protocol, and bootstrap this skill into a new project. It walks the questions to settle with the user first (dependencies, session and roster, the task-category mapping and the independent PM model, gates, VCS mode, install command, and the project's ROADMAP/OWNERSHIP/AGENTS.md red lines), then runs the one command that writes `.pi/team/config.sh` + the `docs/team/` skeleton + the `AGENTS.md` protocol section and starts the pulse, and finally hands day-to-day operation to the `teamsmith` skill. Use when the user wants to bootstrap teamsmith into a new repository, set up a brand-new team, organize multiple agents into a team, or set up an agent collaboration protocol where none exists yet.
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.3.
|
|
6
|
+
version: "0.3.4"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# teamsmith-init · bring a new project to "ready to dispatch"
|