teamsmith 0.0.0-stage → 0.1.2
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/LICENSE +21 -0
- package/README.md +158 -2
- package/bin/team.mjs +59 -0
- package/install.sh +94 -0
- package/package.json +37 -4
- package/skills/teamsmith/CHANGELOG.md +763 -0
- package/skills/teamsmith/SKILL.md +312 -0
- package/skills/teamsmith/extension/team-bg.ts +435 -0
- package/skills/teamsmith/extension/team-inbox-watch.ts +1412 -0
- package/skills/teamsmith/extension/team-notify.ts +663 -0
- package/skills/teamsmith/references/agent-adapters.md +643 -0
- package/skills/teamsmith/references/config.md +477 -0
- package/skills/teamsmith/references/meeting.md +124 -0
- package/skills/teamsmith/references/memory.md +133 -0
- package/skills/teamsmith/references/migration.md +227 -0
- package/skills/teamsmith/references/openspec.md +222 -0
- package/skills/teamsmith/references/philosophy.md +95 -0
- package/skills/teamsmith/references/protocol.md +712 -0
- package/skills/teamsmith/references/troubleshooting.md +1384 -0
- package/skills/teamsmith/references/workflows.md +448 -0
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +1709 -0
- package/skills/teamsmith/scripts/lib/cmd-bg.sh +284 -0
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +311 -0
- package/skills/teamsmith/scripts/lib/cmd-config.sh +1156 -0
- package/skills/teamsmith/scripts/lib/cmd-death.sh +562 -0
- package/skills/teamsmith/scripts/lib/cmd-docs.sh +149 -0
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +124 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +212 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +904 -0
- package/skills/teamsmith/scripts/lib/cmd-outbox.sh +196 -0
- package/skills/teamsmith/scripts/lib/cmd-project.sh +642 -0
- package/skills/teamsmith/scripts/lib/cmd-review.sh +1393 -0
- package/skills/teamsmith/scripts/lib/cmd-status.sh +1399 -0
- package/skills/teamsmith/scripts/lib/cmd-update.sh +191 -0
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +1681 -0
- package/skills/teamsmith/scripts/lib/common.sh +4964 -0
- package/skills/teamsmith/scripts/lib/draft-entry.sh +51 -0
- package/skills/teamsmith/scripts/lib/outbox.sh +2042 -0
- package/skills/teamsmith/scripts/lib/tmux-argv.sh +165 -0
- package/skills/teamsmith/scripts/monitor.mjs +616 -0
- package/skills/teamsmith/scripts/panel/README.md +192 -0
- package/skills/teamsmith/scripts/panel/build.sh +47 -0
- package/skills/teamsmith/scripts/panel/bun.lock +109 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +68 -0
- package/skills/teamsmith/scripts/panel/package.json +24 -0
- package/skills/teamsmith/scripts/panel/panel.js +388 -0
- package/skills/teamsmith/scripts/panel/src/App.tsx +2150 -0
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +154 -0
- package/skills/teamsmith/scripts/panel/src/compose.ts +691 -0
- package/skills/teamsmith/scripts/panel/src/data.ts +555 -0
- package/skills/teamsmith/scripts/panel/src/format.ts +50 -0
- package/skills/teamsmith/scripts/panel/src/layout.ts +2562 -0
- package/skills/teamsmith/scripts/panel/src/main.tsx +894 -0
- package/skills/teamsmith/scripts/panel/src/markdown.ts +340 -0
- package/skills/teamsmith/scripts/panel/src/sanitize.ts +42 -0
- package/skills/teamsmith/scripts/panel/src/settings.ts +154 -0
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +416 -0
- package/skills/teamsmith/scripts/panel/src/strings/index.ts +65 -0
- package/skills/teamsmith/scripts/panel/src/strings/types.ts +9 -0
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +414 -0
- package/skills/teamsmith/scripts/panel/src/theme.ts +116 -0
- package/skills/teamsmith/scripts/panel/src/types.ts +652 -0
- package/skills/teamsmith/scripts/panel/src/width.ts +105 -0
- package/skills/teamsmith/scripts/panel/tsconfig.json +16 -0
- package/skills/teamsmith/scripts/shim/signal-gate +156 -0
- package/skills/teamsmith/scripts/shim/tmux +403 -0
- package/skills/teamsmith/scripts/team +143 -0
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +147 -0
- package/skills/teamsmith/templates/BOARD.md.tmpl +18 -0
- package/skills/teamsmith/templates/DECISIONS.md.tmpl +22 -0
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +25 -0
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +84 -0
- package/skills/teamsmith/templates/ROADMAP.md.tmpl +29 -0
- package/skills/teamsmith/templates/config.sh.tmpl +106 -0
- package/skills/teamsmith/templates/memory-seed.md.tmpl +46 -0
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +110 -0
- package/skills/teamsmith/templates/report.md.tmpl +36 -0
- package/skills/teamsmith/templates/task.md.tmpl +65 -0
- package/skills/teamsmith/templates/threads-README.md +17 -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 +800 -0
- package/skills/teamsmith/tests/config-cli.sh +1562 -0
- package/skills/teamsmith/tests/container-tmux.sh +493 -0
- package/skills/teamsmith/tests/coverage-inventory.sh +173 -0
- package/skills/teamsmith/tests/death-cause.sh +564 -0
- package/skills/teamsmith/tests/delivery-truth.sh +1231 -0
- package/skills/teamsmith/tests/fake-tui.py +450 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +60 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +139 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/mock-server.py +29 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/observe.ts +20 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +79 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +175 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +229 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/README.md +22 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/dev2.seen +8 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/dev2.wake +9 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/pm-nudges.wake +3 -0
- package/skills/teamsmith/tests/fixtures/signal-lint-cases.txt +40 -0
- package/skills/teamsmith/tests/flip-glue.sh +162 -0
- package/skills/teamsmith/tests/flip-m12-26c.sh +129 -0
- package/skills/teamsmith/tests/flip-m12.sh +185 -0
- package/skills/teamsmith/tests/flip-m16.sh +166 -0
- package/skills/teamsmith/tests/flip-m17.sh +204 -0
- package/skills/teamsmith/tests/flip-m33.sh +284 -0
- package/skills/teamsmith/tests/flip-m34.sh +96 -0
- package/skills/teamsmith/tests/flip-m37.sh +185 -0
- package/skills/teamsmith/tests/flip-m4.3.sh +375 -0
- package/skills/teamsmith/tests/flip-m43.sh +128 -0
- package/skills/teamsmith/tests/flip-m44.sh +262 -0
- package/skills/teamsmith/tests/flip-m45.sh +244 -0
- package/skills/teamsmith/tests/flip-m46.sh +238 -0
- package/skills/teamsmith/tests/flip-m48.sh +304 -0
- package/skills/teamsmith/tests/flip-m6.2.sh +205 -0
- package/skills/teamsmith/tests/flip-m6.3.sh +283 -0
- package/skills/teamsmith/tests/flip-m6.4.sh +267 -0
- package/skills/teamsmith/tests/flip-m6.5.sh +113 -0
- package/skills/teamsmith/tests/flip-m7.1.sh +135 -0
- package/skills/teamsmith/tests/flip-m7.2.sh +321 -0
- package/skills/teamsmith/tests/flip-p144.sh +112 -0
- package/skills/teamsmith/tests/flip-p156.sh +133 -0
- package/skills/teamsmith/tests/flip-p158.sh +301 -0
- package/skills/teamsmith/tests/flip-p160.sh +182 -0
- package/skills/teamsmith/tests/flip-p171.sh +249 -0
- package/skills/teamsmith/tests/flip-p18.1.sh +95 -0
- package/skills/teamsmith/tests/flip-p20.sh +286 -0
- package/skills/teamsmith/tests/flip-p201.sh +249 -0
- package/skills/teamsmith/tests/flip-p210.sh +239 -0
- package/skills/teamsmith/tests/flip-p211.sh +152 -0
- package/skills/teamsmith/tests/flip-p217.sh +288 -0
- package/skills/teamsmith/tests/flip-p22.sh +123 -0
- package/skills/teamsmith/tests/flip-p23.sh +239 -0
- package/skills/teamsmith/tests/flip-p25.sh +165 -0
- package/skills/teamsmith/tests/flip-p71.sh +184 -0
- package/skills/teamsmith/tests/flip-p72.sh +202 -0
- package/skills/teamsmith/tests/frames/README.md +176 -0
- package/skills/teamsmith/tests/frames/p78-conversation-rule-below-box.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-cursor-mid-draft.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor-line.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-blank-region.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-only.txt +5 -0
- package/skills/teamsmith/tests/frames/p78-spinner-row-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-wider-rule-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p86-f1-mixed-width-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/p86-f1-narrower-width-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/p86-f1-spinner-top-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/pi-0.85.1-update-banner.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-draft-half-sentence.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-empty-box.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-one-line-draft.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-project-trust-prompt.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.99.2-empty-editor.txt +32 -0
- package/skills/teamsmith/tests/frames/pi-0.99.2-human-draft.txt +32 -0
- package/skills/teamsmith/tests/frames/pi-1.0.0-git-error-in-box.txt +32 -0
- package/skills/teamsmith/tests/gate-guard.sh +112 -0
- package/skills/teamsmith/tests/guard-matrix.sh +233 -0
- package/skills/teamsmith/tests/install-shape.sh +731 -0
- package/skills/teamsmith/tests/ledger-ban.sh +612 -0
- package/skills/teamsmith/tests/lib/box-judge.sh +68 -0
- package/skills/teamsmith/tests/lib/checkout-shape.sh +129 -0
- package/skills/teamsmith/tests/lib/loop-scan.awk +114 -0
- package/skills/teamsmith/tests/lib/pty-wait.sh +676 -0
- package/skills/teamsmith/tests/lib/section-guard.sh +855 -0
- package/skills/teamsmith/tests/lib/shell-lex.pl +261 -0
- package/skills/teamsmith/tests/lib/tmp-root.sh +528 -0
- package/skills/teamsmith/tests/lib/tmux-cap.sh +35 -0
- package/skills/teamsmith/tests/lib/tmux-iso-call-probe.sh +81 -0
- package/skills/teamsmith/tests/lib/tmux-iso-probe.sh +46 -0
- package/skills/teamsmith/tests/lib/tmux-iso.sh +381 -0
- package/skills/teamsmith/tests/load-experiment.sh +290 -0
- package/skills/teamsmith/tests/loop-inventory.tsv +84 -0
- package/skills/teamsmith/tests/panel-b2-slow-stub.sh +19 -0
- package/skills/teamsmith/tests/panel-b2.sh +1183 -0
- package/skills/teamsmith/tests/panel-b3-pty-mouse.py +240 -0
- package/skills/teamsmith/tests/panel-b3-pty-tmux-mouse.py +138 -0
- package/skills/teamsmith/tests/panel-b3-stub.sh +279 -0
- package/skills/teamsmith/tests/panel-b3.sh +1301 -0
- package/skills/teamsmith/tests/panel-choices.sh +572 -0
- package/skills/teamsmith/tests/panel-clipboard-model.ts +187 -0
- package/skills/teamsmith/tests/panel-compose-model.ts +290 -0
- package/skills/teamsmith/tests/panel-contrast.mjs +81 -0
- package/skills/teamsmith/tests/panel-cpu-premise.sh +173 -0
- package/skills/teamsmith/tests/panel-cpu.sh +391 -0
- package/skills/teamsmith/tests/panel-flip-m54.sh +207 -0
- package/skills/teamsmith/tests/panel-flip-p123.sh +278 -0
- package/skills/teamsmith/tests/panel-flip-p125.sh +318 -0
- package/skills/teamsmith/tests/panel-flip-p128.sh +259 -0
- package/skills/teamsmith/tests/panel-keyprobe-pty.py +99 -0
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +41 -0
- package/skills/teamsmith/tests/panel-keyprobe.sh +82 -0
- package/skills/teamsmith/tests/panel-keyprobe.tsx +116 -0
- package/skills/teamsmith/tests/panel-knobs.sh +83 -0
- package/skills/teamsmith/tests/panel-p21.sh +2181 -0
- package/skills/teamsmith/tests/panel-snapshots.sh +802 -0
- package/skills/teamsmith/tests/panel-strings.mjs +195 -0
- package/skills/teamsmith/tests/perf.sh +740 -0
- package/skills/teamsmith/tests/pm-box-real.sh +350 -0
- package/skills/teamsmith/tests/pulse-nudge-key.sh +563 -0
- package/skills/teamsmith/tests/routes.sh +1652 -0
- package/skills/teamsmith/tests/section-budgets.tsv +150 -0
- package/skills/teamsmith/tests/section-guard.sh +231 -0
- package/skills/teamsmith/tests/section-needs-audit.sh +94 -0
- package/skills/teamsmith/tests/section-paths.tsv +142 -0
- package/skills/teamsmith/tests/section-select.sh +655 -0
- package/skills/teamsmith/tests/signal-gate.sh +366 -0
- package/skills/teamsmith/tests/signal-lint-legacy.txt +14 -0
- package/skills/teamsmith/tests/signal-lint.pl +416 -0
- package/skills/teamsmith/tests/skill-load.mjs +65 -0
- package/skills/teamsmith/tests/smoke.sh +19711 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-160.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-99.txt +32 -0
- package/skills/teamsmith/tests/spec-ledger-refs.tsv +78 -0
- package/skills/teamsmith/tests/spec-refs.sh +826 -0
- package/skills/teamsmith/tests/task-header-model.sh +267 -0
- package/skills/teamsmith/tests/team-bg-flip.sh +239 -0
- package/skills/teamsmith/tests/team-bg-harness.mjs +392 -0
- package/skills/teamsmith/tests/team-bg-stop.sh +434 -0
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +191 -0
- package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +1559 -0
- package/skills/teamsmith/tests/tmp-hygiene.sh +1190 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +31 -0
- package/skills/teamsmith/tests/tmux-lint.pl +604 -0
- package/skills/teamsmith-init/SKILL.md +100 -0
- package/skills/teamsmith-init/references/bootstrap.md +74 -0
- package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +46 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Deterministic loopback OpenAI SSE endpoint; no external model or credentials."""
|
|
3
|
+
import http.server, json, os, time
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
out = Path(os.environ['P138_LOG'])
|
|
6
|
+
class Handler(http.server.BaseHTTPRequestHandler):
|
|
7
|
+
def log_message(self, *args): pass
|
|
8
|
+
def do_POST(self):
|
|
9
|
+
req = json.loads(self.rfile.read(int(self.headers['Content-Length'])))
|
|
10
|
+
msgs = req.get('messages', [])
|
|
11
|
+
with (out / 'requests.jsonl').open('a') as f:
|
|
12
|
+
f.write(json.dumps({'ts':time.time(), 'model':req.get('model'), 'messages':msgs}, ensure_ascii=False)+'\n')
|
|
13
|
+
users = [str(m.get('content','')) for m in msgs if m.get('role') == 'user']
|
|
14
|
+
seed = users and 'P138-SEED-DIRTY' in users[-1]
|
|
15
|
+
tool_done = msgs and msgs[-1].get('role') == 'tool'
|
|
16
|
+
self.send_response(200); self.send_header('Content-Type','text/event-stream'); self.end_headers()
|
|
17
|
+
def send(delta, finish=None):
|
|
18
|
+
chunk = {'id':'p138', 'object':'chat.completion.chunk', 'created':int(time.time()), 'model':'p138',
|
|
19
|
+
'choices':[{'index':0,'delta':delta,'finish_reason':finish}]}
|
|
20
|
+
self.wfile.write(('data: '+json.dumps(chunk)+'\n\n').encode()); self.wfile.flush()
|
|
21
|
+
send({'role':'assistant'})
|
|
22
|
+
if seed and not tool_done:
|
|
23
|
+
send({'tool_calls':[{'index':0,'id':'dirty-write','type':'function','function':{
|
|
24
|
+
'name':'write','arguments':json.dumps({'path':'README' if os.environ.get('P138_TRACKED') == '1' else 'leftover.txt','content':'P138 uncommitted evidence\n'})}}]})
|
|
25
|
+
send({}, 'tool_calls')
|
|
26
|
+
else:
|
|
27
|
+
send({'content':'P138-ACK settled; no commit performed.'}); send({},'stop')
|
|
28
|
+
self.wfile.write(b'data: [DONE]\n\n'); self.wfile.flush()
|
|
29
|
+
http.server.ThreadingHTTPServer(('127.0.0.1',18738), Handler).serve_forever()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { appendFileSync } from 'node:fs';
|
|
2
|
+
export default function (pi: any) {
|
|
3
|
+
const file = process.env.P138_EVENTS!;
|
|
4
|
+
const log = (event: string, ctx: any, extra: any = {}) => appendFileSync(file, JSON.stringify({
|
|
5
|
+
ts: new Date().toISOString(), event, cwd: ctx.cwd, idle: ctx.isIdle(),
|
|
6
|
+
editor: ctx.hasUI ? ctx.ui.getEditorText() : null, ...extra,
|
|
7
|
+
}) + '\n');
|
|
8
|
+
let timer: any; let last: string | undefined;
|
|
9
|
+
pi.on('session_start', (_e: any, ctx: any) => {
|
|
10
|
+
log('session_start', ctx);
|
|
11
|
+
timer = setInterval(() => {
|
|
12
|
+
const text = ctx.ui.getEditorText();
|
|
13
|
+
if (text !== last) { last = text; log('editor', ctx); }
|
|
14
|
+
}, 100);
|
|
15
|
+
});
|
|
16
|
+
pi.on('before_agent_start', (e: any, ctx: any) => log('before_agent_start', ctx, {prompt:e.prompt}));
|
|
17
|
+
pi.on('message_end', (e: any, ctx: any) => log('message_end', ctx, {message:e.message}));
|
|
18
|
+
pi.on('agent_settled', (_e: any, ctx: any) => log('agent_settled', ctx));
|
|
19
|
+
pi.on('session_shutdown', (_e: any, ctx: any) => { clearInterval(timer); log('session_shutdown', ctx); });
|
|
20
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# P163 · delivery-truth 的**真实 Pi/model/tmux** 配方(P147/P157 授权配方的夹具版)。
|
|
3
|
+
#
|
|
4
|
+
# 用法(仓库根):
|
|
5
|
+
# P163_EVIDENCE="$PWD/docs/team/reports/P163-dev-bob" \
|
|
6
|
+
# bash skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh \
|
|
7
|
+
# <case> [rev] [long] [runtime]
|
|
8
|
+
#
|
|
9
|
+
# case 必须形如 tmux-p163-… / watch-p163-…(夹具只碰自己的 case 目录)
|
|
10
|
+
# rev 要测的提交(默认 HEAD);源码用 git archive 进容器,绝不 checkout 切分支
|
|
11
|
+
# long 1 = 二投递用长消息(P138_LONG)
|
|
12
|
+
# runtime 0.99.2(默认,**判据版本**)| host(**仅供人工观察,不作为判据**)
|
|
13
|
+
#
|
|
14
|
+
# 与 P147/P157 作者配方的两处有意差异(P163 的两条 finding):
|
|
15
|
+
# ① 现场重置:每个 case 先 rm -rf 自己的现场目录,再写 run.json 运行戳;scenario.sh 在判据读的
|
|
16
|
+
# 事件文件第一行写单次 run_start 标记;judge-second.py 拒绝缺戳 / 标记不是恰好一条 / 标记不在第一行 /
|
|
17
|
+
# run-start.txt 缺失·为空·run= 不符 / 有旧文件 / 观察模式的现场。
|
|
18
|
+
# ② 版本钉死:判决路线只有容器里的 0.99.2;宿主路线(当前 1.0.0)在 run.json 里标 observation,
|
|
19
|
+
# judge-second.py 拒绝给它出判据 —— 避免把「宿主版本差异」当产品红绿。
|
|
20
|
+
#
|
|
21
|
+
# 本脚本只调 `distrobox-host-exec podman`(宿主 podman);容器自己的 tmux server 是私有的。
|
|
22
|
+
set -euo pipefail
|
|
23
|
+
ROOT=$(git rev-parse --show-toplevel)
|
|
24
|
+
E="${P163_EVIDENCE:?需要 P163_EVIDENCE=<证据目录>(容器内挂成 /evidence;目录须已存在)}"
|
|
25
|
+
[ -d "$E" ] || { echo "P163_EVIDENCE 不是目录:$E" >&2; exit 2; }
|
|
26
|
+
E=$(cd -P "$E" && pwd)
|
|
27
|
+
CASE=${1:?case}; REV=${2:-HEAD}; LONG=${3:-0}; PI_VERSION=${4:-0.99.2}
|
|
28
|
+
[[ "$CASE" =~ ^(tmux|watch)-p163-[a-z0-9-]+$ ]] || { echo 'invalid P163 case name' >&2; exit 64; }
|
|
29
|
+
case "$PI_VERSION" in
|
|
30
|
+
0.99.2) MODE=verdict ;;
|
|
31
|
+
host) MODE=observation ;;
|
|
32
|
+
*) echo "unsupported runtime: use 0.99.2 (verdict) or host (人工观察,不作为判据)" >&2; exit 64 ;;
|
|
33
|
+
esac
|
|
34
|
+
MODULES=$HOME/.bun/install/global/node_modules
|
|
35
|
+
PINNED="$E/.runtime/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js"
|
|
36
|
+
if [ "$MODE" = verdict ]; then
|
|
37
|
+
[ -f "$PINNED" ] || { echo "pinned 0.99.2 runtime missing: $PINNED(安装见 fixtures/delivery-truth-real/README.md)" >&2; exit 69; }
|
|
38
|
+
else
|
|
39
|
+
printf '%s\n' '⚠ host 路线仅供人工观察,不作为判据:宿主当前 1.0.0 会把夹具自造的框内行当草稿,judge-second.py 会拒绝出判据'
|
|
40
|
+
fi
|
|
41
|
+
REV_FULL=$(git rev-parse "$REV")
|
|
42
|
+
RUN_ID=$(od -An -N6 -tx1 /dev/urandom | tr -d ' \n')
|
|
43
|
+
STARTED_AT=$(date +%s)
|
|
44
|
+
|
|
45
|
+
# ① 现场重置:这一次的测量只看这一次。
|
|
46
|
+
L="$E/logs/$CASE"
|
|
47
|
+
rm -rf -- "$L"
|
|
48
|
+
mkdir -p "$L" "$E/pkg"
|
|
49
|
+
cp -a "$(dirname "$0")/." "$E/pkg/"
|
|
50
|
+
P163_CASE="$CASE" P163_RUN_ID="$RUN_ID" P163_REV="$REV" P163_REV_FULL="$REV_FULL" \
|
|
51
|
+
P163_PI_VERSION="$PI_VERSION" P163_MODE="$MODE" P163_STARTED_AT="$STARTED_AT" \
|
|
52
|
+
python3 - "$L/run.json" <<'PY'
|
|
53
|
+
import json, os, sys
|
|
54
|
+
keys = ('P163_CASE', 'P163_RUN_ID', 'P163_REV', 'P163_REV_FULL', 'P163_PI_VERSION', 'P163_MODE', 'P163_STARTED_AT')
|
|
55
|
+
run = {k[5:].lower(): os.environ[k] for k in keys}
|
|
56
|
+
run['started_at'] = int(run['started_at'])
|
|
57
|
+
with open(sys.argv[1], 'w') as f:
|
|
58
|
+
json.dump(run, f, indent=1, sort_keys=True)
|
|
59
|
+
f.write('\n')
|
|
60
|
+
PY
|
|
61
|
+
printf 'P163 clean case=%s run=%s revision=%s full=%s runtime=%s mode=%s\n' \
|
|
62
|
+
"$CASE" "$RUN_ID" "$REV" "$REV_FULL" "$PI_VERSION" "$MODE"
|
|
63
|
+
|
|
64
|
+
args=(run --rm --network=none -i -e HOME=/tmp -e P138_CONTAINER=1 -e "P138_LONG=$LONG"
|
|
65
|
+
-e "P138_OLD_NOTIFY=${P138_OLD_NOTIFY:-0}" -e "P143_DRAFT=${P143_DRAFT:-0}" -e "P138_TRACKED=${P138_TRACKED:-0}" -e "P138_SETTLE_DELAY=${P138_SETTLE_DELAY:-1}" -e "P138_SECOND=${P138_SECOND:-0}"
|
|
66
|
+
-e "P163_RUN_ID=$RUN_ID" -e "P163_CASE=$CASE" -e "P163_MODE=$MODE" -e "P163_PI_VERSION=$PI_VERSION"
|
|
67
|
+
-v "$ROOT:/src:ro" -v "$E:/evidence:rw" -w /src)
|
|
68
|
+
if [ "$PI_VERSION" = host ]; then
|
|
69
|
+
args+=(-v "$MODULES:$MODULES:ro" -e "P138_PI_CLI=$MODULES/@earendil-works/pi-coding-agent/dist/bundle/cli.js")
|
|
70
|
+
else
|
|
71
|
+
args+=(-v "$E/.runtime:/runtime:ro" -e P138_PI_CLI=/runtime/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js)
|
|
72
|
+
fi
|
|
73
|
+
# Historical sources exist only in the disposable container; no checkout/reset of a branch.
|
|
74
|
+
git archive "$REV" skills | distrobox-host-exec podman "${args[@]}" localhost/teamsmith-gate:local bash -c '
|
|
75
|
+
mkdir -p /tmp/history; tar -xf - -C /tmp/history
|
|
76
|
+
if [ -e /tmp/history/skills/teamsmith/scripts/team ]; then export P138_SKILL=/tmp/history/skills/teamsmith
|
|
77
|
+
else export P138_SKILL=/tmp/history/skills/pi-team; fi
|
|
78
|
+
exec bash /evidence/pkg/scenario.sh "$1"
|
|
79
|
+
' _ "$CASE"
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Run ONLY inside a disposable container. Sources /src read-only; outputs /evidence.
|
|
3
|
+
#
|
|
4
|
+
# P163:从 P147/P157 的授权配方提升进夹具。两处有意改动(P163 的两条 finding):
|
|
5
|
+
# ① 现场单次性:读 run-case.sh 写的 run.json 运行戳,并在每个判据读的事件文件第一行写
|
|
6
|
+
# run_start 标记;judge-second.py 靠这一对证据(+ run-start.txt 单次运行戳,P197)拒绝旧现场 /
|
|
7
|
+
# 跨次累积的现场。
|
|
8
|
+
# ② 版本透传:P163_MODE/P163_PI_VERSION 由 run-case.sh 决定(host = 人工观察,judge 拒绝出判据)。
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
[ "${P138_CONTAINER:-}" = 1 ] || { echo 'refused: container only'; exit 64; }
|
|
11
|
+
CASE=${1:-watch-dirty}; L=/evidence/logs/$CASE
|
|
12
|
+
RUN_ID=${P163_RUN_ID:-}
|
|
13
|
+
[ -n "$RUN_ID" ] || { echo 'refused: missing P163_RUN_ID (run through run-case.sh)' >&2; exit 65; }
|
|
14
|
+
[ -f "$L/run.json" ] || { echo "refused: $L/run.json missing (scene not cleared/stamped by run-case.sh)" >&2; exit 65; }
|
|
15
|
+
python3 - "$L/run.json" "$CASE" "$RUN_ID" <<'PY' || exit 65
|
|
16
|
+
import json, sys
|
|
17
|
+
run = json.load(open(sys.argv[1]))
|
|
18
|
+
for key, want in (('case', sys.argv[2]), ('run_id', sys.argv[3])):
|
|
19
|
+
if run.get(key) != want:
|
|
20
|
+
raise SystemExit(f'refused: run.json {key}={run.get(key)!r} != {want!r} (stale scene?)')
|
|
21
|
+
PY
|
|
22
|
+
SKILL=${P138_SKILL:-/src/skills/teamsmith}
|
|
23
|
+
mkdir -p "$L"
|
|
24
|
+
# 单次运行标记:判据读的文件第一行。judge-second.py 要求它的 id 与 run.json 完全一致。
|
|
25
|
+
MARK="{\"event\":\"run_start\",\"run\":\"$RUN_ID\",\"ts\":$(date +%s)}"
|
|
26
|
+
printf '%s\n' "$MARK" > "$L/dev-events.jsonl"
|
|
27
|
+
printf '%s\n' "$MARK" > "$L/pm-events.jsonl"
|
|
28
|
+
printf '%s\n' "$MARK" > "$L/requests.jsonl"
|
|
29
|
+
printf 'P163 case=%s run=%s mode=%s runtime=%s\n' "$CASE" "$RUN_ID" "${P163_MODE:-unknown}" "${P163_PI_VERSION:-unknown}" > "$L/run-start.txt"
|
|
30
|
+
R=$(mktemp -d "${TMPDIR:-/tmp}/teamsmith-p163-real.XXXXXX"); mkdir -p "$R/sock" "$R/home" "$R/agentdir" "$R/bin"
|
|
31
|
+
export HOME="$R/home" PI_CODING_AGENT_DIR="$R/agentdir" TMUX_TMPDIR="$R/sock" TERM=xterm-256color
|
|
32
|
+
unset TMUX TMUX_PANE
|
|
33
|
+
for k in ${!TEAM_@}; do unset "$k"; done
|
|
34
|
+
export P138_LOG="$L"
|
|
35
|
+
python3 /evidence/pkg/mock-server.py >"$L/server.log" 2>&1 & SERVER_PID=$!
|
|
36
|
+
cleanup() {
|
|
37
|
+
[ "${BASHPID:-$$}" = "$$" ] || return 0
|
|
38
|
+
tmux kill-server 2>/dev/null || true
|
|
39
|
+
kill "$SERVER_PID" 2>/dev/null || true; wait "$SERVER_PID" 2>/dev/null || true
|
|
40
|
+
rm -rf "$R"
|
|
41
|
+
}
|
|
42
|
+
trap cleanup EXIT
|
|
43
|
+
CLI=${P138_PI_CLI:-/usr/local/lib/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js}
|
|
44
|
+
printf '#!/bin/sh\nexec node %q "$@"\n' "$CLI" > "$R/bin/pi"; chmod +x "$R/bin/pi"
|
|
45
|
+
export PATH="$R/bin:$PATH"
|
|
46
|
+
python3 - "$R/agentdir/models.json" <<'PY'
|
|
47
|
+
import json,sys
|
|
48
|
+
json.dump({'providers':{'p138':{'baseUrl':'http://127.0.0.1:18738/v1','api':'openai-completions','apiKey':'fixture-not-a-secret',
|
|
49
|
+
'models':[{'id':'p138','name':'P138 local fixture','reasoning':False,'input':['text'],'contextWindow':128000,'maxTokens':2048,
|
|
50
|
+
'cost':{'input':0,'output':0,'cacheRead':0,'cacheWrite':0}}]}}},open(sys.argv[1],'w'))
|
|
51
|
+
PY
|
|
52
|
+
mkdir -p "$R/proj"; cd "$R/proj"
|
|
53
|
+
git init -q -b main; git config user.name P138; git config user.email p138@fixture
|
|
54
|
+
printf 'init\n' > README; printf '.pi/team/state/\ndocs/team/inbox/\n.worktrees/\n' > .gitignore
|
|
55
|
+
mkdir -p .pi/team docs/team/inbox
|
|
56
|
+
cat > .pi/team/config.sh <<EOF
|
|
57
|
+
TEAM_SESSION=p138
|
|
58
|
+
TEAM_AGENTS=dev
|
|
59
|
+
TEAM_PM_WINDOW=pm
|
|
60
|
+
TEAM_PI_BIN=$R/bin/pi
|
|
61
|
+
TEAM_NOTIFY_TMUX=0
|
|
62
|
+
TEAM_NOTIFY_LOG=$L/notify.log
|
|
63
|
+
TEAM_REQUIRE_OPENSPEC=0
|
|
64
|
+
TEAM_REQUIRE_MAGIC_CONTEXT=0
|
|
65
|
+
EOF
|
|
66
|
+
git add .; git commit -qm init; git worktree add -qb task/P138 .worktrees/dev
|
|
67
|
+
WT="$R/proj/.worktrees/dev"
|
|
68
|
+
TEAM=(bash "$SKILL/scripts/team")
|
|
69
|
+
"${TEAM[@]}" paths > "$L/paths.txt"
|
|
70
|
+
pi --version > "$L/pi-version.txt"
|
|
71
|
+
launch() {
|
|
72
|
+
local window=$1 cwd=$2 seed=$3 watcher=$4
|
|
73
|
+
local args=(pi --no-session --session-dir "$R/sessions" --approve --no-extensions --no-skills --no-context-files
|
|
74
|
+
--provider p138 --model p138 -e /evidence/pkg/observe.ts)
|
|
75
|
+
[ "$window" != dev ] || args+=(-e "$SKILL/extension/team-notify.ts")
|
|
76
|
+
if [ "$watcher" = yes ] && [ -f "$SKILL/extension/team-inbox-watch.ts" ]; then args+=(-e "$SKILL/extension/team-inbox-watch.ts"); fi
|
|
77
|
+
[ -z "$seed" ] || args+=("$seed")
|
|
78
|
+
local cmd; printf -v cmd '%q ' env "P138_EVENTS=$L/$window-events.jsonl" "TEAM_INBOX_WATCH_TARGET=p138:$window" "${args[@]}"
|
|
79
|
+
if ! tmux has-session -t p138 2>/dev/null; then
|
|
80
|
+
tmux new-session -d -s p138 -n "$window" -x 120 -y 32 -c "$cwd" "$cmd"
|
|
81
|
+
else tmux new-window -d -t p138 -n "$window" -c "$cwd" "$cmd"; fi
|
|
82
|
+
}
|
|
83
|
+
wait_for() {
|
|
84
|
+
local file=$1 needle=$2
|
|
85
|
+
for i in $(seq 1 150); do grep -q "$needle" "$file" 2>/dev/null && return 0; sleep .2; done
|
|
86
|
+
echo "TIMEOUT: $needle in $file"; tmux capture-pane -p -S -100 -t p138:dev || true; return 1
|
|
87
|
+
}
|
|
88
|
+
launch pm "$R/proj" '' yes
|
|
89
|
+
seed=P138-SEED-CLEAN; [[ "$CASE" != *dirty* ]] || seed=P138-SEED-DIRTY
|
|
90
|
+
watcher=yes; [[ "$CASE" != tmux-* ]] || watcher=no
|
|
91
|
+
launch dev "$WT" "$seed" "$watcher"
|
|
92
|
+
wait_for "$L/dev-events.jsonl" 'agent_settled'
|
|
93
|
+
sleep "${P138_SETTLE_DELAY:-1}"
|
|
94
|
+
( cd "$WT" && git status --porcelain ) > "$L/dirty-before.txt"
|
|
95
|
+
tmux capture-pane -p -S -100 -t p138:dev > "$L/dev-before.frame"
|
|
96
|
+
# sender runs in the fixture main root, not in the worker directory.
|
|
97
|
+
MSG="P138-SAY-$CASE"
|
|
98
|
+
if [ "${P138_LONG:-0}" = 1 ]; then MSG="$MSG $(printf '请核对未提交文件并报告检查结果。%.0s' {1..70})"; fi
|
|
99
|
+
printf '%s\n' "$MSG" > "$L/payload.txt"
|
|
100
|
+
set +e
|
|
101
|
+
"${TEAM[@]}" say dev "$MSG" > "$L/say.txt" 2>&1; SAY_RC=$?
|
|
102
|
+
set -e
|
|
103
|
+
printf 'say_rc=%s\n' "$SAY_RC" | tee "$L/result.txt"
|
|
104
|
+
sleep 4
|
|
105
|
+
"${TEAM[@]}" outbox list > "$L/outbox-after-say.txt" 2>&1 || true
|
|
106
|
+
if [[ "$CASE" = tmux-* ]]; then
|
|
107
|
+
tmux display-message -p -t p138:dev '#{cursor_y}' > "$L/cursor-after-say.txt"
|
|
108
|
+
P138_PROBE_SKILL="$SKILL" bash -c '
|
|
109
|
+
. "$P138_PROBE_SKILL/scripts/lib/common.sh"
|
|
110
|
+
. "$P138_PROBE_SKILL/scripts/lib/outbox.sh"
|
|
111
|
+
team_load_config
|
|
112
|
+
printf "verdict=%s\n" "$(team_delivery_verdict p138:dev)"
|
|
113
|
+
printf "box_text=[%s]\n" "$(team_input_box_text p138:dev | tr "\n" "|")"
|
|
114
|
+
' > "$L/box-after-say.txt" 2>&1
|
|
115
|
+
fi
|
|
116
|
+
cp -a .pi/team/state "$L/state-after-say"
|
|
117
|
+
cp -a docs/team/inbox "$L/inbox-after-say"
|
|
118
|
+
tmux capture-pane -p -S -100 -t p138:dev > "$L/dev-after-say.frame"
|
|
119
|
+
# A second correction after the first real turn settled: false BUSY can strand it.
|
|
120
|
+
if [ "${P138_SECOND:-0}" = 1 ]; then
|
|
121
|
+
tmux capture-pane -p -t p138:dev > "$L/second-before.frame"
|
|
122
|
+
set +e
|
|
123
|
+
"${TEAM[@]}" say dev "P138-SECOND-$CASE" > "$L/second-say.txt" 2>&1; SECOND_RC=$?
|
|
124
|
+
set -e
|
|
125
|
+
printf 'second_say_rc=%s\n' "$SECOND_RC" | tee -a "$L/result.txt"
|
|
126
|
+
sleep 2
|
|
127
|
+
"${TEAM[@]}" outbox flush > "$L/second-flush-1.txt" 2>&1
|
|
128
|
+
sleep 2
|
|
129
|
+
"${TEAM[@]}" outbox flush > "$L/second-flush-2.txt" 2>&1
|
|
130
|
+
tmux capture-pane -p -t p138:dev > "$L/second-after.frame"
|
|
131
|
+
"${TEAM[@]}" outbox list > "$L/second-outbox.txt" 2>&1
|
|
132
|
+
cp -a .pi/team/state "$L/state-after-second"
|
|
133
|
+
fi
|
|
134
|
+
# P143 negative control: real editor draft, no submission; keep raw frames.
|
|
135
|
+
if [ "${P143_DRAFT:-0}" = 1 ]; then
|
|
136
|
+
tmux send-keys -t p138:dev -l 'P143-HUMAN-DRAFT'
|
|
137
|
+
sleep 1
|
|
138
|
+
tmux capture-pane -p -t p138:dev > "$L/draft-before.frame"
|
|
139
|
+
tmux display-message -p -t p138:dev '#{cursor_y}' > "$L/draft-cursor.txt"
|
|
140
|
+
set +e
|
|
141
|
+
"${TEAM[@]}" say dev "P143-DRAFT-GUARD-$CASE" > "$L/draft-say.txt" 2>&1
|
|
142
|
+
DRAFT_RC=$?
|
|
143
|
+
set -e
|
|
144
|
+
printf 'draft_say_rc=%s\n' "$DRAFT_RC" | tee -a "$L/result.txt"
|
|
145
|
+
sleep 1
|
|
146
|
+
tmux capture-pane -p -t p138:dev > "$L/draft-after.frame"
|
|
147
|
+
fi
|
|
148
|
+
# notify <recipient> stores to recipient but knocks PM, NOT that worker.
|
|
149
|
+
set +e
|
|
150
|
+
if [ "${P138_OLD_NOTIFY:-0}" = 1 ]; then
|
|
151
|
+
TEAM_NOTIFY_TMUX=1 "${TEAM[@]}" notify dev "P138-NOTIFY-$CASE" > "$L/notify.txt" 2>&1
|
|
152
|
+
else
|
|
153
|
+
TEAM_NOTIFY_TMUX=1 "${TEAM[@]}" notify dev --from pm "P138-NOTIFY-$CASE" > "$L/notify.txt" 2>&1
|
|
154
|
+
fi
|
|
155
|
+
NOTIFY_RC=$?
|
|
156
|
+
set -e
|
|
157
|
+
printf 'notify_rc=%s\n' "$NOTIFY_RC" | tee -a "$L/result.txt"
|
|
158
|
+
sleep 4
|
|
159
|
+
"${TEAM[@]}" outbox list > "$L/outbox-final.txt" 2>&1 || true
|
|
160
|
+
cp -a .pi/team/state "$L/state-final"; cp -a docs/team/inbox "$L/inbox-final"
|
|
161
|
+
tmux capture-pane -p -S -100 -t p138:dev > "$L/dev-final.frame"
|
|
162
|
+
tmux capture-pane -p -S -100 -t p138:pm > "$L/pm-final.frame"
|
|
163
|
+
( cd "$WT" && git status --porcelain ) > "$L/dirty-after.txt"
|
|
164
|
+
python3 - "$L" <<'PY'
|
|
165
|
+
import json,sys,pathlib
|
|
166
|
+
p=pathlib.Path(sys.argv[1]); events=[json.loads(x) for x in (p/'dev-events.jsonl').read_text().splitlines()]
|
|
167
|
+
starts=[e.get('prompt','') for e in events if e['event']=='before_agent_start']
|
|
168
|
+
settled=[e for e in events if e['event']=='agent_settled']
|
|
169
|
+
print('dev_turns=',len(starts),'dev_settled=',len(settled))
|
|
170
|
+
print('dev_prompt_prefixes=',json.dumps([s[:160] for s in starts],ensure_ascii=False))
|
|
171
|
+
print('dev_editor_at_settle=',[e['editor'] for e in settled])
|
|
172
|
+
print('dirty_before=',(p/'dirty-before.txt').read_text().strip())
|
|
173
|
+
print('dirty_after=',(p/'dirty-after.txt').read_text().strip())
|
|
174
|
+
PY
|
|
175
|
+
printf 'Evidence: %s\n' "$L"
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# flip-p49.sh — P55「agent pane 留存与死 pane 席位」的翻转夹具(变异测试,§40 的可运行翻转)
|
|
3
|
+
#
|
|
4
|
+
# 四条腿(每条腿建独立夹具:私有 TMUX_TMPDIR + 独立 git 仓库 + 独立会话,跑同一组核心断言):
|
|
5
|
+
# leg0 green :对未改的 skill 跑 → 必须全绿(夹具自身有效)
|
|
6
|
+
# leg1 no-retain :把建窗点换回旧的一行 new-window(删掉占位+设选项+读回+respawn)
|
|
7
|
+
# → 期望红锚点 B1(kill 之后 pane_dead=1 / 遗体留存)
|
|
8
|
+
# leg2 say-dead :删掉 team say 的死 pane 换道分支(say 对遗体按键)
|
|
9
|
+
# → 期望红锚点 C2(输出点名「pane 已死 + signal=9」)
|
|
10
|
+
# leg3 roster-run:把 roster 覆盖里的 dead 行改成「● 在跑」(尸体冒充活座位)
|
|
11
|
+
# → 期望红锚点 E1(roster 死 pane 行带 ▲ + signal=9)
|
|
12
|
+
#
|
|
13
|
+
# 判绿规则:leg0 全绿;leg1-3 各自的锚点断言红(其余红行原样打印存档)。exit 0 = 四条腿全部如预期。
|
|
14
|
+
# 断言 ID 与 smoke §40 的对应:A=① 创建期 B=② 遗体 C=③ say D=⑤ 复用 E=④ 读面 F=⑧ teardown。
|
|
15
|
+
set -uo pipefail
|
|
16
|
+
|
|
17
|
+
FLIP_SKILL="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # 本脚本所在的 skill 根(被测对象)
|
|
18
|
+
KEEP=0
|
|
19
|
+
[ "${1:-}" = "--keep" ] && KEEP=1
|
|
20
|
+
[ -n "${1:-}" ] && [ "$1" != "--keep" ] && FLIP_SKILL="$(cd "$1" && pwd)"
|
|
21
|
+
|
|
22
|
+
ok_n=0; red_n=0
|
|
23
|
+
note() { printf '%s\n' "$*"; }
|
|
24
|
+
line_ok() { note " ✓ $*"; }
|
|
25
|
+
line_red() { note " ✗ $*"; }
|
|
26
|
+
|
|
27
|
+
# M28 隔离(lint 规则 D 的诚实满足,与 smoke.sh:241 同款):本文件的全部 tmux 调用都打私有
|
|
28
|
+
# socket 目录 —— 顶层 unset TMUX/TMUX_PANE + 顶层把 TMUX_TMPDIR 指到本进程私有目录(已建);此后不导回 TMUX。
|
|
29
|
+
FLIP_SOCK="$(mktemp -d "${TMPDIR:-/tmp}/teamsmith-p55-flip-sock.XXXXXX")"
|
|
30
|
+
TMUX_TMPDIR="$FLIP_SOCK"; export TMUX_TMPDIR
|
|
31
|
+
unset TMUX TMUX_PANE
|
|
32
|
+
# P162:破坏性调用(kill-session)动手前先证明私有 socket 生效;skill 树不全(缺库)就响亮失败,
|
|
33
|
+
# 不静默降级成裸调用。
|
|
34
|
+
# shellcheck source=../../lib/tmux-iso.sh
|
|
35
|
+
. "$FLIP_SKILL/tests/lib/tmux-iso.sh" 2>/dev/null \
|
|
36
|
+
|| { note "P162:找不到 $FLIP_SKILL/tests/lib/tmux-iso.sh(skill 树不全)"; exit 2; }
|
|
37
|
+
|
|
38
|
+
# ---------------------------------------------------------------- 单腿:建夹具 + 跑核心断言
|
|
39
|
+
# 用法:p55_leg <leg名> <skill_dir>;结果写入 $LEG_RESULTS("OK|RED <id> <desc>" 一行一条)
|
|
40
|
+
p55_leg() { # <leg> <skill_dir>
|
|
41
|
+
local leg="$1" SK="$2"
|
|
42
|
+
LEG_ROOT="$(mktemp -d "${TMPDIR:-/tmp}/teamsmith-p55-flip.XXXXXX")"
|
|
43
|
+
local T="$LEG_ROOT" REPO SESS
|
|
44
|
+
REPO="$T/repo"; SESS="p55flip-$leg-$$"
|
|
45
|
+
# 隔离:私有 socket 目录(已 mkdir;不写 TMUX_TMPDIR 指向不存在的目录 —— 那两个回退陷阱的教训)、
|
|
46
|
+
# 剥掉 shim、清掉 TEAM_* 身份
|
|
47
|
+
(
|
|
48
|
+
set -uo pipefail
|
|
49
|
+
unset TMUX TMUX_PANE TEAM_ROOT TEAM_MAIN_ROOT TEAM_PROJECT TEAM_SESSION TEAM_SESSION_FROM \
|
|
50
|
+
TEAM_CONFIG_FILE TEAM_AGENTS TEAM_AGENT_CMD TEAM_AGENT_BIN TEAM_AGENT_NOTIFY_CMD \
|
|
51
|
+
TEAM_AGENT_LOG_GLOB TEAM_DISPATCH_ALIVE_SEC TEAM_AGENT_SCENE_LINES
|
|
52
|
+
_p=""; _ifs="$IFS"; IFS=:
|
|
53
|
+
for d in $PATH; do case "$d" in */scripts/shim) ;; *) _p="${_p:+$_p:}$d" ;; esac; done
|
|
54
|
+
IFS="$_ifs"; PATH="$_p"; export PATH; unset _p _ifs
|
|
55
|
+
|
|
56
|
+
TEAM="bash $SK/scripts/team"
|
|
57
|
+
RES="$T/results"; : > "$RES"
|
|
58
|
+
ck() { # <id> <desc> <0|1> [实际值]
|
|
59
|
+
if [ "$3" = "0" ]; then printf 'OK %s %s\n' "$1" "$2" >> "$RES"
|
|
60
|
+
else printf 'RED %s %s(%s)\n' "$1" "$2" "${4:-}" >> "$RES"; fi
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
mkdir -p "$REPO"; cd "$REPO" || exit 1
|
|
64
|
+
git init -q -b main; git config user.email f@f; git config user.name f
|
|
65
|
+
echo x > README.md; git add -A; git commit -qm init
|
|
66
|
+
$TEAM init --session "$SESS" --agents "p55w" --vcs local --gates "true" --docs docs/team >/dev/null 2>&1
|
|
67
|
+
mkdir -p "$REPO/.pi/team/state"
|
|
68
|
+
printf '# T9.55 · flip probe\n\ntask: T9.55\nagent: p55w\nchange: -\nanchor: none (infra) — flip\n' > "$REPO/.pi/team/state/T9.55-brief.md"
|
|
69
|
+
BR="$(cd "$REPO" && bash -c '. "'"$SK"'/scripts/lib/common.sh"; for _f in "'"$SK"'"/scripts/lib/cmd-*.sh; do . "$_f" 2>/dev/null || true; done; team_load_config >/dev/null 2>&1; team_branch_for_agent p55w T9.55')"
|
|
70
|
+
git worktree add -b "$BR" "$REPO/.worktrees/p55w" main >/dev/null 2>&1
|
|
71
|
+
mkdir -p "$T/bin"
|
|
72
|
+
printf '#!/usr/bin/env bash\necho P55-MARK-1\necho P55-MARK-2\necho P55-MARK-3\nsleep 300\n' > "$T/bin/fake-agent"
|
|
73
|
+
chmod +x "$T/bin/fake-agent"
|
|
74
|
+
DENV=(env TEAM_AGENTS="p55w" TEAM_AGENT_CMD="$T/bin/fake-agent {cwd}" TEAM_AGENT_BIN="$T/bin/fake-agent" TEAM_DISPATCH_ALIVE_SEC=0)
|
|
75
|
+
|
|
76
|
+
# ── A:创建期 ──
|
|
77
|
+
if "${DENV[@]}" $TEAM dispatch p55w T9.55 "$REPO/.pi/team/state/T9.55-brief.md" >"$T/d1.log" 2>&1; then ck A1-0 "派单成功" 0; else ck A1-0 "派单成功" 1 "$(tail -1 "$T/d1.log")"; fi
|
|
78
|
+
roe="$(tmux show-options -w -v -t "$SESS:p55w" remain-on-exit 2>/dev/null)"
|
|
79
|
+
[ "$roe" = "on" ]; ck A1 "remain-on-exit 读回是 on" "$?" "$roe"
|
|
80
|
+
roe_pm="$(tmux show-options -w -v -t "$SESS:pm" remain-on-exit 2>/dev/null)"
|
|
81
|
+
[ -z "$roe_pm" ]; ck A2 "PM 窗口无该设置" "$?" "$roe_pm"
|
|
82
|
+
i=0; while [ "$i" -lt 30 ]; do { tmux capture-pane -p -S - -t "$SESS:p55w" 2>/dev/null || true; } | grep -q P55-MARK-3 && break; sleep 0.3; i=$((i+1)); done
|
|
83
|
+
{ tmux capture-pane -p -S - -t "$SESS:p55w" 2>/dev/null || true; } | grep -q P55-MARK-3; ck A3 "marker 画上" "$?"
|
|
84
|
+
[ "$(tmux list-windows -t "$SESS" -F '#{window_name}' 2>/dev/null | grep -cx p55w)" = "1" ]; ck A4 "恰好一个窗口" "$?"
|
|
85
|
+
|
|
86
|
+
# ── B:kill → 遗体 ──
|
|
87
|
+
pid="$(tmux list-panes -t "$SESS:p55w" -F '#{pane_pid}' 2>/dev/null | head -1)"
|
|
88
|
+
pgid="$(ps -o pgid= -p "$pid" 2>/dev/null | tr -d ' ')"
|
|
89
|
+
my_pgid="$(ps -o pgid= -p $$ 2>/dev/null | tr -d ' ')"
|
|
90
|
+
if [ -n "$pgid" ] && [ "$pgid" != "$my_pgid" ] && [ "$pgid" != "1" ]; then kill -9 -- -"$pgid" 2>/dev/null || true; fi
|
|
91
|
+
i=0; while [ "$i" -lt 25 ]; do [ "$(tmux list-panes -t "$SESS:p55w" -F '#{pane_dead}' 2>/dev/null | head -1)" = "1" ] && break; sleep 0.2; i=$((i+1)); done
|
|
92
|
+
[ "$(tmux list-panes -t "$SESS:p55w" -F '#{pane_dead}' 2>/dev/null | head -1)" = "1" ]; ck B1 "kill 后 pane_dead=1(遗体留存)" "$?"
|
|
93
|
+
[ "$(tmux list-panes -t "$SESS:p55w" -F '#{pane_dead_signal}' 2>/dev/null | head -1)" = "9" ]; ck B2 "退出证据 signal=9" "$?"
|
|
94
|
+
[ "$(tmux list-windows -t "$SESS" -F '#{window_name}' 2>/dev/null | grep -cx p55w)" = "1" ]; ck B3 "窗口没跟 pane 消失" "$?"
|
|
95
|
+
{ tmux capture-pane -p -S - -t "$SESS:p55w" 2>/dev/null || true; } | grep -q P55-MARK-3; ck B4 "遗体画面含 marker" "$?"
|
|
96
|
+
|
|
97
|
+
# ── C:say 对死 pane ──
|
|
98
|
+
before="$(tmux capture-pane -p -S - -t "$SESS:p55w" 2>/dev/null | cksum)"
|
|
99
|
+
env TEAM_AGENTS="p55w" $TEAM say p55w "P55 flip probe" >"$T/say.log" 2>&1; rc=$?
|
|
100
|
+
[ "$rc" = "0" ]; ck C1 "say rc=0" "$?" "rc=$rc"
|
|
101
|
+
grep -qF "pane 已死(signal=9)" "$T/say.log"; ck C2 "输出点名座位已死+证据" "$?" "$(tail -1 "$T/say.log")"
|
|
102
|
+
! grep -qF "已确认送达" "$T/say.log"; ck C3 "不报送达" "$?"
|
|
103
|
+
grep -qF "P55 flip probe" "$REPO/docs/team/inbox/p55w.md" 2>/dev/null; ck C4 "消息落收件箱" "$?"
|
|
104
|
+
after="$(tmux capture-pane -p -S - -t "$SESS:p55w" 2>/dev/null | cksum)"
|
|
105
|
+
[ "$after" = "$before" ]; ck C5 "遗体画面逐字节不变" "$?" "$before → $after"
|
|
106
|
+
|
|
107
|
+
# ── D:复用抓现场 ──
|
|
108
|
+
if env TEAM_AGENTS="p55w" TEAM_AGENT_CMD="$T/bin/fake-agent {cwd}" TEAM_AGENT_BIN="$T/bin/fake-agent" \
|
|
109
|
+
TEAM_DISPATCH_ALIVE_SEC=0 TEAM_AGENT_SCENE_LINES=3 \
|
|
110
|
+
$TEAM dispatch p55w T9.55 "$REPO/.pi/team/state/T9.55-brief.md" >"$T/d2.log" 2>&1; then ck D1 "复用 dispatch 成功" 0; else ck D1 "复用 dispatch 成功" 1 "$(tail -1 "$T/d2.log")"; fi
|
|
111
|
+
grep -qF "上一个 pane 已死(signal=9)" "$T/d2.log"; ck D2 "复用点名上一个 pane 已死" "$?"
|
|
112
|
+
f="$REPO/.pi/team/state/dispatch-p55w-pane-dead.txt"
|
|
113
|
+
grep -qF "exit: signal=9" "$f" 2>/dev/null; ck D3 "现场文件带退出证据" "$?"
|
|
114
|
+
[ -f "$f" ] && { sed -n '/^--- scene ---/,$p' "$f" | tail -n +2 || true; } | grep -q 'P55-MARK'; ck D4 "现场文件画面含 marker" "$?"
|
|
115
|
+
[ "$(tmux list-windows -t "$SESS" -F '#{window_name}' 2>/dev/null | grep -cx p55w)" = "1" ]; ck D5 "替换后恰好一个窗口" "$?"
|
|
116
|
+
[ "$(tmux show-options -w -v -t "$SESS:p55w" remain-on-exit 2>/dev/null)" = "on" ]; ck D6 "新窗口仍 on" "$?"
|
|
117
|
+
|
|
118
|
+
# ── E:读面(kill 之后)──
|
|
119
|
+
pid="$(tmux list-panes -t "$SESS:p55w" -F '#{pane_pid}' 2>/dev/null | head -1)"
|
|
120
|
+
pgid="$(ps -o pgid= -p "$pid" 2>/dev/null | tr -d ' ')"
|
|
121
|
+
[ -n "$pgid" ] && [ "$pgid" != "$my_pgid" ] && [ "$pgid" != "1" ] && kill -9 -- -"$pgid" 2>/dev/null
|
|
122
|
+
i=0; while [ "$i" -lt 25 ]; do [ "$(tmux list-panes -t "$SESS:p55w" -F '#{pane_dead}' 2>/dev/null | head -1)" = "1" ] && break; sleep 0.2; i=$((i+1)); done
|
|
123
|
+
env TEAM_AGENTS="p55w" TEAM_AGENT_BIN="$T/bin/fake-agent" $TEAM roster >"$T/roster.log" 2>&1
|
|
124
|
+
grep -qE "^p55w +▲ 已死 signal=9" "$T/roster.log"; ck E1 "roster 死 pane 行(▲ + signal=9)" "$?" "$(grep '^p55w' "$T/roster.log")"
|
|
125
|
+
env TEAM_AGENTS="p55w" TEAM_AGENT_BIN="$T/bin/fake-agent" $TEAM __panel-data --block agents >"$T/agents.json" 2>/dev/null
|
|
126
|
+
grep -qF '"pane": "dead"' "$T/agents.json" && grep -qF '"pane_exit": "signal=9"' "$T/agents.json"; ck E2 "机器面 pane=dead/pane_exit=signal=9" "$?"
|
|
127
|
+
! grep -qF '"state": "running"' "$T/agents.json"; ck E2b "尸体不以 running 出现" "$?"
|
|
128
|
+
env TEAM_AGENTS="p55w" TEAM_AGENT_BIN="$T/bin/fake-agent" TEAM_AGENT_SCENE_LINES=2 $TEAM status T9.55 >"$T/status.log" 2>&1
|
|
129
|
+
grep -qF "座位 p55w" "$T/status.log" && grep -qF "signal=9" "$T/status.log" && grep -qF "P55-MARK" "$T/status.log"; ck E3 "status 席位段+现场" "$?"
|
|
130
|
+
env TEAM_AGENTS="p55w" TEAM_AGENT_BIN="$T/bin/fake-agent" $TEAM digest >"$T/digest.log" 2>&1
|
|
131
|
+
grep -qF "! p55w pane 已死(signal=9)" "$T/digest.log"; ck E4 "digest 点名死席位+任务未结束" "$?"
|
|
132
|
+
env TEAM_AGENTS="p55w" TEAM_AGENT_BIN="$T/bin/fake-agent" $TEAM doctor >"$T/doctor.log" 2>&1
|
|
133
|
+
grep -qF "死 pane 席位 p55w" "$T/doctor.log"; ck E5 "doctor 告警点名死席位" "$?"
|
|
134
|
+
|
|
135
|
+
# ── F:teardown ──
|
|
136
|
+
env TEAM_AGENTS="p55w" $TEAM teardown --agent p55w >"$T/teardown.log" 2>&1
|
|
137
|
+
i=0; while [ "$i" -lt 25 ]; do tmux list-windows -t "$SESS" -F '#{window_name}' 2>/dev/null | grep -qx p55w || break; sleep 0.2; i=$((i+1)); done
|
|
138
|
+
[ "$(tmux list-windows -t "$SESS" -F '#{window_name}' 2>/dev/null | grep -cx p55w)" = "0" ]; ck F1 "teardown 拆掉遗体窗口" "$?"
|
|
139
|
+
|
|
140
|
+
# P162:收尾先证明私有 socket 生效(不成立就拒绝;cleanup 里不许 exit)
|
|
141
|
+
tmux_iso_guard_soft "flip-p49" "收尾:私有 session" --tmpdir "${TMUX_TMPDIR:-}" \
|
|
142
|
+
&& tmux kill-session -t "$SESS" 2>/dev/null || true
|
|
143
|
+
) || true
|
|
144
|
+
LEG_RESULTS="$LEG_ROOT/results"
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
# ---------------------------------------------------------------- 变异(作用于 skill 副本)
|
|
148
|
+
mut_no_retain() { # <skill副本>:建窗点换回旧一行(删掉 P55 的占位/设选项/读回/respawn 块)
|
|
149
|
+
python3 - "$1/scripts/lib/cmd-agents.sh" <<'PY'
|
|
150
|
+
import sys
|
|
151
|
+
p = sys.argv[1]; s = open(p).read()
|
|
152
|
+
a = s.index(' # P55(remain-on-exit 的时机是红线)')
|
|
153
|
+
b = s.index(' pid="$(team_wait_launch_proof', a)
|
|
154
|
+
s = s[:a] + ' tmux new-window -t "$TEAM_SESSION" -n "$agent" -d -- bash -lc "$inner" "$prompt" >/dev/null 2>&1 || true\n' + s[b:]
|
|
155
|
+
open(p, 'w').write(s)
|
|
156
|
+
PY
|
|
157
|
+
}
|
|
158
|
+
mut_say_dead() { # <skill副本>:删掉 say 的死 pane 换道分支(注释 + if 块,到「# 安全:空提示符时」前)
|
|
159
|
+
python3 - "$1/scripts/lib/cmd-agents.sh" <<'PY'
|
|
160
|
+
import sys
|
|
161
|
+
p = sys.argv[1]; s = open(p).read()
|
|
162
|
+
a = s.index(' # P55(投递换道)')
|
|
163
|
+
b = s.index(' # 安全:空提示符时把消息 send-keys 进去会被 shell 当命令执行', a)
|
|
164
|
+
s = s[:a] + s[b:]
|
|
165
|
+
open(p, 'w').write(s)
|
|
166
|
+
PY
|
|
167
|
+
}
|
|
168
|
+
mut_roster_run() { # <skill副本>:roster 的 dead 行冒充「在跑」
|
|
169
|
+
python3 - "$1/scripts/lib/cmd-status.sh" <<'PY'
|
|
170
|
+
import sys
|
|
171
|
+
p = sys.argv[1]; s = open(p).read()
|
|
172
|
+
old = ' dead*) state="▲ 已死${cond#dead}" ;;'
|
|
173
|
+
assert old in s, "roster dead 行锚点不在"
|
|
174
|
+
s = s.replace(old, ' dead*) state="● $cli 在跑" ;;')
|
|
175
|
+
open(p, 'w').write(s)
|
|
176
|
+
PY
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
# ---------------------------------------------------------------- 四条腿
|
|
180
|
+
OUT="$(mktemp -d "${TMPDIR:-/tmp}/teamsmith-p55-flip-out.XXXXXX")"
|
|
181
|
+
note "P55 flip-p49(§40 翻转夹具)· 输出目录 $OUT"
|
|
182
|
+
note "被测 skill:$FLIP_SKILL"
|
|
183
|
+
|
|
184
|
+
judge() { # <leg> <锚点id> <结果文件> → 0=如预期(锚点红);顺带打印全部红行
|
|
185
|
+
local leg="$1" anchor="$2" res="$3"
|
|
186
|
+
if [ ! -s "$res" ]; then note " ✗ $leg:没有结果文件(夹具没跑起来)"; return 1; fi
|
|
187
|
+
grep '^RED ' "$res" | sed 's/^/ red: /'
|
|
188
|
+
grep -q "^RED $anchor " "$res"
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
flip_rc=0
|
|
192
|
+
|
|
193
|
+
note "== leg0 green(未改) =="
|
|
194
|
+
p55_leg green "$FLIP_SKILL"
|
|
195
|
+
green_red="$(grep -c '^RED ' "$LEG_RESULTS" 2>/dev/null || true)"
|
|
196
|
+
grep '^RED ' "$LEG_RESULTS" 2>/dev/null | sed 's/^/ red: /'
|
|
197
|
+
if [ "$green_red" = "0" ]; then line_ok "leg0:全绿($(grep -c '^OK ' "$LEG_RESULTS") 条断言)——夹具有效"
|
|
198
|
+
else line_red "leg0:未改就有 $green_red 条红 —— 夹具或实现有问题,翻转无意义"; flip_rc=1; fi
|
|
199
|
+
cp "$LEG_RESULTS" "$OUT/leg0-green.results"; [ "$KEEP" = "1" ] || rm -rf "$LEG_ROOT"
|
|
200
|
+
|
|
201
|
+
note "== leg1 变异:删掉留存(建窗回到旧一行)→ 期望 B1 红 =="
|
|
202
|
+
MUT="$(mktemp -d "${TMPDIR:-/tmp}/teamsmith-p55-flip-mut.XXXXXX")"; cp -a "$FLIP_SKILL" "$MUT/skill"
|
|
203
|
+
mut_no_retain "$MUT/skill"
|
|
204
|
+
p55_leg no-retain "$MUT/skill"
|
|
205
|
+
if judge no-retain B1 "$LEG_RESULTS"; then line_ok "leg1:锚点 B1 如预期转红(kill 后窗口消失,遗体断言抓到)"
|
|
206
|
+
else line_red "leg1:锚点 B1 没有红 —— §40 的留存断言拦不住「删掉留存」"; flip_rc=1; fi
|
|
207
|
+
cp "$LEG_RESULTS" "$OUT/leg1-no-retain.results"; [ "$KEEP" = "1" ] || { rm -rf "$LEG_ROOT"; rm -rf "$MUT"; }
|
|
208
|
+
|
|
209
|
+
note "== leg2 变异:say 对死 pane 按键(删掉换道分支)→ 期望 C2 红 =="
|
|
210
|
+
MUT="$(mktemp -d "${TMPDIR:-/tmp}/teamsmith-p55-flip-mut.XXXXXX")"; cp -a "$FLIP_SKILL" "$MUT/skill"
|
|
211
|
+
mut_say_dead "$MUT/skill"
|
|
212
|
+
p55_leg say-dead "$MUT/skill"
|
|
213
|
+
if judge say-dead C2 "$LEG_RESULTS"; then line_ok "leg2:锚点 C2 如预期转红(输出不再点名座位已死)"
|
|
214
|
+
else line_red "leg2:锚点 C2 没有红 —— §40 的投递断言拦不住「say 对遗体按键」"; flip_rc=1; fi
|
|
215
|
+
cp "$LEG_RESULTS" "$OUT/leg2-say-dead.results"; [ "$KEEP" = "1" ] || { rm -rf "$LEG_ROOT"; rm -rf "$MUT"; }
|
|
216
|
+
|
|
217
|
+
note "== leg3 变异:roster 把遗体显示成「在跑」→ 期望 E1 红 =="
|
|
218
|
+
MUT="$(mktemp -d "${TMPDIR:-/tmp}/teamsmith-p55-flip-mut.XXXXXX")"; cp -a "$FLIP_SKILL" "$MUT/skill"
|
|
219
|
+
mut_roster_run "$MUT/skill"
|
|
220
|
+
p55_leg roster-run "$MUT/skill"
|
|
221
|
+
if judge roster-run E1 "$LEG_RESULTS"; then line_ok "leg3:锚点 E1 如预期转红(roster 死 pane 行没了 ▲+证据)"
|
|
222
|
+
else line_red "leg3:锚点 E1 没有红 —— §40 的四态断言拦不住「尸体冒充在跑」"; flip_rc=1; fi
|
|
223
|
+
cp "$LEG_RESULTS" "$OUT/leg3-roster-run.results"; [ "$KEEP" = "1" ] || { rm -rf "$LEG_ROOT"; rm -rf "$MUT"; }
|
|
224
|
+
|
|
225
|
+
note ""
|
|
226
|
+
if [ "$flip_rc" = "0" ]; then note "FLIP 全绿:green 腿全绿 + 三条变异腿各在锚点转红($OUT)"
|
|
227
|
+
else note "FLIP 有未达预期的腿($OUT)"; fi
|
|
228
|
+
rm -rf "$FLIP_SOCK" 2>/dev/null || true
|
|
229
|
+
exit "$flip_rc"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# P71/wake-delivery-idempotence — 事故字节夹具(原样复制,不重写)
|
|
2
|
+
|
|
3
|
+
这四份文件是 2026-09-22 现场文件的**逐字副本**,供 harness S25f(事故重放)直接使用。
|
|
4
|
+
来源与大小:
|
|
5
|
+
|
|
6
|
+
| 文件 | 原始路径 | 大小 |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| `dev2.wake` | `<this-project>/.pi/team/state/inbox-watch/teamsmith_dev2-e88859f1.wake` | 1929 B · 9 行 |
|
|
9
|
+
| `dev2.seen` | `<this-project>/.pi/team/state/inbox-watch/teamsmith_dev2-e88859f1.seen` | 1701 B · 8 行 |
|
|
10
|
+
| `pm-nudges.wake` | `/var/tmp/P71-pm-wake-spool-1746.bak`(76100 B 的 PM spool 前身)里含三个 nudge 时间戳的行 | 690 B · 3 行 |
|
|
11
|
+
|
|
12
|
+
形状(design §1 引用的事实):
|
|
13
|
+
|
|
14
|
+
- `dev2.wake` 与 `dev2.seen` 的差集恰好是最老的一行(`1789810336525`,`M35 范围+1`)——
|
|
15
|
+
它就是「投递过、但没记进去重记忆」的那一行;恢复规则不允许它再被叫醒,过期规则兜住它。
|
|
16
|
+
- `pm-nudges.wake` 的两行文本逐字相同(`[pulse] 待办:未读通知 7 · 待复验 4`),只有时间戳
|
|
17
|
+
(`1790093637236` / `1790094537381`)与第三行的 `未读通知 9` 不同 —— PM 当时看到的
|
|
18
|
+
「同一条被叫两次」正是这两条**不同**的行。
|
|
19
|
+
|
|
20
|
+
S25f 的行为:用这些原始字节建 spool,从 `.seen` 与三个 nudge 交付事实播种投递日志
|
|
21
|
+
(`sent … imported=1`),然后重放事故的截断/重写 —— 必须零唤醒、`rescan … deliver=0`,
|
|
22
|
+
没被记进记忆的那一行只计数、不唤醒。夹具自己按规格解析日志/算身份,不复用实现里的函数。
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
1789868089384 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or perso
|
|
2
|
+
1789868097734 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxx
|
|
3
|
+
1789988187901 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
4
|
+
1790069345651 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describe
|
|
5
|
+
1790079871454 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
6
|
+
1790080212413 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
7
|
+
1790082876488 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
8
|
+
1790086196029 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
1789810336525 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
2
|
+
1789868089384 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or perso
|
|
3
|
+
1789868097734 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxx
|
|
4
|
+
1789988187901 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
5
|
+
1790069345651 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describe
|
|
6
|
+
1790079871454 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
7
|
+
1790080212413 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
8
|
+
1790082876488 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
9
|
+
1790086196029 say pm dev2 SYNTHETIC fixture payload for the inbox-watch tests: this text is invented and describes no real task, instruction or person. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
1790093637236 nudge pulse - SYNTHETIC fixture nudge for the patrol tests: invented text used to verify dedup and recovery. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
2
|
+
1790094537381 nudge pulse - SYNTHETIC fixture nudge for the patrol tests: invented text used to verify dedup and recovery. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
3
|
+
1790095437514 nudge pulse - SYNTHETIC fixture nudge for the patrol tests: invented text used to verify dedup and recovery. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|