@terminals-tech/sdk 1.0.0-rc.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -19
- package/dist/WebContainerManager-4LIOGRVM.js +22 -0
- package/dist/browser-http-client-ZQLDWZMU.js +317 -0
- package/dist/cache-VKYSQRXX.js +45 -0
- package/dist/capabilities-MIPUMBLL.js +96 -0
- package/dist/chunk-2ESYSVXG.js +48 -0
- package/dist/chunk-2WTYE4SW.js +190 -0
- package/dist/chunk-3LFMIVJM.js +40 -0
- package/dist/chunk-ABCK4FWN.js +136 -0
- package/dist/chunk-AFDUOYHD.js +2060 -0
- package/dist/chunk-BCOQMFKT.js +265 -0
- package/dist/chunk-BYXBJQAS.js +0 -0
- package/dist/chunk-DKFJIILR.js +9798 -0
- package/dist/chunk-EXI3LJVJ.js +51 -0
- package/dist/chunk-FOXUEYWK.js +42 -0
- package/dist/chunk-GJWAJAX3.js +173 -0
- package/dist/chunk-H3POJCFA.js +333 -0
- package/dist/chunk-KASHT6C5.js +784 -0
- package/dist/chunk-KHR7ZYCX.js +4034 -0
- package/dist/chunk-L45BSQDJ.js +296 -0
- package/dist/chunk-LLGZTP3G.js +5521 -0
- package/dist/chunk-NTMBOESX.js +152 -0
- package/dist/chunk-OCLSAUCD.js +474 -0
- package/dist/chunk-OSSRZOGC.js +190 -0
- package/dist/chunk-PPFTKJDB.js +497 -0
- package/dist/chunk-PWAHFID5.js +381 -0
- package/dist/chunk-Q2VI6ICE.js +188 -0
- package/dist/chunk-QJFKEQHF.js +6460 -0
- package/dist/chunk-QWXPVB2L.js +320 -0
- package/dist/chunk-QWZRZKLZ.js +896 -0
- package/dist/chunk-STMI72WH.js +1005 -0
- package/dist/chunk-TSQ3BGLA.js +11945 -0
- package/dist/chunk-UJDUQNE2.js +79 -0
- package/dist/chunk-VZA2NUH3.js +118 -0
- package/dist/chunk-WGBCRNMB.js +1817 -0
- package/dist/chunk-WU4OTGJE.js +752 -0
- package/dist/chunk-XPJ63Y6T.js +70 -0
- package/dist/chunk-Y2EULKA2.js +172 -0
- package/dist/chunk-YJEZWCYV.js +94 -0
- package/dist/chunk-ZVO47SQV.js +150 -0
- package/dist/container-lite-QD3CRLS4.js +327 -0
- package/dist/core-H2UUDATO.js +146 -0
- package/dist/crypto-D4LMI2RN.js +45 -0
- package/dist/db-BWC2GGBN.js +50 -0
- package/dist/demo-T655Z5S4.js +87 -0
- package/dist/diagnostics-6RQTBR6I.js +113 -0
- package/dist/dist-OPDCWARF.js +727 -0
- package/dist/dist-VXJEKX3T.js +2441 -0
- package/dist/dist-VYGJXGUS.js +1008 -0
- package/dist/embeddings-7QXTXUMC.js +15 -0
- package/dist/embeddings-MAEWWUHW.js +9 -0
- package/dist/graph-RKMNE2X5.js +36 -0
- package/dist/hvm-CBEP3M4F.js +126 -0
- package/dist/index.cjs +49874 -8001
- package/dist/index.d.cts +1629 -1363
- package/dist/index.d.ts +1629 -1363
- package/dist/index.js +2462 -8130
- package/dist/mcp-NK34ZNM5.js +101 -0
- package/dist/mcp-client-service-browser-SGB2K3VZ.js +14 -0
- package/dist/neuro-state-XHRGIRVO.js +498 -0
- package/dist/nodes-K6GKI2FM.js +364 -0
- package/dist/package-EXUIU2RL.js +93 -0
- package/dist/package-VGL7HYTO.js +106 -0
- package/dist/package-XHMLOAQ4.js +98 -0
- package/dist/pg-events-QJAM2HIP.js +15 -0
- package/dist/pglite-adapter-43IOUBMV.js +50 -0
- package/dist/pgliteService-IUGNNOVU.js +258 -0
- package/dist/policy-IRJCM6FS.js +13 -0
- package/dist/registry-5WTDYQVQ.js +26 -0
- package/dist/registry-FW63E7FE.js +16 -0
- package/dist/registry-ZQ2IBLF6.js +9 -0
- package/dist/resolver-ALOJSOK5.js +24 -0
- package/dist/scheduler-B5CEYKWT.js +127 -0
- package/dist/secret-store-H7273UIT.js +18 -0
- package/dist/server-VW6DYDLH.js +18 -0
- package/dist/skills-VN7IN7SJ.js +6375 -0
- package/dist/stack-4KWCQQP7.js +103 -0
- package/dist/storage-L7MWNSPG.js +13 -0
- package/dist/supabaseService-6AYP2VY3.js +476 -0
- package/dist/topology-CIWWNVAN.js +13 -0
- package/dist/webcontainer-XWCE56F3.js +281 -0
- package/package.json +9 -3
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import "./chunk-2ESYSVXG.js";
|
|
2
|
+
|
|
3
|
+
// ../../lib/brain/connectors/pglite-adapter.ts
|
|
4
|
+
function createDBClientFromPGLite(db) {
|
|
5
|
+
return {
|
|
6
|
+
async executeDDL(sql, _params) {
|
|
7
|
+
await db.exec(sql);
|
|
8
|
+
},
|
|
9
|
+
async executeQuery(sql, params) {
|
|
10
|
+
const result = await db.query(sql, params);
|
|
11
|
+
return { rows: result.rows };
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
async function getConnectorChunks(connectorId) {
|
|
16
|
+
try {
|
|
17
|
+
const pglitePath = "@/lib/pglite/client";
|
|
18
|
+
const mod = await import(
|
|
19
|
+
/* webpackIgnore: true */
|
|
20
|
+
pglitePath
|
|
21
|
+
);
|
|
22
|
+
const db = mod.getDB?.();
|
|
23
|
+
if (!db) return [];
|
|
24
|
+
const result = await db.query(
|
|
25
|
+
`SELECT id, connector_id, content, metadata
|
|
26
|
+
FROM connector_chunks
|
|
27
|
+
WHERE connector_id = $1
|
|
28
|
+
ORDER BY id`,
|
|
29
|
+
[connectorId]
|
|
30
|
+
);
|
|
31
|
+
return (result.rows || []).map((row) => ({
|
|
32
|
+
id: row.id,
|
|
33
|
+
connectorId: row.connector_id,
|
|
34
|
+
content: row.content,
|
|
35
|
+
metadata: {
|
|
36
|
+
source: String(row.metadata?.source ?? ""),
|
|
37
|
+
title: String(row.metadata?.title ?? ""),
|
|
38
|
+
mimeType: String(row.metadata?.mimeType ?? "application/octet-stream"),
|
|
39
|
+
extractedAt: Number(row.metadata?.extractedAt ?? Date.now()),
|
|
40
|
+
...row.metadata
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
} catch {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
createDBClientFromPGLite,
|
|
49
|
+
getConnectorChunks
|
|
50
|
+
};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GET_ALL_QUIZZES_WITH_USER_PROGRESS_SQL,
|
|
3
|
+
SEARCH_QUIZZES_SQL,
|
|
4
|
+
addChatMessage,
|
|
5
|
+
batchStoreEmbeddings,
|
|
6
|
+
checkQuizCompletion,
|
|
7
|
+
checkpointDatabase,
|
|
8
|
+
cleanupOrphanedRuns,
|
|
9
|
+
clearChatMessages,
|
|
10
|
+
completeQuizAndProcessRewards,
|
|
11
|
+
createChatSession,
|
|
12
|
+
createDeployment,
|
|
13
|
+
createSavepoint,
|
|
14
|
+
createSkillRun,
|
|
15
|
+
createUserProfile,
|
|
16
|
+
deleteChatSession,
|
|
17
|
+
deleteDeployment,
|
|
18
|
+
deleteForgeMaterialProfile,
|
|
19
|
+
deleteForgeScene,
|
|
20
|
+
deleteSkillRun,
|
|
21
|
+
deleteUserArtifact,
|
|
22
|
+
deleteWorkspaceState,
|
|
23
|
+
findSimilarDocuments,
|
|
24
|
+
getAllChatSessions,
|
|
25
|
+
getAllFriends,
|
|
26
|
+
getAllInspirations,
|
|
27
|
+
getAllQuizzes,
|
|
28
|
+
getAllQuizzesWithUserProgress,
|
|
29
|
+
getAllResourceCategories,
|
|
30
|
+
getAllResourceDocuments,
|
|
31
|
+
getAllRewards,
|
|
32
|
+
getAllUserProgress,
|
|
33
|
+
getAllWorkspaceStates,
|
|
34
|
+
getBiosignalBridgeConfig,
|
|
35
|
+
getBiosignalProviderConfig,
|
|
36
|
+
getChatMessageCount,
|
|
37
|
+
getChatMessages,
|
|
38
|
+
getChatSession,
|
|
39
|
+
getDeployment,
|
|
40
|
+
getDeploymentsByStack,
|
|
41
|
+
getDeploymentsByUser,
|
|
42
|
+
getDocumentsWithoutEmbeddings,
|
|
43
|
+
getEffectiveOrCreateUserProfile,
|
|
44
|
+
getForgeIterationsByScene,
|
|
45
|
+
getForgeMaterialProfiles,
|
|
46
|
+
getForgeScene,
|
|
47
|
+
getForgeScenesByUser,
|
|
48
|
+
getKBStats,
|
|
49
|
+
getPGLiteIndexedDbSize,
|
|
50
|
+
getPgStatIoStats,
|
|
51
|
+
getQuizById,
|
|
52
|
+
getResourceCategoryById,
|
|
53
|
+
getResourceDocumentById,
|
|
54
|
+
getRewardById,
|
|
55
|
+
getSkillRun,
|
|
56
|
+
getSkillRunsBySlug,
|
|
57
|
+
getSkillRunsByUser,
|
|
58
|
+
getUserArtifactById,
|
|
59
|
+
getUserArtifacts,
|
|
60
|
+
getUserProfile,
|
|
61
|
+
getUserProfileByXverseAddress,
|
|
62
|
+
getUserProgress,
|
|
63
|
+
getVectorSearchMetrics,
|
|
64
|
+
getWorkspaceState,
|
|
65
|
+
hybridSearch,
|
|
66
|
+
hybridSearchDocuments,
|
|
67
|
+
initializeVectorSearch,
|
|
68
|
+
listBiosignalBridgeConfigs,
|
|
69
|
+
listBiosignalProviderConfigs,
|
|
70
|
+
listEnabledBiosignalBridges,
|
|
71
|
+
listEnabledBiosignalProviders,
|
|
72
|
+
releaseSavepoint,
|
|
73
|
+
reseedDormantBiosignalBridges,
|
|
74
|
+
reseedDormantBiosignalProviders,
|
|
75
|
+
resetDatabase,
|
|
76
|
+
retrieveTopKForSession,
|
|
77
|
+
robustJsonParse,
|
|
78
|
+
rollbackToSavepoint,
|
|
79
|
+
safeDbOperation,
|
|
80
|
+
saveForgeIteration,
|
|
81
|
+
saveForgeMaterialProfile,
|
|
82
|
+
saveForgeScene,
|
|
83
|
+
saveGenericState,
|
|
84
|
+
saveUserArtifact,
|
|
85
|
+
saveWorkspaceState,
|
|
86
|
+
searchDocumentsByVector,
|
|
87
|
+
searchQuizzes,
|
|
88
|
+
searchResourceCategories,
|
|
89
|
+
searchResourceDocuments,
|
|
90
|
+
setBiosignalBridgeEnabled,
|
|
91
|
+
setBiosignalProviderEnabled,
|
|
92
|
+
storeDocumentEmbedding,
|
|
93
|
+
unlockReward,
|
|
94
|
+
updateChatSessionTitle,
|
|
95
|
+
updateDeploymentStatus,
|
|
96
|
+
updateSkillRunStatus,
|
|
97
|
+
updateUserProfile,
|
|
98
|
+
upsertConversationEmbedding,
|
|
99
|
+
upsertUserProgress,
|
|
100
|
+
withSavepoint
|
|
101
|
+
} from "./chunk-WGBCRNMB.js";
|
|
102
|
+
import {
|
|
103
|
+
deleteDatabaseByDataDir,
|
|
104
|
+
getStorageEstimate,
|
|
105
|
+
isStoragePersisted,
|
|
106
|
+
requestPersistentStorage
|
|
107
|
+
} from "./chunk-3LFMIVJM.js";
|
|
108
|
+
import {
|
|
109
|
+
PGLiteConnectionPool,
|
|
110
|
+
checkConnectionPoolHealth,
|
|
111
|
+
forceHardReset,
|
|
112
|
+
getConnectionPoolStats,
|
|
113
|
+
getCurrentDataDir,
|
|
114
|
+
getCurrentScope,
|
|
115
|
+
getDB,
|
|
116
|
+
getDataDirForScope,
|
|
117
|
+
getDatabase,
|
|
118
|
+
getDbHealth,
|
|
119
|
+
getDbInitStatus,
|
|
120
|
+
getSchemaVersion,
|
|
121
|
+
initializeSchema,
|
|
122
|
+
isDatabaseReady,
|
|
123
|
+
onDbInitStatusChange,
|
|
124
|
+
restartDbInit,
|
|
125
|
+
retryDbInit,
|
|
126
|
+
setDbScope,
|
|
127
|
+
shutdownPool,
|
|
128
|
+
withDB,
|
|
129
|
+
withTransaction
|
|
130
|
+
} from "./chunk-AFDUOYHD.js";
|
|
131
|
+
import "./chunk-NTMBOESX.js";
|
|
132
|
+
import "./chunk-2ESYSVXG.js";
|
|
133
|
+
export {
|
|
134
|
+
GET_ALL_QUIZZES_WITH_USER_PROGRESS_SQL,
|
|
135
|
+
PGLiteConnectionPool,
|
|
136
|
+
SEARCH_QUIZZES_SQL,
|
|
137
|
+
addChatMessage,
|
|
138
|
+
batchStoreEmbeddings,
|
|
139
|
+
checkConnectionPoolHealth,
|
|
140
|
+
checkQuizCompletion,
|
|
141
|
+
checkpointDatabase,
|
|
142
|
+
cleanupOrphanedRuns,
|
|
143
|
+
clearChatMessages,
|
|
144
|
+
completeQuizAndProcessRewards,
|
|
145
|
+
createChatSession,
|
|
146
|
+
createDeployment,
|
|
147
|
+
createSavepoint,
|
|
148
|
+
createSkillRun,
|
|
149
|
+
createUserProfile,
|
|
150
|
+
deleteChatSession,
|
|
151
|
+
deleteDatabaseByDataDir,
|
|
152
|
+
deleteDeployment,
|
|
153
|
+
deleteForgeMaterialProfile,
|
|
154
|
+
deleteForgeScene,
|
|
155
|
+
deleteSkillRun,
|
|
156
|
+
deleteUserArtifact,
|
|
157
|
+
deleteWorkspaceState,
|
|
158
|
+
findSimilarDocuments,
|
|
159
|
+
forceHardReset,
|
|
160
|
+
getAllChatSessions,
|
|
161
|
+
getAllFriends,
|
|
162
|
+
getAllInspirations,
|
|
163
|
+
getAllQuizzes,
|
|
164
|
+
getAllQuizzesWithUserProgress,
|
|
165
|
+
getAllResourceCategories,
|
|
166
|
+
getAllResourceDocuments,
|
|
167
|
+
getAllRewards,
|
|
168
|
+
getAllUserProgress,
|
|
169
|
+
getAllWorkspaceStates,
|
|
170
|
+
getBiosignalBridgeConfig,
|
|
171
|
+
getBiosignalProviderConfig,
|
|
172
|
+
getChatMessageCount,
|
|
173
|
+
getChatMessages,
|
|
174
|
+
getChatSession,
|
|
175
|
+
getConnectionPoolStats,
|
|
176
|
+
getCurrentDataDir,
|
|
177
|
+
getCurrentScope,
|
|
178
|
+
getDB,
|
|
179
|
+
getDataDirForScope,
|
|
180
|
+
getDatabase,
|
|
181
|
+
getDbHealth,
|
|
182
|
+
getDbInitStatus,
|
|
183
|
+
getDeployment,
|
|
184
|
+
getDeploymentsByStack,
|
|
185
|
+
getDeploymentsByUser,
|
|
186
|
+
getDocumentsWithoutEmbeddings,
|
|
187
|
+
getEffectiveOrCreateUserProfile,
|
|
188
|
+
getForgeIterationsByScene,
|
|
189
|
+
getForgeMaterialProfiles,
|
|
190
|
+
getForgeScene,
|
|
191
|
+
getForgeScenesByUser,
|
|
192
|
+
getKBStats,
|
|
193
|
+
getPGLiteIndexedDbSize,
|
|
194
|
+
getPgStatIoStats,
|
|
195
|
+
getQuizById,
|
|
196
|
+
getResourceCategoryById,
|
|
197
|
+
getResourceDocumentById,
|
|
198
|
+
getRewardById,
|
|
199
|
+
getSchemaVersion,
|
|
200
|
+
getSkillRun,
|
|
201
|
+
getSkillRunsBySlug,
|
|
202
|
+
getSkillRunsByUser,
|
|
203
|
+
getStorageEstimate,
|
|
204
|
+
getUserArtifactById,
|
|
205
|
+
getUserArtifacts,
|
|
206
|
+
getUserProfile,
|
|
207
|
+
getUserProfileByXverseAddress,
|
|
208
|
+
getUserProgress,
|
|
209
|
+
getVectorSearchMetrics,
|
|
210
|
+
getWorkspaceState,
|
|
211
|
+
hybridSearch,
|
|
212
|
+
hybridSearchDocuments,
|
|
213
|
+
initializeSchema,
|
|
214
|
+
initializeVectorSearch,
|
|
215
|
+
isDatabaseReady,
|
|
216
|
+
isStoragePersisted,
|
|
217
|
+
listBiosignalBridgeConfigs,
|
|
218
|
+
listBiosignalProviderConfigs,
|
|
219
|
+
listEnabledBiosignalBridges,
|
|
220
|
+
listEnabledBiosignalProviders,
|
|
221
|
+
onDbInitStatusChange,
|
|
222
|
+
releaseSavepoint,
|
|
223
|
+
requestPersistentStorage,
|
|
224
|
+
reseedDormantBiosignalBridges,
|
|
225
|
+
reseedDormantBiosignalProviders,
|
|
226
|
+
resetDatabase,
|
|
227
|
+
restartDbInit,
|
|
228
|
+
retrieveTopKForSession,
|
|
229
|
+
retryDbInit,
|
|
230
|
+
robustJsonParse,
|
|
231
|
+
rollbackToSavepoint,
|
|
232
|
+
safeDbOperation,
|
|
233
|
+
saveForgeIteration,
|
|
234
|
+
saveForgeMaterialProfile,
|
|
235
|
+
saveForgeScene,
|
|
236
|
+
saveGenericState,
|
|
237
|
+
saveUserArtifact,
|
|
238
|
+
saveWorkspaceState,
|
|
239
|
+
searchDocumentsByVector,
|
|
240
|
+
searchQuizzes,
|
|
241
|
+
searchResourceCategories,
|
|
242
|
+
searchResourceDocuments,
|
|
243
|
+
setBiosignalBridgeEnabled,
|
|
244
|
+
setBiosignalProviderEnabled,
|
|
245
|
+
setDbScope,
|
|
246
|
+
shutdownPool,
|
|
247
|
+
storeDocumentEmbedding,
|
|
248
|
+
unlockReward,
|
|
249
|
+
updateChatSessionTitle,
|
|
250
|
+
updateDeploymentStatus,
|
|
251
|
+
updateSkillRunStatus,
|
|
252
|
+
updateUserProfile,
|
|
253
|
+
upsertConversationEmbedding,
|
|
254
|
+
upsertUserProgress,
|
|
255
|
+
withDB,
|
|
256
|
+
withSavepoint,
|
|
257
|
+
withTransaction
|
|
258
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isNetworkAllowed,
|
|
3
|
+
requireNetworkApproval
|
|
4
|
+
} from "./chunk-UJDUQNE2.js";
|
|
5
|
+
import "./chunk-WGBCRNMB.js";
|
|
6
|
+
import "./chunk-3LFMIVJM.js";
|
|
7
|
+
import "./chunk-AFDUOYHD.js";
|
|
8
|
+
import "./chunk-NTMBOESX.js";
|
|
9
|
+
import "./chunk-2ESYSVXG.js";
|
|
10
|
+
export {
|
|
11
|
+
isNetworkAllowed,
|
|
12
|
+
requireNetworkApproval
|
|
13
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runners
|
|
3
|
+
} from "./chunk-PPFTKJDB.js";
|
|
4
|
+
import "./chunk-KASHT6C5.js";
|
|
5
|
+
import "./chunk-H3POJCFA.js";
|
|
6
|
+
import "./chunk-KHR7ZYCX.js";
|
|
7
|
+
import "./chunk-PWAHFID5.js";
|
|
8
|
+
import "./chunk-Y2EULKA2.js";
|
|
9
|
+
import "./chunk-WU4OTGJE.js";
|
|
10
|
+
import "./chunk-OCLSAUCD.js";
|
|
11
|
+
import "./chunk-BYXBJQAS.js";
|
|
12
|
+
import "./chunk-BCOQMFKT.js";
|
|
13
|
+
import "./chunk-2WTYE4SW.js";
|
|
14
|
+
import "./chunk-FOXUEYWK.js";
|
|
15
|
+
import "./chunk-EXI3LJVJ.js";
|
|
16
|
+
import "./chunk-QJFKEQHF.js";
|
|
17
|
+
import "./chunk-ZVO47SQV.js";
|
|
18
|
+
import "./chunk-XPJ63Y6T.js";
|
|
19
|
+
import "./chunk-WGBCRNMB.js";
|
|
20
|
+
import "./chunk-3LFMIVJM.js";
|
|
21
|
+
import "./chunk-AFDUOYHD.js";
|
|
22
|
+
import "./chunk-NTMBOESX.js";
|
|
23
|
+
import "./chunk-2ESYSVXG.js";
|
|
24
|
+
export {
|
|
25
|
+
runners
|
|
26
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChatGenerateInput,
|
|
3
|
+
ChatGenerateOutput,
|
|
4
|
+
ChatMessage,
|
|
5
|
+
getProvider,
|
|
6
|
+
registerProvider
|
|
7
|
+
} from "./chunk-H3POJCFA.js";
|
|
8
|
+
import "./chunk-KHR7ZYCX.js";
|
|
9
|
+
import "./chunk-2ESYSVXG.js";
|
|
10
|
+
export {
|
|
11
|
+
ChatGenerateInput,
|
|
12
|
+
ChatGenerateOutput,
|
|
13
|
+
ChatMessage,
|
|
14
|
+
getProvider,
|
|
15
|
+
registerProvider
|
|
16
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "./chunk-2ESYSVXG.js";
|
|
2
|
+
|
|
3
|
+
// ../../lib/brain/connectors/resolver.ts
|
|
4
|
+
async function resolveConnectorData(ref) {
|
|
5
|
+
try {
|
|
6
|
+
const { getConnectorChunks } = await import("./pglite-adapter-43IOUBMV.js");
|
|
7
|
+
const chunks = await getConnectorChunks(ref.connectorId);
|
|
8
|
+
if (!ref.dataChunkFilter || Object.keys(ref.dataChunkFilter).length === 0) {
|
|
9
|
+
return chunks;
|
|
10
|
+
}
|
|
11
|
+
return chunks.filter((chunk) => {
|
|
12
|
+
for (const [key, value] of Object.entries(ref.dataChunkFilter)) {
|
|
13
|
+
if (chunk.metadata[key] !== value) return false;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
});
|
|
17
|
+
} catch (err) {
|
|
18
|
+
console.warn(`[connector-resolver] Failed to resolve connector ${ref.connectorId}:`, err);
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
resolveConnectorData
|
|
24
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OrchestratorV0,
|
|
3
|
+
buildScheduleTriggerContext,
|
|
4
|
+
loadStack
|
|
5
|
+
} from "./chunk-STMI72WH.js";
|
|
6
|
+
import "./chunk-GJWAJAX3.js";
|
|
7
|
+
import "./chunk-VZA2NUH3.js";
|
|
8
|
+
import "./chunk-QWXPVB2L.js";
|
|
9
|
+
import {
|
|
10
|
+
createClient,
|
|
11
|
+
init_dist
|
|
12
|
+
} from "./chunk-TSQ3BGLA.js";
|
|
13
|
+
import "./chunk-Q2VI6ICE.js";
|
|
14
|
+
import "./chunk-PWAHFID5.js";
|
|
15
|
+
import "./chunk-Y2EULKA2.js";
|
|
16
|
+
import {
|
|
17
|
+
resolveNode
|
|
18
|
+
} from "./chunk-OCLSAUCD.js";
|
|
19
|
+
import "./chunk-BYXBJQAS.js";
|
|
20
|
+
import "./chunk-BCOQMFKT.js";
|
|
21
|
+
import "./chunk-2WTYE4SW.js";
|
|
22
|
+
import "./chunk-FOXUEYWK.js";
|
|
23
|
+
import "./chunk-EXI3LJVJ.js";
|
|
24
|
+
import "./chunk-QJFKEQHF.js";
|
|
25
|
+
import "./chunk-ZVO47SQV.js";
|
|
26
|
+
import "./chunk-XPJ63Y6T.js";
|
|
27
|
+
import "./chunk-WGBCRNMB.js";
|
|
28
|
+
import "./chunk-3LFMIVJM.js";
|
|
29
|
+
import "./chunk-AFDUOYHD.js";
|
|
30
|
+
import "./chunk-NTMBOESX.js";
|
|
31
|
+
import "./chunk-2ESYSVXG.js";
|
|
32
|
+
|
|
33
|
+
// ../../lib/terminals-tech/machines/core/scheduler.ts
|
|
34
|
+
init_dist();
|
|
35
|
+
function getSupabase() {
|
|
36
|
+
const url = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
|
37
|
+
const key = process.env.SUPABASE_SERVICE_ROLE_KEY;
|
|
38
|
+
if (!url || !key) return null;
|
|
39
|
+
return createClient(url, key, { auth: { persistSession: false } });
|
|
40
|
+
}
|
|
41
|
+
var globalWithJobs = globalThis;
|
|
42
|
+
var jobs = globalWithJobs.__terminals_jobs__ || /* @__PURE__ */ new Map();
|
|
43
|
+
globalWithJobs.__terminals_jobs__ = jobs;
|
|
44
|
+
function getSchedule(stackId) {
|
|
45
|
+
const j = jobs.get(stackId);
|
|
46
|
+
if (!j) return null;
|
|
47
|
+
return { everySeconds: Math.max(1, Math.floor(j.intervalMs / 1e3)) };
|
|
48
|
+
}
|
|
49
|
+
async function scheduleStack(stackId, everySeconds, triggerConfig) {
|
|
50
|
+
cancelSchedule(stackId);
|
|
51
|
+
const intervalMs = Math.max(1e3, everySeconds * 1e3);
|
|
52
|
+
const supabase = getSupabase();
|
|
53
|
+
if (supabase) {
|
|
54
|
+
const { error } = await supabase.from("stack_schedules").upsert(
|
|
55
|
+
{
|
|
56
|
+
stack_id: stackId,
|
|
57
|
+
every_seconds: everySeconds,
|
|
58
|
+
active: true,
|
|
59
|
+
next_run_at: new Date(Date.now() + intervalMs).toISOString(),
|
|
60
|
+
...triggerConfig ? { trigger_config: triggerConfig, trigger_kind: triggerConfig.kind } : {}
|
|
61
|
+
},
|
|
62
|
+
{ onConflict: "stack_id" }
|
|
63
|
+
);
|
|
64
|
+
if (error) {
|
|
65
|
+
console.warn("[scheduler] Failed to persist schedule in Supabase", error);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const job = {
|
|
69
|
+
intervalMs,
|
|
70
|
+
timer: null,
|
|
71
|
+
running: false,
|
|
72
|
+
triggerConfig
|
|
73
|
+
};
|
|
74
|
+
jobs.set(stackId, job);
|
|
75
|
+
const timer = setInterval(async () => {
|
|
76
|
+
if (job.running) {
|
|
77
|
+
console.debug(
|
|
78
|
+
`[scheduler] Stack ${stackId} execution skipped - previous run still in progress`
|
|
79
|
+
);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
job.running = true;
|
|
83
|
+
try {
|
|
84
|
+
const stack = await loadStack(stackId);
|
|
85
|
+
if (!stack) return;
|
|
86
|
+
const orchestrator = new OrchestratorV0(resolveNode);
|
|
87
|
+
const trigCtx = job.triggerConfig ? buildScheduleTriggerContext(job.triggerConfig) : { triggerKind: "interval", triggeredAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
88
|
+
try {
|
|
89
|
+
await orchestrator.run(stack, { triggerContext: trigCtx });
|
|
90
|
+
const sb = getSupabase();
|
|
91
|
+
if (sb) {
|
|
92
|
+
const { error: updateError } = await sb.from("stack_schedules").update({ next_run_at: new Date(Date.now() + intervalMs).toISOString() }).eq("stack_id", stackId);
|
|
93
|
+
if (updateError) {
|
|
94
|
+
console.warn("[scheduler] Failed to bump next_run_at", updateError);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
} finally {
|
|
98
|
+
orchestrator.dispose();
|
|
99
|
+
}
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.warn(`[scheduler] Stack ${stackId} run failed`, e);
|
|
102
|
+
} finally {
|
|
103
|
+
job.running = false;
|
|
104
|
+
}
|
|
105
|
+
}, intervalMs);
|
|
106
|
+
job.timer = timer;
|
|
107
|
+
}
|
|
108
|
+
function cancelSchedule(stackId) {
|
|
109
|
+
const j = jobs.get(stackId);
|
|
110
|
+
if (j) {
|
|
111
|
+
clearInterval(j.timer);
|
|
112
|
+
jobs.delete(stackId);
|
|
113
|
+
}
|
|
114
|
+
const sb = getSupabase();
|
|
115
|
+
if (sb) {
|
|
116
|
+
sb.from("stack_schedules").update({ active: false }).eq("stack_id", stackId).then(({ error }) => {
|
|
117
|
+
if (error) {
|
|
118
|
+
console.warn("[scheduler] Failed to mark schedule inactive in Supabase", error);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
cancelSchedule,
|
|
125
|
+
getSchedule,
|
|
126
|
+
scheduleStack
|
|
127
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getScopedSecret,
|
|
3
|
+
listScopedSecrets,
|
|
4
|
+
putScopedSecret,
|
|
5
|
+
redactSecretValue,
|
|
6
|
+
removeScopedSecret,
|
|
7
|
+
resolveSecretValue
|
|
8
|
+
} from "./chunk-QWXPVB2L.js";
|
|
9
|
+
import "./chunk-TSQ3BGLA.js";
|
|
10
|
+
import "./chunk-2ESYSVXG.js";
|
|
11
|
+
export {
|
|
12
|
+
getScopedSecret,
|
|
13
|
+
listScopedSecrets,
|
|
14
|
+
putScopedSecret,
|
|
15
|
+
redactSecretValue,
|
|
16
|
+
removeScopedSecret,
|
|
17
|
+
resolveSecretValue
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "./chunk-2ESYSVXG.js";
|
|
2
|
+
|
|
3
|
+
// ../../lib/terminals-tech/machines/core/runners/server.ts
|
|
4
|
+
var serverRunnersReady = null;
|
|
5
|
+
async function ensureServerRunnersRegistered() {
|
|
6
|
+
if (typeof window !== "undefined") {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (!serverRunnersReady) {
|
|
10
|
+
serverRunnersReady = Promise.all([import("./stack-4KWCQQP7.js"), import("./container-lite-QD3CRLS4.js")]).then(
|
|
11
|
+
() => void 0
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return serverRunnersReady;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
ensureServerRunnersRegistered
|
|
18
|
+
};
|