@vibecook/truffle-native 0.3.17 → 0.3.23

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
@@ -1,360 +1,366 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
3
  /**
4
- * NapiFileTransferAdapter - Node.js wrapper for file transfer signaling.
4
+ * File transfer handle exposed to JavaScript.
5
5
  *
6
- * Handles file transfer offer/accept/reject/cancel via the mesh message bus.
7
- * Progress events use the broadcast channel (drops allowed for lag recovery).
6
+ * Obtained via `NapiNode.fileTransfer()`. Holds an `Arc<Node>` to create
7
+ * fresh `FileTransfer` handles on each method call (the Rust `FileTransfer`
8
+ * borrows `&Node`, so we can't store it across JS boundaries).
8
9
  */
9
- export declare class NapiFileTransferAdapter {
10
+ export declare class NapiFileTransfer {
10
11
  /**
11
- * Create a new FileTransferAdapter.
12
+ * Send a file to a peer.
12
13
  *
13
- * Sets up the underlying FileTransferManager and adapter with default TCP dial.
14
+ * Resolves with transfer result on success.
14
15
  */
15
- constructor(config: NapiFileTransferAdapterConfig)
16
+ sendFile(peerId: string, localPath: string, remotePath: string): Promise<NapiTransferResult>
16
17
  /**
17
- * Initiate sending a file to a target device.
18
- * Returns the transfer ID.
19
- */
20
- sendFile(targetDeviceId: string, filePath: string): Promise<string>
21
- /** Accept an incoming file transfer offer. */
22
- acceptTransfer(offer: NapiFileTransferOffer, savePath?: string | undefined | null): Promise<void>
23
- /** Reject an incoming file transfer offer. */
24
- rejectTransfer(offer: NapiFileTransferOffer, reason: string): Promise<void>
25
- /** Cancel an active transfer. */
26
- cancelTransfer(transferId: string): Promise<void>
27
- /** Get all tracked transfers. */
28
- getTransfers(): Promise<Array<NapiAdapterTransferInfo>>
29
- /**
30
- * Handle an incoming message from the mesh bus.
31
- * Call this when a file-transfer namespace message arrives.
32
- */
33
- handleBusMessage(msgType: string, payload: any): Promise<void>
34
- /**
35
- * Subscribe to adapter events (offers, progress, completed, failed, cancelled).
18
+ * Pull (download) a file from a remote peer.
36
19
  *
37
- * Only one subscriber allowed. Can be called before or after `start_manager_events`.
20
+ * Resolves with transfer result on success.
38
21
  */
39
- onEvent(callback: (err: null | Error, event: NapiFileTransferEvent) => void): void
22
+ pullFile(peerId: string, remotePath: string, localPath: string): Promise<NapiTransferResult>
23
+ /** Auto-accept all incoming file offers, saving files to `output_dir`. */
24
+ autoAccept(outputDir: string): Promise<void>
25
+ /** Auto-reject all incoming file offers. */
26
+ autoReject(): Promise<void>
40
27
  /**
41
- * Subscribe to outgoing bus messages.
28
+ * Subscribe to incoming file offers with a callback.
29
+ *
30
+ * The callback receives a `NapiFileOffer`. Use `autoAccept()` or
31
+ * `autoReject()` for automated handling, or use `onOffer()` for
32
+ * manual inspection of offers.
33
+ * Subscribe to incoming file offers with a callback.
42
34
  *
43
- * The adapter generates outgoing messages (OFFER, ACCEPT, REJECT, CANCEL)
44
- * that must be sent via the mesh message bus. Can be called before or after
45
- * `start_manager_events`.
35
+ * The callback receives `(offer, responder)` call `responder.accept(path)`
36
+ * or `responder.reject(reason)` to handle the offer. If neither is called
37
+ * within 60 seconds, the offer is auto-rejected.
46
38
  */
47
- onBusMessage(callback: (err: null | Error, message: NapiBusMessage) => void): void
39
+ onOffer(callback: (offer: FileOffer, responder: NapiOfferResponder) => void): void
48
40
  /**
49
- * Start forwarding manager events to the adapter.
41
+ * Subscribe to file transfer events.
50
42
  *
51
- * The FileTransferManager emits events (progress, complete, error) that
52
- * the adapter needs to process. Call this once after construction.
53
- * Also spawns any pending event/bus callbacks registered before a Tokio
54
- * runtime was available.
43
+ * The callback receives `NapiFileTransferEvent` objects for all
44
+ * transfer lifecycle events (hashing, progress, completed, failed, etc.).
55
45
  */
56
- startManagerEvents(): Promise<void>
46
+ onEvent(callback: (event: FileTransferEvent) => void): void
47
+ /** Set the maximum allowed transfer size in bytes. */
48
+ setMaxTransferSize(bytes: number): void
57
49
  }
58
50
 
59
51
  /**
60
- * NapiMeshNode - Node.js wrapper for TruffleRuntime.
61
- *
62
- * Manages the full lifecycle: BridgeManager, GoShim sidecar, ConnectionManager,
63
- * and MeshNode via the unified `TruffleRuntime`. The sidecar provides Tailscale
64
- * connectivity; the bridge routes TCP streams; the connection manager upgrades
65
- * them to WebSocket; and the mesh node handles device discovery, election,
66
- * and messaging.
52
+ * The main truffle node exposed to JavaScript.
67
53
  *
68
- * ## RFC 008 Phase 3
69
- * This wrapper now delegates to `TruffleRuntime` instead of manually wiring
70
- * individual components. Events are delivered as `TruffleEvent` through the
71
- * unified channel, converted to `NapiMeshEvent` for JS consumption.
54
+ * Lifecycle:
55
+ * 1. `new NapiNode()` creates an empty wrapper.
56
+ * 2. `await node.start(config)` builds and starts the underlying `Node<TailscaleProvider>`.
57
+ * 3. Use `getPeers()`, `send()`, `onPeerChange()`, etc.
58
+ * 4. `await node.stop()` — shuts down the node.
72
59
  */
73
- export declare class NapiMeshNode {
60
+ export declare class NapiNode {
61
+ /** Create a new (unstarted) NapiNode. */
62
+ constructor()
74
63
  /**
75
- * Create a new MeshNode.
64
+ * Start the node with the given configuration.
76
65
  *
77
- * The `config` parameter matches the TypeScript `MeshNodeConfig` interface.
66
+ * Resolves when the Tailscale sidecar is connected and the node is ready.
67
+ *
68
+ * # Safety
69
+ * This takes `&mut self` in an async context. The caller must ensure that
70
+ * no other calls are made on this NapiNode while `start()` is in progress.
78
71
  */
79
- constructor(config: NapiMeshNodeConfig)
72
+ start(config: NapiNodeConfig): Promise<void>
80
73
  /**
81
- * Start the mesh node.
82
- *
83
- * If `sidecarPath` was provided, this spawns the Go sidecar process,
84
- * creates a BridgeManager to route connections, and wires everything
85
- * together for full Tailscale mesh networking.
74
+ * Stop the node and release all resources.
86
75
  *
87
- * Events are delivered through the unified `TruffleEvent` channel,
88
- * converted to `NapiMeshEvent` for JS consumption.
76
+ * # Safety
77
+ * This takes `&mut self` in an async context. The caller must ensure that
78
+ * no other calls are made on this NapiNode while `stop()` is in progress.
89
79
  */
90
- start(): Promise<void>
91
- /** Stop the mesh node and sidecar. */
92
80
  stop(): Promise<void>
93
- /** Check if the node is running. */
94
- isRunning(): Promise<boolean>
95
- /** Get the local device info. */
96
- localDevice(): Promise<NapiBaseDevice>
97
- /** Get the local device ID. */
98
- deviceId(): Promise<string>
99
- /** Get all known devices. */
100
- devices(): Promise<Array<NapiBaseDevice>>
101
- /** Get a device by ID. */
102
- deviceById(id: string): Promise<NapiBaseDevice | null>
103
- /** Check if this node is the primary. */
104
- isPrimary(): Promise<boolean>
105
- /** Get the current primary device ID. */
106
- primaryId(): Promise<string | null>
107
- /** Get the current role as a string ("primary" or "secondary"). */
108
- role(): Promise<string>
81
+ /** Get the local node's identity. */
82
+ getLocalInfo(): NapiNodeIdentity
83
+ /** Get all known peers. */
84
+ getPeers(): Promise<Array<NapiPeer>>
85
+ /** Resolve a peer identifier (name or ID) to the canonical node ID. */
86
+ resolvePeerId(peerId: string): Promise<string>
87
+ /** Ping a peer and return latency info. */
88
+ ping(peerId: string): Promise<NapiPingResult>
89
+ /** Get health information from the network layer. */
90
+ health(): Promise<NapiHealthInfo>
91
+ /** Send a namespaced message to a specific peer. */
92
+ send(peerId: string, namespace: string, data: Buffer): Promise<void>
93
+ /** Broadcast a namespaced message to all connected peers. */
94
+ broadcast(namespace: string, data: Buffer): Promise<void>
109
95
  /**
110
- * Send a mesh envelope to a specific device.
111
- * Returns true if the message was sent successfully.
96
+ * Subscribe to peer change events.
97
+ *
98
+ * The callback receives `NapiPeerEvent` objects whenever peers
99
+ * join, leave, connect, disconnect, or update.
112
100
  */
113
- sendEnvelope(deviceId: string, namespace: string, msgType: string, payload: any): Promise<boolean>
114
- /** Broadcast a mesh envelope to all connected devices. */
115
- broadcastEnvelope(namespace: string, msgType: string, payload: any): Promise<void>
116
- /** Get the current auth status ("unknown", "required", "authenticated"). */
117
- authStatus(): Promise<string>
118
- /** Get the current auth URL, if auth is required. */
119
- authUrl(): Promise<string | null>
101
+ onPeerChange(callback: (event: PeerEvent) => void): void
120
102
  /**
121
- * Get the protocol version supported by this node.
103
+ * Subscribe to messages on a specific namespace.
122
104
  *
123
- * Returns the maximum protocol version this node speaks (currently 3,
124
- * the RFC 009 wire format). Use this to check compatibility with peers
125
- * or to display version info in a UI.
105
+ * The callback receives `NapiNamespacedMessage` objects.
126
106
  */
127
- protocolVersion(): number
128
- /** Get the message bus for namespace-based pub/sub. */
129
- messageBus(): NapiMessageBus
130
- /** Handle tailnet peers update from the sidecar. */
131
- handleTailnetPeers(peers: Array<NapiTailnetPeer>): Promise<void>
132
- /** Set the local device as online with its Tailscale IP. */
133
- setLocalOnline(tailscaleIp: string, dnsName?: string | undefined | null): Promise<void>
107
+ onMessage(namespace: string, callback: (msg: NamespacedMessage) => void): void
108
+ /** Get a `NapiFileTransfer` handle for file transfer operations. */
109
+ fileTransfer(): NapiFileTransfer
134
110
  /**
135
- * Subscribe to mesh events.
136
- *
137
- * Uses ThreadsafeFunction with Blocking mode per RFC 003:
138
- * - Critical events (device join/leave, election, errors) are never dropped
139
- * - If the JS event queue is full, Rust waits rather than dropping events
140
- *
141
- * The callback receives NapiMeshEvent objects with event_type, device_id, and payload.
111
+ * Get a `NapiSyncedStore` handle for synchronized state operations.
142
112
  *
143
- * Can be called multiple times to add multiple subscribers.
144
- * Can be called before or after `start()`. If called before `start()`, the
145
- * event loop is spawned when `start()` is called.
113
+ * Each call creates a new store instance with the given `store_id`.
114
+ * Multiple stores can coexist with different IDs.
146
115
  */
147
- onEvent(callback: (err: null | Error, event: NapiMeshEvent) => void): void
116
+ syncedStore(storeId: string): NapiSyncedStore
148
117
  }
149
118
 
150
119
  /**
151
- * NapiMessageBus - Node.js wrapper for MeshMessageBus.
120
+ * Responder for accepting or rejecting a file offer from JS.
152
121
  *
153
- * Provides namespace-based pub/sub for application-level messages.
122
+ * The responder is consumed on the first call to `accept()` or `reject()`.
123
+ * If neither is called, the offer times out after 60 seconds.
154
124
  */
155
- export declare class NapiMessageBus {
156
- /** Get all subscribed namespaces. */
157
- subscribedNamespaces(): Promise<Array<string>>
158
- /** Dispose the message bus, clearing all handlers. */
159
- dispose(): Promise<void>
125
+ export declare class NapiOfferResponder {
126
+ /** Accept the file offer, saving to the specified path. */
127
+ accept(savePath: string): Promise<void>
128
+ /** Reject the file offer with a reason. */
129
+ reject(reason: string): Promise<void>
160
130
  }
161
131
 
162
132
  /**
163
- * NapiStoreSyncAdapter - Node.js wrapper for cross-device state sync.
133
+ * Synchronized store handle exposed to JavaScript.
164
134
  *
165
- * In the JS layer, stores are registered via the SyncableStore trait.
166
- * For NAPI, we expose the adapter's lifecycle and message handling.
135
+ * Obtained via `NapiNode.syncedStore(storeId)`. Each store instance manages
136
+ * device-owned slices of JSON data that are automatically synchronized
137
+ * across the mesh.
167
138
  */
168
- export declare class NapiStoreSyncAdapter {
139
+ export declare class NapiSyncedStore {
140
+ /** Update this device's data in the store. */
141
+ set(data: any): Promise<void>
142
+ /** Get this device's current data, or `null` if `set()` hasn't been called. */
143
+ local(): Promise<any | null>
144
+ /** Get a specific peer's slice by device ID. */
145
+ get(deviceId: string): Promise<NapiSlice | null>
146
+ /** Get all slices (local + remote) as an array. */
147
+ all(): Promise<Array<NapiSlice>>
148
+ /** Get all device IDs that have data in this store. */
149
+ deviceIds(): Promise<Array<string>>
150
+ /** The store identifier. */
151
+ storeId(): string
152
+ /** Current local version number. */
153
+ version(): number
169
154
  /**
170
- * Create a new StoreSyncAdapter.
155
+ * Subscribe to store change events.
171
156
  *
172
- * Note: In the NAPI layer, stores must be registered separately.
173
- * This constructor creates the adapter with an empty store list.
157
+ * The callback receives `NapiStoreEvent` objects whenever local data
158
+ * changes, a peer's data is updated, or a peer is removed.
174
159
  */
175
- constructor(config: NapiStoreSyncConfig)
160
+ onChange(callback: (event: StoreEvent) => void): void
176
161
  /**
177
- * Start syncing.
162
+ * Stop the store and cancel all event-forwarding tasks.
178
163
  *
179
- * If `on_outgoing` was called before `start`, the outgoing loop is
180
- * spawned here inside the NAPI Tokio runtime context.
164
+ * # Safety
165
+ * This takes `&mut self` in an async context. The caller must ensure that
166
+ * no other calls are made on this NapiSyncedStore while `stop()` is in progress.
181
167
  */
182
- start(): Promise<void>
183
- /** Stop syncing. */
184
168
  stop(): Promise<void>
185
- /** Dispose the adapter. */
186
- dispose(): Promise<void>
187
- /** Handle an incoming sync message from a remote device. */
188
- handleSyncMessage(from: string | undefined | null, msgType: string, payload: any): Promise<void>
189
- /** Handle a device going offline. */
190
- handleDeviceOffline(deviceId: string): Promise<void>
191
- /** Handle a new device being discovered. */
192
- handleDeviceDiscovered(deviceId: string): Promise<void>
193
- /** Notify that a local store changed (triggers sync broadcast). */
194
- handleLocalChanged(storeId: string, slice: NapiDeviceSlice): Promise<void>
195
- /**
196
- * Subscribe to outgoing sync messages.
197
- *
198
- * The callback receives messages that should be broadcast to all devices
199
- * via the mesh message bus. Can be called before or after `start()`.
200
- */
201
- onOutgoing(callback: (err: null | Error, message: NapiOutgoingSyncMessage) => void): void
202
169
  }
203
170
 
204
- /** Transfer info returned to JS. */
205
- export interface NapiAdapterTransferInfo {
206
- transferId: string
207
- direction: string
208
- state: string
209
- peerDeviceId: string
171
+ /** An incoming file offer from a remote peer. */
172
+ export interface NapiFileOffer {
173
+ /** Stable node ID of the sending peer. */
174
+ fromPeer: string
175
+ /** Human-readable name of the sending peer. */
176
+ fromName: string
177
+ /** File name being offered. */
210
178
  fileName: string
211
- fileSize: number
212
- bytesTransferred: number
213
- percent: number
214
- bytesPerSecond: number
215
- eta: number
216
- }
217
-
218
- /** A device in the mesh network (JS representation). */
219
- export interface NapiBaseDevice {
220
- id: string
221
- deviceType: string
222
- name: string
223
- tailscaleHostname: string
224
- tailscaleDnsName?: string
225
- tailscaleIp?: string
226
- role?: string
227
- status: string
228
- capabilities: Array<string>
229
- metadata?: any
230
- lastSeen?: number
231
- startedAt?: number
232
- os?: string
233
- latencyMs?: number
179
+ /** File size in bytes. */
180
+ size: number
181
+ /** Expected SHA-256 hash (hex). */
182
+ sha256: string
183
+ /** Suggested save path from the sender. */
184
+ suggestedPath: string
185
+ /** Unique token for this transfer. */
186
+ token: string
234
187
  }
235
188
 
236
- /** Outgoing bus message (sent from adapter to be relayed via mesh). */
237
- export interface NapiBusMessage {
238
- targetDeviceId: string
239
- messageType: string
240
- payload: string
189
+ /** Events emitted by the file transfer subsystem. */
190
+ export interface NapiFileTransferEvent {
191
+ /**
192
+ * Event type: "offer_received", "hashing", "waiting_for_accept",
193
+ * "progress", "completed", "rejected", "failed".
194
+ */
195
+ eventType: string
196
+ /** Transfer token (if applicable). */
197
+ token?: string
198
+ /** File name (if applicable). */
199
+ fileName?: string
200
+ /** Direction: "send" or "receive" (if applicable). */
201
+ direction?: string
202
+ /** Progress info (present for "progress" events). */
203
+ progress?: NapiTransferProgress
204
+ /** Offer info (present for "offer_received" events). */
205
+ offer?: NapiFileOffer
206
+ /** Bytes transferred (present for "completed" events). */
207
+ bytesTransferred?: number
208
+ /** SHA-256 hash (present for "completed" events). */
209
+ sha256?: string
210
+ /** Elapsed seconds (present for "completed" events). */
211
+ elapsedSecs?: number
212
+ /** Reason for rejection or failure. */
213
+ reason?: string
214
+ /** Bytes hashed so far (present for "hashing" events). */
215
+ bytesHashed?: number
216
+ /** Total bytes to hash (present for "hashing" events). */
217
+ totalBytes?: number
241
218
  }
242
219
 
243
- /** Device slice (JS representation). */
244
- export interface NapiDeviceSlice {
245
- deviceId: string
246
- data: any
247
- updatedAt: number
248
- version: number
220
+ /** Health information from the network layer. */
221
+ export interface NapiHealthInfo {
222
+ /** Current backend state (e.g., "Running", "NeedsLogin"). */
223
+ state: string
224
+ /** Key expiry timestamp (RFC 3339), if applicable. */
225
+ keyExpiry?: string
226
+ /** Active health warnings. */
227
+ warnings: Array<string>
228
+ /** Whether the network is fully operational. */
229
+ healthy: boolean
249
230
  }
250
231
 
251
- /** File transfer adapter configuration (JS representation). */
252
- export interface NapiFileTransferAdapterConfig {
253
- /** Local device ID. */
254
- deviceId: string
255
- /** Local address for file transfers (e.g. "host.ts.net:9417"). */
256
- localAddr: string
257
- /** Default output directory for received files. */
258
- outputDir: string
259
- /** Maximum file size in bytes. */
260
- maxFileSize?: number
261
- /** Max concurrent incoming transfers. */
262
- maxConcurrentRecv?: number
263
- /** Progress event interval in milliseconds. */
264
- progressIntervalMs?: number
265
- /** Progress event byte threshold. */
266
- progressBytes?: number
232
+ /** A message received on a specific namespace. */
233
+ export interface NapiNamespacedMessage {
234
+ /** Stable node ID of the sender. */
235
+ from: string
236
+ /** Namespace the message was sent on. */
237
+ namespace: string
238
+ /** Application-defined message type. */
239
+ msgType: string
240
+ /** Opaque JSON payload (as a JS value via serde). */
241
+ payload: any
242
+ /** Millisecond Unix timestamp from the sender, if set. */
243
+ timestamp?: number
267
244
  }
268
245
 
269
- /** File transfer event delivered to JS. */
270
- export interface NapiFileTransferEvent {
271
- eventType: string
272
- transferId?: string
273
- payload: any
246
+ /** Configuration for starting a Node. */
247
+ export interface NapiNodeConfig {
248
+ /** Human-readable node name (used as Tailscale hostname). */
249
+ name: string
250
+ /** Path to the Go sidecar binary. */
251
+ sidecarPath: string
252
+ /** Tailscale state directory. Defaults to `/tmp/truffle-{name}`. */
253
+ stateDir?: string
254
+ /** Tailscale auth key for headless authentication. */
255
+ authKey?: string
256
+ /** Whether the node is ephemeral (auto-removed from tailnet on shutdown). */
257
+ ephemeral?: boolean
258
+ /** WebSocket listen port. Defaults to 9417. */
259
+ wsPort?: number
274
260
  }
275
261
 
276
- /** File transfer offer (JS representation, for accept/reject). */
277
- export interface NapiFileTransferOffer {
278
- transferId: string
279
- senderDeviceId: string
280
- senderAddr: string
281
- fileName: string
282
- fileSize: number
283
- fileSha256: string
284
- token: string
262
+ /** Identity of the local node. */
263
+ export interface NapiNodeIdentity {
264
+ /** Stable node ID. */
265
+ id: string
266
+ /** Hostname on the network. */
267
+ hostname: string
268
+ /** Human-readable display name. */
269
+ name: string
270
+ /** DNS name on the tailnet, if available. */
271
+ dnsName?: string
272
+ /** Tailscale IP address as a string, if available. */
273
+ ip?: string
285
274
  }
286
275
 
287
- /** An incoming mesh message from a peer (JS representation). */
288
- export interface NapiIncomingMessage {
289
- from?: string
290
- connectionId: string
291
- namespace: string
292
- msgType: string
293
- payload: any
276
+ /** A peer as seen by application code. */
277
+ export interface NapiPeer {
278
+ /** Stable node ID. */
279
+ id: string
280
+ /** Human-readable name (hostname). */
281
+ name: string
282
+ /** Network IP address as a string. */
283
+ ip: string
284
+ /** Whether the peer is online (from Layer 3). */
285
+ online: boolean
286
+ /** Whether there is an active WebSocket connection. */
287
+ wsConnected: boolean
288
+ /** Connection type description (e.g., "direct" or "relay:ord"). */
289
+ connectionType: string
290
+ /** Operating system, if known. */
291
+ os?: string
292
+ /** Last time the peer was seen online (RFC 3339 string). */
293
+ lastSeen?: string
294
294
  }
295
295
 
296
- /** A mesh event delivered to JS via ThreadsafeFunction. */
297
- export interface NapiMeshEvent {
296
+ /** A peer change event delivered to JS. */
297
+ export interface NapiPeerEvent {
298
+ /** Event type: "joined", "left", "updated", "ws_connected", "ws_disconnected", "auth_required". */
298
299
  eventType: string
299
- deviceId?: string
300
- payload: any
300
+ /** Peer ID (present for peer events, empty for auth_required). */
301
+ peerId: string
302
+ /** Full peer info (present for joined/updated events). */
303
+ peer?: NapiPeer
304
+ /** Auth URL (present only for auth_required events). */
305
+ authUrl?: string
301
306
  }
302
307
 
303
- /** Configuration for creating a MeshNode. */
304
- export interface NapiMeshNodeConfig {
305
- deviceId: string
306
- deviceName: string
307
- deviceType: string
308
- hostnamePrefix: string
309
- /**
310
- * Path to the Go sidecar binary. Optional — use `resolveSidecarPath()`
311
- * from `@vibecook/truffle` for automatic platform detection.
312
- */
313
- sidecarPath?: string
314
- stateDir?: string
315
- authKey?: string
316
- preferPrimary?: boolean
317
- staticPath?: string
318
- capabilities?: Array<string>
319
- timing?: NapiMeshTimingConfig
320
- /** If true, the node is ephemeral (cleaned up when offline). */
321
- ephemeral?: boolean
322
- /** ACL tags to advertise (e.g. ["tag:truffle"]). */
323
- tags?: Array<string>
308
+ /** Result of a network-level ping. */
309
+ export interface NapiPingResult {
310
+ /** Round-trip latency in milliseconds. */
311
+ latencyMs: number
312
+ /** Connection type description (e.g., "direct" or "relay:sfo"). */
313
+ connection: string
314
+ /** Direct peer endpoint address, if available. */
315
+ peerAddr?: string
324
316
  }
325
317
 
326
- /** Timing configuration for the mesh. */
327
- export interface NapiMeshTimingConfig {
328
- announceIntervalMs?: number
329
- discoveryTimeoutMs?: number
330
- electionTimeoutMs?: number
331
- primaryLossGraceMs?: number
332
- heartbeatPingMs?: number
333
- heartbeatTimeoutMs?: number
318
+ /** A versioned slice of data owned by a single device. */
319
+ export interface NapiSlice {
320
+ /** Device that owns this slice (stable node ID). */
321
+ deviceId: string
322
+ /** The data (JSON value). */
323
+ data: any
324
+ /** Monotonically increasing version (per-device). */
325
+ version: number
326
+ /** When this version was created (Unix milliseconds). */
327
+ updatedAt: number
334
328
  }
335
329
 
336
- /** Outgoing sync message delivered to JS for broadcasting. */
337
- export interface NapiOutgoingSyncMessage {
338
- msgType: string
339
- payload: any
330
+ /** A store change event delivered to JS. */
331
+ export interface NapiStoreEvent {
332
+ /** Event type: "local_changed", "peer_updated", "peer_removed". */
333
+ eventType: string
334
+ /** Device ID (present for peer_updated/peer_removed events). */
335
+ deviceId?: string
336
+ /** Data payload (present for local_changed/peer_updated events). */
337
+ data?: any
338
+ /** Version number (present for peer_updated events). */
339
+ version?: number
340
340
  }
341
341
 
342
- /** Store sync configuration (JS representation). */
343
- export interface NapiStoreSyncConfig {
344
- localDeviceId: string
342
+ /** Progress update for an in-flight file transfer. */
343
+ export interface NapiTransferProgress {
344
+ /** Unique token for this transfer. */
345
+ token: string
346
+ /** Direction: "send" or "receive". */
347
+ direction: string
348
+ /** File name being transferred. */
349
+ fileName: string
350
+ /** Bytes transferred so far. */
351
+ bytesTransferred: number
352
+ /** Total file size in bytes. */
353
+ totalBytes: number
354
+ /** Current transfer speed in bytes per second. */
355
+ speedBps: number
345
356
  }
346
357
 
347
- /** Tailnet peer info (JS representation). */
348
- export interface NapiTailnetPeer {
349
- id: string
350
- hostname: string
351
- dnsName: string
352
- tailscaleIps: Array<string>
353
- online: boolean
354
- os?: string
355
- curAddr?: string
356
- relay?: string
357
- lastSeen?: string
358
- keyExpiry?: string
359
- expired?: boolean
358
+ /** Result of a completed file transfer. */
359
+ export interface NapiTransferResult {
360
+ /** Number of bytes transferred. */
361
+ bytesTransferred: number
362
+ /** SHA-256 hash of the transferred file. */
363
+ sha256: string
364
+ /** Elapsed time in seconds. */
365
+ elapsedSecs: number
360
366
  }
package/index.js CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('@vibecook/truffle-native-android-arm64')
79
79
  const bindingPackageVersion = require('@vibecook/truffle-native-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('@vibecook/truffle-native-android-arm-eabi')
95
95
  const bindingPackageVersion = require('@vibecook/truffle-native-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('@vibecook/truffle-native-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('@vibecook/truffle-native-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('@vibecook/truffle-native-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('@vibecook/truffle-native-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@vibecook/truffle-native-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('@vibecook/truffle-native-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('@vibecook/truffle-native-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('@vibecook/truffle-native-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('@vibecook/truffle-native-darwin-universal')
184
184
  const bindingPackageVersion = require('@vibecook/truffle-native-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('@vibecook/truffle-native-darwin-x64')
200
200
  const bindingPackageVersion = require('@vibecook/truffle-native-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('@vibecook/truffle-native-darwin-arm64')
216
216
  const bindingPackageVersion = require('@vibecook/truffle-native-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('@vibecook/truffle-native-freebsd-x64')
236
236
  const bindingPackageVersion = require('@vibecook/truffle-native-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('@vibecook/truffle-native-freebsd-arm64')
252
252
  const bindingPackageVersion = require('@vibecook/truffle-native-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('@vibecook/truffle-native-linux-x64-musl')
273
273
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('@vibecook/truffle-native-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('@vibecook/truffle-native-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('@vibecook/truffle-native-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('@vibecook/truffle-native-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('@vibecook/truffle-native-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('@vibecook/truffle-native-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('@vibecook/truffle-native-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('@vibecook/truffle-native-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('@vibecook/truffle-native-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@vibecook/truffle-native-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@vibecook/truffle-native-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('@vibecook/truffle-native-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('@vibecook/truffle-native-openharmony-arm64')
478
478
  const bindingPackageVersion = require('@vibecook/truffle-native-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('@vibecook/truffle-native-openharmony-x64')
494
494
  const bindingPackageVersion = require('@vibecook/truffle-native-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('@vibecook/truffle-native-openharmony-arm')
510
510
  const bindingPackageVersion = require('@vibecook/truffle-native-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '0.3.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 0.3.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -576,7 +576,7 @@ if (!nativeBinding) {
576
576
  }
577
577
 
578
578
  module.exports = nativeBinding
579
- module.exports.NapiFileTransferAdapter = nativeBinding.NapiFileTransferAdapter
580
- module.exports.NapiMeshNode = nativeBinding.NapiMeshNode
581
- module.exports.NapiMessageBus = nativeBinding.NapiMessageBus
582
- module.exports.NapiStoreSyncAdapter = nativeBinding.NapiStoreSyncAdapter
579
+ module.exports.NapiFileTransfer = nativeBinding.NapiFileTransfer
580
+ module.exports.NapiNode = nativeBinding.NapiNode
581
+ module.exports.NapiOfferResponder = nativeBinding.NapiOfferResponder
582
+ module.exports.NapiSyncedStore = nativeBinding.NapiSyncedStore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecook/truffle-native",
3
- "version": "0.3.17",
3
+ "version": "0.3.23",
4
4
  "description": "Mesh networking for local-first apps, built on Tailscale (native addon)",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
Binary file
Binary file
Binary file
Binary file
Binary file