@jini-ai/agent-runtime 0.7.3-next.2 → 0.7.3-next.3
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/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 +3 -3
- package/dist/agent-protocol/acp/session-results.js +16 -16
- 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.js +3 -2
- 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 +8 -8
- 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/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/connection-guard.js +98 -83
- package/dist/providers/connection-test.js +0 -5
- package/dist/providers/oauth-provider.d.ts +1 -23
- package/dist/providers/oauth-provider.js +1 -35
- 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 +66 -0
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dispatchFrame, extractErrorMessage, initializingStatus, isRecord, optionalNumber, pickUsage, safeParseJson, stringifyContent, todoWriteInputFromParsedValue } from '../../json-event-stream-shared.js';
|
|
1
|
+
import { dispatchFrame, extractErrorMessage, getRecord, initializingStatus, isRecord, optionalNumber, pickUsage, safeParseJson, stringifyContent, todoWriteInputFromParsedValue } from '../../json-event-stream-shared.js';
|
|
2
2
|
export function createLegacyGoogleStreamState() {
|
|
3
3
|
return { suppressNextArtifactText: false, suppressDuplicateArtifactText: false, artifactOpenCandidate: '', pendingArtifactText: '' };
|
|
4
4
|
}
|
|
@@ -50,7 +50,7 @@ function handleGoogleToolUse(obj, onEvent, state) {
|
|
|
50
50
|
function handleGoogleToolResult(obj, onEvent) {
|
|
51
51
|
if (typeof obj.tool_id !== 'string')
|
|
52
52
|
return false;
|
|
53
|
-
const error =
|
|
53
|
+
const error = getRecord({ value: obj.error });
|
|
54
54
|
const errorMessage = error ? extractErrorMessage({ value: error, fallback: '' }) : '';
|
|
55
55
|
const output = typeof obj.output === 'string'
|
|
56
56
|
? obj.output
|
|
@@ -83,7 +83,7 @@ const GOOGLE_USAGE_FIELDS = [
|
|
|
83
83
|
['cached', 'cached_read_tokens'],
|
|
84
84
|
];
|
|
85
85
|
function handleGoogleResult(obj, onEvent) {
|
|
86
|
-
if (obj.status === 'error' || isRecord(obj.error)) {
|
|
86
|
+
if (obj.status === 'error' || isRecord({ value: obj.error })) {
|
|
87
87
|
onEvent({
|
|
88
88
|
type: 'error',
|
|
89
89
|
message: extractErrorMessage({ value: obj.error, fallback: 'Google stream error' }),
|
|
@@ -91,12 +91,13 @@ function handleGoogleResult(obj, onEvent) {
|
|
|
91
91
|
});
|
|
92
92
|
return true;
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
const stats = getRecord({ value: obj.stats });
|
|
95
|
+
if (!stats)
|
|
95
96
|
return true;
|
|
96
97
|
onEvent({
|
|
97
98
|
type: 'usage',
|
|
98
|
-
usage: pickUsage({ source:
|
|
99
|
-
durationMs: optionalNumber({ value:
|
|
99
|
+
usage: pickUsage({ source: stats, fields: GOOGLE_USAGE_FIELDS }),
|
|
100
|
+
durationMs: optionalNumber({ value: stats.duration_ms }),
|
|
100
101
|
});
|
|
101
102
|
return true;
|
|
102
103
|
}
|
|
@@ -109,8 +110,9 @@ const GOOGLE_FRAME_HANDLERS = new Map([
|
|
|
109
110
|
['result', handleGoogleResult],
|
|
110
111
|
]);
|
|
111
112
|
// Retain the neutral legacy wire decoder for stored streams; no CLI agent uses this kind.
|
|
112
|
-
export function handleLegacyGoogleStreamEvent(obj, onEvent, state) {
|
|
113
|
-
|
|
113
|
+
export function handleLegacyGoogleStreamEvent({ obj: value, onEvent, state }, _optional = {}) {
|
|
114
|
+
const obj = getRecord({ value });
|
|
115
|
+
if (!obj)
|
|
114
116
|
return false;
|
|
115
117
|
if (!isGoogleAssistantText(obj)) {
|
|
116
118
|
flushPendingArtifactText({ state, onEvent });
|
|
@@ -136,7 +138,7 @@ function stripDuplicateArtifactText(text, state) {
|
|
|
136
138
|
}
|
|
137
139
|
const openIndex = current.indexOf(openTag);
|
|
138
140
|
if (openIndex === -1) {
|
|
139
|
-
const candidateLength = artifactOpenCandidateLength(current, openTag);
|
|
141
|
+
const candidateLength = artifactOpenCandidateLength({ text: current, openTag });
|
|
140
142
|
if (state.legacyGoogle.suppressNextArtifactText && candidateLength > 0) {
|
|
141
143
|
state.legacyGoogle.artifactOpenCandidate = current.slice(-candidateLength);
|
|
142
144
|
return current.slice(0, -candidateLength);
|
|
@@ -159,7 +161,7 @@ function stripDuplicateArtifactText(text, state) {
|
|
|
159
161
|
state.legacyGoogle.pendingArtifactText = '';
|
|
160
162
|
return `${prefix}${stripDuplicateArtifactText(current.slice(openIndex), state)}`;
|
|
161
163
|
}
|
|
162
|
-
function artifactOpenCandidateLength(text, openTag) {
|
|
164
|
+
function artifactOpenCandidateLength({ text, openTag }, _optional = {}) {
|
|
163
165
|
const max = Math.min(openTag.length - 1, text.length);
|
|
164
166
|
for (let len = max; len > 0; len -= 1) {
|
|
165
167
|
if (openTag.startsWith(text.slice(-len)))
|
|
@@ -176,8 +178,9 @@ export function flushPendingArtifactText({ state, onEvent }, _optional = {}) {
|
|
|
176
178
|
state.legacyGoogle.suppressNextArtifactText = false;
|
|
177
179
|
onEvent({ type: 'text_delta', delta });
|
|
178
180
|
}
|
|
179
|
-
function isFileWriteToolUse(toolName,
|
|
180
|
-
|
|
181
|
+
function isFileWriteToolUse(toolName, value) {
|
|
182
|
+
const input = getRecord({ value });
|
|
183
|
+
if (!input)
|
|
181
184
|
return false;
|
|
182
185
|
const path = [input.file_path, input.path].find((value) => typeof value === 'string') ?? '';
|
|
183
186
|
const writesFile = toolName === 'write_file' ||
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Gemini's legacy stream reports bare MCP names, indistinguishable from native tool names.
|
|
2
|
+
* Correlation is only a candidate: the shared fold requires a real bridge row with equal input.
|
|
3
|
+
* Keep native names/arguments intact for presentation and auditing. Pure, O(1). */
|
|
4
|
+
export declare function geminiToolCallReceipt({ event }: {
|
|
5
|
+
event: Record<string, unknown>;
|
|
6
|
+
}, _options?: {}): Record<string, unknown>;
|
|
7
|
+
//# sourceMappingURL=tool-calls.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Gemini's legacy stream reports bare MCP names, indistinguishable from native tool names.
|
|
2
|
+
* Correlation is only a candidate: the shared fold requires a real bridge row with equal input.
|
|
3
|
+
* Keep native names/arguments intact for presentation and auditing. Pure, O(1). */
|
|
4
|
+
export function geminiToolCallReceipt({ event }, _options = {}) {
|
|
5
|
+
if (event.type !== 'tool_use' || typeof event.name !== 'string' || event.name.startsWith('mcp__'))
|
|
6
|
+
return event;
|
|
7
|
+
return { ...event, bridgeCall: { name: event.name, input: event.input } };
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=tool-calls.js.map
|
|
@@ -30,4 +30,4 @@ export declare const gooseAgentDef: {
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
2
2
|
/**
|
|
3
3
|
* @module defs/goose
|
|
4
4
|
*
|
|
@@ -10,7 +10,7 @@ import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
|
10
10
|
* machine that has only that one, detection will list goose as installed and the first run will
|
|
11
11
|
* fail on the unknown `acp` command.
|
|
12
12
|
*/
|
|
13
|
-
import { acpModelFetcher, DEFAULT_MODEL_OPTION } from '
|
|
13
|
+
import { acpModelFetcher, DEFAULT_MODEL_OPTION } from '../shared.js';
|
|
14
14
|
export const gooseAgentDef = {
|
|
15
15
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
|
16
16
|
...createAgentModelDiscovery('goose', { fallbackModels: () => gooseAgentDef.fallbackModels }),
|
|
@@ -27,4 +27,4 @@ export const gooseAgentDef = {
|
|
|
27
27
|
// `acp-json-rpc` def — see `types.ts#RuntimeAgentDef.imageDelivery`'s doc.
|
|
28
28
|
imageDelivery: 'native',
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -47,4 +47,4 @@ export declare const grokBuildAgentDef: {
|
|
|
47
47
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
48
48
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
49
49
|
};
|
|
50
|
-
//# sourceMappingURL=
|
|
50
|
+
//# 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
|
/** Agent id, binary name and the routing-mode default model id. */
|
|
4
4
|
const GROK_BUILD_ID = 'grok-build';
|
|
5
5
|
const GROK_MODEL_ID_RE = /^(?:[*•-]\s*|(?=grok-))([a-z0-9][a-z0-9./_:@\[\]-]*)(?:\s+\(default\))?\s*$/i;
|
|
@@ -110,4 +110,4 @@ export const grokBuildAgentDef = {
|
|
|
110
110
|
// `buildClaudeMcpConfigArgs`'s doc), unverified here. Needs live
|
|
111
111
|
// verification before any strategy — new or reused — is safe to assign.
|
|
112
112
|
};
|
|
113
|
-
//# sourceMappingURL=
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
package/dist/defs/index.d.ts
CHANGED
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
* @module defs/index
|
|
3
3
|
* Declarative per-CLI RuntimeAgentDef catalog with AMR/Vela parsing and Antigravity's model lock.
|
|
4
4
|
*/
|
|
5
|
-
export * from './aider.js';
|
|
6
|
-
export * from './amp.js';
|
|
7
|
-
export * from './amr.js';
|
|
5
|
+
export * from './aider/index.js';
|
|
6
|
+
export * from './amp/index.js';
|
|
7
|
+
export * from './amr/index.js';
|
|
8
8
|
export * from './antigravity/index.js';
|
|
9
|
-
export * from './auggie.js';
|
|
10
|
-
export * from './claude.js';
|
|
11
|
-
export * from './cline.js';
|
|
12
|
-
export * from './codebuddy.js';
|
|
13
|
-
export * from './codex.js';
|
|
14
|
-
export * from './crush.js';
|
|
15
|
-
export * from './cursor-agent.js';
|
|
16
|
-
export * from './droid.js';
|
|
17
|
-
export * from './deepseek.js';
|
|
18
|
-
export * from './devin.js';
|
|
19
|
-
export * from './goose.js';
|
|
20
|
-
export * from './grok-build.js';
|
|
21
|
-
export * from './hermes.js';
|
|
22
|
-
export * from './kilo.js';
|
|
23
|
-
export * from './kimi.js';
|
|
24
|
-
export * from './kiro.js';
|
|
25
|
-
export * from './mimo.js';
|
|
26
|
-
export * from './opencode-acp.js';
|
|
27
|
-
export * from './opencode.js';
|
|
28
|
-
export * from './pi.js';
|
|
29
|
-
export * from './qoder.js';
|
|
30
|
-
export * from './qwen.js';
|
|
31
|
-
export * from './reasonix.js';
|
|
32
|
-
export * from './trae-cli.js';
|
|
33
|
-
export * from './vibe.js';
|
|
9
|
+
export * from './auggie/index.js';
|
|
10
|
+
export * from './claude/index.js';
|
|
11
|
+
export * from './cline/index.js';
|
|
12
|
+
export * from './codebuddy/index.js';
|
|
13
|
+
export * from './codex/index.js';
|
|
14
|
+
export * from './crush/index.js';
|
|
15
|
+
export * from './cursor-agent/index.js';
|
|
16
|
+
export * from './droid/index.js';
|
|
17
|
+
export * from './deepseek/index.js';
|
|
18
|
+
export * from './devin/index.js';
|
|
19
|
+
export * from './goose/index.js';
|
|
20
|
+
export * from './grok-build/index.js';
|
|
21
|
+
export * from './hermes/index.js';
|
|
22
|
+
export * from './kilo/index.js';
|
|
23
|
+
export * from './kimi/index.js';
|
|
24
|
+
export * from './kiro/index.js';
|
|
25
|
+
export * from './mimo/index.js';
|
|
26
|
+
export * from './opencode-acp/index.js';
|
|
27
|
+
export * from './opencode/index.js';
|
|
28
|
+
export * from './pi/index.js';
|
|
29
|
+
export * from './qoder/index.js';
|
|
30
|
+
export * from './qwen/index.js';
|
|
31
|
+
export * from './reasonix/index.js';
|
|
32
|
+
export * from './trae-cli/index.js';
|
|
33
|
+
export * from './vibe/index.js';
|
|
34
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/defs/index.js
CHANGED
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
* @module defs/index
|
|
3
3
|
* Declarative per-CLI RuntimeAgentDef catalog with AMR/Vela parsing and Antigravity's model lock.
|
|
4
4
|
*/
|
|
5
|
-
export * from './aider.js';
|
|
6
|
-
export * from './amp.js';
|
|
7
|
-
export * from './amr.js';
|
|
5
|
+
export * from './aider/index.js';
|
|
6
|
+
export * from './amp/index.js';
|
|
7
|
+
export * from './amr/index.js';
|
|
8
8
|
export * from './antigravity/index.js';
|
|
9
|
-
export * from './auggie.js';
|
|
10
|
-
export * from './claude.js';
|
|
11
|
-
export * from './cline.js';
|
|
12
|
-
export * from './codebuddy.js';
|
|
13
|
-
export * from './codex.js';
|
|
14
|
-
export * from './crush.js';
|
|
15
|
-
export * from './cursor-agent.js';
|
|
16
|
-
export * from './droid.js';
|
|
17
|
-
export * from './deepseek.js';
|
|
18
|
-
export * from './devin.js';
|
|
19
|
-
export * from './goose.js';
|
|
20
|
-
export * from './grok-build.js';
|
|
21
|
-
export * from './hermes.js';
|
|
22
|
-
export * from './kilo.js';
|
|
23
|
-
export * from './kimi.js';
|
|
24
|
-
export * from './kiro.js';
|
|
25
|
-
export * from './mimo.js';
|
|
26
|
-
export * from './opencode-acp.js';
|
|
27
|
-
export * from './opencode.js';
|
|
28
|
-
export * from './pi.js';
|
|
29
|
-
export * from './qoder.js';
|
|
30
|
-
export * from './qwen.js';
|
|
31
|
-
export * from './reasonix.js';
|
|
32
|
-
export * from './trae-cli.js';
|
|
33
|
-
export * from './vibe.js';
|
|
9
|
+
export * from './auggie/index.js';
|
|
10
|
+
export * from './claude/index.js';
|
|
11
|
+
export * from './cline/index.js';
|
|
12
|
+
export * from './codebuddy/index.js';
|
|
13
|
+
export * from './codex/index.js';
|
|
14
|
+
export * from './crush/index.js';
|
|
15
|
+
export * from './cursor-agent/index.js';
|
|
16
|
+
export * from './droid/index.js';
|
|
17
|
+
export * from './deepseek/index.js';
|
|
18
|
+
export * from './devin/index.js';
|
|
19
|
+
export * from './goose/index.js';
|
|
20
|
+
export * from './grok-build/index.js';
|
|
21
|
+
export * from './hermes/index.js';
|
|
22
|
+
export * from './kilo/index.js';
|
|
23
|
+
export * from './kimi/index.js';
|
|
24
|
+
export * from './kiro/index.js';
|
|
25
|
+
export * from './mimo/index.js';
|
|
26
|
+
export * from './opencode-acp/index.js';
|
|
27
|
+
export * from './opencode/index.js';
|
|
28
|
+
export * from './pi/index.js';
|
|
29
|
+
export * from './qoder/index.js';
|
|
30
|
+
export * from './qwen/index.js';
|
|
31
|
+
export * from './reasonix/index.js';
|
|
32
|
+
export * from './trae-cli/index.js';
|
|
33
|
+
export * from './vibe/index.js';
|
|
34
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -30,4 +30,4 @@ export declare const kiloAgentDef: {
|
|
|
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 kiloAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
|
5
5
|
...createAgentModelDiscovery('kilo', { fallbackModels: () => kiloAgentDef.fallbackModels }),
|
|
@@ -16,4 +16,4 @@ export const kiloAgentDef = {
|
|
|
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
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { StreamEventHandler } from '../../json-event-stream-shared.js';
|
|
2
|
-
export declare function handleKimiEvent(obj:
|
|
2
|
+
export declare function handleKimiEvent({ obj: value, onEvent }: {
|
|
3
|
+
obj: unknown;
|
|
4
|
+
onEvent: StreamEventHandler;
|
|
5
|
+
}, _optional?: Record<string, never>): boolean;
|
|
3
6
|
//# sourceMappingURL=event-stream.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getRecord, nonEmptyString, safeParseJson, stringifyContent, trimmedNonBlank } from '../../json-event-stream-shared.js';
|
|
2
2
|
function emitKimiToolCalls(toolCalls, onEvent) {
|
|
3
3
|
for (const rawCall of toolCalls) {
|
|
4
|
-
const call =
|
|
5
|
-
const fn =
|
|
4
|
+
const call = getRecord({ value: rawCall }) ?? {};
|
|
5
|
+
const fn = getRecord({ value: call.function }) ?? {};
|
|
6
6
|
const id = trimmedNonBlank({ value: call.id });
|
|
7
7
|
const name = trimmedNonBlank({ value: fn.name });
|
|
8
8
|
if (!id || !name)
|
|
@@ -34,8 +34,9 @@ function handleKimiToolResult(obj, onEvent) {
|
|
|
34
34
|
});
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
|
-
export function handleKimiEvent(obj, onEvent) {
|
|
38
|
-
|
|
37
|
+
export function handleKimiEvent({ obj: value, onEvent }, _optional = {}) {
|
|
38
|
+
const obj = getRecord({ value });
|
|
39
|
+
if (!obj)
|
|
39
40
|
return false;
|
|
40
41
|
if (obj.role === 'assistant')
|
|
41
42
|
return handleKimiAssistant(obj, onEvent);
|
|
@@ -31,4 +31,4 @@ export declare const kimiAgentDef: {
|
|
|
31
31
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
32
32
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=
|
|
34
|
+
//# 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 kimiAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
|
5
5
|
...createAgentModelDiscovery('kimi', { fallbackModels: () => kimiAgentDef.fallbackModels }),
|
|
@@ -22,4 +22,4 @@ export const kimiAgentDef = {
|
|
|
22
22
|
// `acp-json-rpc` def — see `types.ts#RuntimeAgentDef.imageDelivery`'s doc.
|
|
23
23
|
imageDelivery: 'native',
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -30,4 +30,4 @@ export declare const kiroAgentDef: {
|
|
|
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 kiroAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
|
5
5
|
...createAgentModelDiscovery('kiro', { fallbackModels: () => kiroAgentDef.fallbackModels }),
|
|
@@ -16,4 +16,4 @@ export const kiroAgentDef = {
|
|
|
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
|
|
@@ -32,4 +32,4 @@ export declare const mimoAgentDef: {
|
|
|
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,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 mimoAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
|
5
5
|
...createAgentModelDiscovery('mimo', { fallbackModels: () => mimoAgentDef.fallbackModels }),
|
|
@@ -25,4 +25,4 @@ export const mimoAgentDef = {
|
|
|
25
25
|
// same structure as OPENCODE_CONFIG_CONTENT.
|
|
26
26
|
externalMcpInjection: 'mimo-env-content',
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -4,5 +4,9 @@ export type OpenCodeStreamState = {
|
|
|
4
4
|
};
|
|
5
5
|
export declare function createOpenCodeStreamState(): OpenCodeStreamState;
|
|
6
6
|
export declare function emitOpenCodeModelReceipt(obj: JsonObject, onEvent: StreamEventHandler): void;
|
|
7
|
-
export declare function handleOpenCodeEvent(obj:
|
|
7
|
+
export declare function handleOpenCodeEvent({ obj: value, onEvent, state }: {
|
|
8
|
+
obj: unknown;
|
|
9
|
+
onEvent: StreamEventHandler;
|
|
10
|
+
state: ParserState;
|
|
11
|
+
}, _optional?: Record<string, never>): boolean;
|
|
8
12
|
//# sourceMappingURL=event-stream.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dispatchFrame, extractErrorMessage,
|
|
1
|
+
import { dispatchFrame, extractErrorMessage, getRecord, nonEmptyString, optionalNumber, pickUsage, safeParseJson, stringifyContent } from '../../json-event-stream-shared.js';
|
|
2
2
|
export function createOpenCodeStreamState() { return { toolUses: new Set() }; }
|
|
3
3
|
export function emitOpenCodeModelReceipt(obj, onEvent) {
|
|
4
4
|
const properties = obj.properties;
|
|
@@ -16,17 +16,18 @@ const OPENCODE_CACHE_USAGE_FIELDS = [
|
|
|
16
16
|
['read', 'cached_read_tokens'],
|
|
17
17
|
['write', 'cached_write_tokens'],
|
|
18
18
|
];
|
|
19
|
-
function formatOpenCodeUsage(
|
|
20
|
-
|
|
19
|
+
function formatOpenCodeUsage(value) {
|
|
20
|
+
const tokens = getRecord({ value });
|
|
21
|
+
if (!tokens)
|
|
21
22
|
return null;
|
|
22
|
-
const usage = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const usage = pickUsage({ source: tokens, fields: OPENCODE_USAGE_FIELDS });
|
|
24
|
+
const cache = getRecord({ value: tokens.cache });
|
|
25
|
+
if (cache)
|
|
26
|
+
Object.assign(usage, pickUsage({ source: cache, fields: OPENCODE_CACHE_USAGE_FIELDS }));
|
|
26
27
|
return Object.keys(usage).length > 0 ? usage : null;
|
|
27
28
|
}
|
|
28
29
|
function openCodePart(obj) {
|
|
29
|
-
return
|
|
30
|
+
return getRecord({ value: obj.part }) ?? {};
|
|
30
31
|
}
|
|
31
32
|
function handleOpenCodeStepStart(obj, onEvent) {
|
|
32
33
|
// `sessionID` is OpenCode's own session handle (capture-style resume).
|
|
@@ -48,7 +49,7 @@ function handleOpenCodeToolUse(obj, onEvent, state) {
|
|
|
48
49
|
const part = openCodePart(obj);
|
|
49
50
|
if (typeof part.tool !== 'string' || typeof part.callID !== 'string')
|
|
50
51
|
return false;
|
|
51
|
-
const statePart =
|
|
52
|
+
const statePart = getRecord({ value: part.state }) ?? {};
|
|
52
53
|
const key = `${obj.sessionID || 'session'}:${part.callID}`;
|
|
53
54
|
if (!state.opencode.toolUses.has(key)) {
|
|
54
55
|
state.opencode.toolUses.add(key);
|
|
@@ -100,8 +101,9 @@ const OPENCODE_FRAME_HANDLERS = new Map([
|
|
|
100
101
|
['step_finish', handleOpenCodeStepFinish],
|
|
101
102
|
['error', handleOpenCodeError],
|
|
102
103
|
]);
|
|
103
|
-
export function handleOpenCodeEvent(obj, onEvent, state) {
|
|
104
|
-
|
|
104
|
+
export function handleOpenCodeEvent({ obj: value, onEvent, state }, _optional = {}) {
|
|
105
|
+
const obj = getRecord({ value });
|
|
106
|
+
if (!obj)
|
|
105
107
|
return false;
|
|
106
108
|
return dispatchFrame({ handlers: OPENCODE_FRAME_HANDLERS, obj, onEvent, state });
|
|
107
109
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseLineSeparatedModels } from '
|
|
1
|
+
import { parseLineSeparatedModels } from '../shared.js';
|
|
2
2
|
import type { RuntimeBuildOptions, RuntimeContext } from '@jini-ai/core/contracts/agents';
|
|
3
3
|
export declare const opencodeAgentDef: {
|
|
4
4
|
id: string;
|
|
@@ -52,4 +52,4 @@ export declare const opencodeAgentDef: {
|
|
|
52
52
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
53
53
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
2
|
-
import { DEFAULT_MODEL_OPTION, parseLineSeparatedModels } from '
|
|
3
|
-
import { agentCapabilities } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
2
|
+
import { DEFAULT_MODEL_OPTION, parseLineSeparatedModels } from '../shared.js';
|
|
3
|
+
import { agentCapabilities } from '../../capabilities.js';
|
|
4
4
|
const SKIP_PERMISSIONS_FLAG = '--dangerously-skip-permissions';
|
|
5
5
|
// Gated on two independent things: whether this OpenCode build even supports the flag
|
|
6
6
|
// (`skipPermissions`, probed from `--help` text) AND whether the caller wants it — see
|
|
@@ -93,7 +93,7 @@ export const opencodeAgentDef = {
|
|
|
93
93
|
// `instructions` (an array of file paths or remote URLs — confirmed live an inline string is
|
|
94
94
|
// silently ignored, never honored) is OpenCode's real, native system-prompt-append mechanism.
|
|
95
95
|
// Live-verified against an installed `opencode-cli` (1.17.10), not inferred from docs alone —
|
|
96
|
-
// see
|
|
96
|
+
// see `mergeEnvContentInstructions` (`./mcp-config.ts`) for the full transcript summary:
|
|
97
97
|
// 1. The field is honored — a run configured with it visibly followed the instruction file's
|
|
98
98
|
// directive; an identical run without it did not.
|
|
99
99
|
// 2. It appends, never replaces: the same run that followed the custom instruction ALSO still
|
|
@@ -110,4 +110,4 @@ export const opencodeAgentDef = {
|
|
|
110
110
|
// deliberately; do not assume it behaves identically without checking live.
|
|
111
111
|
systemPromptDelivery: { strategy: 'config-instructions-file', varName: 'OPENCODE_CONFIG_CONTENT' },
|
|
112
112
|
};
|
|
113
|
-
//# sourceMappingURL=
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/** The bridge entry the daemon hands over, structurally its `McpJsonServerEntry`: the daemon owns that shape, this file only reads it. */
|
|
2
|
+
type StdioBridgeEntry = {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly args: readonly string[];
|
|
5
|
+
readonly env: Readonly<Record<string, string>>;
|
|
6
|
+
};
|
|
7
|
+
type RemoteBridgeEntry = {
|
|
8
|
+
readonly type: 'remote';
|
|
9
|
+
readonly url: string;
|
|
10
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
11
|
+
};
|
|
12
|
+
type HttpEndpoint = {
|
|
13
|
+
readonly url: string;
|
|
14
|
+
readonly token: string;
|
|
15
|
+
};
|
|
16
|
+
/** Merge the run-scoped HTTP endpoint into OpenCode's existing inline configuration. `envVar` is the variable the
|
|
17
|
+
* runtime bound for this def's config document (the daemon no longer owns that name; K03 moves this file). */
|
|
18
|
+
export declare function withOpenCodeHttpMcp({ env, endpoint, envVar, serverName }: {
|
|
19
|
+
env: NodeJS.ProcessEnv;
|
|
20
|
+
endpoint: HttpEndpoint;
|
|
21
|
+
envVar: string;
|
|
22
|
+
serverName: string;
|
|
23
|
+
}): NodeJS.ProcessEnv;
|
|
24
|
+
/** Keep OpenCode's run-local inline carrier and its existing settings/instruction merge owner.
|
|
25
|
+
* @returns Remote entry replacing stale stdio fields; only the endpoint token is delivered.
|
|
26
|
+
* @complexity O(config bytes) time/space, without I/O.
|
|
27
|
+
*/
|
|
28
|
+
export declare function mergeOpenCodeHttpMcpConfig({ existingRaw, endpoint, serverName }: {
|
|
29
|
+
existingRaw: string | undefined;
|
|
30
|
+
endpoint: HttpEndpoint;
|
|
31
|
+
serverName: string;
|
|
32
|
+
}, _options?: {}): string;
|
|
33
|
+
/**
|
|
34
|
+
* Serialises the bridge entry into the OpenCode-schema config JSON that `OPENCODE_CONFIG_CONTENT`
|
|
35
|
+
* / `MIMOCODE_CONFIG_CONTENT` carries, merging into whatever the host already put in that variable
|
|
36
|
+
* rather than replacing it — the same "merge, never clobber" discipline
|
|
37
|
+
* `mergeMcpJsonContent` (daemon `.mcp.json` merge) applies to `.mcp.json`, and for the same reason: a host may already
|
|
38
|
+
* be handing the CLI the *user's* configured MCP servers through this exact variable, and
|
|
39
|
+
* overwriting it would silently delete them.
|
|
40
|
+
*
|
|
41
|
+
* A missing, empty, or unparseable-as-a-JSON-object existing value degrades to "start from an empty
|
|
42
|
+
* document". Overwriting an unparseable value is deliberate and matches `mergeMcpJsonContent`: this
|
|
43
|
+
* driver did not create it, cannot safely repair it, and must not block the run on it.
|
|
44
|
+
*
|
|
45
|
+
* Emitted per server: `{type: 'local', command: [<command>, ...<args>], environment: {...},
|
|
46
|
+
* enabled: true}` — the shape `@jini-ai/mcp`'s own `buildOpenCodeMcpConfigContent` emits for a
|
|
47
|
+
* stdio server, so both producers stay schema-compatible.
|
|
48
|
+
*
|
|
49
|
+
* **The credential lands in `environment`, i.e. the MCP child's env — never in `command`.** OpenCode
|
|
50
|
+
* spawns the bridge from `command`, so a token placed there would be visible in `ps` output to
|
|
51
|
+
* every other local user. This is the same constraint that keeps `JINI_DAEMON_TOKEN` out of argv on
|
|
52
|
+
* the `.mcp.json` and ACP paths.
|
|
53
|
+
*
|
|
54
|
+
* @param existingRaw - Whatever the spawn env already held for this variable, or `undefined`.
|
|
55
|
+
* @param entry - The shared bridge entry from `buildMcpJsonServerEntry` (daemon).
|
|
56
|
+
* @param serverName - The `mcp` key the entry is registered under (the daemon's bridge key).
|
|
57
|
+
* @returns The full JSON string to set as the env var's value.
|
|
58
|
+
* @complexity O(1) plus `JSON.parse`/`JSON.stringify` over a small config document.
|
|
59
|
+
* @overallScore 100/100
|
|
60
|
+
*/
|
|
61
|
+
export declare function mergeEnvContentMcpConfig({ existingRaw, entry, serverName }: {
|
|
62
|
+
readonly existingRaw: string | undefined;
|
|
63
|
+
readonly entry: StdioBridgeEntry | RemoteBridgeEntry;
|
|
64
|
+
readonly serverName: string;
|
|
65
|
+
}): string;
|
|
66
|
+
/**
|
|
67
|
+
* Merges a staged system-prompt overlay file's path into the `instructions` array of the same
|
|
68
|
+
* OpenCode-schema config document {@link mergeEnvContentMcpConfig} writes `mcp` into — for a
|
|
69
|
+
* `systemPromptDelivery: { strategy: 'config-instructions-file' }` def (`opencode` today).
|
|
70
|
+
*
|
|
71
|
+
* Confirmed live (2026-09-01, opencode-cli 1.17.10), not inferred from docs alone:
|
|
72
|
+
* 1. `instructions` is honored — a run configured with it visibly followed the file's directive
|
|
73
|
+
* (a required exact-token prefix), while an identical run without it did not.
|
|
74
|
+
* 2. It appends, never replaces: the same run that followed the custom instruction ALSO still
|
|
75
|
+
* answered correctly using opencode's own baked-in environment-context system prompt (asked
|
|
76
|
+
* for its cwd, with nothing about cwd anywhere in the custom instructions file) — proof
|
|
77
|
+
* opencode's own defaults survive alongside a custom `instructions` entry, not just proof the
|
|
78
|
+
* file was read at all.
|
|
79
|
+
* 3. Adding this key alongside `mcp` in the same `OPENCODE_CONFIG_CONTENT` document disturbs
|
|
80
|
+
* neither: in one combined run, the MCP bridge still got its connection attempt (logged
|
|
81
|
+
* `key=jini type=local`) AND the custom instruction was still followed — same as running each
|
|
82
|
+
* key alone.
|
|
83
|
+
* 4. `instructions` is re-read fresh from the env on every spawn, including a `-s <id>`-resumed
|
|
84
|
+
* turn (proved by swapping in a second instructions file between two turns of one resumed
|
|
85
|
+
* session and seeing the second turn immediately reflect it while still recalling
|
|
86
|
+
* conversation memory from turn one) — so this mechanism is safe to redeliver every turn like
|
|
87
|
+
* `'append-flag'`/`'env-var'`, exempt from the prompt-prefix fallback's create-only gating
|
|
88
|
+
* (see `resolveSystemPromptOverlayDelivery`'s doc (daemon)): nothing here is ever baked into
|
|
89
|
+
* opencode's own persisted session state the way re-injecting fallback prompt text would be.
|
|
90
|
+
*
|
|
91
|
+
* @param existingRaw - Whatever the spawn env already held for this variable (already possibly
|
|
92
|
+
* carrying `mcp`, if `mergeEnvContentMcpConfig` ran first on the same value — order between the two
|
|
93
|
+
* doesn't matter, each only touches its own top-level key), or `undefined`.
|
|
94
|
+
* @param instructionsFilePath - The staged overlay file's absolute path (see
|
|
95
|
+
* `prepareSystemPromptOverlayFileIfNeeded` (daemon)).
|
|
96
|
+
* @returns The full JSON string to set as the env var's value. Appends to, never clobbers, any
|
|
97
|
+
* `instructions` entries already present — the same "merge, never clobber" discipline
|
|
98
|
+
* {@link mergeEnvContentMcpConfig} applies to `mcp`, in case a host is already using this same
|
|
99
|
+
* config-content variable to carry the operator's own instruction files.
|
|
100
|
+
* @complexity O(1) plus `JSON.parse`/`JSON.stringify` over a small config document.
|
|
101
|
+
* @overallScore 100/100
|
|
102
|
+
*/
|
|
103
|
+
export declare function mergeEnvContentInstructions({ existingRaw, instructionsFilePath }: {
|
|
104
|
+
readonly existingRaw: string | undefined;
|
|
105
|
+
readonly instructionsFilePath: string;
|
|
106
|
+
}): string;
|
|
107
|
+
export {};
|
|
108
|
+
//# sourceMappingURL=mcp-config.d.ts.map
|