@promptwheel/core 0.6.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/codebase-index/index.d.ts +23 -0
- package/dist/codebase-index/index.d.ts.map +1 -0
- package/dist/codebase-index/index.js +361 -0
- package/dist/codebase-index/index.js.map +1 -0
- package/dist/codebase-index/shared.d.ts +95 -0
- package/dist/codebase-index/shared.d.ts.map +1 -0
- package/dist/codebase-index/shared.js +319 -0
- package/dist/codebase-index/shared.js.map +1 -0
- package/dist/config/defaults.d.ts +45 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +79 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/critic/shared.d.ts +49 -0
- package/dist/critic/shared.d.ts.map +1 -0
- package/dist/critic/shared.js +204 -0
- package/dist/critic/shared.js.map +1 -0
- package/dist/db/adapter.d.ts +191 -0
- package/dist/db/adapter.d.ts.map +1 -0
- package/dist/db/adapter.js +40 -0
- package/dist/db/adapter.js.map +1 -0
- package/dist/db/contract.d.ts +47 -0
- package/dist/db/contract.d.ts.map +1 -0
- package/dist/db/contract.js +258 -0
- package/dist/db/contract.js.map +1 -0
- package/dist/db/index.d.ts +6 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +7 -0
- package/dist/db/index.js.map +1 -0
- package/dist/dedup/shared.d.ts +82 -0
- package/dist/dedup/shared.d.ts.map +1 -0
- package/dist/dedup/shared.js +215 -0
- package/dist/dedup/shared.js.map +1 -0
- package/dist/exec/index.d.ts +5 -0
- package/dist/exec/index.d.ts.map +1 -0
- package/dist/exec/index.js +5 -0
- package/dist/exec/index.js.map +1 -0
- package/dist/exec/types.d.ts +64 -0
- package/dist/exec/types.d.ts.map +1 -0
- package/dist/exec/types.js +8 -0
- package/dist/exec/types.js.map +1 -0
- package/dist/formulas/shared.d.ts +42 -0
- package/dist/formulas/shared.d.ts.map +1 -0
- package/dist/formulas/shared.js +204 -0
- package/dist/formulas/shared.js.map +1 -0
- package/dist/guidelines/shared.d.ts +46 -0
- package/dist/guidelines/shared.d.ts.map +1 -0
- package/dist/guidelines/shared.js +128 -0
- package/dist/guidelines/shared.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/learnings/shared.d.ts +112 -0
- package/dist/learnings/shared.d.ts.map +1 -0
- package/dist/learnings/shared.js +402 -0
- package/dist/learnings/shared.js.map +1 -0
- package/dist/proposals/shared.d.ts +137 -0
- package/dist/proposals/shared.d.ts.map +1 -0
- package/dist/proposals/shared.js +254 -0
- package/dist/proposals/shared.js.map +1 -0
- package/dist/repos/index.d.ts +15 -0
- package/dist/repos/index.d.ts.map +1 -0
- package/dist/repos/index.js +11 -0
- package/dist/repos/index.js.map +1 -0
- package/dist/repos/projects.d.ts +41 -0
- package/dist/repos/projects.d.ts.map +1 -0
- package/dist/repos/projects.js +75 -0
- package/dist/repos/projects.js.map +1 -0
- package/dist/repos/run_steps.d.ts +152 -0
- package/dist/repos/run_steps.d.ts.map +1 -0
- package/dist/repos/run_steps.js +328 -0
- package/dist/repos/run_steps.js.map +1 -0
- package/dist/repos/runs.d.ts +92 -0
- package/dist/repos/runs.d.ts.map +1 -0
- package/dist/repos/runs.js +185 -0
- package/dist/repos/runs.js.map +1 -0
- package/dist/repos/tickets.d.ts +71 -0
- package/dist/repos/tickets.d.ts.map +1 -0
- package/dist/repos/tickets.js +158 -0
- package/dist/repos/tickets.js.map +1 -0
- package/dist/scope/shared.d.ts +67 -0
- package/dist/scope/shared.d.ts.map +1 -0
- package/dist/scope/shared.js +355 -0
- package/dist/scope/shared.js.map +1 -0
- package/dist/scout/index.d.ts +18 -0
- package/dist/scout/index.d.ts.map +1 -0
- package/dist/scout/index.js +445 -0
- package/dist/scout/index.js.map +1 -0
- package/dist/scout/kimi-runner.d.ts +21 -0
- package/dist/scout/kimi-runner.d.ts.map +1 -0
- package/dist/scout/kimi-runner.js +76 -0
- package/dist/scout/kimi-runner.js.map +1 -0
- package/dist/scout/mcp-batch-server.d.ts +37 -0
- package/dist/scout/mcp-batch-server.d.ts.map +1 -0
- package/dist/scout/mcp-batch-server.js +144 -0
- package/dist/scout/mcp-batch-server.js.map +1 -0
- package/dist/scout/openai-local-runner.d.ts +20 -0
- package/dist/scout/openai-local-runner.d.ts.map +1 -0
- package/dist/scout/openai-local-runner.js +82 -0
- package/dist/scout/openai-local-runner.js.map +1 -0
- package/dist/scout/prompt.d.ts +49 -0
- package/dist/scout/prompt.d.ts.map +1 -0
- package/dist/scout/prompt.js +153 -0
- package/dist/scout/prompt.js.map +1 -0
- package/dist/scout/runner.d.ts +101 -0
- package/dist/scout/runner.d.ts.map +1 -0
- package/dist/scout/runner.js +521 -0
- package/dist/scout/runner.js.map +1 -0
- package/dist/scout/scanner.d.ts +61 -0
- package/dist/scout/scanner.d.ts.map +1 -0
- package/dist/scout/scanner.js +315 -0
- package/dist/scout/scanner.js.map +1 -0
- package/dist/scout/types.d.ts +221 -0
- package/dist/scout/types.d.ts.map +1 -0
- package/dist/scout/types.js +44 -0
- package/dist/scout/types.js.map +1 -0
- package/dist/sectors/shared.d.ts +146 -0
- package/dist/sectors/shared.d.ts.map +1 -0
- package/dist/sectors/shared.js +408 -0
- package/dist/sectors/shared.js.map +1 -0
- package/dist/services/index.d.ts +10 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +9 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/qa.d.ts +76 -0
- package/dist/services/qa.d.ts.map +1 -0
- package/dist/services/qa.js +228 -0
- package/dist/services/qa.js.map +1 -0
- package/dist/services/scout.d.ts +164 -0
- package/dist/services/scout.d.ts.map +1 -0
- package/dist/services/scout.js +215 -0
- package/dist/services/scout.js.map +1 -0
- package/dist/spindle/shared.d.ts +14 -0
- package/dist/spindle/shared.d.ts.map +1 -0
- package/dist/spindle/shared.js +65 -0
- package/dist/spindle/shared.js.map +1 -0
- package/dist/tools/shared.d.ts +35 -0
- package/dist/tools/shared.d.ts.map +1 -0
- package/dist/tools/shared.js +247 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/trace/shared.d.ts +147 -0
- package/dist/trace/shared.d.ts.map +1 -0
- package/dist/trace/shared.js +414 -0
- package/dist/trace/shared.js.map +1 -0
- package/dist/trajectory/shared.d.ts +69 -0
- package/dist/trajectory/shared.d.ts.map +1 -0
- package/dist/trajectory/shared.js +336 -0
- package/dist/trajectory/shared.js.map +1 -0
- package/dist/utils/id.d.ts +12 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +24 -0
- package/dist/utils/id.js.map +1 -0
- package/dist/utils/id.test.d.ts +5 -0
- package/dist/utils/id.test.d.ts.map +1 -0
- package/dist/utils/id.test.js +173 -0
- package/dist/utils/id.test.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/json.d.ts +9 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +19 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/waves/shared.d.ts +106 -0
- package/dist/waves/shared.d.ts.map +1 -0
- package/dist/waves/shared.js +356 -0
- package/dist/waves/shared.js.map +1 -0
- package/package.json +126 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sector rotation shared algorithms — pure functions for staleness-based
|
|
3
|
+
* codebase scanning rotation.
|
|
4
|
+
*
|
|
5
|
+
* Flat list of scan records (one per codebase-index module). No splitting,
|
|
6
|
+
* no parent/child hierarchy, no cross-ref bumps, no SHA-1 hashing.
|
|
7
|
+
*
|
|
8
|
+
* No filesystem, git, or child_process I/O. I/O-heavy functions
|
|
9
|
+
* (loadOrBuildSectors, refreshSectors, saveSectors) stay in their
|
|
10
|
+
* respective CLI/MCP packages.
|
|
11
|
+
*/
|
|
12
|
+
export interface Sector {
|
|
13
|
+
path: string;
|
|
14
|
+
purpose: string;
|
|
15
|
+
production: boolean;
|
|
16
|
+
fileCount: number;
|
|
17
|
+
productionFileCount: number;
|
|
18
|
+
classificationConfidence: string;
|
|
19
|
+
lastScannedAt: number;
|
|
20
|
+
lastScannedCycle: number;
|
|
21
|
+
scanCount: number;
|
|
22
|
+
proposalYield: number;
|
|
23
|
+
successCount: number;
|
|
24
|
+
failureCount: number;
|
|
25
|
+
polishedAt?: number;
|
|
26
|
+
mergeCount?: number;
|
|
27
|
+
closedCount?: number;
|
|
28
|
+
categoryStats?: Record<string, {
|
|
29
|
+
success: number;
|
|
30
|
+
failure: number;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export interface SectorState {
|
|
34
|
+
version: 2;
|
|
35
|
+
builtAt: string;
|
|
36
|
+
sectors: Sector[];
|
|
37
|
+
}
|
|
38
|
+
export interface CodebaseModuleLike {
|
|
39
|
+
path: string;
|
|
40
|
+
file_count?: number;
|
|
41
|
+
production_file_count?: number;
|
|
42
|
+
purpose?: string;
|
|
43
|
+
production?: boolean;
|
|
44
|
+
classification_confidence?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CoverageMetrics {
|
|
47
|
+
scannedSectors: number;
|
|
48
|
+
totalSectors: number;
|
|
49
|
+
scannedFiles: number;
|
|
50
|
+
totalFiles: number;
|
|
51
|
+
percent: number;
|
|
52
|
+
sectorPercent: number;
|
|
53
|
+
unclassifiedSectors: number;
|
|
54
|
+
}
|
|
55
|
+
/** EMA weight for old value (new = 1 - EMA_OLD_WEIGHT). */
|
|
56
|
+
export declare const EMA_OLD_WEIGHT = 0.7;
|
|
57
|
+
/** Outcome counts are decayed every N total outcomes. */
|
|
58
|
+
export declare const OUTCOME_DECAY_INTERVAL = 20;
|
|
59
|
+
/** Outcome decay multiplier. */
|
|
60
|
+
export declare const OUTCOME_DECAY_FACTOR = 0.7;
|
|
61
|
+
/** Minimum scans before a sector can be marked polished. */
|
|
62
|
+
export declare const POLISHED_MIN_SCANS = 5;
|
|
63
|
+
/** Yield threshold below which a sector may be polished. */
|
|
64
|
+
export declare const POLISHED_YIELD_THRESHOLD = 0.3;
|
|
65
|
+
/** Temporal decay threshold in days. */
|
|
66
|
+
export declare const TEMPORAL_DECAY_DAYS = 7;
|
|
67
|
+
/** Barren yield threshold. */
|
|
68
|
+
export declare const BARREN_YIELD_THRESHOLD = 0.5;
|
|
69
|
+
/** Minimum scans before barren detection. */
|
|
70
|
+
export declare const BARREN_MIN_SCANS = 2;
|
|
71
|
+
/** Minimum failures before high-failure deprioritization. */
|
|
72
|
+
export declare const HIGH_FAILURE_MIN = 3;
|
|
73
|
+
/** Failure rate above which a sector is deprioritized. */
|
|
74
|
+
export declare const HIGH_FAILURE_RATE = 0.6;
|
|
75
|
+
/** Affinity thresholds. */
|
|
76
|
+
export declare const AFFINITY_BOOST_RATE = 0.6;
|
|
77
|
+
export declare const AFFINITY_SUPPRESS_RATE = 0.3;
|
|
78
|
+
export declare const AFFINITY_MIN_ATTEMPTS = 3;
|
|
79
|
+
/** Normalize a path: trim, forward-slash, strip leading ./ and trailing /. */
|
|
80
|
+
export declare function normalizeSectorPath(p: string): string;
|
|
81
|
+
/** Convert a sector to a glob scope pattern. */
|
|
82
|
+
export declare function sectorToScope(sector: Sector): string;
|
|
83
|
+
/** Build fresh sector list from codebase-index modules. Deduplicates by normalized path. */
|
|
84
|
+
export declare function buildSectors(modules: CodebaseModuleLike[]): Sector[];
|
|
85
|
+
/** Normalize fields on a parsed sector (for loading from JSON). */
|
|
86
|
+
export declare function normalizeSectorFields(s: Partial<Sector> & {
|
|
87
|
+
path?: string;
|
|
88
|
+
}): Sector;
|
|
89
|
+
/**
|
|
90
|
+
* Merge fresh sectors with previous state, preserving scan history.
|
|
91
|
+
* Resets polishedAt when file count changes significantly (>20%).
|
|
92
|
+
*/
|
|
93
|
+
export declare function mergeSectors(fresh: Sector[], previous: Sector[]): Sector[];
|
|
94
|
+
export declare function getSectorDifficulty(sector: Sector): 'easy' | 'moderate' | 'hard';
|
|
95
|
+
export declare function getSectorMinConfidence(sector: Sector, base: number): number;
|
|
96
|
+
/**
|
|
97
|
+
* Select the next sector to scan, rotating through them in priority order.
|
|
98
|
+
*
|
|
99
|
+
* Uses a multi-level sort tiebreaker:
|
|
100
|
+
* 0. Polished sectors last (massive deprioritization)
|
|
101
|
+
* 1. Never-scanned first
|
|
102
|
+
* 2. Cycle staleness (lower lastScannedCycle first)
|
|
103
|
+
* 3. Temporal decay (>7 days, older first)
|
|
104
|
+
* 4. Low-confidence sectors first
|
|
105
|
+
* 5. Barren deprioritization (scanCount > 2 && yield < 0.5)
|
|
106
|
+
* 6. High failure rate deprioritization
|
|
107
|
+
* 7. Higher proposalYield first
|
|
108
|
+
* 8. Higher successCount first
|
|
109
|
+
* 9. Alphabetical
|
|
110
|
+
*
|
|
111
|
+
* @param now - current timestamp in ms (defaults to Date.now()). Pass explicitly for testability.
|
|
112
|
+
*/
|
|
113
|
+
export declare function pickNextSector(state: SectorState, currentCycle: number, now?: number): {
|
|
114
|
+
sector: Sector;
|
|
115
|
+
scope: string;
|
|
116
|
+
} | null;
|
|
117
|
+
export declare function computeCoverage(state: SectorState): CoverageMetrics;
|
|
118
|
+
export declare function buildSectorSummary(state: SectorState, currentPath: string, limit?: number): string;
|
|
119
|
+
/**
|
|
120
|
+
* Record scan completion for a sector.
|
|
121
|
+
* @param now - current timestamp in ms (defaults to Date.now()). Pass explicitly for testability.
|
|
122
|
+
*/
|
|
123
|
+
export declare function recordScanResult(state: SectorState, sectorPath: string, currentCycle: number, proposalCount: number, reclassification?: {
|
|
124
|
+
production?: boolean;
|
|
125
|
+
confidence?: string;
|
|
126
|
+
}, now?: number): void;
|
|
127
|
+
export declare function recordTicketOutcome(state: SectorState, sectorPath: string, success: boolean, category?: string): void;
|
|
128
|
+
export declare function updateProposalYield(state: SectorState, sectorPath: string, acceptedCount: number): void;
|
|
129
|
+
export declare function recordMergeOutcome(state: SectorState, sectorPath: string, merged: boolean): void;
|
|
130
|
+
/**
|
|
131
|
+
* Get category affinity for a sector: which categories succeed vs fail.
|
|
132
|
+
* boost: categories with >60% success rate (min 3 attempts)
|
|
133
|
+
* suppress: categories with <30% success rate (min 3 attempts)
|
|
134
|
+
*/
|
|
135
|
+
export declare function getSectorCategoryAffinity(sector: Sector): {
|
|
136
|
+
boost: string[];
|
|
137
|
+
suppress: string[];
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Suggest scope adjustment based on sector yield distribution.
|
|
141
|
+
* narrow: top sectors have much higher yield than average (focus there)
|
|
142
|
+
* widen: all sectors barren (need fresh territory)
|
|
143
|
+
* stable: normal distribution
|
|
144
|
+
*/
|
|
145
|
+
export declare function suggestScopeAdjustment(state: SectorState): 'narrow' | 'widen' | 'stable';
|
|
146
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/sectors/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wBAAwB,EAAE,MAAM,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE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AGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,gBAAgB,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAChE,GAAG,CAAC,EAAE,MAAM,GACX,IAAI,CAgBN;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAerH;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAIvG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAQhG;AAMD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAYjG;AAMD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAexF"}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sector rotation shared algorithms — pure functions for staleness-based
|
|
3
|
+
* codebase scanning rotation.
|
|
4
|
+
*
|
|
5
|
+
* Flat list of scan records (one per codebase-index module). No splitting,
|
|
6
|
+
* no parent/child hierarchy, no cross-ref bumps, no SHA-1 hashing.
|
|
7
|
+
*
|
|
8
|
+
* No filesystem, git, or child_process I/O. I/O-heavy functions
|
|
9
|
+
* (loadOrBuildSectors, refreshSectors, saveSectors) stay in their
|
|
10
|
+
* respective CLI/MCP packages.
|
|
11
|
+
*/
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Constants
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/** EMA weight for old value (new = 1 - EMA_OLD_WEIGHT). */
|
|
16
|
+
export const EMA_OLD_WEIGHT = 0.7;
|
|
17
|
+
/** Outcome counts are decayed every N total outcomes. */
|
|
18
|
+
export const OUTCOME_DECAY_INTERVAL = 20;
|
|
19
|
+
/** Outcome decay multiplier. */
|
|
20
|
+
export const OUTCOME_DECAY_FACTOR = 0.7;
|
|
21
|
+
/** Minimum scans before a sector can be marked polished. */
|
|
22
|
+
export const POLISHED_MIN_SCANS = 5;
|
|
23
|
+
/** Yield threshold below which a sector may be polished. */
|
|
24
|
+
export const POLISHED_YIELD_THRESHOLD = 0.3;
|
|
25
|
+
/** Temporal decay threshold in days. */
|
|
26
|
+
export const TEMPORAL_DECAY_DAYS = 7;
|
|
27
|
+
/** Barren yield threshold. */
|
|
28
|
+
export const BARREN_YIELD_THRESHOLD = 0.5;
|
|
29
|
+
/** Minimum scans before barren detection. */
|
|
30
|
+
export const BARREN_MIN_SCANS = 2;
|
|
31
|
+
/** Minimum failures before high-failure deprioritization. */
|
|
32
|
+
export const HIGH_FAILURE_MIN = 3;
|
|
33
|
+
/** Failure rate above which a sector is deprioritized. */
|
|
34
|
+
export const HIGH_FAILURE_RATE = 0.6;
|
|
35
|
+
/** Affinity thresholds. */
|
|
36
|
+
export const AFFINITY_BOOST_RATE = 0.6;
|
|
37
|
+
export const AFFINITY_SUPPRESS_RATE = 0.3;
|
|
38
|
+
export const AFFINITY_MIN_ATTEMPTS = 3;
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Helpers
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
/** Normalize a path: trim, forward-slash, strip leading ./ and trailing /. */
|
|
43
|
+
export function normalizeSectorPath(p) {
|
|
44
|
+
const s = p.trim().replace(/\\/g, '/').replace(/^\.\/+/, '').replace(/\/+$/, '');
|
|
45
|
+
return s || '.';
|
|
46
|
+
}
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Scope conversion
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
/** Convert a sector to a glob scope pattern. */
|
|
51
|
+
export function sectorToScope(sector) {
|
|
52
|
+
const p = normalizeSectorPath(sector.path);
|
|
53
|
+
if (p === '.')
|
|
54
|
+
return './{*,.*}';
|
|
55
|
+
return `${p}/**`;
|
|
56
|
+
}
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Build sectors from codebase-index modules
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
/** Build fresh sector list from codebase-index modules. Deduplicates by normalized path. */
|
|
61
|
+
export function buildSectors(modules) {
|
|
62
|
+
const seen = new Set();
|
|
63
|
+
const sectors = [];
|
|
64
|
+
for (const m of modules) {
|
|
65
|
+
const p = normalizeSectorPath(m.path);
|
|
66
|
+
if (seen.has(p))
|
|
67
|
+
continue;
|
|
68
|
+
seen.add(p);
|
|
69
|
+
sectors.push({
|
|
70
|
+
path: p,
|
|
71
|
+
purpose: m.purpose ?? '',
|
|
72
|
+
production: m.production ?? true,
|
|
73
|
+
fileCount: m.file_count ?? 0,
|
|
74
|
+
productionFileCount: m.production_file_count ?? m.file_count ?? 0,
|
|
75
|
+
classificationConfidence: m.classification_confidence ?? 'low',
|
|
76
|
+
lastScannedAt: 0,
|
|
77
|
+
lastScannedCycle: 0,
|
|
78
|
+
scanCount: 0,
|
|
79
|
+
proposalYield: 0,
|
|
80
|
+
successCount: 0,
|
|
81
|
+
failureCount: 0,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return sectors;
|
|
85
|
+
}
|
|
86
|
+
/** Normalize fields on a parsed sector (for loading from JSON). */
|
|
87
|
+
export function normalizeSectorFields(s) {
|
|
88
|
+
return {
|
|
89
|
+
path: normalizeSectorPath(s.path ?? '.'),
|
|
90
|
+
purpose: s.purpose ?? '',
|
|
91
|
+
production: s.production ?? true,
|
|
92
|
+
fileCount: s.fileCount ?? 0,
|
|
93
|
+
productionFileCount: s.productionFileCount ?? s.fileCount ?? 0,
|
|
94
|
+
classificationConfidence: s.classificationConfidence ?? 'low',
|
|
95
|
+
lastScannedAt: s.lastScannedAt ?? 0,
|
|
96
|
+
lastScannedCycle: s.lastScannedCycle ?? 0,
|
|
97
|
+
scanCount: s.scanCount ?? 0,
|
|
98
|
+
proposalYield: s.proposalYield ?? 0,
|
|
99
|
+
successCount: s.successCount ?? 0,
|
|
100
|
+
failureCount: s.failureCount ?? 0,
|
|
101
|
+
polishedAt: s.polishedAt ?? 0,
|
|
102
|
+
mergeCount: s.mergeCount,
|
|
103
|
+
closedCount: s.closedCount,
|
|
104
|
+
categoryStats: s.categoryStats,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Merge fresh sectors with previous state, preserving scan history.
|
|
109
|
+
* Resets polishedAt when file count changes significantly (>20%).
|
|
110
|
+
*/
|
|
111
|
+
export function mergeSectors(fresh, previous) {
|
|
112
|
+
const prevByPath = new Map(previous.map(s => [s.path, s]));
|
|
113
|
+
return fresh.map(s => {
|
|
114
|
+
const prev = prevByPath.get(s.path);
|
|
115
|
+
if (!prev)
|
|
116
|
+
return s;
|
|
117
|
+
const fileCountChanged = prev.fileCount > 0 && Math.abs(s.fileCount - prev.fileCount) / prev.fileCount > 0.2;
|
|
118
|
+
return {
|
|
119
|
+
...s,
|
|
120
|
+
lastScannedAt: prev.lastScannedAt,
|
|
121
|
+
lastScannedCycle: prev.lastScannedCycle,
|
|
122
|
+
scanCount: prev.scanCount,
|
|
123
|
+
proposalYield: prev.proposalYield,
|
|
124
|
+
successCount: prev.successCount,
|
|
125
|
+
failureCount: prev.failureCount,
|
|
126
|
+
polishedAt: fileCountChanged ? 0 : (prev.polishedAt ?? 0),
|
|
127
|
+
mergeCount: prev.mergeCount,
|
|
128
|
+
closedCount: prev.closedCount,
|
|
129
|
+
categoryStats: prev.categoryStats,
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
// Difficulty & confidence
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
export function getSectorDifficulty(sector) {
|
|
137
|
+
const total = sector.successCount + sector.failureCount;
|
|
138
|
+
if (total < 3)
|
|
139
|
+
return 'easy';
|
|
140
|
+
const failRate = sector.failureCount / total;
|
|
141
|
+
if (failRate > HIGH_FAILURE_RATE)
|
|
142
|
+
return 'hard';
|
|
143
|
+
if (failRate > AFFINITY_SUPPRESS_RATE)
|
|
144
|
+
return 'moderate';
|
|
145
|
+
return 'easy';
|
|
146
|
+
}
|
|
147
|
+
export function getSectorMinConfidence(sector, base) {
|
|
148
|
+
const difficulty = getSectorDifficulty(sector);
|
|
149
|
+
if (difficulty === 'hard')
|
|
150
|
+
return base + 20;
|
|
151
|
+
if (difficulty === 'moderate')
|
|
152
|
+
return base + 10;
|
|
153
|
+
return base;
|
|
154
|
+
}
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
// pickNextSector — main rotation algorithm
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
/**
|
|
159
|
+
* Select the next sector to scan, rotating through them in priority order.
|
|
160
|
+
*
|
|
161
|
+
* Uses a multi-level sort tiebreaker:
|
|
162
|
+
* 0. Polished sectors last (massive deprioritization)
|
|
163
|
+
* 1. Never-scanned first
|
|
164
|
+
* 2. Cycle staleness (lower lastScannedCycle first)
|
|
165
|
+
* 3. Temporal decay (>7 days, older first)
|
|
166
|
+
* 4. Low-confidence sectors first
|
|
167
|
+
* 5. Barren deprioritization (scanCount > 2 && yield < 0.5)
|
|
168
|
+
* 6. High failure rate deprioritization
|
|
169
|
+
* 7. Higher proposalYield first
|
|
170
|
+
* 8. Higher successCount first
|
|
171
|
+
* 9. Alphabetical
|
|
172
|
+
*
|
|
173
|
+
* @param now - current timestamp in ms (defaults to Date.now()). Pass explicitly for testability.
|
|
174
|
+
*/
|
|
175
|
+
export function pickNextSector(state, currentCycle, now) {
|
|
176
|
+
if (state.sectors.length === 0)
|
|
177
|
+
return null;
|
|
178
|
+
const timestamp = now ?? Date.now();
|
|
179
|
+
const primary = state.sectors.filter(s => s.fileCount > 0 && s.production);
|
|
180
|
+
const candidates = primary.some(s => s.lastScannedAt === 0) ? primary
|
|
181
|
+
: primary.some(s => currentCycle - s.lastScannedCycle >= 2) ? primary
|
|
182
|
+
: state.sectors.filter(s => s.fileCount > 0); // include non-production as fallback
|
|
183
|
+
if (candidates.length === 0)
|
|
184
|
+
return null;
|
|
185
|
+
// Detect polished sectors: scanned many times with low yield and low success
|
|
186
|
+
for (const s of candidates) {
|
|
187
|
+
const total = s.successCount + s.failureCount;
|
|
188
|
+
const successRate = total > 0 ? s.successCount / total : 0;
|
|
189
|
+
if (s.scanCount >= POLISHED_MIN_SCANS && s.proposalYield < POLISHED_YIELD_THRESHOLD && (total < 2 || successRate < POLISHED_YIELD_THRESHOLD)) {
|
|
190
|
+
if (!s.polishedAt)
|
|
191
|
+
s.polishedAt = timestamp;
|
|
192
|
+
}
|
|
193
|
+
else if (s.polishedAt) {
|
|
194
|
+
s.polishedAt = 0;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
candidates.sort((a, b) => {
|
|
198
|
+
// 0. Polished sectors sort after everything
|
|
199
|
+
const aPolished = (a.polishedAt ?? 0) > 0 ? 1 : 0;
|
|
200
|
+
const bPolished = (b.polishedAt ?? 0) > 0 ? 1 : 0;
|
|
201
|
+
if (aPolished !== bPolished)
|
|
202
|
+
return aPolished - bPolished;
|
|
203
|
+
// 1. Never-scanned first
|
|
204
|
+
if ((a.lastScannedAt === 0) !== (b.lastScannedAt === 0))
|
|
205
|
+
return a.lastScannedAt === 0 ? -1 : 1;
|
|
206
|
+
// 2. Cycle staleness (lower lastScannedCycle first)
|
|
207
|
+
if (a.lastScannedCycle !== b.lastScannedCycle)
|
|
208
|
+
return a.lastScannedCycle - b.lastScannedCycle;
|
|
209
|
+
// 3. Temporal decay: if |daysDiff| > 7, older sector first
|
|
210
|
+
const aDays = (timestamp - a.lastScannedAt) / 86400000;
|
|
211
|
+
const bDays = (timestamp - b.lastScannedAt) / 86400000;
|
|
212
|
+
if (aDays > TEMPORAL_DECAY_DAYS && bDays > TEMPORAL_DECAY_DAYS && Math.abs(aDays - bDays) > 1) {
|
|
213
|
+
return bDays - aDays > 0 ? 1 : -1;
|
|
214
|
+
}
|
|
215
|
+
// 4. Low-confidence sectors first
|
|
216
|
+
const aLow = a.classificationConfidence === 'low' ? 1 : 0;
|
|
217
|
+
const bLow = b.classificationConfidence === 'low' ? 1 : 0;
|
|
218
|
+
if (aLow !== bLow)
|
|
219
|
+
return bLow - aLow;
|
|
220
|
+
// 5. Barren deprioritization: scanCount > 2 && proposalYield < 0.5 → sort later
|
|
221
|
+
const aBarren = a.scanCount > BARREN_MIN_SCANS && a.proposalYield < BARREN_YIELD_THRESHOLD ? 1 : 0;
|
|
222
|
+
const bBarren = b.scanCount > BARREN_MIN_SCANS && b.proposalYield < BARREN_YIELD_THRESHOLD ? 1 : 0;
|
|
223
|
+
if (aBarren !== bBarren)
|
|
224
|
+
return aBarren - bBarren;
|
|
225
|
+
// 6. High failure rate deprioritization
|
|
226
|
+
const aFail = a.failureCount >= HIGH_FAILURE_MIN && a.failureCount / (a.failureCount + a.successCount) > HIGH_FAILURE_RATE ? 1 : 0;
|
|
227
|
+
const bFail = b.failureCount >= HIGH_FAILURE_MIN && b.failureCount / (b.failureCount + b.successCount) > HIGH_FAILURE_RATE ? 1 : 0;
|
|
228
|
+
if (aFail !== bFail)
|
|
229
|
+
return aFail - bFail;
|
|
230
|
+
// 7. Higher proposalYield first
|
|
231
|
+
if (a.proposalYield !== b.proposalYield)
|
|
232
|
+
return b.proposalYield - a.proposalYield;
|
|
233
|
+
// 8. Higher successCount first (tiebreaker)
|
|
234
|
+
if (a.successCount !== b.successCount)
|
|
235
|
+
return b.successCount - a.successCount;
|
|
236
|
+
// 9. Alphabetical
|
|
237
|
+
return a.path.localeCompare(b.path);
|
|
238
|
+
});
|
|
239
|
+
const sector = candidates[0];
|
|
240
|
+
return { sector, scope: sectorToScope(sector) };
|
|
241
|
+
}
|
|
242
|
+
// ---------------------------------------------------------------------------
|
|
243
|
+
// Coverage metrics
|
|
244
|
+
// ---------------------------------------------------------------------------
|
|
245
|
+
export function computeCoverage(state) {
|
|
246
|
+
let scannedSectors = 0;
|
|
247
|
+
let totalFiles = 0;
|
|
248
|
+
let scannedFiles = 0;
|
|
249
|
+
let unclassifiedSectors = 0;
|
|
250
|
+
for (const s of state.sectors) {
|
|
251
|
+
if (!s.production)
|
|
252
|
+
continue;
|
|
253
|
+
totalFiles += s.productionFileCount;
|
|
254
|
+
if (s.scanCount > 0) {
|
|
255
|
+
scannedSectors++;
|
|
256
|
+
scannedFiles += s.productionFileCount;
|
|
257
|
+
}
|
|
258
|
+
if (s.classificationConfidence === 'low') {
|
|
259
|
+
unclassifiedSectors++;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
const totalSectors = state.sectors.filter(s => s.production).length;
|
|
263
|
+
const percent = totalFiles > 0 ? Math.round((scannedFiles / totalFiles) * 100) : 0;
|
|
264
|
+
const sectorPercent = totalSectors > 0 ? Math.round((scannedSectors / totalSectors) * 100) : 0;
|
|
265
|
+
return { scannedSectors, totalSectors, scannedFiles, totalFiles, percent, sectorPercent, unclassifiedSectors };
|
|
266
|
+
}
|
|
267
|
+
// ---------------------------------------------------------------------------
|
|
268
|
+
// Sector summary for prompt
|
|
269
|
+
// ---------------------------------------------------------------------------
|
|
270
|
+
export function buildSectorSummary(state, currentPath, limit = 5) {
|
|
271
|
+
const lines = ['### Nearby Sectors'];
|
|
272
|
+
// Recently scanned sectors (sorted by lastScannedAt desc)
|
|
273
|
+
const scanned = state.sectors
|
|
274
|
+
.filter(s => s.scanCount > 0 && s.path !== currentPath)
|
|
275
|
+
.sort((a, b) => b.lastScannedAt - a.lastScannedAt)
|
|
276
|
+
.slice(0, limit);
|
|
277
|
+
if (scanned.length > 0) {
|
|
278
|
+
lines.push('Recently scanned:');
|
|
279
|
+
for (const s of scanned) {
|
|
280
|
+
lines.push(`- \`${s.path}\` — yield: ${s.proposalYield.toFixed(1)}, scans: ${s.scanCount}`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// Top unscanned sectors (sorted by fileCount desc)
|
|
284
|
+
const unscanned = state.sectors
|
|
285
|
+
.filter(s => s.scanCount === 0 && s.fileCount > 0 && s.path !== currentPath)
|
|
286
|
+
.sort((a, b) => b.fileCount - a.fileCount)
|
|
287
|
+
.slice(0, limit);
|
|
288
|
+
if (unscanned.length > 0) {
|
|
289
|
+
lines.push('Top unscanned:');
|
|
290
|
+
for (const s of unscanned) {
|
|
291
|
+
lines.push(`- \`${s.path}\` (${s.fileCount} files)`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return lines.join('\n');
|
|
295
|
+
}
|
|
296
|
+
// ---------------------------------------------------------------------------
|
|
297
|
+
// Outcome recording (mutate state in place)
|
|
298
|
+
// ---------------------------------------------------------------------------
|
|
299
|
+
/**
|
|
300
|
+
* Record scan completion for a sector.
|
|
301
|
+
* @param now - current timestamp in ms (defaults to Date.now()). Pass explicitly for testability.
|
|
302
|
+
*/
|
|
303
|
+
export function recordScanResult(state, sectorPath, currentCycle, proposalCount, reclassification, now) {
|
|
304
|
+
const s = state.sectors.find(x => x.path === sectorPath);
|
|
305
|
+
if (!s)
|
|
306
|
+
return;
|
|
307
|
+
s.lastScannedAt = now ?? Date.now();
|
|
308
|
+
s.lastScannedCycle = currentCycle;
|
|
309
|
+
s.scanCount = (s.scanCount ?? 0) + 1;
|
|
310
|
+
s.proposalYield = EMA_OLD_WEIGHT * (s.proposalYield ?? 0) + (1 - EMA_OLD_WEIGHT) * proposalCount;
|
|
311
|
+
// Apply reclassification if confidence is medium or high
|
|
312
|
+
if (reclassification && (reclassification.confidence === 'medium' || reclassification.confidence === 'high')) {
|
|
313
|
+
if (reclassification.production !== undefined) {
|
|
314
|
+
s.production = reclassification.production;
|
|
315
|
+
}
|
|
316
|
+
s.classificationConfidence = reclassification.confidence;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
export function recordTicketOutcome(state, sectorPath, success, category) {
|
|
320
|
+
const s = state.sectors.find(x => x.path === sectorPath);
|
|
321
|
+
if (!s)
|
|
322
|
+
return;
|
|
323
|
+
if (success)
|
|
324
|
+
s.successCount++;
|
|
325
|
+
else
|
|
326
|
+
s.failureCount++;
|
|
327
|
+
const total = s.successCount + s.failureCount;
|
|
328
|
+
if (total > 0 && total % OUTCOME_DECAY_INTERVAL === 0) {
|
|
329
|
+
s.successCount = Math.round(s.successCount * OUTCOME_DECAY_FACTOR);
|
|
330
|
+
s.failureCount = Math.round(s.failureCount * OUTCOME_DECAY_FACTOR);
|
|
331
|
+
}
|
|
332
|
+
// Category×Sector affinity tracking
|
|
333
|
+
if (category) {
|
|
334
|
+
s.categoryStats ??= {};
|
|
335
|
+
const cs = s.categoryStats[category] ??= { success: 0, failure: 0 };
|
|
336
|
+
if (success)
|
|
337
|
+
cs.success++;
|
|
338
|
+
else
|
|
339
|
+
cs.failure++;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
export function updateProposalYield(state, sectorPath, acceptedCount) {
|
|
343
|
+
const s = state.sectors.find(x => x.path === sectorPath);
|
|
344
|
+
if (!s)
|
|
345
|
+
return;
|
|
346
|
+
s.proposalYield = EMA_OLD_WEIGHT * s.proposalYield + (1 - EMA_OLD_WEIGHT) * acceptedCount;
|
|
347
|
+
}
|
|
348
|
+
export function recordMergeOutcome(state, sectorPath, merged) {
|
|
349
|
+
const s = state.sectors.find(x => x.path === sectorPath);
|
|
350
|
+
if (!s)
|
|
351
|
+
return;
|
|
352
|
+
if (merged) {
|
|
353
|
+
s.mergeCount = (s.mergeCount ?? 0) + 1;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
s.closedCount = (s.closedCount ?? 0) + 1;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
// ---------------------------------------------------------------------------
|
|
360
|
+
// Category affinity
|
|
361
|
+
// ---------------------------------------------------------------------------
|
|
362
|
+
/**
|
|
363
|
+
* Get category affinity for a sector: which categories succeed vs fail.
|
|
364
|
+
* boost: categories with >60% success rate (min 3 attempts)
|
|
365
|
+
* suppress: categories with <30% success rate (min 3 attempts)
|
|
366
|
+
*/
|
|
367
|
+
export function getSectorCategoryAffinity(sector) {
|
|
368
|
+
const boost = [];
|
|
369
|
+
const suppress = [];
|
|
370
|
+
if (!sector.categoryStats)
|
|
371
|
+
return { boost, suppress };
|
|
372
|
+
for (const [cat, stats] of Object.entries(sector.categoryStats)) {
|
|
373
|
+
const total = stats.success + stats.failure;
|
|
374
|
+
if (total < AFFINITY_MIN_ATTEMPTS)
|
|
375
|
+
continue;
|
|
376
|
+
const rate = stats.success / total;
|
|
377
|
+
if (rate > AFFINITY_BOOST_RATE)
|
|
378
|
+
boost.push(cat);
|
|
379
|
+
else if (rate < AFFINITY_SUPPRESS_RATE)
|
|
380
|
+
suppress.push(cat);
|
|
381
|
+
}
|
|
382
|
+
return { boost, suppress };
|
|
383
|
+
}
|
|
384
|
+
// ---------------------------------------------------------------------------
|
|
385
|
+
// Scope adjustment suggestion
|
|
386
|
+
// ---------------------------------------------------------------------------
|
|
387
|
+
/**
|
|
388
|
+
* Suggest scope adjustment based on sector yield distribution.
|
|
389
|
+
* narrow: top sectors have much higher yield than average (focus there)
|
|
390
|
+
* widen: all sectors barren (need fresh territory)
|
|
391
|
+
* stable: normal distribution
|
|
392
|
+
*/
|
|
393
|
+
export function suggestScopeAdjustment(state) {
|
|
394
|
+
const scanned = state.sectors.filter(s => s.production && s.scanCount > 0);
|
|
395
|
+
if (scanned.length < 3)
|
|
396
|
+
return 'stable';
|
|
397
|
+
const yields = scanned.map(s => s.proposalYield).sort((a, b) => b - a);
|
|
398
|
+
const avg = yields.reduce((s, v) => s + v, 0) / yields.length;
|
|
399
|
+
// Check if all scanned sectors are barren
|
|
400
|
+
if (avg < POLISHED_YIELD_THRESHOLD)
|
|
401
|
+
return 'widen';
|
|
402
|
+
// Check if top 3 have much higher yield
|
|
403
|
+
const topAvg = yields.slice(0, 3).reduce((s, v) => s + v, 0) / Math.min(3, yields.length);
|
|
404
|
+
if (avg > 0 && topAvg > avg * 2)
|
|
405
|
+
return 'narrow';
|
|
406
|
+
return 'stable';
|
|
407
|
+
}
|
|
408
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/sectors/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAkDH,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC,yDAAyD;AACzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,gCAAgC;AAChC,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C,wCAAwC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC,8BAA8B;AAC9B,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C,6CAA6C;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,0DAA0D;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG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wC;IACxC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1F,IAAI,GAAG,GAAG,CAAC,IAAI,MAAM,GAAG,GAAG,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAC;IAEjD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service exports
|
|
3
|
+
*
|
|
4
|
+
* Services provide business logic orchestration.
|
|
5
|
+
* They use repositories for data access and are dependency-injected for testability.
|
|
6
|
+
*/
|
|
7
|
+
export { scoutRepo, approveProposals, type ScoutDeps, type ScoutRepoOptions, type ScoutRepoResult, type ScoutProgress, type GitService, type Logger, } from './scout.js';
|
|
8
|
+
export type { ScoutBackend } from '../scout/index.js';
|
|
9
|
+
export { runQa, getQaRunDetails, type QaDeps, type QaLogger, type QaCommand, type QaConfig, type QaArtifactsConfig, type QaRetryConfig, type QaRunOptions, type QaRunResult, } from './qa.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,MAAM,GACZ,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EACL,KAAK,EACL,eAAe,EACf,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service exports
|
|
3
|
+
*
|
|
4
|
+
* Services provide business logic orchestration.
|
|
5
|
+
* They use repositories for data access and are dependency-injected for testability.
|
|
6
|
+
*/
|
|
7
|
+
export { scoutRepo, approveProposals, } from './scout.js';
|
|
8
|
+
export { runQa, getQaRunDetails, } from './qa.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,SAAS,EACT,gBAAgB,GAOjB,MAAM,YAAY,CAAC;AAIpB,OAAO,EACL,KAAK,EACL,eAAe,GAShB,MAAM,SAAS,CAAC"}
|