@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,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_EMBEDDING_DIM,
|
|
3
|
+
DEFAULT_EMBEDDING_MODEL,
|
|
4
|
+
embedText,
|
|
5
|
+
getEmbeddingDimension,
|
|
6
|
+
prewarmEmbeddingsWorker
|
|
7
|
+
} from "./chunk-ZVO47SQV.js";
|
|
8
|
+
import "./chunk-2ESYSVXG.js";
|
|
9
|
+
export {
|
|
10
|
+
DEFAULT_EMBEDDING_DIM,
|
|
11
|
+
DEFAULT_EMBEDDING_MODEL,
|
|
12
|
+
embedText,
|
|
13
|
+
getEmbeddingDimension,
|
|
14
|
+
prewarmEmbeddingsWorker
|
|
15
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "./chunk-2ESYSVXG.js";
|
|
2
|
+
|
|
3
|
+
// ../../lib/terminals-tech/machines/core/adapters/graph.ts
|
|
4
|
+
async function graphLib() {
|
|
5
|
+
return await import("./dist-VYGJXGUS.js");
|
|
6
|
+
}
|
|
7
|
+
function entityGraph() {
|
|
8
|
+
const nodes = /* @__PURE__ */ new Set();
|
|
9
|
+
const edges = [];
|
|
10
|
+
return {
|
|
11
|
+
async handle(input) {
|
|
12
|
+
const g = await graphLib().catch(() => null);
|
|
13
|
+
if (Array.isArray(input?.upsert)) {
|
|
14
|
+
for (const e of input.upsert) {
|
|
15
|
+
nodes.add(String(e.from));
|
|
16
|
+
nodes.add(String(e.to));
|
|
17
|
+
edges.push({ ...e, t: e.t || Date.now() });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (input?.query) {
|
|
21
|
+
const { sinceMs, type } = input.query;
|
|
22
|
+
let res = edges;
|
|
23
|
+
if (sinceMs) {
|
|
24
|
+
const since = Date.now() - Number(sinceMs);
|
|
25
|
+
res = res.filter((e) => (e.t || 0) >= since);
|
|
26
|
+
}
|
|
27
|
+
if (type) res = res.filter((e) => e.type === type);
|
|
28
|
+
return { nodes: Array.from(nodes), edges: res };
|
|
29
|
+
}
|
|
30
|
+
return { nodeCount: nodes.size, edgeCount: edges.length };
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
entityGraph
|
|
36
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import "./chunk-2ESYSVXG.js";
|
|
2
|
+
|
|
3
|
+
// ../../lib/terminals-tech/machines/core/runners/hvm-simulator.ts
|
|
4
|
+
function runFibonacciLogic(n) {
|
|
5
|
+
if (n < 0) return 0;
|
|
6
|
+
if (n === 0) return 0;
|
|
7
|
+
if (n === 1) return 1;
|
|
8
|
+
return runFibonacciLogic(n - 1) + runFibonacciLogic(n - 2);
|
|
9
|
+
}
|
|
10
|
+
async function runInHVMSimulator(programName, input) {
|
|
11
|
+
console.log(`[HVM-Sim] Running ${programName} in simulator mode...`);
|
|
12
|
+
if (programName.includes("agent-logic")) {
|
|
13
|
+
const n = typeof input.n === "number" ? input.n : 15;
|
|
14
|
+
const startTime = performance.now();
|
|
15
|
+
const result = runFibonacciLogic(n);
|
|
16
|
+
const endTime = performance.now();
|
|
17
|
+
console.log(`[HVM-Sim] Completed in ${(endTime - startTime).toFixed(2)}ms. Result: ${result}`);
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
throw new Error(`[HVM-Sim] Unknown program: ${programName}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ../../lib/terminals-tech/machines/core/runners/hvm.ts
|
|
24
|
+
async function runInHVM(manifest, input, ctx) {
|
|
25
|
+
const entry = manifest.entrypoints["wasm-hvm"];
|
|
26
|
+
if (!entry) {
|
|
27
|
+
return {
|
|
28
|
+
error: "No wasm-hvm entrypoint defined",
|
|
29
|
+
input
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const startTime = performance.now();
|
|
34
|
+
let result;
|
|
35
|
+
let strategy = "unknown";
|
|
36
|
+
if (entry.module.endsWith(".wasm")) {
|
|
37
|
+
try {
|
|
38
|
+
result = await runViaWasm(entry.module, input);
|
|
39
|
+
strategy = "wasm";
|
|
40
|
+
} catch (wasmError) {
|
|
41
|
+
console.warn(`[HVM] WASM execution failed, trying fallback:`, wasmError);
|
|
42
|
+
result = await runInHVMSimulator(entry.module, input);
|
|
43
|
+
strategy = "simulator-fallback";
|
|
44
|
+
}
|
|
45
|
+
} else if (entry.module.endsWith(".hvm")) {
|
|
46
|
+
try {
|
|
47
|
+
result = await runViaHVMCore(entry.module, input);
|
|
48
|
+
strategy = "hvm-core";
|
|
49
|
+
} catch (hvmError) {
|
|
50
|
+
console.warn(
|
|
51
|
+
`[HVM] CLI execution failed (likely missing binary), falling back to Simulator:`,
|
|
52
|
+
hvmError
|
|
53
|
+
);
|
|
54
|
+
result = await runInHVMSimulator(entry.module, input);
|
|
55
|
+
strategy = "simulator-fallback";
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
throw new Error(`Unsupported HVM module format: ${entry.module}`);
|
|
59
|
+
}
|
|
60
|
+
const endTime = performance.now();
|
|
61
|
+
return {
|
|
62
|
+
...input,
|
|
63
|
+
result,
|
|
64
|
+
_hvm: {
|
|
65
|
+
reduced: true,
|
|
66
|
+
durationMs: endTime - startTime,
|
|
67
|
+
tier: "wasm-hvm",
|
|
68
|
+
strategy
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
} catch (error) {
|
|
72
|
+
return {
|
|
73
|
+
error: error.message,
|
|
74
|
+
input,
|
|
75
|
+
_hvm: {
|
|
76
|
+
reduced: false,
|
|
77
|
+
tier: "wasm-hvm"
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function runViaHVMCore(hvmPath, input) {
|
|
83
|
+
if (typeof window !== "undefined") {
|
|
84
|
+
const { WebContainerManager } = await import("./WebContainerManager-4LIOGRVM.js");
|
|
85
|
+
const wcm = WebContainerManager.getExistingInstance();
|
|
86
|
+
if (!wcm) {
|
|
87
|
+
throw new Error("WebContainer not available for HVM execution");
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const process = await wcm.spawn("hvm", ["run", hvmPath], {
|
|
91
|
+
cwd: "/home/project"
|
|
92
|
+
});
|
|
93
|
+
let output = "";
|
|
94
|
+
const reader = process.output.getReader();
|
|
95
|
+
while (true) {
|
|
96
|
+
const { done, value } = await reader.read();
|
|
97
|
+
if (done) break;
|
|
98
|
+
output += value;
|
|
99
|
+
}
|
|
100
|
+
const exitCode = await process.exit;
|
|
101
|
+
if (exitCode !== 0) {
|
|
102
|
+
throw new Error(`HVM execution failed with exit code ${exitCode}: ${output}`);
|
|
103
|
+
}
|
|
104
|
+
const match = output.match(/Result:\s*(\d+)/);
|
|
105
|
+
return match ? parseInt(match[1]) : output;
|
|
106
|
+
} catch (e) {
|
|
107
|
+
throw e;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
throw new Error("Server-side HVM execution not implemented");
|
|
111
|
+
}
|
|
112
|
+
async function runViaWasm(wasmPath, input) {
|
|
113
|
+
const response = await fetch(wasmPath);
|
|
114
|
+
const wasmBytes = await response.arrayBuffer();
|
|
115
|
+
const wasmModule = await WebAssembly.instantiate(wasmBytes);
|
|
116
|
+
const instance = wasmModule.instance;
|
|
117
|
+
const main = instance.exports.main;
|
|
118
|
+
if (!main) {
|
|
119
|
+
throw new Error('WASM module does not export "main" function');
|
|
120
|
+
}
|
|
121
|
+
const result = main();
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
runInHVM
|
|
126
|
+
};
|