teamsmith 0.1.1 → 0.2.0
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 +16 -8
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +55 -0
- package/skills/teamsmith/SKILL.md +18 -7
- package/skills/teamsmith/extension/team-bg.ts +47 -11
- package/skills/teamsmith/extension/team-notify.ts +143 -4
- package/skills/teamsmith/references/agent-adapters.md +7 -7
- package/skills/teamsmith/references/config.md +29 -15
- package/skills/teamsmith/references/migration.md +38 -2
- package/skills/teamsmith/references/openspec.md +23 -9
- package/skills/teamsmith/references/protocol.md +81 -13
- package/skills/teamsmith/references/workflows.md +31 -19
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +210 -70
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +70 -9
- package/skills/teamsmith/scripts/lib/cmd-config.sh +222 -70
- package/skills/teamsmith/scripts/lib/cmd-death.sh +2 -15
- package/skills/teamsmith/scripts/lib/cmd-docs.sh +6 -3
- package/skills/teamsmith/scripts/lib/cmd-project.sh +134 -17
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
- package/skills/teamsmith/scripts/lib/cmd-review.sh +13 -10
- package/skills/teamsmith/scripts/lib/cmd-status.sh +42 -13
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +75 -13
- package/skills/teamsmith/scripts/lib/common.sh +797 -71
- package/skills/teamsmith/scripts/monitor.mjs +34 -3
- package/skills/teamsmith/scripts/panel/README.md +22 -11
- package/skills/teamsmith/scripts/panel/panel.js +217 -215
- package/skills/teamsmith/scripts/panel/src/App.tsx +421 -164
- package/skills/teamsmith/scripts/panel/src/data.ts +84 -4
- package/skills/teamsmith/scripts/panel/src/layout.ts +502 -91
- package/skills/teamsmith/scripts/panel/src/main.tsx +97 -12
- package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +56 -21
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +56 -21
- package/skills/teamsmith/scripts/panel/src/types.ts +178 -16
- package/skills/teamsmith/scripts/replies.mjs +893 -0
- package/skills/teamsmith/scripts/team +1 -0
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +15 -2
- package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
- package/skills/teamsmith/templates/config.sh.tmpl +10 -5
- package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +20 -1
- package/skills/teamsmith/templates/report.md.tmpl +12 -0
- package/skills/teamsmith/templates/task.md.tmpl +4 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +682 -0
- package/skills/teamsmith/tests/bg-ledger.sh +307 -0
- package/skills/teamsmith/tests/checkout-shape-probe.sh +287 -58
- package/skills/teamsmith/tests/config-cli.sh +162 -288
- package/skills/teamsmith/tests/death-cause.sh +5 -2
- package/skills/teamsmith/tests/install-shape.sh +4 -2
- package/skills/teamsmith/tests/key-replies-pty.sh +375 -0
- package/skills/teamsmith/tests/key-replies-ui.sh +332 -0
- package/skills/teamsmith/tests/key-replies.sh +1075 -0
- package/skills/teamsmith/tests/ledger-ban.sh +5 -5
- package/skills/teamsmith/tests/ledger-claim.sh +247 -0
- package/skills/teamsmith/tests/lib/checkout-shape.sh +66 -14
- package/skills/teamsmith/tests/lib/model-policy.sh +26 -0
- package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
- package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +136 -0
- package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
- package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
- package/skills/teamsmith/tests/lib/reply-fixture.sh +372 -0
- package/skills/teamsmith/tests/lib/tmux-iso.sh +8 -0
- package/skills/teamsmith/tests/panel-b2.sh +1 -1
- package/skills/teamsmith/tests/panel-b3-stub.sh +27 -0
- package/skills/teamsmith/tests/panel-b3.sh +14 -10
- package/skills/teamsmith/tests/panel-choices.sh +74 -61
- package/skills/teamsmith/tests/panel-cpu.sh +1 -1
- package/skills/teamsmith/tests/panel-p21.sh +311 -190
- package/skills/teamsmith/tests/perf.sh +1 -1
- package/skills/teamsmith/tests/pm-box-real.sh +1 -1
- package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
- package/skills/teamsmith/tests/routes.sh +43 -22
- package/skills/teamsmith/tests/section-budgets.tsv +9 -5
- package/skills/teamsmith/tests/section-paths.tsv +26 -16
- package/skills/teamsmith/tests/section-select.sh +99 -16
- package/skills/teamsmith/tests/smoke.sh +930 -216
- package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
- package/skills/teamsmith/tests/task-header-model.sh +2 -1
- package/skills/teamsmith/tests/task-model-routing.sh +1014 -0
- package/skills/teamsmith-init/SKILL.md +38 -38
- package/skills/teamsmith-init/references/bootstrap.md +6 -4
- package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
|
@@ -34,6 +34,9 @@ import {
|
|
|
34
34
|
import { execFileSync } from 'node:child_process'
|
|
35
35
|
import { homedir } from 'node:os'
|
|
36
36
|
import { join } from 'node:path'
|
|
37
|
+
import { fileURLToPath } from 'node:url'
|
|
38
|
+
|
|
39
|
+
const identityLib = fileURLToPath(new URL('./lib/', import.meta.url))
|
|
37
40
|
|
|
38
41
|
const MAX_TEXT = 150
|
|
39
42
|
const STALE_SECONDS = 3600
|
|
@@ -58,6 +61,7 @@ const asJson = arg('json', false) === true
|
|
|
58
61
|
// 非 Pi 的 agent:显示配置的日志/会话文件的尾部(空 = 不启用,只跟 Pi 会话)
|
|
59
62
|
const logGlob = String(arg('log-glob', process.env.TEAM_AGENT_LOG_GLOB || '') || '')
|
|
60
63
|
const sessionsRoot = join(homedir(), '.pi', 'agent', 'sessions')
|
|
64
|
+
const stateDir = String(arg('state-dir', join(root, '.pi/team/state')))
|
|
61
65
|
|
|
62
66
|
// ---------------------------------------------------------------- 显示安全:剥掉控制序列
|
|
63
67
|
// 显示文本,不显示控制字节。日志/会话内容都可能是别人写的:
|
|
@@ -225,7 +229,7 @@ function sessionDirFor(cwd) {
|
|
|
225
229
|
function newestSession(dir, match) {
|
|
226
230
|
try {
|
|
227
231
|
const files = readdirSync(dir)
|
|
228
|
-
.filter(f => f.endsWith('.jsonl') && (!match || f.
|
|
232
|
+
.filter(f => f.endsWith('.jsonl') && (!match || f.endsWith(match)))
|
|
229
233
|
.map(f => ({ f, m: mtimeMs(join(dir, f)) }))
|
|
230
234
|
.filter(e => e.m !== null)
|
|
231
235
|
.sort((a, b) => b.m - a.m)
|
|
@@ -235,6 +239,33 @@ function newestSession(dir, match) {
|
|
|
235
239
|
}
|
|
236
240
|
}
|
|
237
241
|
|
|
242
|
+
function committedSession(seat) {
|
|
243
|
+
const opened = openRegular(join(stateDir, `${seat}.env`))
|
|
244
|
+
if (!opened.ok) return null
|
|
245
|
+
let snapshot
|
|
246
|
+
try {
|
|
247
|
+
if (opened.size > 65536) return null
|
|
248
|
+
const { buf, error } = readRange(opened.fd, 0, opened.size)
|
|
249
|
+
if (error) return null
|
|
250
|
+
snapshot = buf
|
|
251
|
+
} finally { closeSync(opened.fd) }
|
|
252
|
+
// Use the CLI's one DATA validator on the exact bounded snapshot we opened.
|
|
253
|
+
// No source/eval of state or project config, no second read/TOCTOU, and no
|
|
254
|
+
// weaker JS copy of nonce/path/time/model rules. Bash is already required.
|
|
255
|
+
try {
|
|
256
|
+
const identity = execFileSync('bash', ['--noprofile', '--norc', '-c', `
|
|
257
|
+
source "$1/common.sh"; source "$1/cmd-config.sh"
|
|
258
|
+
data=''; IFS= read -r -d '' -n 65537 data && exit 1
|
|
259
|
+
team_assignment_parse "$2" "$data" || exit 1
|
|
260
|
+
printf '%s\\0%s' "\${TEAM_ASSIGN[worktree]}" "\${TEAM_ASSIGN[sid]}"
|
|
261
|
+
`, '_', identityLib, seat], { input: snapshot, encoding: 'utf8', timeout: 5000, stdio: ['pipe', 'pipe', 'ignore'] })
|
|
262
|
+
const [worktree, sid] = identity.split('\0')
|
|
263
|
+
if (!worktree || !sid) return null
|
|
264
|
+
// No neighboring B/base fallback, even when recorded A is missing.
|
|
265
|
+
return newestSession(sessionDirFor(worktree), `_${sid}.jsonl`)
|
|
266
|
+
} catch { return null }
|
|
267
|
+
}
|
|
268
|
+
|
|
238
269
|
const icons = { say: '💬', run: '🔧', out: ' ↳', think: '🤔', user: '👤' }
|
|
239
270
|
|
|
240
271
|
// Pi 会话:头部窗口(session 头 + 前面几条,够了)+ 尾窗(最近的消息)。
|
|
@@ -508,11 +539,11 @@ for (const t of targets()) {
|
|
|
508
539
|
continue
|
|
509
540
|
}
|
|
510
541
|
const dir = sessionDirFor(t.cwd)
|
|
511
|
-
const found =
|
|
542
|
+
const found = t.name === 'pm (PM)' ? newestSession(dir) : committedSession(t.name)
|
|
512
543
|
if (!found) {
|
|
513
544
|
const hint = logGlob
|
|
514
545
|
? `(无 pi 会话;TEAM_AGENT_LOG_GLOB 未匹配到文件:${logGlob})`
|
|
515
|
-
: '
|
|
546
|
+
: '(committed SID unavailable:缺少完整身份或对应会话文件;不回退邻近会话)'
|
|
516
547
|
blocks.push({ ...t, status: '⚫ 无会话', source: 'none', events: [], meta: hint })
|
|
517
548
|
continue
|
|
518
549
|
}
|
|
@@ -81,24 +81,35 @@ window, one process, the tick keeps logging. `team pulse up` restores the consol
|
|
|
81
81
|
The settings overlay (`,`) carries one navigation row — `项目设置` / `Project settings` — which opens the
|
|
82
82
|
project-settings view. It replaces the page's blocks (title band, tabs and key band stay) and lists the project
|
|
83
83
|
contract from `team __panel-data --block settings`, whose payload is exactly `team config list --json`: one row
|
|
84
|
-
per schema key plus one per key the file carries that the schema does not know, grouped by the **
|
|
85
|
-
command reports** (
|
|
86
|
-
|
|
87
|
-
row, a second click opens it), `/` opens the
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
per schema key plus one per key the file carries that the schema does not know, grouped by the **functional
|
|
85
|
+
group the command reports** (the schema row's `group`, rendered as a section rule), with the file's value, the
|
|
86
|
+
schema's default for an unset key, the line's own inline comment, the effect-class badge and the command's
|
|
87
|
+
warning/route text. `↑`/`↓` walk the row window (a click focuses a row, a second click opens it), `/` opens the
|
|
88
|
+
compose editor in `filter` mode (matches label, raw key, value, category or assignment; `esc` clears), and `esc`
|
|
89
|
+
returns to the overlay row it was opened from (`q` keeps its global collapse meaning). A `refuse` row opens no
|
|
90
|
+
editor — the command's route is shown. An editable row opens the compose line's `setting` mode holding the
|
|
90
91
|
file's value (or the schema default): the first `enter` runs `team config set … --dry-run` and renders the
|
|
91
92
|
confirmation (the class's timing; a danger reply needs one more `enter`), the second `enter` runs
|
|
92
93
|
`team config set … --yes` with the fingerprint pinned when the editor opened; the exit code maps to the receipt
|
|
93
|
-
and every settle re-reads the list and the audit footer.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
and every settle re-reads the list and the audit footer.
|
|
95
|
+
|
|
96
|
+
Under the keys, the same view separates **future policy** from **committed records** (P232). The categories
|
|
97
|
+
block lists one row per `TEAM_TASK_MODELS` entry in the read's own order; `enter` opens a picker built from the
|
|
98
|
+
project's known models plus a free-text entry (no removal entry: the writer has none) and every accept writes
|
|
99
|
+
through `team config set-task-model <category> <model>` — the pair list is never composed in the console. The
|
|
100
|
+
category receipt says the write affects new tasks only and that a committed task keeps its model/SID. The
|
|
101
|
+
`TEAM_TASK_MODELS` row itself routes to that block instead of opening an editor, and `TEAM_PM_MODEL` keeps its
|
|
102
|
+
ordinary model editor (`team config set TEAM_PM_MODEL …`). The assignments block below is **read-only**: one row
|
|
103
|
+
per seat showing the committed `state/<seat>.env` record (task, category, complete model, `selected_via`/
|
|
104
|
+
`launch_via`, SID) plus the PM's own `state/pm-launch.env` record — a seat without a complete record says so
|
|
105
|
+
rather than borrowing the policy's model. Nothing in the view restarts a pulse, a PM or a seat; a legacy
|
|
106
|
+
contract (retired model keys) shows the command's migration diagnosis, naming the CLI route, and offers no
|
|
107
|
+
seat/default editor.
|
|
97
108
|
|
|
98
109
|
The view is console-only: `--print`/`--json` never read it, a parked console spawns no `settings` child (the
|
|
99
110
|
`detail` block's on-demand rule), and the reader rides the open view, never the frame cadence.
|
|
100
111
|
|
|
101
|
-
The pty fixtures for it are `tests/panel-p21.sh` (scenarios `settings write conflict
|
|
112
|
+
The pty fixtures for it are `tests/panel-p21.sh` (scenarios `settings write conflict categories readonly`, driven
|
|
102
113
|
through the real CLI behind an argv-logging wrapper).
|
|
103
114
|
|
|
104
115
|
## Compose and the three actions (pulse-console B2)
|