@raisindb/client 0.1.54 → 0.1.56
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-WFBAWOVM.mjs → chunk-3A3ULBDO.mjs} +3 -3
- package/dist/{chunk-JRFBP4WK.mjs → chunk-4D45SBYO.mjs} +2 -2
- package/dist/{chunk-VZX3ACSO.mjs → chunk-BGU5L4PF.mjs} +3 -3
- package/dist/{chunk-OLJOZIIU.mjs → chunk-GRC5AZMU.mjs} +23 -4
- package/dist/chunk-GRC5AZMU.mjs.map +1 -0
- package/dist/{chunk-DJDP5CX6.mjs → chunk-T26GAHFZ.mjs} +2 -2
- package/dist/{conversation-list-store-CrmmmVKE.d.mts → conversation-list-store-ZtQuHSJ6.d.mts} +188 -4
- package/dist/{conversation-list-store-CrmmmVKE.d.ts → conversation-list-store-ZtQuHSJ6.d.ts} +188 -4
- package/dist/{index-DkVt51MH.d.mts → index-Dz2KIWoc.d.mts} +1 -1
- package/dist/{index-DcJiy1S6.d.ts → index-um2A-Myw.d.ts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +142 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -34
- 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 +22 -3
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +3 -3
- package/dist/{svelte-sql-C0CmmhAL.d.ts → svelte-sql-CBExaUVi.d.ts} +1 -1
- package/dist/{svelte-sql-RNJfHu0B.d.mts → svelte-sql-i2ZwTvv2.d.mts} +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +22 -3
- 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 +22 -3
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-OLJOZIIU.mjs.map +0 -1
- /package/dist/{chunk-WFBAWOVM.mjs.map → chunk-3A3ULBDO.mjs.map} +0 -0
- /package/dist/{chunk-JRFBP4WK.mjs.map → chunk-4D45SBYO.mjs.map} +0 -0
- /package/dist/{chunk-VZX3ACSO.mjs.map → chunk-BGU5L4PF.mjs.map} +0 -0
- /package/dist/{chunk-DJDP5CX6.mjs.map → chunk-T26GAHFZ.mjs.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FlowClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T26GAHFZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ConversationListStore,
|
|
6
6
|
ConversationStore
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GRC5AZMU.mjs";
|
|
8
8
|
|
|
9
9
|
// src/integrations/react/use-auth.ts
|
|
10
10
|
function createUseAuth(react, context) {
|
|
@@ -529,4 +529,4 @@ export {
|
|
|
529
529
|
useFlow,
|
|
530
530
|
createRaisinReact
|
|
531
531
|
};
|
|
532
|
-
//# sourceMappingURL=chunk-
|
|
532
|
+
//# sourceMappingURL=chunk-3A3ULBDO.mjs.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
ConversationListStore,
|
|
9
9
|
ConversationStore,
|
|
10
10
|
logger
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GRC5AZMU.mjs";
|
|
12
12
|
|
|
13
13
|
// src/integrations/vue/vue-auth.ts
|
|
14
14
|
function createUseAuth(vue) {
|
|
@@ -167,4 +167,4 @@ function createRaisinVue(vue) {
|
|
|
167
167
|
export {
|
|
168
168
|
createRaisinVue
|
|
169
169
|
};
|
|
170
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-4D45SBYO.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FlowClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T26GAHFZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ConversationListStore,
|
|
6
6
|
ConversationStore
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GRC5AZMU.mjs";
|
|
8
8
|
|
|
9
9
|
// src/integrations/svelte/svelte-flow.ts
|
|
10
10
|
function createFlowAdapter(options) {
|
|
@@ -187,4 +187,4 @@ export {
|
|
|
187
187
|
createFlowAdapter,
|
|
188
188
|
RAISIN_CONTEXT_KEY
|
|
189
189
|
};
|
|
190
|
-
//# sourceMappingURL=chunk-
|
|
190
|
+
//# sourceMappingURL=chunk-BGU5L4PF.mjs.map
|
|
@@ -412,6 +412,15 @@ function parsePlanTasks(rawTasks) {
|
|
|
412
412
|
};
|
|
413
413
|
}).filter((task) => task !== null);
|
|
414
414
|
}
|
|
415
|
+
var TERMINAL_TASK_STATUSES = /* @__PURE__ */ new Set(["completed", "cancelled"]);
|
|
416
|
+
var TERMINAL_PLAN_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
|
|
417
|
+
function setPlanStatus(plan, nextStatus) {
|
|
418
|
+
if (!nextStatus) return;
|
|
419
|
+
if (TERMINAL_PLAN_STATUSES.has(plan.status) && !TERMINAL_PLAN_STATUSES.has(nextStatus)) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
plan.status = nextStatus;
|
|
423
|
+
}
|
|
415
424
|
function upsertTask(plan, nextTask) {
|
|
416
425
|
const existingIndex = plan.tasks.findIndex(
|
|
417
426
|
(task) => nextTask.taskId && task.taskId === nextTask.taskId || !nextTask.taskId && task.title === nextTask.title
|
|
@@ -420,8 +429,12 @@ function upsertTask(plan, nextTask) {
|
|
|
420
429
|
plan.tasks.push(nextTask);
|
|
421
430
|
return;
|
|
422
431
|
}
|
|
432
|
+
const existing = plan.tasks[existingIndex];
|
|
433
|
+
if (TERMINAL_TASK_STATUSES.has(existing.status) && !TERMINAL_TASK_STATUSES.has(nextTask.status)) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
423
436
|
plan.tasks[existingIndex] = {
|
|
424
|
-
...
|
|
437
|
+
...existing,
|
|
425
438
|
...nextTask
|
|
426
439
|
};
|
|
427
440
|
}
|
|
@@ -465,7 +478,7 @@ function projectPlansFromMessages(messages) {
|
|
|
465
478
|
plan.planPath = planPath ?? plan.planPath;
|
|
466
479
|
plan.planId = planId ?? plan.planId;
|
|
467
480
|
plan.title = asString(data.title) || plan.title;
|
|
468
|
-
plan
|
|
481
|
+
setPlanStatus(plan, asString(data.status));
|
|
469
482
|
plan.requiresApproval = Boolean(data.requires_approval) || plan.status === "pending_approval";
|
|
470
483
|
plan.sourceMessagePath = message.path ?? plan.sourceMessagePath;
|
|
471
484
|
const parsedTasks = parsePlanTasks(data.tasks);
|
|
@@ -481,7 +494,7 @@ function projectPlansFromMessages(messages) {
|
|
|
481
494
|
const plan = ensurePlan(plans, key, "Plan", timestamp);
|
|
482
495
|
plan.planPath = planPath ?? plan.planPath;
|
|
483
496
|
plan.planId = planId ?? plan.planId;
|
|
484
|
-
plan
|
|
497
|
+
setPlanStatus(plan, asString(data.plan_status));
|
|
485
498
|
plan.requiresApproval = plan.status === "pending_approval";
|
|
486
499
|
const taskUpdate = {
|
|
487
500
|
taskId: asString(data.task_id),
|
|
@@ -508,6 +521,12 @@ function projectPlansFromMessages(messages) {
|
|
|
508
521
|
}
|
|
509
522
|
}
|
|
510
523
|
}
|
|
524
|
+
for (const plan of plans.values()) {
|
|
525
|
+
if (!TERMINAL_PLAN_STATUSES.has(plan.status) && plan.tasks.length > 0 && plan.tasks.every((task) => TERMINAL_TASK_STATUSES.has(task.status))) {
|
|
526
|
+
plan.status = "completed";
|
|
527
|
+
plan.requiresApproval = false;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
511
530
|
return [...plans.values()].sort((a, b) => {
|
|
512
531
|
const aTime = Date.parse(a.updatedAt || "");
|
|
513
532
|
const bTime = Date.parse(b.updatedAt || "");
|
|
@@ -1345,4 +1364,4 @@ export {
|
|
|
1345
1364
|
ConversationStore,
|
|
1346
1365
|
ConversationListStore
|
|
1347
1366
|
};
|
|
1348
|
-
//# sourceMappingURL=chunk-
|
|
1367
|
+
//# sourceMappingURL=chunk-GRC5AZMU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/reconnect.ts","../src/logger.ts","../src/connection.ts","../src/utils/home-path.ts","../src/utils/plan-projection.ts","../src/utils/chat-events.ts","../src/stores/conversation-store.ts","../src/stores/conversation-list-store.ts"],"sourcesContent":["/**\n * Reconnection manager with exponential backoff\n */\n\n/**\n * Reconnection strategy options\n */\nexport interface ReconnectOptions {\n /** Initial delay in milliseconds (default: 1000) */\n initialDelay?: number;\n /** Maximum delay in milliseconds (default: 30000) */\n maxDelay?: number;\n /** Backoff multiplier (default: 2) */\n backoffMultiplier?: number;\n /** Maximum number of reconnection attempts (default: Infinity) */\n maxAttempts?: number;\n /** Add random jitter to delay (default: true). Jitter is +/- 25% of the computed delay. */\n jitter?: boolean;\n}\n\n/**\n * Reconnection manager with exponential backoff\n */\nexport class ReconnectManager {\n private currentDelay: number;\n private attempts = 0;\n private reconnectTimeout?: NodeJS.Timeout;\n private isReconnecting = false;\n\n private readonly initialDelay: number;\n private readonly maxDelay: number;\n private readonly backoffMultiplier: number;\n private readonly maxAttempts: number;\n private readonly jitter: boolean;\n\n constructor(options: ReconnectOptions = {}) {\n this.initialDelay = options.initialDelay ?? 1000;\n this.maxDelay = options.maxDelay ?? 30000;\n this.backoffMultiplier = options.backoffMultiplier ?? 2;\n this.maxAttempts = options.maxAttempts ?? Infinity;\n this.jitter = options.jitter ?? true;\n this.currentDelay = this.initialDelay;\n }\n\n /**\n * Schedule a reconnection attempt\n *\n * @param callback - Function to call when it's time to reconnect\n * @returns true if reconnection was scheduled, false if max attempts reached\n */\n scheduleReconnect(callback: () => void | Promise<void>): boolean {\n // Check if we've exceeded max attempts\n if (this.attempts >= this.maxAttempts) {\n return false;\n }\n\n // Clear any existing timeout\n this.cancelReconnect();\n\n this.isReconnecting = true;\n this.attempts++;\n\n // Apply jitter: +/- 25% of the computed delay\n let delay = this.currentDelay;\n if (this.jitter) {\n const jitterRange = delay * 0.25;\n delay += (Math.random() * 2 - 1) * jitterRange;\n delay = Math.max(0, Math.round(delay));\n }\n\n this.reconnectTimeout = setTimeout(async () => {\n try {\n await callback();\n // If successful, reset the delay\n this.reset();\n } catch (error) {\n // Increase delay for next attempt\n this.currentDelay = Math.min(\n this.currentDelay * this.backoffMultiplier,\n this.maxDelay\n );\n }\n }, delay);\n\n return true;\n }\n\n /**\n * Cancel any pending reconnection attempt\n */\n cancelReconnect(): void {\n if (this.reconnectTimeout) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = undefined;\n }\n this.isReconnecting = false;\n }\n\n /**\n * Reset the reconnection state (call after successful connection)\n */\n reset(): void {\n this.cancelReconnect();\n this.currentDelay = this.initialDelay;\n this.attempts = 0;\n }\n\n /**\n * Check if currently in reconnection mode\n */\n isActive(): boolean {\n return this.isReconnecting;\n }\n\n /**\n * Get the current number of reconnection attempts\n */\n getAttempts(): number {\n return this.attempts;\n }\n\n /**\n * Get the current delay in milliseconds\n */\n getCurrentDelay(): number {\n return this.currentDelay;\n }\n\n /**\n * Check if max attempts have been reached\n */\n hasReachedMaxAttempts(): boolean {\n return this.attempts >= this.maxAttempts;\n }\n}\n","/**\n * Configurable logger for RaisinDB client\n */\n\n/**\n * Log levels in order of verbosity (lower = less verbose)\n */\nexport enum LogLevel {\n Silent = 0,\n Error = 1,\n Warn = 2,\n Info = 3,\n Debug = 4,\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Current log level (default: Error) */\n level: LogLevel;\n /** Prefix for all log messages (default: \"[RaisinDB]\") */\n prefix: string;\n}\n\n/**\n * Global logger configuration\n */\nlet config: LoggerConfig = {\n level: LogLevel.Error,\n prefix: '[RaisinDB]',\n};\n\n/**\n * Configure the logger\n *\n * @param options - Logger configuration options\n *\n * @example\n * ```typescript\n * import { configureLogger, LogLevel } from '@raisindb/client';\n *\n * // Enable debug logging\n * configureLogger({ level: LogLevel.Debug });\n *\n * // Disable all logging\n * configureLogger({ level: LogLevel.Silent });\n * ```\n */\nexport function configureLogger(options: Partial<LoggerConfig>): void {\n config = { ...config, ...options };\n}\n\n/**\n * Get current logger configuration\n */\nexport function getLoggerConfig(): LoggerConfig {\n return { ...config };\n}\n\n/**\n * Set log level\n *\n * @param level - Log level to set\n */\nexport function setLogLevel(level: LogLevel): void {\n config.level = level;\n}\n\n/**\n * Get current log level\n */\nexport function getLogLevel(): LogLevel {\n return config.level;\n}\n\n/**\n * Logger instance with level-aware logging methods\n */\nexport const logger = {\n /**\n * Log debug message (only shown when level >= Debug)\n */\n debug(...args: unknown[]): void {\n if (config.level >= LogLevel.Debug) {\n console.log(config.prefix, ...args);\n }\n },\n\n /**\n * Log info message (only shown when level >= Info)\n */\n info(...args: unknown[]): void {\n if (config.level >= LogLevel.Info) {\n console.log(config.prefix, ...args);\n }\n },\n\n /**\n * Log warning message (only shown when level >= Warn)\n */\n warn(...args: unknown[]): void {\n if (config.level >= LogLevel.Warn) {\n console.warn(config.prefix, ...args);\n }\n },\n\n /**\n * Log error message (only shown when level >= Error)\n */\n error(...args: unknown[]): void {\n if (config.level >= LogLevel.Error) {\n console.error(config.prefix, ...args);\n }\n },\n};\n\nif (typeof globalThis !== 'undefined') {\n (globalThis as any).__raisinDebug = (enable = true) => {\n setLogLevel(enable ? LogLevel.Debug : LogLevel.Error);\n console.log(`[RaisinDB] Debug logging ${enable ? 'ENABLED' : 'DISABLED'} (includes server handler logs)`);\n };\n}\n","/**\n * Universal WebSocket connection manager\n *\n * Detects environment (browser vs Node.js) and uses appropriate WebSocket implementation.\n * Handles auto-reconnect, heartbeat, and connection state management.\n */\n\nimport { EventEmitter } from 'events';\nimport { ReconnectManager, ReconnectOptions } from './utils/reconnect';\nimport { logger } from './logger';\n\n/**\n * Connection state\n */\nexport enum ConnectionState {\n Disconnected = 'disconnected',\n Connecting = 'connecting',\n Connected = 'connected',\n Reconnecting = 'reconnecting',\n Closed = 'closed',\n}\n\n/**\n * Connection options\n */\nexport interface ConnectionOptions {\n /** Auto-reconnect on disconnect (default: true) */\n autoReconnect?: boolean;\n /** Reconnection options */\n reconnectOptions?: ReconnectOptions;\n /** Heartbeat interval in milliseconds (default: 30000, 0 to disable) */\n heartbeatInterval?: number;\n /** Heartbeat timeout in milliseconds (default: 5000) */\n heartbeatTimeout?: number;\n /** WebSocket protocols */\n protocols?: string | string[];\n /**\n * Extra headers to send on the WebSocket upgrade request\n * (e.g. `x-tenant-id` for tenant-less `/ws` URLs).\n *\n * Only honored by WebSocket implementations that support custom headers\n * (Node.js `ws` package). Browser WebSockets silently ignore them — the\n * server then resolves the tenant from the request (default: \"default\").\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Connection events\n */\nexport interface ConnectionEvents {\n stateChange: (state: ConnectionState) => void;\n message: (data: ArrayBuffer) => void;\n error: (error: Error) => void;\n close: (event: CloseEvent) => void;\n}\n\n/**\n * Type for WebSocket implementation (browser or Node.js)\n */\ntype WebSocketImpl = typeof WebSocket | typeof import('ws').WebSocket;\n\n/**\n * Get the appropriate WebSocket implementation for the current environment\n */\nfunction getWebSocketImpl(): WebSocketImpl {\n // Browser environment\n if (typeof WebSocket !== 'undefined') {\n return WebSocket as WebSocketImpl;\n }\n\n // Node.js environment\n try {\n // Use dynamic import to avoid bundler issues\n const ws = require('ws');\n return ws.WebSocket || ws.default || ws;\n } catch (error) {\n throw new Error(\n 'WebSocket implementation not found. In Node.js, please install the \"ws\" package: npm install ws'\n );\n }\n}\n\n/**\n * Universal WebSocket connection manager\n */\nexport class Connection extends EventEmitter {\n private ws?: WebSocket;\n private url: string;\n private state: ConnectionState = ConnectionState.Disconnected;\n private reconnectManager: ReconnectManager;\n private heartbeatTimer?: NodeJS.Timeout;\n private heartbeatTimeoutTimer?: NodeJS.Timeout;\n private options: Required<Omit<ConnectionOptions, 'reconnectOptions' | 'protocols' | 'headers'>> & {\n protocols?: string | string[];\n headers?: Record<string, string>;\n };\n private WebSocketImpl: WebSocketImpl;\n private manualClose = false;\n\n constructor(url: string, options: ConnectionOptions = {}) {\n super();\n // Convert raisin:// / raisins:// to ws:// / wss:// for the WebSocket layer\n this.url = url\n .replace(/^raisin:\\/\\//, 'ws://')\n .replace(/^raisins:\\/\\//, 'wss://');\n this.options = {\n autoReconnect: options.autoReconnect ?? true,\n heartbeatInterval: options.heartbeatInterval ?? 30000,\n heartbeatTimeout: options.heartbeatTimeout ?? 5000,\n protocols: options.protocols,\n headers: options.headers,\n };\n this.reconnectManager = new ReconnectManager(options.reconnectOptions);\n this.WebSocketImpl = getWebSocketImpl();\n }\n\n /**\n * Connect to the WebSocket server\n */\n async connect(): Promise<void> {\n if (this.state === ConnectionState.Connected || this.state === ConnectionState.Connecting) {\n return;\n }\n\n this.manualClose = false;\n this.setState(ConnectionState.Connecting);\n\n return new Promise((resolve, reject) => {\n try {\n // Create WebSocket instance.\n // The third argument (upgrade headers) is only understood by the\n // Node.js `ws` package. Browsers do NOT simply ignore it - Chromium\n // fails the handshake when a third argument is passed - so only pass\n // it to non-browser implementations. Browser connections rely on the\n // server-side tenant resolution instead of upgrade headers.\n const isBrowserWebSocket =\n typeof WebSocket !== 'undefined' && this.WebSocketImpl === WebSocket;\n this.ws = (\n isBrowserWebSocket || !this.options.headers\n ? new (this.WebSocketImpl as any)(this.url, this.options.protocols)\n : new (this.WebSocketImpl as any)(this.url, this.options.protocols, {\n headers: this.options.headers,\n })\n ) as WebSocket;\n\n // Set binary type for MessagePack\n this.ws.binaryType = 'arraybuffer';\n\n // Handle open event\n this.ws.onopen = () => {\n this.setState(ConnectionState.Connected);\n this.reconnectManager.reset();\n this.startHeartbeat();\n resolve();\n };\n\n // Handle message event\n this.ws.onmessage = (event: MessageEvent) => {\n logger.debug(`WebSocket onmessage fired - data type: ${typeof event.data}, is ArrayBuffer: ${event.data instanceof ArrayBuffer}`);\n this.resetHeartbeat();\n const data = event.data as ArrayBuffer;\n logger.debug(`Received binary message - size: ${data.byteLength} bytes`);\n logger.debug(`Emitting 'message' event to client handlers`);\n this.emit('message', data);\n };\n\n // Handle error event\n this.ws.onerror = () => {\n const error = new Error('WebSocket error occurred');\n this.emit('error', error);\n if (this.state === ConnectionState.Connecting) {\n reject(error);\n }\n };\n\n // Handle close event\n this.ws.onclose = (event: CloseEvent) => {\n this.stopHeartbeat();\n this.emit('close', event);\n\n if (!this.manualClose && this.options.autoReconnect) {\n this.setState(ConnectionState.Reconnecting);\n this.reconnect();\n } else {\n this.setState(ConnectionState.Disconnected);\n }\n\n if (this.state === ConnectionState.Connecting) {\n reject(new Error(`Connection closed: ${event.reason || 'Unknown reason'}`));\n }\n };\n } catch (error) {\n this.setState(ConnectionState.Disconnected);\n reject(error);\n }\n });\n }\n\n /**\n * Disconnect from the WebSocket server\n */\n disconnect(): void {\n this.manualClose = true;\n this.reconnectManager.cancelReconnect();\n this.stopHeartbeat();\n\n if (this.ws) {\n this.ws.close(1000, 'Client disconnect');\n this.ws = undefined;\n }\n\n this.setState(ConnectionState.Closed);\n }\n\n /**\n * Send data through the WebSocket\n *\n * @param data - Data to send (Uint8Array for MessagePack)\n */\n send(data: Uint8Array): void {\n if (this.state !== ConnectionState.Connected || !this.ws) {\n throw new Error('Cannot send data: not connected');\n }\n\n // Check actual WebSocket readyState\n if (this.ws.readyState !== 1) { // WebSocket.OPEN = 1\n logger.error(`WebSocket not open - readyState: ${this.ws.readyState} (0=CONNECTING, 1=OPEN, 2=CLOSING, 3=CLOSED)`);\n throw new Error(`Cannot send data: WebSocket not open (readyState: ${this.ws.readyState})`);\n }\n\n logger.debug(`Sending message - size: ${data.length} bytes, readyState: ${this.ws.readyState}`);\n\n try {\n this.ws.send(data);\n logger.debug(`Message sent successfully`);\n } catch (error) {\n logger.error(`Failed to send message:`, error);\n throw new Error(`Failed to send data: ${error}`);\n }\n }\n\n /**\n * Get current connection state\n */\n getState(): ConnectionState {\n return this.state;\n }\n\n /**\n * Check if connected\n */\n isConnected(): boolean {\n return this.state === ConnectionState.Connected;\n }\n\n /**\n * Whether auto-reconnect is enabled for this connection.\n *\n * Used by the client to decide whether requests issued while the\n * connection is down can be queued (the connection will come back) or\n * should fail immediately.\n */\n isAutoReconnectEnabled(): boolean {\n return this.options.autoReconnect;\n }\n\n /**\n * Reconnect to the server\n */\n private reconnect(): void {\n const success = this.reconnectManager.scheduleReconnect(async () => {\n try {\n await this.connect();\n } catch (error) {\n // Error is already handled by connect()\n // Reconnection will be scheduled again if autoReconnect is enabled\n }\n });\n\n if (!success) {\n this.setState(ConnectionState.Disconnected);\n this.emit('error', new Error('Max reconnection attempts reached'));\n }\n }\n\n /**\n * Set connection state and emit event\n */\n private setState(state: ConnectionState): void {\n if (this.state !== state) {\n this.state = state;\n this.emit('stateChange', state);\n }\n }\n\n /**\n * Start heartbeat mechanism\n */\n private startHeartbeat(): void {\n if (this.options.heartbeatInterval <= 0) {\n return;\n }\n\n this.stopHeartbeat();\n\n // Note: WebSocket implementations (browser and ws library) automatically handle\n // ping/pong frames at the protocol level, so we don't need application-level heartbeat\n // that sends empty binary messages. The underlying WebSocket will keep the connection alive.\n }\n\n /**\n * Stop heartbeat mechanism\n */\n private stopHeartbeat(): void {\n if (this.heartbeatTimer) {\n clearInterval(this.heartbeatTimer);\n this.heartbeatTimer = undefined;\n }\n if (this.heartbeatTimeoutTimer) {\n clearTimeout(this.heartbeatTimeoutTimer);\n this.heartbeatTimeoutTimer = undefined;\n }\n }\n\n /**\n * Reset heartbeat timeout (called when message received)\n */\n private resetHeartbeat(): void {\n if (this.heartbeatTimeoutTimer) {\n clearTimeout(this.heartbeatTimeoutTimer);\n this.heartbeatTimeoutTimer = undefined;\n }\n }\n}\n","/**\n * User home path normalization.\n *\n * Some server responses (JWT claims, RAISIN_CURRENT_USER(), identity\n * endpoints) return the user home as a workspace-prefixed path like\n * `/raisin:access_control/users/internal/alice`, while others return the\n * workspace-relative form `/users/internal/alice`. SDK code that builds\n * child paths (inbox, chats, outbox) expects the workspace-relative form.\n */\n\n/** Workspace prefix that may leak into user home paths */\nconst ACCESS_CONTROL_PREFIX = '/raisin:access_control';\n\n/**\n * Normalize a user home path to its workspace-relative form.\n *\n * Strips a leading `/raisin:access_control` workspace prefix and trailing\n * slashes, so `/raisin:access_control/users/internal/alice/` becomes\n * `/users/internal/alice`. Paths without the prefix are returned unchanged\n * (modulo trailing-slash trimming). Returns `null` for empty input.\n *\n * @example\n * ```typescript\n * normalizeHomePath('/raisin:access_control/users/internal/alice');\n * // => '/users/internal/alice'\n * normalizeHomePath('/users/internal/alice');\n * // => '/users/internal/alice'\n * ```\n */\nexport function normalizeHomePath(home: string | null | undefined): string | null {\n if (home === null || home === undefined) return null;\n\n let path = home.trim();\n if (path.length === 0) return null;\n\n if (path === ACCESS_CONTROL_PREFIX) return '/';\n if (path.startsWith(`${ACCESS_CONTROL_PREFIX}/`)) {\n path = path.slice(ACCESS_CONTROL_PREFIX.length);\n }\n\n // Trim trailing slashes (but keep root \"/\")\n while (path.length > 1 && path.endsWith('/')) {\n path = path.slice(0, -1);\n }\n\n return path;\n}\n","/**\n * Plan projection utility.\n *\n * Builds deterministic plan/task state from persisted chat messages.\n */\n\nimport type { ChatMessage } from '../types/chat';\n\nexport interface PlanProjectionTask {\n taskId?: string;\n title: string;\n status: string;\n description?: string;\n priority?: string;\n}\n\nexport interface PlanProjection {\n key: string;\n planPath?: string;\n planId?: string;\n title: string;\n status: string;\n requiresApproval: boolean;\n tasks: PlanProjectionTask[];\n sourceMessagePath?: string;\n updatedAt?: string;\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null;\n return value as Record<string, unknown>;\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\nexport function parsePlanTasks(rawTasks: unknown): PlanProjectionTask[] {\n if (!Array.isArray(rawTasks)) return [];\n return rawTasks\n .map((rawTask, index) => {\n if (typeof rawTask === 'string') {\n return {\n title: rawTask,\n status: 'pending',\n } satisfies PlanProjectionTask;\n }\n const task = asRecord(rawTask);\n if (!task) return null;\n return {\n taskId: asString(task.task_id) ?? asString(task.id),\n title: asString(task.title) ?? `Task ${index + 1}`,\n status: asString(task.status) ?? 'pending',\n description: asString(task.description),\n priority: asString(task.priority),\n } satisfies PlanProjectionTask;\n })\n .filter((task): task is PlanProjectionTask => task !== null);\n}\n\nconst TERMINAL_TASK_STATUSES = new Set(['completed', 'cancelled']);\nconst TERMINAL_PLAN_STATUSES = new Set(['completed', 'failed', 'cancelled']);\n\n/**\n * Same race as upsertTask: an ai_task_update message carrying a stale\n * plan_status (e.g. \"in_progress\", computed before the final task's\n * completion count caught up) can be persisted and thus replayed here after\n * the message that actually reflects the terminal plan status. Guard it the\n * same way - never regress out of a terminal plan status.\n */\nfunction setPlanStatus(plan: PlanProjection, nextStatus: string | undefined): void {\n if (!nextStatus) return;\n if (TERMINAL_PLAN_STATUSES.has(plan.status) && !TERMINAL_PLAN_STATUSES.has(nextStatus)) {\n return;\n }\n plan.status = nextStatus;\n}\n\nexport function upsertTask(plan: PlanProjection, nextTask: PlanProjectionTask): void {\n const existingIndex = plan.tasks.findIndex((task) =>\n (nextTask.taskId && task.taskId === nextTask.taskId) ||\n (!nextTask.taskId && task.title === nextTask.title)\n );\n if (existingIndex === -1) {\n plan.tasks.push(nextTask);\n return;\n }\n const existing = plan.tasks[existingIndex];\n // Mirrors the server-side monotonic guard in update-task/index.js: tool\n // calls from one model turn can execute in parallel, so an ai_task_update\n // message for an earlier \"in_progress\" transition can be persisted (and\n // thus replayed here) after the \"completed\" message for the same task.\n // Never let that regress an already-terminal status.\n if (TERMINAL_TASK_STATUSES.has(existing.status) && !TERMINAL_TASK_STATUSES.has(nextTask.status)) {\n return;\n }\n plan.tasks[existingIndex] = {\n ...existing,\n ...nextTask,\n };\n}\n\nexport function ensurePlan(\n plans: Map<string, PlanProjection>,\n key: string,\n fallbackTitle: string,\n timestamp: string | undefined,\n): PlanProjection {\n const existing = plans.get(key);\n if (existing) {\n if (timestamp) existing.updatedAt = timestamp;\n return existing;\n }\n const created: PlanProjection = {\n key,\n title: fallbackTitle,\n status: 'pending_approval',\n requiresApproval: true,\n tasks: [],\n updatedAt: timestamp,\n };\n plans.set(key, created);\n return created;\n}\n\n/**\n * Build deterministic plan/task state from persisted chat messages.\n * Uses ai_plan as canonical plan source and ai_task_update for incremental task status changes.\n */\nexport function projectPlansFromMessages(messages: ChatMessage[]): PlanProjection[] {\n const ordered = [...messages].sort((a, b) => {\n const aTime = Date.parse(a.timestamp || '');\n const bTime = Date.parse(b.timestamp || '');\n return (Number.isNaN(aTime) ? 0 : aTime) - (Number.isNaN(bTime) ? 0 : bTime);\n });\n\n const plans = new Map<string, PlanProjection>();\n\n for (const message of ordered) {\n const timestamp = message.timestamp;\n const data = asRecord(message.data);\n\n if (message.messageType === 'ai_plan' && data) {\n const planPath = asString(data.plan_path);\n const planId = asString(data.plan_id);\n const key = planPath || planId || message.path || message.id || `plan:${timestamp}`;\n const plan = ensurePlan(\n plans,\n key,\n asString(data.title) || message.content || 'Plan',\n timestamp\n );\n\n plan.planPath = planPath ?? plan.planPath;\n plan.planId = planId ?? plan.planId;\n plan.title = asString(data.title) || plan.title;\n setPlanStatus(plan, asString(data.status));\n plan.requiresApproval = Boolean(data.requires_approval) || plan.status === 'pending_approval';\n plan.sourceMessagePath = message.path ?? plan.sourceMessagePath;\n\n const parsedTasks = parsePlanTasks(data.tasks);\n if (parsedTasks.length > 0) {\n plan.tasks = parsedTasks;\n }\n }\n\n if (message.messageType === 'ai_task_update' && data) {\n const planPath = asString(data.plan_path);\n const planId = asString(data.plan_id);\n const key = planPath || planId;\n if (!key) continue;\n\n const plan = ensurePlan(plans, key, 'Plan', timestamp);\n plan.planPath = planPath ?? plan.planPath;\n plan.planId = planId ?? plan.planId;\n setPlanStatus(plan, asString(data.plan_status));\n plan.requiresApproval = plan.status === 'pending_approval';\n\n const taskUpdate: PlanProjectionTask = {\n taskId: asString(data.task_id),\n title: asString(data.task_title) || asString(data.title) || 'Task',\n status: asString(data.status) || 'pending',\n };\n upsertTask(plan, taskUpdate);\n }\n\n if (Array.isArray(message.children)) {\n for (const child of message.children) {\n if (child.type !== 'plan') continue;\n const key = child.path || message.path || message.id || `plan-child:${child.id}:${timestamp}`;\n const plan = ensurePlan(plans, key, child.planTitle || message.content || 'Plan', timestamp);\n plan.title = child.planTitle || plan.title;\n plan.status = child.status || plan.status;\n plan.requiresApproval = plan.status === 'pending_approval';\n if (Array.isArray(child.tasks) && child.tasks.length > 0) {\n plan.tasks = child.tasks.map((task) => ({\n taskId: task.id,\n title: task.title,\n status: task.status,\n }));\n }\n }\n }\n }\n\n // Belt-and-suspenders: if every task landed in a terminal state but the\n // plan's own status field is stuck non-terminal (the same message-race\n // that setPlanStatus guards against can also leave it simply never\n // updated), derive completion from the tasks - mirrors the server's\n // auto-complete check in update-task/index.js's updatePlanProgress.\n for (const plan of plans.values()) {\n if (\n !TERMINAL_PLAN_STATUSES.has(plan.status) &&\n plan.tasks.length > 0 &&\n plan.tasks.every((task) => TERMINAL_TASK_STATUSES.has(task.status))\n ) {\n plan.status = 'completed';\n plan.requiresApproval = false;\n }\n }\n\n return [...plans.values()].sort((a, b) => {\n const aTime = Date.parse(a.updatedAt || '');\n const bTime = Date.parse(b.updatedAt || '');\n return (Number.isNaN(bTime) ? 0 : bTime) - (Number.isNaN(aTime) ? 0 : aTime);\n });\n}\n","import type { ChatDoneEvent, ChatEvent } from '../types/chat';\n\n/**\n * Detect safety-net done events emitted by backend recovery paths.\n *\n * These events can appear while async tool calls are still running.\n * They carry `recovered: true` and an empty content payload.\n */\nexport function isRecoveredDoneEvent(event: ChatEvent): event is ChatDoneEvent & { recovered: true } {\n if (event.type !== 'done') return false;\n const done = event as ChatDoneEvent & { recovered?: unknown };\n if (done.recovered !== true) return false;\n return typeof done.content !== 'string' || done.content.trim().length === 0;\n}\n\n","/**\n * Framework-agnostic conversation store for RaisinDB.\n *\n * Manages the full conversation lifecycle: creating conversations, sending\n * messages, streaming responses, persistent SSE subscriptions, message\n * history, tool call tracking, and plan projection. Notifies subscribers\n * on every state change so UI frameworks (React, Svelte, Vue) can bind.\n *\n * @example Svelte 5:\n * ```typescript\n * const store = new ConversationStore({ database: db, conversationPath: '/...' });\n * let snapshot = $state(store.getSnapshot());\n * store.subscribe(s => { snapshot = s; });\n * ```\n *\n * @example React (via useConversation hook):\n * ```tsx\n * const chat = useConversation(React, { database: db, conversationPath: '/...' });\n * ```\n */\n\nimport type { ConversationManager, ConversationSubscription } from '../conversations';\nimport type { Database } from '../database';\nimport type { ChatMessage, ChatEvent, ChatLogEvent } from '../types/chat';\nimport { logger, getLogLevel, LogLevel } from '../logger';\nimport { projectPlansFromMessages, type PlanProjection } from '../utils/plan-projection';\nimport { isRecoveredDoneEvent } from '../utils/chat-events';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/** Info about an in-flight tool call */\nexport interface ToolCallInfo {\n id: string;\n functionName: string;\n arguments: unknown;\n status: 'running' | 'completed' | 'failed';\n result?: unknown;\n durationMs?: number;\n}\n\n/** Snapshot of the conversation store state */\nexport interface ConversationStoreSnapshot {\n /** The conversation object, if loaded */\n conversation: { conversationPath: string; type: string } | null;\n /** All messages in the conversation */\n messages: ChatMessage[];\n /** Whether the AI is currently generating a response */\n isStreaming: boolean;\n /** Whether the chat is waiting for user input */\n isWaiting: boolean;\n /** Accumulated text from the current streaming response */\n streamingText: string;\n /** Current error, if any */\n error: string | null;\n /** Tracks in-flight tool executions */\n activeToolCalls: ToolCallInfo[];\n /** Deterministic plan/task projection from persisted messages */\n plans: PlanProjection[];\n /** Whether messages are being loaded */\n isLoading: boolean;\n /** Path to the conversation node */\n conversationPath: string | null;\n}\n\n/** Options for creating a ConversationStore */\nexport interface ConversationStoreOptions {\n /** Pre-configured Database instance */\n database: Database;\n /** Resume an existing conversation */\n conversationPath?: string;\n /** Create a new conversation on first message */\n createOptions?: {\n participant: string;\n input?: Record<string, unknown>;\n };\n /** Callback for individual chat events */\n onEvent?: (event: ChatEvent) => void;\n /** Streaming inactivity timeout in ms (default: 120000). Auto-recovers when no SSE event arrives within this window. */\n streamingTimeoutMs?: number;\n /** Activity watchdog polling interval in ms (default: 30000). Periodically checks backend turn health while streaming. */\n watchdogIntervalMs?: number;\n}\n\ntype Subscriber = (snapshot: ConversationStoreSnapshot) => void;\n\n// ---------------------------------------------------------------------------\n// ConversationStore\n// ---------------------------------------------------------------------------\n\n/**\n * Framework-agnostic store managing a single conversation's state.\n *\n * Handles the full lifecycle: creating conversations, sending messages,\n * streaming responses, tool call tracking, plan projection, and deferred\n * message reload on turn completion.\n */\nexport class ConversationStore {\n private manager: ConversationManager;\n private subscribers = new Set<Subscriber>();\n private onEvent?: (event: ChatEvent) => void;\n private createOptions?: { participant: string; input?: Record<string, unknown> };\n\n // Persistent SSE subscription\n private subscription: ConversationSubscription | null = null;\n\n // Internal mutable state\n private _conversationPath: string | null;\n private _messages: ChatMessage[] = [];\n private _isStreaming = false;\n private _isWaiting = false;\n private _streamingText = '';\n private _error: string | null = null;\n private _activeToolCalls: ToolCallInfo[] = [];\n private _isLoading = false;\n private _conversationType: string | null = null;\n\n // Streaming timeout (Fix A)\n private _streamingTimeoutMs: number;\n private _streamingTimer: ReturnType<typeof setTimeout> | null = null;\n\n // Activity watchdog (Fix B)\n private _watchdogIntervalMs: number;\n private _watchdogTimer: ReturnType<typeof setInterval> | null = null;\n\n constructor(options: ConversationStoreOptions) {\n this.manager = options.database.conversations;\n this._conversationPath = options.conversationPath ?? null;\n this.createOptions = options.createOptions;\n this.onEvent = options.onEvent;\n this._streamingTimeoutMs = options.streamingTimeoutMs ?? 120_000;\n this._watchdogIntervalMs = options.watchdogIntervalMs ?? 30_000;\n\n // Auto-subscribe to existing conversation\n if (this._conversationPath) {\n this.ensureSubscription();\n }\n }\n\n // ==========================================================================\n // Subscription\n // ==========================================================================\n\n /**\n * Subscribe to state changes.\n * Returns an unsubscribe function.\n */\n subscribe(callback: Subscriber): () => void {\n this.subscribers.add(callback);\n callback(this.getSnapshot());\n return () => { this.subscribers.delete(callback); };\n }\n\n /**\n * Get the current state snapshot.\n */\n getSnapshot(): ConversationStoreSnapshot {\n return {\n conversation: this._conversationPath\n ? { conversationPath: this._conversationPath, type: this._conversationType || 'ai_chat' }\n : null,\n messages: [...this._messages],\n isStreaming: this._isStreaming,\n isWaiting: this._isWaiting,\n streamingText: this._streamingText,\n error: this._error,\n activeToolCalls: [...this._activeToolCalls],\n plans: projectPlansFromMessages(this._messages),\n isLoading: this._isLoading,\n conversationPath: this._conversationPath,\n };\n }\n\n // ==========================================================================\n // Actions\n // ==========================================================================\n\n /**\n * Send a user message and stream the AI response.\n *\n * If no conversation exists yet and `createOptions` was provided,\n * the conversation is created automatically on the first call.\n */\n async sendMessage(content: string): Promise<void> {\n if (this._isStreaming) {\n logger.warn('[ConversationStore] Cannot send message while streaming');\n return;\n }\n\n logger.info('[ConversationStore] Sending message', { path: this._conversationPath });\n this._error = null;\n\n // Create conversation if needed\n if (!this._conversationPath) {\n if (!this.createOptions) {\n throw new Error('No conversationPath and no createOptions provided');\n }\n try {\n const convo = await this.manager.create({\n participant: this.createOptions.participant,\n input: this.createOptions.input,\n });\n this._conversationPath = convo.conversationPath;\n this._conversationType = convo.type;\n\n for (const event of convo.initialEvents ?? []) {\n this.onEvent?.(event);\n this.handleEvent(event);\n }\n\n this.notify();\n } catch (err) {\n this._error = err instanceof Error ? err.message : String(err);\n this.notify();\n return;\n }\n }\n\n // Add user message optimistically\n const userMessage: ChatMessage = {\n role: 'user',\n content,\n timestamp: new Date().toISOString(),\n };\n this._messages.push(userMessage);\n\n // Start streaming\n this._isStreaming = true;\n this._isWaiting = false;\n this._streamingText = '';\n this._activeToolCalls = [];\n this.resetStreamingTimer();\n this.startWatchdog();\n this.notify();\n\n // Use persistent SSE subscription + create message node\n try {\n this.ensureSubscription();\n await this.subscription!.waitUntilConnected();\n await this.manager.createUserMessage(this._conversationPath!, content);\n // Events arrive via the persistent subscription → handleEvent\n } catch (err) {\n logger.error('[ConversationStore] Send failed', err);\n this._error = err instanceof Error ? err.message : String(err);\n this._isStreaming = false;\n this.clearStreamingTimer();\n this.stopWatchdog();\n this.notify();\n }\n }\n\n /**\n * Load messages from the persisted node tree.\n * Useful for loading history on page reload.\n */\n async loadMessages(): Promise<ChatMessage[]> {\n if (!this._conversationPath) return [];\n this._isLoading = true;\n this.notify();\n try {\n const messages = await this.manager.getMessages(this._conversationPath);\n logger.debug(`[ConversationStore] Loaded ${messages.length} messages`);\n if (messages.length > 0) {\n this._messages = messages;\n // Rebuild tool call state from messages\n this._activeToolCalls = [];\n }\n return messages;\n } finally {\n this._isLoading = false;\n this.notify();\n }\n }\n\n /**\n * Approve a pending plan.\n */\n async approvePlan(planPath: string): Promise<void> {\n await this.manager.approvePlan(planPath);\n }\n\n /**\n * Reject a pending plan.\n */\n async rejectPlan(planPath: string, feedback?: string): Promise<void> {\n await this.manager.rejectPlan(planPath, feedback);\n }\n\n /**\n * Mark a single message as read.\n */\n async markMessageAsRead(messagePath: string): Promise<void> {\n await this.manager.markMessageAsRead(messagePath);\n }\n\n /**\n * Stop the current streaming response.\n */\n stop(): void {\n this._isStreaming = false;\n this.clearStreamingTimer();\n this.stopWatchdog();\n this.notify();\n }\n\n /**\n * Clean up the store and release resources.\n */\n destroy(): void {\n this.stop();\n this.clearStreamingTimer();\n this.stopWatchdog();\n this.subscription?.unsubscribe();\n this.subscription = null;\n this.subscribers.clear();\n }\n\n /**\n * Get the conversation path.\n */\n getConversationPath(): string | null {\n return this._conversationPath;\n }\n\n // ==========================================================================\n // Internal\n // ==========================================================================\n\n private ensureSubscription(): void {\n if (this.subscription) return;\n if (!this._conversationPath) return;\n\n this.subscription = this.manager.subscribe(\n this._conversationPath,\n (event) => {\n this.onEvent?.(event);\n this.handleEvent(event);\n },\n );\n }\n\n private handleEvent(event: ChatEvent): void {\n logger.debug('[ConversationStore] SSE:', event.type);\n // Every SSE event resets the streaming inactivity timer\n if (this._isStreaming) {\n this.resetStreamingTimer();\n }\n switch (event.type) {\n case 'text_chunk':\n this.markStreamingActivity();\n this._streamingText += event.text;\n this.notify();\n break;\n\n case 'thought_chunk':\n this.markStreamingActivity();\n this.notify();\n break;\n\n case 'assistant_message':\n this._messages.push(event.message);\n this._streamingText = '';\n this.notify();\n break;\n\n case 'tool_call_started': {\n this.markStreamingActivity();\n logger.debug('[ConversationStore] Tool started:', event.functionName);\n const info: ToolCallInfo = {\n id: event.toolCallId,\n functionName: event.functionName,\n arguments: event.arguments,\n status: 'running',\n };\n this._activeToolCalls.push(info);\n this.notify();\n break;\n }\n\n case 'tool_call_completed': {\n this.markStreamingActivity();\n logger.debug('[ConversationStore] Tool completed:', event.toolCallId);\n const idx = this._activeToolCalls.findIndex(tc => tc.id === event.toolCallId);\n if (idx >= 0) {\n this._activeToolCalls[idx] = {\n ...this._activeToolCalls[idx],\n status: event.error ? 'failed' : 'completed',\n result: event.result,\n durationMs: event.durationMs,\n };\n }\n this.notify();\n break;\n }\n\n case 'waiting': {\n logger.info('[ConversationStore] Waiting for input');\n this.flushStreamingText(event.timestamp);\n this._isStreaming = false;\n this._isWaiting = true;\n this._activeToolCalls = [];\n this.clearStreamingTimer();\n this.stopWatchdog();\n this.notify();\n // Deferred reload: pick up canonical messages from node tree\n this.deferredReload();\n break;\n }\n\n case 'done': {\n if (isRecoveredDoneEvent(event)) {\n logger.debug('[ConversationStore] Ignoring recovered done event');\n this.reconcileRecoveredDone();\n break;\n }\n const doneEvent = event as import('../types/chat').ChatDoneEvent;\n if (doneEvent.dispatchPhase && doneEvent.dispatchPhase !== 'terminal') {\n logger.debug('[ConversationStore] Ignoring non-terminal done event');\n break;\n }\n logger.info('[ConversationStore] Turn done');\n this.flushStreamingText(event.timestamp);\n // Safety net: if streaming missed chunks, use the complete response from the event\n if (doneEvent.content && !this.lastMessageIsAssistant()) {\n this._messages.push({\n role: (doneEvent.role as ChatMessage['role']) || 'assistant',\n content: doneEvent.content,\n timestamp: event.timestamp,\n senderDisplayName: doneEvent.senderDisplayName,\n finishReason: doneEvent.finishReason,\n });\n }\n this._isStreaming = false;\n this._isWaiting = true;\n this._activeToolCalls = [];\n this.clearStreamingTimer();\n this.stopWatchdog();\n this.notify();\n this.deferredReload();\n break;\n }\n\n case 'completed': {\n this.flushStreamingText(event.timestamp);\n if (event.messages && event.messages.length > 0) {\n this._messages = event.messages;\n }\n this._isStreaming = false;\n this._isWaiting = false;\n this._activeToolCalls = [];\n this.clearStreamingTimer();\n this.stopWatchdog();\n this.notify();\n this.deferredReload();\n break;\n }\n\n case 'failed':\n logger.error('[ConversationStore] Turn failed', event.error);\n this._error = event.error;\n this._isStreaming = false;\n // A failed turn ends any waiting state too - otherwise UIs keyed on\n // isWaiting show a thinking indicator forever after a failure.\n this._isWaiting = false;\n this._streamingText = '';\n this._activeToolCalls = [];\n this.clearStreamingTimer();\n this.stopWatchdog();\n this.notify();\n break;\n\n case 'conversation_created':\n this._conversationPath = event.conversationPath;\n this.notify();\n break;\n\n case 'message_saved':\n // A message was persisted — reload to pick it up, then notify\n this.silentReload().catch(() => {});\n this.notify();\n break;\n\n case 'message_delivered':\n this._messages.push(event.message);\n this.notify();\n break;\n\n case 'log': {\n const logEvent = event as ChatLogEvent;\n const currentLevel = getLogLevel();\n const levelMap: Record<string, LogLevel> = {\n debug: LogLevel.Debug,\n info: LogLevel.Info,\n warn: LogLevel.Warn,\n error: LogLevel.Error,\n };\n const eventLevel = levelMap[logEvent.level] ?? LogLevel.Debug;\n if (currentLevel >= eventLevel) {\n const fn = logEvent.level === 'error' ? console.error\n : logEvent.level === 'warn' ? console.warn\n : logEvent.level === 'debug' ? console.debug\n : console.info;\n fn('[server]', logEvent.message);\n }\n break;\n }\n }\n }\n\n /**\n * Agent activity observed while the store thought the turn was over.\n *\n * This happens when execution continues WITHOUT a user message — plan\n * approval in approve_then_auto / step_by_step (approvePlan() returns an\n * enqueue receipt and the agent starts executing), or agent-initiated\n * follow-ups. The events arrive over the persistent live subscription\n * (no history replay), so activity is always \"now\": re-enter streaming\n * state so UIs show progress and the end-of-turn handling (done/waiting\n * → deferred reload) runs again for this continuation.\n */\n private markStreamingActivity(): void {\n if (this._isStreaming) return;\n logger.debug('[ConversationStore] Agent activity while idle — re-entering streaming state');\n this._isStreaming = true;\n this._isWaiting = false;\n this._streamingText = '';\n this.resetStreamingTimer();\n this.startWatchdog();\n }\n\n /**\n * If accumulated streaming text hasn't been captured in an assistant_message,\n * synthesize one.\n */\n private flushStreamingText(timestamp: string): void {\n if (this._streamingText && !this.lastMessageIsAssistant()) {\n this._messages.push({\n role: 'assistant',\n content: this._streamingText,\n timestamp,\n });\n }\n this._streamingText = '';\n }\n\n private lastMessageIsAssistant(): boolean {\n const last = this._messages[this._messages.length - 1];\n return last?.role === 'assistant';\n }\n\n /**\n * After a turn completes, reload canonical messages from the node tree\n * to catch any events missed during SSE gaps.\n */\n private deferredReload(): void {\n if (!this._conversationPath) return;\n logger.debug('[ConversationStore] Scheduling deferred reload');\n const attemptReload = (delay: number, retriesLeft: number) => {\n setTimeout(async () => {\n try {\n const prevCount = this._messages.length;\n await this.silentReload();\n // If no new messages appeared and retries remain, try again with exponential backoff\n if (this._messages.length === prevCount && retriesLeft > 0) {\n attemptReload(delay * 2, retriesLeft - 1);\n }\n } catch {}\n }, delay);\n };\n attemptReload(500, 2); // 500ms, 1000ms, 2000ms\n }\n\n private async silentReload(): Promise<void> {\n if (!this._conversationPath) return;\n try {\n const fresh = await this.manager.getMessages(this._conversationPath);\n if (fresh.length === 0) return;\n\n // Try incremental merge: match existing messages by role+content\n // to preserve object references (prevents Svelte DOM recreation)\n let matchCount = 0;\n const limit = Math.min(this._messages.length, fresh.length);\n for (let i = 0; i < limit; i++) {\n if (this._messages[i].role !== fresh[i].role ||\n this._messages[i].content !== fresh[i].content) break;\n matchCount++;\n }\n\n if (matchCount === this._messages.length && fresh.length === matchCount) {\n // Same content, possibly different metadata — update silently\n for (let i = 0; i < matchCount; i++) {\n const f = fresh[i];\n const e = this._messages[i];\n if (f.id) e.id = f.id;\n if (f.path) e.path = f.path;\n if (f.messageType) e.messageType = f.messageType;\n if (f.data) e.data = f.data;\n if (f.children) e.children = f.children;\n if (f.finishReason) e.finishReason = f.finishReason;\n }\n await this.rebuildToolCallState();\n return; // No visible change — don't notify\n }\n\n if (matchCount === this._messages.length && fresh.length > matchCount) {\n // Existing messages match prefix — append new ones\n for (let i = matchCount; i < fresh.length; i++) {\n this._messages.push(fresh[i]);\n }\n // Also update metadata on matched messages\n for (let i = 0; i < matchCount; i++) {\n const f = fresh[i];\n const e = this._messages[i];\n if (f.id) e.id = f.id;\n if (f.path) e.path = f.path;\n if (f.messageType) e.messageType = f.messageType;\n if (f.data) e.data = f.data;\n if (f.children) e.children = f.children;\n }\n await this.rebuildToolCallState();\n this.notify(); // New messages to show\n return;\n }\n\n // Fresh is a prefix subset — outbox delivery pending, keep extras\n if (matchCount === fresh.length && fresh.length < this._messages.length) {\n for (let i = 0; i < matchCount; i++) {\n const f = fresh[i];\n const e = this._messages[i];\n if (f.id) e.id = f.id;\n if (f.path) e.path = f.path;\n if (f.messageType) e.messageType = f.messageType;\n if (f.data) e.data = f.data;\n if (f.children) e.children = f.children;\n }\n await this.rebuildToolCallState();\n return; // Keep streaming-flushed extras — message_saved will trigger next reload\n }\n\n // Content mismatch — full replace\n this._messages = fresh;\n await this.rebuildToolCallState();\n this.notify();\n } catch (err) {\n logger.debug('[ConversationStore] Silent reload failed:', err);\n }\n }\n\n // ==========================================================================\n // Streaming timeout (Fix A) — auto-recover on SSE inactivity\n // ==========================================================================\n\n private resetStreamingTimer(): void {\n this.clearStreamingTimer();\n if (!this._isStreaming) return;\n this._streamingTimer = setTimeout(() => {\n if (this._isStreaming) {\n logger.warn('[ConversationStore] Streaming timeout — no SSE activity for', this._streamingTimeoutMs, 'ms');\n this.recoverFromHang();\n }\n }, this._streamingTimeoutMs);\n }\n\n private clearStreamingTimer(): void {\n if (this._streamingTimer) {\n clearTimeout(this._streamingTimer);\n this._streamingTimer = null;\n }\n }\n\n // ==========================================================================\n // Activity watchdog (Fix B) — periodic backend health check\n // ==========================================================================\n\n private startWatchdog(): void {\n this.stopWatchdog();\n if (!this._conversationPath) return;\n this._watchdogTimer = setInterval(async () => {\n if (!this._isStreaming || !this._conversationPath) {\n this.stopWatchdog();\n return;\n }\n try {\n const health = await this.manager.checkTurnHealth(this._conversationPath);\n if (health === 'done' && this._isStreaming) {\n logger.warn('[ConversationStore] Watchdog detected completed turn while still streaming — recovering');\n this.recoverFromHang();\n }\n } catch {\n // Ignore watchdog errors — it's a best-effort check\n }\n }, this._watchdogIntervalMs);\n }\n\n private stopWatchdog(): void {\n if (this._watchdogTimer) {\n clearInterval(this._watchdogTimer);\n this._watchdogTimer = null;\n }\n }\n\n // ==========================================================================\n // Hang recovery (shared by timeout + watchdog)\n // ==========================================================================\n\n private recoverFromHang(): void {\n logger.info('[ConversationStore] Recovering from hang');\n this.clearStreamingTimer();\n this.stopWatchdog();\n this._isStreaming = false;\n this._isWaiting = true;\n this._streamingText = '';\n this.notify();\n // Reload to pick up any persisted state we missed\n this.silentReload().catch(() => {});\n }\n\n /**\n * Reconcile a recovered done event against persisted state.\n * If the backend turn is actually complete, finalize the local state.\n * Otherwise keep streaming active and let normal events continue.\n */\n private reconcileRecoveredDone(): void {\n if (!this._conversationPath) return;\n void this.manager.checkTurnHealth(this._conversationPath).then((health) => {\n if (health !== 'done') return;\n if (!this._isStreaming) return;\n this._isStreaming = false;\n this._isWaiting = true;\n this._activeToolCalls = [];\n this.clearStreamingTimer();\n this.stopWatchdog();\n this.notify();\n this.deferredReload();\n }).catch(() => {\n // Best effort only; streaming watchdog still protects against hangs.\n });\n }\n\n // ==========================================================================\n // Tool call state rebuild (Fix C) — reconstruct from node tree on reload\n // ==========================================================================\n\n private async rebuildToolCallState(): Promise<void> {\n if (!this._conversationPath) {\n this._activeToolCalls = [];\n return;\n }\n try {\n const pendingCalls = await this.manager.getActiveToolCalls(this._conversationPath);\n if (pendingCalls.length > 0) {\n this._activeToolCalls = pendingCalls.map(tc => ({\n id: tc.id,\n functionName: tc.name,\n arguments: undefined,\n status: 'running' as const,\n }));\n // Keep streaming active if there are pending tool calls\n if (!this._isStreaming) {\n this._isStreaming = true;\n this.resetStreamingTimer();\n this.startWatchdog();\n }\n } else {\n this._activeToolCalls = [];\n // No pending tools — check if we should clear streaming\n if (this._isStreaming) {\n const lastMsg = this._messages[this._messages.length - 1];\n const isLastAssistantDone = lastMsg?.role === 'assistant' &&\n (lastMsg.dispatchPhase\n ? lastMsg.dispatchPhase === 'terminal'\n : (!!lastMsg.finishReason && lastMsg.finishReason !== 'tool_calls'));\n if (isLastAssistantDone) {\n this._isStreaming = false;\n this._isWaiting = true;\n this.clearStreamingTimer();\n this.stopWatchdog();\n }\n }\n }\n } catch {\n this._activeToolCalls = [];\n }\n }\n\n private notify(): void {\n const snapshot = this.getSnapshot();\n for (const sub of this.subscribers) {\n try { sub(snapshot); }\n catch (err) { logger.error('Error in conversation store subscriber:', err); }\n }\n }\n}\n","/**\n * Multi-conversation list store for RaisinDB.\n *\n * Manages the list of conversations: loading, creating, deleting, marking\n * as read, and optional real-time updates via WebSocket events.\n *\n * Provides a factory (`getConversationStore`) that returns cached\n * per-conversation `ConversationStore` instances.\n *\n * @example Svelte 5:\n * ```typescript\n * const listStore = new ConversationListStore({ database: db, realtime: true });\n * let snapshot = $state(listStore.getSnapshot());\n * listStore.subscribe(s => { snapshot = s; });\n * await listStore.load();\n * ```\n */\n\nimport type { Database } from '../database';\nimport type { ConversationType, ConversationListItem } from '../types/chat';\nimport { ConversationStore, type ConversationStoreOptions } from './conversation-store';\nimport { logger } from '../logger';\nimport { normalizeHomePath } from '../utils/home-path';\n\n/**\n * Build the realtime subscription filters for a user's chats folder.\n *\n * The server matches subscription paths literally with glob semantics:\n * `*` matches exactly one path segment, `**` matches recursively, and there\n * is NO implicit prefix matching — a plain path only matches that exact\n * node. To observe conversations created/updated under the chats folder we\n * therefore need the recursive `/**` suffix.\n *\n * Exported for testing.\n * @internal\n */\nexport function buildChatsSubscriptionFilters(userHome: string): {\n workspace: string;\n path: string;\n event_types: string[];\n} {\n const home = normalizeHomePath(userHome) ?? userHome;\n return {\n workspace: 'raisin:access_control',\n path: `${home}/inbox/chats/**`,\n event_types: ['node:created', 'node:updated'],\n };\n}\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/** Snapshot of the conversation list state */\nexport interface ConversationListSnapshot {\n conversations: ConversationListItem[];\n totalUnreadCount: number;\n isLoading: boolean;\n error: string | null;\n}\n\n/** Options for creating a ConversationListStore */\nexport interface ConversationListStoreOptions {\n database: Database;\n /** Filter by conversation type */\n type?: ConversationType;\n /** Subscribe to WebSocket events for new conversations */\n realtime?: boolean;\n}\n\ntype Subscriber = (snapshot: ConversationListSnapshot) => void;\n\n// ---------------------------------------------------------------------------\n// ConversationListStore\n// ---------------------------------------------------------------------------\n\nexport class ConversationListStore {\n private database: Database;\n private type?: ConversationType;\n private realtime: boolean;\n private subscribers = new Set<Subscriber>();\n\n // Internal state\n private _conversations: ConversationListItem[] = [];\n private _isLoading = false;\n private _error: string | null = null;\n\n // Cached ConversationStore instances\n private _stores = new Map<string, ConversationStore>();\n\n // Real-time subscription\n private _realtimeSubscription: { unsubscribe: () => void } | null = null;\n\n constructor(options: ConversationListStoreOptions) {\n this.database = options.database;\n this.type = options.type;\n this.realtime = options.realtime ?? false;\n }\n\n // ==========================================================================\n // Subscription\n // ==========================================================================\n\n subscribe(callback: Subscriber): () => void {\n this.subscribers.add(callback);\n callback(this.getSnapshot());\n return () => { this.subscribers.delete(callback); };\n }\n\n getSnapshot(): ConversationListSnapshot {\n return {\n conversations: [...this._conversations],\n totalUnreadCount: this._conversations.reduce((sum, c) => sum + (c.unreadCount ?? 0), 0),\n isLoading: this._isLoading,\n error: this._error,\n };\n }\n\n // ==========================================================================\n // Actions\n // ==========================================================================\n\n /**\n * Load conversations from the server.\n */\n async load(): Promise<void> {\n this._isLoading = true;\n this._error = null;\n this.notify();\n\n try {\n const conversations = await this.database.conversations.list({\n type: this.type,\n });\n logger.debug(`[ConversationListStore] Loaded ${conversations.length} conversations`);\n this._conversations = conversations;\n\n if (this.realtime) {\n this.startRealtimeSubscription();\n }\n } catch (err) {\n logger.error('[ConversationListStore] Failed to load conversations', err);\n this._error = err instanceof Error ? err.message : String(err);\n } finally {\n this._isLoading = false;\n this.notify();\n }\n }\n\n /**\n * Create a new conversation.\n */\n async createConversation(options: {\n participant: string;\n subject?: string;\n input?: Record<string, unknown>;\n }): Promise<ConversationListItem> {\n const convo = await this.database.conversations.create(options);\n\n const listItem: ConversationListItem = {\n id: convo.id,\n type: convo.type,\n conversationPath: convo.conversationPath,\n conversationWorkspace: convo.conversationWorkspace,\n agentRef: convo.agentRef,\n participants: convo.participants,\n unreadCount: 0,\n updatedAt: new Date().toISOString(),\n };\n\n this._conversations = [listItem, ...this._conversations];\n this.notify();\n return listItem;\n }\n\n /**\n * Delete a conversation.\n */\n async deleteConversation(conversationPath: string): Promise<void> {\n // Destroy cached store\n const store = this._stores.get(conversationPath);\n if (store) {\n store.destroy();\n this._stores.delete(conversationPath);\n }\n\n await this.database.conversations.delete(conversationPath);\n this._conversations = this._conversations.filter(c => c.conversationPath !== conversationPath);\n this.notify();\n }\n\n /**\n * Mark a conversation as read.\n */\n async markAsRead(conversationPath: string): Promise<void> {\n await this.database.conversations.markAsRead(conversationPath);\n this._conversations = this._conversations.map(c =>\n c.conversationPath === conversationPath ? { ...c, unreadCount: 0 } : c\n );\n this.notify();\n }\n\n /**\n * Get or create a ConversationStore for a specific conversation.\n * Caches instances so repeated calls return the same store.\n */\n getConversationStore(\n conversationPath: string,\n overrides?: Partial<ConversationStoreOptions>,\n ): ConversationStore {\n let store = this._stores.get(conversationPath);\n if (!store) {\n store = new ConversationStore({\n database: this.database,\n conversationPath,\n ...overrides,\n });\n this._stores.set(conversationPath, store);\n }\n return store;\n }\n\n /**\n * Clean up all resources.\n */\n destroy(): void {\n this._realtimeSubscription?.unsubscribe();\n this._realtimeSubscription = null;\n\n for (const store of this._stores.values()) {\n store.destroy();\n }\n this._stores.clear();\n this.subscribers.clear();\n }\n\n // ==========================================================================\n // Internal\n // ==========================================================================\n\n private async startRealtimeSubscription(): Promise<void> {\n if (this._realtimeSubscription) return;\n logger.debug('[ConversationListStore] Starting realtime subscription');\n\n try {\n const workspace = this.database.workspace('raisin:access_control');\n const events = workspace.events();\n\n // We need the user home path to subscribe to the right folder\n const result = await this.database.executeSql(\n `SELECT RAISIN_CURRENT_USER()->>'path'::String as home`,\n );\n const rows = result.rows as unknown as Record<string, unknown>[];\n const userHome = rows?.[0]?.home as string;\n if (!userHome) return;\n\n this._realtimeSubscription = await events.subscribe(\n buildChatsSubscriptionFilters(userHome),\n async (event) => {\n const eventData = event as any;\n const nodeId = eventData.payload?.node_id;\n if (!nodeId) return;\n\n try {\n const nodeResult = await this.database.executeSql(\n `SELECT id, path, node_type, properties, created_at, updated_at FROM 'raisin:access_control' WHERE id = $1 LIMIT 1`,\n [nodeId],\n );\n const row = (nodeResult.rows as unknown as Record<string, unknown>[])?.[0];\n if (!row || row.node_type !== 'raisin:Conversation') return;\n\n const convPath = row.path as string;\n const props = (row.properties ?? {}) as Record<string, unknown>;\n const item: ConversationListItem = {\n id: row.id as string,\n type: (props.conversation_type as ConversationType) ?? 'ai_chat',\n conversationPath: convPath,\n conversationWorkspace: 'raisin:access_control',\n agentRef: props.agent_ref as string | undefined,\n participants: props.participants as string[] | undefined,\n unreadCount: (props.unread_count as number) ?? 0,\n lastMessage: props.last_message as { content: string; sender_id: string; created_at: string } | undefined,\n updatedAt: (row.updated_at ?? row.created_at) as string,\n };\n\n const existingIdx = this._conversations.findIndex(c => c.conversationPath === convPath);\n if (existingIdx >= 0) {\n // Update existing conversation and move to top\n this._conversations.splice(existingIdx, 1);\n }\n this._conversations = [item, ...this._conversations];\n this.notify();\n } catch (err) {\n logger.debug('Failed to process conversation event:', err);\n }\n },\n );\n } catch (err) {\n logger.debug('Failed to start realtime subscription:', err);\n }\n }\n\n private notify(): void {\n const snapshot = this.getSnapshot();\n for (const sub of this.subscribers) {\n try { sub(snapshot); }\n catch (err) { logger.error('Error in conversation list store subscriber:', err); }\n }\n }\n}\n"],"mappings":";;;;;;;;AAuBO,IAAM,mBAAN,MAAuB;AAAA,EAY5B,YAAY,UAA4B,CAAC,GAAG;AAV5C,SAAQ,WAAW;AAEnB,SAAQ,iBAAiB;AASvB,SAAK,eAAe,QAAQ,gBAAgB;AAC5C,SAAK,WAAW,QAAQ,YAAY;AACpC,SAAK,oBAAoB,QAAQ,qBAAqB;AACtD,SAAK,cAAc,QAAQ,eAAe;AAC1C,SAAK,SAAS,QAAQ,UAAU;AAChC,SAAK,eAAe,KAAK;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,kBAAkB,UAA+C;AAE/D,QAAI,KAAK,YAAY,KAAK,aAAa;AACrC,aAAO;AAAA,IACT;AAGA,SAAK,gBAAgB;AAErB,SAAK,iBAAiB;AACtB,SAAK;AAGL,QAAI,QAAQ,KAAK;AACjB,QAAI,KAAK,QAAQ;AACf,YAAM,cAAc,QAAQ;AAC5B,gBAAU,KAAK,OAAO,IAAI,IAAI,KAAK;AACnC,cAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC;AAAA,IACvC;AAEA,SAAK,mBAAmB,WAAW,YAAY;AAC7C,UAAI;AACF,cAAM,SAAS;AAEf,aAAK,MAAM;AAAA,MACb,SAAS,OAAO;AAEd,aAAK,eAAe,KAAK;AAAA,UACvB,KAAK,eAAe,KAAK;AAAA,UACzB,KAAK;AAAA,QACP;AAAA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AI,cAAc,CAAC;AAClC,kBAAM,OAA6B;AAAA,cACjC,IAAI,IAAI;AAAA,cACR,MAAO,MAAM,qBAA0C;AAAA,cACvD,kBAAkB;AAAA,cAClB,uBAAuB;AAAA,cACvB,UAAU,MAAM;AAAA,cAChB,cAAc,MAAM;AAAA,cACpB,aAAc,MAAM,gBAA2B;AAAA,cAC/C,aAAa,MAAM;AAAA,cACnB,WAAY,IAAI,cAAc,IAAI;AAAA,YACpC;AAEA,kBAAM,cAAc,KAAK,eAAe,UAAU,OAAK,EAAE,qBAAqB,QAAQ;AACtF,gBAAI,eAAe,GAAG;AAEpB,mBAAK,eAAe,OAAO,aAAa,CAAC;AAAA,YAC3C;AACA,iBAAK,iBAAiB,CAAC,MAAM,GAAG,KAAK,cAAc;AACnD,iBAAK,OAAO;AAAA,UACd,SAAS,KAAK;AACZ,mBAAO,MAAM,yCAAyC,GAAG;AAAA,UAC3D;AAAA,QACF;AAAA,MACF;AAAA,IACF,SAAS,KAAK;AACZ,aAAO,MAAM,0CAA0C,GAAG;AAAA,IAC5D;AAAA,EACF;AAAA,EAEQ,SAAe;AACrB,UAAM,WAAW,KAAK,YAAY;AAClC,eAAW,OAAO,KAAK,aAAa;AAClC,UAAI;AAAE,YAAI,QAAQ;AAAA,MAAG,SACd,KAAK;AAAE,eAAO,MAAM,gDAAgD,GAAG;AAAA,MAAG;AAAA,IACnF;AAAA,EACF;AACF;","names":["LogLevel","ConnectionState"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ReconnectManager,
|
|
3
3
|
logger
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GRC5AZMU.mjs";
|
|
5
5
|
|
|
6
6
|
// src/errors.ts
|
|
7
7
|
var RaisinError = class extends Error {
|
|
@@ -863,4 +863,4 @@ export {
|
|
|
863
863
|
SSEClient,
|
|
864
864
|
FlowClient
|
|
865
865
|
};
|
|
866
|
-
//# sourceMappingURL=chunk-
|
|
866
|
+
//# sourceMappingURL=chunk-T26GAHFZ.mjs.map
|
package/dist/{conversation-list-store-CrmmmVKE.d.mts → conversation-list-store-ZtQuHSJ6.d.mts}
RENAMED
|
@@ -335,6 +335,7 @@ declare enum RequestType {
|
|
|
335
335
|
BranchMerge = "branch_merge",
|
|
336
336
|
BranchCompare = "branch_compare",
|
|
337
337
|
BranchDiff = "branch_diff",
|
|
338
|
+
BranchCopyNodes = "branch_copy_nodes",
|
|
338
339
|
TagCreate = "tag_create",
|
|
339
340
|
TagGet = "tag_get",
|
|
340
341
|
TagList = "tag_list",
|
|
@@ -387,7 +388,11 @@ declare enum RequestType {
|
|
|
387
388
|
FlowSubscribeEvents = "flow_subscribe_events",
|
|
388
389
|
FlowUnsubscribeEvents = "flow_unsubscribe_events",
|
|
389
390
|
FunctionInvoke = "function_invoke",
|
|
390
|
-
FunctionInvokeSync = "function_invoke_sync"
|
|
391
|
+
FunctionInvokeSync = "function_invoke_sync",
|
|
392
|
+
ScheduledInvocationCreate = "scheduled_invocation_create",
|
|
393
|
+
ScheduledInvocationCancel = "scheduled_invocation_cancel",
|
|
394
|
+
ScheduledInvocationList = "scheduled_invocation_list",
|
|
395
|
+
ScheduledInvocationGet = "scheduled_invocation_get"
|
|
391
396
|
}
|
|
392
397
|
/**
|
|
393
398
|
* Response status
|
|
@@ -3531,6 +3536,74 @@ declare class ElementTypes {
|
|
|
3531
3536
|
* Branch management operations
|
|
3532
3537
|
*/
|
|
3533
3538
|
|
|
3539
|
+
/**
|
|
3540
|
+
* Branch divergence information (similar to "N commits ahead/behind").
|
|
3541
|
+
*/
|
|
3542
|
+
interface BranchDivergence {
|
|
3543
|
+
/** Number of commits on the compared branch not on the base branch */
|
|
3544
|
+
ahead: number;
|
|
3545
|
+
/** Number of commits on the base branch not on the compared branch */
|
|
3546
|
+
behind: number;
|
|
3547
|
+
/** Common ancestor revision (HLC string, e.g. "1705584000000-5") */
|
|
3548
|
+
common_ancestor: string;
|
|
3549
|
+
}
|
|
3550
|
+
/**
|
|
3551
|
+
* Per-node change in a branch diff (relative to the merge-base).
|
|
3552
|
+
*/
|
|
3553
|
+
interface NodeDiffInfo {
|
|
3554
|
+
/** Node id that changed */
|
|
3555
|
+
node_id: string;
|
|
3556
|
+
/** Workspace the node belongs to */
|
|
3557
|
+
workspace: string;
|
|
3558
|
+
/** Path on the diffed branch (null when only a tombstone exists, e.g. some deletes) */
|
|
3559
|
+
path: string | null;
|
|
3560
|
+
/** Operation: "added" | "modified" | "deleted" | "reordered" */
|
|
3561
|
+
operation: string;
|
|
3562
|
+
/** Translation locale when the change is to a translation (absent = base node) */
|
|
3563
|
+
translation_locale?: string;
|
|
3564
|
+
}
|
|
3565
|
+
/**
|
|
3566
|
+
* Per-node diff of a branch relative to a base branch's merge-base.
|
|
3567
|
+
*
|
|
3568
|
+
* Unlike {@link BranchDivergence} (ahead/behind counts only), this
|
|
3569
|
+
* enumerates exactly which nodes changed since the two branches diverged.
|
|
3570
|
+
*/
|
|
3571
|
+
interface BranchDiff {
|
|
3572
|
+
/** The common ancestor (merge-base) the diff is computed against (HLC string) */
|
|
3573
|
+
common_ancestor: string;
|
|
3574
|
+
/** Nodes present on the branch but not on the base */
|
|
3575
|
+
added: NodeDiffInfo[];
|
|
3576
|
+
/** Nodes changed on the branch (operation "modified" / "reordered") */
|
|
3577
|
+
modified: NodeDiffInfo[];
|
|
3578
|
+
/** Nodes removed on the branch */
|
|
3579
|
+
deleted: NodeDiffInfo[];
|
|
3580
|
+
}
|
|
3581
|
+
/**
|
|
3582
|
+
* Per-node change from a cross-branch node-set copy.
|
|
3583
|
+
*/
|
|
3584
|
+
interface CrossBranchNodeChange {
|
|
3585
|
+
/** Node id (ids are preserved across branches) */
|
|
3586
|
+
node_id: string;
|
|
3587
|
+
/** Path of the node on the target branch */
|
|
3588
|
+
path: string;
|
|
3589
|
+
/** NodeType of the node */
|
|
3590
|
+
node_type: string;
|
|
3591
|
+
/** Operation on the target branch: "added" | "modified" | "deleted" */
|
|
3592
|
+
operation: string;
|
|
3593
|
+
}
|
|
3594
|
+
/**
|
|
3595
|
+
* Summary of a cross-branch node-set copy (see {@link Branches.copyNodes}).
|
|
3596
|
+
*/
|
|
3597
|
+
interface CrossBranchCopySummary {
|
|
3598
|
+
/** Number of nodes written to the target branch (added + modified) */
|
|
3599
|
+
copied: number;
|
|
3600
|
+
/** Number of target-branch nodes pruned (deleteMissing only) */
|
|
3601
|
+
deleted: number;
|
|
3602
|
+
/** The single revision all changes were committed under (HLC string) */
|
|
3603
|
+
revision: string;
|
|
3604
|
+
/** Per-node change list */
|
|
3605
|
+
changes: CrossBranchNodeChange[];
|
|
3606
|
+
}
|
|
3534
3607
|
declare class Branches {
|
|
3535
3608
|
private sendRequest;
|
|
3536
3609
|
constructor(_context: RequestContext, sendRequest: (payload: unknown, requestType: string) => Promise<unknown>);
|
|
@@ -3571,14 +3644,117 @@ declare class Branches {
|
|
|
3571
3644
|
/**
|
|
3572
3645
|
* Compare two branches to calculate divergence
|
|
3573
3646
|
*/
|
|
3574
|
-
compare(branch: string, baseBranch: string): Promise<
|
|
3647
|
+
compare(branch: string, baseBranch: string): Promise<BranchDivergence>;
|
|
3575
3648
|
/**
|
|
3576
3649
|
* Per-node diff of `branch` relative to `baseBranch` (added/modified/deleted).
|
|
3577
3650
|
*
|
|
3578
3651
|
* Cheaper than reading both branch listings: cost scales with the number of
|
|
3579
3652
|
* changed nodes since the branches diverged, not the total content.
|
|
3580
3653
|
*/
|
|
3581
|
-
diff(branch: string, baseBranch: string): Promise<
|
|
3654
|
+
diff(branch: string, baseBranch: string): Promise<BranchDiff>;
|
|
3655
|
+
/**
|
|
3656
|
+
* Copy a node set from `sourceBranch` onto `targetBranch` (branch
|
|
3657
|
+
* promotion): node ids are preserved, so repeated copies update the same
|
|
3658
|
+
* target nodes; all changes land in ONE atomic commit on the target branch.
|
|
3659
|
+
*
|
|
3660
|
+
* Each root's parent path must already exist on the target branch. With
|
|
3661
|
+
* `deleteMissing`, target nodes under the roots that are absent from the
|
|
3662
|
+
* copied source set are pruned (one-way sync).
|
|
3663
|
+
*/
|
|
3664
|
+
copyNodes(sourceBranch: string, targetBranch: string, opts: {
|
|
3665
|
+
workspace: string;
|
|
3666
|
+
roots: string[];
|
|
3667
|
+
recursive?: boolean;
|
|
3668
|
+
deleteMissing?: boolean;
|
|
3669
|
+
}): Promise<CrossBranchCopySummary>;
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
/**
|
|
3673
|
+
* One-shot scheduled invocation operations.
|
|
3674
|
+
*
|
|
3675
|
+
* Schedule a single future run of a server-side function or flow, cancel it
|
|
3676
|
+
* before it fires (by job id or a caller-supplied external key), and inspect
|
|
3677
|
+
* pending/completed invocations. Scheduling is restart-safe: the invocation
|
|
3678
|
+
* is persisted server-side and fires even if the server restarts before
|
|
3679
|
+
* `runAt`.
|
|
3680
|
+
*/
|
|
3681
|
+
|
|
3682
|
+
/** What a scheduled invocation targets. */
|
|
3683
|
+
type ScheduledInvocationTargetKind = 'function' | 'flow';
|
|
3684
|
+
/** Options for {@link SchedulerApi.schedule}. */
|
|
3685
|
+
interface ScheduleInvocationOptions {
|
|
3686
|
+
/** "function" or "flow" */
|
|
3687
|
+
targetKind: ScheduledInvocationTargetKind;
|
|
3688
|
+
/** Path of the target function or flow node */
|
|
3689
|
+
targetPath: string;
|
|
3690
|
+
/** Input passed to the target when it fires */
|
|
3691
|
+
input?: unknown;
|
|
3692
|
+
/** When to fire — RFC3339 string or Date (a past time fires immediately) */
|
|
3693
|
+
runAt: string | Date;
|
|
3694
|
+
/** Caller-supplied idempotency/lookup key (find or cancel by this later) */
|
|
3695
|
+
externalKey?: string;
|
|
3696
|
+
/** Branch the invocation executes against (default "main") */
|
|
3697
|
+
branch?: string;
|
|
3698
|
+
/** Workspace the invocation executes against (default "functions") */
|
|
3699
|
+
workspace?: string;
|
|
3700
|
+
/** Retry attempts if the invocation fails (default 0 — one-shot) */
|
|
3701
|
+
maxRetries?: number;
|
|
3702
|
+
}
|
|
3703
|
+
/** Result of scheduling an invocation. */
|
|
3704
|
+
interface ScheduledInvocationRef {
|
|
3705
|
+
job_id: string;
|
|
3706
|
+
invocation_id: string;
|
|
3707
|
+
status: string;
|
|
3708
|
+
run_at: string;
|
|
3709
|
+
}
|
|
3710
|
+
/** A scheduled invocation as returned by get/list. */
|
|
3711
|
+
interface ScheduledInvocation {
|
|
3712
|
+
job_id: string;
|
|
3713
|
+
invocation_id: string;
|
|
3714
|
+
target_kind: string;
|
|
3715
|
+
target_path: string | null;
|
|
3716
|
+
input: unknown;
|
|
3717
|
+
actor: string | null;
|
|
3718
|
+
external_key: string | null;
|
|
3719
|
+
run_at: string | null;
|
|
3720
|
+
/** "scheduled" | "running" | "completed" | "cancelled" | "failed" */
|
|
3721
|
+
status: string;
|
|
3722
|
+
error: string | null;
|
|
3723
|
+
result: unknown;
|
|
3724
|
+
}
|
|
3725
|
+
/** Filters for {@link SchedulerApi.list}. */
|
|
3726
|
+
interface ListInvocationsFilter {
|
|
3727
|
+
externalKey?: string;
|
|
3728
|
+
status?: string;
|
|
3729
|
+
}
|
|
3730
|
+
declare class SchedulerApi {
|
|
3731
|
+
private sendRequest;
|
|
3732
|
+
constructor(_context: RequestContext, sendRequest: (payload: unknown, requestType: string) => Promise<unknown>);
|
|
3733
|
+
/**
|
|
3734
|
+
* Schedule a one-shot invocation of a function or flow at a fixed time.
|
|
3735
|
+
*/
|
|
3736
|
+
schedule(options: ScheduleInvocationOptions): Promise<ScheduledInvocationRef>;
|
|
3737
|
+
/**
|
|
3738
|
+
* Cancel a pending invocation before it fires, by job id or external key.
|
|
3739
|
+
*/
|
|
3740
|
+
cancel(ref: string | {
|
|
3741
|
+
jobId?: string;
|
|
3742
|
+
externalKey?: string;
|
|
3743
|
+
}): Promise<{
|
|
3744
|
+
job_id: string;
|
|
3745
|
+
status: string;
|
|
3746
|
+
}>;
|
|
3747
|
+
/**
|
|
3748
|
+
* List this repository's scheduled invocations.
|
|
3749
|
+
*/
|
|
3750
|
+
list(filter?: ListInvocationsFilter): Promise<ScheduledInvocation[]>;
|
|
3751
|
+
/**
|
|
3752
|
+
* Fetch a single scheduled invocation, by job id or external key.
|
|
3753
|
+
*/
|
|
3754
|
+
get(ref: string | {
|
|
3755
|
+
jobId?: string;
|
|
3756
|
+
externalKey?: string;
|
|
3757
|
+
}): Promise<ScheduledInvocation>;
|
|
3582
3758
|
}
|
|
3583
3759
|
|
|
3584
3760
|
/**
|
|
@@ -5134,6 +5310,11 @@ declare class Database {
|
|
|
5134
5310
|
* Get Tags management operations
|
|
5135
5311
|
*/
|
|
5136
5312
|
tags(): Tags;
|
|
5313
|
+
/**
|
|
5314
|
+
* Get SchedulerApi for one-shot scheduled invocations (time-based
|
|
5315
|
+
* function/flow runs).
|
|
5316
|
+
*/
|
|
5317
|
+
scheduler(): SchedulerApi;
|
|
5137
5318
|
/**
|
|
5138
5319
|
* Get FlowsApi for running flows via WebSocket
|
|
5139
5320
|
*/
|
|
@@ -5593,6 +5774,9 @@ declare class RaisinClient extends EventEmitter {
|
|
|
5593
5774
|
* @throws Error if no refresh token is stored or refresh fails
|
|
5594
5775
|
*/
|
|
5595
5776
|
refreshToken(): Promise<IdentityUser | null>;
|
|
5777
|
+
/** In-flight refresh shared by concurrent refreshToken() callers. */
|
|
5778
|
+
private _refreshInFlight;
|
|
5779
|
+
private _refreshToken;
|
|
5596
5780
|
/**
|
|
5597
5781
|
* Fetch with a timeout derived from `requestTimeout`.
|
|
5598
5782
|
*
|
|
@@ -6369,4 +6553,4 @@ declare class ConversationListStore {
|
|
|
6369
6553
|
private notify;
|
|
6370
6554
|
}
|
|
6371
6555
|
|
|
6372
|
-
export { WorkspaceManager as $, AuthManager as A, type BatchUpload as B, ConnectionState as C, Database as D, type EventMessage as E, type FlowClientOptions as F, type AuthEvent as G, type HttpClientOptions as H, type IdentityUser as I, type AuthStateChange as J, type AuthStateChangeCallback as K, type UserChangeEvent as L, type UserChangeCallback as M, type Node as N, HttpDatabase as O, type PlanProjection as P, HttpWorkspaceClient as Q, RaisinClient as R, type SubscriptionFilters as S, type ToolCallInfo as T, UploadErrorCode as U, type CurrentUser$1 as V, type UserNode$1 as W, type SignAssetOptions as X, type SignedAssetUrl as Y, type DatabaseHttpOptions as Z, WorkspaceClient as _, type ConversationStoreSnapshot as a, type
|
|
6556
|
+
export { WorkspaceManager as $, AuthManager as A, type BatchUpload as B, ConnectionState as C, Database as D, type EventMessage as E, type FlowClientOptions as F, type AuthEvent as G, type HttpClientOptions as H, type IdentityUser as I, type AuthStateChange as J, type AuthStateChangeCallback as K, type UserChangeEvent as L, type UserChangeCallback as M, type Node as N, HttpDatabase as O, type PlanProjection as P, HttpWorkspaceClient as Q, RaisinClient as R, type SubscriptionFilters as S, type ToolCallInfo as T, UploadErrorCode as U, type CurrentUser$1 as V, type UserNode$1 as W, type SignAssetOptions as X, type SignedAssetUrl as Y, type DatabaseHttpOptions as Z, WorkspaceClient as _, type ConversationStoreSnapshot as a, type SqlQueryPayload as a$, type WorkspaceCreateOptions as a0, type WorkspaceUpdateOptions as a1, NodeOperations as a2, type NodeCreateOptions as a3, type NodeCreateDeepOptions as a4, type NodeUpdateOptions as a5, type NodeQueryOptions as a6, Transaction as a7, type TransactionOptions as a8, NodeTypes as a9, type ConnectionOptions as aA, MemoryTokenStorage as aB, LocalStorageTokenStorage as aC, type TokenStorage as aD, type IdentityAuthResponse as aE, type IdentityAuthError as aF, type RequestEnvelope as aG, type ResponseEnvelope as aH, type NodeEventPayload as aI, type RequestContext as aJ, type ErrorInfo as aK, type ResponseMetadata as aL, type IncomingRelation as aM, type NodeRelationships as aN, type NodeCreatePayload as aO, type NodeCreateDeepPayload as aP, type NodeUpdatePayload as aQ, type NodeDeletePayload as aR, type NodeGetPayload as aS, type NodeHistoryPayload as aT, type RevisionEntry as aU, type AuditQueryPayload as aV, type AuditLogEntry as aW, type NodeQueryPayload as aX, type RelationAddPayload as aY, type RelationRemovePayload as aZ, type RelationsGetPayload as a_, Archetypes as aa, ElementTypes as ab, Branches as ac, type BranchDiff as ad, type BranchDivergence as ae, type CrossBranchCopySummary as af, type CrossBranchNodeChange as ag, type NodeDiffInfo as ah, Tags as ai, SchedulerApi as aj, type ListInvocationsFilter as ak, type ScheduleInvocationOptions as al, type ScheduledInvocation as am, type ScheduledInvocationRef as an, type ScheduledInvocationTargetKind as ao, HttpNodeTypes as ap, HttpArchetypes as aq, HttpElementTypes as ar, type SchemaCommit as as, SqlQuery as at, createSqlHandler as au, EventHandler as av, EventSubscriptions as aw, type EventCallback as ax, type Subscription as ay, Connection as az, type ChatMessage as b, HttpFunctionsApi as b$, type SqlResult as b0, type Workspace as b1, type WorkspaceCreatePayload as b2, type WorkspaceGetPayload as b3, type WorkspaceDeletePayload as b4, type WorkspaceUpdatePayload as b5, type SubscribePayload as b6, type UnsubscribePayload as b7, type SubscriptionResponse as b8, type AuthenticatePayload as b9, type CreateUploadRequest as bA, type CreateUploadResponse as bB, type ChunkUploadResponse as bC, type UploadStatusResponse as bD, type CompleteUploadRequest as bE, type CompleteUploadResponse as bF, type BatchFileProgress as bG, UploadError as bH, DEFAULT_CHUNK_SIZE as bI, DEFAULT_MAX_RETRIES as bJ, DEFAULT_RETRY_BASE_DELAY as bK, DEFAULT_RETRY_MAX_DELAY as bL, DEFAULT_NODE_TYPE as bM, DEFAULT_BRANCH as bN, DEFAULT_BATCH_CONCURRENCY as bO, BrowserFileSource as bP, NodeFileSource as bQ, createFileSource as bR, getContentType as bS, calculateChunkCount as bT, getChunkRange as bU, Uploader as bV, UploadManager as bW, FlowClient as bX, type FlowRunResult as bY, type FlowCollectResult as bZ, FunctionsApi as b_, type AuthenticateResponse as ba, type RefreshTokenPayload as bb, type TransactionBeginPayload as bc, type TransactionBeginResponse as bd, type TransactionCommitPayload as be, type TransactionCommitResponse as bf, type TransactionRollbackPayload as bg, RequestType as bh, ResponseStatus as bi, encodeMessage as bj, decodeMessage as bk, isEventMessage as bl, isResponseEnvelope as bm, ReconnectManager as bn, LogLevel as bo, logger as bp, configureLogger as bq, setLogLevel as br, getLogLevel as bs, getLoggerConfig as bt, type LoggerConfig as bu, type UploadStatus as bv, type UploadOptions as bw, type UploadProgress as bx, type UploadResult as by, type Upload as bz, ConversationStore as c, type ChatCompletedEvent as c$, type FunctionInvokeOptions as c0, type FunctionInvokeResponse as c1, type FunctionInvokeSyncResponse as c2, type FlowRunResponse as c3, type FlowInstanceStatus as c4, type FlowInstanceStatusResponse as c5, type StepStartedEvent as c6, type StepCompletedEvent as c7, type StepFailedEvent as c8, type FlowWaitingEvent as c9, type FlowDefinitionNodeBase as cA, type FlowStepProperties as cB, type FlowDefinitionStep as cC, type ContainerRule as cD, type FlowDefinitionContainer as cE, type FlowDefinitionNode as cF, type FlowDefinition as cG, type InboxTask as cH, type InboxTaskStatus as cI, type TaskCompletionResult as cJ, RETRY_STRATEGIES as cK, getRefDisplayName as cL, getRefPath as cM, isFlowDefinitionStep as cN, isFlowDefinitionContainer as cO, InboxApi as cP, type InboxApiOptions as cQ, type ListTasksOptions as cR, type ListTasksResponse as cS, type ChatEvent as cT, type Conversation as cU, type ConversationType as cV, type ConversationStatus as cW, type MessageBody as cX, type ChatTextChunkEvent as cY, type ChatAssistantMessageEvent as cZ, type ChatWaitingEvent as c_, type FlowResumedEvent as ca, type FlowCompletedEvent as cb, type FlowFailedEvent as cc, type TextChunkEvent as cd, type ToolCallStartedEvent as ce, type ToolCallCompletedEvent as cf, type ThoughtChunkEvent as cg, type ConversationCreatedEvent as ch, type MessageSavedEvent as ci, type LogEvent as cj, isTerminalEvent as ck, type RaisinReference as cl, type ContainerType as cm, type StepErrorBehavior as cn, type FlowErrorStrategy as co, type RetryConfig as cp, type RetryStrategy as cq, type HumanTaskType as cr, type TaskOption as cs, type HandoffTarget as ct, type ChatTerminationMode as cu, type ChatTerminationConfig as cv, type ChatStepConfig as cw, type AiToolMode as cx, type AiErrorBehavior as cy, type AiContainerConfig as cz, type ConversationListItem as d, type ChatFailedEvent as d0, type ChatDoneEvent as d1, type ChatToolCallStartedEvent as d2, type ChatToolCallCompletedEvent as d3, type ChatThoughtChunkEvent as d4, type ToolCallRecord as d5, type MessageChild as d6, type PlanTask as d7, type ChatConversationCreatedEvent as d8, type ChatMessageSavedEvent as d9, type ChatMessageDeliveredEvent as da, type ChatLogEvent as db, ConversationManager as dc, DEFAULT_SEND_MESSAGE_INACTIVITY_TIMEOUT_MS as dd, type ListConversationsOptions as de, type CreateConversationOptions as df, type SendMessageOptions as dg, type ConversationSubscription as dh, type PlanActionReceipt as di, type PlanActionOptions as dj, type ConversationManagerOptions as dk, projectPlansFromMessages as dl, 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 ClientMode as x, type CurrentUser as y, type UserNode as z };
|