@cadenya/cadenya 0.102.0 → 0.104.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.
- package/CHANGELOG.md +16 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agents/agents.d.mts +11 -10
- package/resources/agents/agents.d.mts.map +1 -1
- package/resources/agents/agents.d.ts +11 -10
- package/resources/agents/agents.d.ts.map +1 -1
- package/resources/agents/agents.js.map +1 -1
- package/resources/agents/agents.mjs.map +1 -1
- package/resources/agents/schedules.d.mts +12 -11
- package/resources/agents/schedules.d.mts.map +1 -1
- package/resources/agents/schedules.d.ts +12 -11
- package/resources/agents/schedules.d.ts.map +1 -1
- package/resources/agents/variations.d.mts +11 -9
- package/resources/agents/variations.d.mts.map +1 -1
- package/resources/agents/variations.d.ts +11 -9
- package/resources/agents/variations.d.ts.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/objectives/index.d.mts +1 -1
- package/resources/objectives/index.d.mts.map +1 -1
- package/resources/objectives/index.d.ts +1 -1
- package/resources/objectives/index.d.ts.map +1 -1
- package/resources/objectives/index.js.map +1 -1
- package/resources/objectives/index.mjs.map +1 -1
- package/resources/objectives/objectives.d.mts +121 -28
- package/resources/objectives/objectives.d.mts.map +1 -1
- package/resources/objectives/objectives.d.ts +121 -28
- package/resources/objectives/objectives.d.ts.map +1 -1
- package/resources/objectives/objectives.js +10 -0
- package/resources/objectives/objectives.js.map +1 -1
- package/resources/objectives/objectives.mjs +10 -0
- package/resources/objectives/objectives.mjs.map +1 -1
- package/src/client.ts +8 -0
- package/src/resources/agents/agents.ts +10 -9
- package/src/resources/agents/schedules.ts +12 -11
- package/src/resources/agents/variations.ts +12 -10
- package/src/resources/index.ts +4 -0
- package/src/resources/objectives/index.ts +4 -0
- package/src/resources/objectives/objectives.ts +145 -24
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -85,6 +85,16 @@ export class Objectives extends APIResource {
|
|
|
85
85
|
const { workspaceId, ...query } = params;
|
|
86
86
|
return this._client.getAPIList(path `/v1/workspaces/${workspaceId}/objectives/${objectiveID}/events`, (CursorPagination), { query, ...options });
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns the context-usage breakdown measured for the objective's most recent
|
|
90
|
+
* iteration: character lengths per context component (system prompt, memory
|
|
91
|
+
* appendices, tool definitions, messages by role) alongside the iteration's input
|
|
92
|
+
* token counts.
|
|
93
|
+
*/
|
|
94
|
+
retrieveDiagnostics(objectiveID, params, options) {
|
|
95
|
+
const { workspaceId } = params;
|
|
96
|
+
return this._client.get(path `/v1/workspaces/${workspaceId}/objectives/${objectiveID}/diagnostics`, options);
|
|
97
|
+
}
|
|
88
98
|
/**
|
|
89
99
|
* Streams events for an objective in real-time using server-sent events (SSE)
|
|
90
100
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectives.mjs","sourceRoot":"","sources":["../../src/resources/objectives/objectives.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAOlD,OAAO,KAAK,WAAW,uBAAmB;AAC1C,OAAO,EACL,QAAQ,GAOT,uBAAmB;AACpB,OAAO,KAAK,QAAQ,oBAAgB;AACpC,OAAO,EAML,KAAK,GACN,oBAAgB;AACjB,OAAO,KAAK,YAAY,yBAAqB;AAC7C,OAAO,EAgBL,SAAS,GACV,yBAAqB;AACtB,OAAO,KAAK,QAAQ,oBAAgB;AACpC,OAAO,EAAiE,KAAK,EAAE,oBAAgB;AAE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AExB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CACrB,IAAI,CAAA,kBAAkB,WAAW,eAAe,WAAW,cAAc,EACzE,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,YAAY,CACV,WAAmB,EACnB,MAAmC,EACnC,OAAwB;QAExB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,kBAAkB,WAAW,eAAe,WAAW,gBAAgB,EAAE;YACnG,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAuC,CAAC;IAC3C,CAAC;CACF;AAwgCD,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;AACzB,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;AACjC,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;AACzB,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
|
package/src/client.ts
CHANGED
|
@@ -130,6 +130,7 @@ import {
|
|
|
130
130
|
AssistantMessage,
|
|
131
131
|
AssistantToolCall,
|
|
132
132
|
CallableTool,
|
|
133
|
+
ContextLengths,
|
|
133
134
|
ContextWindowCompacted,
|
|
134
135
|
MemoryRead,
|
|
135
136
|
MemoryReference,
|
|
@@ -143,6 +144,7 @@ import {
|
|
|
143
144
|
ObjectiveContextWindowsCursorPagination,
|
|
144
145
|
ObjectiveContinueParams,
|
|
145
146
|
ObjectiveCreateParams,
|
|
147
|
+
ObjectiveDiagnostics,
|
|
146
148
|
ObjectiveError,
|
|
147
149
|
ObjectiveEvent,
|
|
148
150
|
ObjectiveEventData,
|
|
@@ -153,6 +155,8 @@ import {
|
|
|
153
155
|
ObjectiveListContextWindowsParams,
|
|
154
156
|
ObjectiveListEventsParams,
|
|
155
157
|
ObjectiveListParams,
|
|
158
|
+
ObjectiveRetrieveDiagnosticsParams,
|
|
159
|
+
ObjectiveRetrieveDiagnosticsResponse,
|
|
156
160
|
ObjectiveRetrieveParams,
|
|
157
161
|
ObjectiveSecret,
|
|
158
162
|
ObjectiveStreamEventsParams,
|
|
@@ -1102,6 +1106,7 @@ export declare namespace Cadenya {
|
|
|
1102
1106
|
type AssistantMessage as AssistantMessage,
|
|
1103
1107
|
type AssistantToolCall as AssistantToolCall,
|
|
1104
1108
|
type CallableTool as CallableTool,
|
|
1109
|
+
type ContextLengths as ContextLengths,
|
|
1105
1110
|
type ContextWindowCompacted as ContextWindowCompacted,
|
|
1106
1111
|
type MemoryRead as MemoryRead,
|
|
1107
1112
|
type MemoryReference as MemoryReference,
|
|
@@ -1109,6 +1114,7 @@ export declare namespace Cadenya {
|
|
|
1109
1114
|
type ObjectiveConfigSnapshot as ObjectiveConfigSnapshot,
|
|
1110
1115
|
type ObjectiveContextWindow as ObjectiveContextWindow,
|
|
1111
1116
|
type ObjectiveContextWindowData as ObjectiveContextWindowData,
|
|
1117
|
+
type ObjectiveDiagnostics as ObjectiveDiagnostics,
|
|
1112
1118
|
type ObjectiveError as ObjectiveError,
|
|
1113
1119
|
type ObjectiveEvent as ObjectiveEvent,
|
|
1114
1120
|
type ObjectiveEventData as ObjectiveEventData,
|
|
@@ -1126,6 +1132,7 @@ export declare namespace Cadenya {
|
|
|
1126
1132
|
type ToolResult as ToolResult,
|
|
1127
1133
|
type UserMessage as UserMessage,
|
|
1128
1134
|
type ObjectiveCompactResponse as ObjectiveCompactResponse,
|
|
1135
|
+
type ObjectiveRetrieveDiagnosticsResponse as ObjectiveRetrieveDiagnosticsResponse,
|
|
1129
1136
|
type ObjectivesCursorPagination as ObjectivesCursorPagination,
|
|
1130
1137
|
type ObjectiveContextWindowsCursorPagination as ObjectiveContextWindowsCursorPagination,
|
|
1131
1138
|
type ObjectiveEventsCursorPagination as ObjectiveEventsCursorPagination,
|
|
@@ -1137,6 +1144,7 @@ export declare namespace Cadenya {
|
|
|
1137
1144
|
type ObjectiveContinueParams as ObjectiveContinueParams,
|
|
1138
1145
|
type ObjectiveListContextWindowsParams as ObjectiveListContextWindowsParams,
|
|
1139
1146
|
type ObjectiveListEventsParams as ObjectiveListEventsParams,
|
|
1147
|
+
type ObjectiveRetrieveDiagnosticsParams as ObjectiveRetrieveDiagnosticsParams,
|
|
1140
1148
|
type ObjectiveStreamEventsParams as ObjectiveStreamEventsParams,
|
|
1141
1149
|
};
|
|
1142
1150
|
|
|
@@ -246,15 +246,6 @@ export interface AgentSpec {
|
|
|
246
246
|
*/
|
|
247
247
|
episodicMemoryTtl?: number;
|
|
248
248
|
|
|
249
|
-
/**
|
|
250
|
-
* InputDataSchema is used for enforcing a data input when objectives are created.
|
|
251
|
-
* This is valuable when using liquid formatting in agent variation prompts. Input
|
|
252
|
-
* data schema is also valuable when using an agent as a sub-agent, as the schema
|
|
253
|
-
* is used as the tool's input parameter schema. If omitted, the sub-agent schema
|
|
254
|
-
* will be loaded with a simple "prompt" free text string as its schema.
|
|
255
|
-
*/
|
|
256
|
-
inputDataSchema?: { [key: string]: unknown };
|
|
257
|
-
|
|
258
249
|
/**
|
|
259
250
|
* Optional output definition for objectives created for this agent. When provided,
|
|
260
251
|
* Cadenya will append a tool to that will be called by the LLM in use by the
|
|
@@ -263,6 +254,16 @@ export interface AgentSpec {
|
|
|
263
254
|
*/
|
|
264
255
|
outputDefinition?: { [key: string]: unknown };
|
|
265
256
|
|
|
257
|
+
/**
|
|
258
|
+
* SystemPromptDataSchema enforces the shape of system_prompt_data when objectives
|
|
259
|
+
* are created. This is valuable when using liquid formatting in agent variation
|
|
260
|
+
* system prompt templates. The schema is also used when the agent is attached as a
|
|
261
|
+
* sub-agent, as it becomes the tool's input parameter schema. If omitted, the
|
|
262
|
+
* sub-agent schema will be loaded with a simple "prompt" free text string as its
|
|
263
|
+
* schema.
|
|
264
|
+
*/
|
|
265
|
+
systemPromptDataSchema?: { [key: string]: unknown };
|
|
266
|
+
|
|
266
267
|
/**
|
|
267
268
|
* The URL that Cadenya will send events for any objective assigned to the agent.
|
|
268
269
|
*/
|
|
@@ -194,17 +194,18 @@ export interface AgentScheduleSpec {
|
|
|
194
194
|
schedule: AgentScheduleSpecSchedule;
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
* Optional
|
|
198
|
-
*
|
|
197
|
+
* Optional explicit first user message passed to CreateObjective on each fire.
|
|
198
|
+
* Becomes the first user message in the objective's chat history. When unset, the
|
|
199
|
+
* fired objective defers to the selected variation's first_user_message_template.
|
|
199
200
|
*/
|
|
200
|
-
|
|
201
|
+
firstUserMessage?: string;
|
|
201
202
|
|
|
202
203
|
/**
|
|
203
|
-
* Optional
|
|
204
|
-
*
|
|
205
|
-
*
|
|
204
|
+
* Optional data rendered into the variation's first_user_message_template when
|
|
205
|
+
* each fired objective is created. Separate from `system_prompt_data`, which
|
|
206
|
+
* renders the system prompt template.
|
|
206
207
|
*/
|
|
207
|
-
|
|
208
|
+
firstUserMessageData?: unknown;
|
|
208
209
|
|
|
209
210
|
/**
|
|
210
211
|
* What to do when the previous run is still in flight. Defaults to SKIP.
|
|
@@ -212,11 +213,11 @@ export interface AgentScheduleSpec {
|
|
|
212
213
|
overlapPolicy?: 'OVERLAP_POLICY_UNSPECIFIED' | 'OVERLAP_POLICY_ALLOW' | 'OVERLAP_POLICY_SKIP';
|
|
213
214
|
|
|
214
215
|
/**
|
|
215
|
-
* Optional data rendered into the variation's
|
|
216
|
-
* fired objective is created.
|
|
217
|
-
*
|
|
216
|
+
* Optional data rendered into the variation's system_prompt_template when each
|
|
217
|
+
* fired objective is created. If the agent has a system_prompt_data_schema, this
|
|
218
|
+
* must satisfy it.
|
|
218
219
|
*/
|
|
219
|
-
|
|
220
|
+
systemPromptData?: unknown;
|
|
220
221
|
|
|
221
222
|
/**
|
|
222
223
|
* Optional explicit variation. When unset, the agent's variation_selection_mode
|
|
@@ -262,6 +262,16 @@ export interface AgentVariationSpec {
|
|
|
262
262
|
*/
|
|
263
263
|
description?: string;
|
|
264
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Liquid template for the first user message of objectives using this variation.
|
|
267
|
+
* Rendered with CreateObjectiveRequest.first_user_message_data into
|
|
268
|
+
* Objective.first_user_message, the first user message in the LLM chat history.
|
|
269
|
+
* CreateObjectiveRequest.first_user_message, when set, overrides the rendered
|
|
270
|
+
* result. If neither this template nor first_user_message is present, objective
|
|
271
|
+
* creation is rejected with InvalidArgument.
|
|
272
|
+
*/
|
|
273
|
+
firstUserMessageTemplate?: string;
|
|
274
|
+
|
|
265
275
|
/**
|
|
266
276
|
* ModelConfig defines the model configuration for a variation
|
|
267
277
|
*/
|
|
@@ -278,19 +288,11 @@ export interface AgentVariationSpec {
|
|
|
278
288
|
|
|
279
289
|
/**
|
|
280
290
|
* Liquid template for the system prompt of objectives using this variation.
|
|
281
|
-
* Rendered with CreateObjectiveRequest.
|
|
291
|
+
* Rendered with CreateObjectiveRequest.system_prompt_data into
|
|
292
|
+
* Objective.system_prompt.
|
|
282
293
|
*/
|
|
283
294
|
systemPromptTemplate?: string;
|
|
284
295
|
|
|
285
|
-
/**
|
|
286
|
-
* Liquid template for the initial user message of objectives using this variation.
|
|
287
|
-
* Rendered with CreateObjectiveRequest.user_data and becomes the first user
|
|
288
|
-
* message in the LLM chat history. CreateObjectiveRequest.initial_message, when
|
|
289
|
-
* set, overrides the rendered result. If neither this template nor initial_message
|
|
290
|
-
* is present, objective creation is rejected with InvalidArgument.
|
|
291
|
-
*/
|
|
292
|
-
userMessageTemplate?: string;
|
|
293
|
-
|
|
294
296
|
/**
|
|
295
297
|
* Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights).
|
|
296
298
|
* Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0
|
package/src/resources/index.ts
CHANGED
|
@@ -80,6 +80,7 @@ export {
|
|
|
80
80
|
type AssistantMessage,
|
|
81
81
|
type AssistantToolCall,
|
|
82
82
|
type CallableTool,
|
|
83
|
+
type ContextLengths,
|
|
83
84
|
type ContextWindowCompacted,
|
|
84
85
|
type MemoryRead,
|
|
85
86
|
type MemoryReference,
|
|
@@ -87,6 +88,7 @@ export {
|
|
|
87
88
|
type ObjectiveConfigSnapshot,
|
|
88
89
|
type ObjectiveContextWindow,
|
|
89
90
|
type ObjectiveContextWindowData,
|
|
91
|
+
type ObjectiveDiagnostics,
|
|
90
92
|
type ObjectiveError,
|
|
91
93
|
type ObjectiveEvent,
|
|
92
94
|
type ObjectiveEventData,
|
|
@@ -104,6 +106,7 @@ export {
|
|
|
104
106
|
type ToolResult,
|
|
105
107
|
type UserMessage,
|
|
106
108
|
type ObjectiveCompactResponse,
|
|
109
|
+
type ObjectiveRetrieveDiagnosticsResponse,
|
|
107
110
|
type ObjectiveCreateParams,
|
|
108
111
|
type ObjectiveRetrieveParams,
|
|
109
112
|
type ObjectiveListParams,
|
|
@@ -112,6 +115,7 @@ export {
|
|
|
112
115
|
type ObjectiveContinueParams,
|
|
113
116
|
type ObjectiveListContextWindowsParams,
|
|
114
117
|
type ObjectiveListEventsParams,
|
|
118
|
+
type ObjectiveRetrieveDiagnosticsParams,
|
|
115
119
|
type ObjectiveStreamEventsParams,
|
|
116
120
|
type ObjectivesCursorPagination,
|
|
117
121
|
type ObjectiveContextWindowsCursorPagination,
|
|
@@ -14,6 +14,7 @@ export {
|
|
|
14
14
|
type AssistantMessage,
|
|
15
15
|
type AssistantToolCall,
|
|
16
16
|
type CallableTool,
|
|
17
|
+
type ContextLengths,
|
|
17
18
|
type ContextWindowCompacted,
|
|
18
19
|
type MemoryRead,
|
|
19
20
|
type MemoryReference,
|
|
@@ -21,6 +22,7 @@ export {
|
|
|
21
22
|
type ObjectiveConfigSnapshot,
|
|
22
23
|
type ObjectiveContextWindow,
|
|
23
24
|
type ObjectiveContextWindowData,
|
|
25
|
+
type ObjectiveDiagnostics,
|
|
24
26
|
type ObjectiveError,
|
|
25
27
|
type ObjectiveEvent,
|
|
26
28
|
type ObjectiveEventData,
|
|
@@ -38,6 +40,7 @@ export {
|
|
|
38
40
|
type ToolResult,
|
|
39
41
|
type UserMessage,
|
|
40
42
|
type ObjectiveCompactResponse,
|
|
43
|
+
type ObjectiveRetrieveDiagnosticsResponse,
|
|
41
44
|
type ObjectiveCreateParams,
|
|
42
45
|
type ObjectiveRetrieveParams,
|
|
43
46
|
type ObjectiveListParams,
|
|
@@ -46,6 +49,7 @@ export {
|
|
|
46
49
|
type ObjectiveContinueParams,
|
|
47
50
|
type ObjectiveListContextWindowsParams,
|
|
48
51
|
type ObjectiveListEventsParams,
|
|
52
|
+
type ObjectiveRetrieveDiagnosticsParams,
|
|
49
53
|
type ObjectiveStreamEventsParams,
|
|
50
54
|
type ObjectivesCursorPagination,
|
|
51
55
|
type ObjectiveContextWindowsCursorPagination,
|
|
@@ -170,6 +170,24 @@ export class Objectives extends APIResource {
|
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Returns the context-usage breakdown measured for the objective's most recent
|
|
175
|
+
* iteration: character lengths per context component (system prompt, memory
|
|
176
|
+
* appendices, tool definitions, messages by role) alongside the iteration's input
|
|
177
|
+
* token counts.
|
|
178
|
+
*/
|
|
179
|
+
retrieveDiagnostics(
|
|
180
|
+
objectiveID: string,
|
|
181
|
+
params: ObjectiveRetrieveDiagnosticsParams,
|
|
182
|
+
options?: RequestOptions,
|
|
183
|
+
): APIPromise<ObjectiveRetrieveDiagnosticsResponse> {
|
|
184
|
+
const { workspaceId } = params;
|
|
185
|
+
return this._client.get(
|
|
186
|
+
path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}/diagnostics`,
|
|
187
|
+
options,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
173
191
|
/**
|
|
174
192
|
* Streams events for an objective in real-time using server-sent events (SSE)
|
|
175
193
|
*/
|
|
@@ -236,6 +254,59 @@ export interface CallableTool {
|
|
|
236
254
|
tool?: Shared.ResourceMetadata;
|
|
237
255
|
}
|
|
238
256
|
|
|
257
|
+
/**
|
|
258
|
+
* ContextLengths is the measured character length of each distinct component of an
|
|
259
|
+
* iteration's assembled context window. Values are raw character lengths of the
|
|
260
|
+
* component as assembled into the request — token estimates are derived by the
|
|
261
|
+
* client against input_tokens (component share = component length / sum of all
|
|
262
|
+
* lengths).
|
|
263
|
+
*
|
|
264
|
+
* New components are added as new fields — wire-compatible; absent components read
|
|
265
|
+
* as 0.
|
|
266
|
+
*/
|
|
267
|
+
export interface ContextLengths {
|
|
268
|
+
/**
|
|
269
|
+
* Chat history messages with the assistant role.
|
|
270
|
+
*/
|
|
271
|
+
assistantMessages: number;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* The discoverable/available-tools appendix attached to the system prompt.
|
|
275
|
+
*/
|
|
276
|
+
availableTools: number;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* The episodic memory appendix attached to the system prompt.
|
|
280
|
+
*/
|
|
281
|
+
episodicMemory: number;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* The skills memory appendix attached to the system prompt.
|
|
285
|
+
*/
|
|
286
|
+
skillsMemory: number;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* The objective's base system prompt (rendered variation template).
|
|
290
|
+
*/
|
|
291
|
+
systemPrompt: number;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Serialized tool definitions sent with the completion request (names,
|
|
295
|
+
* descriptions, and JSON-schema parameters).
|
|
296
|
+
*/
|
|
297
|
+
toolDefinitions: number;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Tool results present in the chat history.
|
|
301
|
+
*/
|
|
302
|
+
toolResults: number;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Chat history messages with the user role.
|
|
306
|
+
*/
|
|
307
|
+
userMessages: number;
|
|
308
|
+
}
|
|
309
|
+
|
|
239
310
|
export interface ContextWindowCompacted {
|
|
240
311
|
/**
|
|
241
312
|
* Number of messages that were compacted
|
|
@@ -317,10 +388,10 @@ export interface Objective {
|
|
|
317
388
|
configSnapshot: ObjectiveConfigSnapshot;
|
|
318
389
|
|
|
319
390
|
/**
|
|
320
|
-
* The
|
|
321
|
-
* the
|
|
391
|
+
* The first user message in the LLM chat history, either provided explicitly at
|
|
392
|
+
* creation or rendered from the variation's first_user_message_template.
|
|
322
393
|
*/
|
|
323
|
-
|
|
394
|
+
firstUserMessage: string;
|
|
324
395
|
|
|
325
396
|
/**
|
|
326
397
|
* Metadata for ephemeral operations and activities (e.g., objectives, executions,
|
|
@@ -346,14 +417,14 @@ export interface Objective {
|
|
|
346
417
|
systemPrompt: string;
|
|
347
418
|
|
|
348
419
|
/**
|
|
349
|
-
*
|
|
420
|
+
* Episodic is used to configure the episodic memory for the objective
|
|
350
421
|
*/
|
|
351
|
-
|
|
422
|
+
episodicMemory?: Objective.EpisodicMemory;
|
|
352
423
|
|
|
353
424
|
/**
|
|
354
|
-
*
|
|
425
|
+
* Arbitrary data rendered into the variation's first_user_message_template
|
|
355
426
|
*/
|
|
356
|
-
|
|
427
|
+
firstUserMessageData?: { [key: string]: unknown };
|
|
357
428
|
|
|
358
429
|
/**
|
|
359
430
|
* ObjectiveInfo provides read-only aggregated statistics about an objective's
|
|
@@ -403,9 +474,9 @@ export interface Objective {
|
|
|
403
474
|
stateMessage?: string;
|
|
404
475
|
|
|
405
476
|
/**
|
|
406
|
-
* Arbitrary data
|
|
477
|
+
* Arbitrary data rendered into the variation's system_prompt_template
|
|
407
478
|
*/
|
|
408
|
-
|
|
479
|
+
systemPromptData?: { [key: string]: unknown };
|
|
409
480
|
}
|
|
410
481
|
|
|
411
482
|
export namespace Objective {
|
|
@@ -515,6 +586,37 @@ export interface ObjectiveContextWindowData {
|
|
|
515
586
|
sequence?: number;
|
|
516
587
|
}
|
|
517
588
|
|
|
589
|
+
/**
|
|
590
|
+
* ObjectiveDiagnostics is the context-usage breakdown measured for a single
|
|
591
|
+
* iteration at request-assembly time. It reports how much of the context window
|
|
592
|
+
* each component occupies so tool parameters, memory cascades, and prompts can be
|
|
593
|
+
* tuned against real token usage.
|
|
594
|
+
*/
|
|
595
|
+
export interface ObjectiveDiagnostics {
|
|
596
|
+
/**
|
|
597
|
+
* The portion of input_tokens served from the provider's prompt cache. Lets
|
|
598
|
+
* clients distinguish "big but cached" from "big and paid fresh every iteration".
|
|
599
|
+
*/
|
|
600
|
+
cachedInputTokens: number;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* ContextLengths is the measured character length of each distinct component of an
|
|
604
|
+
* iteration's assembled context window. Values are raw character lengths of the
|
|
605
|
+
* component as assembled into the request — token estimates are derived by the
|
|
606
|
+
* client against input_tokens (component share = component length / sum of all
|
|
607
|
+
* lengths).
|
|
608
|
+
*
|
|
609
|
+
* New components are added as new fields — wire-compatible; absent components read
|
|
610
|
+
* as 0.
|
|
611
|
+
*/
|
|
612
|
+
contextLengths: ContextLengths;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Input tokens reported by the LLM provider for the iteration's completion.
|
|
616
|
+
*/
|
|
617
|
+
inputTokens: number;
|
|
618
|
+
}
|
|
619
|
+
|
|
518
620
|
export interface ObjectiveError {
|
|
519
621
|
message?: string;
|
|
520
622
|
|
|
@@ -899,14 +1001,25 @@ export interface ObjectiveCompactResponse {
|
|
|
899
1001
|
contextWindow?: ObjectiveContextWindowData;
|
|
900
1002
|
}
|
|
901
1003
|
|
|
1004
|
+
export interface ObjectiveRetrieveDiagnosticsResponse {
|
|
1005
|
+
/**
|
|
1006
|
+
* ObjectiveDiagnostics is the context-usage breakdown measured for a single
|
|
1007
|
+
* iteration at request-assembly time. It reports how much of the context window
|
|
1008
|
+
* each component occupies so tool parameters, memory cascades, and prompts can be
|
|
1009
|
+
* tuned against real token usage.
|
|
1010
|
+
*/
|
|
1011
|
+
diagnostics: ObjectiveDiagnostics;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
902
1014
|
export interface ObjectiveCreateParams {
|
|
903
1015
|
agentId: string;
|
|
904
1016
|
|
|
905
1017
|
/**
|
|
906
|
-
* Arbitrary data
|
|
907
|
-
*
|
|
1018
|
+
* Arbitrary data rendered into the selected variation's system_prompt_template
|
|
1019
|
+
* (liquid) to produce the objective's system prompt. If the agent has a
|
|
1020
|
+
* system_prompt_data_schema, this must satisfy it.
|
|
908
1021
|
*/
|
|
909
|
-
|
|
1022
|
+
systemPromptData: { [key: string]: unknown };
|
|
910
1023
|
|
|
911
1024
|
/**
|
|
912
1025
|
* Episodic is used to configure the episodic memory for the objective
|
|
@@ -914,13 +1027,20 @@ export interface ObjectiveCreateParams {
|
|
|
914
1027
|
episodicMemory?: ObjectiveCreateParams.EpisodicMemory;
|
|
915
1028
|
|
|
916
1029
|
/**
|
|
917
|
-
* Optional
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
*
|
|
1030
|
+
* Optional explicit first user message for the LLM chat history. When not set, the
|
|
1031
|
+
* selected variation's first_user_message_template is rendered with
|
|
1032
|
+
* first_user_message_data instead. If neither this field nor a
|
|
1033
|
+
* first_user_message_template is present, the request is rejected with
|
|
921
1034
|
* InvalidArgument.
|
|
922
1035
|
*/
|
|
923
|
-
|
|
1036
|
+
firstUserMessage?: string;
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Arbitrary data rendered into the selected variation's
|
|
1040
|
+
* first_user_message_template (liquid) to produce the first user message. Separate
|
|
1041
|
+
* from `system_prompt_data`, which renders the system prompt template.
|
|
1042
|
+
*/
|
|
1043
|
+
firstUserMessageData?: { [key: string]: unknown };
|
|
924
1044
|
|
|
925
1045
|
/**
|
|
926
1046
|
* Memory layers/entries layered over the baseline cascade inherited from the
|
|
@@ -952,13 +1072,6 @@ export interface ObjectiveCreateParams {
|
|
|
952
1072
|
*/
|
|
953
1073
|
secrets?: Array<ObjectiveCreateParams.Secret>;
|
|
954
1074
|
|
|
955
|
-
/**
|
|
956
|
-
* Arbitrary data rendered into the selected variation's user_message_template
|
|
957
|
-
* (liquid) to produce the initial user message. Separate from `data`, which
|
|
958
|
-
* renders the system prompt template.
|
|
959
|
-
*/
|
|
960
|
-
userData?: { [key: string]: unknown };
|
|
961
|
-
|
|
962
1075
|
/**
|
|
963
1076
|
* Optional explicit variation selection. Overrides the agent's
|
|
964
1077
|
* variation_selection_mode.
|
|
@@ -1114,6 +1227,10 @@ export interface ObjectiveListEventsParams extends CursorPaginationParams {
|
|
|
1114
1227
|
windowId?: string;
|
|
1115
1228
|
}
|
|
1116
1229
|
|
|
1230
|
+
export interface ObjectiveRetrieveDiagnosticsParams {
|
|
1231
|
+
workspaceId: string;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1117
1234
|
export interface ObjectiveStreamEventsParams {
|
|
1118
1235
|
workspaceId: string;
|
|
1119
1236
|
}
|
|
@@ -1128,6 +1245,7 @@ export declare namespace Objectives {
|
|
|
1128
1245
|
type AssistantMessage as AssistantMessage,
|
|
1129
1246
|
type AssistantToolCall as AssistantToolCall,
|
|
1130
1247
|
type CallableTool as CallableTool,
|
|
1248
|
+
type ContextLengths as ContextLengths,
|
|
1131
1249
|
type ContextWindowCompacted as ContextWindowCompacted,
|
|
1132
1250
|
type MemoryRead as MemoryRead,
|
|
1133
1251
|
type MemoryReference as MemoryReference,
|
|
@@ -1135,6 +1253,7 @@ export declare namespace Objectives {
|
|
|
1135
1253
|
type ObjectiveConfigSnapshot as ObjectiveConfigSnapshot,
|
|
1136
1254
|
type ObjectiveContextWindow as ObjectiveContextWindow,
|
|
1137
1255
|
type ObjectiveContextWindowData as ObjectiveContextWindowData,
|
|
1256
|
+
type ObjectiveDiagnostics as ObjectiveDiagnostics,
|
|
1138
1257
|
type ObjectiveError as ObjectiveError,
|
|
1139
1258
|
type ObjectiveEvent as ObjectiveEvent,
|
|
1140
1259
|
type ObjectiveEventData as ObjectiveEventData,
|
|
@@ -1152,6 +1271,7 @@ export declare namespace Objectives {
|
|
|
1152
1271
|
type ToolResult as ToolResult,
|
|
1153
1272
|
type UserMessage as UserMessage,
|
|
1154
1273
|
type ObjectiveCompactResponse as ObjectiveCompactResponse,
|
|
1274
|
+
type ObjectiveRetrieveDiagnosticsResponse as ObjectiveRetrieveDiagnosticsResponse,
|
|
1155
1275
|
type ObjectivesCursorPagination as ObjectivesCursorPagination,
|
|
1156
1276
|
type ObjectiveContextWindowsCursorPagination as ObjectiveContextWindowsCursorPagination,
|
|
1157
1277
|
type ObjectiveEventsCursorPagination as ObjectiveEventsCursorPagination,
|
|
@@ -1163,6 +1283,7 @@ export declare namespace Objectives {
|
|
|
1163
1283
|
type ObjectiveContinueParams as ObjectiveContinueParams,
|
|
1164
1284
|
type ObjectiveListContextWindowsParams as ObjectiveListContextWindowsParams,
|
|
1165
1285
|
type ObjectiveListEventsParams as ObjectiveListEventsParams,
|
|
1286
|
+
type ObjectiveRetrieveDiagnosticsParams as ObjectiveRetrieveDiagnosticsParams,
|
|
1166
1287
|
type ObjectiveStreamEventsParams as ObjectiveStreamEventsParams,
|
|
1167
1288
|
};
|
|
1168
1289
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.104.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.104.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.104.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.104.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|