cadenya 1.6.0 → 1.8.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: ae66411f710ec4a8a1179bb0808b5d2a833e23941002f10e306f0740c13330c2
4
- data.tar.gz: 38707e94f11ebd1852aef385b9a61421aee21071b6fab2c59b9c3606a8f8e4a6
3
+ metadata.gz: 46343a16c9b5115f974c1adece9ea3a9c73545c874d8e49bc722f729555aca6e
4
+ data.tar.gz: 3410780a17133cdc51db580b522d1dfc65f31f05b4c433da87fd5b2568b3ba27
5
5
  SHA512:
6
- metadata.gz: 20431f93c5ef100493776c4c36a2b70a0ca01ff14493c419df5f31e637cedaffd2a3b8f2b93144bc3bf3d19186e618b9c3dec4e37d5deb6ff19435dd540a5ba9
7
- data.tar.gz: 2080ef8b4f1c54c33760380a2c9da415a43ce581c2eb48b1164104bcf360ad3067ffd3dce09082edbf69b94723df7206d0854ce63930688a28bb72d6e2d0dfdd
6
+ metadata.gz: ad7711a70eb3536b373ce2b600ba4b67fb5d6c2f84e529d107e3591dffaa3a52ad34fd589a83b3fa3d6296bcca60760ce58ad20726b6212afb0dbd0df73c9cab
7
+ data.tar.gz: f67228827825272d48f09744da5168e551c5cf561abe7a4c1fc716c2c5e3df258b38ac27580b12ba8394afba08b39744cf4a4865140078ac2fdbd151ece18377
data/README.md CHANGED
@@ -31,7 +31,7 @@ JSON/map fields is never rewritten.
31
31
  ```ruby
32
32
  client.api_keys.create(
33
33
  metadata: {"name" => "sample"},
34
- spec: {}
34
+ spec: {"all_workspaces" => true, "workspace_assignments" => [{"workspace_id" => "sample"}]}
35
35
  )
36
36
  ```
37
37
 
data/api.md CHANGED
@@ -22,65 +22,60 @@ client.accounts.rotate_webhook_signing_key() # => Cadenya::Types::RotateWebhookE
22
22
 
23
23
  ## client.api_keys
24
24
 
25
- Get the global API key
26
-
27
- ```ruby
28
- client.api_keys.retrieve_global() # => Cadenya::Types::APIKey
29
- ```
30
- Disable the global API key
25
+ List API keys
31
26
 
32
27
  ```ruby
33
- client.api_keys.disable_global() # => Cadenya::Types::APIKey
28
+ client.api_keys.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::APIKey
34
29
  ```
35
- Enable the global API key
30
+ Create a new API key
36
31
 
37
32
  ```ruby
38
- client.api_keys.enable_global() # => Cadenya::Types::APIKey
33
+ client.api_keys.create(metadata:, spec:) # => Cadenya::Types::APIKey
39
34
  ```
40
- Rotate the global API key
35
+ Get an API key by ID
41
36
 
42
37
  ```ruby
43
- client.api_keys.rotate_global() # => Cadenya::Types::APIKey
38
+ client.api_keys.retrieve(id) # => Cadenya::Types::APIKey
44
39
  ```
45
- List API keys
40
+ Delete an API key
46
41
 
47
42
  ```ruby
48
- client.api_keys.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::APIKey
43
+ client.api_keys.delete(id) # => nil
49
44
  ```
50
- Create a new API key
45
+ Update an API key
51
46
 
52
47
  ```ruby
53
- client.api_keys.create(metadata:, spec:, workspace_id: nil) # => Cadenya::Types::APIKey
48
+ client.api_keys.update(id, metadata: nil, spec: nil, update_mask: nil) # => Cadenya::Types::APIKey
54
49
  ```
55
- Get an API key by ID
50
+ Assign a workspace to an API key
56
51
 
57
52
  ```ruby
58
- client.api_keys.retrieve(id, workspace_id: nil) # => Cadenya::Types::APIKey
53
+ client.api_keys.add_workspace(id, workspace_id:) # => Cadenya::Types::APIKey
59
54
  ```
60
- Delete an API key
55
+ Disable an API key
61
56
 
62
57
  ```ruby
63
- client.api_keys.delete(id, workspace_id: nil) # => nil
58
+ client.api_keys.disable(id) # => Cadenya::Types::APIKey
64
59
  ```
65
- Update an API key
60
+ Enable an API key
66
61
 
67
62
  ```ruby
68
- client.api_keys.update(id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil) # => Cadenya::Types::APIKey
63
+ client.api_keys.enable(id) # => Cadenya::Types::APIKey
69
64
  ```
70
- Disable an API key
65
+ Remove a workspace from an API key
71
66
 
72
67
  ```ruby
73
- client.api_keys.disable(id, workspace_id: nil) # => Cadenya::Types::APIKey
68
+ client.api_keys.remove_workspace(id, workspace_id:) # => Cadenya::Types::APIKey
74
69
  ```
75
- Enable an API key
70
+ Reveal an API key's token
76
71
 
77
72
  ```ruby
78
- client.api_keys.enable(id, workspace_id: nil) # => Cadenya::Types::APIKey
73
+ client.api_keys.reveal(id) # => Cadenya::Types::APIKey
79
74
  ```
80
75
  Rotate an API key
81
76
 
82
77
  ```ruby
83
- client.api_keys.rotate(id, workspace_id: nil) # => Cadenya::Types::APIKey
78
+ client.api_keys.rotate(id) # => Cadenya::Types::APIKey
84
79
  ```
85
80
 
86
81
  ## client.workspace_admin
@@ -131,12 +126,40 @@ Remove a member from a workspace
131
126
  client.workspace_admin.remove_member(profile_id, workspace_id: nil) # => nil
132
127
  ```
133
128
 
129
+ ## client.trusted_endpoints
130
+
131
+ List trusted endpoints
132
+
133
+ ```ruby
134
+ client.trusted_endpoints.list(limit: nil, cursor: nil, labels: nil) # => Cadenya::Page of Cadenya::Types::TrustedEndpoint
135
+ ```
136
+ Create a trusted endpoint
137
+
138
+ ```ruby
139
+ client.trusted_endpoints.create(metadata:, spec:) # => Cadenya::Types::TrustedEndpoint
140
+ ```
141
+ Get a trusted endpoint by ID
142
+
143
+ ```ruby
144
+ client.trusted_endpoints.retrieve(id) # => Cadenya::Types::TrustedEndpoint
145
+ ```
146
+ Delete a trusted endpoint
147
+
148
+ ```ruby
149
+ client.trusted_endpoints.delete(id) # => nil
150
+ ```
151
+ Verify a URL against the trusted endpoints
152
+
153
+ ```ruby
154
+ client.trusted_endpoints.verify(url:) # => Cadenya::Types::VerifyTrustedEndpointResponse
155
+ ```
156
+
134
157
  ## client.profiles
135
158
 
136
159
  Retrieves the profile for the credentials accessing the API
137
160
 
138
161
  ```ruby
139
- client.profiles.whoami() # => Cadenya::Types::Profile
162
+ client.profiles.whoami() # => Cadenya::Types::WhoamiResponse
140
163
  ```
141
164
 
142
165
  ## client.workspaces
@@ -420,12 +443,12 @@ client.models.swap_on_variations(workspace_id: nil, model_swaps: nil) # => nil
420
443
  List memory layers
421
444
 
422
445
  ```ruby
423
- client.memory_layers.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::MemoryLayer
446
+ client.memory_layers.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, tenant_id: nil, subject_id: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::MemoryLayer
424
447
  ```
425
448
  Create a new memory layer
426
449
 
427
450
  ```ruby
428
- client.memory_layers.create(metadata:, spec:, workspace_id: nil) # => Cadenya::Types::MemoryLayer
451
+ client.memory_layers.create(metadata:, spec:, workspace_id: nil, tenant: nil, subject: nil) # => Cadenya::Types::MemoryLayer
429
452
  ```
430
453
  Get a memory layer by ID
431
454
 
@@ -481,7 +504,7 @@ client.objectives.list(workspace_id: nil, limit: nil, cursor: nil, agent_id: nil
481
504
  Create a new objective
482
505
 
483
506
  ```ruby
484
- client.objectives.create(agent_id:, system_prompt_data:, workspace_id: nil, variation_id: nil, metadata: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil) # => Cadenya::Types::Objective
507
+ client.objectives.create(agent_id:, workspace_id: nil, variation_id: nil, metadata: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil) # => Cadenya::Types::Objective
485
508
  ```
486
509
  Get an objective by ID
487
510
 
@@ -518,6 +541,16 @@ Submit feedback for an objective
518
541
  ```ruby
519
542
  client.objectives.create_feedback(objective_id, metadata:, data:, workspace_id: nil) # => Cadenya::Types::ObjectiveFeedback
520
543
  ```
544
+ List objective queued actions
545
+
546
+ ```ruby
547
+ client.objectives.list_queued_actions(objective_id, workspace_id: nil, limit: nil, cursor: nil, state: nil) # => Cadenya::Page of Cadenya::Types::ObjectiveQueuedAction
548
+ ```
549
+ Remove a queued action
550
+
551
+ ```ruby
552
+ client.objectives.remove_queued_action(objective_id, queued_action_id:, workspace_id: nil) # => Cadenya::Types::ObjectiveQueuedAction
553
+ ```
521
554
  List objective tool calls
522
555
 
523
556
  ```ruby
@@ -556,12 +589,22 @@ client.objectives.cancel(objective_id, workspace_id: nil, reason: nil) # => Cade
556
589
  Compact an objective
557
590
 
558
591
  ```ruby
559
- client.objectives.compact(objective_id, workspace_id: nil, compaction_config: nil) # => Cadenya::Types::CompactObjectiveResponse
592
+ client.objectives.compact(objective_id, workspace_id: nil, compaction_config: nil) # => Cadenya::Types::ObjectiveQueuedAction
560
593
  ```
561
594
  Continue an objective
562
595
 
563
596
  ```ruby
564
- client.objectives.continue(objective_id, message:, workspace_id: nil, enqueue: nil) # => Cadenya::Types::ObjectiveEvent
597
+ client.objectives.continue(objective_id, message:, workspace_id: nil, enqueue: nil) # => Cadenya::Types::ContinueObjectiveResponse
598
+ ```
599
+ Interrupt an objective
600
+
601
+ ```ruby
602
+ client.objectives.interrupt(objective_id, workspace_id: nil) # => Cadenya::Types::ObjectiveEvent
603
+ ```
604
+ Create an objective and stream its events
605
+
606
+ ```ruby
607
+ client.objectives.create_and_stream(agent_id:, metadata:, workspace_id: nil, variation_id: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, last_event_id: nil) # => Cadenya::Stream
565
608
  ```
566
609
 
567
610
  ## client.tool_search
@@ -8,7 +8,7 @@ module Cadenya
8
8
  # The Cadenya API client. Resource groups are readers; unset options are
9
9
  # read from the environment.
10
10
  class Client
11
- attr_reader :accounts, :api_keys, :workspace_admin, :profiles, :workspaces, :agent_pools, :agents, :ai_provider_keys, :models, :memory_layers, :objectives, :tool_search, :tenants, :tool_sets, :uploads, :widget_sessions, :widgets, :workspace_secrets
11
+ attr_reader :accounts, :api_keys, :workspace_admin, :trusted_endpoints, :profiles, :workspaces, :agent_pools, :agents, :ai_provider_keys, :models, :memory_layers, :objectives, :tool_search, :tenants, :tool_sets, :uploads, :widget_sessions, :widgets, :workspace_secrets
12
12
 
13
13
  def initialize(api_key: nil, base_url: nil, webhook_secret: nil, max_retries: 0, connection: nil, stream_transport: nil, workspace_id: nil)
14
14
  if !api_key.nil? && api_key.to_s.strip.empty?
@@ -37,13 +37,14 @@ module Cadenya
37
37
  auth_header: ["Authorization", "Bearer #{api_key}"],
38
38
  max_retries: max_retries,
39
39
  defaults: defaults,
40
- user_agent: "cadenya-ruby/1.5.0 (api 1.0)",
40
+ user_agent: "cadenya-ruby/1.7.0 (api 1.0)",
41
41
  connection: connection,
42
42
  stream_transport: stream_transport
43
43
  )
44
44
  @accounts = Resources::Accounts.new(core)
45
45
  @api_keys = Resources::ApiKeys.new(core)
46
46
  @workspace_admin = Resources::WorkspaceAdmin.new(core)
47
+ @trusted_endpoints = Resources::TrustedEndpoints.new(core)
47
48
  @profiles = Resources::Profiles.new(core)
48
49
  @workspaces = Resources::Workspaces.new(core)
49
50
  @agent_pools = Resources::AgentPools.new(core)
@@ -9,39 +9,12 @@ module Cadenya
9
9
  @core = core
10
10
  end
11
11
 
12
- # Get the global API key
13
- def retrieve_global(request_options: nil)
14
- _path = "/v1/account/global_api_key"
15
- _data = @core.request(:get, _path, request_options: request_options)
16
- Types::APIKey.from_json(_data)
17
- end
18
-
19
- # Disable the global API key
20
- def disable_global(request_options: nil)
21
- _path = "/v1/account/global_api_key:disable"
22
- _data = @core.request(:post, _path, request_options: request_options)
23
- Types::APIKey.from_json(_data)
24
- end
25
-
26
- # Enable the global API key
27
- def enable_global(request_options: nil)
28
- _path = "/v1/account/global_api_key:enable"
29
- _data = @core.request(:post, _path, request_options: request_options)
30
- Types::APIKey.from_json(_data)
31
- end
32
-
33
- # Rotate the global API key
34
- def rotate_global(request_options: nil)
35
- _path = "/v1/account/global_api_key:rotate"
36
- _data = @core.request(:post, _path, request_options: request_options)
37
- Types::APIKey.from_json(_data)
38
- end
39
-
40
12
  # List API keys
41
13
  def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, labels: nil, sort_order: nil, include_info: nil, request_options: nil)
42
14
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
43
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys"
15
+ _path = "/v1/account/api_keys"
44
16
  _query = {
17
+ "workspaceId" => workspace_id,
45
18
  "limit" => limit,
46
19
  "cursor" => cursor,
47
20
  "prefix" => prefix,
@@ -59,9 +32,8 @@ module Cadenya
59
32
  end
60
33
 
61
34
  # Create a new API key
62
- def create(metadata:, spec:, workspace_id: nil, request_options: nil)
63
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
64
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys"
35
+ def create(metadata:, spec:, request_options: nil)
36
+ _path = "/v1/account/api_keys"
65
37
  _body = {
66
38
  "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateAccountResourceMetadata(_v) }).call(metadata),
67
39
  "spec" => spec.nil? ? nil : (->(_v) { Types.encode_APIKeySpec(_v) }).call(spec),
@@ -71,25 +43,22 @@ module Cadenya
71
43
  end
72
44
 
73
45
  # Get an API key by ID
74
- def retrieve(id, workspace_id: nil, request_options: nil)
75
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
76
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}"
46
+ def retrieve(id, request_options: nil)
47
+ _path = "/v1/account/api_keys/#{Util.path_param('id', id)}"
77
48
  _data = @core.request(:get, _path, request_options: request_options)
78
49
  Types::APIKey.from_json(_data)
79
50
  end
80
51
 
81
52
  # Delete an API key
82
- def delete(id, workspace_id: nil, request_options: nil)
83
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
84
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}"
53
+ def delete(id, request_options: nil)
54
+ _path = "/v1/account/api_keys/#{Util.path_param('id', id)}"
85
55
  @core.request(:delete, _path, expects_body: false, request_options: request_options)
86
56
  nil
87
57
  end
88
58
 
89
59
  # Update an API key
90
- def update(id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil, request_options: nil)
91
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
92
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}"
60
+ def update(id, metadata: nil, spec: nil, update_mask: nil, request_options: nil)
61
+ _path = "/v1/account/api_keys/#{Util.path_param('id', id)}"
93
62
  _body = {
94
63
  "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_UpdateAccountResourceMetadata(_v) }).call(metadata),
95
64
  "spec" => spec.nil? ? nil : (->(_v) { Types.encode_APIKeySpec(_v) }).call(spec),
@@ -99,26 +68,50 @@ module Cadenya
99
68
  Types::APIKey.from_json(_data)
100
69
  end
101
70
 
71
+ # Assign a workspace to an API key
72
+ def add_workspace(id, workspace_id:, request_options: nil)
73
+ _path = "/v1/account/api_keys/#{Util.path_param('id', id)}:addWorkspace"
74
+ _body = {
75
+ "workspaceId" => workspace_id,
76
+ }.reject { |_k, v| v.nil? }
77
+ _data = @core.request(:post, _path, body: _body, request_options: request_options)
78
+ Types::APIKey.from_json(_data)
79
+ end
80
+
102
81
  # Disable an API key
103
- def disable(id, workspace_id: nil, request_options: nil)
104
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
105
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}:disable"
82
+ def disable(id, request_options: nil)
83
+ _path = "/v1/account/api_keys/#{Util.path_param('id', id)}:disable"
106
84
  _data = @core.request(:post, _path, request_options: request_options)
107
85
  Types::APIKey.from_json(_data)
108
86
  end
109
87
 
110
88
  # Enable an API key
111
- def enable(id, workspace_id: nil, request_options: nil)
112
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
113
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}:enable"
89
+ def enable(id, request_options: nil)
90
+ _path = "/v1/account/api_keys/#{Util.path_param('id', id)}:enable"
91
+ _data = @core.request(:post, _path, request_options: request_options)
92
+ Types::APIKey.from_json(_data)
93
+ end
94
+
95
+ # Remove a workspace from an API key
96
+ def remove_workspace(id, workspace_id:, request_options: nil)
97
+ _path = "/v1/account/api_keys/#{Util.path_param('id', id)}:removeWorkspace"
98
+ _body = {
99
+ "workspaceId" => workspace_id,
100
+ }.reject { |_k, v| v.nil? }
101
+ _data = @core.request(:post, _path, body: _body, request_options: request_options)
102
+ Types::APIKey.from_json(_data)
103
+ end
104
+
105
+ # Reveal an API key's token
106
+ def reveal(id, request_options: nil)
107
+ _path = "/v1/account/api_keys/#{Util.path_param('id', id)}:reveal"
114
108
  _data = @core.request(:post, _path, request_options: request_options)
115
109
  Types::APIKey.from_json(_data)
116
110
  end
117
111
 
118
112
  # Rotate an API key
119
- def rotate(id, workspace_id: nil, request_options: nil)
120
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
121
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}:rotate"
113
+ def rotate(id, request_options: nil)
114
+ _path = "/v1/account/api_keys/#{Util.path_param('id', id)}:rotate"
122
115
  _data = @core.request(:post, _path, request_options: request_options)
123
116
  Types::APIKey.from_json(_data)
124
117
  end
@@ -13,7 +13,7 @@ module Cadenya
13
13
  end
14
14
 
15
15
  # List memory layers
16
- def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, sort_order: nil, include_info: nil, request_options: nil)
16
+ def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, tenant_id: nil, subject_id: nil, sort_order: nil, include_info: nil, request_options: nil)
17
17
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
18
18
  _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/memory_layers"
19
19
  _query = {
@@ -25,6 +25,8 @@ module Cadenya
25
25
  "agentId" => agent_id,
26
26
  "episodicKeyPrefix" => episodic_key_prefix,
27
27
  "labels" => labels,
28
+ "tenantId" => tenant_id,
29
+ "subjectId" => subject_id,
28
30
  "sortOrder" => sort_order,
29
31
  "includeInfo" => include_info,
30
32
  }
@@ -32,17 +34,19 @@ module Cadenya
32
34
  _items = (_data["items"] || []).map { |item| Types::MemoryLayer.from_json(item) }
33
35
  _next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
34
36
  Page.new(_items, _next_cursor) do |_c|
35
- list(workspace_id: workspace_id, limit: limit, cursor: _c, prefix: prefix, query: query, type: type, agent_id: agent_id, episodic_key_prefix: episodic_key_prefix, labels: labels, sort_order: sort_order, include_info: include_info, request_options: request_options)
37
+ list(workspace_id: workspace_id, limit: limit, cursor: _c, prefix: prefix, query: query, type: type, agent_id: agent_id, episodic_key_prefix: episodic_key_prefix, labels: labels, tenant_id: tenant_id, subject_id: subject_id, sort_order: sort_order, include_info: include_info, request_options: request_options)
36
38
  end
37
39
  end
38
40
 
39
41
  # Create a new memory layer
40
- def create(metadata:, spec:, workspace_id: nil, request_options: nil)
42
+ def create(metadata:, spec:, workspace_id: nil, tenant: nil, subject: nil, request_options: nil)
41
43
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
42
44
  _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/memory_layers"
43
45
  _body = {
44
46
  "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateResourceMetadata(_v) }).call(metadata),
45
47
  "spec" => spec.nil? ? nil : (->(_v) { Types.encode_MemoryLayerSpec(_v) }).call(spec),
48
+ "tenant" => tenant.nil? ? nil : (->(_v) { Types.encode_TenantAssertion(_v) }).call(tenant),
49
+ "subject" => subject.nil? ? nil : (->(_v) { Types.encode_SubjectAssertion(_v) }).call(subject),
46
50
  }.reject { |_k, v| v.nil? }
47
51
  _data = @core.request(:post, _path, body: _body, request_options: request_options)
48
52
  Types::MemoryLayer.from_json(_data)
@@ -38,7 +38,7 @@ module Cadenya
38
38
  end
39
39
 
40
40
  # Create a new objective
41
- def create(agent_id:, system_prompt_data:, workspace_id: nil, variation_id: nil, metadata: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, request_options: nil)
41
+ def create(agent_id:, workspace_id: nil, variation_id: nil, metadata: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, request_options: nil)
42
42
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
43
43
  _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives"
44
44
  _body = {
@@ -155,6 +155,31 @@ module Cadenya
155
155
  Types::ObjectiveFeedback.from_json(_data)
156
156
  end
157
157
 
158
+ # List objective queued actions
159
+ def list_queued_actions(objective_id, workspace_id: nil, limit: nil, cursor: nil, state: nil, request_options: nil)
160
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
161
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives/#{Util.path_param('objectiveId', objective_id)}/queued_actions"
162
+ _query = {
163
+ "limit" => limit,
164
+ "cursor" => cursor,
165
+ "state" => state,
166
+ }
167
+ _data = @core.request(:get, _path, query: _query, request_options: request_options) || {}
168
+ _items = (_data["items"] || []).map { |item| Types::ObjectiveQueuedAction.from_json(item) }
169
+ _next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
170
+ Page.new(_items, _next_cursor) do |_c|
171
+ list_queued_actions(objective_id, workspace_id: workspace_id, limit: limit, cursor: _c, state: state, request_options: request_options)
172
+ end
173
+ end
174
+
175
+ # Remove a queued action
176
+ def remove_queued_action(objective_id, queued_action_id:, workspace_id: nil, request_options: nil)
177
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
178
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives/#{Util.path_param('objectiveId', objective_id)}/queued_actions/#{Util.path_param('queuedActionId', queued_action_id)}:remove"
179
+ _data = @core.request(:post, _path, request_options: request_options)
180
+ Types::ObjectiveQueuedAction.from_json(_data)
181
+ end
182
+
158
183
  # List objective tool calls
159
184
  def list_tool_calls(objective_id, workspace_id: nil, limit: nil, cursor: nil, status: nil, include_info: nil, execution_status: nil, labels: nil, request_options: nil)
160
185
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
@@ -248,7 +273,7 @@ module Cadenya
248
273
  "compactionConfig" => compaction_config.nil? ? nil : (->(_v) { Types.encode_AgentVariationSpec_CompactionConfig(_v) }).call(compaction_config),
249
274
  }.reject { |_k, v| v.nil? }
250
275
  _data = @core.request(:post, _path, body: _body, request_options: request_options)
251
- Types::CompactObjectiveResponse.from_json(_data)
276
+ Types::ObjectiveQueuedAction.from_json(_data)
252
277
  end
253
278
 
254
279
  # Continue an objective
@@ -260,8 +285,42 @@ module Cadenya
260
285
  "enqueue" => enqueue,
261
286
  }.reject { |_k, v| v.nil? }
262
287
  _data = @core.request(:post, _path, body: _body, request_options: request_options)
288
+ Types.decode_ContinueObjectiveResponse(_data)
289
+ end
290
+
291
+ # Interrupt an objective
292
+ def interrupt(objective_id, workspace_id: nil, request_options: nil)
293
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
294
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives/#{Util.path_param('objectiveId', objective_id)}:interrupt"
295
+ _data = @core.request(:post, _path, request_options: request_options)
263
296
  Types::ObjectiveEvent.from_json(_data)
264
297
  end
298
+
299
+ # Create an objective and stream its events
300
+ def create_and_stream(agent_id:, metadata:, workspace_id: nil, variation_id: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, last_event_id: nil, request_options: nil)
301
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
302
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives:stream"
303
+ _body = {
304
+ "agentId" => agent_id,
305
+ "variationId" => variation_id,
306
+ "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateAndStreamObjectiveRequest_Metadata(_v) }).call(metadata),
307
+ "systemPromptData" => system_prompt_data,
308
+ "firstUserMessage" => first_user_message,
309
+ "secrets" => secrets.nil? ? nil : (->(_v) { _v.is_a?(Array) ? _v.map { |_i| (->(_v) { Types.encode_CreateObjectiveRequest_Secret(_v) }).call(_i) } : _v }).call(secrets),
310
+ "memoryCascade" => memory_cascade.nil? ? nil : (->(_v) { _v.is_a?(Array) ? _v.map { |_i| (->(_v) { Types.encode_MemoryReference(_v) }).call(_i) } : _v }).call(memory_cascade),
311
+ "firstUserMessageData" => first_user_message_data,
312
+ "episodicMemory" => episodic_memory.nil? ? nil : (->(_v) { Types.encode_ObjectiveEpisodicConfig(_v) }).call(episodic_memory),
313
+ "tenant" => tenant.nil? ? nil : (->(_v) { Types.encode_TenantAssertion(_v) }).call(tenant),
314
+ "subject" => subject.nil? ? nil : (->(_v) { Types.encode_SubjectAssertion(_v) }).call(subject),
315
+ "pinnedParameters" => pinned_parameters,
316
+ }.reject { |_k, v| v.nil? }
317
+ _headers = last_event_id ? { "Last-Event-ID" => last_event_id } : nil
318
+ _decoder = ->(event) { Types.decode_CreateAndStreamObjectiveResponse(event) }
319
+ _auto_reconnect = !(request_options && request_options[:reconnect] == false)
320
+ Stream.new(_decoder, last_event_id: last_event_id, skip_events: ["ping", "open"], auto_reconnect: _auto_reconnect) do |_cancel, _resume, &on_chunk|
321
+ @core.stream_request(:post, _path, body: _body, headers: (_resume ? { "Last-Event-ID" => _resume } : nil), request_options: request_options, cancel: _cancel, &on_chunk)
322
+ end
323
+ end
265
324
  end
266
325
  end
267
326
  end
@@ -13,7 +13,7 @@ module Cadenya
13
13
  def whoami(request_options: nil)
14
14
  _path = "/v1/whoami"
15
15
  _data = @core.request(:get, _path, request_options: request_options)
16
- Types::Profile.from_json(_data)
16
+ Types::WhoamiResponse.from_json(_data)
17
17
  end
18
18
  end
19
19
  end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by redwood. DO NOT EDIT.
4
+
5
+ module Cadenya
6
+ module Resources
7
+ class TrustedEndpoints
8
+ def initialize(core)
9
+ @core = core
10
+ end
11
+
12
+ # List trusted endpoints
13
+ def list(limit: nil, cursor: nil, labels: nil, request_options: nil)
14
+ _path = "/v1/account/trusted_endpoints"
15
+ _query = {
16
+ "limit" => limit,
17
+ "cursor" => cursor,
18
+ "labels" => labels,
19
+ }
20
+ _data = @core.request(:get, _path, query: _query, request_options: request_options) || {}
21
+ _items = (_data["items"] || []).map { |item| Types::TrustedEndpoint.from_json(item) }
22
+ _next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
23
+ Page.new(_items, _next_cursor) do |_c|
24
+ list(limit: limit, cursor: _c, labels: labels, request_options: request_options)
25
+ end
26
+ end
27
+
28
+ # Create a trusted endpoint
29
+ def create(metadata:, spec:, request_options: nil)
30
+ _path = "/v1/account/trusted_endpoints"
31
+ _body = {
32
+ "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateAccountResourceMetadata(_v) }).call(metadata),
33
+ "spec" => spec.nil? ? nil : (->(_v) { Types.encode_TrustedEndpointSpec(_v) }).call(spec),
34
+ }.reject { |_k, v| v.nil? }
35
+ _data = @core.request(:post, _path, body: _body, request_options: request_options)
36
+ Types::TrustedEndpoint.from_json(_data)
37
+ end
38
+
39
+ # Get a trusted endpoint by ID
40
+ def retrieve(id, request_options: nil)
41
+ _path = "/v1/account/trusted_endpoints/#{Util.path_param('id', id)}"
42
+ _data = @core.request(:get, _path, request_options: request_options)
43
+ Types::TrustedEndpoint.from_json(_data)
44
+ end
45
+
46
+ # Delete a trusted endpoint
47
+ def delete(id, request_options: nil)
48
+ _path = "/v1/account/trusted_endpoints/#{Util.path_param('id', id)}"
49
+ @core.request(:delete, _path, expects_body: false, request_options: request_options)
50
+ nil
51
+ end
52
+
53
+ # Verify a URL against the trusted endpoints
54
+ def verify(url:, request_options: nil)
55
+ _path = "/v1/account/trusted_endpoints:verify"
56
+ _body = {
57
+ "url" => url,
58
+ }.reject { |_k, v| v.nil? }
59
+ _data = @core.request(:post, _path, body: _body, request_options: request_options)
60
+ Types::VerifyTrustedEndpointResponse.from_json(_data)
61
+ end
62
+ end
63
+ end
64
+ end