@agentteams/cli 0.1.83 → 0.1.84
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/.eslintcache +1 -1
- package/dist/auth/activeCredential.d.ts +22 -0
- package/dist/auth/activeCredential.d.ts.map +1 -0
- package/dist/auth/activeCredential.js +25 -0
- package/dist/auth/activeCredential.js.map +1 -0
- package/dist/auth/credentialStore.d.ts +89 -0
- package/dist/auth/credentialStore.d.ts.map +1 -0
- package/dist/auth/credentialStore.js +254 -0
- package/dist/auth/credentialStore.js.map +1 -0
- package/dist/auth/personalTokenClient.d.ts +155 -0
- package/dist/auth/personalTokenClient.d.ts.map +1 -0
- package/dist/auth/personalTokenClient.js +312 -0
- package/dist/auth/personalTokenClient.js.map +1 -0
- package/dist/auth/personalTokenStore.d.ts +16 -0
- package/dist/auth/personalTokenStore.d.ts.map +1 -0
- package/dist/auth/personalTokenStore.js +27 -0
- package/dist/auth/personalTokenStore.js.map +1 -0
- package/dist/commands/agentConfig.d.ts.map +1 -1
- package/dist/commands/agentConfig.js +8 -6
- package/dist/commands/agentConfig.js.map +1 -1
- package/dist/commands/auth.d.ts +97 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +245 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +16 -2
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/convention.d.ts +11 -0
- package/dist/commands/convention.d.ts.map +1 -1
- package/dist/commands/convention.js +35 -11
- package/dist/commands/convention.js.map +1 -1
- package/dist/commands/dependency.d.ts.map +1 -1
- package/dist/commands/dependency.js +8 -6
- package/dist/commands/dependency.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +19 -14
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +17 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +90 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +101 -15
- package/dist/index.js.map +1 -1
- package/dist/mcp/context.d.ts +15 -1
- package/dist/mcp/context.d.ts.map +1 -1
- package/dist/mcp/context.js +24 -5
- package/dist/mcp/context.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +5 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +25 -22
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp-registration/clients.d.ts.map +1 -1
- package/dist/mcp-registration/clients.js +1 -9
- package/dist/mcp-registration/clients.js.map +1 -1
- package/dist/mcp-registration/doctor.d.ts +38 -0
- package/dist/mcp-registration/doctor.d.ts.map +1 -0
- package/dist/mcp-registration/doctor.js +379 -0
- package/dist/mcp-registration/doctor.js.map +1 -0
- package/dist/mcp-registration/index.d.ts +7 -5
- package/dist/mcp-registration/index.d.ts.map +1 -1
- package/dist/mcp-registration/index.js +46 -21
- package/dist/mcp-registration/index.js.map +1 -1
- package/dist/mcp-registration/install.d.ts.map +1 -1
- package/dist/mcp-registration/install.js +12 -15
- package/dist/mcp-registration/install.js.map +1 -1
- package/dist/mcp-registration/render.d.ts +8 -6
- package/dist/mcp-registration/render.d.ts.map +1 -1
- package/dist/mcp-registration/render.js +15 -36
- package/dist/mcp-registration/render.js.map +1 -1
- package/dist/mcp-registration/serverSpec.d.ts +31 -18
- package/dist/mcp-registration/serverSpec.d.ts.map +1 -1
- package/dist/mcp-registration/serverSpec.js +36 -20
- package/dist/mcp-registration/serverSpec.js.map +1 -1
- package/dist/mcp-registration/types.d.ts +0 -3
- package/dist/mcp-registration/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/apiKeyInput.d.ts +16 -0
- package/dist/utils/apiKeyInput.d.ts.map +1 -0
- package/dist/utils/apiKeyInput.js +47 -0
- package/dist/utils/apiKeyInput.js.map +1 -0
- package/dist/utils/authServer.d.ts +32 -3
- package/dist/utils/authServer.d.ts.map +1 -1
- package/dist/utils/authServer.js +46 -6
- package/dist/utils/authServer.js.map +1 -1
- package/dist/utils/config.d.ts +118 -15
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +182 -8
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +16 -0
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/httpClient.d.ts.map +1 -1
- package/dist/utils/httpClient.js +25 -0
- package/dist/utils/httpClient.js.map +1 -1
- package/dist/utils/initOutput.d.ts.map +1 -1
- package/dist/utils/initOutput.js +30 -0
- package/dist/utils/initOutput.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { PROJECT_SCOPE_FILE_MODE, USER_SCOPE_FILE_MODE, writeConfigFileAtomicall
|
|
|
3
3
|
import { findClient, MCP_CLIENTS } from './clients.js';
|
|
4
4
|
import { detectClients } from './detect.js';
|
|
5
5
|
import { McpConfigParseError, upsertContainerEntry } from './jsonc.js';
|
|
6
|
-
import { buildEntryValue,
|
|
6
|
+
import { buildEntryValue, redactKeyMaterial, renderConfigSnippet, renderVendorCommandLine } from './render.js';
|
|
7
7
|
import { buildServerSpec, MCP_SERVER_NAME } from './serverSpec.js';
|
|
8
8
|
import { runVendorCommand } from './vendorCommand.js';
|
|
9
9
|
function firstLines(text, limit = 4) {
|
|
@@ -22,9 +22,8 @@ function installViaVendorCommand(options, configPath, manualSnippet) {
|
|
|
22
22
|
if (!vendor)
|
|
23
23
|
throw new Error(`No vendor command configured for ${client.id}/${scope}`);
|
|
24
24
|
const spec = buildServerSpec({
|
|
25
|
-
credentials: options.credentials,
|
|
26
|
-
secretMode: scope === 'user' ? 'literal' : 'reference',
|
|
27
25
|
serverEntry: options.serverEntry,
|
|
26
|
+
context: options.context,
|
|
28
27
|
});
|
|
29
28
|
const executable = client.executables[0];
|
|
30
29
|
const runner = options.vendorRunner ?? runVendorCommand;
|
|
@@ -38,9 +37,9 @@ function installViaVendorCommand(options, configPath, manualSnippet) {
|
|
|
38
37
|
manualSnippet,
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
const combined =
|
|
40
|
+
// Registration passes no credential, so there is no value of ours to redact — but a
|
|
41
|
+
// vendor CLI echoing its own argv/environment on failure can still surface a `key_`.
|
|
42
|
+
const combined = redactKeyMaterial(`${outcome.stdout}\n${outcome.stderr}`);
|
|
44
43
|
const alreadyRegistered = (vendor.alreadyRegisteredPatterns ?? []).some((pattern) => pattern.test(combined));
|
|
45
44
|
if (alreadyRegistered) {
|
|
46
45
|
return {
|
|
@@ -75,10 +74,8 @@ function installViaJsonMerge(options, configPath, manualSnippet) {
|
|
|
75
74
|
throw new Error(`No container key configured for ${client.id}/${scope}`);
|
|
76
75
|
const base = { clientId: client.id, scope, strategy: definition.strategy, configPath };
|
|
77
76
|
const spec = buildServerSpec({
|
|
78
|
-
credentials: options.credentials,
|
|
79
|
-
// Project files are committable, so they never receive a literal key.
|
|
80
|
-
secretMode: scope === 'user' ? 'literal' : 'reference',
|
|
81
77
|
serverEntry: options.serverEntry,
|
|
78
|
+
context: options.context,
|
|
82
79
|
});
|
|
83
80
|
let source = '';
|
|
84
81
|
if (existsSync(configPath)) {
|
|
@@ -99,7 +96,7 @@ function installViaJsonMerge(options, configPath, manualSnippet) {
|
|
|
99
96
|
edited = upsertContainerEntry(source, {
|
|
100
97
|
containerKey,
|
|
101
98
|
entryKey: serverName,
|
|
102
|
-
entryValue: buildEntryValue(definition.entryShape ?? 'plain', spec
|
|
99
|
+
entryValue: buildEntryValue(definition.entryShape ?? 'plain', spec),
|
|
103
100
|
});
|
|
104
101
|
}
|
|
105
102
|
catch (error) {
|
|
@@ -145,9 +142,8 @@ export function installClient(options) {
|
|
|
145
142
|
const definition = client.scopes[scope];
|
|
146
143
|
const configPath = definition.configPath(options.context);
|
|
147
144
|
const displaySpec = buildServerSpec({
|
|
148
|
-
credentials: options.credentials,
|
|
149
|
-
secretMode: 'reference',
|
|
150
145
|
serverEntry: options.serverEntry,
|
|
146
|
+
context: options.context,
|
|
151
147
|
});
|
|
152
148
|
const manualSnippet = renderConfigSnippet(client, scope, displaySpec, serverName);
|
|
153
149
|
if (definition.strategy === 'configOnly') {
|
|
@@ -208,7 +204,8 @@ export function buildBatchPlan(options) {
|
|
|
208
204
|
* the collected outcomes.
|
|
209
205
|
*/
|
|
210
206
|
export function runBatchInstall(options) {
|
|
211
|
-
const
|
|
207
|
+
const scope = options.scope ?? 'user';
|
|
208
|
+
const plan = buildBatchPlan({ ...options, scope });
|
|
212
209
|
const results = [];
|
|
213
210
|
for (const entry of plan.entries) {
|
|
214
211
|
const client = findClient(entry.clientId);
|
|
@@ -217,7 +214,7 @@ export function runBatchInstall(options) {
|
|
|
217
214
|
if (!entry.applicable) {
|
|
218
215
|
results.push({
|
|
219
216
|
clientId: entry.clientId,
|
|
220
|
-
scope:
|
|
217
|
+
scope: entry.scope,
|
|
221
218
|
strategy: entry.strategy,
|
|
222
219
|
configPath: entry.targetPath,
|
|
223
220
|
outcome: entry.strategy === 'configOnly' ? 'SKIPPED_CONFIG_ONLY' : 'SKIPPED_NOT_DETECTED',
|
|
@@ -227,7 +224,7 @@ export function runBatchInstall(options) {
|
|
|
227
224
|
}
|
|
228
225
|
results.push(installClient({
|
|
229
226
|
client,
|
|
230
|
-
scope:
|
|
227
|
+
scope: entry.scope,
|
|
231
228
|
credentials: options.credentials,
|
|
232
229
|
context: options.context,
|
|
233
230
|
serverEntry: options.serverEntry,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/mcp-registration/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,yBA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AED,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { McpClientDefinition, McpEntryShape, McpScope,
|
|
1
|
+
import type { McpClientDefinition, McpEntryShape, McpScope, McpServerSpec } from './types.js';
|
|
2
2
|
/** Serialize the AgentTeams server entry in the shape the target client expects. */
|
|
3
|
-
export declare function buildEntryValue(shape: McpEntryShape, spec: McpServerSpec
|
|
3
|
+
export declare function buildEntryValue(shape: McpEntryShape, spec: McpServerSpec): Record<string, unknown>;
|
|
4
4
|
/**
|
|
5
5
|
* The copy-pasteable config fragment for one client/scope. This is the escape
|
|
6
6
|
* hatch every failure path points at, so it must be complete on its own: the
|
|
@@ -10,9 +10,11 @@ export declare function renderConfigSnippet(client: McpClientDefinition, scope:
|
|
|
10
10
|
/** The equivalent vendor command, for users who prefer to run it themselves. */
|
|
11
11
|
export declare function renderVendorCommandLine(client: McpClientDefinition, scope: McpScope, spec: McpServerSpec, serverName: string): string | null;
|
|
12
12
|
/**
|
|
13
|
-
* Strip
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Strip AgentTeams key material from vendor output before it reaches a terminal or a log.
|
|
14
|
+
*
|
|
15
|
+
* Registration itself no longer holds a credential — the server spec embeds nothing — so
|
|
16
|
+
* there is no value to pass in. What remains is that vendor CLIs echo their own argv and
|
|
17
|
+
* environment on failure, and that output can carry a `key_` this process never saw.
|
|
16
18
|
*/
|
|
17
|
-
export declare function
|
|
19
|
+
export declare function redactKeyMaterial(text: string): string;
|
|
18
20
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9F,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBlG;AAwBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,aAAa,EACnB,UAAU,EAAE,MAAM,GACjB,MAAM,CAWR;AAED,gFAAgF;AAChF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,aAAa,EACnB,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAMf;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -1,32 +1,19 @@
|
|
|
1
|
-
import { CREDENTIAL_ENV_KEYS } from './serverSpec.js';
|
|
2
|
-
function referencedSpec(spec, reference) {
|
|
3
|
-
if (reference !== 'opencodeEnv')
|
|
4
|
-
return spec;
|
|
5
|
-
const apiKey = spec.env[CREDENTIAL_ENV_KEYS.apiKey];
|
|
6
|
-
if (apiKey !== `\${${CREDENTIAL_ENV_KEYS.apiKey}}`)
|
|
7
|
-
return spec;
|
|
8
|
-
return {
|
|
9
|
-
...spec,
|
|
10
|
-
env: { ...spec.env, [CREDENTIAL_ENV_KEYS.apiKey]: `{env:${CREDENTIAL_ENV_KEYS.apiKey}}` },
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
1
|
/** Serialize the AgentTeams server entry in the shape the target client expects. */
|
|
14
|
-
export function buildEntryValue(shape, spec
|
|
15
|
-
const clientSpec = referencedSpec(spec, reference);
|
|
2
|
+
export function buildEntryValue(shape, spec) {
|
|
16
3
|
if (shape === 'opencode') {
|
|
17
4
|
return {
|
|
18
5
|
type: 'local',
|
|
19
|
-
command: [
|
|
20
|
-
environment: { ...
|
|
6
|
+
command: [spec.command, ...spec.args],
|
|
7
|
+
environment: { ...spec.env },
|
|
21
8
|
enabled: true,
|
|
22
9
|
};
|
|
23
10
|
}
|
|
24
11
|
const entry = {};
|
|
25
12
|
if (shape === 'stdio')
|
|
26
13
|
entry.type = 'stdio';
|
|
27
|
-
entry.command =
|
|
28
|
-
entry.args = [...
|
|
29
|
-
entry.env = { ...
|
|
14
|
+
entry.command = spec.command;
|
|
15
|
+
entry.args = [...spec.args];
|
|
16
|
+
entry.env = { ...spec.env };
|
|
30
17
|
return entry;
|
|
31
18
|
}
|
|
32
19
|
function tomlString(value) {
|
|
@@ -38,11 +25,7 @@ function renderCodexToml(serverName, spec) {
|
|
|
38
25
|
`command = ${tomlString(spec.command)}`,
|
|
39
26
|
`args = [${spec.args.map(tomlString).join(', ')}]`,
|
|
40
27
|
];
|
|
41
|
-
const
|
|
42
|
-
if (apiKey === `\${${CREDENTIAL_ENV_KEYS.apiKey}}`) {
|
|
43
|
-
lines.push(`env_vars = [${tomlString(CREDENTIAL_ENV_KEYS.apiKey)}]`);
|
|
44
|
-
}
|
|
45
|
-
const envEntries = Object.entries(spec.env).filter(([key, value]) => key !== CREDENTIAL_ENV_KEYS.apiKey || value !== `\${${CREDENTIAL_ENV_KEYS.apiKey}}`);
|
|
28
|
+
const envEntries = Object.entries(spec.env);
|
|
46
29
|
if (envEntries.length > 0) {
|
|
47
30
|
lines.push('', `[mcp_servers.${serverName}.env]`);
|
|
48
31
|
for (const [key, value] of envEntries) {
|
|
@@ -62,7 +45,7 @@ export function renderConfigSnippet(client, scope, spec, serverName) {
|
|
|
62
45
|
return renderCodexToml(serverName, spec);
|
|
63
46
|
}
|
|
64
47
|
const containerKey = definition.containerKey;
|
|
65
|
-
const entry = buildEntryValue(definition.entryShape ?? 'plain', spec
|
|
48
|
+
const entry = buildEntryValue(definition.entryShape ?? 'plain', spec);
|
|
66
49
|
const document = containerKey ? { [containerKey]: { [serverName]: entry } } : { [serverName]: entry };
|
|
67
50
|
return JSON.stringify(document, null, 2);
|
|
68
51
|
}
|
|
@@ -75,17 +58,13 @@ export function renderVendorCommandLine(client, scope, spec, serverName) {
|
|
|
75
58
|
return [client.executables[0], ...args].join(' ');
|
|
76
59
|
}
|
|
77
60
|
/**
|
|
78
|
-
* Strip
|
|
79
|
-
*
|
|
80
|
-
*
|
|
61
|
+
* Strip AgentTeams key material from vendor output before it reaches a terminal or a log.
|
|
62
|
+
*
|
|
63
|
+
* Registration itself no longer holds a credential — the server spec embeds nothing — so
|
|
64
|
+
* there is no value to pass in. What remains is that vendor CLIs echo their own argv and
|
|
65
|
+
* environment on failure, and that output can carry a `key_` this process never saw.
|
|
81
66
|
*/
|
|
82
|
-
export function
|
|
83
|
-
|
|
84
|
-
for (const secret of secrets) {
|
|
85
|
-
if (!secret || secret.length < 4)
|
|
86
|
-
continue;
|
|
87
|
-
redacted = redacted.split(secret).join('***');
|
|
88
|
-
}
|
|
89
|
-
return redacted;
|
|
67
|
+
export function redactKeyMaterial(text) {
|
|
68
|
+
return text.replace(/(?<![A-Za-z0-9_-])key_[A-Za-z0-9][A-Za-z0-9_-]{7,}/g, '***');
|
|
90
69
|
}
|
|
91
70
|
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/mcp-registration/render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/mcp-registration/render.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,MAAM,UAAU,eAAe,CAAC,KAAoB,EAAE,IAAmB;IACvE,IAAI,KAAK,KAAK,UAAU,EAAE,CAAC;QACzB,OAAO;YACL,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;YACrC,WAAW,EAAE,EAAE,G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AE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,qDAAqD,EAAE,KAAK,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -1,31 +1,44 @@
|
|
|
1
|
-
import type { McpServerSpec } from './types.js';
|
|
1
|
+
import type { McpPathContext, McpServerSpec } from './types.js';
|
|
2
2
|
/** Server name registered in every client. Kept stable so re-runs update rather than duplicate. */
|
|
3
3
|
export declare const MCP_SERVER_NAME = "agentteams";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/** Published package the `npx` fallback runs. */
|
|
5
|
+
export declare const MCP_RUNTIME_PACKAGE = "@agentteams/cli";
|
|
6
|
+
/** Name of the globally installed executable, when there is one. */
|
|
7
|
+
export declare const MCP_GLOBAL_EXECUTABLE = "agentteams";
|
|
8
|
+
/**
|
|
9
|
+
* Project identity for command context and human-readable output only.
|
|
10
|
+
*
|
|
11
|
+
* There is no credential field on purpose: the generated server spec embeds nothing,
|
|
12
|
+
* and `agentteams mcp` resolves project config plus the OS credential store at request
|
|
13
|
+
* time. Re-adding one here would put a secret back into a client config file.
|
|
14
|
+
*/
|
|
10
15
|
export interface McpCredentials {
|
|
11
|
-
apiKey: string;
|
|
12
16
|
projectId: string;
|
|
13
17
|
teamId: string;
|
|
14
18
|
apiUrl: string;
|
|
15
19
|
}
|
|
16
|
-
/**
|
|
17
|
-
* `literal` writes the real API key into the client's own config file — only
|
|
18
|
-
* ever used for user-scope `install`, where the file lives outside the repo and
|
|
19
|
-
* is chmod 0600. Everything a human can read (`config` output, dry-run plans,
|
|
20
|
-
* project-scope files that get committed) uses `reference`. The renderer then
|
|
21
|
-
* converts that marker to each client's supported inheritance syntax.
|
|
22
|
-
*/
|
|
23
|
-
export type SecretMode = 'literal' | 'reference';
|
|
24
20
|
export interface BuildServerSpecOptions {
|
|
25
|
-
credentials: McpCredentials;
|
|
26
|
-
secretMode: SecretMode;
|
|
27
21
|
/** Absolute path to a local `cli/dist/index.js`; omit to use the published package. */
|
|
28
22
|
serverEntry?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Registration context. When present, the spec is chosen from what this machine can
|
|
25
|
+
* actually spawn; when absent, the global executable is assumed.
|
|
26
|
+
*/
|
|
27
|
+
context?: McpPathContext;
|
|
28
|
+
/** Injection seam so tests drive a fake PATH instead of the developer's machine. */
|
|
29
|
+
fileExists?: (path: string) => boolean;
|
|
29
30
|
}
|
|
31
|
+
/** Is a bare `agentteams` resolvable from this context's PATH? */
|
|
32
|
+
export declare function hasGlobalExecutable(context: McpPathContext, fileExists?: (path: string) => boolean): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* What the client will spawn.
|
|
35
|
+
*
|
|
36
|
+
* A bare `agentteams` is the fast path, but it is only correct when the package is
|
|
37
|
+
* installed globally *and* the client inherits a PATH that contains it — neither holds
|
|
38
|
+
* for `npx @agentteams/cli mcp install` or for a GUI-launched client that never sourced
|
|
39
|
+
* a login shell. Those failures surface as an opaque "server failed to start" inside the
|
|
40
|
+
* client, so when the executable is not resolvable the spec falls back to `npx`, which
|
|
41
|
+
* works in both cases.
|
|
42
|
+
*/
|
|
30
43
|
export declare function buildServerSpec(options: BuildServerSpecOptions): McpServerSpec;
|
|
31
44
|
//# sourceMappingURL=serverSpec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverSpec.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/serverSpec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"serverSpec.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/serverSpec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhE,mGAAmG;AACnG,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,oFAAoF;IACpF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC;AAMD,kEAAkE;AAClE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,cAAc,EACvB,UAAU,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAoB,GACjD,OAAO,CAUT;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,aAAa,CAc9E"}
|
|
@@ -1,29 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { delimiter, isAbsolute, join, resolve } from 'node:path';
|
|
3
3
|
/** Server name registered in every client. Kept stable so re-runs update rather than duplicate. */
|
|
4
4
|
export const MCP_SERVER_NAME = 'agentteams';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (credentials.apiUrl && credentials.apiUrl !== DEFAULT_API_URL) {
|
|
21
|
-
env[CREDENTIAL_ENV_KEYS.apiUrl] = credentials.apiUrl;
|
|
5
|
+
/** Published package the `npx` fallback runs. */
|
|
6
|
+
export const MCP_RUNTIME_PACKAGE = '@agentteams/cli';
|
|
7
|
+
/** Name of the globally installed executable, when there is one. */
|
|
8
|
+
export const MCP_GLOBAL_EXECUTABLE = 'agentteams';
|
|
9
|
+
function executableSuffixes() {
|
|
10
|
+
return process.platform === 'win32' ? ['', '.cmd', '.exe', '.bat', '.ps1'] : [''];
|
|
11
|
+
}
|
|
12
|
+
/** Is a bare `agentteams` resolvable from this context's PATH? */
|
|
13
|
+
export function hasGlobalExecutable(context, fileExists = existsSync) {
|
|
14
|
+
const pathDirs = (context.env.PATH ?? '').split(delimiter).filter((entry) => entry.length > 0);
|
|
15
|
+
for (const directory of pathDirs) {
|
|
16
|
+
for (const suffix of executableSuffixes()) {
|
|
17
|
+
if (fileExists(join(directory, `${MCP_GLOBAL_EXECUTABLE}${suffix}`)))
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
22
20
|
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What the client will spawn.
|
|
25
|
+
*
|
|
26
|
+
* A bare `agentteams` is the fast path, but it is only correct when the package is
|
|
27
|
+
* installed globally *and* the client inherits a PATH that contains it — neither holds
|
|
28
|
+
* for `npx @agentteams/cli mcp install` or for a GUI-launched client that never sourced
|
|
29
|
+
* a login shell. Those failures surface as an opaque "server failed to start" inside the
|
|
30
|
+
* client, so when the executable is not resolvable the spec falls back to `npx`, which
|
|
31
|
+
* works in both cases.
|
|
32
|
+
*/
|
|
33
|
+
export function buildServerSpec(options) {
|
|
34
|
+
const { serverEntry } = options;
|
|
35
|
+
const env = {};
|
|
23
36
|
if (serverEntry) {
|
|
24
37
|
const entryPath = isAbsolute(serverEntry) ? serverEntry : resolve(serverEntry);
|
|
25
38
|
return { command: 'node', args: [entryPath, 'mcp'], env };
|
|
26
39
|
}
|
|
27
|
-
|
|
40
|
+
if (options.context && !hasGlobalExecutable(options.context, options.fileExists)) {
|
|
41
|
+
return { command: 'npx', args: ['-y', MCP_RUNTIME_PACKAGE, 'mcp'], env };
|
|
42
|
+
}
|
|
43
|
+
return { command: MCP_GLOBAL_EXECUTABLE, args: ['mcp'], env };
|
|
28
44
|
}
|
|
29
45
|
//# sourceMappingURL=serverSpec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverSpec.js","sourceRoot":"","sources":["../../src/mcp-registration/serverSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"serverSpec.js","sourceRoot":"","sources":["../../src/mcp-registration/serverSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGjE,mGAAmG;AACnG,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAE5C,iDAAiD;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAErD,oEAAoE;AACpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC;AA2BlD,SAAS,kBAAkB;IACzB,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACpF,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,mBAAmB,CACjC,OAAuB,EACvB,aAAwC,UAAU;IAElD,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,C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
|
export type McpClientId = (typeof MCP_CLIENT_IDS)[number];
|
|
4
4
|
export type McpScope = 'user' | 'project';
|
|
5
|
-
/** Syntax the client uses to inherit a secret from its parent process. */
|
|
6
|
-
export type McpSecretReference = 'dollarBraces' | 'opencodeEnv' | 'codexEnvVars';
|
|
7
5
|
/** How the AgentTeams entry reaches the client's configuration. */
|
|
8
6
|
export type McpInstallStrategy =
|
|
9
7
|
/** The client owns the format; we shell out to its documented non-interactive command. */
|
|
@@ -61,7 +59,6 @@ export interface McpClientDefinition {
|
|
|
61
59
|
label: string;
|
|
62
60
|
/** Executable names looked up on PATH. */
|
|
63
61
|
executables: string[];
|
|
64
|
-
secretReference: McpSecretReference;
|
|
65
62
|
/** Extra directories to probe when the client installs outside PATH (e.g. Kimi). */
|
|
66
63
|
extraBinDirs?: (context: McpPathContext) => string[];
|
|
67
64
|
/** Files/directories whose presence proves the client has been configured on this machine. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/types.ts"],"names":[],"mappings":"AAAA,+HAA+H;AAC/H,eAAO,MAAM,cAAc,8GASjB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/types.ts"],"names":[],"mappings":"AAAA,+HAA+H;AAC/H,eAAO,MAAM,cAAc,8GASjB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAE1C,mEAAmE;AACnE,MAAM,MAAM,kBAAkB;AAC5B,0FAA0F;AACxF,eAAe;AACjB,6EAA6E;GAC3E,WAAW;A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
|
|
|
6
6
|
* CLI Configuration stored in .agentteams/config.json
|
|
7
7
|
* Contains credentials and project context for API communication
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Which credential family this project is configured to authenticate with.
|
|
11
|
+
*
|
|
12
|
+
* `personal-token` is the default: project config stays secret-free while a
|
|
13
|
+
* rotating refresh token lives in the OS credential store. `api-key` is the
|
|
14
|
+
* explicit compatibility path for existing automation and legacy projects.
|
|
15
|
+
*/
|
|
16
|
+
export type AuthMode = 'api-key' | 'personal-token';
|
|
9
17
|
export interface Config {
|
|
10
18
|
/** Team ID from AgentTeams */
|
|
11
19
|
teamId: string;
|
|
@@ -15,6 +23,8 @@ export interface Config {
|
|
|
15
23
|
apiKey: string;
|
|
16
24
|
/** API URL (e.g., "http://localhost:3001") */
|
|
17
25
|
apiUrl: string;
|
|
26
|
+
/** Legacy migration marker; absent configs choose by whether an apiKey exists. */
|
|
27
|
+
authMode?: AuthMode;
|
|
18
28
|
}
|
|
19
29
|
/**
|
|
20
30
|
* Plan from API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAEpD,MAAM,WAAW,MAAM;IACrB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAMD;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAMD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ApiKeyInputOptions {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
apiKeyFile?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ApiKeyInputDependencies {
|
|
6
|
+
readFile: (path: string) => string;
|
|
7
|
+
readStdin: () => string;
|
|
8
|
+
warn: (message: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolve explicit credential input without ever writing the credential to
|
|
12
|
+
* output. The legacy argv path remains compatible, but every use explains the
|
|
13
|
+
* safer environment, file and stdin alternatives on stderr.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveApiKeyInput(options: ApiKeyInputOptions, dependencies?: ApiKeyInputDependencies): string | undefined;
|
|
16
|
+
//# sourceMappingURL=apiKeyInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKeyInput.d.ts","sourceRoot":"","sources":["../../src/utils/apiKeyInput.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAmBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,EAC3B,YAAY,GAAE,uBAA6C,GAC1D,MAAM,GAAG,SAAS,CA8BpB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
const defaultDependencies = {
|
|
3
|
+
readFile: (path) => readFileSync(path, 'utf-8'),
|
|
4
|
+
readStdin: () => readFileSync(0, 'utf-8'),
|
|
5
|
+
warn: (message) => process.stderr.write(message),
|
|
6
|
+
};
|
|
7
|
+
const normalizeApiKey = (value, source) => {
|
|
8
|
+
const normalized = value.trim();
|
|
9
|
+
if (!normalized) {
|
|
10
|
+
throw new Error(`${source} is empty.`);
|
|
11
|
+
}
|
|
12
|
+
if (/\s/.test(normalized)) {
|
|
13
|
+
throw new Error(`${source} must contain exactly one API key without whitespace.`);
|
|
14
|
+
}
|
|
15
|
+
return normalized;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Resolve explicit credential input without ever writing the credential to
|
|
19
|
+
* output. The legacy argv path remains compatible, but every use explains the
|
|
20
|
+
* safer environment, file and stdin alternatives on stderr.
|
|
21
|
+
*/
|
|
22
|
+
export function resolveApiKeyInput(options, dependencies = defaultDependencies) {
|
|
23
|
+
if (options.apiKey !== undefined && options.apiKeyFile !== undefined) {
|
|
24
|
+
throw new Error('--api-key and --api-key-file cannot be used together.');
|
|
25
|
+
}
|
|
26
|
+
if (options.apiKey !== undefined) {
|
|
27
|
+
dependencies.warn('[warn] --api-key exposes credentials in shell history and process listings. Prefer AGENTTEAMS_API_KEY, --api-key-file <path>, or --api-key-file - for stdin.\n');
|
|
28
|
+
return normalizeApiKey(options.apiKey, '--api-key');
|
|
29
|
+
}
|
|
30
|
+
if (options.apiKeyFile === undefined) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const source = options.apiKeyFile === '-' ? 'stdin' : `API key file ${options.apiKeyFile}`;
|
|
34
|
+
try {
|
|
35
|
+
const value = options.apiKeyFile === '-' ? dependencies.readStdin() : dependencies.readFile(options.apiKeyFile);
|
|
36
|
+
return normalizeApiKey(value, source);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (error instanceof Error &&
|
|
40
|
+
(error.message.endsWith('is empty.') || error.message.includes('exactly one API key'))) {
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
44
|
+
throw new Error(`Could not read ${source}: ${detail}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=apiKeyInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKeyInput.js","sourceRoot":"","sources":["../../src/utils/apiKeyInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAavC,MAAM,mBAAmB,GAA4B;IACnD,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAA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C,UAAU,EAAE,CAAC;IAC3F,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAChH,OAAO,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IACE,KAAK,YAAY,KAAK;YACtB,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,EACtF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,KAAK,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
|
|
@@ -7,9 +7,18 @@ export type AuthResult = {
|
|
|
7
7
|
configId: string;
|
|
8
8
|
seedPlanId?: string | null;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The authorization-code callback. Deliberately smaller than {@link AuthResult}:
|
|
12
|
+
* a single-use code that is worthless without the `code_verifier` this process
|
|
13
|
+
* never sent anywhere, instead of a long-lived key travelling through a browser.
|
|
14
|
+
*/
|
|
15
|
+
export type AuthorizationCodeResult = {
|
|
16
|
+
code: string;
|
|
17
|
+
state: string;
|
|
18
|
+
};
|
|
19
|
+
type AuthServerResult<T> = {
|
|
11
20
|
server: Server;
|
|
12
|
-
waitForCallback: () => Promise<
|
|
21
|
+
waitForCallback: () => Promise<T>;
|
|
13
22
|
port: number;
|
|
14
23
|
/** Echo this back through the authorize URL; the callback is rejected without it. */
|
|
15
24
|
state: string;
|
|
@@ -19,6 +28,26 @@ type StartLocalAuthServerOptions = {
|
|
|
19
28
|
};
|
|
20
29
|
/** Unguessable value that proves a callback belongs to the login this process started. */
|
|
21
30
|
export declare function createAuthState(): string;
|
|
22
|
-
export
|
|
31
|
+
export type PkcePair = {
|
|
32
|
+
/** Stays in this process. Without it a stolen code cannot be redeemed. */
|
|
33
|
+
verifier: string;
|
|
34
|
+
/** S256 hash sent through the browser. */
|
|
35
|
+
challenge: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* PKCE S256 pair.
|
|
39
|
+
*
|
|
40
|
+
* 48 random bytes base64url-encode to 64 characters, inside the server's
|
|
41
|
+
* 43–128 range (`api/src/routes/desktop-auth/index.ts`).
|
|
42
|
+
*/
|
|
43
|
+
export declare function createPkcePair(): PkcePair;
|
|
44
|
+
/**
|
|
45
|
+
* Legacy login callback: the web posts the issued agent key back to this port.
|
|
46
|
+
* Kept unchanged for CLI/web combinations that predate the authorization-code
|
|
47
|
+
* path; `P3` is where it goes away.
|
|
48
|
+
*/
|
|
49
|
+
export declare function startLocalAuthServer(options?: StartLocalAuthServerOptions): Promise<AuthServerResult<AuthResult>>;
|
|
50
|
+
/** Authorization-code login callback: only `{ code, state }` crosses this boundary. */
|
|
51
|
+
export declare function startAuthorizationCodeServer(options?: StartLocalAuthServerOptions): Promise<AuthServerResult<AuthorizationCodeResult>>;
|
|
23
52
|
export {};
|
|
24
53
|
//# sourceMappingURL=authServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authServer.d.ts","sourceRoot":"","sources":["../../src/utils/authServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,MAAM,EAA6C,MAAM,WAAW,CAAC;AAejG,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,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