@poncho-ai/harness 0.59.7 → 0.59.8

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @poncho-ai/harness@0.59.7 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
2
+ > @poncho-ai/harness@0.59.8 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
@@ -9,8 +9,8 @@
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
11
  ESM dist/isolate-F2PPSUL6.js 53.82 KB
12
- ESM dist/index.js 558.06 KB
13
- ESM ⚡️ Build success in 257ms
12
+ ESM dist/index.js 558.23 KB
13
+ ESM ⚡️ Build success in 235ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 7680ms
15
+ DTS ⚡️ Build success in 8463ms
16
16
  DTS dist/index.d.ts 101.66 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @poncho-ai/harness
2
2
 
3
+ ## 0.59.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`fb07954`](https://github.com/cesr/poncho-ai/commit/fb07954ee7edfa614bdd5ed27474f4d3be7c8f1f) Thanks [@cesr](https://github.com/cesr)! - Fix conversations.rename on Postgres: the JSONB `data` column usually
8
+ holds a JSON-encoded string scalar (update() binds JSON.stringify output),
9
+ so the 0.59.3 in-blob title update threw `cannot set path in scalar` and
10
+ every rename 500'd. The UPDATE now branches on jsonb_typeof(data) and
11
+ preserves each row's encoding (objects via jsonb_set; string scalars
12
+ unwrapped, set, and re-serialized).
13
+
3
14
  ## 0.59.7
4
15
 
5
16
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3918,7 +3918,10 @@ var SqlStorageEngine = class {
3918
3918
  },
3919
3919
  rename: async (conversationId, title) => {
3920
3920
  const normalized = normalizeTitle2(title);
3921
- const dataExpr = this.dialect.tag === "sqlite" ? `json_set(data, '$.title', $2)` : `jsonb_set(data, '{title}', to_jsonb($2::text))`;
3921
+ const dataExpr = this.dialect.tag === "sqlite" ? `json_set(data, '$.title', $2)` : `CASE WHEN jsonb_typeof(data) = 'object'
3922
+ THEN jsonb_set(data, '{title}', to_jsonb($2::text))
3923
+ ELSE to_jsonb(jsonb_set((data #>> '{}')::jsonb, '{title}', to_jsonb($2::text))::text)
3924
+ END`;
3922
3925
  await this.executor.run(
3923
3926
  rewrite(
3924
3927
  `UPDATE conversations SET title = $1, data = ${dataExpr}, updated_at = $3 WHERE id = $4`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/harness",
3
- "version": "0.59.7",
3
+ "version": "0.59.8",
4
4
  "description": "Agent execution runtime - conversation loop, tool dispatch, streaming",
5
5
  "repository": {
6
6
  "type": "git",
@@ -571,9 +571,21 @@ export abstract class SqlStorageEngine implements StorageEngine {
571
571
  // Distinct placeholders for the two title occurrences: rewrite()
572
572
  // converts $N → ? positionally for sqlite, so reusing $1 would
573
573
  // desync the param array.
574
+ //
575
+ // Postgres: the JSONB column usually holds a JSON-encoded STRING
576
+ // scalar, not an object — update() binds `JSON.stringify(conv)` and
577
+ // the driver serializes that JS string as a JSON string. A bare
578
+ // jsonb_set on those rows throws `cannot set path in scalar`
579
+ // (observed in prod 2026-06-12: every rename 500'd). Branch on the
580
+ // stored shape and preserve each row's encoding: objects get a plain
581
+ // jsonb_set; string scalars get unwrapped (#>> '{}'), parsed, set,
582
+ // and re-serialized back to a string scalar.
574
583
  const dataExpr = this.dialect.tag === "sqlite"
575
584
  ? `json_set(data, '$.title', $2)`
576
- : `jsonb_set(data, '{title}', to_jsonb($2::text))`;
585
+ : `CASE WHEN jsonb_typeof(data) = 'object'
586
+ THEN jsonb_set(data, '{title}', to_jsonb($2::text))
587
+ ELSE to_jsonb(jsonb_set((data #>> '{}')::jsonb, '{title}', to_jsonb($2::text))::text)
588
+ END`;
577
589
  await this.executor.run(
578
590
  rewrite(
579
591
  `UPDATE conversations SET title = $1, data = ${dataExpr}, updated_at = $3 WHERE id = $4`,