@poncho-ai/harness 0.36.1 → 0.36.3

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.36.1 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
2
+ > @poncho-ai/harness@0.36.3 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
  CLI tsup v8.5.1
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
+ ESM dist/index.js 387.70 KB
11
12
  ESM dist/isolate-TCWTUVG4.js 47.34 KB
12
- ESM dist/index.js 387.05 KB
13
- ESM ⚡️ Build success in 209ms
13
+ ESM ⚡️ Build success in 202ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 6381ms
15
+ DTS ⚡️ Build success in 6580ms
16
16
  DTS dist/index.d.ts 56.62 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @poncho-ai/harness
2
2
 
3
+ ## 0.36.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`abb7ec3`](https://github.com/cesr/poncho-ai/commit/abb7ec3c65503f6feaf133f5d2488dc25152a1a8) Thanks [@cesr](https://github.com/cesr)! - fix: messaging conversations not persisting in SQL storage engines
8
+
9
+ The messaging runner creates conversations with a deterministic ID and calls
10
+ `update()` to persist them. But `update()` was a plain UPDATE that silently
11
+ matched zero rows for new conversations, so messages were never saved.
12
+ Changed `update()` to an upsert (INSERT ... ON CONFLICT DO UPDATE) so
13
+ conversations are created on first write and updated on subsequent ones.
14
+
15
+ ## 0.36.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [`04ebc73`](https://github.com/cesr/poncho-ai/commit/04ebc737914ee24b6f76b42016948c372d6a52d0) Thanks [@cesr](https://github.com/cesr)! - fix: disable prepared statements in PostgreSQL driver for compatibility with transaction-mode connection poolers (Supabase, PgBouncer)
20
+
3
21
  ## 0.36.1
4
22
 
5
23
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3342,6 +3342,7 @@ var SqlStorageEngine = class {
3342
3342
  },
3343
3343
  update: async (conversation) => {
3344
3344
  conversation.updatedAt = Date.now();
3345
+ if (!conversation.createdAt) conversation.createdAt = conversation.updatedAt;
3345
3346
  const archive = conversation._toolResultArchive;
3346
3347
  const harnessMessages = conversation._harnessMessages;
3347
3348
  const continuationMessages = conversation._continuationMessages;
@@ -3354,26 +3355,34 @@ var SqlStorageEngine = class {
3354
3355
  const harnessJson = harnessMessages ? JSON.stringify(harnessMessages) : null;
3355
3356
  const continuationJson = continuationMessages ? JSON.stringify(continuationMessages) : null;
3356
3357
  const msgCount = conversation.messages?.length ?? 0;
3358
+ const tid = normalizeTenant2(conversation.tenantId);
3359
+ const now2 = new Date(conversation.updatedAt).toISOString();
3360
+ const created = new Date(conversation.createdAt).toISOString();
3357
3361
  await this.executor.run(
3358
3362
  rewrite(
3359
- `UPDATE conversations
3360
- SET data = $1, title = $2, message_count = $3, updated_at = $4, tenant_id = $5, owner_id = $6,
3361
- tool_result_archive = $7, harness_messages = $8, continuation_messages = $9
3362
- WHERE id = $10 AND agent_id = $11`,
3363
+ `INSERT INTO conversations (id, agent_id, tenant_id, owner_id, title, data, message_count, created_at, updated_at,
3364
+ tool_result_archive, harness_messages, continuation_messages)
3365
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
3366
+ ${this.dialect.upsert(["id", "agent_id"])}
3367
+ data = excluded.data, title = excluded.title, message_count = excluded.message_count,
3368
+ updated_at = excluded.updated_at, tenant_id = excluded.tenant_id, owner_id = excluded.owner_id,
3369
+ tool_result_archive = excluded.tool_result_archive, harness_messages = excluded.harness_messages,
3370
+ continuation_messages = excluded.continuation_messages`,
3363
3371
  this.dialect
3364
3372
  ),
3365
3373
  [
3366
- data,
3374
+ conversation.conversationId,
3375
+ this.agentId,
3376
+ tid,
3377
+ conversation.ownerId,
3367
3378
  conversation.title,
3379
+ data,
3368
3380
  msgCount,
3369
- new Date(conversation.updatedAt).toISOString(),
3370
- normalizeTenant2(conversation.tenantId),
3371
- conversation.ownerId,
3381
+ created,
3382
+ now2,
3372
3383
  archiveJson,
3373
3384
  harnessJson,
3374
- continuationJson,
3375
- conversation.conversationId,
3376
- this.agentId
3385
+ continuationJson
3377
3386
  ]
3378
3387
  );
3379
3388
  },
@@ -4011,7 +4020,8 @@ var PostgresEngine = class extends SqlStorageEngine {
4011
4020
  const postgres = (await import("postgres")).default;
4012
4021
  this.sql = postgres(url, {
4013
4022
  onnotice: () => {
4014
- }
4023
+ },
4024
+ prepare: false
4015
4025
  });
4016
4026
  }
4017
4027
  async initialize() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/harness",
3
- "version": "0.36.1",
3
+ "version": "0.36.3",
4
4
  "description": "Agent execution runtime - conversation loop, tool dispatch, streaming",
5
5
  "repository": {
6
6
  "type": "git",
@@ -56,6 +56,7 @@ export class PostgresEngine extends SqlStorageEngine {
56
56
  const postgres = (await import("postgres")).default;
57
57
  this.sql = postgres(url, {
58
58
  onnotice: () => {},
59
+ prepare: false,
59
60
  });
60
61
  }
61
62
 
@@ -279,6 +279,7 @@ export abstract class SqlStorageEngine implements StorageEngine {
279
279
 
280
280
  update: async (conversation: Conversation): Promise<void> => {
281
281
  conversation.updatedAt = Date.now();
282
+ if (!conversation.createdAt) conversation.createdAt = conversation.updatedAt;
282
283
  // Strip heavy internal fields from the data blob — stored in separate columns
283
284
  const archive = conversation._toolResultArchive;
284
285
  const harnessMessages = conversation._harnessMessages;
@@ -292,26 +293,34 @@ export abstract class SqlStorageEngine implements StorageEngine {
292
293
  const harnessJson = harnessMessages ? JSON.stringify(harnessMessages) : null;
293
294
  const continuationJson = continuationMessages ? JSON.stringify(continuationMessages) : null;
294
295
  const msgCount = conversation.messages?.length ?? 0;
296
+ const tid = normalizeTenant(conversation.tenantId);
297
+ const now = new Date(conversation.updatedAt).toISOString();
298
+ const created = new Date(conversation.createdAt).toISOString();
295
299
  await this.executor.run(
296
300
  rewrite(
297
- `UPDATE conversations
298
- SET data = $1, title = $2, message_count = $3, updated_at = $4, tenant_id = $5, owner_id = $6,
299
- tool_result_archive = $7, harness_messages = $8, continuation_messages = $9
300
- WHERE id = $10 AND agent_id = $11`,
301
+ `INSERT INTO conversations (id, agent_id, tenant_id, owner_id, title, data, message_count, created_at, updated_at,
302
+ tool_result_archive, harness_messages, continuation_messages)
303
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
304
+ ${this.dialect.upsert(["id", "agent_id"])}
305
+ data = excluded.data, title = excluded.title, message_count = excluded.message_count,
306
+ updated_at = excluded.updated_at, tenant_id = excluded.tenant_id, owner_id = excluded.owner_id,
307
+ tool_result_archive = excluded.tool_result_archive, harness_messages = excluded.harness_messages,
308
+ continuation_messages = excluded.continuation_messages`,
301
309
  this.dialect,
302
310
  ),
303
311
  [
304
- data,
312
+ conversation.conversationId,
313
+ this.agentId,
314
+ tid,
315
+ conversation.ownerId,
305
316
  conversation.title,
317
+ data,
306
318
  msgCount,
307
- new Date(conversation.updatedAt).toISOString(),
308
- normalizeTenant(conversation.tenantId),
309
- conversation.ownerId,
319
+ created,
320
+ now,
310
321
  archiveJson,
311
322
  harnessJson,
312
323
  continuationJson,
313
- conversation.conversationId,
314
- this.agentId,
315
324
  ],
316
325
  );
317
326
  },