@gaunt-sloth/core 2.0.0-beta.1 → 2.0.0-beta.3
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.
- package/LICENSE +6 -6
- package/dist/config/loader.d.ts +13 -0
- package/dist/config/loader.js +55 -11
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +10 -0
- package/dist/config/schema.js +46 -24
- package/dist/config/schema.js.map +1 -1
- package/dist/config/shell-policy.d.ts +144 -3
- package/dist/config/shell-policy.js +117 -10
- package/dist/config/shell-policy.js.map +1 -1
- package/dist/config/tool-descriptions.d.ts +5 -5
- package/dist/config/tool-descriptions.js +3 -3
- package/dist/config/types.d.ts +19 -0
- package/dist/config/types.js.map +1 -1
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -1
- package/dist/core/GthAbstractAgent.d.ts +32 -1
- package/dist/core/GthAbstractAgent.js +222 -7
- package/dist/core/GthAbstractAgent.js.map +1 -1
- package/dist/core/GthAgentRunner.d.ts +323 -27
- package/dist/core/GthAgentRunner.js +1092 -112
- package/dist/core/GthAgentRunner.js.map +1 -1
- package/dist/core/GthLangChainAgent.js +1 -1
- package/dist/core/GthLangChainAgent.js.map +1 -1
- package/dist/core/approvals/approvalRequest.d.ts +247 -0
- package/dist/core/approvals/approvalRequest.js +315 -0
- package/dist/core/approvals/approvalRequest.js.map +1 -0
- package/dist/core/approvals/grants.d.ts +165 -9
- package/dist/core/approvals/grants.js +702 -57
- package/dist/core/approvals/grants.js.map +1 -1
- package/dist/core/plainToolIndication.d.ts +11 -1
- package/dist/core/plainToolIndication.js +25 -10
- package/dist/core/plainToolIndication.js.map +1 -1
- package/dist/core/reasoningBlocks.d.ts +4 -6
- package/dist/core/reasoningBlocks.js +4 -6
- package/dist/core/reasoningBlocks.js.map +1 -1
- package/dist/core/shell/ShellCommandFailedError.d.ts +4 -4
- package/dist/core/shell/ShellCommandFailedError.js +4 -4
- package/dist/core/shell/abstention.d.ts +1 -1
- package/dist/core/shell/abstention.js +65 -11
- package/dist/core/shell/abstention.js.map +1 -1
- package/dist/core/shell/alignment.d.ts +491 -0
- package/dist/core/shell/alignment.js +687 -0
- package/dist/core/shell/alignment.js.map +1 -0
- package/dist/core/shell/approvalCapture.d.ts +53 -41
- package/dist/core/shell/approvalCapture.js +0 -42
- package/dist/core/shell/approvalCapture.js.map +1 -1
- package/dist/core/shell/approvalStop.d.ts +121 -3
- package/dist/core/shell/approvalStop.js +153 -90
- package/dist/core/shell/approvalStop.js.map +1 -1
- package/dist/core/shell/hardline.d.ts +26 -4
- package/dist/core/shell/hardline.js +321 -16
- package/dist/core/shell/hardline.js.map +1 -1
- package/dist/core/shell/negotiation.d.ts +352 -63
- package/dist/core/shell/negotiation.js +295 -123
- package/dist/core/shell/negotiation.js.map +1 -1
- package/dist/core/shell/openWorld.d.ts +136 -0
- package/dist/core/shell/openWorld.js +573 -35
- package/dist/core/shell/openWorld.js.map +1 -1
- package/dist/core/shell/provenance.d.ts +91 -0
- package/dist/core/shell/provenance.js +136 -0
- package/dist/core/shell/provenance.js.map +1 -0
- package/dist/core/shell/rater.d.ts +394 -163
- package/dist/core/shell/rater.js +536 -238
- package/dist/core/shell/rater.js.map +1 -1
- package/dist/core/shell/raterHealth.d.ts +101 -0
- package/dist/core/shell/raterHealth.js +121 -0
- package/dist/core/shell/raterHealth.js.map +1 -0
- package/dist/core/shell/raterModel.d.ts +17 -8
- package/dist/core/shell/raterModel.js +11 -8
- package/dist/core/shell/raterModel.js.map +1 -1
- package/dist/core/shell/rejection.d.ts +20 -5
- package/dist/core/shell/rejection.js +18 -4
- package/dist/core/shell/rejection.js.map +1 -1
- package/dist/core/toolDisplay.d.ts +91 -2
- package/dist/core/toolDisplay.js +168 -19
- package/dist/core/toolDisplay.js.map +1 -1
- package/dist/core/types.d.ts +140 -22
- package/dist/core/types.js.map +1 -1
- package/dist/providers/configurationPassthrough.d.ts +36 -6
- package/dist/providers/configurationPassthrough.js +40 -28
- package/dist/providers/configurationPassthrough.js.map +1 -1
- package/dist/providers/geminiSchemaSanitizer.d.ts +2 -2
- package/dist/providers/geminiSchemaSanitizer.js +2 -2
- package/dist/providers/geminiThinking.d.ts +10 -5
- package/dist/providers/geminiThinking.js +10 -5
- package/dist/providers/geminiThinking.js.map +1 -1
- package/dist/providers/openrouter.js +36 -6
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/vertexai.js +21 -0
- package/dist/providers/vertexai.js.map +1 -1
- package/dist/runtime/askStructured.d.ts +22 -0
- package/dist/runtime/askStructured.js +53 -0
- package/dist/runtime/askStructured.js.map +1 -1
- package/dist/utils/aiignoreUtils.d.ts +6 -0
- package/dist/utils/aiignoreUtils.js +69 -1
- package/dist/utils/aiignoreUtils.js.map +1 -1
- package/dist/utils/binaryOutputUtils.js +103 -21
- package/dist/utils/binaryOutputUtils.js.map +1 -1
- package/dist/utils/displayWidth.d.ts +10 -5
- package/dist/utils/displayWidth.js +148 -54
- package/dist/utils/displayWidth.js.map +1 -1
- package/dist/utils/fileUtils.d.ts +7 -1
- package/dist/utils/fileUtils.js +17 -3
- package/dist/utils/fileUtils.js.map +1 -1
- package/dist/utils/globalConfigUtils.d.ts +5 -2
- package/dist/utils/globalConfigUtils.js +14 -3
- package/dist/utils/globalConfigUtils.js.map +1 -1
- package/dist/utils/llmUtils.d.ts +1 -1
- package/dist/utils/llmUtils.js +1 -1
- package/dist/utils/systemPromptNotes.d.ts +3 -3
- package/dist/utils/systemPromptNotes.js +3 -3
- package/dist/utils/vertexaiUtils.js +160 -3
- package/dist/utils/vertexaiUtils.js.map +1 -1
- package/package.json +6 -5
- package/schema/gsloth-config.schema.json +34 -0
|
@@ -23,24 +23,38 @@
|
|
|
23
23
|
* rules below are defined over, so the two agree by construction and a sliced string's width is
|
|
24
24
|
* exactly the sum of the widths of the clusters kept.
|
|
25
25
|
*
|
|
26
|
-
* ## What the slices
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
26
|
+
* ## What the slices cut: text, with its escapes carried along
|
|
27
|
+
*
|
|
28
|
+
* The slices are ANSI-aware, and they agree with {@link displayWidth} by construction. An escape
|
|
29
|
+
* sequence is not one cluster — the terminal swallows it whole, but `ESC`, `[`, `3`, `5`, `m`
|
|
30
|
+
* segment as five, four of them printable. A walk that spent budget on those printable bytes
|
|
31
|
+
* would answer a different question from the ruler it is paired with, since `string-width` strips
|
|
32
|
+
* escapes before measuring; and at a budget narrower than the content it would cut INSIDE a
|
|
33
|
+
* sequence, handing the terminal a mutilated escape.
|
|
34
|
+
*
|
|
35
|
+
* So a sequence is an indivisible token costing zero columns. It is kept whole, and it is carried
|
|
36
|
+
* along with the text it introduces, so a truncated coloured string still renders coloured. A
|
|
37
|
+
* sequence whose text is entirely cut away is dropped with that text rather than left dangling at
|
|
38
|
+
* the end of the result, where it would style nothing and leak its colour into whatever the caller
|
|
39
|
+
* appends next — an ellipsis, the next parameter, the status tag.
|
|
40
|
+
*
|
|
41
|
+
* **The result stays a genuine prefix (or suffix) of the input: no reset is appended.** Terminal
|
|
42
|
+
* state belongs to the surface that owns the line, and both render surfaces already open and close
|
|
43
|
+
* their own styling around each line they draw; an `ESC[0m` injected at the cut would close that
|
|
44
|
+
* wrapper early and un-style everything after it.
|
|
45
|
+
*
|
|
46
|
+
* Because escapes cost no budget, the clusters kept sum to the width of the string as
|
|
47
|
+
* {@link displayWidth} measures it, so the cluster walk decides "does the whole string fit?" on
|
|
48
|
+
* its own — incrementally, stopping at the budget, WITHOUT a pre-measurement of the input. That is
|
|
49
|
+
* what keeps a megabyte-long preview line from being measured end to end before it is cut at
|
|
50
|
+
* column 200, and it is why the escape-bearing case needs no separate ruler.
|
|
51
|
+
*
|
|
52
|
+
* The one input the two do not agree on is an escape sequence placed INSIDE a grapheme cluster,
|
|
53
|
+
* between a base character and its combining mark. The measurement strips the sequence and joins
|
|
54
|
+
* what is left into one cluster; the walk cannot, because the sequence has already broken the
|
|
55
|
+
* cluster in two. The walk then counts such a string WIDER than it renders, which spends budget
|
|
56
|
+
* that is not needed and can leave a slice short — never over its budget, which is the direction
|
|
57
|
+
* that matters.
|
|
44
58
|
*
|
|
45
59
|
* ## Why ambiguous-width characters stay NARROW — and the one place they must not
|
|
46
60
|
*
|
|
@@ -75,8 +89,8 @@ const GRAPHEME_SEGMENTER = new Intl.Segmenter(undefined, { granularity: 'graphem
|
|
|
75
89
|
/**
|
|
76
90
|
* Terminal columns `text` occupies. Zero-width clusters (combining marks, default-ignorables)
|
|
77
91
|
* count 0, wide clusters (CJK, emoji, fullwidth forms) count 2, everything else 1. ANSI escape
|
|
78
|
-
* sequences are not counted, so a pre-coloured string measures as what the user sees —
|
|
79
|
-
* slices below
|
|
92
|
+
* sequences are not counted, so a pre-coloured string measures as what the user sees — and the
|
|
93
|
+
* slices below share that awareness, so a coloured string may be handed to either of them.
|
|
80
94
|
*/
|
|
81
95
|
export function displayWidth(text) {
|
|
82
96
|
return stringWidth(text);
|
|
@@ -104,22 +118,78 @@ export function firstCluster(text) {
|
|
|
104
118
|
return segment;
|
|
105
119
|
return '';
|
|
106
120
|
}
|
|
107
|
-
/** The clusters of `text`, in order — the only unit either slice is allowed to cut between. */
|
|
108
|
-
function clusters(text) {
|
|
109
|
-
const out = [];
|
|
110
|
-
for (const { segment } of GRAPHEME_SEGMENTER.segment(text))
|
|
111
|
-
out.push(segment);
|
|
112
|
-
return out;
|
|
113
|
-
}
|
|
114
121
|
/**
|
|
115
|
-
*
|
|
116
|
-
* `
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
* The code points a sequence can begin with: `ESC` (U+001B) and the one-byte `CSI` (U+009B) — the
|
|
123
|
+
* same two characters `string-width` itself tests for before it strips.
|
|
124
|
+
*/
|
|
125
|
+
const ESCAPE_INTRODUCER_CODES = new Set([0x00_1b, 0x00_9b]);
|
|
126
|
+
/**
|
|
127
|
+
* One ANSI escape sequence — an OSC string, or a CSI/two-character sequence — as a source pattern.
|
|
128
|
+
*
|
|
129
|
+
* This is the grammar of `ansi-regex`, which is what `strip-ansi` matches with and therefore what
|
|
130
|
+
* `string-width` removes before it measures. It is reproduced here rather than imported so the walk
|
|
131
|
+
* can never end up on a DIFFERENT copy of that package from the one `string-width` resolves: two
|
|
132
|
+
* versions in one tree would let the ruler and the walk disagree about where a sequence ends, which
|
|
133
|
+
* is the exact defect this module's ANSI-awareness exists to prevent. The spec cross-checks this
|
|
134
|
+
* pattern against `strip-ansi` itself, so a divergence fails loudly rather than silently.
|
|
135
|
+
*
|
|
136
|
+
* The OSC payload stops at the first terminator character instead of scanning ahead for one, so an
|
|
137
|
+
* unterminated OSC introducer cannot rescan the rest of the input — which is what keeps the walk
|
|
138
|
+
* linear on a long line full of half-written escapes rather than quadratic.
|
|
139
|
+
*/
|
|
140
|
+
const ANSI_SEQUENCE_SOURCE = [
|
|
141
|
+
'(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))',
|
|
142
|
+
'[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]',
|
|
143
|
+
].join('|');
|
|
144
|
+
/**
|
|
145
|
+
* The same grammar anchored with the sticky flag, so it answers "does a sequence START here?" in
|
|
146
|
+
* one step at a known index rather than searching forward for the next one anywhere in the string.
|
|
147
|
+
*
|
|
148
|
+
* Module-level, because compiling it per slice would tax the common case that never uses it. Its
|
|
149
|
+
* `lastIndex` is written immediately before every `exec`, with nothing in between, so a second walk
|
|
150
|
+
* that begins while the first is suspended cannot observe a stale position.
|
|
120
151
|
*/
|
|
121
|
-
|
|
122
|
-
|
|
152
|
+
const ANSI_SEQUENCE_AT_INDEX = new RegExp(ANSI_SEQUENCE_SOURCE, 'y');
|
|
153
|
+
/**
|
|
154
|
+
* The pieces of `text` in order — whole escape sequences and whole grapheme clusters, the only
|
|
155
|
+
* units either slice is allowed to cut between.
|
|
156
|
+
*
|
|
157
|
+
* Lazy, and that is the point: the head slice stops pulling at its budget, so a megabyte-long line
|
|
158
|
+
* costs the length of the RESULT rather than the length of the input.
|
|
159
|
+
*
|
|
160
|
+
* An escape introducer is always its own cluster, because the segmentation rules break on both
|
|
161
|
+
* sides of a control character — so a sequence can only ever begin where a cluster begins, and one
|
|
162
|
+
* anchored match there settles how far it runs. The clusters it spans are then skipped. A cluster
|
|
163
|
+
* that STRADDLES the end of a sequence (a combining mark binding to the sequence's final byte)
|
|
164
|
+
* yields only the part beyond it, so the pieces always reassemble into the input exactly.
|
|
165
|
+
*/
|
|
166
|
+
function* widthTokens(text) {
|
|
167
|
+
let index = 0;
|
|
168
|
+
for (const { segment, index: at } of GRAPHEME_SEGMENTER.segment(text)) {
|
|
169
|
+
const end = at + segment.length;
|
|
170
|
+
if (end <= index)
|
|
171
|
+
continue; // wholly inside a sequence already yielded
|
|
172
|
+
if (at < index) {
|
|
173
|
+
// Straddles the end of that sequence: only what lies beyond it is still unyielded.
|
|
174
|
+
const rest = text.slice(index, end);
|
|
175
|
+
index = end;
|
|
176
|
+
yield { text: rest, escape: false };
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (segment.length === 1 && ESCAPE_INTRODUCER_CODES.has(segment.charCodeAt(0))) {
|
|
180
|
+
ANSI_SEQUENCE_AT_INDEX.lastIndex = at;
|
|
181
|
+
const match = ANSI_SEQUENCE_AT_INDEX.exec(text);
|
|
182
|
+
if (match !== null) {
|
|
183
|
+
index = at + match[0].length;
|
|
184
|
+
yield { text: match[0], escape: true };
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
// An introducer that begins no sequence falls through as an ordinary cluster. It is a
|
|
188
|
+
// control character, so it measures zero and costs no budget either way.
|
|
189
|
+
}
|
|
190
|
+
index = end;
|
|
191
|
+
yield { text: segment, escape: false };
|
|
192
|
+
}
|
|
123
193
|
}
|
|
124
194
|
/**
|
|
125
195
|
* The longest LEADING run of whole clusters whose total width is at most `maxWidth` — i.e. keep
|
|
@@ -146,50 +216,74 @@ export function sliceToMaxWidth(text, maxWidth) {
|
|
|
146
216
|
}
|
|
147
217
|
/**
|
|
148
218
|
* The head-slice both public cuts are made of, given the ruler to measure with. The ruler is passed
|
|
149
|
-
* rather than chosen here so
|
|
150
|
-
*
|
|
151
|
-
*
|
|
219
|
+
* rather than chosen here so a caller cannot end up measured by one and cut by the other — reading
|
|
220
|
+
* the budget narrow and spending it wide would hand back a string that overruns the very budget the
|
|
221
|
+
* caller asked to be held to.
|
|
222
|
+
*
|
|
223
|
+
* The input is measured ONCE, incrementally, by the walk itself: escapes cost nothing, so the
|
|
224
|
+
* clusters kept sum to what {@link displayWidth} would report for them, and "does the whole string
|
|
225
|
+
* fit?" is answered by reaching the end rather than by a separate pass over the input first.
|
|
226
|
+
*
|
|
227
|
+
* Escapes are held back until a cluster is actually kept, so a sequence whose text all falls
|
|
228
|
+
* outside the budget is dropped with it instead of trailing the result and colouring whatever the
|
|
229
|
+
* caller appends next.
|
|
152
230
|
*/
|
|
153
231
|
function sliceHeadToWidth(text, maxWidth, measure) {
|
|
154
232
|
if (maxWidth <= 0)
|
|
155
233
|
return '';
|
|
156
|
-
if (needsWholeStringMeasure(text) && measure(text) <= maxWidth)
|
|
157
|
-
return text;
|
|
158
234
|
let width = 0;
|
|
159
235
|
let kept = '';
|
|
160
|
-
|
|
161
|
-
|
|
236
|
+
let pendingEscapes = '';
|
|
237
|
+
for (const token of widthTokens(text)) {
|
|
238
|
+
if (token.escape) {
|
|
239
|
+
pendingEscapes += token.text;
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
const clusterWidth = measure(token.text);
|
|
162
243
|
if (width + clusterWidth > maxWidth)
|
|
163
|
-
|
|
244
|
+
return kept;
|
|
164
245
|
width += clusterWidth;
|
|
165
|
-
kept +=
|
|
246
|
+
kept += pendingEscapes + token.text;
|
|
247
|
+
pendingEscapes = '';
|
|
166
248
|
}
|
|
167
|
-
|
|
249
|
+
// Every token fitted, so the answer is the input itself — returned rather than reassembled, so
|
|
250
|
+
// a caller comparing the result with what it passed in gets the identity it is testing for.
|
|
251
|
+
return text;
|
|
168
252
|
}
|
|
169
253
|
/**
|
|
170
254
|
* The longest TRAILING run of whole clusters whose total width is at most `maxWidth` — i.e. keep
|
|
171
255
|
* the tail, lose the head. The mirror of {@link sliceToWidth}, for values whose end is the
|
|
172
256
|
* informative part (a path's leaf directory).
|
|
173
257
|
*
|
|
174
|
-
* This one materialises the
|
|
175
|
-
* derivable from the front. Its callers pass a path or a model id, so the input is a line
|
|
176
|
-
* than a file.
|
|
258
|
+
* This one materialises the pieces: it walks backwards, and both cluster and sequence boundaries
|
|
259
|
+
* are only derivable from the front. Its callers pass a path or a model id, so the input is a line
|
|
260
|
+
* rather than a file.
|
|
261
|
+
*
|
|
262
|
+
* Keeping the END means the escapes that OPENED a style sit in the discarded head and go with it,
|
|
263
|
+
* so a tail comes back in the terminal's default styling. Only the sequences inside the kept span
|
|
264
|
+
* are carried, which leaves the tail ending in whatever state the whole string ended in — the cut
|
|
265
|
+
* introduces no bleed of its own.
|
|
177
266
|
*/
|
|
178
267
|
export function sliceEndToWidth(text, maxWidth) {
|
|
179
268
|
if (maxWidth <= 0)
|
|
180
269
|
return '';
|
|
181
|
-
|
|
182
|
-
return text;
|
|
183
|
-
const all = clusters(text);
|
|
270
|
+
const all = [...widthTokens(text)];
|
|
184
271
|
let width = 0;
|
|
185
272
|
let kept = '';
|
|
273
|
+
let pendingEscapes = '';
|
|
186
274
|
for (let index = all.length - 1; index >= 0; index--) {
|
|
187
|
-
const
|
|
275
|
+
const token = all[index];
|
|
276
|
+
if (token.escape) {
|
|
277
|
+
pendingEscapes = token.text + pendingEscapes;
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
const clusterWidth = displayWidth(token.text);
|
|
188
281
|
if (width + clusterWidth > maxWidth)
|
|
189
|
-
|
|
282
|
+
return kept;
|
|
190
283
|
width += clusterWidth;
|
|
191
|
-
kept =
|
|
284
|
+
kept = token.text + pendingEscapes + kept;
|
|
285
|
+
pendingEscapes = '';
|
|
192
286
|
}
|
|
193
|
-
return
|
|
287
|
+
return text;
|
|
194
288
|
}
|
|
195
289
|
//# sourceMappingURL=displayWidth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"displayWidth.js","sourceRoot":"","sources":["../../src/utils/displayWidth.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"displayWidth.js","sourceRoot":"","sources":["../../src/utils/displayWidth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;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;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,WAAW,CAAC,IAAI,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CA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I,YAAY,CAAC;QACtB,IAAI,IAAI,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC;QACpC,cAAc,GAAG,EAAE,CAAC;IACtB,CAAC;IACD,+FAA+F;IAC/F,4FAA4F;IAC5F,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,QAAgB;IAC5D,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACnC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,KAAK,IAAI,KAAK,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QACrD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,cAAc,GAAG,KAAK,CAAC,IAAI,GAAG,cAAc,CAAC;YAC7C,SAAS;QACX,CAAC;QACD,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,KAAK,GAAG,YAAY,GAAG,QAAQ;YAAE,OAAO,IAAI,CAAC;QACjD,KAAK,IAAI,YAAY,CAAC;QACtB,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,cAAc,GAAG,IAAI,CAAC;QAC1C,cAAc,GAAG,EAAE,CAAC;IACtB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -17,10 +17,16 @@ export declare function getGslothFilePath(filename: string): string;
|
|
|
17
17
|
* If .gsloth dir exists returns `projectdir/.gsloth/.gsloth-settings`
|
|
18
18
|
* If .gsloth dir does not exist returns `projectdir`
|
|
19
19
|
*
|
|
20
|
+
* When `identityProfileRaw` names a profile, the path is always
|
|
21
|
+
* `projectdir/.gsloth/.gsloth-settings/<profile>`, creating `.gsloth` and the profile dir as
|
|
22
|
+
* needed — a named profile only exists under `.gsloth-settings/`, so there is no project-root
|
|
23
|
+
* fallback for it. A blank/whitespace-only profile name counts as "no profile".
|
|
24
|
+
*
|
|
20
25
|
* @param filename The configuration filename
|
|
26
|
+
* @param identityProfileRaw Optional identity profile subdirectory name within `.gsloth-settings`
|
|
21
27
|
* @returns The resolved path where the configuration file should be written
|
|
22
28
|
*/
|
|
23
|
-
export declare function getGslothConfigWritePath(filename: string): string;
|
|
29
|
+
export declare function getGslothConfigWritePath(filename: string, identityProfileRaw?: string): string;
|
|
24
30
|
/**
|
|
25
31
|
* Gets the path where gsloth should look for configuration files based on .gsloth directory existence
|
|
26
32
|
* @param filename The configuration filename to look for
|
package/dist/utils/fileUtils.js
CHANGED
|
@@ -37,14 +37,28 @@ export function getGslothFilePath(filename) {
|
|
|
37
37
|
* If .gsloth dir exists returns `projectdir/.gsloth/.gsloth-settings`
|
|
38
38
|
* If .gsloth dir does not exist returns `projectdir`
|
|
39
39
|
*
|
|
40
|
+
* When `identityProfileRaw` names a profile, the path is always
|
|
41
|
+
* `projectdir/.gsloth/.gsloth-settings/<profile>`, creating `.gsloth` and the profile dir as
|
|
42
|
+
* needed — a named profile only exists under `.gsloth-settings/`, so there is no project-root
|
|
43
|
+
* fallback for it. A blank/whitespace-only profile name counts as "no profile".
|
|
44
|
+
*
|
|
40
45
|
* @param filename The configuration filename
|
|
46
|
+
* @param identityProfileRaw Optional identity profile subdirectory name within `.gsloth-settings`
|
|
41
47
|
* @returns The resolved path where the configuration file should be written
|
|
42
48
|
*/
|
|
43
|
-
export function getGslothConfigWritePath(filename) {
|
|
49
|
+
export function getGslothConfigWritePath(filename, identityProfileRaw) {
|
|
44
50
|
const currentDir = getProjectDir();
|
|
51
|
+
const identityProfile = identityProfileRaw?.trim();
|
|
52
|
+
const gslothDirPath = resolve(currentDir, GSLOTH_DIR);
|
|
53
|
+
const gslothSettingsPath = resolve(gslothDirPath, GSLOTH_SETTINGS_DIR);
|
|
54
|
+
if (identityProfile) {
|
|
55
|
+
const profileDirPath = resolve(gslothSettingsPath, identityProfile);
|
|
56
|
+
if (!existsSync(profileDirPath)) {
|
|
57
|
+
mkdirSync(profileDirPath, { recursive: true });
|
|
58
|
+
}
|
|
59
|
+
return resolve(profileDirPath, filename);
|
|
60
|
+
}
|
|
45
61
|
if (gslothDirExists()) {
|
|
46
|
-
const gslothDirPath = resolve(currentDir, GSLOTH_DIR);
|
|
47
|
-
const gslothSettingsPath = resolve(gslothDirPath, GSLOTH_SETTINGS_DIR);
|
|
48
62
|
// Create .gsloth-settings directory if it doesn't exist
|
|
49
63
|
if (!existsSync(gslothSettingsPath)) {
|
|
50
64
|
mkdirSync(gslothSettingsPath, { recursive: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../../src/utils/fileUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC;;;GAGG;AACH,MAAM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,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -34,14 +34,17 @@ export declare function resolveGlobalConfigPath(globalDir: string, filename: str
|
|
|
34
34
|
export declare function getGlobalGslothConfigReadPath(filename: string, identityProfileRaw?: string): string;
|
|
35
35
|
/**
|
|
36
36
|
* Gets the write path for a global gsloth config file (e.g. `.gsloth.config.json`)
|
|
37
|
-
* inside the global `~/.gsloth` directory
|
|
37
|
+
* inside the global `~/.gsloth` directory (or `~/.gsloth/.gsloth-settings/<identityProfile>/`),
|
|
38
|
+
* ensuring the relevant directory exists.
|
|
38
39
|
*
|
|
39
40
|
* Intended for first-run setup flows (CFG-2) that need to persist global settings.
|
|
40
41
|
*
|
|
41
42
|
* @param filename The configuration filename (e.g. `.gsloth.config.json`)
|
|
43
|
+
* @param identityProfileRaw Optional identity profile subdirectory name within `.gsloth-settings`.
|
|
44
|
+
* A blank/whitespace-only value counts as "no profile".
|
|
42
45
|
* @returns The resolved path where the global configuration file should be written
|
|
43
46
|
*/
|
|
44
|
-
export declare function getGlobalGslothConfigWritePath(filename: string): string;
|
|
47
|
+
export declare function getGlobalGslothConfigWritePath(filename: string, identityProfileRaw?: string): string;
|
|
45
48
|
/**
|
|
46
49
|
* Gets the global auth directory path
|
|
47
50
|
* @returns The resolved path to the global auth directory
|
|
@@ -54,15 +54,26 @@ export function getGlobalGslothConfigReadPath(filename, identityProfileRaw) {
|
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Gets the write path for a global gsloth config file (e.g. `.gsloth.config.json`)
|
|
57
|
-
* inside the global `~/.gsloth` directory
|
|
57
|
+
* inside the global `~/.gsloth` directory (or `~/.gsloth/.gsloth-settings/<identityProfile>/`),
|
|
58
|
+
* ensuring the relevant directory exists.
|
|
58
59
|
*
|
|
59
60
|
* Intended for first-run setup flows (CFG-2) that need to persist global settings.
|
|
60
61
|
*
|
|
61
62
|
* @param filename The configuration filename (e.g. `.gsloth.config.json`)
|
|
63
|
+
* @param identityProfileRaw Optional identity profile subdirectory name within `.gsloth-settings`.
|
|
64
|
+
* A blank/whitespace-only value counts as "no profile".
|
|
62
65
|
* @returns The resolved path where the global configuration file should be written
|
|
63
66
|
*/
|
|
64
|
-
export function getGlobalGslothConfigWritePath(filename) {
|
|
65
|
-
|
|
67
|
+
export function getGlobalGslothConfigWritePath(filename, identityProfileRaw) {
|
|
68
|
+
const globalDir = ensureGlobalGslothDir();
|
|
69
|
+
const identityProfile = identityProfileRaw?.trim();
|
|
70
|
+
if (identityProfile) {
|
|
71
|
+
const profileDirPath = resolve(globalDir, GSLOTH_SETTINGS_DIR, identityProfile);
|
|
72
|
+
if (!existsSync(profileDirPath)) {
|
|
73
|
+
mkdirSync(profileDirPath, { recursive: true });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return resolveGlobalConfigPath(globalDir, filename, identityProfileRaw);
|
|
66
77
|
}
|
|
67
78
|
/**
|
|
68
79
|
* Gets the global auth directory path
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalConfigUtils.js","sourceRoot":"","sources":["../../src/utils/globalConfigUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEjF;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;IAEvC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,SAAS,CAAC,SAAS,EAA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AAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IACjC,uCAAuC;IACvC,qBAAqB,EAAE,CAAC;IAExB,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IAEnC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACnD,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IACtC,6CAA6C;IAC7C,MAAM,YAAY,GAAG,SAAS;SAC3B,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;SAC1B,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC;SAC/B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,WAAW,EAAE,CAAC;IAEjB,OAAO,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,OAAO,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/utils/llmUtils.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare function readCodePrompt(config: PromptReadConfig): string;
|
|
|
32
32
|
export declare function readExecPrompt(config: PromptReadConfig): string;
|
|
33
33
|
/**
|
|
34
34
|
* GS2-79 — the SINGLE place a command's mode prompt is chosen, for every site that composes a
|
|
35
|
-
* system prompt via {@link buildSystemMessages}:
|
|
35
|
+
* system prompt via {@link buildSystemMessages}: the agent and the subagent profiles.
|
|
36
36
|
*
|
|
37
37
|
* It exists because the selection used to be an inline three-branch ternary copied to each of
|
|
38
38
|
* those sites, and a command missing from one copy is silently served the CHAT prompt — the
|
package/dist/utils/llmUtils.js
CHANGED
|
@@ -117,7 +117,7 @@ export function readExecPrompt(config) {
|
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
* GS2-79 — the SINGLE place a command's mode prompt is chosen, for every site that composes a
|
|
120
|
-
* system prompt via {@link buildSystemMessages}:
|
|
120
|
+
* system prompt via {@link buildSystemMessages}: the agent and the subagent profiles.
|
|
121
121
|
*
|
|
122
122
|
* It exists because the selection used to be an inline three-branch ternary copied to each of
|
|
123
123
|
* those sites, and a command missing from one copy is silently served the CHAT prompt — the
|
|
@@ -93,9 +93,9 @@ export interface CommitCoAuthor {
|
|
|
93
93
|
* it literally (the overwhelmingly common case, and a literal name is what makes the instruction
|
|
94
94
|
* actionable); when it is not, the note names no tool, keeps both prohibitions and the file form,
|
|
95
95
|
* and supplies the compliant path that remains: do not commit, and hand the message back to the
|
|
96
|
-
* user. That branch states no availability claim of its own —
|
|
97
|
-
*
|
|
98
|
-
* file-writing tool" could be flatly false
|
|
96
|
+
* user. That branch states no availability claim of its own — registering filesystem tools is the
|
|
97
|
+
* agent's decision, made from the same `filesystem` value, so a note asserting "you have no
|
|
98
|
+
* file-writing tool" could be flatly false.
|
|
99
99
|
*
|
|
100
100
|
* The note's prose carries **no backtick and no other markup** — including no angle-bracket
|
|
101
101
|
* placeholder: it is the one piece of guidance whose subject is how to write a commit message, so
|
|
@@ -117,9 +117,9 @@ export function appendCwdNote(systemPrompt, cwd) {
|
|
|
117
117
|
* it literally (the overwhelmingly common case, and a literal name is what makes the instruction
|
|
118
118
|
* actionable); when it is not, the note names no tool, keeps both prohibitions and the file form,
|
|
119
119
|
* and supplies the compliant path that remains: do not commit, and hand the message back to the
|
|
120
|
-
* user. That branch states no availability claim of its own —
|
|
121
|
-
*
|
|
122
|
-
* file-writing tool" could be flatly false
|
|
120
|
+
* user. That branch states no availability claim of its own — registering filesystem tools is the
|
|
121
|
+
* agent's decision, made from the same `filesystem` value, so a note asserting "you have no
|
|
122
|
+
* file-writing tool" could be flatly false.
|
|
123
123
|
*
|
|
124
124
|
* The note's prose carries **no backtick and no other markup** — including no angle-bracket
|
|
125
125
|
* placeholder: it is the one piece of guidance whose subject is how to write a commit message, so
|