@linnlabs/linnkit 0.37.4 → 0.38.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 (68) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/cli.cjs +347 -179
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +347 -179
  5. package/dist/cli.js.map +1 -1
  6. package/dist/context-manager.cjs +55 -11
  7. package/dist/context-manager.cjs.map +1 -1
  8. package/dist/context-manager.js +55 -11
  9. package/dist/context-manager.js.map +1 -1
  10. package/dist/contracts/audit.d.cts +6 -6
  11. package/dist/contracts/audit.d.ts +6 -6
  12. package/dist/contracts/events.d.cts +532 -50
  13. package/dist/contracts/events.d.ts +532 -50
  14. package/dist/contracts/llm-retry.d.cts +47 -0
  15. package/dist/contracts/llm-retry.d.ts +47 -0
  16. package/dist/contracts/messages.d.cts +2 -2
  17. package/dist/contracts/messages.d.ts +2 -2
  18. package/dist/contracts/runtime-error.d.cts +26 -0
  19. package/dist/contracts/runtime-error.d.ts +26 -0
  20. package/dist/contracts/sse.d.cts +571 -55
  21. package/dist/contracts/sse.d.ts +571 -55
  22. package/dist/contracts/sub-run-trace-payload.d.cts +102 -6
  23. package/dist/contracts/sub-run-trace-payload.d.ts +102 -6
  24. package/dist/contracts/token-accounting.d.cts +18 -18
  25. package/dist/contracts/token-accounting.d.ts +18 -18
  26. package/dist/contracts.cjs +65 -10
  27. package/dist/contracts.cjs.map +1 -1
  28. package/dist/contracts.d.cts +4 -2
  29. package/dist/contracts.d.ts +4 -2
  30. package/dist/contracts.js +62 -11
  31. package/dist/contracts.js.map +1 -1
  32. package/dist/index.cjs +506 -286
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.js +506 -286
  35. package/dist/index.js.map +1 -1
  36. package/dist/ports/canonical-inference.d.cts +3 -0
  37. package/dist/ports/canonical-inference.d.ts +3 -0
  38. package/dist/ports/llm-call.d.cts +4 -0
  39. package/dist/ports/llm-call.d.ts +4 -0
  40. package/dist/quickstart.cjs +347 -179
  41. package/dist/quickstart.cjs.map +1 -1
  42. package/dist/quickstart.js +347 -179
  43. package/dist/quickstart.js.map +1 -1
  44. package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.cts +8 -0
  45. package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.ts +8 -0
  46. package/dist/runtime-kernel/events/agentEvents.d.cts +85 -4
  47. package/dist/runtime-kernel/events/agentEvents.d.ts +85 -4
  48. package/dist/runtime-kernel/events/eventGovernance.d.cts +1 -1
  49. package/dist/runtime-kernel/events/eventGovernance.d.ts +1 -1
  50. package/dist/runtime-kernel/events.cjs +55 -11
  51. package/dist/runtime-kernel/events.cjs.map +1 -1
  52. package/dist/runtime-kernel/events.js +55 -11
  53. package/dist/runtime-kernel/events.js.map +1 -1
  54. package/dist/runtime-kernel/llm/request-builder.d.cts +2 -0
  55. package/dist/runtime-kernel/llm/request-builder.d.ts +2 -0
  56. package/dist/runtime-kernel.cjs +468 -271
  57. package/dist/runtime-kernel.cjs.map +1 -1
  58. package/dist/runtime-kernel.js +468 -271
  59. package/dist/runtime-kernel.js.map +1 -1
  60. package/dist/shared/errorClassifier.d.cts +5 -0
  61. package/dist/shared/errorClassifier.d.ts +5 -0
  62. package/dist/testkit.cjs +466 -269
  63. package/dist/testkit.cjs.map +1 -1
  64. package/dist/testkit.js +466 -269
  65. package/dist/testkit.js.map +1 -1
  66. package/docs/integration/llm-provider.md +24 -0
  67. package/docs/integration/realtime.md +29 -0
  68. package/package.json +2 -2
@@ -7,7 +7,7 @@ import { SerializableJsonValue } from './json.cjs';
7
7
  * Host 查询、持久化读取、SSE 与插件公开类型都必须从这里派生;禁止在消费层
8
8
  * 重列 enum 或用 switch 维护另一份“可读取 kind”清单。
9
9
  */
10
- declare const SubRunTraceKind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary"]>;
10
+ declare const SubRunTraceKind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary", "llm_retry", "error"]>;
11
11
  type SubRunTraceKind = z.infer<typeof SubRunTraceKind>;
12
12
  declare const SubRunTraceToolCallDecision: z.ZodObject<{
13
13
  tool_call_id: z.ZodBranded<z.ZodEffects<z.ZodString, string, string>, "ToolCallId">;
@@ -28,7 +28,63 @@ declare const SubRunTracePayload: z.ZodObject<{
28
28
  subrun_id: z.ZodEffects<z.ZodString, string, string>;
29
29
  subrun_parent_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
30
30
  source_event_id: z.ZodEffects<z.ZodString, string, string>;
31
- kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary"]>;
31
+ kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary", "llm_retry", "error"]>;
32
+ retry: z.ZodOptional<z.ZodObject<{
33
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
34
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
35
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
36
+ attempt: z.ZodNumber;
37
+ max_retries: z.ZodNumber;
38
+ total_attempts: z.ZodNumber;
39
+ started_at: z.ZodNumber;
40
+ delay_ms: z.ZodNumber;
41
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
42
+ error: z.ZodString;
43
+ error_code: z.ZodString;
44
+ }, "strict", z.ZodTypeAny, {
45
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
46
+ error: string;
47
+ error_code: string;
48
+ retry_id: string;
49
+ category: "transport" | "output" | "rate_limit" | "other";
50
+ attempt: number;
51
+ max_retries: number;
52
+ total_attempts: number;
53
+ started_at: number;
54
+ delay_ms: number;
55
+ next_retry_at?: number | undefined;
56
+ }, {
57
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
58
+ error: string;
59
+ error_code: string;
60
+ retry_id: string;
61
+ category: "transport" | "output" | "rate_limit" | "other";
62
+ attempt: number;
63
+ max_retries: number;
64
+ total_attempts: number;
65
+ started_at: number;
66
+ delay_ms: number;
67
+ next_retry_at?: number | undefined;
68
+ }>>;
69
+ failure: z.ZodOptional<z.ZodObject<{
70
+ error: z.ZodString;
71
+ error_code: z.ZodOptional<z.ZodString>;
72
+ retryable: z.ZodOptional<z.ZodBoolean>;
73
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
74
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
75
+ }, "strict", z.ZodTypeAny, {
76
+ error: string;
77
+ error_code?: string | undefined;
78
+ retry_id?: string | undefined;
79
+ retryable?: boolean | undefined;
80
+ details?: SerializableJsonValue | undefined;
81
+ }, {
82
+ error: string;
83
+ error_code?: string | undefined;
84
+ retry_id?: string | undefined;
85
+ retryable?: boolean | undefined;
86
+ details?: SerializableJsonValue | undefined;
87
+ }>>;
32
88
  delta: z.ZodOptional<z.ZodString>;
33
89
  content: z.ZodOptional<z.ZodString>;
34
90
  answer_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -95,7 +151,7 @@ declare const SubRunTracePayload: z.ZodObject<{
95
151
  replaced_message_ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
96
152
  meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
97
153
  }, "strip", z.ZodTypeAny, {
98
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
154
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
99
155
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
100
156
  subrun_id: string;
101
157
  source_event_id: string;
@@ -126,17 +182,37 @@ declare const SubRunTracePayload: z.ZodObject<{
126
182
  meta?: Record<string, SerializableJsonValue> | undefined;
127
183
  duration_ms?: number | undefined;
128
184
  subrun_parent_id?: string | undefined;
185
+ output?: SerializableJsonValue | undefined;
186
+ retry?: {
187
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
188
+ error: string;
189
+ error_code: string;
190
+ retry_id: string;
191
+ category: "transport" | "output" | "rate_limit" | "other";
192
+ attempt: number;
193
+ max_retries: number;
194
+ total_attempts: number;
195
+ started_at: number;
196
+ delay_ms: number;
197
+ next_retry_at?: number | undefined;
198
+ } | undefined;
199
+ failure?: {
200
+ error: string;
201
+ error_code?: string | undefined;
202
+ retry_id?: string | undefined;
203
+ retryable?: boolean | undefined;
204
+ details?: SerializableJsonValue | undefined;
205
+ } | undefined;
129
206
  answer_id?: string | undefined;
130
207
  seq?: number | undefined;
131
208
  is_last?: boolean | undefined;
132
209
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
133
- output?: SerializableJsonValue | undefined;
134
210
  original_message_count?: number | undefined;
135
211
  compression_ratio?: number | undefined;
136
212
  included_old_summary?: boolean | undefined;
137
213
  replaced_message_ids?: string[] | undefined;
138
214
  }, {
139
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
215
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
140
216
  parent_tool_call_id: string;
141
217
  subrun_id: string;
142
218
  source_event_id: string;
@@ -167,11 +243,31 @@ declare const SubRunTracePayload: z.ZodObject<{
167
243
  meta?: Record<string, SerializableJsonValue> | undefined;
168
244
  duration_ms?: number | undefined;
169
245
  subrun_parent_id?: string | undefined;
246
+ output?: SerializableJsonValue | undefined;
247
+ retry?: {
248
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
249
+ error: string;
250
+ error_code: string;
251
+ retry_id: string;
252
+ category: "transport" | "output" | "rate_limit" | "other";
253
+ attempt: number;
254
+ max_retries: number;
255
+ total_attempts: number;
256
+ started_at: number;
257
+ delay_ms: number;
258
+ next_retry_at?: number | undefined;
259
+ } | undefined;
260
+ failure?: {
261
+ error: string;
262
+ error_code?: string | undefined;
263
+ retry_id?: string | undefined;
264
+ retryable?: boolean | undefined;
265
+ details?: SerializableJsonValue | undefined;
266
+ } | undefined;
170
267
  answer_id?: string | undefined;
171
268
  seq?: number | undefined;
172
269
  is_last?: boolean | undefined;
173
270
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
174
- output?: SerializableJsonValue | undefined;
175
271
  original_message_count?: number | undefined;
176
272
  compression_ratio?: number | undefined;
177
273
  included_old_summary?: boolean | undefined;
@@ -7,7 +7,7 @@ import { SerializableJsonValue } from './json.js';
7
7
  * Host 查询、持久化读取、SSE 与插件公开类型都必须从这里派生;禁止在消费层
8
8
  * 重列 enum 或用 switch 维护另一份“可读取 kind”清单。
9
9
  */
10
- declare const SubRunTraceKind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary"]>;
10
+ declare const SubRunTraceKind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary", "llm_retry", "error"]>;
11
11
  type SubRunTraceKind = z.infer<typeof SubRunTraceKind>;
12
12
  declare const SubRunTraceToolCallDecision: z.ZodObject<{
13
13
  tool_call_id: z.ZodBranded<z.ZodEffects<z.ZodString, string, string>, "ToolCallId">;
@@ -28,7 +28,63 @@ declare const SubRunTracePayload: z.ZodObject<{
28
28
  subrun_id: z.ZodEffects<z.ZodString, string, string>;
29
29
  subrun_parent_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
30
30
  source_event_id: z.ZodEffects<z.ZodString, string, string>;
31
- kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary"]>;
31
+ kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary", "llm_retry", "error"]>;
32
+ retry: z.ZodOptional<z.ZodObject<{
33
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
34
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
35
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
36
+ attempt: z.ZodNumber;
37
+ max_retries: z.ZodNumber;
38
+ total_attempts: z.ZodNumber;
39
+ started_at: z.ZodNumber;
40
+ delay_ms: z.ZodNumber;
41
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
42
+ error: z.ZodString;
43
+ error_code: z.ZodString;
44
+ }, "strict", z.ZodTypeAny, {
45
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
46
+ error: string;
47
+ error_code: string;
48
+ retry_id: string;
49
+ category: "transport" | "output" | "rate_limit" | "other";
50
+ attempt: number;
51
+ max_retries: number;
52
+ total_attempts: number;
53
+ started_at: number;
54
+ delay_ms: number;
55
+ next_retry_at?: number | undefined;
56
+ }, {
57
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
58
+ error: string;
59
+ error_code: string;
60
+ retry_id: string;
61
+ category: "transport" | "output" | "rate_limit" | "other";
62
+ attempt: number;
63
+ max_retries: number;
64
+ total_attempts: number;
65
+ started_at: number;
66
+ delay_ms: number;
67
+ next_retry_at?: number | undefined;
68
+ }>>;
69
+ failure: z.ZodOptional<z.ZodObject<{
70
+ error: z.ZodString;
71
+ error_code: z.ZodOptional<z.ZodString>;
72
+ retryable: z.ZodOptional<z.ZodBoolean>;
73
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
74
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
75
+ }, "strict", z.ZodTypeAny, {
76
+ error: string;
77
+ error_code?: string | undefined;
78
+ retry_id?: string | undefined;
79
+ retryable?: boolean | undefined;
80
+ details?: SerializableJsonValue | undefined;
81
+ }, {
82
+ error: string;
83
+ error_code?: string | undefined;
84
+ retry_id?: string | undefined;
85
+ retryable?: boolean | undefined;
86
+ details?: SerializableJsonValue | undefined;
87
+ }>>;
32
88
  delta: z.ZodOptional<z.ZodString>;
33
89
  content: z.ZodOptional<z.ZodString>;
34
90
  answer_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -95,7 +151,7 @@ declare const SubRunTracePayload: z.ZodObject<{
95
151
  replaced_message_ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
96
152
  meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
97
153
  }, "strip", z.ZodTypeAny, {
98
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
154
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
99
155
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
100
156
  subrun_id: string;
101
157
  source_event_id: string;
@@ -126,17 +182,37 @@ declare const SubRunTracePayload: z.ZodObject<{
126
182
  meta?: Record<string, SerializableJsonValue> | undefined;
127
183
  duration_ms?: number | undefined;
128
184
  subrun_parent_id?: string | undefined;
185
+ output?: SerializableJsonValue | undefined;
186
+ retry?: {
187
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
188
+ error: string;
189
+ error_code: string;
190
+ retry_id: string;
191
+ category: "transport" | "output" | "rate_limit" | "other";
192
+ attempt: number;
193
+ max_retries: number;
194
+ total_attempts: number;
195
+ started_at: number;
196
+ delay_ms: number;
197
+ next_retry_at?: number | undefined;
198
+ } | undefined;
199
+ failure?: {
200
+ error: string;
201
+ error_code?: string | undefined;
202
+ retry_id?: string | undefined;
203
+ retryable?: boolean | undefined;
204
+ details?: SerializableJsonValue | undefined;
205
+ } | undefined;
129
206
  answer_id?: string | undefined;
130
207
  seq?: number | undefined;
131
208
  is_last?: boolean | undefined;
132
209
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
133
- output?: SerializableJsonValue | undefined;
134
210
  original_message_count?: number | undefined;
135
211
  compression_ratio?: number | undefined;
136
212
  included_old_summary?: boolean | undefined;
137
213
  replaced_message_ids?: string[] | undefined;
138
214
  }, {
139
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
215
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
140
216
  parent_tool_call_id: string;
141
217
  subrun_id: string;
142
218
  source_event_id: string;
@@ -167,11 +243,31 @@ declare const SubRunTracePayload: z.ZodObject<{
167
243
  meta?: Record<string, SerializableJsonValue> | undefined;
168
244
  duration_ms?: number | undefined;
169
245
  subrun_parent_id?: string | undefined;
246
+ output?: SerializableJsonValue | undefined;
247
+ retry?: {
248
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
249
+ error: string;
250
+ error_code: string;
251
+ retry_id: string;
252
+ category: "transport" | "output" | "rate_limit" | "other";
253
+ attempt: number;
254
+ max_retries: number;
255
+ total_attempts: number;
256
+ started_at: number;
257
+ delay_ms: number;
258
+ next_retry_at?: number | undefined;
259
+ } | undefined;
260
+ failure?: {
261
+ error: string;
262
+ error_code?: string | undefined;
263
+ retry_id?: string | undefined;
264
+ retryable?: boolean | undefined;
265
+ details?: SerializableJsonValue | undefined;
266
+ } | undefined;
170
267
  answer_id?: string | undefined;
171
268
  seq?: number | undefined;
172
269
  is_last?: boolean | undefined;
173
270
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
174
- output?: SerializableJsonValue | undefined;
175
271
  original_message_count?: number | undefined;
176
272
  compression_ratio?: number | undefined;
177
273
  included_old_summary?: boolean | undefined;
@@ -57,7 +57,7 @@ declare const ContextTokenComponent: z.ZodObject<{
57
57
  estimatorVersion: z.ZodOptional<z.ZodString>;
58
58
  }, "strip", z.ZodTypeAny, {
59
59
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
60
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -79,7 +79,7 @@ declare const ContextTokenComponent: z.ZodObject<{
79
79
  estimatorVersion?: string | undefined;
80
80
  }, {
81
81
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
82
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -210,7 +210,6 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
210
210
  conversationId?: string | undefined;
211
211
  turnId?: string | undefined;
212
212
  modelId?: string | undefined;
213
- stepId?: string | undefined;
214
213
  route?: {
215
214
  modelId: string;
216
215
  capabilityId: string;
@@ -223,6 +222,7 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
223
222
  baseURL?: string | undefined;
224
223
  endpointModelId?: string | undefined;
225
224
  } | undefined;
225
+ stepId?: string | undefined;
226
226
  createdAt?: number | undefined;
227
227
  }, {
228
228
  id: string;
@@ -244,7 +244,6 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
244
244
  conversationId?: string | undefined;
245
245
  turnId?: string | undefined;
246
246
  modelId?: string | undefined;
247
- stepId?: string | undefined;
248
247
  route?: {
249
248
  modelId: string;
250
249
  capabilityId: string;
@@ -257,6 +256,7 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
257
256
  baseURL?: string | undefined;
258
257
  endpointModelId?: string | undefined;
259
258
  } | undefined;
259
+ stepId?: string | undefined;
260
260
  createdAt?: number | undefined;
261
261
  }>;
262
262
  type LlmUsageTokenLedgerEntry = z.infer<typeof LlmUsageTokenLedgerEntry>;
@@ -338,7 +338,7 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
338
338
  estimatorVersion: z.ZodOptional<z.ZodString>;
339
339
  }, "strip", z.ZodTypeAny, {
340
340
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
341
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -360,7 +360,7 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
360
360
  estimatorVersion?: string | undefined;
361
361
  }, {
362
362
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
363
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -387,7 +387,7 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
387
387
  kind: "context-component";
388
388
  components: {
389
389
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
390
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -413,7 +413,6 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
413
413
  parentRunId?: string | undefined;
414
414
  conversationId?: string | undefined;
415
415
  turnId?: string | undefined;
416
- stepId?: string | undefined;
417
416
  route?: {
418
417
  modelId: string;
419
418
  capabilityId: string;
@@ -426,13 +425,14 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
426
425
  baseURL?: string | undefined;
427
426
  endpointModelId?: string | undefined;
428
427
  } | undefined;
428
+ stepId?: string | undefined;
429
429
  createdAt?: number | undefined;
430
430
  }, {
431
431
  id: string;
432
432
  kind: "context-component";
433
433
  components: {
434
434
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
435
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -458,7 +458,6 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
458
458
  parentRunId?: string | undefined;
459
459
  conversationId?: string | undefined;
460
460
  turnId?: string | undefined;
461
- stepId?: string | undefined;
462
461
  route?: {
463
462
  modelId: string;
464
463
  capabilityId: string;
@@ -471,6 +470,7 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
471
470
  baseURL?: string | undefined;
472
471
  endpointModelId?: string | undefined;
473
472
  } | undefined;
473
+ stepId?: string | undefined;
474
474
  createdAt?: number | undefined;
475
475
  }>;
476
476
  type ContextComponentTokenLedgerEntry = z.infer<typeof ContextComponentTokenLedgerEntry>;
@@ -583,7 +583,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
583
583
  conversationId?: string | undefined;
584
584
  turnId?: string | undefined;
585
585
  modelId?: string | undefined;
586
- stepId?: string | undefined;
587
586
  route?: {
588
587
  modelId: string;
589
588
  capabilityId: string;
@@ -596,6 +595,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
596
595
  baseURL?: string | undefined;
597
596
  endpointModelId?: string | undefined;
598
597
  } | undefined;
598
+ stepId?: string | undefined;
599
599
  createdAt?: number | undefined;
600
600
  }, {
601
601
  id: string;
@@ -617,7 +617,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
617
617
  conversationId?: string | undefined;
618
618
  turnId?: string | undefined;
619
619
  modelId?: string | undefined;
620
- stepId?: string | undefined;
621
620
  route?: {
622
621
  modelId: string;
623
622
  capabilityId: string;
@@ -630,6 +629,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
630
629
  baseURL?: string | undefined;
631
630
  endpointModelId?: string | undefined;
632
631
  } | undefined;
632
+ stepId?: string | undefined;
633
633
  createdAt?: number | undefined;
634
634
  }>, z.ZodObject<{
635
635
  id: z.ZodString;
@@ -709,7 +709,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
709
709
  estimatorVersion: z.ZodOptional<z.ZodString>;
710
710
  }, "strip", z.ZodTypeAny, {
711
711
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
712
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -731,7 +731,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
731
731
  estimatorVersion?: string | undefined;
732
732
  }, {
733
733
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
734
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -758,7 +758,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
758
758
  kind: "context-component";
759
759
  components: {
760
760
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
761
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -784,7 +784,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
784
784
  parentRunId?: string | undefined;
785
785
  conversationId?: string | undefined;
786
786
  turnId?: string | undefined;
787
- stepId?: string | undefined;
788
787
  route?: {
789
788
  modelId: string;
790
789
  capabilityId: string;
@@ -797,13 +796,14 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
797
796
  baseURL?: string | undefined;
798
797
  endpointModelId?: string | undefined;
799
798
  } | undefined;
799
+ stepId?: string | undefined;
800
800
  createdAt?: number | undefined;
801
801
  }, {
802
802
  id: string;
803
803
  kind: "context-component";
804
804
  components: {
805
805
  source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
806
- kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
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;
@@ -829,7 +829,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
829
829
  parentRunId?: string | undefined;
830
830
  conversationId?: string | undefined;
831
831
  turnId?: string | undefined;
832
- stepId?: string | undefined;
833
832
  route?: {
834
833
  modelId: string;
835
834
  capabilityId: string;
@@ -842,6 +841,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
842
841
  baseURL?: string | undefined;
843
842
  endpointModelId?: string | undefined;
844
843
  } | undefined;
844
+ stepId?: string | undefined;
845
845
  createdAt?: number | undefined;
846
846
  }>]>;
847
847
  type TokenLedgerEntry = z.infer<typeof TokenLedgerEntry>;