@aiassesstech/jessie 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ea/calendar-conflicts.d.ts +30 -0
- package/dist/ea/calendar-conflicts.d.ts.map +1 -0
- package/dist/ea/calendar-conflicts.js +70 -0
- package/dist/ea/calendar-conflicts.js.map +1 -0
- package/dist/ea/correspondence-client.d.ts +54 -0
- package/dist/ea/correspondence-client.d.ts.map +1 -0
- package/dist/ea/correspondence-client.js +88 -0
- package/dist/ea/correspondence-client.js.map +1 -0
- package/dist/ea/daily-notes.d.ts +38 -0
- package/dist/ea/daily-notes.d.ts.map +1 -0
- package/dist/ea/daily-notes.js +93 -0
- package/dist/ea/daily-notes.js.map +1 -0
- package/dist/ea/ea-sweep.d.ts +49 -0
- package/dist/ea/ea-sweep.d.ts.map +1 -0
- package/dist/ea/ea-sweep.js +93 -0
- package/dist/ea/ea-sweep.js.map +1 -0
- package/dist/ea/fleet-attention-gate.d.ts +33 -0
- package/dist/ea/fleet-attention-gate.d.ts.map +1 -0
- package/dist/ea/fleet-attention-gate.js +46 -0
- package/dist/ea/fleet-attention-gate.js.map +1 -0
- package/dist/ea/gog-health.d.ts +34 -0
- package/dist/ea/gog-health.d.ts.map +1 -0
- package/dist/ea/gog-health.js +68 -0
- package/dist/ea/gog-health.js.map +1 -0
- package/dist/ea/index.d.ts +19 -0
- package/dist/ea/index.d.ts.map +1 -0
- package/dist/ea/index.js +13 -0
- package/dist/ea/index.js.map +1 -0
- package/dist/ea/sweep-state.d.ts +53 -0
- package/dist/ea/sweep-state.d.ts.map +1 -0
- package/dist/ea/sweep-state.js +145 -0
- package/dist/ea/sweep-state.js.map +1 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +228 -2
- package/dist/plugin.js.map +1 -1
- package/dist/tools/jessie-wiki.d.ts +22 -1
- package/dist/tools/jessie-wiki.d.ts.map +1 -1
- package/dist/tools/jessie-wiki.js +21 -2
- package/dist/tools/jessie-wiki.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar Conflict Detection — EA Infrastructure
|
|
3
|
+
*
|
|
4
|
+
* SPEC: SPEC-jessie-executive-assistant-activation-v1.0 §3.2
|
|
5
|
+
*
|
|
6
|
+
* During each sweep, checks next 24h of calendar events for
|
|
7
|
+
* double-bookings and back-to-back meetings without buffer.
|
|
8
|
+
*/
|
|
9
|
+
export interface CalendarEvent {
|
|
10
|
+
id: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
start: string;
|
|
13
|
+
end: string;
|
|
14
|
+
attendees?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface CalendarConflict {
|
|
17
|
+
type: 'double-booking' | 'no-buffer';
|
|
18
|
+
events: [CalendarEvent, CalendarEvent];
|
|
19
|
+
description: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Detect scheduling conflicts: overlapping events or back-to-back
|
|
23
|
+
* meetings with less than 10 minutes buffer.
|
|
24
|
+
*/
|
|
25
|
+
export declare function detectConflicts(events: CalendarEvent[]): CalendarConflict[];
|
|
26
|
+
/**
|
|
27
|
+
* Format conflicts for Greg's channel message.
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatConflictAlert(conflicts: CalendarConflict[]): string;
|
|
30
|
+
//# sourceMappingURL=calendar-conflicts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-conflicts.d.ts","sourceRoot":"","sources":["../../src/ea/calendar-conflicts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,gBAAgB,GAAG,WAAW,CAAC;IACrC,MAAM,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;CACrB;AAID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,gBAAgB,EAAE,CA8C3E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAYzE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar Conflict Detection — EA Infrastructure
|
|
3
|
+
*
|
|
4
|
+
* SPEC: SPEC-jessie-executive-assistant-activation-v1.0 §3.2
|
|
5
|
+
*
|
|
6
|
+
* During each sweep, checks next 24h of calendar events for
|
|
7
|
+
* double-bookings and back-to-back meetings without buffer.
|
|
8
|
+
*/
|
|
9
|
+
const MIN_BUFFER_MINUTES = 10;
|
|
10
|
+
/**
|
|
11
|
+
* Detect scheduling conflicts: overlapping events or back-to-back
|
|
12
|
+
* meetings with less than 10 minutes buffer.
|
|
13
|
+
*/
|
|
14
|
+
export function detectConflicts(events) {
|
|
15
|
+
if (events.length < 2)
|
|
16
|
+
return [];
|
|
17
|
+
const sorted = [...events].sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
|
|
18
|
+
const conflicts = [];
|
|
19
|
+
for (let i = 0; i < sorted.length - 1; i++) {
|
|
20
|
+
const current = sorted[i];
|
|
21
|
+
const next = sorted[i + 1];
|
|
22
|
+
const currentEnd = new Date(current.end).getTime();
|
|
23
|
+
const nextStart = new Date(next.start).getTime();
|
|
24
|
+
const currentStart = new Date(current.start).getTime();
|
|
25
|
+
const nextEnd = new Date(next.end).getTime();
|
|
26
|
+
if (currentEnd > nextStart) {
|
|
27
|
+
if (currentStart === nextStart && currentEnd === nextEnd) {
|
|
28
|
+
conflicts.push({
|
|
29
|
+
type: 'double-booking',
|
|
30
|
+
events: [current, next],
|
|
31
|
+
description: `"${current.summary}" and "${next.summary}" are at the same time`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
conflicts.push({
|
|
36
|
+
type: 'double-booking',
|
|
37
|
+
events: [current, next],
|
|
38
|
+
description: `"${current.summary}" overlaps with "${next.summary}"`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const bufferMinutes = (nextStart - currentEnd) / (1000 * 60);
|
|
44
|
+
if (bufferMinutes < MIN_BUFFER_MINUTES) {
|
|
45
|
+
conflicts.push({
|
|
46
|
+
type: 'no-buffer',
|
|
47
|
+
events: [current, next],
|
|
48
|
+
description: `"${current.summary}" ends ${bufferMinutes.toFixed(0)} min before "${next.summary}" starts ` +
|
|
49
|
+
`(< ${MIN_BUFFER_MINUTES} min buffer)`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return conflicts;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Format conflicts for Greg's channel message.
|
|
58
|
+
*/
|
|
59
|
+
export function formatConflictAlert(conflicts) {
|
|
60
|
+
if (conflicts.length === 0)
|
|
61
|
+
return '';
|
|
62
|
+
const lines = ['**Calendar Conflicts Detected:**\n'];
|
|
63
|
+
for (const c of conflicts) {
|
|
64
|
+
const icon = c.type === 'double-booking' ? '🔴' : '🟡';
|
|
65
|
+
lines.push(`${icon} ${c.description}`);
|
|
66
|
+
}
|
|
67
|
+
lines.push('\nPlease resolve or let me know if you want me to reschedule.');
|
|
68
|
+
return lines.join('\n');
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=calendar-conflicts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-conflicts.js","sourceRoot":"","sources":["../../src/ea/calendar-conflicts.ts"],"names":[],"mappings":"AAAA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AC,GAAG,IAAI,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;IAC5E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Correspondence Assessment Client — EA → Grillo Integration
|
|
3
|
+
*
|
|
4
|
+
* SPEC: SPEC-jessie-executive-assistant-activation-v1.0 §3.1.1 (Amendment 2 — CRITICAL)
|
|
5
|
+
* SPEC: SPEC-grillo-correspondence-rubric-v1.0 §5.1, §5.4
|
|
6
|
+
*
|
|
7
|
+
* Sends drafts to Grillo for LCSH micro-rubric assessment via
|
|
8
|
+
* fleet-bus. Handles all four verdict paths and the degradation
|
|
9
|
+
* policy (2 consecutive timeouts → stop submitting, batch escalation).
|
|
10
|
+
*
|
|
11
|
+
* Unidirectional constraint: payload contains ONLY draft text,
|
|
12
|
+
* recipient context, and action type. No hints about desired outcome.
|
|
13
|
+
*/
|
|
14
|
+
import type { CorrespondenceActionType, RecipientPLevel } from '@aiassesstech/fleet-bus';
|
|
15
|
+
import type { EaSweepState } from './sweep-state.js';
|
|
16
|
+
export type CorrespondenceVerdict = 'GREEN' | 'YELLOW' | 'RED' | 'RECUSE';
|
|
17
|
+
export interface CorrespondenceAssessmentResult {
|
|
18
|
+
verdict: CorrespondenceVerdict;
|
|
19
|
+
reasoning: string;
|
|
20
|
+
assessmentHash: string;
|
|
21
|
+
rubricVersion: string;
|
|
22
|
+
durationMs: number;
|
|
23
|
+
dimensionFlags: {
|
|
24
|
+
lying: string;
|
|
25
|
+
cheating: string;
|
|
26
|
+
stealing: string;
|
|
27
|
+
harm: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface CorrespondenceClientDeps {
|
|
31
|
+
fleetSend: (options: {
|
|
32
|
+
to: string;
|
|
33
|
+
method: string;
|
|
34
|
+
params: Record<string, unknown>;
|
|
35
|
+
}) => Promise<{
|
|
36
|
+
success: boolean;
|
|
37
|
+
reply?: string;
|
|
38
|
+
}>;
|
|
39
|
+
sweepState: EaSweepState;
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Submit a draft for Grillo LCSH correspondence assessment.
|
|
44
|
+
*
|
|
45
|
+
* Returns the assessment result, or null if Grillo is unavailable
|
|
46
|
+
* or the degradation policy is active.
|
|
47
|
+
*/
|
|
48
|
+
export declare function assessDraft(draft: string, recipientPLevel: RecipientPLevel, actionType: CorrespondenceActionType, deps: CorrespondenceClientDeps, threadContext?: string): Promise<CorrespondenceAssessmentResult | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Send a synthetic probe to Grillo to test recovery from degradation.
|
|
51
|
+
* SPEC §5.4: known-GREEN test draft, not a real message.
|
|
52
|
+
*/
|
|
53
|
+
export declare function probeGrilloRecovery(deps: CorrespondenceClientDeps): Promise<boolean>;
|
|
54
|
+
//# sourceMappingURL=correspondence-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correspondence-client.d.ts","sourceRoot":"","sources":["../../src/ea/correspondence-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAGV,wBAAwB,EACxB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE1E,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,qBAAqB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACrF;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,CAAC,OAAO,EAAE;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjC,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,UAAU,EAAE,YAAY,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,wBAAwB,EACpC,IAAI,EAAE,wBAAwB,EAC9B,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,8BAA8B,GAAG,IAAI,CAAC,CA6DhD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,OAAO,CAAC,CAclB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Correspondence Assessment Client — EA → Grillo Integration
|
|
3
|
+
*
|
|
4
|
+
* SPEC: SPEC-jessie-executive-assistant-activation-v1.0 §3.1.1 (Amendment 2 — CRITICAL)
|
|
5
|
+
* SPEC: SPEC-grillo-correspondence-rubric-v1.0 §5.1, §5.4
|
|
6
|
+
*
|
|
7
|
+
* Sends drafts to Grillo for LCSH micro-rubric assessment via
|
|
8
|
+
* fleet-bus. Handles all four verdict paths and the degradation
|
|
9
|
+
* policy (2 consecutive timeouts → stop submitting, batch escalation).
|
|
10
|
+
*
|
|
11
|
+
* Unidirectional constraint: payload contains ONLY draft text,
|
|
12
|
+
* recipient context, and action type. No hints about desired outcome.
|
|
13
|
+
*/
|
|
14
|
+
const DEFAULT_TIMEOUT_MS = 12_000;
|
|
15
|
+
/**
|
|
16
|
+
* Submit a draft for Grillo LCSH correspondence assessment.
|
|
17
|
+
*
|
|
18
|
+
* Returns the assessment result, or null if Grillo is unavailable
|
|
19
|
+
* or the degradation policy is active.
|
|
20
|
+
*/
|
|
21
|
+
export async function assessDraft(draft, recipientPLevel, actionType, deps, threadContext) {
|
|
22
|
+
if (deps.sweepState.isGrilloDegraded()) {
|
|
23
|
+
deps.sweepState.recordGrilloAssessment('unavailable');
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const params = {
|
|
27
|
+
draft,
|
|
28
|
+
recipientPLevel,
|
|
29
|
+
actionType,
|
|
30
|
+
};
|
|
31
|
+
if (threadContext) {
|
|
32
|
+
params.threadContext = threadContext;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const result = await Promise.race([
|
|
36
|
+
deps.fleetSend({
|
|
37
|
+
to: 'grillo',
|
|
38
|
+
method: 'correspondence/assess',
|
|
39
|
+
params: params,
|
|
40
|
+
}),
|
|
41
|
+
timeout(deps.timeoutMs ?? DEFAULT_TIMEOUT_MS),
|
|
42
|
+
]);
|
|
43
|
+
if (!result || !result.success || !result.reply) {
|
|
44
|
+
deps.sweepState.recordGrilloAssessment('unavailable');
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
let parsed;
|
|
48
|
+
try {
|
|
49
|
+
parsed = JSON.parse(result.reply);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
deps.sweepState.recordGrilloAssessment('unavailable');
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const verdictLower = parsed.verdict.toLowerCase();
|
|
56
|
+
deps.sweepState.recordGrilloAssessment(verdictLower, parsed.assessmentHash, parsed.rubricVersion);
|
|
57
|
+
return {
|
|
58
|
+
verdict: parsed.verdict,
|
|
59
|
+
reasoning: parsed.reasoning,
|
|
60
|
+
assessmentHash: parsed.assessmentHash,
|
|
61
|
+
rubricVersion: parsed.rubricVersion,
|
|
62
|
+
durationMs: parsed.durationMs,
|
|
63
|
+
dimensionFlags: parsed.dimensionFlags,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
deps.sweepState.recordGrilloAssessment('unavailable');
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Send a synthetic probe to Grillo to test recovery from degradation.
|
|
73
|
+
* SPEC §5.4: known-GREEN test draft, not a real message.
|
|
74
|
+
*/
|
|
75
|
+
export async function probeGrilloRecovery(deps) {
|
|
76
|
+
const result = await assessDraft('Test probe — please disregard. Scheduling confirmation for internal meeting.', 'P3', 'auto-resolve-email', deps);
|
|
77
|
+
if (result && result.verdict === 'GREEN' && result.durationMs < 3500) {
|
|
78
|
+
deps.sweepState.clearGrilloDegraded();
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
function timeout(ms) {
|
|
84
|
+
return new Promise((_, reject) => {
|
|
85
|
+
setTimeout(() => reject(new Error('Grillo assessment timeout')), ms);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=correspondence-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correspondence-client.js","sourceRoot":"","sources":["../../src/ea/correspondence-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA+BH,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAa,EACb,eAAgC,EAChC,UAAoC,EACpC,IAA8B,EAC9B,aAAsB;IAEtB,IAAI,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC,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,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,cAAc,EAAE,MAAM,CAAC,cAAc;SACtC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAA8B;IAE9B,MAAM,MAAM,GAAG,MAAM,WAAW,CAC9B,8EAA8E,EAC9E,IAAI,EACJ,oBAAoB,EACpB,IAAI,CACL,CAAC;IAEF,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO,IAAI,MAAM,CAAC,UAAU,GAAG,IAAI,EAAE,CAAC;QACrE,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,OAAO,CAAC,EAAU;IACzB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QAC/B,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daily Notes Layer — EA Incremental Logging
|
|
3
|
+
*
|
|
4
|
+
* SPEC: SPEC-jessie-executive-assistant-activation-v1.0 §6.1 (Amendment 5)
|
|
5
|
+
*
|
|
6
|
+
* One file per day, written incrementally by EA sweeps, meeting
|
|
7
|
+
* ingestion, corrections, and fleet events. Foundation for evening
|
|
8
|
+
* sweep, kaizen, and morning briefing Step 10.
|
|
9
|
+
*/
|
|
10
|
+
export declare class DailyNotes {
|
|
11
|
+
private readonly baseDir;
|
|
12
|
+
private readonly timezone;
|
|
13
|
+
constructor(workspaceDir: string, timezone?: string);
|
|
14
|
+
private filePath;
|
|
15
|
+
private ensureDir;
|
|
16
|
+
private ensureFile;
|
|
17
|
+
/**
|
|
18
|
+
* Append an entry to today's daily notes file.
|
|
19
|
+
*/
|
|
20
|
+
append(section: string, content: string, date?: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Read today's daily notes.
|
|
23
|
+
*/
|
|
24
|
+
readToday(): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Check if today's notes file exists and has been modified today.
|
|
27
|
+
*/
|
|
28
|
+
todayExists(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Roll over: close today's file and create tomorrow's skeleton.
|
|
31
|
+
* Called by jessie-daily-notes-rollover cron at 23:59 CT.
|
|
32
|
+
*/
|
|
33
|
+
rollover(): {
|
|
34
|
+
closedDate: string;
|
|
35
|
+
openedDate: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=daily-notes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daily-notes.d.ts","sourceRoot":"","sources":["../../src/ea/daily-notes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkBH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,YAAY,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA0B;IAKtE,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;IAWlB;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAO7D;;OAEG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAM1B;;OAEG;IACH,WAAW,IAAI,OAAO;IAKtB;;;OAGG;IACH,QAAQ,IAAI;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;CAiBvD"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daily Notes Layer — EA Incremental Logging
|
|
3
|
+
*
|
|
4
|
+
* SPEC: SPEC-jessie-executive-assistant-activation-v1.0 §6.1 (Amendment 5)
|
|
5
|
+
*
|
|
6
|
+
* One file per day, written incrementally by EA sweeps, meeting
|
|
7
|
+
* ingestion, corrections, and fleet events. Foundation for evening
|
|
8
|
+
* sweep, kaizen, and morning briefing Step 10.
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
function todayString(tz = 'America/Chicago') {
|
|
13
|
+
return new Date().toLocaleDateString('en-CA', { timeZone: tz });
|
|
14
|
+
}
|
|
15
|
+
function timeString(tz = 'America/Chicago') {
|
|
16
|
+
return new Date().toLocaleTimeString('en-US', {
|
|
17
|
+
timeZone: tz,
|
|
18
|
+
hour: '2-digit',
|
|
19
|
+
minute: '2-digit',
|
|
20
|
+
hour12: false,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export class DailyNotes {
|
|
24
|
+
baseDir;
|
|
25
|
+
timezone;
|
|
26
|
+
constructor(workspaceDir, timezone = 'America/Chicago') {
|
|
27
|
+
this.baseDir = path.join(workspaceDir, 'agent', 'daily-notes');
|
|
28
|
+
this.timezone = timezone;
|
|
29
|
+
}
|
|
30
|
+
filePath(date) {
|
|
31
|
+
const d = date ?? todayString(this.timezone);
|
|
32
|
+
return path.join(this.baseDir, `${d}.md`);
|
|
33
|
+
}
|
|
34
|
+
ensureDir() {
|
|
35
|
+
if (!fs.existsSync(this.baseDir)) {
|
|
36
|
+
fs.mkdirSync(this.baseDir, { recursive: true });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
ensureFile(date) {
|
|
40
|
+
this.ensureDir();
|
|
41
|
+
const fp = this.filePath(date);
|
|
42
|
+
if (!fs.existsSync(fp)) {
|
|
43
|
+
const d = date ?? todayString(this.timezone);
|
|
44
|
+
const skeleton = `# Daily Notes — ${d}\n\n`;
|
|
45
|
+
fs.writeFileSync(fp, skeleton, 'utf-8');
|
|
46
|
+
}
|
|
47
|
+
return fp;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Append an entry to today's daily notes file.
|
|
51
|
+
*/
|
|
52
|
+
append(section, content, date) {
|
|
53
|
+
const fp = this.ensureFile(date);
|
|
54
|
+
const time = timeString(this.timezone);
|
|
55
|
+
const entry = `\n## ${section} (${time})\n\n${content}\n`;
|
|
56
|
+
fs.appendFileSync(fp, entry, 'utf-8');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Read today's daily notes.
|
|
60
|
+
*/
|
|
61
|
+
readToday() {
|
|
62
|
+
const fp = this.filePath();
|
|
63
|
+
if (!fs.existsSync(fp))
|
|
64
|
+
return null;
|
|
65
|
+
return fs.readFileSync(fp, 'utf-8');
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Check if today's notes file exists and has been modified today.
|
|
69
|
+
*/
|
|
70
|
+
todayExists() {
|
|
71
|
+
const fp = this.filePath();
|
|
72
|
+
return fs.existsSync(fp);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Roll over: close today's file and create tomorrow's skeleton.
|
|
76
|
+
* Called by jessie-daily-notes-rollover cron at 23:59 CT.
|
|
77
|
+
*/
|
|
78
|
+
rollover() {
|
|
79
|
+
const today = todayString(this.timezone);
|
|
80
|
+
this.ensureFile(today);
|
|
81
|
+
const todayFp = this.filePath(today);
|
|
82
|
+
const existing = fs.readFileSync(todayFp, 'utf-8');
|
|
83
|
+
if (!existing.includes('--- End of Day ---')) {
|
|
84
|
+
fs.appendFileSync(todayFp, '\n---\n\n*--- End of Day ---*\n', 'utf-8');
|
|
85
|
+
}
|
|
86
|
+
const tomorrow = new Date();
|
|
87
|
+
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
88
|
+
const tomorrowStr = tomorrow.toLocaleDateString('en-CA', { timeZone: this.timezone });
|
|
89
|
+
this.ensureFile(tomorrowStr);
|
|
90
|
+
return { closedDate: today, openedDate: tomorrowStr };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=daily-notes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daily-notes.js","sourceRoot":"","sources":["../../src/ea/daily-notes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,SAAS,WAAW,CAAC,KAAa,iBAAiB;IACjD,OAAO,IAAI,IAAI,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,iBAAiB;IAChD,OAAO,IAAI,IAAI,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC5C,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,OAAO,UAAU;IACJ,OAAO,CAAS;IAChB,QAAQ,CAAS;IAElC,YAAY,YAAoB,EAAE,WAAmB,iBAAiB;QACpE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEO,QAAQ,CAAC,IAAa;QAC5B,MAAM,CAAC,GAAG,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,OAAO,IAAI,CA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
5
|
+
*
|
|
6
|
+
* Top-level sweep function invoked by cron. Coordinates:
|
|
7
|
+
* 1. Fleet Attention Gate
|
|
8
|
+
* 2. GOG Health Gate
|
|
9
|
+
* 3. Inbox/calendar triage
|
|
10
|
+
* 4. Calendar conflict detection
|
|
11
|
+
* 5. Grillo draft assessment
|
|
12
|
+
* 6. Sweep state persistence
|
|
13
|
+
* 7. Daily notes logging
|
|
14
|
+
*/
|
|
15
|
+
import type { DecisionStore } from '../command/decision-store.js';
|
|
16
|
+
import type { EaSweepState } from './sweep-state.js';
|
|
17
|
+
import type { DailyNotes } from './daily-notes.js';
|
|
18
|
+
import type { CalendarEvent } from './calendar-conflicts.js';
|
|
19
|
+
export interface EaSweepDeps {
|
|
20
|
+
decisionStore: DecisionStore;
|
|
21
|
+
sweepState: EaSweepState;
|
|
22
|
+
dailyNotes: DailyNotes;
|
|
23
|
+
getFleetBusStatus: () => string;
|
|
24
|
+
getRecentFleetAlerts?: () => Array<{
|
|
25
|
+
method: string;
|
|
26
|
+
severity?: string;
|
|
27
|
+
timestamp: string;
|
|
28
|
+
}>;
|
|
29
|
+
gogBinaryPath?: string;
|
|
30
|
+
fetchCalendarEvents?: () => Promise<CalendarEvent[]>;
|
|
31
|
+
notifyGreg: (message: string, label: string) => Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export interface EaSweepResult {
|
|
34
|
+
deferred: boolean;
|
|
35
|
+
deferralReason?: string;
|
|
36
|
+
gogHealthy: boolean;
|
|
37
|
+
gogTransition?: 'first_failure' | 'recovered';
|
|
38
|
+
conflictsDetected: number;
|
|
39
|
+
messagesProcessed: number;
|
|
40
|
+
skippedReason?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Execute one EA sweep cycle.
|
|
44
|
+
*
|
|
45
|
+
* Returns structured result for cron handler to decide
|
|
46
|
+
* whether to send cron/completed or cron/failed.
|
|
47
|
+
*/
|
|
48
|
+
export declare function runEaSweep(deps: EaSweepDeps): Promise<EaSweepRes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;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAoG1E"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EA Sweep Orchestrator — Core Workflow
|
|
3
|
+
*
|
|
4
|
+
* SPEC: SPEC-jessie-executive-assistant-activation-v1.0 §3.1
|
|
5
|
+
*
|
|
6
|
+
* Top-level sweep function invoked by cron. Coordinates:
|
|
7
|
+
* 1. Fleet Attention Gate
|
|
8
|
+
* 2. GOG Health Gate
|
|
9
|
+
* 3. Inbox/calendar triage
|
|
10
|
+
* 4. Calendar conflict detection
|
|
11
|
+
* 5. Grillo draft assessment
|
|
12
|
+
* 6. Sweep state persistence
|
|
13
|
+
* 7. Daily notes logging
|
|
14
|
+
*/
|
|
15
|
+
import { checkFleetAttention } from './fleet-attention-gate.js';
|
|
16
|
+
import { checkGogHealth, markGogNotified } from './gog-health.js';
|
|
17
|
+
import { detectConflicts, formatConflictAlert } from './calendar-conflicts.js';
|
|
18
|
+
/**
|
|
19
|
+
* Execute one EA sweep cycle.
|
|
20
|
+
*
|
|
21
|
+
* Returns structured result for cron handler to decide
|
|
22
|
+
* whether to send cron/completed or cron/failed.
|
|
23
|
+
*/
|
|
24
|
+
export async function runEaSweep(deps) {
|
|
25
|
+
const { decisionStore, sweepState, dailyNotes, getFleetBusStatus, getRecentFleetAlerts, gogBinaryPath, fetchCalendarEvents, notifyGreg, } = deps;
|
|
26
|
+
const fleetCheck = checkFleetAttention({
|
|
27
|
+
decisionStore,
|
|
28
|
+
getFleetBusStatus,
|
|
29
|
+
getRecentFleetAlerts,
|
|
30
|
+
});
|
|
31
|
+
if (fleetCheck.deferred) {
|
|
32
|
+
sweepState.setFleetDeferred(true, fleetCheck.reason);
|
|
33
|
+
sweepState.save();
|
|
34
|
+
console.log(`[jessie] EA deferred: fleet attention required — ${fleetCheck.reason}`);
|
|
35
|
+
dailyNotes.append('EA Sweep — Deferred', `Fleet Attention Gate triggered: ${fleetCheck.reason}`);
|
|
36
|
+
return {
|
|
37
|
+
deferred: true,
|
|
38
|
+
deferralReason: fleetCheck.reason,
|
|
39
|
+
gogHealthy: sweepState.state.gogHealthy,
|
|
40
|
+
conflictsDetected: 0,
|
|
41
|
+
messagesProcessed: 0,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
sweepState.setFleetDeferred(false);
|
|
45
|
+
const gogResult = checkGogHealth(gogBinaryPath);
|
|
46
|
+
sweepState.setGogHealthy(gogResult.healthy);
|
|
47
|
+
let gogTransition;
|
|
48
|
+
if (gogResult.firstFailure) {
|
|
49
|
+
gogTransition = 'first_failure';
|
|
50
|
+
await notifyGreg('[jessie] GOG unavailable — EA layer degraded. Re-auth with: gog auth login', 'ea:gog-failure');
|
|
51
|
+
markGogNotified();
|
|
52
|
+
console.log('[jessie] EA sweep: GOG unavailable, skipping inbox/calendar');
|
|
53
|
+
dailyNotes.append('EA Sweep — GOG Down', 'GOG auth unavailable. Skipping inbox/calendar.');
|
|
54
|
+
}
|
|
55
|
+
if (gogResult.recovered) {
|
|
56
|
+
gogTransition = 'recovered';
|
|
57
|
+
await notifyGreg('[jessie] GOG restored — EA layer operational.', 'ea:gog-recovered');
|
|
58
|
+
markGogNotified();
|
|
59
|
+
dailyNotes.append('EA Sweep — GOG Restored', 'GOG auth restored. Resuming full operations.');
|
|
60
|
+
}
|
|
61
|
+
let conflictsDetected = 0;
|
|
62
|
+
if (gogResult.healthy && fetchCalendarEvents) {
|
|
63
|
+
try {
|
|
64
|
+
const events = await fetchCalendarEvents();
|
|
65
|
+
const conflicts = detectConflicts(events);
|
|
66
|
+
conflictsDetected = conflicts.length;
|
|
67
|
+
if (conflicts.length > 0) {
|
|
68
|
+
const alert = formatConflictAlert(conflicts);
|
|
69
|
+
await notifyGreg(alert, 'ea:calendar-conflicts');
|
|
70
|
+
dailyNotes.append('Calendar Conflicts', `Detected ${conflicts.length} conflict(s):\n${alert}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
console.warn('[jessie] EA sweep: calendar check failed:', err);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
sweepState.recordSweep({});
|
|
78
|
+
sweepState.pruneOldMessages();
|
|
79
|
+
sweepState.save();
|
|
80
|
+
dailyNotes.append('EA Sweep — Complete', [
|
|
81
|
+
`GOG healthy: ${gogResult.healthy}`,
|
|
82
|
+
`Conflicts: ${conflictsDetected}`,
|
|
83
|
+
`Fleet deferred: false`,
|
|
84
|
+
].join(' | '));
|
|
85
|
+
return {
|
|
86
|
+
deferred: false,
|
|
87
|
+
gogHealthy: gogResult.healthy,
|
|
88
|
+
gogTransition,
|
|
89
|
+
conflictsDetected,
|
|
90
|
+
messagesProcessed: 0,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=ea-sweep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ea-sweep.js","sourceRoot":"","sources":["../../src/ea/ea-sweep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAwB/E;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAiB;IAChD,MAAM,EACJ,aAAa,EACb,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,UAAU,GACX,GAAG,IAAI,CAAC;IAET,MAAM,UAAU,GAAG,mBAAmB,CAAC;QACrC,aAAa;QACb,iBAAiB;QACjB,oBAAoB;KACrB,CAAC,CAAC;IAEH,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,U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
|
5
|
+
* Patent: Patent 8 (Self-Governing Ecosystem)
|
|
6
|
+
*
|
|
7
|
+
* Before every EA sweep, Jessie MUST check fleet state. Commander
|
|
8
|
+
* duties are constitutional obligations that cannot be preempted
|
|
9
|
+
* or starved by EA cron jobs. If any fleet-critical event requires
|
|
10
|
+
* Commander attention, the EA sweep defers entirely.
|
|
11
|
+
*/
|
|
12
|
+
import type { DecisionStore } from '../command/decision-store.js';
|
|
13
|
+
export interface FleetAttentionResult {
|
|
14
|
+
deferred: boolean;
|
|
15
|
+
reason?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FleetAttentionDeps {
|
|
18
|
+
decisionStore: DecisionStore;
|
|
19
|
+
getFleetBusStatus: () => string;
|
|
20
|
+
getRecentFleetAlerts?: () => Array<{
|
|
21
|
+
method: string;
|
|
22
|
+
severity?: string;
|
|
23
|
+
timestamp: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check whether fleet-critical events require Commander attention.
|
|
28
|
+
*
|
|
29
|
+
* Returns { deferred: true, reason } if EA should defer,
|
|
30
|
+
* or { deferred: false } if EA can proceed.
|
|
31
|
+
*/
|
|
32
|
+
export declare function checkFleetAttention(deps: FleetAttentionDeps): FleetAttentionResult;
|
|
33
|
+
//# sourceMappingURL=fleet-attention-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleet-attention-gate.d.ts","sourceRoot":"","sources":["../../src/ea/fleet-attention-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,iBAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9F;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,kBAAkB,GAAG,oBAAoB,CAoClF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fleet Attention Gate — Constitutional EA Foundation
|
|
3
|
+
*
|
|
4
|
+
* SPEC: SPEC-jessie-executive-assistant-activation-v1.0 §3.0 (Amendment 1 — CRITICAL)
|
|
5
|
+
* Patent: Patent 8 (Self-Governing Ecosystem)
|
|
6
|
+
*
|
|
7
|
+
* Before every EA sweep, Jessie MUST check fleet state. Commander
|
|
8
|
+
* duties are constitutional obligations that cannot be preempted
|
|
9
|
+
* or starved by EA cron jobs. If any fleet-critical event requires
|
|
10
|
+
* Commander attention, the EA sweep defers entirely.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Check whether fleet-critical events require Commander attention.
|
|
14
|
+
*
|
|
15
|
+
* Returns { deferred: true, reason } if EA should defer,
|
|
16
|
+
* or { deferred: false } if EA can proceed.
|
|
17
|
+
*/
|
|
18
|
+
export function checkFleetAttention(deps) {
|
|
19
|
+
const { decisionStore, getFleetBusStatus, getRecentFleetAlerts } = deps;
|
|
20
|
+
if (getFleetBusStatus() === 'standalone') {
|
|
21
|
+
return { deferred: false };
|
|
22
|
+
}
|
|
23
|
+
const pending = decisionStore.getPendingProposals();
|
|
24
|
+
const urgentProposals = pending.filter((p) => p.riskLevel === 'high' || p.riskLevel === 'critical');
|
|
25
|
+
if (urgentProposals.length > 0) {
|
|
26
|
+
return {
|
|
27
|
+
deferred: true,
|
|
28
|
+
reason: `${urgentProposals.length} pending high/critical proposal(s) require Commander review`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (getRecentFleetAlerts) {
|
|
32
|
+
const alerts = getRecentFleetAlerts();
|
|
33
|
+
const critical = alerts.filter((a) => a.method === 'assessment/failed' ||
|
|
34
|
+
a.method === 'health/incident' ||
|
|
35
|
+
a.method === 'drift/alert' ||
|
|
36
|
+
(a.method === 'health/alert' && a.severity === 'FAIL'));
|
|
37
|
+
if (critical.length > 0) {
|
|
38
|
+
return {
|
|
39
|
+
deferred: true,
|
|
40
|
+
reason: `Fleet-critical event: ${critical[0].method} — Commander attention required`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return { deferred: false };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=fleet-attention-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleet-attention-gate.js","sourceRoot":"","sources":["../../src/ea/fleet-attention-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAeH;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAwB;IAC1D,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC;IAExE,IAAI,iBAAiB,EAAE,KAAK,YAAY,EAAE,CAAC;QACzC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,mBAAmB,EAAE,CAAC;IACpD,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CACpC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,MAAM,IAAI,CAAC,CAAC,SAAS,KAAK,UAAU,CAC5D,CAAC;IACF,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,GAAG,eAAe,CAAC,MAAM,6DAA6D;SAC/F,CAAC;IACJ,CAAC;IAED,IAAI,oBAAoB,EAAE,CAAC;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