vouchington-tooling 0.44.0 → 0.46.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 (124) hide show
  1. package/README.md +10 -52
  2. package/dist/agent-blackboard/client.d.mts +6 -0
  3. package/dist/agent-blackboard/feedback-audit-source.d.mts +4 -10
  4. package/dist/agent-blackboard/feedback-audit-source.mjs +7 -18
  5. package/dist/agent-blackboard/feedback-compose-audit.mjs +6 -14
  6. package/dist/agent-blackboard/feedback-compose.d.mts +1 -4
  7. package/dist/agent-blackboard/feedback-compose.mjs +2 -5
  8. package/dist/agent-blackboard/feedback-fields.mjs +1 -1
  9. package/dist/agent-blackboard/feedback-identity.mjs +1 -1
  10. package/dist/agent-blackboard/feedback-journal-audit.d.mts +6 -8
  11. package/dist/agent-blackboard/feedback-journal-audit.mjs +9 -10
  12. package/dist/agent-blackboard/feedback-journal-sandbox.d.mts +2 -2
  13. package/dist/agent-blackboard/feedback-journal-sandbox.mjs +2 -2
  14. package/dist/agent-blackboard/feedback-outbox-rejected.mjs +1 -1
  15. package/dist/agent-blackboard/feedback-outbox.mjs +2 -2
  16. package/dist/agent-blackboard/index.d.mts +1 -1
  17. package/dist/audit-journal/ci-failures.d.mts +6 -0
  18. package/dist/{session-friction → audit-journal}/ci-failures.mjs +3 -9
  19. package/dist/{session-friction → audit-journal}/journal.d.mts +0 -1
  20. package/dist/{session-friction → audit-journal}/journal.mjs +1 -1
  21. package/dist/audit-journal/session-id.d.mts +1 -0
  22. package/dist/{session-friction → audit-journal}/session-id.mjs +0 -5
  23. package/dist/{session-friction → audit-journal}/text.d.mts +1 -4
  24. package/dist/{session-friction → audit-journal}/text.mjs +4 -22
  25. package/dist/audit-journal/types.d.mts +17 -0
  26. package/dist/cli/commands/gha-runtime-audit.mjs +2 -0
  27. package/dist/cli/usage.d.mts +1 -1
  28. package/dist/cli/usage.mjs +1 -1
  29. package/dist/gh-cli/env.d.mts +9 -0
  30. package/dist/gh-cli/env.mjs +12 -0
  31. package/dist/gh-cli/exec.d.mts +7 -4
  32. package/dist/gh-cli/exec.mjs +7 -5
  33. package/dist/gh-cli/index.d.mts +1 -0
  34. package/dist/gh-cli/index.mjs +1 -0
  35. package/dist/gha-post-review/github.mjs +2 -1
  36. package/dist/index.d.mts +3 -3
  37. package/dist/index.mjs +2 -2
  38. package/dist/mcp-server/context.d.mts +5 -0
  39. package/dist/mcp-server/dispatch.d.mts +5 -0
  40. package/dist/mcp-server/dispatch.mjs +8 -1
  41. package/dist/mcp-server/fake-blackboard.test-helpers.d.mts +2 -0
  42. package/dist/mcp-server/fake-blackboard.test-helpers.mjs +3 -0
  43. package/dist/mcp-server/handlers-pr.d.mts +1 -1
  44. package/dist/mcp-server/handlers-pr.mjs +6 -97
  45. package/dist/mcp-server/handlers-retrospective-save.d.mts +10 -0
  46. package/dist/mcp-server/handlers-retrospective-save.mjs +138 -0
  47. package/dist/mcp-server/handlers-retrospective.d.mts +1 -12
  48. package/dist/mcp-server/handlers-retrospective.mjs +1 -154
  49. package/dist/mcp-server/handlers-session.mjs +25 -6
  50. package/dist/mcp-server/handlers-snapshot-cleanup.d.mts +7 -0
  51. package/dist/mcp-server/handlers-snapshot-cleanup.mjs +36 -0
  52. package/dist/mcp-server/harness.test-helpers.d.mts +3 -0
  53. package/dist/mcp-server/harness.test-helpers.mjs +2 -0
  54. package/dist/mcp-server/policy-run.d.mts +1 -0
  55. package/dist/mcp-server/policy-run.mjs +1 -0
  56. package/dist/mcp-server/pr-agent.d.mts +12 -0
  57. package/dist/mcp-server/pr-agent.mjs +34 -0
  58. package/dist/mcp-server/pr-body.d.mts +6 -2
  59. package/dist/mcp-server/pr-body.mjs +16 -5
  60. package/dist/mcp-server/pr-defaults.d.mts +3 -0
  61. package/dist/mcp-server/pr-defaults.mjs +7 -2
  62. package/dist/mcp-server/pr-gh.mjs +2 -1
  63. package/dist/mcp-server/pr-input.d.mts +14 -6
  64. package/dist/mcp-server/pr-input.mjs +22 -5
  65. package/dist/mcp-server/pr-live.d.mts +4 -1
  66. package/dist/mcp-server/pr-live.mjs +8 -3
  67. package/dist/mcp-server/pr-mode.d.mts +7 -0
  68. package/dist/mcp-server/pr-mode.mjs +34 -0
  69. package/dist/mcp-server/pr-no-source.d.mts +9 -0
  70. package/dist/mcp-server/pr-no-source.mjs +22 -0
  71. package/dist/mcp-server/pr-prepare.d.mts +25 -0
  72. package/dist/mcp-server/pr-prepare.mjs +124 -0
  73. package/dist/mcp-server/preview-registry.d.mts +25 -0
  74. package/dist/mcp-server/preview-registry.mjs +38 -0
  75. package/dist/mcp-server/retrospective-check.d.mts +3 -0
  76. package/dist/mcp-server/retrospective-check.mjs +38 -0
  77. package/dist/mcp-server/retrospective-input.mjs +2 -2
  78. package/dist/mcp-server/retrospective-preview.d.mts +17 -0
  79. package/dist/mcp-server/retrospective-preview.mjs +60 -0
  80. package/dist/mcp-server/server.mjs +1 -0
  81. package/dist/mcp-server/snapshot-registry.d.mts +25 -0
  82. package/dist/mcp-server/snapshot-registry.mjs +32 -0
  83. package/dist/mcp-server/tools-pr.mjs +28 -16
  84. package/dist/mcp-server/tools-retrospective.mjs +25 -5
  85. package/dist/mcp-server/tools.mjs +6 -0
  86. package/dist/{session-friction → private-files}/lock.mjs +3 -2
  87. package/dist/private-files/log-file.d.mts +3 -0
  88. package/dist/private-files/log-file.mjs +53 -0
  89. package/dist/{session-friction → private-files}/utf8.mjs +1 -1
  90. package/dist/retrospective-facts/exec.mjs +2 -1
  91. package/docs/mcp-server.md +112 -26
  92. package/package.json +3 -8
  93. package/skills/retrospective/SKILL.md +3 -1
  94. package/skills/retrospective-distill/SKILL.md +5 -0
  95. package/dist/session-friction/ci-failures.d.mts +0 -13
  96. package/dist/session-friction/classify.d.mts +0 -2
  97. package/dist/session-friction/classify.mjs +0 -98
  98. package/dist/session-friction/command-segments.d.mts +0 -3
  99. package/dist/session-friction/command-segments.mjs +0 -94
  100. package/dist/session-friction/coverage-ledger.d.mts +0 -10
  101. package/dist/session-friction/coverage-ledger.mjs +0 -75
  102. package/dist/session-friction/directory.d.mts +0 -1
  103. package/dist/session-friction/directory.mjs +0 -71
  104. package/dist/session-friction/index.d.mts +0 -6
  105. package/dist/session-friction/index.mjs +0 -5
  106. package/dist/session-friction/log-file.d.mts +0 -7
  107. package/dist/session-friction/log-file.mjs +0 -95
  108. package/dist/session-friction/log.d.mts +0 -8
  109. package/dist/session-friction/log.mjs +0 -163
  110. package/dist/session-friction/normalize.d.mts +0 -1
  111. package/dist/session-friction/normalize.mjs +0 -81
  112. package/dist/session-friction/report.d.mts +0 -16
  113. package/dist/session-friction/report.mjs +0 -91
  114. package/dist/session-friction/sandbox.d.mts +0 -3
  115. package/dist/session-friction/sandbox.mjs +0 -43
  116. package/dist/session-friction/session-id.d.mts +0 -2
  117. package/dist/session-friction/types.d.mts +0 -80
  118. /package/dist/{session-friction → audit-journal}/audit-block.d.mts +0 -0
  119. /package/dist/{session-friction → audit-journal}/audit-block.mjs +0 -0
  120. /package/dist/{session-friction → audit-journal}/audit-fit.d.mts +0 -0
  121. /package/dist/{session-friction → audit-journal}/audit-fit.mjs +0 -0
  122. /package/dist/{session-friction → audit-journal}/types.mjs +0 -0
  123. /package/dist/{session-friction → private-files}/lock.d.mts +0 -0
  124. /package/dist/{session-friction → private-files}/utf8.d.mts +0 -0
@@ -1,43 +0,0 @@
1
- import { byteLength, fitFields, selectWithin } from "./audit-fit.mjs";
2
- import { markdownAuditUnits } from "./text.mjs";
3
- const SANDBOX_SECTION_HEADER = '## Sandbox & Permission Audit';
4
- const SANDBOX_SECTION_MAX_BYTES = 3_000;
5
- // Room for the `- kind (n)` group lines, which are rendered outside the per-event budget.
6
- const GROUP_LINES_BYTES = 120;
7
- // Below this an event line would keep little beyond its timestamp, so it is omitted and counted.
8
- const MIN_EVENT_SHARE_BYTES = 120;
9
- // Event line fields: command prefix, detail, timestamp. Cut detail first, the timestamp never.
10
- const SHRINK_ORDER = [1, 0];
11
- const KIND_ORDER = [
12
- 'sandbox-escalation',
13
- 'sandbox-failure',
14
- 'ambiguous-failure',
15
- ];
16
- /** Reports dropped events as a group in the same shape as the rest, so omission is never silent. */
17
- function omissionGroup(count) {
18
- return `- omitted (${count})\n - see journal — ${count} events omitted to fit the size limit — n/a`;
19
- }
20
- export function buildSandboxSection(events, redact, maxBytes = SANDBOX_SECTION_MAX_BYTES) {
21
- const observations = events.flatMap((event) => event.failure
22
- ? [event, { ...event, kind: event.failure.kind, detail: event.failure.detail }]
23
- : [event]);
24
- const render = (event, budgetBytes) => {
25
- const outcome = event.kind === 'sandbox-escalation' ? ` — outcome: ${event.outcome ?? 'unknown'}` : '';
26
- const [prefix, detail, timestamp] = fitFields([event.commandPrefix, event.detail, event.timestamp].map((field) => markdownAuditUnits(field, redact)), byteLength(` - — — ${outcome}`), budgetBytes, SHRINK_ORDER);
27
- return ` - ${prefix} — ${detail} — ${timestamp}${outcome}`;
28
- };
29
- const total = Math.max(0, Math.min(maxBytes, SANDBOX_SECTION_MAX_BYTES) - GROUP_LINES_BYTES);
30
- const { rendered, omitted } = selectWithin(observations, total, byteLength(omissionGroup(observations.length)) + 1, 1, MIN_EVENT_SHARE_BYTES, render);
31
- const kept = observations
32
- .slice(0, rendered.length)
33
- .map((event, i) => ({ event, line: rendered[i] }));
34
- const groups = KIND_ORDER.map((kind) => {
35
- const selected = kept.filter(({ event }) => event.kind === kind);
36
- return selected.length
37
- ? [`- ${kind} (${selected.length})`, ...selected.map(({ line }) => line)].join('\n')
38
- : undefined;
39
- }).filter((group) => group !== undefined);
40
- if (omitted)
41
- groups.push(omissionGroup(omitted));
42
- return `${SANDBOX_SECTION_HEADER}\nEvents observed: ${observations.length}\n\n${groups.join('\n')}`;
43
- }
@@ -1,2 +0,0 @@
1
- export declare function validateSessionId(sessionId: string): void;
2
- export declare function sanitizeSessionId(sessionId: string): string;
@@ -1,80 +0,0 @@
1
- export type FrictionEventKind = 'sandbox-escalation' | 'sandbox-failure' | 'ambiguous-failure';
2
- export type FrictionEvent = {
3
- kind: FrictionEventKind;
4
- timestamp: string;
5
- commandPrefix: string;
6
- detail: string;
7
- outcome?: 'requested' | 'approved' | 'denied' | 'unknown';
8
- failure?: {
9
- kind: 'sandbox-failure' | 'ambiguous-failure';
10
- detail: string;
11
- };
12
- };
13
- export type ToolResultObservation = {
14
- type: 'tool-result';
15
- command: string;
16
- commandWrappers?: string[];
17
- permissionOutcome?: 'approved' | 'denied';
18
- escalationDetail?: string;
19
- structuredStderr?: string;
20
- };
21
- export type PermissionRequestObservation = {
22
- type: 'permission-request';
23
- command: string;
24
- commandWrappers?: string[];
25
- };
26
- export type FrictionObservation = ToolResultObservation | PermissionRequestObservation;
27
- type FrictionLogCoverage = {
28
- truncated: true;
29
- droppedCount: number;
30
- } | {
31
- truncated?: false;
32
- droppedCount?: never;
33
- };
34
- export type FrictionLogReadResult = {
35
- status: 'absent';
36
- } | ({
37
- status: 'empty';
38
- } & FrictionLogCoverage) | ({
39
- status: 'events';
40
- events: FrictionEvent[];
41
- } & FrictionLogCoverage);
42
- export type FrictionLogOptions = {
43
- directory: string;
44
- maxEvents?: number;
45
- };
46
- export type JournalEntry = {
47
- data?: {
48
- type?: unknown;
49
- markdown?: unknown;
50
- };
51
- };
52
- export type JournalLoadResult = {
53
- status: 'ok';
54
- entries: Iterable<JournalEntry> | AsyncIterable<JournalEntry>;
55
- } | {
56
- status: 'not-found';
57
- };
58
- export type JournalLoader = (sessionId: string) => JournalLoadResult | Promise<JournalLoadResult>;
59
- export type SessionFrictionCoverage = {
60
- journalStatus: 'complete' | 'partial' | 'unavailable';
61
- frictionStatus: 'absent' | 'empty' | 'events' | 'unreadable';
62
- truncated: boolean;
63
- droppedCount?: number;
64
- };
65
- export type SessionFrictionReport = {
66
- coverage: SessionFrictionCoverage;
67
- markdown: string;
68
- diagnostic?: string;
69
- };
70
- export type SessionFrictionReportOptions = FrictionLogOptions & {
71
- journalLoader: JournalLoader;
72
- /** Redacts raw field text before Markdown escaping, which would otherwise break matching. */
73
- redact?: (value: string) => string;
74
- /** Byte allowances for the CI and sandbox sections, as maximums over the built-in budgets. */
75
- budgets?: {
76
- ciBytes: number;
77
- sandboxBytes: number;
78
- };
79
- };
80
- export {};