@assemblyline-agents/pi 0.1.0
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/LICENSE +21 -0
- package/README.md +19 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +503 -0
- package/dist/index.js.map +1 -0
- package/dist/model-stream-retry.d.ts +61 -0
- package/dist/model-stream-retry.d.ts.map +1 -0
- package/dist/model-stream-retry.js +215 -0
- package/dist/model-stream-retry.js.map +1 -0
- package/dist/pi-harness.d.ts +103 -0
- package/dist/pi-harness.d.ts.map +1 -0
- package/dist/pi-harness.js +535 -0
- package/dist/pi-harness.js.map +1 -0
- package/dist/transcript-trim.d.ts +44 -0
- package/dist/transcript-trim.d.ts.map +1 -0
- package/dist/transcript-trim.js +162 -0
- package/dist/transcript-trim.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type Api, type AssistantMessageEventStream, type Model, type SimpleStreamOptions } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { ModelErrorClassification } from "@assemblyline-agents/core";
|
|
3
|
+
/**
|
|
4
|
+
* Retry + timeout envelope around `models.streamSimple`.
|
|
5
|
+
*
|
|
6
|
+
* pi-ai converts provider failures into a terminal `error` stream event
|
|
7
|
+
* (never a rejection), and pi-agent-core stops the whole turn on it — so
|
|
8
|
+
* without this wrapper one transient 429/5xx ends the run. The wrapper
|
|
9
|
+
* re-invokes the stream for retryable pre-content errors, enforces a stream
|
|
10
|
+
* inactivity watchdog, and reports the final error classification so the
|
|
11
|
+
* runtime can distinguish fatal misconfiguration from transient weather.
|
|
12
|
+
*
|
|
13
|
+
* Protocol invariants (pi-agent-core `for await`s the stream then awaits
|
|
14
|
+
* `result()`):
|
|
15
|
+
* - each attempt's `start` event is buffered and only flushed once the
|
|
16
|
+
* attempt commits (first content event or a terminal event) — forwarding a
|
|
17
|
+
* `start` for an attempt that is later retried would leave a dangling
|
|
18
|
+
* partial in the agent transcript;
|
|
19
|
+
* - exactly one terminal event (`done`/`error`) is always pushed, or
|
|
20
|
+
* `result()` would hang the agent loop;
|
|
21
|
+
* - a watchdog abort is rewritten to `stopReason: "error"` — a raw
|
|
22
|
+
* `"aborted"` reads as an intentional stop and would record a successful
|
|
23
|
+
* empty run. Upstream aborts (cancel/deadline) are forwarded untouched.
|
|
24
|
+
*/
|
|
25
|
+
export interface ModelRetryConfig {
|
|
26
|
+
/** Stream-level retry attempts after the initial one (also passed to SDK clients). */
|
|
27
|
+
maxRetries: number;
|
|
28
|
+
/** HTTP request timeout per model call, forwarded to the provider SDK. */
|
|
29
|
+
timeoutMs: number;
|
|
30
|
+
/** Cap on server-requested retry waits (Retry-After) and backoff delays. */
|
|
31
|
+
maxRetryDelayMs: number;
|
|
32
|
+
/** Abort an attempt when no stream event arrives for this long. 0 disables. */
|
|
33
|
+
idleTimeoutMs: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function resolveModelRetryConfig(env?: Record<string, string | undefined>): ModelRetryConfig;
|
|
36
|
+
/** Classify a model-call failure: HTTP status wins, message heuristics fall back. */
|
|
37
|
+
export declare function classifyModelError(status: number | undefined, message: string): ModelErrorClassification;
|
|
38
|
+
export interface ModelRetryEventInfo {
|
|
39
|
+
attempt: number;
|
|
40
|
+
delayMs: number;
|
|
41
|
+
error: string;
|
|
42
|
+
status?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface ModelStreamOutcome {
|
|
45
|
+
classification: ModelErrorClassification;
|
|
46
|
+
attempts: number;
|
|
47
|
+
status?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface StreamWithRetryInput {
|
|
50
|
+
streamOnce: (options: SimpleStreamOptions) => AssistantMessageEventStream;
|
|
51
|
+
model: Model<Api>;
|
|
52
|
+
baseOptions: SimpleStreamOptions;
|
|
53
|
+
config: ModelRetryConfig;
|
|
54
|
+
onRetry?: (info: ModelRetryEventInfo) => void | Promise<void>;
|
|
55
|
+
onOutcome?: (outcome: ModelStreamOutcome) => void;
|
|
56
|
+
/** Test seams. */
|
|
57
|
+
sleep?: (ms: number) => Promise<void>;
|
|
58
|
+
random?: () => number;
|
|
59
|
+
}
|
|
60
|
+
export declare function streamSimpleWithRetry(input: StreamWithRetryInput): AssistantMessageEventStream;
|
|
61
|
+
//# sourceMappingURL=model-stream-retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-stream-retry.d.ts","sourceRoot":"","sources":["../src/model-stream-retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,GAAG,EAGR,KAAK,2BAA2B,EAChC,KAAK,KAAK,EACV,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,sFAAsF;IACtF,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,eAAe,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,aAAa,EAAE,MAAM,CAAC;CACvB;AAQD,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAM,GAAG,gBAAgB,CAOtG;AAUD,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,wBAAwB,CAQxG;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,wBAAwB,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,2BAA2B,CAAC;IAC1E,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,WAAW,EAAE,mBAAmB,CAAC;IACjC,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAClD,kBAAkB;IAClB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;CACvB;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,2BAA2B,CAQ9F"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { createAssistantMessageEventStream } from "@earendil-works/pi-ai";
|
|
2
|
+
const DEFAULT_MODEL_MAX_RETRIES = 2;
|
|
3
|
+
const DEFAULT_MODEL_TIMEOUT_MS = 600_000;
|
|
4
|
+
const DEFAULT_MODEL_MAX_RETRY_DELAY_MS = 60_000;
|
|
5
|
+
const DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS = 300_000;
|
|
6
|
+
const RETRY_BASE_DELAY_MS = 500;
|
|
7
|
+
export function resolveModelRetryConfig(env = {}) {
|
|
8
|
+
return {
|
|
9
|
+
maxRetries: nonNegativeIntEnv(env.OPENEVE_MODEL_MAX_RETRIES, DEFAULT_MODEL_MAX_RETRIES),
|
|
10
|
+
timeoutMs: nonNegativeIntEnv(env.OPENEVE_MODEL_TIMEOUT_MS, DEFAULT_MODEL_TIMEOUT_MS),
|
|
11
|
+
maxRetryDelayMs: nonNegativeIntEnv(env.OPENEVE_MODEL_MAX_RETRY_DELAY_MS, DEFAULT_MODEL_MAX_RETRY_DELAY_MS),
|
|
12
|
+
idleTimeoutMs: nonNegativeIntEnv(env.OPENEVE_MODEL_STREAM_IDLE_TIMEOUT_MS, DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function nonNegativeIntEnv(value, fallback) {
|
|
16
|
+
const parsed = value === undefined ? NaN : Number(value);
|
|
17
|
+
return Number.isInteger(parsed) && parsed >= 0 ? parsed : fallback;
|
|
18
|
+
}
|
|
19
|
+
const RETRYABLE_MESSAGE = /\b(?:408|409|425|429|5\d\d)\b|overloaded|rate.?limit|too many requests|timed?.?out|timeout|econnreset|econnrefused|etimedout|enotfound|eai_again|socket hang up|fetch failed|network|connection (?:closed|error|reset)|service unavailable|server error|internal error/i;
|
|
20
|
+
const FATAL_MESSAGE = /invalid.?api.?key|incorrect api key|unauthorized|authentication|permission|forbidden|invalid request|invalid_request_error|model not found|does not exist|context length|maximum context|billing|quota exceeded.*billing/i;
|
|
21
|
+
/** Classify a model-call failure: HTTP status wins, message heuristics fall back. */
|
|
22
|
+
export function classifyModelError(status, message) {
|
|
23
|
+
if (status !== undefined) {
|
|
24
|
+
if (status === 408 || status === 409 || status === 425 || status === 429 || status >= 500)
|
|
25
|
+
return "retryable";
|
|
26
|
+
if (status >= 400)
|
|
27
|
+
return "fatal";
|
|
28
|
+
}
|
|
29
|
+
if (FATAL_MESSAGE.test(message))
|
|
30
|
+
return "fatal";
|
|
31
|
+
if (RETRYABLE_MESSAGE.test(message))
|
|
32
|
+
return "retryable";
|
|
33
|
+
return "unknown";
|
|
34
|
+
}
|
|
35
|
+
export function streamSimpleWithRetry(input) {
|
|
36
|
+
const wrapper = createAssistantMessageEventStream();
|
|
37
|
+
void pumpWithRetry(input, wrapper).catch((error) => {
|
|
38
|
+
// Last-resort guard: the pump itself must never reject silently, or the
|
|
39
|
+
// agent loop hangs awaiting `result()`.
|
|
40
|
+
wrapper.push(syntheticErrorEvent(input.model, error instanceof Error ? error.message : String(error)));
|
|
41
|
+
});
|
|
42
|
+
return wrapper;
|
|
43
|
+
}
|
|
44
|
+
async function pumpWithRetry(input, wrapper) {
|
|
45
|
+
const { config } = input;
|
|
46
|
+
// Deliberately ref'd timers throughout: during a backoff sleep or a silent
|
|
47
|
+
// stream these are the only pending work — an unref'd timer would let the
|
|
48
|
+
// event loop drain and strand the awaiting agent loop.
|
|
49
|
+
const sleep = input.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
50
|
+
const upstream = input.baseOptions.signal;
|
|
51
|
+
let committed = false;
|
|
52
|
+
for (let attempt = 1;; attempt += 1) {
|
|
53
|
+
let status;
|
|
54
|
+
let retryAfterMs;
|
|
55
|
+
const watchdog = new AbortController();
|
|
56
|
+
let idleTimer;
|
|
57
|
+
const armIdle = () => {
|
|
58
|
+
if (config.idleTimeoutMs <= 0)
|
|
59
|
+
return;
|
|
60
|
+
if (idleTimer)
|
|
61
|
+
clearTimeout(idleTimer);
|
|
62
|
+
idleTimer = setTimeout(() => watchdog.abort(), config.idleTimeoutMs);
|
|
63
|
+
};
|
|
64
|
+
const options = {
|
|
65
|
+
...input.baseOptions,
|
|
66
|
+
signal: upstream ? AbortSignal.any([upstream, watchdog.signal]) : watchdog.signal,
|
|
67
|
+
timeoutMs: input.baseOptions.timeoutMs ?? config.timeoutMs,
|
|
68
|
+
maxRetries: input.baseOptions.maxRetries ?? config.maxRetries,
|
|
69
|
+
maxRetryDelayMs: input.baseOptions.maxRetryDelayMs ?? config.maxRetryDelayMs,
|
|
70
|
+
onResponse: async (response, model) => {
|
|
71
|
+
status = response.status;
|
|
72
|
+
retryAfterMs = parseRetryAfterMs(response.headers, config.maxRetryDelayMs);
|
|
73
|
+
await input.baseOptions.onResponse?.(response, model);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
// Terminal disposition of this attempt: either an event to emit, or a retry.
|
|
77
|
+
let failure;
|
|
78
|
+
let pendingStart;
|
|
79
|
+
let finished = false;
|
|
80
|
+
try {
|
|
81
|
+
const attemptStream = input.streamOnce(options);
|
|
82
|
+
armIdle();
|
|
83
|
+
for await (const event of attemptStream) {
|
|
84
|
+
armIdle();
|
|
85
|
+
if (event.type === "start") {
|
|
86
|
+
pendingStart = event;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (event.type === "error") {
|
|
90
|
+
const upstreamAborted = upstream?.aborted === true;
|
|
91
|
+
if (event.reason === "aborted" && upstreamAborted) {
|
|
92
|
+
// Genuine cancel/deadline: forward untouched, the loop treats it
|
|
93
|
+
// as an intentional stop.
|
|
94
|
+
wrapper.push(event);
|
|
95
|
+
input.onOutcome?.({ classification: "unknown", attempts: attempt, ...(status !== undefined ? { status } : {}) });
|
|
96
|
+
finished = true;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
const watchdogFired = watchdog.signal.aborted && !upstreamAborted;
|
|
100
|
+
const rawMessage = event.error.errorMessage ?? "pi model stream error";
|
|
101
|
+
const message = watchdogFired
|
|
102
|
+
? `Model stream idle timeout after ${config.idleTimeoutMs}ms.`
|
|
103
|
+
: rawMessage;
|
|
104
|
+
failure = {
|
|
105
|
+
message,
|
|
106
|
+
classification: watchdogFired ? "retryable" : classifyModelError(status, rawMessage),
|
|
107
|
+
event: watchdogFired
|
|
108
|
+
? syntheticErrorEvent(input.model, message, event.error)
|
|
109
|
+
: normalizedErrorEvent(event)
|
|
110
|
+
};
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
if (!committed) {
|
|
114
|
+
committed = true;
|
|
115
|
+
if (pendingStart) {
|
|
116
|
+
wrapper.push(pendingStart);
|
|
117
|
+
pendingStart = undefined;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
wrapper.push(event);
|
|
121
|
+
if (event.type === "done") {
|
|
122
|
+
input.onOutcome?.({ classification: "unknown", attempts: attempt, ...(status !== undefined ? { status } : {}) });
|
|
123
|
+
finished = true;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (!failure && !finished) {
|
|
128
|
+
// Stream ended without a terminal event: treat as a transport failure.
|
|
129
|
+
failure = { message: "Model stream ended without a terminal event.", classification: "retryable" };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
134
|
+
failure = { message, classification: classifyModelError(status, message) };
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
if (idleTimer)
|
|
138
|
+
clearTimeout(idleTimer);
|
|
139
|
+
}
|
|
140
|
+
if (finished)
|
|
141
|
+
return;
|
|
142
|
+
if (failure && !committed && failure.classification === "retryable" && attempt <= config.maxRetries && !upstream?.aborted) {
|
|
143
|
+
const delayMs = retryDelayMs(attempt, retryAfterMs, config.maxRetryDelayMs, input.random ?? Math.random);
|
|
144
|
+
await input.onRetry?.({
|
|
145
|
+
attempt,
|
|
146
|
+
delayMs,
|
|
147
|
+
error: failure.message,
|
|
148
|
+
...(status !== undefined ? { status } : {})
|
|
149
|
+
});
|
|
150
|
+
await sleep(delayMs);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (failure) {
|
|
154
|
+
wrapper.push(failure.event ?? syntheticErrorEvent(input.model, failure.message));
|
|
155
|
+
input.onOutcome?.({
|
|
156
|
+
classification: failure.classification,
|
|
157
|
+
attempts: attempt,
|
|
158
|
+
...(status !== undefined ? { status } : {})
|
|
159
|
+
});
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function retryDelayMs(attempt, retryAfterMs, maxDelayMs, random) {
|
|
165
|
+
const cap = maxDelayMs > 0 ? maxDelayMs : DEFAULT_MODEL_MAX_RETRY_DELAY_MS;
|
|
166
|
+
const exp = Math.min(RETRY_BASE_DELAY_MS * 2 ** (attempt - 1), cap);
|
|
167
|
+
const jittered = Math.floor(exp / 2 + random() * (exp / 2));
|
|
168
|
+
if (retryAfterMs !== undefined)
|
|
169
|
+
return Math.min(Math.max(retryAfterMs, jittered), cap);
|
|
170
|
+
return jittered;
|
|
171
|
+
}
|
|
172
|
+
function parseRetryAfterMs(headers, capMs) {
|
|
173
|
+
const raw = headers["retry-after"] ?? headers["Retry-After"];
|
|
174
|
+
if (!raw)
|
|
175
|
+
return undefined;
|
|
176
|
+
const seconds = Number(raw);
|
|
177
|
+
if (Number.isFinite(seconds) && seconds >= 0)
|
|
178
|
+
return Math.min(seconds * 1000, capMs);
|
|
179
|
+
const dateMs = Date.parse(raw);
|
|
180
|
+
if (Number.isFinite(dateMs))
|
|
181
|
+
return Math.min(Math.max(dateMs - Date.now(), 0), capMs);
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
/** Rewrite an `"aborted"`-reason terminal that was NOT externally requested into a hard error. */
|
|
185
|
+
function normalizedErrorEvent(event) {
|
|
186
|
+
if (event.error.stopReason !== "aborted")
|
|
187
|
+
return event;
|
|
188
|
+
return {
|
|
189
|
+
type: "error",
|
|
190
|
+
reason: "error",
|
|
191
|
+
error: { ...event.error, stopReason: "error" }
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function syntheticErrorEvent(model, message, base) {
|
|
195
|
+
const error = {
|
|
196
|
+
role: "assistant",
|
|
197
|
+
content: base?.content ?? [],
|
|
198
|
+
api: model.api,
|
|
199
|
+
provider: model.provider,
|
|
200
|
+
model: model.id,
|
|
201
|
+
usage: base?.usage ?? {
|
|
202
|
+
input: 0,
|
|
203
|
+
output: 0,
|
|
204
|
+
cacheRead: 0,
|
|
205
|
+
cacheWrite: 0,
|
|
206
|
+
totalTokens: 0,
|
|
207
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
208
|
+
},
|
|
209
|
+
stopReason: "error",
|
|
210
|
+
errorMessage: message,
|
|
211
|
+
timestamp: Date.now()
|
|
212
|
+
};
|
|
213
|
+
return { type: "error", reason: "error", error };
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=model-stream-retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-stream-retry.js","sourceRoot":"","sources":["../src/model-stream-retry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAOlC,MAAM,uBAAuB,CAAC;AAqC/B,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,MAAM,wBAAwB,GAAG,OAAO,CAAC;AACzC,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAChD,MAAM,oCAAoC,GAAG,OAAO,CAAC;AACrD,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,UAAU,uBAAuB,CAAC,MAA0C,EAAE;IAClF,OAAO;QACL,UAAU,EAAE,iBAAiB,CAAC,GAAG,CAAC,yBAAyB,EAAE,yBAAyB,CAAC;QACvF,SAAS,EAAE,iBAAiB,CAAC,GAAG,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;QACpF,eAAe,EAAE,iBAAiB,CAAC,GAAG,CAAC,gCAAgC,EAAE,gCAAgC,CAAC;QAC1G,aAAa,EAAE,iBAAiB,CAAC,GAAG,CAAC,oCAAoC,EAAE,oCAAoC,CAAC;KACjH,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAyB,EAAE,QAAgB;IACpE,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;AACrE,CAAC;AAED,MAAM,iBAAiB,GAAG,yQAAyQ,CAAC;AACpS,MAAM,aAAa,GAAG,2NAA2N,CAAC;AAElP,qFAAqF;AACrF,M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1,103 @@
|
|
|
1
|
+
import { type AfterToolCallContext, type AfterToolCallResult, type AgentEvent, type AgentMessage, type AgentTool, type ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { type Api, type AssistantMessage, type Context, type Model, type Models, type SimpleStreamOptions, type Usage } from "@earendil-works/pi-ai";
|
|
3
|
+
import type { HarnessInputMedia, HarnessUsage, HarnessVideoInput, JsonObject, ModelErrorClassification } from "@assemblyline-agents/core";
|
|
4
|
+
import { type ModelRetryEventInfo } from "./model-stream-retry.js";
|
|
5
|
+
export interface RunPiAgentLoopOptions {
|
|
6
|
+
models: Models;
|
|
7
|
+
modelSpec: string;
|
|
8
|
+
reasoning?: ThinkingLevel | undefined;
|
|
9
|
+
systemPrompt: string;
|
|
10
|
+
message?: string;
|
|
11
|
+
media?: HarnessInputMedia[];
|
|
12
|
+
recentHistory: string[];
|
|
13
|
+
messages?: AgentMessage[];
|
|
14
|
+
mode?: "prompt" | "continue";
|
|
15
|
+
tools: () => Promise<AgentTool<any>[]>;
|
|
16
|
+
env?: Record<string, string | undefined>;
|
|
17
|
+
/** Test/embedder seam for OpenRouter model-capability discovery. */
|
|
18
|
+
fetch?: typeof fetch;
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
/** Per-finalized-tool-call override hook (pi-agent-core `afterToolCall`). */
|
|
21
|
+
afterToolCall?: (context: AfterToolCallContext) => Promise<AfterToolCallResult | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Loop backstop: checked before every model request. When it returns true
|
|
24
|
+
* the loop receives a synthetic empty stop response instead of a real
|
|
25
|
+
* model call, ending the turn without further side effects — used when a
|
|
26
|
+
* pause happened mid-batch and the batch terminate flags could not stop
|
|
27
|
+
* the loop (a parallel batch whose pauser finalized after its siblings).
|
|
28
|
+
*/
|
|
29
|
+
shouldStop?: () => boolean;
|
|
30
|
+
/** Hard cap on real model requests for this invocation. */
|
|
31
|
+
maxIterations?: number;
|
|
32
|
+
/** Hard-abort signal: aborts the in-flight model request via `agent.abort()`. */
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
/** Invoked when a model request attempt fails retryably and is being retried. */
|
|
35
|
+
onModelRetry?: (info: ModelRetryEventInfo, state: {
|
|
36
|
+
requestIteration: number;
|
|
37
|
+
}) => Promise<void> | void;
|
|
38
|
+
onEvent?: (event: AgentEvent, state: {
|
|
39
|
+
requestIteration: number;
|
|
40
|
+
}) => Promise<void> | void;
|
|
41
|
+
onRequestStarted?: (input: {
|
|
42
|
+
model: Model<Api>;
|
|
43
|
+
context: Context;
|
|
44
|
+
options?: SimpleStreamOptions;
|
|
45
|
+
}, state: {
|
|
46
|
+
requestIteration: number;
|
|
47
|
+
}) => Promise<void> | void;
|
|
48
|
+
}
|
|
49
|
+
export interface RunPiAgentLoopResult {
|
|
50
|
+
response: string;
|
|
51
|
+
messages: AgentMessage[];
|
|
52
|
+
finalAssistant?: AssistantMessage;
|
|
53
|
+
stoppedReason?: "max_iterations" | "control_signal";
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A pi model run that ended in `stopReason: "error"`. pi-agent-core catches
|
|
57
|
+
* executor failures (bad/missing API key, provider 4xx/5xx, network) and
|
|
58
|
+
* resolves the run with a synthetic empty assistant message rather than
|
|
59
|
+
* throwing, so without this the runtime would record a successful, empty run.
|
|
60
|
+
*/
|
|
61
|
+
export declare class PiHarnessRunError extends Error {
|
|
62
|
+
readonly finalAssistant: AssistantMessage;
|
|
63
|
+
readonly stopReason: string;
|
|
64
|
+
/** Retryable/fatal/unknown, read duck-typed by the runtime via `modelErrorClassification`. */
|
|
65
|
+
readonly classification: ModelErrorClassification;
|
|
66
|
+
constructor(message: string, finalAssistant: AssistantMessage, classification?: ModelErrorClassification);
|
|
67
|
+
}
|
|
68
|
+
export declare function createDefaultPiModels(env?: Record<string, string | undefined>): Promise<Models>;
|
|
69
|
+
export declare function listPiModelSpecs(models?: Models): Promise<string[]>;
|
|
70
|
+
export declare function resolvePiModel(models: Models, modelSpec: string): Model<Api>;
|
|
71
|
+
export declare function runPiAgentLoop(options: RunPiAgentLoopOptions): Promise<RunPiAgentLoopResult>;
|
|
72
|
+
export declare function openRouterModelInputModalities(input: {
|
|
73
|
+
modelId: string;
|
|
74
|
+
env?: Record<string, string | undefined>;
|
|
75
|
+
fetch?: typeof fetch;
|
|
76
|
+
}): Promise<string[]>;
|
|
77
|
+
/**
|
|
78
|
+
* Add complete native videos to the latest user message in an OpenRouter
|
|
79
|
+
* Chat Completions payload. This runs after Pi's text/image conversion because
|
|
80
|
+
* Pi's current public content union does not yet include video.
|
|
81
|
+
*/
|
|
82
|
+
export declare function injectOpenRouterVideoInputs(payload: unknown, videos: HarnessVideoInput[]): unknown;
|
|
83
|
+
export declare function piUsageToRuntime(usage: Usage | undefined): HarnessUsage;
|
|
84
|
+
export interface PiMessageAccounting {
|
|
85
|
+
usage: HarnessUsage;
|
|
86
|
+
providerRequestId?: string;
|
|
87
|
+
billingMode: "api_key" | "byok" | "unknown";
|
|
88
|
+
providerReceipt?: JsonObject;
|
|
89
|
+
}
|
|
90
|
+
export interface OpenRouterGenerationAccountingOptions {
|
|
91
|
+
env?: Record<string, string | undefined>;
|
|
92
|
+
fetch?: typeof fetch;
|
|
93
|
+
fallback?: HarnessUsage;
|
|
94
|
+
}
|
|
95
|
+
/** Resolve provider-settled usage for a completed Pi assistant message. */
|
|
96
|
+
export declare function piMessageAccounting(message: AssistantMessage, options?: {
|
|
97
|
+
env?: Record<string, string | undefined>;
|
|
98
|
+
fetch?: typeof fetch;
|
|
99
|
+
}): Promise<PiMessageAccounting>;
|
|
100
|
+
/** Fetch an immutable OpenRouter generation receipt for initial or retry reconciliation. */
|
|
101
|
+
export declare function openRouterGenerationAccounting(generationId: string, options?: OpenRouterGenerationAccountingOptions): Promise<PiMessageAccounting | undefined>;
|
|
102
|
+
export declare function assistantText(message: AssistantMessage): string;
|
|
103
|
+
//# sourceMappingURL=pi-harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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