@purista/harness 1.2.4 → 1.2.6
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/dist/agents/index.js
CHANGED
|
@@ -230,7 +230,9 @@ async function runDefaultAgentInner(args) {
|
|
|
230
230
|
timestamp: new Date().toISOString()
|
|
231
231
|
};
|
|
232
232
|
emitted.push(assistantMsg);
|
|
233
|
-
|
|
233
|
+
// Provider round-trip items (e.g. OpenAI Responses reasoning items) stay
|
|
234
|
+
// local to the loop; they are replayed on the next round, not persisted.
|
|
235
|
+
modelMessages.push({ role: 'assistant', content: assistantMsg.content, toolCalls, ...(response.providerItems ? { providerItems: response.providerItems } : {}) });
|
|
234
236
|
args.metrics.histogram('harness.agent.tool_batch.size', toolCalls.length, {
|
|
235
237
|
'harness.agent.tool_batch.max_parallel': args.maxParallelToolCalls
|
|
236
238
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EmbeddingRequest, EmbeddingResponse, ContentPart, ModelAlias, ModelCapability, ModelToolSpec, ObjectRequest, ObjectResponse, ObjectStreamChunk, RerankRequest, RerankResponse, TextRequest, TextResponse, TextStreamChunk, ToolCallSpec } from '../ports/model-provider.js';
|
|
1
|
+
import type { EmbeddingRequest, EmbeddingResponse, ContentPart, ModelAlias, ModelCapability, ModelToolSpec, ObjectRequest, ObjectResponse, ObjectStreamChunk, ProviderItems, RerankRequest, RerankResponse, TextRequest, TextResponse, TextStreamChunk, ToolCallSpec } from '../ports/model-provider.js';
|
|
2
2
|
import type { TelemetryShim } from '../telemetry/index.js';
|
|
3
3
|
import type { JsonValue } from './json.js';
|
|
4
4
|
export interface ModelInvokeContext {
|
|
@@ -53,6 +53,7 @@ type ModelMessageFor<A> = {
|
|
|
53
53
|
} | ({
|
|
54
54
|
role: 'assistant';
|
|
55
55
|
content: string | ContentPartFor<A>[];
|
|
56
|
+
providerItems?: ProviderItems;
|
|
56
57
|
} & ToolCallsFor<A>) | (HasCapability<A, 'tool_use'> extends true ? {
|
|
57
58
|
role: 'tool';
|
|
58
59
|
toolCallId: string;
|
|
@@ -49,6 +49,17 @@ export interface ToolCallSpec {
|
|
|
49
49
|
name: string;
|
|
50
50
|
arguments: JsonValue;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Opaque provider wire items returned with a tool-call response and replayed
|
|
54
|
+
* verbatim on the follow-up request of the same turn (e.g. OpenAI Responses
|
|
55
|
+
* API reasoning items). Adapters only replay items tagged with their own
|
|
56
|
+
* provider id; foreign or empty items are ignored and the assistant turn is
|
|
57
|
+
* reconstructed provider-neutrally from `content`/`toolCalls`.
|
|
58
|
+
*/
|
|
59
|
+
export interface ProviderItems {
|
|
60
|
+
providerId: string;
|
|
61
|
+
items: JsonValue[];
|
|
62
|
+
}
|
|
52
63
|
/** Multimodal message content part. */
|
|
53
64
|
export type ContentPart =
|
|
54
65
|
/** Plain text input content. */
|
|
@@ -119,6 +130,7 @@ export type ModelMessage = {
|
|
|
119
130
|
role: 'assistant';
|
|
120
131
|
content: string | ContentPart[];
|
|
121
132
|
toolCalls?: ToolCallSpec[];
|
|
133
|
+
providerItems?: ProviderItems;
|
|
122
134
|
} | {
|
|
123
135
|
role: 'tool';
|
|
124
136
|
toolCallId: string;
|
|
@@ -165,6 +177,7 @@ export interface TextRequest extends BaseRequest {
|
|
|
165
177
|
export interface TextResponse {
|
|
166
178
|
content: string;
|
|
167
179
|
toolCalls?: ToolCallSpec[];
|
|
180
|
+
providerItems?: ProviderItems;
|
|
168
181
|
usage: TokenUsage;
|
|
169
182
|
finishReason: FinishReason;
|
|
170
183
|
raw?: unknown;
|
|
@@ -180,6 +193,7 @@ export type TextStreamChunk = {
|
|
|
180
193
|
kind: 'finish';
|
|
181
194
|
usage: TokenUsage;
|
|
182
195
|
finishReason: FinishReason;
|
|
196
|
+
providerItems?: ProviderItems;
|
|
183
197
|
};
|
|
184
198
|
/** Request for object/object-stream model methods. */
|
|
185
199
|
export interface ObjectRequest<T extends JsonValue = JsonValue> extends BaseRequest {
|
|
@@ -191,6 +205,7 @@ export interface ObjectRequest<T extends JsonValue = JsonValue> extends BaseRequ
|
|
|
191
205
|
export interface ObjectResponse<T extends JsonValue = JsonValue> {
|
|
192
206
|
object: T;
|
|
193
207
|
toolCalls?: ToolCallSpec[];
|
|
208
|
+
providerItems?: ProviderItems;
|
|
194
209
|
usage: TokenUsage;
|
|
195
210
|
finishReason: FinishReason;
|
|
196
211
|
raw?: unknown;
|
|
@@ -211,6 +226,7 @@ export type ObjectStreamChunk<T extends JsonValue = JsonValue> = {
|
|
|
211
226
|
object: T;
|
|
212
227
|
usage: TokenUsage;
|
|
213
228
|
finishReason: FinishReason;
|
|
229
|
+
providerItems?: ProviderItems;
|
|
214
230
|
};
|
|
215
231
|
/** Request for embedding generation. */
|
|
216
232
|
export interface EmbeddingRequest {
|
package/package.json
CHANGED