@cadenya/cadenya 0.45.0 → 0.47.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 (61) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/client.d.mts +4 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +4 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/agent-variations.d.mts +79 -1
  10. package/resources/agent-variations.d.mts.map +1 -1
  11. package/resources/agent-variations.d.ts +79 -1
  12. package/resources/agent-variations.d.ts.map +1 -1
  13. package/resources/agent-variations.js +31 -0
  14. package/resources/agent-variations.js.map +1 -1
  15. package/resources/agent-variations.mjs +31 -0
  16. package/resources/agent-variations.mjs.map +1 -1
  17. package/resources/agents/webhook-deliveries.d.mts +2 -2
  18. package/resources/agents/webhook-deliveries.d.mts.map +1 -1
  19. package/resources/agents/webhook-deliveries.d.ts +2 -2
  20. package/resources/agents/webhook-deliveries.d.ts.map +1 -1
  21. package/resources/index.d.mts +2 -2
  22. package/resources/index.d.mts.map +1 -1
  23. package/resources/index.d.ts +2 -2
  24. package/resources/index.d.ts.map +1 -1
  25. package/resources/index.js.map +1 -1
  26. package/resources/index.mjs.map +1 -1
  27. package/resources/memory-layers/entries.d.mts +1 -8
  28. package/resources/memory-layers/entries.d.mts.map +1 -1
  29. package/resources/memory-layers/entries.d.ts +1 -8
  30. package/resources/memory-layers/entries.d.ts.map +1 -1
  31. package/resources/memory-layers/memory-layers.d.mts +1 -2
  32. package/resources/memory-layers/memory-layers.d.mts.map +1 -1
  33. package/resources/memory-layers/memory-layers.d.ts +1 -2
  34. package/resources/memory-layers/memory-layers.d.ts.map +1 -1
  35. package/resources/memory-layers/memory-layers.js.map +1 -1
  36. package/resources/memory-layers/memory-layers.mjs.map +1 -1
  37. package/resources/objectives/index.d.mts +1 -1
  38. package/resources/objectives/index.d.mts.map +1 -1
  39. package/resources/objectives/index.d.ts +1 -1
  40. package/resources/objectives/index.d.ts.map +1 -1
  41. package/resources/objectives/index.js.map +1 -1
  42. package/resources/objectives/index.mjs.map +1 -1
  43. package/resources/objectives/objectives.d.mts +76 -1
  44. package/resources/objectives/objectives.d.mts.map +1 -1
  45. package/resources/objectives/objectives.d.ts +76 -1
  46. package/resources/objectives/objectives.d.ts.map +1 -1
  47. package/resources/objectives/objectives.js.map +1 -1
  48. package/resources/objectives/objectives.mjs.map +1 -1
  49. package/src/client.ts +12 -0
  50. package/src/resources/agent-variations.ts +124 -0
  51. package/src/resources/agents/webhook-deliveries.ts +4 -2
  52. package/src/resources/index.ts +6 -0
  53. package/src/resources/memory-layers/entries.ts +1 -11
  54. package/src/resources/memory-layers/memory-layers.ts +1 -2
  55. package/src/resources/objectives/index.ts +2 -0
  56. package/src/resources/objectives/objectives.ts +85 -0
  57. package/src/version.ts +1 -1
  58. package/version.d.mts +1 -1
  59. package/version.d.ts +1 -1
  60. package/version.js +1 -1
  61. package/version.mjs +1 -1
@@ -85,6 +85,21 @@ export class AgentVariations extends APIResource {
85
85
  });
86
86
  }
87
87
 
88
+ /**
89
+ * Attaches a memory layer to a variation at a given position in the variation's
90
+ * baseline memory stack.
91
+ */
92
+ addMemoryLayer(
93
+ agentVariationID: string,
94
+ body: AgentVariationAddMemoryLayerParams,
95
+ options?: RequestOptions,
96
+ ): APIPromise<VariationMemoryLayerAssignment> {
97
+ return this._client.post(path`/v1/agent_variations/${agentVariationID}/memory_layers`, {
98
+ body,
99
+ ...options,
100
+ });
101
+ }
102
+
88
103
  /**
89
104
  * Detaches an assignment from a variation, identified by the assignment ID
90
105
  * returned when it was added.
@@ -100,6 +115,37 @@ export class AgentVariations extends APIResource {
100
115
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
101
116
  });
102
117
  }
118
+
119
+ /**
120
+ * Detaches a memory layer assignment from a variation, identified by the
121
+ * assignment id.
122
+ */
123
+ removeMemoryLayer(
124
+ id: string,
125
+ params: AgentVariationRemoveMemoryLayerParams,
126
+ options?: RequestOptions,
127
+ ): APIPromise<void> {
128
+ const { agentVariationId } = params;
129
+ return this._client.delete(path`/v1/agent_variations/${agentVariationId}/memory_layers/${id}`, {
130
+ ...options,
131
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
132
+ });
133
+ }
134
+
135
+ /**
136
+ * Updates the position of a memory layer assignment on a variation.
137
+ */
138
+ updateMemoryLayer(
139
+ id: string,
140
+ params: AgentVariationUpdateMemoryLayerParams,
141
+ options?: RequestOptions,
142
+ ): APIPromise<VariationMemoryLayerAssignment> {
143
+ const { agentVariationId, ...body } = params;
144
+ return this._client.patch(path`/v1/agent_variations/${agentVariationId}/memory_layers/${id}`, {
145
+ body,
146
+ ...options,
147
+ });
148
+ }
103
149
  }
104
150
 
105
151
  export type AgentVariationsCursorPagination = CursorPagination<AgentVariation>;
@@ -147,6 +193,17 @@ export interface AgentVariationInfo {
147
193
  */
148
194
  feedbackCount?: number;
149
195
 
196
+ /**
197
+ * Read-only list of memory layer assignments for this variation, returned in
198
+ * ascending `position` (bottom → top). Capped at 10 entries.
199
+ */
200
+ memoryLayerAssignments?: Array<VariationMemoryLayerAssignment>;
201
+
202
+ /**
203
+ * Count of memory layer assignments.
204
+ */
205
+ memoryLayerCount?: number;
206
+
150
207
  /**
151
208
  * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
152
209
  */
@@ -395,6 +452,41 @@ export interface VariationAssignment {
395
452
  toolSet?: Shared.BareMetadata;
396
453
  }
397
454
 
455
+ /**
456
+ * VariationMemoryLayerAssignment attaches a single MemoryLayer to a variation at a
457
+ * given position in the variation's baseline memory stack. A variation has at most
458
+ * one assignment per memory_layer_id.
459
+ *
460
+ * Variations only support whole-layer attachments — entry pinning is an
461
+ * objective-level capability.
462
+ */
463
+ export interface VariationMemoryLayerAssignment {
464
+ /**
465
+ * Assignment row id — handle for removing the assignment. Distinct from the
466
+ * referenced memory layer's id.
467
+ */
468
+ id?: string;
469
+
470
+ /**
471
+ * BareMetadata contains the minimal metadata for a resource: the ID and an
472
+ * optional human-readable name. These are used for reference fields where the full
473
+ * metadata (account scoping, timestamps, labels, external IDs) is not needed —
474
+ * e.g., the tool references inside an agent variation spec or the tools assigned
475
+ * to an objective. Both fields are server-populated; clients provide IDs through
476
+ * sibling fields rather than by constructing a BareMetadata themselves.
477
+ */
478
+ memoryLayer?: Shared.BareMetadata;
479
+
480
+ /**
481
+ * Position in the variation's baseline stack. Lower values sit lower; the
482
+ * highest-position assignment is on top of the variation's baseline. Gaps are fine
483
+ * — only relative position matters. Positions must be unique within a variation; a
484
+ * request that would collide with an existing assignment's position is rejected
485
+ * with InvalidArgument.
486
+ */
487
+ position?: number;
488
+ }
489
+
398
490
  export interface AgentVariationCreateParams {
399
491
  /**
400
492
  * CreateResourceMetadata contains the user-provided fields for creating a
@@ -469,10 +561,38 @@ export interface AgentVariationAddAssignmentParams {
469
561
  toolSetId?: string;
470
562
  }
471
563
 
564
+ export interface AgentVariationAddMemoryLayerParams {
565
+ /**
566
+ * Layer to attach. Accepts memlyr\_… or external_id:… form.
567
+ */
568
+ memoryLayerId?: string;
569
+
570
+ /**
571
+ * Position in the stack. If omitted, server appends (max existing position + 1).
572
+ */
573
+ position?: number;
574
+ }
575
+
472
576
  export interface AgentVariationRemoveAssignmentParams {
473
577
  agentVariationId: string;
474
578
  }
475
579
 
580
+ export interface AgentVariationRemoveMemoryLayerParams {
581
+ agentVariationId: string;
582
+ }
583
+
584
+ export interface AgentVariationUpdateMemoryLayerParams {
585
+ /**
586
+ * Path param
587
+ */
588
+ agentVariationId: string;
589
+
590
+ /**
591
+ * Body param: New position. Only field currently updatable on an assignment.
592
+ */
593
+ position?: number;
594
+ }
595
+
476
596
  export declare namespace AgentVariations {
477
597
  export {
478
598
  type AgentVariation as AgentVariation,
@@ -487,6 +607,7 @@ export declare namespace AgentVariations {
487
607
  type ToolSelectionAssignedTools as ToolSelectionAssignedTools,
488
608
  type ToolSelectionAutoDiscovery as ToolSelectionAutoDiscovery,
489
609
  type VariationAssignment as VariationAssignment,
610
+ type VariationMemoryLayerAssignment as VariationMemoryLayerAssignment,
490
611
  type AgentVariationsCursorPagination as AgentVariationsCursorPagination,
491
612
  type AgentVariationCreateParams as AgentVariationCreateParams,
492
613
  type AgentVariationRetrieveParams as AgentVariationRetrieveParams,
@@ -494,6 +615,9 @@ export declare namespace AgentVariations {
494
615
  type AgentVariationListParams as AgentVariationListParams,
495
616
  type AgentVariationDeleteParams as AgentVariationDeleteParams,
496
617
  type AgentVariationAddAssignmentParams as AgentVariationAddAssignmentParams,
618
+ type AgentVariationAddMemoryLayerParams as AgentVariationAddMemoryLayerParams,
497
619
  type AgentVariationRemoveAssignmentParams as AgentVariationRemoveAssignmentParams,
620
+ type AgentVariationRemoveMemoryLayerParams as AgentVariationRemoveMemoryLayerParams,
621
+ type AgentVariationUpdateMemoryLayerParams as AgentVariationUpdateMemoryLayerParams,
498
622
  };
499
623
  }
@@ -69,7 +69,8 @@ export interface WebhookDeliveryData {
69
69
  | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE'
70
70
  | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT'
71
71
  | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR'
72
- | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED';
72
+ | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED'
73
+ | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ';
73
74
 
74
75
  /**
75
76
  * Response details (no response_body to avoid storing large payloads)
@@ -127,7 +128,8 @@ export interface WebhookDeliveryListParams extends CursorPaginationParams {
127
128
  | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE'
128
129
  | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT'
129
130
  | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR'
130
- | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED';
131
+ | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED'
132
+ | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ';
131
133
 
132
134
  /**
133
135
  * Optional filter by objective ID
@@ -33,13 +33,17 @@ export {
33
33
  type ToolSelectionAssignedTools,
34
34
  type ToolSelectionAutoDiscovery,
35
35
  type VariationAssignment,
36
+ type VariationMemoryLayerAssignment,
36
37
  type AgentVariationCreateParams,
37
38
  type AgentVariationRetrieveParams,
38
39
  type AgentVariationUpdateParams,
39
40
  type AgentVariationListParams,
40
41
  type AgentVariationDeleteParams,
41
42
  type AgentVariationAddAssignmentParams,
43
+ type AgentVariationAddMemoryLayerParams,
42
44
  type AgentVariationRemoveAssignmentParams,
45
+ type AgentVariationRemoveMemoryLayerParams,
46
+ type AgentVariationUpdateMemoryLayerParams,
43
47
  type AgentVariationsCursorPagination,
44
48
  } from './agent-variations';
45
49
  export {
@@ -77,6 +81,8 @@ export {
77
81
  type AssistantToolCall,
78
82
  type CallableTool,
79
83
  type ContextWindowCompacted,
84
+ type MemoryRead,
85
+ type MemoryReference,
80
86
  type Objective,
81
87
  type ObjectiveContextWindow,
82
88
  type ObjectiveContextWindowData,
@@ -126,8 +126,6 @@ export interface MemoryEntryCreateSpec {
126
126
 
127
127
  description?: string;
128
128
 
129
- title?: string;
130
-
131
129
  /**
132
130
  * ID of a COMPLETE Upload. The server reads the object from storage, copies its
133
131
  * bytes into the entry, and marks the upload consumed.
@@ -144,7 +142,7 @@ export interface MemoryEntryDetail {
144
142
  /**
145
143
  * The resolved body of the entry. For entries created or updated via an upload_id,
146
144
  * this is the ingested content, not the original upload handle. May be empty; an
147
- * entry with only a key, title, and description is valid (e.g., a stub skill being
145
+ * entry with only a key and description is valid (e.g., a stub skill being
148
146
  * drafted, or an entry where the frontmatter alone is the payload).
149
147
  */
150
148
  content: string;
@@ -211,12 +209,6 @@ export interface MemoryEntrySpec {
211
209
  * advertise frontmatter.
212
210
  */
213
211
  description?: string;
214
-
215
- /**
216
- * Short human/LLM-readable title shown in the frontmatter manifest for skills
217
- * entries. Ignored for layer types that do not advertise frontmatter.
218
- */
219
- title?: string;
220
212
  }
221
213
 
222
214
  /**
@@ -232,8 +224,6 @@ export interface MemoryEntryUpdateSpec {
232
224
 
233
225
  key?: string;
234
226
 
235
- title?: string;
236
-
237
227
  uploadId?: string;
238
228
  }
239
229
 
@@ -90,8 +90,7 @@ export type MemoryLayersCursorPagination = CursorPagination<MemoryLayer>;
90
90
  * controls how its entries participate in the agent loop — see MemoryLayerType for
91
91
  * details.
92
92
  *
93
- * Memory stacks are LIFO: when an objective resolves a key, layers are walked from
94
- * the top of the stack downward, and the first matching entry wins.
93
+ * See "Memory stack composition" above for how layers compose at lookup time.
95
94
  */
96
95
  export interface MemoryLayer {
97
96
  /**
@@ -15,6 +15,8 @@ export {
15
15
  type AssistantToolCall,
16
16
  type CallableTool,
17
17
  type ContextWindowCompacted,
18
+ type MemoryRead,
19
+ type MemoryReference,
18
20
  type Objective,
19
21
  type ObjectiveContextWindow,
20
22
  type ObjectiveContextWindowData,
@@ -207,6 +207,51 @@ export interface ContextWindowCompacted {
207
207
  summary?: string;
208
208
  }
209
209
 
210
+ /**
211
+ * MemoryRead is emitted each time the agent resolves a key against the memory
212
+ * stack and loads an entry. Lookups that miss (key not found in any layer) do not
213
+ * emit this event.
214
+ */
215
+ export interface MemoryRead {
216
+ /**
217
+ * The specific entry that was read.
218
+ */
219
+ memoryEntryId?: string;
220
+
221
+ /**
222
+ * The layer the entry resolved to. The top-most layer that contained the key —
223
+ * other layers beneath it that also contained the key are shadowed and not
224
+ * referenced here.
225
+ */
226
+ memoryLayerId?: string;
227
+
228
+ /**
229
+ * Human-readable description of the read, set by the runtime. For example: "Loaded
230
+ * skill", "Resolved context key". Not machine-parsed; intended for UI display
231
+ * alongside the other events in an objective's timeline.
232
+ */
233
+ message?: string;
234
+ }
235
+
236
+ /**
237
+ * MemoryReference identifies a memory layer or a specific entry within one, for
238
+ * composition into a memory stack. Used on objectives (where entry pinning is
239
+ * permitted).
240
+ *
241
+ * memory*layer_id accepts both the canonical form (memlyr*…) and the external-id
242
+ * form (external_id:my-custom-id). The same applies to memory_entry_id.
243
+ */
244
+ export interface MemoryReference {
245
+ /**
246
+ * When set, pushes only this entry from memory_layer_id onto the stack — behaves
247
+ * as a single-entry layer (only this key resolves at this position). The entry
248
+ * must belong to memory_layer_id; mismatches are rejected with InvalidArgument.
249
+ */
250
+ memoryEntryId?: string;
251
+
252
+ memoryLayerId?: string;
253
+ }
254
+
210
255
  export interface Objective {
211
256
  data: ObjectiveData;
212
257
 
@@ -316,6 +361,29 @@ export interface ObjectiveData {
316
361
  */
317
362
  initialMessage?: string;
318
363
 
364
+ /**
365
+ * Memory layers/entries to push onto this objective's memory stack on top of the
366
+ * baseline stack inherited from the selected variation.
367
+ *
368
+ * See "Memory stack composition" in memory.proto for lookup semantics.
369
+ *
370
+ * Array order is push order: the first element sits lower in the objective's
371
+ * contribution to the stack; the LAST element ends up on top of the effective
372
+ * stack. Entries pinned via memory_entry_id behave as single-entry layers at their
373
+ * position.
374
+ *
375
+ * System-managed layers (e.g., episodic) cannot be referenced here; they attach
376
+ * themselves automatically via the runtime based on episodic_key.
377
+ *
378
+ * Stack size cap: the TOTAL effective stack (variation's memory layers
379
+ *
380
+ * - this field) must not exceed 10 entries. A request that would produce an
381
+ * effective stack larger than 10 is rejected with InvalidArgument. Variations
382
+ * themselves are capped at 10 memory layer assignments, so a variation that is
383
+ * already "full" leaves no room for objective-level references.
384
+ */
385
+ memoryStack?: Array<MemoryReference>;
386
+
319
387
  /**
320
388
  * A parent objective means the objective was spawned off using a separate agent to
321
389
  * complete an objective
@@ -358,6 +426,13 @@ export interface ObjectiveEventData {
358
426
 
359
427
  error?: ObjectiveError;
360
428
 
429
+ /**
430
+ * MemoryRead is emitted each time the agent resolves a key against the memory
431
+ * stack and loads an entry. Lookups that miss (key not found in any layer) do not
432
+ * emit this event.
433
+ */
434
+ memoryRead?: MemoryRead;
435
+
361
436
  subObjectiveCreated?: SubObjectiveCreated;
362
437
 
363
438
  toolApprovalRequested?: ToolApprovalRequested;
@@ -472,6 +547,14 @@ export interface ObjectiveInfo {
472
547
  */
473
548
  createdBy?: AccountAPI.Profile;
474
549
 
550
+ /**
551
+ * The effective memory stack at objective creation time, flattened from the
552
+ * variation's baseline plus ObjectiveData.memory_stack. Order is push order (last
553
+ * = top). Returned on reads so clients can see exactly what stack the objective is
554
+ * using without having to re-join variation state.
555
+ */
556
+ effectiveMemoryStack?: Array<MemoryReference>;
557
+
475
558
  /**
476
559
  * Total number of context windows that this objective has generated
477
560
  */
@@ -746,6 +829,8 @@ export declare namespace Objectives {
746
829
  type AssistantToolCall as AssistantToolCall,
747
830
  type CallableTool as CallableTool,
748
831
  type ContextWindowCompacted as ContextWindowCompacted,
832
+ type MemoryRead as MemoryRead,
833
+ type MemoryReference as MemoryReference,
749
834
  type Objective as Objective,
750
835
  type ObjectiveContextWindow as ObjectiveContextWindow,
751
836
  type ObjectiveContextWindowData as ObjectiveContextWindowData,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.45.0'; // x-release-please-version
1
+ export const VERSION = '0.47.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.45.0";
1
+ export declare const VERSION = "0.47.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.45.0";
1
+ export declare const VERSION = "0.47.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.45.0'; // x-release-please-version
4
+ exports.VERSION = '0.47.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.45.0'; // x-release-please-version
1
+ export const VERSION = '0.47.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map