@cotrrackpro-dev/sdk 0.1.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 (233) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/LICENSE +21 -0
  3. package/README.md +111 -0
  4. package/dist/assistant/compliance.d.ts +24 -0
  5. package/dist/assistant/compliance.js +60 -0
  6. package/dist/assistant/compliance.js.map +1 -0
  7. package/dist/assistant/crisis.d.ts +31 -0
  8. package/dist/assistant/crisis.js +62 -0
  9. package/dist/assistant/crisis.js.map +1 -0
  10. package/dist/assistant/index.d.ts +15 -0
  11. package/dist/assistant/index.js +16 -0
  12. package/dist/assistant/index.js.map +1 -0
  13. package/dist/assistant/levels.d.ts +43 -0
  14. package/dist/assistant/levels.js +102 -0
  15. package/dist/assistant/levels.js.map +1 -0
  16. package/dist/assistant/prompt.d.ts +20 -0
  17. package/dist/assistant/prompt.js +96 -0
  18. package/dist/assistant/prompt.js.map +1 -0
  19. package/dist/assistant/rbac.d.ts +45 -0
  20. package/dist/assistant/rbac.js +75 -0
  21. package/dist/assistant/rbac.js.map +1 -0
  22. package/dist/assistant/readability.d.ts +28 -0
  23. package/dist/assistant/readability.js +70 -0
  24. package/dist/assistant/readability.js.map +1 -0
  25. package/dist/auth/broker.d.ts +32 -0
  26. package/dist/auth/broker.js +48 -0
  27. package/dist/auth/broker.js.map +1 -0
  28. package/dist/auth/deviceFlow.d.ts +26 -0
  29. package/dist/auth/deviceFlow.js +65 -0
  30. package/dist/auth/deviceFlow.js.map +1 -0
  31. package/dist/auth/provider.d.ts +32 -0
  32. package/dist/auth/provider.js +29 -0
  33. package/dist/auth/provider.js.map +1 -0
  34. package/dist/community/badges.d.ts +19 -0
  35. package/dist/community/badges.js +19 -0
  36. package/dist/community/badges.js.map +1 -0
  37. package/dist/community/events.d.ts +30 -0
  38. package/dist/community/events.js +31 -0
  39. package/dist/community/events.js.map +1 -0
  40. package/dist/community/identity.d.ts +28 -0
  41. package/dist/community/identity.js +2 -0
  42. package/dist/community/identity.js.map +1 -0
  43. package/dist/community/index.d.ts +7 -0
  44. package/dist/community/index.js +8 -0
  45. package/dist/community/index.js.map +1 -0
  46. package/dist/community/org.d.ts +46 -0
  47. package/dist/community/org.js +32 -0
  48. package/dist/community/org.js.map +1 -0
  49. package/dist/community/tiers.d.ts +8 -0
  50. package/dist/community/tiers.js +40 -0
  51. package/dist/community/tiers.js.map +1 -0
  52. package/dist/community/types.d.ts +26 -0
  53. package/dist/community/types.js +2 -0
  54. package/dist/community/types.js.map +1 -0
  55. package/dist/core/config.d.ts +22 -0
  56. package/dist/core/config.js +27 -0
  57. package/dist/core/config.js.map +1 -0
  58. package/dist/core/errors.d.ts +29 -0
  59. package/dist/core/errors.js +20 -0
  60. package/dist/core/errors.js.map +1 -0
  61. package/dist/core/transport.d.ts +45 -0
  62. package/dist/core/transport.js +109 -0
  63. package/dist/core/transport.js.map +1 -0
  64. package/dist/diagram/core.d.ts +11 -0
  65. package/dist/diagram/core.js +12 -0
  66. package/dist/diagram/core.js.map +1 -0
  67. package/dist/diagram/extract.d.ts +17 -0
  68. package/dist/diagram/extract.js +213 -0
  69. package/dist/diagram/extract.js.map +1 -0
  70. package/dist/diagram/index.d.ts +2 -0
  71. package/dist/diagram/index.js +3 -0
  72. package/dist/diagram/index.js.map +1 -0
  73. package/dist/diagram/mermaid.d.ts +10 -0
  74. package/dist/diagram/mermaid.js +50 -0
  75. package/dist/diagram/mermaid.js.map +1 -0
  76. package/dist/diagram/prompt.d.ts +4 -0
  77. package/dist/diagram/prompt.js +16 -0
  78. package/dist/diagram/prompt.js.map +1 -0
  79. package/dist/diagram/types.d.ts +33 -0
  80. package/dist/diagram/types.js +2 -0
  81. package/dist/diagram/types.js.map +1 -0
  82. package/dist/diagram/validate.d.ts +13 -0
  83. package/dist/diagram/validate.js +48 -0
  84. package/dist/diagram/validate.js.map +1 -0
  85. package/dist/guide/compose.d.ts +10 -0
  86. package/dist/guide/compose.js +31 -0
  87. package/dist/guide/compose.js.map +1 -0
  88. package/dist/guide/core.d.ts +10 -0
  89. package/dist/guide/core.js +11 -0
  90. package/dist/guide/core.js.map +1 -0
  91. package/dist/guide/index.d.ts +2 -0
  92. package/dist/guide/index.js +3 -0
  93. package/dist/guide/index.js.map +1 -0
  94. package/dist/guide/prompt.d.ts +8 -0
  95. package/dist/guide/prompt.js +20 -0
  96. package/dist/guide/prompt.js.map +1 -0
  97. package/dist/guide/render.d.ts +9 -0
  98. package/dist/guide/render.js +180 -0
  99. package/dist/guide/render.js.map +1 -0
  100. package/dist/guide/types.d.ts +67 -0
  101. package/dist/guide/types.js +2 -0
  102. package/dist/guide/types.js.map +1 -0
  103. package/dist/index.d.ts +18 -0
  104. package/dist/index.js +19 -0
  105. package/dist/index.js.map +1 -0
  106. package/dist/mcp/artifacts.generated.d.ts +19 -0
  107. package/dist/mcp/artifacts.generated.js +140 -0
  108. package/dist/mcp/artifacts.generated.js.map +1 -0
  109. package/dist/mcp/format.d.ts +10 -0
  110. package/dist/mcp/format.js +17 -0
  111. package/dist/mcp/format.js.map +1 -0
  112. package/dist/mcp/index.d.ts +12 -0
  113. package/dist/mcp/index.js +18 -0
  114. package/dist/mcp/index.js.map +1 -0
  115. package/dist/mcp/knowledge.generated.d.ts +11 -0
  116. package/dist/mcp/knowledge.generated.js +12 -0
  117. package/dist/mcp/knowledge.generated.js.map +1 -0
  118. package/dist/mcp/prompt-modules.generated.d.ts +12 -0
  119. package/dist/mcp/prompt-modules.generated.js +19 -0
  120. package/dist/mcp/prompt-modules.generated.js.map +1 -0
  121. package/dist/mcp/roles.generated.d.ts +15 -0
  122. package/dist/mcp/roles.generated.js +25 -0
  123. package/dist/mcp/roles.generated.js.map +1 -0
  124. package/dist/mcp/safety.d.ts +35 -0
  125. package/dist/mcp/safety.js +76 -0
  126. package/dist/mcp/safety.js.map +1 -0
  127. package/dist/mcp/scenarios.generated.d.ts +13 -0
  128. package/dist/mcp/scenarios.generated.js +16 -0
  129. package/dist/mcp/scenarios.generated.js.map +1 -0
  130. package/dist/mcp/search.d.ts +13 -0
  131. package/dist/mcp/search.js +33 -0
  132. package/dist/mcp/search.js.map +1 -0
  133. package/dist/mcp/skills.generated.d.ts +17 -0
  134. package/dist/mcp/skills.generated.js +40 -0
  135. package/dist/mcp/skills.generated.js.map +1 -0
  136. package/dist/mcp/toolset.d.ts +31 -0
  137. package/dist/mcp/toolset.js +54 -0
  138. package/dist/mcp/toolset.js.map +1 -0
  139. package/dist/mcp/types.d.ts +96 -0
  140. package/dist/mcp/types.js +9 -0
  141. package/dist/mcp/types.js.map +1 -0
  142. package/dist/mcp/workflows.generated.d.ts +17 -0
  143. package/dist/mcp/workflows.generated.js +12 -0
  144. package/dist/mcp/workflows.generated.js.map +1 -0
  145. package/dist/nocode/core.d.ts +12 -0
  146. package/dist/nocode/core.js +13 -0
  147. package/dist/nocode/core.js.map +1 -0
  148. package/dist/nocode/examples.d.ts +28 -0
  149. package/dist/nocode/examples.js +218 -0
  150. package/dist/nocode/examples.js.map +1 -0
  151. package/dist/nocode/index.d.ts +2 -0
  152. package/dist/nocode/index.js +3 -0
  153. package/dist/nocode/index.js.map +1 -0
  154. package/dist/nocode/mermaid.d.ts +9 -0
  155. package/dist/nocode/mermaid.js +33 -0
  156. package/dist/nocode/mermaid.js.map +1 -0
  157. package/dist/nocode/prompt.d.ts +8 -0
  158. package/dist/nocode/prompt.js +46 -0
  159. package/dist/nocode/prompt.js.map +1 -0
  160. package/dist/nocode/runtime.d.ts +28 -0
  161. package/dist/nocode/runtime.js +113 -0
  162. package/dist/nocode/runtime.js.map +1 -0
  163. package/dist/nocode/simpleOps.d.ts +16 -0
  164. package/dist/nocode/simpleOps.js +137 -0
  165. package/dist/nocode/simpleOps.js.map +1 -0
  166. package/dist/nocode/types.d.ts +72 -0
  167. package/dist/nocode/types.js +12 -0
  168. package/dist/nocode/types.js.map +1 -0
  169. package/dist/nocode/validate.d.ts +17 -0
  170. package/dist/nocode/validate.js +136 -0
  171. package/dist/nocode/validate.js.map +1 -0
  172. package/dist/params/codegen.d.ts +8 -0
  173. package/dist/params/codegen.js +12 -0
  174. package/dist/params/codegen.js.map +1 -0
  175. package/dist/params/convert.d.ts +7 -0
  176. package/dist/params/convert.js +123 -0
  177. package/dist/params/convert.js.map +1 -0
  178. package/dist/params/core.d.ts +11 -0
  179. package/dist/params/core.js +12 -0
  180. package/dist/params/core.js.map +1 -0
  181. package/dist/params/fieldTypes.d.ts +26 -0
  182. package/dist/params/fieldTypes.js +29 -0
  183. package/dist/params/fieldTypes.js.map +1 -0
  184. package/dist/params/index.d.ts +3 -0
  185. package/dist/params/index.js +4 -0
  186. package/dist/params/index.js.map +1 -0
  187. package/dist/params/prompt.d.ts +4 -0
  188. package/dist/params/prompt.js +16 -0
  189. package/dist/params/prompt.js.map +1 -0
  190. package/dist/params/render.d.ts +5 -0
  191. package/dist/params/render.js +25 -0
  192. package/dist/params/render.js.map +1 -0
  193. package/dist/params/types.d.ts +76 -0
  194. package/dist/params/types.js +16 -0
  195. package/dist/params/types.js.map +1 -0
  196. package/dist/params/validate.d.ts +5 -0
  197. package/dist/params/validate.js +104 -0
  198. package/dist/params/validate.js.map +1 -0
  199. package/dist/resources/client.d.ts +58 -0
  200. package/dist/resources/client.js +79 -0
  201. package/dist/resources/client.js.map +1 -0
  202. package/dist/resources/types.d.ts +72 -0
  203. package/dist/resources/types.js +9 -0
  204. package/dist/resources/types.js.map +1 -0
  205. package/dist/workflow/assets.d.ts +8 -0
  206. package/dist/workflow/assets.js +16 -0
  207. package/dist/workflow/assets.js.map +1 -0
  208. package/dist/workflow/commands.d.ts +10 -0
  209. package/dist/workflow/commands.js +21 -0
  210. package/dist/workflow/commands.js.map +1 -0
  211. package/dist/workflow/core.d.ts +15 -0
  212. package/dist/workflow/core.js +16 -0
  213. package/dist/workflow/core.js.map +1 -0
  214. package/dist/workflow/index.d.ts +2 -0
  215. package/dist/workflow/index.js +3 -0
  216. package/dist/workflow/index.js.map +1 -0
  217. package/dist/workflow/stack.d.ts +11 -0
  218. package/dist/workflow/stack.js +40 -0
  219. package/dist/workflow/stack.js.map +1 -0
  220. package/dist/workflow/templates.d.ts +17 -0
  221. package/dist/workflow/templates.js +223 -0
  222. package/dist/workflow/templates.js.map +1 -0
  223. package/dist/workflow/types.d.ts +27 -0
  224. package/dist/workflow/types.js +2 -0
  225. package/dist/workflow/types.js.map +1 -0
  226. package/package.json +77 -0
  227. package/schemas/artifacts.index.json +1211 -0
  228. package/schemas/knowledge.index.json +49 -0
  229. package/schemas/prompt-modules.index.json +105 -0
  230. package/schemas/roles.index.json +431 -0
  231. package/schemas/scenarios.index.json +15 -0
  232. package/schemas/skills.index.json +670 -0
  233. package/schemas/workflows.index.json +462 -0
@@ -0,0 +1,136 @@
1
+ import { isAllowedOp } from "./simpleOps.js";
2
+ function str(v) {
3
+ return typeof v === "string" ? v : "";
4
+ }
5
+ /** Detect a cycle in the directed node graph (DFS three-colour). */
6
+ function findCycle(nodes, edges) {
7
+ const adj = new Map();
8
+ for (const n of nodes)
9
+ adj.set(n.id, []);
10
+ for (const e of edges) {
11
+ const list = adj.get(e.source);
12
+ if (list && adj.has(e.target))
13
+ list.push(e.target);
14
+ }
15
+ const state = new Map(); // 0=unseen 1=in-stack 2=done
16
+ const visit = (id) => {
17
+ state.set(id, 1);
18
+ for (const next of adj.get(id) ?? []) {
19
+ const s = state.get(next) ?? 0;
20
+ if (s === 1)
21
+ return true;
22
+ if (s === 0 && visit(next))
23
+ return true;
24
+ }
25
+ state.set(id, 2);
26
+ return false;
27
+ };
28
+ for (const n of nodes) {
29
+ if ((state.get(n.id) ?? 0) === 0 && visit(n.id))
30
+ return true;
31
+ }
32
+ return false;
33
+ }
34
+ export function validateApp(app) {
35
+ const errors = [];
36
+ const push = (path, message) => {
37
+ errors.push({ path, message });
38
+ };
39
+ if (!str(app.name).trim())
40
+ push("name", "An app name is required.");
41
+ // Guard the top-level shape before iterating it. The input is untrusted JSON,
42
+ // so a missing/mis-typed array must become a clear validation error — never a
43
+ // raw `undefined.forEach` crash from the very function meant to catch it.
44
+ const nodes = Array.isArray(app.nodes) ? app.nodes : [];
45
+ const variables = Array.isArray(app.variables) ? app.variables : [];
46
+ const edges = Array.isArray(app.edges) ? app.edges : [];
47
+ const mcp = Array.isArray(app.settings?.mcp) ? app.settings.mcp : [];
48
+ if (!Array.isArray(app.nodes))
49
+ push("nodes", "An app needs a `nodes` array.");
50
+ if (!Array.isArray(app.variables))
51
+ push("variables", "An app needs a `variables` array.");
52
+ if (!Array.isArray(app.edges))
53
+ push("edges", "An app needs an `edges` array.");
54
+ if (!app.settings || !Array.isArray(app.settings.mcp))
55
+ push("settings.mcp", "An app needs `settings.mcp` — the array of declared tools (use `[]` if none).");
56
+ // unique node ids
57
+ const ids = new Set();
58
+ nodes.forEach((n, i) => {
59
+ if (!str(n.id))
60
+ push(`nodes[${i}].id`, "A node id is required.");
61
+ else if (ids.has(n.id))
62
+ push(`nodes[${i}].id`, `Duplicate node id '${n.id}'.`);
63
+ ids.add(n.id);
64
+ });
65
+ // unique variable keys
66
+ const varKeys = new Set();
67
+ variables.forEach((v, i) => {
68
+ if (varKeys.has(v.key))
69
+ push(`variables[${i}].key`, `Duplicate variable '${v.key}'.`);
70
+ varKeys.add(v.key);
71
+ });
72
+ // edges reference existing nodes
73
+ edges.forEach((e, i) => {
74
+ if (!ids.has(e.source))
75
+ push(`edges[${i}].source`, `Edge source '${e.source}' is not a node.`);
76
+ if (!ids.has(e.target))
77
+ push(`edges[${i}].target`, `Edge target '${e.target}' is not a node.`);
78
+ });
79
+ // per-node-type rules
80
+ const declared = new Set(mcp.map((m) => `${m.serverId}::${m.toolName}`));
81
+ nodes.forEach((n, i) => {
82
+ if (n.type === "transform") {
83
+ const op = str(n.data.op);
84
+ if (!op)
85
+ push(`nodes[${i}].data.op`, "A transform node needs an `op`.");
86
+ else if (!isAllowedOp(op))
87
+ push(`nodes[${i}].data.op`, `Operation not permitted on-device: '${op}'. Use an mcpTool node.`);
88
+ }
89
+ if (n.type === "mcpTool") {
90
+ const serverId = str(n.data.serverId);
91
+ const toolName = str(n.data.toolName);
92
+ if (!serverId || !toolName)
93
+ push(`nodes[${i}].data`, "An mcpTool node needs `serverId` and `toolName`.");
94
+ else if (!declared.has(`${serverId}::${toolName}`))
95
+ push(`nodes[${i}].data`, `mcpTool '${serverId}/${toolName}' is not in settings.mcp (declare it to allow the call).`);
96
+ }
97
+ });
98
+ if (nodes.length && findCycle(nodes, edges))
99
+ push("edges", "The graph has a cycle; a no-code app must be acyclic.");
100
+ return { valid: errors.length === 0, errors };
101
+ }
102
+ /**
103
+ * Soft warnings that don't make an app invalid but usually signal a mistake — the
104
+ * core stays permissive (a variable can be seeded at run time) while still helping
105
+ * surface the common slip: a transform/condition whose `in` names a variable no
106
+ * step produces (a typo or a missing upstream step). Template ops read variables
107
+ * from their text, not `in`, so they're skipped. Pure; same shape as errors.
108
+ */
109
+ export function appWarnings(app) {
110
+ const nodes = Array.isArray(app.nodes) ? app.nodes : [];
111
+ const produced = new Set();
112
+ for (const n of nodes) {
113
+ if (n.type === "input") {
114
+ const k = str(n.data.variable) || str(n.data.key);
115
+ if (k)
116
+ produced.add(k);
117
+ }
118
+ const out = str(n.data.out);
119
+ if (out)
120
+ produced.add(out);
121
+ }
122
+ const warnings = [];
123
+ nodes.forEach((n, i) => {
124
+ if (n.type !== "transform" && n.type !== "condition")
125
+ return;
126
+ if (str(n.data.op) === "template")
127
+ return;
128
+ const inKeys = Array.isArray(n.data.in) ? n.data.in.map(str) : [];
129
+ for (const k of inKeys) {
130
+ if (k && !produced.has(k))
131
+ warnings.push({ path: `nodes[${i}].data.in`, message: `Uses “${k}”, which no step produces — add a step that sets it, or check the spelling.` });
132
+ }
133
+ });
134
+ return warnings;
135
+ }
136
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/nocode/validate.ts"],"names":[],"mappings":"AAQA,OAA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CAAC,CAAC;QACzB,CAAC;QACD,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,GAAG;YAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAU,EAAE,CAAC,EAAE,EAAE;QAC9B,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW;YAAE,OAAO;QAC7D,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,UAAU;YAAE,OAAO;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC,IAAI,CAAC,EAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;gBAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,CAAC,6EAA6E,EAAE,CAAC,CAAC;QAC9K,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Node-only: compile a parameter set's JSON Schema into a TypeScript interface.
3
+ * Kept out of `core.ts` because it lazily imports `json-schema-to-typescript`.
4
+ * Shared by the CLI's `params types` and `sdk/scripts/gen-artifacts.ts` so the
5
+ * compile options live in exactly one place.
6
+ */
7
+ import type { JsonSchema } from "./types.js";
8
+ export declare function schemaToInterface(schema: JsonSchema | object, typeName: string): Promise<string>;
@@ -0,0 +1,12 @@
1
+ export async function schemaToInterface(schema, typeName) {
2
+ let compile;
3
+ try {
4
+ ({ compile } = await import("json-schema-to-typescript"));
5
+ }
6
+ catch {
7
+ throw new Error("TypeScript generation needs `json-schema-to-typescript` (npm i -D json-schema-to-typescript).");
8
+ }
9
+ const ts = await compile(schema, typeName, { bannerComment: "", additionalProperties: false });
10
+ return ts.trim();
11
+ }
12
+ //# sourceMappingURL=codegen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.js","sourceRoot":"","sources":["../../src/params/codegen.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAA2B,EAAE,QAAgB;IACnF,IAAI,OAAgE,CAAC;IACrE,IAAI,CAAC;QACH,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,+FAA+F,CAAC,CAAC;IACnH,CAAC;IACD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,MAAgB,EAAE,QAAQ,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;IACzG,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type JsonSchema, type ParamSet } from "./types.js";
2
+ /** PascalCase a slug for use as a TypeScript interface name. */
3
+ export declare function pascalCase(s: string): string;
4
+ /** A parameter set → canonical JSON Schema (the saved, standards-compliant form). */
5
+ export declare function fieldsToSchema(set: ParamSet): JsonSchema;
6
+ /** Canonical JSON Schema → parameter set (the `--from` importer). Rejects out-of-subset features. */
7
+ export declare function schemaToFields(schema: unknown): ParamSet;
@@ -0,0 +1,123 @@
1
+ import { ParamError } from "./types.js";
2
+ import { FIELD_TYPES } from "./fieldTypes.js";
3
+ const JSON_SCHEMA_URI = "https://json-schema.org/draft/2020-12/schema";
4
+ /** PascalCase a slug for use as a TypeScript interface name. */
5
+ export function pascalCase(s) {
6
+ return s
7
+ .split(/[^a-zA-Z0-9]+/)
8
+ .filter(Boolean)
9
+ .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
10
+ .join("");
11
+ }
12
+ /** A parameter set → canonical JSON Schema (the saved, standards-compliant form). */
13
+ export function fieldsToSchema(set) {
14
+ const properties = {};
15
+ const required = [];
16
+ for (const f of [...set.fields].sort((a, b) => a.key.localeCompare(b.key))) {
17
+ const prop = { ...FIELD_TYPES[f.type].prop(f) };
18
+ if (f.label)
19
+ prop.title = f.label;
20
+ if (f.description)
21
+ prop.description = f.description;
22
+ if (prop.type === "string" && !prop.enum && !prop.format) {
23
+ if (f.minLength != null)
24
+ prop.minLength = f.minLength;
25
+ if (f.maxLength != null)
26
+ prop.maxLength = f.maxLength;
27
+ }
28
+ if (prop.type === "number" || prop.type === "integer") {
29
+ if (f.min != null)
30
+ prop.minimum = f.min;
31
+ if (f.max != null)
32
+ prop.maximum = f.max;
33
+ }
34
+ properties[f.key] = prop;
35
+ if (f.required)
36
+ required.push(f.key);
37
+ }
38
+ const schema = {
39
+ $schema: JSON_SCHEMA_URI,
40
+ type: "object",
41
+ title: set.title,
42
+ additionalProperties: false,
43
+ properties,
44
+ };
45
+ if (set.description)
46
+ schema.description = set.description;
47
+ if (required.length)
48
+ schema.required = required.sort();
49
+ schema["x-cotrackpro"] = { dataSensitivity: set.dataSensitivity };
50
+ return schema;
51
+ }
52
+ const UNSUPPORTED = ["$ref", "allOf", "anyOf", "oneOf", "not", "if", "then", "else", "patternProperties", "dependentSchemas"];
53
+ /** Canonical JSON Schema → parameter set (the `--from` importer). Rejects out-of-subset features. */
54
+ export function schemaToFields(schema) {
55
+ const s = schema;
56
+ if (!s || s.type !== "object" || typeof s.properties !== "object" || s.properties == null) {
57
+ throw new ParamError("Schema must be an object schema with a `properties` map.");
58
+ }
59
+ for (const bad of UNSUPPORTED) {
60
+ if (bad in s)
61
+ throw new ParamError(`Unsupported JSON Schema feature: \`${bad}\`. Use a flat object schema.`);
62
+ }
63
+ const requiredList = Array.isArray(s.required) ? s.required : [];
64
+ const fields = [];
65
+ for (const [key, raw] of Object.entries(s.properties)) {
66
+ fields.push(propToField(key, raw, requiredList.includes(key)));
67
+ }
68
+ const meta = s["x-cotrackpro"] ?? {};
69
+ return {
70
+ title: typeof s.title === "string" ? s.title : "Untitled parameter set",
71
+ description: typeof s.description === "string" ? s.description : undefined,
72
+ dataSensitivity: meta.dataSensitivity ?? "sensitive",
73
+ fields,
74
+ };
75
+ }
76
+ function propToField(key, p, required) {
77
+ // The schema is untrusted input (a hand-written or exported `--from` file). A
78
+ // property whose value isn't a schema object must fail with a clear message —
79
+ // not a raw "Cannot read properties of null (reading 'title')" TypeError.
80
+ if (!p || typeof p !== "object" || Array.isArray(p)) {
81
+ const got = p === null ? "null" : Array.isArray(p) ? "an array" : `a ${typeof p}`;
82
+ throw new ParamError(`Field '${key}' must be a schema object (got ${got}).`);
83
+ }
84
+ const field = { key, label: p.title ?? key, type: inferType(key, p), required };
85
+ if (p.description)
86
+ field.description = p.description;
87
+ if (p.enum)
88
+ field.options = p.enum;
89
+ if (p.items?.enum)
90
+ field.options = p.items.enum;
91
+ if (p.minimum != null)
92
+ field.min = p.minimum;
93
+ if (p.maximum != null)
94
+ field.max = p.maximum;
95
+ if (p.minLength != null)
96
+ field.minLength = p.minLength;
97
+ if (p.maxLength != null)
98
+ field.maxLength = p.maxLength;
99
+ return field;
100
+ }
101
+ function inferType(key, p) {
102
+ switch (p.type) {
103
+ case "boolean":
104
+ return "boolean";
105
+ case "number":
106
+ return "number";
107
+ case "integer":
108
+ return "integer";
109
+ case "array":
110
+ return p.items?.enum ? "multiselect" : "list";
111
+ case "string":
112
+ if (p.format === "date")
113
+ return "date";
114
+ if (p.format === "time")
115
+ return "time";
116
+ if (p.enum)
117
+ return "select";
118
+ return "text";
119
+ default:
120
+ throw new ParamError(`Field '${key}' has an unsupported type '${String(p.type)}'.`);
121
+ }
122
+ }
123
+ //# sourceMappingURL=convert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/params/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoF,MAAM,YAAY,CAAC;AAC1H,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,eAAe,GAAG,8CAA8C,CAAC;AAEvE,gEAAgE;AAChE,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,OAAO,CAAC;SACL,KAAK,CAAC,eAAe,CAAC;SACtB,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,cAAc,CAAC,GAAa;IAC1C,MAAM,UAAU,GAA+B,EAAE,CAAC;IAClD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC3E,MAAM,IAAI,GAAe,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,IAAI,CAAC,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;QAClC,IAAI,CAAC,CAAC,WAAW;YAAE,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC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,GAAG,CAAC,CAAC,OAAO,CAAC;IAC7C,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI;QAAE,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC;IAC7C,IAAI,CAAC,CAAC,SAAS,IAAI,IAAI;QAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;IACvD,IAAI,CAAC,CAAC,SAAS,IAAI,IAAI;QAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;IACvD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,SAAS,CAAC,GAAW,EAAE,CAAa;IAC3C,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;QAChD,KAAK,QAAQ;YACX,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM;gBAAE,OAAO,MAAM,CAAC;YACvC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM;gBAAE,OAAO,MAAM,CAAC;YACvC,IAAI,CAAC,CAAC,IAAI;gBAAE,OAAO,QAAQ,CAAC;YAC5B,OAAO,MAAM,CAAC;QAChB;YACE,MAAM,IAAI,UAAU,CAAC,UAAU,GAAG,8BAA8B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxF,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Browser-safe barrel: everything in `params/` EXCEPT the Node-only codegen.
3
+ * Import-free by construction, so the compiled output loads directly in the
4
+ * portal builder. Keep it that way (an SDK test enforces no external imports).
5
+ */
6
+ export * from "./types.js";
7
+ export * from "./fieldTypes.js";
8
+ export * from "./convert.js";
9
+ export * from "./validate.js";
10
+ export * from "./render.js";
11
+ export * from "./prompt.js";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Browser-safe barrel: everything in `params/` EXCEPT the Node-only codegen.
3
+ * Import-free by construction, so the compiled output loads directly in the
4
+ * portal builder. Keep it that way (an SDK test enforces no external imports).
5
+ */
6
+ export * from "./types.js";
7
+ export * from "./fieldTypes.js";
8
+ export * from "./convert.js";
9
+ export * from "./validate.js";
10
+ export * from "./render.js";
11
+ export * from "./prompt.js";
12
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/params/core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { FieldType, ParamField, SchemaProp } from "./types.js";
2
+ /** Input widget the portal builder renders for a field type. */
3
+ export type Widget = "text" | "textarea" | "number" | "checkbox" | "date" | "time" | "select" | "multiselect" | "taglist";
4
+ export interface FieldTypeDef {
5
+ /** Display name in the builder. */
6
+ label: string;
7
+ /** Widget hint for the portal form. */
8
+ widget: Widget;
9
+ /** Whether this type needs an `options` list (select/multiselect). */
10
+ hasOptions: boolean;
11
+ /** The type-specific JSON Schema fragment (title/description/constraints added by convert). */
12
+ prop(field: ParamField): SchemaProp;
13
+ }
14
+ /**
15
+ * The single source of truth that drives the converter, both validators, the
16
+ * markdown renderer, and the portal's widget rendering — so they cannot drift.
17
+ */
18
+ export declare const FIELD_TYPES: Record<FieldType, FieldTypeDef>;
19
+ export interface FieldTypeMeta {
20
+ type: FieldType;
21
+ label: string;
22
+ widget: Widget;
23
+ hasOptions: boolean;
24
+ }
25
+ /** Serializable view of FIELD_TYPES for the portal (functions stripped). */
26
+ export declare const FIELD_TYPE_LIST: FieldTypeMeta[];
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The single source of truth that drives the converter, both validators, the
3
+ * markdown renderer, and the portal's widget rendering — so they cannot drift.
4
+ */
5
+ export const FIELD_TYPES = {
6
+ text: { label: "Short text", widget: "text", hasOptions: false, prop: () => ({ type: "string" }) },
7
+ longtext: { label: "Long text", widget: "textarea", hasOptions: false, prop: () => ({ type: "string" }) },
8
+ number: { label: "Number", widget: "number", hasOptions: false, prop: () => ({ type: "number" }) },
9
+ integer: { label: "Whole number", widget: "number", hasOptions: false, prop: () => ({ type: "integer" }) },
10
+ boolean: { label: "Yes / no", widget: "checkbox", hasOptions: false, prop: () => ({ type: "boolean" }) },
11
+ date: { label: "Date", widget: "date", hasOptions: false, prop: () => ({ type: "string", format: "date" }) },
12
+ time: { label: "Time", widget: "time", hasOptions: false, prop: () => ({ type: "string", format: "time" }) },
13
+ select: { label: "Choose one", widget: "select", hasOptions: true, prop: (f) => ({ type: "string", enum: f.options ?? [] }) },
14
+ multiselect: {
15
+ label: "Choose many",
16
+ widget: "multiselect",
17
+ hasOptions: true,
18
+ prop: (f) => ({ type: "array", items: { type: "string", enum: f.options ?? [] } }),
19
+ },
20
+ list: { label: "List of text", widget: "taglist", hasOptions: false, prop: () => ({ type: "array", items: { type: "string" } }) },
21
+ };
22
+ /** Serializable view of FIELD_TYPES for the portal (functions stripped). */
23
+ export const FIELD_TYPE_LIST = Object.keys(FIELD_TYPES).map((t) => ({
24
+ type: t,
25
+ label: FIELD_TYPES[t].label,
26
+ widget: FIELD_TYPES[t].widget,
27
+ hasOptions: FIELD_TYPES[t].hasOptions,
28
+ }));
29
+ //# sourceMappingURL=fieldTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldTypes.js","sourceRoot":"","sources":["../../src/params/fieldTypes.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAoC;IAC1D,I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";
3
+ export { schemaToInterface } from "./codegen.js";
@@ -0,0 +1,4 @@
1
+ /** Full params surface: the browser-safe core plus the Node-only codegen helper. */
2
+ export * from "./core.js";
3
+ export { schemaToInterface } from "./codegen.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/params/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Turn a parameter set (a form) into a plain-English prompt to paste into any AI assistant. */
2
+ import type { ParamSet } from "./types.js";
3
+ /** A ready-to-paste prompt asking an assistant to improve the form you're building. */
4
+ export declare function toPrompt(set: ParamSet): string;
@@ -0,0 +1,16 @@
1
+ /** A ready-to-paste prompt asking an assistant to improve the form you're building. */
2
+ export function toPrompt(set) {
3
+ const fields = set.fields.length
4
+ ? set.fields.map((f) => `- ${f.label}${f.required ? " (required)" : ""} — a ${f.type}`).join("\n")
5
+ : "- (no fields yet)";
6
+ return [
7
+ `I'm building a form called "${set.title}" to collect this information:`,
8
+ "",
9
+ fields,
10
+ "",
11
+ "Please help me improve it: what important fields am I missing for this kind of record, how should each field be worded so it's clear and neutral, and what should I be careful about when collecting this?",
12
+ "",
13
+ "Keep it educational and informational only — not legal or clinical advice. This may hold sensitive family information, so flag anything I should keep private. Use court-neutral, child-centered language.",
14
+ ].join("\n");
15
+ }
16
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/params/prompt.ts"],"names":[],"mappings":"AAGA,uFAAuF;AACvF,MAAM,UAAU,QAAQ,CAAC,GAAa;IACpC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM;QAC9B,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAClG,CAAC,CAAC,mBAAmB,CAAC;IACxB,OAAO;QACL,+BAA+B,GAAG,CAAC,KAAK,gCAAgC;QACxE,EAAE;QACF,MAAM;QACN,EAAE;QACF,4MAA4M;QAC5M,EAAE;QACF,4MAA4M;KAC7M,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ParamSet } from "./types.js";
2
+ /** The platform safety line reprinted on every filled document. */
3
+ export declare const SAFETY_LINE: string;
4
+ /** Render a parameter set + (optional) values as a filled markdown document. */
5
+ export declare function renderMarkdown(set: ParamSet, values?: Record<string, unknown>): string;
@@ -0,0 +1,25 @@
1
+ /** The platform safety line reprinted on every filled document. */
2
+ export const SAFETY_LINE = "Educational and informational only — not legal or clinical advice. " +
3
+ "Do not place confidential family information in shared or public locations.";
4
+ /** Render a parameter set + (optional) values as a filled markdown document. */
5
+ export function renderMarkdown(set, values = {}) {
6
+ const lines = [`# ${set.title}`, ""];
7
+ if (set.description) {
8
+ lines.push(set.description, "");
9
+ }
10
+ lines.push(`> Sensitivity: **${set.dataSensitivity}**. ${SAFETY_LINE}`, "");
11
+ for (const f of set.fields) {
12
+ lines.push(`**${f.label || f.key}**`, "", formatValue(f, values[f.key]), "");
13
+ }
14
+ return lines.join("\n");
15
+ }
16
+ function formatValue(f, v) {
17
+ if (v === undefined || v === null || v === "" || (Array.isArray(v) && v.length === 0))
18
+ return "_(not provided)_";
19
+ if (typeof v === "boolean")
20
+ return v ? "Yes" : "No";
21
+ if (Array.isArray(v))
22
+ return v.map((x) => `- ${String(x)}`).join("\n");
23
+ return String(v);
24
+ }
25
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {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C,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Custom parameter-set types. A "parameter" is a typed field; a "parameter set"
3
+ * is a named collection of them, persisted as a standards-compliant JSON Schema.
4
+ *
5
+ * This file and its siblings in `params/` (except `codegen.ts`) MUST stay
6
+ * import-free (no `node:` or external deps) so the compiled output loads directly
7
+ * in the browser — the portal builder and the CLI share this exact logic.
8
+ */
9
+ export type DataSensitivity = "public" | "sensitive" | "confidential";
10
+ export type FieldType = "text" | "longtext" | "number" | "integer" | "boolean" | "date" | "time" | "select" | "multiselect" | "list";
11
+ /** A single user-authored parameter (one field of a form/schema). */
12
+ export interface ParamField {
13
+ /** Property name — a valid identifier (letter, then letters/digits/underscore). */
14
+ key: string;
15
+ /** Human-friendly label (becomes the schema property `title`). */
16
+ label: string;
17
+ type: FieldType;
18
+ required?: boolean;
19
+ description?: string;
20
+ /** Allowed values for `select` / `multiselect`. */
21
+ options?: string[];
22
+ /** Numeric bounds for `number` / `integer`. */
23
+ min?: number;
24
+ max?: number;
25
+ /** Length bounds for `text` / `longtext`. */
26
+ minLength?: number;
27
+ maxLength?: number;
28
+ }
29
+ /** A named, typed set of parameters. */
30
+ export interface ParamSet {
31
+ title: string;
32
+ description?: string;
33
+ dataSensitivity: DataSensitivity;
34
+ fields: ParamField[];
35
+ }
36
+ /** The supported JSON Schema (Draft 2020-12) subset for a single property. */
37
+ export interface SchemaProp {
38
+ type?: "string" | "number" | "integer" | "boolean" | "array";
39
+ title?: string;
40
+ description?: string;
41
+ format?: "date" | "time";
42
+ enum?: string[];
43
+ items?: {
44
+ type: "string";
45
+ enum?: string[];
46
+ };
47
+ minimum?: number;
48
+ maximum?: number;
49
+ minLength?: number;
50
+ maxLength?: number;
51
+ }
52
+ /** The canonical object schema a parameter set serializes to. */
53
+ export interface JsonSchema {
54
+ $schema?: string;
55
+ type: "object";
56
+ title?: string;
57
+ description?: string;
58
+ additionalProperties: false;
59
+ properties: Record<string, SchemaProp>;
60
+ required?: string[];
61
+ "x-cotrackpro"?: {
62
+ dataSensitivity: DataSensitivity;
63
+ };
64
+ }
65
+ export interface ValidationError {
66
+ path: string;
67
+ message: string;
68
+ }
69
+ export interface ValidationResult {
70
+ valid: boolean;
71
+ errors: ValidationError[];
72
+ }
73
+ /** Thrown when a schema uses features outside the supported subset. */
74
+ export declare class ParamError extends Error {
75
+ constructor(message: string);
76
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Custom parameter-set types. A "parameter" is a typed field; a "parameter set"
3
+ * is a named collection of them, persisted as a standards-compliant JSON Schema.
4
+ *
5
+ * This file and its siblings in `params/` (except `codegen.ts`) MUST stay
6
+ * import-free (no `node:` or external deps) so the compiled output loads directly
7
+ * in the browser — the portal builder and the CLI share this exact logic.
8
+ */
9
+ /** Thrown when a schema uses features outside the supported subset. */
10
+ export class ParamError extends Error {
11
+ constructor(message) {
12
+ super(message);
13
+ this.name = "ParamError";
14
+ }
15
+ }
16
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/params/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+EH,uEAAuE;AACvE,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import type { ParamSet, ValidationResult } from "./types.js";
2
+ /** Validate a parameter-set DEFINITION (the schema the user authored). */
3
+ export declare function validateParamSet(def: ParamSet): ValidationResult;
4
+ /** Validate VALUES entered for a parameter set against its field types. */
5
+ export declare function validateValues(set: ParamSet, values: Record<string, unknown>): ValidationResult;