@jini-ai/agent-runtime 0.6.15 → 0.6.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 0.6.17
2
+
3
+ ### Patch Changes
4
+
5
+ - Version bump only.
6
+
7
+ ## 0.6.16
8
+
9
+ ### Minor Changes
10
+
11
+ - Remove the GitHub Copilot CLI agent: its def, `createCopilotStreamHandler`/`CopilotStreamEvent`,
12
+ account model discovery and the `@github/copilot-sdk` optional peer, the MCP installer's `copilot`
13
+ slug, and its icon. A saved `copilot` agent id no longer resolves (`getAgentDef` returns `null`).
14
+ CopilotKit/AG-UI is unrelated and unchanged.
15
+
16
+ Drop peers no runtime entry loads: `express` from core and http-kit (type-only imports; type
17
+ consumers keep `@types/express`), `vue` from ui-kit, `react-dom` from vibecoding.
18
+
1
19
  ## 0.6.13
2
20
 
3
21
  ### Patch Changes
@@ -4,7 +4,7 @@
4
4
  * Turns the normalized agent-event stream into {@link AiTraceEvent}s. Every provider path in the
5
5
  * runtime already converges on one vocabulary before the daemon sees it — `status` (model),
6
6
  * `text_delta`, `thinking_delta`, `tool_use`, `tool_result`, `usage`, `turn_end`, `error`, `end`
7
- * — emitted by `claude-stream`, `copilot-stream`, `qoder-stream`, `json-event-stream` (Codex,
7
+ * — emitted by `claude-stream`, `qoder-stream`, `json-event-stream` (Codex,
8
8
  * OpenCode, Cursor, Kimi), the ACP session (Gemini/Codex/Hermes over ACP) and
9
9
  * `runProviderToolTurn` (OpenAI/Anthropic/Azure/Google HTTP). Tapping that one vocabulary is
10
10
  * what makes tracing provider-agnostic: no per-vendor code lives here.
@@ -12,8 +12,7 @@
12
12
  * A model turn follows explicit request boundaries (`status: requesting`, `end`) when the stream has them;
13
13
  * otherwise each usage report closes one turn (CLI per-step or per-run usage).
14
14
  * Within a request, usage reports are snapshots, not boundaries: a final frame can contain usage AND more text.
15
- * HTTP tool-turn produces one turn per call; CLIs that report once per run (Claude Code `result`,
16
- * Copilot) produce one turn per run with all its tool calls — the granularity the provider gave,
15
+ * HTTP tool-turn produces one turn per call; CLIs that report once per run (Claude Code `result`) produce one turn per run with all its tool calls — the granularity the provider gave,
17
16
  * not a guess.
18
17
  */
19
18
  import { type CaptureTextOptions } from './capture.js';
@@ -4,7 +4,7 @@
4
4
  * Turns the normalized agent-event stream into {@link AiTraceEvent}s. Every provider path in the
5
5
  * runtime already converges on one vocabulary before the daemon sees it — `status` (model),
6
6
  * `text_delta`, `thinking_delta`, `tool_use`, `tool_result`, `usage`, `turn_end`, `error`, `end`
7
- * — emitted by `claude-stream`, `copilot-stream`, `qoder-stream`, `json-event-stream` (Codex,
7
+ * — emitted by `claude-stream`, `qoder-stream`, `json-event-stream` (Codex,
8
8
  * OpenCode, Cursor, Kimi), the ACP session (Gemini/Codex/Hermes over ACP) and
9
9
  * `runProviderToolTurn` (OpenAI/Anthropic/Azure/Google HTTP). Tapping that one vocabulary is
10
10
  * what makes tracing provider-agnostic: no per-vendor code lives here.
@@ -12,8 +12,7 @@
12
12
  * A model turn follows explicit request boundaries (`status: requesting`, `end`) when the stream has them;
13
13
  * otherwise each usage report closes one turn (CLI per-step or per-run usage).
14
14
  * Within a request, usage reports are snapshots, not boundaries: a final frame can contain usage AND more text.
15
- * HTTP tool-turn produces one turn per call; CLIs that report once per run (Claude Code `result`,
16
- * Copilot) produce one turn per run with all its tool calls — the granularity the provider gave,
15
+ * HTTP tool-turn produces one turn per call; CLIs that report once per run (Claude Code `result`) produce one turn per run with all its tool calls — the granularity the provider gave,
17
16
  * not a guess.
18
17
  */
19
18
  import { captureText, stringifyForCapture } from './capture.js';
package/dist/defs/amp.js CHANGED
@@ -10,12 +10,12 @@ import { DEFAULT_MODEL_OPTION } from './shared.js';
10
10
  // prints only its final assistant message (we read the structured
11
11
  // stream instead). The prompt is delivered via stdin (`promptViaStdin`),
12
12
  // matching the `echo "..." | amp -x` shape documented in `amp --help`.
13
- // This avoids the argv length caps that bite copilot/claude on a single
13
+ // This avoids the argv length caps that bite Claude on a single
14
14
  // `-p <body>` argv entry.
15
15
  // - `--stream-json` (requires `--execute`) switches stdout to the
16
16
  // Claude-Code-compatible JSONL stream the daemon already parses.
17
17
  // - `--dangerously-allow-all` is the non-interactive auto-approve flag
18
- // (Amp's equivalent of Copilot's `--allow-all-tools` / Codex's headless
18
+ // (Amp's equivalent of Codex's headless
19
19
  // auto-approve): without it the agent blocks waiting for human approval
20
20
  // on every tool call.
21
21
  //
@@ -11,7 +11,6 @@ export * from './claude.js';
11
11
  export * from './cline.js';
12
12
  export * from './codebuddy.js';
13
13
  export * from './codex.js';
14
- export * from './copilot.js';
15
14
  export * from './crush.js';
16
15
  export * from './cursor-agent.js';
17
16
  export * from './droid.js';
@@ -11,7 +11,6 @@ export * from './claude.js';
11
11
  export * from './cline.js';
12
12
  export * from './codebuddy.js';
13
13
  export * from './codex.js';
14
- export * from './copilot.js';
15
14
  export * from './crush.js';
16
15
  export * from './cursor-agent.js';
17
16
  export * from './droid.js';
@@ -34,7 +34,6 @@ const AGENT_BIN_ENV_KEYS = new Map([
34
34
  ['cline', 'CLINE_BIN'],
35
35
  ['codebuddy', 'CODEBUDDY_BIN'],
36
36
  ['codex', 'CODEX_BIN'],
37
- ['copilot', 'COPILOT_BIN'],
38
37
  ['crush', 'CRUSH_BIN'],
39
38
  ['cursor-agent', 'CURSOR_AGENT_BIN'],
40
39
  ['deepseek', 'DEEPSEEK_BIN'],
package/dist/index.d.ts CHANGED
@@ -39,7 +39,6 @@ export * from './model-registry.js';
39
39
  export { createClaudeStreamHandler, type ClaudeStreamEvent } from './claude-stream.js';
40
40
  export { createJsonEventStreamHandler } from './json-event-stream.js';
41
41
  export { createQoderStreamHandler, type QoderEvent } from './qoder-stream.js';
42
- export { createCopilotStreamHandler, type CopilotStreamEvent } from './copilot-stream.js';
43
42
  export * from './amr-profile-resolver.js';
44
43
  export { type AcpModelProbe, type AcpModelProbeRequest, noopAcpModelProbe, setAcpModelProbe, detectAcpModels as probeAcpModels, } from './acp-model-probe.js';
45
44
  export * from './pi-models.js';
package/dist/index.js CHANGED
@@ -56,7 +56,6 @@ export * from './model-registry.js';
56
56
  export { createClaudeStreamHandler } from './claude-stream.js';
57
57
  export { createJsonEventStreamHandler } from './json-event-stream.js';
58
58
  export { createQoderStreamHandler } from './qoder-stream.js';
59
- export { createCopilotStreamHandler } from './copilot-stream.js';
60
59
  // Host-injected seams; each owner documents its contract.
61
60
  export * from './amr-profile-resolver.js';
62
61
  // `probeAcpModels` is the replaceable probe used by defs/shared.ts; the native ACP transport
package/dist/metadata.js CHANGED
@@ -43,10 +43,6 @@ export const DEFAULT_AGENT_INSTALL_LINKS = {
43
43
  installUrl: 'https://qoder.com/download',
44
44
  docsUrl: 'https://docs.qoder.com',
45
45
  },
46
- copilot: {
47
- installUrl: 'https://github.com/github/copilot-cli',
48
- docsUrl: 'https://docs.github.com/en/copilot/how-tos/use-copilot-extensions/use-in-cli',
49
- },
50
46
  pi: {
51
47
  docsUrl: 'https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/README.md',
52
48
  },
@@ -9,7 +9,7 @@ import { CLAUDE_CODE_INITIALIZE_ARGS, CLAUDE_CODE_INITIALIZE_REQUEST } from './c
9
9
  import { listProviderModels } from './providers/model-catalog.js';
10
10
  import { execAgentFile } from './invocation.js';
11
11
  import { scheduleProbeProcess } from './probe-scheduler.js';
12
- import { probeCopilotSdk, probeDroidSdk } from './model-discovery-sdk.js';
12
+ import { probeDroidSdk } from './model-discovery-sdk.js';
13
13
  import { parseSettingsJson, readModelConfiguration } from './model-discovery-config.js';
14
14
  import { ModelProbeError, modelIdentityKind, withModelProbeTimeout } from './core/model-discovery-shared.js';
15
15
  const ACP_ARGS = {
@@ -22,7 +22,7 @@ const CLI_ARGS = {
22
22
  amp: ['plugins', 'show-agent-options', '--json'], crush: ['models'], deepseek: ['models'], qoder: ['--list-models'],
23
23
  };
24
24
  export function modelProbeTimeoutMs(agentId) {
25
- if (ACP_ARGS[agentId] || ['claude', 'codebuddy', 'pi', 'copilot', 'droid'].includes(agentId))
25
+ if (ACP_ARGS[agentId] || ['claude', 'codebuddy', 'pi', 'droid'].includes(agentId))
26
26
  return 15_000;
27
27
  return 10_000;
28
28
  }
@@ -235,7 +235,7 @@ async function probeCodeBuddyCatalog(agentId, context, deps, signal) {
235
235
  /** Agents with a dedicated discovery category, checked before any declared listing command. */
236
236
  const AGENT_PROBES = new Map([
237
237
  ['claude', probeClaudeCatalog],
238
- ['pi', probeRpc], ['copilot', probeRpc], ['droid', probeRpc],
238
+ ['pi', probeRpc], ['droid', probeRpc],
239
239
  // UNVERIFIED CLI-owned effective credential adapters; OAuth/unknown endpoints require host ports.
240
240
  ['aider', probeProviderApi], ['qwen', probeProviderApi], ['mimo', probeProviderApi],
241
241
  ['codebuddy', probeCodeBuddyCatalog],
@@ -431,8 +431,6 @@ export const defaultModelDiscoveryDeps = {
431
431
  acp: createAcpDiscoveryAdapter({ probe: nativeAcpModelProbe }),
432
432
  rpc: { async probe({ agentId, context, signal }) {
433
433
  // UNVERIFIED locally: use official prompt-free SDK interfaces, not invented CLI flags.
434
- if (agentId === 'copilot')
435
- return scheduleProbeProcess({ work: () => probeCopilotSdk(context, signal) }, { signal });
436
434
  if (agentId === 'droid')
437
435
  return probeDroidSdk(context, defaultModelDiscoveryDeps, signal);
438
436
  if (agentId !== 'pi')
@@ -27,7 +27,6 @@ const CONFIG_FILES = new Map([
27
27
  // UNVERIFIED locally: the survey documents these settings, not installed schema behavior.
28
28
  ['grok-build', ({ user }) => [{ path: user('.grok/config.toml'), format: 'toml', key: 'models.model' }]],
29
29
  ['codebuddy', ({ user, local }) => [json(user('.codebuddy/settings.json')), json(local('.codebuddy/settings.json')), json(local('.codebuddy/settings.local.json'))]],
30
- ['copilot', ({ user }) => [json(user('.copilot/config.json'))]],
31
30
  ['cursor-agent', ({ user }) => [json(user('.cursor/cli-config.json'))]],
32
31
  ['droid', ({ user }) => [json(user('.factory/settings.json'), 'sessionDefaultSettings.model')]],
33
32
  ['qoder', ({ env, user, local }) => [json(join(env.QODER_CONFIG_DIR || user('.qoder'), 'settings.json'), MODEL_NAME_PATH), json(local('.qoder/settings.json'), MODEL_NAME_PATH), json(local('.qoder/settings.local.json'), MODEL_NAME_PATH)]],
@@ -1,32 +1,3 @@
1
1
  import type { ModelDiscoveryContext, ModelDiscoveryDeps, ModelProbeResult } from './model-discovery-types.js';
2
- /** UNVERIFIED locally. The host may install the official SDK or inject the RPC port.
3
- * Use the CLI's authenticated server, not an unrelated HTTP token or an inference prompt.
4
- * https://github.com/github/copilot-sdk/blob/main/nodejs/src/client.ts */
5
- export interface CopilotMetadataClient {
6
- start(): Promise<unknown>;
7
- listModels(): Promise<{
8
- id: string;
9
- name?: string;
10
- }[]>;
11
- forceStop(): Promise<unknown>;
12
- }
13
- export declare function probeCopilotSdk(context: ModelDiscoveryContext, signal: AbortSignal, optional?: {
14
- createClient?: (context: ModelDiscoveryContext) => Promise<CopilotMetadataClient>;
15
- }): Promise<ModelProbeResult>;
16
- /** The slice of `@github/copilot-sdk` this probe constructs a metadata client from. */
17
- export interface CopilotSdkModule {
18
- readonly RuntimeConnection?: {
19
- forStdio(input: {
20
- path: string;
21
- env: Record<string, string>;
22
- }): unknown;
23
- };
24
- readonly CopilotClient: new (options: Record<string, unknown>) => CopilotMetadataClient;
25
- }
26
- /** Builds the metadata client from the host-installed SDK. `importSdk` is the module-loading port
27
- * (Node's dynamic import by default), injectable so both SDK API generations are testable. */
28
- export declare function createCopilotMetadataClient(context: ModelDiscoveryContext, { importSdk }?: {
29
- importSdk?: (name: string) => Promise<CopilotSdkModule>;
30
- }): Promise<CopilotMetadataClient>;
31
2
  export declare function probeDroidSdk(context: ModelDiscoveryContext, deps: ModelDiscoveryDeps, signal: AbortSignal): Promise<ModelProbeResult>;
32
3
  //# sourceMappingURL=model-discovery-sdk.d.ts.map
@@ -1,36 +1,4 @@
1
1
  import { ModelProbeError, modelIdentityKind } from './model-discovery-shared.js';
2
- export async function probeCopilotSdk(context, signal, optional = {}) {
3
- const client = await (optional.createClient ?? createCopilotMetadataClient)(context);
4
- if (signal.aborted) {
5
- await client.forceStop().catch(() => { });
6
- throw new ModelProbeError('timeout');
7
- }
8
- const stop = () => { void Promise.resolve(client.forceStop()).catch(() => { }); };
9
- signal.addEventListener('abort', stop, { once: true });
10
- try {
11
- await client.start();
12
- if (signal.aborted)
13
- throw new ModelProbeError('timeout');
14
- const rows = await client.listModels();
15
- return { models: rows.map((row) => ({ id: row.id, label: row.name || row.id, identityKind: modelIdentityKind(row.id) })), source: 'rpc', coverage: 'account' };
16
- }
17
- finally {
18
- signal.removeEventListener('abort', stop);
19
- // forceStop also closes the child when a failed handshake never reached connected state.
20
- await client.forceStop().catch(() => { });
21
- }
22
- }
23
- /** Builds the metadata client from the host-installed SDK. `importSdk` is the module-loading port
24
- * (Node's dynamic import by default), injectable so both SDK API generations are testable. */
25
- export async function createCopilotMetadataClient(context, { importSdk = (name) => import(name) } = {}) {
26
- const sdk = await importSdk('@github/copilot-sdk');
27
- const env = Object.fromEntries(Object.entries(context.env).filter((entry) => typeof entry[1] === 'string'));
28
- // RuntimeConnection is the current SDK API; older SDKs expose cliPath/cwd/useStdio.
29
- const connection = sdk.RuntimeConnection?.forStdio({ path: context.executable, env });
30
- return new sdk.CopilotClient(connection
31
- ? { connection, workingDirectory: context.cwd, autoRestart: false }
32
- : { cliPath: context.executable, cwd: context.cwd, env, useStdio: true, autoRestart: false });
33
- }
34
2
  /** UNVERIFIED locally. Official Python SDK metadata bridge; no session/inference call.
35
3
  * SDK installation belongs to the host's Python environment.
36
4
  * https://docs.factory.com/sdk/python#discover-available-models */
@@ -123,7 +123,7 @@ export interface ModelDiscoveryDeps {
123
123
  signal: AbortSignal;
124
124
  }): Promise<ModelProbeResult>;
125
125
  };
126
- /** Copilot/Droid SDK ports: no undocumented CLI flags or inference prompts. */
126
+ /** Droid SDK ports: no undocumented CLI flags or inference prompts. */
127
127
  rpc: {
128
128
  probe(input: {
129
129
  agentId: string;
@@ -17,7 +17,7 @@
17
17
  * `connection-guard.ts`'s SSRF guard + secret redaction,
18
18
  * `role-marker-guard.ts`'s contamination detector, and the
19
19
  * "one file per vendor's stream-parsing shape" precedent
20
- * `claude-stream.ts`/`copilot-stream.ts`/`qoder-stream.ts` already
20
+ * `claude-stream.ts`/`qoder-stream.ts` already
21
21
  * establish) rather than duplicating any of that inside `@jini-ai/http-kit` — see
22
22
  * the proposal's "real question: where does provider-specific wire-protocol
23
23
  * logic belong?" section for the placement decision this file implements.
@@ -18,7 +18,7 @@ import { redactSecrets } from '@jini-ai/core';
18
18
  * `connection-guard.ts`'s SSRF guard + secret redaction,
19
19
  * `role-marker-guard.ts`'s contamination detector, and the
20
20
  * "one file per vendor's stream-parsing shape" precedent
21
- * `claude-stream.ts`/`copilot-stream.ts`/`qoder-stream.ts` already
21
+ * `claude-stream.ts`/`qoder-stream.ts` already
22
22
  * establish) rather than duplicating any of that inside `@jini-ai/http-kit` — see
23
23
  * the proposal's "real question: where does provider-specific wire-protocol
24
24
  * logic belong?" section for the placement decision this file implements.
@@ -9,7 +9,7 @@ export declare function getAgentDef({ id }: {
9
9
  * tools) into a session run by this
10
10
  * def, per its own `externalMcpInjection` declaration (`types.ts`'s own doc names the six wired
11
11
  * strategies and the defs that leave the field `undefined` because the CLI has no mechanism to
12
- * receive one — `aider`, `amp`, `copilot`, `crush`, `cursor-agent`, `deepseek`, `droid`,
12
+ * receive one — `aider`, `amp`, `crush`, `cursor-agent`, `deepseek`, `droid`,
13
13
  * `grok-build`, `pi`, `qoder`, and `qwen` today, each documenting why in its own def file).
14
14
  *
15
15
  * This is the single seam a tool-availability UI (e.g. the chat runtime picker's "No tools" badge)
package/dist/registry.js CHANGED
@@ -17,7 +17,7 @@
17
17
  * can reintroduce a de-branded, sandbox-free local-profile loader as an
18
18
  * injected port if a consumer needs it. See `archived provenance ledger`.
19
19
  */
20
- import { aiderAgentDef, ampAgentDef, amrAgentDef, antigravityAgentDef, auggieAgentDef, claudeAgentDef, clineAgentDef, codebuddyAgentDef, codexAgentDef, copilotAgentDef, crushAgentDef, cursorAgentDef, deepseekAgentDef, devinAgentDef, droidAgentDef, gooseAgentDef, grokBuildAgentDef, hermesAgentDef, kiloAgentDef, kimiAgentDef, kiroAgentDef, mimoAgentDef, opencodeAgentDef, piAgentDef, qoderAgentDef, qwenAgentDef, reasonixAgentDef, traeCliAgentDef, vibeAgentDef, } from './defs/index.js';
20
+ import { aiderAgentDef, ampAgentDef, amrAgentDef, antigravityAgentDef, auggieAgentDef, claudeAgentDef, clineAgentDef, codebuddyAgentDef, codexAgentDef, crushAgentDef, cursorAgentDef, deepseekAgentDef, devinAgentDef, droidAgentDef, gooseAgentDef, grokBuildAgentDef, hermesAgentDef, kiloAgentDef, kimiAgentDef, kiroAgentDef, mimoAgentDef, opencodeAgentDef, piAgentDef, qoderAgentDef, qwenAgentDef, reasonixAgentDef, traeCliAgentDef, vibeAgentDef, } from './defs/index.js';
21
21
  export const BASE_AGENT_DEFS = [
22
22
  amrAgentDef,
23
23
  claudeAgentDef,
@@ -32,7 +32,6 @@ export const BASE_AGENT_DEFS = [
32
32
  qwenAgentDef,
33
33
  // Gemini CLI retired 2026-10-06; Antigravity (agy) is the Google CLI path.
34
34
  qoderAgentDef,
35
- copilotAgentDef,
36
35
  ampAgentDef,
37
36
  piAgentDef,
38
37
  kiroAgentDef,
@@ -66,7 +65,7 @@ export function getAgentDef({ id }) {
66
65
  * tools) into a session run by this
67
66
  * def, per its own `externalMcpInjection` declaration (`types.ts`'s own doc names the six wired
68
67
  * strategies and the defs that leave the field `undefined` because the CLI has no mechanism to
69
- * receive one — `aider`, `amp`, `copilot`, `crush`, `cursor-agent`, `deepseek`, `droid`,
68
+ * receive one — `aider`, `amp`, `crush`, `cursor-agent`, `deepseek`, `droid`,
70
69
  * `grok-build`, `pi`, `qoder`, and `qwen` today, each documenting why in its own def file).
71
70
  *
72
71
  * This is the single seam a tool-availability UI (e.g. the chat runtime picker's "No tools" badge)
@@ -1,3 +1,24 @@
1
+ /** Resolve a saved selection against the host's registry; retired ids use its default.
2
+ * `onFallback` reports the first stale selection once per resolver, keeping repeated turns quiet
3
+ * without retaining an unbounded collection of caller-supplied ids. Missing selections are silent.
4
+ * Registry lookup failures propagate; executable availability remains the launcher's responsibility.
5
+ * @complexity O(registry lookup) time per selection, O(1) retained space.
6
+ */
7
+ export declare function createAgentSelectionResolver({ defaultAgentId, onFallback }: {
8
+ defaultAgentId: string;
9
+ onFallback: (input: {
10
+ agentId: string;
11
+ defaultAgentId: string;
12
+ }) => void;
13
+ }, { getDef }?: {
14
+ getDef?: (input: {
15
+ id: string;
16
+ }) => {
17
+ id: string;
18
+ } | null;
19
+ }): (input: {
20
+ agentId?: string | undefined;
21
+ }, options?: Record<string, never>) => string;
1
22
  export declare function resolveAgentBin({ id }: {
2
23
  id: string;
3
24
  }, { configuredEnv }?: {
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/agent-runtime",
3
- "version": "0.6.15",
3
+ "version": "0.6.17",
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": {
@@ -120,29 +120,15 @@
120
120
  "devDependencies": {
121
121
  "@vitest/coverage-v8": "^2.1.9",
122
122
  "@jini-ai/core": "^0.6.13",
123
- "@jini-ai/integrations": "^0.6.15",
124
- "@jini-ai/platform": "^0.6.15"
123
+ "@jini-ai/platform": "^0.6.17",
124
+ "@jini-ai/integrations": "^0.6.17"
125
125
  },
126
126
  "dependencies": {
127
- "@jini-ai/core": "^0.6.15",
128
- "@jini-ai/oauth": "^0.6.15",
129
- "@jini-ai/protocol": "^0.6.15"
130
- },
131
- "peerDependencies": {
132
- "@jini-ai/integrations": "^0.6.10",
133
- "@github/copilot-sdk": "*",
134
- "@jini-ai/platform": "^0.6.10"
135
- },
136
- "peerDependenciesMeta": {
137
- "@jini-ai/integrations": {
138
- "optional": true
139
- },
140
- "@github/copilot-sdk": {
141
- "optional": true
142
- },
143
- "@jini-ai/platform": {
144
- "optional": true
145
- }
127
+ "@jini-ai/oauth": "^0.6.17",
128
+ "@jini-ai/integrations": "^0.6.17",
129
+ "@jini-ai/protocol": "^0.6.17",
130
+ "@jini-ai/core": "^0.6.17",
131
+ "@jini-ai/platform": "^0.6.17"
146
132
  },
147
133
  "scripts": {
148
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,126 +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
- feedLine(line);
38
- }
39
- }
40
- /** One complete, non-blank line: a JSON object is handled, anything else passes through raw. */
41
- function feedLine(line) {
42
- let obj;
43
- try {
44
- obj = JSON.parse(line);
45
- }
46
- catch {
47
- onEvent({ type: 'raw', line });
48
- return;
49
- }
50
- handleObject(obj);
51
- }
52
- function flush() {
53
- const rem = buffer.trim();
54
- buffer = '';
55
- if (!rem)
56
- return;
57
- try {
58
- handleObject(JSON.parse(rem));
59
- }
60
- catch {
61
- onEvent({ type: 'raw', line: rem });
62
- }
63
- }
64
- function handleObject(obj) {
65
- if (!isRecord(obj) || typeof obj.type !== 'string')
66
- return;
67
- const data = isRecord(obj.data) ? obj.data : {};
68
- // Event types we have no UI lane for are dropped on the floor.
69
- COPILOT_EVENT_HANDLERS.get(obj.type)?.({ obj, data, onEvent });
70
- }
71
- return { feed, flush };
72
- }
73
- function emitDelta(type) {
74
- return ({ data, onEvent }) => {
75
- if (typeof data.deltaContent === 'string') {
76
- onEvent({ type, delta: data.deltaContent });
77
- }
78
- };
79
- }
80
- // Map (not an object literal) so a prototype-named `type` can never resolve to a handler.
81
- const COPILOT_EVENT_HANDLERS = new Map([
82
- ['session.tools_updated', ({ data, onEvent }) => {
83
- if (data.model) {
84
- onEvent({ type: 'status', label: 'initializing', model: data.model });
85
- }
86
- }],
87
- ['assistant.turn_start', ({ onEvent }) => onEvent({ type: 'status', label: 'streaming' })],
88
- ['assistant.reasoning_delta', emitDelta('thinking_delta')],
89
- ['assistant.message_delta', emitDelta('text_delta')],
90
- ['tool.execution_start', ({ data, onEvent }) => onEvent({
91
- type: 'tool_use',
92
- id: data.toolCallId ?? null,
93
- name: data.toolName ?? null,
94
- input: data.arguments ?? null,
95
- })],
96
- ['tool.execution_complete', ({ data, onEvent }) => onEvent({
97
- type: 'tool_result',
98
- toolUseId: data.toolCallId ?? null,
99
- content: stringifyResult(data.result),
100
- isError: data.success === false,
101
- })],
102
- // `result` puts usage / exitCode at the top level, not under `data`.
103
- // Treat a missing exitCode as success when `success: true` is set —
104
- // strict `=== 0` would otherwise mis-flag turns where Copilot emits
105
- // usage without a numeric exit code as `error`.
106
- ['result', ({ obj, onEvent }) => onEvent({
107
- type: 'usage',
108
- usage: obj.usage ?? null,
109
- stopReason: obj.success === true || obj.exitCode === 0 ? 'completed' : 'error',
110
- durationMs: isRecord(obj.usage) ? obj.usage.sessionDurationMs ?? null : null,
111
- })],
112
- ]);
113
- function stringifyResult(r) {
114
- if (r == null)
115
- return '';
116
- if (typeof r === 'string')
117
- return r;
118
- if (!isRecord(r))
119
- return JSON.stringify(r);
120
- if (typeof r.content === 'string')
121
- return r.content;
122
- if (typeof r.detailedContent === 'string')
123
- return r.detailedContent;
124
- return JSON.stringify(r);
125
- }
126
- //# 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("../model-contracts.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