@google/gemini-cli 0.61.0-preview.0 → 0.61.0-preview.1
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-YJFCJUWN.js → chunk-34PFYALD.js} +1 -1
- package/bundle/{chunk-3KWHN3A7.js → chunk-4D7PRDBS.js} +1 -1
- package/bundle/{chunk-ZJHBR7W3.js → chunk-4YQFFXRN.js} +1 -1
- package/bundle/{chunk-OZG5CLDY.js → chunk-7HAUMOMS.js} +7 -7
- package/bundle/{chunk-FIYKTSCR.js → chunk-BFB2YEJY.js} +1 -1
- package/bundle/{chunk-AIMNGITH.js → chunk-BHKACUMI.js} +3 -3
- package/bundle/{chunk-WFZMFTEE.js → chunk-EM2O5AOZ.js} +3 -3
- package/bundle/{chunk-HGJ3LRCZ.js → chunk-EUZJSBKR.js} +1 -1
- package/bundle/{chunk-DO6WSZ5A.js → chunk-FSZD7V6N.js} +2 -2
- package/bundle/{chunk-DOJZLPDE.js → chunk-GOOJJ7ZQ.js} +1 -1
- package/bundle/{chunk-LDL5PSV7.js → chunk-H6SLDOAI.js} +2 -2
- package/bundle/{chunk-ACTC6X24.js → chunk-HDPU5WOJ.js} +291 -134
- package/bundle/{chunk-4WJNJ3DK.js → chunk-JKUZ4FYJ.js} +1 -1
- package/bundle/{chunk-ZOKIJ2CA.js → chunk-KXVODVLE.js} +67 -54
- package/bundle/{chunk-HQQJ2XNS.js → chunk-LZGP7KFI.js} +17 -2
- package/bundle/{chunk-UUSSUQWL.js → chunk-MNBKYFEY.js} +9 -8
- package/bundle/{chunk-XL4BRDNV.js → chunk-MXQQJJNZ.js} +7 -7
- package/bundle/{chunk-OANXWSAG.js → chunk-NQXTLK5U.js} +8027 -14705
- package/bundle/chunk-NXDIRTLT.js +512 -0
- package/bundle/{chunk-GLGFO33Y.js → chunk-O4KOWLVM.js} +17 -2
- package/bundle/chunk-OO7JC2QX.js +399635 -0
- package/bundle/{chunk-UCLFGIUA.js → chunk-OTWH6H2T.js} +2 -2
- package/bundle/{chunk-BCGPZKAR.js → chunk-PBNOO4UX.js} +1 -1
- package/bundle/{chunk-6HVPDYWM.js → chunk-SABJGE2G.js} +3 -3
- package/bundle/chunk-TFQNPQHU.js +154 -0
- package/bundle/{chunk-KUWKDEHW.js → chunk-UEKG6P2N.js} +24 -6
- package/bundle/chunk-UST2ZL7P.js +1571 -0
- package/bundle/chunk-VSZD56FP.js +102678 -0
- package/bundle/{chunk-FH2AJT7C.js → chunk-X63OLHR4.js} +325 -136
- package/bundle/chunk-YD7YFB3H.js +398 -0
- package/bundle/chunk-ZAUQFML4.js +118 -0
- package/bundle/chunk-ZXK7SZMG.js +17368 -0
- package/bundle/{cleanup-AM5TUWBB.js → cleanup-DGDWVDXX.js} +2 -2
- package/bundle/{cleanup-FLPPBDLV.js → cleanup-ILJI4AEW.js} +2 -2
- package/bundle/{cleanup-KI735Y45.js → cleanup-QW4EQ3QR.js} +2 -2
- package/bundle/cleanup-R6YFTONK.js +32 -0
- package/bundle/{core-R7CF7CQD.js → core-HFCJBVEU.js} +17 -1
- package/bundle/{devtoolsService-MA34M6Q7.js → devtoolsService-KXJDH42U.js} +2 -2
- package/bundle/{devtoolsService-UUGXHVTK.js → devtoolsService-LWSF6JIT.js} +2 -2
- package/bundle/{devtoolsService-WOA7VJLA.js → devtoolsService-N3A5BSJN.js} +4 -3
- package/bundle/devtoolsService-N4LL6WGD.js +4359 -0
- package/bundle/{dist-VH7RJCTA.js → dist-2BSGBE32.js} +17 -1
- package/bundle/{core-F6IWXMFD.js → dist-6YQ35ICZ.js} +17 -1
- package/bundle/dist-C4IKSTQN.js +2232 -0
- package/bundle/docs/reference/configuration.md +88 -25
- package/bundle/{gemini-SRSLV7D2.js → gemini-5UNXMZT3.js} +219 -201
- package/bundle/gemini-ATQ3WGVL.js +17764 -0
- package/bundle/{gemini-NLU2EPRF.js → gemini-G7D5KPQ2.js} +18 -16
- package/bundle/{gemini-N24ID3HC.js → gemini-RWMUQAJ6.js} +18 -16
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-SOMGNC7U.js → interactiveCli-EAB7PSHJ.js} +19 -14
- package/bundle/{interactiveCli-DDJZ4B26.js → interactiveCli-JYJNFC5D.js} +326 -302
- package/bundle/interactiveCli-KQPTYHND.js +35029 -0
- package/bundle/{interactiveCli-PNXXOFIE.js → interactiveCli-WC6IXMOE.js} +19 -14
- package/bundle/{liteRtServerManager-HDIBGLHN.js → liteRtServerManager-27LLIZ3H.js} +4 -4
- package/bundle/{liteRtServerManager-XEOODEAA.js → liteRtServerManager-HB6JSWYM.js} +4 -4
- package/bundle/{liteRtServerManager-GW22Q7F4.js → liteRtServerManager-NSPOA7KV.js} +4 -4
- package/bundle/liteRtServerManager-WXCFUD52.js +65 -0
- package/bundle/{oauth2-provider-ZC45IIOS.js → oauth2-provider-5CXK7KFQ.js} +1 -1
- package/bundle/{oauth2-provider-SADAKLZ2.js → oauth2-provider-FYIOQREN.js} +1 -1
- package/bundle/{oauth2-provider-347DWYC5.js → oauth2-provider-N7JBWITO.js} +38 -72
- package/bundle/oauth2-provider-Z7WSYKBF.js +235 -0
- package/bundle/{start-IVH46CBG.js → start-4CI64D6Q.js} +6 -6
- package/bundle/{start-PRP35I6V.js → start-MHS6EQUA.js} +6 -6
- package/bundle/{start-H7F3LFFN.js → start-OO24SR5D.js} +6 -6
- package/bundle/start-WRVCTB7Z.js +18 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BHKACUMI.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
updateExtension,
|
|
47
47
|
validateAuthMethod,
|
|
48
48
|
validateContextFilePath
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-KXVODVLE.js";
|
|
50
50
|
import {
|
|
51
51
|
exitCli,
|
|
52
52
|
require_source
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-BFB2YEJY.js";
|
|
54
54
|
import {
|
|
55
55
|
appEvents
|
|
56
56
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -88,11 +88,11 @@ import {
|
|
|
88
88
|
resolveGemmaConfig,
|
|
89
89
|
saveModelChange,
|
|
90
90
|
stripAnsi
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-UEKG6P2N.js";
|
|
92
92
|
import {
|
|
93
93
|
RELAUNCH_EXIT_CODE
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import "./chunk-
|
|
94
|
+
} from "./chunk-FSZD7V6N.js";
|
|
95
|
+
import "./chunk-34PFYALD.js";
|
|
96
96
|
import {
|
|
97
97
|
cleanupCheckpoints,
|
|
98
98
|
registerCleanup,
|
|
@@ -101,12 +101,15 @@ import {
|
|
|
101
101
|
runExitCleanup,
|
|
102
102
|
runSyncCleanup,
|
|
103
103
|
setupSignalHandlers
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-GOOJJ7ZQ.js";
|
|
105
105
|
import {
|
|
106
106
|
ASK_USER_TOOL_NAME,
|
|
107
|
+
ApprovalMode,
|
|
107
108
|
AuthType,
|
|
108
109
|
Client,
|
|
109
110
|
Config,
|
|
111
|
+
CoreEvent,
|
|
112
|
+
CoreToolCallStatus,
|
|
110
113
|
DEFAULT_CONTEXT_FILENAME,
|
|
111
114
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
112
115
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -128,19 +131,27 @@ import {
|
|
|
128
131
|
FolderTrustDiscoveryService,
|
|
129
132
|
GEMINI_DIR,
|
|
130
133
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
134
|
+
GeminiEventType,
|
|
131
135
|
IdeClient,
|
|
136
|
+
IntegrityStatus,
|
|
132
137
|
InvalidStreamError,
|
|
133
138
|
JsonFormatter,
|
|
139
|
+
JsonStreamEventType,
|
|
140
|
+
Kind,
|
|
134
141
|
LegacyAgentSession,
|
|
135
142
|
Logger,
|
|
136
143
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
137
144
|
MCPServerConfig,
|
|
145
|
+
MCPServerStatus,
|
|
146
|
+
MessageBusType,
|
|
138
147
|
OTHER_BLOCKED_MESSAGE,
|
|
148
|
+
OutputFormat,
|
|
139
149
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
140
150
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
141
151
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
142
152
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
143
153
|
PREVIEW_GEMINI_MODEL,
|
|
154
|
+
PolicyDecision,
|
|
144
155
|
PolicyIntegrityManager,
|
|
145
156
|
RECITATION_BLOCKED_MESSAGE,
|
|
146
157
|
REFERENCE_CONTENT_START,
|
|
@@ -148,6 +159,8 @@ import {
|
|
|
148
159
|
ReadManyFilesTool,
|
|
149
160
|
SAFETY_BLOCKED_MESSAGE,
|
|
150
161
|
Scheduler,
|
|
162
|
+
SessionEndReason,
|
|
163
|
+
SessionStartSource,
|
|
151
164
|
ShellExecutionService,
|
|
152
165
|
SimpleExtensionLoader,
|
|
153
166
|
Storage,
|
|
@@ -156,10 +169,13 @@ import {
|
|
|
156
169
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
157
170
|
ToolCallEvent,
|
|
158
171
|
ToolConfirmationOutcome,
|
|
172
|
+
ToolErrorType,
|
|
173
|
+
TrustLevel,
|
|
159
174
|
UserAccountManager,
|
|
160
175
|
UserPromptEvent,
|
|
161
176
|
ValidationCancelledError,
|
|
162
177
|
ValidationRequiredError,
|
|
178
|
+
WarningPriority,
|
|
163
179
|
applyAdminAllowlist,
|
|
164
180
|
applyRequiredServers,
|
|
165
181
|
clearCachedCredentialFile,
|
|
@@ -239,7 +255,7 @@ import {
|
|
|
239
255
|
updatePolicy,
|
|
240
256
|
writeToStderr,
|
|
241
257
|
writeToStdout
|
|
242
|
-
} from "./chunk-
|
|
258
|
+
} from "./chunk-NQXTLK5U.js";
|
|
243
259
|
import "./chunk-664ZODQF.js";
|
|
244
260
|
import "./chunk-IUUIT4SU.js";
|
|
245
261
|
import "./chunk-TUDYL3X4.js";
|
|
@@ -5369,7 +5385,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5369
5385
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5370
5386
|
const isStdio = !!config.command;
|
|
5371
5387
|
if (isStdio && !isTrusted) {
|
|
5372
|
-
return
|
|
5388
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5373
5389
|
}
|
|
5374
5390
|
const client = new Client({
|
|
5375
5391
|
name: "mcp-test-client",
|
|
@@ -5405,7 +5421,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5405
5421
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5406
5422
|
} catch {
|
|
5407
5423
|
await client.close();
|
|
5408
|
-
return
|
|
5424
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5409
5425
|
}
|
|
5410
5426
|
try {
|
|
5411
5427
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5419,10 +5435,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5419
5435
|
);
|
|
5420
5436
|
}
|
|
5421
5437
|
await client.close();
|
|
5422
|
-
return
|
|
5438
|
+
return MCPServerStatus.CONNECTED;
|
|
5423
5439
|
} catch {
|
|
5424
5440
|
await transport.close();
|
|
5425
|
-
return
|
|
5441
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5426
5442
|
}
|
|
5427
5443
|
}
|
|
5428
5444
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5435,12 +5451,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5435
5451
|
});
|
|
5436
5452
|
if (!loadResult.allowed) {
|
|
5437
5453
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5438
|
-
return
|
|
5454
|
+
return MCPServerStatus.BLOCKED;
|
|
5439
5455
|
}
|
|
5440
|
-
return
|
|
5456
|
+
return MCPServerStatus.DISABLED;
|
|
5441
5457
|
}
|
|
5442
5458
|
if (!isTrusted) {
|
|
5443
|
-
return
|
|
5459
|
+
return MCPServerStatus.DISABLED;
|
|
5444
5460
|
}
|
|
5445
5461
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5446
5462
|
}
|
|
@@ -5486,23 +5502,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5486
5502
|
let statusIndicator = "";
|
|
5487
5503
|
let statusText = "";
|
|
5488
5504
|
switch (status) {
|
|
5489
|
-
case
|
|
5505
|
+
case MCPServerStatus.CONNECTED:
|
|
5490
5506
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5491
5507
|
statusText = "Connected";
|
|
5492
5508
|
break;
|
|
5493
|
-
case
|
|
5509
|
+
case MCPServerStatus.CONNECTING:
|
|
5494
5510
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5495
5511
|
statusText = "Connecting";
|
|
5496
5512
|
break;
|
|
5497
|
-
case
|
|
5513
|
+
case MCPServerStatus.BLOCKED:
|
|
5498
5514
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5499
5515
|
statusText = "Blocked";
|
|
5500
5516
|
break;
|
|
5501
|
-
case
|
|
5517
|
+
case MCPServerStatus.DISABLED:
|
|
5502
5518
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5503
5519
|
statusText = "Disabled";
|
|
5504
5520
|
break;
|
|
5505
|
-
case
|
|
5521
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5506
5522
|
default:
|
|
5507
5523
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5508
5524
|
statusText = "Disconnected";
|
|
@@ -5788,7 +5804,7 @@ async function handleInstall(args) {
|
|
|
5788
5804
|
);
|
|
5789
5805
|
if (confirmed) {
|
|
5790
5806
|
const trustedFolders = loadTrustedFolders();
|
|
5791
|
-
await trustedFolders.setValue(realPath,
|
|
5807
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5792
5808
|
} else {
|
|
5793
5809
|
throw new Error(
|
|
5794
5810
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7839,7 +7855,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7839
7855
|
}
|
|
7840
7856
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7841
7857
|
const packageJson = await getPackageJson(__dirname3);
|
|
7842
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.61.0-
|
|
7858
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.61.0-preview.1" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7843
7859
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7844
7860
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7845
7861
|
}
|
|
@@ -7898,9 +7914,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7898
7914
|
cwd,
|
|
7899
7915
|
potentialWorkspacePoliciesDir
|
|
7900
7916
|
);
|
|
7901
|
-
if (integrityResult.status ===
|
|
7917
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
7902
7918
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7903
|
-
} else if (integrityResult.status ===
|
|
7919
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
7904
7920
|
workspacePoliciesDir = void 0;
|
|
7905
7921
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7906
7922
|
policyUpdateConfirmationRequest = {
|
|
@@ -8328,23 +8344,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8328
8344
|
if (rawApprovalMode) {
|
|
8329
8345
|
switch (rawApprovalMode) {
|
|
8330
8346
|
case "yolo":
|
|
8331
|
-
approvalMode =
|
|
8347
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8332
8348
|
break;
|
|
8333
8349
|
case "auto_edit":
|
|
8334
|
-
approvalMode =
|
|
8350
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8335
8351
|
break;
|
|
8336
8352
|
case "plan":
|
|
8337
8353
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8338
8354
|
debugLogger.warn(
|
|
8339
8355
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8340
8356
|
);
|
|
8341
|
-
approvalMode =
|
|
8357
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8342
8358
|
} else {
|
|
8343
|
-
approvalMode =
|
|
8359
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8344
8360
|
}
|
|
8345
8361
|
break;
|
|
8346
8362
|
case "default":
|
|
8347
|
-
approvalMode =
|
|
8363
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8348
8364
|
break;
|
|
8349
8365
|
default:
|
|
8350
8366
|
throw new Error(
|
|
@@ -8352,10 +8368,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8352
8368
|
);
|
|
8353
8369
|
}
|
|
8354
8370
|
} else {
|
|
8355
|
-
approvalMode =
|
|
8371
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8356
8372
|
}
|
|
8357
8373
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8358
|
-
if (approvalMode ===
|
|
8374
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8359
8375
|
if (settings.admin?.secureModeEnabled) {
|
|
8360
8376
|
debugLogger.error(
|
|
8361
8377
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8373,16 +8389,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8373
8389
|
)
|
|
8374
8390
|
);
|
|
8375
8391
|
}
|
|
8376
|
-
} else if (approvalMode ===
|
|
8392
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8377
8393
|
debugLogger.warn(
|
|
8378
8394
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8379
8395
|
);
|
|
8380
8396
|
}
|
|
8381
|
-
if (!trustedFolder && approvalMode !==
|
|
8397
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8382
8398
|
debugLogger.warn(
|
|
8383
8399
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8384
8400
|
);
|
|
8385
|
-
approvalMode =
|
|
8401
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8386
8402
|
}
|
|
8387
8403
|
let telemetrySettings;
|
|
8388
8404
|
try {
|
|
@@ -11083,7 +11099,7 @@ import path10 from "node:path";
|
|
|
11083
11099
|
import process4 from "node:process";
|
|
11084
11100
|
var homeDirectoryCheck = {
|
|
11085
11101
|
id: "home-directory",
|
|
11086
|
-
priority:
|
|
11102
|
+
priority: WarningPriority.Low,
|
|
11087
11103
|
check: async (workspaceRoot, settings) => {
|
|
11088
11104
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
11089
11105
|
return null;
|
|
@@ -11107,7 +11123,7 @@ var homeDirectoryCheck = {
|
|
|
11107
11123
|
};
|
|
11108
11124
|
var rootDirectoryCheck = {
|
|
11109
11125
|
id: "root-directory",
|
|
11110
|
-
priority:
|
|
11126
|
+
priority: WarningPriority.High,
|
|
11111
11127
|
check: async (workspaceRoot, _settings) => {
|
|
11112
11128
|
try {
|
|
11113
11129
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -11123,7 +11139,7 @@ var rootDirectoryCheck = {
|
|
|
11123
11139
|
};
|
|
11124
11140
|
var folderTrustCheck = {
|
|
11125
11141
|
id: "folder-trust",
|
|
11126
|
-
priority:
|
|
11142
|
+
priority: WarningPriority.High,
|
|
11127
11143
|
check: async (workspaceRoot, settings) => {
|
|
11128
11144
|
if (!isFolderTrustEnabled(settings)) {
|
|
11129
11145
|
return null;
|
|
@@ -11313,12 +11329,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
11313
11329
|
error,
|
|
11314
11330
|
config.getContentGeneratorConfig()?.authType
|
|
11315
11331
|
);
|
|
11316
|
-
if (config.getOutputFormat() ===
|
|
11332
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11317
11333
|
const streamFormatter = new StreamJsonFormatter();
|
|
11318
11334
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11319
11335
|
const metrics = uiTelemetryService.getMetrics();
|
|
11320
11336
|
streamFormatter.emitEvent({
|
|
11321
|
-
type:
|
|
11337
|
+
type: JsonStreamEventType.RESULT,
|
|
11322
11338
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11323
11339
|
status: "error",
|
|
11324
11340
|
error: {
|
|
@@ -11329,7 +11345,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
11329
11345
|
});
|
|
11330
11346
|
runSyncCleanup();
|
|
11331
11347
|
process.exit(getNumericExitCode(errorCode));
|
|
11332
|
-
} else if (config.getOutputFormat() ===
|
|
11348
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11333
11349
|
const formatter = new JsonFormatter();
|
|
11334
11350
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11335
11351
|
const formattedError = formatter.formatError(
|
|
@@ -11349,11 +11365,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11349
11365
|
const isFatal = isFatalToolError(errorType);
|
|
11350
11366
|
if (isFatal) {
|
|
11351
11367
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
11352
|
-
if (config.getOutputFormat() ===
|
|
11368
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11353
11369
|
const streamFormatter = new StreamJsonFormatter();
|
|
11354
11370
|
const metrics = uiTelemetryService.getMetrics();
|
|
11355
11371
|
streamFormatter.emitEvent({
|
|
11356
|
-
type:
|
|
11372
|
+
type: JsonStreamEventType.RESULT,
|
|
11357
11373
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11358
11374
|
status: "error",
|
|
11359
11375
|
error: {
|
|
@@ -11362,7 +11378,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11362
11378
|
},
|
|
11363
11379
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
11364
11380
|
});
|
|
11365
|
-
} else if (config.getOutputFormat() ===
|
|
11381
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11366
11382
|
const formatter = new JsonFormatter();
|
|
11367
11383
|
const formattedError = formatter.formatError(
|
|
11368
11384
|
toolExecutionError,
|
|
@@ -11380,11 +11396,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11380
11396
|
}
|
|
11381
11397
|
function handleCancellationError(config) {
|
|
11382
11398
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
11383
|
-
if (config.getOutputFormat() ===
|
|
11399
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11384
11400
|
const streamFormatter = new StreamJsonFormatter();
|
|
11385
11401
|
const metrics = uiTelemetryService.getMetrics();
|
|
11386
11402
|
streamFormatter.emitEvent({
|
|
11387
|
-
type:
|
|
11403
|
+
type: JsonStreamEventType.RESULT,
|
|
11388
11404
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11389
11405
|
status: "error",
|
|
11390
11406
|
error: {
|
|
@@ -11395,7 +11411,7 @@ function handleCancellationError(config) {
|
|
|
11395
11411
|
});
|
|
11396
11412
|
runSyncCleanup();
|
|
11397
11413
|
process.exit(cancellationError.exitCode);
|
|
11398
|
-
} else if (config.getOutputFormat() ===
|
|
11414
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11399
11415
|
const formatter = new JsonFormatter();
|
|
11400
11416
|
const formattedError = formatter.formatError(
|
|
11401
11417
|
cancellationError,
|
|
@@ -11415,11 +11431,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11415
11431
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
11416
11432
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
11417
11433
|
);
|
|
11418
|
-
if (config.getOutputFormat() ===
|
|
11434
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11419
11435
|
const streamFormatter = new StreamJsonFormatter();
|
|
11420
11436
|
const metrics = uiTelemetryService.getMetrics();
|
|
11421
11437
|
streamFormatter.emitEvent({
|
|
11422
|
-
type:
|
|
11438
|
+
type: JsonStreamEventType.RESULT,
|
|
11423
11439
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11424
11440
|
status: "error",
|
|
11425
11441
|
error: {
|
|
@@ -11430,7 +11446,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11430
11446
|
});
|
|
11431
11447
|
runSyncCleanup();
|
|
11432
11448
|
process.exit(maxTurnsError.exitCode);
|
|
11433
|
-
} else if (config.getOutputFormat() ===
|
|
11449
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11434
11450
|
const formatter = new JsonFormatter();
|
|
11435
11451
|
const formattedError = formatter.formatError(
|
|
11436
11452
|
maxTurnsError,
|
|
@@ -11510,7 +11526,7 @@ async function runNonInteractive({
|
|
|
11510
11526
|
}
|
|
11511
11527
|
});
|
|
11512
11528
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11513
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11529
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-LWSF6JIT.js");
|
|
11514
11530
|
setupInitialActivityLogger(config);
|
|
11515
11531
|
}
|
|
11516
11532
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11526,7 +11542,7 @@ async function runNonInteractive({
|
|
|
11526
11542
|
}
|
|
11527
11543
|
};
|
|
11528
11544
|
const startTime = Date.now();
|
|
11529
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11545
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
11530
11546
|
const abortController = new AbortController();
|
|
11531
11547
|
let isAborting = false;
|
|
11532
11548
|
let cancelMessageTimer = null;
|
|
@@ -11579,13 +11595,13 @@ async function runNonInteractive({
|
|
|
11579
11595
|
};
|
|
11580
11596
|
try {
|
|
11581
11597
|
consolePatcher.patch();
|
|
11582
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11598
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11583
11599
|
process.stderr.write(
|
|
11584
11600
|
"[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"
|
|
11585
11601
|
);
|
|
11586
11602
|
}
|
|
11587
11603
|
setupStdinCancellation();
|
|
11588
|
-
coreEvents.on(
|
|
11604
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11589
11605
|
coreEvents.drainBacklogs();
|
|
11590
11606
|
process.stdout.on("error", (err) => {
|
|
11591
11607
|
if (err.code === "EPIPE") {
|
|
@@ -11611,7 +11627,7 @@ async function runNonInteractive({
|
|
|
11611
11627
|
}
|
|
11612
11628
|
if (streamFormatter) {
|
|
11613
11629
|
streamFormatter.emitEvent({
|
|
11614
|
-
type:
|
|
11630
|
+
type: JsonStreamEventType.INIT,
|
|
11615
11631
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11616
11632
|
session_id: config.getSessionId(),
|
|
11617
11633
|
model: config.getModel()
|
|
@@ -11649,7 +11665,7 @@ async function runNonInteractive({
|
|
|
11649
11665
|
}
|
|
11650
11666
|
if (streamFormatter) {
|
|
11651
11667
|
streamFormatter.emitEvent({
|
|
11652
|
-
type:
|
|
11668
|
+
type: JsonStreamEventType.MESSAGE,
|
|
11653
11669
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11654
11670
|
role: "user",
|
|
11655
11671
|
content: input
|
|
@@ -11688,12 +11704,12 @@ async function runNonInteractive({
|
|
|
11688
11704
|
const metrics = uiTelemetryService.getMetrics();
|
|
11689
11705
|
const durationMs = Date.now() - startTime;
|
|
11690
11706
|
streamFormatter.emitEvent({
|
|
11691
|
-
type:
|
|
11707
|
+
type: JsonStreamEventType.RESULT,
|
|
11692
11708
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11693
11709
|
status: errorPayload ? "error" : "success",
|
|
11694
11710
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11695
11711
|
});
|
|
11696
|
-
} else if (config.getOutputFormat() ===
|
|
11712
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11697
11713
|
const formatter = new JsonFormatter();
|
|
11698
11714
|
const stats = uiTelemetryService.getMetrics();
|
|
11699
11715
|
textOutput.write(
|
|
@@ -11786,13 +11802,13 @@ async function runNonInteractive({
|
|
|
11786
11802
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
11787
11803
|
if (streamFormatter) {
|
|
11788
11804
|
streamFormatter.emitEvent({
|
|
11789
|
-
type:
|
|
11805
|
+
type: JsonStreamEventType.MESSAGE,
|
|
11790
11806
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11791
11807
|
role: "assistant",
|
|
11792
11808
|
content: output,
|
|
11793
11809
|
delta: true
|
|
11794
11810
|
});
|
|
11795
|
-
} else if (config.getOutputFormat() ===
|
|
11811
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11796
11812
|
responseText += output;
|
|
11797
11813
|
} else {
|
|
11798
11814
|
if (part.text) {
|
|
@@ -11805,13 +11821,13 @@ async function runNonInteractive({
|
|
|
11805
11821
|
break;
|
|
11806
11822
|
}
|
|
11807
11823
|
case "tool_request": {
|
|
11808
|
-
if (config.getOutputFormat() ===
|
|
11824
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11809
11825
|
preToolResponseText = responseText || preToolResponseText;
|
|
11810
11826
|
responseText = "";
|
|
11811
11827
|
}
|
|
11812
11828
|
if (streamFormatter) {
|
|
11813
11829
|
streamFormatter.emitEvent({
|
|
11814
|
-
type:
|
|
11830
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
11815
11831
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11816
11832
|
tool_name: event.name,
|
|
11817
11833
|
tool_id: event.requestId,
|
|
@@ -11827,7 +11843,7 @@ async function runNonInteractive({
|
|
|
11827
11843
|
const displayText = displayContentToString(display);
|
|
11828
11844
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11829
11845
|
streamFormatter.emitEvent({
|
|
11830
|
-
type:
|
|
11846
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
11831
11847
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11832
11848
|
tool_id: event.requestId,
|
|
11833
11849
|
status: event.isError ? "error" : "success",
|
|
@@ -11842,17 +11858,17 @@ async function runNonInteractive({
|
|
|
11842
11858
|
const display = event.display?.result;
|
|
11843
11859
|
const displayText = displayContentToString(display);
|
|
11844
11860
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11845
|
-
if (event.data?.["errorType"] ===
|
|
11846
|
-
if (config.getOutputFormat() ===
|
|
11861
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
11862
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
11847
11863
|
responseText = preToolResponseText;
|
|
11848
11864
|
}
|
|
11849
11865
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
11850
|
-
if (config.getOutputFormat() ===
|
|
11866
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11851
11867
|
process.stderr.write(`${stopMessage}
|
|
11852
11868
|
`);
|
|
11853
11869
|
}
|
|
11854
11870
|
}
|
|
11855
|
-
if (event.data?.["errorType"] ===
|
|
11871
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
11856
11872
|
throw new FatalToolExecutionError(
|
|
11857
11873
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
11858
11874
|
);
|
|
@@ -11887,12 +11903,12 @@ async function runNonInteractive({
|
|
|
11887
11903
|
}
|
|
11888
11904
|
if (streamFormatter) {
|
|
11889
11905
|
streamFormatter.emitEvent({
|
|
11890
|
-
type:
|
|
11906
|
+
type: JsonStreamEventType.ERROR,
|
|
11891
11907
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11892
11908
|
severity: "error",
|
|
11893
11909
|
message: errorMessage
|
|
11894
11910
|
});
|
|
11895
|
-
} else if (config.getOutputFormat() ===
|
|
11911
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11896
11912
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
11897
11913
|
`);
|
|
11898
11914
|
}
|
|
@@ -11913,12 +11929,12 @@ async function runNonInteractive({
|
|
|
11913
11929
|
const errorCode = event._meta?.["code"];
|
|
11914
11930
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
11915
11931
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
11916
|
-
if (config.getOutputFormat() ===
|
|
11932
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11917
11933
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11918
11934
|
`);
|
|
11919
11935
|
} else if (streamFormatter) {
|
|
11920
11936
|
streamFormatter.emitEvent({
|
|
11921
|
-
type:
|
|
11937
|
+
type: JsonStreamEventType.ERROR,
|
|
11922
11938
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11923
11939
|
severity: "warning",
|
|
11924
11940
|
message: stripAnsi(blockMessage)
|
|
@@ -11928,13 +11944,13 @@ async function runNonInteractive({
|
|
|
11928
11944
|
break;
|
|
11929
11945
|
}
|
|
11930
11946
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
11931
|
-
if (config.getOutputFormat() ===
|
|
11947
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11932
11948
|
process.stderr.write(`[WARNING] ${event.message}
|
|
11933
11949
|
`);
|
|
11934
11950
|
}
|
|
11935
11951
|
if (streamFormatter) {
|
|
11936
11952
|
streamFormatter.emitEvent({
|
|
11937
|
-
type:
|
|
11953
|
+
type: JsonStreamEventType.ERROR,
|
|
11938
11954
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11939
11955
|
severity,
|
|
11940
11956
|
message: stripAnsi(event.message)
|
|
@@ -11954,7 +11970,7 @@ async function runNonInteractive({
|
|
|
11954
11970
|
);
|
|
11955
11971
|
} else if (streamFormatter) {
|
|
11956
11972
|
streamFormatter.emitEvent({
|
|
11957
|
-
type:
|
|
11973
|
+
type: JsonStreamEventType.ERROR,
|
|
11958
11974
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11959
11975
|
severity: "error",
|
|
11960
11976
|
message: "Maximum session turns exceeded"
|
|
@@ -11962,7 +11978,7 @@ async function runNonInteractive({
|
|
|
11962
11978
|
}
|
|
11963
11979
|
}
|
|
11964
11980
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
11965
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
11981
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11966
11982
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
11967
11983
|
`);
|
|
11968
11984
|
}
|
|
@@ -11992,7 +12008,7 @@ async function runNonInteractive({
|
|
|
11992
12008
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
11993
12009
|
scheduler?.dispose();
|
|
11994
12010
|
consolePatcher.cleanup();
|
|
11995
|
-
coreEvents.off(
|
|
12011
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11996
12012
|
}
|
|
11997
12013
|
if (errorToHandle) {
|
|
11998
12014
|
handleError(errorToHandle, config);
|
|
@@ -12020,7 +12036,7 @@ async function runNonInteractive2(params) {
|
|
|
12020
12036
|
}
|
|
12021
12037
|
});
|
|
12022
12038
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
12023
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
12039
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-LWSF6JIT.js");
|
|
12024
12040
|
setupInitialActivityLogger(config);
|
|
12025
12041
|
}
|
|
12026
12042
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -12036,7 +12052,7 @@ async function runNonInteractive2(params) {
|
|
|
12036
12052
|
}
|
|
12037
12053
|
};
|
|
12038
12054
|
const startTime = Date.now();
|
|
12039
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
12055
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
12040
12056
|
const abortController = new AbortController();
|
|
12041
12057
|
let isAborting = false;
|
|
12042
12058
|
let cancelMessageTimer = null;
|
|
@@ -12087,13 +12103,13 @@ async function runNonInteractive2(params) {
|
|
|
12087
12103
|
let scheduler;
|
|
12088
12104
|
try {
|
|
12089
12105
|
consolePatcher.patch();
|
|
12090
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
12106
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12091
12107
|
process.stderr.write(
|
|
12092
12108
|
"[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"
|
|
12093
12109
|
);
|
|
12094
12110
|
}
|
|
12095
12111
|
setupStdinCancellation();
|
|
12096
|
-
coreEvents.on(
|
|
12112
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
12097
12113
|
coreEvents.drainBacklogs();
|
|
12098
12114
|
process.stdout.on("error", (err) => {
|
|
12099
12115
|
if (err.code === "EPIPE") {
|
|
@@ -12117,7 +12133,7 @@ async function runNonInteractive2(params) {
|
|
|
12117
12133
|
}
|
|
12118
12134
|
if (streamFormatter) {
|
|
12119
12135
|
streamFormatter.emitEvent({
|
|
12120
|
-
type:
|
|
12136
|
+
type: JsonStreamEventType.INIT,
|
|
12121
12137
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12122
12138
|
session_id: config.getSessionId(),
|
|
12123
12139
|
model: config.getModel()
|
|
@@ -12155,7 +12171,7 @@ async function runNonInteractive2(params) {
|
|
|
12155
12171
|
}
|
|
12156
12172
|
if (streamFormatter) {
|
|
12157
12173
|
streamFormatter.emitEvent({
|
|
12158
|
-
type:
|
|
12174
|
+
type: JsonStreamEventType.MESSAGE,
|
|
12159
12175
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12160
12176
|
role: "user",
|
|
12161
12177
|
content: input
|
|
@@ -12183,28 +12199,28 @@ async function runNonInteractive2(params) {
|
|
|
12183
12199
|
if (abortController.signal.aborted) {
|
|
12184
12200
|
handleCancellationError(config);
|
|
12185
12201
|
}
|
|
12186
|
-
if (event.type ===
|
|
12202
|
+
if (event.type === GeminiEventType.Content) {
|
|
12187
12203
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
12188
12204
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
12189
12205
|
if (streamFormatter) {
|
|
12190
12206
|
streamFormatter.emitEvent({
|
|
12191
|
-
type:
|
|
12207
|
+
type: JsonStreamEventType.MESSAGE,
|
|
12192
12208
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12193
12209
|
role: "assistant",
|
|
12194
12210
|
content: output,
|
|
12195
12211
|
delta: true
|
|
12196
12212
|
});
|
|
12197
|
-
} else if (config.getOutputFormat() ===
|
|
12213
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12198
12214
|
responseText += output;
|
|
12199
12215
|
} else {
|
|
12200
12216
|
if (event.value) {
|
|
12201
12217
|
textOutput.write(output);
|
|
12202
12218
|
}
|
|
12203
12219
|
}
|
|
12204
|
-
} else if (event.type ===
|
|
12220
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
12205
12221
|
if (streamFormatter) {
|
|
12206
12222
|
streamFormatter.emitEvent({
|
|
12207
|
-
type:
|
|
12223
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
12208
12224
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12209
12225
|
tool_name: event.value.name,
|
|
12210
12226
|
tool_id: event.value.callId,
|
|
@@ -12212,33 +12228,33 @@ async function runNonInteractive2(params) {
|
|
|
12212
12228
|
});
|
|
12213
12229
|
}
|
|
12214
12230
|
toolCallRequests.push(event.value);
|
|
12215
|
-
} else if (event.type ===
|
|
12231
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
12216
12232
|
const message = "Loop detected, stopping execution";
|
|
12217
12233
|
if (streamFormatter) {
|
|
12218
12234
|
streamFormatter.emitEvent({
|
|
12219
|
-
type:
|
|
12235
|
+
type: JsonStreamEventType.ERROR,
|
|
12220
12236
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12221
12237
|
severity: "warning",
|
|
12222
12238
|
message
|
|
12223
12239
|
});
|
|
12224
12240
|
}
|
|
12225
12241
|
warnings.push(message);
|
|
12226
|
-
} else if (event.type ===
|
|
12242
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
12227
12243
|
const message = "Maximum session turns exceeded";
|
|
12228
12244
|
if (streamFormatter) {
|
|
12229
12245
|
streamFormatter.emitEvent({
|
|
12230
|
-
type:
|
|
12246
|
+
type: JsonStreamEventType.ERROR,
|
|
12231
12247
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12232
12248
|
severity: "error",
|
|
12233
12249
|
message
|
|
12234
12250
|
});
|
|
12235
12251
|
}
|
|
12236
12252
|
warnings.push(message);
|
|
12237
|
-
} else if (event.type ===
|
|
12253
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
12238
12254
|
throw event.value.error;
|
|
12239
|
-
} else if (event.type ===
|
|
12255
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
12240
12256
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12241
|
-
if (config.getOutputFormat() ===
|
|
12257
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12242
12258
|
process.stderr.write(`${stopMessage}
|
|
12243
12259
|
`);
|
|
12244
12260
|
}
|
|
@@ -12246,7 +12262,7 @@ async function runNonInteractive2(params) {
|
|
|
12246
12262
|
const metrics = uiTelemetryService.getMetrics();
|
|
12247
12263
|
const durationMs = Date.now() - startTime;
|
|
12248
12264
|
streamFormatter.emitEvent({
|
|
12249
|
-
type:
|
|
12265
|
+
type: JsonStreamEventType.RESULT,
|
|
12250
12266
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12251
12267
|
status: "success",
|
|
12252
12268
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12254,7 +12270,7 @@ async function runNonInteractive2(params) {
|
|
|
12254
12270
|
durationMs
|
|
12255
12271
|
)
|
|
12256
12272
|
});
|
|
12257
|
-
} else if (config.getOutputFormat() ===
|
|
12273
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12258
12274
|
const formatter = new JsonFormatter();
|
|
12259
12275
|
const stats = uiTelemetryService.getMetrics();
|
|
12260
12276
|
textOutput.write(
|
|
@@ -12270,21 +12286,21 @@ async function runNonInteractive2(params) {
|
|
|
12270
12286
|
textOutput.ensureTrailingNewline();
|
|
12271
12287
|
}
|
|
12272
12288
|
return;
|
|
12273
|
-
} else if (event.type ===
|
|
12289
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
12274
12290
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12275
|
-
if (config.getOutputFormat() ===
|
|
12291
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12276
12292
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
12277
12293
|
`);
|
|
12278
12294
|
} else if (streamFormatter) {
|
|
12279
12295
|
streamFormatter.emitEvent({
|
|
12280
|
-
type:
|
|
12296
|
+
type: JsonStreamEventType.ERROR,
|
|
12281
12297
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12282
12298
|
severity: "warning",
|
|
12283
12299
|
message: stripAnsi(blockMessage)
|
|
12284
12300
|
});
|
|
12285
12301
|
}
|
|
12286
12302
|
warnings.push(blockMessage);
|
|
12287
|
-
} else if (event.type ===
|
|
12303
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
12288
12304
|
const eventValue = event.value;
|
|
12289
12305
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
12290
12306
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -12307,12 +12323,12 @@ async function runNonInteractive2(params) {
|
|
|
12307
12323
|
);
|
|
12308
12324
|
if (streamFormatter) {
|
|
12309
12325
|
streamFormatter.emitEvent({
|
|
12310
|
-
type:
|
|
12326
|
+
type: JsonStreamEventType.ERROR,
|
|
12311
12327
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12312
12328
|
severity: "error",
|
|
12313
12329
|
message: invalidStreamError
|
|
12314
12330
|
});
|
|
12315
|
-
} else if (config.getOutputFormat() ===
|
|
12331
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12316
12332
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
12317
12333
|
`);
|
|
12318
12334
|
}
|
|
@@ -12332,7 +12348,7 @@ async function runNonInteractive2(params) {
|
|
|
12332
12348
|
const requestInfo = completedToolCall.request;
|
|
12333
12349
|
if (streamFormatter) {
|
|
12334
12350
|
streamFormatter.emitEvent({
|
|
12335
|
-
type:
|
|
12351
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
12336
12352
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12337
12353
|
tool_id: requestInfo.callId,
|
|
12338
12354
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -12366,11 +12382,11 @@ async function runNonInteractive2(params) {
|
|
|
12366
12382
|
);
|
|
12367
12383
|
}
|
|
12368
12384
|
const stopExecutionTool = completedToolCalls.find(
|
|
12369
|
-
(tc) => tc.response.errorType ===
|
|
12385
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
12370
12386
|
);
|
|
12371
12387
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
12372
12388
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
12373
|
-
if (config.getOutputFormat() ===
|
|
12389
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12374
12390
|
process.stderr.write(`${stopMessage}
|
|
12375
12391
|
`);
|
|
12376
12392
|
}
|
|
@@ -12378,7 +12394,7 @@ async function runNonInteractive2(params) {
|
|
|
12378
12394
|
const metrics = uiTelemetryService.getMetrics();
|
|
12379
12395
|
const durationMs = Date.now() - startTime;
|
|
12380
12396
|
streamFormatter.emitEvent({
|
|
12381
|
-
type:
|
|
12397
|
+
type: JsonStreamEventType.RESULT,
|
|
12382
12398
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12383
12399
|
status: "success",
|
|
12384
12400
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12386,7 +12402,7 @@ async function runNonInteractive2(params) {
|
|
|
12386
12402
|
durationMs
|
|
12387
12403
|
)
|
|
12388
12404
|
});
|
|
12389
|
-
} else if (config.getOutputFormat() ===
|
|
12405
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12390
12406
|
const formatter = new JsonFormatter();
|
|
12391
12407
|
const stats = uiTelemetryService.getMetrics();
|
|
12392
12408
|
textOutput.write(
|
|
@@ -12409,12 +12425,12 @@ async function runNonInteractive2(params) {
|
|
|
12409
12425
|
const metrics = uiTelemetryService.getMetrics();
|
|
12410
12426
|
const durationMs = Date.now() - startTime;
|
|
12411
12427
|
streamFormatter.emitEvent({
|
|
12412
|
-
type:
|
|
12428
|
+
type: JsonStreamEventType.RESULT,
|
|
12413
12429
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12414
12430
|
status: invalidStreamError ? "error" : "success",
|
|
12415
12431
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
12416
12432
|
});
|
|
12417
|
-
} else if (config.getOutputFormat() ===
|
|
12433
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12418
12434
|
const formatter = new JsonFormatter();
|
|
12419
12435
|
const stats = uiTelemetryService.getMetrics();
|
|
12420
12436
|
textOutput.write(
|
|
@@ -12438,7 +12454,7 @@ async function runNonInteractive2(params) {
|
|
|
12438
12454
|
cleanupStdinCancellation();
|
|
12439
12455
|
scheduler?.dispose();
|
|
12440
12456
|
consolePatcher.cleanup();
|
|
12441
|
-
coreEvents.off(
|
|
12457
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
12442
12458
|
}
|
|
12443
12459
|
if (errorToHandle) {
|
|
12444
12460
|
handleError(errorToHandle, config);
|
|
@@ -14829,12 +14845,12 @@ function toToolCallContent(toolResult) {
|
|
|
14829
14845
|
}
|
|
14830
14846
|
var basicPermissionOptions = [
|
|
14831
14847
|
{
|
|
14832
|
-
optionId:
|
|
14848
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14833
14849
|
name: "Allow",
|
|
14834
14850
|
kind: "allow_once"
|
|
14835
14851
|
},
|
|
14836
14852
|
{
|
|
14837
|
-
optionId:
|
|
14853
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14838
14854
|
name: "Reject",
|
|
14839
14855
|
kind: "reject_once"
|
|
14840
14856
|
}
|
|
@@ -14846,13 +14862,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14846
14862
|
switch (confirmation.type) {
|
|
14847
14863
|
case "edit":
|
|
14848
14864
|
options.push({
|
|
14849
|
-
optionId:
|
|
14865
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14850
14866
|
name: "Allow for this session",
|
|
14851
14867
|
kind: "allow_always"
|
|
14852
14868
|
});
|
|
14853
14869
|
if (enablePermanentToolApproval) {
|
|
14854
14870
|
options.push({
|
|
14855
|
-
optionId:
|
|
14871
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14856
14872
|
name: "Allow for this file in all future sessions",
|
|
14857
14873
|
kind: "allow_always"
|
|
14858
14874
|
});
|
|
@@ -14860,13 +14876,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14860
14876
|
break;
|
|
14861
14877
|
case "exec":
|
|
14862
14878
|
options.push({
|
|
14863
|
-
optionId:
|
|
14879
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14864
14880
|
name: "Allow for this session",
|
|
14865
14881
|
kind: "allow_always"
|
|
14866
14882
|
});
|
|
14867
14883
|
if (enablePermanentToolApproval) {
|
|
14868
14884
|
options.push({
|
|
14869
|
-
optionId:
|
|
14885
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14870
14886
|
name: "Allow this command for all future sessions",
|
|
14871
14887
|
kind: "allow_always"
|
|
14872
14888
|
});
|
|
@@ -14875,19 +14891,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14875
14891
|
case "mcp":
|
|
14876
14892
|
options.push(
|
|
14877
14893
|
{
|
|
14878
|
-
optionId:
|
|
14894
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
14879
14895
|
name: "Allow all server tools for this session",
|
|
14880
14896
|
kind: "allow_always"
|
|
14881
14897
|
},
|
|
14882
14898
|
{
|
|
14883
|
-
optionId:
|
|
14899
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
14884
14900
|
name: "Allow tool for this session",
|
|
14885
14901
|
kind: "allow_always"
|
|
14886
14902
|
}
|
|
14887
14903
|
);
|
|
14888
14904
|
if (enablePermanentToolApproval) {
|
|
14889
14905
|
options.push({
|
|
14890
|
-
optionId:
|
|
14906
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14891
14907
|
name: "Allow tool for all future sessions",
|
|
14892
14908
|
kind: "allow_always"
|
|
14893
14909
|
});
|
|
@@ -14895,13 +14911,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14895
14911
|
break;
|
|
14896
14912
|
case "info":
|
|
14897
14913
|
options.push({
|
|
14898
|
-
optionId:
|
|
14914
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14899
14915
|
name: "Allow for this session",
|
|
14900
14916
|
kind: "allow_always"
|
|
14901
14917
|
});
|
|
14902
14918
|
if (enablePermanentToolApproval) {
|
|
14903
14919
|
options.push({
|
|
14904
|
-
optionId:
|
|
14920
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14905
14921
|
name: "Allow for all future sessions",
|
|
14906
14922
|
kind: "allow_always"
|
|
14907
14923
|
});
|
|
@@ -14933,21 +14949,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14933
14949
|
}
|
|
14934
14950
|
function toAcpToolKind(kind) {
|
|
14935
14951
|
switch (kind) {
|
|
14936
|
-
case
|
|
14937
|
-
case
|
|
14938
|
-
case
|
|
14939
|
-
case
|
|
14940
|
-
case
|
|
14941
|
-
case
|
|
14942
|
-
case
|
|
14943
|
-
case
|
|
14944
|
-
case
|
|
14945
|
-
case
|
|
14952
|
+
case Kind.Read:
|
|
14953
|
+
case Kind.Edit:
|
|
14954
|
+
case Kind.Execute:
|
|
14955
|
+
case Kind.Search:
|
|
14956
|
+
case Kind.Delete:
|
|
14957
|
+
case Kind.Move:
|
|
14958
|
+
case Kind.Think:
|
|
14959
|
+
case Kind.Fetch:
|
|
14960
|
+
case Kind.SwitchMode:
|
|
14961
|
+
case Kind.Other:
|
|
14946
14962
|
return kind;
|
|
14947
|
-
case
|
|
14963
|
+
case Kind.Agent:
|
|
14948
14964
|
return "think";
|
|
14949
|
-
case
|
|
14950
|
-
case
|
|
14965
|
+
case Kind.Plan:
|
|
14966
|
+
case Kind.Communicate:
|
|
14951
14967
|
default:
|
|
14952
14968
|
return "other";
|
|
14953
14969
|
}
|
|
@@ -14955,24 +14971,24 @@ function toAcpToolKind(kind) {
|
|
|
14955
14971
|
function buildAvailableModes(isPlanEnabled) {
|
|
14956
14972
|
const modes = [
|
|
14957
14973
|
{
|
|
14958
|
-
id:
|
|
14974
|
+
id: ApprovalMode.DEFAULT,
|
|
14959
14975
|
name: "Default",
|
|
14960
14976
|
description: "Prompts for approval"
|
|
14961
14977
|
},
|
|
14962
14978
|
{
|
|
14963
|
-
id:
|
|
14979
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
14964
14980
|
name: "Auto Edit",
|
|
14965
14981
|
description: "Auto-approves edit tools"
|
|
14966
14982
|
},
|
|
14967
14983
|
{
|
|
14968
|
-
id:
|
|
14984
|
+
id: ApprovalMode.YOLO,
|
|
14969
14985
|
name: "YOLO",
|
|
14970
14986
|
description: "Auto-approves all tools"
|
|
14971
14987
|
}
|
|
14972
14988
|
];
|
|
14973
14989
|
if (isPlanEnabled) {
|
|
14974
14990
|
modes.push({
|
|
14975
|
-
id:
|
|
14991
|
+
id: ApprovalMode.PLAN,
|
|
14976
14992
|
name: "Plan",
|
|
14977
14993
|
description: "Read-only mode"
|
|
14978
14994
|
});
|
|
@@ -14983,13 +14999,15 @@ function buildAvailableModels(config, settings) {
|
|
|
14983
14999
|
const preferredModel = config.getModel() || GEMINI_MODEL_ALIAS_AUTO;
|
|
14984
15000
|
const shouldShowPreviewModels = config.getHasAccessToPreviewModel();
|
|
14985
15001
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
14986
|
-
const
|
|
15002
|
+
const useLatestFlash = config.hasLatestFlashGAAccess?.() ?? false;
|
|
15003
|
+
const useLatestFlashLite = config.hasLatestFlashLiteGAAccess?.() ?? false;
|
|
14987
15004
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
14988
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
15005
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
14989
15006
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
14990
15007
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
14991
15008
|
useGemini3_1: useGemini31,
|
|
14992
|
-
|
|
15009
|
+
useLatestFlash,
|
|
15010
|
+
useLatestFlashLite,
|
|
14993
15011
|
useCustomTools: useCustomToolModel,
|
|
14994
15012
|
hasAccessToPreview: shouldShowPreviewModels
|
|
14995
15013
|
});
|
|
@@ -15005,7 +15023,7 @@ function buildAvailableModels(config, settings) {
|
|
|
15005
15023
|
description: getAutoModelDescription(
|
|
15006
15024
|
shouldShowPreviewModels,
|
|
15007
15025
|
useGemini31,
|
|
15008
|
-
|
|
15026
|
+
useLatestFlash
|
|
15009
15027
|
)
|
|
15010
15028
|
}
|
|
15011
15029
|
];
|
|
@@ -15071,11 +15089,11 @@ var Session = class {
|
|
|
15071
15089
|
this.connection = connection;
|
|
15072
15090
|
this.settings = settings;
|
|
15073
15091
|
coreEvents.on(
|
|
15074
|
-
|
|
15092
|
+
CoreEvent.ApprovalModeChanged,
|
|
15075
15093
|
this.handleApprovalModeChanged
|
|
15076
15094
|
);
|
|
15077
15095
|
this.context.config.getMessageBus()?.subscribe(
|
|
15078
|
-
|
|
15096
|
+
MessageBusType.TOOL_CONFIRMATION_REQUEST,
|
|
15079
15097
|
this.handleToolConfirmationRequest,
|
|
15080
15098
|
{ signal: this.disposeController.signal }
|
|
15081
15099
|
);
|
|
@@ -15099,7 +15117,7 @@ var Session = class {
|
|
|
15099
15117
|
"Policy engine missing. Denying tool confirmation request."
|
|
15100
15118
|
);
|
|
15101
15119
|
await messageBus.publish({
|
|
15102
|
-
type:
|
|
15120
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15103
15121
|
correlationId: request.correlationId,
|
|
15104
15122
|
confirmed: false,
|
|
15105
15123
|
requiresUserConfirmation: false
|
|
@@ -15112,7 +15130,7 @@ var Session = class {
|
|
|
15112
15130
|
"Tool confirmation request missing tool name. Denying."
|
|
15113
15131
|
);
|
|
15114
15132
|
await messageBus.publish({
|
|
15115
|
-
type:
|
|
15133
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15116
15134
|
correlationId: request.correlationId,
|
|
15117
15135
|
confirmed: false,
|
|
15118
15136
|
requiresUserConfirmation: false
|
|
@@ -15125,7 +15143,7 @@ var Session = class {
|
|
|
15125
15143
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
15126
15144
|
);
|
|
15127
15145
|
await messageBus.publish({
|
|
15128
|
-
type:
|
|
15146
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15129
15147
|
correlationId: request.correlationId,
|
|
15130
15148
|
confirmed: false,
|
|
15131
15149
|
requiresUserConfirmation: false
|
|
@@ -15141,15 +15159,15 @@ var Session = class {
|
|
|
15141
15159
|
request.subagent
|
|
15142
15160
|
);
|
|
15143
15161
|
await messageBus.publish({
|
|
15144
|
-
type:
|
|
15162
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15145
15163
|
correlationId: request.correlationId,
|
|
15146
|
-
confirmed: result.decision ===
|
|
15147
|
-
requiresUserConfirmation: result.decision ===
|
|
15164
|
+
confirmed: result.decision === PolicyDecision.ALLOW,
|
|
15165
|
+
requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
|
|
15148
15166
|
});
|
|
15149
15167
|
} catch (error) {
|
|
15150
15168
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
15151
15169
|
await this.context.config.getMessageBus()?.publish({
|
|
15152
|
-
type:
|
|
15170
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15153
15171
|
correlationId: request.correlationId,
|
|
15154
15172
|
confirmed: false,
|
|
15155
15173
|
requiresUserConfirmation: false
|
|
@@ -15169,7 +15187,7 @@ var Session = class {
|
|
|
15169
15187
|
};
|
|
15170
15188
|
dispose() {
|
|
15171
15189
|
coreEvents.off(
|
|
15172
|
-
|
|
15190
|
+
CoreEvent.ApprovalModeChanged,
|
|
15173
15191
|
this.handleApprovalModeChanged
|
|
15174
15192
|
);
|
|
15175
15193
|
this.disposeController.abort();
|
|
@@ -15258,7 +15276,7 @@ ${thought.description}`;
|
|
|
15258
15276
|
await this.sendUpdate({
|
|
15259
15277
|
sessionUpdate: "tool_call",
|
|
15260
15278
|
toolCallId: toolCall.id,
|
|
15261
|
-
status: toolCall.status ===
|
|
15279
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
15262
15280
|
title: toolCall.displayName || toolCall.name,
|
|
15263
15281
|
content: toolCallContent,
|
|
15264
15282
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -15350,7 +15368,7 @@ ${thought.description}`;
|
|
|
15350
15368
|
return { stopReason: "cancelled" };
|
|
15351
15369
|
}
|
|
15352
15370
|
switch (event.type) {
|
|
15353
|
-
case
|
|
15371
|
+
case GeminiEventType.Content: {
|
|
15354
15372
|
const content = {
|
|
15355
15373
|
type: "text",
|
|
15356
15374
|
text: event.value
|
|
@@ -15361,7 +15379,7 @@ ${thought.description}`;
|
|
|
15361
15379
|
});
|
|
15362
15380
|
break;
|
|
15363
15381
|
}
|
|
15364
|
-
case
|
|
15382
|
+
case GeminiEventType.Thought: {
|
|
15365
15383
|
const thoughtText = `**${event.value.subject}**
|
|
15366
15384
|
${event.value.description}`;
|
|
15367
15385
|
await this.sendUpdate({
|
|
@@ -15370,10 +15388,10 @@ ${event.value.description}`;
|
|
|
15370
15388
|
});
|
|
15371
15389
|
break;
|
|
15372
15390
|
}
|
|
15373
|
-
case
|
|
15391
|
+
case GeminiEventType.ToolCallRequest:
|
|
15374
15392
|
toolCallRequests.push(event.value);
|
|
15375
15393
|
break;
|
|
15376
|
-
case
|
|
15394
|
+
case GeminiEventType.Finished: {
|
|
15377
15395
|
const usage2 = event.value.usageMetadata;
|
|
15378
15396
|
if (usage2) {
|
|
15379
15397
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -15381,19 +15399,19 @@ ${event.value.description}`;
|
|
|
15381
15399
|
}
|
|
15382
15400
|
break;
|
|
15383
15401
|
}
|
|
15384
|
-
case
|
|
15402
|
+
case GeminiEventType.ModelInfo:
|
|
15385
15403
|
turnModelId = event.value;
|
|
15386
15404
|
break;
|
|
15387
|
-
case
|
|
15405
|
+
case GeminiEventType.MaxSessionTurns:
|
|
15388
15406
|
stopReason = "max_turn_requests";
|
|
15389
15407
|
break;
|
|
15390
|
-
case
|
|
15408
|
+
case GeminiEventType.LoopDetected:
|
|
15391
15409
|
stopReason = "max_turn_requests";
|
|
15392
15410
|
break;
|
|
15393
|
-
case
|
|
15411
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
15394
15412
|
stopReason = "max_tokens";
|
|
15395
15413
|
break;
|
|
15396
|
-
case
|
|
15414
|
+
case GeminiEventType.Error: {
|
|
15397
15415
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
15398
15416
|
event.value.error
|
|
15399
15417
|
);
|
|
@@ -15621,7 +15639,7 @@ ${event.value.description}`;
|
|
|
15621
15639
|
const output = RequestPermissionResponseSchema.parse(
|
|
15622
15640
|
await this.connection.requestPermission(params)
|
|
15623
15641
|
);
|
|
15624
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15642
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15625
15643
|
await confirmationDetails.onConfirm(outcome);
|
|
15626
15644
|
await updatePolicy(
|
|
15627
15645
|
tool,
|
|
@@ -15632,16 +15650,16 @@ ${event.value.description}`;
|
|
|
15632
15650
|
invocation
|
|
15633
15651
|
);
|
|
15634
15652
|
switch (outcome) {
|
|
15635
|
-
case
|
|
15653
|
+
case ToolConfirmationOutcome.Cancel:
|
|
15636
15654
|
return errorResponse(
|
|
15637
15655
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
15638
15656
|
);
|
|
15639
|
-
case
|
|
15640
|
-
case
|
|
15641
|
-
case
|
|
15642
|
-
case
|
|
15643
|
-
case
|
|
15644
|
-
case
|
|
15657
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
15658
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
15659
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
15660
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
15661
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
15662
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
15645
15663
|
break;
|
|
15646
15664
|
default: {
|
|
15647
15665
|
const resultOutcome = outcome;
|
|
@@ -15695,7 +15713,7 @@ ${event.value.description}`;
|
|
|
15695
15713
|
);
|
|
15696
15714
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15697
15715
|
{
|
|
15698
|
-
status:
|
|
15716
|
+
status: CoreToolCallStatus.Success,
|
|
15699
15717
|
request: {
|
|
15700
15718
|
callId,
|
|
15701
15719
|
name: fc.name,
|
|
@@ -15740,7 +15758,7 @@ ${event.value.description}`;
|
|
|
15740
15758
|
});
|
|
15741
15759
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15742
15760
|
{
|
|
15743
|
-
status:
|
|
15761
|
+
status: CoreToolCallStatus.Error,
|
|
15744
15762
|
request: {
|
|
15745
15763
|
callId,
|
|
15746
15764
|
name: fc.name,
|
|
@@ -15868,12 +15886,12 @@ ${event.value.description}`;
|
|
|
15868
15886
|
sessionId: this.id,
|
|
15869
15887
|
options: [
|
|
15870
15888
|
{
|
|
15871
|
-
optionId:
|
|
15889
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
15872
15890
|
name: "Allow once",
|
|
15873
15891
|
kind: "allow_once"
|
|
15874
15892
|
},
|
|
15875
15893
|
{
|
|
15876
|
-
optionId:
|
|
15894
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
15877
15895
|
name: "Deny",
|
|
15878
15896
|
kind: "reject_once"
|
|
15879
15897
|
}
|
|
@@ -15898,8 +15916,8 @@ ${event.value.description}`;
|
|
|
15898
15916
|
const output = RequestPermissionResponseSchema.parse(
|
|
15899
15917
|
await this.connection.requestPermission(params)
|
|
15900
15918
|
);
|
|
15901
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15902
|
-
if (outcome ===
|
|
15919
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15920
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
15903
15921
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
15904
15922
|
validationError = null;
|
|
15905
15923
|
} else {
|
|
@@ -16336,7 +16354,7 @@ var AcpSessionManager = class {
|
|
|
16336
16354
|
mcpServers,
|
|
16337
16355
|
loadedSettings
|
|
16338
16356
|
);
|
|
16339
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16357
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
|
|
16340
16358
|
let isAuthenticated = false;
|
|
16341
16359
|
let authErrorMessage = "";
|
|
16342
16360
|
try {
|
|
@@ -16348,7 +16366,7 @@ var AcpSessionManager = class {
|
|
|
16348
16366
|
);
|
|
16349
16367
|
isAuthenticated = true;
|
|
16350
16368
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
16351
|
-
if (authType ===
|
|
16369
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
16352
16370
|
isAuthenticated = false;
|
|
16353
16371
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
16354
16372
|
}
|
|
@@ -16457,7 +16475,7 @@ var AcpSessionManager = class {
|
|
|
16457
16475
|
return response;
|
|
16458
16476
|
}
|
|
16459
16477
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
16460
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16478
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
|
|
16461
16479
|
if (!selectedAuthType) {
|
|
16462
16480
|
throw RequestError.authRequired();
|
|
16463
16481
|
}
|
|
@@ -16558,12 +16576,12 @@ var GeminiAgent = class {
|
|
|
16558
16576
|
}
|
|
16559
16577
|
const authMethods = [
|
|
16560
16578
|
{
|
|
16561
|
-
id:
|
|
16579
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
16562
16580
|
name: "Log in with Google",
|
|
16563
16581
|
description: "Log in with your Google account"
|
|
16564
16582
|
},
|
|
16565
16583
|
{
|
|
16566
|
-
id:
|
|
16584
|
+
id: AuthType.USE_GEMINI,
|
|
16567
16585
|
name: "Gemini API key",
|
|
16568
16586
|
description: "Use an API key with Gemini Developer API",
|
|
16569
16587
|
_meta: {
|
|
@@ -16573,12 +16591,12 @@ var GeminiAgent = class {
|
|
|
16573
16591
|
}
|
|
16574
16592
|
},
|
|
16575
16593
|
{
|
|
16576
|
-
id:
|
|
16594
|
+
id: AuthType.USE_VERTEX_AI,
|
|
16577
16595
|
name: "Vertex AI",
|
|
16578
16596
|
description: "Use an API key with Vertex AI GenAI API"
|
|
16579
16597
|
},
|
|
16580
16598
|
{
|
|
16581
|
-
id:
|
|
16599
|
+
id: AuthType.GATEWAY,
|
|
16582
16600
|
name: "AI API Gateway",
|
|
16583
16601
|
description: "Use a custom AI API Gateway",
|
|
16584
16602
|
_meta: {
|
|
@@ -16751,7 +16769,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
16751
16769
|
}
|
|
16752
16770
|
return authType;
|
|
16753
16771
|
} catch (error) {
|
|
16754
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
16772
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
16755
16773
|
handleError(
|
|
16756
16774
|
error instanceof Error ? error : new Error(String(error)),
|
|
16757
16775
|
nonInteractiveConfig,
|
|
@@ -16946,10 +16964,10 @@ var SlashCommandConflictHandler = class {
|
|
|
16946
16964
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
16947
16965
|
}
|
|
16948
16966
|
start() {
|
|
16949
|
-
coreEvents.on(
|
|
16967
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
16950
16968
|
}
|
|
16951
16969
|
stop() {
|
|
16952
|
-
coreEvents.off(
|
|
16970
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
16953
16971
|
if (this.flushTimeout) {
|
|
16954
16972
|
clearTimeout(this.flushTimeout);
|
|
16955
16973
|
this.flushTimeout = null;
|
|
@@ -17230,7 +17248,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
17230
17248
|
}
|
|
17231
17249
|
}
|
|
17232
17250
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
17233
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
17251
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-JYJNFC5D.js");
|
|
17234
17252
|
await doStartUI(
|
|
17235
17253
|
config,
|
|
17236
17254
|
settings,
|
|
@@ -17333,12 +17351,12 @@ async function main() {
|
|
|
17333
17351
|
dns.setDefaultResultOrder(
|
|
17334
17352
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
17335
17353
|
);
|
|
17336
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
17354
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
17337
17355
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
17338
17356
|
settings.setValue(
|
|
17339
17357
|
"User" /* User */,
|
|
17340
17358
|
"security.auth.selectedType",
|
|
17341
|
-
|
|
17359
|
+
AuthType.COMPUTE_ADC
|
|
17342
17360
|
);
|
|
17343
17361
|
}
|
|
17344
17362
|
}
|
|
@@ -17439,7 +17457,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17439
17457
|
await config.storage.initialize();
|
|
17440
17458
|
adminControlsListner.setConfig(config);
|
|
17441
17459
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
17442
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
17460
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-LWSF6JIT.js");
|
|
17443
17461
|
setupInitialActivityLogger(config);
|
|
17444
17462
|
}
|
|
17445
17463
|
registerTelemetryConfig(config);
|
|
@@ -17447,7 +17465,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17447
17465
|
const messageBus = config.getMessageBus();
|
|
17448
17466
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
17449
17467
|
registerCleanup(async () => {
|
|
17450
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
17468
|
+
await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
17451
17469
|
});
|
|
17452
17470
|
if (!config.getAcpMode()) {
|
|
17453
17471
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -17498,7 +17516,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17498
17516
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
17499
17517
|
const initializationResult = await initializeApp(config, settings);
|
|
17500
17518
|
initAppHandle?.end();
|
|
17501
|
-
import("./liteRtServerManager-
|
|
17519
|
+
import("./liteRtServerManager-WXCFUD52.js").then(({ LiteRtServerManager }) => {
|
|
17502
17520
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
17503
17521
|
if (!mergedGemma) return;
|
|
17504
17522
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -17508,7 +17526,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17508
17526
|
autoStartServer: userGemma?.autoStartServer
|
|
17509
17527
|
});
|
|
17510
17528
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
17511
|
-
if (settings.merged.security.auth.selectedType ===
|
|
17529
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
17512
17530
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
17513
17531
|
}
|
|
17514
17532
|
if (config.getAcpMode()) {
|
|
@@ -17524,7 +17542,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17524
17542
|
...rawStartupWarnings.map((message) => ({
|
|
17525
17543
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
17526
17544
|
message,
|
|
17527
|
-
priority:
|
|
17545
|
+
priority: WarningPriority.High
|
|
17528
17546
|
})),
|
|
17529
17547
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
17530
17548
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -17561,7 +17579,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17561
17579
|
${input}` : stdinData;
|
|
17562
17580
|
}
|
|
17563
17581
|
}
|
|
17564
|
-
const sessionStartSource = resumedSessionData ?
|
|
17582
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
17565
17583
|
const hookSystem = config?.getHookSystem();
|
|
17566
17584
|
if (hookSystem) {
|
|
17567
17585
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -17618,8 +17636,8 @@ ${input}` : wrappedContext;
|
|
|
17618
17636
|
}
|
|
17619
17637
|
}
|
|
17620
17638
|
function initializeOutputListenersAndFlush(config) {
|
|
17621
|
-
if (coreEvents.listenerCount(
|
|
17622
|
-
coreEvents.on(
|
|
17639
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
17640
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
17623
17641
|
if (payload.isStderr) {
|
|
17624
17642
|
writeToStderr(payload.chunk, payload.encoding);
|
|
17625
17643
|
} else {
|
|
@@ -17627,8 +17645,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17627
17645
|
}
|
|
17628
17646
|
});
|
|
17629
17647
|
}
|
|
17630
|
-
if (coreEvents.listenerCount(
|
|
17631
|
-
coreEvents.on(
|
|
17648
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
17649
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
17632
17650
|
if (payload.type === "error" || payload.type === "warn") {
|
|
17633
17651
|
writeToStderr(payload.content + "\n");
|
|
17634
17652
|
} else {
|
|
@@ -17636,8 +17654,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17636
17654
|
}
|
|
17637
17655
|
});
|
|
17638
17656
|
}
|
|
17639
|
-
if (coreEvents.listenerCount(
|
|
17640
|
-
coreEvents.on(
|
|
17657
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
17658
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
17641
17659
|
writeToStderr(payload.message + "\n");
|
|
17642
17660
|
});
|
|
17643
17661
|
}
|
|
@@ -17645,7 +17663,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17645
17663
|
const forceToStderr = outputFormat === "json";
|
|
17646
17664
|
coreEvents.drainBacklogs(
|
|
17647
17665
|
(event, args) => {
|
|
17648
|
-
if (forceToStderr && event ===
|
|
17666
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
17649
17667
|
const payload = args[0];
|
|
17650
17668
|
if (!payload.isStderr) {
|
|
17651
17669
|
return {
|