@poncho-ai/harness 0.59.0 → 0.59.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @poncho-ai/harness@0.59.0 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
2
+ > @poncho-ai/harness@0.59.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
  CLI tsup v8.5.1
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
- ESM dist/index.js 567.16 KB
12
11
  ESM dist/isolate-F2PPSUL6.js 53.82 KB
13
- ESM ⚡️ Build success in 256ms
12
+ ESM dist/index.js 567.42 KB
13
+ ESM ⚡️ Build success in 233ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 8437ms
15
+ DTS ⚡️ Build success in 7196ms
16
16
  DTS dist/index.d.ts 104.68 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @poncho-ai/harness
2
2
 
3
+ ## 0.59.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`299f574`](https://github.com/cesr/poncho-ai/commit/299f574a2f2f0d4873f42bbcffdf604e9cc4c29c) Thanks [@cesr](https://github.com/cesr)! - Mark in-flight assistant drafts with `metadata.incomplete = true`.
8
+
9
+ The orchestrator's per-step draft persist (`persistDraft`) and the
10
+ approval/device checkpoint and continuation writes now stamp the trailing
11
+ assistant message `metadata.incomplete = true`; the three terminal writes
12
+ (normal finalize, cancelled, errored) clear it. This lets a consumer that
13
+ reconciles a persisted snapshot against a live event stream (e.g. a
14
+ WebSocket layer) strip the in-flight draft from the authoritative snapshot
15
+ and rebuild that turn from the event log instead — so the snapshot and the
16
+ replayed events never both carry the in-flight turn, eliminating
17
+ reconnect-time duplication. Additive + backwards-compatible: consumers that
18
+ ignore the flag are unaffected.
19
+
20
+ - Updated dependencies [[`299f574`](https://github.com/cesr/poncho-ai/commit/299f574a2f2f0d4873f42bbcffdf604e9cc4c29c)]:
21
+ - @poncho-ai/sdk@1.15.1
22
+
3
23
  ## 0.59.0
4
24
 
5
25
  ### Minor Changes
package/dist/index.js CHANGED
@@ -14477,7 +14477,7 @@ var runConversationTurn = async (opts) => {
14477
14477
  let runContinuationMessages;
14478
14478
  let cancelHarnessMessages;
14479
14479
  let checkpointedRun = false;
14480
- const buildMessages = () => {
14480
+ const buildMessages = (incomplete = true) => {
14481
14481
  const draftSections = cloneSections(draft.sections);
14482
14482
  if (draft.currentTools.length > 0) {
14483
14483
  draftSections.push({ type: "tools", content: [...draft.currentTools] });
@@ -14496,10 +14496,15 @@ var runConversationTurn = async (opts) => {
14496
14496
  {
14497
14497
  role: "assistant",
14498
14498
  content: draft.assistantResponse,
14499
- metadata: buildAssistantMetadata(draft, draftSections, {
14500
- id: assistantId,
14501
- timestamp: turnTimestamp
14502
- })
14499
+ metadata: {
14500
+ ...buildAssistantMetadata(draft, draftSections, {
14501
+ id: assistantId,
14502
+ timestamp: turnTimestamp
14503
+ }),
14504
+ // Only stamp the flag when true; finalize omits it so completed
14505
+ // assistants stay clean (no `incomplete: false` noise on the row).
14506
+ ...incomplete ? { incomplete: true } : {}
14507
+ }
14503
14508
  }
14504
14509
  ];
14505
14510
  };
@@ -14721,7 +14726,7 @@ var runConversationTurn = async (opts) => {
14721
14726
  flushTurnDraft(draft);
14722
14727
  latestRunId = execution.latestRunId || latestRunId;
14723
14728
  if (!checkpointedRun && !runContinuationMessages) {
14724
- conversation.messages = buildMessages();
14729
+ conversation.messages = buildMessages(false);
14725
14730
  applyTurnMetadata(
14726
14731
  conversation,
14727
14732
  {
@@ -14779,7 +14784,7 @@ var runConversationTurn = async (opts) => {
14779
14784
  const aborted = opts.abortSignal?.aborted === true;
14780
14785
  if (aborted || runCancelled) {
14781
14786
  if (draft.assistantResponse.length > 0 || draft.toolTimeline.length > 0 || draft.sections.length > 0) {
14782
- conversation.messages = buildMessages();
14787
+ conversation.messages = buildMessages(false);
14783
14788
  applyTurnMetadata(
14784
14789
  conversation,
14785
14790
  {
@@ -14828,7 +14833,7 @@ var runConversationTurn = async (opts) => {
14828
14833
  }
14829
14834
  }
14830
14835
  if (draft.assistantResponse.length > 0 || draft.toolTimeline.length > 0 || draft.sections.length > 0) {
14831
- conversation.messages = buildMessages();
14836
+ conversation.messages = buildMessages(false);
14832
14837
  conversation.updatedAt = Date.now();
14833
14838
  await opts.conversationStore.update(conversation);
14834
14839
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/harness",
3
- "version": "0.59.0",
3
+ "version": "0.59.1",
4
4
  "description": "Agent execution runtime - conversation loop, tool dispatch, streaming",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "mustache": "^4.2.0",
35
35
  "yaml": "^2.4.0",
36
36
  "zod": "^3.22.0",
37
- "@poncho-ai/sdk": "1.15.0"
37
+ "@poncho-ai/sdk": "1.15.1"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "esbuild": ">=0.17.0",
@@ -157,7 +157,15 @@ export const runConversationTurn = async (
157
157
  let cancelHarnessMessages: Message[] | undefined;
158
158
  let checkpointedRun = false;
159
159
 
160
- const buildMessages = (): Message[] => {
160
+ // `incomplete: true` (the default) marks the trailing assistant message as
161
+ // an in-flight DRAFT — content for a turn that hasn't finished. A consumer
162
+ // (e.g. PonchOS's WS snapshot) uses this to strip the draft from the
163
+ // authoritative snapshot: the in-flight turn is delivered by the event
164
+ // stream instead, so the snapshot and the event log never both carry it
165
+ // (no reconnect duplication). The three TERMINAL writes (normal finalize,
166
+ // cancelled, errored) pass `incomplete: false` — at that point the turn is
167
+ // done and the assistant message is authoritative.
168
+ const buildMessages = (incomplete = true): Message[] => {
161
169
  const draftSections = cloneSections(draft.sections);
162
170
  if (draft.currentTools.length > 0) {
163
171
  draftSections.push({ type: "tools", content: [...draft.currentTools] });
@@ -179,10 +187,15 @@ export const runConversationTurn = async (
179
187
  {
180
188
  role: "assistant" as const,
181
189
  content: draft.assistantResponse,
182
- metadata: buildAssistantMetadata(draft, draftSections, {
183
- id: assistantId,
184
- timestamp: turnTimestamp,
185
- }),
190
+ metadata: {
191
+ ...buildAssistantMetadata(draft, draftSections, {
192
+ id: assistantId,
193
+ timestamp: turnTimestamp,
194
+ }),
195
+ // Only stamp the flag when true; finalize omits it so completed
196
+ // assistants stay clean (no `incomplete: false` noise on the row).
197
+ ...(incomplete ? { incomplete: true } : {}),
198
+ },
186
199
  },
187
200
  ];
188
201
  };
@@ -442,7 +455,7 @@ export const runConversationTurn = async (
442
455
  latestRunId = execution.latestRunId || latestRunId;
443
456
 
444
457
  if (!checkpointedRun && !runContinuationMessages) {
445
- conversation.messages = buildMessages();
458
+ conversation.messages = buildMessages(false); // terminal: turn complete
446
459
  applyTurnMetadata(
447
460
  conversation,
448
461
  {
@@ -515,7 +528,7 @@ export const runConversationTurn = async (
515
528
  draft.toolTimeline.length > 0 ||
516
529
  draft.sections.length > 0
517
530
  ) {
518
- conversation.messages = buildMessages();
531
+ conversation.messages = buildMessages(false); // terminal: cancelled
519
532
  applyTurnMetadata(
520
533
  conversation,
521
534
  {
@@ -571,7 +584,7 @@ export const runConversationTurn = async (
571
584
  draft.toolTimeline.length > 0 ||
572
585
  draft.sections.length > 0
573
586
  ) {
574
- conversation.messages = buildMessages();
587
+ conversation.messages = buildMessages(false); // terminal: errored
575
588
  conversation.updatedAt = Date.now();
576
589
  await opts.conversationStore.update(conversation);
577
590
  }