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