@holmes-lab/holmes-kit 0.1.18 → 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 (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/.build-id +1 -1
  3. package/dist/holmes/cli/approve-context.d.ts +2 -0
  4. package/dist/holmes/cli/approve-context.js +180 -0
  5. package/dist/holmes/cli/approve-ref.d.ts +27 -0
  6. package/dist/holmes/cli/approve-ref.js +40 -0
  7. package/dist/holmes/cli/approve-watch.d.ts +29 -0
  8. package/dist/holmes/cli/approve-watch.js +94 -0
  9. package/dist/holmes/cli/approve.d.ts +50 -13
  10. package/dist/holmes/cli/approve.js +354 -38
  11. package/dist/holmes/cli/doctor.js +182 -0
  12. package/dist/holmes/cli/gitignore-merge.d.ts +4 -0
  13. package/dist/holmes/cli/gitignore-merge.js +17 -1
  14. package/dist/holmes/cli/index.d.ts +23 -0
  15. package/dist/holmes/cli/index.js +487 -20
  16. package/dist/holmes/cli/init.js +14 -0
  17. package/dist/holmes/cli/screen-safe.d.ts +94 -0
  18. package/dist/holmes/cli/screen-safe.js +760 -0
  19. package/dist/holmes/governance/approval-queue.js +56 -4
  20. package/dist/holmes/governance/ledger-rechain.d.ts +25 -0
  21. package/dist/holmes/governance/ledger-rechain.js +95 -0
  22. package/dist/holmes/governance/provenance-chain.d.ts +33 -6
  23. package/dist/holmes/governance/provenance-chain.js +91 -16
  24. package/dist/holmes/governance/provenance-ledger.d.ts +7 -0
  25. package/dist/holmes/governance/provenance-ledger.js +10 -0
  26. package/dist/holmes/guardrail/risk-gate.d.ts +11 -1
  27. package/dist/holmes/guardrail/risk-gate.js +10 -0
  28. package/dist/holmes/mcp/elicit-approval.d.ts +67 -0
  29. package/dist/holmes/mcp/elicit-approval.js +79 -0
  30. package/dist/holmes/mcp/handlers.d.ts +7 -2
  31. package/dist/holmes/mcp/handlers.js +190 -24
  32. package/dist/holmes/mcp/server.js +26 -1
  33. package/dist/holmes/spec/id-collision.d.ts +39 -0
  34. package/dist/holmes/spec/id-collision.js +86 -0
  35. package/dist/holmes/spec/spec-store.js +9 -1
  36. package/package.json +1 -1
@@ -0,0 +1,94 @@
1
+ /**
2
+ * One terminal row's worth of SUBJECT, with the template's own cells already subtracted: an 80
3
+ * column row, minus the widest template prefix on this screen (`\u2713 \uc2b9\uc778 \u2014 `, nine columns)
4
+ * and the kind cell (16) and its space, leaves 52. Every line the decision surface prints is bounded by it, so a queue of any size stays a
5
+ * screen the operator can read top to bottom — the property the batch confirmation depends on
6
+ * (round-5: the field was bounded and the LINE was not, so a bounded field still wrapped).
7
+ */
8
+ /** The terminal this screen promises to fit. The floor no terminal goes below. */
9
+ export declare const ROW_MAX = 80;
10
+ export declare const ROW_COLS = 50;
11
+ /**
12
+ * The `kind` cell. Round-7: at 16 the truncation NOTICE (`… (200자 잘림)`, fifteen columns) consumed
13
+ * the entire budget, so a non-ASCII kind rendered ZERO columns of the operator's text — the category
14
+ * of authority being granted, unreadable, in the list AND the item header AND the confirmation AND
15
+ * every decision echo. That is the round-5 lesson ("a bound met by showing nothing is the
16
+ * concealment this module exists to prevent") reached through a budget nobody re-checked. Twenty
17
+ * columns plus the short notice form below leaves real text on the line.
18
+ */
19
+ export declare const KIND_COLS = 20;
20
+ /**
21
+ * Did rendering this value into `max` columns hide any of it?
22
+ *
23
+ * Round-8: this used to be a REGEX OVER THE RENDERED TEXT, and the data can end with any string it
24
+ * likes — a target ending `… (5자 잘림)` was reported as clipped when nothing had been clipped, so
25
+ * `[A]` refused to batch it and told the operator, falsely, that it did not fit on a row. An agent
26
+ * could disable batch approval for a whole session by choosing its own suffix. The renderer knows
27
+ * the answer; nobody should have to parse it back out of the output.
28
+ */
29
+ export declare function isClipped(value: string, max?: number): boolean;
30
+ /**
31
+ * How many terminal COLUMNS a string occupies. Round-5 measured why a code-point budget is not a
32
+ * screen budget: a 200-code-point line of markers rendered 302 columns — four wrapped rows at 80 —
33
+ * because `⟪`, `⟫` and every Hangul character in `자 제거` are East Asian WIDE (two columns each).
34
+ * The budget exists to bound SCREEN SPACE, so it must be counted in the unit the screen uses.
35
+ */
36
+ export declare function displayWidth(s: string): number;
37
+ /**
38
+ * One line, no control bytes, bounded in terminal COLUMNS — for a field the template puts on a line
39
+ * of its own. `max` is a column budget, not a character count (round-5): the caller is buying screen
40
+ * space, and on this screen a character can cost one column or two.
41
+ *
42
+ * The budget is spent on the OPERATOR'S text: the source is clipped first so escape spam cannot
43
+ * evict the real command (round-3), and the sanitised result is clipped again so markers cannot
44
+ * inflate the output (round-4). The truncation notice is appended AFTER sanitising, so no sequence
45
+ * sitting at the clip boundary can swallow it (round-4).
46
+ */
47
+ export declare function flattenField(s: string, max?: number): string;
48
+ /**
49
+ * @implements A-SPEC-262.1 §13
50
+ * The form agent-controlled text takes on a DECISION ROW: only characters whose width is fixed by
51
+ * the standard, everything else as an ASCII escape.
52
+ *
53
+ * Eight adversarial rounds found the same shape of defect eight times — a character whose width the
54
+ * code guessed (Ambiguous, combining, zero-width), or whose cursor effect it did not model (TAB,
55
+ * ESC), or whose position let the data choose a line boundary (alignment, folding). None of them can
56
+ * occur here, because none of those characters survive to the row: a control byte is not stripped
57
+ * and counted, it is SHOWN as `\u001b`. Nothing is removed, so nothing is hidden — which also
58
+ * retires the removal marker, its forgery guard and its size accounting from this path entirely.
59
+ *
60
+ * What passes through: printable ASCII (one column each) and East_Asian_Width W or F (two columns
61
+ * each, fixed by the standard). Korean and CJK commands therefore stay readable on the screen the
62
+ * operator decides from — the requirement that made this a hybrid rather than a full escaping.
63
+ * A backslash is doubled first, so data can never spell an escape the renderer did not write.
64
+ */
65
+ export declare function rowLiteral(s: string): string;
66
+ /**
67
+ * @implements A-SPEC-262.1 §13
68
+ * A decision row's field: the row literal, cut to `max` columns, with what it could not show stated.
69
+ */
70
+ export declare function rowField(value: string, max?: number): string;
71
+ export declare function wrapColumns(s: string, cols?: number, indent?: string): string;
72
+ export declare function stripControl(s: string): string;
73
+ /**
74
+ * Clip on a CODE POINT boundary. Round-1: slicing UTF-16 units cut a surrogate pair in half and the
75
+ * last visible character of a clipped command rendered as a replacement glyph — on a screen whose
76
+ * whole job is showing the subject verbatim.
77
+ */
78
+ export declare function clipCodePoints(s: string, max: number): string;
79
+ /**
80
+ * Quote a value that is about to appear inside a COPY-PASTEABLE command line.
81
+ *
82
+ * Round-2: the non-TTY hint (A-SPEC-260) fills the real queue id into three `holmes-kit approve …`
83
+ * lines whose whole purpose is being pasted into a shell — and the id is agent-controlled. Flattening
84
+ * stops it forging lines, but a flattened `… | sh` still PIPES when pasted. POSIX single quotes make
85
+ * any byte inert; a literal quote is closed, escaped and reopened.
86
+ */
87
+ export declare function shellQuote(s: string): string;
88
+ /**
89
+ * A reference for a pasteable command line: left ALONE when it is already inert (the shape a real
90
+ * queue id has), quoted only when it is not. Round-2 wanted every pasted byte harmless; quoting
91
+ * unconditionally would also have rewritten the A-SPEC-260 hint that ships today, so the blast
92
+ * radius is kept to the case that needs it — a normal session's screen is byte-for-byte unchanged.
93
+ */
94
+ export declare function safeRef(s: string): string;