@yolk-sdk/agent 0.1.0-canary.76 → 0.1.0-canary.78
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 +194 -9
- package/dist/client/attachments.d.mts.map +1 -1
- package/dist/client/attachments.mjs +3 -3
- package/dist/client/attachments.mjs.map +1 -1
- package/dist/client/state.d.mts +278 -0
- package/dist/client/state.d.mts.map +1 -1
- package/dist/client/state.mjs +143 -227
- package/dist/client/state.mjs.map +1 -1
- package/dist/client/transport.d.mts +4 -4
- package/dist/client/transport.d.mts.map +1 -1
- package/dist/client/transport.mjs +51 -57
- package/dist/client/transport.mjs.map +1 -1
- package/dist/compaction/budget.d.mts.map +1 -1
- package/dist/compaction/budget.mjs.map +1 -1
- package/dist/compaction/checkpoint.d.mts.map +1 -1
- package/dist/compaction/checkpoint.mjs +7 -5
- package/dist/compaction/checkpoint.mjs.map +1 -1
- package/dist/compaction/estimator.d.mts.map +1 -1
- package/dist/compaction/estimator.mjs +4 -14
- package/dist/compaction/estimator.mjs.map +1 -1
- package/dist/compaction/index.d.mts +2 -2
- package/dist/compaction/index.mjs +2 -2
- package/dist/compaction/retry.d.mts +120 -4
- package/dist/compaction/retry.d.mts.map +1 -1
- package/dist/compaction/retry.mjs +35 -13
- package/dist/compaction/retry.mjs.map +1 -1
- package/dist/compaction/summary.d.mts.map +1 -1
- package/dist/compaction/summary.mjs +14 -24
- package/dist/compaction/summary.mjs.map +1 -1
- package/dist/compaction/transformer.mjs +4 -5
- package/dist/compaction/transformer.mjs.map +1 -1
- package/dist/compaction/window.d.mts +155 -29
- package/dist/compaction/window.d.mts.map +1 -1
- package/dist/compaction/window.mjs +16 -19
- package/dist/compaction/window.mjs.map +1 -1
- package/dist/loop/accumulator.d.mts +4 -2
- package/dist/loop/accumulator.d.mts.map +1 -1
- package/dist/loop/accumulator.mjs +39 -25
- package/dist/loop/accumulator.mjs.map +1 -1
- package/dist/loop/collect.d.mts +38 -0
- package/dist/loop/collect.d.mts.map +1 -0
- package/dist/loop/collect.mjs +94 -0
- package/dist/loop/collect.mjs.map +1 -0
- package/dist/loop/error.d.mts +4 -1
- package/dist/loop/error.d.mts.map +1 -1
- package/dist/loop/error.mjs +47 -47
- package/dist/loop/error.mjs.map +1 -1
- package/dist/loop/index.d.mts +5 -3
- package/dist/loop/index.mjs +4 -2
- package/dist/loop/layer.d.mts +17 -0
- package/dist/loop/layer.d.mts.map +1 -0
- package/dist/loop/layer.mjs +15 -0
- package/dist/loop/layer.mjs.map +1 -0
- package/dist/loop/llm-event.d.mts.map +1 -1
- package/dist/loop/llm-event.mjs.map +1 -1
- package/dist/loop/run.d.mts.map +1 -1
- package/dist/loop/run.mjs +73 -114
- package/dist/loop/run.mjs.map +1 -1
- package/dist/loop/services/loop-config.d.mts +4 -4
- package/dist/loop/services/loop-config.d.mts.map +1 -1
- package/dist/loop/services/loop-config.mjs.map +1 -1
- package/dist/loop/services/tool-executor.d.mts +8 -3
- package/dist/loop/services/tool-executor.d.mts.map +1 -1
- package/dist/loop/services/tool-executor.mjs +11 -3
- package/dist/loop/services/tool-executor.mjs.map +1 -1
- package/dist/loop/testing/faux-provider.d.mts.map +1 -1
- package/dist/loop/testing/faux-provider.mjs +1 -1
- package/dist/loop/testing/faux-provider.mjs.map +1 -1
- package/dist/oauth/error.d.mts.map +1 -1
- package/dist/oauth/error.mjs +1 -1
- package/dist/oauth/error.mjs.map +1 -1
- package/dist/protocol/content.d.mts +29 -29
- package/dist/protocol/content.d.mts.map +1 -1
- package/dist/protocol/content.mjs +60 -111
- package/dist/protocol/content.mjs.map +1 -1
- package/dist/protocol/event.d.mts.map +1 -1
- package/dist/protocol/event.mjs +129 -126
- package/dist/protocol/event.mjs.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/message.d.mts +82 -39
- package/dist/protocol/message.d.mts.map +1 -1
- package/dist/protocol/message.mjs +77 -85
- package/dist/protocol/message.mjs.map +1 -1
- package/dist/protocol/reasoning.d.mts.map +1 -1
- package/dist/protocol/reasoning.mjs.map +1 -1
- package/dist/protocol/session.d.mts.map +1 -1
- package/dist/protocol/session.mjs.map +1 -1
- package/dist/protocol/tool.d.mts +219 -89
- package/dist/protocol/tool.d.mts.map +1 -1
- package/dist/protocol/tool.mjs +174 -89
- package/dist/protocol/tool.mjs.map +1 -1
- package/dist/protocol/usage.mjs +11 -11
- package/dist/protocol/usage.mjs.map +1 -1
- package/dist/providers/anthropic/claude-provider.d.mts +6 -9
- package/dist/providers/anthropic/claude-provider.d.mts.map +1 -1
- package/dist/providers/anthropic/claude-provider.mjs +4 -984
- package/dist/providers/anthropic/claude-provider.mjs.map +1 -1
- package/dist/providers/anthropic/claude.d.mts.map +1 -1
- package/dist/providers/anthropic/claude.mjs +10 -10
- package/dist/providers/anthropic/claude.mjs.map +1 -1
- package/dist/providers/anthropic/usage.d.mts.map +1 -1
- package/dist/providers/anthropic/usage.mjs +19 -16
- package/dist/providers/anthropic/usage.mjs.map +1 -1
- package/dist/providers/anthropic-messages-provider-internal.d.mts +16 -0
- package/dist/providers/anthropic-messages-provider-internal.d.mts.map +1 -0
- package/dist/providers/anthropic-messages-provider-internal.mjs +68 -0
- package/dist/providers/anthropic-messages-provider-internal.mjs.map +1 -0
- package/dist/providers/anthropic-provider-internal.d.mts +89 -0
- package/dist/providers/anthropic-provider-internal.d.mts.map +1 -0
- package/dist/providers/anthropic-provider-internal.mjs +996 -0
- package/dist/providers/anthropic-provider-internal.mjs.map +1 -0
- package/dist/providers/openai/codex-provider.d.mts +4 -4
- package/dist/providers/openai/codex-provider.d.mts.map +1 -1
- package/dist/providers/openai/codex-provider.mjs +26 -3
- package/dist/providers/openai/codex-provider.mjs.map +1 -1
- package/dist/providers/openai/codex-usage.d.mts.map +1 -1
- package/dist/providers/openai/codex-usage.mjs +22 -19
- package/dist/providers/openai/codex-usage.mjs.map +1 -1
- package/dist/providers/openai/codex.d.mts.map +1 -1
- package/dist/providers/openai/codex.mjs.map +1 -1
- package/dist/providers/openai/provider.d.mts +21 -7
- package/dist/providers/openai/provider.d.mts.map +1 -1
- package/dist/providers/openai/provider.mjs +215 -122
- package/dist/providers/openai/provider.mjs.map +1 -1
- package/dist/providers/openai/realtime/client-codec.d.mts +7 -1
- package/dist/providers/openai/realtime/client-codec.d.mts.map +1 -1
- package/dist/providers/openai/realtime/client-codec.mjs +30 -4
- package/dist/providers/openai/realtime/client-codec.mjs.map +1 -1
- package/dist/providers/openai/realtime/events.d.mts +81 -85
- package/dist/providers/openai/realtime/events.d.mts.map +1 -1
- package/dist/providers/openai/realtime/events.mjs +135 -162
- package/dist/providers/openai/realtime/events.mjs.map +1 -1
- package/dist/providers/openai/realtime/index.d.mts +2 -2
- package/dist/providers/openai/realtime/index.mjs +2 -2
- package/dist/providers/openai/realtime/session-config.d.mts +7 -4
- package/dist/providers/openai/realtime/session-config.d.mts.map +1 -1
- package/dist/providers/openai/realtime/session-config.mjs +51 -30
- package/dist/providers/openai/realtime/session-config.mjs.map +1 -1
- package/dist/providers/openai/realtime/to-voice.d.mts.map +1 -1
- package/dist/providers/openai/realtime/to-voice.mjs +30 -39
- package/dist/providers/openai/realtime/to-voice.mjs.map +1 -1
- package/dist/providers/openai/speech.d.mts.map +1 -1
- package/dist/providers/openai/speech.mjs +24 -20
- package/dist/providers/openai/speech.mjs.map +1 -1
- package/dist/providers/openai-responses-provider-internal.d.mts +16 -5
- package/dist/providers/openai-responses-provider-internal.d.mts.map +1 -1
- package/dist/providers/openai-responses-provider-internal.mjs +181 -199
- package/dist/providers/openai-responses-provider-internal.mjs.map +1 -1
- package/dist/providers/opencode/go-provider.d.mts +21 -0
- package/dist/providers/opencode/go-provider.d.mts.map +1 -0
- package/dist/providers/opencode/go-provider.mjs +85 -0
- package/dist/providers/opencode/go-provider.mjs.map +1 -0
- package/dist/providers/opencode/usage.d.mts +16 -0
- package/dist/providers/opencode/usage.d.mts.map +1 -0
- package/dist/providers/opencode/usage.mjs +75 -0
- package/dist/providers/opencode/usage.mjs.map +1 -0
- package/dist/providers/provider-error.d.mts.map +1 -1
- package/dist/providers/provider-error.mjs +20 -14
- package/dist/providers/provider-error.mjs.map +1 -1
- package/dist/providers/subscription-usage-internal.mjs +4 -4
- package/dist/providers/subscription-usage-internal.mjs.map +1 -1
- package/dist/providers/subscription-usage.d.mts +1 -1
- package/dist/providers/subscription-usage.d.mts.map +1 -1
- package/dist/providers/subscription-usage.mjs +6 -5
- package/dist/providers/subscription-usage.mjs.map +1 -1
- package/dist/providers/transcript.mjs +6 -10
- package/dist/providers/transcript.mjs.map +1 -1
- package/dist/providers/vercel/ai-gateway-provider.d.mts.map +1 -1
- package/dist/providers/vercel/ai-gateway-provider.mjs +27 -16
- package/dist/providers/vercel/ai-gateway-provider.mjs.map +1 -1
- package/dist/providers/xai/grok.d.mts.map +1 -1
- package/dist/providers/xai/grok.mjs +10 -10
- package/dist/providers/xai/grok.mjs.map +1 -1
- package/dist/providers/xai/usage.d.mts.map +1 -1
- package/dist/providers/xai/usage.mjs +27 -24
- package/dist/providers/xai/usage.mjs.map +1 -1
- package/dist/react/chat-actions.d.mts +418 -0
- package/dist/react/chat-actions.d.mts.map +1 -0
- package/dist/react/chat-actions.mjs +12 -0
- package/dist/react/chat-actions.mjs.map +1 -0
- package/dist/react/chat-core.d.mts.map +1 -1
- package/dist/react/chat-core.mjs +122 -178
- package/dist/react/chat-core.mjs.map +1 -1
- package/dist/react/chat-items.d.mts +505 -2
- package/dist/react/chat-items.d.mts.map +1 -1
- package/dist/react/chat-items.mjs +70 -97
- package/dist/react/chat-items.mjs.map +1 -1
- package/dist/react/chat-messages.d.mts +535 -1
- package/dist/react/chat-messages.d.mts.map +1 -1
- package/dist/react/chat-messages.mjs +257 -424
- package/dist/react/chat-messages.mjs.map +1 -1
- package/dist/react/chat-session-events.d.mts.map +1 -1
- package/dist/react/chat-session-events.mjs.map +1 -1
- package/dist/react/index.d.mts +5 -4
- package/dist/react/index.mjs +4 -3
- package/dist/react/use-agent-chat.d.mts.map +1 -1
- package/dist/react/use-agent-chat.mjs +56 -77
- package/dist/react/use-agent-chat.mjs.map +1 -1
- package/dist/runtime/error.d.mts.map +1 -1
- package/dist/runtime/error.mjs +25 -36
- package/dist/runtime/error.mjs.map +1 -1
- package/dist/runtime/index.d.mts +1 -1
- package/dist/runtime/index.d.mts.map +1 -1
- package/dist/runtime/index.mjs +2 -2
- package/dist/runtime/run-runtime.d.mts +145 -18
- package/dist/runtime/run-runtime.d.mts.map +1 -1
- package/dist/runtime/run-runtime.mjs +23 -35
- package/dist/runtime/run-runtime.mjs.map +1 -1
- package/dist/runtime/session-event-store.d.mts +19 -19
- package/dist/runtime/session-event-store.d.mts.map +1 -1
- package/dist/runtime/session-event-store.mjs +28 -56
- package/dist/runtime/session-event-store.mjs.map +1 -1
- package/dist/skillset/command.d.mts +26 -29
- package/dist/skillset/command.d.mts.map +1 -1
- package/dist/skillset/command.mjs +27 -25
- package/dist/skillset/command.mjs.map +1 -1
- package/dist/skillset/errors.d.mts.map +1 -1
- package/dist/skillset/errors.mjs +1 -1
- package/dist/skillset/errors.mjs.map +1 -1
- package/dist/skillset/manifest.d.mts.map +1 -1
- package/dist/skillset/manifest.mjs.map +1 -1
- package/dist/skillset/markdown.d.mts.map +1 -1
- package/dist/skillset/markdown.mjs.map +1 -1
- package/dist/skillset/merge.d.mts +5 -5
- package/dist/skillset/name.d.mts +2 -2
- package/dist/skillset/name.d.mts.map +1 -1
- package/dist/skillset/name.mjs.map +1 -1
- package/dist/skillset/skill.d.mts +7 -7
- package/dist/skillset/skill.d.mts.map +1 -1
- package/dist/skillset/skill.mjs +7 -7
- package/dist/skillset/skill.mjs.map +1 -1
- package/dist/tools/background.d.mts +2 -1
- package/dist/tools/background.d.mts.map +1 -1
- package/dist/tools/background.mjs +30 -21
- package/dist/tools/background.mjs.map +1 -1
- package/dist/tools/registry.d.mts +20 -20
- package/dist/tools/registry.d.mts.map +1 -1
- package/dist/tools/registry.mjs +111 -82
- package/dist/tools/registry.mjs.map +1 -1
- package/dist/tools/subagent.d.mts.map +1 -1
- package/dist/tools/subagent.mjs +155 -121
- package/dist/tools/subagent.mjs.map +1 -1
- package/dist/voice/browser/index.d.mts +2 -2
- package/dist/voice/browser/index.mjs +2 -2
- package/dist/voice/browser/webrtc.d.mts +5 -4
- package/dist/voice/browser/webrtc.d.mts.map +1 -1
- package/dist/voice/browser/webrtc.mjs +5 -3
- package/dist/voice/browser/webrtc.mjs.map +1 -1
- package/dist/voice/controller.d.mts +11 -6
- package/dist/voice/controller.d.mts.map +1 -1
- package/dist/voice/controller.mjs +20 -18
- package/dist/voice/controller.mjs.map +1 -1
- package/dist/voice/index.d.mts +5 -4
- package/dist/voice/index.mjs +6 -5
- package/dist/voice/outbox.d.mts +6 -2
- package/dist/voice/outbox.d.mts.map +1 -1
- package/dist/voice/outbox.mjs +7 -16
- package/dist/voice/outbox.mjs.map +1 -1
- package/dist/voice/projection.d.mts +2 -1
- package/dist/voice/projection.d.mts.map +1 -1
- package/dist/voice/projection.mjs +56 -83
- package/dist/voice/projection.mjs.map +1 -1
- package/dist/voice/protocol.d.mts.map +1 -1
- package/dist/voice/protocol.mjs +1 -1
- package/dist/voice/protocol.mjs.map +1 -1
- package/dist/voice/react.d.mts +5 -6
- package/dist/voice/react.d.mts.map +1 -1
- package/dist/voice/react.mjs +86 -115
- package/dist/voice/react.mjs.map +1 -1
- package/dist/voice/session-log.d.mts.map +1 -1
- package/dist/voice/session-log.mjs +35 -42
- package/dist/voice/session-log.mjs.map +1 -1
- package/dist/voice/session.d.mts +56 -0
- package/dist/voice/session.d.mts.map +1 -0
- package/dist/voice/session.mjs +48 -0
- package/dist/voice/session.mjs.map +1 -0
- package/dist/voice/speech.d.mts +21 -21
- package/dist/voice/speech.d.mts.map +1 -1
- package/dist/voice/speech.mjs +20 -20
- package/dist/voice/speech.mjs.map +1 -1
- package/dist/voice/tool-bridge.d.mts +10 -10
- package/dist/voice/tool-bridge.d.mts.map +1 -1
- package/dist/voice/tool-bridge.mjs +17 -16
- package/dist/voice/tool-bridge.mjs.map +1 -1
- package/dist/voice/tool-server.d.mts +57 -1
- package/dist/voice/tool-server.d.mts.map +1 -1
- package/dist/voice/tool-server.mjs +28 -36
- package/dist/voice/tool-server.mjs.map +1 -1
- package/dist/voice/websocket.d.mts +4 -3
- package/dist/voice/websocket.d.mts.map +1 -1
- package/dist/voice/websocket.mjs +8 -7
- package/dist/voice/websocket.mjs.map +1 -1
- package/package.json +12 -2
- package/src/client/attachments.ts +9 -3
- package/src/client/index.ts +5 -4
- package/src/client/state.ts +238 -210
- package/src/client/transport.ts +113 -55
- package/src/compaction/budget.ts +2 -0
- package/src/compaction/checkpoint.ts +25 -14
- package/src/compaction/estimator.ts +31 -25
- package/src/compaction/index.ts +23 -2
- package/src/compaction/retry.ts +116 -29
- package/src/compaction/summary.ts +74 -51
- package/src/compaction/transformer.ts +10 -10
- package/src/compaction/window.ts +70 -51
- package/src/loop/README.md +15 -0
- package/src/loop/accumulator.ts +75 -26
- package/src/loop/collect.ts +268 -0
- package/src/loop/error.ts +61 -34
- package/src/loop/index.ts +24 -1
- package/src/loop/layer.ts +32 -0
- package/src/loop/llm-event.ts +1 -0
- package/src/loop/run.ts +204 -162
- package/src/loop/services/loop-config.ts +3 -3
- package/src/loop/services/tool-executor.ts +16 -4
- package/src/loop/testing/faux-provider.ts +2 -0
- package/src/loop/testing/index.ts +2 -0
- package/src/oauth/error.ts +2 -1
- package/src/oauth/index.ts +3 -0
- package/src/protocol/content.ts +95 -106
- package/src/protocol/event.ts +101 -40
- package/src/protocol/index.ts +15 -1
- package/src/protocol/message.ts +94 -54
- package/src/protocol/reasoning.ts +1 -0
- package/src/protocol/session.ts +2 -0
- package/src/protocol/tool.ts +341 -62
- package/src/providers/anthropic/claude-provider.ts +30 -1756
- package/src/providers/anthropic/claude.ts +9 -0
- package/src/providers/anthropic/usage.ts +26 -5
- package/src/providers/anthropic-messages-provider-internal.ts +140 -0
- package/src/providers/anthropic-provider-internal.ts +2086 -0
- package/src/providers/openai/codex-provider.ts +104 -12
- package/src/providers/openai/codex-usage.ts +37 -7
- package/src/providers/openai/codex.ts +9 -0
- package/src/providers/openai/provider.ts +479 -161
- package/src/providers/openai/realtime/client-codec.ts +38 -6
- package/src/providers/openai/realtime/events.ts +18 -47
- package/src/providers/openai/realtime/index.ts +11 -6
- package/src/providers/openai/realtime/session-config.ts +90 -34
- package/src/providers/openai/realtime/to-voice.ts +42 -40
- package/src/providers/openai/speech.ts +50 -12
- package/src/providers/openai-responses-provider-internal.ts +376 -220
- package/src/providers/opencode/go-provider.ts +142 -0
- package/src/providers/opencode/usage.ts +153 -0
- package/src/providers/provider-error.ts +52 -14
- package/src/providers/subscription-usage-internal.ts +3 -2
- package/src/providers/subscription-usage.ts +8 -5
- package/src/providers/transcript.ts +14 -15
- package/src/providers/vercel/ai-gateway-provider.ts +64 -18
- package/src/providers/xai/grok.ts +10 -0
- package/src/providers/xai/usage.ts +28 -11
- package/src/react/chat-actions.ts +33 -0
- package/src/react/chat-core.ts +218 -208
- package/src/react/chat-items.ts +120 -87
- package/src/react/chat-messages.ts +605 -473
- package/src/react/chat-session-events.ts +1 -0
- package/src/react/index.ts +29 -17
- package/src/react/use-agent-chat.ts +82 -45
- package/src/runtime/error.ts +35 -36
- package/src/runtime/index.ts +6 -2
- package/src/runtime/run-runtime.ts +114 -97
- package/src/runtime/session-event-store.ts +42 -48
- package/src/skillset/command.ts +37 -6
- package/src/skillset/errors.ts +2 -1
- package/src/skillset/index.ts +10 -0
- package/src/skillset/manifest.ts +1 -0
- package/src/skillset/markdown.ts +1 -0
- package/src/skillset/name.ts +1 -0
- package/src/skillset/skill.ts +3 -0
- package/src/tools/background.ts +62 -19
- package/src/tools/index.ts +6 -0
- package/src/tools/registry.ts +211 -103
- package/src/tools/subagent.ts +355 -93
- package/src/voice/browser/index.ts +1 -0
- package/src/voice/browser/webrtc.ts +42 -7
- package/src/voice/controller.ts +49 -22
- package/src/voice/index.ts +19 -1
- package/src/voice/outbox.ts +30 -19
- package/src/voice/projection.ts +87 -79
- package/src/voice/protocol.ts +6 -1
- package/src/voice/react.ts +96 -94
- package/src/voice/session-log.ts +38 -34
- package/src/voice/session.ts +138 -0
- package/src/voice/speech.ts +5 -7
- package/src/voice/tool-bridge.ts +21 -18
- package/src/voice/tool-server.ts +21 -19
- package/src/voice/websocket.ts +29 -7
package/README.md
CHANGED
|
@@ -7,13 +7,13 @@ Root export is intentionally empty. Import feature APIs from explicit subpaths.
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
pnpm add @yolk-sdk/agent@canary effect@4.0.0-
|
|
10
|
+
pnpm add @yolk-sdk/agent@canary effect@4.0.0-rc.115
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Add `react` if you use `@yolk-sdk/agent/react` or `@yolk-sdk/agent/voice/react`.
|
|
14
14
|
|
|
15
15
|
Canary APIs are unstable. Keep all `@yolk-sdk/*` packages on the same version.
|
|
16
|
-
Use the SDK's matching Effect version (`4.0.0-
|
|
16
|
+
Use the SDK's matching Effect version (`4.0.0-rc.115`) in host code.
|
|
17
17
|
Published package metadata requires Node.js 22+.
|
|
18
18
|
|
|
19
19
|
## Subpaths
|
|
@@ -37,6 +37,8 @@ Published package metadata requires Node.js 22+.
|
|
|
37
37
|
| `@yolk-sdk/agent/providers/openai/realtime` | OpenAI Realtime session config and event codecs |
|
|
38
38
|
| `@yolk-sdk/agent/providers/openai/speech` | OpenAI text-to-speech and transcription adapters |
|
|
39
39
|
| `@yolk-sdk/agent/providers/vercel/ai-gateway-provider` | Vercel AI Gateway Chat Completions provider factory |
|
|
40
|
+
| `@yolk-sdk/agent/providers/opencode/go-provider` | OpenCode Go Chat Completions, Messages, and Responses provider |
|
|
41
|
+
| `@yolk-sdk/agent/providers/opencode/usage` | OpenCode Go subscription-allowance snapshots |
|
|
40
42
|
| `@yolk-sdk/agent/providers/anthropic` | Anthropic/Claude OAuth and broker helpers |
|
|
41
43
|
| `@yolk-sdk/agent/providers/anthropic/claude` | Claude request and auth helpers |
|
|
42
44
|
| `@yolk-sdk/agent/providers/anthropic/usage` | Claude subscription-allowance snapshots |
|
|
@@ -60,13 +62,14 @@ import {
|
|
|
60
62
|
isTerminalAgentEvent,
|
|
61
63
|
makeSubagentRunId,
|
|
62
64
|
ProviderErrorInfo,
|
|
65
|
+
PlainHitlResponse,
|
|
63
66
|
questionResponseStructuredContent,
|
|
64
67
|
repairDanglingHostToolCalls,
|
|
65
68
|
UserMessage,
|
|
66
69
|
validateNoDanglingHostToolCalls
|
|
67
70
|
} from '@yolk-sdk/agent/protocol'
|
|
68
71
|
import { run } from '@yolk-sdk/agent/loop'
|
|
69
|
-
import { runRuntime } from '@yolk-sdk/agent/runtime'
|
|
72
|
+
import { runRuntime, RuntimeRequest } from '@yolk-sdk/agent/runtime'
|
|
70
73
|
import {
|
|
71
74
|
documentPartFromTextFile,
|
|
72
75
|
initialAgentClientState,
|
|
@@ -87,6 +90,8 @@ import {
|
|
|
87
90
|
resolveTools
|
|
88
91
|
} from '@yolk-sdk/agent/tools'
|
|
89
92
|
import {
|
|
93
|
+
AgentChatAction,
|
|
94
|
+
AgentChatPart,
|
|
90
95
|
applyAgentEventToChatProjection,
|
|
91
96
|
makeAgentChatEventProjectionState,
|
|
92
97
|
useAgentChat
|
|
@@ -94,6 +99,8 @@ import {
|
|
|
94
99
|
import { makeVercelAiGatewayProviderLayer } from '@yolk-sdk/agent/providers/vercel/ai-gateway-provider'
|
|
95
100
|
```
|
|
96
101
|
|
|
102
|
+
`RuntimeRequest` is a value on `@yolk-sdk/agent/runtime` (`Transcript`, `AppendInput`, `AppendHitlResponse`). Pass `RuntimeRequest.Transcript({ sessionId, messages })` into `runRuntime`. For append requests, omitted or `undefined` `expectedRevision` still means use the loaded log revision (`??`).
|
|
103
|
+
|
|
97
104
|
Test helpers live behind their own subpath:
|
|
98
105
|
|
|
99
106
|
```ts
|
|
@@ -107,10 +114,21 @@ and actions for submit, stop, edit, regenerate, delete, tool approval, and quest
|
|
|
107
114
|
package supplies no components, styling, auth, or route ownership, and React remains an optional
|
|
108
115
|
peer used only by React subpaths.
|
|
109
116
|
|
|
117
|
+
Chat ADTs on `@yolk-sdk/agent/react` are value constructors: `AgentChatPart`, `ChatToolState`,
|
|
118
|
+
`DeleteChatTurnResult`, `EditChatUserMessageResult`, `RegenerateChatMessagesResult`, `AgentChatItem`,
|
|
119
|
+
`ToolRunState`, `AgentChatAction`, and hook results such as `AgentChatSubmitResult`. They are
|
|
120
|
+
`Data.taggedEnum` plain objects (`_tag` last), not Equal/Hash classes. Duration descriptors use
|
|
121
|
+
`ToolDurationKnown` / `ToolDurationUnknown` (`Schema.TaggedStruct.make` validates those plains).
|
|
122
|
+
Prefer `AgentChatPart.Text({ ... })` over handwritten `{ _tag: 'Text', ... }`, omit absent optionals,
|
|
123
|
+
and discriminate with `$is` (for example `AgentChatSubmitResult.$is('Submitted')(result)`).
|
|
124
|
+
`useAgentChat` dispatches `AgentChatAction` constructors and returns those hook-result values.
|
|
125
|
+
|
|
110
126
|
By default the hook streams HTTP/NDJSON through `@yolk-sdk/agent/client`. Pass an
|
|
111
127
|
`AgentChatTransport` through the `transport` option to use another runtime. A custom transport
|
|
112
128
|
receives the transcript, session/model options, HITL responses, and an `AbortSignal`, and returns an
|
|
113
|
-
`AsyncIterable<AgentEvent>`; the host still owns endpoint auth and persistence.
|
|
129
|
+
`AsyncIterable<AgentEvent>`; the host still owns endpoint auth and persistence. Custom transport
|
|
130
|
+
rejections are normalized to `AgentTransportError` internally while retaining the original cause.
|
|
131
|
+
Native abort causes stop quietly; other non-Error rejections display `Agent request failed`.
|
|
114
132
|
|
|
115
133
|
## Quick start
|
|
116
134
|
|
|
@@ -129,6 +147,22 @@ const program = run({
|
|
|
129
147
|
// Provide LLM provider, loop config, context transformer, and tool executor layers in the host app.
|
|
130
148
|
```
|
|
131
149
|
|
|
150
|
+
Loop composition is those four Layers plus `run` / `runModelTurn` / `runToolBatch`.
|
|
151
|
+
Merge them with `makeAgentLoopLayer`. Omitted tools use `ToolExecutor.unavailable`; omitted transformer/config use identity and `LoopConfig.defaultLayer`.
|
|
152
|
+
Intercept by decorating a service (`decorateLLMProvider`), not with hooks.
|
|
153
|
+
Durable hosts fold model-turn steps with `collectModelTurn`. Use `collectModelTurnAttempt` when the fold must retain partial output after a failed stream. Kernel incomplete streams (zero `Done` events) set optional `LLMError.responseIssue: 'missing_done'` and stay `invalid_response` / `retryable: false`.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
import { makeAgentLoopLayer } from '@yolk-sdk/agent/loop'
|
|
157
|
+
import { FauxProvider, Reply } from '@yolk-sdk/agent/loop/testing'
|
|
158
|
+
|
|
159
|
+
const LoopLayer = makeAgentLoopLayer({
|
|
160
|
+
provider: FauxProvider.layer(Reply.text('ok'))
|
|
161
|
+
})
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Guide source: [Loop and runtime](https://github.com/magoz/yolk-sdk/blob/main/apps/docs/content/docs/agent/loop-runtime.mdx#compose-the-loop-layer).
|
|
165
|
+
|
|
132
166
|
## OAuth credentials
|
|
133
167
|
|
|
134
168
|
`@yolk-sdk/agent/oauth` defines provider-neutral access-token, broker, freshness, and credential-source
|
|
@@ -157,6 +191,7 @@ limits or apply hidden fallbacks.
|
|
|
157
191
|
| ---------------------------------- | --------------------- |
|
|
158
192
|
| `makeOpenAiProviderLayer` | `maxCompletionTokens` |
|
|
159
193
|
| `makeVercelAiGatewayProviderLayer` | `maxCompletionTokens` |
|
|
194
|
+
| `makeOpenCodeGoProviderLayer` | `maxOutputTokens` |
|
|
160
195
|
| `makeOpenAiCodexProviderLayer` | none |
|
|
161
196
|
| `makeAnthropicClaudeProviderLayer` | `maxTokens` |
|
|
162
197
|
| `makeXAiGrokProviderLayer` | `maxOutputTokens` |
|
|
@@ -167,6 +202,56 @@ require the matching limit configuration. ChatGPT subscription Codex rejects ven
|
|
|
167
202
|
optional deprecated `maxOutputTokens` compatibility field. `OpenAiProviderLayer` reads both
|
|
168
203
|
`OPENAI_API_KEY` and integer `OPENAI_MAX_COMPLETION_TOKENS` through Effect Config.
|
|
169
204
|
|
|
205
|
+
OpenCode Go uses API-key authentication with an explicit host-selected `protocol`:
|
|
206
|
+
`chat-completions`, `messages`, or `responses`. Model IDs stay opaque: pass the Go API model ID
|
|
207
|
+
without OpenCode's `opencode-go/` CLI prefix. The SDK does not fetch a catalog or guess the protocol
|
|
208
|
+
from a model name. Check the [Go endpoint catalog](https://opencode.ai/docs/go/#endpoints).
|
|
209
|
+
|
|
210
|
+
Server-side configuration fragment (the host supplies credentials and model policy):
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
import { Layer, Redacted } from 'effect'
|
|
214
|
+
import { FetchHttpClient } from 'effect/unstable/http'
|
|
215
|
+
import { makeOpenCodeGoProviderLayer } from '@yolk-sdk/agent/providers/opencode/go-provider'
|
|
216
|
+
|
|
217
|
+
const GoLayer = makeOpenCodeGoProviderLayer({
|
|
218
|
+
apiKey: Redacted.make(hostOpenCodeGoApiKey),
|
|
219
|
+
protocol: 'messages',
|
|
220
|
+
maxOutputTokens: hostModelConfig.maxOutputTokens
|
|
221
|
+
}).pipe(Layer.provide(FetchHttpClient.layer))
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The default base URL is `https://opencode.ai/zen/go/v1`. Chat uses non-streamed JSON and Bearer auth;
|
|
225
|
+
Messages uses SSE and `x-api-key`; Responses uses SSE and Bearer auth. All normalize to `LLMEvent`s.
|
|
226
|
+
Messages retains native tool names and system instructions, without Claude OAuth fingerprinting.
|
|
227
|
+
Responses sends `max_output_tokens`, unlike Codex. Go requires a nonempty key and positive safe-integer
|
|
228
|
+
limit at layer construction. `extraHeaders` cannot override required protocol headers, regardless of
|
|
229
|
+
case. Only override `baseUrl` with a trusted proxy because it receives the credential.
|
|
230
|
+
|
|
231
|
+
Request `reasoningEffort` becomes chat `reasoning_effort`, Messages `output_config.effort` (omitting
|
|
232
|
+
`minimal`), or Responses `reasoning.effort` with `summary: 'auto'`. `reasoningSummary` changes the
|
|
233
|
+
Responses summary mode. Hosts must offer only model-supported efforts and media capabilities.
|
|
234
|
+
Chat preserves provider `reasoning_content` in events and assistant replay. No OAuth, model discovery,
|
|
235
|
+
automatic polling, or example-app UI integration is included.
|
|
236
|
+
|
|
237
|
+
Read Go subscription allowance separately from per-request token usage (server-side fragment):
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
import { Effect, Redacted } from 'effect'
|
|
241
|
+
import { FetchHttpClient } from 'effect/unstable/http'
|
|
242
|
+
import { fetchOpenCodeGoSubscriptionUsage } from '@yolk-sdk/agent/providers/opencode/usage'
|
|
243
|
+
|
|
244
|
+
const usageEffect = fetchOpenCodeGoSubscriptionUsage(Redacted.make(hostOpenCodeGoApiKey), {
|
|
245
|
+
requestTimeoutMs: 10_000
|
|
246
|
+
}).pipe(Effect.provide(FetchHttpClient.layer))
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
The fixed API-key endpoint returns used percentages/reset instants for `five-hour`, `seven-day`, and
|
|
250
|
+
`monthly` windows. Monthly resets follow the subscription's anniversary, not the first of the month;
|
|
251
|
+
the adapter preserves the provider's timestamp. Missing/invalid percentages are omitted, not treated
|
|
252
|
+
as zero. Treat snapshots as best-effort; hosts own polling, stale-data policy, persistence, and UI.
|
|
253
|
+
The fetcher blocks redirects and sanitizes failures using the shared subscription-usage error types.
|
|
254
|
+
|
|
170
255
|
Vercel AI Gateway uses its OpenAI-compatible JSON Chat Completions endpoint. Pass either an AI
|
|
171
256
|
Gateway API key or Vercel OIDC token as `apiKey`; `maxCompletionTokens` is sent as Gateway
|
|
172
257
|
`max_tokens`. The env-backed `VercelAiGatewayProviderLayer` tries `AI_GATEWAY_API_KEY` first, then
|
|
@@ -204,6 +289,72 @@ When a constraint cannot be represented faithfully, the projection widens the mo
|
|
|
204
289
|
rather than excluding a valid call. Tool execution remains safe because `makeTool` validates the
|
|
205
290
|
returned arguments against the original Effect Schema before invoking the executor.
|
|
206
291
|
|
|
292
|
+
Before projection, `toAnthropicClaudeRequestBody` and the Claude provider decode `ToolDef.parameters`
|
|
293
|
+
and `ToolCall.params` as `Schema.Json`. Non-JSON values fail as non-retryable `LLMError` with
|
|
294
|
+
`cause: 'provider_error'`. `ToolDef.parameters` now admits `ToolJsonSchema` at construction;
|
|
295
|
+
`ToolCall.params` stays opaque. Provider admission also catches post-construction forgeries.
|
|
296
|
+
After lone-surrogate rewrite, the request
|
|
297
|
+
body is decoded as JSON again and fails rather than skipping serialization. HTTP error bodies that
|
|
298
|
+
are not JSON still classify from status.
|
|
299
|
+
|
|
300
|
+
### Tool parameter documents
|
|
301
|
+
|
|
302
|
+
`ToolDef.parameters` uses `ToolJsonSchema` from `@yolk-sdk/agent/protocol`: a boolean schema or
|
|
303
|
+
plain JSON object. `ToolJsonSchemaObject` is the object arm; `decodeToolJsonSchema` and
|
|
304
|
+
`decodeToolJsonSchemaObject` return `Option`. This checks representation, not JSON Schema semantics.
|
|
305
|
+
Construction/decode preserve admitted identity and accept finite primitives, dense ordinary arrays,
|
|
306
|
+
plain/null-prototype objects, own `__proto__`/`constructor` keys and DAG aliases. Accessors are
|
|
307
|
+
rejected unread; exotic prototypes, hidden/symbol keys, undefined, nonfinite values and cycles fail.
|
|
308
|
+
No Proxy side-effect immunity or immutability is promised. Tool call parameters/results and HITL
|
|
309
|
+
remain opaque. Background wrapping preserves boolean `true`/`false` as the arguments schema;
|
|
310
|
+
reference/resource restrictions still apply at activation.
|
|
311
|
+
|
|
312
|
+
### OpenAI Chat Completions, Responses, and extraBody
|
|
313
|
+
|
|
314
|
+
OpenAI Chat Completions and Responses lowering (including Codex) likewise admits
|
|
315
|
+
`ToolDef.parameters` and tool-call `params` as `Schema.Json` before they are copied onto the request
|
|
316
|
+
body. Non-JSON tool documents and arguments fail as non-retryable `LLMError` `provider_error` before
|
|
317
|
+
transport. `ToolDef.parameters` admits `ToolJsonSchema`; `ToolCall.params` stays opaque. Public Codex wrapper
|
|
318
|
+
`OpenAiCodexTool.parameters` remains `unknown`; that field is not a `Schema.Json` input type.
|
|
319
|
+
|
|
320
|
+
Optional request-body fields such as `max_output_tokens`, `tools`, `parallel_tool_calls`, and
|
|
321
|
+
`reasoning` are omitted unless present — they are not own-property `undefined`. After lone-surrogate
|
|
322
|
+
rewrite, Chat Completions and Responses request bodies are decoded as `Schema.Json` again and fail
|
|
323
|
+
rather than skipping serialization. Inbound HTTP JSON bodies admit `Schema.Json` before class/helper
|
|
324
|
+
consumption (`invalid_response` on failure). Responses SSE event JSON admits `Schema.Json`;
|
|
325
|
+
non-object JSON events are ignored (not failed), while malformed non-JSON event text still fails
|
|
326
|
+
`invalid_response`. First `response.completed` remains terminal. HTTP error bodies stay raw text for
|
|
327
|
+
`classifyProviderFailure`.
|
|
328
|
+
|
|
329
|
+
`OpenAiProviderConfig.extraBody` takes `OpenAiRequestExtras` (JSON-object input). Lowering
|
|
330
|
+
projects enumerable own string fields into an independent portable-data snapshot. Canonical
|
|
331
|
+
`model`, `messages`, `stream`, `tools`, `parallel_tool_calls`, `max_completion_tokens`, and
|
|
332
|
+
`max_tokens` are discarded **without reading their values**; `reasoning` is also discarded when
|
|
333
|
+
`reasoningEffortFormat` is `reasoning-object`. Root symbols/non-enumerable fields are not projected.
|
|
334
|
+
Surviving accessors are rejected unread. Nested values must be finite JSON data with plain/null
|
|
335
|
+
prototypes or dense ordinary arrays; exotic objects, cycles, hidden/symbol keys and extra array
|
|
336
|
+
properties fail. DAG aliases remain aliases in the snapshot; the input is not mutated or retained.
|
|
337
|
+
Invalid extras fail with non-retryable `provider_error`, fixed message
|
|
338
|
+
`Invalid … extraBody JSON: expected a JSON object`, and no HTTP request. Messages never echo values.
|
|
339
|
+
The composed request still passes final `Schema.Json` admission after lone-surrogate rewriting.
|
|
340
|
+
This is not a guarantee against Proxy traps. Gateway routing projects its declared `order`, `only`
|
|
341
|
+
and `sort` fields into JSON; canonical headers and provider identity stay host-owned.
|
|
342
|
+
|
|
343
|
+
### OpenAI Realtime tool JSON
|
|
344
|
+
|
|
345
|
+
Public `OpenAiRealtimeFunctionTool.parameters` and `openAiRealtimeToolParameters(parameters: Schema.Json)`
|
|
346
|
+
now require admitted JSON. Non-JSON advertisement fails `VoiceToolBridgeError` before transport:
|
|
347
|
+
synchronous `toOpenAiRealtimeTool`, `makeOpenAiRealtimeSessionConfig`, and
|
|
348
|
+
`openAiRealtimeSessionConfigFromVoice` throw; `toOpenAiRealtimeToolEffect`,
|
|
349
|
+
`makeOpenAiRealtimeSessionConfigEffect`, and `openAiRealtimeSessionConfigFromVoiceEffect` fail in the
|
|
350
|
+
Effect error channel. Unexpected mapper defects (for example throwing getters) remain defects via
|
|
351
|
+
`Effect.suspend` / `Result`, not `VoiceToolBridgeError`.
|
|
352
|
+
|
|
353
|
+
Union-root lowering uses `Map<string, Schema.Json>` plus `Object.fromEntries` so own `__proto__` /
|
|
354
|
+
`constructor` fields merge (first-seen / string-enum union) instead of prototype assignment or
|
|
355
|
+
inherited `constructor` masquerading as Schema.Json. Required intersection, empty-required omission,
|
|
356
|
+
and object-root identity are unchanged.
|
|
357
|
+
|
|
207
358
|
## Provider failures and retries
|
|
208
359
|
|
|
209
360
|
Provider adapters classify safe failure metadata at the boundary. The loop owns bounded retry
|
|
@@ -464,7 +615,7 @@ HITL is protocol-level, not UI-level:
|
|
|
464
615
|
`streamToolApprovalResponseEventStream`.
|
|
465
616
|
- Denials become model-visible `ToolResult` messages with `isError = true`.
|
|
466
617
|
- Use `makeQuestionToolModule` to expose the package-owned `question` tool; answers resume as structured tool results and model-visible text with selected labels. The loop intercepts questions only when the tool is enabled in `tools`; omitted questions return an unavailable result without HITL or executor dispatch, even if a provider emits one.
|
|
467
|
-
- Use `questionResponseStructuredContent` / `plainHitlResponse` before storing durable HITL payloads that must be plain JSON.
|
|
618
|
+
- Use `questionResponseStructuredContent` / `plainHitlResponse` before storing durable HITL payloads that must be plain JSON. `PlainHitlResponse` is a `Data.taggedEnum` value (`QuestionResponse` / `ToolApprovalResponse`); the helpers omit absent optionals then call those constructors (`_tag` last, plain objects, not Schema classes).
|
|
468
619
|
- Use `toolRunsFromHitlRequests` to hydrate paused UI state from `AgentAwaitingInput.requests`.
|
|
469
620
|
- Use `hitlResponseEvent` when a client needs optimistic approval/question UI updates before resumed stream events arrive.
|
|
470
621
|
- Approval is a host-enforced per-call gate for normal tools, not a model-callable permission tool or persisted allow-always system.
|
|
@@ -510,6 +661,20 @@ request matching. Hosts expose the run endpoints and validate access/response id
|
|
|
510
661
|
|
|
511
662
|
## Voice
|
|
512
663
|
|
|
664
|
+
`VoiceSession.layer` (`@yolk-sdk/agent/voice`) composes a supplied `VoiceTransport` layer,
|
|
665
|
+
`VoiceController`, and an optional `VoiceEventOutbox`. Configured `eventLog` captures events without
|
|
666
|
+
an external stream consumer; omitting it never captures an ambient outbox. The returned event stream
|
|
667
|
+
has one queue consumer and is not a broadcast subscription. Without a consumer, events accumulate
|
|
668
|
+
in memory; hosts should normally drain it. Seeds run during acquisition.
|
|
669
|
+
|
|
670
|
+
Breaking 0.x migration: `makeVoiceController` no longer takes `options.transport`; provide
|
|
671
|
+
`VoiceTransport` with `Effect.provideService`, or use `VoiceSession.layer`.
|
|
672
|
+
`webRtcVoiceTransportLayer` (`voice/browser`) and `webSocketVoiceTransportLayer` (`voice`) acquire
|
|
673
|
+
scoped transports. `Layer.succeed(VoiceTransport, transport)` injects a caller-owned value; it does
|
|
674
|
+
not allocate/finalize it or guarantee fresh resources. Keep the entire usage effect inside a
|
|
675
|
+
provided layer, or use `Layer.buildWithScope` when an explicit session scope owns its lifetime.
|
|
676
|
+
`useYolkVoice` builds each attempt in that attempt's scope and retains stop/unmount cleanup.
|
|
677
|
+
|
|
513
678
|
Voice is a first-class modality: browser WebRTC transport, client controller, server tool
|
|
514
679
|
handler, approval HITL, transcript projection, and one-shot TTS/STT contracts.
|
|
515
680
|
|
|
@@ -535,6 +700,17 @@ handler, approval HITL, transcript projection, and one-shot TTS/STT contracts.
|
|
|
535
700
|
`VoiceSpeechRequest.instructions` steers delivery style only, and
|
|
536
701
|
provider 429s (rate limit or exhausted credits) surface as `VoiceSpeechError` code
|
|
537
702
|
`rate_limited` so hosts can distinguish quota from outage.
|
|
703
|
+
- Browser WebRTC hosts that implement `WebRtcPeerConnectionLike`
|
|
704
|
+
(`@yolk-sdk/agent/voice/browser`) treat `addTrack(track, stream)` as a void command. The
|
|
705
|
+
transport discards the DOM `RTCRtpSender`. Hosts and fakes must not read a sender from this
|
|
706
|
+
capability. Real `RTCPeerConnection.addTrack` remains assignable.
|
|
707
|
+
- `protocolToolCallFromVoice` still returns `ToolCall`. Voice raw argument JSON admits finite
|
|
708
|
+
JSON (`Schema.Json`). Actual `null`, `false`, and `0` still admit as those values. Non-JSON
|
|
709
|
+
and non-finite numbers fail admission: raw text `1e999` projects as the argument string
|
|
710
|
+
`'1e999'`, and `decideVoiceToolCall` approval display params are `{ argumentsJson: '1e999' }`
|
|
711
|
+
(not `Infinity`; do not demonstrate with `JSON.stringify(Infinity)`, which is `null`). Nested
|
|
712
|
+
overflow such as `{"n":1e999}` takes the same mapper-specific fallbacks. Approval identifiers,
|
|
713
|
+
gates, deny, and execution schema validation are unchanged.
|
|
538
714
|
|
|
539
715
|
## Subagents
|
|
540
716
|
|
|
@@ -606,10 +782,12 @@ Without a host, definitions, approval ids, and inline behavior are unchanged.
|
|
|
606
782
|
replays cannot replace accepted calls or receipts, including across turn cleanup and hydration.
|
|
607
783
|
- Activated definitions are unsupported in voice/realtime, including foreground envelope calls.
|
|
608
784
|
Resolve voice toolsets without a background host. Synchronous realtime tool/config mappers throw
|
|
609
|
-
`VoiceToolBridgeError
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
785
|
+
`VoiceToolBridgeError` for unsupported activation **and** for non-JSON tool `parameters`; use
|
|
786
|
+
`toOpenAiRealtimeToolEffect`, `makeOpenAiRealtimeSessionConfigEffect`, or
|
|
787
|
+
`openAiRealtimeSessionConfigFromVoiceEffect` inside Effect programs to catch that typed error.
|
|
788
|
+
Unexpected mapper defects stay defects, not `VoiceToolBridgeError`. Voice handlers deny before
|
|
789
|
+
approval matching, and the low-level bridge rejects activated registry dispatch before validation,
|
|
790
|
+
inline execution, or admission.
|
|
613
791
|
- Raw `ToolRegistration` objects need a side-effect-free `validate` to activate; the loop-owned
|
|
614
792
|
`question` and `subagent` tools cannot activate (subagents keep `makeSubagentAcceptedToolResult`).
|
|
615
793
|
- Manual approval fences the whole batch; activated calls bind the approval `requestId` to the tool
|
|
@@ -627,6 +805,13 @@ data. `makeTool` converts these failures into `ToolResult.isError = true` so the
|
|
|
627
805
|
see the message and continue. The result includes structured content with `type`, `tool`,
|
|
628
806
|
`reason`, `message`, and optional `details` for UI/runtime handling.
|
|
629
807
|
|
|
808
|
+
Optional `makeTool({ invalidParamsMessage })` receives the `Schema.SchemaError` produced by
|
|
809
|
+
`Schema.decodeUnknownEffect` on `parameters` (validate and execute). The decode error is passed
|
|
810
|
+
through unwrapped. Default text is `Invalid ${name} arguments: ${String(error)}`, which keeps the
|
|
811
|
+
`SchemaError(...)` wrapper. In Effect rc.115, `SchemaError` extends native `Error`, but the
|
|
812
|
+
wrapper remains part of this tool-message contract; do not default to `.message`.
|
|
813
|
+
Existing `(error: unknown) => string` callbacks remain assignable.
|
|
814
|
+
|
|
630
815
|
Thrown `ToolError`s become model-visible failed tool results plus `ToolExecutionError` events,
|
|
631
816
|
so keep messages safe and non-secret. Reserve stream failure for provider/runtime defects,
|
|
632
817
|
aborts, and implementation bugs outside typed tool execution.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachments.d.mts","names":[],"sources":["../../src/client/attachments.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"attachments.d.mts","names":[],"sources":["../../src/client/attachments.ts"],"mappings":";;;cAmDa,YAAA,GAAgB,IAAA,EAAM,IAAA,KAAI,MAAA,CAAA,MAAA,SAAA,KAAA;AAAA,cAW1B,wBAAA,GACX,IAAA,EAAM,IAAA,EACN,OAAA;EAAA,SACW,KAAA;AAAA,MACV,MAAA,CAAA,MAAA,oCAAA,YAAA,cAAA,KAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Effect, Result } from "effect";
|
|
1
|
+
import { Effect, Predicate, Result } from "effect";
|
|
2
2
|
import { documentPartFromText, inferTextDocumentMimeType } from "@yolk-sdk/agent/protocol";
|
|
3
3
|
//#region src/client/attachments.ts
|
|
4
4
|
const couldNotReadTextError = () => /* @__PURE__ */ new Error("Could not read text");
|
|
@@ -19,7 +19,7 @@ const textFromFileReaderEffect = (blob) => Effect.callback((resume) => {
|
|
|
19
19
|
};
|
|
20
20
|
const handleLoad = () => {
|
|
21
21
|
removeListeners();
|
|
22
|
-
if (
|
|
22
|
+
if (Predicate.isString(reader.result)) {
|
|
23
23
|
resume(Effect.succeed(reader.result));
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -33,7 +33,7 @@ const textFromFileReaderEffect = (blob) => Effect.callback((resume) => {
|
|
|
33
33
|
return Effect.sync(removeListeners);
|
|
34
34
|
});
|
|
35
35
|
const textFromBlob = (blob) => {
|
|
36
|
-
if (
|
|
36
|
+
if (Predicate.isFunction(blob.text)) return Effect.tryPromise({
|
|
37
37
|
try: () => blob.text(),
|
|
38
38
|
catch: couldNotReadTextError
|
|
39
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachments.mjs","names":[],"sources":["../../src/client/attachments.ts"],"sourcesContent":["import { Effect, Result } from 'effect'\nimport { documentPartFromText, inferTextDocumentMimeType } from '@yolk-sdk/agent/protocol'\n\nconst couldNotReadTextError = () => new Error('Could not read text')\n\nconst textFromFileReaderEffect = (blob: Blob) =>\n Effect.callback<string, Error>(resume => {\n if (typeof FileReader === 'undefined') {\n resume(Effect.fail(couldNotReadTextError()))\n return Effect.void\n }\n\n const reader = new FileReader()\n const removeListeners = () => {\n reader.removeEventListener('load', handleLoad)\n reader.removeEventListener('error', handleError)\n reader.removeEventListener('abort', handleError)\n }\n const fail = () => {\n removeListeners()\n resume(Effect.fail(couldNotReadTextError()))\n }\n const handleLoad = () => {\n removeListeners()\n\n if (
|
|
1
|
+
{"version":3,"file":"attachments.mjs","names":[],"sources":["../../src/client/attachments.ts"],"sourcesContent":["import { Effect, Predicate, Result } from 'effect'\nimport { documentPartFromText, inferTextDocumentMimeType } from '@yolk-sdk/agent/protocol'\n\nconst couldNotReadTextError = () => new Error('Could not read text')\n\nconst textFromFileReaderEffect = (blob: Blob) =>\n Effect.callback<string, Error>(resume => {\n if (typeof FileReader === 'undefined') {\n resume(Effect.fail(couldNotReadTextError()))\n\n return Effect.void\n }\n\n const reader = new FileReader()\n\n const removeListeners = () => {\n reader.removeEventListener('load', handleLoad)\n reader.removeEventListener('error', handleError)\n reader.removeEventListener('abort', handleError)\n }\n\n const fail = () => {\n removeListeners()\n resume(Effect.fail(couldNotReadTextError()))\n }\n\n const handleLoad = () => {\n removeListeners()\n\n if (Predicate.isString(reader.result)) {\n resume(Effect.succeed(reader.result))\n\n return\n }\n\n resume(Effect.fail(couldNotReadTextError()))\n }\n\n const handleError = () => fail()\n\n reader.addEventListener('load', handleLoad)\n reader.addEventListener('error', handleError)\n reader.addEventListener('abort', handleError)\n\n if (Result.isFailure(Result.try(() => reader.readAsText(blob)))) {\n fail()\n }\n\n return Effect.sync(removeListeners)\n })\n\nexport const textFromBlob = (blob: Blob) => {\n if (Predicate.isFunction(blob.text)) {\n return Effect.tryPromise({\n try: () => blob.text(),\n catch: couldNotReadTextError\n })\n }\n\n return textFromFileReaderEffect(blob)\n}\n\nexport const documentPartFromTextFile = (\n file: File,\n options?: {\n readonly title?: string\n }\n) =>\n Effect.gen(function* () {\n const mimeType = inferTextDocumentMimeType({\n filename: file.name,\n mimeType: file.type\n })\n\n if (mimeType === undefined) return undefined\n\n const text = yield* textFromBlob(file)\n\n return documentPartFromText({\n text,\n filename: file.name,\n mimeType,\n title: options?.title\n })\n })\n"],"mappings":";;;AAGA,MAAM,8CAA8B,IAAI,MAAM,qBAAqB;AAEnE,MAAM,4BAA4B,SAChC,OAAO,UAAwB,WAAU;CACvC,IAAI,OAAO,eAAe,aAAa;EACrC,OAAO,OAAO,KAAK,sBAAsB,CAAC,CAAC;EAE3C,OAAO,OAAO;CAChB;CAEA,MAAM,SAAS,IAAI,WAAW;CAE9B,MAAM,wBAAwB;EAC5B,OAAO,oBAAoB,QAAQ,UAAU;EAC7C,OAAO,oBAAoB,SAAS,WAAW;EAC/C,OAAO,oBAAoB,SAAS,WAAW;CACjD;CAEA,MAAM,aAAa;EACjB,gBAAgB;EAChB,OAAO,OAAO,KAAK,sBAAsB,CAAC,CAAC;CAC7C;CAEA,MAAM,mBAAmB;EACvB,gBAAgB;EAEhB,IAAI,UAAU,SAAS,OAAO,MAAM,GAAG;GACrC,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC;GAEpC;EACF;EAEA,OAAO,OAAO,KAAK,sBAAsB,CAAC,CAAC;CAC7C;CAEA,MAAM,oBAAoB,KAAK;CAE/B,OAAO,iBAAiB,QAAQ,UAAU;CAC1C,OAAO,iBAAiB,SAAS,WAAW;CAC5C,OAAO,iBAAiB,SAAS,WAAW;CAE5C,IAAI,OAAO,UAAU,OAAO,UAAU,OAAO,WAAW,IAAI,CAAC,CAAC,GAC5D,KAAK;CAGP,OAAO,OAAO,KAAK,eAAe;AACpC,CAAC;AAEH,MAAa,gBAAgB,SAAe;CAC1C,IAAI,UAAU,WAAW,KAAK,IAAI,GAChC,OAAO,OAAO,WAAW;EACvB,WAAW,KAAK,KAAK;EACrB,OAAO;CACT,CAAC;CAGH,OAAO,yBAAyB,IAAI;AACtC;AAEA,MAAa,4BACX,MACA,YAIA,OAAO,IAAI,aAAa;CACtB,MAAM,WAAW,0BAA0B;EACzC,UAAU,KAAK;EACf,UAAU,KAAK;CACjB,CAAC;CAED,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CAInC,OAAO,qBAAqB;EAC1B,MAAA,OAHkB,aAAa,IAAI;EAInC,UAAU,KAAK;EACf;EACA,OAAO,SAAS;CAClB,CAAC;AACH,CAAC"}
|
package/dist/client/state.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
1
2
|
import { AgentError, AgentEvent, AgentMessage, AgentRetry, HitlRequest, QuestionRequest, QuestionResponse, ToolApprovalRequest, ToolCall, ToolResult, UserMessage } from "@yolk-sdk/agent/protocol";
|
|
2
3
|
|
|
3
4
|
//#region src/client/state.d.ts
|
|
@@ -55,6 +56,283 @@ type AgentToolRun = {
|
|
|
55
56
|
readonly call: ToolCall;
|
|
56
57
|
readonly result: ToolResult;
|
|
57
58
|
};
|
|
59
|
+
declare const AgentToolRun: {
|
|
60
|
+
readonly InputStreaming: Data.TaggedEnum.ConstructorFrom<{
|
|
61
|
+
readonly _tag: "InputStreaming";
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly name?: string;
|
|
64
|
+
readonly input: string;
|
|
65
|
+
}, "_tag">;
|
|
66
|
+
readonly InputReady: Data.TaggedEnum.ConstructorFrom<{
|
|
67
|
+
readonly _tag: "InputReady";
|
|
68
|
+
readonly call: ToolCall;
|
|
69
|
+
}, "_tag">;
|
|
70
|
+
readonly ApprovalRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
71
|
+
readonly _tag: "ApprovalRequested";
|
|
72
|
+
readonly call: ToolCall;
|
|
73
|
+
readonly request?: ToolApprovalRequest;
|
|
74
|
+
}, "_tag">;
|
|
75
|
+
readonly Denied: Data.TaggedEnum.ConstructorFrom<{
|
|
76
|
+
readonly _tag: "Denied";
|
|
77
|
+
readonly toolCallId: string;
|
|
78
|
+
readonly reason: string;
|
|
79
|
+
}, "_tag">;
|
|
80
|
+
readonly QuestionRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
81
|
+
readonly _tag: "QuestionRequested";
|
|
82
|
+
readonly request: QuestionRequest;
|
|
83
|
+
}, "_tag">;
|
|
84
|
+
readonly QuestionAnswered: Data.TaggedEnum.ConstructorFrom<{
|
|
85
|
+
readonly _tag: "QuestionAnswered";
|
|
86
|
+
readonly response: QuestionResponse;
|
|
87
|
+
readonly request?: QuestionRequest;
|
|
88
|
+
}, "_tag">;
|
|
89
|
+
readonly QuestionCancelled: Data.TaggedEnum.ConstructorFrom<{
|
|
90
|
+
readonly _tag: "QuestionCancelled";
|
|
91
|
+
readonly response: QuestionResponse;
|
|
92
|
+
readonly request?: QuestionRequest;
|
|
93
|
+
}, "_tag">;
|
|
94
|
+
readonly Executing: Data.TaggedEnum.ConstructorFrom<{
|
|
95
|
+
readonly _tag: "Executing";
|
|
96
|
+
readonly call: ToolCall;
|
|
97
|
+
readonly startedAtMs: number;
|
|
98
|
+
}, "_tag">;
|
|
99
|
+
readonly Completed: Data.TaggedEnum.ConstructorFrom<{
|
|
100
|
+
readonly _tag: "Completed";
|
|
101
|
+
readonly call: ToolCall;
|
|
102
|
+
readonly result: ToolResult;
|
|
103
|
+
readonly startedAtMs: number;
|
|
104
|
+
readonly endedAtMs: number;
|
|
105
|
+
}, "_tag">;
|
|
106
|
+
readonly Accepted: Data.TaggedEnum.ConstructorFrom<{
|
|
107
|
+
readonly _tag: "Accepted";
|
|
108
|
+
readonly call: ToolCall;
|
|
109
|
+
readonly result: ToolResult;
|
|
110
|
+
readonly startedAtMs: number;
|
|
111
|
+
readonly endedAtMs: number;
|
|
112
|
+
}, "_tag">;
|
|
113
|
+
readonly Errored: Data.TaggedEnum.ConstructorFrom<{
|
|
114
|
+
readonly _tag: "Errored";
|
|
115
|
+
readonly call: ToolCall;
|
|
116
|
+
readonly message: string;
|
|
117
|
+
readonly endedAtMs: number;
|
|
118
|
+
}, "_tag">;
|
|
119
|
+
readonly ProviderCompleted: Data.TaggedEnum.ConstructorFrom<{
|
|
120
|
+
readonly _tag: "ProviderCompleted";
|
|
121
|
+
readonly call: ToolCall;
|
|
122
|
+
readonly result: ToolResult;
|
|
123
|
+
}, "_tag">;
|
|
124
|
+
readonly $is: <Tag extends "InputStreaming" | "InputReady" | "ApprovalRequested" | "Denied" | "QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "Executing" | "Completed" | "Accepted" | "Errored" | "ProviderCompleted">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
125
|
+
readonly _tag: "InputStreaming";
|
|
126
|
+
readonly id: string;
|
|
127
|
+
readonly name?: string;
|
|
128
|
+
readonly input: string;
|
|
129
|
+
}, {
|
|
130
|
+
readonly _tag: Tag;
|
|
131
|
+
}> | Extract<{
|
|
132
|
+
readonly _tag: "InputReady";
|
|
133
|
+
readonly call: ToolCall;
|
|
134
|
+
}, {
|
|
135
|
+
readonly _tag: Tag;
|
|
136
|
+
}> | Extract<{
|
|
137
|
+
readonly _tag: "ApprovalRequested";
|
|
138
|
+
readonly call: ToolCall;
|
|
139
|
+
readonly request?: ToolApprovalRequest;
|
|
140
|
+
}, {
|
|
141
|
+
readonly _tag: Tag;
|
|
142
|
+
}> | Extract<{
|
|
143
|
+
readonly _tag: "Denied";
|
|
144
|
+
readonly toolCallId: string;
|
|
145
|
+
readonly reason: string;
|
|
146
|
+
}, {
|
|
147
|
+
readonly _tag: Tag;
|
|
148
|
+
}> | Extract<{
|
|
149
|
+
readonly _tag: "QuestionRequested";
|
|
150
|
+
readonly request: QuestionRequest;
|
|
151
|
+
}, {
|
|
152
|
+
readonly _tag: Tag;
|
|
153
|
+
}> | Extract<{
|
|
154
|
+
readonly _tag: "QuestionAnswered";
|
|
155
|
+
readonly response: QuestionResponse;
|
|
156
|
+
readonly request?: QuestionRequest;
|
|
157
|
+
}, {
|
|
158
|
+
readonly _tag: Tag;
|
|
159
|
+
}> | Extract<{
|
|
160
|
+
readonly _tag: "QuestionCancelled";
|
|
161
|
+
readonly response: QuestionResponse;
|
|
162
|
+
readonly request?: QuestionRequest;
|
|
163
|
+
}, {
|
|
164
|
+
readonly _tag: Tag;
|
|
165
|
+
}> | Extract<{
|
|
166
|
+
readonly _tag: "Executing";
|
|
167
|
+
readonly call: ToolCall;
|
|
168
|
+
readonly startedAtMs: number;
|
|
169
|
+
}, {
|
|
170
|
+
readonly _tag: Tag;
|
|
171
|
+
}> | Extract<{
|
|
172
|
+
readonly _tag: "Completed";
|
|
173
|
+
readonly call: ToolCall;
|
|
174
|
+
readonly result: ToolResult;
|
|
175
|
+
readonly startedAtMs: number;
|
|
176
|
+
readonly endedAtMs: number;
|
|
177
|
+
}, {
|
|
178
|
+
readonly _tag: Tag;
|
|
179
|
+
}> | Extract<{
|
|
180
|
+
readonly _tag: "Accepted";
|
|
181
|
+
readonly call: ToolCall;
|
|
182
|
+
readonly result: ToolResult;
|
|
183
|
+
readonly startedAtMs: number;
|
|
184
|
+
readonly endedAtMs: number;
|
|
185
|
+
}, {
|
|
186
|
+
readonly _tag: Tag;
|
|
187
|
+
}> | Extract<{
|
|
188
|
+
readonly _tag: "Errored";
|
|
189
|
+
readonly call: ToolCall;
|
|
190
|
+
readonly message: string;
|
|
191
|
+
readonly endedAtMs: number;
|
|
192
|
+
}, {
|
|
193
|
+
readonly _tag: Tag;
|
|
194
|
+
}> | Extract<{
|
|
195
|
+
readonly _tag: "ProviderCompleted";
|
|
196
|
+
readonly call: ToolCall;
|
|
197
|
+
readonly result: ToolResult;
|
|
198
|
+
}, {
|
|
199
|
+
readonly _tag: Tag;
|
|
200
|
+
}>;
|
|
201
|
+
readonly $match: {
|
|
202
|
+
<Cases extends {
|
|
203
|
+
readonly InputStreaming: (args: {
|
|
204
|
+
readonly _tag: "InputStreaming";
|
|
205
|
+
readonly id: string;
|
|
206
|
+
readonly name?: string;
|
|
207
|
+
readonly input: string;
|
|
208
|
+
}) => any;
|
|
209
|
+
readonly InputReady: (args: {
|
|
210
|
+
readonly _tag: "InputReady";
|
|
211
|
+
readonly call: ToolCall;
|
|
212
|
+
}) => any;
|
|
213
|
+
readonly ApprovalRequested: (args: {
|
|
214
|
+
readonly _tag: "ApprovalRequested";
|
|
215
|
+
readonly call: ToolCall;
|
|
216
|
+
readonly request?: ToolApprovalRequest;
|
|
217
|
+
}) => any;
|
|
218
|
+
readonly Denied: (args: {
|
|
219
|
+
readonly _tag: "Denied";
|
|
220
|
+
readonly toolCallId: string;
|
|
221
|
+
readonly reason: string;
|
|
222
|
+
}) => any;
|
|
223
|
+
readonly QuestionRequested: (args: {
|
|
224
|
+
readonly _tag: "QuestionRequested";
|
|
225
|
+
readonly request: QuestionRequest;
|
|
226
|
+
}) => any;
|
|
227
|
+
readonly QuestionAnswered: (args: {
|
|
228
|
+
readonly _tag: "QuestionAnswered";
|
|
229
|
+
readonly response: QuestionResponse;
|
|
230
|
+
readonly request?: QuestionRequest;
|
|
231
|
+
}) => any;
|
|
232
|
+
readonly QuestionCancelled: (args: {
|
|
233
|
+
readonly _tag: "QuestionCancelled";
|
|
234
|
+
readonly response: QuestionResponse;
|
|
235
|
+
readonly request?: QuestionRequest;
|
|
236
|
+
}) => any;
|
|
237
|
+
readonly Executing: (args: {
|
|
238
|
+
readonly _tag: "Executing";
|
|
239
|
+
readonly call: ToolCall;
|
|
240
|
+
readonly startedAtMs: number;
|
|
241
|
+
}) => any;
|
|
242
|
+
readonly Completed: (args: {
|
|
243
|
+
readonly _tag: "Completed";
|
|
244
|
+
readonly call: ToolCall;
|
|
245
|
+
readonly result: ToolResult;
|
|
246
|
+
readonly startedAtMs: number;
|
|
247
|
+
readonly endedAtMs: number;
|
|
248
|
+
}) => any;
|
|
249
|
+
readonly Accepted: (args: {
|
|
250
|
+
readonly _tag: "Accepted";
|
|
251
|
+
readonly call: ToolCall;
|
|
252
|
+
readonly result: ToolResult;
|
|
253
|
+
readonly startedAtMs: number;
|
|
254
|
+
readonly endedAtMs: number;
|
|
255
|
+
}) => any;
|
|
256
|
+
readonly Errored: (args: {
|
|
257
|
+
readonly _tag: "Errored";
|
|
258
|
+
readonly call: ToolCall;
|
|
259
|
+
readonly message: string;
|
|
260
|
+
readonly endedAtMs: number;
|
|
261
|
+
}) => any;
|
|
262
|
+
readonly ProviderCompleted: (args: {
|
|
263
|
+
readonly _tag: "ProviderCompleted";
|
|
264
|
+
readonly call: ToolCall;
|
|
265
|
+
readonly result: ToolResult;
|
|
266
|
+
}) => any;
|
|
267
|
+
}>(cases: Cases): (value: AgentToolRun) => import("effect/Unify").Unify<ReturnType<Cases["InputStreaming" | "InputReady" | "ApprovalRequested" | "Denied" | "QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "Executing" | "Completed" | "Accepted" | "Errored" | "ProviderCompleted"]>>;
|
|
268
|
+
<Cases extends {
|
|
269
|
+
readonly InputStreaming: (args: {
|
|
270
|
+
readonly _tag: "InputStreaming";
|
|
271
|
+
readonly id: string;
|
|
272
|
+
readonly name?: string;
|
|
273
|
+
readonly input: string;
|
|
274
|
+
}) => any;
|
|
275
|
+
readonly InputReady: (args: {
|
|
276
|
+
readonly _tag: "InputReady";
|
|
277
|
+
readonly call: ToolCall;
|
|
278
|
+
}) => any;
|
|
279
|
+
readonly ApprovalRequested: (args: {
|
|
280
|
+
readonly _tag: "ApprovalRequested";
|
|
281
|
+
readonly call: ToolCall;
|
|
282
|
+
readonly request?: ToolApprovalRequest;
|
|
283
|
+
}) => any;
|
|
284
|
+
readonly Denied: (args: {
|
|
285
|
+
readonly _tag: "Denied";
|
|
286
|
+
readonly toolCallId: string;
|
|
287
|
+
readonly reason: string;
|
|
288
|
+
}) => any;
|
|
289
|
+
readonly QuestionRequested: (args: {
|
|
290
|
+
readonly _tag: "QuestionRequested";
|
|
291
|
+
readonly request: QuestionRequest;
|
|
292
|
+
}) => any;
|
|
293
|
+
readonly QuestionAnswered: (args: {
|
|
294
|
+
readonly _tag: "QuestionAnswered";
|
|
295
|
+
readonly response: QuestionResponse;
|
|
296
|
+
readonly request?: QuestionRequest;
|
|
297
|
+
}) => any;
|
|
298
|
+
readonly QuestionCancelled: (args: {
|
|
299
|
+
readonly _tag: "QuestionCancelled";
|
|
300
|
+
readonly response: QuestionResponse;
|
|
301
|
+
readonly request?: QuestionRequest;
|
|
302
|
+
}) => any;
|
|
303
|
+
readonly Executing: (args: {
|
|
304
|
+
readonly _tag: "Executing";
|
|
305
|
+
readonly call: ToolCall;
|
|
306
|
+
readonly startedAtMs: number;
|
|
307
|
+
}) => any;
|
|
308
|
+
readonly Completed: (args: {
|
|
309
|
+
readonly _tag: "Completed";
|
|
310
|
+
readonly call: ToolCall;
|
|
311
|
+
readonly result: ToolResult;
|
|
312
|
+
readonly startedAtMs: number;
|
|
313
|
+
readonly endedAtMs: number;
|
|
314
|
+
}) => any;
|
|
315
|
+
readonly Accepted: (args: {
|
|
316
|
+
readonly _tag: "Accepted";
|
|
317
|
+
readonly call: ToolCall;
|
|
318
|
+
readonly result: ToolResult;
|
|
319
|
+
readonly startedAtMs: number;
|
|
320
|
+
readonly endedAtMs: number;
|
|
321
|
+
}) => any;
|
|
322
|
+
readonly Errored: (args: {
|
|
323
|
+
readonly _tag: "Errored";
|
|
324
|
+
readonly call: ToolCall;
|
|
325
|
+
readonly message: string;
|
|
326
|
+
readonly endedAtMs: number;
|
|
327
|
+
}) => any;
|
|
328
|
+
readonly ProviderCompleted: (args: {
|
|
329
|
+
readonly _tag: "ProviderCompleted";
|
|
330
|
+
readonly call: ToolCall;
|
|
331
|
+
readonly result: ToolResult;
|
|
332
|
+
}) => any;
|
|
333
|
+
}>(value: AgentToolRun, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["InputStreaming" | "InputReady" | "ApprovalRequested" | "Denied" | "QuestionRequested" | "QuestionAnswered" | "QuestionCancelled" | "Executing" | "Completed" | "Accepted" | "Errored" | "ProviderCompleted"]>>;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
58
336
|
type AgentClientState = {
|
|
59
337
|
readonly status: AgentRunStatus;
|
|
60
338
|
readonly messages: ReadonlyArray<AgentMessage>;
|