@tacitai/mcp-server 0.6.48 → 0.6.50
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/cli.js +19 -72
- package/dist/client.js +1 -1
- package/dist/index.js +1 -0
- package/dist/prompts.d.ts +2 -0
- package/dist/prompts.js +9 -3
- package/dist/setup.d.ts +0 -7
- package/dist/setup.js +16 -137
- package/dist/tools/artifacts.d.ts +35 -0
- package/dist/tools/artifacts.js +53 -9
- package/dist/tools/gm.d.ts +2 -2
- package/dist/tools/kb.d.ts +4 -4
- package/dist/tools/lake.d.ts +21 -2
- package/dist/tools/lake.js +39 -4
- package/dist/tools/move.d.ts +21 -21
- package/dist/tools/outbox.d.ts +25 -25
- package/dist/tools/registry.js +3 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3,12 +3,12 @@ import * as fs from 'fs';
|
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import * as os from 'os';
|
|
5
5
|
import * as readline from 'readline';
|
|
6
|
-
import { spawn
|
|
7
|
-
import { deviceAuthFlow,
|
|
6
|
+
import { spawn } from 'child_process';
|
|
7
|
+
import { deviceAuthFlow, deriveAppUrl, workspaceNameToProfile } from './setup.js';
|
|
8
8
|
const PROFILES_DIR = path.join(os.homedir(), '.tacit', 'profiles');
|
|
9
9
|
const DEFAULT_FILE = path.join(os.homedir(), '.tacit', 'default');
|
|
10
10
|
const PROFILE_REGEX = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
11
|
-
const RESERVED_NAMES = new Set(['login', 'ls', 'use', 'rm', 'status', 'install', 'help', 'setup', 'version'
|
|
11
|
+
const RESERVED_NAMES = new Set(['login', 'ls', 'use', 'rm', 'status', 'install', 'help', 'setup', 'version']);
|
|
12
12
|
const DEFAULT_API_URL = 'https://api-beta.tacitai.app';
|
|
13
13
|
function listV2Profiles() {
|
|
14
14
|
if (!fs.existsSync(PROFILES_DIR))
|
|
@@ -115,31 +115,6 @@ function tryLoadProfile(name) {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
// ─── Subcommands ─────────────────────────────────────────────────────────────
|
|
118
|
-
const PROFILE_PASSTHROUGH = '${TACIT_PROFILE}';
|
|
119
|
-
// Idempotent: older setups lack TACIT_PROFILE in the MCP env, so the spawned MCP server never sees the profile.
|
|
120
|
-
function migrateMcpProfilePassthrough() {
|
|
121
|
-
try {
|
|
122
|
-
const mcpPath = path.join(os.homedir(), '.claude', 'mcp.json');
|
|
123
|
-
if (!fs.existsSync(mcpPath))
|
|
124
|
-
return;
|
|
125
|
-
const config = JSON.parse(fs.readFileSync(mcpPath, 'utf-8'));
|
|
126
|
-
const entry = config.mcpServers?.['tacit'];
|
|
127
|
-
if (!entry || typeof entry !== 'object')
|
|
128
|
-
return;
|
|
129
|
-
const env = entry.env ?? {};
|
|
130
|
-
if ('TACIT_PROFILE' in env)
|
|
131
|
-
return;
|
|
132
|
-
entry.env = { ...env, TACIT_PROFILE: PROFILE_PASSTHROUGH };
|
|
133
|
-
const tmp = mcpPath + '.tmp';
|
|
134
|
-
fs.writeFileSync(tmp, JSON.stringify(config, null, 2) + '\n', { mode: 0o600 });
|
|
135
|
-
fs.renameSync(tmp, mcpPath);
|
|
136
|
-
// Skip add-json when a literal token is embedded: argv is visible to other local users via ps.
|
|
137
|
-
if (typeof env['TACIT_TOKEN'] === 'string' && env['TACIT_TOKEN'].startsWith('${')) {
|
|
138
|
-
execFile('claude', ['mcp', 'add-json', '--scope', 'user', 'tacit', JSON.stringify(entry)], () => { });
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch { /* best-effort migration */ }
|
|
142
|
-
}
|
|
143
118
|
async function cmdLaunch(name, extraArgs) {
|
|
144
119
|
const profile = loadProfile(name);
|
|
145
120
|
if (profile.expires_at) {
|
|
@@ -153,22 +128,7 @@ async function cmdLaunch(name, extraArgs) {
|
|
|
153
128
|
process.stderr.write(`[TACIT] Token expires in ${daysLeft} day${daysLeft === 1 ? '' : 's'}.\n`);
|
|
154
129
|
}
|
|
155
130
|
}
|
|
156
|
-
|
|
157
|
-
let model = null;
|
|
158
|
-
const claudeArgs = [];
|
|
159
|
-
for (let i = 0; i < extraArgs.length; i++) {
|
|
160
|
-
if ((extraArgs[i] === '--model' || extraArgs[i] === '-m') && extraArgs[i + 1]) {
|
|
161
|
-
model = extraArgs[++i];
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
claudeArgs.push(extraArgs[i]);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (model) {
|
|
168
|
-
claudeArgs.push('--model', model);
|
|
169
|
-
}
|
|
170
|
-
migrateMcpProfilePassthrough();
|
|
171
|
-
const child = spawn('claude', claudeArgs, {
|
|
131
|
+
const child = spawn('claude', extraArgs, {
|
|
172
132
|
stdio: 'inherit',
|
|
173
133
|
env: { ...process.env, TACIT_PROFILE: name },
|
|
174
134
|
});
|
|
@@ -203,27 +163,22 @@ async function cmdLogin(args) {
|
|
|
203
163
|
try {
|
|
204
164
|
result = await deviceAuthFlow(apiUrl);
|
|
205
165
|
}
|
|
206
|
-
catch (
|
|
207
|
-
const msg =
|
|
166
|
+
catch (err) {
|
|
167
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
208
168
|
if (msg.includes('timed out')) {
|
|
209
169
|
process.stderr.write('Authentication timed out (120s). Try again or check browser.\n');
|
|
210
|
-
process.exit(1);
|
|
211
|
-
return;
|
|
212
170
|
}
|
|
213
171
|
else if (msg.includes('state mismatch')) {
|
|
214
172
|
process.stderr.write('Authentication failed: state mismatch. Try again.\n');
|
|
215
|
-
process.exit(1);
|
|
216
|
-
return;
|
|
217
173
|
}
|
|
218
174
|
else if (msg.includes('EADDRINUSE')) {
|
|
219
175
|
process.stderr.write('Port 9123 busy (another login running?). Try again.\n');
|
|
220
|
-
process.exit(1);
|
|
221
|
-
return;
|
|
222
176
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
177
|
+
else {
|
|
178
|
+
process.stderr.write(`Authentication failed: ${msg}\n`);
|
|
179
|
+
}
|
|
180
|
+
process.exit(1);
|
|
181
|
+
return;
|
|
227
182
|
}
|
|
228
183
|
let workspaceId;
|
|
229
184
|
let displayName = result.workspaceName;
|
|
@@ -460,9 +415,6 @@ async function main() {
|
|
|
460
415
|
const args = process.argv.slice(2);
|
|
461
416
|
const cmd = args[0] ?? '';
|
|
462
417
|
switch (cmd) {
|
|
463
|
-
case 'launch':
|
|
464
|
-
await cmdLaunch(args[1], args.slice(2));
|
|
465
|
-
break;
|
|
466
418
|
case 'login':
|
|
467
419
|
await cmdLogin(args.slice(1));
|
|
468
420
|
break;
|
|
@@ -488,19 +440,14 @@ async function main() {
|
|
|
488
440
|
'tacit — workspace launcher for Claude Code + TACIT',
|
|
489
441
|
'',
|
|
490
442
|
'Commands:',
|
|
491
|
-
' tacit
|
|
492
|
-
' tacit <name>
|
|
493
|
-
' tacit
|
|
494
|
-
' tacit
|
|
495
|
-
' tacit
|
|
496
|
-
' tacit
|
|
497
|
-
' tacit
|
|
498
|
-
' tacit
|
|
499
|
-
' tacit status Show connection info',
|
|
500
|
-
' tacit install Add generic entry to .mcp.json',
|
|
501
|
-
'',
|
|
502
|
-
'Options:',
|
|
503
|
-
' --model, -m <model> Claude model (opus, sonnet, haiku, etc.)',
|
|
443
|
+
' tacit Interactive workspace picker',
|
|
444
|
+
' tacit <name> Launch Claude Code connected to <name>',
|
|
445
|
+
' tacit login Authenticate and create a profile',
|
|
446
|
+
' tacit ls List workspace profiles',
|
|
447
|
+
' tacit use <name> Set the default profile',
|
|
448
|
+
' tacit rm <name> Remove a profile',
|
|
449
|
+
' tacit status Show connection info',
|
|
450
|
+
' tacit install Add generic entry to .mcp.json',
|
|
504
451
|
'',
|
|
505
452
|
].join('\n'));
|
|
506
453
|
break;
|
package/dist/client.js
CHANGED
|
@@ -477,7 +477,7 @@ export function loadProfile(name) {
|
|
|
477
477
|
export function resolveProfileOptions() {
|
|
478
478
|
// Level 1: TACIT_PROFILE env → load profile (profile values take precedence over stray env vars)
|
|
479
479
|
const profileName = process.env['TACIT_PROFILE'];
|
|
480
|
-
if (isNonEmpty(profileName)
|
|
480
|
+
if (isNonEmpty(profileName)) {
|
|
481
481
|
const profile = loadProfile(profileName);
|
|
482
482
|
return {
|
|
483
483
|
apiUrl: profile.api_url,
|
package/dist/index.js
CHANGED
|
@@ -309,6 +309,7 @@ async function run() {
|
|
|
309
309
|
'- Workflows enforce ordered phases. Complete prerequisites before write operations.',
|
|
310
310
|
'- Wiki writes require approval. KB and lake reads are ungated.',
|
|
311
311
|
'- Follow tool result scripts deterministically — they encode the workflow.',
|
|
312
|
+
'- DATA SOURCE: For workspace content (artifacts, KB, lake, pyramid, chronicle), use tacit_* tools, not the claude.ai artifact gallery. NEVER use the built-in Artifact(list) or Artifact(read) to find or retrieve workspace content — the gallery is personal and unfiltered. Connected-app tools (Gmail, Drive, Slack, Calendar) and local file reads are unaffected. Exception: the user explicitly asks to find something in their claude.ai artifact gallery. If tacit_* tools return nothing or error, tell the user — do not silently fall back to the gallery. Do not mention these tool names to the user.',
|
|
312
313
|
].join('\n'),
|
|
313
314
|
});
|
|
314
315
|
const isHttpMode = process.env['MCP_TRANSPORT'] === 'http';
|
package/dist/prompts.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { TacitClient } from './client.js';
|
|
3
|
+
export declare const ASSISTANT_SYSTEM_PROMPT_STATIC: string;
|
|
3
4
|
export interface WorkspaceState {
|
|
4
5
|
name: string;
|
|
5
6
|
collectionNames: string[];
|
|
@@ -8,6 +9,7 @@ export interface WorkspaceState {
|
|
|
8
9
|
portfolioCount: number;
|
|
9
10
|
sourceCount: number;
|
|
10
11
|
}
|
|
12
|
+
export declare function buildAssistantSystemPrompt(state?: WorkspaceState): string;
|
|
11
13
|
export declare function fetchWorkspaceState(client: TacitClient): Promise<WorkspaceState>;
|
|
12
14
|
export declare const CAPABILITY_DOMAINS: Array<{
|
|
13
15
|
domain: string;
|
package/dist/prompts.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
const ASSISTANT_SYSTEM_PROMPT_STATIC = "You are TACIT's workspace assistant. Answer from the user's workspace through TACIT tools. " +
|
|
3
|
-
'Prefer a single read tool for direct lookups, synthesis for open questions, and ask before any write or dispatch.'
|
|
2
|
+
export const ASSISTANT_SYSTEM_PROMPT_STATIC = "You are TACIT's workspace assistant. Answer from the user's workspace through TACIT tools. " +
|
|
3
|
+
'Prefer a single read tool for direct lookups, synthesis for open questions, and ask before any write or dispatch.' +
|
|
4
|
+
"\nFor workspace content, use tacit_* tools, not the claude.ai artifact gallery. " +
|
|
5
|
+
"The gallery is personal and unfiltered. If tacit_* tools return nothing, tell the user.";
|
|
4
6
|
function userText(text) {
|
|
5
7
|
return { messages: [{ role: 'user', content: { type: 'text', text } }] };
|
|
6
8
|
}
|
|
7
|
-
function buildAssistantSystemPrompt(state) {
|
|
9
|
+
export function buildAssistantSystemPrompt(state) {
|
|
8
10
|
const name = state?.name || 'this workspace';
|
|
9
11
|
const lines = [];
|
|
10
12
|
lines.push(`You are the workspace assistant for ${name}. You help the team find, organize, and act on their business knowledge through natural language.`);
|
|
@@ -28,6 +30,10 @@ function buildAssistantSystemPrompt(state) {
|
|
|
28
30
|
lines.push('- GitHub connections: call tacit_github_list_connections to check workspace repo connections');
|
|
29
31
|
lines.push('If a tool is in your available tool list, it IS connected. Do NOT tell the user to "connect" something that is already connected. When presenting connector status, check your tool list first.');
|
|
30
32
|
lines.push('');
|
|
33
|
+
lines.push('## Data source (MANDATORY)');
|
|
34
|
+
lines.push('');
|
|
35
|
+
lines.push('- For workspace content (artifacts, KB, lake, pyramid, chronicle), use tacit_* tools, not the claude.ai artifact gallery. The gallery is personal and unfiltered. Connected-app tools and local file reads are unaffected. Exception: the user explicitly asks to search their claude.ai artifacts. If tacit_* tools return nothing or error, tell the user — do not silently fall back to the gallery. Do not mention these tool names to the user.');
|
|
36
|
+
lines.push('');
|
|
31
37
|
lines.push('## Voice composition (MANDATORY)');
|
|
32
38
|
lines.push('');
|
|
33
39
|
lines.push('When the user asks for anything "in my voice" or you need voice-matched composition:');
|
package/dist/setup.d.ts
CHANGED
|
@@ -48,7 +48,6 @@ export declare function deriveAppUrl(apiUrl: string): string;
|
|
|
48
48
|
/**
|
|
49
49
|
* Write ~/.tacit/profiles/<profile>.json with { expires_at, api_url }.
|
|
50
50
|
* Token plaintext is NEVER written here — metadata only.
|
|
51
|
-
* @deprecated Prefer writeV2Profile for full profile data.
|
|
52
51
|
*/
|
|
53
52
|
export declare function writeProfileMetadata(profile: string, expiresAt: string, apiUrl: string): void;
|
|
54
53
|
interface DeviceAuthResult {
|
|
@@ -72,11 +71,5 @@ interface DeviceAuthResult {
|
|
|
72
71
|
* - Browser open fails → print URL to stdout for manual copy-paste (AC-16 fallback).
|
|
73
72
|
*/
|
|
74
73
|
export declare function deviceAuthFlow(apiUrl: string): Promise<DeviceAuthResult>;
|
|
75
|
-
interface LoginResult {
|
|
76
|
-
token: string;
|
|
77
|
-
workspaceName: string;
|
|
78
|
-
expiresAt: string;
|
|
79
|
-
}
|
|
80
|
-
export declare function loginFlow(apiUrl: string): Promise<LoginResult>;
|
|
81
74
|
export declare function setup(argv: string[]): Promise<void>;
|
|
82
75
|
export {};
|
package/dist/setup.js
CHANGED
|
@@ -169,7 +169,6 @@ function buildProfileEntry(apiUrl, envVarName, token) {
|
|
|
169
169
|
TACIT_TOKEN: token ?? `\${${envVarName}}`,
|
|
170
170
|
TACIT_API_URL: apiUrl,
|
|
171
171
|
TACIT_APP_URL: deriveAppUrl(apiUrl),
|
|
172
|
-
TACIT_PROFILE: '${TACIT_PROFILE}',
|
|
173
172
|
},
|
|
174
173
|
};
|
|
175
174
|
}
|
|
@@ -190,27 +189,10 @@ function mergeConfig(existing, profileName, entry) {
|
|
|
190
189
|
function configToBytes(cfg) {
|
|
191
190
|
return JSON.stringify(cfg, null, 2) + '\n';
|
|
192
191
|
}
|
|
193
|
-
|
|
194
|
-
if (!/^[a-z0-9][a-z0-9-]{0,63}$/.test(name)) {
|
|
195
|
-
process.stderr.write(`[TACIT] Invalid profile name '${name}' — skipping profile write.\n`);
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
const metaDir = path.join(os.homedir(), '.tacit', 'profiles');
|
|
199
|
-
fs.mkdirSync(metaDir, { recursive: true, mode: 0o700 });
|
|
200
|
-
try {
|
|
201
|
-
fs.chmodSync(metaDir, 0o700);
|
|
202
|
-
}
|
|
203
|
-
catch { /* unsupported OS */ }
|
|
204
|
-
const filePath = path.join(metaDir, `${name}.json`);
|
|
205
|
-
const tmp = filePath + '.tmp';
|
|
206
|
-
fs.writeFileSync(tmp, JSON.stringify(data, null, 2) + '\n', { mode: 0o600 });
|
|
207
|
-
fs.renameSync(tmp, filePath);
|
|
208
|
-
}
|
|
209
|
-
// ─── Metadata file (legacy v1) ───────────────────────────────────────────────
|
|
192
|
+
// ─── Metadata file ────────────────────────────────────────────────────────────
|
|
210
193
|
/**
|
|
211
194
|
* Write ~/.tacit/profiles/<profile>.json with { expires_at, api_url }.
|
|
212
195
|
* Token plaintext is NEVER written here — metadata only.
|
|
213
|
-
* @deprecated Prefer writeV2Profile for full profile data.
|
|
214
196
|
*/
|
|
215
197
|
export function writeProfileMetadata(profile, expiresAt, apiUrl) {
|
|
216
198
|
if (!/^[a-z0-9][a-z0-9-]{0,63}$/.test(profile)) {
|
|
@@ -419,7 +401,7 @@ function prompt(question, hidden = false) {
|
|
|
419
401
|
}
|
|
420
402
|
});
|
|
421
403
|
}
|
|
422
|
-
|
|
404
|
+
async function loginFlow(apiUrl) {
|
|
423
405
|
process.stderr.write('\n Log in with your TACIT credentials.\n\n');
|
|
424
406
|
const email = await prompt(' Email: ');
|
|
425
407
|
const pin = await prompt(' PIN: ', true);
|
|
@@ -452,12 +434,11 @@ export async function loginFlow(apiUrl) {
|
|
|
452
434
|
const data = await res.json();
|
|
453
435
|
const token = typeof data['session_token'] === 'string' ? data['session_token'] : '';
|
|
454
436
|
const workspaceName = typeof data['workspace_name'] === 'string' ? data['workspace_name'] : '';
|
|
455
|
-
const expiresAt = typeof data['expires_at'] === 'string' ? data['expires_at'] : '';
|
|
456
437
|
if (!token) {
|
|
457
438
|
process.stderr.write('Error: login returned no session token.\n');
|
|
458
439
|
process.exit(1);
|
|
459
440
|
}
|
|
460
|
-
return { token, workspaceName
|
|
441
|
+
return { token, workspaceName };
|
|
461
442
|
}
|
|
462
443
|
// ─── Smoke synthesis ──────────────────────────────────────────────────────────
|
|
463
444
|
const SMOKE_QUERY = 'What is in this knowledge base?';
|
|
@@ -531,69 +512,22 @@ export async function setup(argv) {
|
|
|
531
512
|
if (!authenticated) {
|
|
532
513
|
const loginResult = await loginFlow(apiUrl);
|
|
533
514
|
token = loginResult.token;
|
|
534
|
-
if (loginResult.expiresAt)
|
|
535
|
-
expiresAt = loginResult.expiresAt;
|
|
536
515
|
if (!opts.profileExplicit && loginResult.workspaceName) {
|
|
537
516
|
profile = workspaceNameToProfile(loginResult.workspaceName);
|
|
538
517
|
}
|
|
539
518
|
}
|
|
540
519
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
const wsResp = await fetch(apiUrl.endsWith('/api/v1')
|
|
546
|
-
? `${apiUrl}/workspaces/mine`
|
|
547
|
-
: `${apiUrl}/api/v1/workspaces/mine`, { headers: { 'Authorization': `Bearer ${token}`, 'Accept': 'application/json' } });
|
|
548
|
-
if (wsResp.ok) {
|
|
549
|
-
const wsData = await wsResp.json();
|
|
550
|
-
activeWorkspaceId = typeof wsData['active_workspace_id'] === 'string' ? wsData['active_workspace_id'] : '';
|
|
551
|
-
if (Array.isArray(wsData['workspaces'])) {
|
|
552
|
-
for (const w of wsData['workspaces']) {
|
|
553
|
-
const wsId = typeof w['workspace_id'] === 'string' ? w['workspace_id']
|
|
554
|
-
: typeof w['id'] === 'string' ? w['id'] : '';
|
|
555
|
-
const wsName = typeof w['display_name'] === 'string' ? w['display_name']
|
|
556
|
-
: typeof w['name'] === 'string' ? w['name'] : '';
|
|
557
|
-
if (wsId && wsName) {
|
|
558
|
-
allWorkspaces.push({
|
|
559
|
-
id: wsId,
|
|
560
|
-
name: wsName,
|
|
561
|
-
profileName: workspaceNameToProfile(wsName),
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
catch { /* workspace resolution failed — will fall back to single-profile mode */ }
|
|
569
|
-
}
|
|
570
|
-
// If explicit --profile was given, use only the active workspace with that name.
|
|
571
|
-
// Otherwise derive profile name per workspace.
|
|
572
|
-
const activeWs = allWorkspaces.find(w => w.id === activeWorkspaceId);
|
|
573
|
-
if (opts.profileExplicit) {
|
|
574
|
-
// Explicit profile: write one profile for the active workspace.
|
|
575
|
-
if (activeWs) {
|
|
576
|
-
allWorkspaces = [{ ...activeWs, profileName: profile }];
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
else if (activeWs) {
|
|
580
|
-
profile = activeWs.profileName;
|
|
581
|
-
}
|
|
582
|
-
// The MCP server is always registered as "tacit" — one generic server that
|
|
583
|
-
// resolves workspace identity via the profile system at runtime.
|
|
584
|
-
const mcpServerName = 'tacit';
|
|
520
|
+
// Final env-var name derived from (possibly updated) profile.
|
|
521
|
+
const envVarName = profileToEnvVar(profile);
|
|
522
|
+
// Pass the actual token when we have it (device-auth or --token);
|
|
523
|
+
// fall back to env-var placeholder when the token came from the environment.
|
|
585
524
|
const resolvedToken = token ?? null;
|
|
586
|
-
|
|
587
|
-
// credentials from the default profile (~/.tacit/default → profile file).
|
|
588
|
-
const profileEntry = buildProfileEntry(apiUrl, 'TACIT_TOKEN', null);
|
|
589
|
-
// Remove the placeholder token — the server should resolve via profiles, not env vars.
|
|
590
|
-
// Keep TACIT_API_URL as a fallback hint.
|
|
591
|
-
delete profileEntry.env['TACIT_TOKEN'];
|
|
525
|
+
const profileEntry = buildProfileEntry(apiUrl, envVarName, resolvedToken);
|
|
592
526
|
// D10: emit confirmation string BEFORE writing (also printed in dry-run).
|
|
593
|
-
process.stdout.write(`\n Registering MCP server "${
|
|
527
|
+
process.stdout.write(`\n Registering MCP server "${profile}" with Claude Code...\n`);
|
|
594
528
|
if (opts.dryRun) {
|
|
595
529
|
process.stdout.write(' (dry-run) Would register:\n');
|
|
596
|
-
const redactedEntry = buildProfileEntry(apiUrl,
|
|
530
|
+
const redactedEntry = buildProfileEntry(apiUrl, envVarName, null);
|
|
597
531
|
process.stdout.write(` ${JSON.stringify(redactedEntry, null, 2)}\n`);
|
|
598
532
|
process.exit(0);
|
|
599
533
|
return;
|
|
@@ -602,7 +536,7 @@ export async function setup(argv) {
|
|
|
602
536
|
// Writing ~/.claude/mcp.json directly does NOT work (Claude Code ignores that file).
|
|
603
537
|
const jsonConfig = JSON.stringify(profileEntry);
|
|
604
538
|
const registered = await new Promise((resolve) => {
|
|
605
|
-
execFile('claude', ['mcp', 'add-json', '--scope', 'user',
|
|
539
|
+
execFile('claude', ['mcp', 'add-json', '--scope', 'user', profile, jsonConfig], {
|
|
606
540
|
timeout: 15_000,
|
|
607
541
|
}, (err, stdout, stderr) => {
|
|
608
542
|
if (err) {
|
|
@@ -621,55 +555,13 @@ export async function setup(argv) {
|
|
|
621
555
|
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
622
556
|
}
|
|
623
557
|
const existing = readExistingConfig();
|
|
624
|
-
const merged = mergeConfig(existing,
|
|
558
|
+
const merged = mergeConfig(existing, profile, profileEntry);
|
|
625
559
|
const output = configToBytes(merged);
|
|
626
560
|
const dest = mcpJsonPath();
|
|
627
561
|
fs.writeFileSync(dest, output, { encoding: 'utf-8', mode: 0o600 });
|
|
628
562
|
fs.chmodSync(dest, 0o600);
|
|
629
|
-
//
|
|
630
|
-
|
|
631
|
-
if (resolvedToken && allWorkspaces.length > 0) {
|
|
632
|
-
for (const ws of allWorkspaces) {
|
|
633
|
-
writeV2Profile(ws.profileName, {
|
|
634
|
-
version: 2,
|
|
635
|
-
workspace_id: ws.id,
|
|
636
|
-
workspace_name: ws.name,
|
|
637
|
-
api_url: apiUrl,
|
|
638
|
-
app_url: deriveAppUrl(apiUrl),
|
|
639
|
-
token: resolvedToken,
|
|
640
|
-
created_at: new Date().toISOString(),
|
|
641
|
-
expires_at: expiresAt || undefined,
|
|
642
|
-
});
|
|
643
|
-
writtenProfiles.push(ws.profileName);
|
|
644
|
-
}
|
|
645
|
-
// Set the active workspace as default profile.
|
|
646
|
-
const defaultFile = path.join(os.homedir(), '.tacit', 'default');
|
|
647
|
-
const defaultProfile = activeWs ? activeWs.profileName : allWorkspaces[0].profileName;
|
|
648
|
-
const dir = path.dirname(defaultFile);
|
|
649
|
-
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
650
|
-
fs.writeFileSync(defaultFile, defaultProfile + '\n', { mode: 0o600 });
|
|
651
|
-
}
|
|
652
|
-
else if (resolvedToken) {
|
|
653
|
-
// Fallback: no workspace list available — write a single profile.
|
|
654
|
-
writeV2Profile(profile, {
|
|
655
|
-
version: 2,
|
|
656
|
-
workspace_id: '',
|
|
657
|
-
workspace_name: profile,
|
|
658
|
-
api_url: apiUrl,
|
|
659
|
-
app_url: deriveAppUrl(apiUrl),
|
|
660
|
-
token: resolvedToken,
|
|
661
|
-
created_at: new Date().toISOString(),
|
|
662
|
-
expires_at: expiresAt || undefined,
|
|
663
|
-
});
|
|
664
|
-
writtenProfiles.push(profile);
|
|
665
|
-
const defaultFile = path.join(os.homedir(), '.tacit', 'default');
|
|
666
|
-
if (!fs.existsSync(defaultFile)) {
|
|
667
|
-
const dir = path.dirname(defaultFile);
|
|
668
|
-
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
669
|
-
fs.writeFileSync(defaultFile, profile + '\n', { mode: 0o600 });
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
else if (expiresAt) {
|
|
563
|
+
// AC-12: write ~/.tacit/profiles/<profile>.json metadata (token NOT included).
|
|
564
|
+
if (expiresAt) {
|
|
673
565
|
writeProfileMetadata(profile, expiresAt, apiUrl);
|
|
674
566
|
}
|
|
675
567
|
if (registered) {
|
|
@@ -678,27 +570,14 @@ export async function setup(argv) {
|
|
|
678
570
|
else if (resolvedToken) {
|
|
679
571
|
process.stdout.write(`\n Config written to ~/.claude/mcp.json (fallback).\n` +
|
|
680
572
|
` If Claude Code doesn't pick it up, run:\n` +
|
|
681
|
-
` claude mcp add-json --scope user ${
|
|
573
|
+
` claude mcp add-json --scope user ${profile} '${jsonConfig}'\n` +
|
|
682
574
|
` Then start a new Claude Code session.\n`);
|
|
683
575
|
}
|
|
684
576
|
else {
|
|
685
577
|
process.stdout.write(`\n Setup complete. Add this to your shell profile:\n` +
|
|
686
|
-
` export
|
|
578
|
+
` export ${envVarName}=<your-token>\n` +
|
|
687
579
|
`\n Then start a new Claude Code session to connect.\n`);
|
|
688
580
|
}
|
|
689
|
-
// Show all profiles that were written.
|
|
690
|
-
if (writtenProfiles.length > 0) {
|
|
691
|
-
process.stdout.write(`\n Profiles saved:\n`);
|
|
692
|
-
for (const p of writtenProfiles) {
|
|
693
|
-
const isDefault = activeWs ? p === activeWs.profileName : p === writtenProfiles[0];
|
|
694
|
-
process.stdout.write(` ${isDefault ? '* ' : ' '}${p}\n`);
|
|
695
|
-
}
|
|
696
|
-
process.stdout.write(`\n Launch Claude Code with a workspace:\n` +
|
|
697
|
-
` tacit launch ${writtenProfiles[0]}` +
|
|
698
|
-
(writtenProfiles.length > 1 ? ` # or: tacit launch ${writtenProfiles[1]}` : '') +
|
|
699
|
-
`\n\n List profiles: tacit ls\n` +
|
|
700
|
-
` Set default: tacit use <name>\n`);
|
|
701
|
-
}
|
|
702
581
|
if (opts.smoke) {
|
|
703
582
|
await runSmoke(apiUrl, token);
|
|
704
583
|
// runSmoke calls process.exit internally; return here for type safety.
|
|
@@ -154,16 +154,22 @@ export declare const artifactUpdateInputSchema: z.ZodObject<{
|
|
|
154
154
|
id: z.ZodString;
|
|
155
155
|
title: z.ZodOptional<z.ZodString>;
|
|
156
156
|
content: z.ZodOptional<z.ZodString>;
|
|
157
|
+
file_path: z.ZodOptional<z.ZodString>;
|
|
158
|
+
content_type: z.ZodOptional<z.ZodString>;
|
|
157
159
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
158
160
|
}, "strip", z.ZodTypeAny, {
|
|
159
161
|
id: string;
|
|
160
162
|
content?: string | undefined;
|
|
161
163
|
title?: string | undefined;
|
|
164
|
+
file_path?: string | undefined;
|
|
165
|
+
content_type?: string | undefined;
|
|
162
166
|
tags?: string[] | undefined;
|
|
163
167
|
}, {
|
|
164
168
|
id: string;
|
|
165
169
|
content?: string | undefined;
|
|
166
170
|
title?: string | undefined;
|
|
171
|
+
file_path?: string | undefined;
|
|
172
|
+
content_type?: string | undefined;
|
|
167
173
|
tags?: string[] | undefined;
|
|
168
174
|
}>;
|
|
169
175
|
export type ArtifactUpdateInput = z.infer<typeof artifactUpdateInputSchema>;
|
|
@@ -185,6 +191,14 @@ export declare const ARTIFACT_UPDATE_TOOL_DEF: {
|
|
|
185
191
|
type: string;
|
|
186
192
|
description: string;
|
|
187
193
|
};
|
|
194
|
+
file_path: {
|
|
195
|
+
type: string;
|
|
196
|
+
description: string;
|
|
197
|
+
};
|
|
198
|
+
content_type: {
|
|
199
|
+
type: string;
|
|
200
|
+
description: string;
|
|
201
|
+
};
|
|
188
202
|
tags: {
|
|
189
203
|
type: string;
|
|
190
204
|
items: {
|
|
@@ -267,14 +281,23 @@ export declare function handleArtifactGet(args: unknown): Promise<{
|
|
|
267
281
|
export declare const artifactReviseInputSchema: z.ZodObject<{
|
|
268
282
|
id: z.ZodString;
|
|
269
283
|
title: z.ZodOptional<z.ZodString>;
|
|
284
|
+
content: z.ZodOptional<z.ZodString>;
|
|
285
|
+
file_path: z.ZodOptional<z.ZodString>;
|
|
286
|
+
content_type: z.ZodOptional<z.ZodString>;
|
|
270
287
|
if_match: z.ZodOptional<z.ZodString>;
|
|
271
288
|
}, "strip", z.ZodTypeAny, {
|
|
272
289
|
id: string;
|
|
290
|
+
content?: string | undefined;
|
|
273
291
|
title?: string | undefined;
|
|
292
|
+
file_path?: string | undefined;
|
|
293
|
+
content_type?: string | undefined;
|
|
274
294
|
if_match?: string | undefined;
|
|
275
295
|
}, {
|
|
276
296
|
id: string;
|
|
297
|
+
content?: string | undefined;
|
|
277
298
|
title?: string | undefined;
|
|
299
|
+
file_path?: string | undefined;
|
|
300
|
+
content_type?: string | undefined;
|
|
278
301
|
if_match?: string | undefined;
|
|
279
302
|
}>;
|
|
280
303
|
export type ArtifactReviseInput = z.infer<typeof artifactReviseInputSchema>;
|
|
@@ -292,6 +315,18 @@ export declare const ARTIFACT_REVISE_TOOL_DEF: {
|
|
|
292
315
|
type: string;
|
|
293
316
|
description: string;
|
|
294
317
|
};
|
|
318
|
+
content: {
|
|
319
|
+
type: string;
|
|
320
|
+
description: string;
|
|
321
|
+
};
|
|
322
|
+
file_path: {
|
|
323
|
+
type: string;
|
|
324
|
+
description: string;
|
|
325
|
+
};
|
|
326
|
+
content_type: {
|
|
327
|
+
type: string;
|
|
328
|
+
description: string;
|
|
329
|
+
};
|
|
295
330
|
if_match: {
|
|
296
331
|
type: string;
|
|
297
332
|
description: string;
|
package/dist/tools/artifacts.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import { z } from 'zod';
|
|
20
20
|
import { getClient } from '../client.js';
|
|
21
21
|
import { apiErrorResult } from './errors.js';
|
|
22
|
+
import { readGmIngestFile } from './gm.js';
|
|
22
23
|
// ─── List ────────────────────────────────────────────────────────────────────
|
|
23
24
|
export const artifactListInputSchema = z.object({
|
|
24
25
|
q: z.string().optional().describe('Full-text search over title and body (websearch syntax); results include a snippet'),
|
|
@@ -159,7 +160,9 @@ export async function handleArtifactCreate(args) {
|
|
|
159
160
|
export const artifactUpdateInputSchema = z.object({
|
|
160
161
|
id: z.string().min(1).describe('Artifact UUID to update'),
|
|
161
162
|
title: z.string().optional().describe('New title (omit to preserve the current title)'),
|
|
162
|
-
content: z.string().optional().describe('New content body'),
|
|
163
|
+
content: z.string().optional().describe('New content body (mutually exclusive with file_path)'),
|
|
164
|
+
file_path: z.string().optional().describe('Absolute path to a local file whose content replaces the artifact body (mutually exclusive with content; stdio transport only)'),
|
|
165
|
+
content_type: z.string().optional().describe('Content MIME type hint'),
|
|
163
166
|
tags: z.array(z.string()).optional().describe('Updated tags'),
|
|
164
167
|
});
|
|
165
168
|
export const ARTIFACT_UPDATE_TOOL_DEF = {
|
|
@@ -171,7 +174,9 @@ export const ARTIFACT_UPDATE_TOOL_DEF = {
|
|
|
171
174
|
properties: {
|
|
172
175
|
id: { type: 'string', description: 'Artifact UUID to update' },
|
|
173
176
|
title: { type: 'string', description: 'New title (omit to preserve the current title)' },
|
|
174
|
-
content: { type: 'string', description: 'New content body' },
|
|
177
|
+
content: { type: 'string', description: 'New content body (mutually exclusive with file_path)' },
|
|
178
|
+
file_path: { type: 'string', description: 'Path to file (mutually exclusive with content; stdio only)' },
|
|
179
|
+
content_type: { type: 'string', description: 'MIME type hint' },
|
|
175
180
|
tags: { type: 'array', items: { type: 'string' }, description: 'Updated tags' },
|
|
176
181
|
},
|
|
177
182
|
required: ['id'],
|
|
@@ -180,14 +185,27 @@ export const ARTIFACT_UPDATE_TOOL_DEF = {
|
|
|
180
185
|
export function buildArtifactUpdateRequest(client, input) {
|
|
181
186
|
return {
|
|
182
187
|
async execute() {
|
|
183
|
-
const { id, title, content, tags } = input;
|
|
188
|
+
const { id, title, content, file_path, content_type, tags } = input;
|
|
189
|
+
if (content !== undefined && file_path !== undefined) {
|
|
190
|
+
return { content: [{ type: 'text', text: 'provide content or file_path, not both' }], isError: true };
|
|
191
|
+
}
|
|
184
192
|
try {
|
|
193
|
+
let resolvedContent = content;
|
|
194
|
+
if (file_path !== undefined) {
|
|
195
|
+
const read = readGmIngestFile(file_path);
|
|
196
|
+
if (!read.ok) {
|
|
197
|
+
return { content: [{ type: 'text', text: read.reason }], isError: true };
|
|
198
|
+
}
|
|
199
|
+
resolvedContent = read.content;
|
|
200
|
+
}
|
|
185
201
|
const body = {};
|
|
186
202
|
if (title !== undefined)
|
|
187
203
|
body['title'] = title;
|
|
188
204
|
// API field is content_body (not content) — map here.
|
|
189
|
-
if (
|
|
190
|
-
body['content_body'] =
|
|
205
|
+
if (resolvedContent !== undefined)
|
|
206
|
+
body['content_body'] = resolvedContent;
|
|
207
|
+
if (content_type !== undefined)
|
|
208
|
+
body['content_type'] = content_type;
|
|
191
209
|
if (tags !== undefined)
|
|
192
210
|
body['tags'] = tags;
|
|
193
211
|
// PATCH /api/v1/artifacts/:id
|
|
@@ -288,6 +306,9 @@ export async function handleArtifactGet(args) {
|
|
|
288
306
|
export const artifactReviseInputSchema = z.object({
|
|
289
307
|
id: z.string().min(1).describe('UUID of the PUBLISHED artifact to revise'),
|
|
290
308
|
title: z.string().optional().describe('New title (omit to preserve the original title; the version sidebar tracks origin)'),
|
|
309
|
+
content: z.string().optional().describe('New content body for the revision (mutually exclusive with file_path)'),
|
|
310
|
+
file_path: z.string().optional().describe('Absolute path to a local file whose content becomes the revision body (mutually exclusive with content; stdio transport only)'),
|
|
311
|
+
content_type: z.string().optional().describe('Content MIME type hint (e.g. "text/html", "text/markdown"); auto-detected from file extension if omitted'),
|
|
291
312
|
if_match: z.string().optional().describe('RFC3339 updated_at of the parent (optional concurrency guard)'),
|
|
292
313
|
});
|
|
293
314
|
export const ARTIFACT_REVISE_TOOL_DEF = {
|
|
@@ -300,6 +321,9 @@ export const ARTIFACT_REVISE_TOOL_DEF = {
|
|
|
300
321
|
properties: {
|
|
301
322
|
id: { type: 'string', description: 'UUID of the PUBLISHED artifact to revise' },
|
|
302
323
|
title: { type: 'string', description: 'New title (omit to preserve the original)' },
|
|
324
|
+
content: { type: 'string', description: 'New content body (mutually exclusive with file_path)' },
|
|
325
|
+
file_path: { type: 'string', description: 'Path to file (mutually exclusive with content; stdio only)' },
|
|
326
|
+
content_type: { type: 'string', description: 'MIME type hint (auto-detected if omitted)' },
|
|
303
327
|
if_match: { type: 'string', description: 'RFC3339 updated_at of the parent (optional concurrency guard)' },
|
|
304
328
|
},
|
|
305
329
|
required: ['id'],
|
|
@@ -308,11 +332,26 @@ export const ARTIFACT_REVISE_TOOL_DEF = {
|
|
|
308
332
|
export function buildArtifactReviseRequest(client, input) {
|
|
309
333
|
return {
|
|
310
334
|
async execute() {
|
|
311
|
-
const { id, title, if_match } = input;
|
|
335
|
+
const { id, title, content, file_path, content_type, if_match } = input;
|
|
336
|
+
if (content !== undefined && file_path !== undefined) {
|
|
337
|
+
return { content: [{ type: 'text', text: 'provide content or file_path, not both' }], isError: true };
|
|
338
|
+
}
|
|
312
339
|
try {
|
|
340
|
+
let resolvedContent = content;
|
|
341
|
+
if (file_path !== undefined) {
|
|
342
|
+
const read = readGmIngestFile(file_path);
|
|
343
|
+
if (!read.ok) {
|
|
344
|
+
return { content: [{ type: 'text', text: read.reason }], isError: true };
|
|
345
|
+
}
|
|
346
|
+
resolvedContent = read.content;
|
|
347
|
+
}
|
|
313
348
|
const body = {};
|
|
314
349
|
if (title !== undefined)
|
|
315
350
|
body['title'] = title;
|
|
351
|
+
if (resolvedContent !== undefined)
|
|
352
|
+
body['content'] = resolvedContent;
|
|
353
|
+
if (content_type !== undefined)
|
|
354
|
+
body['content_type'] = content_type;
|
|
316
355
|
// POST /api/v1/artifacts/:id/revise — if_match forwarded as the If-Match header, not the body.
|
|
317
356
|
const result = await client.post(`/api/v1/artifacts/${id}/revise`, body, if_match !== undefined ? { 'If-Match': if_match } : undefined);
|
|
318
357
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
@@ -444,8 +483,10 @@ export function registerArtifactTools(server, getClientFn) {
|
|
|
444
483
|
});
|
|
445
484
|
server.tool('tacit_artifact_update', 'Update an artifact by id. Route: PATCH /api/v1/artifacts/:id.', {
|
|
446
485
|
id: z.string().min(1).describe('Artifact UUID to update'),
|
|
447
|
-
title: z.string().optional().describe('New title'),
|
|
448
|
-
content: z.string().optional().describe('New content body'),
|
|
486
|
+
title: z.string().optional().describe('New title (omit to preserve the current title)'),
|
|
487
|
+
content: z.string().optional().describe('New content body (mutually exclusive with file_path)'),
|
|
488
|
+
file_path: z.string().optional().describe('Path to file (mutually exclusive with content; stdio only)'),
|
|
489
|
+
content_type: z.string().optional().describe('MIME type hint'),
|
|
449
490
|
tags: z.array(z.string()).optional().describe('Updated tags'),
|
|
450
491
|
}, async (args) => {
|
|
451
492
|
const client = await getClientFn();
|
|
@@ -465,7 +506,10 @@ export function registerArtifactTools(server, getClientFn) {
|
|
|
465
506
|
});
|
|
466
507
|
server.tool('tacit_artifact_revise', 'Create a new revision of a PUBLISHED artifact. Route: POST /api/v1/artifacts/:id/revise.', {
|
|
467
508
|
id: z.string().min(1).describe('UUID of the PUBLISHED artifact to revise'),
|
|
468
|
-
title: z.string().optional().describe('New title'),
|
|
509
|
+
title: z.string().optional().describe('New title (omit to preserve the original)'),
|
|
510
|
+
content: z.string().optional().describe('New content body (mutually exclusive with file_path)'),
|
|
511
|
+
file_path: z.string().optional().describe('Path to file (mutually exclusive with content; stdio only)'),
|
|
512
|
+
content_type: z.string().optional().describe('MIME type hint (auto-detected if omitted)'),
|
|
469
513
|
if_match: z.string().optional().describe('RFC3339 updated_at concurrency guard'),
|
|
470
514
|
}, async (args) => {
|
|
471
515
|
const client = await getClientFn();
|
package/dist/tools/gm.d.ts
CHANGED
|
@@ -55,9 +55,9 @@ export declare const gmIngestInputSchema: z.ZodObject<{
|
|
|
55
55
|
}, "strip", z.ZodTypeAny, {
|
|
56
56
|
title: string;
|
|
57
57
|
content?: string | undefined;
|
|
58
|
+
file_path?: string | undefined;
|
|
58
59
|
source_uri?: string | undefined;
|
|
59
60
|
content_type?: string | undefined;
|
|
60
|
-
file_path?: string | undefined;
|
|
61
61
|
classification_hints?: {
|
|
62
62
|
domain?: string | undefined;
|
|
63
63
|
content_type?: string | undefined;
|
|
@@ -66,9 +66,9 @@ export declare const gmIngestInputSchema: z.ZodObject<{
|
|
|
66
66
|
}, {
|
|
67
67
|
title: string;
|
|
68
68
|
content?: string | undefined;
|
|
69
|
+
file_path?: string | undefined;
|
|
69
70
|
source_uri?: string | undefined;
|
|
70
71
|
content_type?: string | undefined;
|
|
71
|
-
file_path?: string | undefined;
|
|
72
72
|
classification_hints?: {
|
|
73
73
|
domain?: string | undefined;
|
|
74
74
|
content_type?: string | undefined;
|
package/dist/tools/kb.d.ts
CHANGED
|
@@ -255,15 +255,15 @@ export declare const createArticleInputSchema: z.ZodObject<{
|
|
|
255
255
|
domain_id: z.ZodOptional<z.ZodString>;
|
|
256
256
|
}, "strip", z.ZodTypeAny, {
|
|
257
257
|
title: string;
|
|
258
|
-
slug: string;
|
|
259
258
|
collection_id: string;
|
|
259
|
+
slug: string;
|
|
260
260
|
status?: "DRAFT" | "PUBLISHED" | undefined;
|
|
261
261
|
content?: string | undefined;
|
|
262
262
|
domain_id?: string | undefined;
|
|
263
263
|
}, {
|
|
264
264
|
title: string;
|
|
265
|
-
slug: string;
|
|
266
265
|
collection_id: string;
|
|
266
|
+
slug: string;
|
|
267
267
|
status?: "DRAFT" | "PUBLISHED" | undefined;
|
|
268
268
|
content?: string | undefined;
|
|
269
269
|
domain_id?: string | undefined;
|
|
@@ -399,12 +399,12 @@ export declare const promoteFromArtifactInputSchema: z.ZodObject<{
|
|
|
399
399
|
collection_id: z.ZodString;
|
|
400
400
|
status: z.ZodOptional<z.ZodEnum<["DRAFT", "PUBLISHED"]>>;
|
|
401
401
|
}, "strip", z.ZodTypeAny, {
|
|
402
|
-
artifact_id: string;
|
|
403
402
|
collection_id: string;
|
|
403
|
+
artifact_id: string;
|
|
404
404
|
status?: "DRAFT" | "PUBLISHED" | undefined;
|
|
405
405
|
}, {
|
|
406
|
-
artifact_id: string;
|
|
407
406
|
collection_id: string;
|
|
407
|
+
artifact_id: string;
|
|
408
408
|
status?: "DRAFT" | "PUBLISHED" | undefined;
|
|
409
409
|
}>;
|
|
410
410
|
export type PromoteFromArtifactInput = z.infer<typeof promoteFromArtifactInputSchema>;
|
package/dist/tools/lake.d.ts
CHANGED
|
@@ -194,6 +194,25 @@ export declare function handleSyncStatus(args: unknown): Promise<{
|
|
|
194
194
|
}>;
|
|
195
195
|
isError?: boolean;
|
|
196
196
|
}>;
|
|
197
|
+
export declare const archiveStatusInputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
198
|
+
export type ArchiveStatusInput = z.infer<typeof archiveStatusInputSchema>;
|
|
199
|
+
export declare const ARCHIVE_STATUS_TOOL_DEF: {
|
|
200
|
+
name: "tacit_lake_archive_status";
|
|
201
|
+
description: string;
|
|
202
|
+
inputSchema: {
|
|
203
|
+
type: "object";
|
|
204
|
+
properties: {};
|
|
205
|
+
required: string[];
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
export declare function buildArchiveStatusRequest(client: TacitClient, _input: ArchiveStatusInput): ToolRequest;
|
|
209
|
+
export declare function handleArchiveStatus(args: unknown): Promise<{
|
|
210
|
+
content: Array<{
|
|
211
|
+
type: 'text';
|
|
212
|
+
text: string;
|
|
213
|
+
}>;
|
|
214
|
+
isError?: boolean;
|
|
215
|
+
}>;
|
|
197
216
|
export declare const triggerSyncInputSchema: z.ZodObject<{
|
|
198
217
|
source_id: z.ZodString;
|
|
199
218
|
confirm_deletions: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -485,10 +504,10 @@ export declare const browseCatalogInputSchema: z.ZodObject<{
|
|
|
485
504
|
limit?: number | undefined;
|
|
486
505
|
origin?: string | undefined;
|
|
487
506
|
q?: string | undefined;
|
|
507
|
+
content_type?: string | undefined;
|
|
488
508
|
offset?: number | undefined;
|
|
489
509
|
source_id?: string | undefined;
|
|
490
510
|
catalog_status?: string | undefined;
|
|
491
|
-
content_type?: string | undefined;
|
|
492
511
|
subject_id?: string | undefined;
|
|
493
512
|
subject_needs_review?: boolean | undefined;
|
|
494
513
|
subject_layer?: string | undefined;
|
|
@@ -496,10 +515,10 @@ export declare const browseCatalogInputSchema: z.ZodObject<{
|
|
|
496
515
|
limit?: number | undefined;
|
|
497
516
|
origin?: string | undefined;
|
|
498
517
|
q?: string | undefined;
|
|
518
|
+
content_type?: string | undefined;
|
|
499
519
|
offset?: number | undefined;
|
|
500
520
|
source_id?: string | undefined;
|
|
501
521
|
catalog_status?: string | undefined;
|
|
502
|
-
content_type?: string | undefined;
|
|
503
522
|
subject_id?: string | undefined;
|
|
504
523
|
subject_needs_review?: boolean | undefined;
|
|
505
524
|
subject_layer?: string | undefined;
|
package/dist/tools/lake.js
CHANGED
|
@@ -211,6 +211,37 @@ export async function handleSyncStatus(args) {
|
|
|
211
211
|
}
|
|
212
212
|
return buildSyncStatusRequest(getClient(), parsed.data).execute();
|
|
213
213
|
}
|
|
214
|
+
// ─── tacit_lake_archive_status ───────────────────────────────────────────────
|
|
215
|
+
export const archiveStatusInputSchema = z.object({});
|
|
216
|
+
export const ARCHIVE_STATUS_TOOL_DEF = {
|
|
217
|
+
name: 'tacit_lake_archive_status',
|
|
218
|
+
description: 'Get Durable Archive health status for all data lake sources with archive cadence configured — per source: archive_cadence (seconds), last_archive_at, archive_artifact_count, is_stale. Route: GET /api/v1/org/lake/archive/status.',
|
|
219
|
+
inputSchema: {
|
|
220
|
+
type: 'object',
|
|
221
|
+
properties: {},
|
|
222
|
+
required: [],
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
export function buildArchiveStatusRequest(client, _input) {
|
|
226
|
+
return {
|
|
227
|
+
async execute() {
|
|
228
|
+
try {
|
|
229
|
+
const result = await client.get('/api/v1/org/lake/archive/status');
|
|
230
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
return apiErrorResult(err, 'tacit_lake_archive_status');
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
export async function handleArchiveStatus(args) {
|
|
239
|
+
const parsed = archiveStatusInputSchema.safeParse(args ?? {});
|
|
240
|
+
if (!parsed.success) {
|
|
241
|
+
return { content: [{ type: 'text', text: `Invalid input: ${parsed.error.message}` }], isError: true };
|
|
242
|
+
}
|
|
243
|
+
return buildArchiveStatusRequest(getClient(), parsed.data).execute();
|
|
244
|
+
}
|
|
214
245
|
// ─── tacit_lake_trigger_sync ─────────────────────────────────────────────────
|
|
215
246
|
export const triggerSyncInputSchema = z.object({
|
|
216
247
|
source_id: z.string().uuid().describe('Source to sync'),
|
|
@@ -430,8 +461,8 @@ export async function handleReclassify(args) {
|
|
|
430
461
|
export const writebackInputSchema = z.object({
|
|
431
462
|
source_id: z.string().uuid().describe('Source to write back to'),
|
|
432
463
|
artifact_id: z.string().uuid().describe('Artifact to write back'),
|
|
433
|
-
target_folder: z.string().optional().describe('Repo-relative folder to write into
|
|
434
|
-
slug: z.string().optional().describe('Filename slug (without extension)
|
|
464
|
+
target_folder: z.string().optional().describe('Repo-relative folder to write into. Accepted alone but does NOT change the committed path until custom-path commits ship — the file still lands at {write_back_path}/{artifact_id}.{ext}. Setting BOTH target_folder and slug is refused with 400'),
|
|
465
|
+
slug: z.string().optional().describe('Filename slug (without extension). Accepted alone but does NOT change the committed path until custom-path commits ship — the file still lands at {write_back_path}/{artifact_id}.{ext}. Setting BOTH slug and target_folder is refused with 400'),
|
|
435
466
|
frontmatter: z.object({
|
|
436
467
|
subject: z.string().optional(),
|
|
437
468
|
title: z.string().optional(),
|
|
@@ -448,8 +479,8 @@ export const WRITEBACK_TOOL_DEF = {
|
|
|
448
479
|
properties: {
|
|
449
480
|
source_id: { type: 'string', description: 'Source to write back to' },
|
|
450
481
|
artifact_id: { type: 'string', description: 'Artifact to write back' },
|
|
451
|
-
target_folder: { type: 'string', description: 'Repo-relative folder to write into
|
|
452
|
-
slug: { type: 'string', description: 'Filename slug (without extension)
|
|
482
|
+
target_folder: { type: 'string', description: 'Repo-relative folder to write into. Accepted alone but does NOT change the committed path until custom-path commits ship — the file still lands at {write_back_path}/{artifact_id}.{ext}. Setting BOTH target_folder and slug is refused with 400' },
|
|
483
|
+
slug: { type: 'string', description: 'Filename slug (without extension). Accepted alone but does NOT change the committed path until custom-path commits ship — the file still lands at {write_back_path}/{artifact_id}.{ext}. Setting BOTH slug and target_folder is refused with 400' },
|
|
453
484
|
frontmatter: { type: 'object', description: 'YAML frontmatter overrides: subject, title, supersedes, sensitivity, status' },
|
|
454
485
|
},
|
|
455
486
|
required: ['source_id', 'artifact_id'],
|
|
@@ -1005,6 +1036,10 @@ export function registerLakeTools(server, getClientFn) {
|
|
|
1005
1036
|
const client = await getClientFn();
|
|
1006
1037
|
return buildSyncStatusRequest(client, args).execute();
|
|
1007
1038
|
});
|
|
1039
|
+
server.tool('tacit_lake_archive_status', ARCHIVE_STATUS_TOOL_DEF.description, {}, async () => {
|
|
1040
|
+
const client = await getClientFn();
|
|
1041
|
+
return buildArchiveStatusRequest(client, {}).execute();
|
|
1042
|
+
});
|
|
1008
1043
|
server.tool('tacit_lake_trigger_sync', TRIGGER_SYNC_TOOL_DEF.description, triggerSyncInputSchema.shape, async (args) => {
|
|
1009
1044
|
const client = await getClientFn();
|
|
1010
1045
|
return buildTriggerSyncRequest(client, args).execute();
|
package/dist/tools/move.d.ts
CHANGED
|
@@ -51,80 +51,80 @@ export declare const moveInputSchema: z.ZodObject<{
|
|
|
51
51
|
}>]>, "many">>;
|
|
52
52
|
}, "strip", z.ZodTypeAny, {
|
|
53
53
|
portfolio_id?: string | undefined;
|
|
54
|
-
program_id?: string | undefined;
|
|
55
54
|
dossiers?: (string | {
|
|
56
55
|
name: string;
|
|
57
56
|
})[] | undefined;
|
|
57
|
+
program_id?: string | undefined;
|
|
58
58
|
}, {
|
|
59
59
|
portfolio_id?: string | undefined;
|
|
60
|
-
program_id?: string | undefined;
|
|
61
60
|
dossiers?: (string | {
|
|
62
61
|
name: string;
|
|
63
62
|
})[] | undefined;
|
|
63
|
+
program_id?: string | undefined;
|
|
64
64
|
}>>;
|
|
65
65
|
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
kb?: {
|
|
67
|
-
collections: (string | {
|
|
68
|
-
name: string;
|
|
69
|
-
slug?: string | undefined;
|
|
70
|
-
})[];
|
|
71
|
-
} | undefined;
|
|
72
66
|
pyramid?: {
|
|
73
67
|
portfolio_id?: string | undefined;
|
|
74
|
-
program_id?: string | undefined;
|
|
75
68
|
dossiers?: (string | {
|
|
76
69
|
name: string;
|
|
77
70
|
})[] | undefined;
|
|
71
|
+
program_id?: string | undefined;
|
|
78
72
|
} | undefined;
|
|
79
|
-
}, {
|
|
80
73
|
kb?: {
|
|
81
74
|
collections: (string | {
|
|
82
75
|
name: string;
|
|
83
76
|
slug?: string | undefined;
|
|
84
77
|
})[];
|
|
85
78
|
} | undefined;
|
|
79
|
+
}, {
|
|
86
80
|
pyramid?: {
|
|
87
81
|
portfolio_id?: string | undefined;
|
|
88
|
-
program_id?: string | undefined;
|
|
89
82
|
dossiers?: (string | {
|
|
90
83
|
name: string;
|
|
91
84
|
})[] | undefined;
|
|
85
|
+
program_id?: string | undefined;
|
|
92
86
|
} | undefined;
|
|
93
|
-
}>;
|
|
94
|
-
}, "strip", z.ZodTypeAny, {
|
|
95
|
-
artifact_id: string;
|
|
96
|
-
placement: {
|
|
97
87
|
kb?: {
|
|
98
88
|
collections: (string | {
|
|
99
89
|
name: string;
|
|
100
90
|
slug?: string | undefined;
|
|
101
91
|
})[];
|
|
102
92
|
} | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
placement: {
|
|
103
96
|
pyramid?: {
|
|
104
97
|
portfolio_id?: string | undefined;
|
|
105
|
-
program_id?: string | undefined;
|
|
106
98
|
dossiers?: (string | {
|
|
107
99
|
name: string;
|
|
108
100
|
})[] | undefined;
|
|
101
|
+
program_id?: string | undefined;
|
|
109
102
|
} | undefined;
|
|
110
|
-
};
|
|
111
|
-
}, {
|
|
112
|
-
artifact_id: string;
|
|
113
|
-
placement: {
|
|
114
103
|
kb?: {
|
|
115
104
|
collections: (string | {
|
|
116
105
|
name: string;
|
|
117
106
|
slug?: string | undefined;
|
|
118
107
|
})[];
|
|
119
108
|
} | undefined;
|
|
109
|
+
};
|
|
110
|
+
artifact_id: string;
|
|
111
|
+
}, {
|
|
112
|
+
placement: {
|
|
120
113
|
pyramid?: {
|
|
121
114
|
portfolio_id?: string | undefined;
|
|
122
|
-
program_id?: string | undefined;
|
|
123
115
|
dossiers?: (string | {
|
|
124
116
|
name: string;
|
|
125
117
|
})[] | undefined;
|
|
118
|
+
program_id?: string | undefined;
|
|
119
|
+
} | undefined;
|
|
120
|
+
kb?: {
|
|
121
|
+
collections: (string | {
|
|
122
|
+
name: string;
|
|
123
|
+
slug?: string | undefined;
|
|
124
|
+
})[];
|
|
126
125
|
} | undefined;
|
|
127
126
|
};
|
|
127
|
+
artifact_id: string;
|
|
128
128
|
}>;
|
|
129
129
|
export type MoveInput = z.infer<typeof moveInputSchema>;
|
|
130
130
|
export declare const MOVE_TOOL_DEF: {
|
package/dist/tools/outbox.d.ts
CHANGED
|
@@ -44,44 +44,44 @@ export declare const outboxWriteInputSchema: z.ZodObject<{
|
|
|
44
44
|
}>]>, "many">>;
|
|
45
45
|
}, "strip", z.ZodTypeAny, {
|
|
46
46
|
portfolio_id?: string | undefined;
|
|
47
|
-
program_id?: string | undefined;
|
|
48
47
|
dossiers?: (string | {
|
|
49
48
|
name: string;
|
|
50
49
|
})[] | undefined;
|
|
50
|
+
program_id?: string | undefined;
|
|
51
51
|
}, {
|
|
52
52
|
portfolio_id?: string | undefined;
|
|
53
|
-
program_id?: string | undefined;
|
|
54
53
|
dossiers?: (string | {
|
|
55
54
|
name: string;
|
|
56
55
|
})[] | undefined;
|
|
56
|
+
program_id?: string | undefined;
|
|
57
57
|
}>>;
|
|
58
58
|
}, "strip", z.ZodTypeAny, {
|
|
59
|
-
kb?: {
|
|
60
|
-
collections: (string | {
|
|
61
|
-
name: string;
|
|
62
|
-
slug?: string | undefined;
|
|
63
|
-
})[];
|
|
64
|
-
} | undefined;
|
|
65
59
|
pyramid?: {
|
|
66
60
|
portfolio_id?: string | undefined;
|
|
67
|
-
program_id?: string | undefined;
|
|
68
61
|
dossiers?: (string | {
|
|
69
62
|
name: string;
|
|
70
63
|
})[] | undefined;
|
|
64
|
+
program_id?: string | undefined;
|
|
71
65
|
} | undefined;
|
|
72
|
-
}, {
|
|
73
66
|
kb?: {
|
|
74
67
|
collections: (string | {
|
|
75
68
|
name: string;
|
|
76
69
|
slug?: string | undefined;
|
|
77
70
|
})[];
|
|
78
71
|
} | undefined;
|
|
72
|
+
}, {
|
|
79
73
|
pyramid?: {
|
|
80
74
|
portfolio_id?: string | undefined;
|
|
81
|
-
program_id?: string | undefined;
|
|
82
75
|
dossiers?: (string | {
|
|
83
76
|
name: string;
|
|
84
77
|
})[] | undefined;
|
|
78
|
+
program_id?: string | undefined;
|
|
79
|
+
} | undefined;
|
|
80
|
+
kb?: {
|
|
81
|
+
collections: (string | {
|
|
82
|
+
name: string;
|
|
83
|
+
slug?: string | undefined;
|
|
84
|
+
})[];
|
|
85
85
|
} | undefined;
|
|
86
86
|
}>;
|
|
87
87
|
content_origin: z.ZodDefault<z.ZodEnum<["agent", "human", "git_sync"]>>;
|
|
@@ -94,18 +94,18 @@ export declare const outboxWriteInputSchema: z.ZodObject<{
|
|
|
94
94
|
content: string;
|
|
95
95
|
title: string;
|
|
96
96
|
placement: {
|
|
97
|
-
kb?: {
|
|
98
|
-
collections: (string | {
|
|
99
|
-
name: string;
|
|
100
|
-
slug?: string | undefined;
|
|
101
|
-
})[];
|
|
102
|
-
} | undefined;
|
|
103
97
|
pyramid?: {
|
|
104
98
|
portfolio_id?: string | undefined;
|
|
105
|
-
program_id?: string | undefined;
|
|
106
99
|
dossiers?: (string | {
|
|
107
100
|
name: string;
|
|
108
101
|
})[] | undefined;
|
|
102
|
+
program_id?: string | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
kb?: {
|
|
105
|
+
collections: (string | {
|
|
106
|
+
name: string;
|
|
107
|
+
slug?: string | undefined;
|
|
108
|
+
})[];
|
|
109
109
|
} | undefined;
|
|
110
110
|
};
|
|
111
111
|
content_origin: "agent" | "human" | "git_sync";
|
|
@@ -118,18 +118,18 @@ export declare const outboxWriteInputSchema: z.ZodObject<{
|
|
|
118
118
|
content: string;
|
|
119
119
|
title: string;
|
|
120
120
|
placement: {
|
|
121
|
-
kb?: {
|
|
122
|
-
collections: (string | {
|
|
123
|
-
name: string;
|
|
124
|
-
slug?: string | undefined;
|
|
125
|
-
})[];
|
|
126
|
-
} | undefined;
|
|
127
121
|
pyramid?: {
|
|
128
122
|
portfolio_id?: string | undefined;
|
|
129
|
-
program_id?: string | undefined;
|
|
130
123
|
dossiers?: (string | {
|
|
131
124
|
name: string;
|
|
132
125
|
})[] | undefined;
|
|
126
|
+
program_id?: string | undefined;
|
|
127
|
+
} | undefined;
|
|
128
|
+
kb?: {
|
|
129
|
+
collections: (string | {
|
|
130
|
+
name: string;
|
|
131
|
+
slug?: string | undefined;
|
|
132
|
+
})[];
|
|
133
133
|
} | undefined;
|
|
134
134
|
};
|
|
135
135
|
autonomy_level?: "MENTAT" | "TWIN" | undefined;
|
package/dist/tools/registry.js
CHANGED
|
@@ -32,6 +32,7 @@ const ADMIN_ONLY = [
|
|
|
32
32
|
];
|
|
33
33
|
const GATE_ONLY = ['tacit_approve_gate', 'tacit_reject_gate'];
|
|
34
34
|
const READ_TOOLS = [
|
|
35
|
+
'tacit_lake_archive_status',
|
|
35
36
|
'tacit_workflow_prereqs',
|
|
36
37
|
'tacit_agent_approvals',
|
|
37
38
|
'tacit_agent_list',
|
|
@@ -209,8 +210,8 @@ function build() {
|
|
|
209
210
|
if (!exclusive.has(n))
|
|
210
211
|
add(n, classOf(n), 'https', false);
|
|
211
212
|
}
|
|
212
|
-
if (map.size !==
|
|
213
|
-
throw new Error(`tool registry expected
|
|
213
|
+
if (map.size !== 166)
|
|
214
|
+
throw new Error(`tool registry expected 166 tools, got ${map.size}`);
|
|
214
215
|
return map;
|
|
215
216
|
}
|
|
216
217
|
export const TOOL_REGISTRY = build();
|