car-runtime 0.4.9 → 0.5.1

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.
Files changed (2) hide show
  1. package/index.d.ts +167 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -143,6 +143,8 @@ export class CarRuntime {
143
143
  context?: string | null,
144
144
  toolsJson?: string | null,
145
145
  messagesJson?: string | null,
146
+ toolChoice?: string | null,
147
+ parallelToolCalls?: boolean | null,
146
148
  ): Promise<string>;
147
149
 
148
150
  /** Generate text grounded with memory context from this runtime's memgine. */
@@ -285,8 +287,173 @@ export function inferStream(
285
287
  context: string | null | undefined,
286
288
  toolsJson: string | null | undefined,
287
289
  onEvent: (eventJson: string) => void,
290
+ toolChoice?: string | null,
291
+ parallelToolCalls?: boolean | null,
288
292
  ): Promise<string>;
289
293
 
294
+ // --- Voice streaming (stored-callback pattern) ---
295
+
296
+ export type AudioSourceSpec =
297
+ | { kind: 'mic' }
298
+ | { kind: 'system' }
299
+ | { kind: 'file'; path: string }
300
+ | { kind: 'fifo'; path: string }
301
+ | { kind: 'pcm_push'; sample_rate: number; channels?: 1 | 2 };
302
+
303
+ export interface TranscribeStreamOptions {
304
+ model?: string;
305
+ language?: string;
306
+ prompt?: string;
307
+ emit_audio_meta?: boolean;
308
+ /**
309
+ * Enable native streaming partials. Today only takes effect for
310
+ * `mic` sources when the runtime was compiled with the `parakeet`
311
+ * feature; the listener uses Parakeet TDT for transcription and
312
+ * emits `partial` events per non-blank token before each canonical
313
+ * `transcript` event. Without the feature or for non-Mic sources
314
+ * this flag is silently ignored.
315
+ */
316
+ streaming?: boolean;
317
+ /**
318
+ * Attach the prepared speaker diarizer to this session so
319
+ * `transcript` events carry `role: "other:speaker_N"` rather than
320
+ * `"unknown"`. Caller must `prepareDiarizer()` first. Silently
321
+ * ignored if no diarizer has been prepared, or if the source isn't
322
+ * `mic`.
323
+ */
324
+ diarizer?: boolean;
325
+ /**
326
+ * Attach the enrollment-based speaker pipeline so segments matching
327
+ * an enrolled voiceprint get `role: "enrolled_user"`. Pipeline is
328
+ * built lazily from `~/.car/voiceprints/`.
329
+ */
330
+ enrolled?: boolean;
331
+ }
332
+
333
+ export type VoiceStreamEvent =
334
+ | { type: 'speech_start' }
335
+ | { type: 'speech_end' }
336
+ | { type: 'transcript'; text: string; duration_ms: number; role: string }
337
+ | { type: 'partial'; text: string; duration_ms: number }
338
+ | { type: 'audio_chunk'; sample_rate: number; frame_count: number }
339
+ | { type: 'barge_in' }
340
+ | { type: 'enrollment_captured'; label: string; save_path: string }
341
+ | { type: 'enrollment_failed'; reason: string }
342
+ | { type: 'done' }
343
+ | { type: 'error'; message: string };
344
+
345
+ export function registerVoiceEventHandler(
346
+ onEvent: (sessionId: string, eventJson: string) => void,
347
+ ): void;
348
+
349
+ export function transcribeStream(
350
+ rt: CarRuntime,
351
+ sessionId: string,
352
+ audioSourceJson: string,
353
+ optionsJson?: string | null,
354
+ ): Promise<string>;
355
+
356
+ export function transcribeStreamStop(rt: CarRuntime, sessionId: string): Promise<string>;
357
+
358
+ export function transcribeStreamPush(
359
+ rt: CarRuntime,
360
+ sessionId: string,
361
+ pcmFrame: Buffer,
362
+ ): Promise<string>;
363
+
364
+ export function listVoiceSessions(rt: CarRuntime): string;
365
+
366
+ // --- Meeting capture ---
367
+
368
+ export interface StartMeetingRequest {
369
+ id?: string;
370
+ sources: Array<'mic' | 'system'>;
371
+ title?: string;
372
+ model?: string;
373
+ language?: string;
374
+ persist_audio?: boolean;
375
+ root?: string;
376
+ /**
377
+ * Enable native streaming partials on the mic source. Effective
378
+ * only when the runtime was built with `--features parakeet`;
379
+ * silently ignored otherwise. `transcript` events still arrive at
380
+ * segment end — `partial` events are emitted incrementally per
381
+ * non-blank token in between.
382
+ */
383
+ streaming?: boolean;
384
+ /**
385
+ * Attach the prepared diarizer to the mic source so transcripts
386
+ * carry per-speaker roles. Call `prepareDiarizer()` first.
387
+ */
388
+ diarizer?: boolean;
389
+ /**
390
+ * Attach the enrollment-based pipeline so segments matching an
391
+ * enrolled voiceprint get `role: "enrolled_user"`.
392
+ */
393
+ enrolled?: boolean;
394
+ }
395
+
396
+ /** Eagerly download + load the Parakeet TDT model (~600 MB). Idempotent. */
397
+ export function prepareParakeet(rt: CarRuntime): Promise<string>;
398
+
399
+ /** Eagerly download + load the speaker diarizer (~28 MB). Idempotent. */
400
+ export function prepareDiarizer(rt: CarRuntime): Promise<string>;
401
+
402
+ /**
403
+ * Enroll a speaker. `audioJson` shape:
404
+ * - `{"kind":"wav","path":"/abs/path.wav"}` — decoded via hound
405
+ * - `{"kind":"pcm","sample_rate":48000,"channels":1,"data_b64":"<base64>"}`
406
+ *
407
+ * Saves to `~/.car/voiceprints/<label>.toml`. Returns
408
+ * `{"label":...,"path":...,"model_id":...}`.
409
+ */
410
+ export function enrollSpeaker(
411
+ rt: CarRuntime,
412
+ label: string,
413
+ audioJson: string,
414
+ ): Promise<string>;
415
+
416
+ /** List saved enrollments. Returns `{"enrollments":[{label,path,model_id},...]}`. */
417
+ export function listEnrollments(rt: CarRuntime): string;
418
+
419
+ /** Delete a saved enrollment by label. Idempotent. */
420
+ export function removeEnrollment(rt: CarRuntime, label: string): string;
421
+
422
+ // --- Workflow ---
423
+
424
+ /**
425
+ * Run a multi-stage workflow definition. Reuses the agent runner
426
+ * registered via `registerAgentRunner` for any agent stages in the
427
+ * workflow.
428
+ */
429
+ export function runWorkflow(workflowJson: string): Promise<string>;
430
+
431
+ /** Static analysis on a workflow definition. Returns verification report JSON. */
432
+ export function verifyWorkflow(workflowJson: string): string;
433
+
434
+ export interface StartMeetingResponse {
435
+ id: string;
436
+ title: string;
437
+ started_at: string;
438
+ voice_session_ids: string[];
439
+ }
440
+
441
+ export function startMeeting(rt: CarRuntime, requestJson: string): Promise<string>;
442
+
443
+ export function stopMeeting(
444
+ rt: CarRuntime,
445
+ meetingId: string,
446
+ summarize?: boolean | null,
447
+ ): Promise<string>;
448
+
449
+ export function listMeetings(rt: CarRuntime, rootOverride?: string | null): string;
450
+
451
+ export function getMeeting(
452
+ rt: CarRuntime,
453
+ meetingId: string,
454
+ rootOverride?: string | null,
455
+ ): string;
456
+
290
457
  // --- Verification (stateless) ---
291
458
 
292
459
  export function verify(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "car-runtime",
3
- "version": "0.4.9",
3
+ "version": "0.5.1",
4
4
  "description": "Common Agent Runtime — a deterministic execution layer for AI agents",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",