@jini-ai/agent-runtime 0.6.15-rc.1 → 0.6.15
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/dist/agent-protocol/acp/rpc.js +4 -8
- package/dist/agent-protocol/acp/session.js +38 -47
- package/dist/agent-protocol/acp/text-suppression.js +10 -7
- package/dist/agent-protocol/acp/updates.js +4 -5
- package/dist/agent-protocol/core/json-line-stream.d.ts +6 -3
- package/dist/agent-protocol/core/json-line-stream.js +9 -10
- package/dist/agent-protocol/pi-rpc/events.js +27 -27
- package/dist/agent-protocol/pi-rpc/models.js +13 -11
- package/dist/agent-protocol/pi-rpc/session.js +7 -7
- package/dist/ai-trace/classify.js +4 -1
- package/dist/ai-trace/sinks.js +19 -3
- package/dist/ai-trace/usage.js +3 -1
- package/dist/anthropic-live-models.js +0 -0
- package/dist/auth.js +20 -17
- package/dist/claude-code-models.js +29 -17
- package/dist/claude-filesystem-policy.d.ts +4 -3
- package/dist/claude-filesystem-policy.js +39 -12
- package/dist/claude-stream.js +65 -47
- package/dist/copilot-stream.js +14 -11
- package/dist/core/model-discovery-shared.js +4 -2
- package/dist/core/omit-keys.d.ts +7 -0
- package/dist/core/omit-keys.js +12 -0
- package/dist/defs/aider.d.ts +1 -1
- package/dist/defs/amp.d.ts +1 -1
- package/dist/defs/amr.js +5 -9
- package/dist/defs/antigravity-event-stream.d.ts +19 -0
- package/dist/defs/antigravity-event-stream.js +83 -0
- package/dist/defs/antigravity.d.ts +4 -0
- package/dist/defs/antigravity.js +27 -15
- package/dist/defs/auggie.d.ts +3 -3
- package/dist/defs/claude.d.ts +3 -3
- package/dist/defs/cline.d.ts +3 -3
- package/dist/defs/codebuddy.d.ts +1 -1
- package/dist/defs/codex.js +3 -2
- package/dist/defs/copilot.d.ts +1 -1
- package/dist/defs/crush.d.ts +1 -1
- package/dist/defs/cursor-agent.d.ts +3 -1
- package/dist/defs/cursor-agent.js +8 -6
- package/dist/defs/deepseek.d.ts +1 -1
- package/dist/defs/devin.d.ts +3 -3
- package/dist/defs/droid.d.ts +1 -1
- package/dist/defs/goose.d.ts +3 -3
- package/dist/defs/grok-build.js +7 -5
- package/dist/defs/hermes.d.ts +3 -3
- package/dist/defs/kilo.d.ts +3 -3
- package/dist/defs/kimi.d.ts +3 -3
- package/dist/defs/kiro.d.ts +3 -3
- package/dist/defs/mimo.d.ts +1 -1
- package/dist/defs/opencode.d.ts +1 -1
- package/dist/defs/pi.d.ts +1 -1
- package/dist/defs/qoder.d.ts +1 -1
- package/dist/defs/qwen.d.ts +1 -1
- package/dist/defs/reasonix.d.ts +3 -3
- package/dist/defs/trae-cli.d.ts +3 -3
- package/dist/defs/vibe.d.ts +3 -3
- package/dist/detection.js +22 -2
- package/dist/json-event-stream.d.ts +1 -2
- package/dist/json-event-stream.js +10 -9
- package/dist/launch.js +2 -1
- package/dist/model-catalog-cache.js +6 -4
- package/dist/model-contracts.d.ts +29 -0
- package/dist/model-contracts.js +2 -0
- package/dist/model-discovery-adapters.js +44 -19
- package/dist/model-discovery-config.js +8 -4
- package/dist/model-discovery-types.d.ts +2 -2
- package/dist/model-discovery-yaml.d.ts +9 -0
- package/dist/model-discovery-yaml.js +98 -0
- package/dist/model-discovery.js +10 -3
- package/dist/model-registry.js +2 -1
- package/dist/native-tool-policy.d.ts +28 -0
- package/dist/native-tool-policy.js +42 -0
- package/dist/opencode-log.js +13 -10
- package/dist/pi-models.js +13 -11
- package/dist/probe-scheduler.js +13 -5
- package/dist/providers/aihubmix.js +6 -7
- package/dist/providers/anthropic-messages.d.ts +6 -3
- package/dist/providers/anthropic-messages.js +21 -23
- package/dist/providers/azure-chat.d.ts +1 -1
- package/dist/providers/azure-chat.js +7 -10
- package/dist/providers/connection-guard.js +2 -1
- package/dist/providers/connection-test.js +16 -10
- package/dist/providers/google-messages.d.ts +1 -1
- package/dist/providers/google-messages.js +33 -35
- package/dist/providers/google.js +3 -4
- package/dist/providers/model-catalog.js +10 -7
- package/dist/providers/ollama-chat.d.ts +0 -8
- package/dist/providers/ollama-chat.js +17 -19
- package/dist/providers/openai-chat.d.ts +6 -3
- package/dist/providers/openai-chat.js +24 -22
- package/dist/providers/operation-schema.d.ts +2 -3
- package/dist/providers/operation-schema.js +25 -22
- package/dist/providers/provider-tool-policy.d.ts +13 -0
- package/dist/providers/provider-tool-policy.js +2 -0
- package/dist/providers/tool-loop-verdict.d.ts +22 -0
- package/dist/providers/tool-loop-verdict.js +17 -0
- package/dist/providers/tool-turn-types.d.ts +2 -12
- package/dist/providers/tool-turn.js +19 -45
- package/dist/types.d.ts +8 -27
- package/package.json +14 -8
|
@@ -107,6 +107,8 @@ import { redactSecrets } from '@jini-ai/core';
|
|
|
107
107
|
import { createRoleMarkerGuard } from '../role-marker-guard.js';
|
|
108
108
|
import { defaultDnsLookup, pinnedFetch, validateBaseUrlResolved } from './connection-guard.js';
|
|
109
109
|
import { createTurnEndGuard } from './turn-end-guard.js';
|
|
110
|
+
import { trimCharsEnd } from '@jini-ai/core/text';
|
|
111
|
+
import { toolLoopVerdict } from './tool-loop-verdict.js';
|
|
110
112
|
const DEFAULT_OLLAMA_BASE_URL = 'https://ollama.com';
|
|
111
113
|
const DEFAULT_MAX_TOOL_TURNS = 8;
|
|
112
114
|
function isRecord(value) {
|
|
@@ -114,7 +116,7 @@ function isRecord(value) {
|
|
|
114
116
|
}
|
|
115
117
|
/** Strips a trailing `/api` (with or without a trailing slash) before appending `/api/chat` — matches OD's `.replace(/\/+$/, '').replace(/\/api\/?$/, '')` so a caller-supplied `baseUrl` ending in `/api` doesn't produce `/api/api/chat`. */
|
|
116
118
|
function ollamaRequestUrl(baseUrl) {
|
|
117
|
-
const trimmed = (baseUrl ?? DEFAULT_OLLAMA_BASE_URL
|
|
119
|
+
const trimmed = trimCharsEnd({ text: baseUrl ?? DEFAULT_OLLAMA_BASE_URL, chars: '/' }).replace(/\/api\/?$/, '');
|
|
118
120
|
return `${trimmed}/api/chat`;
|
|
119
121
|
}
|
|
120
122
|
function ollamaHeaders(options) {
|
|
@@ -260,14 +262,17 @@ export function handleOllamaTextContent({ state, content, onEvent }) {
|
|
|
260
262
|
* the caller (`runSingleOllamaRequest`) still owns the normal-completion `emitEnd`, exactly like
|
|
261
263
|
* every sibling turn-runner's `emitEnd` contract.
|
|
262
264
|
*/
|
|
265
|
+
/** The message's text content when it is a non-empty string, else `null`. */
|
|
266
|
+
function nonEmptyContent(message) {
|
|
267
|
+
return message && typeof message.content === 'string' && message.content.length > 0 ? message.content : null;
|
|
268
|
+
}
|
|
263
269
|
export function processOllamaLine({ state, line, onEvent, emitEnd }) {
|
|
264
270
|
const message = isRecord(line.message) ? line.message : null;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
+
const text = nonEmptyContent(message);
|
|
272
|
+
if (text !== null && handleOllamaTextContent({ state: state, content: text, onEvent: onEvent }) === 'break') {
|
|
273
|
+
state.finishReason = 'contaminated';
|
|
274
|
+
emitEnd('contaminated');
|
|
275
|
+
return 'break';
|
|
271
276
|
}
|
|
272
277
|
if (message)
|
|
273
278
|
handleOllamaToolCallsField({ state: state, message: message });
|
|
@@ -407,9 +412,7 @@ async function runSingleOllamaRequest(options, messages, emitEnd) {
|
|
|
407
412
|
finishReason: null,
|
|
408
413
|
};
|
|
409
414
|
for await (const line of decodeNdjsonStream(body)) {
|
|
410
|
-
|
|
411
|
-
continue;
|
|
412
|
-
const result = processOllamaLine({ state: state, line: line, onEvent: onEvent, emitEnd: emitEnd });
|
|
415
|
+
const result = isRecord(line) ? processOllamaLine({ state: state, line: line, onEvent: onEvent, emitEnd: emitEnd }) : null;
|
|
413
416
|
if (result === 'break' || result === 'done')
|
|
414
417
|
break;
|
|
415
418
|
}
|
|
@@ -479,15 +482,10 @@ export async function runOllamaToolTurn(requiredArgs, optionalArgs = {}) {
|
|
|
479
482
|
while (true) {
|
|
480
483
|
const outcome = await runSingleOllamaRequest(options, messages, emitEnd);
|
|
481
484
|
lastFinishReason = outcome.finishReason;
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
emitEnd(exitReason);
|
|
487
|
-
break;
|
|
488
|
-
}
|
|
489
|
-
if (!executeTool) {
|
|
490
|
-
emitEnd('stop');
|
|
485
|
+
const verdict = toolLoopVerdict({ ended: endGuard.hasEnded(), hasExecutor: Boolean(executeTool), exitReason: () => ollamaLoopExitReason({ outcome: outcome, toolTurns: toolTurns, maxToolTurns: maxToolTurns }) });
|
|
486
|
+
if (verdict.stop || !executeTool) {
|
|
487
|
+
if (verdict.emit)
|
|
488
|
+
emitEnd(verdict.emit);
|
|
491
489
|
break;
|
|
492
490
|
}
|
|
493
491
|
toolTurns += 1;
|
|
@@ -70,7 +70,7 @@ import { createRoleMarkerGuard } from '../role-marker-guard.js';
|
|
|
70
70
|
import { type DnsLookupAddress, type DnsLookupFn, type PinnedFetch } from './connection-guard.js';
|
|
71
71
|
import { type DecodedSseEvent } from './sse-decode.js';
|
|
72
72
|
import { type TurnEndReason } from './turn-end-guard.js';
|
|
73
|
-
import type { ProviderToolSnapshotOptions, ProviderSchemaFallback, ProviderProtocol } from './tool-
|
|
73
|
+
import type { ProviderToolSnapshotOptions, ProviderSchemaFallback, ProviderProtocol } from './provider-tool-policy.js';
|
|
74
74
|
export interface OpenAiFunctionToolDef {
|
|
75
75
|
readonly type: 'function';
|
|
76
76
|
readonly function: {
|
|
@@ -186,7 +186,9 @@ export declare const DEFAULT_OPENAI_MAX_TOKENS = 8192;
|
|
|
186
186
|
export declare function openAiRequestUrl({ baseUrl }: {
|
|
187
187
|
baseUrl: string | undefined;
|
|
188
188
|
}): string;
|
|
189
|
-
|
|
189
|
+
/** The `OpenAiTurnOptions` keys every caller must pass. */
|
|
190
|
+
type OpenAiRequiredOption = "apiKey" | "model" | "messages" | "onEvent";
|
|
191
|
+
export declare function openAiHeaders(requiredArgs: Pick<OpenAiTurnOptions, OpenAiRequiredOption>, optionalArgs?: Omit<OpenAiTurnOptions, OpenAiRequiredOption>): Record<string, string>;
|
|
190
192
|
export declare function openAiRequestBody({ options, messages }: {
|
|
191
193
|
options: OpenAiTurnOptions;
|
|
192
194
|
messages: readonly OpenAiMessageParam[];
|
|
@@ -448,5 +450,6 @@ export declare function buildOpenAiToolExchangeMessages({ toolResultMessages, fo
|
|
|
448
450
|
* function call. See `anthropic-messages.ts#runAnthropicToolTurn`'s doc for
|
|
449
451
|
* the shared event-stream/`ended`-flag contract this mirrors exactly.
|
|
450
452
|
*/
|
|
451
|
-
export declare function runOpenAiToolTurn(requiredArgs: Pick<OpenAiTurnOptions,
|
|
453
|
+
export declare function runOpenAiToolTurn(requiredArgs: Pick<OpenAiTurnOptions, OpenAiRequiredOption>, optionalArgs?: Omit<OpenAiTurnOptions, OpenAiRequiredOption>): Promise<OpenAiTurnResult>;
|
|
454
|
+
export {};
|
|
452
455
|
//# sourceMappingURL=openai-chat.d.ts.map
|
|
@@ -72,6 +72,9 @@ import { defaultDnsLookup, pinnedFetch, validateBaseUrlResolved } from './connec
|
|
|
72
72
|
import { decodeSseStream } from './sse-decode.js';
|
|
73
73
|
import { buildOpenAIChatTokenParam } from './token-params.js';
|
|
74
74
|
import { createTurnEndGuard } from './turn-end-guard.js';
|
|
75
|
+
import { trimCharsEnd } from '@jini-ai/core/text';
|
|
76
|
+
import { toolLoopVerdict } from './tool-loop-verdict.js';
|
|
77
|
+
import { omitKeys } from '../core/omit-keys.js';
|
|
75
78
|
const DEFAULT_OPENAI_BASE_URL = 'https://api.openai.com';
|
|
76
79
|
const DEFAULT_MAX_TOOL_TURNS = 8;
|
|
77
80
|
const DONE_SENTINEL = '[DONE]';
|
|
@@ -81,7 +84,7 @@ function isRecord(value) {
|
|
|
81
84
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
82
85
|
}
|
|
83
86
|
export function openAiRequestUrl({ baseUrl }) {
|
|
84
|
-
const base = (baseUrl ?? DEFAULT_OPENAI_BASE_URL
|
|
87
|
+
const base = trimCharsEnd({ text: baseUrl ?? DEFAULT_OPENAI_BASE_URL, chars: '/' });
|
|
85
88
|
return /\/v\d+(\/|$)/.test(base) ? `${base}/chat/completions` : `${base}/v1/chat/completions`;
|
|
86
89
|
}
|
|
87
90
|
export function openAiHeaders(requiredArgs, optionalArgs = {}) {
|
|
@@ -116,6 +119,12 @@ export function extractOpenAiErrorDetail({ rawText }) {
|
|
|
116
119
|
}
|
|
117
120
|
return rawText.trim().slice(0, 500);
|
|
118
121
|
}
|
|
122
|
+
/** Wordings a provider uses to refuse a strict/schema feature; any one matching is enough. */
|
|
123
|
+
const STRICT_REJECTION_PATTERNS = [
|
|
124
|
+
/unsupported|not support|unknown (?:field|parameter|name)|unrecognized|not (?:allowed|permitted)/i,
|
|
125
|
+
/invalid (?:json )?schema|schema[^\n]*invalid|requires?[^\n]*beta/i,
|
|
126
|
+
/invalid (?:enum )?value[^\n]*(?:VALIDATED|function[_ .]?calling[_ .]?config)/i,
|
|
127
|
+
];
|
|
119
128
|
/** Only explicit HTTP schema/capability rejections qualify, never auth, rate limits or transport failures.
|
|
120
129
|
* @complexity O(e) time and O(e) space for at most 16 KiB of error text; no I/O.
|
|
121
130
|
*/
|
|
@@ -124,7 +133,7 @@ function isStrictToolRejection({ status, rawErrorText }) {
|
|
|
124
133
|
return false;
|
|
125
134
|
const detail = rawErrorText.slice(0, 16384);
|
|
126
135
|
const namesFeature = /\bstrict\b|\bVALIDATED\b|function[_ .]?calling[_ .]?config|(?:input[_ ]|json[_ ])?schema|structured.outputs/i.test(detail);
|
|
127
|
-
const rejectsFeature =
|
|
136
|
+
const rejectsFeature = STRICT_REJECTION_PATTERNS.some((pattern) => pattern.test(detail));
|
|
128
137
|
return namesFeature && rejectsFeature;
|
|
129
138
|
}
|
|
130
139
|
/**
|
|
@@ -161,7 +170,7 @@ export function refreshOpenAiTools({ options, retry }, _optional = {}) {
|
|
|
161
170
|
let tools = options.getTools?.({ strict: retry.enabled }) ?? options.tools;
|
|
162
171
|
if (!retry.enabled)
|
|
163
172
|
tools = tools?.map(tool => {
|
|
164
|
-
const
|
|
173
|
+
const definition = omitKeys(tool.function, ['strict']);
|
|
165
174
|
return { ...tool, function: definition };
|
|
166
175
|
});
|
|
167
176
|
return { ...options, ...(tools !== undefined ? { tools } : {}) };
|
|
@@ -236,10 +245,9 @@ export function handleOpenAiChoiceDelta({ state, choice, onEvent }) {
|
|
|
236
245
|
const delta = isRecord(choice.delta) ? choice.delta : null;
|
|
237
246
|
if (!delta)
|
|
238
247
|
return 'continue';
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
248
|
+
const text = typeof delta.content === 'string' && delta.content.length > 0 ? delta.content : null;
|
|
249
|
+
if (text !== null && handleOpenAiTextContentDelta({ state: state, content: text, onEvent: onEvent }) === 'break')
|
|
250
|
+
return 'break';
|
|
243
251
|
if (Array.isArray(delta.tool_calls)) {
|
|
244
252
|
for (const rawCall of delta.tool_calls) {
|
|
245
253
|
accumulateOpenAiToolCallDelta({ state: state, rawCall: rawCall });
|
|
@@ -271,12 +279,12 @@ function emitPendingOpenAiToolUseEvents(toolCalls, onEvent) {
|
|
|
271
279
|
function resolveOpenAiRetry({ init, status, rawText }, _options = {}) {
|
|
272
280
|
const toolRetryBody = init.retryToolBody?.({ status, rawErrorText: rawText, body: init.body });
|
|
273
281
|
if (toolRetryBody) {
|
|
274
|
-
const
|
|
282
|
+
const retryInit = omitKeys(init, ['retryToolBody']);
|
|
275
283
|
return { type: 'retry', retryInit: { ...retryInit, body: toolRetryBody } };
|
|
276
284
|
}
|
|
277
285
|
const retryBody = init.retryableBody?.(status, rawText);
|
|
278
286
|
if (retryBody) {
|
|
279
|
-
const
|
|
287
|
+
const retryInit = omitKeys(init, ['retryableBody']);
|
|
280
288
|
return { type: 'retry', retryInit: { ...retryInit, body: retryBody } };
|
|
281
289
|
}
|
|
282
290
|
return null;
|
|
@@ -396,10 +404,9 @@ export async function runOpenAiCompatibleRequest(requiredArgs, optionalArgs = {}
|
|
|
396
404
|
// after this loop, to decide whether pending tool_use events should still be emitted (a
|
|
397
405
|
// contaminating delta can arrive on a *later* chunk than the one that set `finish_reason`).
|
|
398
406
|
const result = processOpenAiStreamFrame({ state: state, frame: frame, onEvent: onEvent });
|
|
399
|
-
if (result === 'done')
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
init.emitEnd('contaminated');
|
|
407
|
+
if (result === 'done' || result === 'contaminated') {
|
|
408
|
+
if (result === 'contaminated')
|
|
409
|
+
init.emitEnd('contaminated');
|
|
403
410
|
break;
|
|
404
411
|
}
|
|
405
412
|
}
|
|
@@ -596,15 +603,10 @@ export async function runOpenAiToolTurn(requiredArgs, optionalArgs = {}) {
|
|
|
596
603
|
while (true) {
|
|
597
604
|
const outcome = await runSingleOpenAiRequest(options, messages, emitEnd, endGuard.hasEnded, retry);
|
|
598
605
|
lastFinishReason = outcome.finishReason;
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
emitEnd(exitReason);
|
|
604
|
-
break;
|
|
605
|
-
}
|
|
606
|
-
if (!executeTool) {
|
|
607
|
-
emitEnd('stop');
|
|
606
|
+
const verdict = toolLoopVerdict({ ended: endGuard.hasEnded(), hasExecutor: Boolean(executeTool), exitReason: () => openAiLoopExitReason({ outcome: outcome, toolTurns: toolTurns, maxToolTurns: maxToolTurns }) });
|
|
607
|
+
if (verdict.stop || !executeTool) {
|
|
608
|
+
if (verdict.emit)
|
|
609
|
+
emitEnd(verdict.emit);
|
|
608
610
|
break;
|
|
609
611
|
}
|
|
610
612
|
toolTurns += 1;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ProviderProtocol } from './tool-
|
|
2
|
-
|
|
3
|
-
export type OperationSchemaFallbackReason = 'endpoint-unsupported' | 'endpoint-rejected' | 'open-map' | 'recursive-schema' | 'unresolved-reference' | 'unsupported-schema' | 'optional-nullable' | 'schema-limit';
|
|
1
|
+
import type { ProviderProtocol, OperationSchemaFallbackReason } from './provider-tool-policy.js';
|
|
2
|
+
export type { OperationSchemaFallbackReason } from './provider-tool-policy.js';
|
|
4
3
|
export interface CompiledOperationSchema {
|
|
5
4
|
readonly schema: Record<string, unknown>;
|
|
6
5
|
readonly strict: boolean;
|
|
@@ -12,6 +12,8 @@ const TYPES = new Set(['object', 'array', 'string', 'integer', 'number', 'boolea
|
|
|
12
12
|
function isRecord(value) {
|
|
13
13
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
14
14
|
}
|
|
15
|
+
/** The fallback reason for any schema construct this projection does not translate. */
|
|
16
|
+
const UNSUPPORTED_SCHEMA = 'unsupported-schema';
|
|
15
17
|
function reject(reason) { throw new SchemaProjectionError(reason); }
|
|
16
18
|
/** Resolve local JSON pointers only. Expansion is bounded by the same node/depth budget as inline schemas. */
|
|
17
19
|
function resolveReference(schema, context) {
|
|
@@ -20,7 +22,7 @@ function resolveReference(schema, context) {
|
|
|
20
22
|
if (typeof schema.$ref !== 'string' || !schema.$ref.startsWith('#/'))
|
|
21
23
|
return reject('unresolved-reference');
|
|
22
24
|
if (Object.keys(schema).some(key => !['$ref', 'description', 'title'].includes(key)))
|
|
23
|
-
return reject(
|
|
25
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
24
26
|
let target = context.root;
|
|
25
27
|
for (const part of schema.$ref.slice(2).split('/')) {
|
|
26
28
|
const key = part.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
@@ -37,30 +39,30 @@ function normalizedNode(schema) {
|
|
|
37
39
|
if (schema.anyOf === undefined)
|
|
38
40
|
return schema;
|
|
39
41
|
if (!Array.isArray(schema.anyOf) || schema.anyOf.length !== 2)
|
|
40
|
-
return reject(
|
|
42
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
41
43
|
const nullMember = schema.anyOf.find(member => isRecord(member) && member.type === 'null');
|
|
42
44
|
if (!isRecord(nullMember) || Object.keys(nullMember).some(key => !['type', 'title', 'description'].includes(key)))
|
|
43
|
-
return reject(
|
|
45
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
44
46
|
const nonNull = schema.anyOf.filter(member => !isRecord(member) || member.type !== 'null');
|
|
45
47
|
if (nonNull.length !== 1 || !isRecord(nonNull[0]))
|
|
46
|
-
return reject(
|
|
48
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
47
49
|
if (Object.keys(schema).some(key => !['anyOf', 'title', 'description', 'default'].includes(key)))
|
|
48
|
-
return reject(
|
|
50
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
49
51
|
const child = nonNull[0];
|
|
50
52
|
if (typeof child.type !== 'string')
|
|
51
|
-
return reject(
|
|
53
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
52
54
|
return { ...child, type: [child.type, 'null'] };
|
|
53
55
|
}
|
|
54
56
|
function nodeTypes(schema) {
|
|
55
57
|
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
56
58
|
if (types.length === 0)
|
|
57
|
-
return reject(
|
|
59
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
58
60
|
if (!types.every((type) => typeof type === 'string' && TYPES.has(type)))
|
|
59
|
-
return reject(
|
|
61
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
60
62
|
if (new Set(types).size !== types.length)
|
|
61
|
-
return reject(
|
|
63
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
62
64
|
if (types.length > 1 && (types.length !== 2 || !types.includes('null')))
|
|
63
|
-
return reject(
|
|
65
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
64
66
|
return types;
|
|
65
67
|
}
|
|
66
68
|
function schemaMetadata(schema) {
|
|
@@ -72,15 +74,15 @@ function projectLiterals(schema, projected) {
|
|
|
72
74
|
projected.enum = literalValues(schema.enum);
|
|
73
75
|
if (Object.hasOwn(schema, 'const')) {
|
|
74
76
|
if (schema.enum !== undefined)
|
|
75
|
-
return reject(
|
|
77
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
76
78
|
projected.enum = literalValues([schema.const]);
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
function literalValues(value) {
|
|
80
82
|
if (!Array.isArray(value) || value.length === 0)
|
|
81
|
-
return reject(
|
|
83
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
82
84
|
if (value.some(member => member !== null && !['string', 'number', 'boolean'].includes(typeof member)))
|
|
83
|
-
return reject(
|
|
85
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
84
86
|
return [...value];
|
|
85
87
|
}
|
|
86
88
|
function childContext(context, schema) {
|
|
@@ -96,9 +98,9 @@ function projectObject(schema, context) {
|
|
|
96
98
|
const properties = schema.properties ?? {};
|
|
97
99
|
const required = schema.required ?? [];
|
|
98
100
|
if (!isRecord(properties) || !Array.isArray(required))
|
|
99
|
-
return reject(
|
|
101
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
100
102
|
if (required.some(key => typeof key !== 'string' || !Object.hasOwn(properties, key)))
|
|
101
|
-
return reject(
|
|
103
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
102
104
|
const requiredKeys = new Set(required);
|
|
103
105
|
const children = Object.entries(properties).map(([key, child]) => [key, projectNode(child, context, !requiredKeys.has(key))]);
|
|
104
106
|
const projected = {
|
|
@@ -134,25 +136,26 @@ function googleEnumDecoder(schema, decoder, protocol) {
|
|
|
134
136
|
if (schema.enum.includes(null)) {
|
|
135
137
|
const types = nodeTypes(schema);
|
|
136
138
|
if (!types.includes('null'))
|
|
137
|
-
return reject(
|
|
139
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
138
140
|
schema.enum = values;
|
|
139
141
|
}
|
|
140
142
|
return { ...decoder, numericEnum: values };
|
|
141
143
|
}
|
|
142
144
|
/** O(n) for the expanded tree, bounded to 2048 nodes and 32 levels; no I/O or input mutation. */
|
|
143
145
|
function projectNode(value, context, optional) {
|
|
144
|
-
|
|
146
|
+
context.budget.remaining -= 1;
|
|
147
|
+
if (context.budget.remaining < 0 || context.depth > 32)
|
|
145
148
|
return reject('schema-limit');
|
|
146
149
|
if (!isRecord(value))
|
|
147
|
-
return reject(
|
|
150
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
148
151
|
const resolved = resolveReference(value, context);
|
|
149
152
|
if (context.ancestors.has(resolved))
|
|
150
153
|
return reject('recursive-schema');
|
|
151
154
|
if (Object.keys(resolved).some(key => !SCHEMA_KEYS.has(key)))
|
|
152
|
-
return reject(
|
|
155
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
153
156
|
const schema = normalizedNode(resolved);
|
|
154
157
|
if (Object.keys(schema).some(key => !SCHEMA_KEYS.has(key)))
|
|
155
|
-
return reject(
|
|
158
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
156
159
|
const types = nodeTypes(schema);
|
|
157
160
|
// Required wire properties cannot represent both omission and a genuine null-as-clear.
|
|
158
161
|
// Prefer fallback over inventing a sentinel or forcing an unintended clear operation.
|
|
@@ -196,7 +199,7 @@ function fallback(schema, protocol, reason) {
|
|
|
196
199
|
function compileStrict(schema, protocol) {
|
|
197
200
|
const result = projectNode(schema, { root: schema, protocol, ancestors: new Set(), budget: { remaining: 2048 }, depth: 0 }, false);
|
|
198
201
|
if (result.schema.type !== 'object')
|
|
199
|
-
return reject(
|
|
202
|
+
return reject(UNSUPPORTED_SCHEMA);
|
|
200
203
|
const wireSchema = protocol === 'google' ? googleParametersOf({ descriptor: { id: '', inputSchema: result.schema } }) : result.schema;
|
|
201
204
|
return { schema: wireSchema, strict: true, decodeInput: input => decodeValue(input, result.decoder) };
|
|
202
205
|
}
|
|
@@ -211,7 +214,7 @@ function compileStrict(schema, protocol) {
|
|
|
211
214
|
export function compileOperationSchema({ schema: inputSchema, protocol }, { strict = false } = {}) {
|
|
212
215
|
const schema = isRecord(inputSchema) ? inputSchema : EMPTY_SCHEMA;
|
|
213
216
|
if (inputSchema !== undefined && !isRecord(inputSchema))
|
|
214
|
-
return fallback(schema, protocol,
|
|
217
|
+
return fallback(schema, protocol, UNSUPPORTED_SCHEMA);
|
|
215
218
|
if (!strict)
|
|
216
219
|
return fallback(schema, protocol, 'endpoint-unsupported');
|
|
217
220
|
try {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Request adapters choose strict support for their actual endpoint/model; policy is always prefer. */
|
|
2
|
+
export interface ProviderToolSnapshotOptions {
|
|
3
|
+
readonly strict?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface ProviderSchemaFallback {
|
|
6
|
+
readonly toolId: string;
|
|
7
|
+
readonly protocol: ProviderProtocol;
|
|
8
|
+
readonly reason: OperationSchemaFallbackReason;
|
|
9
|
+
}
|
|
10
|
+
export type ProviderProtocol = "anthropic" | "openai" | "azure" | "google";
|
|
11
|
+
/** Closed reason codes are safe to observe: no schema, argument values or provider error text. */
|
|
12
|
+
export type OperationSchemaFallbackReason = 'endpoint-unsupported' | 'endpoint-rejected' | 'open-map' | 'recursive-schema' | 'unresolved-reference' | 'unsupported-schema' | 'optional-nullable' | 'schema-limit';
|
|
13
|
+
//# sourceMappingURL=provider-tool-policy.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The stop decision every provider's tool loop makes once a request settles, shared so the
|
|
3
|
+
* five loops (Anthropic, Azure, Google, Ollama, OpenAI) cannot drift apart.
|
|
4
|
+
*/
|
|
5
|
+
/** What a tool loop does after one request: stop (emitting `emit` as the end reason when set), or
|
|
6
|
+
* run the requested tools when `stop` is false. */
|
|
7
|
+
export interface ToolLoopVerdict<R extends string> {
|
|
8
|
+
readonly stop: boolean;
|
|
9
|
+
readonly emit: R | 'stop' | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A turn that already ended mid-request stops with nothing more to emit. Otherwise the provider's
|
|
13
|
+
* own exit reason stops it, and so does a missing executor: pending tool calls were already emitted
|
|
14
|
+
* as `tool_use` events, so with nothing to run them the turn ends with `'stop'` rather than
|
|
15
|
+
* silently retrying forever. `exitReason` is only consulted for a turn that has not ended.
|
|
16
|
+
*/
|
|
17
|
+
export declare function toolLoopVerdict<R extends string>({ ended, hasExecutor, exitReason }: {
|
|
18
|
+
ended: boolean;
|
|
19
|
+
hasExecutor: boolean;
|
|
20
|
+
exitReason: () => R | null;
|
|
21
|
+
}): ToolLoopVerdict<R>;
|
|
22
|
+
//# sourceMappingURL=tool-loop-verdict.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The stop decision every provider's tool loop makes once a request settles, shared so the
|
|
3
|
+
* five loops (Anthropic, Azure, Google, Ollama, OpenAI) cannot drift apart.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A turn that already ended mid-request stops with nothing more to emit. Otherwise the provider's
|
|
7
|
+
* own exit reason stops it, and so does a missing executor: pending tool calls were already emitted
|
|
8
|
+
* as `tool_use` events, so with nothing to run them the turn ends with `'stop'` rather than
|
|
9
|
+
* silently retrying forever. `exitReason` is only consulted for a turn that has not ended.
|
|
10
|
+
*/
|
|
11
|
+
export function toolLoopVerdict({ ended, hasExecutor, exitReason }) {
|
|
12
|
+
if (ended)
|
|
13
|
+
return { stop: true, emit: null };
|
|
14
|
+
const emit = exitReason() || (hasExecutor ? null : 'stop');
|
|
15
|
+
return { stop: emit !== null, emit };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=tool-loop-verdict.js.map
|
|
@@ -2,16 +2,8 @@ import type { runAnthropicToolTurn, AnthropicToolDef } from './anthropic-message
|
|
|
2
2
|
import type { runOpenAiToolTurn, OpenAiFunctionToolDef } from './openai-chat.js';
|
|
3
3
|
import type { runAzureToolTurn, AzureFunctionToolDef } from './azure-chat.js';
|
|
4
4
|
import type { runGoogleToolTurn, GoogleToolDef } from './google-messages.js';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
export interface ProviderToolSnapshotOptions {
|
|
8
|
-
readonly strict?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface ProviderSchemaFallback {
|
|
11
|
-
readonly toolId: string;
|
|
12
|
-
readonly protocol: ProviderProtocol;
|
|
13
|
-
readonly reason: OperationSchemaFallbackReason;
|
|
14
|
-
}
|
|
5
|
+
import type { ProviderToolSnapshotOptions, ProviderSchemaFallback, ProviderProtocol } from './provider-tool-policy.js';
|
|
6
|
+
export type { ProviderToolSnapshotOptions, ProviderSchemaFallback, ProviderProtocol } from './provider-tool-policy.js';
|
|
15
7
|
type RefreshableAdapter<Required, Optional, Result, Tool> = (required: Required, optional?: Optional & {
|
|
16
8
|
/** Read immediately before each request, including a recognized schema downgrade. */
|
|
17
9
|
readonly getTools?: (options?: ProviderToolSnapshotOptions) => readonly Tool[];
|
|
@@ -36,7 +28,6 @@ export interface ProviderToolDescriptor {
|
|
|
36
28
|
/** Preserve a wire name already assigned by the run's core exposure snapshot. */
|
|
37
29
|
readonly wireName?: string;
|
|
38
30
|
}
|
|
39
|
-
export type ProviderProtocol = "anthropic" | "openai" | "azure" | "google";
|
|
40
31
|
export interface ProviderChatMessage {
|
|
41
32
|
readonly role: "user" | "assistant";
|
|
42
33
|
readonly content: string;
|
|
@@ -137,5 +128,4 @@ export interface ProviderToolTurnOptions {
|
|
|
137
128
|
readonly maxToolTurns?: number;
|
|
138
129
|
readonly signal?: AbortSignal;
|
|
139
130
|
}
|
|
140
|
-
export {};
|
|
141
131
|
//# sourceMappingURL=tool-turn-types.d.ts.map
|
|
@@ -26,7 +26,7 @@ function toGoogleToolContent(content) {
|
|
|
26
26
|
return content;
|
|
27
27
|
return content.map((block) => (block.type === "text" ? { text: block.text } : { inlineData: { mimeType: block.mimeType, data: block.data } }));
|
|
28
28
|
}
|
|
29
|
-
function foldToolError(content, isError) {
|
|
29
|
+
function foldToolError(content, isError = false) {
|
|
30
30
|
if (!isError)
|
|
31
31
|
return content;
|
|
32
32
|
return typeof content === "string" ? `${TOOL_ERROR_PREFIX}${content}` : [{ type: "text", text: TOOL_ERROR_PREFIX.trimEnd() }, ...content];
|
|
@@ -73,7 +73,7 @@ function pinWireName(descriptor, names, occupied) {
|
|
|
73
73
|
return;
|
|
74
74
|
const existing = names.get(descriptor.id);
|
|
75
75
|
const owner = occupied.get(descriptor.wireName);
|
|
76
|
-
if (!/^[A-Za-z_]
|
|
76
|
+
if (!/^[A-Za-z_]\w{0,63}$/.test(descriptor.wireName))
|
|
77
77
|
throw new ProviderToolProjectionError({});
|
|
78
78
|
if (existing !== undefined && existing !== descriptor.wireName)
|
|
79
79
|
throw new ProviderToolProjectionError({});
|
|
@@ -193,7 +193,8 @@ async function runAnthropicTurn(input) {
|
|
|
193
193
|
});
|
|
194
194
|
return normalizeTurnResult(result, capturedEndReason);
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
/** OpenAI and Azure share message/tool projection; the selected adapter retains its native request semantics. */
|
|
197
|
+
async function runOpenAiCompatibleTurn(input, _options = {}) {
|
|
197
198
|
const projection = createToolProjection(input);
|
|
198
199
|
const getTools = (options = {}) => openAiTools(projection.getTools(options));
|
|
199
200
|
const tools = openAiTools(projection.getTools({}, { reportFallback: false }));
|
|
@@ -208,7 +209,14 @@ async function runOpenAiTurn(input) {
|
|
|
208
209
|
return { content: foldToolError(toOpenAiToolContent(result.content), result.isError) };
|
|
209
210
|
};
|
|
210
211
|
let capturedEndReason = null;
|
|
211
|
-
const result = await (({ apiKey, model, messages, onEvent, ...optionalArgs }) =>
|
|
212
|
+
const result = await (({ apiKey, model, messages, onEvent, ...optionalArgs }) => {
|
|
213
|
+
if (input.protocol === 'azure') {
|
|
214
|
+
// runAzureTurn checks the required endpoint before any projection or adapter work.
|
|
215
|
+
const { baseUrl, ...azureOptions } = optionalArgs;
|
|
216
|
+
return input.adapters.azure({ apiKey, baseUrl: baseUrl, model, messages, onEvent }, azureOptions);
|
|
217
|
+
}
|
|
218
|
+
return input.adapters.openai({ apiKey, model, messages, onEvent }, optionalArgs);
|
|
219
|
+
})({
|
|
212
220
|
apiKey: input.apiKey,
|
|
213
221
|
...(input.baseUrl ? { baseUrl: input.baseUrl } : {}),
|
|
214
222
|
model: input.model,
|
|
@@ -241,46 +249,7 @@ async function runAzureTurn(input) {
|
|
|
241
249
|
input.onEvent({ type: "end", reason: "error" });
|
|
242
250
|
return { stopReason: "error", toolTurns: 0 };
|
|
243
251
|
}
|
|
244
|
-
|
|
245
|
-
const getTools = (options = {}) => openAiTools(projection.getTools(options));
|
|
246
|
-
const tools = openAiTools(projection.getTools({}, { reportFallback: false }));
|
|
247
|
-
const messages = [
|
|
248
|
-
{ role: "system", content: input.system },
|
|
249
|
-
...input.messages.map((m) => ({ role: m.role, content: m.images?.length ? toOpenAiToolContent([
|
|
250
|
-
{ type: 'text', text: m.content }, ...m.images.map(image => ({ type: 'image', ...image })),
|
|
251
|
-
]) : m.content })),
|
|
252
|
-
];
|
|
253
|
-
const executeTool = async (call) => {
|
|
254
|
-
const result = await projection.execute({ id: call.id, name: call.name, input: call.input });
|
|
255
|
-
return { content: foldToolError(toOpenAiToolContent(result.content), result.isError) };
|
|
256
|
-
};
|
|
257
|
-
let capturedEndReason = null;
|
|
258
|
-
const result = await (({ apiKey, baseUrl, model, messages, onEvent, ...optionalArgs }) => input.adapters.azure({ apiKey, baseUrl, model, messages, onEvent }, optionalArgs))({
|
|
259
|
-
apiKey: input.apiKey,
|
|
260
|
-
baseUrl: input.baseUrl,
|
|
261
|
-
model: input.model,
|
|
262
|
-
messages,
|
|
263
|
-
tools,
|
|
264
|
-
getTools,
|
|
265
|
-
...(input.onSchemaFallback ? { onSchemaFallback: input.onSchemaFallback } : {}),
|
|
266
|
-
...(input.maxTokens !== undefined ? { maxTokens: input.maxTokens } : {}),
|
|
267
|
-
...(input.maxToolTurns !== undefined ? { maxToolTurns: input.maxToolTurns } : {}),
|
|
268
|
-
executeTool,
|
|
269
|
-
...(input.signal ? { signal: input.signal } : {}),
|
|
270
|
-
onEvent: (event) => {
|
|
271
|
-
if (event.type === "fabricated_role_marker")
|
|
272
|
-
return;
|
|
273
|
-
if (event.type === "end")
|
|
274
|
-
capturedEndReason = event.reason;
|
|
275
|
-
if (event.type === "tool_result") {
|
|
276
|
-
const content = describeToolResultContent(event.content);
|
|
277
|
-
input.onEvent({ type: "tool_result", toolUseId: event.toolUseId, content, isError: event.isError || content.startsWith(TOOL_ERROR_PREFIX.trimEnd()) });
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
projection.onEvent(event);
|
|
281
|
-
},
|
|
282
|
-
});
|
|
283
|
-
return normalizeTurnResult(result, capturedEndReason);
|
|
252
|
+
return runOpenAiCompatibleTurn(input);
|
|
284
253
|
}
|
|
285
254
|
async function runGoogleTurn(input) {
|
|
286
255
|
const projection = createToolProjection(input);
|
|
@@ -336,11 +305,16 @@ export async function runProviderToolTurn(required, optional = {}) {
|
|
|
336
305
|
case "anthropic":
|
|
337
306
|
return runAnthropicTurn(input);
|
|
338
307
|
case "openai":
|
|
339
|
-
return
|
|
308
|
+
return runOpenAiCompatibleTurn(input);
|
|
340
309
|
case "azure":
|
|
341
310
|
return runAzureTurn(input);
|
|
342
311
|
case "google":
|
|
343
312
|
return runGoogleTurn(input);
|
|
313
|
+
default: {
|
|
314
|
+
// Unreachable: every supported protocol has a case above, and a new one fails typecheck here.
|
|
315
|
+
const unsupported = input.protocol;
|
|
316
|
+
throw new TypeError(`Unsupported provider tool-turn protocol: ${String(unsupported)}`);
|
|
317
|
+
}
|
|
344
318
|
}
|
|
345
319
|
}
|
|
346
320
|
//# sourceMappingURL=tool-turn.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -11,35 +11,12 @@
|
|
|
11
11
|
* Ported from OD's `apps/daemon/src/runtimes/types.ts`. Product-neutral
|
|
12
12
|
* as found — see `archived provenance ledger` for the full provenance table.
|
|
13
13
|
*/
|
|
14
|
-
import type { AgentModelDiscoveryPort, ModelCatalogSnapshot, DefaultModelResolution
|
|
14
|
+
import type { AgentModelDiscoveryPort, ModelCatalogSnapshot, DefaultModelResolution } from './model-discovery-types.js';
|
|
15
15
|
import type { ExecFileOptions } from 'node:child_process';
|
|
16
16
|
import type { AgentDiagnostic } from '@jini-ai/protocol';
|
|
17
|
-
|
|
18
|
-
export type RuntimeModelOption
|
|
19
|
-
id: string;
|
|
20
|
-
label: string;
|
|
21
|
-
identityKind?: ModelIdentityKind;
|
|
22
|
-
resolvedId?: string;
|
|
23
|
-
/**
|
|
24
|
-
* The reasoning-effort levels THIS model supports, when the runtime's own catalog reports them
|
|
25
|
-
* per model rather than per agent.
|
|
26
|
-
*
|
|
27
|
-
* Present only where a live source actually carries the data — Codex's `debug models` catalog
|
|
28
|
-
* does (`supported_reasoning_levels`), and the levels genuinely differ between models on the same
|
|
29
|
-
* CLI: verified live against codex-cli 0.153.4, where `gpt-6-astra` offers
|
|
30
|
-
* low/medium/high/xhigh/max/ultra while `gpt-5.5` stops at `xhigh`. A single agent-level
|
|
31
|
-
* `RuntimeAgentDef.reasoningOptions` list cannot be correct for both, which is why this is a
|
|
32
|
-
* property of the model row rather than of the def.
|
|
33
|
-
*
|
|
34
|
-
* Consumed by `RuntimeAgentDef.deriveReasoningOptions` to compute the agent-level list a picker
|
|
35
|
-
* renders. Left `undefined` by every runtime whose effort vocabulary really is uniform, and by
|
|
36
|
-
* every static fallback list — an absent value means "nothing catalog-specific to say", never
|
|
37
|
-
* "this model supports no effort levels".
|
|
38
|
-
*/
|
|
39
|
-
reasoning?: readonly RuntimeReasoningOption[];
|
|
40
|
-
};
|
|
17
|
+
import type { RuntimeEnv, RuntimeModelOption, RuntimeReasoningOption } from './model-contracts.js';
|
|
18
|
+
export type { RuntimeEnv, RuntimeModelOption, RuntimeReasoningOption } from './model-contracts.js';
|
|
41
19
|
export type RuntimeModelSource = 'live' | 'fallback';
|
|
42
|
-
export type RuntimeReasoningOption = RuntimeModelOption;
|
|
43
20
|
/**
|
|
44
21
|
* Declares that a runtime carries its reasoning-effort choice INSIDE the model
|
|
45
22
|
* id — as a trailing `-<level>` on the slug — rather than in a flag of its own.
|
|
@@ -169,7 +146,7 @@ export type RuntimePromptBudgetError = {
|
|
|
169
146
|
limit: number;
|
|
170
147
|
};
|
|
171
148
|
/**
|
|
172
|
-
* How the caller should treat
|
|
149
|
+
* How the caller should treat an adapter's raw stdout before text forwarding or structured parsing.
|
|
173
150
|
*
|
|
174
151
|
* Declared as a discriminated union rather than two independent flags
|
|
175
152
|
* (`stdoutBuffering` + `sanitizeStdout`) on purpose: a sanitizer is only
|
|
@@ -295,6 +272,10 @@ export type RuntimeAgentDef = Partial<AgentModelDiscoveryPort> & {
|
|
|
295
272
|
/** This adapter enforces nativeToolAccess and emits normalized shell/edit tool_use events.
|
|
296
273
|
* A host requesting the policy must fail closed when this capability is absent. */
|
|
297
274
|
supportsNativeToolAccess?: boolean;
|
|
275
|
+
/** Native tools cannot be limited per run; always use full access for authorized assistant users. */
|
|
276
|
+
fullCliAccessOnly?: boolean;
|
|
277
|
+
/** Translation key explaining this runtime’s full-access requirement to the user. */
|
|
278
|
+
fullCliAccessNote?: string;
|
|
298
279
|
/** The CLI ships a native subagent tool (e.g. Claude Code's Task/Agent) a run can delegate to.
|
|
299
280
|
* Declarative only: hosts read it through `runtimeSupportsSubagents`, never by model name.
|
|
300
281
|
* Absent = no native subagents. */
|