cadenya 0.28.0 → 0.29.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf555cd84ae5279087a5b60695fec05f03451abbb21cc910c5e85cb1ed52c56e
4
- data.tar.gz: b7662e178b9f76f9e044bdff89f57bb78a75fd58ef92c9f7ac4c75ed45aef3a6
3
+ metadata.gz: d00d248c33699a4a01039ddd4d6123e9648ff8bc367c20a8e65e4885851cb60e
4
+ data.tar.gz: 81189360913ae6f04eb92b83ffdad219dade81eeb6eccb400318d39e89bc8e47
5
5
  SHA512:
6
- metadata.gz: eb71eb5d8238a2f9d63ceadf1ebd77230fbed22f146eada9da0abeb2b578128646b6bbe3feaaf4cc179d5e894cd9c94ab96f413cbf63cbf72ebe94e1b6d42c66
7
- data.tar.gz: 4bb21c37969a3c091aa854523f4e45e323ad513f299b384978befb9d975ad442b0ad24c0c064ae1ff41ec9b1cb781c92ce1bd744531504707ec912e79a4f800c
6
+ metadata.gz: c276b5b5f6499525a452490dc7df6de4ffd9109a666aa712dbcbc201420a9de9ef0cfbffae86174836e055bc31272a72303de43aa6c0ceb4c1de9123f4531ab3
7
+ data.tar.gz: c2f2abd24fa38008337bda2931e8c27e9e39ca1412a9a523ae3d678766e62f58a855de3373a533e4c9733b327ae40286764161dd2e7ef823cf65fa99cc7b820f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.29.0 (2026-07-05)
4
+
5
+ Full Changelog: [v0.28.0...v0.29.0](https://github.com/cadenya/cadenya-ruby/compare/v0.28.0...v0.29.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([e14c0d7](https://github.com/cadenya/cadenya-ruby/commit/e14c0d7509075b97bf655215eb5f266e8903b3a6))
10
+
3
11
  ## 0.28.0 (2026-07-04)
4
12
 
5
13
  Full Changelog: [v0.27.0...v0.28.0](https://github.com/cadenya/cadenya-ruby/compare/v0.27.0...v0.28.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "cadenya", "~> 0.28.0"
20
+ gem "cadenya", "~> 0.29.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ContextLengths < Cadenya::Internal::Type::BaseModel
6
+ response_only do
7
+ # @!attribute assistant_messages
8
+ # Chat history messages with the assistant role.
9
+ #
10
+ # @return [Integer]
11
+ required :assistant_messages, Integer, api_name: :assistantMessages
12
+
13
+ # @!attribute available_tools
14
+ # The discoverable/available-tools appendix attached to the system prompt.
15
+ #
16
+ # @return [Integer]
17
+ required :available_tools, Integer, api_name: :availableTools
18
+
19
+ # @!attribute episodic_memory
20
+ # The episodic memory appendix attached to the system prompt.
21
+ #
22
+ # @return [Integer]
23
+ required :episodic_memory, Integer, api_name: :episodicMemory
24
+
25
+ # @!attribute skills_memory
26
+ # The skills memory appendix attached to the system prompt.
27
+ #
28
+ # @return [Integer]
29
+ required :skills_memory, Integer, api_name: :skillsMemory
30
+
31
+ # @!attribute system_prompt
32
+ # The objective's base system prompt (rendered variation template).
33
+ #
34
+ # @return [Integer]
35
+ required :system_prompt, Integer, api_name: :systemPrompt
36
+
37
+ # @!attribute tool_definitions
38
+ # Serialized tool definitions sent with the completion request (names,
39
+ # descriptions, and JSON-schema parameters).
40
+ #
41
+ # @return [Integer]
42
+ required :tool_definitions, Integer, api_name: :toolDefinitions
43
+
44
+ # @!attribute tool_results
45
+ # Tool results present in the chat history.
46
+ #
47
+ # @return [Integer]
48
+ required :tool_results, Integer, api_name: :toolResults
49
+
50
+ # @!attribute user_messages
51
+ # Chat history messages with the user role.
52
+ #
53
+ # @return [Integer]
54
+ required :user_messages, Integer, api_name: :userMessages
55
+ end
56
+
57
+ # @!method initialize(assistant_messages:, available_tools:, episodic_memory:, skills_memory:, system_prompt:, tool_definitions:, tool_results:, user_messages:)
58
+ # Some parameter documentations has been truncated, see
59
+ # {Cadenya::Models::ContextLengths} for more details.
60
+ #
61
+ # ContextLengths is the measured character length of each distinct component of an
62
+ # iteration's assembled context window. Values are raw character lengths of the
63
+ # component as assembled into the request — token estimates are derived by the
64
+ # client against input_tokens (component share = component length / sum of all
65
+ # lengths).
66
+ #
67
+ # New components are added as new fields — wire-compatible; absent components read
68
+ # as 0.
69
+ #
70
+ # @param assistant_messages [Integer] Chat history messages with the assistant role.
71
+ #
72
+ # @param available_tools [Integer] The discoverable/available-tools appendix attached to the system prompt.
73
+ #
74
+ # @param episodic_memory [Integer] The episodic memory appendix attached to the system prompt.
75
+ #
76
+ # @param skills_memory [Integer] The skills memory appendix attached to the system prompt.
77
+ #
78
+ # @param system_prompt [Integer] The objective's base system prompt (rendered variation template).
79
+ #
80
+ # @param tool_definitions [Integer] Serialized tool definitions sent with the completion request
81
+ #
82
+ # @param tool_results [Integer] Tool results present in the chat history.
83
+ #
84
+ # @param user_messages [Integer] Chat history messages with the user role.
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ObjectiveDiagnostics < Cadenya::Internal::Type::BaseModel
6
+ response_only do
7
+ # @!attribute cached_input_tokens
8
+ # The portion of input_tokens served from the provider's prompt cache. Lets
9
+ # clients distinguish "big but cached" from "big and paid fresh every iteration".
10
+ #
11
+ # @return [Integer]
12
+ required :cached_input_tokens, Integer, api_name: :cachedInputTokens
13
+
14
+ # @!attribute context_lengths
15
+ # ContextLengths is the measured character length of each distinct component of an
16
+ # iteration's assembled context window. Values are raw character lengths of the
17
+ # component as assembled into the request — token estimates are derived by the
18
+ # client against input_tokens (component share = component length / sum of all
19
+ # lengths).
20
+ #
21
+ # New components are added as new fields — wire-compatible; absent components read
22
+ # as 0.
23
+ #
24
+ # @return [Cadenya::Models::ContextLengths]
25
+ required :context_lengths, -> { Cadenya::ContextLengths }, api_name: :contextLengths
26
+
27
+ # @!attribute input_tokens
28
+ # Input tokens reported by the LLM provider for the iteration's completion.
29
+ #
30
+ # @return [Integer]
31
+ required :input_tokens, Integer, api_name: :inputTokens
32
+ end
33
+
34
+ # @!method initialize(cached_input_tokens:, context_lengths:, input_tokens:)
35
+ # Some parameter documentations has been truncated, see
36
+ # {Cadenya::Models::ObjectiveDiagnostics} for more details.
37
+ #
38
+ # ObjectiveDiagnostics is the context-usage breakdown measured for a single
39
+ # iteration at request-assembly time. It reports how much of the context window
40
+ # each component occupies so tool parameters, memory cascades, and prompts can be
41
+ # tuned against real token usage.
42
+ #
43
+ # @param cached_input_tokens [Integer] The portion of input_tokens served from the provider's prompt cache.
44
+ #
45
+ # @param context_lengths [Cadenya::Models::ContextLengths] ContextLengths is the measured character length of each distinct component
46
+ #
47
+ # @param input_tokens [Integer] Input tokens reported by the LLM provider for the iteration's completion.
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Models
5
+ # @see Cadenya::Resources::Objectives#retrieve_diagnostics
6
+ class ObjectiveRetrieveDiagnosticsParams < Cadenya::Internal::Type::BaseModel
7
+ extend Cadenya::Internal::Type::RequestParameters::Converter
8
+ include Cadenya::Internal::Type::RequestParameters
9
+
10
+ # @!attribute workspace_id
11
+ #
12
+ # @return [String]
13
+ required :workspace_id, String
14
+
15
+ # @!attribute objective_id
16
+ #
17
+ # @return [String]
18
+ required :objective_id, String
19
+
20
+ # @!method initialize(workspace_id:, objective_id:, request_options: {})
21
+ # @param workspace_id [String]
22
+ # @param objective_id [String]
23
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}]
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Models
5
+ # @see Cadenya::Resources::Objectives#retrieve_diagnostics
6
+ class ObjectiveRetrieveDiagnosticsResponse < Cadenya::Internal::Type::BaseModel
7
+ response_only do
8
+ # @!attribute diagnostics
9
+ # ObjectiveDiagnostics is the context-usage breakdown measured for a single
10
+ # iteration at request-assembly time. It reports how much of the context window
11
+ # each component occupies so tool parameters, memory cascades, and prompts can be
12
+ # tuned against real token usage.
13
+ #
14
+ # @return [Cadenya::Models::ObjectiveDiagnostics]
15
+ required :diagnostics, -> { Cadenya::ObjectiveDiagnostics }
16
+ end
17
+
18
+ # @!method initialize(diagnostics:)
19
+ # Some parameter documentations has been truncated, see
20
+ # {Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse} for more details.
21
+ #
22
+ # @param diagnostics [Cadenya::Models::ObjectiveDiagnostics] ObjectiveDiagnostics is the context-usage breakdown measured for a single
23
+ end
24
+ end
25
+ end
@@ -125,6 +125,8 @@ module Cadenya
125
125
 
126
126
  CallableTool = Cadenya::Models::CallableTool
127
127
 
128
+ ContextLengths = Cadenya::Models::ContextLengths
129
+
128
130
  ContextWindowCompacted = Cadenya::Models::ContextWindowCompacted
129
131
 
130
132
  CreateOperationMetadata = Cadenya::Models::CreateOperationMetadata
@@ -183,6 +185,8 @@ module Cadenya
183
185
 
184
186
  ObjectiveCreateParams = Cadenya::Models::ObjectiveCreateParams
185
187
 
188
+ ObjectiveDiagnostics = Cadenya::Models::ObjectiveDiagnostics
189
+
186
190
  ObjectiveError = Cadenya::Models::ObjectiveError
187
191
 
188
192
  ObjectiveEvent = Cadenya::Models::ObjectiveEvent
@@ -201,6 +205,8 @@ module Cadenya
201
205
 
202
206
  ObjectiveListParams = Cadenya::Models::ObjectiveListParams
203
207
 
208
+ ObjectiveRetrieveDiagnosticsParams = Cadenya::Models::ObjectiveRetrieveDiagnosticsParams
209
+
204
210
  ObjectiveRetrieveParams = Cadenya::Models::ObjectiveRetrieveParams
205
211
 
206
212
  Objectives = Cadenya::Models::Objectives
@@ -322,6 +322,36 @@ module Cadenya
322
322
  )
323
323
  end
324
324
 
325
+ # Returns the context-usage breakdown measured for the objective's most recent
326
+ # iteration: character lengths per context component (system prompt, memory
327
+ # appendices, tool definitions, messages by role) alongside the iteration's input
328
+ # token counts.
329
+ #
330
+ # @overload retrieve_diagnostics(objective_id, workspace_id:, request_options: {})
331
+ #
332
+ # @param objective_id [String] The ID of the objective. Supports "external_id:" prefix for external IDs.
333
+ #
334
+ # @param workspace_id [String]
335
+ #
336
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
337
+ #
338
+ # @return [Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse]
339
+ #
340
+ # @see Cadenya::Models::ObjectiveRetrieveDiagnosticsParams
341
+ def retrieve_diagnostics(objective_id, params)
342
+ parsed, options = Cadenya::ObjectiveRetrieveDiagnosticsParams.dump_request(params)
343
+ workspace_id =
344
+ parsed.delete(:workspace_id) do
345
+ raise ArgumentError.new("missing required path argument #{_1}")
346
+ end
347
+ @client.request(
348
+ method: :get,
349
+ path: ["v1/workspaces/%1$s/objectives/%2$s/diagnostics", workspace_id, objective_id],
350
+ model: Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse,
351
+ options: options
352
+ )
353
+ end
354
+
325
355
  # Streams events for an objective in real-time using server-sent events (SSE)
326
356
  #
327
357
  # @overload stream_events_streaming(objective_id, workspace_id:, request_options: {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cadenya
4
- VERSION = "0.28.0"
4
+ VERSION = "0.29.0"
5
5
  end
data/lib/cadenya.rb CHANGED
@@ -140,6 +140,7 @@ require_relative "cadenya/models/assistant_tool_call"
140
140
  require_relative "cadenya/models/attribute_filter"
141
141
  require_relative "cadenya/models/bare_metadata"
142
142
  require_relative "cadenya/models/callable_tool"
143
+ require_relative "cadenya/models/context_lengths"
143
144
  require_relative "cadenya/models/context_window_compacted"
144
145
  require_relative "cadenya/models/create_operation_metadata"
145
146
  require_relative "cadenya/models/create_resource_metadata"
@@ -181,6 +182,7 @@ require_relative "cadenya/models/objective_context_window"
181
182
  require_relative "cadenya/models/objective_context_window_data"
182
183
  require_relative "cadenya/models/objective_continue_params"
183
184
  require_relative "cadenya/models/objective_create_params"
185
+ require_relative "cadenya/models/objective_diagnostics"
184
186
  require_relative "cadenya/models/objective_error"
185
187
  require_relative "cadenya/models/objective_event"
186
188
  require_relative "cadenya/models/objective_event_data"
@@ -190,6 +192,8 @@ require_relative "cadenya/models/objective_info"
190
192
  require_relative "cadenya/models/objective_list_context_windows_params"
191
193
  require_relative "cadenya/models/objective_list_events_params"
192
194
  require_relative "cadenya/models/objective_list_params"
195
+ require_relative "cadenya/models/objective_retrieve_diagnostics_params"
196
+ require_relative "cadenya/models/objective_retrieve_diagnostics_response"
193
197
  require_relative "cadenya/models/objective_retrieve_params"
194
198
  require_relative "cadenya/models/objectives/feedback_create_params"
195
199
  require_relative "cadenya/models/objectives/feedback_list_params"
@@ -0,0 +1,103 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ContextLengths < Cadenya::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Cadenya::ContextLengths, Cadenya::Internal::AnyHash)
9
+ end
10
+
11
+ # Chat history messages with the assistant role.
12
+ sig { returns(Integer) }
13
+ attr_accessor :assistant_messages
14
+
15
+ # The discoverable/available-tools appendix attached to the system prompt.
16
+ sig { returns(Integer) }
17
+ attr_accessor :available_tools
18
+
19
+ # The episodic memory appendix attached to the system prompt.
20
+ sig { returns(Integer) }
21
+ attr_accessor :episodic_memory
22
+
23
+ # The skills memory appendix attached to the system prompt.
24
+ sig { returns(Integer) }
25
+ attr_accessor :skills_memory
26
+
27
+ # The objective's base system prompt (rendered variation template).
28
+ sig { returns(Integer) }
29
+ attr_accessor :system_prompt
30
+
31
+ # Serialized tool definitions sent with the completion request (names,
32
+ # descriptions, and JSON-schema parameters).
33
+ sig { returns(Integer) }
34
+ attr_accessor :tool_definitions
35
+
36
+ # Tool results present in the chat history.
37
+ sig { returns(Integer) }
38
+ attr_accessor :tool_results
39
+
40
+ # Chat history messages with the user role.
41
+ sig { returns(Integer) }
42
+ attr_accessor :user_messages
43
+
44
+ # ContextLengths is the measured character length of each distinct component of an
45
+ # iteration's assembled context window. Values are raw character lengths of the
46
+ # component as assembled into the request — token estimates are derived by the
47
+ # client against input_tokens (component share = component length / sum of all
48
+ # lengths).
49
+ #
50
+ # New components are added as new fields — wire-compatible; absent components read
51
+ # as 0.
52
+ sig do
53
+ params(
54
+ assistant_messages: Integer,
55
+ available_tools: Integer,
56
+ episodic_memory: Integer,
57
+ skills_memory: Integer,
58
+ system_prompt: Integer,
59
+ tool_definitions: Integer,
60
+ tool_results: Integer,
61
+ user_messages: Integer
62
+ ).returns(T.attached_class)
63
+ end
64
+ def self.new(
65
+ # Chat history messages with the assistant role.
66
+ assistant_messages:,
67
+ # The discoverable/available-tools appendix attached to the system prompt.
68
+ available_tools:,
69
+ # The episodic memory appendix attached to the system prompt.
70
+ episodic_memory:,
71
+ # The skills memory appendix attached to the system prompt.
72
+ skills_memory:,
73
+ # The objective's base system prompt (rendered variation template).
74
+ system_prompt:,
75
+ # Serialized tool definitions sent with the completion request (names,
76
+ # descriptions, and JSON-schema parameters).
77
+ tool_definitions:,
78
+ # Tool results present in the chat history.
79
+ tool_results:,
80
+ # Chat history messages with the user role.
81
+ user_messages:
82
+ )
83
+ end
84
+
85
+ sig do
86
+ override.returns(
87
+ {
88
+ assistant_messages: Integer,
89
+ available_tools: Integer,
90
+ episodic_memory: Integer,
91
+ skills_memory: Integer,
92
+ system_prompt: Integer,
93
+ tool_definitions: Integer,
94
+ tool_results: Integer,
95
+ user_messages: Integer
96
+ }
97
+ )
98
+ end
99
+ def to_hash
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,76 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ObjectiveDiagnostics < Cadenya::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Cadenya::ObjectiveDiagnostics, Cadenya::Internal::AnyHash)
9
+ end
10
+
11
+ # The portion of input_tokens served from the provider's prompt cache. Lets
12
+ # clients distinguish "big but cached" from "big and paid fresh every iteration".
13
+ sig { returns(Integer) }
14
+ attr_accessor :cached_input_tokens
15
+
16
+ # ContextLengths is the measured character length of each distinct component of an
17
+ # iteration's assembled context window. Values are raw character lengths of the
18
+ # component as assembled into the request — token estimates are derived by the
19
+ # client against input_tokens (component share = component length / sum of all
20
+ # lengths).
21
+ #
22
+ # New components are added as new fields — wire-compatible; absent components read
23
+ # as 0.
24
+ sig { returns(Cadenya::ContextLengths) }
25
+ attr_reader :context_lengths
26
+
27
+ sig { params(context_lengths: Cadenya::ContextLengths::OrHash).void }
28
+ attr_writer :context_lengths
29
+
30
+ # Input tokens reported by the LLM provider for the iteration's completion.
31
+ sig { returns(Integer) }
32
+ attr_accessor :input_tokens
33
+
34
+ # ObjectiveDiagnostics is the context-usage breakdown measured for a single
35
+ # iteration at request-assembly time. It reports how much of the context window
36
+ # each component occupies so tool parameters, memory cascades, and prompts can be
37
+ # tuned against real token usage.
38
+ sig do
39
+ params(
40
+ cached_input_tokens: Integer,
41
+ context_lengths: Cadenya::ContextLengths::OrHash,
42
+ input_tokens: Integer
43
+ ).returns(T.attached_class)
44
+ end
45
+ def self.new(
46
+ # The portion of input_tokens served from the provider's prompt cache. Lets
47
+ # clients distinguish "big but cached" from "big and paid fresh every iteration".
48
+ cached_input_tokens:,
49
+ # ContextLengths is the measured character length of each distinct component of an
50
+ # iteration's assembled context window. Values are raw character lengths of the
51
+ # component as assembled into the request — token estimates are derived by the
52
+ # client against input_tokens (component share = component length / sum of all
53
+ # lengths).
54
+ #
55
+ # New components are added as new fields — wire-compatible; absent components read
56
+ # as 0.
57
+ context_lengths:,
58
+ # Input tokens reported by the LLM provider for the iteration's completion.
59
+ input_tokens:
60
+ )
61
+ end
62
+
63
+ sig do
64
+ override.returns(
65
+ {
66
+ cached_input_tokens: Integer,
67
+ context_lengths: Cadenya::ContextLengths,
68
+ input_tokens: Integer
69
+ }
70
+ )
71
+ end
72
+ def to_hash
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,46 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ObjectiveRetrieveDiagnosticsParams < Cadenya::Internal::Type::BaseModel
6
+ extend Cadenya::Internal::Type::RequestParameters::Converter
7
+ include Cadenya::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Cadenya::ObjectiveRetrieveDiagnosticsParams,
13
+ Cadenya::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :workspace_id
19
+
20
+ sig { returns(String) }
21
+ attr_accessor :objective_id
22
+
23
+ sig do
24
+ params(
25
+ workspace_id: String,
26
+ objective_id: String,
27
+ request_options: Cadenya::RequestOptions::OrHash
28
+ ).returns(T.attached_class)
29
+ end
30
+ def self.new(workspace_id:, objective_id:, request_options: {})
31
+ end
32
+
33
+ sig do
34
+ override.returns(
35
+ {
36
+ workspace_id: String,
37
+ objective_id: String,
38
+ request_options: Cadenya::RequestOptions
39
+ }
40
+ )
41
+ end
42
+ def to_hash
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,43 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ObjectiveRetrieveDiagnosticsResponse < Cadenya::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse,
10
+ Cadenya::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # ObjectiveDiagnostics is the context-usage breakdown measured for a single
15
+ # iteration at request-assembly time. It reports how much of the context window
16
+ # each component occupies so tool parameters, memory cascades, and prompts can be
17
+ # tuned against real token usage.
18
+ sig { returns(Cadenya::ObjectiveDiagnostics) }
19
+ attr_reader :diagnostics
20
+
21
+ sig { params(diagnostics: Cadenya::ObjectiveDiagnostics::OrHash).void }
22
+ attr_writer :diagnostics
23
+
24
+ sig do
25
+ params(diagnostics: Cadenya::ObjectiveDiagnostics::OrHash).returns(
26
+ T.attached_class
27
+ )
28
+ end
29
+ def self.new(
30
+ # ObjectiveDiagnostics is the context-usage breakdown measured for a single
31
+ # iteration at request-assembly time. It reports how much of the context window
32
+ # each component occupies so tool parameters, memory cascades, and prompts can be
33
+ # tuned against real token usage.
34
+ diagnostics:
35
+ )
36
+ end
37
+
38
+ sig { override.returns({ diagnostics: Cadenya::ObjectiveDiagnostics }) }
39
+ def to_hash
40
+ end
41
+ end
42
+ end
43
+ end
@@ -89,6 +89,8 @@ module Cadenya
89
89
 
90
90
  CallableTool = Cadenya::Models::CallableTool
91
91
 
92
+ ContextLengths = Cadenya::Models::ContextLengths
93
+
92
94
  ContextWindowCompacted = Cadenya::Models::ContextWindowCompacted
93
95
 
94
96
  CreateOperationMetadata = Cadenya::Models::CreateOperationMetadata
@@ -147,6 +149,8 @@ module Cadenya
147
149
 
148
150
  ObjectiveCreateParams = Cadenya::Models::ObjectiveCreateParams
149
151
 
152
+ ObjectiveDiagnostics = Cadenya::Models::ObjectiveDiagnostics
153
+
150
154
  ObjectiveError = Cadenya::Models::ObjectiveError
151
155
 
152
156
  ObjectiveEvent = Cadenya::Models::ObjectiveEvent
@@ -166,6 +170,9 @@ module Cadenya
166
170
 
167
171
  ObjectiveListParams = Cadenya::Models::ObjectiveListParams
168
172
 
173
+ ObjectiveRetrieveDiagnosticsParams =
174
+ Cadenya::Models::ObjectiveRetrieveDiagnosticsParams
175
+
169
176
  ObjectiveRetrieveParams = Cadenya::Models::ObjectiveRetrieveParams
170
177
 
171
178
  Objectives = Cadenya::Models::Objectives
@@ -267,6 +267,25 @@ module Cadenya
267
267
  )
268
268
  end
269
269
 
270
+ # Returns the context-usage breakdown measured for the objective's most recent
271
+ # iteration: character lengths per context component (system prompt, memory
272
+ # appendices, tool definitions, messages by role) alongside the iteration's input
273
+ # token counts.
274
+ sig do
275
+ params(
276
+ objective_id: String,
277
+ workspace_id: String,
278
+ request_options: Cadenya::RequestOptions::OrHash
279
+ ).returns(Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse)
280
+ end
281
+ def retrieve_diagnostics(
282
+ # The ID of the objective. Supports "external_id:" prefix for external IDs.
283
+ objective_id,
284
+ workspace_id:,
285
+ request_options: {}
286
+ )
287
+ end
288
+
270
289
  # Streams events for an objective in real-time using server-sent events (SSE)
271
290
  sig do
272
291
  params(
@@ -0,0 +1,55 @@
1
+ module Cadenya
2
+ module Models
3
+ type context_lengths =
4
+ {
5
+ assistant_messages: Integer,
6
+ available_tools: Integer,
7
+ episodic_memory: Integer,
8
+ skills_memory: Integer,
9
+ system_prompt: Integer,
10
+ tool_definitions: Integer,
11
+ tool_results: Integer,
12
+ user_messages: Integer
13
+ }
14
+
15
+ class ContextLengths < Cadenya::Internal::Type::BaseModel
16
+ attr_accessor assistant_messages: Integer
17
+
18
+ attr_accessor available_tools: Integer
19
+
20
+ attr_accessor episodic_memory: Integer
21
+
22
+ attr_accessor skills_memory: Integer
23
+
24
+ attr_accessor system_prompt: Integer
25
+
26
+ attr_accessor tool_definitions: Integer
27
+
28
+ attr_accessor tool_results: Integer
29
+
30
+ attr_accessor user_messages: Integer
31
+
32
+ def initialize: (
33
+ assistant_messages: Integer,
34
+ available_tools: Integer,
35
+ episodic_memory: Integer,
36
+ skills_memory: Integer,
37
+ system_prompt: Integer,
38
+ tool_definitions: Integer,
39
+ tool_results: Integer,
40
+ user_messages: Integer
41
+ ) -> void
42
+
43
+ def to_hash: -> {
44
+ assistant_messages: Integer,
45
+ available_tools: Integer,
46
+ episodic_memory: Integer,
47
+ skills_memory: Integer,
48
+ system_prompt: Integer,
49
+ tool_definitions: Integer,
50
+ tool_results: Integer,
51
+ user_messages: Integer
52
+ }
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,30 @@
1
+ module Cadenya
2
+ module Models
3
+ type objective_diagnostics =
4
+ {
5
+ cached_input_tokens: Integer,
6
+ context_lengths: Cadenya::ContextLengths,
7
+ input_tokens: Integer
8
+ }
9
+
10
+ class ObjectiveDiagnostics < Cadenya::Internal::Type::BaseModel
11
+ attr_accessor cached_input_tokens: Integer
12
+
13
+ attr_accessor context_lengths: Cadenya::ContextLengths
14
+
15
+ attr_accessor input_tokens: Integer
16
+
17
+ def initialize: (
18
+ cached_input_tokens: Integer,
19
+ context_lengths: Cadenya::ContextLengths,
20
+ input_tokens: Integer
21
+ ) -> void
22
+
23
+ def to_hash: -> {
24
+ cached_input_tokens: Integer,
25
+ context_lengths: Cadenya::ContextLengths,
26
+ input_tokens: Integer
27
+ }
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ module Cadenya
2
+ module Models
3
+ type objective_retrieve_diagnostics_params =
4
+ { workspace_id: String, objective_id: String }
5
+ & Cadenya::Internal::Type::request_parameters
6
+
7
+ class ObjectiveRetrieveDiagnosticsParams < Cadenya::Internal::Type::BaseModel
8
+ extend Cadenya::Internal::Type::RequestParameters::Converter
9
+ include Cadenya::Internal::Type::RequestParameters
10
+
11
+ attr_accessor workspace_id: String
12
+
13
+ attr_accessor objective_id: String
14
+
15
+ def initialize: (
16
+ workspace_id: String,
17
+ objective_id: String,
18
+ ?request_options: Cadenya::request_opts
19
+ ) -> void
20
+
21
+ def to_hash: -> {
22
+ workspace_id: String,
23
+ objective_id: String,
24
+ request_options: Cadenya::RequestOptions
25
+ }
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ module Cadenya
2
+ module Models
3
+ type objective_retrieve_diagnostics_response =
4
+ { diagnostics: Cadenya::ObjectiveDiagnostics }
5
+
6
+ class ObjectiveRetrieveDiagnosticsResponse < Cadenya::Internal::Type::BaseModel
7
+ attr_accessor diagnostics: Cadenya::ObjectiveDiagnostics
8
+
9
+ def initialize: (diagnostics: Cadenya::ObjectiveDiagnostics) -> void
10
+
11
+ def to_hash: -> { diagnostics: Cadenya::ObjectiveDiagnostics }
12
+ end
13
+ end
14
+ end
@@ -85,6 +85,8 @@ module Cadenya
85
85
 
86
86
  class CallableTool = Cadenya::Models::CallableTool
87
87
 
88
+ class ContextLengths = Cadenya::Models::ContextLengths
89
+
88
90
  class ContextWindowCompacted = Cadenya::Models::ContextWindowCompacted
89
91
 
90
92
  class CreateOperationMetadata = Cadenya::Models::CreateOperationMetadata
@@ -143,6 +145,8 @@ module Cadenya
143
145
 
144
146
  class ObjectiveCreateParams = Cadenya::Models::ObjectiveCreateParams
145
147
 
148
+ class ObjectiveDiagnostics = Cadenya::Models::ObjectiveDiagnostics
149
+
146
150
  class ObjectiveError = Cadenya::Models::ObjectiveError
147
151
 
148
152
  class ObjectiveEvent = Cadenya::Models::ObjectiveEvent
@@ -161,6 +165,8 @@ module Cadenya
161
165
 
162
166
  class ObjectiveListParams = Cadenya::Models::ObjectiveListParams
163
167
 
168
+ class ObjectiveRetrieveDiagnosticsParams = Cadenya::Models::ObjectiveRetrieveDiagnosticsParams
169
+
164
170
  class ObjectiveRetrieveParams = Cadenya::Models::ObjectiveRetrieveParams
165
171
 
166
172
  module Objectives = Cadenya::Models::Objectives
@@ -86,6 +86,12 @@ module Cadenya
86
86
  ?request_options: Cadenya::request_opts
87
87
  ) -> Cadenya::Internal::CursorPagination[Cadenya::ObjectiveEvent]
88
88
 
89
+ def retrieve_diagnostics: (
90
+ String objective_id,
91
+ workspace_id: String,
92
+ ?request_options: Cadenya::request_opts
93
+ ) -> Cadenya::Models::ObjectiveRetrieveDiagnosticsResponse
94
+
89
95
  def stream_events_streaming: (
90
96
  String objective_id,
91
97
  workspace_id: String,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cadenya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.0
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cadenya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-04 00:00:00.000000000 Z
11
+ date: 2026-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi
@@ -170,6 +170,7 @@ files:
170
170
  - lib/cadenya/models/attribute_filter.rb
171
171
  - lib/cadenya/models/bare_metadata.rb
172
172
  - lib/cadenya/models/callable_tool.rb
173
+ - lib/cadenya/models/context_lengths.rb
173
174
  - lib/cadenya/models/context_window_compacted.rb
174
175
  - lib/cadenya/models/create_operation_metadata.rb
175
176
  - lib/cadenya/models/create_resource_metadata.rb
@@ -211,6 +212,7 @@ files:
211
212
  - lib/cadenya/models/objective_context_window_data.rb
212
213
  - lib/cadenya/models/objective_continue_params.rb
213
214
  - lib/cadenya/models/objective_create_params.rb
215
+ - lib/cadenya/models/objective_diagnostics.rb
214
216
  - lib/cadenya/models/objective_error.rb
215
217
  - lib/cadenya/models/objective_event.rb
216
218
  - lib/cadenya/models/objective_event_data.rb
@@ -220,6 +222,8 @@ files:
220
222
  - lib/cadenya/models/objective_list_context_windows_params.rb
221
223
  - lib/cadenya/models/objective_list_events_params.rb
222
224
  - lib/cadenya/models/objective_list_params.rb
225
+ - lib/cadenya/models/objective_retrieve_diagnostics_params.rb
226
+ - lib/cadenya/models/objective_retrieve_diagnostics_response.rb
223
227
  - lib/cadenya/models/objective_retrieve_params.rb
224
228
  - lib/cadenya/models/objective_secret.rb
225
229
  - lib/cadenya/models/objective_stream_events_params.rb
@@ -484,6 +488,7 @@ files:
484
488
  - rbi/cadenya/models/attribute_filter.rbi
485
489
  - rbi/cadenya/models/bare_metadata.rbi
486
490
  - rbi/cadenya/models/callable_tool.rbi
491
+ - rbi/cadenya/models/context_lengths.rbi
487
492
  - rbi/cadenya/models/context_window_compacted.rbi
488
493
  - rbi/cadenya/models/create_operation_metadata.rbi
489
494
  - rbi/cadenya/models/create_resource_metadata.rbi
@@ -525,6 +530,7 @@ files:
525
530
  - rbi/cadenya/models/objective_context_window_data.rbi
526
531
  - rbi/cadenya/models/objective_continue_params.rbi
527
532
  - rbi/cadenya/models/objective_create_params.rbi
533
+ - rbi/cadenya/models/objective_diagnostics.rbi
528
534
  - rbi/cadenya/models/objective_error.rbi
529
535
  - rbi/cadenya/models/objective_event.rbi
530
536
  - rbi/cadenya/models/objective_event_data.rbi
@@ -534,6 +540,8 @@ files:
534
540
  - rbi/cadenya/models/objective_list_context_windows_params.rbi
535
541
  - rbi/cadenya/models/objective_list_events_params.rbi
536
542
  - rbi/cadenya/models/objective_list_params.rbi
543
+ - rbi/cadenya/models/objective_retrieve_diagnostics_params.rbi
544
+ - rbi/cadenya/models/objective_retrieve_diagnostics_response.rbi
537
545
  - rbi/cadenya/models/objective_retrieve_params.rbi
538
546
  - rbi/cadenya/models/objective_secret.rbi
539
547
  - rbi/cadenya/models/objective_stream_events_params.rbi
@@ -797,6 +805,7 @@ files:
797
805
  - sig/cadenya/models/attribute_filter.rbs
798
806
  - sig/cadenya/models/bare_metadata.rbs
799
807
  - sig/cadenya/models/callable_tool.rbs
808
+ - sig/cadenya/models/context_lengths.rbs
800
809
  - sig/cadenya/models/context_window_compacted.rbs
801
810
  - sig/cadenya/models/create_operation_metadata.rbs
802
811
  - sig/cadenya/models/create_resource_metadata.rbs
@@ -838,6 +847,7 @@ files:
838
847
  - sig/cadenya/models/objective_context_window_data.rbs
839
848
  - sig/cadenya/models/objective_continue_params.rbs
840
849
  - sig/cadenya/models/objective_create_params.rbs
850
+ - sig/cadenya/models/objective_diagnostics.rbs
841
851
  - sig/cadenya/models/objective_error.rbs
842
852
  - sig/cadenya/models/objective_event.rbs
843
853
  - sig/cadenya/models/objective_event_data.rbs
@@ -847,6 +857,8 @@ files:
847
857
  - sig/cadenya/models/objective_list_context_windows_params.rbs
848
858
  - sig/cadenya/models/objective_list_events_params.rbs
849
859
  - sig/cadenya/models/objective_list_params.rbs
860
+ - sig/cadenya/models/objective_retrieve_diagnostics_params.rbs
861
+ - sig/cadenya/models/objective_retrieve_diagnostics_response.rbs
850
862
  - sig/cadenya/models/objective_retrieve_params.rbs
851
863
  - sig/cadenya/models/objective_secret.rbs
852
864
  - sig/cadenya/models/objective_stream_events_params.rbs