@gempack/squad-mcp 0.3.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/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +20 -0
- package/CHANGELOG.md +282 -0
- package/LICENSE +201 -0
- package/NOTICE +11 -0
- package/README.md +164 -0
- package/agents/PO.md +84 -0
- package/agents/Senior-Architect.md +121 -0
- package/agents/Senior-DBA.md +137 -0
- package/agents/Senior-Dev-Reviewer.md +104 -0
- package/agents/Senior-Dev-Security.md +134 -0
- package/agents/Senior-Developer.md +180 -0
- package/agents/Senior-QA.md +146 -0
- package/agents/Skill-Squad-Dev.md +369 -0
- package/agents/Skill-Squad-Review.md +267 -0
- package/agents/TechLead-Consolidator.md +117 -0
- package/agents/TechLead-Planner.md +90 -0
- package/agents/_Severity-and-Ownership.md +68 -0
- package/commands/squad-review.md +68 -0
- package/commands/squad.md +81 -0
- package/dist/config/ownership-matrix.d.ts +48 -0
- package/dist/config/ownership-matrix.js +197 -0
- package/dist/config/ownership-matrix.js.map +1 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.js +14 -0
- package/dist/errors.js.map +1 -0
- package/dist/exec/git.d.ts +17 -0
- package/dist/exec/git.js +0 -0
- package/dist/exec/git.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/observability/logger.d.ts +23 -0
- package/dist/observability/logger.js +93 -0
- package/dist/observability/logger.js.map +1 -0
- package/dist/prompts/registry.d.ts +21 -0
- package/dist/prompts/registry.js +183 -0
- package/dist/prompts/registry.js.map +1 -0
- package/dist/resources/agent-loader.d.ts +20 -0
- package/dist/resources/agent-loader.js +122 -0
- package/dist/resources/agent-loader.js.map +1 -0
- package/dist/resources/registry.d.ts +13 -0
- package/dist/resources/registry.js +67 -0
- package/dist/resources/registry.js.map +1 -0
- package/dist/tools/agents.d.ts +22 -0
- package/dist/tools/agents.js +32 -0
- package/dist/tools/agents.js.map +1 -0
- package/dist/tools/classify-work-type.d.ts +28 -0
- package/dist/tools/classify-work-type.js +0 -0
- package/dist/tools/classify-work-type.js.map +1 -0
- package/dist/tools/compose-advisory-bundle.d.ts +75 -0
- package/dist/tools/compose-advisory-bundle.js +68 -0
- package/dist/tools/compose-advisory-bundle.js.map +1 -0
- package/dist/tools/compose-squad-workflow.d.ts +84 -0
- package/dist/tools/compose-squad-workflow.js +0 -0
- package/dist/tools/compose-squad-workflow.js.map +1 -0
- package/dist/tools/consolidate.d.ts +97 -0
- package/dist/tools/consolidate.js +75 -0
- package/dist/tools/consolidate.js.map +1 -0
- package/dist/tools/detect-changed-files.d.ts +35 -0
- package/dist/tools/detect-changed-files.js +0 -0
- package/dist/tools/detect-changed-files.js.map +1 -0
- package/dist/tools/registry.d.ts +26 -0
- package/dist/tools/registry.js +169 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/score-risk.d.ts +38 -0
- package/dist/tools/score-risk.js +34 -0
- package/dist/tools/score-risk.js.map +1 -0
- package/dist/tools/select-squad.d.ts +46 -0
- package/dist/tools/select-squad.js +0 -0
- package/dist/tools/select-squad.js.map +1 -0
- package/dist/tools/slice-files.d.ts +34 -0
- package/dist/tools/slice-files.js +0 -0
- package/dist/tools/slice-files.js.map +1 -0
- package/dist/tools/validate-plan-text.d.ts +24 -0
- package/dist/tools/validate-plan-text.js +0 -0
- package/dist/tools/validate-plan-text.js.map +1 -0
- package/dist/util/path-safety.d.ts +28 -0
- package/dist/util/path-safety.js +0 -0
- package/dist/util/path-safety.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { composeSquadWorkflow } from './compose-squad-workflow.js';
|
|
3
|
+
import { sliceFilesForAgent } from './slice-files.js';
|
|
4
|
+
import { validatePlanText } from './validate-plan-text.js';
|
|
5
|
+
import { AGENT_NAMES_TUPLE } from '../config/ownership-matrix.js';
|
|
6
|
+
const safeString = (max) => z
|
|
7
|
+
.string()
|
|
8
|
+
.max(max)
|
|
9
|
+
.refine((s) => s.indexOf(' ') === -1, 'must not contain NUL byte');
|
|
10
|
+
const schema = z.object({
|
|
11
|
+
workspace_root: safeString(4096),
|
|
12
|
+
user_prompt: safeString(8192),
|
|
13
|
+
plan: z.string().max(65_536),
|
|
14
|
+
base_ref: safeString(200).optional(),
|
|
15
|
+
staged_only: z.boolean().optional().default(false),
|
|
16
|
+
read_content: z.boolean().optional().default(true),
|
|
17
|
+
force_work_type: z
|
|
18
|
+
.enum(['Feature', 'Bug Fix', 'Refactor', 'Performance', 'Security', 'Business Rule'])
|
|
19
|
+
.optional(),
|
|
20
|
+
force_agents: z.array(z.enum(AGENT_NAMES_TUPLE)).optional().default([]),
|
|
21
|
+
risk_signals: z
|
|
22
|
+
.object({
|
|
23
|
+
touches_auth: z.boolean().optional(),
|
|
24
|
+
touches_money: z.boolean().optional(),
|
|
25
|
+
touches_migration: z.boolean().optional(),
|
|
26
|
+
new_module: z.boolean().optional(),
|
|
27
|
+
api_contract_change: z.boolean().optional(),
|
|
28
|
+
})
|
|
29
|
+
.optional(),
|
|
30
|
+
});
|
|
31
|
+
export async function composeAdvisoryBundle(input) {
|
|
32
|
+
const workflowInput = {
|
|
33
|
+
workspace_root: input.workspace_root,
|
|
34
|
+
user_prompt: input.user_prompt,
|
|
35
|
+
staged_only: input.staged_only,
|
|
36
|
+
read_content: input.read_content,
|
|
37
|
+
force_agents: input.force_agents,
|
|
38
|
+
};
|
|
39
|
+
if (input.base_ref !== undefined)
|
|
40
|
+
workflowInput.base_ref = input.base_ref;
|
|
41
|
+
if (input.force_work_type !== undefined)
|
|
42
|
+
workflowInput.force_work_type = input.force_work_type;
|
|
43
|
+
if (input.risk_signals !== undefined)
|
|
44
|
+
workflowInput.risk_signals = input.risk_signals;
|
|
45
|
+
const workflow = await composeSquadWorkflow(workflowInput);
|
|
46
|
+
const filePaths = workflow.changed_files.files.map((f) => f.path);
|
|
47
|
+
const slices_by_agent = {};
|
|
48
|
+
for (const agent of workflow.squad.agents) {
|
|
49
|
+
const slice = await sliceFilesForAgent({
|
|
50
|
+
agent,
|
|
51
|
+
files: filePaths,
|
|
52
|
+
read_content: input.read_content,
|
|
53
|
+
workspace_root: input.workspace_root,
|
|
54
|
+
});
|
|
55
|
+
slices_by_agent[agent] = slice;
|
|
56
|
+
}
|
|
57
|
+
const plan_validation = validatePlanText({ plan: input.plan });
|
|
58
|
+
return { workflow, slices_by_agent, plan_validation };
|
|
59
|
+
}
|
|
60
|
+
export const composeAdvisoryBundleTool = {
|
|
61
|
+
name: 'compose_advisory_bundle',
|
|
62
|
+
description: 'End-to-end advisory dispatch bundle. Runs compose_squad_workflow, then slice_files_for_agent for each ' +
|
|
63
|
+
'selected agent, then validate_plan_text on the supplied plan. Returns the union output ready for the ' +
|
|
64
|
+
'host to dispatch parallel advisory reviews.',
|
|
65
|
+
schema,
|
|
66
|
+
handler: composeAdvisoryBundle,
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=compose-advisory-bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-advisory-bundle.js","sourceRoot":"","sources":["../../src/tools/compose-advisory-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAA8B,MAAM,6BAA6B,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAoB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAA2B,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CACjC,CAAC;KACE,MAAM,EAAE;KACR,GAAG,CAAC,GAAG,CAAC;KACR,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,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C;AAED,MAAM,CAAC,MAAM,yBAAyB,GAA2B;IAC/D,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,wGAAwG;QACxG,uGAAuG;QACvG,6CAA6C;IAC/C,MAAM;IACN,OAAO,EAAE,qBAAqB;CAC/B,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDef } from './registry.js';
|
|
3
|
+
import { type DetectChangedFilesOutput } from './detect-changed-files.js';
|
|
4
|
+
import { type ClassifyOutput } from './classify-work-type.js';
|
|
5
|
+
import { type RiskOutput } from './score-risk.js';
|
|
6
|
+
import { type SelectSquadOutput } from './select-squad.js';
|
|
7
|
+
import { type WorkType } from '../config/ownership-matrix.js';
|
|
8
|
+
declare const schema: z.ZodObject<{
|
|
9
|
+
workspace_root: z.ZodEffects<z.ZodString, string, string>;
|
|
10
|
+
user_prompt: z.ZodEffects<z.ZodString, string, string>;
|
|
11
|
+
base_ref: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
12
|
+
staged_only: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
13
|
+
read_content: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
14
|
+
force_work_type: z.ZodOptional<z.ZodEnum<["Feature", "Bug Fix", "Refactor", "Performance", "Security", "Business Rule"]>>;
|
|
15
|
+
force_agents: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<[import("../config/ownership-matrix.js").AgentName, ...import("../config/ownership-matrix.js").AgentName[]]>, "many">>>;
|
|
16
|
+
risk_signals: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
touches_auth: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
touches_money: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
touches_migration: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
new_module: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
api_contract_change: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
touches_auth?: boolean | undefined;
|
|
24
|
+
touches_money?: boolean | undefined;
|
|
25
|
+
touches_migration?: boolean | undefined;
|
|
26
|
+
new_module?: boolean | undefined;
|
|
27
|
+
api_contract_change?: boolean | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
touches_auth?: boolean | undefined;
|
|
30
|
+
touches_money?: boolean | undefined;
|
|
31
|
+
touches_migration?: boolean | undefined;
|
|
32
|
+
new_module?: boolean | undefined;
|
|
33
|
+
api_contract_change?: boolean | undefined;
|
|
34
|
+
}>>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
read_content: boolean;
|
|
37
|
+
force_agents: import("../config/ownership-matrix.js").AgentName[];
|
|
38
|
+
workspace_root: string;
|
|
39
|
+
user_prompt: string;
|
|
40
|
+
staged_only: boolean;
|
|
41
|
+
base_ref?: string | undefined;
|
|
42
|
+
force_work_type?: "Feature" | "Bug Fix" | "Refactor" | "Performance" | "Security" | "Business Rule" | undefined;
|
|
43
|
+
risk_signals?: {
|
|
44
|
+
touches_auth?: boolean | undefined;
|
|
45
|
+
touches_money?: boolean | undefined;
|
|
46
|
+
touches_migration?: boolean | undefined;
|
|
47
|
+
new_module?: boolean | undefined;
|
|
48
|
+
api_contract_change?: boolean | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
workspace_root: string;
|
|
52
|
+
user_prompt: string;
|
|
53
|
+
read_content?: boolean | undefined;
|
|
54
|
+
force_agents?: import("../config/ownership-matrix.js").AgentName[] | undefined;
|
|
55
|
+
base_ref?: string | undefined;
|
|
56
|
+
staged_only?: boolean | undefined;
|
|
57
|
+
force_work_type?: "Feature" | "Bug Fix" | "Refactor" | "Performance" | "Security" | "Business Rule" | undefined;
|
|
58
|
+
risk_signals?: {
|
|
59
|
+
touches_auth?: boolean | undefined;
|
|
60
|
+
touches_money?: boolean | undefined;
|
|
61
|
+
touches_migration?: boolean | undefined;
|
|
62
|
+
new_module?: boolean | undefined;
|
|
63
|
+
api_contract_change?: boolean | undefined;
|
|
64
|
+
} | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
type Input = z.infer<typeof schema>;
|
|
67
|
+
export interface ComposeWorkflowOutput {
|
|
68
|
+
changed_files: DetectChangedFilesOutput;
|
|
69
|
+
classification: ClassifyOutput;
|
|
70
|
+
risk: RiskOutput;
|
|
71
|
+
squad: SelectSquadOutput;
|
|
72
|
+
work_type: WorkType;
|
|
73
|
+
inferred_risk_signals: {
|
|
74
|
+
touches_auth: boolean;
|
|
75
|
+
touches_money: boolean;
|
|
76
|
+
touches_migration: boolean;
|
|
77
|
+
files_count: number;
|
|
78
|
+
new_module: boolean;
|
|
79
|
+
api_contract_change: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export declare function composeSquadWorkflow(input: Input): Promise<ComposeWorkflowOutput>;
|
|
83
|
+
export declare const composeSquadWorkflowTool: ToolDef<typeof schema>;
|
|
84
|
+
export {};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-squad-workflow.js","sourceRoot":"","sources":["../../src/tools/compose-squad-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAmD,MAAM,2BAA2B,CAAC;AAChH,OAAO,EAAE,gBAAgB,EAAuB,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAmB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAA0B,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAiB,MAAM,+BAA+B,CAAC;AAEjF,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CACjC,CAAC;KACE,MAAM,EAAE;KACR,GAAG,CAAC,GAAG,CAAC;KACR,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,C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,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAA2B;IAC9D,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,+GAA+G;QAC/G,yGAAyG;IAC3G,MAAM;IACN,OAAO,EAAE,oBAAoB;CAC9B,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDef } from './registry.js';
|
|
3
|
+
declare const schema: z.ZodObject<{
|
|
4
|
+
reports: z.ZodArray<z.ZodObject<{
|
|
5
|
+
agent: z.ZodEnum<[import("../config/ownership-matrix.js").AgentName, ...import("../config/ownership-matrix.js").AgentName[]]>;
|
|
6
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
7
|
+
severity: z.ZodEnum<["Blocker", "Major", "Minor", "Suggestion"]>;
|
|
8
|
+
title: z.ZodString;
|
|
9
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
10
|
+
forwarded_to: z.ZodOptional<z.ZodEnum<[import("../config/ownership-matrix.js").AgentName, ...import("../config/ownership-matrix.js").AgentName[]]>>;
|
|
11
|
+
justified: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
severity: "Blocker" | "Major" | "Minor" | "Suggestion";
|
|
14
|
+
title: string;
|
|
15
|
+
justified: boolean;
|
|
16
|
+
detail?: string | undefined;
|
|
17
|
+
forwarded_to?: import("../config/ownership-matrix.js").AgentName | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
severity: "Blocker" | "Major" | "Minor" | "Suggestion";
|
|
20
|
+
title: string;
|
|
21
|
+
detail?: string | undefined;
|
|
22
|
+
forwarded_to?: import("../config/ownership-matrix.js").AgentName | undefined;
|
|
23
|
+
justified?: boolean | undefined;
|
|
24
|
+
}>, "many">;
|
|
25
|
+
not_evaluated: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
agent: import("../config/ownership-matrix.js").AgentName;
|
|
28
|
+
findings: {
|
|
29
|
+
severity: "Blocker" | "Major" | "Minor" | "Suggestion";
|
|
30
|
+
title: string;
|
|
31
|
+
justified: boolean;
|
|
32
|
+
detail?: string | undefined;
|
|
33
|
+
forwarded_to?: import("../config/ownership-matrix.js").AgentName | undefined;
|
|
34
|
+
}[];
|
|
35
|
+
not_evaluated: boolean;
|
|
36
|
+
}, {
|
|
37
|
+
agent: import("../config/ownership-matrix.js").AgentName;
|
|
38
|
+
findings: {
|
|
39
|
+
severity: "Blocker" | "Major" | "Minor" | "Suggestion";
|
|
40
|
+
title: string;
|
|
41
|
+
detail?: string | undefined;
|
|
42
|
+
forwarded_to?: import("../config/ownership-matrix.js").AgentName | undefined;
|
|
43
|
+
justified?: boolean | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
not_evaluated?: boolean | undefined;
|
|
46
|
+
}>, "many">;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
reports: {
|
|
49
|
+
agent: import("../config/ownership-matrix.js").AgentName;
|
|
50
|
+
findings: {
|
|
51
|
+
severity: "Blocker" | "Major" | "Minor" | "Suggestion";
|
|
52
|
+
title: string;
|
|
53
|
+
justified: boolean;
|
|
54
|
+
detail?: string | undefined;
|
|
55
|
+
forwarded_to?: import("../config/ownership-matrix.js").AgentName | undefined;
|
|
56
|
+
}[];
|
|
57
|
+
not_evaluated: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
}, {
|
|
60
|
+
reports: {
|
|
61
|
+
agent: import("../config/ownership-matrix.js").AgentName;
|
|
62
|
+
findings: {
|
|
63
|
+
severity: "Blocker" | "Major" | "Minor" | "Suggestion";
|
|
64
|
+
title: string;
|
|
65
|
+
detail?: string | undefined;
|
|
66
|
+
forwarded_to?: import("../config/ownership-matrix.js").AgentName | undefined;
|
|
67
|
+
justified?: boolean | undefined;
|
|
68
|
+
}[];
|
|
69
|
+
not_evaluated?: boolean | undefined;
|
|
70
|
+
}[];
|
|
71
|
+
}>;
|
|
72
|
+
type Input = z.infer<typeof schema>;
|
|
73
|
+
export type Verdict = 'APPROVED' | 'CHANGES_REQUIRED' | 'REJECTED';
|
|
74
|
+
export type Severity = 'Blocker' | 'Major' | 'Minor' | 'Suggestion';
|
|
75
|
+
export interface ConsolidationOutput {
|
|
76
|
+
verdict: Verdict;
|
|
77
|
+
blockers: {
|
|
78
|
+
agent: string;
|
|
79
|
+
title: string;
|
|
80
|
+
}[];
|
|
81
|
+
majors_unjustified: {
|
|
82
|
+
agent: string;
|
|
83
|
+
title: string;
|
|
84
|
+
}[];
|
|
85
|
+
forwarded: {
|
|
86
|
+
from: string;
|
|
87
|
+
to: string;
|
|
88
|
+
title: string;
|
|
89
|
+
}[];
|
|
90
|
+
not_evaluated: string[];
|
|
91
|
+
severity_counts: Record<Severity, number>;
|
|
92
|
+
agents_involved: string[];
|
|
93
|
+
summary: string;
|
|
94
|
+
}
|
|
95
|
+
export declare function applyConsolidationRules(input: Input): ConsolidationOutput;
|
|
96
|
+
export declare const applyConsolidationRulesTool: ToolDef<typeof schema>;
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_NAMES_TUPLE } from '../config/ownership-matrix.js';
|
|
3
|
+
const severity = z.enum(['Blocker', 'Major', 'Minor', 'Suggestion']);
|
|
4
|
+
const reportSchema = z.object({
|
|
5
|
+
agent: z.enum(AGENT_NAMES_TUPLE),
|
|
6
|
+
findings: z
|
|
7
|
+
.array(z.object({
|
|
8
|
+
severity,
|
|
9
|
+
title: z.string().max(4096),
|
|
10
|
+
detail: z.string().max(4096).optional(),
|
|
11
|
+
forwarded_to: z.enum(AGENT_NAMES_TUPLE).optional(),
|
|
12
|
+
justified: z.boolean().optional().default(false),
|
|
13
|
+
}))
|
|
14
|
+
.max(500),
|
|
15
|
+
not_evaluated: z.boolean().optional().default(false),
|
|
16
|
+
});
|
|
17
|
+
const schema = z.object({
|
|
18
|
+
reports: z.array(reportSchema).max(50),
|
|
19
|
+
});
|
|
20
|
+
export function applyConsolidationRules(input) {
|
|
21
|
+
const blockers = [];
|
|
22
|
+
const majorsUnjustified = [];
|
|
23
|
+
const forwarded = [];
|
|
24
|
+
const notEvaluated = [];
|
|
25
|
+
const agentsInvolved = new Set();
|
|
26
|
+
const counts = { Blocker: 0, Major: 0, Minor: 0, Suggestion: 0 };
|
|
27
|
+
for (const r of input.reports) {
|
|
28
|
+
agentsInvolved.add(r.agent);
|
|
29
|
+
if (r.not_evaluated) {
|
|
30
|
+
notEvaluated.push(r.agent);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
for (const f of r.findings) {
|
|
34
|
+
counts[f.severity] += 1;
|
|
35
|
+
if (f.severity === 'Blocker')
|
|
36
|
+
blockers.push({ agent: r.agent, title: f.title });
|
|
37
|
+
if (f.severity === 'Major' && !f.justified)
|
|
38
|
+
majorsUnjustified.push({ agent: r.agent, title: f.title });
|
|
39
|
+
if (f.forwarded_to)
|
|
40
|
+
forwarded.push({ from: r.agent, to: f.forwarded_to, title: f.title });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let verdict;
|
|
44
|
+
if (blockers.length)
|
|
45
|
+
verdict = 'REJECTED';
|
|
46
|
+
else if (majorsUnjustified.length)
|
|
47
|
+
verdict = 'REJECTED';
|
|
48
|
+
else if (counts.Major + counts.Minor > 0)
|
|
49
|
+
verdict = 'CHANGES_REQUIRED';
|
|
50
|
+
else
|
|
51
|
+
verdict = 'APPROVED';
|
|
52
|
+
const summary = `Verdict: ${verdict}. ` +
|
|
53
|
+
`${blockers.length} blocker(s), ${majorsUnjustified.length} unjustified major(s), ` +
|
|
54
|
+
`${forwarded.length} forwarded item(s), ${notEvaluated.length} agent(s) not evaluated. ` +
|
|
55
|
+
`Severity counts: ${counts.Blocker} blocker / ${counts.Major} major / ${counts.Minor} minor / ${counts.Suggestion} suggestion.`;
|
|
56
|
+
return {
|
|
57
|
+
verdict,
|
|
58
|
+
blockers,
|
|
59
|
+
majors_unjustified: majorsUnjustified,
|
|
60
|
+
forwarded,
|
|
61
|
+
not_evaluated: notEvaluated,
|
|
62
|
+
severity_counts: counts,
|
|
63
|
+
agents_involved: Array.from(agentsInvolved).sort(),
|
|
64
|
+
summary,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export const applyConsolidationRulesTool = {
|
|
68
|
+
name: 'apply_consolidation_rules',
|
|
69
|
+
description: 'Aggregate advisory reports and emit a verdict per the rules in _Severity-and-Ownership.md. ' +
|
|
70
|
+
'Blocker -> REJECTED. Unjustified Major -> REJECTED. Otherwise CHANGES_REQUIRED or APPROVED. ' +
|
|
71
|
+
'Includes severity_counts and agents_involved for downstream summarization.',
|
|
72
|
+
schema,
|
|
73
|
+
handler: applyConsolidationRules,
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=consolidate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consolidate.js","sourceRoot":"","sources":["../../src/tools/consolidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AAErE,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;IAChC,QAAQ,EAAE,CAAC;SACR,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,QAAQ;QACR,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC;QAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAA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AC3B,eAAe,EAAE,MAAM;QACvB,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,EAAE;QAClD,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,2BAA2B,GAA2B;IACjE,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACT,6FAA6F;QAC7F,8FAA8F;QAC9F,4EAA4E;IAC9E,MAAM;IACN,OAAO,EAAE,uBAAuB;CACjC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDef } from './registry.js';
|
|
3
|
+
import { type RunGitOptions } from '../exec/git.js';
|
|
4
|
+
declare const schema: z.ZodObject<{
|
|
5
|
+
workspace_root: z.ZodEffects<z.ZodString, string, string>;
|
|
6
|
+
base_ref: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
7
|
+
staged_only: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
workspace_root: string;
|
|
10
|
+
staged_only: boolean;
|
|
11
|
+
base_ref?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
workspace_root: string;
|
|
14
|
+
base_ref?: string | undefined;
|
|
15
|
+
staged_only?: boolean | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
type Input = z.infer<typeof schema>;
|
|
18
|
+
export type ChangeStatus = 'added' | 'modified' | 'deleted' | 'renamed' | 'copied' | 'type_changed' | 'unknown';
|
|
19
|
+
export interface ChangedFile {
|
|
20
|
+
path: string;
|
|
21
|
+
status: ChangeStatus;
|
|
22
|
+
raw_status: string;
|
|
23
|
+
old_path?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DetectChangedFilesOutput {
|
|
26
|
+
files: ChangedFile[];
|
|
27
|
+
base_ref: string | null;
|
|
28
|
+
staged_only: boolean;
|
|
29
|
+
invocation: string;
|
|
30
|
+
}
|
|
31
|
+
export interface DetectOptions extends RunGitOptions {
|
|
32
|
+
}
|
|
33
|
+
export declare function detectChangedFiles(input: Input, opts?: DetectOptions): Promise<DetectChangedFilesOutput>;
|
|
34
|
+
export declare const detectChangedFilesTool: ToolDef<typeof schema>;
|
|
35
|
+
export {};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-changed-files.js","sourceRoot":"","sources":["../../src/tools/detect-changed-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAsB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEhF,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CACjC,CAAC;KACE,MAAM,EAAE;KACR,GAAG,CAAC,GAAG,CAAC;KACR,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAAC;AAEvE,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,cAAc,EAAE,UAAU,CAAC,IAAI,CAAC;IAChC,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACpC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CACnD,CAAC,CAAC;AAoBH,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,GAAG;YACN,OAAO,OAAO,CAAC;QACjB,K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handler: (input: z.infer<T>) => Promise<unknown> | unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare function register<T extends ZodTypeAny>(def: ToolDef<T>): void;
|
|
9
|
+
export declare function registerTools(): void;
|
|
10
|
+
export declare function listTools(): {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: Record<string, unknown>;
|
|
14
|
+
}[];
|
|
15
|
+
export declare function dispatchTool(name: string, args: unknown): Promise<{
|
|
16
|
+
content: {
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}[];
|
|
20
|
+
isError: boolean;
|
|
21
|
+
} | {
|
|
22
|
+
content: {
|
|
23
|
+
type: "text";
|
|
24
|
+
text: string;
|
|
25
|
+
}[];
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { scoreRiskTool } from './score-risk.js';
|
|
3
|
+
import { selectSquadTool } from './select-squad.js';
|
|
4
|
+
import { sliceFilesForAgentTool } from './slice-files.js';
|
|
5
|
+
import { listAgentsTool, getAgentDefinitionTool, initLocalConfigTool } from './agents.js';
|
|
6
|
+
import { applyConsolidationRulesTool } from './consolidate.js';
|
|
7
|
+
import { classifyWorkTypeTool } from './classify-work-type.js';
|
|
8
|
+
import { detectChangedFilesTool } from './detect-changed-files.js';
|
|
9
|
+
import { validatePlanTextTool } from './validate-plan-text.js';
|
|
10
|
+
import { composeSquadWorkflowTool } from './compose-squad-workflow.js';
|
|
11
|
+
import { composeAdvisoryBundleTool } from './compose-advisory-bundle.js';
|
|
12
|
+
import { isSquadError } from '../errors.js';
|
|
13
|
+
import { logger, newRequestId } from '../observability/logger.js';
|
|
14
|
+
const tools = new Map();
|
|
15
|
+
export function register(def) {
|
|
16
|
+
tools.set(def.name, def);
|
|
17
|
+
}
|
|
18
|
+
export function registerTools() {
|
|
19
|
+
register(scoreRiskTool);
|
|
20
|
+
register(selectSquadTool);
|
|
21
|
+
register(sliceFilesForAgentTool);
|
|
22
|
+
register(listAgentsTool);
|
|
23
|
+
register(getAgentDefinitionTool);
|
|
24
|
+
register(initLocalConfigTool);
|
|
25
|
+
register(applyConsolidationRulesTool);
|
|
26
|
+
register(classifyWorkTypeTool);
|
|
27
|
+
register(detectChangedFilesTool);
|
|
28
|
+
register(validatePlanTextTool);
|
|
29
|
+
register(composeSquadWorkflowTool);
|
|
30
|
+
register(composeAdvisoryBundleTool);
|
|
31
|
+
}
|
|
32
|
+
export function listTools() {
|
|
33
|
+
return Array.from(tools.values()).map((t) => ({
|
|
34
|
+
name: t.name,
|
|
35
|
+
description: t.description,
|
|
36
|
+
inputSchema: zodToJsonSchema(t.schema),
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
function asToolErrorResponse(body) {
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: 'text', text: JSON.stringify(body, null, 2) }],
|
|
42
|
+
isError: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function shapeOf(args) {
|
|
46
|
+
if (args === null || typeof args !== 'object')
|
|
47
|
+
return undefined;
|
|
48
|
+
const out = {};
|
|
49
|
+
for (const [k, v] of Object.entries(args)) {
|
|
50
|
+
if (v === null || v === undefined) {
|
|
51
|
+
out[k] = v;
|
|
52
|
+
}
|
|
53
|
+
else if (Array.isArray(v)) {
|
|
54
|
+
out[k] = `[Array(${v.length})]`;
|
|
55
|
+
}
|
|
56
|
+
else if (typeof v === 'object') {
|
|
57
|
+
out[k] = '[object]';
|
|
58
|
+
}
|
|
59
|
+
else if (typeof v === 'string') {
|
|
60
|
+
out[k] = `[string(${v.length})]`;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
out[k] = typeof v;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
export async function dispatchTool(name, args) {
|
|
69
|
+
const requestId = newRequestId();
|
|
70
|
+
const started = Date.now();
|
|
71
|
+
const tool = tools.get(name);
|
|
72
|
+
if (!tool) {
|
|
73
|
+
logger.warn('unknown tool', {
|
|
74
|
+
tool: name,
|
|
75
|
+
request_id: requestId,
|
|
76
|
+
outcome: 'unknown_tool',
|
|
77
|
+
duration_ms: Date.now() - started,
|
|
78
|
+
});
|
|
79
|
+
return asToolErrorResponse({
|
|
80
|
+
error: { code: 'UNKNOWN_TOOL', message: `unknown tool: ${name}` },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
logger.debug('tool call', { tool: name, request_id: requestId, input_shape: shapeOf(args) });
|
|
84
|
+
const parsed = tool.schema.safeParse(args);
|
|
85
|
+
if (!parsed.success) {
|
|
86
|
+
logger.warn('invalid input', {
|
|
87
|
+
tool: name,
|
|
88
|
+
request_id: requestId,
|
|
89
|
+
outcome: 'invalid_input',
|
|
90
|
+
duration_ms: Date.now() - started,
|
|
91
|
+
});
|
|
92
|
+
return asToolErrorResponse({
|
|
93
|
+
error: {
|
|
94
|
+
code: 'INVALID_INPUT',
|
|
95
|
+
message: parsed.error.message,
|
|
96
|
+
details: { issues: parsed.error.issues.length },
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const result = await tool.handler(parsed.data);
|
|
102
|
+
logger.info('tool ok', {
|
|
103
|
+
tool: name,
|
|
104
|
+
request_id: requestId,
|
|
105
|
+
outcome: 'success',
|
|
106
|
+
duration_ms: Date.now() - started,
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
const duration_ms = Date.now() - started;
|
|
114
|
+
if (isSquadError(err)) {
|
|
115
|
+
logger.warn('tool error', {
|
|
116
|
+
tool: name,
|
|
117
|
+
request_id: requestId,
|
|
118
|
+
outcome: 'tool_error',
|
|
119
|
+
duration_ms,
|
|
120
|
+
error_code: err.code,
|
|
121
|
+
});
|
|
122
|
+
return asToolErrorResponse({
|
|
123
|
+
error: { code: err.code, message: err.message, details: err.details },
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
127
|
+
logger.error('internal error', {
|
|
128
|
+
tool: name,
|
|
129
|
+
request_id: requestId,
|
|
130
|
+
outcome: 'internal_error',
|
|
131
|
+
duration_ms,
|
|
132
|
+
details: { message },
|
|
133
|
+
});
|
|
134
|
+
return asToolErrorResponse({
|
|
135
|
+
error: { code: 'INTERNAL_ERROR', message: 'internal tool error' },
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function zodToJsonSchema(schema) {
|
|
140
|
+
if (schema instanceof z.ZodObject) {
|
|
141
|
+
const shape = schema.shape;
|
|
142
|
+
const properties = {};
|
|
143
|
+
const required = [];
|
|
144
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
145
|
+
properties[key] = zodToJsonSchema(value);
|
|
146
|
+
if (!value.isOptional())
|
|
147
|
+
required.push(key);
|
|
148
|
+
}
|
|
149
|
+
return { type: 'object', properties, ...(required.length ? { required } : {}) };
|
|
150
|
+
}
|
|
151
|
+
if (schema instanceof z.ZodString)
|
|
152
|
+
return { type: 'string' };
|
|
153
|
+
if (schema instanceof z.ZodNumber)
|
|
154
|
+
return { type: 'number' };
|
|
155
|
+
if (schema instanceof z.ZodBoolean)
|
|
156
|
+
return { type: 'boolean' };
|
|
157
|
+
if (schema instanceof z.ZodArray)
|
|
158
|
+
return { type: 'array', items: zodToJsonSchema(schema.element) };
|
|
159
|
+
if (schema instanceof z.ZodEnum)
|
|
160
|
+
return { type: 'string', enum: schema.options };
|
|
161
|
+
if (schema instanceof z.ZodOptional)
|
|
162
|
+
return zodToJsonSchema(schema.unwrap());
|
|
163
|
+
if (schema instanceof z.ZodDefault)
|
|
164
|
+
return zodToJsonSchema(schema.removeDefault());
|
|
165
|
+
if (schema instanceof z.ZodEffects)
|
|
166
|
+
return zodToJsonSchema(schema.innerType());
|
|
167
|
+
return {};
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAc,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AASlE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmB,CAAC;AAEzC,MAAM,UAAU,QAAQ,CAAuB,GAAe;IAC5D,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAyB,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,QAAQ,CAAC,aAAa,CAAC,CAAC;IACxB,QAAQ,CAAC,eAAe,CAAC,CAAC;IAC1B,QAAQ,CAAC,sBAAsB,CAAC,CAAC;IACjC,QAAQ,CAAC,cAAc,CAAC,C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4
|
+
touches_auth: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
5
|
+
touches_money: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
6
|
+
touches_migration: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
7
|
+
files_count: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
8
|
+
new_module: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
9
|
+
api_contract_change: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
touches_auth: boolean;
|
|
12
|
+
touches_money: boolean;
|
|
13
|
+
touches_migration: boolean;
|
|
14
|
+
files_count: number;
|
|
15
|
+
new_module: boolean;
|
|
16
|
+
api_contract_change: boolean;
|
|
17
|
+
}, {
|
|
18
|
+
touches_auth?: boolean | undefined;
|
|
19
|
+
touches_money?: boolean | undefined;
|
|
20
|
+
touches_migration?: boolean | undefined;
|
|
21
|
+
files_count?: number | undefined;
|
|
22
|
+
new_module?: boolean | undefined;
|
|
23
|
+
api_contract_change?: boolean | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
type Input = z.infer<typeof schema>;
|
|
26
|
+
export type RiskLevel = 'Low' | 'Medium' | 'High';
|
|
27
|
+
export interface RiskOutput {
|
|
28
|
+
level: RiskLevel;
|
|
29
|
+
score: number;
|
|
30
|
+
signals: {
|
|
31
|
+
name: string;
|
|
32
|
+
matched: boolean;
|
|
33
|
+
}[];
|
|
34
|
+
recommendation: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function scoreRisk(input: Input): RiskOutput;
|
|
37
|
+
export declare const scoreRiskTool: ToolDef<typeof schema>;
|
|
38
|
+
export {};
|