instar 1.3.329 → 1.3.331
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +138 -17
- package/dist/commands/server.js.map +1 -1
- package/dist/core/AnthropicSubscriptionRouter.d.ts +68 -0
- package/dist/core/AnthropicSubscriptionRouter.d.ts.map +1 -0
- package/dist/core/AnthropicSubscriptionRouter.js +82 -0
- package/dist/core/AnthropicSubscriptionRouter.js.map +1 -0
- package/dist/core/HttpLeaseTransport.d.ts +24 -0
- package/dist/core/HttpLeaseTransport.d.ts.map +1 -1
- package/dist/core/HttpLeaseTransport.js +34 -4
- package/dist/core/HttpLeaseTransport.js.map +1 -1
- package/dist/core/InteractivePoolIntelligenceProvider.d.ts +38 -0
- package/dist/core/InteractivePoolIntelligenceProvider.d.ts.map +1 -0
- package/dist/core/InteractivePoolIntelligenceProvider.js +61 -0
- package/dist/core/InteractivePoolIntelligenceProvider.js.map +1 -0
- package/dist/core/PeerFailureLogGate.d.ts +44 -0
- package/dist/core/PeerFailureLogGate.d.ts.map +1 -0
- package/dist/core/PeerFailureLogGate.js +60 -0
- package/dist/core/PeerFailureLogGate.js.map +1 -0
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +17 -0
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/intelligenceProviderFactory.d.ts +21 -0
- package/dist/core/intelligenceProviderFactory.d.ts.map +1 -1
- package/dist/core/intelligenceProviderFactory.js +24 -1
- package/dist/core/intelligenceProviderFactory.js.map +1 -1
- package/dist/core/types.d.ts +38 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/providers/adapters/anthropic-interactive-pool/config.d.ts +17 -0
- package/dist/providers/adapters/anthropic-interactive-pool/config.d.ts.map +1 -1
- package/dist/providers/adapters/anthropic-interactive-pool/config.js +1 -0
- package/dist/providers/adapters/anthropic-interactive-pool/config.js.map +1 -1
- package/dist/providers/adapters/anthropic-interactive-pool/pool.d.ts +16 -2
- package/dist/providers/adapters/anthropic-interactive-pool/pool.d.ts.map +1 -1
- package/dist/providers/adapters/anthropic-interactive-pool/pool.js +95 -5
- package/dist/providers/adapters/anthropic-interactive-pool/pool.js.map +1 -1
- package/dist/providers/bootRegistration.d.ts +83 -0
- package/dist/providers/bootRegistration.d.ts.map +1 -0
- package/dist/providers/bootRegistration.js +158 -0
- package/dist/providers/bootRegistration.js.map +1 -0
- package/dist/providers/costAwareRouting.d.ts +16 -0
- package/dist/providers/costAwareRouting.d.ts.map +1 -1
- package/dist/providers/costAwareRouting.js +37 -21
- package/dist/providers/costAwareRouting.js.map +1 -1
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +5 -0
- package/dist/scaffold/templates.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +26 -1
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +63 -63
- package/src/scaffold/templates.ts +5 -0
- package/upgrades/{1.3.329.md → 1.3.330.md} +40 -0
- package/upgrades/1.3.331.md +77 -0
- package/upgrades/side-effects/mesh-pull-brakes.md +63 -0
- package/upgrades/side-effects/provider-substrate-live-wiring.md +145 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnthropicSubscriptionRouter — per-call routing between the two ALLOWED
|
|
3
|
+
* Anthropic paths for internal intelligence calls:
|
|
4
|
+
*
|
|
5
|
+
* - `claude -p` one-shots (anthropic-headless / ClaudeCliIntelligenceProvider)
|
|
6
|
+
* — the Agent SDK credit path post-2026-06-15. Prepaid accelerator.
|
|
7
|
+
* - the interactive REPL pool (InteractivePoolIntelligenceProvider)
|
|
8
|
+
* — the Max-subscription floor. Always available (Rule 1).
|
|
9
|
+
*
|
|
10
|
+
* Modes (intelligence.subscriptionPath.mode):
|
|
11
|
+
* - 'auto' — drain the SDK pot while it's known-healthy, fall to the
|
|
12
|
+
* subscription floor when the pot is unknown/at-margin
|
|
13
|
+
* (decideSdkVsSubscription — same thresholds as the
|
|
14
|
+
* registry-level CostAwareRoutingPolicy, single source of
|
|
15
|
+
* truth). A failed primary gets ONE fallback attempt on the
|
|
16
|
+
* other path, with an onDegrade report — Rule 1 resilience.
|
|
17
|
+
* - 'force' — subscription pool ONLY. No SDK fallback: the whole point
|
|
18
|
+
* of force mode (soak tests, June-15 emergency lever) is
|
|
19
|
+
* proving/guaranteeing zero `claude -p` traffic. Failures
|
|
20
|
+
* are LOUD throws.
|
|
21
|
+
*
|
|
22
|
+
* Mode 'off' never constructs this class — buildIntelligenceProvider
|
|
23
|
+
* returns the plain ClaudeCliIntelligenceProvider, byte-for-byte today's
|
|
24
|
+
* behavior.
|
|
25
|
+
*
|
|
26
|
+
* This router sits INSIDE the circuit-breaker wrap (breaker stays
|
|
27
|
+
* outermost), and BELOW the per-component IntelligenceRouter (framework
|
|
28
|
+
* routing decides claude-vs-codex first; this decides WHICH Claude path).
|
|
29
|
+
*/
|
|
30
|
+
import type { IntelligenceProvider, IntelligenceOptions } from './types.js';
|
|
31
|
+
import type { AgentSdkCreditSnapshot } from '../providers/primitives/observability/usageMeterProvider.js';
|
|
32
|
+
export type SubscriptionPathMode = 'auto' | 'force';
|
|
33
|
+
export interface SubscriptionRouteInfo {
|
|
34
|
+
/** Which path served (or was chosen for) the call. */
|
|
35
|
+
path: 'sdk-credit' | 'subscription-pool';
|
|
36
|
+
/** Decision reason (threshold text, 'forced', or fallback note). */
|
|
37
|
+
reason: string;
|
|
38
|
+
/** Attribution component when the caller supplied one. */
|
|
39
|
+
component?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface SubscriptionDegradeInfo {
|
|
42
|
+
from: 'sdk-credit' | 'subscription-pool';
|
|
43
|
+
to: 'sdk-credit' | 'subscription-pool';
|
|
44
|
+
reason: string;
|
|
45
|
+
component?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface AnthropicSubscriptionRouterOptions {
|
|
48
|
+
/** The `claude -p` provider (UNWRAPPED — the breaker wraps this router). */
|
|
49
|
+
headless: IntelligenceProvider;
|
|
50
|
+
/** The interactive-pool provider. */
|
|
51
|
+
pool: IntelligenceProvider;
|
|
52
|
+
mode: SubscriptionPathMode;
|
|
53
|
+
/** Real credit reader (bootRegistration.buildReadSdkCredit) — never throws. */
|
|
54
|
+
readSdkCredit: () => Promise<AgentSdkCreditSnapshot | null>;
|
|
55
|
+
/** Mirrors CostAwareRoutingPolicy's default (10% of the monthly pot). */
|
|
56
|
+
safetyMarginFraction?: number;
|
|
57
|
+
/** Observability tap — every routing decision (T-05: no invisible routing). */
|
|
58
|
+
onRoute?: (info: SubscriptionRouteInfo) => void;
|
|
59
|
+
/** Observability tap — auto-mode fallback after a primary failure. */
|
|
60
|
+
onDegrade?: (info: SubscriptionDegradeInfo) => void;
|
|
61
|
+
}
|
|
62
|
+
export declare class AnthropicSubscriptionRouter implements IntelligenceProvider {
|
|
63
|
+
private readonly opts;
|
|
64
|
+
private readonly safetyMarginFraction;
|
|
65
|
+
constructor(options: AnthropicSubscriptionRouterOptions);
|
|
66
|
+
evaluate(prompt: string, options?: IntelligenceOptions): Promise<string>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=AnthropicSubscriptionRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnthropicSubscriptionRouter.d.ts","sourceRoot":"","sources":["../../src/core/AnthropicSubscriptionRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6DAA6D,CAAC;AAE1G,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpD,MAAM,WAAW,q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|
5
|
+
* - `claude -p` one-shots (anthropic-headless / ClaudeCliIntelligenceProvider)
|
|
6
|
+
* — the Agent SDK credit path post-2026-06-15. Prepaid accelerator.
|
|
7
|
+
* - the interactive REPL pool (InteractivePoolIntelligenceProvider)
|
|
8
|
+
* — the Max-subscription floor. Always available (Rule 1).
|
|
9
|
+
*
|
|
10
|
+
* Modes (intelligence.subscriptionPath.mode):
|
|
11
|
+
* - 'auto' — drain the SDK pot while it's known-healthy, fall to the
|
|
12
|
+
* subscription floor when the pot is unknown/at-margin
|
|
13
|
+
* (decideSdkVsSubscription — same thresholds as the
|
|
14
|
+
* registry-level CostAwareRoutingPolicy, single source of
|
|
15
|
+
* truth). A failed primary gets ONE fallback attempt on the
|
|
16
|
+
* other path, with an onDegrade report — Rule 1 resilience.
|
|
17
|
+
* - 'force' — subscription pool ONLY. No SDK fallback: the whole point
|
|
18
|
+
* of force mode (soak tests, June-15 emergency lever) is
|
|
19
|
+
* proving/guaranteeing zero `claude -p` traffic. Failures
|
|
20
|
+
* are LOUD throws.
|
|
21
|
+
*
|
|
22
|
+
* Mode 'off' never constructs this class — buildIntelligenceProvider
|
|
23
|
+
* returns the plain ClaudeCliIntelligenceProvider, byte-for-byte today's
|
|
24
|
+
* behavior.
|
|
25
|
+
*
|
|
26
|
+
* This router sits INSIDE the circuit-breaker wrap (breaker stays
|
|
27
|
+
* outermost), and BELOW the per-component IntelligenceRouter (framework
|
|
28
|
+
* routing decides claude-vs-codex first; this decides WHICH Claude path).
|
|
29
|
+
*/
|
|
30
|
+
import { decideSdkVsSubscription } from '../providers/costAwareRouting.js';
|
|
31
|
+
const DEFAULT_SAFETY_MARGIN_FRACTION = 0.1;
|
|
32
|
+
export class AnthropicSubscriptionRouter {
|
|
33
|
+
opts;
|
|
34
|
+
safetyMarginFraction;
|
|
35
|
+
constructor(options) {
|
|
36
|
+
this.opts = options;
|
|
37
|
+
this.safetyMarginFraction =
|
|
38
|
+
options.safetyMarginFraction ?? DEFAULT_SAFETY_MARGIN_FRACTION;
|
|
39
|
+
if (this.safetyMarginFraction < 0 || this.safetyMarginFraction > 1) {
|
|
40
|
+
throw new Error(`AnthropicSubscriptionRouter: safetyMarginFraction must be in [0,1], got ${this.safetyMarginFraction}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async evaluate(prompt, options) {
|
|
44
|
+
const component = options?.attribution?.component;
|
|
45
|
+
if (this.opts.mode === 'force') {
|
|
46
|
+
this.opts.onRoute?.({ path: 'subscription-pool', reason: 'forced-subscription-mode', component });
|
|
47
|
+
// No fallback by design — force mode guarantees zero `claude -p`
|
|
48
|
+
// traffic; a pool failure must surface, not silently re-route.
|
|
49
|
+
return this.opts.pool.evaluate(prompt, options);
|
|
50
|
+
}
|
|
51
|
+
// auto — decide on live credit state (cached reader; never throws).
|
|
52
|
+
const snapshot = await this.opts.readSdkCredit();
|
|
53
|
+
const decision = decideSdkVsSubscription(snapshot, this.safetyMarginFraction);
|
|
54
|
+
const primaryIsSdk = decision.path === 'sdk-credit';
|
|
55
|
+
const primary = primaryIsSdk ? this.opts.headless : this.opts.pool;
|
|
56
|
+
const fallback = primaryIsSdk ? this.opts.pool : this.opts.headless;
|
|
57
|
+
const primaryLabel = primaryIsSdk
|
|
58
|
+
? 'sdk-credit'
|
|
59
|
+
: 'subscription-pool';
|
|
60
|
+
const fallbackLabel = primaryIsSdk
|
|
61
|
+
? 'subscription-pool'
|
|
62
|
+
: 'sdk-credit';
|
|
63
|
+
this.opts.onRoute?.({ path: primaryLabel, reason: decision.reason, component });
|
|
64
|
+
try {
|
|
65
|
+
return await primary.evaluate(prompt, options);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
// @silent-fallback-ok — auto-mode cross-path fallback is the Rule-1
|
|
69
|
+
// contract; the failure is reported via onDegrade (DegradationReporter
|
|
70
|
+
// at the server wiring), and a fallback failure re-throws loudly.
|
|
71
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
72
|
+
this.opts.onDegrade?.({ from: primaryLabel, to: fallbackLabel, reason, component });
|
|
73
|
+
this.opts.onRoute?.({
|
|
74
|
+
path: fallbackLabel,
|
|
75
|
+
reason: `fallback-after-primary-failure: ${reason.slice(0, 200)}`,
|
|
76
|
+
component,
|
|
77
|
+
});
|
|
78
|
+
return fallback.evaluate(prompt, options);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=AnthropicSubscriptionRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnthropicSubscriptionRouter.js","sourceRoot":"","sources":["../../src/core/AnthropicSubscriptionRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAqC3E,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAE3C,MAAM,OAAO,2BAA2B;IACrB,IAAI,CAAqC;IACzC,oBAAoB,CAAS;IAE9C,YAAY,OAA2C;QACrD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,oBAAoB;YACvB,OAAO,CAAC,oBAAoB,IAAI,8BAA8B,CAAC;QACjE,IAAI,IAAI,CAAC,oBAAoB,GAAG,CAAC,IAAI,IAAI,CAAC,oBAAoB,GAAG,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,KAAK,CACb,2EAA2E,IAAI,CAAC,oBAAoB,EAAE,CACvG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc,EAAE,OAA6B;QAC1D,MAAM,SAAS,GAAG,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;QAElD,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,0B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AAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAChE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;YACpF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,IAAI,EAAE,aAAa;gBACnB,MAAM,EAAE,mCAAmC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;gBACjE,SAAS;aACV,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -34,6 +34,24 @@ export interface HttpLeaseTransportDeps {
|
|
|
34
34
|
fetchImpl?: typeof fetch;
|
|
35
35
|
/** How recent a successful broadcast counts as "reachable". Default = leaseTtlMs. */
|
|
36
36
|
reachabilityWindowMs?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Per-request abort timeout (P19 brake: a hung socket must not wedge the
|
|
39
|
+
* caller's fixed-cadence loop — the pull loop's `leasePulling` guard would
|
|
40
|
+
* otherwise stay held forever). Default 30s: the timeout must sit ABOVE the
|
|
41
|
+
* fleet's documented 5–40s receiver-side event-loop-stall envelope's bulk —
|
|
42
|
+
* a slow-but-alive peer must NOT be converted into "no medium", because a
|
|
43
|
+
* failed broadcast feeds the renewal path's self-suspend (second-pass
|
|
44
|
+
* reviewer finding). A truly hung socket never returns, so 30s bounds the
|
|
45
|
+
* wedge exactly as well as a smaller value would. server.ts derives this
|
|
46
|
+
* from leaseTtlMs (min(ttl/2, 30s)).
|
|
47
|
+
*/
|
|
48
|
+
requestTimeoutMs?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Coarse-reminder interval for the per-peer failure log gate (P19 brake:
|
|
51
|
+
* per-attempt logging is amplification — a down peer at a 5s cadence wrote
|
|
52
|
+
* ~17k lines/day). Default 360 consecutive failures (~30min at 5s).
|
|
53
|
+
*/
|
|
54
|
+
failureLogEveryN?: number;
|
|
37
55
|
now?: () => number;
|
|
38
56
|
logger?: (msg: string) => void;
|
|
39
57
|
}
|
|
@@ -44,7 +62,13 @@ export declare class HttpLeaseTransport implements LeaseTransport {
|
|
|
44
62
|
private lastBroadcastOkAt;
|
|
45
63
|
private lastPullOkAt;
|
|
46
64
|
private readonly windowMs;
|
|
65
|
+
private readonly requestTimeoutMs;
|
|
66
|
+
/** State-change failure logging (first/Nth/recovery) — never per-attempt. */
|
|
67
|
+
private readonly logGate;
|
|
47
68
|
constructor(deps: HttpLeaseTransportDeps);
|
|
69
|
+
/** Gated failure/recovery logging — emits only on state changes + coarse reminders. */
|
|
70
|
+
private logFailure;
|
|
71
|
+
private logSuccess;
|
|
48
72
|
private now;
|
|
49
73
|
private log;
|
|
50
74
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpLeaseTransport.d.ts","sourceRoot":"","sources":["../../src/core/HttpLeaseTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"HttpLeaseTransport.d.ts","sourceRoot":"","sources":["../../src/core/HttpLeaseTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,KAAK,EAAE,MAAM,SAAS,EAAE,CAAC;IACzB,kFAAkF;IACl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E,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAiC5D;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAKpC"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* logic is unit-testable without a network.
|
|
18
18
|
*/
|
|
19
19
|
import { signRequest } from '../server/machineAuth.js';
|
|
20
|
+
import { PeerFailureLogGate } from './PeerFailureLogGate.js';
|
|
20
21
|
export class HttpLeaseTransport {
|
|
21
22
|
d;
|
|
22
23
|
lastObserved = null;
|
|
@@ -24,9 +25,25 @@ export class HttpLeaseTransport {
|
|
|
24
25
|
lastBroadcastOkAt = 0;
|
|
25
26
|
lastPullOkAt = 0;
|
|
26
27
|
windowMs;
|
|
28
|
+
requestTimeoutMs;
|
|
29
|
+
/** State-change failure logging (first/Nth/recovery) — never per-attempt. */
|
|
30
|
+
logGate;
|
|
27
31
|
constructor(deps) {
|
|
28
32
|
this.d = deps;
|
|
29
33
|
this.windowMs = deps.reachabilityWindowMs ?? 60_000;
|
|
34
|
+
this.requestTimeoutMs = deps.requestTimeoutMs ?? 30_000;
|
|
35
|
+
this.logGate = new PeerFailureLogGate(deps.failureLogEveryN ?? 360);
|
|
36
|
+
}
|
|
37
|
+
/** Gated failure/recovery logging — emits only on state changes + coarse reminders. */
|
|
38
|
+
logFailure(key, detail) {
|
|
39
|
+
const line = this.logGate.failed(key, detail);
|
|
40
|
+
if (line)
|
|
41
|
+
this.log(line);
|
|
42
|
+
}
|
|
43
|
+
logSuccess(key) {
|
|
44
|
+
const line = this.logGate.succeeded(key);
|
|
45
|
+
if (line)
|
|
46
|
+
this.log(line);
|
|
30
47
|
}
|
|
31
48
|
now() {
|
|
32
49
|
return (this.d.now ?? Date.now)();
|
|
@@ -56,12 +73,19 @@ export class HttpLeaseTransport {
|
|
|
56
73
|
method: 'POST',
|
|
57
74
|
headers: { 'Content-Type': 'application/json', ...headers },
|
|
58
75
|
body: JSON.stringify(body),
|
|
76
|
+
// P19 brake: a hung socket aborts instead of holding the caller open.
|
|
77
|
+
signal: AbortSignal.timeout(this.requestTimeoutMs),
|
|
59
78
|
});
|
|
60
|
-
if (res && res.ok)
|
|
79
|
+
if (res && res.ok) {
|
|
61
80
|
anyOk = true;
|
|
81
|
+
this.logSuccess(`broadcast to ${peer.machineId}`);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this.logFailure(`broadcast to ${peer.machineId}`, `status ${res?.status}`);
|
|
85
|
+
}
|
|
62
86
|
}
|
|
63
87
|
catch (err) {
|
|
64
|
-
this.
|
|
88
|
+
this.logFailure(`broadcast to ${peer.machineId}`, err instanceof Error ? err.message : String(err));
|
|
65
89
|
}
|
|
66
90
|
}));
|
|
67
91
|
if (anyOk)
|
|
@@ -121,12 +145,18 @@ export class HttpLeaseTransport {
|
|
|
121
145
|
method: 'POST',
|
|
122
146
|
headers: { 'Content-Type': 'application/json', ...headers },
|
|
123
147
|
body: JSON.stringify(body),
|
|
148
|
+
// P19 brake: the pull loop's `leasePulling` guard means a hung socket
|
|
149
|
+
// would wedge ALL future pulls — abort instead.
|
|
150
|
+
signal: AbortSignal.timeout(this.requestTimeoutMs),
|
|
124
151
|
});
|
|
125
|
-
if (!res || !res.ok)
|
|
152
|
+
if (!res || !res.ok) {
|
|
153
|
+
this.logFailure(`pull from ${peer.machineId}`, `status ${res?.status}`);
|
|
126
154
|
return null;
|
|
155
|
+
}
|
|
127
156
|
const data = (await res.json().catch(() => null));
|
|
128
157
|
// A successful response (even one carrying no lease) proves the medium is live.
|
|
129
158
|
this.lastPullOkAt = this.now();
|
|
159
|
+
this.logSuccess(`pull from ${peer.machineId}`);
|
|
130
160
|
const lease = data?.lease ?? null;
|
|
131
161
|
if (lease && typeof lease.epoch === 'number') {
|
|
132
162
|
this.recordObserved(lease);
|
|
@@ -135,7 +165,7 @@ export class HttpLeaseTransport {
|
|
|
135
165
|
return null;
|
|
136
166
|
}
|
|
137
167
|
catch (err) {
|
|
138
|
-
this.
|
|
168
|
+
this.logFailure(`pull from ${peer.machineId}`, err instanceof Error ? err.message : String(err));
|
|
139
169
|
return null;
|
|
140
170
|
}
|
|
141
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpLeaseTransport.js","sourceRoot":"","sources":["../../src/core/HttpLeaseTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"HttpLeaseTransport.js","sourceRoot":"","sources":["../../src/core/HttpLeaseTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AA2C7D,MAAM,OAAO,kBAAkB;IACZ,CAAC,CAAyB;IACnC,YAAY,GAAuB,IAAI,CAAC;IACxC,iBAAiB,GAA2B,EAAE,CAAC;IAC/C,iBAAiB,GAAG,CAAC,CAAC;IACtB,YAAY,GAAG,CAAC,CAAC;IACR,QAAQ,CAAS;IACjB,gBAAgB,CAAS;IAC1C,6EAA6E;IAC5D,OAAO,CAAqB;IAE7C,YAAY,IAA4B;QACtC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,oBAAoB,IAAI,MAAM,CAAC;QACpD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC;QACxD,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,IAAI,GAAG,CAAC,CAAC;IACtE,CAAC;IAED,uFAAuF;IAC/E,UAAU,CAAC,GAAW,EAAE,MAAc;QAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAA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AAU,CAAC,aAAa,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YACjG,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC/B,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InteractivePoolIntelligenceProvider — IntelligenceProvider over the
|
|
3
|
+
* anthropic-interactive-pool adapter (the SUBSCRIPTION path).
|
|
4
|
+
*
|
|
5
|
+
* This is the Rule-1 floor for internal LLM judgment calls
|
|
6
|
+
* (specs/provider-portability/04-anthropic-path-constraints.md): instead of
|
|
7
|
+
* a `claude -p` one-shot (which bills the Agent SDK credit pot after
|
|
8
|
+
* 2026-06-15), the call is typed into a long-lived interactive `claude`
|
|
9
|
+
* REPL drawn from the Max subscription — the path that keeps working when
|
|
10
|
+
* the credit pot is empty.
|
|
11
|
+
*
|
|
12
|
+
* Honest limitations (inherent to the pool transport, documented in
|
|
13
|
+
* specs/provider-portability/prototype/interactive-pool/findings.md):
|
|
14
|
+
* - No per-call model selection: the pool runs ONE model, fixed at
|
|
15
|
+
* session spawn (`InteractivePoolConfig.model`). The per-call
|
|
16
|
+
* `options.model` tier is accepted but cannot be honored — per Rule 1,
|
|
17
|
+
* the option is advisory, not the path.
|
|
18
|
+
* - No per-call token usage: the REPL reports cumulative usage only, so
|
|
19
|
+
* `options.onUsage` is NEVER invoked. /metrics/features still counts
|
|
20
|
+
* calls + latency for attributed callers; token columns read 0 for
|
|
21
|
+
* pool-served calls.
|
|
22
|
+
* - Latency: ~8s/prompt steady-state (4s of that is the stability
|
|
23
|
+
* window) vs ~5s for `claude -p`.
|
|
24
|
+
*
|
|
25
|
+
* Failure honesty: pool errors (spawn failure, allocate timeout, prompt
|
|
26
|
+
* timeout) propagate as loud throws with the pool's reason — never a
|
|
27
|
+
* silent empty answer. Callers (circuit breaker, AnthropicSubscriptionRouter)
|
|
28
|
+
* decide fallback.
|
|
29
|
+
*/
|
|
30
|
+
import type { IntelligenceProvider, IntelligenceOptions } from './types.js';
|
|
31
|
+
import type { ProviderAdapter } from '../providers/registry.js';
|
|
32
|
+
export declare class InteractivePoolIntelligenceProvider implements IntelligenceProvider {
|
|
33
|
+
private adapter;
|
|
34
|
+
private oneShot;
|
|
35
|
+
constructor(poolAdapter: ProviderAdapter);
|
|
36
|
+
evaluate(prompt: string, options?: IntelligenceOptions): Promise<string>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=InteractivePoolIntelligenceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InteractivePoolIntelligenceProvider.d.ts","sourceRoot":"","sources":["../../src/core/InteractivePoolIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAG5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAKhE,qBAAa,mCAAoC,YAAW,oBAAoB;IAC9E,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,OAAO,CAAkC;gBAErC,WAAW,EAAE,eAAe;IAQlC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAsB/E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InteractivePoolIntelligenceProvider — IntelligenceProvider over the
|
|
3
|
+
* anthropic-interactive-pool adapter (the SUBSCRIPTION path).
|
|
4
|
+
*
|
|
5
|
+
* This is the Rule-1 floor for internal LLM judgment calls
|
|
6
|
+
* (specs/provider-portability/04-anthropic-path-constraints.md): instead of
|
|
7
|
+
* a `claude -p` one-shot (which bills the Agent SDK credit pot after
|
|
8
|
+
* 2026-06-15), the call is typed into a long-lived interactive `claude`
|
|
9
|
+
* REPL drawn from the Max subscription — the path that keeps working when
|
|
10
|
+
* the credit pot is empty.
|
|
11
|
+
*
|
|
12
|
+
* Honest limitations (inherent to the pool transport, documented in
|
|
13
|
+
* specs/provider-portability/prototype/interactive-pool/findings.md):
|
|
14
|
+
* - No per-call model selection: the pool runs ONE model, fixed at
|
|
15
|
+
* session spawn (`InteractivePoolConfig.model`). The per-call
|
|
16
|
+
* `options.model` tier is accepted but cannot be honored — per Rule 1,
|
|
17
|
+
* the option is advisory, not the path.
|
|
18
|
+
* - No per-call token usage: the REPL reports cumulative usage only, so
|
|
19
|
+
* `options.onUsage` is NEVER invoked. /metrics/features still counts
|
|
20
|
+
* calls + latency for attributed callers; token columns read 0 for
|
|
21
|
+
* pool-served calls.
|
|
22
|
+
* - Latency: ~8s/prompt steady-state (4s of that is the stability
|
|
23
|
+
* window) vs ~5s for `claude -p`.
|
|
24
|
+
*
|
|
25
|
+
* Failure honesty: pool errors (spawn failure, allocate timeout, prompt
|
|
26
|
+
* timeout) propagate as loud throws with the pool's reason — never a
|
|
27
|
+
* silent empty answer. Callers (circuit breaker, AnthropicSubscriptionRouter)
|
|
28
|
+
* decide fallback.
|
|
29
|
+
*/
|
|
30
|
+
import { assertClaudeAllowed } from './claudeForbiddenGuard.js';
|
|
31
|
+
import { CapabilityFlag } from '../providers/capabilities.js';
|
|
32
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
33
|
+
export class InteractivePoolIntelligenceProvider {
|
|
34
|
+
adapter;
|
|
35
|
+
oneShot = null;
|
|
36
|
+
constructor(poolAdapter) {
|
|
37
|
+
// Same codex-only enforcement as ClaudeCliIntelligenceProvider: on a
|
|
38
|
+
// codex-only agent, constructing ANY Claude-backed intelligence path
|
|
39
|
+
// is forbidden, loudly.
|
|
40
|
+
assertClaudeAllowed('InteractivePoolIntelligenceProvider');
|
|
41
|
+
this.adapter = poolAdapter;
|
|
42
|
+
}
|
|
43
|
+
async evaluate(prompt, options) {
|
|
44
|
+
if (!this.oneShot) {
|
|
45
|
+
this.oneShot = this.adapter.primitive(CapabilityFlag.OneShotCompletion);
|
|
46
|
+
}
|
|
47
|
+
const result = await this.oneShot.evaluate(prompt, {
|
|
48
|
+
// Advisory on this path — the pool runs one model fixed at spawn.
|
|
49
|
+
model: options?.model ?? 'fast',
|
|
50
|
+
maxTokens: options?.maxTokens,
|
|
51
|
+
temperature: options?.temperature,
|
|
52
|
+
timeoutMs: options?.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
53
|
+
});
|
|
54
|
+
// The pool transport cannot report per-call usage (usage is null by
|
|
55
|
+
// contract) — options.onUsage is deliberately NOT invoked. Invoking it
|
|
56
|
+
// with zeros would corrupt the per-feature token ledger with
|
|
57
|
+
// fake-precision data; absent is honest.
|
|
58
|
+
return result.text;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=InteractivePoolIntelligenceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InteractivePoolIntelligenceProvider.js","sourceRoot":"","sources":["../../src/core/InteractivePoolIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI9D,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,OAAO,mCAAmC;IACtC,OAAO,CAAkB;IACzB,OAAO,GAA6B,IAAI,CAAC;IAEjD,YAAY,WAA4B;QACtC,qEAAqE;QACrE,qEAAqE;QACrE,wBAAwB;QACxB,mBAAmB,CAAC,qCAAqC,CAAC,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc,EAAE,OAA6B;QAC1D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CACnC,cAAc,CAAC,iBAAiB,CACZ,CAAC;QACzB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE;YACjD,kEAAkE;YAClE,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,MAAM;YAC/B,SAAS,EAAE,OAAO,EAAE,SAAS;YAC7B,WAAW,EAAE,OAAO,EAAE,WAAW;YACjC,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,kBAAkB;SACpD,CAAC,CAAC;QAEH,oEAAoE;QACpE,uEAAuE;QACvE,6DAA6D;QAC7D,yCAAyC;QAEzC,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PeerFailureLogGate — bounded per-peer failure logging for fixed-cadence mesh
|
|
3
|
+
* loops ("No Unbounded Loops" / P19: per-attempt log lines are amplification —
|
|
4
|
+
* cap them).
|
|
5
|
+
*
|
|
6
|
+
* The lease pull/broadcast loops run at a deliberate fixed cadence (~5s,
|
|
7
|
+
* anti-blinding — an Eternal-Sentinel-adjacent design where backing off the
|
|
8
|
+
* ATTEMPTS is wrong). But logging one line per failed attempt turned a
|
|
9
|
+
* down peer into ~17,000 log lines/day (the 2026-06-05 loop-safety audit,
|
|
10
|
+
* the same flood signature as the reaper incident). This gate converts
|
|
11
|
+
* per-attempt logging into STATE-CHANGE logging:
|
|
12
|
+
*
|
|
13
|
+
* - first failure after success (or ever) → log ("became unreachable")
|
|
14
|
+
* - every Nth consecutive failure → one coarse reminder with the count
|
|
15
|
+
* - first success after failures → log ("recovered after N failures")
|
|
16
|
+
* - steady state (all-success / mid-window) → silence
|
|
17
|
+
*
|
|
18
|
+
* Count-based (no clock) so the bound is exact: F consecutive failures produce
|
|
19
|
+
* ⌈F/N⌉ + 1 lines instead of F. Pure, per-key (peer × operation), bounded state.
|
|
20
|
+
*/
|
|
21
|
+
export declare class PeerFailureLogGate {
|
|
22
|
+
private readonly everyN;
|
|
23
|
+
/**
|
|
24
|
+
* Per-key consecutive failure count (0 = healthy). Recovered keys are
|
|
25
|
+
* deleted, so retained state is bounded by currently-failing peer×op pairs.
|
|
26
|
+
* (A peer removed from the registry mid-streak leaves one stale entry —
|
|
27
|
+
* bounded by historical peer count; second-pass reviewer assessed as
|
|
28
|
+
* acceptable.)
|
|
29
|
+
*/
|
|
30
|
+
private failures;
|
|
31
|
+
/** @param everyN coarse-reminder interval in consecutive failures. Default 360 (~30min at a 5s cadence). */
|
|
32
|
+
constructor(everyN?: number);
|
|
33
|
+
/**
|
|
34
|
+
* Record a failed attempt for `key`. Returns the line to log, or null when
|
|
35
|
+
* this attempt should be silent (inside the suppression window).
|
|
36
|
+
*/
|
|
37
|
+
failed(key: string, detail: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Record a successful attempt. Returns the recovery line when this success
|
|
40
|
+
* ends a failure streak, null in steady healthy state.
|
|
41
|
+
*/
|
|
42
|
+
succeeded(key: string): string | null;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=PeerFailureLogGate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeerFailureLogGate.d.ts","sourceRoot":"","sources":["../../src/core/PeerFailureLogGate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAA6B;IAE7C,4GAA4G;gBAChG,MAAM,GAAE,MAAY;IAIhC;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAQlD;;;OAGG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAMtC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PeerFailureLogGate — bounded per-peer failure logging for fixed-cadence mesh
|
|
3
|
+
* loops ("No Unbounded Loops" / P19: per-attempt log lines are amplification —
|
|
4
|
+
* cap them).
|
|
5
|
+
*
|
|
6
|
+
* The lease pull/broadcast loops run at a deliberate fixed cadence (~5s,
|
|
7
|
+
* anti-blinding — an Eternal-Sentinel-adjacent design where backing off the
|
|
8
|
+
* ATTEMPTS is wrong). But logging one line per failed attempt turned a
|
|
9
|
+
* down peer into ~17,000 log lines/day (the 2026-06-05 loop-safety audit,
|
|
10
|
+
* the same flood signature as the reaper incident). This gate converts
|
|
11
|
+
* per-attempt logging into STATE-CHANGE logging:
|
|
12
|
+
*
|
|
13
|
+
* - first failure after success (or ever) → log ("became unreachable")
|
|
14
|
+
* - every Nth consecutive failure → one coarse reminder with the count
|
|
15
|
+
* - first success after failures → log ("recovered after N failures")
|
|
16
|
+
* - steady state (all-success / mid-window) → silence
|
|
17
|
+
*
|
|
18
|
+
* Count-based (no clock) so the bound is exact: F consecutive failures produce
|
|
19
|
+
* ⌈F/N⌉ + 1 lines instead of F. Pure, per-key (peer × operation), bounded state.
|
|
20
|
+
*/
|
|
21
|
+
export class PeerFailureLogGate {
|
|
22
|
+
everyN;
|
|
23
|
+
/**
|
|
24
|
+
* Per-key consecutive failure count (0 = healthy). Recovered keys are
|
|
25
|
+
* deleted, so retained state is bounded by currently-failing peer×op pairs.
|
|
26
|
+
* (A peer removed from the registry mid-streak leaves one stale entry —
|
|
27
|
+
* bounded by historical peer count; second-pass reviewer assessed as
|
|
28
|
+
* acceptable.)
|
|
29
|
+
*/
|
|
30
|
+
failures = new Map();
|
|
31
|
+
/** @param everyN coarse-reminder interval in consecutive failures. Default 360 (~30min at a 5s cadence). */
|
|
32
|
+
constructor(everyN = 360) {
|
|
33
|
+
this.everyN = Math.max(1, everyN);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Record a failed attempt for `key`. Returns the line to log, or null when
|
|
37
|
+
* this attempt should be silent (inside the suppression window).
|
|
38
|
+
*/
|
|
39
|
+
failed(key, detail) {
|
|
40
|
+
const n = (this.failures.get(key) ?? 0) + 1;
|
|
41
|
+
this.failures.set(key, n);
|
|
42
|
+
if (n === 1)
|
|
43
|
+
return `${key} became unreachable: ${detail}`;
|
|
44
|
+
if (n % this.everyN === 0)
|
|
45
|
+
return `${key} still unreachable (${n} consecutive failures): ${detail}`;
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Record a successful attempt. Returns the recovery line when this success
|
|
50
|
+
* ends a failure streak, null in steady healthy state.
|
|
51
|
+
*/
|
|
52
|
+
succeeded(key) {
|
|
53
|
+
const n = this.failures.get(key) ?? 0;
|
|
54
|
+
if (n === 0)
|
|
55
|
+
return null;
|
|
56
|
+
this.failures.delete(key);
|
|
57
|
+
return `${key} recovered after ${n} consecutive failures`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=PeerFailureLogGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeerFailureLogGate.js","sourceRoot":"","sources":["../../src/core/PeerFailureLogGate.ts"],"names":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uBAAuB;IAwC/B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,sBAAsB;IAwC9B,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,8BAA8B;IA6HtC,OAAO,CAAC,+BAA+B;IAuKvC,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,qBAAqB;IAqO7B,OAAO,CAAC,qBAAqB;IAwI7B,OAAO,CAAC,qBAAqB;IAyN7B,OAAO,CAAC,6BAA6B;IAkLrC,OAAO,CAAC,0BAA0B;IAgClC,OAAO,CAAC,gBAAgB;IAmJxB,OAAO,CAAC,6BAA6B;CAoCtC"}
|
|
@@ -2890,6 +2890,23 @@ Check where codex account usage sits without the interactive TUI. The codex CLI
|
|
|
2890
2890
|
patched = true;
|
|
2891
2891
|
result.upgraded.push('CLAUDE.md: added Codex Usage (/codex/usage) awareness (codex-usage-visibility)');
|
|
2892
2892
|
}
|
|
2893
|
+
// subscription-path-routing (Agent Awareness + Migration Parity): existing
|
|
2894
|
+
// agents must learn the June-15 lever exists — the registry introspection
|
|
2895
|
+
// route and the intelligence.subscriptionPath mode switch. Content-sniff
|
|
2896
|
+
// on the route marker.
|
|
2897
|
+
if (!content.includes('/providers/registry')) {
|
|
2898
|
+
const subscriptionPathSection = `
|
|
2899
|
+
### Anthropic Subscription-Path Routing (June-15 readiness)
|
|
2900
|
+
|
|
2901
|
+
Your internal background LLM calls (sentinels, gates, extractors) normally run as \`claude -p\` one-shots, which bill the Agent SDK credit pot after 2026-06-15. The subscription-path lever routes them through a pool of long-lived interactive Claude sessions instead — the path that keeps working when the pot is empty.
|
|
2902
|
+
- What's actually wired in: \`curl -H "Authorization: Bearer $AUTH" http://localhost:${port}/providers/registry\` → registered provider adapters + capability flags. Both \`anthropic-headless\` and \`anthropic-interactive-pool\` listed = the escape hatch is installed.
|
|
2903
|
+
- The lever: \`.instar/config.json\` → \`intelligence.subscriptionPath.mode\`: \`off\` (default — today's behavior), \`auto\` (drain the SDK pot while healthy, slide to the interactive pool when it's unknown/near-empty), \`force\` (interactive pool ONLY — zero \`claude -p\` traffic). Restart sessions/server to apply.
|
|
2904
|
+
- **When to use** (PROACTIVE): "are we ready for the June 15 change?" / "what happens when the SDK credits run out?" → read \`GET /providers/registry\` + report the configured mode. SDK-pot exhaustion → offer the \`force\`/\`auto\` flip instead of letting background checks fail. (Spec: \`docs/specs/provider-substrate-live-wiring.md\`.)
|
|
2905
|
+
`;
|
|
2906
|
+
content += '\n' + subscriptionPathSection;
|
|
2907
|
+
patched = true;
|
|
2908
|
+
result.upgraded.push('CLAUDE.md: added Anthropic Subscription-Path Routing (/providers/registry) awareness (provider-substrate-live-wiring)');
|
|
2909
|
+
}
|
|
2893
2910
|
// session-clock (Agent Awareness + Migration Parity): existing agents must
|
|
2894
2911
|
// learn they can ask how long they've been running / how much is left,
|
|
2895
2912
|
// instead of guessing. Content-sniff on the route marker.
|