@jini-ai/agent-runtime 0.6.15-rc.2 → 0.6.15

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 (99) hide show
  1. package/dist/agent-protocol/acp/rpc.js +4 -8
  2. package/dist/agent-protocol/acp/session.js +33 -37
  3. package/dist/agent-protocol/acp/text-suppression.js +10 -7
  4. package/dist/agent-protocol/acp/updates.js +4 -5
  5. package/dist/agent-protocol/core/json-line-stream.d.ts +6 -3
  6. package/dist/agent-protocol/core/json-line-stream.js +9 -10
  7. package/dist/agent-protocol/pi-rpc/events.js +27 -27
  8. package/dist/agent-protocol/pi-rpc/models.js +13 -11
  9. package/dist/agent-protocol/pi-rpc/session.js +7 -7
  10. package/dist/ai-trace/classify.js +4 -1
  11. package/dist/ai-trace/sinks.js +19 -3
  12. package/dist/ai-trace/usage.js +3 -1
  13. package/dist/anthropic-live-models.js +0 -0
  14. package/dist/auth.js +20 -17
  15. package/dist/claude-code-models.js +29 -17
  16. package/dist/claude-filesystem-policy.d.ts +4 -3
  17. package/dist/claude-filesystem-policy.js +39 -12
  18. package/dist/claude-stream.js +65 -47
  19. package/dist/copilot-stream.js +14 -11
  20. package/dist/core/model-discovery-shared.js +4 -2
  21. package/dist/core/omit-keys.d.ts +7 -0
  22. package/dist/core/omit-keys.js +12 -0
  23. package/dist/defs/aider.d.ts +1 -1
  24. package/dist/defs/amp.d.ts +1 -1
  25. package/dist/defs/amr.js +5 -9
  26. package/dist/defs/antigravity-event-stream.d.ts +19 -0
  27. package/dist/defs/antigravity-event-stream.js +83 -0
  28. package/dist/defs/antigravity.d.ts +4 -0
  29. package/dist/defs/antigravity.js +27 -15
  30. package/dist/defs/auggie.d.ts +3 -3
  31. package/dist/defs/claude.d.ts +3 -3
  32. package/dist/defs/cline.d.ts +3 -3
  33. package/dist/defs/codebuddy.d.ts +1 -1
  34. package/dist/defs/codex.js +3 -2
  35. package/dist/defs/copilot.d.ts +1 -1
  36. package/dist/defs/crush.d.ts +1 -1
  37. package/dist/defs/cursor-agent.d.ts +3 -1
  38. package/dist/defs/cursor-agent.js +8 -6
  39. package/dist/defs/deepseek.d.ts +1 -1
  40. package/dist/defs/devin.d.ts +3 -3
  41. package/dist/defs/droid.d.ts +1 -1
  42. package/dist/defs/goose.d.ts +3 -3
  43. package/dist/defs/grok-build.js +7 -5
  44. package/dist/defs/hermes.d.ts +3 -3
  45. package/dist/defs/kilo.d.ts +3 -3
  46. package/dist/defs/kimi.d.ts +3 -3
  47. package/dist/defs/kiro.d.ts +3 -3
  48. package/dist/defs/mimo.d.ts +1 -1
  49. package/dist/defs/opencode.d.ts +1 -1
  50. package/dist/defs/pi.d.ts +1 -1
  51. package/dist/defs/qoder.d.ts +1 -1
  52. package/dist/defs/qwen.d.ts +1 -1
  53. package/dist/defs/reasonix.d.ts +3 -3
  54. package/dist/defs/trae-cli.d.ts +3 -3
  55. package/dist/defs/vibe.d.ts +3 -3
  56. package/dist/detection.js +22 -2
  57. package/dist/json-event-stream.d.ts +1 -2
  58. package/dist/json-event-stream.js +10 -9
  59. package/dist/launch.js +2 -1
  60. package/dist/model-catalog-cache.js +6 -4
  61. package/dist/model-contracts.d.ts +29 -0
  62. package/dist/model-contracts.js +2 -0
  63. package/dist/model-discovery-adapters.js +44 -19
  64. package/dist/model-discovery-config.js +8 -4
  65. package/dist/model-discovery-types.d.ts +2 -2
  66. package/dist/model-discovery-yaml.d.ts +9 -0
  67. package/dist/model-discovery-yaml.js +98 -0
  68. package/dist/model-discovery.js +10 -3
  69. package/dist/model-registry.js +2 -1
  70. package/dist/native-tool-policy.d.ts +28 -0
  71. package/dist/native-tool-policy.js +42 -0
  72. package/dist/opencode-log.js +13 -10
  73. package/dist/pi-models.js +13 -11
  74. package/dist/probe-scheduler.js +13 -5
  75. package/dist/providers/aihubmix.js +6 -7
  76. package/dist/providers/anthropic-messages.d.ts +6 -3
  77. package/dist/providers/anthropic-messages.js +21 -23
  78. package/dist/providers/azure-chat.d.ts +1 -1
  79. package/dist/providers/azure-chat.js +7 -10
  80. package/dist/providers/connection-guard.js +2 -1
  81. package/dist/providers/connection-test.js +16 -10
  82. package/dist/providers/google-messages.d.ts +1 -1
  83. package/dist/providers/google-messages.js +33 -35
  84. package/dist/providers/google.js +3 -4
  85. package/dist/providers/model-catalog.js +10 -7
  86. package/dist/providers/ollama-chat.d.ts +0 -8
  87. package/dist/providers/ollama-chat.js +17 -19
  88. package/dist/providers/openai-chat.d.ts +6 -3
  89. package/dist/providers/openai-chat.js +24 -22
  90. package/dist/providers/operation-schema.d.ts +2 -3
  91. package/dist/providers/operation-schema.js +25 -22
  92. package/dist/providers/provider-tool-policy.d.ts +13 -0
  93. package/dist/providers/provider-tool-policy.js +2 -0
  94. package/dist/providers/tool-loop-verdict.d.ts +22 -0
  95. package/dist/providers/tool-loop-verdict.js +17 -0
  96. package/dist/providers/tool-turn-types.d.ts +2 -12
  97. package/dist/providers/tool-turn.js +7 -2
  98. package/dist/types.d.ts +8 -27
  99. package/package.json +14 -8
@@ -49,14 +49,14 @@ const OAUTH_URL_PATTERN = new RegExp([
49
49
  // Google's own OAuth 2.0 authorization host — the endpoint agy actually
50
50
  // prints. Host-anchored rather than path-anchored so an upstream move
51
51
  // from `/o/oauth2/auth` to any other path on that host still redacts.
52
- String.raw `https?://accounts\.google\.com/\S*`,
52
+ String.raw `https?://accounts\.google\.com/[^\s"]*`,
53
53
  // Any other absolute URL carrying an OAuth request's or a bearer
54
54
  // credential's hallmark query parameter, so a future change of identity
55
55
  // provider degrades to "redacted" instead of "leaked". Deliberately keyed
56
56
  // on the parameter names rather than on the word "oauth" appearing
57
57
  // somewhere in the URL, which would also eat ordinary documentation links
58
58
  // an assistant reply might legitimately contain.
59
- String.raw `https?://\S*[?&](?:client_id|code_challenge|code_verifier|access_token|id_token|refresh_token)=\S*`,
59
+ String.raw `https?://[^\s"]*[?&](?:client_id|code_challenge|code_verifier|access_token|id_token|refresh_token)=[^\s"]*`,
60
60
  ].join('|'), 'gi');
61
61
  /** What a redacted URL is replaced with. Deliberately says *what* was removed, so the surrounding "Please visit the URL to log in:" text does not read as truncated output. */
62
62
  const OAUTH_URL_PLACEHOLDER = '[redacted sign-in URL]';
@@ -106,18 +106,11 @@ export function parseAgyModels({ stdout }) {
106
106
  const out = [DEFAULT_MODEL_OPTION];
107
107
  const seen = new Set([DEFAULT_MODEL_OPTION.id]);
108
108
  for (const line of lines) {
109
- if (/^fetching available models\.\.\.$/i.test(line))
109
+ const row = antigravityModelRow(line);
110
+ if (!row || seen.has(row.id))
110
111
  continue;
111
- const tabIndex = line.indexOf('\t');
112
- if (tabIndex === -1)
113
- continue;
114
- // `line` is already trimmed, so a tab inside it always has a non-blank character on each
115
- // side: neither the id nor the label can come out empty here.
116
- const id = line.slice(0, tabIndex).trim();
117
- if (seen.has(id))
118
- continue;
119
- seen.add(id);
120
- out.push({ id, label: line.slice(tabIndex + 1).trim() });
112
+ seen.add(row.id);
113
+ out.push(row);
121
114
  }
122
115
  return out.length > 1 ? out : null;
123
116
  }
@@ -241,14 +234,22 @@ export const antigravityAgentDef = {
241
234
  // - `agy -p '<prompt>'` -> the prompt actually lands.
242
235
  // So the prompt rides argv as `-p`'s value. That is also why this def is
243
236
  // argv-budgeted (`maxPromptArgBytes` below) rather than `promptViaStdin`.
244
- return [...skipPermissionsArgs({ options }), ...modelArgs({ options }), ...logFileArgs({ runtimeContext }), '-p', prompt];
237
+ return ['--output-format', 'stream-json', ...skipPermissionsArgs({ options }), ...modelArgs({ options }), ...logFileArgs({ runtimeContext }), '-p', prompt];
245
238
  },
246
239
  // agy takes its prompt on argv (see `buildArgs`), so this def is
247
240
  // argv-budgeted like the other plain-stream argv adapters (aider,
248
241
  // deepseek) rather than `promptViaStdin`. Without one of these three
249
242
  // fields `assessAgentExecutorCompatibility` rejects the def outright.
250
243
  maxPromptArgBytes: 30_000,
251
- streamFormat: 'plain',
244
+ // Structured receipts enable native-tool auditing; they do not enforce an OFF switch.
245
+ // agy's CLI reference exposes no run-scoped settings/permission/MCP override. Global settings
246
+ // writes race other runs, and relocating HOME breaks auth, so audited output alone cannot grant this.
247
+ // Owner 2026-10-29 supersedes the interim refusal: eligible owners always use full access.
248
+ fullCliAccessOnly: true,
249
+ fullCliAccessNote: "Gemini (Antigravity) always runs with full access to this computer, like running it in your own terminal. Pick Claude or Codex if you want the tool limits.",
250
+ streamFormat: 'json-event-stream',
251
+ eventParser: 'antigravity',
252
+ supportsNativeToolAccess: false,
252
253
  // `buildArgs` above already consumes `runtimeContext.agentLogFilePath` when
253
254
  // the caller supplies one; this is what asks it to. Print mode never
254
255
  // echoes auth/quota failures on stdout, so post-exit log inspection is the
@@ -328,4 +329,15 @@ export const antigravityAgentDef = {
328
329
  // default 5m).
329
330
  externalMcpInjection: 'env-passthrough',
330
331
  };
332
+ /** One `id<TAB>label` row of `agy models`, or `null` for the progress banner and tab-less lines. */
333
+ function antigravityModelRow(line) {
334
+ if (/^fetching available models\.\.\.$/i.test(line))
335
+ return null;
336
+ const tabIndex = line.indexOf('\t');
337
+ if (tabIndex === -1)
338
+ return null;
339
+ // `line` is already trimmed, so a tab inside it always has a non-blank character on each
340
+ // side: neither the id nor the label can come out empty here.
341
+ return { id: line.slice(0, tabIndex).trim(), label: line.slice(tabIndex + 1).trim() };
342
+ }
331
343
  //# sourceMappingURL=antigravity.js.map
@@ -5,11 +5,11 @@ export declare const auggieAgentDef: {
5
5
  versionArgs: string[];
6
6
  fetchModels: ({ resolvedBin, env }: {
7
7
  resolvedBin: string;
8
- env: import("../types.js").RuntimeEnv;
8
+ env: import("../model-contracts.js").RuntimeEnv;
9
9
  }, { acpModelProbe }?: {
10
10
  acpModelProbe?: import("../types.js").AcpModelProbe;
11
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
- fallbackModels: import("../types.js").RuntimeModelOption[];
11
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
12
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
13
13
  buildArgs: () => string[];
14
14
  streamFormat: string;
15
15
  externalMcpInjection: "acp-merge";
@@ -21,12 +21,12 @@ export declare const claudeAgentDef: {
21
21
  '--setting-sources': string;
22
22
  '--chrome': string;
23
23
  };
24
- fallbackModels: import("../types.js").RuntimeModelOption[];
24
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
25
25
  fallbackModelsAssertedAt: string;
26
26
  fetchModels: ({ resolvedBin, env }: {
27
27
  resolvedBin: string;
28
- env: import("../types.js").RuntimeEnv;
29
- }) => Promise<import("../types.js").RuntimeModelOption[] | null>;
28
+ env: import("../model-contracts.js").RuntimeEnv;
29
+ }) => Promise<import("../model-contracts.js").RuntimeModelOption[] | null>;
30
30
  reasoningOptions: {
31
31
  id: string;
32
32
  label: string;
@@ -5,11 +5,11 @@ export declare const clineAgentDef: {
5
5
  versionArgs: string[];
6
6
  fetchModels: ({ resolvedBin, env }: {
7
7
  resolvedBin: string;
8
- env: import("../types.js").RuntimeEnv;
8
+ env: import("../model-contracts.js").RuntimeEnv;
9
9
  }, { acpModelProbe }?: {
10
10
  acpModelProbe?: import("../types.js").AcpModelProbe;
11
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
- fallbackModels: import("../types.js").RuntimeModelOption[];
11
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
12
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
13
13
  buildArgs: () => string[];
14
14
  streamFormat: string;
15
15
  externalMcpInjection: "acp-merge";
@@ -9,7 +9,7 @@ export declare const codebuddyAgentDef: {
9
9
  '--include-partial-messages': string;
10
10
  '--add-dir': string;
11
11
  };
12
- fallbackModels: import("../types.js").RuntimeModelOption[];
12
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
13
13
  reasoningOptions: {
14
14
  id: string;
15
15
  label: string;
@@ -314,6 +314,7 @@ export const codexAgentDef = {
314
314
  fallbackModels: [
315
315
  DEFAULT_MODEL_OPTION,
316
316
  { id: 'gpt-6.1-sol', label: 'GPT-6.1 Sol' },
317
+ { id: 'gpt-6.1-terra', label: 'GPT-6.1 Terra' },
317
318
  { id: 'gpt-6-sol', label: 'GPT-6 Sol' },
318
319
  { id: 'gpt-6-luna', label: 'GPT-6 Luna' },
319
320
  { id: 'gpt-6-astra', label: 'gpt-6-astra' },
@@ -335,9 +336,9 @@ export const codexAgentDef = {
335
336
  { id: 'o3', label: 'o3' },
336
337
  { id: 'o4-mini', label: 'o4-mini' },
337
338
  ],
338
- // Asserted against a live `codex debug models` run (codex-cli 0.153.4). See
339
+ // Asserted against the dispatch's live Codex catalog evidence (2026-10-29). See
339
340
  // `RuntimeAgentDef.fallbackModelsAssertedAt` and `scripts/check-model-fallback-freshness.ts`.
340
- fallbackModelsAssertedAt: '2026-10-24',
341
+ fallbackModelsAssertedAt: '2026-10-29',
341
342
  // The OLD-CLI path only. A Codex build new enough to answer `debug models` gets its effort list
342
343
  // derived from that catalog instead (see `deriveReasoningOptions` below), which is what makes
343
344
  // `max` and `ultra` reachable. This list is deliberately NOT widened to match: it is what a build
@@ -3,7 +3,7 @@ export declare const copilotAgentDef: {
3
3
  name: string;
4
4
  bin: string;
5
5
  versionArgs: string[];
6
- fallbackModels: import("../types.js").RuntimeModelOption[];
6
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
7
7
  buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }: {
8
8
  prompt: string;
9
9
  imagePaths: string[];
@@ -3,7 +3,7 @@ export declare const crushAgentDef: {
3
3
  name: string;
4
4
  bin: string;
5
5
  versionArgs: string[];
6
- fallbackModels: import("../types.js").RuntimeModelOption[];
6
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
7
7
  buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }: {
8
8
  prompt: string;
9
9
  imagePaths: string[];
@@ -39,7 +39,9 @@ export declare const cursorAgentDef: {
39
39
  context: import("../model-discovery-types.js").ModelDiscoveryContext;
40
40
  }, optionalArgs?: {
41
41
  signal?: AbortSignal;
42
- force?: boolean;
42
+ force
43
+ /** Approval flags: `--force` always, `--trust` only when this build's `--help` probe saw it. */
44
+ ?: boolean;
43
45
  staleWhileRevalidate?: boolean;
44
46
  deps?: import("../model-discovery-types.js").ModelDiscoveryDeps;
45
47
  }): Promise<import("../model-discovery-types.js").ModelCatalogSnapshot>;
@@ -1,11 +1,13 @@
1
1
  import { createAgentModelDiscovery } from '../model-discovery-native.js';
2
2
  import { DEFAULT_MODEL_OPTION } from './shared.js';
3
3
  import { agentCapabilities } from '../capabilities.js';
4
+ /** Agent id, binary name and event-parser key: one string for all three. */
5
+ const CURSOR_AGENT_ID = 'cursor-agent';
4
6
  /** One `<id>` or `<id> - <label>` listing line; header lines and non-id lines yield null. */
5
7
  function parseCursorAgentModelLine(line) {
6
8
  if (/^(available models|models)$/i.test(line))
7
9
  return null;
8
- const match = line.match(/^([A-Za-z0-9][A-Za-z0-9._/:@-]*)(?:\s+-\s+(.+))?$/);
10
+ const match = line.match(/^([A-Za-z0-9][A-Za-z0-9._/:@-]*)(?:\s+-\s+(\S.*))?$/);
9
11
  if (!match)
10
12
  return null;
11
13
  // The id group is mandatory and non-empty whenever the pattern matched.
@@ -48,7 +50,7 @@ function bypassArgs(options) {
48
50
  // withhold.
49
51
  if (options.permissionMode === 'restricted')
50
52
  return [];
51
- const caps = (options.capabilities ?? agentCapabilities.get('cursor-agent')) || {};
53
+ const caps = (options.capabilities ?? agentCapabilities.get(CURSOR_AGENT_ID)) || {};
52
54
  // `--trust` grants workspace trust in headless runs, but only newer
53
55
  // cursor-agent builds accept it; older ones exit 1 with "unknown option"
54
56
  // (issue #4461). Pass it only when the `--help` probe saw it.
@@ -56,10 +58,10 @@ function bypassArgs(options) {
56
58
  }
57
59
  export const cursorAgentDef = {
58
60
  // UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
59
- ...createAgentModelDiscovery('cursor-agent', { fallbackModels: () => cursorAgentDef.fallbackModels, args: ['models'], parse: parseCursorAgentListing }),
60
- id: 'cursor-agent',
61
+ ...createAgentModelDiscovery(CURSOR_AGENT_ID, { fallbackModels: () => cursorAgentDef.fallbackModels, args: ['models'], parse: parseCursorAgentListing }),
62
+ id: CURSOR_AGENT_ID,
61
63
  name: 'Cursor Agent',
62
- bin: 'cursor-agent',
64
+ bin: CURSOR_AGENT_ID,
63
65
  versionArgs: ['--version'],
64
66
  helpArgs: ['--help'],
65
67
  capabilityFlags: {
@@ -99,7 +101,7 @@ export const cursorAgentDef = {
99
101
  ],
100
102
  promptViaStdin: true,
101
103
  streamFormat: 'json-event-stream',
102
- eventParser: 'cursor-agent',
104
+ eventParser: CURSOR_AGENT_ID,
103
105
  // `cursor-agent status` is a cheap, side-effect-free auth check. Declaring
104
106
  // it here is what makes detection surface an "auth required" badge for
105
107
  // Cursor Agent (the generalized probe only runs for adapters that opt in).
@@ -4,7 +4,7 @@ export declare const deepseekAgentDef: {
4
4
  bin: string;
5
5
  fallbackBins: string[];
6
6
  versionArgs: string[];
7
- fallbackModels: import("../types.js").RuntimeModelOption[];
7
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
8
8
  buildArgs: ({ prompt, imagePaths: _imagePaths }: {
9
9
  prompt: string;
10
10
  imagePaths: string[];
@@ -5,11 +5,11 @@ export declare const devinAgentDef: {
5
5
  versionArgs: string[];
6
6
  fetchModels: ({ resolvedBin, env }: {
7
7
  resolvedBin: string;
8
- env: import("../types.js").RuntimeEnv;
8
+ env: import("../model-contracts.js").RuntimeEnv;
9
9
  }, { acpModelProbe }?: {
10
10
  acpModelProbe?: import("../types.js").AcpModelProbe;
11
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
- fallbackModels: import("../types.js").RuntimeModelOption[];
11
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
12
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
13
13
  buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }: {
14
14
  prompt: string;
15
15
  imagePaths: string[];
@@ -3,7 +3,7 @@ export declare const droidAgentDef: {
3
3
  name: string;
4
4
  bin: string;
5
5
  versionArgs: string[];
6
- fallbackModels: import("../types.js").RuntimeModelOption[];
6
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
7
7
  buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }: {
8
8
  prompt: string;
9
9
  imagePaths: string[];
@@ -5,11 +5,11 @@ export declare const gooseAgentDef: {
5
5
  versionArgs: string[];
6
6
  fetchModels: ({ resolvedBin, env }: {
7
7
  resolvedBin: string;
8
- env: import("../types.js").RuntimeEnv;
8
+ env: import("../model-contracts.js").RuntimeEnv;
9
9
  }, { acpModelProbe }?: {
10
10
  acpModelProbe?: import("../types.js").AcpModelProbe;
11
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
- fallbackModels: import("../types.js").RuntimeModelOption[];
11
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
12
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
13
13
  buildArgs: () => string[];
14
14
  streamFormat: string;
15
15
  externalMcpInjection: "acp-merge";
@@ -1,5 +1,7 @@
1
1
  import { createAgentModelDiscovery } from '../model-discovery-native.js';
2
2
  import { DEFAULT_MODEL_OPTION } from './shared.js';
3
+ /** Agent id, binary name and the routing-mode default model id. */
4
+ const GROK_BUILD_ID = 'grok-build';
3
5
  const GROK_MODEL_ID_RE = /^(?:[*•-]\s*|(?=grok-))([a-z0-9][a-z0-9./_:@\[\]-]*)(?:\s+\(default\))?\s*$/i;
4
6
  export function parseGrokBuildModels({ stdout }) {
5
7
  const seen = new Set();
@@ -10,12 +12,12 @@ export function parseGrokBuildModels({ stdout }) {
10
12
  if (!id || seen.has(id))
11
13
  continue;
12
14
  seen.add(id);
13
- out.push({ id, label: id, identityKind: /^(?:xai\/)?grok-/i.test(id) && id !== 'grok-build' ? 'concrete' : 'routing-mode' });
15
+ out.push({ id, label: id, identityKind: /^(?:xai\/)?grok-/i.test(id) && id !== GROK_BUILD_ID ? 'concrete' : 'routing-mode' });
14
16
  }
15
17
  return out;
16
18
  }
17
19
  function grokModelSupportsReasoningEffort(model) {
18
- if (!model || model === DEFAULT_MODEL_OPTION.id || model === 'grok-build')
20
+ if (!model || model === DEFAULT_MODEL_OPTION.id || model === GROK_BUILD_ID)
19
21
  return false;
20
22
  return /reasoning/i.test(model);
21
23
  }
@@ -41,8 +43,8 @@ function grokModelSupportsReasoningEffort(model) {
41
43
  // tool_use streaming). Upgrading to a `grok-stream-json` event parser is
42
44
  // follow-up work once the format is stable enough to lock in.
43
45
  export const grokBuildAgentDef = {
44
- ...createAgentModelDiscovery('grok-build', { fallbackModels: () => grokBuildAgentDef.fallbackModels, args: ['models'], parse: (input) => grokBuildAgentDef.listModels.parse(input) }),
45
- id: 'grok-build',
46
+ ...createAgentModelDiscovery(GROK_BUILD_ID, { fallbackModels: () => grokBuildAgentDef.fallbackModels, args: ['models'], parse: (input) => grokBuildAgentDef.listModels.parse(input) }),
47
+ id: GROK_BUILD_ID,
46
48
  name: 'Grok Build',
47
49
  bin: 'grok',
48
50
  versionArgs: ['--version'],
@@ -57,7 +59,7 @@ export const grokBuildAgentDef = {
57
59
  },
58
60
  fallbackModels: [
59
61
  DEFAULT_MODEL_OPTION,
60
- { id: 'grok-build', label: 'grok-build (xAI · default)' },
62
+ { id: GROK_BUILD_ID, label: 'grok-build (xAI · default)' },
61
63
  { id: 'grok-4.3', label: 'grok-4.3 (xAI)' },
62
64
  { id: 'grok-4.20-reasoning', label: 'grok-4.20-reasoning (xAI · deep)' },
63
65
  {
@@ -5,11 +5,11 @@ export declare const hermesAgentDef: {
5
5
  versionArgs: string[];
6
6
  fetchModels: ({ resolvedBin, env }: {
7
7
  resolvedBin: string;
8
- env: import("../types.js").RuntimeEnv;
8
+ env: import("../model-contracts.js").RuntimeEnv;
9
9
  }, { acpModelProbe }?: {
10
10
  acpModelProbe?: import("../types.js").AcpModelProbe;
11
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
- fallbackModels: import("../types.js").RuntimeModelOption[];
11
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
12
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
13
13
  buildArgs: () => string[];
14
14
  streamFormat: string;
15
15
  mcpDiscovery: string;
@@ -5,11 +5,11 @@ export declare const kiloAgentDef: {
5
5
  versionArgs: string[];
6
6
  fetchModels: ({ resolvedBin, env }: {
7
7
  resolvedBin: string;
8
- env: import("../types.js").RuntimeEnv;
8
+ env: import("../model-contracts.js").RuntimeEnv;
9
9
  }, { acpModelProbe }?: {
10
10
  acpModelProbe?: import("../types.js").AcpModelProbe;
11
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
- fallbackModels: import("../types.js").RuntimeModelOption[];
11
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
12
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
13
13
  buildArgs: () => string[];
14
14
  streamFormat: string;
15
15
  externalMcpInjection: "acp-merge";
@@ -3,13 +3,13 @@ export declare const kimiAgentDef: {
3
3
  name: string;
4
4
  bin: string;
5
5
  versionArgs: string[];
6
- fallbackModels: import("../types.js").RuntimeModelOption[];
6
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
7
7
  fetchModels: ({ resolvedBin, env }: {
8
8
  resolvedBin: string;
9
- env: import("../types.js").RuntimeEnv;
9
+ env: import("../model-contracts.js").RuntimeEnv;
10
10
  }, { acpModelProbe }?: {
11
11
  acpModelProbe?: import("../types.js").AcpModelProbe;
12
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
13
13
  buildArgs: () => string[];
14
14
  streamFormat: string;
15
15
  mcpDiscovery: string;
@@ -5,11 +5,11 @@ export declare const kiroAgentDef: {
5
5
  versionArgs: string[];
6
6
  fetchModels: ({ resolvedBin, env }: {
7
7
  resolvedBin: string;
8
- env: import("../types.js").RuntimeEnv;
8
+ env: import("../model-contracts.js").RuntimeEnv;
9
9
  }, { acpModelProbe }?: {
10
10
  acpModelProbe?: import("../types.js").AcpModelProbe;
11
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
- fallbackModels: import("../types.js").RuntimeModelOption[];
11
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
12
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
13
13
  buildArgs: () => string[];
14
14
  streamFormat: string;
15
15
  externalMcpInjection: "acp-merge";
@@ -3,7 +3,7 @@ export declare const mimoAgentDef: {
3
3
  name: string;
4
4
  bin: string;
5
5
  versionArgs: string[];
6
- fallbackModels: import("../types.js").RuntimeModelOption[];
6
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
7
7
  buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }: {
8
8
  prompt: string;
9
9
  imagePaths: string[];
@@ -15,7 +15,7 @@ export declare const opencodeAgentDef: {
15
15
  parse: typeof parseLineSeparatedModels;
16
16
  timeoutMs: number;
17
17
  };
18
- fallbackModels: import("../types.js").RuntimeModelOption[];
18
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
19
19
  fallbackModelsAssertedAt: string;
20
20
  buildArgs: (_requiredArgs: {
21
21
  prompt: string;
package/dist/defs/pi.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare const piAgentDef: {
7
7
  versionProbeTimeoutMs: number;
8
8
  fetchModels: ({ resolvedBin, env }: {
9
9
  resolvedBin: string;
10
- env: import("../types.js").RuntimeEnv;
10
+ env: import("../model-contracts.js").RuntimeEnv;
11
11
  }) => Promise<RuntimeModelOption[] | null>;
12
12
  fallbackModels: RuntimeModelOption[];
13
13
  fallbackModelsAssertedAt: string;
@@ -4,7 +4,7 @@ export declare const qoderAgentDef: {
4
4
  name: string;
5
5
  bin: string;
6
6
  versionArgs: string[];
7
- fallbackModels: import("../types.js").RuntimeModelOption[];
7
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
8
8
  buildArgs: ({ imagePaths }: {
9
9
  prompt: string;
10
10
  imagePaths: string[];
@@ -3,7 +3,7 @@ export declare const qwenAgentDef: {
3
3
  name: string;
4
4
  bin: string;
5
5
  versionArgs: string[];
6
- fallbackModels: import("../types.js").RuntimeModelOption[];
6
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
7
7
  buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }: {
8
8
  prompt: string;
9
9
  imagePaths: string[];
@@ -6,10 +6,10 @@ export declare const reasonixAgentDef: {
6
6
  versionArgs: string[];
7
7
  fetchModels: ({ resolvedBin, env }: {
8
8
  resolvedBin: string;
9
- env: import("../types.js").RuntimeEnv;
9
+ env: import("../model-contracts.js").RuntimeEnv;
10
10
  }, { acpModelProbe }?: {
11
11
  acpModelProbe?: import("../types.js").AcpModelProbe;
12
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
13
13
  buildArgs: () => string[];
14
14
  streamFormat: string;
15
15
  mcpDiscovery: string;
@@ -23,7 +23,7 @@ export declare const reasonixAgentDef: {
23
23
  strategy: "env-var";
24
24
  varName: string;
25
25
  };
26
- fallbackModels: import("../types.js").RuntimeModelOption[];
26
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
27
27
  installUrl: string;
28
28
  docsUrl: string;
29
29
  discoverModels(requiredArgs: {
@@ -6,11 +6,11 @@ export declare const traeCliAgentDef: {
6
6
  versionProbeTimeoutMs: number;
7
7
  fetchModels: ({ resolvedBin, env }: {
8
8
  resolvedBin: string;
9
- env: import("../types.js").RuntimeEnv;
9
+ env: import("../model-contracts.js").RuntimeEnv;
10
10
  }, { acpModelProbe }?: {
11
11
  acpModelProbe?: import("../types.js").AcpModelProbe;
12
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
13
- fallbackModels: import("../types.js").RuntimeModelOption[];
12
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
13
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
14
14
  buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }: {
15
15
  prompt: string;
16
16
  imagePaths: string[];
@@ -5,11 +5,11 @@ export declare const vibeAgentDef: {
5
5
  versionArgs: string[];
6
6
  fetchModels: ({ resolvedBin, env }: {
7
7
  resolvedBin: string;
8
- env: import("../types.js").RuntimeEnv;
8
+ env: import("../model-contracts.js").RuntimeEnv;
9
9
  }, { acpModelProbe }?: {
10
10
  acpModelProbe?: import("../types.js").AcpModelProbe;
11
- } | undefined) => Promise<import("../types.js").RuntimeModelOption[]>;
12
- fallbackModels: import("../types.js").RuntimeModelOption[];
11
+ } | undefined) => Promise<import("../model-contracts.js").RuntimeModelOption[]>;
12
+ fallbackModels: import("../model-contracts.js").RuntimeModelOption[];
13
13
  buildArgs: () => never[];
14
14
  streamFormat: string;
15
15
  externalMcpInjection: "acp-merge";
package/dist/detection.js CHANGED
@@ -25,6 +25,7 @@ import { spawnEnvForAgent } from './env.js';
25
25
  import { probeAgentAuthStatus } from './auth.js';
26
26
  import { noopAmrProfileResolver } from './amr-profile-resolver.js';
27
27
  import { buildAuthDiagnostic, buildExecutableDiagnostic, buildNotInvocableDiagnostic } from './diagnostics.js';
28
+ import { omitKeys } from './core/omit-keys.js';
28
29
  async function fetchModels({ def, resolvedBin, env, deps }, { context, version, force } = {}) {
29
30
  const scope = context ?? { executable: resolvedBin, env, cwd: process.cwd(), ...(version !== undefined ? { version } : {}) };
30
31
  const options = { deps, ...(force ? { force: true } : {}) };
@@ -305,8 +306,27 @@ function stripFns(def) {
305
306
  // matter extra because they carry closures — `JSON.stringify` would drop
306
307
  // the functions but keep their enclosing objects, publishing a misleading
307
308
  // `{"buffering":"until-close"}` / `{}` instead of omitting them.
308
- const { discoverModels: _discoverModels, resolveDefaultModel: _resolveDefaultModel, buildArgs: _buildArgs, listModels: _listModels, fetchModels: _fetchModels, deriveReasoningOptions: _deriveReasoningOptions, fallbackModels: _fallbackModels, fallbackModelsAssertedAt: _fallbackModelsAssertedAt, helpArgs: _helpArgs, capabilityFlags: _capabilityFlags, fallbackBins: _fallbackBins, versionProbeTimeoutMs: _versionProbeTimeoutMs, maxPromptArgBytes: _maxPromptArgBytes, env: _env, inactivityTimeoutMs: _inactivityTimeoutMs, authProbe: _authProbe, needsAgentLogFile: _needsAgentLogFile, stdoutPolicy: _stdoutPolicy, runtimeLock: _runtimeLock, ...rest } = def;
309
- return rest;
309
+ return omitKeys(def, [
310
+ 'discoverModels',
311
+ 'resolveDefaultModel',
312
+ 'buildArgs',
313
+ 'listModels',
314
+ 'fetchModels',
315
+ 'deriveReasoningOptions',
316
+ 'fallbackModels',
317
+ 'fallbackModelsAssertedAt',
318
+ 'helpArgs',
319
+ 'capabilityFlags',
320
+ 'fallbackBins',
321
+ 'versionProbeTimeoutMs',
322
+ 'maxPromptArgBytes',
323
+ 'env',
324
+ 'inactivityTimeoutMs',
325
+ 'authProbe',
326
+ 'needsAgentLogFile',
327
+ 'stdoutPolicy',
328
+ 'runtimeLock',
329
+ ]);
310
330
  }
311
331
  /** Cache executable/version/help/auth per host and effective launch; only expired catalogs refresh.
312
332
  * Explicit force queues after the current scan, so a rescan cannot overlap its predecessor.
@@ -1,8 +1,7 @@
1
1
  type StreamEvent = Record<string, unknown>;
2
2
  type StreamEventHandler = (event: StreamEvent) => void;
3
- type ParserKind = string;
4
3
  export declare function createJsonEventStreamHandler({ kind, onEvent }: {
5
- kind: ParserKind;
4
+ kind: string;
6
5
  onEvent: StreamEventHandler;
7
6
  }): {
8
7
  feed: ({ chunk }: {
@@ -1,6 +1,7 @@
1
1
  /** @module json-event-stream
2
2
  * Multi-CLI JSON event parsing with per-handler stream state. */
3
3
  import { sanitizeUntrustedText } from '@jini-ai/core/text';
4
+ import { handleAntigravityEvent } from './defs/antigravity-event-stream.js';
4
5
  function isRecord(value) {
5
6
  return value != null && typeof value === 'object' && !Array.isArray(value);
6
7
  }
@@ -418,7 +419,7 @@ function normalizeTodoStatus(value) {
418
419
  const rule = TODO_STATUS_RULES.find((candidate) => candidate.exact.includes(status) || candidate.prefixes.some((prefix) => status.startsWith(prefix)));
419
420
  return rule ? rule.status : 'pending';
420
421
  }
421
- /** Todo text fields in precedence order; the first string-typed one wins, even when empty. */
422
+ /** Text fields of a to-do item in precedence order; the first string-typed one wins, even when empty. */
422
423
  const TODO_CONTENT_FIELDS = ['content', 'label', 'description', 'text'];
423
424
  function todoFromItem(raw) {
424
425
  if (!isRecord(raw))
@@ -519,11 +520,7 @@ function flushPendingArtifactText(state, onEvent) {
519
520
  function isFileWriteToolUse(toolName, input) {
520
521
  if (!isRecord(input))
521
522
  return false;
522
- const path = typeof input.file_path === 'string'
523
- ? input.file_path
524
- : typeof input.path === 'string'
525
- ? input.path
526
- : '';
523
+ const path = [input.file_path, input.path].find((value) => typeof value === 'string') ?? '';
527
524
  const writesFile = toolName === 'write_file' ||
528
525
  toolName === 'write' ||
529
526
  toolName === 'replace' ||
@@ -663,13 +660,15 @@ function handleCodexItemUpdated(item, onEvent, state) {
663
660
  function completeCodexFileChange(item, onEvent, state) {
664
661
  // Codex reports direct patches as file_change, rather than command_execution. Surface paths
665
662
  // through the SAME native-tool event channel so audit sees edits without persisting patches.
666
- if (!claimCodexToolUse(state, item.id))
667
- return true;
663
+ if (claimCodexToolUse(state, item.id))
664
+ emitCodexFileChange(item, onEvent);
665
+ return true;
666
+ }
667
+ function emitCodexFileChange(item, onEvent) {
668
668
  const changes = Array.isArray(item.changes) ? item.changes : [];
669
669
  onEvent({ type: 'tool_use', id: item.id, name: 'apply_patch',
670
670
  input: { paths: changes.filter(isRecord).map(change => change.path).filter(path => typeof path === 'string') } });
671
671
  onEvent({ type: 'tool_result', toolUseId: item.id, content: 'File change reported by Codex.', isError: item.status === 'failed' });
672
- return true;
673
672
  }
674
673
  function completeCodexCommand(item, onEvent, state) {
675
674
  resetCodexAgentMessageBoundary(state);
@@ -938,6 +937,7 @@ function emitModelReceipts(obj, onEvent) {
938
937
  }
939
938
  }
940
939
  const PARSERS_BY_KIND = new Map([
940
+ ['antigravity', (frame, emit, state) => handleAntigravityEvent({ frame, emit, state: state.antigravity })],
941
941
  ['opencode', handleOpenCodeEvent],
942
942
  ['legacy-google-stream-json', handleLegacyGoogleStreamEvent],
943
943
  ['kimi', handleKimiEvent],
@@ -947,6 +947,7 @@ const PARSERS_BY_KIND = new Map([
947
947
  export function createJsonEventStreamHandler({ kind, onEvent }) {
948
948
  let buffer = '';
949
949
  const state = {
950
+ antigravity: { textEmitted: false, toolUses: new Set(), toolResults: new Set() },
950
951
  cursorTextSoFar: '',
951
952
  cursorTurnStart: 0,
952
953
  openCodeToolUses: new Set(),