@tacitai/mcp-server 0.9.2 → 0.9.3
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/tools/career.d.ts +3 -3
- package/dist/tools/career.js +119 -8
- package/dist/tools/exec-route.js +11 -0
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.js +4 -3
- package/package.json +1 -1
package/dist/tools/career.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Career tools — MV-1543 W2: Career executive MCP tools.
|
|
2
|
+
* Career tools — MV-1543 W2 + FEAT-275 W2: Career executive MCP tools.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 16 tools:
|
|
5
5
|
* READ: tacit_career_list_campaigns, tacit_career_search_status,
|
|
6
6
|
* tacit_career_list_jobs, tacit_career_get_job,
|
|
7
7
|
* tacit_career_list_materials, tacit_career_generate_status
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* tacit_career_search_jobs, tacit_career_add_job,
|
|
10
10
|
* tacit_career_update_job, tacit_career_move_job,
|
|
11
11
|
* tacit_career_attach_material, tacit_career_detach_material,
|
|
12
|
-
* tacit_career_generate_material
|
|
12
|
+
* tacit_career_generate_material, tacit_career_save_material
|
|
13
13
|
*
|
|
14
14
|
* SEC-4: WRITE tools check FEATURE_CAREER_EXEC at the MCP layer (double gate
|
|
15
15
|
* with backend). READ tools (list/get/status) are ungated so users can still
|
package/dist/tools/career.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Career tools — MV-1543 W2: Career executive MCP tools.
|
|
2
|
+
* Career tools — MV-1543 W2 + FEAT-275 W2: Career executive MCP tools.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 16 tools:
|
|
5
5
|
* READ: tacit_career_list_campaigns, tacit_career_search_status,
|
|
6
6
|
* tacit_career_list_jobs, tacit_career_get_job,
|
|
7
7
|
* tacit_career_list_materials, tacit_career_generate_status
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* tacit_career_search_jobs, tacit_career_add_job,
|
|
10
10
|
* tacit_career_update_job, tacit_career_move_job,
|
|
11
11
|
* tacit_career_attach_material, tacit_career_detach_material,
|
|
12
|
-
* tacit_career_generate_material
|
|
12
|
+
* tacit_career_generate_material, tacit_career_save_material
|
|
13
13
|
*
|
|
14
14
|
* SEC-4: WRITE tools check FEATURE_CAREER_EXEC at the MCP layer (double gate
|
|
15
15
|
* with backend). READ tools (list/get/status) are ungated so users can still
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { z } from 'zod';
|
|
19
19
|
import dns from 'node:dns/promises';
|
|
20
|
+
import crypto from 'node:crypto';
|
|
20
21
|
import { TacitApiError, TokenExpiredError } from '../client.js';
|
|
21
22
|
import { apiErrorText, featureDisabledResult } from './errors.js';
|
|
22
23
|
function flagGuard() {
|
|
@@ -166,6 +167,7 @@ const updateJobSchema = z.object({
|
|
|
166
167
|
salary_currency: z.string().optional().describe('Salary currency code (e.g. "CAD", "USD")'),
|
|
167
168
|
employment_type: z.string().optional().describe('Updated employment type'),
|
|
168
169
|
notes: z.string().optional().describe('Personal notes about the job'),
|
|
170
|
+
full_posting_text: z.string().optional().describe('Full job posting text for material generation'),
|
|
169
171
|
});
|
|
170
172
|
const moveJobSchema = z.object({
|
|
171
173
|
ids: z.array(z.string().uuid()).min(1).describe('Job artifact UUIDs to move'),
|
|
@@ -195,6 +197,12 @@ const generateStatusSchema = z.object({
|
|
|
195
197
|
run_id: z.string().uuid().describe('Agent run UUID from generate_material'),
|
|
196
198
|
include_receipt: z.boolean().optional().describe('Include the full run receipt with claims manifest'),
|
|
197
199
|
});
|
|
200
|
+
const saveMaterialSchema = z.object({
|
|
201
|
+
artifact_id: z.string().uuid().describe('Material artifact UUID to save back to'),
|
|
202
|
+
content: z.string().min(1).optional().describe('HTML content to save. Provide exactly one of content or file_path.'),
|
|
203
|
+
file_path: z.string().min(1).optional().describe('Local HTML file to read and save (stdio transport only). Provide exactly one of content or file_path.'),
|
|
204
|
+
base_sha256: z.string().min(64).max(64).describe('SHA-256 hash of the content when it was pulled — drift detection'),
|
|
205
|
+
});
|
|
198
206
|
// ─── Registration ──────────────────────────────────────────────────────────
|
|
199
207
|
export function registerCareerTools(server, getClientFn) {
|
|
200
208
|
// ── 1. tacit_career_list_campaigns ─────────────────────────────────────
|
|
@@ -314,19 +322,27 @@ export function registerCareerTools(server, getClientFn) {
|
|
|
314
322
|
try {
|
|
315
323
|
const client = await getClientFn();
|
|
316
324
|
const { artifact_id } = args;
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
const job = jobs.find((j) => j['artifact_id'] === artifact_id) ?? jobs[0];
|
|
320
|
-
if (!job) {
|
|
325
|
+
const job = await client.get(`/api/v1/artifacts/editor/${artifact_id}`);
|
|
326
|
+
if (!job || !job['artifact_id']) {
|
|
321
327
|
return { content: [{ type: 'text', text: `Job artifact ${artifact_id} not found.` }], isError: true };
|
|
322
328
|
}
|
|
329
|
+
if (String(job['artifact_id']) !== artifact_id) {
|
|
330
|
+
return { content: [{ type: 'text', text: `Job artifact ${artifact_id} not found (id mismatch).` }], isError: true };
|
|
331
|
+
}
|
|
323
332
|
const portfolioId = job['portfolio_id'];
|
|
324
333
|
let materials = [];
|
|
325
334
|
if (portfolioId) {
|
|
326
|
-
|
|
335
|
+
const matResult = await client.get(`/api/v1/portfolios/${portfolioId}/artifacts`, {
|
|
327
336
|
type: 'career_material',
|
|
328
337
|
job_artifact_id: artifact_id,
|
|
329
338
|
});
|
|
339
|
+
const matList = (matResult?.['artifacts'] ?? []);
|
|
340
|
+
materials = {
|
|
341
|
+
artifacts: matList.filter((m) => {
|
|
342
|
+
const meta = (m['structured_metadata'] ?? {});
|
|
343
|
+
return meta['job_artifact_id'] === artifact_id;
|
|
344
|
+
}),
|
|
345
|
+
};
|
|
330
346
|
}
|
|
331
347
|
const metadata = (job['structured_metadata'] ?? {});
|
|
332
348
|
return ok({
|
|
@@ -379,6 +395,8 @@ export function registerCareerTools(server, getClientFn) {
|
|
|
379
395
|
metadata['responsibilities'] = input.responsibilities;
|
|
380
396
|
if (input.notes)
|
|
381
397
|
metadata['notes'] = input.notes;
|
|
398
|
+
if (input.text)
|
|
399
|
+
metadata['full_posting_text'] = input.text;
|
|
382
400
|
const body = {
|
|
383
401
|
title: input.job_title,
|
|
384
402
|
domain: 'CAREER',
|
|
@@ -440,6 +458,8 @@ export function registerCareerTools(server, getClientFn) {
|
|
|
440
458
|
metaFields['employment_type'] = input.employment_type;
|
|
441
459
|
if (input.notes !== undefined)
|
|
442
460
|
metaFields['notes'] = input.notes;
|
|
461
|
+
if (input.full_posting_text !== undefined)
|
|
462
|
+
metaFields['full_posting_text'] = input.full_posting_text;
|
|
443
463
|
if (Object.keys(metaFields).length > 0) {
|
|
444
464
|
const metaRes = await client.patch(`/api/v1/artifacts/${input.artifact_id}/metadata`, { metadata_updates: metaFields });
|
|
445
465
|
results.push({ metadata_update: metaRes });
|
|
@@ -583,4 +603,95 @@ export function registerCareerTools(server, getClientFn) {
|
|
|
583
603
|
return apiErrorResult(err, 'tacit_career_generate_status');
|
|
584
604
|
}
|
|
585
605
|
});
|
|
606
|
+
// ── 16. tacit_career_save_material (FEAT-275 W2) ──────────────────────
|
|
607
|
+
server.tool('tacit_career_save_material', 'Save locally edited career material (resume or cover letter) back to TACIT. Enforces DRAFT-only, workspace match, script stripping, and drift detection. The material keeps its artifact_id and is never published by this tool.', saveMaterialSchema.shape, async (args) => {
|
|
608
|
+
const blocked = flagGuard();
|
|
609
|
+
if (blocked)
|
|
610
|
+
return blocked;
|
|
611
|
+
try {
|
|
612
|
+
const client = await getClientFn();
|
|
613
|
+
const input = args;
|
|
614
|
+
const hasContent = input.content !== undefined;
|
|
615
|
+
const hasFile = input.file_path !== undefined;
|
|
616
|
+
if (hasContent === hasFile) {
|
|
617
|
+
return { content: [{ type: 'text', text: 'Invalid input: provide exactly one of content or file_path' }], isError: true };
|
|
618
|
+
}
|
|
619
|
+
let body;
|
|
620
|
+
if (hasFile) {
|
|
621
|
+
if (process.env['MCP_TRANSPORT'] === 'http') {
|
|
622
|
+
return { content: [{ type: 'text', text: 'file_path is only available on the stdio transport; send content instead' }], isError: true };
|
|
623
|
+
}
|
|
624
|
+
const { readGmIngestFile } = await import('./gm.js');
|
|
625
|
+
const read = readGmIngestFile(input.file_path);
|
|
626
|
+
if (!read.ok) {
|
|
627
|
+
return { content: [{ type: 'text', text: `File read error: ${read.reason}` }], isError: true };
|
|
628
|
+
}
|
|
629
|
+
body = read.content;
|
|
630
|
+
}
|
|
631
|
+
else {
|
|
632
|
+
body = input.content;
|
|
633
|
+
}
|
|
634
|
+
// Script check: reject content with <script> or inline event handlers
|
|
635
|
+
if (/<script[\s>]/i.test(body)) {
|
|
636
|
+
return { content: [{ type: 'text', text: 'Refused: content contains <script> elements. Strip scripts before saving.' }], isError: true };
|
|
637
|
+
}
|
|
638
|
+
if (/\bon(click|load|error|mouseover|mouseout|focus|blur|submit|change|input|keydown|keyup)\s*=/i.test(body)) {
|
|
639
|
+
return { content: [{ type: 'text', text: 'Refused: content contains inline event-handler attributes. Strip them before saving.' }], isError: true };
|
|
640
|
+
}
|
|
641
|
+
// Fetch current artifact state
|
|
642
|
+
const artifact = await client.get(`/api/v1/artifacts/editor/${input.artifact_id}`);
|
|
643
|
+
if (!artifact || !artifact['artifact_id']) {
|
|
644
|
+
return { content: [{ type: 'text', text: `Material ${input.artifact_id} not found` }], isError: true };
|
|
645
|
+
}
|
|
646
|
+
// DRAFT-only check (DB stores uppercase status values)
|
|
647
|
+
const status = artifact['status'];
|
|
648
|
+
if (status && status.toUpperCase() !== 'DRAFT') {
|
|
649
|
+
return {
|
|
650
|
+
content: [{ type: 'text', text: `Material is ${status}, not DRAFT. Only DRAFT materials can be saved back.` }],
|
|
651
|
+
isError: true,
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
// Drift detection: compare current content sha256 with base_sha256
|
|
655
|
+
const currentContent = artifact['content'];
|
|
656
|
+
if (currentContent) {
|
|
657
|
+
const currentHash = crypto.createHash('sha256').update(currentContent, 'utf8').digest('hex');
|
|
658
|
+
if (currentHash !== input.base_sha256) {
|
|
659
|
+
return {
|
|
660
|
+
content: [{
|
|
661
|
+
type: 'text',
|
|
662
|
+
text: `Drift detected: TACIT content has changed since you pulled it (expected sha256 ${input.base_sha256.slice(0, 12)}…, got ${currentHash.slice(0, 12)}…). Re-pull before saving to avoid overwriting changes.`,
|
|
663
|
+
}],
|
|
664
|
+
isError: true,
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
// Write content back
|
|
669
|
+
const contentHash = crypto.createHash('sha256').update(body, 'utf8').digest('hex');
|
|
670
|
+
await client.put(`/api/v1/artifacts/editor/${input.artifact_id}`, { content: body });
|
|
671
|
+
// Set save-back metadata
|
|
672
|
+
const metadata = {
|
|
673
|
+
edited_after_generation: 'true',
|
|
674
|
+
edited_at: new Date().toISOString(),
|
|
675
|
+
local_edit_sha256: contentHash,
|
|
676
|
+
};
|
|
677
|
+
await client.patch(`/api/v1/artifacts/${input.artifact_id}/metadata`, { metadata_updates: metadata });
|
|
678
|
+
// Verify by re-fetching
|
|
679
|
+
const updated = await client.get(`/api/v1/artifacts/editor/${input.artifact_id}`);
|
|
680
|
+
const verifyContent = updated['content'];
|
|
681
|
+
const verifyHash = verifyContent
|
|
682
|
+
? crypto.createHash('sha256').update(verifyContent, 'utf8').digest('hex')
|
|
683
|
+
: 'N/A';
|
|
684
|
+
return ok({
|
|
685
|
+
artifact_id: input.artifact_id,
|
|
686
|
+
saved: true,
|
|
687
|
+
content_sha256: contentHash,
|
|
688
|
+
verified: verifyHash === contentHash,
|
|
689
|
+
updated_at: updated['updated_at'],
|
|
690
|
+
metadata_set: Object.keys(metadata),
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
catch (err) {
|
|
694
|
+
return apiErrorResult(err, 'tacit_career_save_material');
|
|
695
|
+
}
|
|
696
|
+
});
|
|
586
697
|
}
|
package/dist/tools/exec-route.js
CHANGED
|
@@ -323,6 +323,17 @@ function buildScript(role, workflowType = role.workflow_type, workspaceId) {
|
|
|
323
323
|
steps.push('Check tacit_workflow_prereqs if a tool returns a workflow block — it shows required prior steps.');
|
|
324
324
|
return steps;
|
|
325
325
|
}
|
|
326
|
+
if (role.workflow_type === 'coo_operations') {
|
|
327
|
+
steps.push('1. Call tacit_pyramid_list_portfolios to get the portfolio structure and artifact counts.');
|
|
328
|
+
steps.push('2. Call tacit_pyramid_list_programs to get all programs with status, and tacit_pyramid_list_dossiers for overdue or at-risk deliverables.');
|
|
329
|
+
steps.push('3. Call tacit_agent_list to get the configured agent roster and health status.');
|
|
330
|
+
steps.push('4. Call tacit_lake_list_sources to get data source status (active, inactive, errors).');
|
|
331
|
+
steps.push('5. Call tacit_kb_freshness to check for stale KB articles, and tacit_lake_list_proposals for pending placement proposals.');
|
|
332
|
+
steps.push('6. Call tacit_chronicle_search with a 21-day window to get recent activity, decisions, and open items.');
|
|
333
|
+
steps.push('7. Synthesize all of the above into a structured operational status report. Flag: programs with no movement >7 days, proposals pending >48 hours, stale KB articles, inactive sources.');
|
|
334
|
+
steps.push('Present the report as a designed HTML artifact.');
|
|
335
|
+
return steps;
|
|
336
|
+
}
|
|
326
337
|
steps.push(`Call tacit_agent_delegate with role_slug="${role.slug}" and your task description.`);
|
|
327
338
|
steps.push('The delegation returns agent_id and run_id. Use tacit_agent_status with both to check progress and retrieve results.');
|
|
328
339
|
if (role.workflow_type === 'gm_content_placement') {
|
package/dist/tools/registry.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Compile-time tool classification. Governs which tools may be called over HTTPS.
|
|
3
|
-
* Partition: 6 stdio_only + 26 admin_only + 2 gate_only +
|
|
3
|
+
* Partition: 6 stdio_only + 26 admin_only + 2 gate_only + 182 https = 216.
|
|
4
4
|
*/
|
|
5
5
|
export type ToolTransport = 'https' | 'stdio_only' | 'admin_only' | 'gate_only';
|
|
6
6
|
export type ToolClass = 'read' | 'write' | 'admin' | 'dispatch';
|
package/dist/tools/registry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Compile-time tool classification. Governs which tools may be called over HTTPS.
|
|
3
|
-
* Partition: 6 stdio_only + 26 admin_only + 2 gate_only +
|
|
3
|
+
* Partition: 6 stdio_only + 26 admin_only + 2 gate_only + 182 https = 216.
|
|
4
4
|
*/
|
|
5
5
|
const STDIO_ONLY = [
|
|
6
6
|
'tacit_ingest_file',
|
|
@@ -228,6 +228,7 @@ const WRITE_TOOLS = [
|
|
|
228
228
|
'tacit_career_generate_material',
|
|
229
229
|
'tacit_career_attach_material',
|
|
230
230
|
'tacit_career_detach_material',
|
|
231
|
+
'tacit_career_save_material',
|
|
231
232
|
'tacit_career_seed_pyramid',
|
|
232
233
|
'tacit_removal_propose',
|
|
233
234
|
'tacit_removal_approve',
|
|
@@ -259,8 +260,8 @@ function build() {
|
|
|
259
260
|
if (!exclusive.has(n))
|
|
260
261
|
add(n, classOf(n), 'https', false);
|
|
261
262
|
}
|
|
262
|
-
if (map.size !==
|
|
263
|
-
throw new Error(`tool registry expected
|
|
263
|
+
if (map.size !== 216)
|
|
264
|
+
throw new Error(`tool registry expected 216 tools, got ${map.size}`);
|
|
264
265
|
return map;
|
|
265
266
|
}
|
|
266
267
|
export const TOOL_REGISTRY = build();
|