@linnlabs/linnkit 0.38.0 → 0.38.1

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 (39) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/dist/contracts/agentSpec.d.cts +30 -30
  3. package/dist/contracts/agentSpec.d.ts +30 -30
  4. package/dist/contracts/audit.d.cts +32 -32
  5. package/dist/contracts/audit.d.ts +32 -32
  6. package/dist/contracts/contextPolicy.d.cts +36 -36
  7. package/dist/contracts/contextPolicy.d.ts +36 -36
  8. package/dist/contracts/events.d.cts +1203 -1203
  9. package/dist/contracts/events.d.ts +1203 -1203
  10. package/dist/contracts/execution.d.cts +8 -8
  11. package/dist/contracts/execution.d.ts +8 -8
  12. package/dist/contracts/llm-retry.d.cts +2 -2
  13. package/dist/contracts/llm-retry.d.ts +2 -2
  14. package/dist/contracts/messages.d.cts +1178 -1178
  15. package/dist/contracts/messages.d.ts +1178 -1178
  16. package/dist/contracts/provider-continuation.d.cts +28 -28
  17. package/dist/contracts/provider-continuation.d.ts +28 -28
  18. package/dist/contracts/sse.d.cts +988 -988
  19. package/dist/contracts/sse.d.ts +988 -988
  20. package/dist/contracts/sub-run-trace-payload.d.cts +40 -40
  21. package/dist/contracts/sub-run-trace-payload.d.ts +40 -40
  22. package/dist/contracts/token-accounting.d.cts +38 -38
  23. package/dist/contracts/token-accounting.d.ts +38 -38
  24. package/dist/index.cjs +46 -1
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.js +46 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/runtime-kernel/events/agentEvents.d.cts +184 -184
  29. package/dist/runtime-kernel/events/agentEvents.d.ts +184 -184
  30. package/dist/runtime-kernel.cjs +46 -1
  31. package/dist/runtime-kernel.cjs.map +1 -1
  32. package/dist/runtime-kernel.js +46 -1
  33. package/dist/runtime-kernel.js.map +1 -1
  34. package/dist/testkit.cjs +46 -1
  35. package/dist/testkit.cjs.map +1 -1
  36. package/dist/testkit.js +46 -1
  37. package/dist/testkit.js.map +1 -1
  38. package/docs/integration/tools.md +4 -0
  39. package/package.json +2 -2
@@ -14,12 +14,12 @@ declare const SubRunTraceToolCallDecision: z.ZodObject<{
14
14
  tool_name: z.ZodString;
15
15
  args: z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
16
16
  }, "strict", z.ZodTypeAny, {
17
- tool_name: string;
18
17
  tool_call_id: string & z.BRAND<"ToolCallId">;
18
+ tool_name: string;
19
19
  args: Record<string, SerializableJsonValue>;
20
20
  }, {
21
- tool_name: string;
22
21
  tool_call_id: string;
22
+ tool_name: string;
23
23
  args: Record<string, SerializableJsonValue>;
24
24
  }>;
25
25
  type SubRunTraceToolCallDecision = z.infer<typeof SubRunTraceToolCallDecision>;
@@ -42,7 +42,7 @@ declare const SubRunTracePayload: z.ZodObject<{
42
42
  error: z.ZodString;
43
43
  error_code: z.ZodString;
44
44
  }, "strict", z.ZodTypeAny, {
45
- status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
45
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
46
46
  error: string;
47
47
  error_code: string;
48
48
  retry_id: string;
@@ -54,7 +54,7 @@ declare const SubRunTracePayload: z.ZodObject<{
54
54
  delay_ms: number;
55
55
  next_retry_at?: number | undefined;
56
56
  }, {
57
- status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
57
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
58
58
  error: string;
59
59
  error_code: string;
60
60
  retry_id: string;
@@ -101,12 +101,12 @@ declare const SubRunTracePayload: z.ZodObject<{
101
101
  tool_name: z.ZodString;
102
102
  args: z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
103
103
  }, "strict", z.ZodTypeAny, {
104
- tool_name: string;
105
104
  tool_call_id: string & z.BRAND<"ToolCallId">;
105
+ tool_name: string;
106
106
  args: Record<string, SerializableJsonValue>;
107
107
  }, {
108
- tool_name: string;
109
108
  tool_call_id: string;
109
+ tool_name: string;
110
110
  args: Record<string, SerializableJsonValue>;
111
111
  }>, "many">>;
112
112
  output: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
@@ -151,11 +151,20 @@ declare const SubRunTracePayload: z.ZodObject<{
151
151
  replaced_message_ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
152
152
  meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
153
153
  }, "strip", z.ZodTypeAny, {
154
- kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
154
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
155
155
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
156
156
  subrun_id: string;
157
157
  source_event_id: string;
158
158
  status?: "error" | "loading" | "success" | undefined;
159
+ tool_calls?: {
160
+ tool_call_id: string & z.BRAND<"ToolCallId">;
161
+ tool_name: string;
162
+ args: Record<string, SerializableJsonValue>;
163
+ }[] | undefined;
164
+ tool_call_id?: (string & z.BRAND<"ToolCallId">) | undefined;
165
+ completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
166
+ tool_name?: string | undefined;
167
+ args?: Record<string, SerializableJsonValue> | undefined;
159
168
  content?: string | undefined;
160
169
  attachments?: {
161
170
  id: string;
@@ -169,22 +178,8 @@ declare const SubRunTracePayload: z.ZodObject<{
169
178
  fileName?: string | undefined;
170
179
  label?: string | undefined;
171
180
  }[] | undefined;
172
- delta?: string | undefined;
173
- tool_name?: string | undefined;
174
- tool_call_id?: (string & z.BRAND<"ToolCallId">) | undefined;
175
- phase?: "start" | "update" | "complete" | "error" | undefined;
176
- args?: Record<string, SerializableJsonValue> | undefined;
177
- tool_calls?: {
178
- tool_name: string;
179
- tool_call_id: string & z.BRAND<"ToolCallId">;
180
- args: Record<string, SerializableJsonValue>;
181
- }[] | undefined;
182
- meta?: Record<string, SerializableJsonValue> | undefined;
183
- duration_ms?: number | undefined;
184
- subrun_parent_id?: string | undefined;
185
- output?: SerializableJsonValue | undefined;
186
181
  retry?: {
187
- status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
182
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
188
183
  error: string;
189
184
  error_code: string;
190
185
  retry_id: string;
@@ -196,6 +191,12 @@ declare const SubRunTracePayload: z.ZodObject<{
196
191
  delay_ms: number;
197
192
  next_retry_at?: number | undefined;
198
193
  } | undefined;
194
+ delta?: string | undefined;
195
+ phase?: "error" | "start" | "update" | "complete" | undefined;
196
+ meta?: Record<string, SerializableJsonValue> | undefined;
197
+ duration_ms?: number | undefined;
198
+ subrun_parent_id?: string | undefined;
199
+ output?: SerializableJsonValue | undefined;
199
200
  failure?: {
200
201
  error: string;
201
202
  error_code?: string | undefined;
@@ -206,17 +207,25 @@ declare const SubRunTracePayload: z.ZodObject<{
206
207
  answer_id?: string | undefined;
207
208
  seq?: number | undefined;
208
209
  is_last?: boolean | undefined;
209
- completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
210
210
  original_message_count?: number | undefined;
211
211
  compression_ratio?: number | undefined;
212
212
  included_old_summary?: boolean | undefined;
213
213
  replaced_message_ids?: string[] | undefined;
214
214
  }, {
215
- kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
215
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
216
216
  parent_tool_call_id: string;
217
217
  subrun_id: string;
218
218
  source_event_id: string;
219
219
  status?: "error" | "loading" | "success" | undefined;
220
+ tool_calls?: {
221
+ tool_call_id: string;
222
+ tool_name: string;
223
+ args: Record<string, SerializableJsonValue>;
224
+ }[] | undefined;
225
+ tool_call_id?: string | undefined;
226
+ completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
227
+ tool_name?: string | undefined;
228
+ args?: Record<string, SerializableJsonValue> | undefined;
220
229
  content?: string | undefined;
221
230
  attachments?: {
222
231
  id: string;
@@ -230,22 +239,8 @@ declare const SubRunTracePayload: z.ZodObject<{
230
239
  fileName?: string | undefined;
231
240
  label?: string | undefined;
232
241
  }[] | undefined;
233
- delta?: string | undefined;
234
- tool_name?: string | undefined;
235
- tool_call_id?: string | undefined;
236
- phase?: "start" | "update" | "complete" | "error" | undefined;
237
- args?: Record<string, SerializableJsonValue> | undefined;
238
- tool_calls?: {
239
- tool_name: string;
240
- tool_call_id: string;
241
- args: Record<string, SerializableJsonValue>;
242
- }[] | undefined;
243
- meta?: Record<string, SerializableJsonValue> | undefined;
244
- duration_ms?: number | undefined;
245
- subrun_parent_id?: string | undefined;
246
- output?: SerializableJsonValue | undefined;
247
242
  retry?: {
248
- status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
243
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
249
244
  error: string;
250
245
  error_code: string;
251
246
  retry_id: string;
@@ -257,6 +252,12 @@ declare const SubRunTracePayload: z.ZodObject<{
257
252
  delay_ms: number;
258
253
  next_retry_at?: number | undefined;
259
254
  } | undefined;
255
+ delta?: string | undefined;
256
+ phase?: "error" | "start" | "update" | "complete" | undefined;
257
+ meta?: Record<string, SerializableJsonValue> | undefined;
258
+ duration_ms?: number | undefined;
259
+ subrun_parent_id?: string | undefined;
260
+ output?: SerializableJsonValue | undefined;
260
261
  failure?: {
261
262
  error: string;
262
263
  error_code?: string | undefined;
@@ -267,7 +268,6 @@ declare const SubRunTracePayload: z.ZodObject<{
267
268
  answer_id?: string | undefined;
268
269
  seq?: number | undefined;
269
270
  is_last?: boolean | undefined;
270
- completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
271
271
  original_message_count?: number | undefined;
272
272
  compression_ratio?: number | undefined;
273
273
  included_old_summary?: boolean | undefined;
@@ -14,12 +14,12 @@ declare const SubRunTraceToolCallDecision: z.ZodObject<{
14
14
  tool_name: z.ZodString;
15
15
  args: z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
16
16
  }, "strict", z.ZodTypeAny, {
17
- tool_name: string;
18
17
  tool_call_id: string & z.BRAND<"ToolCallId">;
18
+ tool_name: string;
19
19
  args: Record<string, SerializableJsonValue>;
20
20
  }, {
21
- tool_name: string;
22
21
  tool_call_id: string;
22
+ tool_name: string;
23
23
  args: Record<string, SerializableJsonValue>;
24
24
  }>;
25
25
  type SubRunTraceToolCallDecision = z.infer<typeof SubRunTraceToolCallDecision>;
@@ -42,7 +42,7 @@ declare const SubRunTracePayload: z.ZodObject<{
42
42
  error: z.ZodString;
43
43
  error_code: z.ZodString;
44
44
  }, "strict", z.ZodTypeAny, {
45
- status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
45
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
46
46
  error: string;
47
47
  error_code: string;
48
48
  retry_id: string;
@@ -54,7 +54,7 @@ declare const SubRunTracePayload: z.ZodObject<{
54
54
  delay_ms: number;
55
55
  next_retry_at?: number | undefined;
56
56
  }, {
57
- status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
57
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
58
58
  error: string;
59
59
  error_code: string;
60
60
  retry_id: string;
@@ -101,12 +101,12 @@ declare const SubRunTracePayload: z.ZodObject<{
101
101
  tool_name: z.ZodString;
102
102
  args: z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
103
103
  }, "strict", z.ZodTypeAny, {
104
- tool_name: string;
105
104
  tool_call_id: string & z.BRAND<"ToolCallId">;
105
+ tool_name: string;
106
106
  args: Record<string, SerializableJsonValue>;
107
107
  }, {
108
- tool_name: string;
109
108
  tool_call_id: string;
109
+ tool_name: string;
110
110
  args: Record<string, SerializableJsonValue>;
111
111
  }>, "many">>;
112
112
  output: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
@@ -151,11 +151,20 @@ declare const SubRunTracePayload: z.ZodObject<{
151
151
  replaced_message_ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
152
152
  meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
153
153
  }, "strip", z.ZodTypeAny, {
154
- kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
154
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
155
155
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
156
156
  subrun_id: string;
157
157
  source_event_id: string;
158
158
  status?: "error" | "loading" | "success" | undefined;
159
+ tool_calls?: {
160
+ tool_call_id: string & z.BRAND<"ToolCallId">;
161
+ tool_name: string;
162
+ args: Record<string, SerializableJsonValue>;
163
+ }[] | undefined;
164
+ tool_call_id?: (string & z.BRAND<"ToolCallId">) | undefined;
165
+ completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
166
+ tool_name?: string | undefined;
167
+ args?: Record<string, SerializableJsonValue> | undefined;
159
168
  content?: string | undefined;
160
169
  attachments?: {
161
170
  id: string;
@@ -169,22 +178,8 @@ declare const SubRunTracePayload: z.ZodObject<{
169
178
  fileName?: string | undefined;
170
179
  label?: string | undefined;
171
180
  }[] | undefined;
172
- delta?: string | undefined;
173
- tool_name?: string | undefined;
174
- tool_call_id?: (string & z.BRAND<"ToolCallId">) | undefined;
175
- phase?: "start" | "update" | "complete" | "error" | undefined;
176
- args?: Record<string, SerializableJsonValue> | undefined;
177
- tool_calls?: {
178
- tool_name: string;
179
- tool_call_id: string & z.BRAND<"ToolCallId">;
180
- args: Record<string, SerializableJsonValue>;
181
- }[] | undefined;
182
- meta?: Record<string, SerializableJsonValue> | undefined;
183
- duration_ms?: number | undefined;
184
- subrun_parent_id?: string | undefined;
185
- output?: SerializableJsonValue | undefined;
186
181
  retry?: {
187
- status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
182
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
188
183
  error: string;
189
184
  error_code: string;
190
185
  retry_id: string;
@@ -196,6 +191,12 @@ declare const SubRunTracePayload: z.ZodObject<{
196
191
  delay_ms: number;
197
192
  next_retry_at?: number | undefined;
198
193
  } | undefined;
194
+ delta?: string | undefined;
195
+ phase?: "error" | "start" | "update" | "complete" | undefined;
196
+ meta?: Record<string, SerializableJsonValue> | undefined;
197
+ duration_ms?: number | undefined;
198
+ subrun_parent_id?: string | undefined;
199
+ output?: SerializableJsonValue | undefined;
199
200
  failure?: {
200
201
  error: string;
201
202
  error_code?: string | undefined;
@@ -206,17 +207,25 @@ declare const SubRunTracePayload: z.ZodObject<{
206
207
  answer_id?: string | undefined;
207
208
  seq?: number | undefined;
208
209
  is_last?: boolean | undefined;
209
- completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
210
210
  original_message_count?: number | undefined;
211
211
  compression_ratio?: number | undefined;
212
212
  included_old_summary?: boolean | undefined;
213
213
  replaced_message_ids?: string[] | undefined;
214
214
  }, {
215
- kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
215
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
216
216
  parent_tool_call_id: string;
217
217
  subrun_id: string;
218
218
  source_event_id: string;
219
219
  status?: "error" | "loading" | "success" | undefined;
220
+ tool_calls?: {
221
+ tool_call_id: string;
222
+ tool_name: string;
223
+ args: Record<string, SerializableJsonValue>;
224
+ }[] | undefined;
225
+ tool_call_id?: string | undefined;
226
+ completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
227
+ tool_name?: string | undefined;
228
+ args?: Record<string, SerializableJsonValue> | undefined;
220
229
  content?: string | undefined;
221
230
  attachments?: {
222
231
  id: string;
@@ -230,22 +239,8 @@ declare const SubRunTracePayload: z.ZodObject<{
230
239
  fileName?: string | undefined;
231
240
  label?: string | undefined;
232
241
  }[] | undefined;
233
- delta?: string | undefined;
234
- tool_name?: string | undefined;
235
- tool_call_id?: string | undefined;
236
- phase?: "start" | "update" | "complete" | "error" | undefined;
237
- args?: Record<string, SerializableJsonValue> | undefined;
238
- tool_calls?: {
239
- tool_name: string;
240
- tool_call_id: string;
241
- args: Record<string, SerializableJsonValue>;
242
- }[] | undefined;
243
- meta?: Record<string, SerializableJsonValue> | undefined;
244
- duration_ms?: number | undefined;
245
- subrun_parent_id?: string | undefined;
246
- output?: SerializableJsonValue | undefined;
247
242
  retry?: {
248
- status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
243
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
249
244
  error: string;
250
245
  error_code: string;
251
246
  retry_id: string;
@@ -257,6 +252,12 @@ declare const SubRunTracePayload: z.ZodObject<{
257
252
  delay_ms: number;
258
253
  next_retry_at?: number | undefined;
259
254
  } | undefined;
255
+ delta?: string | undefined;
256
+ phase?: "error" | "start" | "update" | "complete" | undefined;
257
+ meta?: Record<string, SerializableJsonValue> | undefined;
258
+ duration_ms?: number | undefined;
259
+ subrun_parent_id?: string | undefined;
260
+ output?: SerializableJsonValue | undefined;
260
261
  failure?: {
261
262
  error: string;
262
263
  error_code?: string | undefined;
@@ -267,7 +268,6 @@ declare const SubRunTracePayload: z.ZodObject<{
267
268
  answer_id?: string | undefined;
268
269
  seq?: number | undefined;
269
270
  is_last?: boolean | undefined;
270
- completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
271
271
  original_message_count?: number | undefined;
272
272
  compression_ratio?: number | undefined;
273
273
  included_old_summary?: boolean | undefined;
@@ -56,18 +56,18 @@ declare const ContextTokenComponent: z.ZodObject<{
56
56
  profileId: z.ZodOptional<z.ZodString>;
57
57
  estimatorVersion: z.ZodOptional<z.ZodString>;
58
58
  }, "strip", z.ZodTypeAny, {
59
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
59
60
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
60
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
61
61
  confidence: "estimate" | "provider-estimate" | "actual";
62
62
  componentId: string;
63
63
  tokens: number;
64
+ role?: string | undefined;
64
65
  resourceId?: string | undefined;
65
66
  width?: number | undefined;
66
67
  height?: number | undefined;
67
68
  label?: string | undefined;
68
- action?: string | undefined;
69
- role?: string | undefined;
70
69
  profileId?: string | undefined;
70
+ action?: string | undefined;
71
71
  messageId?: string | undefined;
72
72
  kept?: boolean | undefined;
73
73
  truncatedAtExecution?: boolean | undefined;
@@ -78,18 +78,18 @@ declare const ContextTokenComponent: z.ZodObject<{
78
78
  attachmentIndex?: number | undefined;
79
79
  estimatorVersion?: string | undefined;
80
80
  }, {
81
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
81
82
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
82
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
83
83
  confidence: "estimate" | "provider-estimate" | "actual";
84
84
  componentId: string;
85
85
  tokens: number;
86
+ role?: string | undefined;
86
87
  resourceId?: string | undefined;
87
88
  width?: number | undefined;
88
89
  height?: number | undefined;
89
90
  label?: string | undefined;
90
- action?: string | undefined;
91
- role?: string | undefined;
92
91
  profileId?: string | undefined;
92
+ action?: string | undefined;
93
93
  messageId?: string | undefined;
94
94
  kept?: boolean | undefined;
95
95
  truncatedAtExecution?: boolean | undefined;
@@ -205,9 +205,9 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
205
205
  totalTokens?: number | undefined;
206
206
  rawUsage?: unknown;
207
207
  };
208
+ conversationId?: string | undefined;
208
209
  runId?: string | undefined;
209
210
  parentRunId?: string | undefined;
210
- conversationId?: string | undefined;
211
211
  turnId?: string | undefined;
212
212
  modelId?: string | undefined;
213
213
  route?: {
@@ -239,9 +239,9 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
239
239
  totalTokens?: number | undefined;
240
240
  rawUsage?: unknown;
241
241
  };
242
+ conversationId?: string | undefined;
242
243
  runId?: string | undefined;
243
244
  parentRunId?: string | undefined;
244
- conversationId?: string | undefined;
245
245
  turnId?: string | undefined;
246
246
  modelId?: string | undefined;
247
247
  route?: {
@@ -337,18 +337,18 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
337
337
  profileId: z.ZodOptional<z.ZodString>;
338
338
  estimatorVersion: z.ZodOptional<z.ZodString>;
339
339
  }, "strip", z.ZodTypeAny, {
340
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
340
341
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
341
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
342
342
  confidence: "estimate" | "provider-estimate" | "actual";
343
343
  componentId: string;
344
344
  tokens: number;
345
+ role?: string | undefined;
345
346
  resourceId?: string | undefined;
346
347
  width?: number | undefined;
347
348
  height?: number | undefined;
348
349
  label?: string | undefined;
349
- action?: string | undefined;
350
- role?: string | undefined;
351
350
  profileId?: string | undefined;
351
+ action?: string | undefined;
352
352
  messageId?: string | undefined;
353
353
  kept?: boolean | undefined;
354
354
  truncatedAtExecution?: boolean | undefined;
@@ -359,18 +359,18 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
359
359
  attachmentIndex?: number | undefined;
360
360
  estimatorVersion?: string | undefined;
361
361
  }, {
362
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
362
363
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
363
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
364
364
  confidence: "estimate" | "provider-estimate" | "actual";
365
365
  componentId: string;
366
366
  tokens: number;
367
+ role?: string | undefined;
367
368
  resourceId?: string | undefined;
368
369
  width?: number | undefined;
369
370
  height?: number | undefined;
370
371
  label?: string | undefined;
371
- action?: string | undefined;
372
- role?: string | undefined;
373
372
  profileId?: string | undefined;
373
+ action?: string | undefined;
374
374
  messageId?: string | undefined;
375
375
  kept?: boolean | undefined;
376
376
  truncatedAtExecution?: boolean | undefined;
@@ -386,18 +386,18 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
386
386
  id: string;
387
387
  kind: "context-component";
388
388
  components: {
389
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
389
390
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
390
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
391
391
  confidence: "estimate" | "provider-estimate" | "actual";
392
392
  componentId: string;
393
393
  tokens: number;
394
+ role?: string | undefined;
394
395
  resourceId?: string | undefined;
395
396
  width?: number | undefined;
396
397
  height?: number | undefined;
397
398
  label?: string | undefined;
398
- action?: string | undefined;
399
- role?: string | undefined;
400
399
  profileId?: string | undefined;
400
+ action?: string | undefined;
401
401
  messageId?: string | undefined;
402
402
  kept?: boolean | undefined;
403
403
  truncatedAtExecution?: boolean | undefined;
@@ -409,9 +409,9 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
409
409
  estimatorVersion?: string | undefined;
410
410
  }[];
411
411
  totalTokens: number;
412
+ conversationId?: string | undefined;
412
413
  runId?: string | undefined;
413
414
  parentRunId?: string | undefined;
414
- conversationId?: string | undefined;
415
415
  turnId?: string | undefined;
416
416
  route?: {
417
417
  modelId: string;
@@ -431,18 +431,18 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
431
431
  id: string;
432
432
  kind: "context-component";
433
433
  components: {
434
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
434
435
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
435
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
436
436
  confidence: "estimate" | "provider-estimate" | "actual";
437
437
  componentId: string;
438
438
  tokens: number;
439
+ role?: string | undefined;
439
440
  resourceId?: string | undefined;
440
441
  width?: number | undefined;
441
442
  height?: number | undefined;
442
443
  label?: string | undefined;
443
- action?: string | undefined;
444
- role?: string | undefined;
445
444
  profileId?: string | undefined;
445
+ action?: string | undefined;
446
446
  messageId?: string | undefined;
447
447
  kept?: boolean | undefined;
448
448
  truncatedAtExecution?: boolean | undefined;
@@ -454,9 +454,9 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
454
454
  estimatorVersion?: string | undefined;
455
455
  }[];
456
456
  totalTokens: number;
457
+ conversationId?: string | undefined;
457
458
  runId?: string | undefined;
458
459
  parentRunId?: string | undefined;
459
- conversationId?: string | undefined;
460
460
  turnId?: string | undefined;
461
461
  route?: {
462
462
  modelId: string;
@@ -578,9 +578,9 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
578
578
  totalTokens?: number | undefined;
579
579
  rawUsage?: unknown;
580
580
  };
581
+ conversationId?: string | undefined;
581
582
  runId?: string | undefined;
582
583
  parentRunId?: string | undefined;
583
- conversationId?: string | undefined;
584
584
  turnId?: string | undefined;
585
585
  modelId?: string | undefined;
586
586
  route?: {
@@ -612,9 +612,9 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
612
612
  totalTokens?: number | undefined;
613
613
  rawUsage?: unknown;
614
614
  };
615
+ conversationId?: string | undefined;
615
616
  runId?: string | undefined;
616
617
  parentRunId?: string | undefined;
617
- conversationId?: string | undefined;
618
618
  turnId?: string | undefined;
619
619
  modelId?: string | undefined;
620
620
  route?: {
@@ -708,18 +708,18 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
708
708
  profileId: z.ZodOptional<z.ZodString>;
709
709
  estimatorVersion: z.ZodOptional<z.ZodString>;
710
710
  }, "strip", z.ZodTypeAny, {
711
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
711
712
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
712
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
713
713
  confidence: "estimate" | "provider-estimate" | "actual";
714
714
  componentId: string;
715
715
  tokens: number;
716
+ role?: string | undefined;
716
717
  resourceId?: string | undefined;
717
718
  width?: number | undefined;
718
719
  height?: number | undefined;
719
720
  label?: string | undefined;
720
- action?: string | undefined;
721
- role?: string | undefined;
722
721
  profileId?: string | undefined;
722
+ action?: string | undefined;
723
723
  messageId?: string | undefined;
724
724
  kept?: boolean | undefined;
725
725
  truncatedAtExecution?: boolean | undefined;
@@ -730,18 +730,18 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
730
730
  attachmentIndex?: number | undefined;
731
731
  estimatorVersion?: string | undefined;
732
732
  }, {
733
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
733
734
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
734
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
735
735
  confidence: "estimate" | "provider-estimate" | "actual";
736
736
  componentId: string;
737
737
  tokens: number;
738
+ role?: string | undefined;
738
739
  resourceId?: string | undefined;
739
740
  width?: number | undefined;
740
741
  height?: number | undefined;
741
742
  label?: string | undefined;
742
- action?: string | undefined;
743
- role?: string | undefined;
744
743
  profileId?: string | undefined;
744
+ action?: string | undefined;
745
745
  messageId?: string | undefined;
746
746
  kept?: boolean | undefined;
747
747
  truncatedAtExecution?: boolean | undefined;
@@ -757,18 +757,18 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
757
757
  id: string;
758
758
  kind: "context-component";
759
759
  components: {
760
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
760
761
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
761
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
762
762
  confidence: "estimate" | "provider-estimate" | "actual";
763
763
  componentId: string;
764
764
  tokens: number;
765
+ role?: string | undefined;
765
766
  resourceId?: string | undefined;
766
767
  width?: number | undefined;
767
768
  height?: number | undefined;
768
769
  label?: string | undefined;
769
- action?: string | undefined;
770
- role?: string | undefined;
771
770
  profileId?: string | undefined;
771
+ action?: string | undefined;
772
772
  messageId?: string | undefined;
773
773
  kept?: boolean | undefined;
774
774
  truncatedAtExecution?: boolean | undefined;
@@ -780,9 +780,9 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
780
780
  estimatorVersion?: string | undefined;
781
781
  }[];
782
782
  totalTokens: number;
783
+ conversationId?: string | undefined;
783
784
  runId?: string | undefined;
784
785
  parentRunId?: string | undefined;
785
- conversationId?: string | undefined;
786
786
  turnId?: string | undefined;
787
787
  route?: {
788
788
  modelId: string;
@@ -802,18 +802,18 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
802
802
  id: string;
803
803
  kind: "context-component";
804
804
  components: {
805
+ kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
805
806
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
806
- kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
807
807
  confidence: "estimate" | "provider-estimate" | "actual";
808
808
  componentId: string;
809
809
  tokens: number;
810
+ role?: string | undefined;
810
811
  resourceId?: string | undefined;
811
812
  width?: number | undefined;
812
813
  height?: number | undefined;
813
814
  label?: string | undefined;
814
- action?: string | undefined;
815
- role?: string | undefined;
816
815
  profileId?: string | undefined;
816
+ action?: string | undefined;
817
817
  messageId?: string | undefined;
818
818
  kept?: boolean | undefined;
819
819
  truncatedAtExecution?: boolean | undefined;
@@ -825,9 +825,9 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
825
825
  estimatorVersion?: string | undefined;
826
826
  }[];
827
827
  totalTokens: number;
828
+ conversationId?: string | undefined;
828
829
  runId?: string | undefined;
829
830
  parentRunId?: string | undefined;
830
- conversationId?: string | undefined;
831
831
  turnId?: string | undefined;
832
832
  route?: {
833
833
  modelId: string;