opencode-swarm 7.5.1 → 7.5.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/dist/agents/critic.d.ts +13 -0
- package/dist/background/event-bus.d.ts +8 -0
- package/dist/background/manager.d.ts +9 -0
- package/dist/build/discovery.d.ts +7 -0
- package/dist/cli/index.js +931 -430
- package/dist/commands/registry.d.ts +16 -0
- package/dist/config/index.d.ts +13 -0
- package/dist/config/schema.d.ts +10 -0
- package/dist/db/qa-gate-profile.d.ts +13 -0
- package/dist/evidence/manager.d.ts +14 -0
- package/dist/git/branch.d.ts +19 -0
- package/dist/hooks/curator-drift.d.ts +6 -0
- package/dist/hooks/curator.d.ts +13 -0
- package/dist/hooks/extractors.d.ts +11 -0
- package/dist/hooks/knowledge-curator.d.ts +6 -0
- package/dist/hooks/knowledge-migrator.d.ts +52 -1
- package/dist/hooks/knowledge-reader.d.ts +4 -0
- package/dist/hooks/knowledge-store.d.ts +21 -0
- package/dist/hooks/knowledge-validator.d.ts +6 -0
- package/dist/hooks/utils.d.ts +14 -0
- package/dist/index.js +958 -567
- package/dist/lang/detector.d.ts +4 -0
- package/dist/lang/index.d.ts +3 -2
- package/dist/lang/registry.d.ts +6 -0
- package/dist/mutation/engine.d.ts +5 -0
- package/dist/mutation/equivalence.d.ts +5 -0
- package/dist/mutation/gate.d.ts +8 -0
- package/dist/parallel/file-locks.d.ts +15 -0
- package/dist/plan/checkpoint.d.ts +4 -0
- package/dist/plan/ledger.d.ts +36 -0
- package/dist/plan/manager.d.ts +13 -0
- package/dist/sast/rules/index.d.ts +14 -0
- package/dist/sast/semgrep.d.ts +8 -0
- package/dist/services/evidence-summary-service.d.ts +51 -1
- package/dist/services/handoff-service.d.ts +68 -0
- package/dist/services/preflight-service.d.ts +67 -0
- package/dist/services/run-memory.d.ts +22 -0
- package/dist/session/snapshot-writer.d.ts +9 -0
- package/dist/state.d.ts +26 -0
- package/dist/telemetry.d.ts +12 -0
- package/dist/test-impact/analyzer.d.ts +20 -0
- package/dist/tools/co-change-analyzer.d.ts +12 -0
- package/dist/tools/knowledge-recall.d.ts +7 -0
- package/dist/tools/lint.d.ts +10 -0
- package/dist/tools/quality-budget.d.ts +7 -0
- package/dist/tools/sast-baseline.d.ts +10 -0
- package/dist/tools/sast-scan.d.ts +8 -0
- package/dist/tools/secretscan.d.ts +8 -0
- package/dist/tools/write-retro.d.ts +9 -0
- package/dist/utils/logger.d.ts +12 -0
- package/dist/utils/path-security.d.ts +10 -0
- package/dist/utils/spec-hash.d.ts +8 -0
- package/package.json +2 -2
package/dist/lang/detector.d.ts
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
* No tool logic — pure detection only.
|
|
7
7
|
*/
|
|
8
8
|
import { type LanguageProfile } from './profiles.js';
|
|
9
|
+
export declare const _internals: {
|
|
10
|
+
getProfileForFile: typeof getProfileForFile;
|
|
11
|
+
detectProjectLanguages: typeof detectProjectLanguages;
|
|
12
|
+
};
|
|
9
13
|
/**
|
|
10
14
|
* Resolve a language profile from a file path based on its extension.
|
|
11
15
|
* Returns undefined for files with no extension or unknown extensions.
|
package/dist/lang/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { _internals as detectorInternals, detectProjectLanguages, getProfileForFile, } from './detector';
|
|
2
2
|
export * from './profiles';
|
|
3
|
-
export
|
|
3
|
+
export type { LanguageDefinition } from './registry';
|
|
4
|
+
export { _internals as registryInternals, getLanguageForExtension, getParserForFile, isSupportedFile, languageDefinitions, listSupportedLanguages, } from './registry';
|
|
4
5
|
export * from './runtime';
|
package/dist/lang/registry.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { type Parser } from './runtime';
|
|
2
|
+
export declare const _internals: {
|
|
3
|
+
getLanguageForExtension: typeof getLanguageForExtension;
|
|
4
|
+
listSupportedLanguages: typeof listSupportedLanguages;
|
|
5
|
+
getParserForFile: typeof getParserForFile;
|
|
6
|
+
isSupportedFile: typeof isSupportedFile;
|
|
7
|
+
};
|
|
2
8
|
export interface LanguageDefinition {
|
|
3
9
|
id: string;
|
|
4
10
|
extensions: string[];
|
|
@@ -42,6 +42,11 @@ export interface MutationReport {
|
|
|
42
42
|
timestamp: string;
|
|
43
43
|
}
|
|
44
44
|
export declare const MAX_MUTATIONS_PER_FUNCTION = 10;
|
|
45
|
+
export declare const _internals: {
|
|
46
|
+
executeMutation: typeof executeMutation;
|
|
47
|
+
computeReport: typeof computeReport;
|
|
48
|
+
executeMutationSuite: typeof executeMutationSuite;
|
|
49
|
+
};
|
|
45
50
|
export declare function executeMutation(patch: MutationPatch, testCommand: string[], _testFiles: string[], workingDir: string): Promise<MutationResult>;
|
|
46
51
|
export declare function computeReport(results: MutationResult[], durationMs: number, budgetMs?: number): MutationReport;
|
|
47
52
|
export declare function executeMutationSuite(patches: MutationPatch[], testCommand: string[], testFiles: string[], workingDir: string, budgetMs?: number, onProgress?: (completed: number, total: number, result: MutationResult) => void, sourceFiles?: Map<string, string>): Promise<MutationReport>;
|
|
@@ -19,6 +19,11 @@ export type LLMJudgeCallback = (original: string, mutated: string, context: stri
|
|
|
19
19
|
* trailing whitespace, and blank lines. Returns true if the stripped versions are identical.
|
|
20
20
|
*/
|
|
21
21
|
export declare function isStaticallyEquivalent(originalCode: string, mutatedCode: string): boolean;
|
|
22
|
+
export declare const _internals: {
|
|
23
|
+
isStaticallyEquivalent: typeof isStaticallyEquivalent;
|
|
24
|
+
checkEquivalence: typeof checkEquivalence;
|
|
25
|
+
batchCheckEquivalence: typeof batchCheckEquivalence;
|
|
26
|
+
};
|
|
22
27
|
/**
|
|
23
28
|
* Check a single mutant for equivalence using two-stage approach.
|
|
24
29
|
* Stage 1: static analysis. Stage 2: LLM judge (if provided and Stage 1 didn't determine equivalence).
|
package/dist/mutation/gate.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export interface MutationGateResult {
|
|
|
15
15
|
/** Prompt for targeted test improvement (non-empty when verdict is 'warn' or 'fail') */
|
|
16
16
|
testImprovementPrompt: string;
|
|
17
17
|
}
|
|
18
|
+
export declare const _internals: {
|
|
19
|
+
evaluateMutationGate: typeof evaluateMutationGate;
|
|
20
|
+
buildTestImprovementPrompt: typeof buildTestImprovementPrompt;
|
|
21
|
+
buildMessage: typeof buildMessage;
|
|
22
|
+
};
|
|
18
23
|
/** Default thresholds */
|
|
19
24
|
export declare const PASS_THRESHOLD = 0.8;
|
|
20
25
|
export declare const WARN_THRESHOLD = 0.6;
|
|
@@ -26,3 +31,6 @@ export declare const WARN_THRESHOLD = 0.6;
|
|
|
26
31
|
* @returns MutationGateResult with verdict and details
|
|
27
32
|
*/
|
|
28
33
|
export declare function evaluateMutationGate(report: MutationReport, passThreshold?: number, warnThreshold?: number): MutationGateResult;
|
|
34
|
+
declare function buildTestImprovementPrompt(report: MutationReport, passThreshold: number, verdict: MutationGateVerdict): string;
|
|
35
|
+
declare function buildMessage(verdict: MutationGateVerdict, adjustedKillRate: number, killed: number, totalMutants: number, equivalent: number, warnThreshold: number): string;
|
|
36
|
+
export {};
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test-only dependency-injection seam. Tests replace the function on this
|
|
3
|
+
* object so they can inject mock behaviour without touching the real
|
|
4
|
+
* `proper-lockfile` module — `mock.module` from `bun:test` leaks across
|
|
5
|
+
* files in Bun's shared test-runner process, which would corrupt
|
|
6
|
+
* unrelated suites. Mutating this local object is file-scoped and
|
|
7
|
+
* trivially restorable via `afterEach`.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: Production code does NOT call through this seam internally.
|
|
10
|
+
* `_internals` exists solely to allow test code to intercept lock
|
|
11
|
+
* acquisition without patching the real implementation.
|
|
12
|
+
*/
|
|
13
|
+
export declare const _internals: {
|
|
14
|
+
tryAcquireLock: typeof tryAcquireLock;
|
|
15
|
+
};
|
|
1
16
|
export interface FileLock {
|
|
2
17
|
filePath: string;
|
|
3
18
|
agent: string;
|
|
@@ -23,3 +23,7 @@ export interface ImportCheckpointResult {
|
|
|
23
23
|
* @returns ImportCheckpointResult indicating success or failure with error message
|
|
24
24
|
*/
|
|
25
25
|
export declare function importCheckpoint(directory: string, source?: string): Promise<ImportCheckpointResult>;
|
|
26
|
+
export declare const _internals: {
|
|
27
|
+
writeCheckpoint: typeof writeCheckpoint;
|
|
28
|
+
importCheckpoint: typeof importCheckpoint;
|
|
29
|
+
};
|
package/dist/plan/ledger.d.ts
CHANGED
|
@@ -65,6 +65,14 @@ export interface SnapshotEventPayload {
|
|
|
65
65
|
export declare class LedgerStaleWriterError extends Error {
|
|
66
66
|
constructor(message: string);
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Get the path to the ledger file
|
|
70
|
+
*/
|
|
71
|
+
declare function getLedgerPath(directory: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Get the path to plan.json
|
|
74
|
+
*/
|
|
75
|
+
declare function getPlanJsonPath(directory: string): string;
|
|
68
76
|
/**
|
|
69
77
|
* Compute a SHA-256 hash of the plan state.
|
|
70
78
|
* Uses deterministic JSON serialization for consistent hashing.
|
|
@@ -207,6 +215,15 @@ interface ReplayOptions {
|
|
|
207
215
|
* @returns Reconstructed Plan from ledger events, or null if plan.json doesn't exist or ledger is empty
|
|
208
216
|
*/
|
|
209
217
|
export declare function replayFromLedger(directory: string, _options?: ReplayOptions): Promise<Plan | null>;
|
|
218
|
+
/**
|
|
219
|
+
* Apply a single ledger event to the plan state.
|
|
220
|
+
* Returns null if the event indicates a full reset (plan_reset).
|
|
221
|
+
*
|
|
222
|
+
* @param plan - Current plan state
|
|
223
|
+
* @param event - Event to apply
|
|
224
|
+
* @returns Updated plan state, or null if plan should be reset
|
|
225
|
+
*/
|
|
226
|
+
declare function applyEventToPlan(plan: Plan, event: LedgerEvent): Plan | null;
|
|
210
227
|
/**
|
|
211
228
|
* Result type for readLedgerEventsWithIntegrity
|
|
212
229
|
*/
|
|
@@ -283,4 +300,23 @@ export interface ApprovedSnapshotInfo {
|
|
|
283
300
|
* @returns The most recent approved snapshot info, or null if none exists
|
|
284
301
|
*/
|
|
285
302
|
export declare function loadLastApprovedPlan(directory: string, expectedPlanId?: string): Promise<ApprovedSnapshotInfo | null>;
|
|
303
|
+
export declare const _internals: {
|
|
304
|
+
computePlanHash: typeof computePlanHash;
|
|
305
|
+
computeCurrentPlanHash: typeof computeCurrentPlanHash;
|
|
306
|
+
ledgerExists: typeof ledgerExists;
|
|
307
|
+
getLatestLedgerSeq: typeof getLatestLedgerSeq;
|
|
308
|
+
readLedgerEvents: typeof readLedgerEvents;
|
|
309
|
+
initLedger: typeof initLedger;
|
|
310
|
+
appendLedgerEvent: typeof appendLedgerEvent;
|
|
311
|
+
appendLedgerEventWithRetry: typeof appendLedgerEventWithRetry;
|
|
312
|
+
takeSnapshotEvent: typeof takeSnapshotEvent;
|
|
313
|
+
replayFromLedger: typeof replayFromLedger;
|
|
314
|
+
applyEventToPlan: typeof applyEventToPlan;
|
|
315
|
+
readLedgerEventsWithIntegrity: typeof readLedgerEventsWithIntegrity;
|
|
316
|
+
quarantineLedgerSuffix: typeof quarantineLedgerSuffix;
|
|
317
|
+
replayWithIntegrity: typeof replayWithIntegrity;
|
|
318
|
+
loadLastApprovedPlan: typeof loadLastApprovedPlan;
|
|
319
|
+
getLedgerPath: typeof getLedgerPath;
|
|
320
|
+
getPlanJsonPath: typeof getPlanJsonPath;
|
|
321
|
+
};
|
|
286
322
|
export {};
|
package/dist/plan/manager.d.ts
CHANGED
|
@@ -10,6 +10,19 @@ import { type Plan, type RuntimePlan, type TaskStatus } from '../config/plan-sch
|
|
|
10
10
|
import { type LedgerEvent, type LedgerEventInput } from './ledger';
|
|
11
11
|
/** Reset the startup ledger check flag. For testing only. */
|
|
12
12
|
export declare function resetStartupLedgerCheck(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Test-only dependency-injection seam. Production code calls
|
|
15
|
+
* `_internals.loadPlan(...)`, `_internals.loadPlanJsonOnly(...)`, etc. so tests
|
|
16
|
+
* can replace the functions on this object without touching the real module —
|
|
17
|
+
* `mock.module` from `bun:test` leaks across files in Bun's shared test-runner
|
|
18
|
+
* process, which would corrupt unrelated suites. Mutating this local object is
|
|
19
|
+
* file-scoped and trivially restorable via `afterEach`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const _internals: {
|
|
22
|
+
loadPlan: typeof loadPlan;
|
|
23
|
+
loadPlanJsonOnly: typeof loadPlanJsonOnly;
|
|
24
|
+
regeneratePlanMarkdown: typeof regeneratePlanMarkdown;
|
|
25
|
+
};
|
|
13
26
|
/**
|
|
14
27
|
* Append a ledger event with exponential-backoff retry on stale-writer conflicts.
|
|
15
28
|
*
|
|
@@ -40,6 +40,15 @@ export interface SastFinding {
|
|
|
40
40
|
remediation?: string;
|
|
41
41
|
excerpt?: string;
|
|
42
42
|
}
|
|
43
|
+
export declare const _internals: {
|
|
44
|
+
getAllRules: typeof getAllRules;
|
|
45
|
+
getRulesForLanguage: typeof getRulesForLanguage;
|
|
46
|
+
getRuleById: typeof getRuleById;
|
|
47
|
+
findPatternMatches: typeof findPatternMatches;
|
|
48
|
+
executeRulesSync: typeof executeRulesSync;
|
|
49
|
+
executeRules: typeof executeRules;
|
|
50
|
+
getRuleStats: typeof getRuleStats;
|
|
51
|
+
};
|
|
43
52
|
/**
|
|
44
53
|
* Get all registered rules
|
|
45
54
|
*/
|
|
@@ -52,6 +61,10 @@ export declare function getRulesForLanguage(language: string): SastRule[];
|
|
|
52
61
|
* Get rule by ID
|
|
53
62
|
*/
|
|
54
63
|
export declare function getRuleById(id: string): SastRule | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Parse source code and extract matches for a given pattern
|
|
66
|
+
*/
|
|
67
|
+
declare function findPatternMatches(content: string, pattern: RegExp): SastMatch[];
|
|
55
68
|
/**
|
|
56
69
|
* Execute rules synchronously (pattern matching only)
|
|
57
70
|
* This is the primary execution method for offline SAST
|
|
@@ -70,3 +83,4 @@ export declare function getRuleStats(): {
|
|
|
70
83
|
bySeverity: Record<string, number>;
|
|
71
84
|
byLanguage: Record<string, number>;
|
|
72
85
|
};
|
|
86
|
+
export {};
|
package/dist/sast/semgrep.d.ts
CHANGED
|
@@ -33,6 +33,14 @@ export interface SemgrepResult {
|
|
|
33
33
|
/** Engine label for the findings */
|
|
34
34
|
engine: 'tier_a' | 'tier_a+tier_b';
|
|
35
35
|
}
|
|
36
|
+
export declare const _internals: {
|
|
37
|
+
isSemgrepAvailable: typeof isSemgrepAvailable;
|
|
38
|
+
checkSemgrepAvailable: typeof checkSemgrepAvailable;
|
|
39
|
+
resetSemgrepCache: typeof resetSemgrepCache;
|
|
40
|
+
runSemgrep: typeof runSemgrep;
|
|
41
|
+
getRulesDirectory: typeof getRulesDirectory;
|
|
42
|
+
hasBundledRules: typeof hasBundledRules;
|
|
43
|
+
};
|
|
36
44
|
/**
|
|
37
45
|
* Check if Semgrep CLI is available on the system
|
|
38
46
|
* Uses caching to avoid shelling out on every check
|
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
* Provides deterministic evidence aggregation per task and phase.
|
|
5
5
|
* Produces machine-readable and human-readable summary artifacts.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { Evidence, EvidenceBundle } from '../config/evidence-schema';
|
|
8
|
+
import type { Phase, PhaseStatus, Task, TaskStatus } from '../config/plan-schema';
|
|
9
|
+
/**
|
|
10
|
+
* Safely normalize evidence bundle entries to a valid array.
|
|
11
|
+
* Handles null, undefined, non-array, and invalid entry objects.
|
|
12
|
+
* Returns only valid entries with required fields.
|
|
13
|
+
*/
|
|
14
|
+
declare function normalizeBundleEntries(bundle: EvidenceBundle | null | undefined): Evidence[];
|
|
8
15
|
/** Evidence types required for task completion */
|
|
9
16
|
export declare const REQUIRED_EVIDENCE_TYPES: readonly ["review", "test"];
|
|
10
17
|
export type RequiredEvidenceType = (typeof REQUIRED_EVIDENCE_TYPES)[number];
|
|
@@ -56,6 +63,33 @@ export interface EvidenceSummaryArtifact {
|
|
|
56
63
|
overallBlockers: PhaseBlocker[];
|
|
57
64
|
summaryText: string;
|
|
58
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Get task status from plan or infer from evidence
|
|
68
|
+
*/
|
|
69
|
+
declare function getTaskStatus(task: Task | undefined, bundle: EvidenceBundle | null): TaskStatus;
|
|
70
|
+
/**
|
|
71
|
+
* Check if evidence meets completion criteria for a task
|
|
72
|
+
*/
|
|
73
|
+
declare function isEvidenceComplete(bundle: EvidenceBundle | null): {
|
|
74
|
+
isComplete: boolean;
|
|
75
|
+
missingEvidence: string[];
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Generate blockers for a task based on evidence and status
|
|
79
|
+
*/
|
|
80
|
+
declare function getTaskBlockers(task: Task | undefined, summary: ReturnType<typeof isEvidenceComplete>, status: TaskStatus): string[];
|
|
81
|
+
/**
|
|
82
|
+
* Build evidence summary for a single task
|
|
83
|
+
*/
|
|
84
|
+
declare function buildTaskSummary(directory: string, task: Task | undefined, taskId: string): Promise<TaskEvidenceSummary>;
|
|
85
|
+
/**
|
|
86
|
+
* Build evidence summary for a single phase
|
|
87
|
+
*/
|
|
88
|
+
declare function buildPhaseSummary(directory: string, phase: Phase): Promise<PhaseEvidenceSummary>;
|
|
89
|
+
/**
|
|
90
|
+
* Generate human-readable summary text
|
|
91
|
+
*/
|
|
92
|
+
declare function generateSummaryText(artifact: EvidenceSummaryArtifact): string;
|
|
59
93
|
/**
|
|
60
94
|
* Build complete evidence summary artifact
|
|
61
95
|
*
|
|
@@ -73,3 +107,19 @@ export declare function isAutoSummaryEnabled(automationConfig?: {
|
|
|
73
107
|
};
|
|
74
108
|
mode?: string;
|
|
75
109
|
}): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
112
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
113
|
+
*/
|
|
114
|
+
export declare const _internals: {
|
|
115
|
+
buildEvidenceSummary: typeof buildEvidenceSummary;
|
|
116
|
+
isAutoSummaryEnabled: typeof isAutoSummaryEnabled;
|
|
117
|
+
normalizeBundleEntries: typeof normalizeBundleEntries;
|
|
118
|
+
getTaskStatus: typeof getTaskStatus;
|
|
119
|
+
isEvidenceComplete: typeof isEvidenceComplete;
|
|
120
|
+
getTaskBlockers: typeof getTaskBlockers;
|
|
121
|
+
buildTaskSummary: typeof buildTaskSummary;
|
|
122
|
+
buildPhaseSummary: typeof buildPhaseSummary;
|
|
123
|
+
generateSummaryText: typeof generateSummaryText;
|
|
124
|
+
};
|
|
125
|
+
export {};
|
|
@@ -4,6 +4,33 @@
|
|
|
4
4
|
* Provides structured handoff data for agent transitions between swarm sessions.
|
|
5
5
|
* Reads from .swarm files to gather current state for context-efficient handoffs.
|
|
6
6
|
*/
|
|
7
|
+
import { loadPlanJsonOnly } from '../plan/manager';
|
|
8
|
+
/**
|
|
9
|
+
* Escape HTML special characters to prevent XSS attacks
|
|
10
|
+
*/
|
|
11
|
+
declare function escapeHtml(str: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Sanitize string by removing RTL override characters and truncating to max length
|
|
14
|
+
*/
|
|
15
|
+
declare function sanitizeString(str: string | null | undefined, maxLength: number): string;
|
|
16
|
+
/**
|
|
17
|
+
* Validated plan type
|
|
18
|
+
*/
|
|
19
|
+
interface ValidPlan {
|
|
20
|
+
phases: Array<{
|
|
21
|
+
id: number;
|
|
22
|
+
name: string;
|
|
23
|
+
tasks: Array<{
|
|
24
|
+
id: string;
|
|
25
|
+
status: string;
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
current_phase: number | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validate that plan.phases is a proper array with valid phase objects
|
|
32
|
+
*/
|
|
33
|
+
declare function validatePlanPhases(plan: unknown): plan is ValidPlan;
|
|
7
34
|
/**
|
|
8
35
|
* Pending QA state from agent sessions
|
|
9
36
|
*/
|
|
@@ -56,6 +83,30 @@ export interface HandoffData {
|
|
|
56
83
|
locked: boolean;
|
|
57
84
|
} | null;
|
|
58
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Extract current phase and task from plan
|
|
88
|
+
*/
|
|
89
|
+
declare function extractCurrentPhaseFromPlan(plan: Awaited<ReturnType<typeof loadPlanJsonOnly>>): {
|
|
90
|
+
currentPhase: string | null;
|
|
91
|
+
currentTask: string | null;
|
|
92
|
+
incompleteTasks: string[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Parse session state JSON
|
|
96
|
+
*/
|
|
97
|
+
declare function parseSessionState(content: string | null): {
|
|
98
|
+
activeAgent: string | null;
|
|
99
|
+
delegationState: DelegationState | null;
|
|
100
|
+
pendingQA: PendingQA | null;
|
|
101
|
+
} | null;
|
|
102
|
+
/**
|
|
103
|
+
* Extract decisions from context.md content
|
|
104
|
+
*/
|
|
105
|
+
declare function extractDecisions(content: string | null): string[];
|
|
106
|
+
/**
|
|
107
|
+
* Extract last 5 lines of Phase Metrics section from context.md
|
|
108
|
+
*/
|
|
109
|
+
declare function extractPhaseMetrics(content: string | null): string;
|
|
59
110
|
/**
|
|
60
111
|
* Get handoff data from the swarm directory.
|
|
61
112
|
* Reads session state, plan, and context to build comprehensive handoff info.
|
|
@@ -72,3 +123,20 @@ export declare function formatHandoffMarkdown(data: HandoffData): string;
|
|
|
72
123
|
* resumption instructions. Designed to be copy-pasted into a new session.
|
|
73
124
|
*/
|
|
74
125
|
export declare function formatContinuationPrompt(data: HandoffData): string;
|
|
126
|
+
/**
|
|
127
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
128
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
129
|
+
*/
|
|
130
|
+
export declare const _internals: {
|
|
131
|
+
getHandoffData: typeof getHandoffData;
|
|
132
|
+
formatHandoffMarkdown: typeof formatHandoffMarkdown;
|
|
133
|
+
formatContinuationPrompt: typeof formatContinuationPrompt;
|
|
134
|
+
escapeHtml: typeof escapeHtml;
|
|
135
|
+
sanitizeString: typeof sanitizeString;
|
|
136
|
+
validatePlanPhases: typeof validatePlanPhases;
|
|
137
|
+
extractCurrentPhaseFromPlan: typeof extractCurrentPhaseFromPlan;
|
|
138
|
+
parseSessionState: typeof parseSessionState;
|
|
139
|
+
extractDecisions: typeof extractDecisions;
|
|
140
|
+
extractPhaseMetrics: typeof extractPhaseMetrics;
|
|
141
|
+
};
|
|
142
|
+
export {};
|
|
@@ -48,6 +48,52 @@ export interface PreflightConfig {
|
|
|
48
48
|
/** Linter to use (default 'biome') */
|
|
49
49
|
linter?: 'biome' | 'eslint';
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Validate directory path to prevent path traversal attacks.
|
|
53
|
+
* Returns the normalized absolute path if valid, or throws an error.
|
|
54
|
+
*/
|
|
55
|
+
declare function validateDirectoryPath(dir: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Validate and sanitize timeout value.
|
|
58
|
+
* Returns a valid timeout within bounds, or throws an error for invalid values.
|
|
59
|
+
*/
|
|
60
|
+
declare function validateTimeout(timeoutMs: number | undefined, defaultValue: number): number;
|
|
61
|
+
/**
|
|
62
|
+
* Get package.json version from directory
|
|
63
|
+
*/
|
|
64
|
+
declare function getPackageVersion(dir: string): string | null;
|
|
65
|
+
/**
|
|
66
|
+
* Get version from CHANGELOG.md (latest version header)
|
|
67
|
+
*/
|
|
68
|
+
declare function getChangelogVersion(dir: string): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* Get version from version file (e.g., VERSION.txt, version.txt)
|
|
71
|
+
*/
|
|
72
|
+
declare function getVersionFileVersion(dir: string): string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Run version consistency check
|
|
75
|
+
*/
|
|
76
|
+
declare function runVersionCheck(dir: string, _timeoutMs: number): Promise<PreflightCheckResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Run lint check
|
|
79
|
+
*/
|
|
80
|
+
declare function runLintCheck(dir: string, linter: 'biome' | 'eslint', timeoutMs: number): Promise<PreflightCheckResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Run tests check
|
|
83
|
+
*/
|
|
84
|
+
declare function runTestsCheck(_dir: string, scope: 'all' | 'convention' | 'graph', timeoutMs: number): Promise<PreflightCheckResult>;
|
|
85
|
+
/**
|
|
86
|
+
* Run secrets check
|
|
87
|
+
*/
|
|
88
|
+
declare function runSecretsCheck(dir: string, timeoutMs: number): Promise<PreflightCheckResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Run evidence completeness check
|
|
91
|
+
*/
|
|
92
|
+
declare function runEvidenceCheck(dir: string): Promise<PreflightCheckResult>;
|
|
93
|
+
/**
|
|
94
|
+
* Run requirement coverage check
|
|
95
|
+
*/
|
|
96
|
+
declare function runRequirementCoverageCheck(dir: string, currentPhase: number): Promise<PreflightCheckResult>;
|
|
51
97
|
/**
|
|
52
98
|
* Run all preflight checks
|
|
53
99
|
*/
|
|
@@ -60,3 +106,24 @@ export declare function formatPreflightMarkdown(report: PreflightReport): string
|
|
|
60
106
|
* Handle preflight command - thin adapter for CLI
|
|
61
107
|
*/
|
|
62
108
|
export declare function handlePreflightCommand(directory: string, _args: string[]): Promise<string>;
|
|
109
|
+
/**
|
|
110
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
111
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
112
|
+
*/
|
|
113
|
+
export declare const _internals: {
|
|
114
|
+
runPreflight: typeof runPreflight;
|
|
115
|
+
formatPreflightMarkdown: typeof formatPreflightMarkdown;
|
|
116
|
+
handlePreflightCommand: typeof handlePreflightCommand;
|
|
117
|
+
validateDirectoryPath: typeof validateDirectoryPath;
|
|
118
|
+
validateTimeout: typeof validateTimeout;
|
|
119
|
+
getPackageVersion: typeof getPackageVersion;
|
|
120
|
+
getChangelogVersion: typeof getChangelogVersion;
|
|
121
|
+
getVersionFileVersion: typeof getVersionFileVersion;
|
|
122
|
+
runVersionCheck: typeof runVersionCheck;
|
|
123
|
+
runLintCheck: typeof runLintCheck;
|
|
124
|
+
runTestsCheck: typeof runTestsCheck;
|
|
125
|
+
runSecretsCheck: typeof runSecretsCheck;
|
|
126
|
+
runEvidenceCheck: typeof runEvidenceCheck;
|
|
127
|
+
runRequirementCoverageCheck: typeof runRequirementCoverageCheck;
|
|
128
|
+
};
|
|
129
|
+
export {};
|
|
@@ -57,6 +57,14 @@ export declare function getTaskHistory(directory: string, taskId: string): Promi
|
|
|
57
57
|
* @returns Array of fail/retry entries
|
|
58
58
|
*/
|
|
59
59
|
export declare function getFailures(directory: string): Promise<RunMemoryEntry[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Group entries by taskId
|
|
62
|
+
*/
|
|
63
|
+
declare function groupByTaskId(entries: RunMemoryEntry[]): Map<string, RunMemoryEntry[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Build a summary line for a single task
|
|
66
|
+
*/
|
|
67
|
+
declare function summarizeTask(taskId: string, entries: RunMemoryEntry[]): string | null;
|
|
60
68
|
/**
|
|
61
69
|
* Generate a compact summary of task failures for context injection
|
|
62
70
|
*
|
|
@@ -64,3 +72,17 @@ export declare function getFailures(directory: string): Promise<RunMemoryEntry[]
|
|
|
64
72
|
* @returns Formatted summary string (≤500 tokens) or null if no failures
|
|
65
73
|
*/
|
|
66
74
|
export declare function getRunMemorySummary(directory: string): Promise<string | null>;
|
|
75
|
+
/**
|
|
76
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
77
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
78
|
+
*/
|
|
79
|
+
export declare const _internals: {
|
|
80
|
+
generateTaskFingerprint: typeof generateTaskFingerprint;
|
|
81
|
+
recordOutcome: typeof recordOutcome;
|
|
82
|
+
getTaskHistory: typeof getTaskHistory;
|
|
83
|
+
getFailures: typeof getFailures;
|
|
84
|
+
getRunMemorySummary: typeof getRunMemorySummary;
|
|
85
|
+
groupByTaskId: typeof groupByTaskId;
|
|
86
|
+
summarizeTask: typeof summarizeTask;
|
|
87
|
+
};
|
|
88
|
+
export {};
|
|
@@ -113,3 +113,12 @@ export declare function createSnapshotWriterHook(directory: string): (input: unk
|
|
|
113
113
|
* are persisted before returning.
|
|
114
114
|
*/
|
|
115
115
|
export declare function flushPendingSnapshot(directory: string): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
118
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
119
|
+
*/
|
|
120
|
+
export declare const _internals: {
|
|
121
|
+
writeSnapshot: typeof writeSnapshot;
|
|
122
|
+
createSnapshotWriterHook: typeof createSnapshotWriterHook;
|
|
123
|
+
flushPendingSnapshot: typeof flushPendingSnapshot;
|
|
124
|
+
};
|
package/dist/state.d.ts
CHANGED
|
@@ -506,3 +506,29 @@ export declare function hasActiveFullAuto(sessionID?: string): boolean;
|
|
|
506
506
|
export declare function setSessionEnvironment(sessionId: string, profile: EnvironmentProfile): void;
|
|
507
507
|
export declare function getSessionEnvironment(sessionId: string): EnvironmentProfile | undefined;
|
|
508
508
|
export declare function ensureSessionEnvironment(sessionId: string): EnvironmentProfile;
|
|
509
|
+
/**
|
|
510
|
+
* Test-only dependency-injection seam. Production code calls
|
|
511
|
+
* `_internals.*` for key exported functions and objects so tests can replace
|
|
512
|
+
* them without using `mock.module` — `mock.module` from `bun:test` leaks
|
|
513
|
+
* across files in Bun's shared test-runner process, which would corrupt
|
|
514
|
+
* unrelated test suites. Mutating this local object is file-scoped and
|
|
515
|
+
* trivially restorable via `afterEach`.
|
|
516
|
+
*/
|
|
517
|
+
export declare const _internals: {
|
|
518
|
+
swarmState: typeof swarmState;
|
|
519
|
+
resetSwarmState: typeof resetSwarmState;
|
|
520
|
+
ensureAgentSession: typeof ensureAgentSession;
|
|
521
|
+
startAgentSession: typeof startAgentSession;
|
|
522
|
+
getAgentSession: typeof getAgentSession;
|
|
523
|
+
beginInvocation: typeof beginInvocation;
|
|
524
|
+
getActiveWindow: typeof getActiveWindow;
|
|
525
|
+
advanceTaskState: typeof advanceTaskState;
|
|
526
|
+
getTaskState: typeof getTaskState;
|
|
527
|
+
hasActiveFullAuto: typeof hasActiveFullAuto;
|
|
528
|
+
hasActiveTurboMode: typeof hasActiveTurboMode;
|
|
529
|
+
buildRehydrationCache: typeof buildRehydrationCache;
|
|
530
|
+
applyRehydrationCache: typeof applyRehydrationCache;
|
|
531
|
+
rehydrateSessionFromDisk: typeof rehydrateSessionFromDisk;
|
|
532
|
+
isCouncilGateActive: typeof isCouncilGateActive;
|
|
533
|
+
defaultRunContext: typeof defaultRunContext;
|
|
534
|
+
};
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -57,3 +57,15 @@ export declare const telemetry: {
|
|
|
57
57
|
prmEscalationTriggered(sessionId: string, pattern: string, level: number, occurrenceCount: number): void;
|
|
58
58
|
prmHardStop(sessionId: string, pattern: string, level: number, occurrenceCount: number): void;
|
|
59
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Test-only dependency-injection seam. Production code calls
|
|
62
|
+
* `_internals.telemetry` and `_internals.emit` so tests can replace the
|
|
63
|
+
* underlying implementations without using `mock.module` — `mock.module` from
|
|
64
|
+
* `bun:test` leaks across files in Bun's shared test-runner process, which
|
|
65
|
+
* would corrupt unrelated test suites. Mutating this local object is
|
|
66
|
+
* file-scoped and trivially restorable via `afterEach`.
|
|
67
|
+
*/
|
|
68
|
+
export declare const _internals: {
|
|
69
|
+
telemetry: typeof telemetry;
|
|
70
|
+
emit: typeof emit;
|
|
71
|
+
};
|
|
@@ -4,6 +4,26 @@ export interface TestImpactResult {
|
|
|
4
4
|
untestedFiles: string[];
|
|
5
5
|
impactMap: Record<string, string[]>;
|
|
6
6
|
}
|
|
7
|
+
declare function normalizePath(p: string): string;
|
|
8
|
+
declare function isCacheStale(impactMap: Record<string, string[]>, generatedAtMs: number): boolean;
|
|
9
|
+
declare function resolveRelativeImport(fromDir: string, importPath: string): string | null;
|
|
10
|
+
declare function findTestFilesSync(cwd: string): string[];
|
|
11
|
+
declare function extractImports(content: string): string[];
|
|
12
|
+
declare function buildImpactMapInternal(cwd: string): Promise<Record<string, string[]>>;
|
|
13
|
+
export declare const _internals: {
|
|
14
|
+
normalizePath: typeof normalizePath;
|
|
15
|
+
isCacheStale: typeof isCacheStale;
|
|
16
|
+
resolveRelativeImport: typeof resolveRelativeImport;
|
|
17
|
+
findTestFilesSync: typeof findTestFilesSync;
|
|
18
|
+
extractImports: typeof extractImports;
|
|
19
|
+
buildImpactMapInternal: typeof buildImpactMapInternal;
|
|
20
|
+
buildImpactMap: typeof buildImpactMap;
|
|
21
|
+
loadImpactMap: typeof loadImpactMap;
|
|
22
|
+
saveImpactMap: typeof saveImpactMap;
|
|
23
|
+
analyzeImpact: typeof analyzeImpact;
|
|
24
|
+
};
|
|
7
25
|
export declare function buildImpactMap(cwd: string): Promise<Record<string, string[]>>;
|
|
8
26
|
export declare function loadImpactMap(cwd: string): Promise<Record<string, string[]>>;
|
|
27
|
+
declare function saveImpactMap(cwd: string, impactMap: Record<string, string[]>): Promise<void>;
|
|
9
28
|
export declare function analyzeImpact(changedFiles: string[], cwd: string): Promise<TestImpactResult>;
|
|
29
|
+
export {};
|
|
@@ -43,3 +43,15 @@ export declare function darkMatterToKnowledgeEntries(pairs: CoChangeEntry[], pro
|
|
|
43
43
|
*/
|
|
44
44
|
export declare function formatDarkMatterOutput(pairs: CoChangeEntry[]): string;
|
|
45
45
|
export declare const co_change_analyzer: ReturnType<typeof tool>;
|
|
46
|
+
/**
|
|
47
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
48
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
49
|
+
*/
|
|
50
|
+
export declare const _internals: {
|
|
51
|
+
parseGitLog: typeof parseGitLog;
|
|
52
|
+
buildCoChangeMatrix: typeof buildCoChangeMatrix;
|
|
53
|
+
getStaticEdges: typeof getStaticEdges;
|
|
54
|
+
detectDarkMatter: typeof detectDarkMatter;
|
|
55
|
+
darkMatterToKnowledgeEntries: typeof darkMatterToKnowledgeEntries;
|
|
56
|
+
formatDarkMatterOutput: typeof formatDarkMatterOutput;
|
|
57
|
+
};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { createSwarmTool } from './create-tool.js';
|
|
2
2
|
export declare const knowledge_recall: ReturnType<typeof createSwarmTool>;
|
|
3
|
+
/**
|
|
4
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
5
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
6
|
+
*/
|
|
7
|
+
export declare const _internals: {
|
|
8
|
+
knowledge_recall: typeof knowledge_recall;
|
|
9
|
+
};
|
package/dist/tools/lint.d.ts
CHANGED
|
@@ -61,3 +61,13 @@ export declare function runLint(linter: SupportedLinter, mode: 'fix' | 'check',
|
|
|
61
61
|
*/
|
|
62
62
|
export declare function runAdditionalLint(linter: AdditionalLinter, mode: 'fix' | 'check', cwd: string): Promise<LintResult>;
|
|
63
63
|
export declare const lint: ReturnType<typeof tool>;
|
|
64
|
+
/**
|
|
65
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
66
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
67
|
+
*/
|
|
68
|
+
export declare const _internals: {
|
|
69
|
+
detectAvailableLinter: typeof detectAvailableLinter;
|
|
70
|
+
runLint: typeof runLint;
|
|
71
|
+
detectAdditionalLinter: typeof detectAdditionalLinter;
|
|
72
|
+
runAdditionalLint: typeof runAdditionalLint;
|
|
73
|
+
};
|
|
@@ -24,3 +24,10 @@ export interface QualityBudgetResult {
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function qualityBudget(input: QualityBudgetInput, directory: string): Promise<QualityBudgetResult>;
|
|
26
26
|
export declare const quality_budget: ReturnType<typeof tool>;
|
|
27
|
+
/**
|
|
28
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
29
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
30
|
+
*/
|
|
31
|
+
export declare const _internals: {
|
|
32
|
+
qualityBudget: typeof qualityBudget;
|
|
33
|
+
};
|
|
@@ -124,3 +124,13 @@ export declare function captureOrMergeBaseline(directory: string, phase: number,
|
|
|
124
124
|
* Returns 'invalid_schema' when the file is present but unparseable.
|
|
125
125
|
*/
|
|
126
126
|
export declare function loadBaseline(directory: string, phase: number): LoadBaselineResult;
|
|
127
|
+
/**
|
|
128
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
129
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
130
|
+
*/
|
|
131
|
+
export declare const _internals: {
|
|
132
|
+
fingerprintFinding: typeof fingerprintFinding;
|
|
133
|
+
assignOccurrenceIndices: typeof assignOccurrenceIndices;
|
|
134
|
+
captureOrMergeBaseline: typeof captureOrMergeBaseline;
|
|
135
|
+
loadBaseline: typeof loadBaseline;
|
|
136
|
+
};
|