@rayss-dev/openclaude 0.33.2-by-rayss → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp.mjs +700 -303
- package/dist/cli.mjs +46 -44
- package/dist/sdk.mjs +677 -281
- package/docs/settings-reference.md +150 -150
- package/docs/windows-aliases-and-launchers.md +162 -162
- package/package.json +2 -1
package/dist/acp.mjs
CHANGED
|
@@ -3756,12 +3756,145 @@ function getTeamsDir() {
|
|
|
3756
3756
|
function getProjectsDir() {
|
|
3757
3757
|
return join(getClaudeConfigHomeDir(), "projects");
|
|
3758
3758
|
}
|
|
3759
|
+
function tokenizeNodeOptions(nodeOptions) {
|
|
3760
|
+
const tokens = [];
|
|
3761
|
+
let isInString = false;
|
|
3762
|
+
let willStartNewArg = true;
|
|
3763
|
+
for (let i = 0;i < nodeOptions.length; i++) {
|
|
3764
|
+
let c = nodeOptions[i];
|
|
3765
|
+
if (c === "\\" && isInString) {
|
|
3766
|
+
if (i + 1 >= nodeOptions.length) {
|
|
3767
|
+
return null;
|
|
3768
|
+
}
|
|
3769
|
+
c = nodeOptions[++i];
|
|
3770
|
+
} else if (c === " " && !isInString) {
|
|
3771
|
+
willStartNewArg = true;
|
|
3772
|
+
continue;
|
|
3773
|
+
} else if (c === '"') {
|
|
3774
|
+
isInString = !isInString;
|
|
3775
|
+
continue;
|
|
3776
|
+
}
|
|
3777
|
+
if (willStartNewArg) {
|
|
3778
|
+
tokens.push(c);
|
|
3779
|
+
willStartNewArg = false;
|
|
3780
|
+
} else {
|
|
3781
|
+
tokens[tokens.length - 1] += c;
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
if (isInString) {
|
|
3785
|
+
return null;
|
|
3786
|
+
}
|
|
3787
|
+
return tokens;
|
|
3788
|
+
}
|
|
3789
|
+
function resolveNodeOption(name, hasInlineValue) {
|
|
3790
|
+
if (hasInlineValue) {
|
|
3791
|
+
const inlineAlias = NODE_INLINE_OPTION_ALIASES.get(`${name}=`);
|
|
3792
|
+
if (inlineAlias) {
|
|
3793
|
+
return {
|
|
3794
|
+
role: NODE_OPTION_ROLES.get(inlineAlias[0]) ?? "boolean",
|
|
3795
|
+
names: [name, ...inlineAlias]
|
|
3796
|
+
};
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
const alias = NODE_OPTION_ALIASES.get(name);
|
|
3800
|
+
if (alias) {
|
|
3801
|
+
return {
|
|
3802
|
+
role: NODE_OPTION_ROLES.get(alias[0]) ?? "boolean",
|
|
3803
|
+
names: [name, ...alias]
|
|
3804
|
+
};
|
|
3805
|
+
}
|
|
3806
|
+
return { role: NODE_OPTION_ROLES.get(name) ?? "boolean", names: [name] };
|
|
3807
|
+
}
|
|
3808
|
+
function parseNodeOptions(nodeOptions) {
|
|
3809
|
+
const tokens = tokenizeNodeOptions(nodeOptions);
|
|
3810
|
+
if (!tokens) {
|
|
3811
|
+
return { valid: false, options: [] };
|
|
3812
|
+
}
|
|
3813
|
+
const options = [];
|
|
3814
|
+
let index = 0;
|
|
3815
|
+
while (index < tokens.length) {
|
|
3816
|
+
const token = tokens[index];
|
|
3817
|
+
index += 1;
|
|
3818
|
+
if (token.length <= 1 || token[0] !== "-") {
|
|
3819
|
+
break;
|
|
3820
|
+
}
|
|
3821
|
+
if (token === "--") {
|
|
3822
|
+
return { valid: false, options: [] };
|
|
3823
|
+
}
|
|
3824
|
+
const equalsIndex = token.startsWith("--") ? token.indexOf("=") : -1;
|
|
3825
|
+
const name = equalsIndex === -1 ? token : token.slice(0, equalsIndex);
|
|
3826
|
+
const inlineValue = equalsIndex === -1 ? undefined : token.slice(equalsIndex + 1);
|
|
3827
|
+
let optionName = name;
|
|
3828
|
+
let negated = false;
|
|
3829
|
+
if (optionName.startsWith("--no-")) {
|
|
3830
|
+
optionName = `--${optionName.slice("--no-".length)}`;
|
|
3831
|
+
negated = true;
|
|
3832
|
+
}
|
|
3833
|
+
const { role, names } = resolveNodeOption(optionName, equalsIndex !== -1);
|
|
3834
|
+
if (negated && role !== "boolean") {
|
|
3835
|
+
return { valid: false, options: [] };
|
|
3836
|
+
}
|
|
3837
|
+
switch (role) {
|
|
3838
|
+
case "boolean":
|
|
3839
|
+
break;
|
|
3840
|
+
case "value": {
|
|
3841
|
+
if (inlineValue !== undefined) {
|
|
3842
|
+
if (inlineValue === "") {
|
|
3843
|
+
return { valid: false, options: [] };
|
|
3844
|
+
}
|
|
3845
|
+
break;
|
|
3846
|
+
}
|
|
3847
|
+
const next = tokens[index];
|
|
3848
|
+
if (next === undefined || next.startsWith("-")) {
|
|
3849
|
+
return { valid: false, options: [] };
|
|
3850
|
+
}
|
|
3851
|
+
index += 1;
|
|
3852
|
+
break;
|
|
3853
|
+
}
|
|
3854
|
+
case "inline-value": {
|
|
3855
|
+
if (inlineValue === undefined) {
|
|
3856
|
+
return { valid: false, options: [] };
|
|
3857
|
+
}
|
|
3858
|
+
break;
|
|
3859
|
+
}
|
|
3860
|
+
case "inline-required": {
|
|
3861
|
+
if (inlineValue === undefined || inlineValue === "") {
|
|
3862
|
+
return { valid: false, options: [] };
|
|
3863
|
+
}
|
|
3864
|
+
break;
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3867
|
+
const recorded = new Set;
|
|
3868
|
+
for (const occurrenceName of names) {
|
|
3869
|
+
if (recorded.has(occurrenceName)) {
|
|
3870
|
+
continue;
|
|
3871
|
+
}
|
|
3872
|
+
recorded.add(occurrenceName);
|
|
3873
|
+
options.push({ name: occurrenceName, negated });
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
return { valid: true, options };
|
|
3877
|
+
}
|
|
3759
3878
|
function hasNodeOption(flag) {
|
|
3760
3879
|
const nodeOptions = process.env.NODE_OPTIONS;
|
|
3761
3880
|
if (!nodeOptions) {
|
|
3762
3881
|
return false;
|
|
3763
3882
|
}
|
|
3764
|
-
|
|
3883
|
+
const parsed = parseNodeOptions(nodeOptions);
|
|
3884
|
+
if (!parsed.valid) {
|
|
3885
|
+
return false;
|
|
3886
|
+
}
|
|
3887
|
+
const negatedQuery = flag.startsWith("--no-");
|
|
3888
|
+
const optionName = negatedQuery ? `--${flag.slice("--no-".length)}` : flag;
|
|
3889
|
+
let enabled = false;
|
|
3890
|
+
let seen = false;
|
|
3891
|
+
for (const option of parsed.options) {
|
|
3892
|
+
if (option.name === optionName) {
|
|
3893
|
+
enabled = !option.negated;
|
|
3894
|
+
seen = true;
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
return negatedQuery ? seen && !enabled : enabled;
|
|
3765
3898
|
}
|
|
3766
3899
|
function isEnvTruthy(envVar) {
|
|
3767
3900
|
if (!envVar)
|
|
@@ -3796,6 +3929,21 @@ function shouldMaintainProjectWorkingDir() {
|
|
|
3796
3929
|
function isRunningOnHomespace() {
|
|
3797
3930
|
return process.env.USER_TYPE === "ant" && isEnvTruthy(process.env.COO_RUNNING_ON_HOMESPACE);
|
|
3798
3931
|
}
|
|
3932
|
+
function getEnvNumber(key, defaultValue) {
|
|
3933
|
+
const value = process.env[key];
|
|
3934
|
+
if (value === undefined) {
|
|
3935
|
+
return defaultValue;
|
|
3936
|
+
}
|
|
3937
|
+
const trimmed = value.trim();
|
|
3938
|
+
if (!/^(0|[1-9]\d*)$/.test(trimmed)) {
|
|
3939
|
+
return defaultValue;
|
|
3940
|
+
}
|
|
3941
|
+
const parsed = Number.parseInt(trimmed, 10);
|
|
3942
|
+
if (!Number.isSafeInteger(parsed) || parsed <= 0) {
|
|
3943
|
+
return defaultValue;
|
|
3944
|
+
}
|
|
3945
|
+
return parsed;
|
|
3946
|
+
}
|
|
3799
3947
|
function isInProtectedNamespace() {
|
|
3800
3948
|
if (process.env.USER_TYPE === "ant") {
|
|
3801
3949
|
return (init_protectedNamespace(), __toCommonJS(exports_protectedNamespace)).checkProtectedNamespace();
|
|
@@ -3811,7 +3959,7 @@ function getVertexRegionForModel(model) {
|
|
|
3811
3959
|
}
|
|
3812
3960
|
return getDefaultVertexRegion();
|
|
3813
3961
|
}
|
|
3814
|
-
var claudeConfigHomeDirOverride, getDefaultClaudeConfigHomeDir, getClaudeConfigHomeDir, VERTEX_REGION_OVERRIDES;
|
|
3962
|
+
var claudeConfigHomeDirOverride, getDefaultClaudeConfigHomeDir, getClaudeConfigHomeDir, NODE_OPTION_ROLES, NODE_OPTION_ALIASES, NODE_INLINE_OPTION_ALIASES, VERTEX_REGION_OVERRIDES;
|
|
3815
3963
|
var init_envUtils = __esm(() => {
|
|
3816
3964
|
init_memoize();
|
|
3817
3965
|
getDefaultClaudeConfigHomeDir = memoize_default(() => {
|
|
@@ -3832,6 +3980,89 @@ var init_envUtils = __esm(() => {
|
|
|
3832
3980
|
}
|
|
3833
3981
|
return getDefaultClaudeConfigHomeDir();
|
|
3834
3982
|
}, { cache: getDefaultClaudeConfigHomeDir.cache });
|
|
3983
|
+
NODE_OPTION_ROLES = new Map([
|
|
3984
|
+
["--max-old-space-size", "inline-value"],
|
|
3985
|
+
["--max-semi-space-size", "inline-value"],
|
|
3986
|
+
["--stack-trace-limit", "inline-required"],
|
|
3987
|
+
["--allow-fs-read", "value"],
|
|
3988
|
+
["--allow-fs-write", "value"],
|
|
3989
|
+
["--conditions", "value"],
|
|
3990
|
+
["-C", "value"],
|
|
3991
|
+
["--cpu-prof-dir", "value"],
|
|
3992
|
+
["--cpu-prof-interval", "value"],
|
|
3993
|
+
["--cpu-prof-name", "value"],
|
|
3994
|
+
["--debug-port", "value"],
|
|
3995
|
+
["--diagnostic-dir", "value"],
|
|
3996
|
+
["--disable-proto", "value"],
|
|
3997
|
+
["--disable-warning", "value"],
|
|
3998
|
+
["--dns-result-order", "value"],
|
|
3999
|
+
["--experimental-default-type", "value"],
|
|
4000
|
+
["--experimental-loader", "value"],
|
|
4001
|
+
["--heap-prof-dir", "value"],
|
|
4002
|
+
["--heap-prof-interval", "value"],
|
|
4003
|
+
["--heap-prof-name", "value"],
|
|
4004
|
+
["--heapsnapshot-near-heap-limit", "value"],
|
|
4005
|
+
["--heapsnapshot-signal", "value"],
|
|
4006
|
+
["--icu-data-dir", "value"],
|
|
4007
|
+
["--import", "value"],
|
|
4008
|
+
["--input-type", "value"],
|
|
4009
|
+
["--inspect-port", "value"],
|
|
4010
|
+
["--inspect-publish-uid", "value"],
|
|
4011
|
+
["--loader", "value"],
|
|
4012
|
+
["--localstorage-file", "value"],
|
|
4013
|
+
["--max-http-header-size", "value"],
|
|
4014
|
+
["--max-old-space-size-percentage", "value"],
|
|
4015
|
+
["--network-family-autoselection-attempt-timeout", "value"],
|
|
4016
|
+
["--openssl-config", "value"],
|
|
4017
|
+
["--redirect-warnings", "value"],
|
|
4018
|
+
["--report-dir", "value"],
|
|
4019
|
+
["--report-directory", "value"],
|
|
4020
|
+
["--report-filename", "value"],
|
|
4021
|
+
["--report-signal", "value"],
|
|
4022
|
+
["--require", "value"],
|
|
4023
|
+
["-r", "value"],
|
|
4024
|
+
["--secure-heap", "value"],
|
|
4025
|
+
["--secure-heap-min", "value"],
|
|
4026
|
+
["--snapshot-blob", "value"],
|
|
4027
|
+
["--test-coverage-branches", "value"],
|
|
4028
|
+
["--test-coverage-exclude", "value"],
|
|
4029
|
+
["--test-coverage-functions", "value"],
|
|
4030
|
+
["--test-coverage-include", "value"],
|
|
4031
|
+
["--test-coverage-lines", "value"],
|
|
4032
|
+
["--test-global-setup", "value"],
|
|
4033
|
+
["--test-isolation", "value"],
|
|
4034
|
+
["--test-name-pattern", "value"],
|
|
4035
|
+
["--test-reporter", "value"],
|
|
4036
|
+
["--test-reporter-destination", "value"],
|
|
4037
|
+
["--test-rerun-failures", "value"],
|
|
4038
|
+
["--test-shard", "value"],
|
|
4039
|
+
["--test-skip-pattern", "value"],
|
|
4040
|
+
["--title", "value"],
|
|
4041
|
+
["--tls-cipher-list", "value"],
|
|
4042
|
+
["--tls-keylog", "value"],
|
|
4043
|
+
["--trace-event-categories", "value"],
|
|
4044
|
+
["--trace-event-file-pattern", "value"],
|
|
4045
|
+
["--trace-require-module", "value"],
|
|
4046
|
+
["--unhandled-rejections", "value"],
|
|
4047
|
+
["--use-largepages", "value"],
|
|
4048
|
+
["--v8-pool-size", "value"],
|
|
4049
|
+
["--watch-kill-signal", "value"],
|
|
4050
|
+
["--watch-path", "value"]
|
|
4051
|
+
]);
|
|
4052
|
+
NODE_OPTION_ALIASES = new Map([
|
|
4053
|
+
["-C", ["--conditions"]],
|
|
4054
|
+
["-r", ["--require"]],
|
|
4055
|
+
["--debug-port", ["--inspect-port"]],
|
|
4056
|
+
["--loader", ["--experimental-loader"]],
|
|
4057
|
+
["--report-directory", ["--report-dir"]],
|
|
4058
|
+
["--experimental-test-isolation", ["--test-isolation"]]
|
|
4059
|
+
]);
|
|
4060
|
+
NODE_INLINE_OPTION_ALIASES = new Map([
|
|
4061
|
+
["--inspect=", ["--inspect-port", "--inspect"]],
|
|
4062
|
+
["--inspect-brk=", ["--inspect-port", "--inspect-brk"]],
|
|
4063
|
+
["--inspect-brk-node=", ["--inspect-port", "--inspect-brk-node"]],
|
|
4064
|
+
["--inspect-wait=", ["--inspect-port", "--inspect-wait"]]
|
|
4065
|
+
]);
|
|
3835
4066
|
VERTEX_REGION_OVERRIDES = [
|
|
3836
4067
|
["claude-haiku-4-5", "VERTEX_REGION_CLAUDE_HAIKU_4_5"],
|
|
3837
4068
|
["claude-3-5-haiku", "VERTEX_REGION_CLAUDE_3_5_HAIKU"],
|
|
@@ -10106,14 +10337,14 @@ function getReleaseTagUrl(version = publicBuildVersion) {
|
|
|
10106
10337
|
return `${OPENCLAUDE_RELEASES_URL}/tag/v${normalizePublicVersion(version)}`;
|
|
10107
10338
|
}
|
|
10108
10339
|
function getPublicBuildVersion() {
|
|
10109
|
-
return "0.
|
|
10340
|
+
return "0.34.0";
|
|
10110
10341
|
}
|
|
10111
10342
|
var import_semver, OPENCLAUDE_RELEASES_URL = "https://github.com/rayss868/openclaude/releases", fallbackBuildVersion, publicBuildVersion;
|
|
10112
10343
|
var init_version = __esm(() => {
|
|
10113
10344
|
import_semver = __toESM(require_semver2(), 1);
|
|
10114
10345
|
fallbackBuildVersion = (() => {
|
|
10115
10346
|
try {
|
|
10116
|
-
return "0.
|
|
10347
|
+
return "0.34.0";
|
|
10117
10348
|
} catch {
|
|
10118
10349
|
return "0.0.0";
|
|
10119
10350
|
}
|
|
@@ -101130,7 +101361,7 @@ function createHttpsProxyAgent(proxyUrl, extra = {}) {
|
|
|
101130
101361
|
callback(null, hostname2, getAddressFamily(options));
|
|
101131
101362
|
};
|
|
101132
101363
|
}
|
|
101133
|
-
return new
|
|
101364
|
+
return new TargetTLSHttpsProxyAgent(proxyUrl, { ...agentOptions, ...extra });
|
|
101134
101365
|
}
|
|
101135
101366
|
function getWebSocketProxyAgent(url3) {
|
|
101136
101367
|
const proxyUrl = getProxyUrl();
|
|
@@ -101227,7 +101458,7 @@ async function getAWSClientProxyConfig() {
|
|
|
101227
101458
|
})
|
|
101228
101459
|
};
|
|
101229
101460
|
}
|
|
101230
|
-
var import_https_proxy_agent, keepAliveDisabled, getProxyAgent, proxyInterceptorId;
|
|
101461
|
+
var import_https_proxy_agent, keepAliveDisabled, TargetTLSHttpsProxyAgent, getProxyAgent, proxyInterceptorId;
|
|
101231
101462
|
var init_proxy = __esm(() => {
|
|
101232
101463
|
init_axios2();
|
|
101233
101464
|
init_memoize();
|
|
@@ -101238,6 +101469,17 @@ var init_proxy = __esm(() => {
|
|
|
101238
101469
|
init_optionalRuntimeModule();
|
|
101239
101470
|
import_https_proxy_agent = __toESM(require_dist3(), 1);
|
|
101240
101471
|
keepAliveDisabled = isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_KEEPALIVE);
|
|
101472
|
+
TargetTLSHttpsProxyAgent = class TargetTLSHttpsProxyAgent extends import_https_proxy_agent.HttpsProxyAgent {
|
|
101473
|
+
targetTLSOptions;
|
|
101474
|
+
constructor(proxyUrl, options) {
|
|
101475
|
+
super(proxyUrl, options);
|
|
101476
|
+
const { ca, cert, key, passphrase } = options;
|
|
101477
|
+
this.targetTLSOptions = { ca, cert, key, passphrase };
|
|
101478
|
+
}
|
|
101479
|
+
connect(...[req, opts]) {
|
|
101480
|
+
return super.connect(req, { ...this.targetTLSOptions, ...opts });
|
|
101481
|
+
}
|
|
101482
|
+
};
|
|
101241
101483
|
getProxyAgent = memoize_default((uri) => {
|
|
101242
101484
|
const undiciMod = require_undici();
|
|
101243
101485
|
const mtlsConfig = getMTLSConfig();
|
|
@@ -110969,7 +111211,7 @@ var init_metadata = __esm(() => {
|
|
|
110969
111211
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
110970
111212
|
WHITESPACE_REGEX = /\s+/;
|
|
110971
111213
|
getVersionBase = memoize_default(() => {
|
|
110972
|
-
const match = "0.
|
|
111214
|
+
const match = "0.34.0".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
110973
111215
|
return match ? match[0] : undefined;
|
|
110974
111216
|
});
|
|
110975
111217
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -111009,9 +111251,9 @@ var init_metadata = __esm(() => {
|
|
|
111009
111251
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
111010
111252
|
isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
|
|
111011
111253
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
111012
|
-
version: "0.
|
|
111254
|
+
version: "0.34.0",
|
|
111013
111255
|
versionBase: getVersionBase(),
|
|
111014
|
-
buildTime: "2026-
|
|
111256
|
+
buildTime: "2026-11-08T14:26:41.014Z",
|
|
111015
111257
|
deploymentEnvironment: env2.detectDeploymentEnvironment(),
|
|
111016
111258
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
111017
111259
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -170514,6 +170756,7 @@ var init_boundedAsync = __esm(() => {
|
|
|
170514
170756
|
});
|
|
170515
170757
|
|
|
170516
170758
|
// src/services/mcp/oauthPort.ts
|
|
170759
|
+
import { randomInt as randomInt2 } from "crypto";
|
|
170517
170760
|
import { createServer as createServer2 } from "http";
|
|
170518
170761
|
function buildRedirectUri(port = REDIRECT_PORT_FALLBACK) {
|
|
170519
170762
|
return `http://localhost:${port}/callback`;
|
|
@@ -170531,7 +170774,7 @@ async function findAvailablePort() {
|
|
|
170531
170774
|
const range = max2 - min + 1;
|
|
170532
170775
|
const maxAttempts = Math.min(range, 100);
|
|
170533
170776
|
for (let attempt = 0;attempt < maxAttempts; attempt++) {
|
|
170534
|
-
const port = min +
|
|
170777
|
+
const port = randomInt2(min, max2 + 1);
|
|
170535
170778
|
try {
|
|
170536
170779
|
await new Promise((resolve23, reject) => {
|
|
170537
170780
|
const testServer = createServer2();
|
|
@@ -174799,11 +175042,11 @@ var init_codeIndexing = __esm(() => {
|
|
|
174799
175042
|
|
|
174800
175043
|
// src/utils/userAgent.ts
|
|
174801
175044
|
function getClaudeCodeUserAgent() {
|
|
174802
|
-
return `claude-code/${"0.
|
|
175045
|
+
return `claude-code/${"0.34.0"}`;
|
|
174803
175046
|
}
|
|
174804
175047
|
function getOpenClaudeUserAgent() {
|
|
174805
175048
|
try {
|
|
174806
|
-
return `openclaude/${"0.
|
|
175049
|
+
return `openclaude/${"0.34.0"}`;
|
|
174807
175050
|
} catch {
|
|
174808
175051
|
return "openclaude/0.0.0";
|
|
174809
175052
|
}
|
|
@@ -174825,7 +175068,7 @@ function getUserAgent() {
|
|
|
174825
175068
|
const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
|
|
174826
175069
|
const workload = getWorkload();
|
|
174827
175070
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
174828
|
-
return `claude-cli/${"0.
|
|
175071
|
+
return `claude-cli/${"0.34.0"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
174829
175072
|
}
|
|
174830
175073
|
function getMCPUserAgent() {
|
|
174831
175074
|
const parts = [];
|
|
@@ -174839,7 +175082,7 @@ function getMCPUserAgent() {
|
|
|
174839
175082
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
174840
175083
|
}
|
|
174841
175084
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
174842
|
-
return `claude-code/${"0.
|
|
175085
|
+
return `claude-code/${"0.34.0"}${suffix}`;
|
|
174843
175086
|
}
|
|
174844
175087
|
function getWebFetchUserAgent() {
|
|
174845
175088
|
const supportUrl = isFirstPartyAnthropicProvider() ? "https://support.anthropic.com/" : "https://github.com/rayss868/openclaude";
|
|
@@ -179914,7 +180157,7 @@ function getAttributionHeader(fingerprint, policy) {
|
|
|
179914
180157
|
if (!policy.generate) {
|
|
179915
180158
|
return "";
|
|
179916
180159
|
}
|
|
179917
|
-
const version2 = `${"0.
|
|
180160
|
+
const version2 = `${"0.34.0"}.${fingerprint}`;
|
|
179918
180161
|
const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
|
|
179919
180162
|
const cch = "";
|
|
179920
180163
|
const workload = getWorkload();
|
|
@@ -182998,11 +183241,13 @@ function createRequestBodyPlanner(context) {
|
|
|
182998
183241
|
options.temperature = params.temperature;
|
|
182999
183242
|
if (params.top_p !== undefined)
|
|
183000
183243
|
options.top_p = params.top_p;
|
|
183244
|
+
const think = request.reasoning?.effort ? ["xhigh", "max", "ultracode"].includes(request.reasoning.effort) ? "high" : request.reasoning.effort : false;
|
|
183001
183245
|
return {
|
|
183002
183246
|
model: request.resolvedModel,
|
|
183003
183247
|
messages: normalizeOllamaNativeMessages(body.messages),
|
|
183004
183248
|
stream: params.stream ?? false,
|
|
183005
183249
|
options,
|
|
183250
|
+
think,
|
|
183006
183251
|
...body.tools ? { tools: body.tools } : {}
|
|
183007
183252
|
};
|
|
183008
183253
|
};
|
|
@@ -183939,10 +184184,8 @@ function convertOllamaStreamingResponse(response, fallbackModel, makeMessageId2
|
|
|
183939
184184
|
buffer = lines.pop() ?? "";
|
|
183940
184185
|
let emitted = false;
|
|
183941
184186
|
for (const line of lines)
|
|
183942
|
-
if (line.trim())
|
|
183943
|
-
enqueue(line.trim(), controller);
|
|
184187
|
+
if (line.trim() && enqueue(line.trim(), controller))
|
|
183944
184188
|
emitted = true;
|
|
183945
|
-
}
|
|
183946
184189
|
if (emitted)
|
|
183947
184190
|
return;
|
|
183948
184191
|
}
|
|
@@ -183956,7 +184199,7 @@ function convertOllamaStreamingResponse(response, fallbackModel, makeMessageId2
|
|
|
183956
184199
|
try {
|
|
183957
184200
|
data = JSON.parse(line);
|
|
183958
184201
|
} catch {
|
|
183959
|
-
return;
|
|
184202
|
+
return false;
|
|
183960
184203
|
}
|
|
183961
184204
|
const model = data.model ?? fallbackModel;
|
|
183962
184205
|
const chunks = [];
|
|
@@ -183982,6 +184225,7 @@ function convertOllamaStreamingResponse(response, fallbackModel, makeMessageId2
|
|
|
183982
184225
|
}
|
|
183983
184226
|
for (const chunk of chunks)
|
|
183984
184227
|
controller.enqueue(encoder.encode(chunk));
|
|
184228
|
+
return chunks.length > 0;
|
|
183985
184229
|
}
|
|
183986
184230
|
return responseWithPreservedUrl(stream4, { status: response.status, statusText: response.statusText, headers: { "content-type": "text/event-stream" } }, response.url);
|
|
183987
184231
|
}
|
|
@@ -184618,6 +184862,13 @@ function convertNonStreamingResponseToAnthropicMessage(data, model, deps) {
|
|
|
184618
184862
|
content.push({ type: "text", text: `
|
|
184619
184863
|
|
|
184620
184864
|
[Content blocked by provider safety filter]` });
|
|
184865
|
+
} else if (choice?.finish_reason === "length") {
|
|
184866
|
+
content.push({
|
|
184867
|
+
type: "text",
|
|
184868
|
+
text: `
|
|
184869
|
+
|
|
184870
|
+
[Response truncated — reached length limit or upstream stalled. Ask the model to continue.]`
|
|
184871
|
+
});
|
|
184621
184872
|
}
|
|
184622
184873
|
return {
|
|
184623
184874
|
id: data.id ?? deps.makeMessageId(),
|
|
@@ -184659,8 +184910,290 @@ function getStreamStats(state2) {
|
|
|
184659
184910
|
};
|
|
184660
184911
|
}
|
|
184661
184912
|
|
|
184913
|
+
// src/services/api/openaiShim/xmlToolCallParsing.ts
|
|
184914
|
+
function coerceXmlToolValue(raw) {
|
|
184915
|
+
const trimmed = raw.trim();
|
|
184916
|
+
if (trimmed === "")
|
|
184917
|
+
return "";
|
|
184918
|
+
try {
|
|
184919
|
+
return JSON.parse(trimmed);
|
|
184920
|
+
} catch {
|
|
184921
|
+
return raw;
|
|
184922
|
+
}
|
|
184923
|
+
}
|
|
184924
|
+
function parseHy3ToolCallInner(inner) {
|
|
184925
|
+
const args = {};
|
|
184926
|
+
const trimmed = inner.trim();
|
|
184927
|
+
const name = trimmed.split(/[\n<]/, 1)[0]?.trim().replace(/[\s`*_]+$/, "");
|
|
184928
|
+
let hasStructuredArguments = false;
|
|
184929
|
+
for (const parameter of inner.matchAll(HY3_PARAMETER_RE)) {
|
|
184930
|
+
const key = parameter[1];
|
|
184931
|
+
if (key) {
|
|
184932
|
+
hasStructuredArguments = true;
|
|
184933
|
+
args[key] = coerceXmlToolValue(parameter[2] ?? "");
|
|
184934
|
+
}
|
|
184935
|
+
}
|
|
184936
|
+
for (const line of inner.matchAll(HY3_NAMED_ARGUMENT_LINE_RE)) {
|
|
184937
|
+
const key = line[1];
|
|
184938
|
+
if (key) {
|
|
184939
|
+
hasStructuredArguments = true;
|
|
184940
|
+
args[key] = coerceXmlToolValue(line[2] ?? "");
|
|
184941
|
+
}
|
|
184942
|
+
}
|
|
184943
|
+
for (const pair of inner.matchAll(HY3_ARG_PAIR_RE)) {
|
|
184944
|
+
const key = pair[1]?.trim();
|
|
184945
|
+
if (key) {
|
|
184946
|
+
hasStructuredArguments = true;
|
|
184947
|
+
args[key] = coerceXmlToolValue(pair[2] ?? "");
|
|
184948
|
+
}
|
|
184949
|
+
}
|
|
184950
|
+
return {
|
|
184951
|
+
name: name && /^[A-Za-z_][\w.-]*$/.test(name) && (hasStructuredArguments || trimmed === name) ? name : undefined,
|
|
184952
|
+
args
|
|
184953
|
+
};
|
|
184954
|
+
}
|
|
184955
|
+
function isHy3Model(model) {
|
|
184956
|
+
return model.split("?", 1)[0]?.toLowerCase() === "tencent/hy3";
|
|
184957
|
+
}
|
|
184958
|
+
function trailingXmlOpenerPrefixLen(s, allowHy3) {
|
|
184959
|
+
let longest = 0;
|
|
184960
|
+
const openers = allowHy3 ? XML_TOOL_CALL_OPENERS : [XML_TOOL_CALL_OPEN];
|
|
184961
|
+
for (const opener of openers) {
|
|
184962
|
+
const max2 = Math.min(s.length, opener.length - 1);
|
|
184963
|
+
for (let len = max2;len > 0; len--) {
|
|
184964
|
+
if (opener.startsWith(s.slice(s.length - len))) {
|
|
184965
|
+
longest = Math.max(longest, len);
|
|
184966
|
+
break;
|
|
184967
|
+
}
|
|
184968
|
+
}
|
|
184969
|
+
}
|
|
184970
|
+
return longest;
|
|
184971
|
+
}
|
|
184972
|
+
function findXmlToolCallOpener(text, allowHy3) {
|
|
184973
|
+
const openers = allowHy3 ? XML_TOOL_CALL_OPENERS : [XML_TOOL_CALL_OPEN];
|
|
184974
|
+
return openers.reduce((first, opener) => {
|
|
184975
|
+
const index = text.indexOf(opener);
|
|
184976
|
+
return index === -1 ? first : first === -1 ? index : Math.min(first, index);
|
|
184977
|
+
}, -1);
|
|
184978
|
+
}
|
|
184979
|
+
function isJsonText(raw) {
|
|
184980
|
+
try {
|
|
184981
|
+
JSON.parse(raw);
|
|
184982
|
+
return true;
|
|
184983
|
+
} catch {
|
|
184984
|
+
return false;
|
|
184985
|
+
}
|
|
184986
|
+
}
|
|
184987
|
+
function findJsonEnvelopeBody(text, bodyStart) {
|
|
184988
|
+
const firstClose = text.indexOf(XML_TOOL_CALL_CLOSE, bodyStart);
|
|
184989
|
+
const jsonStart = text.indexOf("{", bodyStart);
|
|
184990
|
+
if (jsonStart === -1 || firstClose !== -1 && jsonStart > firstClose)
|
|
184991
|
+
return null;
|
|
184992
|
+
const lead = text.slice(bodyStart, jsonStart);
|
|
184993
|
+
if (XML_FUNCTION_NAME_RE.test(lead) || lead.includes(XML_ARG_KEY_OPEN))
|
|
184994
|
+
return null;
|
|
184995
|
+
const json2 = extractBalancedJson(text, jsonStart);
|
|
184996
|
+
if (!json2 || !isJsonText(json2))
|
|
184997
|
+
return null;
|
|
184998
|
+
const jsonEnd = jsonStart + json2.length;
|
|
184999
|
+
const closeIndex = text.indexOf(XML_TOOL_CALL_CLOSE, jsonEnd);
|
|
185000
|
+
return closeIndex === -1 ? { json: [jsonStart, jsonEnd], bodyEnd: text.length, end: text.length } : { json: [jsonStart, jsonEnd], bodyEnd: closeIndex, end: closeIndex + XML_TOOL_CALL_CLOSE.length };
|
|
185001
|
+
}
|
|
185002
|
+
function xmlToolCallBlockMarkup(block) {
|
|
185003
|
+
if (!block.startsWith(XML_TOOL_CALL_OPEN))
|
|
185004
|
+
return block;
|
|
185005
|
+
const envelope = findJsonEnvelopeBody(block, XML_TOOL_CALL_OPEN.length);
|
|
185006
|
+
if (envelope?.end !== block.length)
|
|
185007
|
+
return block;
|
|
185008
|
+
return block.slice(0, envelope.json[0]) + block.slice(envelope.json[1]);
|
|
185009
|
+
}
|
|
185010
|
+
function findStandardXmlToolCallBlocks(text) {
|
|
185011
|
+
const blocks = [];
|
|
185012
|
+
let start = text.indexOf(XML_TOOL_CALL_OPEN);
|
|
185013
|
+
while (start !== -1) {
|
|
185014
|
+
const bodyStart = start + XML_TOOL_CALL_OPEN.length;
|
|
185015
|
+
const envelope = findJsonEnvelopeBody(text, bodyStart);
|
|
185016
|
+
let end;
|
|
185017
|
+
if (envelope) {
|
|
185018
|
+
end = envelope.end;
|
|
185019
|
+
blocks.push({
|
|
185020
|
+
range: [start, end],
|
|
185021
|
+
inner: text.slice(bodyStart, envelope.bodyEnd),
|
|
185022
|
+
json: text.slice(envelope.json[0], envelope.json[1])
|
|
185023
|
+
});
|
|
185024
|
+
} else {
|
|
185025
|
+
const closeIndex = text.indexOf(XML_TOOL_CALL_CLOSE, bodyStart);
|
|
185026
|
+
const bodyEnd = closeIndex === -1 ? text.length : closeIndex;
|
|
185027
|
+
end = closeIndex === -1 ? text.length : closeIndex + XML_TOOL_CALL_CLOSE.length;
|
|
185028
|
+
blocks.push({ range: [start, end], inner: text.slice(bodyStart, bodyEnd) });
|
|
185029
|
+
}
|
|
185030
|
+
start = text.indexOf(XML_TOOL_CALL_OPEN, end);
|
|
185031
|
+
}
|
|
185032
|
+
return blocks;
|
|
185033
|
+
}
|
|
185034
|
+
function findXmlToolCallBlockRanges(text, allowHy3 = false) {
|
|
185035
|
+
const ranges = findStandardXmlToolCallBlocks(text).map((block) => block.range);
|
|
185036
|
+
if (allowHy3) {
|
|
185037
|
+
for (const blockRe of [HY3_TOOL_CALLS_BLOCK_RE, HY3_TOOL_CALL_BLOCK_RE]) {
|
|
185038
|
+
for (const block of text.matchAll(blockRe)) {
|
|
185039
|
+
ranges.push([block.index, block.index + block[0].length]);
|
|
185040
|
+
}
|
|
185041
|
+
}
|
|
185042
|
+
}
|
|
185043
|
+
return ranges.sort((left, right) => left[0] - right[0] || right[1] - left[1]);
|
|
185044
|
+
}
|
|
185045
|
+
function parseStandardXmlToolCallInner(inner, envelopeJson) {
|
|
185046
|
+
let name;
|
|
185047
|
+
const args = {};
|
|
185048
|
+
const trimmedInner = inner.trim();
|
|
185049
|
+
const isJsonEnvelope = envelopeJson !== undefined;
|
|
185050
|
+
const fnMatch = isJsonEnvelope ? null : inner.match(XML_FUNCTION_NAME_RE);
|
|
185051
|
+
if (fnMatch) {
|
|
185052
|
+
name = fnMatch[1];
|
|
185053
|
+
for (const p of inner.matchAll(XML_PARAMETER_RE)) {
|
|
185054
|
+
const key = p[1];
|
|
185055
|
+
if (key)
|
|
185056
|
+
args[key] = coerceXmlToolValue(p[2] ?? "");
|
|
185057
|
+
}
|
|
185058
|
+
} else {
|
|
185059
|
+
const argPairs = [...inner.matchAll(XML_ARG_PAIR_RE)];
|
|
185060
|
+
if (argPairs.length > 0 && !isJsonEnvelope && !trimmedInner.startsWith("{")) {
|
|
185061
|
+
const nameTok = trimmedInner.split(/[\n<]/, 1)[0]?.trim();
|
|
185062
|
+
if (nameTok)
|
|
185063
|
+
name = nameTok;
|
|
185064
|
+
for (const p of argPairs) {
|
|
185065
|
+
const key = (p[1] ?? "").trim();
|
|
185066
|
+
if (key)
|
|
185067
|
+
args[key] = coerceXmlToolValue(p[2] ?? "");
|
|
185068
|
+
}
|
|
185069
|
+
} else if (isJsonEnvelope) {
|
|
185070
|
+
const obj = JSON.parse(envelopeJson);
|
|
185071
|
+
if (typeof obj["name"] === "string") {
|
|
185072
|
+
name = obj["name"];
|
|
185073
|
+
const rawArgs = obj["arguments"];
|
|
185074
|
+
if (typeof rawArgs === "string") {
|
|
185075
|
+
try {
|
|
185076
|
+
Object.assign(args, JSON.parse(rawArgs));
|
|
185077
|
+
} catch {}
|
|
185078
|
+
} else if (rawArgs && typeof rawArgs === "object") {
|
|
185079
|
+
Object.assign(args, rawArgs);
|
|
185080
|
+
}
|
|
185081
|
+
}
|
|
185082
|
+
}
|
|
185083
|
+
}
|
|
185084
|
+
return { name, args };
|
|
185085
|
+
}
|
|
185086
|
+
function parseXmlToolCalls(text, allowHy3, nextSequence) {
|
|
185087
|
+
const results = [];
|
|
185088
|
+
const seen = new Set;
|
|
185089
|
+
const ranges = [];
|
|
185090
|
+
const addCall = (name, args) => {
|
|
185091
|
+
const dedupKey = `${name}:${JSON.stringify(args)}`;
|
|
185092
|
+
if (seen.has(dedupKey))
|
|
185093
|
+
return;
|
|
185094
|
+
seen.add(dedupKey);
|
|
185095
|
+
results.push({ id: `xml_tc_${nextSequence()}`, name, arguments: args });
|
|
185096
|
+
};
|
|
185097
|
+
const hy3Blocks = allowHy3 ? [...text.matchAll(HY3_TOOL_CALL_BLOCK_RE)].map((block) => ({
|
|
185098
|
+
range: [block.index, block.index + block[0].length],
|
|
185099
|
+
parsed: parseHy3ToolCallInner(block[1] ?? "")
|
|
185100
|
+
})) : [];
|
|
185101
|
+
const hy3WrapperRanges = allowHy3 ? [...text.matchAll(HY3_TOOL_CALLS_BLOCK_RE)].filter((wrapper) => {
|
|
185102
|
+
const range = [
|
|
185103
|
+
wrapper.index,
|
|
185104
|
+
wrapper.index + wrapper[0].length
|
|
185105
|
+
];
|
|
185106
|
+
return hy3Blocks.some((block) => block.parsed.name && range[0] <= block.range[0] && block.range[1] <= range[1]);
|
|
185107
|
+
}).map((wrapper) => [
|
|
185108
|
+
wrapper.index,
|
|
185109
|
+
wrapper.index + wrapper[0].length
|
|
185110
|
+
]) : [];
|
|
185111
|
+
const candidates = [];
|
|
185112
|
+
for (const block of hy3Blocks) {
|
|
185113
|
+
const { name, args } = block.parsed;
|
|
185114
|
+
if (!name)
|
|
185115
|
+
continue;
|
|
185116
|
+
const range = block.range;
|
|
185117
|
+
candidates.push({
|
|
185118
|
+
range,
|
|
185119
|
+
name,
|
|
185120
|
+
args,
|
|
185121
|
+
coveredByWrapper: hy3WrapperRanges.some((wrapper) => wrapper[0] <= range[0] && range[1] <= wrapper[1])
|
|
185122
|
+
});
|
|
185123
|
+
}
|
|
185124
|
+
for (const { range, inner, json: json2 } of findStandardXmlToolCallBlocks(text)) {
|
|
185125
|
+
const { name, args } = parseStandardXmlToolCallInner(inner, json2);
|
|
185126
|
+
if (!name)
|
|
185127
|
+
continue;
|
|
185128
|
+
candidates.push({
|
|
185129
|
+
range,
|
|
185130
|
+
name,
|
|
185131
|
+
args,
|
|
185132
|
+
coveredByWrapper: false
|
|
185133
|
+
});
|
|
185134
|
+
}
|
|
185135
|
+
candidates.sort((left, right) => left.range[0] - right.range[0]);
|
|
185136
|
+
for (const candidate of candidates) {
|
|
185137
|
+
addCall(candidate.name, candidate.args);
|
|
185138
|
+
if (!candidate.coveredByWrapper) {
|
|
185139
|
+
ranges.push(candidate.range);
|
|
185140
|
+
}
|
|
185141
|
+
}
|
|
185142
|
+
ranges.push(...hy3WrapperRanges);
|
|
185143
|
+
ranges.sort((left, right) => left[0] - right[0]);
|
|
185144
|
+
return { calls: results, toolCallRanges: ranges };
|
|
185145
|
+
}
|
|
185146
|
+
var HY3_PARAMETER_RE, HY3_NAMED_ARGUMENT_LINE_RE, HY3_ARG_PAIR_RE, XML_TOOL_CALL_OPEN = "<tool_call>", HY3_TOOL_CALLS_OPEN = "<tool_calls:", HY3_TOOL_CALL_OPEN = "<tool_call:", XML_TOOL_CALL_OPENERS, XML_TOOL_CALL_CLOSE = "</tool_call>", XML_ARG_KEY_OPEN = "<arg_key>", HY3_TOOL_CALLS_BLOCK_RE, HY3_TOOL_CALL_BLOCK_RE, XML_FUNCTION_NAME_RE, XML_PARAMETER_RE, XML_ARG_PAIR_RE;
|
|
185147
|
+
var init_xmlToolCallParsing = __esm(() => {
|
|
185148
|
+
init_rawToolCallParsing();
|
|
185149
|
+
HY3_PARAMETER_RE = /<parameter\s+name=["']([^"'>\s]+)["']\s*>([\s\S]*?)<\/parameter>/g;
|
|
185150
|
+
HY3_NAMED_ARGUMENT_LINE_RE = /^\s*([A-Za-z_][\w-]*)\s*:\s*(.+?)\s*$/gm;
|
|
185151
|
+
HY3_ARG_PAIR_RE = /<arg_key(?::[^>\s]+)?>([\s\S]*?)<\/arg_key(?::[^>\s]+)?>\s*<arg_value(?::[^>\s]+)?>([\s\S]*?)<\/arg_value(?::[^>\s]+)?>/g;
|
|
185152
|
+
XML_TOOL_CALL_OPENERS = [
|
|
185153
|
+
XML_TOOL_CALL_OPEN,
|
|
185154
|
+
HY3_TOOL_CALLS_OPEN,
|
|
185155
|
+
HY3_TOOL_CALL_OPEN
|
|
185156
|
+
];
|
|
185157
|
+
HY3_TOOL_CALLS_BLOCK_RE = /<tool_calls:[^>\s]+>([\s\S]*?)(?:<\/tool_calls(?::[^>\s]+)?>|$)/g;
|
|
185158
|
+
HY3_TOOL_CALL_BLOCK_RE = /<tool_call:[^>\s]+>([\s\S]*?)(?:<\/tool_call(?::[^>\s]+)?>|$)/g;
|
|
185159
|
+
XML_FUNCTION_NAME_RE = /<function=([^>\s]+)\s*>/;
|
|
185160
|
+
XML_PARAMETER_RE = /<parameter=([^>\s]+)\s*>([\s\S]*?)<\/parameter>/g;
|
|
185161
|
+
XML_ARG_PAIR_RE = /<arg_key>([\s\S]*?)<\/arg_key>\s*<arg_value>([\s\S]*?)<\/arg_value>/g;
|
|
185162
|
+
});
|
|
185163
|
+
|
|
184662
185164
|
// src/services/api/openaiShim/streamConversion.ts
|
|
184663
185165
|
import { APIError as APIError6 } from "@anthropic-ai/sdk";
|
|
185166
|
+
function reasoningMarkupTouchesBlock(text, start, block) {
|
|
185167
|
+
const markup = xmlToolCallBlockMarkup(block);
|
|
185168
|
+
if (stripThinkTags(markup) !== markup)
|
|
185169
|
+
return true;
|
|
185170
|
+
const lastTagEnd = start > 0 ? text.lastIndexOf(">", start - 1) : -1;
|
|
185171
|
+
const openerTail = text.slice(lastTagEnd + 1, text.indexOf(">", start) + 1);
|
|
185172
|
+
return stripThinkTags(openerTail) !== openerTail;
|
|
185173
|
+
}
|
|
185174
|
+
function visibleTextKeepingToolCallBlocks(text, blockRanges) {
|
|
185175
|
+
const filter2 = createThinkTagFilter();
|
|
185176
|
+
let visible = "";
|
|
185177
|
+
let position = 0;
|
|
185178
|
+
for (const [start, end] of blockRanges) {
|
|
185179
|
+
if (start < position) {
|
|
185180
|
+
if (end > position)
|
|
185181
|
+
return null;
|
|
185182
|
+
continue;
|
|
185183
|
+
}
|
|
185184
|
+
const block = text.slice(start, end);
|
|
185185
|
+
if (reasoningMarkupTouchesBlock(text, start, block))
|
|
185186
|
+
return null;
|
|
185187
|
+
const before = filter2.feed(text.slice(position, start) + TOOL_CALL_BLOCK_BOUNDARY);
|
|
185188
|
+
if (filter2.isInsideBlock()) {
|
|
185189
|
+
visible += before;
|
|
185190
|
+
} else {
|
|
185191
|
+
visible += before.slice(0, -1) + block;
|
|
185192
|
+
}
|
|
185193
|
+
position = end;
|
|
185194
|
+
}
|
|
185195
|
+
return visible + filter2.feed(text.slice(position));
|
|
185196
|
+
}
|
|
184664
185197
|
function convertOpenAIStreamUsage(usage) {
|
|
184665
185198
|
if (!usage)
|
|
184666
185199
|
return;
|
|
@@ -184673,24 +185206,24 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
|
|
|
184673
185206
|
createReaderCanceller: createReaderCanceller2,
|
|
184674
185207
|
createProviderStreamTrace: createProviderStreamTrace2,
|
|
184675
185208
|
createStreamAbortError: createStreamAbortError2,
|
|
184676
|
-
findXmlToolCallOpener,
|
|
185209
|
+
findXmlToolCallOpener: findXmlToolCallOpener2,
|
|
184677
185210
|
geminiThoughtSignatureFromExtraContent: geminiThoughtSignatureFromExtraContent2,
|
|
184678
185211
|
getStreamIdleTimeoutMs: getStreamIdleTimeoutMs2,
|
|
184679
185212
|
headersWithRequestUrl,
|
|
184680
|
-
isHy3Model,
|
|
185213
|
+
isHy3Model: isHy3Model2,
|
|
184681
185214
|
makeMessageId: makeMessageId2,
|
|
184682
185215
|
mergeGeminiThoughtSignature: mergeGeminiThoughtSignature2,
|
|
184683
185216
|
parseRawToolCallsRequestedText: parseRawToolCallsRequestedText2,
|
|
184684
185217
|
parseTextToolCalls: parseTextToolCalls2,
|
|
184685
|
-
parseXmlToolCalls,
|
|
185218
|
+
parseXmlToolCalls: parseXmlToolCalls2,
|
|
184686
185219
|
readWithIdleTimeout: readWithIdleTimeout2,
|
|
184687
185220
|
repairPossiblyTruncatedObjectJson: repairPossiblyTruncatedObjectJson2,
|
|
184688
185221
|
stripRanges: stripRanges2,
|
|
184689
185222
|
throwIfStreamAborted: throwIfStreamAborted2,
|
|
184690
|
-
trailingXmlOpenerPrefixLen
|
|
185223
|
+
trailingXmlOpenerPrefixLen: trailingXmlOpenerPrefixLen2
|
|
184691
185224
|
} = dependencies2;
|
|
184692
185225
|
const messageId = makeMessageId2();
|
|
184693
|
-
const allowHy3ToolCalls =
|
|
185226
|
+
const allowHy3ToolCalls = isHy3Model2(model);
|
|
184694
185227
|
let contentBlockIndex = 0;
|
|
184695
185228
|
const activeToolCalls = new Map;
|
|
184696
185229
|
let hasEmittedContentStart = false;
|
|
@@ -185063,7 +185596,7 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
|
|
|
185063
185596
|
}
|
|
185064
185597
|
} else {
|
|
185065
185598
|
const combined = xmlHoldback + delta.content;
|
|
185066
|
-
const openIdx =
|
|
185599
|
+
const openIdx = findXmlToolCallOpener2(combined, allowHy3ToolCalls);
|
|
185067
185600
|
if (openIdx !== -1) {
|
|
185068
185601
|
const before = combined.slice(0, openIdx);
|
|
185069
185602
|
if (before)
|
|
@@ -185071,7 +185604,7 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
|
|
|
185071
185604
|
xmlHoldback = "";
|
|
185072
185605
|
xmlToolCallText = combined.slice(openIdx);
|
|
185073
185606
|
} else {
|
|
185074
|
-
const keep =
|
|
185607
|
+
const keep = trailingXmlOpenerPrefixLen2(combined, allowHy3ToolCalls);
|
|
185075
185608
|
const emit = keep > 0 ? combined.slice(0, combined.length - keep) : combined;
|
|
185076
185609
|
xmlHoldback = keep > 0 ? combined.slice(combined.length - keep) : "";
|
|
185077
185610
|
if (emit)
|
|
@@ -185199,10 +185732,25 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
|
|
|
185199
185732
|
const originalFinishReason = choice.finish_reason;
|
|
185200
185733
|
let ollamaClosedContentBlock = false;
|
|
185201
185734
|
if (isTerminalOllamaFinish) {
|
|
185202
|
-
|
|
185735
|
+
let toolCallSource = accumulatedText;
|
|
185736
|
+
let { calls: textToolCalls, toolCallRanges } = parseTextToolCalls2(accumulatedText);
|
|
185737
|
+
if (textToolCalls.length === 0) {
|
|
185738
|
+
({ calls: textToolCalls, toolCallRanges } = parseXmlToolCalls2(accumulatedText, allowHy3ToolCalls));
|
|
185739
|
+
const visibleSource = textToolCalls.length > 0 ? visibleTextKeepingToolCallBlocks(accumulatedText, findXmlToolCallBlockRanges(accumulatedText, allowHy3ToolCalls)) : accumulatedText;
|
|
185740
|
+
const callKey = (tc) => `${tc.name}\x00${JSON.stringify(tc.arguments)}`;
|
|
185741
|
+
const rawCallKeys = new Set(textToolCalls.map(callKey));
|
|
185742
|
+
if (visibleSource !== null && visibleSource !== accumulatedText) {
|
|
185743
|
+
toolCallSource = visibleSource;
|
|
185744
|
+
({ calls: textToolCalls, toolCallRanges } = parseXmlToolCalls2(toolCallSource, allowHy3ToolCalls));
|
|
185745
|
+
}
|
|
185746
|
+
if (visibleSource === null || textToolCalls.some((tc) => !rawCallKeys.has(callKey(tc)))) {
|
|
185747
|
+
textToolCalls = [];
|
|
185748
|
+
toolCallRanges = [];
|
|
185749
|
+
}
|
|
185750
|
+
}
|
|
185203
185751
|
if (textToolCalls.length > 0) {
|
|
185204
185752
|
ollamaClosedContentBlock = true;
|
|
185205
|
-
const stripped = stripRanges2(
|
|
185753
|
+
const stripped = stripRanges2(toolCallSource, toolCallRanges).trim();
|
|
185206
185754
|
const strippedVisible = stripThinkTags(stripped).trim();
|
|
185207
185755
|
if (hasEmittedContentStart) {
|
|
185208
185756
|
if (strippedVisible) {
|
|
@@ -185273,7 +185821,7 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
|
|
|
185273
185821
|
if (!isOllamaStream && xmlToolCallText !== null) {
|
|
185274
185822
|
const buffered = xmlToolCallText;
|
|
185275
185823
|
xmlToolCallText = null;
|
|
185276
|
-
const { calls, toolCallRanges } =
|
|
185824
|
+
const { calls, toolCallRanges } = parseXmlToolCalls2(buffered, allowHy3ToolCalls);
|
|
185277
185825
|
if (calls.length > 0) {
|
|
185278
185826
|
const stripped = stripRanges2(buffered, toolCallRanges).trim();
|
|
185279
185827
|
const strippedVisible = stripThinkTags(stripped).trim();
|
|
@@ -185471,13 +186019,14 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
|
|
|
185471
186019
|
throwIfStreamAborted2(signal);
|
|
185472
186020
|
yield { type: "message_stop" };
|
|
185473
186021
|
}
|
|
185474
|
-
var JSON_REPAIR_SUFFIXES2;
|
|
186022
|
+
var JSON_REPAIR_SUFFIXES2, TOOL_CALL_BLOCK_BOUNDARY = "\x00";
|
|
185475
186023
|
var init_streamConversion = __esm(() => {
|
|
185476
186024
|
init_cacheMetrics();
|
|
185477
186025
|
init_openaiErrorClassification();
|
|
185478
186026
|
init_thinkTagSanitizer();
|
|
185479
186027
|
init_toolArgumentNormalization();
|
|
185480
186028
|
init_debug();
|
|
186029
|
+
init_xmlToolCallParsing();
|
|
185481
186030
|
JSON_REPAIR_SUFFIXES2 = [
|
|
185482
186031
|
"}",
|
|
185483
186032
|
'"}',
|
|
@@ -185732,203 +186281,6 @@ var init_geminiStreamConversion = __esm(() => {
|
|
|
185732
186281
|
init_debug();
|
|
185733
186282
|
});
|
|
185734
186283
|
|
|
185735
|
-
// src/services/api/openaiShim/xmlToolCallParsing.ts
|
|
185736
|
-
function coerceXmlToolValue(raw) {
|
|
185737
|
-
const trimmed = raw.trim();
|
|
185738
|
-
if (trimmed === "")
|
|
185739
|
-
return "";
|
|
185740
|
-
try {
|
|
185741
|
-
return JSON.parse(trimmed);
|
|
185742
|
-
} catch {
|
|
185743
|
-
return raw;
|
|
185744
|
-
}
|
|
185745
|
-
}
|
|
185746
|
-
function parseHy3ToolCallInner(inner) {
|
|
185747
|
-
const args = {};
|
|
185748
|
-
const trimmed = inner.trim();
|
|
185749
|
-
const name = trimmed.split(/[\n<]/, 1)[0]?.trim().replace(/[\s`*_]+$/, "");
|
|
185750
|
-
let hasStructuredArguments = false;
|
|
185751
|
-
for (const parameter of inner.matchAll(HY3_PARAMETER_RE)) {
|
|
185752
|
-
const key = parameter[1];
|
|
185753
|
-
if (key) {
|
|
185754
|
-
hasStructuredArguments = true;
|
|
185755
|
-
args[key] = coerceXmlToolValue(parameter[2] ?? "");
|
|
185756
|
-
}
|
|
185757
|
-
}
|
|
185758
|
-
for (const line of inner.matchAll(HY3_NAMED_ARGUMENT_LINE_RE)) {
|
|
185759
|
-
const key = line[1];
|
|
185760
|
-
if (key) {
|
|
185761
|
-
hasStructuredArguments = true;
|
|
185762
|
-
args[key] = coerceXmlToolValue(line[2] ?? "");
|
|
185763
|
-
}
|
|
185764
|
-
}
|
|
185765
|
-
for (const pair of inner.matchAll(HY3_ARG_PAIR_RE)) {
|
|
185766
|
-
const key = pair[1]?.trim();
|
|
185767
|
-
if (key) {
|
|
185768
|
-
hasStructuredArguments = true;
|
|
185769
|
-
args[key] = coerceXmlToolValue(pair[2] ?? "");
|
|
185770
|
-
}
|
|
185771
|
-
}
|
|
185772
|
-
return {
|
|
185773
|
-
name: name && /^[A-Za-z_][\w.-]*$/.test(name) && (hasStructuredArguments || trimmed === name) ? name : undefined,
|
|
185774
|
-
args
|
|
185775
|
-
};
|
|
185776
|
-
}
|
|
185777
|
-
function isHy3Model(model) {
|
|
185778
|
-
return model.split("?", 1)[0]?.toLowerCase() === "tencent/hy3";
|
|
185779
|
-
}
|
|
185780
|
-
function trailingXmlOpenerPrefixLen(s, allowHy3) {
|
|
185781
|
-
let longest = 0;
|
|
185782
|
-
const openers = allowHy3 ? XML_TOOL_CALL_OPENERS : [XML_TOOL_CALL_OPEN];
|
|
185783
|
-
for (const opener of openers) {
|
|
185784
|
-
const max2 = Math.min(s.length, opener.length - 1);
|
|
185785
|
-
for (let len = max2;len > 0; len--) {
|
|
185786
|
-
if (opener.startsWith(s.slice(s.length - len))) {
|
|
185787
|
-
longest = Math.max(longest, len);
|
|
185788
|
-
break;
|
|
185789
|
-
}
|
|
185790
|
-
}
|
|
185791
|
-
}
|
|
185792
|
-
return longest;
|
|
185793
|
-
}
|
|
185794
|
-
function findXmlToolCallOpener(text, allowHy3) {
|
|
185795
|
-
const openers = allowHy3 ? XML_TOOL_CALL_OPENERS : [XML_TOOL_CALL_OPEN];
|
|
185796
|
-
return openers.reduce((first, opener) => {
|
|
185797
|
-
const index = text.indexOf(opener);
|
|
185798
|
-
return index === -1 ? first : first === -1 ? index : Math.min(first, index);
|
|
185799
|
-
}, -1);
|
|
185800
|
-
}
|
|
185801
|
-
function parseStandardXmlToolCallInner(inner) {
|
|
185802
|
-
let name;
|
|
185803
|
-
const args = {};
|
|
185804
|
-
const fnMatch = inner.match(XML_FUNCTION_NAME_RE);
|
|
185805
|
-
if (fnMatch) {
|
|
185806
|
-
name = fnMatch[1];
|
|
185807
|
-
for (const p of inner.matchAll(XML_PARAMETER_RE)) {
|
|
185808
|
-
const key = p[1];
|
|
185809
|
-
if (key)
|
|
185810
|
-
args[key] = coerceXmlToolValue(p[2] ?? "");
|
|
185811
|
-
}
|
|
185812
|
-
} else {
|
|
185813
|
-
const trimmedInner = inner.trim();
|
|
185814
|
-
const argPairs = [...inner.matchAll(XML_ARG_PAIR_RE)];
|
|
185815
|
-
if (argPairs.length > 0 && !trimmedInner.startsWith("{")) {
|
|
185816
|
-
const nameTok = trimmedInner.split(/[\n<]/, 1)[0]?.trim();
|
|
185817
|
-
if (nameTok)
|
|
185818
|
-
name = nameTok;
|
|
185819
|
-
for (const p of argPairs) {
|
|
185820
|
-
const key = (p[1] ?? "").trim();
|
|
185821
|
-
if (key)
|
|
185822
|
-
args[key] = coerceXmlToolValue(p[2] ?? "");
|
|
185823
|
-
}
|
|
185824
|
-
} else {
|
|
185825
|
-
const jsonStart = trimmedInner.indexOf("{");
|
|
185826
|
-
if (jsonStart !== -1) {
|
|
185827
|
-
const jsonRaw = extractBalancedJson(trimmedInner, jsonStart);
|
|
185828
|
-
if (jsonRaw) {
|
|
185829
|
-
try {
|
|
185830
|
-
const obj = JSON.parse(jsonRaw);
|
|
185831
|
-
if (typeof obj["name"] === "string") {
|
|
185832
|
-
name = obj["name"];
|
|
185833
|
-
const rawArgs = obj["arguments"];
|
|
185834
|
-
if (typeof rawArgs === "string") {
|
|
185835
|
-
try {
|
|
185836
|
-
Object.assign(args, JSON.parse(rawArgs));
|
|
185837
|
-
} catch {}
|
|
185838
|
-
} else if (rawArgs && typeof rawArgs === "object") {
|
|
185839
|
-
Object.assign(args, rawArgs);
|
|
185840
|
-
}
|
|
185841
|
-
}
|
|
185842
|
-
} catch {}
|
|
185843
|
-
}
|
|
185844
|
-
}
|
|
185845
|
-
}
|
|
185846
|
-
}
|
|
185847
|
-
return { name, args };
|
|
185848
|
-
}
|
|
185849
|
-
function parseXmlToolCalls(text, allowHy3, nextSequence) {
|
|
185850
|
-
const results = [];
|
|
185851
|
-
const seen = new Set;
|
|
185852
|
-
const ranges = [];
|
|
185853
|
-
const addCall = (name, args) => {
|
|
185854
|
-
const dedupKey = `${name}:${JSON.stringify(args)}`;
|
|
185855
|
-
if (seen.has(dedupKey))
|
|
185856
|
-
return;
|
|
185857
|
-
seen.add(dedupKey);
|
|
185858
|
-
results.push({ id: `xml_tc_${nextSequence()}`, name, arguments: args });
|
|
185859
|
-
};
|
|
185860
|
-
const hy3Blocks = allowHy3 ? [...text.matchAll(HY3_TOOL_CALL_BLOCK_RE)].map((block) => ({
|
|
185861
|
-
range: [block.index, block.index + block[0].length],
|
|
185862
|
-
parsed: parseHy3ToolCallInner(block[1] ?? "")
|
|
185863
|
-
})) : [];
|
|
185864
|
-
const hy3WrapperRanges = allowHy3 ? [...text.matchAll(HY3_TOOL_CALLS_BLOCK_RE)].filter((wrapper) => {
|
|
185865
|
-
const range = [
|
|
185866
|
-
wrapper.index,
|
|
185867
|
-
wrapper.index + wrapper[0].length
|
|
185868
|
-
];
|
|
185869
|
-
return hy3Blocks.some((block) => block.parsed.name && range[0] <= block.range[0] && block.range[1] <= range[1]);
|
|
185870
|
-
}).map((wrapper) => [
|
|
185871
|
-
wrapper.index,
|
|
185872
|
-
wrapper.index + wrapper[0].length
|
|
185873
|
-
]) : [];
|
|
185874
|
-
const candidates = [];
|
|
185875
|
-
for (const block of hy3Blocks) {
|
|
185876
|
-
const { name, args } = block.parsed;
|
|
185877
|
-
if (!name)
|
|
185878
|
-
continue;
|
|
185879
|
-
const range = block.range;
|
|
185880
|
-
candidates.push({
|
|
185881
|
-
range,
|
|
185882
|
-
name,
|
|
185883
|
-
args,
|
|
185884
|
-
coveredByWrapper: hy3WrapperRanges.some((wrapper) => wrapper[0] <= range[0] && range[1] <= wrapper[1])
|
|
185885
|
-
});
|
|
185886
|
-
}
|
|
185887
|
-
for (const block of text.matchAll(XML_TOOL_CALL_BLOCK_RE)) {
|
|
185888
|
-
const range = [
|
|
185889
|
-
block.index,
|
|
185890
|
-
block.index + block[0].length
|
|
185891
|
-
];
|
|
185892
|
-
const { name, args } = parseStandardXmlToolCallInner(block[1] ?? "");
|
|
185893
|
-
if (!name)
|
|
185894
|
-
continue;
|
|
185895
|
-
candidates.push({
|
|
185896
|
-
range,
|
|
185897
|
-
name,
|
|
185898
|
-
args,
|
|
185899
|
-
coveredByWrapper: false
|
|
185900
|
-
});
|
|
185901
|
-
}
|
|
185902
|
-
candidates.sort((left, right) => left.range[0] - right.range[0]);
|
|
185903
|
-
for (const candidate of candidates) {
|
|
185904
|
-
addCall(candidate.name, candidate.args);
|
|
185905
|
-
if (!candidate.coveredByWrapper) {
|
|
185906
|
-
ranges.push(candidate.range);
|
|
185907
|
-
}
|
|
185908
|
-
}
|
|
185909
|
-
ranges.push(...hy3WrapperRanges);
|
|
185910
|
-
ranges.sort((left, right) => left[0] - right[0]);
|
|
185911
|
-
return { calls: results, toolCallRanges: ranges };
|
|
185912
|
-
}
|
|
185913
|
-
var HY3_PARAMETER_RE, HY3_NAMED_ARGUMENT_LINE_RE, HY3_ARG_PAIR_RE, XML_TOOL_CALL_OPEN = "<tool_call>", HY3_TOOL_CALLS_OPEN = "<tool_calls:", HY3_TOOL_CALL_OPEN = "<tool_call:", XML_TOOL_CALL_OPENERS, XML_TOOL_CALL_BLOCK_RE, HY3_TOOL_CALLS_BLOCK_RE, HY3_TOOL_CALL_BLOCK_RE, XML_FUNCTION_NAME_RE, XML_PARAMETER_RE, XML_ARG_PAIR_RE;
|
|
185914
|
-
var init_xmlToolCallParsing = __esm(() => {
|
|
185915
|
-
init_rawToolCallParsing();
|
|
185916
|
-
HY3_PARAMETER_RE = /<parameter\s+name=["']([^"'>\s]+)["']\s*>([\s\S]*?)<\/parameter>/g;
|
|
185917
|
-
HY3_NAMED_ARGUMENT_LINE_RE = /^\s*([A-Za-z_][\w-]*)\s*:\s*(.+?)\s*$/gm;
|
|
185918
|
-
HY3_ARG_PAIR_RE = /<arg_key(?::[^>\s]+)?>([\s\S]*?)<\/arg_key(?::[^>\s]+)?>\s*<arg_value(?::[^>\s]+)?>([\s\S]*?)<\/arg_value(?::[^>\s]+)?>/g;
|
|
185919
|
-
XML_TOOL_CALL_OPENERS = [
|
|
185920
|
-
XML_TOOL_CALL_OPEN,
|
|
185921
|
-
HY3_TOOL_CALLS_OPEN,
|
|
185922
|
-
HY3_TOOL_CALL_OPEN
|
|
185923
|
-
];
|
|
185924
|
-
XML_TOOL_CALL_BLOCK_RE = /<tool_call>([\s\S]*?)(?:<\/tool_call>|$)/g;
|
|
185925
|
-
HY3_TOOL_CALLS_BLOCK_RE = /<tool_calls:[^>\s]+>([\s\S]*?)(?:<\/tool_calls(?::[^>\s]+)?>|$)/g;
|
|
185926
|
-
HY3_TOOL_CALL_BLOCK_RE = /<tool_call:[^>\s]+>([\s\S]*?)(?:<\/tool_call(?::[^>\s]+)?>|$)/g;
|
|
185927
|
-
XML_FUNCTION_NAME_RE = /<function=([^>\s]+)\s*>/;
|
|
185928
|
-
XML_PARAMETER_RE = /<parameter=([^>\s]+)\s*>([\s\S]*?)<\/parameter>/g;
|
|
185929
|
-
XML_ARG_PAIR_RE = /<arg_key>([\s\S]*?)<\/arg_key>\s*<arg_value>([\s\S]*?)<\/arg_value>/g;
|
|
185930
|
-
});
|
|
185931
|
-
|
|
185932
186284
|
// src/services/api/openaiShim/responseAdapters.ts
|
|
185933
186285
|
function makeMessageId2() {
|
|
185934
186286
|
return `msg_${crypto.randomUUID().replace(/-/g, "")}`;
|
|
@@ -188119,7 +188471,7 @@ function computeFingerprint(messageText2, version2) {
|
|
|
188119
188471
|
}
|
|
188120
188472
|
function computeFingerprintFromMessages(messages) {
|
|
188121
188473
|
const firstMessageText = extractFirstMessageText(messages);
|
|
188122
|
-
return computeFingerprint(firstMessageText, "0.
|
|
188474
|
+
return computeFingerprint(firstMessageText, "0.34.0");
|
|
188123
188475
|
}
|
|
188124
188476
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
188125
188477
|
var init_fingerprint = () => {};
|
|
@@ -189602,7 +189954,7 @@ var init_client3 = __esm(() => {
|
|
|
189602
189954
|
const client = new Client({
|
|
189603
189955
|
name: "claude-code",
|
|
189604
189956
|
title: "OpenClaude",
|
|
189605
|
-
version: "0.
|
|
189957
|
+
version: "0.34.0",
|
|
189606
189958
|
description: "OpenClaude — coding-agent CLI for any LLM provider",
|
|
189607
189959
|
websiteUrl: PRODUCT_URL
|
|
189608
189960
|
}, {
|
|
@@ -288941,7 +289293,7 @@ function getAnthropicEnvMetadata() {
|
|
|
288941
289293
|
function getBuildAgeMinutes() {
|
|
288942
289294
|
if (false)
|
|
288943
289295
|
;
|
|
288944
|
-
const buildTime = new Date("2026-
|
|
289296
|
+
const buildTime = new Date("2026-11-08T14:26:41.014Z").getTime();
|
|
288945
289297
|
if (isNaN(buildTime))
|
|
288946
289298
|
return;
|
|
288947
289299
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -299445,7 +299797,7 @@ function Feedback({
|
|
|
299445
299797
|
platform: env2.platform,
|
|
299446
299798
|
gitRepo: envInfo.isGit,
|
|
299447
299799
|
terminal: env2.terminal,
|
|
299448
|
-
version: "0.
|
|
299800
|
+
version: "0.34.0",
|
|
299449
299801
|
transcript: normalizeMessagesForAPI(messages),
|
|
299450
299802
|
errors: sanitizedErrors,
|
|
299451
299803
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -299634,7 +299986,7 @@ function Feedback({
|
|
|
299634
299986
|
", ",
|
|
299635
299987
|
env2.terminal,
|
|
299636
299988
|
", v",
|
|
299637
|
-
"0.
|
|
299989
|
+
"0.34.0"
|
|
299638
299990
|
]
|
|
299639
299991
|
}, undefined, true, undefined, this)
|
|
299640
299992
|
]
|
|
@@ -299742,7 +300094,7 @@ ${sanitizedDescription}
|
|
|
299742
300094
|
` + `**Environment Info**
|
|
299743
300095
|
` + `- Platform: ${env2.platform}
|
|
299744
300096
|
` + `- Terminal: ${env2.terminal}
|
|
299745
|
-
` + `- Version: ${"0.
|
|
300097
|
+
` + `- Version: ${"0.34.0"}
|
|
299746
300098
|
` + feedbackIdLine + `
|
|
299747
300099
|
**Errors**
|
|
299748
300100
|
\`\`\`json
|
|
@@ -305645,7 +305997,7 @@ var init_user = __esm(() => {
|
|
|
305645
305997
|
deviceId,
|
|
305646
305998
|
sessionId: getSessionId(),
|
|
305647
305999
|
email: getEmail(),
|
|
305648
|
-
appVersion: "0.
|
|
306000
|
+
appVersion: "0.34.0",
|
|
305649
306001
|
platform: getHostPlatformForAnalytics(),
|
|
305650
306002
|
organizationUuid,
|
|
305651
306003
|
accountUuid,
|
|
@@ -306779,7 +307131,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
306779
307131
|
}
|
|
306780
307132
|
async function getDoctorDiagnostic() {
|
|
306781
307133
|
const installationType = await getCurrentInstallationType();
|
|
306782
|
-
const version2 = typeof MACRO !== "undefined" ? "0.
|
|
307134
|
+
const version2 = typeof MACRO !== "undefined" ? "0.34.0" : "unknown";
|
|
306783
307135
|
const installationPath = await getInstallationPath();
|
|
306784
307136
|
const invokedBinary = getInvokedBinary();
|
|
306785
307137
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -307490,8 +307842,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
307490
307842
|
const maxVersion = await getMaxVersion();
|
|
307491
307843
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
307492
307844
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
307493
|
-
if (gte("0.
|
|
307494
|
-
logForDebugging(`Native installer: current version ${"0.
|
|
307845
|
+
if (gte("0.34.0", maxVersion)) {
|
|
307846
|
+
logForDebugging(`Native installer: current version ${"0.34.0"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
307495
307847
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
307496
307848
|
latency_ms: Date.now() - startTime,
|
|
307497
307849
|
max_version: maxVersion,
|
|
@@ -307502,7 +307854,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
307502
307854
|
version2 = maxVersion;
|
|
307503
307855
|
}
|
|
307504
307856
|
}
|
|
307505
|
-
if (!forceReinstall && version2 === "0.
|
|
307857
|
+
if (!forceReinstall && version2 === "0.34.0" && await versionIsAvailable(version2) && await isPossibleClaudeBinary(executablePath)) {
|
|
307506
307858
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
307507
307859
|
logEvent("tengu_native_update_complete", {
|
|
307508
307860
|
latency_ms: Date.now() - startTime,
|
|
@@ -352835,7 +353187,7 @@ function buildPrimarySection() {
|
|
|
352835
353187
|
}, undefined, false, undefined, this);
|
|
352836
353188
|
return [{
|
|
352837
353189
|
label: "Version",
|
|
352838
|
-
value: "0.
|
|
353190
|
+
value: "0.34.0"
|
|
352839
353191
|
}, {
|
|
352840
353192
|
label: "Session name",
|
|
352841
353193
|
value: nameValue
|
|
@@ -360357,7 +360709,7 @@ function Config2({
|
|
|
360357
360709
|
}
|
|
360358
360710
|
}, undefined, false, undefined, this)
|
|
360359
360711
|
}, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsxDEV162(ChannelDowngradeDialog, {
|
|
360360
|
-
currentVersion: "0.
|
|
360712
|
+
currentVersion: "0.34.0",
|
|
360361
360713
|
onChoice: (choice) => {
|
|
360362
360714
|
setShowSubmenu(null);
|
|
360363
360715
|
setTabsHidden(false);
|
|
@@ -360369,7 +360721,7 @@ function Config2({
|
|
|
360369
360721
|
autoUpdatesChannel: "stable"
|
|
360370
360722
|
};
|
|
360371
360723
|
if (choice === "stay") {
|
|
360372
|
-
newSettings.minimumVersion = "0.
|
|
360724
|
+
newSettings.minimumVersion = "0.34.0";
|
|
360373
360725
|
}
|
|
360374
360726
|
updateSettingsForSource("userSettings", newSettings);
|
|
360375
360727
|
setSettingsData((prev_27) => ({
|
|
@@ -369456,21 +369808,21 @@ function readPackageManager(env4) {
|
|
|
369456
369808
|
}
|
|
369457
369809
|
function readMacroVersion() {
|
|
369458
369810
|
try {
|
|
369459
|
-
return "0.
|
|
369811
|
+
return "0.34.0";
|
|
369460
369812
|
} catch {
|
|
369461
369813
|
return;
|
|
369462
369814
|
}
|
|
369463
369815
|
}
|
|
369464
369816
|
function readMacroDisplayVersion() {
|
|
369465
369817
|
try {
|
|
369466
|
-
return "0.
|
|
369818
|
+
return "0.34.0";
|
|
369467
369819
|
} catch {
|
|
369468
369820
|
return;
|
|
369469
369821
|
}
|
|
369470
369822
|
}
|
|
369471
369823
|
function readMacroBuildTime() {
|
|
369472
369824
|
try {
|
|
369473
|
-
return "2026-
|
|
369825
|
+
return "2026-11-08T14:26:41.014Z";
|
|
369474
369826
|
} catch {
|
|
369475
369827
|
return;
|
|
369476
369828
|
}
|
|
@@ -443444,9 +443796,9 @@ function readLinuxProcessStartId(pid) {
|
|
|
443444
443796
|
return null;
|
|
443445
443797
|
}
|
|
443446
443798
|
}
|
|
443447
|
-
function readCommandProcessStartId(command9, args, prefix) {
|
|
443799
|
+
function readCommandProcessStartId(command9, args, prefix, timeoutMs) {
|
|
443448
443800
|
try {
|
|
443449
|
-
const result =
|
|
443801
|
+
const result = identityLookupSync(command9, args, {
|
|
443450
443802
|
encoding: "utf8",
|
|
443451
443803
|
env: {
|
|
443452
443804
|
...process.env,
|
|
@@ -443454,7 +443806,7 @@ function readCommandProcessStartId(command9, args, prefix) {
|
|
|
443454
443806
|
LC_ALL: "C",
|
|
443455
443807
|
TZ: "UTC"
|
|
443456
443808
|
},
|
|
443457
|
-
timeout:
|
|
443809
|
+
timeout: timeoutMs,
|
|
443458
443810
|
windowsHide: true
|
|
443459
443811
|
});
|
|
443460
443812
|
if (result.error || result.status !== 0)
|
|
@@ -443465,7 +443817,7 @@ function readCommandProcessStartId(command9, args, prefix) {
|
|
|
443465
443817
|
return null;
|
|
443466
443818
|
}
|
|
443467
443819
|
}
|
|
443468
|
-
function readProcessStartId(pid) {
|
|
443820
|
+
function readProcessStartId(pid, windowsTimeoutMs = WINDOWS_SETTINGS_LOCK_IDENTITY_LOOKUP_TIMEOUT_MS) {
|
|
443469
443821
|
if (process.platform === "linux")
|
|
443470
443822
|
return readLinuxProcessStartId(pid);
|
|
443471
443823
|
if (process.platform === "win32") {
|
|
@@ -443474,9 +443826,9 @@ function readProcessStartId(pid) {
|
|
|
443474
443826
|
"-NonInteractive",
|
|
443475
443827
|
"-Command",
|
|
443476
443828
|
`(Get-Process -Id ${pid} -ErrorAction Stop).StartTime.ToUniversalTime().Ticks`
|
|
443477
|
-
], "windows");
|
|
443829
|
+
], "windows", windowsTimeoutMs);
|
|
443478
443830
|
}
|
|
443479
|
-
return readCommandProcessStartId("ps", ["-p", String(pid), "-o", "lstart="], "posix");
|
|
443831
|
+
return readCommandProcessStartId("ps", ["-p", String(pid), "-o", "lstart="], "posix", SETTINGS_LOCK_IDENTITY_LOOKUP_TIMEOUT_MS);
|
|
443480
443832
|
}
|
|
443481
443833
|
function currentProcessStartId() {
|
|
443482
443834
|
if (settingsLockProcessStartId !== undefined) {
|
|
@@ -443515,7 +443867,7 @@ function isIdentityOwnerAlive(identity4, processStartIds) {
|
|
|
443515
443867
|
if (processStartIds.has(cacheKey)) {
|
|
443516
443868
|
currentProcessStartId2 = processStartIds.get(cacheKey) ?? null;
|
|
443517
443869
|
} else {
|
|
443518
|
-
currentProcessStartId2 = readProcessStartId(identity4.pid);
|
|
443870
|
+
currentProcessStartId2 = readProcessStartId(identity4.pid, SETTINGS_LOCK_IDENTITY_LOOKUP_TIMEOUT_MS);
|
|
443519
443871
|
processStartIds.set(cacheKey, currentProcessStartId2);
|
|
443520
443872
|
}
|
|
443521
443873
|
return currentProcessStartId2 === null || currentProcessStartId2 === identity4.processStartId;
|
|
@@ -443651,6 +444003,10 @@ function acquireSettingsLock(targetPath) {
|
|
|
443651
444003
|
}
|
|
443652
444004
|
const remaining = deadline - now2;
|
|
443653
444005
|
if (remaining <= 0) {
|
|
444006
|
+
if (tryPublishPendingLock(pendingPath, lockPath2)) {
|
|
444007
|
+
acquired = true;
|
|
444008
|
+
return () => releaseOwnedLock(lockPath2, owner);
|
|
444009
|
+
}
|
|
443654
444010
|
throw Object.assign(new Error(`Timed out after ${SETTINGS_LOCK_WAIT_MS}ms waiting for settings lock ${lockPath2}, held by ${describeCurrentOwner(lockPath2)}. If that process is known to have exited, remove the lock directory before retrying.`), { code: "ELOCKED" });
|
|
443655
444011
|
}
|
|
443656
444012
|
Atomics.wait(waitBuffer, 0, 0, Math.min(SETTINGS_LOCK_RETRY_MS, remaining));
|
|
@@ -443680,7 +444036,7 @@ function withSettingsFileTransactionSync(requestedPath, operation) {
|
|
|
443680
444036
|
release2();
|
|
443681
444037
|
return result;
|
|
443682
444038
|
}
|
|
443683
|
-
var SETTINGS_LOCK_RETRY_MS = 25, SETTINGS_LOCK_CONTENTION_LOG_MS = 100, SETTINGS_LOCK_WAIT_MS = 2000, SETTINGS_LOCK_HOST, SETTINGS_LOCK_OWNER_FILE = "owner.json", waitBuffer, settingsLockProcessStartId;
|
|
444039
|
+
var identityLookupSync, SETTINGS_LOCK_RETRY_MS = 25, SETTINGS_LOCK_CONTENTION_LOG_MS = 100, SETTINGS_LOCK_WAIT_MS = 2000, SETTINGS_LOCK_IDENTITY_LOOKUP_TIMEOUT_MS = 1000, WINDOWS_SETTINGS_LOCK_IDENTITY_LOOKUP_TIMEOUT_MS = 1e4, SETTINGS_LOCK_HOST, SETTINGS_LOCK_OWNER_FILE = "owner.json", waitBuffer, settingsLockProcessStartId;
|
|
443684
444040
|
var init_settingsFileTransaction = __esm(() => {
|
|
443685
444041
|
init_debug();
|
|
443686
444042
|
init_errors();
|
|
@@ -443688,6 +444044,7 @@ var init_settingsFileTransaction = __esm(() => {
|
|
|
443688
444044
|
init_fsOperations();
|
|
443689
444045
|
init_internalWrites();
|
|
443690
444046
|
init_settingsCache();
|
|
444047
|
+
identityLookupSync = spawnSync3;
|
|
443691
444048
|
SETTINGS_LOCK_HOST = hostname3();
|
|
443692
444049
|
waitBuffer = new Int32Array(new SharedArrayBuffer(4));
|
|
443693
444050
|
});
|
|
@@ -443920,7 +444277,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
443920
444277
|
smapsRollup,
|
|
443921
444278
|
platform: process.platform,
|
|
443922
444279
|
nodeVersion: process.version,
|
|
443923
|
-
ccVersion: "0.
|
|
444280
|
+
ccVersion: "0.34.0"
|
|
443924
444281
|
};
|
|
443925
444282
|
}
|
|
443926
444283
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -444187,7 +444544,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
444187
444544
|
var call75 = async () => {
|
|
444188
444545
|
return {
|
|
444189
444546
|
type: "text",
|
|
444190
|
-
value: `${"0.
|
|
444547
|
+
value: `${"0.34.0"} (built ${"2026-11-08T14:26:41.014Z"})`
|
|
444191
444548
|
};
|
|
444192
444549
|
}, version2, version_default;
|
|
444193
444550
|
var init_version2 = __esm(() => {
|
|
@@ -444753,7 +445110,7 @@ async function call76(onDone, _context, args) {
|
|
|
444753
445110
|
}, undefined, false, undefined, this));
|
|
444754
445111
|
return null;
|
|
444755
445112
|
}
|
|
444756
|
-
var PACKAGE_URL = "@rayss-dev/openclaude", CURRENT_VERSION = "0.
|
|
445113
|
+
var PACKAGE_URL = "@rayss-dev/openclaude", CURRENT_VERSION = "0.34.0";
|
|
444757
445114
|
var init_update = __esm(() => {
|
|
444758
445115
|
init_StatusIcon();
|
|
444759
445116
|
init_ink2();
|
|
@@ -456943,7 +457300,7 @@ function generateHtmlReport(data, insights) {
|
|
|
456943
457300
|
</html>`;
|
|
456944
457301
|
}
|
|
456945
457302
|
function buildExportData(data, insights, facets) {
|
|
456946
|
-
const version3 = typeof MACRO !== "undefined" ? "0.
|
|
457303
|
+
const version3 = typeof MACRO !== "undefined" ? "0.34.0" : "unknown";
|
|
456947
457304
|
const facets_summary = {
|
|
456948
457305
|
total: facets.size,
|
|
456949
457306
|
goal_categories: {},
|
|
@@ -458526,9 +458883,24 @@ function getEntrypoint() {
|
|
|
458526
458883
|
function isCustomTitleEnabled() {
|
|
458527
458884
|
return true;
|
|
458528
458885
|
}
|
|
458886
|
+
function followSessionSwitches() {
|
|
458887
|
+
if (unsubscribeSessionSwitch)
|
|
458888
|
+
return;
|
|
458889
|
+
pointerSessionId = getSessionId();
|
|
458890
|
+
pointerProjectDir = getSessionProjectDir();
|
|
458891
|
+
unsubscribeSessionSwitch = onSessionSwitch((sessionId) => {
|
|
458892
|
+
const projectDir = getSessionProjectDir();
|
|
458893
|
+
if (sessionId === pointerSessionId && projectDir === pointerProjectDir)
|
|
458894
|
+
return;
|
|
458895
|
+
pointerSessionId = sessionId;
|
|
458896
|
+
pointerProjectDir = projectDir;
|
|
458897
|
+
project?.resetSessionFile();
|
|
458898
|
+
});
|
|
458899
|
+
}
|
|
458529
458900
|
function getProject() {
|
|
458530
458901
|
if (!project) {
|
|
458531
458902
|
project = new Project;
|
|
458903
|
+
followSessionSwitches();
|
|
458532
458904
|
if (!cleanupRegistered3) {
|
|
458533
458905
|
registerCleanup(async () => {
|
|
458534
458906
|
await project?.flush();
|
|
@@ -458558,6 +458930,10 @@ function resetProjectFlushStateForTesting() {
|
|
|
458558
458930
|
}
|
|
458559
458931
|
function resetProjectForTesting() {
|
|
458560
458932
|
project = null;
|
|
458933
|
+
unsubscribeSessionSwitch?.();
|
|
458934
|
+
unsubscribeSessionSwitch = null;
|
|
458935
|
+
pointerSessionId = null;
|
|
458936
|
+
pointerProjectDir = null;
|
|
458561
458937
|
}
|
|
458562
458938
|
function setSessionFileForTesting(path17) {
|
|
458563
458939
|
getProject().sessionFile = path17;
|
|
@@ -458588,8 +458964,8 @@ class Project {
|
|
|
458588
458964
|
currentSessionGoal;
|
|
458589
458965
|
currentSessionBranch;
|
|
458590
458966
|
sessionFile = null;
|
|
458591
|
-
|
|
458592
|
-
|
|
458967
|
+
hasStartedSession = false;
|
|
458968
|
+
pendingEntries = new Map;
|
|
458593
458969
|
remoteIngressUrl = null;
|
|
458594
458970
|
internalEventWriter = null;
|
|
458595
458971
|
internalEventReader = null;
|
|
@@ -458859,15 +459235,35 @@ class Project {
|
|
|
458859
459235
|
return this.trackWrite(() => this.enqueueRewrite(filePath, (signal) => replaceFileAtomic(filePath, data, { signal })));
|
|
458860
459236
|
}
|
|
458861
459237
|
resetSessionFile() {
|
|
459238
|
+
if (this.sessionFile !== null)
|
|
459239
|
+
this.hasStartedSession = true;
|
|
459240
|
+
const startupMetadata = !this.hasStartedSession ? {
|
|
459241
|
+
title: this.currentSessionTitle,
|
|
459242
|
+
agentSetting: this.currentSessionAgentSetting,
|
|
459243
|
+
worktree: this.currentSessionWorktree
|
|
459244
|
+
} : undefined;
|
|
458862
459245
|
this.sessionFile = null;
|
|
458863
|
-
this.
|
|
458864
|
-
|
|
458865
|
-
|
|
458866
|
-
|
|
458867
|
-
|
|
458868
|
-
|
|
458869
|
-
|
|
458870
|
-
|
|
459246
|
+
this.clearSessionMetadata();
|
|
459247
|
+
if (startupMetadata) {
|
|
459248
|
+
this.currentSessionTitle = startupMetadata.title;
|
|
459249
|
+
this.currentSessionAgentSetting = startupMetadata.agentSetting;
|
|
459250
|
+
this.currentSessionWorktree = startupMetadata.worktree;
|
|
459251
|
+
}
|
|
459252
|
+
}
|
|
459253
|
+
clearSessionMetadata() {
|
|
459254
|
+
this.currentSessionTitle = undefined;
|
|
459255
|
+
this.currentSessionTag = undefined;
|
|
459256
|
+
this.currentSessionAgentName = undefined;
|
|
459257
|
+
this.currentSessionAgentColor = undefined;
|
|
459258
|
+
this.currentSessionLastPrompt = undefined;
|
|
459259
|
+
this.currentSessionAgentSetting = undefined;
|
|
459260
|
+
this.currentSessionMode = undefined;
|
|
459261
|
+
this.currentSessionWorktree = undefined;
|
|
459262
|
+
this.currentSessionPrNumber = undefined;
|
|
459263
|
+
this.currentSessionPrUrl = undefined;
|
|
459264
|
+
this.currentSessionPrRepository = undefined;
|
|
459265
|
+
this.currentSessionGoal = undefined;
|
|
459266
|
+
this.currentSessionBranch = undefined;
|
|
458871
459267
|
}
|
|
458872
459268
|
reAppendSessionMetadata(skipTitleRefresh = false) {
|
|
458873
459269
|
if (!this.sessionFile)
|
|
@@ -459052,15 +459448,14 @@ class Project {
|
|
|
459052
459448
|
return shouldSkipSessionPersistence();
|
|
459053
459449
|
}
|
|
459054
459450
|
async materializeSessionFile() {
|
|
459451
|
+
this.hasStartedSession = true;
|
|
459055
459452
|
if (this.shouldSkipPersistence())
|
|
459056
459453
|
return;
|
|
459057
|
-
this.
|
|
459058
|
-
this.ensureCurrentSessionFile();
|
|
459454
|
+
const sessionFile = resolvePath2(this.ensureCurrentSessionFile());
|
|
459059
459455
|
this.reAppendSessionMetadata();
|
|
459060
|
-
|
|
459061
|
-
|
|
459062
|
-
this.pendingEntries
|
|
459063
|
-
this.pendingEntriesSessionId = null;
|
|
459456
|
+
const buffered = this.pendingEntries.get(sessionFile);
|
|
459457
|
+
if (buffered && buffered.length > 0) {
|
|
459458
|
+
this.pendingEntries.delete(sessionFile);
|
|
459064
459459
|
for (const entry of buffered) {
|
|
459065
459460
|
await this.appendEntry(entry);
|
|
459066
459461
|
}
|
|
@@ -459195,9 +459590,13 @@ class Project {
|
|
|
459195
459590
|
let sessionFile;
|
|
459196
459591
|
if (isCurrentSession) {
|
|
459197
459592
|
if (this.sessionFile === null) {
|
|
459198
|
-
|
|
459199
|
-
|
|
459200
|
-
|
|
459593
|
+
const pendingPath = resolvePath2(getTranscriptPath());
|
|
459594
|
+
let buffered = this.pendingEntries.get(pendingPath);
|
|
459595
|
+
if (!buffered) {
|
|
459596
|
+
buffered = [];
|
|
459597
|
+
this.pendingEntries.set(pendingPath, buffered);
|
|
459598
|
+
}
|
|
459599
|
+
buffered.push(entry);
|
|
459201
459600
|
return;
|
|
459202
459601
|
}
|
|
459203
459602
|
sessionFile = this.sessionFile;
|
|
@@ -459289,6 +459688,7 @@ class Project {
|
|
|
459289
459688
|
async forgetDeletedSession(sessionId, transcriptPath) {
|
|
459290
459689
|
this.deletedSessionFiles.add(resolvePath2(transcriptPath));
|
|
459291
459690
|
this.existingSessionFiles.delete(sessionId);
|
|
459691
|
+
this.pendingEntries.delete(resolvePath2(transcriptPath));
|
|
459292
459692
|
if (this.sessionFile && this.isDeletedSessionFile(this.sessionFile)) {
|
|
459293
459693
|
this.resetSessionFile();
|
|
459294
459694
|
}
|
|
@@ -460404,20 +460804,7 @@ function restoreSessionMetadata(meta) {
|
|
|
460404
460804
|
project2.currentSessionBranch = meta.sessionBranch ?? undefined;
|
|
460405
460805
|
}
|
|
460406
460806
|
function clearSessionMetadata() {
|
|
460407
|
-
|
|
460408
|
-
project2.currentSessionTitle = undefined;
|
|
460409
|
-
project2.currentSessionTag = undefined;
|
|
460410
|
-
project2.currentSessionAgentName = undefined;
|
|
460411
|
-
project2.currentSessionAgentColor = undefined;
|
|
460412
|
-
project2.currentSessionLastPrompt = undefined;
|
|
460413
|
-
project2.currentSessionAgentSetting = undefined;
|
|
460414
|
-
project2.currentSessionMode = undefined;
|
|
460415
|
-
project2.currentSessionWorktree = undefined;
|
|
460416
|
-
project2.currentSessionPrNumber = undefined;
|
|
460417
|
-
project2.currentSessionPrUrl = undefined;
|
|
460418
|
-
project2.currentSessionPrRepository = undefined;
|
|
460419
|
-
project2.currentSessionGoal = undefined;
|
|
460420
|
-
project2.currentSessionBranch = undefined;
|
|
460807
|
+
getProject().clearSessionMetadata();
|
|
460421
460808
|
}
|
|
460422
460809
|
function reAppendSessionMetadata() {
|
|
460423
460810
|
getProject().reAppendSessionMetadata();
|
|
@@ -461947,7 +462334,7 @@ async function enrichLogs(allLogs, startIndex, count3, options2) {
|
|
|
461947
462334
|
}
|
|
461948
462335
|
return { logs: result, nextIndex: i3 };
|
|
461949
462336
|
}
|
|
461950
|
-
var VERSION3, builtInCommandNamesCache, MAX_TOMBSTONE_REWRITE_BYTES, TRANSCRIPT_COPY_CHUNK_BYTES, transcriptRewriteHooksForTesting, SKIP_FIRST_PROMPT_PATTERN2, LOCAL_COMMAND_TAGS, EPHEMERAL_PROGRESS_TYPES, MAX_TRANSCRIPT_READ_BYTES, agentTranscriptSubdirs, getProjectDir2, project = null, cleanupRegistered3 = false, REMOTE_FLUSH_INTERVAL_MS = 10, PERSISTED_OUTPUT_TAG2, TOOL_USE_RESULT_KEY, SEARCH_HEAD_BYTES, SEARCH_TAIL_BYTES, SEARCH_MID_WINDOW_BYTES, SEARCH_MAX_MID_WINDOWS = 12, SEARCH_MAX_TOTAL_READ_BYTES, SEARCH_MAX_CHAR_COUNT = 80000, METADATA_TYPE_MARKERS, METADATA_MARKER_BUFS, METADATA_PREFIX_BOUND = 25, getSessionMessages, INITIAL_ENRICH_COUNT = 50, SESSION_BRANCH_ENTRY_PREFIX = '{"type":"session-branch"', SESSION_BRANCH_ENTRY_PREFIX_SPACED = '{"type": "session-branch"';
|
|
462337
|
+
var VERSION3, builtInCommandNamesCache, MAX_TOMBSTONE_REWRITE_BYTES, TRANSCRIPT_COPY_CHUNK_BYTES, transcriptRewriteHooksForTesting, SKIP_FIRST_PROMPT_PATTERN2, LOCAL_COMMAND_TAGS, EPHEMERAL_PROGRESS_TYPES, MAX_TRANSCRIPT_READ_BYTES, agentTranscriptSubdirs, getProjectDir2, project = null, cleanupRegistered3 = false, unsubscribeSessionSwitch = null, pointerSessionId = null, pointerProjectDir = null, REMOTE_FLUSH_INTERVAL_MS = 10, PERSISTED_OUTPUT_TAG2, TOOL_USE_RESULT_KEY, SEARCH_HEAD_BYTES, SEARCH_TAIL_BYTES, SEARCH_MID_WINDOW_BYTES, SEARCH_MAX_MID_WINDOWS = 12, SEARCH_MAX_TOTAL_READ_BYTES, SEARCH_MAX_CHAR_COUNT = 80000, METADATA_TYPE_MARKERS, METADATA_MARKER_BUFS, METADATA_PREFIX_BOUND = 25, getSessionMessages, INITIAL_ENRICH_COUNT = 50, SESSION_BRANCH_ENTRY_PREFIX = '{"type":"session-branch"', SESSION_BRANCH_ENTRY_PREFIX_SPACED = '{"type": "session-branch"';
|
|
461951
462338
|
var init_sessionStorage = __esm(() => {
|
|
461952
462339
|
init_memoize();
|
|
461953
462340
|
init_state();
|
|
@@ -461977,7 +462364,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
461977
462364
|
init_slowOperations();
|
|
461978
462365
|
init_transcriptFileLock();
|
|
461979
462366
|
init_uuid();
|
|
461980
|
-
VERSION3 = typeof MACRO !== "undefined" ? "0.
|
|
462367
|
+
VERSION3 = typeof MACRO !== "undefined" ? "0.34.0" : "unknown";
|
|
461981
462368
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
461982
462369
|
TRANSCRIPT_COPY_CHUNK_BYTES = 64 * 1024;
|
|
461983
462370
|
transcriptRewriteHooksForTesting = {};
|
|
@@ -463466,7 +463853,7 @@ var init_filesystem = __esm(() => {
|
|
|
463466
463853
|
});
|
|
463467
463854
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
463468
463855
|
const nonce = randomBytes19(16).toString("hex");
|
|
463469
|
-
return join150(getClaudeTempDir(), "bundled-skills", "0.
|
|
463856
|
+
return join150(getClaudeTempDir(), "bundled-skills", "0.34.0", nonce);
|
|
463470
463857
|
});
|
|
463471
463858
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
463472
463859
|
});
|
|
@@ -463696,7 +464083,7 @@ var init_diskOutput = __esm(() => {
|
|
|
463696
464083
|
});
|
|
463697
464084
|
|
|
463698
464085
|
// src/Task.ts
|
|
463699
|
-
import { randomInt as
|
|
464086
|
+
import { randomInt as randomInt3 } from "crypto";
|
|
463700
464087
|
function isTerminalTaskStatus(status2) {
|
|
463701
464088
|
return status2 === "completed" || status2 === "failed" || status2 === "killed";
|
|
463702
464089
|
}
|
|
@@ -463707,7 +464094,7 @@ function generateTaskId(type) {
|
|
|
463707
464094
|
const prefix = getTaskIdPrefix(type);
|
|
463708
464095
|
let id = prefix;
|
|
463709
464096
|
for (let i3 = 0;i3 < 8; i3++) {
|
|
463710
|
-
id += TASK_ID_ALPHABET[
|
|
464097
|
+
id += TASK_ID_ALPHABET[randomInt3(TASK_ID_ALPHABET.length)];
|
|
463711
464098
|
}
|
|
463712
464099
|
return id;
|
|
463713
464100
|
}
|
|
@@ -473360,6 +473747,13 @@ var init_findRelevantMemories = __esm(() => {
|
|
|
473360
473747
|
import { readdir as readdir31, stat as stat49 } from "fs/promises";
|
|
473361
473748
|
import nodePath2, { dirname as dirname63, parse as parse12, relative as relative30, resolve as resolve48 } from "path";
|
|
473362
473749
|
import { randomUUID as randomUUID38 } from "crypto";
|
|
473750
|
+
function getTodoReminderConfig() {
|
|
473751
|
+
const config3 = getSettings_DEPRECATED()?.todoReminder;
|
|
473752
|
+
return {
|
|
473753
|
+
turnsSinceWrite: config3?.turnsSinceWrite ?? getEnvNumber("OPENCLAUDE_TODO_REMINDER_TURNS_SINCE_WRITE", 10),
|
|
473754
|
+
turnsBetweenReminders: config3?.turnsBetweenReminders ?? getEnvNumber("OPENCLAUDE_TODO_REMINDER_TURNS_BETWEEN_REMINDERS", 10)
|
|
473755
|
+
};
|
|
473756
|
+
}
|
|
473363
473757
|
function shouldIncludeSkillListingAttachment(querySource) {
|
|
473364
473758
|
return !(typeof querySource === "string" && SKILL_LISTING_SUPPRESSED_QUERY_SOURCES.has(querySource));
|
|
473365
473759
|
}
|
|
@@ -474714,7 +475108,8 @@ async function getTodoReminderAttachments(messages, toolUseContext) {
|
|
|
474714
475108
|
return [];
|
|
474715
475109
|
}
|
|
474716
475110
|
const { turnsSinceLastTodoWrite, turnsSinceLastReminder } = getTodoReminderTurnCounts(messages);
|
|
474717
|
-
|
|
475111
|
+
const reminderConfig = getTodoReminderConfig();
|
|
475112
|
+
if (turnsSinceLastTodoWrite >= reminderConfig.turnsSinceWrite && turnsSinceLastReminder >= reminderConfig.turnsBetweenReminders) {
|
|
474718
475113
|
const todoKey = toolUseContext.agentId ?? getSessionId();
|
|
474719
475114
|
const appState = toolUseContext.getAppState();
|
|
474720
475115
|
const todos = appState.todos[todoKey] ?? [];
|
|
@@ -474775,7 +475170,8 @@ async function getTaskReminderAttachments(messages, toolUseContext) {
|
|
|
474775
475170
|
return [];
|
|
474776
475171
|
}
|
|
474777
475172
|
const { turnsSinceLastTaskManagement, turnsSinceLastReminder } = getTaskReminderTurnCounts(messages);
|
|
474778
|
-
|
|
475173
|
+
const reminderConfig = getTodoReminderConfig();
|
|
475174
|
+
if (turnsSinceLastTaskManagement >= reminderConfig.turnsSinceWrite && turnsSinceLastReminder >= reminderConfig.turnsBetweenReminders) {
|
|
474779
475175
|
const tasks2 = await listTasks(getTaskListId());
|
|
474780
475176
|
return [
|
|
474781
475177
|
{
|
|
@@ -475097,7 +475493,7 @@ function isFileReadDenied(filePath, toolPermissionContext) {
|
|
|
475097
475493
|
const denyRule = matchingRuleForInput(filePath, toolPermissionContext, "read", "deny");
|
|
475098
475494
|
return denyRule !== null;
|
|
475099
475495
|
}
|
|
475100
|
-
var skillSearchModules, autoModeStateModule2, BRIEF_TOOL_NAME2 = null,
|
|
475496
|
+
var skillSearchModules, autoModeStateModule2, BRIEF_TOOL_NAME2 = null, PLAN_MODE_ATTACHMENT_CONFIG, AUTO_MODE_ATTACHMENT_CONFIG, SKILL_LISTING_SUPPRESSED_QUERY_SOURCES, MAX_MEMORY_LINES = 200, MAX_MEMORY_BYTES = 4096, RELEVANT_MEMORIES_CONFIG, VERIFY_PLAN_REMINDER_CONFIG, ATTACHMENT_FILE_IO_CONCURRENCY = 8, INLINE_NOTIFICATION_MODES, defaultAtMentionedFileDeps, defaultChangedFileDeps, sentSkillNames, suppressNext = false, FILTERED_LISTING_MAX = 30, LSP_DIAGNOSTIC_ATTACHMENT_MAX_WAIT_MS, MIN_SNIP_NUDGE_TOKENS = 1e4, MAX_SNIP_NUDGE_REPEAT_TOKENS = 1e5, SNIP_NUDGE_START_FRACTION = 0.6, SNIP_NUDGE_REPEAT_FRACTION = 0.1;
|
|
475101
475497
|
var init_attachments = __esm(() => {
|
|
475102
475498
|
init_metadata();
|
|
475103
475499
|
init_Tool();
|
|
@@ -475118,6 +475514,7 @@ var init_attachments = __esm(() => {
|
|
|
475118
475514
|
init_diagnosticTracking();
|
|
475119
475515
|
init_settings3();
|
|
475120
475516
|
init_providers2();
|
|
475517
|
+
init_envUtils();
|
|
475121
475518
|
init_effort();
|
|
475122
475519
|
init_utils4();
|
|
475123
475520
|
init_imageResizer();
|
|
@@ -475177,10 +475574,6 @@ var init_attachments = __esm(() => {
|
|
|
475177
475574
|
prefetch: (init_prefetch(), __toCommonJS(exports_prefetch))
|
|
475178
475575
|
};
|
|
475179
475576
|
autoModeStateModule2 = __toCommonJS(exports_autoModeState);
|
|
475180
|
-
TODO_REMINDER_CONFIG = {
|
|
475181
|
-
TURNS_SINCE_WRITE: 10,
|
|
475182
|
-
TURNS_BETWEEN_REMINDERS: 10
|
|
475183
|
-
};
|
|
475184
475577
|
PLAN_MODE_ATTACHMENT_CONFIG = {
|
|
475185
475578
|
TURNS_BETWEEN_ATTACHMENTS: 5,
|
|
475186
475579
|
FULL_REMINDER_EVERY_N_ATTACHMENTS: 5
|
|
@@ -496742,6 +497135,10 @@ var init_types13 = __esm(() => {
|
|
|
496742
497135
|
deniedMcpServers: exports_external.array(DeniedMcpServerEntrySchema()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. " + "If a server is on the denylist, it will be blocked across all scopes including enterprise. " + "Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),
|
|
496743
497136
|
hooks: HooksSchema().optional().describe("Custom commands to run before/after tool executions"),
|
|
496744
497137
|
autoFix: AutoFixConfigSchema.optional().describe("Auto-fix configuration: automatically run lint/test after AI file edits " + "and feed errors back for self-repair."),
|
|
497138
|
+
todoReminder: exports_external.object({
|
|
497139
|
+
turnsSinceWrite: exports_external.number().int().positive().optional().catch(undefined).describe("Assistant turns since last TodoWrite/TaskUpdate before showing reminder (default: 10)"),
|
|
497140
|
+
turnsBetweenReminders: exports_external.number().int().positive().optional().catch(undefined).describe("Assistant turns between reminders (default: 10)")
|
|
497141
|
+
}).optional().catch(undefined).describe("Configuration for todo/task tool usage reminders"),
|
|
496745
497142
|
worktree: exports_external.preprocess((val) => {
|
|
496746
497143
|
if (val && typeof val === "object") {
|
|
496747
497144
|
const copy2 = { ...val };
|
|
@@ -501799,7 +502196,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
501799
502196
|
slash_commands: inputs.commands.filter((c6) => c6.userInvocable !== false).map((c6) => c6.name),
|
|
501800
502197
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
501801
502198
|
betas: getSdkBetas(),
|
|
501802
|
-
claude_code_version: "0.
|
|
502199
|
+
claude_code_version: "0.34.0",
|
|
501803
502200
|
output_style: outputStyle2,
|
|
501804
502201
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
501805
502202
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -503361,4 +503758,4 @@ export {
|
|
|
503361
503758
|
createAcpServer
|
|
503362
503759
|
};
|
|
503363
503760
|
|
|
503364
|
-
//# debugId=
|
|
503761
|
+
//# debugId=EC08150E4151F12F64756E2164756E21
|