@costrict/csc 4.2.8-beta1 → 4.2.8
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/dist/cli.js +975 -581
- package/dist/services/rawDump/batchWorker.js +4 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -43388,7 +43388,7 @@ var init_errors3 = __esm(() => {
|
|
|
43388
43388
|
"errors.cli.unableToCreateRemoteSession": "\u9519\u8BEF: \u65E0\u6CD5\u521B\u5EFA\u8FDC\u7A0B\u4F1A\u8BDD",
|
|
43389
43389
|
"errors.cli.stdinTimeout": "\u8B66\u544A: 3 \u79D2\u5185\u672A\u6536\u5230 stdin \u6570\u636E\uFF0C\u5C06\u5728\u65E0\u6570\u636E\u60C5\u51B5\u4E0B\u7EE7\u7EED\u3002" + `\u5982\u679C\u4ECE\u8F83\u6162\u7684\u547D\u4EE4\u7BA1\u9053\u4F20\u5165\uFF0C\u8BF7\u663E\u5F0F\u91CD\u5B9A\u5411 stdin\uFF1A\u4F7F\u7528 < /dev/null \u8DF3\u8FC7\uFF0C\u6216\u7B49\u5F85\u66F4\u957F\u65F6\u95F4\u3002
|
|
43390
43390
|
`,
|
|
43391
|
-
"security.commandContains": "\
|
|
43391
|
+
"security.commandContains": "\u5305\u542B {message}",
|
|
43392
43392
|
"security.commandSubstitution": "\u547D\u4EE4\u66FF\u6362 $()",
|
|
43393
43393
|
"security.processSubIn": "\u8FDB\u7A0B\u66FF\u6362 <()",
|
|
43394
43394
|
"security.processSubOut": "\u8FDB\u7A0B\u66FF\u6362 >()",
|
|
@@ -63721,8 +63721,8 @@ var init_credentials = __esm(() => {
|
|
|
63721
63721
|
import { createRequire } from "module";
|
|
63722
63722
|
function getVersion() {
|
|
63723
63723
|
try {
|
|
63724
|
-
if (typeof MACRO !== "undefined" && "4.2.8
|
|
63725
|
-
return "4.2.8
|
|
63724
|
+
if (typeof MACRO !== "undefined" && "4.2.8")
|
|
63725
|
+
return "4.2.8";
|
|
63726
63726
|
} catch {}
|
|
63727
63727
|
try {
|
|
63728
63728
|
const require2 = createRequire(import.meta.url);
|
|
@@ -184019,7 +184019,7 @@ async function fetchCoStrictModels(baseUrl, accessToken) {
|
|
|
184019
184019
|
headers: {
|
|
184020
184020
|
Authorization: `Bearer ${accessToken}`,
|
|
184021
184021
|
Accept: "application/json",
|
|
184022
|
-
"User-Agent": `csc/${"4.2.8
|
|
184022
|
+
"User-Agent": `csc/${"4.2.8"}`
|
|
184023
184023
|
},
|
|
184024
184024
|
signal: controller.signal
|
|
184025
184025
|
});
|
|
@@ -187605,7 +187605,7 @@ var init_auth7 = __esm(() => {
|
|
|
187605
187605
|
|
|
187606
187606
|
// src/utils/userAgent.ts
|
|
187607
187607
|
function getClaudeCodeUserAgent() {
|
|
187608
|
-
return `costrict/${"4.2.8
|
|
187608
|
+
return `costrict/${"4.2.8"}`;
|
|
187609
187609
|
}
|
|
187610
187610
|
|
|
187611
187611
|
// src/utils/workloadContext.ts
|
|
@@ -187627,7 +187627,7 @@ function getUserAgent() {
|
|
|
187627
187627
|
const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
|
|
187628
187628
|
const workload = getWorkload();
|
|
187629
187629
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
187630
|
-
return `csc/${"4.2.8
|
|
187630
|
+
return `csc/${"4.2.8"}`;
|
|
187631
187631
|
}
|
|
187632
187632
|
function getMCPUserAgent() {
|
|
187633
187633
|
const parts = [];
|
|
@@ -187641,7 +187641,7 @@ function getMCPUserAgent() {
|
|
|
187641
187641
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
187642
187642
|
}
|
|
187643
187643
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
187644
|
-
return `csc/${"4.2.8
|
|
187644
|
+
return `csc/${"4.2.8"}${suffix}`;
|
|
187645
187645
|
}
|
|
187646
187646
|
function getWebFetchUserAgent() {
|
|
187647
187647
|
return `Claude-User (${getClaudeCodeUserAgent()}; +https://support.anthropic.com/)`;
|
|
@@ -187761,7 +187761,7 @@ var init_user = __esm(() => {
|
|
|
187761
187761
|
deviceId,
|
|
187762
187762
|
sessionId: getSessionId(),
|
|
187763
187763
|
email: getEmail(),
|
|
187764
|
-
appVersion: "4.2.8
|
|
187764
|
+
appVersion: "4.2.8",
|
|
187765
187765
|
platform: getHostPlatformForAnalytics(),
|
|
187766
187766
|
organizationUuid,
|
|
187767
187767
|
accountUuid,
|
|
@@ -198842,7 +198842,7 @@ var init_metadata = __esm(() => {
|
|
|
198842
198842
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
198843
198843
|
WHITESPACE_REGEX = /\s+/;
|
|
198844
198844
|
getVersionBase = memoize_default(() => {
|
|
198845
|
-
const match = "4.2.8
|
|
198845
|
+
const match = "4.2.8".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
198846
198846
|
return match ? match[0] : undefined;
|
|
198847
198847
|
});
|
|
198848
198848
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -198882,9 +198882,9 @@ var init_metadata = __esm(() => {
|
|
|
198882
198882
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
198883
198883
|
isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
|
|
198884
198884
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
198885
|
-
version: "4.2.8
|
|
198885
|
+
version: "4.2.8",
|
|
198886
198886
|
versionBase: getVersionBase(),
|
|
198887
|
-
buildTime: "2026-
|
|
198887
|
+
buildTime: "2026-07-01T09:41:30.503Z",
|
|
198888
198888
|
deploymentEnvironment: env4.detectDeploymentEnvironment(),
|
|
198889
198889
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
198890
198890
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -199555,7 +199555,7 @@ function initialize1PEventLogging() {
|
|
|
199555
199555
|
const platform3 = getPlatform();
|
|
199556
199556
|
const attributes = {
|
|
199557
199557
|
[import_semantic_conventions2.ATTR_SERVICE_NAME]: "claude-code",
|
|
199558
|
-
[import_semantic_conventions2.ATTR_SERVICE_VERSION]: "4.2.8
|
|
199558
|
+
[import_semantic_conventions2.ATTR_SERVICE_VERSION]: "4.2.8"
|
|
199559
199559
|
};
|
|
199560
199560
|
if (platform3 === "wsl") {
|
|
199561
199561
|
const wslVersion = getWslVersion();
|
|
@@ -199582,7 +199582,7 @@ function initialize1PEventLogging() {
|
|
|
199582
199582
|
})
|
|
199583
199583
|
]
|
|
199584
199584
|
});
|
|
199585
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.anthropic.claude_code.events", "4.2.8
|
|
199585
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.anthropic.claude_code.events", "4.2.8");
|
|
199586
199586
|
}
|
|
199587
199587
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
199588
199588
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -296619,8 +296619,63 @@ function wrapOpenAIErrorForRetry(error58) {
|
|
|
296619
296619
|
}
|
|
296620
296620
|
return new APIError(error58.status ?? 0, error58.error, error58.message, headers);
|
|
296621
296621
|
}
|
|
296622
|
+
if (error58 instanceof Error) {
|
|
296623
|
+
const chatRagCode = inferChatRagCodeFromApiError(error58.message);
|
|
296624
|
+
if (chatRagCode) {
|
|
296625
|
+
const nonRetryableCodes = [
|
|
296626
|
+
CHAT_RAG_ERR_CODES.ContextExceeded,
|
|
296627
|
+
CHAT_RAG_ERR_CODES.Unauthorized,
|
|
296628
|
+
CHAT_RAG_ERR_CODES.EmptyMessageContent
|
|
296629
|
+
];
|
|
296630
|
+
if (!nonRetryableCodes.includes(chatRagCode)) {
|
|
296631
|
+
const headers = new Headers;
|
|
296632
|
+
headers.set("x-chat-rag-code", chatRagCode);
|
|
296633
|
+
return new APIError(503, {}, error58.message, headers);
|
|
296634
|
+
}
|
|
296635
|
+
}
|
|
296636
|
+
if (isStreamNetworkError(error58.message)) {
|
|
296637
|
+
return new APIConnectionError({ cause: error58 });
|
|
296638
|
+
}
|
|
296639
|
+
}
|
|
296622
296640
|
return error58;
|
|
296623
296641
|
}
|
|
296642
|
+
function isStreamNetworkError(message2) {
|
|
296643
|
+
const lower = message2.toLowerCase();
|
|
296644
|
+
return lower.includes("connection reset") || lower.includes("connection error") || lower.includes("network error") || lower.includes("network connection") || lower.includes("network interrupt") || lower.includes("econnreset") || lower.includes("epipe") || lower.includes("etimedout") || lower.includes("fetch failed") || lower.includes("aborted") || lower.includes("broken pipe") || lower.includes("reset by peer") || lower.includes("unexpected end") || lower.includes("stream closed") || lower.includes("terminated");
|
|
296645
|
+
}
|
|
296646
|
+
function isRetryableStreamError(error58) {
|
|
296647
|
+
if (error58 instanceof APIUserAbortError) {
|
|
296648
|
+
return false;
|
|
296649
|
+
}
|
|
296650
|
+
if (error58 instanceof APIConnectionError) {
|
|
296651
|
+
return true;
|
|
296652
|
+
}
|
|
296653
|
+
if (error58 instanceof APIError) {
|
|
296654
|
+
const chatRagCode = getChatRagCode(error58);
|
|
296655
|
+
if (chatRagCode && isChatRagErrorCode(chatRagCode)) {
|
|
296656
|
+
const nonRetryableCodes = [
|
|
296657
|
+
CHAT_RAG_ERR_CODES.ContextExceeded,
|
|
296658
|
+
CHAT_RAG_ERR_CODES.Unauthorized,
|
|
296659
|
+
CHAT_RAG_ERR_CODES.EmptyMessageContent
|
|
296660
|
+
];
|
|
296661
|
+
return !nonRetryableCodes.includes(chatRagCode);
|
|
296662
|
+
}
|
|
296663
|
+
return error58.status === 429 || error58.status === 529 || (error58.status ?? 0) >= 500;
|
|
296664
|
+
}
|
|
296665
|
+
if (error58 instanceof Error) {
|
|
296666
|
+
const chatRagCode = inferChatRagCodeFromApiError(error58.message);
|
|
296667
|
+
if (chatRagCode) {
|
|
296668
|
+
const nonRetryableCodes = [
|
|
296669
|
+
CHAT_RAG_ERR_CODES.ContextExceeded,
|
|
296670
|
+
CHAT_RAG_ERR_CODES.Unauthorized,
|
|
296671
|
+
CHAT_RAG_ERR_CODES.EmptyMessageContent
|
|
296672
|
+
];
|
|
296673
|
+
return !nonRetryableCodes.includes(chatRagCode);
|
|
296674
|
+
}
|
|
296675
|
+
return isStreamNetworkError(error58.message);
|
|
296676
|
+
}
|
|
296677
|
+
return false;
|
|
296678
|
+
}
|
|
296624
296679
|
var CHAT_RAG_ERR_CODES;
|
|
296625
296680
|
var init_retry3 = __esm(() => {
|
|
296626
296681
|
init_sdk();
|
|
@@ -297083,7 +297138,7 @@ function getRateLimitResetDelayMs(error58) {
|
|
|
297083
297138
|
return null;
|
|
297084
297139
|
return Math.min(delayMs, PERSISTENT_RESET_CAP_MS);
|
|
297085
297140
|
}
|
|
297086
|
-
var abortError = () => new APIUserAbortError, DEFAULT_MAX_RETRIES2 = 10, API_ERROR_FALLBACK_MAX_RETRIES =
|
|
297141
|
+
var abortError = () => new APIUserAbortError, DEFAULT_MAX_RETRIES2 = 10, API_ERROR_FALLBACK_MAX_RETRIES = 10, FLOOR_OUTPUT_TOKENS = 3000, MAX_529_RETRIES = 3, BASE_DELAY_MS = 500, FOREGROUND_529_RETRY_SOURCES, PERSISTENT_MAX_BACKOFF_MS, PERSISTENT_RESET_CAP_MS, HEARTBEAT_INTERVAL_MS2 = 30000, CannotRetryError, FallbackTriggeredError, DEFAULT_FAST_MODE_FALLBACK_HOLD_MS, SHORT_RETRY_THRESHOLD_MS, MIN_COOLDOWN_MS;
|
|
297087
297142
|
var init_withRetry = __esm(() => {
|
|
297088
297143
|
init_sdk();
|
|
297089
297144
|
init_aws();
|
|
@@ -397124,7 +397179,7 @@ function getTelemetryAttributes() {
|
|
|
397124
397179
|
attributes["session.id"] = sessionId;
|
|
397125
397180
|
}
|
|
397126
397181
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
397127
|
-
attributes["app.version"] = "4.2.8
|
|
397182
|
+
attributes["app.version"] = "4.2.8";
|
|
397128
397183
|
}
|
|
397129
397184
|
const oauthAccount = getOauthAccountInfo();
|
|
397130
397185
|
if (oauthAccount) {
|
|
@@ -429579,7 +429634,7 @@ function initLangfuse() {
|
|
|
429579
429634
|
flushInterval: parseInt(process.env.LANGFUSE_FLUSH_INTERVAL ?? "10", 10),
|
|
429580
429635
|
mask: maskFn,
|
|
429581
429636
|
environment: process.env.LANGFUSE_TRACING_ENVIRONMENT ?? "development",
|
|
429582
|
-
release: "4.2.8
|
|
429637
|
+
release: "4.2.8",
|
|
429583
429638
|
exportMode: process.env.LANGFUSE_EXPORT_MODE ?? "batched",
|
|
429584
429639
|
timeout: parseInt(process.env.LANGFUSE_TIMEOUT ?? "5", 10)
|
|
429585
429640
|
});
|
|
@@ -467815,7 +467870,7 @@ function initSentry() {
|
|
|
467815
467870
|
}
|
|
467816
467871
|
init3({
|
|
467817
467872
|
dsn,
|
|
467818
|
-
release: typeof MACRO !== "undefined" ? "4.2.8
|
|
467873
|
+
release: typeof MACRO !== "undefined" ? "4.2.8" : undefined,
|
|
467819
467874
|
environment: typeof BUILD_ENV !== "undefined" ? BUILD_ENV : "production",
|
|
467820
467875
|
maxBreadcrumbs: 20,
|
|
467821
467876
|
sampleRate: 1,
|
|
@@ -495706,7 +495761,7 @@ async function initializeBetaTracing(resource) {
|
|
|
495706
495761
|
});
|
|
495707
495762
|
import_api_logs5.logs.setGlobalLoggerProvider(loggerProvider);
|
|
495708
495763
|
setLoggerProvider(loggerProvider);
|
|
495709
|
-
const eventLogger = import_api_logs5.logs.getLogger("com.anthropic.claude_code.events", "4.2.8
|
|
495764
|
+
const eventLogger = import_api_logs5.logs.getLogger("com.anthropic.claude_code.events", "4.2.8");
|
|
495710
495765
|
setEventLogger(eventLogger);
|
|
495711
495766
|
process.on("beforeExit", async () => {
|
|
495712
495767
|
await loggerProvider?.forceFlush();
|
|
@@ -495746,7 +495801,7 @@ async function initializeTelemetry() {
|
|
|
495746
495801
|
const platform5 = getPlatform();
|
|
495747
495802
|
const baseAttributes = {
|
|
495748
495803
|
[import_semantic_conventions14.ATTR_SERVICE_NAME]: "claude-code",
|
|
495749
|
-
[import_semantic_conventions14.ATTR_SERVICE_VERSION]: "4.2.8
|
|
495804
|
+
[import_semantic_conventions14.ATTR_SERVICE_VERSION]: "4.2.8"
|
|
495750
495805
|
};
|
|
495751
495806
|
if (platform5 === "wsl") {
|
|
495752
495807
|
const wslVersion = getWslVersion();
|
|
@@ -495791,7 +495846,7 @@ async function initializeTelemetry() {
|
|
|
495791
495846
|
} catch {}
|
|
495792
495847
|
};
|
|
495793
495848
|
registerCleanup(shutdownTelemetry2);
|
|
495794
|
-
return meterProvider2.getMeter("com.anthropic.claude_code", "4.2.8
|
|
495849
|
+
return meterProvider2.getMeter("com.anthropic.claude_code", "4.2.8");
|
|
495795
495850
|
}
|
|
495796
495851
|
const meterProvider = new import_sdk_metrics2.MeterProvider({
|
|
495797
495852
|
resource,
|
|
@@ -495811,7 +495866,7 @@ async function initializeTelemetry() {
|
|
|
495811
495866
|
});
|
|
495812
495867
|
import_api_logs5.logs.setGlobalLoggerProvider(loggerProvider);
|
|
495813
495868
|
setLoggerProvider(loggerProvider);
|
|
495814
|
-
const eventLogger = import_api_logs5.logs.getLogger("com.anthropic.claude_code.events", "4.2.8
|
|
495869
|
+
const eventLogger = import_api_logs5.logs.getLogger("com.anthropic.claude_code.events", "4.2.8");
|
|
495815
495870
|
setEventLogger(eventLogger);
|
|
495816
495871
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
495817
495872
|
process.on("beforeExit", async () => {
|
|
@@ -495873,7 +495928,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
495873
495928
|
}
|
|
495874
495929
|
};
|
|
495875
495930
|
registerCleanup(shutdownTelemetry);
|
|
495876
|
-
return meterProvider.getMeter("com.anthropic.claude_code", "4.2.8
|
|
495931
|
+
return meterProvider.getMeter("com.anthropic.claude_code", "4.2.8");
|
|
495877
495932
|
}
|
|
495878
495933
|
async function flushTelemetry() {
|
|
495879
495934
|
const meterProvider = getMeterProvider();
|
|
@@ -496932,7 +496987,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
496932
496987
|
logError3(new AutoUpdaterError("Another process is currently installing an update"));
|
|
496933
496988
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
496934
496989
|
pid: process.pid,
|
|
496935
|
-
currentVersion: "4.2.8
|
|
496990
|
+
currentVersion: "4.2.8"
|
|
496936
496991
|
});
|
|
496937
496992
|
return { status: "in_progress" };
|
|
496938
496993
|
}
|
|
@@ -496941,7 +496996,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
496941
496996
|
if (!env4.isRunningWithBun() && env4.isNpmFromWindowsPath()) {
|
|
496942
496997
|
logError3(new Error("Windows NPM detected in WSL environment"));
|
|
496943
496998
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
496944
|
-
currentVersion: "4.2.8
|
|
496999
|
+
currentVersion: "4.2.8"
|
|
496945
497000
|
});
|
|
496946
497001
|
return {
|
|
496947
497002
|
status: "install_failed",
|
|
@@ -497487,7 +497542,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
497487
497542
|
}
|
|
497488
497543
|
async function getDoctorDiagnostic() {
|
|
497489
497544
|
const installationType = await getCurrentInstallationType();
|
|
497490
|
-
const version7 = typeof MACRO !== "undefined" ? "4.2.8
|
|
497545
|
+
const version7 = typeof MACRO !== "undefined" ? "4.2.8" : "unknown";
|
|
497491
497546
|
const installationPath = await getInstallationPath();
|
|
497492
497547
|
const invokedBinary = getInvokedBinary();
|
|
497493
497548
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -535643,7 +535698,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
535643
535698
|
const client8 = new Client3({
|
|
535644
535699
|
name: "claude-code",
|
|
535645
535700
|
title: "CoStrict",
|
|
535646
|
-
version: "4.2.8
|
|
535701
|
+
version: "4.2.8",
|
|
535647
535702
|
description: "CoStrict agentic coding tool",
|
|
535648
535703
|
websiteUrl: PRODUCT_URL
|
|
535649
535704
|
}, {
|
|
@@ -536014,7 +536069,7 @@ var init_client17 = __esm(() => {
|
|
|
536014
536069
|
const client8 = new Client3({
|
|
536015
536070
|
name: "claude-code",
|
|
536016
536071
|
title: "CoStrict",
|
|
536017
|
-
version: "4.2.8
|
|
536072
|
+
version: "4.2.8",
|
|
536018
536073
|
description: "CoStrict agentic coding tool",
|
|
536019
536074
|
websiteUrl: PRODUCT_URL
|
|
536020
536075
|
}, {
|
|
@@ -537392,7 +537447,7 @@ function getInstallationEnv() {
|
|
|
537392
537447
|
return;
|
|
537393
537448
|
}
|
|
537394
537449
|
function getClaudeCodeVersion() {
|
|
537395
|
-
return "4.2.8
|
|
537450
|
+
return "4.2.8";
|
|
537396
537451
|
}
|
|
537397
537452
|
async function getInstalledVSCodeExtensionVersion(command4) {
|
|
537398
537453
|
const { stdout } = await execFileNoThrow2(command4, ["--list-extensions", "--show-versions"], {
|
|
@@ -538756,8 +538811,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
538756
538811
|
const maxVersion = await getMaxVersion();
|
|
538757
538812
|
if (maxVersion && gt(version8, maxVersion)) {
|
|
538758
538813
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version8} to ${maxVersion}`);
|
|
538759
|
-
if (gte2("4.2.8
|
|
538760
|
-
logForDebugging(`Native installer: current version ${"4.2.8
|
|
538814
|
+
if (gte2("4.2.8", maxVersion)) {
|
|
538815
|
+
logForDebugging(`Native installer: current version ${"4.2.8"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
538761
538816
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
538762
538817
|
latency_ms: Date.now() - startTime2,
|
|
538763
538818
|
max_version: maxVersion,
|
|
@@ -538768,7 +538823,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
538768
538823
|
version8 = maxVersion;
|
|
538769
538824
|
}
|
|
538770
538825
|
}
|
|
538771
|
-
if (!forceReinstall && version8 === "4.2.8
|
|
538826
|
+
if (!forceReinstall && version8 === "4.2.8" && await versionIsAvailable(version8) && await isPossibleClaudeBinary(executablePath)) {
|
|
538772
538827
|
logForDebugging(`Found ${version8} at ${executablePath}, skipping install`);
|
|
538773
538828
|
logEvent("tengu_native_update_complete", {
|
|
538774
538829
|
latency_ms: Date.now() - startTime2,
|
|
@@ -645682,6 +645737,7 @@ async function isParentAlive() {
|
|
|
645682
645737
|
return true;
|
|
645683
645738
|
}
|
|
645684
645739
|
function startBatchWorker() {
|
|
645740
|
+
process.title = "csc_batch_worker";
|
|
645685
645741
|
log12.info("batch worker started");
|
|
645686
645742
|
loadAllState().then(() => {
|
|
645687
645743
|
stateLoaded = true;
|
|
@@ -666291,10 +666347,11 @@ async function checkRuleBasedPermissions(tool, input4, context25) {
|
|
|
666291
666347
|
if (toolPermissionResult?.behavior === "deny") {
|
|
666292
666348
|
return toolPermissionResult;
|
|
666293
666349
|
}
|
|
666294
|
-
|
|
666350
|
+
const shouldBypassPermissions = appState.toolPermissionContext.mode === "bypassPermissions" || appState.toolPermissionContext.mode === "plan" && appState.toolPermissionContext.isBypassPermissionsModeAvailable;
|
|
666351
|
+
if (!appState.toolPermissionContext.forceMode && !shouldBypassPermissions && toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "rule" && toolPermissionResult.decisionReason.rule.ruleBehavior === "ask") {
|
|
666295
666352
|
return toolPermissionResult;
|
|
666296
666353
|
}
|
|
666297
|
-
if (!appState.toolPermissionContext.forceMode && toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "safetyCheck") {
|
|
666354
|
+
if (!appState.toolPermissionContext.forceMode && !shouldBypassPermissions && toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "safetyCheck") {
|
|
666298
666355
|
return toolPermissionResult;
|
|
666299
666356
|
}
|
|
666300
666357
|
return null;
|
|
@@ -666394,14 +666451,14 @@ async function hasPermissionsToUseToolInner(tool, input4, context25) {
|
|
|
666394
666451
|
}
|
|
666395
666452
|
return toolPermissionResult;
|
|
666396
666453
|
}
|
|
666397
|
-
|
|
666454
|
+
appState = context25.getAppState();
|
|
666455
|
+
const shouldBypassPermissions = appState.toolPermissionContext.mode === "bypassPermissions" || appState.toolPermissionContext.mode === "plan" && appState.toolPermissionContext.isBypassPermissionsModeAvailable;
|
|
666456
|
+
if (!appState.toolPermissionContext.forceMode && !shouldBypassPermissions && toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "rule" && toolPermissionResult.decisionReason.rule.ruleBehavior === "ask") {
|
|
666398
666457
|
return toolPermissionResult;
|
|
666399
666458
|
}
|
|
666400
|
-
if (!appState.toolPermissionContext.forceMode && toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "safetyCheck") {
|
|
666459
|
+
if (!appState.toolPermissionContext.forceMode && !shouldBypassPermissions && toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "safetyCheck") {
|
|
666401
666460
|
return toolPermissionResult;
|
|
666402
666461
|
}
|
|
666403
|
-
appState = context25.getAppState();
|
|
666404
|
-
const shouldBypassPermissions = appState.toolPermissionContext.mode === "bypassPermissions" || appState.toolPermissionContext.mode === "plan" && appState.toolPermissionContext.isBypassPermissionsModeAvailable;
|
|
666405
666462
|
if (shouldBypassPermissions && !tool.requiresUserInteraction?.()) {
|
|
666406
666463
|
return {
|
|
666407
666464
|
behavior: "allow",
|
|
@@ -673038,7 +673095,7 @@ function Feedback({
|
|
|
673038
673095
|
platform: env4.platform,
|
|
673039
673096
|
gitRepo: envInfo.isGit,
|
|
673040
673097
|
terminal: env4.terminal,
|
|
673041
|
-
version: "4.2.8
|
|
673098
|
+
version: "4.2.8",
|
|
673042
673099
|
transcript: normalizeMessagesForAPI(messages),
|
|
673043
673100
|
errors: sanitizedErrors,
|
|
673044
673101
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -673221,7 +673278,7 @@ function Feedback({
|
|
|
673221
673278
|
", ",
|
|
673222
673279
|
env4.terminal,
|
|
673223
673280
|
", v",
|
|
673224
|
-
"4.2.8
|
|
673281
|
+
"4.2.8"
|
|
673225
673282
|
]
|
|
673226
673283
|
})
|
|
673227
673284
|
]
|
|
@@ -673318,7 +673375,7 @@ ${sanitizedDescription}
|
|
|
673318
673375
|
` + `**Environment Info**
|
|
673319
673376
|
` + `- Platform: ${env4.platform}
|
|
673320
673377
|
` + `- Terminal: ${env4.terminal}
|
|
673321
|
-
` + `- Version: ${"4.2.8
|
|
673378
|
+
` + `- Version: ${"4.2.8"}
|
|
673322
673379
|
` + `- Feedback ID: ${feedbackId}
|
|
673323
673380
|
` + `
|
|
673324
673381
|
**Errors**
|
|
@@ -675554,7 +675611,7 @@ function buildPrimarySection() {
|
|
|
675554
675611
|
children: t("settings.status.renameHint")
|
|
675555
675612
|
});
|
|
675556
675613
|
return [
|
|
675557
|
-
{ label: t("settings.status.version"), value: "4.2.8
|
|
675614
|
+
{ label: t("settings.status.version"), value: "4.2.8" },
|
|
675558
675615
|
{ label: t("settings.status.sessionName"), value: nameValue },
|
|
675559
675616
|
{ label: t("settings.status.sessionId"), value: sessionId },
|
|
675560
675617
|
{ label: t("settings.status.cwd"), value: getCwd() },
|
|
@@ -678376,7 +678433,7 @@ function Config({
|
|
|
678376
678433
|
}
|
|
678377
678434
|
})
|
|
678378
678435
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime190.jsx(ChannelDowngradeDialog, {
|
|
678379
|
-
currentVersion: "4.2.8
|
|
678436
|
+
currentVersion: "4.2.8",
|
|
678380
678437
|
onChoice: (choice) => {
|
|
678381
678438
|
setShowSubmenu(null);
|
|
678382
678439
|
setTabsHidden(false);
|
|
@@ -678388,7 +678445,7 @@ function Config({
|
|
|
678388
678445
|
autoUpdatesChannel: "stable"
|
|
678389
678446
|
};
|
|
678390
678447
|
if (choice === "stay") {
|
|
678391
|
-
newSettings.minimumVersion = "4.2.8
|
|
678448
|
+
newSettings.minimumVersion = "4.2.8";
|
|
678392
678449
|
}
|
|
678393
678450
|
updateSettingsForSource("userSettings", newSettings);
|
|
678394
678451
|
setSettingsData((prev) => ({
|
|
@@ -683857,7 +683914,7 @@ function HelpV2({ onClose, commands: commands7 }) {
|
|
|
683857
683914
|
color: "professionalBlue",
|
|
683858
683915
|
children: [
|
|
683859
683916
|
/* @__PURE__ */ jsx_runtime217.jsx(Tabs, {
|
|
683860
|
-
title: process.env.USER_TYPE === "sf" ? "/help" : `CoStrict v${"4.2.8
|
|
683917
|
+
title: process.env.USER_TYPE === "sf" ? "/help" : `CoStrict v${"4.2.8"}`,
|
|
683861
683918
|
color: "professionalBlue",
|
|
683862
683919
|
defaultTab: "general",
|
|
683863
683920
|
children: tabs
|
|
@@ -774455,7 +774512,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
774455
774512
|
return [];
|
|
774456
774513
|
}
|
|
774457
774514
|
}
|
|
774458
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "4.2.8
|
|
774515
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "4.2.8") {
|
|
774459
774516
|
if (process.env.USER_TYPE === "sf") {
|
|
774460
774517
|
const changelog = "";
|
|
774461
774518
|
if (changelog) {
|
|
@@ -774482,7 +774539,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "4.2.8-bet
|
|
|
774482
774539
|
releaseNotes
|
|
774483
774540
|
};
|
|
774484
774541
|
}
|
|
774485
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "4.2.8
|
|
774542
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "4.2.8") {
|
|
774486
774543
|
if (process.env.USER_TYPE === "sf") {
|
|
774487
774544
|
const changelog = "";
|
|
774488
774545
|
if (changelog) {
|
|
@@ -777243,7 +777300,7 @@ function isNotLoggedIn() {
|
|
|
777243
777300
|
return true;
|
|
777244
777301
|
}
|
|
777245
777302
|
function getLogoDisplayData() {
|
|
777246
|
-
const version8 = process.env.DEMO_VERSION ?? "4.2.8
|
|
777303
|
+
const version8 = process.env.DEMO_VERSION ?? "4.2.8";
|
|
777247
777304
|
const serverUrl = getDirectConnectServerUrl();
|
|
777248
777305
|
const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
|
|
777249
777306
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -777821,7 +777878,7 @@ var init_MatrixMessageLine = __esm(() => {
|
|
|
777821
777878
|
// src/components/matrix-tactical/MatrixWelcome.tsx
|
|
777822
777879
|
import { basename as basename47 } from "path";
|
|
777823
777880
|
function MatrixWelcome({
|
|
777824
|
-
version: version8 = "4.2.8
|
|
777881
|
+
version: version8 = "4.2.8",
|
|
777825
777882
|
projectName,
|
|
777826
777883
|
cwd: cwd2,
|
|
777827
777884
|
modelDisplayName,
|
|
@@ -778456,13 +778513,13 @@ function LogoV2() {
|
|
|
778456
778513
|
const { hasReleaseNotes } = checkForReleaseNotesSync(config11.lastReleaseNotesSeen);
|
|
778457
778514
|
import_react167.useEffect(() => {
|
|
778458
778515
|
const currentConfig = getGlobalConfig();
|
|
778459
|
-
if (currentConfig.lastReleaseNotesSeen === "4.2.8
|
|
778516
|
+
if (currentConfig.lastReleaseNotesSeen === "4.2.8") {
|
|
778460
778517
|
return;
|
|
778461
778518
|
}
|
|
778462
778519
|
saveGlobalConfig((current2) => {
|
|
778463
|
-
if (current2.lastReleaseNotesSeen === "4.2.8
|
|
778520
|
+
if (current2.lastReleaseNotesSeen === "4.2.8")
|
|
778464
778521
|
return current2;
|
|
778465
|
-
return { ...current2, lastReleaseNotesSeen: "4.2.8
|
|
778522
|
+
return { ...current2, lastReleaseNotesSeen: "4.2.8" };
|
|
778466
778523
|
});
|
|
778467
778524
|
if (showOnboarding) {
|
|
778468
778525
|
incrementProjectOnboardingSeenCount();
|
|
@@ -800400,7 +800457,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
800400
800457
|
smapsRollup,
|
|
800401
800458
|
platform: process.platform,
|
|
800402
800459
|
nodeVersion: process.version,
|
|
800403
|
-
ccVersion: "4.2.8
|
|
800460
|
+
ccVersion: "4.2.8"
|
|
800404
800461
|
};
|
|
800405
800462
|
}
|
|
800406
800463
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -800516,7 +800573,7 @@ var init_mock_limits = __esm(() => {
|
|
|
800516
800573
|
var call54 = async () => {
|
|
800517
800574
|
return {
|
|
800518
800575
|
type: "text",
|
|
800519
|
-
value: `${"4.2.8
|
|
800576
|
+
value: `${"4.2.8"} (built ${"2026-07-01T09:41:30.503Z"})`
|
|
800520
800577
|
};
|
|
800521
800578
|
}, version8, version_default;
|
|
800522
800579
|
var init_version2 = __esm(() => {
|
|
@@ -806934,8 +806991,8 @@ var init_tag2 = __esm(() => {
|
|
|
806934
806991
|
import { createRequire as createRequire4 } from "module";
|
|
806935
806992
|
function getVersion2() {
|
|
806936
806993
|
try {
|
|
806937
|
-
if (typeof MACRO !== "undefined" && "4.2.8
|
|
806938
|
-
return "4.2.8
|
|
806994
|
+
if (typeof MACRO !== "undefined" && "4.2.8")
|
|
806995
|
+
return "4.2.8";
|
|
806939
806996
|
} catch {}
|
|
806940
806997
|
try {
|
|
806941
806998
|
const require3 = createRequire4(import.meta.url);
|
|
@@ -806945,6 +807002,32 @@ function getVersion2() {
|
|
|
806945
807002
|
return "1.0.0";
|
|
806946
807003
|
}
|
|
806947
807004
|
}
|
|
807005
|
+
function isRecord5(value) {
|
|
807006
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
807007
|
+
}
|
|
807008
|
+
async function normalizeGatewayErrorResponse(response3) {
|
|
807009
|
+
if (response3.status >= 400) {
|
|
807010
|
+
return response3;
|
|
807011
|
+
}
|
|
807012
|
+
const contentType = response3.headers.get("content-type") ?? "";
|
|
807013
|
+
if (contentType.includes("text/event-stream")) {
|
|
807014
|
+
return response3;
|
|
807015
|
+
}
|
|
807016
|
+
let body;
|
|
807017
|
+
try {
|
|
807018
|
+
body = await response3.clone().json();
|
|
807019
|
+
} catch {
|
|
807020
|
+
return response3;
|
|
807021
|
+
}
|
|
807022
|
+
if (isRecord5(body) && Array.isArray(body.error) && body.error.length > 0 && isRecord5(body.error[0]) && typeof body.error[0].ApiError === "string") {
|
|
807023
|
+
return new Response(response3.body, {
|
|
807024
|
+
status: 503,
|
|
807025
|
+
statusText: "CoStrict Gateway Error",
|
|
807026
|
+
headers: response3.headers
|
|
807027
|
+
});
|
|
807028
|
+
}
|
|
807029
|
+
return response3;
|
|
807030
|
+
}
|
|
806948
807031
|
function toKebabCase(s) {
|
|
806949
807032
|
if (!s)
|
|
806950
807033
|
return;
|
|
@@ -806986,7 +807069,8 @@ function createCoStrictFetch(options) {
|
|
|
806986
807069
|
headers.set("agent-type", agentType);
|
|
806987
807070
|
headers.set("zgsm-client-id", creds.machine_id);
|
|
806988
807071
|
headers.set("zgsm-client-ide", "cli");
|
|
806989
|
-
const
|
|
807072
|
+
const rawResponse = await fetch(input4, { ...init4, headers });
|
|
807073
|
+
const response3 = await normalizeGatewayErrorResponse(rawResponse);
|
|
806990
807074
|
if (response3.status === 401 && creds.refresh_token) {
|
|
806991
807075
|
try {
|
|
806992
807076
|
const refreshed2 = await refreshCoStrictToken({
|
|
@@ -817245,7 +817329,7 @@ function generateHtmlReport(data, insights) {
|
|
|
817245
817329
|
</html>`;
|
|
817246
817330
|
}
|
|
817247
817331
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
817248
|
-
const version9 = typeof MACRO !== "undefined" ? "4.2.8
|
|
817332
|
+
const version9 = typeof MACRO !== "undefined" ? "4.2.8" : "unknown";
|
|
817249
817333
|
const remote_hosts_collected = remoteStats?.hosts.filter((h5) => h5.sessionCount > 0).map((h5) => h5.name);
|
|
817250
817334
|
const facets_summary = {
|
|
817251
817335
|
total: facets.size,
|
|
@@ -821559,7 +821643,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
821559
821643
|
init_settings2();
|
|
821560
821644
|
init_slowOperations();
|
|
821561
821645
|
init_uuid();
|
|
821562
|
-
VERSION10 = typeof MACRO !== "undefined" ? "4.2.8
|
|
821646
|
+
VERSION10 = typeof MACRO !== "undefined" ? "4.2.8" : "unknown";
|
|
821563
821647
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
821564
821648
|
SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
821565
821649
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -822900,7 +822984,7 @@ var init_filesystem = __esm(() => {
|
|
|
822900
822984
|
});
|
|
822901
822985
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
822902
822986
|
const nonce = randomBytes24(16).toString("hex");
|
|
822903
|
-
return join195(getCostrictTempDir(), "bundled-skills", "4.2.8
|
|
822987
|
+
return join195(getCostrictTempDir(), "bundled-skills", "4.2.8", nonce);
|
|
822904
822988
|
});
|
|
822905
822989
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
822906
822990
|
});
|
|
@@ -829098,7 +829182,7 @@ function computeFingerprint(messageText, version9) {
|
|
|
829098
829182
|
}
|
|
829099
829183
|
function computeFingerprintFromMessages(messages) {
|
|
829100
829184
|
const firstMessageText = extractFirstMessageText(messages);
|
|
829101
|
-
return computeFingerprint(firstMessageText, "4.2.8
|
|
829185
|
+
return computeFingerprint(firstMessageText, "4.2.8");
|
|
829102
829186
|
}
|
|
829103
829187
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
829104
829188
|
var init_fingerprint = () => {};
|
|
@@ -829240,20 +829324,20 @@ function isLangfuseRole(value) {
|
|
|
829240
829324
|
return false;
|
|
829241
829325
|
}
|
|
829242
829326
|
}
|
|
829243
|
-
function
|
|
829327
|
+
function isRecord6(value) {
|
|
829244
829328
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
829245
829329
|
}
|
|
829246
829330
|
function isLangfuseToolCall(value) {
|
|
829247
|
-
if (!
|
|
829331
|
+
if (!isRecord6(value))
|
|
829248
829332
|
return false;
|
|
829249
829333
|
const fn = value.function;
|
|
829250
|
-
return typeof value.id === "string" && value.type === "function" &&
|
|
829334
|
+
return typeof value.id === "string" && value.type === "function" && isRecord6(fn) && typeof fn.name === "string" && typeof fn.arguments === "string";
|
|
829251
829335
|
}
|
|
829252
829336
|
function getToolCalls(value) {
|
|
829253
829337
|
return Array.isArray(value) ? value.filter(isLangfuseToolCall) : [];
|
|
829254
829338
|
}
|
|
829255
829339
|
function getContentToolCalls(content) {
|
|
829256
|
-
return content.flatMap((block) =>
|
|
829340
|
+
return content.flatMap((block) => isRecord6(block) ? getToolCalls(block.tool_calls) : []);
|
|
829257
829341
|
}
|
|
829258
829342
|
function mergeToolCalls(...groups) {
|
|
829259
829343
|
const merged = new Map;
|
|
@@ -829376,10 +829460,10 @@ function convertMessagesToLangfuse(messages, systemPrompt2) {
|
|
|
829376
829460
|
}
|
|
829377
829461
|
}
|
|
829378
829462
|
for (const msg of messages) {
|
|
829379
|
-
if (!
|
|
829463
|
+
if (!isRecord6(msg))
|
|
829380
829464
|
continue;
|
|
829381
829465
|
const wrappedMessage = msg.message;
|
|
829382
|
-
const isWrappedMessage =
|
|
829466
|
+
const isWrappedMessage = isRecord6(wrappedMessage);
|
|
829383
829467
|
const inner = isWrappedMessage ? wrappedMessage : msg;
|
|
829384
829468
|
const role = isLangfuseRole(inner.role) ? inner.role : isWrappedMessage ? toRoleFromWrappedMessage(msg) : "user";
|
|
829385
829469
|
const rawContent2 = inner.content;
|
|
@@ -829508,7 +829592,7 @@ function getAnthropicEnvMetadata() {
|
|
|
829508
829592
|
function getBuildAgeMinutes() {
|
|
829509
829593
|
if (false)
|
|
829510
829594
|
;
|
|
829511
|
-
const buildTime = new Date("2026-
|
|
829595
|
+
const buildTime = new Date("2026-07-01T09:41:30.503Z").getTime();
|
|
829512
829596
|
if (isNaN(buildTime))
|
|
829513
829597
|
return;
|
|
829514
829598
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -830065,6 +830149,168 @@ var init_client18 = __esm(() => {
|
|
|
830065
830149
|
init_state();
|
|
830066
830150
|
});
|
|
830067
830151
|
|
|
830152
|
+
// src/services/api/openai/nonStreamingFallback.ts
|
|
830153
|
+
import { randomUUID as randomUUID50 } from "crypto";
|
|
830154
|
+
function mapFinishReason2(reason) {
|
|
830155
|
+
switch (reason) {
|
|
830156
|
+
case "stop":
|
|
830157
|
+
return "end_turn";
|
|
830158
|
+
case "tool_calls":
|
|
830159
|
+
return "tool_use";
|
|
830160
|
+
case "length":
|
|
830161
|
+
return "max_tokens";
|
|
830162
|
+
case "content_filter":
|
|
830163
|
+
return "end_turn";
|
|
830164
|
+
default:
|
|
830165
|
+
return "end_turn";
|
|
830166
|
+
}
|
|
830167
|
+
}
|
|
830168
|
+
function extractReasoning2(message2) {
|
|
830169
|
+
const anyMessage = message2;
|
|
830170
|
+
if (typeof anyMessage.reasoning_content === "string") {
|
|
830171
|
+
return anyMessage.reasoning_content;
|
|
830172
|
+
}
|
|
830173
|
+
if (typeof anyMessage.reasoning === "string") {
|
|
830174
|
+
return anyMessage.reasoning;
|
|
830175
|
+
}
|
|
830176
|
+
if (Array.isArray(anyMessage.reasoning_details) && anyMessage.reasoning_details.length > 0) {
|
|
830177
|
+
return anyMessage.reasoning_details.filter((d4) => d4 != null && typeof d4.text === "string").map((d4) => d4.text).join("");
|
|
830178
|
+
}
|
|
830179
|
+
return;
|
|
830180
|
+
}
|
|
830181
|
+
async function* adaptOpenAICompletionToAnthropicStream(completion) {
|
|
830182
|
+
const choice = completion.choices?.[0];
|
|
830183
|
+
if (!choice)
|
|
830184
|
+
return;
|
|
830185
|
+
const message2 = choice.message;
|
|
830186
|
+
const messageId = completion.id || `msg_${randomUUID50().replace(/-/g, "").slice(0, 24)}`;
|
|
830187
|
+
const usage2 = completion.usage;
|
|
830188
|
+
yield {
|
|
830189
|
+
type: "message_start",
|
|
830190
|
+
message: {
|
|
830191
|
+
id: messageId,
|
|
830192
|
+
type: "message",
|
|
830193
|
+
role: "assistant",
|
|
830194
|
+
content: [],
|
|
830195
|
+
model: completion.model,
|
|
830196
|
+
stop_reason: null,
|
|
830197
|
+
stop_sequence: null,
|
|
830198
|
+
usage: {
|
|
830199
|
+
input_tokens: usage2?.prompt_tokens ?? 0,
|
|
830200
|
+
output_tokens: 0,
|
|
830201
|
+
cache_creation_input_tokens: 0,
|
|
830202
|
+
cache_read_input_tokens: usage2?.prompt_tokens_details?.cached_tokens ?? 0
|
|
830203
|
+
}
|
|
830204
|
+
}
|
|
830205
|
+
};
|
|
830206
|
+
let currentIndex = -1;
|
|
830207
|
+
const reasoning = extractReasoning2(message2);
|
|
830208
|
+
if (reasoning != null && reasoning !== "") {
|
|
830209
|
+
currentIndex++;
|
|
830210
|
+
yield {
|
|
830211
|
+
type: "content_block_start",
|
|
830212
|
+
index: currentIndex,
|
|
830213
|
+
content_block: {
|
|
830214
|
+
type: "thinking",
|
|
830215
|
+
thinking: "",
|
|
830216
|
+
signature: ""
|
|
830217
|
+
}
|
|
830218
|
+
};
|
|
830219
|
+
yield {
|
|
830220
|
+
type: "content_block_delta",
|
|
830221
|
+
index: currentIndex,
|
|
830222
|
+
delta: {
|
|
830223
|
+
type: "thinking_delta",
|
|
830224
|
+
thinking: reasoning
|
|
830225
|
+
}
|
|
830226
|
+
};
|
|
830227
|
+
yield {
|
|
830228
|
+
type: "content_block_stop",
|
|
830229
|
+
index: currentIndex
|
|
830230
|
+
};
|
|
830231
|
+
}
|
|
830232
|
+
if (typeof message2.content === "string" && message2.content) {
|
|
830233
|
+
currentIndex++;
|
|
830234
|
+
yield {
|
|
830235
|
+
type: "content_block_start",
|
|
830236
|
+
index: currentIndex,
|
|
830237
|
+
content_block: {
|
|
830238
|
+
type: "text",
|
|
830239
|
+
text: ""
|
|
830240
|
+
}
|
|
830241
|
+
};
|
|
830242
|
+
yield {
|
|
830243
|
+
type: "content_block_delta",
|
|
830244
|
+
index: currentIndex,
|
|
830245
|
+
delta: {
|
|
830246
|
+
type: "text_delta",
|
|
830247
|
+
text: message2.content
|
|
830248
|
+
}
|
|
830249
|
+
};
|
|
830250
|
+
yield {
|
|
830251
|
+
type: "content_block_stop",
|
|
830252
|
+
index: currentIndex
|
|
830253
|
+
};
|
|
830254
|
+
}
|
|
830255
|
+
if (message2.tool_calls) {
|
|
830256
|
+
for (const toolCall of message2.tool_calls) {
|
|
830257
|
+
const toolCallFn = toolCall;
|
|
830258
|
+
currentIndex++;
|
|
830259
|
+
yield {
|
|
830260
|
+
type: "content_block_start",
|
|
830261
|
+
index: currentIndex,
|
|
830262
|
+
content_block: {
|
|
830263
|
+
type: "tool_use",
|
|
830264
|
+
id: toolCallFn.id || `toolu_${randomUUID50().replace(/-/g, "").slice(0, 24)}`,
|
|
830265
|
+
name: toolCallFn.function?.name || "",
|
|
830266
|
+
input: {}
|
|
830267
|
+
}
|
|
830268
|
+
};
|
|
830269
|
+
const args = toolCallFn.function?.arguments;
|
|
830270
|
+
if (args) {
|
|
830271
|
+
yield {
|
|
830272
|
+
type: "content_block_delta",
|
|
830273
|
+
index: currentIndex,
|
|
830274
|
+
delta: {
|
|
830275
|
+
type: "input_json_delta",
|
|
830276
|
+
partial_json: args
|
|
830277
|
+
}
|
|
830278
|
+
};
|
|
830279
|
+
}
|
|
830280
|
+
yield {
|
|
830281
|
+
type: "content_block_stop",
|
|
830282
|
+
index: currentIndex
|
|
830283
|
+
};
|
|
830284
|
+
}
|
|
830285
|
+
}
|
|
830286
|
+
const stopReason = mapFinishReason2(choice.finish_reason);
|
|
830287
|
+
yield {
|
|
830288
|
+
type: "message_delta",
|
|
830289
|
+
delta: {
|
|
830290
|
+
stop_reason: stopReason,
|
|
830291
|
+
stop_sequence: null
|
|
830292
|
+
},
|
|
830293
|
+
usage: {
|
|
830294
|
+
input_tokens: usage2?.prompt_tokens ?? 0,
|
|
830295
|
+
output_tokens: usage2?.completion_tokens ?? 0,
|
|
830296
|
+
cache_read_input_tokens: usage2?.prompt_tokens_details?.cached_tokens ?? 0,
|
|
830297
|
+
cache_creation_input_tokens: 0
|
|
830298
|
+
}
|
|
830299
|
+
};
|
|
830300
|
+
yield {
|
|
830301
|
+
type: "message_stop"
|
|
830302
|
+
};
|
|
830303
|
+
}
|
|
830304
|
+
function toNonStreamingOpenAIRequestBody(requestBody) {
|
|
830305
|
+
const {
|
|
830306
|
+
stream: _stream,
|
|
830307
|
+
stream_options: _streamOptions,
|
|
830308
|
+
...rest
|
|
830309
|
+
} = requestBody;
|
|
830310
|
+
return rest;
|
|
830311
|
+
}
|
|
830312
|
+
var init_nonStreamingFallback = () => {};
|
|
830313
|
+
|
|
830068
830314
|
// src/services/api/openai/chatgptAuth.ts
|
|
830069
830315
|
import { chmod as chmod12, mkdir as mkdir63, readFile as readFile74, unlink as unlink30, writeFile as writeFile68 } from "fs/promises";
|
|
830070
830316
|
import { homedir as homedir47 } from "os";
|
|
@@ -830237,7 +830483,7 @@ var init_chatgptAuth = __esm(() => {
|
|
|
830237
830483
|
});
|
|
830238
830484
|
|
|
830239
830485
|
// src/services/api/openai/responsesAdapter.ts
|
|
830240
|
-
import { randomUUID as
|
|
830486
|
+
import { randomUUID as randomUUID51 } from "crypto";
|
|
830241
830487
|
function textFromContent2(content) {
|
|
830242
830488
|
if (typeof content === "string")
|
|
830243
830489
|
return content;
|
|
@@ -830435,7 +830681,7 @@ function mapStopReason(response3) {
|
|
|
830435
830681
|
return "end_turn";
|
|
830436
830682
|
}
|
|
830437
830683
|
async function* adaptResponsesStreamToAnthropic(stream6, model) {
|
|
830438
|
-
const messageId = `msg_${
|
|
830684
|
+
const messageId = `msg_${randomUUID51().replace(/-/gu, "").slice(0, 24)}`;
|
|
830439
830685
|
const toolBlocks = new Map;
|
|
830440
830686
|
let started = false;
|
|
830441
830687
|
let currentContentIndex = -1;
|
|
@@ -830708,7 +830954,7 @@ __export(exports_openai, {
|
|
|
830708
830954
|
isOpenAIThinkingEnabled: () => isOpenAIThinkingEnabled,
|
|
830709
830955
|
buildOpenAIRequestBody: () => buildOpenAIRequestBody
|
|
830710
830956
|
});
|
|
830711
|
-
import { randomUUID as
|
|
830957
|
+
import { randomUUID as randomUUID52 } from "crypto";
|
|
830712
830958
|
function convertToResponsesReasoningEffort(effortValue) {
|
|
830713
830959
|
if (effortValue === "low")
|
|
830714
830960
|
return "low";
|
|
@@ -830772,7 +831018,7 @@ function assembleFinalAssistantOutputs(params) {
|
|
|
830772
831018
|
},
|
|
830773
831019
|
requestId: undefined,
|
|
830774
831020
|
type: "assistant",
|
|
830775
|
-
uuid:
|
|
831021
|
+
uuid: randomUUID52(),
|
|
830776
831022
|
timestamp: new Date().toISOString()
|
|
830777
831023
|
});
|
|
830778
831024
|
} catch (error99) {
|
|
@@ -830792,6 +831038,198 @@ function assembleFinalAssistantOutputs(params) {
|
|
|
830792
831038
|
}
|
|
830793
831039
|
return outputs2;
|
|
830794
831040
|
}
|
|
831041
|
+
async function* getOpenAIStream(requestBody, options, signal) {
|
|
831042
|
+
const retryGenerator = withRetry(() => Promise.resolve(getOpenAIClient({
|
|
831043
|
+
maxRetries: 0,
|
|
831044
|
+
fetchOverride: options.fetchOverride,
|
|
831045
|
+
source: options.querySource,
|
|
831046
|
+
agentId: options.agentId,
|
|
831047
|
+
parentAgentId: options.parentAgentId
|
|
831048
|
+
})), async (client8, _attempt, _context2) => {
|
|
831049
|
+
try {
|
|
831050
|
+
return await client8.chat.completions.create(requestBody, { signal });
|
|
831051
|
+
} catch (err2) {
|
|
831052
|
+
throw wrapOpenAIErrorForRetry(err2);
|
|
831053
|
+
}
|
|
831054
|
+
}, {
|
|
831055
|
+
model: options.model,
|
|
831056
|
+
thinkingConfig: { type: "disabled" },
|
|
831057
|
+
signal,
|
|
831058
|
+
querySource: options.querySource
|
|
831059
|
+
});
|
|
831060
|
+
let e4 = await retryGenerator.next();
|
|
831061
|
+
while (!e4.done) {
|
|
831062
|
+
yield e4.value;
|
|
831063
|
+
e4 = await retryGenerator.next();
|
|
831064
|
+
}
|
|
831065
|
+
return e4.value;
|
|
831066
|
+
}
|
|
831067
|
+
async function* executeOpenAINonStreamingRequest(requestBody, options, signal) {
|
|
831068
|
+
const retryGenerator = withRetry(() => Promise.resolve(getOpenAIClient({
|
|
831069
|
+
maxRetries: 0,
|
|
831070
|
+
fetchOverride: options.fetchOverride,
|
|
831071
|
+
source: options.querySource,
|
|
831072
|
+
agentId: options.agentId,
|
|
831073
|
+
parentAgentId: options.parentAgentId
|
|
831074
|
+
})), async (client8, _attempt, _context2) => {
|
|
831075
|
+
try {
|
|
831076
|
+
return await client8.chat.completions.create(requestBody, { signal });
|
|
831077
|
+
} catch (err2) {
|
|
831078
|
+
throw wrapOpenAIErrorForRetry(err2);
|
|
831079
|
+
}
|
|
831080
|
+
}, {
|
|
831081
|
+
model: options.model,
|
|
831082
|
+
thinkingConfig: { type: "disabled" },
|
|
831083
|
+
signal,
|
|
831084
|
+
querySource: options.querySource
|
|
831085
|
+
});
|
|
831086
|
+
let e4 = await retryGenerator.next();
|
|
831087
|
+
while (!e4.done) {
|
|
831088
|
+
yield e4.value;
|
|
831089
|
+
e4 = await retryGenerator.next();
|
|
831090
|
+
}
|
|
831091
|
+
return e4.value;
|
|
831092
|
+
}
|
|
831093
|
+
async function* consumeOpenAIStream(adaptedStream, openaiModel, tools, options, maxTokens, openaiMessages, toolSchemas, enableThinking) {
|
|
831094
|
+
const contentBlocks = {};
|
|
831095
|
+
const collectedMessages = [];
|
|
831096
|
+
let partialMessage;
|
|
831097
|
+
let stopReason = null;
|
|
831098
|
+
let usage2 = {
|
|
831099
|
+
input_tokens: 0,
|
|
831100
|
+
output_tokens: 0,
|
|
831101
|
+
cache_creation_input_tokens: 0,
|
|
831102
|
+
cache_read_input_tokens: 0
|
|
831103
|
+
};
|
|
831104
|
+
let ttftMs = 0;
|
|
831105
|
+
const start = Date.now();
|
|
831106
|
+
try {
|
|
831107
|
+
for await (const event of adaptedStream) {
|
|
831108
|
+
switch (event.type) {
|
|
831109
|
+
case "message_start": {
|
|
831110
|
+
partialMessage = event.message;
|
|
831111
|
+
ttftMs = Date.now() - start;
|
|
831112
|
+
if (event.message?.usage) {
|
|
831113
|
+
usage2 = {
|
|
831114
|
+
...usage2,
|
|
831115
|
+
...event.message.usage
|
|
831116
|
+
};
|
|
831117
|
+
}
|
|
831118
|
+
break;
|
|
831119
|
+
}
|
|
831120
|
+
case "content_block_start": {
|
|
831121
|
+
const idx = event.index;
|
|
831122
|
+
const cb = event.content_block;
|
|
831123
|
+
if (cb.type === "tool_use") {
|
|
831124
|
+
contentBlocks[idx] = { ...cb, input: "" };
|
|
831125
|
+
} else if (cb.type === "text") {
|
|
831126
|
+
contentBlocks[idx] = { ...cb, text: "" };
|
|
831127
|
+
} else if (cb.type === "thinking") {
|
|
831128
|
+
contentBlocks[idx] = { ...cb, thinking: "", signature: "" };
|
|
831129
|
+
} else {
|
|
831130
|
+
contentBlocks[idx] = { ...cb };
|
|
831131
|
+
}
|
|
831132
|
+
break;
|
|
831133
|
+
}
|
|
831134
|
+
case "content_block_delta": {
|
|
831135
|
+
const idx = event.index;
|
|
831136
|
+
const delta = event.delta;
|
|
831137
|
+
const block = contentBlocks[idx];
|
|
831138
|
+
if (!block)
|
|
831139
|
+
break;
|
|
831140
|
+
if (delta.type === "text_delta") {
|
|
831141
|
+
block.text = (block.text || "") + delta.text;
|
|
831142
|
+
} else if (delta.type === "input_json_delta") {
|
|
831143
|
+
block.input = (block.input || "") + delta.partial_json;
|
|
831144
|
+
} else if (delta.type === "thinking_delta") {
|
|
831145
|
+
block.thinking = (block.thinking || "") + delta.thinking;
|
|
831146
|
+
} else if (delta.type === "signature_delta") {
|
|
831147
|
+
block.signature = delta.signature;
|
|
831148
|
+
}
|
|
831149
|
+
break;
|
|
831150
|
+
}
|
|
831151
|
+
case "content_block_stop": {
|
|
831152
|
+
break;
|
|
831153
|
+
}
|
|
831154
|
+
case "message_delta": {
|
|
831155
|
+
const deltaUsage = event.usage;
|
|
831156
|
+
if (deltaUsage) {
|
|
831157
|
+
usage2 = { ...usage2, ...deltaUsage };
|
|
831158
|
+
}
|
|
831159
|
+
if (event.delta?.stop_reason != null) {
|
|
831160
|
+
stopReason = event.delta.stop_reason;
|
|
831161
|
+
}
|
|
831162
|
+
break;
|
|
831163
|
+
}
|
|
831164
|
+
case "message_stop": {
|
|
831165
|
+
if (partialMessage) {
|
|
831166
|
+
for (const output of assembleFinalAssistantOutputs({
|
|
831167
|
+
partialMessage,
|
|
831168
|
+
contentBlocks,
|
|
831169
|
+
tools,
|
|
831170
|
+
agentId: options.agentId,
|
|
831171
|
+
usage: usage2,
|
|
831172
|
+
stopReason,
|
|
831173
|
+
maxTokens
|
|
831174
|
+
})) {
|
|
831175
|
+
if (output.type === "assistant") {
|
|
831176
|
+
collectedMessages.push(output);
|
|
831177
|
+
}
|
|
831178
|
+
yield output;
|
|
831179
|
+
}
|
|
831180
|
+
partialMessage = null;
|
|
831181
|
+
}
|
|
831182
|
+
if (usage2.input_tokens + usage2.output_tokens > 0) {
|
|
831183
|
+
const costUSD = calculateUSDCost(openaiModel, usage2);
|
|
831184
|
+
addToTotalSessionCost(costUSD, usage2, options.model);
|
|
831185
|
+
}
|
|
831186
|
+
break;
|
|
831187
|
+
}
|
|
831188
|
+
}
|
|
831189
|
+
yield {
|
|
831190
|
+
type: "stream_event",
|
|
831191
|
+
event,
|
|
831192
|
+
...event.type === "message_start" ? { ttftMs } : undefined
|
|
831193
|
+
};
|
|
831194
|
+
}
|
|
831195
|
+
recordLLMObservation(options.langfuseTrace ?? null, {
|
|
831196
|
+
model: openaiModel,
|
|
831197
|
+
provider: "openai",
|
|
831198
|
+
input: convertMessagesToLangfuse(openaiMessages),
|
|
831199
|
+
output: convertOutputToLangfuse(collectedMessages),
|
|
831200
|
+
usage: {
|
|
831201
|
+
input_tokens: usage2.input_tokens,
|
|
831202
|
+
output_tokens: usage2.output_tokens,
|
|
831203
|
+
cache_creation_input_tokens: usage2.cache_creation_input_tokens,
|
|
831204
|
+
cache_read_input_tokens: usage2.cache_read_input_tokens
|
|
831205
|
+
},
|
|
831206
|
+
startTime: new Date(start),
|
|
831207
|
+
endTime: new Date,
|
|
831208
|
+
completionStartTime: ttftMs > 0 ? new Date(start + ttftMs) : undefined,
|
|
831209
|
+
tools: convertToolsToLangfuse(toolSchemas),
|
|
831210
|
+
...enableThinking && { thinking: { type: "enabled" } }
|
|
831211
|
+
});
|
|
831212
|
+
if (partialMessage) {
|
|
831213
|
+
for (const output of assembleFinalAssistantOutputs({
|
|
831214
|
+
partialMessage,
|
|
831215
|
+
contentBlocks,
|
|
831216
|
+
tools,
|
|
831217
|
+
agentId: options.agentId,
|
|
831218
|
+
usage: usage2,
|
|
831219
|
+
stopReason,
|
|
831220
|
+
maxTokens
|
|
831221
|
+
})) {
|
|
831222
|
+
yield output;
|
|
831223
|
+
}
|
|
831224
|
+
}
|
|
831225
|
+
return !!partialMessage;
|
|
831226
|
+
} catch (error99) {
|
|
831227
|
+
if (error99 instanceof Error) {
|
|
831228
|
+
error99.__streamProducedOutput = !!partialMessage;
|
|
831229
|
+
}
|
|
831230
|
+
throw error99;
|
|
831231
|
+
}
|
|
831232
|
+
}
|
|
830795
831233
|
async function* queryModelOpenAI(messages, systemPrompt2, tools, signal, options) {
|
|
830796
831234
|
try {
|
|
830797
831235
|
const openaiModel = resolveOpenAIModel(options.model);
|
|
@@ -830842,188 +831280,69 @@ async function* queryModelOpenAI(messages, systemPrompt2, tools, signal, options
|
|
|
830842
831280
|
const { upperLimit } = getModelMaxOutputTokens(openaiModel);
|
|
830843
831281
|
const maxTokens = resolveOpenAIMaxTokens(upperLimit, options.maxOutputTokensOverride);
|
|
830844
831282
|
logForDebugging(`[OpenAI] Calling model=${openaiModel}, messages=${openaiMessages.length}, tools=${openaiTools.length}, thinking=${enableThinking}`);
|
|
830845
|
-
|
|
830846
|
-
|
|
830847
|
-
|
|
830848
|
-
|
|
830849
|
-
|
|
830850
|
-
|
|
830851
|
-
|
|
830852
|
-
|
|
830853
|
-
|
|
830854
|
-
|
|
830855
|
-
|
|
830856
|
-
|
|
830857
|
-
|
|
830858
|
-
|
|
830859
|
-
|
|
830860
|
-
|
|
830861
|
-
|
|
830862
|
-
|
|
830863
|
-
|
|
830864
|
-
|
|
830865
|
-
|
|
830866
|
-
|
|
830867
|
-
|
|
830868
|
-
|
|
830869
|
-
|
|
830870
|
-
|
|
830871
|
-
|
|
830872
|
-
|
|
830873
|
-
|
|
830874
|
-
|
|
830875
|
-
})), async (client8, _attempt, _context2) => {
|
|
830876
|
-
try {
|
|
830877
|
-
return await client8.chat.completions.create(requestBody, { signal });
|
|
830878
|
-
} catch (err2) {
|
|
830879
|
-
throw wrapOpenAIErrorForRetry(err2);
|
|
830880
|
-
}
|
|
830881
|
-
}, {
|
|
830882
|
-
model: options.model,
|
|
830883
|
-
thinkingConfig: { type: "disabled" },
|
|
830884
|
-
signal,
|
|
830885
|
-
querySource: options.querySource
|
|
830886
|
-
});
|
|
830887
|
-
let stream6;
|
|
830888
|
-
let e4 = await retryGenerator.next();
|
|
830889
|
-
while (!e4.done) {
|
|
830890
|
-
if (e4.value.type === "system") {
|
|
830891
|
-
yield e4.value;
|
|
830892
|
-
}
|
|
830893
|
-
e4 = await retryGenerator.next();
|
|
831283
|
+
const requestBody = isChatGPTAuthEnabled() ? undefined : buildOpenAIRequestBody({
|
|
831284
|
+
model: openaiModel,
|
|
831285
|
+
messages: openaiMessages,
|
|
831286
|
+
tools: openaiTools,
|
|
831287
|
+
toolChoice: openaiToolChoice,
|
|
831288
|
+
enableThinking,
|
|
831289
|
+
maxTokens,
|
|
831290
|
+
temperatureOverride: options.temperatureOverride,
|
|
831291
|
+
outputFormat: options.outputFormat
|
|
831292
|
+
});
|
|
831293
|
+
let streamAttempts = 0;
|
|
831294
|
+
let lastStreamError;
|
|
831295
|
+
while (streamAttempts < MAX_STREAM_RECONNECT_ATTEMPTS) {
|
|
831296
|
+
streamAttempts++;
|
|
831297
|
+
let adaptedStream;
|
|
831298
|
+
if (isChatGPTAuthEnabled()) {
|
|
831299
|
+
adaptedStream = adaptResponsesStreamToAnthropic(await createChatGPTResponsesStream({
|
|
831300
|
+
request: buildResponsesRequest({
|
|
831301
|
+
model: openaiModel,
|
|
831302
|
+
messages: openaiMessages,
|
|
831303
|
+
tools: openaiTools,
|
|
831304
|
+
toolChoice: openaiToolChoice,
|
|
831305
|
+
reasoningEffort
|
|
831306
|
+
}),
|
|
831307
|
+
signal,
|
|
831308
|
+
fetchOverride: options.fetchOverride
|
|
831309
|
+
}), openaiModel);
|
|
831310
|
+
} else {
|
|
831311
|
+
const stream6 = yield* getOpenAIStream(requestBody, options, signal);
|
|
831312
|
+
adaptedStream = adaptOpenAIStreamToAnthropic(stream6, openaiModel);
|
|
830894
831313
|
}
|
|
830895
|
-
|
|
830896
|
-
|
|
830897
|
-
|
|
830898
|
-
|
|
830899
|
-
|
|
830900
|
-
let partialMessage;
|
|
830901
|
-
let stopReason = null;
|
|
830902
|
-
let usage2 = {
|
|
830903
|
-
input_tokens: 0,
|
|
830904
|
-
output_tokens: 0,
|
|
830905
|
-
cache_creation_input_tokens: 0,
|
|
830906
|
-
cache_read_input_tokens: 0
|
|
830907
|
-
};
|
|
830908
|
-
let ttftMs = 0;
|
|
830909
|
-
const start = Date.now();
|
|
830910
|
-
for await (const event of adaptedStream) {
|
|
830911
|
-
switch (event.type) {
|
|
830912
|
-
case "message_start": {
|
|
830913
|
-
partialMessage = event.message;
|
|
830914
|
-
ttftMs = Date.now() - start;
|
|
830915
|
-
if (event.message?.usage) {
|
|
830916
|
-
usage2 = {
|
|
830917
|
-
...usage2,
|
|
830918
|
-
...event.message.usage
|
|
830919
|
-
};
|
|
830920
|
-
}
|
|
830921
|
-
break;
|
|
830922
|
-
}
|
|
830923
|
-
case "content_block_start": {
|
|
830924
|
-
const idx = event.index;
|
|
830925
|
-
const cb = event.content_block;
|
|
830926
|
-
if (cb.type === "tool_use") {
|
|
830927
|
-
contentBlocks[idx] = { ...cb, input: "" };
|
|
830928
|
-
} else if (cb.type === "text") {
|
|
830929
|
-
contentBlocks[idx] = { ...cb, text: "" };
|
|
830930
|
-
} else if (cb.type === "thinking") {
|
|
830931
|
-
contentBlocks[idx] = { ...cb, thinking: "", signature: "" };
|
|
830932
|
-
} else {
|
|
830933
|
-
contentBlocks[idx] = { ...cb };
|
|
830934
|
-
}
|
|
830935
|
-
break;
|
|
830936
|
-
}
|
|
830937
|
-
case "content_block_delta": {
|
|
830938
|
-
const idx = event.index;
|
|
830939
|
-
const delta = event.delta;
|
|
830940
|
-
const block = contentBlocks[idx];
|
|
830941
|
-
if (!block)
|
|
830942
|
-
break;
|
|
830943
|
-
if (delta.type === "text_delta") {
|
|
830944
|
-
block.text = (block.text || "") + delta.text;
|
|
830945
|
-
} else if (delta.type === "input_json_delta") {
|
|
830946
|
-
block.input = (block.input || "") + delta.partial_json;
|
|
830947
|
-
} else if (delta.type === "thinking_delta") {
|
|
830948
|
-
block.thinking = (block.thinking || "") + delta.thinking;
|
|
830949
|
-
} else if (delta.type === "signature_delta") {
|
|
830950
|
-
block.signature = delta.signature;
|
|
830951
|
-
}
|
|
830952
|
-
break;
|
|
830953
|
-
}
|
|
830954
|
-
case "content_block_stop": {
|
|
830955
|
-
break;
|
|
831314
|
+
try {
|
|
831315
|
+
const producedOutput = yield* consumeOpenAIStream(adaptedStream, openaiModel, tools, options, maxTokens, openaiMessages, toolSchemas, enableThinking);
|
|
831316
|
+
if (!producedOutput && streamAttempts < MAX_STREAM_RECONNECT_ATTEMPTS) {
|
|
831317
|
+
logForDebugging(`[OpenAI] Stream completed without producing output (attempt ${streamAttempts}/${MAX_STREAM_RECONNECT_ATTEMPTS}), reconnecting`, { level: "warn" });
|
|
831318
|
+
continue;
|
|
830956
831319
|
}
|
|
830957
|
-
|
|
830958
|
-
|
|
830959
|
-
|
|
830960
|
-
|
|
830961
|
-
|
|
830962
|
-
|
|
830963
|
-
|
|
830964
|
-
}
|
|
830965
|
-
break;
|
|
831320
|
+
return;
|
|
831321
|
+
} catch (error99) {
|
|
831322
|
+
lastStreamError = error99;
|
|
831323
|
+
const producedOutput = error99 instanceof Error && error99.__streamProducedOutput === true;
|
|
831324
|
+
if (!producedOutput && streamAttempts < MAX_STREAM_RECONNECT_ATTEMPTS && isRetryableStreamError(error99)) {
|
|
831325
|
+
logForDebugging(`[OpenAI] Stream failed before producing output (attempt ${streamAttempts}/${MAX_STREAM_RECONNECT_ATTEMPTS}), reconnecting: ${error99 instanceof Error ? error99.message : String(error99)}`, { level: "warn" });
|
|
831326
|
+
continue;
|
|
830966
831327
|
}
|
|
830967
|
-
|
|
830968
|
-
|
|
830969
|
-
|
|
830970
|
-
|
|
830971
|
-
|
|
830972
|
-
|
|
830973
|
-
|
|
830974
|
-
|
|
830975
|
-
|
|
830976
|
-
|
|
830977
|
-
|
|
830978
|
-
if (output.type === "assistant") {
|
|
830979
|
-
collectedMessages.push(output);
|
|
830980
|
-
}
|
|
830981
|
-
yield output;
|
|
830982
|
-
}
|
|
830983
|
-
partialMessage = null;
|
|
830984
|
-
}
|
|
830985
|
-
if (usage2.input_tokens + usage2.output_tokens > 0) {
|
|
830986
|
-
const costUSD = calculateUSDCost(openaiModel, usage2);
|
|
830987
|
-
addToTotalSessionCost(costUSD, usage2, options.model);
|
|
831328
|
+
if (producedOutput && requestBody && !(error99 instanceof APIUserAbortError)) {
|
|
831329
|
+
logForDebugging(`[OpenAI] Streaming failed after producing output, falling back to non-streaming: ${error99 instanceof Error ? error99.message : String(error99)}`, { level: "warn" });
|
|
831330
|
+
try {
|
|
831331
|
+
const nonStreamingBody = toNonStreamingOpenAIRequestBody(requestBody);
|
|
831332
|
+
const completion = yield* executeOpenAINonStreamingRequest(nonStreamingBody, options, signal);
|
|
831333
|
+
const fallbackStream = adaptOpenAICompletionToAnthropicStream(completion);
|
|
831334
|
+
yield* consumeOpenAIStream(fallbackStream, openaiModel, tools, options, maxTokens, openaiMessages, toolSchemas, enableThinking);
|
|
831335
|
+
return;
|
|
831336
|
+
} catch (fallbackError) {
|
|
831337
|
+
logForDebugging(`[OpenAI] Non-streaming fallback also failed: ${fallbackError instanceof Error ? fallbackError.message : String(fallbackError)}`, { level: "error" });
|
|
831338
|
+
throw fallbackError;
|
|
830988
831339
|
}
|
|
830989
|
-
break;
|
|
830990
831340
|
}
|
|
831341
|
+
throw error99;
|
|
830991
831342
|
}
|
|
830992
|
-
yield {
|
|
830993
|
-
type: "stream_event",
|
|
830994
|
-
event,
|
|
830995
|
-
...event.type === "message_start" ? { ttftMs } : undefined
|
|
830996
|
-
};
|
|
830997
831343
|
}
|
|
830998
|
-
|
|
830999
|
-
|
|
831000
|
-
provider: "openai",
|
|
831001
|
-
input: convertMessagesToLangfuse(openaiMessages),
|
|
831002
|
-
output: convertOutputToLangfuse(collectedMessages),
|
|
831003
|
-
usage: {
|
|
831004
|
-
input_tokens: usage2.input_tokens,
|
|
831005
|
-
output_tokens: usage2.output_tokens,
|
|
831006
|
-
cache_creation_input_tokens: usage2.cache_creation_input_tokens,
|
|
831007
|
-
cache_read_input_tokens: usage2.cache_read_input_tokens
|
|
831008
|
-
},
|
|
831009
|
-
startTime: new Date(start),
|
|
831010
|
-
endTime: new Date,
|
|
831011
|
-
completionStartTime: ttftMs > 0 ? new Date(start + ttftMs) : undefined,
|
|
831012
|
-
tools: convertToolsToLangfuse(toolSchemas),
|
|
831013
|
-
...enableThinking && { thinking: { type: "enabled" } }
|
|
831014
|
-
});
|
|
831015
|
-
if (partialMessage) {
|
|
831016
|
-
for (const output of assembleFinalAssistantOutputs({
|
|
831017
|
-
partialMessage,
|
|
831018
|
-
contentBlocks,
|
|
831019
|
-
tools,
|
|
831020
|
-
agentId: options.agentId,
|
|
831021
|
-
usage: usage2,
|
|
831022
|
-
stopReason,
|
|
831023
|
-
maxTokens
|
|
831024
|
-
})) {
|
|
831025
|
-
yield output;
|
|
831026
|
-
}
|
|
831344
|
+
if (lastStreamError) {
|
|
831345
|
+
throw lastStreamError;
|
|
831027
831346
|
}
|
|
831028
831347
|
} catch (error99) {
|
|
831029
831348
|
const errorMessage2 = error99 instanceof Error ? error99.message : String(error99);
|
|
@@ -831035,11 +831354,14 @@ async function* queryModelOpenAI(messages, systemPrompt2, tools, signal, options
|
|
|
831035
831354
|
});
|
|
831036
831355
|
}
|
|
831037
831356
|
}
|
|
831357
|
+
var MAX_STREAM_RECONNECT_ATTEMPTS = 3;
|
|
831038
831358
|
var init_openai5 = __esm(() => {
|
|
831359
|
+
init_sdk();
|
|
831039
831360
|
init_client18();
|
|
831040
831361
|
init_src3();
|
|
831041
831362
|
init_withRetry();
|
|
831042
831363
|
init_retry3();
|
|
831364
|
+
init_nonStreamingFallback();
|
|
831043
831365
|
init_chatgptAuth();
|
|
831044
831366
|
init_responsesAdapter();
|
|
831045
831367
|
init_messages7();
|
|
@@ -831546,7 +831868,7 @@ var exports_gemini = {};
|
|
|
831546
831868
|
__export(exports_gemini, {
|
|
831547
831869
|
queryModelGemini: () => queryModelGemini
|
|
831548
831870
|
});
|
|
831549
|
-
import { randomUUID as
|
|
831871
|
+
import { randomUUID as randomUUID53 } from "crypto";
|
|
831550
831872
|
async function* queryModelGemini(messages, systemPrompt2, tools, signal, options, thinkingConfig) {
|
|
831551
831873
|
try {
|
|
831552
831874
|
const geminiModel = resolveGeminiModel(options.model);
|
|
@@ -831655,7 +831977,7 @@ async function* queryModelGemini(messages, systemPrompt2, tools, signal, options
|
|
|
831655
831977
|
},
|
|
831656
831978
|
requestId: undefined,
|
|
831657
831979
|
type: "assistant",
|
|
831658
|
-
uuid:
|
|
831980
|
+
uuid: randomUUID53(),
|
|
831659
831981
|
timestamp: new Date().toISOString()
|
|
831660
831982
|
};
|
|
831661
831983
|
collectedMessages.push(message2);
|
|
@@ -831740,7 +832062,7 @@ var exports_grok = {};
|
|
|
831740
832062
|
__export(exports_grok, {
|
|
831741
832063
|
queryModelGrok: () => queryModelGrok
|
|
831742
832064
|
});
|
|
831743
|
-
import { randomUUID as
|
|
832065
|
+
import { randomUUID as randomUUID54 } from "crypto";
|
|
831744
832066
|
async function* queryModelGrok(messages, systemPrompt2, tools, signal, options) {
|
|
831745
832067
|
try {
|
|
831746
832068
|
const grokModel = resolveGrokModel(options.model);
|
|
@@ -831847,7 +832169,7 @@ async function* queryModelGrok(messages, systemPrompt2, tools, signal, options)
|
|
|
831847
832169
|
},
|
|
831848
832170
|
requestId: undefined,
|
|
831849
832171
|
type: "assistant",
|
|
831850
|
-
uuid:
|
|
832172
|
+
uuid: randomUUID54(),
|
|
831851
832173
|
timestamp: new Date().toISOString()
|
|
831852
832174
|
};
|
|
831853
832175
|
collectedMessages.push(m3);
|
|
@@ -832153,8 +832475,8 @@ var exports_provider = {};
|
|
|
832153
832475
|
__export(exports_provider, {
|
|
832154
832476
|
queryModelCoStrict: () => queryModelCoStrict
|
|
832155
832477
|
});
|
|
832156
|
-
import { randomUUID as
|
|
832157
|
-
function
|
|
832478
|
+
import { randomUUID as randomUUID55 } from "crypto";
|
|
832479
|
+
function isRecord7(value) {
|
|
832158
832480
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
832159
832481
|
}
|
|
832160
832482
|
function mapErrorToSDKError(error99) {
|
|
@@ -832175,7 +832497,7 @@ function mapErrorToSDKError(error99) {
|
|
|
832175
832497
|
return "unknown";
|
|
832176
832498
|
}
|
|
832177
832499
|
function isPlainRecord(value) {
|
|
832178
|
-
return
|
|
832500
|
+
return isRecord7(value);
|
|
832179
832501
|
}
|
|
832180
832502
|
function tryParsePartialToolInput(rawInput) {
|
|
832181
832503
|
try {
|
|
@@ -832192,7 +832514,7 @@ function contentContainsImage(content) {
|
|
|
832192
832514
|
if (!Array.isArray(content))
|
|
832193
832515
|
return false;
|
|
832194
832516
|
return content.some((block) => {
|
|
832195
|
-
if (!
|
|
832517
|
+
if (!isRecord7(block))
|
|
832196
832518
|
return false;
|
|
832197
832519
|
if (block.type === "image")
|
|
832198
832520
|
return true;
|
|
@@ -832252,178 +832574,96 @@ function isNonMultimodalModelError(message2) {
|
|
|
832252
832574
|
const normalized = message2.toLowerCase();
|
|
832253
832575
|
return normalized.includes("not a multimodal model") || normalized.includes("does not support image") || normalized.includes("does not support images");
|
|
832254
832576
|
}
|
|
832255
|
-
async function*
|
|
832256
|
-
|
|
832257
|
-
|
|
832258
|
-
|
|
832259
|
-
|
|
832260
|
-
|
|
832261
|
-
setCachedIntranetBaseUrl(creds?.base_url ?? null);
|
|
832262
|
-
let defaultMaxTokens = getModelMaxOutputTokens(costrictModel).upperLimit;
|
|
832263
|
-
let maxTokensParamKey = "max_tokens";
|
|
832264
|
-
let modelInfo;
|
|
832265
|
-
if (creds?.access_token) {
|
|
832266
|
-
try {
|
|
832267
|
-
const modelList = await fetchCoStrictModels(baseUrl, creds.access_token);
|
|
832268
|
-
modelInfo = modelList.find((m3) => m3.id === costrictModel);
|
|
832269
|
-
if (modelInfo) {
|
|
832270
|
-
maxTokensParamKey = modelInfo.maxTokensKey || "max_tokens";
|
|
832271
|
-
if (modelInfo.maxTokens != null) {
|
|
832272
|
-
defaultMaxTokens = modelInfo.maxTokens;
|
|
832273
|
-
}
|
|
832274
|
-
}
|
|
832275
|
-
} catch {}
|
|
832276
|
-
}
|
|
832277
|
-
const maxTokensValue = resolveOpenAIMaxTokens(defaultMaxTokens, options.maxOutputTokensOverride);
|
|
832278
|
-
let messagesForAPI = ensureToolResultPairing(normalizeMessagesForAPI(messages, tools));
|
|
832279
|
-
if (modelInfo?.supportsImages === false && messagesContainImages(messagesForAPI)) {
|
|
832280
|
-
messagesForAPI = stripImagesFromMessages2(messagesForAPI, costrictModel);
|
|
832577
|
+
async function* executeCoStrictNonStreamingRequest(client8, requestBody, options, signal) {
|
|
832578
|
+
const retryGenerator = withRetry(() => Promise.resolve(client8), async (c7, _attempt, _context2) => {
|
|
832579
|
+
try {
|
|
832580
|
+
return await c7.chat.completions.create(requestBody, { signal });
|
|
832581
|
+
} catch (err2) {
|
|
832582
|
+
throw wrapOpenAIErrorForRetry(err2);
|
|
832281
832583
|
}
|
|
832282
|
-
|
|
832283
|
-
|
|
832284
|
-
|
|
832285
|
-
|
|
832286
|
-
|
|
832287
|
-
|
|
832288
|
-
|
|
832289
|
-
|
|
832290
|
-
|
|
832291
|
-
|
|
832292
|
-
|
|
832293
|
-
|
|
832294
|
-
|
|
832295
|
-
|
|
832296
|
-
|
|
832297
|
-
|
|
832298
|
-
|
|
832299
|
-
|
|
832300
|
-
|
|
832301
|
-
|
|
832302
|
-
|
|
832303
|
-
|
|
832304
|
-
|
|
832305
|
-
|
|
832306
|
-
|
|
832307
|
-
|
|
832308
|
-
|
|
832309
|
-
|
|
832310
|
-
|
|
832311
|
-
"User-Agent": getUserAgent(),
|
|
832312
|
-
"X-Session-Id": getSessionId(),
|
|
832313
|
-
...options.agentId ? { "X-Agent-Id": options.agentId } : {},
|
|
832314
|
-
...options.parentAgentId ? { "X-Parent-Agent-Id": options.parentAgentId } : {}
|
|
832315
|
-
}
|
|
832316
|
-
});
|
|
832317
|
-
logForDebugging(`[CoStrict] model=${costrictModel}, baseURL=${chatBaseURL}, messages=${openaiMessages.length}, tools=${openaiTools.length}`);
|
|
832318
|
-
const requestBody = {
|
|
832319
|
-
model: costrictModel,
|
|
832320
|
-
messages: openaiMessages,
|
|
832321
|
-
...openaiTools.length > 0 && {
|
|
832322
|
-
tools: openaiTools,
|
|
832323
|
-
...openaiToolChoice && {
|
|
832324
|
-
tool_choice: openaiToolChoice
|
|
832325
|
-
}
|
|
832326
|
-
},
|
|
832327
|
-
stream: true,
|
|
832328
|
-
stream_options: { include_usage: true },
|
|
832329
|
-
[maxTokensParamKey]: maxTokensValue,
|
|
832330
|
-
...enableThinking && {
|
|
832331
|
-
thinking: { type: "enabled" },
|
|
832332
|
-
enable_thinking: true,
|
|
832333
|
-
chat_template_kwargs: { thinking: true }
|
|
832334
|
-
},
|
|
832335
|
-
...!enableThinking && options.temperatureOverride !== undefined && {
|
|
832336
|
-
temperature: options.temperatureOverride
|
|
832337
|
-
}
|
|
832338
|
-
};
|
|
832339
|
-
const retryGenerator = withRetry(() => Promise.resolve(client8), async (c7, _attempt, _context2) => {
|
|
832584
|
+
}, {
|
|
832585
|
+
model: options.model,
|
|
832586
|
+
fallbackModel: options.fallbackModel,
|
|
832587
|
+
thinkingConfig: { type: "disabled" },
|
|
832588
|
+
signal,
|
|
832589
|
+
querySource: options.querySource
|
|
832590
|
+
});
|
|
832591
|
+
let e4 = await retryGenerator.next();
|
|
832592
|
+
while (!e4.done) {
|
|
832593
|
+
yield e4.value;
|
|
832594
|
+
e4 = await retryGenerator.next();
|
|
832595
|
+
}
|
|
832596
|
+
return e4.value;
|
|
832597
|
+
}
|
|
832598
|
+
async function* consumeCoStrictStream(adaptedStream, costrictModel, tools, options, maxTokensValue) {
|
|
832599
|
+
const contentBlocks = {};
|
|
832600
|
+
const toolCallStates = new Map;
|
|
832601
|
+
let partialMessage;
|
|
832602
|
+
let stopReason = null;
|
|
832603
|
+
let usage2 = {
|
|
832604
|
+
input_tokens: 0,
|
|
832605
|
+
output_tokens: 0,
|
|
832606
|
+
cache_creation_input_tokens: 0,
|
|
832607
|
+
cache_read_input_tokens: 0
|
|
832608
|
+
};
|
|
832609
|
+
let ttftMs = 0;
|
|
832610
|
+
const start = Date.now();
|
|
832611
|
+
const finalizeToolCallStates = () => {
|
|
832612
|
+
for (const state3 of toolCallStates.values()) {
|
|
832340
832613
|
try {
|
|
832341
|
-
|
|
832342
|
-
|
|
832343
|
-
throw wrapOpenAIErrorForRetry(err2);
|
|
832344
|
-
}
|
|
832345
|
-
}, {
|
|
832346
|
-
model: options.model,
|
|
832347
|
-
fallbackModel: options.fallbackModel,
|
|
832348
|
-
thinkingConfig: { type: "disabled" },
|
|
832349
|
-
signal,
|
|
832350
|
-
querySource: options.querySource
|
|
832351
|
-
});
|
|
832352
|
-
let stream6;
|
|
832353
|
-
let e4 = await retryGenerator.next();
|
|
832354
|
-
while (!e4.done) {
|
|
832355
|
-
if (e4.value.type === "system") {
|
|
832356
|
-
yield e4.value;
|
|
832357
|
-
}
|
|
832358
|
-
e4 = await retryGenerator.next();
|
|
832359
|
-
}
|
|
832360
|
-
stream6 = e4.value;
|
|
832361
|
-
const adaptedStream = adaptOpenAIStreamToAnthropic(stream6, costrictModel);
|
|
832362
|
-
const contentBlocks = {};
|
|
832363
|
-
const toolCallStates = new Map;
|
|
832364
|
-
let partialMessage;
|
|
832365
|
-
let stopReason = null;
|
|
832366
|
-
let usage2 = {
|
|
832367
|
-
input_tokens: 0,
|
|
832368
|
-
output_tokens: 0,
|
|
832369
|
-
cache_creation_input_tokens: 0,
|
|
832370
|
-
cache_read_input_tokens: 0
|
|
832371
|
-
};
|
|
832372
|
-
let ttftMs = 0;
|
|
832373
|
-
const start = Date.now();
|
|
832374
|
-
const finalizeToolCallStates = () => {
|
|
832375
|
-
for (const state3 of toolCallStates.values()) {
|
|
832376
|
-
try {
|
|
832377
|
-
const parsed = JSON.parse(state3.rawInput);
|
|
832378
|
-
if (!isPlainRecord(parsed)) {
|
|
832379
|
-
state3.finalParseError = getInvalidToolInputMessage(state3.name);
|
|
832380
|
-
}
|
|
832381
|
-
} catch {
|
|
832614
|
+
const parsed = JSON.parse(state3.rawInput);
|
|
832615
|
+
if (!isPlainRecord(parsed)) {
|
|
832382
832616
|
state3.finalParseError = getInvalidToolInputMessage(state3.name);
|
|
832383
832617
|
}
|
|
832618
|
+
} catch {
|
|
832619
|
+
state3.finalParseError = getInvalidToolInputMessage(state3.name);
|
|
832384
832620
|
}
|
|
832385
|
-
}
|
|
832386
|
-
|
|
832387
|
-
|
|
832388
|
-
|
|
832389
|
-
|
|
832390
|
-
|
|
832391
|
-
|
|
832392
|
-
|
|
832393
|
-
|
|
832394
|
-
|
|
832395
|
-
|
|
832396
|
-
|
|
832397
|
-
|
|
832398
|
-
|
|
832399
|
-
|
|
832400
|
-
|
|
832401
|
-
|
|
832402
|
-
|
|
832621
|
+
}
|
|
832622
|
+
};
|
|
832623
|
+
const assembleFinalAssistantOutputs2 = () => {
|
|
832624
|
+
const outputs2 = [];
|
|
832625
|
+
if (!partialMessage)
|
|
832626
|
+
return outputs2;
|
|
832627
|
+
const allBlocksWithIndices = Object.keys(contentBlocks).sort((a5, b6) => Number(a5) - Number(b6)).map((k5) => ({ index: Number(k5), block: contentBlocks[Number(k5)] })).filter((entry) => Boolean(entry.block));
|
|
832628
|
+
const allBlocks = allBlocksWithIndices.map((entry) => entry.block);
|
|
832629
|
+
if (allBlocks.length > 0) {
|
|
832630
|
+
for (const { index: index2, block } of allBlocksWithIndices) {
|
|
832631
|
+
if (block?.type !== "tool_use")
|
|
832632
|
+
continue;
|
|
832633
|
+
const state3 = toolCallStates.get(index2);
|
|
832634
|
+
if (!state3)
|
|
832635
|
+
continue;
|
|
832636
|
+
block.input = state3.rawInput;
|
|
832637
|
+
if (state3.finalParseError) {
|
|
832638
|
+
block.invalidToolCallError = state3.finalParseError;
|
|
832403
832639
|
}
|
|
832404
|
-
outputs2.push({
|
|
832405
|
-
message: {
|
|
832406
|
-
...partialMessage,
|
|
832407
|
-
content: normalizeContentFromAPI(allBlocks, tools, options.agentId, { preserveInvalidToolCall: true }),
|
|
832408
|
-
usage: usage2,
|
|
832409
|
-
stop_reason: stopReason,
|
|
832410
|
-
stop_sequence: null
|
|
832411
|
-
},
|
|
832412
|
-
requestId: undefined,
|
|
832413
|
-
type: "assistant",
|
|
832414
|
-
uuid: randomUUID54(),
|
|
832415
|
-
timestamp: new Date().toISOString()
|
|
832416
|
-
});
|
|
832417
|
-
}
|
|
832418
|
-
if (stopReason === "max_tokens") {
|
|
832419
|
-
outputs2.push(createAssistantAPIErrorMessage({
|
|
832420
|
-
content: `Output truncated: response exceeded the ${maxTokensValue} token limit. ` + `Set OPENAI_MAX_TOKENS or COSTRICT_MAX_OUTPUT_TOKENS to override.`,
|
|
832421
|
-
apiError: "max_output_tokens",
|
|
832422
|
-
error: "max_output_tokens"
|
|
832423
|
-
}));
|
|
832424
832640
|
}
|
|
832425
|
-
|
|
832426
|
-
|
|
832641
|
+
outputs2.push({
|
|
832642
|
+
message: {
|
|
832643
|
+
...partialMessage,
|
|
832644
|
+
content: normalizeContentFromAPI(allBlocks, tools, options.agentId, {
|
|
832645
|
+
preserveInvalidToolCall: true
|
|
832646
|
+
}),
|
|
832647
|
+
usage: usage2,
|
|
832648
|
+
stop_reason: stopReason,
|
|
832649
|
+
stop_sequence: null
|
|
832650
|
+
},
|
|
832651
|
+
requestId: undefined,
|
|
832652
|
+
type: "assistant",
|
|
832653
|
+
uuid: randomUUID55(),
|
|
832654
|
+
timestamp: new Date().toISOString()
|
|
832655
|
+
});
|
|
832656
|
+
}
|
|
832657
|
+
if (stopReason === "max_tokens") {
|
|
832658
|
+
outputs2.push(createAssistantAPIErrorMessage({
|
|
832659
|
+
content: `Output truncated: response exceeded the ${maxTokensValue} token limit. ` + `Set OPENAI_MAX_TOKENS or COSTRICT_MAX_OUTPUT_TOKENS to override.`,
|
|
832660
|
+
apiError: "max_output_tokens",
|
|
832661
|
+
error: "max_output_tokens"
|
|
832662
|
+
}));
|
|
832663
|
+
}
|
|
832664
|
+
return outputs2;
|
|
832665
|
+
};
|
|
832666
|
+
try {
|
|
832427
832667
|
for await (const event of adaptedStream) {
|
|
832428
832668
|
switch (event.type) {
|
|
832429
832669
|
case "message_start": {
|
|
@@ -832521,6 +832761,158 @@ async function* queryModelCoStrict(messages, systemPrompt2, tools, signal, optio
|
|
|
832521
832761
|
yield output;
|
|
832522
832762
|
}
|
|
832523
832763
|
}
|
|
832764
|
+
return !!partialMessage;
|
|
832765
|
+
} catch (error99) {
|
|
832766
|
+
if (error99 instanceof Error) {
|
|
832767
|
+
error99.__streamProducedOutput = !!partialMessage;
|
|
832768
|
+
}
|
|
832769
|
+
throw error99;
|
|
832770
|
+
}
|
|
832771
|
+
}
|
|
832772
|
+
async function* queryModelCoStrict(messages, systemPrompt2, tools, signal, options) {
|
|
832773
|
+
try {
|
|
832774
|
+
const costrictModel = resolveCoStrictModel(options.model);
|
|
832775
|
+
const creds = await loadCoStrictCredentials();
|
|
832776
|
+
const baseUrl = getCoStrictBaseURL(creds?.base_url);
|
|
832777
|
+
const chatBaseURL = `${baseUrl}/chat-rag/api/v1`;
|
|
832778
|
+
setCachedIntranetBaseUrl(creds?.base_url ?? null);
|
|
832779
|
+
let defaultMaxTokens = getModelMaxOutputTokens(costrictModel).upperLimit;
|
|
832780
|
+
let maxTokensParamKey = "max_tokens";
|
|
832781
|
+
let modelInfo;
|
|
832782
|
+
if (creds?.access_token) {
|
|
832783
|
+
try {
|
|
832784
|
+
const modelList = await fetchCoStrictModels(baseUrl, creds.access_token);
|
|
832785
|
+
modelInfo = modelList.find((m3) => m3.id === costrictModel);
|
|
832786
|
+
if (modelInfo) {
|
|
832787
|
+
maxTokensParamKey = modelInfo.maxTokensKey || "max_tokens";
|
|
832788
|
+
if (modelInfo.maxTokens != null) {
|
|
832789
|
+
defaultMaxTokens = modelInfo.maxTokens;
|
|
832790
|
+
}
|
|
832791
|
+
}
|
|
832792
|
+
} catch {}
|
|
832793
|
+
}
|
|
832794
|
+
const maxTokensValue = resolveOpenAIMaxTokens(defaultMaxTokens, options.maxOutputTokensOverride);
|
|
832795
|
+
let messagesForAPI = ensureToolResultPairing(normalizeMessagesForAPI(messages, tools));
|
|
832796
|
+
if (modelInfo?.supportsImages === false && messagesContainImages(messagesForAPI)) {
|
|
832797
|
+
messagesForAPI = stripImagesFromMessages2(messagesForAPI, costrictModel);
|
|
832798
|
+
}
|
|
832799
|
+
const toolSchemas = await Promise.all(tools.map((tool) => toolToAPISchema(tool, {
|
|
832800
|
+
getToolPermissionContext: options.getToolPermissionContext,
|
|
832801
|
+
tools,
|
|
832802
|
+
agents: options.agents,
|
|
832803
|
+
allowedAgentTypes: options.allowedAgentTypes,
|
|
832804
|
+
model: options.model
|
|
832805
|
+
})));
|
|
832806
|
+
const standardTools = toolSchemas.filter((t2) => {
|
|
832807
|
+
const anyT = t2;
|
|
832808
|
+
return anyT.type !== "advisor_20260301" && anyT.type !== "computer_20250124";
|
|
832809
|
+
});
|
|
832810
|
+
const enableThinking = isOpenAIThinkingEnabled(costrictModel);
|
|
832811
|
+
const openaiMessages = anthropicMessagesToOpenAI(messagesForAPI, systemPrompt2, { enableThinking });
|
|
832812
|
+
const openaiTools = anthropicToolsToOpenAI(standardTools);
|
|
832813
|
+
const openaiToolChoice = anthropicToolChoiceToOpenAI(options.toolChoice);
|
|
832814
|
+
const costrictFetch = createCoStrictFetch({
|
|
832815
|
+
agentType: getMainThreadAgentType() ?? getActiveSkillName()
|
|
832816
|
+
});
|
|
832817
|
+
const client8 = new OpenAI({
|
|
832818
|
+
apiKey: "costrict-managed",
|
|
832819
|
+
baseURL: chatBaseURL,
|
|
832820
|
+
maxRetries: 0,
|
|
832821
|
+
timeout: parseInt(process.env.API_TIMEOUT_MS || String(600 * 1000), 10),
|
|
832822
|
+
dangerouslyAllowBrowser: true,
|
|
832823
|
+
fetchOptions: getProxyFetchOptions({
|
|
832824
|
+
forAnthropicAPI: false
|
|
832825
|
+
}),
|
|
832826
|
+
fetch: costrictFetch,
|
|
832827
|
+
defaultHeaders: {
|
|
832828
|
+
"User-Agent": getUserAgent(),
|
|
832829
|
+
"X-Session-Id": getSessionId(),
|
|
832830
|
+
...options.agentId ? { "X-Agent-Id": options.agentId } : {},
|
|
832831
|
+
...options.parentAgentId ? { "X-Parent-Agent-Id": options.parentAgentId } : {}
|
|
832832
|
+
}
|
|
832833
|
+
});
|
|
832834
|
+
logForDebugging(`[CoStrict] model=${costrictModel}, baseURL=${chatBaseURL}, messages=${openaiMessages.length}, tools=${openaiTools.length}`);
|
|
832835
|
+
const requestBody = {
|
|
832836
|
+
model: costrictModel,
|
|
832837
|
+
messages: openaiMessages,
|
|
832838
|
+
...openaiTools.length > 0 && {
|
|
832839
|
+
tools: openaiTools,
|
|
832840
|
+
...openaiToolChoice && {
|
|
832841
|
+
tool_choice: openaiToolChoice
|
|
832842
|
+
}
|
|
832843
|
+
},
|
|
832844
|
+
stream: true,
|
|
832845
|
+
stream_options: { include_usage: true },
|
|
832846
|
+
[maxTokensParamKey]: maxTokensValue,
|
|
832847
|
+
...enableThinking && {
|
|
832848
|
+
thinking: { type: "enabled" },
|
|
832849
|
+
enable_thinking: true,
|
|
832850
|
+
chat_template_kwargs: { thinking: true }
|
|
832851
|
+
},
|
|
832852
|
+
...!enableThinking && options.temperatureOverride !== undefined && {
|
|
832853
|
+
temperature: options.temperatureOverride
|
|
832854
|
+
}
|
|
832855
|
+
};
|
|
832856
|
+
let streamAttempts = 0;
|
|
832857
|
+
let lastStreamError;
|
|
832858
|
+
while (streamAttempts < MAX_STREAM_RECONNECT_ATTEMPTS2) {
|
|
832859
|
+
streamAttempts++;
|
|
832860
|
+
const retryGenerator = withRetry(() => Promise.resolve(client8), async (c7, _attempt, _context2) => {
|
|
832861
|
+
try {
|
|
832862
|
+
return await c7.chat.completions.create(requestBody, { signal });
|
|
832863
|
+
} catch (err2) {
|
|
832864
|
+
throw wrapOpenAIErrorForRetry(err2);
|
|
832865
|
+
}
|
|
832866
|
+
}, {
|
|
832867
|
+
model: options.model,
|
|
832868
|
+
fallbackModel: options.fallbackModel,
|
|
832869
|
+
thinkingConfig: { type: "disabled" },
|
|
832870
|
+
signal,
|
|
832871
|
+
querySource: options.querySource
|
|
832872
|
+
});
|
|
832873
|
+
let stream6;
|
|
832874
|
+
let e4 = await retryGenerator.next();
|
|
832875
|
+
while (!e4.done) {
|
|
832876
|
+
if (e4.value.type === "system") {
|
|
832877
|
+
yield e4.value;
|
|
832878
|
+
}
|
|
832879
|
+
e4 = await retryGenerator.next();
|
|
832880
|
+
}
|
|
832881
|
+
stream6 = e4.value;
|
|
832882
|
+
const adaptedStream = adaptOpenAIStreamToAnthropic(stream6, costrictModel);
|
|
832883
|
+
try {
|
|
832884
|
+
const producedOutput = yield* consumeCoStrictStream(adaptedStream, costrictModel, tools, options, maxTokensValue);
|
|
832885
|
+
if (!producedOutput && streamAttempts < MAX_STREAM_RECONNECT_ATTEMPTS2) {
|
|
832886
|
+
logForDebugging(`[CoStrict] Stream completed without producing output (attempt ${streamAttempts}/${MAX_STREAM_RECONNECT_ATTEMPTS2}), reconnecting`, { level: "warn" });
|
|
832887
|
+
continue;
|
|
832888
|
+
}
|
|
832889
|
+
return;
|
|
832890
|
+
} catch (error99) {
|
|
832891
|
+
lastStreamError = error99;
|
|
832892
|
+
const producedOutput = error99 instanceof Error && error99.__streamProducedOutput === true;
|
|
832893
|
+
if (!producedOutput && streamAttempts < MAX_STREAM_RECONNECT_ATTEMPTS2 && isRetryableStreamError(error99)) {
|
|
832894
|
+
logForDebugging(`[CoStrict] Stream failed before producing output (attempt ${streamAttempts}/${MAX_STREAM_RECONNECT_ATTEMPTS2}), reconnecting: ${error99 instanceof Error ? error99.message : String(error99)}`, { level: "warn" });
|
|
832895
|
+
continue;
|
|
832896
|
+
}
|
|
832897
|
+
if (producedOutput && !(error99 instanceof APIUserAbortError)) {
|
|
832898
|
+
logForDebugging(`[CoStrict] Streaming failed after producing output, falling back to non-streaming: ${error99 instanceof Error ? error99.message : String(error99)}`, { level: "warn" });
|
|
832899
|
+
try {
|
|
832900
|
+
const nonStreamingBody = toNonStreamingOpenAIRequestBody(requestBody);
|
|
832901
|
+
const completion = yield* executeCoStrictNonStreamingRequest(client8, nonStreamingBody, options, signal);
|
|
832902
|
+
const fallbackStream = adaptOpenAICompletionToAnthropicStream(completion);
|
|
832903
|
+
yield* consumeCoStrictStream(fallbackStream, costrictModel, tools, options, maxTokensValue);
|
|
832904
|
+
return;
|
|
832905
|
+
} catch (fallbackError) {
|
|
832906
|
+
logForDebugging(`[CoStrict] Non-streaming fallback also failed: ${fallbackError instanceof Error ? fallbackError.message : String(fallbackError)}`, { level: "error" });
|
|
832907
|
+
throw fallbackError;
|
|
832908
|
+
}
|
|
832909
|
+
}
|
|
832910
|
+
throw error99;
|
|
832911
|
+
}
|
|
832912
|
+
}
|
|
832913
|
+
if (lastStreamError) {
|
|
832914
|
+
throw lastStreamError;
|
|
832915
|
+
}
|
|
832524
832916
|
} catch (error99) {
|
|
832525
832917
|
const errorMsg = error99 instanceof Error ? error99.message : String(error99);
|
|
832526
832918
|
logForDebugging(`[CoStrict] Error: ${errorMsg}`, { level: "error" });
|
|
@@ -832531,11 +832923,13 @@ async function* queryModelCoStrict(messages, systemPrompt2, tools, signal, optio
|
|
|
832531
832923
|
});
|
|
832532
832924
|
}
|
|
832533
832925
|
}
|
|
832534
|
-
var import_partial_json;
|
|
832926
|
+
var import_partial_json, MAX_STREAM_RECONNECT_ATTEMPTS2 = 3;
|
|
832535
832927
|
var init_provider4 = __esm(() => {
|
|
832536
832928
|
init_openai();
|
|
832929
|
+
init_sdk();
|
|
832537
832930
|
init_withRetry();
|
|
832538
832931
|
init_retry3();
|
|
832932
|
+
init_nonStreamingFallback();
|
|
832539
832933
|
init_proxy();
|
|
832540
832934
|
init_http4();
|
|
832541
832935
|
init_state();
|
|
@@ -832558,7 +832952,7 @@ var init_provider4 = __esm(() => {
|
|
|
832558
832952
|
});
|
|
832559
832953
|
|
|
832560
832954
|
// src/services/api/claude.ts
|
|
832561
|
-
import { randomUUID as
|
|
832955
|
+
import { randomUUID as randomUUID56 } from "crypto";
|
|
832562
832956
|
import { existsSync as existsSync32, unlinkSync as unlinkSync10 } from "fs";
|
|
832563
832957
|
function getExtraBodyParams(betaHeaders) {
|
|
832564
832958
|
const extraBodyStr = process.env.CLAUDE_CODE_EXTRA_BODY;
|
|
@@ -833117,7 +833511,7 @@ To invoke any tool listed above, use ExecuteExtraTool with {"tool_name": "<name>
|
|
|
833117
833511
|
const alwaysFlag = getBreakCacheAlwaysPath();
|
|
833118
833512
|
const shouldBreak = existsSync32(onceMarker) || existsSync32(alwaysFlag);
|
|
833119
833513
|
if (shouldBreak) {
|
|
833120
|
-
const nonce =
|
|
833514
|
+
const nonce = randomUUID56();
|
|
833121
833515
|
systemPrompt2 = asSystemPrompt([
|
|
833122
833516
|
...systemPrompt2,
|
|
833123
833517
|
`<!-- cache-break nonce: ${nonce} -->`
|
|
@@ -833388,7 +833782,7 @@ To invoke any tool listed above, use ExecuteExtraTool with {"tool_name": "<name>
|
|
|
833388
833782
|
if (!options.agentId) {
|
|
833389
833783
|
headlessProfilerCheckpoint("api_request_sent");
|
|
833390
833784
|
}
|
|
833391
|
-
clientRequestId = getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl() ?
|
|
833785
|
+
clientRequestId = getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl() ? randomUUID56() : undefined;
|
|
833392
833786
|
const result = await anthropic.beta.messages.create({ ...params, stream: true }, {
|
|
833393
833787
|
signal,
|
|
833394
833788
|
...clientRequestId && {
|
|
@@ -833471,7 +833865,7 @@ To invoke any tool listed above, use ExecuteExtraTool with {"tool_name": "<name>
|
|
|
833471
833865
|
switch (part.type) {
|
|
833472
833866
|
case "message_start": {
|
|
833473
833867
|
partialMessage = part.message;
|
|
833474
|
-
messageUUID =
|
|
833868
|
+
messageUUID = randomUUID56();
|
|
833475
833869
|
ttftMs = Date.now() - start;
|
|
833476
833870
|
usage2 = updateUsage(usage2, part.message?.usage);
|
|
833477
833871
|
if (process.env.USER_TYPE === "sf" && "research" in part.message) {
|
|
@@ -833642,7 +834036,7 @@ To invoke any tool listed above, use ExecuteExtraTool with {"tool_name": "<name>
|
|
|
833642
834036
|
},
|
|
833643
834037
|
requestId: streamRequestId ?? undefined,
|
|
833644
834038
|
type: "assistant",
|
|
833645
|
-
uuid: messageUUID ||
|
|
834039
|
+
uuid: messageUUID || randomUUID56(),
|
|
833646
834040
|
timestamp: new Date().toISOString(),
|
|
833647
834041
|
...process.env.USER_TYPE === "sf" && research !== undefined && { research },
|
|
833648
834042
|
...advisorModel && { advisorModel }
|
|
@@ -833833,7 +834227,7 @@ To invoke any tool listed above, use ExecuteExtraTool with {"tool_name": "<name>
|
|
|
833833
834227
|
},
|
|
833834
834228
|
requestId: streamRequestId ?? undefined,
|
|
833835
834229
|
type: "assistant",
|
|
833836
|
-
uuid:
|
|
834230
|
+
uuid: randomUUID56(),
|
|
833837
834231
|
timestamp: new Date().toISOString(),
|
|
833838
834232
|
...process.env.USER_TYPE === "sf" && research !== undefined && {
|
|
833839
834233
|
research
|
|
@@ -833890,7 +834284,7 @@ To invoke any tool listed above, use ExecuteExtraTool with {"tool_name": "<name>
|
|
|
833890
834284
|
},
|
|
833891
834285
|
requestId: streamRequestId ?? undefined,
|
|
833892
834286
|
type: "assistant",
|
|
833893
|
-
uuid:
|
|
834287
|
+
uuid: randomUUID56(),
|
|
833894
834288
|
timestamp: new Date().toISOString(),
|
|
833895
834289
|
...process.env.USER_TYPE === "sf" && research !== undefined && { research },
|
|
833896
834290
|
...advisorModel && { advisorModel }
|
|
@@ -834545,7 +834939,7 @@ async function sideQuery(opts) {
|
|
|
834545
834939
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
834546
834940
|
}
|
|
834547
834941
|
const messageText = extractFirstUserMessageText(messages);
|
|
834548
|
-
const fingerprint = computeFingerprint(messageText, "4.2.8
|
|
834942
|
+
const fingerprint = computeFingerprint(messageText, "4.2.8");
|
|
834549
834943
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
834550
834944
|
const systemBlocks = [
|
|
834551
834945
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -837333,9 +837727,9 @@ function matchesKeepGoingKeyword(input4) {
|
|
|
837333
837727
|
}
|
|
837334
837728
|
|
|
837335
837729
|
// src/utils/processUserInput/processTextPrompt.ts
|
|
837336
|
-
import { randomUUID as
|
|
837730
|
+
import { randomUUID as randomUUID57 } from "crypto";
|
|
837337
837731
|
function processTextPrompt(input4, imageContentBlocks, imagePasteIds, attachmentMessages, uuid9, permissionMode, isMeta) {
|
|
837338
|
-
const promptId =
|
|
837732
|
+
const promptId = randomUUID57();
|
|
837339
837733
|
setPromptId(promptId);
|
|
837340
837734
|
const userPromptText = typeof input4 === "string" ? input4 : input4.find((block) => block.type === "text")?.text || "";
|
|
837341
837735
|
startInteractionSpan(userPromptText);
|
|
@@ -837432,7 +837826,7 @@ var exports_processBashCommand = {};
|
|
|
837432
837826
|
__export(exports_processBashCommand, {
|
|
837433
837827
|
processBashCommand: () => processBashCommand
|
|
837434
837828
|
});
|
|
837435
|
-
import { randomUUID as
|
|
837829
|
+
import { randomUUID as randomUUID58 } from "crypto";
|
|
837436
837830
|
async function processBashCommand(inputString, precedingInputBlocks, attachmentMessages, context26, setToolJSX) {
|
|
837437
837831
|
const command11 = getValueFromInput(inputString);
|
|
837438
837832
|
const usePowerShell = isPowerShellToolEnabled() && resolveDefaultShell() === "powershell";
|
|
@@ -837485,7 +837879,7 @@ async function processBashCommand(inputString, precedingInputBlocks, attachmentM
|
|
|
837485
837879
|
throw new Error("No result received from shell command");
|
|
837486
837880
|
}
|
|
837487
837881
|
const stderr = data.stderr;
|
|
837488
|
-
const mapped = await processToolResultBlock(shellTool, { ...data, stderr: "" },
|
|
837882
|
+
const mapped = await processToolResultBlock(shellTool, { ...data, stderr: "" }, randomUUID58());
|
|
837489
837883
|
const stdout = typeof mapped.content === "string" ? mapped.content : escapeXml(data.stdout);
|
|
837490
837884
|
return {
|
|
837491
837885
|
messages: [
|
|
@@ -837553,7 +837947,7 @@ var init_processBashCommand = __esm(() => {
|
|
|
837553
837947
|
});
|
|
837554
837948
|
|
|
837555
837949
|
// src/utils/processUserInput/processUserInput.ts
|
|
837556
|
-
import { randomUUID as
|
|
837950
|
+
import { randomUUID as randomUUID59 } from "crypto";
|
|
837557
837951
|
async function processUserInput({
|
|
837558
837952
|
input: input4,
|
|
837559
837953
|
preExpansionInput,
|
|
@@ -837616,7 +838010,7 @@ Original prompt: ${input4}`, "warning")
|
|
|
837616
838010
|
type: "hook_additional_context",
|
|
837617
838011
|
content: hookResult.additionalContexts.map(applyTruncation),
|
|
837618
838012
|
hookName: "UserPromptSubmit",
|
|
837619
|
-
toolUseID: `hook-${
|
|
838013
|
+
toolUseID: `hook-${randomUUID59()}`,
|
|
837620
838014
|
hookEvent: "UserPromptSubmit"
|
|
837621
838015
|
}));
|
|
837622
838016
|
}
|
|
@@ -837898,7 +838292,7 @@ var init_queryContext = __esm(() => {
|
|
|
837898
838292
|
});
|
|
837899
838293
|
|
|
837900
838294
|
// src/utils/messages/systemInit.ts
|
|
837901
|
-
import { randomUUID as
|
|
838295
|
+
import { randomUUID as randomUUID60 } from "crypto";
|
|
837902
838296
|
function sdkCompatToolName(name3) {
|
|
837903
838297
|
return name3 === AGENT_TOOL_NAME ? LEGACY_AGENT_TOOL_NAME : name3;
|
|
837904
838298
|
}
|
|
@@ -837920,7 +838314,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
837920
838314
|
slash_commands: inputs.commands.filter((c7) => c7.userInvocable !== false).map((c7) => c7.name),
|
|
837921
838315
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
837922
838316
|
betas: getSdkBetas(),
|
|
837923
|
-
claude_code_version: "4.2.8
|
|
838317
|
+
claude_code_version: "4.2.8",
|
|
837924
838318
|
output_style: outputStyle2,
|
|
837925
838319
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
837926
838320
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -837929,7 +838323,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
837929
838323
|
path: plugin2.path,
|
|
837930
838324
|
source: plugin2.source
|
|
837931
838325
|
})),
|
|
837932
|
-
uuid:
|
|
838326
|
+
uuid: randomUUID60()
|
|
837933
838327
|
};
|
|
837934
838328
|
if (false) {}
|
|
837935
838329
|
initMessage.fast_mode_state = getFastModeState(inputs.model, inputs.fastMode);
|
|
@@ -837952,7 +838346,7 @@ __export(exports_MessageSelector, {
|
|
|
837952
838346
|
messagesAfterAreOnlySynthetic: () => messagesAfterAreOnlySynthetic,
|
|
837953
838347
|
MessageSelector: () => MessageSelector
|
|
837954
838348
|
});
|
|
837955
|
-
import { randomUUID as
|
|
838349
|
+
import { randomUUID as randomUUID61 } from "crypto";
|
|
837956
838350
|
import * as path48 from "path";
|
|
837957
838351
|
function isTextBlock2(block) {
|
|
837958
838352
|
return block.type === "text";
|
|
@@ -837972,7 +838366,7 @@ function MessageSelector({
|
|
|
837972
838366
|
const fileHistory = useAppState((s) => s.fileHistory);
|
|
837973
838367
|
const [error99, setError] = import_react225.useState(undefined);
|
|
837974
838368
|
const isFileHistoryEnabled = fileHistoryEnabled();
|
|
837975
|
-
const currentUUID = import_react225.useMemo(
|
|
838369
|
+
const currentUUID = import_react225.useMemo(randomUUID61, []);
|
|
837976
838370
|
const messageOptions = import_react225.useMemo(() => [
|
|
837977
838371
|
...messages.filter(selectableUserMessagesFilter),
|
|
837978
838372
|
{
|
|
@@ -838734,7 +839128,7 @@ var init_MessageSelector = __esm(() => {
|
|
|
838734
839128
|
});
|
|
838735
839129
|
|
|
838736
839130
|
// src/QueryEngine.ts
|
|
838737
|
-
import { randomUUID as
|
|
839131
|
+
import { randomUUID as randomUUID62 } from "crypto";
|
|
838738
839132
|
|
|
838739
839133
|
class QueryEngine {
|
|
838740
839134
|
config;
|
|
@@ -839045,7 +839439,7 @@ class QueryEngine {
|
|
|
839045
839439
|
modelUsage: getModelUsage(),
|
|
839046
839440
|
permission_denials: this.permissionDenials,
|
|
839047
839441
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
839048
|
-
uuid:
|
|
839442
|
+
uuid: randomUUID62()
|
|
839049
839443
|
};
|
|
839050
839444
|
return;
|
|
839051
839445
|
}
|
|
@@ -839172,7 +839566,7 @@ class QueryEngine {
|
|
|
839172
839566
|
event,
|
|
839173
839567
|
session_id: getSessionId(),
|
|
839174
839568
|
parent_tool_use_id: null,
|
|
839175
|
-
uuid:
|
|
839569
|
+
uuid: randomUUID62()
|
|
839176
839570
|
};
|
|
839177
839571
|
break;
|
|
839178
839572
|
}
|
|
@@ -839206,7 +839600,7 @@ class QueryEngine {
|
|
|
839206
839600
|
modelUsage: getModelUsage(),
|
|
839207
839601
|
permission_denials: this.permissionDenials,
|
|
839208
839602
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
839209
|
-
uuid:
|
|
839603
|
+
uuid: randomUUID62(),
|
|
839210
839604
|
errors: [
|
|
839211
839605
|
`Reached maximum number of turns (${attachment.maxTurns})`
|
|
839212
839606
|
]
|
|
@@ -839307,7 +839701,7 @@ class QueryEngine {
|
|
|
839307
839701
|
modelUsage: getModelUsage(),
|
|
839308
839702
|
permission_denials: this.permissionDenials,
|
|
839309
839703
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
839310
|
-
uuid:
|
|
839704
|
+
uuid: randomUUID62(),
|
|
839311
839705
|
errors: [
|
|
839312
839706
|
`Reached maximum budget ($${maxBudgetUsd}). Increase the limit with --max-budget-usd or start a new session.`
|
|
839313
839707
|
]
|
|
@@ -839338,7 +839732,7 @@ class QueryEngine {
|
|
|
839338
839732
|
modelUsage: getModelUsage(),
|
|
839339
839733
|
permission_denials: this.permissionDenials,
|
|
839340
839734
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
839341
|
-
uuid:
|
|
839735
|
+
uuid: randomUUID62(),
|
|
839342
839736
|
errors: [
|
|
839343
839737
|
`Failed to provide valid structured output after ${maxRetries} attempts`
|
|
839344
839738
|
]
|
|
@@ -839371,7 +839765,7 @@ class QueryEngine {
|
|
|
839371
839765
|
modelUsage: getModelUsage(),
|
|
839372
839766
|
permission_denials: this.permissionDenials,
|
|
839373
839767
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
839374
|
-
uuid:
|
|
839768
|
+
uuid: randomUUID62(),
|
|
839375
839769
|
errors: (() => {
|
|
839376
839770
|
const all4 = getInMemoryErrors();
|
|
839377
839771
|
const start = errorLogWatermark ? all4.lastIndexOf(errorLogWatermark) + 1 : 0;
|
|
@@ -839408,7 +839802,7 @@ class QueryEngine {
|
|
|
839408
839802
|
permission_denials: this.permissionDenials,
|
|
839409
839803
|
structured_output: structuredOutputFromTool,
|
|
839410
839804
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
839411
|
-
uuid:
|
|
839805
|
+
uuid: randomUUID62()
|
|
839412
839806
|
};
|
|
839413
839807
|
}
|
|
839414
839808
|
interrupt() {
|
|
@@ -840698,7 +841092,7 @@ function formatResourceLink(name3, uri3) {
|
|
|
840698
841092
|
}
|
|
840699
841093
|
|
|
840700
841094
|
// src/services/acp/agent.ts
|
|
840701
|
-
import { randomUUID as
|
|
841095
|
+
import { randomUUID as randomUUID63 } from "crypto";
|
|
840702
841096
|
|
|
840703
841097
|
class AcpAgent {
|
|
840704
841098
|
conn;
|
|
@@ -840804,7 +841198,7 @@ class AcpAgent {
|
|
|
840804
841198
|
}
|
|
840805
841199
|
const promptCancelGeneration = session2.cancelGeneration;
|
|
840806
841200
|
if (session2.promptRunning) {
|
|
840807
|
-
const promptUuid =
|
|
841201
|
+
const promptUuid = randomUUID63();
|
|
840808
841202
|
const cancelled = await new Promise((resolve55) => {
|
|
840809
841203
|
session2.pendingQueue.push(promptUuid);
|
|
840810
841204
|
session2.pendingMessages.set(promptUuid, { resolve: resolve55 });
|
|
@@ -840917,7 +841311,7 @@ class AcpAgent {
|
|
|
840917
841311
|
}
|
|
840918
841312
|
async createSession(params, opts = {}) {
|
|
840919
841313
|
enableConfigs();
|
|
840920
|
-
const sessionId = opts.sessionId ??
|
|
841314
|
+
const sessionId = opts.sessionId ?? randomUUID63();
|
|
840921
841315
|
const cwd2 = params.cwd;
|
|
840922
841316
|
setOriginalCwd(cwd2);
|
|
840923
841317
|
const previousProcessCwd = process.cwd();
|
|
@@ -841814,7 +842208,7 @@ var init_media = __esm(() => {
|
|
|
841814
842208
|
});
|
|
841815
842209
|
|
|
841816
842210
|
// packages/weixin/src/send.ts
|
|
841817
|
-
import { randomUUID as
|
|
842211
|
+
import { randomUUID as randomUUID64 } from "crypto";
|
|
841818
842212
|
function stripCodeBlocks(text2) {
|
|
841819
842213
|
let result = "";
|
|
841820
842214
|
let i6 = 0;
|
|
@@ -841857,7 +842251,7 @@ function markdownToPlainText(text2) {
|
|
|
841857
842251
|
`).trim();
|
|
841858
842252
|
}
|
|
841859
842253
|
async function sendText2(params) {
|
|
841860
|
-
const clientId =
|
|
842254
|
+
const clientId = randomUUID64();
|
|
841861
842255
|
await sendMessage3(params.baseUrl, params.token, {
|
|
841862
842256
|
to_user_id: params.to,
|
|
841863
842257
|
from_user_id: "",
|
|
@@ -841877,7 +842271,7 @@ async function sendText2(params) {
|
|
|
841877
842271
|
async function sendItems(params) {
|
|
841878
842272
|
let lastClientId = "";
|
|
841879
842273
|
for (const item of params.items) {
|
|
841880
|
-
lastClientId =
|
|
842274
|
+
lastClientId = randomUUID64();
|
|
841881
842275
|
await sendMessage3(params.baseUrl, params.token, {
|
|
841882
842276
|
to_user_id: params.to,
|
|
841883
842277
|
from_user_id: "",
|
|
@@ -842769,7 +843163,7 @@ function appendToLog(path50, message2) {
|
|
|
842769
843163
|
cwd: getFsImplementation().cwd(),
|
|
842770
843164
|
userType: process.env.USER_TYPE,
|
|
842771
843165
|
sessionId: getSessionId(),
|
|
842772
|
-
version: "4.2.8
|
|
843166
|
+
version: "4.2.8"
|
|
842773
843167
|
};
|
|
842774
843168
|
getLogWriter(path50).write(messageWithTimestamp);
|
|
842775
843169
|
}
|
|
@@ -850864,7 +851258,7 @@ var init_FileEditToolDiff = __esm(() => {
|
|
|
850864
851258
|
});
|
|
850865
851259
|
|
|
850866
851260
|
// src/hooks/useDiffInIDE.ts
|
|
850867
|
-
import { randomUUID as
|
|
851261
|
+
import { randomUUID as randomUUID65 } from "crypto";
|
|
850868
851262
|
import { basename as basename57 } from "path";
|
|
850869
851263
|
function useDiffInIDE({
|
|
850870
851264
|
onChange,
|
|
@@ -850875,7 +851269,7 @@ function useDiffInIDE({
|
|
|
850875
851269
|
}) {
|
|
850876
851270
|
const isUnmounted = import_react241.useRef(false);
|
|
850877
851271
|
const [hasError, setHasError] = import_react241.useState(false);
|
|
850878
|
-
const sha = import_react241.useMemo(() =>
|
|
851272
|
+
const sha = import_react241.useMemo(() => randomUUID65().slice(0, 6), []);
|
|
850879
851273
|
const tabName = import_react241.useMemo(() => `\u273B [CoStrict] ${basename57(filePath)} (${sha}) \u29C9`, [filePath, sha]);
|
|
850880
851274
|
const shouldShowDiffInIDE = hasAccessToIDEExtensionDiffFeature(toolUseContext.options.mcpClients) && getGlobalConfig().diffTool === "auto" && !filePath.endsWith(".ipynb");
|
|
850881
851275
|
const ideName = getConnectedIdeName(toolUseContext.options.mcpClients) ?? "IDE";
|
|
@@ -861070,7 +861464,7 @@ var init_ThinkingToggle = __esm(() => {
|
|
|
861070
861464
|
});
|
|
861071
861465
|
|
|
861072
861466
|
// src/components/teams/TeamsDialog.tsx
|
|
861073
|
-
import { randomUUID as
|
|
861467
|
+
import { randomUUID as randomUUID66 } from "crypto";
|
|
861074
861468
|
function TeamsDialog({ initialTeams, onDone }) {
|
|
861075
861469
|
useRegisterOverlay("teams-dialog");
|
|
861076
861470
|
const setAppState = useSetAppState();
|
|
@@ -861464,7 +861858,7 @@ async function killTeammate(paneId, backendType, teamName, teammateId, teammateN
|
|
|
861464
861858
|
messages: [
|
|
861465
861859
|
...prev.inbox.messages,
|
|
861466
861860
|
{
|
|
861467
|
-
id:
|
|
861861
|
+
id: randomUUID66(),
|
|
861468
861862
|
from: "system",
|
|
861469
861863
|
text: jsonStringify({
|
|
861470
861864
|
type: "teammate_terminated",
|
|
@@ -863571,7 +863965,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
863571
863965
|
project_dir: getOriginalCwd(),
|
|
863572
863966
|
added_dirs: addedDirs
|
|
863573
863967
|
},
|
|
863574
|
-
version: "4.2.8
|
|
863968
|
+
version: "4.2.8",
|
|
863575
863969
|
output_style: {
|
|
863576
863970
|
name: outputStyleName
|
|
863577
863971
|
},
|
|
@@ -867661,11 +868055,11 @@ var init_PromptInput = __esm(() => {
|
|
|
867661
868055
|
});
|
|
867662
868056
|
|
|
867663
868057
|
// src/remote/remotePermissionBridge.ts
|
|
867664
|
-
import { randomUUID as
|
|
868058
|
+
import { randomUUID as randomUUID67 } from "crypto";
|
|
867665
868059
|
function createSyntheticAssistantMessage(request3, requestId2) {
|
|
867666
868060
|
return {
|
|
867667
868061
|
type: "assistant",
|
|
867668
|
-
uuid:
|
|
868062
|
+
uuid: randomUUID67(),
|
|
867669
868063
|
message: {
|
|
867670
868064
|
id: `remote-${requestId2}`,
|
|
867671
868065
|
type: "message",
|
|
@@ -868182,7 +868576,7 @@ var init_useDirectConnect = __esm(() => {
|
|
|
868182
868576
|
});
|
|
868183
868577
|
|
|
868184
868578
|
// src/hooks/useSSHSession.ts
|
|
868185
|
-
import { randomUUID as
|
|
868579
|
+
import { randomUUID as randomUUID68 } from "crypto";
|
|
868186
868580
|
function useSSHSession({
|
|
868187
868581
|
session: session2,
|
|
868188
868582
|
setMessages,
|
|
@@ -868280,7 +868674,7 @@ function useSSHSession({
|
|
|
868280
868674
|
subtype: "informational",
|
|
868281
868675
|
content: `SSH connection dropped \u2014 reconnecting (attempt ${attempt}/${max2})...`,
|
|
868282
868676
|
timestamp: new Date().toISOString(),
|
|
868283
|
-
uuid:
|
|
868677
|
+
uuid: randomUUID68(),
|
|
868284
868678
|
level: "warning"
|
|
868285
868679
|
};
|
|
868286
868680
|
setMessages((prev) => [...prev, msg]);
|
|
@@ -868385,7 +868779,7 @@ var init_sessionHistory = __esm(() => {
|
|
|
868385
868779
|
});
|
|
868386
868780
|
|
|
868387
868781
|
// src/hooks/useAssistantHistory.ts
|
|
868388
|
-
import { randomUUID as
|
|
868782
|
+
import { randomUUID as randomUUID69 } from "crypto";
|
|
868389
868783
|
function pageToMessages(page) {
|
|
868390
868784
|
const out = [];
|
|
868391
868785
|
for (const ev of page.events) {
|
|
@@ -868410,7 +868804,7 @@ function useAssistantHistory({
|
|
|
868410
868804
|
const inflightRef = import_react295.useRef(false);
|
|
868411
868805
|
const anchorRef = import_react295.useRef(null);
|
|
868412
868806
|
const fillBudgetRef = import_react295.useRef(0);
|
|
868413
|
-
const sentinelUuidRef = import_react295.useRef(
|
|
868807
|
+
const sentinelUuidRef = import_react295.useRef(randomUUID69());
|
|
868414
868808
|
function mkSentinel(text2) {
|
|
868415
868809
|
return {
|
|
868416
868810
|
type: "system",
|
|
@@ -878657,7 +879051,7 @@ var init_coordinatorHandler = __esm(() => {
|
|
|
878657
879051
|
});
|
|
878658
879052
|
|
|
878659
879053
|
// src/utils/pipePermissionRelay.ts
|
|
878660
|
-
import { randomUUID as
|
|
879054
|
+
import { randomUUID as randomUUID70 } from "crypto";
|
|
878661
879055
|
function getPipeSender() {
|
|
878662
879056
|
return _pipeRelay ?? null;
|
|
878663
879057
|
}
|
|
@@ -878667,7 +879061,7 @@ function tryRelayPipePermissionRequest(toolUseConfirm, onResponse2) {
|
|
|
878667
879061
|
const send = getPipeSender();
|
|
878668
879062
|
if (!send)
|
|
878669
879063
|
return null;
|
|
878670
|
-
const requestId2 =
|
|
879064
|
+
const requestId2 = randomUUID70();
|
|
878671
879065
|
const payload = {
|
|
878672
879066
|
requestId: requestId2,
|
|
878673
879067
|
toolName: toolUseConfirm.tool.name,
|
|
@@ -881031,7 +881425,7 @@ var init_inboxPollerIdentity = __esm(() => {
|
|
|
881031
881425
|
});
|
|
881032
881426
|
|
|
881033
881427
|
// src/hooks/useInboxPoller.ts
|
|
881034
|
-
import { randomUUID as
|
|
881428
|
+
import { randomUUID as randomUUID71 } from "crypto";
|
|
881035
881429
|
function useInboxPoller({
|
|
881036
881430
|
enabled: enabled2,
|
|
881037
881431
|
isLoading,
|
|
@@ -881435,7 +881829,7 @@ function useInboxPoller({
|
|
|
881435
881829
|
messages: [
|
|
881436
881830
|
...prev.inbox.messages,
|
|
881437
881831
|
{
|
|
881438
|
-
id:
|
|
881832
|
+
id: randomUUID71(),
|
|
881439
881833
|
from: "system",
|
|
881440
881834
|
text: jsonStringify({
|
|
881441
881835
|
type: "teammate_terminated",
|
|
@@ -881475,7 +881869,7 @@ ${messageContent}
|
|
|
881475
881869
|
messages: [
|
|
881476
881870
|
...prev.inbox.messages,
|
|
881477
881871
|
...regularMessages.map((m3) => ({
|
|
881478
|
-
id:
|
|
881872
|
+
id: randomUUID71(),
|
|
881479
881873
|
from: m3.from,
|
|
881480
881874
|
text: m3.text,
|
|
881481
881875
|
timestamp: m3.timestamp,
|
|
@@ -882150,7 +882544,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
882150
882544
|
} catch {}
|
|
882151
882545
|
const data = {
|
|
882152
882546
|
trigger,
|
|
882153
|
-
version: "4.2.8
|
|
882547
|
+
version: "4.2.8",
|
|
882154
882548
|
platform: process.platform,
|
|
882155
882549
|
transcript,
|
|
882156
882550
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -882201,7 +882595,7 @@ var init_submitTranscriptShare = __esm(() => {
|
|
|
882201
882595
|
});
|
|
882202
882596
|
|
|
882203
882597
|
// src/components/FeedbackSurvey/useSurveyState.tsx
|
|
882204
|
-
import { randomUUID as
|
|
882598
|
+
import { randomUUID as randomUUID72 } from "crypto";
|
|
882205
882599
|
function useSurveyState({
|
|
882206
882600
|
hideThanksAfterMs,
|
|
882207
882601
|
onOpen,
|
|
@@ -882212,7 +882606,7 @@ function useSurveyState({
|
|
|
882212
882606
|
}) {
|
|
882213
882607
|
const [state4, setState] = import_react324.useState("closed");
|
|
882214
882608
|
const [lastResponse, setLastResponse] = import_react324.useState(null);
|
|
882215
|
-
const appearanceId = import_react324.useRef(
|
|
882609
|
+
const appearanceId = import_react324.useRef(randomUUID72());
|
|
882216
882610
|
const lastResponseRef = import_react324.useRef(null);
|
|
882217
882611
|
const showThanksThenClose = import_react324.useCallback(() => {
|
|
882218
882612
|
setState("thanks");
|
|
@@ -882230,7 +882624,7 @@ function useSurveyState({
|
|
|
882230
882624
|
return;
|
|
882231
882625
|
}
|
|
882232
882626
|
setState("open");
|
|
882233
|
-
appearanceId.current =
|
|
882627
|
+
appearanceId.current = randomUUID72();
|
|
882234
882628
|
onOpen(appearanceId.current);
|
|
882235
882629
|
}, [state4, onOpen]);
|
|
882236
882630
|
const handleSelect = import_react324.useCallback((selected) => {
|
|
@@ -883405,7 +883799,7 @@ function getReleaseType(current2, latest) {
|
|
|
883405
883799
|
return "patch";
|
|
883406
883800
|
}
|
|
883407
883801
|
async function checkNewAutoUpdate(callbacks) {
|
|
883408
|
-
const currentVersion = "4.2.8
|
|
883802
|
+
const currentVersion = "4.2.8";
|
|
883409
883803
|
logForDebugging(`[newAutoUpdater] checking, current: ${currentVersion}`);
|
|
883410
883804
|
if (isNewAutoUpdaterDisabled()) {
|
|
883411
883805
|
return { action: "skip", currentVersion, latestVersion: null };
|
|
@@ -884975,21 +885369,21 @@ function extractLspInfoFromManifest(lspServers) {
|
|
|
884975
885369
|
}
|
|
884976
885370
|
return extractFromServerConfigRecord(lspServers);
|
|
884977
885371
|
}
|
|
884978
|
-
function
|
|
885372
|
+
function isRecord8(value) {
|
|
884979
885373
|
return typeof value === "object" && value !== null;
|
|
884980
885374
|
}
|
|
884981
885375
|
function extractFromServerConfigRecord(serverConfigs) {
|
|
884982
885376
|
const extensions5 = new Set;
|
|
884983
885377
|
let command11 = null;
|
|
884984
885378
|
for (const [_serverName, config11] of Object.entries(serverConfigs)) {
|
|
884985
|
-
if (!
|
|
885379
|
+
if (!isRecord8(config11)) {
|
|
884986
885380
|
continue;
|
|
884987
885381
|
}
|
|
884988
885382
|
if (!command11 && typeof config11.command === "string") {
|
|
884989
885383
|
command11 = config11.command;
|
|
884990
885384
|
}
|
|
884991
885385
|
const extMapping = config11.extensionToLanguage;
|
|
884992
|
-
if (
|
|
885386
|
+
if (isRecord8(extMapping)) {
|
|
884993
885387
|
for (const ext of Object.keys(extMapping)) {
|
|
884994
885388
|
extensions5.add(ext.toLowerCase());
|
|
884995
885389
|
}
|
|
@@ -889797,7 +890191,7 @@ import { spawnSync as spawnSync9 } from "child_process";
|
|
|
889797
890191
|
import { dirname as dirname84, join as join216 } from "path";
|
|
889798
890192
|
import { tmpdir as tmpdir21 } from "os";
|
|
889799
890193
|
import { writeFile as writeFile75 } from "fs/promises";
|
|
889800
|
-
import { randomUUID as
|
|
890194
|
+
import { randomUUID as randomUUID73 } from "crypto";
|
|
889801
890195
|
function median(values4) {
|
|
889802
890196
|
const sorted = [...values4].sort((a5, b6) => a5 - b6);
|
|
889803
890197
|
const mid = Math.floor(sorted.length / 2);
|
|
@@ -890487,7 +890881,7 @@ function REPL({
|
|
|
890487
890881
|
const [isMessageSelectorVisible, setIsMessageSelectorVisible] = import_react356.useState(false);
|
|
890488
890882
|
const [messageSelectorPreselect, setMessageSelectorPreselect] = import_react356.useState(undefined);
|
|
890489
890883
|
const [showCostDialog, setShowCostDialog] = import_react356.useState(false);
|
|
890490
|
-
const [conversationId, setConversationId2] = import_react356.useState(
|
|
890884
|
+
const [conversationId, setConversationId2] = import_react356.useState(randomUUID73());
|
|
890491
890885
|
const [idleReturnPending, setIdleReturnPending] = import_react356.useState(null);
|
|
890492
890886
|
const skipIdleCheckRef = import_react356.useRef(false);
|
|
890493
890887
|
const lastQueryCompletionTimeRef = import_react356.useRef(lastQueryCompletionTime);
|
|
@@ -891243,7 +891637,7 @@ ${t("repl.sandboxRequired", { reason })}
|
|
|
891243
891637
|
} else {
|
|
891244
891638
|
setMessages(() => [newMessage]);
|
|
891245
891639
|
}
|
|
891246
|
-
setConversationId2(
|
|
891640
|
+
setConversationId2(randomUUID73());
|
|
891247
891641
|
if (true) {
|
|
891248
891642
|
proactiveModule8?.setContextBlocked(false);
|
|
891249
891643
|
}
|
|
@@ -891334,7 +891728,7 @@ ${t("repl.sandboxRequired", { reason })}
|
|
|
891334
891728
|
});
|
|
891335
891729
|
if (!shouldQuery) {
|
|
891336
891730
|
if (newMessages.some(isCompactBoundaryMessage)) {
|
|
891337
|
-
setConversationId2(
|
|
891731
|
+
setConversationId2(randomUUID73());
|
|
891338
891732
|
if (true) {
|
|
891339
891733
|
proactiveModule8?.setContextBlocked(false);
|
|
891340
891734
|
}
|
|
@@ -892017,7 +892411,7 @@ ${t("repl.sandboxRequired", { reason })}
|
|
|
892017
892411
|
rewindToMessageIndex: messageIndex
|
|
892018
892412
|
});
|
|
892019
892413
|
setMessages(prev.slice(0, messageIndex));
|
|
892020
|
-
setConversationId2(
|
|
892414
|
+
setConversationId2(randomUUID73());
|
|
892021
892415
|
resetMicrocompactState();
|
|
892022
892416
|
if (false) {}
|
|
892023
892417
|
const permMode = message2.permissionMode;
|
|
@@ -893403,7 +893797,7 @@ ${t("repl.suspended")}
|
|
|
893403
893797
|
if (true) {
|
|
893404
893798
|
proactiveModule8?.setContextBlocked(false);
|
|
893405
893799
|
}
|
|
893406
|
-
setConversationId2(
|
|
893800
|
+
setConversationId2(randomUUID73());
|
|
893407
893801
|
runPostCompactCleanup(context26.options.querySource);
|
|
893408
893802
|
if (direction === "from") {
|
|
893409
893803
|
const r4 = textForResubmit(message2);
|
|
@@ -894281,7 +894675,7 @@ function WelcomeV2() {
|
|
|
894281
894675
|
dimColor: true,
|
|
894282
894676
|
children: [
|
|
894283
894677
|
"v",
|
|
894284
|
-
"4.2.8
|
|
894678
|
+
"4.2.8",
|
|
894285
894679
|
" "
|
|
894286
894680
|
]
|
|
894287
894681
|
})
|
|
@@ -894347,7 +894741,7 @@ function WelcomeV2() {
|
|
|
894347
894741
|
dimColor: true,
|
|
894348
894742
|
children: [
|
|
894349
894743
|
"v",
|
|
894350
|
-
"4.2.8
|
|
894744
|
+
"4.2.8",
|
|
894351
894745
|
" "
|
|
894352
894746
|
]
|
|
894353
894747
|
})
|
|
@@ -894449,7 +894843,7 @@ function AppleTerminalWelcomeV2({ theme: theme2, welcomeMessage }) {
|
|
|
894449
894843
|
dimColor: true,
|
|
894450
894844
|
children: [
|
|
894451
894845
|
"v",
|
|
894452
|
-
"4.2.8
|
|
894846
|
+
"4.2.8",
|
|
894453
894847
|
" "
|
|
894454
894848
|
]
|
|
894455
894849
|
})
|
|
@@ -894515,7 +894909,7 @@ function AppleTerminalWelcomeV2({ theme: theme2, welcomeMessage }) {
|
|
|
894515
894909
|
dimColor: true,
|
|
894516
894910
|
children: [
|
|
894517
894911
|
"v",
|
|
894518
|
-
"4.2.8
|
|
894912
|
+
"4.2.8",
|
|
894519
894913
|
" "
|
|
894520
894914
|
]
|
|
894521
894915
|
})
|
|
@@ -895455,7 +895849,7 @@ function completeOnboarding() {
|
|
|
895455
895849
|
saveGlobalConfig((current2) => ({
|
|
895456
895850
|
...current2,
|
|
895457
895851
|
hasCompletedOnboarding: true,
|
|
895458
|
-
lastOnboardingVersion: "4.2.8
|
|
895852
|
+
lastOnboardingVersion: "4.2.8"
|
|
895459
895853
|
}));
|
|
895460
895854
|
}
|
|
895461
895855
|
function showDialog(root6, renderer) {
|
|
@@ -896834,7 +897228,7 @@ function registerWeixinBuiltinPlugin() {
|
|
|
896834
897228
|
registerBuiltinPlugin({
|
|
896835
897229
|
name: "weixin",
|
|
896836
897230
|
description: "WeChat channel integration. Enables inbound WeChat messages via channels and provides reply/send_typing MCP tools. Configure with `ccb weixin login` and enable for a session with `--channels plugin:weixin@builtin`.",
|
|
896837
|
-
version: "4.2.8
|
|
897231
|
+
version: "4.2.8",
|
|
896838
897232
|
defaultEnabled: true,
|
|
896839
897233
|
mcpServers: {
|
|
896840
897234
|
weixin: {
|
|
@@ -900435,7 +900829,7 @@ var init_resetProToOpusDefault = __esm(() => {
|
|
|
900435
900829
|
});
|
|
900436
900830
|
|
|
900437
900831
|
// src/remote/SessionsWebSocket.ts
|
|
900438
|
-
import { randomUUID as
|
|
900832
|
+
import { randomUUID as randomUUID74 } from "crypto";
|
|
900439
900833
|
function isSessionsMessage(value) {
|
|
900440
900834
|
if (typeof value !== "object" || value === null || !("type" in value)) {
|
|
900441
900835
|
return false;
|
|
@@ -900619,7 +901013,7 @@ class SessionsWebSocket {
|
|
|
900619
901013
|
}
|
|
900620
901014
|
const controlRequest = {
|
|
900621
901015
|
type: "control_request",
|
|
900622
|
-
request_id:
|
|
901016
|
+
request_id: randomUUID74(),
|
|
900623
901017
|
request: request3
|
|
900624
901018
|
};
|
|
900625
901019
|
logForDebugging(`[SessionsWebSocket] Sending control request: ${request3.subtype}`);
|
|
@@ -902755,7 +903149,7 @@ var init_ndjsonSafeStringify = __esm(() => {
|
|
|
902755
903149
|
});
|
|
902756
903150
|
|
|
902757
903151
|
// src/cli/structuredIO.ts
|
|
902758
|
-
import { randomUUID as
|
|
903152
|
+
import { randomUUID as randomUUID75 } from "crypto";
|
|
902759
903153
|
function serializeDecisionReason(reason) {
|
|
902760
903154
|
if (!reason) {
|
|
902761
903155
|
return;
|
|
@@ -903011,7 +903405,7 @@ class StructuredIO {
|
|
|
903011
903405
|
writeToStdout(ndjsonSafeStringify(message2) + `
|
|
903012
903406
|
`);
|
|
903013
903407
|
}
|
|
903014
|
-
async sendRequest(request3, schema2, signal, requestId2 =
|
|
903408
|
+
async sendRequest(request3, schema2, signal, requestId2 = randomUUID75()) {
|
|
903015
903409
|
const message2 = {
|
|
903016
903410
|
type: "control_request",
|
|
903017
903411
|
request_id: requestId2,
|
|
@@ -903077,7 +903471,7 @@ class StructuredIO {
|
|
|
903077
903471
|
parentSignal.addEventListener("abort", onParentAbort, { once: true });
|
|
903078
903472
|
try {
|
|
903079
903473
|
const hookPromise = executePermissionRequestHooksForSDK(tool.name, toolUseID, input4, toolUseContext, mainPermissionResult.suggestions).then((decision) => ({ source: "hook", decision }));
|
|
903080
|
-
const requestId2 =
|
|
903474
|
+
const requestId2 = randomUUID75();
|
|
903081
903475
|
onPermissionPrompt?.(buildRequiresActionDetails(tool, input4, toolUseID, requestId2));
|
|
903082
903476
|
const sdkPromise = this.sendRequest({
|
|
903083
903477
|
subtype: "can_use_tool",
|
|
@@ -903157,7 +903551,7 @@ class StructuredIO {
|
|
|
903157
903551
|
subtype: "can_use_tool",
|
|
903158
903552
|
tool_name: SANDBOX_NETWORK_ACCESS_TOOL_NAME,
|
|
903159
903553
|
input: { host: hostPattern.host },
|
|
903160
|
-
tool_use_id:
|
|
903554
|
+
tool_use_id: randomUUID75(),
|
|
903161
903555
|
description: `Allow network connection to ${hostPattern.host}?`
|
|
903162
903556
|
}, outputSchema41());
|
|
903163
903557
|
return result.behavior === "allow";
|
|
@@ -903471,7 +903865,7 @@ function coalescePatches(base2, overlay) {
|
|
|
903471
903865
|
var init_WorkerStateUploader = () => {};
|
|
903472
903866
|
|
|
903473
903867
|
// src/cli/transports/ccrClient.ts
|
|
903474
|
-
import { randomUUID as
|
|
903868
|
+
import { randomUUID as randomUUID76 } from "crypto";
|
|
903475
903869
|
function alwaysValidStatus2() {
|
|
903476
903870
|
return true;
|
|
903477
903871
|
}
|
|
@@ -903843,7 +904237,7 @@ class CCRClient {
|
|
|
903843
904237
|
return {
|
|
903844
904238
|
payload: {
|
|
903845
904239
|
...msg,
|
|
903846
|
-
uuid: typeof msg.uuid === "string" ? msg.uuid :
|
|
904240
|
+
uuid: typeof msg.uuid === "string" ? msg.uuid : randomUUID76()
|
|
903847
904241
|
}
|
|
903848
904242
|
};
|
|
903849
904243
|
}
|
|
@@ -903867,7 +904261,7 @@ class CCRClient {
|
|
|
903867
904261
|
payload: {
|
|
903868
904262
|
type: eventType,
|
|
903869
904263
|
...payload,
|
|
903870
|
-
uuid: typeof payload.uuid === "string" ? payload.uuid :
|
|
904264
|
+
uuid: typeof payload.uuid === "string" ? payload.uuid : randomUUID76()
|
|
903871
904265
|
},
|
|
903872
904266
|
...isCompaction && { is_compaction: true },
|
|
903873
904267
|
...agentId && { agent_id: agentId }
|
|
@@ -904927,11 +905321,11 @@ var init_idleTimeout = __esm(() => {
|
|
|
904927
905321
|
});
|
|
904928
905322
|
|
|
904929
905323
|
// src/utils/sessionUrl.ts
|
|
904930
|
-
import { randomUUID as
|
|
905324
|
+
import { randomUUID as randomUUID77 } from "crypto";
|
|
904931
905325
|
function parseSessionIdentifier(resumeIdentifier) {
|
|
904932
905326
|
if (resumeIdentifier.toLowerCase().endsWith(".jsonl")) {
|
|
904933
905327
|
return {
|
|
904934
|
-
sessionId:
|
|
905328
|
+
sessionId: randomUUID77(),
|
|
904935
905329
|
ingressUrl: null,
|
|
904936
905330
|
isUrl: false,
|
|
904937
905331
|
jsonlFile: resumeIdentifier,
|
|
@@ -904950,7 +905344,7 @@ function parseSessionIdentifier(resumeIdentifier) {
|
|
|
904950
905344
|
try {
|
|
904951
905345
|
const url5 = new URL(resumeIdentifier);
|
|
904952
905346
|
return {
|
|
904953
|
-
sessionId:
|
|
905347
|
+
sessionId: randomUUID77(),
|
|
904954
905348
|
ingressUrl: url5.href,
|
|
904955
905349
|
isUrl: true,
|
|
904956
905350
|
jsonlFile: null,
|
|
@@ -905134,7 +905528,7 @@ __export(exports_print, {
|
|
|
905134
905528
|
import { readFile as readFile83, stat as stat55 } from "fs/promises";
|
|
905135
905529
|
import { dirname as dirname86 } from "path";
|
|
905136
905530
|
import { cwd as cwd2 } from "process";
|
|
905137
|
-
import { randomUUID as
|
|
905531
|
+
import { randomUUID as randomUUID78 } from "crypto";
|
|
905138
905532
|
function trackReceivedMessageUuid(uuid9) {
|
|
905139
905533
|
if (receivedMessageUuids.has(uuid9)) {
|
|
905140
905534
|
return false;
|
|
@@ -905259,7 +905653,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
|
|
|
905259
905653
|
hook_id: event.hookId,
|
|
905260
905654
|
hook_name: event.hookName,
|
|
905261
905655
|
hook_event: event.hookEvent,
|
|
905262
|
-
uuid:
|
|
905656
|
+
uuid: randomUUID78(),
|
|
905263
905657
|
session_id: getSessionId()
|
|
905264
905658
|
};
|
|
905265
905659
|
case "progress":
|
|
@@ -905272,7 +905666,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
|
|
|
905272
905666
|
stdout: event.stdout,
|
|
905273
905667
|
stderr: event.stderr,
|
|
905274
905668
|
output: event.output,
|
|
905275
|
-
uuid:
|
|
905669
|
+
uuid: randomUUID78(),
|
|
905276
905670
|
session_id: getSessionId()
|
|
905277
905671
|
};
|
|
905278
905672
|
case "response":
|
|
@@ -905287,7 +905681,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
|
|
|
905287
905681
|
stderr: event.stderr,
|
|
905288
905682
|
exit_code: event.exitCode,
|
|
905289
905683
|
outcome: event.outcome,
|
|
905290
|
-
uuid:
|
|
905684
|
+
uuid: randomUUID78(),
|
|
905291
905685
|
session_id: getSessionId()
|
|
905292
905686
|
};
|
|
905293
905687
|
}
|
|
@@ -905504,7 +905898,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
905504
905898
|
subtype: "status",
|
|
905505
905899
|
status: null,
|
|
905506
905900
|
permissionMode: newMode,
|
|
905507
|
-
uuid:
|
|
905901
|
+
uuid: randomUUID78(),
|
|
905508
905902
|
session_id: getSessionId()
|
|
905509
905903
|
});
|
|
905510
905904
|
}
|
|
@@ -905525,7 +905919,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
905525
905919
|
isAuthenticating: status2.isAuthenticating,
|
|
905526
905920
|
output: status2.output,
|
|
905527
905921
|
error: status2.error,
|
|
905528
|
-
uuid:
|
|
905922
|
+
uuid: randomUUID78(),
|
|
905529
905923
|
session_id: getSessionId()
|
|
905530
905924
|
});
|
|
905531
905925
|
});
|
|
@@ -905536,7 +905930,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
905536
905930
|
output.enqueue({
|
|
905537
905931
|
type: "rate_limit_event",
|
|
905538
905932
|
rate_limit_info: rateLimitInfo,
|
|
905539
|
-
uuid:
|
|
905933
|
+
uuid: randomUUID78(),
|
|
905540
905934
|
session_id: getSessionId()
|
|
905541
905935
|
});
|
|
905542
905936
|
}
|
|
@@ -905552,7 +905946,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
905552
905946
|
enqueue({
|
|
905553
905947
|
mode: "prompt",
|
|
905554
905948
|
value: turnInterruptionState.message.message.content,
|
|
905555
|
-
uuid:
|
|
905949
|
+
uuid: randomUUID78()
|
|
905556
905950
|
});
|
|
905557
905951
|
}
|
|
905558
905952
|
const modelOptions = getModelOptions();
|
|
@@ -905656,7 +906050,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
905656
906050
|
subtype: "elicitation_complete",
|
|
905657
906051
|
mcp_server_name: serverName,
|
|
905658
906052
|
elicitation_id: elicitationId,
|
|
905659
|
-
uuid:
|
|
906053
|
+
uuid: randomUUID78(),
|
|
905660
906054
|
session_id: getSessionId()
|
|
905661
906055
|
});
|
|
905662
906056
|
});
|
|
@@ -905899,7 +906293,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
905899
906293
|
for (const command11 of commands8) {
|
|
905900
906294
|
enqueue({
|
|
905901
906295
|
...command11,
|
|
905902
|
-
uuid:
|
|
906296
|
+
uuid: randomUUID78()
|
|
905903
906297
|
});
|
|
905904
906298
|
}
|
|
905905
906299
|
run4();
|
|
@@ -906038,7 +906432,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
906038
906432
|
duration_ms: durationMsMatch ? parseInt(durationMsMatch[1], 10) : 0
|
|
906039
906433
|
} : undefined,
|
|
906040
906434
|
session_id: getSessionId(),
|
|
906041
|
-
uuid:
|
|
906435
|
+
uuid: randomUUID78()
|
|
906042
906436
|
});
|
|
906043
906437
|
}
|
|
906044
906438
|
}
|
|
@@ -906112,7 +906506,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
906112
906506
|
subtype: "status",
|
|
906113
906507
|
status: status2,
|
|
906114
906508
|
session_id: getSessionId(),
|
|
906115
|
-
uuid:
|
|
906509
|
+
uuid: randomUUID78()
|
|
906116
906510
|
});
|
|
906117
906511
|
}
|
|
906118
906512
|
})) {
|
|
@@ -906158,7 +906552,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
906158
906552
|
for (const nextCommand of nextCommands) {
|
|
906159
906553
|
enqueue({
|
|
906160
906554
|
...nextCommand,
|
|
906161
|
-
uuid:
|
|
906555
|
+
uuid: randomUUID78()
|
|
906162
906556
|
});
|
|
906163
906557
|
}
|
|
906164
906558
|
}
|
|
@@ -906194,7 +906588,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
906194
906588
|
const suggestionMsg = {
|
|
906195
906589
|
type: "prompt_suggestion",
|
|
906196
906590
|
suggestion: result.suggestion,
|
|
906197
|
-
uuid:
|
|
906591
|
+
uuid: randomUUID78(),
|
|
906198
906592
|
session_id: getSessionId()
|
|
906199
906593
|
};
|
|
906200
906594
|
const lastEmittedEntry = {
|
|
@@ -906284,7 +906678,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
906284
906678
|
usage: EMPTY_USAGE,
|
|
906285
906679
|
modelUsage: {},
|
|
906286
906680
|
permission_denials: [],
|
|
906287
|
-
uuid:
|
|
906681
|
+
uuid: randomUUID78(),
|
|
906288
906682
|
errors: [
|
|
906289
906683
|
errorMessage(error99),
|
|
906290
906684
|
...getInMemoryErrors().map((_2) => _2.error)
|
|
@@ -906373,7 +906767,7 @@ ${m3.text}
|
|
|
906373
906767
|
enqueue({
|
|
906374
906768
|
mode: "prompt",
|
|
906375
906769
|
value: formatted,
|
|
906376
|
-
uuid:
|
|
906770
|
+
uuid: randomUUID78()
|
|
906377
906771
|
});
|
|
906378
906772
|
run4();
|
|
906379
906773
|
return;
|
|
@@ -906384,7 +906778,7 @@ ${m3.text}
|
|
|
906384
906778
|
enqueue({
|
|
906385
906779
|
mode: "prompt",
|
|
906386
906780
|
value: SHUTDOWN_TEAM_PROMPT,
|
|
906387
|
-
uuid:
|
|
906781
|
+
uuid: randomUUID78()
|
|
906388
906782
|
});
|
|
906389
906783
|
run4();
|
|
906390
906784
|
return;
|
|
@@ -906408,7 +906802,7 @@ ${m3.text}
|
|
|
906408
906802
|
enqueue({
|
|
906409
906803
|
mode: "prompt",
|
|
906410
906804
|
value: SHUTDOWN_TEAM_PROMPT,
|
|
906411
|
-
uuid:
|
|
906805
|
+
uuid: randomUUID78()
|
|
906412
906806
|
});
|
|
906413
906807
|
run4();
|
|
906414
906808
|
} else if (!process.env.CSC_SERVE_MODE) {
|
|
@@ -906456,7 +906850,7 @@ ${m3.text}
|
|
|
906456
906850
|
const enqueueAndRun = (command11) => {
|
|
906457
906851
|
enqueue({
|
|
906458
906852
|
...command11,
|
|
906459
|
-
uuid:
|
|
906853
|
+
uuid: randomUUID78()
|
|
906460
906854
|
});
|
|
906461
906855
|
run4();
|
|
906462
906856
|
};
|
|
@@ -907501,7 +907895,7 @@ async function handleInitializeRequest(request3, requestId2, initialized7, outpu
|
|
|
907501
907895
|
isAuthenticating: status2.isAuthenticating,
|
|
907502
907896
|
output: status2.output,
|
|
907503
907897
|
error: status2.error,
|
|
907504
|
-
uuid:
|
|
907898
|
+
uuid: randomUUID78(),
|
|
907505
907899
|
session_id: getSessionId()
|
|
907506
907900
|
});
|
|
907507
907901
|
}
|
|
@@ -907705,7 +908099,7 @@ function emitLoadError(message2, outputFormat) {
|
|
|
907705
908099
|
usage: EMPTY_USAGE,
|
|
907706
908100
|
modelUsage: {},
|
|
907707
908101
|
permission_denials: [],
|
|
907708
|
-
uuid:
|
|
908102
|
+
uuid: randomUUID78(),
|
|
907709
908103
|
errors: [message2]
|
|
907710
908104
|
};
|
|
907711
908105
|
process.stdout.write(jsonStringify(errorResult2) + `
|
|
@@ -908473,7 +908867,7 @@ var init_SSHSessionManager = __esm(() => {
|
|
|
908473
908867
|
});
|
|
908474
908868
|
|
|
908475
908869
|
// src/ssh/SSHAuthProxy.ts
|
|
908476
|
-
import { randomUUID as
|
|
908870
|
+
import { randomUUID as randomUUID79 } from "crypto";
|
|
908477
908871
|
import { unlinkSync as unlinkSync12 } from "fs";
|
|
908478
908872
|
function resolveAuthHeaders() {
|
|
908479
908873
|
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
@@ -908531,7 +908925,7 @@ async function proxyFetch(req, nonce) {
|
|
|
908531
908925
|
}
|
|
908532
908926
|
}
|
|
908533
908927
|
async function createAuthProxy() {
|
|
908534
|
-
const id =
|
|
908928
|
+
const id = randomUUID79();
|
|
908535
908929
|
if (isWindows3) {
|
|
908536
908930
|
return createTcpAuthProxy(id);
|
|
908537
908931
|
}
|
|
@@ -908559,7 +908953,7 @@ async function createUnixSocketAuthProxy(id) {
|
|
|
908559
908953
|
};
|
|
908560
908954
|
}
|
|
908561
908955
|
async function createTcpAuthProxy(id) {
|
|
908562
|
-
const nonce =
|
|
908956
|
+
const nonce = randomUUID79();
|
|
908563
908957
|
const server2 = Bun.serve({
|
|
908564
908958
|
port: 0,
|
|
908565
908959
|
hostname: "127.0.0.1",
|
|
@@ -908734,7 +909128,7 @@ __export(exports_createSSHSession, {
|
|
|
908734
909128
|
createLocalSSHSession: () => createLocalSSHSession,
|
|
908735
909129
|
SSHSessionError: () => SSHSessionError
|
|
908736
909130
|
});
|
|
908737
|
-
import { randomUUID as
|
|
909131
|
+
import { randomUUID as randomUUID80 } from "crypto";
|
|
908738
909132
|
async function createSSHSession(config11, callbacks) {
|
|
908739
909133
|
const { host, localVersion, extraCliArgs, remoteBin } = config11;
|
|
908740
909134
|
const onProgress = callbacks?.onProgress;
|
|
@@ -908773,7 +909167,7 @@ async function createSSHSession(config11, callbacks) {
|
|
|
908773
909167
|
}
|
|
908774
909168
|
const { proxy, localAddress, authEnv } = await createAuthProxy();
|
|
908775
909169
|
logForDebugging(`[SSH] auth proxy listening on ${localAddress}`);
|
|
908776
|
-
const remoteSocketId =
|
|
909170
|
+
const remoteSocketId = randomUUID80().slice(0, 8);
|
|
908777
909171
|
const isWindows4 = process.platform === "win32";
|
|
908778
909172
|
const remoteCli = [];
|
|
908779
909173
|
for (const [k5, v2] of Object.entries(authEnv)) {
|
|
@@ -909318,7 +909712,7 @@ async function startMCPServer(cwd3, debug5, verbose) {
|
|
|
909318
909712
|
setCwd(cwd3);
|
|
909319
909713
|
const server2 = new Server({
|
|
909320
909714
|
name: "claude/tengu",
|
|
909321
|
-
version: "4.2.8
|
|
909715
|
+
version: "4.2.8"
|
|
909322
909716
|
}, {
|
|
909323
909717
|
capabilities: {
|
|
909324
909718
|
tools: {}
|
|
@@ -911597,7 +911991,7 @@ function createHealthRoutes(sessionManager) {
|
|
|
911597
911991
|
const uptime2 = process.uptime() * 1000;
|
|
911598
911992
|
return c7.json({
|
|
911599
911993
|
status: "ok",
|
|
911600
|
-
version: "4.2.8
|
|
911994
|
+
version: "4.2.8",
|
|
911601
911995
|
uptime_ms: Math.round(uptime2),
|
|
911602
911996
|
active_sessions: sessionManager.getActiveCount()
|
|
911603
911997
|
});
|
|
@@ -911867,7 +912261,7 @@ function getMacroDefines() {
|
|
|
911867
912261
|
commit = execSync3("git rev-parse --short HEAD", { encoding: "utf-8", cwd: __dirname }).trim();
|
|
911868
912262
|
} catch {}
|
|
911869
912263
|
return {
|
|
911870
|
-
"MACRO.VERSION": JSON.stringify("4.2.8
|
|
912264
|
+
"MACRO.VERSION": JSON.stringify("4.2.8"),
|
|
911871
912265
|
"MACRO.BUILD_TIME": JSON.stringify(new Date().toISOString()),
|
|
911872
912266
|
"MACRO.COMMIT": JSON.stringify(commit),
|
|
911873
912267
|
"MACRO.FEEDBACK_CHANNEL": JSON.stringify(""),
|
|
@@ -913565,7 +913959,7 @@ var init_transcriptReader = __esm(() => {
|
|
|
913565
913959
|
});
|
|
913566
913960
|
|
|
913567
913961
|
// src/server/streamStateTracker.ts
|
|
913568
|
-
import { randomUUID as
|
|
913962
|
+
import { randomUUID as randomUUID81 } from "crypto";
|
|
913569
913963
|
function updateStreamUsage(state4, usage2) {
|
|
913570
913964
|
if (!usage2)
|
|
913571
913965
|
return;
|
|
@@ -913578,12 +913972,12 @@ function getOrCreate(sessionID) {
|
|
|
913578
913972
|
let state4 = states.get(sessionID);
|
|
913579
913973
|
if (!state4) {
|
|
913580
913974
|
state4 = {
|
|
913581
|
-
messageID:
|
|
913975
|
+
messageID: randomUUID81(),
|
|
913582
913976
|
parentID: "",
|
|
913583
913977
|
modelID: "",
|
|
913584
913978
|
timeCreated: Date.now(),
|
|
913585
913979
|
activeBlocks: new Map,
|
|
913586
|
-
stepStartPartID:
|
|
913980
|
+
stepStartPartID: randomUUID81(),
|
|
913587
913981
|
assistantPartEmitted: false,
|
|
913588
913982
|
usage: { inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 },
|
|
913589
913983
|
stopReason: ""
|
|
@@ -913630,7 +914024,7 @@ function processStreamEvent(sessionID, event) {
|
|
|
913630
914024
|
switch (eventType) {
|
|
913631
914025
|
case "message_start": {
|
|
913632
914026
|
const msg = event.message;
|
|
913633
|
-
state4.messageID = event._message_uuid ||
|
|
914027
|
+
state4.messageID = event._message_uuid || randomUUID81();
|
|
913634
914028
|
state4.modelID = msg?.model ?? "";
|
|
913635
914029
|
state4.usage = {
|
|
913636
914030
|
inputTokens: 0,
|
|
@@ -913655,7 +914049,7 @@ function processStreamEvent(sessionID, event) {
|
|
|
913655
914049
|
});
|
|
913656
914050
|
state4.assistantPartEmitted = true;
|
|
913657
914051
|
}
|
|
913658
|
-
state4.stepStartPartID =
|
|
914052
|
+
state4.stepStartPartID = randomUUID81();
|
|
913659
914053
|
results.push({
|
|
913660
914054
|
type: "message.part.updated",
|
|
913661
914055
|
properties: {
|
|
@@ -913671,7 +914065,7 @@ function processStreamEvent(sessionID, event) {
|
|
|
913671
914065
|
const index2 = evt.index;
|
|
913672
914066
|
if (!block)
|
|
913673
914067
|
break;
|
|
913674
|
-
const partID =
|
|
914068
|
+
const partID = randomUUID81();
|
|
913675
914069
|
const blockState = {
|
|
913676
914070
|
type: block.type,
|
|
913677
914071
|
partID,
|
|
@@ -913869,7 +914263,7 @@ function processStreamEvent(sessionID, event) {
|
|
|
913869
914263
|
sessionID,
|
|
913870
914264
|
part: {
|
|
913871
914265
|
type: "step-finish",
|
|
913872
|
-
id:
|
|
914266
|
+
id: randomUUID81(),
|
|
913873
914267
|
reason: state4.stopReason || "stop",
|
|
913874
914268
|
cost: 0,
|
|
913875
914269
|
tokens: {
|
|
@@ -914021,7 +914415,7 @@ var init_streamStateTracker = __esm(() => {
|
|
|
914021
914415
|
});
|
|
914022
914416
|
|
|
914023
914417
|
// src/server/sessionMessageRouter.ts
|
|
914024
|
-
import { randomUUID as
|
|
914418
|
+
import { randomUUID as randomUUID82 } from "crypto";
|
|
914025
914419
|
function isApiErrorContent(content) {
|
|
914026
914420
|
if (typeof content === "string") {
|
|
914027
914421
|
return API_ERROR_PREFIX_RE.test(content) || COSTRICT_API_ERROR_PREFIX_RE.test(content);
|
|
@@ -914222,7 +914616,7 @@ function handleAssistantMessage(msg, ctx) {
|
|
|
914222
914616
|
ctx.emitOpencodeEvent("message.updated", {
|
|
914223
914617
|
sessionID: emitSessionID,
|
|
914224
914618
|
info: {
|
|
914225
|
-
id: streamInfo?.messageID ?? msg.uuid ??
|
|
914619
|
+
id: streamInfo?.messageID ?? msg.uuid ?? randomUUID82(),
|
|
914226
914620
|
role: "assistant",
|
|
914227
914621
|
modelID: streamInfo?.modelID ?? msg.model ?? ctx.getModel() ?? "",
|
|
914228
914622
|
providerID: msg.provider_id ?? ctx.getProviderId(),
|
|
@@ -914259,7 +914653,7 @@ function handleAssistantMessage(msg, ctx) {
|
|
|
914259
914653
|
sessionID: emitSessionID,
|
|
914260
914654
|
part: {
|
|
914261
914655
|
type: "tool",
|
|
914262
|
-
id: toolInfo?.partID ??
|
|
914656
|
+
id: toolInfo?.partID ?? randomUUID82(),
|
|
914263
914657
|
callID: toolUseID,
|
|
914264
914658
|
tool: toolInfo?.toolName ? normalizeToolName3(toolInfo.toolName) : "",
|
|
914265
914659
|
messageID: toolInfo?.messageID ?? ctx.getLastMessageUuid() ?? "",
|
|
@@ -914279,7 +914673,7 @@ function handleAssistantMessage(msg, ctx) {
|
|
|
914279
914673
|
ctx.emitOpencodeEvent("message.updated", {
|
|
914280
914674
|
sessionID: emitSessionID,
|
|
914281
914675
|
info: {
|
|
914282
|
-
id: streamInfo?.messageID ?? msg.uuid ??
|
|
914676
|
+
id: streamInfo?.messageID ?? msg.uuid ?? randomUUID82(),
|
|
914283
914677
|
role: "assistant",
|
|
914284
914678
|
modelID: streamInfo?.modelID ?? msg.model ?? ctx.getModel() ?? "",
|
|
914285
914679
|
providerID: msg.provider_id ?? ctx.getProviderId(),
|
|
@@ -914300,7 +914694,7 @@ function handleAssistantMessage(msg, ctx) {
|
|
|
914300
914694
|
if (!msg.provider_id && ctx.getProviderId()) {
|
|
914301
914695
|
enriched = { ...enriched, provider_id: ctx.getProviderId() };
|
|
914302
914696
|
}
|
|
914303
|
-
const assistantMsgID = msg.uuid ??
|
|
914697
|
+
const assistantMsgID = msg.uuid ?? randomUUID82();
|
|
914304
914698
|
ctx.emitOpencodeEvent("message.updated", {
|
|
914305
914699
|
sessionID: emitSessionID,
|
|
914306
914700
|
info: {
|
|
@@ -914367,10 +914761,10 @@ function emitCompactSummaryMessage(msg, ctx) {
|
|
|
914367
914761
|
const compactState = ctx.getCompactState();
|
|
914368
914762
|
if (!compactState)
|
|
914369
914763
|
return;
|
|
914370
|
-
const assistantMsgID = msg.uuid ??
|
|
914764
|
+
const assistantMsgID = msg.uuid ?? randomUUID82();
|
|
914371
914765
|
const now3 = Date.now();
|
|
914372
|
-
const stepSeq =
|
|
914373
|
-
const partSeq =
|
|
914766
|
+
const stepSeq = randomUUID82();
|
|
914767
|
+
const partSeq = randomUUID82();
|
|
914374
914768
|
let rawContent2 = msg.message ?? msg.content;
|
|
914375
914769
|
if (rawContent2 && typeof rawContent2 === "object" && !Array.isArray(rawContent2) && "content" in rawContent2) {
|
|
914376
914770
|
rawContent2 = rawContent2.content;
|
|
@@ -914467,7 +914861,7 @@ function handleUserMessage(msg, ctx) {
|
|
|
914467
914861
|
sessionID: emitSessionID,
|
|
914468
914862
|
part: {
|
|
914469
914863
|
type: "tool",
|
|
914470
|
-
id: toolInfo?.partID ??
|
|
914864
|
+
id: toolInfo?.partID ?? randomUUID82(),
|
|
914471
914865
|
callID: toolUseID,
|
|
914472
914866
|
tool: toolInfo?.toolName ? normalizeToolName3(toolInfo.toolName) : "",
|
|
914473
914867
|
messageID: toolInfo?.messageID,
|
|
@@ -914493,7 +914887,7 @@ function handleUserMessage(msg, ctx) {
|
|
|
914493
914887
|
ctx.emitOpencodeEvent("message.updated", {
|
|
914494
914888
|
sessionID: emitSessionID,
|
|
914495
914889
|
info: {
|
|
914496
|
-
id: msgUuid ??
|
|
914890
|
+
id: msgUuid ?? randomUUID82(),
|
|
914497
914891
|
role: "user",
|
|
914498
914892
|
time: { created: Date.now() },
|
|
914499
914893
|
parentID: null
|
|
@@ -914504,7 +914898,7 @@ function emitCompactContinueMessage(ctx) {
|
|
|
914504
914898
|
const compactState = ctx.getCompactState();
|
|
914505
914899
|
if (!compactState)
|
|
914506
914900
|
return;
|
|
914507
|
-
const continueMsgID =
|
|
914901
|
+
const continueMsgID = randomUUID82();
|
|
914508
914902
|
const now3 = Date.now();
|
|
914509
914903
|
ctx.emitOpencodeEvent("message.updated", {
|
|
914510
914904
|
sessionID: ctx.sessionId,
|
|
@@ -914519,7 +914913,7 @@ function emitCompactContinueMessage(ctx) {
|
|
|
914519
914913
|
ctx.emitOpencodeEvent("message.part.updated", {
|
|
914520
914914
|
sessionID: ctx.sessionId,
|
|
914521
914915
|
part: {
|
|
914522
|
-
id:
|
|
914916
|
+
id: randomUUID82(),
|
|
914523
914917
|
sessionID: ctx.sessionId,
|
|
914524
914918
|
messageID: continueMsgID,
|
|
914525
914919
|
type: "text",
|
|
@@ -914784,16 +915178,16 @@ function handleCancelRequest(msg, ctx) {
|
|
|
914784
915178
|
function buildPartFromContentBlock(block, messageID, sessionID) {
|
|
914785
915179
|
switch (block.type) {
|
|
914786
915180
|
case "text":
|
|
914787
|
-
return { type: "text", id:
|
|
915181
|
+
return { type: "text", id: randomUUID82(), text: block.text, messageID, sessionID };
|
|
914788
915182
|
case "thinking":
|
|
914789
|
-
return { type: "reasoning", id:
|
|
915183
|
+
return { type: "reasoning", id: randomUUID82(), text: block.thinking, messageID, sessionID };
|
|
914790
915184
|
case "redacted_thinking":
|
|
914791
|
-
return { type: "reasoning", id:
|
|
915185
|
+
return { type: "reasoning", id: randomUUID82(), text: "", redacted: true, messageID, sessionID };
|
|
914792
915186
|
case "tool_use": {
|
|
914793
915187
|
const toolInput = normalizeToolInput4(block.input);
|
|
914794
915188
|
return {
|
|
914795
915189
|
type: "tool",
|
|
914796
|
-
id:
|
|
915190
|
+
id: randomUUID82(),
|
|
914797
915191
|
callID: block.id,
|
|
914798
915192
|
tool: normalizeToolName3(block.name),
|
|
914799
915193
|
state: {
|
|
@@ -914819,7 +915213,7 @@ function emitTaskStarted(msg, ctx) {
|
|
|
914819
915213
|
const description = msg.description;
|
|
914820
915214
|
const prompt = msg.prompt;
|
|
914821
915215
|
const toolUseId = msg.tool_use_id;
|
|
914822
|
-
const assistantMessageID =
|
|
915216
|
+
const assistantMessageID = randomUUID82();
|
|
914823
915217
|
ctx.registerSubagent({
|
|
914824
915218
|
agentId,
|
|
914825
915219
|
agentType: taskType,
|
|
@@ -914903,7 +915297,7 @@ function emitTaskProgress3(msg, ctx) {
|
|
|
914903
915297
|
sessionID: ctx.sessionId,
|
|
914904
915298
|
part: {
|
|
914905
915299
|
type: "tool",
|
|
914906
|
-
id:
|
|
915300
|
+
id: randomUUID82(),
|
|
914907
915301
|
callID: toolState.mainToolUseID,
|
|
914908
915302
|
tool: mainToolInfo?.toolName ? normalizeToolName3(mainToolInfo.toolName) : "task",
|
|
914909
915303
|
state: {
|
|
@@ -914926,7 +915320,7 @@ function emitTaskProgress3(msg, ctx) {
|
|
|
914926
915320
|
const toolName = toolIndex === toolUses ? lastToolName : "Tool";
|
|
914927
915321
|
let partID = toolState.toolPartIDs.get(toolIndex);
|
|
914928
915322
|
if (!partID) {
|
|
914929
|
-
partID =
|
|
915323
|
+
partID = randomUUID82();
|
|
914930
915324
|
toolState.toolPartIDs.set(toolIndex, partID);
|
|
914931
915325
|
}
|
|
914932
915326
|
ctx.emitOpencodeEvent("message.part.updated", {
|
|
@@ -914969,7 +915363,7 @@ function emitTaskCompleted(msg, ctx) {
|
|
|
914969
915363
|
sessionID: ctx.sessionId,
|
|
914970
915364
|
part: {
|
|
914971
915365
|
type: "tool",
|
|
914972
|
-
id: agentToolInfo?.partID ??
|
|
915366
|
+
id: agentToolInfo?.partID ?? randomUUID82(),
|
|
914973
915367
|
callID: toolUseId,
|
|
914974
915368
|
tool: agentToolInfo?.toolName ? normalizeToolName3(agentToolInfo.toolName) : undefined,
|
|
914975
915369
|
messageID: agentToolInfo?.messageID,
|
|
@@ -915037,8 +915431,8 @@ function emitCompactionEvent(msg, ctx) {
|
|
|
915037
915431
|
const compactMetadata = msg.compact_metadata;
|
|
915038
915432
|
const isAuto = msg.subtype === "microcompact_boundary" || compactMetadata?.trigger === "auto";
|
|
915039
915433
|
const postCompactTokens = typeof compactMetadata?.post_compact_tokens === "number" ? compactMetadata.post_compact_tokens : typeof compactMetadata?.postCompactTokens === "number" ? compactMetadata.postCompactTokens : undefined;
|
|
915040
|
-
const userMessageID =
|
|
915041
|
-
const compactionPartID = msg.uuid ??
|
|
915434
|
+
const userMessageID = randomUUID82();
|
|
915435
|
+
const compactionPartID = msg.uuid ?? randomUUID82();
|
|
915042
915436
|
ctx.emitOpencodeEvent("message.updated", {
|
|
915043
915437
|
sessionID: ctx.sessionId,
|
|
915044
915438
|
info: {
|
|
@@ -917782,7 +918176,7 @@ __export(exports_update, {
|
|
|
917782
918176
|
});
|
|
917783
918177
|
async function update() {
|
|
917784
918178
|
logEvent("tengu_update_check", {});
|
|
917785
|
-
writeToStdout(`${t("cli.update.currentVersion", "Current version")}: ${"4.2.8
|
|
918179
|
+
writeToStdout(`${t("cli.update.currentVersion", "Current version")}: ${"4.2.8"}
|
|
917786
918180
|
`);
|
|
917787
918181
|
const channel5 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
917788
918182
|
writeToStdout(`${t("cli.update.checkingUpdates", { channel: channel5 }, "Checking for updates to {channel} version...")}
|
|
@@ -917857,8 +918251,8 @@ async function update() {
|
|
|
917857
918251
|
writeToStdout(`${t("cli.update.managedByHomebrew", "CoStrict is managed by Homebrew.")}
|
|
917858
918252
|
`);
|
|
917859
918253
|
const latest = await getLatestVersion(channel5);
|
|
917860
|
-
if (latest && !gte2("4.2.8
|
|
917861
|
-
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.8
|
|
918254
|
+
if (latest && !gte2("4.2.8", latest)) {
|
|
918255
|
+
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.8", latest }, "Update available: {current} \u2192 {latest}")}
|
|
917862
918256
|
`);
|
|
917863
918257
|
writeToStdout(`
|
|
917864
918258
|
`);
|
|
@@ -917874,8 +918268,8 @@ async function update() {
|
|
|
917874
918268
|
writeToStdout(`${t("cli.update.managedByWinget", "CoStrict is managed by winget.")}
|
|
917875
918269
|
`);
|
|
917876
918270
|
const latest = await getLatestVersion(channel5);
|
|
917877
|
-
if (latest && !gte2("4.2.8
|
|
917878
|
-
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.8
|
|
918271
|
+
if (latest && !gte2("4.2.8", latest)) {
|
|
918272
|
+
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.8", latest }, "Update available: {current} \u2192 {latest}")}
|
|
917879
918273
|
`);
|
|
917880
918274
|
writeToStdout(`
|
|
917881
918275
|
`);
|
|
@@ -917891,8 +918285,8 @@ async function update() {
|
|
|
917891
918285
|
writeToStdout(`${t("cli.update.managedByApk", "CoStrict is managed by apk.")}
|
|
917892
918286
|
`);
|
|
917893
918287
|
const latest = await getLatestVersion(channel5);
|
|
917894
|
-
if (latest && !gte2("4.2.8
|
|
917895
|
-
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.8
|
|
918288
|
+
if (latest && !gte2("4.2.8", latest)) {
|
|
918289
|
+
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.8", latest }, "Update available: {current} \u2192 {latest}")}
|
|
917896
918290
|
`);
|
|
917897
918291
|
writeToStdout(`
|
|
917898
918292
|
`);
|
|
@@ -917957,11 +918351,11 @@ async function update() {
|
|
|
917957
918351
|
`);
|
|
917958
918352
|
await gracefulShutdown(1);
|
|
917959
918353
|
}
|
|
917960
|
-
if (result2.latestVersion === "4.2.8
|
|
917961
|
-
writeToStdout(source_default.green(t("cli.update.upToDateVersion", { version: "4.2.8
|
|
918354
|
+
if (result2.latestVersion === "4.2.8") {
|
|
918355
|
+
writeToStdout(source_default.green(t("cli.update.upToDateVersion", { version: "4.2.8" }, "CoStrict is up to date ({version})")) + `
|
|
917962
918356
|
`);
|
|
917963
918357
|
} else {
|
|
917964
|
-
writeToStdout(source_default.green(t("cli.update.successfullyUpdated", { from: "4.2.8
|
|
918358
|
+
writeToStdout(source_default.green(t("cli.update.successfullyUpdated", { from: "4.2.8", to: String(result2.latestVersion) }, "Successfully updated from {from} to version {to}")) + `
|
|
917965
918359
|
`);
|
|
917966
918360
|
regenerateCompletionCache();
|
|
917967
918361
|
}
|
|
@@ -918021,12 +918415,12 @@ async function update() {
|
|
|
918021
918415
|
`);
|
|
918022
918416
|
await gracefulShutdown(1);
|
|
918023
918417
|
}
|
|
918024
|
-
if (latestVersion === "4.2.8
|
|
918025
|
-
writeToStdout(source_default.green(t("cli.update.upToDateVersion", { version: "4.2.8
|
|
918418
|
+
if (latestVersion === "4.2.8") {
|
|
918419
|
+
writeToStdout(source_default.green(t("cli.update.upToDateVersion", { version: "4.2.8" }, "CoStrict is up to date ({version})")) + `
|
|
918026
918420
|
`);
|
|
918027
918421
|
await gracefulShutdown(0);
|
|
918028
918422
|
}
|
|
918029
|
-
writeToStdout(`${t("cli.update.newVersionAvailable", { latest: String(latestVersion), current: "4.2.8
|
|
918423
|
+
writeToStdout(`${t("cli.update.newVersionAvailable", { latest: String(latestVersion), current: "4.2.8" }, "New version available: {latest} (current: {current})")}
|
|
918030
918424
|
`);
|
|
918031
918425
|
writeToStdout(`${t("cli.update.installing", "Installing update...")}
|
|
918032
918426
|
`);
|
|
@@ -918071,7 +918465,7 @@ async function update() {
|
|
|
918071
918465
|
logForDebugging(`update: Installation status: ${result.status}`);
|
|
918072
918466
|
switch (result.status) {
|
|
918073
918467
|
case "success":
|
|
918074
|
-
writeToStdout(source_default.green(t("cli.update.successfullyUpdated", { from: "4.2.8
|
|
918468
|
+
writeToStdout(source_default.green(t("cli.update.successfullyUpdated", { from: "4.2.8", to: String(latestVersion) }, "Successfully updated from {from} to version {to}")) + `
|
|
918075
918469
|
`);
|
|
918076
918470
|
regenerateCompletionCache();
|
|
918077
918471
|
break;
|
|
@@ -920291,7 +920685,7 @@ ${assistantAddendum}` : assistantAddendum;
|
|
|
920291
920685
|
}
|
|
920292
920686
|
}
|
|
920293
920687
|
logForDiagnosticsNoPII("info", "started", {
|
|
920294
|
-
version: "4.2.8
|
|
920688
|
+
version: "4.2.8",
|
|
920295
920689
|
is_native_binary: isInBundledMode()
|
|
920296
920690
|
});
|
|
920297
920691
|
registerCleanup(async () => {
|
|
@@ -920772,7 +921166,7 @@ Session: ${directConnectConfig.sessionId}`, "info");
|
|
|
920772
921166
|
sshSession = await createSSHSession2({
|
|
920773
921167
|
host: _pendingSSH.host,
|
|
920774
921168
|
cwd: _pendingSSH.cwd,
|
|
920775
|
-
localVersion: "4.2.8
|
|
921169
|
+
localVersion: "4.2.8",
|
|
920776
921170
|
permissionMode: _pendingSSH.permissionMode,
|
|
920777
921171
|
dangerouslySkipPermissions: _pendingSSH.dangerouslySkipPermissions,
|
|
920778
921172
|
extraCliArgs: _pendingSSH.extraCliArgs,
|
|
@@ -921244,7 +921638,7 @@ Usage: csc --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
921244
921638
|
pendingHookMessages
|
|
921245
921639
|
}, renderAndRun);
|
|
921246
921640
|
}
|
|
921247
|
-
}).version("4.2.8
|
|
921641
|
+
}).version("4.2.8 (CoStrict)", "-v, --version", cliDesc("cli.option.version", "Output the version number"));
|
|
921248
921642
|
program2.addOption(new Option("-w, --worktree [name]", cliDesc("cli.option.worktree", "Create a new git worktree for this session (optionally specify a name)")).hideHelp());
|
|
921249
921643
|
program2.addOption(new Option("--tmux", cliDesc("cli.option.tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.")).hideHelp());
|
|
921250
921644
|
if (canUserConfigureAdvisor()) {
|
|
@@ -921960,10 +922354,10 @@ if (process.env.CLAUDE_CODE_REMOTE === "true") {
|
|
|
921960
922354
|
async function main2() {
|
|
921961
922355
|
const args = process.argv.slice(2);
|
|
921962
922356
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
921963
|
-
const d4 = new Date("2026-
|
|
922357
|
+
const d4 = new Date("2026-07-01T09:41:30.503Z");
|
|
921964
922358
|
const p2 = (n3) => String(n3).padStart(2, "0");
|
|
921965
922359
|
const buildTime = `${d4.getFullYear()}/${p2(d4.getMonth() + 1)}/${p2(d4.getDate())} ${p2(d4.getHours())}:${p2(d4.getMinutes())}:${p2(d4.getSeconds())}`;
|
|
921966
|
-
console.log(`${"4.2.8
|
|
922360
|
+
console.log(`${"4.2.8"} (commit: ${"353b792d4"}, built: ${buildTime})`);
|
|
921967
922361
|
return;
|
|
921968
922362
|
}
|
|
921969
922363
|
const { terminateBatchWorker: terminateBatchWorker2 } = await Promise.resolve().then(() => (init_spawn(), exports_spawn));
|
|
@@ -922033,7 +922427,7 @@ async function main2() {
|
|
|
922033
922427
|
registerPermissionHandler(server2, handler) {
|
|
922034
922428
|
server2.setNotificationHandler(ChannelPermissionRequestNotificationSchema2(), async (notification) => handler(notification.params));
|
|
922035
922429
|
}
|
|
922036
|
-
}, "4.2.8
|
|
922430
|
+
}, "4.2.8");
|
|
922037
922431
|
return;
|
|
922038
922432
|
}
|
|
922039
922433
|
if (args[0] === "--daemon-worker" || args[0]?.startsWith("--daemon-worker=")) {
|
|
@@ -922131,5 +922525,5 @@ async function main2() {
|
|
|
922131
922525
|
}
|
|
922132
922526
|
main2();
|
|
922133
922527
|
|
|
922134
|
-
//# debugId=
|
|
922528
|
+
//# debugId=13ED2747AD1152AF64756E2164756E21
|
|
922135
922529
|
//# sourceMappingURL=cli.js.map
|