@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,296 @@
1
+ import {
2
+ registry
3
+ } from "./chunk-ABCK4FWN.js";
4
+
5
+ // ../../lib/skills/schema-compiler.ts
6
+ function resolveDefinition(def) {
7
+ if (typeof def === "boolean") return null;
8
+ return def;
9
+ }
10
+ function formatLabel(key) {
11
+ return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
12
+ }
13
+ function compileProperty(key, prop, required) {
14
+ const label = prop.title ?? formatLabel(key);
15
+ const description = prop.description;
16
+ const type = prop.type;
17
+ if (type === "array") {
18
+ const itemsDef = prop.items;
19
+ const items = itemsDef && !Array.isArray(itemsDef) ? resolveDefinition(itemsDef) : null;
20
+ if (items && Array.isArray(items.enum)) {
21
+ return {
22
+ key,
23
+ widget: "multi-select",
24
+ label,
25
+ description,
26
+ required,
27
+ constraints: {
28
+ options: items.enum,
29
+ minItems: prop.minItems,
30
+ maxItems: prop.maxItems
31
+ },
32
+ toFormValue: (v) => Array.isArray(v) ? v.map(String) : [],
33
+ fromFormValue: (v) => Array.isArray(v) ? v : []
34
+ };
35
+ }
36
+ if (items && items.type === "string") {
37
+ return {
38
+ key,
39
+ widget: "text",
40
+ label,
41
+ description: description ? `${description} (comma-separated)` : "Enter values separated by commas",
42
+ required,
43
+ constraints: {
44
+ minItems: prop.minItems,
45
+ maxItems: prop.maxItems
46
+ },
47
+ toFormValue: (v) => Array.isArray(v) ? v.join(", ") : typeof v === "string" ? v : "",
48
+ fromFormValue: (v) => {
49
+ if (Array.isArray(v)) return v;
50
+ if (typeof v === "string") {
51
+ return v.split(",").map((s) => s.trim()).filter(Boolean);
52
+ }
53
+ return [];
54
+ }
55
+ };
56
+ }
57
+ return {
58
+ error: `Field "${key}": array items type "${items?.type ?? "unknown"}" is not supported \u2014 use items.enum for multi-select or items.type: "string" for comma input`
59
+ };
60
+ }
61
+ if (type === "string" && Array.isArray(prop.enum)) {
62
+ return {
63
+ key,
64
+ widget: "select",
65
+ label,
66
+ description,
67
+ required,
68
+ constraints: { options: prop.enum },
69
+ toFormValue: (v) => typeof v === "string" ? v : "",
70
+ fromFormValue: (v) => v
71
+ };
72
+ }
73
+ if (type === "string" && (prop.maxLength ?? 0) > 500) {
74
+ return {
75
+ key,
76
+ widget: "textarea",
77
+ label,
78
+ description,
79
+ required,
80
+ constraints: {
81
+ minLength: prop.minLength,
82
+ maxLength: prop.maxLength
83
+ },
84
+ toFormValue: (v) => typeof v === "string" ? v : String(v ?? ""),
85
+ fromFormValue: (v) => v
86
+ };
87
+ }
88
+ if (type === "string") {
89
+ return {
90
+ key,
91
+ widget: "text",
92
+ label,
93
+ description,
94
+ required,
95
+ constraints: {
96
+ minLength: prop.minLength,
97
+ maxLength: prop.maxLength
98
+ },
99
+ toFormValue: (v) => typeof v === "string" ? v : String(v ?? ""),
100
+ fromFormValue: (v) => v
101
+ };
102
+ }
103
+ if (type === "number" || type === "integer") {
104
+ return {
105
+ key,
106
+ widget: "number",
107
+ label,
108
+ description,
109
+ required,
110
+ constraints: {
111
+ min: prop.minimum,
112
+ max: prop.maximum
113
+ },
114
+ toFormValue: (v) => typeof v === "number" ? v : 0,
115
+ fromFormValue: (v) => {
116
+ const n = Number(v);
117
+ if (Number.isNaN(n)) return 0;
118
+ return type === "integer" ? Math.round(n) : n;
119
+ }
120
+ };
121
+ }
122
+ if (type === "boolean") {
123
+ return {
124
+ key,
125
+ widget: "toggle",
126
+ label,
127
+ description,
128
+ required,
129
+ constraints: {},
130
+ toFormValue: (v) => v === true,
131
+ fromFormValue: (v) => v === true || v === "true"
132
+ };
133
+ }
134
+ if (type === "object") {
135
+ return healObjectField(key, prop, required);
136
+ }
137
+ return {
138
+ error: `Field "${key}": type "${type ?? "undefined"}" is not supported \u2014 use string, number, integer, boolean, array, or object`
139
+ };
140
+ }
141
+ function healObjectField(key, prop, required) {
142
+ const label = prop.title ?? formatLabel(key);
143
+ const description = prop.description;
144
+ const subProperties = prop.properties ? Object.keys(prop.properties) : [];
145
+ const hasProperties = subProperties.length > 0;
146
+ const entropy = hasProperties ? Math.log2(Math.max(2, subProperties.length)) * 2 + subProperties.length * 0.5 : 1;
147
+ const confidence = hasProperties ? 0.7 : description ? 0.5 : 0.3;
148
+ const lostDimensions = ["object schema enforcement"];
149
+ if (hasProperties) {
150
+ lostDimensions.push(
151
+ `nested structure (${subProperties.length} properties: ${subProperties.join(", ")})`
152
+ );
153
+ lostDimensions.push("per-property type constraints");
154
+ if (prop.required && Array.isArray(prop.required)) {
155
+ lostDimensions.push(`required-field enforcement (${prop.required.join(", ")})`);
156
+ }
157
+ }
158
+ let placeholder;
159
+ if (hasProperties && prop.properties) {
160
+ const example = {};
161
+ for (const [k, v] of Object.entries(prop.properties)) {
162
+ const resolved = resolveDefinition(v);
163
+ example[k] = resolved?.type === "number" || resolved?.type === "integer" ? "0" : resolved?.type === "boolean" ? "false" : "";
164
+ }
165
+ try {
166
+ placeholder = JSON.stringify(example, null, 2);
167
+ } catch {
168
+ }
169
+ }
170
+ return {
171
+ key,
172
+ widget: "textarea",
173
+ label,
174
+ description: description ? `${description} (JSON)` : `Enter ${formatLabel(key)} as JSON`,
175
+ required,
176
+ constraints: {
177
+ // Suggest a minimum for non-empty JSON objects
178
+ minLength: required ? 2 : void 0
179
+ },
180
+ toFormValue: (v) => {
181
+ if (typeof v === "string") return v;
182
+ if (v === null || v === void 0) return placeholder ?? "{}";
183
+ try {
184
+ return JSON.stringify(v, null, 2);
185
+ } catch {
186
+ return "{}";
187
+ }
188
+ },
189
+ fromFormValue: (v) => {
190
+ if (typeof v !== "string") return v;
191
+ const trimmed = v.trim();
192
+ if (!trimmed) return {};
193
+ try {
194
+ return JSON.parse(trimmed);
195
+ } catch {
196
+ return trimmed;
197
+ }
198
+ },
199
+ healingTrace: {
200
+ originalType: "object",
201
+ strategy: "json-textarea",
202
+ lostDimensions,
203
+ entropy,
204
+ confidence
205
+ }
206
+ };
207
+ }
208
+ function compileInputSchema(schema) {
209
+ const fields = [];
210
+ const errors = [];
211
+ const warnings = [];
212
+ if (schema.type !== "object" || !schema.properties) {
213
+ return {
214
+ fields,
215
+ errors: ["inputSchema must be type: 'object' with properties"],
216
+ warnings: []
217
+ };
218
+ }
219
+ const required = new Set(
220
+ Array.isArray(schema.required) ? schema.required : []
221
+ );
222
+ for (const [key, propDef] of Object.entries(schema.properties)) {
223
+ const prop = resolveDefinition(propDef);
224
+ if (!prop) {
225
+ errors.push(`Property "${key}" is a boolean schema \u2014 skipped`);
226
+ continue;
227
+ }
228
+ const result = compileProperty(key, prop, required.has(key));
229
+ if ("error" in result) {
230
+ errors.push(result.error);
231
+ } else {
232
+ fields.push(result);
233
+ if (result.healingTrace) {
234
+ const t = result.healingTrace;
235
+ warnings.push(
236
+ `Field "${key}": type "${t.originalType}" healed to ${t.strategy} (entropy: ${t.entropy.toFixed(1)} bits, lost: ${t.lostDimensions.join("; ")})`
237
+ );
238
+ }
239
+ }
240
+ }
241
+ return { fields, errors, warnings };
242
+ }
243
+
244
+ // ../../lib/skills/registry.ts
245
+ var SLUG_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
246
+ var SKILL_REGISTRY = /* @__PURE__ */ new Map();
247
+ function registerSkill(skill) {
248
+ const slug = skill.skill.slug;
249
+ if (!slug || !SLUG_PATTERN.test(slug)) {
250
+ console.warn(
251
+ `[Skills] Rejected registration: invalid slug "${slug}" \u2014 must be lowercase alphanumeric with hyphens`
252
+ );
253
+ return;
254
+ }
255
+ if (skill.skill.inputSchema) {
256
+ const compiled = compileInputSchema(skill.skill.inputSchema);
257
+ if (compiled.errors.length > 0) {
258
+ console.warn(`[Skills] Schema errors for "${slug}":`, compiled.errors.join("; "));
259
+ }
260
+ if (compiled.warnings.length > 0) {
261
+ console.warn(`[Skills] Schema healing for "${slug}":`, compiled.warnings.join("; "));
262
+ }
263
+ }
264
+ SKILL_REGISTRY.set(slug, skill);
265
+ registry.register(skill, "skill", "system", skill.skill.tags);
266
+ }
267
+ function getSkill(slug) {
268
+ return SKILL_REGISTRY.get(slug);
269
+ }
270
+ function getAllSkills() {
271
+ return Array.from(SKILL_REGISTRY.values());
272
+ }
273
+ function getSkillsByCategory(category) {
274
+ return getAllSkills().filter((s) => s.skill.category === category);
275
+ }
276
+ function getSkillCount() {
277
+ return SKILL_REGISTRY.size;
278
+ }
279
+ var skillsLoadPromise = null;
280
+ async function ensureSkillsRegistered() {
281
+ if (SKILL_REGISTRY.size > 0) return;
282
+ if (!skillsLoadPromise) {
283
+ skillsLoadPromise = import("./skills-VN7IN7SJ.js").then(() => {
284
+ });
285
+ }
286
+ await skillsLoadPromise;
287
+ }
288
+
289
+ export {
290
+ registerSkill,
291
+ getSkill,
292
+ getAllSkills,
293
+ getSkillsByCategory,
294
+ getSkillCount,
295
+ ensureSkillsRegistered
296
+ };