@yolk-sdk/agent 0.1.0-canary.113 → 0.1.0-canary.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -41
- package/dist/client/state.d.mts +82 -82
- package/dist/client/state.d.mts.map +1 -1
- package/dist/compaction/estimator.d.mts.map +1 -1
- package/dist/compaction/estimator.mjs +2 -2
- package/dist/compaction/estimator.mjs.map +1 -1
- package/dist/compaction/retry.d.mts +30 -30
- package/dist/compaction/retry.d.mts.map +1 -1
- package/dist/compaction/window.d.mts +39 -39
- package/dist/compaction/window.d.mts.map +1 -1
- package/dist/loop/run.d.mts.map +1 -1
- package/dist/loop/run.mjs +1 -1
- package/dist/loop/run.mjs.map +1 -1
- package/dist/protocol/content.d.mts +28 -3
- package/dist/protocol/content.d.mts.map +1 -1
- package/dist/protocol/content.mjs +58 -5
- package/dist/protocol/content.mjs.map +1 -1
- package/dist/protocol/file.d.mts +38 -0
- package/dist/protocol/file.d.mts.map +1 -0
- package/dist/protocol/file.mjs +49 -0
- package/dist/protocol/file.mjs.map +1 -0
- package/dist/protocol/index.d.mts +3 -2
- package/dist/protocol/index.d.mts.map +1 -1
- package/dist/protocol/index.mjs +3 -2
- package/dist/protocol/message.d.mts +4 -4
- package/dist/protocol/tool.d.mts +7 -2
- package/dist/protocol/tool.d.mts.map +1 -1
- package/dist/protocol/tool.mjs +6 -1
- package/dist/protocol/tool.mjs.map +1 -1
- package/dist/providers/anthropic-provider-internal.d.mts.map +1 -1
- package/dist/providers/anthropic-provider-internal.mjs +6 -3
- package/dist/providers/anthropic-provider-internal.mjs.map +1 -1
- package/dist/providers/openai/provider.d.mts.map +1 -1
- package/dist/providers/openai/provider.mjs +8 -3
- package/dist/providers/openai/provider.mjs.map +1 -1
- package/dist/providers/openai-responses-provider-internal.d.mts.map +1 -1
- package/dist/providers/openai-responses-provider-internal.mjs +6 -3
- package/dist/providers/openai-responses-provider-internal.mjs.map +1 -1
- package/dist/react/chat-actions.d.mts +15 -15
- package/dist/react/chat-actions.d.mts.map +1 -1
- package/dist/react/chat-items.d.mts +85 -85
- package/dist/react/chat-items.d.mts.map +1 -1
- package/dist/react/chat-messages.d.mts +93 -93
- package/dist/react/chat-messages.d.mts.map +1 -1
- package/dist/react/chat-session-events.d.mts +1 -1
- package/dist/skillset/merge.d.mts +1 -1
- package/dist/tools/files.d.mts +57 -0
- package/dist/tools/files.d.mts.map +1 -0
- package/dist/tools/files.mjs +119 -0
- package/dist/tools/files.mjs.map +1 -0
- package/dist/tools/index.d.mts +2 -1
- package/dist/tools/index.mjs +2 -1
- package/dist/tools/ledger.d.mts.map +1 -1
- package/dist/tools/ledger.mjs +11 -3
- package/dist/tools/ledger.mjs.map +1 -1
- package/dist/tools/registry.d.mts +6 -0
- package/dist/tools/registry.d.mts.map +1 -1
- package/dist/tools/registry.mjs +24 -14
- package/dist/tools/registry.mjs.map +1 -1
- package/package.json +2 -2
- package/src/compaction/estimator.ts +2 -0
- package/src/loop/run.ts +6 -0
- package/src/protocol/content.ts +66 -1
- package/src/protocol/file.ts +70 -0
- package/src/protocol/index.ts +15 -0
- package/src/protocol/tool.ts +6 -1
- package/src/providers/anthropic-provider-internal.ts +5 -0
- package/src/providers/openai/provider.ts +12 -0
- package/src/providers/openai-responses-provider-internal.ts +5 -0
- package/src/tools/files.ts +260 -0
- package/src/tools/index.ts +4 -0
- package/src/tools/ledger.ts +28 -2
- package/src/tools/registry.ts +56 -16
package/README.md
CHANGED
|
@@ -20,47 +20,47 @@ Published package metadata requires Node.js 22+.
|
|
|
20
20
|
|
|
21
21
|
## Subpaths
|
|
22
22
|
|
|
23
|
-
| Subpath | Purpose
|
|
24
|
-
| -------------------------------------------------------- |
|
|
25
|
-
| `@yolk-sdk/agent/protocol` | Wire messages, events, content, usage, tool schemas
|
|
26
|
-
| `@yolk-sdk/agent/loop` | Stateless LLM/tool loop, host instructions
|
|
27
|
-
| `@yolk-sdk/agent/loop/testing` | Faux provider and tool executor test helpers
|
|
28
|
-
| `@yolk-sdk/agent/runtime` | Transcript or append-backed runtime orchestration
|
|
29
|
-
| `@yolk-sdk/agent/client` | HTTP/NDJSON transport, HITL resume, retry/error state helpers
|
|
30
|
-
| `@yolk-sdk/agent/compaction` | Host-owned compaction budgets, checkpoints, formatting, retry
|
|
31
|
-
| `@yolk-sdk/agent/classification` | Classifier model contract: typed questions, answers, usage, errors
|
|
32
|
-
| `@yolk-sdk/agent/tools` | Tool registry, deferred loading (`tool_search`), typed inputs, interactions, subagents/questions, durable tool ledger, staged tool plans, tool change previews |
|
|
33
|
-
| `@yolk-sdk/agent/react` | Headless React chat hook, reducer, selectors, and render model
|
|
34
|
-
| `@yolk-sdk/agent/oauth` | Provider-neutral OAuth token and broker contracts
|
|
35
|
-
| `@yolk-sdk/agent/providers/openai` | OpenAI/Codex OAuth and broker helpers
|
|
36
|
-
| `@yolk-sdk/agent/providers/openai/codex` | OpenAI Codex request and auth helpers
|
|
37
|
-
| `@yolk-sdk/agent/providers/openai/codex-usage` | Codex subscription-allowance snapshots
|
|
38
|
-
| `@yolk-sdk/agent/providers/openai/codex-provider` | Codex LLM provider factory
|
|
39
|
-
| `@yolk-sdk/agent/providers/openai/provider` | OpenAI-compatible LLM provider factory
|
|
40
|
-
| `@yolk-sdk/agent/providers/openai/conformance` | Synthetic OpenAI chat, Codex Responses, and Codex usage fixtures and conformance cases
|
|
41
|
-
| `@yolk-sdk/agent/providers/openai/realtime` | OpenAI Realtime session config and event codecs
|
|
42
|
-
| `@yolk-sdk/agent/providers/openai/speech` | OpenAI text-to-speech and transcription adapters
|
|
43
|
-
| `@yolk-sdk/agent/providers/vercel/ai-gateway-provider` | Vercel AI Gateway Chat Completions provider factory
|
|
44
|
-
| `@yolk-sdk/agent/providers/vercel/ai-gateway-classifier` | Vercel AI Gateway classifier (`POST /v1/evaluate`) layer
|
|
45
|
-
| `@yolk-sdk/agent/providers/vercel/conformance` | Verified Gateway chat fixtures, synthetic classifier fixtures, and conformance cases
|
|
46
|
-
| `@yolk-sdk/agent/providers/opencode/go-provider` | OpenCode Go Chat Completions, Messages, and Responses provider
|
|
47
|
-
| `@yolk-sdk/agent/providers/opencode/usage` | OpenCode Go subscription-allowance snapshots
|
|
48
|
-
| `@yolk-sdk/agent/providers/opencode/conformance` | Synthetic OpenCode Go (per protocol, commentary replay, usage) fixtures and conformance cases
|
|
49
|
-
| `@yolk-sdk/agent/providers/anthropic` | Anthropic/Claude OAuth and broker helpers
|
|
50
|
-
| `@yolk-sdk/agent/providers/anthropic/claude` | Claude request and auth helpers
|
|
51
|
-
| `@yolk-sdk/agent/providers/anthropic/usage` | Claude subscription-allowance snapshots
|
|
52
|
-
| `@yolk-sdk/agent/providers/anthropic/claude-provider` | Claude LLM provider factory, thinking config, and reasoning replay provider id
|
|
53
|
-
| `@yolk-sdk/agent/providers/anthropic/conformance` | Synthetic Anthropic Messages and Claude usage fixtures and conformance cases
|
|
54
|
-
| `@yolk-sdk/agent/providers/xai` | Grok subscription OAuth and token broker helpers
|
|
55
|
-
| `@yolk-sdk/agent/providers/xai/grok` | Grok subscription request and auth helpers
|
|
56
|
-
| `@yolk-sdk/agent/providers/xai/grok-provider` | Grok subscription LLM provider factory
|
|
57
|
-
| `@yolk-sdk/agent/providers/xai/usage` | Grok subscription-allowance snapshots
|
|
58
|
-
| `@yolk-sdk/agent/providers/xai/conformance` | Synthetic Grok Responses and Grok usage fixtures and conformance cases
|
|
59
|
-
| `@yolk-sdk/agent/providers/subscription-usage` | Shared allowance snapshot and safe error schemas
|
|
60
|
-
| `@yolk-sdk/agent/skillset` | Portable skill and slash-command parsing/catalogs
|
|
61
|
-
| `@yolk-sdk/agent/voice` | Voice protocol, controller, tool handler, projection, speech
|
|
62
|
-
| `@yolk-sdk/agent/voice/browser` | Browser WebRTC voice transport
|
|
63
|
-
| `@yolk-sdk/agent/voice/react` | Headless browser voice React hook
|
|
23
|
+
| Subpath | Purpose |
|
|
24
|
+
| -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| `@yolk-sdk/agent/protocol` | Wire messages, events, content (including `FilePart`), usage, tool schemas |
|
|
26
|
+
| `@yolk-sdk/agent/loop` | Stateless LLM/tool loop, host instructions |
|
|
27
|
+
| `@yolk-sdk/agent/loop/testing` | Faux provider and tool executor test helpers |
|
|
28
|
+
| `@yolk-sdk/agent/runtime` | Transcript or append-backed runtime orchestration |
|
|
29
|
+
| `@yolk-sdk/agent/client` | HTTP/NDJSON transport, HITL resume, retry/error state helpers |
|
|
30
|
+
| `@yolk-sdk/agent/compaction` | Host-owned compaction budgets, checkpoints, formatting, retry |
|
|
31
|
+
| `@yolk-sdk/agent/classification` | Classifier model contract: typed questions, answers, usage, errors |
|
|
32
|
+
| `@yolk-sdk/agent/tools` | Tool registry, deferred loading (`tool_search`), typed inputs, interactions, subagents/questions, durable tool ledger, staged tool plans, tool change previews, file capture |
|
|
33
|
+
| `@yolk-sdk/agent/react` | Headless React chat hook, reducer, selectors, and render model |
|
|
34
|
+
| `@yolk-sdk/agent/oauth` | Provider-neutral OAuth token and broker contracts |
|
|
35
|
+
| `@yolk-sdk/agent/providers/openai` | OpenAI/Codex OAuth and broker helpers |
|
|
36
|
+
| `@yolk-sdk/agent/providers/openai/codex` | OpenAI Codex request and auth helpers |
|
|
37
|
+
| `@yolk-sdk/agent/providers/openai/codex-usage` | Codex subscription-allowance snapshots |
|
|
38
|
+
| `@yolk-sdk/agent/providers/openai/codex-provider` | Codex LLM provider factory |
|
|
39
|
+
| `@yolk-sdk/agent/providers/openai/provider` | OpenAI-compatible LLM provider factory |
|
|
40
|
+
| `@yolk-sdk/agent/providers/openai/conformance` | Synthetic OpenAI chat, Codex Responses, and Codex usage fixtures and conformance cases |
|
|
41
|
+
| `@yolk-sdk/agent/providers/openai/realtime` | OpenAI Realtime session config and event codecs |
|
|
42
|
+
| `@yolk-sdk/agent/providers/openai/speech` | OpenAI text-to-speech and transcription adapters |
|
|
43
|
+
| `@yolk-sdk/agent/providers/vercel/ai-gateway-provider` | Vercel AI Gateway Chat Completions provider factory |
|
|
44
|
+
| `@yolk-sdk/agent/providers/vercel/ai-gateway-classifier` | Vercel AI Gateway classifier (`POST /v1/evaluate`) layer |
|
|
45
|
+
| `@yolk-sdk/agent/providers/vercel/conformance` | Verified Gateway chat fixtures, synthetic classifier fixtures, and conformance cases |
|
|
46
|
+
| `@yolk-sdk/agent/providers/opencode/go-provider` | OpenCode Go Chat Completions, Messages, and Responses provider |
|
|
47
|
+
| `@yolk-sdk/agent/providers/opencode/usage` | OpenCode Go subscription-allowance snapshots |
|
|
48
|
+
| `@yolk-sdk/agent/providers/opencode/conformance` | Synthetic OpenCode Go (per protocol, commentary replay, usage) fixtures and conformance cases |
|
|
49
|
+
| `@yolk-sdk/agent/providers/anthropic` | Anthropic/Claude OAuth and broker helpers |
|
|
50
|
+
| `@yolk-sdk/agent/providers/anthropic/claude` | Claude request and auth helpers |
|
|
51
|
+
| `@yolk-sdk/agent/providers/anthropic/usage` | Claude subscription-allowance snapshots |
|
|
52
|
+
| `@yolk-sdk/agent/providers/anthropic/claude-provider` | Claude LLM provider factory, thinking config, and reasoning replay provider id |
|
|
53
|
+
| `@yolk-sdk/agent/providers/anthropic/conformance` | Synthetic Anthropic Messages and Claude usage fixtures and conformance cases |
|
|
54
|
+
| `@yolk-sdk/agent/providers/xai` | Grok subscription OAuth and token broker helpers |
|
|
55
|
+
| `@yolk-sdk/agent/providers/xai/grok` | Grok subscription request and auth helpers |
|
|
56
|
+
| `@yolk-sdk/agent/providers/xai/grok-provider` | Grok subscription LLM provider factory |
|
|
57
|
+
| `@yolk-sdk/agent/providers/xai/usage` | Grok subscription-allowance snapshots |
|
|
58
|
+
| `@yolk-sdk/agent/providers/xai/conformance` | Synthetic Grok Responses and Grok usage fixtures and conformance cases |
|
|
59
|
+
| `@yolk-sdk/agent/providers/subscription-usage` | Shared allowance snapshot and safe error schemas |
|
|
60
|
+
| `@yolk-sdk/agent/skillset` | Portable skill and slash-command parsing/catalogs |
|
|
61
|
+
| `@yolk-sdk/agent/voice` | Voice protocol, controller, tool handler, projection, speech |
|
|
62
|
+
| `@yolk-sdk/agent/voice/browser` | Browser WebRTC voice transport |
|
|
63
|
+
| `@yolk-sdk/agent/voice/react` | Headless browser voice React hook |
|
|
64
64
|
|
|
65
65
|
## Imports
|
|
66
66
|
|
|
@@ -564,6 +564,21 @@ inside one source fail validation. Hosts own file discovery, storage, enablement
|
|
|
564
564
|
- `ImagePart` with `InlineBase64`, `Url`, or host-owned `Ref` source
|
|
565
565
|
- `DocumentPart` with `InlineBase64`, `Url`, or host-owned `Ref` source
|
|
566
566
|
- `AudioPart` with `InlineBase64`, `Url`, or host-owned `Ref` source
|
|
567
|
+
- `FilePart`: bytes a tool yields for other tools to move, not for the model to view. Providers
|
|
568
|
+
render it as its label only (`filePartText`)
|
|
569
|
+
|
|
570
|
+
### File capture
|
|
571
|
+
|
|
572
|
+
`resolveTools(modules, context, { files: { store, maxFileBytes? } })` stores the inline bytes of
|
|
573
|
+
every executed result (direct, code mode nested, staged and interaction calls) through the host
|
|
574
|
+
`FileStoreApi` before the ledger or transcript sees them
|
|
575
|
+
([ADR 0009](https://github.com/magoz/yolk-sdk/blob/main/docs/adr/0009-file-claim-check.md)). A
|
|
576
|
+
`FilePart` becomes a `fileId` label (`[file file_…: name, mime, size]`), inline images, documents
|
|
577
|
+
and audio keep their source and gain a label, and `ToolResult.files` lists the descriptors
|
|
578
|
+
(`FileDescriptor`, not sent to providers). Without `files`, over `maxFileBytes` (default 100 MiB)
|
|
579
|
+
or when storing fails, inline `FilePart` bytes become a "file not captured" label. Tools build
|
|
580
|
+
file parts with `filePartFromBytes`. `@yolk-sdk/files` provides an object-storage store and tools
|
|
581
|
+
that move a `fileId` to upload URLs, links and the sandbox.
|
|
567
582
|
|
|
568
583
|
Build sources with `inlineBase64AttachmentSource`, `urlAttachmentSource`, or
|
|
569
584
|
`refAttachmentSource`. OpenAI-compatible Chat Completions providers support inline text documents;
|
package/dist/client/state.d.mts
CHANGED
|
@@ -80,6 +80,26 @@ type AgentToolRun = {
|
|
|
80
80
|
readonly result: ToolResult;
|
|
81
81
|
};
|
|
82
82
|
declare const AgentToolRun: {
|
|
83
|
+
readonly InputStreaming: Data.TaggedEnum.ConstructorFrom<{
|
|
84
|
+
readonly _tag: "InputStreaming";
|
|
85
|
+
readonly id: string;
|
|
86
|
+
readonly name?: string;
|
|
87
|
+
readonly input: string;
|
|
88
|
+
}, "_tag">;
|
|
89
|
+
readonly InputReady: Data.TaggedEnum.ConstructorFrom<{
|
|
90
|
+
readonly _tag: "InputReady";
|
|
91
|
+
readonly call: ToolCall;
|
|
92
|
+
}, "_tag">;
|
|
93
|
+
readonly ApprovalRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
94
|
+
readonly _tag: "ApprovalRequested";
|
|
95
|
+
readonly call: ToolCall;
|
|
96
|
+
readonly request?: ToolApprovalRequest;
|
|
97
|
+
}, "_tag">;
|
|
98
|
+
readonly Denied: Data.TaggedEnum.ConstructorFrom<{
|
|
99
|
+
readonly _tag: "Denied";
|
|
100
|
+
readonly toolCallId: string;
|
|
101
|
+
readonly reason: string;
|
|
102
|
+
}, "_tag">;
|
|
83
103
|
readonly QuestionRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
84
104
|
readonly _tag: "QuestionRequested";
|
|
85
105
|
readonly request: QuestionRequest;
|
|
@@ -122,31 +142,21 @@ declare const AgentToolRun: {
|
|
|
122
142
|
readonly response: InteractionResponse;
|
|
123
143
|
readonly request?: InteractionRequest;
|
|
124
144
|
}, "_tag">;
|
|
125
|
-
readonly
|
|
126
|
-
readonly _tag: "
|
|
127
|
-
readonly id: string;
|
|
128
|
-
readonly name?: string;
|
|
129
|
-
readonly input: string;
|
|
130
|
-
}, "_tag">;
|
|
131
|
-
readonly ApprovalRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
132
|
-
readonly _tag: "ApprovalRequested";
|
|
145
|
+
readonly Executing: Data.TaggedEnum.ConstructorFrom<{
|
|
146
|
+
readonly _tag: "Executing";
|
|
133
147
|
readonly call: ToolCall;
|
|
134
|
-
readonly
|
|
135
|
-
|
|
136
|
-
readonly Denied: Data.TaggedEnum.ConstructorFrom<{
|
|
137
|
-
readonly _tag: "Denied";
|
|
138
|
-
readonly toolCallId: string;
|
|
139
|
-
readonly reason: string;
|
|
148
|
+
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
149
|
+
readonly interaction?: true;
|
|
140
150
|
}, "_tag">;
|
|
141
|
-
readonly
|
|
142
|
-
readonly _tag: "
|
|
151
|
+
readonly Completed: Data.TaggedEnum.ConstructorFrom<{
|
|
152
|
+
readonly _tag: "Completed";
|
|
143
153
|
readonly call: ToolCall;
|
|
144
154
|
readonly result: ToolResult;
|
|
145
155
|
readonly startedAtMs: number;
|
|
146
156
|
readonly endedAtMs: number;
|
|
147
157
|
}, "_tag">;
|
|
148
|
-
readonly
|
|
149
|
-
readonly _tag: "
|
|
158
|
+
readonly Accepted: Data.TaggedEnum.ConstructorFrom<{
|
|
159
|
+
readonly _tag: "Accepted";
|
|
150
160
|
readonly call: ToolCall;
|
|
151
161
|
readonly result: ToolResult;
|
|
152
162
|
readonly startedAtMs: number;
|
|
@@ -163,17 +173,7 @@ declare const AgentToolRun: {
|
|
|
163
173
|
readonly call: ToolCall;
|
|
164
174
|
readonly result: ToolResult;
|
|
165
175
|
}, "_tag">;
|
|
166
|
-
readonly InputReady:
|
|
167
|
-
readonly _tag: "InputReady";
|
|
168
|
-
readonly call: ToolCall;
|
|
169
|
-
}, "_tag">;
|
|
170
|
-
readonly Executing: Data.TaggedEnum.ConstructorFrom<{
|
|
171
|
-
readonly _tag: "Executing";
|
|
172
|
-
readonly call: ToolCall;
|
|
173
|
-
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
174
|
-
readonly interaction?: true;
|
|
175
|
-
}, "_tag">;
|
|
176
|
-
readonly $is: <Tag extends "QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "InputRequested" | "InputSubmitted" | "InputCancelled" | "InteractionRequested" | "InteractionSubmitted" | "InteractionCancelled" | "InputStreaming" | "ApprovalRequested" | "Denied" | "Accepted" | "Completed" | "Errored" | "ProviderCompleted" | "InputReady" | "Executing">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
176
|
+
readonly $is: <Tag extends "InputStreaming" | "InputReady" | "ApprovalRequested" | "Denied" | "QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "InputRequested" | "InputSubmitted" | "InputCancelled" | "InteractionRequested" | "InteractionSubmitted" | "InteractionCancelled" | "Executing" | "Completed" | "Accepted" | "Errored" | "ProviderCompleted">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
177
177
|
readonly _tag: "InputStreaming";
|
|
178
178
|
readonly id: string;
|
|
179
179
|
readonly name?: string;
|
|
@@ -287,6 +287,26 @@ declare const AgentToolRun: {
|
|
|
287
287
|
}>;
|
|
288
288
|
readonly $match: {
|
|
289
289
|
<Cases extends {
|
|
290
|
+
readonly InputStreaming: (args: {
|
|
291
|
+
readonly _tag: "InputStreaming";
|
|
292
|
+
readonly id: string;
|
|
293
|
+
readonly name?: string;
|
|
294
|
+
readonly input: string;
|
|
295
|
+
}) => any;
|
|
296
|
+
readonly InputReady: (args: {
|
|
297
|
+
readonly _tag: "InputReady";
|
|
298
|
+
readonly call: ToolCall;
|
|
299
|
+
}) => any;
|
|
300
|
+
readonly ApprovalRequested: (args: {
|
|
301
|
+
readonly _tag: "ApprovalRequested";
|
|
302
|
+
readonly call: ToolCall;
|
|
303
|
+
readonly request?: ToolApprovalRequest;
|
|
304
|
+
}) => any;
|
|
305
|
+
readonly Denied: (args: {
|
|
306
|
+
readonly _tag: "Denied";
|
|
307
|
+
readonly toolCallId: string;
|
|
308
|
+
readonly reason: string;
|
|
309
|
+
}) => any;
|
|
290
310
|
readonly QuestionRequested: (args: {
|
|
291
311
|
readonly _tag: "QuestionRequested";
|
|
292
312
|
readonly request: QuestionRequest;
|
|
@@ -329,31 +349,21 @@ declare const AgentToolRun: {
|
|
|
329
349
|
readonly response: InteractionResponse;
|
|
330
350
|
readonly request?: InteractionRequest;
|
|
331
351
|
}) => any;
|
|
332
|
-
readonly
|
|
333
|
-
readonly _tag: "
|
|
334
|
-
readonly id: string;
|
|
335
|
-
readonly name?: string;
|
|
336
|
-
readonly input: string;
|
|
337
|
-
}) => any;
|
|
338
|
-
readonly ApprovalRequested: (args: {
|
|
339
|
-
readonly _tag: "ApprovalRequested";
|
|
352
|
+
readonly Executing: (args: {
|
|
353
|
+
readonly _tag: "Executing";
|
|
340
354
|
readonly call: ToolCall;
|
|
341
|
-
readonly
|
|
342
|
-
|
|
343
|
-
readonly Denied: (args: {
|
|
344
|
-
readonly _tag: "Denied";
|
|
345
|
-
readonly toolCallId: string;
|
|
346
|
-
readonly reason: string;
|
|
355
|
+
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
356
|
+
readonly interaction?: true;
|
|
347
357
|
}) => any;
|
|
348
|
-
readonly
|
|
349
|
-
readonly _tag: "
|
|
358
|
+
readonly Completed: (args: {
|
|
359
|
+
readonly _tag: "Completed";
|
|
350
360
|
readonly call: ToolCall;
|
|
351
361
|
readonly result: ToolResult;
|
|
352
362
|
readonly startedAtMs: number;
|
|
353
363
|
readonly endedAtMs: number;
|
|
354
364
|
}) => any;
|
|
355
|
-
readonly
|
|
356
|
-
readonly _tag: "
|
|
365
|
+
readonly Accepted: (args: {
|
|
366
|
+
readonly _tag: "Accepted";
|
|
357
367
|
readonly call: ToolCall;
|
|
358
368
|
readonly result: ToolResult;
|
|
359
369
|
readonly startedAtMs: number;
|
|
@@ -370,18 +380,28 @@ declare const AgentToolRun: {
|
|
|
370
380
|
readonly call: ToolCall;
|
|
371
381
|
readonly result: ToolResult;
|
|
372
382
|
}) => any;
|
|
383
|
+
}>(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"]>>;
|
|
384
|
+
<Cases extends {
|
|
385
|
+
readonly InputStreaming: (args: {
|
|
386
|
+
readonly _tag: "InputStreaming";
|
|
387
|
+
readonly id: string;
|
|
388
|
+
readonly name?: string;
|
|
389
|
+
readonly input: string;
|
|
390
|
+
}) => any;
|
|
373
391
|
readonly InputReady: (args: {
|
|
374
392
|
readonly _tag: "InputReady";
|
|
375
393
|
readonly call: ToolCall;
|
|
376
394
|
}) => any;
|
|
377
|
-
readonly
|
|
378
|
-
readonly _tag: "
|
|
395
|
+
readonly ApprovalRequested: (args: {
|
|
396
|
+
readonly _tag: "ApprovalRequested";
|
|
379
397
|
readonly call: ToolCall;
|
|
380
|
-
readonly
|
|
381
|
-
|
|
398
|
+
readonly request?: ToolApprovalRequest;
|
|
399
|
+
}) => any;
|
|
400
|
+
readonly Denied: (args: {
|
|
401
|
+
readonly _tag: "Denied";
|
|
402
|
+
readonly toolCallId: string;
|
|
403
|
+
readonly reason: string;
|
|
382
404
|
}) => any;
|
|
383
|
-
}>(cases: Cases): (value: AgentToolRun) => import("effect/Unify").Unify<ReturnType<Cases["QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "InputRequested" | "InputSubmitted" | "InputCancelled" | "InteractionRequested" | "InteractionSubmitted" | "InteractionCancelled" | "InputStreaming" | "ApprovalRequested" | "Denied" | "Accepted" | "Completed" | "Errored" | "ProviderCompleted" | "InputReady" | "Executing"]>>;
|
|
384
|
-
<Cases extends {
|
|
385
405
|
readonly QuestionRequested: (args: {
|
|
386
406
|
readonly _tag: "QuestionRequested";
|
|
387
407
|
readonly request: QuestionRequest;
|
|
@@ -424,31 +444,21 @@ declare const AgentToolRun: {
|
|
|
424
444
|
readonly response: InteractionResponse;
|
|
425
445
|
readonly request?: InteractionRequest;
|
|
426
446
|
}) => any;
|
|
427
|
-
readonly
|
|
428
|
-
readonly _tag: "
|
|
429
|
-
readonly id: string;
|
|
430
|
-
readonly name?: string;
|
|
431
|
-
readonly input: string;
|
|
432
|
-
}) => any;
|
|
433
|
-
readonly ApprovalRequested: (args: {
|
|
434
|
-
readonly _tag: "ApprovalRequested";
|
|
447
|
+
readonly Executing: (args: {
|
|
448
|
+
readonly _tag: "Executing";
|
|
435
449
|
readonly call: ToolCall;
|
|
436
|
-
readonly
|
|
437
|
-
|
|
438
|
-
readonly Denied: (args: {
|
|
439
|
-
readonly _tag: "Denied";
|
|
440
|
-
readonly toolCallId: string;
|
|
441
|
-
readonly reason: string;
|
|
450
|
+
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
451
|
+
readonly interaction?: true;
|
|
442
452
|
}) => any;
|
|
443
|
-
readonly
|
|
444
|
-
readonly _tag: "
|
|
453
|
+
readonly Completed: (args: {
|
|
454
|
+
readonly _tag: "Completed";
|
|
445
455
|
readonly call: ToolCall;
|
|
446
456
|
readonly result: ToolResult;
|
|
447
457
|
readonly startedAtMs: number;
|
|
448
458
|
readonly endedAtMs: number;
|
|
449
459
|
}) => any;
|
|
450
|
-
readonly
|
|
451
|
-
readonly _tag: "
|
|
460
|
+
readonly Accepted: (args: {
|
|
461
|
+
readonly _tag: "Accepted";
|
|
452
462
|
readonly call: ToolCall;
|
|
453
463
|
readonly result: ToolResult;
|
|
454
464
|
readonly startedAtMs: number;
|
|
@@ -465,17 +475,7 @@ declare const AgentToolRun: {
|
|
|
465
475
|
readonly call: ToolCall;
|
|
466
476
|
readonly result: ToolResult;
|
|
467
477
|
}) => any;
|
|
468
|
-
|
|
469
|
-
readonly _tag: "InputReady";
|
|
470
|
-
readonly call: ToolCall;
|
|
471
|
-
}) => any;
|
|
472
|
-
readonly Executing: (args: {
|
|
473
|
-
readonly _tag: "Executing";
|
|
474
|
-
readonly call: ToolCall;
|
|
475
|
-
readonly startedAtMs: number; /** Preserve witnessed interaction acceptance across transport interruptions. */
|
|
476
|
-
readonly interaction?: true;
|
|
477
|
-
}) => any;
|
|
478
|
-
}>(value: AgentToolRun, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "InputRequested" | "InputSubmitted" | "InputCancelled" | "InteractionRequested" | "InteractionSubmitted" | "InteractionCancelled" | "InputStreaming" | "ApprovalRequested" | "Denied" | "Accepted" | "Completed" | "Errored" | "ProviderCompleted" | "InputReady" | "Executing"]>>;
|
|
478
|
+
}>(value: AgentToolRun, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["InputStreaming" | "InputReady" | "ApprovalRequested" | "Denied" | "QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "InputRequested" | "InputSubmitted" | "InputCancelled" | "InteractionRequested" | "InteractionSubmitted" | "InteractionCancelled" | "Executing" | "Completed" | "Accepted" | "Errored" | "ProviderCompleted"]>>;
|
|
479
479
|
};
|
|
480
480
|
};
|
|
481
481
|
type AgentClientState = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.mts","names":[],"sources":["../../src/client/state.ts"],"mappings":";;;;KAoBY,cAAA;AAAA,KAEA,YAAA;EAAA,SAEG,IAAA;EAAA,SACA,EAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;AAAA;EAAA,SAEA,IAAA;EAAA,SAA6B,IAAA,EAAM,QAAA;AAAA;EAAA,SAEnC,IAAA;EAAA,SACA,IAAA,EAAM,QAAA;EAAA,SACN,OAAA,GAAU,mBAAA;AAAA;EAAA,SAEV,IAAA;EAAA,SAAyB,UAAA;EAAA,SAA6B,MAAA;AAAA;EAAA,SACtD,IAAA;EAAA,SAAoC,OAAA,EAAS,eAAA;AAAA;EAAA,SAE7C,IAAA;EAAA,SACA,QAAA,EAAU,gBAAA;EAAA,SACV,OAAA,GA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AAA,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,cA4SU,sBAAA,GACX,KAAA,EAAO,gBAAA,EACP,OAAA,EAAS,WAAA,KACR,gBAAA;AAAA,cAcU,cAAA,GACX,KAAA,EAAO,gBAAA,EACP,OAAA,WACA,SAAA,GAAW,UAAA,YACV,gBAAA;AAAA,cASU,gBAAA,GAAoB,KAAA,EAAO,gBAAA,KAAmB,gBAOzD;AAAA,cAEW,iBAAA,GACX,MAAA,EAAQ,aAAA,CAAc,UAAA,GACtB,YAAA,GAAc,gBAAA,EACd,OAAA,GAAS,sBAAA,KAA2B,gBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimator.d.mts","names":[],"sources":["../../src/compaction/estimator.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"estimator.d.mts","names":[],"sources":["../../src/compaction/estimator.ts"],"mappings":";;;KAUY,oBAAA;EAAA,SACD,kBAAA;EAAA,SACA,eAAA,IAAmB,IAAA;EAAA,SACnB,eAAA;EAAA,SACA,qBAAA;AAAA;AAAA,KAGC,qBAAA,IAAyB,OAAqB,EAAZ,YAAY;AAAA,KAE9C,wBAAA,IAA4B,QAAA,EAAU,aAAa,CAAC,YAAA;AAAA,cAEnD,yBAAA;AAAA,cAEA,sBAAA;AAAA,cAEA,4BAAA;AAAA,cAWA,kBAAA,GAAsB,IAAA,UAAc,OAAA,GAAS,oBAAyB;AAAA,cAMtE,qBAAA,GAAyB,OAAA,EAAS,OAAA,EAAS,OAAA,GAAS,oBAAyB;AAAA,cAkB7E,0BAAA,GACX,OAAA,EAAS,YAAA,EACT,OAAA,GAAS,oBAAyB;AAAA,cA2BvB,2BAAA,GACX,QAAA,EAAU,aAAA,CAAc,YAAA,GACxB,OAAA,GAAS,oBAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Match, Predicate } from "effect";
|
|
2
|
-
import { assistantContent, assistantHostToolCalls, assistantReasoningText } from "@yolk-sdk/agent/protocol";
|
|
2
|
+
import { assistantContent, assistantHostToolCalls, assistantReasoningText, filePartText } from "@yolk-sdk/agent/protocol";
|
|
3
3
|
//#region src/compaction/estimator.ts
|
|
4
4
|
const defaultCharactersPerToken = 4;
|
|
5
5
|
const defaultMediaPartTokens = 512;
|
|
@@ -10,7 +10,7 @@ const messageOverheadTokens = (options) => Math.max(0, options.messageOverheadTo
|
|
|
10
10
|
const estimateTextTokens = (text, options = {}) => Math.max(0, Math.ceil(options.countTextTokens?.(text) ?? text.length / charactersPerToken(options)));
|
|
11
11
|
const estimateContentTokens = (content, options = {}) => {
|
|
12
12
|
if (Predicate.isString(content)) return estimateTextTokens(content, options);
|
|
13
|
-
return content.reduce((total, part) => total + Match.value(part).pipe(Match.tag("Text", (current) => estimateTextTokens(current.text, options)), Match.tag("Image", "Document", "Audio", () => mediaPartTokens(options)), Match.exhaustive), 0);
|
|
13
|
+
return content.reduce((total, part) => total + Match.value(part).pipe(Match.tag("Text", (current) => estimateTextTokens(current.text, options)), Match.tag("Image", "Document", "Audio", () => mediaPartTokens(options)), Match.tag("File", (current) => estimateTextTokens(filePartText(current), options)), Match.exhaustive), 0);
|
|
14
14
|
};
|
|
15
15
|
const estimateAgentMessageTokens = (message, options = {}) => {
|
|
16
16
|
return Match.value(message).pipe(Match.tag("User", "ToolResult", (current) => estimateContentTokens(current.content, options) + messageOverheadTokens(options)), Match.tag("Assistant", (current) => estimateContentTokens(assistantContent(current), options) + estimateTextTokens(assistantReasoningText(current), options) + assistantHostToolCalls(current).reduce((total, call) => total + estimateTextTokens(call.id, options) + estimateTextTokens(call.name, options) + messageOverheadTokens(options), 0) + messageOverheadTokens(options)), Match.exhaustive);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimator.mjs","names":[],"sources":["../../src/compaction/estimator.ts"],"sourcesContent":["import {\n assistantContent,\n assistantHostToolCalls,\n assistantReasoningText,\n type AgentMessage,\n type Content\n} from '@yolk-sdk/agent/protocol'\nimport { Match, Predicate } from 'effect'\n\nexport type TokenEstimateOptions = {\n readonly charactersPerToken?: number\n readonly countTextTokens?: (text: string) => number\n readonly mediaPartTokens?: number\n readonly messageOverheadTokens?: number\n}\n\nexport type MessageTokenEstimator = (message: AgentMessage) => number\n\nexport type TranscriptTokenEstimator = (messages: ReadonlyArray<AgentMessage>) => number\n\nexport const defaultCharactersPerToken = 4\n\nexport const defaultMediaPartTokens = 512\n\nexport const defaultMessageOverheadTokens = 6\n\nconst charactersPerToken = (options: TokenEstimateOptions) =>\n Math.max(1, options.charactersPerToken ?? defaultCharactersPerToken)\n\nconst mediaPartTokens = (options: TokenEstimateOptions) =>\n Math.max(0, options.mediaPartTokens ?? defaultMediaPartTokens)\n\nconst messageOverheadTokens = (options: TokenEstimateOptions) =>\n Math.max(0, options.messageOverheadTokens ?? defaultMessageOverheadTokens)\n\nexport const estimateTextTokens = (text: string, options: TokenEstimateOptions = {}) =>\n Math.max(\n 0,\n Math.ceil(options.countTextTokens?.(text) ?? text.length / charactersPerToken(options))\n )\n\nexport const estimateContentTokens = (content: Content, options: TokenEstimateOptions = {}) => {\n if (Predicate.isString(content)) {\n return estimateTextTokens(content, options)\n }\n\n return content.reduce(\n (total, part) =>\n total +\n Match.value(part).pipe(\n Match.tag('Text', current => estimateTextTokens(current.text, options)),\n Match.tag('Image', 'Document', 'Audio', () => mediaPartTokens(options)),\n Match.exhaustive\n ),\n 0\n )\n}\n\nexport const estimateAgentMessageTokens = (\n message: AgentMessage,\n options: TokenEstimateOptions = {}\n) => {\n return Match.value(message).pipe(\n Match.tag(\n 'User',\n 'ToolResult',\n current => estimateContentTokens(current.content, options) + messageOverheadTokens(options)\n ),\n Match.tag(\n 'Assistant',\n current =>\n estimateContentTokens(assistantContent(current), options) +\n estimateTextTokens(assistantReasoningText(current), options) +\n assistantHostToolCalls(current).reduce(\n (total, call) =>\n total +\n estimateTextTokens(call.id, options) +\n estimateTextTokens(call.name, options) +\n messageOverheadTokens(options),\n 0\n ) +\n messageOverheadTokens(options)\n ),\n Match.exhaustive\n )\n}\n\nexport const estimateAgentMessagesTokens = (\n messages: ReadonlyArray<AgentMessage>,\n options: TokenEstimateOptions = {}\n) => messages.reduce((total, message) => total + estimateAgentMessageTokens(message, options), 0)\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"estimator.mjs","names":[],"sources":["../../src/compaction/estimator.ts"],"sourcesContent":["import {\n assistantContent,\n assistantHostToolCalls,\n assistantReasoningText,\n filePartText,\n type AgentMessage,\n type Content\n} from '@yolk-sdk/agent/protocol'\nimport { Match, Predicate } from 'effect'\n\nexport type TokenEstimateOptions = {\n readonly charactersPerToken?: number\n readonly countTextTokens?: (text: string) => number\n readonly mediaPartTokens?: number\n readonly messageOverheadTokens?: number\n}\n\nexport type MessageTokenEstimator = (message: AgentMessage) => number\n\nexport type TranscriptTokenEstimator = (messages: ReadonlyArray<AgentMessage>) => number\n\nexport const defaultCharactersPerToken = 4\n\nexport const defaultMediaPartTokens = 512\n\nexport const defaultMessageOverheadTokens = 6\n\nconst charactersPerToken = (options: TokenEstimateOptions) =>\n Math.max(1, options.charactersPerToken ?? defaultCharactersPerToken)\n\nconst mediaPartTokens = (options: TokenEstimateOptions) =>\n Math.max(0, options.mediaPartTokens ?? defaultMediaPartTokens)\n\nconst messageOverheadTokens = (options: TokenEstimateOptions) =>\n Math.max(0, options.messageOverheadTokens ?? defaultMessageOverheadTokens)\n\nexport const estimateTextTokens = (text: string, options: TokenEstimateOptions = {}) =>\n Math.max(\n 0,\n Math.ceil(options.countTextTokens?.(text) ?? text.length / charactersPerToken(options))\n )\n\nexport const estimateContentTokens = (content: Content, options: TokenEstimateOptions = {}) => {\n if (Predicate.isString(content)) {\n return estimateTextTokens(content, options)\n }\n\n return content.reduce(\n (total, part) =>\n total +\n Match.value(part).pipe(\n Match.tag('Text', current => estimateTextTokens(current.text, options)),\n Match.tag('Image', 'Document', 'Audio', () => mediaPartTokens(options)),\n Match.tag('File', current => estimateTextTokens(filePartText(current), options)),\n Match.exhaustive\n ),\n 0\n )\n}\n\nexport const estimateAgentMessageTokens = (\n message: AgentMessage,\n options: TokenEstimateOptions = {}\n) => {\n return Match.value(message).pipe(\n Match.tag(\n 'User',\n 'ToolResult',\n current => estimateContentTokens(current.content, options) + messageOverheadTokens(options)\n ),\n Match.tag(\n 'Assistant',\n current =>\n estimateContentTokens(assistantContent(current), options) +\n estimateTextTokens(assistantReasoningText(current), options) +\n assistantHostToolCalls(current).reduce(\n (total, call) =>\n total +\n estimateTextTokens(call.id, options) +\n estimateTextTokens(call.name, options) +\n messageOverheadTokens(options),\n 0\n ) +\n messageOverheadTokens(options)\n ),\n Match.exhaustive\n )\n}\n\nexport const estimateAgentMessagesTokens = (\n messages: ReadonlyArray<AgentMessage>,\n options: TokenEstimateOptions = {}\n) => messages.reduce((total, message) => total + estimateAgentMessageTokens(message, options), 0)\n"],"mappings":";;;AAqBA,MAAa,4BAA4B;AAEzC,MAAa,yBAAyB;AAEtC,MAAa,+BAA+B;AAE5C,MAAM,sBAAsB,YAC1B,KAAK,IAAI,GAAG,QAAQ,sBAAA,CAA+C;AAErE,MAAM,mBAAmB,YACvB,KAAK,IAAI,GAAG,QAAQ,mBAAA,GAAyC;AAE/D,MAAM,yBAAyB,YAC7B,KAAK,IAAI,GAAG,QAAQ,yBAAA,CAAqD;AAE3E,MAAa,sBAAsB,MAAc,UAAgC,CAAC,MAChF,KAAK,IACH,GACA,KAAK,KAAK,QAAQ,kBAAkB,IAAI,KAAK,KAAK,SAAS,mBAAmB,OAAO,CAAC,CACxF;AAEF,MAAa,yBAAyB,SAAkB,UAAgC,CAAC,MAAM;CAC7F,IAAI,UAAU,SAAS,OAAO,GAC5B,OAAO,mBAAmB,SAAS,OAAO;CAG5C,OAAO,QAAQ,QACZ,OAAO,SACN,QACA,MAAM,MAAM,IAAI,EAAE,KAChB,MAAM,IAAI,SAAQ,YAAW,mBAAmB,QAAQ,MAAM,OAAO,CAAC,GACtE,MAAM,IAAI,SAAS,YAAY,eAAe,gBAAgB,OAAO,CAAC,GACtE,MAAM,IAAI,SAAQ,YAAW,mBAAmB,aAAa,OAAO,GAAG,OAAO,CAAC,GAC/E,MAAM,UACR,GACF,CACF;AACF;AAEA,MAAa,8BACX,SACA,UAAgC,CAAC,MAC9B;CACH,OAAO,MAAM,MAAM,OAAO,EAAE,KAC1B,MAAM,IACJ,QACA,eACA,YAAW,sBAAsB,QAAQ,SAAS,OAAO,IAAI,sBAAsB,OAAO,CAC5F,GACA,MAAM,IACJ,cACA,YACE,sBAAsB,iBAAiB,OAAO,GAAG,OAAO,IACxD,mBAAmB,uBAAuB,OAAO,GAAG,OAAO,IAC3D,uBAAuB,OAAO,EAAE,QAC7B,OAAO,SACN,QACA,mBAAmB,KAAK,IAAI,OAAO,IACnC,mBAAmB,KAAK,MAAM,OAAO,IACrC,sBAAsB,OAAO,GAC/B,CACF,IACA,sBAAsB,OAAO,CACjC,GACA,MAAM,UACR;AACF;AAEA,MAAa,+BACX,UACA,UAAgC,CAAC,MAC9B,SAAS,QAAQ,OAAO,YAAY,QAAQ,2BAA2B,SAAS,OAAO,GAAG,CAAC"}
|
|
@@ -12,58 +12,58 @@ type ContextOverflowRetryCompactionResult = Data.TaggedEnum<{
|
|
|
12
12
|
};
|
|
13
13
|
}>;
|
|
14
14
|
declare const ContextOverflowRetryCompactionResult: {
|
|
15
|
-
readonly Skipped: Data.TaggedEnum.ConstructorFrom<{
|
|
16
|
-
readonly _tag: "Skipped";
|
|
17
|
-
readonly messages: ReadonlyArray<AgentMessage>;
|
|
18
|
-
}, "_tag">;
|
|
19
15
|
readonly Compacted: Data.TaggedEnum.ConstructorFrom<{
|
|
20
16
|
readonly _tag: "Compacted";
|
|
21
17
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
22
18
|
}, "_tag">;
|
|
23
|
-
readonly
|
|
19
|
+
readonly Skipped: Data.TaggedEnum.ConstructorFrom<{
|
|
24
20
|
readonly _tag: "Skipped";
|
|
25
21
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
22
|
+
}, "_tag">;
|
|
23
|
+
readonly $is: <Tag extends "Compacted" | "Skipped">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
24
|
+
readonly _tag: "Compacted";
|
|
25
|
+
readonly messages: ReadonlyArray<AgentMessage>;
|
|
26
26
|
}, {
|
|
27
27
|
readonly _tag: Tag;
|
|
28
28
|
}> | Extract<{
|
|
29
|
-
readonly _tag: "
|
|
29
|
+
readonly _tag: "Skipped";
|
|
30
30
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
31
31
|
}, {
|
|
32
32
|
readonly _tag: Tag;
|
|
33
33
|
}>;
|
|
34
34
|
readonly $match: {
|
|
35
35
|
<Cases extends {
|
|
36
|
-
readonly Skipped: (args: {
|
|
37
|
-
readonly _tag: "Skipped";
|
|
38
|
-
readonly messages: ReadonlyArray<AgentMessage>;
|
|
39
|
-
}) => any;
|
|
40
36
|
readonly Compacted: (args: {
|
|
41
37
|
readonly _tag: "Compacted";
|
|
42
38
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
43
39
|
}) => any;
|
|
40
|
+
readonly Skipped: (args: {
|
|
41
|
+
readonly _tag: "Skipped";
|
|
42
|
+
readonly messages: ReadonlyArray<AgentMessage>;
|
|
43
|
+
}) => any;
|
|
44
44
|
}>(cases: Cases): (value: {
|
|
45
|
-
readonly _tag: "
|
|
45
|
+
readonly _tag: "Compacted";
|
|
46
46
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
47
47
|
} | {
|
|
48
|
-
readonly _tag: "
|
|
48
|
+
readonly _tag: "Skipped";
|
|
49
49
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
50
|
-
}) => import("effect/Unify").Unify<ReturnType<Cases["
|
|
50
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Compacted" | "Skipped"]>>;
|
|
51
51
|
<Cases extends {
|
|
52
|
-
readonly Skipped: (args: {
|
|
53
|
-
readonly _tag: "Skipped";
|
|
54
|
-
readonly messages: ReadonlyArray<AgentMessage>;
|
|
55
|
-
}) => any;
|
|
56
52
|
readonly Compacted: (args: {
|
|
57
53
|
readonly _tag: "Compacted";
|
|
58
54
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
59
55
|
}) => any;
|
|
56
|
+
readonly Skipped: (args: {
|
|
57
|
+
readonly _tag: "Skipped";
|
|
58
|
+
readonly messages: ReadonlyArray<AgentMessage>;
|
|
59
|
+
}) => any;
|
|
60
60
|
}>(value: {
|
|
61
|
-
readonly _tag: "
|
|
61
|
+
readonly _tag: "Compacted";
|
|
62
62
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
63
63
|
} | {
|
|
64
|
-
readonly _tag: "
|
|
64
|
+
readonly _tag: "Skipped";
|
|
65
65
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
66
|
-
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["
|
|
66
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Compacted" | "Skipped"]>>;
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
type OverflowCompactionDecision = {
|
|
@@ -73,14 +73,14 @@ type OverflowCompactionDecision = {
|
|
|
73
73
|
readonly _tag: 'Skipped';
|
|
74
74
|
};
|
|
75
75
|
declare const OverflowCompactionDecision: {
|
|
76
|
-
readonly Skipped: Data.TaggedEnum.ConstructorFrom<{
|
|
77
|
-
readonly _tag: "Skipped";
|
|
78
|
-
}, "_tag">;
|
|
79
76
|
readonly Compacted: Data.TaggedEnum.ConstructorFrom<{
|
|
80
77
|
readonly _tag: "Compacted";
|
|
81
78
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
82
79
|
}, "_tag">;
|
|
83
|
-
readonly
|
|
80
|
+
readonly Skipped: Data.TaggedEnum.ConstructorFrom<{
|
|
81
|
+
readonly _tag: "Skipped";
|
|
82
|
+
}, "_tag">;
|
|
83
|
+
readonly $is: <Tag extends "Compacted" | "Skipped">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
84
84
|
readonly _tag: "Compacted";
|
|
85
85
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
86
86
|
}, {
|
|
@@ -92,23 +92,23 @@ declare const OverflowCompactionDecision: {
|
|
|
92
92
|
}>;
|
|
93
93
|
readonly $match: {
|
|
94
94
|
<Cases extends {
|
|
95
|
-
readonly Skipped: (args: {
|
|
96
|
-
readonly _tag: "Skipped";
|
|
97
|
-
}) => any;
|
|
98
95
|
readonly Compacted: (args: {
|
|
99
96
|
readonly _tag: "Compacted";
|
|
100
97
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
101
98
|
}) => any;
|
|
102
|
-
}>(cases: Cases): (value: OverflowCompactionDecision) => import("effect/Unify").Unify<ReturnType<Cases["Skipped" | "Compacted"]>>;
|
|
103
|
-
<Cases extends {
|
|
104
99
|
readonly Skipped: (args: {
|
|
105
100
|
readonly _tag: "Skipped";
|
|
106
101
|
}) => any;
|
|
102
|
+
}>(cases: Cases): (value: OverflowCompactionDecision) => import("effect/Unify").Unify<ReturnType<Cases["Compacted" | "Skipped"]>>;
|
|
103
|
+
<Cases extends {
|
|
107
104
|
readonly Compacted: (args: {
|
|
108
105
|
readonly _tag: "Compacted";
|
|
109
106
|
readonly messages: ReadonlyArray<AgentMessage>;
|
|
110
107
|
}) => any;
|
|
111
|
-
|
|
108
|
+
readonly Skipped: (args: {
|
|
109
|
+
readonly _tag: "Skipped";
|
|
110
|
+
}) => any;
|
|
111
|
+
}>(value: OverflowCompactionDecision, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Compacted" | "Skipped"]>>;
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
type ContextOverflowRetryCompactor = (messages: ReadonlyArray<AgentMessage>) => Effect.Effect<ContextOverflowRetryCompactionResult, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.mts","names":[],"sources":["../../src/compaction/retry.ts"],"mappings":";;;;;KASY,oCAAA,GAAuC,IAAA,CAAK,UAAA;EACtD,SAAA;IAAA,SACW,QAAA,EAAU,aAAA,CAAc,YAAA;EAAA;EAEnC,OAAA;IAAA,SACW,QAAA,EAAU,aAAA,CAAc,YAAA;EAAA;AAAA;AAAA,cAIxB,oCAAA;EAAA;;
|
|
1
|
+
{"version":3,"file":"retry.d.mts","names":[],"sources":["../../src/compaction/retry.ts"],"mappings":";;;;;KASY,oCAAA,GAAuC,IAAA,CAAK,UAAA;EACtD,SAAA;IAAA,SACW,QAAA,EAAU,aAAA,CAAc,YAAA;EAAA;EAEnC,OAAA;IAAA,SACW,QAAA,EAAU,aAAA,CAAc,YAAA;EAAA;AAAA;AAAA,cAIxB,oCAAA;EAAA;;uBAPU,aAAA,CAAc,YAAA;EAAA;EAAA;;uBAGd,aAAA,CAAc,YAAA;EAAA;EAAA;;uBAHd,aAAA,CAAc,YAAA;EAAA;IAAA;;;uBAGd,aAAA,CAAc,YAAA;EAAA;IAAA;;;;;;2BAHd,aAAA,CAAc,YAAA;MAAA;MAAA;;2BAGd,aAAA,CAAc,YAAA;MAAA;IAAA;;yBAHd,aAAA,CAAc,YAAA;IAAA;MAAA;yBAGd,aAAA,CAAc,YAAA;IAAA;;;;2BAHd,aAAA,CAAc,YAAA;MAAA;MAAA;;2BAGd,aAAA,CAAc,YAAA;MAAA;IAAA;;yBAHd,aAAA,CAAc,YAAA;IAAA;MAAA;yBAGd,aAAA,CAAc,YAAA;IAAA;;;KAOzB,0BAAA;EAAA,SAEG,IAAA;EAAA,SACA,QAAA,EAAU,aAAa,CAAC,YAAA;AAAA;EAAA,SAGxB,IAAA;AAAA;AAAA,cAGF,0BAAA;EAAA;;uBANY,aAAA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