cadenya 0.8.0 → 0.9.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/cadenya/models/objective.rb +116 -18
  5. data/lib/cadenya/models/objective_config_snapshot.rb +39 -0
  6. data/lib/cadenya/models/objective_create_params.rb +65 -4
  7. data/lib/cadenya/models/objective_info.rb +45 -29
  8. data/lib/cadenya/models/objective_secret.rb +15 -0
  9. data/lib/cadenya/models/objectives/objective_tool_call.rb +19 -19
  10. data/lib/cadenya/models.rb +3 -5
  11. data/lib/cadenya/resources/objectives/tool_calls.rb +4 -4
  12. data/lib/cadenya/resources/objectives.rb +11 -5
  13. data/lib/cadenya/version.rb +1 -1
  14. data/lib/cadenya.rb +2 -3
  15. data/rbi/cadenya/models/objective.rbi +172 -32
  16. data/rbi/cadenya/models/objective_config_snapshot.rbi +70 -0
  17. data/rbi/cadenya/models/objective_create_params.rbi +112 -6
  18. data/rbi/cadenya/models/objective_info.rbi +50 -56
  19. data/rbi/cadenya/models/objective_secret.rbi +26 -0
  20. data/rbi/cadenya/models/objectives/objective_tool_call.rbi +47 -57
  21. data/rbi/cadenya/models/profile_spec.rbi +2 -2
  22. data/rbi/cadenya/models.rbi +3 -5
  23. data/rbi/cadenya/resources/objectives.rbi +29 -1
  24. data/sig/cadenya/models/objective.rbs +85 -15
  25. data/sig/cadenya/models/objective_config_snapshot.rbs +40 -0
  26. data/sig/cadenya/models/objective_create_params.rbs +45 -4
  27. data/sig/cadenya/models/objective_info.rbs +26 -38
  28. data/sig/cadenya/models/objective_secret.rbs +15 -0
  29. data/sig/cadenya/models/objectives/objective_tool_call.rbs +23 -27
  30. data/sig/cadenya/models.rbs +3 -5
  31. data/sig/cadenya/resources/objectives.rbs +4 -1
  32. metadata +8 -11
  33. data/lib/cadenya/models/objective_data.rb +0 -127
  34. data/lib/cadenya/models/objective_data_secret.rb +0 -21
  35. data/lib/cadenya/models/objective_status.rb +0 -37
  36. data/rbi/cadenya/models/objective_data.rbi +0 -198
  37. data/rbi/cadenya/models/objective_data_secret.rbi +0 -32
  38. data/rbi/cadenya/models/objective_status.rbi +0 -75
  39. data/sig/cadenya/models/objective_data.rbs +0 -98
  40. data/sig/cadenya/models/objective_data_secret.rbs +0 -19
  41. data/sig/cadenya/models/objective_status.rbs +0 -47
@@ -8,79 +8,65 @@ module Cadenya
8
8
  T.any(Cadenya::ObjectiveInfo, Cadenya::Internal::AnyHash)
9
9
  end
10
10
 
11
+ # A profile identifies a user or non-human principal (such as an API key) at the
12
+ # account level. Profiles are account-scoped and can be granted access to multiple
13
+ # workspaces.
14
+ sig { returns(Cadenya::Profile) }
15
+ attr_reader :created_by
16
+
17
+ sig { params(created_by: Cadenya::Profile::OrHash).void }
18
+ attr_writer :created_by
19
+
11
20
  # Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
12
- sig { returns(T.nilable(Cadenya::ResourceMetadata)) }
21
+ sig { returns(Cadenya::ResourceMetadata) }
13
22
  attr_reader :agent
14
23
 
15
24
  sig { params(agent: Cadenya::ResourceMetadata::OrHash).void }
16
25
  attr_writer :agent
17
26
 
18
27
  # Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
19
- sig { returns(T.nilable(Cadenya::ResourceMetadata)) }
28
+ sig { returns(Cadenya::ResourceMetadata) }
20
29
  attr_reader :agent_variation
21
30
 
22
31
  sig { params(agent_variation: Cadenya::ResourceMetadata::OrHash).void }
23
32
  attr_writer :agent_variation
24
33
 
25
- # A profile identifies a user or non-human principal (such as an API key) at the
26
- # account level. Profiles are account-scoped and can be granted access to multiple
27
- # workspaces.
28
- sig { returns(T.nilable(Cadenya::Profile)) }
29
- attr_reader :created_by
30
-
31
- sig { params(created_by: Cadenya::Profile::OrHash).void }
32
- attr_writer :created_by
34
+ # ID of the objective's current (most recent) context window. Hydrated on demand;
35
+ # empty when the objective has not yet produced a context window.
36
+ sig { returns(String) }
37
+ attr_accessor :current_context_window_id
33
38
 
34
39
  # The effective memory stack at objective creation time, flattened from the
35
- # variation's baseline plus ObjectiveData.memory_stack. Order is push order (last
36
- # = top). Returned on reads so clients can see exactly what stack the objective is
40
+ # variation's baseline plus Objective.memory_stack. Order is push order (last =
41
+ # top). Returned on reads so clients can see exactly what stack the objective is
37
42
  # using without having to re-join variation state.
38
- sig { returns(T.nilable(T::Array[Cadenya::MemoryReference])) }
39
- attr_reader :effective_memory_stack
40
-
41
- sig do
42
- params(
43
- effective_memory_stack: T::Array[Cadenya::MemoryReference::OrHash]
44
- ).void
45
- end
46
- attr_writer :effective_memory_stack
43
+ sig { returns(T::Array[Cadenya::MemoryReference]) }
44
+ attr_accessor :effective_memory_stack
47
45
 
48
46
  # Total number of context windows that this objective has generated
49
- sig { returns(T.nilable(Integer)) }
50
- attr_reader :total_context_windows
51
-
52
- sig { params(total_context_windows: Integer).void }
53
- attr_writer :total_context_windows
47
+ sig { returns(Integer) }
48
+ attr_accessor :total_context_windows
54
49
 
55
50
  # Total number of events generated during this objective's execution
56
- sig { returns(T.nilable(Integer)) }
57
- attr_reader :total_events
58
-
59
- sig { params(total_events: Integer).void }
60
- attr_writer :total_events
51
+ sig { returns(Integer) }
52
+ attr_accessor :total_events
61
53
 
62
54
  # Total input tokens consumed across all LLM completions across all context
63
55
  # windows
64
- sig { returns(T.nilable(Integer)) }
65
- attr_reader :total_input_tokens
56
+ sig { returns(Integer) }
57
+ attr_accessor :total_input_tokens
66
58
 
67
- sig { params(total_input_tokens: Integer).void }
68
- attr_writer :total_input_tokens
59
+ sig { returns(Integer) }
60
+ attr_accessor :total_iterations
69
61
 
70
62
  # Total output tokens generated across all LLM completions across all context
71
63
  # windows
72
- sig { returns(T.nilable(Integer)) }
73
- attr_reader :total_output_tokens
74
-
75
- sig { params(total_output_tokens: Integer).void }
76
- attr_writer :total_output_tokens
64
+ sig { returns(Integer) }
65
+ attr_accessor :total_output_tokens
77
66
 
78
67
  # Total number of tool calls made during execution
79
- sig { returns(T.nilable(Integer)) }
80
- attr_reader :total_tool_calls
81
-
82
- sig { params(total_tool_calls: Integer).void }
83
- attr_writer :total_tool_calls
68
+ sig { returns(Integer) }
69
+ attr_accessor :total_tool_calls
84
70
 
85
71
  # ObjectiveInfo provides read-only aggregated statistics about an objective's
86
72
  # execution
@@ -89,40 +75,46 @@ module Cadenya
89
75
  agent: Cadenya::ResourceMetadata::OrHash,
90
76
  agent_variation: Cadenya::ResourceMetadata::OrHash,
91
77
  created_by: Cadenya::Profile::OrHash,
78
+ current_context_window_id: String,
92
79
  effective_memory_stack: T::Array[Cadenya::MemoryReference::OrHash],
93
80
  total_context_windows: Integer,
94
81
  total_events: Integer,
95
82
  total_input_tokens: Integer,
83
+ total_iterations: Integer,
96
84
  total_output_tokens: Integer,
97
85
  total_tool_calls: Integer
98
86
  ).returns(T.attached_class)
99
87
  end
100
88
  def self.new(
101
89
  # Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
102
- agent: nil,
90
+ agent:,
103
91
  # Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
104
- agent_variation: nil,
92
+ agent_variation:,
105
93
  # A profile identifies a user or non-human principal (such as an API key) at the
106
94
  # account level. Profiles are account-scoped and can be granted access to multiple
107
95
  # workspaces.
108
- created_by: nil,
96
+ created_by:,
97
+ # ID of the objective's current (most recent) context window. Hydrated on demand;
98
+ # empty when the objective has not yet produced a context window.
99
+ current_context_window_id:,
109
100
  # The effective memory stack at objective creation time, flattened from the
110
- # variation's baseline plus ObjectiveData.memory_stack. Order is push order (last
111
- # = top). Returned on reads so clients can see exactly what stack the objective is
101
+ # variation's baseline plus Objective.memory_stack. Order is push order (last =
102
+ # top). Returned on reads so clients can see exactly what stack the objective is
112
103
  # using without having to re-join variation state.
113
- effective_memory_stack: nil,
104
+ effective_memory_stack:,
114
105
  # Total number of context windows that this objective has generated
115
- total_context_windows: nil,
106
+ total_context_windows:,
116
107
  # Total number of events generated during this objective's execution
117
- total_events: nil,
108
+ total_events:,
118
109
  # Total input tokens consumed across all LLM completions across all context
119
110
  # windows
120
- total_input_tokens: nil,
111
+ total_input_tokens:,
112
+ total_iterations:,
121
113
  # Total output tokens generated across all LLM completions across all context
122
114
  # windows
123
- total_output_tokens: nil,
115
+ total_output_tokens:,
124
116
  # Total number of tool calls made during execution
125
- total_tool_calls: nil
117
+ total_tool_calls:
126
118
  )
127
119
  end
128
120
 
@@ -132,10 +124,12 @@ module Cadenya
132
124
  agent: Cadenya::ResourceMetadata,
133
125
  agent_variation: Cadenya::ResourceMetadata,
134
126
  created_by: Cadenya::Profile,
127
+ current_context_window_id: String,
135
128
  effective_memory_stack: T::Array[Cadenya::MemoryReference],
136
129
  total_context_windows: Integer,
137
130
  total_events: Integer,
138
131
  total_input_tokens: Integer,
132
+ total_iterations: Integer,
139
133
  total_output_tokens: Integer,
140
134
  total_tool_calls: Integer
141
135
  }
@@ -0,0 +1,26 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class ObjectiveSecret < Cadenya::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Cadenya::ObjectiveSecret, Cadenya::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T.nilable(String)) }
12
+ attr_reader :name
13
+
14
+ sig { params(name: String).void }
15
+ attr_writer :name
16
+
17
+ sig { params(name: String).returns(T.attached_class) }
18
+ def self.new(name: nil)
19
+ end
20
+
21
+ sig { override.returns({ name: String }) }
22
+ def to_hash
23
+ end
24
+ end
25
+ end
26
+ end
@@ -46,20 +46,10 @@ module Cadenya
46
46
 
47
47
  sig do
48
48
  returns(
49
- T.nilable(
50
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
51
- )
49
+ Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
52
50
  )
53
51
  end
54
- attr_reader :execution_status
55
-
56
- sig do
57
- params(
58
- execution_status:
59
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::OrSymbol
60
- ).void
61
- end
62
- attr_writer :execution_status
52
+ attr_accessor :execution_status
63
53
 
64
54
  # ObjectiveToolCall is a record of a tool call made during an objective's
65
55
  # execution. Tool calls are mutable — their status changes as they are approved,
@@ -67,21 +57,21 @@ module Cadenya
67
57
  sig do
68
58
  params(
69
59
  data: Cadenya::Objectives::ObjectiveToolCallData::OrHash,
70
- metadata: Cadenya::OperationMetadata::OrHash,
71
- status: Cadenya::Objectives::ObjectiveToolCall::Status::OrSymbol,
72
60
  execution_status:
73
61
  Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::OrSymbol,
62
+ metadata: Cadenya::OperationMetadata::OrHash,
63
+ status: Cadenya::Objectives::ObjectiveToolCall::Status::OrSymbol,
74
64
  info: Cadenya::Objectives::ObjectiveToolCallInfo::OrHash
75
65
  ).returns(T.attached_class)
76
66
  end
77
67
  def self.new(
78
68
  data:,
69
+ execution_status:,
79
70
  # Metadata for ephemeral operations and activities (e.g., objectives, executions,
80
71
  # runs)
81
72
  metadata:,
82
73
  # Current status of the tool call
83
74
  status:,
84
- execution_status: nil,
85
75
  info: nil
86
76
  )
87
77
  end
@@ -90,11 +80,11 @@ module Cadenya
90
80
  override.returns(
91
81
  {
92
82
  data: Cadenya::Objectives::ObjectiveToolCallData,
83
+ execution_status:
84
+ Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol,
93
85
  metadata: Cadenya::OperationMetadata,
94
86
  status:
95
87
  Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol,
96
- execution_status:
97
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol,
98
88
  info: Cadenya::Objectives::ObjectiveToolCallInfo
99
89
  }
100
90
  )
@@ -102,46 +92,48 @@ module Cadenya
102
92
  def to_hash
103
93
  end
104
94
 
105
- # Current status of the tool call
106
- module Status
95
+ module ExecutionStatus
107
96
  extend Cadenya::Internal::Type::Enum
108
97
 
109
98
  TaggedSymbol =
110
99
  T.type_alias do
111
- T.all(Symbol, Cadenya::Objectives::ObjectiveToolCall::Status)
100
+ T.all(
101
+ Symbol,
102
+ Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus
103
+ )
112
104
  end
113
105
  OrSymbol = T.type_alias { T.any(Symbol, String) }
114
106
 
115
- TOOL_CALL_STATUS_UNSPECIFIED =
107
+ TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED =
116
108
  T.let(
117
- :TOOL_CALL_STATUS_UNSPECIFIED,
118
- Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
109
+ :TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED,
110
+ Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
119
111
  )
120
- TOOL_CALL_STATUS_AUTO_APPROVED =
112
+ TOOL_CALL_EXECUTION_STATUS_PENDING =
121
113
  T.let(
122
- :TOOL_CALL_STATUS_AUTO_APPROVED,
123
- Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
114
+ :TOOL_CALL_EXECUTION_STATUS_PENDING,
115
+ Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
124
116
  )
125
- TOOL_CALL_STATUS_WAITING_FOR_APPROVAL =
117
+ TOOL_CALL_EXECUTION_STATUS_RUNNING =
126
118
  T.let(
127
- :TOOL_CALL_STATUS_WAITING_FOR_APPROVAL,
128
- Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
119
+ :TOOL_CALL_EXECUTION_STATUS_RUNNING,
120
+ Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
129
121
  )
130
- TOOL_CALL_STATUS_APPROVED =
122
+ TOOL_CALL_EXECUTION_STATUS_COMPLETED =
131
123
  T.let(
132
- :TOOL_CALL_STATUS_APPROVED,
133
- Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
124
+ :TOOL_CALL_EXECUTION_STATUS_COMPLETED,
125
+ Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
134
126
  )
135
- TOOL_CALL_STATUS_DENIED =
127
+ TOOL_CALL_EXECUTION_STATUS_ERRORED =
136
128
  T.let(
137
- :TOOL_CALL_STATUS_DENIED,
138
- Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
129
+ :TOOL_CALL_EXECUTION_STATUS_ERRORED,
130
+ Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
139
131
  )
140
132
 
141
133
  sig do
142
134
  override.returns(
143
135
  T::Array[
144
- Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
136
+ Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
145
137
  ]
146
138
  )
147
139
  end
@@ -149,48 +141,46 @@ module Cadenya
149
141
  end
150
142
  end
151
143
 
152
- module ExecutionStatus
144
+ # Current status of the tool call
145
+ module Status
153
146
  extend Cadenya::Internal::Type::Enum
154
147
 
155
148
  TaggedSymbol =
156
149
  T.type_alias do
157
- T.all(
158
- Symbol,
159
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus
160
- )
150
+ T.all(Symbol, Cadenya::Objectives::ObjectiveToolCall::Status)
161
151
  end
162
152
  OrSymbol = T.type_alias { T.any(Symbol, String) }
163
153
 
164
- TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED =
154
+ TOOL_CALL_STATUS_UNSPECIFIED =
165
155
  T.let(
166
- :TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED,
167
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
156
+ :TOOL_CALL_STATUS_UNSPECIFIED,
157
+ Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
168
158
  )
169
- TOOL_CALL_EXECUTION_STATUS_PENDING =
159
+ TOOL_CALL_STATUS_AUTO_APPROVED =
170
160
  T.let(
171
- :TOOL_CALL_EXECUTION_STATUS_PENDING,
172
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
161
+ :TOOL_CALL_STATUS_AUTO_APPROVED,
162
+ Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
173
163
  )
174
- TOOL_CALL_EXECUTION_STATUS_RUNNING =
164
+ TOOL_CALL_STATUS_WAITING_FOR_APPROVAL =
175
165
  T.let(
176
- :TOOL_CALL_EXECUTION_STATUS_RUNNING,
177
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
166
+ :TOOL_CALL_STATUS_WAITING_FOR_APPROVAL,
167
+ Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
178
168
  )
179
- TOOL_CALL_EXECUTION_STATUS_COMPLETED =
169
+ TOOL_CALL_STATUS_APPROVED =
180
170
  T.let(
181
- :TOOL_CALL_EXECUTION_STATUS_COMPLETED,
182
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
171
+ :TOOL_CALL_STATUS_APPROVED,
172
+ Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
183
173
  )
184
- TOOL_CALL_EXECUTION_STATUS_ERRORED =
174
+ TOOL_CALL_STATUS_DENIED =
185
175
  T.let(
186
- :TOOL_CALL_EXECUTION_STATUS_ERRORED,
187
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
176
+ :TOOL_CALL_STATUS_DENIED,
177
+ Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
188
178
  )
189
179
 
190
180
  sig do
191
181
  override.returns(
192
182
  T::Array[
193
- Cadenya::Objectives::ObjectiveToolCall::ExecutionStatus::TaggedSymbol
183
+ Cadenya::Objectives::ObjectiveToolCall::Status::TaggedSymbol
194
184
  ]
195
185
  )
196
186
  end
@@ -7,7 +7,7 @@ module Cadenya
7
7
  T.type_alias { T.any(Cadenya::ProfileSpec, Cadenya::Internal::AnyHash) }
8
8
 
9
9
  # Whether this profile represents a human user, an API key, or a system principal.
10
- sig { returns(Cadenya::ProfileSpec::Type::OrSymbol) }
10
+ sig { returns(Cadenya::ProfileSpec::Type::TaggedSymbol) }
11
11
  attr_accessor :type
12
12
 
13
13
  # Email address of the profile. Required and unique within an account for user
@@ -47,7 +47,7 @@ module Cadenya
47
47
  sig do
48
48
  override.returns(
49
49
  {
50
- type: Cadenya::ProfileSpec::Type::OrSymbol,
50
+ type: Cadenya::ProfileSpec::Type::TaggedSymbol,
51
51
  email: String,
52
52
  name: String
53
53
  }
@@ -153,6 +153,8 @@ module Cadenya
153
153
 
154
154
  ObjectiveCompactParams = Cadenya::Models::ObjectiveCompactParams
155
155
 
156
+ ObjectiveConfigSnapshot = Cadenya::Models::ObjectiveConfigSnapshot
157
+
156
158
  ObjectiveContextWindow = Cadenya::Models::ObjectiveContextWindow
157
159
 
158
160
  ObjectiveContextWindowData = Cadenya::Models::ObjectiveContextWindowData
@@ -161,10 +163,6 @@ module Cadenya
161
163
 
162
164
  ObjectiveCreateParams = Cadenya::Models::ObjectiveCreateParams
163
165
 
164
- ObjectiveData = Cadenya::Models::ObjectiveData
165
-
166
- ObjectiveDataSecret = Cadenya::Models::ObjectiveDataSecret
167
-
168
166
  ObjectiveError = Cadenya::Models::ObjectiveError
169
167
 
170
168
  ObjectiveEventData = Cadenya::Models::ObjectiveEventData
@@ -186,7 +184,7 @@ module Cadenya
186
184
 
187
185
  Objectives = Cadenya::Models::Objectives
188
186
 
189
- ObjectiveStatus = Cadenya::Models::ObjectiveStatus
187
+ ObjectiveSecret = Cadenya::Models::ObjectiveSecret
190
188
 
191
189
  OperationMetadata = Cadenya::Models::OperationMetadata
192
190
 
@@ -20,8 +20,11 @@ module Cadenya
20
20
  params(
21
21
  workspace_id: String,
22
22
  agent_id: String,
23
- data: Cadenya::ObjectiveData::OrHash,
23
+ data: T::Hash[Symbol, T.anything],
24
+ initial_message: String,
25
+ memory_stack: T::Array[Cadenya::MemoryReference::OrHash],
24
26
  metadata: Cadenya::CreateOperationMetadata::OrHash,
27
+ secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret::OrHash],
25
28
  variation_id: String,
26
29
  request_options: Cadenya::RequestOptions::OrHash
27
30
  ).returns(Cadenya::Objective)
@@ -29,11 +32,36 @@ module Cadenya
29
32
  def create(
30
33
  workspace_id,
31
34
  agent_id:,
35
+ # Arbitrary data for the objective. May be used in liquid templates for prompts
36
+ # configured on the agent variation
32
37
  data:,
38
+ # Optional override for initial message sent to the agent. This becomes the first
39
+ # user message in the LLM chat history. The agent variation is used to set this if
40
+ # not present.
41
+ initial_message: nil,
42
+ # Memory layers/entries to push onto this objective's memory stack on top of the
43
+ # baseline stack inherited from the selected variation.
44
+ #
45
+ # Array order is push order: the first element sits lower in the objective's
46
+ # contribution to the stack; the LAST element ends up on top of the effective
47
+ # stack. Entries pinned via memory_entry_id behave as single-entry layers at their
48
+ # position.
49
+ #
50
+ # System-managed layers (e.g., episodic) cannot be referenced here; they attach
51
+ # themselves automatically based on episodic_key.
52
+ #
53
+ # Stack size cap: the TOTAL effective stack (variation's memory layers
54
+ #
55
+ # - this field) must not exceed 10 entries. A request that would produce an
56
+ # effective stack larger than 10 is rejected with InvalidArgument.
57
+ memory_stack: nil,
33
58
  # CreateOperationMetadata contains the user-provided fields for creating an
34
59
  # operation. Read-only fields (id, account_id, workspace_id, created_at,
35
60
  # profile_id) are excluded since they are set by the server.
36
61
  metadata: nil,
62
+ # Secrets that can be used in the headers for tool calls using the secret
63
+ # interpolation format.
64
+ secrets: nil,
37
65
  # Optional explicit variation selection. Overrides the agent's
38
66
  # variation_selection_mode.
39
67
  variation_id: nil,
@@ -2,45 +2,115 @@ module Cadenya
2
2
  module Models
3
3
  type objective =
4
4
  {
5
- data: Cadenya::ObjectiveData,
5
+ config_snapshot: Cadenya::ObjectiveConfigSnapshot,
6
+ initial_message: String,
6
7
  metadata: Cadenya::OperationMetadata,
7
- status: Cadenya::ObjectiveStatus,
8
+ state: Cadenya::Models::Objective::state,
9
+ system_prompt: String,
10
+ data: ::Hash[Symbol, top],
8
11
  info: Cadenya::ObjectiveInfo,
9
- last_five_windows: ::Array[Cadenya::ObjectiveContextWindow]
12
+ memory_stack: ::Array[Cadenya::MemoryReference],
13
+ output: ::Hash[Symbol, top],
14
+ parent_objective_id: String,
15
+ secrets: ::Array[Cadenya::ObjectiveSecret],
16
+ state_message: String
10
17
  }
11
18
 
12
19
  class Objective < Cadenya::Internal::Type::BaseModel
13
- attr_accessor data: Cadenya::ObjectiveData
20
+ attr_accessor initial_message: String
14
21
 
15
22
  attr_accessor metadata: Cadenya::OperationMetadata
16
23
 
17
- attr_accessor status: Cadenya::ObjectiveStatus
24
+ attr_reader memory_stack: ::Array[Cadenya::MemoryReference]?
25
+
26
+ def memory_stack=: (
27
+ ::Array[Cadenya::MemoryReference]
28
+ ) -> ::Array[Cadenya::MemoryReference]
29
+
30
+ attr_reader secrets: ::Array[Cadenya::ObjectiveSecret]?
31
+
32
+ def secrets=: (
33
+ ::Array[Cadenya::ObjectiveSecret]
34
+ ) -> ::Array[Cadenya::ObjectiveSecret]
35
+
36
+ attr_accessor config_snapshot: Cadenya::ObjectiveConfigSnapshot
37
+
38
+ attr_accessor state: Cadenya::Models::Objective::state
39
+
40
+ attr_accessor system_prompt: String
41
+
42
+ attr_reader data: ::Hash[Symbol, top]?
43
+
44
+ def data=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
18
45
 
19
46
  attr_reader info: Cadenya::ObjectiveInfo?
20
47
 
21
48
  def info=: (Cadenya::ObjectiveInfo) -> Cadenya::ObjectiveInfo
22
49
 
23
- attr_reader last_five_windows: ::Array[Cadenya::ObjectiveContextWindow]?
50
+ attr_reader output: ::Hash[Symbol, top]?
24
51
 
25
- def last_five_windows=: (
26
- ::Array[Cadenya::ObjectiveContextWindow]
27
- ) -> ::Array[Cadenya::ObjectiveContextWindow]
52
+ def output=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
53
+
54
+ attr_reader parent_objective_id: String?
55
+
56
+ def parent_objective_id=: (String) -> String
57
+
58
+ attr_reader state_message: String?
59
+
60
+ def state_message=: (String) -> String
28
61
 
29
62
  def initialize: (
30
- data: Cadenya::ObjectiveData,
63
+ config_snapshot: Cadenya::ObjectiveConfigSnapshot,
64
+ initial_message: String,
31
65
  metadata: Cadenya::OperationMetadata,
32
- status: Cadenya::ObjectiveStatus,
66
+ state: Cadenya::Models::Objective::state,
67
+ system_prompt: String,
68
+ ?data: ::Hash[Symbol, top],
33
69
  ?info: Cadenya::ObjectiveInfo,
34
- ?last_five_windows: ::Array[Cadenya::ObjectiveContextWindow]
70
+ ?memory_stack: ::Array[Cadenya::MemoryReference],
71
+ ?output: ::Hash[Symbol, top],
72
+ ?parent_objective_id: String,
73
+ ?secrets: ::Array[Cadenya::ObjectiveSecret],
74
+ ?state_message: String
35
75
  ) -> void
36
76
 
37
77
  def to_hash: -> {
38
- data: Cadenya::ObjectiveData,
78
+ config_snapshot: Cadenya::ObjectiveConfigSnapshot,
79
+ initial_message: String,
39
80
  metadata: Cadenya::OperationMetadata,
40
- status: Cadenya::ObjectiveStatus,
81
+ state: Cadenya::Models::Objective::state,
82
+ system_prompt: String,
83
+ data: ::Hash[Symbol, top],
41
84
  info: Cadenya::ObjectiveInfo,
42
- last_five_windows: ::Array[Cadenya::ObjectiveContextWindow]
85
+ memory_stack: ::Array[Cadenya::MemoryReference],
86
+ output: ::Hash[Symbol, top],
87
+ parent_objective_id: String,
88
+ secrets: ::Array[Cadenya::ObjectiveSecret],
89
+ state_message: String
43
90
  }
91
+
92
+ type state =
93
+ :STATE_UNSPECIFIED
94
+ | :STATE_PENDING
95
+ | :STATE_RUNNING
96
+ | :STATE_WAITING
97
+ | :STATE_FAILED
98
+ | :STATE_CANCELLED
99
+ | :STATE_FINALIZED
100
+
101
+ module State
102
+ extend Cadenya::Internal::Type::Enum
103
+
104
+ STATE_UNSPECIFIED: :STATE_UNSPECIFIED
105
+ STATE_PENDING: :STATE_PENDING
106
+ STATE_RUNNING: :STATE_RUNNING
107
+ STATE_WAITING: :STATE_WAITING
108
+ STATE_FAILED: :STATE_FAILED
109
+ STATE_CANCELLED: :STATE_CANCELLED
110
+ STATE_FINALIZED: :STATE_FINALIZED
111
+
112
+ def self?.values: -> ::Array[Cadenya::Models::Objective::state]
113
+ end
44
114
  end
45
115
  end
46
116
  end
@@ -0,0 +1,40 @@
1
+ module Cadenya
2
+ module Models
3
+ type objective_config_snapshot =
4
+ {
5
+ agent: Cadenya::Agent,
6
+ agent_schedule: Cadenya::Agents::AgentSchedule,
7
+ agent_variation: Cadenya::Agents::AgentVariation
8
+ }
9
+
10
+ class ObjectiveConfigSnapshot < Cadenya::Internal::Type::BaseModel
11
+ attr_reader agent: Cadenya::Agent?
12
+
13
+ def agent=: (Cadenya::Agent) -> Cadenya::Agent
14
+
15
+ attr_reader agent_schedule: Cadenya::Agents::AgentSchedule?
16
+
17
+ def agent_schedule=: (
18
+ Cadenya::Agents::AgentSchedule
19
+ ) -> Cadenya::Agents::AgentSchedule
20
+
21
+ attr_reader agent_variation: Cadenya::Agents::AgentVariation?
22
+
23
+ def agent_variation=: (
24
+ Cadenya::Agents::AgentVariation
25
+ ) -> Cadenya::Agents::AgentVariation
26
+
27
+ def initialize: (
28
+ ?agent: Cadenya::Agent,
29
+ ?agent_schedule: Cadenya::Agents::AgentSchedule,
30
+ ?agent_variation: Cadenya::Agents::AgentVariation
31
+ ) -> void
32
+
33
+ def to_hash: -> {
34
+ agent: Cadenya::Agent,
35
+ agent_schedule: Cadenya::Agents::AgentSchedule,
36
+ agent_variation: Cadenya::Agents::AgentVariation
37
+ }
38
+ end
39
+ end
40
+ end