@tacitai/mcp-server 0.7.0 → 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.
- package/dist/api-errors.d.ts +102 -0
- package/dist/api-errors.js +165 -0
- package/dist/autonomy.d.ts +46 -0
- package/dist/autonomy.js +118 -0
- package/dist/claude-config.d.ts +139 -0
- package/dist/claude-config.js +339 -0
- package/dist/cli-launch.d.ts +33 -0
- package/dist/cli-launch.js +178 -0
- package/dist/cli-login.d.ts +34 -0
- package/dist/cli-login.js +200 -0
- package/dist/cli-mode.d.ts +47 -0
- package/dist/cli-mode.js +170 -0
- package/dist/cli-profiles.d.ts +37 -0
- package/dist/cli-profiles.js +344 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +59 -458
- package/dist/client.d.ts +88 -52
- package/dist/client.js +195 -295
- package/dist/credentials.d.ts +81 -0
- package/dist/credentials.js +291 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +37 -89
- package/dist/oauth.d.ts +1 -1
- package/dist/oauth.js +5 -5
- package/dist/profile-store.d.ts +96 -0
- package/dist/profile-store.js +382 -0
- package/dist/prompt.d.ts +32 -0
- package/dist/prompt.js +99 -0
- package/dist/prompts.d.ts +2 -2
- package/dist/prompts.js +3 -3
- package/dist/server-mode.d.ts +65 -0
- package/dist/server-mode.js +99 -0
- package/dist/setup-migrate.d.ts +35 -0
- package/dist/setup-migrate.js +204 -0
- package/dist/setup.d.ts +41 -66
- package/dist/setup.js +361 -531
- package/dist/signin.d.ts +108 -0
- package/dist/signin.js +595 -0
- package/dist/tools/agents.d.ts +4 -4
- package/dist/tools/artifacts.d.ts +2 -0
- package/dist/tools/artifacts.js +8 -1
- package/dist/tools/errors.d.ts +12 -0
- package/dist/tools/errors.js +65 -0
- package/dist/tools/exec-route.d.ts +34 -0
- package/dist/tools/exec-route.js +101 -27
- package/dist/tools/iam.js +2 -3
- package/dist/tools/secretary.d.ts +1 -0
- package/dist/tools/secretary.js +2 -1
- package/dist/tools/synthesize.d.ts +37 -0
- package/dist/tools/synthesize.js +126 -7
- package/dist/tools/voice.d.ts +3 -2
- package/dist/tools/voice.js +70 -18
- package/dist/tools/workspaces.js +7 -4
- package/dist/version.d.ts +6 -0
- package/dist/version.js +18 -0
- package/dist/workflow-registry.d.ts +1 -0
- package/dist/workflow-registry.js +21 -0
- package/package.json +4 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,17 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TacitClient — REST/SSE client over
|
|
2
|
+
* TacitClient — REST/SSE client over an API URL it is GIVEN.
|
|
3
3
|
*
|
|
4
4
|
* Security invariants (enforced here and NEVER relaxed):
|
|
5
|
-
* -
|
|
5
|
+
* - The token is NEVER written to any output stream (stdout, stderr, logs).
|
|
6
6
|
* - The Authorization header value is NEVER logged at any level.
|
|
7
7
|
* - No anthropic/openai SDK import.
|
|
8
|
-
* -
|
|
8
|
+
* - This module reads no credential from the environment. Credentials arrive as
|
|
9
|
+
* constructor options from credentials.ts (levels 0/1/2/4/5), the only
|
|
10
|
+
* module that reads them (MV-1542c step 1.4).
|
|
9
11
|
*/
|
|
12
|
+
export { type AutonomyLevel, parseAutonomyLevel, autonomyAtLeast, getCachedAutonomy, ensureAutonomy, } from './autonomy.js';
|
|
13
|
+
/** GET /api/v1/auth/whoami (every authenticated credential kind). */
|
|
14
|
+
export interface WhoAmI {
|
|
15
|
+
credential_type: 'jwt' | 'iam_token' | 'dev_token' | 'api_key' | 'hmac_session';
|
|
16
|
+
workspace_id: string;
|
|
17
|
+
workspace_name: string;
|
|
18
|
+
user_id?: string | null;
|
|
19
|
+
person_id?: string | null;
|
|
20
|
+
identity_email?: string | null;
|
|
21
|
+
is_owner: boolean;
|
|
22
|
+
autonomy_level?: string | null;
|
|
23
|
+
expires_at?: string | null;
|
|
24
|
+
token_id?: string | null;
|
|
25
|
+
device_label?: string | null;
|
|
26
|
+
used_owner_fallback?: boolean;
|
|
27
|
+
cli_login_ttl_days?: number;
|
|
28
|
+
}
|
|
10
29
|
export interface TacitClientOptions {
|
|
11
30
|
apiUrl?: string;
|
|
12
31
|
appUrl?: string;
|
|
13
32
|
token?: string;
|
|
33
|
+
/** HMAC X-Tacit-Session credential (eval/oracle harness); wins over `token` when set. */
|
|
34
|
+
sessionToken?: string;
|
|
14
35
|
workspaceId?: string;
|
|
36
|
+
workspaceName?: string;
|
|
37
|
+
/** Where the credential came from, for the 401 message (profile or environment). Default: profile. */
|
|
38
|
+
credentialSource?: 'profile' | 'env';
|
|
39
|
+
/** Name of the environment variable that held an env credential (for the 401 message). */
|
|
40
|
+
envVar?: string;
|
|
15
41
|
/** Override the root directory used to locate .tacit/sync.json (default: process.cwd()). */
|
|
16
42
|
rootDir?: string;
|
|
17
43
|
}
|
|
@@ -19,37 +45,56 @@ export declare class TacitClient {
|
|
|
19
45
|
private readonly apiUrl;
|
|
20
46
|
private readonly _appUrl;
|
|
21
47
|
private token;
|
|
48
|
+
private readonly sessionToken;
|
|
22
49
|
private readonly _fetch;
|
|
23
50
|
private readonly _rootDir;
|
|
24
51
|
private _workspaceId;
|
|
25
52
|
private _workspaceName;
|
|
53
|
+
private readonly _credentialSource;
|
|
54
|
+
private readonly _envVar;
|
|
26
55
|
private _initialized;
|
|
27
56
|
/**
|
|
28
|
-
* @param fetchOrOpts -
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @param opts - Additional options (apiUrl, token, workspaceId, rootDir).
|
|
32
|
-
* Only used when fetchOrOpts is a fetch function.
|
|
57
|
+
* @param fetchOrOpts - A custom fetch implementation (for testing) or a
|
|
58
|
+
* TacitClientOptions object.
|
|
59
|
+
* @param opts - Options when the first argument is a fetch function.
|
|
33
60
|
*/
|
|
34
61
|
constructor(fetchOrOpts?: typeof globalThis.fetch | TacitClientOptions, opts?: TacitClientOptions);
|
|
62
|
+
/** Values that fill the `<workspace>` / credential slots of api-errors.ts messages. */
|
|
63
|
+
private errorContext;
|
|
35
64
|
get workspaceId(): string;
|
|
36
65
|
get workspaceName(): string | null;
|
|
66
|
+
/** GET /api/v1/auth/whoami. Throws TokenExpiredError (401) or TacitApiError. */
|
|
67
|
+
whoami(timeoutMs?: number): Promise<WhoAmI>;
|
|
68
|
+
/** Adopt a verified identity: fills a missing workspace id and the name; skips the /workspaces/mine lookup. */
|
|
69
|
+
applyIdentity(who: Pick<WhoAmI, 'workspace_id' | 'workspace_name'>): void;
|
|
70
|
+
/**
|
|
71
|
+
* Decoded payload of an HMAC session credential (carries the autonomy claim), or null
|
|
72
|
+
* when the client does not hold one. Never returns the token itself.
|
|
73
|
+
*/
|
|
74
|
+
hmacSessionClaims(): Record<string, unknown> | null;
|
|
75
|
+
/**
|
|
76
|
+
* Fill in the workspace name for a client built without one (level-2 env credentials on an
|
|
77
|
+
* old server). Never replaces a workspace id that is already set.
|
|
78
|
+
*/
|
|
37
79
|
initialize(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Switch workspace. Session JWT credentials only (G4, D-45): any other credential kind
|
|
82
|
+
* switches by choosing another saved login, so it gets a named error instead of a 401.
|
|
83
|
+
*/
|
|
38
84
|
switchWorkspace(workspaceId: string): Promise<{
|
|
39
85
|
workspace_id: string;
|
|
40
86
|
name: string;
|
|
41
87
|
}>;
|
|
42
88
|
/**
|
|
43
89
|
* Resolve the workspace ID:
|
|
44
|
-
* 1. Return this._workspaceId if already set (
|
|
45
|
-
* 2.
|
|
46
|
-
* 3.
|
|
47
|
-
* 4. Return null if no source is available.
|
|
90
|
+
* 1. Return this._workspaceId if already set (constructor options / profile / whoami).
|
|
91
|
+
* 2. Fall back to <rootDir>/.tacit/sync.json.
|
|
92
|
+
* 3. Return null if no source is available.
|
|
48
93
|
*/
|
|
49
94
|
resolveWorkspaceId(): Promise<string | null>;
|
|
50
95
|
/**
|
|
51
96
|
* Build a user-facing URL for an entity in the TACIT web app.
|
|
52
|
-
* Returns null when
|
|
97
|
+
* Returns null when no app URL is configured.
|
|
53
98
|
*
|
|
54
99
|
* Route patterns (TanStack file-based routing in tacitai.app.beta):
|
|
55
100
|
* artifact → /view/:id
|
|
@@ -63,15 +108,17 @@ export declare class TacitClient {
|
|
|
63
108
|
/**
|
|
64
109
|
* Build auth headers. Value is NEVER written to logs.
|
|
65
110
|
*
|
|
66
|
-
* MV-1515n
|
|
67
|
-
* X-Tacit-Session
|
|
68
|
-
* format), it takes precedence and is sent as X-Tacit-Session instead of
|
|
69
|
-
* Authorization — this is additive and does not change default behavior
|
|
70
|
-
* (Bearer via TACIT_TOKEN) when TACIT_SESSION_TOKEN is unset.
|
|
111
|
+
* An HMAC session credential (explicit `sessionToken`, MV-1515n harness, or an HMAC-shaped
|
|
112
|
+
* token) is sent as X-Tacit-Session; everything else as a Bearer token.
|
|
71
113
|
*/
|
|
72
114
|
private authHeaders;
|
|
115
|
+
/**
|
|
116
|
+
* Every request carries a credential, so none may follow a redirect (L-7): a 307/308 would re-send
|
|
117
|
+
* the Authorization / X-Tacit-Session header and body to another origin. A 3xx is an error.
|
|
118
|
+
*/
|
|
119
|
+
private send;
|
|
73
120
|
/** GET request returning parsed JSON. */
|
|
74
|
-
get<T = unknown>(endpoint: string, params?: Record<string, string | number | boolean | undefined
|
|
121
|
+
get<T = unknown>(endpoint: string, params?: Record<string, string | number | boolean | undefined>, timeoutMs?: number): Promise<T>;
|
|
75
122
|
/** POST request returning parsed JSON. `extraHeaders` merges on top of auth headers (e.g. If-Match). */
|
|
76
123
|
post<T = unknown>(endpoint: string, body: unknown, extraHeaders?: Record<string, string>, timeoutMs?: number): Promise<T>;
|
|
77
124
|
/** PUT request returning parsed JSON. */
|
|
@@ -93,51 +140,40 @@ export declare class TacitApiError extends Error {
|
|
|
93
140
|
readonly statusCode: number;
|
|
94
141
|
readonly body: string;
|
|
95
142
|
readonly endpoint: string;
|
|
96
|
-
|
|
143
|
+
/** Workspace name when the client knew it, for the <workspace> slot of api-errors.ts messages. */
|
|
144
|
+
readonly workspace: string | null;
|
|
145
|
+
constructor(statusCode: number, body: string, endpoint: string,
|
|
146
|
+
/** Workspace name when the client knew it, for the <workspace> slot of api-errors.ts messages. */
|
|
147
|
+
workspace?: string | null);
|
|
97
148
|
}
|
|
98
149
|
/**
|
|
99
|
-
* Thrown when the API returns 401 —
|
|
100
|
-
*
|
|
150
|
+
* Thrown when the API returns 401 — the credential has expired or been revoked.
|
|
151
|
+
* Tools catch this and surface a user-actionable message.
|
|
101
152
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* re-auth needed). After 7 days, full device-auth is required.
|
|
153
|
+
* `code` is the server's named error code when the 401 body carried one
|
|
154
|
+
* (e.g. MEMBERSHIP_NOT_FOUND, CREDENTIAL_BINDING_MISMATCH); null for an old server.
|
|
105
155
|
*
|
|
106
156
|
* Security invariant: token plaintext is NEVER included in this error.
|
|
107
157
|
*/
|
|
108
158
|
export declare class TokenExpiredError extends Error {
|
|
109
159
|
readonly renewalUrl: string;
|
|
110
160
|
readonly setupCommand: string;
|
|
111
|
-
|
|
161
|
+
readonly code: string | null;
|
|
162
|
+
/** Workspace name when the client knew it. */
|
|
163
|
+
readonly workspace: string | null;
|
|
164
|
+
readonly statusCode = 401;
|
|
165
|
+
constructor(renewalUrl: string, setupCommand: string, code?: string | null,
|
|
166
|
+
/** The api-errors.ts message for this 401. When absent, the generic renewal text is used. */
|
|
167
|
+
message?: string,
|
|
168
|
+
/** Workspace name when the client knew it. */
|
|
169
|
+
workspace?: string | null);
|
|
112
170
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
workspace_name?: string;
|
|
117
|
-
api_url: string;
|
|
118
|
-
app_url?: string;
|
|
119
|
-
token: string;
|
|
120
|
-
created_at?: string;
|
|
121
|
-
expires_at?: string;
|
|
171
|
+
/** `tacit_switch_workspace` with a credential that is not a session JWT (D-45). */
|
|
172
|
+
export declare class SwitchNotSupportedError extends Error {
|
|
173
|
+
constructor();
|
|
122
174
|
}
|
|
123
|
-
export declare function loadProfile(name: string): ProfileData;
|
|
124
|
-
/**
|
|
125
|
-
* 5-level resolution chain (FEAT-255 §2.1). Empty-string-as-unset rule applies.
|
|
126
|
-
* Returns TacitClientOptions from the first matching level.
|
|
127
|
-
* Throws on set-but-invalid states (profile missing, WORKSPACE_ID without TOKEN).
|
|
128
|
-
*/
|
|
129
|
-
export declare function resolveProfileOptions(): TacitClientOptions;
|
|
130
175
|
/** HTTPS mode: bind the caller's token/apiUrl/principal to everything run inside fn. */
|
|
131
176
|
export declare function runWithRequestContext<T>(token: string, apiUrl: string, fn: () => Promise<T>, principal?: string): Promise<T>;
|
|
132
177
|
export declare function getRequestPrincipal(): string | null;
|
|
133
|
-
export
|
|
134
|
-
export declare function parseAutonomyLevel(raw: unknown): AutonomyLevel;
|
|
135
|
-
export declare function autonomyAtLeast(current: AutonomyLevel, required: AutonomyLevel): boolean;
|
|
136
|
-
export declare function getRequestAutonomy(principal: string): Promise<AutonomyLevel | {
|
|
137
|
-
error: 'token_expired';
|
|
138
|
-
}>;
|
|
139
|
-
export declare function ensureAutonomy(principal: string): Promise<AutonomyLevel | {
|
|
140
|
-
error: 'token_expired';
|
|
141
|
-
}>;
|
|
142
|
-
export declare function getCachedAutonomy(principal: string): AutonomyLevel | null;
|
|
178
|
+
export declare function setDefaultClient(client: TacitClient | null): void;
|
|
143
179
|
export declare function getClient(): TacitClient;
|