@google/gemini-cli 0.43.0-preview.1 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-LTSFEC7U.js → chunk-2PZUIVU3.js} +2 -2
- package/bundle/{chunk-EWAAFVBK.js → chunk-4IXP3BQP.js} +1 -1
- package/bundle/{chunk-N3MLU4IQ.js → chunk-4N6JQGX6.js} +7 -7
- package/bundle/{chunk-6YMGRLOQ.js → chunk-5LLZICYH.js} +1 -1
- package/bundle/{chunk-CKPZGEE3.js → chunk-6KWJMH6E.js} +2 -2
- package/bundle/{chunk-L4LBKMR6.js → chunk-6LSSATGP.js} +1 -1
- package/bundle/{chunk-QAQT56LH.js → chunk-6PXLKFEE.js} +3 -3
- package/bundle/{chunk-ICOPZSVB.js → chunk-AR2D7G5V.js} +3 -3
- package/bundle/{chunk-3BNJIKEP.js → chunk-DB4PQOJV.js} +2 -2
- package/bundle/{chunk-UBCHSKF2.js → chunk-DP6V2BFN.js} +7 -7
- package/bundle/{chunk-4ZT3EIBI.js → chunk-KL6UT6F7.js} +1 -1
- package/bundle/{chunk-VSTO23O2.js → chunk-KZP4B2KY.js} +1 -1
- package/bundle/{chunk-IF5BAOVJ.js → chunk-ORAERZ7C.js} +1 -1
- package/bundle/{chunk-NG2WIKH5.js → chunk-QH43L44B.js} +4 -4
- package/bundle/{chunk-PLEERNRJ.js → chunk-SP2PGMIB.js} +2 -2
- package/bundle/{chunk-DJCG6GWZ.js → chunk-SSOGRVCN.js} +2 -2
- package/bundle/{chunk-LTFEPQ67.js → chunk-TK52UAKX.js} +1 -1
- package/bundle/{chunk-4G3X2H3F.js → chunk-TUSXQIOT.js} +6 -9
- package/bundle/{chunk-MRVZNBXY.js → chunk-U6X4OPT5.js} +4 -4
- package/bundle/{chunk-S36EONMM.js → chunk-UH3BLMAQ.js} +1 -1
- package/bundle/{chunk-KILFUY3Y.js → chunk-VNPDB5AB.js} +1 -1
- package/bundle/{chunk-NDSJWRFE.js → chunk-W2MTI7FK.js} +13059 -6973
- package/bundle/{chunk-4SLX6GS6.js → chunk-YS4NB3TW.js} +54 -67
- package/bundle/{chunk-CZPVSLJF.js → chunk-ZWSMHWOL.js} +8 -9
- package/bundle/{cleanup-NMUMRIEF.js → cleanup-5M6XXPD5.js} +2 -2
- package/bundle/{cleanup-LMJA4J5S.js → cleanup-RDTCKYOC.js} +3 -3
- package/bundle/{cleanup-BMLCC7SO.js → cleanup-TI2NCMMY.js} +2 -2
- package/bundle/{core-WXTAU5UX.js → core-KK5NR7XJ.js} +1 -1
- package/bundle/{dist-MXL7ZG46.js → core-PKLJMNGJ.js} +2 -2
- package/bundle/{devtoolsService-6THA6GNX.js → devtoolsService-I65SE4OX.js} +2 -2
- package/bundle/{devtoolsService-2L5U47ZQ.js → devtoolsService-OFCX6SOA.js} +2 -2
- package/bundle/{devtoolsService-J2AC6YXM.js → devtoolsService-WA4GU73C.js} +4 -5
- package/bundle/{dist-DIIMIT2U.js → dist-BDJKFMK4.js} +1 -1
- package/bundle/{gemini-HYQU2RK2.js → gemini-H266Z57W.js} +188 -202
- package/bundle/{gemini-D32FDZXN.js → gemini-PBHAWQU6.js} +14 -14
- package/bundle/{gemini-DLZ2R4X7.js → gemini-YQATFAPB.js} +14 -14
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-NR7OUF3G.js → interactiveCli-2RXDSQZ7.js} +8 -8
- package/bundle/{interactiveCli-K7ETWJMN.js → interactiveCli-MHCNTGQB.js} +296 -315
- package/bundle/{interactiveCli-DHMPW4RS.js → interactiveCli-YR3FARLA.js} +8 -8
- package/bundle/{liteRtServerManager-PKRLUK2P.js → liteRtServerManager-HTBHSP3E.js} +4 -4
- package/bundle/{liteRtServerManager-L7C3D5RL.js → liteRtServerManager-WMZJWUGC.js} +4 -4
- package/bundle/{liteRtServerManager-UPCAT7Z2.js → liteRtServerManager-ZU6GBYTQ.js} +5 -5
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-52IJKUJI.js → oauth2-provider-7A7OEBRV.js} +1 -1
- package/bundle/{oauth2-provider-OPOTTZ5C.js → oauth2-provider-7AMBXQXB.js} +1 -1
- package/bundle/{oauth2-provider-WN4YIDA4.js → oauth2-provider-EUHAWOQQ.js} +73 -39
- package/bundle/{start-TMFPUYEL.js → start-D7BGLINR.js} +6 -6
- package/bundle/{start-6KIIUSAH.js → start-FNWNJC6F.js} +7 -7
- package/bundle/{start-7ZNSGJD6.js → start-ZXZSKJFC.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-ERQUIEOO.js +0 -512
- package/bundle/chunk-F7PEGIBA.js +0 -156
- package/bundle/chunk-UB4AWMZC.js +0 -391
- package/bundle/chunk-ULCEBJMK.js +0 -17248
- package/bundle/chunk-UUHMEKLA.js +0 -357199
- package/bundle/chunk-UW3H4T6A.js +0 -1571
- package/bundle/chunk-XKIM3BNI.js +0 -118
- package/bundle/chunk-YIHNW7CC.js +0 -81649
- package/bundle/cleanup-M7RSLDBR.js +0 -33
- package/bundle/devtoolsService-SRWIME2Q.js +0 -857
- package/bundle/dist-POIHCQVM.js +0 -2124
- package/bundle/gemini-JJG7ZGWB.js +0 -16356
- package/bundle/interactiveCli-X4AUP7T7.js +0 -34752
- package/bundle/liteRtServerManager-TEBDIGEN.js +0 -66
- package/bundle/oauth2-provider-TOAKXOL7.js +0 -237
- package/bundle/start-EPIILWLN.js +0 -19
|
@@ -41,18 +41,18 @@ import {
|
|
|
41
41
|
updateAllUpdatableExtensions,
|
|
42
42
|
updateExtension,
|
|
43
43
|
validateAuthMethod
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-DP6V2BFN.js";
|
|
45
45
|
import {
|
|
46
46
|
appEvents
|
|
47
47
|
} from "./chunk-5PS3AYFU.js";
|
|
48
48
|
import {
|
|
49
49
|
startCommand,
|
|
50
50
|
startServer
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-AR2D7G5V.js";
|
|
52
52
|
import {
|
|
53
53
|
exitCli,
|
|
54
54
|
require_source
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-6LSSATGP.js";
|
|
56
56
|
import {
|
|
57
57
|
DEFAULT_PORT,
|
|
58
58
|
GEMMA_MODEL_NAME,
|
|
@@ -86,11 +86,11 @@ import {
|
|
|
86
86
|
readServerProcessInfo,
|
|
87
87
|
resolveGemmaConfig,
|
|
88
88
|
saveModelChange
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-TUSXQIOT.js";
|
|
90
90
|
import {
|
|
91
91
|
RELAUNCH_EXIT_CODE
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import "./chunk-
|
|
92
|
+
} from "./chunk-6KWJMH6E.js";
|
|
93
|
+
import "./chunk-ZWSMHWOL.js";
|
|
94
94
|
import {
|
|
95
95
|
cleanupCheckpoints,
|
|
96
96
|
registerCleanup,
|
|
@@ -99,43 +99,33 @@ import {
|
|
|
99
99
|
runExitCleanup,
|
|
100
100
|
runSyncCleanup,
|
|
101
101
|
setupSignalHandlers
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-SP2PGMIB.js";
|
|
103
103
|
import {
|
|
104
104
|
AuthType,
|
|
105
105
|
ChatRecordingService,
|
|
106
106
|
Client,
|
|
107
107
|
Config,
|
|
108
|
-
CoreToolCallStatus,
|
|
109
108
|
ExitCodes,
|
|
110
109
|
FileDiscoveryService,
|
|
111
110
|
FolderTrustDiscoveryService,
|
|
112
|
-
GeminiEventType,
|
|
113
111
|
IdeClient,
|
|
114
|
-
IntegrityStatus,
|
|
115
112
|
InvalidStreamError,
|
|
116
113
|
JsonFormatter,
|
|
117
|
-
JsonStreamEventType,
|
|
118
114
|
LegacyAgentSession,
|
|
119
115
|
Logger,
|
|
120
116
|
MCPServerConfig,
|
|
121
|
-
MCPServerStatus,
|
|
122
|
-
OutputFormat,
|
|
123
117
|
PolicyIntegrityManager,
|
|
124
118
|
ROOT_SCHEDULER_ID,
|
|
125
119
|
ReadManyFilesTool,
|
|
126
120
|
Scheduler,
|
|
127
|
-
SessionEndReason,
|
|
128
|
-
SessionStartSource,
|
|
129
121
|
ShellExecutionService,
|
|
130
122
|
SimpleExtensionLoader,
|
|
131
123
|
StreamJsonFormatter,
|
|
132
124
|
ToolCallEvent,
|
|
133
|
-
TrustLevel,
|
|
134
125
|
UserAccountManager,
|
|
135
126
|
UserPromptEvent,
|
|
136
127
|
ValidationCancelledError,
|
|
137
128
|
ValidationRequiredError,
|
|
138
|
-
WarningPriority,
|
|
139
129
|
addMemory,
|
|
140
130
|
applyAdminAllowlist,
|
|
141
131
|
applyRequiredServers,
|
|
@@ -200,11 +190,9 @@ import {
|
|
|
200
190
|
updatePolicy,
|
|
201
191
|
writeToStderr,
|
|
202
192
|
writeToStdout
|
|
203
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-QH43L44B.js";
|
|
204
194
|
import {
|
|
205
195
|
ASK_USER_TOOL_NAME,
|
|
206
|
-
ApprovalMode,
|
|
207
|
-
CoreEvent,
|
|
208
196
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
209
197
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
210
198
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
@@ -224,7 +212,6 @@ import {
|
|
|
224
212
|
FatalUntrustedWorkspaceError,
|
|
225
213
|
GEMINI_DIR,
|
|
226
214
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
227
|
-
Kind,
|
|
228
215
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
229
216
|
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
230
217
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
@@ -234,7 +221,6 @@ import {
|
|
|
234
221
|
REFERENCE_CONTENT_START,
|
|
235
222
|
Storage,
|
|
236
223
|
ToolConfirmationOutcome,
|
|
237
|
-
ToolErrorType,
|
|
238
224
|
coreEvents,
|
|
239
225
|
debugLogger,
|
|
240
226
|
external_exports,
|
|
@@ -249,7 +235,7 @@ import {
|
|
|
249
235
|
loadServerHierarchicalMemory,
|
|
250
236
|
resolveToRealPath,
|
|
251
237
|
setGeminiMdFilename
|
|
252
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-N6QYTC2T.js";
|
|
253
239
|
import "./chunk-664ZODQF.js";
|
|
254
240
|
import "./chunk-RJTRUG2J.js";
|
|
255
241
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5379,7 +5365,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5379
5365
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5380
5366
|
const isStdio = !!config.command;
|
|
5381
5367
|
if (isStdio && !isTrusted) {
|
|
5382
|
-
return
|
|
5368
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5383
5369
|
}
|
|
5384
5370
|
const client = new Client({
|
|
5385
5371
|
name: "mcp-test-client",
|
|
@@ -5415,7 +5401,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5415
5401
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5416
5402
|
} catch {
|
|
5417
5403
|
await client.close();
|
|
5418
|
-
return
|
|
5404
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5419
5405
|
}
|
|
5420
5406
|
try {
|
|
5421
5407
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5429,10 +5415,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5429
5415
|
);
|
|
5430
5416
|
}
|
|
5431
5417
|
await client.close();
|
|
5432
|
-
return
|
|
5418
|
+
return "connected" /* CONNECTED */;
|
|
5433
5419
|
} catch {
|
|
5434
5420
|
await transport.close();
|
|
5435
|
-
return
|
|
5421
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5436
5422
|
}
|
|
5437
5423
|
}
|
|
5438
5424
|
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
@@ -5445,12 +5431,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5445
5431
|
});
|
|
5446
5432
|
if (!loadResult.allowed) {
|
|
5447
5433
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5448
|
-
return
|
|
5434
|
+
return "blocked" /* BLOCKED */;
|
|
5449
5435
|
}
|
|
5450
|
-
return
|
|
5436
|
+
return "disabled" /* DISABLED */;
|
|
5451
5437
|
}
|
|
5452
5438
|
if (!isTrusted) {
|
|
5453
|
-
return
|
|
5439
|
+
return "disabled" /* DISABLED */;
|
|
5454
5440
|
}
|
|
5455
5441
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5456
5442
|
}
|
|
@@ -5492,23 +5478,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5492
5478
|
let statusIndicator = "";
|
|
5493
5479
|
let statusText = "";
|
|
5494
5480
|
switch (status) {
|
|
5495
|
-
case
|
|
5481
|
+
case "connected" /* CONNECTED */:
|
|
5496
5482
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5497
5483
|
statusText = "Connected";
|
|
5498
5484
|
break;
|
|
5499
|
-
case
|
|
5485
|
+
case "connecting" /* CONNECTING */:
|
|
5500
5486
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5501
5487
|
statusText = "Connecting";
|
|
5502
5488
|
break;
|
|
5503
|
-
case
|
|
5489
|
+
case "blocked" /* BLOCKED */:
|
|
5504
5490
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5505
5491
|
statusText = "Blocked";
|
|
5506
5492
|
break;
|
|
5507
|
-
case
|
|
5493
|
+
case "disabled" /* DISABLED */:
|
|
5508
5494
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5509
5495
|
statusText = "Disabled";
|
|
5510
5496
|
break;
|
|
5511
|
-
case
|
|
5497
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5512
5498
|
default:
|
|
5513
5499
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5514
5500
|
statusText = "Disconnected";
|
|
@@ -5794,7 +5780,7 @@ async function handleInstall(args) {
|
|
|
5794
5780
|
);
|
|
5795
5781
|
if (confirmed) {
|
|
5796
5782
|
const trustedFolders = loadTrustedFolders();
|
|
5797
|
-
await trustedFolders.setValue(realPath,
|
|
5783
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5798
5784
|
} else {
|
|
5799
5785
|
throw new Error(
|
|
5800
5786
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7839,7 +7825,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7839
7825
|
}
|
|
7840
7826
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7841
7827
|
const packageJson = await getPackageJson(__dirname3);
|
|
7842
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.43.0
|
|
7828
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.43.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7843
7829
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7844
7830
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7845
7831
|
}
|
|
@@ -7898,9 +7884,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7898
7884
|
cwd,
|
|
7899
7885
|
potentialWorkspacePoliciesDir
|
|
7900
7886
|
);
|
|
7901
|
-
if (integrityResult.status ===
|
|
7887
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7902
7888
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7903
|
-
} else if (integrityResult.status ===
|
|
7889
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7904
7890
|
workspacePoliciesDir = void 0;
|
|
7905
7891
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7906
7892
|
policyUpdateConfirmationRequest = {
|
|
@@ -8349,23 +8335,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8349
8335
|
if (rawApprovalMode) {
|
|
8350
8336
|
switch (rawApprovalMode) {
|
|
8351
8337
|
case "yolo":
|
|
8352
|
-
approvalMode =
|
|
8338
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8353
8339
|
break;
|
|
8354
8340
|
case "auto_edit":
|
|
8355
|
-
approvalMode =
|
|
8341
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8356
8342
|
break;
|
|
8357
8343
|
case "plan":
|
|
8358
8344
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8359
8345
|
debugLogger.warn(
|
|
8360
8346
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8361
8347
|
);
|
|
8362
|
-
approvalMode =
|
|
8348
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8363
8349
|
} else {
|
|
8364
|
-
approvalMode =
|
|
8350
|
+
approvalMode = "plan" /* PLAN */;
|
|
8365
8351
|
}
|
|
8366
8352
|
break;
|
|
8367
8353
|
case "default":
|
|
8368
|
-
approvalMode =
|
|
8354
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8369
8355
|
break;
|
|
8370
8356
|
default:
|
|
8371
8357
|
throw new Error(
|
|
@@ -8373,10 +8359,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8373
8359
|
);
|
|
8374
8360
|
}
|
|
8375
8361
|
} else {
|
|
8376
|
-
approvalMode =
|
|
8362
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8377
8363
|
}
|
|
8378
8364
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8379
|
-
if (approvalMode ===
|
|
8365
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8380
8366
|
if (settings.admin?.secureModeEnabled) {
|
|
8381
8367
|
debugLogger.error(
|
|
8382
8368
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8394,16 +8380,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8394
8380
|
)
|
|
8395
8381
|
);
|
|
8396
8382
|
}
|
|
8397
|
-
} else if (approvalMode ===
|
|
8383
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8398
8384
|
debugLogger.warn(
|
|
8399
8385
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8400
8386
|
);
|
|
8401
8387
|
}
|
|
8402
|
-
if (!trustedFolder && approvalMode !==
|
|
8388
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8403
8389
|
debugLogger.warn(
|
|
8404
8390
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8405
8391
|
);
|
|
8406
|
-
approvalMode =
|
|
8392
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8407
8393
|
}
|
|
8408
8394
|
let telemetrySettings;
|
|
8409
8395
|
try {
|
|
@@ -9820,7 +9806,7 @@ import path9 from "node:path";
|
|
|
9820
9806
|
import process4 from "node:process";
|
|
9821
9807
|
var homeDirectoryCheck = {
|
|
9822
9808
|
id: "home-directory",
|
|
9823
|
-
priority:
|
|
9809
|
+
priority: "low" /* Low */,
|
|
9824
9810
|
check: async (workspaceRoot, settings) => {
|
|
9825
9811
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9826
9812
|
return null;
|
|
@@ -9844,7 +9830,7 @@ var homeDirectoryCheck = {
|
|
|
9844
9830
|
};
|
|
9845
9831
|
var rootDirectoryCheck = {
|
|
9846
9832
|
id: "root-directory",
|
|
9847
|
-
priority:
|
|
9833
|
+
priority: "high" /* High */,
|
|
9848
9834
|
check: async (workspaceRoot, _settings) => {
|
|
9849
9835
|
try {
|
|
9850
9836
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9860,7 +9846,7 @@ var rootDirectoryCheck = {
|
|
|
9860
9846
|
};
|
|
9861
9847
|
var folderTrustCheck = {
|
|
9862
9848
|
id: "folder-trust",
|
|
9863
|
-
priority:
|
|
9849
|
+
priority: "high" /* High */,
|
|
9864
9850
|
check: async (workspaceRoot, settings) => {
|
|
9865
9851
|
if (!isFolderTrustEnabled(settings)) {
|
|
9866
9852
|
return null;
|
|
@@ -10050,12 +10036,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10050
10036
|
error,
|
|
10051
10037
|
config.getContentGeneratorConfig()?.authType
|
|
10052
10038
|
);
|
|
10053
|
-
if (config.getOutputFormat() ===
|
|
10039
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10054
10040
|
const streamFormatter = new StreamJsonFormatter();
|
|
10055
10041
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10056
10042
|
const metrics = uiTelemetryService.getMetrics();
|
|
10057
10043
|
streamFormatter.emitEvent({
|
|
10058
|
-
type:
|
|
10044
|
+
type: "result" /* RESULT */,
|
|
10059
10045
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10060
10046
|
status: "error",
|
|
10061
10047
|
error: {
|
|
@@ -10066,7 +10052,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10066
10052
|
});
|
|
10067
10053
|
runSyncCleanup();
|
|
10068
10054
|
process.exit(getNumericExitCode(errorCode));
|
|
10069
|
-
} else if (config.getOutputFormat() ===
|
|
10055
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10070
10056
|
const formatter = new JsonFormatter();
|
|
10071
10057
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10072
10058
|
const formattedError = formatter.formatError(
|
|
@@ -10086,11 +10072,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10086
10072
|
const isFatal = isFatalToolError(errorType);
|
|
10087
10073
|
if (isFatal) {
|
|
10088
10074
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10089
|
-
if (config.getOutputFormat() ===
|
|
10075
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10090
10076
|
const streamFormatter = new StreamJsonFormatter();
|
|
10091
10077
|
const metrics = uiTelemetryService.getMetrics();
|
|
10092
10078
|
streamFormatter.emitEvent({
|
|
10093
|
-
type:
|
|
10079
|
+
type: "result" /* RESULT */,
|
|
10094
10080
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10095
10081
|
status: "error",
|
|
10096
10082
|
error: {
|
|
@@ -10099,7 +10085,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10099
10085
|
},
|
|
10100
10086
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10101
10087
|
});
|
|
10102
|
-
} else if (config.getOutputFormat() ===
|
|
10088
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10103
10089
|
const formatter = new JsonFormatter();
|
|
10104
10090
|
const formattedError = formatter.formatError(
|
|
10105
10091
|
toolExecutionError,
|
|
@@ -10117,11 +10103,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10117
10103
|
}
|
|
10118
10104
|
function handleCancellationError(config) {
|
|
10119
10105
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10120
|
-
if (config.getOutputFormat() ===
|
|
10106
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10121
10107
|
const streamFormatter = new StreamJsonFormatter();
|
|
10122
10108
|
const metrics = uiTelemetryService.getMetrics();
|
|
10123
10109
|
streamFormatter.emitEvent({
|
|
10124
|
-
type:
|
|
10110
|
+
type: "result" /* RESULT */,
|
|
10125
10111
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10126
10112
|
status: "error",
|
|
10127
10113
|
error: {
|
|
@@ -10132,7 +10118,7 @@ function handleCancellationError(config) {
|
|
|
10132
10118
|
});
|
|
10133
10119
|
runSyncCleanup();
|
|
10134
10120
|
process.exit(cancellationError.exitCode);
|
|
10135
|
-
} else if (config.getOutputFormat() ===
|
|
10121
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10136
10122
|
const formatter = new JsonFormatter();
|
|
10137
10123
|
const formattedError = formatter.formatError(
|
|
10138
10124
|
cancellationError,
|
|
@@ -10152,11 +10138,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10152
10138
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10153
10139
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10154
10140
|
);
|
|
10155
|
-
if (config.getOutputFormat() ===
|
|
10141
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10156
10142
|
const streamFormatter = new StreamJsonFormatter();
|
|
10157
10143
|
const metrics = uiTelemetryService.getMetrics();
|
|
10158
10144
|
streamFormatter.emitEvent({
|
|
10159
|
-
type:
|
|
10145
|
+
type: "result" /* RESULT */,
|
|
10160
10146
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10161
10147
|
status: "error",
|
|
10162
10148
|
error: {
|
|
@@ -10167,7 +10153,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10167
10153
|
});
|
|
10168
10154
|
runSyncCleanup();
|
|
10169
10155
|
process.exit(maxTurnsError.exitCode);
|
|
10170
|
-
} else if (config.getOutputFormat() ===
|
|
10156
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10171
10157
|
const formatter = new JsonFormatter();
|
|
10172
10158
|
const formattedError = formatter.formatError(
|
|
10173
10159
|
maxTurnsError,
|
|
@@ -10247,7 +10233,7 @@ async function runNonInteractive({
|
|
|
10247
10233
|
}
|
|
10248
10234
|
});
|
|
10249
10235
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10250
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10236
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-WA4GU73C.js");
|
|
10251
10237
|
setupInitialActivityLogger(config);
|
|
10252
10238
|
}
|
|
10253
10239
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10263,7 +10249,7 @@ async function runNonInteractive({
|
|
|
10263
10249
|
}
|
|
10264
10250
|
};
|
|
10265
10251
|
const startTime = Date.now();
|
|
10266
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10252
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10267
10253
|
const abortController = new AbortController();
|
|
10268
10254
|
let isAborting = false;
|
|
10269
10255
|
let cancelMessageTimer = null;
|
|
@@ -10316,13 +10302,13 @@ async function runNonInteractive({
|
|
|
10316
10302
|
};
|
|
10317
10303
|
try {
|
|
10318
10304
|
consolePatcher.patch();
|
|
10319
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10305
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10320
10306
|
process.stderr.write(
|
|
10321
10307
|
"[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"
|
|
10322
10308
|
);
|
|
10323
10309
|
}
|
|
10324
10310
|
setupStdinCancellation();
|
|
10325
|
-
coreEvents.on(
|
|
10311
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10326
10312
|
coreEvents.drainBacklogs();
|
|
10327
10313
|
process.stdout.on("error", (err) => {
|
|
10328
10314
|
if (err.code === "EPIPE") {
|
|
@@ -10348,7 +10334,7 @@ async function runNonInteractive({
|
|
|
10348
10334
|
}
|
|
10349
10335
|
if (streamFormatter) {
|
|
10350
10336
|
streamFormatter.emitEvent({
|
|
10351
|
-
type:
|
|
10337
|
+
type: "init" /* INIT */,
|
|
10352
10338
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10353
10339
|
session_id: config.getSessionId(),
|
|
10354
10340
|
model: config.getModel()
|
|
@@ -10386,7 +10372,7 @@ async function runNonInteractive({
|
|
|
10386
10372
|
}
|
|
10387
10373
|
if (streamFormatter) {
|
|
10388
10374
|
streamFormatter.emitEvent({
|
|
10389
|
-
type:
|
|
10375
|
+
type: "message" /* MESSAGE */,
|
|
10390
10376
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10391
10377
|
role: "user",
|
|
10392
10378
|
content: input
|
|
@@ -10425,12 +10411,12 @@ async function runNonInteractive({
|
|
|
10425
10411
|
const metrics = uiTelemetryService.getMetrics();
|
|
10426
10412
|
const durationMs = Date.now() - startTime;
|
|
10427
10413
|
streamFormatter.emitEvent({
|
|
10428
|
-
type:
|
|
10414
|
+
type: "result" /* RESULT */,
|
|
10429
10415
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10430
10416
|
status: "success",
|
|
10431
10417
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10432
10418
|
});
|
|
10433
|
-
} else if (config.getOutputFormat() ===
|
|
10419
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10434
10420
|
const formatter = new JsonFormatter();
|
|
10435
10421
|
const stats = uiTelemetryService.getMetrics();
|
|
10436
10422
|
textOutput.write(
|
|
@@ -10523,13 +10509,13 @@ async function runNonInteractive({
|
|
|
10523
10509
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10524
10510
|
if (streamFormatter) {
|
|
10525
10511
|
streamFormatter.emitEvent({
|
|
10526
|
-
type:
|
|
10512
|
+
type: "message" /* MESSAGE */,
|
|
10527
10513
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10528
10514
|
role: "assistant",
|
|
10529
10515
|
content: output,
|
|
10530
10516
|
delta: true
|
|
10531
10517
|
});
|
|
10532
|
-
} else if (config.getOutputFormat() ===
|
|
10518
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10533
10519
|
responseText += output;
|
|
10534
10520
|
} else {
|
|
10535
10521
|
if (part.text) {
|
|
@@ -10542,13 +10528,13 @@ async function runNonInteractive({
|
|
|
10542
10528
|
break;
|
|
10543
10529
|
}
|
|
10544
10530
|
case "tool_request": {
|
|
10545
|
-
if (config.getOutputFormat() ===
|
|
10531
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10546
10532
|
preToolResponseText = responseText || preToolResponseText;
|
|
10547
10533
|
responseText = "";
|
|
10548
10534
|
}
|
|
10549
10535
|
if (streamFormatter) {
|
|
10550
10536
|
streamFormatter.emitEvent({
|
|
10551
|
-
type:
|
|
10537
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10552
10538
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10553
10539
|
tool_name: event.name,
|
|
10554
10540
|
tool_id: event.requestId,
|
|
@@ -10564,7 +10550,7 @@ async function runNonInteractive({
|
|
|
10564
10550
|
const displayText = displayContentToString(display);
|
|
10565
10551
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10566
10552
|
streamFormatter.emitEvent({
|
|
10567
|
-
type:
|
|
10553
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
10568
10554
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10569
10555
|
tool_id: event.requestId,
|
|
10570
10556
|
status: event.isError ? "error" : "success",
|
|
@@ -10579,17 +10565,17 @@ async function runNonInteractive({
|
|
|
10579
10565
|
const display = event.display?.result;
|
|
10580
10566
|
const displayText = displayContentToString(display);
|
|
10581
10567
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10582
|
-
if (event.data?.["errorType"] ===
|
|
10583
|
-
if (config.getOutputFormat() ===
|
|
10568
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
10569
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
10584
10570
|
responseText = preToolResponseText;
|
|
10585
10571
|
}
|
|
10586
10572
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10587
|
-
if (config.getOutputFormat() ===
|
|
10573
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10588
10574
|
process.stderr.write(`${stopMessage}
|
|
10589
10575
|
`);
|
|
10590
10576
|
}
|
|
10591
10577
|
}
|
|
10592
|
-
if (event.data?.["errorType"] ===
|
|
10578
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
10593
10579
|
throw new FatalToolExecutionError(
|
|
10594
10580
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10595
10581
|
);
|
|
@@ -10611,12 +10597,12 @@ async function runNonInteractive({
|
|
|
10611
10597
|
const errorCode = event._meta?.["code"];
|
|
10612
10598
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10613
10599
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
10614
|
-
if (config.getOutputFormat() ===
|
|
10600
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10615
10601
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10616
10602
|
`);
|
|
10617
10603
|
} else if (streamFormatter) {
|
|
10618
10604
|
streamFormatter.emitEvent({
|
|
10619
|
-
type:
|
|
10605
|
+
type: "error" /* ERROR */,
|
|
10620
10606
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10621
10607
|
severity: "warning",
|
|
10622
10608
|
message: stripAnsi(blockMessage)
|
|
@@ -10626,13 +10612,13 @@ async function runNonInteractive({
|
|
|
10626
10612
|
break;
|
|
10627
10613
|
}
|
|
10628
10614
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10629
|
-
if (config.getOutputFormat() ===
|
|
10615
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10630
10616
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10631
10617
|
`);
|
|
10632
10618
|
}
|
|
10633
10619
|
if (streamFormatter) {
|
|
10634
10620
|
streamFormatter.emitEvent({
|
|
10635
|
-
type:
|
|
10621
|
+
type: "error" /* ERROR */,
|
|
10636
10622
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10637
10623
|
severity,
|
|
10638
10624
|
message: stripAnsi(event.message)
|
|
@@ -10652,7 +10638,7 @@ async function runNonInteractive({
|
|
|
10652
10638
|
);
|
|
10653
10639
|
} else if (streamFormatter) {
|
|
10654
10640
|
streamFormatter.emitEvent({
|
|
10655
|
-
type:
|
|
10641
|
+
type: "error" /* ERROR */,
|
|
10656
10642
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10657
10643
|
severity: "error",
|
|
10658
10644
|
message: "Maximum session turns exceeded"
|
|
@@ -10660,7 +10646,7 @@ async function runNonInteractive({
|
|
|
10660
10646
|
}
|
|
10661
10647
|
}
|
|
10662
10648
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10663
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10649
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10664
10650
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10665
10651
|
`);
|
|
10666
10652
|
}
|
|
@@ -10690,7 +10676,7 @@ async function runNonInteractive({
|
|
|
10690
10676
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10691
10677
|
scheduler?.dispose();
|
|
10692
10678
|
consolePatcher.cleanup();
|
|
10693
|
-
coreEvents.off(
|
|
10679
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10694
10680
|
}
|
|
10695
10681
|
if (errorToHandle) {
|
|
10696
10682
|
handleError(errorToHandle, config);
|
|
@@ -10718,7 +10704,7 @@ async function runNonInteractive2(params) {
|
|
|
10718
10704
|
}
|
|
10719
10705
|
});
|
|
10720
10706
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10721
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10707
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-WA4GU73C.js");
|
|
10722
10708
|
setupInitialActivityLogger(config);
|
|
10723
10709
|
}
|
|
10724
10710
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10734,7 +10720,7 @@ async function runNonInteractive2(params) {
|
|
|
10734
10720
|
}
|
|
10735
10721
|
};
|
|
10736
10722
|
const startTime = Date.now();
|
|
10737
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10723
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10738
10724
|
const abortController = new AbortController();
|
|
10739
10725
|
let isAborting = false;
|
|
10740
10726
|
let cancelMessageTimer = null;
|
|
@@ -10785,13 +10771,13 @@ async function runNonInteractive2(params) {
|
|
|
10785
10771
|
let scheduler;
|
|
10786
10772
|
try {
|
|
10787
10773
|
consolePatcher.patch();
|
|
10788
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10774
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10789
10775
|
process.stderr.write(
|
|
10790
10776
|
"[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"
|
|
10791
10777
|
);
|
|
10792
10778
|
}
|
|
10793
10779
|
setupStdinCancellation();
|
|
10794
|
-
coreEvents.on(
|
|
10780
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10795
10781
|
coreEvents.drainBacklogs();
|
|
10796
10782
|
process.stdout.on("error", (err) => {
|
|
10797
10783
|
if (err.code === "EPIPE") {
|
|
@@ -10815,7 +10801,7 @@ async function runNonInteractive2(params) {
|
|
|
10815
10801
|
}
|
|
10816
10802
|
if (streamFormatter) {
|
|
10817
10803
|
streamFormatter.emitEvent({
|
|
10818
|
-
type:
|
|
10804
|
+
type: "init" /* INIT */,
|
|
10819
10805
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10820
10806
|
session_id: config.getSessionId(),
|
|
10821
10807
|
model: config.getModel()
|
|
@@ -10853,7 +10839,7 @@ async function runNonInteractive2(params) {
|
|
|
10853
10839
|
}
|
|
10854
10840
|
if (streamFormatter) {
|
|
10855
10841
|
streamFormatter.emitEvent({
|
|
10856
|
-
type:
|
|
10842
|
+
type: "message" /* MESSAGE */,
|
|
10857
10843
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10858
10844
|
role: "user",
|
|
10859
10845
|
content: input
|
|
@@ -10881,28 +10867,28 @@ async function runNonInteractive2(params) {
|
|
|
10881
10867
|
if (abortController.signal.aborted) {
|
|
10882
10868
|
handleCancellationError(config);
|
|
10883
10869
|
}
|
|
10884
|
-
if (event.type ===
|
|
10870
|
+
if (event.type === "content" /* Content */) {
|
|
10885
10871
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10886
10872
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10887
10873
|
if (streamFormatter) {
|
|
10888
10874
|
streamFormatter.emitEvent({
|
|
10889
|
-
type:
|
|
10875
|
+
type: "message" /* MESSAGE */,
|
|
10890
10876
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10891
10877
|
role: "assistant",
|
|
10892
10878
|
content: output,
|
|
10893
10879
|
delta: true
|
|
10894
10880
|
});
|
|
10895
|
-
} else if (config.getOutputFormat() ===
|
|
10881
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10896
10882
|
responseText += output;
|
|
10897
10883
|
} else {
|
|
10898
10884
|
if (event.value) {
|
|
10899
10885
|
textOutput.write(output);
|
|
10900
10886
|
}
|
|
10901
10887
|
}
|
|
10902
|
-
} else if (event.type ===
|
|
10888
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
10903
10889
|
if (streamFormatter) {
|
|
10904
10890
|
streamFormatter.emitEvent({
|
|
10905
|
-
type:
|
|
10891
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10906
10892
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10907
10893
|
tool_name: event.value.name,
|
|
10908
10894
|
tool_id: event.value.callId,
|
|
@@ -10910,33 +10896,33 @@ async function runNonInteractive2(params) {
|
|
|
10910
10896
|
});
|
|
10911
10897
|
}
|
|
10912
10898
|
toolCallRequests.push(event.value);
|
|
10913
|
-
} else if (event.type ===
|
|
10899
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
10914
10900
|
const message = "Loop detected, stopping execution";
|
|
10915
10901
|
if (streamFormatter) {
|
|
10916
10902
|
streamFormatter.emitEvent({
|
|
10917
|
-
type:
|
|
10903
|
+
type: "error" /* ERROR */,
|
|
10918
10904
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10919
10905
|
severity: "warning",
|
|
10920
10906
|
message
|
|
10921
10907
|
});
|
|
10922
10908
|
}
|
|
10923
10909
|
warnings.push(message);
|
|
10924
|
-
} else if (event.type ===
|
|
10910
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
10925
10911
|
const message = "Maximum session turns exceeded";
|
|
10926
10912
|
if (streamFormatter) {
|
|
10927
10913
|
streamFormatter.emitEvent({
|
|
10928
|
-
type:
|
|
10914
|
+
type: "error" /* ERROR */,
|
|
10929
10915
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10930
10916
|
severity: "error",
|
|
10931
10917
|
message
|
|
10932
10918
|
});
|
|
10933
10919
|
}
|
|
10934
10920
|
warnings.push(message);
|
|
10935
|
-
} else if (event.type ===
|
|
10921
|
+
} else if (event.type === "error" /* Error */) {
|
|
10936
10922
|
throw event.value.error;
|
|
10937
|
-
} else if (event.type ===
|
|
10923
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
10938
10924
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10939
|
-
if (config.getOutputFormat() ===
|
|
10925
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10940
10926
|
process.stderr.write(`${stopMessage}
|
|
10941
10927
|
`);
|
|
10942
10928
|
}
|
|
@@ -10944,7 +10930,7 @@ async function runNonInteractive2(params) {
|
|
|
10944
10930
|
const metrics = uiTelemetryService.getMetrics();
|
|
10945
10931
|
const durationMs = Date.now() - startTime;
|
|
10946
10932
|
streamFormatter.emitEvent({
|
|
10947
|
-
type:
|
|
10933
|
+
type: "result" /* RESULT */,
|
|
10948
10934
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10949
10935
|
status: "success",
|
|
10950
10936
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10952,7 +10938,7 @@ async function runNonInteractive2(params) {
|
|
|
10952
10938
|
durationMs
|
|
10953
10939
|
)
|
|
10954
10940
|
});
|
|
10955
|
-
} else if (config.getOutputFormat() ===
|
|
10941
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10956
10942
|
const formatter = new JsonFormatter();
|
|
10957
10943
|
const stats = uiTelemetryService.getMetrics();
|
|
10958
10944
|
textOutput.write(
|
|
@@ -10968,30 +10954,30 @@ async function runNonInteractive2(params) {
|
|
|
10968
10954
|
textOutput.ensureTrailingNewline();
|
|
10969
10955
|
}
|
|
10970
10956
|
return;
|
|
10971
|
-
} else if (event.type ===
|
|
10957
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
10972
10958
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10973
|
-
if (config.getOutputFormat() ===
|
|
10959
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10974
10960
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10975
10961
|
`);
|
|
10976
10962
|
} else if (streamFormatter) {
|
|
10977
10963
|
streamFormatter.emitEvent({
|
|
10978
|
-
type:
|
|
10964
|
+
type: "error" /* ERROR */,
|
|
10979
10965
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10980
10966
|
severity: "warning",
|
|
10981
10967
|
message: stripAnsi(blockMessage)
|
|
10982
10968
|
});
|
|
10983
10969
|
}
|
|
10984
10970
|
warnings.push(blockMessage);
|
|
10985
|
-
} else if (event.type ===
|
|
10971
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
10986
10972
|
invalidStreamError = "Invalid stream: The model returned an empty response or malformed tool call.";
|
|
10987
10973
|
if (streamFormatter) {
|
|
10988
10974
|
streamFormatter.emitEvent({
|
|
10989
|
-
type:
|
|
10975
|
+
type: "error" /* ERROR */,
|
|
10990
10976
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10991
10977
|
severity: "error",
|
|
10992
10978
|
message: invalidStreamError
|
|
10993
10979
|
});
|
|
10994
|
-
} else if (config.getOutputFormat() ===
|
|
10980
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10995
10981
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
10996
10982
|
`);
|
|
10997
10983
|
}
|
|
@@ -11011,7 +10997,7 @@ async function runNonInteractive2(params) {
|
|
|
11011
10997
|
const requestInfo = completedToolCall.request;
|
|
11012
10998
|
if (streamFormatter) {
|
|
11013
10999
|
streamFormatter.emitEvent({
|
|
11014
|
-
type:
|
|
11000
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11015
11001
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11016
11002
|
tool_id: requestInfo.callId,
|
|
11017
11003
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11045,11 +11031,11 @@ async function runNonInteractive2(params) {
|
|
|
11045
11031
|
);
|
|
11046
11032
|
}
|
|
11047
11033
|
const stopExecutionTool = completedToolCalls.find(
|
|
11048
|
-
(tc) => tc.response.errorType ===
|
|
11034
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
11049
11035
|
);
|
|
11050
11036
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11051
11037
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11052
|
-
if (config.getOutputFormat() ===
|
|
11038
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11053
11039
|
process.stderr.write(`${stopMessage}
|
|
11054
11040
|
`);
|
|
11055
11041
|
}
|
|
@@ -11057,7 +11043,7 @@ async function runNonInteractive2(params) {
|
|
|
11057
11043
|
const metrics = uiTelemetryService.getMetrics();
|
|
11058
11044
|
const durationMs = Date.now() - startTime;
|
|
11059
11045
|
streamFormatter.emitEvent({
|
|
11060
|
-
type:
|
|
11046
|
+
type: "result" /* RESULT */,
|
|
11061
11047
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11062
11048
|
status: "success",
|
|
11063
11049
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11065,7 +11051,7 @@ async function runNonInteractive2(params) {
|
|
|
11065
11051
|
durationMs
|
|
11066
11052
|
)
|
|
11067
11053
|
});
|
|
11068
|
-
} else if (config.getOutputFormat() ===
|
|
11054
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11069
11055
|
const formatter = new JsonFormatter();
|
|
11070
11056
|
const stats = uiTelemetryService.getMetrics();
|
|
11071
11057
|
textOutput.write(
|
|
@@ -11088,12 +11074,12 @@ async function runNonInteractive2(params) {
|
|
|
11088
11074
|
const metrics = uiTelemetryService.getMetrics();
|
|
11089
11075
|
const durationMs = Date.now() - startTime;
|
|
11090
11076
|
streamFormatter.emitEvent({
|
|
11091
|
-
type:
|
|
11077
|
+
type: "result" /* RESULT */,
|
|
11092
11078
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11093
11079
|
status: invalidStreamError ? "error" : "success",
|
|
11094
11080
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11095
11081
|
});
|
|
11096
|
-
} else if (config.getOutputFormat() ===
|
|
11082
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11097
11083
|
const formatter = new JsonFormatter();
|
|
11098
11084
|
const stats = uiTelemetryService.getMetrics();
|
|
11099
11085
|
textOutput.write(
|
|
@@ -11117,7 +11103,7 @@ async function runNonInteractive2(params) {
|
|
|
11117
11103
|
cleanupStdinCancellation();
|
|
11118
11104
|
scheduler?.dispose();
|
|
11119
11105
|
consolePatcher.cleanup();
|
|
11120
|
-
coreEvents.off(
|
|
11106
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11121
11107
|
}
|
|
11122
11108
|
if (errorToHandle) {
|
|
11123
11109
|
handleError(errorToHandle, config);
|
|
@@ -13548,12 +13534,12 @@ function toToolCallContent(toolResult) {
|
|
|
13548
13534
|
}
|
|
13549
13535
|
var basicPermissionOptions = [
|
|
13550
13536
|
{
|
|
13551
|
-
optionId:
|
|
13537
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
13552
13538
|
name: "Allow",
|
|
13553
13539
|
kind: "allow_once"
|
|
13554
13540
|
},
|
|
13555
13541
|
{
|
|
13556
|
-
optionId:
|
|
13542
|
+
optionId: "cancel" /* Cancel */,
|
|
13557
13543
|
name: "Reject",
|
|
13558
13544
|
kind: "reject_once"
|
|
13559
13545
|
}
|
|
@@ -13565,13 +13551,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13565
13551
|
switch (confirmation.type) {
|
|
13566
13552
|
case "edit":
|
|
13567
13553
|
options.push({
|
|
13568
|
-
optionId:
|
|
13554
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13569
13555
|
name: "Allow for this session",
|
|
13570
13556
|
kind: "allow_always"
|
|
13571
13557
|
});
|
|
13572
13558
|
if (enablePermanentToolApproval) {
|
|
13573
13559
|
options.push({
|
|
13574
|
-
optionId:
|
|
13560
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13575
13561
|
name: "Allow for this file in all future sessions",
|
|
13576
13562
|
kind: "allow_always"
|
|
13577
13563
|
});
|
|
@@ -13579,13 +13565,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13579
13565
|
break;
|
|
13580
13566
|
case "exec":
|
|
13581
13567
|
options.push({
|
|
13582
|
-
optionId:
|
|
13568
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13583
13569
|
name: "Allow for this session",
|
|
13584
13570
|
kind: "allow_always"
|
|
13585
13571
|
});
|
|
13586
13572
|
if (enablePermanentToolApproval) {
|
|
13587
13573
|
options.push({
|
|
13588
|
-
optionId:
|
|
13574
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13589
13575
|
name: "Allow this command for all future sessions",
|
|
13590
13576
|
kind: "allow_always"
|
|
13591
13577
|
});
|
|
@@ -13594,19 +13580,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13594
13580
|
case "mcp":
|
|
13595
13581
|
options.push(
|
|
13596
13582
|
{
|
|
13597
|
-
optionId:
|
|
13583
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
13598
13584
|
name: "Allow all server tools for this session",
|
|
13599
13585
|
kind: "allow_always"
|
|
13600
13586
|
},
|
|
13601
13587
|
{
|
|
13602
|
-
optionId:
|
|
13588
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
13603
13589
|
name: "Allow tool for this session",
|
|
13604
13590
|
kind: "allow_always"
|
|
13605
13591
|
}
|
|
13606
13592
|
);
|
|
13607
13593
|
if (enablePermanentToolApproval) {
|
|
13608
13594
|
options.push({
|
|
13609
|
-
optionId:
|
|
13595
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13610
13596
|
name: "Allow tool for all future sessions",
|
|
13611
13597
|
kind: "allow_always"
|
|
13612
13598
|
});
|
|
@@ -13614,13 +13600,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13614
13600
|
break;
|
|
13615
13601
|
case "info":
|
|
13616
13602
|
options.push({
|
|
13617
|
-
optionId:
|
|
13603
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13618
13604
|
name: "Allow for this session",
|
|
13619
13605
|
kind: "allow_always"
|
|
13620
13606
|
});
|
|
13621
13607
|
if (enablePermanentToolApproval) {
|
|
13622
13608
|
options.push({
|
|
13623
|
-
optionId:
|
|
13609
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13624
13610
|
name: "Allow for all future sessions",
|
|
13625
13611
|
kind: "allow_always"
|
|
13626
13612
|
});
|
|
@@ -13652,21 +13638,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13652
13638
|
}
|
|
13653
13639
|
function toAcpToolKind(kind) {
|
|
13654
13640
|
switch (kind) {
|
|
13655
|
-
case
|
|
13656
|
-
case
|
|
13657
|
-
case
|
|
13658
|
-
case
|
|
13659
|
-
case
|
|
13660
|
-
case
|
|
13661
|
-
case
|
|
13662
|
-
case
|
|
13663
|
-
case
|
|
13664
|
-
case
|
|
13641
|
+
case "read" /* Read */:
|
|
13642
|
+
case "edit" /* Edit */:
|
|
13643
|
+
case "execute" /* Execute */:
|
|
13644
|
+
case "search" /* Search */:
|
|
13645
|
+
case "delete" /* Delete */:
|
|
13646
|
+
case "move" /* Move */:
|
|
13647
|
+
case "think" /* Think */:
|
|
13648
|
+
case "fetch" /* Fetch */:
|
|
13649
|
+
case "switch_mode" /* SwitchMode */:
|
|
13650
|
+
case "other" /* Other */:
|
|
13665
13651
|
return kind;
|
|
13666
|
-
case
|
|
13652
|
+
case "agent" /* Agent */:
|
|
13667
13653
|
return "think";
|
|
13668
|
-
case
|
|
13669
|
-
case
|
|
13654
|
+
case "plan" /* Plan */:
|
|
13655
|
+
case "communicate" /* Communicate */:
|
|
13670
13656
|
default:
|
|
13671
13657
|
return "other";
|
|
13672
13658
|
}
|
|
@@ -13674,24 +13660,24 @@ function toAcpToolKind(kind) {
|
|
|
13674
13660
|
function buildAvailableModes(isPlanEnabled) {
|
|
13675
13661
|
const modes = [
|
|
13676
13662
|
{
|
|
13677
|
-
id:
|
|
13663
|
+
id: "default" /* DEFAULT */,
|
|
13678
13664
|
name: "Default",
|
|
13679
13665
|
description: "Prompts for approval"
|
|
13680
13666
|
},
|
|
13681
13667
|
{
|
|
13682
|
-
id:
|
|
13668
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
13683
13669
|
name: "Auto Edit",
|
|
13684
13670
|
description: "Auto-approves edit tools"
|
|
13685
13671
|
},
|
|
13686
13672
|
{
|
|
13687
|
-
id:
|
|
13673
|
+
id: "yolo" /* YOLO */,
|
|
13688
13674
|
name: "YOLO",
|
|
13689
13675
|
description: "Auto-approves all tools"
|
|
13690
13676
|
}
|
|
13691
13677
|
];
|
|
13692
13678
|
if (isPlanEnabled) {
|
|
13693
13679
|
modes.push({
|
|
13694
|
-
id:
|
|
13680
|
+
id: "plan" /* PLAN */,
|
|
13695
13681
|
name: "Plan",
|
|
13696
13682
|
description: "Read-only mode"
|
|
13697
13683
|
});
|
|
@@ -13704,7 +13690,7 @@ function buildAvailableModels(config, settings) {
|
|
|
13704
13690
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13705
13691
|
const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
|
|
13706
13692
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13707
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13693
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
13708
13694
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13709
13695
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13710
13696
|
useGemini3_1: useGemini31,
|
|
@@ -13793,7 +13779,7 @@ var Session = class {
|
|
|
13793
13779
|
this.connection = connection;
|
|
13794
13780
|
this.settings = settings;
|
|
13795
13781
|
coreEvents.on(
|
|
13796
|
-
|
|
13782
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13797
13783
|
this.handleApprovalModeChanged
|
|
13798
13784
|
);
|
|
13799
13785
|
}
|
|
@@ -13816,7 +13802,7 @@ var Session = class {
|
|
|
13816
13802
|
};
|
|
13817
13803
|
dispose() {
|
|
13818
13804
|
coreEvents.off(
|
|
13819
|
-
|
|
13805
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13820
13806
|
this.handleApprovalModeChanged
|
|
13821
13807
|
);
|
|
13822
13808
|
}
|
|
@@ -13904,7 +13890,7 @@ ${thought.description}`;
|
|
|
13904
13890
|
await this.sendUpdate({
|
|
13905
13891
|
sessionUpdate: "tool_call",
|
|
13906
13892
|
toolCallId: toolCall.id,
|
|
13907
|
-
status: toolCall.status ===
|
|
13893
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
13908
13894
|
title: toolCall.displayName || toolCall.name,
|
|
13909
13895
|
content: toolCallContent,
|
|
13910
13896
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -13996,7 +13982,7 @@ ${thought.description}`;
|
|
|
13996
13982
|
return { stopReason: "cancelled" };
|
|
13997
13983
|
}
|
|
13998
13984
|
switch (event.type) {
|
|
13999
|
-
case
|
|
13985
|
+
case "content" /* Content */: {
|
|
14000
13986
|
const content = {
|
|
14001
13987
|
type: "text",
|
|
14002
13988
|
text: event.value
|
|
@@ -14007,7 +13993,7 @@ ${thought.description}`;
|
|
|
14007
13993
|
});
|
|
14008
13994
|
break;
|
|
14009
13995
|
}
|
|
14010
|
-
case
|
|
13996
|
+
case "thought" /* Thought */: {
|
|
14011
13997
|
const thoughtText = `**${event.value.subject}**
|
|
14012
13998
|
${event.value.description}`;
|
|
14013
13999
|
await this.sendUpdate({
|
|
@@ -14016,10 +14002,10 @@ ${event.value.description}`;
|
|
|
14016
14002
|
});
|
|
14017
14003
|
break;
|
|
14018
14004
|
}
|
|
14019
|
-
case
|
|
14005
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
14020
14006
|
toolCallRequests.push(event.value);
|
|
14021
14007
|
break;
|
|
14022
|
-
case
|
|
14008
|
+
case "finished" /* Finished */: {
|
|
14023
14009
|
const usage2 = event.value.usageMetadata;
|
|
14024
14010
|
if (usage2) {
|
|
14025
14011
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14027,19 +14013,19 @@ ${event.value.description}`;
|
|
|
14027
14013
|
}
|
|
14028
14014
|
break;
|
|
14029
14015
|
}
|
|
14030
|
-
case
|
|
14016
|
+
case "model_info" /* ModelInfo */:
|
|
14031
14017
|
turnModelId = event.value;
|
|
14032
14018
|
break;
|
|
14033
|
-
case
|
|
14019
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
14034
14020
|
stopReason = "max_turn_requests";
|
|
14035
14021
|
break;
|
|
14036
|
-
case
|
|
14022
|
+
case "loop_detected" /* LoopDetected */:
|
|
14037
14023
|
stopReason = "max_turn_requests";
|
|
14038
14024
|
break;
|
|
14039
|
-
case
|
|
14025
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
14040
14026
|
stopReason = "max_tokens";
|
|
14041
14027
|
break;
|
|
14042
|
-
case
|
|
14028
|
+
case "error" /* Error */: {
|
|
14043
14029
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14044
14030
|
event.value.error
|
|
14045
14031
|
);
|
|
@@ -14267,7 +14253,7 @@ ${event.value.description}`;
|
|
|
14267
14253
|
const output = RequestPermissionResponseSchema.parse(
|
|
14268
14254
|
await this.connection.requestPermission(params)
|
|
14269
14255
|
);
|
|
14270
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14256
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14271
14257
|
await confirmationDetails.onConfirm(outcome);
|
|
14272
14258
|
await updatePolicy(
|
|
14273
14259
|
tool,
|
|
@@ -14278,16 +14264,16 @@ ${event.value.description}`;
|
|
|
14278
14264
|
invocation
|
|
14279
14265
|
);
|
|
14280
14266
|
switch (outcome) {
|
|
14281
|
-
case
|
|
14267
|
+
case "cancel" /* Cancel */:
|
|
14282
14268
|
return errorResponse(
|
|
14283
14269
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14284
14270
|
);
|
|
14285
|
-
case
|
|
14286
|
-
case
|
|
14287
|
-
case
|
|
14288
|
-
case
|
|
14289
|
-
case
|
|
14290
|
-
case
|
|
14271
|
+
case "proceed_once" /* ProceedOnce */:
|
|
14272
|
+
case "proceed_always" /* ProceedAlways */:
|
|
14273
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
14274
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
14275
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
14276
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
14291
14277
|
break;
|
|
14292
14278
|
default: {
|
|
14293
14279
|
const resultOutcome = outcome;
|
|
@@ -14341,7 +14327,7 @@ ${event.value.description}`;
|
|
|
14341
14327
|
);
|
|
14342
14328
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14343
14329
|
{
|
|
14344
|
-
status:
|
|
14330
|
+
status: "success" /* Success */,
|
|
14345
14331
|
request: {
|
|
14346
14332
|
callId,
|
|
14347
14333
|
name: fc.name,
|
|
@@ -14386,7 +14372,7 @@ ${event.value.description}`;
|
|
|
14386
14372
|
});
|
|
14387
14373
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14388
14374
|
{
|
|
14389
|
-
status:
|
|
14375
|
+
status: "error" /* Error */,
|
|
14390
14376
|
request: {
|
|
14391
14377
|
callId,
|
|
14392
14378
|
name: fc.name,
|
|
@@ -14501,12 +14487,12 @@ ${event.value.description}`;
|
|
|
14501
14487
|
sessionId: this.id,
|
|
14502
14488
|
options: [
|
|
14503
14489
|
{
|
|
14504
|
-
optionId:
|
|
14490
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14505
14491
|
name: "Allow once",
|
|
14506
14492
|
kind: "allow_once"
|
|
14507
14493
|
},
|
|
14508
14494
|
{
|
|
14509
|
-
optionId:
|
|
14495
|
+
optionId: "cancel" /* Cancel */,
|
|
14510
14496
|
name: "Deny",
|
|
14511
14497
|
kind: "reject_once"
|
|
14512
14498
|
}
|
|
@@ -14531,8 +14517,8 @@ ${event.value.description}`;
|
|
|
14531
14517
|
const output = RequestPermissionResponseSchema.parse(
|
|
14532
14518
|
await this.connection.requestPermission(params)
|
|
14533
14519
|
);
|
|
14534
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14535
|
-
if (outcome ===
|
|
14520
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14521
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
14536
14522
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14537
14523
|
validationError = null;
|
|
14538
14524
|
} else {
|
|
@@ -14964,7 +14950,7 @@ var AcpSessionManager = class {
|
|
|
14964
14950
|
mcpServers,
|
|
14965
14951
|
loadedSettings
|
|
14966
14952
|
);
|
|
14967
|
-
const authType = loadedSettings.merged.security.auth.selectedType ||
|
|
14953
|
+
const authType = loadedSettings.merged.security.auth.selectedType || "gemini-api-key" /* USE_GEMINI */;
|
|
14968
14954
|
let isAuthenticated = false;
|
|
14969
14955
|
let authErrorMessage = "";
|
|
14970
14956
|
try {
|
|
@@ -14976,7 +14962,7 @@ var AcpSessionManager = class {
|
|
|
14976
14962
|
);
|
|
14977
14963
|
isAuthenticated = true;
|
|
14978
14964
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
14979
|
-
if (authType ===
|
|
14965
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
14980
14966
|
isAuthenticated = false;
|
|
14981
14967
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
14982
14968
|
}
|
|
@@ -15186,12 +15172,12 @@ var GeminiAgent = class {
|
|
|
15186
15172
|
}
|
|
15187
15173
|
const authMethods = [
|
|
15188
15174
|
{
|
|
15189
|
-
id:
|
|
15175
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
15190
15176
|
name: "Log in with Google",
|
|
15191
15177
|
description: "Log in with your Google account"
|
|
15192
15178
|
},
|
|
15193
15179
|
{
|
|
15194
|
-
id:
|
|
15180
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
15195
15181
|
name: "Gemini API key",
|
|
15196
15182
|
description: "Use an API key with Gemini Developer API",
|
|
15197
15183
|
_meta: {
|
|
@@ -15201,12 +15187,12 @@ var GeminiAgent = class {
|
|
|
15201
15187
|
}
|
|
15202
15188
|
},
|
|
15203
15189
|
{
|
|
15204
|
-
id:
|
|
15190
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
15205
15191
|
name: "Vertex AI",
|
|
15206
15192
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15207
15193
|
},
|
|
15208
15194
|
{
|
|
15209
|
-
id:
|
|
15195
|
+
id: "gateway" /* GATEWAY */,
|
|
15210
15196
|
name: "AI API Gateway",
|
|
15211
15197
|
description: "Use a custom AI API Gateway",
|
|
15212
15198
|
_meta: {
|
|
@@ -15379,7 +15365,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15379
15365
|
}
|
|
15380
15366
|
return authType;
|
|
15381
15367
|
} catch (error) {
|
|
15382
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15368
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
15383
15369
|
handleError(
|
|
15384
15370
|
error instanceof Error ? error : new Error(String(error)),
|
|
15385
15371
|
nonInteractiveConfig,
|
|
@@ -15575,10 +15561,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15575
15561
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15576
15562
|
}
|
|
15577
15563
|
start() {
|
|
15578
|
-
coreEvents.on(
|
|
15564
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15579
15565
|
}
|
|
15580
15566
|
stop() {
|
|
15581
|
-
coreEvents.off(
|
|
15567
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15582
15568
|
if (this.flushTimeout) {
|
|
15583
15569
|
clearTimeout(this.flushTimeout);
|
|
15584
15570
|
this.flushTimeout = null;
|
|
@@ -15859,7 +15845,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
15859
15845
|
}
|
|
15860
15846
|
}
|
|
15861
15847
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15862
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15848
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-MHCNTGQB.js");
|
|
15863
15849
|
await doStartUI(
|
|
15864
15850
|
config,
|
|
15865
15851
|
settings,
|
|
@@ -15962,12 +15948,12 @@ async function main() {
|
|
|
15962
15948
|
dns.setDefaultResultOrder(
|
|
15963
15949
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
15964
15950
|
);
|
|
15965
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
15951
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
15966
15952
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
15967
15953
|
settings.setValue(
|
|
15968
15954
|
"User" /* User */,
|
|
15969
15955
|
"security.auth.selectedType",
|
|
15970
|
-
|
|
15956
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
15971
15957
|
);
|
|
15972
15958
|
}
|
|
15973
15959
|
}
|
|
@@ -16067,7 +16053,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16067
16053
|
await config.storage.initialize();
|
|
16068
16054
|
adminControlsListner.setConfig(config);
|
|
16069
16055
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
16070
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
16056
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-WA4GU73C.js");
|
|
16071
16057
|
setupInitialActivityLogger(config);
|
|
16072
16058
|
}
|
|
16073
16059
|
registerTelemetryConfig(config);
|
|
@@ -16075,7 +16061,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16075
16061
|
const messageBus = config.getMessageBus();
|
|
16076
16062
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
16077
16063
|
registerCleanup(async () => {
|
|
16078
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
16064
|
+
await config.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
16079
16065
|
});
|
|
16080
16066
|
if (!config.getAcpMode()) {
|
|
16081
16067
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16126,7 +16112,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16126
16112
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16127
16113
|
const initializationResult = await initializeApp(config, settings);
|
|
16128
16114
|
initAppHandle?.end();
|
|
16129
|
-
import("./liteRtServerManager-
|
|
16115
|
+
import("./liteRtServerManager-WMZJWUGC.js").then(({ LiteRtServerManager }) => {
|
|
16130
16116
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16131
16117
|
if (!mergedGemma) return;
|
|
16132
16118
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16136,7 +16122,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16136
16122
|
autoStartServer: userGemma?.autoStartServer
|
|
16137
16123
|
});
|
|
16138
16124
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16139
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16125
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
16140
16126
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16141
16127
|
}
|
|
16142
16128
|
if (config.getAcpMode()) {
|
|
@@ -16152,7 +16138,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16152
16138
|
...rawStartupWarnings.map((message) => ({
|
|
16153
16139
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16154
16140
|
message,
|
|
16155
|
-
priority:
|
|
16141
|
+
priority: "high" /* High */
|
|
16156
16142
|
})),
|
|
16157
16143
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16158
16144
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16189,7 +16175,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16189
16175
|
${input}` : stdinData;
|
|
16190
16176
|
}
|
|
16191
16177
|
}
|
|
16192
|
-
const sessionStartSource = resumedSessionData ?
|
|
16178
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
16193
16179
|
const hookSystem = config?.getHookSystem();
|
|
16194
16180
|
if (hookSystem) {
|
|
16195
16181
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16246,8 +16232,8 @@ ${input}` : wrappedContext;
|
|
|
16246
16232
|
}
|
|
16247
16233
|
}
|
|
16248
16234
|
function initializeOutputListenersAndFlush(config) {
|
|
16249
|
-
if (coreEvents.listenerCount(
|
|
16250
|
-
coreEvents.on(
|
|
16235
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
16236
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
16251
16237
|
if (payload.isStderr) {
|
|
16252
16238
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16253
16239
|
} else {
|
|
@@ -16255,8 +16241,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16255
16241
|
}
|
|
16256
16242
|
});
|
|
16257
16243
|
}
|
|
16258
|
-
if (coreEvents.listenerCount(
|
|
16259
|
-
coreEvents.on(
|
|
16244
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
16245
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
16260
16246
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16261
16247
|
writeToStderr(payload.content + "\n");
|
|
16262
16248
|
} else {
|
|
@@ -16264,8 +16250,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16264
16250
|
}
|
|
16265
16251
|
});
|
|
16266
16252
|
}
|
|
16267
|
-
if (coreEvents.listenerCount(
|
|
16268
|
-
coreEvents.on(
|
|
16253
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
16254
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
16269
16255
|
writeToStderr(payload.message + "\n");
|
|
16270
16256
|
});
|
|
16271
16257
|
}
|
|
@@ -16273,7 +16259,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16273
16259
|
const forceToStderr = outputFormat === "json";
|
|
16274
16260
|
coreEvents.drainBacklogs(
|
|
16275
16261
|
(event, args) => {
|
|
16276
|
-
if (forceToStderr && event ===
|
|
16262
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
16277
16263
|
const payload = args[0];
|
|
16278
16264
|
if (!payload.isStderr) {
|
|
16279
16265
|
return {
|