@vincemakes/kiso-tui-cells 0.12.0 → 0.13.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.
@@ -63,6 +63,44 @@ export interface SaferRuntime {
63
63
  * all still there, which is the only thing they need to know to keep
64
64
  * going. */
65
65
  export declare const SAFER_DEGRADED = "couldn't get safer options \u2014 the original choices stand";
66
+ /**
67
+ * R3v2-F1 — the same sentence, for the one failure the reply's own text
68
+ * can PROVE.
69
+ *
70
+ * The unqualified line is true of every failure the ask has, which is
71
+ * exactly why it explains nothing when the cause was knowable. A reply
72
+ * the token budget cut in half is knowable: the JSON opens and never
73
+ * closes. So that case gets the cause in a parenthesis and keeps
74
+ * everything else — one line, dim, still leading with what is still
75
+ * true — because the human is mid-approval and the shape of the sentence
76
+ * is what they have already learned to read.
77
+ */
78
+ export declare const SAFER_DEGRADED_TRUNCATED = "couldn't get safer options (the reply was cut short) \u2014 the original choices stand";
79
+ /**
80
+ * R3v2-F1 — a failure that knows why it failed.
81
+ *
82
+ * `truncated` is the only cause the caller can demonstrate from the
83
+ * text, and it is deliberately the only member: a diagnosis the product
84
+ * cannot prove is worse than no diagnosis, so every other failure stays
85
+ * the unqualified line rather than growing a guess.
86
+ */
87
+ export interface SaferFailure {
88
+ readonly reason: "truncated";
89
+ }
90
+ /**
91
+ * R3v2-F1 — what the safer-options provider hands back.
92
+ *
93
+ * A list is the answer. `null` is a failure with nothing to add, and is
94
+ * still the whole contract for any caller that has nothing to add — the
95
+ * widening is additive, so an existing provider's behaviour is
96
+ * byte-identical. A SaferFailure is a failure that can name its cause.
97
+ */
98
+ export type SaferAnswer = readonly SaferOption[] | SaferFailure | null;
99
+ /** R3v2-F1: the line a failed ask owes the human — the unqualified one,
100
+ * unless the answer named a cause. The panel asks this instead of
101
+ * reaching for a constant, so the choice of sentence lives with the
102
+ * sentences. */
103
+ export declare function saferDegradedNote(answer: SaferAnswer): string;
66
104
  /** The row that returns to state 1. Rendered last, always present — an
67
105
  * alternatives list you cannot back out of would be a trap. */
68
106
  export declare const SAFER_BACK = "back to the original choices";
@@ -35,6 +35,27 @@ import { escapeTerminal, palette } from "./render.js";
35
35
  * all still there, which is the only thing they need to know to keep
36
36
  * going. */
37
37
  export const SAFER_DEGRADED = "couldn't get safer options — the original choices stand";
38
+ /**
39
+ * R3v2-F1 — the same sentence, for the one failure the reply's own text
40
+ * can PROVE.
41
+ *
42
+ * The unqualified line is true of every failure the ask has, which is
43
+ * exactly why it explains nothing when the cause was knowable. A reply
44
+ * the token budget cut in half is knowable: the JSON opens and never
45
+ * closes. So that case gets the cause in a parenthesis and keeps
46
+ * everything else — one line, dim, still leading with what is still
47
+ * true — because the human is mid-approval and the shape of the sentence
48
+ * is what they have already learned to read.
49
+ */
50
+ export const SAFER_DEGRADED_TRUNCATED = "couldn't get safer options (the reply was cut short) — the original choices stand";
51
+ /** R3v2-F1: the line a failed ask owes the human — the unqualified one,
52
+ * unless the answer named a cause. The panel asks this instead of
53
+ * reaching for a constant, so the choice of sentence lives with the
54
+ * sentences. */
55
+ export function saferDegradedNote(answer) {
56
+ const failure = answer === null || Array.isArray(answer) ? null : answer;
57
+ return failure?.reason === "truncated" ? SAFER_DEGRADED_TRUNCATED : SAFER_DEGRADED;
58
+ }
38
59
  /** The row that returns to state 1. Rendered last, always present — an
39
60
  * alternatives list you cannot back out of would be a trap. */
40
61
  export const SAFER_BACK = "back to the original choices";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-tui-cells",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "kiso tui-cells — the components cell renderer (components, diff, width, the render slice). Zero runtime dependencies: input is data, output is bytes.",
5
5
  "type": "module",
6
6
  "license": "MIT",