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

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 (119) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/agent-protocol/acp/rpc.js +4 -8
  3. package/dist/agent-protocol/acp/session.js +33 -37
  4. package/dist/agent-protocol/acp/text-suppression.js +10 -7
  5. package/dist/agent-protocol/acp/updates.js +4 -5
  6. package/dist/agent-protocol/core/json-line-stream.d.ts +6 -3
  7. package/dist/agent-protocol/core/json-line-stream.js +9 -10
  8. package/dist/agent-protocol/pi-rpc/events.js +27 -27
  9. package/dist/agent-protocol/pi-rpc/models.js +13 -11
  10. package/dist/agent-protocol/pi-rpc/session.js +7 -7
  11. package/dist/ai-trace/classify.js +4 -1
  12. package/dist/ai-trace/recorder.d.ts +2 -3
  13. package/dist/ai-trace/recorder.js +2 -3
  14. package/dist/ai-trace/sinks.js +19 -3
  15. package/dist/ai-trace/usage.js +3 -1
  16. package/dist/anthropic-live-models.js +0 -0
  17. package/dist/auth.js +20 -17
  18. package/dist/claude-code-models.js +29 -17
  19. package/dist/claude-filesystem-policy.d.ts +4 -3
  20. package/dist/claude-filesystem-policy.js +39 -12
  21. package/dist/claude-stream.js +65 -47
  22. package/dist/core/model-discovery-shared.js +4 -2
  23. package/dist/core/omit-keys.d.ts +7 -0
  24. package/dist/core/omit-keys.js +12 -0
  25. package/dist/defs/aider.d.ts +1 -1
  26. package/dist/defs/amp.d.ts +1 -1
  27. package/dist/defs/amp.js +2 -2
  28. package/dist/defs/amr.js +5 -9
  29. package/dist/defs/antigravity-event-stream.d.ts +19 -0
  30. package/dist/defs/antigravity-event-stream.js +83 -0
  31. package/dist/defs/antigravity.d.ts +4 -0
  32. package/dist/defs/antigravity.js +27 -15
  33. package/dist/defs/auggie.d.ts +3 -3
  34. package/dist/defs/claude.d.ts +3 -3
  35. package/dist/defs/cline.d.ts +3 -3
  36. package/dist/defs/codebuddy.d.ts +1 -1
  37. package/dist/defs/codex.js +3 -2
  38. package/dist/defs/crush.d.ts +1 -1
  39. package/dist/defs/cursor-agent.d.ts +3 -1
  40. package/dist/defs/cursor-agent.js +8 -6
  41. package/dist/defs/deepseek.d.ts +1 -1
  42. package/dist/defs/devin.d.ts +3 -3
  43. package/dist/defs/droid.d.ts +1 -1
  44. package/dist/defs/goose.d.ts +3 -3
  45. package/dist/defs/grok-build.js +7 -5
  46. package/dist/defs/hermes.d.ts +3 -3
  47. package/dist/defs/index.d.ts +0 -1
  48. package/dist/defs/index.js +0 -1
  49. package/dist/defs/kilo.d.ts +3 -3
  50. package/dist/defs/kimi.d.ts +3 -3
  51. package/dist/defs/kiro.d.ts +3 -3
  52. package/dist/defs/mimo.d.ts +1 -1
  53. package/dist/defs/opencode.d.ts +1 -1
  54. package/dist/defs/pi.d.ts +1 -1
  55. package/dist/defs/qoder.d.ts +1 -1
  56. package/dist/defs/qwen.d.ts +1 -1
  57. package/dist/defs/reasonix.d.ts +3 -3
  58. package/dist/defs/trae-cli.d.ts +3 -3
  59. package/dist/defs/vibe.d.ts +3 -3
  60. package/dist/detection.js +22 -2
  61. package/dist/executables.js +0 -1
  62. package/dist/index.d.ts +0 -1
  63. package/dist/index.js +0 -1
  64. package/dist/json-event-stream.d.ts +1 -2
  65. package/dist/json-event-stream.js +10 -9
  66. package/dist/launch.js +2 -1
  67. package/dist/metadata.js +0 -4
  68. package/dist/model-catalog-cache.js +6 -4
  69. package/dist/model-contracts.d.ts +29 -0
  70. package/dist/model-contracts.js +2 -0
  71. package/dist/model-discovery-adapters.js +47 -24
  72. package/dist/model-discovery-config.js +8 -5
  73. package/dist/model-discovery-sdk.d.ts +0 -29
  74. package/dist/model-discovery-sdk.js +0 -32
  75. package/dist/model-discovery-types.d.ts +3 -3
  76. package/dist/model-discovery-yaml.d.ts +9 -0
  77. package/dist/model-discovery-yaml.js +98 -0
  78. package/dist/model-discovery.js +10 -3
  79. package/dist/model-registry.js +2 -1
  80. package/dist/native-tool-policy.d.ts +28 -0
  81. package/dist/native-tool-policy.js +42 -0
  82. package/dist/opencode-log.js +13 -10
  83. package/dist/pi-models.js +13 -11
  84. package/dist/probe-scheduler.js +13 -5
  85. package/dist/providers/aihubmix.js +6 -7
  86. package/dist/providers/anthropic-messages.d.ts +7 -4
  87. package/dist/providers/anthropic-messages.js +22 -24
  88. package/dist/providers/azure-chat.d.ts +1 -1
  89. package/dist/providers/azure-chat.js +7 -10
  90. package/dist/providers/connection-guard.js +2 -1
  91. package/dist/providers/connection-test.js +16 -10
  92. package/dist/providers/google-messages.d.ts +1 -1
  93. package/dist/providers/google-messages.js +33 -35
  94. package/dist/providers/google.js +3 -4
  95. package/dist/providers/model-catalog.js +10 -7
  96. package/dist/providers/ollama-chat.d.ts +0 -8
  97. package/dist/providers/ollama-chat.js +17 -19
  98. package/dist/providers/openai-chat.d.ts +6 -3
  99. package/dist/providers/openai-chat.js +24 -22
  100. package/dist/providers/operation-schema.d.ts +2 -3
  101. package/dist/providers/operation-schema.js +25 -22
  102. package/dist/providers/provider-tool-policy.d.ts +13 -0
  103. package/dist/providers/provider-tool-policy.js +2 -0
  104. package/dist/providers/tool-loop-verdict.d.ts +22 -0
  105. package/dist/providers/tool-loop-verdict.js +17 -0
  106. package/dist/providers/tool-turn-types.d.ts +2 -12
  107. package/dist/providers/tool-turn.js +7 -2
  108. package/dist/registry.d.ts +1 -1
  109. package/dist/registry.js +2 -3
  110. package/dist/resolution.d.ts +21 -0
  111. package/dist/resolution.js +22 -1
  112. package/dist/role-marker-guard.d.ts +1 -1
  113. package/dist/role-marker-guard.js +1 -1
  114. package/dist/types.d.ts +8 -27
  115. package/package.json +14 -22
  116. package/dist/copilot-stream.d.ts +0 -65
  117. package/dist/copilot-stream.js +0 -123
  118. package/dist/defs/copilot.d.ts +0 -34
  119. package/dist/defs/copilot.js +0 -96
@@ -1,9 +1,30 @@
1
1
  /**
2
2
  * @module resolution
3
- * Resolve an agent's absolute executable path from the current PATH and registry.
3
+ * Resolve saved agent selections and absolute executable paths against the registry.
4
4
  */
5
5
  import { getAgentDef } from './registry.js';
6
6
  import { resolveAgentExecutable } from './executables.js';
7
+ /** Resolve a saved selection against the host's registry; retired ids use its default.
8
+ * `onFallback` reports the first stale selection once per resolver, keeping repeated turns quiet
9
+ * without retaining an unbounded collection of caller-supplied ids. Missing selections are silent.
10
+ * Registry lookup failures propagate; executable availability remains the launcher's responsibility.
11
+ * @complexity O(registry lookup) time per selection, O(1) retained space.
12
+ */
13
+ export function createAgentSelectionResolver({ defaultAgentId, onFallback }, { getDef = getAgentDef } = {}) {
14
+ let warned = false;
15
+ return ({ agentId }, _options = {}) => {
16
+ if (agentId === undefined)
17
+ return defaultAgentId;
18
+ if (getDef({ id: agentId }))
19
+ return agentId;
20
+ // Saved preferences outlive adapters: recover before session or launch state is keyed by id.
21
+ if (!warned) {
22
+ warned = true;
23
+ onFallback({ agentId, defaultAgentId });
24
+ }
25
+ return defaultAgentId;
26
+ };
27
+ }
7
28
  // Used by the chat handler so spawn() gets the same executable that
8
29
  // detection reported as available — fixes Windows ENOENT when the bare
9
30
  // bin name isn't on the child process's PATH.
@@ -6,7 +6,7 @@
6
6
  * own output (see #3247 — same class as #2102 / #2464).
7
7
  *
8
8
  * `createRoleMarkerGuard()` — stateful per-message guard for structured
9
- * stream handlers that can track message boundaries (Claude, Copilot,
9
+ * stream handlers that can track message boundaries (Claude,
10
10
  * Qoder, OpenCode/Codex, Pi, ACP). Returns `{ feedText, contaminated,
11
11
  * warningEvent }`.
12
12
  */
@@ -6,7 +6,7 @@
6
6
  * own output (see #3247 — same class as #2102 / #2464).
7
7
  *
8
8
  * `createRoleMarkerGuard()` — stateful per-message guard for structured
9
- * stream handlers that can track message boundaries (Claude, Copilot,
9
+ * stream handlers that can track message boundaries (Claude,
10
10
  * Qoder, OpenCode/Codex, Pi, ACP). Returns `{ feedText, contaminated,
11
11
  * warningEvent }`.
12
12
  */
package/dist/types.d.ts CHANGED
@@ -11,35 +11,12 @@
11
11
  * Ported from OD's `apps/daemon/src/runtimes/types.ts`. Product-neutral
12
12
  * as found — see `archived provenance ledger` for the full provenance table.
13
13
  */
14
- import type { AgentModelDiscoveryPort, ModelCatalogSnapshot, DefaultModelResolution, ModelIdentityKind } from './model-discovery-types.js';
14
+ import type { AgentModelDiscoveryPort, ModelCatalogSnapshot, DefaultModelResolution } from './model-discovery-types.js';
15
15
  import type { ExecFileOptions } from 'node:child_process';
16
16
  import type { AgentDiagnostic } from '@jini-ai/protocol';
17
- export type RuntimeEnv = NodeJS.ProcessEnv | Record<string, string>;
18
- export type RuntimeModelOption = {
19
- id: string;
20
- label: string;
21
- identityKind?: ModelIdentityKind;
22
- resolvedId?: string;
23
- /**
24
- * The reasoning-effort levels THIS model supports, when the runtime's own catalog reports them
25
- * per model rather than per agent.
26
- *
27
- * Present only where a live source actually carries the data — Codex's `debug models` catalog
28
- * does (`supported_reasoning_levels`), and the levels genuinely differ between models on the same
29
- * CLI: verified live against codex-cli 0.153.4, where `gpt-6-astra` offers
30
- * low/medium/high/xhigh/max/ultra while `gpt-5.5` stops at `xhigh`. A single agent-level
31
- * `RuntimeAgentDef.reasoningOptions` list cannot be correct for both, which is why this is a
32
- * property of the model row rather than of the def.
33
- *
34
- * Consumed by `RuntimeAgentDef.deriveReasoningOptions` to compute the agent-level list a picker
35
- * renders. Left `undefined` by every runtime whose effort vocabulary really is uniform, and by
36
- * every static fallback list — an absent value means "nothing catalog-specific to say", never
37
- * "this model supports no effort levels".
38
- */
39
- reasoning?: readonly RuntimeReasoningOption[];
40
- };
17
+ import type { RuntimeEnv, RuntimeModelOption, RuntimeReasoningOption } from './model-contracts.js';
18
+ export type { RuntimeEnv, RuntimeModelOption, RuntimeReasoningOption } from './model-contracts.js';
41
19
  export type RuntimeModelSource = 'live' | 'fallback';
42
- export type RuntimeReasoningOption = RuntimeModelOption;
43
20
  /**
44
21
  * Declares that a runtime carries its reasoning-effort choice INSIDE the model
45
22
  * id — as a trailing `-<level>` on the slug — rather than in a flag of its own.
@@ -169,7 +146,7 @@ export type RuntimePromptBudgetError = {
169
146
  limit: number;
170
147
  };
171
148
  /**
172
- * How the caller should treat a `streamFormat: 'plain'` adapter's raw stdout.
149
+ * How the caller should treat an adapter's raw stdout before text forwarding or structured parsing.
173
150
  *
174
151
  * Declared as a discriminated union rather than two independent flags
175
152
  * (`stdoutBuffering` + `sanitizeStdout`) on purpose: a sanitizer is only
@@ -295,6 +272,10 @@ export type RuntimeAgentDef = Partial<AgentModelDiscoveryPort> & {
295
272
  /** This adapter enforces nativeToolAccess and emits normalized shell/edit tool_use events.
296
273
  * A host requesting the policy must fail closed when this capability is absent. */
297
274
  supportsNativeToolAccess?: boolean;
275
+ /** Native tools cannot be limited per run; always use full access for authorized assistant users. */
276
+ fullCliAccessOnly?: boolean;
277
+ /** Translation key explaining this runtime’s full-access requirement to the user. */
278
+ fullCliAccessNote?: string;
298
279
  /** The CLI ships a native subagent tool (e.g. Claude Code's Task/Agent) a run can delegate to.
299
280
  * Declarative only: hosts read it through `runtimeSupportsSubagents`, never by model name.
300
281
  * Absent = no native subagents. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/agent-runtime",
3
- "version": "0.6.15-rc.2",
3
+ "version": "0.6.16",
4
4
  "description": "Coding-agent runtime adapters: runtime registry, detection, launch, stream parsers, and the ACP/pi-rpc subprocess transport.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -19,6 +19,7 @@
19
19
  "./providers/sse-decode": "universal",
20
20
  "./model-discovery": "node",
21
21
  "./model-selection": "universal",
22
+ "./native-tool-policy": "universal",
22
23
  "./ai-trace": "universal"
23
24
  },
24
25
  "isolation": {
@@ -40,6 +41,11 @@
40
41
  "main": "./dist/index.js",
41
42
  "types": "./dist/index.d.ts",
42
43
  "exports": {
44
+ "./native-tool-policy": {
45
+ "types": "./dist/native-tool-policy.d.ts",
46
+ "import": "./dist/native-tool-policy.js",
47
+ "default": "./dist/native-tool-policy.js"
48
+ },
43
49
  ".": {
44
50
  "types": "./dist/index.d.ts",
45
51
  "import": "./dist/index.js",
@@ -114,29 +120,15 @@
114
120
  "devDependencies": {
115
121
  "@vitest/coverage-v8": "^2.1.9",
116
122
  "@jini-ai/core": "^0.6.13",
117
- "@jini-ai/integrations": "^0.6.15-rc.2",
118
- "@jini-ai/platform": "^0.6.15-rc.2"
123
+ "@jini-ai/integrations": "^0.6.16",
124
+ "@jini-ai/platform": "^0.6.16"
119
125
  },
120
126
  "dependencies": {
121
- "@jini-ai/core": "^0.6.15-rc.2",
122
- "@jini-ai/protocol": "^0.6.15-rc.2",
123
- "@jini-ai/oauth": "^0.6.15-rc.2"
124
- },
125
- "peerDependencies": {
126
- "@jini-ai/integrations": "^0.6.15-rc.2",
127
- "@github/copilot-sdk": "*",
128
- "@jini-ai/platform": "^0.6.15-rc.2"
129
- },
130
- "peerDependenciesMeta": {
131
- "@jini-ai/integrations": {
132
- "optional": true
133
- },
134
- "@github/copilot-sdk": {
135
- "optional": true
136
- },
137
- "@jini-ai/platform": {
138
- "optional": true
139
- }
127
+ "@jini-ai/core": "^0.6.16",
128
+ "@jini-ai/oauth": "^0.6.16",
129
+ "@jini-ai/integrations": "^0.6.16",
130
+ "@jini-ai/platform": "^0.6.16",
131
+ "@jini-ai/protocol": "^0.6.16"
140
132
  },
141
133
  "scripts": {
142
134
  "build": "tsc -p tsconfig.json",
@@ -1,65 +0,0 @@
1
- /**
2
- * @module copilot-stream
3
- *
4
- * Parses GitHub Copilot CLI's `--output-format json` JSONL stream into the
5
- * same UI-friendly events that claude-stream.js emits, so the chat panel
6
- * can render Copilot's thinking / tool calls / text the same way it does
7
- * Claude Code's.
8
- *
9
- * Copilot's schema uses dotted top-level types (`assistant.*`, `tool.*`,
10
- * `session.*`, `user.*`, `result`) with the payload under `data`. The
11
- * `ephemeral: true` events (session.mcp_*, reasoning_delta, etc.) are still
12
- * useful — they carry the streaming deltas — but events we don't have a UI
13
- * lane for (mcp_server_status, skills_loaded, full reasoning recap, turn
14
- * boundaries) are dropped on the floor.
15
- *
16
- * Mapping:
17
- * session.tools_updated -> status (initializing, with model name)
18
- * assistant.turn_start -> status (streaming)
19
- * assistant.reasoning_delta -> thinking_delta
20
- * assistant.message_delta -> text_delta
21
- * tool.execution_start -> tool_use
22
- * tool.execution_complete -> tool_result
23
- * result -> usage
24
- */
25
- /** Every event `createCopilotStreamHandler` can emit, discriminated on `type` — see `claude-stream.ts`'s `ClaudeStreamEvent` doc for why this is exported rather than left as `Record<string, unknown>`. */
26
- export type CopilotStreamEvent = {
27
- type: 'raw';
28
- line: string;
29
- } | {
30
- type: 'status';
31
- label: 'initializing';
32
- model: unknown;
33
- } | {
34
- type: 'status';
35
- label: 'streaming';
36
- } | {
37
- type: 'thinking_delta' | 'text_delta';
38
- delta: string;
39
- } | {
40
- type: 'tool_use';
41
- id: unknown;
42
- name: unknown;
43
- input: unknown;
44
- } | {
45
- type: 'tool_result';
46
- toolUseId: unknown;
47
- content: string;
48
- isError: boolean;
49
- } | {
50
- type: 'usage';
51
- usage: unknown;
52
- stopReason: 'completed' | 'error';
53
- durationMs: unknown;
54
- };
55
- type EventSink = (event: CopilotStreamEvent) => void;
56
- export declare function createCopilotStreamHandler({ onEvent }: {
57
- onEvent: EventSink;
58
- }): {
59
- feed: ({ chunk }: {
60
- chunk: string;
61
- }) => void;
62
- flush: () => void;
63
- };
64
- export {};
65
- //# sourceMappingURL=copilot-stream.d.ts.map
@@ -1,123 +0,0 @@
1
- /**
2
- * @module copilot-stream
3
- *
4
- * Parses GitHub Copilot CLI's `--output-format json` JSONL stream into the
5
- * same UI-friendly events that claude-stream.js emits, so the chat panel
6
- * can render Copilot's thinking / tool calls / text the same way it does
7
- * Claude Code's.
8
- *
9
- * Copilot's schema uses dotted top-level types (`assistant.*`, `tool.*`,
10
- * `session.*`, `user.*`, `result`) with the payload under `data`. The
11
- * `ephemeral: true` events (session.mcp_*, reasoning_delta, etc.) are still
12
- * useful — they carry the streaming deltas — but events we don't have a UI
13
- * lane for (mcp_server_status, skills_loaded, full reasoning recap, turn
14
- * boundaries) are dropped on the floor.
15
- *
16
- * Mapping:
17
- * session.tools_updated -> status (initializing, with model name)
18
- * assistant.turn_start -> status (streaming)
19
- * assistant.reasoning_delta -> thinking_delta
20
- * assistant.message_delta -> text_delta
21
- * tool.execution_start -> tool_use
22
- * tool.execution_complete -> tool_result
23
- * result -> usage
24
- */
25
- function isRecord(value) {
26
- return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
27
- }
28
- export function createCopilotStreamHandler({ onEvent }) {
29
- let buffer = '';
30
- function feed({ chunk }) {
31
- buffer += chunk;
32
- let nl;
33
- while ((nl = buffer.indexOf('\n')) !== -1) {
34
- const line = buffer.slice(0, nl).trim();
35
- buffer = buffer.slice(nl + 1);
36
- if (!line)
37
- continue;
38
- let obj;
39
- try {
40
- obj = JSON.parse(line);
41
- }
42
- catch {
43
- onEvent({ type: 'raw', line });
44
- continue;
45
- }
46
- handleObject(obj);
47
- }
48
- }
49
- function flush() {
50
- const rem = buffer.trim();
51
- buffer = '';
52
- if (!rem)
53
- return;
54
- try {
55
- handleObject(JSON.parse(rem));
56
- }
57
- catch {
58
- onEvent({ type: 'raw', line: rem });
59
- }
60
- }
61
- function handleObject(obj) {
62
- if (!isRecord(obj) || typeof obj.type !== 'string')
63
- return;
64
- const data = isRecord(obj.data) ? obj.data : {};
65
- // Event types we have no UI lane for are dropped on the floor.
66
- COPILOT_EVENT_HANDLERS.get(obj.type)?.({ obj, data, onEvent });
67
- }
68
- return { feed, flush };
69
- }
70
- function emitDelta(type) {
71
- return ({ data, onEvent }) => {
72
- if (typeof data.deltaContent === 'string') {
73
- onEvent({ type, delta: data.deltaContent });
74
- }
75
- };
76
- }
77
- // Map (not an object literal) so a prototype-named `type` can never resolve to a handler.
78
- const COPILOT_EVENT_HANDLERS = new Map([
79
- ['session.tools_updated', ({ data, onEvent }) => {
80
- if (data.model) {
81
- onEvent({ type: 'status', label: 'initializing', model: data.model });
82
- }
83
- }],
84
- ['assistant.turn_start', ({ onEvent }) => onEvent({ type: 'status', label: 'streaming' })],
85
- ['assistant.reasoning_delta', emitDelta('thinking_delta')],
86
- ['assistant.message_delta', emitDelta('text_delta')],
87
- ['tool.execution_start', ({ data, onEvent }) => onEvent({
88
- type: 'tool_use',
89
- id: data.toolCallId ?? null,
90
- name: data.toolName ?? null,
91
- input: data.arguments ?? null,
92
- })],
93
- ['tool.execution_complete', ({ data, onEvent }) => onEvent({
94
- type: 'tool_result',
95
- toolUseId: data.toolCallId ?? null,
96
- content: stringifyResult(data.result),
97
- isError: data.success === false,
98
- })],
99
- // `result` puts usage / exitCode at the top level, not under `data`.
100
- // Treat a missing exitCode as success when `success: true` is set —
101
- // strict `=== 0` would otherwise mis-flag turns where Copilot emits
102
- // usage without a numeric exit code as `error`.
103
- ['result', ({ obj, onEvent }) => onEvent({
104
- type: 'usage',
105
- usage: obj.usage ?? null,
106
- stopReason: obj.success === true || obj.exitCode === 0 ? 'completed' : 'error',
107
- durationMs: isRecord(obj.usage) ? obj.usage.sessionDurationMs ?? null : null,
108
- })],
109
- ]);
110
- function stringifyResult(r) {
111
- if (r == null)
112
- return '';
113
- if (typeof r === 'string')
114
- return r;
115
- if (!isRecord(r))
116
- return JSON.stringify(r);
117
- if (typeof r.content === 'string')
118
- return r.content;
119
- if (typeof r.detailedContent === 'string')
120
- return r.detailedContent;
121
- return JSON.stringify(r);
122
- }
123
- //# sourceMappingURL=copilot-stream.js.map
@@ -1,34 +0,0 @@
1
- export declare const copilotAgentDef: {
2
- id: string;
3
- name: string;
4
- bin: string;
5
- versionArgs: string[];
6
- fallbackModels: import("../types.js").RuntimeModelOption[];
7
- buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }: {
8
- prompt: string;
9
- imagePaths: string[];
10
- }, { extraAllowedDirs, options }?: {
11
- extraAllowedDirs?: string[];
12
- options?: import("../types.js").RuntimeBuildOptions;
13
- runtimeContext?: import("../types.js").RuntimeContext;
14
- } | undefined) => string[];
15
- promptViaStdin: true;
16
- streamFormat: string;
17
- inactivityTimeoutMs: number;
18
- discoverModels(requiredArgs: {
19
- context: import("../model-discovery-types.js").ModelDiscoveryContext;
20
- }, optionalArgs?: {
21
- signal?: AbortSignal;
22
- force?: boolean;
23
- staleWhileRevalidate?: boolean;
24
- deps?: import("../model-discovery-types.js").ModelDiscoveryDeps;
25
- }): Promise<import("../model-discovery-types.js").ModelCatalogSnapshot>;
26
- resolveDefaultModel(requiredArgs: {
27
- context: import("../model-discovery-types.js").ModelDiscoveryContext;
28
- catalog: import("../model-discovery-types.js").ModelCatalogSnapshot;
29
- }, optionalArgs?: {
30
- signal?: AbortSignal;
31
- deps?: import("../model-discovery-types.js").ModelDiscoveryDeps;
32
- }): Promise<import("../model-discovery-types.js").DefaultModelResolution>;
33
- };
34
- //# sourceMappingURL=copilot.d.ts.map
@@ -1,96 +0,0 @@
1
- import { createAgentModelDiscovery } from '../model-discovery-native.js';
2
- import { DEFAULT_MODEL_OPTION } from './shared.js';
3
- export const copilotAgentDef = {
4
- // UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
5
- ...createAgentModelDiscovery('copilot', { fallbackModels: () => copilotAgentDef.fallbackModels }),
6
- id: 'copilot',
7
- name: 'GitHub Copilot CLI',
8
- bin: 'copilot',
9
- versionArgs: ['--version'],
10
- // Prompt is delivered via stdin (gated by `promptViaStdin: true`
11
- // below) to avoid Windows `spawn ENAMETOOLONG` (issue #705):
12
- // `copilot -p <body>` ships the full composed prompt as a single
13
- // argv entry, and CreateProcess caps `lpCommandLine` at ~32 KB
14
- // direct or ~8 KB through a `.cmd` shim. Any non-trivial composed
15
- // prompt blows past that — even a "Hi" expands to several thousand
16
- // chars after selected context is composed in.
17
- //
18
- // The transport is "omit `-p` entirely, pipe the prompt to stdin"
19
- // per upstream copilot-cli issue #1046 (closed as already supported,
20
- // confirmed working on Copilot CLI for `echo "..." | copilot
21
- // --model <id>` and `cat prompt.txt | copilot --model <id>`). The
22
- // `-p -` form is a literal one-character prompt; omitting
23
- // `-p` entirely is the separate code path that delegates to
24
- // stdin under a non-TTY pipe — which is exactly how the daemon
25
- // spawns the child (`stdio: ['pipe', 'pipe', 'pipe']`).
26
- //
27
- // `--allow-all-tools` is still required for non-interactive runs:
28
- // without it the CLI blocks waiting for human approval on every
29
- // tool call. Unlike Codex (where `exec` is a dedicated headless
30
- // subcommand with auto-approve baked in) or Claude Code (which
31
- // inherits its permission policy from the user's settings.json),
32
- // Copilot always prompts unless this flag is passed explicitly.
33
- //
34
- // `--output-format json` produces JSONL that copilot-stream.js
35
- // parses into the same typed events as claude-stream.js.
36
- //
37
- // `--add-dir` (repeatable, same flag as Claude Code's) widens
38
- // Copilot's path-level sandbox to skill seeds + design-system
39
- // specs outside the project cwd.
40
- //
41
- // No `models` subcommand; the CLI accepts whatever the user's
42
- // Copilot subscription exposes. Ship a small evidence-based hint
43
- // list — the default we observed in the JSON stream and the
44
- // example from `copilot --help`. Users can paste any other id via
45
- // Settings.
46
- fallbackModels: [
47
- DEFAULT_MODEL_OPTION,
48
- { id: 'claude-sonnet-4.6', label: 'Claude Sonnet 4.6' },
49
- { id: 'gpt-5.2', label: 'GPT-5.2' },
50
- ],
51
- buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }, { extraAllowedDirs = [], options = {} } = {}) => {
52
- const args = [
53
- // See `RuntimeBuildOptions.permissionMode`'s doc: bypass is the default (unchanged
54
- // behavior) unless a caller explicitly opts into a restricted run, in which case
55
- // Copilot withholds tool calls that would need approval instead of auto-running them.
56
- ...(options.permissionMode !== 'restricted' ? ['--allow-all-tools'] : []),
57
- '--output-format',
58
- 'json',
59
- ];
60
- if (options.model && options.model !== 'default') {
61
- args.push('--model', options.model);
62
- }
63
- const dirs = (extraAllowedDirs || []).filter((d) => typeof d === 'string' && d.length > 0);
64
- for (const d of dirs)
65
- args.push('--add-dir', d);
66
- return args;
67
- },
68
- promptViaStdin: true,
69
- streamFormat: 'copilot-stream-json',
70
- // GitHub Copilot's deck-generation and large-prompt turns go silent
71
- // (no stdout, no streamed events) for stretches that exceed the
72
- // 10-minute global default — the model is still working but the
73
- // CLI does not emit keepalive frames. The default watchdog used to
74
- // kill those runs as `stalled` even though the agent was healthy
75
- // (issue #2467: "GitHub Copilot agent getting stuck after 10 mins
76
- // and few seconds"). 30 minutes gives the heavy turns room to land
77
- // while still bounding genuine hangs; a host can still allow an
78
- // operator to override this via its own env var if it wants it
79
- // tighter.
80
- inactivityTimeoutMs: 30 * 60 * 1000,
81
- // No `externalMcpInjection` yet. Copilot CLI has an explicit, run-scoped
82
- // flag for this: `--additional-mcp-config <json|@path>`, documented as
83
- // session-only and the highest-priority MCP source (it wins over both
84
- // `~/.copilot/mcp-config.json` and the auto-discovered project
85
- // `.github/mcp.json`/`.mcp.json`) — so, unlike the global-file or
86
- // auto-discovery routes this comment previously (incorrectly) treated as
87
- // the only options, this one needs neither `COPILOT_HOME` redirection nor
88
- // `GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP` trust gating. What's still
89
- // unconfirmed is the exact JSON shape the flag expects at its top level
90
- // (official docs describe the flag's purpose but not its schema
91
- // verbatim) — needs a local `copilot --help`/`copilot mcp --help` check
92
- // before wiring, not a guess. Closest candidate for a new strategy: pass
93
- // `@<run-scoped-file>` the same way `'claude-mcp-json'` passes a path,
94
- // once the schema is confirmed.
95
- };
96
- //# sourceMappingURL=copilot.js.map