@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.
- package/dist/client.d.ts +10 -0
- package/dist/client.js +71 -0
- package/dist/flags.d.ts +11 -0
- package/dist/flags.js +33 -0
- package/dist/index.js +75 -4
- package/dist/prompts.d.ts +55 -0
- package/dist/prompts.js +26 -0
- package/dist/templates/role-loader.d.ts +9 -0
- package/dist/templates/role-loader.js +93 -0
- package/dist/tools/agents.d.ts +27 -4
- package/dist/tools/agents.js +110 -10
- package/dist/tools/cmo.d.ts +14 -0
- package/dist/tools/cmo.js +125 -0
- package/dist/tools/errors.js +4 -2
- package/dist/tools/outbox.d.ts +2 -2
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.js +14 -3
- package/dist/tools/workflow-prereqs.d.ts +16 -0
- package/dist/tools/workflow-prereqs.js +29 -0
- package/dist/tools/workflow-types.d.ts +11 -0
- package/dist/tools/workflow-types.js +179 -0
- package/dist/tools/workflow.d.ts +9 -0
- package/dist/tools/workflow.js +134 -0
- package/dist/workflow-gate.d.ts +173 -78
- package/dist/workflow-gate.js +741 -156
- package/dist/workflow-persistence.d.ts +25 -0
- package/dist/workflow-persistence.js +127 -0
- package/dist/workflow-registry.d.ts +80 -0
- package/dist/workflow-registry.js +375 -0
- package/dist/workflow-type-schema.d.ts +11 -0
- package/dist/workflow-type-schema.js +92 -0
- package/package.json +2 -1
package/dist/client.d.ts
CHANGED
|
@@ -112,4 +112,14 @@ export declare class TokenExpiredError extends Error {
|
|
|
112
112
|
/** HTTPS mode: bind the caller's token/apiUrl/principal to everything run inside fn. */
|
|
113
113
|
export declare function runWithRequestContext<T>(token: string, apiUrl: string, fn: () => Promise<T>, principal?: string): Promise<T>;
|
|
114
114
|
export declare function getRequestPrincipal(): string | null;
|
|
115
|
+
export type AutonomyLevel = 'GUEST' | 'SCRIBE' | 'MENTAT' | 'TWIN';
|
|
116
|
+
export declare function parseAutonomyLevel(raw: unknown): AutonomyLevel;
|
|
117
|
+
export declare function autonomyAtLeast(current: AutonomyLevel, required: AutonomyLevel): boolean;
|
|
118
|
+
export declare function getRequestAutonomy(principal: string): Promise<AutonomyLevel | {
|
|
119
|
+
error: 'token_expired';
|
|
120
|
+
}>;
|
|
121
|
+
export declare function ensureAutonomy(principal: string): Promise<AutonomyLevel | {
|
|
122
|
+
error: 'token_expired';
|
|
123
|
+
}>;
|
|
124
|
+
export declare function getCachedAutonomy(principal: string): AutonomyLevel | null;
|
|
115
125
|
export declare function getClient(): TacitClient;
|
package/dist/client.js
CHANGED
|
@@ -434,6 +434,77 @@ export function runWithRequestContext(token, apiUrl, fn, principal) {
|
|
|
434
434
|
export function getRequestPrincipal() {
|
|
435
435
|
return requestStore.getStore()?.principal ?? null;
|
|
436
436
|
}
|
|
437
|
+
const AUTONOMY_ORDINAL = { GUEST: 0, SCRIBE: 1, MENTAT: 2, TWIN: 3 };
|
|
438
|
+
export function parseAutonomyLevel(raw) {
|
|
439
|
+
if (typeof raw !== 'string' || !raw)
|
|
440
|
+
return 'SCRIBE';
|
|
441
|
+
const upper = raw.toUpperCase();
|
|
442
|
+
if (upper === 'OWNER')
|
|
443
|
+
return 'TWIN';
|
|
444
|
+
if (upper === 'GUEST' || upper === 'SCRIBE' || upper === 'MENTAT' || upper === 'TWIN')
|
|
445
|
+
return upper;
|
|
446
|
+
return 'SCRIBE';
|
|
447
|
+
}
|
|
448
|
+
export function autonomyAtLeast(current, required) {
|
|
449
|
+
return AUTONOMY_ORDINAL[current] >= AUTONOMY_ORDINAL[required];
|
|
450
|
+
}
|
|
451
|
+
const autonomyCache = new Map();
|
|
452
|
+
function envFallbackAutonomy() {
|
|
453
|
+
return parseAutonomyLevel(process.env['TACIT_AUTONOMY_LEVEL']);
|
|
454
|
+
}
|
|
455
|
+
export async function getRequestAutonomy(principal) {
|
|
456
|
+
const cached = autonomyCache.get(principal);
|
|
457
|
+
if (cached)
|
|
458
|
+
return cached;
|
|
459
|
+
const token = process.env['TACIT_TOKEN'] ?? '';
|
|
460
|
+
if (!token) {
|
|
461
|
+
const level = envFallbackAutonomy();
|
|
462
|
+
autonomyCache.set(principal, level);
|
|
463
|
+
return level;
|
|
464
|
+
}
|
|
465
|
+
const apiUrl = (process.env['TACIT_API_URL'] ?? 'http://localhost:7473').replace(/\/$/, '');
|
|
466
|
+
try {
|
|
467
|
+
const resp = await globalThis.fetch(`${apiUrl}/api/v1/people/myself`, {
|
|
468
|
+
headers: { Authorization: `Bearer ${token}`, Accept: 'application/json' },
|
|
469
|
+
signal: AbortSignal.timeout(5000),
|
|
470
|
+
});
|
|
471
|
+
if (resp.status === 401) {
|
|
472
|
+
return { error: 'token_expired' };
|
|
473
|
+
}
|
|
474
|
+
if (resp.status === 403) {
|
|
475
|
+
const body = await resp.text().catch(() => '');
|
|
476
|
+
if (body.includes('people.read')) {
|
|
477
|
+
autonomyCache.set(principal, 'GUEST');
|
|
478
|
+
return 'GUEST';
|
|
479
|
+
}
|
|
480
|
+
const level = envFallbackAutonomy();
|
|
481
|
+
autonomyCache.set(principal, level);
|
|
482
|
+
return level;
|
|
483
|
+
}
|
|
484
|
+
if (resp.status === 404) {
|
|
485
|
+
const level = envFallbackAutonomy();
|
|
486
|
+
autonomyCache.set(principal, level);
|
|
487
|
+
return level;
|
|
488
|
+
}
|
|
489
|
+
if (!resp.ok) {
|
|
490
|
+
const level = envFallbackAutonomy();
|
|
491
|
+
return level; // don't cache non-2xx
|
|
492
|
+
}
|
|
493
|
+
const data = (await resp.json());
|
|
494
|
+
const level = parseAutonomyLevel(data['autonomy_level']);
|
|
495
|
+
autonomyCache.set(principal, level);
|
|
496
|
+
return level;
|
|
497
|
+
}
|
|
498
|
+
catch {
|
|
499
|
+
return envFallbackAutonomy(); // network error — don't cache
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
export async function ensureAutonomy(principal) {
|
|
503
|
+
return getRequestAutonomy(principal);
|
|
504
|
+
}
|
|
505
|
+
export function getCachedAutonomy(principal) {
|
|
506
|
+
return autonomyCache.get(principal) ?? null;
|
|
507
|
+
}
|
|
437
508
|
/** Shared singleton client (initialized lazily on first use). */
|
|
438
509
|
let _defaultClient = null;
|
|
439
510
|
export function getClient() {
|
package/dist/flags.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature flag resolution for workflow types (MV-1539 W2 Step 6).
|
|
3
|
+
*
|
|
4
|
+
* Each workflow type maps to a feature flag env var. Flag OFF blocks
|
|
5
|
+
* creation (startWorkflow returns type_not_active) but does NOT block
|
|
6
|
+
* lifecycle operations on existing instances (flag gates creation, not
|
|
7
|
+
* lifecycle — persisted instances whose flag is now OFF are completable).
|
|
8
|
+
*/
|
|
9
|
+
export declare function isWorkflowTypeActive(typeName: string): boolean;
|
|
10
|
+
export declare function getWorkflowTypeFlag(typeName: string): string | undefined;
|
|
11
|
+
export declare function isUserWorkflowTypesActive(): boolean;
|
package/dist/flags.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature flag resolution for workflow types (MV-1539 W2 Step 6).
|
|
3
|
+
*
|
|
4
|
+
* Each workflow type maps to a feature flag env var. Flag OFF blocks
|
|
5
|
+
* creation (startWorkflow returns type_not_active) but does NOT block
|
|
6
|
+
* lifecycle operations on existing instances (flag gates creation, not
|
|
7
|
+
* lifecycle — persisted instances whose flag is now OFF are completable).
|
|
8
|
+
*/
|
|
9
|
+
const WORKFLOW_TYPE_FLAGS = {
|
|
10
|
+
cos_coordination: 'FEATURE_WORKFLOW_COS',
|
|
11
|
+
pyr_exec: 'FEATURE_WORKFLOW_PYR_EXEC',
|
|
12
|
+
coo_operations: 'FEATURE_WORKFLOW_COO',
|
|
13
|
+
cmo_marketing_pipeline: 'FEATURE_WORKFLOW_CMO',
|
|
14
|
+
sales_full_pipeline: 'FEATURE_WORKFLOW_SALES',
|
|
15
|
+
research_exec: 'FEATURE_WORKFLOW_RESEARCH',
|
|
16
|
+
wiki_authoring: 'FEATURE_WORKFLOW_WIKI',
|
|
17
|
+
kb_management: 'FEATURE_WORKFLOW_KB',
|
|
18
|
+
lake_operations: 'FEATURE_WORKFLOW_LAKE',
|
|
19
|
+
};
|
|
20
|
+
export function isWorkflowTypeActive(typeName) {
|
|
21
|
+
const envVar = WORKFLOW_TYPE_FLAGS[typeName];
|
|
22
|
+
if (!envVar)
|
|
23
|
+
return true; // GM and unknown types are always active
|
|
24
|
+
const val = process.env[envVar];
|
|
25
|
+
return val === 'true' || val === '1';
|
|
26
|
+
}
|
|
27
|
+
export function getWorkflowTypeFlag(typeName) {
|
|
28
|
+
return WORKFLOW_TYPE_FLAGS[typeName];
|
|
29
|
+
}
|
|
30
|
+
export function isUserWorkflowTypesActive() {
|
|
31
|
+
const val = process.env['FEATURE_WORKFLOW_USER_TYPES'];
|
|
32
|
+
return val === 'true' || val === '1';
|
|
33
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -60,15 +60,77 @@ import { registerSkillTools } from './tools/skills.js';
|
|
|
60
60
|
import { registerWikiTools } from './tools/wiki.js';
|
|
61
61
|
import { registerVoiceTools } from './tools/voice.js';
|
|
62
62
|
import { registerOnboardingTools } from './tools/onboarding.js';
|
|
63
|
+
import { registerWorkflowTools } from './tools/workflow.js';
|
|
64
|
+
import { registerWorkflowTypeTools } from './tools/workflow-types.js';
|
|
65
|
+
import { registerWorkflowPrereqsTool } from './tools/workflow-prereqs.js';
|
|
66
|
+
import { registerCmoTools } from './tools/cmo.js';
|
|
63
67
|
import { registerPrompts } from './prompts.js';
|
|
64
|
-
import { getRequestPrincipal } from './client.js';
|
|
68
|
+
import { getRequestPrincipal, ensureAutonomy } from './client.js';
|
|
65
69
|
// Setup wizard (MV-1057h / W5)
|
|
66
70
|
import { setup, profileToEnvVar } from './setup.js';
|
|
67
71
|
import { WorkflowGate } from './workflow-gate.js';
|
|
68
|
-
|
|
72
|
+
import { WorkflowPersistence } from './workflow-persistence.js';
|
|
73
|
+
import { createDefaultRegistry } from './workflow-registry.js';
|
|
74
|
+
// FEAT-249 / MV-1539: one WorkflowGate per server process — workflow state keyed
|
|
69
75
|
// by request principal (stdio shares the single '__stdio__' slot). Never store gate
|
|
70
76
|
// state inside the per-request AsyncLocalStorage context; see workflow-gate.ts.
|
|
71
|
-
const gate = new WorkflowGate(
|
|
77
|
+
const gate = new WorkflowGate({
|
|
78
|
+
registry: createDefaultRegistry(),
|
|
79
|
+
persistence: new WorkflowPersistence(async () => getModuleClient()),
|
|
80
|
+
onEvent: async (event) => {
|
|
81
|
+
try {
|
|
82
|
+
const client = await getModuleClient();
|
|
83
|
+
await client.request('POST', '/api/v1/events', {
|
|
84
|
+
event_type: event.eventType,
|
|
85
|
+
raw_payload: JSON.stringify(event),
|
|
86
|
+
title: `${event.eventType} [${event.typeName}] ${event.instanceId.slice(0, 8)}`,
|
|
87
|
+
metadata: event.metadata,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
process.stderr.write(`[workflow-chronicle] event emit failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
// MV-1539 W1 Step 3: preCall hook — wraps every tool handler to record calls centrally.
|
|
96
|
+
const PRECALL_EXEMPT = new Set(['tacit_cmo_lint']);
|
|
97
|
+
function installPreCallHook(server) {
|
|
98
|
+
const originalTool = server.tool.bind(server);
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
server.tool = function (...registerArgs) {
|
|
101
|
+
const toolName = registerArgs[0];
|
|
102
|
+
if (PRECALL_EXEMPT.has(toolName)) {
|
|
103
|
+
return originalTool(...registerArgs);
|
|
104
|
+
}
|
|
105
|
+
const handlerIdx = registerArgs.length - 1;
|
|
106
|
+
const originalHandler = registerArgs[handlerIdx];
|
|
107
|
+
registerArgs[handlerIdx] = async (...callArgs) => {
|
|
108
|
+
const principal = getRequestPrincipal();
|
|
109
|
+
const principalKey = principal ?? '__stdio__';
|
|
110
|
+
const autonomyResult = await ensureAutonomy(principalKey);
|
|
111
|
+
if (typeof autonomyResult === 'object' && 'error' in autonomyResult) {
|
|
112
|
+
return { content: [{ type: 'text', text: JSON.stringify(autonomyResult) }], isError: true };
|
|
113
|
+
}
|
|
114
|
+
const autonomyBlock = gate.checkToolAutonomy(principal, toolName);
|
|
115
|
+
if (autonomyBlock) {
|
|
116
|
+
return { content: [{ type: 'text', text: JSON.stringify(autonomyBlock) }], isError: true };
|
|
117
|
+
}
|
|
118
|
+
gate.recordCallForAll(principal, toolName);
|
|
119
|
+
const block = gate.checkToolBlock(principal, toolName);
|
|
120
|
+
if (block) {
|
|
121
|
+
return { content: [{ type: 'text', text: JSON.stringify(block) }], isError: true };
|
|
122
|
+
}
|
|
123
|
+
if (!gate.routeToolCall(principal, toolName)) {
|
|
124
|
+
const coldBlock = gate.checkColdToolBlock(toolName);
|
|
125
|
+
if (coldBlock) {
|
|
126
|
+
return { content: [{ type: 'text', text: JSON.stringify(coldBlock) }], isError: true };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return originalHandler(...callArgs);
|
|
130
|
+
};
|
|
131
|
+
return originalTool(...registerArgs);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
72
134
|
// ─── ESM __dirname replacement ───────────────────────────────────────────────
|
|
73
135
|
const __filename = fileURLToPath(import.meta.url);
|
|
74
136
|
const __dirname = path.dirname(__filename);
|
|
@@ -145,7 +207,10 @@ async function run() {
|
|
|
145
207
|
}
|
|
146
208
|
checkProfileExpiry(profile);
|
|
147
209
|
checkCompatibility();
|
|
148
|
-
const server = new McpServer({ name: '@tacitai/mcp-server', version: '0.3.0' }, {
|
|
210
|
+
const server = new McpServer({ name: '@tacitai/mcp-server', version: '0.3.0' }, {
|
|
211
|
+
capabilities: { tools: {}, prompts: {} },
|
|
212
|
+
instructions: 'This MCP server manages a workspace executive team with workflow-enforced operations. Use tacit_agent_list to see the team. Use tacit_workflow_prereqs to discover prerequisite chains before calling gated tools. Workflows enforce ordered phases — complete prerequisites before attempting write operations.',
|
|
213
|
+
});
|
|
149
214
|
const isHttpMode = process.env['MCP_TRANSPORT'] === 'http';
|
|
150
215
|
let clientInstance = null;
|
|
151
216
|
const getClient = async () => {
|
|
@@ -159,6 +224,8 @@ async function run() {
|
|
|
159
224
|
}
|
|
160
225
|
return clientInstance;
|
|
161
226
|
};
|
|
227
|
+
// MV-1539: install preCall hook before tool registration
|
|
228
|
+
installPreCallHook(server);
|
|
162
229
|
// Register all tool modules
|
|
163
230
|
registerSearchTools(server, getClient);
|
|
164
231
|
registerSynthesizeTools(server, getClient);
|
|
@@ -190,6 +257,10 @@ async function run() {
|
|
|
190
257
|
registerWikiTools(server, getClient);
|
|
191
258
|
registerVoiceTools(server, getClient);
|
|
192
259
|
registerOnboardingTools(server, getClient);
|
|
260
|
+
registerWorkflowTools(server, gate);
|
|
261
|
+
registerWorkflowTypeTools(server, getClient, gate.getRegistry());
|
|
262
|
+
registerWorkflowPrereqsTool(server, gate.getRegistry());
|
|
263
|
+
registerCmoTools(server);
|
|
193
264
|
registerPrompts(server, getClient);
|
|
194
265
|
if (process.env['MCP_TRANSPORT'] === 'http') {
|
|
195
266
|
await startHttpTransport(server);
|
package/dist/prompts.d.ts
CHANGED
|
@@ -58,6 +58,61 @@ export declare const GM_WORKFLOW: {
|
|
|
58
58
|
readonly signal: "User sees a clear, plain-language confirmation.";
|
|
59
59
|
}];
|
|
60
60
|
};
|
|
61
|
+
export declare const COS_SUB_WORKFLOWS: readonly [{
|
|
62
|
+
readonly id: "delegate_gm";
|
|
63
|
+
readonly target: "gm_content_placement";
|
|
64
|
+
readonly trigger: "Content ingestion, placement, or filing requests";
|
|
65
|
+
}, {
|
|
66
|
+
readonly id: "delegate_coo";
|
|
67
|
+
readonly target: "coo_operations";
|
|
68
|
+
readonly trigger: "Operational tasks, team coordination, process execution";
|
|
69
|
+
}, {
|
|
70
|
+
readonly id: "delegate_research";
|
|
71
|
+
readonly target: "research_exec";
|
|
72
|
+
readonly trigger: "Research requests, SOTA surveys, evidence gathering";
|
|
73
|
+
}, {
|
|
74
|
+
readonly id: "delegate_cmo";
|
|
75
|
+
readonly target: "cmo_marketing_pipeline";
|
|
76
|
+
readonly trigger: "Marketing content production, brand compliance";
|
|
77
|
+
}];
|
|
78
|
+
export declare const COO_SUB_WORKFLOWS: readonly [{
|
|
79
|
+
readonly id: "delegate_sales";
|
|
80
|
+
readonly target: "sales_full_pipeline";
|
|
81
|
+
readonly trigger: "Sales pipeline, proposals, discovery, quotes";
|
|
82
|
+
}, {
|
|
83
|
+
readonly id: "delegate_gm";
|
|
84
|
+
readonly target: "gm_content_placement";
|
|
85
|
+
readonly trigger: "Content placement via GM workflow";
|
|
86
|
+
}, {
|
|
87
|
+
readonly id: "delegate_pyr";
|
|
88
|
+
readonly target: "pyr_exec";
|
|
89
|
+
readonly trigger: "Pyramid structure operations (portfolio, program, dossier management)";
|
|
90
|
+
}, {
|
|
91
|
+
readonly id: "delegate_research";
|
|
92
|
+
readonly target: "research_exec";
|
|
93
|
+
readonly trigger: "Research dispatch for operational decisions";
|
|
94
|
+
}, {
|
|
95
|
+
readonly id: "delegate_cmo";
|
|
96
|
+
readonly target: "cmo_marketing_pipeline";
|
|
97
|
+
readonly trigger: "Marketing content requests from operations";
|
|
98
|
+
}];
|
|
99
|
+
export declare const PYR_EXEC_SUB_WORKFLOWS: readonly [{
|
|
100
|
+
readonly id: "list_portfolios";
|
|
101
|
+
readonly tool: "tacit_pyramid_list_portfolios";
|
|
102
|
+
readonly trigger: "Show all portfolios";
|
|
103
|
+
}, {
|
|
104
|
+
readonly id: "list_value_streams";
|
|
105
|
+
readonly tool: "tacit_pyramid_list_value_streams";
|
|
106
|
+
readonly trigger: "Show value streams";
|
|
107
|
+
}, {
|
|
108
|
+
readonly id: "list_programs";
|
|
109
|
+
readonly tool: "tacit_pyramid_list_programs";
|
|
110
|
+
readonly trigger: "Show programs under a portfolio";
|
|
111
|
+
}, {
|
|
112
|
+
readonly id: "list_dossiers";
|
|
113
|
+
readonly tool: "tacit_pyramid_list_dossiers";
|
|
114
|
+
readonly trigger: "Show dossiers under a program";
|
|
115
|
+
}];
|
|
61
116
|
export declare const EXPERIENCES: readonly [{
|
|
62
117
|
readonly id: "explore_workspace";
|
|
63
118
|
readonly num: 1;
|
package/dist/prompts.js
CHANGED
|
@@ -63,6 +63,12 @@ function buildAssistantSystemPrompt(state) {
|
|
|
63
63
|
lines.push('');
|
|
64
64
|
lines.push('During onboarding experiences, minimize what you ask from the user. Each experience should require at most one short sentence from the user — you do the heavy lifting. Never ask the user to provide details, pick topics, or name entities before you start working. Use what is already in the workspace, make reasonable defaults, and let the user correct you if needed. The goal is delight through effortless demonstration, not a task list.');
|
|
65
65
|
lines.push('');
|
|
66
|
+
lines.push('## Workflow enforcement');
|
|
67
|
+
lines.push('');
|
|
68
|
+
lines.push('- Some tools are gated by phased workflows: required tools must be called, in order, before gated tools succeed. A rejection lists the prerequisite chain, what is completed, and the next step — follow it rather than retrying.');
|
|
69
|
+
lines.push('- Before calling a write or dispatch tool you have not used, call `tacit_workflow_prereqs` with its name to see the prerequisite chain.');
|
|
70
|
+
lines.push('- Call `tacit_agent_list` to see the executive team and address them by name.');
|
|
71
|
+
lines.push('');
|
|
66
72
|
lines.push('## Safety');
|
|
67
73
|
lines.push('');
|
|
68
74
|
lines.push('- Never modify or delete content without explicit approval.');
|
|
@@ -190,6 +196,26 @@ export const GM_WORKFLOW = {
|
|
|
190
196
|
},
|
|
191
197
|
],
|
|
192
198
|
};
|
|
199
|
+
// ─── Sub-Workflow Guidance Constants (MV-1539 W2) ────────────────────────────
|
|
200
|
+
export const COS_SUB_WORKFLOWS = [
|
|
201
|
+
{ id: 'delegate_gm', target: 'gm_content_placement', trigger: 'Content ingestion, placement, or filing requests' },
|
|
202
|
+
{ id: 'delegate_coo', target: 'coo_operations', trigger: 'Operational tasks, team coordination, process execution' },
|
|
203
|
+
{ id: 'delegate_research', target: 'research_exec', trigger: 'Research requests, SOTA surveys, evidence gathering' },
|
|
204
|
+
{ id: 'delegate_cmo', target: 'cmo_marketing_pipeline', trigger: 'Marketing content production, brand compliance' },
|
|
205
|
+
];
|
|
206
|
+
export const COO_SUB_WORKFLOWS = [
|
|
207
|
+
{ id: 'delegate_sales', target: 'sales_full_pipeline', trigger: 'Sales pipeline, proposals, discovery, quotes' },
|
|
208
|
+
{ id: 'delegate_gm', target: 'gm_content_placement', trigger: 'Content placement via GM workflow' },
|
|
209
|
+
{ id: 'delegate_pyr', target: 'pyr_exec', trigger: 'Pyramid structure operations (portfolio, program, dossier management)' },
|
|
210
|
+
{ id: 'delegate_research', target: 'research_exec', trigger: 'Research dispatch for operational decisions' },
|
|
211
|
+
{ id: 'delegate_cmo', target: 'cmo_marketing_pipeline', trigger: 'Marketing content requests from operations' },
|
|
212
|
+
];
|
|
213
|
+
export const PYR_EXEC_SUB_WORKFLOWS = [
|
|
214
|
+
{ id: 'list_portfolios', tool: 'tacit_pyramid_list_portfolios', trigger: 'Show all portfolios' },
|
|
215
|
+
{ id: 'list_value_streams', tool: 'tacit_pyramid_list_value_streams', trigger: 'Show value streams' },
|
|
216
|
+
{ id: 'list_programs', tool: 'tacit_pyramid_list_programs', trigger: 'Show programs under a portfolio' },
|
|
217
|
+
{ id: 'list_dossiers', tool: 'tacit_pyramid_list_dossiers', trigger: 'Show dossiers under a program' },
|
|
218
|
+
];
|
|
193
219
|
export const EXPERIENCES = [
|
|
194
220
|
{ id: 'explore_workspace', num: 1, name: 'Explore Your Workspace', tier: 1, tierName: 'Orient & Equip', action: 'Type: "What is in my workspace?" — see what knowledge, collections, and structure are already here.', signal: 'You can describe what is in your workspace', tip: '' },
|
|
195
221
|
{ id: 'see_capabilities', num: 2, name: 'See What\'s Possible', tier: 1, tierName: 'Orient & Equip', action: 'Type: "What can TACIT do for me?" — discover the full range of capabilities available to you.', signal: 'You know what TACIT can do and are ready to try it', tip: '' },
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = join(__filename, '..');
|
|
6
|
+
let cachedTemplates = null;
|
|
7
|
+
export function loadRoleTemplates() {
|
|
8
|
+
if (cachedTemplates)
|
|
9
|
+
return cachedTemplates;
|
|
10
|
+
const candidates = [
|
|
11
|
+
join(__dirname, '..', '..', '..', '..', 'config', 'exec-roles.yaml'),
|
|
12
|
+
join(__dirname, '..', '..', 'config', 'exec-roles.yaml'),
|
|
13
|
+
];
|
|
14
|
+
for (const p of candidates) {
|
|
15
|
+
try {
|
|
16
|
+
const raw = readFileSync(p, 'utf-8');
|
|
17
|
+
const parsed = parseYaml(raw);
|
|
18
|
+
if (parsed?.roles && Array.isArray(parsed.roles)) {
|
|
19
|
+
cachedTemplates = parsed.roles;
|
|
20
|
+
return cachedTemplates;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
// try next candidate
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
cachedTemplates = FALLBACK_TEMPLATES;
|
|
28
|
+
return cachedTemplates;
|
|
29
|
+
}
|
|
30
|
+
function parseYaml(raw) {
|
|
31
|
+
// Minimal YAML parser for the flat roles structure; avoids a YAML dependency.
|
|
32
|
+
const roles = [];
|
|
33
|
+
let current = null;
|
|
34
|
+
let arrayField = null;
|
|
35
|
+
for (const line of raw.split('\n')) {
|
|
36
|
+
const trimmed = line.trimEnd();
|
|
37
|
+
if (trimmed.trimStart().startsWith('#') || trimmed === '')
|
|
38
|
+
continue;
|
|
39
|
+
const indent = line.length - line.trimStart().length;
|
|
40
|
+
if (indent === 2 && trimmed.trimStart().startsWith('- slug:')) {
|
|
41
|
+
if (current?.slug)
|
|
42
|
+
roles.push(current);
|
|
43
|
+
current = {
|
|
44
|
+
slug: trimmed.split(':').slice(1).join(':').trim(),
|
|
45
|
+
default_capabilities: [],
|
|
46
|
+
workflow_types: [],
|
|
47
|
+
};
|
|
48
|
+
arrayField = null;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (!current)
|
|
52
|
+
continue;
|
|
53
|
+
if (indent === 4 && trimmed.includes(':') && !trimmed.trimStart().startsWith('-')) {
|
|
54
|
+
arrayField = null;
|
|
55
|
+
const [key, ...rest] = trimmed.split(':');
|
|
56
|
+
const val = rest.join(':').trim();
|
|
57
|
+
const k = key.trim();
|
|
58
|
+
if (k === 'display_name')
|
|
59
|
+
current.display_name = val;
|
|
60
|
+
else if (k === 'description')
|
|
61
|
+
current.description = val;
|
|
62
|
+
else if (k === 'icon')
|
|
63
|
+
current.icon = val;
|
|
64
|
+
else if (k === 'default_capabilities' || k === 'workflow_types') {
|
|
65
|
+
arrayField = k;
|
|
66
|
+
}
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (indent === 6 && trimmed.trimStart().startsWith('- ') && arrayField) {
|
|
70
|
+
const val = trimmed.trimStart().slice(2).trim();
|
|
71
|
+
if (arrayField === 'default_capabilities') {
|
|
72
|
+
(current.default_capabilities ??= []).push(val);
|
|
73
|
+
}
|
|
74
|
+
else if (arrayField === 'workflow_types') {
|
|
75
|
+
(current.workflow_types ??= []).push(val);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (current?.slug)
|
|
80
|
+
roles.push(current);
|
|
81
|
+
return roles.length > 0 ? { roles } : null;
|
|
82
|
+
}
|
|
83
|
+
const FALLBACK_TEMPLATES = [
|
|
84
|
+
{ slug: 'general_manager', display_name: 'General Manager', description: 'Oversees content placement and coordination.', icon: 'briefcase', default_capabilities: ['content_placement', 'artifact_management'], workflow_types: ['gm_content_placement'] },
|
|
85
|
+
{ slug: 'chief_of_staff', display_name: 'Chief of Staff', description: 'Coordinates cross-functional workflows.', icon: 'clipboard', default_capabilities: ['coordination', 'approval_management'], workflow_types: ['cos_coordination'] },
|
|
86
|
+
{ slug: 'pyramid_executor', display_name: 'Pyramid Executor', description: 'Manages strategic pyramid operations.', icon: 'layers', default_capabilities: ['portfolio_management', 'program_management'], workflow_types: ['pyr_exec'] },
|
|
87
|
+
{ slug: 'coo_operator', display_name: 'COO Operator', description: 'Handles operational workflows.', icon: 'settings', default_capabilities: ['operations_management'], workflow_types: ['coo_operations'] },
|
|
88
|
+
{ slug: 'cmo_marketer', display_name: 'CMO Marketer', description: 'Manages marketing pipeline.', icon: 'megaphone', default_capabilities: ['marketing_pipeline'], workflow_types: ['cmo_marketing_pipeline'] },
|
|
89
|
+
{ slug: 'sales_executor', display_name: 'Sales Executor', description: 'Manages sales pipeline.', icon: 'trending_up', default_capabilities: ['pipeline_management'], workflow_types: ['sales_full_pipeline'] },
|
|
90
|
+
{ slug: 'wiki_editor', display_name: 'Wiki Editor', description: 'Authors and maintains wiki content with structured classification and validation workflows.', icon: 'book', default_capabilities: ['wiki_authoring', 'content_classification', 'content_validation'], workflow_types: ['wiki_authoring'] },
|
|
91
|
+
{ slug: 'kb_curator', display_name: 'KB Curator', description: 'Curates knowledge base articles, collections, and source integrations.', icon: 'library', default_capabilities: ['kb_management', 'article_curation', 'source_administration'], workflow_types: ['kb_management'] },
|
|
92
|
+
{ slug: 'lake_operator', display_name: 'Lake Operator', description: 'Manages data lake ingestion, classification, taxonomy, and structure proposals.', icon: 'database', default_capabilities: ['lake_ingestion', 'classification', 'taxonomy_management', 'structure_proposals'], workflow_types: ['lake_operations'] },
|
|
93
|
+
];
|
package/dist/tools/agents.d.ts
CHANGED
|
@@ -51,24 +51,43 @@ export declare function handleAgentList(args: unknown): Promise<{
|
|
|
51
51
|
}>;
|
|
52
52
|
isError?: boolean;
|
|
53
53
|
}>;
|
|
54
|
-
export declare const agentDelegateInputSchema: z.ZodObject<{
|
|
55
|
-
agent_id: z.ZodString
|
|
54
|
+
export declare const agentDelegateInputSchema: z.ZodEffects<z.ZodObject<{
|
|
55
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
56
|
+
role_slug: z.ZodOptional<z.ZodString>;
|
|
56
57
|
task: z.ZodString;
|
|
57
58
|
kind: z.ZodOptional<z.ZodString>;
|
|
58
59
|
target_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
59
60
|
program_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
60
61
|
dossier_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
61
62
|
}, "strip", z.ZodTypeAny, {
|
|
62
|
-
agent_id: string;
|
|
63
63
|
task: string;
|
|
64
64
|
program_ids?: string[] | undefined;
|
|
65
|
+
role_slug?: string | undefined;
|
|
66
|
+
agent_id?: string | undefined;
|
|
65
67
|
kind?: string | undefined;
|
|
66
68
|
target_ids?: string[] | undefined;
|
|
67
69
|
dossier_ids?: string[] | undefined;
|
|
68
70
|
}, {
|
|
69
|
-
agent_id: string;
|
|
70
71
|
task: string;
|
|
71
72
|
program_ids?: string[] | undefined;
|
|
73
|
+
role_slug?: string | undefined;
|
|
74
|
+
agent_id?: string | undefined;
|
|
75
|
+
kind?: string | undefined;
|
|
76
|
+
target_ids?: string[] | undefined;
|
|
77
|
+
dossier_ids?: string[] | undefined;
|
|
78
|
+
}>, {
|
|
79
|
+
task: string;
|
|
80
|
+
program_ids?: string[] | undefined;
|
|
81
|
+
role_slug?: string | undefined;
|
|
82
|
+
agent_id?: string | undefined;
|
|
83
|
+
kind?: string | undefined;
|
|
84
|
+
target_ids?: string[] | undefined;
|
|
85
|
+
dossier_ids?: string[] | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
task: string;
|
|
88
|
+
program_ids?: string[] | undefined;
|
|
89
|
+
role_slug?: string | undefined;
|
|
90
|
+
agent_id?: string | undefined;
|
|
72
91
|
kind?: string | undefined;
|
|
73
92
|
target_ids?: string[] | undefined;
|
|
74
93
|
dossier_ids?: string[] | undefined;
|
|
@@ -84,6 +103,10 @@ export declare const AGENT_DELEGATE_TOOL_DEF: {
|
|
|
84
103
|
type: string;
|
|
85
104
|
description: string;
|
|
86
105
|
};
|
|
106
|
+
role_slug: {
|
|
107
|
+
type: string;
|
|
108
|
+
description: string;
|
|
109
|
+
};
|
|
87
110
|
task: {
|
|
88
111
|
type: string;
|
|
89
112
|
description: string;
|