@tacitai/mcp-server 0.6.55 → 0.8.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 (59) hide show
  1. package/dist/api-errors.d.ts +102 -0
  2. package/dist/api-errors.js +165 -0
  3. package/dist/autonomy.d.ts +46 -0
  4. package/dist/autonomy.js +118 -0
  5. package/dist/claude-config.d.ts +139 -0
  6. package/dist/claude-config.js +339 -0
  7. package/dist/cli-launch.d.ts +33 -0
  8. package/dist/cli-launch.js +178 -0
  9. package/dist/cli-login.d.ts +34 -0
  10. package/dist/cli-login.js +200 -0
  11. package/dist/cli-mode.d.ts +47 -0
  12. package/dist/cli-mode.js +170 -0
  13. package/dist/cli-profiles.d.ts +37 -0
  14. package/dist/cli-profiles.js +344 -0
  15. package/dist/cli.d.ts +9 -0
  16. package/dist/cli.js +59 -458
  17. package/dist/client.d.ts +88 -52
  18. package/dist/client.js +195 -295
  19. package/dist/credentials.d.ts +81 -0
  20. package/dist/credentials.js +291 -0
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +37 -89
  23. package/dist/oauth.d.ts +1 -1
  24. package/dist/oauth.js +5 -5
  25. package/dist/profile-store.d.ts +96 -0
  26. package/dist/profile-store.js +382 -0
  27. package/dist/prompt.d.ts +32 -0
  28. package/dist/prompt.js +99 -0
  29. package/dist/prompts.d.ts +2 -2
  30. package/dist/prompts.js +3 -3
  31. package/dist/server-mode.d.ts +65 -0
  32. package/dist/server-mode.js +99 -0
  33. package/dist/setup-migrate.d.ts +35 -0
  34. package/dist/setup-migrate.js +204 -0
  35. package/dist/setup.d.ts +41 -66
  36. package/dist/setup.js +361 -531
  37. package/dist/signin.d.ts +108 -0
  38. package/dist/signin.js +595 -0
  39. package/dist/tools/agents.d.ts +4 -4
  40. package/dist/tools/artifacts.d.ts +2 -0
  41. package/dist/tools/artifacts.js +8 -1
  42. package/dist/tools/career.js +25 -1
  43. package/dist/tools/errors.d.ts +12 -0
  44. package/dist/tools/errors.js +65 -0
  45. package/dist/tools/exec-route.d.ts +34 -0
  46. package/dist/tools/exec-route.js +101 -27
  47. package/dist/tools/iam.js +2 -3
  48. package/dist/tools/secretary.d.ts +1 -0
  49. package/dist/tools/secretary.js +2 -1
  50. package/dist/tools/synthesize.d.ts +37 -0
  51. package/dist/tools/synthesize.js +126 -7
  52. package/dist/tools/voice.d.ts +3 -2
  53. package/dist/tools/voice.js +70 -18
  54. package/dist/tools/workspaces.js +7 -4
  55. package/dist/version.d.ts +6 -0
  56. package/dist/version.js +18 -0
  57. package/dist/workflow-registry.d.ts +1 -0
  58. package/dist/workflow-registry.js +21 -0
  59. package/package.json +4 -1
@@ -8,12 +8,13 @@
8
8
  * GET /profiles/:id/stats — get profile statistics
9
9
  * POST /profiles/:id/samples — upload a voice sample
10
10
  *
11
- * compose_in_voice uses POST /api/v1/mind/synthesize with
12
- * synthesis_mode=crew_compose + voice_mode=voice_on.
11
+ * compose_in_voice (BUG-418):
12
+ * with `content` -> POST /api/v1/voice/profiles/:id/generate (voice rewrite of grounded text)
13
+ * without content -> SSE /api/v1/mind/synthesize/stream, voice_mode=voice_on, voice_applied checked
13
14
  */
14
15
  import { z } from 'zod';
15
- import { apiErrorResult } from './errors.js';
16
- import { buildSynthesizeRequest } from './synthesize.js';
16
+ import { apiErrorResult, error } from './errors.js';
17
+ import { parseSseDone, voiceNotAppliedResult, listVoiceProfiles, requireSoleActiveProfile } from './synthesize.js';
17
18
  export function registerVoiceTools(server, getClientFn) {
18
19
  // ── tacit_voice_list_profiles ──────────────────────────────────────────────
19
20
  server.tool('tacit_voice_list_profiles', 'List your voice profiles with name, active status, sample count, and quality indicators. Use when someone asks about their voice profiles or writing style settings.', {}, async () => {
@@ -71,28 +72,79 @@ export function registerVoiceTools(server, getClientFn) {
71
72
  }
72
73
  });
73
74
  // ── tacit_compose_in_voice ─────────────────────────────────────────────────
74
- server.tool('tacit_compose_in_voice', 'Compose an artifact in your writing voice. Combines crew-based artifact generation with voice personalization in a single call. Use when someone says "write this in my voice" or "compose a brief in my style".', {
75
- query: z.string().min(1).describe('Composition prompt — what to write'),
75
+ server.tool('tacit_compose_in_voice', 'Compose or rewrite text in your writing voice. Put the grounded source text (facts, draft, cover letter) in `content` and it is rewritten in your voice via your active voice profile. Omit `content` only for a KB-grounded draft generated from workspace knowledge. Fails loudly if voice cannot be applied. Use when someone says "write this in my voice" or "rewrite this in my style".', {
76
+ query: z.string().min(1).describe('Composition prompt — what to write (becomes the voice constraint when content is given)'),
77
+ content: z.string().min(1).optional().describe("Grounded source text to rewrite in the user's voice. Omit only for KB-grounded drafts."),
78
+ title: z.string().optional().describe('Title for the voice rewrite (default "Voice rewrite"). Used with content.'),
76
79
  voice_profile_id: z.string().optional().describe('Specific voice profile UUID. Omit to use the active profile.'),
77
80
  workspace_id: z.string().optional().describe('Optional workspace UUID'),
78
- collection_ids: z.array(z.string()).optional().describe('Optional collection UUIDs to scope synthesis to'),
79
- program_ids: z.array(z.string()).optional().describe('Optional program UUIDs to scope synthesis to'),
81
+ collection_ids: z.array(z.string()).optional().describe('Optional collection UUIDs to scope synthesis to (KB-grounded drafts)'),
82
+ program_ids: z.array(z.string()).optional().describe('Optional program UUIDs to scope synthesis to (KB-grounded drafts)'),
80
83
  }, async (args) => {
81
84
  try {
82
85
  const client = await getClientFn();
83
- const input = {
84
- query: args.query,
85
- synthesis_mode: 'crew_compose',
86
- voice_mode: 'voice_on',
87
- voice_profile_id: args.voice_profile_id,
88
- workspace_id: args.workspace_id,
89
- collection_ids: args.collection_ids,
90
- program_ids: args.program_ids,
91
- };
92
- return buildSynthesizeRequest(client, input).execute();
86
+ if (args.content)
87
+ return await composeFromContent(client, args);
88
+ return await composeFromKb(client, args);
93
89
  }
94
90
  catch (err) {
95
91
  return apiErrorResult(err, 'compose_in_voice');
96
92
  }
97
93
  });
98
94
  }
95
+ const NO_ACTIVE_PROFILE = 'No active voice profile exists. A voice profile needs 3+ writing samples (tacit_voice_upload_sample) and must be active before text can be written in your voice.';
96
+ async function composeFromContent(client, args) {
97
+ let id = args.voice_profile_id;
98
+ if (!id) {
99
+ const active = (await listVoiceProfiles(client)).filter((p) => p.voice_active === true);
100
+ if (active.length === 0)
101
+ return error(NO_ACTIVE_PROFILE);
102
+ if (active.length > 1) {
103
+ return error(`More than one voice profile is active (${active.map((p) => p.profile_id).join(', ')}). Pass voice_profile_id to choose one.`);
104
+ }
105
+ id = active[0].profile_id;
106
+ if (!id)
107
+ return error('unexpected /voice/profiles response shape (active profile has no profile_id)');
108
+ }
109
+ try {
110
+ const res = (await client.post(`/api/v1/voice/profiles/${id}/generate`, {
111
+ title: args.title ?? 'Voice rewrite',
112
+ content: args.content,
113
+ constraint: args.query,
114
+ formats: ['text'],
115
+ }));
116
+ const out = {
117
+ text: res['narrative_content'],
118
+ voice_profile_id: id,
119
+ voice_match_degraded: res['voice_match_degraded'],
120
+ identity_similarity: res['identity_similarity'],
121
+ constellation_label: res['constellation_label'],
122
+ };
123
+ return { content: [{ type: 'text', text: JSON.stringify(out) }] };
124
+ }
125
+ catch (err) {
126
+ return apiErrorResult(err, `/api/v1/voice/profiles/${id}/generate`);
127
+ }
128
+ }
129
+ async function composeFromKb(client, args) {
130
+ const blocked = await requireSoleActiveProfile(client, args.voice_profile_id);
131
+ if (blocked)
132
+ return blocked;
133
+ const chunks = [];
134
+ let done = null;
135
+ for await (const chunk of client.postSSE('/api/v1/mind/synthesize/stream', {
136
+ query: args.query,
137
+ synthesis_mode: 'crew_compose',
138
+ voice_mode: 'voice_on',
139
+ ...(args.workspace_id ? { workspace_id: args.workspace_id } : {}),
140
+ ...(args.collection_ids ? { collection_ids: args.collection_ids } : {}),
141
+ ...(args.program_ids ? { program_ids: args.program_ids } : {}),
142
+ })) {
143
+ done = parseSseDone(chunk) ?? done;
144
+ chunks.push(chunk);
145
+ }
146
+ const failed = voiceNotAppliedResult(done, chunks);
147
+ if (failed)
148
+ return failed;
149
+ return { content: chunks.map((c) => ({ type: 'text', text: c })) };
150
+ }
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { TacitApiError } from '../client.js';
3
- import { success, error, featureDisabledResult } from './errors.js';
2
+ import { SwitchNotSupportedError, TacitApiError, TokenExpiredError } from '../client.js';
3
+ import { success, error, featureDisabledResult, apiErrorResult } from './errors.js';
4
4
  export function registerWorkspaceTools(server, getClient) {
5
5
  server.tool('tacit_list_workspaces', 'List all workspaces accessible to the authenticated user.', {}, async () => {
6
6
  try {
@@ -27,8 +27,11 @@ export function registerWorkspaceTools(server, getClient) {
27
27
  });
28
28
  }
29
29
  catch (e) {
30
- if (e instanceof TacitApiError)
31
- return featureDisabledResult(e) ?? error(e.message);
30
+ if (e instanceof SwitchNotSupportedError)
31
+ return error(e.message);
32
+ if (e instanceof TacitApiError || e instanceof TokenExpiredError) {
33
+ return featureDisabledResult(e) ?? apiErrorResult(e, '/api/v1/auth/switch-workspace');
34
+ }
32
35
  return error(`Unexpected error: ${e instanceof Error ? e.message : String(e)}`);
33
36
  }
34
37
  });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Version of the running package, read from the package.json that ships next to `dist/`
3
+ * (and sits one level above `src/` when run from source). One source of truth: nothing
4
+ * in the code hard-codes a version.
5
+ */
6
+ export declare function readPackageVersion(): string;
@@ -0,0 +1,18 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ /**
5
+ * Version of the running package, read from the package.json that ships next to `dist/`
6
+ * (and sits one level above `src/` when run from source). One source of truth: nothing
7
+ * in the code hard-codes a version.
8
+ */
9
+ export function readPackageVersion() {
10
+ try {
11
+ const here = path.dirname(fileURLToPath(import.meta.url));
12
+ const pkg = JSON.parse(fs.readFileSync(path.join(here, '..', 'package.json'), 'utf-8'));
13
+ return typeof pkg.version === 'string' && pkg.version ? pkg.version : 'unknown';
14
+ }
15
+ catch {
16
+ return 'unknown';
17
+ }
18
+ }
@@ -84,4 +84,5 @@ export declare const IAM_ACCESS_REVIEW_TYPE_DEF: WorkflowTypeDef;
84
84
  export declare const SECURITY_AUDIT_TYPE_DEF: WorkflowTypeDef;
85
85
  export declare const SECRET_ROTATION_TYPE_DEF: WorkflowTypeDef;
86
86
  export declare const CAREER_APPLICATION_TYPE_DEF: WorkflowTypeDef;
87
+ export declare const VOICE_COMPOSE_TYPE_DEF: WorkflowTypeDef;
87
88
  export declare function createDefaultRegistry(): WorkflowRegistry;
@@ -439,6 +439,26 @@ export const CAREER_APPLICATION_TYPE_DEF = {
439
439
  guidance: 'CAREER_APPLICATION',
440
440
  maxInstances: 3,
441
441
  };
442
+ // ─── Voice Compose type definition (BUG-418) ───────────────────────────────
443
+ // tacit_compose_in_voice is in requiredTools, never gatedTools: gating would block every direct caller.
444
+ export const VOICE_COMPOSE_TYPE_DEF = {
445
+ name: 'voice_compose',
446
+ entryTool: null,
447
+ prereqs: {
448
+ kind: 'phased',
449
+ phases: [
450
+ { name: 'resolve_profile', requiredTools: ['tacit_voice_list_profiles'], gatedTools: [], approvalGate: false, guidance: 'VOICE_RESOLVE' },
451
+ { name: 'ground', requiredTools: [], gatedTools: [], approvalGate: false, guidance: 'VOICE_GROUND' },
452
+ { name: 'compose', requiredTools: ['tacit_compose_in_voice'], gatedTools: [], approvalGate: false, guidance: 'VOICE_COMPOSE_STEP' },
453
+ { name: 'verify', requiredTools: [], gatedTools: [], approvalGate: false, guidance: 'VOICE_VERIFY' },
454
+ ],
455
+ },
456
+ persistent: false,
457
+ failDirection: 'open',
458
+ sharedToolPolicy: 'passthrough',
459
+ guidance: 'VOICE_COMPOSE',
460
+ maxInstances: 3,
461
+ };
442
462
  // ─── Factory ────────────────────────────────────────────────────────────────
443
463
  export function createDefaultRegistry() {
444
464
  const registry = new WorkflowRegistry();
@@ -459,5 +479,6 @@ export function createDefaultRegistry() {
459
479
  registry.register(SECURITY_AUDIT_TYPE_DEF);
460
480
  registry.register(SECRET_ROTATION_TYPE_DEF);
461
481
  registry.register(CAREER_APPLICATION_TYPE_DEF);
482
+ registry.register(VOICE_COMPOSE_TYPE_DEF);
462
483
  return registry;
463
484
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tacitai/mcp-server",
3
- "version": "0.6.55",
3
+ "version": "0.8.0",
4
4
  "description": "stdio MCP server wrapping Tacit /api/v1 REST/SSE API",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -42,5 +42,8 @@
42
42
  "@types/semver": "^7.5.0",
43
43
  "typescript": "^5.4.0",
44
44
  "vitest": "^4.1.7"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
45
48
  }
46
49
  }