@google/gemini-cli 0.64.0-nightly.20261005.gfb972b2f8 → 0.64.0-preview.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-PO2VSL43.js → chunk-2NQXIWQK.js} +5 -7
- package/bundle/{chunk-JUHOHELL.js → chunk-6OFXOGEG.js} +14846 -7842
- package/bundle/{chunk-EIWQ2LQQ.js → chunk-EBP6K2WG.js} +7 -7
- package/bundle/{chunk-EELKDWQ4.js → chunk-EDVFNWRG.js} +1 -1
- package/bundle/{chunk-EB43SHKX.js → chunk-EDYPRCAA.js} +2 -2
- package/bundle/{chunk-AQYLEGXG.js → chunk-HN74ORTP.js} +1 -1
- package/bundle/{chunk-H7GSTRIW.js → chunk-KCCVXZ52.js} +58 -71
- package/bundle/{chunk-JQYJUNLF.js → chunk-MLSLNORV.js} +3 -3
- package/bundle/{chunk-27FWUQTG.js → chunk-NX7TO2DU.js} +1 -1
- package/bundle/{chunk-NFSPTLUK.js → chunk-SDWOC67Z.js} +1 -1
- package/bundle/{chunk-2TCGCQ3U.js → chunk-UBGF6JU5.js} +1 -1
- package/bundle/{chunk-NALEOBWX.js → chunk-VBVCLWLA.js} +2 -2
- package/bundle/{chunk-UBR6TWNB.js → chunk-VJYKQD5D.js} +3 -3
- package/bundle/{chunk-Q5GLE3YW.js → chunk-Y2HXXBXI.js} +8 -9
- package/bundle/{chunk-OLLYWO5Q.js → chunk-ZOHM7BPT.js} +1 -1
- package/bundle/{chunk-CUFMYKIC.js → chunk-ZQW7OGUO.js} +3 -3
- package/bundle/{cleanup-4TGCO5X2.js → cleanup-GGCB2LVD.js} +2 -2
- package/bundle/{cleanup-6PBH36B7.js → cleanup-JRDG3OTL.js} +2 -2
- package/bundle/{dist-EKBAHHIJ.js → core-6HRWFQZW.js} +1 -1
- package/bundle/{devtoolsService-U6FKQ6JD.js → devtoolsService-MF6JKRUV.js} +3 -4
- package/bundle/{devtoolsService-DH4C7EZB.js → devtoolsService-XZCKFZP5.js} +2 -2
- package/bundle/{dist-UAE7T55Q.js → dist-7L3BRW6V.js} +1 -1
- package/bundle/{gemini-E3VK7GSB.js → gemini-JPMMQ3KA.js} +14 -14
- package/bundle/{gemini-IYF3YHXZ.js → gemini-QOQNG5VY.js} +198 -214
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-WHZXRGLN.js → interactiveCli-R3P4A3FC.js} +293 -312
- package/bundle/{interactiveCli-T3HF2HRX.js → interactiveCli-UDWGRVJL.js} +8 -8
- package/bundle/{liteRtServerManager-X6UOQ3MA.js → liteRtServerManager-OVPUSK2T.js} +4 -4
- package/bundle/{liteRtServerManager-YUF3UXMU.js → liteRtServerManager-RAV63AGE.js} +4 -4
- package/bundle/{oauth2-provider-D4J3TFC3.js → oauth2-provider-FVTRRJZR.js} +1 -1
- package/bundle/{oauth2-provider-F7QKNLGE.js → oauth2-provider-XFP63FGJ.js} +72 -38
- package/bundle/{start-TO2FZTHQ.js → start-5O7TBK5L.js} +6 -6
- package/bundle/{start-U3PILSF7.js → start-VQQ2Q5KT.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-6ISJPGCD.js +0 -154
- package/bundle/chunk-6LCUTDX7.js +0 -401196
- package/bundle/chunk-NBEG6GFX.js +0 -118
- package/bundle/chunk-PGYGRESN.js +0 -425
- package/bundle/chunk-QSGRHC6M.js +0 -1571
- package/bundle/chunk-UMTL4SBM.js +0 -103121
- package/bundle/chunk-UP3637TZ.js +0 -512
- package/bundle/chunk-XZLCMV4F.js +0 -17507
- package/bundle/cleanup-HQ46NIAL.js +0 -32
- package/bundle/devtoolsService-YL2CULLT.js +0 -4359
- package/bundle/dist-BVPLCCBS.js +0 -2252
- package/bundle/gemini-53BFSQPR.js +0 -17934
- package/bundle/interactiveCli-OHZNMG4G.js +0 -34979
- package/bundle/liteRtServerManager-KKZLBYK6.js +0 -65
- package/bundle/oauth2-provider-4V3LC2C5.js +0 -235
- package/bundle/start-JVWQ2CSF.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-VJYKQD5D.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
updateExtension,
|
|
47
47
|
validateAuthMethod,
|
|
48
48
|
validateContextFilePath
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-KCCVXZ52.js";
|
|
50
50
|
import {
|
|
51
51
|
exitCli,
|
|
52
52
|
require_source
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-EDVFNWRG.js";
|
|
54
54
|
import {
|
|
55
55
|
appEvents
|
|
56
56
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -88,11 +88,11 @@ import {
|
|
|
88
88
|
resolveGemmaConfig,
|
|
89
89
|
saveModelChange,
|
|
90
90
|
stripAnsi
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-2NQXIWQK.js";
|
|
92
92
|
import {
|
|
93
93
|
RELAUNCH_EXIT_CODE
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import "./chunk-
|
|
94
|
+
} from "./chunk-EDYPRCAA.js";
|
|
95
|
+
import "./chunk-Y2HXXBXI.js";
|
|
96
96
|
import {
|
|
97
97
|
cleanupCheckpoints,
|
|
98
98
|
registerCleanup,
|
|
@@ -101,15 +101,12 @@ import {
|
|
|
101
101
|
runExitCleanup,
|
|
102
102
|
runSyncCleanup,
|
|
103
103
|
setupSignalHandlers
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-SDWOC67Z.js";
|
|
105
105
|
import {
|
|
106
106
|
ASK_USER_TOOL_NAME,
|
|
107
|
-
ApprovalMode,
|
|
108
107
|
AuthType,
|
|
109
108
|
Client,
|
|
110
109
|
Config,
|
|
111
|
-
CoreEvent,
|
|
112
|
-
CoreToolCallStatus,
|
|
113
110
|
DEFAULT_CONTEXT_FILENAME,
|
|
114
111
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
115
112
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -131,27 +128,19 @@ import {
|
|
|
131
128
|
FolderTrustDiscoveryService,
|
|
132
129
|
GEMINI_DIR,
|
|
133
130
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
134
|
-
GeminiEventType,
|
|
135
131
|
IdeClient,
|
|
136
|
-
IntegrityStatus,
|
|
137
132
|
InvalidStreamError,
|
|
138
133
|
JsonFormatter,
|
|
139
|
-
JsonStreamEventType,
|
|
140
|
-
Kind,
|
|
141
134
|
LegacyAgentSession,
|
|
142
135
|
Logger,
|
|
143
136
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
144
137
|
MCPServerConfig,
|
|
145
|
-
MCPServerStatus,
|
|
146
|
-
MessageBusType,
|
|
147
138
|
OTHER_BLOCKED_MESSAGE,
|
|
148
|
-
OutputFormat,
|
|
149
139
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
150
140
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
151
141
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
152
142
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
153
143
|
PREVIEW_GEMINI_MODEL,
|
|
154
|
-
PolicyDecision,
|
|
155
144
|
PolicyIntegrityManager,
|
|
156
145
|
RECITATION_BLOCKED_MESSAGE,
|
|
157
146
|
REFERENCE_CONTENT_START,
|
|
@@ -159,8 +148,6 @@ import {
|
|
|
159
148
|
ReadManyFilesTool,
|
|
160
149
|
SAFETY_BLOCKED_MESSAGE,
|
|
161
150
|
Scheduler,
|
|
162
|
-
SessionEndReason,
|
|
163
|
-
SessionStartSource,
|
|
164
151
|
ShellExecutionService,
|
|
165
152
|
SimpleExtensionLoader,
|
|
166
153
|
Storage,
|
|
@@ -169,13 +156,10 @@ import {
|
|
|
169
156
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
170
157
|
ToolCallEvent,
|
|
171
158
|
ToolConfirmationOutcome,
|
|
172
|
-
ToolErrorType,
|
|
173
|
-
TrustLevel,
|
|
174
159
|
UserAccountManager,
|
|
175
160
|
UserPromptEvent,
|
|
176
161
|
ValidationCancelledError,
|
|
177
162
|
ValidationRequiredError,
|
|
178
|
-
WarningPriority,
|
|
179
163
|
applyAdminAllowlist,
|
|
180
164
|
applyRequiredServers,
|
|
181
165
|
clearCachedCredentialFile,
|
|
@@ -256,7 +240,7 @@ import {
|
|
|
256
240
|
updatePolicy,
|
|
257
241
|
writeToStderr,
|
|
258
242
|
writeToStdout
|
|
259
|
-
} from "./chunk-
|
|
243
|
+
} from "./chunk-6OFXOGEG.js";
|
|
260
244
|
import "./chunk-664ZODQF.js";
|
|
261
245
|
import "./chunk-IUUIT4SU.js";
|
|
262
246
|
import "./chunk-L6PII3GR.js";
|
|
@@ -5386,7 +5370,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5386
5370
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5387
5371
|
const isStdio = !!config.command;
|
|
5388
5372
|
if (isStdio && !isTrusted) {
|
|
5389
|
-
return
|
|
5373
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5390
5374
|
}
|
|
5391
5375
|
const client = new Client({
|
|
5392
5376
|
name: "mcp-test-client",
|
|
@@ -5422,7 +5406,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5422
5406
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5423
5407
|
} catch {
|
|
5424
5408
|
await client.close();
|
|
5425
|
-
return
|
|
5409
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5426
5410
|
}
|
|
5427
5411
|
try {
|
|
5428
5412
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5436,10 +5420,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5436
5420
|
);
|
|
5437
5421
|
}
|
|
5438
5422
|
await client.close();
|
|
5439
|
-
return
|
|
5423
|
+
return "connected" /* CONNECTED */;
|
|
5440
5424
|
} catch {
|
|
5441
5425
|
await transport.close();
|
|
5442
|
-
return
|
|
5426
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5443
5427
|
}
|
|
5444
5428
|
}
|
|
5445
5429
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5452,12 +5436,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5452
5436
|
});
|
|
5453
5437
|
if (!loadResult.allowed) {
|
|
5454
5438
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5455
|
-
return
|
|
5439
|
+
return "blocked" /* BLOCKED */;
|
|
5456
5440
|
}
|
|
5457
|
-
return
|
|
5441
|
+
return "disabled" /* DISABLED */;
|
|
5458
5442
|
}
|
|
5459
5443
|
if (!isTrusted) {
|
|
5460
|
-
return
|
|
5444
|
+
return "disabled" /* DISABLED */;
|
|
5461
5445
|
}
|
|
5462
5446
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5463
5447
|
}
|
|
@@ -5503,23 +5487,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5503
5487
|
let statusIndicator = "";
|
|
5504
5488
|
let statusText = "";
|
|
5505
5489
|
switch (status) {
|
|
5506
|
-
case
|
|
5490
|
+
case "connected" /* CONNECTED */:
|
|
5507
5491
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5508
5492
|
statusText = "Connected";
|
|
5509
5493
|
break;
|
|
5510
|
-
case
|
|
5494
|
+
case "connecting" /* CONNECTING */:
|
|
5511
5495
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5512
5496
|
statusText = "Connecting";
|
|
5513
5497
|
break;
|
|
5514
|
-
case
|
|
5498
|
+
case "blocked" /* BLOCKED */:
|
|
5515
5499
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5516
5500
|
statusText = "Blocked";
|
|
5517
5501
|
break;
|
|
5518
|
-
case
|
|
5502
|
+
case "disabled" /* DISABLED */:
|
|
5519
5503
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5520
5504
|
statusText = "Disabled";
|
|
5521
5505
|
break;
|
|
5522
|
-
case
|
|
5506
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5523
5507
|
default:
|
|
5524
5508
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5525
5509
|
statusText = "Disconnected";
|
|
@@ -5805,7 +5789,7 @@ async function handleInstall(args) {
|
|
|
5805
5789
|
);
|
|
5806
5790
|
if (confirmed) {
|
|
5807
5791
|
const trustedFolders = loadTrustedFolders();
|
|
5808
|
-
await trustedFolders.setValue(realPath,
|
|
5792
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5809
5793
|
} else {
|
|
5810
5794
|
throw new Error(
|
|
5811
5795
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7856,7 +7840,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7856
7840
|
}
|
|
7857
7841
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7858
7842
|
const packageJson = await getPackageJson(__dirname3);
|
|
7859
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.64.0-
|
|
7843
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.64.0-preview.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7860
7844
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7861
7845
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7862
7846
|
}
|
|
@@ -7915,9 +7899,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7915
7899
|
cwd,
|
|
7916
7900
|
potentialWorkspacePoliciesDir
|
|
7917
7901
|
);
|
|
7918
|
-
if (integrityResult.status ===
|
|
7902
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7919
7903
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7920
|
-
} else if (integrityResult.status ===
|
|
7904
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7921
7905
|
workspacePoliciesDir = void 0;
|
|
7922
7906
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7923
7907
|
policyUpdateConfirmationRequest = {
|
|
@@ -8345,23 +8329,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8345
8329
|
if (rawApprovalMode) {
|
|
8346
8330
|
switch (rawApprovalMode) {
|
|
8347
8331
|
case "yolo":
|
|
8348
|
-
approvalMode =
|
|
8332
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8349
8333
|
break;
|
|
8350
8334
|
case "auto_edit":
|
|
8351
|
-
approvalMode =
|
|
8335
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8352
8336
|
break;
|
|
8353
8337
|
case "plan":
|
|
8354
8338
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8355
8339
|
debugLogger.warn(
|
|
8356
8340
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8357
8341
|
);
|
|
8358
|
-
approvalMode =
|
|
8342
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8359
8343
|
} else {
|
|
8360
|
-
approvalMode =
|
|
8344
|
+
approvalMode = "plan" /* PLAN */;
|
|
8361
8345
|
}
|
|
8362
8346
|
break;
|
|
8363
8347
|
case "default":
|
|
8364
|
-
approvalMode =
|
|
8348
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8365
8349
|
break;
|
|
8366
8350
|
default:
|
|
8367
8351
|
throw new Error(
|
|
@@ -8369,10 +8353,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8369
8353
|
);
|
|
8370
8354
|
}
|
|
8371
8355
|
} else {
|
|
8372
|
-
approvalMode =
|
|
8356
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8373
8357
|
}
|
|
8374
8358
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8375
|
-
if (approvalMode ===
|
|
8359
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8376
8360
|
if (settings.admin?.secureModeEnabled) {
|
|
8377
8361
|
debugLogger.error(
|
|
8378
8362
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8390,16 +8374,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8390
8374
|
)
|
|
8391
8375
|
);
|
|
8392
8376
|
}
|
|
8393
|
-
} else if (approvalMode ===
|
|
8377
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8394
8378
|
debugLogger.warn(
|
|
8395
8379
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8396
8380
|
);
|
|
8397
8381
|
}
|
|
8398
|
-
if (!trustedFolder && approvalMode !==
|
|
8382
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8399
8383
|
debugLogger.warn(
|
|
8400
8384
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8401
8385
|
);
|
|
8402
|
-
approvalMode =
|
|
8386
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8403
8387
|
}
|
|
8404
8388
|
let telemetrySettings;
|
|
8405
8389
|
try {
|
|
@@ -11100,7 +11084,7 @@ import path10 from "node:path";
|
|
|
11100
11084
|
import process4 from "node:process";
|
|
11101
11085
|
var homeDirectoryCheck = {
|
|
11102
11086
|
id: "home-directory",
|
|
11103
|
-
priority:
|
|
11087
|
+
priority: "low" /* Low */,
|
|
11104
11088
|
check: async (workspaceRoot, settings) => {
|
|
11105
11089
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
11106
11090
|
return null;
|
|
@@ -11124,7 +11108,7 @@ var homeDirectoryCheck = {
|
|
|
11124
11108
|
};
|
|
11125
11109
|
var rootDirectoryCheck = {
|
|
11126
11110
|
id: "root-directory",
|
|
11127
|
-
priority:
|
|
11111
|
+
priority: "high" /* High */,
|
|
11128
11112
|
check: async (workspaceRoot, _settings) => {
|
|
11129
11113
|
try {
|
|
11130
11114
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -11140,7 +11124,7 @@ var rootDirectoryCheck = {
|
|
|
11140
11124
|
};
|
|
11141
11125
|
var folderTrustCheck = {
|
|
11142
11126
|
id: "folder-trust",
|
|
11143
|
-
priority:
|
|
11127
|
+
priority: "high" /* High */,
|
|
11144
11128
|
check: async (workspaceRoot, settings) => {
|
|
11145
11129
|
if (!isFolderTrustEnabled(settings)) {
|
|
11146
11130
|
return null;
|
|
@@ -11330,12 +11314,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
11330
11314
|
error,
|
|
11331
11315
|
config.getContentGeneratorConfig()?.authType
|
|
11332
11316
|
);
|
|
11333
|
-
if (config.getOutputFormat() ===
|
|
11317
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11334
11318
|
const streamFormatter = new StreamJsonFormatter();
|
|
11335
11319
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11336
11320
|
const metrics = uiTelemetryService.getMetrics();
|
|
11337
11321
|
streamFormatter.emitEvent({
|
|
11338
|
-
type:
|
|
11322
|
+
type: "result" /* RESULT */,
|
|
11339
11323
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11340
11324
|
status: "error",
|
|
11341
11325
|
error: {
|
|
@@ -11346,7 +11330,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
11346
11330
|
});
|
|
11347
11331
|
runSyncCleanup();
|
|
11348
11332
|
process.exit(getNumericExitCode(errorCode));
|
|
11349
|
-
} else if (config.getOutputFormat() ===
|
|
11333
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11350
11334
|
const formatter = new JsonFormatter();
|
|
11351
11335
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11352
11336
|
const formattedError = formatter.formatError(
|
|
@@ -11366,11 +11350,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11366
11350
|
const isFatal = isFatalToolError(errorType);
|
|
11367
11351
|
if (isFatal) {
|
|
11368
11352
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
11369
|
-
if (config.getOutputFormat() ===
|
|
11353
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11370
11354
|
const streamFormatter = new StreamJsonFormatter();
|
|
11371
11355
|
const metrics = uiTelemetryService.getMetrics();
|
|
11372
11356
|
streamFormatter.emitEvent({
|
|
11373
|
-
type:
|
|
11357
|
+
type: "result" /* RESULT */,
|
|
11374
11358
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11375
11359
|
status: "error",
|
|
11376
11360
|
error: {
|
|
@@ -11379,7 +11363,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11379
11363
|
},
|
|
11380
11364
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
11381
11365
|
});
|
|
11382
|
-
} else if (config.getOutputFormat() ===
|
|
11366
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11383
11367
|
const formatter = new JsonFormatter();
|
|
11384
11368
|
const formattedError = formatter.formatError(
|
|
11385
11369
|
toolExecutionError,
|
|
@@ -11397,11 +11381,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11397
11381
|
}
|
|
11398
11382
|
function handleCancellationError(config) {
|
|
11399
11383
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
11400
|
-
if (config.getOutputFormat() ===
|
|
11384
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11401
11385
|
const streamFormatter = new StreamJsonFormatter();
|
|
11402
11386
|
const metrics = uiTelemetryService.getMetrics();
|
|
11403
11387
|
streamFormatter.emitEvent({
|
|
11404
|
-
type:
|
|
11388
|
+
type: "result" /* RESULT */,
|
|
11405
11389
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11406
11390
|
status: "error",
|
|
11407
11391
|
error: {
|
|
@@ -11412,7 +11396,7 @@ function handleCancellationError(config) {
|
|
|
11412
11396
|
});
|
|
11413
11397
|
runSyncCleanup();
|
|
11414
11398
|
process.exit(cancellationError.exitCode);
|
|
11415
|
-
} else if (config.getOutputFormat() ===
|
|
11399
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11416
11400
|
const formatter = new JsonFormatter();
|
|
11417
11401
|
const formattedError = formatter.formatError(
|
|
11418
11402
|
cancellationError,
|
|
@@ -11432,11 +11416,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11432
11416
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
11433
11417
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
11434
11418
|
);
|
|
11435
|
-
if (config.getOutputFormat() ===
|
|
11419
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11436
11420
|
const streamFormatter = new StreamJsonFormatter();
|
|
11437
11421
|
const metrics = uiTelemetryService.getMetrics();
|
|
11438
11422
|
streamFormatter.emitEvent({
|
|
11439
|
-
type:
|
|
11423
|
+
type: "result" /* RESULT */,
|
|
11440
11424
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11441
11425
|
status: "error",
|
|
11442
11426
|
error: {
|
|
@@ -11447,7 +11431,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11447
11431
|
});
|
|
11448
11432
|
runSyncCleanup();
|
|
11449
11433
|
process.exit(maxTurnsError.exitCode);
|
|
11450
|
-
} else if (config.getOutputFormat() ===
|
|
11434
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11451
11435
|
const formatter = new JsonFormatter();
|
|
11452
11436
|
const formattedError = formatter.formatError(
|
|
11453
11437
|
maxTurnsError,
|
|
@@ -11527,7 +11511,7 @@ async function runNonInteractive({
|
|
|
11527
11511
|
}
|
|
11528
11512
|
});
|
|
11529
11513
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11530
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11514
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-MF6JKRUV.js");
|
|
11531
11515
|
setupInitialActivityLogger(config);
|
|
11532
11516
|
}
|
|
11533
11517
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11543,7 +11527,7 @@ async function runNonInteractive({
|
|
|
11543
11527
|
}
|
|
11544
11528
|
};
|
|
11545
11529
|
const startTime = Date.now();
|
|
11546
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11530
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
11547
11531
|
const abortController = new AbortController();
|
|
11548
11532
|
let isAborting = false;
|
|
11549
11533
|
let cancelMessageTimer = null;
|
|
@@ -11596,13 +11580,13 @@ async function runNonInteractive({
|
|
|
11596
11580
|
};
|
|
11597
11581
|
try {
|
|
11598
11582
|
consolePatcher.patch();
|
|
11599
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11583
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11600
11584
|
process.stderr.write(
|
|
11601
11585
|
"[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"
|
|
11602
11586
|
);
|
|
11603
11587
|
}
|
|
11604
11588
|
setupStdinCancellation();
|
|
11605
|
-
coreEvents.on(
|
|
11589
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11606
11590
|
coreEvents.drainBacklogs();
|
|
11607
11591
|
process.stdout.on("error", (err) => {
|
|
11608
11592
|
if (err.code === "EPIPE") {
|
|
@@ -11628,7 +11612,7 @@ async function runNonInteractive({
|
|
|
11628
11612
|
}
|
|
11629
11613
|
if (streamFormatter) {
|
|
11630
11614
|
streamFormatter.emitEvent({
|
|
11631
|
-
type:
|
|
11615
|
+
type: "init" /* INIT */,
|
|
11632
11616
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11633
11617
|
session_id: config.getSessionId(),
|
|
11634
11618
|
model: config.getModel()
|
|
@@ -11666,7 +11650,7 @@ async function runNonInteractive({
|
|
|
11666
11650
|
}
|
|
11667
11651
|
if (streamFormatter) {
|
|
11668
11652
|
streamFormatter.emitEvent({
|
|
11669
|
-
type:
|
|
11653
|
+
type: "message" /* MESSAGE */,
|
|
11670
11654
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11671
11655
|
role: "user",
|
|
11672
11656
|
content: input
|
|
@@ -11705,12 +11689,12 @@ async function runNonInteractive({
|
|
|
11705
11689
|
const metrics = uiTelemetryService.getMetrics();
|
|
11706
11690
|
const durationMs = Date.now() - startTime;
|
|
11707
11691
|
streamFormatter.emitEvent({
|
|
11708
|
-
type:
|
|
11692
|
+
type: "result" /* RESULT */,
|
|
11709
11693
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11710
11694
|
status: errorPayload ? "error" : "success",
|
|
11711
11695
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11712
11696
|
});
|
|
11713
|
-
} else if (config.getOutputFormat() ===
|
|
11697
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11714
11698
|
const formatter = new JsonFormatter();
|
|
11715
11699
|
const stats = uiTelemetryService.getMetrics();
|
|
11716
11700
|
textOutput.write(
|
|
@@ -11803,13 +11787,13 @@ async function runNonInteractive({
|
|
|
11803
11787
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
11804
11788
|
if (streamFormatter) {
|
|
11805
11789
|
streamFormatter.emitEvent({
|
|
11806
|
-
type:
|
|
11790
|
+
type: "message" /* MESSAGE */,
|
|
11807
11791
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11808
11792
|
role: "assistant",
|
|
11809
11793
|
content: output,
|
|
11810
11794
|
delta: true
|
|
11811
11795
|
});
|
|
11812
|
-
} else if (config.getOutputFormat() ===
|
|
11796
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11813
11797
|
responseText += output;
|
|
11814
11798
|
} else {
|
|
11815
11799
|
if (part.text) {
|
|
@@ -11822,13 +11806,13 @@ async function runNonInteractive({
|
|
|
11822
11806
|
break;
|
|
11823
11807
|
}
|
|
11824
11808
|
case "tool_request": {
|
|
11825
|
-
if (config.getOutputFormat() ===
|
|
11809
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11826
11810
|
preToolResponseText = responseText || preToolResponseText;
|
|
11827
11811
|
responseText = "";
|
|
11828
11812
|
}
|
|
11829
11813
|
if (streamFormatter) {
|
|
11830
11814
|
streamFormatter.emitEvent({
|
|
11831
|
-
type:
|
|
11815
|
+
type: "tool_use" /* TOOL_USE */,
|
|
11832
11816
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11833
11817
|
tool_name: event.name,
|
|
11834
11818
|
tool_id: event.requestId,
|
|
@@ -11844,7 +11828,7 @@ async function runNonInteractive({
|
|
|
11844
11828
|
const displayText = displayContentToString(display);
|
|
11845
11829
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11846
11830
|
streamFormatter.emitEvent({
|
|
11847
|
-
type:
|
|
11831
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11848
11832
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11849
11833
|
tool_id: event.requestId,
|
|
11850
11834
|
status: event.isError ? "error" : "success",
|
|
@@ -11859,17 +11843,17 @@ async function runNonInteractive({
|
|
|
11859
11843
|
const display = event.display?.result;
|
|
11860
11844
|
const displayText = displayContentToString(display);
|
|
11861
11845
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11862
|
-
if (event.data?.["errorType"] ===
|
|
11863
|
-
if (config.getOutputFormat() ===
|
|
11846
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
11847
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
11864
11848
|
responseText = preToolResponseText;
|
|
11865
11849
|
}
|
|
11866
11850
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
11867
|
-
if (config.getOutputFormat() ===
|
|
11851
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11868
11852
|
process.stderr.write(`${stopMessage}
|
|
11869
11853
|
`);
|
|
11870
11854
|
}
|
|
11871
11855
|
}
|
|
11872
|
-
if (event.data?.["errorType"] ===
|
|
11856
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
11873
11857
|
throw new FatalToolExecutionError(
|
|
11874
11858
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
11875
11859
|
);
|
|
@@ -11904,12 +11888,12 @@ async function runNonInteractive({
|
|
|
11904
11888
|
}
|
|
11905
11889
|
if (streamFormatter) {
|
|
11906
11890
|
streamFormatter.emitEvent({
|
|
11907
|
-
type:
|
|
11891
|
+
type: "error" /* ERROR */,
|
|
11908
11892
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11909
11893
|
severity: "error",
|
|
11910
11894
|
message: errorMessage
|
|
11911
11895
|
});
|
|
11912
|
-
} else if (config.getOutputFormat() ===
|
|
11896
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11913
11897
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
11914
11898
|
`);
|
|
11915
11899
|
}
|
|
@@ -11930,12 +11914,12 @@ async function runNonInteractive({
|
|
|
11930
11914
|
const errorCode = event._meta?.["code"];
|
|
11931
11915
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
11932
11916
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
11933
|
-
if (config.getOutputFormat() ===
|
|
11917
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11934
11918
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11935
11919
|
`);
|
|
11936
11920
|
} else if (streamFormatter) {
|
|
11937
11921
|
streamFormatter.emitEvent({
|
|
11938
|
-
type:
|
|
11922
|
+
type: "error" /* ERROR */,
|
|
11939
11923
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11940
11924
|
severity: "warning",
|
|
11941
11925
|
message: stripAnsi(blockMessage)
|
|
@@ -11945,13 +11929,13 @@ async function runNonInteractive({
|
|
|
11945
11929
|
break;
|
|
11946
11930
|
}
|
|
11947
11931
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
11948
|
-
if (config.getOutputFormat() ===
|
|
11932
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11949
11933
|
process.stderr.write(`[WARNING] ${event.message}
|
|
11950
11934
|
`);
|
|
11951
11935
|
}
|
|
11952
11936
|
if (streamFormatter) {
|
|
11953
11937
|
streamFormatter.emitEvent({
|
|
11954
|
-
type:
|
|
11938
|
+
type: "error" /* ERROR */,
|
|
11955
11939
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11956
11940
|
severity,
|
|
11957
11941
|
message: stripAnsi(event.message)
|
|
@@ -11971,7 +11955,7 @@ async function runNonInteractive({
|
|
|
11971
11955
|
);
|
|
11972
11956
|
} else if (streamFormatter) {
|
|
11973
11957
|
streamFormatter.emitEvent({
|
|
11974
|
-
type:
|
|
11958
|
+
type: "error" /* ERROR */,
|
|
11975
11959
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11976
11960
|
severity: "error",
|
|
11977
11961
|
message: "Maximum session turns exceeded"
|
|
@@ -11979,7 +11963,7 @@ async function runNonInteractive({
|
|
|
11979
11963
|
}
|
|
11980
11964
|
}
|
|
11981
11965
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
11982
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
11966
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11983
11967
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
11984
11968
|
`);
|
|
11985
11969
|
}
|
|
@@ -12009,7 +11993,7 @@ async function runNonInteractive({
|
|
|
12009
11993
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
12010
11994
|
scheduler?.dispose();
|
|
12011
11995
|
consolePatcher.cleanup();
|
|
12012
|
-
coreEvents.off(
|
|
11996
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
12013
11997
|
}
|
|
12014
11998
|
if (errorToHandle) {
|
|
12015
11999
|
handleError(errorToHandle, config);
|
|
@@ -12037,7 +12021,7 @@ async function runNonInteractive2(params) {
|
|
|
12037
12021
|
}
|
|
12038
12022
|
});
|
|
12039
12023
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
12040
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
12024
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-MF6JKRUV.js");
|
|
12041
12025
|
setupInitialActivityLogger(config);
|
|
12042
12026
|
}
|
|
12043
12027
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -12053,7 +12037,7 @@ async function runNonInteractive2(params) {
|
|
|
12053
12037
|
}
|
|
12054
12038
|
};
|
|
12055
12039
|
const startTime = Date.now();
|
|
12056
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
12040
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
12057
12041
|
const abortController = new AbortController();
|
|
12058
12042
|
let isAborting = false;
|
|
12059
12043
|
let cancelMessageTimer = null;
|
|
@@ -12104,13 +12088,13 @@ async function runNonInteractive2(params) {
|
|
|
12104
12088
|
let scheduler;
|
|
12105
12089
|
try {
|
|
12106
12090
|
consolePatcher.patch();
|
|
12107
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
12091
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
12108
12092
|
process.stderr.write(
|
|
12109
12093
|
"[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"
|
|
12110
12094
|
);
|
|
12111
12095
|
}
|
|
12112
12096
|
setupStdinCancellation();
|
|
12113
|
-
coreEvents.on(
|
|
12097
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
12114
12098
|
coreEvents.drainBacklogs();
|
|
12115
12099
|
process.stdout.on("error", (err) => {
|
|
12116
12100
|
if (err.code === "EPIPE") {
|
|
@@ -12134,7 +12118,7 @@ async function runNonInteractive2(params) {
|
|
|
12134
12118
|
}
|
|
12135
12119
|
if (streamFormatter) {
|
|
12136
12120
|
streamFormatter.emitEvent({
|
|
12137
|
-
type:
|
|
12121
|
+
type: "init" /* INIT */,
|
|
12138
12122
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12139
12123
|
session_id: config.getSessionId(),
|
|
12140
12124
|
model: config.getModel()
|
|
@@ -12172,7 +12156,7 @@ async function runNonInteractive2(params) {
|
|
|
12172
12156
|
}
|
|
12173
12157
|
if (streamFormatter) {
|
|
12174
12158
|
streamFormatter.emitEvent({
|
|
12175
|
-
type:
|
|
12159
|
+
type: "message" /* MESSAGE */,
|
|
12176
12160
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12177
12161
|
role: "user",
|
|
12178
12162
|
content: input
|
|
@@ -12200,28 +12184,28 @@ async function runNonInteractive2(params) {
|
|
|
12200
12184
|
if (abortController.signal.aborted) {
|
|
12201
12185
|
handleCancellationError(config);
|
|
12202
12186
|
}
|
|
12203
|
-
if (event.type ===
|
|
12187
|
+
if (event.type === "content" /* Content */) {
|
|
12204
12188
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
12205
12189
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
12206
12190
|
if (streamFormatter) {
|
|
12207
12191
|
streamFormatter.emitEvent({
|
|
12208
|
-
type:
|
|
12192
|
+
type: "message" /* MESSAGE */,
|
|
12209
12193
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12210
12194
|
role: "assistant",
|
|
12211
12195
|
content: output,
|
|
12212
12196
|
delta: true
|
|
12213
12197
|
});
|
|
12214
|
-
} else if (config.getOutputFormat() ===
|
|
12198
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12215
12199
|
responseText += output;
|
|
12216
12200
|
} else {
|
|
12217
12201
|
if (event.value) {
|
|
12218
12202
|
textOutput.write(output);
|
|
12219
12203
|
}
|
|
12220
12204
|
}
|
|
12221
|
-
} else if (event.type ===
|
|
12205
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
12222
12206
|
if (streamFormatter) {
|
|
12223
12207
|
streamFormatter.emitEvent({
|
|
12224
|
-
type:
|
|
12208
|
+
type: "tool_use" /* TOOL_USE */,
|
|
12225
12209
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12226
12210
|
tool_name: event.value.name,
|
|
12227
12211
|
tool_id: event.value.callId,
|
|
@@ -12229,33 +12213,33 @@ async function runNonInteractive2(params) {
|
|
|
12229
12213
|
});
|
|
12230
12214
|
}
|
|
12231
12215
|
toolCallRequests.push(event.value);
|
|
12232
|
-
} else if (event.type ===
|
|
12216
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
12233
12217
|
const message = "Loop detected, stopping execution";
|
|
12234
12218
|
if (streamFormatter) {
|
|
12235
12219
|
streamFormatter.emitEvent({
|
|
12236
|
-
type:
|
|
12220
|
+
type: "error" /* ERROR */,
|
|
12237
12221
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12238
12222
|
severity: "warning",
|
|
12239
12223
|
message
|
|
12240
12224
|
});
|
|
12241
12225
|
}
|
|
12242
12226
|
warnings.push(message);
|
|
12243
|
-
} else if (event.type ===
|
|
12227
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
12244
12228
|
const message = "Maximum session turns exceeded";
|
|
12245
12229
|
if (streamFormatter) {
|
|
12246
12230
|
streamFormatter.emitEvent({
|
|
12247
|
-
type:
|
|
12231
|
+
type: "error" /* ERROR */,
|
|
12248
12232
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12249
12233
|
severity: "error",
|
|
12250
12234
|
message
|
|
12251
12235
|
});
|
|
12252
12236
|
}
|
|
12253
12237
|
warnings.push(message);
|
|
12254
|
-
} else if (event.type ===
|
|
12238
|
+
} else if (event.type === "error" /* Error */) {
|
|
12255
12239
|
throw event.value.error;
|
|
12256
|
-
} else if (event.type ===
|
|
12240
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
12257
12241
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12258
|
-
if (config.getOutputFormat() ===
|
|
12242
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
12259
12243
|
process.stderr.write(`${stopMessage}
|
|
12260
12244
|
`);
|
|
12261
12245
|
}
|
|
@@ -12263,7 +12247,7 @@ async function runNonInteractive2(params) {
|
|
|
12263
12247
|
const metrics = uiTelemetryService.getMetrics();
|
|
12264
12248
|
const durationMs = Date.now() - startTime;
|
|
12265
12249
|
streamFormatter.emitEvent({
|
|
12266
|
-
type:
|
|
12250
|
+
type: "result" /* RESULT */,
|
|
12267
12251
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12268
12252
|
status: "success",
|
|
12269
12253
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12271,7 +12255,7 @@ async function runNonInteractive2(params) {
|
|
|
12271
12255
|
durationMs
|
|
12272
12256
|
)
|
|
12273
12257
|
});
|
|
12274
|
-
} else if (config.getOutputFormat() ===
|
|
12258
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12275
12259
|
const formatter = new JsonFormatter();
|
|
12276
12260
|
const stats = uiTelemetryService.getMetrics();
|
|
12277
12261
|
textOutput.write(
|
|
@@ -12287,21 +12271,21 @@ async function runNonInteractive2(params) {
|
|
|
12287
12271
|
textOutput.ensureTrailingNewline();
|
|
12288
12272
|
}
|
|
12289
12273
|
return;
|
|
12290
|
-
} else if (event.type ===
|
|
12274
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
12291
12275
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12292
|
-
if (config.getOutputFormat() ===
|
|
12276
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
12293
12277
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
12294
12278
|
`);
|
|
12295
12279
|
} else if (streamFormatter) {
|
|
12296
12280
|
streamFormatter.emitEvent({
|
|
12297
|
-
type:
|
|
12281
|
+
type: "error" /* ERROR */,
|
|
12298
12282
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12299
12283
|
severity: "warning",
|
|
12300
12284
|
message: stripAnsi(blockMessage)
|
|
12301
12285
|
});
|
|
12302
12286
|
}
|
|
12303
12287
|
warnings.push(blockMessage);
|
|
12304
|
-
} else if (event.type ===
|
|
12288
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
12305
12289
|
const eventValue = event.value;
|
|
12306
12290
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
12307
12291
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -12324,12 +12308,12 @@ async function runNonInteractive2(params) {
|
|
|
12324
12308
|
);
|
|
12325
12309
|
if (streamFormatter) {
|
|
12326
12310
|
streamFormatter.emitEvent({
|
|
12327
|
-
type:
|
|
12311
|
+
type: "error" /* ERROR */,
|
|
12328
12312
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12329
12313
|
severity: "error",
|
|
12330
12314
|
message: invalidStreamError
|
|
12331
12315
|
});
|
|
12332
|
-
} else if (config.getOutputFormat() ===
|
|
12316
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
12333
12317
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
12334
12318
|
`);
|
|
12335
12319
|
}
|
|
@@ -12349,7 +12333,7 @@ async function runNonInteractive2(params) {
|
|
|
12349
12333
|
const requestInfo = completedToolCall.request;
|
|
12350
12334
|
if (streamFormatter) {
|
|
12351
12335
|
streamFormatter.emitEvent({
|
|
12352
|
-
type:
|
|
12336
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
12353
12337
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12354
12338
|
tool_id: requestInfo.callId,
|
|
12355
12339
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -12383,11 +12367,11 @@ async function runNonInteractive2(params) {
|
|
|
12383
12367
|
);
|
|
12384
12368
|
}
|
|
12385
12369
|
const stopExecutionTool = completedToolCalls.find(
|
|
12386
|
-
(tc) => tc.response.errorType ===
|
|
12370
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
12387
12371
|
);
|
|
12388
12372
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
12389
12373
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
12390
|
-
if (config.getOutputFormat() ===
|
|
12374
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
12391
12375
|
process.stderr.write(`${stopMessage}
|
|
12392
12376
|
`);
|
|
12393
12377
|
}
|
|
@@ -12395,7 +12379,7 @@ async function runNonInteractive2(params) {
|
|
|
12395
12379
|
const metrics = uiTelemetryService.getMetrics();
|
|
12396
12380
|
const durationMs = Date.now() - startTime;
|
|
12397
12381
|
streamFormatter.emitEvent({
|
|
12398
|
-
type:
|
|
12382
|
+
type: "result" /* RESULT */,
|
|
12399
12383
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12400
12384
|
status: "success",
|
|
12401
12385
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12403,7 +12387,7 @@ async function runNonInteractive2(params) {
|
|
|
12403
12387
|
durationMs
|
|
12404
12388
|
)
|
|
12405
12389
|
});
|
|
12406
|
-
} else if (config.getOutputFormat() ===
|
|
12390
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12407
12391
|
const formatter = new JsonFormatter();
|
|
12408
12392
|
const stats = uiTelemetryService.getMetrics();
|
|
12409
12393
|
textOutput.write(
|
|
@@ -12426,12 +12410,12 @@ async function runNonInteractive2(params) {
|
|
|
12426
12410
|
const metrics = uiTelemetryService.getMetrics();
|
|
12427
12411
|
const durationMs = Date.now() - startTime;
|
|
12428
12412
|
streamFormatter.emitEvent({
|
|
12429
|
-
type:
|
|
12413
|
+
type: "result" /* RESULT */,
|
|
12430
12414
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12431
12415
|
status: invalidStreamError ? "error" : "success",
|
|
12432
12416
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
12433
12417
|
});
|
|
12434
|
-
} else if (config.getOutputFormat() ===
|
|
12418
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12435
12419
|
const formatter = new JsonFormatter();
|
|
12436
12420
|
const stats = uiTelemetryService.getMetrics();
|
|
12437
12421
|
textOutput.write(
|
|
@@ -12455,7 +12439,7 @@ async function runNonInteractive2(params) {
|
|
|
12455
12439
|
cleanupStdinCancellation();
|
|
12456
12440
|
scheduler?.dispose();
|
|
12457
12441
|
consolePatcher.cleanup();
|
|
12458
|
-
coreEvents.off(
|
|
12442
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
12459
12443
|
}
|
|
12460
12444
|
if (errorToHandle) {
|
|
12461
12445
|
handleError(errorToHandle, config);
|
|
@@ -14846,12 +14830,12 @@ function toToolCallContent(toolResult) {
|
|
|
14846
14830
|
}
|
|
14847
14831
|
var basicPermissionOptions = [
|
|
14848
14832
|
{
|
|
14849
|
-
optionId:
|
|
14833
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14850
14834
|
name: "Allow",
|
|
14851
14835
|
kind: "allow_once"
|
|
14852
14836
|
},
|
|
14853
14837
|
{
|
|
14854
|
-
optionId:
|
|
14838
|
+
optionId: "cancel" /* Cancel */,
|
|
14855
14839
|
name: "Reject",
|
|
14856
14840
|
kind: "reject_once"
|
|
14857
14841
|
}
|
|
@@ -14863,13 +14847,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14863
14847
|
switch (confirmation.type) {
|
|
14864
14848
|
case "edit":
|
|
14865
14849
|
options.push({
|
|
14866
|
-
optionId:
|
|
14850
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14867
14851
|
name: "Allow for this session",
|
|
14868
14852
|
kind: "allow_always"
|
|
14869
14853
|
});
|
|
14870
14854
|
if (enablePermanentToolApproval) {
|
|
14871
14855
|
options.push({
|
|
14872
|
-
optionId:
|
|
14856
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14873
14857
|
name: "Allow for this file in all future sessions",
|
|
14874
14858
|
kind: "allow_always"
|
|
14875
14859
|
});
|
|
@@ -14877,13 +14861,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14877
14861
|
break;
|
|
14878
14862
|
case "exec":
|
|
14879
14863
|
options.push({
|
|
14880
|
-
optionId:
|
|
14864
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14881
14865
|
name: "Allow for this session",
|
|
14882
14866
|
kind: "allow_always"
|
|
14883
14867
|
});
|
|
14884
14868
|
if (enablePermanentToolApproval) {
|
|
14885
14869
|
options.push({
|
|
14886
|
-
optionId:
|
|
14870
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14887
14871
|
name: "Allow this command for all future sessions",
|
|
14888
14872
|
kind: "allow_always"
|
|
14889
14873
|
});
|
|
@@ -14892,19 +14876,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14892
14876
|
case "mcp":
|
|
14893
14877
|
options.push(
|
|
14894
14878
|
{
|
|
14895
|
-
optionId:
|
|
14879
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
14896
14880
|
name: "Allow all server tools for this session",
|
|
14897
14881
|
kind: "allow_always"
|
|
14898
14882
|
},
|
|
14899
14883
|
{
|
|
14900
|
-
optionId:
|
|
14884
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
14901
14885
|
name: "Allow tool for this session",
|
|
14902
14886
|
kind: "allow_always"
|
|
14903
14887
|
}
|
|
14904
14888
|
);
|
|
14905
14889
|
if (enablePermanentToolApproval) {
|
|
14906
14890
|
options.push({
|
|
14907
|
-
optionId:
|
|
14891
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14908
14892
|
name: "Allow tool for all future sessions",
|
|
14909
14893
|
kind: "allow_always"
|
|
14910
14894
|
});
|
|
@@ -14912,13 +14896,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14912
14896
|
break;
|
|
14913
14897
|
case "info":
|
|
14914
14898
|
options.push({
|
|
14915
|
-
optionId:
|
|
14899
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14916
14900
|
name: "Allow for this session",
|
|
14917
14901
|
kind: "allow_always"
|
|
14918
14902
|
});
|
|
14919
14903
|
if (enablePermanentToolApproval) {
|
|
14920
14904
|
options.push({
|
|
14921
|
-
optionId:
|
|
14905
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14922
14906
|
name: "Allow for all future sessions",
|
|
14923
14907
|
kind: "allow_always"
|
|
14924
14908
|
});
|
|
@@ -14950,21 +14934,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14950
14934
|
}
|
|
14951
14935
|
function toAcpToolKind(kind) {
|
|
14952
14936
|
switch (kind) {
|
|
14953
|
-
case
|
|
14954
|
-
case
|
|
14955
|
-
case
|
|
14956
|
-
case
|
|
14957
|
-
case
|
|
14958
|
-
case
|
|
14959
|
-
case
|
|
14960
|
-
case
|
|
14961
|
-
case
|
|
14962
|
-
case
|
|
14937
|
+
case "read" /* Read */:
|
|
14938
|
+
case "edit" /* Edit */:
|
|
14939
|
+
case "execute" /* Execute */:
|
|
14940
|
+
case "search" /* Search */:
|
|
14941
|
+
case "delete" /* Delete */:
|
|
14942
|
+
case "move" /* Move */:
|
|
14943
|
+
case "think" /* Think */:
|
|
14944
|
+
case "fetch" /* Fetch */:
|
|
14945
|
+
case "switch_mode" /* SwitchMode */:
|
|
14946
|
+
case "other" /* Other */:
|
|
14963
14947
|
return kind;
|
|
14964
|
-
case
|
|
14948
|
+
case "agent" /* Agent */:
|
|
14965
14949
|
return "think";
|
|
14966
|
-
case
|
|
14967
|
-
case
|
|
14950
|
+
case "plan" /* Plan */:
|
|
14951
|
+
case "communicate" /* Communicate */:
|
|
14968
14952
|
default:
|
|
14969
14953
|
return "other";
|
|
14970
14954
|
}
|
|
@@ -14972,24 +14956,24 @@ function toAcpToolKind(kind) {
|
|
|
14972
14956
|
function buildAvailableModes(isPlanEnabled) {
|
|
14973
14957
|
const modes = [
|
|
14974
14958
|
{
|
|
14975
|
-
id:
|
|
14959
|
+
id: "default" /* DEFAULT */,
|
|
14976
14960
|
name: "Default",
|
|
14977
14961
|
description: "Prompts for approval"
|
|
14978
14962
|
},
|
|
14979
14963
|
{
|
|
14980
|
-
id:
|
|
14964
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
14981
14965
|
name: "Auto Edit",
|
|
14982
14966
|
description: "Auto-approves edit tools"
|
|
14983
14967
|
},
|
|
14984
14968
|
{
|
|
14985
|
-
id:
|
|
14969
|
+
id: "yolo" /* YOLO */,
|
|
14986
14970
|
name: "YOLO",
|
|
14987
14971
|
description: "Auto-approves all tools"
|
|
14988
14972
|
}
|
|
14989
14973
|
];
|
|
14990
14974
|
if (isPlanEnabled) {
|
|
14991
14975
|
modes.push({
|
|
14992
|
-
id:
|
|
14976
|
+
id: "plan" /* PLAN */,
|
|
14993
14977
|
name: "Plan",
|
|
14994
14978
|
description: "Read-only mode"
|
|
14995
14979
|
});
|
|
@@ -15003,7 +14987,7 @@ function buildAvailableModels(config, settings) {
|
|
|
15003
14987
|
const useLatestFlash = config.hasLatestFlashGAAccess?.() ?? false;
|
|
15004
14988
|
const useLatestFlashLite = config.hasLatestFlashLiteGAAccess?.() ?? false;
|
|
15005
14989
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
15006
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
14990
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
15007
14991
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
15008
14992
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
15009
14993
|
useGemini3_1: useGemini31,
|
|
@@ -15090,11 +15074,11 @@ var Session = class {
|
|
|
15090
15074
|
this.connection = connection;
|
|
15091
15075
|
this.settings = settings;
|
|
15092
15076
|
coreEvents.on(
|
|
15093
|
-
|
|
15077
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
15094
15078
|
this.handleApprovalModeChanged
|
|
15095
15079
|
);
|
|
15096
15080
|
this.context.config.getMessageBus()?.subscribe(
|
|
15097
|
-
|
|
15081
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
15098
15082
|
this.handleToolConfirmationRequest,
|
|
15099
15083
|
{ signal: this.disposeController.signal }
|
|
15100
15084
|
);
|
|
@@ -15118,7 +15102,7 @@ var Session = class {
|
|
|
15118
15102
|
"Policy engine missing. Denying tool confirmation request."
|
|
15119
15103
|
);
|
|
15120
15104
|
await messageBus.publish({
|
|
15121
|
-
type:
|
|
15105
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15122
15106
|
correlationId: request.correlationId,
|
|
15123
15107
|
confirmed: false,
|
|
15124
15108
|
requiresUserConfirmation: false
|
|
@@ -15131,7 +15115,7 @@ var Session = class {
|
|
|
15131
15115
|
"Tool confirmation request missing tool name. Denying."
|
|
15132
15116
|
);
|
|
15133
15117
|
await messageBus.publish({
|
|
15134
|
-
type:
|
|
15118
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15135
15119
|
correlationId: request.correlationId,
|
|
15136
15120
|
confirmed: false,
|
|
15137
15121
|
requiresUserConfirmation: false
|
|
@@ -15144,7 +15128,7 @@ var Session = class {
|
|
|
15144
15128
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
15145
15129
|
);
|
|
15146
15130
|
await messageBus.publish({
|
|
15147
|
-
type:
|
|
15131
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15148
15132
|
correlationId: request.correlationId,
|
|
15149
15133
|
confirmed: false,
|
|
15150
15134
|
requiresUserConfirmation: false
|
|
@@ -15160,15 +15144,15 @@ var Session = class {
|
|
|
15160
15144
|
request.subagent
|
|
15161
15145
|
);
|
|
15162
15146
|
await messageBus.publish({
|
|
15163
|
-
type:
|
|
15147
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15164
15148
|
correlationId: request.correlationId,
|
|
15165
|
-
confirmed: result.decision ===
|
|
15166
|
-
requiresUserConfirmation: result.decision ===
|
|
15149
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
15150
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
15167
15151
|
});
|
|
15168
15152
|
} catch (error) {
|
|
15169
15153
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
15170
15154
|
await this.context.config.getMessageBus()?.publish({
|
|
15171
|
-
type:
|
|
15155
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15172
15156
|
correlationId: request.correlationId,
|
|
15173
15157
|
confirmed: false,
|
|
15174
15158
|
requiresUserConfirmation: false
|
|
@@ -15188,7 +15172,7 @@ var Session = class {
|
|
|
15188
15172
|
};
|
|
15189
15173
|
async dispose() {
|
|
15190
15174
|
coreEvents.off(
|
|
15191
|
-
|
|
15175
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
15192
15176
|
this.handleApprovalModeChanged
|
|
15193
15177
|
);
|
|
15194
15178
|
this.disposeController.abort();
|
|
@@ -15284,7 +15268,7 @@ ${thought.description}`;
|
|
|
15284
15268
|
await this.sendUpdate({
|
|
15285
15269
|
sessionUpdate: "tool_call",
|
|
15286
15270
|
toolCallId: toolCall.id,
|
|
15287
|
-
status: toolCall.status ===
|
|
15271
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
15288
15272
|
title: toolCall.displayName || toolCall.name,
|
|
15289
15273
|
content: toolCallContent,
|
|
15290
15274
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -15393,7 +15377,7 @@ ${thought.description}`;
|
|
|
15393
15377
|
return { stopReason: "cancelled" };
|
|
15394
15378
|
}
|
|
15395
15379
|
switch (event.type) {
|
|
15396
|
-
case
|
|
15380
|
+
case "content" /* Content */: {
|
|
15397
15381
|
const content = {
|
|
15398
15382
|
type: "text",
|
|
15399
15383
|
text: event.value
|
|
@@ -15404,7 +15388,7 @@ ${thought.description}`;
|
|
|
15404
15388
|
});
|
|
15405
15389
|
break;
|
|
15406
15390
|
}
|
|
15407
|
-
case
|
|
15391
|
+
case "thought" /* Thought */: {
|
|
15408
15392
|
const thoughtText = `**${event.value.subject}**
|
|
15409
15393
|
${event.value.description}`;
|
|
15410
15394
|
await this.sendUpdate({
|
|
@@ -15413,10 +15397,10 @@ ${event.value.description}`;
|
|
|
15413
15397
|
});
|
|
15414
15398
|
break;
|
|
15415
15399
|
}
|
|
15416
|
-
case
|
|
15400
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
15417
15401
|
toolCallRequests.push(event.value);
|
|
15418
15402
|
break;
|
|
15419
|
-
case
|
|
15403
|
+
case "finished" /* Finished */: {
|
|
15420
15404
|
const usage2 = event.value.usageMetadata;
|
|
15421
15405
|
if (usage2) {
|
|
15422
15406
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -15433,19 +15417,19 @@ ${event.value.description}`;
|
|
|
15433
15417
|
}
|
|
15434
15418
|
break;
|
|
15435
15419
|
}
|
|
15436
|
-
case
|
|
15420
|
+
case "model_info" /* ModelInfo */:
|
|
15437
15421
|
turnModelId = event.value;
|
|
15438
15422
|
break;
|
|
15439
|
-
case
|
|
15423
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
15440
15424
|
stopReason = "max_turn_requests";
|
|
15441
15425
|
break;
|
|
15442
|
-
case
|
|
15426
|
+
case "loop_detected" /* LoopDetected */:
|
|
15443
15427
|
stopReason = "max_turn_requests";
|
|
15444
15428
|
break;
|
|
15445
|
-
case
|
|
15429
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
15446
15430
|
stopReason = "max_tokens";
|
|
15447
15431
|
break;
|
|
15448
|
-
case
|
|
15432
|
+
case "error" /* Error */: {
|
|
15449
15433
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
15450
15434
|
event.value.error
|
|
15451
15435
|
);
|
|
@@ -15626,7 +15610,7 @@ ${event.value.description}`;
|
|
|
15626
15610
|
const output = RequestPermissionResponseSchema.parse(
|
|
15627
15611
|
await this.connection.requestPermission(params)
|
|
15628
15612
|
);
|
|
15629
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15613
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15630
15614
|
await confirmationDetails.onConfirm(outcome);
|
|
15631
15615
|
await updatePolicy(
|
|
15632
15616
|
tool,
|
|
@@ -15637,7 +15621,7 @@ ${event.value.description}`;
|
|
|
15637
15621
|
invocation
|
|
15638
15622
|
);
|
|
15639
15623
|
switch (outcome) {
|
|
15640
|
-
case
|
|
15624
|
+
case "cancel" /* Cancel */: {
|
|
15641
15625
|
const cancelError = new Error(
|
|
15642
15626
|
`Tool "${fc.name}" was canceled by the user.`
|
|
15643
15627
|
);
|
|
@@ -15655,12 +15639,12 @@ ${event.value.description}`;
|
|
|
15655
15639
|
});
|
|
15656
15640
|
return errorResponse(cancelError);
|
|
15657
15641
|
}
|
|
15658
|
-
case
|
|
15659
|
-
case
|
|
15660
|
-
case
|
|
15661
|
-
case
|
|
15662
|
-
case
|
|
15663
|
-
case
|
|
15642
|
+
case "proceed_once" /* ProceedOnce */:
|
|
15643
|
+
case "proceed_always" /* ProceedAlways */:
|
|
15644
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
15645
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
15646
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
15647
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
15664
15648
|
break;
|
|
15665
15649
|
default: {
|
|
15666
15650
|
const resultOutcome = outcome;
|
|
@@ -15714,7 +15698,7 @@ ${event.value.description}`;
|
|
|
15714
15698
|
);
|
|
15715
15699
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15716
15700
|
{
|
|
15717
|
-
status:
|
|
15701
|
+
status: "success" /* Success */,
|
|
15718
15702
|
request: {
|
|
15719
15703
|
callId,
|
|
15720
15704
|
name: fc.name,
|
|
@@ -15759,7 +15743,7 @@ ${event.value.description}`;
|
|
|
15759
15743
|
});
|
|
15760
15744
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15761
15745
|
{
|
|
15762
|
-
status:
|
|
15746
|
+
status: "error" /* Error */,
|
|
15763
15747
|
request: {
|
|
15764
15748
|
callId,
|
|
15765
15749
|
name: fc.name,
|
|
@@ -15887,12 +15871,12 @@ ${event.value.description}`;
|
|
|
15887
15871
|
sessionId: this.id,
|
|
15888
15872
|
options: [
|
|
15889
15873
|
{
|
|
15890
|
-
optionId:
|
|
15874
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
15891
15875
|
name: "Allow once",
|
|
15892
15876
|
kind: "allow_once"
|
|
15893
15877
|
},
|
|
15894
15878
|
{
|
|
15895
|
-
optionId:
|
|
15879
|
+
optionId: "cancel" /* Cancel */,
|
|
15896
15880
|
name: "Deny",
|
|
15897
15881
|
kind: "reject_once"
|
|
15898
15882
|
}
|
|
@@ -15917,8 +15901,8 @@ ${event.value.description}`;
|
|
|
15917
15901
|
const output = RequestPermissionResponseSchema.parse(
|
|
15918
15902
|
await this.connection.requestPermission(params)
|
|
15919
15903
|
);
|
|
15920
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15921
|
-
if (outcome ===
|
|
15904
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15905
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
15922
15906
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
15923
15907
|
validationError = null;
|
|
15924
15908
|
} else {
|
|
@@ -16363,7 +16347,7 @@ var AcpSessionManager = class {
|
|
|
16363
16347
|
mcpServers,
|
|
16364
16348
|
loadedSettings
|
|
16365
16349
|
);
|
|
16366
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16350
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
16367
16351
|
let isAuthenticated = false;
|
|
16368
16352
|
let authErrorMessage = "";
|
|
16369
16353
|
try {
|
|
@@ -16375,7 +16359,7 @@ var AcpSessionManager = class {
|
|
|
16375
16359
|
);
|
|
16376
16360
|
isAuthenticated = true;
|
|
16377
16361
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
16378
|
-
if (authType ===
|
|
16362
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
16379
16363
|
isAuthenticated = false;
|
|
16380
16364
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
16381
16365
|
}
|
|
@@ -16559,7 +16543,7 @@ var AcpSessionManager = class {
|
|
|
16559
16543
|
}
|
|
16560
16544
|
}
|
|
16561
16545
|
async prepareSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
16562
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16546
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
16563
16547
|
if (!selectedAuthType) {
|
|
16564
16548
|
throw RequestError.authRequired();
|
|
16565
16549
|
}
|
|
@@ -16671,12 +16655,12 @@ var GeminiAgent = class {
|
|
|
16671
16655
|
}
|
|
16672
16656
|
const authMethods = [
|
|
16673
16657
|
{
|
|
16674
|
-
id:
|
|
16658
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
16675
16659
|
name: "Log in with Google",
|
|
16676
16660
|
description: "Log in with your Google account"
|
|
16677
16661
|
},
|
|
16678
16662
|
{
|
|
16679
|
-
id:
|
|
16663
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
16680
16664
|
name: "Gemini API key",
|
|
16681
16665
|
description: "Use an API key with Gemini Developer API",
|
|
16682
16666
|
_meta: {
|
|
@@ -16686,12 +16670,12 @@ var GeminiAgent = class {
|
|
|
16686
16670
|
}
|
|
16687
16671
|
},
|
|
16688
16672
|
{
|
|
16689
|
-
id:
|
|
16673
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
16690
16674
|
name: "Vertex AI",
|
|
16691
16675
|
description: "Use an API key with Vertex AI GenAI API"
|
|
16692
16676
|
},
|
|
16693
16677
|
{
|
|
16694
|
-
id:
|
|
16678
|
+
id: "gateway" /* GATEWAY */,
|
|
16695
16679
|
name: "AI API Gateway",
|
|
16696
16680
|
description: "Use a custom AI API Gateway",
|
|
16697
16681
|
_meta: {
|
|
@@ -16864,7 +16848,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
16864
16848
|
}
|
|
16865
16849
|
return authType;
|
|
16866
16850
|
} catch (error) {
|
|
16867
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
16851
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
16868
16852
|
handleError(
|
|
16869
16853
|
error instanceof Error ? error : new Error(String(error)),
|
|
16870
16854
|
nonInteractiveConfig,
|
|
@@ -17059,10 +17043,10 @@ var SlashCommandConflictHandler = class {
|
|
|
17059
17043
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
17060
17044
|
}
|
|
17061
17045
|
start() {
|
|
17062
|
-
coreEvents.on(
|
|
17046
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
17063
17047
|
}
|
|
17064
17048
|
stop() {
|
|
17065
|
-
coreEvents.off(
|
|
17049
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
17066
17050
|
if (this.flushTimeout) {
|
|
17067
17051
|
clearTimeout(this.flushTimeout);
|
|
17068
17052
|
this.flushTimeout = null;
|
|
@@ -17418,7 +17402,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
17418
17402
|
}
|
|
17419
17403
|
}
|
|
17420
17404
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
17421
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
17405
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-R3P4A3FC.js");
|
|
17422
17406
|
await doStartUI(
|
|
17423
17407
|
config,
|
|
17424
17408
|
settings,
|
|
@@ -17521,12 +17505,12 @@ async function main() {
|
|
|
17521
17505
|
dns.setDefaultResultOrder(
|
|
17522
17506
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
17523
17507
|
);
|
|
17524
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
17508
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
17525
17509
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
17526
17510
|
settings.setValue(
|
|
17527
17511
|
"User" /* User */,
|
|
17528
17512
|
"security.auth.selectedType",
|
|
17529
|
-
|
|
17513
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
17530
17514
|
);
|
|
17531
17515
|
}
|
|
17532
17516
|
}
|
|
@@ -17627,7 +17611,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17627
17611
|
await config.storage.initialize();
|
|
17628
17612
|
adminControlsListner.setConfig(config);
|
|
17629
17613
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
17630
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
17614
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-MF6JKRUV.js");
|
|
17631
17615
|
setupInitialActivityLogger(config);
|
|
17632
17616
|
}
|
|
17633
17617
|
registerTelemetryConfig(config);
|
|
@@ -17635,7 +17619,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17635
17619
|
const messageBus = config.getMessageBus();
|
|
17636
17620
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
17637
17621
|
registerCleanup(async () => {
|
|
17638
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
17622
|
+
await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
17639
17623
|
});
|
|
17640
17624
|
if (!config.getAcpMode()) {
|
|
17641
17625
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -17686,7 +17670,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17686
17670
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
17687
17671
|
const initializationResult = await initializeApp(config, settings);
|
|
17688
17672
|
initAppHandle?.end();
|
|
17689
|
-
import("./liteRtServerManager-
|
|
17673
|
+
import("./liteRtServerManager-RAV63AGE.js").then(({ LiteRtServerManager }) => {
|
|
17690
17674
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
17691
17675
|
if (!mergedGemma) return;
|
|
17692
17676
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -17696,7 +17680,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17696
17680
|
autoStartServer: userGemma?.autoStartServer
|
|
17697
17681
|
});
|
|
17698
17682
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
17699
|
-
if (settings.merged.security.auth.selectedType ===
|
|
17683
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
17700
17684
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
17701
17685
|
}
|
|
17702
17686
|
if (config.getAcpMode()) {
|
|
@@ -17712,7 +17696,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17712
17696
|
...rawStartupWarnings.map((message) => ({
|
|
17713
17697
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
17714
17698
|
message,
|
|
17715
|
-
priority:
|
|
17699
|
+
priority: "high" /* High */
|
|
17716
17700
|
})),
|
|
17717
17701
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
17718
17702
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -17749,7 +17733,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17749
17733
|
${input}` : stdinData;
|
|
17750
17734
|
}
|
|
17751
17735
|
}
|
|
17752
|
-
const sessionStartSource = resumedSessionData ?
|
|
17736
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
17753
17737
|
const hookSystem = config?.getHookSystem();
|
|
17754
17738
|
if (hookSystem) {
|
|
17755
17739
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -17806,8 +17790,8 @@ ${input}` : wrappedContext;
|
|
|
17806
17790
|
}
|
|
17807
17791
|
}
|
|
17808
17792
|
function initializeOutputListenersAndFlush(config) {
|
|
17809
|
-
if (coreEvents.listenerCount(
|
|
17810
|
-
coreEvents.on(
|
|
17793
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
17794
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
17811
17795
|
if (payload.isStderr) {
|
|
17812
17796
|
writeToStderr(payload.chunk, payload.encoding);
|
|
17813
17797
|
} else {
|
|
@@ -17815,8 +17799,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17815
17799
|
}
|
|
17816
17800
|
});
|
|
17817
17801
|
}
|
|
17818
|
-
if (coreEvents.listenerCount(
|
|
17819
|
-
coreEvents.on(
|
|
17802
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
17803
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
17820
17804
|
if (payload.type === "error" || payload.type === "warn") {
|
|
17821
17805
|
writeToStderr(payload.content + "\n");
|
|
17822
17806
|
} else {
|
|
@@ -17824,8 +17808,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17824
17808
|
}
|
|
17825
17809
|
});
|
|
17826
17810
|
}
|
|
17827
|
-
if (coreEvents.listenerCount(
|
|
17828
|
-
coreEvents.on(
|
|
17811
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
17812
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
17829
17813
|
writeToStderr(payload.message + "\n");
|
|
17830
17814
|
});
|
|
17831
17815
|
}
|
|
@@ -17833,7 +17817,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17833
17817
|
const forceToStderr = outputFormat === "json";
|
|
17834
17818
|
coreEvents.drainBacklogs(
|
|
17835
17819
|
(event, args) => {
|
|
17836
|
-
if (forceToStderr && event ===
|
|
17820
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
17837
17821
|
const payload = args[0];
|
|
17838
17822
|
if (!payload.isStderr) {
|
|
17839
17823
|
return {
|