opencode-swarm 7.5.1 → 7.5.3
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 +940 -431
- 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 +971 -570
- 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
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { AgentDefinition } from '../agents/index.js';
|
|
2
|
+
declare function levenshteinDistance(a: string, b: string): number;
|
|
3
|
+
declare function findSimilarCommands(query: string): string[];
|
|
4
|
+
declare function buildDetailedHelp(commandName: string, entry: CommandEntry): string;
|
|
2
5
|
export declare function handleHelpCommand(ctx: CommandContext): Promise<string>;
|
|
3
6
|
export type CommandContext = {
|
|
4
7
|
directory: string;
|
|
@@ -403,6 +406,18 @@ export declare function validateAliases(): {
|
|
|
403
406
|
errors: string[];
|
|
404
407
|
warnings: string[];
|
|
405
408
|
};
|
|
409
|
+
/**
|
|
410
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
411
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
412
|
+
*/
|
|
413
|
+
export declare const _internals: {
|
|
414
|
+
handleHelpCommand: typeof handleHelpCommand;
|
|
415
|
+
validateAliases: typeof validateAliases;
|
|
416
|
+
resolveCommand: typeof resolveCommand;
|
|
417
|
+
levenshteinDistance: typeof levenshteinDistance;
|
|
418
|
+
findSimilarCommands: typeof findSimilarCommands;
|
|
419
|
+
buildDetailedHelp: typeof buildDetailedHelp;
|
|
420
|
+
};
|
|
406
421
|
/**
|
|
407
422
|
* Resolves compound commands like "evidence summary" and "config doctor".
|
|
408
423
|
* Tries a two-token compound key first, then falls back to a single-token key.
|
|
@@ -414,3 +429,4 @@ export declare function resolveCommand(tokens: string[]): {
|
|
|
414
429
|
key: string;
|
|
415
430
|
warning?: string;
|
|
416
431
|
} | null;
|
|
432
|
+
export {};
|
package/dist/config/index.d.ts
CHANGED
|
@@ -3,6 +3,19 @@ export { ALL_AGENT_NAMES, ALL_SUBAGENT_NAMES, DEFAULT_MODELS, isQAAgent, isSubag
|
|
|
3
3
|
export type { ApprovalEvidence, BaseEvidence, DiffEvidence, Evidence, EvidenceBundle, EvidenceType, EvidenceVerdict, NoteEvidence, ReviewEvidence, TestEvidence, } from './evidence-schema';
|
|
4
4
|
export { ApprovalEvidenceSchema, BaseEvidenceSchema, DiffEvidenceSchema, EVIDENCE_MAX_JSON_BYTES, EVIDENCE_MAX_PATCH_BYTES, EVIDENCE_MAX_TASK_BYTES, EvidenceBundleSchema, EvidenceSchema, EvidenceTypeSchema, EvidenceVerdictSchema, NoteEvidenceSchema, ReviewEvidenceSchema, TestEvidenceSchema, } from './evidence-schema';
|
|
5
5
|
export { loadAgentPrompt, loadPluginConfig, loadPluginConfigWithMeta, loadPluginConfigWithMetaAsync, } from './loader';
|
|
6
|
+
import { loadPluginConfigWithMeta } from './loader';
|
|
7
|
+
/**
|
|
8
|
+
* Test-only dependency-injection seam — see `gitignore-warning.ts:_internals`
|
|
9
|
+
* for the rationale (`mock.module` from `bun:test` leaks across files in
|
|
10
|
+
* Bun's shared test-runner process). Mutating this local object is
|
|
11
|
+
* file-scoped and trivially restorable via `afterEach`.
|
|
12
|
+
*
|
|
13
|
+
* Note: functions are re-exported from ./loader so tests mocking index.js
|
|
14
|
+
* can substitute at this level without touching the loader module directly.
|
|
15
|
+
*/
|
|
16
|
+
export declare const _internals: {
|
|
17
|
+
loadPluginConfigWithMeta: typeof loadPluginConfigWithMeta;
|
|
18
|
+
};
|
|
6
19
|
export type { MigrationStatus, Phase, PhaseStatus, Plan, Task, TaskSize, TaskStatus, } from './plan-schema';
|
|
7
20
|
export { MigrationStatusSchema, PhaseSchema, PhaseStatusSchema, PlanSchema, TaskSchema, TaskSizeSchema, TaskStatusSchema, } from './plan-schema';
|
|
8
21
|
export type { AgentOverrideConfig, AutomationCapabilities, AutomationConfig, AutomationMode, PhaseCompleteConfig, PipelineConfig, PluginConfig, SwarmConfig, } from './schema';
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Test-only dependency-injection seam — see `gitignore-warning.ts:_internals`
|
|
4
|
+
* for the rationale (`mock.module` from `bun:test` leaks across files in
|
|
5
|
+
* Bun's shared test-runner process). Mutating this local object is
|
|
6
|
+
* file-scoped and trivially restorable via `afterEach`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const _internals: {
|
|
9
|
+
stripKnownSwarmPrefix: typeof stripKnownSwarmPrefix;
|
|
10
|
+
resolveGuardrailsConfig: typeof resolveGuardrailsConfig;
|
|
11
|
+
};
|
|
2
12
|
/**
|
|
3
13
|
* Strips known Swarm prefixes from agent names to get the canonical agent name.
|
|
4
14
|
*
|
|
@@ -6,6 +6,19 @@
|
|
|
6
6
|
* locked, row updates are rejected by a SQLite trigger and by this service.
|
|
7
7
|
* Sessions can only ratchet gates tighter (enable more), never disable them.
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Test-only dependency-injection seam — see `gitignore-warning.ts:_internals`
|
|
11
|
+
* for the rationale (`mock.module` from `bun:test` leaks across files in
|
|
12
|
+
* Bun's shared test-runner process). Mutating this local object is
|
|
13
|
+
* file-scoped and trivially restorable via `afterEach`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const _internals: {
|
|
16
|
+
getProfile: typeof getProfile;
|
|
17
|
+
getOrCreateProfile: typeof getOrCreateProfile;
|
|
18
|
+
setGates: typeof setGates;
|
|
19
|
+
getEffectiveGates: typeof getEffectiveGates;
|
|
20
|
+
computeProfileHash: typeof computeProfileHash;
|
|
21
|
+
};
|
|
9
22
|
/**
|
|
10
23
|
* QA gate flags. All ten gates are tracked explicitly.
|
|
11
24
|
*/
|
|
@@ -45,6 +45,10 @@ export declare const sanitizeTaskId: typeof _sanitizeTaskId;
|
|
|
45
45
|
* @throws Error if task ID is invalid or size limit would be exceeded
|
|
46
46
|
*/
|
|
47
47
|
export declare function saveEvidence(directory: string, taskId: string, evidence: Evidence): Promise<EvidenceBundle>;
|
|
48
|
+
/**
|
|
49
|
+
* Transform a flat retrospective object into a valid EvidenceBundle.
|
|
50
|
+
*/
|
|
51
|
+
declare function wrapFlatRetrospective(flatEntry: Record<string, unknown>, taskId: string): EvidenceBundle;
|
|
48
52
|
/**
|
|
49
53
|
* Load evidence bundle for a task.
|
|
50
54
|
* Returns a LoadEvidenceResult discriminated union.
|
|
@@ -76,3 +80,13 @@ export declare function checkRequirementCoverage(phase: number, directory: strin
|
|
|
76
80
|
* Returns array of archived (deleted) task IDs.
|
|
77
81
|
*/
|
|
78
82
|
export declare function archiveEvidence(directory: string, maxAgeDays: number, maxBundles?: number): Promise<string[]>;
|
|
83
|
+
/**
|
|
84
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
85
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
86
|
+
*/
|
|
87
|
+
export declare const _internals: {
|
|
88
|
+
wrapFlatRetrospective: typeof wrapFlatRetrospective;
|
|
89
|
+
loadEvidence: typeof loadEvidence;
|
|
90
|
+
listEvidenceTaskIds: typeof listEvidenceTaskIds;
|
|
91
|
+
};
|
|
92
|
+
export {};
|
package/dist/git/branch.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute git command safely
|
|
3
|
+
*/
|
|
4
|
+
declare function gitExec(args: string[], cwd: string): string;
|
|
1
5
|
/**
|
|
2
6
|
* Check if we're in a git repository
|
|
3
7
|
*/
|
|
@@ -57,6 +61,10 @@ export interface ResetToRemoteBranchResult {
|
|
|
57
61
|
prunedBranches: string[];
|
|
58
62
|
warnings: string[];
|
|
59
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Detect the default remote branch using multiple fallback methods
|
|
66
|
+
*/
|
|
67
|
+
declare function detectDefaultRemoteBranch(cwd: string): string | null;
|
|
60
68
|
/**
|
|
61
69
|
* Reset local branch to align with its remote counterpart.
|
|
62
70
|
* Safely handles uncommitted changes, unpushed commits, and detached HEAD states.
|
|
@@ -68,3 +76,14 @@ export interface ResetToRemoteBranchResult {
|
|
|
68
76
|
export declare function resetToRemoteBranch(cwd: string, options?: {
|
|
69
77
|
pruneBranches?: boolean;
|
|
70
78
|
}): ResetToRemoteBranchResult;
|
|
79
|
+
/**
|
|
80
|
+
* DI seam for testability. Contains all test-mocked exports.
|
|
81
|
+
* Internal calls should use _internals.fn() instead of fn() directly.
|
|
82
|
+
*/
|
|
83
|
+
export declare const _internals: {
|
|
84
|
+
gitExec: typeof gitExec;
|
|
85
|
+
detectDefaultRemoteBranch: typeof detectDefaultRemoteBranch;
|
|
86
|
+
getDefaultBaseBranch: typeof getDefaultBaseBranch;
|
|
87
|
+
resetToRemoteBranch: typeof resetToRemoteBranch;
|
|
88
|
+
};
|
|
89
|
+
export {};
|
|
@@ -11,6 +11,12 @@ export declare function readPriorDriftReports(directory: string): Promise<DriftR
|
|
|
11
11
|
* Returns the absolute path of the written file.
|
|
12
12
|
*/
|
|
13
13
|
export declare function writeDriftReport(directory: string, report: DriftReport): Promise<string>;
|
|
14
|
+
export declare const _internals: {
|
|
15
|
+
readPriorDriftReports: typeof readPriorDriftReports;
|
|
16
|
+
writeDriftReport: typeof writeDriftReport;
|
|
17
|
+
runDeterministicDriftCheck: typeof runDeterministicDriftCheck;
|
|
18
|
+
buildDriftInjectionText: typeof buildDriftInjectionText;
|
|
19
|
+
};
|
|
14
20
|
/**
|
|
15
21
|
* Deterministic drift check for the given phase.
|
|
16
22
|
* Builds a structured DriftReport from curator data, plan, spec, and prior reports.
|
package/dist/hooks/curator.d.ts
CHANGED
|
@@ -32,6 +32,14 @@ import type { KnowledgeConfig } from './knowledge-types.js';
|
|
|
32
32
|
* Used to delegate analysis to the explorer agent in CURATOR mode.
|
|
33
33
|
*/
|
|
34
34
|
export type CuratorLLMDelegate = (systemPrompt: string, userInput: string, signal?: AbortSignal) => Promise<string>;
|
|
35
|
+
export declare const _internals: {
|
|
36
|
+
parseKnowledgeRecommendations: typeof parseKnowledgeRecommendations;
|
|
37
|
+
readCuratorSummary: typeof readCuratorSummary;
|
|
38
|
+
writeCuratorSummary: typeof writeCuratorSummary;
|
|
39
|
+
filterPhaseEvents: typeof filterPhaseEvents;
|
|
40
|
+
checkPhaseCompliance: typeof checkPhaseCompliance;
|
|
41
|
+
normalizeAgentName: typeof normalizeAgentName;
|
|
42
|
+
};
|
|
35
43
|
/**
|
|
36
44
|
* Parse OBSERVATIONS section from curator LLM output.
|
|
37
45
|
* Expected format per line: "- entry <uuid> (<observable>): [text]"
|
|
@@ -52,6 +60,10 @@ export declare function readCuratorSummary(directory: string): Promise<CuratorSu
|
|
|
52
60
|
* @param summary - The curator summary to write
|
|
53
61
|
*/
|
|
54
62
|
export declare function writeCuratorSummary(directory: string, summary: CuratorSummary): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Normalize agent name by stripping common swarm prefixes.
|
|
65
|
+
*/
|
|
66
|
+
declare function normalizeAgentName(name: string): string;
|
|
55
67
|
/**
|
|
56
68
|
* Filter events from JSONL by phase or timestamp.
|
|
57
69
|
* @param eventsJsonl - Raw JSONL string of events
|
|
@@ -106,3 +118,4 @@ export declare function applyCuratorKnowledgeUpdates(directory: string, recommen
|
|
|
106
118
|
applied: number;
|
|
107
119
|
skipped: number;
|
|
108
120
|
}>;
|
|
121
|
+
export {};
|
|
@@ -51,3 +51,14 @@ export declare function extractPlanCursor(planContent: string, options?: {
|
|
|
51
51
|
maxTokens?: number;
|
|
52
52
|
lookaheadTasks?: number;
|
|
53
53
|
}): string;
|
|
54
|
+
export declare const _internals: {
|
|
55
|
+
extractCurrentPhase: typeof extractCurrentPhase;
|
|
56
|
+
extractCurrentTask: typeof extractCurrentTask;
|
|
57
|
+
extractDecisions: typeof extractDecisions;
|
|
58
|
+
extractIncompleteTasks: typeof extractIncompleteTasks;
|
|
59
|
+
extractPatterns: typeof extractPatterns;
|
|
60
|
+
extractCurrentPhaseFromPlan: typeof extractCurrentPhaseFromPlan;
|
|
61
|
+
extractCurrentTaskFromPlan: typeof extractCurrentTaskFromPlan;
|
|
62
|
+
extractIncompleteTasksFromPlan: typeof extractIncompleteTasksFromPlan;
|
|
63
|
+
extractPlanCursor: typeof extractPlanCursor;
|
|
64
|
+
};
|
|
@@ -25,3 +25,9 @@ export declare function runAutoPromotion(directory: string, config: KnowledgeCon
|
|
|
25
25
|
* Watches for writes to .swarm/plan.md and extracts lessons from the retrospective section.
|
|
26
26
|
*/
|
|
27
27
|
export declare function createKnowledgeCuratorHook(directory: string, config: KnowledgeConfig): (input: unknown, output: unknown) => Promise<void>;
|
|
28
|
+
export declare const _internals: {
|
|
29
|
+
isWriteToEvidenceFile: typeof isWriteToEvidenceFile;
|
|
30
|
+
curateAndStoreSwarm: typeof curateAndStoreSwarm;
|
|
31
|
+
runAutoPromotion: typeof runAutoPromotion;
|
|
32
|
+
createKnowledgeCuratorHook: typeof createKnowledgeCuratorHook;
|
|
33
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** One-time migration from .swarm/context.md → .swarm/knowledge.jsonl for existing projects. */
|
|
2
|
-
import type { KnowledgeConfig } from './knowledge-types.js';
|
|
2
|
+
import type { KnowledgeCategory, KnowledgeConfig } from './knowledge-types.js';
|
|
3
3
|
export interface MigrationResult {
|
|
4
4
|
migrated: boolean;
|
|
5
5
|
entriesMigrated: number;
|
|
@@ -8,4 +8,55 @@ export interface MigrationResult {
|
|
|
8
8
|
skippedReason?: 'sentinel-exists' | 'no-context-file' | 'empty-context' | 'external-sentinel-exists';
|
|
9
9
|
}
|
|
10
10
|
export declare function migrateKnowledgeToExternal(_directory: string, _config: KnowledgeConfig): Promise<MigrationResult>;
|
|
11
|
+
interface RawMigrationEntry {
|
|
12
|
+
text: string;
|
|
13
|
+
sourceSection: 'lessons-learned' | 'patterns' | 'sme-cache' | 'decisions';
|
|
14
|
+
categoryHint: KnowledgeCategory | null;
|
|
15
|
+
}
|
|
16
|
+
interface Section {
|
|
17
|
+
heading: string;
|
|
18
|
+
body: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const _internals: {
|
|
21
|
+
migrateContextToKnowledge: typeof migrateContextToKnowledge;
|
|
22
|
+
migrateKnowledgeToExternal: typeof migrateKnowledgeToExternal;
|
|
23
|
+
parseContextMd: typeof parseContextMd;
|
|
24
|
+
splitIntoSections: typeof splitIntoSections;
|
|
25
|
+
extractBullets: typeof extractBullets;
|
|
26
|
+
inferCategoryFromText: typeof inferCategoryFromText;
|
|
27
|
+
truncateLesson: typeof truncateLesson;
|
|
28
|
+
inferProjectName: typeof inferProjectName;
|
|
29
|
+
writeSentinel: typeof writeSentinel;
|
|
30
|
+
};
|
|
11
31
|
export declare function migrateContextToKnowledge(directory: string, config: KnowledgeConfig): Promise<MigrationResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Parse context.md content into raw migration entries.
|
|
34
|
+
* Extracts bullets from sections matching: lessons-learned, patterns, sme-cache, decisions.
|
|
35
|
+
*/
|
|
36
|
+
declare function parseContextMd(content: string): RawMigrationEntry[];
|
|
37
|
+
/**
|
|
38
|
+
* Split markdown content into sections based on headings (h1-h3).
|
|
39
|
+
*/
|
|
40
|
+
declare function splitIntoSections(content: string): Section[];
|
|
41
|
+
/**
|
|
42
|
+
* Extract bullet points from markdown body text.
|
|
43
|
+
* Matches lines starting with - or * followed by content.
|
|
44
|
+
*/
|
|
45
|
+
declare function extractBullets(body: string): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Infer knowledge category from text using keyword matching.
|
|
48
|
+
*/
|
|
49
|
+
declare function inferCategoryFromText(text: string): KnowledgeCategory;
|
|
50
|
+
/**
|
|
51
|
+
* Truncate lesson text to maximum 280 characters.
|
|
52
|
+
*/
|
|
53
|
+
declare function truncateLesson(text: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Infer project name from package.json or directory basename.
|
|
56
|
+
*/
|
|
57
|
+
declare function inferProjectName(directory: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Write sentinel file to track migration status.
|
|
60
|
+
*/
|
|
61
|
+
declare function writeSentinel(sentinelPath: string, migrated: number, dropped: number): Promise<void>;
|
|
62
|
+
export {};
|
|
@@ -20,3 +20,7 @@ export interface RankedEntry extends KnowledgeEntryBase {
|
|
|
20
20
|
}
|
|
21
21
|
export declare function readMergedKnowledge(directory: string, config: KnowledgeConfig, context?: ProjectContext): Promise<RankedEntry[]>;
|
|
22
22
|
export declare function updateRetrievalOutcome(directory: string, phaseInfo: string, phaseSucceeded: boolean): Promise<void>;
|
|
23
|
+
export declare const _internals: {
|
|
24
|
+
readMergedKnowledge: typeof readMergedKnowledge;
|
|
25
|
+
updateRetrievalOutcome: typeof updateRetrievalOutcome;
|
|
26
|
+
};
|
|
@@ -28,3 +28,24 @@ export declare function findNearDuplicate<T extends {
|
|
|
28
28
|
}>(candidate: string, entries: T[], threshold?: number): T | undefined;
|
|
29
29
|
export declare function computeConfidence(confirmedByCount: number, autoGenerated: boolean): number;
|
|
30
30
|
export declare function inferTags(lesson: string): string[];
|
|
31
|
+
export declare const _internals: {
|
|
32
|
+
getPlatformConfigDir: typeof getPlatformConfigDir;
|
|
33
|
+
resolveSwarmKnowledgePath: typeof resolveSwarmKnowledgePath;
|
|
34
|
+
resolveSwarmRejectedPath: typeof resolveSwarmRejectedPath;
|
|
35
|
+
resolveHiveKnowledgePath: typeof resolveHiveKnowledgePath;
|
|
36
|
+
resolveHiveRejectedPath: typeof resolveHiveRejectedPath;
|
|
37
|
+
readKnowledge: typeof readKnowledge;
|
|
38
|
+
readRejectedLessons: typeof readRejectedLessons;
|
|
39
|
+
appendKnowledge: typeof appendKnowledge;
|
|
40
|
+
rewriteKnowledge: typeof rewriteKnowledge;
|
|
41
|
+
enforceKnowledgeCap: typeof enforceKnowledgeCap;
|
|
42
|
+
sweepAgedEntries: typeof sweepAgedEntries;
|
|
43
|
+
sweepStaleTodos: typeof sweepStaleTodos;
|
|
44
|
+
appendRejectedLesson: typeof appendRejectedLesson;
|
|
45
|
+
normalize: typeof normalize;
|
|
46
|
+
wordBigrams: typeof wordBigrams;
|
|
47
|
+
jaccardBigram: typeof jaccardBigram;
|
|
48
|
+
findNearDuplicate: typeof findNearDuplicate;
|
|
49
|
+
computeConfidence: typeof computeConfidence;
|
|
50
|
+
inferTags: typeof inferTags;
|
|
51
|
+
};
|
|
@@ -27,3 +27,9 @@ export interface EntryHealthResult {
|
|
|
27
27
|
export declare function auditEntryHealth(entry: KnowledgeEntryBase): EntryHealthResult;
|
|
28
28
|
export declare function quarantineEntry(directory: string, entryId: string, reason: string, reportedBy: 'architect' | 'user' | 'auto'): Promise<void>;
|
|
29
29
|
export declare function restoreEntry(directory: string, entryId: string): Promise<void>;
|
|
30
|
+
export declare const _internals: {
|
|
31
|
+
validateLesson: typeof validateLesson;
|
|
32
|
+
auditEntryHealth: typeof auditEntryHealth;
|
|
33
|
+
quarantineEntry: typeof quarantineEntry;
|
|
34
|
+
restoreEntry: typeof restoreEntry;
|
|
35
|
+
};
|
package/dist/hooks/utils.d.ts
CHANGED
|
@@ -5,6 +5,20 @@
|
|
|
5
5
|
* including error handling, handler composition, file I/O, and
|
|
6
6
|
* token estimation for swarm-related operations.
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* Test-only dependency-injection seam. Production code calls
|
|
10
|
+
* `_internals.<fn>(...)` so tests can replace the function on this object
|
|
11
|
+
* without touching the real module — `mock.module` from `bun:test` leaks
|
|
12
|
+
* across files in Bun's shared test-runner process, which would corrupt
|
|
13
|
+
* unrelated suites. Mutating this local object is file-scoped and
|
|
14
|
+
* trivially restorable via `afterEach`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const _internals: {
|
|
17
|
+
safeHook: typeof safeHook;
|
|
18
|
+
composeHandlers: typeof composeHandlers;
|
|
19
|
+
validateSwarmPath: typeof validateSwarmPath;
|
|
20
|
+
readSwarmFileAsync: typeof readSwarmFileAsync;
|
|
21
|
+
};
|
|
8
22
|
export declare function safeHook<I, O>(fn: (input: I, output: O) => Promise<void>): (input: I, output: O) => Promise<void>;
|
|
9
23
|
export declare function composeHandlers<I, O>(...fns: Array<(input: I, output: O) => Promise<void>>): (input: I, output: O) => Promise<void>;
|
|
10
24
|
/**
|