@oneharness/sdk 0.4.3 → 0.4.5

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.
@@ -111,12 +111,21 @@ export type HistoryRecord = {
111
111
  [k: string]: unknown;
112
112
  } | {
113
113
  duration_ms: number | null;
114
+ /**
115
+ * Best-effort normalized tool-call events; `null` when the harness exposes
116
+ * no machine-readable trace.
117
+ */
114
118
  events: {
119
+ duration_ms?: null | undefined;
120
+ finished_at?: null | undefined;
115
121
  index: number;
116
122
  input: unknown;
117
123
  kind: string;
118
124
  name: string | null;
119
125
  output: string | null;
126
+ started_at?: null | undefined;
127
+ status?: null | undefined;
128
+ tool_call_id?: string | null | undefined;
120
129
  [k: string]: unknown;
121
130
  }[] | null;
122
131
  exit_code: number | null;
@@ -125,7 +134,7 @@ export type HistoryRecord = {
125
134
  * unclassified.
126
135
  */
127
136
  failure_kind: FailureKind | null;
128
- finished_at?: string | null | undefined;
137
+ finished_at: null;
129
138
  /**
130
139
  * Canonical harness id (e.g. `claude-code`).
131
140
  */
@@ -140,6 +149,84 @@ export type HistoryRecord = {
140
149
  * The effective top-level model for the run, if any.
141
150
  */
142
151
  model: string | null;
152
+ model_ms?: never | undefined;
153
+ /**
154
+ * The human-meaningful session name (see [`session_name`]); repeated on
155
+ * every record so a reader can resolve a session by name from any line.
156
+ */
157
+ name: string;
158
+ /**
159
+ * The normalized approval mode requested for the run.
160
+ */
161
+ permission_mode: "read-only" | "plan" | "default" | "edit" | "auto" | "bypass";
162
+ /**
163
+ * The project directory the run operated in (the real path, not the
164
+ * on-disk slug), so the list view can show where a session ran.
165
+ */
166
+ project: string;
167
+ /**
168
+ * The prompt this harness run received (its own, on a batch run; else the
169
+ * run's single prompt).
170
+ */
171
+ prompt: string;
172
+ schema_version: "0.3";
173
+ /**
174
+ * The oneharness session id this run belongs to (the history file's stem).
175
+ */
176
+ session: string;
177
+ /**
178
+ * The harness's own continuation id, when it exposed one; `null` otherwise.
179
+ */
180
+ session_id: string | null;
181
+ started_at?: never | undefined;
182
+ status: Status;
183
+ /**
184
+ * Best-effort final assistant text; `null` when extraction was impossible.
185
+ */
186
+ text: string | null;
187
+ /**
188
+ * How `text` was extracted; `null` when absent.
189
+ */
190
+ text_source: string | null;
191
+ time_to_first_token_ms?: never | undefined;
192
+ /**
193
+ * RFC3339 UTC instant the record was written (append time).
194
+ */
195
+ timestamp: string;
196
+ tool_ms?: never | undefined;
197
+ usage: Usage1;
198
+ [k: string]: unknown;
199
+ } | {
200
+ duration_ms: number | null;
201
+ events: {
202
+ index: number;
203
+ input: unknown;
204
+ kind: string;
205
+ name: string | null;
206
+ output: string | null;
207
+ [k: string]: unknown;
208
+ }[] | null;
209
+ exit_code: number | null;
210
+ /**
211
+ * Best-effort classified failure reason (see [`FailureKind`]); `null` when
212
+ * unclassified.
213
+ */
214
+ failure_kind: FailureKind | null;
215
+ finished_at?: string | null | undefined;
216
+ /**
217
+ * Canonical harness id (e.g. `claude-code`).
218
+ */
219
+ harness: string;
220
+ /**
221
+ * Globally unique, time-ordered record id. This is also the cursor accepted
222
+ * by `history watch --after` and the exact id accepted by history lookup.
223
+ */
224
+ history_id: string;
225
+ labels?: HistoryLabels2 | undefined;
226
+ /**
227
+ * The effective top-level model for the run, if any.
228
+ */
229
+ model: string | null;
143
230
  model_ms?: number | null | undefined;
144
231
  /**
145
232
  * The human-meaningful session name (see [`session_name`]); repeated on
@@ -191,7 +278,7 @@ export type HistoryRecord = {
191
278
  */
192
279
  timestamp: string;
193
280
  tool_ms?: number | null | undefined;
194
- usage: Usage1;
281
+ usage: Usage2;
195
282
  [k: string]: unknown;
196
283
  };
197
284
  export type ToolCallStatus = "completed" | "failed" | "timeout" | "interrupted";
@@ -338,3 +425,40 @@ export interface Usage1 {
338
425
  output_tokens: number | null;
339
426
  [k: string]: unknown;
340
427
  }
428
+ /**
429
+ * Caller-supplied metadata used to select related task-graph records.
430
+ * Omitted on the wire when empty for additive compatibility.
431
+ */
432
+ export interface HistoryLabels2 {
433
+ [k: string]: string;
434
+ }
435
+ /**
436
+ * Best-effort token/cost accounting (every field `null` when unreported).
437
+ */
438
+ export interface Usage2 {
439
+ /**
440
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
441
+ * previously-written prefix), when the harness reports them. `None` when the
442
+ * harness does not surface cache counts — never `0` as a guess.
443
+ */
444
+ cache_read_tokens: number | null;
445
+ /**
446
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
447
+ * creation), when the harness reports them. `None` when not surfaced.
448
+ */
449
+ cache_write_tokens: number | null;
450
+ /**
451
+ * Total cost in USD, when the harness reports it (often absent on
452
+ * subscription auth, where there is no per-call dollar figure).
453
+ */
454
+ cost_usd: number | null;
455
+ /**
456
+ * Prompt/input tokens billed, when the harness reports them.
457
+ */
458
+ input_tokens: number | null;
459
+ /**
460
+ * Completion/output tokens billed, when the harness reports them.
461
+ */
462
+ output_tokens: number | null;
463
+ [k: string]: unknown;
464
+ }
@@ -121,12 +121,21 @@ export type HistoryRecord = {
121
121
  [k: string]: unknown;
122
122
  } | {
123
123
  duration_ms: number | null;
124
+ /**
125
+ * Best-effort normalized tool-call events; `null` when the harness exposes
126
+ * no machine-readable trace.
127
+ */
124
128
  events: {
129
+ duration_ms?: null | undefined;
130
+ finished_at?: null | undefined;
125
131
  index: number;
126
132
  input: unknown;
127
133
  kind: string;
128
134
  name: string | null;
129
135
  output: string | null;
136
+ started_at?: null | undefined;
137
+ status?: null | undefined;
138
+ tool_call_id?: string | null | undefined;
130
139
  [k: string]: unknown;
131
140
  }[] | null;
132
141
  exit_code: number | null;
@@ -135,7 +144,7 @@ export type HistoryRecord = {
135
144
  * unclassified.
136
145
  */
137
146
  failure_kind: FailureKind | null;
138
- finished_at?: string | null | undefined;
147
+ finished_at: null;
139
148
  /**
140
149
  * Canonical harness id (e.g. `claude-code`).
141
150
  */
@@ -150,6 +159,84 @@ export type HistoryRecord = {
150
159
  * The effective top-level model for the run, if any.
151
160
  */
152
161
  model: string | null;
162
+ model_ms?: never | undefined;
163
+ /**
164
+ * The human-meaningful session name (see [`session_name`]); repeated on
165
+ * every record so a reader can resolve a session by name from any line.
166
+ */
167
+ name: string;
168
+ /**
169
+ * The normalized approval mode requested for the run.
170
+ */
171
+ permission_mode: "read-only" | "plan" | "default" | "edit" | "auto" | "bypass";
172
+ /**
173
+ * The project directory the run operated in (the real path, not the
174
+ * on-disk slug), so the list view can show where a session ran.
175
+ */
176
+ project: string;
177
+ /**
178
+ * The prompt this harness run received (its own, on a batch run; else the
179
+ * run's single prompt).
180
+ */
181
+ prompt: string;
182
+ schema_version: "0.3";
183
+ /**
184
+ * The oneharness session id this run belongs to (the history file's stem).
185
+ */
186
+ session: string;
187
+ /**
188
+ * The harness's own continuation id, when it exposed one; `null` otherwise.
189
+ */
190
+ session_id: string | null;
191
+ started_at?: never | undefined;
192
+ status: Status;
193
+ /**
194
+ * Best-effort final assistant text; `null` when extraction was impossible.
195
+ */
196
+ text: string | null;
197
+ /**
198
+ * How `text` was extracted; `null` when absent.
199
+ */
200
+ text_source: string | null;
201
+ time_to_first_token_ms?: never | undefined;
202
+ /**
203
+ * RFC3339 UTC instant the record was written (append time).
204
+ */
205
+ timestamp: string;
206
+ tool_ms?: never | undefined;
207
+ usage: Usage1;
208
+ [k: string]: unknown;
209
+ } | {
210
+ duration_ms: number | null;
211
+ events: {
212
+ index: number;
213
+ input: unknown;
214
+ kind: string;
215
+ name: string | null;
216
+ output: string | null;
217
+ [k: string]: unknown;
218
+ }[] | null;
219
+ exit_code: number | null;
220
+ /**
221
+ * Best-effort classified failure reason (see [`FailureKind`]); `null` when
222
+ * unclassified.
223
+ */
224
+ failure_kind: FailureKind | null;
225
+ finished_at?: string | null | undefined;
226
+ /**
227
+ * Canonical harness id (e.g. `claude-code`).
228
+ */
229
+ harness: string;
230
+ /**
231
+ * Globally unique, time-ordered record id. This is also the cursor accepted
232
+ * by `history watch --after` and the exact id accepted by history lookup.
233
+ */
234
+ history_id: string;
235
+ labels?: HistoryLabels2 | undefined;
236
+ /**
237
+ * The effective top-level model for the run, if any.
238
+ */
239
+ model: string | null;
153
240
  model_ms?: number | null | undefined;
154
241
  /**
155
242
  * The human-meaningful session name (see [`session_name`]); repeated on
@@ -201,7 +288,7 @@ export type HistoryRecord = {
201
288
  */
202
289
  timestamp: string;
203
290
  tool_ms?: number | null | undefined;
204
- usage: Usage1;
291
+ usage: Usage2;
205
292
  [k: string]: unknown;
206
293
  };
207
294
  export type ToolCallStatus = "completed" | "failed" | "timeout" | "interrupted";
@@ -347,3 +434,40 @@ export interface Usage1 {
347
434
  output_tokens: number | null;
348
435
  [k: string]: unknown;
349
436
  }
437
+ /**
438
+ * Caller-supplied metadata used to select related task-graph records.
439
+ * Omitted on the wire when empty for additive compatibility.
440
+ */
441
+ export interface HistoryLabels2 {
442
+ [k: string]: string;
443
+ }
444
+ /**
445
+ * Best-effort token/cost accounting (every field `null` when unreported).
446
+ */
447
+ export interface Usage2 {
448
+ /**
449
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
450
+ * previously-written prefix), when the harness reports them. `None` when the
451
+ * harness does not surface cache counts — never `0` as a guess.
452
+ */
453
+ cache_read_tokens: number | null;
454
+ /**
455
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
456
+ * creation), when the harness reports them. `None` when not surfaced.
457
+ */
458
+ cache_write_tokens: number | null;
459
+ /**
460
+ * Total cost in USD, when the harness reports it (often absent on
461
+ * subscription auth, where there is no per-call dollar figure).
462
+ */
463
+ cost_usd: number | null;
464
+ /**
465
+ * Prompt/input tokens billed, when the harness reports them.
466
+ */
467
+ input_tokens: number | null;
468
+ /**
469
+ * Completion/output tokens billed, when the harness reports them.
470
+ */
471
+ output_tokens: number | null;
472
+ [k: string]: unknown;
473
+ }
@@ -111,12 +111,21 @@ export type HistoryRecord = {
111
111
  [k: string]: unknown;
112
112
  } | {
113
113
  duration_ms: number | null;
114
+ /**
115
+ * Best-effort normalized tool-call events; `null` when the harness exposes
116
+ * no machine-readable trace.
117
+ */
114
118
  events: {
119
+ duration_ms?: null | undefined;
120
+ finished_at?: null | undefined;
115
121
  index: number;
116
122
  input: unknown;
117
123
  kind: string;
118
124
  name: string | null;
119
125
  output: string | null;
126
+ started_at?: null | undefined;
127
+ status?: null | undefined;
128
+ tool_call_id?: string | null | undefined;
120
129
  [k: string]: unknown;
121
130
  }[] | null;
122
131
  exit_code: number | null;
@@ -125,7 +134,7 @@ export type HistoryRecord = {
125
134
  * unclassified.
126
135
  */
127
136
  failure_kind: FailureKind | null;
128
- finished_at?: string | null | undefined;
137
+ finished_at: null;
129
138
  /**
130
139
  * Canonical harness id (e.g. `claude-code`).
131
140
  */
@@ -140,6 +149,84 @@ export type HistoryRecord = {
140
149
  * The effective top-level model for the run, if any.
141
150
  */
142
151
  model: string | null;
152
+ model_ms?: never | undefined;
153
+ /**
154
+ * The human-meaningful session name (see [`session_name`]); repeated on
155
+ * every record so a reader can resolve a session by name from any line.
156
+ */
157
+ name: string;
158
+ /**
159
+ * The normalized approval mode requested for the run.
160
+ */
161
+ permission_mode: "read-only" | "plan" | "default" | "edit" | "auto" | "bypass";
162
+ /**
163
+ * The project directory the run operated in (the real path, not the
164
+ * on-disk slug), so the list view can show where a session ran.
165
+ */
166
+ project: string;
167
+ /**
168
+ * The prompt this harness run received (its own, on a batch run; else the
169
+ * run's single prompt).
170
+ */
171
+ prompt: string;
172
+ schema_version: "0.3";
173
+ /**
174
+ * The oneharness session id this run belongs to (the history file's stem).
175
+ */
176
+ session: string;
177
+ /**
178
+ * The harness's own continuation id, when it exposed one; `null` otherwise.
179
+ */
180
+ session_id: string | null;
181
+ started_at?: never | undefined;
182
+ status: Status;
183
+ /**
184
+ * Best-effort final assistant text; `null` when extraction was impossible.
185
+ */
186
+ text: string | null;
187
+ /**
188
+ * How `text` was extracted; `null` when absent.
189
+ */
190
+ text_source: string | null;
191
+ time_to_first_token_ms?: never | undefined;
192
+ /**
193
+ * RFC3339 UTC instant the record was written (append time).
194
+ */
195
+ timestamp: string;
196
+ tool_ms?: never | undefined;
197
+ usage: Usage1;
198
+ [k: string]: unknown;
199
+ } | {
200
+ duration_ms: number | null;
201
+ events: {
202
+ index: number;
203
+ input: unknown;
204
+ kind: string;
205
+ name: string | null;
206
+ output: string | null;
207
+ [k: string]: unknown;
208
+ }[] | null;
209
+ exit_code: number | null;
210
+ /**
211
+ * Best-effort classified failure reason (see [`FailureKind`]); `null` when
212
+ * unclassified.
213
+ */
214
+ failure_kind: FailureKind | null;
215
+ finished_at?: string | null | undefined;
216
+ /**
217
+ * Canonical harness id (e.g. `claude-code`).
218
+ */
219
+ harness: string;
220
+ /**
221
+ * Globally unique, time-ordered record id. This is also the cursor accepted
222
+ * by `history watch --after` and the exact id accepted by history lookup.
223
+ */
224
+ history_id: string;
225
+ labels?: HistoryLabels2 | undefined;
226
+ /**
227
+ * The effective top-level model for the run, if any.
228
+ */
229
+ model: string | null;
143
230
  model_ms?: number | null | undefined;
144
231
  /**
145
232
  * The human-meaningful session name (see [`session_name`]); repeated on
@@ -191,7 +278,7 @@ export type HistoryRecord = {
191
278
  */
192
279
  timestamp: string;
193
280
  tool_ms?: number | null | undefined;
194
- usage: Usage1;
281
+ usage: Usage2;
195
282
  [k: string]: unknown;
196
283
  };
197
284
  export type ToolCallStatus = "completed" | "failed" | "timeout" | "interrupted";
@@ -337,3 +424,40 @@ export interface Usage1 {
337
424
  output_tokens: number | null;
338
425
  [k: string]: unknown;
339
426
  }
427
+ /**
428
+ * Caller-supplied metadata used to select related task-graph records.
429
+ * Omitted on the wire when empty for additive compatibility.
430
+ */
431
+ export interface HistoryLabels2 {
432
+ [k: string]: string;
433
+ }
434
+ /**
435
+ * Best-effort token/cost accounting (every field `null` when unreported).
436
+ */
437
+ export interface Usage2 {
438
+ /**
439
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
440
+ * previously-written prefix), when the harness reports them. `None` when the
441
+ * harness does not surface cache counts — never `0` as a guess.
442
+ */
443
+ cache_read_tokens: number | null;
444
+ /**
445
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
446
+ * creation), when the harness reports them. `None` when not surfaced.
447
+ */
448
+ cache_write_tokens: number | null;
449
+ /**
450
+ * Total cost in USD, when the harness reports it (often absent on
451
+ * subscription auth, where there is no per-call dollar figure).
452
+ */
453
+ cost_usd: number | null;
454
+ /**
455
+ * Prompt/input tokens billed, when the harness reports them.
456
+ */
457
+ input_tokens: number | null;
458
+ /**
459
+ * Completion/output tokens billed, when the harness reports them.
460
+ */
461
+ output_tokens: number | null;
462
+ [k: string]: unknown;
463
+ }