@jini-ai/agent-runtime 0.7.3-next.2 → 0.7.4

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 (177) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +38 -0
  3. package/dist/agent-protocol/acp/models.d.ts +0 -10
  4. package/dist/agent-protocol/acp/models.js +0 -10
  5. package/dist/agent-protocol/acp/rpc.d.ts +5 -1
  6. package/dist/agent-protocol/acp/rpc.js +2 -1
  7. package/dist/agent-protocol/acp/session-permission.js +4 -3
  8. package/dist/agent-protocol/acp/session-results.d.ts +4 -4
  9. package/dist/agent-protocol/acp/session-results.js +30 -21
  10. package/dist/agent-protocol/acp/session-run.js +0 -8
  11. package/dist/agent-protocol/acp/session-types.d.ts +0 -1
  12. package/dist/agent-protocol/acp/session-usage.d.ts +12 -0
  13. package/dist/agent-protocol/acp/session-usage.js +29 -0
  14. package/dist/agent-protocol/acp/session.d.ts +1 -1
  15. package/dist/agent-protocol/acp/session.js +10 -4
  16. package/dist/agent-protocol/acp/text-suppression.js +75 -71
  17. package/dist/agent-protocol/pi-rpc/events.d.ts +21 -4
  18. package/dist/agent-protocol/pi-rpc/events.js +9 -9
  19. package/dist/agent-protocol/pi-rpc/internal.d.ts +6 -2
  20. package/dist/agent-protocol/pi-rpc/internal.js +6 -4
  21. package/dist/agent-protocol/pi-rpc/session.js +4 -3
  22. package/dist/anthropic-live-models.js +0 -0
  23. package/dist/claude-code-models.d.ts +3 -1
  24. package/dist/claude-code-models.js +4 -4
  25. package/dist/claude-stream-frames.js +1 -1
  26. package/dist/cli-probe-cache.d.ts +33 -0
  27. package/dist/cli-probe-cache.js +59 -0
  28. package/dist/custom-instructions.d.ts +107 -0
  29. package/dist/custom-instructions.js +80 -0
  30. package/dist/defs/{aider.d.ts → aider/index.d.ts} +2 -1
  31. package/dist/defs/{aider.js → aider/index.js} +6 -3
  32. package/dist/defs/amr/executable-env.d.ts +2 -0
  33. package/dist/defs/amr/executable-env.js +2 -0
  34. package/dist/defs/amr/executable-resolution.d.ts +5 -1
  35. package/dist/defs/amr/executable-resolution.js +1 -1
  36. package/dist/defs/antigravity/index.d.ts +1 -0
  37. package/dist/defs/antigravity/index.js +3 -0
  38. package/dist/defs/antigravity/permissions.d.ts +26 -0
  39. package/dist/defs/antigravity/permissions.js +66 -0
  40. package/dist/defs/{auggie.d.ts → auggie/index.d.ts} +1 -1
  41. package/dist/defs/{auggie.js → auggie/index.js} +3 -3
  42. package/dist/defs/claude/config-dir.d.ts +62 -0
  43. package/dist/defs/claude/config-dir.js +133 -0
  44. package/dist/defs/claude/filesystem.d.ts +33 -0
  45. package/dist/defs/claude/filesystem.js +30 -0
  46. package/dist/defs/{claude.d.ts → claude/index.d.ts} +1 -1
  47. package/dist/defs/{claude.js → claude/index.js} +9 -9
  48. package/dist/defs/claude/mcp-config.d.ts +22 -0
  49. package/dist/defs/claude/mcp-config.js +29 -0
  50. package/dist/defs/claude/mcp-delivery.d.ts +57 -0
  51. package/dist/defs/claude/mcp-delivery.js +75 -0
  52. package/dist/defs/claude/mcp-json.d.ts +34 -0
  53. package/dist/defs/claude/mcp-json.js +38 -0
  54. package/dist/defs/claude/subagent-start.d.ts +12 -0
  55. package/dist/defs/claude/subagent-start.js +35 -0
  56. package/dist/defs/{cline.d.ts → cline/index.d.ts} +1 -1
  57. package/dist/defs/{cline.js → cline/index.js} +3 -3
  58. package/dist/defs/codex/contracts.d.ts +47 -0
  59. package/dist/defs/codex/contracts.js +6 -0
  60. package/dist/defs/codex/event-stream.d.ts +5 -1
  61. package/dist/defs/codex/event-stream.js +29 -24
  62. package/dist/defs/codex/home-config.d.ts +55 -0
  63. package/dist/defs/codex/home-config.js +224 -0
  64. package/dist/defs/codex/home-staging.d.ts +57 -0
  65. package/dist/defs/codex/home-staging.js +184 -0
  66. package/dist/defs/{codex.d.ts → codex/index.d.ts} +2 -2
  67. package/dist/defs/{codex.js → codex/index.js} +3 -3
  68. package/dist/defs/codex/isolation.d.ts +29 -0
  69. package/dist/defs/codex/isolation.js +69 -0
  70. package/dist/defs/codex/launch.d.ts +4 -1
  71. package/dist/defs/codex/launch.js +1 -1
  72. package/dist/defs/codex/mcp-delivery.d.ts +8 -0
  73. package/dist/defs/codex/mcp-delivery.js +5 -0
  74. package/dist/defs/{crush.d.ts → crush/index.d.ts} +1 -1
  75. package/dist/defs/{crush.js → crush/index.js} +3 -3
  76. package/dist/defs/cursor-agent/event-stream.d.ts +5 -1
  77. package/dist/defs/cursor-agent/event-stream.js +14 -7
  78. package/dist/defs/{cursor-agent.d.ts → cursor-agent/index.d.ts} +1 -1
  79. package/dist/defs/{cursor-agent.js → cursor-agent/index.js} +4 -4
  80. package/dist/defs/{deepseek.d.ts → deepseek/index.d.ts} +2 -1
  81. package/dist/defs/{deepseek.js → deepseek/index.js} +6 -3
  82. package/dist/defs/{devin.d.ts → devin/index.d.ts} +1 -1
  83. package/dist/defs/{devin.js → devin/index.js} +3 -3
  84. package/dist/defs/{droid.d.ts → droid/index.d.ts} +1 -1
  85. package/dist/defs/{droid.js → droid/index.js} +3 -3
  86. package/dist/defs/gemini/event-stream.d.ts +5 -1
  87. package/dist/defs/gemini/event-stream.js +15 -12
  88. package/dist/defs/gemini/tool-calls.d.ts +7 -0
  89. package/dist/defs/gemini/tool-calls.js +9 -0
  90. package/dist/defs/{goose.d.ts → goose/index.d.ts} +1 -1
  91. package/dist/defs/{goose.js → goose/index.js} +3 -3
  92. package/dist/defs/{grok-build.d.ts → grok-build/index.d.ts} +1 -1
  93. package/dist/defs/{grok-build.js → grok-build/index.js} +3 -3
  94. package/dist/defs/index.d.ts +28 -28
  95. package/dist/defs/index.js +28 -28
  96. package/dist/defs/{kilo.d.ts → kilo/index.d.ts} +1 -1
  97. package/dist/defs/{kilo.js → kilo/index.js} +3 -3
  98. package/dist/defs/kimi/event-stream.d.ts +4 -1
  99. package/dist/defs/kimi/event-stream.js +6 -5
  100. package/dist/defs/{kimi.d.ts → kimi/index.d.ts} +1 -1
  101. package/dist/defs/{kimi.js → kimi/index.js} +3 -3
  102. package/dist/defs/{kiro.d.ts → kiro/index.d.ts} +1 -1
  103. package/dist/defs/{kiro.js → kiro/index.js} +3 -3
  104. package/dist/defs/mimo/constants.d.ts +2 -0
  105. package/dist/defs/mimo/constants.js +2 -0
  106. package/dist/defs/{mimo.d.ts → mimo/index.d.ts} +1 -1
  107. package/dist/defs/{mimo.js → mimo/index.js} +3 -3
  108. package/dist/defs/opencode/constants.d.ts +2 -0
  109. package/dist/defs/opencode/constants.js +2 -0
  110. package/dist/defs/opencode/event-stream.d.ts +5 -1
  111. package/dist/defs/opencode/event-stream.js +13 -11
  112. package/dist/defs/{opencode.d.ts → opencode/index.d.ts} +2 -2
  113. package/dist/defs/{opencode.js → opencode/index.js} +5 -5
  114. package/dist/defs/opencode/mcp-config.d.ts +108 -0
  115. package/dist/defs/opencode/mcp-config.js +119 -0
  116. package/dist/defs/opencode/model-discovery.d.ts +3 -1
  117. package/dist/defs/opencode/model-discovery.js +1 -1
  118. package/dist/defs/opencode/tool-calls.d.ts +7 -0
  119. package/dist/defs/opencode/tool-calls.js +12 -0
  120. package/dist/defs/{opencode-acp.d.ts → opencode-acp/index.d.ts} +2 -2
  121. package/dist/defs/{opencode-acp.js → opencode-acp/index.js} +4 -4
  122. package/dist/defs/{pi.d.ts → pi/index.d.ts} +1 -1
  123. package/dist/defs/{pi.js → pi/index.js} +3 -3
  124. package/dist/defs/pi/model-discovery.d.ts +4 -1
  125. package/dist/defs/pi/model-discovery.js +1 -1
  126. package/dist/defs/{qoder.d.ts → qoder/index.d.ts} +1 -1
  127. package/dist/defs/{qoder.js → qoder/index.js} +3 -3
  128. package/dist/defs/{qwen.d.ts → qwen/index.d.ts} +1 -1
  129. package/dist/defs/{qwen.js → qwen/index.js} +3 -3
  130. package/dist/defs/{reasonix.d.ts → reasonix/index.d.ts} +1 -1
  131. package/dist/defs/{reasonix.js → reasonix/index.js} +3 -3
  132. package/dist/defs/{trae-cli.d.ts → trae-cli/index.d.ts} +1 -1
  133. package/dist/defs/{trae-cli.js → trae-cli/index.js} +3 -3
  134. package/dist/defs/{vibe.d.ts → vibe/index.d.ts} +1 -1
  135. package/dist/defs/{vibe.js → vibe/index.js} +3 -3
  136. package/dist/executables.js +1 -1
  137. package/dist/inventory/index.d.ts +61 -0
  138. package/dist/inventory/index.js +45 -0
  139. package/dist/json-event-stream-shared.d.ts +10 -2
  140. package/dist/json-event-stream-shared.js +21 -13
  141. package/dist/json-event-stream.js +6 -5
  142. package/dist/launch.js +1 -1
  143. package/dist/model-catalog-live-discovery.d.ts +103 -0
  144. package/dist/model-catalog-live-discovery.js +111 -0
  145. package/dist/model-discovery-adapters.d.ts +6 -1
  146. package/dist/model-discovery-adapters.js +4 -3
  147. package/dist/model-discovery-config.js +1 -1
  148. package/dist/native-permissions.d.ts +19 -0
  149. package/dist/native-permissions.js +22 -0
  150. package/dist/providers/anthropic-messages.js +3 -2
  151. package/dist/providers/connection-guard.js +99 -84
  152. package/dist/providers/connection-test.js +0 -5
  153. package/dist/providers/google-messages.js +1 -1
  154. package/dist/providers/oauth-provider.d.ts +1 -23
  155. package/dist/providers/oauth-provider.js +1 -35
  156. package/dist/providers/openai-chat-request.js +1 -1
  157. package/dist/providers/tool-loop-verdict.d.ts +1 -0
  158. package/dist/providers/tool-loop-verdict.js +4 -1
  159. package/dist/providers/tool-turn-types.d.ts +12 -9
  160. package/dist/providers/tool-turn.d.ts +63 -1
  161. package/dist/providers/tool-turn.js +67 -1
  162. package/dist/qoder-stream.js +66 -66
  163. package/dist/role-marker-guard.js +49 -30
  164. package/dist/runtime-def-binding.js +1 -1
  165. package/dist/runtime-port-bindings.d.ts +82 -0
  166. package/dist/runtime-port-bindings.js +4 -1
  167. package/dist/runtime-strategies.d.ts +100 -0
  168. package/dist/runtime-strategies.js +129 -0
  169. package/package.json +44 -10
  170. package/dist/defs/amp.d.ts +0 -2
  171. package/dist/defs/amp.js +0 -2
  172. package/dist/defs/amr.d.ts +0 -2
  173. package/dist/defs/amr.js +0 -2
  174. package/dist/defs/codebuddy.d.ts +0 -2
  175. package/dist/defs/codebuddy.js +0 -2
  176. package/dist/defs/hermes.d.ts +0 -2
  177. package/dist/defs/hermes.js +0 -2
@@ -0,0 +1,103 @@
1
+ import { type ProviderModelOption } from "@jini-ai/core/contracts/agents";
2
+ import type { Clock } from "@jini-ai/core/primitives";
3
+ import { listProviderModels } from "./providers/model-catalog.js";
4
+ /** The slice of a host's stored execution credential live discovery reads. */
5
+ export interface LiveModelCredential {
6
+ readonly protocol: string;
7
+ readonly apiKey: string;
8
+ /** Null/absent falls back to the host-injected `defaultBaseUrl`. */
9
+ readonly baseUrl?: string | null;
10
+ readonly providerId?: string | null;
11
+ }
12
+ /** The client-safe projection a live entry is reduced to; a host's fallback entries may carry more. */
13
+ export interface LiveModelSummary {
14
+ readonly id: string;
15
+ readonly label: string;
16
+ }
17
+ /** The tenant tuple a credential (and therefore a cache slot) belongs to. */
18
+ export interface LiveModelKey {
19
+ workspaceId: string;
20
+ principalId: string;
21
+ }
22
+ export interface LiveModelDiscovery {
23
+ /**
24
+ * Resolves the admin's stored execution credential for `(workspaceId, principalId)` and, only
25
+ * when it is a usable `anthropic` credential, returns Claude's live model catalog (cached — see
26
+ * this file's header). Returns `null` for every other outcome: no row, no key, wrong protocol, or
27
+ * a failed/timed-out live call. `null` is not an error signal — the caller's contract
28
+ * (`unionModels`) is to treat it as "nothing to enrich with" and leave the static fallback list
29
+ * exactly as it was, which is what makes this a strict enrichment layer rather than a dependency
30
+ * the picker can be blocked or degraded by.
31
+ *
32
+ * No network call is made at all on the `null`/wrong-protocol paths — verified directly by the
33
+ * tests stubbing `globalThis.fetch` to throw. That is the "never a gate" invariant a
34
+ * Max-subscription admin with no stored key depends on: zero added latency, by construction, not
35
+ * by a cache that merely answers fast.
36
+ *
37
+ * @complexity O(1) plus, at most, one cached network call.
38
+ */
39
+ getLiveClaudeModels(key: LiveModelKey): Promise<readonly ProviderModelOption[] | null>;
40
+ }
41
+ /** Creates one host-owned discovery/cache instance; generic cache and its rationale now live in
42
+ * `./model-catalog-cache.ts` (`@jini-ai/agent-runtime/model-catalog/cache`). The in-flight call itself is shared so concurrent
43
+ * requests in a TTL window issue one provider call, rather than caching only its eventual value.
44
+ * Successes and failures keep the same five-minute TTL; credentials are resolved before each read.
45
+ * A host may be multi-workspace: delimiter-joined `${workspaceId}:${principalId}` keys would alias
46
+ * tenants if either ID contained `:`. The package encodes the full tuple structurally, including
47
+ * credential and endpoint scope. SHA-256 fingerprints invalidate rotation without retaining a raw key
48
+ * in cache keys. A result wrapper preserves the distinction between a successful empty catalog and failure.
49
+ * The host injects `resolveCredential` (its own credential store read + decrypt) and
50
+ * `defaultBaseUrl` (its provider catalog's Anthropic endpoint).
51
+ */
52
+ export declare function createLiveModelDiscovery({ resolveCredential, defaultBaseUrl, clock, discover }: {
53
+ resolveCredential: (key: LiveModelKey) => Promise<LiveModelCredential | null>;
54
+ defaultBaseUrl: string;
55
+ clock: Clock;
56
+ discover: (required: {
57
+ apiKey: string;
58
+ baseUrl: string;
59
+ }) => Promise<readonly ProviderModelOption[] | null>;
60
+ }, { ttlMs }?: {
61
+ ttlMs?: number;
62
+ }): LiveModelDiscovery;
63
+ /**
64
+ * The one network call this module makes, isolated so {@link LiveModelDiscovery.getLiveClaudeModels} stays
65
+ * readable. `listProviderModels` returns expected auth, network, timeout and malformed-response failures
66
+ * as `{ok: false, ...}`. The package cache also catches unexpected discovery rejections and records
67
+ * a null result for the same TTL, so a rejected promise never poisons the slot.
68
+ *
69
+ * Logs on `!result.ok` — deliberately the ONLY log line in this module. A live call only reaches
70
+ * this function once {@link LiveModelDiscovery.getLiveClaudeModels} has already resolved a real `anthropic`
71
+ * credential, so a failure here means an admin who set up BYOK for Claude is silently getting the
72
+ * static fallback list instead of the live one they configured — worth an operator seeing, unlike
73
+ * the no-credential/wrong-protocol paths (expected, quiet by design). One line, not a stack: the
74
+ * `listProviderModels` result already redacts the key (`redactSecrets`), so `result.detail` is
75
+ * safe to log as-is.
76
+ *
77
+ * @complexity O(1) local work; one outbound HTTPS call bounded by `listProviderModels`'s own
78
+ * 12s timeout.
79
+ */
80
+ export declare function fetchLiveClaudeModels({ apiKey, baseUrl, warn }: {
81
+ apiKey: string;
82
+ baseUrl: string;
83
+ /** Receives the one failure line. Injected so the host owns its log sink and any log-line
84
+ * prefix; the engine never writes to the console. */
85
+ warn: (message: string) => void;
86
+ }, { listModels }?: {
87
+ listModels?: typeof listProviderModels;
88
+ }): Promise<readonly ProviderModelOption[] | null>;
89
+ /**
90
+ * Merges a live-discovered model list into the static fallback list, per design doc §3.5: UNION,
91
+ * never replace. `fallback` is always fully present in the result, in its original order — there
92
+ * is no code path here that can drop the `'default'` sentinel or the bare `sonnet`/`opus`/`haiku`
93
+ * aliases, because nothing is ever removed from it. `live` entries are appended in their given
94
+ * order, skipping any `id` already present (from `fallback` or an earlier `live` entry).
95
+ *
96
+ * @complexity O(f + l) where f/l are the fallback/live list lengths — one `Set` built from
97
+ * `fallback`, one pass over `live`.
98
+ */
99
+ export declare function unionModels<Model extends LiveModelSummary>({ fallback, live }: {
100
+ fallback: readonly Model[];
101
+ live: readonly ProviderModelOption[];
102
+ }, _optional?: Record<string, never>): (Model | LiveModelSummary)[];
103
+ //# sourceMappingURL=model-catalog-live-discovery.d.ts.map
@@ -0,0 +1,111 @@
1
+ import { createHash } from "node:crypto";
2
+ import {} from "@jini-ai/core/contracts/agents";
3
+ import { listProviderModels } from "./providers/model-catalog.js";
4
+ import { ModelCatalogCache, unionModels as unionModelCatalog } from "./model-catalog-cache.js";
5
+ /**
6
+ * @file Live model discovery for a Local CLI picker's `claude` entry — the enrichment step a host's
7
+ * `GET /api/agents` handler calls before responding (design: the host's local-CLI live model
8
+ * discovery design, §3.1/§3.5).
9
+ *
10
+ * Two independent concerns, deliberately not folded into one function:
11
+ * - {@link LiveModelDiscovery.getLiveClaudeModels} — the "never a gate" credential branch. Resolves the
12
+ * principal's own stored execution credential (through the host-injected `resolveCredential`) and
13
+ * returns immediately, with NO network call, whenever there is no credential, no key, or a protocol
14
+ * other than `anthropic`. Only a resolved `anthropic` credential reaches the cache/network path below.
15
+ * - The in-memory TTL cache — wraps ONLY the `listProviderModels` call, not the credential check
16
+ * (that check is a single cheap repo read + decrypt in a typical host, so caching it buys nothing
17
+ * and would only obscure the "zero network calls" property under a cache hit/miss branch). Sized
18
+ * so a busy admin dock (mount, tab switch back to the dock) doesn't reissue a live HTTPS call on
19
+ * every `/api/agents` load — see the design doc's Risks §5 for the accepted staleness window this
20
+ * trades for that.
21
+ *
22
+ * {@link unionModels} is the §3.5 merge policy: fallback entries (including the `sonnet`/`opus`/
23
+ * `haiku` aliases and the `'default'` sentinel) are ALWAYS present, unconditionally — this function
24
+ * has no code path that can drop one. Live-discovered ids are appended only when not already
25
+ * present, deduped by `id`.
26
+ */
27
+ /** How long one successful-or-failed live call is trusted before the next request re-issues it.
28
+ * Deliberately minutes, not seconds: installing/rotating a stored key is a deliberate admin
29
+ * action, not one that needs sub-minute staleness (design doc §3.1's own reasoning). */
30
+ const LIVE_MODEL_CACHE_TTL_MS = 5 * 60_000;
31
+ /** Creates one host-owned discovery/cache instance; generic cache and its rationale now live in
32
+ * `./model-catalog-cache.ts` (`@jini-ai/agent-runtime/model-catalog/cache`). The in-flight call itself is shared so concurrent
33
+ * requests in a TTL window issue one provider call, rather than caching only its eventual value.
34
+ * Successes and failures keep the same five-minute TTL; credentials are resolved before each read.
35
+ * A host may be multi-workspace: delimiter-joined `${workspaceId}:${principalId}` keys would alias
36
+ * tenants if either ID contained `:`. The package encodes the full tuple structurally, including
37
+ * credential and endpoint scope. SHA-256 fingerprints invalidate rotation without retaining a raw key
38
+ * in cache keys. A result wrapper preserves the distinction between a successful empty catalog and failure.
39
+ * The host injects `resolveCredential` (its own credential store read + decrypt) and
40
+ * `defaultBaseUrl` (its provider catalog's Anthropic endpoint).
41
+ */
42
+ export function createLiveModelDiscovery({ resolveCredential, defaultBaseUrl, clock, discover }, { ttlMs = LIVE_MODEL_CACHE_TTL_MS } = {}) {
43
+ const cache = new ModelCatalogCache({
44
+ clock,
45
+ // Each get supplies a discovery closure AFTER resolving that principal's credential. This
46
+ // required default is fail-closed if a future caller forgets that closure; it never does I/O.
47
+ discover: async () => null,
48
+ merge: ({ live }) => live,
49
+ }, { ttlMs });
50
+ return {
51
+ async getLiveClaudeModels(key) {
52
+ const stored = await resolveCredential(key);
53
+ if (!stored || stored.protocol !== "anthropic" || !stored.apiKey.trim())
54
+ return null;
55
+ const baseUrl = stored.baseUrl ?? defaultBaseUrl;
56
+ const credentialFingerprint = createHash("sha256").update(stored.apiKey).digest("hex");
57
+ const outcomes = await cache.get({
58
+ cacheKey: [key.workspaceId, key.principalId, stored.protocol, stored.providerId ?? "", baseUrl, credentialFingerprint],
59
+ fallback: [],
60
+ }, {
61
+ discover: async () => {
62
+ const models = await discover({ apiKey: stored.apiKey, baseUrl });
63
+ return models === null ? null : [{ models }];
64
+ },
65
+ });
66
+ return outcomes[0]?.models ?? null;
67
+ },
68
+ };
69
+ }
70
+ /**
71
+ * The one network call this module makes, isolated so {@link LiveModelDiscovery.getLiveClaudeModels} stays
72
+ * readable. `listProviderModels` returns expected auth, network, timeout and malformed-response failures
73
+ * as `{ok: false, ...}`. The package cache also catches unexpected discovery rejections and records
74
+ * a null result for the same TTL, so a rejected promise never poisons the slot.
75
+ *
76
+ * Logs on `!result.ok` — deliberately the ONLY log line in this module. A live call only reaches
77
+ * this function once {@link LiveModelDiscovery.getLiveClaudeModels} has already resolved a real `anthropic`
78
+ * credential, so a failure here means an admin who set up BYOK for Claude is silently getting the
79
+ * static fallback list instead of the live one they configured — worth an operator seeing, unlike
80
+ * the no-credential/wrong-protocol paths (expected, quiet by design). One line, not a stack: the
81
+ * `listProviderModels` result already redacts the key (`redactSecrets`), so `result.detail` is
82
+ * safe to log as-is.
83
+ *
84
+ * @complexity O(1) local work; one outbound HTTPS call bounded by `listProviderModels`'s own
85
+ * 12s timeout.
86
+ */
87
+ export async function fetchLiveClaudeModels({ apiKey, baseUrl, warn }, { listModels = listProviderModels } = {}) {
88
+ const result = await listModels({ protocol: "anthropic", baseUrl, apiKey });
89
+ if (!result.ok) {
90
+ const detail = result.detail ? `: ${result.detail}` : "";
91
+ warn(`live Claude model discovery failed (${result.kind}${detail}) — falling back to the static model list`);
92
+ return null;
93
+ }
94
+ return result.models ?? null;
95
+ }
96
+ /**
97
+ * Merges a live-discovered model list into the static fallback list, per design doc §3.5: UNION,
98
+ * never replace. `fallback` is always fully present in the result, in its original order — there
99
+ * is no code path here that can drop the `'default'` sentinel or the bare `sonnet`/`opus`/`haiku`
100
+ * aliases, because nothing is ever removed from it. `live` entries are appended in their given
101
+ * order, skipping any `id` already present (from `fallback` or an earlier `live` entry).
102
+ *
103
+ * @complexity O(f + l) where f/l are the fallback/live list lengths — one `Set` built from
104
+ * `fallback`, one pass over `live`.
105
+ */
106
+ export function unionModels({ fallback, live }, _optional = {}) {
107
+ // Preserve the client-safe projection: fallback metadata survives, while discovered entries
108
+ // expose only the model ID and label. Deduplication/order belong to the package merger.
109
+ return unionModelCatalog({ fallback, live: live.map(({ id, label }) => ({ id, label })) });
110
+ }
111
+ //# sourceMappingURL=model-catalog-live-discovery.js.map
@@ -33,7 +33,12 @@ export declare function probeClaudeInitialize({ context, deps, signal }: {
33
33
  deps: ModelDiscoveryDeps;
34
34
  signal: AbortSignal;
35
35
  }, _optional?: Record<string, never>): Promise<ModelProbeResult>;
36
- export declare function probeProviderApi(agentId: string, context: ModelDiscoveryContext, deps: ModelDiscoveryDeps, signal: AbortSignal): Promise<ModelProbeResult>;
36
+ export declare function probeProviderApi({ agentId, context, deps, signal }: {
37
+ agentId: string;
38
+ context: ModelDiscoveryContext;
39
+ deps: ModelDiscoveryDeps;
40
+ signal: AbortSignal;
41
+ }, _optional?: Record<string, never>): Promise<ModelProbeResult>;
37
42
  /** Caches are partial observed catalogs, always stale, never silently promoted to live. */
38
43
  export declare function probeCliCache({ agentId, context, deps, signal }: {
39
44
  agentId: string;
@@ -135,7 +135,7 @@ const PROVIDER_LIST_FAILURES = { auth_failed: 'auth-missing', timeout: 'timeout'
135
135
  function aiderProviderPrefix(agentId, selection) {
136
136
  return agentId === 'aider' && selection?.includes('/') ? selection.slice(0, selection.indexOf('/') + 1) : '';
137
137
  }
138
- export async function probeProviderApi(agentId, context, deps, signal) {
138
+ export async function probeProviderApi({ agentId, context, deps, signal }, _optional = {}) {
139
139
  const config = await readModelConfiguration({ agentId, context, deps, signal });
140
140
  const effectiveContext = config.selection ? { ...context, model: config.selection } : context;
141
141
  const input = await deps.credential.connection({ agentId, context: effectiveContext, signal });
@@ -210,6 +210,7 @@ function parseGenericCliModels(stdout) {
210
210
  return [{ id: match[1], label: match[2] || match[1], identityKind: modelIdentityKind({ id: match[1] }) }];
211
211
  });
212
212
  }
213
+ const probeProviderCatalog = (agentId, context, deps, signal) => probeProviderApi({ agentId, context, deps, signal });
213
214
  const probeRpc = (agentId, context, deps, signal) => deps.rpc.probe({ agentId, context, signal });
214
215
  async function probeClaudeCatalog(agentId, context, deps, signal) {
215
216
  try {
@@ -217,7 +218,7 @@ async function probeClaudeCatalog(agentId, context, deps, signal) {
217
218
  }
218
219
  catch {
219
220
  try {
220
- return await probeProviderApi(agentId, context, deps, signal);
221
+ return await probeProviderApi({ agentId, context, deps, signal });
221
222
  }
222
223
  catch {
223
224
  return probeCliCache({ agentId, context, deps, signal });
@@ -239,7 +240,7 @@ const AGENT_PROBES = new Map([
239
240
  ['claude', probeClaudeCatalog],
240
241
  ['pi', probeRpc], ['droid', probeRpc],
241
242
  // UNVERIFIED CLI-owned effective credential adapters; OAuth/unknown endpoints require host ports.
242
- ['aider', probeProviderApi], ['qwen', probeProviderApi], ['mimo', probeProviderApi],
243
+ ['aider', probeProviderCatalog], ['qwen', probeProviderCatalog], ['mimo', probeProviderCatalog],
243
244
  ['codebuddy', probeCodeBuddyCatalog],
244
245
  ]);
245
246
  const DISK_CACHE_LISTINGS = new Set(['codex', 'opencode']);
@@ -60,7 +60,7 @@ function parseJsonModel(file, raw) {
60
60
  const model = dotted(settings, file.key || 'model');
61
61
  // Cursor's model object subkeys are undocumented: never guess which one is the effective id.
62
62
  const parse = file.key ? JSON_MODEL_PARSERS.get(file.key) : undefined;
63
- return parse ? parse(model, settings) : scalar({ value: model });
63
+ return parse ? parse({ model, settings }) : scalar({ value: model });
64
64
  }
65
65
  /** Every quoted `model = "..."` assignment with the TOML section it appears in. */
66
66
  function tomlModelAssignments(raw) {
@@ -1,3 +1,4 @@
1
+ import type { JsonValue } from '@jini-ai/core/primitives';
1
2
  /** Generic native-capability snapshots. Hosts own grant gates, persistence and migration. */
2
3
  export interface NativeAgentPermissions<K extends string> {
3
4
  enabled?: boolean;
@@ -44,4 +45,22 @@ export declare function projectNativePermissions<K extends string>(required: {
44
45
  capabilityKeys: readonly K[];
45
46
  agentId?: string;
46
47
  }, _optional?: Record<string, never>): NativePermissionSet<K>;
48
+ /** Merge one save into a host's raw stored permission layer (read with its unknown fields intact).
49
+ * Without `agentId` the master flag and every capability reset to the host defaults and the host's
50
+ * `masterSaveFields` (for example a migration marker) are stamped; with one, only that agent's entry
51
+ * changes, and the master/default fields and every other agent's entry remain intact.
52
+ * Returns a fresh JSON object without mutation or I/O.
53
+ * @complexity O(k + a + p) time/space for k raw fields, a agents and p capability entries.
54
+ */
55
+ export declare function patchNativePermissionLayer<K extends string>(required: {
56
+ raw: Record<string, JsonValue>;
57
+ defaults: {
58
+ enabled: boolean;
59
+ capabilities: Record<K, boolean>;
60
+ };
61
+ agentId?: string;
62
+ capabilities?: Partial<Record<K, boolean>>;
63
+ enabled?: boolean;
64
+ masterSaveFields?: Record<string, JsonValue>;
65
+ }, _optional?: Record<string, never>): Record<string, JsonValue>;
47
66
  //# sourceMappingURL=native-permissions.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { isNonArrayRecord } from '@jini-ai/core/records';
1
2
  /** A malformed permission snapshot; the host supplies the safe refusal text. */
2
3
  export class InvalidNativePermissionsError extends Error {
3
4
  constructor({ message }) {
@@ -77,4 +78,25 @@ export function projectNativePermissions(required, _optional = {}) {
77
78
  return fillNativePermissions({ ...settings, capabilityKeys, enabled: override?.enabled ?? settings.enabled,
78
79
  capabilities: { ...settings.capabilities, ...override?.capabilities } });
79
80
  }
81
+ /** Merge one save into a host's raw stored permission layer (read with its unknown fields intact).
82
+ * Without `agentId` the master flag and every capability reset to the host defaults and the host's
83
+ * `masterSaveFields` (for example a migration marker) are stamped; with one, only that agent's entry
84
+ * changes, and the master/default fields and every other agent's entry remain intact.
85
+ * Returns a fresh JSON object without mutation or I/O.
86
+ * @complexity O(k + a + p) time/space for k raw fields, a agents and p capability entries.
87
+ */
88
+ export function patchNativePermissionLayer(required, _optional = {}) {
89
+ const { raw, defaults, agentId, capabilities, enabled, masterSaveFields } = required;
90
+ if (!agentId)
91
+ return { ...raw, enabled: defaults.enabled, capabilities: { ...defaults.capabilities }, ...masterSaveFields };
92
+ const byAgent = objectValue({ value: raw.byAgent });
93
+ const previous = objectValue({ value: byAgent[agentId] });
94
+ return { ...raw, enabled: raw.enabled ?? defaults.enabled, capabilities: raw.capabilities ?? { ...defaults.capabilities },
95
+ byAgent: { ...byAgent, [agentId]: { ...previous, ...(enabled === undefined ? {} : { enabled }),
96
+ capabilities: { ...objectValue({ value: previous.capabilities }), ...capabilities } } } };
97
+ }
98
+ function objectValue(required) {
99
+ // The guard excludes null, primitives and arrays, so the only JsonValue member left is JsonObject.
100
+ return isNonArrayRecord(required) ? required.value : {};
101
+ }
80
102
  //# sourceMappingURL=native-permissions.js.map
@@ -1,4 +1,4 @@
1
- import { redactSecrets } from '@jini-ai/core';
1
+ import { redactSecrets } from '@jini-ai/core/redaction';
2
2
  /**
3
3
  * @module providers/anthropic-messages
4
4
  *
@@ -394,7 +394,8 @@ async function runSingleAnthropicRequest(options, messages, emitEnd, retry) {
394
394
  const data = parseAnthropicSseData({ raw: frame.data });
395
395
  if (!data)
396
396
  return null; // malformed/empty keep-alive frame, or a non-object payload
397
- const handler = ANTHROPIC_FRAME_HANDLERS[anthropicFrameKind({ data: data, frameEvent: frame.event })];
397
+ const kind = anthropicFrameKind({ data: data, frameEvent: frame.event });
398
+ const handler = Object.hasOwn(ANTHROPIC_FRAME_HANDLERS, kind) ? ANTHROPIC_FRAME_HANDLERS[kind] : undefined;
398
399
  if (!handler)
399
400
  return null; // `message_stop`, `ping`, or a future event type — nothing to do
400
401
  return handler(state, data, onEvent, options.apiKey);
@@ -45,7 +45,7 @@ import { readProviderResponseText, MAX_PROVIDER_ERROR_BYTES } from './response-t
45
45
  * that actually matters, the UI accepts one this guard would have refused.
46
46
  */
47
47
  import { isLoopbackApiHost, isBlockedExternalApiHostname } from '@jini-ai/core/net';
48
- import { isIpLiteralHostname } from '@jini-ai/core';
48
+ import { isIpLiteralHostname } from '@jini-ai/core/origin-validation';
49
49
  import { trimCharsEnd } from '@jini-ai/core/text';
50
50
  /**
51
51
  * Synchronous base-URL check: scheme allow-list + literal-hostname block-list.
@@ -201,90 +201,9 @@ export async function pinnedFetch({ url, init, pinnedAddress }, { idleTimeoutMs
201
201
  const { request: httpsRequest } = await import('node:https');
202
202
  const { request: httpRequest } = await import('node:http');
203
203
  const transportRequest = isHttps ? httpsRequest : httpRequest;
204
- const family = pinnedAddress?.family === 6 ? 6 : 4;
205
204
  return new Promise((resolve, reject) => {
206
- const req = transportRequest({
207
- hostname: parsed.hostname,
208
- ...(parsed.port ? { port: Number(parsed.port) } : {}),
209
- path: `${parsed.pathname}${parsed.search}`,
210
- method: init.method,
211
- // `identity` is explicit, not incidental. `fetch` transparently decompresses a response;
212
- // `http(s).request` does NOT, so a compressed body would reach a caller that parses it as
213
- // UTF-8 SSE and produce silent garbage — surfacing far from the cause as an empty stream
214
- // or a JSON parse error. Node sends no `Accept-Encoding` of its own, so this only makes
215
- // the existing behaviour explicit and survives a caller that sets its own headers.
216
- // Paired with the `content-encoding` check below, which covers a server that compresses
217
- // unbidden anyway.
218
- headers: { 'accept-encoding': 'identity', ...init.headers },
219
- // `servername` set explicitly to the ORIGINAL hostname (not `pinnedAddress`) is what SNI
220
- // and certificate hostname validation actually run against — this is what makes it a pin
221
- // rather than a redirect to a different origin. `rejectUnauthorized` is left at its
222
- // `node:https` default (`true`, i.e. certificate validation stays ON); nothing in this
223
- // function ever sets it, and it must stay that way.
224
- ...(isHttps ? { servername: parsed.hostname } : {}),
225
- ...(pinnedAddress
226
- ? {
227
- // Happy Eyeballs (`autoSelectFamily`, on by default since Node 20) races several
228
- // resolved addresses and expects `lookup` to support its array-returning calling
229
- // convention — the opposite of what pinning wants (exactly one address, no fallback
230
- // to any other). Disabling it keeps `net`'s classic single-address `lookup` contract,
231
- // which is what the callback below implements.
232
- autoSelectFamily: false,
233
- lookup: (_hostname, _options, callback) => {
234
- callback(null, pinnedAddress.address, family);
235
- },
236
- }
237
- : {}),
238
- }, (res) => {
239
- // `IncomingMessage.statusCode` is typed optional only because the same class also models
240
- // server-side requests; a response handed to a `http(s).request` callback always carries
241
- // one, so no fallback branch is needed.
242
- const status = Number(res.statusCode);
243
- // A server may compress despite `accept-encoding: identity`. Nothing downstream
244
- // decompresses, so failing loudly here is strictly better than handing back bytes the
245
- // caller will misparse: a hard error names the cause, silent garbage does not.
246
- const encoding = res.headers['content-encoding'];
247
- if (typeof encoding === 'string' && encoding.trim() !== '' && encoding.trim().toLowerCase() !== 'identity') {
248
- res.resume(); // drain, so the socket is not left half-read
249
- reject(new Error(`pinnedFetch: response used unsupported content-encoding "${encoding}". `
250
- + 'This transport does not decompress; the request asked for identity.'));
251
- return;
252
- }
253
- // `http(s).request` never auto-follows a redirect the way `fetch`'s default does, but
254
- // that alone is a WEAKER posture than the `redirect: 'error'` callers ask for: real
255
- // `fetch` THROWS on a 3xx, whereas simply not following one would resolve normally with
256
- // `status: 302` and a likely-empty body — turning the guard's hard failure into a quiet
257
- // `ok: false` a caller could half-handle as a generic upstream error. That undersells the
258
- // reviewer's original finding: a guard-passing endpoint could 302 into blocked address
259
- // space with auth headers still attached. So this rejects explicitly, matching `fetch`'s
260
- // throw rather than merely approximating it by omission. Only the five redirect codes
261
- // `fetch` itself treats as redirects (a `Location` header is what actually enables the
262
- // rebinding hop) — NOT every 3xx: `304 Not Modified` carries no `Location` and no provider
263
- // in this package sends conditional-request headers that could ever produce one.
264
- if ([301, 302, 303, 307, 308].includes(status)) {
265
- res.resume();
266
- reject(new Error(`pinnedFetch: refused to follow a ${status} redirect`
267
- + (typeof res.headers.location === 'string' ? ` to "${res.headers.location}"` : '')
268
- + '. Matches fetch\'s redirect: \'error\' behavior — a guard-passing endpoint redirecting into blocked address space is the other half of the SSRF finding this transport closes.'));
269
- return;
270
- }
271
- resolve({
272
- ok: status >= 200 && status < 300,
273
- status,
274
- body: res,
275
- text: () => readProviderResponseText({ body: res }, {
276
- maxBytes: status >= 200 && status < 300 ? 8 * 1024 * 1024 : MAX_PROVIDER_ERROR_BYTES,
277
- }),
278
- });
279
- });
280
- if (init.signal) {
281
- if (init.signal.aborted) {
282
- req.destroy(new Error('The operation was aborted'));
283
- }
284
- else {
285
- init.signal.addEventListener('abort', () => req.destroy(new Error('The operation was aborted')), { once: true });
286
- }
287
- }
205
+ const req = transportRequest(buildPinnedRequestOptions({ parsed, isHttps, init, pinnedAddress }), (res) => handlePinnedResponse({ res, resolve, reject }));
206
+ bindAbortSignal({ req, signal: init.signal });
288
207
  // Fires on socket INACTIVITY (no bytes sent or received), covering connect hangs, a
289
208
  // provider that accepts the connection and then never speaks, and a body that stalls
290
209
  // mid-stream — not on total request duration, matching `setTimeout`'s own semantics.
@@ -295,6 +214,102 @@ export async function pinnedFetch({ url, init, pinnedAddress }, { idleTimeoutMs
295
214
  req.end(init.body);
296
215
  });
297
216
  }
217
+ /**
218
+ * Guarded request setup for {@link pinnedFetch}: the request line, headers, TLS server name and —
219
+ * when `pinnedAddress` is set — the connection binding. Pure over its inputs; opens nothing.
220
+ */
221
+ function buildPinnedRequestOptions({ parsed, isHttps, init, pinnedAddress }) {
222
+ return {
223
+ hostname: parsed.hostname,
224
+ ...(parsed.port ? { port: Number(parsed.port) } : {}),
225
+ path: `${parsed.pathname}${parsed.search}`,
226
+ method: init.method,
227
+ // `identity` is explicit, not incidental. `fetch` transparently decompresses a response;
228
+ // `http(s).request` does NOT, so a compressed body would reach a caller that parses it as
229
+ // UTF-8 SSE and produce silent garbage — surfacing far from the cause as an empty stream
230
+ // or a JSON parse error. Node sends no `Accept-Encoding` of its own, so this only makes
231
+ // the existing behaviour explicit and survives a caller that sets its own headers.
232
+ // Paired with the `content-encoding` check below, which covers a server that compresses
233
+ // unbidden anyway.
234
+ headers: { 'accept-encoding': 'identity', ...init.headers },
235
+ // `servername` set explicitly to the ORIGINAL hostname (not `pinnedAddress`) is what SNI
236
+ // and certificate hostname validation actually run against — this is what makes it a pin
237
+ // rather than a redirect to a different origin. `rejectUnauthorized` is left at its
238
+ // `node:https` default (`true`, i.e. certificate validation stays ON); nothing in this
239
+ // function ever sets it, and it must stay that way.
240
+ ...(isHttps ? { servername: parsed.hostname } : {}),
241
+ ...(pinnedAddress ? pinnedConnectionOptions({ pinnedAddress }) : {}),
242
+ };
243
+ }
244
+ /** The connection binding itself: dial exactly `pinnedAddress`, never a second DNS answer. */
245
+ function pinnedConnectionOptions({ pinnedAddress }) {
246
+ const family = pinnedAddress.family === 6 ? 6 : 4;
247
+ return {
248
+ // Happy Eyeballs (`autoSelectFamily`, on by default since Node 20) races several
249
+ // resolved addresses and expects `lookup` to support its array-returning calling
250
+ // convention — the opposite of what pinning wants (exactly one address, no fallback
251
+ // to any other). Disabling it keeps `net`'s classic single-address `lookup` contract,
252
+ // which is what the callback below implements.
253
+ autoSelectFamily: false,
254
+ lookup: (_hostname, _options, callback) => {
255
+ callback(null, pinnedAddress.address, family);
256
+ },
257
+ };
258
+ }
259
+ /** Aborts the in-flight request when the caller's signal fires (immediately if it already has). */
260
+ function bindAbortSignal({ req, signal }) {
261
+ if (!signal)
262
+ return;
263
+ if (signal.aborted) {
264
+ req.destroy(new Error('The operation was aborted'));
265
+ }
266
+ else {
267
+ signal.addEventListener('abort', () => req.destroy(new Error('The operation was aborted')), { once: true });
268
+ }
269
+ }
270
+ /** Response handling for {@link pinnedFetch}: refuse compressed bodies and redirects, else resolve. */
271
+ function handlePinnedResponse({ res, resolve, reject }) {
272
+ // `IncomingMessage.statusCode` is typed optional only because the same class also models
273
+ // server-side requests; a response handed to a `http(s).request` callback always carries
274
+ // one, so no fallback branch is needed.
275
+ const status = Number(res.statusCode);
276
+ // A server may compress despite `accept-encoding: identity`. Nothing downstream
277
+ // decompresses, so failing loudly here is strictly better than handing back bytes the
278
+ // caller will misparse: a hard error names the cause, silent garbage does not.
279
+ const encoding = res.headers['content-encoding'];
280
+ if (typeof encoding === 'string' && encoding.trim() !== '' && encoding.trim().toLowerCase() !== 'identity') {
281
+ res.resume(); // drain, so the socket is not left half-read
282
+ reject(new Error(`pinnedFetch: response used unsupported content-encoding "${encoding}". `
283
+ + 'This transport does not decompress; the request asked for identity.'));
284
+ return;
285
+ }
286
+ // `http(s).request` never auto-follows a redirect the way `fetch`'s default does, but
287
+ // that alone is a WEAKER posture than the `redirect: 'error'` callers ask for: real
288
+ // `fetch` THROWS on a 3xx, whereas simply not following one would resolve normally with
289
+ // `status: 302` and a likely-empty body — turning the guard's hard failure into a quiet
290
+ // `ok: false` a caller could half-handle as a generic upstream error. That undersells the
291
+ // reviewer's original finding: a guard-passing endpoint could 302 into blocked address
292
+ // space with auth headers still attached. So this rejects explicitly, matching `fetch`'s
293
+ // throw rather than merely approximating it by omission. Only the five redirect codes
294
+ // `fetch` itself treats as redirects (a `Location` header is what actually enables the
295
+ // rebinding hop) — NOT every 3xx: `304 Not Modified` carries no `Location` and no provider
296
+ // in this package sends conditional-request headers that could ever produce one.
297
+ if ([301, 302, 303, 307, 308].includes(status)) {
298
+ res.resume();
299
+ reject(new Error(`pinnedFetch: refused to follow a ${status} redirect`
300
+ + (typeof res.headers.location === 'string' ? ` to "${res.headers.location}"` : '')
301
+ + '. Matches fetch\'s redirect: \'error\' behavior — a guard-passing endpoint redirecting into blocked address space is the other half of the SSRF finding this transport closes.'));
302
+ return;
303
+ }
304
+ resolve({
305
+ ok: status >= 200 && status < 300,
306
+ status,
307
+ body: res,
308
+ text: () => readProviderResponseText({ body: res }, {
309
+ maxBytes: status >= 200 && status < 300 ? 8 * 1024 * 1024 : MAX_PROVIDER_ERROR_BYTES,
310
+ }),
311
+ });
312
+ }
298
313
  /** Default DNS lookup for {@link validateBaseUrlResolved} — `node:dns/promises`' `lookup(hostname, { all: true, family: 0 })`. */
299
314
  export async function defaultDnsLookup({ hostname }) {
300
315
  const { promises: dnsPromises } = await import('node:dns');
@@ -240,11 +240,6 @@ function buildProviderCall(input) {
240
240
  extractText: extractGoogleMessageText,
241
241
  };
242
242
  }
243
- default: {
244
- // Unreachable: every supported protocol has a case above, and a new one fails typecheck here.
245
- const unsupported = input.protocol;
246
- throw new TypeError(`Unsupported connection-test protocol: ${String(unsupported)}`);
247
- }
248
243
  }
249
244
  }
250
245
  function parseProviderResponse({ rawText }, _options = {}) {
@@ -1,4 +1,4 @@
1
- import { redactSecrets } from '@jini-ai/core';
1
+ import { redactSecrets } from '@jini-ai/core/redaction';
2
2
  /**
3
3
  * @module providers/google-messages
4
4
  *
@@ -15,10 +15,7 @@
15
15
  * generic-provider-material classification this task asked for — so the
16
16
  * dance is now a config-driven `beginOAuthPkce`/`completeOAuthPkce`/
17
17
  * `refreshOAuthPkceToken` triad taking an {@link OAuthPkceProviderConfig},
18
- * with `XAI_OAUTH_PROVIDER_CONFIG` kept as the one concrete preset the
19
- * origin actually shipped (same pattern this package already uses for
20
- * `RuntimeAgentDef` — a generic contract type plus concrete `defs/*`
21
- * instances).
18
+ * (the concrete xAI preset now lives in `@jini-ai/provider-plugins/xai/preset`).
22
19
  */
23
20
  import { type OAuthTokenResponse, type PendingAuthCache } from './pkce.js';
24
21
  export interface OAuthPkceProviderConfig {
@@ -73,23 +70,4 @@ export interface RefreshOAuthPkceInput {
73
70
  * client_id is always used, it doesn't need to be persisted per-token.
74
71
  */
75
72
  export declare function refreshOAuthPkceToken(requiredArgs: Pick<RefreshOAuthPkceInput, "config" | "refreshToken">, optionalArgs?: Omit<RefreshOAuthPkceInput, "config" | "refreshToken">): Promise<OAuthTokenResponse>;
76
- /** Stable provider id used to key an xAI token in any per-provider cache. */
77
- export declare const XAI_OAUTH_PROVIDER_ID = "xai";
78
- export declare const XAI_OAUTH_REDIRECT_HOST = "127.0.0.1";
79
- export declare const XAI_OAUTH_REDIRECT_PORT = 56121;
80
- export declare const XAI_OAUTH_REDIRECT_PATH = "/callback";
81
- /**
82
- * xAI Grok OAuth 2.0 + PKCE provider config. xAI doesn't speak MCP and
83
- * doesn't expose Dynamic Client Registration, so the issuer / endpoints /
84
- * client_id / scope are hardcoded rather than discovered — same as the
85
- * origin.
86
- *
87
- * `clientId` is a proof-of-concept id reused from NousResearch/hermes-agent
88
- * (xAI does not publish a public application-registration flow); a
89
- * consumer that provisions its own client_id with xAI should override this
90
- * field rather than edit the constant.
91
- */
92
- export declare const XAI_OAUTH_PROVIDER_CONFIG: OAuthPkceProviderConfig;
93
- /** The fixed loopback redirect URI xAI's client_id is registered against. */
94
- export declare function xaiOAuthRedirectUri(): string;
95
73
  //# sourceMappingURL=oauth-provider.d.ts.map