@peakflo/agent-harness 0.2.29 → 0.2.30-rc.2
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.
|
@@ -180,6 +180,14 @@ export declare class ClaudeCodeAdapter implements CodingAgentAdapter {
|
|
|
180
180
|
/**
|
|
181
181
|
* Converts SDKMessage to MessagePart[] format
|
|
182
182
|
*/
|
|
183
|
+
/**
|
|
184
|
+
* What a QUESTION part showed when it was created, per turn. The result
|
|
185
|
+
* update replaces the whole stored tool payload, so it must carry the
|
|
186
|
+
* questions, input and title forward, or the card loses its questions the
|
|
187
|
+
* moment the tool result arrives. Keyed like `apiRetryBursts`.
|
|
188
|
+
*/
|
|
189
|
+
private readonly questionPartsByTurn;
|
|
190
|
+
private questionPartsFor;
|
|
183
191
|
private convertSDKMessageToParts;
|
|
184
192
|
/**
|
|
185
193
|
* Builds a human-readable title for a tool call from its input.
|
|
@@ -1480,6 +1480,21 @@ class ClaudeCodeAdapter {
|
|
|
1480
1480
|
/**
|
|
1481
1481
|
* Converts SDKMessage to MessagePart[] format
|
|
1482
1482
|
*/
|
|
1483
|
+
/**
|
|
1484
|
+
* What a QUESTION part showed when it was created, per turn. The result
|
|
1485
|
+
* update replaces the whole stored tool payload, so it must carry the
|
|
1486
|
+
* questions, input and title forward, or the card loses its questions the
|
|
1487
|
+
* moment the tool result arrives. Keyed like `apiRetryBursts`.
|
|
1488
|
+
*/
|
|
1489
|
+
questionPartsByTurn = new WeakMap();
|
|
1490
|
+
questionPartsFor(turn) {
|
|
1491
|
+
let parts = this.questionPartsByTurn.get(turn);
|
|
1492
|
+
if (!parts) {
|
|
1493
|
+
parts = new Map();
|
|
1494
|
+
this.questionPartsByTurn.set(turn, parts);
|
|
1495
|
+
}
|
|
1496
|
+
return parts;
|
|
1497
|
+
}
|
|
1483
1498
|
convertSDKMessageToParts(msg, seenPartIds, partContentLengths, config) {
|
|
1484
1499
|
const parts = [];
|
|
1485
1500
|
const msgWithProps = msg;
|
|
@@ -1604,6 +1619,7 @@ class ClaudeCodeAdapter {
|
|
|
1604
1619
|
}
|
|
1605
1620
|
if (Array.isArray(questions) && questions.length > 0) {
|
|
1606
1621
|
partContentLengths.set(toolPartId, `pending:${toolName}`);
|
|
1622
|
+
this.questionPartsFor(partContentLengths).set(toolPartId, { input, title, questions });
|
|
1607
1623
|
parts.push({
|
|
1608
1624
|
id: toolPartId,
|
|
1609
1625
|
type: 'question',
|
|
@@ -1701,13 +1717,19 @@ class ClaudeCodeAdapter {
|
|
|
1701
1717
|
// Update the existing tool part - mark as completed
|
|
1702
1718
|
partContentLengths.set(toolPartId, `success:${resultContent.length}`);
|
|
1703
1719
|
// For plan review: don't send empty output (would overwrite plan from input.plan)
|
|
1720
|
+
// A question keeps its questions, input and title, and stays a question
|
|
1721
|
+
// part: the stored payload is replaced by this update.
|
|
1722
|
+
const question = this.questionPartsFor(partContentLengths).get(toolPartId);
|
|
1704
1723
|
parts.push({
|
|
1705
1724
|
id: toolPartId,
|
|
1706
|
-
type:
|
|
1725
|
+
type: question
|
|
1726
|
+
? 'question'
|
|
1727
|
+
: isPlanReview ? 'planreview' : coding_agent_adapter_1.MessagePartType.TOOL,
|
|
1707
1728
|
content: isPlanReview ? (toolName === 'EnterPlanMode' ? 'Enter plan mode' : 'Exit plan mode') : `Tool completed`,
|
|
1708
1729
|
tool: {
|
|
1709
1730
|
name: toolName,
|
|
1710
1731
|
status: 'success',
|
|
1732
|
+
...(question ? { title: question.title, input: question.input, questions: question.questions } : {}),
|
|
1711
1733
|
...(outputContent ? { output: outputContent } : {}),
|
|
1712
1734
|
},
|
|
1713
1735
|
update: true, // Mark as update to existing message
|
|
@@ -1287,7 +1287,13 @@ class SessionRunner {
|
|
|
1287
1287
|
// There was no per-turn host-note mechanism in the harness. Keep the
|
|
1288
1288
|
// addition small: a workspace may supply one note, which is sent to the
|
|
1289
1289
|
// model but is not written into the durable user conversation.
|
|
1290
|
-
const turnNote =
|
|
1290
|
+
const turnNote = [
|
|
1291
|
+
this.deps.workspace.takeTurnNote?.(session.sessionId),
|
|
1292
|
+
// Server note for this turn (lease input). Not stored, not shown.
|
|
1293
|
+
session.input.hostNote
|
|
1294
|
+
]
|
|
1295
|
+
.filter(Boolean)
|
|
1296
|
+
.join('\n\n');
|
|
1291
1297
|
const promptWithHostNote = turnNote
|
|
1292
1298
|
? `${turnNote}\n\n${promptText}`
|
|
1293
1299
|
: promptText;
|
package/dist/types.d.ts
CHANGED
|
@@ -681,6 +681,11 @@ export interface LeasedTurnInput {
|
|
|
681
681
|
name: string;
|
|
682
682
|
reason: string;
|
|
683
683
|
}>;
|
|
684
|
+
/**
|
|
685
|
+
* A server-written note for THIS turn only. It is put before the person's
|
|
686
|
+
* text in the model prompt. It is not stored and not shown in the chat.
|
|
687
|
+
*/
|
|
688
|
+
hostNote?: string;
|
|
684
689
|
}
|
|
685
690
|
export interface LeasedAttachment {
|
|
686
691
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peakflo/agent-harness",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30-rc.2",
|
|
4
4
|
"description": "Headless Peakflo coding-agent harness. One codebase, three hosting modes: a Daytona cloud sandbox, a customer VM, and the 20x desktop.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|