@shipers-dev/multi 0.11.1 → 0.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipers-dev/multi",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "multi-agent": "./dist/index.js"
@@ -11,6 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@agentclientprotocol/sdk": "^0.20.0",
14
- "@agentclientprotocol/claude-agent-acp": "^0.31.0"
14
+ "@agentclientprotocol/claude-agent-acp": "^0.31.0",
15
+ "@multi/lib": "workspace:*"
15
16
  }
16
17
  }
package/src/acp-runner.ts CHANGED
@@ -22,13 +22,8 @@ function fmtErr(e: any): string {
22
22
  return String(e);
23
23
  }
24
24
 
25
- export type AcpEvent =
26
- | { event_type: 'progress'; payload: any }
27
- | { event_type: 'assistant_text'; payload: { text: string } }
28
- | { event_type: 'tool_call'; payload: { id: string; tool: string; kind?: string; status?: string; input?: any; locations?: any[] } }
29
- | { event_type: 'tool_result'; payload: { tool_use_id: string; content: string } }
30
- | { event_type: 'result'; payload: { result?: string; duration_ms?: number; total_cost_usd?: number; stopReason?: string } }
31
- | { event_type: 'error'; payload: { message: string } };
25
+ import type { CliStreamEmit } from '@multi/lib';
26
+ export type AcpEvent = CliStreamEmit;
32
27
 
33
28
  export type AcpRunOpts = {
34
29
  apiUrl: string;
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ import { apiClient, setAuthToken } from './client';
5
5
  import { Database } from 'bun:sqlite';
6
6
  import { runAcp } from './acp-runner';
7
7
  import { runAcpx } from './acpx-runner';
8
+ import { STREAM_SCHEMA_VERSION, type StreamEventType, type CliStreamEmit } from '@multi/lib';
8
9
  import { ensureWorktree } from './worktree';
9
10
  import { materializeBundle, lastMaterializedRevision } from './materializer';
10
11
  import { parseArgs } from 'util';
@@ -1371,7 +1372,7 @@ async function drainOfflineDispatches(apiUrl: string, deviceId: string, secret:
1371
1372
  onEnqueued();
1372
1373
  }
1373
1374
 
1374
- async function postStream(apiUrl: string, issueId: string, event_type: string, payload: any) {
1375
+ async function postStream(apiUrl: string, issueId: string, event_type: StreamEventType, payload: unknown) {
1375
1376
  // Local ndjson sink for tail -f debugging.
1376
1377
  try {
1377
1378
  ensureDirs();
@@ -1379,7 +1380,9 @@ async function postStream(apiUrl: string, issueId: string, event_type: string, p
1379
1380
  const path = join(MULTI_DIR, 'logs', `events-${date}.ndjson`);
1380
1381
  appendFileSync(path, JSON.stringify({ ts: Date.now(), issue_id: issueId, event_type, payload }) + '\n');
1381
1382
  } catch {}
1382
- await apiClient.post(`${apiUrl}/api/streams/${issueId}`, { event_type, payload });
1383
+ await apiClient.post(`${apiUrl}/api/streams/${issueId}`, { event_type, payload }, {
1384
+ headers: { 'X-Stream-Version': String(STREAM_SCHEMA_VERSION) },
1385
+ });
1383
1386
  }
1384
1387
 
1385
1388
  // Download attachments of a comment to a local dir. Returns list of absolute paths.
@@ -1445,7 +1448,7 @@ async function uploadOutputDir(apiUrl: string, commentId: string, dir: string):
1445
1448
  return uploaded;
1446
1449
  }
1447
1450
 
1448
- type StreamEvent = { event_type: 'progress' | 'stdout' | 'stderr' | 'tool_call' | 'done' | 'error'; payload: any };
1451
+ type StreamEvent = CliStreamEmit;
1449
1452
  type Runner = (task: any) => AsyncGenerator<StreamEvent>;
1450
1453
 
1451
1454
  function pickRunner(detected: { type: string; path: string }[], preferType?: string): Runner {