@google/gemini-cli 0.57.0 → 0.59.0-nightly.20260826.g64b5b79a6
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/bundle/{chunk-GPOBVDAD.js → chunk-2XH6YQA3.js} +1 -1
- package/bundle/{chunk-RLDNVR77.js → chunk-42H67AQY.js} +1 -1
- package/bundle/{chunk-XG56CL6B.js → chunk-4GVC4WXO.js} +1 -1
- package/bundle/{chunk-GAS2GAYB.js → chunk-5NOWNKP2.js} +1 -1
- package/bundle/{chunk-AOE6E7MU.js → chunk-6HMGXDAM.js} +2 -2
- package/bundle/{chunk-ASZFEU6C.js → chunk-6JOAMCED.js} +7 -7
- package/bundle/{chunk-4H4K2RBL.js → chunk-6W7YIA56.js} +3 -3
- package/bundle/{chunk-FVC4WCSP.js → chunk-7NY4ZTQR.js} +9 -8
- package/bundle/{chunk-7HKQGPWB.js → chunk-A4UDQKD5.js} +181 -45
- package/bundle/{chunk-O7TOZUUB.js → chunk-CHEYELOR.js} +3 -3
- package/bundle/{chunk-QJ33O2NH.js → chunk-D5MWR4N7.js} +67 -54
- package/bundle/{chunk-7IKUWYZO.js → chunk-D6B5MMPM.js} +1 -1
- package/bundle/{chunk-S3MXVTTY.js → chunk-DDPSAYW5.js} +7832 -14380
- package/bundle/{chunk-MNBBUQQS.js → chunk-FE2O62SQ.js} +3 -3
- package/bundle/chunk-GNGS7JAX.js +512 -0
- package/bundle/{chunk-ISXOUBN5.js → chunk-H3LS7KZV.js} +2 -2
- package/bundle/chunk-HHT4PH5C.js +102506 -0
- package/bundle/{chunk-FYAMITQ2.js → chunk-ISBZIU3W.js} +1 -1
- package/bundle/{chunk-HY6GN2F7.js → chunk-L4WIUWX2.js} +1 -1
- package/bundle/{chunk-YW7SDLZQ.js → chunk-N2LJHI4Z.js} +1 -1
- package/bundle/{chunk-DFPYJMVX.js → chunk-PODHBUY4.js} +242 -106
- package/bundle/{chunk-IKHAM2LG.js → chunk-R3WPMYRA.js} +7 -7
- package/bundle/{chunk-GAROUUGQ.js → chunk-RUSHKFOL.js} +1 -1
- package/bundle/{chunk-LQJHQ4BU.js → chunk-T6F7T4HB.js} +2 -2
- package/bundle/chunk-TLM7H7PX.js +118 -0
- package/bundle/chunk-UZMBA5WK.js +398 -0
- package/bundle/chunk-WLH25DMR.js +154 -0
- package/bundle/chunk-WV32QTVP.js +1571 -0
- package/bundle/{chunk-TAWZWX2B.js → chunk-X5G6NU2I.js} +1 -1
- package/bundle/{chunk-7ZGWPQVZ.js → chunk-Y5JAPAE7.js} +8 -5
- package/bundle/chunk-Z76ASXTA.js +397737 -0
- package/bundle/chunk-ZDDE25R7.js +17332 -0
- package/bundle/{cleanup-2HUWGXK6.js → cleanup-34Z5I5SH.js} +2 -2
- package/bundle/{cleanup-7N2HFE2E.js → cleanup-4VWTH4RG.js} +2 -2
- package/bundle/{cleanup-DA7OSZS5.js → cleanup-EYUEQ3XR.js} +2 -2
- package/bundle/cleanup-VDHBLGPE.js +32 -0
- package/bundle/{core-CFPIDJ4Z.js → core-EGFEDJ3W.js} +3 -1
- package/bundle/{devtoolsService-7YYOUGVF.js → devtoolsService-36RB7X37.js} +2 -2
- package/bundle/{devtoolsService-WMEEEXY6.js → devtoolsService-7S57JJNO.js} +2 -2
- package/bundle/{devtoolsService-VQSLUOYF.js → devtoolsService-DXYGYJ7D.js} +4 -3
- package/bundle/devtoolsService-GTAMCKKS.js +4359 -0
- package/bundle/{dist-AMP5W5P2.js → dist-JTJ62JGT.js} +3 -1
- package/bundle/{core-2NMRPWUN.js → dist-VOTQZZ6O.js} +3 -1
- package/bundle/dist-YR52AOO2.js +2182 -0
- package/bundle/docs/changelogs/preview.md +29 -93
- package/bundle/{gemini-OYYGXMHL.js → gemini-5EAA6NJV.js} +266 -20
- package/bundle/{gemini-5LF4JAP7.js → gemini-7P3TLVM6.js} +266 -20
- package/bundle/{gemini-PSRJNVY5.js → gemini-Q7UOIDN3.js} +466 -204
- package/bundle/gemini-W2XA2YDC.js +17337 -0
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-5O6FZS57.js → interactiveCli-FND3663C.js} +8 -9
- package/bundle/{interactiveCli-5E2C3XOC.js → interactiveCli-Q5LYURYV.js} +8 -9
- package/bundle/{interactiveCli-PP7WTUZL.js → interactiveCli-WOWDL7QG.js} +315 -297
- package/bundle/interactiveCli-Y72465UI.js +34983 -0
- package/bundle/{liteRtServerManager-LK6HOSMO.js → liteRtServerManager-2OROP4PN.js} +4 -4
- package/bundle/{liteRtServerManager-ZPDALIDY.js → liteRtServerManager-4OX2GTJ6.js} +4 -4
- package/bundle/{liteRtServerManager-5QBFCLBK.js → liteRtServerManager-D3QHGS4D.js} +4 -4
- package/bundle/liteRtServerManager-OJH52VO2.js +65 -0
- package/bundle/{oauth2-provider-CO22I6UM.js → oauth2-provider-5NRHM5MB.js} +1 -1
- package/bundle/{oauth2-provider-BYKBBEKI.js → oauth2-provider-KMI3S6GW.js} +1 -1
- package/bundle/{oauth2-provider-BGMEA7RS.js → oauth2-provider-ORGDEEU4.js} +38 -72
- package/bundle/oauth2-provider-PVAC3N6U.js +235 -0
- package/bundle/policies/write.toml +10 -2
- package/bundle/sandbox-macos-permissive-open.sb +50 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +50 -0
- package/bundle/sandbox-macos-restrictive-open.sb +50 -1
- package/bundle/sandbox-macos-restrictive-proxied.sb +50 -0
- package/bundle/sandbox-macos-strict-open.sb +50 -0
- package/bundle/sandbox-macos-strict-proxied.sb +50 -0
- package/bundle/{start-KH6WSP5C.js → start-6R4C5ECY.js} +6 -6
- package/bundle/{start-O6LWZY6K.js → start-HFZ6RS2Q.js} +6 -6
- package/bundle/{start-JRTTCV3K.js → start-I4VWENDT.js} +6 -6
- package/bundle/start-JXFPAQNF.js +18 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6W7YIA56.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -45,11 +45,11 @@ import {
|
|
|
45
45
|
updateAllUpdatableExtensions,
|
|
46
46
|
updateExtension,
|
|
47
47
|
validateAuthMethod
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-6JOAMCED.js";
|
|
49
49
|
import {
|
|
50
50
|
exitCli,
|
|
51
51
|
require_source
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-N2LJHI4Z.js";
|
|
53
53
|
import {
|
|
54
54
|
appEvents
|
|
55
55
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -87,11 +87,11 @@ import {
|
|
|
87
87
|
resolveGemmaConfig,
|
|
88
88
|
saveModelChange,
|
|
89
89
|
stripAnsi
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-RUSHKFOL.js";
|
|
91
91
|
import {
|
|
92
92
|
RELAUNCH_EXIT_CODE
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-
|
|
93
|
+
} from "./chunk-UZMBA5WK.js";
|
|
94
|
+
import "./chunk-4GVC4WXO.js";
|
|
95
95
|
import {
|
|
96
96
|
cleanupCheckpoints,
|
|
97
97
|
registerCleanup,
|
|
@@ -100,12 +100,15 @@ import {
|
|
|
100
100
|
runExitCleanup,
|
|
101
101
|
runSyncCleanup,
|
|
102
102
|
setupSignalHandlers
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-42H67AQY.js";
|
|
104
104
|
import {
|
|
105
105
|
ASK_USER_TOOL_NAME,
|
|
106
|
+
ApprovalMode,
|
|
106
107
|
AuthType,
|
|
107
108
|
Client,
|
|
108
109
|
Config,
|
|
110
|
+
CoreEvent,
|
|
111
|
+
CoreToolCallStatus,
|
|
109
112
|
DEFAULT_CONTEXT_FILENAME,
|
|
110
113
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
111
114
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -127,19 +130,27 @@ import {
|
|
|
127
130
|
FolderTrustDiscoveryService,
|
|
128
131
|
GEMINI_DIR,
|
|
129
132
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
133
|
+
GeminiEventType,
|
|
130
134
|
IdeClient,
|
|
135
|
+
IntegrityStatus,
|
|
131
136
|
InvalidStreamError,
|
|
132
137
|
JsonFormatter,
|
|
138
|
+
JsonStreamEventType,
|
|
139
|
+
Kind,
|
|
133
140
|
LegacyAgentSession,
|
|
134
141
|
Logger,
|
|
135
142
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
136
143
|
MCPServerConfig,
|
|
144
|
+
MCPServerStatus,
|
|
145
|
+
MessageBusType,
|
|
137
146
|
OTHER_BLOCKED_MESSAGE,
|
|
147
|
+
OutputFormat,
|
|
138
148
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
139
149
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
140
150
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
141
151
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
142
152
|
PREVIEW_GEMINI_MODEL,
|
|
153
|
+
PolicyDecision,
|
|
143
154
|
PolicyIntegrityManager,
|
|
144
155
|
RECITATION_BLOCKED_MESSAGE,
|
|
145
156
|
REFERENCE_CONTENT_START,
|
|
@@ -147,6 +158,8 @@ import {
|
|
|
147
158
|
ReadManyFilesTool,
|
|
148
159
|
SAFETY_BLOCKED_MESSAGE,
|
|
149
160
|
Scheduler,
|
|
161
|
+
SessionEndReason,
|
|
162
|
+
SessionStartSource,
|
|
150
163
|
ShellExecutionService,
|
|
151
164
|
SimpleExtensionLoader,
|
|
152
165
|
Storage,
|
|
@@ -155,10 +168,13 @@ import {
|
|
|
155
168
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
156
169
|
ToolCallEvent,
|
|
157
170
|
ToolConfirmationOutcome,
|
|
171
|
+
ToolErrorType,
|
|
172
|
+
TrustLevel,
|
|
158
173
|
UserAccountManager,
|
|
159
174
|
UserPromptEvent,
|
|
160
175
|
ValidationCancelledError,
|
|
161
176
|
ValidationRequiredError,
|
|
177
|
+
WarningPriority,
|
|
162
178
|
applyAdminAllowlist,
|
|
163
179
|
applyRequiredServers,
|
|
164
180
|
clearCachedCredentialFile,
|
|
@@ -238,7 +254,7 @@ import {
|
|
|
238
254
|
updatePolicy,
|
|
239
255
|
writeToStderr,
|
|
240
256
|
writeToStdout
|
|
241
|
-
} from "./chunk-
|
|
257
|
+
} from "./chunk-DDPSAYW5.js";
|
|
242
258
|
import "./chunk-664ZODQF.js";
|
|
243
259
|
import "./chunk-IUUIT4SU.js";
|
|
244
260
|
import "./chunk-TUDYL3X4.js";
|
|
@@ -5368,7 +5384,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5368
5384
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5369
5385
|
const isStdio = !!config.command;
|
|
5370
5386
|
if (isStdio && !isTrusted) {
|
|
5371
|
-
return
|
|
5387
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5372
5388
|
}
|
|
5373
5389
|
const client = new Client({
|
|
5374
5390
|
name: "mcp-test-client",
|
|
@@ -5404,7 +5420,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5404
5420
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5405
5421
|
} catch {
|
|
5406
5422
|
await client.close();
|
|
5407
|
-
return
|
|
5423
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5408
5424
|
}
|
|
5409
5425
|
try {
|
|
5410
5426
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5418,10 +5434,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5418
5434
|
);
|
|
5419
5435
|
}
|
|
5420
5436
|
await client.close();
|
|
5421
|
-
return
|
|
5437
|
+
return MCPServerStatus.CONNECTED;
|
|
5422
5438
|
} catch {
|
|
5423
5439
|
await transport.close();
|
|
5424
|
-
return
|
|
5440
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5425
5441
|
}
|
|
5426
5442
|
}
|
|
5427
5443
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5434,12 +5450,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5434
5450
|
});
|
|
5435
5451
|
if (!loadResult.allowed) {
|
|
5436
5452
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5437
|
-
return
|
|
5453
|
+
return MCPServerStatus.BLOCKED;
|
|
5438
5454
|
}
|
|
5439
|
-
return
|
|
5455
|
+
return MCPServerStatus.DISABLED;
|
|
5440
5456
|
}
|
|
5441
5457
|
if (!isTrusted) {
|
|
5442
|
-
return
|
|
5458
|
+
return MCPServerStatus.DISABLED;
|
|
5443
5459
|
}
|
|
5444
5460
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5445
5461
|
}
|
|
@@ -5485,23 +5501,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5485
5501
|
let statusIndicator = "";
|
|
5486
5502
|
let statusText = "";
|
|
5487
5503
|
switch (status) {
|
|
5488
|
-
case
|
|
5504
|
+
case MCPServerStatus.CONNECTED:
|
|
5489
5505
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5490
5506
|
statusText = "Connected";
|
|
5491
5507
|
break;
|
|
5492
|
-
case
|
|
5508
|
+
case MCPServerStatus.CONNECTING:
|
|
5493
5509
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5494
5510
|
statusText = "Connecting";
|
|
5495
5511
|
break;
|
|
5496
|
-
case
|
|
5512
|
+
case MCPServerStatus.BLOCKED:
|
|
5497
5513
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5498
5514
|
statusText = "Blocked";
|
|
5499
5515
|
break;
|
|
5500
|
-
case
|
|
5516
|
+
case MCPServerStatus.DISABLED:
|
|
5501
5517
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5502
5518
|
statusText = "Disabled";
|
|
5503
5519
|
break;
|
|
5504
|
-
case
|
|
5520
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5505
5521
|
default:
|
|
5506
5522
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5507
5523
|
statusText = "Disconnected";
|
|
@@ -5787,7 +5803,7 @@ async function handleInstall(args) {
|
|
|
5787
5803
|
);
|
|
5788
5804
|
if (confirmed) {
|
|
5789
5805
|
const trustedFolders = loadTrustedFolders();
|
|
5790
|
-
await trustedFolders.setValue(realPath,
|
|
5806
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5791
5807
|
} else {
|
|
5792
5808
|
throw new Error(
|
|
5793
5809
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7832,7 +7848,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7832
7848
|
}
|
|
7833
7849
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7834
7850
|
const packageJson = await getPackageJson(__dirname3);
|
|
7835
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.
|
|
7851
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.59.0-nightly.20260826.g64b5b79a6" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7836
7852
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7837
7853
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7838
7854
|
}
|
|
@@ -7891,9 +7907,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7891
7907
|
cwd,
|
|
7892
7908
|
potentialWorkspacePoliciesDir
|
|
7893
7909
|
);
|
|
7894
|
-
if (integrityResult.status ===
|
|
7910
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
7895
7911
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7896
|
-
} else if (integrityResult.status ===
|
|
7912
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
7897
7913
|
workspacePoliciesDir = void 0;
|
|
7898
7914
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7899
7915
|
policyUpdateConfirmationRequest = {
|
|
@@ -8321,23 +8337,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8321
8337
|
if (rawApprovalMode) {
|
|
8322
8338
|
switch (rawApprovalMode) {
|
|
8323
8339
|
case "yolo":
|
|
8324
|
-
approvalMode =
|
|
8340
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8325
8341
|
break;
|
|
8326
8342
|
case "auto_edit":
|
|
8327
|
-
approvalMode =
|
|
8343
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8328
8344
|
break;
|
|
8329
8345
|
case "plan":
|
|
8330
8346
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8331
8347
|
debugLogger.warn(
|
|
8332
8348
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8333
8349
|
);
|
|
8334
|
-
approvalMode =
|
|
8350
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8335
8351
|
} else {
|
|
8336
|
-
approvalMode =
|
|
8352
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8337
8353
|
}
|
|
8338
8354
|
break;
|
|
8339
8355
|
case "default":
|
|
8340
|
-
approvalMode =
|
|
8356
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8341
8357
|
break;
|
|
8342
8358
|
default:
|
|
8343
8359
|
throw new Error(
|
|
@@ -8345,10 +8361,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8345
8361
|
);
|
|
8346
8362
|
}
|
|
8347
8363
|
} else {
|
|
8348
|
-
approvalMode =
|
|
8364
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8349
8365
|
}
|
|
8350
8366
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8351
|
-
if (approvalMode ===
|
|
8367
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8352
8368
|
if (settings.admin?.secureModeEnabled) {
|
|
8353
8369
|
debugLogger.error(
|
|
8354
8370
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8366,16 +8382,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8366
8382
|
)
|
|
8367
8383
|
);
|
|
8368
8384
|
}
|
|
8369
|
-
} else if (approvalMode ===
|
|
8385
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8370
8386
|
debugLogger.warn(
|
|
8371
8387
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8372
8388
|
);
|
|
8373
8389
|
}
|
|
8374
|
-
if (!trustedFolder && approvalMode !==
|
|
8390
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8375
8391
|
debugLogger.warn(
|
|
8376
8392
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8377
8393
|
);
|
|
8378
|
-
approvalMode =
|
|
8394
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8379
8395
|
}
|
|
8380
8396
|
let telemetrySettings;
|
|
8381
8397
|
try {
|
|
@@ -9002,7 +9018,48 @@ var BUILTIN_SEATBELT_PROFILE_CONTENTS = {
|
|
|
9002
9018
|
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
9003
9019
|
(allow network-inbound (local ip "*:*"))
|
|
9004
9020
|
(allow network-bind (local ip "*:*"))
|
|
9005
|
-
(allow network-outbound)
|
|
9021
|
+
(allow network-outbound)
|
|
9022
|
+
(deny file-read* file-write*
|
|
9023
|
+
(literal "/var/run/docker.sock")
|
|
9024
|
+
(literal "/var/run/docker.sock.raw")
|
|
9025
|
+
(literal "/private/var/run/docker.sock")
|
|
9026
|
+
(literal "/private/var/run/docker.sock.raw")
|
|
9027
|
+
(subpath "/var/run/docker")
|
|
9028
|
+
(subpath "/private/var/run/docker")
|
|
9029
|
+
(subpath "/Users/Shared/.docker")
|
|
9030
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/run"))
|
|
9031
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/desktop"))
|
|
9032
|
+
(subpath (string-append (param "HOME_DIR") "/.colima"))
|
|
9033
|
+
(subpath (string-append (param "HOME_DIR") "/.orbstack/run"))
|
|
9034
|
+
(subpath (string-append (param "HOME_DIR") "/.rd"))
|
|
9035
|
+
)
|
|
9036
|
+
(deny process-exec
|
|
9037
|
+
(literal "/usr/local/bin/docker")
|
|
9038
|
+
(literal "/usr/local/bin/dockerd")
|
|
9039
|
+
(literal "/usr/local/bin/docker-compose")
|
|
9040
|
+
(literal "/usr/bin/docker")
|
|
9041
|
+
(literal "/opt/homebrew/bin/docker")
|
|
9042
|
+
(literal "/opt/homebrew/bin/dockerd")
|
|
9043
|
+
(literal "/opt/homebrew/bin/docker-compose")
|
|
9044
|
+
(literal "/opt/homebrew/bin/podman")
|
|
9045
|
+
(literal "/usr/local/bin/podman")
|
|
9046
|
+
(literal "/opt/homebrew/bin/colima")
|
|
9047
|
+
(literal "/usr/local/bin/colima")
|
|
9048
|
+
(literal "/opt/homebrew/bin/orb")
|
|
9049
|
+
(literal "/Applications/Docker.app/Contents/Resources/bin/docker")
|
|
9050
|
+
(subpath "/Applications/Docker.app/Contents/MacOS/")
|
|
9051
|
+
(subpath "/Applications/OrbStack.app/Contents/MacOS/")
|
|
9052
|
+
(subpath "/Applications/Rancher Desktop.app/Contents/MacOS/")
|
|
9053
|
+
)
|
|
9054
|
+
(deny mach-lookup
|
|
9055
|
+
(xpc-service-name-prefix "com.docker.")
|
|
9056
|
+
(global-name-prefix "com.docker.")
|
|
9057
|
+
(global-name-prefix "dev.kdrag0n.OrbStack")
|
|
9058
|
+
)
|
|
9059
|
+
(deny ipc-posix-shm*
|
|
9060
|
+
(ipc-posix-name-prefix "docker")
|
|
9061
|
+
(ipc-posix-name-prefix "com.docker.")
|
|
9062
|
+
)`,
|
|
9006
9063
|
"permissive-proxied": `(version 1)
|
|
9007
9064
|
(deny default)
|
|
9008
9065
|
(allow file-read*)
|
|
@@ -9097,7 +9154,48 @@ var BUILTIN_SEATBELT_PROFILE_CONTENTS = {
|
|
|
9097
9154
|
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
9098
9155
|
(allow network-inbound (local ip "localhost:9229"))
|
|
9099
9156
|
(allow network-bind (local ip "*:*"))
|
|
9100
|
-
(allow network-outbound (remote tcp "localhost:8877"))
|
|
9157
|
+
(allow network-outbound (remote tcp "localhost:8877"))
|
|
9158
|
+
(deny file-read* file-write*
|
|
9159
|
+
(literal "/var/run/docker.sock")
|
|
9160
|
+
(literal "/var/run/docker.sock.raw")
|
|
9161
|
+
(literal "/private/var/run/docker.sock")
|
|
9162
|
+
(literal "/private/var/run/docker.sock.raw")
|
|
9163
|
+
(subpath "/var/run/docker")
|
|
9164
|
+
(subpath "/private/var/run/docker")
|
|
9165
|
+
(subpath "/Users/Shared/.docker")
|
|
9166
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/run"))
|
|
9167
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/desktop"))
|
|
9168
|
+
(subpath (string-append (param "HOME_DIR") "/.colima"))
|
|
9169
|
+
(subpath (string-append (param "HOME_DIR") "/.orbstack/run"))
|
|
9170
|
+
(subpath (string-append (param "HOME_DIR") "/.rd"))
|
|
9171
|
+
)
|
|
9172
|
+
(deny process-exec
|
|
9173
|
+
(literal "/usr/local/bin/docker")
|
|
9174
|
+
(literal "/usr/local/bin/dockerd")
|
|
9175
|
+
(literal "/usr/local/bin/docker-compose")
|
|
9176
|
+
(literal "/usr/bin/docker")
|
|
9177
|
+
(literal "/opt/homebrew/bin/docker")
|
|
9178
|
+
(literal "/opt/homebrew/bin/dockerd")
|
|
9179
|
+
(literal "/opt/homebrew/bin/docker-compose")
|
|
9180
|
+
(literal "/opt/homebrew/bin/podman")
|
|
9181
|
+
(literal "/usr/local/bin/podman")
|
|
9182
|
+
(literal "/opt/homebrew/bin/colima")
|
|
9183
|
+
(literal "/usr/local/bin/colima")
|
|
9184
|
+
(literal "/opt/homebrew/bin/orb")
|
|
9185
|
+
(literal "/Applications/Docker.app/Contents/Resources/bin/docker")
|
|
9186
|
+
(subpath "/Applications/Docker.app/Contents/MacOS/")
|
|
9187
|
+
(subpath "/Applications/OrbStack.app/Contents/MacOS/")
|
|
9188
|
+
(subpath "/Applications/Rancher Desktop.app/Contents/MacOS/")
|
|
9189
|
+
)
|
|
9190
|
+
(deny mach-lookup
|
|
9191
|
+
(xpc-service-name-prefix "com.docker.")
|
|
9192
|
+
(global-name-prefix "com.docker.")
|
|
9193
|
+
(global-name-prefix "dev.kdrag0n.OrbStack")
|
|
9194
|
+
)
|
|
9195
|
+
(deny ipc-posix-shm*
|
|
9196
|
+
(ipc-posix-name-prefix "docker")
|
|
9197
|
+
(ipc-posix-name-prefix "com.docker.")
|
|
9198
|
+
)`,
|
|
9101
9199
|
"restrictive-open": `(version 1)
|
|
9102
9200
|
(deny default)
|
|
9103
9201
|
(allow file-read*)
|
|
@@ -9169,7 +9267,48 @@ var BUILTIN_SEATBELT_PROFILE_CONTENTS = {
|
|
|
9169
9267
|
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
9170
9268
|
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
9171
9269
|
(allow network-inbound (local ip "localhost:9229"))
|
|
9172
|
-
(allow network-outbound)
|
|
9270
|
+
(allow network-outbound)
|
|
9271
|
+
(deny file-read* file-write*
|
|
9272
|
+
(literal "/var/run/docker.sock")
|
|
9273
|
+
(literal "/var/run/docker.sock.raw")
|
|
9274
|
+
(literal "/private/var/run/docker.sock")
|
|
9275
|
+
(literal "/private/var/run/docker.sock.raw")
|
|
9276
|
+
(subpath "/var/run/docker")
|
|
9277
|
+
(subpath "/private/var/run/docker")
|
|
9278
|
+
(subpath "/Users/Shared/.docker")
|
|
9279
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/run"))
|
|
9280
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/desktop"))
|
|
9281
|
+
(subpath (string-append (param "HOME_DIR") "/.colima"))
|
|
9282
|
+
(subpath (string-append (param "HOME_DIR") "/.orbstack/run"))
|
|
9283
|
+
(subpath (string-append (param "HOME_DIR") "/.rd"))
|
|
9284
|
+
)
|
|
9285
|
+
(deny process-exec
|
|
9286
|
+
(literal "/usr/local/bin/docker")
|
|
9287
|
+
(literal "/usr/local/bin/dockerd")
|
|
9288
|
+
(literal "/usr/local/bin/docker-compose")
|
|
9289
|
+
(literal "/usr/bin/docker")
|
|
9290
|
+
(literal "/opt/homebrew/bin/docker")
|
|
9291
|
+
(literal "/opt/homebrew/bin/dockerd")
|
|
9292
|
+
(literal "/opt/homebrew/bin/docker-compose")
|
|
9293
|
+
(literal "/opt/homebrew/bin/podman")
|
|
9294
|
+
(literal "/usr/local/bin/podman")
|
|
9295
|
+
(literal "/opt/homebrew/bin/colima")
|
|
9296
|
+
(literal "/usr/local/bin/colima")
|
|
9297
|
+
(literal "/opt/homebrew/bin/orb")
|
|
9298
|
+
(literal "/Applications/Docker.app/Contents/Resources/bin/docker")
|
|
9299
|
+
(subpath "/Applications/Docker.app/Contents/MacOS/")
|
|
9300
|
+
(subpath "/Applications/OrbStack.app/Contents/MacOS/")
|
|
9301
|
+
(subpath "/Applications/Rancher Desktop.app/Contents/MacOS/")
|
|
9302
|
+
)
|
|
9303
|
+
(deny mach-lookup
|
|
9304
|
+
(xpc-service-name-prefix "com.docker.")
|
|
9305
|
+
(global-name-prefix "com.docker.")
|
|
9306
|
+
(global-name-prefix "dev.kdrag0n.OrbStack")
|
|
9307
|
+
)
|
|
9308
|
+
(deny ipc-posix-shm*
|
|
9309
|
+
(ipc-posix-name-prefix "docker")
|
|
9310
|
+
(ipc-posix-name-prefix "com.docker.")
|
|
9311
|
+
)`,
|
|
9173
9312
|
"restrictive-proxied": `(version 1)
|
|
9174
9313
|
(deny default)
|
|
9175
9314
|
(allow file-read*)
|
|
@@ -9241,7 +9380,48 @@ var BUILTIN_SEATBELT_PROFILE_CONTENTS = {
|
|
|
9241
9380
|
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
9242
9381
|
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
9243
9382
|
(allow network-inbound (local ip "localhost:9229"))
|
|
9244
|
-
(allow network-outbound (remote tcp "localhost:8877"))
|
|
9383
|
+
(allow network-outbound (remote tcp "localhost:8877"))
|
|
9384
|
+
(deny file-read* file-write*
|
|
9385
|
+
(literal "/var/run/docker.sock")
|
|
9386
|
+
(literal "/var/run/docker.sock.raw")
|
|
9387
|
+
(literal "/private/var/run/docker.sock")
|
|
9388
|
+
(literal "/private/var/run/docker.sock.raw")
|
|
9389
|
+
(subpath "/var/run/docker")
|
|
9390
|
+
(subpath "/private/var/run/docker")
|
|
9391
|
+
(subpath "/Users/Shared/.docker")
|
|
9392
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/run"))
|
|
9393
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/desktop"))
|
|
9394
|
+
(subpath (string-append (param "HOME_DIR") "/.colima"))
|
|
9395
|
+
(subpath (string-append (param "HOME_DIR") "/.orbstack/run"))
|
|
9396
|
+
(subpath (string-append (param "HOME_DIR") "/.rd"))
|
|
9397
|
+
)
|
|
9398
|
+
(deny process-exec
|
|
9399
|
+
(literal "/usr/local/bin/docker")
|
|
9400
|
+
(literal "/usr/local/bin/dockerd")
|
|
9401
|
+
(literal "/usr/local/bin/docker-compose")
|
|
9402
|
+
(literal "/usr/bin/docker")
|
|
9403
|
+
(literal "/opt/homebrew/bin/docker")
|
|
9404
|
+
(literal "/opt/homebrew/bin/dockerd")
|
|
9405
|
+
(literal "/opt/homebrew/bin/docker-compose")
|
|
9406
|
+
(literal "/opt/homebrew/bin/podman")
|
|
9407
|
+
(literal "/usr/local/bin/podman")
|
|
9408
|
+
(literal "/opt/homebrew/bin/colima")
|
|
9409
|
+
(literal "/usr/local/bin/colima")
|
|
9410
|
+
(literal "/opt/homebrew/bin/orb")
|
|
9411
|
+
(literal "/Applications/Docker.app/Contents/Resources/bin/docker")
|
|
9412
|
+
(subpath "/Applications/Docker.app/Contents/MacOS/")
|
|
9413
|
+
(subpath "/Applications/OrbStack.app/Contents/MacOS/")
|
|
9414
|
+
(subpath "/Applications/Rancher Desktop.app/Contents/MacOS/")
|
|
9415
|
+
)
|
|
9416
|
+
(deny mach-lookup
|
|
9417
|
+
(xpc-service-name-prefix "com.docker.")
|
|
9418
|
+
(global-name-prefix "com.docker.")
|
|
9419
|
+
(global-name-prefix "dev.kdrag0n.OrbStack")
|
|
9420
|
+
)
|
|
9421
|
+
(deny ipc-posix-shm*
|
|
9422
|
+
(ipc-posix-name-prefix "docker")
|
|
9423
|
+
(ipc-posix-name-prefix "com.docker.")
|
|
9424
|
+
)`,
|
|
9245
9425
|
"strict-open": `(version 1)
|
|
9246
9426
|
(deny default)
|
|
9247
9427
|
(allow file-read*
|
|
@@ -9342,7 +9522,48 @@ var BUILTIN_SEATBELT_PROFILE_CONTENTS = {
|
|
|
9342
9522
|
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
9343
9523
|
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
9344
9524
|
(allow network-inbound (local ip "localhost:9229"))
|
|
9345
|
-
(allow network-outbound)
|
|
9525
|
+
(allow network-outbound)
|
|
9526
|
+
(deny file-read* file-write*
|
|
9527
|
+
(literal "/var/run/docker.sock")
|
|
9528
|
+
(literal "/var/run/docker.sock.raw")
|
|
9529
|
+
(literal "/private/var/run/docker.sock")
|
|
9530
|
+
(literal "/private/var/run/docker.sock.raw")
|
|
9531
|
+
(subpath "/var/run/docker")
|
|
9532
|
+
(subpath "/private/var/run/docker")
|
|
9533
|
+
(subpath "/Users/Shared/.docker")
|
|
9534
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/run"))
|
|
9535
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/desktop"))
|
|
9536
|
+
(subpath (string-append (param "HOME_DIR") "/.colima"))
|
|
9537
|
+
(subpath (string-append (param "HOME_DIR") "/.orbstack/run"))
|
|
9538
|
+
(subpath (string-append (param "HOME_DIR") "/.rd"))
|
|
9539
|
+
)
|
|
9540
|
+
(deny process-exec
|
|
9541
|
+
(literal "/usr/local/bin/docker")
|
|
9542
|
+
(literal "/usr/local/bin/dockerd")
|
|
9543
|
+
(literal "/usr/local/bin/docker-compose")
|
|
9544
|
+
(literal "/usr/bin/docker")
|
|
9545
|
+
(literal "/opt/homebrew/bin/docker")
|
|
9546
|
+
(literal "/opt/homebrew/bin/dockerd")
|
|
9547
|
+
(literal "/opt/homebrew/bin/docker-compose")
|
|
9548
|
+
(literal "/opt/homebrew/bin/podman")
|
|
9549
|
+
(literal "/usr/local/bin/podman")
|
|
9550
|
+
(literal "/opt/homebrew/bin/colima")
|
|
9551
|
+
(literal "/usr/local/bin/colima")
|
|
9552
|
+
(literal "/opt/homebrew/bin/orb")
|
|
9553
|
+
(literal "/Applications/Docker.app/Contents/Resources/bin/docker")
|
|
9554
|
+
(subpath "/Applications/Docker.app/Contents/MacOS/")
|
|
9555
|
+
(subpath "/Applications/OrbStack.app/Contents/MacOS/")
|
|
9556
|
+
(subpath "/Applications/Rancher Desktop.app/Contents/MacOS/")
|
|
9557
|
+
)
|
|
9558
|
+
(deny mach-lookup
|
|
9559
|
+
(xpc-service-name-prefix "com.docker.")
|
|
9560
|
+
(global-name-prefix "com.docker.")
|
|
9561
|
+
(global-name-prefix "dev.kdrag0n.OrbStack")
|
|
9562
|
+
)
|
|
9563
|
+
(deny ipc-posix-shm*
|
|
9564
|
+
(ipc-posix-name-prefix "docker")
|
|
9565
|
+
(ipc-posix-name-prefix "com.docker.")
|
|
9566
|
+
)`,
|
|
9346
9567
|
"strict-proxied": `(version 1)
|
|
9347
9568
|
(deny default)
|
|
9348
9569
|
(allow file-read*
|
|
@@ -9443,7 +9664,48 @@ var BUILTIN_SEATBELT_PROFILE_CONTENTS = {
|
|
|
9443
9664
|
(allow mach-lookup (global-name "com.apple.sysmond"))
|
|
9444
9665
|
(allow file-ioctl (regex #"^/dev/tty.*"))
|
|
9445
9666
|
(allow network-inbound (local ip "localhost:9229"))
|
|
9446
|
-
(allow network-outbound (remote tcp "localhost:8877"))
|
|
9667
|
+
(allow network-outbound (remote tcp "localhost:8877"))
|
|
9668
|
+
(deny file-read* file-write*
|
|
9669
|
+
(literal "/var/run/docker.sock")
|
|
9670
|
+
(literal "/var/run/docker.sock.raw")
|
|
9671
|
+
(literal "/private/var/run/docker.sock")
|
|
9672
|
+
(literal "/private/var/run/docker.sock.raw")
|
|
9673
|
+
(subpath "/var/run/docker")
|
|
9674
|
+
(subpath "/private/var/run/docker")
|
|
9675
|
+
(subpath "/Users/Shared/.docker")
|
|
9676
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/run"))
|
|
9677
|
+
(subpath (string-append (param "HOME_DIR") "/.docker/desktop"))
|
|
9678
|
+
(subpath (string-append (param "HOME_DIR") "/.colima"))
|
|
9679
|
+
(subpath (string-append (param "HOME_DIR") "/.orbstack/run"))
|
|
9680
|
+
(subpath (string-append (param "HOME_DIR") "/.rd"))
|
|
9681
|
+
)
|
|
9682
|
+
(deny process-exec
|
|
9683
|
+
(literal "/usr/local/bin/docker")
|
|
9684
|
+
(literal "/usr/local/bin/dockerd")
|
|
9685
|
+
(literal "/usr/local/bin/docker-compose")
|
|
9686
|
+
(literal "/usr/bin/docker")
|
|
9687
|
+
(literal "/opt/homebrew/bin/docker")
|
|
9688
|
+
(literal "/opt/homebrew/bin/dockerd")
|
|
9689
|
+
(literal "/opt/homebrew/bin/docker-compose")
|
|
9690
|
+
(literal "/opt/homebrew/bin/podman")
|
|
9691
|
+
(literal "/usr/local/bin/podman")
|
|
9692
|
+
(literal "/opt/homebrew/bin/colima")
|
|
9693
|
+
(literal "/usr/local/bin/colima")
|
|
9694
|
+
(literal "/opt/homebrew/bin/orb")
|
|
9695
|
+
(literal "/Applications/Docker.app/Contents/Resources/bin/docker")
|
|
9696
|
+
(subpath "/Applications/Docker.app/Contents/MacOS/")
|
|
9697
|
+
(subpath "/Applications/OrbStack.app/Contents/MacOS/")
|
|
9698
|
+
(subpath "/Applications/Rancher Desktop.app/Contents/MacOS/")
|
|
9699
|
+
)
|
|
9700
|
+
(deny mach-lookup
|
|
9701
|
+
(xpc-service-name-prefix "com.docker.")
|
|
9702
|
+
(global-name-prefix "com.docker.")
|
|
9703
|
+
(global-name-prefix "dev.kdrag0n.OrbStack")
|
|
9704
|
+
)
|
|
9705
|
+
(deny ipc-posix-shm*
|
|
9706
|
+
(ipc-posix-name-prefix "docker")
|
|
9707
|
+
(ipc-posix-name-prefix "com.docker.")
|
|
9708
|
+
)`
|
|
9447
9709
|
};
|
|
9448
9710
|
BUILTIN_SEATBELT_PROFILE_CONTENTS["permissive-closed"] = BUILTIN_SEATBELT_PROFILE_CONTENTS["strict-open"];
|
|
9449
9711
|
BUILTIN_SEATBELT_PROFILE_CONTENTS["restrictive-closed"] = BUILTIN_SEATBELT_PROFILE_CONTENTS["strict-proxied"];
|
|
@@ -10412,7 +10674,7 @@ import path9 from "node:path";
|
|
|
10412
10674
|
import process4 from "node:process";
|
|
10413
10675
|
var homeDirectoryCheck = {
|
|
10414
10676
|
id: "home-directory",
|
|
10415
|
-
priority:
|
|
10677
|
+
priority: WarningPriority.Low,
|
|
10416
10678
|
check: async (workspaceRoot, settings) => {
|
|
10417
10679
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
10418
10680
|
return null;
|
|
@@ -10436,7 +10698,7 @@ var homeDirectoryCheck = {
|
|
|
10436
10698
|
};
|
|
10437
10699
|
var rootDirectoryCheck = {
|
|
10438
10700
|
id: "root-directory",
|
|
10439
|
-
priority:
|
|
10701
|
+
priority: WarningPriority.High,
|
|
10440
10702
|
check: async (workspaceRoot, _settings) => {
|
|
10441
10703
|
try {
|
|
10442
10704
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -10452,7 +10714,7 @@ var rootDirectoryCheck = {
|
|
|
10452
10714
|
};
|
|
10453
10715
|
var folderTrustCheck = {
|
|
10454
10716
|
id: "folder-trust",
|
|
10455
|
-
priority:
|
|
10717
|
+
priority: WarningPriority.High,
|
|
10456
10718
|
check: async (workspaceRoot, settings) => {
|
|
10457
10719
|
if (!isFolderTrustEnabled(settings)) {
|
|
10458
10720
|
return null;
|
|
@@ -10642,12 +10904,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10642
10904
|
error,
|
|
10643
10905
|
config.getContentGeneratorConfig()?.authType
|
|
10644
10906
|
);
|
|
10645
|
-
if (config.getOutputFormat() ===
|
|
10907
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10646
10908
|
const streamFormatter = new StreamJsonFormatter();
|
|
10647
10909
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10648
10910
|
const metrics = uiTelemetryService.getMetrics();
|
|
10649
10911
|
streamFormatter.emitEvent({
|
|
10650
|
-
type:
|
|
10912
|
+
type: JsonStreamEventType.RESULT,
|
|
10651
10913
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10652
10914
|
status: "error",
|
|
10653
10915
|
error: {
|
|
@@ -10658,7 +10920,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10658
10920
|
});
|
|
10659
10921
|
runSyncCleanup();
|
|
10660
10922
|
process.exit(getNumericExitCode(errorCode));
|
|
10661
|
-
} else if (config.getOutputFormat() ===
|
|
10923
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10662
10924
|
const formatter = new JsonFormatter();
|
|
10663
10925
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10664
10926
|
const formattedError = formatter.formatError(
|
|
@@ -10678,11 +10940,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10678
10940
|
const isFatal = isFatalToolError(errorType);
|
|
10679
10941
|
if (isFatal) {
|
|
10680
10942
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10681
|
-
if (config.getOutputFormat() ===
|
|
10943
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10682
10944
|
const streamFormatter = new StreamJsonFormatter();
|
|
10683
10945
|
const metrics = uiTelemetryService.getMetrics();
|
|
10684
10946
|
streamFormatter.emitEvent({
|
|
10685
|
-
type:
|
|
10947
|
+
type: JsonStreamEventType.RESULT,
|
|
10686
10948
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10687
10949
|
status: "error",
|
|
10688
10950
|
error: {
|
|
@@ -10691,7 +10953,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10691
10953
|
},
|
|
10692
10954
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10693
10955
|
});
|
|
10694
|
-
} else if (config.getOutputFormat() ===
|
|
10956
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10695
10957
|
const formatter = new JsonFormatter();
|
|
10696
10958
|
const formattedError = formatter.formatError(
|
|
10697
10959
|
toolExecutionError,
|
|
@@ -10709,11 +10971,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10709
10971
|
}
|
|
10710
10972
|
function handleCancellationError(config) {
|
|
10711
10973
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10712
|
-
if (config.getOutputFormat() ===
|
|
10974
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10713
10975
|
const streamFormatter = new StreamJsonFormatter();
|
|
10714
10976
|
const metrics = uiTelemetryService.getMetrics();
|
|
10715
10977
|
streamFormatter.emitEvent({
|
|
10716
|
-
type:
|
|
10978
|
+
type: JsonStreamEventType.RESULT,
|
|
10717
10979
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10718
10980
|
status: "error",
|
|
10719
10981
|
error: {
|
|
@@ -10724,7 +10986,7 @@ function handleCancellationError(config) {
|
|
|
10724
10986
|
});
|
|
10725
10987
|
runSyncCleanup();
|
|
10726
10988
|
process.exit(cancellationError.exitCode);
|
|
10727
|
-
} else if (config.getOutputFormat() ===
|
|
10989
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10728
10990
|
const formatter = new JsonFormatter();
|
|
10729
10991
|
const formattedError = formatter.formatError(
|
|
10730
10992
|
cancellationError,
|
|
@@ -10744,11 +11006,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10744
11006
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10745
11007
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10746
11008
|
);
|
|
10747
|
-
if (config.getOutputFormat() ===
|
|
11009
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10748
11010
|
const streamFormatter = new StreamJsonFormatter();
|
|
10749
11011
|
const metrics = uiTelemetryService.getMetrics();
|
|
10750
11012
|
streamFormatter.emitEvent({
|
|
10751
|
-
type:
|
|
11013
|
+
type: JsonStreamEventType.RESULT,
|
|
10752
11014
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10753
11015
|
status: "error",
|
|
10754
11016
|
error: {
|
|
@@ -10759,7 +11021,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10759
11021
|
});
|
|
10760
11022
|
runSyncCleanup();
|
|
10761
11023
|
process.exit(maxTurnsError.exitCode);
|
|
10762
|
-
} else if (config.getOutputFormat() ===
|
|
11024
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10763
11025
|
const formatter = new JsonFormatter();
|
|
10764
11026
|
const formattedError = formatter.formatError(
|
|
10765
11027
|
maxTurnsError,
|
|
@@ -10839,7 +11101,7 @@ async function runNonInteractive({
|
|
|
10839
11101
|
}
|
|
10840
11102
|
});
|
|
10841
11103
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10842
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11104
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-DXYGYJ7D.js");
|
|
10843
11105
|
setupInitialActivityLogger(config);
|
|
10844
11106
|
}
|
|
10845
11107
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10855,7 +11117,7 @@ async function runNonInteractive({
|
|
|
10855
11117
|
}
|
|
10856
11118
|
};
|
|
10857
11119
|
const startTime = Date.now();
|
|
10858
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11120
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10859
11121
|
const abortController = new AbortController();
|
|
10860
11122
|
let isAborting = false;
|
|
10861
11123
|
let cancelMessageTimer = null;
|
|
@@ -10908,13 +11170,13 @@ async function runNonInteractive({
|
|
|
10908
11170
|
};
|
|
10909
11171
|
try {
|
|
10910
11172
|
consolePatcher.patch();
|
|
10911
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11173
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10912
11174
|
process.stderr.write(
|
|
10913
11175
|
"[WARNING] --raw-output is enabled. Model output is not sanitized and may contain harmful ANSI sequences (e.g. for phishing or command injection). Use --accept-raw-output-risk to suppress this warning.\n"
|
|
10914
11176
|
);
|
|
10915
11177
|
}
|
|
10916
11178
|
setupStdinCancellation();
|
|
10917
|
-
coreEvents.on(
|
|
11179
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10918
11180
|
coreEvents.drainBacklogs();
|
|
10919
11181
|
process.stdout.on("error", (err) => {
|
|
10920
11182
|
if (err.code === "EPIPE") {
|
|
@@ -10940,7 +11202,7 @@ async function runNonInteractive({
|
|
|
10940
11202
|
}
|
|
10941
11203
|
if (streamFormatter) {
|
|
10942
11204
|
streamFormatter.emitEvent({
|
|
10943
|
-
type:
|
|
11205
|
+
type: JsonStreamEventType.INIT,
|
|
10944
11206
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10945
11207
|
session_id: config.getSessionId(),
|
|
10946
11208
|
model: config.getModel()
|
|
@@ -10978,7 +11240,7 @@ async function runNonInteractive({
|
|
|
10978
11240
|
}
|
|
10979
11241
|
if (streamFormatter) {
|
|
10980
11242
|
streamFormatter.emitEvent({
|
|
10981
|
-
type:
|
|
11243
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10982
11244
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10983
11245
|
role: "user",
|
|
10984
11246
|
content: input
|
|
@@ -11017,12 +11279,12 @@ async function runNonInteractive({
|
|
|
11017
11279
|
const metrics = uiTelemetryService.getMetrics();
|
|
11018
11280
|
const durationMs = Date.now() - startTime;
|
|
11019
11281
|
streamFormatter.emitEvent({
|
|
11020
|
-
type:
|
|
11282
|
+
type: JsonStreamEventType.RESULT,
|
|
11021
11283
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11022
11284
|
status: errorPayload ? "error" : "success",
|
|
11023
11285
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11024
11286
|
});
|
|
11025
|
-
} else if (config.getOutputFormat() ===
|
|
11287
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11026
11288
|
const formatter = new JsonFormatter();
|
|
11027
11289
|
const stats = uiTelemetryService.getMetrics();
|
|
11028
11290
|
textOutput.write(
|
|
@@ -11115,13 +11377,13 @@ async function runNonInteractive({
|
|
|
11115
11377
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
11116
11378
|
if (streamFormatter) {
|
|
11117
11379
|
streamFormatter.emitEvent({
|
|
11118
|
-
type:
|
|
11380
|
+
type: JsonStreamEventType.MESSAGE,
|
|
11119
11381
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11120
11382
|
role: "assistant",
|
|
11121
11383
|
content: output,
|
|
11122
11384
|
delta: true
|
|
11123
11385
|
});
|
|
11124
|
-
} else if (config.getOutputFormat() ===
|
|
11386
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11125
11387
|
responseText += output;
|
|
11126
11388
|
} else {
|
|
11127
11389
|
if (part.text) {
|
|
@@ -11134,13 +11396,13 @@ async function runNonInteractive({
|
|
|
11134
11396
|
break;
|
|
11135
11397
|
}
|
|
11136
11398
|
case "tool_request": {
|
|
11137
|
-
if (config.getOutputFormat() ===
|
|
11399
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11138
11400
|
preToolResponseText = responseText || preToolResponseText;
|
|
11139
11401
|
responseText = "";
|
|
11140
11402
|
}
|
|
11141
11403
|
if (streamFormatter) {
|
|
11142
11404
|
streamFormatter.emitEvent({
|
|
11143
|
-
type:
|
|
11405
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
11144
11406
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11145
11407
|
tool_name: event.name,
|
|
11146
11408
|
tool_id: event.requestId,
|
|
@@ -11156,7 +11418,7 @@ async function runNonInteractive({
|
|
|
11156
11418
|
const displayText = displayContentToString(display);
|
|
11157
11419
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11158
11420
|
streamFormatter.emitEvent({
|
|
11159
|
-
type:
|
|
11421
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
11160
11422
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11161
11423
|
tool_id: event.requestId,
|
|
11162
11424
|
status: event.isError ? "error" : "success",
|
|
@@ -11171,17 +11433,17 @@ async function runNonInteractive({
|
|
|
11171
11433
|
const display = event.display?.result;
|
|
11172
11434
|
const displayText = displayContentToString(display);
|
|
11173
11435
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11174
|
-
if (event.data?.["errorType"] ===
|
|
11175
|
-
if (config.getOutputFormat() ===
|
|
11436
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
11437
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
11176
11438
|
responseText = preToolResponseText;
|
|
11177
11439
|
}
|
|
11178
11440
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
11179
|
-
if (config.getOutputFormat() ===
|
|
11441
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11180
11442
|
process.stderr.write(`${stopMessage}
|
|
11181
11443
|
`);
|
|
11182
11444
|
}
|
|
11183
11445
|
}
|
|
11184
|
-
if (event.data?.["errorType"] ===
|
|
11446
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
11185
11447
|
throw new FatalToolExecutionError(
|
|
11186
11448
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
11187
11449
|
);
|
|
@@ -11216,12 +11478,12 @@ async function runNonInteractive({
|
|
|
11216
11478
|
}
|
|
11217
11479
|
if (streamFormatter) {
|
|
11218
11480
|
streamFormatter.emitEvent({
|
|
11219
|
-
type:
|
|
11481
|
+
type: JsonStreamEventType.ERROR,
|
|
11220
11482
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11221
11483
|
severity: "error",
|
|
11222
11484
|
message: errorMessage
|
|
11223
11485
|
});
|
|
11224
|
-
} else if (config.getOutputFormat() ===
|
|
11486
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11225
11487
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
11226
11488
|
`);
|
|
11227
11489
|
}
|
|
@@ -11242,12 +11504,12 @@ async function runNonInteractive({
|
|
|
11242
11504
|
const errorCode = event._meta?.["code"];
|
|
11243
11505
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
11244
11506
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
11245
|
-
if (config.getOutputFormat() ===
|
|
11507
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11246
11508
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11247
11509
|
`);
|
|
11248
11510
|
} else if (streamFormatter) {
|
|
11249
11511
|
streamFormatter.emitEvent({
|
|
11250
|
-
type:
|
|
11512
|
+
type: JsonStreamEventType.ERROR,
|
|
11251
11513
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11252
11514
|
severity: "warning",
|
|
11253
11515
|
message: stripAnsi(blockMessage)
|
|
@@ -11257,13 +11519,13 @@ async function runNonInteractive({
|
|
|
11257
11519
|
break;
|
|
11258
11520
|
}
|
|
11259
11521
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
11260
|
-
if (config.getOutputFormat() ===
|
|
11522
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11261
11523
|
process.stderr.write(`[WARNING] ${event.message}
|
|
11262
11524
|
`);
|
|
11263
11525
|
}
|
|
11264
11526
|
if (streamFormatter) {
|
|
11265
11527
|
streamFormatter.emitEvent({
|
|
11266
|
-
type:
|
|
11528
|
+
type: JsonStreamEventType.ERROR,
|
|
11267
11529
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11268
11530
|
severity,
|
|
11269
11531
|
message: stripAnsi(event.message)
|
|
@@ -11283,7 +11545,7 @@ async function runNonInteractive({
|
|
|
11283
11545
|
);
|
|
11284
11546
|
} else if (streamFormatter) {
|
|
11285
11547
|
streamFormatter.emitEvent({
|
|
11286
|
-
type:
|
|
11548
|
+
type: JsonStreamEventType.ERROR,
|
|
11287
11549
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11288
11550
|
severity: "error",
|
|
11289
11551
|
message: "Maximum session turns exceeded"
|
|
@@ -11291,7 +11553,7 @@ async function runNonInteractive({
|
|
|
11291
11553
|
}
|
|
11292
11554
|
}
|
|
11293
11555
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
11294
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
11556
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11295
11557
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
11296
11558
|
`);
|
|
11297
11559
|
}
|
|
@@ -11321,7 +11583,7 @@ async function runNonInteractive({
|
|
|
11321
11583
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
11322
11584
|
scheduler?.dispose();
|
|
11323
11585
|
consolePatcher.cleanup();
|
|
11324
|
-
coreEvents.off(
|
|
11586
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11325
11587
|
}
|
|
11326
11588
|
if (errorToHandle) {
|
|
11327
11589
|
handleError(errorToHandle, config);
|
|
@@ -11349,7 +11611,7 @@ async function runNonInteractive2(params) {
|
|
|
11349
11611
|
}
|
|
11350
11612
|
});
|
|
11351
11613
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11352
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11614
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-DXYGYJ7D.js");
|
|
11353
11615
|
setupInitialActivityLogger(config);
|
|
11354
11616
|
}
|
|
11355
11617
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11365,7 +11627,7 @@ async function runNonInteractive2(params) {
|
|
|
11365
11627
|
}
|
|
11366
11628
|
};
|
|
11367
11629
|
const startTime = Date.now();
|
|
11368
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11630
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
11369
11631
|
const abortController = new AbortController();
|
|
11370
11632
|
let isAborting = false;
|
|
11371
11633
|
let cancelMessageTimer = null;
|
|
@@ -11416,13 +11678,13 @@ async function runNonInteractive2(params) {
|
|
|
11416
11678
|
let scheduler;
|
|
11417
11679
|
try {
|
|
11418
11680
|
consolePatcher.patch();
|
|
11419
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11681
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11420
11682
|
process.stderr.write(
|
|
11421
11683
|
"[WARNING] --raw-output is enabled. Model output is not sanitized and may contain harmful ANSI sequences (e.g. for phishing or command injection). Use --accept-raw-output-risk to suppress this warning.\n"
|
|
11422
11684
|
);
|
|
11423
11685
|
}
|
|
11424
11686
|
setupStdinCancellation();
|
|
11425
|
-
coreEvents.on(
|
|
11687
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11426
11688
|
coreEvents.drainBacklogs();
|
|
11427
11689
|
process.stdout.on("error", (err) => {
|
|
11428
11690
|
if (err.code === "EPIPE") {
|
|
@@ -11446,7 +11708,7 @@ async function runNonInteractive2(params) {
|
|
|
11446
11708
|
}
|
|
11447
11709
|
if (streamFormatter) {
|
|
11448
11710
|
streamFormatter.emitEvent({
|
|
11449
|
-
type:
|
|
11711
|
+
type: JsonStreamEventType.INIT,
|
|
11450
11712
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11451
11713
|
session_id: config.getSessionId(),
|
|
11452
11714
|
model: config.getModel()
|
|
@@ -11484,7 +11746,7 @@ async function runNonInteractive2(params) {
|
|
|
11484
11746
|
}
|
|
11485
11747
|
if (streamFormatter) {
|
|
11486
11748
|
streamFormatter.emitEvent({
|
|
11487
|
-
type:
|
|
11749
|
+
type: JsonStreamEventType.MESSAGE,
|
|
11488
11750
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11489
11751
|
role: "user",
|
|
11490
11752
|
content: input
|
|
@@ -11512,28 +11774,28 @@ async function runNonInteractive2(params) {
|
|
|
11512
11774
|
if (abortController.signal.aborted) {
|
|
11513
11775
|
handleCancellationError(config);
|
|
11514
11776
|
}
|
|
11515
|
-
if (event.type ===
|
|
11777
|
+
if (event.type === GeminiEventType.Content) {
|
|
11516
11778
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
11517
11779
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
11518
11780
|
if (streamFormatter) {
|
|
11519
11781
|
streamFormatter.emitEvent({
|
|
11520
|
-
type:
|
|
11782
|
+
type: JsonStreamEventType.MESSAGE,
|
|
11521
11783
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11522
11784
|
role: "assistant",
|
|
11523
11785
|
content: output,
|
|
11524
11786
|
delta: true
|
|
11525
11787
|
});
|
|
11526
|
-
} else if (config.getOutputFormat() ===
|
|
11788
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11527
11789
|
responseText += output;
|
|
11528
11790
|
} else {
|
|
11529
11791
|
if (event.value) {
|
|
11530
11792
|
textOutput.write(output);
|
|
11531
11793
|
}
|
|
11532
11794
|
}
|
|
11533
|
-
} else if (event.type ===
|
|
11795
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
11534
11796
|
if (streamFormatter) {
|
|
11535
11797
|
streamFormatter.emitEvent({
|
|
11536
|
-
type:
|
|
11798
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
11537
11799
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11538
11800
|
tool_name: event.value.name,
|
|
11539
11801
|
tool_id: event.value.callId,
|
|
@@ -11541,33 +11803,33 @@ async function runNonInteractive2(params) {
|
|
|
11541
11803
|
});
|
|
11542
11804
|
}
|
|
11543
11805
|
toolCallRequests.push(event.value);
|
|
11544
|
-
} else if (event.type ===
|
|
11806
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
11545
11807
|
const message = "Loop detected, stopping execution";
|
|
11546
11808
|
if (streamFormatter) {
|
|
11547
11809
|
streamFormatter.emitEvent({
|
|
11548
|
-
type:
|
|
11810
|
+
type: JsonStreamEventType.ERROR,
|
|
11549
11811
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11550
11812
|
severity: "warning",
|
|
11551
11813
|
message
|
|
11552
11814
|
});
|
|
11553
11815
|
}
|
|
11554
11816
|
warnings.push(message);
|
|
11555
|
-
} else if (event.type ===
|
|
11817
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
11556
11818
|
const message = "Maximum session turns exceeded";
|
|
11557
11819
|
if (streamFormatter) {
|
|
11558
11820
|
streamFormatter.emitEvent({
|
|
11559
|
-
type:
|
|
11821
|
+
type: JsonStreamEventType.ERROR,
|
|
11560
11822
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11561
11823
|
severity: "error",
|
|
11562
11824
|
message
|
|
11563
11825
|
});
|
|
11564
11826
|
}
|
|
11565
11827
|
warnings.push(message);
|
|
11566
|
-
} else if (event.type ===
|
|
11828
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
11567
11829
|
throw event.value.error;
|
|
11568
|
-
} else if (event.type ===
|
|
11830
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
11569
11831
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
11570
|
-
if (config.getOutputFormat() ===
|
|
11832
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11571
11833
|
process.stderr.write(`${stopMessage}
|
|
11572
11834
|
`);
|
|
11573
11835
|
}
|
|
@@ -11575,7 +11837,7 @@ async function runNonInteractive2(params) {
|
|
|
11575
11837
|
const metrics = uiTelemetryService.getMetrics();
|
|
11576
11838
|
const durationMs = Date.now() - startTime;
|
|
11577
11839
|
streamFormatter.emitEvent({
|
|
11578
|
-
type:
|
|
11840
|
+
type: JsonStreamEventType.RESULT,
|
|
11579
11841
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11580
11842
|
status: "success",
|
|
11581
11843
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11583,7 +11845,7 @@ async function runNonInteractive2(params) {
|
|
|
11583
11845
|
durationMs
|
|
11584
11846
|
)
|
|
11585
11847
|
});
|
|
11586
|
-
} else if (config.getOutputFormat() ===
|
|
11848
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11587
11849
|
const formatter = new JsonFormatter();
|
|
11588
11850
|
const stats = uiTelemetryService.getMetrics();
|
|
11589
11851
|
textOutput.write(
|
|
@@ -11599,21 +11861,21 @@ async function runNonInteractive2(params) {
|
|
|
11599
11861
|
textOutput.ensureTrailingNewline();
|
|
11600
11862
|
}
|
|
11601
11863
|
return;
|
|
11602
|
-
} else if (event.type ===
|
|
11864
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
11603
11865
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
11604
|
-
if (config.getOutputFormat() ===
|
|
11866
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11605
11867
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11606
11868
|
`);
|
|
11607
11869
|
} else if (streamFormatter) {
|
|
11608
11870
|
streamFormatter.emitEvent({
|
|
11609
|
-
type:
|
|
11871
|
+
type: JsonStreamEventType.ERROR,
|
|
11610
11872
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11611
11873
|
severity: "warning",
|
|
11612
11874
|
message: stripAnsi(blockMessage)
|
|
11613
11875
|
});
|
|
11614
11876
|
}
|
|
11615
11877
|
warnings.push(blockMessage);
|
|
11616
|
-
} else if (event.type ===
|
|
11878
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
11617
11879
|
const eventValue = event.value;
|
|
11618
11880
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
11619
11881
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -11636,12 +11898,12 @@ async function runNonInteractive2(params) {
|
|
|
11636
11898
|
);
|
|
11637
11899
|
if (streamFormatter) {
|
|
11638
11900
|
streamFormatter.emitEvent({
|
|
11639
|
-
type:
|
|
11901
|
+
type: JsonStreamEventType.ERROR,
|
|
11640
11902
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11641
11903
|
severity: "error",
|
|
11642
11904
|
message: invalidStreamError
|
|
11643
11905
|
});
|
|
11644
|
-
} else if (config.getOutputFormat() ===
|
|
11906
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11645
11907
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
11646
11908
|
`);
|
|
11647
11909
|
}
|
|
@@ -11661,7 +11923,7 @@ async function runNonInteractive2(params) {
|
|
|
11661
11923
|
const requestInfo = completedToolCall.request;
|
|
11662
11924
|
if (streamFormatter) {
|
|
11663
11925
|
streamFormatter.emitEvent({
|
|
11664
|
-
type:
|
|
11926
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
11665
11927
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11666
11928
|
tool_id: requestInfo.callId,
|
|
11667
11929
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11695,11 +11957,11 @@ async function runNonInteractive2(params) {
|
|
|
11695
11957
|
);
|
|
11696
11958
|
}
|
|
11697
11959
|
const stopExecutionTool = completedToolCalls.find(
|
|
11698
|
-
(tc) => tc.response.errorType ===
|
|
11960
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
11699
11961
|
);
|
|
11700
11962
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11701
11963
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11702
|
-
if (config.getOutputFormat() ===
|
|
11964
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11703
11965
|
process.stderr.write(`${stopMessage}
|
|
11704
11966
|
`);
|
|
11705
11967
|
}
|
|
@@ -11707,7 +11969,7 @@ async function runNonInteractive2(params) {
|
|
|
11707
11969
|
const metrics = uiTelemetryService.getMetrics();
|
|
11708
11970
|
const durationMs = Date.now() - startTime;
|
|
11709
11971
|
streamFormatter.emitEvent({
|
|
11710
|
-
type:
|
|
11972
|
+
type: JsonStreamEventType.RESULT,
|
|
11711
11973
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11712
11974
|
status: "success",
|
|
11713
11975
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11715,7 +11977,7 @@ async function runNonInteractive2(params) {
|
|
|
11715
11977
|
durationMs
|
|
11716
11978
|
)
|
|
11717
11979
|
});
|
|
11718
|
-
} else if (config.getOutputFormat() ===
|
|
11980
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11719
11981
|
const formatter = new JsonFormatter();
|
|
11720
11982
|
const stats = uiTelemetryService.getMetrics();
|
|
11721
11983
|
textOutput.write(
|
|
@@ -11738,12 +12000,12 @@ async function runNonInteractive2(params) {
|
|
|
11738
12000
|
const metrics = uiTelemetryService.getMetrics();
|
|
11739
12001
|
const durationMs = Date.now() - startTime;
|
|
11740
12002
|
streamFormatter.emitEvent({
|
|
11741
|
-
type:
|
|
12003
|
+
type: JsonStreamEventType.RESULT,
|
|
11742
12004
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11743
12005
|
status: invalidStreamError ? "error" : "success",
|
|
11744
12006
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11745
12007
|
});
|
|
11746
|
-
} else if (config.getOutputFormat() ===
|
|
12008
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11747
12009
|
const formatter = new JsonFormatter();
|
|
11748
12010
|
const stats = uiTelemetryService.getMetrics();
|
|
11749
12011
|
textOutput.write(
|
|
@@ -11767,7 +12029,7 @@ async function runNonInteractive2(params) {
|
|
|
11767
12029
|
cleanupStdinCancellation();
|
|
11768
12030
|
scheduler?.dispose();
|
|
11769
12031
|
consolePatcher.cleanup();
|
|
11770
|
-
coreEvents.off(
|
|
12032
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11771
12033
|
}
|
|
11772
12034
|
if (errorToHandle) {
|
|
11773
12035
|
handleError(errorToHandle, config);
|
|
@@ -14158,12 +14420,12 @@ function toToolCallContent(toolResult) {
|
|
|
14158
14420
|
}
|
|
14159
14421
|
var basicPermissionOptions = [
|
|
14160
14422
|
{
|
|
14161
|
-
optionId:
|
|
14423
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14162
14424
|
name: "Allow",
|
|
14163
14425
|
kind: "allow_once"
|
|
14164
14426
|
},
|
|
14165
14427
|
{
|
|
14166
|
-
optionId:
|
|
14428
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14167
14429
|
name: "Reject",
|
|
14168
14430
|
kind: "reject_once"
|
|
14169
14431
|
}
|
|
@@ -14175,13 +14437,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14175
14437
|
switch (confirmation.type) {
|
|
14176
14438
|
case "edit":
|
|
14177
14439
|
options.push({
|
|
14178
|
-
optionId:
|
|
14440
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14179
14441
|
name: "Allow for this session",
|
|
14180
14442
|
kind: "allow_always"
|
|
14181
14443
|
});
|
|
14182
14444
|
if (enablePermanentToolApproval) {
|
|
14183
14445
|
options.push({
|
|
14184
|
-
optionId:
|
|
14446
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14185
14447
|
name: "Allow for this file in all future sessions",
|
|
14186
14448
|
kind: "allow_always"
|
|
14187
14449
|
});
|
|
@@ -14189,13 +14451,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14189
14451
|
break;
|
|
14190
14452
|
case "exec":
|
|
14191
14453
|
options.push({
|
|
14192
|
-
optionId:
|
|
14454
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14193
14455
|
name: "Allow for this session",
|
|
14194
14456
|
kind: "allow_always"
|
|
14195
14457
|
});
|
|
14196
14458
|
if (enablePermanentToolApproval) {
|
|
14197
14459
|
options.push({
|
|
14198
|
-
optionId:
|
|
14460
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14199
14461
|
name: "Allow this command for all future sessions",
|
|
14200
14462
|
kind: "allow_always"
|
|
14201
14463
|
});
|
|
@@ -14204,19 +14466,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14204
14466
|
case "mcp":
|
|
14205
14467
|
options.push(
|
|
14206
14468
|
{
|
|
14207
|
-
optionId:
|
|
14469
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
14208
14470
|
name: "Allow all server tools for this session",
|
|
14209
14471
|
kind: "allow_always"
|
|
14210
14472
|
},
|
|
14211
14473
|
{
|
|
14212
|
-
optionId:
|
|
14474
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
14213
14475
|
name: "Allow tool for this session",
|
|
14214
14476
|
kind: "allow_always"
|
|
14215
14477
|
}
|
|
14216
14478
|
);
|
|
14217
14479
|
if (enablePermanentToolApproval) {
|
|
14218
14480
|
options.push({
|
|
14219
|
-
optionId:
|
|
14481
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14220
14482
|
name: "Allow tool for all future sessions",
|
|
14221
14483
|
kind: "allow_always"
|
|
14222
14484
|
});
|
|
@@ -14224,13 +14486,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14224
14486
|
break;
|
|
14225
14487
|
case "info":
|
|
14226
14488
|
options.push({
|
|
14227
|
-
optionId:
|
|
14489
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14228
14490
|
name: "Allow for this session",
|
|
14229
14491
|
kind: "allow_always"
|
|
14230
14492
|
});
|
|
14231
14493
|
if (enablePermanentToolApproval) {
|
|
14232
14494
|
options.push({
|
|
14233
|
-
optionId:
|
|
14495
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14234
14496
|
name: "Allow for all future sessions",
|
|
14235
14497
|
kind: "allow_always"
|
|
14236
14498
|
});
|
|
@@ -14262,21 +14524,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14262
14524
|
}
|
|
14263
14525
|
function toAcpToolKind(kind) {
|
|
14264
14526
|
switch (kind) {
|
|
14265
|
-
case
|
|
14266
|
-
case
|
|
14267
|
-
case
|
|
14268
|
-
case
|
|
14269
|
-
case
|
|
14270
|
-
case
|
|
14271
|
-
case
|
|
14272
|
-
case
|
|
14273
|
-
case
|
|
14274
|
-
case
|
|
14527
|
+
case Kind.Read:
|
|
14528
|
+
case Kind.Edit:
|
|
14529
|
+
case Kind.Execute:
|
|
14530
|
+
case Kind.Search:
|
|
14531
|
+
case Kind.Delete:
|
|
14532
|
+
case Kind.Move:
|
|
14533
|
+
case Kind.Think:
|
|
14534
|
+
case Kind.Fetch:
|
|
14535
|
+
case Kind.SwitchMode:
|
|
14536
|
+
case Kind.Other:
|
|
14275
14537
|
return kind;
|
|
14276
|
-
case
|
|
14538
|
+
case Kind.Agent:
|
|
14277
14539
|
return "think";
|
|
14278
|
-
case
|
|
14279
|
-
case
|
|
14540
|
+
case Kind.Plan:
|
|
14541
|
+
case Kind.Communicate:
|
|
14280
14542
|
default:
|
|
14281
14543
|
return "other";
|
|
14282
14544
|
}
|
|
@@ -14284,24 +14546,24 @@ function toAcpToolKind(kind) {
|
|
|
14284
14546
|
function buildAvailableModes(isPlanEnabled) {
|
|
14285
14547
|
const modes = [
|
|
14286
14548
|
{
|
|
14287
|
-
id:
|
|
14549
|
+
id: ApprovalMode.DEFAULT,
|
|
14288
14550
|
name: "Default",
|
|
14289
14551
|
description: "Prompts for approval"
|
|
14290
14552
|
},
|
|
14291
14553
|
{
|
|
14292
|
-
id:
|
|
14554
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
14293
14555
|
name: "Auto Edit",
|
|
14294
14556
|
description: "Auto-approves edit tools"
|
|
14295
14557
|
},
|
|
14296
14558
|
{
|
|
14297
|
-
id:
|
|
14559
|
+
id: ApprovalMode.YOLO,
|
|
14298
14560
|
name: "YOLO",
|
|
14299
14561
|
description: "Auto-approves all tools"
|
|
14300
14562
|
}
|
|
14301
14563
|
];
|
|
14302
14564
|
if (isPlanEnabled) {
|
|
14303
14565
|
modes.push({
|
|
14304
|
-
id:
|
|
14566
|
+
id: ApprovalMode.PLAN,
|
|
14305
14567
|
name: "Plan",
|
|
14306
14568
|
description: "Read-only mode"
|
|
14307
14569
|
});
|
|
@@ -14314,7 +14576,7 @@ function buildAvailableModels(config, settings) {
|
|
|
14314
14576
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
14315
14577
|
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
|
|
14316
14578
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
14317
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
14579
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
14318
14580
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
14319
14581
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
14320
14582
|
useGemini3_1: useGemini31,
|
|
@@ -14400,11 +14662,11 @@ var Session = class {
|
|
|
14400
14662
|
this.connection = connection;
|
|
14401
14663
|
this.settings = settings;
|
|
14402
14664
|
coreEvents.on(
|
|
14403
|
-
|
|
14665
|
+
CoreEvent.ApprovalModeChanged,
|
|
14404
14666
|
this.handleApprovalModeChanged
|
|
14405
14667
|
);
|
|
14406
14668
|
this.context.config.getMessageBus()?.subscribe(
|
|
14407
|
-
|
|
14669
|
+
MessageBusType.TOOL_CONFIRMATION_REQUEST,
|
|
14408
14670
|
this.handleToolConfirmationRequest,
|
|
14409
14671
|
{ signal: this.disposeController.signal }
|
|
14410
14672
|
);
|
|
@@ -14428,7 +14690,7 @@ var Session = class {
|
|
|
14428
14690
|
"Policy engine missing. Denying tool confirmation request."
|
|
14429
14691
|
);
|
|
14430
14692
|
await messageBus.publish({
|
|
14431
|
-
type:
|
|
14693
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
14432
14694
|
correlationId: request.correlationId,
|
|
14433
14695
|
confirmed: false,
|
|
14434
14696
|
requiresUserConfirmation: false
|
|
@@ -14441,7 +14703,7 @@ var Session = class {
|
|
|
14441
14703
|
"Tool confirmation request missing tool name. Denying."
|
|
14442
14704
|
);
|
|
14443
14705
|
await messageBus.publish({
|
|
14444
|
-
type:
|
|
14706
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
14445
14707
|
correlationId: request.correlationId,
|
|
14446
14708
|
confirmed: false,
|
|
14447
14709
|
requiresUserConfirmation: false
|
|
@@ -14454,7 +14716,7 @@ var Session = class {
|
|
|
14454
14716
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
14455
14717
|
);
|
|
14456
14718
|
await messageBus.publish({
|
|
14457
|
-
type:
|
|
14719
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
14458
14720
|
correlationId: request.correlationId,
|
|
14459
14721
|
confirmed: false,
|
|
14460
14722
|
requiresUserConfirmation: false
|
|
@@ -14470,15 +14732,15 @@ var Session = class {
|
|
|
14470
14732
|
request.subagent
|
|
14471
14733
|
);
|
|
14472
14734
|
await messageBus.publish({
|
|
14473
|
-
type:
|
|
14735
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
14474
14736
|
correlationId: request.correlationId,
|
|
14475
|
-
confirmed: result.decision ===
|
|
14476
|
-
requiresUserConfirmation: result.decision ===
|
|
14737
|
+
confirmed: result.decision === PolicyDecision.ALLOW,
|
|
14738
|
+
requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
|
|
14477
14739
|
});
|
|
14478
14740
|
} catch (error) {
|
|
14479
14741
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
14480
14742
|
await this.context.config.getMessageBus()?.publish({
|
|
14481
|
-
type:
|
|
14743
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
14482
14744
|
correlationId: request.correlationId,
|
|
14483
14745
|
confirmed: false,
|
|
14484
14746
|
requiresUserConfirmation: false
|
|
@@ -14498,7 +14760,7 @@ var Session = class {
|
|
|
14498
14760
|
};
|
|
14499
14761
|
dispose() {
|
|
14500
14762
|
coreEvents.off(
|
|
14501
|
-
|
|
14763
|
+
CoreEvent.ApprovalModeChanged,
|
|
14502
14764
|
this.handleApprovalModeChanged
|
|
14503
14765
|
);
|
|
14504
14766
|
this.disposeController.abort();
|
|
@@ -14587,7 +14849,7 @@ ${thought.description}`;
|
|
|
14587
14849
|
await this.sendUpdate({
|
|
14588
14850
|
sessionUpdate: "tool_call",
|
|
14589
14851
|
toolCallId: toolCall.id,
|
|
14590
|
-
status: toolCall.status ===
|
|
14852
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
14591
14853
|
title: toolCall.displayName || toolCall.name,
|
|
14592
14854
|
content: toolCallContent,
|
|
14593
14855
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14679,7 +14941,7 @@ ${thought.description}`;
|
|
|
14679
14941
|
return { stopReason: "cancelled" };
|
|
14680
14942
|
}
|
|
14681
14943
|
switch (event.type) {
|
|
14682
|
-
case
|
|
14944
|
+
case GeminiEventType.Content: {
|
|
14683
14945
|
const content = {
|
|
14684
14946
|
type: "text",
|
|
14685
14947
|
text: event.value
|
|
@@ -14690,7 +14952,7 @@ ${thought.description}`;
|
|
|
14690
14952
|
});
|
|
14691
14953
|
break;
|
|
14692
14954
|
}
|
|
14693
|
-
case
|
|
14955
|
+
case GeminiEventType.Thought: {
|
|
14694
14956
|
const thoughtText = `**${event.value.subject}**
|
|
14695
14957
|
${event.value.description}`;
|
|
14696
14958
|
await this.sendUpdate({
|
|
@@ -14699,10 +14961,10 @@ ${event.value.description}`;
|
|
|
14699
14961
|
});
|
|
14700
14962
|
break;
|
|
14701
14963
|
}
|
|
14702
|
-
case
|
|
14964
|
+
case GeminiEventType.ToolCallRequest:
|
|
14703
14965
|
toolCallRequests.push(event.value);
|
|
14704
14966
|
break;
|
|
14705
|
-
case
|
|
14967
|
+
case GeminiEventType.Finished: {
|
|
14706
14968
|
const usage2 = event.value.usageMetadata;
|
|
14707
14969
|
if (usage2) {
|
|
14708
14970
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14710,19 +14972,19 @@ ${event.value.description}`;
|
|
|
14710
14972
|
}
|
|
14711
14973
|
break;
|
|
14712
14974
|
}
|
|
14713
|
-
case
|
|
14975
|
+
case GeminiEventType.ModelInfo:
|
|
14714
14976
|
turnModelId = event.value;
|
|
14715
14977
|
break;
|
|
14716
|
-
case
|
|
14978
|
+
case GeminiEventType.MaxSessionTurns:
|
|
14717
14979
|
stopReason = "max_turn_requests";
|
|
14718
14980
|
break;
|
|
14719
|
-
case
|
|
14981
|
+
case GeminiEventType.LoopDetected:
|
|
14720
14982
|
stopReason = "max_turn_requests";
|
|
14721
14983
|
break;
|
|
14722
|
-
case
|
|
14984
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
14723
14985
|
stopReason = "max_tokens";
|
|
14724
14986
|
break;
|
|
14725
|
-
case
|
|
14987
|
+
case GeminiEventType.Error: {
|
|
14726
14988
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14727
14989
|
event.value.error
|
|
14728
14990
|
);
|
|
@@ -14950,7 +15212,7 @@ ${event.value.description}`;
|
|
|
14950
15212
|
const output = RequestPermissionResponseSchema.parse(
|
|
14951
15213
|
await this.connection.requestPermission(params)
|
|
14952
15214
|
);
|
|
14953
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15215
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14954
15216
|
await confirmationDetails.onConfirm(outcome);
|
|
14955
15217
|
await updatePolicy(
|
|
14956
15218
|
tool,
|
|
@@ -14961,16 +15223,16 @@ ${event.value.description}`;
|
|
|
14961
15223
|
invocation
|
|
14962
15224
|
);
|
|
14963
15225
|
switch (outcome) {
|
|
14964
|
-
case
|
|
15226
|
+
case ToolConfirmationOutcome.Cancel:
|
|
14965
15227
|
return errorResponse(
|
|
14966
15228
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14967
15229
|
);
|
|
14968
|
-
case
|
|
14969
|
-
case
|
|
14970
|
-
case
|
|
14971
|
-
case
|
|
14972
|
-
case
|
|
14973
|
-
case
|
|
15230
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
15231
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
15232
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
15233
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
15234
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
15235
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
14974
15236
|
break;
|
|
14975
15237
|
default: {
|
|
14976
15238
|
const resultOutcome = outcome;
|
|
@@ -15024,7 +15286,7 @@ ${event.value.description}`;
|
|
|
15024
15286
|
);
|
|
15025
15287
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15026
15288
|
{
|
|
15027
|
-
status:
|
|
15289
|
+
status: CoreToolCallStatus.Success,
|
|
15028
15290
|
request: {
|
|
15029
15291
|
callId,
|
|
15030
15292
|
name: fc.name,
|
|
@@ -15069,7 +15331,7 @@ ${event.value.description}`;
|
|
|
15069
15331
|
});
|
|
15070
15332
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15071
15333
|
{
|
|
15072
|
-
status:
|
|
15334
|
+
status: CoreToolCallStatus.Error,
|
|
15073
15335
|
request: {
|
|
15074
15336
|
callId,
|
|
15075
15337
|
name: fc.name,
|
|
@@ -15197,12 +15459,12 @@ ${event.value.description}`;
|
|
|
15197
15459
|
sessionId: this.id,
|
|
15198
15460
|
options: [
|
|
15199
15461
|
{
|
|
15200
|
-
optionId:
|
|
15462
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
15201
15463
|
name: "Allow once",
|
|
15202
15464
|
kind: "allow_once"
|
|
15203
15465
|
},
|
|
15204
15466
|
{
|
|
15205
|
-
optionId:
|
|
15467
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
15206
15468
|
name: "Deny",
|
|
15207
15469
|
kind: "reject_once"
|
|
15208
15470
|
}
|
|
@@ -15227,8 +15489,8 @@ ${event.value.description}`;
|
|
|
15227
15489
|
const output = RequestPermissionResponseSchema.parse(
|
|
15228
15490
|
await this.connection.requestPermission(params)
|
|
15229
15491
|
);
|
|
15230
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15231
|
-
if (outcome ===
|
|
15492
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15493
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
15232
15494
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
15233
15495
|
validationError = null;
|
|
15234
15496
|
} else {
|
|
@@ -15665,7 +15927,7 @@ var AcpSessionManager = class {
|
|
|
15665
15927
|
mcpServers,
|
|
15666
15928
|
loadedSettings
|
|
15667
15929
|
);
|
|
15668
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15930
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
|
|
15669
15931
|
let isAuthenticated = false;
|
|
15670
15932
|
let authErrorMessage = "";
|
|
15671
15933
|
try {
|
|
@@ -15677,7 +15939,7 @@ var AcpSessionManager = class {
|
|
|
15677
15939
|
);
|
|
15678
15940
|
isAuthenticated = true;
|
|
15679
15941
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
15680
|
-
if (authType ===
|
|
15942
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
15681
15943
|
isAuthenticated = false;
|
|
15682
15944
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
15683
15945
|
}
|
|
@@ -15786,7 +16048,7 @@ var AcpSessionManager = class {
|
|
|
15786
16048
|
return response;
|
|
15787
16049
|
}
|
|
15788
16050
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
15789
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16051
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
|
|
15790
16052
|
if (!selectedAuthType) {
|
|
15791
16053
|
throw RequestError.authRequired();
|
|
15792
16054
|
}
|
|
@@ -15887,12 +16149,12 @@ var GeminiAgent = class {
|
|
|
15887
16149
|
}
|
|
15888
16150
|
const authMethods = [
|
|
15889
16151
|
{
|
|
15890
|
-
id:
|
|
16152
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
15891
16153
|
name: "Log in with Google",
|
|
15892
16154
|
description: "Log in with your Google account"
|
|
15893
16155
|
},
|
|
15894
16156
|
{
|
|
15895
|
-
id:
|
|
16157
|
+
id: AuthType.USE_GEMINI,
|
|
15896
16158
|
name: "Gemini API key",
|
|
15897
16159
|
description: "Use an API key with Gemini Developer API",
|
|
15898
16160
|
_meta: {
|
|
@@ -15902,12 +16164,12 @@ var GeminiAgent = class {
|
|
|
15902
16164
|
}
|
|
15903
16165
|
},
|
|
15904
16166
|
{
|
|
15905
|
-
id:
|
|
16167
|
+
id: AuthType.USE_VERTEX_AI,
|
|
15906
16168
|
name: "Vertex AI",
|
|
15907
16169
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15908
16170
|
},
|
|
15909
16171
|
{
|
|
15910
|
-
id:
|
|
16172
|
+
id: AuthType.GATEWAY,
|
|
15911
16173
|
name: "AI API Gateway",
|
|
15912
16174
|
description: "Use a custom AI API Gateway",
|
|
15913
16175
|
_meta: {
|
|
@@ -16080,7 +16342,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
16080
16342
|
}
|
|
16081
16343
|
return authType;
|
|
16082
16344
|
} catch (error) {
|
|
16083
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
16345
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
16084
16346
|
handleError(
|
|
16085
16347
|
error instanceof Error ? error : new Error(String(error)),
|
|
16086
16348
|
nonInteractiveConfig,
|
|
@@ -16275,10 +16537,10 @@ var SlashCommandConflictHandler = class {
|
|
|
16275
16537
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
16276
16538
|
}
|
|
16277
16539
|
start() {
|
|
16278
|
-
coreEvents.on(
|
|
16540
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
16279
16541
|
}
|
|
16280
16542
|
stop() {
|
|
16281
|
-
coreEvents.off(
|
|
16543
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
16282
16544
|
if (this.flushTimeout) {
|
|
16283
16545
|
clearTimeout(this.flushTimeout);
|
|
16284
16546
|
this.flushTimeout = null;
|
|
@@ -16559,7 +16821,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
16559
16821
|
}
|
|
16560
16822
|
}
|
|
16561
16823
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
16562
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
16824
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-Y72465UI.js");
|
|
16563
16825
|
await doStartUI(
|
|
16564
16826
|
config,
|
|
16565
16827
|
settings,
|
|
@@ -16662,12 +16924,12 @@ async function main() {
|
|
|
16662
16924
|
dns.setDefaultResultOrder(
|
|
16663
16925
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
16664
16926
|
);
|
|
16665
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
16927
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
16666
16928
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
16667
16929
|
settings.setValue(
|
|
16668
16930
|
"User" /* User */,
|
|
16669
16931
|
"security.auth.selectedType",
|
|
16670
|
-
|
|
16932
|
+
AuthType.COMPUTE_ADC
|
|
16671
16933
|
);
|
|
16672
16934
|
}
|
|
16673
16935
|
}
|
|
@@ -16768,7 +17030,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16768
17030
|
await config.storage.initialize();
|
|
16769
17031
|
adminControlsListner.setConfig(config);
|
|
16770
17032
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
16771
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
17033
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-DXYGYJ7D.js");
|
|
16772
17034
|
setupInitialActivityLogger(config);
|
|
16773
17035
|
}
|
|
16774
17036
|
registerTelemetryConfig(config);
|
|
@@ -16776,7 +17038,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16776
17038
|
const messageBus = config.getMessageBus();
|
|
16777
17039
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
16778
17040
|
registerCleanup(async () => {
|
|
16779
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
17041
|
+
await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
16780
17042
|
});
|
|
16781
17043
|
if (!config.getAcpMode()) {
|
|
16782
17044
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16827,7 +17089,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16827
17089
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16828
17090
|
const initializationResult = await initializeApp(config, settings);
|
|
16829
17091
|
initAppHandle?.end();
|
|
16830
|
-
import("./liteRtServerManager-
|
|
17092
|
+
import("./liteRtServerManager-D3QHGS4D.js").then(({ LiteRtServerManager }) => {
|
|
16831
17093
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16832
17094
|
if (!mergedGemma) return;
|
|
16833
17095
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16837,7 +17099,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16837
17099
|
autoStartServer: userGemma?.autoStartServer
|
|
16838
17100
|
});
|
|
16839
17101
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16840
|
-
if (settings.merged.security.auth.selectedType ===
|
|
17102
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
16841
17103
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16842
17104
|
}
|
|
16843
17105
|
if (config.getAcpMode()) {
|
|
@@ -16853,7 +17115,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16853
17115
|
...rawStartupWarnings.map((message) => ({
|
|
16854
17116
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16855
17117
|
message,
|
|
16856
|
-
priority:
|
|
17118
|
+
priority: WarningPriority.High
|
|
16857
17119
|
})),
|
|
16858
17120
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16859
17121
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16890,7 +17152,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16890
17152
|
${input}` : stdinData;
|
|
16891
17153
|
}
|
|
16892
17154
|
}
|
|
16893
|
-
const sessionStartSource = resumedSessionData ?
|
|
17155
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
16894
17156
|
const hookSystem = config?.getHookSystem();
|
|
16895
17157
|
if (hookSystem) {
|
|
16896
17158
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16947,8 +17209,8 @@ ${input}` : wrappedContext;
|
|
|
16947
17209
|
}
|
|
16948
17210
|
}
|
|
16949
17211
|
function initializeOutputListenersAndFlush(config) {
|
|
16950
|
-
if (coreEvents.listenerCount(
|
|
16951
|
-
coreEvents.on(
|
|
17212
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
17213
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
16952
17214
|
if (payload.isStderr) {
|
|
16953
17215
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16954
17216
|
} else {
|
|
@@ -16956,8 +17218,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16956
17218
|
}
|
|
16957
17219
|
});
|
|
16958
17220
|
}
|
|
16959
|
-
if (coreEvents.listenerCount(
|
|
16960
|
-
coreEvents.on(
|
|
17221
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
17222
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
16961
17223
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16962
17224
|
writeToStderr(payload.content + "\n");
|
|
16963
17225
|
} else {
|
|
@@ -16965,8 +17227,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16965
17227
|
}
|
|
16966
17228
|
});
|
|
16967
17229
|
}
|
|
16968
|
-
if (coreEvents.listenerCount(
|
|
16969
|
-
coreEvents.on(
|
|
17230
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
17231
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
16970
17232
|
writeToStderr(payload.message + "\n");
|
|
16971
17233
|
});
|
|
16972
17234
|
}
|
|
@@ -16974,7 +17236,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16974
17236
|
const forceToStderr = outputFormat === "json";
|
|
16975
17237
|
coreEvents.drainBacklogs(
|
|
16976
17238
|
(event, args) => {
|
|
16977
|
-
if (forceToStderr && event ===
|
|
17239
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
16978
17240
|
const payload = args[0];
|
|
16979
17241
|
if (!payload.isStderr) {
|
|
16980
17242
|
return {
|