@@ -8,8 +8,11 @@ import type { OpenClawConfig } from "../config/config.js";
88import { redactIdentifier } from "../logging/redact-identifier.js" ;
99import type { AuthProfileFailureReason } from "./auth-profiles.js" ;
1010import { ensureAuthProfileStore , saveAuthProfileStore } from "./auth-profiles/store.js" ;
11- import { buildAttemptReplayMetadata } from "./embedded-agent-runner/run/incomplete-turn.js" ;
1211import type { EmbeddedRunAttemptResult } from "./embedded-agent-runner/run/types.js" ;
12+ import {
13+ buildEmbeddedRunnerAssistant as buildAssistant ,
14+ makeEmbeddedRunnerAttempt as makeAttempt ,
15+ } from "./test-helpers/embedded-agent-runner-e2e-fixtures.js" ;
1316import {
1417 installEmbeddedRunnerBackoffE2eMocks ,
1518 installEmbeddedRunnerBaseE2eMocks ,
@@ -141,69 +144,6 @@ afterEach(() => {
141144 resetLoggerFn ( ) ;
142145} ) ;
143146
144- const baseUsage = {
145- input : 0 ,
146- output : 0 ,
147- cacheRead : 0 ,
148- cacheWrite : 0 ,
149- totalTokens : 0 ,
150- cost : { input : 0 , output : 0 , cacheRead : 0 , cacheWrite : 0 , total : 0 } ,
151- } ;
152-
153- const buildAssistant = ( overrides : Partial < AssistantMessage > ) : AssistantMessage => ( {
154- role : "assistant" ,
155- content : [ ] ,
156- api : "openai-responses" ,
157- provider : "openai" ,
158- model : "mock-1" ,
159- usage : baseUsage ,
160- stopReason : "stop" ,
161- timestamp : Date . now ( ) ,
162- ...overrides ,
163- } ) ;
164-
165- const makeAttempt = ( overrides : Partial < EmbeddedRunAttemptResult > ) : EmbeddedRunAttemptResult => {
166- const toolMetas = overrides . toolMetas ?? [ ] ;
167- const didSendViaMessagingTool = overrides . didSendViaMessagingTool ?? false ;
168- const messagingToolSentTexts = overrides . messagingToolSentTexts ?? [ ] ;
169- const messagingToolSentMediaUrls = overrides . messagingToolSentMediaUrls ?? [ ] ;
170- const messagingToolSentTargets = overrides . messagingToolSentTargets ?? [ ] ;
171- const successfulCronAdds = overrides . successfulCronAdds ;
172- return {
173- aborted : false ,
174- externalAbort : false ,
175- timedOut : false ,
176- idleTimedOut : false ,
177- timedOutDuringCompaction : false ,
178- timedOutDuringToolExecution : false ,
179- promptError : null ,
180- promptErrorSource : null ,
181- sessionIdUsed : "session:test" ,
182- systemPromptReport : undefined ,
183- messagesSnapshot : [ ] ,
184- assistantTexts : [ ] ,
185- toolMetas,
186- lastAssistant : undefined ,
187- replayMetadata :
188- overrides . replayMetadata ??
189- buildAttemptReplayMetadata ( {
190- toolMetas,
191- didSendViaMessagingTool,
192- messagingToolSentTexts,
193- messagingToolSentMediaUrls,
194- messagingToolSentTargets,
195- successfulCronAdds,
196- } ) ,
197- didSendViaMessagingTool,
198- messagingToolSentTexts,
199- messagingToolSentMediaUrls,
200- messagingToolSentTargets,
201- cloudCodeAssistFormatError : false ,
202- itemLifecycle : { startedCount : 0 , completedCount : 0 , activeCount : 0 } ,
203- ...overrides ,
204- } ;
205- } ;
206-
207147const makeConfig = ( opts ?: {
208148 fallbacks ?: string [ ] ;
209149 apiKey ?: string ;
0 commit comments