@poncho-ai/harness 0.50.0 → 0.50.1
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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +25 -0
- package/dist/index.js +4 -3
- package/package.json +1 -1
- package/src/upload-store.ts +13 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/harness@0.50.
|
|
2
|
+
> @poncho-ai/harness@0.50.1 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
|
|
3
3
|
> node scripts/embed-docs.js && tsup src/index.ts --format esm --dts
|
|
4
4
|
|
|
5
5
|
[embed-docs] Generated poncho-docs.ts with 4 topics
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
[34mCLI[39m tsup v8.5.1
|
|
9
9
|
[34mCLI[39m Target: es2022
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
+
[32mESM[39m [1mdist/index.js [22m[32m530.75 KB[39m
|
|
11
12
|
[32mESM[39m [1mdist/isolate-BNQ6P3HI.js [22m[32m51.41 KB[39m
|
|
12
|
-
[32mESM[39m
|
|
13
|
-
[32mESM[39m ⚡️ Build success in 259ms
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 224ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
15
|
+
[32mDTS[39m ⚡️ Build success in 6878ms
|
|
16
16
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m89.28 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @poncho-ai/harness
|
|
2
2
|
|
|
3
|
+
## 0.50.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#131](https://github.com/cesr/poncho-ai/pull/131) [`9e0ccd8`](https://github.com/cesr/poncho-ai/commit/9e0ccd8307ab056f94b7efc3e25a0cb71ee75625) Thanks [@cesr](https://github.com/cesr)! - harness: strip `poncho-upload://` scheme in `S3UploadStore.get` / `.delete`
|
|
8
|
+
|
|
9
|
+
`createUploadStore({ provider: "s3" })` wraps `S3UploadStore` in
|
|
10
|
+
`CachedUploadStore`, whose `put` returns a `poncho-upload://<key>` ref
|
|
11
|
+
and stores the underlying S3 object at the bare `<key>`. On read,
|
|
12
|
+
`CachedUploadStore.get` checks an in-memory cache (10-minute TTL); on
|
|
13
|
+
miss it falls through to `S3UploadStore.get(<ref>)`. Pre-fix, the S3
|
|
14
|
+
store treated the scheme-prefixed ref as a literal S3 key and hit the
|
|
15
|
+
backend with `poncho-upload://<key>` — guaranteed `NoSuchKey`.
|
|
16
|
+
|
|
17
|
+
In practice this meant a chat message with an attached image worked on
|
|
18
|
+
the turn it was uploaded (cache hit) and then started showing as
|
|
19
|
+
"[Attached file: … — file is no longer available]" on every follow-up
|
|
20
|
+
turn ~10 minutes later (cache miss → S3 NoSuchKey → outer catch in the
|
|
21
|
+
harness resolver). The same path worked for the local-fs store, which
|
|
22
|
+
strips the scheme in both `get` and `delete`.
|
|
23
|
+
|
|
24
|
+
`S3UploadStore.get` now strips the scheme before issuing
|
|
25
|
+
`GetObjectCommand`. `S3UploadStore.delete` already stripped `https://`
|
|
26
|
+
and now strips `poncho-upload://` too.
|
|
27
|
+
|
|
3
28
|
## 0.50.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -2612,16 +2612,17 @@ var S3UploadStore = class {
|
|
|
2612
2612
|
}
|
|
2613
2613
|
return Buffer.from(await response.arrayBuffer());
|
|
2614
2614
|
}
|
|
2615
|
+
const key = urlOrKey.startsWith(PONCHO_UPLOAD_SCHEME) ? urlOrKey.slice(PONCHO_UPLOAD_SCHEME.length) : urlOrKey;
|
|
2615
2616
|
await this.ensureClient();
|
|
2616
2617
|
const result = await this.client.send(
|
|
2617
|
-
new this.s3Sdk.GetObjectCommand({ Bucket: this.bucket, Key:
|
|
2618
|
+
new this.s3Sdk.GetObjectCommand({ Bucket: this.bucket, Key: key })
|
|
2618
2619
|
);
|
|
2619
|
-
if (!result.Body) throw new Error(`uploads: empty body for S3 key ${
|
|
2620
|
+
if (!result.Body) throw new Error(`uploads: empty body for S3 key ${key}`);
|
|
2620
2621
|
return Buffer.from(await result.Body.transformToByteArray());
|
|
2621
2622
|
}
|
|
2622
2623
|
async delete(urlOrKey) {
|
|
2623
2624
|
await this.ensureClient();
|
|
2624
|
-
const key = urlOrKey.startsWith("https://") ? new URL(urlOrKey).pathname.slice(1) : urlOrKey;
|
|
2625
|
+
const key = urlOrKey.startsWith("https://") ? new URL(urlOrKey).pathname.slice(1) : urlOrKey.startsWith(PONCHO_UPLOAD_SCHEME) ? urlOrKey.slice(PONCHO_UPLOAD_SCHEME.length) : urlOrKey;
|
|
2625
2626
|
await this.client.send(
|
|
2626
2627
|
new this.s3Sdk.DeleteObjectCommand({ Bucket: this.bucket, Key: key })
|
|
2627
2628
|
);
|
package/package.json
CHANGED
package/src/upload-store.ts
CHANGED
|
@@ -349,11 +349,19 @@ export class S3UploadStore implements UploadStore {
|
|
|
349
349
|
}
|
|
350
350
|
return Buffer.from(await response.arrayBuffer());
|
|
351
351
|
}
|
|
352
|
+
// Strip the `poncho-upload://` scheme — LocalUploadStore does this for
|
|
353
|
+
// both get/delete but S3 used to treat the full URI as a literal S3
|
|
354
|
+
// key, so resolving a persisted file part (data: "poncho-upload://…")
|
|
355
|
+
// on a follow-up turn 404'd against R2 and the harness emitted a
|
|
356
|
+
// "file is no longer available" placeholder.
|
|
357
|
+
const key = urlOrKey.startsWith(PONCHO_UPLOAD_SCHEME)
|
|
358
|
+
? urlOrKey.slice(PONCHO_UPLOAD_SCHEME.length)
|
|
359
|
+
: urlOrKey;
|
|
352
360
|
await this.ensureClient();
|
|
353
361
|
const result = await this.client.send(
|
|
354
|
-
new this.s3Sdk.GetObjectCommand({ Bucket: this.bucket, Key:
|
|
362
|
+
new this.s3Sdk.GetObjectCommand({ Bucket: this.bucket, Key: key }),
|
|
355
363
|
);
|
|
356
|
-
if (!result.Body) throw new Error(`uploads: empty body for S3 key ${
|
|
364
|
+
if (!result.Body) throw new Error(`uploads: empty body for S3 key ${key}`);
|
|
357
365
|
return Buffer.from(await result.Body.transformToByteArray());
|
|
358
366
|
}
|
|
359
367
|
|
|
@@ -361,7 +369,9 @@ export class S3UploadStore implements UploadStore {
|
|
|
361
369
|
await this.ensureClient();
|
|
362
370
|
const key = urlOrKey.startsWith("https://")
|
|
363
371
|
? new URL(urlOrKey).pathname.slice(1)
|
|
364
|
-
: urlOrKey
|
|
372
|
+
: urlOrKey.startsWith(PONCHO_UPLOAD_SCHEME)
|
|
373
|
+
? urlOrKey.slice(PONCHO_UPLOAD_SCHEME.length)
|
|
374
|
+
: urlOrKey;
|
|
365
375
|
await this.client.send(
|
|
366
376
|
new this.s3Sdk.DeleteObjectCommand({ Bucket: this.bucket, Key: key }),
|
|
367
377
|
);
|