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.
Files changed (104) hide show
  1. package/README.md +16 -8
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +55 -0
  4. package/skills/teamsmith/SKILL.md +18 -7
  5. package/skills/teamsmith/extension/team-bg.ts +47 -11
  6. package/skills/teamsmith/extension/team-notify.ts +143 -4
  7. package/skills/teamsmith/references/agent-adapters.md +7 -7
  8. package/skills/teamsmith/references/config.md +29 -15
  9. package/skills/teamsmith/references/migration.md +38 -2
  10. package/skills/teamsmith/references/openspec.md +23 -9
  11. package/skills/teamsmith/references/protocol.md +81 -13
  12. package/skills/teamsmith/references/workflows.md +31 -19
  13. package/skills/teamsmith/scripts/lib/cmd-agents.sh +210 -70
  14. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +70 -9
  15. package/skills/teamsmith/scripts/lib/cmd-config.sh +222 -70
  16. package/skills/teamsmith/scripts/lib/cmd-death.sh +2 -15
  17. package/skills/teamsmith/scripts/lib/cmd-docs.sh +6 -3
  18. package/skills/teamsmith/scripts/lib/cmd-project.sh +134 -17
  19. package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
  20. package/skills/teamsmith/scripts/lib/cmd-review.sh +13 -10
  21. package/skills/teamsmith/scripts/lib/cmd-status.sh +42 -13
  22. package/skills/teamsmith/scripts/lib/cmd-watch.sh +75 -13
  23. package/skills/teamsmith/scripts/lib/common.sh +797 -71
  24. package/skills/teamsmith/scripts/monitor.mjs +34 -3
  25. package/skills/teamsmith/scripts/panel/README.md +22 -11
  26. package/skills/teamsmith/scripts/panel/panel.js +217 -215
  27. package/skills/teamsmith/scripts/panel/src/App.tsx +421 -164
  28. package/skills/teamsmith/scripts/panel/src/data.ts +84 -4
  29. package/skills/teamsmith/scripts/panel/src/layout.ts +502 -91
  30. package/skills/teamsmith/scripts/panel/src/main.tsx +97 -12
  31. package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
  32. package/skills/teamsmith/scripts/panel/src/strings/en.ts +56 -21
  33. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +56 -21
  34. package/skills/teamsmith/scripts/panel/src/types.ts +178 -16
  35. package/skills/teamsmith/scripts/replies.mjs +893 -0
  36. package/skills/teamsmith/scripts/team +1 -0
  37. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +15 -2
  38. package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
  39. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
  40. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
  41. package/skills/teamsmith/templates/config.sh.tmpl +10 -5
  42. package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
  43. package/skills/teamsmith/templates/pm-prompt.md.tmpl +20 -1
  44. package/skills/teamsmith/templates/report.md.tmpl +12 -0
  45. package/skills/teamsmith/templates/task.md.tmpl +4 -0
  46. package/skills/teamsmith/tests/bg-ledger-harness.mjs +682 -0
  47. package/skills/teamsmith/tests/bg-ledger.sh +307 -0
  48. package/skills/teamsmith/tests/checkout-shape-probe.sh +287 -58
  49. package/skills/teamsmith/tests/config-cli.sh +162 -288
  50. package/skills/teamsmith/tests/death-cause.sh +5 -2
  51. package/skills/teamsmith/tests/install-shape.sh +4 -2
  52. package/skills/teamsmith/tests/key-replies-pty.sh +375 -0
  53. package/skills/teamsmith/tests/key-replies-ui.sh +332 -0
  54. package/skills/teamsmith/tests/key-replies.sh +1075 -0
  55. package/skills/teamsmith/tests/ledger-ban.sh +5 -5
  56. package/skills/teamsmith/tests/ledger-claim.sh +247 -0
  57. package/skills/teamsmith/tests/lib/checkout-shape.sh +66 -14
  58. package/skills/teamsmith/tests/lib/model-policy.sh +26 -0
  59. package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
  60. package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
  61. package/skills/teamsmith/tests/lib/model-routing-flips.py +136 -0
  62. package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
  63. package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
  64. package/skills/teamsmith/tests/lib/reply-fixture.sh +372 -0
  65. package/skills/teamsmith/tests/lib/tmux-iso.sh +8 -0
  66. package/skills/teamsmith/tests/panel-b2.sh +1 -1
  67. package/skills/teamsmith/tests/panel-b3-stub.sh +27 -0
  68. package/skills/teamsmith/tests/panel-b3.sh +14 -10
  69. package/skills/teamsmith/tests/panel-choices.sh +74 -61
  70. package/skills/teamsmith/tests/panel-cpu.sh +1 -1
  71. package/skills/teamsmith/tests/panel-p21.sh +311 -190
  72. package/skills/teamsmith/tests/perf.sh +1 -1
  73. package/skills/teamsmith/tests/pm-box-real.sh +1 -1
  74. package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
  75. package/skills/teamsmith/tests/routes.sh +43 -22
  76. package/skills/teamsmith/tests/section-budgets.tsv +9 -5
  77. package/skills/teamsmith/tests/section-paths.tsv +26 -16
  78. package/skills/teamsmith/tests/section-select.sh +99 -16
  79. package/skills/teamsmith/tests/smoke.sh +930 -216
  80. package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
  81. package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
  82. package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
  83. package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
  84. package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
  85. package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
  86. package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
  87. package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
  88. package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
  89. package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
  90. package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
  91. package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
  92. package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
  93. package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
  94. package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
  95. package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
  96. package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
  97. package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
  98. package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
  99. package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
  100. package/skills/teamsmith/tests/task-header-model.sh +2 -1
  101. package/skills/teamsmith/tests/task-model-routing.sh +1014 -0
  102. package/skills/teamsmith-init/SKILL.md +38 -38
  103. package/skills/teamsmith-init/references/bootstrap.md +6 -4
  104. package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
@@ -10,8 +10,8 @@
10
10
  export type PmState = 'running' | 'starting' | 'absent' | 'foreign' | 'unknown'
11
11
  export type AgentState = 'running' | 'exited' | 'absent'
12
12
 
13
- /** The four console pages (TUI-only; `--print`/`--json` render the overview). */
14
- export type PageId = 1 | 2 | 3 | 4
13
+ /** The five console pages (TUI-only; `--print`/`--json` render the overview). */
14
+ export type PageId = 1 | 2 | 3 | 4 | 5
15
15
 
16
16
  /**
17
17
  * The board's six lanes in the fixed order BOARD.md's header legend declares (P123). Both the layout
@@ -365,23 +365,67 @@ export interface SettingsChoicePicker {
365
365
  index: number
366
366
  /** The accepted interval the numeric kinds display (null when the kind names none). */
367
367
  interval: { min: string; max: string } | null
368
+ /**
369
+ * True when this picker edits a **task category** rather than a contract key (P232): the row it
370
+ * belongs to is a category row, its entries are the project's known models plus free text, and
371
+ * the accept writes `team config set-task-model <category> <model>` — never a pair list.
372
+ */
373
+ category?: boolean
374
+ }
375
+
376
+ /** One future task-category policy row as `team config list --json` reports it (P232). */
377
+ export interface SettingsCategory {
378
+ category: string
379
+ model: string
368
380
  }
369
381
 
370
- /** One seat's displayed model and its CLI-computed source (P22/B4). */
371
- export interface SettingsSeat {
382
+ /**
383
+ * One seat's **committed** launch assignment (P232): the record a dispatch published, read-only.
384
+ * `assigned=false` means there is no complete record — `diagnostic` then says why, and no model is
385
+ * invented (the future policy above is never displayed as this seat's actual model).
386
+ */
387
+ export interface SettingsAssignment {
372
388
  agent: string
389
+ assigned: boolean
390
+ task: string
391
+ category: string
373
392
  model: string
374
- source: 'config' | 'explicit' | 'record'
375
- override: boolean
393
+ selected_via: string
394
+ launch_via: string
395
+ sid: string
396
+ identity_via: string
397
+ diagnostic: string
398
+ }
399
+
400
+ /** The PM's last launch metadata (`state/pm-launch.env`), read-only (P232). */
401
+ export interface SettingsPmLaunch {
402
+ project?: string
403
+ window?: string
404
+ model?: string
405
+ nonce?: string
406
+ time?: string
407
+ mode?: string
408
+ resume_key?: string
376
409
  }
377
410
 
378
- /** The `settings` block: exactly `team config list --json` (P22/B2). */
411
+ /**
412
+ * The `settings` block: exactly `team config list --json` (P22/B2). `models` separates the future
413
+ * policy (`policy.categories`/`policy.pm`) from the committed launch records (`assignments`,
414
+ * `pm_launch`) — the view never presents one as the other — plus the project's known model
415
+ * vocabulary (`known`) and the policy's migration diagnosis (`diagnostic`).
416
+ */
379
417
  export interface SettingsBlock {
380
418
  path: string
381
419
  fingerprint: string
382
420
  mtime: string
383
421
  keys: SettingsKey[]
384
- models: { default: string; known: string[]; seats: SettingsSeat[] }
422
+ models: {
423
+ policy: { categories: SettingsCategory[]; pm: string }
424
+ assignments: SettingsAssignment[]
425
+ pm_launch: SettingsPmLaunch
426
+ known: string[]
427
+ diagnostic: string
428
+ }
385
429
  audit: string[]
386
430
  }
387
431
 
@@ -412,6 +456,88 @@ export interface DetailBlock {
412
456
  files: DetailFile[]
413
457
  }
414
458
 
459
+ // ---------------------------------------------------------------- key replies (pulse-key-replies)
460
+
461
+ /** One numbered slot as the readers report it: metadata only, or a numbered unavailable row. */
462
+ export type ReplyEntry =
463
+ | {
464
+ no: number
465
+ available: true
466
+ /** Safe display text (the metadata's own sanitization already ran in the reader). */
467
+ title: string
468
+ /** The declared (self-declared, never verified) publisher label. */
469
+ from: string
470
+ /** UTC ISO publication time. */
471
+ at: string
472
+ bytes: number
473
+ sha256: string
474
+ }
475
+ | { no: number; available: false; reason: string }
476
+
477
+ /** One index-level warning (`partial-tail`): a reader continues and says the tail is incomplete. */
478
+ export interface ReplyWarning {
479
+ kind: string
480
+ bytes?: number
481
+ }
482
+
483
+ /** The latest-reply summary block (`__panel-data --block reply_summary`). Body-free by contract. */
484
+ export interface ReplySummaryBlock {
485
+ available: boolean
486
+ /** ok | empty | unavailable */
487
+ state: string
488
+ total_slots: number
489
+ warnings: ReplyWarning[]
490
+ entry?: ReplyEntry
491
+ reason?: string
492
+ }
493
+
494
+ /** One list page: at most 50 slots, newest first, `next_before` when older slots exist. */
495
+ export interface ReplyListBlock {
496
+ available: boolean
497
+ state: string
498
+ total_slots: number
499
+ entries: ReplyEntry[]
500
+ next_before: number | null
501
+ warnings: ReplyWarning[]
502
+ }
503
+
504
+ /** One committed body as safe display text (`--format json`); `--raw` is the byte-exact exit. */
505
+ export interface ReplyBodyBlock {
506
+ no: number
507
+ available: boolean
508
+ title: string
509
+ from: string
510
+ at: string
511
+ bytes: number
512
+ sha256: string
513
+ text_kind: string
514
+ display_text: string
515
+ }
516
+
517
+ /** The open viewer's document window as the frame rendered it (the App's scroll clamps on it). */
518
+ export interface ReplyDocWindow {
519
+ /** The number the document belongs to. */
520
+ no: number
521
+ /** Document rows at the rendered width. */
522
+ total: number
523
+ /** Rows the window shows. */
524
+ visible: number
525
+ /** The first visible row (clamped by the layout). */
526
+ offset: number
527
+ }
528
+
529
+ /** The key-replies page's list window as the frame rendered it (the App's arrows clamp on it). */
530
+ export interface ReplyWindow {
531
+ /** The focused row's number (0 when the page has no committed row to focus). */
532
+ focus: number
533
+ /** The first visible row's index in the drawn list. */
534
+ offset: number
535
+ /** Rows the window shows. */
536
+ visible: number
537
+ /** Rows the page currently holds. */
538
+ count: number
539
+ }
540
+
415
541
  /** The console-only readers, keyed by their block name; absent = that source failed. */
416
542
  export interface PanelBlocks {
417
543
  board?: BoardBlock
@@ -426,6 +552,12 @@ export interface PanelBlocks {
426
552
  settings?: SettingsBlock
427
553
  /** Built only while the detail view is open (design §8); never spawned on a parked page. */
428
554
  detail?: DetailBlock
555
+ /** The overview's latest-reply summary (scheduled on every page; body-free). */
556
+ reply_summary?: ReplySummaryBlock
557
+ /** Page 5's current list page: wanted only on page 5 (and only for the cursor in view). */
558
+ reply_list?: ReplyListBlock
559
+ /** The open viewer's one body: wanted only while the reply viewer is open. */
560
+ reply_body?: ReplyBodyBlock
429
561
  }
430
562
 
431
563
  // ------------------------------------------------------------------ layout
@@ -516,10 +648,22 @@ export type Action =
516
648
  | { kind: 'choice-close' }
517
649
  /** The settings overlay's navigation row: open the project-settings view. */
518
650
  | { kind: 'settings-open-view' }
519
- /** The seat picker: choose option `index` (a click on a picker row). */
520
- | { kind: 'seat-pick'; index: number }
521
- /** The seat picker: move the selection (the ↑/↓ chips). */
522
- | { kind: 'seat-move'; delta: number }
651
+ /** Key-replies page: a click on a row (focus when it was not focused, open when it was). */
652
+ | { kind: 'reply-click'; index: number }
653
+ /** Key-replies page: move the row focus (↑/↓ and the wheel rows). */
654
+ | { kind: 'reply-move'; delta: number }
655
+ /** Key-replies page: fetch the adjacent cursor page (←/→ and the Older/Newer chips). */
656
+ | { kind: 'reply-page'; dir: -1 | 1 }
657
+ /** Key-replies page: `r` — drop the cursor chain and fetch the newest page. */
658
+ | { kind: 'reply-reset' }
659
+ /** Key-replies page: open the focused row's body (Enter / the second click). */
660
+ | { kind: 'reply-open'; index?: number }
661
+ /** Key-replies viewer: scroll the document (↑/↓, PgUp/PgDn, Home/End, the wheel). */
662
+ | { kind: 'reply-scroll'; delta: number }
663
+ /** Key-replies viewer: leave it (Esc/q) back to the same list cursor, focus and viewport. */
664
+ | { kind: 'reply-close' }
665
+ /** The overview's latest-reply entry: page 5 plus that entry's viewer. */
666
+ | { kind: 'reply-open-latest'; no?: number }
523
667
 
524
668
  export interface PlacedLine {
525
669
  line: Line
@@ -580,6 +724,10 @@ export interface Frame {
580
724
  detail?: DetailWindow
581
725
  /** The project-settings view's row window (absent while the view is closed). */
582
726
  settings?: SettingsWindow
727
+ /** Page 5's list window (absent off page 5). */
728
+ replyList?: ReplyWindow
729
+ /** The open reply viewer's document window (absent while the viewer is closed). */
730
+ replyDoc?: ReplyDocWindow
583
731
  /** The work page's board rows in the order they were drawn (the App's `↑`/`↓` walk this). */
584
732
  boardOrder?: FocusRef[]
585
733
  }
@@ -595,7 +743,8 @@ export interface FrameInput {
595
743
  width: number
596
744
  height: number
597
745
  /** Whether the activity column is on for this frame. */
598
- activity: boolean
746
+ activity: boolean /** Why the reply-body reader is degraded, when it is a failure and not a pending read. */
747
+ replyBodyFailed?: boolean
599
748
  }
600
749
 
601
750
  /** The console's UI state (TUI-only; the machine exits use the defaults). */
@@ -628,6 +777,21 @@ export interface ViewState {
628
777
  detail?: string | null
629
778
  /** The open detail view's file tab (clamped by the layout; 0 = the first file). */
630
779
  detailIndex?: number
780
+ /** Page 5's focused number (a stable `no`, never an array position); null = the newest row. */
781
+ replyFocus?: number | null
782
+ /** Page 5's fetched cursor: null/absent = the newest page; a number = `--before` that number. */
783
+ replyCursor?: number | null
784
+ /** The cursors already fetched, newest first (the Newer chain walks back through this). */
785
+ replyStack?: number[]
786
+ /** The open viewer's number (null/absent = the list is showing). */
787
+ replyBody?: number | null
788
+ /** The viewer document's first visible row. */
789
+ replyScroll?: number
790
+ /** Page 5's list window offset (`undefined` = follow the focus; a number = the wheel's offset). */
791
+ replyOffset?: number | null
792
+ /** True when the viewer's body read failed (the frame carries the block's error): the viewer then
793
+ * says "unavailable" instead of spinning forever. */
794
+ replyBodyFailed?: boolean
631
795
  /** The detail document's first visible row. */
632
796
  detailScroll?: number
633
797
  /** True while the project-settings view replaces the page's blocks (P22/B2). */
@@ -645,8 +809,6 @@ export interface ViewState {
645
809
  settingsDraft?: { row: number; text: string; cursor: number } | null
646
810
  /** The pending write confirmation (the first Enter of a two-step write). */
647
811
  settingsConfirm?: { row: number; key: string; old: string; next: string; danger: boolean } | null
648
- /** The open seat picker: the seat's agent, its option list and the selection. */
649
- seatPicker?: { agent: string; row: number; models: string[]; index: number } | null
650
- /** The open choice picker (M55): the row, its schema-derived entries and the selection. */
812
+ /** The open choice picker (M55/P232): the row, its schema-derived entries and the selection. */
651
813
  choicePicker?: SettingsChoicePicker | null
652
814
  }