@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.
Files changed (82) hide show
  1. package/README.md +15 -19
  2. package/dist/WebContainerManager-4LIOGRVM.js +22 -0
  3. package/dist/browser-http-client-ZQLDWZMU.js +317 -0
  4. package/dist/cache-VKYSQRXX.js +45 -0
  5. package/dist/capabilities-MIPUMBLL.js +96 -0
  6. package/dist/chunk-2ESYSVXG.js +48 -0
  7. package/dist/chunk-2WTYE4SW.js +190 -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-BYXBJQAS.js +0 -0
  13. package/dist/chunk-DKFJIILR.js +9798 -0
  14. package/dist/chunk-EXI3LJVJ.js +51 -0
  15. package/dist/chunk-FOXUEYWK.js +42 -0
  16. package/dist/chunk-GJWAJAX3.js +173 -0
  17. package/dist/chunk-H3POJCFA.js +333 -0
  18. package/dist/chunk-KASHT6C5.js +784 -0
  19. package/dist/chunk-KHR7ZYCX.js +4034 -0
  20. package/dist/chunk-L45BSQDJ.js +296 -0
  21. package/dist/chunk-LLGZTP3G.js +5521 -0
  22. package/dist/chunk-NTMBOESX.js +152 -0
  23. package/dist/chunk-OCLSAUCD.js +474 -0
  24. package/dist/chunk-OSSRZOGC.js +190 -0
  25. package/dist/chunk-PPFTKJDB.js +497 -0
  26. package/dist/chunk-PWAHFID5.js +381 -0
  27. package/dist/chunk-Q2VI6ICE.js +188 -0
  28. package/dist/chunk-QJFKEQHF.js +6460 -0
  29. package/dist/chunk-QWXPVB2L.js +320 -0
  30. package/dist/chunk-QWZRZKLZ.js +896 -0
  31. package/dist/chunk-STMI72WH.js +1005 -0
  32. package/dist/chunk-TSQ3BGLA.js +11945 -0
  33. package/dist/chunk-UJDUQNE2.js +79 -0
  34. package/dist/chunk-VZA2NUH3.js +118 -0
  35. package/dist/chunk-WGBCRNMB.js +1817 -0
  36. package/dist/chunk-WU4OTGJE.js +752 -0
  37. package/dist/chunk-XPJ63Y6T.js +70 -0
  38. package/dist/chunk-Y2EULKA2.js +172 -0
  39. package/dist/chunk-YJEZWCYV.js +94 -0
  40. package/dist/chunk-ZVO47SQV.js +150 -0
  41. package/dist/container-lite-QD3CRLS4.js +327 -0
  42. package/dist/core-H2UUDATO.js +146 -0
  43. package/dist/crypto-D4LMI2RN.js +45 -0
  44. package/dist/db-BWC2GGBN.js +50 -0
  45. package/dist/demo-T655Z5S4.js +87 -0
  46. package/dist/diagnostics-6RQTBR6I.js +113 -0
  47. package/dist/dist-OPDCWARF.js +727 -0
  48. package/dist/dist-VXJEKX3T.js +2441 -0
  49. package/dist/dist-VYGJXGUS.js +1008 -0
  50. package/dist/embeddings-7QXTXUMC.js +15 -0
  51. package/dist/embeddings-MAEWWUHW.js +9 -0
  52. package/dist/graph-RKMNE2X5.js +36 -0
  53. package/dist/hvm-CBEP3M4F.js +126 -0
  54. package/dist/index.cjs +49874 -8001
  55. package/dist/index.d.cts +1629 -1363
  56. package/dist/index.d.ts +1629 -1363
  57. package/dist/index.js +2462 -8130
  58. package/dist/mcp-NK34ZNM5.js +101 -0
  59. package/dist/mcp-client-service-browser-SGB2K3VZ.js +14 -0
  60. package/dist/neuro-state-XHRGIRVO.js +498 -0
  61. package/dist/nodes-K6GKI2FM.js +364 -0
  62. package/dist/package-EXUIU2RL.js +93 -0
  63. package/dist/package-VGL7HYTO.js +106 -0
  64. package/dist/package-XHMLOAQ4.js +98 -0
  65. package/dist/pg-events-QJAM2HIP.js +15 -0
  66. package/dist/pglite-adapter-43IOUBMV.js +50 -0
  67. package/dist/pgliteService-IUGNNOVU.js +258 -0
  68. package/dist/policy-IRJCM6FS.js +13 -0
  69. package/dist/registry-5WTDYQVQ.js +26 -0
  70. package/dist/registry-FW63E7FE.js +16 -0
  71. package/dist/registry-ZQ2IBLF6.js +9 -0
  72. package/dist/resolver-ALOJSOK5.js +24 -0
  73. package/dist/scheduler-B5CEYKWT.js +127 -0
  74. package/dist/secret-store-H7273UIT.js +18 -0
  75. package/dist/server-VW6DYDLH.js +18 -0
  76. package/dist/skills-VN7IN7SJ.js +6375 -0
  77. package/dist/stack-4KWCQQP7.js +103 -0
  78. package/dist/storage-L7MWNSPG.js +13 -0
  79. package/dist/supabaseService-6AYP2VY3.js +476 -0
  80. package/dist/topology-CIWWNVAN.js +13 -0
  81. package/dist/webcontainer-XWCE56F3.js +281 -0
  82. package/package.json +9 -3
@@ -0,0 +1,152 @@
1
+ // ../../lib/terminals-tech/core/base/retry.ts
2
+ function calculateDelay(attempt, baseDelayMs, maxDelayMs, jitter = 0) {
3
+ let delay = baseDelayMs * Math.pow(2, attempt);
4
+ delay = Math.min(delay, maxDelayMs);
5
+ if (jitter > 0) {
6
+ const jitterAmount = delay * jitter * Math.random();
7
+ delay = delay + jitterAmount - jitter * delay / 2;
8
+ delay = Math.max(baseDelayMs, delay);
9
+ }
10
+ return Math.floor(delay);
11
+ }
12
+ function exponentialBackoff(options = {}) {
13
+ return {
14
+ maxAttempts: options.maxAttempts ?? 3,
15
+ baseDelayMs: options.baseDelayMs ?? 100,
16
+ maxDelayMs: options.maxDelayMs ?? 1e4,
17
+ jitter: options.jitter ?? 0.1,
18
+ shouldRetry: options.shouldRetry ?? defaultShouldRetry
19
+ };
20
+ }
21
+ function defaultShouldRetry(error, _attempt) {
22
+ if (error.name === "TypeError" && error.message.includes("fetch")) {
23
+ return true;
24
+ }
25
+ if (error.name === "AbortError") {
26
+ return false;
27
+ }
28
+ if ("status" in error) {
29
+ const status = error.status;
30
+ return status >= 500 || status === 429;
31
+ }
32
+ return true;
33
+ }
34
+ async function withRetry(fn, strategyOrOptions = {}) {
35
+ const strategy = "maxAttempts" in strategyOrOptions && "shouldRetry" in strategyOrOptions ? strategyOrOptions : exponentialBackoff(strategyOrOptions);
36
+ const options = strategyOrOptions;
37
+ let lastError = null;
38
+ for (let attempt = 0; attempt < strategy.maxAttempts; attempt++) {
39
+ if (options.signal?.aborted) {
40
+ throw new DOMException("Operation was aborted", "AbortError");
41
+ }
42
+ try {
43
+ return await fn();
44
+ } catch (error) {
45
+ lastError = error instanceof Error ? error : new Error(String(error));
46
+ const isLastAttempt = attempt >= strategy.maxAttempts - 1;
47
+ if (isLastAttempt || !strategy.shouldRetry(lastError, attempt)) {
48
+ throw lastError;
49
+ }
50
+ const delay = calculateDelay(
51
+ attempt,
52
+ strategy.baseDelayMs,
53
+ strategy.maxDelayMs,
54
+ strategy.jitter
55
+ );
56
+ options.onRetry?.(lastError, attempt + 1, delay);
57
+ await new Promise((resolve, reject) => {
58
+ const timeoutId = setTimeout(resolve, delay);
59
+ if (options.signal) {
60
+ const abortHandler = () => {
61
+ clearTimeout(timeoutId);
62
+ reject(new DOMException("Operation was aborted", "AbortError"));
63
+ };
64
+ options.signal.addEventListener("abort", abortHandler, {
65
+ once: true
66
+ });
67
+ }
68
+ });
69
+ }
70
+ }
71
+ throw lastError ?? new Error("Retry failed");
72
+ }
73
+ function createCircuitBreaker(options) {
74
+ const state = {
75
+ failures: 0,
76
+ lastFailure: null,
77
+ isOpen: false,
78
+ nextAttempt: null
79
+ };
80
+ let halfOpenInFlight = 0;
81
+ return {
82
+ /**
83
+ * Execute function with circuit breaker protection.
84
+ *
85
+ * States:
86
+ * CLOSED — failures < threshold, all requests pass through
87
+ * OPEN — failures >= threshold, fast-fails until resetTimeoutMs elapses
88
+ * HALF_OPEN — resetTimeoutMs elapsed, allows `halfOpenRequests` concurrent probes
89
+ *
90
+ * Transitions:
91
+ * T1: CLOSED → CLOSED (success resets failures)
92
+ * T2: CLOSED → OPEN (failure hits threshold)
93
+ * T3: OPEN → OPEN (fast-fail, time not elapsed)
94
+ * T4: OPEN → HALF_OPEN (time elapsed, probe allowed)
95
+ * T5: HALF_OPEN → CLOSED (probe succeeds)
96
+ * T6: HALF_OPEN → OPEN (probe fails)
97
+ */
98
+ async execute(fn) {
99
+ if (state.isOpen) {
100
+ const now = Date.now();
101
+ if (state.nextAttempt && now < state.nextAttempt) {
102
+ throw new Error("Circuit breaker is open");
103
+ }
104
+ if (options.halfOpenRequests != null && halfOpenInFlight >= options.halfOpenRequests) {
105
+ throw new Error("Circuit breaker half-open \u2014 probe limit reached");
106
+ }
107
+ halfOpenInFlight++;
108
+ }
109
+ try {
110
+ const result = await fn();
111
+ state.failures = 0;
112
+ state.isOpen = false;
113
+ state.nextAttempt = null;
114
+ halfOpenInFlight = 0;
115
+ return result;
116
+ } catch (error) {
117
+ if (state.isOpen) {
118
+ halfOpenInFlight = Math.max(0, halfOpenInFlight - 1);
119
+ }
120
+ state.failures++;
121
+ state.lastFailure = Date.now();
122
+ if (state.failures >= options.failureThreshold) {
123
+ state.isOpen = true;
124
+ state.nextAttempt = Date.now() + options.resetTimeoutMs;
125
+ halfOpenInFlight = 0;
126
+ }
127
+ throw error;
128
+ }
129
+ },
130
+ /**
131
+ * Get current state
132
+ */
133
+ getState() {
134
+ return { ...state };
135
+ },
136
+ /**
137
+ * Manually reset the circuit breaker
138
+ */
139
+ reset() {
140
+ state.failures = 0;
141
+ state.lastFailure = null;
142
+ state.isOpen = false;
143
+ state.nextAttempt = null;
144
+ halfOpenInFlight = 0;
145
+ }
146
+ };
147
+ }
148
+
149
+ export {
150
+ withRetry,
151
+ createCircuitBreaker
152
+ };
@@ -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-K6GKI2FM.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
+ };