@claude-flow/plugin-agent-federation 1.0.0-alpha.10

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 (90) hide show
  1. package/README.md +45 -0
  2. package/dist/application/federation-breaker-service.d.ts +182 -0
  3. package/dist/application/federation-breaker-service.d.ts.map +1 -0
  4. package/dist/application/federation-breaker-service.js +251 -0
  5. package/dist/application/federation-breaker-service.js.map +1 -0
  6. package/dist/application/federation-coordinator.d.ts +166 -0
  7. package/dist/application/federation-coordinator.d.ts.map +1 -0
  8. package/dist/application/federation-coordinator.js +412 -0
  9. package/dist/application/federation-coordinator.js.map +1 -0
  10. package/dist/application/inbound-dispatcher.d.ts +59 -0
  11. package/dist/application/inbound-dispatcher.d.ts.map +1 -0
  12. package/dist/application/inbound-dispatcher.js +96 -0
  13. package/dist/application/inbound-dispatcher.js.map +1 -0
  14. package/dist/application/policy-engine.d.ts +41 -0
  15. package/dist/application/policy-engine.d.ts.map +1 -0
  16. package/dist/application/policy-engine.js +184 -0
  17. package/dist/application/policy-engine.js.map +1 -0
  18. package/dist/application/spend-reporter.d.ts +150 -0
  19. package/dist/application/spend-reporter.d.ts.map +1 -0
  20. package/dist/application/spend-reporter.js +128 -0
  21. package/dist/application/spend-reporter.js.map +1 -0
  22. package/dist/application/trust-evaluator.d.ts +42 -0
  23. package/dist/application/trust-evaluator.d.ts.map +1 -0
  24. package/dist/application/trust-evaluator.js +132 -0
  25. package/dist/application/trust-evaluator.js.map +1 -0
  26. package/dist/bin.d.ts +13 -0
  27. package/dist/bin.d.ts.map +1 -0
  28. package/dist/bin.js +189 -0
  29. package/dist/bin.js.map +1 -0
  30. package/dist/cli-commands.d.ts +7 -0
  31. package/dist/cli-commands.d.ts.map +1 -0
  32. package/dist/cli-commands.js +198 -0
  33. package/dist/cli-commands.js.map +1 -0
  34. package/dist/domain/entities/federation-envelope.d.ts +45 -0
  35. package/dist/domain/entities/federation-envelope.d.ts.map +1 -0
  36. package/dist/domain/entities/federation-envelope.js +71 -0
  37. package/dist/domain/entities/federation-envelope.js.map +1 -0
  38. package/dist/domain/entities/federation-node.d.ts +104 -0
  39. package/dist/domain/entities/federation-node.d.ts.map +1 -0
  40. package/dist/domain/entities/federation-node.js +152 -0
  41. package/dist/domain/entities/federation-node.js.map +1 -0
  42. package/dist/domain/entities/federation-session.d.ts +55 -0
  43. package/dist/domain/entities/federation-session.d.ts.map +1 -0
  44. package/dist/domain/entities/federation-session.js +105 -0
  45. package/dist/domain/entities/federation-session.js.map +1 -0
  46. package/dist/domain/entities/trust-level.d.ts +17 -0
  47. package/dist/domain/entities/trust-level.d.ts.map +1 -0
  48. package/dist/domain/entities/trust-level.js +35 -0
  49. package/dist/domain/entities/trust-level.js.map +1 -0
  50. package/dist/domain/services/audit-service.d.ts +69 -0
  51. package/dist/domain/services/audit-service.d.ts.map +1 -0
  52. package/dist/domain/services/audit-service.js +149 -0
  53. package/dist/domain/services/audit-service.js.map +1 -0
  54. package/dist/domain/services/discovery-service.d.ts +51 -0
  55. package/dist/domain/services/discovery-service.d.ts.map +1 -0
  56. package/dist/domain/services/discovery-service.js +140 -0
  57. package/dist/domain/services/discovery-service.js.map +1 -0
  58. package/dist/domain/services/handshake-service.d.ts +48 -0
  59. package/dist/domain/services/handshake-service.d.ts.map +1 -0
  60. package/dist/domain/services/handshake-service.js +94 -0
  61. package/dist/domain/services/handshake-service.js.map +1 -0
  62. package/dist/domain/services/pii-pipeline-service.d.ts +65 -0
  63. package/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
  64. package/dist/domain/services/pii-pipeline-service.js +208 -0
  65. package/dist/domain/services/pii-pipeline-service.js.map +1 -0
  66. package/dist/domain/services/routing-service.d.ts +51 -0
  67. package/dist/domain/services/routing-service.d.ts.map +1 -0
  68. package/dist/domain/services/routing-service.js +147 -0
  69. package/dist/domain/services/routing-service.js.map +1 -0
  70. package/dist/domain/value-objects/federation-budget.d.ts +89 -0
  71. package/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
  72. package/dist/domain/value-objects/federation-budget.js +165 -0
  73. package/dist/domain/value-objects/federation-budget.js.map +1 -0
  74. package/dist/domain/value-objects/federation-node-state.d.ts +92 -0
  75. package/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
  76. package/dist/domain/value-objects/federation-node-state.js +100 -0
  77. package/dist/domain/value-objects/federation-node-state.js.map +1 -0
  78. package/dist/index.d.ts +17 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +17 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/mcp-tools.d.ts +8 -0
  83. package/dist/mcp-tools.d.ts.map +1 -0
  84. package/dist/mcp-tools.js +343 -0
  85. package/dist/mcp-tools.js.map +1 -0
  86. package/dist/plugin.d.ts +18 -0
  87. package/dist/plugin.d.ts.map +1 -0
  88. package/dist/plugin.js +376 -0
  89. package/dist/plugin.js.map +1 -0
  90. package/package.json +44 -0
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Federation budget + hop counter (ADR-097 Phase 1).
3
+ *
4
+ * Carried in {@link FederationEnvelope} alongside the existing
5
+ * sourceNodeId/targetNodeId/payload. Sender supplies the original limits;
6
+ * each outbound hop increments hopCount and decrements remaining budget.
7
+ *
8
+ * Phase 1 enforces at the *send* side because there is no inbound
9
+ * dispatcher today (sendToNode is a stub — see researcher report).
10
+ * Phase 2 will move the decrement to receive once the inbound path lands.
11
+ *
12
+ * Security invariants pinned by the reviewer (audit_1776853149979 follow-up):
13
+ *
14
+ * 1. validateBudget rejects NaN, ±Infinity, negative numbers, and
15
+ * non-integer hop counts. Returns a discriminated result so callers
16
+ * cannot accidentally use a bad budget unchecked.
17
+ * 2. enforceBudget runs check-then-decrement in a single synchronous
18
+ * function with no awaits inside — two concurrent send calls cannot
19
+ * both pass the pre-check.
20
+ * 3. Errors return constant strings ("HOP_LIMIT_EXCEEDED" /
21
+ * "BUDGET_EXCEEDED") with no remaining-budget echo so a caller can't
22
+ * use the error response as an oracle for the threshold.
23
+ */
24
+ /** Maximum hops a federation message may travel before the breaker opens. */
25
+ export const DEFAULT_MAX_HOPS = 8;
26
+ /** Hard ceiling on caller-supplied maxUsd to prevent absurd integer math. */
27
+ const MAX_USD_CEILING = 1_000_000;
28
+ /** Hard ceiling on caller-supplied maxTokens. 1B tokens is more than any real session. */
29
+ const MAX_TOKENS_CEILING = 1_000_000_000;
30
+ /** Hard ceiling on hop count. */
31
+ const MAX_HOPS_CEILING = 64;
32
+ /**
33
+ * Validate a raw budget object. Pure, no side effects. Caller obtains either
34
+ * a guaranteed-safe Budget or a structured error suitable for logging.
35
+ *
36
+ * Accepts undefined/null and returns a default unbounded budget (maxHops =
37
+ * DEFAULT_MAX_HOPS, tokens/usd = Infinity). This preserves backward
38
+ * compatibility for callers that don't pass a budget at all.
39
+ */
40
+ export function validateBudget(raw, overrideMaxHops) {
41
+ // Default unbounded budget when caller passes nothing.
42
+ if (raw == null && overrideMaxHops == null) {
43
+ return {
44
+ ok: true,
45
+ budget: {
46
+ maxHops: DEFAULT_MAX_HOPS,
47
+ maxTokens: Number.POSITIVE_INFINITY,
48
+ maxUsd: Number.POSITIVE_INFINITY,
49
+ },
50
+ };
51
+ }
52
+ // Caller passed a bare maxHops without a budget object — accept it as a
53
+ // hop-only budget. Useful for "no remote delegation allowed" via
54
+ // maxHops: 0.
55
+ if (raw == null && overrideMaxHops != null) {
56
+ const hopCheck = checkHops(overrideMaxHops);
57
+ if (!hopCheck.ok)
58
+ return hopCheck;
59
+ return {
60
+ ok: true,
61
+ budget: {
62
+ maxHops: hopCheck.value,
63
+ maxTokens: Number.POSITIVE_INFINITY,
64
+ maxUsd: Number.POSITIVE_INFINITY,
65
+ },
66
+ };
67
+ }
68
+ if (typeof raw !== 'object' || Array.isArray(raw)) {
69
+ return { ok: false, error: 'budget must be an object' };
70
+ }
71
+ const obj = raw;
72
+ const hopsRaw = overrideMaxHops ?? obj.maxHops;
73
+ const hopCheck = hopsRaw == null
74
+ ? { ok: true, value: DEFAULT_MAX_HOPS }
75
+ : checkHops(hopsRaw);
76
+ if (!hopCheck.ok)
77
+ return hopCheck;
78
+ const tokensCheck = obj.maxTokens == null
79
+ ? { ok: true, value: Number.POSITIVE_INFINITY }
80
+ : checkBound(obj.maxTokens, MAX_TOKENS_CEILING, 'maxTokens', true);
81
+ if (!tokensCheck.ok)
82
+ return tokensCheck;
83
+ const usdCheck = obj.maxUsd == null
84
+ ? { ok: true, value: Number.POSITIVE_INFINITY }
85
+ : checkBound(obj.maxUsd, MAX_USD_CEILING, 'maxUsd', false);
86
+ if (!usdCheck.ok)
87
+ return usdCheck;
88
+ return {
89
+ ok: true,
90
+ budget: {
91
+ maxHops: hopCheck.value,
92
+ maxTokens: tokensCheck.value,
93
+ maxUsd: usdCheck.value,
94
+ },
95
+ };
96
+ }
97
+ function checkHops(v) {
98
+ if (typeof v !== 'number' || !Number.isFinite(v) || !Number.isInteger(v)) {
99
+ return { ok: false, error: 'maxHops must be a finite integer' };
100
+ }
101
+ if (v < 0)
102
+ return { ok: false, error: 'maxHops must be >= 0' };
103
+ if (v > MAX_HOPS_CEILING) {
104
+ return { ok: false, error: `maxHops exceeds ceiling (${MAX_HOPS_CEILING})` };
105
+ }
106
+ return { ok: true, value: v };
107
+ }
108
+ function checkBound(v, ceiling, label, requireInteger) {
109
+ if (typeof v !== 'number' || !Number.isFinite(v)) {
110
+ return { ok: false, error: `${label} must be a finite number` };
111
+ }
112
+ if (requireInteger && !Number.isInteger(v)) {
113
+ return { ok: false, error: `${label} must be an integer` };
114
+ }
115
+ if (v < 0)
116
+ return { ok: false, error: `${label} must be >= 0` };
117
+ if (v > ceiling) {
118
+ return { ok: false, error: `${label} exceeds ceiling (${ceiling})` };
119
+ }
120
+ return { ok: true, value: v };
121
+ }
122
+ /**
123
+ * Atomic (single synchronous function, no internal awaits) hop check.
124
+ *
125
+ * Returns the hopCount value the OUTBOUND envelope should carry plus the
126
+ * remaining budget that downstream peers will see. Callers must use the
127
+ * returned values; mutating the input Budget is forbidden (it's readonly).
128
+ *
129
+ * Contract:
130
+ * - hopCount represents how many hops the message has already taken.
131
+ * - The next outbound hop increments it: nextHopCount = hopCount + 1.
132
+ * - The check fires AFTER increment: nextHopCount must be <= maxHops.
133
+ * - This means maxHops=0 refuses to forward at all, which matches the
134
+ * ADR's "no remote delegation allowed" semantic.
135
+ *
136
+ * tokensSpent / usdSpent are caller-reported actuals from the immediately
137
+ * preceding leg (or 0 on the originator). The check fires on the
138
+ * *post-spend* totals so a leg that overshoots is caught before the next
139
+ * outbound dispatch.
140
+ */
141
+ export function enforceBudget(budget, hopCount, spent = { tokens: 0, usd: 0 }) {
142
+ const nextHopCount = hopCount + 1;
143
+ if (nextHopCount > budget.maxHops) {
144
+ return { ok: false, reason: 'HOP_LIMIT_EXCEEDED' };
145
+ }
146
+ // Negative spend is a programming error; treat as 0 rather than refunding
147
+ // the budget (which would let a malicious caller inflate remaining).
148
+ const ts = Math.max(0, spent.tokens);
149
+ const us = Math.max(0, spent.usd);
150
+ const remainingTokens = budget.maxTokens - ts;
151
+ const remainingUsd = budget.maxUsd - us;
152
+ if (remainingTokens < 0 || remainingUsd < 0) {
153
+ return { ok: false, reason: 'BUDGET_EXCEEDED' };
154
+ }
155
+ return {
156
+ ok: true,
157
+ nextHopCount,
158
+ remaining: {
159
+ maxHops: budget.maxHops,
160
+ maxTokens: remainingTokens,
161
+ maxUsd: remainingUsd,
162
+ },
163
+ };
164
+ }
165
+ //# sourceMappingURL=federation-budget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-budget.js","sourceRoot":"","sources":["../../../src/domain/value-objects/federation-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,6EAA6E;AAC7E,MAAM,eAAe,GAAG,SAAS,CAAC;AAClC,0FAA0F;AAC1F,MAAM,kBAAkB,GAAG,aAAa,CAA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AC;IAClC,IAAI,YAAY,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QAClC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;IACrD,CAAC;IACD,0EAA0E;IAC1E,qEAAqE;IACrE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;IAC9C,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;IACxC,IAAI,eAAe,GAAG,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAClD,CAAC;IACD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,YAAY;QACZ,SAAS,EAAE;YACT,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,eAAe;YAC1B,MAAM,EAAE,YAAY;SACrB;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Federation peer state machine (ADR-097 Phase 2).
3
+ *
4
+ * Phase 1 shipped the budget envelope + enforcer that travels with every
5
+ * outbound message. Phase 2 adds the per-peer breaker: when a peer crosses a
6
+ * cost or failure threshold, transition it to SUSPENDED so subsequent
7
+ * `federation_send` calls short-circuit. After a cooldown the peer can
8
+ * recover; if it stays bad the breaker escalates to EVICTED.
9
+ *
10
+ * This module is the *value object* layer — pure, no I/O. The breaker
11
+ * service (Phase 2.b, separate file) reads cost-tracker telemetry, evaluates
12
+ * thresholds, and calls `transition` on the FederationNode entity. Decoupling
13
+ * the state machine from the policy lets tests pin transitions without
14
+ * standing up the cost bus.
15
+ *
16
+ * Security invariants pinned by the spec:
17
+ *
18
+ * 1. EVICTED is terminal under normal flow. The only way out is an
19
+ * explicit `reactivate` call (operator-initiated). This prevents a
20
+ * misbehaving peer from auto-recovering through the cooldown.
21
+ * 2. canTransition is the single source of truth for legality. Any path
22
+ * that mutates state MUST consult it; direct field writes are not
23
+ * permitted (entity getter/setter shape enforces this).
24
+ * 3. Reasons are constant strings, no remaining-budget echo on failure
25
+ * (matches Phase 1's anti-oracle posture).
26
+ * 4. Default cooldown is conservative (30 min) so a transient spike
27
+ * cannot ping-pong a peer ACTIVE↔SUSPENDED at high frequency.
28
+ */
29
+ /** Lifecycle state of a federation peer. */
30
+ export declare enum FederationNodeState {
31
+ /** Default; healthy. `federation_send` accepts deliveries. */
32
+ ACTIVE = "ACTIVE",
33
+ /** Breaker tripped. Sends short-circuit with PEER_SUSPENDED. */
34
+ SUSPENDED = "SUSPENDED",
35
+ /** Removed from active rotation. Sends short-circuit with PEER_EVICTED. */
36
+ EVICTED = "EVICTED"
37
+ }
38
+ /** Reason a peer was suspended/evicted. Constant strings — no echo of caps. */
39
+ export type SuspensionReason = 'COST_THRESHOLD_EXCEEDED' | 'FAILURE_RATIO_EXCEEDED' | 'MANUAL_SUSPEND' | 'GRACE_PERIOD_EXPIRED' | 'MANUAL_EVICT';
40
+ /**
41
+ * Default cooldown a SUSPENDED peer must wait before being eligible for
42
+ * SUSPENDED → ACTIVE. 30 minutes matches the ADR-097 Part 2 spec and is
43
+ * intentionally well past the prompt-cache window so a recovery probe is
44
+ * cheap to amortize.
45
+ */
46
+ export declare const DEFAULT_SUSPENSION_COOLDOWN_MS: number;
47
+ /**
48
+ * Default age at which a continuously-SUSPENDED peer is auto-escalated to
49
+ * EVICTED. 24 hours per spec — long enough to ride out a cost-tracker
50
+ * outage without false eviction, short enough that a genuinely-broken peer
51
+ * doesn't linger forever.
52
+ */
53
+ export declare const DEFAULT_AUTO_EVICTION_AGE_MS: number;
54
+ /** A successful transition's reason payload (for the audit trail). */
55
+ export interface TransitionReason {
56
+ readonly reason: SuspensionReason;
57
+ /** Optional opaque correlation key — task ID, breaker run ID, etc. */
58
+ readonly correlationId?: string;
59
+ }
60
+ /**
61
+ * Static legality table for state transitions. Returns true iff the
62
+ * `from -> to` edge is in the allowed set. Used by the entity to reject
63
+ * illegal mutations before applying them.
64
+ *
65
+ * Allowed edges:
66
+ * ACTIVE → SUSPENDED (breaker trips)
67
+ * SUSPENDED → ACTIVE (cooldown + probe success)
68
+ * SUSPENDED → EVICTED (grace expired, or manual evict)
69
+ * ACTIVE → EVICTED (manual evict only — skips suspend)
70
+ * EVICTED → ACTIVE (manual reactivate only)
71
+ *
72
+ * Disallowed (anything else, including self-loops, is a no-op error).
73
+ */
74
+ export declare function canTransition(from: FederationNodeState, to: FederationNodeState): boolean;
75
+ /**
76
+ * Should a SUSPENDED peer be eligible for SUSPENDED → ACTIVE based purely
77
+ * on elapsed time? The breaker still has to confirm health via probe before
78
+ * it actually calls reactivate; this just answers "is the cooldown done?"
79
+ *
80
+ * Pure function of (suspendedAt, now, cooldownMs) so it's trivially
81
+ * deterministic in tests.
82
+ */
83
+ export declare function isCooldownElapsed(suspendedAt: Date, now: Date, cooldownMs?: number): boolean;
84
+ /**
85
+ * Should a SUSPENDED peer be auto-escalated to EVICTED based on the age of
86
+ * its suspension? Returns true once the peer has been continuously
87
+ * SUSPENDED past the configured limit (default 24h). The breaker calls
88
+ * this on each tick and, if true, issues the SUSPENDED → EVICTED
89
+ * transition with reason GRACE_PERIOD_EXPIRED.
90
+ */
91
+ export declare function shouldAutoEvict(suspendedAt: Date, now: Date, ageLimitMs?: number): boolean;
92
+ //# sourceMappingURL=federation-node-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-node-state.d.ts","sourceRoot":"","sources":["../../../src/domain/value-objects/federation-node-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,4CAA4C;AAC5C,oBAAY,mBAAmB;IAC7B,8DAA8D;IAC9D,MAAM,WAAW;IACjB,gEAAgE;IAChE,SAAS,cAAc;IACvB,2EAA2E;IAC3E,OAAO,YAAY;CACpB;AAED,+EAA+E;AAC/E,MAAM,MAAM,gBAAgB,GACxB,yBAAyB,GACzB,wBAAwB,GACxB,gBAAgB,GAChB,sBAAsB,GACtB,cAAc,CAAC;AAEnB;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,QAAiB,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAAsB,CAAC;AAEhE,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,sEAAsE;IACtE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,mBAAmB,EACzB,EAAE,EAAE,mBAAmB,GACtB,OAAO,CAUT;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,IAAI,EACjB,GAAG,EAAE,IAAI,EACT,UAAU,GAAE,MAAuC,GAClD,OAAO,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,IAAI,EACjB,GAAG,EAAE,IAAI,EACT,UAAU,GAAE,MAAqC,GAChD,OAAO,CAET"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Federation peer state machine (ADR-097 Phase 2).
3
+ *
4
+ * Phase 1 shipped the budget envelope + enforcer that travels with every
5
+ * outbound message. Phase 2 adds the per-peer breaker: when a peer crosses a
6
+ * cost or failure threshold, transition it to SUSPENDED so subsequent
7
+ * `federation_send` calls short-circuit. After a cooldown the peer can
8
+ * recover; if it stays bad the breaker escalates to EVICTED.
9
+ *
10
+ * This module is the *value object* layer — pure, no I/O. The breaker
11
+ * service (Phase 2.b, separate file) reads cost-tracker telemetry, evaluates
12
+ * thresholds, and calls `transition` on the FederationNode entity. Decoupling
13
+ * the state machine from the policy lets tests pin transitions without
14
+ * standing up the cost bus.
15
+ *
16
+ * Security invariants pinned by the spec:
17
+ *
18
+ * 1. EVICTED is terminal under normal flow. The only way out is an
19
+ * explicit `reactivate` call (operator-initiated). This prevents a
20
+ * misbehaving peer from auto-recovering through the cooldown.
21
+ * 2. canTransition is the single source of truth for legality. Any path
22
+ * that mutates state MUST consult it; direct field writes are not
23
+ * permitted (entity getter/setter shape enforces this).
24
+ * 3. Reasons are constant strings, no remaining-budget echo on failure
25
+ * (matches Phase 1's anti-oracle posture).
26
+ * 4. Default cooldown is conservative (30 min) so a transient spike
27
+ * cannot ping-pong a peer ACTIVE↔SUSPENDED at high frequency.
28
+ */
29
+ /** Lifecycle state of a federation peer. */
30
+ export var FederationNodeState;
31
+ (function (FederationNodeState) {
32
+ /** Default; healthy. `federation_send` accepts deliveries. */
33
+ FederationNodeState["ACTIVE"] = "ACTIVE";
34
+ /** Breaker tripped. Sends short-circuit with PEER_SUSPENDED. */
35
+ FederationNodeState["SUSPENDED"] = "SUSPENDED";
36
+ /** Removed from active rotation. Sends short-circuit with PEER_EVICTED. */
37
+ FederationNodeState["EVICTED"] = "EVICTED";
38
+ })(FederationNodeState || (FederationNodeState = {}));
39
+ /**
40
+ * Default cooldown a SUSPENDED peer must wait before being eligible for
41
+ * SUSPENDED → ACTIVE. 30 minutes matches the ADR-097 Part 2 spec and is
42
+ * intentionally well past the prompt-cache window so a recovery probe is
43
+ * cheap to amortize.
44
+ */
45
+ export const DEFAULT_SUSPENSION_COOLDOWN_MS = 30 * 60 * 1000;
46
+ /**
47
+ * Default age at which a continuously-SUSPENDED peer is auto-escalated to
48
+ * EVICTED. 24 hours per spec — long enough to ride out a cost-tracker
49
+ * outage without false eviction, short enough that a genuinely-broken peer
50
+ * doesn't linger forever.
51
+ */
52
+ export const DEFAULT_AUTO_EVICTION_AGE_MS = 24 * 60 * 60 * 1000;
53
+ /**
54
+ * Static legality table for state transitions. Returns true iff the
55
+ * `from -> to` edge is in the allowed set. Used by the entity to reject
56
+ * illegal mutations before applying them.
57
+ *
58
+ * Allowed edges:
59
+ * ACTIVE → SUSPENDED (breaker trips)
60
+ * SUSPENDED → ACTIVE (cooldown + probe success)
61
+ * SUSPENDED → EVICTED (grace expired, or manual evict)
62
+ * ACTIVE → EVICTED (manual evict only — skips suspend)
63
+ * EVICTED → ACTIVE (manual reactivate only)
64
+ *
65
+ * Disallowed (anything else, including self-loops, is a no-op error).
66
+ */
67
+ export function canTransition(from, to) {
68
+ if (from === to)
69
+ return false;
70
+ if (from === FederationNodeState.ACTIVE) {
71
+ return to === FederationNodeState.SUSPENDED || to === FederationNodeState.EVICTED;
72
+ }
73
+ if (from === FederationNodeState.SUSPENDED) {
74
+ return to === FederationNodeState.ACTIVE || to === FederationNodeState.EVICTED;
75
+ }
76
+ // EVICTED is terminal except for explicit operator reactivate.
77
+ return to === FederationNodeState.ACTIVE;
78
+ }
79
+ /**
80
+ * Should a SUSPENDED peer be eligible for SUSPENDED → ACTIVE based purely
81
+ * on elapsed time? The breaker still has to confirm health via probe before
82
+ * it actually calls reactivate; this just answers "is the cooldown done?"
83
+ *
84
+ * Pure function of (suspendedAt, now, cooldownMs) so it's trivially
85
+ * deterministic in tests.
86
+ */
87
+ export function isCooldownElapsed(suspendedAt, now, cooldownMs = DEFAULT_SUSPENSION_COOLDOWN_MS) {
88
+ return now.getTime() - suspendedAt.getTime() >= cooldownMs;
89
+ }
90
+ /**
91
+ * Should a SUSPENDED peer be auto-escalated to EVICTED based on the age of
92
+ * its suspension? Returns true once the peer has been continuously
93
+ * SUSPENDED past the configured limit (default 24h). The breaker calls
94
+ * this on each tick and, if true, issues the SUSPENDED → EVICTED
95
+ * transition with reason GRACE_PERIOD_EXPIRED.
96
+ */
97
+ export function shouldAutoEvict(suspendedAt, now, ageLimitMs = DEFAULT_AUTO_EVICTION_AGE_MS) {
98
+ return now.getTime() - suspendedAt.getTime() >= ageLimitMs;
99
+ }
100
+ //# sourceMappingURL=federation-node-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-node-state.js","sourceRoot":"","sources":["../../../src/domain/value-objects/federation-node-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,4CAA4C;AAC5C,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,8DAA8D;IAC9D,wCAAiB,CAAA;IACjB,gEAAgE;IAChE,8CAAuB,CAAA;IACvB,2EAA2E;IAC3E,0CAAmB,CAAA;AACrB,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B;AAUD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAShE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAyB,EACzB,EAAuB;IAEvB,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAC9B,IAAI,IAAI,KAAK,mBAAmB,CAAC,MAAM,EAAE,CAAC;QACxC,OAAO,EAAE,KAAK,mBAAmB,CAAC,SAAS,IAAI,EAAE,KAAK,mBAAmB,CAAC,OAAO,CAAC;IACpF,CAAC;IACD,IAAI,IAAI,KAAK,mBAAmB,CAAC,SAAS,EAAE,CAAC;QAC3C,OAAO,EAAE,KAAK,mBAAmB,CAAC,MAAM,IAAI,EAAE,KAAK,mBAAmB,CAAC,OAAO,CAAC;IACjF,CAAC;IACD,+DAA+D;IAC/D,OAAO,EAAE,KAAK,mBAAmB,CAAC,MAAM,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,WAAiB,EACjB,GAAS,EACT,aAAqB,8BAA8B;IAEnD,OAAO,GAAG,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,IAAI,UAAU,CAAC;AAC7D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,WAAiB,EACjB,GAAS,EACT,aAAqB,4BAA4B;IAEjD,OAAO,GAAG,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,IAAI,UAAU,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,17 @@
1
+ export { AgentFederationPlugin } from './plugin.js';
2
+ export { FederationNode, type FederationNodeProps, type FederationNodeCapabilities, type FederationNodeMetadata, type FederationNodeStateRecord } from './domain/entities/federation-node.js';
3
+ export { FederationNodeState, type SuspensionReason, type TransitionReason, canTransition, isCooldownElapsed, shouldAutoEvict, DEFAULT_SUSPENSION_COOLDOWN_MS, DEFAULT_AUTO_EVICTION_AGE_MS, } from './domain/value-objects/federation-node-state.js';
4
+ export { FederationBreakerService, evaluatePolicy, DEFAULT_BREAKER_POLICY, DEFAULT_MAX_SAMPLES_PER_PEER, type BreakerPolicy, type BreakerDecision, type SendOutcome, } from './application/federation-breaker-service.js';
5
+ export { InMemorySpendReporter, MemorySpendReporter, DEFAULT_FEDERATION_SPEND_NAMESPACE, DEFAULT_FEDERATION_SPEND_TTL_SECONDS, type SpendReporter, type MemoryStore, type MemorySpendReporterConfig, type FederationSpendEvent, } from './application/spend-reporter.js';
6
+ export { FederationSession, type FederationSessionProps, type SessionMetrics } from './domain/entities/federation-session.js';
7
+ export { FederationEnvelope, type FederationEnvelopeProps, type FederationMessageType, type PIIScanResult, type PIIScanDetection, type PIIScanAction, CONSENSUS_REQUIRED_TYPES, } from './domain/entities/federation-envelope.js';
8
+ export { TrustLevel, TRUST_TRANSITION_THRESHOLDS, CAPABILITY_GATES, isOperationAllowed, getTrustLevelLabel, type TrustTransitionThreshold, } from './domain/entities/trust-level.js';
9
+ export { PIIPipelineService, type PIIType, type PIIAction, type PIIDetection, type PIIPolicyConfig, type PIICalibration, type PIITransformResult, type PIIConfidenceThresholds, type PIIPipelineServiceDeps, } from './domain/services/pii-pipeline-service.js';
10
+ export { DiscoveryService, type DiscoveryMechanism, type FederationManifest, type DiscoveryServiceDeps, type DiscoveryConfig, } from './domain/services/discovery-service.js';
11
+ export { HandshakeService, type HandshakeChallenge, type HandshakeChallengeResponse, type HandshakeResult, type HandshakeServiceDeps, type HandshakeConfig, } from './domain/services/handshake-service.js';
12
+ export { RoutingService, type RoutingMode, type RoutingResult, type ConsensusProposal, type RoutingServiceDeps, } from './domain/services/routing-service.js';
13
+ export { AuditService, type FederationAuditEvent, type FederationAuditEventType, type AuditSeverity, type AuditCategory, type ComplianceMode, type AuditQuery, type AuditExportFormat, type AuditServiceDeps, type AuditServiceConfig, } from './domain/services/audit-service.js';
14
+ export { TrustEvaluator, type TrustScoreComponents, type TrustTransitionResult, type ImmediateDowngradeReason, type TrustEvaluatorDeps, } from './application/trust-evaluator.js';
15
+ export { FederationCoordinator, type FederationCoordinatorConfig, type FederationStatus, } from './application/federation-coordinator.js';
16
+ export { PolicyEngine, type FederationClaimType, type SecurityPolicy, type PolicyEvaluationResult, type PolicyEngineDeps, } from './application/policy-engine.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,0BAA0B,EAAE,KAAK,sBAAsB,EAAE,KAAK,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAC9L,OAAO,EACL,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,wBAAwB,EACxB,cAA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BAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,GACxB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,GACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,qBAAqB,EACrB,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,GACtB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,gCAAgC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ export { AgentFederationPlugin } from './plugin.js';
2
+ export { FederationNode } from './domain/entities/federation-node.js';
3
+ export { FederationNodeState, canTransition, isCooldownElapsed, shouldAutoEvict, DEFAULT_SUSPENSION_COOLDOWN_MS, DEFAULT_AUTO_EVICTION_AGE_MS, } from './domain/value-objects/federation-node-state.js';
4
+ export { FederationBreakerService, evaluatePolicy, DEFAULT_BREAKER_POLICY, DEFAULT_MAX_SAMPLES_PER_PEER, } from './application/federation-breaker-service.js';
5
+ export { InMemorySpendReporter, MemorySpendReporter, DEFAULT_FEDERATION_SPEND_NAMESPACE, DEFAULT_FEDERATION_SPEND_TTL_SECONDS, } from './application/spend-reporter.js';
6
+ export { FederationSession } from './domain/entities/federation-session.js';
7
+ export { FederationEnvelope, CONSENSUS_REQUIRED_TYPES, } from './domain/entities/federation-envelope.js';
8
+ export { TrustLevel, TRUST_TRANSITION_THRESHOLDS, CAPABILITY_GATES, isOperationAllowed, getTrustLevelLabel, } from './domain/entities/trust-level.js';
9
+ export { PIIPipelineService, } from './domain/services/pii-pipeline-service.js';
10
+ export { DiscoveryService, } from './domain/services/discovery-service.js';
11
+ export { HandshakeService, } from './domain/services/handshake-service.js';
12
+ export { RoutingService, } from './domain/services/routing-service.js';
13
+ export { AuditService, } from './domain/services/audit-service.js';
14
+ export { TrustEvaluator, } from './application/trust-evaluator.js';
15
+ export { FederationCoordinator, } from './application/federation-coordinator.js';
16
+ export { PolicyEngine, } from './application/policy-engine.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,cAAc,EAA0H,MAAM,sCAAsC,CAAC;AAC9L,OAAO,EACL,mBAAmB,EAGnB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACtB,4BAA4B,GAI7B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,kCAAkC,EAClC,oCAAoC,GAKrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAoD,MAAM,yCAAyC,CAAC;AAC9H,OAAO,EACL,kBAAkB,EAMlB,wBAAwB,GACzB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,UAAU,EACV,2BAA2B,EAC3B,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,kBAAkB,GASnB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,gBAAgB,GAKjB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,gBAAgB,GAMjB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,cAAc,GAKf,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,YAAY,GAUb,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,cAAc,GAKf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,qBAAqB,GAGtB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,YAAY,GAKb,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { MCPToolDefinition } from '@claude-flow/shared/src/plugin-interface.js';
2
+ import type { PluginContext } from '@claude-flow/shared/src/plugin-interface.js';
3
+ import type { FederationCoordinator } from './application/federation-coordinator.js';
4
+ type CoordinatorGetter = () => FederationCoordinator | null;
5
+ type ContextGetter = () => PluginContext | null;
6
+ export declare function createMcpTools(getCoordinator: CoordinatorGetter, getContext: ContextGetter): MCPToolDefinition[];
7
+ export {};
8
+ //# sourceMappingURL=mcp-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAGrF,KAAK,iBAAiB,GAAG,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC5D,KAAK,aAAa,GAAG,MAAM,aAAa,GAAG,IAAI,CAAC;AAMhD,wBAAgB,cAAc,CAC5B,cAAc,EAAE,iBAAiB,EACjC,UAAU,EAAE,aAAa,GACxB,iBAAiB,EAAE,CAoWrB"}