@oneharness/sdk 0.18.0 → 0.19.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.
@@ -958,6 +958,11 @@ export declare const CAPABILITIES: {
958
958
  readonly flag: "--variant";
959
959
  readonly kind: "value";
960
960
  readonly unless: null;
961
+ }, {
962
+ readonly option: "session";
963
+ readonly flag: "--session";
964
+ readonly kind: "value";
965
+ readonly unless: null;
961
966
  }, {
962
967
  readonly option: "project";
963
968
  readonly flag: "--project";
@@ -1084,6 +1084,12 @@ export const CAPABILITIES = {
1084
1084
  kind: "value",
1085
1085
  unless: null,
1086
1086
  },
1087
+ {
1088
+ option: "session",
1089
+ flag: "--session",
1090
+ kind: "value",
1091
+ unless: null,
1092
+ },
1087
1093
  {
1088
1094
  option: "project",
1089
1095
  flag: "--project",
@@ -566,8 +566,10 @@ export interface ActionEvent {
566
566
  duration_ms: number | null;
567
567
  finished_at: string | null;
568
568
  /**
569
- * Position of this event within the run, so "≤ N tool calls" and "did X
570
- * before Y" are expressible from a stable ordering (also array order).
569
+ * Position of this event within the run, so "did X before Y" is
570
+ * expressible from a stable ordering (also array order). It counts every
571
+ * kind, so tool calls interleaved with `message`/`reasoning` events do not
572
+ * carry contiguous indexes; count tool calls by `kind`, not by `index`.
571
573
  */
572
574
  index: number;
573
575
  /**
@@ -577,9 +579,13 @@ export interface ActionEvent {
577
579
  */
578
580
  input: unknown;
579
581
  /**
580
- * The kind of event: `tool_call` (the model invoked a tool) or
581
- * `tool_result` (the observation returned to the model). Left open for
582
- * future kinds rather than an enum, so a new shape never breaks the field.
582
+ * The kind of event: `tool_call` (the model invoked a tool),
583
+ * `tool_result` (the observation returned to the model), `message` (the
584
+ * agent's own text, in `output`) or `reasoning` (its reasoning text, in
585
+ * `output`). A `message` or `reasoning` event is one finished item, never
586
+ * a token delta. Left open for future kinds rather than an enum, so a new
587
+ * shape never breaks the field — a consumer counting tool calls filters on
588
+ * it (see [`ActionEvent::is_tool_activity`]).
583
589
  */
584
590
  kind: string;
585
591
  /**
@@ -7,6 +7,14 @@ export type HistoryLine = ({
7
7
  harness_id?: string | null | undefined;
8
8
  run_id: string;
9
9
  schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7" | "1.8" | "1.9";
10
+ /**
11
+ * The name of the session this line belongs to — the `name` its run's
12
+ * closing `run` line will carry — so a run still in progress (events but
13
+ * no closing line yet) can be listed and followed by name. Omitted when
14
+ * absent: lines written before it existed carry none, and every reader
15
+ * that predates it ignores it.
16
+ */
17
+ session_name?: string | null | undefined;
10
18
  type: "event";
11
19
  variant?: string | null | undefined;
12
20
  [k: string]: unknown;
@@ -19,6 +27,14 @@ export type HistoryLine = ({
19
27
  harness_id?: string | null | undefined;
20
28
  run_id: string;
21
29
  schema_version: "1.0" | "1.1";
30
+ /**
31
+ * The name of the session this line belongs to — the `name` its run's
32
+ * closing `run` line will carry — so a run still in progress (events but
33
+ * no closing line yet) can be listed and followed by name. Omitted when
34
+ * absent: lines written before it existed carry none, and every reader
35
+ * that predates it ignores it.
36
+ */
37
+ session_name?: string | null | undefined;
22
38
  type: "event";
23
39
  variant?: string | null | undefined;
24
40
  [k: string]: unknown;
@@ -412,8 +428,10 @@ export interface ActionEvent {
412
428
  duration_ms: number | null;
413
429
  finished_at: string | null;
414
430
  /**
415
- * Position of this event within the run, so "≤ N tool calls" and "did X
416
- * before Y" are expressible from a stable ordering (also array order).
431
+ * Position of this event within the run, so "did X before Y" is
432
+ * expressible from a stable ordering (also array order). It counts every
433
+ * kind, so tool calls interleaved with `message`/`reasoning` events do not
434
+ * carry contiguous indexes; count tool calls by `kind`, not by `index`.
417
435
  */
418
436
  index: number;
419
437
  /**
@@ -423,9 +441,13 @@ export interface ActionEvent {
423
441
  */
424
442
  input: unknown;
425
443
  /**
426
- * The kind of event: `tool_call` (the model invoked a tool) or
427
- * `tool_result` (the observation returned to the model). Left open for
428
- * future kinds rather than an enum, so a new shape never breaks the field.
444
+ * The kind of event: `tool_call` (the model invoked a tool),
445
+ * `tool_result` (the observation returned to the model), `message` (the
446
+ * agent's own text, in `output`) or `reasoning` (its reasoning text, in
447
+ * `output`). A `message` or `reasoning` event is one finished item, never
448
+ * a token delta. Left open for future kinds rather than an enum, so a new
449
+ * shape never breaks the field — a consumer counting tool calls filters on
450
+ * it (see [`ActionEvent::is_tool_activity`]).
429
451
  */
430
452
  kind: string;
431
453
  /**
@@ -1,8 +1,12 @@
1
1
  export type HistoryList = HistorySessionSummary[];
2
2
  /**
3
- * A one-line summary of a session, for `oneharness history list`. Read from the
4
- * session's records: `name`/`project`/`started` come from the first record,
5
- * `harnesses` is the distinct set across all records.
3
+ * A one-line summary of a session, for `oneharness history list`, read from
4
+ * both its closing `run` records and its event lines. `name`/`project`/
5
+ * `started` come from the first record; a session still in its first turn has
6
+ * none yet, so they fall back to the events' `session_name`, the project
7
+ * directory's slug, and the instant in the session id. `harnesses` is the
8
+ * distinct set across records and events, and `running` says an event's run
9
+ * has no closing record yet.
6
10
  */
7
11
  export interface HistorySessionSummary {
8
12
  /**
@@ -30,6 +34,12 @@ export interface HistorySessionSummary {
30
34
  * How many harness-run records the session holds.
31
35
  */
32
36
  record_count: number;
37
+ /**
38
+ * Whether a harness run in this session has written events but not yet
39
+ * its closing record — the run is still going (or ended without one: a
40
+ * killed process leaves the same file). Omitted when false.
41
+ */
42
+ running?: boolean | undefined;
33
43
  /**
34
44
  * The RFC3339 UTC start time (first record's timestamp); empty if unknown.
35
45
  */
@@ -49,6 +49,9 @@ export type HistoryRecord = {
49
49
  }) | (ActionEvent & {
50
50
  kind?: "tool_result" | undefined;
51
51
  [k: string]: unknown;
52
+ }) | (ActionEvent & {
53
+ kind?: "message" | "reasoning" | undefined;
54
+ [k: string]: unknown;
52
55
  }))[] | null;
53
56
  exit_code: number | null;
54
57
  /**
@@ -207,6 +210,9 @@ export type HistoryRecord = {
207
210
  }) | (ActionEvent & {
208
211
  kind?: "tool_result" | undefined;
209
212
  [k: string]: unknown;
213
+ }) | (ActionEvent & {
214
+ kind?: "message" | "reasoning" | undefined;
215
+ [k: string]: unknown;
210
216
  })) & {
211
217
  timing_source?: never | undefined;
212
218
  [k: string]: unknown;
@@ -1363,8 +1369,10 @@ export interface ActionEvent {
1363
1369
  duration_ms: number | null;
1364
1370
  finished_at: string | null;
1365
1371
  /**
1366
- * Position of this event within the run, so "≤ N tool calls" and "did X
1367
- * before Y" are expressible from a stable ordering (also array order).
1372
+ * Position of this event within the run, so "did X before Y" is
1373
+ * expressible from a stable ordering (also array order). It counts every
1374
+ * kind, so tool calls interleaved with `message`/`reasoning` events do not
1375
+ * carry contiguous indexes; count tool calls by `kind`, not by `index`.
1368
1376
  */
1369
1377
  index: number;
1370
1378
  /**
@@ -1374,9 +1382,13 @@ export interface ActionEvent {
1374
1382
  */
1375
1383
  input: unknown;
1376
1384
  /**
1377
- * The kind of event: `tool_call` (the model invoked a tool) or
1378
- * `tool_result` (the observation returned to the model). Left open for
1379
- * future kinds rather than an enum, so a new shape never breaks the field.
1385
+ * The kind of event: `tool_call` (the model invoked a tool),
1386
+ * `tool_result` (the observation returned to the model), `message` (the
1387
+ * agent's own text, in `output`) or `reasoning` (its reasoning text, in
1388
+ * `output`). A `message` or `reasoning` event is one finished item, never
1389
+ * a token delta. Left open for future kinds rather than an enum, so a new
1390
+ * shape never breaks the field — a consumer counting tool calls filters on
1391
+ * it (see [`ActionEvent::is_tool_activity`]).
1380
1392
  */
1381
1393
  kind: string;
1382
1394
  /**
@@ -126,6 +126,9 @@ export type HistoryRecord = {
126
126
  }) | (ActionEvent & {
127
127
  kind?: "tool_result" | undefined;
128
128
  [k: string]: unknown;
129
+ }) | (ActionEvent & {
130
+ kind?: "message" | "reasoning" | undefined;
131
+ [k: string]: unknown;
129
132
  }))[] | null;
130
133
  exit_code: number | null;
131
134
  /**
@@ -284,6 +287,9 @@ export type HistoryRecord = {
284
287
  }) | (ActionEvent & {
285
288
  kind?: "tool_result" | undefined;
286
289
  [k: string]: unknown;
290
+ }) | (ActionEvent & {
291
+ kind?: "message" | "reasoning" | undefined;
292
+ [k: string]: unknown;
287
293
  })) & {
288
294
  timing_source?: never | undefined;
289
295
  [k: string]: unknown;
@@ -1375,6 +1381,14 @@ export type HistoryEventLine = {
1375
1381
  harness_id?: string | null | undefined;
1376
1382
  run_id: string;
1377
1383
  schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7" | "1.8" | "1.9";
1384
+ /**
1385
+ * The name of the session this line belongs to — the `name` its run's
1386
+ * closing `run` line will carry — so a run still in progress (events but
1387
+ * no closing line yet) can be listed and followed by name. Omitted when
1388
+ * absent: lines written before it existed carry none, and every reader
1389
+ * that predates it ignores it.
1390
+ */
1391
+ session_name?: string | null | undefined;
1378
1392
  variant?: string | null | undefined;
1379
1393
  [k: string]: unknown;
1380
1394
  } | {
@@ -1386,6 +1400,14 @@ export type HistoryEventLine = {
1386
1400
  harness_id?: string | null | undefined;
1387
1401
  run_id: string;
1388
1402
  schema_version: "1.0" | "1.1";
1403
+ /**
1404
+ * The name of the session this line belongs to — the `name` its run's
1405
+ * closing `run` line will carry — so a run still in progress (events but
1406
+ * no closing line yet) can be listed and followed by name. Omitted when
1407
+ * absent: lines written before it existed carry none, and every reader
1408
+ * that predates it ignores it.
1409
+ */
1410
+ session_name?: string | null | undefined;
1389
1411
  variant?: string | null | undefined;
1390
1412
  [k: string]: unknown;
1391
1413
  };
@@ -1401,8 +1423,10 @@ export interface ActionEvent {
1401
1423
  duration_ms: number | null;
1402
1424
  finished_at: string | null;
1403
1425
  /**
1404
- * Position of this event within the run, so "≤ N tool calls" and "did X
1405
- * before Y" are expressible from a stable ordering (also array order).
1426
+ * Position of this event within the run, so "did X before Y" is
1427
+ * expressible from a stable ordering (also array order). It counts every
1428
+ * kind, so tool calls interleaved with `message`/`reasoning` events do not
1429
+ * carry contiguous indexes; count tool calls by `kind`, not by `index`.
1406
1430
  */
1407
1431
  index: number;
1408
1432
  /**
@@ -1412,9 +1436,13 @@ export interface ActionEvent {
1412
1436
  */
1413
1437
  input: unknown;
1414
1438
  /**
1415
- * The kind of event: `tool_call` (the model invoked a tool) or
1416
- * `tool_result` (the observation returned to the model). Left open for
1417
- * future kinds rather than an enum, so a new shape never breaks the field.
1439
+ * The kind of event: `tool_call` (the model invoked a tool),
1440
+ * `tool_result` (the observation returned to the model), `message` (the
1441
+ * agent's own text, in `output`) or `reasoning` (its reasoning text, in
1442
+ * `output`). A `message` or `reasoning` event is one finished item, never
1443
+ * a token delta. Left open for future kinds rather than an enum, so a new
1444
+ * shape never breaks the field — a consumer counting tool calls filters on
1445
+ * it (see [`ActionEvent::is_tool_activity`]).
1418
1446
  */
1419
1447
  kind: string;
1420
1448
  /**
@@ -22,6 +22,12 @@ export interface HistoryWatchOptions {
22
22
  */
23
23
  noConfig?: boolean | undefined;
24
24
  project?: string | undefined;
25
+ /**
26
+ * Follow one session: its id, or its name (the newest session so named
27
+ * whose labels match every label filter, including one still running, or
28
+ * the first to appear).
29
+ */
30
+ session?: string | null | undefined;
25
31
  /**
26
32
  * Narrow to one configured harness identity (`claude-code:work`).
27
33
  */
@@ -112,6 +112,9 @@ export type HistoryRecord = ({
112
112
  }) | (ActionEvent & {
113
113
  kind?: "tool_result" | undefined;
114
114
  [k: string]: unknown;
115
+ }) | (ActionEvent & {
116
+ kind?: "message" | "reasoning" | undefined;
117
+ [k: string]: unknown;
115
118
  }))[] | null;
116
119
  exit_code: number | null;
117
120
  /**
@@ -270,6 +273,9 @@ export type HistoryRecord = ({
270
273
  }) | (ActionEvent & {
271
274
  kind?: "tool_result" | undefined;
272
275
  [k: string]: unknown;
276
+ }) | (ActionEvent & {
277
+ kind?: "message" | "reasoning" | undefined;
278
+ [k: string]: unknown;
273
279
  })) & {
274
280
  timing_source?: never | undefined;
275
281
  [k: string]: unknown;
@@ -1367,8 +1373,10 @@ export interface ActionEvent {
1367
1373
  duration_ms: number | null;
1368
1374
  finished_at: string | null;
1369
1375
  /**
1370
- * Position of this event within the run, so "≤ N tool calls" and "did X
1371
- * before Y" are expressible from a stable ordering (also array order).
1376
+ * Position of this event within the run, so "did X before Y" is
1377
+ * expressible from a stable ordering (also array order). It counts every
1378
+ * kind, so tool calls interleaved with `message`/`reasoning` events do not
1379
+ * carry contiguous indexes; count tool calls by `kind`, not by `index`.
1372
1380
  */
1373
1381
  index: number;
1374
1382
  /**
@@ -1378,9 +1386,13 @@ export interface ActionEvent {
1378
1386
  */
1379
1387
  input: unknown;
1380
1388
  /**
1381
- * The kind of event: `tool_call` (the model invoked a tool) or
1382
- * `tool_result` (the observation returned to the model). Left open for
1383
- * future kinds rather than an enum, so a new shape never breaks the field.
1389
+ * The kind of event: `tool_call` (the model invoked a tool),
1390
+ * `tool_result` (the observation returned to the model), `message` (the
1391
+ * agent's own text, in `output`) or `reasoning` (its reasoning text, in
1392
+ * `output`). A `message` or `reasoning` event is one finished item, never
1393
+ * a token delta. Left open for future kinds rather than an enum, so a new
1394
+ * shape never breaks the field — a consumer counting tool calls filters on
1395
+ * it (see [`ActionEvent::is_tool_activity`]).
1384
1396
  */
1385
1397
  kind: string;
1386
1398
  /**
@@ -169,8 +169,10 @@ export interface ActionEvent {
169
169
  duration_ms: number | null;
170
170
  finished_at: string | null;
171
171
  /**
172
- * Position of this event within the run, so "≤ N tool calls" and "did X
173
- * before Y" are expressible from a stable ordering (also array order).
172
+ * Position of this event within the run, so "did X before Y" is
173
+ * expressible from a stable ordering (also array order). It counts every
174
+ * kind, so tool calls interleaved with `message`/`reasoning` events do not
175
+ * carry contiguous indexes; count tool calls by `kind`, not by `index`.
174
176
  */
175
177
  index: number;
176
178
  /**
@@ -180,9 +182,13 @@ export interface ActionEvent {
180
182
  */
181
183
  input: unknown;
182
184
  /**
183
- * The kind of event: `tool_call` (the model invoked a tool) or
184
- * `tool_result` (the observation returned to the model). Left open for
185
- * future kinds rather than an enum, so a new shape never breaks the field.
185
+ * The kind of event: `tool_call` (the model invoked a tool),
186
+ * `tool_result` (the observation returned to the model), `message` (the
187
+ * agent's own text, in `output`) or `reasoning` (its reasoning text, in
188
+ * `output`). A `message` or `reasoning` event is one finished item, never
189
+ * a token delta. Left open for future kinds rather than an enum, so a new
190
+ * shape never breaks the field — a consumer counting tool calls filters on
191
+ * it (see [`ActionEvent::is_tool_activity`]).
186
192
  */
187
193
  kind: string;
188
194
  /**
@@ -1153,6 +1153,12 @@
1153
1153
  "kind": "value",
1154
1154
  "unless": null
1155
1155
  },
1156
+ {
1157
+ "option": "session",
1158
+ "flag": "--session",
1159
+ "kind": "value",
1160
+ "unless": null
1161
+ },
1156
1162
  {
1157
1163
  "option": "project",
1158
1164
  "flag": "--project",
@@ -1508,7 +1514,7 @@
1508
1514
  ]
1509
1515
  },
1510
1516
  "index": {
1511
- "description": "Position of this event within the run, so \"≤ N tool calls\" and \"did X\nbefore Y\" are expressible from a stable ordering (also array order).",
1517
+ "description": "Position of this event within the run, so \"did X before Y\" is\nexpressible from a stable ordering (also array order). It counts every\nkind, so tool calls interleaved with `message`/`reasoning` events do not\ncarry contiguous indexes; count tool calls by `kind`, not by `index`.",
1512
1518
  "type": "integer",
1513
1519
  "format": "uint",
1514
1520
  "minimum": 0
@@ -1517,7 +1523,7 @@
1517
1523
  "description": "Structured, tool-shaped arguments (the command string, the file path),\nso a consumer asserts on specific args without re-parsing; `null` when the\nevent carries none (e.g. a `tool_result`)."
1518
1524
  },
1519
1525
  "kind": {
1520
- "description": "The kind of event: `tool_call` (the model invoked a tool) or\n`tool_result` (the observation returned to the model). Left open for\nfuture kinds rather than an enum, so a new shape never breaks the field.",
1526
+ "description": "The kind of event: `tool_call` (the model invoked a tool),\n`tool_result` (the observation returned to the model), `message` (the\nagent's own text, in `output`) or `reasoning` (its reasoning text, in\n`output`). A `message` or `reasoning` event is one finished item, never\na token delta. Left open for future kinds rather than an enum, so a new\nshape never breaks the field — a consumer counting tool calls filters on\nit (see [`ActionEvent::is_tool_activity`]).",
1521
1527
  "type": "string"
1522
1528
  },
1523
1529
  "name": {
@@ -2589,7 +2595,7 @@
2589
2595
  ]
2590
2596
  },
2591
2597
  "index": {
2592
- "description": "Position of this event within the run, so \"≤ N tool calls\" and \"did X\nbefore Y\" are expressible from a stable ordering (also array order).",
2598
+ "description": "Position of this event within the run, so \"did X before Y\" is\nexpressible from a stable ordering (also array order). It counts every\nkind, so tool calls interleaved with `message`/`reasoning` events do not\ncarry contiguous indexes; count tool calls by `kind`, not by `index`.",
2593
2599
  "type": "integer",
2594
2600
  "format": "uint",
2595
2601
  "minimum": 0
@@ -2598,7 +2604,7 @@
2598
2604
  "description": "Structured, tool-shaped arguments (the command string, the file path),\nso a consumer asserts on specific args without re-parsing; `null` when the\nevent carries none (e.g. a `tool_result`)."
2599
2605
  },
2600
2606
  "kind": {
2601
- "description": "The kind of event: `tool_call` (the model invoked a tool) or\n`tool_result` (the observation returned to the model). Left open for\nfuture kinds rather than an enum, so a new shape never breaks the field.",
2607
+ "description": "The kind of event: `tool_call` (the model invoked a tool),\n`tool_result` (the observation returned to the model), `message` (the\nagent's own text, in `output`) or `reasoning` (its reasoning text, in\n`output`). A `message` or `reasoning` event is one finished item, never\na token delta. Left open for future kinds rather than an enum, so a new\nshape never breaks the field — a consumer counting tool calls filters on\nit (see [`ActionEvent::is_tool_activity`]).",
2602
2608
  "type": "string"
2603
2609
  },
2604
2610
  "name": {
@@ -4257,6 +4263,18 @@
4257
4263
  "project": {
4258
4264
  "type": "string"
4259
4265
  },
4266
+ "session": {
4267
+ "description": "Follow one session: its id, or its name (the newest session so named\nwhose labels match every label filter, including one still running, or\nthe first to appear).",
4268
+ "type": [
4269
+ "string",
4270
+ "null"
4271
+ ],
4272
+ "minLength": 1,
4273
+ "not": {
4274
+ "pattern": "[^A-Za-z0-9-]|^-|-$|--"
4275
+ },
4276
+ "pattern": "^(?:[a-z0-9-]+|[a-z0-9-]+-(?:[0-9]{4}(?:(?:0[13578]|1[02])(?:0[1-9]|[12][0-9]|3[01])|(?:0[469]|11)(?:0[1-9]|[12][0-9]|30)|02(?:0[1-9]|1[0-9]|2[0-8]))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:[02468][048]|[13579][26])00)0229)T(?:[01][0-9]|2[0-3])[0-5][0-9][0-5][0-9]Z-[0-9]+)$"
4277
+ },
4260
4278
  "variant": {
4261
4279
  "description": "Narrow to one configured harness identity (`claude-code:work`).",
4262
4280
  "type": "string"
@@ -4331,6 +4349,17 @@
4331
4349
  "1.9"
4332
4350
  ]
4333
4351
  },
4352
+ "session_name": {
4353
+ "description": "The name of the session this line belongs to — the `name` its run's\nclosing `run` line will carry — so a run still in progress (events but\nno closing line yet) can be listed and followed by name. Omitted when\nabsent: lines written before it existed carry none, and every reader\nthat predates it ignores it.",
4354
+ "type": [
4355
+ "string",
4356
+ "null"
4357
+ ],
4358
+ "minLength": 1,
4359
+ "not": {
4360
+ "pattern": "[^a-z0-9-]|^-|-$|--"
4361
+ }
4362
+ },
4334
4363
  "type": {
4335
4364
  "type": "string",
4336
4365
  "const": "event"
@@ -4393,6 +4422,17 @@
4393
4422
  "1.1"
4394
4423
  ]
4395
4424
  },
4425
+ "session_name": {
4426
+ "description": "The name of the session this line belongs to — the `name` its run's\nclosing `run` line will carry — so a run still in progress (events but\nno closing line yet) can be listed and followed by name. Omitted when\nabsent: lines written before it existed carry none, and every reader\nthat predates it ignores it.",
4427
+ "type": [
4428
+ "string",
4429
+ "null"
4430
+ ],
4431
+ "minLength": 1,
4432
+ "not": {
4433
+ "pattern": "[^a-z0-9-]|^-|-$|--"
4434
+ }
4435
+ },
4396
4436
  "type": {
4397
4437
  "type": "string",
4398
4438
  "const": "event"
@@ -5940,7 +5980,7 @@
5940
5980
  ]
5941
5981
  },
5942
5982
  "index": {
5943
- "description": "Position of this event within the run, so \"≤ N tool calls\" and \"did X\nbefore Y\" are expressible from a stable ordering (also array order).",
5983
+ "description": "Position of this event within the run, so \"did X before Y\" is\nexpressible from a stable ordering (also array order). It counts every\nkind, so tool calls interleaved with `message`/`reasoning` events do not\ncarry contiguous indexes; count tool calls by `kind`, not by `index`.",
5944
5984
  "type": "integer",
5945
5985
  "format": "uint",
5946
5986
  "minimum": 0
@@ -5949,7 +5989,7 @@
5949
5989
  "description": "Structured, tool-shaped arguments (the command string, the file path),\nso a consumer asserts on specific args without re-parsing; `null` when the\nevent carries none (e.g. a `tool_result`)."
5950
5990
  },
5951
5991
  "kind": {
5952
- "description": "The kind of event: `tool_call` (the model invoked a tool) or\n`tool_result` (the observation returned to the model). Left open for\nfuture kinds rather than an enum, so a new shape never breaks the field.",
5992
+ "description": "The kind of event: `tool_call` (the model invoked a tool),\n`tool_result` (the observation returned to the model), `message` (the\nagent's own text, in `output`) or `reasoning` (its reasoning text, in\n`output`). A `message` or `reasoning` event is one finished item, never\na token delta. Left open for future kinds rather than an enum, so a new\nshape never breaks the field — a consumer counting tool calls filters on\nit (see [`ActionEvent::is_tool_activity`]).",
5953
5993
  "type": "string"
5954
5994
  },
5955
5995
  "name": {
@@ -6788,6 +6828,25 @@
6788
6828
  }
6789
6829
  }
6790
6830
  ]
6831
+ },
6832
+ {
6833
+ "allOf": [
6834
+ {
6835
+ "$ref": "#/$defs/ActionEvent"
6836
+ },
6837
+ {
6838
+ "type": "object",
6839
+ "properties": {
6840
+ "kind": {
6841
+ "type": "string",
6842
+ "enum": [
6843
+ "message",
6844
+ "reasoning"
6845
+ ]
6846
+ }
6847
+ }
6848
+ }
6849
+ ]
6791
6850
  }
6792
6851
  ]
6793
6852
  }
@@ -7170,6 +7229,25 @@
7170
7229
  }
7171
7230
  }
7172
7231
  ]
7232
+ },
7233
+ {
7234
+ "allOf": [
7235
+ {
7236
+ "$ref": "#/$defs/ActionEvent"
7237
+ },
7238
+ {
7239
+ "type": "object",
7240
+ "properties": {
7241
+ "kind": {
7242
+ "type": "string",
7243
+ "enum": [
7244
+ "message",
7245
+ "reasoning"
7246
+ ]
7247
+ }
7248
+ }
7249
+ }
7250
+ ]
7173
7251
  }
7174
7252
  ]
7175
7253
  },
@@ -8942,7 +9020,7 @@
8942
9020
  ]
8943
9021
  },
8944
9022
  "index": {
8945
- "description": "Position of this event within the run, so \"≤ N tool calls\" and \"did X\nbefore Y\" are expressible from a stable ordering (also array order).",
9023
+ "description": "Position of this event within the run, so \"did X before Y\" is\nexpressible from a stable ordering (also array order). It counts every\nkind, so tool calls interleaved with `message`/`reasoning` events do not\ncarry contiguous indexes; count tool calls by `kind`, not by `index`.",
8946
9024
  "type": "integer",
8947
9025
  "format": "uint",
8948
9026
  "minimum": 0
@@ -8951,7 +9029,7 @@
8951
9029
  "description": "Structured, tool-shaped arguments (the command string, the file path),\nso a consumer asserts on specific args without re-parsing; `null` when the\nevent carries none (e.g. a `tool_result`)."
8952
9030
  },
8953
9031
  "kind": {
8954
- "description": "The kind of event: `tool_call` (the model invoked a tool) or\n`tool_result` (the observation returned to the model). Left open for\nfuture kinds rather than an enum, so a new shape never breaks the field.",
9032
+ "description": "The kind of event: `tool_call` (the model invoked a tool),\n`tool_result` (the observation returned to the model), `message` (the\nagent's own text, in `output`) or `reasoning` (its reasoning text, in\n`output`). A `message` or `reasoning` event is one finished item, never\na token delta. Left open for future kinds rather than an enum, so a new\nshape never breaks the field — a consumer counting tool calls filters on\nit (see [`ActionEvent::is_tool_activity`]).",
8955
9033
  "type": "string"
8956
9034
  },
8957
9035
  "name": {
@@ -9326,7 +9404,7 @@
9326
9404
  ]
9327
9405
  },
9328
9406
  "index": {
9329
- "description": "Position of this event within the run, so \"≤ N tool calls\" and \"did X\nbefore Y\" are expressible from a stable ordering (also array order).",
9407
+ "description": "Position of this event within the run, so \"did X before Y\" is\nexpressible from a stable ordering (also array order). It counts every\nkind, so tool calls interleaved with `message`/`reasoning` events do not\ncarry contiguous indexes; count tool calls by `kind`, not by `index`.",
9330
9408
  "type": "integer",
9331
9409
  "format": "uint",
9332
9410
  "minimum": 0
@@ -9335,7 +9413,7 @@
9335
9413
  "description": "Structured, tool-shaped arguments (the command string, the file path),\nso a consumer asserts on specific args without re-parsing; `null` when the\nevent carries none (e.g. a `tool_result`)."
9336
9414
  },
9337
9415
  "kind": {
9338
- "description": "The kind of event: `tool_call` (the model invoked a tool) or\n`tool_result` (the observation returned to the model). Left open for\nfuture kinds rather than an enum, so a new shape never breaks the field.",
9416
+ "description": "The kind of event: `tool_call` (the model invoked a tool),\n`tool_result` (the observation returned to the model), `message` (the\nagent's own text, in `output`) or `reasoning` (its reasoning text, in\n`output`). A `message` or `reasoning` event is one finished item, never\na token delta. Left open for future kinds rather than an enum, so a new\nshape never breaks the field — a consumer counting tool calls filters on\nit (see [`ActionEvent::is_tool_activity`]).",
9339
9417
  "type": "string"
9340
9418
  },
9341
9419
  "name": {
@@ -9496,6 +9574,17 @@
9496
9574
  "1.9"
9497
9575
  ]
9498
9576
  },
9577
+ "session_name": {
9578
+ "description": "The name of the session this line belongs to — the `name` its run's\nclosing `run` line will carry — so a run still in progress (events but\nno closing line yet) can be listed and followed by name. Omitted when\nabsent: lines written before it existed carry none, and every reader\nthat predates it ignores it.",
9579
+ "type": [
9580
+ "string",
9581
+ "null"
9582
+ ],
9583
+ "minLength": 1,
9584
+ "not": {
9585
+ "pattern": "[^a-z0-9-]|^-|-$|--"
9586
+ }
9587
+ },
9499
9588
  "variant": {
9500
9589
  "type": [
9501
9590
  "string",
@@ -9553,6 +9642,17 @@
9553
9642
  "1.1"
9554
9643
  ]
9555
9644
  },
9645
+ "session_name": {
9646
+ "description": "The name of the session this line belongs to — the `name` its run's\nclosing `run` line will carry — so a run still in progress (events but\nno closing line yet) can be listed and followed by name. Omitted when\nabsent: lines written before it existed carry none, and every reader\nthat predates it ignores it.",
9647
+ "type": [
9648
+ "string",
9649
+ "null"
9650
+ ],
9651
+ "minLength": 1,
9652
+ "not": {
9653
+ "pattern": "[^a-z0-9-]|^-|-$|--"
9654
+ }
9655
+ },
9556
9656
  "variant": {
9557
9657
  "type": [
9558
9658
  "string",
@@ -10113,6 +10213,25 @@
10113
10213
  }
10114
10214
  }
10115
10215
  ]
10216
+ },
10217
+ {
10218
+ "allOf": [
10219
+ {
10220
+ "$ref": "#/$defs/ActionEvent"
10221
+ },
10222
+ {
10223
+ "type": "object",
10224
+ "properties": {
10225
+ "kind": {
10226
+ "type": "string",
10227
+ "enum": [
10228
+ "message",
10229
+ "reasoning"
10230
+ ]
10231
+ }
10232
+ }
10233
+ }
10234
+ ]
10116
10235
  }
10117
10236
  ]
10118
10237
  }
@@ -10495,6 +10614,25 @@
10495
10614
  }
10496
10615
  }
10497
10616
  ]
10617
+ },
10618
+ {
10619
+ "allOf": [
10620
+ {
10621
+ "$ref": "#/$defs/ActionEvent"
10622
+ },
10623
+ {
10624
+ "type": "object",
10625
+ "properties": {
10626
+ "kind": {
10627
+ "type": "string",
10628
+ "enum": [
10629
+ "message",
10630
+ "reasoning"
10631
+ ]
10632
+ }
10633
+ }
10634
+ }
10635
+ ]
10498
10636
  }
10499
10637
  ]
10500
10638
  },
@@ -12448,7 +12586,7 @@
12448
12586
  ]
12449
12587
  },
12450
12588
  "index": {
12451
- "description": "Position of this event within the run, so \"≤ N tool calls\" and \"did X\nbefore Y\" are expressible from a stable ordering (also array order).",
12589
+ "description": "Position of this event within the run, so \"did X before Y\" is\nexpressible from a stable ordering (also array order). It counts every\nkind, so tool calls interleaved with `message`/`reasoning` events do not\ncarry contiguous indexes; count tool calls by `kind`, not by `index`.",
12452
12590
  "type": "integer",
12453
12591
  "format": "uint",
12454
12592
  "minimum": 0
@@ -12457,7 +12595,7 @@
12457
12595
  "description": "Structured, tool-shaped arguments (the command string, the file path),\nso a consumer asserts on specific args without re-parsing; `null` when the\nevent carries none (e.g. a `tool_result`)."
12458
12596
  },
12459
12597
  "kind": {
12460
- "description": "The kind of event: `tool_call` (the model invoked a tool) or\n`tool_result` (the observation returned to the model). Left open for\nfuture kinds rather than an enum, so a new shape never breaks the field.",
12598
+ "description": "The kind of event: `tool_call` (the model invoked a tool),\n`tool_result` (the observation returned to the model), `message` (the\nagent's own text, in `output`) or `reasoning` (its reasoning text, in\n`output`). A `message` or `reasoning` event is one finished item, never\na token delta. Left open for future kinds rather than an enum, so a new\nshape never breaks the field — a consumer counting tool calls filters on\nit (see [`ActionEvent::is_tool_activity`]).",
12461
12599
  "type": "string"
12462
12600
  },
12463
12601
  "name": {
@@ -13121,6 +13259,25 @@
13121
13259
  }
13122
13260
  }
13123
13261
  ]
13262
+ },
13263
+ {
13264
+ "allOf": [
13265
+ {
13266
+ "$ref": "#/$defs/ActionEvent"
13267
+ },
13268
+ {
13269
+ "type": "object",
13270
+ "properties": {
13271
+ "kind": {
13272
+ "type": "string",
13273
+ "enum": [
13274
+ "message",
13275
+ "reasoning"
13276
+ ]
13277
+ }
13278
+ }
13279
+ }
13280
+ ]
13124
13281
  }
13125
13282
  ]
13126
13283
  }
@@ -13503,6 +13660,25 @@
13503
13660
  }
13504
13661
  }
13505
13662
  ]
13663
+ },
13664
+ {
13665
+ "allOf": [
13666
+ {
13667
+ "$ref": "#/$defs/ActionEvent"
13668
+ },
13669
+ {
13670
+ "type": "object",
13671
+ "properties": {
13672
+ "kind": {
13673
+ "type": "string",
13674
+ "enum": [
13675
+ "message",
13676
+ "reasoning"
13677
+ ]
13678
+ }
13679
+ }
13680
+ }
13681
+ ]
13506
13682
  }
13507
13683
  ]
13508
13684
  },
@@ -15456,7 +15632,7 @@
15456
15632
  }
15457
15633
  },
15458
15634
  "HistorySessionSummary": {
15459
- "description": "A one-line summary of a session, for `oneharness history list`. Read from the\nsession's records: `name`/`project`/`started` come from the first record,\n`harnesses` is the distinct set across all records.",
15635
+ "description": "A one-line summary of a session, for `oneharness history list`, read from\nboth its closing `run` records and its event lines. `name`/`project`/\n`started` come from the first record; a session still in its first turn has\nnone yet, so they fall back to the events' `session_name`, the project\ndirectory's slug, and the instant in the session id. `harnesses` is the\ndistinct set across records and events, and `running` says an event's run\nhas no closing record yet.",
15460
15636
  "type": "object",
15461
15637
  "properties": {
15462
15638
  "harnesses": {
@@ -15492,6 +15668,10 @@
15492
15668
  "format": "uint",
15493
15669
  "minimum": 0
15494
15670
  },
15671
+ "running": {
15672
+ "description": "Whether a harness run in this session has written events but not yet\nits closing record — the run is still going (or ended without one: a\nkilled process leaves the same file). Omitted when false.",
15673
+ "type": "boolean"
15674
+ },
15495
15675
  "started": {
15496
15676
  "description": "The RFC3339 UTC start time (first record's timestamp); empty if unknown.",
15497
15677
  "type": "string"
@@ -360,6 +360,17 @@ export const HistoryEventLineSchema = z.union([
360
360
  z.literal("1.9"),
361
361
  ])
362
362
  .refine((value) => value !== undefined, { message: "Required" }),
363
+ session_name: z
364
+ .union([
365
+ z
366
+ .string()
367
+ .min(1)
368
+ .refine((value) => !new RegExp("[^a-z0-9-]|^-|-$|--", "u").test(value), {
369
+ message: "Invalid string: must not contain [^a-z0-9-]|^-|-$|--",
370
+ }),
371
+ z.null(),
372
+ ])
373
+ .optional(),
363
374
  variant: z.union([z.string(), z.null()]).optional(),
364
375
  }),
365
376
  z.looseObject({
@@ -379,6 +390,17 @@ export const HistoryEventLineSchema = z.union([
379
390
  schema_version: z
380
391
  .union([z.literal("1.0"), z.literal("1.1")])
381
392
  .refine((value) => value !== undefined, { message: "Required" }),
393
+ session_name: z
394
+ .union([
395
+ z
396
+ .string()
397
+ .min(1)
398
+ .refine((value) => !new RegExp("[^a-z0-9-]|^-|-$|--", "u").test(value), {
399
+ message: "Invalid string: must not contain [^a-z0-9-]|^-|-$|--",
400
+ }),
401
+ z.null(),
402
+ ])
403
+ .optional(),
382
404
  variant: z.union([z.string(), z.null()]).optional(),
383
405
  }),
384
406
  ]);
@@ -419,6 +441,17 @@ export const HistoryLineSchema = z.union([
419
441
  z.literal("1.9"),
420
442
  ])
421
443
  .refine((value) => value !== undefined, { message: "Required" }),
444
+ session_name: z
445
+ .union([
446
+ z
447
+ .string()
448
+ .min(1)
449
+ .refine((value) => !new RegExp("[^a-z0-9-]|^-|-$|--", "u").test(value), {
450
+ message: "Invalid string: must not contain [^a-z0-9-]|^-|-$|--",
451
+ }),
452
+ z.null(),
453
+ ])
454
+ .optional(),
422
455
  type: z.literal("event").refine((value) => value !== undefined, { message: "Required" }),
423
456
  variant: z.union([z.string(), z.null()]).optional(),
424
457
  }),
@@ -439,6 +472,17 @@ export const HistoryLineSchema = z.union([
439
472
  schema_version: z
440
473
  .union([z.literal("1.0"), z.literal("1.1")])
441
474
  .refine((value) => value !== undefined, { message: "Required" }),
475
+ session_name: z
476
+ .union([
477
+ z
478
+ .string()
479
+ .min(1)
480
+ .refine((value) => !new RegExp("[^a-z0-9-]|^-|-$|--", "u").test(value), {
481
+ message: "Invalid string: must not contain [^a-z0-9-]|^-|-$|--",
482
+ }),
483
+ z.null(),
484
+ ])
485
+ .optional(),
442
486
  type: z.literal("event").refine((value) => value !== undefined, { message: "Required" }),
443
487
  variant: z.union([z.string(), z.null()]).optional(),
444
488
  }),
@@ -1241,6 +1285,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1241
1285
  z.intersection(z.lazy(() => ActionEventSchema), z.looseObject({
1242
1286
  kind: z.literal("tool_result").optional(),
1243
1287
  })),
1288
+ z.intersection(z.lazy(() => ActionEventSchema), z.looseObject({
1289
+ kind: z.union([z.literal("message"), z.literal("reasoning")]).optional(),
1290
+ })),
1244
1291
  ])),
1245
1292
  z.null(),
1246
1293
  ])
@@ -1391,6 +1438,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1391
1438
  z.intersection(z.lazy(() => ActionEventSchema), z.looseObject({
1392
1439
  kind: z.literal("tool_result").optional(),
1393
1440
  })),
1441
+ z.intersection(z.lazy(() => ActionEventSchema), z.looseObject({
1442
+ kind: z.union([z.literal("message"), z.literal("reasoning")]).optional(),
1443
+ })),
1394
1444
  ]), z.looseObject({
1395
1445
  timing_source: z.never().optional(),
1396
1446
  }))),
@@ -2197,6 +2247,7 @@ export const HistorySessionSummarySchema = z.looseObject({
2197
2247
  .int()
2198
2248
  .gte(0)
2199
2249
  .refine((value) => value !== undefined, { message: "Required" }),
2250
+ running: z.boolean().optional(),
2200
2251
  started: z.string().refine((value) => value !== undefined, { message: "Required" }),
2201
2252
  });
2202
2253
  export const HistoryStreamEnvelopeSchema = z.union([
@@ -2223,6 +2274,18 @@ export const HistoryWatchOptionsSchema = z.strictObject({
2223
2274
  labels: z.lazy(() => HistoryLabelsSchema).optional(),
2224
2275
  noConfig: z.boolean().optional(),
2225
2276
  project: z.string().optional(),
2277
+ session: z
2278
+ .union([
2279
+ z
2280
+ .string()
2281
+ .min(1)
2282
+ .regex(new RegExp("^(?:[a-z0-9-]+|[a-z0-9-]+-(?:[0-9]{4}(?:(?:0[13578]|1[02])(?:0[1-9]|[12][0-9]|3[01])|(?:0[469]|11)(?:0[1-9]|[12][0-9]|30)|02(?:0[1-9]|1[0-9]|2[0-8]))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:[02468][048]|[13579][26])00)0229)T(?:[01][0-9]|2[0-3])[0-5][0-9][0-5][0-9]Z-[0-9]+)$", "u"))
2283
+ .refine((value) => !new RegExp("[^A-Za-z0-9-]|^-|-$|--", "u").test(value), {
2284
+ message: "Invalid string: must not contain [^A-Za-z0-9-]|^-|-$|--",
2285
+ }),
2286
+ z.null(),
2287
+ ])
2288
+ .optional(),
2226
2289
  variant: z.string().optional(),
2227
2290
  });
2228
2291
  export const HookEntrySchema = z.strictObject({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneharness/sdk",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Typed Node.js SDK for oneharness",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "node": ">=20"
20
20
  },
21
21
  "dependencies": {
22
- "oneharness-cli": "0.18.0",
22
+ "oneharness-cli": "0.19.0",
23
23
  "zod": "^4.4.3"
24
24
  }
25
25
  }