gaunt-sloth 2.0.0-beta.9 → 2.0.1
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/.gsloth.review-discovery.md +19 -0
- package/cli.js +49 -0
- package/dist/cli.js +42 -7
- package/dist/cli.js.map +1 -1
- package/dist/commands/adkEvalRunner.d.ts +7 -6
- package/dist/commands/adkEvalRunner.js +3 -3
- package/dist/commands/adkEvalRunner.js.map +1 -1
- package/dist/commands/agUiEvalRunner.d.ts +4 -4
- package/dist/commands/agUiEvalRunner.js +8 -7
- package/dist/commands/agUiEvalRunner.js.map +1 -1
- package/dist/commands/askCommand.d.ts +15 -2
- package/dist/commands/askCommand.js +75 -32
- package/dist/commands/askCommand.js.map +1 -1
- package/dist/commands/batchCommand.d.ts +6 -2
- package/dist/commands/batchCommand.js +13 -7
- package/dist/commands/batchCommand.js.map +1 -1
- package/dist/commands/chatCommand.js.map +1 -1
- package/dist/commands/codeCommand.js.map +1 -1
- package/dist/commands/commandIntrospection.d.ts +1 -1
- package/dist/commands/commandIntrospection.js +6 -3
- package/dist/commands/commandIntrospection.js.map +1 -1
- package/dist/commands/configCommand.d.ts +1 -1
- package/dist/commands/configCommand.js +1 -1
- package/dist/commands/configSetup.d.ts +1 -1
- package/dist/commands/discoveryConfigSchemaAgreement.d.ts +45 -0
- package/dist/commands/discoveryConfigSchemaAgreement.js +2 -0
- package/dist/commands/discoveryConfigSchemaAgreement.js.map +1 -0
- package/dist/commands/evalCommand.d.ts +27 -1
- package/dist/commands/evalCommand.js +156 -13
- package/dist/commands/evalCommand.js.map +1 -1
- package/dist/commands/execCommand.d.ts +15 -3
- package/dist/commands/execCommand.js +123 -51
- package/dist/commands/execCommand.js.map +1 -1
- package/dist/commands/firstRunDialog.d.ts +3 -3
- package/dist/commands/firstRunDialog.js +2 -2
- package/dist/commands/getCommand.js +10 -1
- package/dist/commands/getCommand.js.map +1 -1
- package/dist/commands/historyCommand.d.ts +16 -8
- package/dist/commands/historyCommand.js +190 -72
- package/dist/commands/historyCommand.js.map +1 -1
- package/dist/commands/insightsCommand.d.ts +4 -2
- package/dist/commands/insightsCommand.js +10 -7
- package/dist/commands/insightsCommand.js.map +1 -1
- package/dist/commands/prCommand.js +45 -16
- package/dist/commands/prCommand.js.map +1 -1
- package/dist/commands/prDiscovery.d.ts +24 -25
- package/dist/commands/prDiscovery.js +55 -132
- package/dist/commands/prDiscovery.js.map +1 -1
- package/dist/commands/requirementsDiscovery.d.ts +82 -0
- package/dist/commands/requirementsDiscovery.js +127 -0
- package/dist/commands/requirementsDiscovery.js.map +1 -0
- package/dist/commands/resumeOption.d.ts +19 -9
- package/dist/commands/resumeOption.js +29 -17
- package/dist/commands/resumeOption.js.map +1 -1
- package/dist/commands/reviewCommand.js +75 -8
- package/dist/commands/reviewCommand.js.map +1 -1
- package/dist/commands/reviewDiscovery.d.ts +96 -0
- package/dist/commands/reviewDiscovery.js +180 -0
- package/dist/commands/reviewDiscovery.js.map +1 -0
- package/dist/commands/singleShotResume.d.ts +19 -0
- package/dist/commands/singleShotResume.js +37 -0
- package/dist/commands/singleShotResume.js.map +1 -0
- package/dist/tui/approvalBridges.d.ts +86 -0
- package/dist/tui/approvalBridges.js +147 -0
- package/dist/tui/approvalBridges.js.map +1 -0
- package/dist/tui/components/App.js +278 -29
- package/dist/tui/components/App.js.map +1 -1
- package/dist/tui/components/DebugPanel.d.ts +6 -3
- package/dist/tui/components/DebugPanel.js +32 -10
- package/dist/tui/components/DebugPanel.js.map +1 -1
- package/dist/tui/components/FetchProgress.d.ts +1 -1
- package/dist/tui/components/LaunchBanner.d.ts +4 -3
- package/dist/tui/components/LaunchBanner.js +8 -6
- package/dist/tui/components/LaunchBanner.js.map +1 -1
- package/dist/tui/components/LiveTurn.d.ts +15 -9
- package/dist/tui/components/LiveTurn.js +15 -14
- package/dist/tui/components/LiveTurn.js.map +1 -1
- package/dist/tui/components/PromptInput.d.ts +2 -2
- package/dist/tui/components/PromptInput.js +11 -6
- package/dist/tui/components/PromptInput.js.map +1 -1
- package/dist/tui/components/ResumePicker.d.ts +69 -0
- package/dist/tui/components/ResumePicker.js +93 -0
- package/dist/tui/components/ResumePicker.js.map +1 -0
- package/dist/tui/components/SelectList.d.ts +1 -1
- package/dist/tui/components/SelectList.js +1 -1
- package/dist/tui/components/SlashCommandMenu.d.ts +1 -1
- package/dist/tui/components/SlashCommandMenu.js +1 -1
- package/dist/tui/components/StatusBar.d.ts +27 -1
- package/dist/tui/components/StatusBar.js +13 -2
- package/dist/tui/components/StatusBar.js.map +1 -1
- package/dist/tui/debugRender.d.ts +26 -3
- package/dist/tui/debugRender.js +233 -2
- package/dist/tui/debugRender.js.map +1 -1
- package/dist/tui/fixtureAgent.d.ts +2 -2
- package/dist/tui/fixtureAgent.js +2 -2
- package/dist/tui/keyBindings.js +7 -1
- package/dist/tui/keyBindings.js.map +1 -1
- package/dist/tui/keyGuards.d.ts +1 -1
- package/dist/tui/keyGuards.js +1 -1
- package/dist/tui/ruleWidth.d.ts +1 -1
- package/dist/tui/ruleWidth.js +1 -1
- package/dist/tui/selectCancelled.d.ts +1 -1
- package/dist/tui/selectCancelled.js +1 -1
- package/dist/tui/transcriptWindow.js +7 -1
- package/dist/tui/transcriptWindow.js.map +1 -1
- package/dist/tui/tuiSessionModule.js +91 -192
- package/dist/tui/tuiSessionModule.js.map +1 -1
- package/dist/tui/types.d.ts +79 -19
- package/dist/tui/useMouse.d.ts +1 -1
- package/dist/tui/useMouse.js +1 -1
- package/dist/tui/useSlothAnimation.d.ts +1 -1
- package/dist/tui/viewModel.d.ts +64 -12
- package/dist/tui/viewModel.js +38 -11
- package/dist/tui/viewModel.js.map +1 -1
- package/dist/utils/configErrorGuard.d.ts +11 -3
- package/dist/utils/configErrorGuard.js +11 -3
- package/dist/utils/configErrorGuard.js.map +1 -1
- package/package.json +19 -19
|
@@ -42,7 +42,7 @@ function createCellConfigResolver(baseConfig, commandLineConfigOverrides) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Build the injectable {@link RunCellFn} that adapts the shared single-shot runtime
|
|
45
|
+
* Build the injectable {@link @gaunt-sloth/batch!"types.js".RunCellFn | RunCellFn} that adapts the shared single-shot runtime
|
|
46
46
|
* (`runSingleShot`) to one matrix cell. Isolated in its own function so each cell run gets a fresh
|
|
47
47
|
* `createResolvers()` (its own MCP client instance) — matching batch's "N isolated model calls"
|
|
48
48
|
* contract (docs/batch-mechanism-vs-judgment.md) rather than sharing one resolver/client across
|
|
@@ -78,11 +78,13 @@ export async function buildProductionRunCell(baseConfig, preamble, commandLineCo
|
|
|
78
78
|
// an orphaned-process leak, one per cell.
|
|
79
79
|
const resolvers = createResolvers();
|
|
80
80
|
try {
|
|
81
|
-
const { ok, answer, tokensInput, tokensOutput, tools, toolResults } = await runSingleShot(`${options.sourcePrefix}-${cell.id}`, preamble, content, cellConfig, resolvers, options.command,
|
|
81
|
+
const { ok, answer, tokensInput, tokensOutput, tools, toolResults, advertisedTools } = await runSingleShot(`${options.sourcePrefix}-${cell.id}`, preamble, content, cellConfig, resolvers, options.command,
|
|
82
82
|
// batch/eval ask for the lean backend, same as exec/ask — the only one shipped;
|
|
83
83
|
// config.agent.backend names no other.
|
|
84
|
-
resolveAgentFactory(cellConfig, 'lean'), { displayCommand: options.displayCommand });
|
|
85
|
-
|
|
84
|
+
resolveAgentFactory(cellConfig, 'lean'), { displayCommand: options.displayCommand, origin: options.origin });
|
|
85
|
+
// BATCH-32: `advertisedTools` is threaded through with the rest — it is `gth eval`'s coverage
|
|
86
|
+
// denominator, and this adapter is the only place the agent's inventory can reach the runner.
|
|
87
|
+
return { ok, answer, tokensInput, tokensOutput, tools, toolResults, advertisedTools };
|
|
86
88
|
}
|
|
87
89
|
catch (error) {
|
|
88
90
|
// runSingleShot itself is documented to never throw for a normal LLM/tool failure (it
|
|
@@ -104,7 +106,7 @@ export async function buildProductionRunCell(baseConfig, preamble, commandLineCo
|
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
108
|
/**
|
|
107
|
-
* BATCH-12 Task 2 — build the injectable {@link RunConversationFn} that adapts core's MULTI-TURN
|
|
109
|
+
* BATCH-12 Task 2 — build the injectable {@link @gaunt-sloth/batch!"evalTypes.js".RunConversationFn | RunConversationFn} that adapts core's MULTI-TURN
|
|
108
110
|
* `runConversation` to `gth eval`'s conversation seam. The multi-turn analogue of
|
|
109
111
|
* {@link buildProductionRunCell}: same fresh-`createResolvers()` per conversation + cleanup-on-
|
|
110
112
|
* every-path discipline, but it runs a whole scripted conversation (agent/tools built ONCE, messages
|
|
@@ -136,14 +138,17 @@ export async function buildProductionRunConversation(config, preamble, options)
|
|
|
136
138
|
// conversation ends — the agent/tools persist ACROSS the turns inside `runConversation`.
|
|
137
139
|
const resolvers = createResolvers();
|
|
138
140
|
try {
|
|
139
|
-
const turns = await runConversation(`${options.sourcePrefix}-conversation`, preamble, wrapped, cellConfig, resolvers, options.command, resolveAgentFactory(cellConfig, 'lean'), { displayCommand: options.displayCommand });
|
|
140
|
-
|
|
141
|
+
const turns = await runConversation(`${options.sourcePrefix}-conversation`, preamble, wrapped, cellConfig, resolvers, options.command, resolveAgentFactory(cellConfig, 'lean'), { displayCommand: options.displayCommand, origin: options.origin });
|
|
142
|
+
// BATCH-32: `advertisedTools` rides along per turn (the same inventory on each — the
|
|
143
|
+
// conversation builds its agent once), so a multi-turn suite contributes a denominator too.
|
|
144
|
+
return turns.map(({ ok, answer, tokensInput, tokensOutput, tools, toolResults, advertisedTools, error, }) => ({
|
|
141
145
|
ok,
|
|
142
146
|
answer,
|
|
143
147
|
tokensInput,
|
|
144
148
|
tokensOutput,
|
|
145
149
|
tools,
|
|
146
150
|
toolResults,
|
|
151
|
+
advertisedTools,
|
|
147
152
|
error,
|
|
148
153
|
}));
|
|
149
154
|
}
|
|
@@ -230,6 +235,7 @@ export function batchCommand(program, commandLineConfigOverrides) {
|
|
|
230
235
|
command: 'exec',
|
|
231
236
|
// The header says `batch`; the mode prompt stays `exec`. Do not collapse these two.
|
|
232
237
|
displayCommand: 'batch',
|
|
238
|
+
origin: 'batch',
|
|
233
239
|
sourcePrefix: 'BATCH',
|
|
234
240
|
wrapBlockPrefix: 'script',
|
|
235
241
|
wrapPrefix: 'prompt-executable script',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batchCommand.js","sourceRoot":"","sources":["../../src/commands/batchCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAgB9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAS,wBAAwB,CAC/B,UAAqB,EACrB,0BAAsD;IAEtD,MAAM,cAAc,GAAG,IAAI,GAAG,EAA8B,CAAC;IAE7D,OAAO,CAAC,KAAyB,EAAsB,EAAE;QACvD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,UAAU,CAAC,EAAE,GAAG,0BAA0B,EAAE,KAAK,EAAE,CAAC,CAAC;YAC9D,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ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OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,IAAI,qBAAqB,EAAE,CAAC;QAC5D,MAAM,OAAO,GAAG,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAErD,cAAc,CACZ,mBAAmB,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,mBAAmB;YACnE,sBAAsB,SAAS,EAAE,CACpC,CAAC;QACF,6FAA6F;QAC7F,6FAA6F;QAC7F,2FAA2F;QAC3F,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QACjE,IAAI,IAAI,EAAE,CAAC;YACT,WAAW,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,kFAAkF;YAClF,wEAAwE;YACxE,cAAc,CACZ,GAAG,OAAO,CAAC,MAAM,yBAAyB,SAAS,4BAA4B,CAChF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatCommand.js","sourceRoot":"","sources":["../../src/commands/chatCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatCommand.js","sourceRoot":"","sources":["../../src/commands/chatCommand.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGhF,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,0BAAsD;IAEtD,2FAA2F;IAC3F,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oDAAoD,CAAC;SACjE,QAAQ,CAAC,WAAW,EAAE,mCAAmC,CAAC;QAC3D,0DAA0D;SACzD,SAAS,CAAC,YAAY,EAAE,CAAC;SACzB,WAAW,CACV,OAAO,EACP,IAAI;QACF,aAAa;QACb,gBAAgB;QAChB,kEAAkE;QAClE,4BAA4B,CAC/B;SACA,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,OAAqC,EAAE,EAAE;QACvE,MAAM,YAAY,CAChB,mBAAmB,EACnB,0BAA0B,EAC1B,OAAO,EACP,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeCommand.js","sourceRoot":"","sources":["../../src/commands/codeCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codeCommand.js","sourceRoot":"","sources":["../../src/commands/codeCommand.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGhF,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,0BAAsD;IAEtD,8EAA8E;IAC9E,gGAAgG;IAChG,4CAA4C;IAC5C,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,YAAY,CAChB,mBAAmB,EACnB,0BAA0B,EAC1B,SAAS,EACT,iBAAiB,CAAC,OAAO,EAAE,EAAE,CAAC,CAC/B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,uFAAuF,CACxF;SACA,QAAQ,CAAC,WAAW,EAAE,2CAA2C,CAAC;QACnE,0DAA0D;SACzD,SAAS,CAAC,YAAY,EAAE,CAAC;SACzB,WAAW,CACV,OAAO,EACP,IAAI;QACF,aAAa;QACb,gBAAgB;QAChB,6DAA6D;QAC7D,4BAA4B,CAC/B;SACA,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,OAAqC,EAAE,EAAE;QACvE,MAAM,YAAY,CAChB,mBAAmB,EACnB,0BAA0B,EAC1B,OAAO,EACP,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GthConfig } from '@gaunt-sloth/core/config.js';
|
|
2
2
|
import { type ContentSourceType, type RequirementSourceType } from '#src/commands/commandUtils.js';
|
|
3
|
-
export type PromptCommandType = 'ask' | 'review' | 'pr' | 'pr-discovery' | 'chat' | 'code' | 'exec';
|
|
3
|
+
export type PromptCommandType = 'ask' | 'review' | 'pr' | 'pr-discovery' | 'review-discovery' | 'chat' | 'code' | 'exec';
|
|
4
4
|
export type SourceCommandType = 'review' | 'pr';
|
|
5
5
|
export type SourceInputType = 'content' | 'requirements';
|
|
6
6
|
export declare function getAskSystemPrompt(config: GthConfig): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getContentFromSource, getRequirementsFromSource, } from '#src/commands/commandUtils.js';
|
|
2
2
|
import { buildSystemMessages, readBackstory, readChatPrompt, readCodePrompt, readExecPrompt, readGuidelines, readReviewInstructions, readSystemPrompt, } from '@gaunt-sloth/core/utils/llmUtils.js';
|
|
3
3
|
import { readPrDiscoveryPrompt } from '#src/commands/prDiscovery.js';
|
|
4
|
+
import { readReviewDiscoveryPrompt } from '#src/commands/reviewDiscovery.js';
|
|
4
5
|
export function getAskSystemPrompt(config) {
|
|
5
6
|
const parts = [readBackstory(config), readGuidelines(config)];
|
|
6
7
|
const systemPrompt = readSystemPrompt(config);
|
|
@@ -42,9 +43,11 @@ export function getCommandSystemPrompt(command, config) {
|
|
|
42
43
|
}
|
|
43
44
|
const modePrompt = command === 'pr-discovery'
|
|
44
45
|
? readPrDiscoveryPrompt(config)
|
|
45
|
-
: command === '
|
|
46
|
-
?
|
|
47
|
-
:
|
|
46
|
+
: command === 'review-discovery'
|
|
47
|
+
? readReviewDiscoveryPrompt(config)
|
|
48
|
+
: command === 'chat'
|
|
49
|
+
? readChatPrompt(config)
|
|
50
|
+
: readCodePrompt(config);
|
|
48
51
|
return flattenSystemMessageContent(config, modePrompt);
|
|
49
52
|
}
|
|
50
53
|
function flattenSystemMessageContent(config, modePrompt) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandIntrospection.js","sourceRoot":"","sources":["../../src/commands/commandIntrospection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAG1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"commandIntrospection.js","sourceRoot":"","sources":["../../src/commands/commandIntrospection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAG1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAO7E,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,KAAK,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,gBAAgB,CAAC,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,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,aAA4C;IAE5C,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO;QACL,GAAG,MAAM;QACT,QAAQ,EAAE;YACR,GAAG,MAAM,CAAC,QAAQ;YAClB,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE;SACtD;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAA0B,EAC1B,SAA0B,EAC1B,EAAsB,EACtB,MAAiB,EACjB,SAAqD;IAErD,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QACjC,OAAO,yBAAyB,CAC9B,6BAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,SAAkC,CAAC,EAClF,EAAE,EACF,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO,oBAAoB,CACzB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,SAA8B,CAAC,EAC1E,EAAE,EACF,MAAM,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { type CommandLineConfigOverrides, type GthConfig } from '@gaunt-sloth/core/config.js';
|
|
3
3
|
/**
|
|
4
|
-
* Produce a plain, printable, secret-free view of a fully-resolved
|
|
4
|
+
* Produce a plain, printable, secret-free view of a fully-resolved `GthConfig`.
|
|
5
5
|
*
|
|
6
6
|
* The resolved config carries live, non-serializable objects (the instantiated `llm`, tool
|
|
7
7
|
* instances, middleware); those are replaced with short descriptors so the output is readable
|
|
@@ -9,7 +9,7 @@ import { setExitCode } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
|
9
9
|
const SECRET_KEY_RE = /(api[-_]?key|secret|token|password|passwd|authorization|bearer|credential)/i;
|
|
10
10
|
const REDACTED = '***REDACTED***';
|
|
11
11
|
/**
|
|
12
|
-
* Produce a plain, printable, secret-free view of a fully-resolved
|
|
12
|
+
* Produce a plain, printable, secret-free view of a fully-resolved `GthConfig`.
|
|
13
13
|
*
|
|
14
14
|
* The resolved config carries live, non-serializable objects (the instantiated `llm`, tool
|
|
15
15
|
* instances, middleware); those are replaced with short descriptors so the output is readable
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Where {@link createProjectConfig} writes the scaffolded config. Mirrors {@link ConfigScope}
|
|
2
|
+
* Where {@link createProjectConfig} writes the scaffolded config. Mirrors {@link gaunt-sloth!commands/firstRunDialog.ConfigScope | ConfigScope}
|
|
3
3
|
* (firstRunDialog.ts) but as a destination the scriptable `gth init <provider>` path is told
|
|
4
4
|
* rather than a choice it asks for: `global: true` selects `~/.gsloth/` (or its named profile
|
|
5
5
|
* dir); `global: false`/omitted keeps the existing project default.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CFG-82 — the discovery config's two declarations are held together here, at build time.
|
|
3
|
+
*
|
|
4
|
+
* `commands.pr.discovery` and `commands.review.discovery` are declared twice on purpose: their
|
|
5
|
+
* runtime shape is in core's zod schema (`packages/core/src/config/schema.ts`), which is what
|
|
6
|
+
* `gth config validate` and the published JSON Schema read, and their TypeScript types are the
|
|
7
|
+
* interfaces in this package, merged into core's command config by module augmentation because
|
|
8
|
+
* `tools` is typed with LangChain tool types. Two declarations drift unless something compares
|
|
9
|
+
* them, and a drifted schema fails quietly: a field the interfaces gained but the schema lacks is
|
|
10
|
+
* stripped before it is checked, and a field only the schema has is accepted and never read.
|
|
11
|
+
*
|
|
12
|
+
* So this file does not compile unless, for each of `PrDiscoveryConfig` and
|
|
13
|
+
* `ReviewDiscoveryConfig`, the interface and the zod-inferred shape have the same set of keys and,
|
|
14
|
+
* for every key but `tools`, the same type. `tools` is bounded rather than equated: the interface
|
|
15
|
+
* names LangChain tool arrays and the schema takes an array of anything (as the root `tools` does,
|
|
16
|
+
* since a JS config passes live instances), so the check there is one-directional — every value the
|
|
17
|
+
* interface allows, the schema accepts. The key-set check still catches `tools` being added or
|
|
18
|
+
* removed on either side.
|
|
19
|
+
*
|
|
20
|
+
* Nothing here exists at runtime. `pnpm run build` is the gate; `discoveryConfigSchemaAgreement
|
|
21
|
+
* .spec.ts` type-checks this file directly as well, beside a probe proving the comparison can fail.
|
|
22
|
+
*/
|
|
23
|
+
import type { RawGthConfigInput } from '@gaunt-sloth/core/config/schema.js';
|
|
24
|
+
import type { PrDiscoveryConfig } from '#src/commands/prDiscovery.js';
|
|
25
|
+
import type { ReviewDiscoveryConfig } from '#src/commands/reviewDiscovery.js';
|
|
26
|
+
/** `true` only when `A` and `B` are the same type (not merely mutually assignable). */
|
|
27
|
+
export type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => (T extends B ? 1 : 2) ? true : false;
|
|
28
|
+
/** Compiles only when its argument is `true`. */
|
|
29
|
+
export type Expect<T extends true> = T;
|
|
30
|
+
/**
|
|
31
|
+
* Same keys, same types for every key but `tools`, and the interface's `tools` accepted by the
|
|
32
|
+
* schema's. Optional keys count: mutual assignability alone would miss a new optional field.
|
|
33
|
+
*/
|
|
34
|
+
export type DiscoveryShapesAgree<Interface, Schema> = Equal<keyof Interface, keyof Schema> extends true ? Equal<Omit<Interface, 'tools'>, Omit<Schema, 'tools'>> extends true ? 'tools' extends keyof Interface ? Interface['tools' & keyof Interface] extends Schema['tools' & keyof Schema] ? true : false : true : false : false;
|
|
35
|
+
/** `commands` as core's zod schema infers it. */
|
|
36
|
+
export type SchemaCommands = NonNullable<RawGthConfigInput['commands']>;
|
|
37
|
+
/** `commands.pr.discovery` as core's zod schema infers it. */
|
|
38
|
+
export type SchemaPrDiscovery = NonNullable<NonNullable<SchemaCommands['pr']>['discovery']>;
|
|
39
|
+
/** `commands.review.discovery` as core's zod schema infers it. */
|
|
40
|
+
export type SchemaReviewDiscovery = NonNullable<NonNullable<SchemaCommands['review']>['discovery']>;
|
|
41
|
+
/** Exported only so the assertions are not unused; it carries no information. */
|
|
42
|
+
export type DiscoveryConfigSchemaAgreement = [
|
|
43
|
+
Expect<DiscoveryShapesAgree<PrDiscoveryConfig, SchemaPrDiscovery>>,
|
|
44
|
+
Expect<DiscoveryShapesAgree<ReviewDiscoveryConfig, SchemaReviewDiscovery>>
|
|
45
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoveryConfigSchemaAgreement.js","sourceRoot":"","sources":["../../src/commands/discoveryConfigSchemaAgreement.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { CommandLineConfigOverrides } from '@gaunt-sloth/core/config.js';
|
|
3
|
+
import type { ConfiguredEvalToolCoverage } from '@gaunt-sloth/core/config.js';
|
|
4
|
+
import type { RunToolCoverageSource, RunToolCoverageSpec } from '@gaunt-sloth/batch';
|
|
3
5
|
/** Split each collected `--reporter` value on `,`, flatten, trim, drop blanks, and de-duplicate
|
|
4
6
|
* (order-preserving), so `-r junit,text` and `-r junit -r text` both yield `['junit','text']`. */
|
|
5
7
|
export declare function normalizeReporterNames(collected: string[]): string[];
|
|
@@ -11,7 +13,7 @@ export declare function normalizeReporterNames(collected: string[]): string[];
|
|
|
11
13
|
*/
|
|
12
14
|
export declare function isReporterFilePath(modulePath: string): boolean;
|
|
13
15
|
/**
|
|
14
|
-
* Resolve a `reporters` config module STRING to an absolute file path
|
|
16
|
+
* Resolve a `reporters` config module STRING to an absolute file path `importExternalFile` can
|
|
15
17
|
* load (BATCH-22 — the third-party-reporter enabler):
|
|
16
18
|
* - A **file path** ({@link isReporterFilePath}) keeps the original behavior: resolved against the
|
|
17
19
|
* PROJECT dir (the same base `readFileFromProjectDir` uses).
|
|
@@ -28,6 +30,30 @@ export declare function resolveReporterModule(modulePath: string): string;
|
|
|
28
30
|
/** Default output dir when `-o/--output` is omitted: a timestamped dir next to other gth reports —
|
|
29
31
|
* same convention as `defaultBatchOutputDir` in `batchCommand.ts`, `_EVAL` suffix instead. */
|
|
30
32
|
export declare function defaultEvalOutputDir(): string;
|
|
33
|
+
/** BATCH-48 — the run floor as the eval command resolved it, once, before any suite ran. */
|
|
34
|
+
export interface RunToolCoverageResolution {
|
|
35
|
+
/** The declared spec, or `undefined` when the base config does not set `evalToolCoverage`. */
|
|
36
|
+
spec?: RunToolCoverageSpec;
|
|
37
|
+
/** Where the value was read from, named in the output. */
|
|
38
|
+
source: RunToolCoverageSource;
|
|
39
|
+
/** Whether the run has a base config at all. `false` means no floor, and the output says so. */
|
|
40
|
+
hasBaseConfig: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* BATCH-48 — turn the base config's `evalToolCoverage` into the run floor, and name its source.
|
|
44
|
+
*
|
|
45
|
+
* **Once per run, from the base config only.** `loaded` is read by `loadConfiguredEvalToolCoverage`
|
|
46
|
+
* before the suite loop, from the overrides the invocation was started with. It is never read off a
|
|
47
|
+
* config a suite builds: configs are built per suite, a sweep cell deep-merges its own `config` onto
|
|
48
|
+
* each, and a suite that declares `identities:` builds one config per identity. Reading the floor off
|
|
49
|
+
* any of those would let two suites — or two cells of one suite — be graded against two thresholds,
|
|
50
|
+
* or let the floor be whichever identity happened to be built first.
|
|
51
|
+
*
|
|
52
|
+
* **The source is the invocation's, named for the reader.** A `-i` profile, a `-c` file, the global
|
|
53
|
+
* config, or the discovered project config — so a reader can see which threshold the run was graded
|
|
54
|
+
* against and where it was declared, rather than inferring it from which suites happened to run.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveRunToolCoverage(commandLineConfigOverrides: CommandLineConfigOverrides, loaded: ConfiguredEvalToolCoverage): RunToolCoverageResolution;
|
|
31
57
|
/**
|
|
32
58
|
* Pure resolver for the judge identity profile — kept small and side-effect-free so it's unit
|
|
33
59
|
* testable in isolation. Precedence (highest first): CLI `--judge <profile>` > suite-level
|
|
@@ -2,7 +2,7 @@ import { mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'n
|
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { basename, dirname, extname, join, relative, resolve } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { initConfig, resolveIdentityProfileConfigPath, } from '@gaunt-sloth/core/config.js';
|
|
5
|
+
import { initConfig, loadConfiguredEvalToolCoverage, resolveIdentityProfileConfigPath, } from '@gaunt-sloth/core/config.js';
|
|
6
6
|
import { getAskSystemPrompt } from '#src/commands/commandIntrospection.js';
|
|
7
7
|
import { buildProductionRunCell, buildProductionRunConversation, } from '#src/commands/batchCommand.js';
|
|
8
8
|
import { parseIntOption } from '#src/commands/cliOptionParsers.js';
|
|
@@ -37,7 +37,7 @@ export function isReporterFilePath(modulePath) {
|
|
|
37
37
|
/^[a-zA-Z]:[\\/]/.test(modulePath));
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Resolve a `reporters` config module STRING to an absolute file path
|
|
40
|
+
* Resolve a `reporters` config module STRING to an absolute file path `importExternalFile` can
|
|
41
41
|
* load (BATCH-22 — the third-party-reporter enabler):
|
|
42
42
|
* - A **file path** ({@link isReporterFilePath}) keeps the original behavior: resolved against the
|
|
43
43
|
* PROJECT dir (the same base `readFileFromProjectDir` uses).
|
|
@@ -77,7 +77,7 @@ export function resolveReporterModule(modulePath) {
|
|
|
77
77
|
*
|
|
78
78
|
* Each config reporter's module STRING is resolved by {@link resolveReporterModule} — a file path
|
|
79
79
|
* against the PROJECT dir, or a bare package specifier by node resolution against the PROJECT dir's
|
|
80
|
-
* `node_modules` — then imported via
|
|
80
|
+
* `node_modules` — then imported via `importExternalFile` (which turns the absolute path into a
|
|
81
81
|
* `file://` URL and supports `.ts` through jiti). Its DEFAULT export must be an `EvalReporterFactory`
|
|
82
82
|
* (`() => EvalReporter`); an unresolvable specifier, a missing file, a failed import, or a
|
|
83
83
|
* non-function default export THROWS — caught by the command's outer try/catch → exit 2 (harness
|
|
@@ -139,6 +139,37 @@ async function initConfigForCell(commandLineConfigOverrides, cell, identityProfi
|
|
|
139
139
|
// right here because `config.llm` — the ONE non-data field — is rejected at suite-parse time.
|
|
140
140
|
return deepMerge(config, cell.config);
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* BATCH-48 — turn the base config's `evalToolCoverage` into the run floor, and name its source.
|
|
144
|
+
*
|
|
145
|
+
* **Once per run, from the base config only.** `loaded` is read by `loadConfiguredEvalToolCoverage`
|
|
146
|
+
* before the suite loop, from the overrides the invocation was started with. It is never read off a
|
|
147
|
+
* config a suite builds: configs are built per suite, a sweep cell deep-merges its own `config` onto
|
|
148
|
+
* each, and a suite that declares `identities:` builds one config per identity. Reading the floor off
|
|
149
|
+
* any of those would let two suites — or two cells of one suite — be graded against two thresholds,
|
|
150
|
+
* or let the floor be whichever identity happened to be built first.
|
|
151
|
+
*
|
|
152
|
+
* **The source is the invocation's, named for the reader.** A `-i` profile, a `-c` file, the global
|
|
153
|
+
* config, or the discovered project config — so a reader can see which threshold the run was graded
|
|
154
|
+
* against and where it was declared, rather than inferring it from which suites happened to run.
|
|
155
|
+
*/
|
|
156
|
+
export function resolveRunToolCoverage(commandLineConfigOverrides, loaded) {
|
|
157
|
+
// `-c` is checked first because it wins outright in the loader: with `-c` and `-i` both given,
|
|
158
|
+
// the value comes from the `-c` file, and naming the profile would name a config never read.
|
|
159
|
+
const profile = commandLineConfigOverrides.identityProfile?.trim();
|
|
160
|
+
const source = commandLineConfigOverrides.customConfigPath
|
|
161
|
+
? { kind: 'config-file', path: commandLineConfigOverrides.customConfigPath }
|
|
162
|
+
: profile
|
|
163
|
+
? { kind: 'profile', profile }
|
|
164
|
+
: loaded.layer === 'global'
|
|
165
|
+
? { kind: 'global' }
|
|
166
|
+
: { kind: 'project' };
|
|
167
|
+
const declared = loaded.value;
|
|
168
|
+
const spec = declared
|
|
169
|
+
? { waive: declared.waive ?? [], ...(declared.min !== undefined ? { min: declared.min } : {}) }
|
|
170
|
+
: undefined;
|
|
171
|
+
return { source, hasBaseConfig: loaded.found, ...(spec ? { spec } : {}) };
|
|
172
|
+
}
|
|
142
173
|
/** `basename(path)` with its extension removed — the per-suite output subdir name and the JUnit
|
|
143
174
|
* `<testsuites>` name. `eval/authz-matrix.yaml` → `authz-matrix`. */
|
|
144
175
|
function suiteStem(path) {
|
|
@@ -312,7 +343,7 @@ async function printRelabelDiff(parsedSuite, relabelPath) {
|
|
|
312
343
|
* suite/sweep-cell structure lines up automatically. A missing baseline is a warning, never a
|
|
313
344
|
* failure: comparing against a run that does not exist is not a regression.
|
|
314
345
|
*/
|
|
315
|
-
async function printRunDiff(compareToRoot, outputRoot, cellOutputDir, summary) {
|
|
346
|
+
async function printRunDiff(compareToRoot, outputRoot, cellOutputDir, summary, driftSpec) {
|
|
316
347
|
const projectDir = getProjectDir();
|
|
317
348
|
const relativePath = relative(resolve(projectDir, outputRoot), resolve(projectDir, cellOutputDir));
|
|
318
349
|
const baselineFile = join(resolve(projectDir, compareToRoot), relativePath, 'results.json');
|
|
@@ -325,10 +356,15 @@ async function printRunDiff(compareToRoot, outputRoot, cellOutputDir, summary) {
|
|
|
325
356
|
'for this unit. "No regressions" cannot be claimed for a comparison that did not happen.');
|
|
326
357
|
return;
|
|
327
358
|
}
|
|
328
|
-
const { diffRuns, renderRunDiff } = await import('@gaunt-sloth/batch/evalCompare.js');
|
|
329
|
-
|
|
359
|
+
const { diffRuns, renderRunDiff, parseJudgeDriftFilter } = await import('@gaunt-sloth/batch/evalCompare.js');
|
|
360
|
+
// `undefined` leaves the threshold-ward default to `diffRuns` itself rather than restating it
|
|
361
|
+
// here, so the CLI cannot drift from the library's idea of quiet.
|
|
362
|
+
const driftFilter = driftSpec === undefined ? undefined : parseJudgeDriftFilter(driftSpec);
|
|
363
|
+
const diff = diffRuns(baseline, summary, driftFilter);
|
|
330
364
|
for (const line of renderRunDiff(diff)) {
|
|
331
|
-
if (line.trimStart().startsWith('!') ||
|
|
365
|
+
if (line.trimStart().startsWith('!') ||
|
|
366
|
+
line.trimStart().startsWith('REGRESSED') ||
|
|
367
|
+
line.trimStart().startsWith('JUDGE DRIFT')) {
|
|
332
368
|
displayWarning(line);
|
|
333
369
|
}
|
|
334
370
|
else {
|
|
@@ -386,7 +422,14 @@ export function evalCommand(program, commandLineConfigOverrides) {
|
|
|
386
422
|
'the corpus BY ID and exit without running anything. Reports agreement, per-case ' +
|
|
387
423
|
'disagreements, and any ids present in only one of the two.')
|
|
388
424
|
.option('--compare-to <dir>', "A previous run's -o output root. Each run unit is diffed against the matching results.json " +
|
|
389
|
-
'under it: verdict regressions, verdict fixes, reclassifications,
|
|
425
|
+
'under it: verdict regressions, verdict fixes, reclassifications, metric deltas, and ' +
|
|
426
|
+
'judge-score drift.')
|
|
427
|
+
.option('--drift <filter>', 'How --compare-to filters JUDGE-SCORE movement. "threshold-ward" (default) reports only a ' +
|
|
428
|
+
'score that crossed the pass threshold or slid down to it — a move that stays above the ' +
|
|
429
|
+
'gate is judge wobble, and printing it trains you to skip the section. ' +
|
|
430
|
+
'"threshold-ward:<0-3>" widens that shoulder to report a slide to N points above the ' +
|
|
431
|
+
'gate too; "min:<1-10>" reports any movement of N+ points either way; "mean" reports ' +
|
|
432
|
+
'only the suite-level mean; "off" reports none.')
|
|
390
433
|
.addHelpText('after', '\n' +
|
|
391
434
|
'Reporters:\n' +
|
|
392
435
|
' text (default) a human-readable PASS/FAIL summary on the console\n' +
|
|
@@ -416,7 +459,8 @@ export function evalCommand(program, commandLineConfigOverrides) {
|
|
|
416
459
|
'\n' +
|
|
417
460
|
' $ gth eval eval/rater.yaml --export-blind blind.json # relabel by a second person\n' +
|
|
418
461
|
' $ gth eval eval/rater.yaml --relabel-diff relabelled.json # then diff it back\n' +
|
|
419
|
-
' $ gth eval eval/rater.yaml -o out/today --compare-to out/yesterday\n'
|
|
462
|
+
' $ gth eval eval/rater.yaml -o out/today --compare-to out/yesterday\n' +
|
|
463
|
+
' $ gth eval eval/js-basics.yaml -o out/today --compare-to out/yesterday --drift mean\n')
|
|
420
464
|
.action(async (suitePaths, options) => {
|
|
421
465
|
try {
|
|
422
466
|
// Specific `.js` subpaths (not the bare package root), matching batchCommand.ts's
|
|
@@ -428,7 +472,23 @@ export function evalCommand(program, commandLineConfigOverrides) {
|
|
|
428
472
|
const { concurrencyHint } = await import('@gaunt-sloth/batch/BatchRunner.js');
|
|
429
473
|
const { resolveReporters } = await import('@gaunt-sloth/batch/reporters/registry.js');
|
|
430
474
|
const { driveReporters } = await import('@gaunt-sloth/batch/reporters/drive.js');
|
|
431
|
-
const { expandSweep, renderComparison } = await import('@gaunt-sloth/batch/evalCompare.js');
|
|
475
|
+
const { expandSweep, renderComparison, parseJudgeDriftFilter } = await import('@gaunt-sloth/batch/evalCompare.js');
|
|
476
|
+
// BATCH-32 — the run-level coverage union printed beside `EVAL TOTAL:`.
|
|
477
|
+
// BATCH-48 — the run floor is graded by `gradeRunToolCoverage`, never by that union: the
|
|
478
|
+
// union stays reporting-only so a suite's own `min:` is never re-applied to it.
|
|
479
|
+
const { aggregateToolCoverage, gradeRunToolCoverage, hasRunToolCoverageSpec } = await import('@gaunt-sloth/batch/toolCoverage.js');
|
|
480
|
+
const { renderToolCoverage } = await import('@gaunt-sloth/batch/toolCoverageRender.js');
|
|
481
|
+
// BATCH-33 — reject a malformed `--drift` BEFORE anything runs. The filter is not consulted
|
|
482
|
+
// until each unit's diff is printed, at the very end of a run that can take minutes and
|
|
483
|
+
// spend real model calls; validating it there would let a typo cost the whole run and then
|
|
484
|
+
// report the flag.
|
|
485
|
+
if (options.drift !== undefined)
|
|
486
|
+
parseJudgeDriftFilter(options.drift);
|
|
487
|
+
// BATCH-48 — the run floor, resolved ONCE, from the base config the run was started with,
|
|
488
|
+
// before any suite runs. See `resolveRunToolCoverage` for why it is never read off a config
|
|
489
|
+
// a suite builds. A malformed floor, or a `-i` / `-c` that does not resolve, throws here →
|
|
490
|
+
// the outer catch → exit 2 with nothing run.
|
|
491
|
+
const runCoverage = resolveRunToolCoverage(commandLineConfigOverrides, await loadConfiguredEvalToolCoverage(commandLineConfigOverrides));
|
|
432
492
|
// The reporter selection (`--reporter`, else the default `['text']`) and the output ROOT are
|
|
433
493
|
// invocation-level — the same for every suite. REPLACES the default: the `--reporter` value
|
|
434
494
|
// when given, else `['text']`.
|
|
@@ -480,6 +540,7 @@ export function evalCommand(program, commandLineConfigOverrides) {
|
|
|
480
540
|
command: 'ask',
|
|
481
541
|
// The header says `eval`; the mode prompt stays `ask`. Do not collapse these two.
|
|
482
542
|
displayCommand: 'eval',
|
|
543
|
+
origin: 'eval',
|
|
483
544
|
sourcePrefix: 'EVAL',
|
|
484
545
|
wrapBlockPrefix: 'message',
|
|
485
546
|
wrapPrefix: 'user message',
|
|
@@ -548,7 +609,12 @@ export function evalCommand(program, commandLineConfigOverrides) {
|
|
|
548
609
|
// from this config, exactly as for the external targets.
|
|
549
610
|
baseConfig = await initConfigForCell(commandLineConfigOverrides, sweepCell);
|
|
550
611
|
const { buildRaterClassifier } = await import('@gaunt-sloth/batch/raterTarget.js');
|
|
551
|
-
|
|
612
|
+
// [[BATCH-31]] — and the cell's PROMPT ARM, which is the one override that does not
|
|
613
|
+
// travel through `baseConfig`. It is handed over separately on purpose: a note omission
|
|
614
|
+
// that could ride the config would be settable wherever a config is, which is exactly
|
|
615
|
+
// the reachability the node forbids. `undefined` when no axis declares one, which is
|
|
616
|
+
// every suite written before this and the whole `rung × model` sweep.
|
|
617
|
+
classify = await buildRaterClassifier(parsedSuite.target, baseConfig, sweepCell?.notes !== undefined ? { notes: sweepCell.notes } : undefined);
|
|
552
618
|
}
|
|
553
619
|
else {
|
|
554
620
|
// gth-agent, NO identities (unchanged): one runCell/runConversation under the invoked
|
|
@@ -640,6 +706,17 @@ export function evalCommand(program, commandLineConfigOverrides) {
|
|
|
640
706
|
// so a gate breached in one suite of many would otherwise be lost between the per-suite
|
|
641
707
|
// report that printed it and the exit code that should have honoured it.
|
|
642
708
|
let anyMetricGateFailed = false;
|
|
709
|
+
// BATCH-32 — each suite's coverage report, kept for the run-level union below and tracked
|
|
710
|
+
// here for the same reason `anyMetricGateFailed` is: the combined summary is a bare
|
|
711
|
+
// concatenation of cases and carries no per-suite coverage block.
|
|
712
|
+
const coverageReports = [];
|
|
713
|
+
let anyCoverageGateFailed = false;
|
|
714
|
+
// BATCH-48 — one grading of the one run floor resolved before the loop. Both call sites —
|
|
715
|
+
// the TOTAL block and the run line — go through it, so they cannot grade the run twice and
|
|
716
|
+
// disagree about which denominator the exit code honoured.
|
|
717
|
+
const runGrade = (aggregate) => runCoverage.spec && hasRunToolCoverageSpec(runCoverage.spec)
|
|
718
|
+
? gradeRunToolCoverage(aggregate, runCoverage.spec, runCoverage.source)
|
|
719
|
+
: undefined;
|
|
643
720
|
for (const suite of suites) {
|
|
644
721
|
let suiteOutputDir = outputRoot;
|
|
645
722
|
if (!single) {
|
|
@@ -688,11 +765,23 @@ export function evalCommand(program, commandLineConfigOverrides) {
|
|
|
688
765
|
if ((summary.classification?.gateFailures.length ?? 0) > 0) {
|
|
689
766
|
anyMetricGateFailed = true;
|
|
690
767
|
}
|
|
768
|
+
// BATCH-32 — a suite's coverage report feeds two separate things, and keeping them
|
|
769
|
+
// separate is the point. Its GATE is graded against the suite that declared it (the
|
|
770
|
+
// `metrics:` precedent) and ORed into the run's exit here; its NUMBERS join the
|
|
771
|
+
// run-level union printed beside `EVAL TOTAL:`. Re-applying a declared floor to that
|
|
772
|
+
// union would make the same suite pass alone and fail inside a directory, with
|
|
773
|
+
// nothing in either output saying the threshold had moved.
|
|
774
|
+
if (summary.toolCoverage) {
|
|
775
|
+
coverageReports.push(summary.toolCoverage);
|
|
776
|
+
if (summary.toolCoverage.gateFailures.length > 0) {
|
|
777
|
+
anyCoverageGateFailed = true;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
691
780
|
if (cell)
|
|
692
781
|
columns.push({ name: cell.name, summary });
|
|
693
782
|
// BATCH-25 — run-over-run diff against the matching unit under the baseline root.
|
|
694
783
|
if (options.compareTo !== undefined) {
|
|
695
|
-
await printRunDiff(options.compareTo, outputRoot, cellOutputDir, summary);
|
|
784
|
+
await printRunDiff(options.compareTo, outputRoot, cellOutputDir, summary, options.drift);
|
|
696
785
|
}
|
|
697
786
|
}
|
|
698
787
|
// One comparison table across the cells, not N unrelated reports — the whole point of
|
|
@@ -745,6 +834,57 @@ export function evalCommand(program, commandLineConfigOverrides) {
|
|
|
745
834
|
else {
|
|
746
835
|
displayWarning(totalLine);
|
|
747
836
|
}
|
|
837
|
+
// BATCH-32 — the run-level coverage figure, beside `EVAL TOTAL:` and for the same reason
|
|
838
|
+
// that line exists. Coverage is a DIRECTORY-level property: one suite covering 3 tools is
|
|
839
|
+
// fine if its sibling covers the other 38, so the union across the run is the number that
|
|
840
|
+
// answers "is this surface tested", and each suite's own block above is the detail. Like
|
|
841
|
+
// `EVAL TOTAL:` it is printed only for a multi-suite run — with one suite the reporter's
|
|
842
|
+
// block already IS the aggregate, and repeating it would imply a second measurement.
|
|
843
|
+
//
|
|
844
|
+
// BATCH-48 — when a run floor is set, the TOTAL block prints the figure that floor graded
|
|
845
|
+
// (the aggregate minus the run-level `waive`), not the ungraded union. Printing the union
|
|
846
|
+
// and then a different number below it would put two denominators on screen with nothing
|
|
847
|
+
// saying which one the exit code honoured.
|
|
848
|
+
const aggregate = aggregateToolCoverage(coverageReports);
|
|
849
|
+
const graded = runGrade(aggregate);
|
|
850
|
+
const printed = graded?.report ?? aggregate;
|
|
851
|
+
if (printed) {
|
|
852
|
+
for (const line of renderToolCoverage(printed, { scope: 'TOTAL' })) {
|
|
853
|
+
display(line);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
// BATCH-48 — the run floor, graded independently of every suite's own `min:` and printed for
|
|
858
|
+
// ANY run that declared one, including a run of one suite. The multi-suite-only rule above is
|
|
859
|
+
// about printing the TOTAL block; it must not stop a set floor from being graded, and a
|
|
860
|
+
// single-suite run still has to say which threshold it was graded against and where it came
|
|
861
|
+
// from. The source line is what makes the two floors distinguishable: it names the threshold
|
|
862
|
+
// and the config it was read from, which neither suite's own block states.
|
|
863
|
+
const grade = runGrade(aggregateToolCoverage(coverageReports));
|
|
864
|
+
if (grade) {
|
|
865
|
+
display(`TOOL COVERAGE RUN: ${grade.sourceLine}`);
|
|
866
|
+
// A single-suite run prints no TOTAL block, so the graded figure has to appear here or the
|
|
867
|
+
// source line names a threshold the reader never sees applied. A multi-suite run already
|
|
868
|
+
// printed it above; repeating it would look like a second measurement.
|
|
869
|
+
if (grade.report && suites.length === 1) {
|
|
870
|
+
for (const line of renderToolCoverage(grade.report)) {
|
|
871
|
+
display(line);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
for (const warning of grade.warnings)
|
|
875
|
+
displayWarning(` ! ${warning}`);
|
|
876
|
+
for (const failure of grade.gateFailures) {
|
|
877
|
+
displayWarning(`TOOL COVERAGE GATE FAILED — ${failure}`);
|
|
878
|
+
}
|
|
879
|
+
if (grade.gateFailures.length > 0)
|
|
880
|
+
anyCoverageGateFailed = true;
|
|
881
|
+
}
|
|
882
|
+
else if (!runCoverage.hasBaseConfig) {
|
|
883
|
+
// BATCH-48 — no base config (a matrix-only project started with no `-i`), so no floor.
|
|
884
|
+
// Said rather than left silent: a reader who set the floor on an identity's profile would
|
|
885
|
+
// otherwise see a green run and conclude it held, when it was never read — the floor comes
|
|
886
|
+
// only from the base config, never from an identity's.
|
|
887
|
+
display('TOOL COVERAGE RUN: no evalToolCoverage floor — the run was started with no base config');
|
|
748
888
|
}
|
|
749
889
|
// BATCH-24: cases run one at a time unless the user asks for more, so say so once at the
|
|
750
890
|
// very end of the whole invocation (not per suite) — otherwise a slow multi-case run looks
|
|
@@ -766,9 +906,12 @@ export function evalCommand(program, commandLineConfigOverrides) {
|
|
|
766
906
|
}
|
|
767
907
|
// BATCH-25 — a breached hard metric gate forces exit 1 even when every case passed. It is a
|
|
768
908
|
// product signal, never a harness one, so a harness error still dominates it.
|
|
909
|
+
// BATCH-32 — a breached coverage floor or an unmet `require:` is the same kind of signal and
|
|
910
|
+
// is ORed in here, because the combined summary carries no per-suite coverage block and a
|
|
911
|
+
// gate breached in one suite of many would otherwise be printed and then not honoured.
|
|
769
912
|
const exitCode = anyHarnessError
|
|
770
913
|
? 2
|
|
771
|
-
: anyMetricGateFailed
|
|
914
|
+
: anyMetricGateFailed || anyCoverageGateFailed
|
|
772
915
|
? Math.max(classifyEvalExit(combined), 1)
|
|
773
916
|
: classifyEvalExit(combined);
|
|
774
917
|
if (exitCode !== 0) {
|