@terminals-tech/sdk 1.0.0-rc.1 → 1.0.0-rc.2

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.
Files changed (79) hide show
  1. package/dist/WebContainerManager-SHXC5VKI.js +22 -0
  2. package/dist/browser-http-client-ZQLDWZMU.js +317 -0
  3. package/dist/cache-VKYSQRXX.js +45 -0
  4. package/dist/capabilities-MIPUMBLL.js +96 -0
  5. package/dist/chunk-2ESYSVXG.js +48 -0
  6. package/dist/chunk-2WTYE4SW.js +190 -0
  7. package/dist/chunk-3CEM77QZ.js +474 -0
  8. package/dist/chunk-3LFMIVJM.js +40 -0
  9. package/dist/chunk-ABCK4FWN.js +136 -0
  10. package/dist/chunk-AFDUOYHD.js +2060 -0
  11. package/dist/chunk-BCOQMFKT.js +265 -0
  12. package/dist/chunk-BKB3MD5Y.js +723 -0
  13. package/dist/chunk-BYXBJQAS.js +0 -0
  14. package/dist/chunk-DKFJIILR.js +9798 -0
  15. package/dist/chunk-EXI3LJVJ.js +51 -0
  16. package/dist/chunk-FOXUEYWK.js +42 -0
  17. package/dist/chunk-GJWAJAX3.js +173 -0
  18. package/dist/chunk-H3POJCFA.js +333 -0
  19. package/dist/chunk-KHR7ZYCX.js +4034 -0
  20. package/dist/chunk-NTMBOESX.js +152 -0
  21. package/dist/chunk-OSSRZOGC.js +190 -0
  22. package/dist/chunk-PUZ2S62E.js +977 -0
  23. package/dist/chunk-PWAHFID5.js +381 -0
  24. package/dist/chunk-Q2VI6ICE.js +188 -0
  25. package/dist/chunk-Q4B7YS7T.js +557 -0
  26. package/dist/chunk-QJFKEQHF.js +6460 -0
  27. package/dist/chunk-QWXPVB2L.js +320 -0
  28. package/dist/chunk-QWZRZKLZ.js +896 -0
  29. package/dist/chunk-SHPGIVDH.js +5521 -0
  30. package/dist/chunk-TSQ3BGLA.js +11945 -0
  31. package/dist/chunk-UJDUQNE2.js +79 -0
  32. package/dist/chunk-UKVUPKZP.js +296 -0
  33. package/dist/chunk-VZA2NUH3.js +118 -0
  34. package/dist/chunk-WGBCRNMB.js +1817 -0
  35. package/dist/chunk-WU4OTGJE.js +752 -0
  36. package/dist/chunk-XPJ63Y6T.js +70 -0
  37. package/dist/chunk-Y2EULKA2.js +172 -0
  38. package/dist/chunk-YJEZWCYV.js +94 -0
  39. package/dist/chunk-ZVO47SQV.js +150 -0
  40. package/dist/container-lite-KQX3NMPY.js +327 -0
  41. package/dist/core-H2UUDATO.js +146 -0
  42. package/dist/crypto-D4LMI2RN.js +45 -0
  43. package/dist/db-BWC2GGBN.js +50 -0
  44. package/dist/demo-VXMGMJNK.js +87 -0
  45. package/dist/diagnostics-6RQTBR6I.js +113 -0
  46. package/dist/dist-OPDCWARF.js +727 -0
  47. package/dist/dist-VXJEKX3T.js +2441 -0
  48. package/dist/dist-VYGJXGUS.js +1008 -0
  49. package/dist/embeddings-7QXTXUMC.js +15 -0
  50. package/dist/embeddings-MAEWWUHW.js +9 -0
  51. package/dist/graph-RKMNE2X5.js +36 -0
  52. package/dist/hvm-DRQK2MUT.js +126 -0
  53. package/dist/index.cjs +11706 -4004
  54. package/dist/index.d.cts +1299 -1339
  55. package/dist/index.d.ts +1299 -1339
  56. package/dist/index.js +189 -7938
  57. package/dist/mcp-NK34ZNM5.js +101 -0
  58. package/dist/mcp-client-service-browser-SGB2K3VZ.js +14 -0
  59. package/dist/neuro-state-XHRGIRVO.js +498 -0
  60. package/dist/nodes-DXKYDTVO.js +224 -0
  61. package/dist/package-EXUIU2RL.js +93 -0
  62. package/dist/package-VGL7HYTO.js +106 -0
  63. package/dist/package-XHMLOAQ4.js +98 -0
  64. package/dist/pg-events-QJAM2HIP.js +15 -0
  65. package/dist/pgliteService-IUGNNOVU.js +258 -0
  66. package/dist/policy-IRJCM6FS.js +13 -0
  67. package/dist/registry-BL3TDQDB.js +26 -0
  68. package/dist/registry-FW63E7FE.js +16 -0
  69. package/dist/registry-ZQ2IBLF6.js +9 -0
  70. package/dist/scheduler-H6Q53IMI.js +122 -0
  71. package/dist/secret-store-H7273UIT.js +18 -0
  72. package/dist/server-7DM74VFW.js +18 -0
  73. package/dist/skills-KLTTT2RM.js +6375 -0
  74. package/dist/stack-CHDAFU2S.js +103 -0
  75. package/dist/storage-L7MWNSPG.js +13 -0
  76. package/dist/supabaseService-6AYP2VY3.js +476 -0
  77. package/dist/topology-CIWWNVAN.js +13 -0
  78. package/dist/webcontainer-3LDJVIIL.js +281 -0
  79. package/package.json +2 -2
@@ -0,0 +1,190 @@
1
+ // ../../lib/terminals-tech/core/base/events.ts
2
+ function createEventBus() {
3
+ const handlers = /* @__PURE__ */ new Map();
4
+ const wildcardHandlers = /* @__PURE__ */ new Set();
5
+ function getHandlers(event) {
6
+ if (!handlers.has(event)) {
7
+ handlers.set(event, /* @__PURE__ */ new Set());
8
+ }
9
+ return handlers.get(event);
10
+ }
11
+ return {
12
+ on(event, handler) {
13
+ const set = getHandlers(event);
14
+ set.add(handler);
15
+ return () => set.delete(handler);
16
+ },
17
+ once(event, handler) {
18
+ const set = getHandlers(event);
19
+ const wrapper = (payload) => {
20
+ set.delete(wrapper);
21
+ handler(payload);
22
+ };
23
+ set.add(wrapper);
24
+ return () => set.delete(wrapper);
25
+ },
26
+ off(event, handler) {
27
+ const set = handlers.get(event);
28
+ if (set) {
29
+ set.delete(handler);
30
+ }
31
+ },
32
+ emit(event, payload) {
33
+ const set = handlers.get(event);
34
+ if (set) {
35
+ for (const handler of set) {
36
+ try {
37
+ handler(payload);
38
+ } catch (e) {
39
+ console.error(`EventBus: Error in handler for '${String(event)}'`, e);
40
+ }
41
+ }
42
+ }
43
+ for (const handler of wildcardHandlers) {
44
+ try {
45
+ handler(event, payload);
46
+ } catch (e) {
47
+ console.error(`EventBus: Error in wildcard handler for '${String(event)}'`, e);
48
+ }
49
+ }
50
+ },
51
+ async emitAsync(event, payload) {
52
+ const set = handlers.get(event);
53
+ const promises = [];
54
+ if (set) {
55
+ for (const handler of set) {
56
+ promises.push(
57
+ Promise.resolve().then(() => handler(payload)).catch((e) => {
58
+ console.error(`EventBus: Error in async handler for '${String(event)}'`, e);
59
+ })
60
+ );
61
+ }
62
+ }
63
+ for (const handler of wildcardHandlers) {
64
+ promises.push(
65
+ Promise.resolve().then(() => handler(event, payload)).catch((e) => {
66
+ console.error(`EventBus: Error in async wildcard handler for '${String(event)}'`, e);
67
+ })
68
+ );
69
+ }
70
+ await Promise.all(promises);
71
+ },
72
+ onAny(handler) {
73
+ wildcardHandlers.add(handler);
74
+ return () => wildcardHandlers.delete(handler);
75
+ },
76
+ removeAllListeners(event) {
77
+ if (event !== void 0) {
78
+ handlers.delete(event);
79
+ } else {
80
+ handlers.clear();
81
+ wildcardHandlers.clear();
82
+ }
83
+ },
84
+ listenerCount(event) {
85
+ return handlers.get(event)?.size ?? 0;
86
+ },
87
+ eventNames() {
88
+ return Array.from(handlers.keys());
89
+ }
90
+ };
91
+ }
92
+ function createSignalBus(maxLogSize = 1e3) {
93
+ const subscriptions = [];
94
+ const signalLog = [];
95
+ let idCounter = 0;
96
+ function matches(sub, signal) {
97
+ if (sub.type !== "*" && sub.type !== signal.type) {
98
+ return false;
99
+ }
100
+ if (sub.sourceLayer && sub.sourceLayer !== signal.source) {
101
+ return false;
102
+ }
103
+ if (sub.targetLayer && sub.targetLayer !== signal.target) {
104
+ return false;
105
+ }
106
+ return true;
107
+ }
108
+ return {
109
+ emit(type, source, target, payload, correlationId, interactionId) {
110
+ const signal = {
111
+ id: `sig_${++idCounter}_${Date.now()}`,
112
+ type,
113
+ source,
114
+ target,
115
+ payload,
116
+ timestamp: Date.now(),
117
+ correlationId,
118
+ interactionId
119
+ };
120
+ signalLog.push(signal);
121
+ if (signalLog.length > maxLogSize) {
122
+ signalLog.shift();
123
+ }
124
+ for (const sub of subscriptions) {
125
+ if (matches(sub, signal)) {
126
+ try {
127
+ sub.handler(signal);
128
+ } catch (error) {
129
+ console.error(`[SignalBus] Handler error for ${type}:`, error);
130
+ }
131
+ }
132
+ }
133
+ return signal;
134
+ },
135
+ subscribe(type, handler, options) {
136
+ const subscription = {
137
+ type,
138
+ handler,
139
+ sourceLayer: options?.sourceLayer,
140
+ targetLayer: options?.targetLayer
141
+ };
142
+ subscriptions.push(subscription);
143
+ return () => {
144
+ const index = subscriptions.indexOf(subscription);
145
+ if (index >= 0) {
146
+ subscriptions.splice(index, 1);
147
+ }
148
+ };
149
+ },
150
+ subscribeFromLayer(layer, handler) {
151
+ return this.subscribe("*", handler, { sourceLayer: layer });
152
+ },
153
+ subscribeToLayer(layer, handler) {
154
+ return this.subscribe("*", handler, { targetLayer: layer });
155
+ },
156
+ getRecentSignals(count = 10) {
157
+ return signalLog.slice(-count);
158
+ },
159
+ getCorrelated(correlationId) {
160
+ return signalLog.filter((s) => s.correlationId === correlationId);
161
+ },
162
+ clearSubscriptions() {
163
+ subscriptions.length = 0;
164
+ },
165
+ clearLog() {
166
+ signalLog.length = 0;
167
+ }
168
+ };
169
+ }
170
+ var globalSignalBus = null;
171
+ function getSignalBus() {
172
+ if (!globalSignalBus) {
173
+ globalSignalBus = createSignalBus();
174
+ }
175
+ return globalSignalBus;
176
+ }
177
+ function emitSignal(type, source, target, payload, correlationId, interactionId) {
178
+ return getSignalBus().emit(type, source, target, payload, correlationId, interactionId);
179
+ }
180
+ function subscribeToSignals(type, handler, options) {
181
+ return getSignalBus().subscribe(type, handler, options);
182
+ }
183
+
184
+ export {
185
+ createEventBus,
186
+ createSignalBus,
187
+ getSignalBus,
188
+ emitSignal,
189
+ subscribeToSignals
190
+ };
@@ -0,0 +1,474 @@
1
+ // ../../lib/terminals-tech/machines/core/catalog.ts
2
+ var inMemoryCatalog = /* @__PURE__ */ new Map();
3
+ var nodesInitialized = false;
4
+ async function ensureNodesLoaded() {
5
+ if (!nodesInitialized) {
6
+ await import("./nodes-DXKYDTVO.js");
7
+ nodesInitialized = true;
8
+ }
9
+ }
10
+ var manifestProviders = /* @__PURE__ */ new Map();
11
+ function registerNode(manifest) {
12
+ inMemoryCatalog.set(manifest.id, manifest);
13
+ }
14
+ function registerManifestProvider(name, provider) {
15
+ manifestProviders.set(name, provider);
16
+ }
17
+ async function resolveNode(ref) {
18
+ await ensureNodesLoaded();
19
+ const staticNode = inMemoryCatalog.get(ref);
20
+ if (staticNode) return staticNode;
21
+ for (const provider of manifestProviders.values()) {
22
+ try {
23
+ const manifest = await provider(ref);
24
+ if (manifest) return manifest;
25
+ } catch (err) {
26
+ console.warn(`[resolveNode] Provider failed for ${ref}:`, err);
27
+ }
28
+ }
29
+ return null;
30
+ }
31
+ registerNode({
32
+ id: "demo.echo.v1",
33
+ version: "0.1.0",
34
+ kind: "task",
35
+ label: "Echo",
36
+ description: "Returns input as output",
37
+ runtimes: ["worker"],
38
+ entrypoints: { worker: { module: "local" } },
39
+ inputsSchema: {
40
+ type: "object",
41
+ properties: { message: { type: "string" } },
42
+ required: ["message"]
43
+ },
44
+ outputsSchema: { type: "object", properties: { echoed: { type: "object" } } }
45
+ });
46
+ registerNode({
47
+ id: "demo.webhook.post.v1",
48
+ version: "0.1.0",
49
+ kind: "webhook",
50
+ label: "Webhook POST",
51
+ description: "POST JSON to a URL",
52
+ runtimes: ["worker"],
53
+ entrypoints: { worker: { module: "local" } },
54
+ inputsSchema: {
55
+ type: "object",
56
+ properties: { url: { type: "string" }, body: { type: "object" } },
57
+ required: ["url", "body"]
58
+ },
59
+ outputsSchema: {
60
+ type: "object",
61
+ properties: {
62
+ status: { type: "number" },
63
+ ok: { type: "boolean" },
64
+ body: { type: "string" }
65
+ }
66
+ },
67
+ policies: {
68
+ network: { egress: "allow:list", allowList: ["https://httpbin.org"] }
69
+ },
70
+ secrets: [
71
+ {
72
+ name: "DEMO_BEARER_TOKEN",
73
+ scope: "node",
74
+ env: "AUTH_TOKEN",
75
+ required: false
76
+ }
77
+ ]
78
+ });
79
+ registerNode({
80
+ id: "demo.mcp.echo.v1",
81
+ version: "0.1.0",
82
+ kind: "mcp",
83
+ label: "MCP Echo",
84
+ description: "Demonstrates MCP policy gate and echo",
85
+ runtimes: ["worker"],
86
+ entrypoints: { worker: { module: "local" } },
87
+ inputsSchema: {
88
+ type: "object",
89
+ properties: { service: { type: "string" }, model: { type: "string" } },
90
+ required: ["service", "model"]
91
+ },
92
+ outputsSchema: { type: "object" },
93
+ mcp: { server: "https://example.com/mcp", tools: [] }
94
+ });
95
+ registerNode({
96
+ id: "demo.webcontainer.echo.v1",
97
+ version: "0.1.0",
98
+ kind: "task",
99
+ label: "WC Echo",
100
+ description: "Runs a trivial command in WebContainer and echoes inputs",
101
+ runtimes: ["webcontainer"],
102
+ entrypoints: {
103
+ webcontainer: { command: "node", args: ["-e", 'console.log("wc-node")'] }
104
+ },
105
+ inputsSchema: {
106
+ type: "object",
107
+ properties: { payload: { type: "object" } },
108
+ required: ["payload"]
109
+ },
110
+ outputsSchema: { type: "object" }
111
+ });
112
+ registerNode({
113
+ id: "system.input.v1",
114
+ version: "0.1.0",
115
+ kind: "task",
116
+ label: "Stack Input",
117
+ description: "Defines the inputs for a stack.",
118
+ runtimes: ["worker"],
119
+ entrypoints: { worker: { module: "local" } },
120
+ inputsSchema: { type: "object" },
121
+ outputsSchema: { type: "object" }
122
+ });
123
+ registerNode({
124
+ id: "system.output.v1",
125
+ version: "0.1.0",
126
+ kind: "task",
127
+ label: "Stack Output",
128
+ description: "Defines the outputs of a stack.",
129
+ runtimes: ["worker"],
130
+ entrypoints: { worker: { module: "local" } },
131
+ inputsSchema: { type: "object" },
132
+ outputsSchema: { type: "object" }
133
+ });
134
+ registerNode({
135
+ id: "base.time.timeline.v1",
136
+ version: "0.1.0",
137
+ kind: "transform",
138
+ label: "Timeline",
139
+ description: "Event clock, windows and scheduling for temporal flows.",
140
+ runtimes: ["worker"],
141
+ entrypoints: { worker: { module: "local" } },
142
+ inputsSchema: {
143
+ type: "object",
144
+ properties: { events: { type: "array" }, window: { type: "string" } }
145
+ },
146
+ outputsSchema: {
147
+ type: "object",
148
+ properties: { windowEvents: { type: "array" }, ticks: { type: "array" } }
149
+ }
150
+ });
151
+ registerNode({
152
+ id: "base.time.memory.v1",
153
+ version: "0.1.0",
154
+ kind: "task",
155
+ label: "Temporal Memory",
156
+ description: "Time-indexed key-value store with TTL and query windows.",
157
+ runtimes: ["worker"],
158
+ entrypoints: { worker: { module: "local" } },
159
+ inputsSchema: {
160
+ type: "object",
161
+ properties: { put: { type: "object" }, get: { type: "object" } }
162
+ },
163
+ outputsSchema: { type: "object" }
164
+ });
165
+ registerNode({
166
+ id: "base.field.store3d.v1",
167
+ version: "0.1.0",
168
+ kind: "task",
169
+ label: "Field Store 3D",
170
+ description: "Stores/queries radiance, SDF, or gaussian splat parameters.",
171
+ runtimes: ["worker"],
172
+ entrypoints: { worker: { module: "local" } },
173
+ inputsSchema: {
174
+ type: "object",
175
+ properties: { upsert: { type: "array" }, query: { type: "object" } }
176
+ },
177
+ outputsSchema: { type: "object" },
178
+ capabilities: ["fields:xyzt"]
179
+ });
180
+ registerNode({
181
+ id: "base.field.projector.v1",
182
+ version: "0.1.0",
183
+ kind: "transform",
184
+ label: "Cross\u2011Modal Projector",
185
+ description: "Maps field points (xyzt) to semantic embeddings/entities.",
186
+ runtimes: ["worker"],
187
+ entrypoints: { worker: { module: "local" } },
188
+ inputsSchema: {
189
+ type: "object",
190
+ properties: { points: { type: "array" }, model: { type: "string" } }
191
+ },
192
+ outputsSchema: {
193
+ type: "object",
194
+ properties: { embeddings: { type: "array" } }
195
+ }
196
+ });
197
+ registerNode({
198
+ id: "base.semantic.zero-agent.v1",
199
+ version: "0.1.0",
200
+ kind: "prompt",
201
+ label: "Zero Agent",
202
+ description: "LLM tool-using node with context shaping and routing.",
203
+ runtimes: ["worker"],
204
+ entrypoints: { worker: { module: "local" } },
205
+ inputsSchema: {
206
+ type: "object",
207
+ properties: {
208
+ prompt: { type: "string" },
209
+ tools: { type: "array" },
210
+ memory: { type: "object" }
211
+ }
212
+ },
213
+ outputsSchema: {
214
+ type: "object",
215
+ properties: { messages: { type: "array" }, artifacts: { type: "array" } }
216
+ }
217
+ });
218
+ registerNode({
219
+ id: "base.semantic.entity-graph.v1",
220
+ version: "0.1.0",
221
+ kind: "task",
222
+ label: "Entity Graph",
223
+ description: "Typed nodes/edges with uncertainty; updates by deltas.",
224
+ runtimes: ["worker"],
225
+ entrypoints: { worker: { module: "local" } },
226
+ inputsSchema: {
227
+ type: "object",
228
+ properties: { upsert: { type: "array" }, query: { type: "object" } }
229
+ },
230
+ outputsSchema: { type: "object" }
231
+ });
232
+ registerNode({
233
+ id: "base.interface.oracle-adapter.v1",
234
+ version: "0.1.0",
235
+ kind: "webhook",
236
+ label: "Oracle Adapter",
237
+ description: "Bridges external web apps/APIs into the composition.",
238
+ runtimes: ["worker"],
239
+ entrypoints: { worker: { module: "local" } },
240
+ inputsSchema: { type: "object", properties: { request: { type: "object" } } },
241
+ outputsSchema: {
242
+ type: "object",
243
+ properties: { response: { type: "object" } }
244
+ },
245
+ policies: { network: { egress: "ask" } }
246
+ });
247
+ registerNode({
248
+ id: "astro.transform.buildAgentPrompt.v1",
249
+ version: "0.1.0",
250
+ kind: "transform",
251
+ label: "Build Agent Prompt",
252
+ description: "Constructs an astronomer assistant prompt from a user question and product/record context.",
253
+ runtimes: ["worker"],
254
+ entrypoints: { worker: { module: "local" } },
255
+ inputsSchema: {
256
+ type: "object",
257
+ properties: {
258
+ question: { type: "string" },
259
+ product: { type: "object" },
260
+ record: { type: "object" }
261
+ },
262
+ required: ["question"]
263
+ },
264
+ outputsSchema: { type: "object", properties: { prompt: { type: "string" } } }
265
+ });
266
+ registerNode({
267
+ id: "transform.object.pickPath.v1",
268
+ version: "0.1.0",
269
+ kind: "transform",
270
+ label: "Pick Path",
271
+ description: "Extracts a nested value from an object using a dot path.",
272
+ runtimes: ["worker"],
273
+ entrypoints: { worker: { module: "local" } },
274
+ inputsSchema: {
275
+ type: "object",
276
+ properties: { object: { type: "object" }, path: { type: "string" } },
277
+ required: ["object", "path"]
278
+ },
279
+ outputsSchema: { type: "object", properties: { value: { type: "object" } } }
280
+ });
281
+ registerNode({
282
+ id: "intel.llm.http.v1",
283
+ version: "0.1.0",
284
+ kind: "task",
285
+ label: "HTTP LLM (OpenRouter)",
286
+ description: "Calls an LLM provider over HTTP (default OpenRouter). Inputs: prompt, model, apiKey.",
287
+ runtimes: ["worker"],
288
+ entrypoints: { worker: { module: "local" } },
289
+ inputsSchema: {
290
+ type: "object",
291
+ properties: {
292
+ prompt: { type: "string" },
293
+ model: { type: "string" },
294
+ apiKey: { type: "string" }
295
+ },
296
+ required: ["prompt"]
297
+ },
298
+ outputsSchema: {
299
+ type: "object",
300
+ properties: { text: { type: "string" }, messages: { type: "array" } }
301
+ },
302
+ policies: {
303
+ network: { egress: "allow:list", allowList: ["https://openrouter.ai"] }
304
+ }
305
+ });
306
+ registerNode({
307
+ id: "provider.http.invoke.v1",
308
+ version: "0.1.0",
309
+ kind: "task",
310
+ label: "HTTP Invoke",
311
+ description: "Calls an HTTP endpoint with method/headers/body; returns JSON or text.",
312
+ runtimes: ["worker"],
313
+ entrypoints: { worker: { module: "local" } },
314
+ inputsSchema: {
315
+ type: "object",
316
+ properties: {
317
+ url: { type: "string" },
318
+ method: { type: "string" },
319
+ headers: { type: "object" },
320
+ body: { type: "object" },
321
+ parse: { type: "string" }
322
+ },
323
+ required: ["url"]
324
+ },
325
+ outputsSchema: { type: "object" },
326
+ policies: { network: { egress: "ask" } }
327
+ });
328
+ registerNode({
329
+ id: "provider.tap.query.v1",
330
+ version: "0.1.0",
331
+ kind: "task",
332
+ label: "TAP Query",
333
+ description: "Executes ADQL via TAP sync endpoint and returns rows as JSON.",
334
+ runtimes: ["worker"],
335
+ entrypoints: { worker: { module: "local" } },
336
+ inputsSchema: {
337
+ type: "object",
338
+ properties: {
339
+ tapUrl: { type: "string" },
340
+ adql: { type: "string" },
341
+ format: { type: "string" },
342
+ maxRows: { type: "number" },
343
+ token: { type: "string" }
344
+ },
345
+ required: ["tapUrl", "adql"]
346
+ },
347
+ outputsSchema: { type: "object" },
348
+ policies: { network: { egress: "ask" } }
349
+ });
350
+ registerNode({
351
+ id: "table.firstRow.v1",
352
+ version: "0.1.0",
353
+ kind: "transform",
354
+ label: "First Row",
355
+ description: "Selects the first record from a table of rows.",
356
+ runtimes: ["worker"],
357
+ entrypoints: { worker: { module: "local" } },
358
+ inputsSchema: {
359
+ type: "object",
360
+ properties: { rows: { type: "array" } },
361
+ required: ["rows"]
362
+ },
363
+ outputsSchema: { type: "object", properties: { record: { type: "object" } } }
364
+ });
365
+ registerNode({
366
+ id: "items.pickPreferred.v1",
367
+ version: "0.1.0",
368
+ kind: "transform",
369
+ label: "Pick Preferred Items",
370
+ description: "Picks preferred items by ordered type keys; returns selected array.",
371
+ runtimes: ["worker"],
372
+ entrypoints: { worker: { module: "local" } },
373
+ inputsSchema: {
374
+ type: "object",
375
+ properties: {
376
+ items: { type: "array" },
377
+ prefer: { type: "array" },
378
+ typeKey: { type: "string" },
379
+ groupKey: { type: "string" }
380
+ },
381
+ required: ["items"]
382
+ },
383
+ outputsSchema: {
384
+ type: "object",
385
+ properties: { selected: { type: "array" } }
386
+ }
387
+ });
388
+ registerNode({
389
+ id: "transform.buildPrompt.v1",
390
+ version: "0.1.0",
391
+ kind: "transform",
392
+ label: "Build Prompt",
393
+ description: "Constructs an assistant prompt from question + context (record or object).",
394
+ runtimes: ["worker"],
395
+ entrypoints: { worker: { module: "local" } },
396
+ inputsSchema: {
397
+ type: "object",
398
+ properties: { question: { type: "string" }, context: { type: "object" } },
399
+ required: ["question"]
400
+ },
401
+ outputsSchema: { type: "object", properties: { prompt: { type: "string" } } }
402
+ });
403
+ registerNode({
404
+ id: "intel.embedText.v1",
405
+ version: "0.1.0",
406
+ kind: "task",
407
+ label: "Embed Text",
408
+ description: "Computes an embedding vector from text.",
409
+ runtimes: ["worker"],
410
+ entrypoints: { worker: { module: "local" } },
411
+ inputsSchema: {
412
+ type: "object",
413
+ properties: { text: { type: "string" } },
414
+ required: ["text"]
415
+ },
416
+ outputsSchema: { type: "object", properties: { vector: { type: "array" } } }
417
+ });
418
+ registerNode({
419
+ id: "integration.source.poll.v1",
420
+ version: "0.1.0",
421
+ kind: "task",
422
+ label: "Integration Source (Poll)",
423
+ description: "Polls a provider resource with cursoring and returns normalized events.",
424
+ runtimes: ["worker"],
425
+ entrypoints: { worker: { module: "local" } },
426
+ inputsSchema: {
427
+ type: "object",
428
+ properties: {
429
+ provider: { type: "string" },
430
+ resource: { type: "string" },
431
+ config: { type: "object" },
432
+ cursorKey: { type: "string" }
433
+ },
434
+ required: ["provider", "resource"]
435
+ },
436
+ outputsSchema: {
437
+ type: "object",
438
+ properties: { items: { type: "array" }, cursor: { type: "string" } }
439
+ },
440
+ policies: { network: { egress: "ask" } },
441
+ secrets: [{ name: "DISCORD_BOT_TOKEN", scope: "stack", required: false }]
442
+ });
443
+ registerNode({
444
+ id: "integration.sink.post.v1",
445
+ version: "0.1.0",
446
+ kind: "task",
447
+ label: "Integration Sink (Post)",
448
+ description: "Posts items to a provider resource (supports webhooks or REST).",
449
+ runtimes: ["worker"],
450
+ entrypoints: { worker: { module: "local" } },
451
+ inputsSchema: {
452
+ type: "object",
453
+ properties: {
454
+ provider: { type: "string" },
455
+ resource: { type: "string" },
456
+ config: { type: "object" },
457
+ item: { type: "object" },
458
+ items: { type: "array" }
459
+ },
460
+ required: ["provider", "resource"]
461
+ },
462
+ outputsSchema: {
463
+ type: "object",
464
+ properties: { ok: { type: "boolean" }, status: { type: "number" } }
465
+ },
466
+ policies: { network: { egress: "ask" } },
467
+ secrets: [{ name: "DISCORD_BOT_TOKEN", scope: "stack", required: false }]
468
+ });
469
+
470
+ export {
471
+ registerNode,
472
+ registerManifestProvider,
473
+ resolveNode
474
+ };
@@ -0,0 +1,40 @@
1
+ // ../../lib/pglite/storage.ts
2
+ async function getStorageEstimate() {
3
+ if (typeof navigator === "undefined" || !navigator.storage?.estimate) return null;
4
+ return navigator.storage.estimate();
5
+ }
6
+ async function isStoragePersisted() {
7
+ if (typeof navigator === "undefined" || !navigator.storage?.persisted) return null;
8
+ return navigator.storage.persisted();
9
+ }
10
+ async function requestPersistentStorage() {
11
+ if (typeof navigator === "undefined" || !navigator.storage?.persist) return null;
12
+ return navigator.storage.persist();
13
+ }
14
+ function dataDirToDbName(dataDir) {
15
+ if (!dataDir.startsWith("idb://")) return null;
16
+ const name = dataDir.slice("idb://".length);
17
+ return name || null;
18
+ }
19
+ async function deleteDatabaseByDataDir(dataDir) {
20
+ const name = dataDirToDbName(dataDir);
21
+ if (!name) {
22
+ throw new Error(`Unsupported dataDir: ${dataDir}`);
23
+ }
24
+ if (typeof indexedDB === "undefined") {
25
+ throw new Error("indexedDB is not available in this environment");
26
+ }
27
+ await new Promise((resolve, reject) => {
28
+ const request = indexedDB.deleteDatabase(name);
29
+ request.onsuccess = () => resolve();
30
+ request.onerror = () => reject(request.error ?? new Error("Failed to delete IndexedDB"));
31
+ request.onblocked = () => reject(new Error("Delete blocked by open connections"));
32
+ });
33
+ }
34
+
35
+ export {
36
+ getStorageEstimate,
37
+ isStoragePersisted,
38
+ requestPersistentStorage,
39
+ deleteDatabaseByDataDir
40
+ };