@google/gemini-cli 0.45.0-preview.1 → 0.45.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-6WWGBNKT.js → chunk-2ARYG3KE.js} +1 -1
- package/bundle/{chunk-2ZH72RHY.js → chunk-3TWZMAJU.js} +3 -3
- package/bundle/{chunk-BO72FGK2.js → chunk-4EBMYFID.js} +7 -7
- package/bundle/{chunk-K43EAKOP.js → chunk-4KOU3QNT.js} +5 -8
- package/bundle/{chunk-BLUAEAZN.js → chunk-53SRWMUU.js} +1 -1
- package/bundle/{chunk-5YTIYFJO.js → chunk-6T7N6JF2.js} +4 -4
- package/bundle/{chunk-OWSYSTWM.js → chunk-EORX7LYI.js} +1 -1
- package/bundle/{chunk-IGJG7DNZ.js → chunk-EUYIPFPA.js} +1 -1
- package/bundle/{chunk-3NDAYKF4.js → chunk-GVEZJIV3.js} +1 -1
- package/bundle/{chunk-E3KBY4EQ.js → chunk-HFVEWB6N.js} +1 -1
- package/bundle/{chunk-CJTRYZPP.js → chunk-IL7J46PP.js} +3 -3
- package/bundle/{chunk-4KX3ETW3.js → chunk-JLFE3KRS.js} +1 -1
- package/bundle/{chunk-JXVK53RJ.js → chunk-K6WTIGVC.js} +2 -2
- package/bundle/{chunk-JWWA32XO.js → chunk-KSNTXH4E.js} +54 -67
- package/bundle/{chunk-R52453KY.js → chunk-N6QPQL7E.js} +4 -4
- package/bundle/{chunk-Y6SLZFPD.js → chunk-PNU4GACG.js} +2 -2
- package/bundle/{chunk-FEY3T6LA.js → chunk-PXEK5ENZ.js} +8 -9
- package/bundle/{chunk-5BX5PJIE.js → chunk-SG46YSQ3.js} +7 -7
- package/bundle/{chunk-S6AQSJNU.js → chunk-THZMPVCN.js} +1 -1
- package/bundle/{chunk-WTRP3GGZ.js → chunk-TWSSMLUS.js} +1 -1
- package/bundle/{chunk-HA5VES5S.js → chunk-VL3FKVC7.js} +3 -3
- package/bundle/{chunk-DDJWQSDN.js → chunk-XV2YFH7B.js} +14033 -7525
- package/bundle/{chunk-NB2NOE4L.js → chunk-YI3KORH5.js} +2 -2
- package/bundle/{chunk-CJHCK2YW.js → chunk-Z5F25543.js} +1 -1
- package/bundle/{cleanup-2FHZMQ3Z.js → cleanup-3SMSXJJA.js} +2 -2
- package/bundle/{cleanup-F7XRM3DT.js → cleanup-FNQ3LEWG.js} +2 -2
- package/bundle/{cleanup-OZH3SJVM.js → cleanup-I56KHTTC.js} +2 -2
- package/bundle/{core-B47ZXN3Y.js → core-AQUUQTX2.js} +1 -1
- package/bundle/{dist-C6L3MGQS.js → core-KGXBOJTX.js} +1 -1
- package/bundle/{devtoolsService-L7PYKOHR.js → devtoolsService-EW3B2Y63.js} +2 -2
- package/bundle/{devtoolsService-XYSZCMQM.js → devtoolsService-F7PHNBEQ.js} +2 -2
- package/bundle/{devtoolsService-OYQJHPEW.js → devtoolsService-VFEFRDYG.js} +3 -4
- package/bundle/{dist-MOEHPHUN.js → dist-2G5KTD32.js} +1 -1
- package/bundle/{gemini-LT5MWLZQ.js → gemini-4KS2EZX6.js} +14 -14
- package/bundle/{gemini-CHS2YNJG.js → gemini-JMMBFICD.js} +196 -212
- package/bundle/{gemini-2XSNIT2N.js → gemini-ORQHD633.js} +14 -14
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-UUI7OUZK.js → interactiveCli-ESB66RW7.js} +8 -8
- package/bundle/{interactiveCli-2YFAMDR5.js → interactiveCli-XUZZOZXX.js} +8 -8
- package/bundle/{interactiveCli-6EFCVZP7.js → interactiveCli-ZJXV4DW7.js} +295 -314
- package/bundle/{liteRtServerManager-2VKZTPMY.js → liteRtServerManager-DORIWEMR.js} +4 -4
- package/bundle/{liteRtServerManager-4PZ3X7SS.js → liteRtServerManager-HELKQKOZ.js} +4 -4
- package/bundle/{liteRtServerManager-GH6VHWTU.js → liteRtServerManager-RNNHEQJI.js} +4 -4
- package/bundle/{oauth2-provider-BDX6V2YX.js → oauth2-provider-2IJNOFOO.js} +1 -1
- package/bundle/{oauth2-provider-4UIWNIX3.js → oauth2-provider-7N4OFPTL.js} +1 -1
- package/bundle/{oauth2-provider-N2ZY2DXQ.js → oauth2-provider-YYLBPESU.js} +72 -38
- package/bundle/{start-3LEQZELI.js → start-66KF6MVV.js} +6 -6
- package/bundle/{start-FH2E2VQ2.js → start-IGG6LDST.js} +6 -6
- package/bundle/{start-FPEO7KCZ.js → start-R7DTCFCN.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-565MWDPP.js +0 -394439
- package/bundle/chunk-HVWNKZSB.js +0 -154
- package/bundle/chunk-HZCAEM2F.js +0 -398
- package/bundle/chunk-NVJOR76X.js +0 -1571
- package/bundle/chunk-NYWYNF2Z.js +0 -81685
- package/bundle/chunk-OQLEYMM2.js +0 -512
- package/bundle/chunk-SKDT4PWC.js +0 -118
- package/bundle/chunk-TCAVPMJX.js +0 -17320
- package/bundle/cleanup-ZO5CVKGH.js +0 -32
- package/bundle/devtoolsService-SGV7MSUA.js +0 -856
- package/bundle/dist-WLKMTHZQ.js +0 -2134
- package/bundle/gemini-CQDPCFEE.js +0 -16406
- package/bundle/interactiveCli-HA3BASZN.js +0 -34726
- package/bundle/liteRtServerManager-OMSM6SJU.js +0 -65
- package/bundle/oauth2-provider-TRRJCE2P.js +0 -235
- package/bundle/start-J7G6YXDJ.js +0 -18
|
@@ -41,18 +41,18 @@ import {
|
|
|
41
41
|
updateAllUpdatableExtensions,
|
|
42
42
|
updateExtension,
|
|
43
43
|
validateAuthMethod
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-KSNTXH4E.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-VL3FKVC7.js";
|
|
52
52
|
import {
|
|
53
53
|
exitCli,
|
|
54
54
|
require_source
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-GVEZJIV3.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-2ARYG3KE.js";
|
|
90
90
|
import {
|
|
91
91
|
RELAUNCH_EXIT_CODE
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import "./chunk-
|
|
92
|
+
} from "./chunk-YI3KORH5.js";
|
|
93
|
+
import "./chunk-HFVEWB6N.js";
|
|
94
94
|
import {
|
|
95
95
|
cleanupCheckpoints,
|
|
96
96
|
registerCleanup,
|
|
@@ -99,15 +99,12 @@ import {
|
|
|
99
99
|
runExitCleanup,
|
|
100
100
|
runSyncCleanup,
|
|
101
101
|
setupSignalHandlers
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-TWSSMLUS.js";
|
|
103
103
|
import {
|
|
104
104
|
ASK_USER_TOOL_NAME,
|
|
105
|
-
ApprovalMode,
|
|
106
105
|
AuthType,
|
|
107
106
|
Client,
|
|
108
107
|
Config,
|
|
109
|
-
CoreEvent,
|
|
110
|
-
CoreToolCallStatus,
|
|
111
108
|
DEFAULT_CONTEXT_FILENAME,
|
|
112
109
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
113
110
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -129,45 +126,32 @@ import {
|
|
|
129
126
|
FolderTrustDiscoveryService,
|
|
130
127
|
GEMINI_DIR,
|
|
131
128
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
132
|
-
GeminiEventType,
|
|
133
129
|
IdeClient,
|
|
134
|
-
IntegrityStatus,
|
|
135
130
|
InvalidStreamError,
|
|
136
131
|
JsonFormatter,
|
|
137
|
-
JsonStreamEventType,
|
|
138
|
-
Kind,
|
|
139
132
|
LegacyAgentSession,
|
|
140
133
|
Logger,
|
|
141
134
|
MCPServerConfig,
|
|
142
|
-
MCPServerStatus,
|
|
143
|
-
MessageBusType,
|
|
144
|
-
OutputFormat,
|
|
145
135
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
146
136
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
147
137
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
148
138
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
149
139
|
PREVIEW_GEMINI_MODEL,
|
|
150
|
-
PolicyDecision,
|
|
151
140
|
PolicyIntegrityManager,
|
|
152
141
|
REFERENCE_CONTENT_START,
|
|
153
142
|
ROOT_SCHEDULER_ID,
|
|
154
143
|
ReadManyFilesTool,
|
|
155
144
|
Scheduler,
|
|
156
|
-
SessionEndReason,
|
|
157
|
-
SessionStartSource,
|
|
158
145
|
ShellExecutionService,
|
|
159
146
|
SimpleExtensionLoader,
|
|
160
147
|
Storage,
|
|
161
148
|
StreamJsonFormatter,
|
|
162
149
|
ToolCallEvent,
|
|
163
150
|
ToolConfirmationOutcome,
|
|
164
|
-
ToolErrorType,
|
|
165
|
-
TrustLevel,
|
|
166
151
|
UserAccountManager,
|
|
167
152
|
UserPromptEvent,
|
|
168
153
|
ValidationCancelledError,
|
|
169
154
|
ValidationRequiredError,
|
|
170
|
-
WarningPriority,
|
|
171
155
|
applyAdminAllowlist,
|
|
172
156
|
applyRequiredServers,
|
|
173
157
|
clearCachedCredentialFile,
|
|
@@ -247,7 +231,7 @@ import {
|
|
|
247
231
|
updatePolicy,
|
|
248
232
|
writeToStderr,
|
|
249
233
|
writeToStdout
|
|
250
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-N6QPQL7E.js";
|
|
251
235
|
import "./chunk-6HI7VNOG.js";
|
|
252
236
|
import "./chunk-TUDYL3X4.js";
|
|
253
237
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5377,7 +5361,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5377
5361
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5378
5362
|
const isStdio = !!config.command;
|
|
5379
5363
|
if (isStdio && !isTrusted) {
|
|
5380
|
-
return
|
|
5364
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5381
5365
|
}
|
|
5382
5366
|
const client = new Client({
|
|
5383
5367
|
name: "mcp-test-client",
|
|
@@ -5413,7 +5397,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5413
5397
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5414
5398
|
} catch {
|
|
5415
5399
|
await client.close();
|
|
5416
|
-
return
|
|
5400
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5417
5401
|
}
|
|
5418
5402
|
try {
|
|
5419
5403
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5427,10 +5411,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5427
5411
|
);
|
|
5428
5412
|
}
|
|
5429
5413
|
await client.close();
|
|
5430
|
-
return
|
|
5414
|
+
return "connected" /* CONNECTED */;
|
|
5431
5415
|
} catch {
|
|
5432
5416
|
await transport.close();
|
|
5433
|
-
return
|
|
5417
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5434
5418
|
}
|
|
5435
5419
|
}
|
|
5436
5420
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5443,12 +5427,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5443
5427
|
});
|
|
5444
5428
|
if (!loadResult.allowed) {
|
|
5445
5429
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5446
|
-
return
|
|
5430
|
+
return "blocked" /* BLOCKED */;
|
|
5447
5431
|
}
|
|
5448
|
-
return
|
|
5432
|
+
return "disabled" /* DISABLED */;
|
|
5449
5433
|
}
|
|
5450
5434
|
if (!isTrusted) {
|
|
5451
|
-
return
|
|
5435
|
+
return "disabled" /* DISABLED */;
|
|
5452
5436
|
}
|
|
5453
5437
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5454
5438
|
}
|
|
@@ -5494,23 +5478,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5494
5478
|
let statusIndicator = "";
|
|
5495
5479
|
let statusText = "";
|
|
5496
5480
|
switch (status) {
|
|
5497
|
-
case
|
|
5481
|
+
case "connected" /* CONNECTED */:
|
|
5498
5482
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5499
5483
|
statusText = "Connected";
|
|
5500
5484
|
break;
|
|
5501
|
-
case
|
|
5485
|
+
case "connecting" /* CONNECTING */:
|
|
5502
5486
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5503
5487
|
statusText = "Connecting";
|
|
5504
5488
|
break;
|
|
5505
|
-
case
|
|
5489
|
+
case "blocked" /* BLOCKED */:
|
|
5506
5490
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5507
5491
|
statusText = "Blocked";
|
|
5508
5492
|
break;
|
|
5509
|
-
case
|
|
5493
|
+
case "disabled" /* DISABLED */:
|
|
5510
5494
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5511
5495
|
statusText = "Disabled";
|
|
5512
5496
|
break;
|
|
5513
|
-
case
|
|
5497
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5514
5498
|
default:
|
|
5515
5499
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5516
5500
|
statusText = "Disconnected";
|
|
@@ -5796,7 +5780,7 @@ async function handleInstall(args) {
|
|
|
5796
5780
|
);
|
|
5797
5781
|
if (confirmed) {
|
|
5798
5782
|
const trustedFolders = loadTrustedFolders();
|
|
5799
|
-
await trustedFolders.setValue(realPath,
|
|
5783
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5800
5784
|
} else {
|
|
5801
5785
|
throw new Error(
|
|
5802
5786
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7841,7 +7825,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7841
7825
|
}
|
|
7842
7826
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7843
7827
|
const packageJson = await getPackageJson(__dirname3);
|
|
7844
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.45.0
|
|
7828
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.45.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7845
7829
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7846
7830
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7847
7831
|
}
|
|
@@ -7900,9 +7884,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7900
7884
|
cwd,
|
|
7901
7885
|
potentialWorkspacePoliciesDir
|
|
7902
7886
|
);
|
|
7903
|
-
if (integrityResult.status ===
|
|
7887
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7904
7888
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7905
|
-
} else if (integrityResult.status ===
|
|
7889
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7906
7890
|
workspacePoliciesDir = void 0;
|
|
7907
7891
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7908
7892
|
policyUpdateConfirmationRequest = {
|
|
@@ -8330,23 +8314,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8330
8314
|
if (rawApprovalMode) {
|
|
8331
8315
|
switch (rawApprovalMode) {
|
|
8332
8316
|
case "yolo":
|
|
8333
|
-
approvalMode =
|
|
8317
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8334
8318
|
break;
|
|
8335
8319
|
case "auto_edit":
|
|
8336
|
-
approvalMode =
|
|
8320
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8337
8321
|
break;
|
|
8338
8322
|
case "plan":
|
|
8339
8323
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8340
8324
|
debugLogger.warn(
|
|
8341
8325
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8342
8326
|
);
|
|
8343
|
-
approvalMode =
|
|
8327
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8344
8328
|
} else {
|
|
8345
|
-
approvalMode =
|
|
8329
|
+
approvalMode = "plan" /* PLAN */;
|
|
8346
8330
|
}
|
|
8347
8331
|
break;
|
|
8348
8332
|
case "default":
|
|
8349
|
-
approvalMode =
|
|
8333
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8350
8334
|
break;
|
|
8351
8335
|
default:
|
|
8352
8336
|
throw new Error(
|
|
@@ -8354,10 +8338,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8354
8338
|
);
|
|
8355
8339
|
}
|
|
8356
8340
|
} else {
|
|
8357
|
-
approvalMode =
|
|
8341
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8358
8342
|
}
|
|
8359
8343
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8360
|
-
if (approvalMode ===
|
|
8344
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8361
8345
|
if (settings.admin?.secureModeEnabled) {
|
|
8362
8346
|
debugLogger.error(
|
|
8363
8347
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8375,16 +8359,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8375
8359
|
)
|
|
8376
8360
|
);
|
|
8377
8361
|
}
|
|
8378
|
-
} else if (approvalMode ===
|
|
8362
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8379
8363
|
debugLogger.warn(
|
|
8380
8364
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8381
8365
|
);
|
|
8382
8366
|
}
|
|
8383
|
-
if (!trustedFolder && approvalMode !==
|
|
8367
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8384
8368
|
debugLogger.warn(
|
|
8385
8369
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8386
8370
|
);
|
|
8387
|
-
approvalMode =
|
|
8371
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8388
8372
|
}
|
|
8389
8373
|
let telemetrySettings;
|
|
8390
8374
|
try {
|
|
@@ -9822,7 +9806,7 @@ import path9 from "node:path";
|
|
|
9822
9806
|
import process4 from "node:process";
|
|
9823
9807
|
var homeDirectoryCheck = {
|
|
9824
9808
|
id: "home-directory",
|
|
9825
|
-
priority:
|
|
9809
|
+
priority: "low" /* Low */,
|
|
9826
9810
|
check: async (workspaceRoot, settings) => {
|
|
9827
9811
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9828
9812
|
return null;
|
|
@@ -9846,7 +9830,7 @@ var homeDirectoryCheck = {
|
|
|
9846
9830
|
};
|
|
9847
9831
|
var rootDirectoryCheck = {
|
|
9848
9832
|
id: "root-directory",
|
|
9849
|
-
priority:
|
|
9833
|
+
priority: "high" /* High */,
|
|
9850
9834
|
check: async (workspaceRoot, _settings) => {
|
|
9851
9835
|
try {
|
|
9852
9836
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9862,7 +9846,7 @@ var rootDirectoryCheck = {
|
|
|
9862
9846
|
};
|
|
9863
9847
|
var folderTrustCheck = {
|
|
9864
9848
|
id: "folder-trust",
|
|
9865
|
-
priority:
|
|
9849
|
+
priority: "high" /* High */,
|
|
9866
9850
|
check: async (workspaceRoot, settings) => {
|
|
9867
9851
|
if (!isFolderTrustEnabled(settings)) {
|
|
9868
9852
|
return null;
|
|
@@ -10052,12 +10036,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10052
10036
|
error,
|
|
10053
10037
|
config.getContentGeneratorConfig()?.authType
|
|
10054
10038
|
);
|
|
10055
|
-
if (config.getOutputFormat() ===
|
|
10039
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10056
10040
|
const streamFormatter = new StreamJsonFormatter();
|
|
10057
10041
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10058
10042
|
const metrics = uiTelemetryService.getMetrics();
|
|
10059
10043
|
streamFormatter.emitEvent({
|
|
10060
|
-
type:
|
|
10044
|
+
type: "result" /* RESULT */,
|
|
10061
10045
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10062
10046
|
status: "error",
|
|
10063
10047
|
error: {
|
|
@@ -10068,7 +10052,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10068
10052
|
});
|
|
10069
10053
|
runSyncCleanup();
|
|
10070
10054
|
process.exit(getNumericExitCode(errorCode));
|
|
10071
|
-
} else if (config.getOutputFormat() ===
|
|
10055
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10072
10056
|
const formatter = new JsonFormatter();
|
|
10073
10057
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10074
10058
|
const formattedError = formatter.formatError(
|
|
@@ -10088,11 +10072,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10088
10072
|
const isFatal = isFatalToolError(errorType);
|
|
10089
10073
|
if (isFatal) {
|
|
10090
10074
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10091
|
-
if (config.getOutputFormat() ===
|
|
10075
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10092
10076
|
const streamFormatter = new StreamJsonFormatter();
|
|
10093
10077
|
const metrics = uiTelemetryService.getMetrics();
|
|
10094
10078
|
streamFormatter.emitEvent({
|
|
10095
|
-
type:
|
|
10079
|
+
type: "result" /* RESULT */,
|
|
10096
10080
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10097
10081
|
status: "error",
|
|
10098
10082
|
error: {
|
|
@@ -10101,7 +10085,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10101
10085
|
},
|
|
10102
10086
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10103
10087
|
});
|
|
10104
|
-
} else if (config.getOutputFormat() ===
|
|
10088
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10105
10089
|
const formatter = new JsonFormatter();
|
|
10106
10090
|
const formattedError = formatter.formatError(
|
|
10107
10091
|
toolExecutionError,
|
|
@@ -10119,11 +10103,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10119
10103
|
}
|
|
10120
10104
|
function handleCancellationError(config) {
|
|
10121
10105
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10122
|
-
if (config.getOutputFormat() ===
|
|
10106
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10123
10107
|
const streamFormatter = new StreamJsonFormatter();
|
|
10124
10108
|
const metrics = uiTelemetryService.getMetrics();
|
|
10125
10109
|
streamFormatter.emitEvent({
|
|
10126
|
-
type:
|
|
10110
|
+
type: "result" /* RESULT */,
|
|
10127
10111
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10128
10112
|
status: "error",
|
|
10129
10113
|
error: {
|
|
@@ -10134,7 +10118,7 @@ function handleCancellationError(config) {
|
|
|
10134
10118
|
});
|
|
10135
10119
|
runSyncCleanup();
|
|
10136
10120
|
process.exit(cancellationError.exitCode);
|
|
10137
|
-
} else if (config.getOutputFormat() ===
|
|
10121
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10138
10122
|
const formatter = new JsonFormatter();
|
|
10139
10123
|
const formattedError = formatter.formatError(
|
|
10140
10124
|
cancellationError,
|
|
@@ -10154,11 +10138,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10154
10138
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10155
10139
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10156
10140
|
);
|
|
10157
|
-
if (config.getOutputFormat() ===
|
|
10141
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10158
10142
|
const streamFormatter = new StreamJsonFormatter();
|
|
10159
10143
|
const metrics = uiTelemetryService.getMetrics();
|
|
10160
10144
|
streamFormatter.emitEvent({
|
|
10161
|
-
type:
|
|
10145
|
+
type: "result" /* RESULT */,
|
|
10162
10146
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10163
10147
|
status: "error",
|
|
10164
10148
|
error: {
|
|
@@ -10169,7 +10153,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10169
10153
|
});
|
|
10170
10154
|
runSyncCleanup();
|
|
10171
10155
|
process.exit(maxTurnsError.exitCode);
|
|
10172
|
-
} else if (config.getOutputFormat() ===
|
|
10156
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10173
10157
|
const formatter = new JsonFormatter();
|
|
10174
10158
|
const formattedError = formatter.formatError(
|
|
10175
10159
|
maxTurnsError,
|
|
@@ -10249,7 +10233,7 @@ async function runNonInteractive({
|
|
|
10249
10233
|
}
|
|
10250
10234
|
});
|
|
10251
10235
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10252
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10236
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-F7PHNBEQ.js");
|
|
10253
10237
|
setupInitialActivityLogger(config);
|
|
10254
10238
|
}
|
|
10255
10239
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10265,7 +10249,7 @@ async function runNonInteractive({
|
|
|
10265
10249
|
}
|
|
10266
10250
|
};
|
|
10267
10251
|
const startTime = Date.now();
|
|
10268
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10252
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10269
10253
|
const abortController = new AbortController();
|
|
10270
10254
|
let isAborting = false;
|
|
10271
10255
|
let cancelMessageTimer = null;
|
|
@@ -10318,13 +10302,13 @@ async function runNonInteractive({
|
|
|
10318
10302
|
};
|
|
10319
10303
|
try {
|
|
10320
10304
|
consolePatcher.patch();
|
|
10321
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10305
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10322
10306
|
process.stderr.write(
|
|
10323
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"
|
|
10324
10308
|
);
|
|
10325
10309
|
}
|
|
10326
10310
|
setupStdinCancellation();
|
|
10327
|
-
coreEvents.on(
|
|
10311
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10328
10312
|
coreEvents.drainBacklogs();
|
|
10329
10313
|
process.stdout.on("error", (err) => {
|
|
10330
10314
|
if (err.code === "EPIPE") {
|
|
@@ -10350,7 +10334,7 @@ async function runNonInteractive({
|
|
|
10350
10334
|
}
|
|
10351
10335
|
if (streamFormatter) {
|
|
10352
10336
|
streamFormatter.emitEvent({
|
|
10353
|
-
type:
|
|
10337
|
+
type: "init" /* INIT */,
|
|
10354
10338
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10355
10339
|
session_id: config.getSessionId(),
|
|
10356
10340
|
model: config.getModel()
|
|
@@ -10388,7 +10372,7 @@ async function runNonInteractive({
|
|
|
10388
10372
|
}
|
|
10389
10373
|
if (streamFormatter) {
|
|
10390
10374
|
streamFormatter.emitEvent({
|
|
10391
|
-
type:
|
|
10375
|
+
type: "message" /* MESSAGE */,
|
|
10392
10376
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10393
10377
|
role: "user",
|
|
10394
10378
|
content: input
|
|
@@ -10427,12 +10411,12 @@ async function runNonInteractive({
|
|
|
10427
10411
|
const metrics = uiTelemetryService.getMetrics();
|
|
10428
10412
|
const durationMs = Date.now() - startTime;
|
|
10429
10413
|
streamFormatter.emitEvent({
|
|
10430
|
-
type:
|
|
10414
|
+
type: "result" /* RESULT */,
|
|
10431
10415
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10432
10416
|
status: "success",
|
|
10433
10417
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10434
10418
|
});
|
|
10435
|
-
} else if (config.getOutputFormat() ===
|
|
10419
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10436
10420
|
const formatter = new JsonFormatter();
|
|
10437
10421
|
const stats = uiTelemetryService.getMetrics();
|
|
10438
10422
|
textOutput.write(
|
|
@@ -10525,13 +10509,13 @@ async function runNonInteractive({
|
|
|
10525
10509
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10526
10510
|
if (streamFormatter) {
|
|
10527
10511
|
streamFormatter.emitEvent({
|
|
10528
|
-
type:
|
|
10512
|
+
type: "message" /* MESSAGE */,
|
|
10529
10513
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10530
10514
|
role: "assistant",
|
|
10531
10515
|
content: output,
|
|
10532
10516
|
delta: true
|
|
10533
10517
|
});
|
|
10534
|
-
} else if (config.getOutputFormat() ===
|
|
10518
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10535
10519
|
responseText += output;
|
|
10536
10520
|
} else {
|
|
10537
10521
|
if (part.text) {
|
|
@@ -10544,13 +10528,13 @@ async function runNonInteractive({
|
|
|
10544
10528
|
break;
|
|
10545
10529
|
}
|
|
10546
10530
|
case "tool_request": {
|
|
10547
|
-
if (config.getOutputFormat() ===
|
|
10531
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10548
10532
|
preToolResponseText = responseText || preToolResponseText;
|
|
10549
10533
|
responseText = "";
|
|
10550
10534
|
}
|
|
10551
10535
|
if (streamFormatter) {
|
|
10552
10536
|
streamFormatter.emitEvent({
|
|
10553
|
-
type:
|
|
10537
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10554
10538
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10555
10539
|
tool_name: event.name,
|
|
10556
10540
|
tool_id: event.requestId,
|
|
@@ -10566,7 +10550,7 @@ async function runNonInteractive({
|
|
|
10566
10550
|
const displayText = displayContentToString(display);
|
|
10567
10551
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10568
10552
|
streamFormatter.emitEvent({
|
|
10569
|
-
type:
|
|
10553
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
10570
10554
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10571
10555
|
tool_id: event.requestId,
|
|
10572
10556
|
status: event.isError ? "error" : "success",
|
|
@@ -10581,17 +10565,17 @@ async function runNonInteractive({
|
|
|
10581
10565
|
const display = event.display?.result;
|
|
10582
10566
|
const displayText = displayContentToString(display);
|
|
10583
10567
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10584
|
-
if (event.data?.["errorType"] ===
|
|
10585
|
-
if (config.getOutputFormat() ===
|
|
10568
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
10569
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
10586
10570
|
responseText = preToolResponseText;
|
|
10587
10571
|
}
|
|
10588
10572
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10589
|
-
if (config.getOutputFormat() ===
|
|
10573
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10590
10574
|
process.stderr.write(`${stopMessage}
|
|
10591
10575
|
`);
|
|
10592
10576
|
}
|
|
10593
10577
|
}
|
|
10594
|
-
if (event.data?.["errorType"] ===
|
|
10578
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
10595
10579
|
throw new FatalToolExecutionError(
|
|
10596
10580
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10597
10581
|
);
|
|
@@ -10613,12 +10597,12 @@ async function runNonInteractive({
|
|
|
10613
10597
|
const errorCode = event._meta?.["code"];
|
|
10614
10598
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10615
10599
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
10616
|
-
if (config.getOutputFormat() ===
|
|
10600
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10617
10601
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10618
10602
|
`);
|
|
10619
10603
|
} else if (streamFormatter) {
|
|
10620
10604
|
streamFormatter.emitEvent({
|
|
10621
|
-
type:
|
|
10605
|
+
type: "error" /* ERROR */,
|
|
10622
10606
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10623
10607
|
severity: "warning",
|
|
10624
10608
|
message: stripAnsi(blockMessage)
|
|
@@ -10628,13 +10612,13 @@ async function runNonInteractive({
|
|
|
10628
10612
|
break;
|
|
10629
10613
|
}
|
|
10630
10614
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10631
|
-
if (config.getOutputFormat() ===
|
|
10615
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10632
10616
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10633
10617
|
`);
|
|
10634
10618
|
}
|
|
10635
10619
|
if (streamFormatter) {
|
|
10636
10620
|
streamFormatter.emitEvent({
|
|
10637
|
-
type:
|
|
10621
|
+
type: "error" /* ERROR */,
|
|
10638
10622
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10639
10623
|
severity,
|
|
10640
10624
|
message: stripAnsi(event.message)
|
|
@@ -10654,7 +10638,7 @@ async function runNonInteractive({
|
|
|
10654
10638
|
);
|
|
10655
10639
|
} else if (streamFormatter) {
|
|
10656
10640
|
streamFormatter.emitEvent({
|
|
10657
|
-
type:
|
|
10641
|
+
type: "error" /* ERROR */,
|
|
10658
10642
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10659
10643
|
severity: "error",
|
|
10660
10644
|
message: "Maximum session turns exceeded"
|
|
@@ -10662,7 +10646,7 @@ async function runNonInteractive({
|
|
|
10662
10646
|
}
|
|
10663
10647
|
}
|
|
10664
10648
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10665
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10649
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10666
10650
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10667
10651
|
`);
|
|
10668
10652
|
}
|
|
@@ -10692,7 +10676,7 @@ async function runNonInteractive({
|
|
|
10692
10676
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10693
10677
|
scheduler?.dispose();
|
|
10694
10678
|
consolePatcher.cleanup();
|
|
10695
|
-
coreEvents.off(
|
|
10679
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10696
10680
|
}
|
|
10697
10681
|
if (errorToHandle) {
|
|
10698
10682
|
handleError(errorToHandle, config);
|
|
@@ -10720,7 +10704,7 @@ async function runNonInteractive2(params) {
|
|
|
10720
10704
|
}
|
|
10721
10705
|
});
|
|
10722
10706
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10723
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10707
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-F7PHNBEQ.js");
|
|
10724
10708
|
setupInitialActivityLogger(config);
|
|
10725
10709
|
}
|
|
10726
10710
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10736,7 +10720,7 @@ async function runNonInteractive2(params) {
|
|
|
10736
10720
|
}
|
|
10737
10721
|
};
|
|
10738
10722
|
const startTime = Date.now();
|
|
10739
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10723
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10740
10724
|
const abortController = new AbortController();
|
|
10741
10725
|
let isAborting = false;
|
|
10742
10726
|
let cancelMessageTimer = null;
|
|
@@ -10787,13 +10771,13 @@ async function runNonInteractive2(params) {
|
|
|
10787
10771
|
let scheduler;
|
|
10788
10772
|
try {
|
|
10789
10773
|
consolePatcher.patch();
|
|
10790
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10774
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10791
10775
|
process.stderr.write(
|
|
10792
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"
|
|
10793
10777
|
);
|
|
10794
10778
|
}
|
|
10795
10779
|
setupStdinCancellation();
|
|
10796
|
-
coreEvents.on(
|
|
10780
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10797
10781
|
coreEvents.drainBacklogs();
|
|
10798
10782
|
process.stdout.on("error", (err) => {
|
|
10799
10783
|
if (err.code === "EPIPE") {
|
|
@@ -10817,7 +10801,7 @@ async function runNonInteractive2(params) {
|
|
|
10817
10801
|
}
|
|
10818
10802
|
if (streamFormatter) {
|
|
10819
10803
|
streamFormatter.emitEvent({
|
|
10820
|
-
type:
|
|
10804
|
+
type: "init" /* INIT */,
|
|
10821
10805
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10822
10806
|
session_id: config.getSessionId(),
|
|
10823
10807
|
model: config.getModel()
|
|
@@ -10855,7 +10839,7 @@ async function runNonInteractive2(params) {
|
|
|
10855
10839
|
}
|
|
10856
10840
|
if (streamFormatter) {
|
|
10857
10841
|
streamFormatter.emitEvent({
|
|
10858
|
-
type:
|
|
10842
|
+
type: "message" /* MESSAGE */,
|
|
10859
10843
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10860
10844
|
role: "user",
|
|
10861
10845
|
content: input
|
|
@@ -10883,28 +10867,28 @@ async function runNonInteractive2(params) {
|
|
|
10883
10867
|
if (abortController.signal.aborted) {
|
|
10884
10868
|
handleCancellationError(config);
|
|
10885
10869
|
}
|
|
10886
|
-
if (event.type ===
|
|
10870
|
+
if (event.type === "content" /* Content */) {
|
|
10887
10871
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10888
10872
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10889
10873
|
if (streamFormatter) {
|
|
10890
10874
|
streamFormatter.emitEvent({
|
|
10891
|
-
type:
|
|
10875
|
+
type: "message" /* MESSAGE */,
|
|
10892
10876
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10893
10877
|
role: "assistant",
|
|
10894
10878
|
content: output,
|
|
10895
10879
|
delta: true
|
|
10896
10880
|
});
|
|
10897
|
-
} else if (config.getOutputFormat() ===
|
|
10881
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10898
10882
|
responseText += output;
|
|
10899
10883
|
} else {
|
|
10900
10884
|
if (event.value) {
|
|
10901
10885
|
textOutput.write(output);
|
|
10902
10886
|
}
|
|
10903
10887
|
}
|
|
10904
|
-
} else if (event.type ===
|
|
10888
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
10905
10889
|
if (streamFormatter) {
|
|
10906
10890
|
streamFormatter.emitEvent({
|
|
10907
|
-
type:
|
|
10891
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10908
10892
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10909
10893
|
tool_name: event.value.name,
|
|
10910
10894
|
tool_id: event.value.callId,
|
|
@@ -10912,33 +10896,33 @@ async function runNonInteractive2(params) {
|
|
|
10912
10896
|
});
|
|
10913
10897
|
}
|
|
10914
10898
|
toolCallRequests.push(event.value);
|
|
10915
|
-
} else if (event.type ===
|
|
10899
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
10916
10900
|
const message = "Loop detected, stopping execution";
|
|
10917
10901
|
if (streamFormatter) {
|
|
10918
10902
|
streamFormatter.emitEvent({
|
|
10919
|
-
type:
|
|
10903
|
+
type: "error" /* ERROR */,
|
|
10920
10904
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10921
10905
|
severity: "warning",
|
|
10922
10906
|
message
|
|
10923
10907
|
});
|
|
10924
10908
|
}
|
|
10925
10909
|
warnings.push(message);
|
|
10926
|
-
} else if (event.type ===
|
|
10910
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
10927
10911
|
const message = "Maximum session turns exceeded";
|
|
10928
10912
|
if (streamFormatter) {
|
|
10929
10913
|
streamFormatter.emitEvent({
|
|
10930
|
-
type:
|
|
10914
|
+
type: "error" /* ERROR */,
|
|
10931
10915
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10932
10916
|
severity: "error",
|
|
10933
10917
|
message
|
|
10934
10918
|
});
|
|
10935
10919
|
}
|
|
10936
10920
|
warnings.push(message);
|
|
10937
|
-
} else if (event.type ===
|
|
10921
|
+
} else if (event.type === "error" /* Error */) {
|
|
10938
10922
|
throw event.value.error;
|
|
10939
|
-
} else if (event.type ===
|
|
10923
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
10940
10924
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10941
|
-
if (config.getOutputFormat() ===
|
|
10925
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10942
10926
|
process.stderr.write(`${stopMessage}
|
|
10943
10927
|
`);
|
|
10944
10928
|
}
|
|
@@ -10946,7 +10930,7 @@ async function runNonInteractive2(params) {
|
|
|
10946
10930
|
const metrics = uiTelemetryService.getMetrics();
|
|
10947
10931
|
const durationMs = Date.now() - startTime;
|
|
10948
10932
|
streamFormatter.emitEvent({
|
|
10949
|
-
type:
|
|
10933
|
+
type: "result" /* RESULT */,
|
|
10950
10934
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10951
10935
|
status: "success",
|
|
10952
10936
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10954,7 +10938,7 @@ async function runNonInteractive2(params) {
|
|
|
10954
10938
|
durationMs
|
|
10955
10939
|
)
|
|
10956
10940
|
});
|
|
10957
|
-
} else if (config.getOutputFormat() ===
|
|
10941
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10958
10942
|
const formatter = new JsonFormatter();
|
|
10959
10943
|
const stats = uiTelemetryService.getMetrics();
|
|
10960
10944
|
textOutput.write(
|
|
@@ -10970,30 +10954,30 @@ async function runNonInteractive2(params) {
|
|
|
10970
10954
|
textOutput.ensureTrailingNewline();
|
|
10971
10955
|
}
|
|
10972
10956
|
return;
|
|
10973
|
-
} else if (event.type ===
|
|
10957
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
10974
10958
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10975
|
-
if (config.getOutputFormat() ===
|
|
10959
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10976
10960
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10977
10961
|
`);
|
|
10978
10962
|
} else if (streamFormatter) {
|
|
10979
10963
|
streamFormatter.emitEvent({
|
|
10980
|
-
type:
|
|
10964
|
+
type: "error" /* ERROR */,
|
|
10981
10965
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10982
10966
|
severity: "warning",
|
|
10983
10967
|
message: stripAnsi(blockMessage)
|
|
10984
10968
|
});
|
|
10985
10969
|
}
|
|
10986
10970
|
warnings.push(blockMessage);
|
|
10987
|
-
} else if (event.type ===
|
|
10971
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
10988
10972
|
invalidStreamError = "Invalid stream: The model returned an empty response or malformed tool call.";
|
|
10989
10973
|
if (streamFormatter) {
|
|
10990
10974
|
streamFormatter.emitEvent({
|
|
10991
|
-
type:
|
|
10975
|
+
type: "error" /* ERROR */,
|
|
10992
10976
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10993
10977
|
severity: "error",
|
|
10994
10978
|
message: invalidStreamError
|
|
10995
10979
|
});
|
|
10996
|
-
} else if (config.getOutputFormat() ===
|
|
10980
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10997
10981
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
10998
10982
|
`);
|
|
10999
10983
|
}
|
|
@@ -11013,7 +10997,7 @@ async function runNonInteractive2(params) {
|
|
|
11013
10997
|
const requestInfo = completedToolCall.request;
|
|
11014
10998
|
if (streamFormatter) {
|
|
11015
10999
|
streamFormatter.emitEvent({
|
|
11016
|
-
type:
|
|
11000
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11017
11001
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11018
11002
|
tool_id: requestInfo.callId,
|
|
11019
11003
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11047,11 +11031,11 @@ async function runNonInteractive2(params) {
|
|
|
11047
11031
|
);
|
|
11048
11032
|
}
|
|
11049
11033
|
const stopExecutionTool = completedToolCalls.find(
|
|
11050
|
-
(tc) => tc.response.errorType ===
|
|
11034
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
11051
11035
|
);
|
|
11052
11036
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11053
11037
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11054
|
-
if (config.getOutputFormat() ===
|
|
11038
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11055
11039
|
process.stderr.write(`${stopMessage}
|
|
11056
11040
|
`);
|
|
11057
11041
|
}
|
|
@@ -11059,7 +11043,7 @@ async function runNonInteractive2(params) {
|
|
|
11059
11043
|
const metrics = uiTelemetryService.getMetrics();
|
|
11060
11044
|
const durationMs = Date.now() - startTime;
|
|
11061
11045
|
streamFormatter.emitEvent({
|
|
11062
|
-
type:
|
|
11046
|
+
type: "result" /* RESULT */,
|
|
11063
11047
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11064
11048
|
status: "success",
|
|
11065
11049
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11067,7 +11051,7 @@ async function runNonInteractive2(params) {
|
|
|
11067
11051
|
durationMs
|
|
11068
11052
|
)
|
|
11069
11053
|
});
|
|
11070
|
-
} else if (config.getOutputFormat() ===
|
|
11054
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11071
11055
|
const formatter = new JsonFormatter();
|
|
11072
11056
|
const stats = uiTelemetryService.getMetrics();
|
|
11073
11057
|
textOutput.write(
|
|
@@ -11090,12 +11074,12 @@ async function runNonInteractive2(params) {
|
|
|
11090
11074
|
const metrics = uiTelemetryService.getMetrics();
|
|
11091
11075
|
const durationMs = Date.now() - startTime;
|
|
11092
11076
|
streamFormatter.emitEvent({
|
|
11093
|
-
type:
|
|
11077
|
+
type: "result" /* RESULT */,
|
|
11094
11078
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11095
11079
|
status: invalidStreamError ? "error" : "success",
|
|
11096
11080
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11097
11081
|
});
|
|
11098
|
-
} else if (config.getOutputFormat() ===
|
|
11082
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11099
11083
|
const formatter = new JsonFormatter();
|
|
11100
11084
|
const stats = uiTelemetryService.getMetrics();
|
|
11101
11085
|
textOutput.write(
|
|
@@ -11119,7 +11103,7 @@ async function runNonInteractive2(params) {
|
|
|
11119
11103
|
cleanupStdinCancellation();
|
|
11120
11104
|
scheduler?.dispose();
|
|
11121
11105
|
consolePatcher.cleanup();
|
|
11122
|
-
coreEvents.off(
|
|
11106
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11123
11107
|
}
|
|
11124
11108
|
if (errorToHandle) {
|
|
11125
11109
|
handleError(errorToHandle, config);
|
|
@@ -13510,12 +13494,12 @@ function toToolCallContent(toolResult) {
|
|
|
13510
13494
|
}
|
|
13511
13495
|
var basicPermissionOptions = [
|
|
13512
13496
|
{
|
|
13513
|
-
optionId:
|
|
13497
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
13514
13498
|
name: "Allow",
|
|
13515
13499
|
kind: "allow_once"
|
|
13516
13500
|
},
|
|
13517
13501
|
{
|
|
13518
|
-
optionId:
|
|
13502
|
+
optionId: "cancel" /* Cancel */,
|
|
13519
13503
|
name: "Reject",
|
|
13520
13504
|
kind: "reject_once"
|
|
13521
13505
|
}
|
|
@@ -13527,13 +13511,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13527
13511
|
switch (confirmation.type) {
|
|
13528
13512
|
case "edit":
|
|
13529
13513
|
options.push({
|
|
13530
|
-
optionId:
|
|
13514
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13531
13515
|
name: "Allow for this session",
|
|
13532
13516
|
kind: "allow_always"
|
|
13533
13517
|
});
|
|
13534
13518
|
if (enablePermanentToolApproval) {
|
|
13535
13519
|
options.push({
|
|
13536
|
-
optionId:
|
|
13520
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13537
13521
|
name: "Allow for this file in all future sessions",
|
|
13538
13522
|
kind: "allow_always"
|
|
13539
13523
|
});
|
|
@@ -13541,13 +13525,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13541
13525
|
break;
|
|
13542
13526
|
case "exec":
|
|
13543
13527
|
options.push({
|
|
13544
|
-
optionId:
|
|
13528
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13545
13529
|
name: "Allow for this session",
|
|
13546
13530
|
kind: "allow_always"
|
|
13547
13531
|
});
|
|
13548
13532
|
if (enablePermanentToolApproval) {
|
|
13549
13533
|
options.push({
|
|
13550
|
-
optionId:
|
|
13534
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13551
13535
|
name: "Allow this command for all future sessions",
|
|
13552
13536
|
kind: "allow_always"
|
|
13553
13537
|
});
|
|
@@ -13556,19 +13540,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13556
13540
|
case "mcp":
|
|
13557
13541
|
options.push(
|
|
13558
13542
|
{
|
|
13559
|
-
optionId:
|
|
13543
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
13560
13544
|
name: "Allow all server tools for this session",
|
|
13561
13545
|
kind: "allow_always"
|
|
13562
13546
|
},
|
|
13563
13547
|
{
|
|
13564
|
-
optionId:
|
|
13548
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
13565
13549
|
name: "Allow tool for this session",
|
|
13566
13550
|
kind: "allow_always"
|
|
13567
13551
|
}
|
|
13568
13552
|
);
|
|
13569
13553
|
if (enablePermanentToolApproval) {
|
|
13570
13554
|
options.push({
|
|
13571
|
-
optionId:
|
|
13555
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13572
13556
|
name: "Allow tool for all future sessions",
|
|
13573
13557
|
kind: "allow_always"
|
|
13574
13558
|
});
|
|
@@ -13576,13 +13560,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13576
13560
|
break;
|
|
13577
13561
|
case "info":
|
|
13578
13562
|
options.push({
|
|
13579
|
-
optionId:
|
|
13563
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13580
13564
|
name: "Allow for this session",
|
|
13581
13565
|
kind: "allow_always"
|
|
13582
13566
|
});
|
|
13583
13567
|
if (enablePermanentToolApproval) {
|
|
13584
13568
|
options.push({
|
|
13585
|
-
optionId:
|
|
13569
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13586
13570
|
name: "Allow for all future sessions",
|
|
13587
13571
|
kind: "allow_always"
|
|
13588
13572
|
});
|
|
@@ -13614,21 +13598,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13614
13598
|
}
|
|
13615
13599
|
function toAcpToolKind(kind) {
|
|
13616
13600
|
switch (kind) {
|
|
13617
|
-
case
|
|
13618
|
-
case
|
|
13619
|
-
case
|
|
13620
|
-
case
|
|
13621
|
-
case
|
|
13622
|
-
case
|
|
13623
|
-
case
|
|
13624
|
-
case
|
|
13625
|
-
case
|
|
13626
|
-
case
|
|
13601
|
+
case "read" /* Read */:
|
|
13602
|
+
case "edit" /* Edit */:
|
|
13603
|
+
case "execute" /* Execute */:
|
|
13604
|
+
case "search" /* Search */:
|
|
13605
|
+
case "delete" /* Delete */:
|
|
13606
|
+
case "move" /* Move */:
|
|
13607
|
+
case "think" /* Think */:
|
|
13608
|
+
case "fetch" /* Fetch */:
|
|
13609
|
+
case "switch_mode" /* SwitchMode */:
|
|
13610
|
+
case "other" /* Other */:
|
|
13627
13611
|
return kind;
|
|
13628
|
-
case
|
|
13612
|
+
case "agent" /* Agent */:
|
|
13629
13613
|
return "think";
|
|
13630
|
-
case
|
|
13631
|
-
case
|
|
13614
|
+
case "plan" /* Plan */:
|
|
13615
|
+
case "communicate" /* Communicate */:
|
|
13632
13616
|
default:
|
|
13633
13617
|
return "other";
|
|
13634
13618
|
}
|
|
@@ -13636,24 +13620,24 @@ function toAcpToolKind(kind) {
|
|
|
13636
13620
|
function buildAvailableModes(isPlanEnabled) {
|
|
13637
13621
|
const modes = [
|
|
13638
13622
|
{
|
|
13639
|
-
id:
|
|
13623
|
+
id: "default" /* DEFAULT */,
|
|
13640
13624
|
name: "Default",
|
|
13641
13625
|
description: "Prompts for approval"
|
|
13642
13626
|
},
|
|
13643
13627
|
{
|
|
13644
|
-
id:
|
|
13628
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
13645
13629
|
name: "Auto Edit",
|
|
13646
13630
|
description: "Auto-approves edit tools"
|
|
13647
13631
|
},
|
|
13648
13632
|
{
|
|
13649
|
-
id:
|
|
13633
|
+
id: "yolo" /* YOLO */,
|
|
13650
13634
|
name: "YOLO",
|
|
13651
13635
|
description: "Auto-approves all tools"
|
|
13652
13636
|
}
|
|
13653
13637
|
];
|
|
13654
13638
|
if (isPlanEnabled) {
|
|
13655
13639
|
modes.push({
|
|
13656
|
-
id:
|
|
13640
|
+
id: "plan" /* PLAN */,
|
|
13657
13641
|
name: "Plan",
|
|
13658
13642
|
description: "Read-only mode"
|
|
13659
13643
|
});
|
|
@@ -13665,7 +13649,7 @@ function buildAvailableModels(config, settings) {
|
|
|
13665
13649
|
const shouldShowPreviewModels = config.getHasAccessToPreviewModel();
|
|
13666
13650
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13667
13651
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13668
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13652
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
13669
13653
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13670
13654
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13671
13655
|
useGemini3_1: useGemini31,
|
|
@@ -13749,11 +13733,11 @@ var Session = class {
|
|
|
13749
13733
|
this.connection = connection;
|
|
13750
13734
|
this.settings = settings;
|
|
13751
13735
|
coreEvents.on(
|
|
13752
|
-
|
|
13736
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13753
13737
|
this.handleApprovalModeChanged
|
|
13754
13738
|
);
|
|
13755
13739
|
this.context.config.getMessageBus()?.subscribe(
|
|
13756
|
-
|
|
13740
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
13757
13741
|
this.handleToolConfirmationRequest,
|
|
13758
13742
|
{ signal: this.disposeController.signal }
|
|
13759
13743
|
);
|
|
@@ -13777,7 +13761,7 @@ var Session = class {
|
|
|
13777
13761
|
"Policy engine missing. Denying tool confirmation request."
|
|
13778
13762
|
);
|
|
13779
13763
|
await messageBus.publish({
|
|
13780
|
-
type:
|
|
13764
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13781
13765
|
correlationId: request.correlationId,
|
|
13782
13766
|
confirmed: false,
|
|
13783
13767
|
requiresUserConfirmation: false
|
|
@@ -13790,7 +13774,7 @@ var Session = class {
|
|
|
13790
13774
|
"Tool confirmation request missing tool name. Denying."
|
|
13791
13775
|
);
|
|
13792
13776
|
await messageBus.publish({
|
|
13793
|
-
type:
|
|
13777
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13794
13778
|
correlationId: request.correlationId,
|
|
13795
13779
|
confirmed: false,
|
|
13796
13780
|
requiresUserConfirmation: false
|
|
@@ -13803,7 +13787,7 @@ var Session = class {
|
|
|
13803
13787
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
13804
13788
|
);
|
|
13805
13789
|
await messageBus.publish({
|
|
13806
|
-
type:
|
|
13790
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13807
13791
|
correlationId: request.correlationId,
|
|
13808
13792
|
confirmed: false,
|
|
13809
13793
|
requiresUserConfirmation: false
|
|
@@ -13819,15 +13803,15 @@ var Session = class {
|
|
|
13819
13803
|
request.subagent
|
|
13820
13804
|
);
|
|
13821
13805
|
await messageBus.publish({
|
|
13822
|
-
type:
|
|
13806
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13823
13807
|
correlationId: request.correlationId,
|
|
13824
|
-
confirmed: result.decision ===
|
|
13825
|
-
requiresUserConfirmation: result.decision ===
|
|
13808
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
13809
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
13826
13810
|
});
|
|
13827
13811
|
} catch (error) {
|
|
13828
13812
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
13829
13813
|
await this.context.config.getMessageBus()?.publish({
|
|
13830
|
-
type:
|
|
13814
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13831
13815
|
correlationId: request.correlationId,
|
|
13832
13816
|
confirmed: false,
|
|
13833
13817
|
requiresUserConfirmation: false
|
|
@@ -13847,7 +13831,7 @@ var Session = class {
|
|
|
13847
13831
|
};
|
|
13848
13832
|
dispose() {
|
|
13849
13833
|
coreEvents.off(
|
|
13850
|
-
|
|
13834
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13851
13835
|
this.handleApprovalModeChanged
|
|
13852
13836
|
);
|
|
13853
13837
|
this.disposeController.abort();
|
|
@@ -13936,7 +13920,7 @@ ${thought.description}`;
|
|
|
13936
13920
|
await this.sendUpdate({
|
|
13937
13921
|
sessionUpdate: "tool_call",
|
|
13938
13922
|
toolCallId: toolCall.id,
|
|
13939
|
-
status: toolCall.status ===
|
|
13923
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
13940
13924
|
title: toolCall.displayName || toolCall.name,
|
|
13941
13925
|
content: toolCallContent,
|
|
13942
13926
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14028,7 +14012,7 @@ ${thought.description}`;
|
|
|
14028
14012
|
return { stopReason: "cancelled" };
|
|
14029
14013
|
}
|
|
14030
14014
|
switch (event.type) {
|
|
14031
|
-
case
|
|
14015
|
+
case "content" /* Content */: {
|
|
14032
14016
|
const content = {
|
|
14033
14017
|
type: "text",
|
|
14034
14018
|
text: event.value
|
|
@@ -14039,7 +14023,7 @@ ${thought.description}`;
|
|
|
14039
14023
|
});
|
|
14040
14024
|
break;
|
|
14041
14025
|
}
|
|
14042
|
-
case
|
|
14026
|
+
case "thought" /* Thought */: {
|
|
14043
14027
|
const thoughtText = `**${event.value.subject}**
|
|
14044
14028
|
${event.value.description}`;
|
|
14045
14029
|
await this.sendUpdate({
|
|
@@ -14048,10 +14032,10 @@ ${event.value.description}`;
|
|
|
14048
14032
|
});
|
|
14049
14033
|
break;
|
|
14050
14034
|
}
|
|
14051
|
-
case
|
|
14035
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
14052
14036
|
toolCallRequests.push(event.value);
|
|
14053
14037
|
break;
|
|
14054
|
-
case
|
|
14038
|
+
case "finished" /* Finished */: {
|
|
14055
14039
|
const usage2 = event.value.usageMetadata;
|
|
14056
14040
|
if (usage2) {
|
|
14057
14041
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14059,19 +14043,19 @@ ${event.value.description}`;
|
|
|
14059
14043
|
}
|
|
14060
14044
|
break;
|
|
14061
14045
|
}
|
|
14062
|
-
case
|
|
14046
|
+
case "model_info" /* ModelInfo */:
|
|
14063
14047
|
turnModelId = event.value;
|
|
14064
14048
|
break;
|
|
14065
|
-
case
|
|
14049
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
14066
14050
|
stopReason = "max_turn_requests";
|
|
14067
14051
|
break;
|
|
14068
|
-
case
|
|
14052
|
+
case "loop_detected" /* LoopDetected */:
|
|
14069
14053
|
stopReason = "max_turn_requests";
|
|
14070
14054
|
break;
|
|
14071
|
-
case
|
|
14055
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
14072
14056
|
stopReason = "max_tokens";
|
|
14073
14057
|
break;
|
|
14074
|
-
case
|
|
14058
|
+
case "error" /* Error */: {
|
|
14075
14059
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14076
14060
|
event.value.error
|
|
14077
14061
|
);
|
|
@@ -14299,7 +14283,7 @@ ${event.value.description}`;
|
|
|
14299
14283
|
const output = RequestPermissionResponseSchema.parse(
|
|
14300
14284
|
await this.connection.requestPermission(params)
|
|
14301
14285
|
);
|
|
14302
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14286
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14303
14287
|
await confirmationDetails.onConfirm(outcome);
|
|
14304
14288
|
await updatePolicy(
|
|
14305
14289
|
tool,
|
|
@@ -14310,16 +14294,16 @@ ${event.value.description}`;
|
|
|
14310
14294
|
invocation
|
|
14311
14295
|
);
|
|
14312
14296
|
switch (outcome) {
|
|
14313
|
-
case
|
|
14297
|
+
case "cancel" /* Cancel */:
|
|
14314
14298
|
return errorResponse(
|
|
14315
14299
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14316
14300
|
);
|
|
14317
|
-
case
|
|
14318
|
-
case
|
|
14319
|
-
case
|
|
14320
|
-
case
|
|
14321
|
-
case
|
|
14322
|
-
case
|
|
14301
|
+
case "proceed_once" /* ProceedOnce */:
|
|
14302
|
+
case "proceed_always" /* ProceedAlways */:
|
|
14303
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
14304
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
14305
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
14306
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
14323
14307
|
break;
|
|
14324
14308
|
default: {
|
|
14325
14309
|
const resultOutcome = outcome;
|
|
@@ -14373,7 +14357,7 @@ ${event.value.description}`;
|
|
|
14373
14357
|
);
|
|
14374
14358
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14375
14359
|
{
|
|
14376
|
-
status:
|
|
14360
|
+
status: "success" /* Success */,
|
|
14377
14361
|
request: {
|
|
14378
14362
|
callId,
|
|
14379
14363
|
name: fc.name,
|
|
@@ -14418,7 +14402,7 @@ ${event.value.description}`;
|
|
|
14418
14402
|
});
|
|
14419
14403
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14420
14404
|
{
|
|
14421
|
-
status:
|
|
14405
|
+
status: "error" /* Error */,
|
|
14422
14406
|
request: {
|
|
14423
14407
|
callId,
|
|
14424
14408
|
name: fc.name,
|
|
@@ -14546,12 +14530,12 @@ ${event.value.description}`;
|
|
|
14546
14530
|
sessionId: this.id,
|
|
14547
14531
|
options: [
|
|
14548
14532
|
{
|
|
14549
|
-
optionId:
|
|
14533
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14550
14534
|
name: "Allow once",
|
|
14551
14535
|
kind: "allow_once"
|
|
14552
14536
|
},
|
|
14553
14537
|
{
|
|
14554
|
-
optionId:
|
|
14538
|
+
optionId: "cancel" /* Cancel */,
|
|
14555
14539
|
name: "Deny",
|
|
14556
14540
|
kind: "reject_once"
|
|
14557
14541
|
}
|
|
@@ -14576,8 +14560,8 @@ ${event.value.description}`;
|
|
|
14576
14560
|
const output = RequestPermissionResponseSchema.parse(
|
|
14577
14561
|
await this.connection.requestPermission(params)
|
|
14578
14562
|
);
|
|
14579
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14580
|
-
if (outcome ===
|
|
14563
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14564
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
14581
14565
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14582
14566
|
validationError = null;
|
|
14583
14567
|
} else {
|
|
@@ -15014,7 +14998,7 @@ var AcpSessionManager = class {
|
|
|
15014
14998
|
mcpServers,
|
|
15015
14999
|
loadedSettings
|
|
15016
15000
|
);
|
|
15017
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15001
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
15018
15002
|
let isAuthenticated = false;
|
|
15019
15003
|
let authErrorMessage = "";
|
|
15020
15004
|
try {
|
|
@@ -15026,7 +15010,7 @@ var AcpSessionManager = class {
|
|
|
15026
15010
|
);
|
|
15027
15011
|
isAuthenticated = true;
|
|
15028
15012
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
15029
|
-
if (authType ===
|
|
15013
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
15030
15014
|
isAuthenticated = false;
|
|
15031
15015
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
15032
15016
|
}
|
|
@@ -15135,7 +15119,7 @@ var AcpSessionManager = class {
|
|
|
15135
15119
|
return response;
|
|
15136
15120
|
}
|
|
15137
15121
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
15138
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15122
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
15139
15123
|
if (!selectedAuthType) {
|
|
15140
15124
|
throw RequestError.authRequired();
|
|
15141
15125
|
}
|
|
@@ -15236,12 +15220,12 @@ var GeminiAgent = class {
|
|
|
15236
15220
|
}
|
|
15237
15221
|
const authMethods = [
|
|
15238
15222
|
{
|
|
15239
|
-
id:
|
|
15223
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
15240
15224
|
name: "Log in with Google",
|
|
15241
15225
|
description: "Log in with your Google account"
|
|
15242
15226
|
},
|
|
15243
15227
|
{
|
|
15244
|
-
id:
|
|
15228
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
15245
15229
|
name: "Gemini API key",
|
|
15246
15230
|
description: "Use an API key with Gemini Developer API",
|
|
15247
15231
|
_meta: {
|
|
@@ -15251,12 +15235,12 @@ var GeminiAgent = class {
|
|
|
15251
15235
|
}
|
|
15252
15236
|
},
|
|
15253
15237
|
{
|
|
15254
|
-
id:
|
|
15238
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
15255
15239
|
name: "Vertex AI",
|
|
15256
15240
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15257
15241
|
},
|
|
15258
15242
|
{
|
|
15259
|
-
id:
|
|
15243
|
+
id: "gateway" /* GATEWAY */,
|
|
15260
15244
|
name: "AI API Gateway",
|
|
15261
15245
|
description: "Use a custom AI API Gateway",
|
|
15262
15246
|
_meta: {
|
|
@@ -15429,7 +15413,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15429
15413
|
}
|
|
15430
15414
|
return authType;
|
|
15431
15415
|
} catch (error) {
|
|
15432
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15416
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
15433
15417
|
handleError(
|
|
15434
15418
|
error instanceof Error ? error : new Error(String(error)),
|
|
15435
15419
|
nonInteractiveConfig,
|
|
@@ -15624,10 +15608,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15624
15608
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15625
15609
|
}
|
|
15626
15610
|
start() {
|
|
15627
|
-
coreEvents.on(
|
|
15611
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15628
15612
|
}
|
|
15629
15613
|
stop() {
|
|
15630
|
-
coreEvents.off(
|
|
15614
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15631
15615
|
if (this.flushTimeout) {
|
|
15632
15616
|
clearTimeout(this.flushTimeout);
|
|
15633
15617
|
this.flushTimeout = null;
|
|
@@ -15908,7 +15892,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
15908
15892
|
}
|
|
15909
15893
|
}
|
|
15910
15894
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15911
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15895
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-ZJXV4DW7.js");
|
|
15912
15896
|
await doStartUI(
|
|
15913
15897
|
config,
|
|
15914
15898
|
settings,
|
|
@@ -16011,12 +15995,12 @@ async function main() {
|
|
|
16011
15995
|
dns.setDefaultResultOrder(
|
|
16012
15996
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
16013
15997
|
);
|
|
16014
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
15998
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
16015
15999
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
16016
16000
|
settings.setValue(
|
|
16017
16001
|
"User" /* User */,
|
|
16018
16002
|
"security.auth.selectedType",
|
|
16019
|
-
|
|
16003
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
16020
16004
|
);
|
|
16021
16005
|
}
|
|
16022
16006
|
}
|
|
@@ -16117,7 +16101,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16117
16101
|
await config.storage.initialize();
|
|
16118
16102
|
adminControlsListner.setConfig(config);
|
|
16119
16103
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
16120
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
16104
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-F7PHNBEQ.js");
|
|
16121
16105
|
setupInitialActivityLogger(config);
|
|
16122
16106
|
}
|
|
16123
16107
|
registerTelemetryConfig(config);
|
|
@@ -16125,7 +16109,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16125
16109
|
const messageBus = config.getMessageBus();
|
|
16126
16110
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
16127
16111
|
registerCleanup(async () => {
|
|
16128
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
16112
|
+
await config.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
16129
16113
|
});
|
|
16130
16114
|
if (!config.getAcpMode()) {
|
|
16131
16115
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16176,7 +16160,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16176
16160
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16177
16161
|
const initializationResult = await initializeApp(config, settings);
|
|
16178
16162
|
initAppHandle?.end();
|
|
16179
|
-
import("./liteRtServerManager-
|
|
16163
|
+
import("./liteRtServerManager-RNNHEQJI.js").then(({ LiteRtServerManager }) => {
|
|
16180
16164
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16181
16165
|
if (!mergedGemma) return;
|
|
16182
16166
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16186,7 +16170,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16186
16170
|
autoStartServer: userGemma?.autoStartServer
|
|
16187
16171
|
});
|
|
16188
16172
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16189
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16173
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
16190
16174
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16191
16175
|
}
|
|
16192
16176
|
if (config.getAcpMode()) {
|
|
@@ -16202,7 +16186,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16202
16186
|
...rawStartupWarnings.map((message) => ({
|
|
16203
16187
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16204
16188
|
message,
|
|
16205
|
-
priority:
|
|
16189
|
+
priority: "high" /* High */
|
|
16206
16190
|
})),
|
|
16207
16191
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16208
16192
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16239,7 +16223,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16239
16223
|
${input}` : stdinData;
|
|
16240
16224
|
}
|
|
16241
16225
|
}
|
|
16242
|
-
const sessionStartSource = resumedSessionData ?
|
|
16226
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
16243
16227
|
const hookSystem = config?.getHookSystem();
|
|
16244
16228
|
if (hookSystem) {
|
|
16245
16229
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16296,8 +16280,8 @@ ${input}` : wrappedContext;
|
|
|
16296
16280
|
}
|
|
16297
16281
|
}
|
|
16298
16282
|
function initializeOutputListenersAndFlush(config) {
|
|
16299
|
-
if (coreEvents.listenerCount(
|
|
16300
|
-
coreEvents.on(
|
|
16283
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
16284
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
16301
16285
|
if (payload.isStderr) {
|
|
16302
16286
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16303
16287
|
} else {
|
|
@@ -16305,8 +16289,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16305
16289
|
}
|
|
16306
16290
|
});
|
|
16307
16291
|
}
|
|
16308
|
-
if (coreEvents.listenerCount(
|
|
16309
|
-
coreEvents.on(
|
|
16292
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
16293
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
16310
16294
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16311
16295
|
writeToStderr(payload.content + "\n");
|
|
16312
16296
|
} else {
|
|
@@ -16314,8 +16298,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16314
16298
|
}
|
|
16315
16299
|
});
|
|
16316
16300
|
}
|
|
16317
|
-
if (coreEvents.listenerCount(
|
|
16318
|
-
coreEvents.on(
|
|
16301
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
16302
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
16319
16303
|
writeToStderr(payload.message + "\n");
|
|
16320
16304
|
});
|
|
16321
16305
|
}
|
|
@@ -16323,7 +16307,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16323
16307
|
const forceToStderr = outputFormat === "json";
|
|
16324
16308
|
coreEvents.drainBacklogs(
|
|
16325
16309
|
(event, args) => {
|
|
16326
|
-
if (forceToStderr && event ===
|
|
16310
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
16327
16311
|
const payload = args[0];
|
|
16328
16312
|
if (!payload.isStderr) {
|
|
16329
16313
|
return {
|