@oneharness/sdk 0.4.6 → 0.5.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.
@@ -1794,6 +1794,9 @@
1794
1794
  "allProjects": {
1795
1795
  "type": "boolean"
1796
1796
  },
1797
+ "events": {
1798
+ "type": "boolean"
1799
+ },
1797
1800
  "historyDir": {
1798
1801
  "type": "string"
1799
1802
  },
@@ -1827,6 +1830,769 @@
1827
1830
  }
1828
1831
  }
1829
1832
  },
1833
+ "history_line": {
1834
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
1835
+ "title": "HistoryLine",
1836
+ "description": "One event-sourced history JSONL line.",
1837
+ "oneOf": [
1838
+ {
1839
+ "allOf": [
1840
+ {
1841
+ "description": "One normalized action observed during a run.",
1842
+ "type": "object",
1843
+ "properties": {
1844
+ "event": {
1845
+ "$ref": "#/$defs/ActionEvent"
1846
+ },
1847
+ "harness": {
1848
+ "type": "string"
1849
+ },
1850
+ "run_id": {
1851
+ "type": "string",
1852
+ "maxLength": 36,
1853
+ "minLength": 36,
1854
+ "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
1855
+ },
1856
+ "schema_version": {
1857
+ "type": "string",
1858
+ "const": "1.0"
1859
+ },
1860
+ "type": {
1861
+ "type": "string",
1862
+ "const": "event"
1863
+ }
1864
+ },
1865
+ "required": [
1866
+ "schema_version",
1867
+ "run_id",
1868
+ "harness",
1869
+ "event",
1870
+ "type"
1871
+ ]
1872
+ }
1873
+ ]
1874
+ },
1875
+ {
1876
+ "allOf": [
1877
+ {
1878
+ "oneOf": [
1879
+ {
1880
+ "allOf": [
1881
+ {
1882
+ "description": "The terminal summary for one harness run.",
1883
+ "type": "object",
1884
+ "properties": {
1885
+ "duration_ms": {
1886
+ "type": "integer",
1887
+ "minimum": 0
1888
+ },
1889
+ "exit_code": {
1890
+ "type": [
1891
+ "integer",
1892
+ "null"
1893
+ ],
1894
+ "format": "int32"
1895
+ },
1896
+ "failure_kind": {
1897
+ "anyOf": [
1898
+ {
1899
+ "$ref": "#/$defs/FailureKind"
1900
+ },
1901
+ {
1902
+ "type": "null"
1903
+ }
1904
+ ]
1905
+ },
1906
+ "finished_at": {
1907
+ "type": "string"
1908
+ },
1909
+ "harness": {
1910
+ "type": "string"
1911
+ },
1912
+ "history_id": {
1913
+ "type": "string",
1914
+ "maxLength": 36,
1915
+ "minLength": 36,
1916
+ "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
1917
+ },
1918
+ "labels": {
1919
+ "$ref": "#/$defs/HistoryLabels"
1920
+ },
1921
+ "model": {
1922
+ "type": [
1923
+ "string",
1924
+ "null"
1925
+ ]
1926
+ },
1927
+ "model_ms": {
1928
+ "type": "integer",
1929
+ "minimum": 0
1930
+ },
1931
+ "name": {
1932
+ "type": "string"
1933
+ },
1934
+ "permission_mode": {
1935
+ "$ref": "#/$defs/PermissionMode"
1936
+ },
1937
+ "project": {
1938
+ "type": "string"
1939
+ },
1940
+ "prompt": {
1941
+ "type": "string"
1942
+ },
1943
+ "schema_version": {
1944
+ "type": "string",
1945
+ "const": "1.0"
1946
+ },
1947
+ "session": {
1948
+ "type": "string"
1949
+ },
1950
+ "session_id": {
1951
+ "type": [
1952
+ "string",
1953
+ "null"
1954
+ ]
1955
+ },
1956
+ "started_at": {
1957
+ "type": "string",
1958
+ "minLength": 1
1959
+ },
1960
+ "status": {
1961
+ "type": "string",
1962
+ "enum": [
1963
+ "ok",
1964
+ "nonzero"
1965
+ ]
1966
+ },
1967
+ "text": {
1968
+ "type": [
1969
+ "string",
1970
+ "null"
1971
+ ]
1972
+ },
1973
+ "text_source": {
1974
+ "type": [
1975
+ "string",
1976
+ "null"
1977
+ ]
1978
+ },
1979
+ "time_to_first_token_ms": {
1980
+ "type": [
1981
+ "integer",
1982
+ "null"
1983
+ ],
1984
+ "format": "uint128",
1985
+ "minimum": 0
1986
+ },
1987
+ "timestamp": {
1988
+ "type": "string"
1989
+ },
1990
+ "tool_ms": {
1991
+ "type": "integer",
1992
+ "minimum": 0
1993
+ },
1994
+ "type": {
1995
+ "type": "string",
1996
+ "const": "run"
1997
+ },
1998
+ "usage": {
1999
+ "$ref": "#/$defs/Usage"
2000
+ }
2001
+ },
2002
+ "required": [
2003
+ "schema_version",
2004
+ "history_id",
2005
+ "session",
2006
+ "name",
2007
+ "project",
2008
+ "timestamp",
2009
+ "harness",
2010
+ "model",
2011
+ "prompt",
2012
+ "permission_mode",
2013
+ "status",
2014
+ "exit_code",
2015
+ "duration_ms",
2016
+ "finished_at",
2017
+ "text",
2018
+ "text_source",
2019
+ "usage",
2020
+ "session_id",
2021
+ "failure_kind",
2022
+ "type",
2023
+ "started_at",
2024
+ "model_ms",
2025
+ "tool_ms"
2026
+ ]
2027
+ }
2028
+ ]
2029
+ },
2030
+ {
2031
+ "allOf": [
2032
+ {
2033
+ "description": "The terminal summary for one harness run.",
2034
+ "type": "object",
2035
+ "properties": {
2036
+ "duration_ms": {
2037
+ "type": "integer",
2038
+ "minimum": 0
2039
+ },
2040
+ "exit_code": {
2041
+ "type": [
2042
+ "integer",
2043
+ "null"
2044
+ ],
2045
+ "format": "int32"
2046
+ },
2047
+ "failure_kind": {
2048
+ "anyOf": [
2049
+ {
2050
+ "$ref": "#/$defs/FailureKind"
2051
+ },
2052
+ {
2053
+ "type": "null"
2054
+ }
2055
+ ]
2056
+ },
2057
+ "finished_at": {
2058
+ "type": [
2059
+ "string",
2060
+ "null"
2061
+ ]
2062
+ },
2063
+ "harness": {
2064
+ "type": "string"
2065
+ },
2066
+ "history_id": {
2067
+ "type": "string",
2068
+ "maxLength": 36,
2069
+ "minLength": 36,
2070
+ "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
2071
+ },
2072
+ "labels": {
2073
+ "$ref": "#/$defs/HistoryLabels"
2074
+ },
2075
+ "model": {
2076
+ "type": [
2077
+ "string",
2078
+ "null"
2079
+ ]
2080
+ },
2081
+ "model_ms": {
2082
+ "type": "integer",
2083
+ "minimum": 0
2084
+ },
2085
+ "name": {
2086
+ "type": "string"
2087
+ },
2088
+ "permission_mode": {
2089
+ "$ref": "#/$defs/PermissionMode"
2090
+ },
2091
+ "project": {
2092
+ "type": "string"
2093
+ },
2094
+ "prompt": {
2095
+ "type": "string"
2096
+ },
2097
+ "schema_version": {
2098
+ "type": "string",
2099
+ "const": "1.0"
2100
+ },
2101
+ "session": {
2102
+ "type": "string"
2103
+ },
2104
+ "session_id": {
2105
+ "type": [
2106
+ "string",
2107
+ "null"
2108
+ ]
2109
+ },
2110
+ "started_at": {
2111
+ "type": "string",
2112
+ "minLength": 1
2113
+ },
2114
+ "status": {
2115
+ "type": "string",
2116
+ "enum": [
2117
+ "timeout",
2118
+ "spawn_error",
2119
+ "skipped",
2120
+ "planned"
2121
+ ]
2122
+ },
2123
+ "text": {
2124
+ "type": [
2125
+ "string",
2126
+ "null"
2127
+ ]
2128
+ },
2129
+ "text_source": {
2130
+ "type": [
2131
+ "string",
2132
+ "null"
2133
+ ]
2134
+ },
2135
+ "time_to_first_token_ms": {
2136
+ "type": [
2137
+ "integer",
2138
+ "null"
2139
+ ],
2140
+ "format": "uint128",
2141
+ "minimum": 0
2142
+ },
2143
+ "timestamp": {
2144
+ "type": "string"
2145
+ },
2146
+ "tool_ms": {
2147
+ "type": "integer",
2148
+ "minimum": 0
2149
+ },
2150
+ "type": {
2151
+ "type": "string",
2152
+ "const": "run"
2153
+ },
2154
+ "usage": {
2155
+ "$ref": "#/$defs/Usage"
2156
+ }
2157
+ },
2158
+ "required": [
2159
+ "schema_version",
2160
+ "history_id",
2161
+ "session",
2162
+ "name",
2163
+ "project",
2164
+ "timestamp",
2165
+ "harness",
2166
+ "model",
2167
+ "prompt",
2168
+ "permission_mode",
2169
+ "status",
2170
+ "exit_code",
2171
+ "duration_ms",
2172
+ "finished_at",
2173
+ "text",
2174
+ "text_source",
2175
+ "usage",
2176
+ "session_id",
2177
+ "failure_kind",
2178
+ "type",
2179
+ "started_at",
2180
+ "model_ms",
2181
+ "tool_ms"
2182
+ ]
2183
+ }
2184
+ ]
2185
+ },
2186
+ {
2187
+ "allOf": [
2188
+ {
2189
+ "description": "The terminal summary for one harness run.",
2190
+ "type": "object",
2191
+ "properties": {
2192
+ "duration_ms": {
2193
+ "type": [
2194
+ "integer",
2195
+ "null"
2196
+ ],
2197
+ "format": "uint128",
2198
+ "minimum": 0
2199
+ },
2200
+ "exit_code": {
2201
+ "type": [
2202
+ "integer",
2203
+ "null"
2204
+ ],
2205
+ "format": "int32"
2206
+ },
2207
+ "failure_kind": {
2208
+ "anyOf": [
2209
+ {
2210
+ "$ref": "#/$defs/FailureKind"
2211
+ },
2212
+ {
2213
+ "type": "null"
2214
+ }
2215
+ ]
2216
+ },
2217
+ "finished_at": {
2218
+ "type": "null"
2219
+ },
2220
+ "harness": {
2221
+ "type": "string"
2222
+ },
2223
+ "history_id": {
2224
+ "type": "string",
2225
+ "maxLength": 36,
2226
+ "minLength": 36,
2227
+ "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
2228
+ },
2229
+ "labels": {
2230
+ "$ref": "#/$defs/HistoryLabels"
2231
+ },
2232
+ "model": {
2233
+ "type": [
2234
+ "string",
2235
+ "null"
2236
+ ]
2237
+ },
2238
+ "model_ms": false,
2239
+ "name": {
2240
+ "type": "string"
2241
+ },
2242
+ "permission_mode": {
2243
+ "$ref": "#/$defs/PermissionMode"
2244
+ },
2245
+ "project": {
2246
+ "type": "string"
2247
+ },
2248
+ "prompt": {
2249
+ "type": "string"
2250
+ },
2251
+ "schema_version": {
2252
+ "type": "string",
2253
+ "const": "1.0"
2254
+ },
2255
+ "session": {
2256
+ "type": "string"
2257
+ },
2258
+ "session_id": {
2259
+ "type": [
2260
+ "string",
2261
+ "null"
2262
+ ]
2263
+ },
2264
+ "started_at": false,
2265
+ "status": {
2266
+ "$ref": "#/$defs/Status"
2267
+ },
2268
+ "text": {
2269
+ "type": [
2270
+ "string",
2271
+ "null"
2272
+ ]
2273
+ },
2274
+ "text_source": {
2275
+ "type": [
2276
+ "string",
2277
+ "null"
2278
+ ]
2279
+ },
2280
+ "time_to_first_token_ms": false,
2281
+ "timestamp": {
2282
+ "type": "string"
2283
+ },
2284
+ "tool_ms": false,
2285
+ "type": {
2286
+ "type": "string",
2287
+ "const": "run"
2288
+ },
2289
+ "usage": {
2290
+ "$ref": "#/$defs/Usage"
2291
+ }
2292
+ },
2293
+ "required": [
2294
+ "schema_version",
2295
+ "history_id",
2296
+ "session",
2297
+ "name",
2298
+ "project",
2299
+ "timestamp",
2300
+ "harness",
2301
+ "model",
2302
+ "prompt",
2303
+ "permission_mode",
2304
+ "status",
2305
+ "exit_code",
2306
+ "duration_ms",
2307
+ "finished_at",
2308
+ "text",
2309
+ "text_source",
2310
+ "usage",
2311
+ "session_id",
2312
+ "failure_kind",
2313
+ "type"
2314
+ ]
2315
+ }
2316
+ ]
2317
+ }
2318
+ ]
2319
+ }
2320
+ ]
2321
+ }
2322
+ ],
2323
+ "$defs": {
2324
+ "ActionEvent": {
2325
+ "description": "One normalized action a harness took, harness-agnostic so a single consumer\nassertion works across harnesses. Every field is always serialized (null when\nabsent) so the shape is stable, mirroring the `usage` contract.",
2326
+ "type": "object",
2327
+ "properties": {
2328
+ "duration_ms": {
2329
+ "description": "Monotonic elapsed tool time. `None` means no terminal boundary was seen.",
2330
+ "type": [
2331
+ "integer",
2332
+ "null"
2333
+ ],
2334
+ "format": "uint128",
2335
+ "minimum": 0
2336
+ },
2337
+ "finished_at": {
2338
+ "type": [
2339
+ "string",
2340
+ "null"
2341
+ ]
2342
+ },
2343
+ "index": {
2344
+ "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).",
2345
+ "type": "integer",
2346
+ "format": "uint",
2347
+ "minimum": 0
2348
+ },
2349
+ "input": {
2350
+ "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`)."
2351
+ },
2352
+ "kind": {
2353
+ "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.",
2354
+ "type": "string"
2355
+ },
2356
+ "name": {
2357
+ "description": "Normalized tool name where knowable (e.g. `bash`, `Edit`); `null` for a\n`tool_result`, or when the harness did not name the tool.",
2358
+ "type": [
2359
+ "string",
2360
+ "null"
2361
+ ]
2362
+ },
2363
+ "output": {
2364
+ "description": "The result/observation text, when the trace exposes it; `null` otherwise.",
2365
+ "type": [
2366
+ "string",
2367
+ "null"
2368
+ ]
2369
+ },
2370
+ "started_at": {
2371
+ "description": "UTC interval bounds for tool execution, populated on history records.",
2372
+ "type": [
2373
+ "string",
2374
+ "null"
2375
+ ]
2376
+ },
2377
+ "status": {
2378
+ "description": "Terminal tool state, populated on history tool-call events.",
2379
+ "anyOf": [
2380
+ {
2381
+ "$ref": "#/$defs/ToolCallStatus"
2382
+ },
2383
+ {
2384
+ "type": "null"
2385
+ }
2386
+ ]
2387
+ },
2388
+ "tool_call_id": {
2389
+ "description": "Stable call identity within the session. Present on tool calls and their\nmatching results when the provider exposes an identity; history fills a\ndeterministic run-local identity for providers that do not.",
2390
+ "type": [
2391
+ "string",
2392
+ "null"
2393
+ ]
2394
+ }
2395
+ },
2396
+ "required": [
2397
+ "kind",
2398
+ "name",
2399
+ "input",
2400
+ "output",
2401
+ "index",
2402
+ "tool_call_id",
2403
+ "started_at",
2404
+ "finished_at",
2405
+ "duration_ms",
2406
+ "status"
2407
+ ]
2408
+ },
2409
+ "FailureKind": {
2410
+ "description": "The normalized, closed set of failure reasons oneharness can classify from a\nharness's output. It is the single source for the `failure_kind` contract\nvalue: serialized as the snake_case token a consumer reads in the report\n(`auth`, `rate_limit`, `model_not_found`, `quota`, `tool_deferred`), so the\nwire shape is unchanged — modeling it as an enum keeps a misspelled or\ninvalid kind unrepresentable and gives every producer/consumer (classifier,\n`is_failure`, the fallback fall-through rule, the report, history) one\ndefinition to share instead of scattered string literals.",
2411
+ "oneOf": [
2412
+ {
2413
+ "description": "Authentication / authorization rejected the request (401/403, missing or\ninvalid credentials).",
2414
+ "type": "string",
2415
+ "const": "auth"
2416
+ },
2417
+ {
2418
+ "description": "Rate limited (429, too many requests) — a transient condition of an\notherwise working, authenticated harness.",
2419
+ "type": "string",
2420
+ "const": "rate_limit"
2421
+ },
2422
+ {
2423
+ "description": "The requested model was not found / is invalid — a configuration mistake.",
2424
+ "type": "string",
2425
+ "const": "model_not_found"
2426
+ },
2427
+ {
2428
+ "description": "Out of quota / credits, or a billing problem — a provisioning failure.",
2429
+ "type": "string",
2430
+ "const": "quota"
2431
+ },
2432
+ {
2433
+ "description": "The harness deferred a builtin tool call instead of executing it, so a\nclean-exit run did no useful work (Claude Code bridge deployments; issue\n#1114). The only kind that can appear on a `status: ok` run.",
2434
+ "type": "string",
2435
+ "const": "tool_deferred"
2436
+ }
2437
+ ]
2438
+ },
2439
+ "HistoryLabels": {
2440
+ "type": "object",
2441
+ "additionalProperties": {
2442
+ "type": "string",
2443
+ "maxLength": 256,
2444
+ "minLength": 1,
2445
+ "not": {
2446
+ "pattern": "[\\u0000-\\u001f\\u007f-\\u009f]"
2447
+ }
2448
+ },
2449
+ "propertyNames": {
2450
+ "type": "string",
2451
+ "maxLength": 64,
2452
+ "not": {
2453
+ "pattern": "[^A-Za-z0-9._-]"
2454
+ },
2455
+ "pattern": "^[A-Za-z0-9]"
2456
+ }
2457
+ },
2458
+ "PermissionMode": {
2459
+ "description": "The unified approval mode, from least to most autonomy. A harness may not\nsupport every value (see [`crate::domain::harness::HarnessSpec::mode`]); the\ncommand layer refuses an unsupported one before spawning, never silently\ndowngrading it.",
2460
+ "oneOf": [
2461
+ {
2462
+ "description": "No mutations — the agent may read but not edit files or run commands —\n*without* the plan workflow: it just does whatever read-only work the task\nallows. Mapped to each harness's strongest per-run no-mutation enforcement\n(Codex's read-only sandbox, Claude's deny rules, Copilot's `--deny-tool`,\nCursor's `ask` mode). The enforced counterpart to [`Self::Plan`].",
2463
+ "type": "string",
2464
+ "const": "read-only"
2465
+ },
2466
+ {
2467
+ "description": "Read and propose only — like [`Self::ReadOnly`], but additionally engages\nthe harness's *plan* workflow: research the task and write a plan rather\nthan act. Supported only where a native plan mode exists (Claude/Qwen/\nCursor/Copilot, OpenCode's `plan` agent); harnesses with no plan workflow\n(Codex, Goose, Crush) reject it — use [`Self::ReadOnly`] for those.",
2468
+ "type": "string",
2469
+ "const": "plan"
2470
+ },
2471
+ {
2472
+ "description": "The harness's normal ask flow, mapped to its cleanest *non-interactive*\nvariant so a headless run never blocks waiting for input (Claude's\n`dontAsk` deny-and-continue, Goose's fail-closed `approve`, Copilot's\nauto-deny). Where no such variant exists the harness's [`ModeHeadless`]\nis [`ModeHeadless::Hangs`].",
2473
+ "type": "string",
2474
+ "const": "default"
2475
+ },
2476
+ {
2477
+ "description": "Auto-approve file edits, still gate shell/commands. (Claude's\n`acceptEdits`, Qwen's `auto-edit`.)",
2478
+ "type": "string",
2479
+ "const": "edit"
2480
+ },
2481
+ {
2482
+ "description": "Auto-approve operations the harness deems safe (a classifier), gate the\nrisky ones. (Claude's `auto`, Qwen's `auto`, Goose's `smart_approve`.)",
2483
+ "type": "string",
2484
+ "const": "auto"
2485
+ },
2486
+ {
2487
+ "description": "Approve everything — no prompts, no gating. The headless default, because\nan unattended agent otherwise hangs on the first approval. Every harness\nsupports it. (Claude's `bypassPermissions`, Codex's\n`--dangerously-bypass-approvals-and-sandbox`, Qwen/Crush `--yolo`, …)",
2488
+ "type": "string",
2489
+ "const": "bypass"
2490
+ }
2491
+ ]
2492
+ },
2493
+ "Status": {
2494
+ "description": "The outcome of attempting to run one harness.",
2495
+ "oneOf": [
2496
+ {
2497
+ "description": "Spawned and exited 0.",
2498
+ "type": "string",
2499
+ "const": "ok"
2500
+ },
2501
+ {
2502
+ "description": "Spawned and exited non-zero.",
2503
+ "type": "string",
2504
+ "const": "nonzero"
2505
+ },
2506
+ {
2507
+ "description": "Killed after exceeding the per-harness timeout.",
2508
+ "type": "string",
2509
+ "const": "timeout"
2510
+ },
2511
+ {
2512
+ "description": "The binary was resolved but could not be executed.",
2513
+ "type": "string",
2514
+ "const": "spawn-error"
2515
+ },
2516
+ {
2517
+ "description": "The binary was not found, so the harness was not run.",
2518
+ "type": "string",
2519
+ "const": "skipped"
2520
+ },
2521
+ {
2522
+ "description": "`--print-command`: the command was built but not executed.",
2523
+ "type": "string",
2524
+ "const": "planned"
2525
+ }
2526
+ ]
2527
+ },
2528
+ "ToolCallStatus": {
2529
+ "type": "string",
2530
+ "enum": [
2531
+ "completed",
2532
+ "failed",
2533
+ "timeout",
2534
+ "interrupted"
2535
+ ]
2536
+ },
2537
+ "Usage": {
2538
+ "description": "Normalized token/cost accounting. Every field is best-effort and independently\nnullable: a harness may report tokens but not dollar cost (cost is commonly\nabsent on subscription auth), or report nothing at all (plain-text harnesses).",
2539
+ "type": "object",
2540
+ "properties": {
2541
+ "cache_read_tokens": {
2542
+ "description": "Prompt tokens served from the provider's prompt cache (a cheap read of a\npreviously-written prefix), when the harness reports them. `None` when the\nharness does not surface cache counts — never `0` as a guess.",
2543
+ "type": [
2544
+ "integer",
2545
+ "null"
2546
+ ],
2547
+ "format": "uint64",
2548
+ "minimum": 0
2549
+ },
2550
+ "cache_write_tokens": {
2551
+ "description": "Prompt tokens written to the provider's prompt cache (a.k.a. cache\ncreation), when the harness reports them. `None` when not surfaced.",
2552
+ "type": [
2553
+ "integer",
2554
+ "null"
2555
+ ],
2556
+ "format": "uint64",
2557
+ "minimum": 0
2558
+ },
2559
+ "cost_usd": {
2560
+ "description": "Total cost in USD, when the harness reports it (often absent on\nsubscription auth, where there is no per-call dollar figure).",
2561
+ "type": [
2562
+ "number",
2563
+ "null"
2564
+ ],
2565
+ "format": "double"
2566
+ },
2567
+ "input_tokens": {
2568
+ "description": "Prompt/input tokens billed, when the harness reports them.",
2569
+ "type": [
2570
+ "integer",
2571
+ "null"
2572
+ ],
2573
+ "format": "uint64",
2574
+ "minimum": 0
2575
+ },
2576
+ "output_tokens": {
2577
+ "description": "Completion/output tokens billed, when the harness reports them.",
2578
+ "type": [
2579
+ "integer",
2580
+ "null"
2581
+ ],
2582
+ "format": "uint64",
2583
+ "minimum": 0
2584
+ }
2585
+ },
2586
+ "required": [
2587
+ "input_tokens",
2588
+ "output_tokens",
2589
+ "cache_read_tokens",
2590
+ "cache_write_tokens",
2591
+ "cost_usd"
2592
+ ]
2593
+ }
2594
+ }
2595
+ },
1830
2596
  "history_record": {
1831
2597
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1832
2598
  "title": "HistoryRecord",
@@ -2084,7 +2850,7 @@
2084
2850
  },
2085
2851
  "schema_version": {
2086
2852
  "type": "string",
2087
- "const": "0.3"
2853
+ "const": "1.0"
2088
2854
  },
2089
2855
  "session": {
2090
2856
  "description": "The oneharness session id this run belongs to (the history file's stem).",
@@ -2295,7 +3061,7 @@
2295
3061
  },
2296
3062
  "schema_version": {
2297
3063
  "type": "string",
2298
- "const": "0.3"
3064
+ "const": "1.0"
2299
3065
  },
2300
3066
  "session": {
2301
3067
  "description": "The oneharness session id this run belongs to (the history file's stem).",
@@ -2863,6 +3629,40 @@
2863
3629
  "type",
2864
3630
  "record"
2865
3631
  ]
3632
+ },
3633
+ {
3634
+ "description": "A normalized action event observed before its run closes.",
3635
+ "type": "object",
3636
+ "properties": {
3637
+ "line": {
3638
+ "$ref": "#/$defs/HistoryEventLine"
3639
+ },
3640
+ "type": {
3641
+ "type": "string",
3642
+ "const": "event"
3643
+ }
3644
+ },
3645
+ "required": [
3646
+ "type",
3647
+ "line"
3648
+ ]
3649
+ },
3650
+ {
3651
+ "description": "A normalized action event observed before its run closes.",
3652
+ "type": "object",
3653
+ "properties": {
3654
+ "line": {
3655
+ "$ref": "#/$defs/HistoryEventLine"
3656
+ },
3657
+ "type": {
3658
+ "type": "string",
3659
+ "const": "event"
3660
+ }
3661
+ },
3662
+ "required": [
3663
+ "type",
3664
+ "line"
3665
+ ]
2866
3666
  }
2867
3667
  ],
2868
3668
  "$defs": {
@@ -2981,6 +3781,33 @@
2981
3781
  }
2982
3782
  ]
2983
3783
  },
3784
+ "HistoryEventLine": {
3785
+ "description": "One normalized action observed during a run.",
3786
+ "type": "object",
3787
+ "properties": {
3788
+ "event": {
3789
+ "$ref": "#/$defs/ActionEvent"
3790
+ },
3791
+ "harness": {
3792
+ "type": "string"
3793
+ },
3794
+ "run_id": {
3795
+ "type": "string",
3796
+ "maxLength": 36,
3797
+ "minLength": 36,
3798
+ "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
3799
+ },
3800
+ "schema_version": {
3801
+ "type": "string"
3802
+ }
3803
+ },
3804
+ "required": [
3805
+ "schema_version",
3806
+ "run_id",
3807
+ "harness",
3808
+ "event"
3809
+ ]
3810
+ },
2984
3811
  "HistoryLabels": {
2985
3812
  "type": "object",
2986
3813
  "additionalProperties": {
@@ -3255,7 +4082,7 @@
3255
4082
  },
3256
4083
  "schema_version": {
3257
4084
  "type": "string",
3258
- "const": "0.3"
4085
+ "const": "1.0"
3259
4086
  },
3260
4087
  "session": {
3261
4088
  "description": "The oneharness session id this run belongs to (the history file's stem).",
@@ -3466,7 +4293,7 @@
3466
4293
  },
3467
4294
  "schema_version": {
3468
4295
  "type": "string",
3469
- "const": "0.3"
4296
+ "const": "1.0"
3470
4297
  },
3471
4298
  "session": {
3472
4299
  "description": "The oneharness session id this run belongs to (the history file's stem).",
@@ -4276,7 +5103,7 @@
4276
5103
  },
4277
5104
  "schema_version": {
4278
5105
  "type": "string",
4279
- "const": "0.3"
5106
+ "const": "1.0"
4280
5107
  },
4281
5108
  "session": {
4282
5109
  "description": "The oneharness session id this run belongs to (the history file's stem).",
@@ -4487,7 +5314,7 @@
4487
5314
  },
4488
5315
  "schema_version": {
4489
5316
  "type": "string",
4490
- "const": "0.3"
5317
+ "const": "1.0"
4491
5318
  },
4492
5319
  "session": {
4493
5320
  "description": "The oneharness session id this run belongs to (the history file's stem).",