approval-md 0.4.0 → 0.4.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.
Files changed (190) hide show
  1. package/SPEC.md +11 -0
  2. package/cli.js +72 -4
  3. package/dist/src/channels/contract.d.ts +53 -0
  4. package/dist/src/channels/contract.js +56 -0
  5. package/dist/src/channels/contract.js.map +1 -1
  6. package/dist/src/channels/tagging.d.ts +25 -0
  7. package/dist/src/channels/tagging.js +57 -5
  8. package/dist/src/channels/tagging.js.map +1 -1
  9. package/dist/src/channels/telegram-minimal.d.ts +251 -0
  10. package/dist/src/channels/telegram-minimal.js +618 -0
  11. package/dist/src/channels/telegram-minimal.js.map +1 -0
  12. package/dist/src/channels/telegram.d.ts +454 -19
  13. package/dist/src/channels/telegram.js +931 -80
  14. package/dist/src/channels/telegram.js.map +1 -1
  15. package/dist/src/cli/amend.js +8 -1
  16. package/dist/src/cli/amend.js.map +1 -1
  17. package/dist/src/cli/attest.js +2 -1
  18. package/dist/src/cli/attest.js.map +1 -1
  19. package/dist/src/cli/audit-card.d.ts +1 -1
  20. package/dist/src/cli/audit-card.js +40 -1
  21. package/dist/src/cli/audit-card.js.map +1 -1
  22. package/dist/src/cli/audit.d.ts +7 -5
  23. package/dist/src/cli/audit.js +25 -12
  24. package/dist/src/cli/audit.js.map +1 -1
  25. package/dist/src/cli/channel-telegram-webhook.d.ts +2 -0
  26. package/dist/src/cli/channel-telegram-webhook.js +7 -0
  27. package/dist/src/cli/channel-telegram-webhook.js.map +1 -1
  28. package/dist/src/cli/channel-telegram.d.ts +75 -2
  29. package/dist/src/cli/channel-telegram.js +172 -16
  30. package/dist/src/cli/channel-telegram.js.map +1 -1
  31. package/dist/src/cli/channel-web.js +2 -1
  32. package/dist/src/cli/channel-web.js.map +1 -1
  33. package/dist/src/cli/channel.js +2 -1
  34. package/dist/src/cli/channel.js.map +1 -1
  35. package/dist/src/cli/doctor.js +1 -1
  36. package/dist/src/cli/doctor.js.map +1 -1
  37. package/dist/src/cli/execute.d.ts +12 -0
  38. package/dist/src/cli/execute.js +50 -4
  39. package/dist/src/cli/execute.js.map +1 -1
  40. package/dist/src/cli/gate.js +2 -1
  41. package/dist/src/cli/gate.js.map +1 -1
  42. package/dist/src/cli/help.d.ts +1 -0
  43. package/dist/src/cli/help.js +39 -18
  44. package/dist/src/cli/help.js.map +1 -1
  45. package/dist/src/cli/hook.d.ts +121 -3
  46. package/dist/src/cli/hook.js +719 -79
  47. package/dist/src/cli/hook.js.map +1 -1
  48. package/dist/src/cli/log-checkpoint.js +2 -1
  49. package/dist/src/cli/log-checkpoint.js.map +1 -1
  50. package/dist/src/cli/log-unlock.d.ts +23 -0
  51. package/dist/src/cli/log-unlock.js +110 -0
  52. package/dist/src/cli/log-unlock.js.map +1 -0
  53. package/dist/src/cli/main.js +23 -6
  54. package/dist/src/cli/main.js.map +1 -1
  55. package/dist/src/cli/setup-common.js +2 -1
  56. package/dist/src/cli/setup-common.js.map +1 -1
  57. package/dist/src/cli/up.js +5 -0
  58. package/dist/src/cli/up.js.map +1 -1
  59. package/dist/src/cli/vault.js +2 -1
  60. package/dist/src/cli/vault.js.map +1 -1
  61. package/dist/src/cli/verb-registry.js +1 -0
  62. package/dist/src/cli/verb-registry.js.map +1 -1
  63. package/dist/src/cli/wordmark.d.ts +2 -2
  64. package/dist/src/cli/wordmark.js +2 -2
  65. package/dist/src/core/attest-bootstrap.js +2 -1
  66. package/dist/src/core/attest-bootstrap.js.map +1 -1
  67. package/dist/src/core/attest.js +5 -4
  68. package/dist/src/core/attest.js.map +1 -1
  69. package/dist/src/core/audit.d.ts +113 -9
  70. package/dist/src/core/audit.js +382 -18
  71. package/dist/src/core/audit.js.map +1 -1
  72. package/dist/src/core/budgets.d.ts +12 -0
  73. package/dist/src/core/budgets.js +54 -1
  74. package/dist/src/core/budgets.js.map +1 -1
  75. package/dist/src/core/checkpoint.js +3 -2
  76. package/dist/src/core/checkpoint.js.map +1 -1
  77. package/dist/src/core/command-class.js +6 -0
  78. package/dist/src/core/command-class.js.map +1 -1
  79. package/dist/src/core/decision-refusal.js +2 -1
  80. package/dist/src/core/decision-refusal.js.map +1 -1
  81. package/dist/src/core/delegation.d.ts +109 -0
  82. package/dist/src/core/delegation.js +244 -0
  83. package/dist/src/core/delegation.js.map +1 -0
  84. package/dist/src/core/execute.js +12 -3
  85. package/dist/src/core/execute.js.map +1 -1
  86. package/dist/src/core/gate-window.js +4 -3
  87. package/dist/src/core/gate-window.js.map +1 -1
  88. package/dist/src/core/gate.d.ts +84 -43
  89. package/dist/src/core/gate.js +114 -6
  90. package/dist/src/core/gate.js.map +1 -1
  91. package/dist/src/core/gesture-refusal.js +2 -1
  92. package/dist/src/core/gesture-refusal.js.map +1 -1
  93. package/dist/src/core/identity.d.ts +105 -0
  94. package/dist/src/core/identity.js +122 -0
  95. package/dist/src/core/identity.js.map +1 -0
  96. package/dist/src/core/log-lock.d.ts +435 -0
  97. package/dist/src/core/log-lock.js +1093 -0
  98. package/dist/src/core/log-lock.js.map +1 -0
  99. package/dist/src/core/log.d.ts +82 -3
  100. package/dist/src/core/log.js +285 -40
  101. package/dist/src/core/log.js.map +1 -1
  102. package/dist/src/core/loop.d.ts +11 -0
  103. package/dist/src/core/loop.js +63 -4
  104. package/dist/src/core/loop.js.map +1 -1
  105. package/dist/src/core/policy-diff.js +20 -1
  106. package/dist/src/core/policy-diff.js.map +1 -1
  107. package/dist/src/core/policy-explain.js +18 -2
  108. package/dist/src/core/policy-explain.js.map +1 -1
  109. package/dist/src/core/policy-load.d.ts +38 -1
  110. package/dist/src/core/policy-load.js +34 -2
  111. package/dist/src/core/policy-load.js.map +1 -1
  112. package/dist/src/core/policy-match.js +30 -5
  113. package/dist/src/core/policy-match.js.map +1 -1
  114. package/dist/src/core/policy-proposal.d.ts +17 -0
  115. package/dist/src/core/policy-proposal.js +32 -16
  116. package/dist/src/core/policy-proposal.js.map +1 -1
  117. package/dist/src/core/prompt-layout.d.ts +186 -1
  118. package/dist/src/core/prompt-layout.js +345 -3
  119. package/dist/src/core/prompt-layout.js.map +1 -1
  120. package/dist/src/core/sender-identity.d.ts +24 -1
  121. package/dist/src/core/sender-identity.js +31 -0
  122. package/dist/src/core/sender-identity.js.map +1 -1
  123. package/dist/src/core/token.js +11 -0
  124. package/dist/src/core/token.js.map +1 -1
  125. package/dist/src/core/tool-map.d.ts +125 -0
  126. package/dist/src/core/tool-map.js +179 -0
  127. package/dist/src/core/tool-map.js.map +1 -0
  128. package/dist/src/core/validate.d.ts +20 -6
  129. package/dist/src/core/validate.js +0 -0
  130. package/dist/src/core/validate.js.map +1 -1
  131. package/dist/src/daemon/git-evidence.d.ts +2 -2
  132. package/dist/src/daemon/git-evidence.js +1 -1
  133. package/dist/src/serve/archive.d.ts +8 -0
  134. package/dist/src/serve/archive.js +11 -2
  135. package/dist/src/serve/archive.js.map +1 -1
  136. package/docs/README-extended.md +15 -0
  137. package/docs/cli-reference.md +571 -28
  138. package/package.json +2 -2
  139. package/schema/event.schema.json +387 -29
  140. package/schema/fixtures/event/invalid/audit-lock-reclaimed-age-without-created.json +19 -0
  141. package/schema/fixtures/event/invalid/audit-lock-reclaimed-agent-actor.json +14 -0
  142. package/schema/fixtures/event/invalid/audit-lock-reclaimed-lockfile-path.json +14 -0
  143. package/schema/fixtures/event/invalid/audit-lock-reclaimed-operator-cleared-system-actor.json +14 -0
  144. package/schema/fixtures/event/invalid/audit-lock-reclaimed-unknown-reason.json +14 -0
  145. package/schema/fixtures/event/invalid/audit-lock-reclaimed-without-age.json +13 -0
  146. package/schema/fixtures/event/invalid/audit-reviewed-agent-actor.json +6 -1
  147. package/schema/fixtures/event/invalid/audit-reviewed-bad-payload-hash.json +21 -0
  148. package/schema/fixtures/event/invalid/audit-reviewed-loved-no-note.json +5 -0
  149. package/schema/fixtures/event/invalid/audit-reviewed-model-actor.json +20 -0
  150. package/schema/fixtures/event/invalid/audit-reviewed-no-subject-hash.json +19 -0
  151. package/schema/fixtures/event/invalid/audit-reviewed-no-subject-seq.json +19 -0
  152. package/schema/fixtures/event/invalid/audit-reviewed-no-verdict-source.json +19 -0
  153. package/schema/fixtures/event/invalid/audit-reviewed-no-verdict.json +19 -0
  154. package/schema/fixtures/event/invalid/audit-reviewed-system-actor.json +6 -1
  155. package/schema/fixtures/event/invalid/audit-reviewed-verdict-source-model.json +20 -0
  156. package/schema/fixtures/event/invalid/audit-sampled-no-policy-hash.json +14 -0
  157. package/schema/fixtures/event/invalid/execution-started-harness-tool-space.json +18 -0
  158. package/schema/fixtures/event/valid/audit-lock-reclaimed-implausible-created.json +18 -0
  159. package/schema/fixtures/event/valid/audit-lock-reclaimed-legacy.json +14 -0
  160. package/schema/fixtures/event/valid/audit-lock-reclaimed-unlock.json +19 -0
  161. package/schema/fixtures/event/valid/audit-lock-reclaimed.json +19 -0
  162. package/schema/fixtures/event/valid/audit-reviewed-reaction.json +5 -0
  163. package/schema/fixtures/event/valid/audit-reviewed.json +6 -1
  164. package/schema/fixtures/event/valid/audit-sampled.json +2 -1
  165. package/schema/fixtures/event/valid/daemon-identity.json +2 -1
  166. package/schema/fixtures/event/valid/execution-started-harness-tool.json +19 -0
  167. package/schema/fixtures/policy/invalid/delegation-advice-string.json +15 -0
  168. package/schema/fixtures/policy/invalid/delegation-class-duplicate.json +18 -0
  169. package/schema/fixtures/policy/invalid/delegation-class-wildcard.json +17 -0
  170. package/schema/fixtures/policy/invalid/delegation-daily-cap-fractional.json +15 -0
  171. package/schema/fixtures/policy/invalid/delegation-daily-cap-negative.json +15 -0
  172. package/schema/fixtures/policy/invalid/delegation-daily-cap-too-high.json +15 -0
  173. package/schema/fixtures/policy/invalid/delegation-escalate-duplicate.json +18 -0
  174. package/schema/fixtures/policy/invalid/delegation-escalate-unknown.json +17 -0
  175. package/schema/fixtures/policy/invalid/delegation-max-autonomy-alias.json +15 -0
  176. package/schema/fixtures/policy/invalid/delegation-max-autonomy-autonomous.json +15 -0
  177. package/schema/fixtures/policy/invalid/delegation-model-no-version.json +15 -0
  178. package/schema/fixtures/policy/invalid/delegation-model-provider-form.json +15 -0
  179. package/schema/fixtures/policy/invalid/delegation-null.json +7 -0
  180. package/schema/fixtures/policy/invalid/delegation-reviewer-agent.json +17 -0
  181. package/schema/fixtures/policy/invalid/delegation-reviewer-bare-id.json +17 -0
  182. package/schema/fixtures/policy/invalid/delegation-unknown-key.json +16 -0
  183. package/schema/fixtures/policy/invalid/tools-class-wildcard.json +9 -0
  184. package/schema/fixtures/policy/invalid/tools-match-double-star.json +9 -0
  185. package/schema/fixtures/policy/invalid/unmapped-tool-unknown.json +7 -0
  186. package/schema/fixtures/policy/valid/delegation-empty.json +7 -0
  187. package/schema/fixtures/policy/valid/delegation-grammar-full.json +41 -0
  188. package/schema/fixtures/policy/valid/delegation-off.json +15 -0
  189. package/schema/fixtures/policy/valid/tools-mapping.json +17 -0
  190. package/schema/policy.schema.json +178 -0
@@ -0,0 +1,618 @@
1
+ /**
2
+ * The minimal Telegram card (APRV-489): one message, in plain words, with the
3
+ * whole technical card collapsed inside it.
4
+ *
5
+ * The owner's complaint was that an approval prompt is "very verbose and
6
+ * technical", and that the people approving (village residents on a phone) are
7
+ * not engineers. The answer is a second LAYOUT of the same request, chosen by
8
+ * the attested policy (`channels.telegram.prompt.style: minimal`). It is never
9
+ * a second READING of the payload: SPEC.md §10.3 (amended APRV-489) lets the
10
+ * canonical rendering be collapsed behind one tap, inside the message that
11
+ * carries the buttons, and nothing more.
12
+ *
13
+ * ## What the card is made of, and who wrote each part
14
+ *
15
+ * ```
16
+ * <b>Your agent wants to <phrase></b> computed: chosen by the class the LOG records
17
+ * <blockquote>quoted payload lines</blockquote> verbatim from the BOUND bytes, marked as a quote
18
+ * <i>AI summary (not checked):</i> … claimed: a model's sentence, below the quote
19
+ * <i>Your agent says (not checked):</i> … claimed: the agent's summary, below the quote
20
+ * Open for about 3 days. If you don't answer… computed: the gate's own window, from the log
21
+ * <blockquote expandable>Full details …</blockquote> the technical card, canonical rendering whole
22
+ * [✅ Approve] [✋ Deny] the same callback data as the technical card
23
+ * ```
24
+ *
25
+ * The phrase comes from the runtime's own table for the classes core emits;
26
+ * else, for a payload the runtime reads itself (a command, a file change, an
27
+ * email), from that payload's kind with `(type: <class>)`; else, for an opaque
28
+ * payload only, from the operator's attested `say.<class>.does` (R3-S1).
29
+ * Nothing the agent writes can reach the first line.
30
+ *
31
+ * ## Quoted text is hostile input
32
+ *
33
+ * Every quoted value was written by the party asking for approval. So each one
34
+ * is one line (a line break is drawn as ` ⏎ `); control, format, bidirectional,
35
+ * default-ignorable and blank-looking characters, and combining marks beyond two
36
+ * on one character, are drawn as `«U+202E»`; `«` and `⏎` themselves are drawn
37
+ * the same way so the marking is injective; the length is bounded with an
38
+ * explicit `…(cut; see full details)` taken between grapheme clusters; and the
39
+ * result is HTML-escaped. A value therefore cannot start a line of its own,
40
+ * cannot close the quote box, cannot open or close the collapsed block, and
41
+ * cannot be bold: the headline and the deadline line are bold or outside the
42
+ * box, and nothing quoted can be either.
43
+ *
44
+ * ## The box holds payload bytes and nothing else (fix round 2, B1)
45
+ *
46
+ * Every line inside the quote box is ONE payload value, verbatim (marked and,
47
+ * where cut, visibly cut), under a label: the operator's attested label, or the
48
+ * runtime's fixed label for a field of a shape the runtime knows (`From`,
49
+ * `In folder`, `replace_all`, …). Nothing computed or paraphrased goes inside
50
+ * the box: no outline of a command, no "yes" for `true`. What the box does not
51
+ * show is said OUTSIDE it, by computed notices: a cut, and the names of fields
52
+ * not quoted.
53
+ *
54
+ * ## When the card is NOT drawn
55
+ *
56
+ * Every case below is sent as the technical card instead, and the reason is
57
+ * recorded on the decision ({@link MinimalFallback}): never a guessed or partial
58
+ * minimal card.
59
+ *
60
+ * - an attestation prompt, a policy edit (`policy.*`, `log.*`, or a protected
61
+ * path): SPEC.md §10.3 wants the diff in front of the approver;
62
+ * - a truncated payload, or none: there is no canonical rendering to collapse;
63
+ * - an abnormal health row (a budget over, a policy not attested, an autonomy
64
+ * that is not `manual`): the reason to look is the technical card's;
65
+ * - an opaque payload with no `say` declaration, with a key its `quote` map does
66
+ * not name (the closed-field-set rule of SPEC.md §9), that is not an object,
67
+ * or whose declaration quotes nothing;
68
+ * - a card longer than {@link MINIMAL_MESSAGE_BUDGET}: the canonical rendering
69
+ * is never cut to fit.
70
+ *
71
+ * Pure: no clock, no IO. It imports nothing from `telegram.ts`, which calls it.
72
+ */
73
+ import { LIVE_TOOL_CALL } from "./contract.js";
74
+ import { commandSegmentWords } from "../core/command-class.js";
75
+ import { changePayloadView, commandPayloadView, emailPayloadFields, } from "../core/wysiwys.js";
76
+ import { BUILTIN_CLASS_PHRASES, sayEntryFor, } from "../core/prompt-layout.js";
77
+ /**
78
+ * The longest a minimal card may be, in characters of HTML.
79
+ *
80
+ * Telegram's limit is 4096 characters after entity parsing; the raw HTML is
81
+ * always at least as long, so a card under this is under the limit. The rest is
82
+ * room for the line a relay prepends (the control plane's `Agent: <name>`,
83
+ * name at most 48 characters), so the card stays one message there too.
84
+ */
85
+ export const MINIMAL_MESSAGE_BUDGET = 3800;
86
+ /** The longest key name a hidden-fields notice names, in code points. */
87
+ export const MINIMAL_KEY_MAX = 64;
88
+ /** The longest quoted value, in code points, before the cut marker. */
89
+ export const MINIMAL_QUOTE_MAX = 280;
90
+ /** The longest command shown whole on the card; a longer one is cut, visibly, and announced. */
91
+ export const MINIMAL_COMMAND_MAX = 160;
92
+ /** What a cut value ends with. Plain words, because the reader is not an engineer. */
93
+ export const MINIMAL_CUT_MARK = "…(cut; see full details)";
94
+ /** How a line break inside a quoted value is drawn. */
95
+ export const MINIMAL_NEWLINE_MARK = " ⏎ ";
96
+ /** How an empty quoted value is drawn (`«` is always marked in input, so this cannot be forged). */
97
+ export const MINIMAL_EMPTY_MARK = "«empty»";
98
+ /** The headline's fixed opening. */
99
+ export const MINIMAL_HEADLINE_PREFIX = "Your agent wants to ";
100
+ /** The labels on claimed lines: what wrote them, and that nobody checked. */
101
+ export const MINIMAL_GLOSS_LABEL = "AI summary (not checked):";
102
+ export const MINIMAL_SUMMARY_LABEL = "Your agent says (not checked):";
103
+ export const MINIMAL_COST_LABEL = "Your agent estimates the cost (not checked):";
104
+ /**
105
+ * The computed line under the quote box when the box does not show every byte
106
+ * of the payload in full (a value was cut). Plain words, and outside the box,
107
+ * so no quoted text can produce or suppress it.
108
+ */
109
+ export const MINIMAL_MORE_LINE = "⚠ There is more than fits here: open Full details before deciding.";
110
+ /**
111
+ * The computed line under the quote box when the box leaves a field the payload
112
+ * carries unquoted (a `~` key in the operator's `quote` map), naming the
113
+ * fields by the payload's own key names, marked like quoted text (S5).
114
+ */
115
+ export function hiddenFieldsLine(keys) {
116
+ const names = keys.map((key) => isolate(quoteLine(key, MINIMAL_KEY_MAX - 2))).join(", ");
117
+ return `Not shown here: ${names}. Open Full details before deciding.`;
118
+ }
119
+ /** The fixed opening of {@link hiddenFieldsLine}, for tests and for readers. */
120
+ export const MINIMAL_HIDDEN_PREFIX = "Not shown here: ";
121
+ /** The first line of the collapsed block: what a reader sees before tapping. */
122
+ export const MINIMAL_DETAILS_HEADING = "Full details (tap to open)";
123
+ /** The label of the reject button on a minimal card (R7: label only; the verb is still `r`). */
124
+ export const MINIMAL_DENY_LABEL = "✋ Deny";
125
+ /**
126
+ * Why a request was sent as the technical card although the policy asked for
127
+ * minimal. Recorded on the decision as `rendering.fallback`.
128
+ */
129
+ export const MINIMAL_FALLBACKS = [
130
+ "attestation",
131
+ "policy",
132
+ "no-payload",
133
+ "truncated",
134
+ "anomaly",
135
+ "undeclared",
136
+ "unlisted-key",
137
+ "nothing-quoted",
138
+ "too-long",
139
+ "digest",
140
+ "stale-summary",
141
+ "batch",
142
+ "send-refused",
143
+ "policy-unattested",
144
+ ];
145
+ /** The phrases for the classes core itself emits; the table lives in `core/prompt-layout.ts` (R2-S2). */
146
+ export { BUILTIN_CLASS_PHRASES };
147
+ /** The phrase for a structured payload kind, when the class has none. */
148
+ const KIND_PHRASES = {
149
+ command: "run a command",
150
+ "file-change": "change a file",
151
+ email: "send an email",
152
+ };
153
+ /** The three characters Telegram's HTML mode treats as markup (same rule as `telegram.ts`). */
154
+ function escapeHtml(text) {
155
+ return text.replace(/&/gu, "&amp;").replace(/</gu, "&lt;").replace(/>/gu, "&gt;");
156
+ }
157
+ /**
158
+ * Characters drawn as `«U+XXXX»`: controls, format (bidi, zero-width), line and
159
+ * paragraph separators, private use, lone surrogates, every default-ignorable
160
+ * code point (variation selectors, U+034F, the Khmer and Mongolian invisibles,
161
+ * tag characters, …), and the blank-looking letters and symbols that are not
162
+ * default-ignorable: the Hangul fillers U+115F, U+1160, U+3164, U+FFA0 and the
163
+ * braille blank U+2800 (S1).
164
+ */
165
+ const MARKED = /^[\p{Cc}\p{Cf}\p{Zl}\p{Zp}\p{Co}\p{Cs}\p{Default_Ignorable_Code_Point}\u115F\u1160\u3164\uFFA0\u2800]$/u;
166
+ /** A combining mark. */
167
+ const COMBINING = /^\p{M}$/u;
168
+ /** Combining marks drawn as themselves on one character; the rest are marked. */
169
+ export const MINIMAL_COMBINING_MAX = 2;
170
+ /** `«U+XXXX»` for one code point. */
171
+ function codeMark(character) {
172
+ const code = character.codePointAt(0) ?? 0;
173
+ return `«U+${code.toString(16).toUpperCase().padStart(4, "0")}»`;
174
+ }
175
+ /**
176
+ * A recognised emoji sequence (Unicode's RGI set: `\p{RGI_Emoji}`, a property
177
+ * of strings that needs the regular expression `v` flag), or `null` on a
178
+ * runtime without it (fix round 3, R2-B1).
179
+ *
180
+ * A grapheme cluster is drawn untouched ONLY when the whole cluster is one such
181
+ * sequence (❤️, 👨‍👩‍👧, 1️⃣, 🏴 with its tag characters): then every
182
+ * presentation selector, joiner and tag in it is part of the emoji's look. In
183
+ * every other cluster each of them is marked, so U+FE0F after a face that is
184
+ * already an emoji, or U+200D between two pictographs that form no emoji, cannot
185
+ * carry hidden bits. On a runtime without the property the answer is `null`
186
+ * and NOTHING is exempt: every selector and joiner is marked. Node 20, this
187
+ * package's floor, ships V8 11.3, which supports the `v` flag (V8 11.2).
188
+ */
189
+ const RGI_EMOJI = (() => {
190
+ try {
191
+ return new RegExp("^\\p{RGI_Emoji}$", "v");
192
+ }
193
+ catch {
194
+ return null;
195
+ }
196
+ })();
197
+ /** Whether `cluster` is drawn as itself: a recognised emoji sequence, on a runtime that can tell. */
198
+ export function isRecognisedEmoji(cluster) {
199
+ return RGI_EMOJI !== null && RGI_EMOJI.test(cluster);
200
+ }
201
+ /**
202
+ * One grapheme cluster as the card draws it. A recognised emoji sequence is
203
+ * itself; in any other cluster every marked character, including every
204
+ * presentation selector and joiner, is drawn `«U+XXXX»`.
205
+ */
206
+ function drawCluster(cluster) {
207
+ if (isRecognisedEmoji(cluster))
208
+ return cluster;
209
+ const points = [...cluster];
210
+ let out = "";
211
+ let marks = 0;
212
+ for (const character of points) {
213
+ if (character === "\n") {
214
+ out += MINIMAL_NEWLINE_MARK;
215
+ marks = 0;
216
+ continue;
217
+ }
218
+ if (character === "«" || character === "⏎") {
219
+ out += codeMark(character);
220
+ marks = 0;
221
+ continue;
222
+ }
223
+ if (MARKED.test(character)) {
224
+ out += codeMark(character);
225
+ continue;
226
+ }
227
+ if (COMBINING.test(character)) {
228
+ marks += 1;
229
+ out += marks > MINIMAL_COMBINING_MAX ? codeMark(character) : character;
230
+ continue;
231
+ }
232
+ marks = 0;
233
+ out += character;
234
+ }
235
+ return out;
236
+ }
237
+ /** Grapheme clusters, so a cut never splits a flag, an emoji sequence or a letter with its accents. */
238
+ const GRAPHEMES = new Intl.Segmenter("en", { granularity: "grapheme" });
239
+ /**
240
+ * A quoted value as one marked, bounded, UNESCAPED line.
241
+ *
242
+ * Injective up to the cut: every output token comes from exactly one input
243
+ * code point, and the tokens `«U+…»` and ` ⏎ ` arise only from marking,
244
+ * because `«` and `⏎` in the input are themselves marked. The cut is taken
245
+ * between grapheme clusters, so neither a mark nor a cluster is ever split.
246
+ *
247
+ * Injective is not the same as "never looks the same". Two different values can
248
+ * still look alike to a reader: look-alike letters from other scripts
249
+ * (Cyrillic а and Latin a), a lone emoji with and without its presentation
250
+ * selector, and runs of ordinary spaces are drawn as themselves. The marking
251
+ * removes the invisible differences, not the visible but subtle ones.
252
+ */
253
+ export function quoteLine(value, max = MINIMAL_QUOTE_MAX) {
254
+ return drawQuote(value, max).text;
255
+ }
256
+ /** {@link quoteLine}, and whether the value was cut. */
257
+ function drawQuote(value, max) {
258
+ if (value.length === 0)
259
+ return { text: MINIMAL_EMPTY_MARK, cut: false };
260
+ let out = "";
261
+ let used = 0;
262
+ for (const { segment } of GRAPHEMES.segment(value)) {
263
+ const token = drawCluster(segment);
264
+ const cost = [...token].length;
265
+ if (used + cost > max)
266
+ return { text: `${out}${MINIMAL_CUT_MARK}`, cut: true };
267
+ out += token;
268
+ used += cost;
269
+ }
270
+ return { text: out, cut: false };
271
+ }
272
+ /** A value of any JSON type as text: strings as themselves, everything else as JSON. */
273
+ function valueText(value) {
274
+ if (typeof value === "string")
275
+ return value;
276
+ return JSON.stringify(value) ?? String(value);
277
+ }
278
+ /**
279
+ * The runtime's own first-strong isolate around every quoted value (fix round
280
+ * 3, R2-S1). Letters of a right-to-left script reorder the digits and words
281
+ * near them with no control character present (`pay 100 א 5`); inside an
282
+ * isolate a value can reorder only what is inside the isolate, never its
283
+ * label, a neighbouring line or the card's text around it. What is inside
284
+ * includes the cut mark, which is drawn within the value's isolate: a cut
285
+ * right-to-left value shows `…(cut; see full details)` at its LEFT edge (the
286
+ * end, in its reading order). The mark is still on the line and still visible,
287
+ * and the computed notice under the box says the same thing outside any
288
+ * isolate. Added AFTER marking, so payload U+2068/U+2069 are still marked and
289
+ * these two never are; counted in every length bound; never inside the
290
+ * collapsed block, which stays the technical card byte for byte.
291
+ *
292
+ * Quoted values, hidden-field names and the class name in a headline are
293
+ * isolated. The operator's attested `does` phrase is NOT: it is drawn as
294
+ * written inside the bold headline, so a right-to-left phrase follows the
295
+ * ordinary bidirectional rules within that one line (R3-S2).
296
+ */
297
+ export const ISOLATE_OPEN = "\u2068";
298
+ export const ISOLATE_CLOSE = "\u2069";
299
+ function isolate(text) {
300
+ return `${ISOLATE_OPEN}${text}${ISOLATE_CLOSE}`;
301
+ }
302
+ /** A value drawn, bounded (the two isolate characters counted), escaped and isolated. */
303
+ function drawIsolated(value, max) {
304
+ const line = drawQuote(value, Math.max(1, max - 2));
305
+ return { html: isolate(escapeHtml(line.text)), cut: line.cut };
306
+ }
307
+ /** One quote-box line, HTML: `<b>label:</b> value`, or the value alone for an empty label; and whether it was cut. */
308
+ function quoted(label, value, max = MINIMAL_QUOTE_MAX) {
309
+ const line = drawIsolated(value, max);
310
+ return { html: label.length === 0 ? line.html : `<b>${escapeHtml(label)}:</b> ${line.html}`, cut: line.cut, label };
311
+ }
312
+ /** A class name as the headline may show it: marked like a quoted value, bounded, isolated. */
313
+ function className(actionClass) {
314
+ return isolate(quoteLine(actionClass, 78));
315
+ }
316
+ /** "about 4 minutes", "about 3 days": a duration a non-engineer reads at a glance. */
317
+ export function plainDuration(ms) {
318
+ const minutes = Math.round(ms / 60_000);
319
+ if (ms < 60_000 || minutes < 1)
320
+ return "less than a minute";
321
+ if (minutes < 90)
322
+ return `about ${String(minutes)} minute${minutes === 1 ? "" : "s"}`;
323
+ const hours = Math.round(ms / 3_600_000);
324
+ if (hours < 36)
325
+ return `about ${String(hours)} hours`;
326
+ const days = Math.round(ms / 86_400_000);
327
+ return `about ${String(days)} day${days === 1 ? "" : "s"}`;
328
+ }
329
+ /**
330
+ * How long the approver has and what doing nothing means, in plain words.
331
+ *
332
+ * Computed from the window the GATE judges the request by (`ttl_remaining_ms`:
333
+ * the policy's TTL narrowed by a harness hook's cap, from the verified log) and
334
+ * from whether the request is a tool call the agent is blocked in
335
+ * ({@link LIVE_TOOL_CALL}, set by the tagger from the request record). Doing
336
+ * nothing never makes anything happen: the only `on_expiry` is `reject`, and a
337
+ * hook request that outlives its cap is withdrawn.
338
+ */
339
+ export function deadlineLine(request) {
340
+ const ms = request.ttl_remaining_ms.value;
341
+ const toolCall = request[LIVE_TOOL_CALL]?.value === true;
342
+ if (ms === null) {
343
+ return toolCall
344
+ ? "Your agent is waiting. There is no time limit on this question."
345
+ : "There is no time limit. Nothing happens until you answer.";
346
+ }
347
+ if (ms <= 0)
348
+ return "Time is up: this request has closed, and an answer now will not count.";
349
+ const left = plainDuration(ms);
350
+ return toolCall
351
+ ? `Your agent is waiting: ${left} left. If you don't answer, it will not do this.`
352
+ : `Open for ${left}. If you don't answer, your agent will not do this.`;
353
+ }
354
+ /**
355
+ * The computed line under a command's quote box when the box does NOT show the
356
+ * whole command (fix round 4, R3-B1), or `null` when it does.
357
+ *
358
+ * A notice of what the box leaves out, and nothing else (SPEC.md §10.3,
359
+ * amended). A command shown whole gets no line at all, whatever it contains:
360
+ * the bytes are in the box, and the card makes no claim about how many
361
+ * commands they are or what they run. The classifier's segment count does not
362
+ * see commands started inside other commands (a here-document piped into a
363
+ * shell, `$( … )`, backticks, `bash -c '…'`, `eval`), so the count can only be
364
+ * a LOWER bound: the cut form says "at least N", and only when N is two or
365
+ * more. `count` is that count, or `null` when the classifier cannot read the
366
+ * command. The line never names or paraphrases a command the box does not show.
367
+ */
368
+ export function commandNotice(count, cut) {
369
+ if (!cut)
370
+ return null;
371
+ if (count === null) {
372
+ return "⚠ More than one command may be here, and only the beginning is shown above: open Full details before deciding.";
373
+ }
374
+ return count > 1
375
+ ? `⚠ This runs at least ${String(count)} commands. Only the beginning is shown above: open Full details before deciding.`
376
+ : "⚠ Only the beginning of this command is shown above: open Full details before deciding.";
377
+ }
378
+ /** The quote-box lines for a payload, or why there are none. */
379
+ function excerptOf(value, entry) {
380
+ const command = commandPayloadView(value);
381
+ if (command !== null) {
382
+ // R2-B2: a value stands alone only when it is the only quotation, so the
383
+ // command takes a label whenever its folder is quoted too.
384
+ const commandLine = quoted(command.cwd === null ? "" : "Command", command.command, MINIMAL_COMMAND_MAX);
385
+ const lines = [commandLine];
386
+ // Where it runs is part of what it does (`rm -rf *` in a scratch folder
387
+ // and in a home folder are different requests), so it is always shown.
388
+ const folder = command.cwd === null ? null : quoted("In folder", command.cwd);
389
+ if (folder !== null)
390
+ lines.push(folder);
391
+ // B1: no outline of the command inside the box, and none outside it. The
392
+ // classifier's breakdown drops flags and their values, which is exactly
393
+ // where a deletion target or an uploaded file lives. What the card says
394
+ // instead is COMPUTED, outside the box, and only when the command is cut:
395
+ // that only the beginning is shown, with the classifier's count as a lower
396
+ // bound (R3-B1: a whole command carries no count line).
397
+ const segments = commandSegmentWords(command.command);
398
+ return {
399
+ ...excerpt("command", lines, false),
400
+ // The command line's own cut is said by the command notice below; the
401
+ // generic warning is left for the folder line alone.
402
+ partial: folder?.cut === true,
403
+ commandNotice: commandNotice(segments === null ? null : segments.length, commandLine.cut),
404
+ };
405
+ }
406
+ const change = changePayloadView(value);
407
+ if (change !== null) {
408
+ const file = change.labels.find((field) => field.label === "file")?.text ?? "";
409
+ const lines = [quoted("File", file)];
410
+ if (change.before === null) {
411
+ lines.push(quoted("New content", change.after));
412
+ }
413
+ else {
414
+ lines.push(quoted("Replaces", change.before), quoted("With", change.after));
415
+ }
416
+ // `replace_all: true` changes every match, not one: the same before/after
417
+ // text means a different edit, so it is on the card whenever it is set.
418
+ // Every other field of the shape, under its own key name and verbatim
419
+ // value (B1: `replace_all: true`, never a paraphrase of it).
420
+ for (const field of change.labels) {
421
+ if (field.label !== "file")
422
+ lines.push(quoted(field.label, field.text));
423
+ }
424
+ return excerpt("file-change", lines, false);
425
+ }
426
+ const email = emailPayloadFields(value);
427
+ if (email !== null) {
428
+ const labels = {
429
+ from: "From",
430
+ to: "To",
431
+ cc: "Cc",
432
+ bcc: "Bcc",
433
+ subject: "Subject",
434
+ body: "Message",
435
+ content_type: "Format",
436
+ };
437
+ const lines = [];
438
+ const record = value;
439
+ for (const field of email) {
440
+ const label = labels[field.label];
441
+ if (label === undefined)
442
+ continue;
443
+ // R2-B2: a list of addresses is one quoted line PER ADDRESS under the
444
+ // same label, never the addresses joined with ", " (which would draw
445
+ // ["a, b"] and ["a", "b"] the same).
446
+ const raw = record[field.label];
447
+ if (Array.isArray(raw)) {
448
+ for (const address of raw)
449
+ lines.push(quoted(label, address));
450
+ }
451
+ else {
452
+ lines.push(quoted(label, field.text));
453
+ }
454
+ }
455
+ return excerpt("email", lines, false);
456
+ }
457
+ // Opaque: the closed field set is the operator's declaration, or nothing.
458
+ if (entry === null || entry.quote === undefined)
459
+ return { ok: false, reason: "undeclared" };
460
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
461
+ return { ok: false, reason: "undeclared" };
462
+ }
463
+ const record = value;
464
+ for (const key of Object.keys(record)) {
465
+ if (!Object.prototype.hasOwnProperty.call(entry.quote, key)) {
466
+ return { ok: false, reason: "unlisted-key" };
467
+ }
468
+ }
469
+ const lines = [];
470
+ const hidden = [];
471
+ for (const [key, label] of Object.entries(entry.quote)) {
472
+ if (!Object.prototype.hasOwnProperty.call(record, key))
473
+ continue;
474
+ if (label === null) {
475
+ hidden.push(key);
476
+ continue;
477
+ }
478
+ lines.push(quoted(label, valueText(record[key])));
479
+ }
480
+ if (lines.length === 0)
481
+ return { ok: false, reason: "nothing-quoted" };
482
+ // R2-B2: an unlabelled value only as the ONLY quotation. A loaded policy
483
+ // cannot declare otherwise (refused at load); a hand-built map falls back.
484
+ if (lines.length > 1 && lines.some((line) => line.label.length === 0)) {
485
+ return { ok: false, reason: "undeclared" };
486
+ }
487
+ return { ...excerpt("opaque", lines, false), hidden };
488
+ }
489
+ function excerpt(kind, lines, partial) {
490
+ return {
491
+ kind,
492
+ lines: lines.map((line) => line.html),
493
+ partial: partial || lines.some((line) => line.cut),
494
+ hidden: [],
495
+ };
496
+ }
497
+ /**
498
+ * The collapsed block: the technical card's three regions, in the order the
499
+ * technical card sends them, inside one expandable blockquote.
500
+ *
501
+ * Two wrappers are dropped and nothing else changes: the `<code>` around the
502
+ * action key and the `<pre>` around the canonical rendering. The Bot API's
503
+ * formatting rules (core.telegram.org/bots/api#formatting-options) let bold and
504
+ * italic sit inside any entity, say blockquotes cannot nest, and say the other
505
+ * entities cannot contain each other, so `pre` and `code` inside a blockquote
506
+ * are not a combination this card relies on. The TEXT is unchanged character
507
+ * for character: the canonical rendering is escaped exactly as inside `<pre>`,
508
+ * so what the reader sees, and what a test decodes back, is the rendering byte
509
+ * for byte.
510
+ */
511
+ export function detailsBlock(technical) {
512
+ const header = technical.header
513
+ .split("\n")
514
+ .map((entry) => {
515
+ const match = /^<code>([^<]*)<\/code>$/u.exec(entry);
516
+ return match === null ? entry : (match[1] ?? "");
517
+ })
518
+ .join("\n");
519
+ const parts = [`<b>${escapeHtml(MINIMAL_DETAILS_HEADING)}</b>`, header];
520
+ if (technical.payloadText !== null) {
521
+ parts.push("", `${technical.payloadLabel}\n${escapeHtml(technical.payloadText)}`);
522
+ }
523
+ parts.push("", technical.claimedText);
524
+ return `<blockquote expandable>${parts.join("\n")}</blockquote>`;
525
+ }
526
+ /** Classes whose prompt is always technical: the gate's own organs. */
527
+ function isPolicyClass(actionClass) {
528
+ return actionClass.startsWith("policy.") || actionClass === "policy" || actionClass.startsWith("log.");
529
+ }
530
+ /**
531
+ * Draw the minimal card for `request`, or say why it is not drawn.
532
+ *
533
+ * `technical` is `renderTelegram`'s output for the same request under the same
534
+ * layout, so the collapsed block is the technical card and nothing else.
535
+ */
536
+ export function renderTelegramMinimal(request, technical, say) {
537
+ if (request.policy_diff !== undefined || request.policy_load !== undefined) {
538
+ return { ok: false, reason: "attestation" };
539
+ }
540
+ const actionClass = request.class.value;
541
+ if (isPolicyClass(actionClass) || request.protected_path !== undefined) {
542
+ return { ok: false, reason: "policy" };
543
+ }
544
+ const payload = request.fullPayload.value;
545
+ if (payload === null || technical.payloadText === null)
546
+ return { ok: false, reason: "no-payload" };
547
+ if (payload.truncated)
548
+ return { ok: false, reason: "truncated" };
549
+ // Any abnormal health fact draws the technical card, whether or not the
550
+ // operator's row layout would have shown its row (fix round 2, S7): a hidden
551
+ // row must not let an unattested policy, a budget over its ceiling or an
552
+ // autonomy that is not manual reach the approver as a simple card.
553
+ if (technical.anomalous ||
554
+ request.autonomy.value !== "manual" ||
555
+ !request.budgets.value.every((verdict) => verdict.pass) ||
556
+ request.attestation.value.status !== "attested") {
557
+ return { ok: false, reason: "anomaly" };
558
+ }
559
+ const declared = sayEntryFor(say, actionClass);
560
+ const entry = declared?.entry ?? null;
561
+ const excerpt = excerptOf(payload.value, entry);
562
+ if ("ok" in excerpt)
563
+ return excerpt;
564
+ const builtin = Object.prototype.hasOwnProperty.call(BUILTIN_CLASS_PHRASES, actionClass)
565
+ ? BUILTIN_CLASS_PHRASES[actionClass]
566
+ : undefined;
567
+ // R2-S2: core's own phrase always wins for core's own classes (a say entry
568
+ // may not set `does` for them; refused at load).
569
+ // R3-S1: the runtime's kind phrase always wins for a payload the runtime
570
+ // reads itself (a command, a file change, an email), whatever the class: an
571
+ // operator's `does` is for payloads the runtime cannot read, which is what
572
+ // `say` exists for. A `does` for a class the classifier emits is refused at
573
+ // load (`prompt-say-kind`); for any other class the payload's kind is known
574
+ // only here, so the phrase is ignored here and the card says so to the
575
+ // caller, which notes it on the decision record.
576
+ let phrase;
577
+ let sayDoesIgnored = false;
578
+ if (builtin !== undefined)
579
+ phrase = builtin;
580
+ else if (excerpt.kind !== "opaque") {
581
+ phrase = `${KIND_PHRASES[excerpt.kind]} (type: ${className(actionClass)})`;
582
+ sayDoesIgnored = entry?.does !== undefined;
583
+ }
584
+ else if (entry?.does !== undefined)
585
+ phrase = entry.does;
586
+ else
587
+ return { ok: false, reason: "undeclared" };
588
+ const headline = `<b>${escapeHtml(`${MINIMAL_HEADLINE_PREFIX}${phrase}`)}</b>`;
589
+ const lines = [headline, `<blockquote>${excerpt.lines.join("\n")}</blockquote>`];
590
+ // Computed, outside the box, before any claimed line: what the box does NOT
591
+ // show. A partial excerpt is never presented as if it were the whole.
592
+ if (excerpt.commandNotice !== undefined && excerpt.commandNotice !== null) {
593
+ lines.push(escapeHtml(excerpt.commandNotice));
594
+ }
595
+ if (excerpt.partial)
596
+ lines.push(escapeHtml(MINIMAL_MORE_LINE));
597
+ if (excerpt.hidden.length > 0)
598
+ lines.push(escapeHtml(hiddenFieldsLine(excerpt.hidden)));
599
+ // Claimed lines: only below the quote, always labelled, always one line.
600
+ if (request.gloss !== undefined && request.gloss.value.trim().length > 0) {
601
+ lines.push(`<i>${escapeHtml(MINIMAL_GLOSS_LABEL)}</i> ${drawIsolated(request.gloss.value, MINIMAL_QUOTE_MAX).html}`);
602
+ }
603
+ const showSummary = entry !== null && (entry.note ?? "summary") === "summary";
604
+ const summary = request.summary.value;
605
+ if (showSummary && summary !== null && summary.trim().length > 0) {
606
+ lines.push(`<i>${escapeHtml(MINIMAL_SUMMARY_LABEL)}</i> ${drawIsolated(summary, MINIMAL_QUOTE_MAX).html}`);
607
+ }
608
+ if (request.est_cost_usd.value > 0) {
609
+ lines.push(`<i>${escapeHtml(MINIMAL_COST_LABEL)}</i> ${escapeHtml(`$${request.est_cost_usd.value.toFixed(2)}`)}`);
610
+ }
611
+ lines.push(escapeHtml(deadlineLine(request)));
612
+ const details = detailsBlock(technical);
613
+ const text = `${lines.join("\n")}\n${details}`;
614
+ if (text.length > MINIMAL_MESSAGE_BUDGET)
615
+ return { ok: false, reason: "too-long" };
616
+ return { ok: true, text, headline, details, ...(sayDoesIgnored ? { sayDoesIgnored: true } : {}) };
617
+ }
618
+ //# sourceMappingURL=telegram-minimal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telegram-minimal.js","sourceRoot":"","sources":["../../../src/channels/telegram-minimal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AAEH,OAAO,EAAE,cAAc,EAAuB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MA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