@genesislcap/ai-assistant 15.69.0 → 15.71.0-FUI-2650.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/dist/ai-assistant.api.json +97 -0
- package/dist/ai-assistant.d.ts +65 -0
- package/dist/chat-driver.cjs +18031 -0
- package/dist/chat-driver.cjs.map +4 -4
- package/dist/chat-driver.mjs +18024 -0
- package/dist/chat-driver.mjs.map +4 -4
- package/dist/custom-elements.json +5524 -2684
- package/dist/dts/chat-driver-node.d.ts +2 -0
- package/dist/dts/chat-driver-node.d.ts.map +1 -1
- package/dist/dts/code-review/code-review.types.d.ts +76 -0
- package/dist/dts/code-review/code-review.types.d.ts.map +1 -0
- package/dist/dts/code-review/code-reviewer.agent.d.ts +77 -0
- package/dist/dts/code-review/code-reviewer.agent.d.ts.map +1 -0
- package/dist/dts/code-review/code-reviewer.prompt.d.ts +23 -0
- package/dist/dts/code-review/code-reviewer.prompt.d.ts.map +1 -0
- package/dist/dts/code-review/gate.d.ts +44 -0
- package/dist/dts/code-review/gate.d.ts.map +1 -0
- package/dist/dts/code-review/index.d.ts +27 -0
- package/dist/dts/code-review/index.d.ts.map +1 -0
- package/dist/dts/code-review/review-changes.d.ts +70 -0
- package/dist/dts/code-review/review-changes.d.ts.map +1 -0
- package/dist/dts/code-review/rules/context-trigger-map.d.ts +6 -0
- package/dist/dts/code-review/rules/context-trigger-map.d.ts.map +1 -0
- package/dist/dts/code-review/rules/context.registry.d.ts +123 -0
- package/dist/dts/code-review/rules/context.registry.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-ai-extensions.d.ts +13 -0
- package/dist/dts/code-review/rules/fui-ai-extensions.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-blotter.d.ts +16 -0
- package/dist/dts/code-review/rules/fui-blotter.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-chart.d.ts +20 -0
- package/dist/dts/code-review/rules/fui-chart.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-column-defs.d.ts +21 -0
- package/dist/dts/code-review/rules/fui-column-defs.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-components.d.ts +9 -0
- package/dist/dts/code-review/rules/fui-components.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-criteria.d.ts +32 -0
- package/dist/dts/code-review/rules/fui-criteria.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-custom-renderer.d.ts +15 -0
- package/dist/dts/code-review/rules/fui-custom-renderer.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-dashboard.d.ts +19 -0
- package/dist/dts/code-review/rules/fui-dashboard.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-dialogs.d.ts +19 -0
- package/dist/dts/code-review/rules/fui-dialogs.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-entity-management.d.ts +19 -0
- package/dist/dts/code-review/rules/fui-entity-management.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-error-boundary.d.ts +9 -0
- package/dist/dts/code-review/rules/fui-error-boundary.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-eventing.d.ts +8 -0
- package/dist/dts/code-review/rules/fui-eventing.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-flexlayout.d.ts +17 -0
- package/dist/dts/code-review/rules/fui-flexlayout.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-flyout-panel.d.ts +10 -0
- package/dist/dts/code-review/rules/fui-flyout-panel.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-form-component.d.ts +9 -0
- package/dist/dts/code-review/rules/fui-form-component.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-formatters.d.ts +12 -0
- package/dist/dts/code-review/rules/fui-formatters.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-foundation-comms.d.ts +10 -0
- package/dist/dts/code-review/rules/fui-foundation-comms.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-global-filters.d.ts +33 -0
- package/dist/dts/code-review/rules/fui-global-filters.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-import-surface.d.ts +37 -0
- package/dist/dts/code-review/rules/fui-import-surface.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-inline-editing.d.ts +10 -0
- package/dist/dts/code-review/rules/fui-inline-editing.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-layout.d.ts +7 -0
- package/dist/dts/code-review/rules/fui-layout.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-notifications.d.ts +12 -0
- package/dist/dts/code-review/rules/fui-notifications.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-primitives.d.ts +26 -0
- package/dist/dts/code-review/rules/fui-primitives.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts +18 -0
- package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-redux-store.d.ts +8 -0
- package/dist/dts/code-review/rules/fui-redux-store.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-reporting.d.ts +19 -0
- package/dist/dts/code-review/rules/fui-reporting.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-styling.d.ts +15 -0
- package/dist/dts/code-review/rules/fui-styling.d.ts.map +1 -0
- package/dist/dts/code-review/rules/fui-trade-form.d.ts +13 -0
- package/dist/dts/code-review/rules/fui-trade-form.d.ts.map +1 -0
- package/dist/dts/code-review/submit-code-review.tool.d.ts +12 -0
- package/dist/dts/code-review/submit-code-review.tool.d.ts.map +1 -0
- package/dist/dts/code-review/unified-diff.d.ts +7 -0
- package/dist/dts/code-review/unified-diff.d.ts.map +1 -0
- package/dist/dts/code-review/verdict.d.ts +23 -0
- package/dist/dts/code-review/verdict.d.ts.map +1 -0
- package/dist/dts/components/code-review-result/code-review-result.d.ts +26 -0
- package/dist/dts/components/code-review-result/code-review-result.d.ts.map +1 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/react.d.ts +20 -10
- package/dist/esm/chat-driver-node.js +6 -0
- package/dist/esm/code-review/code-review.types.js +6 -0
- package/dist/esm/code-review/code-reviewer.agent.js +167 -0
- package/dist/esm/code-review/code-reviewer.prompt.js +103 -0
- package/dist/esm/code-review/gate.js +93 -0
- package/dist/esm/code-review/index.js +28 -0
- package/dist/esm/code-review/review-changes.js +123 -0
- package/dist/esm/code-review/rules/context-trigger-map.js +20 -0
- package/dist/esm/code-review/rules/context.registry.js +772 -0
- package/dist/esm/code-review/rules/fui-ai-extensions.js +306 -0
- package/dist/esm/code-review/rules/fui-blotter.js +596 -0
- package/dist/esm/code-review/rules/fui-chart.js +669 -0
- package/dist/esm/code-review/rules/fui-column-defs.js +862 -0
- package/dist/esm/code-review/rules/fui-components.js +245 -0
- package/dist/esm/code-review/rules/fui-criteria.js +538 -0
- package/dist/esm/code-review/rules/fui-custom-renderer.js +612 -0
- package/dist/esm/code-review/rules/fui-dashboard.js +604 -0
- package/dist/esm/code-review/rules/fui-dialogs.js +588 -0
- package/dist/esm/code-review/rules/fui-entity-management.js +1014 -0
- package/dist/esm/code-review/rules/fui-error-boundary.js +244 -0
- package/dist/esm/code-review/rules/fui-eventing.js +628 -0
- package/dist/esm/code-review/rules/fui-flexlayout.js +860 -0
- package/dist/esm/code-review/rules/fui-flyout-panel.js +432 -0
- package/dist/esm/code-review/rules/fui-form-component.js +898 -0
- package/dist/esm/code-review/rules/fui-formatters.js +415 -0
- package/dist/esm/code-review/rules/fui-foundation-comms.js +518 -0
- package/dist/esm/code-review/rules/fui-global-filters.js +778 -0
- package/dist/esm/code-review/rules/fui-import-surface.js +452 -0
- package/dist/esm/code-review/rules/fui-inline-editing.js +445 -0
- package/dist/esm/code-review/rules/fui-layout.js +431 -0
- package/dist/esm/code-review/rules/fui-notifications.js +439 -0
- package/dist/esm/code-review/rules/fui-primitives.js +1216 -0
- package/dist/esm/code-review/rules/fui-rapid-grid-pro.js +650 -0
- package/dist/esm/code-review/rules/fui-redux-store.js +522 -0
- package/dist/esm/code-review/rules/fui-reporting.js +506 -0
- package/dist/esm/code-review/rules/fui-styling.js +1229 -0
- package/dist/esm/code-review/rules/fui-trade-form.js +618 -0
- package/dist/esm/code-review/submit-code-review.tool.js +43 -0
- package/dist/esm/code-review/unified-diff.js +96 -0
- package/dist/esm/code-review/verdict.js +24 -0
- package/dist/esm/components/code-review-result/code-review-result.js +89 -0
- package/dist/esm/index.js +3 -0
- package/dist/react.cjs +25 -18
- package/dist/react.mjs +23 -17
- package/docs/code-review.md +137 -0
- package/package.json +24 -17
- package/scripts/smoke-chat-driver-node.mjs +15 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { GenesisElement } from '@genesislcap/web-core';
|
|
2
|
+
import type { CodeReviewGateResult } from '../../code-review/code-review.types';
|
|
3
|
+
import { type CodeReviewSummary } from '../../code-review/verdict';
|
|
4
|
+
/**
|
|
5
|
+
* Displays one code-review verdict: the status (approved, blocking, advisory, skipped or
|
|
6
|
+
* unavailable), the files reviewed and the reviewer's feedback. Display only — it does not apply a
|
|
7
|
+
* fix; the host decides what a verdict means for its write path.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const el = document.createElement('ai-code-review-result') as AiCodeReviewResult;
|
|
12
|
+
* el.result = await runCodeReviewPreGate(files, requestSubAgent);
|
|
13
|
+
* el.files = files.map((f) => f.path);
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @beta
|
|
17
|
+
*/
|
|
18
|
+
export declare class AiCodeReviewResult extends GenesisElement {
|
|
19
|
+
/** The gate result to show; `null` means the review was skipped. */
|
|
20
|
+
result: CodeReviewGateResult | null;
|
|
21
|
+
/** Paths of the files the review covered. */
|
|
22
|
+
files: string[];
|
|
23
|
+
/** @internal */
|
|
24
|
+
get summary(): CodeReviewSummary;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=code-review-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-review-result.d.ts","sourceRoot":"","sources":["../../../../src/components/code-review-result/code-review-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAKf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAExF;;;;;;;;;;;;;GAaG;AACH,qBA2Da,kBAAmB,SAAQ,cAAc;IACpD,oEAAoE;IACxD,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IAEvD,6CAA6C;IACjC,KAAK,EAAE,MAAM,EAAE,CAAM;IAEjC,gBAAgB;IAChB,IAAI,OAAO,IAAI,iBAAiB,CAE/B;CACF"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -36,5 +36,6 @@ export type { HandlerCapabilityFactory, HandlerCapabilityScope } from './types/h
|
|
|
36
36
|
export type { DecisionAnswer, DecisionOption, DecisionSpec, InteractionSurface, InvokeResult, SurfaceAction, SurfaceActionSpec, SurfaceSpec, } from './types/interaction-surface';
|
|
37
37
|
export { getInteractionRegistration, registerInteraction, type InteractionControllerFactory, type InteractionRegistration, } from './state/interaction-registry';
|
|
38
38
|
export { AiChatMarkdown, MARKDOWN_EXPORTPARTS } from './components/chat-markdown/chat-markdown';
|
|
39
|
+
export { AiCodeReviewResult } from './components/code-review-result/code-review-result';
|
|
39
40
|
export type { GenesisChangeRequest, GenesisReviewPayload, GenesisWriteReviewCompletedEventDetail, } from './genesis/review-payload';
|
|
40
41
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc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,uBAAuB,GAC7B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAGhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAIxF,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,sCAAsC,GACvC,MAAM,0BAA0B,CAAC"}
|
package/dist/dts/react.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { AgentPicker as AgentPickerWC } from './components/agent-picker/age
|
|
|
10
10
|
import type { AiChatBubble as AiChatBubbleWC } from './components/chat-bubble/chat-bubble';
|
|
11
11
|
import type { AiChatInteractionWrapper as AiChatInteractionWrapperWC } from './components/chat-interaction-wrapper/chat-interaction-wrapper';
|
|
12
12
|
import type { AiChatMarkdown as AiChatMarkdownWC } from './components/chat-markdown/chat-markdown';
|
|
13
|
+
import type { AiCodeReviewResult as AiCodeReviewResultWC } from './components/code-review-result/code-review-result';
|
|
13
14
|
import type { AiFlowingWavesIndicator as AiFlowingWavesIndicatorWC } from './components/flowing-waves-indicator';
|
|
14
15
|
import type { AiHaloOverlay as AiHaloOverlayWC } from './components/halo-overlay';
|
|
15
16
|
import type { MessageFeedback as MessageFeedbackWC } from './components/message-feedback/message-feedback';
|
|
@@ -116,16 +117,6 @@ export declare const AutopilotHandBack: React.ForwardRefExoticComponent<
|
|
|
116
117
|
>;
|
|
117
118
|
export type AutopilotHandBackRef = AutopilotHandBackWC;
|
|
118
119
|
|
|
119
|
-
export declare const GenesisWriteReview: React.ForwardRefExoticComponent<
|
|
120
|
-
React.PropsWithChildren<
|
|
121
|
-
Omit<PublicOf<GenesisWriteReviewWC>, 'children' | 'style'> &
|
|
122
|
-
HTMLWCProps & {
|
|
123
|
-
onInteractionCompleted?: (event: CustomEvent<GenesisWriteReviewCompletedEventDetail>) => void;
|
|
124
|
-
}
|
|
125
|
-
> & React.RefAttributes<GenesisWriteReviewWC>
|
|
126
|
-
>;
|
|
127
|
-
export type GenesisWriteReviewRef = GenesisWriteReviewWC;
|
|
128
|
-
|
|
129
120
|
export declare const AiActivityHalo: React.ForwardRefExoticComponent<
|
|
130
121
|
React.PropsWithChildren<
|
|
131
122
|
Omit<PublicOf<AiActivityHaloWC>, 'children' | 'style'> &
|
|
@@ -175,6 +166,15 @@ export declare const AiChatMarkdown: React.ForwardRefExoticComponent<
|
|
|
175
166
|
>;
|
|
176
167
|
export type AiChatMarkdownRef = AiChatMarkdownWC;
|
|
177
168
|
|
|
169
|
+
export declare const AiCodeReviewResult: React.ForwardRefExoticComponent<
|
|
170
|
+
React.PropsWithChildren<
|
|
171
|
+
Omit<PublicOf<AiCodeReviewResultWC>, 'children' | 'style'> &
|
|
172
|
+
HTMLWCProps & {
|
|
173
|
+
}
|
|
174
|
+
> & React.RefAttributes<AiCodeReviewResultWC>
|
|
175
|
+
>;
|
|
176
|
+
export type AiCodeReviewResultRef = AiCodeReviewResultWC;
|
|
177
|
+
|
|
178
178
|
export declare const MessageFeedback: React.ForwardRefExoticComponent<
|
|
179
179
|
React.PropsWithChildren<
|
|
180
180
|
Omit<PublicOf<MessageFeedbackWC>, 'children' | 'style'> &
|
|
@@ -193,4 +193,14 @@ export declare const FoundationAiPopoutManager: React.ForwardRefExoticComponent<
|
|
|
193
193
|
>;
|
|
194
194
|
export type FoundationAiPopoutManagerRef = FoundationAiPopoutManagerWC;
|
|
195
195
|
|
|
196
|
+
export declare const GenesisWriteReview: React.ForwardRefExoticComponent<
|
|
197
|
+
React.PropsWithChildren<
|
|
198
|
+
Omit<PublicOf<GenesisWriteReviewWC>, 'children' | 'style'> &
|
|
199
|
+
HTMLWCProps & {
|
|
200
|
+
onInteractionCompleted?: (event: CustomEvent<GenesisWriteReviewCompletedEventDetail>) => void;
|
|
201
|
+
}
|
|
202
|
+
> & React.RefAttributes<GenesisWriteReviewWC>
|
|
203
|
+
>;
|
|
204
|
+
export type GenesisWriteReviewRef = GenesisWriteReviewWC;
|
|
205
|
+
|
|
196
206
|
export {};
|
|
@@ -113,3 +113,9 @@ export { buildTimelineEntries } from './state/persistence/build-timeline-entries
|
|
|
113
113
|
// and cost figures are as old as that. Pass a fresh snapshot of your own through this before
|
|
114
114
|
// `assembleDebugLog`, or state in your own output that the totals are historical.
|
|
115
115
|
export { assembleDebugLog, withFreshMetaSnapshot } from './state/persistence/diagnostics';
|
|
116
|
+
// The UI Code Reviewer (FUI-2650), for Node hosts such as a CI job reviewing a patch. Bundled
|
|
117
|
+
// here rather than as its own Node artifact so `createHeadlessSubAgentCaller` drives the SAME
|
|
118
|
+
// ChatDriver / foundation-ai instance as the providers built from this entry (see the provider
|
|
119
|
+
// note above on `instanceof`). Named, like everything else here; its closure is the rule-pack
|
|
120
|
+
// strings plus the driver, so it stays DOM-clean (smoke-chat-driver-node.mjs checks).
|
|
121
|
+
export { CODE_REVIEWER_AGENT_NAME, createCodeReviewAgent, createHeadlessSubAgentCaller, isGenesisWebFile, parseUnifiedDiff, reviewChanges, summarizeCodeReview, } from './code-review';
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { logger } from '../utils/logger';
|
|
3
|
+
import { CODE_REVIEWER_AGENT_NAME } from './code-review.types';
|
|
4
|
+
import { buildCodeReviewerPrompt } from './code-reviewer.prompt';
|
|
5
|
+
import { createContextToolDefinitions, createContextToolHandlers, } from './rules/context.registry';
|
|
6
|
+
import { submitCodeReviewHandler, submitCodeReviewToolDefinition } from './submit-code-review.tool';
|
|
7
|
+
const FILE_TOOL_NAMES = ['vfs_read', 'vfs_list'];
|
|
8
|
+
// ── Tool-call budget (GENC-1358) ──────────────────────────────────────────────
|
|
9
|
+
// The reviewer has five read/explore tools and only one terminal tool
|
|
10
|
+
// (submit_code_review), and sub-agent turns default tool_choice to 'required' — so
|
|
11
|
+
// a model that keeps choosing reads can never end the turn on its own. One run
|
|
12
|
+
// crawled 38 distinct files over ~46 tool calls reviewing a single trivial slice,
|
|
13
|
+
// never submitted, and hit the framework's DEFAULT_MAX_TOOL_ITERATIONS (50). That
|
|
14
|
+
// fails the sub-agent with `max_iterations` — which fails open to "approved", but
|
|
15
|
+
// only after burning ~2.5 min of High-tier calls and leaving no verdict. "Normal
|
|
16
|
+
// reviews finish in 4–11 turns" was the GENC-1358 design premise; MEASURED live
|
|
17
|
+
// since (GENC-1560 buildout scenario) that premise does not hold for a real
|
|
18
|
+
// multi-file generating step — reviews routinely ran 22–26 turns, right up
|
|
19
|
+
// against FORCE_AT, not the rare backstop case it was sized for. We warn as the
|
|
20
|
+
// budget runs down, then force submit_code_review well short of the framework
|
|
21
|
+
// cap so a runaway terminates with a real verdict cheaply. FORCE_AT is
|
|
22
|
+
// deliberately generous (>2x the ORIGINAL observed legitimate max) to leave
|
|
23
|
+
// headroom for genuinely interconnected changes. Moved unchanged from genesis-create
|
|
24
|
+
// (FUI-2650) — retune only against a new measurement.
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const FORCE_AT = 25;
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const WARN_FROM = 18;
|
|
29
|
+
// A SEPARATE, earlier nudge (GENC-1560) — not a budget countdown, a batching
|
|
30
|
+
// reminder. The turn-count blowup above traces to the model reading one file or
|
|
31
|
+
// one context module per turn despite the prompt's own worked example of a
|
|
32
|
+
// parallel batch (34 tools over 26 turns ⇒ ~1.3 tools/turn, near strictly
|
|
33
|
+
// sequential). WARN_FROM=18 fires far too late to change that pattern — by turn
|
|
34
|
+
// 18 the sequential habit for THIS review is already set. This fires while there
|
|
35
|
+
// is still time for the review to recover into 1-2 genuine parallel batches.
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const BATCHING_REMINDER_FROM = 6;
|
|
38
|
+
/**
|
|
39
|
+
* Escalating budget warning, delivered via tailContext (its own framed
|
|
40
|
+
* `<system-reminder>` block, hence no leading separator).
|
|
41
|
+
*/
|
|
42
|
+
function budgetWarning(turnIndex) {
|
|
43
|
+
const remaining = FORCE_AT - turnIndex;
|
|
44
|
+
return (`⚠️ TOOL-CALL BUDGET: you have made ${turnIndex} tool calls. You MUST call ` +
|
|
45
|
+
`submit_code_review within ${remaining} more — after that it is forced ` +
|
|
46
|
+
`automatically. Submit your verdict NOW, based on the issues you have ALREADY ` +
|
|
47
|
+
`identified in the supplied files. Stop reading further files, and do not ` +
|
|
48
|
+
`invent a blocking issue to justify more investigation.`);
|
|
49
|
+
}
|
|
50
|
+
/** Earlier, non-countdown nudge — see BATCHING_REMINDER_FROM. */
|
|
51
|
+
function batchingReminder(turnIndex) {
|
|
52
|
+
return (`⚠️ ${turnIndex} turns in and still going: if each turn so far made only ONE tool call, ` +
|
|
53
|
+
`stop — that is the sequential pattern Step 1 asks you to avoid. Decide everything you ` +
|
|
54
|
+
`still need (remaining files, remaining context modules) and emit ALL of those calls ` +
|
|
55
|
+
`together in your NEXT reply, then submit. If you are already batching and there is ` +
|
|
56
|
+
`genuinely more to check, continue — this is a reminder, not a limit.`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Per-turn nudge text, delivered via `tailContext` — NOT concatenated onto `systemPrompt`.
|
|
60
|
+
* Both nudge strings interpolate the live turn number, so a system prompt carrying them changes
|
|
61
|
+
* on EVERY turn from BATCHING_REMINDER_FROM onward — and 'history' scope's cache breakpoint
|
|
62
|
+
* chain starts at the system block, so that defeats the cache to the end of the review.
|
|
63
|
+
* MEASURED in genesis-create (GENC-1560): 82% of one generating step's cost.
|
|
64
|
+
*/
|
|
65
|
+
function reviewerTailContext(ctx) {
|
|
66
|
+
if (ctx.turnIndex >= WARN_FROM)
|
|
67
|
+
return budgetWarning(ctx.turnIndex);
|
|
68
|
+
if (ctx.turnIndex >= BATCHING_REMINDER_FROM)
|
|
69
|
+
return batchingReminder(ctx.turnIndex);
|
|
70
|
+
return '';
|
|
71
|
+
}
|
|
72
|
+
/** Mirrors the sub-agent default ('required') until FORCE_AT, then forces the verdict. */
|
|
73
|
+
function reviewerToolChoice(ctx) {
|
|
74
|
+
if (ctx.turnIndex >= FORCE_AT) {
|
|
75
|
+
// Log once at the force point (the forced submit ends the loop). Surfaces an
|
|
76
|
+
// otherwise-silent runaway — the fail-open path swallowed these completely.
|
|
77
|
+
if (ctx.turnIndex === FORCE_AT) {
|
|
78
|
+
logger.warn(`Code reviewer reached the tool-call budget (${FORCE_AT}) without submitting — forcing submit_code_review.`);
|
|
79
|
+
}
|
|
80
|
+
return { tool: 'submit_code_review' };
|
|
81
|
+
}
|
|
82
|
+
return 'required';
|
|
83
|
+
}
|
|
84
|
+
const isFileTools = (files) => 'definitions' in files && 'handlers' in files;
|
|
85
|
+
/** Generic `vfs_read` / `vfs_list` over a {@link CodeReviewFileReader}. */
|
|
86
|
+
function fileReaderTools(reader) {
|
|
87
|
+
return {
|
|
88
|
+
definitions: [
|
|
89
|
+
{
|
|
90
|
+
name: 'vfs_list',
|
|
91
|
+
description: 'List every file path you may read. Use an exact path from this list with vfs_read.',
|
|
92
|
+
parameters: { type: 'object', properties: {} },
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'vfs_read',
|
|
96
|
+
description: 'Read the full content of a file, as it stands with the change under review applied.',
|
|
97
|
+
parameters: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
required: ['path'],
|
|
100
|
+
properties: {
|
|
101
|
+
path: { type: 'string', description: 'Exact path from vfs_list.' },
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
handlers: {
|
|
107
|
+
vfs_list: () => __awaiter(this, void 0, void 0, function* () { return ({ files: yield reader.list() }); }),
|
|
108
|
+
vfs_read: (args) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
const { path } = args;
|
|
110
|
+
const content = yield reader.read(path);
|
|
111
|
+
if (content === undefined) {
|
|
112
|
+
return { error: `File not found: '${path}'. Call vfs_list to see readable paths.` };
|
|
113
|
+
}
|
|
114
|
+
return { path, content };
|
|
115
|
+
}),
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/** Keeps only `vfs_read` / `vfs_list` — the reviewer must never hold a write tool. */
|
|
120
|
+
function readOnlyFileTools(tools) {
|
|
121
|
+
const allowed = (name) => FILE_TOOL_NAMES.includes(name);
|
|
122
|
+
return {
|
|
123
|
+
definitions: tools.definitions.filter((t) => allowed(t.name)),
|
|
124
|
+
handlers: Object.fromEntries(Object.entries(tools.handlers).filter(([k]) => allowed(k))),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Creates the UI Code Reviewer: a read-only sub-agent that reviews changed web files for Genesis
|
|
129
|
+
* UI pattern compliance and semantic correctness, and submits exactly one verdict through
|
|
130
|
+
* `submit_code_review`. Register it in a parent agent's `subAgents` and call it with
|
|
131
|
+
* {@link runCodeReviewPreGate}.
|
|
132
|
+
*
|
|
133
|
+
* The tool budget, `tailContext` nudges, `history` cache scope and the read-only tool set are
|
|
134
|
+
* fixed here so every host gets the same cost behaviour.
|
|
135
|
+
* @beta
|
|
136
|
+
*/
|
|
137
|
+
export function createCodeReviewAgent(options) {
|
|
138
|
+
var _a, _b, _c;
|
|
139
|
+
const files = readOnlyFileTools(isFileTools(options.files) ? options.files : fileReaderTools(options.files));
|
|
140
|
+
const extraRules = (_a = options.extraRules) !== null && _a !== void 0 ? _a : [];
|
|
141
|
+
const grounding = options.grounding;
|
|
142
|
+
return Object.assign(Object.assign({ name: CODE_REVIEWER_AGENT_NAME, description: (_b = options.description) !== null && _b !== void 0 ? _b : 'Reviews changed web files for Genesis UI pattern compliance before they are written.' }, (options.provider !== undefined ? { provider: options.provider } : {})), { thinkingPolicy: (_c = options.thinkingPolicy) !== null && _c !== void 0 ? _c : 'off',
|
|
143
|
+
// Byte-stable: the turn-count nudges are delivered per turn via tailContext (below), NOT
|
|
144
|
+
// concatenated here, so the prompt never churns mid-review — see reviewerTailContext.
|
|
145
|
+
systemPrompt: buildCodeReviewerPrompt({
|
|
146
|
+
triggerTable: options.triggerTable,
|
|
147
|
+
grounding: grounding !== undefined,
|
|
148
|
+
}),
|
|
149
|
+
// 'history', not 'prompt' (GENC-1560). 'prompt' caches ONLY the tools+system prefix, so every
|
|
150
|
+
// tool result the reviewer has already read is resent uncached on every later turn of the
|
|
151
|
+
// SAME review. MEASURED in genesis-create: reviews routinely ran 22–26 turns, and ten such
|
|
152
|
+
// reviews cost $51 of a $73 scenario run under 'prompt'. 'history' caches the growing
|
|
153
|
+
// conversation itself. No-op on Gemini (implicit caching). Depends on systemPrompt staying
|
|
154
|
+
// byte-stable turn to turn.
|
|
155
|
+
cachePolicy: { scope: 'history' },
|
|
156
|
+
// Resolved every turn, but injected outside the cached prefix — '' (the common case, before
|
|
157
|
+
// turn 6) is dropped. Raw content; foundation-ai frames it in a <system-reminder>.
|
|
158
|
+
tailContext: reviewerTailContext,
|
|
159
|
+
// Bounds the read/explore loop: force the verdict before the framework's
|
|
160
|
+
// max-iterations cap turns a runaway into a silent, expensive fail-open.
|
|
161
|
+
toolChoice: reviewerToolChoice, toolDefinitions: [
|
|
162
|
+
...files.definitions,
|
|
163
|
+
...createContextToolDefinitions(extraRules),
|
|
164
|
+
...(grounding ? [grounding.definition] : []),
|
|
165
|
+
submitCodeReviewToolDefinition,
|
|
166
|
+
], toolHandlers: Object.assign(Object.assign(Object.assign(Object.assign({}, files.handlers), createContextToolHandlers(extraRules)), (grounding ? { [grounding.definition.name]: grounding.handler } : {})), { submit_code_review: submitCodeReviewHandler }) });
|
|
167
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { CONTEXT_TRIGGER_TABLE } from './rules/context-trigger-map';
|
|
2
|
+
/**
|
|
3
|
+
* The reviewer's tool names in the order the prompt lists them. `query_project_schema` is listed
|
|
4
|
+
* only when the host registers it — the prompt must never name a tool the host did not wire.
|
|
5
|
+
*/
|
|
6
|
+
export const CODE_REVIEWER_BASE_TOOL_NAMES = [
|
|
7
|
+
'vfs_read',
|
|
8
|
+
'vfs_list',
|
|
9
|
+
'search_context',
|
|
10
|
+
'read_contextIndex',
|
|
11
|
+
'read_context',
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* The reviewer's system prompt (moved from genesis-create, text unchanged — FUI-2650). Byte-stable
|
|
15
|
+
* for a given host: turn-count nudges go in `tailContext`, never here, or the `history` cache
|
|
16
|
+
* breaks on every turn (GENC-1560).
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
export function buildCodeReviewerPrompt(options = {}) {
|
|
20
|
+
var _a;
|
|
21
|
+
const triggerTable = (_a = options.triggerTable) !== null && _a !== void 0 ? _a : CONTEXT_TRIGGER_TABLE;
|
|
22
|
+
const toolNames = [
|
|
23
|
+
...CODE_REVIEWER_BASE_TOOL_NAMES,
|
|
24
|
+
...(options.grounding ? ['query_project_schema'] : []),
|
|
25
|
+
'submit_code_review',
|
|
26
|
+
];
|
|
27
|
+
return `You are an automated code reviewer for Genesis React/TypeScript applications.
|
|
28
|
+
|
|
29
|
+
You receive a set of changed files immediately before they are written to disk. Your job: catch semantic issues that TypeScript and Vite cannot verify. You do NOT generate or fix code — you read, evaluate, and submit exactly one verdict.
|
|
30
|
+
|
|
31
|
+
**TypeScript type errors and Vite build errors have already been checked by automated tooling.** Do NOT re-check TypeScript correctness. Your job is semantic and pattern compliance only.
|
|
32
|
+
|
|
33
|
+
**Your tool set is exactly: ${toolNames.join(', ')}.**
|
|
34
|
+
Calling vfs_edit, vfs_write, or any other tool will fail immediately.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Step 1 — Locate the files
|
|
39
|
+
|
|
40
|
+
**READ EVERYTHING YOU NEED IN ONE PARALLEL BATCH — never one call per reply.** MEASURED (GENC-1560 buildout scenario): reviews of a real multi-file change routinely ran 22–26 separate turns, most of them a single \`vfs_read\` or \`read_context\` call each — the SAME total reads would have taken 2–3 turns done as parallel batches. Every extra sequential turn resends this review's own growing history in full; batching is not a style preference, it directly controls how much this review costs. Decide up front what you need — the supplied files' related imports, AND every context module the trigger table below matches — and emit ALL of those tool calls together, in ONE reply:
|
|
41
|
+
|
|
42
|
+
\`\`\`
|
|
43
|
+
// One reply, multiple tool calls — not four separate turns:
|
|
44
|
+
read_context({ name: "fui-column-defs" })
|
|
45
|
+
read_context({ name: "fui-styling" })
|
|
46
|
+
vfs_read({ path: "MainTrading/AxesGrid/AxesGridOptions.ts" })
|
|
47
|
+
vfs_read({ path: "MainTrading/AxesGrid/AxesTypes.ts" })
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
Two batches is normal for a large change (e.g. \`read_contextIndex\` + initial reads, then a second batch once you know what else you need); a THIRD round of individual single-tool-call turns is the failure mode this section exists to prevent.
|
|
51
|
+
|
|
52
|
+
The files to review are in your context message under the \`files\` array. A NEW file arrives as \`{ path, content }\` (full content); an EDITED file arrives as \`{ path, diff }\` — a unified diff of this change only (\`-\` removed, \`+\` added, other lines unchanged context). Planned files additionally carry \`purpose\` and \`acceptanceChecks\` from the architecture plan.
|
|
53
|
+
**Do NOT call vfs_read for a path supplied with \`content\`** — use the supplied content directly. For a \`diff\` entry, the CHANGE is the subject of your review: judge the added/changed lines, and do NOT flag pre-existing code that merely appears as diff context — it is not part of this change. You MAY vfs_read a diff entry's own path when surrounding code is genuinely needed to judge the change (the read returns the post-edit content) — but decide THAT up front too, and batch it with everything else, rather than reading one diff file, deciding you need another, and reading that next turn.
|
|
54
|
+
|
|
55
|
+
You MAY read OTHER VFS files, but only ones **directly relevant** to reviewing the supplied files. A file is directly relevant only if a supplied file imports from it, or it imports from a supplied file, AND you need to confirm a specific symbol or type. Do NOT read a file merely because it belongs to the same page or feature, and do NOT survey the project. When in doubt, submit your verdict: over-reading is itself a failure mode.
|
|
56
|
+
|
|
57
|
+
## Step 2 — Identify and load relevant contexts (run in parallel)
|
|
58
|
+
|
|
59
|
+
1. Call read_contextIndex() to get the full module catalog.
|
|
60
|
+
2. Inspect the imports, component names, and patterns in the provided files.
|
|
61
|
+
3. In one parallel batch, call read_context(name) for every relevant module.
|
|
62
|
+
|
|
63
|
+
Context trigger map — load the matching module if any of these signals appear in the provided files:
|
|
64
|
+
|
|
65
|
+
${triggerTable}
|
|
66
|
+
|
|
67
|
+
## Step 3 — Evaluate against loaded context rules
|
|
68
|
+
|
|
69
|
+
For each loaded context, check only the rules and anti-patterns it explicitly documents. Do NOT invent new rules or apply personal style preferences.
|
|
70
|
+
|
|
71
|
+
Additionally, check these universal issues regardless of which contexts were loaded:
|
|
72
|
+
|
|
73
|
+
**BLOCKING — must be fixed before the changes apply (a runtime/build break, or a hard Genesis convention):**
|
|
74
|
+
- JSX syntax (\`<ComponentName />\`, \`<div>\`, JSX expressions) written inside a \`.ts\` file (non-component files like column defs, store slices, and utilities must be \`.ts\`)
|
|
75
|
+
- React hooks (\`useState\`, \`useEffect\`, \`useRef\`, \`useCallback\`, \`useMemo\`) called after a conditional \`return\` statement — violates React rules of hooks
|
|
76
|
+
- Explicit \`any\` type annotation on a variable, function parameter, return type, or generic
|
|
77
|
+
- **Raw HTML form/interactive controls where a design-system component exists** — \`<input>\` / \`<select>\` / \`<textarea>\` / \`<button>\` used instead of \`TextField\` / \`NumberField\` / \`Select\` + \`ListboxOption\` / \`TextArea\` / \`Button\` from \`@genesislcap/rapid-design-system/react\`. Genesis components give design tokens, theming, and consistent behaviour; raw HTML controls skip all of it. A frequent tell: a design-system form component is imported but the field is rendered as raw HTML (which also leaves the import unused). Scope it tightly: layout/semantic elements (\`<div>\`, \`<span>\`, etc.) are fine, and a \`<table>\` is fine for a FIXED non-interactive matrix (a price ladder, a key/value summary) though a scrolling/sortable DATASET belongs in RapidGridPro, and a native control genuinely required with NO Genesis equivalent (e.g. a file input) is not a violation — do not flag those. But do NOT narrow this to form fields: an interactive \`<button>\` is in scope WHEREVER it appears — inside an ag-Grid cell renderer, in a toolbar strip, inside a hand-built modal — because \`Button\` always exists and a native one is unthemed everywhere. A whole renderer component returning \`<button style={{…}}>\` is the same violation as an inline one; the extra file does not make it a different thing. **Separately: a hand-built toolbar div or strip rendered directly above or beside an \`<EntityManagement>\` grid is itself the anti-pattern, themed button or not** — grid-level actions belong on the grid via \`customActions\` (\`{ name, action, position: CrudMenuPosition.Top, requiresSelection? }\`), not in a sibling container. Flag the container as the primary issue there, not just an unthemed button inside it. This is ADVISORY, not blocking — a hand-rolled strip beside a RapidGridPro grid, a page-level filter row, or an \`onRenderTabSet\` action is legitimate. This exact case shipped and passed review, because an earlier version of this line ended "flag only a form field".
|
|
78
|
+
|
|
79
|
+
**ADVISORY — non-blocking, worth flagging:**
|
|
80
|
+
- TODO / stub / placeholder code — NOT only comments. The comment forms (\`// TODO: implement\`, empty function bodies, \`throw new Error('not implemented')\`) are the easy ones. The form that actually ships is a handler that RUNS and does the wrong thing: \`onClick={() => alert('+ New RFQ placeholder clicked!')}\`, \`onClick={() => console.log('todo')}\`, a submit that only closes the dialog. This passed review on every step of a benchmark run because the checklist said "comments". Treat any \`alert()\`/\`console.log()\` standing in for a real interaction as a stub — but do NOT flag \`alert()\` used as genuine post-submit success/error feedback next to a real \`commitGenesisEvent\`; that is crude, not missing.
|
|
81
|
+
- Hardcoded enum or status strings in UI that the server schema defines (should be fetched or imported from a typed constant)
|
|
82
|
+
|
|
83
|
+
**PLAN ACCEPTANCE CHECKS — verify when supplied:** a file entry may carry its plan spec: \`purpose\` (what the file is for) and \`acceptanceChecks\` (the planner's concrete "done" criteria for that file). Verify each acceptance check against the supplied content or diff (vfs_read the file's own path when the diff alone cannot confirm a check). Report every unmet check as an issue, quoting the failed check — blocking when required behaviour is missing or wrong, advisory when the shortfall is cosmetic or partial. A check you cannot verify from the code alone (e.g. it needs the running app) is NOT an issue — skip it. Files without these fields have no plan spec; review them against the loaded context rules only.
|
|
84
|
+
|
|
85
|
+
## Step 4 — Call submit_code_review exactly once
|
|
86
|
+
|
|
87
|
+
**Only report an issue you are CONFIRMING is a real violation.** Decide each candidate issue BEFORE you write it: if, on inspection, the code is actually correct (it follows the rule, the cast is necessary, the pattern is the documented one), do NOT list it. NEVER emit a \`[BLOCKING]\` (or advisory) issue whose own explanation concludes the code is fine ("…however this is correct", "…this is fine per <rule>") — that wastes a whole fix cycle making the primary agent "fix" working code. A blocking verdict must contain only issues that genuinely block. If you are unsure whether something is a violation, leave it out.
|
|
88
|
+
|
|
89
|
+
Submit as soon as you have evaluated the supplied files against the loaded contexts — do not keep exploring for more files to read. Once you have your verdict:
|
|
90
|
+
|
|
91
|
+
\`\`\`
|
|
92
|
+
// All clear:
|
|
93
|
+
submit_code_review({ approved: true })
|
|
94
|
+
|
|
95
|
+
// Advisory issues only (changes proceed, feedback attached):
|
|
96
|
+
submit_code_review({ approved: false, severity: "advisory", feedback: "<numbered list>" })
|
|
97
|
+
|
|
98
|
+
// Any blocking issue (changes rejected, primary agent must fix first):
|
|
99
|
+
submit_code_review({ approved: false, severity: "blocking", feedback: "<numbered list>" })
|
|
100
|
+
\`\`\`
|
|
101
|
+
|
|
102
|
+
In \`feedback\`: for each issue include the file path, the violating code snippet, the rule violated (referencing the loaded context by name), and the correct pattern. List ALL issues — both blocking and advisory — when severity is "blocking".`;
|
|
103
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { CODE_REVIEWER_AGENT_NAME, } from './code-review.types';
|
|
3
|
+
import { buildUnifiedDiff } from './unified-diff';
|
|
4
|
+
// Review-proportionality thresholds (R12): micro-changes skip the semantic reviewer.
|
|
5
|
+
// A single small edit, or a 2-3 file batch of tiny tweaks, is not worth a sub-agent run.
|
|
6
|
+
const MINOR_SINGLE_FILE_DELTA = 500;
|
|
7
|
+
const MINOR_BATCH_TOTAL_DELTA = 700;
|
|
8
|
+
const MINOR_BATCH_MAX_FILES = 3;
|
|
9
|
+
/**
|
|
10
|
+
* Whether a change is big enough to review. Minor changes skip the model: CSS-only, a single
|
|
11
|
+
* non-CSS file whose size changed by under 500 characters, or a batch of at most 3 brand-new
|
|
12
|
+
* files totalling under 700 characters. A multi-file batch containing any edit always reviews.
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export function shouldRunCodeReviewPreGate(files) {
|
|
16
|
+
const reviewable = files.filter((f) => f.newContent !== '');
|
|
17
|
+
if (reviewable.length === 0)
|
|
18
|
+
return false;
|
|
19
|
+
const nonCss = reviewable.filter((f) => !f.path.endsWith('.css'));
|
|
20
|
+
if (nonCss.length === 0)
|
|
21
|
+
return false;
|
|
22
|
+
if (nonCss.length === 1) {
|
|
23
|
+
const delta = Math.abs(nonCss[0].newContent.length - nonCss[0].oldContent.length);
|
|
24
|
+
return delta >= MINOR_SINGLE_FILE_DELTA;
|
|
25
|
+
}
|
|
26
|
+
// Multi-file batch: only skip when EVERY non-CSS file is a brand-new create. An edit can
|
|
27
|
+
// swap logic without changing length, so its length delta is a lie — never skip a batch
|
|
28
|
+
// that contains one. For all-creates the delta really is file size, so gate on total size.
|
|
29
|
+
const allCreates = nonCss.every((f) => f.oldContent === '');
|
|
30
|
+
if (!allCreates)
|
|
31
|
+
return true;
|
|
32
|
+
const totalSize = nonCss.reduce((sum, f) => sum + f.newContent.length, 0);
|
|
33
|
+
// A small batch of tiny new files is as minor as one small edit — bounded by file count
|
|
34
|
+
// so a wide batch always reviews regardless of its combined size.
|
|
35
|
+
return !(nonCss.length <= MINOR_BATCH_MAX_FILES && totalSize < MINOR_BATCH_TOTAL_DELTA);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Builds the reviewer's `files` context. Edits ride as a compact unified diff so the reviewer
|
|
39
|
+
* judges THIS change, not the pre-existing file around it; new files keep full content (recall
|
|
40
|
+
* risk on creations is real), as does an edit too large to diff cheaply. A plan spec rides
|
|
41
|
+
* along on either shape. Deletions are dropped.
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
export function buildReviewFiles(files, specFor) {
|
|
45
|
+
return files
|
|
46
|
+
.filter((f) => f.newContent !== '')
|
|
47
|
+
.map((f) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const diff = f.oldContent === '' ? null : buildUnifiedDiff(f.path, f.oldContent, f.newContent);
|
|
50
|
+
const body = diff === null ? { content: f.newContent } : { diff };
|
|
51
|
+
const spec = specFor === null || specFor === void 0 ? void 0 : specFor(f.path);
|
|
52
|
+
return Object.assign(Object.assign(Object.assign({ path: f.path }, body), (((_a = spec === null || spec === void 0 ? void 0 : spec.purpose) === null || _a === void 0 ? void 0 : _a.trim()) ? { purpose: spec.purpose } : {})), (((_b = spec === null || spec === void 0 ? void 0 : spec.acceptanceChecks) === null || _b === void 0 ? void 0 : _b.length) ? { acceptanceChecks: spec.acceptanceChecks } : {}));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Sends already-built review files to the reviewer sub-agent and maps its outcome. A sub-agent
|
|
57
|
+
* that never returns a verdict yields `{ unavailable, reason }` — callers fail open on it (a
|
|
58
|
+
* reviewer crash must not block a change whose mechanical checks passed) but must not claim the
|
|
59
|
+
* review found no errors.
|
|
60
|
+
* @beta
|
|
61
|
+
*/
|
|
62
|
+
export function requestCodeReview(files, requestSubAgent) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const withChecks = files.filter((f) => { var _a; return (_a = f.acceptanceChecks) === null || _a === void 0 ? void 0 : _a.length; }).length;
|
|
65
|
+
const verdict = yield requestSubAgent(CODE_REVIEWER_AGENT_NAME, {
|
|
66
|
+
task: `Review ${files.length} changed file(s) for Genesis UI pattern compliance and semantic correctness.` +
|
|
67
|
+
(withChecks > 0
|
|
68
|
+
? ` ${withChecks} file(s) carry their plan spec (purpose / acceptanceChecks) — verify each acceptance check and report any unmet one as an issue.`
|
|
69
|
+
: ''),
|
|
70
|
+
context: { files },
|
|
71
|
+
historyCap: 1,
|
|
72
|
+
});
|
|
73
|
+
if ('reason' in verdict)
|
|
74
|
+
return { unavailable: true, reason: verdict.reason };
|
|
75
|
+
return verdict.result;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Invokes the code reviewer sub-agent before the host commits a change.
|
|
80
|
+
* Returns the verdict; an `{ unavailable, reason }` marker when the sub-agent failed to produce
|
|
81
|
+
* one; or `null` when the change is minor (see {@link shouldRunCodeReviewPreGate}) or no
|
|
82
|
+
* sub-agent caller is available.
|
|
83
|
+
* @beta
|
|
84
|
+
*/
|
|
85
|
+
export function runCodeReviewPreGate(files_1, requestSubAgent_1) {
|
|
86
|
+
return __awaiter(this, arguments, void 0, function* (files, requestSubAgent, options = {}) {
|
|
87
|
+
if (!requestSubAgent)
|
|
88
|
+
return null;
|
|
89
|
+
if (!shouldRunCodeReviewPreGate(files))
|
|
90
|
+
return null;
|
|
91
|
+
return requestCodeReview(buildReviewFiles(files, options.specFor), requestSubAgent);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The UI Code Reviewer (`@genesislcap/ai-assistant/code-review`) — FUI-2650.
|
|
3
|
+
*
|
|
4
|
+
* A read-only sub-agent that reviews changed web files for Genesis UI pattern compliance and
|
|
5
|
+
* semantic correctness, the proportionality gate that decides when to run it, and the default
|
|
6
|
+
* Genesis web rule pack it reviews against. Lifted from genesis-create's UI Builder; Create is its
|
|
7
|
+
* first consumer.
|
|
8
|
+
*
|
|
9
|
+
* Its own entry point, not re-exported from the package root: the rule pack is several hundred KB
|
|
10
|
+
* of reference text that only a host running the reviewer should pay for. Node hosts (a CI job)
|
|
11
|
+
* get the same surface from `./chat-driver`, which bundles it with the driver it runs on. The
|
|
12
|
+
* `<ai-code-review-result>` element is on the package root, since it needs a DOM.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
export { CODE_REVIEWER_AGENT_NAME, } from './code-review.types';
|
|
18
|
+
export { buildReviewFiles, requestCodeReview, runCodeReviewPreGate, shouldRunCodeReviewPreGate, } from './gate';
|
|
19
|
+
export { createCodeReviewAgent, } from './code-reviewer.agent';
|
|
20
|
+
export { buildCodeReviewerPrompt } from './code-reviewer.prompt';
|
|
21
|
+
export { submitCodeReviewHandler, submitCodeReviewToolDefinition } from './submit-code-review.tool';
|
|
22
|
+
export { createHeadlessSubAgentCaller, isGenesisWebFile, parseUnifiedDiff, reviewChanges, } from './review-changes';
|
|
23
|
+
export { summarizeCodeReview } from './verdict';
|
|
24
|
+
export { buildUnifiedDiff } from './unified-diff';
|
|
25
|
+
// The default Genesis web rule pack. genesis-create's writer agents read the same modules, so the
|
|
26
|
+
// whole registry surface is public, not just what the reviewer needs.
|
|
27
|
+
export { contextToolDefinitions, createContextToolDefinitions, createContextToolHandlers, GENESIS_WEB_RULE_MODULE_NAMES, getContextModule, isKnownContext, MAX_DEPENDENCY_CONTEXT_CHARS, MAX_DEPENDENCY_CONTEXT_MODULES, resolveContextDependencies, searchContextModules, } from './rules/context.registry';
|
|
28
|
+
export { CONTEXT_TRIGGER_TABLE } from './rules/context-trigger-map';
|