@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/sdk.mjs CHANGED
@@ -3724,12 +3724,145 @@ function getTeamsDir() {
3724
3724
  function getProjectsDir() {
3725
3725
  return join(getClaudeConfigHomeDir(), "projects");
3726
3726
  }
3727
+ function tokenizeNodeOptions(nodeOptions) {
3728
+ const tokens = [];
3729
+ let isInString = false;
3730
+ let willStartNewArg = true;
3731
+ for (let i = 0;i < nodeOptions.length; i++) {
3732
+ let c = nodeOptions[i];
3733
+ if (c === "\\" && isInString) {
3734
+ if (i + 1 >= nodeOptions.length) {
3735
+ return null;
3736
+ }
3737
+ c = nodeOptions[++i];
3738
+ } else if (c === " " && !isInString) {
3739
+ willStartNewArg = true;
3740
+ continue;
3741
+ } else if (c === '"') {
3742
+ isInString = !isInString;
3743
+ continue;
3744
+ }
3745
+ if (willStartNewArg) {
3746
+ tokens.push(c);
3747
+ willStartNewArg = false;
3748
+ } else {
3749
+ tokens[tokens.length - 1] += c;
3750
+ }
3751
+ }
3752
+ if (isInString) {
3753
+ return null;
3754
+ }
3755
+ return tokens;
3756
+ }
3757
+ function resolveNodeOption(name, hasInlineValue) {
3758
+ if (hasInlineValue) {
3759
+ const inlineAlias = NODE_INLINE_OPTION_ALIASES.get(`${name}=`);
3760
+ if (inlineAlias) {
3761
+ return {
3762
+ role: NODE_OPTION_ROLES.get(inlineAlias[0]) ?? "boolean",
3763
+ names: [name, ...inlineAlias]
3764
+ };
3765
+ }
3766
+ }
3767
+ const alias = NODE_OPTION_ALIASES.get(name);
3768
+ if (alias) {
3769
+ return {
3770
+ role: NODE_OPTION_ROLES.get(alias[0]) ?? "boolean",
3771
+ names: [name, ...alias]
3772
+ };
3773
+ }
3774
+ return { role: NODE_OPTION_ROLES.get(name) ?? "boolean", names: [name] };
3775
+ }
3776
+ function parseNodeOptions(nodeOptions) {
3777
+ const tokens = tokenizeNodeOptions(nodeOptions);
3778
+ if (!tokens) {
3779
+ return { valid: false, options: [] };
3780
+ }
3781
+ const options = [];
3782
+ let index = 0;
3783
+ while (index < tokens.length) {
3784
+ const token = tokens[index];
3785
+ index += 1;
3786
+ if (token.length <= 1 || token[0] !== "-") {
3787
+ break;
3788
+ }
3789
+ if (token === "--") {
3790
+ return { valid: false, options: [] };
3791
+ }
3792
+ const equalsIndex = token.startsWith("--") ? token.indexOf("=") : -1;
3793
+ const name = equalsIndex === -1 ? token : token.slice(0, equalsIndex);
3794
+ const inlineValue = equalsIndex === -1 ? undefined : token.slice(equalsIndex + 1);
3795
+ let optionName = name;
3796
+ let negated = false;
3797
+ if (optionName.startsWith("--no-")) {
3798
+ optionName = `--${optionName.slice("--no-".length)}`;
3799
+ negated = true;
3800
+ }
3801
+ const { role, names } = resolveNodeOption(optionName, equalsIndex !== -1);
3802
+ if (negated && role !== "boolean") {
3803
+ return { valid: false, options: [] };
3804
+ }
3805
+ switch (role) {
3806
+ case "boolean":
3807
+ break;
3808
+ case "value": {
3809
+ if (inlineValue !== undefined) {
3810
+ if (inlineValue === "") {
3811
+ return { valid: false, options: [] };
3812
+ }
3813
+ break;
3814
+ }
3815
+ const next = tokens[index];
3816
+ if (next === undefined || next.startsWith("-")) {
3817
+ return { valid: false, options: [] };
3818
+ }
3819
+ index += 1;
3820
+ break;
3821
+ }
3822
+ case "inline-value": {
3823
+ if (inlineValue === undefined) {
3824
+ return { valid: false, options: [] };
3825
+ }
3826
+ break;
3827
+ }
3828
+ case "inline-required": {
3829
+ if (inlineValue === undefined || inlineValue === "") {
3830
+ return { valid: false, options: [] };
3831
+ }
3832
+ break;
3833
+ }
3834
+ }
3835
+ const recorded = new Set;
3836
+ for (const occurrenceName of names) {
3837
+ if (recorded.has(occurrenceName)) {
3838
+ continue;
3839
+ }
3840
+ recorded.add(occurrenceName);
3841
+ options.push({ name: occurrenceName, negated });
3842
+ }
3843
+ }
3844
+ return { valid: true, options };
3845
+ }
3727
3846
  function hasNodeOption(flag) {
3728
3847
  const nodeOptions = process.env.NODE_OPTIONS;
3729
3848
  if (!nodeOptions) {
3730
3849
  return false;
3731
3850
  }
3732
- return nodeOptions.split(/\s+/).includes(flag);
3851
+ const parsed = parseNodeOptions(nodeOptions);
3852
+ if (!parsed.valid) {
3853
+ return false;
3854
+ }
3855
+ const negatedQuery = flag.startsWith("--no-");
3856
+ const optionName = negatedQuery ? `--${flag.slice("--no-".length)}` : flag;
3857
+ let enabled = false;
3858
+ let seen = false;
3859
+ for (const option of parsed.options) {
3860
+ if (option.name === optionName) {
3861
+ enabled = !option.negated;
3862
+ seen = true;
3863
+ }
3864
+ }
3865
+ return negatedQuery ? seen && !enabled : enabled;
3733
3866
  }
3734
3867
  function isEnvTruthy(envVar) {
3735
3868
  if (!envVar)
@@ -3764,6 +3897,21 @@ function shouldMaintainProjectWorkingDir() {
3764
3897
  function isRunningOnHomespace() {
3765
3898
  return process.env.USER_TYPE === "ant" && isEnvTruthy(process.env.COO_RUNNING_ON_HOMESPACE);
3766
3899
  }
3900
+ function getEnvNumber(key, defaultValue) {
3901
+ const value = process.env[key];
3902
+ if (value === undefined) {
3903
+ return defaultValue;
3904
+ }
3905
+ const trimmed = value.trim();
3906
+ if (!/^(0|[1-9]\d*)$/.test(trimmed)) {
3907
+ return defaultValue;
3908
+ }
3909
+ const parsed = Number.parseInt(trimmed, 10);
3910
+ if (!Number.isSafeInteger(parsed) || parsed <= 0) {
3911
+ return defaultValue;
3912
+ }
3913
+ return parsed;
3914
+ }
3767
3915
  function isInProtectedNamespace() {
3768
3916
  if (process.env.USER_TYPE === "ant") {
3769
3917
  return (init_protectedNamespace(), __toCommonJS(exports_protectedNamespace)).checkProtectedNamespace();
@@ -3779,7 +3927,7 @@ function getVertexRegionForModel(model) {
3779
3927
  }
3780
3928
  return getDefaultVertexRegion();
3781
3929
  }
3782
- var claudeConfigHomeDirOverride, getDefaultClaudeConfigHomeDir, getClaudeConfigHomeDir, VERTEX_REGION_OVERRIDES;
3930
+ var claudeConfigHomeDirOverride, getDefaultClaudeConfigHomeDir, getClaudeConfigHomeDir, NODE_OPTION_ROLES, NODE_OPTION_ALIASES, NODE_INLINE_OPTION_ALIASES, VERTEX_REGION_OVERRIDES;
3783
3931
  var init_envUtils = __esm(() => {
3784
3932
  init_memoize();
3785
3933
  getDefaultClaudeConfigHomeDir = memoize_default(() => {
@@ -3800,6 +3948,89 @@ var init_envUtils = __esm(() => {
3800
3948
  }
3801
3949
  return getDefaultClaudeConfigHomeDir();
3802
3950
  }, { cache: getDefaultClaudeConfigHomeDir.cache });
3951
+ NODE_OPTION_ROLES = new Map([
3952
+ ["--max-old-space-size", "inline-value"],
3953
+ ["--max-semi-space-size", "inline-value"],
3954
+ ["--stack-trace-limit", "inline-required"],
3955
+ ["--allow-fs-read", "value"],
3956
+ ["--allow-fs-write", "value"],
3957
+ ["--conditions", "value"],
3958
+ ["-C", "value"],
3959
+ ["--cpu-prof-dir", "value"],
3960
+ ["--cpu-prof-interval", "value"],
3961
+ ["--cpu-prof-name", "value"],
3962
+ ["--debug-port", "value"],
3963
+ ["--diagnostic-dir", "value"],
3964
+ ["--disable-proto", "value"],
3965
+ ["--disable-warning", "value"],
3966
+ ["--dns-result-order", "value"],
3967
+ ["--experimental-default-type", "value"],
3968
+ ["--experimental-loader", "value"],
3969
+ ["--heap-prof-dir", "value"],
3970
+ ["--heap-prof-interval", "value"],
3971
+ ["--heap-prof-name", "value"],
3972
+ ["--heapsnapshot-near-heap-limit", "value"],
3973
+ ["--heapsnapshot-signal", "value"],
3974
+ ["--icu-data-dir", "value"],
3975
+ ["--import", "value"],
3976
+ ["--input-type", "value"],
3977
+ ["--inspect-port", "value"],
3978
+ ["--inspect-publish-uid", "value"],
3979
+ ["--loader", "value"],
3980
+ ["--localstorage-file", "value"],
3981
+ ["--max-http-header-size", "value"],
3982
+ ["--max-old-space-size-percentage", "value"],
3983
+ ["--network-family-autoselection-attempt-timeout", "value"],
3984
+ ["--openssl-config", "value"],
3985
+ ["--redirect-warnings", "value"],
3986
+ ["--report-dir", "value"],
3987
+ ["--report-directory", "value"],
3988
+ ["--report-filename", "value"],
3989
+ ["--report-signal", "value"],
3990
+ ["--require", "value"],
3991
+ ["-r", "value"],
3992
+ ["--secure-heap", "value"],
3993
+ ["--secure-heap-min", "value"],
3994
+ ["--snapshot-blob", "value"],
3995
+ ["--test-coverage-branches", "value"],
3996
+ ["--test-coverage-exclude", "value"],
3997
+ ["--test-coverage-functions", "value"],
3998
+ ["--test-coverage-include", "value"],
3999
+ ["--test-coverage-lines", "value"],
4000
+ ["--test-global-setup", "value"],
4001
+ ["--test-isolation", "value"],
4002
+ ["--test-name-pattern", "value"],
4003
+ ["--test-reporter", "value"],
4004
+ ["--test-reporter-destination", "value"],
4005
+ ["--test-rerun-failures", "value"],
4006
+ ["--test-shard", "value"],
4007
+ ["--test-skip-pattern", "value"],
4008
+ ["--title", "value"],
4009
+ ["--tls-cipher-list", "value"],
4010
+ ["--tls-keylog", "value"],
4011
+ ["--trace-event-categories", "value"],
4012
+ ["--trace-event-file-pattern", "value"],
4013
+ ["--trace-require-module", "value"],
4014
+ ["--unhandled-rejections", "value"],
4015
+ ["--use-largepages", "value"],
4016
+ ["--v8-pool-size", "value"],
4017
+ ["--watch-kill-signal", "value"],
4018
+ ["--watch-path", "value"]
4019
+ ]);
4020
+ NODE_OPTION_ALIASES = new Map([
4021
+ ["-C", ["--conditions"]],
4022
+ ["-r", ["--require"]],
4023
+ ["--debug-port", ["--inspect-port"]],
4024
+ ["--loader", ["--experimental-loader"]],
4025
+ ["--report-directory", ["--report-dir"]],
4026
+ ["--experimental-test-isolation", ["--test-isolation"]]
4027
+ ]);
4028
+ NODE_INLINE_OPTION_ALIASES = new Map([
4029
+ ["--inspect=", ["--inspect-port", "--inspect"]],
4030
+ ["--inspect-brk=", ["--inspect-port", "--inspect-brk"]],
4031
+ ["--inspect-brk-node=", ["--inspect-port", "--inspect-brk-node"]],
4032
+ ["--inspect-wait=", ["--inspect-port", "--inspect-wait"]]
4033
+ ]);
3803
4034
  VERTEX_REGION_OVERRIDES = [
3804
4035
  ["claude-haiku-4-5", "VERTEX_REGION_CLAUDE_HAIKU_4_5"],
3805
4036
  ["claude-3-5-haiku", "VERTEX_REGION_CLAUDE_3_5_HAIKU"],
@@ -10131,7 +10362,7 @@ var init_version = __esm(() => {
10131
10362
  import_semver = __toESM(require_semver2(), 1);
10132
10363
  fallbackBuildVersion = (() => {
10133
10364
  try {
10134
- return "0.33.2-by-rayss";
10365
+ return "0.34.0";
10135
10366
  } catch {
10136
10367
  return "0.0.0";
10137
10368
  }
@@ -66751,6 +66982,10 @@ var init_types2 = __esm(() => {
66751
66982
  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."),
66752
66983
  hooks: HooksSchema().optional().describe("Custom commands to run before/after tool executions"),
66753
66984
  autoFix: AutoFixConfigSchema.optional().describe("Auto-fix configuration: automatically run lint/test after AI file edits " + "and feed errors back for self-repair."),
66985
+ todoReminder: exports_external.object({
66986
+ turnsSinceWrite: exports_external.number().int().positive().optional().catch(undefined).describe("Assistant turns since last TodoWrite/TaskUpdate before showing reminder (default: 10)"),
66987
+ turnsBetweenReminders: exports_external.number().int().positive().optional().catch(undefined).describe("Assistant turns between reminders (default: 10)")
66988
+ }).optional().catch(undefined).describe("Configuration for todo/task tool usage reminders"),
66754
66989
  worktree: exports_external.preprocess((val) => {
66755
66990
  if (val && typeof val === "object") {
66756
66991
  const copy = { ...val };
@@ -67494,9 +67729,9 @@ function readLinuxProcessStartId(pid) {
67494
67729
  return null;
67495
67730
  }
67496
67731
  }
67497
- function readCommandProcessStartId(command, args, prefix) {
67732
+ function readCommandProcessStartId(command, args, prefix, timeoutMs) {
67498
67733
  try {
67499
- const result = spawnSync2(command, args, {
67734
+ const result = identityLookupSync(command, args, {
67500
67735
  encoding: "utf8",
67501
67736
  env: {
67502
67737
  ...process.env,
@@ -67504,7 +67739,7 @@ function readCommandProcessStartId(command, args, prefix) {
67504
67739
  LC_ALL: "C",
67505
67740
  TZ: "UTC"
67506
67741
  },
67507
- timeout: 1000,
67742
+ timeout: timeoutMs,
67508
67743
  windowsHide: true
67509
67744
  });
67510
67745
  if (result.error || result.status !== 0)
@@ -67515,7 +67750,7 @@ function readCommandProcessStartId(command, args, prefix) {
67515
67750
  return null;
67516
67751
  }
67517
67752
  }
67518
- function readProcessStartId(pid) {
67753
+ function readProcessStartId(pid, windowsTimeoutMs = WINDOWS_SETTINGS_LOCK_IDENTITY_LOOKUP_TIMEOUT_MS) {
67519
67754
  if (process.platform === "linux")
67520
67755
  return readLinuxProcessStartId(pid);
67521
67756
  if (process.platform === "win32") {
@@ -67524,9 +67759,9 @@ function readProcessStartId(pid) {
67524
67759
  "-NonInteractive",
67525
67760
  "-Command",
67526
67761
  `(Get-Process -Id ${pid} -ErrorAction Stop).StartTime.ToUniversalTime().Ticks`
67527
- ], "windows");
67762
+ ], "windows", windowsTimeoutMs);
67528
67763
  }
67529
- return readCommandProcessStartId("ps", ["-p", String(pid), "-o", "lstart="], "posix");
67764
+ return readCommandProcessStartId("ps", ["-p", String(pid), "-o", "lstart="], "posix", SETTINGS_LOCK_IDENTITY_LOOKUP_TIMEOUT_MS);
67530
67765
  }
67531
67766
  function currentProcessStartId() {
67532
67767
  if (settingsLockProcessStartId !== undefined) {
@@ -67565,7 +67800,7 @@ function isIdentityOwnerAlive(identity4, processStartIds) {
67565
67800
  if (processStartIds.has(cacheKey)) {
67566
67801
  currentProcessStartId2 = processStartIds.get(cacheKey) ?? null;
67567
67802
  } else {
67568
- currentProcessStartId2 = readProcessStartId(identity4.pid);
67803
+ currentProcessStartId2 = readProcessStartId(identity4.pid, SETTINGS_LOCK_IDENTITY_LOOKUP_TIMEOUT_MS);
67569
67804
  processStartIds.set(cacheKey, currentProcessStartId2);
67570
67805
  }
67571
67806
  return currentProcessStartId2 === null || currentProcessStartId2 === identity4.processStartId;
@@ -67701,6 +67936,10 @@ function acquireSettingsLock(targetPath) {
67701
67936
  }
67702
67937
  const remaining = deadline - now;
67703
67938
  if (remaining <= 0) {
67939
+ if (tryPublishPendingLock(pendingPath, lockPath)) {
67940
+ acquired = true;
67941
+ return () => releaseOwnedLock(lockPath, owner);
67942
+ }
67704
67943
  throw Object.assign(new Error(`Timed out after ${SETTINGS_LOCK_WAIT_MS}ms waiting for settings lock ${lockPath}, held by ${describeCurrentOwner(lockPath)}. If that process is known to have exited, remove the lock directory before retrying.`), { code: "ELOCKED" });
67705
67944
  }
67706
67945
  Atomics.wait(waitBuffer, 0, 0, Math.min(SETTINGS_LOCK_RETRY_MS, remaining));
@@ -67730,7 +67969,7 @@ function withSettingsFileTransactionSync(requestedPath, operation) {
67730
67969
  release();
67731
67970
  return result;
67732
67971
  }
67733
- 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;
67972
+ 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;
67734
67973
  var init_settingsFileTransaction = __esm(() => {
67735
67974
  init_debug();
67736
67975
  init_errors();
@@ -67738,6 +67977,7 @@ var init_settingsFileTransaction = __esm(() => {
67738
67977
  init_fsOperations();
67739
67978
  init_internalWrites();
67740
67979
  init_settingsCache();
67980
+ identityLookupSync = spawnSync2;
67741
67981
  SETTINGS_LOCK_HOST = hostname2();
67742
67982
  waitBuffer = new Int32Array(new SharedArrayBuffer(4));
67743
67983
  });
@@ -70365,7 +70605,7 @@ function getAttributionHeader(fingerprint, policy) {
70365
70605
  if (!policy.generate) {
70366
70606
  return "";
70367
70607
  }
70368
- const version2 = `${"0.33.2-by-rayss"}.${fingerprint}`;
70608
+ const version2 = `${"0.34.0"}.${fingerprint}`;
70369
70609
  const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
70370
70610
  const cch = "";
70371
70611
  const workload = getWorkload();
@@ -97865,7 +98105,7 @@ function createHttpsProxyAgent(proxyUrl, extra = {}) {
97865
98105
  callback(null, hostname3, getAddressFamily(options));
97866
98106
  };
97867
98107
  }
97868
- return new import_https_proxy_agent.HttpsProxyAgent(proxyUrl, { ...agentOptions, ...extra });
98108
+ return new TargetTLSHttpsProxyAgent(proxyUrl, { ...agentOptions, ...extra });
97869
98109
  }
97870
98110
  function getWebSocketProxyAgent(url3) {
97871
98111
  const proxyUrl = getProxyUrl();
@@ -97962,7 +98202,7 @@ async function getAWSClientProxyConfig() {
97962
98202
  })
97963
98203
  };
97964
98204
  }
97965
- var import_https_proxy_agent, keepAliveDisabled, getProxyAgent, proxyInterceptorId;
98205
+ var import_https_proxy_agent, keepAliveDisabled, TargetTLSHttpsProxyAgent, getProxyAgent, proxyInterceptorId;
97966
98206
  var init_proxy = __esm(() => {
97967
98207
  init_axios2();
97968
98208
  init_memoize();
@@ -97973,6 +98213,17 @@ var init_proxy = __esm(() => {
97973
98213
  init_optionalRuntimeModule();
97974
98214
  import_https_proxy_agent = __toESM(require_dist2(), 1);
97975
98215
  keepAliveDisabled = isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_KEEPALIVE);
98216
+ TargetTLSHttpsProxyAgent = class TargetTLSHttpsProxyAgent extends import_https_proxy_agent.HttpsProxyAgent {
98217
+ targetTLSOptions;
98218
+ constructor(proxyUrl, options) {
98219
+ super(proxyUrl, options);
98220
+ const { ca, cert, key, passphrase } = options;
98221
+ this.targetTLSOptions = { ca, cert, key, passphrase };
98222
+ }
98223
+ connect(...[req, opts]) {
98224
+ return super.connect(req, { ...this.targetTLSOptions, ...opts });
98225
+ }
98226
+ };
97976
98227
  getProxyAgent = memoize_default((uri) => {
97977
98228
  const undiciMod = require_undici();
97978
98229
  const mtlsConfig = getMTLSConfig();
@@ -104001,7 +104252,7 @@ var init_metadata = __esm(() => {
104001
104252
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
104002
104253
  WHITESPACE_REGEX = /\s+/;
104003
104254
  getVersionBase = memoize_default(() => {
104004
- const match = "0.33.2-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
104255
+ const match = "0.34.0".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
104005
104256
  return match ? match[0] : undefined;
104006
104257
  });
104007
104258
  buildEnvContext = memoize_default(async () => {
@@ -104041,9 +104292,9 @@ var init_metadata = __esm(() => {
104041
104292
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
104042
104293
  isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
104043
104294
  isClaudeAiAuth: isClaudeAISubscriber(),
104044
- version: "0.33.2-by-rayss",
104295
+ version: "0.34.0",
104045
104296
  versionBase: getVersionBase(),
104046
- buildTime: "2026-10-23T01:50:01.313Z",
104297
+ buildTime: "2026-11-08T14:26:39.046Z",
104047
104298
  deploymentEnvironment: env2.detectDeploymentEnvironment(),
104048
104299
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
104049
104300
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -112200,11 +112451,11 @@ var init_effort = __esm(() => {
112200
112451
 
112201
112452
  // src/utils/userAgent.ts
112202
112453
  function getClaudeCodeUserAgent() {
112203
- return `claude-code/${"0.33.2-by-rayss"}`;
112454
+ return `claude-code/${"0.34.0"}`;
112204
112455
  }
112205
112456
  function getOpenClaudeUserAgent() {
112206
112457
  try {
112207
- return `openclaude/${"0.33.2-by-rayss"}`;
112458
+ return `openclaude/${"0.34.0"}`;
112208
112459
  } catch {
112209
112460
  return "openclaude/0.0.0";
112210
112461
  }
@@ -112216,7 +112467,7 @@ function getUserAgent() {
112216
112467
  const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
112217
112468
  const workload = getWorkload();
112218
112469
  const workloadSuffix = workload ? `, workload/${workload}` : "";
112219
- return `claude-cli/${"0.33.2-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
112470
+ return `claude-cli/${"0.34.0"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
112220
112471
  }
112221
112472
  function getMCPUserAgent() {
112222
112473
  const parts = [];
@@ -112230,7 +112481,7 @@ function getMCPUserAgent() {
112230
112481
  parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
112231
112482
  }
112232
112483
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
112233
- return `claude-code/${"0.33.2-by-rayss"}${suffix}`;
112484
+ return `claude-code/${"0.34.0"}${suffix}`;
112234
112485
  }
112235
112486
  function getWebFetchUserAgent() {
112236
112487
  const supportUrl = isFirstPartyAnthropicProvider() ? "https://support.anthropic.com/" : "https://github.com/rayss868/openclaude";
@@ -115726,11 +115977,13 @@ function createRequestBodyPlanner(context) {
115726
115977
  options.temperature = params.temperature;
115727
115978
  if (params.top_p !== undefined)
115728
115979
  options.top_p = params.top_p;
115980
+ const think = request.reasoning?.effort ? ["xhigh", "max", "ultracode"].includes(request.reasoning.effort) ? "high" : request.reasoning.effort : false;
115729
115981
  return {
115730
115982
  model: request.resolvedModel,
115731
115983
  messages: normalizeOllamaNativeMessages(body.messages),
115732
115984
  stream: params.stream ?? false,
115733
115985
  options,
115986
+ think,
115734
115987
  ...body.tools ? { tools: body.tools } : {}
115735
115988
  };
115736
115989
  };
@@ -156990,7 +157243,7 @@ function computeFingerprint(messageText2, version2) {
156990
157243
  }
156991
157244
  function computeFingerprintFromMessages(messages) {
156992
157245
  const firstMessageText = extractFirstMessageText(messages);
156993
- return computeFingerprint(firstMessageText, "0.33.2-by-rayss");
157246
+ return computeFingerprint(firstMessageText, "0.34.0");
156994
157247
  }
156995
157248
  var FINGERPRINT_SALT = "59cf53e54c78";
156996
157249
  var init_fingerprint = () => {};
@@ -158473,7 +158726,7 @@ var init_client2 = __esm(() => {
158473
158726
  const client = new Client({
158474
158727
  name: "claude-code",
158475
158728
  title: "OpenClaude",
158476
- version: "0.33.2-by-rayss",
158729
+ version: "0.34.0",
158477
158730
  description: "OpenClaude — coding-agent CLI for any LLM provider",
158478
158731
  websiteUrl: PRODUCT_URL
158479
158732
  }, {
@@ -228447,6 +228700,13 @@ var init_prefetch = __esm(() => {
228447
228700
  import { readdir as readdir16, stat as stat23 } from "fs/promises";
228448
228701
  import nodePath2, { dirname as dirname40, parse as parse10, relative as relative12, resolve as resolve28 } from "path";
228449
228702
  import { randomUUID as randomUUID16 } from "crypto";
228703
+ function getTodoReminderConfig() {
228704
+ const config2 = getSettings_DEPRECATED()?.todoReminder;
228705
+ return {
228706
+ turnsSinceWrite: config2?.turnsSinceWrite ?? getEnvNumber("OPENCLAUDE_TODO_REMINDER_TURNS_SINCE_WRITE", 10),
228707
+ turnsBetweenReminders: config2?.turnsBetweenReminders ?? getEnvNumber("OPENCLAUDE_TODO_REMINDER_TURNS_BETWEEN_REMINDERS", 10)
228708
+ };
228709
+ }
228450
228710
  function shouldIncludeSkillListingAttachment(querySource) {
228451
228711
  return !(typeof querySource === "string" && SKILL_LISTING_SUPPRESSED_QUERY_SOURCES.has(querySource));
228452
228712
  }
@@ -229797,7 +230057,8 @@ async function getTodoReminderAttachments(messages, toolUseContext) {
229797
230057
  return [];
229798
230058
  }
229799
230059
  const { turnsSinceLastTodoWrite, turnsSinceLastReminder } = getTodoReminderTurnCounts(messages);
229800
- if (turnsSinceLastTodoWrite >= TODO_REMINDER_CONFIG.TURNS_SINCE_WRITE && turnsSinceLastReminder >= TODO_REMINDER_CONFIG.TURNS_BETWEEN_REMINDERS) {
230060
+ const reminderConfig = getTodoReminderConfig();
230061
+ if (turnsSinceLastTodoWrite >= reminderConfig.turnsSinceWrite && turnsSinceLastReminder >= reminderConfig.turnsBetweenReminders) {
229801
230062
  const todoKey = toolUseContext.agentId ?? getSessionId();
229802
230063
  const appState = toolUseContext.getAppState();
229803
230064
  const todos = appState.todos[todoKey] ?? [];
@@ -229858,7 +230119,8 @@ async function getTaskReminderAttachments(messages, toolUseContext) {
229858
230119
  return [];
229859
230120
  }
229860
230121
  const { turnsSinceLastTaskManagement, turnsSinceLastReminder } = getTaskReminderTurnCounts(messages);
229861
- if (turnsSinceLastTaskManagement >= TODO_REMINDER_CONFIG.TURNS_SINCE_WRITE && turnsSinceLastReminder >= TODO_REMINDER_CONFIG.TURNS_BETWEEN_REMINDERS) {
230122
+ const reminderConfig = getTodoReminderConfig();
230123
+ if (turnsSinceLastTaskManagement >= reminderConfig.turnsSinceWrite && turnsSinceLastReminder >= reminderConfig.turnsBetweenReminders) {
229862
230124
  const tasks = await listTasks(getTaskListId());
229863
230125
  return [
229864
230126
  {
@@ -230180,7 +230442,7 @@ function isFileReadDenied(filePath, toolPermissionContext) {
230180
230442
  const denyRule = matchingRuleForInput(filePath, toolPermissionContext, "read", "deny");
230181
230443
  return denyRule !== null;
230182
230444
  }
230183
- var skillSearchModules, autoModeStateModule2, BRIEF_TOOL_NAME2 = null, TODO_REMINDER_CONFIG, 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;
230445
+ 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;
230184
230446
  var init_attachments2 = __esm(() => {
230185
230447
  init_metadata();
230186
230448
  init_Tool();
@@ -230201,6 +230463,7 @@ var init_attachments2 = __esm(() => {
230201
230463
  init_diagnosticTracking();
230202
230464
  init_settings2();
230203
230465
  init_providers();
230466
+ init_envUtils();
230204
230467
  init_effort();
230205
230468
  init_utils5();
230206
230469
  init_imageResizer();
@@ -230260,10 +230523,6 @@ var init_attachments2 = __esm(() => {
230260
230523
  prefetch: (init_prefetch(), __toCommonJS(exports_prefetch))
230261
230524
  };
230262
230525
  autoModeStateModule2 = __toCommonJS(exports_autoModeState);
230263
- TODO_REMINDER_CONFIG = {
230264
- TURNS_SINCE_WRITE: 10,
230265
- TURNS_BETWEEN_REMINDERS: 10
230266
- };
230267
230526
  PLAN_MODE_ATTACHMENT_CONFIG = {
230268
230527
  TURNS_BETWEEN_ATTACHMENTS: 5,
230269
230528
  FULL_REMINDER_EVERY_N_ATTACHMENTS: 5
@@ -238462,7 +238721,7 @@ function getAnthropicEnvMetadata() {
238462
238721
  function getBuildAgeMinutes() {
238463
238722
  if (false)
238464
238723
  ;
238465
- const buildTime = new Date("2026-10-23T01:50:01.313Z").getTime();
238724
+ const buildTime = new Date("2026-11-08T14:26:39.046Z").getTime();
238466
238725
  if (isNaN(buildTime))
238467
238726
  return;
238468
238727
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -248539,10 +248798,8 @@ function convertOllamaStreamingResponse(response, fallbackModel, makeMessageId2
248539
248798
  buffer = lines.pop() ?? "";
248540
248799
  let emitted = false;
248541
248800
  for (const line of lines)
248542
- if (line.trim()) {
248543
- enqueue(line.trim(), controller);
248801
+ if (line.trim() && enqueue(line.trim(), controller))
248544
248802
  emitted = true;
248545
- }
248546
248803
  if (emitted)
248547
248804
  return;
248548
248805
  }
@@ -248556,7 +248813,7 @@ function convertOllamaStreamingResponse(response, fallbackModel, makeMessageId2
248556
248813
  try {
248557
248814
  data = JSON.parse(line);
248558
248815
  } catch {
248559
- return;
248816
+ return false;
248560
248817
  }
248561
248818
  const model = data.model ?? fallbackModel;
248562
248819
  const chunks = [];
@@ -248582,6 +248839,7 @@ function convertOllamaStreamingResponse(response, fallbackModel, makeMessageId2
248582
248839
  }
248583
248840
  for (const chunk of chunks)
248584
248841
  controller.enqueue(encoder.encode(chunk));
248842
+ return chunks.length > 0;
248585
248843
  }
248586
248844
  return responseWithPreservedUrl(stream4, { status: response.status, statusText: response.statusText, headers: { "content-type": "text/event-stream" } }, response.url);
248587
248845
  }
@@ -249218,6 +249476,13 @@ function convertNonStreamingResponseToAnthropicMessage(data, model, deps) {
249218
249476
  content.push({ type: "text", text: `
249219
249477
 
249220
249478
  [Content blocked by provider safety filter]` });
249479
+ } else if (choice?.finish_reason === "length") {
249480
+ content.push({
249481
+ type: "text",
249482
+ text: `
249483
+
249484
+ [Response truncated — reached length limit or upstream stalled. Ask the model to continue.]`
249485
+ });
249221
249486
  }
249222
249487
  return {
249223
249488
  id: data.id ?? deps.makeMessageId(),
@@ -249259,8 +249524,290 @@ function getStreamStats(state2) {
249259
249524
  };
249260
249525
  }
249261
249526
 
249527
+ // src/services/api/openaiShim/xmlToolCallParsing.ts
249528
+ function coerceXmlToolValue(raw) {
249529
+ const trimmed = raw.trim();
249530
+ if (trimmed === "")
249531
+ return "";
249532
+ try {
249533
+ return JSON.parse(trimmed);
249534
+ } catch {
249535
+ return raw;
249536
+ }
249537
+ }
249538
+ function parseHy3ToolCallInner(inner) {
249539
+ const args = {};
249540
+ const trimmed = inner.trim();
249541
+ const name = trimmed.split(/[\n<]/, 1)[0]?.trim().replace(/[\s`*_]+$/, "");
249542
+ let hasStructuredArguments = false;
249543
+ for (const parameter of inner.matchAll(HY3_PARAMETER_RE)) {
249544
+ const key = parameter[1];
249545
+ if (key) {
249546
+ hasStructuredArguments = true;
249547
+ args[key] = coerceXmlToolValue(parameter[2] ?? "");
249548
+ }
249549
+ }
249550
+ for (const line of inner.matchAll(HY3_NAMED_ARGUMENT_LINE_RE)) {
249551
+ const key = line[1];
249552
+ if (key) {
249553
+ hasStructuredArguments = true;
249554
+ args[key] = coerceXmlToolValue(line[2] ?? "");
249555
+ }
249556
+ }
249557
+ for (const pair of inner.matchAll(HY3_ARG_PAIR_RE)) {
249558
+ const key = pair[1]?.trim();
249559
+ if (key) {
249560
+ hasStructuredArguments = true;
249561
+ args[key] = coerceXmlToolValue(pair[2] ?? "");
249562
+ }
249563
+ }
249564
+ return {
249565
+ name: name && /^[A-Za-z_][\w.-]*$/.test(name) && (hasStructuredArguments || trimmed === name) ? name : undefined,
249566
+ args
249567
+ };
249568
+ }
249569
+ function isHy3Model(model) {
249570
+ return model.split("?", 1)[0]?.toLowerCase() === "tencent/hy3";
249571
+ }
249572
+ function trailingXmlOpenerPrefixLen(s, allowHy3) {
249573
+ let longest = 0;
249574
+ const openers = allowHy3 ? XML_TOOL_CALL_OPENERS : [XML_TOOL_CALL_OPEN];
249575
+ for (const opener2 of openers) {
249576
+ const max2 = Math.min(s.length, opener2.length - 1);
249577
+ for (let len = max2;len > 0; len--) {
249578
+ if (opener2.startsWith(s.slice(s.length - len))) {
249579
+ longest = Math.max(longest, len);
249580
+ break;
249581
+ }
249582
+ }
249583
+ }
249584
+ return longest;
249585
+ }
249586
+ function findXmlToolCallOpener(text, allowHy3) {
249587
+ const openers = allowHy3 ? XML_TOOL_CALL_OPENERS : [XML_TOOL_CALL_OPEN];
249588
+ return openers.reduce((first, opener2) => {
249589
+ const index = text.indexOf(opener2);
249590
+ return index === -1 ? first : first === -1 ? index : Math.min(first, index);
249591
+ }, -1);
249592
+ }
249593
+ function isJsonText(raw) {
249594
+ try {
249595
+ JSON.parse(raw);
249596
+ return true;
249597
+ } catch {
249598
+ return false;
249599
+ }
249600
+ }
249601
+ function findJsonEnvelopeBody(text, bodyStart) {
249602
+ const firstClose = text.indexOf(XML_TOOL_CALL_CLOSE, bodyStart);
249603
+ const jsonStart = text.indexOf("{", bodyStart);
249604
+ if (jsonStart === -1 || firstClose !== -1 && jsonStart > firstClose)
249605
+ return null;
249606
+ const lead = text.slice(bodyStart, jsonStart);
249607
+ if (XML_FUNCTION_NAME_RE.test(lead) || lead.includes(XML_ARG_KEY_OPEN))
249608
+ return null;
249609
+ const json2 = extractBalancedJson(text, jsonStart);
249610
+ if (!json2 || !isJsonText(json2))
249611
+ return null;
249612
+ const jsonEnd = jsonStart + json2.length;
249613
+ const closeIndex = text.indexOf(XML_TOOL_CALL_CLOSE, jsonEnd);
249614
+ return closeIndex === -1 ? { json: [jsonStart, jsonEnd], bodyEnd: text.length, end: text.length } : { json: [jsonStart, jsonEnd], bodyEnd: closeIndex, end: closeIndex + XML_TOOL_CALL_CLOSE.length };
249615
+ }
249616
+ function xmlToolCallBlockMarkup(block2) {
249617
+ if (!block2.startsWith(XML_TOOL_CALL_OPEN))
249618
+ return block2;
249619
+ const envelope = findJsonEnvelopeBody(block2, XML_TOOL_CALL_OPEN.length);
249620
+ if (envelope?.end !== block2.length)
249621
+ return block2;
249622
+ return block2.slice(0, envelope.json[0]) + block2.slice(envelope.json[1]);
249623
+ }
249624
+ function findStandardXmlToolCallBlocks(text) {
249625
+ const blocks = [];
249626
+ let start = text.indexOf(XML_TOOL_CALL_OPEN);
249627
+ while (start !== -1) {
249628
+ const bodyStart = start + XML_TOOL_CALL_OPEN.length;
249629
+ const envelope = findJsonEnvelopeBody(text, bodyStart);
249630
+ let end;
249631
+ if (envelope) {
249632
+ end = envelope.end;
249633
+ blocks.push({
249634
+ range: [start, end],
249635
+ inner: text.slice(bodyStart, envelope.bodyEnd),
249636
+ json: text.slice(envelope.json[0], envelope.json[1])
249637
+ });
249638
+ } else {
249639
+ const closeIndex = text.indexOf(XML_TOOL_CALL_CLOSE, bodyStart);
249640
+ const bodyEnd = closeIndex === -1 ? text.length : closeIndex;
249641
+ end = closeIndex === -1 ? text.length : closeIndex + XML_TOOL_CALL_CLOSE.length;
249642
+ blocks.push({ range: [start, end], inner: text.slice(bodyStart, bodyEnd) });
249643
+ }
249644
+ start = text.indexOf(XML_TOOL_CALL_OPEN, end);
249645
+ }
249646
+ return blocks;
249647
+ }
249648
+ function findXmlToolCallBlockRanges(text, allowHy3 = false) {
249649
+ const ranges = findStandardXmlToolCallBlocks(text).map((block2) => block2.range);
249650
+ if (allowHy3) {
249651
+ for (const blockRe of [HY3_TOOL_CALLS_BLOCK_RE, HY3_TOOL_CALL_BLOCK_RE]) {
249652
+ for (const block2 of text.matchAll(blockRe)) {
249653
+ ranges.push([block2.index, block2.index + block2[0].length]);
249654
+ }
249655
+ }
249656
+ }
249657
+ return ranges.sort((left, right) => left[0] - right[0] || right[1] - left[1]);
249658
+ }
249659
+ function parseStandardXmlToolCallInner(inner, envelopeJson) {
249660
+ let name;
249661
+ const args = {};
249662
+ const trimmedInner = inner.trim();
249663
+ const isJsonEnvelope = envelopeJson !== undefined;
249664
+ const fnMatch = isJsonEnvelope ? null : inner.match(XML_FUNCTION_NAME_RE);
249665
+ if (fnMatch) {
249666
+ name = fnMatch[1];
249667
+ for (const p of inner.matchAll(XML_PARAMETER_RE)) {
249668
+ const key = p[1];
249669
+ if (key)
249670
+ args[key] = coerceXmlToolValue(p[2] ?? "");
249671
+ }
249672
+ } else {
249673
+ const argPairs = [...inner.matchAll(XML_ARG_PAIR_RE)];
249674
+ if (argPairs.length > 0 && !isJsonEnvelope && !trimmedInner.startsWith("{")) {
249675
+ const nameTok = trimmedInner.split(/[\n<]/, 1)[0]?.trim();
249676
+ if (nameTok)
249677
+ name = nameTok;
249678
+ for (const p of argPairs) {
249679
+ const key = (p[1] ?? "").trim();
249680
+ if (key)
249681
+ args[key] = coerceXmlToolValue(p[2] ?? "");
249682
+ }
249683
+ } else if (isJsonEnvelope) {
249684
+ const obj = JSON.parse(envelopeJson);
249685
+ if (typeof obj["name"] === "string") {
249686
+ name = obj["name"];
249687
+ const rawArgs = obj["arguments"];
249688
+ if (typeof rawArgs === "string") {
249689
+ try {
249690
+ Object.assign(args, JSON.parse(rawArgs));
249691
+ } catch {}
249692
+ } else if (rawArgs && typeof rawArgs === "object") {
249693
+ Object.assign(args, rawArgs);
249694
+ }
249695
+ }
249696
+ }
249697
+ }
249698
+ return { name, args };
249699
+ }
249700
+ function parseXmlToolCalls(text, allowHy3, nextSequence) {
249701
+ const results = [];
249702
+ const seen = new Set;
249703
+ const ranges = [];
249704
+ const addCall = (name, args) => {
249705
+ const dedupKey = `${name}:${JSON.stringify(args)}`;
249706
+ if (seen.has(dedupKey))
249707
+ return;
249708
+ seen.add(dedupKey);
249709
+ results.push({ id: `xml_tc_${nextSequence()}`, name, arguments: args });
249710
+ };
249711
+ const hy3Blocks = allowHy3 ? [...text.matchAll(HY3_TOOL_CALL_BLOCK_RE)].map((block2) => ({
249712
+ range: [block2.index, block2.index + block2[0].length],
249713
+ parsed: parseHy3ToolCallInner(block2[1] ?? "")
249714
+ })) : [];
249715
+ const hy3WrapperRanges = allowHy3 ? [...text.matchAll(HY3_TOOL_CALLS_BLOCK_RE)].filter((wrapper) => {
249716
+ const range = [
249717
+ wrapper.index,
249718
+ wrapper.index + wrapper[0].length
249719
+ ];
249720
+ return hy3Blocks.some((block2) => block2.parsed.name && range[0] <= block2.range[0] && block2.range[1] <= range[1]);
249721
+ }).map((wrapper) => [
249722
+ wrapper.index,
249723
+ wrapper.index + wrapper[0].length
249724
+ ]) : [];
249725
+ const candidates = [];
249726
+ for (const block2 of hy3Blocks) {
249727
+ const { name, args } = block2.parsed;
249728
+ if (!name)
249729
+ continue;
249730
+ const range = block2.range;
249731
+ candidates.push({
249732
+ range,
249733
+ name,
249734
+ args,
249735
+ coveredByWrapper: hy3WrapperRanges.some((wrapper) => wrapper[0] <= range[0] && range[1] <= wrapper[1])
249736
+ });
249737
+ }
249738
+ for (const { range, inner, json: json2 } of findStandardXmlToolCallBlocks(text)) {
249739
+ const { name, args } = parseStandardXmlToolCallInner(inner, json2);
249740
+ if (!name)
249741
+ continue;
249742
+ candidates.push({
249743
+ range,
249744
+ name,
249745
+ args,
249746
+ coveredByWrapper: false
249747
+ });
249748
+ }
249749
+ candidates.sort((left, right) => left.range[0] - right.range[0]);
249750
+ for (const candidate of candidates) {
249751
+ addCall(candidate.name, candidate.args);
249752
+ if (!candidate.coveredByWrapper) {
249753
+ ranges.push(candidate.range);
249754
+ }
249755
+ }
249756
+ ranges.push(...hy3WrapperRanges);
249757
+ ranges.sort((left, right) => left[0] - right[0]);
249758
+ return { calls: results, toolCallRanges: ranges };
249759
+ }
249760
+ 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;
249761
+ var init_xmlToolCallParsing = __esm(() => {
249762
+ init_rawToolCallParsing();
249763
+ HY3_PARAMETER_RE = /<parameter\s+name=["']([^"'>\s]+)["']\s*>([\s\S]*?)<\/parameter>/g;
249764
+ HY3_NAMED_ARGUMENT_LINE_RE = /^\s*([A-Za-z_][\w-]*)\s*:\s*(.+?)\s*$/gm;
249765
+ HY3_ARG_PAIR_RE = /<arg_key(?::[^>\s]+)?>([\s\S]*?)<\/arg_key(?::[^>\s]+)?>\s*<arg_value(?::[^>\s]+)?>([\s\S]*?)<\/arg_value(?::[^>\s]+)?>/g;
249766
+ XML_TOOL_CALL_OPENERS = [
249767
+ XML_TOOL_CALL_OPEN,
249768
+ HY3_TOOL_CALLS_OPEN,
249769
+ HY3_TOOL_CALL_OPEN
249770
+ ];
249771
+ HY3_TOOL_CALLS_BLOCK_RE = /<tool_calls:[^>\s]+>([\s\S]*?)(?:<\/tool_calls(?::[^>\s]+)?>|$)/g;
249772
+ HY3_TOOL_CALL_BLOCK_RE = /<tool_call:[^>\s]+>([\s\S]*?)(?:<\/tool_call(?::[^>\s]+)?>|$)/g;
249773
+ XML_FUNCTION_NAME_RE = /<function=([^>\s]+)\s*>/;
249774
+ XML_PARAMETER_RE = /<parameter=([^>\s]+)\s*>([\s\S]*?)<\/parameter>/g;
249775
+ XML_ARG_PAIR_RE = /<arg_key>([\s\S]*?)<\/arg_key>\s*<arg_value>([\s\S]*?)<\/arg_value>/g;
249776
+ });
249777
+
249262
249778
  // src/services/api/openaiShim/streamConversion.ts
249263
249779
  import { APIError as APIError7 } from "@anthropic-ai/sdk";
249780
+ function reasoningMarkupTouchesBlock(text, start, block2) {
249781
+ const markup = xmlToolCallBlockMarkup(block2);
249782
+ if (stripThinkTags(markup) !== markup)
249783
+ return true;
249784
+ const lastTagEnd = start > 0 ? text.lastIndexOf(">", start - 1) : -1;
249785
+ const openerTail = text.slice(lastTagEnd + 1, text.indexOf(">", start) + 1);
249786
+ return stripThinkTags(openerTail) !== openerTail;
249787
+ }
249788
+ function visibleTextKeepingToolCallBlocks(text, blockRanges) {
249789
+ const filter2 = createThinkTagFilter();
249790
+ let visible = "";
249791
+ let position = 0;
249792
+ for (const [start, end] of blockRanges) {
249793
+ if (start < position) {
249794
+ if (end > position)
249795
+ return null;
249796
+ continue;
249797
+ }
249798
+ const block2 = text.slice(start, end);
249799
+ if (reasoningMarkupTouchesBlock(text, start, block2))
249800
+ return null;
249801
+ const before = filter2.feed(text.slice(position, start) + TOOL_CALL_BLOCK_BOUNDARY);
249802
+ if (filter2.isInsideBlock()) {
249803
+ visible += before;
249804
+ } else {
249805
+ visible += before.slice(0, -1) + block2;
249806
+ }
249807
+ position = end;
249808
+ }
249809
+ return visible + filter2.feed(text.slice(position));
249810
+ }
249264
249811
  function convertOpenAIStreamUsage(usage) {
249265
249812
  if (!usage)
249266
249813
  return;
@@ -249273,24 +249820,24 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
249273
249820
  createReaderCanceller: createReaderCanceller2,
249274
249821
  createProviderStreamTrace: createProviderStreamTrace2,
249275
249822
  createStreamAbortError: createStreamAbortError2,
249276
- findXmlToolCallOpener,
249823
+ findXmlToolCallOpener: findXmlToolCallOpener2,
249277
249824
  geminiThoughtSignatureFromExtraContent: geminiThoughtSignatureFromExtraContent2,
249278
249825
  getStreamIdleTimeoutMs: getStreamIdleTimeoutMs2,
249279
249826
  headersWithRequestUrl,
249280
- isHy3Model,
249827
+ isHy3Model: isHy3Model2,
249281
249828
  makeMessageId: makeMessageId2,
249282
249829
  mergeGeminiThoughtSignature: mergeGeminiThoughtSignature2,
249283
249830
  parseRawToolCallsRequestedText: parseRawToolCallsRequestedText2,
249284
249831
  parseTextToolCalls: parseTextToolCalls2,
249285
- parseXmlToolCalls,
249832
+ parseXmlToolCalls: parseXmlToolCalls2,
249286
249833
  readWithIdleTimeout: readWithIdleTimeout2,
249287
249834
  repairPossiblyTruncatedObjectJson: repairPossiblyTruncatedObjectJson2,
249288
249835
  stripRanges: stripRanges2,
249289
249836
  throwIfStreamAborted: throwIfStreamAborted2,
249290
- trailingXmlOpenerPrefixLen
249837
+ trailingXmlOpenerPrefixLen: trailingXmlOpenerPrefixLen2
249291
249838
  } = dependencies2;
249292
249839
  const messageId = makeMessageId2();
249293
- const allowHy3ToolCalls = isHy3Model(model);
249840
+ const allowHy3ToolCalls = isHy3Model2(model);
249294
249841
  let contentBlockIndex = 0;
249295
249842
  const activeToolCalls = new Map;
249296
249843
  let hasEmittedContentStart = false;
@@ -249663,7 +250210,7 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
249663
250210
  }
249664
250211
  } else {
249665
250212
  const combined = xmlHoldback + delta.content;
249666
- const openIdx = findXmlToolCallOpener(combined, allowHy3ToolCalls);
250213
+ const openIdx = findXmlToolCallOpener2(combined, allowHy3ToolCalls);
249667
250214
  if (openIdx !== -1) {
249668
250215
  const before = combined.slice(0, openIdx);
249669
250216
  if (before)
@@ -249671,7 +250218,7 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
249671
250218
  xmlHoldback = "";
249672
250219
  xmlToolCallText = combined.slice(openIdx);
249673
250220
  } else {
249674
- const keep = trailingXmlOpenerPrefixLen(combined, allowHy3ToolCalls);
250221
+ const keep = trailingXmlOpenerPrefixLen2(combined, allowHy3ToolCalls);
249675
250222
  const emit2 = keep > 0 ? combined.slice(0, combined.length - keep) : combined;
249676
250223
  xmlHoldback = keep > 0 ? combined.slice(combined.length - keep) : "";
249677
250224
  if (emit2)
@@ -249799,10 +250346,25 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
249799
250346
  const originalFinishReason = choice.finish_reason;
249800
250347
  let ollamaClosedContentBlock = false;
249801
250348
  if (isTerminalOllamaFinish) {
249802
- const { calls: textToolCalls, toolCallRanges } = parseTextToolCalls2(accumulatedText);
250349
+ let toolCallSource = accumulatedText;
250350
+ let { calls: textToolCalls, toolCallRanges } = parseTextToolCalls2(accumulatedText);
250351
+ if (textToolCalls.length === 0) {
250352
+ ({ calls: textToolCalls, toolCallRanges } = parseXmlToolCalls2(accumulatedText, allowHy3ToolCalls));
250353
+ const visibleSource = textToolCalls.length > 0 ? visibleTextKeepingToolCallBlocks(accumulatedText, findXmlToolCallBlockRanges(accumulatedText, allowHy3ToolCalls)) : accumulatedText;
250354
+ const callKey = (tc) => `${tc.name}\x00${JSON.stringify(tc.arguments)}`;
250355
+ const rawCallKeys = new Set(textToolCalls.map(callKey));
250356
+ if (visibleSource !== null && visibleSource !== accumulatedText) {
250357
+ toolCallSource = visibleSource;
250358
+ ({ calls: textToolCalls, toolCallRanges } = parseXmlToolCalls2(toolCallSource, allowHy3ToolCalls));
250359
+ }
250360
+ if (visibleSource === null || textToolCalls.some((tc) => !rawCallKeys.has(callKey(tc)))) {
250361
+ textToolCalls = [];
250362
+ toolCallRanges = [];
250363
+ }
250364
+ }
249803
250365
  if (textToolCalls.length > 0) {
249804
250366
  ollamaClosedContentBlock = true;
249805
- const stripped = stripRanges2(accumulatedText, toolCallRanges).trim();
250367
+ const stripped = stripRanges2(toolCallSource, toolCallRanges).trim();
249806
250368
  const strippedVisible = stripThinkTags(stripped).trim();
249807
250369
  if (hasEmittedContentStart) {
249808
250370
  if (strippedVisible) {
@@ -249873,7 +250435,7 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
249873
250435
  if (!isOllamaStream && xmlToolCallText !== null) {
249874
250436
  const buffered = xmlToolCallText;
249875
250437
  xmlToolCallText = null;
249876
- const { calls, toolCallRanges } = parseXmlToolCalls(buffered, allowHy3ToolCalls);
250438
+ const { calls, toolCallRanges } = parseXmlToolCalls2(buffered, allowHy3ToolCalls);
249877
250439
  if (calls.length > 0) {
249878
250440
  const stripped = stripRanges2(buffered, toolCallRanges).trim();
249879
250441
  const strippedVisible = stripThinkTags(stripped).trim();
@@ -250071,13 +250633,14 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
250071
250633
  throwIfStreamAborted2(signal);
250072
250634
  yield { type: "message_stop" };
250073
250635
  }
250074
- var JSON_REPAIR_SUFFIXES2;
250636
+ var JSON_REPAIR_SUFFIXES2, TOOL_CALL_BLOCK_BOUNDARY = "\x00";
250075
250637
  var init_streamConversion = __esm(() => {
250076
250638
  init_cacheMetrics();
250077
250639
  init_openaiErrorClassification();
250078
250640
  init_thinkTagSanitizer();
250079
250641
  init_toolArgumentNormalization();
250080
250642
  init_debug();
250643
+ init_xmlToolCallParsing();
250081
250644
  JSON_REPAIR_SUFFIXES2 = [
250082
250645
  "}",
250083
250646
  '"}',
@@ -250332,203 +250895,6 @@ var init_geminiStreamConversion = __esm(() => {
250332
250895
  init_debug();
250333
250896
  });
250334
250897
 
250335
- // src/services/api/openaiShim/xmlToolCallParsing.ts
250336
- function coerceXmlToolValue(raw) {
250337
- const trimmed = raw.trim();
250338
- if (trimmed === "")
250339
- return "";
250340
- try {
250341
- return JSON.parse(trimmed);
250342
- } catch {
250343
- return raw;
250344
- }
250345
- }
250346
- function parseHy3ToolCallInner(inner) {
250347
- const args = {};
250348
- const trimmed = inner.trim();
250349
- const name = trimmed.split(/[\n<]/, 1)[0]?.trim().replace(/[\s`*_]+$/, "");
250350
- let hasStructuredArguments = false;
250351
- for (const parameter of inner.matchAll(HY3_PARAMETER_RE)) {
250352
- const key = parameter[1];
250353
- if (key) {
250354
- hasStructuredArguments = true;
250355
- args[key] = coerceXmlToolValue(parameter[2] ?? "");
250356
- }
250357
- }
250358
- for (const line of inner.matchAll(HY3_NAMED_ARGUMENT_LINE_RE)) {
250359
- const key = line[1];
250360
- if (key) {
250361
- hasStructuredArguments = true;
250362
- args[key] = coerceXmlToolValue(line[2] ?? "");
250363
- }
250364
- }
250365
- for (const pair of inner.matchAll(HY3_ARG_PAIR_RE)) {
250366
- const key = pair[1]?.trim();
250367
- if (key) {
250368
- hasStructuredArguments = true;
250369
- args[key] = coerceXmlToolValue(pair[2] ?? "");
250370
- }
250371
- }
250372
- return {
250373
- name: name && /^[A-Za-z_][\w.-]*$/.test(name) && (hasStructuredArguments || trimmed === name) ? name : undefined,
250374
- args
250375
- };
250376
- }
250377
- function isHy3Model(model) {
250378
- return model.split("?", 1)[0]?.toLowerCase() === "tencent/hy3";
250379
- }
250380
- function trailingXmlOpenerPrefixLen(s, allowHy3) {
250381
- let longest = 0;
250382
- const openers = allowHy3 ? XML_TOOL_CALL_OPENERS : [XML_TOOL_CALL_OPEN];
250383
- for (const opener2 of openers) {
250384
- const max2 = Math.min(s.length, opener2.length - 1);
250385
- for (let len = max2;len > 0; len--) {
250386
- if (opener2.startsWith(s.slice(s.length - len))) {
250387
- longest = Math.max(longest, len);
250388
- break;
250389
- }
250390
- }
250391
- }
250392
- return longest;
250393
- }
250394
- function findXmlToolCallOpener(text, allowHy3) {
250395
- const openers = allowHy3 ? XML_TOOL_CALL_OPENERS : [XML_TOOL_CALL_OPEN];
250396
- return openers.reduce((first, opener2) => {
250397
- const index = text.indexOf(opener2);
250398
- return index === -1 ? first : first === -1 ? index : Math.min(first, index);
250399
- }, -1);
250400
- }
250401
- function parseStandardXmlToolCallInner(inner) {
250402
- let name;
250403
- const args = {};
250404
- const fnMatch = inner.match(XML_FUNCTION_NAME_RE);
250405
- if (fnMatch) {
250406
- name = fnMatch[1];
250407
- for (const p of inner.matchAll(XML_PARAMETER_RE)) {
250408
- const key = p[1];
250409
- if (key)
250410
- args[key] = coerceXmlToolValue(p[2] ?? "");
250411
- }
250412
- } else {
250413
- const trimmedInner = inner.trim();
250414
- const argPairs = [...inner.matchAll(XML_ARG_PAIR_RE)];
250415
- if (argPairs.length > 0 && !trimmedInner.startsWith("{")) {
250416
- const nameTok = trimmedInner.split(/[\n<]/, 1)[0]?.trim();
250417
- if (nameTok)
250418
- name = nameTok;
250419
- for (const p of argPairs) {
250420
- const key = (p[1] ?? "").trim();
250421
- if (key)
250422
- args[key] = coerceXmlToolValue(p[2] ?? "");
250423
- }
250424
- } else {
250425
- const jsonStart = trimmedInner.indexOf("{");
250426
- if (jsonStart !== -1) {
250427
- const jsonRaw = extractBalancedJson(trimmedInner, jsonStart);
250428
- if (jsonRaw) {
250429
- try {
250430
- const obj = JSON.parse(jsonRaw);
250431
- if (typeof obj["name"] === "string") {
250432
- name = obj["name"];
250433
- const rawArgs = obj["arguments"];
250434
- if (typeof rawArgs === "string") {
250435
- try {
250436
- Object.assign(args, JSON.parse(rawArgs));
250437
- } catch {}
250438
- } else if (rawArgs && typeof rawArgs === "object") {
250439
- Object.assign(args, rawArgs);
250440
- }
250441
- }
250442
- } catch {}
250443
- }
250444
- }
250445
- }
250446
- }
250447
- return { name, args };
250448
- }
250449
- function parseXmlToolCalls(text, allowHy3, nextSequence) {
250450
- const results = [];
250451
- const seen = new Set;
250452
- const ranges = [];
250453
- const addCall = (name, args) => {
250454
- const dedupKey = `${name}:${JSON.stringify(args)}`;
250455
- if (seen.has(dedupKey))
250456
- return;
250457
- seen.add(dedupKey);
250458
- results.push({ id: `xml_tc_${nextSequence()}`, name, arguments: args });
250459
- };
250460
- const hy3Blocks = allowHy3 ? [...text.matchAll(HY3_TOOL_CALL_BLOCK_RE)].map((block2) => ({
250461
- range: [block2.index, block2.index + block2[0].length],
250462
- parsed: parseHy3ToolCallInner(block2[1] ?? "")
250463
- })) : [];
250464
- const hy3WrapperRanges = allowHy3 ? [...text.matchAll(HY3_TOOL_CALLS_BLOCK_RE)].filter((wrapper) => {
250465
- const range = [
250466
- wrapper.index,
250467
- wrapper.index + wrapper[0].length
250468
- ];
250469
- return hy3Blocks.some((block2) => block2.parsed.name && range[0] <= block2.range[0] && block2.range[1] <= range[1]);
250470
- }).map((wrapper) => [
250471
- wrapper.index,
250472
- wrapper.index + wrapper[0].length
250473
- ]) : [];
250474
- const candidates = [];
250475
- for (const block2 of hy3Blocks) {
250476
- const { name, args } = block2.parsed;
250477
- if (!name)
250478
- continue;
250479
- const range = block2.range;
250480
- candidates.push({
250481
- range,
250482
- name,
250483
- args,
250484
- coveredByWrapper: hy3WrapperRanges.some((wrapper) => wrapper[0] <= range[0] && range[1] <= wrapper[1])
250485
- });
250486
- }
250487
- for (const block2 of text.matchAll(XML_TOOL_CALL_BLOCK_RE)) {
250488
- const range = [
250489
- block2.index,
250490
- block2.index + block2[0].length
250491
- ];
250492
- const { name, args } = parseStandardXmlToolCallInner(block2[1] ?? "");
250493
- if (!name)
250494
- continue;
250495
- candidates.push({
250496
- range,
250497
- name,
250498
- args,
250499
- coveredByWrapper: false
250500
- });
250501
- }
250502
- candidates.sort((left, right) => left.range[0] - right.range[0]);
250503
- for (const candidate of candidates) {
250504
- addCall(candidate.name, candidate.args);
250505
- if (!candidate.coveredByWrapper) {
250506
- ranges.push(candidate.range);
250507
- }
250508
- }
250509
- ranges.push(...hy3WrapperRanges);
250510
- ranges.sort((left, right) => left[0] - right[0]);
250511
- return { calls: results, toolCallRanges: ranges };
250512
- }
250513
- 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;
250514
- var init_xmlToolCallParsing = __esm(() => {
250515
- init_rawToolCallParsing();
250516
- HY3_PARAMETER_RE = /<parameter\s+name=["']([^"'>\s]+)["']\s*>([\s\S]*?)<\/parameter>/g;
250517
- HY3_NAMED_ARGUMENT_LINE_RE = /^\s*([A-Za-z_][\w-]*)\s*:\s*(.+?)\s*$/gm;
250518
- HY3_ARG_PAIR_RE = /<arg_key(?::[^>\s]+)?>([\s\S]*?)<\/arg_key(?::[^>\s]+)?>\s*<arg_value(?::[^>\s]+)?>([\s\S]*?)<\/arg_value(?::[^>\s]+)?>/g;
250519
- XML_TOOL_CALL_OPENERS = [
250520
- XML_TOOL_CALL_OPEN,
250521
- HY3_TOOL_CALLS_OPEN,
250522
- HY3_TOOL_CALL_OPEN
250523
- ];
250524
- XML_TOOL_CALL_BLOCK_RE = /<tool_call>([\s\S]*?)(?:<\/tool_call>|$)/g;
250525
- HY3_TOOL_CALLS_BLOCK_RE = /<tool_calls:[^>\s]+>([\s\S]*?)(?:<\/tool_calls(?::[^>\s]+)?>|$)/g;
250526
- HY3_TOOL_CALL_BLOCK_RE = /<tool_call:[^>\s]+>([\s\S]*?)(?:<\/tool_call(?::[^>\s]+)?>|$)/g;
250527
- XML_FUNCTION_NAME_RE = /<function=([^>\s]+)\s*>/;
250528
- XML_PARAMETER_RE = /<parameter=([^>\s]+)\s*>([\s\S]*?)<\/parameter>/g;
250529
- XML_ARG_PAIR_RE = /<arg_key>([\s\S]*?)<\/arg_key>\s*<arg_value>([\s\S]*?)<\/arg_value>/g;
250530
- });
250531
-
250532
250898
  // src/services/api/openaiShim/responseAdapters.ts
250533
250899
  function makeMessageId2() {
250534
250900
  return `msg_${crypto.randomUUID().replace(/-/g, "")}`;
@@ -264010,9 +264376,24 @@ function getEntrypoint() {
264010
264376
  function isCustomTitleEnabled() {
264011
264377
  return true;
264012
264378
  }
264379
+ function followSessionSwitches() {
264380
+ if (unsubscribeSessionSwitch)
264381
+ return;
264382
+ pointerSessionId = getSessionId();
264383
+ pointerProjectDir = getSessionProjectDir();
264384
+ unsubscribeSessionSwitch = onSessionSwitch((sessionId) => {
264385
+ const projectDir = getSessionProjectDir();
264386
+ if (sessionId === pointerSessionId && projectDir === pointerProjectDir)
264387
+ return;
264388
+ pointerSessionId = sessionId;
264389
+ pointerProjectDir = projectDir;
264390
+ project?.resetSessionFile();
264391
+ });
264392
+ }
264013
264393
  function getProject() {
264014
264394
  if (!project) {
264015
264395
  project = new Project;
264396
+ followSessionSwitches();
264016
264397
  if (!cleanupRegistered2) {
264017
264398
  registerCleanup(async () => {
264018
264399
  await project?.flush();
@@ -264042,6 +264423,10 @@ function resetProjectFlushStateForTesting() {
264042
264423
  }
264043
264424
  function resetProjectForTesting() {
264044
264425
  project = null;
264426
+ unsubscribeSessionSwitch?.();
264427
+ unsubscribeSessionSwitch = null;
264428
+ pointerSessionId = null;
264429
+ pointerProjectDir = null;
264045
264430
  }
264046
264431
  function setSessionFileForTesting(path13) {
264047
264432
  getProject().sessionFile = path13;
@@ -264072,8 +264457,8 @@ class Project {
264072
264457
  currentSessionGoal;
264073
264458
  currentSessionBranch;
264074
264459
  sessionFile = null;
264075
- pendingEntries = [];
264076
- pendingEntriesSessionId = null;
264460
+ hasStartedSession = false;
264461
+ pendingEntries = new Map;
264077
264462
  remoteIngressUrl = null;
264078
264463
  internalEventWriter = null;
264079
264464
  internalEventReader = null;
@@ -264343,15 +264728,35 @@ class Project {
264343
264728
  return this.trackWrite(() => this.enqueueRewrite(filePath, (signal) => replaceFileAtomic(filePath, data, { signal })));
264344
264729
  }
264345
264730
  resetSessionFile() {
264731
+ if (this.sessionFile !== null)
264732
+ this.hasStartedSession = true;
264733
+ const startupMetadata = !this.hasStartedSession ? {
264734
+ title: this.currentSessionTitle,
264735
+ agentSetting: this.currentSessionAgentSetting,
264736
+ worktree: this.currentSessionWorktree
264737
+ } : undefined;
264346
264738
  this.sessionFile = null;
264347
- this.pendingEntries = [];
264348
- this.pendingEntriesSessionId = null;
264349
- }
264350
- dropForeignPendingEntries(sessionId) {
264351
- if (this.pendingEntriesSessionId !== null && this.pendingEntriesSessionId !== sessionId) {
264352
- this.pendingEntries = [];
264353
- this.pendingEntriesSessionId = null;
264354
- }
264739
+ this.clearSessionMetadata();
264740
+ if (startupMetadata) {
264741
+ this.currentSessionTitle = startupMetadata.title;
264742
+ this.currentSessionAgentSetting = startupMetadata.agentSetting;
264743
+ this.currentSessionWorktree = startupMetadata.worktree;
264744
+ }
264745
+ }
264746
+ clearSessionMetadata() {
264747
+ this.currentSessionTitle = undefined;
264748
+ this.currentSessionTag = undefined;
264749
+ this.currentSessionAgentName = undefined;
264750
+ this.currentSessionAgentColor = undefined;
264751
+ this.currentSessionLastPrompt = undefined;
264752
+ this.currentSessionAgentSetting = undefined;
264753
+ this.currentSessionMode = undefined;
264754
+ this.currentSessionWorktree = undefined;
264755
+ this.currentSessionPrNumber = undefined;
264756
+ this.currentSessionPrUrl = undefined;
264757
+ this.currentSessionPrRepository = undefined;
264758
+ this.currentSessionGoal = undefined;
264759
+ this.currentSessionBranch = undefined;
264355
264760
  }
264356
264761
  reAppendSessionMetadata(skipTitleRefresh = false) {
264357
264762
  if (!this.sessionFile)
@@ -264536,15 +264941,14 @@ class Project {
264536
264941
  return shouldSkipSessionPersistence();
264537
264942
  }
264538
264943
  async materializeSessionFile() {
264944
+ this.hasStartedSession = true;
264539
264945
  if (this.shouldSkipPersistence())
264540
264946
  return;
264541
- this.dropForeignPendingEntries(getSessionId());
264542
- this.ensureCurrentSessionFile();
264947
+ const sessionFile = resolvePath2(this.ensureCurrentSessionFile());
264543
264948
  this.reAppendSessionMetadata();
264544
- if (this.pendingEntries.length > 0) {
264545
- const buffered = this.pendingEntries;
264546
- this.pendingEntries = [];
264547
- this.pendingEntriesSessionId = null;
264949
+ const buffered = this.pendingEntries.get(sessionFile);
264950
+ if (buffered && buffered.length > 0) {
264951
+ this.pendingEntries.delete(sessionFile);
264548
264952
  for (const entry of buffered) {
264549
264953
  await this.appendEntry(entry);
264550
264954
  }
@@ -264679,9 +265083,13 @@ class Project {
264679
265083
  let sessionFile;
264680
265084
  if (isCurrentSession) {
264681
265085
  if (this.sessionFile === null) {
264682
- this.dropForeignPendingEntries(currentSessionId);
264683
- this.pendingEntriesSessionId = currentSessionId;
264684
- this.pendingEntries.push(entry);
265086
+ const pendingPath = resolvePath2(getTranscriptPath());
265087
+ let buffered = this.pendingEntries.get(pendingPath);
265088
+ if (!buffered) {
265089
+ buffered = [];
265090
+ this.pendingEntries.set(pendingPath, buffered);
265091
+ }
265092
+ buffered.push(entry);
264685
265093
  return;
264686
265094
  }
264687
265095
  sessionFile = this.sessionFile;
@@ -264773,6 +265181,7 @@ class Project {
264773
265181
  async forgetDeletedSession(sessionId, transcriptPath) {
264774
265182
  this.deletedSessionFiles.add(resolvePath2(transcriptPath));
264775
265183
  this.existingSessionFiles.delete(sessionId);
265184
+ this.pendingEntries.delete(resolvePath2(transcriptPath));
264776
265185
  if (this.sessionFile && this.isDeletedSessionFile(this.sessionFile)) {
264777
265186
  this.resetSessionFile();
264778
265187
  }
@@ -265888,20 +266297,7 @@ function restoreSessionMetadata(meta) {
265888
266297
  project2.currentSessionBranch = meta.sessionBranch ?? undefined;
265889
266298
  }
265890
266299
  function clearSessionMetadata() {
265891
- const project2 = getProject();
265892
- project2.currentSessionTitle = undefined;
265893
- project2.currentSessionTag = undefined;
265894
- project2.currentSessionAgentName = undefined;
265895
- project2.currentSessionAgentColor = undefined;
265896
- project2.currentSessionLastPrompt = undefined;
265897
- project2.currentSessionAgentSetting = undefined;
265898
- project2.currentSessionMode = undefined;
265899
- project2.currentSessionWorktree = undefined;
265900
- project2.currentSessionPrNumber = undefined;
265901
- project2.currentSessionPrUrl = undefined;
265902
- project2.currentSessionPrRepository = undefined;
265903
- project2.currentSessionGoal = undefined;
265904
- project2.currentSessionBranch = undefined;
266300
+ getProject().clearSessionMetadata();
265905
266301
  }
265906
266302
  function reAppendSessionMetadata() {
265907
266303
  getProject().reAppendSessionMetadata();
@@ -267431,7 +267827,7 @@ async function enrichLogs(allLogs, startIndex, count4, options2) {
267431
267827
  }
267432
267828
  return { logs: result, nextIndex: i3 };
267433
267829
  }
267434
- 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, cleanupRegistered2 = 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, getSessionMessages2, INITIAL_ENRICH_COUNT = 50, SESSION_BRANCH_ENTRY_PREFIX = '{"type":"session-branch"', SESSION_BRANCH_ENTRY_PREFIX_SPACED = '{"type": "session-branch"';
267830
+ 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, cleanupRegistered2 = 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, getSessionMessages2, INITIAL_ENRICH_COUNT = 50, SESSION_BRANCH_ENTRY_PREFIX = '{"type":"session-branch"', SESSION_BRANCH_ENTRY_PREFIX_SPACED = '{"type": "session-branch"';
267435
267831
  var init_sessionStorage = __esm(() => {
267436
267832
  init_memoize();
267437
267833
  init_state();
@@ -267461,7 +267857,7 @@ var init_sessionStorage = __esm(() => {
267461
267857
  init_slowOperations();
267462
267858
  init_transcriptFileLock();
267463
267859
  init_uuid();
267464
- VERSION3 = typeof MACRO !== "undefined" ? "0.33.2-by-rayss" : "unknown";
267860
+ VERSION3 = typeof MACRO !== "undefined" ? "0.34.0" : "unknown";
267465
267861
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
267466
267862
  TRANSCRIPT_COPY_CHUNK_BYTES = 64 * 1024;
267467
267863
  transcriptRewriteHooksForTesting = {};
@@ -268938,7 +269334,7 @@ var init_filesystem = __esm(() => {
268938
269334
  });
268939
269335
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
268940
269336
  const nonce = randomBytes10(16).toString("hex");
268941
- return join94(getClaudeTempDir(), "bundled-skills", "0.33.2-by-rayss", nonce);
269337
+ return join94(getClaudeTempDir(), "bundled-skills", "0.34.0", nonce);
268942
269338
  });
268943
269339
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
268944
269340
  });
@@ -283477,7 +283873,7 @@ function buildSystemInitMessage(inputs) {
283477
283873
  slash_commands: inputs.commands.filter((c7) => c7.userInvocable !== false).map((c7) => c7.name),
283478
283874
  apiKeySource: getAnthropicApiKeyWithSource().source,
283479
283875
  betas: getSdkBetas(),
283480
- claude_code_version: "0.33.2-by-rayss",
283876
+ claude_code_version: "0.34.0",
283481
283877
  output_style: outputStyle,
283482
283878
  agents: inputs.agents.map((agent) => agent.agentType),
283483
283879
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -288101,4 +288497,4 @@ export {
288101
288497
  AbortError
288102
288498
  };
288103
288499
 
288104
- //# debugId=FF699A9CFF4EF9BA64756E2164756E21
288500
+ //# debugId=D63E3380C1B6979964756E2164756E21