@yolk-sdk/agent 0.1.0-canary.118 → 0.1.0-canary.119
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/client/state.d.mts +76 -76
- package/dist/client/state.d.mts.map +1 -1
- package/dist/protocol/index.d.mts +2 -2
- package/dist/protocol/index.d.mts.map +1 -1
- package/dist/protocol/index.mjs +2 -2
- package/dist/protocol/nested-tool-calls.d.mts +9 -2
- package/dist/protocol/nested-tool-calls.d.mts.map +1 -1
- package/dist/protocol/nested-tool-calls.mjs +11 -1
- package/dist/protocol/nested-tool-calls.mjs.map +1 -1
- package/dist/react/chat-items.d.mts +69 -69
- package/dist/react/chat-items.d.mts.map +1 -1
- package/dist/react/chat-messages.d.mts +77 -77
- package/dist/react/chat-messages.d.mts.map +1 -1
- package/dist/skillset/merge.d.mts +3 -3
- package/dist/tools/index.d.mts +2 -2
- package/dist/tools/index.mjs +2 -2
- package/dist/tools/ledger.d.mts +22 -7
- package/dist/tools/ledger.d.mts.map +1 -1
- package/dist/tools/ledger.mjs +8 -6
- package/dist/tools/ledger.mjs.map +1 -1
- package/dist/tools/registry.d.mts +27 -1
- package/dist/tools/registry.d.mts.map +1 -1
- package/dist/tools/registry.mjs +39 -21
- package/dist/tools/registry.mjs.map +1 -1
- package/package.json +2 -2
- package/src/protocol/index.ts +1 -0
- package/src/protocol/nested-tool-calls.ts +15 -0
- package/src/tools/README.md +8 -0
- package/src/tools/index.ts +1 -0
- package/src/tools/ledger.ts +23 -6
- package/src/tools/registry.ts +107 -17
package/dist/client/state.d.mts
CHANGED
|
@@ -79,26 +79,6 @@ type AgentToolRun = {
|
|
|
79
79
|
readonly result: ToolResult;
|
|
80
80
|
};
|
|
81
81
|
declare const AgentToolRun: {
|
|
82
|
-
readonly InputStreaming: Data.TaggedEnum.ConstructorFrom<{
|
|
83
|
-
readonly _tag: "InputStreaming";
|
|
84
|
-
readonly id: string;
|
|
85
|
-
readonly name?: string;
|
|
86
|
-
readonly input: string;
|
|
87
|
-
}, "_tag">;
|
|
88
|
-
readonly InputReady: Data.TaggedEnum.ConstructorFrom<{
|
|
89
|
-
readonly _tag: "InputReady";
|
|
90
|
-
readonly call: ToolCall;
|
|
91
|
-
}, "_tag">;
|
|
92
|
-
readonly ApprovalRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
93
|
-
readonly _tag: "ApprovalRequested";
|
|
94
|
-
readonly call: ToolCall;
|
|
95
|
-
readonly request?: ToolApprovalRequest;
|
|
96
|
-
}, "_tag">;
|
|
97
|
-
readonly Denied: Data.TaggedEnum.ConstructorFrom<{
|
|
98
|
-
readonly _tag: "Denied";
|
|
99
|
-
readonly toolCallId: string;
|
|
100
|
-
readonly reason: string;
|
|
101
|
-
}, "_tag">;
|
|
102
82
|
readonly QuestionRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
103
83
|
readonly _tag: "QuestionRequested";
|
|
104
84
|
readonly request: QuestionRequest;
|
|
@@ -141,12 +121,6 @@ declare const AgentToolRun: {
|
|
|
141
121
|
readonly response: InteractionResponse;
|
|
142
122
|
readonly request?: InteractionRequest;
|
|
143
123
|
}, "_tag">;
|
|
144
|
-
readonly Executing: Data.TaggedEnum.ConstructorFrom<{
|
|
145
|
-
readonly _tag: "Executing";
|
|
146
|
-
readonly call: ToolCall;
|
|
147
|
-
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
148
|
-
readonly interaction?: true;
|
|
149
|
-
}, "_tag">;
|
|
150
124
|
readonly Completed: Data.TaggedEnum.ConstructorFrom<{
|
|
151
125
|
readonly _tag: "Completed";
|
|
152
126
|
readonly call: ToolCall;
|
|
@@ -161,6 +135,22 @@ declare const AgentToolRun: {
|
|
|
161
135
|
readonly startedAtMs: number;
|
|
162
136
|
readonly endedAtMs: number;
|
|
163
137
|
}, "_tag">;
|
|
138
|
+
readonly InputStreaming: Data.TaggedEnum.ConstructorFrom<{
|
|
139
|
+
readonly _tag: "InputStreaming";
|
|
140
|
+
readonly id: string;
|
|
141
|
+
readonly name?: string;
|
|
142
|
+
readonly input: string;
|
|
143
|
+
}, "_tag">;
|
|
144
|
+
readonly ApprovalRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
145
|
+
readonly _tag: "ApprovalRequested";
|
|
146
|
+
readonly call: ToolCall;
|
|
147
|
+
readonly request?: ToolApprovalRequest;
|
|
148
|
+
}, "_tag">;
|
|
149
|
+
readonly Denied: Data.TaggedEnum.ConstructorFrom<{
|
|
150
|
+
readonly _tag: "Denied";
|
|
151
|
+
readonly toolCallId: string;
|
|
152
|
+
readonly reason: string;
|
|
153
|
+
}, "_tag">;
|
|
164
154
|
readonly Errored: Data.TaggedEnum.ConstructorFrom<{
|
|
165
155
|
readonly _tag: "Errored";
|
|
166
156
|
readonly call: ToolCall;
|
|
@@ -172,7 +162,17 @@ declare const AgentToolRun: {
|
|
|
172
162
|
readonly call: ToolCall;
|
|
173
163
|
readonly result: ToolResult;
|
|
174
164
|
}, "_tag">;
|
|
175
|
-
readonly
|
|
165
|
+
readonly InputReady: Data.TaggedEnum.ConstructorFrom<{
|
|
166
|
+
readonly _tag: "InputReady";
|
|
167
|
+
readonly call: ToolCall;
|
|
168
|
+
}, "_tag">;
|
|
169
|
+
readonly Executing: Data.TaggedEnum.ConstructorFrom<{
|
|
170
|
+
readonly _tag: "Executing";
|
|
171
|
+
readonly call: ToolCall;
|
|
172
|
+
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
173
|
+
readonly interaction?: true;
|
|
174
|
+
}, "_tag">;
|
|
175
|
+
readonly $is: <Tag extends "QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "InputRequested" | "InputSubmitted" | "InputCancelled" | "InteractionRequested" | "InteractionSubmitted" | "InteractionCancelled" | "Completed" | "Accepted" | "InputStreaming" | "ApprovalRequested" | "Denied" | "Errored" | "ProviderCompleted" | "InputReady" | "Executing">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
176
176
|
readonly _tag: "InputStreaming";
|
|
177
177
|
readonly id: string;
|
|
178
178
|
readonly name?: string;
|
|
@@ -286,26 +286,6 @@ declare const AgentToolRun: {
|
|
|
286
286
|
}>;
|
|
287
287
|
readonly $match: {
|
|
288
288
|
<Cases extends {
|
|
289
|
-
readonly InputStreaming: (args: {
|
|
290
|
-
readonly _tag: "InputStreaming";
|
|
291
|
-
readonly id: string;
|
|
292
|
-
readonly name?: string;
|
|
293
|
-
readonly input: string;
|
|
294
|
-
}) => any;
|
|
295
|
-
readonly InputReady: (args: {
|
|
296
|
-
readonly _tag: "InputReady";
|
|
297
|
-
readonly call: ToolCall;
|
|
298
|
-
}) => any;
|
|
299
|
-
readonly ApprovalRequested: (args: {
|
|
300
|
-
readonly _tag: "ApprovalRequested";
|
|
301
|
-
readonly call: ToolCall;
|
|
302
|
-
readonly request?: ToolApprovalRequest;
|
|
303
|
-
}) => any;
|
|
304
|
-
readonly Denied: (args: {
|
|
305
|
-
readonly _tag: "Denied";
|
|
306
|
-
readonly toolCallId: string;
|
|
307
|
-
readonly reason: string;
|
|
308
|
-
}) => any;
|
|
309
289
|
readonly QuestionRequested: (args: {
|
|
310
290
|
readonly _tag: "QuestionRequested";
|
|
311
291
|
readonly request: QuestionRequest;
|
|
@@ -348,12 +328,6 @@ declare const AgentToolRun: {
|
|
|
348
328
|
readonly response: InteractionResponse;
|
|
349
329
|
readonly request?: InteractionRequest;
|
|
350
330
|
}) => any;
|
|
351
|
-
readonly Executing: (args: {
|
|
352
|
-
readonly _tag: "Executing";
|
|
353
|
-
readonly call: ToolCall;
|
|
354
|
-
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
355
|
-
readonly interaction?: true;
|
|
356
|
-
}) => any;
|
|
357
331
|
readonly Completed: (args: {
|
|
358
332
|
readonly _tag: "Completed";
|
|
359
333
|
readonly call: ToolCall;
|
|
@@ -368,6 +342,22 @@ declare const AgentToolRun: {
|
|
|
368
342
|
readonly startedAtMs: number;
|
|
369
343
|
readonly endedAtMs: number;
|
|
370
344
|
}) => any;
|
|
345
|
+
readonly InputStreaming: (args: {
|
|
346
|
+
readonly _tag: "InputStreaming";
|
|
347
|
+
readonly id: string;
|
|
348
|
+
readonly name?: string;
|
|
349
|
+
readonly input: string;
|
|
350
|
+
}) => any;
|
|
351
|
+
readonly ApprovalRequested: (args: {
|
|
352
|
+
readonly _tag: "ApprovalRequested";
|
|
353
|
+
readonly call: ToolCall;
|
|
354
|
+
readonly request?: ToolApprovalRequest;
|
|
355
|
+
}) => any;
|
|
356
|
+
readonly Denied: (args: {
|
|
357
|
+
readonly _tag: "Denied";
|
|
358
|
+
readonly toolCallId: string;
|
|
359
|
+
readonly reason: string;
|
|
360
|
+
}) => any;
|
|
371
361
|
readonly Errored: (args: {
|
|
372
362
|
readonly _tag: "Errored";
|
|
373
363
|
readonly call: ToolCall;
|
|
@@ -379,28 +369,18 @@ declare const AgentToolRun: {
|
|
|
379
369
|
readonly call: ToolCall;
|
|
380
370
|
readonly result: ToolResult;
|
|
381
371
|
}) => any;
|
|
382
|
-
}>(cases: Cases): (value: AgentToolRun) => import("effect/Unify").Unify<ReturnType<Cases["InputStreaming" | "InputReady" | "ApprovalRequested" | "Denied" | "QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "InputRequested" | "InputSubmitted" | "InputCancelled" | "InteractionRequested" | "InteractionSubmitted" | "InteractionCancelled" | "Executing" | "Completed" | "Accepted" | "Errored" | "ProviderCompleted"]>>;
|
|
383
|
-
<Cases extends {
|
|
384
|
-
readonly InputStreaming: (args: {
|
|
385
|
-
readonly _tag: "InputStreaming";
|
|
386
|
-
readonly id: string;
|
|
387
|
-
readonly name?: string;
|
|
388
|
-
readonly input: string;
|
|
389
|
-
}) => any;
|
|
390
372
|
readonly InputReady: (args: {
|
|
391
373
|
readonly _tag: "InputReady";
|
|
392
374
|
readonly call: ToolCall;
|
|
393
375
|
}) => any;
|
|
394
|
-
readonly
|
|
395
|
-
readonly _tag: "
|
|
376
|
+
readonly Executing: (args: {
|
|
377
|
+
readonly _tag: "Executing";
|
|
396
378
|
readonly call: ToolCall;
|
|
397
|
-
readonly
|
|
398
|
-
|
|
399
|
-
readonly Denied: (args: {
|
|
400
|
-
readonly _tag: "Denied";
|
|
401
|
-
readonly toolCallId: string;
|
|
402
|
-
readonly reason: string;
|
|
379
|
+
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
380
|
+
readonly interaction?: true;
|
|
403
381
|
}) => any;
|
|
382
|
+
}>(cases: Cases): (value: AgentToolRun) => import("effect/Unify").Unify<ReturnType<Cases["QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "InputRequested" | "InputSubmitted" | "InputCancelled" | "InteractionRequested" | "InteractionSubmitted" | "InteractionCancelled" | "Completed" | "Accepted" | "InputStreaming" | "ApprovalRequested" | "Denied" | "Errored" | "ProviderCompleted" | "InputReady" | "Executing"]>>;
|
|
383
|
+
<Cases extends {
|
|
404
384
|
readonly QuestionRequested: (args: {
|
|
405
385
|
readonly _tag: "QuestionRequested";
|
|
406
386
|
readonly request: QuestionRequest;
|
|
@@ -443,12 +423,6 @@ declare const AgentToolRun: {
|
|
|
443
423
|
readonly response: InteractionResponse;
|
|
444
424
|
readonly request?: InteractionRequest;
|
|
445
425
|
}) => any;
|
|
446
|
-
readonly Executing: (args: {
|
|
447
|
-
readonly _tag: "Executing";
|
|
448
|
-
readonly call: ToolCall;
|
|
449
|
-
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
450
|
-
readonly interaction?: true;
|
|
451
|
-
}) => any;
|
|
452
426
|
readonly Completed: (args: {
|
|
453
427
|
readonly _tag: "Completed";
|
|
454
428
|
readonly call: ToolCall;
|
|
@@ -463,6 +437,22 @@ declare const AgentToolRun: {
|
|
|
463
437
|
readonly startedAtMs: number;
|
|
464
438
|
readonly endedAtMs: number;
|
|
465
439
|
}) => any;
|
|
440
|
+
readonly InputStreaming: (args: {
|
|
441
|
+
readonly _tag: "InputStreaming";
|
|
442
|
+
readonly id: string;
|
|
443
|
+
readonly name?: string;
|
|
444
|
+
readonly input: string;
|
|
445
|
+
}) => any;
|
|
446
|
+
readonly ApprovalRequested: (args: {
|
|
447
|
+
readonly _tag: "ApprovalRequested";
|
|
448
|
+
readonly call: ToolCall;
|
|
449
|
+
readonly request?: ToolApprovalRequest;
|
|
450
|
+
}) => any;
|
|
451
|
+
readonly Denied: (args: {
|
|
452
|
+
readonly _tag: "Denied";
|
|
453
|
+
readonly toolCallId: string;
|
|
454
|
+
readonly reason: string;
|
|
455
|
+
}) => any;
|
|
466
456
|
readonly Errored: (args: {
|
|
467
457
|
readonly _tag: "Errored";
|
|
468
458
|
readonly call: ToolCall;
|
|
@@ -474,7 +464,17 @@ declare const AgentToolRun: {
|
|
|
474
464
|
readonly call: ToolCall;
|
|
475
465
|
readonly result: ToolResult;
|
|
476
466
|
}) => any;
|
|
477
|
-
|
|
467
|
+
readonly InputReady: (args: {
|
|
468
|
+
readonly _tag: "InputReady";
|
|
469
|
+
readonly call: ToolCall;
|
|
470
|
+
}) => any;
|
|
471
|
+
readonly Executing: (args: {
|
|
472
|
+
readonly _tag: "Executing";
|
|
473
|
+
readonly call: ToolCall;
|
|
474
|
+
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
475
|
+
readonly interaction?: true;
|
|
476
|
+
}) => any;
|
|
477
|
+
}>(value: AgentToolRun, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "InputRequested" | "InputSubmitted" | "InputCancelled" | "InteractionRequested" | "InteractionSubmitted" | "InteractionCancelled" | "Completed" | "Accepted" | "InputStreaming" | "ApprovalRequested" | "Denied" | "Errored" | "ProviderCompleted" | "InputReady" | "Executing"]>>;
|
|
478
478
|
};
|
|
479
479
|
};
|
|
480
480
|
type AgentClientState = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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;;;iBAjKC,QAAA;AAAA;EAAA;iBAG7B,QAAA;EAAA,mBACI,mBAAA;AAAA;EAAA;oBAGmC,eAAA;AAAA;EAAA;oBAWH,YAAA;AAAA;EAAA;oBAWM,kBAAA;AAAA;EAAA;qBAGtC,mBAAA;EAAA,mBACA,kBAAA;AAAA;EAAA;iBASJ,QAAA;EAAA,8BAb0C;EAAA;;cAgJlD,iBAAA,GAAqB,IAAA,EAAM,aAAA,CAAc,YAAA;EAAA;iBA5HjC,QAAA;EAAA,iBACE,UAAA;EAAA;;;cAwIV,wBAAA,GACX,QAAA,EAAU,aAAA,CAAc,WAAA,MACvB,aAAA,CAAc,YAAA;AAAA,cAwNJ,kBAAA,GACX,QAAA,EAAU,aAAA,CAAc,YAAA,GACxB,OAAA,EAAS,YAAA,KACR,eAAA;AAAA,cAUU,eAAA,GAAmB,KAAA,EAAO,gBAAA,EAAkB,KAAA,EAAO,UAAA,KAAa,gBAAA;AAAA,cAMhE,0BAAA,GACX,KAAA,EAAO,gBAAA,EACP,KAAA,EAAO,UAAA,EACP,OAAA,GAAS,sBAAA,KACR,gBAAA;AAAA,cAmSU,sBAAA,GACX,KAAA,EAAO,gBAAA,EACP,OAAA,EAAS,WAAA,KACR,gBAAA;;cAeU,cAAA,GACX,KAAA,EAAO,gBAAA,EACP,OAAA,WACA,KAAA,GAAQ,UAAA,KACP,gBAAA;;cAUU,gBAAA,GAAoB,KAAA,EAAO,gBAAA,KAAmB,gBAIxD;AAAA,cAEU,iBAAA,GACX,MAAA,EAAQ,aAAA,CAAc,UAAA,GACtB,YAAA,GAAc,gBAAA,EACd,OAAA,GAAS,sBAAA,KAA2B,gBAAA"}
|
|
@@ -3,7 +3,7 @@ import { AgentContentCapabilities, AgentModelCapabilities, textImageDocumentMode
|
|
|
3
3
|
import { AttachmentContentPart, AttachmentSource, AttachmentSourceResolver, AudioPart, Content, ContentPart, DocumentPart, FilePart, ImagePart, InlineBase64AttachmentSource, RefAttachmentSource, TextPart, UrlAttachmentSource, appendTextToContent, attachmentSourceBase64, attachmentSourceDataUrl, attachmentSourcePreview, attachmentSourceText, attachmentSourceUrl, base64ToBytes, bytesToBase64, contentPartPreview, contentPartText, contentParts, contentPreview, contentText, documentPartFromText, filePartFromBytes, filePartText, inferTextDocumentMimeType, inlineBase64AttachmentSource, inlineBase64Source, isContentEmpty, isTextDocumentMimeType, refAttachmentSource, replaceLoneSurrogates, replaceLoneSurrogatesDeep, resolveContentAttachmentSources, textDocumentMimeTypeFromFilename, textToBase64Utf8, urlAttachmentSource } from "./content.mjs";
|
|
4
4
|
import { FileDescriptor, FileId, fileIdPattern, fileLabel, fileNotCapturedLabel, formatFileSize, isFileId, normalizeFileMimeType } from "./file.mjs";
|
|
5
5
|
import { AgentInputUsage, AgentOutputUsage, AgentUsage, addAgentUsage, zeroAgentUsage } from "./usage.mjs";
|
|
6
|
-
import { BoundedNestedToolCallArgs, NestedToolCallCounts, NestedToolCallInput, NestedToolCallRecord, NestedToolCallRecorder, NestedToolCallResultFields, NestedToolCallStatus, NestedToolCalls, boundNestedToolCallArgs, emptyNestedToolCallRecorder, makeNestedToolCallRecorder, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, recordNestedToolCall } from "./nested-tool-calls.mjs";
|
|
6
|
+
import { BoundedNestedToolCallArgs, NestedToolCallAccess, NestedToolCallCounts, NestedToolCallInput, NestedToolCallRecord, NestedToolCallRecorder, NestedToolCallResultFields, NestedToolCallStatus, NestedToolCalls, boundNestedToolCallArgs, emptyNestedToolCallRecorder, makeNestedToolCallRecorder, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, recordNestedToolCall } from "./nested-tool-calls.mjs";
|
|
7
7
|
import { BackgroundToolAccepted, BackgroundToolExecution, BackgroundToolInput, ErrorToolResultInput, HitlRequest, HitlResponse, HitlResponseSource, InputContentFormatter, InputDescriptor, InputRequest, InputResponse, InputResponseOutcome, InputResponseStructuredContent, InputResponseValidator, InputToolHandler, InteractionActionDescriptor, InteractionAdmissionError, InteractionBusinessOutcome, InteractionCallValidator, InteractionCandidate, InteractionClaim, InteractionDescriptor, InteractionHost, InteractionHostError, InteractionOutcome, InteractionPreflight, InteractionReceipt, InteractionReceiptStatus, InteractionRef, InteractionRequest, InteractionResponse, InteractionResponseOutcome, InteractionResponseStructuredContent, InteractionResponseValidator, InteractionValidationError, PlainHitlResponse, PlainInputResponse, PlainInteractionResponse, PlainQuestionAnswer, PlainQuestionResponse, PlainToolApprovalResponse, QuestionAnswer, QuestionOption, QuestionPrompt, QuestionRequest, QuestionResponse, QuestionResponseOutcome, QuestionResponseStructuredContent, QuestionToolParams, ToolApprovalDecision, ToolApprovalMode, ToolApprovalPolicy, ToolApprovalRequest, ToolApprovalResponse, ToolCall, ToolCallableBy, ToolDef, ToolDiscovery, ToolExposure, ToolJsonSchema, ToolJsonSchemaObject, ToolLoading, ToolResult, decodeBackgroundToolInput, decodeToolJsonSchema, decodeToolJsonSchemaObject, formatInputResponseContent, formatInteractionResponseContent, formatQuestionResponseContent, inputRequestId, inputResponseStructuredContent, interactionJsonEquals, interactionRequestId, interactionResponseStructuredContent, interactionUnknownOutcomeNotice, isCodeModeCallable, isCodeModeFailClosed, isDeferredTool, isProviderToolDef, isToolJsonSchemaObject, isToolStageable, makeBackgroundToolAcceptedResult, makeErrorToolResult, makeInteractionToolResult, plainHitlResponse, plainInputResponse, plainInteractionResponse, plainQuestionAnswer, plainQuestionResponse, plainToolApprovalResponse, providerToolDefs, questionResponseStructuredContent, sameInteractionBinding, sameInteractionCall, toolDiscovery, validInteractionReceipt, validateInteractionSubmission } from "./tool.mjs";
|
|
8
8
|
import { ToolApprovalPreviewer, ToolChangeCut, ToolChangeItem, ToolChangePreview, ToolChangePreviewError, ToolChangePreviewErrorCause, ToolChangePreviewFailure, ToolChangeScalar, ToolChangeSetCuts, ToolChangeSideCuts, ToolChangeTarget, ToolFieldChange, ToolListChange, ToolSetChange, ToolStructuredChange, ToolTextChange, ToolValueChange } from "./change-preview.mjs";
|
|
9
9
|
import { AgentMessage, AssistantAgentMessage, AssistantPart, AssistantReasoningPart, AssistantReasoningReplay, AssistantTextPart, DanglingHostToolCall, HostToolCallPart, MessageAnnotations, MessageAuthor, MessageEnvelope, MessageInstruction, ProviderToolCallPart, ProviderToolResultPart, RedactedReasoningReplay, RepairDanglingHostToolCallsOptions, SignedReasoningReplay, ToolResultMessage, TranscriptInvariantValidation, UserMessage, assistantContent, assistantHostToolCalls, assistantReasoningText, danglingHostToolCalls, isInstructionMessage, latestInstructionMessages, latestInstructionState, messageContextText, prependMessageContextToContent, repairDanglingHostToolCalls, resolveMessageAttachmentSources, resolveMessagesAttachmentSources, toolResultMessageFromResult, validateNoDanglingHostToolCalls } from "./message.mjs";
|
|
@@ -16,5 +16,5 @@ import { ToolSearchActivation, activatedToolNames, declaredToolDefs, toolSearchT
|
|
|
16
16
|
//#region src/protocol/index.d.ts
|
|
17
17
|
type MessageId = string;
|
|
18
18
|
//#endregion
|
|
19
|
-
export { AgentAbortReason, AgentActivity, AgentAwaitingInput, AgentBlocked, AgentBlockedKind, AgentBusy, AgentCompacting, AgentContentCapabilities, AgentDone, AgentEnd, AgentError, AgentErrorCode, AgentEvent, AgentFailed, AgentGenerating, AgentIdle, AgentInputUsage, AgentMessage, AgentModelCapabilities, AgentOutputUsage, AgentReasoningEffort, AgentRetry, AgentRetrying, AgentRunningTools, AgentStart, AgentStatus, AgentStatusTree, AgentToolActivityCall, AgentUsage, AgentWebSocketClientMessage, AgentWebSocketServerMessage, AgentWorking, AssistantAgentMessage, AssistantMessageEvent, AssistantPart, AssistantReasoningPart, AssistantReasoningReplay, AssistantTextPart, type AttachmentContentPart, AttachmentSource, type AttachmentSourceResolver, AudioPart, BackgroundToolAccepted, BackgroundToolExecution, BackgroundToolInput, type BoundedNestedToolCallArgs, CompactionEnd, CompactionStart, Content, ContentPart, type DanglingHostToolCall, DocumentPart, type ErrorToolResultInput, FileDescriptor, FileId, FilePart, HitlRequest, HitlResponse, HitlResponseSource, HostToolCallPart, ImagePart, InlineBase64AttachmentSource, InputCancelled, type InputContentFormatter, InputDescriptor, InputRequest, InputRequested, InputResponse, InputResponseInput, InputResponseOutcome, type InputResponseStructuredContent, type InputResponseValidator, InputSubmitted, type InputToolHandler, InteractionActionDescriptor, InteractionAdmissionError, InteractionBusinessOutcome, type InteractionCallValidator, InteractionCancelled, InteractionCandidate, InteractionClaim, InteractionDescriptor, type InteractionHost, InteractionHostError, type InteractionOutcome, type InteractionPreflight, InteractionReceipt, InteractionReceiptStatus, type InteractionRef, InteractionRequest, InteractionRequested, InteractionResponse, InteractionResponseInput, InteractionResponseOutcome, type InteractionResponseStructuredContent, type InteractionResponseValidator, InteractionSubmitted, InteractionValidationError, LLMReasoningDelta, LLMReasoningReplay, LLMStreamEnd, LLMStreamStart, LLMTextDelta, MessageAnnotations, MessageAuthor, type MessageEnvelope, MessageId, MessageInstruction, NestedToolCallCounts, type NestedToolCallInput, NestedToolCallRecord, type NestedToolCallRecorder, type NestedToolCallResultFields, NestedToolCallStatus, NestedToolCalls, PlainHitlResponse, type PlainInputResponse, type PlainInteractionResponse, type PlainQuestionAnswer, type PlainQuestionResponse, type PlainToolApprovalResponse, ProviderErrorInfo, ProviderFailureKind, ProviderStreamDiagnostics, ProviderStreamProtocol, ProviderStreamResponseFormat, ProviderToolCallPart, ProviderToolResult, ProviderToolResultPart, QuestionAnswer, QuestionAnswered, QuestionCancelled, QuestionOption, QuestionPrompt, QuestionRequest, QuestionRequested, QuestionResponse, QuestionResponseInput, QuestionResponseOutcome, type QuestionResponseStructuredContent, QuestionToolParams, RedactedReasoningReplay, RefAttachmentSource, type RepairDanglingHostToolCallsOptions, SessionSnapshot, SignedReasoningReplay, SubagentCompleted, SubagentStarted, SubagentStatus, SubagentStatusEntry, type TerminalAgentEvent, TextPart, ToolApprovalDecision, ToolApprovalDenied, ToolApprovalGranted, ToolApprovalMode, ToolApprovalPolicy, type ToolApprovalPreviewer, ToolApprovalRequest, ToolApprovalRequested, ToolApprovalResponse, ToolApprovalResponseInput, ToolCall, ToolCallableBy, ToolChangeCut, ToolChangeItem, ToolChangePreview, ToolChangePreviewError, ToolChangePreviewErrorCause, ToolChangePreviewFailure, ToolChangeScalar, ToolChangeSetCuts, ToolChangeSideCuts, ToolChangeTarget, ToolDef, ToolDiscovery, ToolExecutionAccepted, ToolExecutionCompleted, ToolExecutionError, ToolExecutionStarted, type ToolExposure, ToolFieldChange, ToolInputDelta, ToolInputEnd, ToolInputStart, ToolJsonSchema, ToolJsonSchemaObject, ToolListChange, ToolLoading, ToolResult, ToolResultMessage, ToolSearchActivation, ToolSetChange, ToolStructuredChange, ToolTextChange, ToolValueChange, type TranscriptInvariantValidation, TurnEnd, TurnStart, UrlAttachmentSource, UsageUpdate, UserInput, UserMessage, UserMessageEvent, activatedToolNames, addAgentUsage, agentBlockedKind, agentStatusFromEvents, agentStatusRetry, agentStatusTreeFromEvents, appendTextToContent, assistantContent, assistantHostToolCalls, assistantReasoningText, attachmentSourceBase64, attachmentSourceDataUrl, attachmentSourcePreview, attachmentSourceText, attachmentSourceUrl, base64ToBytes, boundNestedToolCallArgs, bytesToBase64, contentPartPreview, contentPartText, contentParts, contentPreview, contentText, danglingHostToolCalls, declaredToolDefs, decodeBackgroundToolInput, decodeToolJsonSchema, decodeToolJsonSchemaObject, documentPartFromText, emptyNestedToolCallRecorder, fileIdPattern, fileLabel, fileNotCapturedLabel, filePartFromBytes, filePartText, formatFileSize, formatInputResponseContent, formatInteractionResponseContent, formatQuestionResponseContent, hitlRequestBlockedKind, hitlResponseEvent, idleAgentStatus, inferTextDocumentMimeType, initialAgentStatusTree, inlineBase64AttachmentSource, inlineBase64Source, inputRequestId, inputResponseStructuredContent, interactionJsonEquals, interactionRequestId, interactionResponseStructuredContent, interactionUnknownOutcomeNotice, isAgentStatusLive, isCodeModeCallable, isCodeModeFailClosed, isContentEmpty, isDeferredTool, isFileId, isInstructionMessage, isProviderToolDef, isSubagentAcceptedToolResult, isSubagentObservationToolResult, isTerminalAgentEvent, isTextDocumentMimeType, isToolJsonSchemaObject, isToolStageable, latestInstructionMessages, latestInstructionState, makeBackgroundToolAcceptedResult, makeErrorToolResult, makeInteractionToolResult, makeNestedToolCallRecorder, makeSubagentRunId, messageContextText, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, nextAgentStatus, nextAgentStatusTree, normalizeFileMimeType, plainHitlResponse, plainInputResponse, plainInteractionResponse, plainQuestionAnswer, plainQuestionResponse, plainToolApprovalResponse, prependMessageContextToContent, providerToolDefs, questionResponseStructuredContent, reconcileAgentStatus, recordNestedToolCall, refAttachmentSource, repairDanglingHostToolCalls, replaceLoneSurrogates, replaceLoneSurrogatesDeep, resolveContentAttachmentSources, resolveMessageAttachmentSources, resolveMessagesAttachmentSources, sameInteractionBinding, sameInteractionCall, settleAgentStatusTree, startAgentStatusTree, textDocumentMimeTypeFromFilename, textImageDocumentModelCapabilities, textImageModelCapabilities, textOnlyModelCapabilities, textToBase64Utf8, toolDiscovery, toolResultMessageFromResult, toolSearchToolName, truncateCodePoints, urlAttachmentSource, validInteractionReceipt, validateInteractionSubmission, validateNoDanglingHostToolCalls, withSubagentStatus, zeroAgentUsage };
|
|
19
|
+
export { AgentAbortReason, AgentActivity, AgentAwaitingInput, AgentBlocked, AgentBlockedKind, AgentBusy, AgentCompacting, AgentContentCapabilities, AgentDone, AgentEnd, AgentError, AgentErrorCode, AgentEvent, AgentFailed, AgentGenerating, AgentIdle, AgentInputUsage, AgentMessage, AgentModelCapabilities, AgentOutputUsage, AgentReasoningEffort, AgentRetry, AgentRetrying, AgentRunningTools, AgentStart, AgentStatus, AgentStatusTree, AgentToolActivityCall, AgentUsage, AgentWebSocketClientMessage, AgentWebSocketServerMessage, AgentWorking, AssistantAgentMessage, AssistantMessageEvent, AssistantPart, AssistantReasoningPart, AssistantReasoningReplay, AssistantTextPart, type AttachmentContentPart, AttachmentSource, type AttachmentSourceResolver, AudioPart, BackgroundToolAccepted, BackgroundToolExecution, BackgroundToolInput, type BoundedNestedToolCallArgs, CompactionEnd, CompactionStart, Content, ContentPart, type DanglingHostToolCall, DocumentPart, type ErrorToolResultInput, FileDescriptor, FileId, FilePart, HitlRequest, HitlResponse, HitlResponseSource, HostToolCallPart, ImagePart, InlineBase64AttachmentSource, InputCancelled, type InputContentFormatter, InputDescriptor, InputRequest, InputRequested, InputResponse, InputResponseInput, InputResponseOutcome, type InputResponseStructuredContent, type InputResponseValidator, InputSubmitted, type InputToolHandler, InteractionActionDescriptor, InteractionAdmissionError, InteractionBusinessOutcome, type InteractionCallValidator, InteractionCancelled, InteractionCandidate, InteractionClaim, InteractionDescriptor, type InteractionHost, InteractionHostError, type InteractionOutcome, type InteractionPreflight, InteractionReceipt, InteractionReceiptStatus, type InteractionRef, InteractionRequest, InteractionRequested, InteractionResponse, InteractionResponseInput, InteractionResponseOutcome, type InteractionResponseStructuredContent, type InteractionResponseValidator, InteractionSubmitted, InteractionValidationError, LLMReasoningDelta, LLMReasoningReplay, LLMStreamEnd, LLMStreamStart, LLMTextDelta, MessageAnnotations, MessageAuthor, type MessageEnvelope, MessageId, MessageInstruction, NestedToolCallAccess, NestedToolCallCounts, type NestedToolCallInput, NestedToolCallRecord, type NestedToolCallRecorder, type NestedToolCallResultFields, NestedToolCallStatus, NestedToolCalls, PlainHitlResponse, type PlainInputResponse, type PlainInteractionResponse, type PlainQuestionAnswer, type PlainQuestionResponse, type PlainToolApprovalResponse, ProviderErrorInfo, ProviderFailureKind, ProviderStreamDiagnostics, ProviderStreamProtocol, ProviderStreamResponseFormat, ProviderToolCallPart, ProviderToolResult, ProviderToolResultPart, QuestionAnswer, QuestionAnswered, QuestionCancelled, QuestionOption, QuestionPrompt, QuestionRequest, QuestionRequested, QuestionResponse, QuestionResponseInput, QuestionResponseOutcome, type QuestionResponseStructuredContent, QuestionToolParams, RedactedReasoningReplay, RefAttachmentSource, type RepairDanglingHostToolCallsOptions, SessionSnapshot, SignedReasoningReplay, SubagentCompleted, SubagentStarted, SubagentStatus, SubagentStatusEntry, type TerminalAgentEvent, TextPart, ToolApprovalDecision, ToolApprovalDenied, ToolApprovalGranted, ToolApprovalMode, ToolApprovalPolicy, type ToolApprovalPreviewer, ToolApprovalRequest, ToolApprovalRequested, ToolApprovalResponse, ToolApprovalResponseInput, ToolCall, ToolCallableBy, ToolChangeCut, ToolChangeItem, ToolChangePreview, ToolChangePreviewError, ToolChangePreviewErrorCause, ToolChangePreviewFailure, ToolChangeScalar, ToolChangeSetCuts, ToolChangeSideCuts, ToolChangeTarget, ToolDef, ToolDiscovery, ToolExecutionAccepted, ToolExecutionCompleted, ToolExecutionError, ToolExecutionStarted, type ToolExposure, ToolFieldChange, ToolInputDelta, ToolInputEnd, ToolInputStart, ToolJsonSchema, ToolJsonSchemaObject, ToolListChange, ToolLoading, ToolResult, ToolResultMessage, ToolSearchActivation, ToolSetChange, ToolStructuredChange, ToolTextChange, ToolValueChange, type TranscriptInvariantValidation, TurnEnd, TurnStart, UrlAttachmentSource, UsageUpdate, UserInput, UserMessage, UserMessageEvent, activatedToolNames, addAgentUsage, agentBlockedKind, agentStatusFromEvents, agentStatusRetry, agentStatusTreeFromEvents, appendTextToContent, assistantContent, assistantHostToolCalls, assistantReasoningText, attachmentSourceBase64, attachmentSourceDataUrl, attachmentSourcePreview, attachmentSourceText, attachmentSourceUrl, base64ToBytes, boundNestedToolCallArgs, bytesToBase64, contentPartPreview, contentPartText, contentParts, contentPreview, contentText, danglingHostToolCalls, declaredToolDefs, decodeBackgroundToolInput, decodeToolJsonSchema, decodeToolJsonSchemaObject, documentPartFromText, emptyNestedToolCallRecorder, fileIdPattern, fileLabel, fileNotCapturedLabel, filePartFromBytes, filePartText, formatFileSize, formatInputResponseContent, formatInteractionResponseContent, formatQuestionResponseContent, hitlRequestBlockedKind, hitlResponseEvent, idleAgentStatus, inferTextDocumentMimeType, initialAgentStatusTree, inlineBase64AttachmentSource, inlineBase64Source, inputRequestId, inputResponseStructuredContent, interactionJsonEquals, interactionRequestId, interactionResponseStructuredContent, interactionUnknownOutcomeNotice, isAgentStatusLive, isCodeModeCallable, isCodeModeFailClosed, isContentEmpty, isDeferredTool, isFileId, isInstructionMessage, isProviderToolDef, isSubagentAcceptedToolResult, isSubagentObservationToolResult, isTerminalAgentEvent, isTextDocumentMimeType, isToolJsonSchemaObject, isToolStageable, latestInstructionMessages, latestInstructionState, makeBackgroundToolAcceptedResult, makeErrorToolResult, makeInteractionToolResult, makeNestedToolCallRecorder, makeSubagentRunId, messageContextText, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, nextAgentStatus, nextAgentStatusTree, normalizeFileMimeType, plainHitlResponse, plainInputResponse, plainInteractionResponse, plainQuestionAnswer, plainQuestionResponse, plainToolApprovalResponse, prependMessageContextToContent, providerToolDefs, questionResponseStructuredContent, reconcileAgentStatus, recordNestedToolCall, refAttachmentSource, repairDanglingHostToolCalls, replaceLoneSurrogates, replaceLoneSurrogatesDeep, resolveContentAttachmentSources, resolveMessageAttachmentSources, resolveMessagesAttachmentSources, sameInteractionBinding, sameInteractionCall, settleAgentStatusTree, startAgentStatusTree, textDocumentMimeTypeFromFilename, textImageDocumentModelCapabilities, textImageModelCapabilities, textOnlyModelCapabilities, textToBase64Utf8, toolDiscovery, toolResultMessageFromResult, toolSearchToolName, truncateCodePoints, urlAttachmentSource, validInteractionReceipt, validateInteractionSubmission, validateNoDanglingHostToolCalls, withSubagentStatus, zeroAgentUsage };
|
|
20
20
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/protocol/index.ts"],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/protocol/index.ts"],"mappings":";;;;;;;;;;;;;;;;KA8WY,SAAA"}
|
package/dist/protocol/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { FileDescriptor, FileId, fileIdPattern, fileLabel, fileNotCapturedLabel,
|
|
|
3
3
|
import { AttachmentSource, AudioPart, Content, ContentPart, DocumentPart, FilePart, ImagePart, InlineBase64AttachmentSource, RefAttachmentSource, TextPart, UrlAttachmentSource, appendTextToContent, attachmentSourceBase64, attachmentSourceDataUrl, attachmentSourcePreview, attachmentSourceText, attachmentSourceUrl, base64ToBytes, bytesToBase64, contentPartPreview, contentPartText, contentParts, contentPreview, contentText, documentPartFromText, filePartFromBytes, filePartText, inferTextDocumentMimeType, inlineBase64AttachmentSource, inlineBase64Source, isContentEmpty, isTextDocumentMimeType, refAttachmentSource, replaceLoneSurrogates, replaceLoneSurrogatesDeep, resolveContentAttachmentSources, textDocumentMimeTypeFromFilename, textToBase64Utf8, urlAttachmentSource } from "./content.mjs";
|
|
4
4
|
import { truncateCodePoints } from "./bounded-text.mjs";
|
|
5
5
|
import { AgentInputUsage, AgentOutputUsage, AgentUsage, addAgentUsage, zeroAgentUsage } from "./usage.mjs";
|
|
6
|
-
import { NestedToolCallCounts, NestedToolCallRecord, NestedToolCallStatus, NestedToolCalls, boundNestedToolCallArgs, emptyNestedToolCallRecorder, makeNestedToolCallRecorder, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, recordNestedToolCall } from "./nested-tool-calls.mjs";
|
|
6
|
+
import { NestedToolCallAccess, NestedToolCallCounts, NestedToolCallRecord, NestedToolCallStatus, NestedToolCalls, boundNestedToolCallArgs, emptyNestedToolCallRecorder, makeNestedToolCallRecorder, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, recordNestedToolCall } from "./nested-tool-calls.mjs";
|
|
7
7
|
import { BackgroundToolAccepted, BackgroundToolExecution, BackgroundToolInput, HitlRequest, HitlResponse, HitlResponseSource, InputDescriptor, InputRequest, InputResponse, InputResponseOutcome, InteractionActionDescriptor, InteractionAdmissionError, InteractionBusinessOutcome, InteractionCandidate, InteractionClaim, InteractionDescriptor, InteractionHostError, InteractionReceipt, InteractionReceiptStatus, InteractionRequest, InteractionResponse, InteractionResponseOutcome, InteractionValidationError, PlainHitlResponse, QuestionAnswer, QuestionOption, QuestionPrompt, QuestionRequest, QuestionResponse, QuestionResponseOutcome, QuestionToolParams, ToolApprovalDecision, ToolApprovalMode, ToolApprovalPolicy, ToolApprovalRequest, ToolApprovalResponse, ToolCall, ToolCallableBy, ToolDef, ToolDiscovery, ToolJsonSchema, ToolJsonSchemaObject, ToolLoading, ToolResult, decodeBackgroundToolInput, decodeToolJsonSchema, decodeToolJsonSchemaObject, formatInputResponseContent, formatInteractionResponseContent, formatQuestionResponseContent, inputRequestId, inputResponseStructuredContent, interactionJsonEquals, interactionRequestId, interactionResponseStructuredContent, interactionUnknownOutcomeNotice, isCodeModeCallable, isCodeModeFailClosed, isDeferredTool, isProviderToolDef, isToolJsonSchemaObject, isToolStageable, makeBackgroundToolAcceptedResult, makeErrorToolResult, makeInteractionToolResult, plainHitlResponse, plainInputResponse, plainInteractionResponse, plainQuestionAnswer, plainQuestionResponse, plainToolApprovalResponse, providerToolDefs, questionResponseStructuredContent, sameInteractionBinding, sameInteractionCall, toolDiscovery, validInteractionReceipt, validateInteractionSubmission } from "./tool.mjs";
|
|
8
8
|
import { AgentContentCapabilities, AgentModelCapabilities, textImageDocumentModelCapabilities, textImageModelCapabilities, textOnlyModelCapabilities } from "./capability.mjs";
|
|
9
9
|
import { AgentMessage, AssistantAgentMessage, AssistantPart, AssistantReasoningPart, AssistantReasoningReplay, AssistantTextPart, HostToolCallPart, MessageAnnotations, MessageAuthor, MessageInstruction, ProviderToolCallPart, ProviderToolResultPart, RedactedReasoningReplay, SignedReasoningReplay, ToolResultMessage, UserMessage, assistantContent, assistantHostToolCalls, assistantReasoningText, danglingHostToolCalls, isInstructionMessage, latestInstructionMessages, latestInstructionState, messageContextText, prependMessageContextToContent, repairDanglingHostToolCalls, resolveMessageAttachmentSources, resolveMessagesAttachmentSources, toolResultMessageFromResult, validateNoDanglingHostToolCalls } from "./message.mjs";
|
|
@@ -12,4 +12,4 @@ import { AgentReasoningEffort } from "./reasoning.mjs";
|
|
|
12
12
|
import { AgentActivity, AgentBlocked, AgentBlockedKind, AgentBusy, AgentCompacting, AgentDone, AgentFailed, AgentGenerating, AgentIdle, AgentRetrying, AgentRunningTools, AgentStatus, AgentStatusTree, AgentToolActivityCall, AgentWorking, SubagentStatusEntry, agentBlockedKind, agentStatusFromEvents, agentStatusRetry, agentStatusTreeFromEvents, hitlRequestBlockedKind, idleAgentStatus, initialAgentStatusTree, isAgentStatusLive, nextAgentStatus, nextAgentStatusTree, reconcileAgentStatus, settleAgentStatusTree, startAgentStatusTree, withSubagentStatus } from "./status.mjs";
|
|
13
13
|
import { AgentWebSocketClientMessage, AgentWebSocketServerMessage, InputResponseInput, InteractionResponseInput, QuestionResponseInput, SessionSnapshot, ToolApprovalResponseInput, UserInput } from "./session.mjs";
|
|
14
14
|
import { ToolSearchActivation, activatedToolNames, declaredToolDefs, toolSearchToolName } from "./tool-search.mjs";
|
|
15
|
-
export { AgentAbortReason, AgentActivity, AgentAwaitingInput, AgentBlocked, AgentBlockedKind, AgentBusy, AgentCompacting, AgentContentCapabilities, AgentDone, AgentEnd, AgentError, AgentErrorCode, AgentEvent, AgentFailed, AgentGenerating, AgentIdle, AgentInputUsage, AgentMessage, AgentModelCapabilities, AgentOutputUsage, AgentReasoningEffort, AgentRetry, AgentRetrying, AgentRunningTools, AgentStart, AgentStatus, AgentStatusTree, AgentToolActivityCall, AgentUsage, AgentWebSocketClientMessage, AgentWebSocketServerMessage, AgentWorking, AssistantAgentMessage, AssistantMessageEvent, AssistantPart, AssistantReasoningPart, AssistantReasoningReplay, AssistantTextPart, AttachmentSource, AudioPart, BackgroundToolAccepted, BackgroundToolExecution, BackgroundToolInput, CompactionEnd, CompactionStart, Content, ContentPart, DocumentPart, FileDescriptor, FileId, FilePart, HitlRequest, HitlResponse, HitlResponseSource, HostToolCallPart, ImagePart, InlineBase64AttachmentSource, InputCancelled, InputDescriptor, InputRequest, InputRequested, InputResponse, InputResponseInput, InputResponseOutcome, InputSubmitted, InteractionActionDescriptor, InteractionAdmissionError, InteractionBusinessOutcome, InteractionCancelled, InteractionCandidate, InteractionClaim, InteractionDescriptor, InteractionHostError, InteractionReceipt, InteractionReceiptStatus, InteractionRequest, InteractionRequested, InteractionResponse, InteractionResponseInput, InteractionResponseOutcome, InteractionSubmitted, InteractionValidationError, LLMReasoningDelta, LLMReasoningReplay, LLMStreamEnd, LLMStreamStart, LLMTextDelta, MessageAnnotations, MessageAuthor, MessageInstruction, NestedToolCallCounts, NestedToolCallRecord, NestedToolCallStatus, NestedToolCalls, PlainHitlResponse, ProviderErrorInfo, ProviderFailureKind, ProviderStreamDiagnostics, ProviderStreamProtocol, ProviderStreamResponseFormat, ProviderToolCallPart, ProviderToolResult, ProviderToolResultPart, QuestionAnswer, QuestionAnswered, QuestionCancelled, QuestionOption, QuestionPrompt, QuestionRequest, QuestionRequested, QuestionResponse, QuestionResponseInput, QuestionResponseOutcome, QuestionToolParams, RedactedReasoningReplay, RefAttachmentSource, SessionSnapshot, SignedReasoningReplay, SubagentCompleted, SubagentStarted, SubagentStatus, SubagentStatusEntry, TextPart, ToolApprovalDecision, ToolApprovalDenied, ToolApprovalGranted, ToolApprovalMode, ToolApprovalPolicy, ToolApprovalRequest, ToolApprovalRequested, ToolApprovalResponse, ToolApprovalResponseInput, ToolCall, ToolCallableBy, ToolChangeCut, ToolChangeItem, ToolChangePreview, ToolChangePreviewError, ToolChangePreviewErrorCause, ToolChangePreviewFailure, ToolChangeScalar, ToolChangeSetCuts, ToolChangeSideCuts, ToolChangeTarget, ToolDef, ToolDiscovery, ToolExecutionAccepted, ToolExecutionCompleted, ToolExecutionError, ToolExecutionStarted, ToolFieldChange, ToolInputDelta, ToolInputEnd, ToolInputStart, ToolJsonSchema, ToolJsonSchemaObject, ToolListChange, ToolLoading, ToolResult, ToolResultMessage, ToolSearchActivation, ToolSetChange, ToolStructuredChange, ToolTextChange, ToolValueChange, TurnEnd, TurnStart, UrlAttachmentSource, UsageUpdate, UserInput, UserMessage, UserMessageEvent, activatedToolNames, addAgentUsage, agentBlockedKind, agentStatusFromEvents, agentStatusRetry, agentStatusTreeFromEvents, appendTextToContent, assistantContent, assistantHostToolCalls, assistantReasoningText, attachmentSourceBase64, attachmentSourceDataUrl, attachmentSourcePreview, attachmentSourceText, attachmentSourceUrl, base64ToBytes, boundNestedToolCallArgs, bytesToBase64, contentPartPreview, contentPartText, contentParts, contentPreview, contentText, danglingHostToolCalls, declaredToolDefs, decodeBackgroundToolInput, decodeToolJsonSchema, decodeToolJsonSchemaObject, documentPartFromText, emptyNestedToolCallRecorder, fileIdPattern, fileLabel, fileNotCapturedLabel, filePartFromBytes, filePartText, formatFileSize, formatInputResponseContent, formatInteractionResponseContent, formatQuestionResponseContent, hitlRequestBlockedKind, hitlResponseEvent, idleAgentStatus, inferTextDocumentMimeType, initialAgentStatusTree, inlineBase64AttachmentSource, inlineBase64Source, inputRequestId, inputResponseStructuredContent, interactionJsonEquals, interactionRequestId, interactionResponseStructuredContent, interactionUnknownOutcomeNotice, isAgentStatusLive, isCodeModeCallable, isCodeModeFailClosed, isContentEmpty, isDeferredTool, isFileId, isInstructionMessage, isProviderToolDef, isSubagentAcceptedToolResult, isSubagentObservationToolResult, isTerminalAgentEvent, isTextDocumentMimeType, isToolJsonSchemaObject, isToolStageable, latestInstructionMessages, latestInstructionState, makeBackgroundToolAcceptedResult, makeErrorToolResult, makeInteractionToolResult, makeNestedToolCallRecorder, makeSubagentRunId, messageContextText, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, nextAgentStatus, nextAgentStatusTree, normalizeFileMimeType, plainHitlResponse, plainInputResponse, plainInteractionResponse, plainQuestionAnswer, plainQuestionResponse, plainToolApprovalResponse, prependMessageContextToContent, providerToolDefs, questionResponseStructuredContent, reconcileAgentStatus, recordNestedToolCall, refAttachmentSource, repairDanglingHostToolCalls, replaceLoneSurrogates, replaceLoneSurrogatesDeep, resolveContentAttachmentSources, resolveMessageAttachmentSources, resolveMessagesAttachmentSources, sameInteractionBinding, sameInteractionCall, settleAgentStatusTree, startAgentStatusTree, textDocumentMimeTypeFromFilename, textImageDocumentModelCapabilities, textImageModelCapabilities, textOnlyModelCapabilities, textToBase64Utf8, toolDiscovery, toolResultMessageFromResult, toolSearchToolName, truncateCodePoints, urlAttachmentSource, validInteractionReceipt, validateInteractionSubmission, validateNoDanglingHostToolCalls, withSubagentStatus, zeroAgentUsage };
|
|
15
|
+
export { AgentAbortReason, AgentActivity, AgentAwaitingInput, AgentBlocked, AgentBlockedKind, AgentBusy, AgentCompacting, AgentContentCapabilities, AgentDone, AgentEnd, AgentError, AgentErrorCode, AgentEvent, AgentFailed, AgentGenerating, AgentIdle, AgentInputUsage, AgentMessage, AgentModelCapabilities, AgentOutputUsage, AgentReasoningEffort, AgentRetry, AgentRetrying, AgentRunningTools, AgentStart, AgentStatus, AgentStatusTree, AgentToolActivityCall, AgentUsage, AgentWebSocketClientMessage, AgentWebSocketServerMessage, AgentWorking, AssistantAgentMessage, AssistantMessageEvent, AssistantPart, AssistantReasoningPart, AssistantReasoningReplay, AssistantTextPart, AttachmentSource, AudioPart, BackgroundToolAccepted, BackgroundToolExecution, BackgroundToolInput, CompactionEnd, CompactionStart, Content, ContentPart, DocumentPart, FileDescriptor, FileId, FilePart, HitlRequest, HitlResponse, HitlResponseSource, HostToolCallPart, ImagePart, InlineBase64AttachmentSource, InputCancelled, InputDescriptor, InputRequest, InputRequested, InputResponse, InputResponseInput, InputResponseOutcome, InputSubmitted, InteractionActionDescriptor, InteractionAdmissionError, InteractionBusinessOutcome, InteractionCancelled, InteractionCandidate, InteractionClaim, InteractionDescriptor, InteractionHostError, InteractionReceipt, InteractionReceiptStatus, InteractionRequest, InteractionRequested, InteractionResponse, InteractionResponseInput, InteractionResponseOutcome, InteractionSubmitted, InteractionValidationError, LLMReasoningDelta, LLMReasoningReplay, LLMStreamEnd, LLMStreamStart, LLMTextDelta, MessageAnnotations, MessageAuthor, MessageInstruction, NestedToolCallAccess, NestedToolCallCounts, NestedToolCallRecord, NestedToolCallStatus, NestedToolCalls, PlainHitlResponse, ProviderErrorInfo, ProviderFailureKind, ProviderStreamDiagnostics, ProviderStreamProtocol, ProviderStreamResponseFormat, ProviderToolCallPart, ProviderToolResult, ProviderToolResultPart, QuestionAnswer, QuestionAnswered, QuestionCancelled, QuestionOption, QuestionPrompt, QuestionRequest, QuestionRequested, QuestionResponse, QuestionResponseInput, QuestionResponseOutcome, QuestionToolParams, RedactedReasoningReplay, RefAttachmentSource, SessionSnapshot, SignedReasoningReplay, SubagentCompleted, SubagentStarted, SubagentStatus, SubagentStatusEntry, TextPart, ToolApprovalDecision, ToolApprovalDenied, ToolApprovalGranted, ToolApprovalMode, ToolApprovalPolicy, ToolApprovalRequest, ToolApprovalRequested, ToolApprovalResponse, ToolApprovalResponseInput, ToolCall, ToolCallableBy, ToolChangeCut, ToolChangeItem, ToolChangePreview, ToolChangePreviewError, ToolChangePreviewErrorCause, ToolChangePreviewFailure, ToolChangeScalar, ToolChangeSetCuts, ToolChangeSideCuts, ToolChangeTarget, ToolDef, ToolDiscovery, ToolExecutionAccepted, ToolExecutionCompleted, ToolExecutionError, ToolExecutionStarted, ToolFieldChange, ToolInputDelta, ToolInputEnd, ToolInputStart, ToolJsonSchema, ToolJsonSchemaObject, ToolListChange, ToolLoading, ToolResult, ToolResultMessage, ToolSearchActivation, ToolSetChange, ToolStructuredChange, ToolTextChange, ToolValueChange, TurnEnd, TurnStart, UrlAttachmentSource, UsageUpdate, UserInput, UserMessage, UserMessageEvent, activatedToolNames, addAgentUsage, agentBlockedKind, agentStatusFromEvents, agentStatusRetry, agentStatusTreeFromEvents, appendTextToContent, assistantContent, assistantHostToolCalls, assistantReasoningText, attachmentSourceBase64, attachmentSourceDataUrl, attachmentSourcePreview, attachmentSourceText, attachmentSourceUrl, base64ToBytes, boundNestedToolCallArgs, bytesToBase64, contentPartPreview, contentPartText, contentParts, contentPreview, contentText, danglingHostToolCalls, declaredToolDefs, decodeBackgroundToolInput, decodeToolJsonSchema, decodeToolJsonSchemaObject, documentPartFromText, emptyNestedToolCallRecorder, fileIdPattern, fileLabel, fileNotCapturedLabel, filePartFromBytes, filePartText, formatFileSize, formatInputResponseContent, formatInteractionResponseContent, formatQuestionResponseContent, hitlRequestBlockedKind, hitlResponseEvent, idleAgentStatus, inferTextDocumentMimeType, initialAgentStatusTree, inlineBase64AttachmentSource, inlineBase64Source, inputRequestId, inputResponseStructuredContent, interactionJsonEquals, interactionRequestId, interactionResponseStructuredContent, interactionUnknownOutcomeNotice, isAgentStatusLive, isCodeModeCallable, isCodeModeFailClosed, isContentEmpty, isDeferredTool, isFileId, isInstructionMessage, isProviderToolDef, isSubagentAcceptedToolResult, isSubagentObservationToolResult, isTerminalAgentEvent, isTextDocumentMimeType, isToolJsonSchemaObject, isToolStageable, latestInstructionMessages, latestInstructionState, makeBackgroundToolAcceptedResult, makeErrorToolResult, makeInteractionToolResult, makeNestedToolCallRecorder, makeSubagentRunId, messageContextText, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, nextAgentStatus, nextAgentStatusTree, normalizeFileMimeType, plainHitlResponse, plainInputResponse, plainInteractionResponse, plainQuestionAnswer, plainQuestionResponse, plainToolApprovalResponse, prependMessageContextToContent, providerToolDefs, questionResponseStructuredContent, reconcileAgentStatus, recordNestedToolCall, refAttachmentSource, repairDanglingHostToolCalls, replaceLoneSurrogates, replaceLoneSurrogatesDeep, resolveContentAttachmentSources, resolveMessageAttachmentSources, resolveMessagesAttachmentSources, sameInteractionBinding, sameInteractionCall, settleAgentStatusTree, startAgentStatusTree, textDocumentMimeTypeFromFilename, textImageDocumentModelCapabilities, textImageModelCapabilities, textOnlyModelCapabilities, textToBase64Utf8, toolDiscovery, toolResultMessageFromResult, toolSearchToolName, truncateCodePoints, urlAttachmentSource, validInteractionReceipt, validateInteractionSubmission, validateNoDanglingHostToolCalls, withSubagentStatus, zeroAgentUsage };
|
|
@@ -21,11 +21,15 @@ declare const nestedToolCallMaxTotalArgsBytes: number;
|
|
|
21
21
|
declare const nestedToolCallMaxErrorChars = 500;
|
|
22
22
|
declare const NestedToolCallStatus: Schema.Literals<readonly ["ok", "error", "cancelled"]>;
|
|
23
23
|
type NestedToolCallStatus = typeof NestedToolCallStatus.Type;
|
|
24
|
+
/** A nested call's effective access, the `ToolAccess` literals (`toolCallAccess`). */
|
|
25
|
+
declare const NestedToolCallAccess: Schema.Literals<readonly ["read", "write", "destructive"]>;
|
|
26
|
+
type NestedToolCallAccess = typeof NestedToolCallAccess.Type;
|
|
24
27
|
declare const NestedToolCallRecord_base: Schema.Class<NestedToolCallRecord, Schema.Struct<{
|
|
25
28
|
readonly id: Schema.Trimmed;
|
|
26
29
|
readonly name: Schema.Trimmed;
|
|
27
30
|
readonly args: Schema.String;
|
|
28
31
|
readonly status: Schema.Literals<readonly ["ok", "error", "cancelled"]>;
|
|
32
|
+
readonly access: Schema.optional<Schema.Literals<readonly ["read", "write", "destructive"]>>;
|
|
29
33
|
readonly durationMs: Schema.optional<Schema.Number>;
|
|
30
34
|
readonly error: Schema.optional<Schema.String>;
|
|
31
35
|
readonly usage: Schema.optional<typeof AgentUsage>;
|
|
@@ -33,6 +37,8 @@ declare const NestedToolCallRecord_base: Schema.Class<NestedToolCallRecord, Sche
|
|
|
33
37
|
/** One nested tool call made by a tool on behalf of the model (for example a code mode script).
|
|
34
38
|
* Host/UI audit data only: never model-visible and never the nested result itself.
|
|
35
39
|
* `args` is compact JSON, cut to the byte bounds with a trailing `…` (then no longer JSON).
|
|
40
|
+
* `access` is the call's effective access (`read` for a read-only call of a `write` tool); absent
|
|
41
|
+
* on records written before it existed and for tools the caller could not resolve.
|
|
36
42
|
*/
|
|
37
43
|
declare class NestedToolCallRecord extends NestedToolCallRecord_base {}
|
|
38
44
|
declare const NestedToolCallCounts_base: Schema.Class<NestedToolCallCounts, Schema.Struct<{
|
|
@@ -56,7 +62,8 @@ type NestedToolCallInput = {
|
|
|
56
62
|
/** Caller-assigned id; the convention is `<parentToolCallId>/<seq>`. */readonly id: string;
|
|
57
63
|
readonly name: string; /** Raw call arguments; recorded as compact JSON within the byte bounds. */
|
|
58
64
|
readonly args: unknown;
|
|
59
|
-
readonly status: NestedToolCallStatus;
|
|
65
|
+
readonly status: NestedToolCallStatus; /** The call's effective access (`NestedToolExecutor.access`); omit when unknown. */
|
|
66
|
+
readonly access?: NestedToolCallAccess;
|
|
60
67
|
readonly durationMs?: number;
|
|
61
68
|
readonly error?: string;
|
|
62
69
|
readonly usage?: AgentUsage;
|
|
@@ -112,5 +119,5 @@ type NestedToolCallResultFields = {
|
|
|
112
119
|
*/
|
|
113
120
|
declare const nestedToolCallResultFields: (recorder: NestedToolCallRecorder) => NestedToolCallResultFields;
|
|
114
121
|
//#endregion
|
|
115
|
-
export { BoundedNestedToolCallArgs, NestedToolCallCounts, NestedToolCallInput, NestedToolCallRecord, NestedToolCallRecorder, NestedToolCallResultFields, NestedToolCallStatus, NestedToolCalls, boundNestedToolCallArgs, emptyNestedToolCallRecorder, makeNestedToolCallRecorder, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, recordNestedToolCall };
|
|
122
|
+
export { BoundedNestedToolCallArgs, NestedToolCallAccess, NestedToolCallCounts, NestedToolCallInput, NestedToolCallRecord, NestedToolCallRecorder, NestedToolCallResultFields, NestedToolCallStatus, NestedToolCalls, boundNestedToolCallArgs, emptyNestedToolCallRecorder, makeNestedToolCallRecorder, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, recordNestedToolCall };
|
|
116
123
|
//# sourceMappingURL=nested-tool-calls.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested-tool-calls.d.mts","names":[],"sources":["../../src/protocol/nested-tool-calls.ts"],"mappings":";;;;;;AAeA;;cAAa,sBAAA;;cAGA,8BAAA;AAAb;;;AAAA,cAKa,yBAAA,GAA6B,QAA4B;AAL3B;AAAA,cAW9B,0BAAA;;cAGA,+BAAA;;cAGA,2BAAA;AAAA,cAEA,oBAAA,EAAoB,MAAA,CAAA,QAAA;AAAA,KAErB,oBAAA,UAA8B,oBAAA,CAAqB,IAAI;AAAA,cAAA,yBAAA
|
|
1
|
+
{"version":3,"file":"nested-tool-calls.d.mts","names":[],"sources":["../../src/protocol/nested-tool-calls.ts"],"mappings":";;;;;;AAeA;;cAAa,sBAAA;;cAGA,8BAAA;AAAb;;;AAAA,cAKa,yBAAA,GAA6B,QAA4B;AAL3B;AAAA,cAW9B,0BAAA;;cAGA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;AAAA;;;;cAMhB,0BAAA,GACX,QAAA,EAAU,sBAAA,KACT,0BAQF"}
|
|
@@ -25,15 +25,24 @@ const NestedToolCallStatus = Schema.Literals([
|
|
|
25
25
|
"error",
|
|
26
26
|
"cancelled"
|
|
27
27
|
]);
|
|
28
|
+
/** A nested call's effective access, the `ToolAccess` literals (`toolCallAccess`). */
|
|
29
|
+
const NestedToolCallAccess = Schema.Literals([
|
|
30
|
+
"read",
|
|
31
|
+
"write",
|
|
32
|
+
"destructive"
|
|
33
|
+
]);
|
|
28
34
|
/** One nested tool call made by a tool on behalf of the model (for example a code mode script).
|
|
29
35
|
* Host/UI audit data only: never model-visible and never the nested result itself.
|
|
30
36
|
* `args` is compact JSON, cut to the byte bounds with a trailing `…` (then no longer JSON).
|
|
37
|
+
* `access` is the call's effective access (`read` for a read-only call of a `write` tool); absent
|
|
38
|
+
* on records written before it existed and for tools the caller could not resolve.
|
|
31
39
|
*/
|
|
32
40
|
var NestedToolCallRecord = class extends Schema.Class("NestedToolCallRecord")({
|
|
33
41
|
id: NonEmptyTrimmedString,
|
|
34
42
|
name: NonEmptyTrimmedString,
|
|
35
43
|
args: Schema.String,
|
|
36
44
|
status: NestedToolCallStatus,
|
|
45
|
+
access: Schema.optional(NestedToolCallAccess),
|
|
37
46
|
durationMs: Schema.optional(Schema.Number),
|
|
38
47
|
error: Schema.optional(Schema.String),
|
|
39
48
|
usage: Schema.optional(AgentUsage)
|
|
@@ -114,6 +123,7 @@ const recordNestedToolCall = (recorder, input) => {
|
|
|
114
123
|
args,
|
|
115
124
|
status: input.status
|
|
116
125
|
};
|
|
126
|
+
if (input.access !== void 0) fields.access = input.access;
|
|
117
127
|
if (input.durationMs !== void 0) fields.durationMs = input.durationMs;
|
|
118
128
|
if (input.error !== void 0) fields.error = truncateCodePoints(input.error, 500);
|
|
119
129
|
if (input.usage !== void 0) fields.usage = input.usage;
|
|
@@ -138,6 +148,6 @@ const nestedToolCallResultFields = (recorder) => {
|
|
|
138
148
|
};
|
|
139
149
|
};
|
|
140
150
|
//#endregion
|
|
141
|
-
export { NestedToolCallCounts, NestedToolCallRecord, NestedToolCallStatus, NestedToolCalls, boundNestedToolCallArgs, emptyNestedToolCallRecorder, makeNestedToolCallRecorder, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, recordNestedToolCall };
|
|
151
|
+
export { NestedToolCallAccess, NestedToolCallCounts, NestedToolCallRecord, NestedToolCallStatus, NestedToolCalls, boundNestedToolCallArgs, emptyNestedToolCallRecorder, makeNestedToolCallRecorder, nestedToolCallMaxArgsBytes, nestedToolCallMaxCalls, nestedToolCallMaxErrorChars, nestedToolCallMaxRecordedCalls, nestedToolCallMaxTotalArgsBytes, nestedToolCallRecordLimit, nestedToolCallResultFields, recordNestedToolCall };
|
|
142
152
|
|
|
143
153
|
//# sourceMappingURL=nested-tool-calls.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested-tool-calls.mjs","names":[],"sources":["../../src/protocol/nested-tool-calls.ts"],"sourcesContent":["import * as Schema from 'effect/Schema'\nimport {\n compactToolArguments,\n truncateCodePoints,\n truncateUtf8,\n utf8ByteLength\n} from './bounded-text.ts'\nimport { addAgentUsage, AgentUsage } from './usage.ts'\n\nconst NonEmptyTrimmedString = Schema.Trimmed.pipe(Schema.check(Schema.isNonEmpty()))\n\n/** Default number of nested calls a record keeps; later calls are dropped (counted, not listed)\n * and mark the record incomplete. Callers size the record to their own call limit with\n * `makeNestedToolCallRecorder({ maxCalls })` (code mode uses `limits.maxNestedCalls`).\n */\nexport const nestedToolCallMaxCalls = 256\n\n/** Ceiling of any record's `maxCalls`: a larger (or infinite) limit keeps this many calls. */\nexport const nestedToolCallMaxRecordedCalls = 4096\n\n/** The number of calls a record keeps for a requested `maxCalls`: whole, within\n * `0..nestedToolCallMaxRecordedCalls`; `NaN` and absent mean `nestedToolCallMaxCalls`.\n */\nexport const nestedToolCallRecordLimit = (maxCalls: number | undefined): number =>\n maxCalls === undefined || Number.isNaN(maxCalls)\n ? nestedToolCallMaxCalls\n : Math.max(0, Math.min(nestedToolCallMaxRecordedCalls, Math.floor(maxCalls)))\n\n/** UTF-8 byte budget for one recorded call's compact JSON arguments. */\nexport const nestedToolCallMaxArgsBytes = 8 * 1024\n\n/** UTF-8 byte budget for the compact JSON arguments of all recorded calls together. */\nexport const nestedToolCallMaxTotalArgsBytes = 32 * 1024\n\n/** Recorded nested-call errors are cut to this many characters (code points). */\nexport const nestedToolCallMaxErrorChars = 500\n\nexport const NestedToolCallStatus = Schema.Literals(['ok', 'error', 'cancelled'])\n\nexport type NestedToolCallStatus = typeof NestedToolCallStatus.Type\n\n/** One nested tool call made by a tool on behalf of the model (for example a code mode script).\n * Host/UI audit data only: never model-visible and never the nested result itself.\n * `args` is compact JSON, cut to the byte bounds with a trailing `…` (then no longer JSON).\n */\nexport class NestedToolCallRecord extends Schema.Class<NestedToolCallRecord>(\n 'NestedToolCallRecord'\n)({\n id: NonEmptyTrimmedString,\n name: NonEmptyTrimmedString,\n args: Schema.String,\n status: NestedToolCallStatus,\n durationMs: Schema.optional(Schema.Number),\n error: Schema.optional(Schema.String),\n usage: Schema.optional(AgentUsage)\n}) {}\n\n/** Calls per status over every recorded call, including calls dropped from `calls`. */\nexport class NestedToolCallCounts extends Schema.Class<NestedToolCallCounts>(\n 'NestedToolCallCounts'\n)({\n ok: Schema.Number,\n error: Schema.Number,\n cancelled: Schema.Number\n}) {}\n\n/** Bounded nested-call record. `complete: false` means calls were dropped or arguments cut.\n * `counts` (absent on records written before it existed) counts every call by status, dropped\n * calls included, so totals stay correct when `calls` is cut.\n */\nexport class NestedToolCalls extends Schema.Class<NestedToolCalls>('NestedToolCalls')({\n calls: Schema.Array(NestedToolCallRecord),\n complete: Schema.Boolean,\n counts: Schema.optional(NestedToolCallCounts)\n}) {}\n\nexport type NestedToolCallInput = {\n /** Caller-assigned id; the convention is `<parentToolCallId>/<seq>`. */\n readonly id: string\n readonly name: string\n /** Raw call arguments; recorded as compact JSON within the byte bounds. */\n readonly args: unknown\n readonly status: NestedToolCallStatus\n readonly durationMs?: number\n readonly error?: string\n readonly usage?: AgentUsage\n}\n\ntype StatusCounts = {\n readonly ok: number\n readonly error: number\n readonly cancelled: number\n}\n\nconst zeroCounts: StatusCounts = { ok: 0, error: 0, cancelled: 0 }\n\n/** Immutable recorder state. Fold calls with `recordNestedToolCall`; usage and status counts of\n * dropped calls still count. `maxCalls` defaults to `nestedToolCallMaxCalls`.\n */\nexport type NestedToolCallRecorder = {\n readonly calls: ReadonlyArray<NestedToolCallRecord>\n readonly complete: boolean\n readonly argsBytes: number\n readonly usage?: AgentUsage\n readonly maxCalls?: number\n readonly counts?: StatusCounts\n}\n\n/** An empty recorder keeping at most `maxCalls` calls (default `nestedToolCallMaxCalls`, clamped\n * by `nestedToolCallRecordLimit` to at most `nestedToolCallMaxRecordedCalls`); the argument byte\n * budgets are fixed.\n */\nexport const makeNestedToolCallRecorder = (\n options: { readonly maxCalls?: number } = {}\n): NestedToolCallRecorder => ({\n calls: [],\n complete: true,\n argsBytes: 0,\n maxCalls: nestedToolCallRecordLimit(options.maxCalls),\n counts: zeroCounts\n})\n\nexport const emptyNestedToolCallRecorder: NestedToolCallRecorder = makeNestedToolCallRecorder()\n\n/** One call's arguments cut to the nested-call record budgets (see `boundNestedToolCallArgs`). */\nexport type BoundedNestedToolCallArgs = {\n /** The kept compact JSON, cut with a trailing `…` when `truncated`. */\n readonly args: string\n /** UTF-8 bytes of `args`. */\n readonly bytes: number\n readonly truncated: boolean\n}\n\n/** One call's compact JSON arguments within the record budgets: at most\n * `nestedToolCallMaxArgsBytes`, and at most what `usedBytes` leaves of\n * `nestedToolCallMaxTotalArgsBytes`. Shared by every bounded nested-call listing (`nestedCalls`,\n * code mode `interruptedCalls`) so the bounds cannot drift.\n */\nexport const boundNestedToolCallArgs = (\n args: string,\n usedBytes: number\n): BoundedNestedToolCallArgs => {\n const limit = Math.max(\n 0,\n Math.min(nestedToolCallMaxArgsBytes, nestedToolCallMaxTotalArgsBytes - usedBytes)\n )\n\n const kept = truncateUtf8(args, limit)\n\n return { args: kept, bytes: utf8ByteLength(kept), truncated: kept !== args }\n}\n\ntype NestedToolCallRecordFields = {\n id: string\n name: string\n args: string\n status: NestedToolCallStatus\n durationMs?: number\n error?: string\n usage?: AgentUsage\n}\n\n/** Pure fold step enforcing the record bounds. Calls past the recorder's `maxCalls` are dropped\n * (still counted by status), arguments past the per-call or total byte budget are cut; either marks\n * the record incomplete. Errors are always cut to `nestedToolCallMaxErrorChars` without affecting\n * completeness.\n */\nexport const recordNestedToolCall = (\n recorder: NestedToolCallRecorder,\n input: NestedToolCallInput\n): NestedToolCallRecorder => {\n const usage =\n input.usage === undefined\n ? recorder.usage\n : recorder.usage === undefined\n ? input.usage\n : addAgentUsage(recorder.usage, input.usage)\n\n type RecorderFields = {\n calls: ReadonlyArray<NestedToolCallRecord>\n complete: boolean\n argsBytes: number\n usage?: AgentUsage\n maxCalls?: number\n counts?: StatusCounts\n }\n\n const previousCounts = recorder.counts ?? zeroCounts\n\n const counts: StatusCounts = {\n ...previousCounts,\n [input.status]: previousCounts[input.status] + 1\n }\n\n const maxCalls = nestedToolCallRecordLimit(recorder.maxCalls)\n\n const withUsage = (fields: RecorderFields): NestedToolCallRecorder => {\n if (usage !== undefined) {\n fields.usage = usage\n }\n\n fields.maxCalls = maxCalls\n fields.counts = counts\n\n return fields\n }\n\n if (recorder.calls.length >= maxCalls) {\n return withUsage({ calls: recorder.calls, complete: false, argsBytes: recorder.argsBytes })\n }\n\n const { args, bytes, truncated } = boundNestedToolCallArgs(\n compactToolArguments(input.args),\n recorder.argsBytes\n )\n\n const fields: NestedToolCallRecordFields = {\n id: input.id,\n name: input.name,\n args,\n status: input.status\n }\n\n if (input.durationMs !== undefined) {\n fields.durationMs = input.durationMs\n }\n\n if (input.error !== undefined) {\n fields.error = truncateCodePoints(input.error, nestedToolCallMaxErrorChars)\n }\n\n if (input.usage !== undefined) {\n fields.usage = input.usage\n }\n\n return withUsage({\n calls: [...recorder.calls, NestedToolCallRecord.make(fields)],\n complete: recorder.complete && !truncated,\n argsBytes: recorder.argsBytes + bytes\n })\n}\n\nexport type NestedToolCallResultFields = {\n readonly nestedCalls: NestedToolCalls\n readonly usage?: AgentUsage\n}\n\n/** `ToolResult` fields for a recorder: the bounded record with per-status counts plus summed\n * usage when reported.\n */\nexport const nestedToolCallResultFields = (\n recorder: NestedToolCallRecorder\n): NestedToolCallResultFields => {\n const nestedCalls = NestedToolCalls.make({\n calls: recorder.calls,\n complete: recorder.complete,\n counts: NestedToolCallCounts.make(recorder.counts ?? zeroCounts)\n })\n\n return recorder.usage === undefined ? { nestedCalls } : { nestedCalls, usage: recorder.usage }\n}\n"],"mappings":";;;;AASA,MAAM,wBAAwB,OAAO,QAAQ,KAAK,OAAO,MAAM,OAAO,WAAW,CAAC,CAAC;;;;;AAMnF,MAAa,yBAAyB;;AAGtC,MAAa,iCAAiC;;;;AAK9C,MAAa,6BAA6B,aACxC,aAAa,KAAA,KAAa,OAAO,MAAM,QAAQ,IAAA,MAE3C,KAAK,IAAI,GAAG,KAAK,IAAI,gCAAgC,KAAK,MAAM,QAAQ,CAAC,CAAC;;AAGhF,MAAa,6BAA6B,IAAI;;AAG9C,MAAa,kCAAkC,KAAK;;AAGpD,MAAa,8BAA8B;AAE3C,MAAa,uBAAuB,OAAO,SAAS;CAAC;CAAM;CAAS;AAAW,CAAC;;;;;AAQhF,IAAa,uBAAb,cAA0C,OAAO,MAC/C,sBACF,EAAE;CACA,IAAI;CACJ,MAAM;CACN,MAAM,OAAO;CACb,QAAQ;CACR,YAAY,OAAO,SAAS,OAAO,MAAM;CACzC,OAAO,OAAO,SAAS,OAAO,MAAM;CACpC,OAAO,OAAO,SAAS,UAAU;AACnC,CAAC,EAAE,CAAC;;AAGJ,IAAa,uB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;EAAO,WAAW,SAAS;CAAU,CAAC;CAG5F,MAAM,EAAE,MAAM,OAAO,cAAc,wBACjC,qBAAqB,MAAM,IAAI,GAC/B,SAAS,SACX;CAEA,MAAM,SAAqC;EACzC,IAAI,MAAM;EACV,MAAM,MAAM;EACZ;EACA,QAAQ,MAAM;CAChB;CAEA,IAAI,MAAM,eAAe,KAAA,GACvB,OAAO,aAAa,MAAM;CAG5B,IAAI,MAAM,UAAU,KAAA,GAClB,OAAO,QAAQ,mBAAmB,MAAM,OAAA,GAAkC;CAG5E,IAAI,MAAM,UAAU,KAAA,GAClB,OAAO,QAAQ,MAAM;CAGvB,OAAO,UAAU;EACf,OAAO,CAAC,GAAG,SAAS,OAAO,qBAAqB,KAAK,MAAM,CAAC;EAC5D,UAAU,SAAS,YAAY,CAAC;EAChC,WAAW,SAAS,YAAY;CAClC,CAAC;AACH;;;;AAUA,MAAa,8BACX,aAC+B;CAC/B,MAAM,cAAc,gBAAgB,KAAK;EACvC,OAAO,SAAS;EAChB,UAAU,SAAS;EACnB,QAAQ,qBAAqB,KAAK,SAAS,UAAU,UAAU;CACjE,CAAC;CAED,OAAO,SAAS,UAAU,KAAA,IAAY,EAAE,YAAY,IAAI;EAAE;EAAa,OAAO,SAAS;CAAM;AAC/F"}
|
|
1
|
+
{"version":3,"file":"nested-tool-calls.mjs","names":[],"sources":["../../src/protocol/nested-tool-calls.ts"],"sourcesContent":["import * as Schema from 'effect/Schema'\nimport {\n compactToolArguments,\n truncateCodePoints,\n truncateUtf8,\n utf8ByteLength\n} from './bounded-text.ts'\nimport { addAgentUsage, AgentUsage } from './usage.ts'\n\nconst NonEmptyTrimmedString = Schema.Trimmed.pipe(Schema.check(Schema.isNonEmpty()))\n\n/** Default number of nested calls a record keeps; later calls are dropped (counted, not listed)\n * and mark the record incomplete. Callers size the record to their own call limit with\n * `makeNestedToolCallRecorder({ maxCalls })` (code mode uses `limits.maxNestedCalls`).\n */\nexport const nestedToolCallMaxCalls = 256\n\n/** Ceiling of any record's `maxCalls`: a larger (or infinite) limit keeps this many calls. */\nexport const nestedToolCallMaxRecordedCalls = 4096\n\n/** The number of calls a record keeps for a requested `maxCalls`: whole, within\n * `0..nestedToolCallMaxRecordedCalls`; `NaN` and absent mean `nestedToolCallMaxCalls`.\n */\nexport const nestedToolCallRecordLimit = (maxCalls: number | undefined): number =>\n maxCalls === undefined || Number.isNaN(maxCalls)\n ? nestedToolCallMaxCalls\n : Math.max(0, Math.min(nestedToolCallMaxRecordedCalls, Math.floor(maxCalls)))\n\n/** UTF-8 byte budget for one recorded call's compact JSON arguments. */\nexport const nestedToolCallMaxArgsBytes = 8 * 1024\n\n/** UTF-8 byte budget for the compact JSON arguments of all recorded calls together. */\nexport const nestedToolCallMaxTotalArgsBytes = 32 * 1024\n\n/** Recorded nested-call errors are cut to this many characters (code points). */\nexport const nestedToolCallMaxErrorChars = 500\n\nexport const NestedToolCallStatus = Schema.Literals(['ok', 'error', 'cancelled'])\n\nexport type NestedToolCallStatus = typeof NestedToolCallStatus.Type\n\n/** A nested call's effective access, the `ToolAccess` literals (`toolCallAccess`). */\nexport const NestedToolCallAccess = Schema.Literals(['read', 'write', 'destructive'])\n\nexport type NestedToolCallAccess = typeof NestedToolCallAccess.Type\n\n/** One nested tool call made by a tool on behalf of the model (for example a code mode script).\n * Host/UI audit data only: never model-visible and never the nested result itself.\n * `args` is compact JSON, cut to the byte bounds with a trailing `…` (then no longer JSON).\n * `access` is the call's effective access (`read` for a read-only call of a `write` tool); absent\n * on records written before it existed and for tools the caller could not resolve.\n */\nexport class NestedToolCallRecord extends Schema.Class<NestedToolCallRecord>(\n 'NestedToolCallRecord'\n)({\n id: NonEmptyTrimmedString,\n name: NonEmptyTrimmedString,\n args: Schema.String,\n status: NestedToolCallStatus,\n access: Schema.optional(NestedToolCallAccess),\n durationMs: Schema.optional(Schema.Number),\n error: Schema.optional(Schema.String),\n usage: Schema.optional(AgentUsage)\n}) {}\n\n/** Calls per status over every recorded call, including calls dropped from `calls`. */\nexport class NestedToolCallCounts extends Schema.Class<NestedToolCallCounts>(\n 'NestedToolCallCounts'\n)({\n ok: Schema.Number,\n error: Schema.Number,\n cancelled: Schema.Number\n}) {}\n\n/** Bounded nested-call record. `complete: false` means calls were dropped or arguments cut.\n * `counts` (absent on records written before it existed) counts every call by status, dropped\n * calls included, so totals stay correct when `calls` is cut.\n */\nexport class NestedToolCalls extends Schema.Class<NestedToolCalls>('NestedToolCalls')({\n calls: Schema.Array(NestedToolCallRecord),\n complete: Schema.Boolean,\n counts: Schema.optional(NestedToolCallCounts)\n}) {}\n\nexport type NestedToolCallInput = {\n /** Caller-assigned id; the convention is `<parentToolCallId>/<seq>`. */\n readonly id: string\n readonly name: string\n /** Raw call arguments; recorded as compact JSON within the byte bounds. */\n readonly args: unknown\n readonly status: NestedToolCallStatus\n /** The call's effective access (`NestedToolExecutor.access`); omit when unknown. */\n readonly access?: NestedToolCallAccess\n readonly durationMs?: number\n readonly error?: string\n readonly usage?: AgentUsage\n}\n\ntype StatusCounts = {\n readonly ok: number\n readonly error: number\n readonly cancelled: number\n}\n\nconst zeroCounts: StatusCounts = { ok: 0, error: 0, cancelled: 0 }\n\n/** Immutable recorder state. Fold calls with `recordNestedToolCall`; usage and status counts of\n * dropped calls still count. `maxCalls` defaults to `nestedToolCallMaxCalls`.\n */\nexport type NestedToolCallRecorder = {\n readonly calls: ReadonlyArray<NestedToolCallRecord>\n readonly complete: boolean\n readonly argsBytes: number\n readonly usage?: AgentUsage\n readonly maxCalls?: number\n readonly counts?: StatusCounts\n}\n\n/** An empty recorder keeping at most `maxCalls` calls (default `nestedToolCallMaxCalls`, clamped\n * by `nestedToolCallRecordLimit` to at most `nestedToolCallMaxRecordedCalls`); the argument byte\n * budgets are fixed.\n */\nexport const makeNestedToolCallRecorder = (\n options: { readonly maxCalls?: number } = {}\n): NestedToolCallRecorder => ({\n calls: [],\n complete: true,\n argsBytes: 0,\n maxCalls: nestedToolCallRecordLimit(options.maxCalls),\n counts: zeroCounts\n})\n\nexport const emptyNestedToolCallRecorder: NestedToolCallRecorder = makeNestedToolCallRecorder()\n\n/** One call's arguments cut to the nested-call record budgets (see `boundNestedToolCallArgs`). */\nexport type BoundedNestedToolCallArgs = {\n /** The kept compact JSON, cut with a trailing `…` when `truncated`. */\n readonly args: string\n /** UTF-8 bytes of `args`. */\n readonly bytes: number\n readonly truncated: boolean\n}\n\n/** One call's compact JSON arguments within the record budgets: at most\n * `nestedToolCallMaxArgsBytes`, and at most what `usedBytes` leaves of\n * `nestedToolCallMaxTotalArgsBytes`. Shared by every bounded nested-call listing (`nestedCalls`,\n * code mode `interruptedCalls`) so the bounds cannot drift.\n */\nexport const boundNestedToolCallArgs = (\n args: string,\n usedBytes: number\n): BoundedNestedToolCallArgs => {\n const limit = Math.max(\n 0,\n Math.min(nestedToolCallMaxArgsBytes, nestedToolCallMaxTotalArgsBytes - usedBytes)\n )\n\n const kept = truncateUtf8(args, limit)\n\n return { args: kept, bytes: utf8ByteLength(kept), truncated: kept !== args }\n}\n\ntype NestedToolCallRecordFields = {\n id: string\n name: string\n args: string\n status: NestedToolCallStatus\n access?: NestedToolCallAccess\n durationMs?: number\n error?: string\n usage?: AgentUsage\n}\n\n/** Pure fold step enforcing the record bounds. Calls past the recorder's `maxCalls` are dropped\n * (still counted by status), arguments past the per-call or total byte budget are cut; either marks\n * the record incomplete. Errors are always cut to `nestedToolCallMaxErrorChars` without affecting\n * completeness.\n */\nexport const recordNestedToolCall = (\n recorder: NestedToolCallRecorder,\n input: NestedToolCallInput\n): NestedToolCallRecorder => {\n const usage =\n input.usage === undefined\n ? recorder.usage\n : recorder.usage === undefined\n ? input.usage\n : addAgentUsage(recorder.usage, input.usage)\n\n type RecorderFields = {\n calls: ReadonlyArray<NestedToolCallRecord>\n complete: boolean\n argsBytes: number\n usage?: AgentUsage\n maxCalls?: number\n counts?: StatusCounts\n }\n\n const previousCounts = recorder.counts ?? zeroCounts\n\n const counts: StatusCounts = {\n ...previousCounts,\n [input.status]: previousCounts[input.status] + 1\n }\n\n const maxCalls = nestedToolCallRecordLimit(recorder.maxCalls)\n\n const withUsage = (fields: RecorderFields): NestedToolCallRecorder => {\n if (usage !== undefined) {\n fields.usage = usage\n }\n\n fields.maxCalls = maxCalls\n fields.counts = counts\n\n return fields\n }\n\n if (recorder.calls.length >= maxCalls) {\n return withUsage({ calls: recorder.calls, complete: false, argsBytes: recorder.argsBytes })\n }\n\n const { args, bytes, truncated } = boundNestedToolCallArgs(\n compactToolArguments(input.args),\n recorder.argsBytes\n )\n\n const fields: NestedToolCallRecordFields = {\n id: input.id,\n name: input.name,\n args,\n status: input.status\n }\n\n if (input.access !== undefined) {\n fields.access = input.access\n }\n\n if (input.durationMs !== undefined) {\n fields.durationMs = input.durationMs\n }\n\n if (input.error !== undefined) {\n fields.error = truncateCodePoints(input.error, nestedToolCallMaxErrorChars)\n }\n\n if (input.usage !== undefined) {\n fields.usage = input.usage\n }\n\n return withUsage({\n calls: [...recorder.calls, NestedToolCallRecord.make(fields)],\n complete: recorder.complete && !truncated,\n argsBytes: recorder.argsBytes + bytes\n })\n}\n\nexport type NestedToolCallResultFields = {\n readonly nestedCalls: NestedToolCalls\n readonly usage?: AgentUsage\n}\n\n/** `ToolResult` fields for a recorder: the bounded record with per-status counts plus summed\n * usage when reported.\n */\nexport const nestedToolCallResultFields = (\n recorder: NestedToolCallRecorder\n): NestedToolCallResultFields => {\n const nestedCalls = NestedToolCalls.make({\n calls: recorder.calls,\n complete: recorder.complete,\n counts: NestedToolCallCounts.make(recorder.counts ?? zeroCounts)\n })\n\n return recorder.usage === undefined ? { nestedCalls } : { nestedCalls, usage: recorder.usage }\n}\n"],"mappings":";;;;AASA,MAAM,wBAAwB,OAAO,QAAQ,KAAK,OAAO,MAAM,OAAO,WAAW,CAAC,CAAC;;;;;AAMnF,MAAa,yBAAyB;;AAGtC,MAAa,iCAAiC;;;;AAK9C,MAAa,6BAA6B,aACxC,aAAa,KAAA,KAAa,OAAO,MAAM,QAAQ,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