cadenya 0.26.0 → 0.28.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/cadenya/models/account_info.rb +13 -1
  5. data/lib/cadenya/models/account_rotate_challenge_token_params.rb +14 -0
  6. data/lib/cadenya/models/agent_spec.rb +16 -15
  7. data/lib/cadenya/models/agents/agent_schedule_spec.rb +21 -20
  8. data/lib/cadenya/models/agents/agent_variation_spec.rb +16 -14
  9. data/lib/cadenya/models/agents/webhook_delivery_data.rb +1 -0
  10. data/lib/cadenya/models/agents/webhook_delivery_list_params.rb +1 -0
  11. data/lib/cadenya/models/objective.rb +18 -16
  12. data/lib/cadenya/models/objective_continue_params.rb +1 -26
  13. data/lib/cadenya/models/objective_create_params.rb +28 -25
  14. data/lib/cadenya/models/objective_event_data.rb +63 -1
  15. data/lib/cadenya/models/rotate_challenge_token_response.rb +18 -0
  16. data/lib/cadenya/models/tool_set_adapter_mcp.rb +38 -1
  17. data/lib/cadenya/models/tool_sets/tool_info.rb +14 -1
  18. data/lib/cadenya/models.rb +4 -0
  19. data/lib/cadenya/resources/account.rb +19 -0
  20. data/lib/cadenya/resources/objectives.rb +6 -8
  21. data/lib/cadenya/version.rb +1 -1
  22. data/lib/cadenya.rb +2 -0
  23. data/rbi/cadenya/models/account_info.rbi +19 -0
  24. data/rbi/cadenya/models/account_rotate_challenge_token_params.rbi +30 -0
  25. data/rbi/cadenya/models/agent_spec.rbi +23 -19
  26. data/rbi/cadenya/models/agents/agent_schedule_spec.rbi +38 -36
  27. data/rbi/cadenya/models/agents/agent_variation_spec.rbi +25 -21
  28. data/rbi/cadenya/models/agents/webhook_delivery_data.rbi +5 -0
  29. data/rbi/cadenya/models/agents/webhook_delivery_list_params.rbi +5 -0
  30. data/rbi/cadenya/models/objective.rbi +24 -24
  31. data/rbi/cadenya/models/objective_continue_params.rbi +0 -49
  32. data/rbi/cadenya/models/objective_create_params.rbi +39 -37
  33. data/rbi/cadenya/models/objective_event_data.rbi +128 -0
  34. data/rbi/cadenya/models/rotate_challenge_token_response.rbi +30 -0
  35. data/rbi/cadenya/models/tool_set_adapter_mcp.rbi +69 -0
  36. data/rbi/cadenya/models/tool_sets/tool_info.rbi +17 -0
  37. data/rbi/cadenya/models.rbi +5 -0
  38. data/rbi/cadenya/resources/account.rbi +10 -0
  39. data/rbi/cadenya/resources/objectives.rbi +16 -20
  40. data/sig/cadenya/models/account_info.rbs +11 -1
  41. data/sig/cadenya/models/account_rotate_challenge_token_params.rbs +15 -0
  42. data/sig/cadenya/models/agent_spec.rbs +9 -7
  43. data/sig/cadenya/models/agents/agent_schedule_spec.rbs +15 -15
  44. data/sig/cadenya/models/agents/agent_variation_spec.rbs +7 -7
  45. data/sig/cadenya/models/agents/webhook_delivery_data.rbs +2 -0
  46. data/sig/cadenya/models/agents/webhook_delivery_list_params.rbs +2 -0
  47. data/sig/cadenya/models/objective.rbs +14 -14
  48. data/sig/cadenya/models/objective_continue_params.rbs +1 -26
  49. data/sig/cadenya/models/objective_create_params.rbs +16 -16
  50. data/sig/cadenya/models/objective_event_data.rbs +56 -0
  51. data/sig/cadenya/models/rotate_challenge_token_response.rbs +15 -0
  52. data/sig/cadenya/models/tool_set_adapter_mcp.rbs +32 -0
  53. data/sig/cadenya/models/tool_sets/tool_info.rbs +11 -1
  54. data/sig/cadenya/models.rbs +4 -0
  55. data/sig/cadenya/resources/account.rbs +4 -0
  56. data/sig/cadenya/resources/objectives.rbs +3 -4
  57. metadata +8 -2
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Models
5
+ # @see Cadenya::Resources::Account#rotate_challenge_token
6
+ class RotateChallengeTokenResponse < Cadenya::Internal::Type::BaseModel
7
+ # @!attribute challenge_token
8
+ #
9
+ # @return [String, nil]
10
+ optional :challenge_token, String, api_name: :challengeToken
11
+
12
+ # @!method initialize(challenge_token: nil)
13
+ # Response containing the newly generated challenge token.
14
+ #
15
+ # @param challenge_token [String]
16
+ end
17
+ end
18
+ end
@@ -20,6 +20,12 @@ module Cadenya
20
20
  # @return [Cadenya::Models::ToolFilter, nil]
21
21
  optional :include_tools, -> { Cadenya::ToolFilter }, api_name: :includeTools
22
22
 
23
+ # @!attribute just_in_time
24
+ # Defines behavior for just-in-time capable tool set adapters (IE: MCP).
25
+ #
26
+ # @return [Cadenya::Models::ToolSetAdapterMcp::JustInTime, nil]
27
+ optional :just_in_time, -> { Cadenya::ToolSetAdapterMcp::JustInTime }, api_name: :justInTime
28
+
23
29
  # @!attribute tool_approvals
24
30
  # Approval filters that will automatically set the approval requirement on tools
25
31
  # synced from an external source
@@ -32,7 +38,7 @@ module Cadenya
32
38
  # @return [String, nil]
33
39
  optional :url, String
34
40
 
35
- # @!method initialize(exclude_tools: nil, headers: nil, include_tools: nil, tool_approvals: nil, url: nil)
41
+ # @!method initialize(exclude_tools: nil, headers: nil, include_tools: nil, just_in_time: nil, tool_approvals: nil, url: nil)
36
42
  # Some parameter documentations has been truncated, see
37
43
  # {Cadenya::Models::ToolSetAdapterMcp} for more details.
38
44
  #
@@ -42,9 +48,40 @@ module Cadenya
42
48
  #
43
49
  # @param include_tools [Cadenya::Models::ToolFilter] Top-level filter with simple boolean logic (no nesting)
44
50
  #
51
+ # @param just_in_time [Cadenya::Models::ToolSetAdapterMcp::JustInTime] Defines behavior for just-in-time capable tool set adapters (IE: MCP).
52
+ #
45
53
  # @param tool_approvals [Cadenya::Models::ApprovalRequirementFilter] Approval filters that will automatically set the approval requirement on tools s
46
54
  #
47
55
  # @param url [String]
56
+
57
+ # @see Cadenya::Models::ToolSetAdapterMcp#just_in_time
58
+ class JustInTime < Cadenya::Internal::Type::BaseModel
59
+ # @!attribute enabled
60
+ #
61
+ # @return [Boolean, nil]
62
+ optional :enabled, Cadenya::Internal::Type::Boolean
63
+
64
+ # @!attribute fail_objective_on_tool_list_error
65
+ # If set, an objective will automatically be failed if tools cannot be loaded in
66
+ # the initial stages of an objective being created. Tools are loaded
67
+ # asynchronously, so this setting is useful for ensuring that an objective
68
+ # continued any further if tools are not available.
69
+ #
70
+ # @return [Boolean, nil]
71
+ optional :fail_objective_on_tool_list_error,
72
+ Cadenya::Internal::Type::Boolean,
73
+ api_name: :failObjectiveOnToolListError
74
+
75
+ # @!method initialize(enabled: nil, fail_objective_on_tool_list_error: nil)
76
+ # Some parameter documentations has been truncated, see
77
+ # {Cadenya::Models::ToolSetAdapterMcp::JustInTime} for more details.
78
+ #
79
+ # Defines behavior for just-in-time capable tool set adapters (IE: MCP).
80
+ #
81
+ # @param enabled [Boolean]
82
+ #
83
+ # @param fail_objective_on_tool_list_error [Boolean] If set, an objective will automatically be failed if tools cannot be loaded
84
+ end
48
85
  end
49
86
  end
50
87
  end
@@ -18,12 +18,25 @@ module Cadenya
18
18
  # @return [Cadenya::Models::ResourceMetadata, nil]
19
19
  optional :tool_set, -> { Cadenya::ResourceMetadata }, api_name: :toolSet
20
20
 
21
- # @!method initialize(created_by: nil, tool_set: nil)
21
+ response_only do
22
+ # @!attribute signature
23
+ # Content signature identifying the tool within its tool set: a hash of the
24
+ # sanitized llm_tool_name, description, and canonical parameters. Two tools with
25
+ # the same llm_tool_name but different parameters or description (as MCP servers
26
+ # may return per user) have distinct signatures.
27
+ #
28
+ # @return [String, nil]
29
+ optional :signature, String
30
+ end
31
+
32
+ # @!method initialize(created_by: nil, signature: nil, tool_set: nil)
22
33
  # Some parameter documentations has been truncated, see
23
34
  # {Cadenya::Models::ToolSets::ToolInfo} for more details.
24
35
  #
25
36
  # @param created_by [Cadenya::Models::Profile] A profile identifies a user or non-human principal (such as an API key)
26
37
  #
38
+ # @param signature [String] Content signature identifying the tool within its tool set: a hash of the
39
+ #
27
40
  # @param tool_set [Cadenya::Models::ResourceMetadata] Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
28
41
  end
29
42
  end
@@ -47,6 +47,8 @@ module Cadenya
47
47
 
48
48
  AccountRetrieveParams = Cadenya::Models::AccountRetrieveParams
49
49
 
50
+ AccountRotateChallengeTokenParams = Cadenya::Models::AccountRotateChallengeTokenParams
51
+
50
52
  AccountRotateWebhookSigningKeyParams = Cadenya::Models::AccountRotateWebhookSigningKeyParams
51
53
 
52
54
  AccountSpec = Cadenya::Models::AccountSpec
@@ -219,6 +221,8 @@ module Cadenya
219
221
 
220
222
  ResourceMetadata = Cadenya::Models::ResourceMetadata
221
223
 
224
+ RotateChallengeTokenResponse = Cadenya::Models::RotateChallengeTokenResponse
225
+
222
226
  RotateWebhookSigningKeyResponse = Cadenya::Models::RotateWebhookSigningKeyResponse
223
227
 
224
228
  SearchSearchToolsOrToolSetsParams = Cadenya::Models::SearchSearchToolsOrToolSetsParams
@@ -24,6 +24,25 @@ module Cadenya
24
24
  )
25
25
  end
26
26
 
27
+ # Rotates the challenge token sent in the X-Cadenya-Challenge-Token header on MCP
28
+ # tools/list requests. Returns only the new token.
29
+ #
30
+ # @overload rotate_challenge_token(request_options: {})
31
+ #
32
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
33
+ #
34
+ # @return [Cadenya::Models::RotateChallengeTokenResponse]
35
+ #
36
+ # @see Cadenya::Models::AccountRotateChallengeTokenParams
37
+ def rotate_challenge_token(params = {})
38
+ @client.request(
39
+ method: :post,
40
+ path: "v1/account:rotateChallengeToken",
41
+ model: Cadenya::RotateChallengeTokenResponse,
42
+ options: params[:request_options]
43
+ )
44
+ end
45
+
27
46
  # Rotates the webhook signing key for the account. Returns only the new key.
28
47
  #
29
48
  # @overload rotate_webhook_signing_key(request_options: {})
@@ -20,17 +20,19 @@ module Cadenya
20
20
  #
21
21
  # Creates a new objective in the workspace
22
22
  #
23
- # @overload create(workspace_id, agent_id:, data:, episodic_memory: nil, initial_message: nil, memory_cascade: nil, metadata: nil, secrets: nil, user_data: nil, variation_id: nil, request_options: {})
23
+ # @overload create(workspace_id, agent_id:, system_prompt_data:, episodic_memory: nil, first_user_message: nil, first_user_message_data: nil, memory_cascade: nil, metadata: nil, secrets: nil, variation_id: nil, request_options: {})
24
24
  #
25
25
  # @param workspace_id [String]
26
26
  #
27
27
  # @param agent_id [String]
28
28
  #
29
- # @param data [Hash{Symbol=>Object}] Arbitrary data for the objective. May be used in liquid templates for prompts co
29
+ # @param system_prompt_data [Hash{Symbol=>Object}] Arbitrary data rendered into the selected variation's system_prompt_template
30
30
  #
31
31
  # @param episodic_memory [Cadenya::Models::ObjectiveCreateParams::EpisodicMemory] Episodic is used to configure the episodic memory for the objective
32
32
  #
33
- # @param initial_message [String] Optional override for the initial message sent to the agent. This becomes the fi
33
+ # @param first_user_message [String] Optional explicit first user message for the LLM chat history. When not set,
34
+ #
35
+ # @param first_user_message_data [Hash{Symbol=>Object}] Arbitrary data rendered into the selected variation's first_user_message_templat
34
36
  #
35
37
  # @param memory_cascade [Array<Cadenya::Models::MemoryReference>] Memory layers/entries layered over the baseline cascade inherited
36
38
  #
@@ -38,8 +40,6 @@ module Cadenya
38
40
  #
39
41
  # @param secrets [Array<Cadenya::Models::ObjectiveCreateParams::Secret>] Secrets that can be used in the headers for tool calls using the secret interpol
40
42
  #
41
- # @param user_data [Hash{Symbol=>Object}] Arbitrary data rendered into the selected variation's user_message_template
42
- #
43
43
  # @param variation_id [String] Optional explicit variation selection. Overrides the agent's variation_selection
44
44
  #
45
45
  # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -208,7 +208,7 @@ module Cadenya
208
208
  #
209
209
  # Continues an objective that has completed
210
210
  #
211
- # @overload continue(objective_id, workspace_id:, enqueue: nil, message: nil, secrets: nil, request_options: {})
211
+ # @overload continue(objective_id, workspace_id:, enqueue: nil, message: nil, request_options: {})
212
212
  #
213
213
  # @param objective_id [String] Path param: The ID of the objective. If you have assigned an external ID to the
214
214
  #
@@ -218,8 +218,6 @@ module Cadenya
218
218
  #
219
219
  # @param message [String] Body param: The message to continue an objective that has completed (or you are
220
220
  #
221
- # @param secrets [Array<Cadenya::Models::ObjectiveContinueParams::Secret>] Body param: Secrets that should be included with the message. Helpful for when y
222
- #
223
221
  # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
224
222
  #
225
223
  # @return [Cadenya::Models::ObjectiveEvent]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cadenya
4
- VERSION = "0.26.0"
4
+ VERSION = "0.28.0"
5
5
  end
data/lib/cadenya.rb CHANGED
@@ -60,6 +60,7 @@ require_relative "cadenya/models/account"
60
60
  require_relative "cadenya/models/account_info"
61
61
  require_relative "cadenya/models/account_resource_metadata"
62
62
  require_relative "cadenya/models/account_retrieve_params"
63
+ require_relative "cadenya/models/account_rotate_challenge_token_params"
63
64
  require_relative "cadenya/models/account_rotate_webhook_signing_key_params"
64
65
  require_relative "cadenya/models/account_spec"
65
66
  require_relative "cadenya/models/agent"
@@ -223,6 +224,7 @@ require_relative "cadenya/models/profile"
223
224
  require_relative "cadenya/models/profile_spec"
224
225
  require_relative "cadenya/models/profile_whoami_params"
225
226
  require_relative "cadenya/models/resource_metadata"
227
+ require_relative "cadenya/models/rotate_challenge_token_response"
226
228
  require_relative "cadenya/models/rotate_webhook_signing_key_response"
227
229
  require_relative "cadenya/models/search_search_tools_or_tool_sets_params"
228
230
  require_relative "cadenya/models/search_search_tools_or_tool_sets_response"
@@ -6,6 +6,17 @@ module Cadenya
6
6
  OrHash =
7
7
  T.type_alias { T.any(Cadenya::AccountInfo, Cadenya::Internal::AnyHash) }
8
8
 
9
+ # The challenge token Cadenya sends in the X-Cadenya-Challenge-Token header on
10
+ # every MCP tools/list request. Server implementations can accept a valid
11
+ # challenge token in place of per-user auth when listing tools, while still
12
+ # requiring real auth on tools/call. Rotate with RotateChallengeToken; update any
13
+ # servers validating the token before rotating.
14
+ sig { returns(T.nilable(String)) }
15
+ attr_reader :challenge_token
16
+
17
+ sig { params(challenge_token: String).void }
18
+ attr_writer :challenge_token
19
+
9
20
  # An API key for the account. Use workspace-association RPCs to grant the key
10
21
  # access to specific workspaces; a key with zero workspaces is valid but cannot
11
22
  # access workspace-scoped resources.
@@ -27,11 +38,18 @@ module Cadenya
27
38
  # Server-populated information about the account.
28
39
  sig do
29
40
  params(
41
+ challenge_token: String,
30
42
  global_api_key: Cadenya::APIKey::OrHash,
31
43
  webhook_events_hmac_secret: String
32
44
  ).returns(T.attached_class)
33
45
  end
34
46
  def self.new(
47
+ # The challenge token Cadenya sends in the X-Cadenya-Challenge-Token header on
48
+ # every MCP tools/list request. Server implementations can accept a valid
49
+ # challenge token in place of per-user auth when listing tools, while still
50
+ # requiring real auth on tools/call. Rotate with RotateChallengeToken; update any
51
+ # servers validating the token before rotating.
52
+ challenge_token: nil,
35
53
  # An API key for the account. Use workspace-association RPCs to grant the key
36
54
  # access to specific workspaces; a key with zero workspaces is valid but cannot
37
55
  # access workspace-scoped resources.
@@ -46,6 +64,7 @@ module Cadenya
46
64
  sig do
47
65
  override.returns(
48
66
  {
67
+ challenge_token: String,
49
68
  global_api_key: Cadenya::APIKey,
50
69
  webhook_events_hmac_secret: String
51
70
  }
@@ -0,0 +1,30 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class AccountRotateChallengeTokenParams < 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::AccountRotateChallengeTokenParams,
13
+ Cadenya::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ params(request_options: Cadenya::RequestOptions::OrHash).returns(
19
+ T.attached_class
20
+ )
21
+ end
22
+ def self.new(request_options: {})
23
+ end
24
+
25
+ sig { override.returns({ request_options: Cadenya::RequestOptions }) }
26
+ def to_hash
27
+ end
28
+ end
29
+ end
30
+ end
@@ -38,17 +38,6 @@ module Cadenya
38
38
  sig { params(episodic_memory_ttl: Integer).void }
39
39
  attr_writer :episodic_memory_ttl
40
40
 
41
- # InputDataSchema is used for enforcing a data input when objectives are created.
42
- # This is valuable when using liquid formatting in agent variation prompts. Input
43
- # data schema is also valuable when using an agent as a sub-agent, as the schema
44
- # is used as the tool's input parameter schema. If omitted, the sub-agent schema
45
- # will be loaded with a simple "prompt" free text string as its schema.
46
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
47
- attr_reader :input_data_schema
48
-
49
- sig { params(input_data_schema: T::Hash[Symbol, T.anything]).void }
50
- attr_writer :input_data_schema
51
-
52
41
  # Optional output definition for objectives created for this agent. When provided,
53
42
  # Cadenya will append a tool to that will be called by the LLM in use by the
54
43
  # variant to extract information in the format provided here. Use this option when
@@ -59,6 +48,20 @@ module Cadenya
59
48
  sig { params(output_definition: T::Hash[Symbol, T.anything]).void }
60
49
  attr_writer :output_definition
61
50
 
51
+ # SystemPromptDataSchema enforces the shape of system_prompt_data when objectives
52
+ # are created. This is valuable when using liquid formatting in agent variation
53
+ # system prompt templates. The schema is also used when the agent is attached as a
54
+ # sub-agent, as it becomes the tool's input parameter schema. If omitted, the
55
+ # sub-agent schema will be loaded with a simple "prompt" free text string as its
56
+ # schema.
57
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
58
+ attr_reader :system_prompt_data_schema
59
+
60
+ sig do
61
+ params(system_prompt_data_schema: T::Hash[Symbol, T.anything]).void
62
+ end
63
+ attr_writer :system_prompt_data_schema
64
+
62
65
  # The URL that Cadenya will send events for any objective assigned to the agent.
63
66
  sig { returns(T.nilable(String)) }
64
67
  attr_reader :webhook_events_url
@@ -74,8 +77,8 @@ module Cadenya
74
77
  description: String,
75
78
  enable_episodic_memory: T::Boolean,
76
79
  episodic_memory_ttl: Integer,
77
- input_data_schema: T::Hash[Symbol, T.anything],
78
80
  output_definition: T::Hash[Symbol, T.anything],
81
+ system_prompt_data_schema: T::Hash[Symbol, T.anything],
79
82
  webhook_events_url: String
80
83
  ).returns(T.attached_class)
81
84
  end
@@ -95,17 +98,18 @@ module Cadenya
95
98
  # layer's expiry forward by this duration, and stored entries expire this long
96
99
  # after they are written. If not set, episodic memories are retained indefinitely.
97
100
  episodic_memory_ttl: nil,
98
- # InputDataSchema is used for enforcing a data input when objectives are created.
99
- # This is valuable when using liquid formatting in agent variation prompts. Input
100
- # data schema is also valuable when using an agent as a sub-agent, as the schema
101
- # is used as the tool's input parameter schema. If omitted, the sub-agent schema
102
- # will be loaded with a simple "prompt" free text string as its schema.
103
- input_data_schema: nil,
104
101
  # Optional output definition for objectives created for this agent. When provided,
105
102
  # Cadenya will append a tool to that will be called by the LLM in use by the
106
103
  # variant to extract information in the format provided here. Use this option when
107
104
  # you want structured data to be created by your objectives.
108
105
  output_definition: nil,
106
+ # SystemPromptDataSchema enforces the shape of system_prompt_data when objectives
107
+ # are created. This is valuable when using liquid formatting in agent variation
108
+ # system prompt templates. The schema is also used when the agent is attached as a
109
+ # sub-agent, as it becomes the tool's input parameter schema. If omitted, the
110
+ # sub-agent schema will be loaded with a simple "prompt" free text string as its
111
+ # schema.
112
+ system_prompt_data_schema: nil,
109
113
  # The URL that Cadenya will send events for any objective assigned to the agent.
110
114
  webhook_events_url: nil
111
115
  )
@@ -119,8 +123,8 @@ module Cadenya
119
123
  description: String,
120
124
  enable_episodic_memory: T::Boolean,
121
125
  episodic_memory_ttl: Integer,
122
- input_data_schema: T::Hash[Symbol, T.anything],
123
126
  output_definition: T::Hash[Symbol, T.anything],
127
+ system_prompt_data_schema: T::Hash[Symbol, T.anything],
124
128
  webhook_events_url: String
125
129
  }
126
130
  )
@@ -27,22 +27,23 @@ module Cadenya
27
27
  end
28
28
  attr_writer :schedule
29
29
 
30
- # Optional input data passed to the objective. If the agent has an
31
- # input_data_schema, this must satisfy it.
32
- sig { returns(T.nilable(T.anything)) }
33
- attr_reader :data
30
+ # Optional explicit first user message passed to CreateObjective on each fire.
31
+ # Becomes the first user message in the objective's chat history. When unset, the
32
+ # fired objective defers to the selected variation's first_user_message_template.
33
+ sig { returns(T.nilable(String)) }
34
+ attr_reader :first_user_message
34
35
 
35
- sig { params(data: T.anything).void }
36
- attr_writer :data
36
+ sig { params(first_user_message: String).void }
37
+ attr_writer :first_user_message
37
38
 
38
- # Optional initial message passed to CreateObjective on each fire. Becomes the
39
- # first user message in the objective's chat history. When unset, the fired
40
- # objective defers to the selected variation's user_message_template.
41
- sig { returns(T.nilable(String)) }
42
- attr_reader :initial_message
39
+ # Optional data rendered into the variation's first_user_message_template when
40
+ # each fired objective is created. Separate from `system_prompt_data`, which
41
+ # renders the system prompt template.
42
+ sig { returns(T.nilable(T.anything)) }
43
+ attr_reader :first_user_message_data
43
44
 
44
- sig { params(initial_message: String).void }
45
- attr_writer :initial_message
45
+ sig { params(first_user_message_data: T.anything).void }
46
+ attr_writer :first_user_message_data
46
47
 
47
48
  # What to do when the previous run is still in flight. Defaults to SKIP.
48
49
  sig do
@@ -62,14 +63,14 @@ module Cadenya
62
63
  end
63
64
  attr_writer :overlap_policy
64
65
 
65
- # Optional data rendered into the variation's user_message_template when each
66
- # fired objective is created. Separate from `data`, which renders the system
67
- # prompt template.
66
+ # Optional data rendered into the variation's system_prompt_template when each
67
+ # fired objective is created. If the agent has a system_prompt_data_schema, this
68
+ # must satisfy it.
68
69
  sig { returns(T.nilable(T.anything)) }
69
- attr_reader :user_data
70
+ attr_reader :system_prompt_data
70
71
 
71
- sig { params(user_data: T.anything).void }
72
- attr_writer :user_data
72
+ sig { params(system_prompt_data: T.anything).void }
73
+ attr_writer :system_prompt_data
73
74
 
74
75
  # Optional explicit variation. When unset, the agent's variation_selection_mode
75
76
  # chooses per fire.
@@ -83,11 +84,11 @@ module Cadenya
83
84
  sig do
84
85
  params(
85
86
  schedule: Cadenya::Agents::AgentScheduleSpecSchedule::OrHash,
86
- data: T.anything,
87
- initial_message: String,
87
+ first_user_message: String,
88
+ first_user_message_data: T.anything,
88
89
  overlap_policy:
89
90
  Cadenya::Agents::AgentScheduleSpec::OverlapPolicy::OrSymbol,
90
- user_data: T.anything,
91
+ system_prompt_data: T.anything,
91
92
  variation_id: String
92
93
  ).returns(T.attached_class)
93
94
  end
@@ -96,19 +97,20 @@ module Cadenya
96
97
  # of calendar rules (wall-clock) and/or interval rules (duration), OR'd together.
97
98
  # At least one rule is required.
98
99
  schedule:,
99
- # Optional input data passed to the objective. If the agent has an
100
- # input_data_schema, this must satisfy it.
101
- data: nil,
102
- # Optional initial message passed to CreateObjective on each fire. Becomes the
103
- # first user message in the objective's chat history. When unset, the fired
104
- # objective defers to the selected variation's user_message_template.
105
- initial_message: nil,
100
+ # Optional explicit first user message passed to CreateObjective on each fire.
101
+ # Becomes the first user message in the objective's chat history. When unset, the
102
+ # fired objective defers to the selected variation's first_user_message_template.
103
+ first_user_message: nil,
104
+ # Optional data rendered into the variation's first_user_message_template when
105
+ # each fired objective is created. Separate from `system_prompt_data`, which
106
+ # renders the system prompt template.
107
+ first_user_message_data: nil,
106
108
  # What to do when the previous run is still in flight. Defaults to SKIP.
107
109
  overlap_policy: nil,
108
- # Optional data rendered into the variation's user_message_template when each
109
- # fired objective is created. Separate from `data`, which renders the system
110
- # prompt template.
111
- user_data: nil,
110
+ # Optional data rendered into the variation's system_prompt_template when each
111
+ # fired objective is created. If the agent has a system_prompt_data_schema, this
112
+ # must satisfy it.
113
+ system_prompt_data: nil,
112
114
  # Optional explicit variation. When unset, the agent's variation_selection_mode
113
115
  # chooses per fire.
114
116
  variation_id: nil
@@ -119,11 +121,11 @@ module Cadenya
119
121
  override.returns(
120
122
  {
121
123
  schedule: Cadenya::Agents::AgentScheduleSpecSchedule,
122
- data: T.anything,
123
- initial_message: String,
124
+ first_user_message: String,
125
+ first_user_message_data: T.anything,
124
126
  overlap_policy:
125
127
  Cadenya::Agents::AgentScheduleSpec::OverlapPolicy::OrSymbol,
126
- user_data: T.anything,
128
+ system_prompt_data: T.anything,
127
129
  variation_id: String
128
130
  }
129
131
  )
@@ -51,6 +51,18 @@ module Cadenya
51
51
  sig { params(description: String).void }
52
52
  attr_writer :description
53
53
 
54
+ # Liquid template for the first user message of objectives using this variation.
55
+ # Rendered with CreateObjectiveRequest.first_user_message_data into
56
+ # Objective.first_user_message, the first user message in the LLM chat history.
57
+ # CreateObjectiveRequest.first_user_message, when set, overrides the rendered
58
+ # result. If neither this template nor first_user_message is present, objective
59
+ # creation is rejected with InvalidArgument.
60
+ sig { returns(T.nilable(String)) }
61
+ attr_reader :first_user_message_template
62
+
63
+ sig { params(first_user_message_template: String).void }
64
+ attr_writer :first_user_message_template
65
+
54
66
  # ModelConfig defines the model configuration for a variation
55
67
  sig do
56
68
  returns(T.nilable(Cadenya::Agents::AgentVariationSpecModelConfig))
@@ -85,24 +97,14 @@ module Cadenya
85
97
  attr_writer :progressive_discovery
86
98
 
87
99
  # Liquid template for the system prompt of objectives using this variation.
88
- # Rendered with CreateObjectiveRequest.data into Objective.system_prompt.
100
+ # Rendered with CreateObjectiveRequest.system_prompt_data into
101
+ # Objective.system_prompt.
89
102
  sig { returns(T.nilable(String)) }
90
103
  attr_reader :system_prompt_template
91
104
 
92
105
  sig { params(system_prompt_template: String).void }
93
106
  attr_writer :system_prompt_template
94
107
 
95
- # Liquid template for the initial user message of objectives using this variation.
96
- # Rendered with CreateObjectiveRequest.user_data and becomes the first user
97
- # message in the LLM chat history. CreateObjectiveRequest.initial_message, when
98
- # set, overrides the rendered result. If neither this template nor initial_message
99
- # is present, objective creation is rejected with InvalidArgument.
100
- sig { returns(T.nilable(String)) }
101
- attr_reader :user_message_template
102
-
103
- sig { params(user_message_template: String).void }
104
- attr_writer :user_message_template
105
-
106
108
  # Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights).
107
109
  # Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0
108
110
  # means never auto-selected, but can still be chosen explicitly via variation_id
@@ -120,12 +122,12 @@ module Cadenya
120
122
  Cadenya::Agents::AgentVariationSpecCompactionConfig::OrHash,
121
123
  constraints: Cadenya::Agents::AgentVariationSpecConstraints::OrHash,
122
124
  description: String,
125
+ first_user_message_template: String,
123
126
  model_config:
124
127
  Cadenya::Agents::AgentVariationSpecModelConfig::OrHash,
125
128
  progressive_discovery:
126
129
  Cadenya::Agents::AgentVariationSpecProgressiveDiscovery::OrHash,
127
130
  system_prompt_template: String,
128
- user_message_template: String,
129
131
  weight: Integer
130
132
  ).returns(T.attached_class)
131
133
  end
@@ -137,6 +139,13 @@ module Cadenya
137
139
  constraints: nil,
138
140
  # Human-readable description of what this variation does or when it should be used
139
141
  description: nil,
142
+ # Liquid template for the first user message of objectives using this variation.
143
+ # Rendered with CreateObjectiveRequest.first_user_message_data into
144
+ # Objective.first_user_message, the first user message in the LLM chat history.
145
+ # CreateObjectiveRequest.first_user_message, when set, overrides the rendered
146
+ # result. If neither this template nor first_user_message is present, objective
147
+ # creation is rejected with InvalidArgument.
148
+ first_user_message_template: nil,
140
149
  # ModelConfig defines the model configuration for a variation
141
150
  model_config: nil,
142
151
  # ProgressiveDiscovery is used to indicate that the agent should automatically
@@ -146,14 +155,9 @@ module Cadenya
146
155
  # and can help select the best tools for the task.
147
156
  progressive_discovery: nil,
148
157
  # Liquid template for the system prompt of objectives using this variation.
149
- # Rendered with CreateObjectiveRequest.data into Objective.system_prompt.
158
+ # Rendered with CreateObjectiveRequest.system_prompt_data into
159
+ # Objective.system_prompt.
150
160
  system_prompt_template: nil,
151
- # Liquid template for the initial user message of objectives using this variation.
152
- # Rendered with CreateObjectiveRequest.user_data and becomes the first user
153
- # message in the LLM chat history. CreateObjectiveRequest.initial_message, when
154
- # set, overrides the rendered result. If neither this template nor initial_message
155
- # is present, objective creation is rejected with InvalidArgument.
156
- user_message_template: nil,
157
161
  # Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights).
158
162
  # Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0
159
163
  # means never auto-selected, but can still be chosen explicitly via variation_id
@@ -169,11 +173,11 @@ module Cadenya
169
173
  Cadenya::Agents::AgentVariationSpecCompactionConfig,
170
174
  constraints: Cadenya::Agents::AgentVariationSpecConstraints,
171
175
  description: String,
176
+ first_user_message_template: String,
172
177
  model_config: Cadenya::Agents::AgentVariationSpecModelConfig,
173
178
  progressive_discovery:
174
179
  Cadenya::Agents::AgentVariationSpecProgressiveDiscovery,
175
180
  system_prompt_template: String,
176
- user_message_template: String,
177
181
  weight: Integer
178
182
  }
179
183
  )
@@ -228,6 +228,11 @@ module Cadenya
228
228
  :OBJECTIVE_EVENT_TYPE_FINALIZED,
229
229
  Cadenya::Agents::WebhookDeliveryData::EventType::TaggedSymbol
230
230
  )
231
+ OBJECTIVE_EVENT_TYPE_NOTICE =
232
+ T.let(
233
+ :OBJECTIVE_EVENT_TYPE_NOTICE,
234
+ Cadenya::Agents::WebhookDeliveryData::EventType::TaggedSymbol
235
+ )
231
236
 
232
237
  sig do
233
238
  override.returns(
@@ -197,6 +197,11 @@ module Cadenya
197
197
  :OBJECTIVE_EVENT_TYPE_FINALIZED,
198
198
  Cadenya::Agents::WebhookDeliveryListParams::EventType::TaggedSymbol
199
199
  )
200
+ OBJECTIVE_EVENT_TYPE_NOTICE =
201
+ T.let(
202
+ :OBJECTIVE_EVENT_TYPE_NOTICE,
203
+ Cadenya::Agents::WebhookDeliveryListParams::EventType::TaggedSymbol
204
+ )
200
205
 
201
206
  sig do
202
207
  override.returns(