pentect 0.0.67 → 0.0.70

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <h1 align="center">Pentect</h1>
8
8
 
9
- <p align="center">AI can use your secrets without ever seeing them.</p>
9
+ <p align="center">Local secret handles for supported AI tools.</p>
10
10
 
11
11
  <p align="center">
12
12
  <a href="https://pentect.dev/">Documentation</a> ·
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentect",
3
- "version": "0.0.67",
3
+ "version": "0.0.70",
4
4
  "type": "module",
5
5
  "description": "Local secret masking boundary for AI agents",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@ export function retryableStatus(status) {
54
54
  return status === 408 || status === 429 || status >= 500;
55
55
  }
56
56
 
57
- export async function fetchWithRetry(url, options = {}) {
57
+ export async function downloadWithRetry(url, options = {}) {
58
58
  const request = options.request || globalThis.fetch;
59
59
  const wait = options.wait || ((milliseconds) => new Promise(
60
60
  (resolveDelay) => setTimeout(resolveDelay, milliseconds),
@@ -68,9 +68,24 @@ export async function fetchWithRetry(url, options = {}) {
68
68
  headers: { 'user-agent': 'pentect-npm-installer' },
69
69
  signal: timeout(),
70
70
  });
71
- if (!retryableStatus(response.status) || attempt === 3) return response;
72
- await response.body?.cancel();
73
- lastError = new Error(`Download failed (${response.status} ${response.statusText})`);
71
+ if (!response.ok) {
72
+ await response.body?.cancel();
73
+ if (!retryableStatus(response.status) || attempt === 3) {
74
+ return {
75
+ ok: false,
76
+ status: response.status,
77
+ statusText: response.statusText,
78
+ };
79
+ }
80
+ lastError = new Error(`Download failed (${response.status} ${response.statusText})`);
81
+ } else {
82
+ return {
83
+ ok: true,
84
+ status: response.status,
85
+ statusText: response.statusText,
86
+ bytes: Buffer.from(await response.arrayBuffer()),
87
+ };
88
+ }
74
89
  } catch (error) {
75
90
  lastError = error;
76
91
  if (attempt === 3) throw error;
@@ -81,14 +96,14 @@ export async function fetchWithRetry(url, options = {}) {
81
96
  }
82
97
 
83
98
  async function download(url) {
84
- const response = await fetchWithRetry(url);
99
+ const response = await downloadWithRetry(url);
85
100
  if (!response.ok) throw new Error(`Download failed (${response.status} ${response.statusText})`);
86
- return Buffer.from(await response.arrayBuffer());
101
+ return response.bytes;
87
102
  }
88
103
 
89
104
  async function downloadBinary(base, asset) {
90
- const compressed = await fetchWithRetry(`${base}/${asset}.gz`);
91
- if (compressed.ok) return gunzipSync(Buffer.from(await compressed.arrayBuffer()));
105
+ const compressed = await downloadWithRetry(`${base}/${asset}.gz`);
106
+ if (compressed.ok) return gunzipSync(compressed.bytes);
92
107
  if (compressed.status !== 404) {
93
108
  throw new Error(`Download failed (${compressed.status} ${compressed.statusText})`);
94
109
  }