opencode-anthropic-multi-account 0.2.104 → 0.2.105

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.
@@ -7,6 +7,7 @@ import { spawn } from "child_process";
7
7
  import { createServer } from "http";
8
8
  import { basename, dirname as dirname2, join as join2 } from "path";
9
9
  import {
10
+ chmodSync,
10
11
  existsSync as existsSync2,
11
12
  readFileSync,
12
13
  renameSync
@@ -2297,6 +2298,18 @@ function getOsName() {
2297
2298
  return "Linux";
2298
2299
  }
2299
2300
 
2301
+ // ../providers/claude-code/src/capture-provenance.ts
2302
+ import { randomUUID as randomUUID2 } from "crypto";
2303
+ function createClaudeCodeCaptureNonce() {
2304
+ return `kyoli-capture-${randomUUID2()}`;
2305
+ }
2306
+ function isClaudeCodeCaptureRequest(request, nonce) {
2307
+ if (request.method !== "POST" || !request.url || !nonce) {
2308
+ return false;
2309
+ }
2310
+ return request.url.split("?", 1)[0] === `/${nonce}/v1/messages`;
2311
+ }
2312
+
2300
2313
  // ../providers/claude-code/src/fingerprint-capture.ts
2301
2314
  var CURRENT_SCHEMA_VERSION = 2;
2302
2315
  var LIVE_TTL_MS = 24 * 60 * 60 * 1e3;
@@ -2419,6 +2432,13 @@ function quarantineCorruptCache(cachePath) {
2419
2432
  }
2420
2433
  function readLiveCacheSync(sourceOverride = "cached") {
2421
2434
  const cachePath = getCachePath();
2435
+ if (process.platform !== "win32") {
2436
+ try {
2437
+ chmodSync(cachePath, 384);
2438
+ } catch {
2439
+ return null;
2440
+ }
2441
+ }
2422
2442
  try {
2423
2443
  const parsed = JSON.parse(readFileSync(cachePath, "utf8"));
2424
2444
  if (!isTemplateData(parsed)) {
@@ -2461,7 +2481,7 @@ async function atomicWriteJson(targetPath, payload) {
2461
2481
  );
2462
2482
  await mkdir2(dirname2(targetPath), { recursive: true });
2463
2483
  await writeFile2(tmpPath, `${JSON.stringify(payload, null, 2)}
2464
- `, "utf8");
2484
+ `, { encoding: "utf8", mode: 384 });
2465
2485
  await rename(tmpPath, targetPath);
2466
2486
  }
2467
2487
  async function writeLiveCache(template2) {
@@ -2664,8 +2684,14 @@ async function captureLiveTemplateAsync(timeoutMs = DEFAULT_CAPTURE_TIMEOUT_MS,
2664
2684
  return null;
2665
2685
  }
2666
2686
  let capturedRequest = null;
2687
+ const captureNonce = createClaudeCodeCaptureNonce();
2667
2688
  const responseBody = createSseResponseBody();
2668
2689
  const server = createServer(async (req, res) => {
2690
+ if (!isClaudeCodeCaptureRequest(req, captureNonce)) {
2691
+ res.writeHead(404, { "content-type": "application/json" });
2692
+ res.end('{"error":"not_found"}');
2693
+ return;
2694
+ }
2669
2695
  try {
2670
2696
  const bodyText = await captureRequestBody(req);
2671
2697
  const parsedBody = JSON.parse(bodyText);
@@ -2698,7 +2724,7 @@ async function captureLiveTemplateAsync(timeoutMs = DEFAULT_CAPTURE_TIMEOUT_MS,
2698
2724
  reject(new Error("capture server failed to bind"));
2699
2725
  });
2700
2726
  });
2701
- const baseUrl = `http://${LOOPBACK_HOST}:${address.port}`;
2727
+ const baseUrl = `http://${LOOPBACK_HOST}:${address.port}/${captureNonce}`;
2702
2728
  await runClaudeCapture({
2703
2729
  binaryPath,
2704
2730
  baseUrl,
@@ -2900,4 +2926,4 @@ export {
2900
2926
  setFingerprintCaptureTestOverridesForTest,
2901
2927
  resetFingerprintCaptureForTest
2902
2928
  };
2903
- //# sourceMappingURL=chunk-R4DIX7J7.js.map
2929
+ //# sourceMappingURL=chunk-HTND2R24.js.map