wtf-p 0.9.0 → 0.9.1

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 (114) hide show
  1. package/README.md +5 -2
  2. package/bin/lib/adapter-compiler.js +65 -18
  3. package/package.json +1 -1
  4. package/pancode/extension/.wtfp-generated.json +8 -4
  5. package/pancode/extension/pancode-extension.yaml +1 -1
  6. package/pancode/extension/runtime/extension.test.ts +89 -2
  7. package/pancode/extension/runtime/extension.ts +110 -24
  8. package/pancode/extension/runtime/help.json +82 -0
  9. package/pancode/plugin/.wtfp-generated.json +27 -27
  10. package/pancode/plugin/dev.pancode/agents/wtfp-argument-verifier.md +4 -0
  11. package/pancode/plugin/dev.pancode/agents/wtfp-citation-expert.md +4 -0
  12. package/pancode/plugin/dev.pancode/agents/wtfp-citation-formatter.md +4 -0
  13. package/pancode/plugin/dev.pancode/agents/wtfp-coherence-checker.md +4 -0
  14. package/pancode/plugin/dev.pancode/agents/wtfp-outliner.md +4 -0
  15. package/pancode/plugin/dev.pancode/agents/wtfp-plan-checker.md +4 -0
  16. package/pancode/plugin/dev.pancode/agents/wtfp-prose-polisher.md +4 -0
  17. package/pancode/plugin/dev.pancode/agents/wtfp-research-synthesizer.md +4 -0
  18. package/pancode/plugin/dev.pancode/agents/wtfp-section-planner.md +4 -0
  19. package/pancode/plugin/dev.pancode/agents/wtfp-section-reviewer.md +4 -0
  20. package/pancode/plugin/dev.pancode/agents/wtfp-section-writer.md +4 -0
  21. package/pancode/plugin/dev.pancode/playbooks/wtfp-draft-review.md +1 -1
  22. package/pancode/plugin/dev.pancode/playbooks/wtfp-plan-section.md +2 -0
  23. package/pancode/plugin/dev.pancode/prompts/wtfp/contribute.md +3 -0
  24. package/pancode/plugin/dev.pancode/prompts/wtfp/create-outline.md +1 -1
  25. package/pancode/plugin/dev.pancode/prompts/wtfp/help.md +1 -1
  26. package/pancode/plugin/dev.pancode/prompts/wtfp/insert-section.md +1 -1
  27. package/pancode/plugin/dev.pancode/prompts/wtfp/pause-writing.md +1 -1
  28. package/pancode/plugin/dev.pancode/prompts/wtfp/remove-section.md +3 -0
  29. package/pancode/plugin/dev.pancode/prompts/wtfp/report-bug.md +3 -0
  30. package/pancode/plugin/dev.pancode/prompts/wtfp/request-feature.md +3 -0
  31. package/pancode/plugin/dev.pancode/prompts/wtfp/update.md +3 -0
  32. package/pancode/plugin/plugin.json +1 -1
  33. package/pancode/plugin/workflows/create-outline.md +1 -1
  34. package/pancode/plugin/workflows/insert-section.md +1 -1
  35. package/pancode/plugin/workflows/pause-writing.md +1 -1
  36. package/protocol/workflows/create-outline.md +1 -1
  37. package/protocol/workflows/insert-section.md +1 -1
  38. package/protocol/workflows/pause-writing.md +1 -1
  39. package/vendors/antigravity/.wtfp-generated.json +8 -8
  40. package/vendors/antigravity/plugin.json +2 -2
  41. package/vendors/antigravity/skills/wtfp-create-outline/SKILL.md +1 -1
  42. package/vendors/antigravity/skills/wtfp-insert-section/SKILL.md +1 -1
  43. package/vendors/antigravity/skills/wtfp-pause-writing/SKILL.md +1 -1
  44. package/vendors/antigravity/workflows/create-outline.md +1 -1
  45. package/vendors/antigravity/workflows/insert-section.md +1 -1
  46. package/vendors/antigravity/workflows/pause-writing.md +1 -1
  47. package/vendors/claude/.claude-plugin/marketplace.json +2 -2
  48. package/vendors/claude/.claude-plugin/plugin.json +1 -1
  49. package/vendors/claude/.wtfp-generated.json +33 -33
  50. package/vendors/claude/commands/create-outline.md +1 -1
  51. package/vendors/claude/commands/insert-section.md +1 -1
  52. package/vendors/claude/commands/pause-writing.md +1 -1
  53. package/vendors/claude/dev.pancode/agents/wtfp-argument-verifier.md +4 -0
  54. package/vendors/claude/dev.pancode/agents/wtfp-citation-expert.md +4 -0
  55. package/vendors/claude/dev.pancode/agents/wtfp-citation-formatter.md +4 -0
  56. package/vendors/claude/dev.pancode/agents/wtfp-coherence-checker.md +4 -0
  57. package/vendors/claude/dev.pancode/agents/wtfp-outliner.md +4 -0
  58. package/vendors/claude/dev.pancode/agents/wtfp-plan-checker.md +4 -0
  59. package/vendors/claude/dev.pancode/agents/wtfp-prose-polisher.md +4 -0
  60. package/vendors/claude/dev.pancode/agents/wtfp-research-synthesizer.md +4 -0
  61. package/vendors/claude/dev.pancode/agents/wtfp-section-planner.md +4 -0
  62. package/vendors/claude/dev.pancode/agents/wtfp-section-reviewer.md +4 -0
  63. package/vendors/claude/dev.pancode/agents/wtfp-section-writer.md +4 -0
  64. package/vendors/claude/dev.pancode/fleets/wtfp-draft-review.md +1 -1
  65. package/vendors/claude/dev.pancode/fleets/wtfp-plan-section.md +2 -0
  66. package/vendors/claude/dev.pancode/prompts/wtfp/advance.md +3 -0
  67. package/vendors/claude/dev.pancode/prompts/wtfp/contribute.md +3 -0
  68. package/vendors/claude/dev.pancode/prompts/wtfp/create-outline.md +1 -1
  69. package/vendors/claude/dev.pancode/prompts/wtfp/help.md +1 -1
  70. package/vendors/claude/dev.pancode/prompts/wtfp/insert-section.md +1 -1
  71. package/vendors/claude/dev.pancode/prompts/wtfp/pause-writing.md +1 -1
  72. package/vendors/claude/dev.pancode/prompts/wtfp/remove-section.md +3 -0
  73. package/vendors/claude/dev.pancode/prompts/wtfp/report-bug.md +3 -0
  74. package/vendors/claude/dev.pancode/prompts/wtfp/request-feature.md +3 -0
  75. package/vendors/claude/dev.pancode/prompts/wtfp/update.md +3 -0
  76. package/vendors/claude/plugin.json +1 -1
  77. package/vendors/claude/workflows/create-outline.md +1 -1
  78. package/vendors/claude/workflows/insert-section.md +1 -1
  79. package/vendors/claude/workflows/pause-writing.md +1 -1
  80. package/vendors/codex/plugins/wtfp/.codex-plugin/plugin.json +1 -1
  81. package/vendors/codex/plugins/wtfp/.wtfp-generated.json +6 -6
  82. package/vendors/codex/plugins/wtfp/plugin.json +1 -1
  83. package/vendors/codex/plugins/wtfp/workflows/create-outline.md +1 -1
  84. package/vendors/codex/plugins/wtfp/workflows/insert-section.md +1 -1
  85. package/vendors/codex/plugins/wtfp/workflows/pause-writing.md +1 -1
  86. package/vendors/copilot/.wtfp-generated.json +6 -6
  87. package/vendors/copilot/marketplace.json +2 -2
  88. package/vendors/copilot/plugins/wtfp/.claude-plugin/plugin.json +1 -1
  89. package/vendors/copilot/plugins/wtfp/.wtfp-generated.json +8 -8
  90. package/vendors/copilot/plugins/wtfp/commands/wtfp-create-outline.md +1 -1
  91. package/vendors/copilot/plugins/wtfp/commands/wtfp-insert-section.md +1 -1
  92. package/vendors/copilot/plugins/wtfp/commands/wtfp-pause-writing.md +1 -1
  93. package/vendors/copilot/plugins/wtfp/workflows/create-outline.md +1 -1
  94. package/vendors/copilot/plugins/wtfp/workflows/insert-section.md +1 -1
  95. package/vendors/copilot/plugins/wtfp/workflows/pause-writing.md +1 -1
  96. package/vendors/copilot/project/.github/prompts/wtfp-pause-writing.prompt.md +1 -1
  97. package/vendors/copilot/project/.github/wtfp/workflows/create-outline.md +1 -1
  98. package/vendors/copilot/project/.github/wtfp/workflows/insert-section.md +1 -1
  99. package/vendors/copilot/project/.github/wtfp/workflows/pause-writing.md +1 -1
  100. package/vendors/gemini/.wtfp-generated.json +8 -8
  101. package/vendors/gemini/commands/wtfp/create-outline.toml +1 -1
  102. package/vendors/gemini/commands/wtfp/insert-section.toml +1 -1
  103. package/vendors/gemini/commands/wtfp/pause-writing.toml +1 -1
  104. package/vendors/gemini/gemini-extension.json +1 -1
  105. package/vendors/gemini/workflows/create-outline.md +1 -1
  106. package/vendors/gemini/workflows/insert-section.md +1 -1
  107. package/vendors/gemini/workflows/pause-writing.md +1 -1
  108. package/vendors/opencode/.wtfp-generated.json +7 -7
  109. package/vendors/opencode/commands/wtfp/create-outline.md +1 -1
  110. package/vendors/opencode/commands/wtfp/insert-section.md +1 -1
  111. package/vendors/opencode/commands/wtfp/pause-writing.md +1 -1
  112. package/vendors/opencode/workflows/create-outline.md +1 -1
  113. package/vendors/opencode/workflows/insert-section.md +1 -1
  114. package/vendors/opencode/workflows/pause-writing.md +1 -1
package/README.md CHANGED
@@ -106,8 +106,9 @@ On PanCode, one command then carries the project forward:
106
106
  The desk picks each step from the project records, by the same ladder
107
107
  `/wtfp:progress` reports, and arms its write guard for that action alone. It
108
108
  stops at the first gate only you can answer, asks it, and continues after your
109
- answer; a gate you keep pending ends the run. Press `a` in the desk to start
110
- it. Every other host, and any step you want to run yourself, moves one action
109
+ answer; a gate you keep pending ends the run. In the desk, `Ctrl+G A` starts
110
+ it, `Ctrl+G C` answers the pending gate and `Ctrl+G V` validates the records.
111
+ Every other host, and any step you want to run yourself, moves one action
111
112
  at a time:
112
113
 
113
114
  ```text
@@ -216,3 +217,5 @@ time for writer's block.
216
217
  **No more excuses. Ship the paper.**
217
218
 
218
219
  </div>
220
+
221
+ Part of Anthony Kougkas's agentic engineering work: [akougkas.io/work/agentic-engineering](https://akougkas.io/work/agentic-engineering/)
@@ -754,7 +754,26 @@ function pancodeDeskCalls(tools) {
754
754
  if (!(name in PANCODE_DESK_ARGS)) throw new Error(`no PanCode argument shape for desk tool ${tool}`);
755
755
  return `${name} ${PANCODE_DESK_ARGS[name]}`;
756
756
  });
757
- return `Call desk tools with \`gateway(op="call", capability="extension_wtfp__<tool>", args={...})\`, without a describe first; args: ${args.join(', ')}. Describe one only after it rejects its arguments. A record write that would not validate, or reports a stale read or a missing version, asks you to fix the record or read it again and resend; that is not a refusal. Any other error or refusal stops the action; never bypass it with a manual write or shell script. \`read_record\` on a family URI, such as \`project://sources\` or \`project://evidence\`, returns that family's records in one call, and names a \`?after=\` page for any it holds back; list a family that way, never with a shell. It serves JSON records only; read authored artifacts directly: \`project://sections/{s}/context\`, \`research\`, \`summary\` and \`handoff\` are \`.planning/sections/{s}/<name>.md\`, plans and reviews are \`.planning/sections/{s}/plans/<id>.md\` and \`reviews/<id>.md\`, and \`project://paper/{a}\` is \`paper/{a}.md\`.`;
757
+ return `Call desk tools with \`gateway(op="call", capability="extension_wtfp__<tool>", args={...})\`, without a describe first; args: ${args.join(', ')}. Describe one only after it rejects its arguments. A record write that would not validate, or reports a stale read or a missing version, asks you to fix the record or read it again and resend; that is not a refusal. Any other error or refusal stops the action; never bypass it with a manual write or shell script. \`read_record\` on a family URI, such as \`project://sources\` or \`project://evidence\`, returns that family's records in one call, and names a \`?after=\` page for any it holds back; list a family that way, never with a shell. It serves JSON records only; read authored artifacts directly: ${PANCODE_ARTIFACT_PATHS}.`;
758
+ }
759
+
760
+ // Where PanCode keeps the portable project's resources (protocol/project/README.md).
761
+ // A worker holds only `project://` URIs and no desk to resolve them, so its
762
+ // recipe and its playbook carry these paths.
763
+ const PANCODE_RECORD_PATHS = '`project://manifest`, `config`, `state` and `decisions` are `.planning/project.json`, `config.json`, `state.json` and `decisions.json`; `project://structure/outline` is `.planning/structure/outline.json`; `project://sections/{s}` is `.planning/sections/{s}/section.json`; and `project://sources/{id}`, `evidence/{id}`, `checkpoints/{id}` and `validations/{id}` are `.planning/sources/{id}.json`, `.planning/evidence/{id}.json`, `.planning/checkpoints/{id}.json` and `.planning/validations/{id}.json`';
764
+ const PANCODE_ARTIFACT_PATHS = '`project://sections/{s}/context`, `research`, `summary` and `handoff` are `.planning/sections/{s}/<name>.md`, plans and reviews are `.planning/sections/{s}/plans/<id>.md` and `reviews/<id>.md`, and `project://paper/{a}` is `paper/{a}.md`';
765
+
766
+ // One declared logical write as the workspace path a PanCode worker writes.
767
+ // `section` is what stands for the section id; other placeholders read as `<name>`.
768
+ function pancodeArtifactPath(resource, section) {
769
+ const sectionPart = (value) => value === '{section}' ? section : `<${value.replace(/[{}]/gu, '')}>`;
770
+ const paper = /^project:\/\/paper\/(\{[a-z]+\})$/u.exec(resource);
771
+ if (paper) return `paper/${sectionPart(paper[1])}.md`;
772
+ const named = /^project:\/\/sections\/(\{[a-z]+\})\/(context|research|summary|handoff)$/u.exec(resource);
773
+ if (named) return `.planning/sections/${sectionPart(named[1])}/${named[2]}.md`;
774
+ const listed = /^project:\/\/sections\/(\{[a-z]+\})\/(plans|reviews)\/(\{[a-z]+\})$/u.exec(resource);
775
+ if (listed) return `.planning/sections/${sectionPart(listed[1])}/${listed[2]}/${sectionPart(listed[3])}.md`;
776
+ return null;
758
777
  }
759
778
 
760
779
  // The PanCode projection of the workflow.drive capability. The desk, not the
@@ -801,6 +820,27 @@ const HELP_START_SEQUENCE = Object.freeze([
801
820
  'write-section', 'review-section', 'progress', 'pause-writing', 'resume-writing'
802
821
  ]);
803
822
 
823
+ // The catalog's actions in the help card's reading order: one group per skill,
824
+ // then the product operations. The desk's help card draws the same groups.
825
+ function helpGroups(model) {
826
+ const groupIds = new Set(HELP_GROUP_ORDER.map(([id]) => id));
827
+ for (const skill of model.catalog.skills) {
828
+ if (!groupIds.has(skill.id)) throw new Error(`help card has no group order for skill ${skill.id}`);
829
+ }
830
+ return [
831
+ ...HELP_GROUP_ORDER.map(([skillId, title]) => ({
832
+ title,
833
+ skill: skillId,
834
+ actions: model.catalog.skills.find((entry) => entry.id === skillId).actions
835
+ })),
836
+ { title: 'Product operations', skill: null, actions: model.catalog.operations.actions }
837
+ ];
838
+ }
839
+
840
+ function pancodeHelpData(model) {
841
+ return stableJson({ schema: 'wtfp.pancode-help/v1', groups: helpGroups(model).map(({ title, actions }) => ({ title, actions })) });
842
+ }
843
+
804
844
  // The argument a human types after the action, derived from the contract's
805
845
  // preconditions: an action whose condition names a target or selected section
806
846
  // takes a section id; a selected prose target or milestone id likewise.
@@ -827,10 +867,7 @@ function pancodeHelpCard(model, availabilityById, legacyFleetNames = false) {
827
867
  : ` [unavailable on pancode: ${[...new Set([...availability.unavailableCapabilities, ...availability.unavailableEffects])].join(', ')}]`;
828
868
  return ` /wtfp:${id} ${helpArgumentHint(action)}\n ${action.description}${blocked}`;
829
869
  };
830
- const groupIds = new Set(HELP_GROUP_ORDER.map(([id]) => id));
831
- for (const skill of model.catalog.skills) {
832
- if (!groupIds.has(skill.id)) throw new Error(`help card has no group order for skill ${skill.id}`);
833
- }
870
+ const groups = helpGroups(model);
834
871
  for (const id of HELP_START_SEQUENCE) if (!byId.has(id)) throw new Error(`help card start sequence names an unknown action: ${id}`);
835
872
  const playbooks = fs.readdirSync(path.join(PROTOCOL_ROOT, 'fleets'))
836
873
  .filter((file) => file.endsWith('.json')).sort()
@@ -847,13 +884,7 @@ function pancodeHelpCard(model, availabilityById, legacyFleetNames = false) {
847
884
  : [])
848
885
  ]),
849
886
  '',
850
- ...HELP_GROUP_ORDER.flatMap(([skillId, title]) => {
851
- const skill = model.catalog.skills.find((entry) => entry.id === skillId);
852
- return [`${title} (skill ${skillId})`, ...skill.actions.map(line), ''];
853
- }),
854
- 'Product operations',
855
- ...model.catalog.operations.actions.map(line),
856
- '',
887
+ ...groups.flatMap(({ title, skill, actions }) => [skill ? `${title} (skill ${skill})` : title, ...actions.map(line), '']),
857
888
  legacyFleetNames
858
889
  ? 'Fleets (pancode fleet run <fleet> --var section=<section>; explicit fleet primitives, not auto-routed)'
859
890
  : 'Playbooks (pancode fleet run <playbook> --var section=<section>; run explicitly, never auto-routed)',
@@ -893,7 +924,10 @@ function renderMarkdownCommand(action, workflowBody, target, availability, deskT
893
924
  if (target === 'claude' || target === 'copilot' || target === 'antigravity') {
894
925
  lines.push('allowed-tools: []');
895
926
  }
896
- lines.push('---', '', blockedActionBody(action, target, availability), '', generatedBanner('protocol/actions', action.id), '');
927
+ // PanCode prints a display-only prompt's first fenced block with no model call, so the refusal costs nothing.
928
+ if (target === 'pancode') lines.push('display-only: true');
929
+ const body = blockedActionBody(action, target, availability);
930
+ lines.push('---', '', target === 'pancode' ? ['```text', body, '```'].join('\n') : body, '', generatedBanner('protocol/actions', action.id), '');
897
931
  return lines.join('\n');
898
932
  }
899
933
  lines.push('argument-hint: "[arguments]"');
@@ -1236,6 +1270,10 @@ function renderPanCodeRole(role, slug) {
1236
1270
  ...(verifier ? ['**Output:** your final message is one JSON object, `{"verdict":"pass|fail","checks":[...]}`, and nothing else. Do every step below as checks in that object, not as a Markdown review; the exact form is in the PanCode result contract at the end.', ''] : []),
1237
1271
  nativeWorkflowBody(roleBodyWithoutPortableResult(role), 'pancode'),
1238
1272
  '',
1273
+ '## PanCode project paths',
1274
+ '',
1275
+ `On PanCode the \`project://\` URIs above are files under the workspace root. Records: ${PANCODE_RECORD_PATHS}. Authored artifacts: ${PANCODE_ARTIFACT_PATHS}. Read and write those files; section artifacts live under \`.planning/sections/\`, never a top-level \`sections/\`.`,
1276
+ '',
1239
1277
  // Live on the 0.8.3 host, a writer that could not count words returned blocked and stopped the drive.
1240
1278
  ...(/word count/i.test(roleBodyWithoutPortableResult(role)) ? ['On PanCode a worker holds no word counter. The dispatching action measures the persisted manuscript after you return and writes that count into the summary, so write the summary without a count. A count you cannot take never blocks this role: return completed when the rest is done.', ''] : []),
1241
1279
  '## PanCode result contract',
@@ -1394,11 +1432,19 @@ function pancodeFleet(fleetId) {
1394
1432
  /\{([a-z][a-z0-9-]*)\}/gu,
1395
1433
  (_match, parameter) => `{{${parameter}}}`
1396
1434
  );
1397
- const logicalWrites = fleet.steps.flatMap(step => step.writes);
1398
- const nativeResourceProjection = logicalWrites.some(resource =>
1399
- /^project:\/\/paper(?:\/|$)/u.test(resource)
1400
- )
1401
- ? 'For this PanCode projection, resolve logical `project://paper/...` artifacts under the project-root `paper/` directory, never under `.planning/paper/`.'
1435
+ const logicalWrites = [...new Set(fleet.steps.flatMap(step => step.writes))];
1436
+ const writePaths = logicalWrites.map((resource) => {
1437
+ const file = pancodeArtifactPath(resource, '{{section}}');
1438
+ if (file === null) throw new Error(`fleet ${fleetId} has no PanCode path for ${resource}`);
1439
+ const uri = resource.replace(/\{([a-z]+)\}/gu, (_match, name) => name === 'section' ? '{{section}}' : `<${name}>`);
1440
+ return `\`${uri}\` as \`${file}\``;
1441
+ });
1442
+ const roots = [
1443
+ ...(writePaths.some((entry) => entry.includes('`.planning/sections/')) ? ['section artifacts go under `.planning/sections/`, never a top-level `sections/`'] : []),
1444
+ ...(writePaths.some((entry) => entry.includes('`paper/')) ? ['manuscripts go under `paper/`, never `.planning/paper/`'] : [])
1445
+ ];
1446
+ const nativeResourceProjection = writePaths.length > 0
1447
+ ? `On PanCode, write ${writePaths.join(' and ')}, relative to the workspace root: ${roots.join(', and ')}.`
1402
1448
  : null;
1403
1449
  return [
1404
1450
  '---',
@@ -1766,6 +1812,7 @@ function addPanCodeRuntime(plan, model, availabilityById) {
1766
1812
  addFile(plan, 'runtime/claim-coverage.cjs', `${generatedScriptBanner('evaluation', 'lib/claim-coverage.js')}\n${fs.readFileSync(path.join(ROOT, 'evaluation', 'lib', 'claim-coverage.js'), 'utf8')}`);
1767
1813
  addFile(plan, 'runtime/desk-trust.cjs', `${generatedScriptBanner('evaluation', 'lib/desk-trust.js')}\n${fs.readFileSync(path.join(ROOT, 'evaluation', 'lib', 'desk-trust.js'), 'utf8')}`);
1768
1814
  addFile(plan, 'runtime/write-guard.json', pancodeWriteGuard(model, availabilityById));
1815
+ addFile(plan, 'runtime/help.json', pancodeHelpData(model));
1769
1816
  addFile(plan, 'skins/wtfp.json', source('skins/wtfp.json'));
1770
1817
  copyTree(plan, path.join(PROTOCOL_ROOT, 'project', 'schemas'), 'project/schemas');
1771
1818
  copyTree(plan, path.join(PROTOCOL_ROOT, 'project', 'templates'), 'project/templates');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wtf-p",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Portable, evidence-grounded academic writing workflows (papers, proposals, posters, presentations) for PanCode, Claude Code, Codex, GitHub Copilot CLI, OpenCode, Antigravity CLI, and Gemini CLI.",
5
5
  "bin": {
6
6
  "wtfp": "bin/install.js",
@@ -2,7 +2,7 @@
2
2
  "schema": "wtfp.generated-adapter/v1",
3
3
  "generatorVersion": 5,
4
4
  "target": "pancode-extension",
5
- "sourceHash": "b9ca57142b453c0571f0dd1c10bea6d7a36ecb0c646e9c1b092f8175755487de",
5
+ "sourceHash": "57232427f8bbf3b1910c9cff3dafd97f0907557db93af3708c15e3a35d90d8f2",
6
6
  "files": [
7
7
  {
8
8
  "path": "actions/add-todo.json",
@@ -158,7 +158,7 @@
158
158
  },
159
159
  {
160
160
  "path": "pancode-extension.yaml",
161
- "sha256": "9a74dd6538c32cc02a147c868c5064e169aba1d79b712de37e21f21f4b732e99"
161
+ "sha256": "3ad6dbb7e3498b4bd0196f8d7ab6d2d2cb7d63da024088a42de11e2dbb1edb2a"
162
162
  },
163
163
  {
164
164
  "path": "project/schemas/checkpoint.schema.json",
@@ -262,11 +262,15 @@
262
262
  },
263
263
  {
264
264
  "path": "runtime/extension.test.ts",
265
- "sha256": "ffe94104e73271f7771d40364a61b37c55699f4040549329e6d462bc17df5306"
265
+ "sha256": "4a1d0fe231e02e993f218f98635960ea668a62f87faa267a8da263dfad03497f"
266
266
  },
267
267
  {
268
268
  "path": "runtime/extension.ts",
269
- "sha256": "aa6d48f9de4bb77f47f6c12ced3ac511ca851b7141dbf9ec44d78401f5d15133"
269
+ "sha256": "d91ddfe74be125cfaf7f448399bac2c91e4855bde4637e67932cd113a1e310b8"
270
+ },
271
+ {
272
+ "path": "runtime/help.json",
273
+ "sha256": "046cac7c434f9c9682898aadcd956f9a26740eb36040cb1a2bde716c768b009d"
270
274
  },
271
275
  {
272
276
  "path": "runtime/json-schema.cjs",
@@ -2,7 +2,7 @@
2
2
  id: wtfp
3
3
  plugin: wtfp
4
4
  name: WTF-P
5
- version: 0.9.0
5
+ version: 0.9.1
6
6
  description: "The WTF-P writing desk for PanCode; paper state, gates and the write guard run in code."
7
7
  license: MIT
8
8
  compatibility: { pancode: ">=0.9.0" }
@@ -468,6 +468,41 @@ test("record writes at the revision or digest the caller read and refuses stale,
468
468
  assert.match(gone.text, /holds wtfp.project.source\/v1|no longer exists/);
469
469
  }));
470
470
 
471
+ test("a section write may not add a link to a missing artifact or a claim id another claim holds", () =>
472
+ withDesk(async (host, workspace) => {
473
+ const sectionFile = ".planning/sections/introduction/section.json";
474
+ const section = read(workspace, sectionFile);
475
+ const artifacts = section.artifacts as Json;
476
+ const dangling = await host.tool("record", {
477
+ uri: "project://sections/introduction",
478
+ record: { ...section, artifacts: { ...artifacts, context: "project://sections/introduction/context" } },
479
+ expect_sha256: sha(workspace, sectionFile),
480
+ });
481
+ assert.match(dangling.text, /links project:\/\/sections\/introduction\/context, which has no file yet\. Write the artifact first/);
482
+ assert.deepEqual(read(workspace, sectionFile).artifacts, artifacts);
483
+ put(workspace, ".planning/sections/introduction/context.md", "# Context\n");
484
+ const linked = await host.tool("record", {
485
+ uri: "project://sections/introduction",
486
+ record: { ...section, artifacts: { ...artifacts, context: "project://sections/introduction/context" } },
487
+ expect_sha256: sha(workspace, sectionFile),
488
+ });
489
+ assert.equal(linked.isError, undefined, linked.text);
490
+
491
+ const claim = { id: "claim-flush", statement: "Flushes dominate logging cost.", status: "planned", evidence_required: false, evidence_uris: [] };
492
+ const current = read(workspace, sectionFile);
493
+ const claimed = await host.tool("record", { uri: "project://sections/introduction", record: { ...current, claims: [claim] }, expect_sha256: sha(workspace, sectionFile) });
494
+ assert.equal(claimed.isError, undefined, claimed.text);
495
+ const { updated_at: _updated, revision: _revision, ...base } = read(workspace, sectionFile);
496
+ const methods = { ...base, id: "methods", title: "Methods", status: "not-started", artifacts: { plans: [], reviews: [] }, checkpoint_uris: [], claims: [claim] };
497
+ const duplicate = await host.tool("record", { uri: "project://sections/methods", record: methods });
498
+ assert.match(duplicate.text, /claim-flush is already a claim of project:\/\/sections\/introduction\. Each claim needs an id no other claim in the project holds/);
499
+ const twice = await host.tool("record", { uri: "project://sections/methods", record: { ...methods, claims: [{ ...claim, id: "claim-cost" }, { ...claim, id: "claim-cost" }] } });
500
+ assert.match(twice.text, /claim-cost appears twice in this record/);
501
+ assert.equal(existsSync(path.join(workspace, ".planning/sections/methods/section.json")), false);
502
+ const fresh = await host.tool("record", { uri: "project://sections/methods", record: { ...methods, claims: [{ ...claim, id: "claim-method" }] } });
503
+ assert.equal(fresh.isError, undefined, fresh.text);
504
+ }));
505
+
471
506
  test("record refuses wrong type, id, project and unknown fields without touching the destination", () =>
472
507
  withDesk(async (host, workspace) => {
473
508
  const before = sha(workspace, ".planning/sections/introduction/section.json");
@@ -582,6 +617,57 @@ test("a gate answer is recorded as a sealed interaction bound to what the author
582
617
  assert.match(again.text, /already resolved by the author at this desk/);
583
618
  }));
584
619
 
620
+ test("resume on a pause checkpoint returns the project to active in the same write; expire leaves it paused", () =>
621
+ withDesk(async (host, workspace) => {
622
+ const pause = (id: string): void => {
623
+ put(workspace, `.planning/checkpoints/${id}.json`, {
624
+ schema: "wtfp.project.checkpoint/v1",
625
+ id,
626
+ project_id: PROJECT,
627
+ kind: "human-action",
628
+ status: "pending",
629
+ blocking: true,
630
+ scope_uri: "project://sections/introduction",
631
+ request: "Resume writing the introduction?",
632
+ options: [
633
+ { id: "resume", label: "Resume", implication: "The project returns to active." },
634
+ { id: "expire", label: "Expire", implication: "The checkpoint closes and the project stays paused." },
635
+ ],
636
+ resume_action: "write-section",
637
+ created_at: AT,
638
+ });
639
+ const state = read(workspace, ".planning/state.json");
640
+ put(workspace, ".planning/state.json", { ...state, status: "paused", active_checkpoint_uris: [`project://checkpoints/${id}`] });
641
+ };
642
+ pause("pause-expire");
643
+ await answer(host, "pause-expire", "expire");
644
+ assert.deepEqual([read(workspace, ".planning/state.json").status, read(workspace, ".planning/state.json").active_checkpoint_uris], ["paused", []]);
645
+
646
+ pause("pause-resume");
647
+ const before = read(workspace, ".planning/state.json").revision as number;
648
+ const key = await ask(host, "pause-resume");
649
+ const done = await host.interview({ id: "gate-one", step: key, nav: "next", answers: { choice: "resume" } });
650
+ assert.match("done" in done ? done.text : "", /pause-resume: Resume\. The project is active again/);
651
+ const state = read(workspace, ".planning/state.json");
652
+ assert.deepEqual([state.status, state.phase, state.active_checkpoint_uris, state.revision], ["active", "writing", [], before + 1]);
653
+ assert.deepEqual([(state.last_transition as Json).from, (state.last_transition as Json).to], ["paused", "active"]);
654
+ const report = (await host.command("validate")).text;
655
+ assert.match(report, /records valid against their schemas/);
656
+ assert.doesNotMatch(report, /project:\/\/(state|checkpoints\/pause-)/);
657
+ }));
658
+
659
+ test("the author's card for a batch of gate answers names what was chosen and leaves the model's instructions out", () =>
660
+ withDesk(async (host) => {
661
+ await answer(host, PLAN_GATE, "approve");
662
+ const started = await host.command("check-todos");
663
+ const next = await host.interview({ id: "gate", step: started.interview?.step.key as string, nav: "next", answers: { choice: "workflow-first" } });
664
+ assert.ok("done" in next);
665
+ assert.match(next.text, /checkpoint-framing: Workflow first\. The desk wrote .*read any of them again/);
666
+ const card = JSON.stringify(next.card);
667
+ assert.match(card, /Recorded: checkpoint-framing: Workflow first\./);
668
+ assert.doesNotMatch(card, /The desk wrote|read any of them again/);
669
+ }, SERVED));
670
+
585
671
  test("cancelling, headless asking and keeping a gate pending never resolve it (G2)", () =>
586
672
  withDesk(async (host, workspace) => {
587
673
  let key = await ask(host, GATE);
@@ -1727,7 +1813,7 @@ test("under the read and write access PanCode grants the desk, it judges every c
1727
1813
  const run = spawnSync(
1728
1814
  process.execPath,
1729
1815
  ["--permission", ...[directory(ROOT), harness, ...read].map((root) => `--allow-fs-read=${root}`), ...write.map((root) => `--allow-fs-write=${root}`), harness, path.join(ROOT, "runtime/extension.ts"), workspace, JSON.stringify(calls.map(([call]) => withFacts({ point: "before_tool", ...call }, workspace)))],
1730
- { cwd: workspace, encoding: "utf8", timeout: 60000 },
1816
+ { cwd: workspace, encoding: "utf8" },
1731
1817
  );
1732
1818
  assert.equal(run.status, 0, run.stderr);
1733
1819
  const verdicts = JSON.parse(run.stdout) as Array<string | null>;
@@ -1756,7 +1842,7 @@ test("under the write access PanCode grants the desk, which refuses every flush,
1756
1842
  "[]",
1757
1843
  JSON.stringify([["record", { uri: "project://state", record: { ...state, phase: "reviewing" }, expect_revision: 3 }]]),
1758
1844
  ],
1759
- { cwd: workspace, encoding: "utf8", timeout: 60000 },
1845
+ { cwd: workspace, encoding: "utf8" },
1760
1846
  );
1761
1847
  assert.equal(run.status, 0, run.stderr);
1762
1848
  const { results } = JSON.parse(run.stdout) as { results: Array<{ isError: boolean; text: string }> };
@@ -1876,6 +1962,7 @@ test("a pending plan gate cannot be retired by briefly linking a decoy plan", ()
1876
1962
  await answer(host, GATE, "protocol-first");
1877
1963
  const sectionFile = ".planning/sections/introduction/section.json";
1878
1964
  const section = read(workspace, sectionFile);
1965
+ writeFileSync(path.join(workspace, ".planning/sections/introduction/plans/decoy.md"), "# Decoy\n");
1879
1966
  const decoy = { ...(section.artifacts as Json), plans: [PLAN_URI, "project://sections/introduction/plans/decoy"] };
1880
1967
  assert.equal((await host.tool("record", { uri: "project://sections/introduction", record: { ...section, artifacts: decoy }, expect_sha256: sha(workspace, sectionFile) })).isError, undefined);
1881
1968
  const checkpoint = read(workspace, `.planning/checkpoints/${PLAN_GATE}.json`);
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * WTF-P writing desk for PanCode. Human-edited source; the adapter
4
4
  * compiler copies it to pancode/extension/runtime/ beside the
5
- * generated write-guard.json, json-schema.cjs and claim-coverage.cjs.
5
+ * generated write-guard.json, help.json, json-schema.cjs and claim-coverage.cjs.
6
6
  *
7
7
  * The desk reads the portable `.planning` records and the manuscript and
8
8
  * draws them. It is also the project's one JSON record writer on PanCode: each
@@ -113,6 +113,10 @@ const GUARD = JSON.parse(readFileSync(new URL("./write-guard.json", import.meta.
113
113
  actions: Record<string, GuardAction>;
114
114
  paperWriters: string[];
115
115
  };
116
+ const HELP = JSON.parse(readFileSync(new URL("./help.json", import.meta.url), "utf8")) as {
117
+ schema: string;
118
+ groups: Array<{ title: string; actions: string[] }>;
119
+ };
116
120
  const SKIN = JSON.parse(readFileSync(new URL("../skins/wtfp.json", import.meta.url), "utf8")) as ExtensionSkin;
117
121
  const RECORD_LIMIT = 1024 * 1024;
118
122
  const PHASES = ["initialized", "mapped", "outlining", "planning", "writing", "reviewing", "ready", "delivered"] as const;
@@ -917,11 +921,7 @@ function reconcile(workspace: string, desk: Desk): Finding[] {
917
921
  continue;
918
922
  }
919
923
  const artifacts = (section.record.artifacts ?? {}) as Json;
920
- for (const uri of [
921
- ...(Array.isArray(artifacts.plans) ? (artifacts.plans as string[]) : []),
922
- ...(Array.isArray(artifacts.reviews) ? (artifacts.reviews as string[]) : []),
923
- ...["context", "research", "summary", "handoff"].map((key) => artifacts[key]).filter((uri): uri is string => typeof uri === "string"),
924
- ]) {
924
+ for (const uri of sectionLinks(section.record)) {
925
925
  const file = artifactFile(workspace, uri, desk.outputFormat);
926
926
  if (file === null || readBytes(workspace, file) === null) add("error", "artifact-dangling", subject, `${uri} is linked but does not resolve to a file.`);
927
927
  }
@@ -1382,6 +1382,56 @@ function prepare(workspace: string, input: RecordWrite, origin: "agent" | "desk"
1382
1382
  }
1383
1383
  }
1384
1384
 
1385
+ /** The artifact URIs a section record links, manuscript aside: the links reconcile resolves. */
1386
+ function sectionLinks(record: Json | null): string[] {
1387
+ const artifacts = isObject(record?.artifacts) ? (record.artifacts as Json) : {};
1388
+ return [
1389
+ ...(Array.isArray(artifacts.plans) ? artifacts.plans : []),
1390
+ ...(Array.isArray(artifacts.reviews) ? artifacts.reviews : []),
1391
+ ...["context", "research", "summary", "handoff"].map((key) => artifacts[key]),
1392
+ ].filter((uri): uri is string => typeof uri === "string");
1393
+ }
1394
+
1395
+ function claimIds(record: Json | null): string[] {
1396
+ return (Array.isArray(record?.claims) ? record.claims : []).map((claim) => (isObject(claim) ? text(claim.id) : "")).filter(Boolean);
1397
+ }
1398
+
1399
+ /**
1400
+ * Why a section write would leave the project failing validation, judged on what
1401
+ * this write adds: a link to an artifact file that does not exist, or a claim id
1402
+ * another claim already holds.
1403
+ */
1404
+ function sectionRefusal(workspace: string, uri: string, prior: Json | null, record: Json): string | null {
1405
+ const linked = new Set(sectionLinks(prior));
1406
+ const missing = sectionLinks(record).filter((link) => {
1407
+ if (linked.has(link)) return false;
1408
+ const file = artifactFile(workspace, link);
1409
+ return file === null || readBytes(workspace, file) === null;
1410
+ });
1411
+ if (missing.length > 0)
1412
+ return `${uri} links ${missing.join(", ")}, which ${missing.length === 1 ? "has" : "have"} no file yet. Write the artifact first or leave the link out until it exists, then send the write again; a missing artifact is not a refusal and does not end the step`;
1413
+ const held = new Set(claimIds(prior));
1414
+ const ids = claimIds(record);
1415
+ const added = ids.filter((id) => !held.has(id));
1416
+ const twice = [...new Set(added.filter((id, index) => added.indexOf(id) !== index))];
1417
+ const owners = new Map<string, string>();
1418
+ const directory = contained(workspace, ".planning/sections");
1419
+ const own = record.id;
1420
+ if (directory !== null && existsSync(directory) && lstatSync(directory).isDirectory())
1421
+ for (const entry of readdirSync(directory, { withFileTypes: true })) {
1422
+ if (!entry.isDirectory() || entry.name === own) continue;
1423
+ for (const id of claimIds(readRecord(workspace, `.planning/sections/${entry.name}/section.json`)))
1424
+ if (added.includes(id) && !owners.has(id)) owners.set(id, entry.name);
1425
+ }
1426
+ const clashes = [
1427
+ ...twice.map((id) => `${id} appears twice in this record`),
1428
+ ...[...owners].map(([id, section]) => `${id} is already a claim of project://sections/${section}`),
1429
+ ];
1430
+ return clashes.length > 0
1431
+ ? `${uri}: ${clashes.join("; ")}. Each claim needs an id no other claim in the project holds; rename the claim and send the write again. A duplicate id is not a refusal and does not end the step`
1432
+ : null;
1433
+ }
1434
+
1385
1435
  function prepareRecord(workspace: string, input: RecordWrite, origin: "agent" | "desk", armed: Armed | null): Prepared {
1386
1436
  const { uri } = input;
1387
1437
  const record = input.record;
@@ -1443,6 +1493,10 @@ function prepareRecord(workspace: string, input: RecordWrite, origin: "agent" |
1443
1493
  const refusal = checkpointRefusal(prior, record, superseded);
1444
1494
  if (refusal) throw new Error(`${uri}: ${refusal}`);
1445
1495
  }
1496
+ if (route.type === "section") {
1497
+ const refusal = sectionRefusal(workspace, uri, prior, record);
1498
+ if (refusal) throw new Error(refusal);
1499
+ }
1446
1500
  const next: Json = { ...record };
1447
1501
  let revision: number | null = null;
1448
1502
  if (REVISIONED.has(route.type)) {
@@ -1952,9 +2006,9 @@ function islands(desk: Desk, running: Record<string, { agentId: string; at: numb
1952
2006
  items: [
1953
2007
  { label: "sources verified", value: String(verified), tone: verified > 0 ? "positive" : "muted" },
1954
2008
  { label: "provisional", value: String(provisional), tone: provisional > 0 ? "warning" : "muted" },
1955
- ...(lost > 0 ? [{ label: "unavailable or retracted", value: String(lost), tone: "error" as ViewTone }] : []),
2009
+ ...(lost > 0 ? [{ label: "sources unusable", value: String(lost), tone: "error" as ViewTone }] : []),
1956
2010
  { label: "evidence items", value: String(desk.evidence) },
1957
- { label: "required claims without support", value: String(unsupported), tone: unsupported > 0 ? "warning" : "positive" },
2011
+ { label: "unsupported claims", value: String(unsupported), tone: unsupported > 0 ? "warning" : "positive" },
1958
2012
  ],
1959
2013
  },
1960
2014
  });
@@ -2109,6 +2163,8 @@ async function revalidate(ctx: ExtensionContextV2, files: string[]): Promise<Vie
2109
2163
  const KEEP = "__keep";
2110
2164
  const RESOLVE = "__resolve";
2111
2165
  const WAIVE = "__waive";
2166
+ /** The pause checkpoint's option that returns a paused project to active (pause-writing step 2). */
2167
+ const RESUME = "resume";
2112
2168
 
2113
2169
  /** What the author was shown, kept until the answer arrives so a changed question cannot take an old answer. */
2114
2170
  interface Asked {
@@ -2223,7 +2279,7 @@ function interactionId(): string {
2223
2279
  return `interaction-${timestamp().replace(/[^0-9]/gu, "")}-${randomBytes(4).toString("hex")}`;
2224
2280
  }
2225
2281
 
2226
- type AnswerResult = { kind: "recorded" | "kept" | "stale" | "refused"; text: string; checkpoint?: string };
2282
+ type AnswerResult = { kind: "recorded" | "kept" | "stale" | "refused"; text: string; author?: string; checkpoint?: string };
2227
2283
 
2228
2284
  /**
2229
2285
  * Records one gate answer. The answer counts only if it names an option the
@@ -2272,6 +2328,7 @@ async function answer(ctx: ExtensionContextV2, stepKey: string, picked: unknown,
2272
2328
  );
2273
2329
  const writes: Array<{ input: RecordWrite }> = [{ input: { uri: `project://interactions/${String(interaction.id)}`, record: interaction } }];
2274
2330
  let linkedIn: string | null = null;
2331
+ let resumed = false;
2275
2332
  if (!stale && picked !== KEEP) {
2276
2333
  const { file: _file, trust: _trust, answer: _answer, ...stored } = checkpoint;
2277
2334
  writes.push({
@@ -2298,14 +2355,22 @@ async function answer(ctx: ExtensionContextV2, stepKey: string, picked: unknown,
2298
2355
  });
2299
2356
  const state = readRecord(workspace, ".planning/state.json");
2300
2357
  const uri = `project://checkpoints/${checkpoint.id}`;
2301
- if (state && Array.isArray(state.active_checkpoint_uris) && state.active_checkpoint_uris.includes(uri))
2358
+ if (state && Array.isArray(state.active_checkpoint_uris) && state.active_checkpoint_uris.includes(uri)) {
2359
+ resumed = option?.id === RESUME && state.status === "paused";
2302
2360
  writes.push({
2303
2361
  input: {
2304
2362
  uri: "project://state",
2305
2363
  expect_revision: typeof state.revision === "number" ? state.revision : 0,
2306
- record: { ...state, active_checkpoint_uris: (state.active_checkpoint_uris as string[]).filter((entry) => entry !== uri) },
2364
+ record: {
2365
+ ...state,
2366
+ active_checkpoint_uris: (state.active_checkpoint_uris as string[]).filter((entry) => entry !== uri),
2367
+ ...(resumed
2368
+ ? { status: "active", last_transition: { from: "paused", to: "active", reason: `The author chose to resume at ${checkpoint.id}.`, at: now } }
2369
+ : {}),
2370
+ },
2307
2371
  },
2308
2372
  });
2373
+ }
2309
2374
  // The author's approval links the plan in the same commit: live, the model asked the desk for its next
2310
2375
  // step before linking, and the approved plan sat unlinked while the driver planned again.
2311
2376
  const planned = option?.id === APPROVE && planGate(checkpoint) ? /^project:\/\/sections\/([^/]+)\/plans\//u.exec(checkpoint.scope_uri)?.[1] : undefined;
@@ -2345,14 +2410,16 @@ async function answer(ctx: ExtensionContextV2, stepKey: string, picked: unknown,
2345
2410
  checkpoint: checkpoint.id,
2346
2411
  };
2347
2412
  if (picked === KEEP) return { kind: "kept", text: `${checkpoint.id}: kept pending`, checkpoint: checkpoint.id };
2413
+ const chosen = `${option ? `${checkpoint.id}: ${shown(checkpoint, option).label}` : `${checkpoint.id}: ${picked === WAIVE ? "waived" : "done"}`}${
2414
+ resumed ? ". The project is active again" : ""
2415
+ }`;
2348
2416
  return {
2349
2417
  kind: "recorded",
2350
- text: `${option ? `${checkpoint.id}: ${shown(checkpoint, option).label}` : `${checkpoint.id}: ${picked === WAIVE ? "waived" : "done"}`}${
2351
- linkedIn ? `. The desk linked ${checkpoint.scope_uri} in ${linkedIn} with this answer; do not link it again` : ""
2352
- }. The desk wrote ${writes
2418
+ text: `${chosen}${linkedIn ? `. The desk linked ${checkpoint.scope_uri} in ${linkedIn} with this answer; do not link it again` : ""}. The desk wrote ${writes
2353
2419
  .slice(1)
2354
2420
  .map((entry) => entry.input.uri)
2355
2421
  .join(", ")}; read any of them again before writing it`,
2422
+ author: chosen,
2356
2423
  checkpoint: checkpoint.id,
2357
2424
  };
2358
2425
  }
@@ -2860,6 +2927,7 @@ function helpCard(served: ServedPlugin): { text: string; card: View } {
2860
2927
  ];
2861
2928
  });
2862
2929
  const local = [...DESK_COMMANDS].map((id) => actionName(served, id));
2930
+ const unavailable = new Set(availability.actions.filter((entry) => entry.status !== "available").map((entry) => entry.id));
2863
2931
  return {
2864
2932
  text: rows.map((row) => `${row[0]} ${row[1]}`).join("\n"),
2865
2933
  card: {
@@ -2869,7 +2937,14 @@ function helpCard(served: ServedPlugin): { text: string; card: View } {
2869
2937
  title: "WTF-P actions",
2870
2938
  meta: `${rows.length}`,
2871
2939
  children: [
2872
- { t: "table", columns: ["action", "what it does"], rows },
2940
+ {
2941
+ t: "kv",
2942
+ items: HELP.groups.map((group) => ({
2943
+ label: group.title,
2944
+ value: group.actions.map((id) => `${actionName(served, id)}${unavailable.has(id) ? " (unavailable)" : ""}`).join(" "),
2945
+ })),
2946
+ },
2947
+ ...(served ? [{ t: "text", wrap: "wrap", tone: "muted", text: "Type /wtfp: in the prompt to see what each action does." } as View] : []),
2873
2948
  {
2874
2949
  t: "text",
2875
2950
  wrap: "wrap",
@@ -2949,9 +3024,17 @@ async function validateAll(ctx: ExtensionContextV2): Promise<ExtensionOutputV2>
2949
3024
  ...(findings.length > 0
2950
3025
  ? [
2951
3026
  {
2952
- t: "table",
2953
- columns: ["severity", "finding", "subject", "detail"],
2954
- rows: findings.slice(0, 40).map((finding) => [finding.severity, finding.code, finding.subject.replace(/^project:\/\//u, ""), finding.message]),
3027
+ t: "list",
3028
+ items: findings.slice(0, 40).map((finding, index) => {
3029
+ const tone: ViewTone = finding.severity === "warning" ? "warning" : finding.severity === "info" ? "muted" : "error";
3030
+ return {
3031
+ key: String(index),
3032
+ mark: tone === "error" ? "✗" : tone === "warning" ? "!" : "·",
3033
+ tone,
3034
+ label: `${finding.severity} ${finding.code} · ${finding.subject.replace(/^project:\/\//u, "")}`,
3035
+ detail: finding.message,
3036
+ };
3037
+ }),
2955
3038
  } as View,
2956
3039
  ]
2957
3040
  : []),
@@ -3760,7 +3843,7 @@ export default function extension(api: ExtensionApiV2): void {
3760
3843
  ...(await picture(ctx)),
3761
3844
  };
3762
3845
  const kept = (await ctx.state.get<string[]>("gate-kept")).value ?? [];
3763
- const recorded = (await ctx.state.get<string[]>("gate-recorded")).value ?? [];
3846
+ const recorded = (await ctx.state.get<Array<{ text: string; author: string }>>("gate-recorded")).value ?? [];
3764
3847
  let note = "";
3765
3848
  try {
3766
3849
  const typed = await freeText(ctx, event);
@@ -3771,7 +3854,7 @@ export default function extension(api: ExtensionApiV2): void {
3771
3854
  if (current && remaining.includes(current)) return { step: await ask(ctx, desk, current, FREE_TEXT), total: remaining.length + recorded.length + kept.length };
3772
3855
  }
3773
3856
  const result = typed ?? (await answer(ctx, event.step, choiceOf(event.answers), noteOf(event)));
3774
- if (result.kind === "recorded") recorded.push(result.text);
3857
+ if (result.kind === "recorded") recorded.push({ text: result.text, author: result.author ?? result.text });
3775
3858
  else if (result.kind === "kept" && result.checkpoint) kept.push(result.checkpoint);
3776
3859
  else if (result.kind === "refused") {
3777
3860
  note = result.text;
@@ -3787,11 +3870,12 @@ export default function extension(api: ExtensionApiV2): void {
3787
3870
  const next = remaining[0];
3788
3871
  if (next && !note.startsWith("Nothing was recorded")) return { step: await ask(ctx, desk, next), total: remaining.length + recorded.length + kept.length };
3789
3872
  await ctx.state.set("gate-recorded", []);
3790
- const summary = [recorded.length > 0 ? `Recorded: ${recorded.join("; ")}.` : "Nothing recorded.", note].filter(Boolean).join(" ");
3873
+ const summary = (pick: "text" | "author"): string =>
3874
+ [recorded.length > 0 ? `Recorded: ${recorded.map((entry) => entry[pick]).join("; ")}.` : "Nothing recorded.", note].filter(Boolean).join(" ");
3791
3875
  return {
3792
3876
  done: true,
3793
- text: summary,
3794
- card: { t: "text", text: `${recorded.length > 0 ? "✓" : "·"} ${summary}`, tone: recorded.length > 0 ? "positive" : "muted", wrap: "wrap" },
3877
+ text: summary("text"),
3878
+ card: { t: "text", text: `${recorded.length > 0 ? "✓" : "·"} ${summary("author")}`, tone: recorded.length > 0 ? "positive" : "muted", wrap: "wrap" },
3795
3879
  ...(await picture(ctx, desk)),
3796
3880
  };
3797
3881
  });
@@ -3890,7 +3974,9 @@ export default function extension(api: ExtensionApiV2): void {
3890
3974
  {
3891
3975
  kind: "notify_operator",
3892
3976
  key: "wtfp-guard",
3893
- message: `WTF-P write guard armed for ${actionName(ctx.snapshot.plugin ?? null, armed.action)}${armed.section ? ` ${armed.section}` : ""}: files stay under ${roots.join(", ") || "nothing"}, records under what it declares.`,
3977
+ message: `WTF-P write guard armed for ${actionName(ctx.snapshot.plugin ?? null, armed.action)}${armed.section ? ` ${armed.section}` : ""}: ${
3978
+ roots.length > 0 ? `files stay under ${roots.join(", ")}` : "it writes no files"
3979
+ }, and records only the ones its contract declares.`,
3894
3980
  },
3895
3981
  ],
3896
3982
  };