@agent-relay/factory 0.1.64 → 0.1.66

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.
Files changed (68) hide show
  1. package/README.md +9 -0
  2. package/dist/cli/diagnose.d.ts +92 -0
  3. package/dist/cli/diagnose.d.ts.map +1 -0
  4. package/dist/cli/diagnose.js +381 -0
  5. package/dist/cli/diagnose.js.map +1 -0
  6. package/dist/cli/fleet.d.ts +9 -1
  7. package/dist/cli/fleet.d.ts.map +1 -1
  8. package/dist/cli/fleet.js +97 -4
  9. package/dist/cli/fleet.js.map +1 -1
  10. package/dist/config/schema.d.ts +134 -2
  11. package/dist/config/schema.d.ts.map +1 -1
  12. package/dist/config/schema.js +60 -0
  13. package/dist/config/schema.js.map +1 -1
  14. package/dist/fleet/internal-fleet-client.d.ts +16 -0
  15. package/dist/fleet/internal-fleet-client.d.ts.map +1 -1
  16. package/dist/fleet/internal-fleet-client.js +228 -13
  17. package/dist/fleet/internal-fleet-client.js.map +1 -1
  18. package/dist/hosted/orchestrator.d.ts.map +1 -1
  19. package/dist/hosted/orchestrator.js +1 -4
  20. package/dist/hosted/orchestrator.js.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/observability/error-class.d.ts +29 -0
  26. package/dist/observability/error-class.d.ts.map +1 -0
  27. package/dist/observability/error-class.js +36 -0
  28. package/dist/observability/error-class.js.map +1 -0
  29. package/dist/observability/index.d.ts +1 -0
  30. package/dist/observability/index.d.ts.map +1 -1
  31. package/dist/observability/index.js +1 -0
  32. package/dist/observability/index.js.map +1 -1
  33. package/dist/orchestrator/batch-tracker.d.ts +7 -0
  34. package/dist/orchestrator/batch-tracker.d.ts.map +1 -1
  35. package/dist/orchestrator/batch-tracker.js +1 -0
  36. package/dist/orchestrator/batch-tracker.js.map +1 -1
  37. package/dist/orchestrator/factory.d.ts +18 -0
  38. package/dist/orchestrator/factory.d.ts.map +1 -1
  39. package/dist/orchestrator/factory.js +1059 -82
  40. package/dist/orchestrator/factory.js.map +1 -1
  41. package/dist/orchestrator/index.d.ts +1 -0
  42. package/dist/orchestrator/index.d.ts.map +1 -1
  43. package/dist/orchestrator/index.js +1 -0
  44. package/dist/orchestrator/index.js.map +1 -1
  45. package/dist/orchestrator/public-health.d.ts +82 -0
  46. package/dist/orchestrator/public-health.d.ts.map +1 -0
  47. package/dist/orchestrator/public-health.js +491 -0
  48. package/dist/orchestrator/public-health.js.map +1 -0
  49. package/dist/ports/state.d.ts +25 -0
  50. package/dist/ports/state.d.ts.map +1 -1
  51. package/dist/state/dispatch-lifecycle-slot.d.ts +45 -0
  52. package/dist/state/dispatch-lifecycle-slot.d.ts.map +1 -0
  53. package/dist/state/dispatch-lifecycle-slot.js +67 -0
  54. package/dist/state/dispatch-lifecycle-slot.js.map +1 -0
  55. package/dist/state/file-state-store.d.ts +8 -0
  56. package/dist/state/file-state-store.d.ts.map +1 -1
  57. package/dist/state/file-state-store.js +19 -19
  58. package/dist/state/file-state-store.js.map +1 -1
  59. package/dist/state/in-memory-state-store.d.ts +8 -0
  60. package/dist/state/in-memory-state-store.d.ts.map +1 -1
  61. package/dist/state/in-memory-state-store.js +18 -19
  62. package/dist/state/in-memory-state-store.js.map +1 -1
  63. package/dist/state/watch-state-document.js +1 -0
  64. package/dist/state/watch-state-document.js.map +1 -1
  65. package/dist/triage/schema.d.ts +14 -14
  66. package/dist/types.d.ts +180 -1
  67. package/dist/types.d.ts.map +1 -1
  68. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  export { BatchTracker, issueKey } from './batch-tracker.js';
2
+ export { DEFAULT_PUBLIC_HEALTH_STALE_MS, DEFAULT_READINESS_RECONCILE_INTERVAL_MS, FACTORY_PUBLIC_HEALTH_SCHEMA_VERSION, READINESS_RECONCILE_STALL_INTERVALS, derivedReadinessReconcileState, publicHealthFromHeartbeat, readinessReconcileInFlightMs, } from './public-health.js';
2
3
  export type { DependencyAdmission, DependencyBlocker, ParkedIssue } from './batch-tracker.js';
3
4
  export { dependencyIdentity, findDependencyCycle, parseBlockedBy, resolveDependency } from './dependencies.js';
4
5
  export type { DeclaredDependency, ResolvedDependency } from './dependencies.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACxD,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAC3G,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC5E,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC/E,OAAO,EACL,mCAAmC,EACnC,kCAAkC,EAClC,wBAAwB,EACxB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,mCAAmC,EACnC,+BAA+B,EAC/B,iBAAiB,EACjB,6BAA6B,EAC7B,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,oCAAoC,EACpC,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,UAAU,CAAA;AACjB,YAAY,EACV,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EACL,8BAA8B,EAC9B,uCAAuC,EACvC,oCAAoC,EACpC,mCAAmC,EACnC,8BAA8B,EAC9B,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,iBAAiB,CAAA;AACxB,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAC3G,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC5E,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC/E,OAAO,EACL,mCAAmC,EACnC,kCAAkC,EAClC,wBAAwB,EACxB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,mCAAmC,EACnC,+BAA+B,EAC/B,iBAAiB,EACjB,6BAA6B,EAC7B,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,oCAAoC,EACpC,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,UAAU,CAAA;AACjB,YAAY,EACV,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,UAAU,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export { BatchTracker, issueKey } from './batch-tracker.js';
2
+ export { DEFAULT_PUBLIC_HEALTH_STALE_MS, DEFAULT_READINESS_RECONCILE_INTERVAL_MS, FACTORY_PUBLIC_HEALTH_SCHEMA_VERSION, READINESS_RECONCILE_STALL_INTERVALS, derivedReadinessReconcileState, publicHealthFromHeartbeat, readinessReconcileInFlightMs, } from './public-health.js';
2
3
  export { dependencyIdentity, findDependencyCycle, parseBlockedBy, resolveDependency } from './dependencies.js';
3
4
  export { DEFAULT_FACTORY_LOOP_HEARTBEAT_PATH, DEFAULT_FACTORY_LOOP_REGISTRY_PATH, checkFactoryLoopLiveness, createFactory, FactoryLoop, isDispatchableIssue, isAllowedFactoryGithubDraft, isAllowedFactoryGithubArtifactDraft, isLiveDispatchStateChangedError, isRealLinearIssue, LiveDispatchStateChangedError, githubIssuePathParts, parseGithubFactoryIssue, parseLinearIssue, readLinearIssueWithCanonicalFallback, readFactoryLoopHeartbeat, } from './factory.js';
4
5
  export { FactoryEnvironmentReaper, FactoryReaper, heldAgentsFromRegistry, readFactoryInFlightRegistry, reapFactoryEnvironmentsOnce, reapFactoryOrphansOnce, } from './reaper.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAG3G,OAAO,EACL,mCAAmC,EACnC,kCAAkC,EAClC,wBAAwB,EACxB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,mCAAmC,EACnC,+BAA+B,EAC/B,iBAAiB,EACjB,6BAA6B,EAC7B,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,oCAAoC,EACpC,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EACL,8BAA8B,EAC9B,uCAAuC,EACvC,oCAAoC,EACpC,mCAAmC,EACnC,8BAA8B,EAC9B,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAG3G,OAAO,EACL,mCAAmC,EACnC,kCAAkC,EAClC,wBAAwB,EACxB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,mCAAmC,EACnC,+BAA+B,EAC/B,iBAAiB,EACjB,6BAA6B,EAC7B,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,oCAAoC,EACpC,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,UAAU,CAAA"}
@@ -0,0 +1,82 @@
1
+ import type { FactoryLoopHeartbeat, FactoryPublicHealth, FactoryPublicSubsystemState, FactoryReadinessReconcileStatus } from '../types.js';
2
+ /**
3
+ * Public health projection (#295).
4
+ *
5
+ * A deployed Factory's only unauthenticated surface is the container's
6
+ * `/healthz`. Until now it carried subsystem *state strings* and nothing else,
7
+ * so an operator could see `degraded` without learning how badly, since when,
8
+ * or what class of failure — and could not see a wedged sweep at all, because
9
+ * a hang writes no state. The fields that answer those questions live in the
10
+ * loop heartbeat next to `lastError`, which is free text and must not be
11
+ * published.
12
+ *
13
+ * This module is that boundary. It builds the public record **by
14
+ * construction**: every field is named here, every number is coerced, every
15
+ * string is either a closed enum or passes the shared telemetry allowlist.
16
+ * Nothing is spread, so a field added upstream — or written by an older or
17
+ * hostile producer — cannot reach the public surface by default.
18
+ */
19
+ export declare const FACTORY_PUBLIC_HEALTH_SCHEMA_VERSION = 1;
20
+ /** Default readiness-reconcile cadence, mirrored from the live daemon. */
21
+ export declare const DEFAULT_READINESS_RECONCILE_INTERVAL_MS = 60000;
22
+ /**
23
+ * How many missed passes make an in-flight sweep `stalled`.
24
+ *
25
+ * A cold container legitimately spends minutes in its first pass — #36
26
+ * measured a post-boot reconcile at 61 minutes while the Relayfile mirror
27
+ * hydrated — so a small multiple would cry wolf on every boot. Ten missed
28
+ * passes (ten minutes at the default cadence) is past any warm-path sweep,
29
+ * and `inFlightMs`/`missedPasses`/`lastCompletedAtMs` ship alongside so a
30
+ * reader can still tell "first pass since boot, still hydrating" from "was
31
+ * fine for hours, then stopped".
32
+ */
33
+ export declare const READINESS_RECONCILE_STALL_INTERVALS = 10;
34
+ /** Heartbeat age past which the whole record is treated as unknown, not green. */
35
+ export declare const DEFAULT_PUBLIC_HEALTH_STALE_MS = 60000;
36
+ /**
37
+ * How long the current pass has been running, or `undefined` when none is.
38
+ *
39
+ * A sweep that hangs takes neither the success nor the failure path, so no
40
+ * field is written while it is stuck. The only evidence is that its start
41
+ * timestamp is newer than both settle timestamps — which is why the *relative
42
+ * order* of these three numbers, not any state string, is the signal.
43
+ */
44
+ export declare function readinessReconcileInFlightMs(status: Pick<FactoryReadinessReconcileStatus, 'inFlightSinceMs' | 'lastStartedAtMs' | 'lastCompletedAtMs' | 'lastFailureAtMs'>, nowMs: number): number | undefined;
45
+ /**
46
+ * The state a reader should believe, which is not always the one on record.
47
+ *
48
+ * `state` as persisted is last-write-wins over the last *settled* pass, so it
49
+ * reports `healthy` for as long as a hang lasts. This re-derives it against
50
+ * the clock: an in-flight pass past the stall threshold is `stalled` no matter
51
+ * what the last completed pass said.
52
+ */
53
+ export declare function derivedReadinessReconcileState(status: Pick<FactoryReadinessReconcileStatus, 'state' | 'intervalMs' | 'inFlightSinceMs' | 'lastStartedAtMs' | 'lastCompletedAtMs' | 'lastFailureAtMs'>, nowMs: number): FactoryPublicSubsystemState | 'unknown';
54
+ /**
55
+ * Project a loop heartbeat into the record safe to serve unauthenticated.
56
+ *
57
+ * `nowMs` must come from the *writer's* clock, not a remote reader's: every
58
+ * derived duration here is a difference against timestamps the daemon
59
+ * produced, and comparing them to a laptop's clock would report skew as
60
+ * stall. Readers get `ageMs` instead and can bound the staleness themselves.
61
+ */
62
+ export declare function publicHealthFromHeartbeat(heartbeat: FactoryLoopHeartbeat | undefined, opts?: {
63
+ nowMs?: number;
64
+ staleMs?: number;
65
+ }): FactoryPublicHealth;
66
+ /**
67
+ * Re-read a health record that arrived over the wire.
68
+ *
69
+ * A reader of a remote `/healthz` holds parsed JSON from a process it does
70
+ * not control and that may be several versions behind. Running it back
71
+ * through the same coercions the writer used means a caller can rely on the
72
+ * shape — and means an unrecognised state or a hostile string cannot reach a
73
+ * terminal or a downstream report just because it arrived over HTTP.
74
+ *
75
+ * The derived fields are read, not recomputed: they were derived against the
76
+ * writer's clock, and a reader's clock would report skew as stall.
77
+ *
78
+ * Returns `undefined` when the record is absent, which is how a caller tells
79
+ * "instance predates the diagnostics block" from "instance is unhealthy".
80
+ */
81
+ export declare function normalizePublicHealth(value: unknown): FactoryPublicHealth | undefined;
82
+ //# sourceMappingURL=public-health.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-health.d.ts","sourceRoot":"","sources":["../../src/orchestrator/public-health.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,oBAAoB,EAIpB,mBAAmB,EAEnB,2BAA2B,EAC3B,+BAA+B,EAChC,MAAM,UAAU,CAAA;AAEjB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oCAAoC,IAAI,CAAA;AAErD,0EAA0E;AAC1E,eAAO,MAAM,uCAAuC,QAAS,CAAA;AAE7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mCAAmC,KAAK,CAAA;AAErD,kFAAkF;AAClF,eAAO,MAAM,8BAA8B,QAAS,CAAA;AAsJpD;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,IAAI,CACV,+BAA+B,EAC/B,iBAAiB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,iBAAiB,CAChF,EACD,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAgBpB;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,IAAI,CACV,+BAA+B,EAC/B,OAAO,GAAG,YAAY,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,iBAAiB,CACzG,EACD,KAAK,EAAE,MAAM,GACZ,2BAA2B,GAAG,SAAS,CAQzC;AA+GD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,oBAAoB,GAAG,SAAS,EAC3C,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAC9C,mBAAmB,CAwGrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,GAAG,SAAS,CA2ErF"}
@@ -0,0 +1,491 @@
1
+ import { telemetryErrorClassName } from '../observability/error-class.js';
2
+ import { DEFAULT_AGENTLESS_HOLD_TIMEOUT_MS, DEFAULT_CAPACITY_WAIT_WARN_MS } from '../config/schema.js';
3
+ /**
4
+ * Public health projection (#295).
5
+ *
6
+ * A deployed Factory's only unauthenticated surface is the container's
7
+ * `/healthz`. Until now it carried subsystem *state strings* and nothing else,
8
+ * so an operator could see `degraded` without learning how badly, since when,
9
+ * or what class of failure — and could not see a wedged sweep at all, because
10
+ * a hang writes no state. The fields that answer those questions live in the
11
+ * loop heartbeat next to `lastError`, which is free text and must not be
12
+ * published.
13
+ *
14
+ * This module is that boundary. It builds the public record **by
15
+ * construction**: every field is named here, every number is coerced, every
16
+ * string is either a closed enum or passes the shared telemetry allowlist.
17
+ * Nothing is spread, so a field added upstream — or written by an older or
18
+ * hostile producer — cannot reach the public surface by default.
19
+ */
20
+ export const FACTORY_PUBLIC_HEALTH_SCHEMA_VERSION = 1;
21
+ /** Default readiness-reconcile cadence, mirrored from the live daemon. */
22
+ export const DEFAULT_READINESS_RECONCILE_INTERVAL_MS = 60_000;
23
+ /**
24
+ * How many missed passes make an in-flight sweep `stalled`.
25
+ *
26
+ * A cold container legitimately spends minutes in its first pass — #36
27
+ * measured a post-boot reconcile at 61 minutes while the Relayfile mirror
28
+ * hydrated — so a small multiple would cry wolf on every boot. Ten missed
29
+ * passes (ten minutes at the default cadence) is past any warm-path sweep,
30
+ * and `inFlightMs`/`missedPasses`/`lastCompletedAtMs` ship alongside so a
31
+ * reader can still tell "first pass since boot, still hydrating" from "was
32
+ * fine for hours, then stopped".
33
+ */
34
+ export const READINESS_RECONCILE_STALL_INTERVALS = 10;
35
+ /** Heartbeat age past which the whole record is treated as unknown, not green. */
36
+ export const DEFAULT_PUBLIC_HEALTH_STALE_MS = 60_000;
37
+ const READINESS_RECONCILE_STATES = [
38
+ 'not-running',
39
+ 'healthy',
40
+ 'retrying',
41
+ 'degraded',
42
+ 'stalled',
43
+ ];
44
+ const EVENT_LISTENER_STATES = [
45
+ 'not-listening',
46
+ 'starting',
47
+ 'subscribed',
48
+ 'polling',
49
+ ];
50
+ const FLEET_CONTROL_PLANE_STATES = [
51
+ 'closed',
52
+ 'open',
53
+ 'half-open',
54
+ ];
55
+ /** Subsystems whose degradation stops issues from being dispatched. */
56
+ const DISPATCH_GATING_SUBSYSTEMS = [
57
+ 'readinessReconcile',
58
+ 'eventListener',
59
+ 'fleetControlPlane',
60
+ // #303. A full batch stops dispatch exactly as hard as a failing sweep, and
61
+ // is the only one of the four that fails without anything throwing: nothing
62
+ // increments a failure counter, nothing writes `lastError`, and the wait
63
+ // logged once and went quiet. It belongs on this list because "why is
64
+ // nothing being dispatched" is the question the list exists to answer.
65
+ 'dispatchCapacity',
66
+ ];
67
+ const finiteNumber = (value) => typeof value === 'number' && Number.isFinite(value) ? value : undefined;
68
+ /** A cadence is a denominator: zero or negative would make every derived ratio nonsense. */
69
+ const positiveNumber = (value) => {
70
+ const parsed = finiteNumber(value);
71
+ return parsed !== undefined && parsed > 0 ? parsed : undefined;
72
+ };
73
+ const counter = (value) => {
74
+ const parsed = finiteNumber(value);
75
+ return parsed !== undefined && parsed >= 0 ? Math.floor(parsed) : 0;
76
+ };
77
+ /**
78
+ * The widest instant `Date` can represent (ECMA-262 time-value limit).
79
+ *
80
+ * Review follow-up on #300 (P2, codex): a finite number is not a valid date.
81
+ * `new Date(1e300).toISOString()` throws, and these numbers arrive from a
82
+ * remote process — so a hostile or corrupted record could abort a renderer
83
+ * that was asked to explain an outage. A timestamp outside the range is
84
+ * dropped rather than published.
85
+ */
86
+ const MAX_TIME_VALUE_MS = 8.64e15;
87
+ const timestamp = (value) => {
88
+ const parsed = finiteNumber(value);
89
+ return parsed !== undefined && Math.abs(parsed) <= MAX_TIME_VALUE_MS ? parsed : undefined;
90
+ };
91
+ const optionalTimestamp = (key, value) => {
92
+ const parsed = timestamp(value);
93
+ return parsed === undefined ? {} : { [key]: parsed };
94
+ };
95
+ const plainRecord = (value) => value !== null && typeof value === 'object' && !Array.isArray(value)
96
+ ? value
97
+ : undefined;
98
+ const optionalNumber = (key, value) => {
99
+ const parsed = finiteNumber(value);
100
+ return parsed === undefined ? {} : { [key]: parsed };
101
+ };
102
+ /**
103
+ * A duration that cannot be negative, dropped rather than republished.
104
+ *
105
+ * The writer never emits these; a remote process on another version might
106
+ * (#300 review, CodeRabbit). Dropping the field keeps the promise this
107
+ * module's doc comment makes to its callers about the shape they get.
108
+ */
109
+ const optionalDuration = (key, value) => {
110
+ const parsed = finiteNumber(value);
111
+ return parsed === undefined || parsed < 0 ? {} : { [key]: parsed };
112
+ };
113
+ /** A count of whole passes: fractions are not a thing an operator can read. */
114
+ const optionalCount = (key, value) => {
115
+ const parsed = finiteNumber(value);
116
+ return parsed === undefined || parsed < 0
117
+ ? {}
118
+ : { [key]: Math.floor(parsed) };
119
+ };
120
+ const optionalPositive = (key, value) => {
121
+ const parsed = positiveNumber(value);
122
+ return parsed === undefined ? {} : { [key]: parsed };
123
+ };
124
+ /** Control characters stripped, length bounded: this text can reach a terminal. */
125
+ const boundedText = (value) =>
126
+ // C0 and C1 alike (#300 review, P2, cubic): some terminals interpret the
127
+ // C1 range as escape introducers.
128
+ value.replace(/[\u0000-\u001F\u007F-\u009F]+/gu, ' ').trim().slice(0, 300);
129
+ const DISPATCH_CAPACITY_STATES = [
130
+ 'healthy',
131
+ 'waiting',
132
+ 'stalled',
133
+ ];
134
+ /**
135
+ * Capacity state from the numbers that produced it.
136
+ *
137
+ * Used by the writer, and as the fallback when a record arrives carrying an
138
+ * unrecognised state string. Falling back to `healthy` there would hide the
139
+ * exact condition this block exists to report, and unlike the readiness
140
+ * derivations this one needs no clock — `longestWaitMs` is a duration the
141
+ * writer already measured.
142
+ */
143
+ const deriveDispatchCapacityState = (waiting, longestWaitMs, warnMs) => waiting === 0
144
+ ? 'healthy'
145
+ : longestWaitMs !== undefined && longestWaitMs > warnMs
146
+ ? 'stalled'
147
+ : 'waiting';
148
+ const dispatchCapacityState = (value, waiting, longestWaitMs, warnMs) => typeof value === 'string' && DISPATCH_CAPACITY_STATES.includes(value)
149
+ ? value
150
+ : deriveDispatchCapacityState(waiting, longestWaitMs, warnMs);
151
+ const enumValue = (value, allowed) => typeof value === 'string' && allowed.includes(value) ? value : 'unknown';
152
+ /**
153
+ * How long the current pass has been running, or `undefined` when none is.
154
+ *
155
+ * A sweep that hangs takes neither the success nor the failure path, so no
156
+ * field is written while it is stuck. The only evidence is that its start
157
+ * timestamp is newer than both settle timestamps — which is why the *relative
158
+ * order* of these three numbers, not any state string, is the signal.
159
+ */
160
+ export function readinessReconcileInFlightMs(status, nowMs) {
161
+ // A daemon that publishes `inFlightSinceMs` knows what is still running and
162
+ // does not need the inference below. It is strictly better: a sweep whose
163
+ // wait ended on the #296 deadline writes a settle timestamp while its
164
+ // `runOnce()` keeps running, so timestamp order alone would call that stuck
165
+ // pass "not in flight" — the exact blindness this projection exists to cure.
166
+ const inFlightSinceMs = timestamp(status.inFlightSinceMs);
167
+ if (inFlightSinceMs !== undefined)
168
+ return Math.max(0, nowMs - inFlightSinceMs);
169
+ const startedAtMs = timestamp(status.lastStartedAtMs);
170
+ if (startedAtMs === undefined)
171
+ return undefined;
172
+ const settledAtMs = Math.max(timestamp(status.lastCompletedAtMs) ?? Number.NEGATIVE_INFINITY, timestamp(status.lastFailureAtMs) ?? Number.NEGATIVE_INFINITY);
173
+ if (settledAtMs >= startedAtMs)
174
+ return undefined;
175
+ return Math.max(0, nowMs - startedAtMs);
176
+ }
177
+ /**
178
+ * The state a reader should believe, which is not always the one on record.
179
+ *
180
+ * `state` as persisted is last-write-wins over the last *settled* pass, so it
181
+ * reports `healthy` for as long as a hang lasts. This re-derives it against
182
+ * the clock: an in-flight pass past the stall threshold is `stalled` no matter
183
+ * what the last completed pass said.
184
+ */
185
+ export function derivedReadinessReconcileState(status, nowMs) {
186
+ const reported = enumValue(status.state, READINESS_RECONCILE_STATES);
187
+ // A daemon that is not running has no pass in flight; its own state wins.
188
+ if (reported === 'not-running')
189
+ return reported;
190
+ const inFlightMs = readinessReconcileInFlightMs(status, nowMs);
191
+ if (inFlightMs === undefined)
192
+ return reported;
193
+ const intervalMs = positiveNumber(status.intervalMs) ?? DEFAULT_READINESS_RECONCILE_INTERVAL_MS;
194
+ return inFlightMs > intervalMs * READINESS_RECONCILE_STALL_INTERVALS ? 'stalled' : reported;
195
+ }
196
+ function readinessReconcileHealth(status, nowMs) {
197
+ // Review follow-up on #300 (P2, cubic): a recorded `intervalMs: 0` made
198
+ // every in-flight pass instantly stalled and `missedPasses` Infinity, which
199
+ // JSON renders as null. An unusable cadence falls back to the default and is
200
+ // not republished as though it were real.
201
+ const intervalMs = positiveNumber(status.intervalMs);
202
+ const inFlightMs = readinessReconcileInFlightMs(status, nowMs);
203
+ const cadenceMs = intervalMs ?? DEFAULT_READINESS_RECONCILE_INTERVAL_MS;
204
+ return {
205
+ state: derivedReadinessReconcileState(status, nowMs),
206
+ consecutiveFailures: counter(status.consecutiveFailures),
207
+ failureThreshold: counter(status.failureThreshold),
208
+ ...(intervalMs !== undefined ? { intervalMs } : {}),
209
+ ...(finiteNumber(status.lastDurationMs) !== undefined
210
+ ? { lastDurationMs: finiteNumber(status.lastDurationMs) }
211
+ : {}),
212
+ ...optionalTimestamp('lastStartedAtMs', status.lastStartedAtMs),
213
+ ...optionalTimestamp('lastCompletedAtMs', status.lastCompletedAtMs),
214
+ ...optionalTimestamp('lastFailureAtMs', status.lastFailureAtMs),
215
+ ...(inFlightMs !== undefined
216
+ ? { inFlightMs, missedPasses: Math.floor(inFlightMs / cadenceMs) }
217
+ : {}),
218
+ // `lastError` itself never crosses. Its class does, through the same
219
+ // allowlist that guards IterationReport.skipped[].reason — and a record
220
+ // that carries an error but no admissible class still says so.
221
+ ...(status.lastErrorClass !== undefined || status.lastError !== undefined
222
+ ? { lastErrorClass: telemetryErrorClassName(status.lastErrorClass) }
223
+ : {}),
224
+ };
225
+ }
226
+ /**
227
+ * Occupied slots that will not free themselves.
228
+ *
229
+ * NOT "has no agent yet". `BatchTracker#recordPlanned` writes a spec before
230
+ * the spawn returns, so every healthy dispatch is agent-less for as long as
231
+ * its placement takes — minutes for a cloud spawn — and on a single-slot batch
232
+ * that is nearly always. Counting that would make the wedge signature read 1
233
+ * continuously on a batch that is working, which is worse than not having the
234
+ * field (#303 review, cubic). The condition no healthy dispatch reaches is
235
+ * *never placed and already past the deadline that should have reaped it*.
236
+ *
237
+ * Defensive throughout: this runs inside the heartbeat writer, where a throw
238
+ * costs the whole diagnostics block, and the record may come from an older or
239
+ * corrupted producer (#303 review, cubic).
240
+ */
241
+ function countAgentlessOccupants(occupants, reapMs) {
242
+ if (!Array.isArray(occupants))
243
+ return 0;
244
+ return occupants.filter((entry) => {
245
+ const occupant = plainRecord(entry);
246
+ if (!occupant)
247
+ return false;
248
+ const slotHeldForMs = finiteNumber(occupant.slotHeldForMs);
249
+ // A producer that sends neither field cannot answer the question, and
250
+ // guessing "wedged" from an absence is how a false alarm gets published.
251
+ // `>=`, not `>`: the reaper skips only while `nowMs < dueAtMs`, so it
252
+ // reaps at exactly the deadline. A diagnostic that disagrees with the
253
+ // mechanism it reports on — even on one boundary instant — is the failure
254
+ // mode this whole PR exists to close (#303 review, cubic).
255
+ return finiteNumber(occupant.placedAgents) === 0 &&
256
+ slotHeldForMs !== undefined &&
257
+ slotHeldForMs >= reapMs;
258
+ }).length;
259
+ }
260
+ /**
261
+ * Batch occupancy, redacted (#303).
262
+ *
263
+ * Issue keys stay behind the authenticated surface — they carry customer
264
+ * project and repository names — so the public record carries counts and
265
+ * durations only. `agentlessOccupants` is the wedge signature: a slot held by
266
+ * a lifecycle that never placed an agent cannot make progress on its own.
267
+ */
268
+ function dispatchCapacityHealth(status) {
269
+ const waiting = counter(status.waiting);
270
+ const longestWaitMs = finiteNumber(status.longestWaitMs);
271
+ const warnMs = positiveNumber(status.waitWarnMs) ?? DEFAULT_CAPACITY_WAIT_WARN_MS;
272
+ const reapMs = positiveNumber(status.agentlessHoldTimeoutMs) ?? DEFAULT_AGENTLESS_HOLD_TIMEOUT_MS;
273
+ const agentlessOccupants = countAgentlessOccupants(status.occupants, reapMs);
274
+ return {
275
+ state: deriveDispatchCapacityState(waiting, longestWaitMs, warnMs),
276
+ batchSize: counter(status.batchSize),
277
+ active: counter(status.active),
278
+ waiting,
279
+ waitWarnMs: warnMs,
280
+ agentlessHoldTimeoutMs: reapMs,
281
+ ...optionalDuration('longestWaitMs', longestWaitMs),
282
+ ...(agentlessOccupants > 0 ? { agentlessOccupants } : {}),
283
+ };
284
+ }
285
+ function fleetControlPlaneHealth(status) {
286
+ return {
287
+ state: enumValue(status.state, FLEET_CONTROL_PLANE_STATES),
288
+ consecutiveFailures: counter(status.consecutiveFailures),
289
+ failureThreshold: counter(status.failureThreshold),
290
+ ...optionalTimestamp('lastFailureAtMs', status.lastFailureAtMs),
291
+ ...optionalTimestamp('retryAtMs', status.retryAtMs),
292
+ // `lastError` stays behind /evidence: a roster probe failure names the
293
+ // broker socket path.
294
+ };
295
+ }
296
+ /**
297
+ * Project a loop heartbeat into the record safe to serve unauthenticated.
298
+ *
299
+ * `nowMs` must come from the *writer's* clock, not a remote reader's: every
300
+ * derived duration here is a difference against timestamps the daemon
301
+ * produced, and comparing them to a laptop's clock would report skew as
302
+ * stall. Readers get `ageMs` instead and can bound the staleness themselves.
303
+ */
304
+ export function publicHealthFromHeartbeat(heartbeat, opts = {}) {
305
+ const nowMs = opts.nowMs ?? Date.now();
306
+ const staleMs = opts.staleMs ?? DEFAULT_PUBLIC_HEALTH_STALE_MS;
307
+ if (!heartbeat) {
308
+ return {
309
+ schemaVersion: FACTORY_PUBLIC_HEALTH_SCHEMA_VERSION,
310
+ ok: false,
311
+ status: 'unknown',
312
+ stale: true,
313
+ reason: 'heartbeat missing',
314
+ degradedSubsystems: [],
315
+ };
316
+ }
317
+ const updatedAtMs = timestamp(heartbeat.updatedAtMs);
318
+ const ageMs = updatedAtMs === undefined ? undefined : Math.max(0, nowMs - updatedAtMs);
319
+ const stale = ageMs === undefined || ageMs > staleMs;
320
+ const loopStatus = enumValue(heartbeat.status, ['running', 'idle', 'stopping']);
321
+ const readinessReconcile = heartbeat.readinessReconcile
322
+ ? readinessReconcileHealth(heartbeat.readinessReconcile, nowMs)
323
+ : undefined;
324
+ const fleetControlPlane = heartbeat.fleetControlPlane
325
+ ? fleetControlPlaneHealth(heartbeat.fleetControlPlane)
326
+ : undefined;
327
+ const dispatchCapacity = heartbeat.dispatchCapacity
328
+ ? dispatchCapacityHealth(heartbeat.dispatchCapacity)
329
+ : undefined;
330
+ const eventListener = heartbeat.eventListener
331
+ // Only the state. `reason` is assembled free text and stays behind the
332
+ // authenticated surface.
333
+ ? { state: enumValue(heartbeat.eventListener.state, EVENT_LISTENER_STATES) }
334
+ : undefined;
335
+ // A daemon that is not running a readiness loop is not a live dispatcher —
336
+ // a bounded `factory loop` reports `not-running` here and is not supposed to
337
+ // hold a subscription. Only a live instance's listener is dispatch-gating.
338
+ const liveDispatcher = readinessReconcile !== undefined && readinessReconcile.state !== 'not-running';
339
+ const degradedSubsystems = DISPATCH_GATING_SUBSYSTEMS.filter((name) => {
340
+ if (name === 'readinessReconcile') {
341
+ return readinessReconcile !== undefined &&
342
+ readinessReconcile.state !== 'healthy' &&
343
+ readinessReconcile.state !== 'not-running';
344
+ }
345
+ if (name === 'fleetControlPlane') {
346
+ // An open circuit fails every spawn fast; half-open is one probe away
347
+ // from either. Both mean dispatch is not admitting work normally.
348
+ return fleetControlPlane !== undefined && fleetControlPlane.state !== 'closed';
349
+ }
350
+ if (name === 'dispatchCapacity') {
351
+ // `waiting` alone is ordinary backpressure and stays green: a batch is
352
+ // supposed to fill up. Only a wait past the configured threshold — which
353
+ // a deployment running multi-hour issues should raise rather than
354
+ // silence — is a degradation.
355
+ return dispatchCapacity !== undefined && dispatchCapacity.state === 'stalled';
356
+ }
357
+ // Review follow-up on #300 (P2, codex): `starting` is what a live daemon
358
+ // reports before `#startLiveSubscription` installs the subscription. No
359
+ // listener is registered, and startup can be lengthy, so anything short of
360
+ // a registered subscription or an active poll is amber — not green.
361
+ return liveDispatcher &&
362
+ eventListener !== undefined &&
363
+ eventListener.state !== 'subscribed' &&
364
+ eventListener.state !== 'polling';
365
+ });
366
+ // Deliberate split (#295, deliverable 2).
367
+ //
368
+ // `ok` answers "is this process alive", because that is the question the
369
+ // platform asks: the container ping endpoint is `/healthz`, and a non-200
370
+ // there recycles the container. Recycling a wedged Factory destroys the
371
+ // in-memory evidence of the wedge and restarts the cold-start hydration
372
+ // that #36 measured at 61 minutes, so a dispatch-gating degradation must
373
+ // not be able to reach into container lifecycle.
374
+ //
375
+ // `status` is the amber a liveness bit cannot express. No platform reads
376
+ // it, so a monitor can alert on `status !== "ok"` — or on
377
+ // `degradedSubsystems` being non-empty — and get the signal that was
378
+ // missing during the outage, with no restart-loop risk.
379
+ const ok = !stale && loopStatus !== 'stopping' && loopStatus !== 'unknown';
380
+ const status = !ok ? 'unknown' : degradedSubsystems.length > 0 ? 'degraded' : 'ok';
381
+ const reason = stale
382
+ ? 'heartbeat stale'
383
+ : loopStatus === 'stopping'
384
+ ? 'loop stopping'
385
+ : degradedSubsystems.length > 0
386
+ ? `dispatch-gating subsystem not healthy: ${degradedSubsystems.join(', ')}`
387
+ : undefined;
388
+ return {
389
+ schemaVersion: FACTORY_PUBLIC_HEALTH_SCHEMA_VERSION,
390
+ ok,
391
+ status,
392
+ stale,
393
+ ...(updatedAtMs !== undefined ? { updatedAtMs } : {}),
394
+ ...(ageMs !== undefined ? { ageMs } : {}),
395
+ loopStatus,
396
+ degradedSubsystems: [...degradedSubsystems],
397
+ ...(reason ? { reason } : {}),
398
+ ...(readinessReconcile ? { readinessReconcile } : {}),
399
+ ...(eventListener ? { eventListener } : {}),
400
+ ...(fleetControlPlane ? { fleetControlPlane } : {}),
401
+ ...(dispatchCapacity ? { dispatchCapacity } : {}),
402
+ };
403
+ }
404
+ /**
405
+ * Re-read a health record that arrived over the wire.
406
+ *
407
+ * A reader of a remote `/healthz` holds parsed JSON from a process it does
408
+ * not control and that may be several versions behind. Running it back
409
+ * through the same coercions the writer used means a caller can rely on the
410
+ * shape — and means an unrecognised state or a hostile string cannot reach a
411
+ * terminal or a downstream report just because it arrived over HTTP.
412
+ *
413
+ * The derived fields are read, not recomputed: they were derived against the
414
+ * writer's clock, and a reader's clock would report skew as stall.
415
+ *
416
+ * Returns `undefined` when the record is absent, which is how a caller tells
417
+ * "instance predates the diagnostics block" from "instance is unhealthy".
418
+ */
419
+ export function normalizePublicHealth(value) {
420
+ const record = plainRecord(value);
421
+ if (!record)
422
+ return undefined;
423
+ const readiness = plainRecord(record.readinessReconcile);
424
+ const listener = plainRecord(record.eventListener);
425
+ const fleet = plainRecord(record.fleetControlPlane);
426
+ const capacity = plainRecord(record.dispatchCapacity);
427
+ const degradedSubsystems = Array.isArray(record.degradedSubsystems)
428
+ ? DISPATCH_GATING_SUBSYSTEMS.filter((name) => record.degradedSubsystems.includes(name))
429
+ : [];
430
+ const status = enumValue(record.status, ['ok', 'degraded']);
431
+ return {
432
+ schemaVersion: finiteNumber(record.schemaVersion) ?? FACTORY_PUBLIC_HEALTH_SCHEMA_VERSION,
433
+ ok: record.ok === true,
434
+ status,
435
+ stale: record.stale === true,
436
+ ...optionalTimestamp('updatedAtMs', record.updatedAtMs),
437
+ ...optionalDuration('ageMs', record.ageMs),
438
+ loopStatus: enumValue(record.loopStatus, ['running', 'idle', 'stopping']),
439
+ degradedSubsystems: [...degradedSubsystems],
440
+ ...(typeof record.reason === 'string'
441
+ ? { reason: boundedText(record.reason) }
442
+ : {}),
443
+ ...(readiness
444
+ ? {
445
+ readinessReconcile: {
446
+ state: enumValue(readiness.state, READINESS_RECONCILE_STATES),
447
+ consecutiveFailures: counter(readiness.consecutiveFailures),
448
+ failureThreshold: counter(readiness.failureThreshold),
449
+ ...optionalPositive('intervalMs', readiness.intervalMs),
450
+ ...optionalDuration('lastDurationMs', readiness.lastDurationMs),
451
+ ...optionalTimestamp('lastStartedAtMs', readiness.lastStartedAtMs),
452
+ ...optionalTimestamp('lastCompletedAtMs', readiness.lastCompletedAtMs),
453
+ ...optionalTimestamp('lastFailureAtMs', readiness.lastFailureAtMs),
454
+ ...optionalDuration('inFlightMs', readiness.inFlightMs),
455
+ ...optionalCount('missedPasses', readiness.missedPasses),
456
+ ...(readiness.lastErrorClass !== undefined
457
+ ? { lastErrorClass: telemetryErrorClassName(readiness.lastErrorClass) }
458
+ : {}),
459
+ },
460
+ }
461
+ : {}),
462
+ ...(listener ? { eventListener: { state: enumValue(listener.state, EVENT_LISTENER_STATES) } } : {}),
463
+ ...(fleet
464
+ ? {
465
+ fleetControlPlane: {
466
+ state: enumValue(fleet.state, FLEET_CONTROL_PLANE_STATES),
467
+ consecutiveFailures: counter(fleet.consecutiveFailures),
468
+ failureThreshold: counter(fleet.failureThreshold),
469
+ ...optionalTimestamp('lastFailureAtMs', fleet.lastFailureAtMs),
470
+ ...optionalTimestamp('retryAtMs', fleet.retryAtMs),
471
+ },
472
+ }
473
+ : {}),
474
+ ...(capacity
475
+ ? {
476
+ dispatchCapacity: {
477
+ state: dispatchCapacityState(capacity.state, counter(capacity.waiting), optionalDuration('longestWaitMs', capacity.longestWaitMs).longestWaitMs, positiveNumber(capacity.waitWarnMs) ?? DEFAULT_CAPACITY_WAIT_WARN_MS),
478
+ batchSize: counter(capacity.batchSize),
479
+ active: counter(capacity.active),
480
+ waiting: counter(capacity.waiting),
481
+ waitWarnMs: positiveNumber(capacity.waitWarnMs) ?? DEFAULT_CAPACITY_WAIT_WARN_MS,
482
+ agentlessHoldTimeoutMs: positiveNumber(capacity.agentlessHoldTimeoutMs)
483
+ ?? DEFAULT_AGENTLESS_HOLD_TIMEOUT_MS,
484
+ ...optionalDuration('longestWaitMs', capacity.longestWaitMs),
485
+ ...optionalCount('agentlessOccupants', capacity.agentlessOccupants),
486
+ },
487
+ }
488
+ : {}),
489
+ };
490
+ }
491
+ //# sourceMappingURL=public-health.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-health.js","sourceRoot":"","sources":["../../src/orchestrator/public-health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AAEzE,OAAO,EAAE,iCAAiC,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAcnG;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAA;AAErD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,uCAAuC,GAAG,MAAM,CAAA;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,CAAA;AAErD,kFAAkF;AAClF,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAA;AAEpD,MAAM,0BAA0B,GAA2C;IACzE,aAAa;IACb,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;CACV,CAAA;AAED,MAAM,qBAAqB,GAAmD;IAC5E,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