ai-hist-native 0.31.0 → 0.32.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
@@ -9,7 +9,9 @@ export declare function historyExport(requestJson: string, dbPath?: string | und
9
9
  *
10
10
  * `op` names the read (`markers`, `requests`, `usage_summary`, `user_turns`,
11
11
  * `capabilities`) and `args_json` carries `{dbPath?, source, sessionId?,
12
- * limit?, after?}`. The answer is the same camelCase document the matching
12
+ * limit?, after?}`; the change feed's `changes` and `commit_changes` read
13
+ * `{dbPath?, from?, consumer?, kinds?, session?, limit?}` and
14
+ * `{dbPath?, consumer, kinds?, position}` (see `change_feed.rs`). The answer is the same camelCase document the matching
13
15
  * typed function returns. A missing database answers an empty page, never an
14
16
  * error, and never creates the file.
15
17
  */
@@ -24,13 +26,33 @@ export declare function nativeContractVersion(): number
24
26
  * Performance measurements are only meaningful against `release`.
25
27
  */
26
28
  export declare function nativeBuildProfile(): string
29
+ /**
30
+ * Where a newest-first history read stopped: its last row's
31
+ * `(timestampMs, id)` and, for a search match, its `matchSource`.
32
+ */
33
+ export interface NativeHistoryCursor {
34
+ timestampMs: number
35
+ id: number
36
+ /** `history` (the default when absent) or `session_event`. */
37
+ matchSource?: string
38
+ }
27
39
  export interface HistoryQueryOptions {
28
40
  scope?: string
29
41
  dbPath?: string
30
42
  source?: string
31
43
  project?: string
32
44
  tag?: string
45
+ /**
46
+ * Deprecated: exclusive, so it skips rows tied on the boundary
47
+ * timestamp. Page with `after` instead.
48
+ */
33
49
  beforeMs?: number
50
+ /** Inclusive lower timestamp bound. */
51
+ sinceMs?: number
52
+ /** Inclusive upper timestamp bound. */
53
+ untilMs?: number
54
+ /** Continue after this row (the previous page's `nextCursor`). */
55
+ after?: NativeHistoryCursor
34
56
  limit?: number
35
57
  }
36
58
  export interface SearchOptions {
@@ -39,9 +61,31 @@ export interface SearchOptions {
39
61
  source?: string
40
62
  project?: string
41
63
  tag?: string
64
+ /**
65
+ * Deprecated: exclusive, so it skips rows tied on the boundary
66
+ * timestamp. Page with `after` instead.
67
+ */
42
68
  beforeMs?: number
69
+ /** Inclusive lower timestamp bound. */
70
+ sinceMs?: number
71
+ /** Inclusive upper timestamp bound. */
72
+ untilMs?: number
73
+ /** Continue after this match (the previous page's `nextCursor`). */
74
+ after?: NativeHistoryCursor
43
75
  limit?: number
44
76
  rawFts?: boolean
77
+ /** `all` (default), `user`, `assistant` or `prompt` — the CLI's `--role`. */
78
+ role?: string
79
+ }
80
+ export interface NativeSearchPage {
81
+ matches: Array<NativeSearchMatch>
82
+ /** Present only when a further match exists. */
83
+ nextCursor?: NativeHistoryCursor
84
+ }
85
+ export interface NativeHistoryPage {
86
+ entries: Array<NativeHistoryEntry>
87
+ /** Present only when a further entry exists. */
88
+ nextCursor?: NativeHistoryCursor
45
89
  }
46
90
  export interface SessionOptions {
47
91
  dbPath?: string
@@ -57,6 +101,29 @@ export interface NativeHistoryEntry {
57
101
  timestampMs: number
58
102
  locations: Array<string>
59
103
  }
104
+ /**
105
+ * One `search` match. `id` is unique only within `match_source`: a prompt
106
+ * is a `history` row, anything else a `session_event` row.
107
+ */
108
+ export interface NativeSearchMatch {
109
+ id: number
110
+ source: string
111
+ sessionId?: string
112
+ project?: string
113
+ /**
114
+ * The matched text: the prompt for a `history` match, the event text
115
+ * otherwise. Named `prompt` so a match is still a history entry.
116
+ */
117
+ prompt: string
118
+ timestampMs: number
119
+ locations: Array<string>
120
+ /** `history` or `session_event`. */
121
+ matchSource: string
122
+ /** `user` for a `history` match; the event's role otherwise. */
123
+ role: string
124
+ /** `history` for a `history` match; the event's kind otherwise. */
125
+ kind: string
126
+ }
60
127
  export interface NativeSessionEvent {
61
128
  id: number
62
129
  source: string
@@ -364,10 +431,17 @@ export interface StatsOptions {
364
431
  */
365
432
  byCwd?: boolean
366
433
  }
367
- /** Full-text search of indexed history. Never discovers or syncs implicitly. */
368
- export declare function search(query: string, options?: SearchOptions | undefined | null): Promise<Array<NativeHistoryEntry>>
434
+ /**
435
+ * Full-text search of indexed prompts and session events. Never discovers or
436
+ * syncs implicitly. Same contract as `ai-hist search`.
437
+ */
438
+ export declare function search(query: string, options?: SearchOptions | undefined | null): Promise<Array<NativeSearchMatch>>
439
+ /** One page of `search`, newest first, with the cursor to the next page. */
440
+ export declare function searchPage(query: string, options?: SearchOptions | undefined | null): Promise<NativeSearchPage>
369
441
  /** Recent indexed history. Never discovers or syncs implicitly. */
370
442
  export declare function recent(options?: HistoryQueryOptions | undefined | null): Promise<Array<NativeHistoryEntry>>
443
+ /** One page of `recent`, newest first, with the cursor to the next page. */
444
+ export declare function recentPage(options?: HistoryQueryOptions | undefined | null): Promise<NativeHistoryPage>
371
445
  /** Indexed prompts for one session. Event payloads are separately paginated. */
372
446
  export declare function getSession(sessionId: string, options?: SessionOptions | undefined | null): Promise<Array<NativeHistoryEntry>>
373
447
  /** One bounded page of normalized events for a session. */
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 { historyExport, sessionStoreCall, getSourceObservation, applySourceObservations, applySourceEvidence, nativeContractVersion, nativeBuildProfile, search, recent, getSession, getSessionEventsPage, getSessionToolCallsPage, getSessionUserTurnsPage, getSessionFileEditsPage, getSessionRequestsPage, getSessionUsage, stats, listSessionCatalogPage, listSessionCatalog, discoverSessions, hydrateSession, getSessionRelationships, getSessionTree, getSessionChildrenPage, sync, syncLocal, installGitHooks, linkGitCommit } = nativeBinding
313
+ const { historyExport, sessionStoreCall, getSourceObservation, applySourceObservations, applySourceEvidence, nativeContractVersion, nativeBuildProfile, search, searchPage, recent, recentPage, getSession, getSessionEventsPage, getSessionToolCallsPage, getSessionUserTurnsPage, getSessionFileEditsPage, getSessionRequestsPage, getSessionUsage, stats, listSessionCatalogPage, listSessionCatalog, discoverSessions, hydrateSession, getSessionRelationships, getSessionTree, getSessionChildrenPage, sync, syncLocal, installGitHooks, linkGitCommit } = nativeBinding
314
314
 
315
315
  module.exports.historyExport = historyExport
316
316
  module.exports.sessionStoreCall = sessionStoreCall
@@ -320,7 +320,9 @@ module.exports.applySourceEvidence = applySourceEvidence
320
320
  module.exports.nativeContractVersion = nativeContractVersion
321
321
  module.exports.nativeBuildProfile = nativeBuildProfile
322
322
  module.exports.search = search
323
+ module.exports.searchPage = searchPage
323
324
  module.exports.recent = recent
325
+ module.exports.recentPage = recentPage
324
326
  module.exports.getSession = getSession
325
327
  module.exports.getSessionEventsPage = getSessionEventsPage
326
328
  module.exports.getSessionToolCallsPage = getSessionToolCallsPage
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hist-native-darwin-arm64",
3
- "version": "0.31.0",
3
+ "version": "0.32.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.31.0",
3
+ "version": "0.32.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.31.0",
3
+ "version": "0.32.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.31.0",
3
+ "version": "0.32.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.31.0",
3
+ "version": "0.32.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.31.0",
3
+ "version": "0.32.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.31.0",
3
+ "version": "0.32.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.31.0",
3
+ "version": "0.32.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.31.0",
48
- "ai-hist-native-darwin-x64": "0.31.0",
49
- "ai-hist-native-linux-x64-gnu": "0.31.0",
50
- "ai-hist-native-linux-arm64-gnu": "0.31.0",
51
- "ai-hist-native-linux-x64-musl": "0.31.0",
52
- "ai-hist-native-linux-arm64-musl": "0.31.0",
53
- "ai-hist-native-win32-x64-msvc": "0.31.0"
47
+ "ai-hist-native-darwin-arm64": "0.32.0",
48
+ "ai-hist-native-darwin-x64": "0.32.0",
49
+ "ai-hist-native-linux-x64-gnu": "0.32.0",
50
+ "ai-hist-native-linux-arm64-gnu": "0.32.0",
51
+ "ai-hist-native-linux-x64-musl": "0.32.0",
52
+ "ai-hist-native-linux-arm64-musl": "0.32.0",
53
+ "ai-hist-native-win32-x64-msvc": "0.32.0"
54
54
  }
55
55
  }