@telora/daemon 0.21.7 → 0.21.26
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/build-info.json +14 -3
- package/dist/audit-hooks.d.ts +62 -3
- package/dist/audit-hooks.d.ts.map +1 -1
- package/dist/audit-hooks.js +123 -3
- package/dist/audit-hooks.js.map +1 -1
- package/dist/completion/event.d.ts +1 -0
- package/dist/completion/event.d.ts.map +1 -1
- package/dist/completion/event.js.map +1 -1
- package/dist/completion/review-exit-phase.d.ts +12 -0
- package/dist/completion/review-exit-phase.d.ts.map +1 -1
- package/dist/completion/review-exit-phase.js +45 -10
- package/dist/completion/review-exit-phase.js.map +1 -1
- package/dist/completion/team-completion.d.ts.map +1 -1
- package/dist/completion/team-completion.js +6 -0
- package/dist/completion/team-completion.js.map +1 -1
- package/dist/completion/team-lifecycle.d.ts.map +1 -1
- package/dist/completion/team-lifecycle.js +2 -1
- package/dist/completion/team-lifecycle.js.map +1 -1
- package/dist/delivery-advance-block.d.ts +9 -1
- package/dist/delivery-advance-block.d.ts.map +1 -1
- package/dist/delivery-advance-block.js +37 -1
- package/dist/delivery-advance-block.js.map +1 -1
- package/dist/delivery-lifecycle.d.ts.map +1 -1
- package/dist/delivery-lifecycle.js +9 -0
- package/dist/delivery-lifecycle.js.map +1 -1
- package/dist/delivery-reconciler.d.ts +16 -0
- package/dist/delivery-reconciler.d.ts.map +1 -1
- package/dist/delivery-reconciler.js +12 -0
- package/dist/delivery-reconciler.js.map +1 -1
- package/dist/external-hold.d.ts +42 -0
- package/dist/external-hold.d.ts.map +1 -1
- package/dist/external-hold.js +85 -11
- package/dist/external-hold.js.map +1 -1
- package/dist/focus-engine.d.ts.map +1 -1
- package/dist/focus-engine.js +10 -1
- package/dist/focus-engine.js.map +1 -1
- package/dist/focus-executor.d.ts.map +1 -1
- package/dist/focus-executor.js +5 -0
- package/dist/focus-executor.js.map +1 -1
- package/dist/focus-lifecycle.d.ts.map +1 -1
- package/dist/focus-lifecycle.js +9 -11
- package/dist/focus-lifecycle.js.map +1 -1
- package/dist/focus-provisioning.d.ts.map +1 -1
- package/dist/focus-provisioning.js +9 -11
- package/dist/focus-provisioning.js.map +1 -1
- package/dist/focus-team-state.d.ts +23 -0
- package/dist/focus-team-state.d.ts.map +1 -1
- package/dist/focus-team-state.js +42 -0
- package/dist/focus-team-state.js.map +1 -1
- package/dist/git/merge.d.ts +24 -0
- package/dist/git/merge.d.ts.map +1 -1
- package/dist/git/merge.js +45 -5
- package/dist/git/merge.js.map +1 -1
- package/dist/git/types.d.ts +9 -0
- package/dist/git/types.d.ts.map +1 -1
- package/dist/git/types.js.map +1 -1
- package/dist/heartbeat.d.ts +53 -0
- package/dist/heartbeat.d.ts.map +1 -1
- package/dist/heartbeat.js +100 -7
- package/dist/heartbeat.js.map +1 -1
- package/dist/listener-auto-advance.d.ts.map +1 -1
- package/dist/listener-auto-advance.js +12 -2
- package/dist/listener-auto-advance.js.map +1 -1
- package/dist/nexus/escalation-bridge.d.ts +8 -0
- package/dist/nexus/escalation-bridge.d.ts.map +1 -1
- package/dist/nexus/escalation-bridge.js +8 -0
- package/dist/nexus/escalation-bridge.js.map +1 -1
- package/dist/nexus/return.d.ts +28 -2
- package/dist/nexus/return.d.ts.map +1 -1
- package/dist/nexus/return.js +53 -2
- package/dist/nexus/return.js.map +1 -1
- package/dist/output-monitor.d.ts.map +1 -1
- package/dist/output-monitor.js +14 -0
- package/dist/output-monitor.js.map +1 -1
- package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
- package/dist/prompt-sections/execution-sections.js +7 -0
- package/dist/prompt-sections/execution-sections.js.map +1 -1
- package/dist/prompt-sections/persona-sections.d.ts +10 -0
- package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
- package/dist/prompt-sections/persona-sections.js +4 -2
- package/dist/prompt-sections/persona-sections.js.map +1 -1
- package/dist/prompt-sections/scoping-sections.d.ts.map +1 -1
- package/dist/prompt-sections/scoping-sections.js +8 -0
- package/dist/prompt-sections/scoping-sections.js.map +1 -1
- package/dist/queries/agent-resolvable-promotion.d.ts +17 -5
- package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -1
- package/dist/queries/agent-resolvable-promotion.js +24 -10
- package/dist/queries/agent-resolvable-promotion.js.map +1 -1
- package/dist/queries/daemon-connection.d.ts +21 -1
- package/dist/queries/daemon-connection.d.ts.map +1 -1
- package/dist/queries/daemon-connection.js +4 -1
- package/dist/queries/daemon-connection.js.map +1 -1
- package/dist/queries/deliveries.d.ts +44 -12
- package/dist/queries/deliveries.d.ts.map +1 -1
- package/dist/queries/deliveries.js +32 -15
- package/dist/queries/deliveries.js.map +1 -1
- package/dist/queries/delivery-gate-state.d.ts +23 -0
- package/dist/queries/delivery-gate-state.d.ts.map +1 -1
- package/dist/queries/issues.d.ts.map +1 -1
- package/dist/queries/issues.js +6 -0
- package/dist/queries/issues.js.map +1 -1
- package/dist/queries/requests.d.ts +30 -0
- package/dist/queries/requests.d.ts.map +1 -0
- package/dist/queries/requests.js +32 -0
- package/dist/queries/requests.js.map +1 -0
- package/dist/resolvers/shared/git-diff.d.ts +32 -3
- package/dist/resolvers/shared/git-diff.d.ts.map +1 -1
- package/dist/resolvers/shared/git-diff.js +120 -16
- package/dist/resolvers/shared/git-diff.js.map +1 -1
- package/dist/retention-observation.d.ts +126 -0
- package/dist/retention-observation.d.ts.map +1 -0
- package/dist/retention-observation.js +143 -0
- package/dist/retention-observation.js.map +1 -0
- package/dist/spawn/prompt-assembly.d.ts +9 -0
- package/dist/spawn/prompt-assembly.d.ts.map +1 -1
- package/dist/spawn/prompt-assembly.js +2 -1
- package/dist/spawn/prompt-assembly.js.map +1 -1
- package/dist/spawn/worktree-session.d.ts.map +1 -1
- package/dist/spawn/worktree-session.js +13 -14
- package/dist/spawn/worktree-session.js.map +1 -1
- package/dist/stall-detector-config.d.ts +2 -0
- package/dist/stall-detector-config.d.ts.map +1 -1
- package/dist/stall-detector-config.js +4 -0
- package/dist/stall-detector-config.js.map +1 -1
- package/dist/stall-detectors.d.ts +55 -0
- package/dist/stall-detectors.d.ts.map +1 -1
- package/dist/stall-detectors.js +63 -2
- package/dist/stall-detectors.js.map +1 -1
- package/dist/state-cascade.d.ts.map +1 -1
- package/dist/state-cascade.js +5 -1
- package/dist/state-cascade.js.map +1 -1
- package/dist/templates/claude-md.d.ts +1 -1
- package/dist/templates/claude-md.d.ts.map +1 -1
- package/dist/templates/claude-md.js +25 -0
- package/dist/templates/claude-md.js.map +1 -1
- package/dist/types/focus.d.ts +14 -0
- package/dist/types/focus.d.ts.map +1 -1
- package/dist/unified-shell.d.ts.map +1 -1
- package/dist/unified-shell.js +8 -0
- package/dist/unified-shell.js.map +1 -1
- package/dist/verification-deps.d.ts +14 -0
- package/dist/verification-deps.d.ts.map +1 -1
- package/dist/verification-deterministic.d.ts.map +1 -1
- package/dist/verification-deterministic.js +31 -4
- package/dist/verification-deterministic.js.map +1 -1
- package/dist/verification-engine.d.ts.map +1 -1
- package/dist/verification-engine.js +78 -21
- package/dist/verification-engine.js.map +1 -1
- package/dist/verification-evidence.d.ts.map +1 -1
- package/dist/verification-evidence.js +2 -2
- package/dist/verification-evidence.js.map +1 -1
- package/dist/worktree/index.d.ts +1 -0
- package/dist/worktree/index.d.ts.map +1 -1
- package/dist/worktree/index.js +1 -0
- package/dist/worktree/index.js.map +1 -1
- package/dist/worktree/safety.d.ts +14 -6
- package/dist/worktree/safety.d.ts.map +1 -1
- package/dist/worktree/safety.js +17 -13
- package/dist/worktree/safety.js.map +1 -1
- package/dist/worktree/scratch-guard.d.ts +57 -0
- package/dist/worktree/scratch-guard.d.ts.map +1 -1
- package/dist/worktree/scratch-guard.js +168 -21
- package/dist/worktree/scratch-guard.js.map +1 -1
- package/dist/worktree/verify-interlock.d.ts +52 -0
- package/dist/worktree/verify-interlock.d.ts.map +1 -0
- package/dist/worktree/verify-interlock.js +94 -0
- package/dist/worktree/verify-interlock.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retention observation — the daemon's client-side read of the retention
|
|
3
|
+
* picture the product-api heartbeat response already carries.
|
|
4
|
+
*
|
|
5
|
+
* The heartbeat response body includes `retentionSchedules` (an array of
|
|
6
|
+
* per-horizon status). The edge function (supabase/functions/product-api/
|
|
7
|
+
* handlers/daemon-session-handlers.ts) already computes the two states this
|
|
8
|
+
* focus exists because nothing could tell apart:
|
|
9
|
+
* - a horizon declared but neither heartbeat-enforced nor pg_cron-scheduled
|
|
10
|
+
* (classifyRetentionDetection -> `unenforced`), and
|
|
11
|
+
* - a horizon wired to an enforcer that has never actually removed a row
|
|
12
|
+
* (classifyNeverSwept -> `neverSwept`).
|
|
13
|
+
* It only console-logs them; nothing on the daemon side read the field at all
|
|
14
|
+
* (`git grep retentionSchedule -- packages` was empty). This module closes that:
|
|
15
|
+
* it parses the field the daemon already receives, classifies each horizon with
|
|
16
|
+
* the SAME conditions as the edge (mirrored below, not re-derived differently),
|
|
17
|
+
* records the per-beat classification into a bounded window, and evaluates the
|
|
18
|
+
* precondition that gates retiring the pg_cron fallback -- "this environment's
|
|
19
|
+
* horizons are being held by the app-side sweep" -- from that recorded window.
|
|
20
|
+
*
|
|
21
|
+
* Everything here is pure and independently testable. The heartbeat module owns
|
|
22
|
+
* the window state and feeds observations in on each successful beat.
|
|
23
|
+
*
|
|
24
|
+
* DEGRADE-TO-UNKNOWN: a daemon shipped from this repo (via npm) routinely beats
|
|
25
|
+
* against an environment whose deployed edge bundle predates the field and omits
|
|
26
|
+
* `retentionSchedules`, or returns a malformed one. That is the ordinary case
|
|
27
|
+
* for a while, not an edge case: an absent/malformed field yields an `unknown`
|
|
28
|
+
* observation and never throws, so it can never disturb the heartbeat or the
|
|
29
|
+
* daemon's own liveness.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Per-environment state of ONE declared retention horizon. Daemon-side mirror of
|
|
33
|
+
* the edge `RetentionJobStatus` interface (daemon-session-handlers.ts). The edge
|
|
34
|
+
* normalizes snake_case rows to this camelCase shape before returning it on the
|
|
35
|
+
* heartbeat response, so the daemon receives it camelCase.
|
|
36
|
+
*/
|
|
37
|
+
export interface RetentionJobStatus {
|
|
38
|
+
job: string;
|
|
39
|
+
pgCronAvailable: boolean;
|
|
40
|
+
scheduleInstalled: boolean;
|
|
41
|
+
horizonDays: number | null;
|
|
42
|
+
enforcedByHeartbeat: boolean;
|
|
43
|
+
/** When this horizon was last actually swept, or null if it has never been swept. */
|
|
44
|
+
lastSweptAt: string | null;
|
|
45
|
+
/** Rows removed by the most recent recorded sweep, or null if never swept. */
|
|
46
|
+
lastRowsRemoved: number | null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parse the `retentionSchedules` array off a heartbeat response body.
|
|
50
|
+
*
|
|
51
|
+
* Returns the validated array when present and well-formed, or `null` when the
|
|
52
|
+
* field is absent (older edge bundle) or malformed. Never throws -- reads the
|
|
53
|
+
* body the daemon already received, adds no round trip.
|
|
54
|
+
*/
|
|
55
|
+
export declare function parseRetentionSchedules(body: unknown): RetentionJobStatus[] | null;
|
|
56
|
+
/**
|
|
57
|
+
* Classification of a single declared horizon. Mirrors the edge's two pure
|
|
58
|
+
* classifiers, collapsed into one mutually-exclusive verdict per horizon:
|
|
59
|
+
* - `declared_unenforced` = edge `classifyRetentionDetection` unenforced:
|
|
60
|
+
* nothing runs it (no heartbeat sweep AND no installed pg_cron schedule).
|
|
61
|
+
* - `never_swept` = edge `classifyNeverSwept`: an enforcer is wired
|
|
62
|
+
* (heartbeat and/or installed pg_cron) but no sweep has ever been recorded.
|
|
63
|
+
* - `healthy` = enforced AND a sweep has actually run (lastSweptAt set).
|
|
64
|
+
*/
|
|
65
|
+
export type RetentionClassification = 'healthy' | 'declared_unenforced' | 'never_swept';
|
|
66
|
+
/** Classify one horizon. Pure. Mirrors the edge conditions exactly. */
|
|
67
|
+
export declare function classifyRetentionJob(s: RetentionJobStatus): RetentionClassification;
|
|
68
|
+
/**
|
|
69
|
+
* One beat's retention observation. `jobs` is `null` when the beat produced no
|
|
70
|
+
* usable retention field (older edge bundle / malformed) -- the "unknown"
|
|
71
|
+
* observation. Otherwise it is the per-horizon classification for that beat.
|
|
72
|
+
*/
|
|
73
|
+
export interface RetentionBeatObservation {
|
|
74
|
+
atMs: number;
|
|
75
|
+
jobs: ReadonlyArray<{
|
|
76
|
+
job: string;
|
|
77
|
+
classification: RetentionClassification;
|
|
78
|
+
}> | null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Turn a heartbeat response body into a beat observation. Total: an absent or
|
|
82
|
+
* malformed field yields `{ jobs: null }` (unknown), never a throw.
|
|
83
|
+
*/
|
|
84
|
+
export declare function observeRetentionBeat(body: unknown, atMs: number): RetentionBeatObservation;
|
|
85
|
+
/** How many beats of observation are kept. Bounded so the window never grows. */
|
|
86
|
+
export declare const RETENTION_WINDOW_SIZE = 10;
|
|
87
|
+
/**
|
|
88
|
+
* Append an observation to the rolling window, bounded to `maxSize`. Pure --
|
|
89
|
+
* returns a new array; the caller owns the state cell.
|
|
90
|
+
*/
|
|
91
|
+
export declare function recordRetentionObservation(window: readonly RetentionBeatObservation[], obs: RetentionBeatObservation, maxSize?: number): RetentionBeatObservation[];
|
|
92
|
+
/**
|
|
93
|
+
* How many consecutive most-recent beats must all show every declared horizon
|
|
94
|
+
* healthy before the retirement precondition is considered held. Keying the
|
|
95
|
+
* decision to a window (not a single beat) is what makes it a recorded
|
|
96
|
+
* observation rather than an assumption.
|
|
97
|
+
*/
|
|
98
|
+
export declare const RETENTION_MIN_HEALTHY_BEATS = 3;
|
|
99
|
+
/**
|
|
100
|
+
* Verdict on the pg_cron-retirement precondition: "this environment's horizons
|
|
101
|
+
* are being held by the app-side sweep".
|
|
102
|
+
* - `yes` -- every declared horizon observed healthy across the window.
|
|
103
|
+
* - `no` -- at least one horizon is unenforced or never-swept.
|
|
104
|
+
* - `unknown` -- too few beats yet, an older/malformed bundle in the window,
|
|
105
|
+
* or no declared horizons observed. Never conflated with `yes`.
|
|
106
|
+
*/
|
|
107
|
+
export type RetirementPreconditionVerdict = {
|
|
108
|
+
held: 'yes';
|
|
109
|
+
observedBeats: number;
|
|
110
|
+
} | {
|
|
111
|
+
held: 'no';
|
|
112
|
+
reason: string;
|
|
113
|
+
unhealthyJobs: string[];
|
|
114
|
+
} | {
|
|
115
|
+
held: 'unknown';
|
|
116
|
+
reason: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Evaluate the retirement precondition from the recorded window. Pure. The
|
|
120
|
+
* verdict flips to `yes` ONLY on recorded healthy observations across the
|
|
121
|
+
* required number of beats; a single `unknown` beat in the required span, or too
|
|
122
|
+
* few beats, holds it at `unknown` -- it can never claim `held: yes` from an
|
|
123
|
+
* environment it has not actually observed enforcing.
|
|
124
|
+
*/
|
|
125
|
+
export declare function evaluateRetirementPrecondition(window: readonly RetentionBeatObservation[], minHealthyBeats?: number): RetirementPreconditionVerdict;
|
|
126
|
+
//# sourceMappingURL=retention-observation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention-observation.d.ts","sourceRoot":"","sources":["../src/retention-observation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qFAAqF;IACrF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,8EAA8E;IAC9E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAuBD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,kBAAkB,EAAE,GA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+
* Retention observation — the daemon's client-side read of the retention
|
|
3
|
+
* picture the product-api heartbeat response already carries.
|
|
4
|
+
*
|
|
5
|
+
* The heartbeat response body includes `retentionSchedules` (an array of
|
|
6
|
+
* per-horizon status). The edge function (supabase/functions/product-api/
|
|
7
|
+
* handlers/daemon-session-handlers.ts) already computes the two states this
|
|
8
|
+
* focus exists because nothing could tell apart:
|
|
9
|
+
* - a horizon declared but neither heartbeat-enforced nor pg_cron-scheduled
|
|
10
|
+
* (classifyRetentionDetection -> `unenforced`), and
|
|
11
|
+
* - a horizon wired to an enforcer that has never actually removed a row
|
|
12
|
+
* (classifyNeverSwept -> `neverSwept`).
|
|
13
|
+
* It only console-logs them; nothing on the daemon side read the field at all
|
|
14
|
+
* (`git grep retentionSchedule -- packages` was empty). This module closes that:
|
|
15
|
+
* it parses the field the daemon already receives, classifies each horizon with
|
|
16
|
+
* the SAME conditions as the edge (mirrored below, not re-derived differently),
|
|
17
|
+
* records the per-beat classification into a bounded window, and evaluates the
|
|
18
|
+
* precondition that gates retiring the pg_cron fallback -- "this environment's
|
|
19
|
+
* horizons are being held by the app-side sweep" -- from that recorded window.
|
|
20
|
+
*
|
|
21
|
+
* Everything here is pure and independently testable. The heartbeat module owns
|
|
22
|
+
* the window state and feeds observations in on each successful beat.
|
|
23
|
+
*
|
|
24
|
+
* DEGRADE-TO-UNKNOWN: a daemon shipped from this repo (via npm) routinely beats
|
|
25
|
+
* against an environment whose deployed edge bundle predates the field and omits
|
|
26
|
+
* `retentionSchedules`, or returns a malformed one. That is the ordinary case
|
|
27
|
+
* for a while, not an edge case: an absent/malformed field yields an `unknown`
|
|
28
|
+
* observation and never throws, so it can never disturb the heartbeat or the
|
|
29
|
+
* daemon's own liveness.
|
|
30
|
+
*/
|
|
31
|
+
import { z } from 'zod';
|
|
32
|
+
/**
|
|
33
|
+
* Strict validator for one horizon status. Strictness is deliberate: the edge
|
|
34
|
+
* already normalized every field, so any deviation from this exact shape means
|
|
35
|
+
* an older/malformed bundle, which must degrade to "unknown" rather than be
|
|
36
|
+
* half-read.
|
|
37
|
+
*/
|
|
38
|
+
const retentionJobStatusSchema = z.object({
|
|
39
|
+
job: z.string(),
|
|
40
|
+
pgCronAvailable: z.boolean(),
|
|
41
|
+
scheduleInstalled: z.boolean(),
|
|
42
|
+
horizonDays: z.number().nullable(),
|
|
43
|
+
enforcedByHeartbeat: z.boolean(),
|
|
44
|
+
lastSweptAt: z.string().nullable(),
|
|
45
|
+
lastRowsRemoved: z.number().nullable(),
|
|
46
|
+
});
|
|
47
|
+
/** The `retentionSchedules` field as it appears on the heartbeat response body. */
|
|
48
|
+
const heartbeatBodySchema = z.object({
|
|
49
|
+
retentionSchedules: z.array(retentionJobStatusSchema),
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Parse the `retentionSchedules` array off a heartbeat response body.
|
|
53
|
+
*
|
|
54
|
+
* Returns the validated array when present and well-formed, or `null` when the
|
|
55
|
+
* field is absent (older edge bundle) or malformed. Never throws -- reads the
|
|
56
|
+
* body the daemon already received, adds no round trip.
|
|
57
|
+
*/
|
|
58
|
+
export function parseRetentionSchedules(body) {
|
|
59
|
+
const result = heartbeatBodySchema.safeParse(body);
|
|
60
|
+
return result.success ? result.data.retentionSchedules : null;
|
|
61
|
+
}
|
|
62
|
+
/** Classify one horizon. Pure. Mirrors the edge conditions exactly. */
|
|
63
|
+
export function classifyRetentionJob(s) {
|
|
64
|
+
const enforced = s.enforcedByHeartbeat || (s.pgCronAvailable && s.scheduleInstalled);
|
|
65
|
+
if (!enforced)
|
|
66
|
+
return 'declared_unenforced';
|
|
67
|
+
if (s.lastSweptAt === null)
|
|
68
|
+
return 'never_swept';
|
|
69
|
+
return 'healthy';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Turn a heartbeat response body into a beat observation. Total: an absent or
|
|
73
|
+
* malformed field yields `{ jobs: null }` (unknown), never a throw.
|
|
74
|
+
*/
|
|
75
|
+
export function observeRetentionBeat(body, atMs) {
|
|
76
|
+
const schedules = parseRetentionSchedules(body);
|
|
77
|
+
if (schedules === null)
|
|
78
|
+
return { atMs, jobs: null };
|
|
79
|
+
return {
|
|
80
|
+
atMs,
|
|
81
|
+
jobs: schedules.map((s) => ({ job: s.job, classification: classifyRetentionJob(s) })),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** How many beats of observation are kept. Bounded so the window never grows. */
|
|
85
|
+
export const RETENTION_WINDOW_SIZE = 10;
|
|
86
|
+
/**
|
|
87
|
+
* Append an observation to the rolling window, bounded to `maxSize`. Pure --
|
|
88
|
+
* returns a new array; the caller owns the state cell.
|
|
89
|
+
*/
|
|
90
|
+
export function recordRetentionObservation(window, obs, maxSize = RETENTION_WINDOW_SIZE) {
|
|
91
|
+
const next = [...window, obs];
|
|
92
|
+
return next.length > maxSize ? next.slice(next.length - maxSize) : next;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* How many consecutive most-recent beats must all show every declared horizon
|
|
96
|
+
* healthy before the retirement precondition is considered held. Keying the
|
|
97
|
+
* decision to a window (not a single beat) is what makes it a recorded
|
|
98
|
+
* observation rather than an assumption.
|
|
99
|
+
*/
|
|
100
|
+
export const RETENTION_MIN_HEALTHY_BEATS = 3;
|
|
101
|
+
/**
|
|
102
|
+
* Evaluate the retirement precondition from the recorded window. Pure. The
|
|
103
|
+
* verdict flips to `yes` ONLY on recorded healthy observations across the
|
|
104
|
+
* required number of beats; a single `unknown` beat in the required span, or too
|
|
105
|
+
* few beats, holds it at `unknown` -- it can never claim `held: yes` from an
|
|
106
|
+
* environment it has not actually observed enforcing.
|
|
107
|
+
*/
|
|
108
|
+
export function evaluateRetirementPrecondition(window, minHealthyBeats = RETENTION_MIN_HEALTHY_BEATS) {
|
|
109
|
+
const recent = window.slice(-minHealthyBeats);
|
|
110
|
+
if (recent.length < minHealthyBeats) {
|
|
111
|
+
return {
|
|
112
|
+
held: 'unknown',
|
|
113
|
+
reason: `insufficient observations (${recent.length}/${minHealthyBeats} beats recorded)`,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (recent.some((b) => b.jobs === null)) {
|
|
117
|
+
return {
|
|
118
|
+
held: 'unknown',
|
|
119
|
+
reason: 'a recent beat returned no retention field (older edge bundle or malformed response)',
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
// Every recent beat must carry at least one declared horizon; an all-empty
|
|
123
|
+
// window has nothing to vouch for and is not "held".
|
|
124
|
+
if (!recent.every((b) => (b.jobs?.length ?? 0) > 0)) {
|
|
125
|
+
return { held: 'unknown', reason: 'no declared retention horizons observed' };
|
|
126
|
+
}
|
|
127
|
+
const unhealthy = new Set();
|
|
128
|
+
for (const beat of recent) {
|
|
129
|
+
for (const j of beat.jobs ?? []) {
|
|
130
|
+
if (j.classification !== 'healthy')
|
|
131
|
+
unhealthy.add(j.job);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (unhealthy.size > 0) {
|
|
135
|
+
return {
|
|
136
|
+
held: 'no',
|
|
137
|
+
reason: 'one or more declared horizons were not healthy across the window',
|
|
138
|
+
unhealthyJobs: [...unhealthy].sort(),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return { held: 'yes', observedBeats: recent.length };
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=retention-observation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention-observation.js","sourceRoot":"","sources":["../src/retention-observation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB;;;;;GAKG;AACH,MAAM,wBAAwB,GAAkC,CAAC,CAAC,MAAM,CAAC;IACvE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;IAC5B,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC9B,WAAW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E,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,yCAAyC,EAAE,CAAC;IAChF,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;YAChC,IAAI,CAAC,CAAC,cAAc,KAAK,SAAS;gBAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO;YACL,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,kEAAkE;YAC1E,aAAa,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,IAAI,EAAE;SACrC,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -134,6 +134,15 @@ export declare function buildSpawnMessage(args: {
|
|
|
134
134
|
* that only need the message string are unaffected.
|
|
135
135
|
*/
|
|
136
136
|
gitDiffManifestSink?: AssemblyManifestEntry[];
|
|
137
|
+
/**
|
|
138
|
+
* The review pass's own Telora agent_sessions.id, carried onto the resume-delta
|
|
139
|
+
* shape (review lineage only) so a resumed reviewer is handed the active id it
|
|
140
|
+
* must pass to focus_review_complete. The fresh-prompt shape already bakes this
|
|
141
|
+
* into `prompt` via buildSpawnPrompt(agentSessionId); this threads it to the
|
|
142
|
+
* resume-delta shape too. Optional so message-shape unit tests need not supply
|
|
143
|
+
* it; the production spawn path always passes session.id.
|
|
144
|
+
*/
|
|
145
|
+
agentSessionId?: string;
|
|
137
146
|
}): Promise<string>;
|
|
138
147
|
/**
|
|
139
148
|
* Decide whether this spawn must be forced fresh to deliver a scoping directive,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-assembly.d.ts","sourceRoot":"","sources":["../../src/spawn/prompt-assembly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAML,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAA2D,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC5H,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC3D,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;IACnD,eAAe,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;IACnD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,yBAAyB,EAAE,YAAY,CAAC,2BAA2B,CAAC,CAAC;IACrE,QAAQ,EAAE,OAAO,CAAC;IAClB,gGAAgG;IAChG,WAAW,EAAE,MAAM,CAAC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G;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAC9C;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkGlB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC3D,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;IACnD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,GAAG;IAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAE,CAQvD;AAED,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,EAC1D,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,GACjD,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAWhD;AAED,wBAAgB,iCAAiC,CAAC,IAAI,EAAE;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;CAC5D,GAAG,MAAM,CA+BT"}
|
|
@@ -106,7 +106,7 @@ export function buildSpawnPrompt(args) {
|
|
|
106
106
|
* delivery-lifecycle terminalizes them instead.
|
|
107
107
|
*/
|
|
108
108
|
export async function buildSpawnMessage(args) {
|
|
109
|
-
const { prompt, resumeId, readOnlyFocus, role, promptContext, spawnSpec, config, focusId, focusName, deliveries, issues, worktreePath, priorFindings, answeredEscalationsSection = '', gitDiffManifestSink } = args;
|
|
109
|
+
const { prompt, resumeId, readOnlyFocus, role, promptContext, spawnSpec, config, focusId, focusName, deliveries, issues, worktreePath, priorFindings, answeredEscalationsSection = '', gitDiffManifestSink, agentSessionId } = args;
|
|
110
110
|
const answersSuffix = answeredEscalationsSection.trim() ? `\n\n${answeredEscalationsSection}` : '';
|
|
111
111
|
// Scoping directive takes priority over the fresh/resume split, but ONLY for
|
|
112
112
|
// executable (non-discovery) focuses. It is returned even when resumeId is
|
|
@@ -195,6 +195,7 @@ export async function buildSpawnMessage(args) {
|
|
|
195
195
|
gitDiff,
|
|
196
196
|
priorFindings,
|
|
197
197
|
...(reviewCoverage ? { reviewCoverage } : {}),
|
|
198
|
+
...(agentSessionId ? { agentSessionId } : {}),
|
|
198
199
|
}) + answersSuffix;
|
|
199
200
|
log.info(`[focus-executor] Resuming Claude session ${resumeId} for "${focusName}" ` +
|
|
200
201
|
`-- sending incremental delta (lineage ${spawnSpec.lineage}, ${messageToSend.length} chars, ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-assembly.js","sourceRoot":"","sources":["../../src/spawn/prompt-assembly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,iCAAiC,EACjC,6BAA6B,EAC7B,uBAAuB,GAExB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,iCAAiC,EAAoD,MAAM,uBAAuB,CAAC;AAE5H,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE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CAAC;IACtE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC;IAClD,gFAAgF;IAChF,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,MAAM,EAAE,YAAY,CAAC;IACrB,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,cAAc,CAAC;CAC3B,GAAG;IACF,SAAS,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;IACjD,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IAClD,OAAO,EAAE,YAAY,CAAC;CACvB,CAqBA"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { createSession, } from '../supabase.js';
|
|
14
14
|
import { createWorktree, runGitSync, repoHasCommits } from '../git.js';
|
|
15
|
-
import {
|
|
15
|
+
import { installExecutionWorktreeGuards } from '../audit-hooks.js';
|
|
16
16
|
import { getFocusWorktree, setFocusWorktree } from '../focus-worktree-state.js';
|
|
17
17
|
import { reconcileAgentResolvableForFocus } from '../queries/agent-resolvable-promotion.js';
|
|
18
18
|
import { resolveLineageSpec } from '../session-lineage.js';
|
|
@@ -87,14 +87,14 @@ export async function resolveSpawnWorktree(args) {
|
|
|
87
87
|
log.warn(`Rebase failed for "${focusName}", continuing with existing state`);
|
|
88
88
|
}
|
|
89
89
|
log.info(` Worktree (reused): ${worktreePath}`);
|
|
90
|
-
// Re-assert
|
|
91
|
-
// installs them at provisioning time, but
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
// Re-assert execution-worktree git guards on the reused worktree.
|
|
91
|
+
// ensureFocusWorktrees installs them at provisioning time, but core.hooksPath
|
|
92
|
+
// and the hook files are per-worktree config that does NOT survive as tree
|
|
93
|
+
// content, and a worktree may be reused across daemon restarts -- re-applying
|
|
94
|
+
// here (idempotent) guarantees the delivery-trailer commit-msg hook (and, when
|
|
95
|
+
// read-only, the deny overlay + pre-commit block) are present before spawn.
|
|
96
|
+
installExecutionWorktreeGuards(worktreePath, readOnly);
|
|
97
|
+
log.info(` Re-asserted execution worktree guards (reused worktree)`);
|
|
98
98
|
return worktreePath;
|
|
99
99
|
}
|
|
100
100
|
// Guard: can't create worktrees in a repo with no commits
|
|
@@ -118,11 +118,10 @@ export async function resolveSpawnWorktree(args) {
|
|
|
118
118
|
repoPath: config.repoPath,
|
|
119
119
|
});
|
|
120
120
|
log.info(` Worktree (created inline): ${worktreePath}`);
|
|
121
|
-
// Install
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
121
|
+
// Install execution-worktree git guards: the delivery-trailer commit-msg hook
|
|
122
|
+
// always, plus read-only audit guards when the focus is read-only.
|
|
123
|
+
installExecutionWorktreeGuards(worktreePath, readOnly);
|
|
124
|
+
log.info(` Installed execution worktree guards`);
|
|
126
125
|
return worktreePath;
|
|
127
126
|
}
|
|
128
127
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worktree-session.js","sourceRoot":"","sources":["../../src/spawn/worktree-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,EACL,aAAa,GAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"worktree-session.js","sourceRoot":"","sources":["../../src/spawn/worktree-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,EACL,aAAa,GAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAA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|
15
15
|
/** Resolve the focus-level review-cycle cap (env override or default). */
|
|
16
16
|
export declare function resolveReviewCycleCap(): number;
|
|
17
|
+
/** Resolve the idle-team stall threshold in hours (env override or default). */
|
|
18
|
+
export declare function resolveIdleTeamStallHours(): number;
|
|
17
19
|
//# sourceMappingURL=stall-detector-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stall-detector-config.d.ts","sourceRoot":"","sources":["../src/stall-detector-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,uEAAuE;AACvE,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,wFAAwF;AACxF,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
|
|
1
|
+
{"version":3,"file":"stall-detector-config.d.ts","sourceRoot":"","sources":["../src/stall-detector-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,uEAAuE;AACvE,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,wFAAwF;AACxF,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,gFAAgF;AAChF,wBAAgB,yBAAyB,IAAI,MAAM,CAElD"}
|
|
@@ -21,4 +21,8 @@ export function resolveReviewWindowStaleHours() {
|
|
|
21
21
|
export function resolveReviewCycleCap() {
|
|
22
22
|
return loadEnvConfig().TELORA_REVIEW_CYCLE_CAP;
|
|
23
23
|
}
|
|
24
|
+
/** Resolve the idle-team stall threshold in hours (env override or default). */
|
|
25
|
+
export function resolveIdleTeamStallHours() {
|
|
26
|
+
return loadEnvConfig().TELORA_IDLE_TEAM_STALL_HOURS;
|
|
27
|
+
}
|
|
24
28
|
//# sourceMappingURL=stall-detector-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stall-detector-config.js","sourceRoot":"","sources":["../src/stall-detector-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uEAAuE;AACvE,MAAM,UAAU,sBAAsB;IACpC,OAAO,aAAa,EAAE,CAAC,kCAAkC,CAAC;AAC5D,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,6BAA6B;IAC3C,OAAO,aAAa,EAAE,CAAC,gCAAgC,CAAC;AAC1D,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,qBAAqB;IACnC,OAAO,aAAa,EAAE,CAAC,uBAAuB,CAAC;AACjD,CAAC"}
|
|
1
|
+
{"version":3,"file":"stall-detector-config.js","sourceRoot":"","sources":["../src/stall-detector-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uEAAuE;AACvE,MAAM,UAAU,sBAAsB;IACpC,OAAO,aAAa,EAAE,CAAC,kCAAkC,CAAC;AAC5D,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,6BAA6B;IAC3C,OAAO,aAAa,EAAE,CAAC,gCAAgC,CAAC;AAC1D,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,qBAAqB;IACnC,OAAO,aAAa,EAAE,CAAC,uBAAuB,CAAC;AACjD,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,yBAAyB;IACvC,OAAO,aAAa,EAAE,CAAC,4BAA4B,CAAC;AACtD,CAAC"}
|
|
@@ -138,4 +138,59 @@ export declare function isReviewWindowStale(reviewRequestedAt: string | null, ha
|
|
|
138
138
|
* existing review-handling seam rather than fanning out its own focus scan.
|
|
139
139
|
*/
|
|
140
140
|
export declare function checkReviewWindowStaleForFocus(ctx: FocusStallContext, reviewRequestedAt: string | null, deps?: ReviewWindowDeps): Promise<void>;
|
|
141
|
+
export interface IdleTeamStallDeps {
|
|
142
|
+
/**
|
|
143
|
+
* The team's per-team last-activity epoch ms, or null when nothing has been
|
|
144
|
+
* recorded yet (a team still initializing before its first agent event).
|
|
145
|
+
*/
|
|
146
|
+
getLastActivityAt: (focusId: string) => number | null;
|
|
147
|
+
/**
|
|
148
|
+
* True when the focus has a live team ELIGIBLE for idle recovery: it exists in
|
|
149
|
+
* activeTeams and is in the `executing` phase. A team already tearing down
|
|
150
|
+
* (shutting_down/terminated) must not be re-recovered every tick -- once
|
|
151
|
+
* recovery flips it to shutting_down this returns false, so terminateTeam is
|
|
152
|
+
* not re-issued on each 30s cascade pass until the reap clears the clock.
|
|
153
|
+
*/
|
|
154
|
+
isTeamRecoverable: (focusId: string) => boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Recover the stalled team. The default terminates it via terminateTeam (a
|
|
157
|
+
* controlled `teardown`), which the normal completion path then reaps: the
|
|
158
|
+
* activeTeams entry is dropped (un-blocking merge-back on active_team), the
|
|
159
|
+
* governor slot returns via the exactly-once release, and a verify_failed
|
|
160
|
+
* delivery re-enters the executor's normal queue. Returns true if a team was
|
|
161
|
+
* actually terminated.
|
|
162
|
+
*/
|
|
163
|
+
recoverTeam: (focusId: string) => boolean;
|
|
164
|
+
/** Current epoch ms; injectable for tests. Defaults to Date.now. */
|
|
165
|
+
now: () => number;
|
|
166
|
+
/** Override the threshold (hours) for tests; defaults to env-config. */
|
|
167
|
+
thresholdHours?: number;
|
|
168
|
+
}
|
|
169
|
+
/** Default: a focus is recoverable when its team is live and `executing`. */
|
|
170
|
+
export declare function isTeamRecoverable(focusId: string): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Pure decision: has this team's activity clock frozen past the threshold?
|
|
173
|
+
*
|
|
174
|
+
* False when no activity has been recorded yet (null) -- a team still
|
|
175
|
+
* initializing has not stalled, it just has not produced its first event. The
|
|
176
|
+
* gap is measured against the LAST agent event, not spawn, so a team that keeps
|
|
177
|
+
* producing events never trips (its idle age stays under the threshold). The
|
|
178
|
+
* observed park kept phase=executing while the last-activity clock stayed frozen
|
|
179
|
+
* for 16h37m -- exactly what this predicate catches. Exported for direct unit
|
|
180
|
+
* testing.
|
|
181
|
+
*/
|
|
182
|
+
export declare function isTeamIdleStalled(lastActivityMs: number | null, nowMs: number, thresholdMs: number): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Check ONE focus's team for an idle stall and RECOVER it (terminate so the
|
|
185
|
+
* daemon's normal execution/release paths resume) when its last agent event is
|
|
186
|
+
* older than the threshold. Reads the per-team last-activity clock the caller's
|
|
187
|
+
* seam does not need to load.
|
|
188
|
+
*
|
|
189
|
+
* Files NO escalation: the ask -- recover the parked team -- names an act the
|
|
190
|
+
* daemon performs itself, so this detector ACTS rather than routing a human an
|
|
191
|
+
* item that can only wait ("A hold must name a human act"). A genuinely working
|
|
192
|
+
* team is never recovered: its clock keeps advancing, so its idle age stays
|
|
193
|
+
* under the threshold.
|
|
194
|
+
*/
|
|
195
|
+
export declare function checkIdleTeamStallForFocus(ctx: FocusStallContext, deps?: IdleTeamStallDeps): void;
|
|
141
196
|
//# sourceMappingURL=stall-detectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stall-detectors.d.ts","sourceRoot":"","sources":["../src/stall-detectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAMpD,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACpC,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"stall-detectors.d.ts","sourceRoot":"","sources":["../src/stall-detectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAMpD,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACpC,MAAM,qCAAqC,C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