@realtimex/folio 0.1.15 → 0.1.17
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/api/src/middleware/auth.ts +77 -0
- package/api/src/routes/chat.ts +7 -1
- package/api/src/routes/index.ts +2 -0
- package/api/src/routes/ingestions.ts +51 -6
- package/api/src/routes/policies.ts +50 -7
- package/api/src/routes/stats.ts +9 -5
- package/api/src/routes/workspaces.ts +290 -0
- package/api/src/services/ChatService.ts +8 -2
- package/api/src/services/IngestionService.ts +38 -26
- package/api/src/services/PolicyEngine.ts +4 -1
- package/api/src/services/PolicyLearningService.ts +31 -6
- package/api/src/services/PolicyLoader.ts +44 -25
- package/api/src/services/RAGService.ts +52 -12
- package/api/src/services/SDKService.ts +48 -2
- package/dist/api/src/middleware/auth.js +59 -0
- package/dist/api/src/routes/chat.js +1 -1
- package/dist/api/src/routes/index.js +2 -0
- package/dist/api/src/routes/ingestions.js +51 -9
- package/dist/api/src/routes/policies.js +49 -7
- package/dist/api/src/routes/stats.js +9 -5
- package/dist/api/src/routes/workspaces.js +220 -0
- package/dist/api/src/services/ChatService.js +7 -2
- package/dist/api/src/services/IngestionService.js +35 -30
- package/dist/api/src/services/PolicyEngine.js +2 -1
- package/dist/api/src/services/PolicyLearningService.js +28 -6
- package/dist/api/src/services/PolicyLoader.js +29 -25
- package/dist/api/src/services/RAGService.js +43 -11
- package/dist/api/src/services/SDKService.js +37 -2
- package/dist/assets/index-CTn5FcC4.js +113 -0
- package/dist/assets/index-Dq9sxoZK.css +1 -0
- package/dist/index.html +2 -2
- package/docs-dev/ingestion-engine.md +3 -3
- package/package.json +1 -1
- package/supabase/functions/workspace-invite/index.ts +110 -0
- package/supabase/migrations/20260223000000_initial_foundation.sql +5 -0
- package/supabase/migrations/20260224000004_add_avatars_storage.sql +4 -0
- package/supabase/migrations/20260224000006_add_policies_table.sql +5 -0
- package/supabase/migrations/20260224000008_add_ingestions_table.sql +2 -0
- package/supabase/migrations/20260225000000_setup_compatible_mode.sql +17 -4
- package/supabase/migrations/20260225000003_add_baseline_configs.sql +4 -3
- package/supabase/migrations/20260226000000_add_processing_events.sql +1 -0
- package/supabase/migrations/20260226000002_add_dynamic_rag.sql +1 -0
- package/supabase/migrations/20260226000005_add_chat_tables.sql +3 -0
- package/supabase/migrations/20260228000001_add_policy_match_feedback.sql +4 -0
- package/supabase/migrations/20260302064608_add_ingestion_llm_settings_compat.sql +15 -0
- package/supabase/migrations/20260303000000_add_workspaces_phase1.sql +459 -0
- package/supabase/migrations/20260303010000_add_workspace_management_rpc.sql +310 -0
- package/supabase/migrations/20260303020000_workspace_scope_document_chunks.sql +139 -0
- package/dist/assets/index-Cj989Mcp.js +0 -113
- package/dist/assets/index-DzN8-j-e.css +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { RealtimeXSDK } from "@realtimex/sdk";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
2
4
|
import { createLogger } from "../utils/logger.js";
|
|
3
5
|
const logger = createLogger("SDKService");
|
|
4
6
|
export class SDKService {
|
|
@@ -34,7 +36,6 @@ export class SDKService {
|
|
|
34
36
|
]
|
|
35
37
|
});
|
|
36
38
|
logger.info("RealTimeX SDK initialized successfully");
|
|
37
|
-
// @ts-ignore ping available in desktop bridge
|
|
38
39
|
this.instance.ping?.().catch(() => {
|
|
39
40
|
logger.warn("Desktop ping failed during startup");
|
|
40
41
|
});
|
|
@@ -61,7 +62,6 @@ export class SDKService {
|
|
|
61
62
|
return false;
|
|
62
63
|
// Try to ping first (faster)
|
|
63
64
|
try {
|
|
64
|
-
// @ts-ignore ping available in desktop bridge
|
|
65
65
|
await sdk.ping();
|
|
66
66
|
return true;
|
|
67
67
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -95,6 +95,40 @@ export class SDKService {
|
|
|
95
95
|
clearTimeout(timeoutHandle);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
static appDataDir = null;
|
|
99
|
+
static async getAppDataDir() {
|
|
100
|
+
if (this.appDataDir) {
|
|
101
|
+
return this.appDataDir;
|
|
102
|
+
}
|
|
103
|
+
const sdk = this.getSDK();
|
|
104
|
+
if (!sdk) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const dataDir = await this.withTimeout(sdk.getAppDataDir(), 10000, "App data directory fetch timed out");
|
|
109
|
+
if (!dataDir || !dataDir.trim()) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
this.appDataDir = dataDir;
|
|
113
|
+
return dataDir;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
logger.warn("Failed to get app data directory from SDK", {
|
|
117
|
+
error: error instanceof Error ? error.message : String(error),
|
|
118
|
+
});
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
static async getDefaultDropzoneDir() {
|
|
123
|
+
const sdkDataDir = await this.getAppDataDir();
|
|
124
|
+
if (sdkDataDir) {
|
|
125
|
+
return path.join(sdkDataDir, "dropzone");
|
|
126
|
+
}
|
|
127
|
+
const sdkAppId = this.getSDK()?.appId?.trim();
|
|
128
|
+
const envAppId = process.env.RTX_APP_ID?.trim();
|
|
129
|
+
const fallbackAppId = sdkAppId || envAppId || "folio";
|
|
130
|
+
return path.join(os.homedir(), ".realtimex.ai", "Resources", "local-apps", fallbackAppId, "dropzone");
|
|
131
|
+
}
|
|
98
132
|
// Cache for default providers (avoid repeated SDK calls)
|
|
99
133
|
static defaultChatProvider = null;
|
|
100
134
|
static defaultEmbedProvider = null;
|
|
@@ -206,6 +240,7 @@ export class SDKService {
|
|
|
206
240
|
return await this.getDefaultEmbedProvider();
|
|
207
241
|
}
|
|
208
242
|
static clearProviderCache() {
|
|
243
|
+
this.appDataDir = null;
|
|
209
244
|
this.defaultChatProvider = null;
|
|
210
245
|
this.defaultEmbedProvider = null;
|
|
211
246
|
}
|