@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,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,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
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// ../../lib/skills/types.ts
|
|
2
|
+
var SKILL_CATEGORIES = [
|
|
3
|
+
"startup",
|
|
4
|
+
"legal",
|
|
5
|
+
"finance",
|
|
6
|
+
"engineering",
|
|
7
|
+
"content",
|
|
8
|
+
"research",
|
|
9
|
+
"operations",
|
|
10
|
+
"marketing",
|
|
11
|
+
"verification"
|
|
12
|
+
];
|
|
13
|
+
var SKILL_TIERS = ["flagship", "professional", "utility"];
|
|
14
|
+
var SKILL_RANKS = ["skill", "flow", "fleet", "org", "society"];
|
|
15
|
+
var SKILL_RUN_STATUSES = [
|
|
16
|
+
"pending",
|
|
17
|
+
"running",
|
|
18
|
+
"gate_pending",
|
|
19
|
+
"paused",
|
|
20
|
+
"resuming",
|
|
21
|
+
"retrying",
|
|
22
|
+
"completed",
|
|
23
|
+
"failed",
|
|
24
|
+
"cancelled"
|
|
25
|
+
];
|
|
26
|
+
function isSkillCategory(value) {
|
|
27
|
+
return typeof value === "string" && SKILL_CATEGORIES.includes(value);
|
|
28
|
+
}
|
|
29
|
+
function isSkillTier(value) {
|
|
30
|
+
return typeof value === "string" && SKILL_TIERS.includes(value);
|
|
31
|
+
}
|
|
32
|
+
function isSkillManifest(value) {
|
|
33
|
+
if (typeof value !== "object" || value === null) return false;
|
|
34
|
+
const obj = value;
|
|
35
|
+
if (!Array.isArray(obj.nodes)) return false;
|
|
36
|
+
if (typeof obj.skill !== "object" || obj.skill === null) return false;
|
|
37
|
+
const skill = obj.skill;
|
|
38
|
+
return typeof skill.slug === "string" && typeof skill.title === "string" && isSkillCategory(skill.category) && isSkillTier(skill.tier);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ../../lib/registry.ts
|
|
42
|
+
var ManifestRegistry = class {
|
|
43
|
+
entries = /* @__PURE__ */ new Map();
|
|
44
|
+
register(manifest, type, source, tags) {
|
|
45
|
+
const key = this.deriveKey(manifest, type);
|
|
46
|
+
if (!key) return;
|
|
47
|
+
this.entries.set(key, {
|
|
48
|
+
type,
|
|
49
|
+
manifest,
|
|
50
|
+
source,
|
|
51
|
+
registeredAt: Date.now(),
|
|
52
|
+
tags
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
get(key) {
|
|
56
|
+
return this.entries.get(key);
|
|
57
|
+
}
|
|
58
|
+
getSkill(slug) {
|
|
59
|
+
const entry = this.entries.get(slug);
|
|
60
|
+
if (entry && entry.type === "skill") {
|
|
61
|
+
return entry.manifest;
|
|
62
|
+
}
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
65
|
+
getAll(filter) {
|
|
66
|
+
let results = [];
|
|
67
|
+
for (const entry of this.entries.values()) {
|
|
68
|
+
if (filter?.type && entry.type !== filter.type) continue;
|
|
69
|
+
if (filter?.source && entry.source !== filter.source) continue;
|
|
70
|
+
if (filter?.category && entry.type === "skill") {
|
|
71
|
+
const skill = entry.manifest;
|
|
72
|
+
if (skill.skill.category !== filter.category) continue;
|
|
73
|
+
}
|
|
74
|
+
if (filter?.tags && filter.tags.length > 0) {
|
|
75
|
+
const entryTags = entry.tags ?? [];
|
|
76
|
+
if (!filter.tags.some((t) => entryTags.includes(t))) continue;
|
|
77
|
+
}
|
|
78
|
+
results.push(entry);
|
|
79
|
+
}
|
|
80
|
+
results.sort((a, b) => b.registeredAt - a.registeredAt);
|
|
81
|
+
if (filter?.limit && filter.limit > 0) {
|
|
82
|
+
results = results.slice(0, filter.limit);
|
|
83
|
+
}
|
|
84
|
+
return results;
|
|
85
|
+
}
|
|
86
|
+
resolve(ref) {
|
|
87
|
+
const colonIdx = ref.indexOf(":");
|
|
88
|
+
if (colonIdx > 0) {
|
|
89
|
+
const key = ref.slice(colonIdx + 1);
|
|
90
|
+
return this.entries.get(key) ?? null;
|
|
91
|
+
}
|
|
92
|
+
return this.entries.get(ref) ?? null;
|
|
93
|
+
}
|
|
94
|
+
search(query, filter) {
|
|
95
|
+
const q = query.toLowerCase();
|
|
96
|
+
const all = this.getAll(filter);
|
|
97
|
+
return all.filter((entry) => {
|
|
98
|
+
const m = entry.manifest;
|
|
99
|
+
if (m.name?.toLowerCase().includes(q)) return true;
|
|
100
|
+
if (m.description?.toLowerCase().includes(q)) return true;
|
|
101
|
+
if (m.id?.toLowerCase().includes(q)) return true;
|
|
102
|
+
if (entry.type === "skill") {
|
|
103
|
+
const skill = m;
|
|
104
|
+
if (skill.skill.slug.toLowerCase().includes(q)) return true;
|
|
105
|
+
if (skill.skill.title.toLowerCase().includes(q)) return true;
|
|
106
|
+
if (skill.skill.tags.some((t) => t.toLowerCase().includes(q))) return true;
|
|
107
|
+
}
|
|
108
|
+
return false;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
unregister(key) {
|
|
112
|
+
return this.entries.delete(key);
|
|
113
|
+
}
|
|
114
|
+
get size() {
|
|
115
|
+
return this.entries.size;
|
|
116
|
+
}
|
|
117
|
+
clear() {
|
|
118
|
+
this.entries.clear();
|
|
119
|
+
}
|
|
120
|
+
deriveKey(manifest, type) {
|
|
121
|
+
if (type === "skill" && isSkillManifest(manifest)) {
|
|
122
|
+
return manifest.skill.slug;
|
|
123
|
+
}
|
|
124
|
+
return manifest.id;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var registry = new ManifestRegistry();
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
SKILL_CATEGORIES,
|
|
131
|
+
SKILL_TIERS,
|
|
132
|
+
SKILL_RANKS,
|
|
133
|
+
SKILL_RUN_STATUSES,
|
|
134
|
+
ManifestRegistry,
|
|
135
|
+
registry
|
|
136
|
+
};
|