@joeytheman/gemini-mcp-tool 1.3.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -35
- package/dist/__tests__/agyModelSteps.test.d.ts +2 -0
- package/dist/__tests__/agyModelSteps.test.d.ts.map +1 -0
- package/dist/__tests__/agyModelSteps.test.js +58 -0
- package/dist/__tests__/agyModelSteps.test.js.map +1 -0
- package/dist/__tests__/ask-gemini.test.js +99 -37
- package/dist/__tests__/ask-gemini.test.js.map +1 -1
- package/dist/__tests__/capture-script.chromium.test.d.ts +2 -0
- package/dist/__tests__/capture-script.chromium.test.d.ts.map +1 -0
- package/dist/__tests__/capture-script.chromium.test.js +235 -0
- package/dist/__tests__/capture-script.chromium.test.js.map +1 -0
- package/dist/__tests__/layout-snippet.chromium.test.d.ts +2 -0
- package/dist/__tests__/layout-snippet.chromium.test.d.ts.map +1 -0
- package/dist/__tests__/layout-snippet.chromium.test.js +333 -0
- package/dist/__tests__/layout-snippet.chromium.test.js.map +1 -0
- package/dist/__tests__/layout-snippet.test.d.ts +2 -0
- package/dist/__tests__/layout-snippet.test.d.ts.map +1 -0
- package/dist/__tests__/layout-snippet.test.js +12 -0
- package/dist/__tests__/layout-snippet.test.js.map +1 -0
- package/dist/__tests__/live-pass.test.d.ts +2 -0
- package/dist/__tests__/live-pass.test.d.ts.map +1 -0
- package/dist/__tests__/live-pass.test.js +1249 -0
- package/dist/__tests__/live-pass.test.js.map +1 -0
- package/dist/__tests__/screen-review.test.d.ts +2 -0
- package/dist/__tests__/screen-review.test.d.ts.map +1 -0
- package/dist/__tests__/screen-review.test.js +553 -0
- package/dist/__tests__/screen-review.test.js.map +1 -0
- package/dist/__tests__/server-progress.test.d.ts +2 -0
- package/dist/__tests__/server-progress.test.d.ts.map +1 -0
- package/dist/__tests__/server-progress.test.js +63 -0
- package/dist/__tests__/server-progress.test.js.map +1 -0
- package/dist/__tests__/server.test.js +17 -19
- package/dist/__tests__/server.test.js.map +1 -1
- package/dist/__tests__/simple-tools.test.d.ts +2 -0
- package/dist/__tests__/simple-tools.test.d.ts.map +1 -0
- package/dist/__tests__/simple-tools.test.js +30 -0
- package/dist/__tests__/simple-tools.test.js.map +1 -0
- package/dist/__tests__/tools.test.js +91 -0
- package/dist/__tests__/tools.test.js.map +1 -1
- package/dist/__tests__/utils/agyExecutor.test.d.ts +2 -0
- package/dist/__tests__/utils/agyExecutor.test.d.ts.map +1 -0
- package/dist/__tests__/utils/agyExecutor.test.js +731 -0
- package/dist/__tests__/utils/agyExecutor.test.js.map +1 -0
- package/dist/__tests__/utils/agyTranscriptRecovery.test.d.ts +2 -0
- package/dist/__tests__/utils/agyTranscriptRecovery.test.d.ts.map +1 -0
- package/dist/__tests__/utils/agyTranscriptRecovery.test.js +127 -0
- package/dist/__tests__/utils/agyTranscriptRecovery.test.js.map +1 -0
- package/dist/__tests__/utils/chunkCache.test.js +26 -2
- package/dist/__tests__/utils/chunkCache.test.js.map +1 -1
- package/dist/__tests__/utils/commandExecutor.test.js +185 -7
- package/dist/__tests__/utils/commandExecutor.test.js.map +1 -1
- package/dist/__tests__/utils/fileReferences.test.d.ts +2 -0
- package/dist/__tests__/utils/fileReferences.test.d.ts.map +1 -0
- package/dist/__tests__/utils/fileReferences.test.js +87 -0
- package/dist/__tests__/utils/fileReferences.test.js.map +1 -0
- package/dist/__tests__/utils/gitStatusGuard.test.d.ts +2 -0
- package/dist/__tests__/utils/gitStatusGuard.test.d.ts.map +1 -0
- package/dist/__tests__/utils/gitStatusGuard.test.js +106 -0
- package/dist/__tests__/utils/gitStatusGuard.test.js.map +1 -0
- package/dist/__tests__/utils/progressUpdates.test.d.ts +2 -0
- package/dist/__tests__/utils/progressUpdates.test.d.ts.map +1 -0
- package/dist/__tests__/utils/progressUpdates.test.js +62 -0
- package/dist/__tests__/utils/progressUpdates.test.js.map +1 -0
- package/dist/__tests__/utils/responseCache.test.js +31 -11
- package/dist/__tests__/utils/responseCache.test.js.map +1 -1
- package/dist/__tests__/utils/test-helpers.d.ts +4 -0
- package/dist/__tests__/utils/test-helpers.d.ts.map +1 -1
- package/dist/__tests__/utils/test-helpers.js +16 -0
- package/dist/__tests__/utils/test-helpers.js.map +1 -1
- package/dist/constants.d.ts +91 -26
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +101 -28
- package/dist/constants.js.map +1 -1
- package/dist/index.js +20 -95
- package/dist/index.js.map +1 -1
- package/dist/layoutCheckSnippet.generated.d.ts +2 -0
- package/dist/layoutCheckSnippet.generated.d.ts.map +1 -0
- package/dist/layoutCheckSnippet.generated.js +3 -0
- package/dist/layoutCheckSnippet.generated.js.map +1 -0
- package/dist/tools/ask-gemini.tool.d.ts +34 -0
- package/dist/tools/ask-gemini.tool.d.ts.map +1 -1
- package/dist/tools/ask-gemini.tool.js +40 -23
- package/dist/tools/ask-gemini.tool.js.map +1 -1
- package/dist/tools/brainstorm.tool.d.ts.map +1 -1
- package/dist/tools/brainstorm.tool.js +7 -5
- package/dist/tools/brainstorm.tool.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/live-pass.tool.d.ts +206 -0
- package/dist/tools/live-pass.tool.d.ts.map +1 -0
- package/dist/tools/live-pass.tool.js +670 -0
- package/dist/tools/live-pass.tool.js.map +1 -0
- package/dist/tools/registry.d.ts +6 -4
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +14 -11
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/screen-review.tool.d.ts +124 -0
- package/dist/tools/screen-review.tool.d.ts.map +1 -0
- package/dist/tools/screen-review.tool.js +449 -0
- package/dist/tools/screen-review.tool.js.map +1 -0
- package/dist/tools/simple-tools.d.ts.map +1 -1
- package/dist/tools/simple-tools.js +9 -3
- package/dist/tools/simple-tools.js.map +1 -1
- package/dist/utils/agyExecutor.d.ts +76 -0
- package/dist/utils/agyExecutor.d.ts.map +1 -0
- package/dist/utils/agyExecutor.js +449 -0
- package/dist/utils/agyExecutor.js.map +1 -0
- package/dist/utils/agyModelSteps.d.ts +5 -0
- package/dist/utils/agyModelSteps.d.ts.map +1 -0
- package/dist/utils/agyModelSteps.js +33 -0
- package/dist/utils/agyModelSteps.js.map +1 -0
- package/dist/utils/agyReport.d.ts +19 -0
- package/dist/utils/agyReport.d.ts.map +1 -0
- package/dist/utils/agyReport.js +62 -0
- package/dist/utils/agyReport.js.map +1 -0
- package/dist/utils/agyTranscriptRecovery.d.ts +16 -0
- package/dist/utils/agyTranscriptRecovery.d.ts.map +1 -0
- package/dist/utils/agyTranscriptRecovery.js +149 -0
- package/dist/utils/agyTranscriptRecovery.js.map +1 -0
- package/dist/utils/artifactFile.d.ts +6 -0
- package/dist/utils/artifactFile.d.ts.map +1 -0
- package/dist/utils/artifactFile.js +55 -0
- package/dist/utils/artifactFile.js.map +1 -0
- package/dist/utils/captureScript.d.ts +24 -0
- package/dist/utils/captureScript.d.ts.map +1 -0
- package/dist/utils/captureScript.js +83 -0
- package/dist/utils/captureScript.js.map +1 -0
- package/dist/utils/chunkCache.d.ts.map +1 -1
- package/dist/utils/chunkCache.js +19 -5
- package/dist/utils/chunkCache.js.map +1 -1
- package/dist/utils/commandExecutor.d.ts +7 -1
- package/dist/utils/commandExecutor.d.ts.map +1 -1
- package/dist/utils/commandExecutor.js +162 -22
- package/dist/utils/commandExecutor.js.map +1 -1
- package/dist/utils/fileReferences.d.ts +45 -0
- package/dist/utils/fileReferences.d.ts.map +1 -0
- package/dist/utils/fileReferences.js +169 -0
- package/dist/utils/fileReferences.js.map +1 -0
- package/dist/utils/gitCheckout.d.ts +14 -0
- package/dist/utils/gitCheckout.d.ts.map +1 -0
- package/dist/utils/gitCheckout.js +36 -0
- package/dist/utils/gitCheckout.js.map +1 -0
- package/dist/utils/gitStatusGuard.d.ts +35 -0
- package/dist/utils/gitStatusGuard.d.ts.map +1 -0
- package/dist/utils/gitStatusGuard.js +82 -0
- package/dist/utils/gitStatusGuard.js.map +1 -0
- package/dist/utils/layoutCheck.d.ts +58 -0
- package/dist/utils/layoutCheck.d.ts.map +1 -0
- package/dist/utils/layoutCheck.js +84 -0
- package/dist/utils/layoutCheck.js.map +1 -0
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +0 -6
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/progressUpdates.d.ts +14 -0
- package/dist/utils/progressUpdates.d.ts.map +1 -0
- package/dist/utils/progressUpdates.js +40 -0
- package/dist/utils/progressUpdates.js.map +1 -0
- package/dist/utils/responseCache.d.ts +3 -3
- package/dist/utils/responseCache.d.ts.map +1 -1
- package/dist/utils/responseCache.js +11 -6
- package/dist/utils/responseCache.js.map +1 -1
- package/package.json +19 -16
- package/dist/__tests__/utils/geminiExecutor.test.d.ts +0 -2
- package/dist/__tests__/utils/geminiExecutor.test.d.ts.map +0 -1
- package/dist/__tests__/utils/geminiExecutor.test.js +0 -337
- package/dist/__tests__/utils/geminiExecutor.test.js.map +0 -1
- package/dist/utils/geminiExecutor.d.ts +0 -17
- package/dist/utils/geminiExecutor.d.ts.map +0 -1
- package/dist/utils/geminiExecutor.js +0 -238
- package/dist/utils/geminiExecutor.js.map +0 -1
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import { formatZodIssues } from './registry.js';
|
|
5
|
+
import { deniedActionsSummary, executeAgyJson, formatAgyUsageLine, formatConversationLine, printTimeoutSchema, toAgyJsonSchema, } from '../utils/agyExecutor.js';
|
|
6
|
+
import { bulletList, section, renderUnparsableEnvelope, formatWorkingTreeSection, failWithWorkingTree } from '../utils/agyReport.js';
|
|
7
|
+
import { isWithin, resolveWorkingDirectory, realpathOfExistingPrefix } from '../utils/fileReferences.js';
|
|
8
|
+
import { snapshotWorkingTree, diffWorkingTree } from '../utils/gitStatusGuard.js';
|
|
9
|
+
import { resolveMergeBase } from '../utils/gitCheckout.js';
|
|
10
|
+
import { hasImageSignature } from '../utils/artifactFile.js';
|
|
11
|
+
import { countAgyModelSteps, formatModelSteps } from '../utils/agyModelSteps.js';
|
|
12
|
+
import { ERROR_MESSAGES, LIVE_PASS, MODELS, MODEL_CHOICE_DESCRIPTION, PRINT_TIMEOUT_CEILING_NOTE } from '../constants.js';
|
|
13
|
+
const WHITESPACE = /\s/;
|
|
14
|
+
// ---------------------------------------------------------------- arguments
|
|
15
|
+
function fileExists(candidate) {
|
|
16
|
+
try {
|
|
17
|
+
return fs.statSync(candidate).isFile();
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const screenReviewArgsSchema = z.object({
|
|
24
|
+
mode: z.enum(['review', 'plan']).describe("'review' judges screenshots after a live pass. 'plan' inventories a route file before any screenshot exists and returns no verdict."),
|
|
25
|
+
instructions: z.string().min(1).describe("The caller's reviewer prompt, verbatim. Passed through unchanged so rule citations stay exact."),
|
|
26
|
+
context: z.string().optional().describe("Optional extra context: composition contract, changed-file list, issue text."),
|
|
27
|
+
workingDirectory: z.string().min(1).describe("Absolute path to the checkout the instructions cite. Used as the agy cwd and workspace root, so repository-relative rule paths resolve."),
|
|
28
|
+
images: z.array(z.string()).optional().describe("review mode only: absolute paths to the PNG/JPEG frames to judge. Each must exist."),
|
|
29
|
+
changedRoutes: z.array(z.string()).optional().describe("review mode: repo-relative route/component files the diff touched (from `git diff --name-only`). Every changed screen file (under an `app/` directory) that no image shows makes the review REQUEST_CHANGES; a changed file under `components/` only warns."),
|
|
30
|
+
routeFile: z.string().optional().describe("plan mode only: absolute path to the route/screen source file to inventory. Must exist inside workingDirectory."),
|
|
31
|
+
baseRef: z.string().min(1).optional().describe("review mode only: the git ref the diff under review is based on, such as 'origin/main'. Resolved in code to its merge base with HEAD (the call fails when it does not resolve); Gemini may then run read-only `git diff <merge-base>...HEAD` and `git show <merge-base>:<path>` to judge severity by the branch's own diff. That needs yolo: true, because headless agy denies the shell otherwise. Without baseRef Gemini runs no git at all."),
|
|
32
|
+
model: z.string().default(MODELS.MEDIUM).describe(`${MODEL_CHOICE_DESCRIPTION} Defaults to '${MODELS.MEDIUM}'.`),
|
|
33
|
+
printTimeout: printTimeoutSchema.default(LIVE_PASS.SCREEN_REVIEW_PRINT_TIMEOUT).describe(`agy --print-timeout for the review. ${PRINT_TIMEOUT_CEILING_NOTE}`),
|
|
34
|
+
yolo: z.boolean().default(false).describe("Pass --dangerously-skip-permissions. Defaults to false because a review only reads. Set it to true when the instructions ask Gemini to read repository files that are not passed as images: it reaches for a shell to do that, headless agy denies the shell, and the call then fails naming the denied action."),
|
|
35
|
+
conversationId: z.string().min(1).optional().describe("Resume a previous review so round 2 keeps round 1's visual analysis."),
|
|
36
|
+
}).superRefine((value, ctx) => {
|
|
37
|
+
if (value.mode === 'review') {
|
|
38
|
+
if (value.routeFile) {
|
|
39
|
+
ctx.addIssue({ code: 'custom', message: 'routeFile is plan mode only', path: ['routeFile'] });
|
|
40
|
+
}
|
|
41
|
+
if (!value.images || value.images.length === 0) {
|
|
42
|
+
ctx.addIssue({ code: 'custom', message: ERROR_MESSAGES.SCREEN_REVIEW_NO_IMAGES, path: ['images'] });
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
value.images.forEach((image, index) => {
|
|
46
|
+
if (!path.isAbsolute(image)) {
|
|
47
|
+
ctx.addIssue({ code: 'custom', message: `image path must be absolute: ${image}`, path: ['images', index] });
|
|
48
|
+
}
|
|
49
|
+
else if (WHITESPACE.test(image)) {
|
|
50
|
+
ctx.addIssue({ code: 'custom', message: `${ERROR_MESSAGES.UNREFERENCEABLE_PATH}: ${image}`, path: ['images', index] });
|
|
51
|
+
}
|
|
52
|
+
else if (!fileExists(image)) {
|
|
53
|
+
ctx.addIssue({ code: 'custom', message: `${ERROR_MESSAGES.SCREEN_REVIEW_IMAGE_MISSING}: ${image}`, path: ['images', index] });
|
|
54
|
+
}
|
|
55
|
+
else if (!hasImageSignature(image)) {
|
|
56
|
+
ctx.addIssue({ code: 'custom', message: `image must be a PNG or JPEG: ${image}`, path: ['images', index] });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (value.images) {
|
|
62
|
+
ctx.addIssue({ code: 'custom', message: 'images is review mode only', path: ['images'] });
|
|
63
|
+
}
|
|
64
|
+
if (value.baseRef !== undefined) {
|
|
65
|
+
ctx.addIssue({ code: 'custom', message: 'baseRef is review mode only', path: ['baseRef'] });
|
|
66
|
+
}
|
|
67
|
+
const routeFile = value.routeFile;
|
|
68
|
+
if (!routeFile || !path.isAbsolute(routeFile) || !fileExists(routeFile)) {
|
|
69
|
+
ctx.addIssue({ code: 'custom', message: ERROR_MESSAGES.SCREEN_REVIEW_ROUTE_FILE, path: ['routeFile'] });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (WHITESPACE.test(routeFile)) {
|
|
73
|
+
ctx.addIssue({ code: 'custom', message: `${ERROR_MESSAGES.UNREFERENCEABLE_PATH}: ${routeFile}`, path: ['routeFile'] });
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// Realpath'd on both sides: execute resolves workingDirectory the same way,
|
|
77
|
+
// so a symlinked spelling must not reject a route file that is really inside.
|
|
78
|
+
if (!isWithin(realpathOfExistingPrefix(value.workingDirectory), realpathOfExistingPrefix(routeFile))) {
|
|
79
|
+
ctx.addIssue({
|
|
80
|
+
code: 'custom',
|
|
81
|
+
message: `${ERROR_MESSAGES.SCREEN_REVIEW_ROUTE_FILE}. '${routeFile}' is outside the working directory.`,
|
|
82
|
+
path: ['routeFile'],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
// ----------------------------------------------------------- result schemas
|
|
87
|
+
const reviewFindingSchema = z.object({
|
|
88
|
+
severity: z.enum(['BLOCKER', 'MAJOR', 'MINOR']),
|
|
89
|
+
confirmed: z.boolean().describe("True only when you read the line or pixel yourself and it is really there. When unsure, file it MINOR instead of guessing."),
|
|
90
|
+
location: z.string().describe("Where it is: the region of the screen, and the file:line when you verified one."),
|
|
91
|
+
observed: z.string().describe("What the image shows. This is the first thing the reader sees, so describe the image, not the rule."),
|
|
92
|
+
rule: z.string().describe("The rule or contract this violates, cited as the instructions cite it."),
|
|
93
|
+
fix: z.string(),
|
|
94
|
+
});
|
|
95
|
+
export const screenReviewResultSchema = z.object({
|
|
96
|
+
verdict: z.enum(['APPROVE', 'REQUEST_CHANGES']),
|
|
97
|
+
screens: z.array(z.object({
|
|
98
|
+
file: z.string().describe("The image path you were given, copied exactly."),
|
|
99
|
+
subject: z.string().describe("Which screen and state this image shows."),
|
|
100
|
+
route_file: z.string().describe("Repo-relative path of the route or screen source file this image shows, chosen from the changed files when one fits. Empty string when you genuinely cannot tell."),
|
|
101
|
+
inventory: z.array(z.string()).describe("Every control, label and region visible in this image. Enumerate before judging."),
|
|
102
|
+
findings: z.array(reviewFindingSchema),
|
|
103
|
+
})),
|
|
104
|
+
cross_screen_findings: z.array(reviewFindingSchema),
|
|
105
|
+
summary: z.string(),
|
|
106
|
+
});
|
|
107
|
+
export const screenPlanResultSchema = z.object({
|
|
108
|
+
route_file: z.string(),
|
|
109
|
+
controls: z.array(z.object({
|
|
110
|
+
control: z.string(),
|
|
111
|
+
primitive: z.string(),
|
|
112
|
+
placement: z.string(),
|
|
113
|
+
promoted: z.boolean(),
|
|
114
|
+
verb_today: z.string(),
|
|
115
|
+
verb_per_rule: z.string(),
|
|
116
|
+
operation: z.string(),
|
|
117
|
+
capability: z.string(),
|
|
118
|
+
scope: z.string(),
|
|
119
|
+
})),
|
|
120
|
+
top_slot_priority: z.array(z.string()),
|
|
121
|
+
hand_rolls_to_delete: z.array(z.object({ line: z.string(), primitive: z.string() })),
|
|
122
|
+
notes: z.string(),
|
|
123
|
+
});
|
|
124
|
+
export const SCREEN_REVIEW_RESULT_JSON_SCHEMA = toAgyJsonSchema(screenReviewResultSchema);
|
|
125
|
+
export const SCREEN_PLAN_RESULT_JSON_SCHEMA = toAgyJsonSchema(screenPlanResultSchema);
|
|
126
|
+
const SCHEMA_TEXT = {
|
|
127
|
+
review: JSON.stringify(SCREEN_REVIEW_RESULT_JSON_SCHEMA),
|
|
128
|
+
plan: JSON.stringify(SCREEN_PLAN_RESULT_JSON_SCHEMA),
|
|
129
|
+
};
|
|
130
|
+
// ------------------------------------------------------------------- prompt
|
|
131
|
+
function readingSection(config) {
|
|
132
|
+
const routeFile = config.mode === 'plan' ? 'the route file above' : 'the route file each image shows';
|
|
133
|
+
const git = config.mode === 'review' && config.mergeBase
|
|
134
|
+
? `The diff under review is ${config.mergeBase}...HEAD (${config.mergeBase} is the merge base of the caller's base ref and HEAD, resolved for you). Severity follows that diff: you may run read-only \`git diff ${config.mergeBase}...HEAD\`, optionally with \`--name-only\` and \`-- <paths>\`, and \`git show ${config.mergeBase}:<path>\`. No other git command.`
|
|
135
|
+
: 'Never run git.';
|
|
136
|
+
return `## Reading code (bounded)
|
|
137
|
+
Read only the code the checklist needs as evidence, and only the lines you need:
|
|
138
|
+
- ${routeFile}, and the components and UI primitives it renders;
|
|
139
|
+
- the changed files listed above or named in the context;
|
|
140
|
+
- the producer lines (serializers, services, hooks) behind a capability or viewer-scoped field the checklist asks about;
|
|
141
|
+
- the rule files and READMEs the instructions cite, and the board or design files they name.
|
|
142
|
+
${git}
|
|
143
|
+
Never run tests, Jest, npm or any package script. Never read node_modules, release notes or changelog fragments. Never re-read the file the instructions came from: they are above, verbatim.
|
|
144
|
+
`;
|
|
145
|
+
}
|
|
146
|
+
export function buildScreenReviewPrompt(config) {
|
|
147
|
+
// The heading is explicit and always present: a reviewer checklist that files
|
|
148
|
+
// "no composition contract" as a finding must be able to see that one WAS
|
|
149
|
+
// supplied (or that none was) rather than infer it from silence.
|
|
150
|
+
const contextSection = `\n## Context supplied by the caller (composition contract, changed files)\n` +
|
|
151
|
+
`${config.context?.trim() || 'No context supplied.'}\n`;
|
|
152
|
+
if (config.mode === 'plan') {
|
|
153
|
+
return `# Screen plan
|
|
154
|
+
|
|
155
|
+
Read this route file and inventory the actions it exposes. There is no screenshot and no verdict: this runs before anything is built.
|
|
156
|
+
|
|
157
|
+
@${config.routeFile}
|
|
158
|
+
|
|
159
|
+
## Instructions
|
|
160
|
+
${config.instructions}
|
|
161
|
+
${contextSection}
|
|
162
|
+
${readingSection({ mode: 'plan' })}
|
|
163
|
+
## Contract
|
|
164
|
+
- Cover this route only. Do not wander into other routes or shared components except to name the primitive a control should use.
|
|
165
|
+
- Every control that is visible or reachable on this route gets a row, including ones hidden behind a menu.
|
|
166
|
+
- Your answer is ONLY the schema JSON. No prose before or after it, no markdown fences.`;
|
|
167
|
+
}
|
|
168
|
+
const changed = config.changedRoutes ?? [];
|
|
169
|
+
const changedSection = changed.length > 0
|
|
170
|
+
? `\n## Changed files in this diff\n${changed.map(route => `- ${route}`).join('\n')}\n`
|
|
171
|
+
: '\n';
|
|
172
|
+
const imageRefs = (config.images ?? []).map(image => `@${image}`).join('\n');
|
|
173
|
+
return `# Screen review
|
|
174
|
+
|
|
175
|
+
Open every image below before reading any code. You are the second pair of eyes on frames someone else captured; the caller never opens them, so every judgement must be grounded in a sentence about what an image shows.
|
|
176
|
+
|
|
177
|
+
${imageRefs}
|
|
178
|
+
|
|
179
|
+
## Instructions
|
|
180
|
+
${config.instructions}
|
|
181
|
+
${contextSection}${changedSection}
|
|
182
|
+
${readingSection({ mode: 'review', mergeBase: config.mergeBase })}
|
|
183
|
+
## Contract
|
|
184
|
+
- Enumerate what is in each image (every control, label and region) BEFORE judging it. Fill "inventory" first.
|
|
185
|
+
- Set each screen's "route_file" to the repo-relative path of the route or screen source file that image shows, choosing from the changed files above when one of them fits. Use "" only when you genuinely cannot tell — the caller uses this to check that every changed screen has a screenshot.
|
|
186
|
+
- Each finding's "observed" clause describes what the image shows; "rule" cites the rule it breaks.
|
|
187
|
+
- Set "confirmed": true only when you read the line or pixel yourself and it is really there. When unsure, file it MINOR.
|
|
188
|
+
- One "screens" entry per image above, and set its "file" to that image's absolute path copied verbatim from the @ line — character for character, no renaming, no relative path, no basename. The caller matches your entries back to the paths it gave you.
|
|
189
|
+
- If you could not open an image, say so in "summary" and leave it out of "screens".
|
|
190
|
+
- Your answer is ONLY the schema JSON. No prose before or after it, no markdown fences, no image data, no base64.`;
|
|
191
|
+
}
|
|
192
|
+
function normalizeRoute(route) {
|
|
193
|
+
return route.trim().replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+/, '');
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* A reported route_file claims a changed file when it names that exact path, or
|
|
197
|
+
* is an absolute/longer spelling of it. A TRUNCATED report is never accepted:
|
|
198
|
+
* `app/orders.tsx` would otherwise claim both `apps/admin/app/orders.tsx` and
|
|
199
|
+
* `apps/customer/app/orders.tsx`, letting one image cover two changed screens.
|
|
200
|
+
*/
|
|
201
|
+
function claimsRoute(routeFile, changedRoute) {
|
|
202
|
+
const reported = normalizeRoute(routeFile);
|
|
203
|
+
const changed = normalizeRoute(changedRoute);
|
|
204
|
+
if (!reported || !changed)
|
|
205
|
+
return false;
|
|
206
|
+
return reported === changed || reported.endsWith(`/${changed}`);
|
|
207
|
+
}
|
|
208
|
+
// git paths are repo-relative, so `app/orders.tsx` has no leading slash to match on.
|
|
209
|
+
function isUnderDirectory(route, directory) {
|
|
210
|
+
return `/${normalizeRoute(route)}`.includes(`/${directory}/`);
|
|
211
|
+
}
|
|
212
|
+
/** Gemini's verdict is advisory; unconfirmed MAJORs are downgraded, unreviewed images always block. */
|
|
213
|
+
export function deriveReviewVerdict(result, images, changedRoutes = []) {
|
|
214
|
+
const reasons = [];
|
|
215
|
+
const warnings = [];
|
|
216
|
+
let downgraded = 0;
|
|
217
|
+
const allFindings = [
|
|
218
|
+
...result.screens.flatMap(screen => screen.findings.map(finding => ({ ...finding, where: screen.file }))),
|
|
219
|
+
...result.cross_screen_findings.map(finding => ({ ...finding, where: 'cross-screen' })),
|
|
220
|
+
];
|
|
221
|
+
for (const finding of allFindings) {
|
|
222
|
+
if (finding.severity === 'BLOCKER') {
|
|
223
|
+
reasons.push(`BLOCKER (${finding.where}): ${finding.observed}`);
|
|
224
|
+
}
|
|
225
|
+
else if (finding.severity === 'MAJOR' && finding.confirmed) {
|
|
226
|
+
reasons.push(`MAJOR confirmed (${finding.where}): ${finding.observed}`);
|
|
227
|
+
}
|
|
228
|
+
else if (finding.severity === 'MAJOR') {
|
|
229
|
+
downgraded += 1;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// Compare resolved paths: Gemini may echo a realpath'd or ./-stripped
|
|
233
|
+
// spelling of the same image, and treating that as "not reviewed" would fail
|
|
234
|
+
// a review that actually happened.
|
|
235
|
+
const reviewedFiles = new Map(result.screens.map(screen => [realpathOfExistingPrefix(screen.file), screen.file]));
|
|
236
|
+
const unreviewed = images.filter(image => !reviewedFiles.has(realpathOfExistingPrefix(image)));
|
|
237
|
+
for (const image of unreviewed) {
|
|
238
|
+
reasons.push(`not reviewed: ${image}`);
|
|
239
|
+
}
|
|
240
|
+
const imageKeys = new Set(images.map(realpathOfExistingPrefix));
|
|
241
|
+
const unknownFiles = [...reviewedFiles]
|
|
242
|
+
.filter(([key]) => !imageKeys.has(key))
|
|
243
|
+
.map(([, reported]) => reported);
|
|
244
|
+
// Partial screenshot coverage is as unreviewed as no screenshot at all.
|
|
245
|
+
const coverage = changedRoutes.map(route => ({
|
|
246
|
+
route,
|
|
247
|
+
image: result.screens.find(screen => claimsRoute(screen.route_file, route))?.file ?? null,
|
|
248
|
+
}));
|
|
249
|
+
for (const entry of coverage.filter(entry => !entry.image)) {
|
|
250
|
+
if (isUnderDirectory(entry.route, 'app')) {
|
|
251
|
+
reasons.push(`no evidence for changed screen ${entry.route}`);
|
|
252
|
+
}
|
|
253
|
+
else if (isUnderDirectory(entry.route, 'components')) {
|
|
254
|
+
warnings.push(`changed component with no frame showing it: ${entry.route}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
verdict: reasons.length > 0 ? 'REQUEST_CHANGES' : 'APPROVE',
|
|
259
|
+
reported: result.verdict,
|
|
260
|
+
reasons,
|
|
261
|
+
unreviewed,
|
|
262
|
+
unknownFiles,
|
|
263
|
+
downgraded,
|
|
264
|
+
coverage,
|
|
265
|
+
warnings,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
// ------------------------------------------------------------------ reports
|
|
269
|
+
function renderFinding(finding) {
|
|
270
|
+
const severity = finding.severity === 'MAJOR' && !finding.confirmed
|
|
271
|
+
? 'MINOR (unconfirmed, downgraded)'
|
|
272
|
+
: finding.severity;
|
|
273
|
+
return `${severity} — ${finding.observed}\n location: ${finding.location}\n rule: ${finding.rule}\n fix: ${finding.fix}`;
|
|
274
|
+
}
|
|
275
|
+
export function formatScreenReviewReport(input) {
|
|
276
|
+
const { envelope, result, decision } = input;
|
|
277
|
+
const headline = decision.verdict === decision.reported
|
|
278
|
+
? `# Screen review: ${decision.verdict}`
|
|
279
|
+
: `# Screen review: ${decision.verdict} (Gemini reported ${decision.reported})`;
|
|
280
|
+
const parts = [];
|
|
281
|
+
if (envelope.conversation_id)
|
|
282
|
+
parts.push(formatConversationLine(envelope.conversation_id));
|
|
283
|
+
parts.push(headline);
|
|
284
|
+
parts.push(formatAgyUsageLine(envelope));
|
|
285
|
+
parts.push(formatModelSteps(input.modelSteps));
|
|
286
|
+
parts.push(section('Why', bulletList(decision.reasons)));
|
|
287
|
+
if (decision.coverage.length > 0) {
|
|
288
|
+
parts.push(section('Screenshot coverage', decision.coverage
|
|
289
|
+
.map(entry => `- ${entry.route} → ${entry.image ?? 'MISSING'}`)
|
|
290
|
+
.join('\n')));
|
|
291
|
+
}
|
|
292
|
+
for (const screen of result.screens) {
|
|
293
|
+
parts.push(section(`${screen.subject}`, [
|
|
294
|
+
`file: ${screen.file}`,
|
|
295
|
+
screen.route_file ? `route: ${screen.route_file}` : 'route: not identified',
|
|
296
|
+
`inventory: ${screen.inventory.join(', ') || 'none reported'}`,
|
|
297
|
+
`findings:`,
|
|
298
|
+
bulletList(screen.findings.map(renderFinding)),
|
|
299
|
+
].join('\n')));
|
|
300
|
+
}
|
|
301
|
+
parts.push(section('Cross-screen findings', bulletList(result.cross_screen_findings.map(renderFinding))));
|
|
302
|
+
parts.push(section('Summary', result.summary || '- not reported'));
|
|
303
|
+
const notes = [...decision.warnings];
|
|
304
|
+
if (decision.downgraded > 0) {
|
|
305
|
+
notes.push(`${decision.downgraded} unconfirmed MAJOR finding(s) shown as MINOR`);
|
|
306
|
+
}
|
|
307
|
+
if (decision.unknownFiles.length > 0) {
|
|
308
|
+
notes.push(`answer named images that were not supplied: ${decision.unknownFiles.join(', ')}`);
|
|
309
|
+
}
|
|
310
|
+
if (input.deniedActions) {
|
|
311
|
+
notes.push(`agy denied actions: ${input.deniedActions}`);
|
|
312
|
+
}
|
|
313
|
+
if (notes.length > 0)
|
|
314
|
+
parts.push(section('Notes', bulletList(notes)));
|
|
315
|
+
const workingTreeSection = formatWorkingTreeSection(input.workingTree);
|
|
316
|
+
if (workingTreeSection)
|
|
317
|
+
parts.push(workingTreeSection);
|
|
318
|
+
return parts.join('\n\n');
|
|
319
|
+
}
|
|
320
|
+
const PLAN_COLUMNS = [
|
|
321
|
+
'control', 'primitive', 'placement', 'promoted', 'verb today', 'verb per rule',
|
|
322
|
+
'operation', 'capability', 'scope',
|
|
323
|
+
];
|
|
324
|
+
export function formatScreenPlanReport(input) {
|
|
325
|
+
const { envelope, result, routeFile } = input;
|
|
326
|
+
const rows = result.controls.map(control => `| ${[
|
|
327
|
+
control.control, control.primitive, control.placement, String(control.promoted),
|
|
328
|
+
control.verb_today, control.verb_per_rule, control.operation, control.capability, control.scope,
|
|
329
|
+
].join(' | ')} |`);
|
|
330
|
+
const table = [
|
|
331
|
+
`| ${PLAN_COLUMNS.join(' | ')} |`,
|
|
332
|
+
`|${PLAN_COLUMNS.map(() => '---').join('|')}|`,
|
|
333
|
+
...rows,
|
|
334
|
+
].join('\n');
|
|
335
|
+
const parts = [];
|
|
336
|
+
if (envelope.conversation_id)
|
|
337
|
+
parts.push(formatConversationLine(envelope.conversation_id));
|
|
338
|
+
parts.push(`# Screen plan: ${routeFile}`);
|
|
339
|
+
parts.push(formatAgyUsageLine(envelope));
|
|
340
|
+
parts.push(section('Controls', result.controls.length > 0 ? table : '- none reported'));
|
|
341
|
+
parts.push(section('Top slot priority', bulletList(result.top_slot_priority)));
|
|
342
|
+
parts.push(section('Hand-rolls to delete', bulletList(result.hand_rolls_to_delete.map(item => `${item.line} → ${item.primitive}`))));
|
|
343
|
+
parts.push(section('Notes', result.notes || '- none'));
|
|
344
|
+
const warnings = [];
|
|
345
|
+
if (result.route_file && path.resolve(result.route_file) !== path.resolve(routeFile)) {
|
|
346
|
+
warnings.push(`answer named route_file '${result.route_file}' but the request was '${routeFile}'`);
|
|
347
|
+
}
|
|
348
|
+
if (input.deniedActions) {
|
|
349
|
+
warnings.push(`agy denied actions: ${input.deniedActions}`);
|
|
350
|
+
}
|
|
351
|
+
if (warnings.length > 0)
|
|
352
|
+
parts.push(section('Warnings', bulletList(warnings)));
|
|
353
|
+
const workingTreeSection = formatWorkingTreeSection(input.workingTree);
|
|
354
|
+
if (workingTreeSection)
|
|
355
|
+
parts.push(workingTreeSection);
|
|
356
|
+
return parts.join('\n\n');
|
|
357
|
+
}
|
|
358
|
+
// ------------------------------------------------------------------ execute
|
|
359
|
+
export const screenReviewTool = {
|
|
360
|
+
name: "screen-review",
|
|
361
|
+
description: "Delegate screen review to Gemini: in 'review' mode it opens the given PNGs, inventories what each shows, and returns findings with an APPROVE / REQUEST_CHANGES verdict; in 'plan' mode it inventories the controls of a route file before anything is built. Text only — no image reaches the caller's context.",
|
|
362
|
+
zodSchema: screenReviewArgsSchema,
|
|
363
|
+
prompt: {
|
|
364
|
+
description: "Have Gemini judge captured screens against a reviewer prompt (review mode), or inventory a route file's controls before implementation (plan mode).",
|
|
365
|
+
},
|
|
366
|
+
category: 'gemini',
|
|
367
|
+
annotations: {
|
|
368
|
+
title: "Screen Review",
|
|
369
|
+
readOnlyHint: true,
|
|
370
|
+
openWorldHint: true,
|
|
371
|
+
},
|
|
372
|
+
execute: async (args, onProgress, signal) => {
|
|
373
|
+
const input = screenReviewArgsSchema.parse(args);
|
|
374
|
+
const workingDirectory = resolveWorkingDirectory(input.workingDirectory);
|
|
375
|
+
const isPlan = input.mode === 'plan';
|
|
376
|
+
// agy resolves an @reference only under a workspace directory, so every
|
|
377
|
+
// image's parent has to be added explicitly.
|
|
378
|
+
const imageDirs = [...new Set((input.images ?? []).map(image => path.dirname(image)))];
|
|
379
|
+
const mergeBase = input.baseRef === undefined
|
|
380
|
+
? undefined
|
|
381
|
+
: await resolveMergeBase(workingDirectory, input.baseRef).catch((error) => {
|
|
382
|
+
throw new Error(`${ERROR_MESSAGES.SCREEN_REVIEW_BASE_REF}: '${input.baseRef}'. ${error.message}`);
|
|
383
|
+
});
|
|
384
|
+
const before = input.yolo ? await snapshotWorkingTree(workingDirectory) : null;
|
|
385
|
+
const afterWorkingTree = async () => diffWorkingTree(before, input.yolo ? await snapshotWorkingTree(workingDirectory) : null);
|
|
386
|
+
let envelope;
|
|
387
|
+
try {
|
|
388
|
+
envelope = await executeAgyJson(buildScreenReviewPrompt({
|
|
389
|
+
mode: input.mode,
|
|
390
|
+
instructions: input.instructions,
|
|
391
|
+
context: input.context,
|
|
392
|
+
images: input.images,
|
|
393
|
+
routeFile: input.routeFile,
|
|
394
|
+
changedRoutes: input.changedRoutes,
|
|
395
|
+
mergeBase,
|
|
396
|
+
}), {
|
|
397
|
+
model: input.model,
|
|
398
|
+
yolo: input.yolo,
|
|
399
|
+
printTimeout: input.printTimeout,
|
|
400
|
+
conversationId: input.conversationId,
|
|
401
|
+
includeDirectories: [workingDirectory, ...imageDirs],
|
|
402
|
+
cwd: workingDirectory,
|
|
403
|
+
jsonSchema: isPlan ? SCHEMA_TEXT.plan : SCHEMA_TEXT.review,
|
|
404
|
+
noCache: true,
|
|
405
|
+
signal,
|
|
406
|
+
}, onProgress);
|
|
407
|
+
}
|
|
408
|
+
catch (error) {
|
|
409
|
+
// A timeout or CLI failure can land after Gemini has used the shell yolo
|
|
410
|
+
// gave it, so the warning travels with the error.
|
|
411
|
+
failWithWorkingTree(error, await afterWorkingTree());
|
|
412
|
+
}
|
|
413
|
+
const deniedActions = deniedActionsSummary(envelope);
|
|
414
|
+
// Both modes and both exits: yolo gave Gemini a shell either way.
|
|
415
|
+
const workingTree = await afterWorkingTree();
|
|
416
|
+
if (isPlan) {
|
|
417
|
+
const parsed = screenPlanResultSchema.safeParse(envelope.structured_output);
|
|
418
|
+
if (!parsed.success) {
|
|
419
|
+
return [
|
|
420
|
+
renderUnparsableEnvelope(envelope, '# Screen plan: no usable answer', formatZodIssues(parsed.error)),
|
|
421
|
+
formatWorkingTreeSection(workingTree),
|
|
422
|
+
].filter(Boolean).join('\n\n');
|
|
423
|
+
}
|
|
424
|
+
return formatScreenPlanReport({
|
|
425
|
+
envelope,
|
|
426
|
+
result: parsed.data,
|
|
427
|
+
routeFile: input.routeFile,
|
|
428
|
+
deniedActions,
|
|
429
|
+
workingTree,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
const parsed = screenReviewResultSchema.safeParse(envelope.structured_output);
|
|
433
|
+
if (!parsed.success) {
|
|
434
|
+
return [
|
|
435
|
+
renderUnparsableEnvelope(envelope, '# Screen review: no usable answer', formatZodIssues(parsed.error)),
|
|
436
|
+
formatWorkingTreeSection(workingTree),
|
|
437
|
+
].filter(Boolean).join('\n\n');
|
|
438
|
+
}
|
|
439
|
+
return formatScreenReviewReport({
|
|
440
|
+
envelope,
|
|
441
|
+
result: parsed.data,
|
|
442
|
+
decision: deriveReviewVerdict(parsed.data, input.images ?? [], input.changedRoutes ?? []),
|
|
443
|
+
deniedActions,
|
|
444
|
+
workingTree,
|
|
445
|
+
modelSteps: envelope.conversation_id ? await countAgyModelSteps(envelope.conversation_id) : null,
|
|
446
|
+
});
|
|
447
|
+
},
|
|
448
|
+
};
|
|
449
|
+
//# sourceMappingURL=screen-review.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-review.tool.js","sourceRoot":"","sources":["../../src/tools/screen-review.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAe,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,GAEhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACrI,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACzG,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAwB,MAAM,4BAA4B,CAAC;AACxG,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAE1H,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,6EAA6E;AAE7E,SAAS,UAAU,CAAC,SAAiB;IACnC,IAAI,CAAC;QACH,OAAO,E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;QAED,MAAM,MAAM,GAAG,wBAAwB,CAAC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QAC9E,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,wBAAwB,CAAC,QAAQ,EAAE,mCAAmC,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACtG,wBAAwB,CAAC,WAAW,CAAC;aACtC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,wBAAwB,CAAC;YAC9B,QAAQ;YACR,MAAM,EAAE,MAAM,CAAC,IAAI;YACnB,QAAQ,EAAE,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,CAAC,aAAa,IAAI,EAAE,CAAC;YACzF,aAAa;YACb,WAAW;YACX,UAAU,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,kBAAkB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI;SACjG,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-tools.d.ts","sourceRoot":"","sources":["../../src/tools/simple-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"simple-tools.d.ts","sourceRoot":"","sources":["../../src/tools/simple-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,eAAO,MAAM,QAAQ,EAAE,WAmBtB,CAAC;AAIF,eAAO,MAAM,QAAQ,EAAE,WAmBtB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { executeCommand } from '../utils/commandExecutor.js';
|
|
3
|
+
import { AGY_LIMITS } from '../constants.js';
|
|
3
4
|
const pingArgsSchema = z.object({
|
|
4
5
|
prompt: z.string().default('').describe("Message to echo "),
|
|
5
6
|
});
|
|
@@ -18,7 +19,9 @@ export const pingTool = {
|
|
|
18
19
|
},
|
|
19
20
|
execute: async (args, onProgress) => {
|
|
20
21
|
const message = args.prompt || args.message || "Pong!";
|
|
21
|
-
|
|
22
|
+
const text = message;
|
|
23
|
+
onProgress?.(text);
|
|
24
|
+
return text;
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
27
|
const helpArgsSchema = z.object({});
|
|
@@ -35,8 +38,11 @@ export const helpTool = {
|
|
|
35
38
|
readOnlyHint: true,
|
|
36
39
|
openWorldHint: true,
|
|
37
40
|
},
|
|
38
|
-
execute: async (args, onProgress) => {
|
|
39
|
-
return executeCommand("
|
|
41
|
+
execute: async (args, onProgress, signal) => {
|
|
42
|
+
return executeCommand("agy", ["--help"], onProgress, undefined, {
|
|
43
|
+
killAfterMs: AGY_LIMITS.DEFAULT_CEILING_MS,
|
|
44
|
+
signal,
|
|
45
|
+
});
|
|
40
46
|
}
|
|
41
47
|
};
|
|
42
48
|
//# sourceMappingURL=simple-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-tools.js","sourceRoot":"","sources":["../../src/tools/simple-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"simple-tools.js","sourceRoot":"","sources":["../../src/tools/simple-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;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AM;SACP,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z, type ZodType } from 'zod';
|
|
2
|
+
export interface AgyCLIOptions {
|
|
3
|
+
model?: string;
|
|
4
|
+
sandbox?: boolean;
|
|
5
|
+
changeMode?: boolean;
|
|
6
|
+
yolo?: boolean;
|
|
7
|
+
approvalMode?: string;
|
|
8
|
+
outputFormat?: string;
|
|
9
|
+
jsonSchema?: string;
|
|
10
|
+
effort?: string;
|
|
11
|
+
includeDirectories?: string | string[];
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
printTimeout?: string;
|
|
14
|
+
promptInteractive?: string;
|
|
15
|
+
extensions?: string | string[];
|
|
16
|
+
resume?: boolean | string;
|
|
17
|
+
conversationId?: string;
|
|
18
|
+
noCache?: boolean;
|
|
19
|
+
cwd?: string;
|
|
20
|
+
/** Stops agy when the MCP request is cancelled. */
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
}
|
|
23
|
+
export interface AgyUsage {
|
|
24
|
+
input_tokens?: number;
|
|
25
|
+
output_tokens?: number;
|
|
26
|
+
thinking_tokens?: number;
|
|
27
|
+
cache_read_tokens?: number;
|
|
28
|
+
total_tokens?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface AgyDeniedAction {
|
|
31
|
+
action?: string;
|
|
32
|
+
display_name?: string;
|
|
33
|
+
}
|
|
34
|
+
/** One line of `agy --output-format json` output. */
|
|
35
|
+
export interface AgyJsonEnvelope {
|
|
36
|
+
conversation_id?: string;
|
|
37
|
+
status?: string;
|
|
38
|
+
response?: string;
|
|
39
|
+
error?: string;
|
|
40
|
+
structured_output?: unknown;
|
|
41
|
+
num_turns?: number;
|
|
42
|
+
duration_seconds?: number;
|
|
43
|
+
usage?: AgyUsage;
|
|
44
|
+
denied_actions?: AgyDeniedAction[];
|
|
45
|
+
}
|
|
46
|
+
export declare const printTimeoutSchema: z.ZodString;
|
|
47
|
+
/**
|
|
48
|
+
* How long an agy process may run: its print timeout plus a margin, or the
|
|
49
|
+
* default ceiling when there is no positive timeout.
|
|
50
|
+
*/
|
|
51
|
+
export declare function agyKillAfterMs(printTimeout?: string): number;
|
|
52
|
+
/**
|
|
53
|
+
* The conversation this call asked agy to resume, if any. `resume` with a bare
|
|
54
|
+
* ID maps to the same `--conversation` flag as `conversationId`, so both must be
|
|
55
|
+
* checked against what agy actually returned.
|
|
56
|
+
*/
|
|
57
|
+
export declare function requestedConversationId(opts: AgyCLIOptions): string | undefined;
|
|
58
|
+
export declare function parseAgyJsonEnvelope(stdout: string): AgyJsonEnvelope;
|
|
59
|
+
/** Human-readable "DisplayName (action)" list of the actions agy refused to run. */
|
|
60
|
+
export declare function deniedActionsSummary(envelope: AgyJsonEnvelope): string;
|
|
61
|
+
export declare function formatAgyUsageLine(envelope: AgyJsonEnvelope): string;
|
|
62
|
+
/**
|
|
63
|
+
* Render an envelope for a human reader. A resumed turn replays the PREVIOUS
|
|
64
|
+
* turn's structured_output, so it is only trusted when this call passed a schema.
|
|
65
|
+
*/
|
|
66
|
+
export declare function renderAgyJsonEnvelope(envelope: AgyJsonEnvelope, opts?: {
|
|
67
|
+
hadSchema?: boolean;
|
|
68
|
+
}): string;
|
|
69
|
+
export declare function formatConversationLine(conversationId: string): string;
|
|
70
|
+
/** A zod schema as the JSON Schema agy's `--json-schema` accepts (no `$schema` key). */
|
|
71
|
+
export declare function toAgyJsonSchema(schema: ZodType): Record<string, unknown>;
|
|
72
|
+
export declare function executeAgyCLI(prompt: string, options: AgyCLIOptions | string, onProgress?: (newOutput: string) => void): Promise<string>;
|
|
73
|
+
/** Run agy in json mode and return the parsed envelope. */
|
|
74
|
+
export declare function executeAgyJson(prompt: string, options?: AgyCLIOptions, onProgress?: (newOutput: string) => void): Promise<AgyJsonEnvelope>;
|
|
75
|
+
export declare function processChangeModeOutput(rawResult: string, chunkIndex?: number, chunkCacheKey?: string, prompt?: string): Promise<string>;
|
|
76
|
+
//# sourceMappingURL=agyExec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