@superatomai/sdk-node 0.0.44 → 0.0.45-dsp

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.
@@ -0,0 +1,530 @@
1
+ // src/userResponse/scripts/script-bootstrap.ts
2
+ import { pathToFileURL } from "url";
3
+
4
+ // src/userResponse/scripts/script-ipc.ts
5
+ function encodeMessage(msg) {
6
+ return JSON.stringify(msg) + "\n";
7
+ }
8
+ var LineOverflowError = class extends Error {
9
+ constructor(buffered, limit) {
10
+ super(`IPC message exceeded ${limit} bytes without a newline (${buffered} buffered) \u2014 aborting to avoid unbounded memory.`);
11
+ this.buffered = buffered;
12
+ this.limit = limit;
13
+ this.name = "LineOverflowError";
14
+ }
15
+ };
16
+ var DEFAULT_MAX_IPC_BYTES = (() => {
17
+ const envVal = Number(process.env.SCRIPT_MAX_IPC_BYTES);
18
+ return Number.isFinite(envVal) && envVal > 0 ? Math.floor(envVal) : 64 * 1024 * 1024;
19
+ })();
20
+ var LineSplitter = class {
21
+ constructor(maxBytes = DEFAULT_MAX_IPC_BYTES) {
22
+ this.maxBytes = maxBytes;
23
+ this.buffer = "";
24
+ }
25
+ push(chunk) {
26
+ this.buffer += chunk;
27
+ const lines = [];
28
+ let idx;
29
+ while ((idx = this.buffer.indexOf("\n")) !== -1) {
30
+ const line = this.buffer.slice(0, idx);
31
+ this.buffer = this.buffer.slice(idx + 1);
32
+ if (line.length > 0) lines.push(line);
33
+ }
34
+ if (this.buffer.length > this.maxBytes) {
35
+ const buffered = this.buffer.length;
36
+ this.buffer = "";
37
+ throw new LineOverflowError(buffered, this.maxBytes);
38
+ }
39
+ return lines;
40
+ }
41
+ /** Flush any remaining partial data (useful on stream close) */
42
+ flush() {
43
+ if (this.buffer.length === 0) return null;
44
+ const rest = this.buffer;
45
+ this.buffer = "";
46
+ return rest;
47
+ }
48
+ };
49
+
50
+ // src/userResponse/scripts/fmt.ts
51
+ var DASH = "\u2014";
52
+ var DEFAULT_FMT_CONFIG = { locale: "en-IN", currency: "INR" };
53
+ var MONEY_TIERS = {
54
+ "en-IN": [[1e7, "Cr"], [1e5, "L"]],
55
+ "hi-IN": [[1e7, "Cr"], [1e5, "L"]]
56
+ };
57
+ var DEFAULT_MONEY_TIERS = [[1e9, "B"], [1e6, "M"]];
58
+ function moneyTiers(locale) {
59
+ return MONEY_TIERS[locale] ?? DEFAULT_MONEY_TIERS;
60
+ }
61
+ var COUNT_SCALE_MIN = 1e7;
62
+ function toNum(v) {
63
+ if (v === null || v === void 0 || v === "") return null;
64
+ const n = typeof v === "number" ? v : Number(v);
65
+ return Number.isFinite(n) ? n : null;
66
+ }
67
+ var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
68
+ var ISO_DATE = /^\d{4}-\d{2}-\d{2}([T ]|$)/;
69
+ function toDate(v) {
70
+ if (v === null || v === void 0 || v === "") return null;
71
+ if (v instanceof Date) return Number.isNaN(v.getTime()) ? null : v;
72
+ if (typeof v === "number") {
73
+ const d = new Date(v);
74
+ return Number.isNaN(d.getTime()) ? null : d;
75
+ }
76
+ if (typeof v === "string" && ISO_DATE.test(v.trim())) {
77
+ const d = new Date(v.trim());
78
+ return Number.isNaN(d.getTime()) ? null : d;
79
+ }
80
+ return null;
81
+ }
82
+ function makeFmt(cfg = {}) {
83
+ const locale = cfg.locale || DEFAULT_FMT_CONFIG.locale;
84
+ const currency = cfg.currency || DEFAULT_FMT_CONFIG.currency;
85
+ const group = (n, decimals = 0) => n.toLocaleString(locale, { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
86
+ const symbol = (() => {
87
+ try {
88
+ const parts = new Intl.NumberFormat(locale, { style: "currency", currency }).formatToParts(0);
89
+ return parts.find((p) => p.type === "currency")?.value ?? "";
90
+ } catch {
91
+ return "";
92
+ }
93
+ })();
94
+ const scaled = (abs, tiers, decimals) => {
95
+ for (const [threshold, unit] of tiers) {
96
+ if (abs >= threshold) return `${group(abs / threshold, decimals)} ${unit}`;
97
+ }
98
+ return null;
99
+ };
100
+ function money(v, decimals = 2) {
101
+ const n = toNum(v);
102
+ if (n === null) return DASH;
103
+ const sign = n < 0 ? "-" : "";
104
+ const abs = Math.abs(n);
105
+ const tiers = moneyTiers(locale);
106
+ for (let i = 0; i < tiers.length; i++) {
107
+ const [threshold, unit] = tiers[i];
108
+ if (abs < threshold) continue;
109
+ const value = Number((abs / threshold).toFixed(decimals));
110
+ const higher = tiers[i - 1];
111
+ if (higher && value * threshold >= higher[0]) {
112
+ return `${sign}${symbol}${group(abs / higher[0], decimals)} ${higher[1]}`;
113
+ }
114
+ return `${sign}${symbol}${group(abs / threshold, decimals)} ${unit}`;
115
+ }
116
+ try {
117
+ return new Intl.NumberFormat(locale, {
118
+ style: "currency",
119
+ currency,
120
+ minimumFractionDigits: Number.isInteger(n) ? 0 : decimals,
121
+ maximumFractionDigits: decimals
122
+ }).format(n);
123
+ } catch {
124
+ return `${sign}${symbol}${group(abs, Number.isInteger(abs) ? 0 : decimals)}`;
125
+ }
126
+ }
127
+ function num(v, decimals) {
128
+ const n = toNum(v);
129
+ if (n === null) return DASH;
130
+ return group(n, decimals ?? (Number.isInteger(n) ? 0 : 2));
131
+ }
132
+ function count(v, decimals = 2) {
133
+ const n = toNum(v);
134
+ if (n === null) return DASH;
135
+ const abs = Math.abs(n);
136
+ const s = abs >= COUNT_SCALE_MIN ? scaled(abs, moneyTiers(locale), decimals) : null;
137
+ if (s) return `${n < 0 ? "-" : ""}${s}`;
138
+ return group(n, Number.isInteger(n) ? 0 : decimals);
139
+ }
140
+ function pct(part, whole, decimals = 1) {
141
+ const p = toNum(part), w = toNum(whole);
142
+ if (p === null || w === null || w === 0) return DASH;
143
+ return `${group(p / w * 100, decimals)}%`;
144
+ }
145
+ function delta(current, previous, decimals = 1) {
146
+ const c = toNum(current), p = toNum(previous);
147
+ if (c === null || p === null || p === 0) return DASH;
148
+ const change = (c - p) / Math.abs(p) * 100;
149
+ return `${change >= 0 ? "+" : "-"}${group(Math.abs(change), decimals)}%`;
150
+ }
151
+ function date(v) {
152
+ const d = toDate(v);
153
+ if (!d) return DASH;
154
+ return `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}`;
155
+ }
156
+ function range(from, to) {
157
+ const a = toDate(from), b = toDate(to);
158
+ if (!a || !b) return DASH;
159
+ const left = a.getUTCFullYear() === b.getUTCFullYear() ? `${a.getUTCDate()} ${MONTHS[a.getUTCMonth()]}` : date(a);
160
+ return `${left} \u2013 ${date(b)}`;
161
+ }
162
+ function list(items, conjunction = "and") {
163
+ const parts = (items || []).map((i) => String(i ?? "").trim()).filter(Boolean);
164
+ if (!parts.length) return DASH;
165
+ if (parts.length === 1) return parts[0];
166
+ return `${parts.slice(0, -1).join(", ")} ${conjunction} ${parts[parts.length - 1]}`;
167
+ }
168
+ return { money, num, count, pct, delta, date, range, list };
169
+ }
170
+
171
+ // src/userResponse/scripts/script-bootstrap.ts
172
+ var SCRIPT_ARG = process.argv[2];
173
+ if (!SCRIPT_ARG) {
174
+ sendError("Bootstrap was invoked without a script path.", "compile");
175
+ process.exit(1);
176
+ }
177
+ var BRIDGE_URL = process.env.SCRIPT_BRIDGE_URL;
178
+ var executedQueries = [];
179
+ var PREVIEW_MAX_ROWS = 10;
180
+ var PREVIEW_MAX_CHARS = 200;
181
+ var QUERY_ROW_CAP = 250;
182
+ function previewRows(data) {
183
+ return data.slice(0, PREVIEW_MAX_ROWS).map((row) => {
184
+ if (!row || typeof row !== "object") return row;
185
+ const out = {};
186
+ for (const [k, v] of Object.entries(row)) {
187
+ out[k] = typeof v === "string" && v.length > PREVIEW_MAX_CHARS ? v.slice(0, PREVIEW_MAX_CHARS) + "\u2026" : v;
188
+ }
189
+ return out;
190
+ });
191
+ }
192
+ var initResolve = null;
193
+ var initPromise = new Promise((resolve) => {
194
+ initResolve = resolve;
195
+ });
196
+ function buildCtx(init) {
197
+ return {
198
+ now: init.now,
199
+ async query(toolId, sql) {
200
+ if (!BRIDGE_URL) throw new Error("SCRIPT_BRIDGE_URL is not set \u2014 script bridge server is not running");
201
+ const startedAt = Date.now();
202
+ send({ type: "stream", chunk: `
203
+ \u{1F4DD} **Querying ${toolId}:**
204
+ \`\`\`sql
205
+ ${sql}
206
+ \`\`\`
207
+
208
+ ` });
209
+ send({ type: "stream", chunk: `__QUERY_TIMER_START_Executing query__` });
210
+ const res = await fetch(`${BRIDGE_URL}/query`, {
211
+ method: "POST",
212
+ headers: { "content-type": "application/json" },
213
+ body: JSON.stringify({ toolId, sql, limit: QUERY_ROW_CAP })
214
+ });
215
+ const json = await res.json();
216
+ const executionTimeMs = Date.now() - startedAt;
217
+ send({ type: "stream", chunk: `__QUERY_TIMER_DONE_${(executionTimeMs / 1e3).toFixed(1)}__
218
+
219
+ ` });
220
+ if (!res.ok || !json.success) {
221
+ const errMsg = json.error || `Bridge query failed (${res.status})`;
222
+ send({ type: "stream", chunk: `\u274C **Query failed on ${toolId}:** ${errMsg}
223
+
224
+ ` });
225
+ throw new Error(errMsg);
226
+ }
227
+ if (json.metadata?.truncated) {
228
+ const total = json.metadata.totalCount ?? "more";
229
+ const hasGroupBy = /\bGROUP\s+BY\b/i.test(sql);
230
+ const explicitLimitMatch = sql.match(/\bLIMIT\s+(\d+)/i);
231
+ const hasDeliberateLimit = explicitLimitMatch != null && Number(explicitLimitMatch[1]) < QUERY_ROW_CAP;
232
+ if (hasGroupBy) {
233
+ send({ type: "stream", chunk: `\u2139\uFE0F Only the top ${QUERY_ROW_CAP} of ${total} grouped rows are returned (query is already aggregated via GROUP BY) \u2014 expected for a top-N request.
234
+
235
+ ` });
236
+ } else if (hasDeliberateLimit) {
237
+ send({ type: "stream", chunk: `\u2139\uFE0F Only the ${explicitLimitMatch[1]} rows requested (of ${total} matching) are returned \u2014 expected for a top-N request with an explicit LIMIT.
238
+
239
+ ` });
240
+ } else {
241
+ const msg = `ctx.query truncated the result of this query to ${QUERY_ROW_CAP} rows (it matched ${total}). Do NOT compute over raw rows \u2014 AGGREGATE IN SQL (GROUP BY / mode() / mode(...) FILTER (WHERE \u2026) / COUNT(...) FILTER (\u2026) / CASE) so the query returns the final, already-reduced rows, then have getData return those.`;
242
+ send({ type: "stream", chunk: `\u274C **Result truncated on ${toolId}:** ${msg}
243
+
244
+ ` });
245
+ throw new Error(msg);
246
+ }
247
+ }
248
+ const data = json.data ?? [];
249
+ const count = json.count ?? data.length;
250
+ send({ type: "stream", chunk: `\u2705 **${count} rows from ${toolId}**
251
+
252
+ ` });
253
+ if (data.length > 0) {
254
+ send({ type: "stream", chunk: `<DataTable>${JSON.stringify(previewRows(data))}</DataTable>
255
+
256
+ ` });
257
+ }
258
+ executedQueries.push({
259
+ sourceId: toolId,
260
+ sourceName: toolId,
261
+ // enriched by runner after result arrives
262
+ sql,
263
+ data,
264
+ count,
265
+ executionTimeMs
266
+ });
267
+ return { data, count };
268
+ },
269
+ /**
270
+ * Call a tool with structured params (typically a direct tool whose
271
+ * fn(params) does not expect a SQL string). Returns whatever the tool
272
+ * returned — shape is up to the tool.
273
+ *
274
+ * Use this when you need a pre-built business-logic tool (e.g.,
275
+ * "Calculate Shelf Life") that takes structured input rather than SQL.
276
+ * For SQL source tools, keep using ctx.query.
277
+ *
278
+ * runTool results do NOT auto-flow into executedQueries. If you want
279
+ * the result visualised, register it via ctx.emit() after extracting
280
+ * the array you want to chart.
281
+ */
282
+ async runTool(toolId, params = {}) {
283
+ if (!BRIDGE_URL) throw new Error("SCRIPT_BRIDGE_URL is not set \u2014 script bridge server is not running");
284
+ const res = await fetch(`${BRIDGE_URL}/run-tool`, {
285
+ method: "POST",
286
+ headers: { "content-type": "application/json" },
287
+ body: JSON.stringify({ toolId, params })
288
+ });
289
+ const json = await res.json();
290
+ if (!res.ok || !json.success) throw new Error(json.error || `Bridge run-tool failed (${res.status})`);
291
+ return json.result;
292
+ },
293
+ /**
294
+ * Register a computed dataset. Flows into executedQueries alongside
295
+ * real SQL query results so component generation can render post-SQL
296
+ * transforms (weighted averages, clustering, joins) as charts.
297
+ */
298
+ emit(name, rows, meta) {
299
+ executedQueries.push({
300
+ sourceId: `computed:${name}`,
301
+ sourceName: meta?.description || name,
302
+ sql: `-- computed dataset: ${name}`,
303
+ data: Array.isArray(rows) ? rows : [],
304
+ count: Array.isArray(rows) ? rows.length : 0,
305
+ executionTimeMs: 0,
306
+ virtual: true
307
+ });
308
+ },
309
+ /**
310
+ * Forward a short progress message to the parent's StreamBuffer so the UI
311
+ * continues to see per-script feedback during execution.
312
+ */
313
+ log(chunk) {
314
+ send({ type: "stream", chunk });
315
+ }
316
+ };
317
+ }
318
+ function guardCtx(ctx) {
319
+ const PASSTHROUGH = /* @__PURE__ */ new Set([
320
+ "then",
321
+ "catch",
322
+ "finally",
323
+ "constructor",
324
+ "toJSON",
325
+ "inspect",
326
+ "valueOf",
327
+ "toString",
328
+ "hasOwnProperty",
329
+ "nodeType"
330
+ ]);
331
+ return new Proxy(ctx, {
332
+ get(target, prop, receiver) {
333
+ if (typeof prop === "symbol" || prop in target || PASSTHROUGH.has(prop)) {
334
+ return Reflect.get(target, prop, receiver);
335
+ }
336
+ const available = Reflect.ownKeys(target).filter((k) => typeof k === "string").join(", ");
337
+ throw new TypeError(
338
+ `ctx.${String(prop)} does not exist. ctx has exactly: ${available}. There are no formatting/parsing/date helpers on ctx \u2014 interpolate ISO date strings straight into the SQL and do date arithmetic in SQL.`
339
+ );
340
+ }
341
+ });
342
+ }
343
+ function send(msg) {
344
+ return process.stdout.write(encodeMessage(msg));
345
+ }
346
+ function sendError(message, phase, stack) {
347
+ send({ type: "error", message, stack, phase });
348
+ }
349
+ var splitter = new LineSplitter();
350
+ process.stdin.setEncoding("utf-8");
351
+ process.stdin.on("data", (chunk) => {
352
+ let lines;
353
+ try {
354
+ lines = splitter.push(chunk);
355
+ } catch (err) {
356
+ const msg = err instanceof Error ? err.message : String(err);
357
+ sendError(msg, "runtime");
358
+ process.exit(1);
359
+ }
360
+ for (const line of lines) {
361
+ let msg;
362
+ try {
363
+ msg = JSON.parse(line);
364
+ } catch {
365
+ continue;
366
+ }
367
+ handleMessage(msg);
368
+ }
369
+ });
370
+ function handleMessage(msg) {
371
+ switch (msg.type) {
372
+ case "init": {
373
+ if (initResolve) {
374
+ const now = new Date(msg.now || (/* @__PURE__ */ new Date()).toISOString());
375
+ const params = restoreParamTypes(msg.params || {}, msg.paramSchema);
376
+ initResolve({ params, now, mode: msg.mode, data: msg.data, datasets: msg.datasets, fmt: msg.fmt });
377
+ initResolve = null;
378
+ }
379
+ break;
380
+ }
381
+ }
382
+ }
383
+ function collectDatasets(queries) {
384
+ const out = {};
385
+ for (const q of queries) {
386
+ if (q.virtual && q.sourceId.startsWith("computed:")) {
387
+ out[q.sourceId.slice("computed:".length)] = q.data;
388
+ }
389
+ }
390
+ return out;
391
+ }
392
+ async function runComponents(mod, data, params, fmtCfg, datasets = {}) {
393
+ const getComponents = mod?.getComponents ?? mod?.default?.getComponents;
394
+ if (typeof getComponents !== "function") return {};
395
+ try {
396
+ const out = await getComponents(data, params, makeFmt(fmtCfg), datasets);
397
+ if (!Array.isArray(out)) {
398
+ return { componentsError: "getComponents must return an ARRAY of component specs" };
399
+ }
400
+ if (out.some((c) => !c || typeof c !== "object")) {
401
+ return { componentsError: "every entry getComponents returns must be a component spec object" };
402
+ }
403
+ return { components: out };
404
+ } catch (err) {
405
+ const e = err;
406
+ return { componentsError: e?.message || String(err) };
407
+ }
408
+ }
409
+ async function runAnalysis(mod, data, params, fmtCfg, datasets = {}) {
410
+ const getAnalysis = mod?.getAnalysis ?? mod?.default?.getAnalysis;
411
+ if (typeof getAnalysis !== "function") return {};
412
+ try {
413
+ const out = await getAnalysis(data, params, makeFmt(fmtCfg), datasets);
414
+ if (!out || typeof out !== "object") {
415
+ return { analysisError: "getAnalysis must return an object with { analysis, summary, method }" };
416
+ }
417
+ return {
418
+ analysis: {
419
+ analysis: typeof out.analysis === "string" ? out.analysis : void 0,
420
+ summary: Array.isArray(out.summary) ? out.summary.map((s) => String(s)) : void 0,
421
+ method: typeof out.method === "string" ? out.method : void 0
422
+ }
423
+ };
424
+ } catch (err) {
425
+ const e = err;
426
+ return { analysisError: e?.message || String(err) };
427
+ }
428
+ }
429
+ (async () => {
430
+ let mod;
431
+ let getData;
432
+ try {
433
+ mod = await import(pathToFileURL(SCRIPT_ARG).href);
434
+ getData = mod.getData ?? (typeof mod.default === "function" ? mod.default : mod.default?.getData);
435
+ } catch (err) {
436
+ const e = err;
437
+ sendError(e.message || String(err), "compile", e.stack);
438
+ process.exit(1);
439
+ return;
440
+ }
441
+ const init = await initPromise;
442
+ if (init.mode === "analysis" || init.mode === "components") {
443
+ const started = Date.now();
444
+ const rows = Array.isArray(init.data) ? init.data : [];
445
+ const ds = init.datasets ?? {};
446
+ const authored = init.mode === "analysis" ? await runAnalysis(mod, rows, init.params, init.fmt, ds) : await runComponents(mod, rows, init.params, init.fmt, ds);
447
+ const flushedAuthored = send({
448
+ type: "result",
449
+ data: [],
450
+ count: rows.length,
451
+ executedQueries: [],
452
+ executionTimeMs: Date.now() - started,
453
+ sampleRows: [],
454
+ ...authored
455
+ });
456
+ if (flushedAuthored) process.exit(0);
457
+ else process.stdout.once("drain", () => process.exit(0));
458
+ return;
459
+ }
460
+ if (typeof getData !== "function") {
461
+ sendError(
462
+ `Script at ${SCRIPT_ARG} does not export getData \u2014 expected \`export async function getData(ctx, params)\``,
463
+ "compile"
464
+ );
465
+ process.exit(1);
466
+ return;
467
+ }
468
+ const ctx = guardCtx(buildCtx(init));
469
+ const startedAt = Date.now();
470
+ try {
471
+ const raw = await getData(ctx, init.params);
472
+ const executionTimeMs = Date.now() - startedAt;
473
+ const data = normalizeResultData(raw);
474
+ const count = typeof raw?.count === "number" ? raw.count : data.length;
475
+ const sampleRows = data.slice(0, 5);
476
+ const ds = collectDatasets(executedQueries);
477
+ const { analysis, analysisError } = await runAnalysis(mod, data, init.params, init.fmt, ds);
478
+ const { components, componentsError } = await runComponents(mod, data, init.params, init.fmt, ds);
479
+ const result = {
480
+ type: "result",
481
+ data,
482
+ count,
483
+ executedQueries,
484
+ executionTimeMs,
485
+ sampleRows,
486
+ analysis,
487
+ analysisError,
488
+ components,
489
+ componentsError
490
+ };
491
+ const flushed = send(result);
492
+ if (flushed) {
493
+ process.exit(0);
494
+ } else {
495
+ process.stdout.once("drain", () => process.exit(0));
496
+ }
497
+ } catch (err) {
498
+ const e = err;
499
+ sendError(e.message || String(err), "runtime", e.stack);
500
+ process.exit(1);
501
+ }
502
+ })();
503
+ function normalizeResultData(raw) {
504
+ if (!raw) return [];
505
+ if (Array.isArray(raw)) return raw;
506
+ if (Array.isArray(raw.data)) return raw.data;
507
+ if (raw.data && typeof raw.data === "object") return [raw.data];
508
+ return [];
509
+ }
510
+ function restoreParamTypes(params, schema) {
511
+ if (!schema) return params;
512
+ const out = { ...params };
513
+ for (const [name, type] of Object.entries(schema)) {
514
+ const v = out[name];
515
+ if (v === void 0 || v === null) continue;
516
+ if (type === "date" && typeof v === "string") {
517
+ const d = new Date(v);
518
+ if (!isNaN(d.getTime())) out[name] = d;
519
+ } else if (type === "date_range" && typeof v === "object") {
520
+ const from = v.from;
521
+ const to = v.to;
522
+ out[name] = {
523
+ from: typeof from === "string" ? new Date(from) : from,
524
+ to: typeof to === "string" ? new Date(to) : to
525
+ };
526
+ }
527
+ }
528
+ return out;
529
+ }
530
+ //# sourceMappingURL=script-bootstrap.mjs.map
package/package.json CHANGED
@@ -1,49 +1,52 @@
1
- {
2
- "name": "@superatomai/sdk-node",
3
- "version": "0.0.44",
4
- "description": "Node.js TypeScript SDK for Superatom",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.mjs",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js"
13
- }
14
- },
15
- "files": [
16
- "dist"
17
- ],
18
- "scripts": {
19
- "build": "tsup",
20
- "dev": "tsup --watch",
21
- "test": "tsx test-sdk.ts",
22
- "prepublishOnly": "pnpm run build"
23
- },
24
- "keywords": [
25
- "superatom",
26
- "sdk",
27
- "typescript"
28
- ],
29
- "author": "ashish@superatom.ai",
30
- "license": "MIT",
31
- "devDependencies": {
32
- "@types/node": "^20.11.5",
33
- "@types/ws": "^8.18.1",
34
- "dotenv": "^17.2.3",
35
- "tsup": "^8.0.1",
36
- "tsx": "^4.20.6",
37
- "typescript": "^5.3.3",
38
- "ws": "^8.18.3"
39
- },
40
- "dependencies": {
41
- "@anthropic-ai/sdk": "^0.66.0",
42
- "@google/generative-ai": "^0.21.0",
43
- "groq-sdk": "^0.33.0",
44
- "jsonrepair": "^3.13.1",
45
- "openai": "^4.77.0",
46
- "ws": "^8.18.3",
47
- "zod": "^3.25.76"
48
- }
49
- }
1
+ {
2
+ "name": "@superatomai/sdk-node",
3
+ "version": "0.0.45-dsp",
4
+ "description": "Node.js TypeScript SDK for Superatom",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "!dist/**/*.map"
18
+ ],
19
+ "keywords": [
20
+ "superatom",
21
+ "sdk",
22
+ "typescript"
23
+ ],
24
+ "author": "ashish@superatom.ai",
25
+ "license": "MIT",
26
+ "devDependencies": {
27
+ "@types/node": "^20.11.5",
28
+ "@types/ws": "^8.18.1",
29
+ "dotenv": "^17.2.3",
30
+ "tsup": "^8.0.1",
31
+ "tsx": "^4.20.6",
32
+ "typescript": "^5.3.3",
33
+ "ws": "^8.21.0"
34
+ },
35
+ "dependencies": {
36
+ "@anthropic-ai/sdk": "^0.66.0",
37
+ "@earendil-works/pi-coding-agent": "^0.80.3",
38
+ "@google/generative-ai": "^0.21.0",
39
+ "groq-sdk": "^0.33.0",
40
+ "jsonrepair": "^3.13.1",
41
+ "openai": "^4.77.0",
42
+ "typebox": "^1.1.38",
43
+ "ws": "^8.21.0",
44
+ "zod": "^3.25.76"
45
+ },
46
+ "scripts": {
47
+ "build": "tsc --noEmit && tsup",
48
+ "dev": "tsup --watch",
49
+ "test": "tsx test-sdk.ts",
50
+ "type-check": "tsc --noEmit"
51
+ }
52
+ }