@gaunt-sloth/review 2.0.0-alpha.28 → 2.0.0-alpha.29
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.
|
@@ -5,4 +5,16 @@ export interface ReviewContext {
|
|
|
5
5
|
/** PR number under review; undefined in `gth pr` discovery mode (current branch's PR). */
|
|
6
6
|
prId?: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Run a review of `diff` and print the verdict.
|
|
10
|
+
*
|
|
11
|
+
* @param source - Source label, used for the output file name.
|
|
12
|
+
* @param _preamble - Ignored (GS2-79); see the body comment. Retained positionally so existing
|
|
13
|
+
* callers need no change, exactly as `runSingleShot` retains its own.
|
|
14
|
+
* @param diff - The content under review.
|
|
15
|
+
* @param config - The resolved config.
|
|
16
|
+
* @param command - `review` or `pr`; selects the command config and the agent's mode prompt.
|
|
17
|
+
* @param resolvers - Optional agent resolvers (tools/middleware).
|
|
18
|
+
* @param reviewContext - Extra review context (binds GitHub-only tools to the PR under review).
|
|
19
|
+
*/
|
|
20
|
+
export declare function review(source: string, _preamble: string, diff: string, config: GthConfig, command?: 'pr' | 'review', resolvers?: AgentResolvers, reviewContext?: ReviewContext): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultStatusCallback, displayDebug, displayError, displayInfo, displaySuccess, displayWarning, flushSessionLog, initSessionLogging, stopSessionLogging, } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
2
2
|
import { getCommandOutputFilePath } from '#src/utils/fileUtils.js';
|
|
3
|
-
import { HumanMessage
|
|
3
|
+
import { HumanMessage } from '@langchain/core/messages';
|
|
4
4
|
import { GthAgentRunner } from '@gaunt-sloth/core/core/GthAgentRunner.js';
|
|
5
5
|
import { MemorySaver } from '@langchain/langgraph';
|
|
6
6
|
import { ProgressIndicator } from '@gaunt-sloth/core/utils/ProgressIndicator.js';
|
|
@@ -8,10 +8,37 @@ import { createReviewRateMiddleware, REVIEW_RATE_ARTIFACT_KEY, } from '#src/midd
|
|
|
8
8
|
import { deleteArtifact, getArtifact } from '@gaunt-sloth/core/state/artifactStore.js';
|
|
9
9
|
import { setExitCode } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
10
10
|
import { get as getGhReadFileTool, GTH_GH_READ_FILE_TOOL_NAME } from '#src/tools/ghReadFileTool.js';
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Run a review of `diff` and print the verdict.
|
|
13
|
+
*
|
|
14
|
+
* @param source - Source label, used for the output file name.
|
|
15
|
+
* @param _preamble - Ignored (GS2-79); see the body comment. Retained positionally so existing
|
|
16
|
+
* callers need no change, exactly as `runSingleShot` retains its own.
|
|
17
|
+
* @param diff - The content under review.
|
|
18
|
+
* @param config - The resolved config.
|
|
19
|
+
* @param command - `review` or `pr`; selects the command config and the agent's mode prompt.
|
|
20
|
+
* @param resolvers - Optional agent resolvers (tools/middleware).
|
|
21
|
+
* @param reviewContext - Extra review context (binds GitHub-only tools to the PR under review).
|
|
22
|
+
*/
|
|
23
|
+
export async function review(source,
|
|
24
|
+
// GS2-79: `_preamble` is retained for signature stability but is NO LONGER injected as a leading
|
|
25
|
+
// SystemMessage. Both agent backends COMPOSE the full system prompt themselves — backstory +
|
|
26
|
+
// guidelines + the per-command mode prompt + system prompt — and hand it to createAgent as
|
|
27
|
+
// `systemPrompt`; for `review`/`pr` that mode prompt IS the review instructions (core's
|
|
28
|
+
// `readModePrompt`). Passing this preamble as well produced TWO system messages, which
|
|
29
|
+
// `@langchain/anthropic` rejects outright ("System messages are only permitted as the first
|
|
30
|
+
// passed message"), breaking every `gth review` and `gth pr` run on Anthropic on both backends
|
|
31
|
+
// (Google/OpenAI silently merged them, so only Anthropic showed it). The same removal was made in
|
|
32
|
+
// `runSingleShot` and `conversation` for the same reason.
|
|
33
|
+
//
|
|
34
|
+
// Dropping it is content-preserving ONLY because the backends now select the review instructions:
|
|
35
|
+
// before that they composed the CHAT prompt for `review`/`pr`, so removing the preamble alone
|
|
36
|
+
// would have silently turned a review into a chat. `GthPromptParity.spec.ts` pins that.
|
|
37
|
+
_preamble, diff, config, command = 'review', resolvers, reviewContext) {
|
|
12
38
|
const progressIndicator = config.streamOutput ? undefined : new ProgressIndicator('Reviewing.');
|
|
13
39
|
try {
|
|
14
|
-
|
|
40
|
+
// Only the human turn: the agent supplies the system prompt via `createAgent({ systemPrompt })`.
|
|
41
|
+
const messages = [new HumanMessage(diff)];
|
|
15
42
|
// REL-2: optionally give the review agent a `gh api` file-read tool so it can fetch the FULL
|
|
16
43
|
// contents of a file when the PR diff truncates large changes. Only added in a GitHub PR
|
|
17
44
|
// context (the content source resolves to GitHub); a graceful no-op otherwise. Reads through
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewModule.js","sourceRoot":"","sources":["../../src/modules/reviewModule.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"reviewModule.js","sourceRoot":"","sources":["../../src/modules/reviewModule.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,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;IAC5E,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAE/B,IAAI,MAAM,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,cAAc,CAAC,QAAQ,WAAW,EAAE,CAAC,CAAC;IACxC,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,QAAQ,WAAW,EAAE,CAAC,CAAC;QACpC,IAAI,UAAU,CAAC,iBAAiB,IAAI,IAAI,EAAE,CAAC;YACzC,WAAW,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaunt-sloth/review",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.29",
|
|
4
4
|
"description": "Review functionality for Gaunt Sloth",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Andrew Kondratev",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@langchain/langgraph": "^1.4.8",
|
|
39
39
|
"langchain": "^1.5.4",
|
|
40
40
|
"zod": "^4.4.3",
|
|
41
|
-
"@gaunt-sloth/core": "2.0.0-alpha.
|
|
41
|
+
"@gaunt-sloth/core": "2.0.0-alpha.29"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"./dist/*",
|