@vyuhlabs/dxkit 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -0
- package/README.md +9 -9
- package/dist/agents/extract.d.ts +25 -0
- package/dist/agents/extract.d.ts.map +1 -0
- package/dist/agents/extract.js +186 -0
- package/dist/agents/extract.js.map +1 -0
- package/dist/agents/schemas.d.ts +106 -0
- package/dist/agents/schemas.d.ts.map +1 -0
- package/dist/agents/schemas.js +86 -0
- package/dist/agents/schemas.js.map +1 -0
- package/dist/agents/session.d.ts +28 -0
- package/dist/agents/session.d.ts.map +1 -0
- package/dist/agents/session.js +223 -0
- package/dist/agents/session.js.map +1 -0
- package/dist/analyzers/bom/gather.d.ts +12 -1
- package/dist/analyzers/bom/gather.d.ts.map +1 -1
- package/dist/analyzers/bom/gather.js +46 -0
- package/dist/analyzers/bom/gather.js.map +1 -1
- package/dist/analyzers/bom/index.d.ts.map +1 -1
- package/dist/analyzers/bom/index.js +37 -0
- package/dist/analyzers/bom/index.js.map +1 -1
- package/dist/analyzers/bom/types.d.ts +20 -0
- package/dist/analyzers/bom/types.d.ts.map +1 -1
- package/dist/analyzers/index.d.ts +3 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +6 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/analyzers/security/report.d.ts +6 -0
- package/dist/analyzers/security/report.d.ts.map +1 -0
- package/dist/analyzers/security/report.js +118 -0
- package/dist/analyzers/security/report.js.map +1 -0
- package/dist/analyzers/tools/dotnet.d.ts +8 -0
- package/dist/analyzers/tools/dotnet.d.ts.map +1 -0
- package/dist/analyzers/tools/dotnet.js +81 -0
- package/dist/analyzers/tools/dotnet.js.map +1 -0
- package/dist/analyzers/tools/gather-cache.d.ts +16 -0
- package/dist/analyzers/tools/gather-cache.d.ts.map +1 -0
- package/dist/analyzers/tools/gather-cache.js +126 -0
- package/dist/analyzers/tools/gather-cache.js.map +1 -0
- package/dist/analyzers/tools/go.d.ts +8 -0
- package/dist/analyzers/tools/go.d.ts.map +1 -0
- package/dist/analyzers/tools/go.js +84 -0
- package/dist/analyzers/tools/go.js.map +1 -0
- package/dist/analyzers/tools/node.d.ts +8 -0
- package/dist/analyzers/tools/node.d.ts.map +1 -0
- package/dist/analyzers/tools/node.js +160 -0
- package/dist/analyzers/tools/node.js.map +1 -0
- package/dist/analyzers/tools/python.d.ts +8 -0
- package/dist/analyzers/tools/python.d.ts.map +1 -0
- package/dist/analyzers/tools/python.js +81 -0
- package/dist/analyzers/tools/python.js.map +1 -0
- package/dist/analyzers/tools/rust.d.ts +8 -0
- package/dist/analyzers/tools/rust.d.ts.map +1 -0
- package/dist/analyzers/tools/rust.js +86 -0
- package/dist/analyzers/tools/rust.js.map +1 -0
- package/dist/analyzers/xlsx/bom.d.ts.map +1 -1
- package/dist/analyzers/xlsx/bom.js +11 -1
- package/dist/analyzers/xlsx/bom.js.map +1 -1
- package/dist/languages/capabilities/types.d.ts +1 -0
- package/dist/languages/capabilities/types.d.ts.map +1 -1
- package/dist/languages/csharp.d.ts +41 -6
- package/dist/languages/csharp.d.ts.map +1 -1
- package/dist/languages/csharp.js +225 -35
- package/dist/languages/csharp.js.map +1 -1
- package/dist/languages/go.d.ts +35 -0
- package/dist/languages/go.d.ts.map +1 -1
- package/dist/languages/go.js +156 -0
- package/dist/languages/go.js.map +1 -1
- package/dist/languages/python.d.ts +49 -0
- package/dist/languages/python.d.ts.map +1 -1
- package/dist/languages/python.js +202 -17
- package/dist/languages/python.js.map +1 -1
- package/dist/languages/rust.d.ts +15 -0
- package/dist/languages/rust.d.ts.map +1 -1
- package/dist/languages/rust.js +93 -0
- package/dist/languages/rust.js.map +1 -1
- package/dist/languages/typescript.d.ts +17 -0
- package/dist/languages/typescript.d.ts.map +1 -1
- package/dist/languages/typescript.js +106 -0
- package/dist/languages/typescript.js.map +1 -1
- package/package.json +1 -1
- package/templates/.ai/templates/session-checkpoint-template.md +97 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,98 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.2.0] - 2026-04-23
|
|
11
|
+
|
|
12
|
+
Minor release adding Snyk-style top-level dep attribution across every
|
|
13
|
+
language pack. Answers "which direct manifest dep do I upgrade to fix
|
|
14
|
+
the most advisories" alongside the existing per-leaf-package reporting.
|
|
15
|
+
Drop-in upgrade — additive `topLevelDep?: string[]` field, no schema
|
|
16
|
+
bump required.
|
|
17
|
+
|
|
18
|
+
### Added — top-level dep attribution (Phase 10h.4)
|
|
19
|
+
|
|
20
|
+
- **`DepVulnFinding.topLevelDep?: string[]`** — per-advisory list of
|
|
21
|
+
root manifest entries (direct + dev deps) that transitively pull the
|
|
22
|
+
vulnerable package. Coarse name-level attribution (unions across
|
|
23
|
+
multiple parents when the package is reachable from more than one
|
|
24
|
+
top-level). Enables Snyk-style grouping: one advisory against
|
|
25
|
+
`tar@7.5.9` surfaces as "under `@loopback/cli`" rather than just
|
|
26
|
+
"tar has a CVE".
|
|
27
|
+
|
|
28
|
+
- **TypeScript pack** — BFS over `package-lock.json` (v2/v3) from
|
|
29
|
+
each root `dependencies` / `devDependencies` entry. Pure parser
|
|
30
|
+
`buildTsTopLevelDepIndex` unit-tested; benchmark on
|
|
31
|
+
`vyuhlabs-platform`: 71/71 findings attributed across 31 vulnerable
|
|
32
|
+
packages, `@loopback/cli` rollup = 29 advisories (matches Snyk UI).
|
|
33
|
+
|
|
34
|
+
- **Python pack** — BFS over `pip show` graph from packages with empty
|
|
35
|
+
`Required-by`. Pure parsers `parsePipShowOutput` +
|
|
36
|
+
`buildPyTopLevelDepIndex`. Venv detection now includes poetry
|
|
37
|
+
(`poetry env info --path`), pipenv (`pipenv --venv`), and
|
|
38
|
+
`$VIRTUAL_ENV` env var alongside the existing `.venv`/`venv` fast
|
|
39
|
+
path — poetry with default `virtualenvs.in-project = false` now
|
|
40
|
+
resolves.
|
|
41
|
+
|
|
42
|
+
- **Go pack** — BFS over `go mod graph` output, with `go.mod`'s
|
|
43
|
+
`// indirect` markers filtering the seed set so only user-declared
|
|
44
|
+
direct deps become top-levels. Pure parsers `parseGoModDirectDeps` +
|
|
45
|
+
`buildGoTopLevelDepIndex`.
|
|
46
|
+
|
|
47
|
+
- **Rust pack** — BFS over `cargo metadata --format-version 1` resolve
|
|
48
|
+
graph from each direct dep of `resolve.root`. Pure parser
|
|
49
|
+
`buildRustTopLevelDepIndex`; maps package ids → names, collapses
|
|
50
|
+
version variants.
|
|
51
|
+
|
|
52
|
+
- **C# pack** — **two-part expansion**. First,
|
|
53
|
+
`dotnet list package --vulnerable` now uses `--include-transitive`,
|
|
54
|
+
so transitive vulns (previously invisible) are surfaced. Second,
|
|
55
|
+
attribution comes from walking `obj/project.assets.json` — pure
|
|
56
|
+
parsers `parseProjectAssetsJson` + `buildCsharpTopLevelDepIndex`.
|
|
57
|
+
Direct findings carry self-attribution; transitive findings gain
|
|
58
|
+
`topLevelDep` from the assets-json graph. Degrades gracefully when
|
|
59
|
+
the lockfile is absent (user hasn't run `dotnet restore`).
|
|
60
|
+
|
|
61
|
+
### Added — bom render surfaces top-level grouping
|
|
62
|
+
|
|
63
|
+
- **`BomReport.summary.byTopLevelDep: Record<string, BomTopLevelRollup>`**
|
|
64
|
+
where `BomTopLevelRollup = { advisoryCount, maxSeverity, packages[] }`.
|
|
65
|
+
Multi-parent advisories increment counters for each top-level they
|
|
66
|
+
list, matching Snyk's rollup semantics.
|
|
67
|
+
|
|
68
|
+
- **Markdown "Top-Level Dep Groups" section** in `bom-<date>.md` —
|
|
69
|
+
sorted by severity then advisory count. First row is the single
|
|
70
|
+
upgrade that resolves the most critical/highest-volume issues. Caps
|
|
71
|
+
at 30 top-levels, packages list truncated at 8 with "+N more".
|
|
72
|
+
|
|
73
|
+
- **Xlsx col 12 annotation** — each advisory line gains
|
|
74
|
+
` via <parent>` (single top-level) or ` via <parent> (+N more)`
|
|
75
|
+
(multi-parent). Reviewer sees upgrade guidance directly in the
|
|
76
|
+
spreadsheet cell. No suffix when `topLevelDep` is unset.
|
|
77
|
+
|
|
78
|
+
### Fixed — TS dep-vuln finding dedupe
|
|
79
|
+
|
|
80
|
+
- `gatherTsDepVulnsResult` now de-duplicates findings by
|
|
81
|
+
`(package, installedVersion, id)`. npm-audit inlines the same
|
|
82
|
+
advisory on every consumer's `via[]` across the vulnerability tree
|
|
83
|
+
(e.g. minimatch's ReDoS appearing on `@loopback/cli`, `glob-parent`,
|
|
84
|
+
`picomatch` simultaneously); the advisory-emission loop previously
|
|
85
|
+
pushed N copies of one logical finding. Platform count 94 → 71,
|
|
86
|
+
14 distinct dupe pairs → 0. Pre-existing from 2.1.0; caught during
|
|
87
|
+
10h.4 evaluation.
|
|
88
|
+
|
|
89
|
+
### Notes
|
|
90
|
+
|
|
91
|
+
- Every pack degrades gracefully when its dep-graph source is missing:
|
|
92
|
+
TS without `package-lock.json`, Python without a venv, Go without
|
|
93
|
+
`go.mod`, Rust without `cargo metadata`, C# without
|
|
94
|
+
`obj/project.assets.json`. Findings still emit; `topLevelDep` stays
|
|
95
|
+
unset.
|
|
96
|
+
|
|
97
|
+
- Release validated against `vyuhlabs-platform` TypeScript benchmark.
|
|
98
|
+
Python/Go/Rust/C# packs exercised via fixture-based unit tests
|
|
99
|
+
(+53 new tests across the 4 non-TS language test files); real-world
|
|
100
|
+
validation lands with 2.3.0's cross-ecosystem benchmark fixtures.
|
|
101
|
+
|
|
10
102
|
## [2.1.0] - 2026-04-23
|
|
11
103
|
|
|
12
104
|
Minor release adding two new analyzers and a shared XLSX converter.
|
package/README.md
CHANGED
|
@@ -34,15 +34,15 @@ The two modes are complementary. The analyzers run anywhere; the scaffolder writ
|
|
|
34
34
|
|
|
35
35
|
Seven deterministic analyzers. Each emits a markdown report to `.ai/reports/` and optional structured JSON.
|
|
36
36
|
|
|
37
|
-
| Command | What it does
|
|
38
|
-
| ----------------- |
|
|
39
|
-
| `health` | 6-dimension score (Testing, Quality, Docs, Security, Maint, DX)
|
|
40
|
-
| `vulnerabilities` | gitleaks + semgrep + per-pack dep-audit (per-advisory detail in `--detailed`)
|
|
41
|
-
| `test-gaps` | Coverage artifact → import-graph → filename (strongest wins)
|
|
42
|
-
| `quality` | Slop score + jscpd duplication + eslint/ruff + hygiene
|
|
43
|
-
| `dev-report` | Commits, contributors, hot files, velocity, conventional %
|
|
44
|
-
| `licenses` | Dependency license inventory across every active pack (TS/Python/Go/Rust/C#)
|
|
45
|
-
| `bom` | **Bill of Materials** — joins licenses + vulnerabilities per package, 15-col XLSX | 10–40s | `.ai/reports/bom-<date>.{md,xlsx}` |
|
|
37
|
+
| Command | What it does | Runtime | Output |
|
|
38
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------ |
|
|
39
|
+
| `health` | 6-dimension score (Testing, Quality, Docs, Security, Maint, DX) | 10–20s | `.ai/reports/health-audit-<date>.md` |
|
|
40
|
+
| `vulnerabilities` | gitleaks + semgrep + per-pack dep-audit (per-advisory detail in `--detailed`) | 5–30s | `.ai/reports/vulnerability-scan-<date>.md` |
|
|
41
|
+
| `test-gaps` | Coverage artifact → import-graph → filename (strongest wins) | <1s | `.ai/reports/test-gaps-<date>.md` |
|
|
42
|
+
| `quality` | Slop score + jscpd duplication + eslint/ruff + hygiene | 5–15s | `.ai/reports/quality-review-<date>.md` |
|
|
43
|
+
| `dev-report` | Commits, contributors, hot files, velocity, conventional % | <1s | `.ai/reports/developer-report-<date>.md` |
|
|
44
|
+
| `licenses` | Dependency license inventory across every active pack (TS/Python/Go/Rust/C#) | 5–20s | `.ai/reports/licenses-<date>.md` |
|
|
45
|
+
| `bom` | **Bill of Materials** — joins licenses + vulnerabilities per package, 15-col XLSX; groups advisories by top-level manifest dep (Snyk-style) | 10–40s | `.ai/reports/bom-<date>.{md,xlsx}` |
|
|
46
46
|
|
|
47
47
|
Plus a converter: `vyuh-dxkit to-xlsx <json-file>` renders any `licenses` or `bom` detailed JSON as the canonical 15-column XLSX.
|
|
48
48
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt extraction — reads agent templates from src-templates/
|
|
3
|
+
* and transforms them for use with Managed Agents.
|
|
4
|
+
*
|
|
5
|
+
* Source of truth: src-templates/.claude/agents-available/*.md
|
|
6
|
+
* This module READS those files at runtime — never copies or duplicates them.
|
|
7
|
+
*/
|
|
8
|
+
export interface ExtractedAgent {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
systemPrompt: string;
|
|
12
|
+
model: string;
|
|
13
|
+
tools: Array<{
|
|
14
|
+
type: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}>;
|
|
17
|
+
outputSchema: object | undefined;
|
|
18
|
+
}
|
|
19
|
+
/** List all available agent template names. */
|
|
20
|
+
export declare function listAgentTemplates(): string[];
|
|
21
|
+
/** Extract a single agent's prompt from its template file. */
|
|
22
|
+
export declare function extractAgent(name: string, modelOverride?: string): ExtractedAgent;
|
|
23
|
+
/** Extract all available agent prompts. */
|
|
24
|
+
export declare function extractAllAgents(modelOverride?: string): ExtractedAgent[];
|
|
25
|
+
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/agents/extract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;IACvD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AA4DD,+CAA+C;AAC/C,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAO7C;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,cAAc,CA0CjF;AAED,2CAA2C;AAC3C,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,CAEzE"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Prompt extraction — reads agent templates from src-templates/
|
|
4
|
+
* and transforms them for use with Managed Agents.
|
|
5
|
+
*
|
|
6
|
+
* Source of truth: src-templates/.claude/agents-available/*.md
|
|
7
|
+
* This module READS those files at runtime — never copies or duplicates them.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.listAgentTemplates = listAgentTemplates;
|
|
44
|
+
exports.extractAgent = extractAgent;
|
|
45
|
+
exports.extractAllAgents = extractAllAgents;
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const schemas_1 = require("./schemas");
|
|
49
|
+
/**
|
|
50
|
+
* Default model per agent category.
|
|
51
|
+
* Analysis agents use Sonnet (cheaper, good enough).
|
|
52
|
+
* Execution agents use Opus (accuracy matters for code changes).
|
|
53
|
+
*/
|
|
54
|
+
const AGENT_MODELS = {
|
|
55
|
+
// Analysis — Sonnet is cost-effective
|
|
56
|
+
'health-auditor': 'claude-sonnet-4-6',
|
|
57
|
+
'vulnerability-scanner': 'claude-sonnet-4-6',
|
|
58
|
+
'test-gap-finder': 'claude-sonnet-4-6',
|
|
59
|
+
'dev-report': 'claude-sonnet-4-6',
|
|
60
|
+
'dependency-mapper': 'claude-sonnet-4-6',
|
|
61
|
+
'codebase-explorer': 'claude-sonnet-4-6',
|
|
62
|
+
'code-reviewer': 'claude-sonnet-4-6',
|
|
63
|
+
'doc-writer': 'claude-sonnet-4-6',
|
|
64
|
+
'dashboard-builder': 'claude-sonnet-4-6',
|
|
65
|
+
'knowledge-bot': 'claude-sonnet-4-6',
|
|
66
|
+
// Execution — Opus for accuracy
|
|
67
|
+
'feature-planner': 'claude-opus-4-6',
|
|
68
|
+
'feature-builder': 'claude-opus-4-6',
|
|
69
|
+
'plan-executor': 'claude-opus-4-6',
|
|
70
|
+
'strategic-planner': 'claude-opus-4-6',
|
|
71
|
+
'test-writer': 'claude-opus-4-6',
|
|
72
|
+
'debugger': 'claude-opus-4-6',
|
|
73
|
+
'hooks-configurator': 'claude-sonnet-4-6',
|
|
74
|
+
};
|
|
75
|
+
/** Map of Claude Code slash command references to plain-language equivalents. */
|
|
76
|
+
const COMMAND_REPLACEMENTS = {
|
|
77
|
+
'Run /health': 'Analyze the codebase for health metrics',
|
|
78
|
+
'Run /quality': 'Run available linting tools via bash',
|
|
79
|
+
'Run /test': 'Run the test suite via bash',
|
|
80
|
+
'Run /vulnerabilities': 'Scan for security vulnerabilities',
|
|
81
|
+
'/health': 'health analysis',
|
|
82
|
+
'/quality': 'quality check',
|
|
83
|
+
'/test': 'test suite',
|
|
84
|
+
};
|
|
85
|
+
/** Lines to strip from prompts (Claude Code-specific). */
|
|
86
|
+
const STRIP_PATTERNS = [
|
|
87
|
+
/Save .*to \.ai\/reports\/.*/g,
|
|
88
|
+
/Saves? reports? to \.ai\/reports\/.*/g,
|
|
89
|
+
/\.ai\/reports\//g,
|
|
90
|
+
/\.ai\/sessions\//g,
|
|
91
|
+
];
|
|
92
|
+
/**
|
|
93
|
+
* Resolve the templates directory.
|
|
94
|
+
* In development: src-templates/
|
|
95
|
+
* When published: templates/ (copied by build script)
|
|
96
|
+
*/
|
|
97
|
+
function templatesDir() {
|
|
98
|
+
const srcTemplates = path.resolve(__dirname, '..', '..', 'src-templates');
|
|
99
|
+
if (fs.existsSync(srcTemplates))
|
|
100
|
+
return srcTemplates;
|
|
101
|
+
return path.resolve(__dirname, '..', '..', 'templates');
|
|
102
|
+
}
|
|
103
|
+
/** List all available agent template names. */
|
|
104
|
+
function listAgentTemplates() {
|
|
105
|
+
const dir = path.join(templatesDir(), '.claude', 'agents-available');
|
|
106
|
+
if (!fs.existsSync(dir))
|
|
107
|
+
return [];
|
|
108
|
+
return fs
|
|
109
|
+
.readdirSync(dir)
|
|
110
|
+
.filter((f) => f.endsWith('.md'))
|
|
111
|
+
.map((f) => f.replace('.md', ''));
|
|
112
|
+
}
|
|
113
|
+
/** Extract a single agent's prompt from its template file. */
|
|
114
|
+
function extractAgent(name, modelOverride) {
|
|
115
|
+
const filePath = path.join(templatesDir(), '.claude', 'agents-available', `${name}.md`);
|
|
116
|
+
if (!fs.existsSync(filePath)) {
|
|
117
|
+
throw new Error(`Agent template not found: ${name}`);
|
|
118
|
+
}
|
|
119
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
120
|
+
const { frontmatter, body } = parseFrontmatter(raw);
|
|
121
|
+
// Clean the prompt for Managed Agent use
|
|
122
|
+
let systemPrompt = body;
|
|
123
|
+
// Replace Claude Code command references
|
|
124
|
+
for (const [pattern, replacement] of Object.entries(COMMAND_REPLACEMENTS)) {
|
|
125
|
+
systemPrompt = systemPrompt.replaceAll(pattern, replacement);
|
|
126
|
+
}
|
|
127
|
+
// Strip Claude Code-specific lines
|
|
128
|
+
for (const pattern of STRIP_PATTERNS) {
|
|
129
|
+
systemPrompt = systemPrompt.replace(pattern, '');
|
|
130
|
+
}
|
|
131
|
+
// Determine the agent type for schema lookup
|
|
132
|
+
const agentType = mapNameToSchemaType(name);
|
|
133
|
+
const outputSchema = agentType ? (0, schemas_1.getSchema)(agentType) : undefined;
|
|
134
|
+
// Append JSON output instructions if we have a schema
|
|
135
|
+
if (outputSchema) {
|
|
136
|
+
systemPrompt += `\n\n## Output Format\n\nReturn your analysis as valid JSON. Wrap the JSON in a \`\`\`json code block. The JSON must match this schema:\n\n\`\`\`json\n${JSON.stringify(outputSchema, null, 2)}\n\`\`\`\n`;
|
|
137
|
+
}
|
|
138
|
+
// Clean up excessive blank lines
|
|
139
|
+
systemPrompt = systemPrompt.replace(/\n{3,}/g, '\n\n').trim();
|
|
140
|
+
return {
|
|
141
|
+
name: `dxkit-${name}`,
|
|
142
|
+
description: frontmatter.description || `DXKit ${name} agent`,
|
|
143
|
+
systemPrompt,
|
|
144
|
+
model: modelOverride || AGENT_MODELS[name] || 'claude-sonnet-4-6',
|
|
145
|
+
tools: [{ type: 'agent_toolset_20260401' }],
|
|
146
|
+
outputSchema,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/** Extract all available agent prompts. */
|
|
150
|
+
function extractAllAgents(modelOverride) {
|
|
151
|
+
return listAgentTemplates().map((name) => extractAgent(name, modelOverride));
|
|
152
|
+
}
|
|
153
|
+
/** Map agent names to schema type keys. */
|
|
154
|
+
function mapNameToSchemaType(name) {
|
|
155
|
+
const map = {
|
|
156
|
+
'health-auditor': 'health',
|
|
157
|
+
'vulnerability-scanner': 'vulnerabilities',
|
|
158
|
+
'feature-planner': 'feature',
|
|
159
|
+
'feature-builder': 'execution',
|
|
160
|
+
'plan-executor': 'execution',
|
|
161
|
+
};
|
|
162
|
+
return map[name];
|
|
163
|
+
}
|
|
164
|
+
/** Parse YAML-ish frontmatter from agent markdown files. */
|
|
165
|
+
function parseFrontmatter(raw) {
|
|
166
|
+
const frontmatter = {};
|
|
167
|
+
if (!raw.startsWith('---')) {
|
|
168
|
+
return { frontmatter, body: raw };
|
|
169
|
+
}
|
|
170
|
+
const endIdx = raw.indexOf('---', 3);
|
|
171
|
+
if (endIdx === -1) {
|
|
172
|
+
return { frontmatter, body: raw };
|
|
173
|
+
}
|
|
174
|
+
const fmBlock = raw.slice(3, endIdx).trim();
|
|
175
|
+
for (const line of fmBlock.split('\n')) {
|
|
176
|
+
const colonIdx = line.indexOf(':');
|
|
177
|
+
if (colonIdx === -1)
|
|
178
|
+
continue;
|
|
179
|
+
const key = line.slice(0, colonIdx).trim();
|
|
180
|
+
const value = line.slice(colonIdx + 1).trim();
|
|
181
|
+
frontmatter[key] = value;
|
|
182
|
+
}
|
|
183
|
+
const body = raw.slice(endIdx + 3).trim();
|
|
184
|
+
return { frontmatter, body };
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=extract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/agents/extract.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EH,gDAOC;AAGD,oCA0CC;AAGD,4CAEC;AAjID,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAsC;AAWtC;;;;GAIG;AACH,MAAM,YAAY,GAA2B;IAC3C,sCAAsC;IACtC,gBAAgB,EAAE,mBAAmB;IACrC,uBAAuB,EAAE,mBAAmB;IAC5C,iBAAiB,EAAE,mBAAmB;IACtC,YAAY,EAAE,mBAAmB;IACjC,mBAAmB,EAAE,mBAAmB;IACxC,mBAAmB,EAAE,mBAAmB;IACxC,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,mBAAmB;IACjC,mBAAmB,EAAE,mBAAmB;IACxC,eAAe,EAAE,mBAAmB;IAEpC,gCAAgC;IAChC,iBAAiB,EAAE,iBAAiB;IACpC,iBAAiB,EAAE,iBAAiB;IACpC,eAAe,EAAE,iBAAiB;IAClC,mBAAmB,EAAE,iBAAiB;IACtC,aAAa,EAAE,iBAAiB;IAChC,UAAU,EAAE,iBAAiB;IAC7B,oBAAoB,EAAE,mBAAmB;CAC1C,CAAC;AAEF,iFAAiF;AACjF,MAAM,oBAAoB,GAA2B;IACnD,aAAa,EAAE,yCAAyC;IACxD,cAAc,EAAE,sCAAsC;IACtD,WAAW,EAAE,6BAA6B;IAC1C,sBAAsB,EAAE,mCAAmC;IAC3D,SAAS,EAAE,iBAAiB;IAC5B,UAAU,EAAE,eAAe;IAC3B,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,0DAA0D;AAC1D,MAAM,cAAc,GAAG;IACrB,8BAA8B;IAC9B,uCAAuC;IACvC,kBAAkB;IAClB,mBAAmB;CACpB,CAAC;AAEF;;;;G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AAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON output schemas for Managed Agent responses.
|
|
3
|
+
* Each agent type returns structured JSON matching these schemas.
|
|
4
|
+
*/
|
|
5
|
+
export interface HealthReport {
|
|
6
|
+
repo: string;
|
|
7
|
+
analyzedAt: string;
|
|
8
|
+
summary: {
|
|
9
|
+
overallScore: number;
|
|
10
|
+
maxScore: number;
|
|
11
|
+
grade: 'A' | 'B' | 'C' | 'D' | 'F';
|
|
12
|
+
};
|
|
13
|
+
dimensions: {
|
|
14
|
+
testing: {
|
|
15
|
+
score: number;
|
|
16
|
+
details: string;
|
|
17
|
+
};
|
|
18
|
+
quality: {
|
|
19
|
+
score: number;
|
|
20
|
+
details: string;
|
|
21
|
+
};
|
|
22
|
+
documentation: {
|
|
23
|
+
score: number;
|
|
24
|
+
details: string;
|
|
25
|
+
};
|
|
26
|
+
security: {
|
|
27
|
+
score: number;
|
|
28
|
+
details: string;
|
|
29
|
+
};
|
|
30
|
+
maintainability: {
|
|
31
|
+
score: number;
|
|
32
|
+
details: string;
|
|
33
|
+
};
|
|
34
|
+
developerExperience: {
|
|
35
|
+
score: number;
|
|
36
|
+
details: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
recommendations: Array<{
|
|
40
|
+
priority: number;
|
|
41
|
+
title: string;
|
|
42
|
+
description: string;
|
|
43
|
+
affectedFiles: string[];
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
export interface VulnerabilityReport {
|
|
47
|
+
repo: string;
|
|
48
|
+
analyzedAt: string;
|
|
49
|
+
summary: {
|
|
50
|
+
total: number;
|
|
51
|
+
critical: number;
|
|
52
|
+
high: number;
|
|
53
|
+
medium: number;
|
|
54
|
+
low: number;
|
|
55
|
+
};
|
|
56
|
+
findings: Array<{
|
|
57
|
+
cwe: string;
|
|
58
|
+
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
59
|
+
title: string;
|
|
60
|
+
file: string;
|
|
61
|
+
line: number | null;
|
|
62
|
+
description: string;
|
|
63
|
+
recommendation: string;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
export interface FeaturePlan {
|
|
67
|
+
slug: string;
|
|
68
|
+
title: string;
|
|
69
|
+
description: string;
|
|
70
|
+
tasks: Array<{
|
|
71
|
+
sequence: number;
|
|
72
|
+
title: string;
|
|
73
|
+
description: string;
|
|
74
|
+
type: string;
|
|
75
|
+
affectedFiles: string[];
|
|
76
|
+
acceptanceCriteria: string[];
|
|
77
|
+
dependsOn: number[];
|
|
78
|
+
}>;
|
|
79
|
+
risks: Array<{
|
|
80
|
+
description: string;
|
|
81
|
+
severity: string;
|
|
82
|
+
mitigation: string;
|
|
83
|
+
}>;
|
|
84
|
+
}
|
|
85
|
+
export interface ExecutionReport {
|
|
86
|
+
taskKey: string;
|
|
87
|
+
status: 'success' | 'failed' | 'timeout';
|
|
88
|
+
filesChanged: Array<{
|
|
89
|
+
path: string;
|
|
90
|
+
additions: number;
|
|
91
|
+
deletions: number;
|
|
92
|
+
}>;
|
|
93
|
+
changeSummary: string;
|
|
94
|
+
testResults: {
|
|
95
|
+
passed: boolean;
|
|
96
|
+
total: number;
|
|
97
|
+
failed: number;
|
|
98
|
+
output: string;
|
|
99
|
+
};
|
|
100
|
+
retries: number;
|
|
101
|
+
}
|
|
102
|
+
/** JSON schema objects for injection into system prompts. */
|
|
103
|
+
export declare const SCHEMA_JSON: Record<string, object>;
|
|
104
|
+
/** Map agent type names to their JSON schemas. */
|
|
105
|
+
export declare function getSchema(agentType: string): object | undefined;
|
|
106
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/agents/schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE;QACP,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;KACpC,CAAC;IACF,UAAU,EAAE;QACV,OAAO,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;QAC5C,OAAO,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;QAC5C,aAAa,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;QAClD,QAAQ,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7C,eAAe,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;QACpD,mBAAmB,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;KACzD,CAAC;IACF,eAAe,EAAE,KAAK,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,mBAAmB;IAClC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AI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAChF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6DAA6D;AAC7D,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuE9C,CAAC;AAEF,kDAAkD;AAClD,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/D"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* JSON output schemas for Managed Agent responses.
|
|
4
|
+
* Each agent type returns structured JSON matching these schemas.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SCHEMA_JSON = void 0;
|
|
8
|
+
exports.getSchema = getSchema;
|
|
9
|
+
/** JSON schema objects for injection into system prompts. */
|
|
10
|
+
exports.SCHEMA_JSON = {
|
|
11
|
+
health: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
repo: { type: 'string' },
|
|
15
|
+
analyzedAt: { type: 'string' },
|
|
16
|
+
summary: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
overallScore: { type: 'number' },
|
|
20
|
+
maxScore: { type: 'number', const: 60 },
|
|
21
|
+
grade: { type: 'string', enum: ['A', 'B', 'C', 'D', 'F'] },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
dimensions: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
testing: { type: 'object', properties: { score: { type: 'number' }, details: { type: 'string' } } },
|
|
28
|
+
quality: { type: 'object', properties: { score: { type: 'number' }, details: { type: 'string' } } },
|
|
29
|
+
documentation: { type: 'object', properties: { score: { type: 'number' }, details: { type: 'string' } } },
|
|
30
|
+
security: { type: 'object', properties: { score: { type: 'number' }, details: { type: 'string' } } },
|
|
31
|
+
maintainability: { type: 'object', properties: { score: { type: 'number' }, details: { type: 'string' } } },
|
|
32
|
+
developerExperience: { type: 'object', properties: { score: { type: 'number' }, details: { type: 'string' } } },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
recommendations: {
|
|
36
|
+
type: 'array',
|
|
37
|
+
items: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
priority: { type: 'number' },
|
|
41
|
+
title: { type: 'string' },
|
|
42
|
+
description: { type: 'string' },
|
|
43
|
+
affectedFiles: { type: 'array', items: { type: 'string' } },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
vulnerabilities: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
repo: { type: 'string' },
|
|
53
|
+
analyzedAt: { type: 'string' },
|
|
54
|
+
summary: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
total: { type: 'number' },
|
|
58
|
+
critical: { type: 'number' },
|
|
59
|
+
high: { type: 'number' },
|
|
60
|
+
medium: { type: 'number' },
|
|
61
|
+
low: { type: 'number' },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
findings: {
|
|
65
|
+
type: 'array',
|
|
66
|
+
items: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
properties: {
|
|
69
|
+
cwe: { type: 'string' },
|
|
70
|
+
severity: { type: 'string' },
|
|
71
|
+
title: { type: 'string' },
|
|
72
|
+
file: { type: 'string' },
|
|
73
|
+
line: { type: ['number', 'null'] },
|
|
74
|
+
description: { type: 'string' },
|
|
75
|
+
recommendation: { type: 'string' },
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
/** Map agent type names to their JSON schemas. */
|
|
83
|
+
function getSchema(agentType) {
|
|
84
|
+
return exports.SCHEMA_JSON[agentType];
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/agents/schemas.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA6IH,8BAEC;AA7ED,6DAA6D;AAChD,QAAA,WAAW,GAA2B;IACjD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC9B,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAChC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;oBACvC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;iBAC3D;aACF;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;oBACnG,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,KAAK,EAA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HROPIC_API_KEY.
|
|
6
|
+
*/
|
|
7
|
+
/** Stored agent config — persisted to .dxkit-agents.json */
|
|
8
|
+
export interface AgentConfig {
|
|
9
|
+
version: string;
|
|
10
|
+
environment_id: string;
|
|
11
|
+
agents: Record<string, {
|
|
12
|
+
agent_id: string;
|
|
13
|
+
agent_version: string;
|
|
14
|
+
prompt_hash: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
/** Load agent config from disk. */
|
|
18
|
+
export declare function loadConfig(cwd: string): AgentConfig | null;
|
|
19
|
+
/**
|
|
20
|
+
* Set up all agents on Anthropic's infrastructure.
|
|
21
|
+
* Creates an environment and one agent per template.
|
|
22
|
+
*/
|
|
23
|
+
export declare function setupAgents(cwd: string, modelOverride?: string): Promise<AgentConfig>;
|
|
24
|
+
/** List registered agents. */
|
|
25
|
+
export declare function listAgents(cwd: string): void;
|
|
26
|
+
/** Run an agent session on a GitHub repo. */
|
|
27
|
+
export declare function runAgent(cwd: string, agentType: string, repoUrl: string, githubToken: string, branch?: string, task?: string): Promise<string>;
|
|
28
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/agents/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CACZ,MAAM,EACN;QACE,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;KACrB,CACF,CAAC;CACH;AAID,mCAAmC;AACnC,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAQ1D;AAkBD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAsD3F;AAED,8BAA8B;AAC9B,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAe5C;AAED,6CAA6C;AAC7C,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAuFjB"}
|