@lythos/agent-adapter-deepseek-serve 0.9.37 → 0.9.38

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/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@lythos/agent-adapter-deepseek-serve",
3
- "version": "0.9.37",
3
+ "version": "0.9.38",
4
4
  "type": "module",
5
+ "scripts": {
6
+ "test": "bun test src/ --pass-with-no-tests",
7
+ "test:coverage": "bun test src/ --coverage --coverage-reporter=lcov --coverage-dir=coverage --pass-with-no-tests",
8
+ "test:watch": "bun test src/ --watch"
9
+ },
5
10
  "main": "./src/index.ts",
6
11
  "exports": {
7
12
  ".": "./src/index.ts"
@@ -141,8 +141,8 @@ async function ensureServeRunning(): Promise<number> {
141
141
  stdin: 'ignore',
142
142
  })
143
143
 
144
- // Wait for serve to be ready
145
- for (let i = 0; i < 30; i++) {
144
+ // Wait for serve to be ready (up to 60s for CI/cold-start)
145
+ for (let i = 0; i < 120; i++) {
146
146
  try {
147
147
  const res = await fetch(`http://127.0.0.1:${port}/health`, { signal: AbortSignal.timeout(1000) })
148
148
  if (res.ok) {
@@ -193,12 +193,27 @@ async function collectThreadOutput(threadId: string, port: number, timeoutMs: nu
193
193
  const event: DeepSeekEvent = JSON.parse(line.slice(6))
194
194
  if (event.seq > lastSeq) lastSeq = event.seq
195
195
  if (event.payload?.delta) output += event.payload.delta
196
- if (event.event === 'turn.completed') completed = true
196
+ if (event.event === 'turn_completed' || event.event === 'turn.completed') completed = true
197
197
  } catch {}
198
198
  }
199
199
  }
200
200
  }
201
201
 
202
+ // Fallback: check thread status directly if SSE didn't signal completion
203
+ if (!completed) {
204
+ try {
205
+ const thRes = await fetch(
206
+ `http://127.0.0.1:${port}/v1/threads/${threadId}`,
207
+ { signal: AbortSignal.timeout(3000) }
208
+ )
209
+ if (thRes.ok) {
210
+ const th = await thRes.json()
211
+ const turn = th.turns?.[0] ?? th.thread?.latest_turn
212
+ if (turn?.status === 'completed' && output) completed = true
213
+ }
214
+ } catch {}
215
+ }
216
+
202
217
  if (completed && output) return output
203
218
 
204
219
  // Adaptive poll: shorter interval when events are flowing