@jini-ai/agent-runtime 0.4.4 → 0.4.6
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 +5 -0
- package/dist/agent-protocol/acp/models.d.ts +11 -0
- package/dist/agent-protocol/acp/models.js +12 -3
- package/dist/capabilities.d.ts +1 -8
- package/dist/capabilities.js +8 -1
- package/dist/claude-code-models.d.ts +13 -1
- package/dist/claude-code-models.js +15 -17
- package/dist/claude-segment-usage.d.ts +9 -2
- package/dist/claude-segment-usage.js +20 -4
- package/dist/claude-stream.d.ts +4 -0
- package/dist/claude-stream.js +5 -1
- package/dist/defs/aider.js +1 -1
- package/dist/defs/amp.js +1 -1
- package/dist/defs/amr.js +1 -1
- package/dist/defs/antigravity.js +1 -1
- package/dist/defs/auggie.js +1 -1
- package/dist/defs/claude.d.ts +2 -0
- package/dist/defs/claude.js +11 -3
- package/dist/defs/cline.js +1 -1
- package/dist/defs/codebuddy.js +2 -2
- package/dist/defs/codex.js +1 -1
- package/dist/defs/copilot.js +1 -1
- package/dist/defs/crush.js +1 -1
- package/dist/defs/cursor-agent.js +2 -2
- package/dist/defs/deepseek.js +1 -1
- package/dist/defs/devin.js +1 -1
- package/dist/defs/droid.js +1 -1
- package/dist/defs/goose.js +1 -1
- package/dist/defs/grok-build.js +1 -1
- package/dist/defs/hermes.js +1 -1
- package/dist/defs/kilo.js +1 -1
- package/dist/defs/kimi.js +1 -1
- package/dist/defs/kiro.js +1 -1
- package/dist/defs/mimo.js +1 -1
- package/dist/defs/opencode.js +2 -2
- package/dist/defs/pi.js +1 -1
- package/dist/defs/qoder.js +1 -1
- package/dist/defs/qwen.js +1 -1
- package/dist/defs/reasonix.js +1 -1
- package/dist/defs/trae-cli.js +1 -1
- package/dist/defs/vibe.js +1 -1
- package/dist/detection.d.ts +28 -4
- package/dist/detection.js +82 -43
- package/dist/diagnostics.d.ts +6 -1
- package/dist/diagnostics.js +2 -2
- package/dist/env.js +1 -1
- package/dist/executables.d.ts +15 -9
- package/dist/executables.js +73 -65
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/invocation.d.ts +24 -2
- package/dist/invocation.js +19 -7
- package/dist/launch.d.ts +2 -1
- package/dist/launch.js +2 -2
- package/dist/model-discovery-adapters.d.ts +6 -2
- package/dist/model-discovery-adapters.js +64 -51
- package/dist/model-discovery-native.d.ts +14 -0
- package/dist/model-discovery-native.js +22 -0
- package/dist/model-discovery-sdk.js +1 -1
- package/dist/model-discovery-shared.d.ts +14 -0
- package/dist/model-discovery-shared.js +53 -0
- package/dist/model-discovery-types.d.ts +26 -0
- package/dist/model-discovery.d.ts +17 -22
- package/dist/model-discovery.js +18 -69
- package/dist/models.d.ts +9 -4
- package/dist/models.js +11 -11
- package/dist/probe-scheduler.d.ts +19 -0
- package/dist/probe-scheduler.js +30 -0
- package/dist/runtime-state.d.ts +41 -0
- package/dist/runtime-state.js +31 -0
- package/dist/types.d.ts +4 -0
- package/package.json +36 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## 0.4.6 — 2026-10-13
|
|
2
|
+
|
|
3
|
+
- New `./model-discovery` subpath: the discovery policy with injected `deps` and `probes` (`createAgentModelDiscovery({ agentId, configuration, deps, probes })`, `modelDiscoveryForDef({ def, deps })`, `resolveModelForLaunch({ def, context, deps })`). It loads no child_process/fs or native adapters. The root keeps the published scalar signatures, wired to the native probes.
|
|
4
|
+
- Platform helpers come from the narrow platform subpaths; peer `@jini-ai/platform` floor is now `^0.5.5`.
|
|
5
|
+
|
|
1
6
|
## 0.4.3 — 2026-10-08
|
|
2
7
|
|
|
3
8
|
- Desktop 0.1.13 release fixes: see commits a2659d24 (admin), 5695a7c3 (chat, agent-runtime), 8ad4ac5c (devops).
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/** @module agent-protocol/acp/models
|
|
2
|
+
* ACP model detection, normalisation, and config-option selection. The primary
|
|
3
|
+
* export `detectAcpModels` spawns an ACP subprocess, performs the
|
|
4
|
+
* `initialize` + `session/new` handshake, and returns the available model list.
|
|
5
|
+
* Consumed by runtime adapter definitions. Depends on the core JSON-line
|
|
6
|
+
* stream and acp/types, acp/constants, acp/json, acp/rpc, and
|
|
7
|
+
* acp/session-params.
|
|
8
|
+
*/
|
|
9
|
+
import { spawn } from 'node:child_process';
|
|
1
10
|
import type { UnknownRecord } from './types.js';
|
|
2
11
|
/** A single model entry exposed to the daemon's model-selection UI and to `session/set_model` calls. */
|
|
3
12
|
export interface ModelOption {
|
|
@@ -22,6 +31,8 @@ export interface DetectAcpModelsOptions {
|
|
|
22
31
|
defaultModelOption?: ModelOption;
|
|
23
32
|
signal?: AbortSignal;
|
|
24
33
|
onSessionResult?: (result: UnknownRecord) => void;
|
|
34
|
+
/** Process effect port; metadata tests use a child fake rather than replacing modules. */
|
|
35
|
+
spawnProcess?: typeof spawn;
|
|
25
36
|
}
|
|
26
37
|
/**
|
|
27
38
|
* Normalises a raw config-option field value to a lowercase, whitespace- and
|
|
@@ -191,10 +191,10 @@ export function currentModelFromSessionResult(result) {
|
|
|
191
191
|
* @returns A promise resolving to the available `ModelOption[]`.
|
|
192
192
|
*/
|
|
193
193
|
export async function detectAcpModels(requiredArgs, optionalArgs = {}) {
|
|
194
|
-
const { bin, args, cwd = process.cwd(), env = process.env, timeoutMs = DEFAULT_TIMEOUT_MS, clientName = 'agent-runtime-detect', clientVersion = 'runtime-adapter', defaultModelOption = { id: 'default', label: 'Default (CLI config)' }, signal, onSessionResult, } = { ...optionalArgs, ...requiredArgs };
|
|
194
|
+
const { bin, args, cwd = process.cwd(), env = process.env, timeoutMs = DEFAULT_TIMEOUT_MS, clientName = 'agent-runtime-detect', clientVersion = 'runtime-adapter', defaultModelOption = { id: 'default', label: 'Default (CLI config)' }, signal, onSessionResult, spawnProcess = spawn, } = { ...optionalArgs, ...requiredArgs };
|
|
195
195
|
const effectiveTimeoutMs = resolveAcpTimeoutMs(env, timeoutMs);
|
|
196
196
|
return await new Promise((resolve, reject) => {
|
|
197
|
-
const child =
|
|
197
|
+
const child = spawnProcess(bin, args, {
|
|
198
198
|
cwd,
|
|
199
199
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
200
200
|
env: { ...env },
|
|
@@ -202,6 +202,7 @@ export async function detectAcpModels(requiredArgs, optionalArgs = {}) {
|
|
|
202
202
|
child.stdout.setEncoding('utf8');
|
|
203
203
|
child.stderr.setEncoding('utf8');
|
|
204
204
|
let settled = false;
|
|
205
|
+
let closed = false;
|
|
205
206
|
let stderrBuf = '';
|
|
206
207
|
let stdoutBytes = 0;
|
|
207
208
|
let expectedId = 1;
|
|
@@ -223,7 +224,14 @@ export async function detectAcpModels(requiredArgs, optionalArgs = {}) {
|
|
|
223
224
|
const killTimer = setTimeout(() => { if (child.exitCode === null)
|
|
224
225
|
child.kill('SIGKILL'); }, 250);
|
|
225
226
|
killTimer.unref();
|
|
226
|
-
|
|
227
|
+
// The process scheduler must retain its slot until exit, including the SIGKILL grace
|
|
228
|
+
// period. Returning at metadata receipt would overlap this child with the next probe.
|
|
229
|
+
if (closed) {
|
|
230
|
+
clearTimeout(killTimer);
|
|
231
|
+
fn(value);
|
|
232
|
+
}
|
|
233
|
+
else
|
|
234
|
+
child.once('close', () => { clearTimeout(killTimer); fn(value); });
|
|
227
235
|
};
|
|
228
236
|
const fail = (message) => {
|
|
229
237
|
finish(reject, new Error(message));
|
|
@@ -289,6 +297,7 @@ export async function detectAcpModels(requiredArgs, optionalArgs = {}) {
|
|
|
289
297
|
});
|
|
290
298
|
child.on('error', (err) => fail(`spawn failed: ${err.message}`));
|
|
291
299
|
child.on('close', (code, signal) => {
|
|
300
|
+
closed = true;
|
|
292
301
|
parser.flush();
|
|
293
302
|
if (!settled) {
|
|
294
303
|
const errTail = stderrBuf.trim();
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* @module capabilities
|
|
3
|
-
*
|
|
4
|
-
* Per-agent `--help`-probed capability flags, cached by agent id. Ported
|
|
5
|
-
* verbatim from OD's `apps/daemon/src/runtimes/capabilities.ts`.
|
|
6
|
-
*/
|
|
7
|
-
import type { RuntimeCapabilityMap } from './types.js';
|
|
8
|
-
export declare const agentCapabilities: Map<string, RuntimeCapabilityMap>;
|
|
1
|
+
export declare const agentCapabilities: Map<string, import("./types.js").RuntimeCapabilityMap>;
|
|
9
2
|
//# sourceMappingURL=capabilities.d.ts.map
|
package/dist/capabilities.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module capabilities
|
|
3
|
+
*
|
|
4
|
+
* Per-agent `--help`-probed capability flags, cached by agent id. Ported
|
|
5
|
+
* verbatim from OD's `apps/daemon/src/runtimes/capabilities.ts`.
|
|
6
|
+
*/
|
|
7
|
+
import { defaultRuntimeState } from './runtime-state.js';
|
|
8
|
+
export const agentCapabilities = defaultRuntimeState.capabilities;
|
|
2
9
|
//# sourceMappingURL=capabilities.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AgentRuntimeState } from './runtime-state.js';
|
|
1
2
|
import type { RuntimeEnv, RuntimeModelOption } from './types.js';
|
|
2
3
|
/** The single stdin line that asks the CLI for its initialize payload (which carries `models`). */
|
|
3
4
|
export declare const CLAUDE_CODE_INITIALIZE_REQUEST = "{\"type\":\"control_request\",\"request_id\":\"jini-model-probe\",\"request\":{\"subtype\":\"initialize\"}}\n";
|
|
@@ -58,5 +59,16 @@ export declare function setClaudeCodeModelIoForTesting(io: ClaudeCodeModelIo | n
|
|
|
58
59
|
* @complexity O(f + l) plus, at most once per {@link CLAUDE_CODE_MODEL_CACHE_TTL_MS} per cache key,
|
|
59
60
|
* one CLI spawn bounded by {@link CLAUDE_CODE_INIT_TIMEOUT_MS} and one file read.
|
|
60
61
|
*/
|
|
61
|
-
export
|
|
62
|
+
export interface ClaudeCodeModelsOptions {
|
|
63
|
+
state?: AgentRuntimeState;
|
|
64
|
+
io?: ClaudeCodeModelIo;
|
|
65
|
+
now?: () => number;
|
|
66
|
+
}
|
|
67
|
+
export declare function loadClaudeCodeModels(required: {
|
|
68
|
+
bin: string;
|
|
69
|
+
env: RuntimeEnv;
|
|
70
|
+
fallbackModels?: readonly RuntimeModelOption[];
|
|
71
|
+
}, optional?: ClaudeCodeModelsOptions): Promise<RuntimeModelOption[] | null>;
|
|
72
|
+
/** Published positional form remains additive compatibility. */
|
|
73
|
+
export declare function loadClaudeCodeModels(bin: string, env: RuntimeEnv, fallbackModels: readonly RuntimeModelOption[], now?: () => number): Promise<RuntimeModelOption[] | null>;
|
|
62
74
|
//# sourceMappingURL=claude-code-models.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defaultRuntimeState } from './runtime-state.js';
|
|
1
2
|
/**
|
|
2
3
|
* @module claude-code-models
|
|
3
4
|
*
|
|
@@ -38,7 +39,7 @@ import { createHash } from 'node:crypto';
|
|
|
38
39
|
import { readFile } from 'node:fs/promises';
|
|
39
40
|
import os from 'node:os';
|
|
40
41
|
import { join } from 'node:path';
|
|
41
|
-
import { createCommandInvocation } from '@jini-ai/platform';
|
|
42
|
+
import { createCommandInvocation } from '@jini-ai/platform/command';
|
|
42
43
|
import { sanitizeCustomModel } from './models.js';
|
|
43
44
|
/** A spawn costs ~2.5s and the picker list only moves when Claude Code updates or the server's
|
|
44
45
|
* "additional" options change, so one answer is trusted for this long per process. Failures are
|
|
@@ -193,7 +194,7 @@ const defaultIo = {
|
|
|
193
194
|
readConfigFile: (path) => readFile(path, 'utf8').catch(() => null),
|
|
194
195
|
};
|
|
195
196
|
let activeIo = defaultIo;
|
|
196
|
-
const cache =
|
|
197
|
+
const cache = defaultRuntimeState.claudeModels;
|
|
197
198
|
/** Test-only: install fake I/O (or `null` to restore the real one) and clear the process cache. */
|
|
198
199
|
export function setClaudeCodeModelIoForTesting(io) {
|
|
199
200
|
activeIo = io ?? defaultIo;
|
|
@@ -209,13 +210,13 @@ function cacheKeyFor(bin, env) {
|
|
|
209
210
|
return `${bin}\u0000${resolveClaudeConfigPath(env)}\u0000${fingerprint}`;
|
|
210
211
|
}
|
|
211
212
|
/** Source (1), then source (2). Never rejects. */
|
|
212
|
-
async function discoverClaudeCodeModels(bin, env) {
|
|
213
|
+
async function discoverClaudeCodeModels(bin, env, io) {
|
|
213
214
|
try {
|
|
214
|
-
const stdout = await
|
|
215
|
+
const stdout = await io.runInitialize(bin, env);
|
|
215
216
|
const fromCli = stdout ? parseClaudeInitializeModels(stdout) : null;
|
|
216
217
|
if (fromCli)
|
|
217
218
|
return fromCli;
|
|
218
|
-
const raw = await
|
|
219
|
+
const raw = await io.readConfigFile(resolveClaudeConfigPath(env));
|
|
219
220
|
const cached = raw === null ? null : parseClaudeCodePickerCache(raw);
|
|
220
221
|
if (!cached?.ok)
|
|
221
222
|
return null;
|
|
@@ -227,21 +228,18 @@ async function discoverClaudeCodeModels(bin, env) {
|
|
|
227
228
|
return null;
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
* one CLI spawn bounded by {@link CLAUDE_CODE_INIT_TIMEOUT_MS} and one file read.
|
|
239
|
-
*/
|
|
240
|
-
export async function loadClaudeCodeModels(bin, env, _fallbackModels, now = Date.now) {
|
|
231
|
+
export async function loadClaudeCodeModels(required, optional = {}, _fallbackModels = [], clock = Date.now) {
|
|
232
|
+
const bin = typeof required === 'string' ? required : required.bin;
|
|
233
|
+
const env = typeof required === 'string' ? optional : required.env;
|
|
234
|
+
const options = typeof required === 'string' ? {} : optional;
|
|
235
|
+
const state = options.state ?? defaultRuntimeState;
|
|
236
|
+
const cache = state.claudeModels;
|
|
237
|
+
const io = options.io ?? (state === defaultRuntimeState ? activeIo : defaultIo);
|
|
238
|
+
const now = options.now ?? clock;
|
|
241
239
|
const key = cacheKeyFor(bin, env);
|
|
242
240
|
const cached = cache.get(key);
|
|
243
241
|
const pending = cached && cached.expiresAt > now() ? cached.value : null;
|
|
244
|
-
const value = pending ?? discoverClaudeCodeModels(bin, env);
|
|
242
|
+
const value = pending ?? discoverClaudeCodeModels(bin, env, io);
|
|
245
243
|
if (!pending)
|
|
246
244
|
cache.set(key, { expiresAt: now() + CLAUDE_CODE_MODEL_CACHE_TTL_MS, value });
|
|
247
245
|
const live = await value;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/** Token counters are per segment; Claude's dollar counter spans the session.
|
|
2
|
+
* Aborted results can zero counters already streamed. */
|
|
3
|
+
export declare function createClaudeSegmentUsage(_required: Record<string, never>, { nowMs, costBasis }?: {
|
|
3
4
|
nowMs?: () => number;
|
|
5
|
+
costBasis?: 'session' | 'run';
|
|
4
6
|
}): {
|
|
5
7
|
observe: ({ messageId, usage }: {
|
|
6
8
|
messageId: string;
|
|
@@ -10,10 +12,15 @@ export declare function createClaudeSegmentUsage(_required: Record<string, never
|
|
|
10
12
|
result: Record<string, unknown>;
|
|
11
13
|
interrupted: boolean;
|
|
12
14
|
}, _optional?: {}) => {
|
|
15
|
+
cumulativeCostUsd?: number;
|
|
16
|
+
costSessionId?: string;
|
|
13
17
|
usage: {} | null;
|
|
14
18
|
costUsd: {} | null;
|
|
15
19
|
durationMs: {} | null;
|
|
16
20
|
};
|
|
21
|
+
setSession: ({ id }: {
|
|
22
|
+
id: unknown;
|
|
23
|
+
}, _optional?: {}) => void;
|
|
17
24
|
hasObserved: () => boolean;
|
|
18
25
|
};
|
|
19
26
|
//# sourceMappingURL=claude-segment-usage.d.ts.map
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/** Token counters are per segment; Claude's dollar counter spans the session.
|
|
2
|
+
* Aborted results can zero counters already streamed. */
|
|
3
|
+
export function createClaudeSegmentUsage(_required, { nowMs = Date.now, costBasis = 'session' } = {}) {
|
|
3
4
|
const messages = new Map();
|
|
4
5
|
let startedAt = nowMs();
|
|
6
|
+
let sessionId;
|
|
7
|
+
/** Capture the CLI's identity so durable chat usage can reconcile resumed runs. */
|
|
8
|
+
function setSession({ id }, _optional = {}) {
|
|
9
|
+
if (typeof id === 'string' && id.length > 0)
|
|
10
|
+
sessionId = id;
|
|
11
|
+
}
|
|
5
12
|
/** Merge cumulative counters for one message; wrappers repeat the same streamed usage.
|
|
6
13
|
* O(k) per snapshot in k reported counters; retained state is O(m·k) for m messages in a segment. */
|
|
7
14
|
function observe({ messageId, usage }, _optional = {}) {
|
|
@@ -40,8 +47,17 @@ export function createClaudeSegmentUsage(_required, { nowMs = Date.now } = {}) {
|
|
|
40
47
|
: messages.size || interrupted ? Math.max(0, endedAt - startedAt) : duration ?? null;
|
|
41
48
|
messages.clear();
|
|
42
49
|
startedAt = endedAt;
|
|
43
|
-
|
|
50
|
+
// Preserve the cumulative snapshot rather than calling it a per-run charge. A zeroed
|
|
51
|
+
// aborted result still uses the existing model-cost fallback for its interrupted segment.
|
|
52
|
+
const cumulative = costBasis === 'session' && sessionId !== undefined &&
|
|
53
|
+
typeof costUsd === 'number' && Number.isFinite(costUsd) && costUsd >= 0 &&
|
|
54
|
+
!(interrupted && result.total_cost_usd === 0);
|
|
55
|
+
return { usage: Object.keys(usage).length ? usage : result.usage ?? null,
|
|
56
|
+
costUsd: cumulative ? null : costUsd, durationMs,
|
|
57
|
+
...(costBasis === 'session' && sessionId !== undefined ? { costSessionId: sessionId } : {}),
|
|
58
|
+
...(cumulative ? { cumulativeCostUsd: costUsd } : {}),
|
|
59
|
+
};
|
|
44
60
|
}
|
|
45
|
-
return { observe, finish, hasObserved: () => messages.size > 0 };
|
|
61
|
+
return { observe, finish, setSession, hasObserved: () => messages.size > 0 };
|
|
46
62
|
}
|
|
47
63
|
//# sourceMappingURL=claude-segment-usage.js.map
|
package/dist/claude-stream.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export type ClaudeStreamEvent = {
|
|
|
82
82
|
type: 'usage';
|
|
83
83
|
usage: unknown;
|
|
84
84
|
costUsd: unknown;
|
|
85
|
+
cumulativeCostUsd?: number;
|
|
86
|
+
costSessionId?: string;
|
|
85
87
|
durationMs: unknown;
|
|
86
88
|
stopReason: string | null;
|
|
87
89
|
} | {
|
|
@@ -159,6 +161,8 @@ interface ClaudeStreamHandlerOptions {
|
|
|
159
161
|
suppressHtmlArtifactsAfterFileWrite?: boolean;
|
|
160
162
|
/** Clock used only when an interrupted segment omits its duration. */
|
|
161
163
|
nowMs?: () => number;
|
|
164
|
+
/** Claude's results span a session; compatible CLIs can retain per-run cost semantics. */
|
|
165
|
+
costBasis?: 'session' | 'run';
|
|
162
166
|
}
|
|
163
167
|
export declare function createClaudeStreamHandler({ onEvent }: {
|
|
164
168
|
onEvent: EventSink;
|
package/dist/claude-stream.js
CHANGED
|
@@ -339,7 +339,10 @@ export function emitAssistantErrorIfPresent(obj, content, onEvent) {
|
|
|
339
339
|
}
|
|
340
340
|
export function createClaudeStreamHandler({ onEvent }, options = {}) {
|
|
341
341
|
let buffer = '';
|
|
342
|
-
const segmentUsage = createClaudeSegmentUsage({},
|
|
342
|
+
const segmentUsage = createClaudeSegmentUsage({}, {
|
|
343
|
+
...(options.nowMs === undefined ? {} : { nowMs: options.nowMs }),
|
|
344
|
+
...(options.costBasis === undefined ? {} : { costBasis: options.costBasis }),
|
|
345
|
+
});
|
|
343
346
|
// Per-content-block scratch, keyed by `${messageId}:${blockIndex}`.
|
|
344
347
|
const blocks = new Map();
|
|
345
348
|
// Tool uses already emitted from streamed `input_json_delta` data OR full wrappers.
|
|
@@ -682,6 +685,7 @@ export function createClaudeStreamHandler({ onEvent }, options = {}) {
|
|
|
682
685
|
function handleObject(obj) {
|
|
683
686
|
if (!isRecord(obj))
|
|
684
687
|
return;
|
|
688
|
+
segmentUsage.setSession({ id: obj.session_id });
|
|
685
689
|
switch (obj.type) {
|
|
686
690
|
case 'system':
|
|
687
691
|
handleSystemMessage(obj, onEvent);
|
package/dist/defs/aider.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const aiderAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/amp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
// Amp CLI (https://ampcode.com) is a full agentic coding CLI, argv-shaped
|
|
4
4
|
// much like Claude Code: it has a headless execute mode and emits a
|
package/dist/defs/amr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { execAgentFile } from './shared.js';
|
|
3
3
|
const AMR_MODELS_TIMEOUT_MS = 10_000;
|
|
4
4
|
const AMR_MODELS_RETRY_DELAYS_MS = [250, 750];
|
package/dist/defs/antigravity.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { redactOAuthUrls } from '@jini-ai/oauth';
|
|
3
3
|
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
4
4
|
// `agy` v1.1.24 has a real `--model <id>` flag (`agy --help`: "Model for the current CLI
|
package/dist/defs/auggie.js
CHANGED
package/dist/defs/claude.d.ts
CHANGED
|
@@ -37,9 +37,11 @@ export declare const claudeAgentDef: {
|
|
|
37
37
|
promptViaStdin: true;
|
|
38
38
|
promptInputFormat: "stream-json";
|
|
39
39
|
streamFormat: string;
|
|
40
|
+
usageCostBasis: "session";
|
|
40
41
|
externalMcpInjection: "claude-mcp-json";
|
|
41
42
|
env: {
|
|
42
43
|
ENABLE_TOOL_SEARCH: string;
|
|
44
|
+
CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS: string;
|
|
43
45
|
};
|
|
44
46
|
systemPromptDelivery: {
|
|
45
47
|
strategy: "append-flag";
|
package/dist/defs/claude.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
/**
|
|
3
3
|
* Claude Code has no dedicated image-attachment flag. imageDelivery: 'prompt-path' makes the
|
|
4
4
|
* executor append local image paths to the prompt and add their directories to extraAllowedDirs;
|
|
@@ -157,7 +157,7 @@ export const claudeAgentDef = {
|
|
|
157
157
|
// default), which has no length cap. Mirrors the codex/opencode/
|
|
158
158
|
// cursor/qwen entries below.
|
|
159
159
|
buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }, { extraAllowedDirs = [], options = {}, runtimeContext = {} } = {}) => {
|
|
160
|
-
const caps = agentCapabilities.get('claude') || {};
|
|
160
|
+
const caps = (options.capabilities ?? agentCapabilities.get('claude')) || {};
|
|
161
161
|
// `--input-format stream-json` lets the daemon stream multiple JSONL
|
|
162
162
|
// messages into stdin instead of closing it after the initial prompt,
|
|
163
163
|
// keeping the turn open so the daemon can stream further user messages
|
|
@@ -243,6 +243,7 @@ export const claudeAgentDef = {
|
|
|
243
243
|
promptViaStdin: true,
|
|
244
244
|
promptInputFormat: 'stream-json',
|
|
245
245
|
streamFormat: 'claude-stream-json',
|
|
246
|
+
usageCostBasis: 'session',
|
|
246
247
|
// Claude Code auto-loads `.mcp.json` from the project cwd at spawn,
|
|
247
248
|
// so the daemon writes the user's external MCP servers there before
|
|
248
249
|
// launching (server.ts handles the cwd guard).
|
|
@@ -254,7 +255,14 @@ export const claudeAgentDef = {
|
|
|
254
255
|
// code.claude.com/docs/en/mcp ("`false` — All MCP tools loaded upfront, no deferral"); verified
|
|
255
256
|
// in the installed 2.1.283 binary (a defined-falsy value selects the "standard" tool mode).
|
|
256
257
|
// A default only: a run's own env can still set ENABLE_TOOL_SEARCH (see agent-executor).
|
|
257
|
-
env: {
|
|
258
|
+
env: {
|
|
259
|
+
ENABLE_TOOL_SEARCH: 'false',
|
|
260
|
+
// 2026-10-10 plannie incident: the CLI stopped two background theme subagents ten minutes
|
|
261
|
+
// after the reply ended. Installed Claude Code 2.1.296 confirms 0 waits indefinitely.
|
|
262
|
+
// Complements the daemon's stdin hold while background tasks run (agent-executor/events.ts).
|
|
263
|
+
// A default only: the host can override it through the run's explicit env passthrough.
|
|
264
|
+
CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS: '0',
|
|
265
|
+
},
|
|
258
266
|
// Formerly inline in `buildArgs` above (see the comment there) — moved to the declarative
|
|
259
267
|
// shape every def now uses to receive `RuntimeBuildOptions.systemPromptOverlay`. Same flag,
|
|
260
268
|
// same probe gate (`capabilityFlags['--append-system-prompt']` above), same "append, never
|
package/dist/defs/cline.js
CHANGED
package/dist/defs/codebuddy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { agentCapabilities } from '../capabilities.js';
|
|
3
3
|
import { buildClaudeMcpConfigArgs, DEFAULT_MODEL_OPTION } from './shared.js';
|
|
4
4
|
// Codebuddy Code (https://www.codebuddy.cn) — a Claude Code–compatible CLI
|
|
@@ -79,7 +79,7 @@ export const codebuddyAgentDef = {
|
|
|
79
79
|
{ id: 'max', label: 'Max' },
|
|
80
80
|
],
|
|
81
81
|
buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }, { extraAllowedDirs = [], options = {}, runtimeContext = {} } = {}) => {
|
|
82
|
-
const caps = agentCapabilities.get('codebuddy') || {};
|
|
82
|
+
const caps = (options.capabilities ?? agentCapabilities.get('codebuddy')) || {};
|
|
83
83
|
// Same stdin strategy as Claude Code: `--input-format stream-json`
|
|
84
84
|
// enables JSONL stdin so the daemon can answer AskUserQuestion tool
|
|
85
85
|
// calls. `--output-format stream-json` gives us SSE-style events.
|
package/dist/defs/codex.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
/** CODEX_SANDBOX_MODE and CODEX_DISABLE_PLUGINS are adapter-scoped operator overrides;
|
|
3
3
|
* no product-specific environment naming is required. */
|
|
4
4
|
import { DEFAULT_MODEL_OPTION, clampCodexReasoning } from './shared.js';
|
package/dist/defs/copilot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const copilotAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/crush.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
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
4
|
export function parseCursorAgentModels({ stdout }) {
|
|
@@ -67,7 +67,7 @@ export const cursorAgentDef = {
|
|
|
67
67
|
// which then surfaces as "your message only contains '-'". Keep stdin
|
|
68
68
|
// piped for prompt delivery, but do not append a fake prompt arg.
|
|
69
69
|
buildArgs: ({ prompt: _prompt, imagePaths: _imagePaths }, { extraAllowedDirs: _extra, options = {}, runtimeContext = {} } = {}) => {
|
|
70
|
-
const caps = agentCapabilities.get('cursor-agent') || {};
|
|
70
|
+
const caps = (options.capabilities ?? agentCapabilities.get('cursor-agent')) || {};
|
|
71
71
|
const args = [];
|
|
72
72
|
args.push('--print', '--output-format', 'stream-json', '--stream-partial-output');
|
|
73
73
|
// See `RuntimeBuildOptions.permissionMode`'s doc: bypass is the default
|
package/dist/defs/deepseek.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const deepseekAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/devin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { detectAcpModels, DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const devinAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/droid.js
CHANGED
package/dist/defs/goose.js
CHANGED
package/dist/defs/grok-build.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
const GROK_MODEL_ID_RE = /^(?:[*•-]\s*|(?=grok-))([a-z0-9][a-z0-9./_:@\[\]-]*)(?:\s+\(default\))?\s*$/i;
|
|
4
4
|
export function parseGrokBuildModels({ stdout }) {
|
package/dist/defs/hermes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { detectAcpModels, DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const hermesAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/kilo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { detectAcpModels, DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const kiloAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/kimi.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { detectAcpModels, DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const kimiAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/kiro.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { detectAcpModels, DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const kiroAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/mimo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const mimoAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/opencode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { DEFAULT_MODEL_OPTION, parseLineSeparatedModels } from './shared.js';
|
|
3
3
|
import { agentCapabilities } from '../capabilities.js';
|
|
4
4
|
const SKIP_PERMISSIONS_FLAG = '--dangerously-skip-permissions';
|
|
@@ -58,7 +58,7 @@ export const opencodeAgentDef = {
|
|
|
58
58
|
// (`skipPermissions`, probed from `--help` text) AND whether the caller wants it — see
|
|
59
59
|
// `RuntimeBuildOptions.permissionMode`'s doc. Bypass remains the default (unchanged
|
|
60
60
|
// behavior) unless a caller explicitly opts into a restricted run.
|
|
61
|
-
if (agentCapabilities.get('opencode')?.skipPermissions && options.permissionMode !== 'restricted') {
|
|
61
|
+
if ((options.capabilities ?? agentCapabilities.get('opencode'))?.skipPermissions && options.permissionMode !== 'restricted') {
|
|
62
62
|
args.push(SKIP_PERMISSIONS_FLAG);
|
|
63
63
|
}
|
|
64
64
|
// Capture-style resume: OpenCode mints its own session id (reported on
|
package/dist/defs/pi.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { DEFAULT_MODEL_OPTION, execAgentFile, parsePiModels } from './shared.js';
|
|
4
4
|
export const piAgentDef = {
|
package/dist/defs/qoder.js
CHANGED
package/dist/defs/qwen.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const qwenAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/reasonix.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
/** Reasonix's declarative definition stays product-neutral (R5, checkEngineBoundaries).
|
|
3
3
|
* Per-run system overlays use REASONIX_ACP_SYSTEM_APPEND via the shared systemPromptDelivery
|
|
4
4
|
* dispatch and computeChildEnv. Static def.env is computed once and cannot carry host/per-run
|
package/dist/defs/trae-cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { detectAcpModels, DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const traeCliAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
package/dist/defs/vibe.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '../model-discovery.js';
|
|
1
|
+
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
2
2
|
import { detectAcpModels, DEFAULT_MODEL_OPTION } from './shared.js';
|
|
3
3
|
export const vibeAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|