@raisindb/client 0.5.2 → 0.5.4
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/dist/{chunk-3KMOXRTK.mjs → chunk-765DLJMZ.mjs} +24 -3
- package/dist/chunk-765DLJMZ.mjs.map +1 -0
- package/dist/{chunk-Q4IBPW2W.mjs → chunk-AULHRX5C.mjs} +2 -2
- package/dist/{chunk-QJKYNLT4.mjs → chunk-IFV4ECHC.mjs} +3 -3
- package/dist/{chunk-B6EFDYFS.mjs → chunk-VMUT6PIO.mjs} +2 -2
- package/dist/{chunk-P44XWTPA.mjs → chunk-ZUUSBLVP.mjs} +3 -3
- package/dist/{conversation-list-store-DVYgTaaA.d.mts → conversation-list-store-Bw1UwRL8.d.mts} +398 -173
- package/dist/{conversation-list-store-DVYgTaaA.d.ts → conversation-list-store-Bw1UwRL8.d.ts} +398 -173
- package/dist/{index-AKUurvWQ.d.ts → index-B1u8uo8e.d.ts} +1 -1
- package/dist/{index-BOO1gV6F.d.mts → index-C-K8H-PW.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +199 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +181 -6
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +23 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +3 -3
- package/dist/{svelte-sql-B1nLVQuc.d.mts → svelte-sql-Ce8sVO7T.d.mts} +1 -1
- package/dist/{svelte-sql-ABIom_Bb.d.ts → svelte-sql-GOSaxlBv.d.ts} +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +23 -2
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +3 -3
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +23 -2
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-3KMOXRTK.mjs.map +0 -1
- /package/dist/{chunk-Q4IBPW2W.mjs.map → chunk-AULHRX5C.mjs.map} +0 -0
- /package/dist/{chunk-QJKYNLT4.mjs.map → chunk-IFV4ECHC.mjs.map} +0 -0
- /package/dist/{chunk-B6EFDYFS.mjs.map → chunk-VMUT6PIO.mjs.map} +0 -0
- /package/dist/{chunk-P44XWTPA.mjs.map → chunk-ZUUSBLVP.mjs.map} +0 -0
package/dist/{conversation-list-store-DVYgTaaA.d.ts → conversation-list-store-Bw1UwRL8.d.ts}
RENAMED
|
@@ -1,178 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import * as fs_promises from 'fs/promises';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Reconnection manager with exponential backoff
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Reconnection strategy options
|
|
9
|
-
*/
|
|
10
|
-
interface ReconnectOptions {
|
|
11
|
-
/** Initial delay in milliseconds (default: 1000) */
|
|
12
|
-
initialDelay?: number;
|
|
13
|
-
/** Maximum delay in milliseconds (default: 30000) */
|
|
14
|
-
maxDelay?: number;
|
|
15
|
-
/** Backoff multiplier (default: 2) */
|
|
16
|
-
backoffMultiplier?: number;
|
|
17
|
-
/** Maximum number of reconnection attempts (default: Infinity) */
|
|
18
|
-
maxAttempts?: number;
|
|
19
|
-
/** Add random jitter to delay (default: true). Jitter is +/- 25% of the computed delay. */
|
|
20
|
-
jitter?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Reconnection manager with exponential backoff
|
|
24
|
-
*/
|
|
25
|
-
declare class ReconnectManager {
|
|
26
|
-
private currentDelay;
|
|
27
|
-
private attempts;
|
|
28
|
-
private reconnectTimeout?;
|
|
29
|
-
private isReconnecting;
|
|
30
|
-
private readonly initialDelay;
|
|
31
|
-
private readonly maxDelay;
|
|
32
|
-
private readonly backoffMultiplier;
|
|
33
|
-
private readonly maxAttempts;
|
|
34
|
-
private readonly jitter;
|
|
35
|
-
constructor(options?: ReconnectOptions);
|
|
36
|
-
/**
|
|
37
|
-
* Schedule a reconnection attempt
|
|
38
|
-
*
|
|
39
|
-
* @param callback - Function to call when it's time to reconnect
|
|
40
|
-
* @returns true if reconnection was scheduled, false if max attempts reached
|
|
41
|
-
*/
|
|
42
|
-
scheduleReconnect(callback: () => void | Promise<void>): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Cancel any pending reconnection attempt
|
|
45
|
-
*/
|
|
46
|
-
cancelReconnect(): void;
|
|
47
|
-
/**
|
|
48
|
-
* Reset the reconnection state (call after successful connection)
|
|
49
|
-
*/
|
|
50
|
-
reset(): void;
|
|
51
|
-
/**
|
|
52
|
-
* Check if currently in reconnection mode
|
|
53
|
-
*/
|
|
54
|
-
isActive(): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Get the current number of reconnection attempts
|
|
57
|
-
*/
|
|
58
|
-
getAttempts(): number;
|
|
59
|
-
/**
|
|
60
|
-
* Get the current delay in milliseconds
|
|
61
|
-
*/
|
|
62
|
-
getCurrentDelay(): number;
|
|
63
|
-
/**
|
|
64
|
-
* Check if max attempts have been reached
|
|
65
|
-
*/
|
|
66
|
-
hasReachedMaxAttempts(): boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Universal WebSocket connection manager
|
|
71
|
-
*
|
|
72
|
-
* Detects environment (browser vs Node.js) and uses appropriate WebSocket implementation.
|
|
73
|
-
* Handles auto-reconnect, heartbeat, and connection state management.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Connection state
|
|
78
|
-
*/
|
|
79
|
-
declare enum ConnectionState {
|
|
80
|
-
Disconnected = "disconnected",
|
|
81
|
-
Connecting = "connecting",
|
|
82
|
-
Connected = "connected",
|
|
83
|
-
Reconnecting = "reconnecting",
|
|
84
|
-
Closed = "closed"
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Connection options
|
|
88
|
-
*/
|
|
89
|
-
interface ConnectionOptions {
|
|
90
|
-
/** Auto-reconnect on disconnect (default: true) */
|
|
91
|
-
autoReconnect?: boolean;
|
|
92
|
-
/** Reconnection options */
|
|
93
|
-
reconnectOptions?: ReconnectOptions;
|
|
94
|
-
/** Heartbeat interval in milliseconds (default: 30000, 0 to disable) */
|
|
95
|
-
heartbeatInterval?: number;
|
|
96
|
-
/** Heartbeat timeout in milliseconds (default: 5000) */
|
|
97
|
-
heartbeatTimeout?: number;
|
|
98
|
-
/** WebSocket protocols */
|
|
99
|
-
protocols?: string | string[];
|
|
100
|
-
/**
|
|
101
|
-
* Extra headers to send on the WebSocket upgrade request
|
|
102
|
-
* (e.g. `x-tenant-id` for tenant-less `/ws` URLs).
|
|
103
|
-
*
|
|
104
|
-
* Only honored by WebSocket implementations that support custom headers
|
|
105
|
-
* (Node.js `ws` package). Browser WebSockets silently ignore them — the
|
|
106
|
-
* server then resolves the tenant from the request (default: "default").
|
|
107
|
-
*/
|
|
108
|
-
headers?: Record<string, string>;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Universal WebSocket connection manager
|
|
112
|
-
*/
|
|
113
|
-
declare class Connection extends EventEmitter {
|
|
114
|
-
private ws?;
|
|
115
|
-
private url;
|
|
116
|
-
private state;
|
|
117
|
-
private reconnectManager;
|
|
118
|
-
private heartbeatTimer?;
|
|
119
|
-
private heartbeatTimeoutTimer?;
|
|
120
|
-
private options;
|
|
121
|
-
private WebSocketImpl;
|
|
122
|
-
private manualClose;
|
|
123
|
-
constructor(url: string, options?: ConnectionOptions);
|
|
124
|
-
/**
|
|
125
|
-
* Connect to the WebSocket server
|
|
126
|
-
*/
|
|
127
|
-
connect(): Promise<void>;
|
|
128
|
-
/**
|
|
129
|
-
* Disconnect from the WebSocket server
|
|
130
|
-
*/
|
|
131
|
-
disconnect(): void;
|
|
132
|
-
/**
|
|
133
|
-
* Send data through the WebSocket
|
|
134
|
-
*
|
|
135
|
-
* @param data - Data to send (Uint8Array for MessagePack)
|
|
136
|
-
*/
|
|
137
|
-
send(data: Uint8Array): void;
|
|
138
|
-
/**
|
|
139
|
-
* Get current connection state
|
|
140
|
-
*/
|
|
141
|
-
getState(): ConnectionState;
|
|
142
|
-
/**
|
|
143
|
-
* Check if connected
|
|
144
|
-
*/
|
|
145
|
-
isConnected(): boolean;
|
|
146
|
-
/**
|
|
147
|
-
* Whether auto-reconnect is enabled for this connection.
|
|
148
|
-
*
|
|
149
|
-
* Used by the client to decide whether requests issued while the
|
|
150
|
-
* connection is down can be queued (the connection will come back) or
|
|
151
|
-
* should fail immediately.
|
|
152
|
-
*/
|
|
153
|
-
isAutoReconnectEnabled(): boolean;
|
|
154
|
-
/**
|
|
155
|
-
* Reconnect to the server
|
|
156
|
-
*/
|
|
157
|
-
private reconnect;
|
|
158
|
-
/**
|
|
159
|
-
* Set connection state and emit event
|
|
160
|
-
*/
|
|
161
|
-
private setState;
|
|
162
|
-
/**
|
|
163
|
-
* Start heartbeat mechanism
|
|
164
|
-
*/
|
|
165
|
-
private startHeartbeat;
|
|
166
|
-
/**
|
|
167
|
-
* Stop heartbeat mechanism
|
|
168
|
-
*/
|
|
169
|
-
private stopHeartbeat;
|
|
170
|
-
/**
|
|
171
|
-
* Reset heartbeat timeout (called when message received)
|
|
172
|
-
*/
|
|
173
|
-
private resetHeartbeat;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
4
|
/**
|
|
177
5
|
* WebSocket protocol definitions for RaisinDB
|
|
178
6
|
*
|
|
@@ -828,6 +656,330 @@ declare function isEventMessage(message: ResponseEnvelope | EventMessage): messa
|
|
|
828
656
|
*/
|
|
829
657
|
declare function isResponseEnvelope(message: ResponseEnvelope | EventMessage): message is ResponseEnvelope;
|
|
830
658
|
|
|
659
|
+
/**
|
|
660
|
+
* Retrieval: finding passages, and answering from them.
|
|
661
|
+
*
|
|
662
|
+
* # Why these are methods and not `functions().invoke('ask', …)`
|
|
663
|
+
*
|
|
664
|
+
* `invoke` is the escape hatch — the way to call something the SDK does not
|
|
665
|
+
* model. Reaching for it here would cost three things that matter more than the
|
|
666
|
+
* line of code it saves:
|
|
667
|
+
*
|
|
668
|
+
* 1. **The name is a string resolved at run time.** `invoke('ask')` resolves
|
|
669
|
+
* by function NAME on the server; a typo, a rename or a package that has
|
|
670
|
+
* not been installed yet is a 404 at run time, in production, with nothing
|
|
671
|
+
* in the type checker to catch it.
|
|
672
|
+
* 2. **Nobody owns the argument and response shape.** Every call site
|
|
673
|
+
* rebuilds `{ question, workspaces, limit }` from documentation and
|
|
674
|
+
* re-derives what a citation looks like. That is the drift this codebase
|
|
675
|
+
* keeps paying for elsewhere — several hand-maintained copies of one
|
|
676
|
+
* shape, differing slightly, none of them wrong enough to notice.
|
|
677
|
+
* 3. **It freezes the transport.** A call site that names a function can
|
|
678
|
+
* never be moved to an endpoint, a cache or a different implementation
|
|
679
|
+
* without breaking every caller. Behind a method, that is an internal
|
|
680
|
+
* detail.
|
|
681
|
+
*
|
|
682
|
+
* So `search()` and `ask()` are the surface, and how they are served is ours to
|
|
683
|
+
* change. `functions().invoke(...)` remains, for functions the caller wrote.
|
|
684
|
+
*
|
|
685
|
+
* # Why `search()` builds SQL rather than calling a search endpoint
|
|
686
|
+
*
|
|
687
|
+
* Because the SQL surface is the complete one — scope, granularity, weights,
|
|
688
|
+
* distance ceilings, the chunk text and its provenance — and it is the one the
|
|
689
|
+
* engine tests. A second wire format for search would be a second thing to keep
|
|
690
|
+
* in step with the first. What matters is that the query shape is written ONCE,
|
|
691
|
+
* here, instead of in every application that wants site search.
|
|
692
|
+
*/
|
|
693
|
+
|
|
694
|
+
/** One matching passage. */
|
|
695
|
+
interface SearchPassage {
|
|
696
|
+
/** Path of the node the passage came from. */
|
|
697
|
+
path: string;
|
|
698
|
+
/** Node id, stable across renames — cite with this plus `chunkIndex`. */
|
|
699
|
+
nodeId: string;
|
|
700
|
+
/** The node's name, for display. */
|
|
701
|
+
name: string;
|
|
702
|
+
/** Which chunk of the document matched. `0` for an unchunked node. */
|
|
703
|
+
chunkIndex: number;
|
|
704
|
+
/** The passage itself. */
|
|
705
|
+
text: string;
|
|
706
|
+
/**
|
|
707
|
+
* False when only a short preview of the passage was available.
|
|
708
|
+
*
|
|
709
|
+
* Use it to point a reader at the document; do not quote it as if it were the
|
|
710
|
+
* whole passage.
|
|
711
|
+
*/
|
|
712
|
+
textIsExact: boolean;
|
|
713
|
+
/** Fused rank score. Comparable within one result set, not across queries. */
|
|
714
|
+
score: number;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Which workspaces a retrieval may read, as one string.
|
|
718
|
+
*
|
|
719
|
+
* | Form | Example | Behaviour |
|
|
720
|
+
* |---|---|---|
|
|
721
|
+
* | One name | `'stories'` | Exact |
|
|
722
|
+
* | A list | `'stories, handbook, policies'` | Exact, each name; spaces are trimmed |
|
|
723
|
+
* | A glob | `'content-*'` | Pattern — one token, never mixed into a list |
|
|
724
|
+
* | Everything | `'ALL READABLE'` | Every workspace the caller may read |
|
|
725
|
+
*
|
|
726
|
+
* **A name is an assertion; a glob is a question.** A listed name that does not
|
|
727
|
+
* resolve is an ERROR — you meant that workspace, so a typo is reported rather
|
|
728
|
+
* than silently searching the rest. A glob that matches nothing is fine and
|
|
729
|
+
* simply returns no rows; you only hoped for a pattern.
|
|
730
|
+
*
|
|
731
|
+
* `'*'` and `'ALL'` are rejected on purpose. `'*'` reads as "unscoped" and the
|
|
732
|
+
* eye slides past it in review, while two uppercase words appear in no other
|
|
733
|
+
* context — so "which of our queries go repo-wide?" stays answerable with one
|
|
734
|
+
* grep.
|
|
735
|
+
*
|
|
736
|
+
* Row-level security applies to the results either way: a caller never sees a
|
|
737
|
+
* node it may not read. The scope is not a security boundary, it is an
|
|
738
|
+
* INTENT — it decides which corpus the answer is drawn from. On a public site
|
|
739
|
+
* those differ sharply: the visitor's identity may legitimately read published
|
|
740
|
+
* pages, and a chatbot scoped to everything readable will happily quote an
|
|
741
|
+
* internal handbook at them because nothing said not to.
|
|
742
|
+
*/
|
|
743
|
+
type WorkspaceScope = string;
|
|
744
|
+
interface SearchOptions {
|
|
745
|
+
/**
|
|
746
|
+
* Where to look. See {@link WorkspaceScope} for the forms.
|
|
747
|
+
*
|
|
748
|
+
* Required, and deliberately not defaulted: an unscoped search on a website
|
|
749
|
+
* is how content nobody meant to publish reaches a visitor. Pass
|
|
750
|
+
* `'ALL READABLE'` when that really is what you mean.
|
|
751
|
+
*/
|
|
752
|
+
workspaces: WorkspaceScope;
|
|
753
|
+
/** How many passages. Defaults to 8. */
|
|
754
|
+
limit?: number;
|
|
755
|
+
/** Optional vector-distance ceiling, to tighten precision. */
|
|
756
|
+
maxDistance?: number;
|
|
757
|
+
}
|
|
758
|
+
/** An answer, and the passages it was drawn from. */
|
|
759
|
+
interface Answer {
|
|
760
|
+
/** The answer text. Empty when `grounded` is false. */
|
|
761
|
+
answer: string;
|
|
762
|
+
/**
|
|
763
|
+
* False when nothing relevant was retrieved.
|
|
764
|
+
*
|
|
765
|
+
* The model is NOT called in that case — it is not that the model declined,
|
|
766
|
+
* it is that it was never asked. A model handed an empty context answers from
|
|
767
|
+
* its own training, fluently, with nothing in the reply marking it invented.
|
|
768
|
+
*/
|
|
769
|
+
grounded: boolean;
|
|
770
|
+
/** The passages given to the model, numbered as the answer cites them. */
|
|
771
|
+
citations: Citation[];
|
|
772
|
+
/**
|
|
773
|
+
* One entry per retrieval attempt. A second entry means the first search was
|
|
774
|
+
* graded insufficient and the query was rewritten.
|
|
775
|
+
*/
|
|
776
|
+
attempts: {
|
|
777
|
+
query: string;
|
|
778
|
+
passages: number;
|
|
779
|
+
}[];
|
|
780
|
+
/** The model that produced the answer. */
|
|
781
|
+
model: string;
|
|
782
|
+
}
|
|
783
|
+
interface Citation {
|
|
784
|
+
/** The number used in the answer text: `[1]`, `[2]`. */
|
|
785
|
+
marker: number;
|
|
786
|
+
path: string;
|
|
787
|
+
nodeId: string;
|
|
788
|
+
name: string;
|
|
789
|
+
chunkIndex: number;
|
|
790
|
+
textIsExact: boolean;
|
|
791
|
+
}
|
|
792
|
+
interface AskOptions {
|
|
793
|
+
/**
|
|
794
|
+
* Where the answer may be drawn from. See {@link WorkspaceScope}.
|
|
795
|
+
*
|
|
796
|
+
* Required, exactly as it is on {@link SearchApi.search}, and for a sharper
|
|
797
|
+
* reason: an answer is quoted back to whoever asked. A chatbot on a public
|
|
798
|
+
* page left at "everything readable" will paraphrase an internal document
|
|
799
|
+
* the moment a visitor's question happens to match it — fluently, with a
|
|
800
|
+
* citation, and with nothing to show it was never meant for them.
|
|
801
|
+
*/
|
|
802
|
+
workspaces: WorkspaceScope;
|
|
803
|
+
/** How many passages to ground the answer in. Defaults to 8. */
|
|
804
|
+
limit?: number;
|
|
805
|
+
/** Model id, as `slug:model`. Defaults to the tenant's configured chat model. */
|
|
806
|
+
model?: string;
|
|
807
|
+
/** Also bring in the graph neighbourhood of the question's subject. */
|
|
808
|
+
useGraph?: boolean;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Reconnection manager with exponential backoff
|
|
813
|
+
*/
|
|
814
|
+
/**
|
|
815
|
+
* Reconnection strategy options
|
|
816
|
+
*/
|
|
817
|
+
interface ReconnectOptions {
|
|
818
|
+
/** Initial delay in milliseconds (default: 1000) */
|
|
819
|
+
initialDelay?: number;
|
|
820
|
+
/** Maximum delay in milliseconds (default: 30000) */
|
|
821
|
+
maxDelay?: number;
|
|
822
|
+
/** Backoff multiplier (default: 2) */
|
|
823
|
+
backoffMultiplier?: number;
|
|
824
|
+
/** Maximum number of reconnection attempts (default: Infinity) */
|
|
825
|
+
maxAttempts?: number;
|
|
826
|
+
/** Add random jitter to delay (default: true). Jitter is +/- 25% of the computed delay. */
|
|
827
|
+
jitter?: boolean;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Reconnection manager with exponential backoff
|
|
831
|
+
*/
|
|
832
|
+
declare class ReconnectManager {
|
|
833
|
+
private currentDelay;
|
|
834
|
+
private attempts;
|
|
835
|
+
private reconnectTimeout?;
|
|
836
|
+
private isReconnecting;
|
|
837
|
+
private readonly initialDelay;
|
|
838
|
+
private readonly maxDelay;
|
|
839
|
+
private readonly backoffMultiplier;
|
|
840
|
+
private readonly maxAttempts;
|
|
841
|
+
private readonly jitter;
|
|
842
|
+
constructor(options?: ReconnectOptions);
|
|
843
|
+
/**
|
|
844
|
+
* Schedule a reconnection attempt
|
|
845
|
+
*
|
|
846
|
+
* @param callback - Function to call when it's time to reconnect
|
|
847
|
+
* @returns true if reconnection was scheduled, false if max attempts reached
|
|
848
|
+
*/
|
|
849
|
+
scheduleReconnect(callback: () => void | Promise<void>): boolean;
|
|
850
|
+
/**
|
|
851
|
+
* Cancel any pending reconnection attempt
|
|
852
|
+
*/
|
|
853
|
+
cancelReconnect(): void;
|
|
854
|
+
/**
|
|
855
|
+
* Reset the reconnection state (call after successful connection)
|
|
856
|
+
*/
|
|
857
|
+
reset(): void;
|
|
858
|
+
/**
|
|
859
|
+
* Check if currently in reconnection mode
|
|
860
|
+
*/
|
|
861
|
+
isActive(): boolean;
|
|
862
|
+
/**
|
|
863
|
+
* Get the current number of reconnection attempts
|
|
864
|
+
*/
|
|
865
|
+
getAttempts(): number;
|
|
866
|
+
/**
|
|
867
|
+
* Get the current delay in milliseconds
|
|
868
|
+
*/
|
|
869
|
+
getCurrentDelay(): number;
|
|
870
|
+
/**
|
|
871
|
+
* Check if max attempts have been reached
|
|
872
|
+
*/
|
|
873
|
+
hasReachedMaxAttempts(): boolean;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Universal WebSocket connection manager
|
|
878
|
+
*
|
|
879
|
+
* Detects environment (browser vs Node.js) and uses appropriate WebSocket implementation.
|
|
880
|
+
* Handles auto-reconnect, heartbeat, and connection state management.
|
|
881
|
+
*/
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* Connection state
|
|
885
|
+
*/
|
|
886
|
+
declare enum ConnectionState {
|
|
887
|
+
Disconnected = "disconnected",
|
|
888
|
+
Connecting = "connecting",
|
|
889
|
+
Connected = "connected",
|
|
890
|
+
Reconnecting = "reconnecting",
|
|
891
|
+
Closed = "closed"
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Connection options
|
|
895
|
+
*/
|
|
896
|
+
interface ConnectionOptions {
|
|
897
|
+
/** Auto-reconnect on disconnect (default: true) */
|
|
898
|
+
autoReconnect?: boolean;
|
|
899
|
+
/** Reconnection options */
|
|
900
|
+
reconnectOptions?: ReconnectOptions;
|
|
901
|
+
/** Heartbeat interval in milliseconds (default: 30000, 0 to disable) */
|
|
902
|
+
heartbeatInterval?: number;
|
|
903
|
+
/** Heartbeat timeout in milliseconds (default: 5000) */
|
|
904
|
+
heartbeatTimeout?: number;
|
|
905
|
+
/** WebSocket protocols */
|
|
906
|
+
protocols?: string | string[];
|
|
907
|
+
/**
|
|
908
|
+
* Extra headers to send on the WebSocket upgrade request
|
|
909
|
+
* (e.g. `x-tenant-id` for tenant-less `/ws` URLs).
|
|
910
|
+
*
|
|
911
|
+
* Only honored by WebSocket implementations that support custom headers
|
|
912
|
+
* (Node.js `ws` package). Browser WebSockets silently ignore them — the
|
|
913
|
+
* server then resolves the tenant from the request (default: "default").
|
|
914
|
+
*/
|
|
915
|
+
headers?: Record<string, string>;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Universal WebSocket connection manager
|
|
919
|
+
*/
|
|
920
|
+
declare class Connection extends EventEmitter {
|
|
921
|
+
private ws?;
|
|
922
|
+
private url;
|
|
923
|
+
private state;
|
|
924
|
+
private reconnectManager;
|
|
925
|
+
private heartbeatTimer?;
|
|
926
|
+
private heartbeatTimeoutTimer?;
|
|
927
|
+
private options;
|
|
928
|
+
private WebSocketImpl;
|
|
929
|
+
private manualClose;
|
|
930
|
+
constructor(url: string, options?: ConnectionOptions);
|
|
931
|
+
/**
|
|
932
|
+
* Connect to the WebSocket server
|
|
933
|
+
*/
|
|
934
|
+
connect(): Promise<void>;
|
|
935
|
+
/**
|
|
936
|
+
* Disconnect from the WebSocket server
|
|
937
|
+
*/
|
|
938
|
+
disconnect(): void;
|
|
939
|
+
/**
|
|
940
|
+
* Send data through the WebSocket
|
|
941
|
+
*
|
|
942
|
+
* @param data - Data to send (Uint8Array for MessagePack)
|
|
943
|
+
*/
|
|
944
|
+
send(data: Uint8Array): void;
|
|
945
|
+
/**
|
|
946
|
+
* Get current connection state
|
|
947
|
+
*/
|
|
948
|
+
getState(): ConnectionState;
|
|
949
|
+
/**
|
|
950
|
+
* Check if connected
|
|
951
|
+
*/
|
|
952
|
+
isConnected(): boolean;
|
|
953
|
+
/**
|
|
954
|
+
* Whether auto-reconnect is enabled for this connection.
|
|
955
|
+
*
|
|
956
|
+
* Used by the client to decide whether requests issued while the
|
|
957
|
+
* connection is down can be queued (the connection will come back) or
|
|
958
|
+
* should fail immediately.
|
|
959
|
+
*/
|
|
960
|
+
isAutoReconnectEnabled(): boolean;
|
|
961
|
+
/**
|
|
962
|
+
* Reconnect to the server
|
|
963
|
+
*/
|
|
964
|
+
private reconnect;
|
|
965
|
+
/**
|
|
966
|
+
* Set connection state and emit event
|
|
967
|
+
*/
|
|
968
|
+
private setState;
|
|
969
|
+
/**
|
|
970
|
+
* Start heartbeat mechanism
|
|
971
|
+
*/
|
|
972
|
+
private startHeartbeat;
|
|
973
|
+
/**
|
|
974
|
+
* Stop heartbeat mechanism
|
|
975
|
+
*/
|
|
976
|
+
private stopHeartbeat;
|
|
977
|
+
/**
|
|
978
|
+
* Reset heartbeat timeout (called when message received)
|
|
979
|
+
*/
|
|
980
|
+
private resetHeartbeat;
|
|
981
|
+
}
|
|
982
|
+
|
|
831
983
|
/**
|
|
832
984
|
* JWT authentication manager
|
|
833
985
|
*/
|
|
@@ -4493,6 +4645,18 @@ interface PlanTask {
|
|
|
4493
4645
|
title: string;
|
|
4494
4646
|
/** Task status */
|
|
4495
4647
|
status: string;
|
|
4648
|
+
/** Durable child-agent delegation state, when this task was delegated. */
|
|
4649
|
+
delegation?: PlanTaskDelegation;
|
|
4650
|
+
}
|
|
4651
|
+
interface PlanTaskDelegation {
|
|
4652
|
+
id: string;
|
|
4653
|
+
status: string;
|
|
4654
|
+
agentRef?: string;
|
|
4655
|
+
flowInstanceId?: string;
|
|
4656
|
+
branch?: string;
|
|
4657
|
+
baseBranch?: string;
|
|
4658
|
+
result?: unknown;
|
|
4659
|
+
error?: string;
|
|
4496
4660
|
}
|
|
4497
4661
|
/** Child record attached to a message (thought, tool call detail, plan, cost) */
|
|
4498
4662
|
interface MessageChild {
|
|
@@ -5825,6 +5989,7 @@ declare class Database {
|
|
|
5825
5989
|
private workspaceManager?;
|
|
5826
5990
|
private sqlQuery?;
|
|
5827
5991
|
private sqlHandler?;
|
|
5992
|
+
private _searchApi?;
|
|
5828
5993
|
private branch?;
|
|
5829
5994
|
private revision?;
|
|
5830
5995
|
private getUploadManager?;
|
|
@@ -5939,6 +6104,56 @@ declare class Database {
|
|
|
5939
6104
|
* Get FunctionsApi for invoking server-side functions via WebSocket
|
|
5940
6105
|
*/
|
|
5941
6106
|
functions(): FunctionsApi;
|
|
6107
|
+
/**
|
|
6108
|
+
* The retrieval implementation behind {@link search} and {@link ask}.
|
|
6109
|
+
*
|
|
6110
|
+
* Private: callers get the two verbs, not the object, so how retrieval is
|
|
6111
|
+
* served stays ours to change.
|
|
6112
|
+
*/
|
|
6113
|
+
private searchApi;
|
|
6114
|
+
/**
|
|
6115
|
+
* Find the passages matching a query, by meaning and by keyword at once.
|
|
6116
|
+
*
|
|
6117
|
+
* No model is involved — this is the call for a search box or for assembling
|
|
6118
|
+
* your own context. Returns one entry per PASSAGE, so several may come from
|
|
6119
|
+
* one document.
|
|
6120
|
+
*
|
|
6121
|
+
* @example
|
|
6122
|
+
* ```typescript
|
|
6123
|
+
* const passages = await db.search('how much notice to terminate', {
|
|
6124
|
+
* workspaces: 'stories',
|
|
6125
|
+
* });
|
|
6126
|
+
* passages[0].text; // the passage itself
|
|
6127
|
+
* passages[0].chunkIndex; // where in the document it came from
|
|
6128
|
+
* ```
|
|
6129
|
+
*/
|
|
6130
|
+
search(query: string, options: SearchOptions): Promise<SearchPassage[]>;
|
|
6131
|
+
/**
|
|
6132
|
+
* Answer a question from the stored content, with citations.
|
|
6133
|
+
*
|
|
6134
|
+
* Retrieves, judges whether what came back answers the question, rewrites the
|
|
6135
|
+
* query once if it does not, and answers from those passages only. Check
|
|
6136
|
+
* `grounded` before showing the answer: when it is false nothing relevant was
|
|
6137
|
+
* found and the model was never asked.
|
|
6138
|
+
*
|
|
6139
|
+
* `workspaces` is required, the same as on {@link search}: an answer is
|
|
6140
|
+
* quoted back to whoever asked, so the corpus it may be drawn from is stated
|
|
6141
|
+
* rather than assumed. One name, a comma-separated list, a glob, or
|
|
6142
|
+
* `'ALL READABLE'`.
|
|
6143
|
+
*
|
|
6144
|
+
* A method rather than `functions().invoke('ask', ...)` on purpose — see the
|
|
6145
|
+
* note at the top of `search-api.ts`. `invoke` is the escape hatch for
|
|
6146
|
+
* functions YOU wrote.
|
|
6147
|
+
*
|
|
6148
|
+
* @example
|
|
6149
|
+
* ```typescript
|
|
6150
|
+
* const { answer, citations, grounded } = await db.ask(
|
|
6151
|
+
* 'How much notice do we have to give?',
|
|
6152
|
+
* { workspaces: 'stories, handbook' }, // one name, a list, a glob, or 'ALL READABLE'
|
|
6153
|
+
* );
|
|
6154
|
+
* ```
|
|
6155
|
+
*/
|
|
6156
|
+
ask(question: string, options: AskOptions): Promise<Answer>;
|
|
5942
6157
|
/**
|
|
5943
6158
|
* Get a pre-configured ConversationManager for managing conversations.
|
|
5944
6159
|
*
|
|
@@ -6907,6 +7122,16 @@ interface PlanProjectionTask {
|
|
|
6907
7122
|
status: string;
|
|
6908
7123
|
description?: string;
|
|
6909
7124
|
priority?: string;
|
|
7125
|
+
delegation?: {
|
|
7126
|
+
id?: string;
|
|
7127
|
+
status: string;
|
|
7128
|
+
agentRef?: string;
|
|
7129
|
+
flowInstanceId?: string;
|
|
7130
|
+
branch?: string;
|
|
7131
|
+
baseBranch?: string;
|
|
7132
|
+
result?: unknown;
|
|
7133
|
+
error?: string;
|
|
7134
|
+
};
|
|
6910
7135
|
}
|
|
6911
7136
|
interface PlanProjection {
|
|
6912
7137
|
key: string;
|
|
@@ -7193,4 +7418,4 @@ declare class ConversationListStore {
|
|
|
7193
7418
|
private notify;
|
|
7194
7419
|
}
|
|
7195
7420
|
|
|
7196
|
-
export {
|
|
7421
|
+
export { type CurrentUser$1 as $, AuthManager as A, type BatchUpload as B, ConnectionState as C, Database as D, type EventMessage as E, type FlowClientOptions as F, type SearchOptions as G, type HttpClientOptions as H, type IdentityUser as I, type SearchPassage as J, type ClientMode as K, type CurrentUser as L, type UserNode as M, type Node as N, type AuthEvent as O, type PlanProjection as P, type AuthStateChange as Q, RaisinClient as R, type SubscriptionFilters as S, type ToolCallInfo as T, UploadErrorCode as U, type AuthStateChangeCallback as V, type WorkspaceScope as W, type UserChangeEvent as X, type UserChangeCallback as Y, HttpDatabase as Z, HttpWorkspaceClient as _, type ConversationStoreSnapshot as a, type AuditQueryPayload as a$, type UserNode$1 as a0, type SignAssetOptions as a1, type SignedAssetUrl as a2, type DatabaseHttpOptions as a3, WorkspaceClient as a4, WorkspaceManager as a5, type WorkspaceCreateOptions as a6, type WorkspaceUpdateOptions as a7, NodeOperations as a8, type NodeCreateOptions as a9, createSqlHandler as aA, EventHandler as aB, EventSubscriptions as aC, type EventCallback as aD, type Subscription as aE, Connection as aF, type ConnectionOptions as aG, MemoryTokenStorage as aH, LocalStorageTokenStorage as aI, type TokenStorage as aJ, type IdentityAuthResponse as aK, type IdentityAuthError as aL, type RequestEnvelope as aM, type ResponseEnvelope as aN, type NodeEventPayload as aO, type RequestContext as aP, type ErrorInfo as aQ, type ResponseMetadata as aR, type IncomingRelation as aS, type NodeRelationships as aT, type NodeCreatePayload as aU, type NodeCreateDeepPayload as aV, type NodeUpdatePayload as aW, type NodeDeletePayload as aX, type NodeGetPayload as aY, type NodeHistoryPayload as aZ, type RevisionEntry as a_, type NodeCreateDeepOptions as aa, type NodeUpdateOptions as ab, type NodeQueryOptions as ac, Transaction as ad, type TransactionOptions as ae, NodeTypes as af, Archetypes as ag, ElementTypes as ah, Branches as ai, type BranchDiff as aj, type BranchDivergence as ak, type CrossBranchCopySummary as al, type CrossBranchNodeChange as am, type NodeDiffInfo as an, Tags as ao, SchedulerApi as ap, type ListInvocationsFilter as aq, type ScheduleInvocationOptions as ar, type ScheduledInvocation as as, type ScheduledInvocationRef as at, type ScheduledInvocationTargetKind as au, HttpNodeTypes as av, HttpArchetypes as aw, HttpElementTypes as ax, type SchemaCommit as ay, SqlQuery as az, type ChatMessage as b, Uploader as b$, type AuditLogEntry as b0, type NodeQueryPayload as b1, type RelationAddPayload as b2, type RelationRemovePayload as b3, type RelationsGetPayload as b4, type SqlQueryPayload as b5, type SqlResult as b6, type Workspace as b7, type WorkspaceCreatePayload as b8, type WorkspaceGetPayload as b9, type LoggerConfig as bA, type UploadStatus as bB, type UploadOptions as bC, type UploadProgress as bD, type UploadResult as bE, type Upload as bF, type CreateUploadRequest as bG, type CreateUploadResponse as bH, type ChunkUploadResponse as bI, type UploadStatusResponse as bJ, type CompleteUploadRequest as bK, type CompleteUploadResponse as bL, type BatchFileProgress as bM, UploadError as bN, DEFAULT_CHUNK_SIZE as bO, DEFAULT_MAX_RETRIES as bP, DEFAULT_RETRY_BASE_DELAY as bQ, DEFAULT_RETRY_MAX_DELAY as bR, DEFAULT_NODE_TYPE as bS, DEFAULT_BRANCH as bT, DEFAULT_BATCH_CONCURRENCY as bU, BrowserFileSource as bV, NodeFileSource as bW, createFileSource as bX, getContentType as bY, calculateChunkCount as bZ, getChunkRange as b_, type WorkspaceDeletePayload as ba, type WorkspaceUpdatePayload as bb, type SubscribePayload as bc, type UnsubscribePayload as bd, type SubscriptionResponse as be, type AuthenticatePayload as bf, type AuthenticateResponse as bg, type RefreshTokenPayload as bh, type TransactionBeginPayload as bi, type TransactionBeginResponse as bj, type TransactionCommitPayload as bk, type TransactionCommitResponse as bl, type TransactionRollbackPayload as bm, RequestType as bn, ResponseStatus as bo, encodeMessage as bp, decodeMessage as bq, isEventMessage as br, isResponseEnvelope as bs, ReconnectManager as bt, LogLevel as bu, logger as bv, configureLogger as bw, setLogLevel as bx, getLogLevel as by, getLoggerConfig as bz, ConversationStore as c, type AiErrorBehavior as c$, UploadManager as c0, FlowClient as c1, type FlowRunResult as c2, type FlowCollectResult as c3, FunctionsApi as c4, HttpFunctionsApi as c5, IdentityAuthApi as c6, readTokensFromFragment as c7, type IdentityAuthResult as c8, type IdentityAuthTransport as c9, type StepFailedEvent as cA, type FlowWaitingEvent as cB, type FlowResumedEvent as cC, type FlowCompletedEvent as cD, type FlowFailedEvent as cE, type TextChunkEvent as cF, type ToolCallStartedEvent as cG, type ToolCallCompletedEvent as cH, type ThoughtChunkEvent as cI, type ConversationCreatedEvent as cJ, type MessageSavedEvent as cK, type LogEvent as cL, isTerminalEvent as cM, type RaisinReference as cN, type ContainerType as cO, type StepErrorBehavior as cP, type FlowErrorStrategy as cQ, type RetryConfig as cR, type RetryStrategy as cS, type HumanTaskType as cT, type CanonicalTaskType as cU, type TaskOption as cV, type HandoffTarget as cW, type ChatTerminationMode as cX, type ChatTerminationConfig as cY, type ChatStepConfig as cZ, type AiToolMode as c_, type IdentityInfo as ca, type IdentityMe as cb, type MagicLinkSent as cc, type MagicLinkOptions as cd, type AuthProviders as ce, type FunctionInvokeOptions as cf, type FunctionInvokeResponse as cg, type FunctionInvokeSyncResponse as ch, McpClient as ci, type McpTransport as cj, type McpFrameStream as ck, type McpJsonRpcFrame as cl, type McpToolDescriptor as cm, type McpContentBlock as cn, type McpCallToolResult as co, type McpResourceContents as cp, type McpReadResourceResult as cq, type McpResourceUpdate as cr, type McpResourceSubscription as cs, type FlowRunResponse as ct, type FlowInstanceStatus as cu, type FlowInstanceStatusResponse as cv, type FlowMetrics as cw, type StepStartedEvent as cx, type StepCompletedEvent as cy, type StepUsage as cz, type ConversationListItem as d, type AiContainerConfig as d0, type FlowDefinitionNodeBase as d1, type FlowStepProperties as d2, type FlowDefinitionStep as d3, type ContainerRule as d4, type FanOutConfig as d5, type MergeStrategy as d6, type FlowDefinitionContainer as d7, type LoopConfig as d8, type FlowDefinitionNode as d9, type ChatToolCallCompletedEvent as dA, type ChatThoughtChunkEvent as dB, type ToolCallRecord as dC, type MessageChild as dD, type PlanTask as dE, type ChatConversationCreatedEvent as dF, type ChatMessageSavedEvent as dG, type ChatMessageDeliveredEvent as dH, type ChatLogEvent as dI, ConversationManager as dJ, DEFAULT_SEND_MESSAGE_INACTIVITY_TIMEOUT_MS as dK, type ListConversationsOptions as dL, type CreateConversationOptions as dM, type SendMessageOptions as dN, type ConversationSubscription as dO, type PlanActionReceipt as dP, type PlanActionOptions as dQ, type ConversationManagerOptions as dR, projectPlansFromMessages as dS, type FlowDefinition as da, type InboxTask as db, type InboxTaskStatus as dc, type TaskCompletionResult as dd, RETRY_STRATEGIES as de, getRefDisplayName as df, getRefPath as dg, isFlowDefinitionStep as dh, isFlowDefinitionContainer as di, InboxApi as dj, type InboxApiOptions as dk, type ListTasksOptions as dl, type ListTasksResponse as dm, type ChatEvent as dn, type Conversation as dp, type ConversationType as dq, type ConversationStatus as dr, type MessageBody as ds, type ChatTextChunkEvent as dt, type ChatAssistantMessageEvent as du, type ChatWaitingEvent as dv, type ChatCompletedEvent as dw, type ChatFailedEvent as dx, type ChatDoneEvent as dy, type ChatToolCallStartedEvent as dz, ConversationListStore as e, type ConversationStoreOptions as f, type ConversationListStoreOptions as g, type ConversationListSnapshot as h, FlowsApi as i, type FlowExecutionEvent as j, type PlanProjectionTask as k, type PropertyValue as l, type RelationRef as m, type ClientOptions as n, type Credentials as o, RaisinHttpClient as p, type RetryOptions as q, type UploaderConfig as r, type FileSource as s, type BatchUploadOptions as t, type BatchUploadResult as u, type BatchProgress as v, type ReconnectOptions as w, type Answer as x, type AskOptions as y, type Citation as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-
|
|
1
|
+
import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-Bw1UwRL8.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* React adapters for the RaisinDB conversation stores.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-
|
|
1
|
+
import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-Bw1UwRL8.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* React adapters for the RaisinDB conversation stores.
|