summaryrefslogtreecommitdiffhomepage
path: root/lib/dispatch/adapter/interface/message.rb
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-04-29 21:40:58 +0900
committerAdam Malczewski <[email protected]>2026-04-29 21:40:58 +0900
commit27af03cb3540539f065334c199fdb42c48776fc5 (patch)
tree9dcaecc59f4383d88933519b5b049793e772427b /lib/dispatch/adapter/interface/message.rb
parent07277435c0688ad9f5fa682633b86b99ef5bb854 (diff)
downloaddispatch-adapter-interface-27af03cb3540539f065334c199fdb42c48776fc5.tar.gz
dispatch-adapter-interface-27af03cb3540539f065334c199fdb42c48776fc5.zip
update to support claude
Diffstat (limited to 'lib/dispatch/adapter/interface/message.rb')
-rw-r--r--lib/dispatch/adapter/interface/message.rb23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/dispatch/adapter/interface/message.rb b/lib/dispatch/adapter/interface/message.rb
index eb51c99..dfe7301 100644
--- a/lib/dispatch/adapter/interface/message.rb
+++ b/lib/dispatch/adapter/interface/message.rb
@@ -4,9 +4,14 @@ module Dispatch
module Adapter
Message = Struct.new(:role, :content, keyword_init: true)
- TextBlock = Struct.new(:type, :text, keyword_init: true) do
- def initialize(text:, type: "text")
- super(type:, text:)
+ # +cache_control+ values:
+ # nil — no cache breakpoint (default)
+ # { type: :ephemeral } — provider default TTL
+ # { type: :ephemeral, ttl: :"5m" } — short-lived cache
+ # { type: :ephemeral, ttl: :"1h" } — long-lived cache
+ TextBlock = Struct.new(:type, :text, :cache_control, keyword_init: true) do
+ def initialize(text:, cache_control: nil, type: "text")
+ super(type:, text:, cache_control:)
end
end
@@ -27,5 +32,17 @@ module Dispatch
super(type:, tool_use_id:, content:, is_error:)
end
end
+
+ ThinkingBlock = Struct.new(:type, :thinking, :signature, keyword_init: true) do
+ def initialize(thinking:, signature: nil, type: "thinking")
+ super(type:, thinking:, signature:)
+ end
+ end
+
+ RedactedThinkingBlock = Struct.new(:type, :data, keyword_init: true) do
+ def initialize(data:, type: "redacted_thinking")
+ super(type:, data:)
+ end
+ end
end
end