ai-hist-native 0.20.0 → 0.21.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.
package/index.d.ts CHANGED
@@ -71,6 +71,29 @@ 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
74
97
  requestId?: string
75
98
  stopReason?: string
76
99
  agentVersion?: string
@@ -142,6 +165,49 @@ export interface EvidencePageOptions {
142
165
  limit?: number
143
166
  after?: EvidenceCursor
144
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
+ }
145
211
  export interface SessionToolCallsPage {
146
212
  contractVersion: number
147
213
  source: string
@@ -203,6 +269,15 @@ export declare function getSessionEventsPage(sessionId: string, options?: Events
203
269
  * globally unique, so an id-only lookup could interleave two sessions.
204
270
  */
205
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>
206
281
  /** One bounded page of recorded file edits for one session. */
207
282
  export declare function getSessionFileEditsPage(source: string, sessionId: string, options?: EvidencePageOptions | undefined | null): Promise<SessionFileEditsPage>
208
283
  /** Database statistics over already-indexed data. */
@@ -373,6 +448,7 @@ export interface NativeSessionRelationship {
373
448
  spawnedAtMs?: number
374
449
  createdMs: number
375
450
  relationshipUid: string
451
+ originSessionId?: string
376
452
  }
377
453
  export interface NativeRelationshipCapabilities {
378
454
  source: string
@@ -392,6 +468,7 @@ export interface NativeSessionRelationships {
392
468
  sessionId: string
393
469
  asParent: Array<NativeSessionRelationship>
394
470
  asChild: Array<NativeSessionRelationship>
471
+ continuity: Array<NativeSessionRelationship>
395
472
  capabilities: NativeRelationshipCapabilities
396
473
  diagnostics: Array<NativeRelationshipDiagnostic>
397
474
  }
@@ -435,6 +512,11 @@ export interface SessionTreeOptions {
435
512
  dbPath?: string
436
513
  maxDepth?: number
437
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>
438
520
  }
439
521
  export interface SessionChildrenPageOptions {
440
522
  source: string
@@ -442,6 +524,7 @@ export interface SessionChildrenPageOptions {
442
524
  dbPath?: string
443
525
  limit?: number
444
526
  after?: RelationshipCursor
527
+ relationshipKinds?: Array<string>
445
528
  }
446
529
  /**
447
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.20.0",
3
+ "version": "0.21.1",
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.20.0",
3
+ "version": "0.21.1",
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.20.0",
3
+ "version": "0.21.1",
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.20.0",
3
+ "version": "0.21.1",
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.20.0",
3
+ "version": "0.21.1",
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.20.0",
3
+ "version": "0.21.1",
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.20.0",
3
+ "version": "0.21.1",
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.20.0",
3
+ "version": "0.21.1",
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.20.0",
48
- "ai-hist-native-darwin-x64": "0.20.0",
49
- "ai-hist-native-linux-x64-gnu": "0.20.0",
50
- "ai-hist-native-linux-arm64-gnu": "0.20.0",
51
- "ai-hist-native-linux-x64-musl": "0.20.0",
52
- "ai-hist-native-linux-arm64-musl": "0.20.0",
53
- "ai-hist-native-win32-x64-msvc": "0.20.0"
47
+ "ai-hist-native-darwin-arm64": "0.21.1",
48
+ "ai-hist-native-darwin-x64": "0.21.1",
49
+ "ai-hist-native-linux-x64-gnu": "0.21.1",
50
+ "ai-hist-native-linux-arm64-gnu": "0.21.1",
51
+ "ai-hist-native-linux-x64-musl": "0.21.1",
52
+ "ai-hist-native-linux-arm64-musl": "0.21.1",
53
+ "ai-hist-native-win32-x64-msvc": "0.21.1"
54
54
  }
55
55
  }