@jini-ai/agent-runtime 0.6.15-rc.1 → 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 +38 -47
  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 +19 -45
  98. package/dist/types.d.ts +8 -27
  99. package/package.json +14 -8
@@ -0,0 +1,83 @@
1
+ function record(value) {
2
+ return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {};
3
+ }
4
+ /** Native edits record paths, never patches or complete document contents. */
5
+ function nativeTool({ name, parameters }, _options = {}) {
6
+ if (name === 'run_command')
7
+ return { name: 'Bash', input: { command: parameters.CommandLine } };
8
+ if (name === 'write_to_file')
9
+ return { name: 'Write', input: { file_path: parameters.TargetFile } };
10
+ if (name === 'replace_file_content' || name === 'multi_replace_file_content') {
11
+ return { name: 'Edit', input: { file_path: parameters.TargetFile } };
12
+ }
13
+ return { name, input: parameters };
14
+ }
15
+ /** ACTIVE and DONE can describe the same call; a DONE-only receipt must also be audited. */
16
+ function toolStep({ step, emit, state }, _options = {}) {
17
+ if (typeof step.conversation_id !== 'string' || typeof step.step_index !== 'number')
18
+ return;
19
+ const info = record(step.tool_info);
20
+ const name = info.name ?? step.tool_name;
21
+ if (typeof name !== 'string')
22
+ return;
23
+ // A tool-name-only ACTIVE frame cannot supply the command/path yet; wait for its receipt.
24
+ if (info.parameters === undefined && step.state !== 'DONE')
25
+ return;
26
+ const id = `${step.conversation_id}:${step.step_index}`;
27
+ if (!state.toolUses.has(id)) {
28
+ state.toolUses.add(id);
29
+ emit({ type: 'tool_use', id, ...nativeTool({ name, parameters: record(info.parameters) }) });
30
+ }
31
+ toolResult({ step, info, id, emit, state });
32
+ }
33
+ function toolResult({ step, info, id, emit, state }, _options = {}) {
34
+ if (step.state !== 'DONE' || state.toolResults.has(id))
35
+ return;
36
+ state.toolResults.add(id);
37
+ const error = record(info.error);
38
+ const content = typeof error.message === 'string' ? error.message : info.output;
39
+ emit({ type: 'tool_result', toolUseId: id, content: typeof content === 'string' ? content : '',
40
+ isError: info.error !== undefined && info.error !== null });
41
+ }
42
+ function responseText({ text, emit, state }, _options = {}) {
43
+ if (typeof text !== 'string' || text.length === 0)
44
+ return;
45
+ state.textEmitted = true;
46
+ emit({ type: 'text_delta', delta: text });
47
+ }
48
+ /** The terminal response repeats streamed deltas. Errors must survive even on exit zero. */
49
+ function terminalResult({ result, emit, state }, _options = {}) {
50
+ if (!state.textEmitted)
51
+ responseText({ text: result.response, emit, state });
52
+ if (result.status !== 'SUCCESS') {
53
+ emit({ type: 'error', message: typeof result.error === 'string' ? result.error : 'Antigravity did not complete the turn.' });
54
+ }
55
+ if (result.usage !== undefined) {
56
+ const usage = record(result.usage);
57
+ emit({ type: 'usage', usage: { input_tokens: usage.input_tokens, output_tokens: usage.output_tokens,
58
+ thought_tokens: usage.thinking_tokens, cached_read_tokens: usage.cache_read_tokens } });
59
+ }
60
+ }
61
+ /** Translate real tool receipts through the shared tool_use/tool_result audit channel.
62
+ * Pure except for the caller-owned parser state and event sink. O(1) per frame.
63
+ */
64
+ export function handleAntigravityEvent({ frame, emit, state }, _options = {}) {
65
+ const obj = record(frame);
66
+ if (obj.event === 'init') {
67
+ emit({ type: 'status', label: 'initializing', model: record(obj.init).model });
68
+ return true;
69
+ }
70
+ if (obj.event === 'result') {
71
+ terminalResult({ result: record(obj.result), emit, state });
72
+ return true;
73
+ }
74
+ if (obj.event !== 'step_update')
75
+ return false;
76
+ const step = record(obj.step_update);
77
+ if (step.step_type === 'agent_response')
78
+ responseText({ text: step.text_delta, emit, state });
79
+ if (step.step_type === 'tool')
80
+ toolStep({ step, emit, state });
81
+ return true;
82
+ }
83
+ //# sourceMappingURL=antigravity-event-stream.js.map
@@ -66,7 +66,11 @@ export declare const antigravityAgentDef: {
66
66
  runtimeContext?: RuntimeContext;
67
67
  } | undefined) => string[];
68
68
  maxPromptArgBytes: number;
69
+ fullCliAccessOnly: true;
70
+ fullCliAccessNote: string;
69
71
  streamFormat: string;
72
+ eventParser: string;
73
+ supportsNativeToolAccess: false;
70
74
  needsAgentLogFile: true;
71
75
  stdoutPolicy: {
72
76
  buffering: "until-close";
@@ -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";