paseo-dsh-direct 0.2.6 → 0.2.7

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,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-dsh-direct",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "DeepSeek Harness Direct Provider Plugin for Paseo",
5
5
  "repository": {
6
6
  "type": "git",
@@ -379,6 +379,24 @@ export async function launchDshBridge(options: LaunchBridgeOptions): Promise<Dsh
379
379
  }
380
380
  }
381
381
 
382
+ /**
383
+ * Parse one stdout line from the bridge process. `undefined` means the line is
384
+ * not a protocol message: dsh also writes its own logs to stdout (for example
385
+ * the model-catalog line the deepseek-account provider emits), and such a line
386
+ * must not fail the bridge.
387
+ */
388
+ export function parseBridgeLine(line: string): RpcResponse | RpcNotification | undefined {
389
+ let value: unknown;
390
+ try {
391
+ value = JSON.parse(line);
392
+ } catch {
393
+ return undefined;
394
+ }
395
+ return typeof value === "object" && value !== null && !Array.isArray(value)
396
+ ? (value as RpcResponse | RpcNotification)
397
+ : undefined;
398
+ }
399
+
382
400
  class JsonlBridgeClient implements DshBridge {
383
401
  initialized!: BridgeInitializeResult;
384
402
  readonly executable: string;
@@ -517,11 +535,12 @@ class JsonlBridgeClient implements DshBridge {
517
535
 
518
536
  private acceptLine(line: string): void {
519
537
  if (!line.trim()) return;
520
- let message: RpcResponse | RpcNotification;
521
- try {
522
- message = JSON.parse(line) as RpcResponse | RpcNotification;
523
- } catch {
524
- this.fail(new Error(`DSH bridge wrote invalid JSON: ${line.slice(0, 200)}`));
538
+ const message = parseBridgeLine(line);
539
+ if (message === undefined) {
540
+ // stdout carries the protocol, but dsh writes its own logs there too.
541
+ // Forward the line to stderr and keep the bridge alive instead of
542
+ // failing every provider snapshot on one log line.
543
+ process.stderr.write(`[paseo-dsh-direct] ignored dsh stdout: ${line.slice(0, 2000)}\n`);
525
544
  return;
526
545
  }
527
546
  if ("id" in message) {