@genesislcap/ai-assistant 15.70.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 +9287 -6447
- 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 +10 -0
- 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 +7 -0
- package/dist/react.mjs +6 -0
- package/docs/code-review.md +137 -0
- package/package.json +24 -17
- package/scripts/smoke-chat-driver-node.mjs +15 -0
|
@@ -34,4 +34,6 @@ export { buildTimelineEntries } from './state/persistence/build-timeline-entries
|
|
|
34
34
|
export type { TurnSnapshotLike } from './state/persistence/build-timeline-entries';
|
|
35
35
|
export { assembleDebugLog, withFreshMetaSnapshot } from './state/persistence/diagnostics';
|
|
36
36
|
export type { DebugLog, DiagnosticEntry } from './state/persistence/diagnostics';
|
|
37
|
+
export { CODE_REVIEWER_AGENT_NAME, createCodeReviewAgent, createHeadlessSubAgentCaller, isGenesisWebFile, parseUnifiedDiff, reviewChanges, summarizeCodeReview, } from './code-review';
|
|
38
|
+
export type { CodeReviewAgentOptions, CodeReviewFileReader, CodeReviewGateResult, CodeReviewResult, CodeReviewStatus, CodeReviewSummary, ReviewChangesOptions, ReviewChangesResult, } from './code-review';
|
|
37
39
|
//# sourceMappingURL=chat-driver-node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-driver-node.d.ts","sourceRoot":"","sources":["../../src/chat-driver-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAA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; {@link runCodeReviewPreGate} does.
|
|
4
|
+
* @beta
|
|
5
|
+
*/
|
|
6
|
+
export declare const CODE_REVIEWER_AGENT_NAME = "UI Code Reviewer";
|
|
7
|
+
/**
|
|
8
|
+
* A verdict from the reviewer's `submit_code_review` tool.
|
|
9
|
+
*
|
|
10
|
+
* - `approved: true`: the change proceeds.
|
|
11
|
+
* - `approved: false`, `severity: 'blocking'`: the change is rejected and the writer must fix it.
|
|
12
|
+
* - `approved: false`, `severity: 'advisory'`: the change proceeds with `feedback` attached.
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export interface CodeReviewResult {
|
|
16
|
+
approved: boolean;
|
|
17
|
+
severity?: 'blocking' | 'advisory';
|
|
18
|
+
feedback?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Result of the code-review pre-gate. A {@link CodeReviewResult} is a real verdict; the
|
|
22
|
+
* `unavailable` shape means the reviewer sub-agent failed to return one (e.g. max_iterations),
|
|
23
|
+
* which callers fail open on — but must NOT report as a clean pass (GENC-1358).
|
|
24
|
+
* @beta
|
|
25
|
+
*/
|
|
26
|
+
export type CodeReviewGateResult = CodeReviewResult | {
|
|
27
|
+
unavailable: true;
|
|
28
|
+
reason: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A file as the host sees it: the version on disk (`oldContent`, `''` for a new file) and the
|
|
32
|
+
* version under review (`newContent`, `''` for a deletion, which is never reviewed).
|
|
33
|
+
* @beta
|
|
34
|
+
*/
|
|
35
|
+
export interface ChangedFile {
|
|
36
|
+
path: string;
|
|
37
|
+
newContent: string;
|
|
38
|
+
oldContent: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The host's plan for one file. The reviewer verifies each acceptance check and reports any
|
|
42
|
+
* unmet one as an issue.
|
|
43
|
+
* @beta
|
|
44
|
+
*/
|
|
45
|
+
export interface ReviewFileSpec {
|
|
46
|
+
purpose?: string;
|
|
47
|
+
acceptanceChecks?: string[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One file as it is sent to the reviewer: a new file carries its full `content`, an edit carries
|
|
51
|
+
* a unified `diff` of this change only (or full `content` when the file is too large to diff).
|
|
52
|
+
* @beta
|
|
53
|
+
*/
|
|
54
|
+
export type ReviewFile = ({
|
|
55
|
+
path: string;
|
|
56
|
+
content: string;
|
|
57
|
+
} | {
|
|
58
|
+
path: string;
|
|
59
|
+
diff: string;
|
|
60
|
+
}) & ReviewFileSpec;
|
|
61
|
+
/**
|
|
62
|
+
* The host's sub-agent caller — the shape of the assistant's `requestSubAgent`.
|
|
63
|
+
* @beta
|
|
64
|
+
*/
|
|
65
|
+
export type SubAgentCaller = <T = never>(name: string, opts?: {
|
|
66
|
+
task?: string;
|
|
67
|
+
context?: Record<string, unknown>;
|
|
68
|
+
historyCap?: number;
|
|
69
|
+
}) => Promise<{
|
|
70
|
+
ok: true;
|
|
71
|
+
result: T;
|
|
72
|
+
} | {
|
|
73
|
+
ok: false;
|
|
74
|
+
reason: string;
|
|
75
|
+
}>;
|
|
76
|
+
//# sourceMappingURL=code-review.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-review.types.d.ts","sourceRoot":"","sources":["../../../src/code-review/code-review.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,WAAW,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAC3F,cAAc,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,GAAG,KAAK,EACrC,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,KAC7E,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ChatThinkingPolicy, ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
2
|
+
import type { AgentConfig, ProviderInput } from '../config/config';
|
|
3
|
+
import { type RuleModule } from './rules/context.registry';
|
|
4
|
+
/**
|
|
5
|
+
* Reads the files the reviewer may inspect.
|
|
6
|
+
*
|
|
7
|
+
* **`read` must return the version under review** — the post-edit / pending content, not the
|
|
8
|
+
* version on disk. A reader that returns the on-disk file makes the reviewer flag the pre-edit
|
|
9
|
+
* code as a bug in a change that only exists in the host's buffer (the phantom-issue failure
|
|
10
|
+
* genesis-create hit before GENC-1389), and the host can never clear it.
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export interface CodeReviewFileReader {
|
|
14
|
+
/** Post-edit content of `path`, or `undefined` when it does not exist. */
|
|
15
|
+
read(path: string): string | undefined | Promise<string | undefined>;
|
|
16
|
+
/** Every path the reviewer may read. */
|
|
17
|
+
list(): string[] | Promise<string[]>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A host's own `vfs_read` / `vfs_list` tools, for a host that already has them (genesis-create
|
|
21
|
+
* passes its VFS tools backed by the pending buffer). Only those two names are accepted.
|
|
22
|
+
* @beta
|
|
23
|
+
*/
|
|
24
|
+
export interface CodeReviewFileTools {
|
|
25
|
+
definitions: ChatToolDefinition[];
|
|
26
|
+
handlers: ChatToolHandlers;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Optional project grounding — genesis-create's `query_project_schema`. A host without it simply
|
|
30
|
+
* does not register the tool, and the prompt does not name it.
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
export interface CodeReviewGrounding {
|
|
34
|
+
definition: ChatToolDefinition;
|
|
35
|
+
handler: ChatToolHandlers[string];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The host-supplied ports for {@link createCodeReviewAgent}.
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
export interface CodeReviewAgentOptions {
|
|
42
|
+
/** How the reviewer reads files. See {@link CodeReviewFileReader} — post-edit content only. */
|
|
43
|
+
files: CodeReviewFileReader | CodeReviewFileTools;
|
|
44
|
+
/** Project rule modules added to the default Genesis web pack. */
|
|
45
|
+
extraRules?: RuleModule[];
|
|
46
|
+
/** Trigger-table override (signal → module rows). Defaults to the Genesis web table. */
|
|
47
|
+
triggerTable?: string;
|
|
48
|
+
/** Optional `query_project_schema`. */
|
|
49
|
+
grounding?: CodeReviewGrounding;
|
|
50
|
+
/**
|
|
51
|
+
* Provider registry name (or resolver). Omit to use the host's default. The reviewer runs on
|
|
52
|
+
* every meaningful write, so pick a fast, cheap tier: a reasoning tier here dominates cost.
|
|
53
|
+
*/
|
|
54
|
+
provider?: ProviderInput;
|
|
55
|
+
/** Thinking posture. Defaults to `'off'` for the same cost reason as `provider`. */
|
|
56
|
+
thinkingPolicy?: ChatThinkingPolicy;
|
|
57
|
+
/** Sub-agent description shown to the parent agent. */
|
|
58
|
+
description?: string;
|
|
59
|
+
}
|
|
60
|
+
/** @internal */
|
|
61
|
+
export declare const FORCE_AT = 25;
|
|
62
|
+
/** @internal */
|
|
63
|
+
export declare const WARN_FROM = 18;
|
|
64
|
+
/** @internal */
|
|
65
|
+
export declare const BATCHING_REMINDER_FROM = 6;
|
|
66
|
+
/**
|
|
67
|
+
* Creates the UI Code Reviewer: a read-only sub-agent that reviews changed web files for Genesis
|
|
68
|
+
* UI pattern compliance and semantic correctness, and submits exactly one verdict through
|
|
69
|
+
* `submit_code_review`. Register it in a parent agent's `subAgents` and call it with
|
|
70
|
+
* {@link runCodeReviewPreGate}.
|
|
71
|
+
*
|
|
72
|
+
* The tool budget, `tailContext` nudges, `history` cache scope and the read-only tool set are
|
|
73
|
+
* fixed here so every host gets the same cost behaviour.
|
|
74
|
+
* @beta
|
|
75
|
+
*/
|
|
76
|
+
export declare function createCodeReviewAgent(options: CodeReviewAgentOptions): AgentConfig;
|
|
77
|
+
//# sourceMappingURL=code-reviewer.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-reviewer.agent.d.ts","sourceRoot":"","sources":["../../../src/code-review/code-reviewer.agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAElB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAC;AAIxF,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,0BA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
|
+
/**
|
|
2
|
+
* The reviewer's tool names in the order the prompt lists them. `query_project_schema` is listed
|
|
3
|
+
* only when the host registers it — the prompt must never name a tool the host did not wire.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CODE_REVIEWER_BASE_TOOL_NAMES: readonly ["vfs_read", "vfs_list", "search_context", "read_contextIndex", "read_context"];
|
|
6
|
+
/**
|
|
7
|
+
* Options for {@link buildCodeReviewerPrompt}.
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export interface CodeReviewerPromptOptions {
|
|
11
|
+
/** Trigger table rows (signal → module). Defaults to the Genesis web table. */
|
|
12
|
+
triggerTable?: string;
|
|
13
|
+
/** Whether the host registered `query_project_schema`. */
|
|
14
|
+
grounding?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The reviewer's system prompt (moved from genesis-create, text unchanged — FUI-2650). Byte-stable
|
|
18
|
+
* for a given host: turn-count nudges go in `tailContext`, never here, or the `history` cache
|
|
19
|
+
* breaks on every turn (GENC-1560).
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildCodeReviewerPrompt(options?: CodeReviewerPromptOptions): string;
|
|
23
|
+
//# sourceMappingURL=code-reviewer.prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-reviewer.prompt.d.ts","sourceRoot":"","sources":["../../../src/code-review/code-reviewer.prompt.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,6BAA6B,0FAMhC,CAAC;AAEX;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,yBAA8B,GAAG,MAAM,CAmFvF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ChangedFile, type CodeReviewGateResult, type ReviewFile, type ReviewFileSpec, type SubAgentCaller } from './code-review.types';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a change is big enough to review. Minor changes skip the model: CSS-only, a single
|
|
4
|
+
* non-CSS file whose size changed by under 500 characters, or a batch of at most 3 brand-new
|
|
5
|
+
* files totalling under 700 characters. A multi-file batch containing any edit always reviews.
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export declare function shouldRunCodeReviewPreGate(files: ChangedFile[]): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Options for {@link runCodeReviewPreGate}.
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export interface CodeReviewPreGateOptions {
|
|
14
|
+
/**
|
|
15
|
+
* The host's plan spec for a file, if it has one. The host owns path matching (for example,
|
|
16
|
+
* canonicalising a planned path against the path actually written).
|
|
17
|
+
*/
|
|
18
|
+
specFor?: (path: string) => ReviewFileSpec | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Builds the reviewer's `files` context. Edits ride as a compact unified diff so the reviewer
|
|
22
|
+
* judges THIS change, not the pre-existing file around it; new files keep full content (recall
|
|
23
|
+
* risk on creations is real), as does an edit too large to diff cheaply. A plan spec rides
|
|
24
|
+
* along on either shape. Deletions are dropped.
|
|
25
|
+
* @beta
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildReviewFiles(files: ChangedFile[], specFor?: (path: string) => ReviewFileSpec | undefined): ReviewFile[];
|
|
28
|
+
/**
|
|
29
|
+
* Sends already-built review files to the reviewer sub-agent and maps its outcome. A sub-agent
|
|
30
|
+
* that never returns a verdict yields `{ unavailable, reason }` — callers fail open on it (a
|
|
31
|
+
* reviewer crash must not block a change whose mechanical checks passed) but must not claim the
|
|
32
|
+
* review found no errors.
|
|
33
|
+
* @beta
|
|
34
|
+
*/
|
|
35
|
+
export declare function requestCodeReview(files: ReviewFile[], requestSubAgent: SubAgentCaller): Promise<CodeReviewGateResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Invokes the code reviewer sub-agent before the host commits a change.
|
|
38
|
+
* Returns the verdict; an `{ unavailable, reason }` marker when the sub-agent failed to produce
|
|
39
|
+
* one; or `null` when the change is minor (see {@link shouldRunCodeReviewPreGate}) or no
|
|
40
|
+
* sub-agent caller is available.
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
export declare function runCodeReviewPreGate(files: ChangedFile[], requestSubAgent: SubAgentCaller | undefined, options?: CodeReviewPreGateOptions): Promise<CodeReviewGateResult | null>;
|
|
44
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../../src/code-review/gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,oBAAoB,EAEzB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAS7B;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAkBxE;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;CACxD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,EAAE,EACpB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,GACrD,UAAU,EAAE,CAed;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,UAAU,EAAE,EACnB,eAAe,EAAE,cAAc,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAa/B;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,WAAW,EAAE,EACpB,eAAe,EAAE,cAAc,GAAG,SAAS,EAC3C,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAItC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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, type ChangedFile, type CodeReviewGateResult, type CodeReviewResult, type ReviewFile, type ReviewFileSpec, type SubAgentCaller, } from './code-review.types';
|
|
18
|
+
export { buildReviewFiles, requestCodeReview, runCodeReviewPreGate, shouldRunCodeReviewPreGate, type CodeReviewPreGateOptions, } from './gate';
|
|
19
|
+
export { createCodeReviewAgent, type CodeReviewAgentOptions, type CodeReviewFileReader, type CodeReviewFileTools, type CodeReviewGrounding, } from './code-reviewer.agent';
|
|
20
|
+
export { buildCodeReviewerPrompt, type CodeReviewerPromptOptions } from './code-reviewer.prompt';
|
|
21
|
+
export { submitCodeReviewHandler, submitCodeReviewToolDefinition } from './submit-code-review.tool';
|
|
22
|
+
export { createHeadlessSubAgentCaller, isGenesisWebFile, parseUnifiedDiff, reviewChanges, type PatchFile, type ReviewChangesOptions, type ReviewChangesResult, } from './review-changes';
|
|
23
|
+
export { summarizeCodeReview, type CodeReviewStatus, type CodeReviewSummary } from './verdict';
|
|
24
|
+
export { buildUnifiedDiff } from './unified-diff';
|
|
25
|
+
export { contextToolDefinitions, createContextToolDefinitions, createContextToolHandlers, GENESIS_WEB_RULE_MODULE_NAMES, getContextModule, isKnownContext, MAX_DEPENDENCY_CONTEXT_CHARS, MAX_DEPENDENCY_CONTEXT_MODULES, resolveContextDependencies, searchContextModules, type ContextEntry, type ResolvedContextModule, type RuleModule, } from './rules/context.registry';
|
|
26
|
+
export { CONTEXT_TRIGGER_TABLE } from './rules/context-trigger-map';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-review/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,wBAAwB,EACxB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,gBAAgB,EAChB,cAAc,EACd,4BAA4B,EAC5B,8BAA8B,EAC9B,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { AIProviderRegistry } from '@genesislcap/foundation-ai';
|
|
2
|
+
import type { AgentConfig } from '../config/config';
|
|
3
|
+
import type { CodeReviewGateResult, SubAgentCaller } from './code-review.types';
|
|
4
|
+
/**
|
|
5
|
+
* One file from a parsed unified diff.
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export interface PatchFile {
|
|
9
|
+
path: string;
|
|
10
|
+
/** `'create'` for a new file, `'edit'` for a modified one, `'delete'` for a removal. */
|
|
11
|
+
kind: 'create' | 'edit' | 'delete';
|
|
12
|
+
/** Full content of a created file. */
|
|
13
|
+
content?: string;
|
|
14
|
+
/** This file's section of the patch (header plus hunks) for an edit. */
|
|
15
|
+
diff?: string;
|
|
16
|
+
/** Characters on added (`+`) lines, excluding the leading marker. */
|
|
17
|
+
addedChars: number;
|
|
18
|
+
/** Characters on removed (`-`) lines, excluding the leading marker. */
|
|
19
|
+
removedChars: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parses a `git diff` / `git format-patch` unified diff into one entry per file. Binary files and
|
|
23
|
+
* renames without content changes are skipped.
|
|
24
|
+
* @beta
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseUnifiedDiff(patch: string): PatchFile[];
|
|
27
|
+
/**
|
|
28
|
+
* Whether the default Genesis web rule pack covers a path: TypeScript, TSX and CSS sources, not
|
|
29
|
+
* declaration files or tests.
|
|
30
|
+
* @beta
|
|
31
|
+
*/
|
|
32
|
+
export declare function isGenesisWebFile(path: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Runs agents as sub-agents with no parent conversation — the same lifecycle a parent
|
|
35
|
+
* `ChatDriver` uses for `requestSubAgent`, for hosts (a CI job, a script) that have a provider
|
|
36
|
+
* registry but no assistant.
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
39
|
+
export declare function createHeadlessSubAgentCaller(registry: AIProviderRegistry, agents: AgentConfig[]): SubAgentCaller;
|
|
40
|
+
/**
|
|
41
|
+
* Options for {@link reviewChanges}.
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
export interface ReviewChangesOptions {
|
|
45
|
+
/** Calls the reviewer — a host's `requestSubAgent`, or {@link createHeadlessSubAgentCaller}. */
|
|
46
|
+
requestSubAgent: SubAgentCaller;
|
|
47
|
+
/** Which paths the rule pack covers. Defaults to {@link isGenesisWebFile}. */
|
|
48
|
+
covers?: (path: string) => boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The outcome of {@link reviewChanges}: the gate result (`null` when skipped) and the files that
|
|
52
|
+
* were in and out of the rule pack's scope.
|
|
53
|
+
* @beta
|
|
54
|
+
*/
|
|
55
|
+
export interface ReviewChangesResult {
|
|
56
|
+
verdict: CodeReviewGateResult | null;
|
|
57
|
+
reviewed: string[];
|
|
58
|
+
outOfScope: string[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Reviews a unified diff without an assistant: keeps the files the rule pack covers, applies the
|
|
62
|
+
* same proportionality skip as the pre-gate, and asks the reviewer for one verdict. Edits ride as
|
|
63
|
+
* their diff, new files as full content; deletions are not reviewed.
|
|
64
|
+
*
|
|
65
|
+
* For an edit the skip rule uses the diff's added/removed character counts in place of the
|
|
66
|
+
* before/after file sizes, which it does not have.
|
|
67
|
+
* @beta
|
|
68
|
+
*/
|
|
69
|
+
export declare function reviewChanges(patch: string, options: ReviewChangesOptions): Promise<ReviewChangesResult>;
|
|
70
|
+
//# sourceMappingURL=review-changes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-changes.d.ts","sourceRoot":"","sources":["../../../src/code-review/review-changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAEV,oBAAoB,EAEpB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAG7B;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;IACnC,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;CACtB;AAOD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,CAmC3D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGtD;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,EAAE,WAAW,EAAE,GACpB,cAAc,CAwBhB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,gGAAgG;IAChG,eAAe,EAAE,cAAc,CAAC;IAChC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACrC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CA2B9B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared context trigger table used by Code Reviewer, Error Analyst, and Convergence Judge.
|
|
3
|
+
* Each row maps a code signal to the focused context module that covers it.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CONTEXT_TRIGGER_TABLE = "| If you see\u2026 | Load context |\n|---|---|\n| Imports from rapid-grid-pro, foundation-entity-management, or ag-Grid ColDef | fui-column-defs |\n| EntityManagement, createEvent, updateEvent, deleteEvent, onRowClicked | fui-entity-management |\n| RapidGridPro, GridProGenesisDatasource, GridProColumn, ColDef | fui-rapid-grid-pro |\n| Form, UiSchema, VerticalLayout, Categorization, Stepper, childElements | fui-form-component |\n| Dialog, Modal, Flyout, useRef for modal/flyout, ref.current?.show() | fui-dialogs |\n| Button, Select, ListboxOption, Tabs, TabPanel, Card, Snackbar, DatePicker, OptionsDatasource, MultiselectDatasource, Combobox, Multiselect | fui-primitives |\n| Redux slices, publishEventName, row selection, cross-tile filtering | fui-eventing |\n| Connect, snapshot(), request(), commitEvent(), stream() | fui-foundation-comms |\n| editable column config, cellEditor, inline editing | fui-inline-editing |\n| flexlayout-react, Layout, Model, TabNode, componentMap | fui-layout |\n| .css files or className styling | fui-styling |\n| TileErrorBoundary or withTileErrorBoundary | fui-error-boundary |\n| GlobalFilters, CriteriaBuilder, shared filter bar, Filters from foundation-forms | fui-global-filters |";
|
|
6
|
+
//# sourceMappingURL=context-trigger-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-trigger-map.d.ts","sourceRoot":"","sources":["../../../../src/code-review/rules/context-trigger-map.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,gtCAewE,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
2
|
+
/**
|
|
3
|
+
* One rule module: reference material the reviewer (and a writer) loads with `read_context`.
|
|
4
|
+
* @beta
|
|
5
|
+
*/
|
|
6
|
+
export interface ContextEntry {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
whenToUse: string[];
|
|
10
|
+
relatedContexts: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Modules this one cannot be applied correctly WITHOUT. Load-bearing since GENC-1560:
|
|
13
|
+
* read_context attaches each of these modules' content to the response (depth 1 — see
|
|
14
|
+
* resolveContextDependencies). Contrast `relatedContexts`, which stays documentation-only
|
|
15
|
+
* ("you might also want…"). Only add a name here when reading the parent without it
|
|
16
|
+
* produces wrong code — every entry is paid for in prompt characters on every read.
|
|
17
|
+
*/
|
|
18
|
+
dependsOn?: string[];
|
|
19
|
+
content: string;
|
|
20
|
+
tags: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* True if `name` is a real context module that read_context can load. Used to
|
|
24
|
+
* validate planner-supplied requiredContextModules before they reach the
|
|
25
|
+
* vfs_snapshot gate — an unknown name there can never be loaded, so the gate
|
|
26
|
+
* would reject the snapshot forever (snapshot↔read_context loop).
|
|
27
|
+
*/
|
|
28
|
+
export declare function isKnownContext(name: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* One module from the default pack, or `undefined` for an unknown name. For hosts and tests that
|
|
31
|
+
* need a module's text without going through `read_context`. One argument, so it is safe to pass
|
|
32
|
+
* point-free (`names.map(getContextModule)`).
|
|
33
|
+
* @beta
|
|
34
|
+
*/
|
|
35
|
+
export declare function getContextModule(name: string): ContextEntry | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* A host's own rule module, added to the default Genesis web pack. A module whose `name` matches
|
|
38
|
+
* a default module replaces it.
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
export interface RuleModule extends ContextEntry {
|
|
42
|
+
name: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Names of every module in the default Genesis web pack.
|
|
46
|
+
* @beta
|
|
47
|
+
*/
|
|
48
|
+
export declare const GENESIS_WEB_RULE_MODULE_NAMES: readonly string[];
|
|
49
|
+
/** A context module's payload as read_context returns it. */
|
|
50
|
+
export interface ResolvedContextModule {
|
|
51
|
+
name: string;
|
|
52
|
+
title: string;
|
|
53
|
+
content: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* How many dependency modules one read_context response may carry, and the total
|
|
57
|
+
* dependency content it may carry. The widest dependsOn list is fui-dashboard's three
|
|
58
|
+
* (fui-styling + fui-chart + fui-flexlayout). fui-styling alone grew past 45k chars once
|
|
59
|
+
* GENC-1560's container-chrome/token rules landed in it — this cap was measured at ~93k
|
|
60
|
+
* for the same three modules before that, so it is raised here with real headroom rather
|
|
61
|
+
* than left to silently start dropping a dependency on the next content edit to any of the
|
|
62
|
+
* three (GENC-1560: this exact drop reproduced during that work — fui-styling, listed last
|
|
63
|
+
* in FUI_DASHBOARD_DEPS at the time, fell into `omitted` the moment the combined total
|
|
64
|
+
* crossed 100k). fui-styling is now ALSO ordered first in FUI_DASHBOARD_DEPS so that even
|
|
65
|
+
* if a future edit pushes the total back over budget, the module actually needed for
|
|
66
|
+
* styling correctness is never the one silently dropped — fui-chart / fui-flexlayout are
|
|
67
|
+
* large reference material that degrades gracefully if the model reads them itself instead.
|
|
68
|
+
* Over-budget dependencies are NAMED in the response rather than dropped silently, so the
|
|
69
|
+
* model can still read_context them itself.
|
|
70
|
+
*/
|
|
71
|
+
export declare const MAX_DEPENDENCY_CONTEXT_MODULES = 4;
|
|
72
|
+
export declare const MAX_DEPENDENCY_CONTEXT_CHARS = 150000;
|
|
73
|
+
/**
|
|
74
|
+
* GENC-1560 — the dependsOn edges, resolved to actual content.
|
|
75
|
+
*
|
|
76
|
+
* Until now `dependsOn` was inert: read_context returned only the module it was asked for
|
|
77
|
+
* and read_contextIndex merely listed the names, so a module could declare a dependency the
|
|
78
|
+
* agent never received. That is exactly how fui-styling stayed invisible to the agent that
|
|
79
|
+
* writes CSS: fui-dashboard has declared 'fui-styling' as a dependency all along (its
|
|
80
|
+
* layering rules are why the KPI-strip-over-FlexLayout shape works), and reading
|
|
81
|
+
* fui-dashboard delivered none of it.
|
|
82
|
+
*
|
|
83
|
+
* DEPTH 1 — direct dependencies only, never dependencies-of-dependencies. Depth 1 makes the
|
|
84
|
+
* payload trivially bounded and provably cycle-free (there is no recursion to loop): the
|
|
85
|
+
* declared graph already contains a cycle, fui-column-defs ⇄ fui-formatters, which any
|
|
86
|
+
* deeper walk would have to special-case. A depth-2 walk from fui-blotter would also pull
|
|
87
|
+
* eight modules / ~200k chars for one read — far past the point where attaching beats
|
|
88
|
+
* letting the model ask. Self-references and unknown names are skipped.
|
|
89
|
+
*
|
|
90
|
+
* The budget is a parameter so the overflow path can be exercised: with the real caps no
|
|
91
|
+
* declared dependsOn list comes close, yet that path is the whole point of the guard (the
|
|
92
|
+
* silent drop it replaces is the incident above), so it must be provable rather than assumed.
|
|
93
|
+
*/
|
|
94
|
+
export declare function resolveContextDependencies(name: string, budget?: {
|
|
95
|
+
maxModules?: number;
|
|
96
|
+
maxChars?: number;
|
|
97
|
+
}, registry?: Record<string, ContextEntry>): {
|
|
98
|
+
dependencies: ResolvedContextModule[];
|
|
99
|
+
omitted: string[];
|
|
100
|
+
};
|
|
101
|
+
export declare function searchContextModules(query: string): Array<{
|
|
102
|
+
name: string;
|
|
103
|
+
score: number;
|
|
104
|
+
title: string;
|
|
105
|
+
description: string;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* The rule-pack tools: `search_context`, `read_contextIndex` and `read_context`. A host's own
|
|
109
|
+
* modules are named alongside the default pack in `read_context`'s valid-name list.
|
|
110
|
+
* @beta
|
|
111
|
+
*/
|
|
112
|
+
export declare function createContextToolDefinitions(extraModules?: RuleModule[]): ChatToolDefinition[];
|
|
113
|
+
/**
|
|
114
|
+
* The default pack's rule-pack tool definitions.
|
|
115
|
+
* @beta
|
|
116
|
+
*/
|
|
117
|
+
export declare const contextToolDefinitions: ChatToolDefinition[];
|
|
118
|
+
/**
|
|
119
|
+
* Handlers for the rule-pack tools, over the default pack plus a host's own modules.
|
|
120
|
+
* @beta
|
|
121
|
+
*/
|
|
122
|
+
export declare const createContextToolHandlers: (extraModules?: RuleModule[]) => ChatToolHandlers;
|
|
123
|
+
//# sourceMappingURL=context.registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.registry.d.ts","sourceRoot":"","sources":["../../../../src/code-review/rules/context.registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAkEvF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AA6eD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEvE;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
|
2
|
+
* Context for the generated app's own AI chat additions under ai/extensions/: tools, the widgets
|
|
3
|
+
* they open with requestInteraction, and writes. The widget contract, the write traps and the
|
|
4
|
+
* shape checks are read from @genesislcap/ai-assistant 15.54 (chat-interaction-wrapper,
|
|
5
|
+
* interaction-controller, genesis/write-commit, register-genesis-assistant), the version the seed's
|
|
6
|
+
* assistant runs on.
|
|
7
|
+
*
|
|
8
|
+
* Tags for selective context injection — inject when conversation mentions these keywords.
|
|
9
|
+
*/
|
|
10
|
+
export declare const FUI_AI_EXTENSIONS_TAGS: string[];
|
|
11
|
+
export declare const FUI_AI_EXTENSIONS_DEPS: string[];
|
|
12
|
+
export declare const FUI_AI_EXTENSIONS_CONTEXT = "\n## AI CHAT EXTENSIONS \u2014 the app's own chat tools, widgets and writes (`ai/extensions/`)\n\nThe generated app's AI chat already has tools made from the project: `req_*` reads for its request servers, and `event_*` actions for the events the project offers the chat. `ai/extensions/` is where the app adds its own: a tool those do not cover, a widget the chat shows, a rule for the chat's system prompt. This is guidance for doing that well, not a gate: build what the user asks for.\n\n**A widget reaches the chat only through a tool in `ai/extensions/index.ts`**, whose handler opens it with `context.requestInteraction`. **A widget file on its own does nothing**: no tool opens it, so the chat never shows it. **Never tell the user a tool or widget is ready** until `index.ts` exports a definition and a handler that open it.\n\n### Where the files go\n- Path keys under `ai/extensions/` map to `client/src/ai/extensions/`. The entry is `ai/extensions/index.ts`: the seed writes it as `export const extensions = {};` and the assistant reads it. **`vfs_read` it first** and keep every tool already in it.\n- Put each widget in its own file beside it (e.g. `ai/extensions/cancel-order-review.ts`) and import that file from `index.ts`, so the element is registered before any tool asks for it. **Write the tool that opens it in `index.ts` in the same change**: the widget file alone does nothing.\n- Only an app whose project selected AI Chat has this folder (the app then depends on `@genesislcap/ai-assistant`). In any other app an `ai/` write is skipped, and the write's `warnings` say so: AI Chat has to be on in the project first.\n- Never write `ai/generated/`: it is rewritten from the project's AI config on every generate.\n- **Import nothing from `@genesislcap/ai-assistant` or `@genesislcap/foundation-ai`** in these files. The app does not depend on foundation-ai, and the assistant checks the shape of `extensions` where it reads it, so type what you need structurally (section 1). Import only packages every generated app has: `@genesislcap/foundation-comms`, `@genesislcap/web-core`, `@genesislcap/foundation-events`, `@genesislcap/rapid-grid-pro`.\n- **No secrets and no AI vendor calls.** Never put an API key, token or password in these files, and never call an AI vendor (OpenAI, Anthropic, Gemini, \u2026) from them: the app's chat proxy holds the key and meters the spend. A tool talks to the app's own server through Connect, and to nothing else.\n- Extensions add tools, widgets and prompt text only. They cannot declare agents or sub-agents.\n\n### 1. The tool shape\nOne definition the model sees, and one handler that runs it, under the same name:\n\n```ts\n// ai/extensions/index.ts\nimport { getConnect } from '@genesislcap/foundation-comms';\nimport './cancel-order-review'; // registers <cancel-order-review> before a tool opens it\n\n// Typed here, not imported: the assistant checks `extensions` against its own types where it reads it.\ntype InteractionResult<T = unknown> = {\n status: 'approved' | 'rejected' | 'timeout';\n payload?: T;\n message?: string;\n};\ntype ToolContext = {\n requestInteraction: <T = unknown>(\n componentName: string,\n data: unknown,\n options?: { timeoutMs?: number; signal?: AbortSignal },\n ) => Promise<T>;\n turnSignal?: AbortSignal;\n};\ntype ToolHandler = (args: Record<string, unknown>, context: ToolContext) => Promise<unknown>;\n\n/** A criteria string literal: backslashes, then quotes, escaped, so a value can never end the expression. */\nconst quoted = (value: string) => `'${value.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\")}'`;\n\nconst openOrders: ToolHandler = async (args) => {\n const counterpartyId = String(args.counterpartyId ?? '').trim();\n if (!counterpartyId) return 'Say which counterparty (its COUNTERPARTY_ID).';\n const reply = await getConnect().request('REQ_ORDER', {\n REQUEST: {},\n DETAILS: { CRITERIA_MATCH: `COUNTERPARTY_ID == ${quoted(counterpartyId)} && STATUS == 'OPEN'` },\n });\n return serialisable((reply.REPLY ?? []).slice(0, 20));\n};\n\nexport const extensions = {\n toolDefinitions: [\n {\n name: 'open_orders_for_counterparty',\n description:\n 'Lists the OPEN orders of one counterparty, at most 20. Use it when the user asks what a ' +\n 'counterparty still has open. Returns rows of ORDER_ID, INSTRUMENT_ID, QUANTITY, PRICE.',\n parameters: {\n type: 'object',\n properties: {\n counterpartyId: { type: 'string', description: 'The COUNTERPARTY_ID, exactly as stored.' },\n },\n required: ['counterpartyId'],\n },\n },\n ],\n toolHandlers: { open_orders_for_counterparty: openOrders },\n};\n```\n- **Name**: snake_case and unique. Never `req_*` or `event_*`: those are the generated tools' names, and an extension tool with one of them replaces the generated tool, so the chat silently loses a tool that worked.\n- **A wrong shape blocks the whole chat.** The assistant checks `extensions` when it starts, and turns itself off with a fault message if:\n - a definition has no name;\n - a name is defined twice;\n - a definition has no handler of the same name, or a handler has no definition;\n - `systemPrompt` is not a string.\n\n Keep `toolDefinitions` and `toolHandlers` in step.\n- **Description**: written for the model. What it does, when to use it, what it returns, and for a write whether it asks the user first.\n- **Parameters**: a JSON schema. Mark the required ones, and describe each value's form (an id as text, a date as `YYYY-MM-DD`).\n- **What the handler returns** is what the model reads: a short string, or a small object that `JSON.stringify` can take. Return a refusal or a failure as text the model can relay (`'Not written: \u2026'`) rather than throwing.\n- The app's tsconfig is `strict` with `noUnusedParameters`, so an unused parameter is named `_args` or `_context`.\n- **A handler returns a Promise** (write it `async`), as the assistant's `ChatToolHandlers` requires. The assistant checks `extensions` against that type in `ai/generated/assistant.ts`, and the type check of the files you wrote does not report a mismatch there, so a handler typed `=> unknown` passes your check and still breaks the app's build.\n- Confirm every resource and event name with `query_project_schema` before using it. The names here (`REQ_ORDER`, `EVENT_ORDER_CANCEL`) are examples.\n\n### 2. Reads\n- Read with Connect: `getConnect().request('REQ_<TABLE>', \u2026)` for a request server, or `snapshot(resource, { CRITERIA_MATCH, MAX_ROWS })` for a data server. See `fui-foundation-comms` for the shapes.\n- **Filter a request server with `DETAILS.CRITERIA_MATCH`.** The Genesis server also applies fields put in `REQUEST`, but Create's instant preview does not. That is the mock backend the app runs on until the user switches to the live server, and there every row comes back. So `REQUEST: { ORDER_ID }` followed by `REPLY[0]` reads somebody else's order in the preview. Both apply `CRITERIA_MATCH` (string values single-quoted, with backslashes and quotes escaped, as `quoted` does above).\n- **Use the row whose key is the one you asked for**, never `REPLY[0]` blindly.\n- **Cap the rows in code** (`.slice(0, N)`): the instant preview does not apply `MAX_ROWS`. Return only the fields the model needs, since everything a tool returns goes into the conversation.\n- **A LONG beyond 2^53 arrives as a `BigInt`.** That covers ids, `RECORD_ID`, sequences and nano timestamps. `JSON.stringify` throws on one (\"Do not know how to serialize a BigInt\"), and the chat stringifies every tool result and every widget's `data`. So pass rows through a helper first:\n```ts\n/** A safe integer becomes a number; anything larger becomes its exact digits, never a rounded number. */\nfunction serialisable(value: unknown): unknown {\n if (typeof value === 'bigint') {\n const asNumber = Number(value);\n return Number.isSafeInteger(asNumber) ? asNumber : value.toString();\n }\n if (Array.isArray(value)) return value.map(serialisable);\n if (value && typeof value === 'object') {\n return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, serialisable(v)]));\n }\n return value;\n}\n```\n- **DATE and DATETIME travel as epoch millis** (UTC), both ways. Show them formatted, and send millis.\n- Reads run as the signed-in user, so the server's rights apply to them.\n\n### 3. Widgets: `context.requestInteraction`\nA handler can put a widget in the chat and wait for the user: `await context.requestInteraction(tag, data, options)`. This is the contract (`@genesislcap/ai-assistant` 15.54):\n- The widget is a **custom element**, created by its tag. It does **not** get `data` as a property. It gets `interaction`:\n - `{ status: 'pending', data, \u2026 }` while it waits;\n - `{ status: 'resolved', data, result }` once answered, set again on the live element when the answer lands.\n- It answers by dispatching **`interaction-completed`** on itself, with the result as the event's detail: `{ status: 'approved', payload? }` or `{ status: 'rejected', message? }`. Only the first answer counts.\n- `requestInteraction` **resolves** with that result. It never rejects for a refusal. With `timeoutMs`, or when `signal` aborts, it resolves `{ status: 'timeout', message }` and the widget turns read-only. **Pass `signal: context.turnSignal`**, so the user's Stop closes a widget left open.\n- **Only one interaction may be open at a time**: a second `requestInteraction` while one waits throws at once. Open widgets one after another, never from parallel calls.\n- A tag that is not registered shows \"Component \u2026 is not available\" and the call never settles. That is why `index.ts` imports the widget file.\n- The tag must contain a hyphen and be unique in the app. Prefix it with something of the app's (e.g. `orders-cancel-review`) rather than a generic name.\n- The app registers the rapid design system and grid-pro app-wide, so a widget's template can use `<rapid-button>`, `<rapid-text-field>` and `<rapid-grid-pro>` directly.\n- **Render the widget through its own template** (the `template` given to `@customElement`, as below), even though the app's pages are React. A `GenesisElement` has its own shadow root with no slot, so anything rendered into the element itself never shows, and the widget opens blank. That covers `createRoot(this)`, `this.innerHTML` and React in the light DOM. Keep React out of chat widgets.\n\nA review widget, in the app's own `GenesisElement` (decorators are on in the app's tsconfig):\n```ts\n// ai/extensions/cancel-order-review.ts\nimport { css, customElement, GenesisElement, html, observable, when } from '@genesislcap/web-core';\n\ntype Review = { orderId: string; rows: Record<string, unknown>[] };\ntype Interaction =\n | { status: 'pending'; data: Review }\n | { status: 'resolved'; data: Review; result?: { status: string; message?: string } };\n\nconst template = html<CancelOrderReview>`\n <rapid-grid-pro\n :rowData=\"${(x) => x.review?.rows ?? []}\"\n :gridOptions=\"${(x) => x.gridOptions}\"\n domLayout=\"autoHeight\"\n ></rapid-grid-pro>\n ${when(\n (x) => x.interaction?.status === 'pending',\n html<CancelOrderReview>`\n <rapid-button @click=\"${(x) => x.answer('approved')}\">Cancel the order</rapid-button>\n <rapid-button @click=\"${(x) => x.answer('rejected')}\">Keep it</rapid-button>\n `,\n )}\n ${when(\n (x) => x.interaction?.status === 'resolved',\n html<CancelOrderReview>`<span>${(x) => x.outcome}</span>`,\n )}\n`;\n\n@customElement({\n name: 'orders-cancel-review',\n template,\n styles: css`:host { display: block; }`,\n})\nexport class CancelOrderReview extends GenesisElement {\n @observable interaction?: Interaction;\n\n gridOptions = {\n columnDefs: [\n { field: 'ORDER_ID', headerName: 'Order' },\n { field: 'STATUS', headerName: 'Status' },\n { field: 'QUANTITY', headerName: 'Quantity' },\n ],\n };\n\n get review(): Review | undefined {\n return this.interaction?.data;\n }\n\n get outcome(): string {\n const result = this.interaction?.status === 'resolved' ? this.interaction.result : undefined;\n return result?.status === 'approved' ? 'Approved' : result?.message ?? 'Not approved';\n }\n\n answer(status: 'approved' | 'rejected') {\n this.$emit(\n 'interaction-completed',\n status === 'approved' ? { status } : { status, message: 'The user kept the order.' },\n );\n }\n}\n```\n- A widget can show anything the user needs to decide: a grid of the rows (as above), a form to edit values before approving (return them as `payload`), or a choice between options.\n- **An inline `@keydown` or `@input` handler on an input must `return true`.** A FAST event handler that returns anything but `true` makes FAST call `preventDefault()`, so a handler that returns nothing stops the user typing in the field. A `@click` on a button gets away with it, because a button has no default to lose.\n- Show the values exactly as they will be sent, and tell the model what the user decided through the result.\n\n### 4. Writes: show a review first, by default\nUnless the user explicitly asks for a tool that writes without asking, every write tool follows this order:\n1. **Read the row by its key, from its table's own request server** (`REQ_<TABLE>` for the table the event writes; `CRITERIA_MATCH`, then the row with that key): the pre-image. Not a view or a query over the table: it can hold other rows or other fields, and in the instant preview a view's request server returns no rows, so the tool reports \"not found\" for a row that exists.\n2. **Show the review**: `requestInteraction` with the row and the exact values that will be sent.\n3. **Not approved: stop.** `rejected` gives `'Not written: <message>'`, and `timeout` gives `'Not written: no answer.'`\n4. **Read the row again by its key, just before committing.** If any value the review showed has changed, refuse: `'Not written: the order changed since the review (QUANTITY).'` Leave out `RECORD_ID` and `TIMESTAMP`, which move on every write, and compare as text, so that a `BigInt` and its digits match.\n5. **Commit exactly what was approved**, then report what the server said.\n\n```ts\nconst SHOWN = ['ORDER_ID', 'STATUS', 'QUANTITY'];\n// By CRITERIA_MATCH, and only the row with the asked key: the instant preview ignores REQUEST fields (see Reads).\nconst rowOf = async (orderId: string) => {\n const reply = await getConnect().request('REQ_ORDER', {\n REQUEST: {},\n DETAILS: { CRITERIA_MATCH: `ORDER_ID == ${quoted(orderId)}` },\n });\n return (reply.REPLY ?? []).find((r: Record<string, unknown>) => String(r.ORDER_ID) === orderId) as\n | Record<string, unknown>\n | undefined;\n};\n\nconst cancelOrder: ToolHandler = async (args, context) => {\n const orderId = String(args.orderId ?? '').trim();\n const before = orderId ? await rowOf(orderId) : undefined;\n if (!before) return `Not written: there is no order ${orderId}.`;\n\n const answer = await context.requestInteraction<InteractionResult>(\n 'orders-cancel-review',\n { orderId, rows: [serialisable(before)] },\n { signal: context.turnSignal },\n );\n if (answer.status !== 'approved') {\n return `Not written: ${answer.status === 'timeout' ? 'no answer' : answer.message ?? 'the user declined'}.`;\n }\n\n const now = await rowOf(orderId);\n const changed = SHOWN.filter((f) => String(now?.[f] ?? '') !== String(before[f] ?? ''));\n if (!now || changed.length) {\n return `Not written: the order changed since the review (${changed.join(', ') || 'it is gone'}).`;\n }\n\n try {\n const reply = await getConnect().commitEvent('EVENT_ORDER_CANCEL', { DETAILS: { ORDER_ID: orderId } });\n if (reply.MESSAGE_TYPE === 'EVENT_ACK') return `Order ${orderId} cancelled.`;\n return `Not written: ${(reply.ERROR ?? []).map((e: { TEXT?: string }) => e.TEXT).join('; ') || 'the server refused it'}.`;\n } catch (error) {\n const received = (error as { receivedMessage?: { MESSAGE_TYPE?: string; ERROR?: { TEXT?: string }[] } })\n ?.receivedMessage;\n if (received?.MESSAGE_TYPE === 'EVENT_NACK' || received?.MESSAGE_TYPE === 'MSG_NACK') {\n return `Not written: ${(received.ERROR ?? []).map((e) => e.TEXT).join('; ') || 'the server refused it'}.`;\n }\n return 'The app did not answer, so whether the order was cancelled is unknown.';\n }\n};\n```\n- **A write that skips the review** is written only when the user asks for one. Its description then says so plainly, e.g. `'Cancels the order immediately, without asking the user to review it.'`\n\n### 5. Write traps\n- **`commitEvent` RESOLVES on a NACK.** Check `MESSAGE_TYPE === 'EVENT_ACK'`, and never report \"written\" without one. A NACK carries the server's reasons in `ERROR[].TEXT`: relay those.\n- **The instant preview ignores `REQUEST` fields.** Read by `DETAILS.CRITERIA_MATCH`, which the preview and the server both apply, and act only on the row whose key you asked for. Otherwise, in the preview, a tool cancels or refuses the wrong order.\n- **A throw is not a refusal.** A rejection carrying `receivedMessage` with `EVENT_NACK` or `MSG_NACK` is the server's refusal. Anything else means the connection gave up, and the write may or may not have landed, so say that it is unknown.\n- **Never send `VALIDATE: true` as a dry run.** A handler without an `onValidate` block (`hasValidate: false` in `query_project_schema`) COMMITS the row anyway, and even with one it is not a preview of the write. Show the review widget instead.\n- **Whole numbers beyond 2^53 cannot be sent as numbers.** A key read as a `BigInt` or as digits must not go through `Number()`, because a rounded id writes against the wrong record. If the event takes it as a number and it is not a safe integer, refuse rather than round.\n- **DATE and DATETIME are epoch millis.** Convert a date the user typed before sending, and show the date back in the review.\n- **Field sizes**: a plain `STRING` field holds 64 characters on the app's H2 database, and `INT` is 32-bit. Check a value fits before sending it, or the server refuses it, sometimes with an SQL error.\n- **It runs as the signed-in user.** The event's permission codes, and the handler's own validation, still apply. A refusal is an answer to relay, not a bug to work around.\n- **Do not hand raw `Error.message` to the model.** A transport error can carry internal host names: return your own plain text.\n- Send `IGNORE_WARNINGS` only if the user asked to.\n\n### 6. Rules for the system prompt\n`systemPrompt` is appended to the chat's configured prompt. Use it to tell the model when each of your tools applies, and what the server will refuse:\n```ts\nexport const extensions = {\n toolDefinitions: [/* \u2026 */],\n toolHandlers: { /* \u2026 */ },\n systemPrompt: [\n 'Use cancel_order only for an order the user names; it shows the order for review before cancelling.',\n 'Cancelling needs the ORDER_CANCEL right; without it the server refuses and you say so.',\n 'Only an OPEN order can be cancelled: the server refuses any other with \"Order is already <status>\".',\n 'If the server refuses, relay its reason word for word.',\n ].join('\\n'),\n};\n```\n- Derive the rules from `query_project_schema('events', NAME)`:\n - **`refusals`**: each message the handler's own code refuses with, as `{ block, line, text }`. A `validate` one is checked before anything is written, and a `commit` one while writing. `${\u2026}` is a value the server fills in. Turn each into a rule the model can act on, e.g. `Order is already ${\u2026}` becomes \"only an OPEN order can be cancelled\".\n - `permissionCodes`: the rights it needs.\n - `writes` and `enumWrites`: what it changes.\n - `entity` and `inputType`.\n- `refusals` is a floor, not a complete list: a message built in code, or a check in a function it calls, is not in it. For a Spring handler, or a spec from an older preview, it is unknown; the answer's `refusalsNote` says which. **Anything not listed there, ask the user** rather than invent it, or write the general form (\"the server may refuse it; relay its reason\").\n- Keep it short and specific to the app's own tools. The chat's base prompt already covers the generated tools.\n";
|
|
13
|
+
//# sourceMappingURL=fui-ai-extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fui-ai-extensions.d.ts","sourceRoot":"","sources":["../../../../src/code-review/rules/fui-ai-extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,UAelC,CAAC;AAEF,eAAO,MAAM,sBAAsB,UAA2B,CAAC;AAE/D,eAAO,MAAM,yBAAyB,m5nBAuRrC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context injected into the UI Builder system prompt.
|
|
3
|
+
* Covers trade blotter / order management page patterns.
|
|
4
|
+
*
|
|
5
|
+
* Sources verified against:
|
|
6
|
+
* - sales-trader-hub client/src/pages/column.tsx (column def patterns)
|
|
7
|
+
* - sales-trader-hub client/src/components/Blotter/BlotterGrid/BlotterGrid.tsx
|
|
8
|
+
* - sales-trader-hub client/src/components/Blotter/BlotterGridControlBar/BlotterGridControlBar.tsx
|
|
9
|
+
* - sales-trader-hub client/src/pages/Home/BlotterManager/BlotterComponent.tsx
|
|
10
|
+
* - fui-entity-management.ts (master-detail cross-tile pattern)
|
|
11
|
+
* - fui-eventing.ts (Redux-based row-selection eventing)
|
|
12
|
+
*/
|
|
13
|
+
export declare const FUI_BLOTTER_TAGS: string[];
|
|
14
|
+
export declare const FUI_BLOTTER_DEPS: string[];
|
|
15
|
+
export declare const FUI_BLOTTER_CONTEXT: string;
|
|
16
|
+
//# sourceMappingURL=fui-blotter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fui-blotter.d.ts","sourceRoot":"","sources":["../../../../src/code-review/rules/fui-blotter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,gBAAgB,UAyB5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAA+D,CAAC;AAE7F,eAAO,MAAM,mBAAmB,QA4iBxB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context: G2PlotChart — chart component from @genesislcap/g2plot-chart/react
|
|
3
|
+
*
|
|
4
|
+
* Sources verified against:
|
|
5
|
+
* - foundation-marketplace/charts/g2plot-chart/dist/dts/react.d.ts
|
|
6
|
+
* - foundation-marketplace/charts/g2plot-chart/dist/dts/chart.types.d.ts
|
|
7
|
+
* - foundation-marketplace/charts/g2plot-chart/src/chart.ts (initalizeConfiguration → legend behaviour)
|
|
8
|
+
* - foundation-marketplace/charts/g2plot-chart/src/chart-datasource/chart-datasource.ts
|
|
9
|
+
* - foundation-marketplace/charts/g2plot-chart/src/chart-datasource/chart-datasource.utils.ts
|
|
10
|
+
* (getReduced, getNormalizedFieldValue — BigDecimal string → number normalization)
|
|
11
|
+
* - foundation-marketplace/charts/g2plot-chart/src/models/*.ts (per-type Rapid styling defaults)
|
|
12
|
+
* - foundation-marketplace/charts/g2plot-chart/src/settings/colors.ts (chartsGradients palette)
|
|
13
|
+
* - node_modules/@antv/g2plot@2.4.35 typings (lib/types/common.d.ts Options, per-plot types.d.ts)
|
|
14
|
+
* - showcase react-client/src/pages/Charts (tabbed charts reference page)
|
|
15
|
+
* - blank-app-seed/.genx/templates/react/chart.hbs
|
|
16
|
+
*/
|
|
17
|
+
export declare const FUI_CHART_DEPS: string[];
|
|
18
|
+
export declare const FUI_CHART_TAGS: string[];
|
|
19
|
+
export declare const FUI_CHART_CONTEXT: string;
|
|
20
|
+
//# sourceMappingURL=fui-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fui-chart.d.ts","sourceRoot":"","sources":["../../../../src/code-review/rules/fui-chart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,eAAO,MAAM,cAAc,EAAE,MAAM,EAAO,CAAC;AAE3C,eAAO,MAAM,cAAc,UA0D1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,QA8kBtB,CAAC"}
|