@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/dist/types.d.ts CHANGED
@@ -5,13 +5,42 @@
5
5
  * is fixed and intentionally not overridable here; use the OpenAI-compatible
6
6
  * provider to target a custom endpoint.
7
7
  */
8
- export type AIProviderConfig = AIProviderConfig_Openrouter | AIProviderConfig_Openai | AIProviderConfig_OpenaiCompatible;
8
+ export type AIProviderConfig = AIProviderConfig_Openrouter | AIProviderConfig_Openai | AIProviderConfig_OpenaiCompatible | AIProviderConfig_Vertex | AIProviderConfig_Bedrock;
9
9
  /**
10
10
  * AIProviderCredential is the secret material used to authenticate with a
11
11
  * provider. The set case must correspond to AIProviderKeySpec.provider. The
12
- * server encrypts the serialized message at rest and never returns it on reads.
12
+ * server classifies and encrypts sensitive fields at rest and never returns
13
+ * secret values on reads.
13
14
  */
14
- export type AIProviderCredential = AIProviderCredential_ApiKey | AIProviderCredential_Headers;
15
+ export type AIProviderCredential = AIProviderCredential_ApiKey | AIProviderCredential_Headers | AIProviderCredential_GoogleServiceAccount | AIProviderCredential_AwsAccessKey;
16
+ /**
17
+ * AIProviderCredentialFieldStatus is the safe read representation of one
18
+ * credential field. Value is populated only when sensitive is false.
19
+ */
20
+ export interface AIProviderCredentialFieldStatus {
21
+ name?: string;
22
+ sensitive?: boolean;
23
+ configured?: boolean;
24
+ value?: string;
25
+ }
26
+ /**
27
+ * AIProviderCredentialPatch changes selected fields of the current credential.
28
+ * Omitted values are retained and clear_fields explicitly removes optional
29
+ * fields. Changing type replaces the credential and requires all mandatory
30
+ * fields for the new type.
31
+ */
32
+ export interface AIProviderCredentialPatch {
33
+ credentials?: AIProviderCredential;
34
+ clearFields?: Array<string>;
35
+ }
36
+ /**
37
+ * AIProviderCredentialStatus describes the stored authentication method and
38
+ * its fields without returning secret material.
39
+ */
40
+ export interface AIProviderCredentialStatus {
41
+ type?: string;
42
+ fields?: Array<AIProviderCredentialFieldStatus>;
43
+ }
15
44
  /**
16
45
  * AIProviderKey is a credential for an AI provider, scoped to a workspace.
17
46
  * Most keys are customer-provided (BYOK); Cadenya also provisions promotional
@@ -28,6 +57,10 @@ export interface AIProviderKey {
28
57
  */
29
58
  info?: AIProviderKeyInfo;
30
59
  }
60
+ /**
61
+ * How models on this key are maintained; see ModelManagement.
62
+ */
63
+ export type AiProviderKeyInfoModelManagement = 'MODEL_MANAGEMENT_UNSPECIFIED' | 'MODEL_MANAGEMENT_CADENYA' | 'MODEL_MANAGEMENT_SYNCED' | 'MODEL_MANAGEMENT_CUSTOMIZABLE' | 'MODEL_MANAGEMENT_MANUAL';
31
64
  /**
32
65
  * AIProviderKeyInfo carries server-derived, read-only details about a key, for
33
66
  * AI provider management UIs.
@@ -46,11 +79,20 @@ export interface AIProviderKeyInfo {
46
79
  * These are not added or maintained by account administrators.
47
80
  */
48
81
  isPromotional: boolean;
82
+ /**
83
+ * Safe-to-display credential state. Secret values are never populated;
84
+ * configured reports whether a value is present without revealing it.
85
+ */
86
+ credentialStatus?: AIProviderCredentialStatus;
87
+ /**
88
+ * How models on this key are maintained; see ModelManagement.
89
+ */
90
+ modelManagement: AiProviderKeyInfoModelManagement;
49
91
  }
50
92
  /**
51
93
  * The AI provider this key authenticates against.
52
94
  */
53
- export type AiProviderKeySpecProvider = 'AI_PROVIDER_UNSPECIFIED' | 'AI_PROVIDER_OPENROUTER' | 'AI_PROVIDER_OPENAI' | 'AI_PROVIDER_ANTHROPIC' | 'AI_PROVIDER_GEMINI' | 'AI_PROVIDER_OPENAI_COMPATIBLE';
95
+ 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';
54
96
  export interface AIProviderKeySpec {
55
97
  /**
56
98
  * The AI provider this key authenticates against.
@@ -63,8 +105,9 @@ export interface AIProviderKeySpec {
63
105
  credentials?: AIProviderCredential;
64
106
  /**
65
107
  * Non-secret, provider-specific settings (OpenAI org/project, OpenRouter
66
- * region, OpenAI-compatible base URL). The set case must correspond to
67
- * `provider`. Returned on reads. Optional: omit to accept provider defaults.
108
+ * region, OpenAI-compatible base URL, Vertex project/location, or Bedrock
109
+ * Region). The set case must correspond to `provider`. Returned on reads.
110
+ * Optional for providers that have usable defaults.
68
111
  */
69
112
  config?: AIProviderConfig;
70
113
  }
@@ -406,7 +449,7 @@ export interface AgentScheduleSpec_Schedule {
406
449
  }
407
450
  /**
408
451
  * Controls how variations are automatically selected when creating objectives
409
- * Defaults to RANDOM when unspecified
452
+ * Defaults to WEIGHTED when unspecified
410
453
  */
411
454
  export type AgentSpecVariationSelectionMode = 'VARIATION_SELECTION_MODE_UNSPECIFIED' | 'VARIATION_SELECTION_MODE_RANDOM' | 'VARIATION_SELECTION_MODE_WEIGHTED';
412
455
  /**
@@ -423,9 +466,9 @@ export interface AgentSpec {
423
466
  webhookEventsUrl?: string;
424
467
  /**
425
468
  * Controls how variations are automatically selected when creating objectives
426
- * Defaults to RANDOM when unspecified
469
+ * Defaults to WEIGHTED when unspecified
427
470
  */
428
- variationSelectionMode: AgentSpecVariationSelectionMode;
471
+ variationSelectionMode?: AgentSpecVariationSelectionMode;
429
472
  /**
430
473
  * SystemPromptDataSchema enforces the shape of system_prompt_data when objectives are created. This is valuable when using liquid formatting in agent
431
474
  * 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.
@@ -770,10 +813,16 @@ export interface BareMetadata {
770
813
  /**
771
814
  * Human-readable name of the referenced resource, populated by the server
772
815
  * on reads for convenience. Absent on references to resources that do not
773
- * have a name (e.g., objective tasks).
816
+ * have a name.
774
817
  */
775
818
  name?: string;
776
819
  }
820
+ /**
821
+ * BedrockConfig selects the AWS source Region used for Bedrock Runtime calls.
822
+ */
823
+ export interface BedrockConfig {
824
+ region?: string;
825
+ }
777
826
  /**
778
827
  * 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
779
828
  * might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides).
@@ -1108,6 +1157,25 @@ export interface CreateMemoryLayerRequest {
1108
1157
  metadata: CreateResourceMetadata;
1109
1158
  spec: MemoryLayerSpec;
1110
1159
  }
1160
+ /**
1161
+ * Create model request. The model is created on the given AI provider key with
1162
+ * PROVENANCE_MANUALLY_ENTERED and STATE_ENABLED. The key must be customer
1163
+ * provided and its provider must accept manual definitions (see
1164
+ * AIProviderKeyInfo.model_management).
1165
+ */
1166
+ export interface CreateModelRequest {
1167
+ /**
1168
+ * Workspace ID.
1169
+ */
1170
+ workspaceId?: string;
1171
+ /**
1172
+ * The AI provider key the model routes through. Accepts the canonical
1173
+ * `aipk_…` form or the `external_id:<value>` form.
1174
+ */
1175
+ aiProviderKeyId?: string;
1176
+ metadata: CreateResourceMetadata;
1177
+ spec: ModelSpec;
1178
+ }
1111
1179
  /**
1112
1180
  * Request to submit feedback for an objective
1113
1181
  */
@@ -1341,6 +1409,22 @@ export interface CreateWorkspaceSecretRequest {
1341
1409
  export interface CredentialAPIKey {
1342
1410
  apiKey?: string;
1343
1411
  }
1412
+ /**
1413
+ * CredentialAWSAccessKey carries AWS SigV4 credentials. Optional presence is
1414
+ * used by credential patches so omitted values remain unchanged.
1415
+ */
1416
+ export interface CredentialAWSAccessKey {
1417
+ accessKeyId?: string;
1418
+ secretAccessKey?: string;
1419
+ sessionToken?: string;
1420
+ }
1421
+ /**
1422
+ * CredentialGoogleServiceAccount carries an in-memory Google service-account
1423
+ * credential document.
1424
+ */
1425
+ export interface CredentialGoogleServiceAccount {
1426
+ json?: string;
1427
+ }
1344
1428
  /**
1345
1429
  * CredentialHeaders carries arbitrary HTTP headers sent with every request to
1346
1430
  * the provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
@@ -1520,10 +1604,6 @@ export interface ListObjectiveFeedbackResponse {
1520
1604
  items: Array<ObjectiveFeedback>;
1521
1605
  pagination?: Page;
1522
1606
  }
1523
- export interface ListObjectiveTasksResponse {
1524
- items: Array<ObjectiveTask>;
1525
- pagination?: Page;
1526
- }
1527
1607
  export interface ListObjectiveToolCallsResponse {
1528
1608
  items: Array<ObjectiveToolCall>;
1529
1609
  pagination?: Page;
@@ -1835,6 +1915,12 @@ export interface MemoryReference {
1835
1915
  * :enable and :disable actions to transition.
1836
1916
  */
1837
1917
  export type ModelState = 'STATE_UNSPECIFIED' | 'STATE_ENABLED' | 'STATE_DISABLED';
1918
+ /**
1919
+ * Where this definition came from. Output only; set at creation. Synced
1920
+ * models reject edits to metadata.name and spec, manually entered models
1921
+ * accept them.
1922
+ */
1923
+ export type ModelProvenance = 'PROVENANCE_UNSPECIFIED' | 'PROVENANCE_SYNCED_FROM_PROVIDER' | 'PROVENANCE_MANUALLY_ENTERED';
1838
1924
  export interface Model {
1839
1925
  /**
1840
1926
  * Resource metadata
@@ -1854,6 +1940,39 @@ export interface Model {
1854
1940
  * :enable and :disable actions to transition.
1855
1941
  */
1856
1942
  state: ModelState;
1943
+ /**
1944
+ * Where this definition came from. Output only; set at creation. Synced
1945
+ * models reject edits to metadata.name and spec, manually entered models
1946
+ * accept them.
1947
+ */
1948
+ provenance: ModelProvenance;
1949
+ /**
1950
+ * Customer price overrides. Output only here; set through UpdateModel with
1951
+ * pricing_override.* mask paths. When an override is present, spec's price
1952
+ * fields already reflect it (they are the effective prices).
1953
+ */
1954
+ pricingOverride?: ModelPricingOverride;
1955
+ /**
1956
+ * The rates before any customer override: the catalog rate for a synced
1957
+ * model, the entered rate for a manually entered one. Output only. When a
1958
+ * side matches the spec price, an override may still be present; inspect
1959
+ * pricing_override field presence to determine whether an override is set.
1960
+ */
1961
+ basePricing: ModelBasePricing;
1962
+ }
1963
+ /**
1964
+ * ModelBasePricing is a model's default rates in cents per million tokens,
1965
+ * unaffected by pricing overrides. Zero means the rate is not known.
1966
+ */
1967
+ export interface ModelBasePricing {
1968
+ /**
1969
+ * Default input token rate, in cents per million tokens.
1970
+ */
1971
+ inputPricePerMillionTokens: string;
1972
+ /**
1973
+ * Default output token rate, in cents per million tokens.
1974
+ */
1975
+ outputPricePerMillionTokens: string;
1857
1976
  }
1858
1977
  /**
1859
1978
  * ModelInfo carries server-derived, read-only details about a model.
@@ -1876,6 +1995,21 @@ export interface ModelInfo {
1876
1995
  */
1877
1996
  lastUsedAt?: string;
1878
1997
  }
1998
+ /**
1999
+ * ModelPricingOverride replaces the catalog prices for a model. Each field is
2000
+ * independent: an absent field keeps the catalog price, a present field (zero
2001
+ * included) replaces it. Prices are cents per million tokens.
2002
+ */
2003
+ export interface ModelPricingOverride {
2004
+ /**
2005
+ * Override for input token price, in cents per million tokens.
2006
+ */
2007
+ inputPricePerMillionTokens?: string;
2008
+ /**
2009
+ * Override for output token price, in cents per million tokens.
2010
+ */
2011
+ outputPricePerMillionTokens?: string;
2012
+ }
1879
2013
  export interface ModelSpec {
1880
2014
  /**
1881
2015
  * The model provider (e.g., "anthropic", "openai", "google")
@@ -1894,11 +2028,16 @@ export interface ModelSpec {
1894
2028
  */
1895
2029
  maxOutputTokens: number;
1896
2030
  /**
1897
- * Cost per million input tokens in cents (e.g., 300 = $3.00)
2031
+ * Cost per million input tokens in cents (e.g., 300 = $3.00). On reads this
2032
+ * is the effective price: the catalog price unless
2033
+ * Model.pricing_override replaces it. Writes only apply to manually
2034
+ * entered models; use UpdateModel's pricing_override paths to override a
2035
+ * synced model's price.
1898
2036
  */
1899
2037
  inputPricePerMillionTokens: string;
1900
2038
  /**
1901
- * Cost per million output tokens in cents (e.g., 1500 = $15.00)
2039
+ * Cost per million output tokens in cents (e.g., 1500 = $15.00). Effective
2040
+ * price on reads, see input_price_per_million_tokens.
1902
2041
  */
1903
2042
  outputPricePerMillionTokens: string;
1904
2043
  /**
@@ -1907,6 +2046,15 @@ export interface ModelSpec {
1907
2046
  * (and its mode) lives here too, as the "reasoning" capability.
1908
2047
  */
1909
2048
  capabilities: Array<ModelSpec_Capability>;
2049
+ /**
2050
+ * The identifier the provider expects in inference requests, exactly as the
2051
+ * provider spells it: an OpenAI model name, a Vertex publisher model
2052
+ * resource, a Bedrock inference-profile ID or ARN, or an OpenAI-compatible
2053
+ * endpoint's model ID. Distinct from metadata.external_id, which is
2054
+ * Cadenya's slug. Verified with a minimal provider completion on creation
2055
+ * and whenever the identifier changes.
2056
+ */
2057
+ providerModelId: string;
1910
2058
  }
1911
2059
  /**
1912
2060
  * Capability describes one inference knob this model supports, with any
@@ -2258,32 +2406,6 @@ export interface ObjectiveInfo {
2258
2406
  */
2259
2407
  widget?: BareMetadata;
2260
2408
  }
2261
- /**
2262
- * ObjectiveTask represents a task within an objective, typically created and managed by an AI agent
2263
- * to track progress toward completing the objective.
2264
- */
2265
- export interface ObjectiveTask {
2266
- metadata: BareMetadata;
2267
- data: ObjectiveTaskData;
2268
- }
2269
- export interface ObjectiveTaskData {
2270
- /**
2271
- * The sequential number of this task within the objective (auto-assigned, 1-based)
2272
- */
2273
- number: number;
2274
- /**
2275
- * Description of the task to be completed
2276
- */
2277
- task: string;
2278
- /**
2279
- * Whether the task has been completed
2280
- */
2281
- completed: boolean;
2282
- /**
2283
- * Timestamp when the task was marked as completed
2284
- */
2285
- completedAt?: string;
2286
- }
2287
2409
  /**
2288
2410
  * ObjectiveTimedOut is the terminal event written when an objective is
2289
2411
  * finalized by the inactivity sweep because it saw no activity (no user
@@ -2415,6 +2537,11 @@ export interface ObjectiveToolCallResult_ImageBlock {
2415
2537
  }
2416
2538
  export interface ObjectiveToolCallResult_TextBlock {
2417
2539
  text: string;
2540
+ /**
2541
+ * Size of the stored text in bytes. Filled by the server at record time;
2542
+ * zero on results recorded before this field existed.
2543
+ */
2544
+ sizeBytes?: string;
2418
2545
  }
2419
2546
  /**
2420
2547
  * Current status of the tool call
@@ -3802,6 +3929,11 @@ export interface UpdateAIProviderKeyRequest {
3802
3929
  * Fields to update.
3803
3930
  */
3804
3931
  updateMask?: string;
3932
+ /**
3933
+ * Field-level credential changes. This is independent of update_mask;
3934
+ * legacy clients may continue replacing spec.credentials atomically.
3935
+ */
3936
+ credentialPatch?: AIProviderCredentialPatch;
3805
3937
  }
3806
3938
  export interface UpdateAPIKeyRequest {
3807
3939
  /**
@@ -3952,6 +4084,41 @@ export interface UpdateMemoryLayerRequest {
3952
4084
  spec?: MemoryLayerSpec;
3953
4085
  updateMask?: string;
3954
4086
  }
4087
+ /**
4088
+ * Update model request. update_mask must list leaf paths: metadata.name,
4089
+ * metadata.external_id, metadata.labels, spec.provider_model_id,
4090
+ * spec.provider, spec.family, spec.max_input_tokens, spec.max_output_tokens,
4091
+ * spec.capabilities, pricing_override.input_price_per_million_tokens, and
4092
+ * pricing_override.output_price_per_million_tokens. Synced models
4093
+ * (PROVENANCE_SYNCED_FROM_PROVIDER) reject metadata.name and spec.* paths.
4094
+ * spec price fields are never writable; price changes go through
4095
+ * pricing_override, where a masked-but-absent field clears the override.
4096
+ * Metadata and spec must be present when their respective paths are masked.
4097
+ */
4098
+ export interface UpdateModelRequest {
4099
+ /**
4100
+ * Workspace ID.
4101
+ */
4102
+ workspaceId?: string;
4103
+ /**
4104
+ * Model ID. Accepts the canonical `model_…` form or the `external_id:<value>` form.
4105
+ */
4106
+ id?: string;
4107
+ metadata?: UpdateResourceMetadata;
4108
+ /**
4109
+ * When any spec.* path is masked, send the complete spec (current values
4110
+ * plus edits); it is validated as a whole.
4111
+ */
4112
+ spec?: ModelSpec;
4113
+ /**
4114
+ * Customer price overrides, applied per masked path.
4115
+ */
4116
+ pricingOverride?: ModelPricingOverride;
4117
+ /**
4118
+ * Fields to update. Required; leaf paths only.
4119
+ */
4120
+ updateMask?: string;
4121
+ }
3955
4122
  /**
3956
4123
  * UpdateResourceMetadata contains the user-provided fields for updating
3957
4124
  * a workspace-scoped resource. Read-only fields (id, account_id, workspace_id, profile_id,
@@ -4175,6 +4342,14 @@ export interface VariationMemoryLayerAssignment {
4175
4342
  */
4176
4343
  position: number;
4177
4344
  }
4345
+ /**
4346
+ * VertexConfig configures the Google Cloud project and location used by the
4347
+ * Vertex AI backend. Both are required for service-account authentication.
4348
+ */
4349
+ export interface VertexConfig {
4350
+ projectId?: string;
4351
+ location?: string;
4352
+ }
4178
4353
  export interface WebhookDelivery {
4179
4354
  metadata: OperationMetadata;
4180
4355
  /**
@@ -4917,6 +5092,22 @@ export interface AIProviderCredential_Headers {
4917
5092
  */
4918
5093
  headers: CredentialHeaders;
4919
5094
  }
5095
+ export interface AIProviderCredential_GoogleServiceAccount {
5096
+ type: 'googleServiceAccount';
5097
+ /**
5098
+ * Google service-account JSON for Vertex AI. The server accepts only the
5099
+ * service_account credential type and never writes the JSON to plaintext
5100
+ * storage.
5101
+ */
5102
+ googleServiceAccount: CredentialGoogleServiceAccount;
5103
+ }
5104
+ export interface AIProviderCredential_AwsAccessKey {
5105
+ type: 'awsAccessKey';
5106
+ /**
5107
+ * AWS access credentials for Bedrock SigV4 authentication.
5108
+ */
5109
+ awsAccessKey: CredentialAWSAccessKey;
5110
+ }
4920
5111
  export interface AIProviderConfig_Openrouter {
4921
5112
  type: 'openrouter';
4922
5113
  openrouter: OpenRouterConfig;
@@ -4929,6 +5120,14 @@ export interface AIProviderConfig_OpenaiCompatible {
4929
5120
  type: 'openaiCompatible';
4930
5121
  openaiCompatible: OpenAICompatibleConfig;
4931
5122
  }
5123
+ export interface AIProviderConfig_Vertex {
5124
+ type: 'vertex';
5125
+ vertex: VertexConfig;
5126
+ }
5127
+ export interface AIProviderConfig_Bedrock {
5128
+ type: 'bedrock';
5129
+ bedrock: BedrockConfig;
5130
+ }
4932
5131
  export interface ModelSpec_Capability_Temperature {
4933
5132
  type: 'temperature';
4934
5133
  temperature: Capability_Temperature;