@google/gemini-cli 0.49.0-nightly.20260625.gd845bc5d4 → 0.49.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-DQARXBEA.js → chunk-2KPOY3PT.js} +1 -1
- package/bundle/{chunk-GP3HT3XA.js → chunk-5D76V46E.js} +1 -1
- package/bundle/{chunk-W4CY6ZAV.js → chunk-6SAPFKW2.js} +7 -7
- package/bundle/{chunk-KZTYIR7T.js → chunk-DG2DMXNL.js} +4 -4
- package/bundle/{chunk-M3LLLH4Q.js → chunk-DUXXYDOU.js} +14099 -7557
- package/bundle/{chunk-VFEUUHDP.js → chunk-GD7RCEFJ.js} +1 -1
- package/bundle/{chunk-Z7VJ5D2F.js → chunk-HHBELWTD.js} +1 -1
- package/bundle/{chunk-2H7H7LHE.js → chunk-KUPS66EC.js} +1 -1
- package/bundle/{chunk-ZUVD4OMS.js → chunk-KVKWITLW.js} +1 -1
- package/bundle/{chunk-CZXPXLF4.js → chunk-LJT2N46V.js} +2 -2
- package/bundle/{chunk-KEKQ7HNE.js → chunk-MT2PHBHF.js} +54 -67
- package/bundle/{chunk-6WLO7RJO.js → chunk-O3DZHA75.js} +3 -3
- package/bundle/{chunk-N6JHSW2E.js → chunk-QJ52LUEZ.js} +1 -1
- package/bundle/{chunk-PGI5U4RD.js → chunk-RWFC7SH2.js} +8 -9
- package/bundle/{chunk-LZSQIPID.js → chunk-SWRFLYQS.js} +3 -3
- package/bundle/{chunk-D7ASGNGV.js → chunk-THSPF7UM.js} +7 -7
- package/bundle/{chunk-JNWGPSWO.js → chunk-UTCNY4YR.js} +1 -1
- package/bundle/{chunk-4ZKDF6RJ.js → chunk-UXLDTYS5.js} +1 -1
- package/bundle/{chunk-LHQTFC5V.js → chunk-V33X6KEX.js} +2 -2
- package/bundle/{chunk-IH4N7SHL.js → chunk-VLV2BYPM.js} +4 -4
- package/bundle/{chunk-5VDCISGZ.js → chunk-VSVATFSS.js} +2 -2
- package/bundle/{chunk-NSCBFJB5.js → chunk-WDIGNHW2.js} +5 -8
- package/bundle/{chunk-DVXL5G45.js → chunk-YAWAHLTJ.js} +1 -1
- package/bundle/{chunk-SM66ZQJE.js → chunk-YP5PXUYC.js} +3 -3
- package/bundle/{cleanup-7ZAS2HJC.js → cleanup-J3QILUCY.js} +2 -2
- package/bundle/{cleanup-OWDILGDO.js → cleanup-UIXA2GEB.js} +2 -2
- package/bundle/{cleanup-UAXXCVMU.js → cleanup-YMPS4FUE.js} +2 -2
- package/bundle/{core-U7XFRGTW.js → core-64JIIVRX.js} +1 -1
- package/bundle/{dist-5MIUEMAQ.js → core-ELQDFBG3.js} +1 -1
- package/bundle/{devtoolsService-5OSGJYDS.js → devtoolsService-HCHZ2F6P.js} +2 -2
- package/bundle/{devtoolsService-6LH5MZBL.js → devtoolsService-HSYIYY4G.js} +3 -4
- package/bundle/{devtoolsService-6HAVTQZ5.js → devtoolsService-YX6EFIXG.js} +2 -2
- package/bundle/{dist-B6J3QDWI.js → dist-CLCQE7YY.js} +1 -1
- package/bundle/{gemini-H6TAAPCA.js → gemini-APNDCIQH.js} +196 -212
- package/bundle/{gemini-6SJTD2W4.js → gemini-FSMCKCVD.js} +14 -14
- package/bundle/{gemini-3BRU2HQK.js → gemini-MHDYPMBW.js} +13 -13
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-B6MSN4C4.js → interactiveCli-4GI574PD.js} +8 -8
- package/bundle/{interactiveCli-KOS354WR.js → interactiveCli-PM57R35K.js} +295 -314
- package/bundle/{interactiveCli-BS2D2SBI.js → interactiveCli-PR7HIXJT.js} +8 -8
- package/bundle/{liteRtServerManager-FWHYC4A3.js → liteRtServerManager-IXIJTRUX.js} +4 -4
- package/bundle/{liteRtServerManager-HIIW3S66.js → liteRtServerManager-SRAMJKDM.js} +4 -4
- package/bundle/{liteRtServerManager-M7B3AIIU.js → liteRtServerManager-TYKWESZG.js} +4 -4
- package/bundle/{oauth2-provider-RILC6FBL.js → oauth2-provider-4UAT62TZ.js} +1 -1
- package/bundle/{oauth2-provider-G7I2PMHS.js → oauth2-provider-I7ZHNJPU.js} +72 -38
- package/bundle/{oauth2-provider-EA2VTAQO.js → oauth2-provider-UU4JM5RG.js} +1 -1
- package/bundle/{start-AVLVGFFA.js → start-C5MXXCE7.js} +6 -6
- package/bundle/{start-CCQWWAKJ.js → start-RIHKQGGY.js} +6 -6
- package/bundle/{start-FI6MCT26.js → start-W4HQTHNO.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-6VICSAQD.js +0 -154
- package/bundle/chunk-EB5KWRK7.js +0 -512
- package/bundle/chunk-IP2NI6CQ.js +0 -398
- package/bundle/chunk-M43EUC7R.js +0 -1571
- package/bundle/chunk-P3C2ZDOD.js +0 -102505
- package/bundle/chunk-SSMJN6LA.js +0 -387674
- package/bundle/chunk-TNS2COLB.js +0 -17332
- package/bundle/chunk-YNU56L7B.js +0 -118
- package/bundle/cleanup-VF75F443.js +0 -32
- package/bundle/devtoolsService-OV63XS6S.js +0 -4359
- package/bundle/dist-GPCVSENP.js +0 -2150
- package/bundle/gemini-R6VOKNQ4.js +0 -29270
- package/bundle/interactiveCli-HSHPW4IB.js +0 -34767
- package/bundle/liteRtServerManager-ZMLRN3HQ.js +0 -65
- package/bundle/oauth2-provider-KED65L5Q.js +0 -235
- package/bundle/start-OOI6CRQA.js +0 -18
|
@@ -41,18 +41,18 @@ import {
|
|
|
41
41
|
updateAllUpdatableExtensions,
|
|
42
42
|
updateExtension,
|
|
43
43
|
validateAuthMethod
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-6SAPFKW2.js";
|
|
45
45
|
import {
|
|
46
46
|
appEvents
|
|
47
47
|
} from "./chunk-5PS3AYFU.js";
|
|
48
48
|
import {
|
|
49
49
|
startCommand,
|
|
50
50
|
startServer
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-YP5PXUYC.js";
|
|
52
52
|
import {
|
|
53
53
|
exitCli,
|
|
54
54
|
require_source
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-YAWAHLTJ.js";
|
|
56
56
|
import {
|
|
57
57
|
DEFAULT_PORT,
|
|
58
58
|
GEMMA_MODEL_NAME,
|
|
@@ -87,11 +87,11 @@ import {
|
|
|
87
87
|
resolveGemmaConfig,
|
|
88
88
|
saveModelChange,
|
|
89
89
|
stripAnsi
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-WDIGNHW2.js";
|
|
91
91
|
import {
|
|
92
92
|
RELAUNCH_EXIT_CODE
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-
|
|
93
|
+
} from "./chunk-VSVATFSS.js";
|
|
94
|
+
import "./chunk-RWFC7SH2.js";
|
|
95
95
|
import {
|
|
96
96
|
cleanupCheckpoints,
|
|
97
97
|
registerCleanup,
|
|
@@ -100,14 +100,11 @@ import {
|
|
|
100
100
|
runExitCleanup,
|
|
101
101
|
runSyncCleanup,
|
|
102
102
|
setupSignalHandlers
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-HHBELWTD.js";
|
|
104
104
|
import {
|
|
105
105
|
ASK_USER_TOOL_NAME,
|
|
106
|
-
ApprovalMode,
|
|
107
106
|
AuthType,
|
|
108
107
|
Config,
|
|
109
|
-
CoreEvent,
|
|
110
|
-
CoreToolCallStatus,
|
|
111
108
|
DEFAULT_CONTEXT_FILENAME,
|
|
112
109
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
113
110
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -129,45 +126,32 @@ import {
|
|
|
129
126
|
FolderTrustDiscoveryService,
|
|
130
127
|
GEMINI_DIR,
|
|
131
128
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
132
|
-
GeminiEventType,
|
|
133
129
|
IdeClient,
|
|
134
|
-
IntegrityStatus,
|
|
135
130
|
InvalidStreamError,
|
|
136
131
|
JsonFormatter,
|
|
137
|
-
JsonStreamEventType,
|
|
138
|
-
Kind,
|
|
139
132
|
LegacyAgentSession,
|
|
140
133
|
Logger,
|
|
141
134
|
MCPServerConfig,
|
|
142
|
-
MCPServerStatus,
|
|
143
|
-
MessageBusType,
|
|
144
|
-
OutputFormat,
|
|
145
135
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
146
136
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
147
137
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
148
138
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
149
139
|
PREVIEW_GEMINI_MODEL,
|
|
150
|
-
PolicyDecision,
|
|
151
140
|
PolicyIntegrityManager,
|
|
152
141
|
REFERENCE_CONTENT_START,
|
|
153
142
|
ROOT_SCHEDULER_ID,
|
|
154
143
|
ReadManyFilesTool,
|
|
155
144
|
Scheduler,
|
|
156
|
-
SessionEndReason,
|
|
157
|
-
SessionStartSource,
|
|
158
145
|
ShellExecutionService,
|
|
159
146
|
SimpleExtensionLoader,
|
|
160
147
|
Storage,
|
|
161
148
|
StreamJsonFormatter,
|
|
162
149
|
ToolCallEvent,
|
|
163
150
|
ToolConfirmationOutcome,
|
|
164
|
-
ToolErrorType,
|
|
165
|
-
TrustLevel,
|
|
166
151
|
UserAccountManager,
|
|
167
152
|
UserPromptEvent,
|
|
168
153
|
ValidationCancelledError,
|
|
169
154
|
ValidationRequiredError,
|
|
170
|
-
WarningPriority,
|
|
171
155
|
applyAdminAllowlist,
|
|
172
156
|
applyRequiredServers,
|
|
173
157
|
clearCachedCredentialFile,
|
|
@@ -249,7 +233,7 @@ import {
|
|
|
249
233
|
updatePolicy,
|
|
250
234
|
writeToStderr,
|
|
251
235
|
writeToStdout
|
|
252
|
-
} from "./chunk-
|
|
236
|
+
} from "./chunk-DG2DMXNL.js";
|
|
253
237
|
import "./chunk-664ZODQF.js";
|
|
254
238
|
import "./chunk-TUDYL3X4.js";
|
|
255
239
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -18220,7 +18204,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
18220
18204
|
async function testMCPConnection(serverName, config2, isTrusted, activeSettings) {
|
|
18221
18205
|
const isStdio = !!config2.command;
|
|
18222
18206
|
if (isStdio && !isTrusted) {
|
|
18223
|
-
return
|
|
18207
|
+
return "disconnected" /* DISCONNECTED */;
|
|
18224
18208
|
}
|
|
18225
18209
|
const client = new Client({
|
|
18226
18210
|
name: "mcp-test-client",
|
|
@@ -18256,7 +18240,7 @@ async function testMCPConnection(serverName, config2, isTrusted, activeSettings)
|
|
|
18256
18240
|
transport = await createTransport(serverName, config2, false, mcpContext);
|
|
18257
18241
|
} catch {
|
|
18258
18242
|
await client.close();
|
|
18259
|
-
return
|
|
18243
|
+
return "disconnected" /* DISCONNECTED */;
|
|
18260
18244
|
}
|
|
18261
18245
|
try {
|
|
18262
18246
|
const timeout = config2.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -18270,10 +18254,10 @@ async function testMCPConnection(serverName, config2, isTrusted, activeSettings)
|
|
|
18270
18254
|
);
|
|
18271
18255
|
}
|
|
18272
18256
|
await client.close();
|
|
18273
|
-
return
|
|
18257
|
+
return "connected" /* CONNECTED */;
|
|
18274
18258
|
} catch {
|
|
18275
18259
|
await transport.close();
|
|
18276
|
-
return
|
|
18260
|
+
return "disconnected" /* DISCONNECTED */;
|
|
18277
18261
|
}
|
|
18278
18262
|
}
|
|
18279
18263
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -18286,12 +18270,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
18286
18270
|
});
|
|
18287
18271
|
if (!loadResult.allowed) {
|
|
18288
18272
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
18289
|
-
return
|
|
18273
|
+
return "blocked" /* BLOCKED */;
|
|
18290
18274
|
}
|
|
18291
|
-
return
|
|
18275
|
+
return "disabled" /* DISABLED */;
|
|
18292
18276
|
}
|
|
18293
18277
|
if (!isTrusted) {
|
|
18294
|
-
return
|
|
18278
|
+
return "disabled" /* DISABLED */;
|
|
18295
18279
|
}
|
|
18296
18280
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
18297
18281
|
}
|
|
@@ -18337,23 +18321,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
18337
18321
|
let statusIndicator = "";
|
|
18338
18322
|
let statusText = "";
|
|
18339
18323
|
switch (status) {
|
|
18340
|
-
case
|
|
18324
|
+
case "connected" /* CONNECTED */:
|
|
18341
18325
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
18342
18326
|
statusText = "Connected";
|
|
18343
18327
|
break;
|
|
18344
|
-
case
|
|
18328
|
+
case "connecting" /* CONNECTING */:
|
|
18345
18329
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
18346
18330
|
statusText = "Connecting";
|
|
18347
18331
|
break;
|
|
18348
|
-
case
|
|
18332
|
+
case "blocked" /* BLOCKED */:
|
|
18349
18333
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
18350
18334
|
statusText = "Blocked";
|
|
18351
18335
|
break;
|
|
18352
|
-
case
|
|
18336
|
+
case "disabled" /* DISABLED */:
|
|
18353
18337
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
18354
18338
|
statusText = "Disabled";
|
|
18355
18339
|
break;
|
|
18356
|
-
case
|
|
18340
|
+
case "disconnected" /* DISCONNECTED */:
|
|
18357
18341
|
default:
|
|
18358
18342
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
18359
18343
|
statusText = "Disconnected";
|
|
@@ -18639,7 +18623,7 @@ async function handleInstall(args) {
|
|
|
18639
18623
|
);
|
|
18640
18624
|
if (confirmed) {
|
|
18641
18625
|
const trustedFolders = loadTrustedFolders();
|
|
18642
|
-
await trustedFolders.setValue(realPath,
|
|
18626
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
18643
18627
|
} else {
|
|
18644
18628
|
throw new Error(
|
|
18645
18629
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -20684,7 +20668,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
20684
20668
|
}
|
|
20685
20669
|
const command2 = getSandboxCommand(sandboxValue);
|
|
20686
20670
|
const packageJson = await getPackageJson(__dirname3);
|
|
20687
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.49.0
|
|
20671
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.49.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
20688
20672
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
20689
20673
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
20690
20674
|
}
|
|
@@ -20743,9 +20727,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
20743
20727
|
cwd,
|
|
20744
20728
|
potentialWorkspacePoliciesDir
|
|
20745
20729
|
);
|
|
20746
|
-
if (integrityResult.status ===
|
|
20730
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
20747
20731
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
20748
|
-
} else if (integrityResult.status ===
|
|
20732
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
20749
20733
|
workspacePoliciesDir = void 0;
|
|
20750
20734
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
20751
20735
|
policyUpdateConfirmationRequest = {
|
|
@@ -21173,23 +21157,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
21173
21157
|
if (rawApprovalMode) {
|
|
21174
21158
|
switch (rawApprovalMode) {
|
|
21175
21159
|
case "yolo":
|
|
21176
|
-
approvalMode =
|
|
21160
|
+
approvalMode = "yolo" /* YOLO */;
|
|
21177
21161
|
break;
|
|
21178
21162
|
case "auto_edit":
|
|
21179
|
-
approvalMode =
|
|
21163
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
21180
21164
|
break;
|
|
21181
21165
|
case "plan":
|
|
21182
21166
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
21183
21167
|
debugLogger.warn(
|
|
21184
21168
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
21185
21169
|
);
|
|
21186
|
-
approvalMode =
|
|
21170
|
+
approvalMode = "default" /* DEFAULT */;
|
|
21187
21171
|
} else {
|
|
21188
|
-
approvalMode =
|
|
21172
|
+
approvalMode = "plan" /* PLAN */;
|
|
21189
21173
|
}
|
|
21190
21174
|
break;
|
|
21191
21175
|
case "default":
|
|
21192
|
-
approvalMode =
|
|
21176
|
+
approvalMode = "default" /* DEFAULT */;
|
|
21193
21177
|
break;
|
|
21194
21178
|
default:
|
|
21195
21179
|
throw new Error(
|
|
@@ -21197,10 +21181,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
21197
21181
|
);
|
|
21198
21182
|
}
|
|
21199
21183
|
} else {
|
|
21200
|
-
approvalMode =
|
|
21184
|
+
approvalMode = "default" /* DEFAULT */;
|
|
21201
21185
|
}
|
|
21202
21186
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
21203
|
-
if (approvalMode ===
|
|
21187
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
21204
21188
|
if (settings.admin?.secureModeEnabled) {
|
|
21205
21189
|
debugLogger.error(
|
|
21206
21190
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -21218,16 +21202,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
21218
21202
|
)
|
|
21219
21203
|
);
|
|
21220
21204
|
}
|
|
21221
|
-
} else if (approvalMode ===
|
|
21205
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
21222
21206
|
debugLogger.warn(
|
|
21223
21207
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
21224
21208
|
);
|
|
21225
21209
|
}
|
|
21226
|
-
if (!trustedFolder && approvalMode !==
|
|
21210
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
21227
21211
|
debugLogger.warn(
|
|
21228
21212
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
21229
21213
|
);
|
|
21230
|
-
approvalMode =
|
|
21214
|
+
approvalMode = "default" /* DEFAULT */;
|
|
21231
21215
|
}
|
|
21232
21216
|
let telemetrySettings;
|
|
21233
21217
|
try {
|
|
@@ -22665,7 +22649,7 @@ import path9 from "node:path";
|
|
|
22665
22649
|
import process5 from "node:process";
|
|
22666
22650
|
var homeDirectoryCheck = {
|
|
22667
22651
|
id: "home-directory",
|
|
22668
|
-
priority:
|
|
22652
|
+
priority: "low" /* Low */,
|
|
22669
22653
|
check: async (workspaceRoot, settings) => {
|
|
22670
22654
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
22671
22655
|
return null;
|
|
@@ -22689,7 +22673,7 @@ var homeDirectoryCheck = {
|
|
|
22689
22673
|
};
|
|
22690
22674
|
var rootDirectoryCheck = {
|
|
22691
22675
|
id: "root-directory",
|
|
22692
|
-
priority:
|
|
22676
|
+
priority: "high" /* High */,
|
|
22693
22677
|
check: async (workspaceRoot, _settings) => {
|
|
22694
22678
|
try {
|
|
22695
22679
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -22705,7 +22689,7 @@ var rootDirectoryCheck = {
|
|
|
22705
22689
|
};
|
|
22706
22690
|
var folderTrustCheck = {
|
|
22707
22691
|
id: "folder-trust",
|
|
22708
|
-
priority:
|
|
22692
|
+
priority: "high" /* High */,
|
|
22709
22693
|
check: async (workspaceRoot, settings) => {
|
|
22710
22694
|
if (!isFolderTrustEnabled(settings)) {
|
|
22711
22695
|
return null;
|
|
@@ -22895,12 +22879,12 @@ function handleError(error, config2, customErrorCode) {
|
|
|
22895
22879
|
error,
|
|
22896
22880
|
config2.getContentGeneratorConfig()?.authType
|
|
22897
22881
|
);
|
|
22898
|
-
if (config2.getOutputFormat() ===
|
|
22882
|
+
if (config2.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
22899
22883
|
const streamFormatter = new StreamJsonFormatter();
|
|
22900
22884
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
22901
22885
|
const metrics = uiTelemetryService.getMetrics();
|
|
22902
22886
|
streamFormatter.emitEvent({
|
|
22903
|
-
type:
|
|
22887
|
+
type: "result" /* RESULT */,
|
|
22904
22888
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22905
22889
|
status: "error",
|
|
22906
22890
|
error: {
|
|
@@ -22911,7 +22895,7 @@ function handleError(error, config2, customErrorCode) {
|
|
|
22911
22895
|
});
|
|
22912
22896
|
runSyncCleanup();
|
|
22913
22897
|
process.exit(getNumericExitCode(errorCode));
|
|
22914
|
-
} else if (config2.getOutputFormat() ===
|
|
22898
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
22915
22899
|
const formatter = new JsonFormatter();
|
|
22916
22900
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
22917
22901
|
const formattedError = formatter.formatError(
|
|
@@ -22931,11 +22915,11 @@ function handleToolError(toolName, toolError, config2, errorType, resultDisplay)
|
|
|
22931
22915
|
const isFatal = isFatalToolError(errorType);
|
|
22932
22916
|
if (isFatal) {
|
|
22933
22917
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
22934
|
-
if (config2.getOutputFormat() ===
|
|
22918
|
+
if (config2.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
22935
22919
|
const streamFormatter = new StreamJsonFormatter();
|
|
22936
22920
|
const metrics = uiTelemetryService.getMetrics();
|
|
22937
22921
|
streamFormatter.emitEvent({
|
|
22938
|
-
type:
|
|
22922
|
+
type: "result" /* RESULT */,
|
|
22939
22923
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22940
22924
|
status: "error",
|
|
22941
22925
|
error: {
|
|
@@ -22944,7 +22928,7 @@ function handleToolError(toolName, toolError, config2, errorType, resultDisplay)
|
|
|
22944
22928
|
},
|
|
22945
22929
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
22946
22930
|
});
|
|
22947
|
-
} else if (config2.getOutputFormat() ===
|
|
22931
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
22948
22932
|
const formatter = new JsonFormatter();
|
|
22949
22933
|
const formattedError = formatter.formatError(
|
|
22950
22934
|
toolExecutionError,
|
|
@@ -22962,11 +22946,11 @@ function handleToolError(toolName, toolError, config2, errorType, resultDisplay)
|
|
|
22962
22946
|
}
|
|
22963
22947
|
function handleCancellationError(config2) {
|
|
22964
22948
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
22965
|
-
if (config2.getOutputFormat() ===
|
|
22949
|
+
if (config2.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
22966
22950
|
const streamFormatter = new StreamJsonFormatter();
|
|
22967
22951
|
const metrics = uiTelemetryService.getMetrics();
|
|
22968
22952
|
streamFormatter.emitEvent({
|
|
22969
|
-
type:
|
|
22953
|
+
type: "result" /* RESULT */,
|
|
22970
22954
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22971
22955
|
status: "error",
|
|
22972
22956
|
error: {
|
|
@@ -22977,7 +22961,7 @@ function handleCancellationError(config2) {
|
|
|
22977
22961
|
});
|
|
22978
22962
|
runSyncCleanup();
|
|
22979
22963
|
process.exit(cancellationError.exitCode);
|
|
22980
|
-
} else if (config2.getOutputFormat() ===
|
|
22964
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
22981
22965
|
const formatter = new JsonFormatter();
|
|
22982
22966
|
const formattedError = formatter.formatError(
|
|
22983
22967
|
cancellationError,
|
|
@@ -22997,11 +22981,11 @@ function handleMaxTurnsExceededError(config2) {
|
|
|
22997
22981
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
22998
22982
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
22999
22983
|
);
|
|
23000
|
-
if (config2.getOutputFormat() ===
|
|
22984
|
+
if (config2.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
23001
22985
|
const streamFormatter = new StreamJsonFormatter();
|
|
23002
22986
|
const metrics = uiTelemetryService.getMetrics();
|
|
23003
22987
|
streamFormatter.emitEvent({
|
|
23004
|
-
type:
|
|
22988
|
+
type: "result" /* RESULT */,
|
|
23005
22989
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23006
22990
|
status: "error",
|
|
23007
22991
|
error: {
|
|
@@ -23012,7 +22996,7 @@ function handleMaxTurnsExceededError(config2) {
|
|
|
23012
22996
|
});
|
|
23013
22997
|
runSyncCleanup();
|
|
23014
22998
|
process.exit(maxTurnsError.exitCode);
|
|
23015
|
-
} else if (config2.getOutputFormat() ===
|
|
22999
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
23016
23000
|
const formatter = new JsonFormatter();
|
|
23017
23001
|
const formattedError = formatter.formatError(
|
|
23018
23002
|
maxTurnsError,
|
|
@@ -23092,7 +23076,7 @@ async function runNonInteractive({
|
|
|
23092
23076
|
}
|
|
23093
23077
|
});
|
|
23094
23078
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
23095
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
23079
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-HCHZ2F6P.js");
|
|
23096
23080
|
setupInitialActivityLogger(config2);
|
|
23097
23081
|
}
|
|
23098
23082
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -23108,7 +23092,7 @@ async function runNonInteractive({
|
|
|
23108
23092
|
}
|
|
23109
23093
|
};
|
|
23110
23094
|
const startTime = Date.now();
|
|
23111
|
-
const streamFormatter = config2.getOutputFormat() ===
|
|
23095
|
+
const streamFormatter = config2.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
23112
23096
|
const abortController = new AbortController();
|
|
23113
23097
|
let isAborting = false;
|
|
23114
23098
|
let cancelMessageTimer = null;
|
|
@@ -23161,13 +23145,13 @@ async function runNonInteractive({
|
|
|
23161
23145
|
};
|
|
23162
23146
|
try {
|
|
23163
23147
|
consolePatcher.patch();
|
|
23164
|
-
if (config2.getRawOutput() && !config2.getAcceptRawOutputRisk() && config2.getOutputFormat() ===
|
|
23148
|
+
if (config2.getRawOutput() && !config2.getAcceptRawOutputRisk() && config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23165
23149
|
process.stderr.write(
|
|
23166
23150
|
"[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"
|
|
23167
23151
|
);
|
|
23168
23152
|
}
|
|
23169
23153
|
setupStdinCancellation();
|
|
23170
|
-
coreEvents.on(
|
|
23154
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
23171
23155
|
coreEvents.drainBacklogs();
|
|
23172
23156
|
process.stdout.on("error", (err) => {
|
|
23173
23157
|
if (err.code === "EPIPE") {
|
|
@@ -23193,7 +23177,7 @@ async function runNonInteractive({
|
|
|
23193
23177
|
}
|
|
23194
23178
|
if (streamFormatter) {
|
|
23195
23179
|
streamFormatter.emitEvent({
|
|
23196
|
-
type:
|
|
23180
|
+
type: "init" /* INIT */,
|
|
23197
23181
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23198
23182
|
session_id: config2.getSessionId(),
|
|
23199
23183
|
model: config2.getModel()
|
|
@@ -23231,7 +23215,7 @@ async function runNonInteractive({
|
|
|
23231
23215
|
}
|
|
23232
23216
|
if (streamFormatter) {
|
|
23233
23217
|
streamFormatter.emitEvent({
|
|
23234
|
-
type:
|
|
23218
|
+
type: "message" /* MESSAGE */,
|
|
23235
23219
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23236
23220
|
role: "user",
|
|
23237
23221
|
content: input
|
|
@@ -23270,12 +23254,12 @@ async function runNonInteractive({
|
|
|
23270
23254
|
const metrics = uiTelemetryService.getMetrics();
|
|
23271
23255
|
const durationMs = Date.now() - startTime;
|
|
23272
23256
|
streamFormatter.emitEvent({
|
|
23273
|
-
type:
|
|
23257
|
+
type: "result" /* RESULT */,
|
|
23274
23258
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23275
23259
|
status: "success",
|
|
23276
23260
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
23277
23261
|
});
|
|
23278
|
-
} else if (config2.getOutputFormat() ===
|
|
23262
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
23279
23263
|
const formatter = new JsonFormatter();
|
|
23280
23264
|
const stats = uiTelemetryService.getMetrics();
|
|
23281
23265
|
textOutput.write(
|
|
@@ -23368,13 +23352,13 @@ async function runNonInteractive({
|
|
|
23368
23352
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
23369
23353
|
if (streamFormatter) {
|
|
23370
23354
|
streamFormatter.emitEvent({
|
|
23371
|
-
type:
|
|
23355
|
+
type: "message" /* MESSAGE */,
|
|
23372
23356
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23373
23357
|
role: "assistant",
|
|
23374
23358
|
content: output,
|
|
23375
23359
|
delta: true
|
|
23376
23360
|
});
|
|
23377
|
-
} else if (config2.getOutputFormat() ===
|
|
23361
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
23378
23362
|
responseText += output;
|
|
23379
23363
|
} else {
|
|
23380
23364
|
if (part.text) {
|
|
@@ -23387,13 +23371,13 @@ async function runNonInteractive({
|
|
|
23387
23371
|
break;
|
|
23388
23372
|
}
|
|
23389
23373
|
case "tool_request": {
|
|
23390
|
-
if (config2.getOutputFormat() ===
|
|
23374
|
+
if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
23391
23375
|
preToolResponseText = responseText || preToolResponseText;
|
|
23392
23376
|
responseText = "";
|
|
23393
23377
|
}
|
|
23394
23378
|
if (streamFormatter) {
|
|
23395
23379
|
streamFormatter.emitEvent({
|
|
23396
|
-
type:
|
|
23380
|
+
type: "tool_use" /* TOOL_USE */,
|
|
23397
23381
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23398
23382
|
tool_name: event.name,
|
|
23399
23383
|
tool_id: event.requestId,
|
|
@@ -23409,7 +23393,7 @@ async function runNonInteractive({
|
|
|
23409
23393
|
const displayText = displayContentToString(display);
|
|
23410
23394
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
23411
23395
|
streamFormatter.emitEvent({
|
|
23412
|
-
type:
|
|
23396
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
23413
23397
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23414
23398
|
tool_id: event.requestId,
|
|
23415
23399
|
status: event.isError ? "error" : "success",
|
|
@@ -23424,17 +23408,17 @@ async function runNonInteractive({
|
|
|
23424
23408
|
const display = event.display?.result;
|
|
23425
23409
|
const displayText = displayContentToString(display);
|
|
23426
23410
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
23427
|
-
if (event.data?.["errorType"] ===
|
|
23428
|
-
if (config2.getOutputFormat() ===
|
|
23411
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
23412
|
+
if (config2.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
23429
23413
|
responseText = preToolResponseText;
|
|
23430
23414
|
}
|
|
23431
23415
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
23432
|
-
if (config2.getOutputFormat() ===
|
|
23416
|
+
if (config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23433
23417
|
process.stderr.write(`${stopMessage}
|
|
23434
23418
|
`);
|
|
23435
23419
|
}
|
|
23436
23420
|
}
|
|
23437
|
-
if (event.data?.["errorType"] ===
|
|
23421
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
23438
23422
|
throw new FatalToolExecutionError(
|
|
23439
23423
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
23440
23424
|
);
|
|
@@ -23456,12 +23440,12 @@ async function runNonInteractive({
|
|
|
23456
23440
|
const errorCode = event._meta?.["code"];
|
|
23457
23441
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
23458
23442
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
23459
|
-
if (config2.getOutputFormat() ===
|
|
23443
|
+
if (config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23460
23444
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
23461
23445
|
`);
|
|
23462
23446
|
} else if (streamFormatter) {
|
|
23463
23447
|
streamFormatter.emitEvent({
|
|
23464
|
-
type:
|
|
23448
|
+
type: "error" /* ERROR */,
|
|
23465
23449
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23466
23450
|
severity: "warning",
|
|
23467
23451
|
message: stripAnsi(blockMessage)
|
|
@@ -23471,13 +23455,13 @@ async function runNonInteractive({
|
|
|
23471
23455
|
break;
|
|
23472
23456
|
}
|
|
23473
23457
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
23474
|
-
if (config2.getOutputFormat() ===
|
|
23458
|
+
if (config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23475
23459
|
process.stderr.write(`[WARNING] ${event.message}
|
|
23476
23460
|
`);
|
|
23477
23461
|
}
|
|
23478
23462
|
if (streamFormatter) {
|
|
23479
23463
|
streamFormatter.emitEvent({
|
|
23480
|
-
type:
|
|
23464
|
+
type: "error" /* ERROR */,
|
|
23481
23465
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23482
23466
|
severity,
|
|
23483
23467
|
message: stripAnsi(event.message)
|
|
@@ -23497,7 +23481,7 @@ async function runNonInteractive({
|
|
|
23497
23481
|
);
|
|
23498
23482
|
} else if (streamFormatter) {
|
|
23499
23483
|
streamFormatter.emitEvent({
|
|
23500
|
-
type:
|
|
23484
|
+
type: "error" /* ERROR */,
|
|
23501
23485
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23502
23486
|
severity: "error",
|
|
23503
23487
|
message: "Maximum session turns exceeded"
|
|
@@ -23505,7 +23489,7 @@ async function runNonInteractive({
|
|
|
23505
23489
|
}
|
|
23506
23490
|
}
|
|
23507
23491
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
23508
|
-
if (stopMessage && config2.getOutputFormat() ===
|
|
23492
|
+
if (stopMessage && config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23509
23493
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
23510
23494
|
`);
|
|
23511
23495
|
}
|
|
@@ -23535,7 +23519,7 @@ async function runNonInteractive({
|
|
|
23535
23519
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
23536
23520
|
scheduler?.dispose();
|
|
23537
23521
|
consolePatcher.cleanup();
|
|
23538
|
-
coreEvents.off(
|
|
23522
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
23539
23523
|
}
|
|
23540
23524
|
if (errorToHandle) {
|
|
23541
23525
|
handleError(errorToHandle, config2);
|
|
@@ -23563,7 +23547,7 @@ async function runNonInteractive2(params) {
|
|
|
23563
23547
|
}
|
|
23564
23548
|
});
|
|
23565
23549
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
23566
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
23550
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-HCHZ2F6P.js");
|
|
23567
23551
|
setupInitialActivityLogger(config2);
|
|
23568
23552
|
}
|
|
23569
23553
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -23579,7 +23563,7 @@ async function runNonInteractive2(params) {
|
|
|
23579
23563
|
}
|
|
23580
23564
|
};
|
|
23581
23565
|
const startTime = Date.now();
|
|
23582
|
-
const streamFormatter = config2.getOutputFormat() ===
|
|
23566
|
+
const streamFormatter = config2.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
23583
23567
|
const abortController = new AbortController();
|
|
23584
23568
|
let isAborting = false;
|
|
23585
23569
|
let cancelMessageTimer = null;
|
|
@@ -23630,13 +23614,13 @@ async function runNonInteractive2(params) {
|
|
|
23630
23614
|
let scheduler;
|
|
23631
23615
|
try {
|
|
23632
23616
|
consolePatcher.patch();
|
|
23633
|
-
if (config2.getRawOutput() && !config2.getAcceptRawOutputRisk() && config2.getOutputFormat() ===
|
|
23617
|
+
if (config2.getRawOutput() && !config2.getAcceptRawOutputRisk() && config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23634
23618
|
process.stderr.write(
|
|
23635
23619
|
"[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"
|
|
23636
23620
|
);
|
|
23637
23621
|
}
|
|
23638
23622
|
setupStdinCancellation();
|
|
23639
|
-
coreEvents.on(
|
|
23623
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
23640
23624
|
coreEvents.drainBacklogs();
|
|
23641
23625
|
process.stdout.on("error", (err) => {
|
|
23642
23626
|
if (err.code === "EPIPE") {
|
|
@@ -23660,7 +23644,7 @@ async function runNonInteractive2(params) {
|
|
|
23660
23644
|
}
|
|
23661
23645
|
if (streamFormatter) {
|
|
23662
23646
|
streamFormatter.emitEvent({
|
|
23663
|
-
type:
|
|
23647
|
+
type: "init" /* INIT */,
|
|
23664
23648
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23665
23649
|
session_id: config2.getSessionId(),
|
|
23666
23650
|
model: config2.getModel()
|
|
@@ -23698,7 +23682,7 @@ async function runNonInteractive2(params) {
|
|
|
23698
23682
|
}
|
|
23699
23683
|
if (streamFormatter) {
|
|
23700
23684
|
streamFormatter.emitEvent({
|
|
23701
|
-
type:
|
|
23685
|
+
type: "message" /* MESSAGE */,
|
|
23702
23686
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23703
23687
|
role: "user",
|
|
23704
23688
|
content: input
|
|
@@ -23726,28 +23710,28 @@ async function runNonInteractive2(params) {
|
|
|
23726
23710
|
if (abortController.signal.aborted) {
|
|
23727
23711
|
handleCancellationError(config2);
|
|
23728
23712
|
}
|
|
23729
|
-
if (event.type ===
|
|
23713
|
+
if (event.type === "content" /* Content */) {
|
|
23730
23714
|
const isRaw = config2.getRawOutput() || config2.getAcceptRawOutputRisk();
|
|
23731
23715
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
23732
23716
|
if (streamFormatter) {
|
|
23733
23717
|
streamFormatter.emitEvent({
|
|
23734
|
-
type:
|
|
23718
|
+
type: "message" /* MESSAGE */,
|
|
23735
23719
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23736
23720
|
role: "assistant",
|
|
23737
23721
|
content: output,
|
|
23738
23722
|
delta: true
|
|
23739
23723
|
});
|
|
23740
|
-
} else if (config2.getOutputFormat() ===
|
|
23724
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
23741
23725
|
responseText += output;
|
|
23742
23726
|
} else {
|
|
23743
23727
|
if (event.value) {
|
|
23744
23728
|
textOutput.write(output);
|
|
23745
23729
|
}
|
|
23746
23730
|
}
|
|
23747
|
-
} else if (event.type ===
|
|
23731
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
23748
23732
|
if (streamFormatter) {
|
|
23749
23733
|
streamFormatter.emitEvent({
|
|
23750
|
-
type:
|
|
23734
|
+
type: "tool_use" /* TOOL_USE */,
|
|
23751
23735
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23752
23736
|
tool_name: event.value.name,
|
|
23753
23737
|
tool_id: event.value.callId,
|
|
@@ -23755,33 +23739,33 @@ async function runNonInteractive2(params) {
|
|
|
23755
23739
|
});
|
|
23756
23740
|
}
|
|
23757
23741
|
toolCallRequests.push(event.value);
|
|
23758
|
-
} else if (event.type ===
|
|
23742
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
23759
23743
|
const message = "Loop detected, stopping execution";
|
|
23760
23744
|
if (streamFormatter) {
|
|
23761
23745
|
streamFormatter.emitEvent({
|
|
23762
|
-
type:
|
|
23746
|
+
type: "error" /* ERROR */,
|
|
23763
23747
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23764
23748
|
severity: "warning",
|
|
23765
23749
|
message
|
|
23766
23750
|
});
|
|
23767
23751
|
}
|
|
23768
23752
|
warnings.push(message);
|
|
23769
|
-
} else if (event.type ===
|
|
23753
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
23770
23754
|
const message = "Maximum session turns exceeded";
|
|
23771
23755
|
if (streamFormatter) {
|
|
23772
23756
|
streamFormatter.emitEvent({
|
|
23773
|
-
type:
|
|
23757
|
+
type: "error" /* ERROR */,
|
|
23774
23758
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23775
23759
|
severity: "error",
|
|
23776
23760
|
message
|
|
23777
23761
|
});
|
|
23778
23762
|
}
|
|
23779
23763
|
warnings.push(message);
|
|
23780
|
-
} else if (event.type ===
|
|
23764
|
+
} else if (event.type === "error" /* Error */) {
|
|
23781
23765
|
throw event.value.error;
|
|
23782
|
-
} else if (event.type ===
|
|
23766
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
23783
23767
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
23784
|
-
if (config2.getOutputFormat() ===
|
|
23768
|
+
if (config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23785
23769
|
process.stderr.write(`${stopMessage}
|
|
23786
23770
|
`);
|
|
23787
23771
|
}
|
|
@@ -23789,7 +23773,7 @@ async function runNonInteractive2(params) {
|
|
|
23789
23773
|
const metrics = uiTelemetryService.getMetrics();
|
|
23790
23774
|
const durationMs = Date.now() - startTime;
|
|
23791
23775
|
streamFormatter.emitEvent({
|
|
23792
|
-
type:
|
|
23776
|
+
type: "result" /* RESULT */,
|
|
23793
23777
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23794
23778
|
status: "success",
|
|
23795
23779
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -23797,7 +23781,7 @@ async function runNonInteractive2(params) {
|
|
|
23797
23781
|
durationMs
|
|
23798
23782
|
)
|
|
23799
23783
|
});
|
|
23800
|
-
} else if (config2.getOutputFormat() ===
|
|
23784
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
23801
23785
|
const formatter = new JsonFormatter();
|
|
23802
23786
|
const stats = uiTelemetryService.getMetrics();
|
|
23803
23787
|
textOutput.write(
|
|
@@ -23813,30 +23797,30 @@ async function runNonInteractive2(params) {
|
|
|
23813
23797
|
textOutput.ensureTrailingNewline();
|
|
23814
23798
|
}
|
|
23815
23799
|
return;
|
|
23816
|
-
} else if (event.type ===
|
|
23800
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
23817
23801
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
23818
|
-
if (config2.getOutputFormat() ===
|
|
23802
|
+
if (config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23819
23803
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
23820
23804
|
`);
|
|
23821
23805
|
} else if (streamFormatter) {
|
|
23822
23806
|
streamFormatter.emitEvent({
|
|
23823
|
-
type:
|
|
23807
|
+
type: "error" /* ERROR */,
|
|
23824
23808
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23825
23809
|
severity: "warning",
|
|
23826
23810
|
message: stripAnsi(blockMessage)
|
|
23827
23811
|
});
|
|
23828
23812
|
}
|
|
23829
23813
|
warnings.push(blockMessage);
|
|
23830
|
-
} else if (event.type ===
|
|
23814
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
23831
23815
|
invalidStreamError = "Invalid stream: The model returned an empty response or malformed tool call.";
|
|
23832
23816
|
if (streamFormatter) {
|
|
23833
23817
|
streamFormatter.emitEvent({
|
|
23834
|
-
type:
|
|
23818
|
+
type: "error" /* ERROR */,
|
|
23835
23819
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23836
23820
|
severity: "error",
|
|
23837
23821
|
message: invalidStreamError
|
|
23838
23822
|
});
|
|
23839
|
-
} else if (config2.getOutputFormat() ===
|
|
23823
|
+
} else if (config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23840
23824
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
23841
23825
|
`);
|
|
23842
23826
|
}
|
|
@@ -23856,7 +23840,7 @@ async function runNonInteractive2(params) {
|
|
|
23856
23840
|
const requestInfo = completedToolCall.request;
|
|
23857
23841
|
if (streamFormatter) {
|
|
23858
23842
|
streamFormatter.emitEvent({
|
|
23859
|
-
type:
|
|
23843
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
23860
23844
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23861
23845
|
tool_id: requestInfo.callId,
|
|
23862
23846
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -23890,11 +23874,11 @@ async function runNonInteractive2(params) {
|
|
|
23890
23874
|
);
|
|
23891
23875
|
}
|
|
23892
23876
|
const stopExecutionTool = completedToolCalls.find(
|
|
23893
|
-
(tc) => tc.response.errorType ===
|
|
23877
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
23894
23878
|
);
|
|
23895
23879
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
23896
23880
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
23897
|
-
if (config2.getOutputFormat() ===
|
|
23881
|
+
if (config2.getOutputFormat() === "text" /* TEXT */) {
|
|
23898
23882
|
process.stderr.write(`${stopMessage}
|
|
23899
23883
|
`);
|
|
23900
23884
|
}
|
|
@@ -23902,7 +23886,7 @@ async function runNonInteractive2(params) {
|
|
|
23902
23886
|
const metrics = uiTelemetryService.getMetrics();
|
|
23903
23887
|
const durationMs = Date.now() - startTime;
|
|
23904
23888
|
streamFormatter.emitEvent({
|
|
23905
|
-
type:
|
|
23889
|
+
type: "result" /* RESULT */,
|
|
23906
23890
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23907
23891
|
status: "success",
|
|
23908
23892
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -23910,7 +23894,7 @@ async function runNonInteractive2(params) {
|
|
|
23910
23894
|
durationMs
|
|
23911
23895
|
)
|
|
23912
23896
|
});
|
|
23913
|
-
} else if (config2.getOutputFormat() ===
|
|
23897
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
23914
23898
|
const formatter = new JsonFormatter();
|
|
23915
23899
|
const stats = uiTelemetryService.getMetrics();
|
|
23916
23900
|
textOutput.write(
|
|
@@ -23933,12 +23917,12 @@ async function runNonInteractive2(params) {
|
|
|
23933
23917
|
const metrics = uiTelemetryService.getMetrics();
|
|
23934
23918
|
const durationMs = Date.now() - startTime;
|
|
23935
23919
|
streamFormatter.emitEvent({
|
|
23936
|
-
type:
|
|
23920
|
+
type: "result" /* RESULT */,
|
|
23937
23921
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23938
23922
|
status: invalidStreamError ? "error" : "success",
|
|
23939
23923
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
23940
23924
|
});
|
|
23941
|
-
} else if (config2.getOutputFormat() ===
|
|
23925
|
+
} else if (config2.getOutputFormat() === "json" /* JSON */) {
|
|
23942
23926
|
const formatter = new JsonFormatter();
|
|
23943
23927
|
const stats = uiTelemetryService.getMetrics();
|
|
23944
23928
|
textOutput.write(
|
|
@@ -23962,7 +23946,7 @@ async function runNonInteractive2(params) {
|
|
|
23962
23946
|
cleanupStdinCancellation();
|
|
23963
23947
|
scheduler?.dispose();
|
|
23964
23948
|
consolePatcher.cleanup();
|
|
23965
|
-
coreEvents.off(
|
|
23949
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
23966
23950
|
}
|
|
23967
23951
|
if (errorToHandle) {
|
|
23968
23952
|
handleError(errorToHandle, config2);
|
|
@@ -26353,12 +26337,12 @@ function toToolCallContent(toolResult) {
|
|
|
26353
26337
|
}
|
|
26354
26338
|
var basicPermissionOptions = [
|
|
26355
26339
|
{
|
|
26356
|
-
optionId:
|
|
26340
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
26357
26341
|
name: "Allow",
|
|
26358
26342
|
kind: "allow_once"
|
|
26359
26343
|
},
|
|
26360
26344
|
{
|
|
26361
|
-
optionId:
|
|
26345
|
+
optionId: "cancel" /* Cancel */,
|
|
26362
26346
|
name: "Reject",
|
|
26363
26347
|
kind: "reject_once"
|
|
26364
26348
|
}
|
|
@@ -26370,13 +26354,13 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
|
|
|
26370
26354
|
switch (confirmation.type) {
|
|
26371
26355
|
case "edit":
|
|
26372
26356
|
options.push({
|
|
26373
|
-
optionId:
|
|
26357
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
26374
26358
|
name: "Allow for this session",
|
|
26375
26359
|
kind: "allow_always"
|
|
26376
26360
|
});
|
|
26377
26361
|
if (enablePermanentToolApproval) {
|
|
26378
26362
|
options.push({
|
|
26379
|
-
optionId:
|
|
26363
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
26380
26364
|
name: "Allow for this file in all future sessions",
|
|
26381
26365
|
kind: "allow_always"
|
|
26382
26366
|
});
|
|
@@ -26384,13 +26368,13 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
|
|
|
26384
26368
|
break;
|
|
26385
26369
|
case "exec":
|
|
26386
26370
|
options.push({
|
|
26387
|
-
optionId:
|
|
26371
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
26388
26372
|
name: "Allow for this session",
|
|
26389
26373
|
kind: "allow_always"
|
|
26390
26374
|
});
|
|
26391
26375
|
if (enablePermanentToolApproval) {
|
|
26392
26376
|
options.push({
|
|
26393
|
-
optionId:
|
|
26377
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
26394
26378
|
name: "Allow this command for all future sessions",
|
|
26395
26379
|
kind: "allow_always"
|
|
26396
26380
|
});
|
|
@@ -26399,19 +26383,19 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
|
|
|
26399
26383
|
case "mcp":
|
|
26400
26384
|
options.push(
|
|
26401
26385
|
{
|
|
26402
|
-
optionId:
|
|
26386
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
26403
26387
|
name: "Allow all server tools for this session",
|
|
26404
26388
|
kind: "allow_always"
|
|
26405
26389
|
},
|
|
26406
26390
|
{
|
|
26407
|
-
optionId:
|
|
26391
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
26408
26392
|
name: "Allow tool for this session",
|
|
26409
26393
|
kind: "allow_always"
|
|
26410
26394
|
}
|
|
26411
26395
|
);
|
|
26412
26396
|
if (enablePermanentToolApproval) {
|
|
26413
26397
|
options.push({
|
|
26414
|
-
optionId:
|
|
26398
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
26415
26399
|
name: "Allow tool for all future sessions",
|
|
26416
26400
|
kind: "allow_always"
|
|
26417
26401
|
});
|
|
@@ -26419,13 +26403,13 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
|
|
|
26419
26403
|
break;
|
|
26420
26404
|
case "info":
|
|
26421
26405
|
options.push({
|
|
26422
|
-
optionId:
|
|
26406
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
26423
26407
|
name: "Allow for this session",
|
|
26424
26408
|
kind: "allow_always"
|
|
26425
26409
|
});
|
|
26426
26410
|
if (enablePermanentToolApproval) {
|
|
26427
26411
|
options.push({
|
|
26428
|
-
optionId:
|
|
26412
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
26429
26413
|
name: "Allow for all future sessions",
|
|
26430
26414
|
kind: "allow_always"
|
|
26431
26415
|
});
|
|
@@ -26457,21 +26441,21 @@ function toPermissionOptions(confirmation, config2, enablePermanentToolApproval
|
|
|
26457
26441
|
}
|
|
26458
26442
|
function toAcpToolKind(kind) {
|
|
26459
26443
|
switch (kind) {
|
|
26460
|
-
case
|
|
26461
|
-
case
|
|
26462
|
-
case
|
|
26463
|
-
case
|
|
26464
|
-
case
|
|
26465
|
-
case
|
|
26466
|
-
case
|
|
26467
|
-
case
|
|
26468
|
-
case
|
|
26469
|
-
case
|
|
26444
|
+
case "read" /* Read */:
|
|
26445
|
+
case "edit" /* Edit */:
|
|
26446
|
+
case "execute" /* Execute */:
|
|
26447
|
+
case "search" /* Search */:
|
|
26448
|
+
case "delete" /* Delete */:
|
|
26449
|
+
case "move" /* Move */:
|
|
26450
|
+
case "think" /* Think */:
|
|
26451
|
+
case "fetch" /* Fetch */:
|
|
26452
|
+
case "switch_mode" /* SwitchMode */:
|
|
26453
|
+
case "other" /* Other */:
|
|
26470
26454
|
return kind;
|
|
26471
|
-
case
|
|
26455
|
+
case "agent" /* Agent */:
|
|
26472
26456
|
return "think";
|
|
26473
|
-
case
|
|
26474
|
-
case
|
|
26457
|
+
case "plan" /* Plan */:
|
|
26458
|
+
case "communicate" /* Communicate */:
|
|
26475
26459
|
default:
|
|
26476
26460
|
return "other";
|
|
26477
26461
|
}
|
|
@@ -26479,24 +26463,24 @@ function toAcpToolKind(kind) {
|
|
|
26479
26463
|
function buildAvailableModes(isPlanEnabled) {
|
|
26480
26464
|
const modes = [
|
|
26481
26465
|
{
|
|
26482
|
-
id:
|
|
26466
|
+
id: "default" /* DEFAULT */,
|
|
26483
26467
|
name: "Default",
|
|
26484
26468
|
description: "Prompts for approval"
|
|
26485
26469
|
},
|
|
26486
26470
|
{
|
|
26487
|
-
id:
|
|
26471
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
26488
26472
|
name: "Auto Edit",
|
|
26489
26473
|
description: "Auto-approves edit tools"
|
|
26490
26474
|
},
|
|
26491
26475
|
{
|
|
26492
|
-
id:
|
|
26476
|
+
id: "yolo" /* YOLO */,
|
|
26493
26477
|
name: "YOLO",
|
|
26494
26478
|
description: "Auto-approves all tools"
|
|
26495
26479
|
}
|
|
26496
26480
|
];
|
|
26497
26481
|
if (isPlanEnabled) {
|
|
26498
26482
|
modes.push({
|
|
26499
|
-
id:
|
|
26483
|
+
id: "plan" /* PLAN */,
|
|
26500
26484
|
name: "Plan",
|
|
26501
26485
|
description: "Read-only mode"
|
|
26502
26486
|
});
|
|
@@ -26509,7 +26493,7 @@ function buildAvailableModels(config2, settings) {
|
|
|
26509
26493
|
const useGemini31 = config2.getGemini31LaunchedSync?.() ?? false;
|
|
26510
26494
|
const useGemini3_5Flash = config2.hasGemini35FlashGAAccess?.() ?? false;
|
|
26511
26495
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
26512
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
26496
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
26513
26497
|
if (config2.getExperimentalDynamicModelConfiguration?.() === true && config2.getModelConfigService) {
|
|
26514
26498
|
const options = config2.getModelConfigService().getAvailableModelOptions({
|
|
26515
26499
|
useGemini3_1: useGemini31,
|
|
@@ -26595,11 +26579,11 @@ var Session = class {
|
|
|
26595
26579
|
this.connection = connection;
|
|
26596
26580
|
this.settings = settings;
|
|
26597
26581
|
coreEvents.on(
|
|
26598
|
-
|
|
26582
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
26599
26583
|
this.handleApprovalModeChanged
|
|
26600
26584
|
);
|
|
26601
26585
|
this.context.config.getMessageBus()?.subscribe(
|
|
26602
|
-
|
|
26586
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
26603
26587
|
this.handleToolConfirmationRequest,
|
|
26604
26588
|
{ signal: this.disposeController.signal }
|
|
26605
26589
|
);
|
|
@@ -26623,7 +26607,7 @@ var Session = class {
|
|
|
26623
26607
|
"Policy engine missing. Denying tool confirmation request."
|
|
26624
26608
|
);
|
|
26625
26609
|
await messageBus.publish({
|
|
26626
|
-
type:
|
|
26610
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
26627
26611
|
correlationId: request.correlationId,
|
|
26628
26612
|
confirmed: false,
|
|
26629
26613
|
requiresUserConfirmation: false
|
|
@@ -26636,7 +26620,7 @@ var Session = class {
|
|
|
26636
26620
|
"Tool confirmation request missing tool name. Denying."
|
|
26637
26621
|
);
|
|
26638
26622
|
await messageBus.publish({
|
|
26639
|
-
type:
|
|
26623
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
26640
26624
|
correlationId: request.correlationId,
|
|
26641
26625
|
confirmed: false,
|
|
26642
26626
|
requiresUserConfirmation: false
|
|
@@ -26649,7 +26633,7 @@ var Session = class {
|
|
|
26649
26633
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
26650
26634
|
);
|
|
26651
26635
|
await messageBus.publish({
|
|
26652
|
-
type:
|
|
26636
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
26653
26637
|
correlationId: request.correlationId,
|
|
26654
26638
|
confirmed: false,
|
|
26655
26639
|
requiresUserConfirmation: false
|
|
@@ -26665,15 +26649,15 @@ var Session = class {
|
|
|
26665
26649
|
request.subagent
|
|
26666
26650
|
);
|
|
26667
26651
|
await messageBus.publish({
|
|
26668
|
-
type:
|
|
26652
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
26669
26653
|
correlationId: request.correlationId,
|
|
26670
|
-
confirmed: result.decision ===
|
|
26671
|
-
requiresUserConfirmation: result.decision ===
|
|
26654
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
26655
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
26672
26656
|
});
|
|
26673
26657
|
} catch (error) {
|
|
26674
26658
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
26675
26659
|
await this.context.config.getMessageBus()?.publish({
|
|
26676
|
-
type:
|
|
26660
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
26677
26661
|
correlationId: request.correlationId,
|
|
26678
26662
|
confirmed: false,
|
|
26679
26663
|
requiresUserConfirmation: false
|
|
@@ -26693,7 +26677,7 @@ var Session = class {
|
|
|
26693
26677
|
};
|
|
26694
26678
|
dispose() {
|
|
26695
26679
|
coreEvents.off(
|
|
26696
|
-
|
|
26680
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
26697
26681
|
this.handleApprovalModeChanged
|
|
26698
26682
|
);
|
|
26699
26683
|
this.disposeController.abort();
|
|
@@ -26782,7 +26766,7 @@ ${thought.description}`;
|
|
|
26782
26766
|
await this.sendUpdate({
|
|
26783
26767
|
sessionUpdate: "tool_call",
|
|
26784
26768
|
toolCallId: toolCall.id,
|
|
26785
|
-
status: toolCall.status ===
|
|
26769
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
26786
26770
|
title: toolCall.displayName || toolCall.name,
|
|
26787
26771
|
content: toolCallContent,
|
|
26788
26772
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -26874,7 +26858,7 @@ ${thought.description}`;
|
|
|
26874
26858
|
return { stopReason: "cancelled" };
|
|
26875
26859
|
}
|
|
26876
26860
|
switch (event.type) {
|
|
26877
|
-
case
|
|
26861
|
+
case "content" /* Content */: {
|
|
26878
26862
|
const content = {
|
|
26879
26863
|
type: "text",
|
|
26880
26864
|
text: event.value
|
|
@@ -26885,7 +26869,7 @@ ${thought.description}`;
|
|
|
26885
26869
|
});
|
|
26886
26870
|
break;
|
|
26887
26871
|
}
|
|
26888
|
-
case
|
|
26872
|
+
case "thought" /* Thought */: {
|
|
26889
26873
|
const thoughtText = `**${event.value.subject}**
|
|
26890
26874
|
${event.value.description}`;
|
|
26891
26875
|
await this.sendUpdate({
|
|
@@ -26894,10 +26878,10 @@ ${event.value.description}`;
|
|
|
26894
26878
|
});
|
|
26895
26879
|
break;
|
|
26896
26880
|
}
|
|
26897
|
-
case
|
|
26881
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
26898
26882
|
toolCallRequests.push(event.value);
|
|
26899
26883
|
break;
|
|
26900
|
-
case
|
|
26884
|
+
case "finished" /* Finished */: {
|
|
26901
26885
|
const usage2 = event.value.usageMetadata;
|
|
26902
26886
|
if (usage2) {
|
|
26903
26887
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -26905,19 +26889,19 @@ ${event.value.description}`;
|
|
|
26905
26889
|
}
|
|
26906
26890
|
break;
|
|
26907
26891
|
}
|
|
26908
|
-
case
|
|
26892
|
+
case "model_info" /* ModelInfo */:
|
|
26909
26893
|
turnModelId = event.value;
|
|
26910
26894
|
break;
|
|
26911
|
-
case
|
|
26895
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
26912
26896
|
stopReason = "max_turn_requests";
|
|
26913
26897
|
break;
|
|
26914
|
-
case
|
|
26898
|
+
case "loop_detected" /* LoopDetected */:
|
|
26915
26899
|
stopReason = "max_turn_requests";
|
|
26916
26900
|
break;
|
|
26917
|
-
case
|
|
26901
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
26918
26902
|
stopReason = "max_tokens";
|
|
26919
26903
|
break;
|
|
26920
|
-
case
|
|
26904
|
+
case "error" /* Error */: {
|
|
26921
26905
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
26922
26906
|
event.value.error
|
|
26923
26907
|
);
|
|
@@ -27145,7 +27129,7 @@ ${event.value.description}`;
|
|
|
27145
27129
|
const output = RequestPermissionResponseSchema.parse(
|
|
27146
27130
|
await this.connection.requestPermission(params)
|
|
27147
27131
|
);
|
|
27148
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
27132
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
27149
27133
|
await confirmationDetails.onConfirm(outcome);
|
|
27150
27134
|
await updatePolicy(
|
|
27151
27135
|
tool,
|
|
@@ -27156,16 +27140,16 @@ ${event.value.description}`;
|
|
|
27156
27140
|
invocation
|
|
27157
27141
|
);
|
|
27158
27142
|
switch (outcome) {
|
|
27159
|
-
case
|
|
27143
|
+
case "cancel" /* Cancel */:
|
|
27160
27144
|
return errorResponse(
|
|
27161
27145
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
27162
27146
|
);
|
|
27163
|
-
case
|
|
27164
|
-
case
|
|
27165
|
-
case
|
|
27166
|
-
case
|
|
27167
|
-
case
|
|
27168
|
-
case
|
|
27147
|
+
case "proceed_once" /* ProceedOnce */:
|
|
27148
|
+
case "proceed_always" /* ProceedAlways */:
|
|
27149
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
27150
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
27151
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
27152
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
27169
27153
|
break;
|
|
27170
27154
|
default: {
|
|
27171
27155
|
const resultOutcome = outcome;
|
|
@@ -27219,7 +27203,7 @@ ${event.value.description}`;
|
|
|
27219
27203
|
);
|
|
27220
27204
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
27221
27205
|
{
|
|
27222
|
-
status:
|
|
27206
|
+
status: "success" /* Success */,
|
|
27223
27207
|
request: {
|
|
27224
27208
|
callId,
|
|
27225
27209
|
name: fc.name,
|
|
@@ -27264,7 +27248,7 @@ ${event.value.description}`;
|
|
|
27264
27248
|
});
|
|
27265
27249
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
27266
27250
|
{
|
|
27267
|
-
status:
|
|
27251
|
+
status: "error" /* Error */,
|
|
27268
27252
|
request: {
|
|
27269
27253
|
callId,
|
|
27270
27254
|
name: fc.name,
|
|
@@ -27392,12 +27376,12 @@ ${event.value.description}`;
|
|
|
27392
27376
|
sessionId: this.id,
|
|
27393
27377
|
options: [
|
|
27394
27378
|
{
|
|
27395
|
-
optionId:
|
|
27379
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
27396
27380
|
name: "Allow once",
|
|
27397
27381
|
kind: "allow_once"
|
|
27398
27382
|
},
|
|
27399
27383
|
{
|
|
27400
|
-
optionId:
|
|
27384
|
+
optionId: "cancel" /* Cancel */,
|
|
27401
27385
|
name: "Deny",
|
|
27402
27386
|
kind: "reject_once"
|
|
27403
27387
|
}
|
|
@@ -27422,8 +27406,8 @@ ${event.value.description}`;
|
|
|
27422
27406
|
const output = RequestPermissionResponseSchema.parse(
|
|
27423
27407
|
await this.connection.requestPermission(params)
|
|
27424
27408
|
);
|
|
27425
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
27426
|
-
if (outcome ===
|
|
27409
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
27410
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
27427
27411
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
27428
27412
|
validationError = null;
|
|
27429
27413
|
} else {
|
|
@@ -27860,7 +27844,7 @@ var AcpSessionManager = class {
|
|
|
27860
27844
|
mcpServers,
|
|
27861
27845
|
loadedSettings
|
|
27862
27846
|
);
|
|
27863
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
27847
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
27864
27848
|
let isAuthenticated = false;
|
|
27865
27849
|
let authErrorMessage = "";
|
|
27866
27850
|
try {
|
|
@@ -27872,7 +27856,7 @@ var AcpSessionManager = class {
|
|
|
27872
27856
|
);
|
|
27873
27857
|
isAuthenticated = true;
|
|
27874
27858
|
const contentGeneratorConfig = config2.getContentGeneratorConfig();
|
|
27875
|
-
if (authType ===
|
|
27859
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
27876
27860
|
isAuthenticated = false;
|
|
27877
27861
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
27878
27862
|
}
|
|
@@ -27981,7 +27965,7 @@ var AcpSessionManager = class {
|
|
|
27981
27965
|
return response;
|
|
27982
27966
|
}
|
|
27983
27967
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
27984
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
27968
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
27985
27969
|
if (!selectedAuthType) {
|
|
27986
27970
|
throw RequestError.authRequired();
|
|
27987
27971
|
}
|
|
@@ -28082,12 +28066,12 @@ var GeminiAgent = class {
|
|
|
28082
28066
|
}
|
|
28083
28067
|
const authMethods = [
|
|
28084
28068
|
{
|
|
28085
|
-
id:
|
|
28069
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
28086
28070
|
name: "Log in with Google",
|
|
28087
28071
|
description: "Log in with your Google account"
|
|
28088
28072
|
},
|
|
28089
28073
|
{
|
|
28090
|
-
id:
|
|
28074
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
28091
28075
|
name: "Gemini API key",
|
|
28092
28076
|
description: "Use an API key with Gemini Developer API",
|
|
28093
28077
|
_meta: {
|
|
@@ -28097,12 +28081,12 @@ var GeminiAgent = class {
|
|
|
28097
28081
|
}
|
|
28098
28082
|
},
|
|
28099
28083
|
{
|
|
28100
|
-
id:
|
|
28084
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
28101
28085
|
name: "Vertex AI",
|
|
28102
28086
|
description: "Use an API key with Vertex AI GenAI API"
|
|
28103
28087
|
},
|
|
28104
28088
|
{
|
|
28105
|
-
id:
|
|
28089
|
+
id: "gateway" /* GATEWAY */,
|
|
28106
28090
|
name: "AI API Gateway",
|
|
28107
28091
|
description: "Use a custom AI API Gateway",
|
|
28108
28092
|
_meta: {
|
|
@@ -28275,7 +28259,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
28275
28259
|
}
|
|
28276
28260
|
return authType;
|
|
28277
28261
|
} catch (error) {
|
|
28278
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
28262
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
28279
28263
|
handleError(
|
|
28280
28264
|
error instanceof Error ? error : new Error(String(error)),
|
|
28281
28265
|
nonInteractiveConfig,
|
|
@@ -28470,10 +28454,10 @@ var SlashCommandConflictHandler = class {
|
|
|
28470
28454
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
28471
28455
|
}
|
|
28472
28456
|
start() {
|
|
28473
|
-
coreEvents.on(
|
|
28457
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
28474
28458
|
}
|
|
28475
28459
|
stop() {
|
|
28476
|
-
coreEvents.off(
|
|
28460
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
28477
28461
|
if (this.flushTimeout) {
|
|
28478
28462
|
clearTimeout(this.flushTimeout);
|
|
28479
28463
|
this.flushTimeout = null;
|
|
@@ -28754,7 +28738,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
28754
28738
|
}
|
|
28755
28739
|
}
|
|
28756
28740
|
async function startInteractiveUI(config2, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
28757
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
28741
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-4GI574PD.js");
|
|
28758
28742
|
await doStartUI(
|
|
28759
28743
|
config2,
|
|
28760
28744
|
settings,
|
|
@@ -28857,12 +28841,12 @@ async function main() {
|
|
|
28857
28841
|
dns.setDefaultResultOrder(
|
|
28858
28842
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
28859
28843
|
);
|
|
28860
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
28844
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
28861
28845
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
28862
28846
|
settings.setValue(
|
|
28863
28847
|
"User" /* User */,
|
|
28864
28848
|
"security.auth.selectedType",
|
|
28865
|
-
|
|
28849
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
28866
28850
|
);
|
|
28867
28851
|
}
|
|
28868
28852
|
}
|
|
@@ -28963,7 +28947,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
28963
28947
|
await config2.storage.initialize();
|
|
28964
28948
|
adminControlsListner.setConfig(config2);
|
|
28965
28949
|
if (config2.isInteractive() && settings.merged.general.devtools) {
|
|
28966
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
28950
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-HCHZ2F6P.js");
|
|
28967
28951
|
setupInitialActivityLogger(config2);
|
|
28968
28952
|
}
|
|
28969
28953
|
registerTelemetryConfig(config2);
|
|
@@ -28971,7 +28955,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
28971
28955
|
const messageBus = config2.getMessageBus();
|
|
28972
28956
|
createPolicyUpdater2(policyEngine, messageBus, config2.storage);
|
|
28973
28957
|
registerCleanup(async () => {
|
|
28974
|
-
await config2?.getHookSystem()?.fireSessionEndEvent(
|
|
28958
|
+
await config2?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
28975
28959
|
});
|
|
28976
28960
|
if (!config2.getAcpMode()) {
|
|
28977
28961
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -29022,7 +29006,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
29022
29006
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
29023
29007
|
const initializationResult = await initializeApp(config2, settings);
|
|
29024
29008
|
initAppHandle?.end();
|
|
29025
|
-
import("./liteRtServerManager-
|
|
29009
|
+
import("./liteRtServerManager-TYKWESZG.js").then(({ LiteRtServerManager }) => {
|
|
29026
29010
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
29027
29011
|
if (!mergedGemma) return;
|
|
29028
29012
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -29032,7 +29016,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
29032
29016
|
autoStartServer: userGemma?.autoStartServer
|
|
29033
29017
|
});
|
|
29034
29018
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
29035
|
-
if (settings.merged.security.auth.selectedType ===
|
|
29019
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config2.isBrowserLaunchSuppressed()) {
|
|
29036
29020
|
await getOauthClient(settings.merged.security.auth.selectedType, config2);
|
|
29037
29021
|
}
|
|
29038
29022
|
if (config2.getAcpMode()) {
|
|
@@ -29048,7 +29032,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
29048
29032
|
...rawStartupWarnings.map((message) => ({
|
|
29049
29033
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
29050
29034
|
message,
|
|
29051
|
-
priority:
|
|
29035
|
+
priority: "high" /* High */
|
|
29052
29036
|
})),
|
|
29053
29037
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
29054
29038
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -29085,7 +29069,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
29085
29069
|
${input}` : stdinData;
|
|
29086
29070
|
}
|
|
29087
29071
|
}
|
|
29088
|
-
const sessionStartSource = resumedSessionData ?
|
|
29072
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
29089
29073
|
const hookSystem = config2?.getHookSystem();
|
|
29090
29074
|
if (hookSystem) {
|
|
29091
29075
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -29142,8 +29126,8 @@ ${input}` : wrappedContext;
|
|
|
29142
29126
|
}
|
|
29143
29127
|
}
|
|
29144
29128
|
function initializeOutputListenersAndFlush(config2) {
|
|
29145
|
-
if (coreEvents.listenerCount(
|
|
29146
|
-
coreEvents.on(
|
|
29129
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
29130
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
29147
29131
|
if (payload.isStderr) {
|
|
29148
29132
|
writeToStderr(payload.chunk, payload.encoding);
|
|
29149
29133
|
} else {
|
|
@@ -29151,8 +29135,8 @@ function initializeOutputListenersAndFlush(config2) {
|
|
|
29151
29135
|
}
|
|
29152
29136
|
});
|
|
29153
29137
|
}
|
|
29154
|
-
if (coreEvents.listenerCount(
|
|
29155
|
-
coreEvents.on(
|
|
29138
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
29139
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
29156
29140
|
if (payload.type === "error" || payload.type === "warn") {
|
|
29157
29141
|
writeToStderr(payload.content + "\n");
|
|
29158
29142
|
} else {
|
|
@@ -29160,8 +29144,8 @@ function initializeOutputListenersAndFlush(config2) {
|
|
|
29160
29144
|
}
|
|
29161
29145
|
});
|
|
29162
29146
|
}
|
|
29163
|
-
if (coreEvents.listenerCount(
|
|
29164
|
-
coreEvents.on(
|
|
29147
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
29148
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
29165
29149
|
writeToStderr(payload.message + "\n");
|
|
29166
29150
|
});
|
|
29167
29151
|
}
|
|
@@ -29169,7 +29153,7 @@ function initializeOutputListenersAndFlush(config2) {
|
|
|
29169
29153
|
const forceToStderr = outputFormat === "json";
|
|
29170
29154
|
coreEvents.drainBacklogs(
|
|
29171
29155
|
(event, args) => {
|
|
29172
|
-
if (forceToStderr && event ===
|
|
29156
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
29173
29157
|
const payload = args[0];
|
|
29174
29158
|
if (!payload.isStderr) {
|
|
29175
29159
|
return {
|