repowise 0.1.92 → 0.1.93

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.
@@ -2426,7 +2426,8 @@ __export(sidecar_client_exports, {
2426
2426
  uploadSidecar: () => uploadSidecar
2427
2427
  });
2428
2428
  async function uploadSidecar(req, fetchImpl = fetch) {
2429
- const url = `${req.apiUrl.replace(/\/$/, "")}/v1/repos/${encodeURIComponent(req.repoId)}/typed-resolution`;
2429
+ const base = req.apiUrl.replace(/\/$/, "");
2430
+ const repoSeg = encodeURIComponent(req.repoId);
2430
2431
  const body = JSON.stringify({ ...req.sidecar, commitSha: req.commitSha });
2431
2432
  const byteLength = Buffer.byteLength(body, "utf8");
2432
2433
  if (byteLength > UPLOAD_BODY_BYTE_LIMIT) {
@@ -2439,6 +2440,43 @@ async function uploadSidecar(req, fetchImpl = fetch) {
2439
2440
  error: msg
2440
2441
  };
2441
2442
  }
2443
+ const urlRes = await fetchImpl(`${base}/v1/repos/${repoSeg}/typed-resolution/upload-url`, {
2444
+ method: "POST",
2445
+ headers: {
2446
+ "content-type": "application/json",
2447
+ authorization: `Bearer ${req.authToken}`
2448
+ },
2449
+ body: JSON.stringify({ commitSha: req.commitSha })
2450
+ });
2451
+ if (urlRes.status === 404) {
2452
+ return uploadSidecarLegacy(req, body, fetchImpl);
2453
+ }
2454
+ if (!urlRes.ok) {
2455
+ const text = await urlRes.text().catch(() => "");
2456
+ throw new Error(`upload-url request failed: HTTP ${urlRes.status.toString()} ${text}`);
2457
+ }
2458
+ const urlPayload = await urlRes.json();
2459
+ const presignedUrl = urlPayload.data?.url;
2460
+ const uploadKey = urlPayload.data?.key ?? "";
2461
+ if (!presignedUrl)
2462
+ throw new Error("upload-url response missing `data.url`");
2463
+ const putRes = await fetchImpl(presignedUrl, {
2464
+ method: "PUT",
2465
+ headers: { "content-type": "application/json" },
2466
+ body
2467
+ });
2468
+ if (!putRes.ok) {
2469
+ const text = await putRes.text().catch(() => "");
2470
+ throw new Error(`S3 sidecar PUT failed: HTTP ${putRes.status.toString()} ${text}`);
2471
+ }
2472
+ return {
2473
+ uploaded: true,
2474
+ resolutionCount: req.sidecar.resolutions.length,
2475
+ uploadKey
2476
+ };
2477
+ }
2478
+ async function uploadSidecarLegacy(req, body, fetchImpl) {
2479
+ const url = `${req.apiUrl.replace(/\/$/, "")}/v1/repos/${encodeURIComponent(req.repoId)}/typed-resolution`;
2442
2480
  const res = await fetchImpl(url, {
2443
2481
  method: "POST",
2444
2482
  headers: {
@@ -2551,7 +2589,7 @@ var init_sidecar_client = __esm({
2551
2589
  "../listener/dist/typed-resolution/sidecar-client.js"() {
2552
2590
  "use strict";
2553
2591
  init_src();
2554
- UPLOAD_BODY_BYTE_LIMIT = 8 * 1024 * 1024;
2592
+ UPLOAD_BODY_BYTE_LIMIT = 32 * 1024 * 1024;
2555
2593
  }
2556
2594
  });
2557
2595
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repowise",
3
- "version": "0.1.92",
3
+ "version": "0.1.93",
4
4
  "type": "module",
5
5
  "description": "AI-optimized codebase context generator",
6
6
  "bin": {