ai-hist-native 0.11.0 → 0.13.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
@@ -74,6 +74,70 @@ export interface SessionEventsPage {
74
74
  events: Array<NativeSessionEvent>
75
75
  nextCursor?: EventCursor
76
76
  }
77
+ export interface NativeSessionToolCall {
78
+ id: number
79
+ source: string
80
+ sessionId: string
81
+ messageId?: string
82
+ toolUseId: string
83
+ name: string
84
+ target?: string
85
+ /**
86
+ * Stored provider arguments, unparsed. The SDK owns JSON parsing so an
87
+ * unreadable value cannot fail a whole page at the boundary.
88
+ */
89
+ argsJson?: string
90
+ isError?: boolean
91
+ tsMs?: number
92
+ }
93
+ export interface NativeSessionFileEdit {
94
+ id: number
95
+ source: string
96
+ sessionId: string
97
+ messageId?: string
98
+ toolUseId: string
99
+ filePath: string
100
+ toolName?: string
101
+ linesAdded?: number
102
+ linesRemoved?: number
103
+ /** Stored provider patch, unparsed, for the same reason as `args_json`. */
104
+ structuredPatchJson?: string
105
+ userModified?: boolean
106
+ tsMs?: number
107
+ gitBranch?: string
108
+ cwd?: string
109
+ }
110
+ /**
111
+ * Continuation for tool call and file edit pages. `tsMs` is optional because
112
+ * both tables order their undated rows last.
113
+ *
114
+ * Absent-or-`undefined` is how a caller says "inside the undated tail": an
115
+ * explicit JavaScript `null` cannot be converted to `i64` and fails at the
116
+ * boundary, so the SDK normalizes `null` to `undefined` before calling in.
117
+ */
118
+ export interface EvidenceCursor {
119
+ tsMs?: number
120
+ id: number
121
+ }
122
+ export interface EvidencePageOptions {
123
+ dbPath?: string
124
+ limit?: number
125
+ after?: EvidenceCursor
126
+ }
127
+ export interface SessionToolCallsPage {
128
+ contractVersion: number
129
+ source: string
130
+ sessionId: string
131
+ toolCalls: Array<NativeSessionToolCall>
132
+ nextCursor?: EvidenceCursor
133
+ }
134
+ export interface SessionFileEditsPage {
135
+ contractVersion: number
136
+ source: string
137
+ sessionId: string
138
+ fileEdits: Array<NativeSessionFileEdit>
139
+ nextCursor?: EvidenceCursor
140
+ }
77
141
  export interface SourceCount {
78
142
  source: string
79
143
  count: number
@@ -103,6 +167,15 @@ export declare function recent(options?: HistoryQueryOptions | undefined | null)
103
167
  export declare function getSession(sessionId: string, options?: SessionOptions | undefined | null): Promise<Array<NativeHistoryEntry>>
104
168
  /** One bounded page of normalized events for a session. */
105
169
  export declare function getSessionEventsPage(sessionId: string, options?: EventsPageOptions | undefined | null): Promise<SessionEventsPage>
170
+ /**
171
+ * One bounded page of recorded tool calls for one session.
172
+ *
173
+ * Both `source` and `sessionId` are required: provider session ids are not
174
+ * globally unique, so an id-only lookup could interleave two sessions.
175
+ */
176
+ export declare function getSessionToolCallsPage(source: string, sessionId: string, options?: EvidencePageOptions | undefined | null): Promise<SessionToolCallsPage>
177
+ /** One bounded page of recorded file edits for one session. */
178
+ export declare function getSessionFileEditsPage(source: string, sessionId: string, options?: EvidencePageOptions | undefined | null): Promise<SessionFileEditsPage>
106
179
  /** Database statistics over already-indexed data. */
107
180
  export declare function stats(options?: StatsOptions | undefined | null): Promise<NativeStats>
108
181
  export interface CatalogSession {
@@ -173,6 +246,8 @@ export interface DiscoveryCounters {
173
246
  skippedUnchanged: number
174
247
  filesOpened: number
175
248
  bytesRead: number
249
+ providerQueries: number
250
+ recordsInspected: number
176
251
  }
177
252
  export interface SourceExemption {
178
253
  source: string
@@ -207,6 +282,7 @@ export interface HydrationEvidence {
207
282
  prompts: number
208
283
  events: number
209
284
  toolCalls: number
285
+ fileEdits: number
210
286
  relatedSessions: number
211
287
  }
212
288
  export interface HydrationDiagnostic {
@@ -221,6 +297,7 @@ export interface HydrateSessionResult {
221
297
  source: string
222
298
  sessionId: string
223
299
  status: string
300
+ capability: string
224
301
  discoveryState: string
225
302
  presence: string
226
303
  indexedThrough: HydrationIndexedThrough
@@ -230,6 +307,108 @@ export interface HydrateSessionResult {
230
307
  }
231
308
  /** Fully index one cataloged session without enumerating unrelated sessions. */
232
309
  export declare function hydrateSession(options: HydrateSessionOptions): Promise<HydrateSessionResult>
310
+ export interface NativeSessionRelationship {
311
+ source: string
312
+ parentSessionId: string
313
+ childSessionId?: string
314
+ relationship: string
315
+ identityStatus: string
316
+ childAgentType?: string
317
+ childAgentName?: string
318
+ childModel?: string
319
+ spawnDepth?: number
320
+ evidenceKind: string
321
+ evidenceLocator?: string
322
+ evidenceRef?: string
323
+ childHasEvents: boolean
324
+ spawnedAtMs?: number
325
+ createdMs: number
326
+ relationshipUid: string
327
+ }
328
+ export interface NativeRelationshipCapabilities {
329
+ source: string
330
+ stableChildIdentity: string
331
+ recordsAgentType: boolean
332
+ recordsSpawnTime: boolean
333
+ recordsEvidenceLocator: boolean
334
+ }
335
+ export interface NativeRelationshipDiagnostic {
336
+ code: string
337
+ message: string
338
+ relationshipUid?: string
339
+ }
340
+ export interface NativeSessionRelationships {
341
+ contractVersion: number
342
+ source: string
343
+ sessionId: string
344
+ asParent: Array<NativeSessionRelationship>
345
+ asChild: Array<NativeSessionRelationship>
346
+ capabilities: NativeRelationshipCapabilities
347
+ diagnostics: Array<NativeRelationshipDiagnostic>
348
+ }
349
+ export interface NativeSessionTreeNode {
350
+ source: string
351
+ sessionId: string
352
+ depth: number
353
+ parentSessionId?: string
354
+ relationship?: NativeSessionRelationship
355
+ childCount: number
356
+ hasEvents: boolean
357
+ truncated: boolean
358
+ }
359
+ export interface NativeSessionTree {
360
+ contractVersion: number
361
+ source: string
362
+ rootSessionId: string
363
+ nodes: Array<NativeSessionTreeNode>
364
+ unlinked: Array<NativeSessionRelationship>
365
+ capabilities: NativeRelationshipCapabilities
366
+ diagnostics: Array<NativeRelationshipDiagnostic>
367
+ truncated: boolean
368
+ maxDepthReached: number
369
+ }
370
+ export interface RelationshipCursor {
371
+ spawnedAtMs?: number
372
+ relationshipUid: string
373
+ }
374
+ export interface NativeSessionChildrenPage {
375
+ children: Array<NativeSessionRelationship>
376
+ nextCursor?: RelationshipCursor
377
+ }
378
+ export interface RelationshipOptions {
379
+ source: string
380
+ sessionId: string
381
+ dbPath?: string
382
+ }
383
+ export interface SessionTreeOptions {
384
+ source: string
385
+ sessionId: string
386
+ dbPath?: string
387
+ maxDepth?: number
388
+ maxNodes?: number
389
+ }
390
+ export interface SessionChildrenPageOptions {
391
+ source: string
392
+ sessionId: string
393
+ dbPath?: string
394
+ limit?: number
395
+ after?: RelationshipCursor
396
+ }
397
+ /**
398
+ * Direct delegation relationships for one session, in both directions.
399
+ * A missing database is an empty result, not an error.
400
+ */
401
+ export declare function getSessionRelationships(options: RelationshipOptions): Promise<NativeSessionRelationships>
402
+ /**
403
+ * The complete descendant delegation tree for one session: pre-order,
404
+ * cycle-safe, and bounded by `maxDepth` / `maxNodes`.
405
+ */
406
+ export declare function getSessionTree(options: SessionTreeOptions): Promise<NativeSessionTree>
407
+ /**
408
+ * One bounded page of a session's direct children, in the same total order
409
+ * the tree traversal uses.
410
+ */
411
+ export declare function getSessionChildrenPage(options: SessionChildrenPageOptions): Promise<NativeSessionChildrenPage>
233
412
  export interface SyncOptions {
234
413
  dbPath?: string
235
414
  scope?: string
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 { nativeContractVersion, nativeBuildProfile, search, recent, getSession, getSessionEventsPage, stats, listSessionCatalogPage, listSessionCatalog, discoverSessions, hydrateSession, sync, syncLocal, syncAndPush } = nativeBinding
313
+ const { nativeContractVersion, nativeBuildProfile, search, recent, getSession, getSessionEventsPage, getSessionToolCallsPage, getSessionFileEditsPage, stats, listSessionCatalogPage, listSessionCatalog, discoverSessions, hydrateSession, getSessionRelationships, getSessionTree, getSessionChildrenPage, sync, syncLocal, syncAndPush } = nativeBinding
314
314
 
315
315
  module.exports.nativeContractVersion = nativeContractVersion
316
316
  module.exports.nativeBuildProfile = nativeBuildProfile
@@ -318,11 +318,16 @@ module.exports.search = search
318
318
  module.exports.recent = recent
319
319
  module.exports.getSession = getSession
320
320
  module.exports.getSessionEventsPage = getSessionEventsPage
321
+ module.exports.getSessionToolCallsPage = getSessionToolCallsPage
322
+ module.exports.getSessionFileEditsPage = getSessionFileEditsPage
321
323
  module.exports.stats = stats
322
324
  module.exports.listSessionCatalogPage = listSessionCatalogPage
323
325
  module.exports.listSessionCatalog = listSessionCatalog
324
326
  module.exports.discoverSessions = discoverSessions
325
327
  module.exports.hydrateSession = hydrateSession
328
+ module.exports.getSessionRelationships = getSessionRelationships
329
+ module.exports.getSessionTree = getSessionTree
330
+ module.exports.getSessionChildrenPage = getSessionChildrenPage
326
331
  module.exports.sync = sync
327
332
  module.exports.syncLocal = syncLocal
328
333
  module.exports.syncAndPush = syncAndPush
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native-darwin-arm64",
3
- "version": "0.11.0",
3
+ "version": "0.13.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.11.0",
3
+ "version": "0.13.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.11.0",
3
+ "version": "0.13.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.11.0",
3
+ "version": "0.13.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.11.0",
3
+ "version": "0.13.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.11.0",
3
+ "version": "0.13.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.11.0",
3
+ "version": "0.13.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.11.0",
3
+ "version": "0.13.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.11.0",
48
- "ai-hist-native-darwin-x64": "0.11.0",
49
- "ai-hist-native-linux-x64-gnu": "0.11.0",
50
- "ai-hist-native-linux-arm64-gnu": "0.11.0",
51
- "ai-hist-native-linux-x64-musl": "0.11.0",
52
- "ai-hist-native-linux-arm64-musl": "0.11.0",
53
- "ai-hist-native-win32-x64-msvc": "0.11.0"
47
+ "ai-hist-native-darwin-arm64": "0.13.0",
48
+ "ai-hist-native-darwin-x64": "0.13.0",
49
+ "ai-hist-native-linux-x64-gnu": "0.13.0",
50
+ "ai-hist-native-linux-arm64-gnu": "0.13.0",
51
+ "ai-hist-native-linux-x64-musl": "0.13.0",
52
+ "ai-hist-native-linux-arm64-musl": "0.13.0",
53
+ "ai-hist-native-win32-x64-msvc": "0.13.0"
54
54
  }
55
55
  }