ai-hist-native 0.19.0 → 0.21.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.
package/index.d.ts CHANGED
@@ -71,6 +71,35 @@ export interface NativeSessionEvent {
71
71
  model?: string
72
72
  tokenJson?: string
73
73
  eventUid: string
74
+ /**
75
+ * Per-tool-result fidelity. Null on every row that is not a tool result,
76
+ * and on a tool-result row whose provider does not record the fact.
77
+ */
78
+ toolUseId?: string
79
+ /** Raw UTF-8 byte length of the provider's result payload. */
80
+ payloadBytes?: number
81
+ /** True when the harness had already truncated the payload. */
82
+ payloadTruncated?: boolean
83
+ /** First 16 hex characters of the payload's sha256. */
84
+ payloadHash?: string
85
+ /** n-th result recorded for this `toolUseId`, from zero. */
86
+ callIndex?: number
87
+ /** Position of this result in the transcript's tool-result order. */
88
+ eventIndex?: number
89
+ /** `running` / `completed` / `errored` / `cancelled` / `unknown`. */
90
+ resultStatus?: string
91
+ /** `tool_result` / `subagent_notification` / `function_call_output`. */
92
+ eventSource?: string
93
+ /** Which provider signal set the error. */
94
+ errorSignal?: string
95
+ subagentSessionId?: string
96
+ agentId?: string
97
+ requestId?: string
98
+ stopReason?: string
99
+ agentVersion?: string
100
+ isSidechain?: boolean
101
+ isMeta?: boolean
102
+ turnId?: string
74
103
  }
75
104
  export interface EventCursor {
76
105
  tsMs: number
@@ -136,6 +165,49 @@ export interface EvidencePageOptions {
136
165
  limit?: number
137
166
  after?: EvidenceCursor
138
167
  }
168
+ export interface NativeSessionUserTurnBlock {
169
+ /** `text` or `tool_result`. */
170
+ kind: string
171
+ toolUseId?: string
172
+ /**
173
+ * Measured payload bytes when the parser recorded them, otherwise the
174
+ * UTF-8 length of the stored text.
175
+ */
176
+ byteLen: number
177
+ /**
178
+ * True when the result is known to have failed, false when it is known
179
+ * to have succeeded, null when the provider has not said.
180
+ */
181
+ isError?: boolean
182
+ }
183
+ export interface NativeSessionUserTurn {
184
+ id: number
185
+ source: string
186
+ sessionId: string
187
+ messageId?: string
188
+ /**
189
+ * The nearest messages recorded either side of this turn, from either
190
+ * side of the conversation. Null only when the session recorded no named
191
+ * message on that side; an event the provider left unnamed is passed
192
+ * over rather than nulling the field.
193
+ */
194
+ precedingMessageId?: string
195
+ followingMessageId?: string
196
+ tsMs: number
197
+ blocks: Array<NativeSessionUserTurnBlock>
198
+ }
199
+ export interface UserTurnsPageOptions {
200
+ dbPath?: string
201
+ limit?: number
202
+ after?: EventCursor
203
+ }
204
+ export interface SessionUserTurnsPage {
205
+ contractVersion: number
206
+ source: string
207
+ sessionId: string
208
+ userTurns: Array<NativeSessionUserTurn>
209
+ nextCursor?: EventCursor
210
+ }
139
211
  export interface SessionToolCallsPage {
140
212
  contractVersion: number
141
213
  source: string
@@ -197,6 +269,15 @@ export declare function getSessionEventsPage(sessionId: string, options?: Events
197
269
  * globally unique, so an id-only lookup could interleave two sessions.
198
270
  */
199
271
  export declare function getSessionToolCallsPage(source: string, sessionId: string, options?: EvidencePageOptions | undefined | null): Promise<SessionToolCallsPage>
272
+ /**
273
+ * One bounded page of user turns for one session, oldest first.
274
+ *
275
+ * Each turn carries the ordered blocks the provider attached to one user
276
+ * message: the human's own text and the tool results that came back with it,
277
+ * with the measured payload size of each. Computed from `session_events`
278
+ * rather than a table of its own, so it cannot disagree with the transcript.
279
+ */
280
+ export declare function getSessionUserTurnsPage(source: string, sessionId: string, options?: UserTurnsPageOptions | undefined | null): Promise<SessionUserTurnsPage>
200
281
  /** One bounded page of recorded file edits for one session. */
201
282
  export declare function getSessionFileEditsPage(source: string, sessionId: string, options?: EvidencePageOptions | undefined | null): Promise<SessionFileEditsPage>
202
283
  /** Database statistics over already-indexed data. */
@@ -339,6 +420,12 @@ export interface HydrateSessionResult {
339
420
  presence: string
340
421
  indexedThrough: HydrationIndexedThrough
341
422
  evidence: HydrationEvidence
423
+ /**
424
+ * Evidence kinds this hydration can have indexed, as wire names
425
+ * (`history`, `session_event`, `tool_call`, `file_edit`,
426
+ * `relationship`, `commit_link`).
427
+ */
428
+ coverage: Array<string>
342
429
  relatedSessionIds: Array<string>
343
430
  diagnostics: Array<HydrationDiagnostic>
344
431
  }
@@ -361,6 +448,7 @@ export interface NativeSessionRelationship {
361
448
  spawnedAtMs?: number
362
449
  createdMs: number
363
450
  relationshipUid: string
451
+ originSessionId?: string
364
452
  }
365
453
  export interface NativeRelationshipCapabilities {
366
454
  source: string
@@ -380,6 +468,7 @@ export interface NativeSessionRelationships {
380
468
  sessionId: string
381
469
  asParent: Array<NativeSessionRelationship>
382
470
  asChild: Array<NativeSessionRelationship>
471
+ continuity: Array<NativeSessionRelationship>
383
472
  capabilities: NativeRelationshipCapabilities
384
473
  diagnostics: Array<NativeRelationshipDiagnostic>
385
474
  }
@@ -423,6 +512,11 @@ export interface SessionTreeOptions {
423
512
  dbPath?: string
424
513
  maxDepth?: number
425
514
  maxNodes?: number
515
+ /**
516
+ * Which edges the walk follows. Omitted means delegation only, which is
517
+ * what every caller got before continuity existed.
518
+ */
519
+ relationshipKinds?: Array<string>
426
520
  }
427
521
  export interface SessionChildrenPageOptions {
428
522
  source: string
@@ -430,6 +524,7 @@ export interface SessionChildrenPageOptions {
430
524
  dbPath?: string
431
525
  limit?: number
432
526
  after?: RelationshipCursor
527
+ relationshipKinds?: Array<string>
433
528
  }
434
529
  /**
435
530
  * Direct delegation relationships for one session, in both directions.
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { historyDelivery, historyDeliveryDrain, getSourceObservation, applySourceObservations, applySourceEvidence, nativeContractVersion, nativeBuildProfile, search, recent, getSession, getSessionEventsPage, getSessionToolCallsPage, getSessionFileEditsPage, stats, listSessionCatalogPage, listSessionCatalog, discoverSessions, hydrateSession, getSessionRelationships, getSessionTree, getSessionChildrenPage, sync, syncLocal, installGitHooks, linkGitCommit } = nativeBinding
313
+ const { historyDelivery, historyDeliveryDrain, getSourceObservation, applySourceObservations, applySourceEvidence, nativeContractVersion, nativeBuildProfile, search, recent, getSession, getSessionEventsPage, getSessionToolCallsPage, getSessionUserTurnsPage, getSessionFileEditsPage, stats, listSessionCatalogPage, listSessionCatalog, discoverSessions, hydrateSession, getSessionRelationships, getSessionTree, getSessionChildrenPage, sync, syncLocal, installGitHooks, linkGitCommit } = nativeBinding
314
314
 
315
315
  module.exports.historyDelivery = historyDelivery
316
316
  module.exports.historyDeliveryDrain = historyDeliveryDrain
@@ -324,6 +324,7 @@ module.exports.recent = recent
324
324
  module.exports.getSession = getSession
325
325
  module.exports.getSessionEventsPage = getSessionEventsPage
326
326
  module.exports.getSessionToolCallsPage = getSessionToolCallsPage
327
+ module.exports.getSessionUserTurnsPage = getSessionUserTurnsPage
327
328
  module.exports.getSessionFileEditsPage = getSessionFileEditsPage
328
329
  module.exports.stats = stats
329
330
  module.exports.listSessionCatalogPage = listSessionCatalogPage
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native-darwin-arm64",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "os": [
5
5
  "darwin"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native-darwin-x64",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "os": [
5
5
  "darwin"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native-linux-arm64-gnu",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "os": [
5
5
  "linux"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native-linux-arm64-musl",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "os": [
5
5
  "linux"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native-linux-x64-gnu",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "os": [
5
5
  "linux"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native-linux-x64-musl",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "os": [
5
5
  "linux"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native-win32-x64-msvc",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "os": [
5
5
  "win32"
6
6
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "Mandatory Node-API engine for RelayHistory.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -44,12 +44,12 @@
44
44
  "@napi-rs/cli": "^2.18.4"
45
45
  },
46
46
  "optionalDependencies": {
47
- "ai-hist-native-darwin-arm64": "0.19.0",
48
- "ai-hist-native-darwin-x64": "0.19.0",
49
- "ai-hist-native-linux-x64-gnu": "0.19.0",
50
- "ai-hist-native-linux-arm64-gnu": "0.19.0",
51
- "ai-hist-native-linux-x64-musl": "0.19.0",
52
- "ai-hist-native-linux-arm64-musl": "0.19.0",
53
- "ai-hist-native-win32-x64-msvc": "0.19.0"
47
+ "ai-hist-native-darwin-arm64": "0.21.0",
48
+ "ai-hist-native-darwin-x64": "0.21.0",
49
+ "ai-hist-native-linux-x64-gnu": "0.21.0",
50
+ "ai-hist-native-linux-arm64-gnu": "0.21.0",
51
+ "ai-hist-native-linux-x64-musl": "0.21.0",
52
+ "ai-hist-native-linux-arm64-musl": "0.21.0",
53
+ "ai-hist-native-win32-x64-msvc": "0.21.0"
54
54
  }
55
55
  }