@tacitai/mcp-server 0.6.28 → 0.6.29

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,92 @@
1
+ /**
2
+ * Hand-written TS validation for user-authored workflow type definitions (MV-1539 W7 Step 29).
3
+ * No ajv dependency — validation is structural checks only.
4
+ */
5
+ export const SYSTEM_RESERVED_TYPE_NAMES = [
6
+ 'gm_content_placement', 'cos_coordination', 'pyr_exec',
7
+ 'coo_operations', 'cmo_marketing_pipeline', 'sales_full_pipeline', 'research_exec',
8
+ 'wiki_authoring', 'kb_management', 'lake_operations',
9
+ ];
10
+ export const SYSTEM_RESERVED_TOOLS = [
11
+ 'tacit_gm_ingest', 'tacit_gm_approve', 'tacit_gm_reset',
12
+ 'tacit_kb_promote_from_artifact', 'tacit_kb_promote_from_catalog',
13
+ 'tacit_cmo_lint', 'tacit_dispatch_crew',
14
+ 'tacit_research_launch', 'tacit_research_prepare', 'tacit_research_place',
15
+ ];
16
+ const TYPE_NAME_PATTERN = /^[a-z][a-z0-9_]{2,63}$/;
17
+ export function validateUserTypeDef(input) {
18
+ const errors = [];
19
+ if (!input || typeof input !== 'object') {
20
+ return { valid: false, errors: ['input must be a non-null object'] };
21
+ }
22
+ const def = input;
23
+ if (typeof def['name'] !== 'string' || !TYPE_NAME_PATTERN.test(def['name'])) {
24
+ errors.push('name must match ^[a-z][a-z0-9_]{2,63}$');
25
+ }
26
+ if (typeof def['name'] === 'string' && SYSTEM_RESERVED_TYPE_NAMES.includes(def['name'])) {
27
+ errors.push(`name '${def['name']}' is reserved for a system workflow type`);
28
+ }
29
+ if (def['failDirection'] !== 'open' && def['failDirection'] !== 'closed') {
30
+ errors.push('failDirection must be "open" or "closed"');
31
+ }
32
+ if (def['sharedToolPolicy'] !== 'passthrough') {
33
+ errors.push('sharedToolPolicy must be "passthrough"');
34
+ }
35
+ const reservedSet = new Set(SYSTEM_RESERVED_TOOLS);
36
+ const reservedHits = [];
37
+ function checkTool(t) {
38
+ if (typeof t === 'string' && reservedSet.has(t))
39
+ reservedHits.push(t);
40
+ }
41
+ if (def['entryTool'] != null)
42
+ checkTool(def['entryTool']);
43
+ const ta = def['terminalAction'];
44
+ if (ta?.['tool'] != null)
45
+ checkTool(ta['tool']);
46
+ const prereqs = def['prereqs'];
47
+ if (!prereqs || (prereqs['kind'] !== 'flat' && prereqs['kind'] !== 'phased')) {
48
+ errors.push('prereqs.kind must be "flat" or "phased"');
49
+ }
50
+ else if (prereqs['kind'] === 'flat') {
51
+ const tools = prereqs['tools'];
52
+ if (!Array.isArray(tools)) {
53
+ errors.push('prereqs.tools must be an array');
54
+ }
55
+ else {
56
+ for (const t of tools)
57
+ checkTool(t);
58
+ }
59
+ }
60
+ else {
61
+ const phases = prereqs['phases'];
62
+ if (!Array.isArray(phases) || phases.length === 0) {
63
+ errors.push('prereqs.phases must be a non-empty array');
64
+ }
65
+ else {
66
+ for (let i = 0; i < phases.length; i++) {
67
+ const p = phases[i];
68
+ if (!p || typeof p['name'] !== 'string' || p['name'] === '') {
69
+ errors.push(`phase[${i}].name must be a non-empty string`);
70
+ }
71
+ if (!Array.isArray(p?.['requiredTools'])) {
72
+ errors.push(`phase[${i}].requiredTools must be an array`);
73
+ }
74
+ else {
75
+ for (const t of p['requiredTools'])
76
+ checkTool(t);
77
+ }
78
+ if (!Array.isArray(p?.['gatedTools'])) {
79
+ errors.push(`phase[${i}].gatedTools must be an array`);
80
+ }
81
+ else {
82
+ for (const t of p['gatedTools'])
83
+ checkTool(t);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ if (reservedHits.length > 0) {
89
+ errors.push(`tools ${JSON.stringify([...new Set(reservedHits)])} are reserved for system workflow types`);
90
+ }
91
+ return { valid: errors.length === 0, errors };
92
+ }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@tacitai/mcp-server",
3
- "version": "0.6.28",
3
+ "version": "0.6.29",
4
+ "private": false,
4
5
  "description": "stdio MCP server wrapping Tacit /api/v1 REST/SSE API",
5
6
  "license": "UNLICENSED",
6
7
  "repository": {