@codeledger/engine 0.7.2 → 0.7.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/claims/claims.d.ts +14 -0
- package/dist/claims/claims.d.ts.map +1 -0
- package/dist/claims/claims.js +125 -0
- package/dist/claims/claims.js.map +1 -0
- package/dist/claims/index.d.ts +2 -0
- package/dist/claims/index.d.ts.map +1 -0
- package/dist/claims/index.js +2 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/dashboard/index.d.ts +3 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +3 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/dashboard/metrics.d.ts +24 -0
- package/dist/dashboard/metrics.d.ts.map +1 -0
- package/dist/dashboard/metrics.js +358 -0
- package/dist/dashboard/metrics.js.map +1 -0
- package/dist/dashboard/store.d.ts +26 -0
- package/dist/dashboard/store.d.ts.map +1 -0
- package/dist/dashboard/store.js +97 -0
- package/dist/dashboard/store.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/integration/ambient-coordinator.d.ts +75 -0
- package/dist/integration/ambient-coordinator.d.ts.map +1 -0
- package/dist/integration/ambient-coordinator.js +183 -0
- package/dist/integration/ambient-coordinator.js.map +1 -0
- package/dist/integration/index.d.ts +4 -0
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +3 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/warning-throttle.d.ts +63 -0
- package/dist/integration/warning-throttle.d.ts.map +1 -0
- package/dist/integration/warning-throttle.js +347 -0
- package/dist/integration/warning-throttle.js.map +1 -0
- package/dist/intervention/escalation.d.ts +23 -0
- package/dist/intervention/escalation.d.ts.map +1 -0
- package/dist/intervention/escalation.js +149 -0
- package/dist/intervention/escalation.js.map +1 -0
- package/dist/intervention/generator.d.ts +12 -0
- package/dist/intervention/generator.d.ts.map +1 -0
- package/dist/intervention/generator.js +191 -0
- package/dist/intervention/generator.js.map +1 -0
- package/dist/intervention/index.d.ts +4 -0
- package/dist/intervention/index.d.ts.map +1 -0
- package/dist/intervention/index.js +4 -0
- package/dist/intervention/index.js.map +1 -0
- package/dist/intervention/signal-aggregator.d.ts +26 -0
- package/dist/intervention/signal-aggregator.d.ts.map +1 -0
- package/dist/intervention/signal-aggregator.js +274 -0
- package/dist/intervention/signal-aggregator.js.map +1 -0
- package/dist/layer-d/conflict-detector.d.ts +12 -0
- package/dist/layer-d/conflict-detector.d.ts.map +1 -0
- package/dist/layer-d/conflict-detector.js +150 -0
- package/dist/layer-d/conflict-detector.js.map +1 -0
- package/dist/layer-d/index.d.ts +3 -0
- package/dist/layer-d/index.d.ts.map +1 -0
- package/dist/layer-d/index.js +3 -0
- package/dist/layer-d/index.js.map +1 -0
- package/dist/layer-d/surface-extractor.d.ts +10 -0
- package/dist/layer-d/surface-extractor.d.ts.map +1 -0
- package/dist/layer-d/surface-extractor.js +96 -0
- package/dist/layer-d/surface-extractor.js.map +1 -0
- package/dist/policy-domains/domains.d.ts +31 -0
- package/dist/policy-domains/domains.d.ts.map +1 -0
- package/dist/policy-domains/domains.js +445 -0
- package/dist/policy-domains/domains.js.map +1 -0
- package/dist/policy-domains/index.d.ts +8 -0
- package/dist/policy-domains/index.d.ts.map +1 -0
- package/dist/policy-domains/index.js +8 -0
- package/dist/policy-domains/index.js.map +1 -0
- package/dist/pulse/index.d.ts +2 -0
- package/dist/pulse/index.d.ts.map +1 -0
- package/dist/pulse/index.js +2 -0
- package/dist/pulse/index.js.map +1 -0
- package/dist/pulse/pulse.d.ts +20 -0
- package/dist/pulse/pulse.d.ts.map +1 -0
- package/dist/pulse/pulse.js +253 -0
- package/dist/pulse/pulse.js.map +1 -0
- package/dist/severity/index.d.ts +2 -0
- package/dist/severity/index.d.ts.map +1 -0
- package/dist/severity/index.js +2 -0
- package/dist/severity/index.js.map +1 -0
- package/dist/severity/severity.d.ts +48 -0
- package/dist/severity/severity.d.ts.map +1 -0
- package/dist/severity/severity.js +134 -0
- package/dist/severity/severity.js.map +1 -0
- package/dist/staleness/index.d.ts +2 -0
- package/dist/staleness/index.d.ts.map +1 -0
- package/dist/staleness/index.js +2 -0
- package/dist/staleness/index.js.map +1 -0
- package/dist/staleness/jit-staleness.d.ts +29 -0
- package/dist/staleness/jit-staleness.d.ts.map +1 -0
- package/dist/staleness/jit-staleness.js +240 -0
- package/dist/staleness/jit-staleness.js.map +1 -0
- package/dist/team-policy/index.d.ts +1 -1
- package/dist/team-policy/index.d.ts.map +1 -1
- package/dist/team-policy/index.js +1 -1
- package/dist/team-policy/index.js.map +1 -1
- package/dist/team-policy/policy.d.ts +7 -0
- package/dist/team-policy/policy.d.ts.map +1 -1
- package/dist/team-policy/policy.js +38 -0
- package/dist/team-policy/policy.js.map +1 -1
- package/dist/trust/approval.d.ts +16 -0
- package/dist/trust/approval.d.ts.map +1 -0
- package/dist/trust/approval.js +183 -0
- package/dist/trust/approval.js.map +1 -0
- package/dist/trust/capsule.d.ts +36 -0
- package/dist/trust/capsule.d.ts.map +1 -0
- package/dist/trust/capsule.js +206 -0
- package/dist/trust/capsule.js.map +1 -0
- package/dist/trust/index.d.ts +6 -0
- package/dist/trust/index.d.ts.map +1 -0
- package/dist/trust/index.js +6 -0
- package/dist/trust/index.js.map +1 -0
- package/dist/trust/learning-feedback.d.ts +18 -0
- package/dist/trust/learning-feedback.d.ts.map +1 -0
- package/dist/trust/learning-feedback.js +146 -0
- package/dist/trust/learning-feedback.js.map +1 -0
- package/dist/trust/risk-scoring.d.ts +16 -0
- package/dist/trust/risk-scoring.d.ts.map +1 -0
- package/dist/trust/risk-scoring.js +142 -0
- package/dist/trust/risk-scoring.js.map +1 -0
- package/dist/trust/timeline.d.ts +42 -0
- package/dist/trust/timeline.d.ts.map +1 -0
- package/dist/trust/timeline.js +154 -0
- package/dist/trust/timeline.js.map +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard Data Store — Append-only JSONL persistence for dashboard snapshots
|
|
3
|
+
*
|
|
4
|
+
* Storage: .codeledger/dashboard-history.jsonl
|
|
5
|
+
*
|
|
6
|
+
* Each line is a JSON-encoded DashboardSnapshot.
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync, appendFileSync, existsSync } from 'node:fs';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
export const DASHBOARD_HISTORY_FILE = 'dashboard-history.jsonl';
|
|
11
|
+
// Trend threshold: delta > 0.02 = improving, delta < -0.02 = degrading
|
|
12
|
+
const TREND_THRESHOLD = 0.02;
|
|
13
|
+
// ─── Public API ──────────────────────────────────────────────────────────────
|
|
14
|
+
/**
|
|
15
|
+
* Append a dashboard metrics snapshot to the JSONL history file.
|
|
16
|
+
*/
|
|
17
|
+
export function appendDashboardSnapshot(dataDir, metrics, source = 'cli') {
|
|
18
|
+
const snapshot = {
|
|
19
|
+
...metrics,
|
|
20
|
+
snapshot_source: source,
|
|
21
|
+
};
|
|
22
|
+
const filePath = join(dataDir, DASHBOARD_HISTORY_FILE);
|
|
23
|
+
const line = JSON.stringify(snapshot) + '\n';
|
|
24
|
+
appendFileSync(filePath, line, 'utf-8');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Read all dashboard snapshots from the JSONL history file.
|
|
28
|
+
* Returns an empty array if the file does not exist.
|
|
29
|
+
*/
|
|
30
|
+
export function readDashboardHistory(dataDir) {
|
|
31
|
+
const filePath = join(dataDir, DASHBOARD_HISTORY_FILE);
|
|
32
|
+
if (!existsSync(filePath))
|
|
33
|
+
return [];
|
|
34
|
+
try {
|
|
35
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
36
|
+
const lines = content.split('\n').filter((l) => l.trim().length > 0);
|
|
37
|
+
const snapshots = [];
|
|
38
|
+
for (const line of lines) {
|
|
39
|
+
try {
|
|
40
|
+
const parsed = JSON.parse(line);
|
|
41
|
+
snapshots.push(parsed);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Skip malformed lines
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return snapshots;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Compute trend directions from dashboard history.
|
|
55
|
+
*
|
|
56
|
+
* Uses the last 5 entries to determine if each metric is improving, stable, or degrading.
|
|
57
|
+
* For DRI and override_frequency, a decrease is "improving" (lower risk is better).
|
|
58
|
+
*/
|
|
59
|
+
export function computeTrends(history) {
|
|
60
|
+
if (history.length < 2) {
|
|
61
|
+
return {
|
|
62
|
+
ahs_trend: 'stable',
|
|
63
|
+
dri_trend: 'stable',
|
|
64
|
+
eds_trend: 'stable',
|
|
65
|
+
sts_trend: 'stable',
|
|
66
|
+
override_trend: 'stable',
|
|
67
|
+
overall_trend: 'stable',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// Use last 5 entries (or fewer)
|
|
71
|
+
const recent = history.slice(-5);
|
|
72
|
+
const first = recent[0];
|
|
73
|
+
const last = recent[recent.length - 1];
|
|
74
|
+
return {
|
|
75
|
+
ahs_trend: trendDirection(last.ahs - first.ahs, false),
|
|
76
|
+
dri_trend: trendDirection(last.dri - first.dri, true), // inverted: decrease = improving
|
|
77
|
+
eds_trend: trendDirection(last.eds - first.eds, false),
|
|
78
|
+
sts_trend: trendDirection(last.sts - first.sts, false),
|
|
79
|
+
override_trend: trendDirection(last.override_frequency - first.override_frequency, true), // inverted
|
|
80
|
+
overall_trend: trendDirection(last.overall - first.overall, false),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Determine trend direction from a delta value.
|
|
85
|
+
*
|
|
86
|
+
* @param delta - The difference (last - first)
|
|
87
|
+
* @param inverted - If true, a negative delta is "improving" (e.g., DRI, overrides)
|
|
88
|
+
*/
|
|
89
|
+
function trendDirection(delta, inverted) {
|
|
90
|
+
const effectiveDelta = inverted ? -delta : delta;
|
|
91
|
+
if (effectiveDelta > TREND_THRESHOLD)
|
|
92
|
+
return 'improving';
|
|
93
|
+
if (effectiveDelta < -TREND_THRESHOLD)
|
|
94
|
+
return 'degrading';
|
|
95
|
+
return 'stable';
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/dashboard/store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAEhE,uEAAuE;AACvE,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAe,EACf,OAAyB,EACzB,SAAiB,KAAK;IAEtB,MAAM,QAAQ,GAAsB;QAClC,GAAG,OAAO;QACV,eAAe,EAAE,MAAM;KACxB,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IAC7C,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACvD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,IAAI,CAAC;QACH,MAAM,OAA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AAE,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,iCAAiC;QACxF,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC;QACtD,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC;QACtD,cAAc,EAAE,cAAc,CAAC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAAE,WAAW;QACrG,aAAa,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;KACnE,CAAC;AACJ,CAAC;AAMD;;;;;GAKG;AACH,SAAS,cAAc,CAAC,KAAa,EAAE,QAAiB;IACtD,MAAM,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAEjD,IAAI,cAAc,GAAG,eAAe;QAAE,OAAO,WAAW,CAAC;IACzD,IAAI,cAAc,GAAG,CAAC,eAAe;QAAE,OAAO,WAAW,CAAC;IAC1D,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -51,4 +51,14 @@ export * from './team-metrics/index.js';
|
|
|
51
51
|
export * from './provenance/index.js';
|
|
52
52
|
export * from './policy-sim/index.js';
|
|
53
53
|
export * from './orchestrator/index.js';
|
|
54
|
+
export * from './pulse/index.js';
|
|
55
|
+
export * from './layer-d/index.js';
|
|
56
|
+
export * from './severity/index.js';
|
|
57
|
+
export * from './claims/index.js';
|
|
58
|
+
export * from './staleness/index.js';
|
|
59
|
+
export * from './integration/index.js';
|
|
60
|
+
export * from './trust/index.js';
|
|
61
|
+
export * from './dashboard/index.js';
|
|
62
|
+
export * from './intervention/index.js';
|
|
63
|
+
export * from './policy-domains/index.js';
|
|
54
64
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -53,4 +53,23 @@ export * from './team-metrics/index.js';
|
|
|
53
53
|
export * from './provenance/index.js';
|
|
54
54
|
export * from './policy-sim/index.js';
|
|
55
55
|
export * from './orchestrator/index.js';
|
|
56
|
+
// v2.5 — Pulse: Ambient Session Discovery
|
|
57
|
+
export * from './pulse/index.js';
|
|
58
|
+
// Layer D — Semantic / Signature Conflict Detection
|
|
59
|
+
export * from './layer-d/index.js';
|
|
60
|
+
// v2.6 — Conflict Severity Matrix & Soft Claims
|
|
61
|
+
export * from './severity/index.js';
|
|
62
|
+
export * from './claims/index.js';
|
|
63
|
+
// v2.7 — JIT Staleness / Context Shadowing
|
|
64
|
+
export * from './staleness/index.js';
|
|
65
|
+
// v2.8 — Ambient Coordination Integration Layer
|
|
66
|
+
export * from './integration/index.js';
|
|
67
|
+
// v3.0 — Executive Trust: Command Capsules & Approval Workflow
|
|
68
|
+
export * from './trust/index.js';
|
|
69
|
+
// v3.1 — Architecture Health Dashboard
|
|
70
|
+
export * from './dashboard/index.js';
|
|
71
|
+
// v3.2 — Architecture Intervention Engine
|
|
72
|
+
export * from './intervention/index.js';
|
|
73
|
+
// v3.3 — Policy Domain Framework (Governance-as-Code)
|
|
74
|
+
export * from './policy-domains/index.js';
|
|
56
75
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAE/B,wDAAwD;AACxD,cAAc,oBAAoB,CAAC;AAEnC,yCAAyC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAE/B,wDAAwD;AACxD,cAAc,oBAAoB,CAAC;AAEnC,yCAAyC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AAExC,0CAA0C;AAC1C,cAAc,kBAAkB,CAAC;AAEjC,oDAAoD;AACpD,cAAc,oBAAoB,CAAC;AAEnC,gDAAgD;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAElC,2CAA2C;AAC3C,cAAc,sBAAsB,CAAC;AAErC,gDAAgD;AAChD,cAAc,wBAAwB,CAAC;AAEvC,+DAA+D;AAC/D,cAAc,kBAAkB,CAAC;AAEjC,uCAAuC;AACvC,cAAc,sBAAsB,CAAC;AAErC,0CAA0C;AAC1C,cAAc,yBAAyB,CAAC;AAExC,sDAAsD;AACtD,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient Coordinator — Integration Layer (Part G)
|
|
3
|
+
*
|
|
4
|
+
* Wires the new ambient coordination subsystems into existing
|
|
5
|
+
* CodeLedger architecture:
|
|
6
|
+
*
|
|
7
|
+
* - Pulse → SCE (slice builder), CCS (confidence scoring), ISC (intent sufficiency)
|
|
8
|
+
* - Layer D → dependency graph, intent model
|
|
9
|
+
* - Staleness → ECL-Lite history, failure hotspots
|
|
10
|
+
* - Claims → session awareness, multi-agent coordination
|
|
11
|
+
*
|
|
12
|
+
* This module provides a unified entry point for ambient coordination,
|
|
13
|
+
* keeping subsystems loosely coupled while enabling cross-system data flow.
|
|
14
|
+
*/
|
|
15
|
+
import type { PulseSession, PulseState, LayerDConflict, LayerDAnalysis, ConflictSeverityAssessment, SoftClaim, ShadowUpdate, SessionRecord, ConflictZone, SeverityConfig, ISODateTime } from '@codeledger/types';
|
|
16
|
+
/** Full ambient coordination status for a repository */
|
|
17
|
+
export interface AmbientStatus {
|
|
18
|
+
pulse: PulseState;
|
|
19
|
+
activeClaims: SoftClaim[];
|
|
20
|
+
fileConflicts: ConflictZone[];
|
|
21
|
+
semanticConflicts: LayerDAnalysis | null;
|
|
22
|
+
severityAssessments: ConflictSeverityAssessment[];
|
|
23
|
+
staleness: ShadowUpdate[];
|
|
24
|
+
timestamp: ISODateTime;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Run Pulse scan and return inferred sessions.
|
|
28
|
+
* These sessions can feed into ISC (intent sufficiency) and SCE (slice builder)
|
|
29
|
+
* as candidate task contexts.
|
|
30
|
+
*/
|
|
31
|
+
export declare function discoverSessions(repoRoot: string): PulseSession[];
|
|
32
|
+
/**
|
|
33
|
+
* Extract intent keywords from Pulse sessions for ISC cross-referencing.
|
|
34
|
+
* Returns a map of sessionId → intent keywords.
|
|
35
|
+
*/
|
|
36
|
+
export declare function extractIntentKeywords(sessions: PulseSession[]): Map<string, string[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Run Layer D analysis across active sessions.
|
|
39
|
+
* Compares public surfaces to detect semantic/signature conflicts.
|
|
40
|
+
*/
|
|
41
|
+
export declare function analyzeSemanticConflicts(repoRoot: string, sessions: SessionRecord[]): LayerDAnalysis;
|
|
42
|
+
/**
|
|
43
|
+
* Compute severity assessments for all session pairs.
|
|
44
|
+
* Combines file-level conflict zones with Layer D semantic conflicts.
|
|
45
|
+
*/
|
|
46
|
+
export declare function assessConflictSeverity(sessions: SessionRecord[], fileConflicts: ConflictZone[], semanticConflicts: LayerDConflict[], config?: SeverityConfig): ConflictSeverityAssessment[];
|
|
47
|
+
/**
|
|
48
|
+
* Compute staleness for all active sessions.
|
|
49
|
+
* Integrates with ECL-Lite history by using the session's activation ref
|
|
50
|
+
* as the staleness baseline.
|
|
51
|
+
*/
|
|
52
|
+
export declare function computeSessionStaleness(repoRoot: string, sessions: SessionRecord[], activationRefs: Map<string, string>): ShadowUpdate[];
|
|
53
|
+
/**
|
|
54
|
+
* Sync a session's working set to a soft claim.
|
|
55
|
+
* Called after Pulse scan to keep claims up-to-date.
|
|
56
|
+
*/
|
|
57
|
+
export declare function syncPulseToClaims(repoRoot: string, pulseSession: PulseSession, actorId: string): SoftClaim;
|
|
58
|
+
/**
|
|
59
|
+
* Get formatted presence summary for display.
|
|
60
|
+
* Combines claims from all sources (explicit + Pulse-synced).
|
|
61
|
+
*/
|
|
62
|
+
export declare function getPresenceSummary(repoRoot: string): string[];
|
|
63
|
+
/**
|
|
64
|
+
* Run a complete ambient coordination scan.
|
|
65
|
+
* This is the main entry point for the integration layer.
|
|
66
|
+
*
|
|
67
|
+
* Steps:
|
|
68
|
+
* 1. Run Pulse to discover sessions
|
|
69
|
+
* 2. Read active claims
|
|
70
|
+
* 3. Analyze semantic conflicts (if multiple sessions)
|
|
71
|
+
* 4. Compute severity assessments
|
|
72
|
+
* 5. Compute staleness for each session
|
|
73
|
+
*/
|
|
74
|
+
export declare function runAmbientScan(repoRoot: string, sessions: SessionRecord[], fileConflicts: ConflictZone[], activationRefs: Map<string, string>): AmbientStatus;
|
|
75
|
+
//# sourceMappingURL=ambient-coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient-coordinator.d.ts","sourceRoot":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GAGG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,MAAM,GACd,SAAS,CASX;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAY7D;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,aAAa,EAAE,EACzB,aAAa,EAAE,YAAY,EAAE,EAC7B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,aAAa,CAkCf"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient Coordinator — Integration Layer (Part G)
|
|
3
|
+
*
|
|
4
|
+
* Wires the new ambient coordination subsystems into existing
|
|
5
|
+
* CodeLedger architecture:
|
|
6
|
+
*
|
|
7
|
+
* - Pulse → SCE (slice builder), CCS (confidence scoring), ISC (intent sufficiency)
|
|
8
|
+
* - Layer D → dependency graph, intent model
|
|
9
|
+
* - Staleness → ECL-Lite history, failure hotspots
|
|
10
|
+
* - Claims → session awareness, multi-agent coordination
|
|
11
|
+
*
|
|
12
|
+
* This module provides a unified entry point for ambient coordination,
|
|
13
|
+
* keeping subsystems loosely coupled while enabling cross-system data flow.
|
|
14
|
+
*/
|
|
15
|
+
import { runPulseScan, loadPulseState } from '../pulse/index.js';
|
|
16
|
+
import { extractSessionSurface, detectLayerDConflicts } from '../layer-d/index.js';
|
|
17
|
+
import { computeSeverity, buildSignalsFromOverlap, DEFAULT_SEVERITY_CONFIG } from '../severity/index.js';
|
|
18
|
+
import { writeClaim, readActiveClaims, pruneExpiredClaims, getPresence } from '../claims/index.js';
|
|
19
|
+
import { computeShadowUpdate } from '../staleness/index.js';
|
|
20
|
+
// ─── Pulse → Intent Feed ───────────────────────────────────────────────────
|
|
21
|
+
/**
|
|
22
|
+
* Run Pulse scan and return inferred sessions.
|
|
23
|
+
* These sessions can feed into ISC (intent sufficiency) and SCE (slice builder)
|
|
24
|
+
* as candidate task contexts.
|
|
25
|
+
*/
|
|
26
|
+
export function discoverSessions(repoRoot) {
|
|
27
|
+
return runPulseScan(repoRoot);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extract intent keywords from Pulse sessions for ISC cross-referencing.
|
|
31
|
+
* Returns a map of sessionId → intent keywords.
|
|
32
|
+
*/
|
|
33
|
+
export function extractIntentKeywords(sessions) {
|
|
34
|
+
const result = new Map();
|
|
35
|
+
for (const s of sessions) {
|
|
36
|
+
const keywords = s.candidateIntent
|
|
37
|
+
.split(/[\s+\-_]/)
|
|
38
|
+
.filter((k) => k.length > 2);
|
|
39
|
+
result.set(s.sessionId, keywords);
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
// ─── Layer D → Dependency Graph Feed ───────────────────────────────────────
|
|
44
|
+
/**
|
|
45
|
+
* Run Layer D analysis across active sessions.
|
|
46
|
+
* Compares public surfaces to detect semantic/signature conflicts.
|
|
47
|
+
*/
|
|
48
|
+
export function analyzeSemanticConflicts(repoRoot, sessions) {
|
|
49
|
+
// Extract public surfaces for each session's files
|
|
50
|
+
const surfaces = sessions
|
|
51
|
+
.filter(s => s.bundle_files.length > 0)
|
|
52
|
+
.map(s => {
|
|
53
|
+
const fullPaths = s.bundle_files.map(f => `${repoRoot}/${f}`);
|
|
54
|
+
return extractSessionSurface(s.session_id, fullPaths);
|
|
55
|
+
});
|
|
56
|
+
// Build dependency surface map (session → directories of their files)
|
|
57
|
+
const depSurfaces = new Map();
|
|
58
|
+
for (const s of sessions) {
|
|
59
|
+
depSurfaces.set(s.session_id, s.bundle_files);
|
|
60
|
+
}
|
|
61
|
+
return detectLayerDConflicts(surfaces, depSurfaces);
|
|
62
|
+
}
|
|
63
|
+
// ─── Severity Assessment ───────────────────────────────────────────────────
|
|
64
|
+
/**
|
|
65
|
+
* Compute severity assessments for all session pairs.
|
|
66
|
+
* Combines file-level conflict zones with Layer D semantic conflicts.
|
|
67
|
+
*/
|
|
68
|
+
export function assessConflictSeverity(sessions, fileConflicts, semanticConflicts, config = DEFAULT_SEVERITY_CONFIG) {
|
|
69
|
+
const assessments = [];
|
|
70
|
+
const processedPairs = new Set();
|
|
71
|
+
// Group file conflicts by session pairs
|
|
72
|
+
for (const session of sessions) {
|
|
73
|
+
const sessionConflicts = fileConflicts.filter(z => z.other_session !== session.session_id);
|
|
74
|
+
for (const conflict of sessionConflicts) {
|
|
75
|
+
const pairKey = [session.session_id, conflict.other_session].sort().join('::');
|
|
76
|
+
if (processedPairs.has(pairKey))
|
|
77
|
+
continue;
|
|
78
|
+
processedPairs.add(pairKey);
|
|
79
|
+
const overlappingFiles = fileConflicts
|
|
80
|
+
.filter(z => (z.other_session === conflict.other_session) ||
|
|
81
|
+
(z.other_session === session.session_id))
|
|
82
|
+
.map(z => z.file);
|
|
83
|
+
const semanticForPair = semanticConflicts.filter(c => (c.producerSession === session.session_id &&
|
|
84
|
+
c.consumerSessions.includes(conflict.other_session)) ||
|
|
85
|
+
(c.producerSession === conflict.other_session &&
|
|
86
|
+
c.consumerSessions.includes(session.session_id)));
|
|
87
|
+
const signals = buildSignalsFromOverlap(overlappingFiles, [], // dependency overlaps computed separately
|
|
88
|
+
[], // shared test surface
|
|
89
|
+
false, // branch divergence
|
|
90
|
+
semanticForPair.map(c => ({ symbol: c.affectedSymbol, file: c.file })), config.weights);
|
|
91
|
+
assessments.push(computeSeverity(signals, [session.session_id, conflict.other_session], config));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return assessments.sort((a, b) => b.aggregateScore - a.aggregateScore);
|
|
95
|
+
}
|
|
96
|
+
// ─── Staleness Integration ─────────────────────────────────────────────────
|
|
97
|
+
/**
|
|
98
|
+
* Compute staleness for all active sessions.
|
|
99
|
+
* Integrates with ECL-Lite history by using the session's activation ref
|
|
100
|
+
* as the staleness baseline.
|
|
101
|
+
*/
|
|
102
|
+
export function computeSessionStaleness(repoRoot, sessions, activationRefs) {
|
|
103
|
+
const updates = [];
|
|
104
|
+
for (const session of sessions) {
|
|
105
|
+
const ref = activationRefs.get(session.session_id);
|
|
106
|
+
if (!ref)
|
|
107
|
+
continue;
|
|
108
|
+
const update = computeShadowUpdate(repoRoot, session.session_id, session.bundle_files, [], // dependency surface from Pulse
|
|
109
|
+
ref);
|
|
110
|
+
updates.push(update);
|
|
111
|
+
}
|
|
112
|
+
return updates;
|
|
113
|
+
}
|
|
114
|
+
// ─── Claims Integration ────────────────────────────────────────────────────
|
|
115
|
+
/**
|
|
116
|
+
* Sync a session's working set to a soft claim.
|
|
117
|
+
* Called after Pulse scan to keep claims up-to-date.
|
|
118
|
+
*/
|
|
119
|
+
export function syncPulseToClaims(repoRoot, pulseSession, actorId) {
|
|
120
|
+
return writeClaim(repoRoot, {
|
|
121
|
+
sessionId: pulseSession.sessionId,
|
|
122
|
+
actorId,
|
|
123
|
+
timestamp: pulseSession.timestamp,
|
|
124
|
+
touchedFiles: pulseSession.touchedFiles,
|
|
125
|
+
dependencySurface: pulseSession.dependencySurface,
|
|
126
|
+
intentLabel: pulseSession.candidateIntent,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get formatted presence summary for display.
|
|
131
|
+
* Combines claims from all sources (explicit + Pulse-synced).
|
|
132
|
+
*/
|
|
133
|
+
export function getPresenceSummary(repoRoot) {
|
|
134
|
+
pruneExpiredClaims(repoRoot);
|
|
135
|
+
const presence = getPresence(repoRoot);
|
|
136
|
+
if (presence.length === 0)
|
|
137
|
+
return ['No active claims detected.'];
|
|
138
|
+
const lines = [];
|
|
139
|
+
for (const p of presence) {
|
|
140
|
+
const actors = p.actors.map((a) => `${a.actorId} (${a.intentLabel})`).join(', ');
|
|
141
|
+
lines.push(`${p.file}: ${actors}`);
|
|
142
|
+
}
|
|
143
|
+
return lines;
|
|
144
|
+
}
|
|
145
|
+
// ─── Full Ambient Scan ─────────────────────────────────────────────────────
|
|
146
|
+
/**
|
|
147
|
+
* Run a complete ambient coordination scan.
|
|
148
|
+
* This is the main entry point for the integration layer.
|
|
149
|
+
*
|
|
150
|
+
* Steps:
|
|
151
|
+
* 1. Run Pulse to discover sessions
|
|
152
|
+
* 2. Read active claims
|
|
153
|
+
* 3. Analyze semantic conflicts (if multiple sessions)
|
|
154
|
+
* 4. Compute severity assessments
|
|
155
|
+
* 5. Compute staleness for each session
|
|
156
|
+
*/
|
|
157
|
+
export function runAmbientScan(repoRoot, sessions, fileConflicts, activationRefs) {
|
|
158
|
+
// 1. Pulse scan
|
|
159
|
+
discoverSessions(repoRoot);
|
|
160
|
+
const pulseState = loadPulseState(repoRoot);
|
|
161
|
+
// 2. Active claims
|
|
162
|
+
pruneExpiredClaims(repoRoot);
|
|
163
|
+
const activeClaims = readActiveClaims(repoRoot);
|
|
164
|
+
// 3. Semantic conflicts (only if multiple sessions)
|
|
165
|
+
let semanticConflicts = null;
|
|
166
|
+
if (sessions.length >= 2) {
|
|
167
|
+
semanticConflicts = analyzeSemanticConflicts(repoRoot, sessions);
|
|
168
|
+
}
|
|
169
|
+
// 4. Severity assessments
|
|
170
|
+
const severityAssessments = assessConflictSeverity(sessions, fileConflicts, semanticConflicts?.conflicts ?? []);
|
|
171
|
+
// 5. Staleness
|
|
172
|
+
const staleness = computeSessionStaleness(repoRoot, sessions, activationRefs);
|
|
173
|
+
return {
|
|
174
|
+
pulse: pulseState,
|
|
175
|
+
activeClaims,
|
|
176
|
+
fileConflicts,
|
|
177
|
+
semanticConflicts,
|
|
178
|
+
severityAssessments,
|
|
179
|
+
staleness,
|
|
180
|
+
timestamp: new Date().toISOString(),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=ambient-coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient-coordinator.js","sourceRoot":"","sources":["../../src/integration/ambient-coordinator.ts"],"names":[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essions, extractIntentKeywords, analyzeSemanticConflicts, assessConflictSeverity, computeSessionStaleness, syncPulseToClaims, getPresenceSummary, runAmbientScan, } from './ambient-coordinator.js';
|
|
2
|
+
export type { AmbientStatus } from './ambient-coordinator.js';
|
|
3
|
+
export { generateFileOverlapWarnings, generateSeverityWarnings, generateStalenessWarnings, deduplicateWarningsByPair, throttleWarnings, formatWarnings, loadThrottleState, saveThrottleState, warningHash, warningDedupKey, coalesceWarnings, } from './warning-throttle.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { discoverSessions, extractIntentKeywords, analyzeSemanticConflicts, assessConflictSeverity, computeSessionStaleness, syncPulseToClaims, getPresenceSummary, runAmbientScan, } from './ambient-coordinator.js';
|
|
2
|
+
export { generateFileOverlapWarnings, generateSeverityWarnings, generateStalenessWarnings, deduplicateWarningsByPair, throttleWarnings, formatWarnings, loadThrottleState, saveThrottleState, warningHash, warningDedupKey, coalesceWarnings, } from './warning-throttle.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ConflictWarning, WarningThrottleState, ConflictZone, ConflictSeverityAssessment, ShadowUpdate } from '@codeledger/types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate conflict warnings from file overlap zones.
|
|
4
|
+
*
|
|
5
|
+
* Hardened: severity is based on overlapping file count with graduated thresholds.
|
|
6
|
+
* Only MEDIUM+ severity overlaps generate warnings (1-file overlap = LOW = silent).
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateFileOverlapWarnings(sessionId: string, zones: ConflictZone[]): ConflictWarning[];
|
|
9
|
+
/** Generate warnings from severity assessments (MEDIUM+ only) */
|
|
10
|
+
export declare function generateSeverityWarnings(sessionId: string, assessments: ConflictSeverityAssessment[]): ConflictWarning[];
|
|
11
|
+
/**
|
|
12
|
+
* Generate staleness warnings.
|
|
13
|
+
*
|
|
14
|
+
* Hardened: only generates warnings for MEDIUM+ staleness.
|
|
15
|
+
* LOW staleness is too noisy for user-facing warnings — it is recorded
|
|
16
|
+
* in the PRCheckResult for programmatic consumers but not surfaced.
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateStalenessWarnings(updates: ShadowUpdate[]): ConflictWarning[];
|
|
19
|
+
/**
|
|
20
|
+
* Merge overlapping warnings for the same session pair.
|
|
21
|
+
* Prevents both a file-overlap warning and a severity warning for the
|
|
22
|
+
* same pair from reaching the user — keeps only the higher-severity one.
|
|
23
|
+
*/
|
|
24
|
+
export declare function deduplicateWarningsByPair(warnings: ConflictWarning[]): ConflictWarning[];
|
|
25
|
+
/**
|
|
26
|
+
* Compute a content hash for a warning (for dedup).
|
|
27
|
+
* Hardened: includes severity in hash so severity changes bypass throttle.
|
|
28
|
+
*/
|
|
29
|
+
export declare function warningHash(warning: ConflictWarning): string;
|
|
30
|
+
/**
|
|
31
|
+
* Compute a dedup key for a warning based on type and session pair.
|
|
32
|
+
*/
|
|
33
|
+
export declare function warningDedupKey(warning: ConflictWarning): string;
|
|
34
|
+
/**
|
|
35
|
+
* Coalesce redundant warnings for the same session pair.
|
|
36
|
+
* Alias for deduplicateWarningsByPair.
|
|
37
|
+
*/
|
|
38
|
+
export declare const coalesceWarnings: typeof deduplicateWarningsByPair;
|
|
39
|
+
/** Load throttle state from disk */
|
|
40
|
+
export declare function loadThrottleState(repoRoot: string, sessionId?: string): WarningThrottleState;
|
|
41
|
+
/** Save throttle state to disk */
|
|
42
|
+
export declare function saveThrottleState(repoRoot: string, state: WarningThrottleState, sessionId?: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Filter warnings through throttle/dedup.
|
|
45
|
+
* Returns only warnings that should be shown to the user.
|
|
46
|
+
*
|
|
47
|
+
* Hardened algorithm:
|
|
48
|
+
* 1. Deduplicate by session pair (one-warning-per-surface)
|
|
49
|
+
* 2. Apply severity-aware cooldown windows
|
|
50
|
+
* 3. Same-signal suppression (skip if material content unchanged)
|
|
51
|
+
* 4. Severity escalation bypass (always show if severity increased)
|
|
52
|
+
*/
|
|
53
|
+
export declare function throttleWarnings(repoRoot: string, warnings: ConflictWarning[], throttleIntervalMs?: number, sessionId?: string): ConflictWarning[];
|
|
54
|
+
/**
|
|
55
|
+
* Format warnings as human-readable lines.
|
|
56
|
+
*
|
|
57
|
+
* Hardened tone: measured, technical, precise.
|
|
58
|
+
* - HIGH → "Warning" (not "CRITICAL" or "ALERT")
|
|
59
|
+
* - MEDIUM → "Notice"
|
|
60
|
+
* - LOW → "Info"
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatWarnings(warnings: ConflictWarning[]): string[];
|
|
63
|
+
//# sourceMappingURL=warning-throttle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warning-throttle.d.ts","sourceRoot":"","sources":["../../src/integration/warning-throttle.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EAEpB,YAAY,EACZ,0BAA0B,EAC1B,YAAY,EAEb,MAAM,mBAAmB,CAAC;AA6B3B;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,YAAY,EAAE,GACpB,eAAe,EAAE,CA0CnB;AAED,iEAAiE;AACjE,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,0BAA0B,EAAE,GACxC,eAAe,EAAE,CA6BnB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,YAAY,EAAE,GACtB,eAAe,EAAE,CAqCnB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAiCxF;AAID;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAO5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAGhE;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,kCAA4B,CAAC;AAgB1D,oCAAoC;AACpC,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAgB5F;AAED,kCAAkC;AAClC,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,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