@mandible-ai/mandible 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -44
- package/dist/examples/code-pipeline/colonies.d.ts +10 -0
- package/dist/examples/code-pipeline/colonies.d.ts.map +1 -0
- package/dist/examples/code-pipeline/colonies.js +112 -0
- package/dist/examples/code-pipeline/colonies.js.map +1 -0
- package/dist/examples/code-pipeline/docker.d.ts +3 -0
- package/dist/examples/code-pipeline/docker.d.ts.map +1 -0
- package/dist/examples/code-pipeline/docker.js +63 -0
- package/dist/examples/code-pipeline/docker.js.map +1 -0
- package/dist/examples/code-pipeline/index.js +44 -228
- package/dist/examples/code-pipeline/index.js.map +1 -1
- package/dist/examples/github-colony/mandible.config.d.ts +1 -10
- package/dist/examples/github-colony/mandible.config.d.ts.map +1 -1
- package/dist/examples/github-colony/mandible.config.js +16 -24
- package/dist/examples/github-colony/mandible.config.js.map +1 -1
- package/dist/examples/repo-maintenance/fixer.d.ts +11 -4
- package/dist/examples/repo-maintenance/fixer.d.ts.map +1 -1
- package/dist/examples/repo-maintenance/fixer.js +130 -123
- package/dist/examples/repo-maintenance/fixer.js.map +1 -1
- package/dist/examples/repo-maintenance/mandible.config.d.ts +1 -10
- package/dist/examples/repo-maintenance/mandible.config.d.ts.map +1 -1
- package/dist/examples/repo-maintenance/mandible.config.js +14 -14
- package/dist/examples/repo-maintenance/mandible.config.js.map +1 -1
- package/dist/examples/repo-maintenance/scout.d.ts +11 -4
- package/dist/examples/repo-maintenance/scout.d.ts.map +1 -1
- package/dist/examples/repo-maintenance/scout.js +102 -95
- package/dist/examples/repo-maintenance/scout.js.map +1 -1
- package/dist/examples/repo-maintenance/seed.js +19 -37
- package/dist/examples/repo-maintenance/seed.js.map +1 -1
- package/package.json +2 -7
|
@@ -1,143 +1,150 @@
|
|
|
1
1
|
// PURPOSE: Fixer colony — claims issue:detected signals and attempts to fix them using a Claude agent.
|
|
2
2
|
// PURPOSE: Deposits fix:proposed on success or fix:failed on failure.
|
|
3
|
-
import { colony } from '../../src/dsl/builder.js';
|
|
4
3
|
import { withClaudeCode } from '../../src/providers/claude-code.js';
|
|
5
4
|
// ----------------------------------------------------------
|
|
6
|
-
// Fixer colony
|
|
5
|
+
// Fixer colony configurator
|
|
7
6
|
// ----------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Returns a colony configurator for use with the mandible() DSL.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* await mandible('repo-maintenance')
|
|
12
|
+
* .environment(env)
|
|
13
|
+
* .colony('fixer', configureFixer(repoRoot))
|
|
14
|
+
* .start();
|
|
15
|
+
*/
|
|
16
|
+
export function configureFixer(repoRoot, options = {}) {
|
|
17
|
+
const { senseTypes = 'issue:detected', model = 'claude-sonnet-4-5-20250929', maxBudgetUsd = 3.00, maxTurns = 80, allowedTools = ['Read', 'Edit', 'Write', 'Bash', 'Glob', 'Grep'], disallowedTools = [], concurrency = 2, claimLeaseDuration = 600_000, bedrock, } = options;
|
|
10
18
|
const types = Array.isArray(senseTypes) ? senseTypes : [senseTypes];
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'',
|
|
22
|
-
'Workflow:',
|
|
23
|
-
'1. Create a branch named `mandible/fix-{category}-{short-hash}` from the current HEAD.',
|
|
24
|
-
' Use the first 6 chars of a random hex string for the short hash.',
|
|
25
|
-
'2. Analyze the issue description and affected files.',
|
|
26
|
-
'3. Make the MINIMAL change needed to resolve the issue.',
|
|
27
|
-
'4. Run tests (`npm test` or `npx vitest run`) to verify the fix does not break anything.',
|
|
28
|
-
'5. Output a JSON result block (see below).',
|
|
29
|
-
'',
|
|
30
|
-
'Constraints:',
|
|
31
|
-
'- Do NOT merge to main. Only work on the fix branch.',
|
|
32
|
-
'- Do NOT make changes beyond what is needed for this specific issue.',
|
|
33
|
-
'- If a previous_feedback field is present, it means a prior fix attempt was rejected.',
|
|
34
|
-
' Use that feedback to improve your approach.',
|
|
35
|
-
'- If you cannot fix the issue, output a failure result instead.',
|
|
36
|
-
'',
|
|
37
|
-
'Output format — wrap in a ```json code block:',
|
|
38
|
-
'```json',
|
|
39
|
-
'{',
|
|
40
|
-
' "status": "success",',
|
|
41
|
-
' "issue_title": "Short title of the issue",',
|
|
42
|
-
' "branch": "mandible/fix-category-abc123",',
|
|
43
|
-
' "diff_summary": "What changed and why",',
|
|
44
|
-
' "files_changed": ["file1.ts", "file2.ts"],',
|
|
45
|
-
' "tests_passed": true,',
|
|
46
|
-
' "confidence": "high"',
|
|
47
|
-
'}',
|
|
48
|
-
'```',
|
|
49
|
-
'',
|
|
50
|
-
'On failure:',
|
|
51
|
-
'```json',
|
|
52
|
-
'{',
|
|
53
|
-
' "status": "failure",',
|
|
54
|
-
' "issue_title": "Short title of the issue",',
|
|
55
|
-
' "reason": "Why the fix could not be applied",',
|
|
56
|
-
' "attempted_approach": "What was tried"',
|
|
57
|
-
'}',
|
|
58
|
-
'```',
|
|
59
|
-
].join('\n'),
|
|
60
|
-
prompt: (signal) => {
|
|
61
|
-
const p = signal.payload;
|
|
62
|
-
const lines = [
|
|
63
|
-
'## Fix Request',
|
|
19
|
+
return (c) => {
|
|
20
|
+
for (const t of types) {
|
|
21
|
+
c = c.sense(t, { unclaimed: true });
|
|
22
|
+
}
|
|
23
|
+
return c
|
|
24
|
+
.do('fix-issue', withClaudeCode({
|
|
25
|
+
model,
|
|
26
|
+
systemPrompt: [
|
|
27
|
+
'You are a Fixer agent in a repo-maintenance colony.',
|
|
28
|
+
'Your job is to claim a detected issue and produce a minimal, correct fix.',
|
|
64
29
|
'',
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
30
|
+
'Workflow:',
|
|
31
|
+
'1. Create a branch named `mandible/fix-{category}-{short-hash}` from the current HEAD.',
|
|
32
|
+
' Use the first 6 chars of a random hex string for the short hash.',
|
|
33
|
+
'2. Analyze the issue description and affected files.',
|
|
34
|
+
'3. Make the MINIMAL change needed to resolve the issue.',
|
|
35
|
+
'4. Run tests (`npm test` or `npx vitest run`) to verify the fix does not break anything.',
|
|
36
|
+
'5. Output a JSON result block (see below).',
|
|
68
37
|
'',
|
|
69
|
-
'
|
|
70
|
-
|
|
38
|
+
'Constraints:',
|
|
39
|
+
'- Do NOT merge to main. Only work on the fix branch.',
|
|
40
|
+
'- Do NOT make changes beyond what is needed for this specific issue.',
|
|
41
|
+
'- If a previous_feedback field is present, it means a prior fix attempt was rejected.',
|
|
42
|
+
' Use that feedback to improve your approach.',
|
|
43
|
+
'- If you cannot fix the issue, output a failure result instead.',
|
|
71
44
|
'',
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
45
|
+
'Output format — wrap in a ```json code block:',
|
|
46
|
+
'```json',
|
|
47
|
+
'{',
|
|
48
|
+
' "status": "success",',
|
|
49
|
+
' "issue_title": "Short title of the issue",',
|
|
50
|
+
' "branch": "mandible/fix-category-abc123",',
|
|
51
|
+
' "diff_summary": "What changed and why",',
|
|
52
|
+
' "files_changed": ["file1.ts", "file2.ts"],',
|
|
53
|
+
' "tests_passed": true,',
|
|
54
|
+
' "confidence": "high"',
|
|
55
|
+
'}',
|
|
56
|
+
'```',
|
|
57
|
+
'',
|
|
58
|
+
'On failure:',
|
|
59
|
+
'```json',
|
|
60
|
+
'{',
|
|
61
|
+
' "status": "failure",',
|
|
62
|
+
' "issue_title": "Short title of the issue",',
|
|
63
|
+
' "reason": "Why the fix could not be applied",',
|
|
64
|
+
' "attempted_approach": "What was tried"',
|
|
65
|
+
'}',
|
|
66
|
+
'```',
|
|
67
|
+
].join('\n'),
|
|
68
|
+
prompt: (signal) => {
|
|
69
|
+
const p = signal.payload;
|
|
70
|
+
const lines = [
|
|
71
|
+
'## Fix Request',
|
|
72
|
+
'',
|
|
73
|
+
`**Category:** ${p.category ?? 'unknown'}`,
|
|
74
|
+
`**Severity:** ${p.severity ?? 'medium'}`,
|
|
75
|
+
`**Title:** ${p.title ?? 'Untitled issue'}`,
|
|
76
|
+
'',
|
|
77
|
+
'### Description',
|
|
78
|
+
String(p.description ?? 'No description provided.'),
|
|
79
|
+
'',
|
|
80
|
+
];
|
|
81
|
+
const files = p.files;
|
|
82
|
+
if (files && files.length > 0) {
|
|
83
|
+
lines.push('### Affected Files');
|
|
84
|
+
for (const f of files) {
|
|
85
|
+
lines.push(`- ${f}`);
|
|
86
|
+
}
|
|
87
|
+
lines.push('');
|
|
88
|
+
}
|
|
89
|
+
if (p.suggested_fix) {
|
|
90
|
+
lines.push('### Suggested Fix');
|
|
91
|
+
lines.push(String(p.suggested_fix));
|
|
92
|
+
lines.push('');
|
|
93
|
+
}
|
|
94
|
+
if (p.previous_feedback) {
|
|
95
|
+
lines.push('### Previous Feedback (from rejected attempt)');
|
|
96
|
+
lines.push(String(p.previous_feedback));
|
|
97
|
+
lines.push('');
|
|
98
|
+
lines.push('Use this feedback to improve your fix approach.');
|
|
99
|
+
lines.push('');
|
|
100
|
+
}
|
|
101
|
+
lines.push('Apply the fix, run tests, and output the JSON result block.');
|
|
102
|
+
return lines.join('\n');
|
|
103
|
+
},
|
|
104
|
+
allowedTools,
|
|
105
|
+
disallowedTools,
|
|
106
|
+
workingDirectory: repoRoot,
|
|
107
|
+
maxBudgetUsd,
|
|
108
|
+
maxTurns,
|
|
109
|
+
bedrock,
|
|
110
|
+
output: (result, signal) => {
|
|
111
|
+
const parsed = parseFixerOutput(result.text);
|
|
112
|
+
const issuePayload = signal.payload;
|
|
113
|
+
const issueTitle = String(issuePayload.title ?? 'Unknown issue');
|
|
114
|
+
if (parsed.status === 'failure') {
|
|
115
|
+
return [{
|
|
116
|
+
type: 'fix:failed',
|
|
117
|
+
payload: {
|
|
118
|
+
issue_title: parsed.issue_title || issueTitle,
|
|
119
|
+
reason: parsed.reason || 'Agent did not produce a valid result',
|
|
120
|
+
attempted_approach: parsed.attempted_approach,
|
|
121
|
+
costUsd: result.costUsd,
|
|
122
|
+
durationMs: result.durationMs,
|
|
123
|
+
},
|
|
124
|
+
tags: ['failure'],
|
|
125
|
+
}];
|
|
78
126
|
}
|
|
79
|
-
lines.push('');
|
|
80
|
-
}
|
|
81
|
-
if (p.suggested_fix) {
|
|
82
|
-
lines.push('### Suggested Fix');
|
|
83
|
-
lines.push(String(p.suggested_fix));
|
|
84
|
-
lines.push('');
|
|
85
|
-
}
|
|
86
|
-
if (p.previous_feedback) {
|
|
87
|
-
lines.push('### Previous Feedback (from rejected attempt)');
|
|
88
|
-
lines.push(String(p.previous_feedback));
|
|
89
|
-
lines.push('');
|
|
90
|
-
lines.push('Use this feedback to improve your fix approach.');
|
|
91
|
-
lines.push('');
|
|
92
|
-
}
|
|
93
|
-
lines.push('Apply the fix, run tests, and output the JSON result block.');
|
|
94
|
-
return lines.join('\n');
|
|
95
|
-
},
|
|
96
|
-
allowedTools,
|
|
97
|
-
disallowedTools,
|
|
98
|
-
workingDirectory: repoRoot,
|
|
99
|
-
maxBudgetUsd,
|
|
100
|
-
maxTurns,
|
|
101
|
-
bedrock,
|
|
102
|
-
output: (result, signal) => {
|
|
103
|
-
const parsed = parseFixerOutput(result.text);
|
|
104
|
-
const issuePayload = signal.payload;
|
|
105
|
-
const issueTitle = String(issuePayload.title ?? 'Unknown issue');
|
|
106
|
-
if (parsed.status === 'failure') {
|
|
107
127
|
return [{
|
|
108
|
-
type: 'fix:
|
|
128
|
+
type: 'fix:proposed',
|
|
109
129
|
payload: {
|
|
110
130
|
issue_title: parsed.issue_title || issueTitle,
|
|
111
|
-
|
|
112
|
-
|
|
131
|
+
branch: parsed.branch || 'unknown',
|
|
132
|
+
diff_summary: parsed.diff_summary || '',
|
|
133
|
+
files_changed: parsed.files_changed || [],
|
|
134
|
+
tests_passed: parsed.tests_passed ?? false,
|
|
135
|
+
confidence: parsed.confidence || 'low',
|
|
113
136
|
costUsd: result.costUsd,
|
|
114
137
|
durationMs: result.durationMs,
|
|
115
138
|
},
|
|
116
|
-
tags: ['
|
|
139
|
+
tags: [parsed.confidence || 'low', parsed.tests_passed ? 'tests-pass' : 'tests-fail'],
|
|
117
140
|
}];
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
files_changed: parsed.files_changed || [],
|
|
126
|
-
tests_passed: parsed.tests_passed ?? false,
|
|
127
|
-
confidence: parsed.confidence || 'low',
|
|
128
|
-
costUsd: result.costUsd,
|
|
129
|
-
durationMs: result.durationMs,
|
|
130
|
-
},
|
|
131
|
-
tags: [parsed.confidence || 'low', parsed.tests_passed ? 'tests-pass' : 'tests-fail'],
|
|
132
|
-
}];
|
|
133
|
-
},
|
|
134
|
-
autoWithdraw: true,
|
|
135
|
-
}))
|
|
136
|
-
.concurrency(concurrency)
|
|
137
|
-
.claim('lease', claimLeaseDuration)
|
|
138
|
-
.poll(3000)
|
|
139
|
-
.build();
|
|
140
|
-
return def;
|
|
141
|
+
},
|
|
142
|
+
autoWithdraw: true,
|
|
143
|
+
}))
|
|
144
|
+
.concurrency(concurrency)
|
|
145
|
+
.claim('lease', claimLeaseDuration)
|
|
146
|
+
.poll(3000);
|
|
147
|
+
};
|
|
141
148
|
}
|
|
142
149
|
/**
|
|
143
150
|
* Extracts JSON result from the agent's markdown-formatted output.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixer.js","sourceRoot":"","sources":["../../../examples/repo-maintenance/fixer.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,sEAAsE;
|
|
1
|
+
{"version":3,"file":"fixer.js","sourceRoot":"","sources":["../../../examples/repo-maintenance/fixer.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,sEAAsE;AAKtE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;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ment;
|
|
4
|
-
colonies: import("../../src/index.js").ColonyDefinition<Record<string, unknown>>[];
|
|
5
|
-
dashboard: {
|
|
6
|
-
port: number;
|
|
7
|
-
open: boolean;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
1
|
+
export {};
|
|
11
2
|
//# sourceMappingURL=mandible.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mandible.config.d.ts","sourceRoot":"","sources":["../../../examples/repo-maintenance/mandible.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mandible.config.d.ts","sourceRoot":"","sources":["../../../examples/repo-maintenance/mandible.config.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
// PURPOSE:
|
|
2
|
-
// PURPOSE: Run: npx tsx
|
|
1
|
+
// PURPOSE: Repo-maintenance example — Scout + Fixer colonies.
|
|
2
|
+
// PURPOSE: Run: npx tsx examples/repo-maintenance/mandible.config.ts
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import { rm, mkdir } from 'node:fs/promises';
|
|
5
|
+
import { mandible } from '../../src/dsl/mandible.js';
|
|
5
6
|
import { FilesystemEnvironment } from '../../src/environments/filesystem/index.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { configureScout } from './scout.js';
|
|
8
|
+
import { configureFixer } from './fixer.js';
|
|
8
9
|
const ENV_ROOT = resolve('/tmp/mandible-repo-maintenance');
|
|
9
10
|
const TARGET_REPO = resolve(process.env.TARGET_REPO ?? process.cwd());
|
|
10
11
|
// Clean slate on startup
|
|
11
12
|
await rm(ENV_ROOT, { recursive: true, force: true });
|
|
12
13
|
await mkdir(ENV_ROOT, { recursive: true });
|
|
13
14
|
const env = new FilesystemEnvironment({ root: ENV_ROOT, name: 'repo-maintenance' });
|
|
14
|
-
// ──
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
// ── Start colonies via mandible DSL ───────────────────────
|
|
16
|
+
const host = await mandible('repo-maintenance')
|
|
17
|
+
.environment(env)
|
|
18
|
+
.colony('scout', configureScout(TARGET_REPO))
|
|
19
|
+
.colony('fixer', configureFixer(TARGET_REPO))
|
|
20
|
+
.start();
|
|
21
|
+
console.log(`Started ${host.colonies.length} colonies (id: ${host.metadata.id})`);
|
|
22
|
+
// ── Seed scan trigger after a short delay ─────────────────
|
|
18
23
|
setTimeout(async () => {
|
|
19
24
|
await env.deposit({
|
|
20
25
|
type: 'scan:trigger',
|
|
@@ -25,10 +30,5 @@ setTimeout(async () => {
|
|
|
25
30
|
meta: { deposited_by: 'seed', ttl: 10 * 60_000 },
|
|
26
31
|
});
|
|
27
32
|
}, 2000);
|
|
28
|
-
|
|
29
|
-
export default {
|
|
30
|
-
environment: env,
|
|
31
|
-
colonies: [scout, fixer],
|
|
32
|
-
dashboard: { port: 4040, open: true },
|
|
33
|
-
};
|
|
33
|
+
await host.dashboard({ port: 4040 });
|
|
34
34
|
//# sourceMappingURL=mandible.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mandible.config.js","sourceRoot":"","sources":["../../../examples/repo-maintenance/mandible.config.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"mandible.config.js","sourceRoot":"","sources":["../../../examples/repo-maintenance/mandible.config.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,qEAAqE;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,QAAQ,GAAG,OAA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
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Environment } from '../../src/core/types.js';
|
|
2
1
|
import type { BedrockConfig } from '../../src/providers/types.js';
|
|
2
|
+
import type { ColonyBuilder } from '../../src/dsl/builder.js';
|
|
3
3
|
export interface ScanTriggerPayload {
|
|
4
4
|
scope: 'full' | 'incremental';
|
|
5
5
|
triggered_by: string;
|
|
@@ -15,8 +15,6 @@ export interface IssueDetectedPayload {
|
|
|
15
15
|
export interface ScoutColonyOptions {
|
|
16
16
|
/** Signal types to sense. Defaults to ['scan:trigger']. */
|
|
17
17
|
senseTypes?: string | string[];
|
|
18
|
-
/** Colony name. Defaults to 'scout'. */
|
|
19
|
-
name?: string;
|
|
20
18
|
/** Model to use. Defaults to 'claude-sonnet-4-5-20250929'. */
|
|
21
19
|
model?: string;
|
|
22
20
|
/** Max budget per scan in USD. Defaults to 0.50. */
|
|
@@ -30,7 +28,16 @@ export interface ScoutColonyOptions {
|
|
|
30
28
|
/** Route through AWS Bedrock instead of direct Anthropic API. */
|
|
31
29
|
bedrock?: BedrockConfig;
|
|
32
30
|
}
|
|
33
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Returns a colony configurator for use with the mandible() DSL.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* await mandible('repo-maintenance')
|
|
36
|
+
* .environment(env)
|
|
37
|
+
* .colony('scout', configureScout(repoRoot))
|
|
38
|
+
* .start();
|
|
39
|
+
*/
|
|
40
|
+
export declare function configureScout(repoRoot: string, options?: ScoutColonyOptions): (c: ColonyBuilder) => ColonyBuilder<Record<string, unknown>>;
|
|
34
41
|
/**
|
|
35
42
|
* Extracts JSON issue array from the agent's markdown-formatted output.
|
|
36
43
|
* Looks for a ```json code block, parses it, and validates the shape.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scout.d.ts","sourceRoot":"","sources":["../../../examples/repo-maintenance/scout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scout.d.ts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