@planu/cli 0.99.0 → 1.0.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/dist/config/license-plans.json +1 -0
- package/dist/engine/agent-orchestrator/coordinator-prompt.d.ts +3 -0
- package/dist/engine/agent-orchestrator/coordinator-prompt.d.ts.map +1 -0
- package/dist/engine/agent-orchestrator/coordinator-prompt.js +38 -0
- package/dist/engine/agent-orchestrator/coordinator-prompt.js.map +1 -0
- package/dist/engine/agent-orchestrator/execution-guide.d.ts +3 -0
- package/dist/engine/agent-orchestrator/execution-guide.d.ts.map +1 -0
- package/dist/engine/agent-orchestrator/execution-guide.js +59 -0
- package/dist/engine/agent-orchestrator/execution-guide.js.map +1 -0
- package/dist/engine/agent-orchestrator/file-partitioner.d.ts +7 -0
- package/dist/engine/agent-orchestrator/file-partitioner.d.ts.map +1 -0
- package/dist/engine/agent-orchestrator/file-partitioner.js +19 -0
- package/dist/engine/agent-orchestrator/file-partitioner.js.map +1 -0
- package/dist/engine/agent-orchestrator/index.d.ts +12 -0
- package/dist/engine/agent-orchestrator/index.d.ts.map +1 -0
- package/dist/engine/agent-orchestrator/index.js +131 -0
- package/dist/engine/agent-orchestrator/index.js.map +1 -0
- package/dist/engine/agent-orchestrator/spec-reader.d.ts +6 -0
- package/dist/engine/agent-orchestrator/spec-reader.d.ts.map +1 -0
- package/dist/engine/agent-orchestrator/spec-reader.js +20 -0
- package/dist/engine/agent-orchestrator/spec-reader.js.map +1 -0
- package/dist/engine/agent-orchestrator/specialist-prompt.d.ts +3 -0
- package/dist/engine/agent-orchestrator/specialist-prompt.d.ts.map +1 -0
- package/dist/engine/agent-orchestrator/specialist-prompt.js +56 -0
- package/dist/engine/agent-orchestrator/specialist-prompt.js.map +1 -0
- package/dist/engine/agent-orchestrator/verifier-prompt.d.ts +3 -0
- package/dist/engine/agent-orchestrator/verifier-prompt.d.ts.map +1 -0
- package/dist/engine/agent-orchestrator/verifier-prompt.js +69 -0
- package/dist/engine/agent-orchestrator/verifier-prompt.js.map +1 -0
- package/dist/engine/trial/index.d.ts +25 -0
- package/dist/engine/trial/index.d.ts.map +1 -0
- package/dist/engine/trial/index.js +125 -0
- package/dist/engine/trial/index.js.map +1 -0
- package/dist/engine/trial-engine.d.ts +2 -0
- package/dist/engine/trial-engine.d.ts.map +1 -0
- package/dist/engine/trial-engine.js +3 -0
- package/dist/engine/trial-engine.js.map +1 -0
- package/dist/engine/update-notifier.d.ts +2 -0
- package/dist/engine/update-notifier.d.ts.map +1 -1
- package/dist/engine/update-notifier.js +12 -0
- package/dist/engine/update-notifier.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/trial-store.d.ts +19 -0
- package/dist/storage/trial-store.d.ts.map +1 -0
- package/dist/storage/trial-store.js +50 -0
- package/dist/storage/trial-store.js.map +1 -0
- package/dist/tools/init-project/handler.js +1 -1
- package/dist/tools/init-project/handler.js.map +1 -1
- package/dist/tools/init-project/result-builder.d.ts +1 -1
- package/dist/tools/init-project/result-builder.d.ts.map +1 -1
- package/dist/tools/init-project/result-builder.js +10 -2
- package/dist/tools/init-project/result-builder.js.map +1 -1
- package/dist/tools/license-status.d.ts.map +1 -1
- package/dist/tools/license-status.js +20 -2
- package/dist/tools/license-status.js.map +1 -1
- package/dist/tools/orchestrate-agents-handler.d.ts +4 -0
- package/dist/tools/orchestrate-agents-handler.d.ts.map +1 -0
- package/dist/tools/orchestrate-agents-handler.js +70 -0
- package/dist/tools/orchestrate-agents-handler.js.map +1 -0
- package/dist/tools/register-spec-331-tools.d.ts +3 -0
- package/dist/tools/register-spec-331-tools.d.ts.map +1 -0
- package/dist/tools/register-spec-331-tools.js +41 -0
- package/dist/tools/register-spec-331-tools.js.map +1 -0
- package/dist/tools/register-trial-tools.d.ts +3 -0
- package/dist/tools/register-trial-tools.d.ts.map +1 -0
- package/dist/tools/register-trial-tools.js +16 -0
- package/dist/tools/register-trial-tools.js.map +1 -0
- package/dist/tools/safe-handler.d.ts +3 -0
- package/dist/tools/safe-handler.d.ts.map +1 -1
- package/dist/tools/safe-handler.js +24 -2
- package/dist/tools/safe-handler.js.map +1 -1
- package/dist/tools/status-handler.d.ts.map +1 -1
- package/dist/tools/status-handler.js +9 -2
- package/dist/tools/status-handler.js.map +1 -1
- package/dist/tools/trial-handler.d.ts +5 -0
- package/dist/tools/trial-handler.d.ts.map +1 -0
- package/dist/tools/trial-handler.js +51 -0
- package/dist/tools/trial-handler.js.map +1 -0
- package/dist/types/agent-orchestration.d.ts +54 -0
- package/dist/types/agent-orchestration.d.ts.map +1 -0
- package/dist/types/agent-orchestration.js +3 -0
- package/dist/types/agent-orchestration.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/telemetry.d.ts +1 -1
- package/dist/types/telemetry.d.ts.map +1 -1
- package/dist/types/trial.d.ts +41 -0
- package/dist/types/trial.d.ts.map +1 -0
- package/dist/types/trial.js +3 -0
- package/dist/types/trial.js.map +1 -0
- package/package.json +1 -1
- package/src/config/license-plans.json +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-prompt.d.ts","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/coordinator-prompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAEjF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAoC5E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// engine/agent-orchestrator/coordinator-prompt.ts — Build coordinator agent prompt
|
|
2
|
+
export function buildCoordinatorPrompt(input) {
|
|
3
|
+
const { spec, specContent, technicalContent, count } = input;
|
|
4
|
+
return `# Coordinator Agent — ${spec.id}: ${spec.title}
|
|
5
|
+
|
|
6
|
+
## Your Role
|
|
7
|
+
You are the **Coordinator** for implementing SPEC **${spec.id}**. Your job is to:
|
|
8
|
+
1. Read and fully understand the spec and technical design
|
|
9
|
+
2. Break the implementation into ${String(count)} parallel workstreams
|
|
10
|
+
3. Produce a detailed workstream breakdown document for the Specialist agents
|
|
11
|
+
4. Do NOT write implementation code yourself
|
|
12
|
+
|
|
13
|
+
## Model Recommendation
|
|
14
|
+
Use **claude-opus** for this planning task.
|
|
15
|
+
|
|
16
|
+
## Spec Content
|
|
17
|
+
${specContent || '(spec.md not available — use spec title and ID to reason about scope)'}
|
|
18
|
+
|
|
19
|
+
## Technical Design
|
|
20
|
+
${technicalContent || '(technical.md not available — derive workstreams from logical layers: storage, engine, tools, tests)'}
|
|
21
|
+
|
|
22
|
+
## Your Output (REQUIRED)
|
|
23
|
+
Produce a markdown document titled "## Workstream Breakdown — ${spec.id}" with:
|
|
24
|
+
- One section per Specialist (Specialist-1 through Specialist-${String(count)})
|
|
25
|
+
- Each section: file ownership list, acceptance criteria assigned, implementation notes
|
|
26
|
+
- Any shared types or interfaces that all specialists must agree on BEFORE starting
|
|
27
|
+
- Integration points where specialists must coordinate
|
|
28
|
+
|
|
29
|
+
This document will be given to each Specialist agent as their briefing.
|
|
30
|
+
|
|
31
|
+
## Success Criteria
|
|
32
|
+
- All ${String(count)} workstreams have clear, non-overlapping file ownership
|
|
33
|
+
- Every acceptance criterion is assigned to exactly one Specialist
|
|
34
|
+
- Shared interfaces are defined upfront to prevent merge conflicts
|
|
35
|
+
- Each Specialist has enough context to work autonomously
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=coordinator-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-prompt.js","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/coordinator-prompt.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAInF,MAAM,UAAU,sBAAsB,CAAC,KAA6B;IAClE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAE7D,OAAO,yBAAyB,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK;;;sDAGF,IAAI,CAAC,EAAE;;mCAE1B,MAAM,CAAC,KAAK,CAAC;;;;;;;;EAQ9C,WAAW,IAAI,uEAAuE;;;EAGtF,gBAAgB,IAAI,sGAAsG;;;gEAG5D,IAAI,CAAC,EAAE;gEACP,MAAM,CAAC,KAAK,CAAC;;;;;;;;QAQrE,MAAM,CAAC,KAAK,CAAC;;;;CAIpB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-guide.d.ts","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/execution-guide.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAgEtE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// engine/agent-orchestrator/execution-guide.ts — Generate markdown execution guide
|
|
2
|
+
export function buildExecutionGuide(input) {
|
|
3
|
+
const { spec, count, roles } = input;
|
|
4
|
+
const specialistNames = roles
|
|
5
|
+
.filter((r) => r.role === 'specialist')
|
|
6
|
+
.map((r) => `- **${r.name}** — files: ${r.files.slice(0, 3).join(', ')}${r.files.length > 3 ? '...' : ''}`)
|
|
7
|
+
.join('\n');
|
|
8
|
+
return `# Orchestration Execution Guide — ${spec.id}: ${spec.title}
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
This plan uses **3 sequential waves** with **${String(count)} parallel specialists** in Wave 2.
|
|
12
|
+
Total agents: ${String(roles.length)} (1 Coordinator + ${String(count)} Specialists + 1 Verifier)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Wave 1 — Coordinator (run first, alone)
|
|
17
|
+
Launch one Claude Code session with the **Coordinator** prompt.
|
|
18
|
+
Wait until it produces the "Workstream Breakdown" document before proceeding to Wave 2.
|
|
19
|
+
|
|
20
|
+
**When to move to Wave 2:** Coordinator has delivered the workstream breakdown with assigned files and criteria for each Specialist.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Wave 2 — Specialists (run in parallel)
|
|
25
|
+
Launch ${String(count)} Claude Code sessions simultaneously, one per Specialist:
|
|
26
|
+
|
|
27
|
+
${specialistNames}
|
|
28
|
+
|
|
29
|
+
Each Specialist works exclusively on their assigned files.
|
|
30
|
+
Wait until ALL Specialists report completion before proceeding to Wave 3.
|
|
31
|
+
|
|
32
|
+
**Tip:** Open ${String(count)} terminal windows and paste each Specialist prompt into a separate \`claude\` session.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Wave 3 — Verifier (run last, alone)
|
|
37
|
+
Launch one Claude Code session with the **Verifier** prompt.
|
|
38
|
+
The Verifier reads all changes from Wave 2 and validates every acceptance criterion.
|
|
39
|
+
|
|
40
|
+
**Done when:** Verifier reports PASS on all criteria and \`pnpm test:coverage\` passes.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Quick Reference — File Ownership
|
|
45
|
+
|
|
46
|
+
${roles
|
|
47
|
+
.filter((r) => r.role === 'specialist')
|
|
48
|
+
.map((r) => `### ${r.name}\n${r.files.length > 0 ? r.files.map((f) => ` - \`${f}\``).join('\n') : ' - (See Coordinator breakdown)'}`)
|
|
49
|
+
.join('\n\n')}
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Troubleshooting
|
|
54
|
+
- **Merge conflicts**: means two Specialists touched the same file — re-assign ownership and re-run
|
|
55
|
+
- **Type errors after merge**: run \`pnpm typecheck\` to identify the conflict
|
|
56
|
+
- **Coverage drop**: re-run the affected Specialist's tests with \`pnpm test:coverage\`
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=execution-guide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-guide.js","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/execution-guide.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAInF,MAAM,UAAU,mBAAmB,CAAC,KAA0B;IAC5D,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAErC,MAAM,eAAe,GAAG,KAAK;SAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC;SACtC,GAAG,CACF,CAAC,CAAC,EAAE,EAAE,CACJ,OAAO,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CACjG;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,qCAAqC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK;;;+CAGrB,MAAM,CAAC,KAAK,CAAC;gBAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,MAAM,CAAC,KAAK,CAAC;;;;;;;;;;;;;SAa7D,MAAM,CAAC,KAAK,CAAC;;EAEpB,eAAe;;;;;gBAKD,MAAM,CAAC,KAAK,CAAC;;;;;;;;;;;;;;EAc3B,KAAK;SACJ,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC;SACtC,GAAG,CACF,CAAC,CAAC,EAAE,EAAE,CACJ,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,iCAAiC,EAAE,CAC7H;SACA,IAAI,CAAC,MAAM,CAAC;;;;;;;;CAQd,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Partition a list of files into `count` non-overlapping groups.
|
|
3
|
+
* Uses round-robin distribution so each specialist gets a balanced share.
|
|
4
|
+
* Guarantees no file appears in more than one partition.
|
|
5
|
+
*/
|
|
6
|
+
export declare function partitionFiles(files: string[], count: number): string[][];
|
|
7
|
+
//# sourceMappingURL=file-partitioner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-partitioner.d.ts","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/file-partitioner.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAazE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// engine/agent-orchestrator/file-partitioner.ts — Partition files into non-overlapping workstreams
|
|
2
|
+
/**
|
|
3
|
+
* Partition a list of files into `count` non-overlapping groups.
|
|
4
|
+
* Uses round-robin distribution so each specialist gets a balanced share.
|
|
5
|
+
* Guarantees no file appears in more than one partition.
|
|
6
|
+
*/
|
|
7
|
+
export function partitionFiles(files, count) {
|
|
8
|
+
const partitions = Array.from({ length: count }, () => []);
|
|
9
|
+
files.forEach((file, i) => {
|
|
10
|
+
const bucket = i % count;
|
|
11
|
+
const partition = partitions[bucket];
|
|
12
|
+
/* v8 ignore next 1 */
|
|
13
|
+
if (partition !== undefined) {
|
|
14
|
+
partition.push(file);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return partitions;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=file-partitioner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-partitioner.js","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/file-partitioner.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAe,EAAE,KAAa;IAC3D,MAAM,UAAU,GAAe,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAEvE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACxB,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC;QACzB,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QACrC,sBAAsB;QACtB,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Spec } from '../../types/index.js';
|
|
2
|
+
import type { OrchestratorAgentRole, OrchestrationPlan } from '../../types/agent-orchestration.js';
|
|
3
|
+
export type { OrchestrationPlan, OrchestratorAgentRole };
|
|
4
|
+
/**
|
|
5
|
+
* Generate a declarative multi-agent orchestration plan from a spec.
|
|
6
|
+
*
|
|
7
|
+
* @param spec - Spec metadata from spec-store
|
|
8
|
+
* @param agentCount - Number of specialist agents (2–8)
|
|
9
|
+
* @param projectPath - Absolute path to the project root
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateOrchestrationPlan(spec: Spec, agentCount: number, projectPath: string): Promise<OrchestrationPlan>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAQnG,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,iBAAiB,CAAC,CAkE5B"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// engine/agent-orchestrator/index.ts — SPEC-331: Declarative Multi-Agent Orchestration
|
|
2
|
+
// Generates a structured OrchestrationPlan from an approved spec.
|
|
3
|
+
// Pure: no network calls; reads spec data already passed in by the handler.
|
|
4
|
+
import { readFileContent } from './spec-reader.js';
|
|
5
|
+
import { partitionFiles } from './file-partitioner.js';
|
|
6
|
+
import { buildCoordinatorPrompt } from './coordinator-prompt.js';
|
|
7
|
+
import { buildSpecialistPrompt } from './specialist-prompt.js';
|
|
8
|
+
import { buildVerifierPrompt } from './verifier-prompt.js';
|
|
9
|
+
import { buildExecutionGuide } from './execution-guide.js';
|
|
10
|
+
/**
|
|
11
|
+
* Generate a declarative multi-agent orchestration plan from a spec.
|
|
12
|
+
*
|
|
13
|
+
* @param spec - Spec metadata from spec-store
|
|
14
|
+
* @param agentCount - Number of specialist agents (2–8)
|
|
15
|
+
* @param projectPath - Absolute path to the project root
|
|
16
|
+
*/
|
|
17
|
+
export async function generateOrchestrationPlan(spec, agentCount, projectPath) {
|
|
18
|
+
const count = Math.max(2, Math.min(8, agentCount));
|
|
19
|
+
// Read spec markdown content (acceptance criteria, technical file list)
|
|
20
|
+
const specContent = await readFileContent(spec.specPath, projectPath);
|
|
21
|
+
const technicalContent = await readFileContent(spec.technicalPath, projectPath);
|
|
22
|
+
// Extract acceptance criteria lines from spec markdown
|
|
23
|
+
const criteria = extractCriteria(specContent);
|
|
24
|
+
// Extract file list from technical.md (or fall back to logical layers)
|
|
25
|
+
const allFiles = extractFiles(technicalContent);
|
|
26
|
+
// Partition files across N specialist workstreams (non-overlapping)
|
|
27
|
+
const workstreams = partitionFiles(allFiles, count);
|
|
28
|
+
// Build roles
|
|
29
|
+
const roles = [];
|
|
30
|
+
// Wave 1 — Coordinator
|
|
31
|
+
roles.push({
|
|
32
|
+
role: 'coordinator',
|
|
33
|
+
name: 'Coordinator',
|
|
34
|
+
files: [],
|
|
35
|
+
wave: 1,
|
|
36
|
+
prompt: buildCoordinatorPrompt({ spec, specContent, technicalContent, count }),
|
|
37
|
+
});
|
|
38
|
+
// Wave 2 — Specialists (parallel)
|
|
39
|
+
for (let i = 0; i < count; i++) {
|
|
40
|
+
const files = workstreams[i] ?? [];
|
|
41
|
+
const label = deriveLabel(files, i);
|
|
42
|
+
roles.push({
|
|
43
|
+
role: 'specialist',
|
|
44
|
+
name: `Specialist-${String(i + 1)}: ${label}`,
|
|
45
|
+
files,
|
|
46
|
+
wave: 2,
|
|
47
|
+
prompt: buildSpecialistPrompt({
|
|
48
|
+
spec,
|
|
49
|
+
specContent,
|
|
50
|
+
index: i + 1,
|
|
51
|
+
label,
|
|
52
|
+
files,
|
|
53
|
+
criteria,
|
|
54
|
+
totalSpecialists: count,
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// Wave 3 — Verifier
|
|
59
|
+
roles.push({
|
|
60
|
+
role: 'verifier',
|
|
61
|
+
name: 'Verifier',
|
|
62
|
+
files: allFiles,
|
|
63
|
+
wave: 3,
|
|
64
|
+
prompt: buildVerifierPrompt({ spec, criteria, allFiles }),
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
specId: spec.id,
|
|
68
|
+
specTitle: spec.title,
|
|
69
|
+
agentCount: count,
|
|
70
|
+
totalWaves: 3,
|
|
71
|
+
roles,
|
|
72
|
+
executionGuide: buildExecutionGuide({ spec, count, roles }),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Internal helpers
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
function extractCriteria(specContent) {
|
|
79
|
+
const lines = specContent.split('\n');
|
|
80
|
+
return lines
|
|
81
|
+
.filter((l) => /^\s*-\s*\[[ x]\]/.test(l))
|
|
82
|
+
.map((l) => l.replace(/^\s*-\s*\[[ x]\]\s*/, '').trim())
|
|
83
|
+
.filter((l) => l.length > 0);
|
|
84
|
+
}
|
|
85
|
+
function extractFiles(technicalContent) {
|
|
86
|
+
if (!technicalContent) {
|
|
87
|
+
// Fallback to logical layers when no technical.md available
|
|
88
|
+
return ['src/storage/', 'src/engine/', 'src/tools/', 'tests/'];
|
|
89
|
+
}
|
|
90
|
+
const lines = technicalContent.split('\n');
|
|
91
|
+
const files = [];
|
|
92
|
+
const filePattern = /`([^`]+\.[a-zA-Z]+)`|^\s*[-*]\s+(src\/[^\s]+|tests\/[^\s]+)/;
|
|
93
|
+
for (const line of lines) {
|
|
94
|
+
const match = filePattern.exec(line);
|
|
95
|
+
if (match) {
|
|
96
|
+
const candidate = (match[1] ?? match[2] ?? '').trim();
|
|
97
|
+
if (candidate.length > 0 && !files.includes(candidate)) {
|
|
98
|
+
files.push(candidate);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (files.length === 0) {
|
|
103
|
+
return ['src/storage/', 'src/engine/', 'src/tools/', 'tests/'];
|
|
104
|
+
}
|
|
105
|
+
return files;
|
|
106
|
+
}
|
|
107
|
+
function deriveLabel(files, index) {
|
|
108
|
+
if (files.length === 0) {
|
|
109
|
+
return `Workstream ${String(index + 1)}`;
|
|
110
|
+
}
|
|
111
|
+
// Heuristic: derive label from most common path segment
|
|
112
|
+
const segments = files.flatMap((f) => f.split('/').filter(Boolean));
|
|
113
|
+
const freq = new Map();
|
|
114
|
+
for (const seg of segments) {
|
|
115
|
+
freq.set(seg, (freq.get(seg) ?? 0) + 1);
|
|
116
|
+
}
|
|
117
|
+
// Ignore generic segments
|
|
118
|
+
const ignored = new Set(['src', 'tests', 'ts', 'js', 'index']);
|
|
119
|
+
const ranked = [...freq.entries()]
|
|
120
|
+
.filter(([k]) => !ignored.has(k) && k.length > 2)
|
|
121
|
+
.sort((a, b) => b[1] - a[1]);
|
|
122
|
+
const top = ranked[0];
|
|
123
|
+
if (top) {
|
|
124
|
+
return capitalize(top[0]);
|
|
125
|
+
}
|
|
126
|
+
return `Workstream ${String(index + 1)}`;
|
|
127
|
+
}
|
|
128
|
+
function capitalize(s) {
|
|
129
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,kEAAkE;AAClE,4EAA4E;AAI5E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAI3D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,IAAU,EACV,UAAkB,EAClB,WAAmB;IAEnB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;IAEnD,wEAAwE;IACxE,MAAM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 +1,20 @@
|
|
|
1
|
+
// engine/agent-orchestrator/spec-reader.ts — Read spec file content from disk
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* Read a spec file's content.
|
|
6
|
+
* Returns empty string if the file does not exist or the path is empty.
|
|
7
|
+
*/
|
|
8
|
+
export async function readFileContent(filePath, projectPath) {
|
|
9
|
+
if (!filePath) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
const absolute = filePath.startsWith('/') ? filePath : resolve(projectPath, filePath);
|
|
14
|
+
return await readFile(absolute, 'utf-8');
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=spec-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-reader.js","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/spec-reader.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,QAA4B,EAC5B,WAAmB;IAEnB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACtF,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialist-prompt.d.ts","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/specialist-prompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CA0D1E"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// engine/agent-orchestrator/specialist-prompt.ts — Build specialist agent prompts
|
|
2
|
+
export function buildSpecialistPrompt(input) {
|
|
3
|
+
const { spec, index, label, files, criteria, totalSpecialists } = input;
|
|
4
|
+
const fileList = files.length > 0
|
|
5
|
+
? files.map((f) => ` - \`${f}\``).join('\n')
|
|
6
|
+
: ' - (See Coordinator workstream breakdown for your assigned files)';
|
|
7
|
+
const criteriaSection = criteria.length > 0
|
|
8
|
+
? criteria.map((c) => `- [ ] ${c}`).join('\n')
|
|
9
|
+
: '- [ ] (Refer to spec.md for your assigned acceptance criteria)';
|
|
10
|
+
return `# Specialist-${String(index)} Agent: ${label} — ${spec.id}: ${spec.title}
|
|
11
|
+
|
|
12
|
+
## Your Role
|
|
13
|
+
You are **Specialist-${String(index)} (${label})** for implementing SPEC **${spec.id}**.
|
|
14
|
+
You work in parallel with ${String(totalSpecialists - 1)} other Specialist(s). Each specialist has exclusive file ownership — you must NOT modify files outside your list.
|
|
15
|
+
|
|
16
|
+
## Model Recommendation
|
|
17
|
+
Use **claude-sonnet** for implementation tasks.
|
|
18
|
+
|
|
19
|
+
## Your Exclusive File Ownership
|
|
20
|
+
${fileList}
|
|
21
|
+
|
|
22
|
+
Do NOT create or modify files outside this list. If you discover a shared dependency, coordinate with the Coordinator's workstream breakdown.
|
|
23
|
+
|
|
24
|
+
## Acceptance Criteria (full list — implement the ones in your workstream)
|
|
25
|
+
${criteriaSection}
|
|
26
|
+
|
|
27
|
+
## Spec Context
|
|
28
|
+
**ID:** ${spec.id}
|
|
29
|
+
**Title:** ${spec.title}
|
|
30
|
+
**Status:** ${spec.status}
|
|
31
|
+
**Risk:** ${spec.risk}
|
|
32
|
+
|
|
33
|
+
## Implementation Instructions
|
|
34
|
+
1. Read the Coordinator's workstream breakdown to understand your exact assigned criteria
|
|
35
|
+
2. Implement ONLY the files in your ownership list above
|
|
36
|
+
3. Write tests alongside implementation (same branch of work)
|
|
37
|
+
4. Follow existing codebase conventions: TypeScript strict mode, ES modules, explicit return types
|
|
38
|
+
5. Use \`import type\` for type-only imports
|
|
39
|
+
6. All types must be defined in \`src/types/\` (not alongside implementation)
|
|
40
|
+
7. Run \`pnpm typecheck && pnpm lint\` before finishing
|
|
41
|
+
|
|
42
|
+
## Success Criteria
|
|
43
|
+
- All acceptance criteria assigned to you are implemented and tested
|
|
44
|
+
- \`pnpm typecheck\` passes with 0 errors
|
|
45
|
+
- \`pnpm lint\` passes with 0 warnings
|
|
46
|
+
- No files modified outside your exclusive ownership list
|
|
47
|
+
- Code coverage for your files ≥ 95%
|
|
48
|
+
|
|
49
|
+
## Output When Done
|
|
50
|
+
Report back:
|
|
51
|
+
1. Files created/modified
|
|
52
|
+
2. Acceptance criteria implemented (checked off)
|
|
53
|
+
3. Any open questions or blockers for the Verifier
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=specialist-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialist-prompt.js","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/specialist-prompt.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAIlF,MAAM,UAAU,qBAAqB,CAAC,KAA4B;IAChE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAExE,MAAM,QAAQ,GACZ,KAAK,CAAC,MAAM,GAAG,CAAC;QACd,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC7C,CAAC,CAAC,oEAAoE,CAAC;IAE3E,MAAM,eAAe,GACnB,QAAQ,CAAC,MAAM,GAAG,CAAC;QACjB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9C,CAAC,CAAC,gEAAgE,CAAC;IAEvE,OAAO,gBAAgB,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK;;;uBAG3D,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,+BAA+B,IAAI,CAAC,EAAE;4BACxD,MAAM,CAAC,gBAAgB,GAAG,CAAC,CAAC;;;;;;EAMtD,QAAQ;;;;;EAKR,eAAe;;;UAGP,IAAI,CAAC,EAAE;aACJ,IAAI,CAAC,KAAK;cACT,IAAI,CAAC,MAAM;YACb,IAAI,CAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;CAuBpB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier-prompt.d.ts","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/verifier-prompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAuEtE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// engine/agent-orchestrator/verifier-prompt.ts — Build verifier agent prompt
|
|
2
|
+
export function buildVerifierPrompt(input) {
|
|
3
|
+
const { spec, criteria, allFiles } = input;
|
|
4
|
+
const criteriaList = criteria.length > 0
|
|
5
|
+
? criteria.map((c) => `- [ ] ${c}`).join('\n')
|
|
6
|
+
: '- [ ] (Read spec.md acceptance criteria section)';
|
|
7
|
+
/* v8 ignore next 3 */
|
|
8
|
+
const fileList = allFiles.length > 0
|
|
9
|
+
? allFiles.map((f) => ` - \`${f}\``).join('\n')
|
|
10
|
+
: ' - (Scan the full project for changes related to this spec)';
|
|
11
|
+
return `# Verifier Agent — ${spec.id}: ${spec.title}
|
|
12
|
+
|
|
13
|
+
## Your Role
|
|
14
|
+
You are the **Verifier** for SPEC **${spec.id}**. You run AFTER all Specialist agents have completed. Your job is to validate that EVERY acceptance criterion has been correctly implemented.
|
|
15
|
+
|
|
16
|
+
## Model Recommendation
|
|
17
|
+
Use **claude-opus** for deep validation and cross-cutting analysis.
|
|
18
|
+
|
|
19
|
+
## Spec Reference
|
|
20
|
+
**ID:** ${spec.id}
|
|
21
|
+
**Title:** ${spec.title}
|
|
22
|
+
**Status:** ${spec.status}
|
|
23
|
+
|
|
24
|
+
## All Acceptance Criteria to Verify
|
|
25
|
+
${criteriaList}
|
|
26
|
+
|
|
27
|
+
## Files to Inspect
|
|
28
|
+
${fileList}
|
|
29
|
+
|
|
30
|
+
## Verification Instructions
|
|
31
|
+
For each acceptance criterion:
|
|
32
|
+
1. Find the implementation in the codebase
|
|
33
|
+
2. Confirm the behavior matches what the criterion specifies
|
|
34
|
+
3. Check edge cases: error paths, empty inputs, boundary values
|
|
35
|
+
4. Verify tests exist and actually cover the criterion
|
|
36
|
+
5. Run \`pnpm typecheck && pnpm lint && pnpm test:coverage\` and confirm all pass
|
|
37
|
+
|
|
38
|
+
## Cross-Cutting Checks
|
|
39
|
+
- No file ownership violations (each specialist only touched their assigned files)
|
|
40
|
+
- No circular imports introduced
|
|
41
|
+
- Type definitions are in \`src/types/\` (not in engine/tools files)
|
|
42
|
+
- All public functions have explicit return types
|
|
43
|
+
- No \`any\` types introduced
|
|
44
|
+
|
|
45
|
+
## Output Report (REQUIRED)
|
|
46
|
+
Produce a Verification Report:
|
|
47
|
+
\`\`\`
|
|
48
|
+
## Verification Report — ${spec.id}
|
|
49
|
+
|
|
50
|
+
### ✅ Criteria Met
|
|
51
|
+
(list each passing criterion with file reference)
|
|
52
|
+
|
|
53
|
+
### ❌ Criteria Missing or Incorrect
|
|
54
|
+
(list each failing criterion with explanation)
|
|
55
|
+
|
|
56
|
+
### Test Coverage
|
|
57
|
+
(summarize coverage results)
|
|
58
|
+
|
|
59
|
+
### Decision: PASS / FAIL
|
|
60
|
+
(if FAIL, list exact actions needed before marking spec done)
|
|
61
|
+
\`\`\`
|
|
62
|
+
|
|
63
|
+
## Success Criteria
|
|
64
|
+
- All acceptance criteria are implemented and verifiably working
|
|
65
|
+
- \`pnpm test:coverage\` passes with coverage ≥ 95%
|
|
66
|
+
- Verification Report is produced with PASS/FAIL decision
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=verifier-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier-prompt.js","sourceRoot":"","sources":["../../../src/engine/agent-orchestrator/verifier-prompt.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAI7E,MAAM,UAAU,mBAAmB,CAAC,KAA0B;IAC5D,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE3C,MAAM,YAAY,GAChB,QAAQ,CAAC,MAAM,GAAG,CAAC;QACjB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9C,CAAC,CAAC,kDAAkD,CAAC;IAEzD,sBAAsB;IACtB,MAAM,QAAQ,GACZ,QAAQ,CAAC,MAAM,GAAG,CAAC;QACjB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAChD,CAAC,CAAC,8DAA8D,CAAC;IAErE,OAAO,sBAAsB,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK;;;sCAGf,IAAI,CAAC,EAAE;;;;;;UAMnC,IAAI,CAAC,EAAE;aACJ,IAAI,CAAC,KAAK;cACT,IAAI,CAAC,MAAM;;;EAGvB,YAAY;;;EAGZ,QAAQ;;;;;;;;;;;;;;;;;;;;2BAoBiB,IAAI,CAAC,EAAE;;;;;;;;;;;;;;;;;;;CAmBjC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TrialStatus, RequestTrialResult } from '../../types/index.js';
|
|
2
|
+
import { isTrialActive as storeIsTrialActive } from '../../storage/trial-store.js';
|
|
3
|
+
/**
|
|
4
|
+
* Generates a deterministic, anonymous installation ID from machine attributes.
|
|
5
|
+
* Uses SHA-256(hostname + platform + arch) — no personal data.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getInstallationId(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Sends a trial activation request to the Planu trial API.
|
|
10
|
+
* On success the server inserts a row in the `trials` table and returns
|
|
11
|
+
* a UUID trialKey + expiry date.
|
|
12
|
+
*/
|
|
13
|
+
export declare function requestTrial(email: string): Promise<RequestTrialResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the current trial status. Fast local read — no network call.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getTrialStatus(): Promise<TrialStatus>;
|
|
18
|
+
export { storeIsTrialActive as isTrialActive };
|
|
19
|
+
/**
|
|
20
|
+
* Validates the trial key against the server. If the server says the key is
|
|
21
|
+
* invalid or revoked, marks the trial as expired locally by clearing trialKey.
|
|
22
|
+
* Fire-and-forget — never awaited by callers.
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateTrialBackground(): Promise<void>;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/trial/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAGL,aAAa,IAAI,kBAAkB,EAEpC,MAAM,8BAA8B,CAAC;AActC;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAG1C;AAMD;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAwC7E;AAMD;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAe3D;AAMD,OAAO,EAAE,kBAAkB,IAAI,aAAa,EAAE,CAAC;AAM/C;;;;GAIG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC,CA6B7D"}
|