@cadenya/cadenya 1.0.2 → 1.1.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 (48) hide show
  1. package/api.md +38 -38
  2. package/dist/client.d.ts +2 -2
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +4 -4
  5. package/dist/client.js.map +1 -1
  6. package/dist/core/http.d.ts +6 -1
  7. package/dist/core/http.d.ts.map +1 -1
  8. package/dist/core/http.js +33 -6
  9. package/dist/core/http.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/resources/agents.d.ts +1 -1
  15. package/dist/resources/agents.js +1 -1
  16. package/dist/resources/agents.js.map +1 -1
  17. package/dist/resources/ai-provider-keys.d.ts +11 -1
  18. package/dist/resources/ai-provider-keys.d.ts.map +1 -1
  19. package/dist/resources/ai-provider-keys.js +2 -2
  20. package/dist/resources/ai-provider-keys.js.map +1 -1
  21. package/dist/resources/memory-layers.d.ts +1 -1
  22. package/dist/resources/memory-layers.js +1 -1
  23. package/dist/resources/memory-layers.js.map +1 -1
  24. package/dist/resources/models.d.ts +51 -1
  25. package/dist/resources/models.d.ts.map +1 -1
  26. package/dist/resources/models.js +32 -0
  27. package/dist/resources/models.js.map +1 -1
  28. package/dist/resources/objectives.d.ts +1 -46
  29. package/dist/resources/objectives.d.ts.map +1 -1
  30. package/dist/resources/objectives.js +0 -35
  31. package/dist/resources/objectives.js.map +1 -1
  32. package/dist/resources/tools.d.ts +1 -1
  33. package/dist/resources/tools.js +1 -1
  34. package/dist/resources/tools.js.map +1 -1
  35. package/dist/types.d.ts +241 -42
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/client.ts +4 -4
  40. package/src/core/http.ts +45 -6
  41. package/src/index.ts +1 -1
  42. package/src/resources/agents.ts +1 -1
  43. package/src/resources/ai-provider-keys.ts +13 -3
  44. package/src/resources/memory-layers.ts +1 -1
  45. package/src/resources/models.ts +67 -1
  46. package/src/resources/objectives.ts +1 -62
  47. package/src/resources/tools.ts +1 -1
  48. package/src/types.ts +262 -45
package/src/types.ts CHANGED
@@ -10,16 +10,52 @@
10
10
  export type AIProviderConfig =
11
11
  | AIProviderConfig_Openrouter
12
12
  | AIProviderConfig_Openai
13
- | AIProviderConfig_OpenaiCompatible;
13
+ | AIProviderConfig_OpenaiCompatible
14
+ | AIProviderConfig_Vertex
15
+ | AIProviderConfig_Bedrock;
14
16
 
15
17
  /**
16
18
  * AIProviderCredential is the secret material used to authenticate with a
17
19
  * provider. The set case must correspond to AIProviderKeySpec.provider. The
18
- * server encrypts the serialized message at rest and never returns it on reads.
20
+ * server classifies and encrypts sensitive fields at rest and never returns
21
+ * secret values on reads.
19
22
  */
20
23
  export type AIProviderCredential =
21
24
  | AIProviderCredential_ApiKey
22
- | AIProviderCredential_Headers;
25
+ | AIProviderCredential_Headers
26
+ | AIProviderCredential_GoogleServiceAccount
27
+ | AIProviderCredential_AwsAccessKey;
28
+
29
+ /**
30
+ * AIProviderCredentialFieldStatus is the safe read representation of one
31
+ * credential field. Value is populated only when sensitive is false.
32
+ */
33
+ export interface AIProviderCredentialFieldStatus {
34
+ name?: string;
35
+ sensitive?: boolean;
36
+ configured?: boolean;
37
+ value?: string;
38
+ }
39
+
40
+ /**
41
+ * AIProviderCredentialPatch changes selected fields of the current credential.
42
+ * Omitted values are retained and clear_fields explicitly removes optional
43
+ * fields. Changing type replaces the credential and requires all mandatory
44
+ * fields for the new type.
45
+ */
46
+ export interface AIProviderCredentialPatch {
47
+ credentials?: AIProviderCredential;
48
+ clearFields?: Array<string>;
49
+ }
50
+
51
+ /**
52
+ * AIProviderCredentialStatus describes the stored authentication method and
53
+ * its fields without returning secret material.
54
+ */
55
+ export interface AIProviderCredentialStatus {
56
+ type?: string;
57
+ fields?: Array<AIProviderCredentialFieldStatus>;
58
+ }
23
59
 
24
60
  /**
25
61
  * AIProviderKey is a credential for an AI provider, scoped to a workspace.
@@ -38,6 +74,11 @@ export interface AIProviderKey {
38
74
  info?: AIProviderKeyInfo;
39
75
  }
40
76
 
77
+ /**
78
+ * How models on this key are maintained; see ModelManagement.
79
+ */
80
+ export type AiProviderKeyInfoModelManagement = 'MODEL_MANAGEMENT_UNSPECIFIED' | 'MODEL_MANAGEMENT_CADENYA' | 'MODEL_MANAGEMENT_SYNCED' | 'MODEL_MANAGEMENT_CUSTOMIZABLE' | 'MODEL_MANAGEMENT_MANUAL';
81
+
41
82
  /**
42
83
  * AIProviderKeyInfo carries server-derived, read-only details about a key, for
43
84
  * AI provider management UIs.
@@ -56,12 +97,21 @@ export interface AIProviderKeyInfo {
56
97
  * These are not added or maintained by account administrators.
57
98
  */
58
99
  isPromotional: boolean;
100
+ /**
101
+ * Safe-to-display credential state. Secret values are never populated;
102
+ * configured reports whether a value is present without revealing it.
103
+ */
104
+ credentialStatus?: AIProviderCredentialStatus;
105
+ /**
106
+ * How models on this key are maintained; see ModelManagement.
107
+ */
108
+ modelManagement: AiProviderKeyInfoModelManagement;
59
109
  }
60
110
 
61
111
  /**
62
112
  * The AI provider this key authenticates against.
63
113
  */
64
- export type AiProviderKeySpecProvider = 'AI_PROVIDER_UNSPECIFIED' | 'AI_PROVIDER_OPENROUTER' | 'AI_PROVIDER_OPENAI' | 'AI_PROVIDER_ANTHROPIC' | 'AI_PROVIDER_GEMINI' | 'AI_PROVIDER_OPENAI_COMPATIBLE';
114
+ export type AiProviderKeySpecProvider = 'AI_PROVIDER_UNSPECIFIED' | 'AI_PROVIDER_OPENROUTER' | 'AI_PROVIDER_OPENAI' | 'AI_PROVIDER_ANTHROPIC' | 'AI_PROVIDER_GEMINI' | 'AI_PROVIDER_OPENAI_COMPATIBLE' | 'AI_PROVIDER_VERTEX' | 'AI_PROVIDER_BEDROCK';
65
115
 
66
116
  export interface AIProviderKeySpec {
67
117
  /**
@@ -75,8 +125,9 @@ export interface AIProviderKeySpec {
75
125
  credentials?: AIProviderCredential;
76
126
  /**
77
127
  * Non-secret, provider-specific settings (OpenAI org/project, OpenRouter
78
- * region, OpenAI-compatible base URL). The set case must correspond to
79
- * `provider`. Returned on reads. Optional: omit to accept provider defaults.
128
+ * region, OpenAI-compatible base URL, Vertex project/location, or Bedrock
129
+ * Region). The set case must correspond to `provider`. Returned on reads.
130
+ * Optional for providers that have usable defaults.
80
131
  */
81
132
  config?: AIProviderConfig;
82
133
  }
@@ -442,7 +493,7 @@ export interface AgentScheduleSpec_Schedule {
442
493
 
443
494
  /**
444
495
  * Controls how variations are automatically selected when creating objectives
445
- * Defaults to RANDOM when unspecified
496
+ * Defaults to WEIGHTED when unspecified
446
497
  */
447
498
  export type AgentSpecVariationSelectionMode = 'VARIATION_SELECTION_MODE_UNSPECIFIED' | 'VARIATION_SELECTION_MODE_RANDOM' | 'VARIATION_SELECTION_MODE_WEIGHTED';
448
499
 
@@ -460,9 +511,9 @@ export interface AgentSpec {
460
511
  webhookEventsUrl?: string;
461
512
  /**
462
513
  * Controls how variations are automatically selected when creating objectives
463
- * Defaults to RANDOM when unspecified
514
+ * Defaults to WEIGHTED when unspecified
464
515
  */
465
- variationSelectionMode: AgentSpecVariationSelectionMode;
516
+ variationSelectionMode?: AgentSpecVariationSelectionMode;
466
517
  /**
467
518
  * SystemPromptDataSchema enforces the shape of system_prompt_data when objectives are created. This is valuable when using liquid formatting in agent
468
519
  * variation system prompt templates. The schema is also used when the agent is attached as a sub-agent, as it becomes the tool's input parameter schema.
@@ -823,11 +874,18 @@ export interface BareMetadata {
823
874
  /**
824
875
  * Human-readable name of the referenced resource, populated by the server
825
876
  * on reads for convenience. Absent on references to resources that do not
826
- * have a name (e.g., objective tasks).
877
+ * have a name.
827
878
  */
828
879
  name?: string;
829
880
  }
830
881
 
882
+ /**
883
+ * BedrockConfig selects the AWS source Region used for Bedrock Runtime calls.
884
+ */
885
+ export interface BedrockConfig {
886
+ region?: string;
887
+ }
888
+
831
889
  /**
832
890
  * CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective
833
891
  * might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides).
@@ -1195,6 +1253,26 @@ export interface CreateMemoryLayerRequest {
1195
1253
  spec: MemoryLayerSpec;
1196
1254
  }
1197
1255
 
1256
+ /**
1257
+ * Create model request. The model is created on the given AI provider key with
1258
+ * PROVENANCE_MANUALLY_ENTERED and STATE_ENABLED. The key must be customer
1259
+ * provided and its provider must accept manual definitions (see
1260
+ * AIProviderKeyInfo.model_management).
1261
+ */
1262
+ export interface CreateModelRequest {
1263
+ /**
1264
+ * Workspace ID.
1265
+ */
1266
+ workspaceId?: string;
1267
+ /**
1268
+ * The AI provider key the model routes through. Accepts the canonical
1269
+ * `aipk_…` form or the `external_id:<value>` form.
1270
+ */
1271
+ aiProviderKeyId?: string;
1272
+ metadata: CreateResourceMetadata;
1273
+ spec: ModelSpec;
1274
+ }
1275
+
1198
1276
  /**
1199
1277
  * Request to submit feedback for an objective
1200
1278
  */
@@ -1443,6 +1521,24 @@ export interface CredentialAPIKey {
1443
1521
  apiKey?: string;
1444
1522
  }
1445
1523
 
1524
+ /**
1525
+ * CredentialAWSAccessKey carries AWS SigV4 credentials. Optional presence is
1526
+ * used by credential patches so omitted values remain unchanged.
1527
+ */
1528
+ export interface CredentialAWSAccessKey {
1529
+ accessKeyId?: string;
1530
+ secretAccessKey?: string;
1531
+ sessionToken?: string;
1532
+ }
1533
+
1534
+ /**
1535
+ * CredentialGoogleServiceAccount carries an in-memory Google service-account
1536
+ * credential document.
1537
+ */
1538
+ export interface CredentialGoogleServiceAccount {
1539
+ json?: string;
1540
+ }
1541
+
1446
1542
  /**
1447
1543
  * CredentialHeaders carries arbitrary HTTP headers sent with every request to
1448
1544
  * the provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
@@ -1646,11 +1742,6 @@ export interface ListObjectiveFeedbackResponse {
1646
1742
  pagination?: Page;
1647
1743
  }
1648
1744
 
1649
- export interface ListObjectiveTasksResponse {
1650
- items: Array<ObjectiveTask>;
1651
- pagination?: Page;
1652
- }
1653
-
1654
1745
  export interface ListObjectiveToolCallsResponse {
1655
1746
  items: Array<ObjectiveToolCall>;
1656
1747
  pagination?: Page;
@@ -1994,6 +2085,13 @@ export interface MemoryReference {
1994
2085
  */
1995
2086
  export type ModelState = 'STATE_UNSPECIFIED' | 'STATE_ENABLED' | 'STATE_DISABLED';
1996
2087
 
2088
+ /**
2089
+ * Where this definition came from. Output only; set at creation. Synced
2090
+ * models reject edits to metadata.name and spec, manually entered models
2091
+ * accept them.
2092
+ */
2093
+ export type ModelProvenance = 'PROVENANCE_UNSPECIFIED' | 'PROVENANCE_SYNCED_FROM_PROVIDER' | 'PROVENANCE_MANUALLY_ENTERED';
2094
+
1997
2095
  export interface Model {
1998
2096
  /**
1999
2097
  * Resource metadata
@@ -2013,6 +2111,40 @@ export interface Model {
2013
2111
  * :enable and :disable actions to transition.
2014
2112
  */
2015
2113
  state: ModelState;
2114
+ /**
2115
+ * Where this definition came from. Output only; set at creation. Synced
2116
+ * models reject edits to metadata.name and spec, manually entered models
2117
+ * accept them.
2118
+ */
2119
+ provenance: ModelProvenance;
2120
+ /**
2121
+ * Customer price overrides. Output only here; set through UpdateModel with
2122
+ * pricing_override.* mask paths. When an override is present, spec's price
2123
+ * fields already reflect it (they are the effective prices).
2124
+ */
2125
+ pricingOverride?: ModelPricingOverride;
2126
+ /**
2127
+ * The rates before any customer override: the catalog rate for a synced
2128
+ * model, the entered rate for a manually entered one. Output only. When a
2129
+ * side matches the spec price, an override may still be present; inspect
2130
+ * pricing_override field presence to determine whether an override is set.
2131
+ */
2132
+ basePricing: ModelBasePricing;
2133
+ }
2134
+
2135
+ /**
2136
+ * ModelBasePricing is a model's default rates in cents per million tokens,
2137
+ * unaffected by pricing overrides. Zero means the rate is not known.
2138
+ */
2139
+ export interface ModelBasePricing {
2140
+ /**
2141
+ * Default input token rate, in cents per million tokens.
2142
+ */
2143
+ inputPricePerMillionTokens: string;
2144
+ /**
2145
+ * Default output token rate, in cents per million tokens.
2146
+ */
2147
+ outputPricePerMillionTokens: string;
2016
2148
  }
2017
2149
 
2018
2150
  /**
@@ -2037,6 +2169,22 @@ export interface ModelInfo {
2037
2169
  lastUsedAt?: string;
2038
2170
  }
2039
2171
 
2172
+ /**
2173
+ * ModelPricingOverride replaces the catalog prices for a model. Each field is
2174
+ * independent: an absent field keeps the catalog price, a present field (zero
2175
+ * included) replaces it. Prices are cents per million tokens.
2176
+ */
2177
+ export interface ModelPricingOverride {
2178
+ /**
2179
+ * Override for input token price, in cents per million tokens.
2180
+ */
2181
+ inputPricePerMillionTokens?: string;
2182
+ /**
2183
+ * Override for output token price, in cents per million tokens.
2184
+ */
2185
+ outputPricePerMillionTokens?: string;
2186
+ }
2187
+
2040
2188
  export interface ModelSpec {
2041
2189
  /**
2042
2190
  * The model provider (e.g., "anthropic", "openai", "google")
@@ -2055,11 +2203,16 @@ export interface ModelSpec {
2055
2203
  */
2056
2204
  maxOutputTokens: number;
2057
2205
  /**
2058
- * Cost per million input tokens in cents (e.g., 300 = $3.00)
2206
+ * Cost per million input tokens in cents (e.g., 300 = $3.00). On reads this
2207
+ * is the effective price: the catalog price unless
2208
+ * Model.pricing_override replaces it. Writes only apply to manually
2209
+ * entered models; use UpdateModel's pricing_override paths to override a
2210
+ * synced model's price.
2059
2211
  */
2060
2212
  inputPricePerMillionTokens: string;
2061
2213
  /**
2062
- * Cost per million output tokens in cents (e.g., 1500 = $15.00)
2214
+ * Cost per million output tokens in cents (e.g., 1500 = $15.00). Effective
2215
+ * price on reads, see input_price_per_million_tokens.
2063
2216
  */
2064
2217
  outputPricePerMillionTokens: string;
2065
2218
  /**
@@ -2068,6 +2221,15 @@ export interface ModelSpec {
2068
2221
  * (and its mode) lives here too, as the "reasoning" capability.
2069
2222
  */
2070
2223
  capabilities: Array<ModelSpec_Capability>;
2224
+ /**
2225
+ * The identifier the provider expects in inference requests, exactly as the
2226
+ * provider spells it: an OpenAI model name, a Vertex publisher model
2227
+ * resource, a Bedrock inference-profile ID or ARN, or an OpenAI-compatible
2228
+ * endpoint's model ID. Distinct from metadata.external_id, which is
2229
+ * Cadenya's slug. Verified with a minimal provider completion on creation
2230
+ * and whenever the identifier changes.
2231
+ */
2232
+ providerModelId: string;
2071
2233
  }
2072
2234
 
2073
2235
  /**
@@ -2466,34 +2628,6 @@ export interface ObjectiveInfo {
2466
2628
  widget?: BareMetadata;
2467
2629
  }
2468
2630
 
2469
- /**
2470
- * ObjectiveTask represents a task within an objective, typically created and managed by an AI agent
2471
- * to track progress toward completing the objective.
2472
- */
2473
- export interface ObjectiveTask {
2474
- metadata: BareMetadata;
2475
- data: ObjectiveTaskData;
2476
- }
2477
-
2478
- export interface ObjectiveTaskData {
2479
- /**
2480
- * The sequential number of this task within the objective (auto-assigned, 1-based)
2481
- */
2482
- number: number;
2483
- /**
2484
- * Description of the task to be completed
2485
- */
2486
- task: string;
2487
- /**
2488
- * Whether the task has been completed
2489
- */
2490
- completed: boolean;
2491
- /**
2492
- * Timestamp when the task was marked as completed
2493
- */
2494
- completedAt?: string;
2495
- }
2496
-
2497
2631
  /**
2498
2632
  * ObjectiveTimedOut is the terminal event written when an objective is
2499
2633
  * finalized by the inactivity sweep because it saw no activity (no user
@@ -2639,6 +2773,11 @@ export interface ObjectiveToolCallResult_ImageBlock {
2639
2773
 
2640
2774
  export interface ObjectiveToolCallResult_TextBlock {
2641
2775
  text: string;
2776
+ /**
2777
+ * Size of the stored text in bytes. Filled by the server at record time;
2778
+ * zero on results recorded before this field existed.
2779
+ */
2780
+ sizeBytes?: string;
2642
2781
  }
2643
2782
 
2644
2783
  /**
@@ -4163,6 +4302,11 @@ export interface UpdateAIProviderKeyRequest {
4163
4302
  * Fields to update.
4164
4303
  */
4165
4304
  updateMask?: string;
4305
+ /**
4306
+ * Field-level credential changes. This is independent of update_mask;
4307
+ * legacy clients may continue replacing spec.credentials atomically.
4308
+ */
4309
+ credentialPatch?: AIProviderCredentialPatch;
4166
4310
  }
4167
4311
 
4168
4312
  export interface UpdateAPIKeyRequest {
@@ -4322,6 +4466,42 @@ export interface UpdateMemoryLayerRequest {
4322
4466
  updateMask?: string;
4323
4467
  }
4324
4468
 
4469
+ /**
4470
+ * Update model request. update_mask must list leaf paths: metadata.name,
4471
+ * metadata.external_id, metadata.labels, spec.provider_model_id,
4472
+ * spec.provider, spec.family, spec.max_input_tokens, spec.max_output_tokens,
4473
+ * spec.capabilities, pricing_override.input_price_per_million_tokens, and
4474
+ * pricing_override.output_price_per_million_tokens. Synced models
4475
+ * (PROVENANCE_SYNCED_FROM_PROVIDER) reject metadata.name and spec.* paths.
4476
+ * spec price fields are never writable; price changes go through
4477
+ * pricing_override, where a masked-but-absent field clears the override.
4478
+ * Metadata and spec must be present when their respective paths are masked.
4479
+ */
4480
+ export interface UpdateModelRequest {
4481
+ /**
4482
+ * Workspace ID.
4483
+ */
4484
+ workspaceId?: string;
4485
+ /**
4486
+ * Model ID. Accepts the canonical `model_…` form or the `external_id:<value>` form.
4487
+ */
4488
+ id?: string;
4489
+ metadata?: UpdateResourceMetadata;
4490
+ /**
4491
+ * When any spec.* path is masked, send the complete spec (current values
4492
+ * plus edits); it is validated as a whole.
4493
+ */
4494
+ spec?: ModelSpec;
4495
+ /**
4496
+ * Customer price overrides, applied per masked path.
4497
+ */
4498
+ pricingOverride?: ModelPricingOverride;
4499
+ /**
4500
+ * Fields to update. Required; leaf paths only.
4501
+ */
4502
+ updateMask?: string;
4503
+ }
4504
+
4325
4505
  /**
4326
4506
  * UpdateResourceMetadata contains the user-provided fields for updating
4327
4507
  * a workspace-scoped resource. Read-only fields (id, account_id, workspace_id, profile_id,
@@ -4562,6 +4742,15 @@ export interface VariationMemoryLayerAssignment {
4562
4742
  position: number;
4563
4743
  }
4564
4744
 
4745
+ /**
4746
+ * VertexConfig configures the Google Cloud project and location used by the
4747
+ * Vertex AI backend. Both are required for service-account authentication.
4748
+ */
4749
+ export interface VertexConfig {
4750
+ projectId?: string;
4751
+ location?: string;
4752
+ }
4753
+
4565
4754
  export interface WebhookDelivery {
4566
4755
  metadata: OperationMetadata;
4567
4756
  /**
@@ -5391,6 +5580,24 @@ export interface AIProviderCredential_Headers {
5391
5580
  headers: CredentialHeaders;
5392
5581
  }
5393
5582
 
5583
+ export interface AIProviderCredential_GoogleServiceAccount {
5584
+ type: 'googleServiceAccount';
5585
+ /**
5586
+ * Google service-account JSON for Vertex AI. The server accepts only the
5587
+ * service_account credential type and never writes the JSON to plaintext
5588
+ * storage.
5589
+ */
5590
+ googleServiceAccount: CredentialGoogleServiceAccount;
5591
+ }
5592
+
5593
+ export interface AIProviderCredential_AwsAccessKey {
5594
+ type: 'awsAccessKey';
5595
+ /**
5596
+ * AWS access credentials for Bedrock SigV4 authentication.
5597
+ */
5598
+ awsAccessKey: CredentialAWSAccessKey;
5599
+ }
5600
+
5394
5601
  export interface AIProviderConfig_Openrouter {
5395
5602
  type: 'openrouter';
5396
5603
  openrouter: OpenRouterConfig;
@@ -5406,6 +5613,16 @@ export interface AIProviderConfig_OpenaiCompatible {
5406
5613
  openaiCompatible: OpenAICompatibleConfig;
5407
5614
  }
5408
5615
 
5616
+ export interface AIProviderConfig_Vertex {
5617
+ type: 'vertex';
5618
+ vertex: VertexConfig;
5619
+ }
5620
+
5621
+ export interface AIProviderConfig_Bedrock {
5622
+ type: 'bedrock';
5623
+ bedrock: BedrockConfig;
5624
+ }
5625
+
5409
5626
  export interface ModelSpec_Capability_Temperature {
5410
5627
  type: 'temperature';
5411
5628
  temperature: Capability_Temperature;