instar 1.3.330 → 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 +133 -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/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/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.331.md +77 -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,qBAAqB;IACpC,sDAAsD;IACtD,IAAI,EAAE,YAAY,GAAG,mBAAmB,CAAC;IACzC,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,YAAY,GAAG,mBAAmB,CAAC;IACzC,EAAE,EAAE,YAAY,GAAG,mBAAmB,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kCAAkC;IACjD,4EAA4E;IAC5E,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,qCAAqC;IACrC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,+EAA+E;IAC/E,aAAa,EAAE,MAAM,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;IAC5D,yEAAyE;IACzE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAChD,sEAAsE;IACtE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,uBAAuB,KAAK,IAAI,CAAC;CACrD;AAID,qBAAa,2BAA4B,YAAW,oBAAoB;IACtE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqC;IAC1D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;gBAElC,OAAO,EAAE,kCAAkC;IAWjD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAwC/E"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { 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":"AnthropicS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E;gBACjE,SAAS;aACV,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;IACH,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,GA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;IAI3C,6EAA6E;IAC7E,yBAAyB,IAAI,MAAM;IAInC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,2BAA2B;IAmFnC,OAAO,CAAC,mBAAmB;IAyd3B,OAAO,CAAC,wBAAwB;IAuJhC,OAAO,CAAC,2BAA2B;IAwEnC,OAAO,CAAC,yBAAyB;IA8IjC,OAAO,CAAC,2BAA2B;IAqKnC,OAAO,CAAC,qBAAqB;IAqS7B,OAAO,CAAC,uBAAuB;IAqJ/B,OAAO,CAAC,oBAAoB;IAgG5B,OAAO,CAAC,qBAAqB;IA8H7B,OAAO,CAAC,2BAA2B;IAoHnC,OAAO,CAAC,iCAAiC;IA6DzC,OAAO,CAAC,4BAA4B;IA0MpC;;;;;;;;;;OAUG;IACH;;;;;;;;;;;OAWG;IAEH,gBAAuB,iCAAiC,EAAE,WAAW,CAAC,MAAM,CAAC,CAgC1E;IAEH;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,8BAA8B;IAiHtC,OAAO,CAAC,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.
|