multicorn-shield 1.9.3 → 1.9.4
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/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
- Bump `version` in `package.json` before publishing to npm.
|
|
11
11
|
|
|
12
|
+
## [1.9.4] - 2026-05-13
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Double "Bearer" prefix in Codex CLI hosted proxy TOML snippet (was outputting `Bearer Bearer mcs_...`)
|
|
17
|
+
- Codex CLI hosted proxy now auto-writes MCP server config to `~/.codex/config.toml` instead of asking users to paste manually
|
|
18
|
+
- PreToolUse hook now prints the consent/approval URL to stderr so users know where to approve
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Codex CLI hosted proxy next-steps updated: "Restart Codex CLI to load the new MCP server config"
|
|
23
|
+
- Added copy-pasteable "Try it out" prompt to Codex CLI hosted proxy next-steps
|
|
24
|
+
|
|
12
25
|
## [1.9.3] - 2026-05-13
|
|
13
26
|
|
|
14
27
|
### Fixed
|
package/dist/multicorn-proxy.js
CHANGED
|
@@ -947,6 +947,68 @@ function getCodexCliHooksInstallDir() {
|
|
|
947
947
|
function getCodexConfigTomlPath() {
|
|
948
948
|
return join(homedir(), ".codex", "config.toml");
|
|
949
949
|
}
|
|
950
|
+
function escapeTomlDoubleQuotedScalar(value) {
|
|
951
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
952
|
+
}
|
|
953
|
+
function stripCodexMcpServerTomlBlocks(content, serverKey) {
|
|
954
|
+
const lines = content.split(/\r?\n/);
|
|
955
|
+
const mainHeader = `[mcp_servers.${serverKey}]`;
|
|
956
|
+
const headersHeader = `[mcp_servers.${serverKey}.http_headers]`;
|
|
957
|
+
const out = [];
|
|
958
|
+
let state = "idle";
|
|
959
|
+
for (const line of lines) {
|
|
960
|
+
const t = line.trim();
|
|
961
|
+
if (state === "idle") {
|
|
962
|
+
if (t === mainHeader || t === headersHeader) {
|
|
963
|
+
state = t === headersHeader ? "skip_headers" : "skip_main";
|
|
964
|
+
continue;
|
|
965
|
+
}
|
|
966
|
+
out.push(line);
|
|
967
|
+
} else if (state === "skip_main") {
|
|
968
|
+
if (t.startsWith("[") && t.endsWith("]")) {
|
|
969
|
+
if (t === headersHeader) {
|
|
970
|
+
state = "skip_headers";
|
|
971
|
+
} else {
|
|
972
|
+
state = "idle";
|
|
973
|
+
out.push(line);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
} else {
|
|
977
|
+
if (t.startsWith("[") && t.endsWith("]")) {
|
|
978
|
+
state = "idle";
|
|
979
|
+
out.push(line);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
return out.join("\n").trimEnd();
|
|
984
|
+
}
|
|
985
|
+
async function mergeCodexHostedMcpIntoToml(shortName, proxyUrl, apiKey) {
|
|
986
|
+
const configPath = getCodexConfigTomlPath();
|
|
987
|
+
let existing = "";
|
|
988
|
+
try {
|
|
989
|
+
existing = await readFile(configPath, "utf8");
|
|
990
|
+
} catch (err) {
|
|
991
|
+
if (!(isErrnoException(err) && err.code === "ENOENT")) {
|
|
992
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
993
|
+
throw new Error(`Could not read Codex CLI config at ${configPath}: ${detail}`);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
const stripped = stripCodexMcpServerTomlBlocks(existing, shortName);
|
|
997
|
+
const urlEsc = escapeTomlDoubleQuotedScalar(proxyUrl);
|
|
998
|
+
const tokenEsc = escapeTomlDoubleQuotedScalar(apiKey);
|
|
999
|
+
const block = `[mcp_servers.${shortName}]
|
|
1000
|
+
url = "${urlEsc}"
|
|
1001
|
+
|
|
1002
|
+
[mcp_servers.${shortName}.http_headers]
|
|
1003
|
+
Authorization = "Bearer ${tokenEsc}"
|
|
1004
|
+
`;
|
|
1005
|
+
const trimmedBase = stripped.trimEnd();
|
|
1006
|
+
const full = (trimmedBase.length > 0 ? `${trimmedBase}
|
|
1007
|
+
|
|
1008
|
+
` : "") + block;
|
|
1009
|
+
await mkdir(dirname(configPath), { recursive: true });
|
|
1010
|
+
await writeFile(configPath, full, SECRET_JSON_FILE_OPTIONS);
|
|
1011
|
+
}
|
|
950
1012
|
function getCodexHooksJsonPath() {
|
|
951
1013
|
return join(homedir(), ".codex", "hooks.json");
|
|
952
1014
|
}
|
|
@@ -2153,7 +2215,20 @@ async function applyHostedProxyMcpConfig(platform, proxyUrl, shortName, apiKey,
|
|
|
2153
2215
|
printHostedProxyJsonParseWarning(join(workspacePath, "opencode.json"));
|
|
2154
2216
|
}
|
|
2155
2217
|
} else if (platform === "codex-cli") {
|
|
2156
|
-
|
|
2218
|
+
let codexTomlWritten = false;
|
|
2219
|
+
try {
|
|
2220
|
+
await mergeCodexHostedMcpIntoToml(shortName, proxyUrlWithKeyWhenNeeded, apiKey);
|
|
2221
|
+
codexTomlWritten = true;
|
|
2222
|
+
process.stderr.write(
|
|
2223
|
+
style.green("\u2713 ") + "MCP server config written to " + style.cyan(getCodexConfigTomlPath()) + "\n"
|
|
2224
|
+
);
|
|
2225
|
+
} catch (err) {
|
|
2226
|
+
process.stderr.write(
|
|
2227
|
+
`${style.yellow("!")} Could not auto-write config: ${err instanceof Error ? err.message : String(err)}
|
|
2228
|
+
`
|
|
2229
|
+
);
|
|
2230
|
+
}
|
|
2231
|
+
printPlatformSnippet(platform, proxyUrl, shortName, apiKey, codexTomlWritten);
|
|
2157
2232
|
return;
|
|
2158
2233
|
} else if (platform === "continue-dev") {
|
|
2159
2234
|
result = await mergeContinueHostedMcp(
|
|
@@ -2279,7 +2354,7 @@ async function mergeGooseConfig(shortName, proxyUrl, apiKey) {
|
|
|
2279
2354
|
writeMcpAddedLine(shortName, filePath);
|
|
2280
2355
|
return "ok";
|
|
2281
2356
|
}
|
|
2282
|
-
function printPlatformSnippet(platform, routingToken, shortName, apiKey) {
|
|
2357
|
+
function printPlatformSnippet(platform, routingToken, shortName, apiKey, codexCliTomlWritten) {
|
|
2283
2358
|
const hostedInlinePlatforms = /* @__PURE__ */ new Set([
|
|
2284
2359
|
"cursor",
|
|
2285
2360
|
"claude-desktop",
|
|
@@ -2393,11 +2468,12 @@ mcpServers:
|
|
|
2393
2468
|
2
|
|
2394
2469
|
);
|
|
2395
2470
|
} else if (platform === "codex-cli") {
|
|
2471
|
+
const bearerToken = authHeader.startsWith("Bearer ") ? authHeader.slice("Bearer ".length) : authHeader;
|
|
2396
2472
|
snippetText = `[mcp_servers.${shortName}]
|
|
2397
2473
|
url = "${urlInSnippet}"
|
|
2398
2474
|
|
|
2399
2475
|
[mcp_servers.${shortName}.http_headers]
|
|
2400
|
-
Authorization = "Bearer ${
|
|
2476
|
+
Authorization = "Bearer ${bearerToken}"
|
|
2401
2477
|
`;
|
|
2402
2478
|
} else {
|
|
2403
2479
|
const urlKey = platform === "windsurf" ? "serverUrl" : "url";
|
|
@@ -2443,11 +2519,15 @@ Authorization = "Bearer ${authHeader}"
|
|
|
2443
2519
|
) + "\n\n"
|
|
2444
2520
|
);
|
|
2445
2521
|
} else if (platform === "codex-cli") {
|
|
2446
|
-
|
|
2447
|
-
"\n" + style.dim(
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2522
|
+
if (codexCliTomlWritten === true) {
|
|
2523
|
+
process.stderr.write("\n" + style.dim("Added to ~/.codex/config.toml:") + "\n\n");
|
|
2524
|
+
} else {
|
|
2525
|
+
process.stderr.write(
|
|
2526
|
+
"\n" + style.dim(
|
|
2527
|
+
"Add this to ~/.codex/config.toml (create the file if it does not exist). Restart Codex CLI after saving."
|
|
2528
|
+
) + "\n\n"
|
|
2529
|
+
);
|
|
2530
|
+
}
|
|
2451
2531
|
} else if (platform === "github-copilot") {
|
|
2452
2532
|
process.stderr.write(
|
|
2453
2533
|
"\n" + style.dim(
|
|
@@ -3241,11 +3321,6 @@ You have ${String(agentsForPlatform.length)} agent(s) connected for ${selectedLa
|
|
|
3241
3321
|
apiKey,
|
|
3242
3322
|
initWorkspacePath
|
|
3243
3323
|
);
|
|
3244
|
-
process.stderr.write(
|
|
3245
|
-
"\n" + style.dim(
|
|
3246
|
-
"Add the TOML snippet above to ~/.codex/config.toml. Restart Codex CLI after saving."
|
|
3247
|
-
) + "\n"
|
|
3248
|
-
);
|
|
3249
3324
|
configuredAgents.push({
|
|
3250
3325
|
selection,
|
|
3251
3326
|
platform: selectedPlatform,
|
|
@@ -3582,8 +3657,9 @@ You have ${String(agentsForPlatform.length)} agent(s) connected for ${selectedLa
|
|
|
3582
3657
|
);
|
|
3583
3658
|
}
|
|
3584
3659
|
if (codexHostedConfigured) {
|
|
3660
|
+
const codexLabel = mcpPromptLabel2("codex-cli");
|
|
3585
3661
|
blocks.push(
|
|
3586
|
-
"\n" + style.bold("Codex CLI (hosted)") + "\n \u2192 Restart Codex CLI
|
|
3662
|
+
"\n" + style.bold("Codex CLI (hosted)") + "\n \u2192 Restart Codex CLI to load the new MCP server config\n \u2192 Verify it's connected: run /mcp in Codex CLI to see your active MCP servers\n \u2192 Try it - paste this into Codex:\n Use the " + codexLabel + " MCP server to list available tools\n"
|
|
3587
3663
|
);
|
|
3588
3664
|
}
|
|
3589
3665
|
if (configuredPlatforms.has("other-mcp")) {
|
|
@@ -4662,7 +4738,7 @@ var init_package = __esm({
|
|
|
4662
4738
|
"package.json"() {
|
|
4663
4739
|
package_default = {
|
|
4664
4740
|
name: "multicorn-shield",
|
|
4665
|
-
version: "1.9.
|
|
4741
|
+
version: "1.9.4",
|
|
4666
4742
|
description: "The control layer for AI agents: permissions, consent, spending limits, and audit logging.",
|
|
4667
4743
|
license: "MIT",
|
|
4668
4744
|
author: "Multicorn AI Pty Ltd",
|
package/dist/multicorn-shield.js
CHANGED
|
@@ -961,6 +961,68 @@ function getCodexCliHooksInstallDir() {
|
|
|
961
961
|
function getCodexConfigTomlPath() {
|
|
962
962
|
return join(homedir(), ".codex", "config.toml");
|
|
963
963
|
}
|
|
964
|
+
function escapeTomlDoubleQuotedScalar(value) {
|
|
965
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
966
|
+
}
|
|
967
|
+
function stripCodexMcpServerTomlBlocks(content, serverKey) {
|
|
968
|
+
const lines = content.split(/\r?\n/);
|
|
969
|
+
const mainHeader = `[mcp_servers.${serverKey}]`;
|
|
970
|
+
const headersHeader = `[mcp_servers.${serverKey}.http_headers]`;
|
|
971
|
+
const out = [];
|
|
972
|
+
let state = "idle";
|
|
973
|
+
for (const line of lines) {
|
|
974
|
+
const t = line.trim();
|
|
975
|
+
if (state === "idle") {
|
|
976
|
+
if (t === mainHeader || t === headersHeader) {
|
|
977
|
+
state = t === headersHeader ? "skip_headers" : "skip_main";
|
|
978
|
+
continue;
|
|
979
|
+
}
|
|
980
|
+
out.push(line);
|
|
981
|
+
} else if (state === "skip_main") {
|
|
982
|
+
if (t.startsWith("[") && t.endsWith("]")) {
|
|
983
|
+
if (t === headersHeader) {
|
|
984
|
+
state = "skip_headers";
|
|
985
|
+
} else {
|
|
986
|
+
state = "idle";
|
|
987
|
+
out.push(line);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
} else {
|
|
991
|
+
if (t.startsWith("[") && t.endsWith("]")) {
|
|
992
|
+
state = "idle";
|
|
993
|
+
out.push(line);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return out.join("\n").trimEnd();
|
|
998
|
+
}
|
|
999
|
+
async function mergeCodexHostedMcpIntoToml(shortName, proxyUrl, apiKey) {
|
|
1000
|
+
const configPath = getCodexConfigTomlPath();
|
|
1001
|
+
let existing = "";
|
|
1002
|
+
try {
|
|
1003
|
+
existing = await readFile(configPath, "utf8");
|
|
1004
|
+
} catch (err) {
|
|
1005
|
+
if (!(isErrnoException(err) && err.code === "ENOENT")) {
|
|
1006
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
1007
|
+
throw new Error(`Could not read Codex CLI config at ${configPath}: ${detail}`);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
const stripped = stripCodexMcpServerTomlBlocks(existing, shortName);
|
|
1011
|
+
const urlEsc = escapeTomlDoubleQuotedScalar(proxyUrl);
|
|
1012
|
+
const tokenEsc = escapeTomlDoubleQuotedScalar(apiKey);
|
|
1013
|
+
const block = `[mcp_servers.${shortName}]
|
|
1014
|
+
url = "${urlEsc}"
|
|
1015
|
+
|
|
1016
|
+
[mcp_servers.${shortName}.http_headers]
|
|
1017
|
+
Authorization = "Bearer ${tokenEsc}"
|
|
1018
|
+
`;
|
|
1019
|
+
const trimmedBase = stripped.trimEnd();
|
|
1020
|
+
const full = (trimmedBase.length > 0 ? `${trimmedBase}
|
|
1021
|
+
|
|
1022
|
+
` : "") + block;
|
|
1023
|
+
await mkdir(dirname(configPath), { recursive: true });
|
|
1024
|
+
await writeFile(configPath, full, SECRET_JSON_FILE_OPTIONS);
|
|
1025
|
+
}
|
|
964
1026
|
function getCodexHooksJsonPath() {
|
|
965
1027
|
return join(homedir(), ".codex", "hooks.json");
|
|
966
1028
|
}
|
|
@@ -2246,7 +2308,20 @@ async function applyHostedProxyMcpConfig(platform, proxyUrl, shortName, apiKey,
|
|
|
2246
2308
|
printHostedProxyJsonParseWarning(join(workspacePath, "opencode.json"));
|
|
2247
2309
|
}
|
|
2248
2310
|
} else if (platform === "codex-cli") {
|
|
2249
|
-
|
|
2311
|
+
let codexTomlWritten = false;
|
|
2312
|
+
try {
|
|
2313
|
+
await mergeCodexHostedMcpIntoToml(shortName, proxyUrlWithKeyWhenNeeded, apiKey);
|
|
2314
|
+
codexTomlWritten = true;
|
|
2315
|
+
process.stderr.write(
|
|
2316
|
+
style.green("\u2713 ") + "MCP server config written to " + style.cyan(getCodexConfigTomlPath()) + "\n"
|
|
2317
|
+
);
|
|
2318
|
+
} catch (err) {
|
|
2319
|
+
process.stderr.write(
|
|
2320
|
+
`${style.yellow("!")} Could not auto-write config: ${err instanceof Error ? err.message : String(err)}
|
|
2321
|
+
`
|
|
2322
|
+
);
|
|
2323
|
+
}
|
|
2324
|
+
printPlatformSnippet(platform, proxyUrl, shortName, apiKey, codexTomlWritten);
|
|
2250
2325
|
return;
|
|
2251
2326
|
} else if (platform === "continue-dev") {
|
|
2252
2327
|
result = await mergeContinueHostedMcp(
|
|
@@ -2372,7 +2447,7 @@ async function mergeGooseConfig(shortName, proxyUrl, apiKey) {
|
|
|
2372
2447
|
writeMcpAddedLine(shortName, filePath);
|
|
2373
2448
|
return "ok";
|
|
2374
2449
|
}
|
|
2375
|
-
function printPlatformSnippet(platform, routingToken, shortName, apiKey) {
|
|
2450
|
+
function printPlatformSnippet(platform, routingToken, shortName, apiKey, codexCliTomlWritten) {
|
|
2376
2451
|
const hostedInlinePlatforms = /* @__PURE__ */ new Set([
|
|
2377
2452
|
"cursor",
|
|
2378
2453
|
"claude-desktop",
|
|
@@ -2486,11 +2561,12 @@ mcpServers:
|
|
|
2486
2561
|
2
|
|
2487
2562
|
);
|
|
2488
2563
|
} else if (platform === "codex-cli") {
|
|
2564
|
+
const bearerToken = authHeader.startsWith("Bearer ") ? authHeader.slice("Bearer ".length) : authHeader;
|
|
2489
2565
|
snippetText = `[mcp_servers.${shortName}]
|
|
2490
2566
|
url = "${urlInSnippet}"
|
|
2491
2567
|
|
|
2492
2568
|
[mcp_servers.${shortName}.http_headers]
|
|
2493
|
-
Authorization = "Bearer ${
|
|
2569
|
+
Authorization = "Bearer ${bearerToken}"
|
|
2494
2570
|
`;
|
|
2495
2571
|
} else {
|
|
2496
2572
|
const urlKey = platform === "windsurf" ? "serverUrl" : "url";
|
|
@@ -2536,11 +2612,15 @@ Authorization = "Bearer ${authHeader}"
|
|
|
2536
2612
|
) + "\n\n"
|
|
2537
2613
|
);
|
|
2538
2614
|
} else if (platform === "codex-cli") {
|
|
2539
|
-
|
|
2540
|
-
"\n" + style.dim(
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2615
|
+
if (codexCliTomlWritten === true) {
|
|
2616
|
+
process.stderr.write("\n" + style.dim("Added to ~/.codex/config.toml:") + "\n\n");
|
|
2617
|
+
} else {
|
|
2618
|
+
process.stderr.write(
|
|
2619
|
+
"\n" + style.dim(
|
|
2620
|
+
"Add this to ~/.codex/config.toml (create the file if it does not exist). Restart Codex CLI after saving."
|
|
2621
|
+
) + "\n\n"
|
|
2622
|
+
);
|
|
2623
|
+
}
|
|
2544
2624
|
} else if (platform === "github-copilot") {
|
|
2545
2625
|
process.stderr.write(
|
|
2546
2626
|
"\n" + style.dim(
|
|
@@ -3335,11 +3415,6 @@ You have ${String(agentsForPlatform.length)} agent(s) connected for ${selectedLa
|
|
|
3335
3415
|
apiKey,
|
|
3336
3416
|
initWorkspacePath
|
|
3337
3417
|
);
|
|
3338
|
-
process.stderr.write(
|
|
3339
|
-
"\n" + style.dim(
|
|
3340
|
-
"Add the TOML snippet above to ~/.codex/config.toml. Restart Codex CLI after saving."
|
|
3341
|
-
) + "\n"
|
|
3342
|
-
);
|
|
3343
3418
|
configuredAgents.push({
|
|
3344
3419
|
selection,
|
|
3345
3420
|
platform: selectedPlatform,
|
|
@@ -3676,8 +3751,9 @@ You have ${String(agentsForPlatform.length)} agent(s) connected for ${selectedLa
|
|
|
3676
3751
|
);
|
|
3677
3752
|
}
|
|
3678
3753
|
if (codexHostedConfigured) {
|
|
3754
|
+
const codexLabel = mcpPromptLabel2("codex-cli");
|
|
3679
3755
|
blocks.push(
|
|
3680
|
-
"\n" + style.bold("Codex CLI (hosted)") + "\n \u2192 Restart Codex CLI
|
|
3756
|
+
"\n" + style.bold("Codex CLI (hosted)") + "\n \u2192 Restart Codex CLI to load the new MCP server config\n \u2192 Verify it's connected: run /mcp in Codex CLI to see your active MCP servers\n \u2192 Try it - paste this into Codex:\n Use the " + codexLabel + " MCP server to list available tools\n"
|
|
3681
3757
|
);
|
|
3682
3758
|
}
|
|
3683
3759
|
if (configuredPlatforms.has("other-mcp")) {
|
|
@@ -4585,7 +4661,7 @@ async function restoreClaudeDesktopMcpFromBackup() {
|
|
|
4585
4661
|
|
|
4586
4662
|
// package.json
|
|
4587
4663
|
var package_default = {
|
|
4588
|
-
version: "1.9.
|
|
4664
|
+
version: "1.9.4"};
|
|
4589
4665
|
|
|
4590
4666
|
// src/package-meta.ts
|
|
4591
4667
|
var PACKAGE_VERSION = package_default.version;
|
package/dist/shield-extension.js
CHANGED
|
@@ -22517,7 +22517,7 @@ async function writeExtensionBackup(claudeDesktopConfigPath, mcpServers) {
|
|
|
22517
22517
|
|
|
22518
22518
|
// package.json
|
|
22519
22519
|
var package_default = {
|
|
22520
|
-
version: "1.9.
|
|
22520
|
+
version: "1.9.4"};
|
|
22521
22521
|
|
|
22522
22522
|
// src/package-meta.ts
|
|
22523
22523
|
var PACKAGE_VERSION = package_default.version;
|
package/package.json
CHANGED
|
@@ -164,7 +164,7 @@ function openBrowser(url) {
|
|
|
164
164
|
function sleep(ms) {
|
|
165
165
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
166
166
|
}
|
|
167
|
-
async function pollApprovalStatus(config, approvalId) {
|
|
167
|
+
async function pollApprovalStatus(config, approvalId, consentLink) {
|
|
168
168
|
let lastProgressWrite = Date.now();
|
|
169
169
|
for (let i = 0; i < MAX_APPROVAL_POLLS; i++) {
|
|
170
170
|
if (i > 0) {
|
|
@@ -172,9 +172,8 @@ async function pollApprovalStatus(config, approvalId) {
|
|
|
172
172
|
}
|
|
173
173
|
const now = Date.now();
|
|
174
174
|
if (now - lastProgressWrite >= 3e4) {
|
|
175
|
-
process.stderr.write(
|
|
176
|
-
|
|
177
|
-
);
|
|
175
|
+
process.stderr.write(`[Shield] Waiting for approval... ${consentLink}
|
|
176
|
+
`);
|
|
178
177
|
lastProgressWrite = now;
|
|
179
178
|
}
|
|
180
179
|
let statusCode;
|
|
@@ -235,13 +234,16 @@ async function handlePendingWithConsentAndPoll(
|
|
|
235
234
|
actionType,
|
|
236
235
|
approvalsUrl,
|
|
237
236
|
) {
|
|
237
|
+
const consentLink = consentUrl(config.baseUrl, config.agentName, service, actionType);
|
|
238
|
+
process.stderr.write(`[Shield] Action requires approval. Open: ${consentLink}
|
|
239
|
+
`);
|
|
238
240
|
if (hasConsentMarker(config.agentName)) {
|
|
239
241
|
process.stderr.write(
|
|
240
242
|
`[Shield] Waiting for approval (up to 5 min)...
|
|
241
243
|
Approve in the Shield dashboard: ${approvalsUrl}
|
|
242
244
|
`,
|
|
243
245
|
);
|
|
244
|
-
const approved2 = await pollApprovalStatus(config, approvalId);
|
|
246
|
+
const approved2 = await pollApprovalStatus(config, approvalId, consentLink);
|
|
245
247
|
if (approved2) {
|
|
246
248
|
process.exit(0);
|
|
247
249
|
}
|
|
@@ -251,13 +253,12 @@ async function handlePendingWithConsentAndPoll(
|
|
|
251
253
|
);
|
|
252
254
|
process.exit(0);
|
|
253
255
|
}
|
|
254
|
-
const url = consentUrl(config.baseUrl, config.agentName, service, actionType);
|
|
255
256
|
writeConsentMarker(config.agentName);
|
|
256
|
-
openBrowser(
|
|
257
|
+
openBrowser(consentLink);
|
|
257
258
|
process.stderr.write(
|
|
258
259
|
"[Shield] Opening Shield consent screen... Waiting for approval (up to 5 min).\n",
|
|
259
260
|
);
|
|
260
|
-
const approved = await pollApprovalStatus(config, approvalId);
|
|
261
|
+
const approved = await pollApprovalStatus(config, approvalId, consentLink);
|
|
261
262
|
if (approved) {
|
|
262
263
|
process.exit(0);
|
|
263
264
|
}
|