@jini-ai/agent-runtime 0.7.3-next.2 → 0.7.4
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 +7 -0
- package/README.md +38 -0
- package/dist/agent-protocol/acp/models.d.ts +0 -10
- package/dist/agent-protocol/acp/models.js +0 -10
- package/dist/agent-protocol/acp/rpc.d.ts +5 -1
- package/dist/agent-protocol/acp/rpc.js +2 -1
- package/dist/agent-protocol/acp/session-permission.js +4 -3
- package/dist/agent-protocol/acp/session-results.d.ts +4 -4
- package/dist/agent-protocol/acp/session-results.js +30 -21
- package/dist/agent-protocol/acp/session-run.js +0 -8
- package/dist/agent-protocol/acp/session-types.d.ts +0 -1
- package/dist/agent-protocol/acp/session-usage.d.ts +12 -0
- package/dist/agent-protocol/acp/session-usage.js +29 -0
- package/dist/agent-protocol/acp/session.d.ts +1 -1
- package/dist/agent-protocol/acp/session.js +10 -4
- package/dist/agent-protocol/acp/text-suppression.js +75 -71
- package/dist/agent-protocol/pi-rpc/events.d.ts +21 -4
- package/dist/agent-protocol/pi-rpc/events.js +9 -9
- package/dist/agent-protocol/pi-rpc/internal.d.ts +6 -2
- package/dist/agent-protocol/pi-rpc/internal.js +6 -4
- package/dist/agent-protocol/pi-rpc/session.js +4 -3
- package/dist/anthropic-live-models.js +0 -0
- package/dist/claude-code-models.d.ts +3 -1
- package/dist/claude-code-models.js +4 -4
- package/dist/claude-stream-frames.js +1 -1
- package/dist/cli-probe-cache.d.ts +33 -0
- package/dist/cli-probe-cache.js +59 -0
- package/dist/custom-instructions.d.ts +107 -0
- package/dist/custom-instructions.js +80 -0
- package/dist/defs/{aider.d.ts → aider/index.d.ts} +2 -1
- package/dist/defs/{aider.js → aider/index.js} +6 -3
- package/dist/defs/amr/executable-env.d.ts +2 -0
- package/dist/defs/amr/executable-env.js +2 -0
- package/dist/defs/amr/executable-resolution.d.ts +5 -1
- package/dist/defs/amr/executable-resolution.js +1 -1
- package/dist/defs/antigravity/index.d.ts +1 -0
- package/dist/defs/antigravity/index.js +3 -0
- package/dist/defs/antigravity/permissions.d.ts +26 -0
- package/dist/defs/antigravity/permissions.js +66 -0
- package/dist/defs/{auggie.d.ts → auggie/index.d.ts} +1 -1
- package/dist/defs/{auggie.js → auggie/index.js} +3 -3
- package/dist/defs/claude/config-dir.d.ts +62 -0
- package/dist/defs/claude/config-dir.js +133 -0
- package/dist/defs/claude/filesystem.d.ts +33 -0
- package/dist/defs/claude/filesystem.js +30 -0
- package/dist/defs/{claude.d.ts → claude/index.d.ts} +1 -1
- package/dist/defs/{claude.js → claude/index.js} +9 -9
- package/dist/defs/claude/mcp-config.d.ts +22 -0
- package/dist/defs/claude/mcp-config.js +29 -0
- package/dist/defs/claude/mcp-delivery.d.ts +57 -0
- package/dist/defs/claude/mcp-delivery.js +75 -0
- package/dist/defs/claude/mcp-json.d.ts +34 -0
- package/dist/defs/claude/mcp-json.js +38 -0
- package/dist/defs/claude/subagent-start.d.ts +12 -0
- package/dist/defs/claude/subagent-start.js +35 -0
- package/dist/defs/{cline.d.ts → cline/index.d.ts} +1 -1
- package/dist/defs/{cline.js → cline/index.js} +3 -3
- package/dist/defs/codex/contracts.d.ts +47 -0
- package/dist/defs/codex/contracts.js +6 -0
- package/dist/defs/codex/event-stream.d.ts +5 -1
- package/dist/defs/codex/event-stream.js +29 -24
- package/dist/defs/codex/home-config.d.ts +55 -0
- package/dist/defs/codex/home-config.js +224 -0
- package/dist/defs/codex/home-staging.d.ts +57 -0
- package/dist/defs/codex/home-staging.js +184 -0
- package/dist/defs/{codex.d.ts → codex/index.d.ts} +2 -2
- package/dist/defs/{codex.js → codex/index.js} +3 -3
- package/dist/defs/codex/isolation.d.ts +29 -0
- package/dist/defs/codex/isolation.js +69 -0
- package/dist/defs/codex/launch.d.ts +4 -1
- package/dist/defs/codex/launch.js +1 -1
- package/dist/defs/codex/mcp-delivery.d.ts +8 -0
- package/dist/defs/codex/mcp-delivery.js +5 -0
- package/dist/defs/{crush.d.ts → crush/index.d.ts} +1 -1
- package/dist/defs/{crush.js → crush/index.js} +3 -3
- package/dist/defs/cursor-agent/event-stream.d.ts +5 -1
- package/dist/defs/cursor-agent/event-stream.js +14 -7
- package/dist/defs/{cursor-agent.d.ts → cursor-agent/index.d.ts} +1 -1
- package/dist/defs/{cursor-agent.js → cursor-agent/index.js} +4 -4
- package/dist/defs/{deepseek.d.ts → deepseek/index.d.ts} +2 -1
- package/dist/defs/{deepseek.js → deepseek/index.js} +6 -3
- package/dist/defs/{devin.d.ts → devin/index.d.ts} +1 -1
- package/dist/defs/{devin.js → devin/index.js} +3 -3
- package/dist/defs/{droid.d.ts → droid/index.d.ts} +1 -1
- package/dist/defs/{droid.js → droid/index.js} +3 -3
- package/dist/defs/gemini/event-stream.d.ts +5 -1
- package/dist/defs/gemini/event-stream.js +15 -12
- package/dist/defs/gemini/tool-calls.d.ts +7 -0
- package/dist/defs/gemini/tool-calls.js +9 -0
- package/dist/defs/{goose.d.ts → goose/index.d.ts} +1 -1
- package/dist/defs/{goose.js → goose/index.js} +3 -3
- package/dist/defs/{grok-build.d.ts → grok-build/index.d.ts} +1 -1
- package/dist/defs/{grok-build.js → grok-build/index.js} +3 -3
- package/dist/defs/index.d.ts +28 -28
- package/dist/defs/index.js +28 -28
- package/dist/defs/{kilo.d.ts → kilo/index.d.ts} +1 -1
- package/dist/defs/{kilo.js → kilo/index.js} +3 -3
- package/dist/defs/kimi/event-stream.d.ts +4 -1
- package/dist/defs/kimi/event-stream.js +6 -5
- package/dist/defs/{kimi.d.ts → kimi/index.d.ts} +1 -1
- package/dist/defs/{kimi.js → kimi/index.js} +3 -3
- package/dist/defs/{kiro.d.ts → kiro/index.d.ts} +1 -1
- package/dist/defs/{kiro.js → kiro/index.js} +3 -3
- package/dist/defs/mimo/constants.d.ts +2 -0
- package/dist/defs/mimo/constants.js +2 -0
- package/dist/defs/{mimo.d.ts → mimo/index.d.ts} +1 -1
- package/dist/defs/{mimo.js → mimo/index.js} +3 -3
- package/dist/defs/opencode/constants.d.ts +2 -0
- package/dist/defs/opencode/constants.js +2 -0
- package/dist/defs/opencode/event-stream.d.ts +5 -1
- package/dist/defs/opencode/event-stream.js +13 -11
- package/dist/defs/{opencode.d.ts → opencode/index.d.ts} +2 -2
- package/dist/defs/{opencode.js → opencode/index.js} +5 -5
- package/dist/defs/opencode/mcp-config.d.ts +108 -0
- package/dist/defs/opencode/mcp-config.js +119 -0
- package/dist/defs/opencode/model-discovery.d.ts +3 -1
- package/dist/defs/opencode/model-discovery.js +1 -1
- package/dist/defs/opencode/tool-calls.d.ts +7 -0
- package/dist/defs/opencode/tool-calls.js +12 -0
- package/dist/defs/{opencode-acp.d.ts → opencode-acp/index.d.ts} +2 -2
- package/dist/defs/{opencode-acp.js → opencode-acp/index.js} +4 -4
- package/dist/defs/{pi.d.ts → pi/index.d.ts} +1 -1
- package/dist/defs/{pi.js → pi/index.js} +3 -3
- package/dist/defs/pi/model-discovery.d.ts +4 -1
- package/dist/defs/pi/model-discovery.js +1 -1
- package/dist/defs/{qoder.d.ts → qoder/index.d.ts} +1 -1
- package/dist/defs/{qoder.js → qoder/index.js} +3 -3
- package/dist/defs/{qwen.d.ts → qwen/index.d.ts} +1 -1
- package/dist/defs/{qwen.js → qwen/index.js} +3 -3
- package/dist/defs/{reasonix.d.ts → reasonix/index.d.ts} +1 -1
- package/dist/defs/{reasonix.js → reasonix/index.js} +3 -3
- package/dist/defs/{trae-cli.d.ts → trae-cli/index.d.ts} +1 -1
- package/dist/defs/{trae-cli.js → trae-cli/index.js} +3 -3
- package/dist/defs/{vibe.d.ts → vibe/index.d.ts} +1 -1
- package/dist/defs/{vibe.js → vibe/index.js} +3 -3
- package/dist/executables.js +1 -1
- package/dist/inventory/index.d.ts +61 -0
- package/dist/inventory/index.js +45 -0
- package/dist/json-event-stream-shared.d.ts +10 -2
- package/dist/json-event-stream-shared.js +21 -13
- package/dist/json-event-stream.js +6 -5
- package/dist/launch.js +1 -1
- package/dist/model-catalog-live-discovery.d.ts +103 -0
- package/dist/model-catalog-live-discovery.js +111 -0
- package/dist/model-discovery-adapters.d.ts +6 -1
- package/dist/model-discovery-adapters.js +4 -3
- package/dist/model-discovery-config.js +1 -1
- package/dist/native-permissions.d.ts +19 -0
- package/dist/native-permissions.js +22 -0
- package/dist/providers/anthropic-messages.js +3 -2
- package/dist/providers/connection-guard.js +99 -84
- package/dist/providers/connection-test.js +0 -5
- package/dist/providers/google-messages.js +1 -1
- package/dist/providers/oauth-provider.d.ts +1 -23
- package/dist/providers/oauth-provider.js +1 -35
- package/dist/providers/openai-chat-request.js +1 -1
- package/dist/providers/tool-loop-verdict.d.ts +1 -0
- package/dist/providers/tool-loop-verdict.js +4 -1
- package/dist/providers/tool-turn-types.d.ts +12 -9
- package/dist/providers/tool-turn.d.ts +63 -1
- package/dist/providers/tool-turn.js +67 -1
- package/dist/qoder-stream.js +66 -66
- package/dist/role-marker-guard.js +49 -30
- package/dist/runtime-def-binding.js +1 -1
- package/dist/runtime-port-bindings.d.ts +82 -0
- package/dist/runtime-port-bindings.js +4 -1
- package/dist/runtime-strategies.d.ts +100 -0
- package/dist/runtime-strategies.js +129 -0
- package/package.json +44 -10
- package/dist/defs/amp.d.ts +0 -2
- package/dist/defs/amp.js +0 -2
- package/dist/defs/amr.d.ts +0 -2
- package/dist/defs/amr.js +0 -2
- package/dist/defs/codebuddy.d.ts +0 -2
- package/dist/defs/codebuddy.js +0 -2
- package/dist/defs/hermes.d.ts +0 -2
- package/dist/defs/hermes.js +0 -2
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { getRecord } from '../../json-event-stream-shared.js';
|
|
2
|
+
/** Merge the run-scoped HTTP endpoint into OpenCode's existing inline configuration. `envVar` is the variable the
|
|
3
|
+
* runtime bound for this def's config document (the daemon no longer owns that name; K03 moves this file). */
|
|
4
|
+
// `serverName` is the key the daemon registers its bridge under.
|
|
5
|
+
export function withOpenCodeHttpMcp({ env, endpoint, envVar, serverName }) {
|
|
6
|
+
return { ...env, [envVar]: mergeOpenCodeHttpMcpConfig({ existingRaw: env[envVar], endpoint, serverName }) };
|
|
7
|
+
}
|
|
8
|
+
/** Keep OpenCode's run-local inline carrier and its existing settings/instruction merge owner.
|
|
9
|
+
* @returns Remote entry replacing stale stdio fields; only the endpoint token is delivered.
|
|
10
|
+
* @complexity O(config bytes) time/space, without I/O.
|
|
11
|
+
*/
|
|
12
|
+
export function mergeOpenCodeHttpMcpConfig({ existingRaw, endpoint, serverName }, _options = {}) {
|
|
13
|
+
return mergeEnvContentMcpConfig({ existingRaw, serverName, entry: {
|
|
14
|
+
type: 'remote', url: endpoint.url, headers: { Authorization: `Bearer ${endpoint.token}` },
|
|
15
|
+
} });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Serialises the bridge entry into the OpenCode-schema config JSON that `OPENCODE_CONFIG_CONTENT`
|
|
19
|
+
* / `MIMOCODE_CONFIG_CONTENT` carries, merging into whatever the host already put in that variable
|
|
20
|
+
* rather than replacing it — the same "merge, never clobber" discipline
|
|
21
|
+
* `mergeMcpJsonContent` (daemon `.mcp.json` merge) applies to `.mcp.json`, and for the same reason: a host may already
|
|
22
|
+
* be handing the CLI the *user's* configured MCP servers through this exact variable, and
|
|
23
|
+
* overwriting it would silently delete them.
|
|
24
|
+
*
|
|
25
|
+
* A missing, empty, or unparseable-as-a-JSON-object existing value degrades to "start from an empty
|
|
26
|
+
* document". Overwriting an unparseable value is deliberate and matches `mergeMcpJsonContent`: this
|
|
27
|
+
* driver did not create it, cannot safely repair it, and must not block the run on it.
|
|
28
|
+
*
|
|
29
|
+
* Emitted per server: `{type: 'local', command: [<command>, ...<args>], environment: {...},
|
|
30
|
+
* enabled: true}` — the shape `@jini-ai/mcp`'s own `buildOpenCodeMcpConfigContent` emits for a
|
|
31
|
+
* stdio server, so both producers stay schema-compatible.
|
|
32
|
+
*
|
|
33
|
+
* **The credential lands in `environment`, i.e. the MCP child's env — never in `command`.** OpenCode
|
|
34
|
+
* spawns the bridge from `command`, so a token placed there would be visible in `ps` output to
|
|
35
|
+
* every other local user. This is the same constraint that keeps `JINI_DAEMON_TOKEN` out of argv on
|
|
36
|
+
* the `.mcp.json` and ACP paths.
|
|
37
|
+
*
|
|
38
|
+
* @param existingRaw - Whatever the spawn env already held for this variable, or `undefined`.
|
|
39
|
+
* @param entry - The shared bridge entry from `buildMcpJsonServerEntry` (daemon).
|
|
40
|
+
* @param serverName - The `mcp` key the entry is registered under (the daemon's bridge key).
|
|
41
|
+
* @returns The full JSON string to set as the env var's value.
|
|
42
|
+
* @complexity O(1) plus `JSON.parse`/`JSON.stringify` over a small config document.
|
|
43
|
+
* @overallScore 100/100
|
|
44
|
+
*/
|
|
45
|
+
export function mergeEnvContentMcpConfig({ existingRaw, entry, serverName }) {
|
|
46
|
+
let doc = {};
|
|
47
|
+
if (existingRaw !== undefined && existingRaw.length > 0) {
|
|
48
|
+
try {
|
|
49
|
+
doc = getRecord({ value: JSON.parse(existingRaw) }) ?? doc;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
doc = {};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const existingMcp = getRecord({ value: doc.mcp }) ?? {};
|
|
56
|
+
const mcp = {
|
|
57
|
+
...existingMcp,
|
|
58
|
+
[serverName]: 'command' in entry ? {
|
|
59
|
+
type: 'local',
|
|
60
|
+
command: [entry.command, ...entry.args],
|
|
61
|
+
environment: { ...entry.env },
|
|
62
|
+
enabled: true,
|
|
63
|
+
} : entry,
|
|
64
|
+
};
|
|
65
|
+
return JSON.stringify({ ...doc, mcp });
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Merges a staged system-prompt overlay file's path into the `instructions` array of the same
|
|
69
|
+
* OpenCode-schema config document {@link mergeEnvContentMcpConfig} writes `mcp` into — for a
|
|
70
|
+
* `systemPromptDelivery: { strategy: 'config-instructions-file' }` def (`opencode` today).
|
|
71
|
+
*
|
|
72
|
+
* Confirmed live (2026-09-01, opencode-cli 1.17.10), not inferred from docs alone:
|
|
73
|
+
* 1. `instructions` is honored — a run configured with it visibly followed the file's directive
|
|
74
|
+
* (a required exact-token prefix), while an identical run without it did not.
|
|
75
|
+
* 2. It appends, never replaces: the same run that followed the custom instruction ALSO still
|
|
76
|
+
* answered correctly using opencode's own baked-in environment-context system prompt (asked
|
|
77
|
+
* for its cwd, with nothing about cwd anywhere in the custom instructions file) — proof
|
|
78
|
+
* opencode's own defaults survive alongside a custom `instructions` entry, not just proof the
|
|
79
|
+
* file was read at all.
|
|
80
|
+
* 3. Adding this key alongside `mcp` in the same `OPENCODE_CONFIG_CONTENT` document disturbs
|
|
81
|
+
* neither: in one combined run, the MCP bridge still got its connection attempt (logged
|
|
82
|
+
* `key=jini type=local`) AND the custom instruction was still followed — same as running each
|
|
83
|
+
* key alone.
|
|
84
|
+
* 4. `instructions` is re-read fresh from the env on every spawn, including a `-s <id>`-resumed
|
|
85
|
+
* turn (proved by swapping in a second instructions file between two turns of one resumed
|
|
86
|
+
* session and seeing the second turn immediately reflect it while still recalling
|
|
87
|
+
* conversation memory from turn one) — so this mechanism is safe to redeliver every turn like
|
|
88
|
+
* `'append-flag'`/`'env-var'`, exempt from the prompt-prefix fallback's create-only gating
|
|
89
|
+
* (see `resolveSystemPromptOverlayDelivery`'s doc (daemon)): nothing here is ever baked into
|
|
90
|
+
* opencode's own persisted session state the way re-injecting fallback prompt text would be.
|
|
91
|
+
*
|
|
92
|
+
* @param existingRaw - Whatever the spawn env already held for this variable (already possibly
|
|
93
|
+
* carrying `mcp`, if `mergeEnvContentMcpConfig` ran first on the same value — order between the two
|
|
94
|
+
* doesn't matter, each only touches its own top-level key), or `undefined`.
|
|
95
|
+
* @param instructionsFilePath - The staged overlay file's absolute path (see
|
|
96
|
+
* `prepareSystemPromptOverlayFileIfNeeded` (daemon)).
|
|
97
|
+
* @returns The full JSON string to set as the env var's value. Appends to, never clobbers, any
|
|
98
|
+
* `instructions` entries already present — the same "merge, never clobber" discipline
|
|
99
|
+
* {@link mergeEnvContentMcpConfig} applies to `mcp`, in case a host is already using this same
|
|
100
|
+
* config-content variable to carry the operator's own instruction files.
|
|
101
|
+
* @complexity O(1) plus `JSON.parse`/`JSON.stringify` over a small config document.
|
|
102
|
+
* @overallScore 100/100
|
|
103
|
+
*/
|
|
104
|
+
export function mergeEnvContentInstructions({ existingRaw, instructionsFilePath }) {
|
|
105
|
+
let doc = {};
|
|
106
|
+
if (existingRaw !== undefined && existingRaw.length > 0) {
|
|
107
|
+
try {
|
|
108
|
+
doc = getRecord({ value: JSON.parse(existingRaw) }) ?? doc;
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
doc = {};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const existingInstructions = Array.isArray(doc.instructions)
|
|
115
|
+
? doc.instructions.filter((entry) => typeof entry === 'string')
|
|
116
|
+
: [];
|
|
117
|
+
return JSON.stringify({ ...doc, instructions: [...existingInstructions, instructionsFilePath] });
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=mcp-config.js.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ModelConfigAdapter } from '../../model-discovery-config-types.js';
|
|
2
|
-
export declare function parseOpenCodeRecentModel(model
|
|
2
|
+
export declare function parseOpenCodeRecentModel({ model }: {
|
|
3
|
+
model: unknown;
|
|
4
|
+
}, _optional?: Record<string, never>): string | undefined;
|
|
3
5
|
export declare const opencodeModelConfig: ModelConfigAdapter;
|
|
4
6
|
//# sourceMappingURL=model-discovery.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { json, qualified, scalar } from '../../model-discovery-config-types.js';
|
|
3
|
-
export function parseOpenCodeRecentModel(model) {
|
|
3
|
+
export function parseOpenCodeRecentModel({ model }, _optional = {}) {
|
|
4
4
|
if (!Array.isArray(model))
|
|
5
5
|
return scalar({ value: model });
|
|
6
6
|
const first = model[0];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** OpenCode joins server and tool with an underscore and can emit a completed call after its
|
|
2
|
+
* bridge result. Preserve the receipt; only its correlation candidate uses the remote name.
|
|
3
|
+
* A native snake-case tool cannot fold without a matching canonical bridge row. Pure, O(n). */
|
|
4
|
+
export declare function openCodeToolCallReceipt({ event }: {
|
|
5
|
+
event: Record<string, unknown>;
|
|
6
|
+
}, _options?: {}): Record<string, unknown>;
|
|
7
|
+
//# sourceMappingURL=tool-calls.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** OpenCode joins server and tool with an underscore and can emit a completed call after its
|
|
2
|
+
* bridge result. Preserve the receipt; only its correlation candidate uses the remote name.
|
|
3
|
+
* A native snake-case tool cannot fold without a matching canonical bridge row. Pure, O(n). */
|
|
4
|
+
export function openCodeToolCallReceipt({ event }, _options = {}) {
|
|
5
|
+
if (event.type !== 'tool_use' || typeof event.name !== 'string' || event.name.startsWith('mcp__'))
|
|
6
|
+
return event;
|
|
7
|
+
const separator = event.name.indexOf('_');
|
|
8
|
+
if (separator <= 0 || separator === event.name.length - 1)
|
|
9
|
+
return event;
|
|
10
|
+
return { ...event, bridgeCall: { name: event.name.slice(separator + 1), input: event.input, buffered: true } };
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=tool-calls.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseLineSeparatedModels } from '
|
|
1
|
+
import { parseLineSeparatedModels } from '../shared.js';
|
|
2
2
|
/** Pilot of OpenCode's native ACP mode; listed in BASE_AGENT_DEFS only after the cloud parity check passes. */
|
|
3
3
|
export declare const opencodeAcpAgentDef: {
|
|
4
4
|
id: string;
|
|
@@ -39,4 +39,4 @@ export declare const opencodeAcpAgentDef: {
|
|
|
39
39
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
40
40
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
41
41
|
};
|
|
42
|
-
//# sourceMappingURL=
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
2
|
-
import { parseLineSeparatedModels } from '
|
|
3
|
-
import { opencodeAgentDef } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
2
|
+
import { parseLineSeparatedModels } from '../shared.js';
|
|
3
|
+
import { opencodeAgentDef } from '../opencode/index.js';
|
|
4
4
|
/** Pilot of OpenCode's native ACP mode; listed in BASE_AGENT_DEFS only after the cloud parity check passes. */
|
|
5
5
|
export const opencodeAcpAgentDef = {
|
|
6
6
|
...createAgentModelDiscovery('opencode', { fallbackModels: () => opencodeAgentDef.fallbackModels, args: ['models'], parse: parseLineSeparatedModels }),
|
|
@@ -20,4 +20,4 @@ export const opencodeAcpAgentDef = {
|
|
|
20
20
|
systemPromptDelivery: opencodeAgentDef.systemPromptDelivery,
|
|
21
21
|
imageDelivery: 'native',
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { DEFAULT_MODEL_OPTION, execAgentFile, parsePiModels } from '
|
|
3
|
+
import { DEFAULT_MODEL_OPTION, execAgentFile, parsePiModels } from '../shared.js';
|
|
4
4
|
function modelArgs({ options }) {
|
|
5
5
|
// pi --model accepts patterns ("sonnet", "anthropic/claude-sonnet-4-5",
|
|
6
6
|
// "openai/gpt-5:high") so we pass the value through as-is.
|
|
@@ -111,4 +111,4 @@ export const piAgentDef = {
|
|
|
111
111
|
// for this CLI's scope). There is no config surface to inject a server
|
|
112
112
|
// into; this is a permanent unwired, not a gap to close later.
|
|
113
113
|
};
|
|
114
|
-
//# sourceMappingURL=
|
|
114
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { ModelConfigAdapter } from '../../model-discovery-config-types.js';
|
|
2
|
-
export declare function parsePiDefaultModel(model
|
|
2
|
+
export declare function parsePiDefaultModel({ model, settings }: {
|
|
3
|
+
model: unknown;
|
|
4
|
+
settings: Record<string, unknown> | null;
|
|
5
|
+
}, _optional?: Record<string, never>): string | undefined;
|
|
3
6
|
export declare const piModelConfig: ModelConfigAdapter;
|
|
4
7
|
//# sourceMappingURL=model-discovery.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { json } from '../../model-discovery-config-types.js';
|
|
3
3
|
import { parseSettingsJson, qualified, scalar } from '../../model-discovery-config-types.js';
|
|
4
|
-
export function parsePiDefaultModel(model, settings) {
|
|
4
|
+
export function parsePiDefaultModel({ model, settings }, _optional = {}) {
|
|
5
5
|
const id = scalar({ value: model });
|
|
6
6
|
return id ? qualified({ provider: scalar({ value: settings?.defaultProvider }), id }) : id;
|
|
7
7
|
}
|
|
@@ -32,4 +32,4 @@ export declare const qoderAgentDef: {
|
|
|
32
32
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
33
33
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { DEFAULT_MODEL_OPTION } from '
|
|
3
|
+
import { DEFAULT_MODEL_OPTION } from '../shared.js';
|
|
4
4
|
/** Approval, workspace and model argv, in that order. */
|
|
5
5
|
function qoderRunArgs({ options, runtimeContext }) {
|
|
6
6
|
const args = [];
|
|
@@ -68,4 +68,4 @@ export const qoderAgentDef = {
|
|
|
68
68
|
// once auto-discovery's headless trust-prompt behavior is verified live
|
|
69
69
|
// for this CLI specifically.
|
|
70
70
|
};
|
|
71
|
-
//# sourceMappingURL=
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -30,4 +30,4 @@ export declare const qwenAgentDef: {
|
|
|
30
30
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
31
31
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
2
|
-
import { DEFAULT_MODEL_OPTION } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
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.
|
|
5
5
|
...createAgentModelDiscovery('qwen', { fallbackModels: () => qwenAgentDef.fallbackModels }),
|
|
@@ -41,4 +41,4 @@ export const qwenAgentDef = {
|
|
|
41
41
|
// fixed relative path rather than an env var, so it doesn't literally fit
|
|
42
42
|
// either. Needs a new settings.json-merge strategy.
|
|
43
43
|
};
|
|
44
|
-
//# sourceMappingURL=
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -42,4 +42,4 @@ export declare const reasonixAgentDef: {
|
|
|
42
42
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
43
43
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
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
|
|
5
5
|
* overlay wording. */
|
|
6
6
|
import os from 'node:os';
|
|
7
7
|
import path from 'node:path';
|
|
8
|
-
import { acpModelFetcher, DEFAULT_MODEL_OPTION } from '
|
|
8
|
+
import { acpModelFetcher, DEFAULT_MODEL_OPTION } from '../shared.js';
|
|
9
9
|
/** Resolve Reasonix's home directory, respecting REASONIX_HOME if already set. */
|
|
10
10
|
function reasonixHome() {
|
|
11
11
|
if (process.env.REASONIX_HOME)
|
|
@@ -48,4 +48,4 @@ export const reasonixAgentDef = {
|
|
|
48
48
|
installUrl: 'https://github.com/esengine/DeepSeek-Reasonix',
|
|
49
49
|
docsUrl: 'https://esengine.github.io/DeepSeek-Reasonix/',
|
|
50
50
|
};
|
|
51
|
-
//# sourceMappingURL=
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -39,4 +39,4 @@ export declare const traeCliAgentDef: {
|
|
|
39
39
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
40
40
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
41
41
|
};
|
|
42
|
-
//# sourceMappingURL=
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
2
|
-
import { acpModelFetcher, DEFAULT_MODEL_OPTION } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
2
|
+
import { acpModelFetcher, 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.
|
|
5
5
|
...createAgentModelDiscovery('trae-cli', { fallbackModels: () => traeCliAgentDef.fallbackModels }),
|
|
@@ -20,4 +20,4 @@ export const traeCliAgentDef = {
|
|
|
20
20
|
// `acp-json-rpc` def — see `types.ts#RuntimeAgentDef.imageDelivery`'s doc.
|
|
21
21
|
imageDelivery: 'native',
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -30,4 +30,4 @@ export declare const vibeAgentDef: {
|
|
|
30
30
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
31
31
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
2
|
-
import { acpModelFetcher, DEFAULT_MODEL_OPTION } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
2
|
+
import { acpModelFetcher, 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.
|
|
5
5
|
...createAgentModelDiscovery('vibe', { fallbackModels: () => vibeAgentDef.fallbackModels }),
|
|
@@ -16,4 +16,4 @@ export const vibeAgentDef = {
|
|
|
16
16
|
// `acp-json-rpc` def — see `types.ts#RuntimeAgentDef.imageDelivery`'s doc.
|
|
17
17
|
imageDelivery: 'native',
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/dist/executables.js
CHANGED
|
@@ -278,7 +278,7 @@ export function resolveAgentExecutable({ def }, options = {}) {
|
|
|
278
278
|
return inspectAgentExecutableResolution({ def: def }, options).selectedPath;
|
|
279
279
|
}
|
|
280
280
|
function bundledExecutablePaths(def, configuredEnv, resolved) {
|
|
281
|
-
const builtInPath = PACKAGED_EXECUTABLES.get(def.id)?.(configuredEnv, resolved, EXECUTABLE_HELPERS) ?? null;
|
|
281
|
+
const builtInPath = PACKAGED_EXECUTABLES.get(def.id)?.({ configuredEnv, options: resolved, services: EXECUTABLE_HELPERS }) ?? null;
|
|
282
282
|
const appBundlePath = APP_BUNDLE_EXECUTABLES.get(def.id)?.(resolved, EXECUTABLE_HELPERS) ?? null;
|
|
283
283
|
return { builtInPath, appBundlePath };
|
|
284
284
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The agent-CLI picker's inventory: which agent runtimes a host's picker lists, and how each is summarized.
|
|
3
|
+
*
|
|
4
|
+
* The same probe a host may already run for another picker (launch resolution plus a model probe), reshaped to
|
|
5
|
+
* the neutral `AgentInventorySummary`. Only runtimes that can take external tools are listed when the host's
|
|
6
|
+
* whole tool surface arrives through an injected MCP bridge: a runtime that cannot load MCP would chat with no
|
|
7
|
+
* tools at all. The host decides that eligibility through `supportsTools`.
|
|
8
|
+
*
|
|
9
|
+
* Cached once per process: a PATH probe spawns every installed CLI for its version and model list, which is far
|
|
10
|
+
* too slow to repeat on every picker mount. `rescan` forces a fresh one.
|
|
11
|
+
*/
|
|
12
|
+
import type { RuntimeAgentDef } from "@jini-ai/core/contracts/agents";
|
|
13
|
+
import type { AgentInventorySummary } from "@jini-ai/core/contracts/agents/inventory";
|
|
14
|
+
/**
|
|
15
|
+
* Runs `work`; on any failure answers `fallback`. The host binds its own fallback idiom (the shape of
|
|
16
|
+
* Core's `orFallback`), so a failed probe is observed the way the rest of the host observes them.
|
|
17
|
+
*/
|
|
18
|
+
type OrFallback = <Value>(required: {
|
|
19
|
+
work: () => Value | PromiseLike<Value>;
|
|
20
|
+
fallback: Value;
|
|
21
|
+
step: string;
|
|
22
|
+
}) => Promise<Value>;
|
|
23
|
+
/** The slice of an agent runtime this module reads — injected so tests probe nothing. */
|
|
24
|
+
interface AgentRuntimePorts {
|
|
25
|
+
defs: readonly RuntimeAgentDef[];
|
|
26
|
+
resolveLaunch: (required: {
|
|
27
|
+
def: RuntimeAgentDef;
|
|
28
|
+
}) => {
|
|
29
|
+
launchPath?: string | null;
|
|
30
|
+
diagnostic?: string | null;
|
|
31
|
+
};
|
|
32
|
+
probeModels: (required: {
|
|
33
|
+
def: RuntimeAgentDef;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
models: RuntimeAgentDef["fallbackModels"];
|
|
36
|
+
}>;
|
|
37
|
+
supportsTools: (required: {
|
|
38
|
+
def: RuntimeAgentDef;
|
|
39
|
+
}) => boolean;
|
|
40
|
+
/** A model probe that fails falls back to the def's own models through this. */
|
|
41
|
+
orFallback: OrFallback;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* One def's summary. Probes models only for an installed CLI; an absent one shows its fallbacks and
|
|
45
|
+
* says why it is unavailable.
|
|
46
|
+
* @complexity O(models + reasoning options) time and space, plus one model probe when available.
|
|
47
|
+
*/
|
|
48
|
+
declare function summarizeAgent({ def, ports }: {
|
|
49
|
+
def: RuntimeAgentDef;
|
|
50
|
+
ports: AgentRuntimePorts;
|
|
51
|
+
}, _optional?: {}): Promise<AgentInventorySummary>;
|
|
52
|
+
/**
|
|
53
|
+
* The cached lister a host's transport layer calls. Installed CLIs sort first so the picker's default is usable.
|
|
54
|
+
* @complexity O(n) defs per probe, probes run concurrently.
|
|
55
|
+
*/
|
|
56
|
+
declare function createAgentInventory(ports: AgentRuntimePorts, _optional?: {}): (required: {
|
|
57
|
+
rescan: boolean;
|
|
58
|
+
}) => Promise<AgentInventorySummary[]>;
|
|
59
|
+
export { createAgentInventory, summarizeAgent };
|
|
60
|
+
export type { AgentRuntimePorts, OrFallback };
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One def's summary. Probes models only for an installed CLI; an absent one shows its fallbacks and
|
|
3
|
+
* says why it is unavailable.
|
|
4
|
+
* @complexity O(models + reasoning options) time and space, plus one model probe when available.
|
|
5
|
+
*/
|
|
6
|
+
async function summarizeAgent({ def, ports }, _optional = {}) {
|
|
7
|
+
const launch = ports.resolveLaunch({ def });
|
|
8
|
+
const available = Boolean(launch.launchPath);
|
|
9
|
+
let models = def.fallbackModels;
|
|
10
|
+
if (available) {
|
|
11
|
+
const probe = ports.probeModels({ def });
|
|
12
|
+
models = (await ports.orFallback({ work: () => probe, fallback: { models: def.fallbackModels }, step: "Probe inventory agent models" })).models;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
id: def.id,
|
|
16
|
+
name: def.name,
|
|
17
|
+
available,
|
|
18
|
+
version: null,
|
|
19
|
+
// An explicitly empty model vocabulary must survive so the picker does not inherit agent levels.
|
|
20
|
+
models: models.map(({ id, label, reasoning }) => ({ id, label, ...(reasoning !== undefined ? { reasoning } : {}) })),
|
|
21
|
+
reasoningOptions: (def.reasoningOptions ?? []).map(({ id, label }) => ({ id, label })),
|
|
22
|
+
...(def.reasoningInModelId ? { reasoningInModelId: def.reasoningInModelId } : {}),
|
|
23
|
+
...(def.supportsCustomModel === undefined ? {} : { supportsCustomModel: def.supportsCustomModel }),
|
|
24
|
+
...(available ? {} : { diagnostic: launch.diagnostic ?? `${def.name} CLI not found on PATH` }),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The cached lister a host's transport layer calls. Installed CLIs sort first so the picker's default is usable.
|
|
29
|
+
* @complexity O(n) defs per probe, probes run concurrently.
|
|
30
|
+
*/
|
|
31
|
+
function createAgentInventory(ports, _optional = {}) {
|
|
32
|
+
let cached = null;
|
|
33
|
+
const probe = () => {
|
|
34
|
+
const pending = Promise.all(ports.defs.filter((def) => ports.supportsTools({ def })).map((def) => summarizeAgent({ def, ports })))
|
|
35
|
+
.then((rows) => [...rows].sort((a, b) => Number(b.available) - Number(a.available)));
|
|
36
|
+
// A failed probe must not poison the cache forever.
|
|
37
|
+
pending.catch(() => { if (cached === pending)
|
|
38
|
+
cached = null; });
|
|
39
|
+
cached = pending;
|
|
40
|
+
return pending;
|
|
41
|
+
};
|
|
42
|
+
return ({ rescan }) => (rescan || cached === null ? probe() : cached);
|
|
43
|
+
}
|
|
44
|
+
export { createAgentInventory, summarizeAgent };
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -33,7 +33,15 @@ export type Usage = {
|
|
|
33
33
|
export type FrameHandler = (obj: JsonObject, onEvent: StreamEventHandler, state: ParserState) => boolean;
|
|
34
34
|
/** `[vendor field, Usage field]` pairs, in the emitted key order. */
|
|
35
35
|
export type UsageFields = ReadonlyArray<readonly [string, keyof Usage]>;
|
|
36
|
-
export declare function isRecord(
|
|
36
|
+
export declare function isRecord(required: {
|
|
37
|
+
value: unknown;
|
|
38
|
+
}, _optional?: Record<string, never>): required is {
|
|
39
|
+
value: JsonObject;
|
|
40
|
+
};
|
|
41
|
+
/** Read a validated record without losing the type when the value is passed inline. */
|
|
42
|
+
export declare function getRecord(required: {
|
|
43
|
+
value: unknown;
|
|
44
|
+
}, _optional?: Record<string, never>): JsonObject | undefined;
|
|
37
45
|
export declare function nonEmptyString({ value }: {
|
|
38
46
|
value: unknown;
|
|
39
47
|
}, _optional?: Record<string, never>): string | null;
|
|
@@ -65,7 +73,7 @@ export declare function stringifyContent({ value }: {
|
|
|
65
73
|
value: unknown;
|
|
66
74
|
}, _optional?: Record<string, never>): string;
|
|
67
75
|
/** Unwrap string/record error envelopes, retaining string or numeric codes alongside messages. */
|
|
68
|
-
export declare function extractErrorMessage({ value, fallback }: {
|
|
76
|
+
export declare function extractErrorMessage({ value: input, fallback }: {
|
|
69
77
|
value: unknown;
|
|
70
78
|
fallback: string;
|
|
71
79
|
}, _optional?: Record<string, never>): string;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
export function isRecord(
|
|
1
|
+
export function isRecord(required, _optional = {}) {
|
|
2
|
+
const { value } = required;
|
|
2
3
|
return value != null && typeof value === 'object' && !Array.isArray(value);
|
|
3
4
|
}
|
|
5
|
+
/** Read a validated record without losing the type when the value is passed inline. */
|
|
6
|
+
export function getRecord(required, _optional = {}) {
|
|
7
|
+
return isRecord(required) ? required.value : undefined;
|
|
8
|
+
}
|
|
4
9
|
export function nonEmptyString({ value }, _optional = {}) {
|
|
5
10
|
return typeof value === 'string' && value ? value : null;
|
|
6
11
|
}
|
|
@@ -62,12 +67,13 @@ function isNonNullObject(value) {
|
|
|
62
67
|
return value !== null && typeof value === 'object';
|
|
63
68
|
}
|
|
64
69
|
/** Unwrap string/record error envelopes, retaining string or numeric codes alongside messages. */
|
|
65
|
-
export function extractErrorMessage({ value, fallback }, _optional = {}) {
|
|
66
|
-
if (typeof
|
|
67
|
-
const parsed = safeParseJson({ value });
|
|
68
|
-
return isNonNullObject(parsed) ? extractErrorMessage({ value: parsed, fallback:
|
|
70
|
+
export function extractErrorMessage({ value: input, fallback }, _optional = {}) {
|
|
71
|
+
if (typeof input === 'string') {
|
|
72
|
+
const parsed = safeParseJson({ value: input });
|
|
73
|
+
return isNonNullObject(parsed) ? extractErrorMessage({ value: parsed, fallback: input }) : input;
|
|
69
74
|
}
|
|
70
|
-
|
|
75
|
+
const value = getRecord({ value: input });
|
|
76
|
+
if (!value)
|
|
71
77
|
return fallback;
|
|
72
78
|
const message = extractRecordErrorMessage({ value, fallback: '' });
|
|
73
79
|
const code = typeof value.code === 'number' ? String(value.code) : trimmedNonBlank({ value: value.code });
|
|
@@ -107,8 +113,9 @@ function normalizeTodoStatus(value) {
|
|
|
107
113
|
}
|
|
108
114
|
/** Text fields of a to-do item in precedence order; the first string-typed one wins, even when empty. */
|
|
109
115
|
const TODO_CONTENT_FIELDS = ['content', 'label', 'description', 'text'];
|
|
110
|
-
function todoFromItem(
|
|
111
|
-
|
|
116
|
+
function todoFromItem(value) {
|
|
117
|
+
const raw = getRecord({ value });
|
|
118
|
+
if (!raw)
|
|
112
119
|
return null;
|
|
113
120
|
const field = TODO_CONTENT_FIELDS.find((key) => typeof raw[key] === 'string');
|
|
114
121
|
const content = field ? raw[field] : '';
|
|
@@ -136,12 +143,13 @@ export function todoWriteInputFromItems({ items }, _optional = {}) {
|
|
|
136
143
|
export function todoWriteInputFromParsedValue({ value }, _optional = {}) {
|
|
137
144
|
if (Array.isArray(value))
|
|
138
145
|
return todoWriteInputFromItems({ items: value });
|
|
139
|
-
|
|
146
|
+
const record = getRecord({ value });
|
|
147
|
+
if (!record)
|
|
140
148
|
return null;
|
|
141
|
-
if (Array.isArray(
|
|
142
|
-
return todoWriteInputFromItems({ items:
|
|
143
|
-
if (Array.isArray(
|
|
144
|
-
return todoWriteInputFromItems({ items:
|
|
149
|
+
if (Array.isArray(record.todos))
|
|
150
|
+
return todoWriteInputFromItems({ items: record.todos });
|
|
151
|
+
if (Array.isArray(record.todo))
|
|
152
|
+
return todoWriteInputFromItems({ items: record.todo });
|
|
145
153
|
return null;
|
|
146
154
|
}
|
|
147
155
|
//# sourceMappingURL=json-event-stream-shared.js.map
|
|
@@ -7,13 +7,14 @@ import { createOpenCodeStreamState, emitOpenCodeModelReceipt, handleOpenCodeEven
|
|
|
7
7
|
import { createLegacyGoogleStreamState, flushPendingArtifactText, handleLegacyGoogleStreamEvent } from './defs/gemini/event-stream.js';
|
|
8
8
|
import { handleKimiEvent } from './defs/kimi/event-stream.js';
|
|
9
9
|
import { createCursorStreamState, handleCursorEvent } from './defs/cursor-agent/event-stream.js';
|
|
10
|
-
import {
|
|
10
|
+
import { getRecord } from './json-event-stream-shared.js';
|
|
11
11
|
const MODEL_RECEIPT_FRAME_TYPES = new Set(['session.created', 'thread.started', 'turn.started', 'model.changed']);
|
|
12
12
|
const MODEL_RECEIPT_EXTRACTORS = [emitOpenCodeModelReceipt];
|
|
13
13
|
// Preserve structured model receipts before vendor event translation. These fields describe
|
|
14
14
|
// session/turn/assistant-message metadata; generated text is never used for model identity.
|
|
15
|
-
function emitModelReceipts(
|
|
16
|
-
|
|
15
|
+
function emitModelReceipts(value, onEvent) {
|
|
16
|
+
const obj = getRecord({ value });
|
|
17
|
+
if (!obj)
|
|
17
18
|
return;
|
|
18
19
|
for (const extract of MODEL_RECEIPT_EXTRACTORS)
|
|
19
20
|
extract(obj, onEvent);
|
|
@@ -22,7 +23,7 @@ function emitModelReceipts(obj, onEvent) {
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
const PARSERS_BY_KIND = new Map([
|
|
25
|
-
['antigravity', (frame, emit, state) => handleAntigravityEvent({ frame, emit, state: state.antigravity })],
|
|
26
|
+
['antigravity', ({ obj: frame, onEvent: emit, state }) => handleAntigravityEvent({ frame, emit, state: state.antigravity })],
|
|
26
27
|
['opencode', handleOpenCodeEvent],
|
|
27
28
|
['legacy-google-stream-json', handleLegacyGoogleStreamEvent],
|
|
28
29
|
['kimi', handleKimiEvent],
|
|
@@ -53,7 +54,7 @@ export function createJsonEventStreamHandler({ kind, onEvent }, _optional = {})
|
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
56
|
emitModelReceipts(obj, onEvent);
|
|
56
|
-
if (parse?.(obj, onEvent, state))
|
|
57
|
+
if (parse?.({ obj, onEvent, state }))
|
|
57
58
|
return;
|
|
58
59
|
onEvent({ type: 'raw', line });
|
|
59
60
|
}
|
package/dist/launch.js
CHANGED
|
@@ -16,7 +16,7 @@ export function resolveAgentLaunch({ def }, options = {}) {
|
|
|
16
16
|
? [path.dirname(resolution.selectedPath)]
|
|
17
17
|
: [];
|
|
18
18
|
const adapt = LAUNCH_ADAPTERS.get(def.id);
|
|
19
|
-
return { ...resolution, ...(adapt?.(resolution.selectedPath, childPathPrepend) ?? {
|
|
19
|
+
return { ...resolution, ...(adapt?.({ selectedPath: resolution.selectedPath, childPathPrepend }) ?? {
|
|
20
20
|
launchPath: resolution.selectedPath, launchKind: 'selected', childPathPrepend, diagnostic: null,
|
|
21
21
|
}) };
|
|
22
22
|
}
|