@google/gemini-cli 0.57.0-preview.1 → 0.57.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-S5UX3QS5.js → chunk-4H4K2RBL.js} +3 -3
- package/bundle/{chunk-G65GW52B.js → chunk-7HKQGPWB.js} +4 -4
- package/bundle/{chunk-EAK33LFP.js → chunk-7IKUWYZO.js} +1 -1
- package/bundle/{chunk-ALVDOQNA.js → chunk-7ZGWPQVZ.js} +1 -1
- package/bundle/{chunk-ZMPGHLGO.js → chunk-AOE6E7MU.js} +2 -2
- package/bundle/{chunk-65C235NM.js → chunk-ASZFEU6C.js} +7 -7
- package/bundle/{chunk-O7SBKM7M.js → chunk-DFPYJMVX.js} +4 -4
- package/bundle/{chunk-VBK54QCZ.js → chunk-FVC4WCSP.js} +1 -1
- package/bundle/{chunk-3BVBON3V.js → chunk-FYAMITQ2.js} +1 -1
- package/bundle/{chunk-GK7NUJ35.js → chunk-GAROUUGQ.js} +1 -1
- package/bundle/{chunk-3NPMAHLX.js → chunk-GAS2GAYB.js} +1 -1
- package/bundle/{chunk-4ALCU2HQ.js → chunk-GPOBVDAD.js} +5 -8
- package/bundle/{chunk-RLDNUS35.js → chunk-HY6GN2F7.js} +1 -1
- package/bundle/{chunk-AKCYXG7C.js → chunk-IKHAM2LG.js} +7 -7
- package/bundle/{chunk-MBWROXYM.js → chunk-ISXOUBN5.js} +2 -2
- package/bundle/{chunk-NMMXRZ53.js → chunk-LQJHQ4BU.js} +2 -2
- package/bundle/{chunk-UMQE7UC6.js → chunk-MNBBUQQS.js} +3 -3
- package/bundle/{chunk-W23OOD2C.js → chunk-O7TOZUUB.js} +3 -3
- package/bundle/{chunk-FHDRG5U4.js → chunk-QJ33O2NH.js} +54 -67
- package/bundle/{chunk-Q73BPF7A.js → chunk-RLDNVR77.js} +1 -1
- package/bundle/{chunk-NPOI4K6X.js → chunk-S3MXVTTY.js} +14357 -7673
- package/bundle/{chunk-NQ4RH42O.js → chunk-TAWZWX2B.js} +8 -9
- package/bundle/{chunk-GMQ6QNZB.js → chunk-XG56CL6B.js} +1 -1
- package/bundle/{chunk-SCBVGZXH.js → chunk-YW7SDLZQ.js} +1 -1
- package/bundle/{cleanup-2W5DPMY3.js → cleanup-2HUWGXK6.js} +2 -2
- package/bundle/{cleanup-OTHE7RNU.js → cleanup-7N2HFE2E.js} +2 -2
- package/bundle/{cleanup-SM67K64R.js → cleanup-DA7OSZS5.js} +2 -2
- package/bundle/{core-US34OW5M.js → core-2NMRPWUN.js} +1 -1
- package/bundle/{dist-5TYMQVIZ.js → core-CFPIDJ4Z.js} +1 -1
- package/bundle/{devtoolsService-5J53UK6Z.js → devtoolsService-7YYOUGVF.js} +2 -2
- package/bundle/{devtoolsService-JBFUXTCT.js → devtoolsService-VQSLUOYF.js} +3 -4
- package/bundle/{devtoolsService-GU2GQSOF.js → devtoolsService-WMEEEXY6.js} +2 -2
- package/bundle/{dist-OWKHVWTR.js → dist-AMP5W5P2.js} +1 -1
- package/bundle/{gemini-W2B6CLJC.js → gemini-5LF4JAP7.js} +198 -214
- package/bundle/{gemini-LSMTDETS.js → gemini-OYYGXMHL.js} +14 -14
- package/bundle/{gemini-3M22N2C3.js → gemini-PSRJNVY5.js} +14 -14
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-LQJM6LRE.js → interactiveCli-5E2C3XOC.js} +8 -8
- package/bundle/{interactiveCli-D6H37PJQ.js → interactiveCli-5O6FZS57.js} +8 -8
- package/bundle/{interactiveCli-L3ZXOVEV.js → interactiveCli-PP7WTUZL.js} +296 -315
- package/bundle/{liteRtServerManager-3BY6TBHG.js → liteRtServerManager-5QBFCLBK.js} +4 -4
- package/bundle/{liteRtServerManager-C5WZRQUF.js → liteRtServerManager-LK6HOSMO.js} +4 -4
- package/bundle/{liteRtServerManager-IGKUGGP4.js → liteRtServerManager-ZPDALIDY.js} +4 -4
- package/bundle/{oauth2-provider-KSRLPOK3.js → oauth2-provider-BGMEA7RS.js} +1 -1
- package/bundle/{oauth2-provider-RWKTMYJF.js → oauth2-provider-BYKBBEKI.js} +1 -1
- package/bundle/{oauth2-provider-VHNLCU4Y.js → oauth2-provider-CO22I6UM.js} +72 -38
- package/bundle/{start-EXAQFM4Y.js → start-JRTTCV3K.js} +6 -6
- package/bundle/{start-IPZF32E3.js → start-KH6WSP5C.js} +6 -6
- package/bundle/{start-SVNTSNHV.js → start-O6LWZY6K.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-4SNEOO5E.js +0 -398
- package/bundle/chunk-LNXGFWGZ.js +0 -17332
- package/bundle/chunk-QJP6CMLN.js +0 -118
- package/bundle/chunk-SWQAIZEQ.js +0 -102506
- package/bundle/chunk-VGGWKRAC.js +0 -154
- package/bundle/chunk-WDFSF5L4.js +0 -397601
- package/bundle/chunk-XESAM7IL.js +0 -512
- package/bundle/chunk-Y3APL4PE.js +0 -1571
- package/bundle/cleanup-XAUT5CMD.js +0 -32
- package/bundle/devtoolsService-V46GUHRF.js +0 -4359
- package/bundle/dist-V5VJYW6J.js +0 -2180
- package/bundle/gemini-OZOYJF22.js +0 -17091
- package/bundle/interactiveCli-RGOYDSMH.js +0 -34984
- package/bundle/liteRtServerManager-IJ4I2PZA.js +0 -65
- package/bundle/oauth2-provider-ZT4OFVMK.js +0 -235
- package/bundle/start-ZXU5BFZY.js +0 -18
|
@@ -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-O7TOZUUB.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -45,11 +45,11 @@ import {
|
|
|
45
45
|
updateAllUpdatableExtensions,
|
|
46
46
|
updateExtension,
|
|
47
47
|
validateAuthMethod
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-QJ33O2NH.js";
|
|
49
49
|
import {
|
|
50
50
|
exitCli,
|
|
51
51
|
require_source
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-YW7SDLZQ.js";
|
|
53
53
|
import {
|
|
54
54
|
appEvents
|
|
55
55
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -87,11 +87,11 @@ import {
|
|
|
87
87
|
resolveGemmaConfig,
|
|
88
88
|
saveModelChange,
|
|
89
89
|
stripAnsi
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-7ZGWPQVZ.js";
|
|
91
91
|
import {
|
|
92
92
|
RELAUNCH_EXIT_CODE
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-
|
|
93
|
+
} from "./chunk-AOE6E7MU.js";
|
|
94
|
+
import "./chunk-TAWZWX2B.js";
|
|
95
95
|
import {
|
|
96
96
|
cleanupCheckpoints,
|
|
97
97
|
registerCleanup,
|
|
@@ -100,15 +100,12 @@ import {
|
|
|
100
100
|
runExitCleanup,
|
|
101
101
|
runSyncCleanup,
|
|
102
102
|
setupSignalHandlers
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-7IKUWYZO.js";
|
|
104
104
|
import {
|
|
105
105
|
ASK_USER_TOOL_NAME,
|
|
106
|
-
ApprovalMode,
|
|
107
106
|
AuthType,
|
|
108
107
|
Client,
|
|
109
108
|
Config,
|
|
110
|
-
CoreEvent,
|
|
111
|
-
CoreToolCallStatus,
|
|
112
109
|
DEFAULT_CONTEXT_FILENAME,
|
|
113
110
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
114
111
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -130,27 +127,19 @@ import {
|
|
|
130
127
|
FolderTrustDiscoveryService,
|
|
131
128
|
GEMINI_DIR,
|
|
132
129
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
133
|
-
GeminiEventType,
|
|
134
130
|
IdeClient,
|
|
135
|
-
IntegrityStatus,
|
|
136
131
|
InvalidStreamError,
|
|
137
132
|
JsonFormatter,
|
|
138
|
-
JsonStreamEventType,
|
|
139
|
-
Kind,
|
|
140
133
|
LegacyAgentSession,
|
|
141
134
|
Logger,
|
|
142
135
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
143
136
|
MCPServerConfig,
|
|
144
|
-
MCPServerStatus,
|
|
145
|
-
MessageBusType,
|
|
146
137
|
OTHER_BLOCKED_MESSAGE,
|
|
147
|
-
OutputFormat,
|
|
148
138
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
149
139
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
150
140
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
151
141
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
152
142
|
PREVIEW_GEMINI_MODEL,
|
|
153
|
-
PolicyDecision,
|
|
154
143
|
PolicyIntegrityManager,
|
|
155
144
|
RECITATION_BLOCKED_MESSAGE,
|
|
156
145
|
REFERENCE_CONTENT_START,
|
|
@@ -158,8 +147,6 @@ import {
|
|
|
158
147
|
ReadManyFilesTool,
|
|
159
148
|
SAFETY_BLOCKED_MESSAGE,
|
|
160
149
|
Scheduler,
|
|
161
|
-
SessionEndReason,
|
|
162
|
-
SessionStartSource,
|
|
163
150
|
ShellExecutionService,
|
|
164
151
|
SimpleExtensionLoader,
|
|
165
152
|
Storage,
|
|
@@ -168,13 +155,10 @@ import {
|
|
|
168
155
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
169
156
|
ToolCallEvent,
|
|
170
157
|
ToolConfirmationOutcome,
|
|
171
|
-
ToolErrorType,
|
|
172
|
-
TrustLevel,
|
|
173
158
|
UserAccountManager,
|
|
174
159
|
UserPromptEvent,
|
|
175
160
|
ValidationCancelledError,
|
|
176
161
|
ValidationRequiredError,
|
|
177
|
-
WarningPriority,
|
|
178
162
|
applyAdminAllowlist,
|
|
179
163
|
applyRequiredServers,
|
|
180
164
|
clearCachedCredentialFile,
|
|
@@ -254,7 +238,7 @@ import {
|
|
|
254
238
|
updatePolicy,
|
|
255
239
|
writeToStderr,
|
|
256
240
|
writeToStdout
|
|
257
|
-
} from "./chunk-
|
|
241
|
+
} from "./chunk-S3MXVTTY.js";
|
|
258
242
|
import "./chunk-664ZODQF.js";
|
|
259
243
|
import "./chunk-IUUIT4SU.js";
|
|
260
244
|
import "./chunk-TUDYL3X4.js";
|
|
@@ -5384,7 +5368,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5384
5368
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5385
5369
|
const isStdio = !!config.command;
|
|
5386
5370
|
if (isStdio && !isTrusted) {
|
|
5387
|
-
return
|
|
5371
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5388
5372
|
}
|
|
5389
5373
|
const client = new Client({
|
|
5390
5374
|
name: "mcp-test-client",
|
|
@@ -5420,7 +5404,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5420
5404
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5421
5405
|
} catch {
|
|
5422
5406
|
await client.close();
|
|
5423
|
-
return
|
|
5407
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5424
5408
|
}
|
|
5425
5409
|
try {
|
|
5426
5410
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5434,10 +5418,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5434
5418
|
);
|
|
5435
5419
|
}
|
|
5436
5420
|
await client.close();
|
|
5437
|
-
return
|
|
5421
|
+
return "connected" /* CONNECTED */;
|
|
5438
5422
|
} catch {
|
|
5439
5423
|
await transport.close();
|
|
5440
|
-
return
|
|
5424
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5441
5425
|
}
|
|
5442
5426
|
}
|
|
5443
5427
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5450,12 +5434,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5450
5434
|
});
|
|
5451
5435
|
if (!loadResult.allowed) {
|
|
5452
5436
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5453
|
-
return
|
|
5437
|
+
return "blocked" /* BLOCKED */;
|
|
5454
5438
|
}
|
|
5455
|
-
return
|
|
5439
|
+
return "disabled" /* DISABLED */;
|
|
5456
5440
|
}
|
|
5457
5441
|
if (!isTrusted) {
|
|
5458
|
-
return
|
|
5442
|
+
return "disabled" /* DISABLED */;
|
|
5459
5443
|
}
|
|
5460
5444
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5461
5445
|
}
|
|
@@ -5501,23 +5485,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5501
5485
|
let statusIndicator = "";
|
|
5502
5486
|
let statusText = "";
|
|
5503
5487
|
switch (status) {
|
|
5504
|
-
case
|
|
5488
|
+
case "connected" /* CONNECTED */:
|
|
5505
5489
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5506
5490
|
statusText = "Connected";
|
|
5507
5491
|
break;
|
|
5508
|
-
case
|
|
5492
|
+
case "connecting" /* CONNECTING */:
|
|
5509
5493
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5510
5494
|
statusText = "Connecting";
|
|
5511
5495
|
break;
|
|
5512
|
-
case
|
|
5496
|
+
case "blocked" /* BLOCKED */:
|
|
5513
5497
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5514
5498
|
statusText = "Blocked";
|
|
5515
5499
|
break;
|
|
5516
|
-
case
|
|
5500
|
+
case "disabled" /* DISABLED */:
|
|
5517
5501
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5518
5502
|
statusText = "Disabled";
|
|
5519
5503
|
break;
|
|
5520
|
-
case
|
|
5504
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5521
5505
|
default:
|
|
5522
5506
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5523
5507
|
statusText = "Disconnected";
|
|
@@ -5803,7 +5787,7 @@ async function handleInstall(args) {
|
|
|
5803
5787
|
);
|
|
5804
5788
|
if (confirmed) {
|
|
5805
5789
|
const trustedFolders = loadTrustedFolders();
|
|
5806
|
-
await trustedFolders.setValue(realPath,
|
|
5790
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5807
5791
|
} else {
|
|
5808
5792
|
throw new Error(
|
|
5809
5793
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7848,7 +7832,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7848
7832
|
}
|
|
7849
7833
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7850
7834
|
const packageJson = await getPackageJson(__dirname3);
|
|
7851
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.57.0
|
|
7835
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.57.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7852
7836
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7853
7837
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7854
7838
|
}
|
|
@@ -7907,9 +7891,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7907
7891
|
cwd,
|
|
7908
7892
|
potentialWorkspacePoliciesDir
|
|
7909
7893
|
);
|
|
7910
|
-
if (integrityResult.status ===
|
|
7894
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7911
7895
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7912
|
-
} else if (integrityResult.status ===
|
|
7896
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7913
7897
|
workspacePoliciesDir = void 0;
|
|
7914
7898
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7915
7899
|
policyUpdateConfirmationRequest = {
|
|
@@ -8337,23 +8321,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8337
8321
|
if (rawApprovalMode) {
|
|
8338
8322
|
switch (rawApprovalMode) {
|
|
8339
8323
|
case "yolo":
|
|
8340
|
-
approvalMode =
|
|
8324
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8341
8325
|
break;
|
|
8342
8326
|
case "auto_edit":
|
|
8343
|
-
approvalMode =
|
|
8327
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8344
8328
|
break;
|
|
8345
8329
|
case "plan":
|
|
8346
8330
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8347
8331
|
debugLogger.warn(
|
|
8348
8332
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8349
8333
|
);
|
|
8350
|
-
approvalMode =
|
|
8334
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8351
8335
|
} else {
|
|
8352
|
-
approvalMode =
|
|
8336
|
+
approvalMode = "plan" /* PLAN */;
|
|
8353
8337
|
}
|
|
8354
8338
|
break;
|
|
8355
8339
|
case "default":
|
|
8356
|
-
approvalMode =
|
|
8340
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8357
8341
|
break;
|
|
8358
8342
|
default:
|
|
8359
8343
|
throw new Error(
|
|
@@ -8361,10 +8345,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8361
8345
|
);
|
|
8362
8346
|
}
|
|
8363
8347
|
} else {
|
|
8364
|
-
approvalMode =
|
|
8348
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8365
8349
|
}
|
|
8366
8350
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8367
|
-
if (approvalMode ===
|
|
8351
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8368
8352
|
if (settings.admin?.secureModeEnabled) {
|
|
8369
8353
|
debugLogger.error(
|
|
8370
8354
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8382,16 +8366,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8382
8366
|
)
|
|
8383
8367
|
);
|
|
8384
8368
|
}
|
|
8385
|
-
} else if (approvalMode ===
|
|
8369
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8386
8370
|
debugLogger.warn(
|
|
8387
8371
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8388
8372
|
);
|
|
8389
8373
|
}
|
|
8390
|
-
if (!trustedFolder && approvalMode !==
|
|
8374
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8391
8375
|
debugLogger.warn(
|
|
8392
8376
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8393
8377
|
);
|
|
8394
|
-
approvalMode =
|
|
8378
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8395
8379
|
}
|
|
8396
8380
|
let telemetrySettings;
|
|
8397
8381
|
try {
|
|
@@ -10428,7 +10412,7 @@ import path9 from "node:path";
|
|
|
10428
10412
|
import process4 from "node:process";
|
|
10429
10413
|
var homeDirectoryCheck = {
|
|
10430
10414
|
id: "home-directory",
|
|
10431
|
-
priority:
|
|
10415
|
+
priority: "low" /* Low */,
|
|
10432
10416
|
check: async (workspaceRoot, settings) => {
|
|
10433
10417
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
10434
10418
|
return null;
|
|
@@ -10452,7 +10436,7 @@ var homeDirectoryCheck = {
|
|
|
10452
10436
|
};
|
|
10453
10437
|
var rootDirectoryCheck = {
|
|
10454
10438
|
id: "root-directory",
|
|
10455
|
-
priority:
|
|
10439
|
+
priority: "high" /* High */,
|
|
10456
10440
|
check: async (workspaceRoot, _settings) => {
|
|
10457
10441
|
try {
|
|
10458
10442
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -10468,7 +10452,7 @@ var rootDirectoryCheck = {
|
|
|
10468
10452
|
};
|
|
10469
10453
|
var folderTrustCheck = {
|
|
10470
10454
|
id: "folder-trust",
|
|
10471
|
-
priority:
|
|
10455
|
+
priority: "high" /* High */,
|
|
10472
10456
|
check: async (workspaceRoot, settings) => {
|
|
10473
10457
|
if (!isFolderTrustEnabled(settings)) {
|
|
10474
10458
|
return null;
|
|
@@ -10658,12 +10642,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10658
10642
|
error,
|
|
10659
10643
|
config.getContentGeneratorConfig()?.authType
|
|
10660
10644
|
);
|
|
10661
|
-
if (config.getOutputFormat() ===
|
|
10645
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10662
10646
|
const streamFormatter = new StreamJsonFormatter();
|
|
10663
10647
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10664
10648
|
const metrics = uiTelemetryService.getMetrics();
|
|
10665
10649
|
streamFormatter.emitEvent({
|
|
10666
|
-
type:
|
|
10650
|
+
type: "result" /* RESULT */,
|
|
10667
10651
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10668
10652
|
status: "error",
|
|
10669
10653
|
error: {
|
|
@@ -10674,7 +10658,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10674
10658
|
});
|
|
10675
10659
|
runSyncCleanup();
|
|
10676
10660
|
process.exit(getNumericExitCode(errorCode));
|
|
10677
|
-
} else if (config.getOutputFormat() ===
|
|
10661
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10678
10662
|
const formatter = new JsonFormatter();
|
|
10679
10663
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10680
10664
|
const formattedError = formatter.formatError(
|
|
@@ -10694,11 +10678,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10694
10678
|
const isFatal = isFatalToolError(errorType);
|
|
10695
10679
|
if (isFatal) {
|
|
10696
10680
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10697
|
-
if (config.getOutputFormat() ===
|
|
10681
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10698
10682
|
const streamFormatter = new StreamJsonFormatter();
|
|
10699
10683
|
const metrics = uiTelemetryService.getMetrics();
|
|
10700
10684
|
streamFormatter.emitEvent({
|
|
10701
|
-
type:
|
|
10685
|
+
type: "result" /* RESULT */,
|
|
10702
10686
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10703
10687
|
status: "error",
|
|
10704
10688
|
error: {
|
|
@@ -10707,7 +10691,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10707
10691
|
},
|
|
10708
10692
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10709
10693
|
});
|
|
10710
|
-
} else if (config.getOutputFormat() ===
|
|
10694
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10711
10695
|
const formatter = new JsonFormatter();
|
|
10712
10696
|
const formattedError = formatter.formatError(
|
|
10713
10697
|
toolExecutionError,
|
|
@@ -10725,11 +10709,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10725
10709
|
}
|
|
10726
10710
|
function handleCancellationError(config) {
|
|
10727
10711
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10728
|
-
if (config.getOutputFormat() ===
|
|
10712
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10729
10713
|
const streamFormatter = new StreamJsonFormatter();
|
|
10730
10714
|
const metrics = uiTelemetryService.getMetrics();
|
|
10731
10715
|
streamFormatter.emitEvent({
|
|
10732
|
-
type:
|
|
10716
|
+
type: "result" /* RESULT */,
|
|
10733
10717
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10734
10718
|
status: "error",
|
|
10735
10719
|
error: {
|
|
@@ -10740,7 +10724,7 @@ function handleCancellationError(config) {
|
|
|
10740
10724
|
});
|
|
10741
10725
|
runSyncCleanup();
|
|
10742
10726
|
process.exit(cancellationError.exitCode);
|
|
10743
|
-
} else if (config.getOutputFormat() ===
|
|
10727
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10744
10728
|
const formatter = new JsonFormatter();
|
|
10745
10729
|
const formattedError = formatter.formatError(
|
|
10746
10730
|
cancellationError,
|
|
@@ -10760,11 +10744,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10760
10744
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10761
10745
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10762
10746
|
);
|
|
10763
|
-
if (config.getOutputFormat() ===
|
|
10747
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10764
10748
|
const streamFormatter = new StreamJsonFormatter();
|
|
10765
10749
|
const metrics = uiTelemetryService.getMetrics();
|
|
10766
10750
|
streamFormatter.emitEvent({
|
|
10767
|
-
type:
|
|
10751
|
+
type: "result" /* RESULT */,
|
|
10768
10752
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10769
10753
|
status: "error",
|
|
10770
10754
|
error: {
|
|
@@ -10775,7 +10759,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10775
10759
|
});
|
|
10776
10760
|
runSyncCleanup();
|
|
10777
10761
|
process.exit(maxTurnsError.exitCode);
|
|
10778
|
-
} else if (config.getOutputFormat() ===
|
|
10762
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10779
10763
|
const formatter = new JsonFormatter();
|
|
10780
10764
|
const formattedError = formatter.formatError(
|
|
10781
10765
|
maxTurnsError,
|
|
@@ -10855,7 +10839,7 @@ async function runNonInteractive({
|
|
|
10855
10839
|
}
|
|
10856
10840
|
});
|
|
10857
10841
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10858
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10842
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-VQSLUOYF.js");
|
|
10859
10843
|
setupInitialActivityLogger(config);
|
|
10860
10844
|
}
|
|
10861
10845
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10871,7 +10855,7 @@ async function runNonInteractive({
|
|
|
10871
10855
|
}
|
|
10872
10856
|
};
|
|
10873
10857
|
const startTime = Date.now();
|
|
10874
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10858
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10875
10859
|
const abortController = new AbortController();
|
|
10876
10860
|
let isAborting = false;
|
|
10877
10861
|
let cancelMessageTimer = null;
|
|
@@ -10924,13 +10908,13 @@ async function runNonInteractive({
|
|
|
10924
10908
|
};
|
|
10925
10909
|
try {
|
|
10926
10910
|
consolePatcher.patch();
|
|
10927
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10911
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10928
10912
|
process.stderr.write(
|
|
10929
10913
|
"[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"
|
|
10930
10914
|
);
|
|
10931
10915
|
}
|
|
10932
10916
|
setupStdinCancellation();
|
|
10933
|
-
coreEvents.on(
|
|
10917
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10934
10918
|
coreEvents.drainBacklogs();
|
|
10935
10919
|
process.stdout.on("error", (err) => {
|
|
10936
10920
|
if (err.code === "EPIPE") {
|
|
@@ -10956,7 +10940,7 @@ async function runNonInteractive({
|
|
|
10956
10940
|
}
|
|
10957
10941
|
if (streamFormatter) {
|
|
10958
10942
|
streamFormatter.emitEvent({
|
|
10959
|
-
type:
|
|
10943
|
+
type: "init" /* INIT */,
|
|
10960
10944
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10961
10945
|
session_id: config.getSessionId(),
|
|
10962
10946
|
model: config.getModel()
|
|
@@ -10994,7 +10978,7 @@ async function runNonInteractive({
|
|
|
10994
10978
|
}
|
|
10995
10979
|
if (streamFormatter) {
|
|
10996
10980
|
streamFormatter.emitEvent({
|
|
10997
|
-
type:
|
|
10981
|
+
type: "message" /* MESSAGE */,
|
|
10998
10982
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10999
10983
|
role: "user",
|
|
11000
10984
|
content: input
|
|
@@ -11033,12 +11017,12 @@ async function runNonInteractive({
|
|
|
11033
11017
|
const metrics = uiTelemetryService.getMetrics();
|
|
11034
11018
|
const durationMs = Date.now() - startTime;
|
|
11035
11019
|
streamFormatter.emitEvent({
|
|
11036
|
-
type:
|
|
11020
|
+
type: "result" /* RESULT */,
|
|
11037
11021
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11038
11022
|
status: errorPayload ? "error" : "success",
|
|
11039
11023
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11040
11024
|
});
|
|
11041
|
-
} else if (config.getOutputFormat() ===
|
|
11025
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11042
11026
|
const formatter = new JsonFormatter();
|
|
11043
11027
|
const stats = uiTelemetryService.getMetrics();
|
|
11044
11028
|
textOutput.write(
|
|
@@ -11131,13 +11115,13 @@ async function runNonInteractive({
|
|
|
11131
11115
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
11132
11116
|
if (streamFormatter) {
|
|
11133
11117
|
streamFormatter.emitEvent({
|
|
11134
|
-
type:
|
|
11118
|
+
type: "message" /* MESSAGE */,
|
|
11135
11119
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11136
11120
|
role: "assistant",
|
|
11137
11121
|
content: output,
|
|
11138
11122
|
delta: true
|
|
11139
11123
|
});
|
|
11140
|
-
} else if (config.getOutputFormat() ===
|
|
11124
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11141
11125
|
responseText += output;
|
|
11142
11126
|
} else {
|
|
11143
11127
|
if (part.text) {
|
|
@@ -11150,13 +11134,13 @@ async function runNonInteractive({
|
|
|
11150
11134
|
break;
|
|
11151
11135
|
}
|
|
11152
11136
|
case "tool_request": {
|
|
11153
|
-
if (config.getOutputFormat() ===
|
|
11137
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11154
11138
|
preToolResponseText = responseText || preToolResponseText;
|
|
11155
11139
|
responseText = "";
|
|
11156
11140
|
}
|
|
11157
11141
|
if (streamFormatter) {
|
|
11158
11142
|
streamFormatter.emitEvent({
|
|
11159
|
-
type:
|
|
11143
|
+
type: "tool_use" /* TOOL_USE */,
|
|
11160
11144
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11161
11145
|
tool_name: event.name,
|
|
11162
11146
|
tool_id: event.requestId,
|
|
@@ -11172,7 +11156,7 @@ async function runNonInteractive({
|
|
|
11172
11156
|
const displayText = displayContentToString(display);
|
|
11173
11157
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11174
11158
|
streamFormatter.emitEvent({
|
|
11175
|
-
type:
|
|
11159
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11176
11160
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11177
11161
|
tool_id: event.requestId,
|
|
11178
11162
|
status: event.isError ? "error" : "success",
|
|
@@ -11187,17 +11171,17 @@ async function runNonInteractive({
|
|
|
11187
11171
|
const display = event.display?.result;
|
|
11188
11172
|
const displayText = displayContentToString(display);
|
|
11189
11173
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11190
|
-
if (event.data?.["errorType"] ===
|
|
11191
|
-
if (config.getOutputFormat() ===
|
|
11174
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
11175
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
11192
11176
|
responseText = preToolResponseText;
|
|
11193
11177
|
}
|
|
11194
11178
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
11195
|
-
if (config.getOutputFormat() ===
|
|
11179
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11196
11180
|
process.stderr.write(`${stopMessage}
|
|
11197
11181
|
`);
|
|
11198
11182
|
}
|
|
11199
11183
|
}
|
|
11200
|
-
if (event.data?.["errorType"] ===
|
|
11184
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
11201
11185
|
throw new FatalToolExecutionError(
|
|
11202
11186
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
11203
11187
|
);
|
|
@@ -11232,12 +11216,12 @@ async function runNonInteractive({
|
|
|
11232
11216
|
}
|
|
11233
11217
|
if (streamFormatter) {
|
|
11234
11218
|
streamFormatter.emitEvent({
|
|
11235
|
-
type:
|
|
11219
|
+
type: "error" /* ERROR */,
|
|
11236
11220
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11237
11221
|
severity: "error",
|
|
11238
11222
|
message: errorMessage
|
|
11239
11223
|
});
|
|
11240
|
-
} else if (config.getOutputFormat() ===
|
|
11224
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11241
11225
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
11242
11226
|
`);
|
|
11243
11227
|
}
|
|
@@ -11258,12 +11242,12 @@ async function runNonInteractive({
|
|
|
11258
11242
|
const errorCode = event._meta?.["code"];
|
|
11259
11243
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
11260
11244
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
11261
|
-
if (config.getOutputFormat() ===
|
|
11245
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11262
11246
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11263
11247
|
`);
|
|
11264
11248
|
} else if (streamFormatter) {
|
|
11265
11249
|
streamFormatter.emitEvent({
|
|
11266
|
-
type:
|
|
11250
|
+
type: "error" /* ERROR */,
|
|
11267
11251
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11268
11252
|
severity: "warning",
|
|
11269
11253
|
message: stripAnsi(blockMessage)
|
|
@@ -11273,13 +11257,13 @@ async function runNonInteractive({
|
|
|
11273
11257
|
break;
|
|
11274
11258
|
}
|
|
11275
11259
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
11276
|
-
if (config.getOutputFormat() ===
|
|
11260
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11277
11261
|
process.stderr.write(`[WARNING] ${event.message}
|
|
11278
11262
|
`);
|
|
11279
11263
|
}
|
|
11280
11264
|
if (streamFormatter) {
|
|
11281
11265
|
streamFormatter.emitEvent({
|
|
11282
|
-
type:
|
|
11266
|
+
type: "error" /* ERROR */,
|
|
11283
11267
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11284
11268
|
severity,
|
|
11285
11269
|
message: stripAnsi(event.message)
|
|
@@ -11299,7 +11283,7 @@ async function runNonInteractive({
|
|
|
11299
11283
|
);
|
|
11300
11284
|
} else if (streamFormatter) {
|
|
11301
11285
|
streamFormatter.emitEvent({
|
|
11302
|
-
type:
|
|
11286
|
+
type: "error" /* ERROR */,
|
|
11303
11287
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11304
11288
|
severity: "error",
|
|
11305
11289
|
message: "Maximum session turns exceeded"
|
|
@@ -11307,7 +11291,7 @@ async function runNonInteractive({
|
|
|
11307
11291
|
}
|
|
11308
11292
|
}
|
|
11309
11293
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
11310
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
11294
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11311
11295
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
11312
11296
|
`);
|
|
11313
11297
|
}
|
|
@@ -11337,7 +11321,7 @@ async function runNonInteractive({
|
|
|
11337
11321
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
11338
11322
|
scheduler?.dispose();
|
|
11339
11323
|
consolePatcher.cleanup();
|
|
11340
|
-
coreEvents.off(
|
|
11324
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11341
11325
|
}
|
|
11342
11326
|
if (errorToHandle) {
|
|
11343
11327
|
handleError(errorToHandle, config);
|
|
@@ -11365,7 +11349,7 @@ async function runNonInteractive2(params) {
|
|
|
11365
11349
|
}
|
|
11366
11350
|
});
|
|
11367
11351
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11368
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11352
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-VQSLUOYF.js");
|
|
11369
11353
|
setupInitialActivityLogger(config);
|
|
11370
11354
|
}
|
|
11371
11355
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11381,7 +11365,7 @@ async function runNonInteractive2(params) {
|
|
|
11381
11365
|
}
|
|
11382
11366
|
};
|
|
11383
11367
|
const startTime = Date.now();
|
|
11384
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11368
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
11385
11369
|
const abortController = new AbortController();
|
|
11386
11370
|
let isAborting = false;
|
|
11387
11371
|
let cancelMessageTimer = null;
|
|
@@ -11432,13 +11416,13 @@ async function runNonInteractive2(params) {
|
|
|
11432
11416
|
let scheduler;
|
|
11433
11417
|
try {
|
|
11434
11418
|
consolePatcher.patch();
|
|
11435
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11419
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11436
11420
|
process.stderr.write(
|
|
11437
11421
|
"[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"
|
|
11438
11422
|
);
|
|
11439
11423
|
}
|
|
11440
11424
|
setupStdinCancellation();
|
|
11441
|
-
coreEvents.on(
|
|
11425
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11442
11426
|
coreEvents.drainBacklogs();
|
|
11443
11427
|
process.stdout.on("error", (err) => {
|
|
11444
11428
|
if (err.code === "EPIPE") {
|
|
@@ -11462,7 +11446,7 @@ async function runNonInteractive2(params) {
|
|
|
11462
11446
|
}
|
|
11463
11447
|
if (streamFormatter) {
|
|
11464
11448
|
streamFormatter.emitEvent({
|
|
11465
|
-
type:
|
|
11449
|
+
type: "init" /* INIT */,
|
|
11466
11450
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11467
11451
|
session_id: config.getSessionId(),
|
|
11468
11452
|
model: config.getModel()
|
|
@@ -11500,7 +11484,7 @@ async function runNonInteractive2(params) {
|
|
|
11500
11484
|
}
|
|
11501
11485
|
if (streamFormatter) {
|
|
11502
11486
|
streamFormatter.emitEvent({
|
|
11503
|
-
type:
|
|
11487
|
+
type: "message" /* MESSAGE */,
|
|
11504
11488
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11505
11489
|
role: "user",
|
|
11506
11490
|
content: input
|
|
@@ -11528,28 +11512,28 @@ async function runNonInteractive2(params) {
|
|
|
11528
11512
|
if (abortController.signal.aborted) {
|
|
11529
11513
|
handleCancellationError(config);
|
|
11530
11514
|
}
|
|
11531
|
-
if (event.type ===
|
|
11515
|
+
if (event.type === "content" /* Content */) {
|
|
11532
11516
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
11533
11517
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
11534
11518
|
if (streamFormatter) {
|
|
11535
11519
|
streamFormatter.emitEvent({
|
|
11536
|
-
type:
|
|
11520
|
+
type: "message" /* MESSAGE */,
|
|
11537
11521
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11538
11522
|
role: "assistant",
|
|
11539
11523
|
content: output,
|
|
11540
11524
|
delta: true
|
|
11541
11525
|
});
|
|
11542
|
-
} else if (config.getOutputFormat() ===
|
|
11526
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11543
11527
|
responseText += output;
|
|
11544
11528
|
} else {
|
|
11545
11529
|
if (event.value) {
|
|
11546
11530
|
textOutput.write(output);
|
|
11547
11531
|
}
|
|
11548
11532
|
}
|
|
11549
|
-
} else if (event.type ===
|
|
11533
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
11550
11534
|
if (streamFormatter) {
|
|
11551
11535
|
streamFormatter.emitEvent({
|
|
11552
|
-
type:
|
|
11536
|
+
type: "tool_use" /* TOOL_USE */,
|
|
11553
11537
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11554
11538
|
tool_name: event.value.name,
|
|
11555
11539
|
tool_id: event.value.callId,
|
|
@@ -11557,33 +11541,33 @@ async function runNonInteractive2(params) {
|
|
|
11557
11541
|
});
|
|
11558
11542
|
}
|
|
11559
11543
|
toolCallRequests.push(event.value);
|
|
11560
|
-
} else if (event.type ===
|
|
11544
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
11561
11545
|
const message = "Loop detected, stopping execution";
|
|
11562
11546
|
if (streamFormatter) {
|
|
11563
11547
|
streamFormatter.emitEvent({
|
|
11564
|
-
type:
|
|
11548
|
+
type: "error" /* ERROR */,
|
|
11565
11549
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11566
11550
|
severity: "warning",
|
|
11567
11551
|
message
|
|
11568
11552
|
});
|
|
11569
11553
|
}
|
|
11570
11554
|
warnings.push(message);
|
|
11571
|
-
} else if (event.type ===
|
|
11555
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
11572
11556
|
const message = "Maximum session turns exceeded";
|
|
11573
11557
|
if (streamFormatter) {
|
|
11574
11558
|
streamFormatter.emitEvent({
|
|
11575
|
-
type:
|
|
11559
|
+
type: "error" /* ERROR */,
|
|
11576
11560
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11577
11561
|
severity: "error",
|
|
11578
11562
|
message
|
|
11579
11563
|
});
|
|
11580
11564
|
}
|
|
11581
11565
|
warnings.push(message);
|
|
11582
|
-
} else if (event.type ===
|
|
11566
|
+
} else if (event.type === "error" /* Error */) {
|
|
11583
11567
|
throw event.value.error;
|
|
11584
|
-
} else if (event.type ===
|
|
11568
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
11585
11569
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
11586
|
-
if (config.getOutputFormat() ===
|
|
11570
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11587
11571
|
process.stderr.write(`${stopMessage}
|
|
11588
11572
|
`);
|
|
11589
11573
|
}
|
|
@@ -11591,7 +11575,7 @@ async function runNonInteractive2(params) {
|
|
|
11591
11575
|
const metrics = uiTelemetryService.getMetrics();
|
|
11592
11576
|
const durationMs = Date.now() - startTime;
|
|
11593
11577
|
streamFormatter.emitEvent({
|
|
11594
|
-
type:
|
|
11578
|
+
type: "result" /* RESULT */,
|
|
11595
11579
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11596
11580
|
status: "success",
|
|
11597
11581
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11599,7 +11583,7 @@ async function runNonInteractive2(params) {
|
|
|
11599
11583
|
durationMs
|
|
11600
11584
|
)
|
|
11601
11585
|
});
|
|
11602
|
-
} else if (config.getOutputFormat() ===
|
|
11586
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11603
11587
|
const formatter = new JsonFormatter();
|
|
11604
11588
|
const stats = uiTelemetryService.getMetrics();
|
|
11605
11589
|
textOutput.write(
|
|
@@ -11615,21 +11599,21 @@ async function runNonInteractive2(params) {
|
|
|
11615
11599
|
textOutput.ensureTrailingNewline();
|
|
11616
11600
|
}
|
|
11617
11601
|
return;
|
|
11618
|
-
} else if (event.type ===
|
|
11602
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
11619
11603
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
11620
|
-
if (config.getOutputFormat() ===
|
|
11604
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11621
11605
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11622
11606
|
`);
|
|
11623
11607
|
} else if (streamFormatter) {
|
|
11624
11608
|
streamFormatter.emitEvent({
|
|
11625
|
-
type:
|
|
11609
|
+
type: "error" /* ERROR */,
|
|
11626
11610
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11627
11611
|
severity: "warning",
|
|
11628
11612
|
message: stripAnsi(blockMessage)
|
|
11629
11613
|
});
|
|
11630
11614
|
}
|
|
11631
11615
|
warnings.push(blockMessage);
|
|
11632
|
-
} else if (event.type ===
|
|
11616
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
11633
11617
|
const eventValue = event.value;
|
|
11634
11618
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
11635
11619
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -11652,12 +11636,12 @@ async function runNonInteractive2(params) {
|
|
|
11652
11636
|
);
|
|
11653
11637
|
if (streamFormatter) {
|
|
11654
11638
|
streamFormatter.emitEvent({
|
|
11655
|
-
type:
|
|
11639
|
+
type: "error" /* ERROR */,
|
|
11656
11640
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11657
11641
|
severity: "error",
|
|
11658
11642
|
message: invalidStreamError
|
|
11659
11643
|
});
|
|
11660
|
-
} else if (config.getOutputFormat() ===
|
|
11644
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11661
11645
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
11662
11646
|
`);
|
|
11663
11647
|
}
|
|
@@ -11677,7 +11661,7 @@ async function runNonInteractive2(params) {
|
|
|
11677
11661
|
const requestInfo = completedToolCall.request;
|
|
11678
11662
|
if (streamFormatter) {
|
|
11679
11663
|
streamFormatter.emitEvent({
|
|
11680
|
-
type:
|
|
11664
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11681
11665
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11682
11666
|
tool_id: requestInfo.callId,
|
|
11683
11667
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11711,11 +11695,11 @@ async function runNonInteractive2(params) {
|
|
|
11711
11695
|
);
|
|
11712
11696
|
}
|
|
11713
11697
|
const stopExecutionTool = completedToolCalls.find(
|
|
11714
|
-
(tc) => tc.response.errorType ===
|
|
11698
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
11715
11699
|
);
|
|
11716
11700
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11717
11701
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11718
|
-
if (config.getOutputFormat() ===
|
|
11702
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11719
11703
|
process.stderr.write(`${stopMessage}
|
|
11720
11704
|
`);
|
|
11721
11705
|
}
|
|
@@ -11723,7 +11707,7 @@ async function runNonInteractive2(params) {
|
|
|
11723
11707
|
const metrics = uiTelemetryService.getMetrics();
|
|
11724
11708
|
const durationMs = Date.now() - startTime;
|
|
11725
11709
|
streamFormatter.emitEvent({
|
|
11726
|
-
type:
|
|
11710
|
+
type: "result" /* RESULT */,
|
|
11727
11711
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11728
11712
|
status: "success",
|
|
11729
11713
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11731,7 +11715,7 @@ async function runNonInteractive2(params) {
|
|
|
11731
11715
|
durationMs
|
|
11732
11716
|
)
|
|
11733
11717
|
});
|
|
11734
|
-
} else if (config.getOutputFormat() ===
|
|
11718
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11735
11719
|
const formatter = new JsonFormatter();
|
|
11736
11720
|
const stats = uiTelemetryService.getMetrics();
|
|
11737
11721
|
textOutput.write(
|
|
@@ -11754,12 +11738,12 @@ async function runNonInteractive2(params) {
|
|
|
11754
11738
|
const metrics = uiTelemetryService.getMetrics();
|
|
11755
11739
|
const durationMs = Date.now() - startTime;
|
|
11756
11740
|
streamFormatter.emitEvent({
|
|
11757
|
-
type:
|
|
11741
|
+
type: "result" /* RESULT */,
|
|
11758
11742
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11759
11743
|
status: invalidStreamError ? "error" : "success",
|
|
11760
11744
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11761
11745
|
});
|
|
11762
|
-
} else if (config.getOutputFormat() ===
|
|
11746
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11763
11747
|
const formatter = new JsonFormatter();
|
|
11764
11748
|
const stats = uiTelemetryService.getMetrics();
|
|
11765
11749
|
textOutput.write(
|
|
@@ -11783,7 +11767,7 @@ async function runNonInteractive2(params) {
|
|
|
11783
11767
|
cleanupStdinCancellation();
|
|
11784
11768
|
scheduler?.dispose();
|
|
11785
11769
|
consolePatcher.cleanup();
|
|
11786
|
-
coreEvents.off(
|
|
11770
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11787
11771
|
}
|
|
11788
11772
|
if (errorToHandle) {
|
|
11789
11773
|
handleError(errorToHandle, config);
|
|
@@ -14174,12 +14158,12 @@ function toToolCallContent(toolResult) {
|
|
|
14174
14158
|
}
|
|
14175
14159
|
var basicPermissionOptions = [
|
|
14176
14160
|
{
|
|
14177
|
-
optionId:
|
|
14161
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14178
14162
|
name: "Allow",
|
|
14179
14163
|
kind: "allow_once"
|
|
14180
14164
|
},
|
|
14181
14165
|
{
|
|
14182
|
-
optionId:
|
|
14166
|
+
optionId: "cancel" /* Cancel */,
|
|
14183
14167
|
name: "Reject",
|
|
14184
14168
|
kind: "reject_once"
|
|
14185
14169
|
}
|
|
@@ -14191,13 +14175,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14191
14175
|
switch (confirmation.type) {
|
|
14192
14176
|
case "edit":
|
|
14193
14177
|
options.push({
|
|
14194
|
-
optionId:
|
|
14178
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14195
14179
|
name: "Allow for this session",
|
|
14196
14180
|
kind: "allow_always"
|
|
14197
14181
|
});
|
|
14198
14182
|
if (enablePermanentToolApproval) {
|
|
14199
14183
|
options.push({
|
|
14200
|
-
optionId:
|
|
14184
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14201
14185
|
name: "Allow for this file in all future sessions",
|
|
14202
14186
|
kind: "allow_always"
|
|
14203
14187
|
});
|
|
@@ -14205,13 +14189,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14205
14189
|
break;
|
|
14206
14190
|
case "exec":
|
|
14207
14191
|
options.push({
|
|
14208
|
-
optionId:
|
|
14192
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14209
14193
|
name: "Allow for this session",
|
|
14210
14194
|
kind: "allow_always"
|
|
14211
14195
|
});
|
|
14212
14196
|
if (enablePermanentToolApproval) {
|
|
14213
14197
|
options.push({
|
|
14214
|
-
optionId:
|
|
14198
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14215
14199
|
name: "Allow this command for all future sessions",
|
|
14216
14200
|
kind: "allow_always"
|
|
14217
14201
|
});
|
|
@@ -14220,19 +14204,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14220
14204
|
case "mcp":
|
|
14221
14205
|
options.push(
|
|
14222
14206
|
{
|
|
14223
|
-
optionId:
|
|
14207
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
14224
14208
|
name: "Allow all server tools for this session",
|
|
14225
14209
|
kind: "allow_always"
|
|
14226
14210
|
},
|
|
14227
14211
|
{
|
|
14228
|
-
optionId:
|
|
14212
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
14229
14213
|
name: "Allow tool for this session",
|
|
14230
14214
|
kind: "allow_always"
|
|
14231
14215
|
}
|
|
14232
14216
|
);
|
|
14233
14217
|
if (enablePermanentToolApproval) {
|
|
14234
14218
|
options.push({
|
|
14235
|
-
optionId:
|
|
14219
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14236
14220
|
name: "Allow tool for all future sessions",
|
|
14237
14221
|
kind: "allow_always"
|
|
14238
14222
|
});
|
|
@@ -14240,13 +14224,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14240
14224
|
break;
|
|
14241
14225
|
case "info":
|
|
14242
14226
|
options.push({
|
|
14243
|
-
optionId:
|
|
14227
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14244
14228
|
name: "Allow for this session",
|
|
14245
14229
|
kind: "allow_always"
|
|
14246
14230
|
});
|
|
14247
14231
|
if (enablePermanentToolApproval) {
|
|
14248
14232
|
options.push({
|
|
14249
|
-
optionId:
|
|
14233
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14250
14234
|
name: "Allow for all future sessions",
|
|
14251
14235
|
kind: "allow_always"
|
|
14252
14236
|
});
|
|
@@ -14278,21 +14262,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14278
14262
|
}
|
|
14279
14263
|
function toAcpToolKind(kind) {
|
|
14280
14264
|
switch (kind) {
|
|
14281
|
-
case
|
|
14282
|
-
case
|
|
14283
|
-
case
|
|
14284
|
-
case
|
|
14285
|
-
case
|
|
14286
|
-
case
|
|
14287
|
-
case
|
|
14288
|
-
case
|
|
14289
|
-
case
|
|
14290
|
-
case
|
|
14265
|
+
case "read" /* Read */:
|
|
14266
|
+
case "edit" /* Edit */:
|
|
14267
|
+
case "execute" /* Execute */:
|
|
14268
|
+
case "search" /* Search */:
|
|
14269
|
+
case "delete" /* Delete */:
|
|
14270
|
+
case "move" /* Move */:
|
|
14271
|
+
case "think" /* Think */:
|
|
14272
|
+
case "fetch" /* Fetch */:
|
|
14273
|
+
case "switch_mode" /* SwitchMode */:
|
|
14274
|
+
case "other" /* Other */:
|
|
14291
14275
|
return kind;
|
|
14292
|
-
case
|
|
14276
|
+
case "agent" /* Agent */:
|
|
14293
14277
|
return "think";
|
|
14294
|
-
case
|
|
14295
|
-
case
|
|
14278
|
+
case "plan" /* Plan */:
|
|
14279
|
+
case "communicate" /* Communicate */:
|
|
14296
14280
|
default:
|
|
14297
14281
|
return "other";
|
|
14298
14282
|
}
|
|
@@ -14300,24 +14284,24 @@ function toAcpToolKind(kind) {
|
|
|
14300
14284
|
function buildAvailableModes(isPlanEnabled) {
|
|
14301
14285
|
const modes = [
|
|
14302
14286
|
{
|
|
14303
|
-
id:
|
|
14287
|
+
id: "default" /* DEFAULT */,
|
|
14304
14288
|
name: "Default",
|
|
14305
14289
|
description: "Prompts for approval"
|
|
14306
14290
|
},
|
|
14307
14291
|
{
|
|
14308
|
-
id:
|
|
14292
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
14309
14293
|
name: "Auto Edit",
|
|
14310
14294
|
description: "Auto-approves edit tools"
|
|
14311
14295
|
},
|
|
14312
14296
|
{
|
|
14313
|
-
id:
|
|
14297
|
+
id: "yolo" /* YOLO */,
|
|
14314
14298
|
name: "YOLO",
|
|
14315
14299
|
description: "Auto-approves all tools"
|
|
14316
14300
|
}
|
|
14317
14301
|
];
|
|
14318
14302
|
if (isPlanEnabled) {
|
|
14319
14303
|
modes.push({
|
|
14320
|
-
id:
|
|
14304
|
+
id: "plan" /* PLAN */,
|
|
14321
14305
|
name: "Plan",
|
|
14322
14306
|
description: "Read-only mode"
|
|
14323
14307
|
});
|
|
@@ -14330,7 +14314,7 @@ function buildAvailableModels(config, settings) {
|
|
|
14330
14314
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
14331
14315
|
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
|
|
14332
14316
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
14333
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
14317
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
14334
14318
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
14335
14319
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
14336
14320
|
useGemini3_1: useGemini31,
|
|
@@ -14416,11 +14400,11 @@ var Session = class {
|
|
|
14416
14400
|
this.connection = connection;
|
|
14417
14401
|
this.settings = settings;
|
|
14418
14402
|
coreEvents.on(
|
|
14419
|
-
|
|
14403
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
14420
14404
|
this.handleApprovalModeChanged
|
|
14421
14405
|
);
|
|
14422
14406
|
this.context.config.getMessageBus()?.subscribe(
|
|
14423
|
-
|
|
14407
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
14424
14408
|
this.handleToolConfirmationRequest,
|
|
14425
14409
|
{ signal: this.disposeController.signal }
|
|
14426
14410
|
);
|
|
@@ -14444,7 +14428,7 @@ var Session = class {
|
|
|
14444
14428
|
"Policy engine missing. Denying tool confirmation request."
|
|
14445
14429
|
);
|
|
14446
14430
|
await messageBus.publish({
|
|
14447
|
-
type:
|
|
14431
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14448
14432
|
correlationId: request.correlationId,
|
|
14449
14433
|
confirmed: false,
|
|
14450
14434
|
requiresUserConfirmation: false
|
|
@@ -14457,7 +14441,7 @@ var Session = class {
|
|
|
14457
14441
|
"Tool confirmation request missing tool name. Denying."
|
|
14458
14442
|
);
|
|
14459
14443
|
await messageBus.publish({
|
|
14460
|
-
type:
|
|
14444
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14461
14445
|
correlationId: request.correlationId,
|
|
14462
14446
|
confirmed: false,
|
|
14463
14447
|
requiresUserConfirmation: false
|
|
@@ -14470,7 +14454,7 @@ var Session = class {
|
|
|
14470
14454
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
14471
14455
|
);
|
|
14472
14456
|
await messageBus.publish({
|
|
14473
|
-
type:
|
|
14457
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14474
14458
|
correlationId: request.correlationId,
|
|
14475
14459
|
confirmed: false,
|
|
14476
14460
|
requiresUserConfirmation: false
|
|
@@ -14486,15 +14470,15 @@ var Session = class {
|
|
|
14486
14470
|
request.subagent
|
|
14487
14471
|
);
|
|
14488
14472
|
await messageBus.publish({
|
|
14489
|
-
type:
|
|
14473
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14490
14474
|
correlationId: request.correlationId,
|
|
14491
|
-
confirmed: result.decision ===
|
|
14492
|
-
requiresUserConfirmation: result.decision ===
|
|
14475
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
14476
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
14493
14477
|
});
|
|
14494
14478
|
} catch (error) {
|
|
14495
14479
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
14496
14480
|
await this.context.config.getMessageBus()?.publish({
|
|
14497
|
-
type:
|
|
14481
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14498
14482
|
correlationId: request.correlationId,
|
|
14499
14483
|
confirmed: false,
|
|
14500
14484
|
requiresUserConfirmation: false
|
|
@@ -14514,7 +14498,7 @@ var Session = class {
|
|
|
14514
14498
|
};
|
|
14515
14499
|
dispose() {
|
|
14516
14500
|
coreEvents.off(
|
|
14517
|
-
|
|
14501
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
14518
14502
|
this.handleApprovalModeChanged
|
|
14519
14503
|
);
|
|
14520
14504
|
this.disposeController.abort();
|
|
@@ -14603,7 +14587,7 @@ ${thought.description}`;
|
|
|
14603
14587
|
await this.sendUpdate({
|
|
14604
14588
|
sessionUpdate: "tool_call",
|
|
14605
14589
|
toolCallId: toolCall.id,
|
|
14606
|
-
status: toolCall.status ===
|
|
14590
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
14607
14591
|
title: toolCall.displayName || toolCall.name,
|
|
14608
14592
|
content: toolCallContent,
|
|
14609
14593
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14695,7 +14679,7 @@ ${thought.description}`;
|
|
|
14695
14679
|
return { stopReason: "cancelled" };
|
|
14696
14680
|
}
|
|
14697
14681
|
switch (event.type) {
|
|
14698
|
-
case
|
|
14682
|
+
case "content" /* Content */: {
|
|
14699
14683
|
const content = {
|
|
14700
14684
|
type: "text",
|
|
14701
14685
|
text: event.value
|
|
@@ -14706,7 +14690,7 @@ ${thought.description}`;
|
|
|
14706
14690
|
});
|
|
14707
14691
|
break;
|
|
14708
14692
|
}
|
|
14709
|
-
case
|
|
14693
|
+
case "thought" /* Thought */: {
|
|
14710
14694
|
const thoughtText = `**${event.value.subject}**
|
|
14711
14695
|
${event.value.description}`;
|
|
14712
14696
|
await this.sendUpdate({
|
|
@@ -14715,10 +14699,10 @@ ${event.value.description}`;
|
|
|
14715
14699
|
});
|
|
14716
14700
|
break;
|
|
14717
14701
|
}
|
|
14718
|
-
case
|
|
14702
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
14719
14703
|
toolCallRequests.push(event.value);
|
|
14720
14704
|
break;
|
|
14721
|
-
case
|
|
14705
|
+
case "finished" /* Finished */: {
|
|
14722
14706
|
const usage2 = event.value.usageMetadata;
|
|
14723
14707
|
if (usage2) {
|
|
14724
14708
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14726,19 +14710,19 @@ ${event.value.description}`;
|
|
|
14726
14710
|
}
|
|
14727
14711
|
break;
|
|
14728
14712
|
}
|
|
14729
|
-
case
|
|
14713
|
+
case "model_info" /* ModelInfo */:
|
|
14730
14714
|
turnModelId = event.value;
|
|
14731
14715
|
break;
|
|
14732
|
-
case
|
|
14716
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
14733
14717
|
stopReason = "max_turn_requests";
|
|
14734
14718
|
break;
|
|
14735
|
-
case
|
|
14719
|
+
case "loop_detected" /* LoopDetected */:
|
|
14736
14720
|
stopReason = "max_turn_requests";
|
|
14737
14721
|
break;
|
|
14738
|
-
case
|
|
14722
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
14739
14723
|
stopReason = "max_tokens";
|
|
14740
14724
|
break;
|
|
14741
|
-
case
|
|
14725
|
+
case "error" /* Error */: {
|
|
14742
14726
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14743
14727
|
event.value.error
|
|
14744
14728
|
);
|
|
@@ -14966,7 +14950,7 @@ ${event.value.description}`;
|
|
|
14966
14950
|
const output = RequestPermissionResponseSchema.parse(
|
|
14967
14951
|
await this.connection.requestPermission(params)
|
|
14968
14952
|
);
|
|
14969
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14953
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14970
14954
|
await confirmationDetails.onConfirm(outcome);
|
|
14971
14955
|
await updatePolicy(
|
|
14972
14956
|
tool,
|
|
@@ -14977,16 +14961,16 @@ ${event.value.description}`;
|
|
|
14977
14961
|
invocation
|
|
14978
14962
|
);
|
|
14979
14963
|
switch (outcome) {
|
|
14980
|
-
case
|
|
14964
|
+
case "cancel" /* Cancel */:
|
|
14981
14965
|
return errorResponse(
|
|
14982
14966
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14983
14967
|
);
|
|
14984
|
-
case
|
|
14985
|
-
case
|
|
14986
|
-
case
|
|
14987
|
-
case
|
|
14988
|
-
case
|
|
14989
|
-
case
|
|
14968
|
+
case "proceed_once" /* ProceedOnce */:
|
|
14969
|
+
case "proceed_always" /* ProceedAlways */:
|
|
14970
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
14971
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
14972
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
14973
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
14990
14974
|
break;
|
|
14991
14975
|
default: {
|
|
14992
14976
|
const resultOutcome = outcome;
|
|
@@ -15040,7 +15024,7 @@ ${event.value.description}`;
|
|
|
15040
15024
|
);
|
|
15041
15025
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15042
15026
|
{
|
|
15043
|
-
status:
|
|
15027
|
+
status: "success" /* Success */,
|
|
15044
15028
|
request: {
|
|
15045
15029
|
callId,
|
|
15046
15030
|
name: fc.name,
|
|
@@ -15085,7 +15069,7 @@ ${event.value.description}`;
|
|
|
15085
15069
|
});
|
|
15086
15070
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15087
15071
|
{
|
|
15088
|
-
status:
|
|
15072
|
+
status: "error" /* Error */,
|
|
15089
15073
|
request: {
|
|
15090
15074
|
callId,
|
|
15091
15075
|
name: fc.name,
|
|
@@ -15213,12 +15197,12 @@ ${event.value.description}`;
|
|
|
15213
15197
|
sessionId: this.id,
|
|
15214
15198
|
options: [
|
|
15215
15199
|
{
|
|
15216
|
-
optionId:
|
|
15200
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
15217
15201
|
name: "Allow once",
|
|
15218
15202
|
kind: "allow_once"
|
|
15219
15203
|
},
|
|
15220
15204
|
{
|
|
15221
|
-
optionId:
|
|
15205
|
+
optionId: "cancel" /* Cancel */,
|
|
15222
15206
|
name: "Deny",
|
|
15223
15207
|
kind: "reject_once"
|
|
15224
15208
|
}
|
|
@@ -15243,8 +15227,8 @@ ${event.value.description}`;
|
|
|
15243
15227
|
const output = RequestPermissionResponseSchema.parse(
|
|
15244
15228
|
await this.connection.requestPermission(params)
|
|
15245
15229
|
);
|
|
15246
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15247
|
-
if (outcome ===
|
|
15230
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15231
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
15248
15232
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
15249
15233
|
validationError = null;
|
|
15250
15234
|
} else {
|
|
@@ -15681,7 +15665,7 @@ var AcpSessionManager = class {
|
|
|
15681
15665
|
mcpServers,
|
|
15682
15666
|
loadedSettings
|
|
15683
15667
|
);
|
|
15684
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15668
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
15685
15669
|
let isAuthenticated = false;
|
|
15686
15670
|
let authErrorMessage = "";
|
|
15687
15671
|
try {
|
|
@@ -15693,7 +15677,7 @@ var AcpSessionManager = class {
|
|
|
15693
15677
|
);
|
|
15694
15678
|
isAuthenticated = true;
|
|
15695
15679
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
15696
|
-
if (authType ===
|
|
15680
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
15697
15681
|
isAuthenticated = false;
|
|
15698
15682
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
15699
15683
|
}
|
|
@@ -15802,7 +15786,7 @@ var AcpSessionManager = class {
|
|
|
15802
15786
|
return response;
|
|
15803
15787
|
}
|
|
15804
15788
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
15805
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15789
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
15806
15790
|
if (!selectedAuthType) {
|
|
15807
15791
|
throw RequestError.authRequired();
|
|
15808
15792
|
}
|
|
@@ -15903,12 +15887,12 @@ var GeminiAgent = class {
|
|
|
15903
15887
|
}
|
|
15904
15888
|
const authMethods = [
|
|
15905
15889
|
{
|
|
15906
|
-
id:
|
|
15890
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
15907
15891
|
name: "Log in with Google",
|
|
15908
15892
|
description: "Log in with your Google account"
|
|
15909
15893
|
},
|
|
15910
15894
|
{
|
|
15911
|
-
id:
|
|
15895
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
15912
15896
|
name: "Gemini API key",
|
|
15913
15897
|
description: "Use an API key with Gemini Developer API",
|
|
15914
15898
|
_meta: {
|
|
@@ -15918,12 +15902,12 @@ var GeminiAgent = class {
|
|
|
15918
15902
|
}
|
|
15919
15903
|
},
|
|
15920
15904
|
{
|
|
15921
|
-
id:
|
|
15905
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
15922
15906
|
name: "Vertex AI",
|
|
15923
15907
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15924
15908
|
},
|
|
15925
15909
|
{
|
|
15926
|
-
id:
|
|
15910
|
+
id: "gateway" /* GATEWAY */,
|
|
15927
15911
|
name: "AI API Gateway",
|
|
15928
15912
|
description: "Use a custom AI API Gateway",
|
|
15929
15913
|
_meta: {
|
|
@@ -16096,7 +16080,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
16096
16080
|
}
|
|
16097
16081
|
return authType;
|
|
16098
16082
|
} catch (error) {
|
|
16099
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
16083
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
16100
16084
|
handleError(
|
|
16101
16085
|
error instanceof Error ? error : new Error(String(error)),
|
|
16102
16086
|
nonInteractiveConfig,
|
|
@@ -16291,10 +16275,10 @@ var SlashCommandConflictHandler = class {
|
|
|
16291
16275
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
16292
16276
|
}
|
|
16293
16277
|
start() {
|
|
16294
|
-
coreEvents.on(
|
|
16278
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
16295
16279
|
}
|
|
16296
16280
|
stop() {
|
|
16297
|
-
coreEvents.off(
|
|
16281
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
16298
16282
|
if (this.flushTimeout) {
|
|
16299
16283
|
clearTimeout(this.flushTimeout);
|
|
16300
16284
|
this.flushTimeout = null;
|
|
@@ -16575,7 +16559,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
16575
16559
|
}
|
|
16576
16560
|
}
|
|
16577
16561
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
16578
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
16562
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-PP7WTUZL.js");
|
|
16579
16563
|
await doStartUI(
|
|
16580
16564
|
config,
|
|
16581
16565
|
settings,
|
|
@@ -16678,12 +16662,12 @@ async function main() {
|
|
|
16678
16662
|
dns.setDefaultResultOrder(
|
|
16679
16663
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
16680
16664
|
);
|
|
16681
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
16665
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
16682
16666
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
16683
16667
|
settings.setValue(
|
|
16684
16668
|
"User" /* User */,
|
|
16685
16669
|
"security.auth.selectedType",
|
|
16686
|
-
|
|
16670
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
16687
16671
|
);
|
|
16688
16672
|
}
|
|
16689
16673
|
}
|
|
@@ -16784,7 +16768,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16784
16768
|
await config.storage.initialize();
|
|
16785
16769
|
adminControlsListner.setConfig(config);
|
|
16786
16770
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
16787
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
16771
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-VQSLUOYF.js");
|
|
16788
16772
|
setupInitialActivityLogger(config);
|
|
16789
16773
|
}
|
|
16790
16774
|
registerTelemetryConfig(config);
|
|
@@ -16792,7 +16776,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16792
16776
|
const messageBus = config.getMessageBus();
|
|
16793
16777
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
16794
16778
|
registerCleanup(async () => {
|
|
16795
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
16779
|
+
await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
16796
16780
|
});
|
|
16797
16781
|
if (!config.getAcpMode()) {
|
|
16798
16782
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16843,7 +16827,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16843
16827
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16844
16828
|
const initializationResult = await initializeApp(config, settings);
|
|
16845
16829
|
initAppHandle?.end();
|
|
16846
|
-
import("./liteRtServerManager-
|
|
16830
|
+
import("./liteRtServerManager-ZPDALIDY.js").then(({ LiteRtServerManager }) => {
|
|
16847
16831
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16848
16832
|
if (!mergedGemma) return;
|
|
16849
16833
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16853,7 +16837,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16853
16837
|
autoStartServer: userGemma?.autoStartServer
|
|
16854
16838
|
});
|
|
16855
16839
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16856
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16840
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
16857
16841
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16858
16842
|
}
|
|
16859
16843
|
if (config.getAcpMode()) {
|
|
@@ -16869,7 +16853,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16869
16853
|
...rawStartupWarnings.map((message) => ({
|
|
16870
16854
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16871
16855
|
message,
|
|
16872
|
-
priority:
|
|
16856
|
+
priority: "high" /* High */
|
|
16873
16857
|
})),
|
|
16874
16858
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16875
16859
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16906,7 +16890,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16906
16890
|
${input}` : stdinData;
|
|
16907
16891
|
}
|
|
16908
16892
|
}
|
|
16909
|
-
const sessionStartSource = resumedSessionData ?
|
|
16893
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
16910
16894
|
const hookSystem = config?.getHookSystem();
|
|
16911
16895
|
if (hookSystem) {
|
|
16912
16896
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16963,8 +16947,8 @@ ${input}` : wrappedContext;
|
|
|
16963
16947
|
}
|
|
16964
16948
|
}
|
|
16965
16949
|
function initializeOutputListenersAndFlush(config) {
|
|
16966
|
-
if (coreEvents.listenerCount(
|
|
16967
|
-
coreEvents.on(
|
|
16950
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
16951
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
16968
16952
|
if (payload.isStderr) {
|
|
16969
16953
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16970
16954
|
} else {
|
|
@@ -16972,8 +16956,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16972
16956
|
}
|
|
16973
16957
|
});
|
|
16974
16958
|
}
|
|
16975
|
-
if (coreEvents.listenerCount(
|
|
16976
|
-
coreEvents.on(
|
|
16959
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
16960
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
16977
16961
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16978
16962
|
writeToStderr(payload.content + "\n");
|
|
16979
16963
|
} else {
|
|
@@ -16981,8 +16965,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16981
16965
|
}
|
|
16982
16966
|
});
|
|
16983
16967
|
}
|
|
16984
|
-
if (coreEvents.listenerCount(
|
|
16985
|
-
coreEvents.on(
|
|
16968
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
16969
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
16986
16970
|
writeToStderr(payload.message + "\n");
|
|
16987
16971
|
});
|
|
16988
16972
|
}
|
|
@@ -16990,7 +16974,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16990
16974
|
const forceToStderr = outputFormat === "json";
|
|
16991
16975
|
coreEvents.drainBacklogs(
|
|
16992
16976
|
(event, args) => {
|
|
16993
|
-
if (forceToStderr && event ===
|
|
16977
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
16994
16978
|
const payload = args[0];
|
|
16995
16979
|
if (!payload.isStderr) {
|
|
16996
16980
|
return {
|