@gaunt-sloth/core 2.0.0-alpha.25 → 2.0.0-alpha.27

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 (41) hide show
  1. package/dist/config/schema.js +64 -15
  2. package/dist/config/schema.js.map +1 -1
  3. package/dist/config/types.d.ts +17 -8
  4. package/dist/config/types.js.map +1 -1
  5. package/dist/constants.d.ts +7 -4
  6. package/dist/constants.js +7 -4
  7. package/dist/constants.js.map +1 -1
  8. package/dist/core/GthAgentRunner.d.ts +10 -4
  9. package/dist/core/GthAgentRunner.js +24 -7
  10. package/dist/core/GthAgentRunner.js.map +1 -1
  11. package/dist/core/GthLangChainAgent.d.ts +16 -0
  12. package/dist/core/GthLangChainAgent.js +36 -15
  13. package/dist/core/GthLangChainAgent.js.map +1 -1
  14. package/dist/core/launchBanner.js +36 -17
  15. package/dist/core/launchBanner.js.map +1 -1
  16. package/dist/core/shell/abstention.d.ts +88 -0
  17. package/dist/core/shell/abstention.js +184 -0
  18. package/dist/core/shell/abstention.js.map +1 -0
  19. package/dist/core/shell/openWorld.d.ts +137 -12
  20. package/dist/core/shell/openWorld.js +677 -12
  21. package/dist/core/shell/openWorld.js.map +1 -1
  22. package/dist/core/shell/rater.d.ts +68 -38
  23. package/dist/core/shell/rater.js +105 -61
  24. package/dist/core/shell/rater.js.map +1 -1
  25. package/dist/core/shell/rejection.d.ts +7 -4
  26. package/dist/core/shell/rejection.js +3 -3
  27. package/dist/core/shell/rejection.js.map +1 -1
  28. package/dist/core/toolDisplay.d.ts +12 -3
  29. package/dist/core/toolDisplay.js +27 -7
  30. package/dist/core/toolDisplay.js.map +1 -1
  31. package/dist/utils/displayWidth.d.ts +30 -0
  32. package/dist/utils/displayWidth.js +140 -0
  33. package/dist/utils/displayWidth.js.map +1 -0
  34. package/dist/utils/systemPromptNotes.d.ts +28 -8
  35. package/dist/utils/systemPromptNotes.js +47 -49
  36. package/dist/utils/systemPromptNotes.js.map +1 -1
  37. package/dist/utils/untrustedText.d.ts +66 -0
  38. package/dist/utils/untrustedText.js +80 -0
  39. package/dist/utils/untrustedText.js.map +1 -0
  40. package/package.json +2 -1
  41. package/schema/gsloth-config.schema.json +3 -1
@@ -1,4 +1,4 @@
1
- /** The three moves §7 requires every rejection to name. */
1
+ /** The three moves §7 requires a JUDGED rejection to name. */
2
2
  export const REJECTION_MOVES = 'You may call the same command with a justification, call a different command, or ask the user ' +
3
3
  'if there is no way around it.';
4
4
  /**
@@ -10,9 +10,9 @@ export function buildGrantedAlternativeClause(toolName) {
10
10
  return `\`${toolName}\` does this and is already approved at this level, so it will not interrupt the user.`;
11
11
  }
12
12
  /**
13
- * Build the §7 rejection message handed back to the model as the refused call's tool result.
13
+ * Build the rejection message handed back to the model as the refused call's tool result.
14
14
  *
15
- * Shape (each part omitted when it does not apply):
15
+ * §7 shape, each part omitted when it does not apply:
16
16
  * 1. who refused what;
17
17
  * 2. the rater's explanation, when a rating exists;
18
18
  * 3. the three moves — always;
@@ -1 +1 @@
1
- {"version":3,"file":"rejection.js","sourceRoot":"","sources":["../../../src/core/shell/rejection.ts"],"names":[],"mappings":"AAoCA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAC1B,gGAAgG;IAChG,+BAA+B,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAAC,QAAgB;IAC5D,OAAO,KAAK,QAAQ,wFAAwF,CAAC;AAC/G,CAAC;AAiBD;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgC;IACpE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC;IACtF,MAAM,MAAM,GACV,OAAO,CAAC,MAAM,KAAK,OAAO;QACxB,CAAC,CAAC,2BAA2B,MAAM,GAAG;QACtC,CAAC,CAAC,qBAAqB,MAAM,GAAG,CAAC;IAErC,M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E,CAAC;IAC/C,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,IAAI,CAAC,gBAAgB,MAAM,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IACzD,IAAI,SAAS,EAAE,CAAC;QACd,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
@@ -1,13 +1,22 @@
1
1
  /** The single canonical output-preview cap (lines). No other preview length exists anywhere. */
2
2
  export declare const TOOL_OUTPUT_PREVIEW_LINES = 10;
3
- /** Per-line character cap for preview lines (a one-line minified bundle must not flood a row). */
3
+ /**
4
+ * Per-line cap for preview lines, in terminal COLUMNS (a one-line minified bundle must not flood a
5
+ * row). The `CHARS` in the name is historical; every cap here is a column budget, because a
6
+ * character count is not a width — see `#src/utils/displayWidth.js`.
7
+ */
4
8
  export declare const TOOL_PREVIEW_LINE_MAX_CHARS = 200;
5
- /** Per-value character cap inside a params summary. */
9
+ /** Per-value cap inside a params summary, in terminal COLUMNS. */
6
10
  export declare const TOOL_PARAM_VALUE_MAX_CHARS = 48;
7
- /** Whole params-summary character cap (everything inside the parentheses). */
11
+ /** Whole params-summary cap (everything inside the parentheses), in terminal COLUMNS. */
8
12
  export declare const TOOL_SUMMARY_MAX_CHARS = 120;
9
13
  /** The overflow/truncation marker used everywhere in this module. */
10
14
  export declare const ELLIPSIS = "\u2026";
15
+ /**
16
+ * Columns {@link ELLIPSIS} itself occupies, which every truncator has to reserve out of its budget
17
+ * before slicing. Derived rather than written as `1` so it stays true of whatever marker is used.
18
+ */
19
+ export declare const ELLIPSIS_WIDTH: number;
11
20
  /**
12
21
  * Style tag for one rendered line. The two surfaces map these to their own colour systems
13
22
  * (Ink `<Text>` props / raw ANSI): `dim` = greyed preview text, `added`/`removed` = diff
@@ -27,18 +27,28 @@
27
27
  * (added = `added` style/green, removed = `removed` style/red); monochrome keeps the `+`/`-`
28
28
  * prefixes so the diff still reads without colour (DL-7 graceful degradation).
29
29
  */
30
+ import { displayWidth, sliceToWidth } from '#src/utils/displayWidth.js';
30
31
  import { collectSecretValues, redactText } from '#src/utils/redactSecrets.js';
31
32
  import { env } from '#src/utils/systemUtils.js';
32
33
  /** The single canonical output-preview cap (lines). No other preview length exists anywhere. */
33
34
  export const TOOL_OUTPUT_PREVIEW_LINES = 10;
34
- /** Per-line character cap for preview lines (a one-line minified bundle must not flood a row). */
35
+ /**
36
+ * Per-line cap for preview lines, in terminal COLUMNS (a one-line minified bundle must not flood a
37
+ * row). The `CHARS` in the name is historical; every cap here is a column budget, because a
38
+ * character count is not a width — see `#src/utils/displayWidth.js`.
39
+ */
35
40
  export const TOOL_PREVIEW_LINE_MAX_CHARS = 200;
36
- /** Per-value character cap inside a params summary. */
41
+ /** Per-value cap inside a params summary, in terminal COLUMNS. */
37
42
  export const TOOL_PARAM_VALUE_MAX_CHARS = 48;
38
- /** Whole params-summary character cap (everything inside the parentheses). */
43
+ /** Whole params-summary cap (everything inside the parentheses), in terminal COLUMNS. */
39
44
  export const TOOL_SUMMARY_MAX_CHARS = 120;
40
45
  /** The overflow/truncation marker used everywhere in this module. */
41
46
  export const ELLIPSIS = '…';
47
+ /**
48
+ * Columns {@link ELLIPSIS} itself occupies, which every truncator has to reserve out of its budget
49
+ * before slicing. Derived rather than written as `1` so it stays true of whatever marker is used.
50
+ */
51
+ export const ELLIPSIS_WIDTH = displayWidth(ELLIPSIS);
42
52
  const FALLBACK_GLYPH = '⚙';
43
53
  const FILE_GLYPH = '📁';
44
54
  const SHELL_GLYPH = '🔧';
@@ -109,12 +119,22 @@ export function resetToolDisplaySecretsCacheForTests() {
109
119
  function inline(value) {
110
120
  return value.replace(/\s+/g, ' ').trim();
111
121
  }
112
- /** Truncate to `max` characters with the {@link ELLIPSIS} marker. */
122
+ /**
123
+ * Truncate to `max` terminal COLUMNS with the {@link ELLIPSIS} marker, reserving the marker's own
124
+ * width out of the budget. Slicing goes through the shared width primitive: a code-point count
125
+ * would read a CJK or emoji value as shorter than it renders and hand it back whole, over-running
126
+ * the row it is drawn on.
127
+ *
128
+ * Whether the value fits is put to the SLICE rather than to the ruler, because the slice stops at
129
+ * the budget: a value that over-runs is recognised from its first `max` columns, where measuring
130
+ * it reads all of it — and the values arriving here are whole tool-output lines, which
131
+ * {@link TOOL_PREVIEW_LINE_MAX_CHARS} exists precisely because they can be a megabyte long.
132
+ */
113
133
  function truncate(value, max) {
114
- const chars = [...value];
115
- if (chars.length <= max)
134
+ const fitted = sliceToWidth(value, max);
135
+ if (fitted === value)
116
136
  return value;
117
- return chars.slice(0, Math.max(0, max - 1)).join('') + ELLIPSIS;
137
+ return sliceToWidth(value, max - ELLIPSIS_WIDTH) + ELLIPSIS;
118
138
  }
119
139
  /**
120
140
  * Render one arg value for the summary: strings inline+truncated, the rest JSON-ish.
@@ -1 +1 @@
1
- {"version":3,"file":"toolDisplay.js","sourceRoot":"","sources":["../../src/core/toolDisplay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEhD,gGAAgG;AAChG,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C,kGAAkG;AAClG,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE/C,uDAAuD;AACvD,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C,8EAA8E;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C,qEAAqE;AACrE,MAAM,CAAC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AAE,OAAO,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;+EAE+E;AAE/E,MAAM,aAAa,GAAqC;IACtD,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU;CACpB,CAAC;AACF,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAqB,EAAE,MAAe;IACvE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IAC9B,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,EAAE,CAAC;AACjE,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Terminal columns `text` occupies. Zero-width clusters (combining marks, default-ignorables)
3
+ * count 0, wide clusters (CJK, emoji, fullwidth forms) count 2, everything else 1. ANSI escape
4
+ * sequences are not counted, so a pre-coloured string measures as what the user sees — but the
5
+ * slices below do not share that awareness, so do not read this as a licence to feed them one.
6
+ */
7
+ export declare function displayWidth(text: string): number;
8
+ /**
9
+ * The longest LEADING run of whole clusters whose total width is at most `maxWidth` — i.e. keep
10
+ * the head, lose the tail. Total (never throws): a non-positive `maxWidth` yields `''`.
11
+ *
12
+ * A cluster is kept only if it fits ENTIRELY, so the result can come back one column short of
13
+ * `maxWidth` when the next cluster is two columns wide. That is the point: half a wide glyph
14
+ * cannot be drawn, and spending the column anyway is how text over-runs its budget.
15
+ *
16
+ * The clusters are produced one at a time and the walk stops at the budget, so the cost is the
17
+ * length of the RESULT rather than the length of the input — the input here is a whole tool-output
18
+ * line, which is unbounded.
19
+ */
20
+ export declare function sliceToWidth(text: string, maxWidth: number): string;
21
+ /**
22
+ * The longest TRAILING run of whole clusters whose total width is at most `maxWidth` — i.e. keep
23
+ * the tail, lose the head. The mirror of {@link sliceToWidth}, for values whose end is the
24
+ * informative part (a path's leaf directory).
25
+ *
26
+ * This one materialises the clusters: it walks backwards, and cluster boundaries are only
27
+ * derivable from the front. Its callers pass a path or a model id, so the input is a line rather
28
+ * than a file.
29
+ */
30
+ export declare function sliceEndToWidth(text: string, maxWidth: number): string;
@@ -0,0 +1,140 @@
1
+ /**
2
+ * @module displayWidth
3
+ * The one place this repo answers "how many terminal COLUMNS does this string occupy, and where
4
+ * may I cut it". Everything that fits text to a terminal — the launch banner's field budgets, the
5
+ * tool-display caps — measures and slices through here.
6
+ *
7
+ * ## Why a code-point count is not a width
8
+ *
9
+ * `[...text].length` counts code points, which is right for UTF-16 safety and wrong for layout: a
10
+ * CJK ideograph or an emoji is ONE code point occupying TWO columns. Text measured that way reads
11
+ * as shorter than it renders, escapes whatever budget it was given, and wraps — and a wrapped
12
+ * continuation line starts back at column 0, which is precisely the failure the budgets exist to
13
+ * prevent. So the rule is: a value destined for a fixed column budget is measured with
14
+ * {@link displayWidth} and cut with {@link sliceToWidth} / {@link sliceEndToWidth}, never with
15
+ * `.length`, a spread, or `String.prototype.slice`.
16
+ *
17
+ * ## Why grapheme clusters are the cutting unit
18
+ *
19
+ * Slicing by code point is safe against halving a surrogate pair but not against halving a
20
+ * CLUSTER: a flag, a skin-toned or ZWJ-joined emoji, or a base letter plus its combining mark are
21
+ * several code points that a terminal draws as one glyph, and cutting between them produces
22
+ * mojibake or an orphaned mark. `Intl.Segmenter` gives the same cluster boundaries the width
23
+ * rules below are defined over, so the two agree by construction and a sliced string's width is
24
+ * exactly the sum of the widths of the clusters kept.
25
+ *
26
+ * ## What the slices expect: PLAIN text
27
+ *
28
+ * {@link displayWidth} is ANSI-aware and the slices are NOT, and that asymmetry is a contract
29
+ * rather than an oversight. An escape sequence is not one cluster — the terminal swallows it
30
+ * whole, but `ESC`, `[`, `3`, `5`, `m` segment as five, four of them printable — so the two
31
+ * disagree on an escape-bearing string and a slice can both under-fill its budget and cut inside
32
+ * a sequence. Feed the slices the text a user will read, and colour it afterwards; that is what
33
+ * every caller here does, since both render surfaces map a style tag to their own escapes at the
34
+ * very end. Making the slices ANSI-aware would change what a coloured preview line renders as,
35
+ * which is a decision for whoever needs it and not a silent detail of this module.
36
+ *
37
+ * That asymmetry is also why a slice decides "does the whole string fit?" two different ways. For
38
+ * plain text the cluster walk decides it: the widths of the clusters sum to the width of the
39
+ * string, so walking until the budget is blown answers the question and answers it WITHOUT
40
+ * touching the rest of the input — which is what keeps a megabyte-long preview line from being
41
+ * measured end to end before it is cut at column 200. Only escape-bearing text is measured whole
42
+ * first, because there the two rulers disagree and a coloured string that MEASURES as fitting must
43
+ * be handed back whole rather than cut short by the bytes of its own escapes.
44
+ *
45
+ * ## Why ambiguous-width characters stay NARROW
46
+ *
47
+ * `string-width` defaults to treating East-Asian "Ambiguous" characters as one column, and that
48
+ * default is load-bearing here rather than incidental: the sloth face is block elements, the
49
+ * wordmark is box-drawing, and `…` is U+2026 — all Ambiguous. Counting them as two columns would
50
+ * measure the 16-column face at 32 and shatter the layout it anchors. Do not pass
51
+ * `ambiguousIsNarrow: false`; the specs pin the face at 16 and the wordmark at 19 so a change of
52
+ * that policy fails loudly instead of quietly doubling the art.
53
+ */
54
+ import stringWidth from 'string-width';
55
+ /**
56
+ * Grapheme-cluster boundaries, i.e. what a terminal draws as one glyph. Built once: constructing
57
+ * an `Intl.Segmenter` is expensive relative to the short strings this module handles.
58
+ */
59
+ const GRAPHEME_SEGMENTER = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
60
+ /**
61
+ * Terminal columns `text` occupies. Zero-width clusters (combining marks, default-ignorables)
62
+ * count 0, wide clusters (CJK, emoji, fullwidth forms) count 2, everything else 1. ANSI escape
63
+ * sequences are not counted, so a pre-coloured string measures as what the user sees — but the
64
+ * slices below do not share that awareness, so do not read this as a licence to feed them one.
65
+ */
66
+ export function displayWidth(text) {
67
+ return stringWidth(text);
68
+ }
69
+ /** The clusters of `text`, in order — the only unit either slice is allowed to cut between. */
70
+ function clusters(text) {
71
+ const out = [];
72
+ for (const { segment } of GRAPHEME_SEGMENTER.segment(text))
73
+ out.push(segment);
74
+ return out;
75
+ }
76
+ /**
77
+ * Whether the whole-string measurement is the only ruler that can answer "does this fit" for
78
+ * `text` — true exactly when it carries an escape introducer (`ESC`, or the one-byte `CSI`), the
79
+ * two characters `string-width` itself strips on. On anything else the cluster widths sum to the
80
+ * whole-string width, so the walk decides the same question incrementally and a pre-measurement
81
+ * would be a second full pass over the input for nothing.
82
+ */
83
+ function needsWholeStringMeasure(text) {
84
+ return text.includes('\u001B') || text.includes('\u009B');
85
+ }
86
+ /**
87
+ * The longest LEADING run of whole clusters whose total width is at most `maxWidth` — i.e. keep
88
+ * the head, lose the tail. Total (never throws): a non-positive `maxWidth` yields `''`.
89
+ *
90
+ * A cluster is kept only if it fits ENTIRELY, so the result can come back one column short of
91
+ * `maxWidth` when the next cluster is two columns wide. That is the point: half a wide glyph
92
+ * cannot be drawn, and spending the column anyway is how text over-runs its budget.
93
+ *
94
+ * The clusters are produced one at a time and the walk stops at the budget, so the cost is the
95
+ * length of the RESULT rather than the length of the input — the input here is a whole tool-output
96
+ * line, which is unbounded.
97
+ */
98
+ export function sliceToWidth(text, maxWidth) {
99
+ if (maxWidth <= 0)
100
+ return '';
101
+ if (needsWholeStringMeasure(text) && displayWidth(text) <= maxWidth)
102
+ return text;
103
+ let width = 0;
104
+ let kept = '';
105
+ for (const { segment } of GRAPHEME_SEGMENTER.segment(text)) {
106
+ const clusterWidth = displayWidth(segment);
107
+ if (width + clusterWidth > maxWidth)
108
+ break;
109
+ width += clusterWidth;
110
+ kept += segment;
111
+ }
112
+ return kept;
113
+ }
114
+ /**
115
+ * The longest TRAILING run of whole clusters whose total width is at most `maxWidth` — i.e. keep
116
+ * the tail, lose the head. The mirror of {@link sliceToWidth}, for values whose end is the
117
+ * informative part (a path's leaf directory).
118
+ *
119
+ * This one materialises the clusters: it walks backwards, and cluster boundaries are only
120
+ * derivable from the front. Its callers pass a path or a model id, so the input is a line rather
121
+ * than a file.
122
+ */
123
+ export function sliceEndToWidth(text, maxWidth) {
124
+ if (maxWidth <= 0)
125
+ return '';
126
+ if (needsWholeStringMeasure(text) && displayWidth(text) <= maxWidth)
127
+ return text;
128
+ const all = clusters(text);
129
+ let width = 0;
130
+ let kept = '';
131
+ for (let index = all.length - 1; index >= 0; index--) {
132
+ const clusterWidth = displayWidth(all[index]);
133
+ if (width + clusterWidth > maxWidth)
134
+ break;
135
+ width += clusterWidth;
136
+ kept = all[index] + kept;
137
+ }
138
+ return kept;
139
+ }
140
+ //# sourceMappingURL=displayWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"displayWidth.js","sourceRoot":"","sources":["../../src/utils/displayWidth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,OAAO,WAAW,MAAM,cAAc,CAAC;AAEvC;;;GAGG;AACH,MAAM,kBAAkB,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,+FAA+F;AAC/F,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9E,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,SAAS,uBAAuB,CAAC,IAAY;IAC3C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,E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AG,IAAI,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -61,26 +61,46 @@ export interface CommitCoAuthor {
61
61
  email?: string;
62
62
  }
63
63
  /**
64
- * GS2-35: append the commit co-authoring rule to the composed code-mode system prompt.
64
+ * GS2-35/EXT-83: append the commit-writing rules to the composed code-mode system prompt.
65
65
  *
66
66
  * Gaunt Sloth has **no dedicated git-commit tool** — the agent commits by calling
67
- * `run_shell_command` with `git commit`, composing the message (including any trailer) itself. Left
68
- * unguided, models emit `Co-Authored-By: <their own model name>` (e.g. `Claude`, `GPT`, `Gemini`)
69
- * from trained habit, which is **factually wrong**: the commit was produced by *Gaunt Sloth*, not by
70
- * the model. This note is the fix at the correct layer first-party prompt guidance that (a) states
71
- * the exact trailer to emit and (b) forbids a model-name co-author.
67
+ * `run_shell_command` with `git commit`, composing the message (including any trailer) itself. That
68
+ * leaves two things it must be told, and both live here because both are about committing:
69
+ *
70
+ * 1. **WHO the co-author is.** Left unguided, models emit their own model name from trained habit,
71
+ * which is factually wrong: the commit was produced by *Gaunt Sloth*, not by the model. The note
72
+ * states the exact trailer to emit. EXT-83 — rather than enumerate model names not to write (a
73
+ * denylist is stale the day a new vendor ships, and an enumeration beside a catch-all teaches the
74
+ * model that the list is the rule), the correct name is SUPPLIED: the resolved
75
+ * {@link ResolvedModelIdentity} decorates the DEFAULT name as `Gaunt Sloth (provider:model)`, so
76
+ * the real model is named while the authorship stays Gaunt Sloth's.
77
+ * 2. **HOW the message reaches git.** A commit message passed inline in a double-quoted shell
78
+ * argument is EXPANDED BY THE SHELL before git runs, so a message that quotes code the way
79
+ * ordinary technical prose does is executed as a command. The note states that mechanism rather
80
+ * than merely forbidding the construct — naming a construct without its mechanism has been
81
+ * measured not to work. A file path carries no shell metacharacters, so the file form removes the
82
+ * failure mode instead of asking the model to avoid it.
83
+ *
84
+ * The note's prose carries **no backtick and no other markup** — including no angle-bracket
85
+ * placeholder: it is the one piece of guidance whose subject is how to write a commit message, so
86
+ * quoting its own examples in backticks would demonstrate the exact style rule 2 exists to stop, and
87
+ * an angle-bracket placeholder copied literally is itself a shell input redirect. The `<email>` of
88
+ * the trailer line is the exception the RFC form requires, and is scoped out of the scan.
72
89
  *
73
90
  * The identity is config-driven (`commit.coAuthor` in {@link import('#src/config/types.js').GthConfig}).
74
91
  * Each field falls back INDEPENDENTLY to the Gaunt Sloth account
75
92
  * ({@link DEFAULT_COMMIT_CO_AUTHOR_NAME} / {@link DEFAULT_COMMIT_CO_AUTHOR_EMAIL}) — so a partial
76
93
  * override (name only, or a config that bypassed the loader) still yields a complete trailer, and a
77
- * fully-absent config yields the default account. Blank/whitespace values are treated as unset.
94
+ * fully-absent config yields the default account. Blank/whitespace values are treated as unset. An
95
+ * EXPLICITLY CONFIGURED name is emitted verbatim, with no identity spliced in — the user asked for
96
+ * that string; the identity decorates only the default. An unresolvable identity (`undefined`) falls
97
+ * back to the plain default name, never to a placeholder.
78
98
  *
79
99
  * Backend-agnostic: composed through the shared code path so BOTH the lean `GthLangChainAgent` and
80
100
  * the deep `GthDeepAgent` inject it (the git-commit capability rides on `run_shell_command`, which
81
101
  * both backends expose in code mode). Returns the note alone when there is no base prompt.
82
102
  */
83
- export declare function appendCommitCoAuthorNote(systemPrompt: string | undefined, coAuthor?: CommitCoAuthor): string;
103
+ export declare function appendCommitCoAuthorNote(systemPrompt: string | undefined, coAuthor?: CommitCoAuthor, modelIdentity?: ResolvedModelIdentity): string;
84
104
  /**
85
105
  * GS2-34/GS2-53 — the resolved active-model identity, as a STRUCTURED value.
86
106
  *
@@ -15,6 +15,7 @@
15
15
  * `GthDeepAgent`.
16
16
  */
17
17
  import { DEFAULT_COMMIT_CO_AUTHOR_EMAIL, DEFAULT_COMMIT_CO_AUTHOR_NAME } from '#src/constants.js';
18
+ import { capUntrustedText, defangUntrustedDelimiters, MCP_FENCE_BEGIN, MCP_FENCE_END, } from '#src/utils/untrustedText.js';
18
19
  /**
19
20
  * EXT-26: the platform-agnostic tail shared by both {@link appendOsShellNote} branches.
20
21
  *
@@ -84,34 +85,64 @@ export function appendCwdNote(systemPrompt, cwd) {
84
85
  return systemPrompt ? `${systemPrompt}\n\n${cwdNote}` : cwdNote;
85
86
  }
86
87
  /**
87
- * GS2-35: append the commit co-authoring rule to the composed code-mode system prompt.
88
+ * GS2-35/EXT-83: append the commit-writing rules to the composed code-mode system prompt.
88
89
  *
89
90
  * Gaunt Sloth has **no dedicated git-commit tool** — the agent commits by calling
90
- * `run_shell_command` with `git commit`, composing the message (including any trailer) itself. Left
91
- * unguided, models emit `Co-Authored-By: <their own model name>` (e.g. `Claude`, `GPT`, `Gemini`)
92
- * from trained habit, which is **factually wrong**: the commit was produced by *Gaunt Sloth*, not by
93
- * the model. This note is the fix at the correct layer first-party prompt guidance that (a) states
94
- * the exact trailer to emit and (b) forbids a model-name co-author.
91
+ * `run_shell_command` with `git commit`, composing the message (including any trailer) itself. That
92
+ * leaves two things it must be told, and both live here because both are about committing:
93
+ *
94
+ * 1. **WHO the co-author is.** Left unguided, models emit their own model name from trained habit,
95
+ * which is factually wrong: the commit was produced by *Gaunt Sloth*, not by the model. The note
96
+ * states the exact trailer to emit. EXT-83 — rather than enumerate model names not to write (a
97
+ * denylist is stale the day a new vendor ships, and an enumeration beside a catch-all teaches the
98
+ * model that the list is the rule), the correct name is SUPPLIED: the resolved
99
+ * {@link ResolvedModelIdentity} decorates the DEFAULT name as `Gaunt Sloth (provider:model)`, so
100
+ * the real model is named while the authorship stays Gaunt Sloth's.
101
+ * 2. **HOW the message reaches git.** A commit message passed inline in a double-quoted shell
102
+ * argument is EXPANDED BY THE SHELL before git runs, so a message that quotes code the way
103
+ * ordinary technical prose does is executed as a command. The note states that mechanism rather
104
+ * than merely forbidding the construct — naming a construct without its mechanism has been
105
+ * measured not to work. A file path carries no shell metacharacters, so the file form removes the
106
+ * failure mode instead of asking the model to avoid it.
107
+ *
108
+ * The note's prose carries **no backtick and no other markup** — including no angle-bracket
109
+ * placeholder: it is the one piece of guidance whose subject is how to write a commit message, so
110
+ * quoting its own examples in backticks would demonstrate the exact style rule 2 exists to stop, and
111
+ * an angle-bracket placeholder copied literally is itself a shell input redirect. The `<email>` of
112
+ * the trailer line is the exception the RFC form requires, and is scoped out of the scan.
95
113
  *
96
114
  * The identity is config-driven (`commit.coAuthor` in {@link import('#src/config/types.js').GthConfig}).
97
115
  * Each field falls back INDEPENDENTLY to the Gaunt Sloth account
98
116
  * ({@link DEFAULT_COMMIT_CO_AUTHOR_NAME} / {@link DEFAULT_COMMIT_CO_AUTHOR_EMAIL}) — so a partial
99
117
  * override (name only, or a config that bypassed the loader) still yields a complete trailer, and a
100
- * fully-absent config yields the default account. Blank/whitespace values are treated as unset.
118
+ * fully-absent config yields the default account. Blank/whitespace values are treated as unset. An
119
+ * EXPLICITLY CONFIGURED name is emitted verbatim, with no identity spliced in — the user asked for
120
+ * that string; the identity decorates only the default. An unresolvable identity (`undefined`) falls
121
+ * back to the plain default name, never to a placeholder.
101
122
  *
102
123
  * Backend-agnostic: composed through the shared code path so BOTH the lean `GthLangChainAgent` and
103
124
  * the deep `GthDeepAgent` inject it (the git-commit capability rides on `run_shell_command`, which
104
125
  * both backends expose in code mode). Returns the note alone when there is no base prompt.
105
126
  */
106
- export function appendCommitCoAuthorNote(systemPrompt, coAuthor) {
107
- const name = coAuthor?.name?.trim() || DEFAULT_COMMIT_CO_AUTHOR_NAME;
127
+ export function appendCommitCoAuthorNote(systemPrompt, coAuthor, modelIdentity) {
128
+ // EXT-83 ONE place composes the name, so the parenthesised shape stays a one-line change. The
129
+ // identity decorates ONLY the default name: a configured name is the user's own string and is
130
+ // emitted verbatim, and an unresolved identity yields the bare default (never a placeholder).
131
+ const configuredName = coAuthor?.name?.trim();
132
+ const identity = modelIdentity?.identity?.trim();
133
+ const name = configuredName ||
134
+ (identity ? `${DEFAULT_COMMIT_CO_AUTHOR_NAME} (${identity})` : DEFAULT_COMMIT_CO_AUTHOR_NAME);
108
135
  const email = coAuthor?.email?.trim() || DEFAULT_COMMIT_CO_AUTHOR_EMAIL;
109
136
  const note = 'When you create a git commit, add EXACTLY this co-author trailer line (on its own line, at ' +
110
137
  `the end of the commit message):\nCo-Authored-By: ${name} <${email}>\n` +
111
- 'NEVER attribute the co-author to the underlying model or provider name (do not write ' +
112
- '`Co-Authored-By: Claude`, `GPT`, `Gemini`, `Opus`, `Sonnet`, or any model/vendor name): the ' +
113
- 'commit is authored by Gaunt Sloth, the assistant, not the model. Emit at most this one ' +
114
- 'Co-Authored-By trailer.';
138
+ 'Emit at most this one Co-Authored-By trailer.\n' +
139
+ 'Write the commit message in plain English: say what changed and why, and keep code, shell ' +
140
+ 'commands, backticks and markup out of it.\n' +
141
+ 'Never pass a commit message inline with the -m option: inside double quotes a POSIX shell ' +
142
+ 'expands backtick and dollar-parenthesis constructs before git ever runs, so a message that ' +
143
+ 'quotes code is executed as a command. Write the message to a file with the write_file tool ' +
144
+ '(never with shell echo or a heredoc, which put the same text back into a shell argument), ' +
145
+ 'then commit it with git commit -F followed by that file path.';
115
146
  return systemPrompt ? `${systemPrompt}\n\n${note}` : note;
116
147
  }
117
148
  /**
@@ -208,46 +239,13 @@ export function appendModelContextNote(systemPrompt, modelIdentity) {
208
239
  export const MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER = 4000;
209
240
  /** EXT-32: truncation marker appended when a server's instructions exceed the per-server cap. */
210
241
  export const MCP_INSTRUCTIONS_TRUNCATION_MARKER = '… [truncated]';
211
- /** EXT-32: the ONLY real structural delimiters in the composed block (emitted by this helper). */
212
- const MCP_FENCE_BEGIN = '[BEGIN MCP SERVER-PROVIDED CONTEXT]';
213
- const MCP_FENCE_END = '[END MCP SERVER-PROVIDED CONTEXT]';
214
- /**
215
- * EXT-32 (security): neutralize the block's structural delimiters inside UNTRUSTED server text.
216
- *
217
- * `getInstructions()` is fully server-controlled, so a malicious/compromised MCP server can emit
218
- * text that forges the fence tokens or a per-server label — closing the fence early so its lines
219
- * land OUTSIDE the visual boundary, or impersonating another server. Before fencing, we defang any
220
- * occurrence in the server text of:
221
- * - the fence tokens `[BEGIN|END MCP SERVER-PROVIDED CONTEXT]` (bracket run collapsed so they can
222
- * no longer be read as the real delimiter), and
223
- * - a per-server label line `--- Server: …` (the leading `---` run broken so it can't masquerade
224
- * as one of our labels).
225
- * After this, the ONLY real delimiters in the composed block are the ones this helper emits. The
226
- * server NAME in our own label comes from trusted config keys, so it is not sanitized — only the
227
- * server-supplied CONTENT is. Whitespace-tolerant matching (`\s+`, optional bracket padding, `-{3,}`)
228
- * so trivial spacing variants can't slip a delimiter through.
229
- */
230
- function defangMcpDelimiters(text) {
231
- return text
232
- .replace(/\[\s*(BEGIN|END)\s+MCP\s+SERVER-PROVIDED\s+CONTEXT\s*\]/gi, (_m, kw) => `(server text: ${kw.toUpperCase()} MCP SERVER-PROVIDED CONTEXT)`)
233
- .replace(/-{3,}(\s*Server\s*:)/gi, '- - -$1');
234
- }
235
242
  /**
236
243
  * EXT-32: cap server text at {@link MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER}, SURROGATE-SAFE.
237
244
  *
238
- * A naive `slice(0, N)` can split a surrogate pair (e.g. an emoji) at the boundary, emitting a lone
239
- * half-code-unit. If the cut would land between a high and low surrogate, back off one code unit so
240
- * the pair is kept whole (dropped entirely rather than split). Appends the truncation marker only
241
- * when text is actually clipped.
245
+ * Thin binding of the shared {@link capUntrustedText} to this block's own cap and marker.
242
246
  */
243
247
  function capMcpText(text) {
244
- if (text.length <= MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER)
245
- return text;
246
- let end = MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER;
247
- const code = text.charCodeAt(end - 1);
248
- if (code >= 0xd800 && code <= 0xdbff)
249
- end -= 1; // don't split a surrogate pair
250
- return `${text.slice(0, end).trimEnd()}\n${MCP_INSTRUCTIONS_TRUNCATION_MARKER}`;
248
+ return capUntrustedText(text, MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER, MCP_INSTRUCTIONS_TRUNCATION_MARKER);
251
249
  }
252
250
  /**
253
251
  * EXT-32: append connected MCP servers' discovery `instructions` to the composed system prompt.
@@ -277,7 +275,7 @@ export function appendMcpServerInstructionsNote(systemPrompt, instructions) {
277
275
  // SECURITY: defang the untrusted server text's structural delimiters BEFORE fencing, then cap
278
276
  // (surrogate-safe). Order matters — defang first so a forged fence/label can't survive into the
279
277
  // composed block; cap after so the final per-server size stays bounded.
280
- const safe = capMcpText(defangMcpDelimiters(text));
278
+ const safe = capMcpText(defangUntrustedDelimiters(text));
281
279
  blocks.push(`--- Server: "${entry.server}" ---\n${safe}`);
282
280
  }
283
281
  if (blocks.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"systemPromptNotes.js","sourceRoot":"","sources":["../../src/utils/systemPromptNotes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAElG;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,4FAA4F;IAC5F,wFAAwF;IACxF,2DAA2D,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAgC;IAChE,IAAI,IAAY,CAAC;IACjB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,IAAI;YACF,sFAAsF;gBACtF,qFAAqF;gBACrF,uFAAuF;gBACvF,4FAA4F;gBAC5F,6BAA6B,iBAAiB,EAAE,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QACjE,IAAI;YACF,0BAA0B,MAAM,yDAAyD;gBACzF,qFAAqF;gBACrF,+CAA+C,iBAAiB,EAAE,CAAC;IACvE,CAAC;IACD,OAAO,YAAY,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