@pellux/goodvibes-sdk 0.25.7 → 0.25.8

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 (96) hide show
  1. package/dist/_internal/contracts/artifacts/operator-contract.json +100 -4
  2. package/dist/_internal/contracts/generated/foundation-metadata.d.ts +2 -2
  3. package/dist/_internal/contracts/generated/foundation-metadata.js +2 -2
  4. package/dist/_internal/contracts/generated/operator-contract.d.ts.map +1 -1
  5. package/dist/_internal/contracts/generated/operator-contract.js +100 -4
  6. package/dist/_internal/contracts/generated/operator-method-ids.d.ts +1 -1
  7. package/dist/_internal/contracts/generated/operator-method-ids.d.ts.map +1 -1
  8. package/dist/_internal/contracts/generated/operator-method-ids.js +1 -0
  9. package/dist/_internal/daemon/context.d.ts +1 -0
  10. package/dist/_internal/daemon/context.d.ts.map +1 -1
  11. package/dist/_internal/daemon/media-route-types.d.ts +10 -0
  12. package/dist/_internal/daemon/media-route-types.d.ts.map +1 -1
  13. package/dist/_internal/daemon/media-routes.d.ts +1 -1
  14. package/dist/_internal/daemon/media-routes.d.ts.map +1 -1
  15. package/dist/_internal/daemon/media-routes.js +91 -10
  16. package/dist/_internal/daemon/operator.d.ts +1 -1
  17. package/dist/_internal/daemon/operator.d.ts.map +1 -1
  18. package/dist/_internal/daemon/operator.js +2 -0
  19. package/dist/_internal/platform/adapters/ntfy/index.js +13 -2
  20. package/dist/_internal/platform/adapters/types.d.ts +2 -0
  21. package/dist/_internal/platform/adapters/types.d.ts.map +1 -1
  22. package/dist/_internal/platform/batch/index.d.ts +4 -0
  23. package/dist/_internal/platform/batch/index.d.ts.map +1 -0
  24. package/dist/_internal/platform/batch/index.js +2 -0
  25. package/dist/_internal/platform/batch/manager.d.ts +41 -0
  26. package/dist/_internal/platform/batch/manager.d.ts.map +1 -0
  27. package/dist/_internal/platform/batch/manager.js +400 -0
  28. package/dist/_internal/platform/batch/types.d.ts +85 -0
  29. package/dist/_internal/platform/batch/types.d.ts.map +1 -0
  30. package/dist/_internal/platform/batch/types.js +10 -0
  31. package/dist/_internal/platform/channels/builtin/plugins.d.ts.map +1 -1
  32. package/dist/_internal/platform/channels/builtin/plugins.js +1 -0
  33. package/dist/_internal/platform/channels/reply-pipeline.d.ts +9 -1
  34. package/dist/_internal/platform/channels/reply-pipeline.d.ts.map +1 -1
  35. package/dist/_internal/platform/channels/reply-pipeline.js +156 -6
  36. package/dist/_internal/platform/config/schema-domain-core.d.ts +6 -0
  37. package/dist/_internal/platform/config/schema-domain-core.d.ts.map +1 -1
  38. package/dist/_internal/platform/config/schema-domain-core.js +30 -0
  39. package/dist/_internal/platform/config/schema-domain-runtime.d.ts +19 -0
  40. package/dist/_internal/platform/config/schema-domain-runtime.d.ts.map +1 -1
  41. package/dist/_internal/platform/config/schema-domain-runtime.js +118 -0
  42. package/dist/_internal/platform/config/schema-types.d.ts +33 -2
  43. package/dist/_internal/platform/config/schema-types.d.ts.map +1 -1
  44. package/dist/_internal/platform/config/schema.d.ts.map +1 -1
  45. package/dist/_internal/platform/config/schema.js +3 -0
  46. package/dist/_internal/platform/control-plane/method-catalog-media.d.ts.map +1 -1
  47. package/dist/_internal/platform/control-plane/method-catalog-media.js +17 -0
  48. package/dist/_internal/platform/control-plane/routes/operator.d.ts +1 -1
  49. package/dist/_internal/platform/control-plane/routes/operator.d.ts.map +1 -1
  50. package/dist/_internal/platform/control-plane/routes/operator.js +2 -0
  51. package/dist/_internal/platform/daemon/facade-composition.d.ts +2 -0
  52. package/dist/_internal/platform/daemon/facade-composition.d.ts.map +1 -1
  53. package/dist/_internal/platform/daemon/facade-composition.js +10 -0
  54. package/dist/_internal/platform/daemon/http/batch-routes.d.ts +8 -0
  55. package/dist/_internal/platform/daemon/http/batch-routes.d.ts.map +1 -0
  56. package/dist/_internal/platform/daemon/http/batch-routes.js +113 -0
  57. package/dist/_internal/platform/daemon/http/router-route-contexts.d.ts.map +1 -1
  58. package/dist/_internal/platform/daemon/http/router-route-contexts.js +1 -0
  59. package/dist/_internal/platform/daemon/http/router.d.ts +4 -0
  60. package/dist/_internal/platform/daemon/http/router.d.ts.map +1 -1
  61. package/dist/_internal/platform/daemon/http/router.js +15 -0
  62. package/dist/_internal/platform/daemon/http/runtime-route-types.d.ts +2 -0
  63. package/dist/_internal/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
  64. package/dist/_internal/platform/daemon/surface-actions.d.ts +6 -0
  65. package/dist/_internal/platform/daemon/surface-actions.d.ts.map +1 -1
  66. package/dist/_internal/platform/daemon/surface-actions.js +13 -0
  67. package/dist/_internal/platform/daemon/surface-delivery.d.ts +3 -0
  68. package/dist/_internal/platform/daemon/surface-delivery.d.ts.map +1 -1
  69. package/dist/_internal/platform/daemon/surface-delivery.js +42 -6
  70. package/dist/_internal/platform/daemon/types.d.ts +2 -0
  71. package/dist/_internal/platform/daemon/types.d.ts.map +1 -1
  72. package/dist/_internal/platform/providers/anthropic.d.ts +13 -1
  73. package/dist/_internal/platform/providers/anthropic.d.ts.map +1 -1
  74. package/dist/_internal/platform/providers/anthropic.js +219 -1
  75. package/dist/_internal/platform/providers/interface.d.ts +48 -0
  76. package/dist/_internal/platform/providers/interface.d.ts.map +1 -1
  77. package/dist/_internal/platform/providers/openai.d.ts +13 -1
  78. package/dist/_internal/platform/providers/openai.d.ts.map +1 -1
  79. package/dist/_internal/platform/providers/openai.js +189 -1
  80. package/dist/_internal/platform/version.js +1 -1
  81. package/dist/_internal/platform/voice/index.d.ts +1 -1
  82. package/dist/_internal/platform/voice/index.d.ts.map +1 -1
  83. package/dist/_internal/platform/voice/providers/elevenlabs.d.ts.map +1 -1
  84. package/dist/_internal/platform/voice/providers/elevenlabs.js +150 -4
  85. package/dist/_internal/platform/voice/service.d.ts +2 -1
  86. package/dist/_internal/platform/voice/service.d.ts.map +1 -1
  87. package/dist/_internal/platform/voice/service.js +7 -0
  88. package/dist/_internal/platform/voice/types.d.ts +18 -1
  89. package/dist/_internal/platform/voice/types.d.ts.map +1 -1
  90. package/dist/index.d.ts +2 -0
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +1 -0
  93. package/dist/workers.d.ts +40 -0
  94. package/dist/workers.d.ts.map +1 -0
  95. package/dist/workers.js +144 -0
  96. package/package.json +5 -1
@@ -6,6 +6,8 @@ export interface TrackedChannelReply {
6
6
  readonly agentId: string;
7
7
  readonly surfaceKind: ChannelSurface;
8
8
  readonly task: string;
9
+ readonly agentTask?: string;
10
+ readonly workflowChainId?: string;
9
11
  readonly createdAt: number;
10
12
  readonly sessionId?: string;
11
13
  readonly routeId?: string;
@@ -23,6 +25,7 @@ export declare class ChannelReplyPipeline {
23
25
  private readonly routeBindings;
24
26
  private readonly now;
25
27
  private readonly buffers;
28
+ private readonly workflowChains;
26
29
  private readonly unsubscribers;
27
30
  constructor(deps: ReplyPipelineDeps);
28
31
  attachRuntimeBus(runtimeBus: RuntimeEventBus | null): void;
@@ -32,9 +35,14 @@ export declare class ChannelReplyPipeline {
32
35
  has(agentId: string): boolean;
33
36
  getPending(agentId: string): TrackedChannelReply | null;
34
37
  deliverProgress(agentId: string, explicitText?: string, force?: boolean): Promise<ChannelRenderResult | null>;
35
- deliverFinal(agentId: string, explicitText: string): Promise<ChannelRenderResult | null>;
38
+ deliverFinal(agentId: string, explicitText: string, options?: {
39
+ readonly keepTracking?: boolean;
40
+ }): Promise<ChannelRenderResult | null>;
36
41
  private handleEnvelope;
42
+ private handleWorkflowEnvelope;
37
43
  private trackChildPendingReply;
44
+ private findPendingForWorkflowTask;
45
+ private associateWorkflowChain;
38
46
  private resolvePolicy;
39
47
  private dispatch;
40
48
  private disposeSubscriptions;
@@ -1 +1 @@
1
- {"version":3,"file":"reply-pipeline.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/channels/reply-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACzG,OAAO,KAAK,EACV,kBAAk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EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAe3G,YAAY,CAChB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE;QAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAO,GAChD,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;YA0BxB,cAAc;YAiDd,sBAAsB;IAsCpC,OAAO,CAAC,sBAAsB;IAmB9B,OAAO,CAAC,0BAA0B;IAgBlC,OAAO,CAAC,sBAAsB;YAahB,aAAa;YAIb,QAAQ;IAgCtB,OAAO,CAAC,oBAAoB;CAK7B"}
@@ -194,7 +194,10 @@ function buildRenderedText(explicitText, events, policy, phase) {
194
194
  if (phase === 'final' && explicitText.trim().length > 0) {
195
195
  return trimText(explicitText, policy.maxChunkChars);
196
196
  }
197
- const lines = events
197
+ const renderableEvents = policy.surface === 'ntfy'
198
+ ? events.filter((event) => event.kind !== 'assistant_text' && event.kind !== 'reasoning')
199
+ : events;
200
+ const lines = renderableEvents
198
201
  .slice(-policy.maxEventsPerUpdate)
199
202
  .map((event) => eventLine(event, policy.reasoningVisibility))
200
203
  .filter((line) => Boolean(line && line.trim().length > 0));
@@ -217,6 +220,16 @@ function resolveEnvelopeAgentId(envelope) {
217
220
  const payload = envelope.payload;
218
221
  return typeof payload.agentId === 'string' ? payload.agentId : null;
219
222
  }
223
+ function isWorkflowEventPayload(payload) {
224
+ return payload.type.startsWith('WORKFLOW_');
225
+ }
226
+ function resolveEnvelopeWorkflowChainId(envelope) {
227
+ const payload = envelope.payload;
228
+ return typeof payload.chainId === 'string' && payload.chainId.length > 0 ? payload.chainId : null;
229
+ }
230
+ function isAgentFinalEvent(type) {
231
+ return type === 'AGENT_COMPLETED' || type === 'AGENT_FAILED' || type === 'AGENT_CANCELLED';
232
+ }
220
233
  export function normalizeChannelRenderEventFromRuntime(envelope) {
221
234
  const payload = envelope.payload;
222
235
  switch (payload.type) {
@@ -297,6 +310,50 @@ export function normalizeChannelRenderEventFromRuntime(envelope) {
297
310
  return [renderEvent(payload.type === 'COMPACTION_FAILED' ? 'error' : 'compaction', 'progress', envelope, {
298
311
  text: payload.type.replace(/^COMPACTION_/, '').toLowerCase().replace(/_/g, ' '),
299
312
  })];
313
+ case 'WORKFLOW_CHAIN_CREATED':
314
+ return [renderEvent('status', 'progress', envelope, {
315
+ text: `WRFC chain ${payload.chainId.slice(0, 12)} started: ${trimText(payload.task, 180)}`,
316
+ })];
317
+ case 'WORKFLOW_STATE_CHANGED':
318
+ return [renderEvent('status', 'progress', envelope, {
319
+ text: `WRFC chain ${payload.chainId.slice(0, 12)} moved from ${payload.from} to ${payload.to}`,
320
+ })];
321
+ case 'WORKFLOW_REVIEW_COMPLETED': {
322
+ const constraintSummary = typeof payload.constraintsSatisfied === 'number' && typeof payload.constraintsTotal === 'number'
323
+ ? `, constraints ${payload.constraintsSatisfied}/${payload.constraintsTotal}`
324
+ : '';
325
+ return [renderEvent(payload.passed ? 'status' : 'error', 'progress', envelope, {
326
+ text: `WRFC review ${payload.passed ? 'passed' : 'needs fixes'}: score ${payload.score}/10${constraintSummary}`,
327
+ })];
328
+ }
329
+ case 'WORKFLOW_FIX_ATTEMPTED':
330
+ return [renderEvent('status', 'progress', envelope, {
331
+ text: `WRFC fix attempt ${payload.attempt}/${payload.maxAttempts} started`,
332
+ })];
333
+ case 'WORKFLOW_GATE_RESULT':
334
+ return [renderEvent(payload.passed ? 'status' : 'error', 'progress', envelope, {
335
+ text: `WRFC gate ${payload.gate} ${payload.passed ? 'passed' : 'failed'}`,
336
+ })];
337
+ case 'WORKFLOW_AUTO_COMMITTED':
338
+ return [renderEvent('status', 'progress', envelope, {
339
+ text: `WRFC changes committed${payload.commitHash ? `: ${payload.commitHash}` : ''}`,
340
+ })];
341
+ case 'WORKFLOW_CASCADE_ABORTED':
342
+ return [renderEvent('error', 'progress', envelope, {
343
+ text: `WRFC cascade warning: ${payload.reason}`,
344
+ })];
345
+ case 'WORKFLOW_CONSTRAINTS_ENUMERATED':
346
+ return [renderEvent('status', 'progress', envelope, {
347
+ text: `WRFC constraints enumerated: ${payload.constraints.length}`,
348
+ })];
349
+ case 'WORKFLOW_CHAIN_PASSED':
350
+ return [renderEvent('status', 'final', envelope, {
351
+ text: `WRFC chain ${payload.chainId.slice(0, 12)} passed`,
352
+ })];
353
+ case 'WORKFLOW_CHAIN_FAILED':
354
+ return [renderEvent('error', 'final', envelope, {
355
+ text: `WRFC chain ${payload.chainId.slice(0, 12)} failed: ${payload.reason}`,
356
+ })];
300
357
  case 'TURN_COMPLETED':
301
358
  return payload.response.trim().length > 0
302
359
  ? [renderEvent('assistant_text', 'final', envelope, { text: payload.response })]
@@ -312,6 +369,7 @@ export class ChannelReplyPipeline {
312
369
  routeBindings;
313
370
  now;
314
371
  buffers = new Map();
372
+ workflowChains = new Map();
315
373
  unsubscribers = [];
316
374
  constructor(deps) {
317
375
  this.channelPlugins = deps.channelPlugins;
@@ -331,6 +389,7 @@ export class ChannelReplyPipeline {
331
389
  'permissions',
332
390
  'providers',
333
391
  'compaction',
392
+ 'workflows',
334
393
  ];
335
394
  for (const domain of domains) {
336
395
  this.unsubscribers.push(runtimeBus.onDomain(domain, (envelope) => {
@@ -341,15 +400,24 @@ export class ChannelReplyPipeline {
341
400
  dispose() {
342
401
  this.disposeSubscriptions();
343
402
  this.buffers.clear();
403
+ this.workflowChains.clear();
344
404
  }
345
405
  trackPending(pending) {
346
406
  this.buffers.set(pending.agentId, {
347
407
  pending,
348
408
  events: [],
349
409
  });
410
+ if (typeof pending.workflowChainId === 'string' && pending.workflowChainId.length > 0) {
411
+ this.workflowChains.set(pending.workflowChainId, pending.agentId);
412
+ }
350
413
  }
351
414
  untrack(agentId) {
352
415
  this.buffers.delete(agentId);
416
+ for (const [chainId, mappedAgentId] of this.workflowChains.entries()) {
417
+ if (mappedAgentId === agentId) {
418
+ this.workflowChains.delete(chainId);
419
+ }
420
+ }
353
421
  }
354
422
  has(agentId) {
355
423
  return this.buffers.has(agentId);
@@ -362,7 +430,7 @@ export class ChannelReplyPipeline {
362
430
  if (!state)
363
431
  return null;
364
432
  const policy = await this.resolvePolicy(state.pending.surfaceKind);
365
- const text = buildRenderedText(explicitText ?? '', state.events, policy, 'progress');
433
+ const text = buildRenderedText(policy.surface === 'ntfy' ? '' : explicitText ?? '', state.events, policy, 'progress');
366
434
  if (!text)
367
435
  return null;
368
436
  if (!force && state.lastDeliveredText === text && (this.now() - (state.lastDeliveredAt ?? 0)) < DEFAULT_PROGRESS_INTERVAL_MS) {
@@ -373,7 +441,7 @@ export class ChannelReplyPipeline {
373
441
  state.lastDeliveredAt = this.now();
374
442
  return result;
375
443
  }
376
- async deliverFinal(agentId, explicitText) {
444
+ async deliverFinal(agentId, explicitText, options = {}) {
377
445
  const state = this.buffers.get(agentId);
378
446
  if (!state)
379
447
  return null;
@@ -388,10 +456,16 @@ export class ChannelReplyPipeline {
388
456
  metadata: {},
389
457
  };
390
458
  const result = await this.dispatch(state, policy, 'final', buildRenderedText(explicitText, finalEvents.length > 0 ? finalEvents : [...state.events, statusEvent], policy, 'final'), finalEvents.length > 0 ? finalEvents : [...state.events.slice(-policy.maxEventsPerUpdate + 1), statusEvent]);
391
- this.untrack(agentId);
459
+ if (!options.keepTracking) {
460
+ this.untrack(agentId);
461
+ }
392
462
  return result;
393
463
  }
394
464
  async handleEnvelope(envelope) {
465
+ if (isWorkflowEventPayload(envelope.payload)) {
466
+ await this.handleWorkflowEnvelope(envelope);
467
+ return;
468
+ }
395
469
  if (envelope.payload.type === 'AGENT_SPAWNING'
396
470
  && typeof envelope.payload.parentAgentId === 'string'
397
471
  && envelope.payload.parentAgentId.length > 0) {
@@ -412,17 +486,62 @@ export class ChannelReplyPipeline {
412
486
  }
413
487
  const hasFinal = events.some((event) => event.phase === 'final');
414
488
  if (hasFinal) {
489
+ const finalKinds = state.pending.surfaceKind === 'ntfy'
490
+ ? new Set(['error', 'status'])
491
+ : new Set(['assistant_text', 'error', 'status']);
415
492
  const text = events
416
- .filter((event) => event.kind === 'assistant_text' || event.kind === 'error' || event.kind === 'status')
493
+ .filter((event) => finalKinds.has(event.kind))
417
494
  .map((event) => event.text ?? '')
418
495
  .filter(Boolean)
419
496
  .join('\n')
420
497
  .trim();
421
- await this.deliverFinal(agentId, text);
498
+ await this.deliverFinal(agentId, text, {
499
+ keepTracking: state.pending.surfaceKind === 'ntfy'
500
+ && typeof state.pending.workflowChainId === 'string'
501
+ && isAgentFinalEvent(envelope.payload.type),
502
+ });
422
503
  return;
423
504
  }
424
505
  await this.deliverProgress(agentId);
425
506
  }
507
+ async handleWorkflowEnvelope(envelope) {
508
+ if (envelope.payload.type === 'WORKFLOW_CHAIN_CREATED') {
509
+ const matched = this.findPendingForWorkflowTask(envelope.payload.task);
510
+ if (matched) {
511
+ this.associateWorkflowChain(matched.pending.agentId, envelope.payload.chainId);
512
+ }
513
+ }
514
+ const chainId = resolveEnvelopeWorkflowChainId(envelope);
515
+ if (!chainId)
516
+ return;
517
+ const agentId = this.workflowChains.get(chainId);
518
+ if (!agentId)
519
+ return;
520
+ const state = this.buffers.get(agentId);
521
+ if (!state) {
522
+ this.workflowChains.delete(chainId);
523
+ return;
524
+ }
525
+ const events = normalizeChannelRenderEventFromRuntime(envelope);
526
+ if (events.length === 0)
527
+ return;
528
+ state.events.push(...events);
529
+ if (state.events.length > MAX_BUFFERED_EVENTS) {
530
+ state.events.splice(0, state.events.length - MAX_BUFFERED_EVENTS);
531
+ }
532
+ const hasFinal = events.some((event) => event.phase === 'final');
533
+ if (hasFinal) {
534
+ const text = events
535
+ .filter((event) => event.kind === 'error' || event.kind === 'status')
536
+ .map((event) => event.text ?? '')
537
+ .filter(Boolean)
538
+ .join('\n')
539
+ .trim();
540
+ await this.deliverFinal(agentId, text);
541
+ return;
542
+ }
543
+ await this.deliverProgress(agentId, undefined, true);
544
+ }
426
545
  trackChildPendingReply(agentId, parentAgentId, task) {
427
546
  if (this.buffers.has(agentId))
428
547
  return;
@@ -443,6 +562,37 @@ export class ChannelReplyPipeline {
443
562
  events: [],
444
563
  });
445
564
  }
565
+ findPendingForWorkflowTask(task) {
566
+ const normalizedTask = task.trim();
567
+ if (!normalizedTask)
568
+ return null;
569
+ let fallback = null;
570
+ for (const state of this.buffers.values()) {
571
+ if (typeof state.pending.workflowChainId === 'string')
572
+ continue;
573
+ const agentTask = typeof state.pending.agentTask === 'string' ? state.pending.agentTask.trim() : '';
574
+ const pendingTask = state.pending.task.trim();
575
+ if (agentTask === normalizedTask)
576
+ return state;
577
+ if (!fallback && pendingTask === normalizedTask) {
578
+ fallback = state;
579
+ }
580
+ }
581
+ return fallback;
582
+ }
583
+ associateWorkflowChain(agentId, chainId) {
584
+ const state = this.buffers.get(agentId);
585
+ if (!state)
586
+ return;
587
+ this.workflowChains.set(chainId, agentId);
588
+ this.buffers.set(agentId, {
589
+ ...state,
590
+ pending: {
591
+ ...state.pending,
592
+ workflowChainId: chainId,
593
+ },
594
+ });
595
+ }
446
596
  async resolvePolicy(surface) {
447
597
  return await this.channelPlugins.getRenderPolicy(surface) ?? DEFAULT_POLICY[surface];
448
598
  }
@@ -75,6 +75,12 @@ export declare const coreConfigDefaults: {
75
75
  operationalMessages: string;
76
76
  wrfcMessages: string;
77
77
  };
78
+ tts: {
79
+ provider: string;
80
+ voice: string;
81
+ llmProvider: string;
82
+ llmModel: string;
83
+ };
78
84
  release: {
79
85
  channel: string;
80
86
  };
@@ -1 +1 @@
1
- {"version":3,"file":"schema-domain-core.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/config/schema-domain-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoH9B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,uBAAuB,EAmX3D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,uBAAuB,EA+H3D,CAAC"}
1
+ {"version":3,"file":"schema-domain-core.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/config/schema-domain-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0H9B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,uBAAuB,EA2Y3D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,uBAAuB,EA+H3D,CAAC"}
@@ -74,6 +74,12 @@ export const coreConfigDefaults = {
74
74
  operationalMessages: 'panel',
75
75
  wrfcMessages: 'both',
76
76
  },
77
+ tts: {
78
+ provider: 'elevenlabs',
79
+ voice: '',
80
+ llmProvider: '',
81
+ llmModel: '',
82
+ },
77
83
  release: {
78
84
  channel: 'stable',
79
85
  },
@@ -465,6 +471,30 @@ export const coreHeadConfigSettings = [
465
471
  description: 'Where operational system messages render by default: panel, conversation, or both',
466
472
  enumValues: ['panel', 'conversation', 'both'],
467
473
  },
474
+ {
475
+ key: 'tts.provider',
476
+ type: 'string',
477
+ default: 'elevenlabs',
478
+ description: 'Default TTS provider used by spoken-output clients when no provider is supplied on the request',
479
+ },
480
+ {
481
+ key: 'tts.voice',
482
+ type: 'string',
483
+ default: '',
484
+ description: 'Default TTS voice id used by spoken-output clients when no voice is supplied on the request',
485
+ },
486
+ {
487
+ key: 'tts.llmProvider',
488
+ type: 'string',
489
+ default: '',
490
+ description: 'Optional LLM provider override for spoken-output turns; empty means use the active chat provider',
491
+ },
492
+ {
493
+ key: 'tts.llmModel',
494
+ type: 'string',
495
+ default: '',
496
+ description: 'Optional LLM model override for spoken-output turns; empty means use the active chat model',
497
+ },
468
498
  {
469
499
  key: 'ui.operationalMessages',
470
500
  type: 'enum',
@@ -8,6 +8,25 @@ export declare const runtimeConfigDefaults: {
8
8
  maxListeners: number;
9
9
  };
10
10
  };
11
+ batch: {
12
+ mode: string;
13
+ fallback: string;
14
+ queueBackend: string;
15
+ tickIntervalMs: number;
16
+ maxDelayMs: number;
17
+ maxJobsPerProviderBatch: number;
18
+ maxQueuePayloadBytes: number;
19
+ maxQueueMessagesPerDay: number;
20
+ };
21
+ cloudflare: {
22
+ enabled: boolean;
23
+ freeTierMode: boolean;
24
+ workerBaseUrl: string;
25
+ workerTokenRef: string;
26
+ queueName: string;
27
+ deadLetterQueueName: string;
28
+ maxQueueOpsPerDay: number;
29
+ };
11
30
  telemetry: {
12
31
  includeRawPrompts: boolean;
13
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"schema-domain-runtime.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/config/schema-domain-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFjC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,uBAAuB,EAyMjE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,uBAAuB,EA2HnE,CAAC"}
1
+ {"version":3,"file":"schema-domain-runtime.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/config/schema-domain-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGjC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,uBAAuB,EAyMjE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,uBAAuB,EA8NnE,CAAC"}
@@ -7,6 +7,25 @@ export const runtimeConfigDefaults = {
7
7
  maxListeners: 100,
8
8
  },
9
9
  },
10
+ batch: {
11
+ mode: 'off',
12
+ fallback: 'live',
13
+ queueBackend: 'local',
14
+ tickIntervalMs: 60_000,
15
+ maxDelayMs: 5 * 60 * 1000,
16
+ maxJobsPerProviderBatch: 100,
17
+ maxQueuePayloadBytes: 16 * 1024,
18
+ maxQueueMessagesPerDay: 1_000,
19
+ },
20
+ cloudflare: {
21
+ enabled: false,
22
+ freeTierMode: true,
23
+ workerBaseUrl: '',
24
+ workerTokenRef: '',
25
+ queueName: 'goodvibes-batch',
26
+ deadLetterQueueName: 'goodvibes-batch-dlq',
27
+ maxQueueOpsPerDay: 10_000,
28
+ },
10
29
  telemetry: {
11
30
  includeRawPrompts: false,
12
31
  },
@@ -401,4 +420,103 @@ export const runtimeSecondaryConfigSettings = [
401
420
  'Set to true ONLY for debugging in non-production environments — raw prompts may contain PII, secrets, or proprietary data. ' +
402
421
  'When true at startup, a WARN log is emitted to make the configuration visible to ops.',
403
422
  },
423
+ {
424
+ key: 'batch.mode',
425
+ type: 'enum',
426
+ default: 'off',
427
+ description: 'Daemon provider Batch API mode: off, explicit per request, or eligible-by-default for batch-capable daemon requests',
428
+ enumValues: ['off', 'explicit', 'eligible-by-default'],
429
+ },
430
+ {
431
+ key: 'batch.fallback',
432
+ type: 'enum',
433
+ default: 'live',
434
+ description: 'Fallback behavior when a batch-requested job is not eligible: live allows callers to choose live execution, fail rejects the batch job',
435
+ enumValues: ['live', 'fail'],
436
+ },
437
+ {
438
+ key: 'batch.queueBackend',
439
+ type: 'enum',
440
+ default: 'local',
441
+ description: 'Queue backend for daemon batch signals. local stores jobs under the daemon config directory; cloudflare requires cloudflare.enabled.',
442
+ enumValues: ['local', 'cloudflare'],
443
+ },
444
+ {
445
+ key: 'batch.tickIntervalMs',
446
+ type: 'number',
447
+ default: 60_000,
448
+ description: 'Daemon-local batch scheduler tick interval in milliseconds',
449
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 5_000 && v <= 60 * 60 * 1000,
450
+ },
451
+ {
452
+ key: 'batch.maxDelayMs',
453
+ type: 'number',
454
+ default: 5 * 60 * 1000,
455
+ description: 'Maximum time a queued local batch job should wait before the daemon submits its provider batch',
456
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0 && v <= 24 * 60 * 60 * 1000,
457
+ },
458
+ {
459
+ key: 'batch.maxJobsPerProviderBatch',
460
+ type: 'number',
461
+ default: 100,
462
+ description: 'Maximum SDK jobs grouped into a single upstream provider batch submission',
463
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 1 && v <= 100_000,
464
+ },
465
+ {
466
+ key: 'batch.maxQueuePayloadBytes',
467
+ type: 'number',
468
+ default: 16 * 1024,
469
+ description: 'Recommended maximum Cloudflare queue message payload size; queue messages should be signals, not full prompt archives',
470
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 1024 && v <= 128 * 1024,
471
+ },
472
+ {
473
+ key: 'batch.maxQueueMessagesPerDay',
474
+ type: 'number',
475
+ default: 1_000,
476
+ description: 'SDK-side free-tier guardrail for Cloudflare queue message volume',
477
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0 && v <= 10_000_000,
478
+ },
479
+ {
480
+ key: 'cloudflare.enabled',
481
+ type: 'boolean',
482
+ default: false,
483
+ description: 'Enable optional Cloudflare Worker/Queue integration points. The daemon does not require Cloudflare when this is false.',
484
+ },
485
+ {
486
+ key: 'cloudflare.freeTierMode',
487
+ type: 'boolean',
488
+ default: true,
489
+ description: 'Prefer Cloudflare usage patterns that fit the free tier: small queue signals, local daemon storage, and bounded daily queue volume',
490
+ },
491
+ {
492
+ key: 'cloudflare.workerBaseUrl',
493
+ type: 'string',
494
+ default: '',
495
+ description: 'Optional deployed GoodVibes Cloudflare Worker base URL used by clients that proxy batch signals through Workers',
496
+ },
497
+ {
498
+ key: 'cloudflare.workerTokenRef',
499
+ type: 'string',
500
+ default: '',
501
+ description: 'Optional GoodVibes secret reference for the Worker-to-daemon bearer token',
502
+ },
503
+ {
504
+ key: 'cloudflare.queueName',
505
+ type: 'string',
506
+ default: 'goodvibes-batch',
507
+ description: 'Cloudflare Queue binding/name for GoodVibes batch job signals',
508
+ },
509
+ {
510
+ key: 'cloudflare.deadLetterQueueName',
511
+ type: 'string',
512
+ default: 'goodvibes-batch-dlq',
513
+ description: 'Cloudflare dead-letter queue binding/name for failed GoodVibes batch job signals',
514
+ },
515
+ {
516
+ key: 'cloudflare.maxQueueOpsPerDay',
517
+ type: 'number',
518
+ default: 10_000,
519
+ description: 'Free-tier queue operation budget used by clients to warn before Cloudflare queue usage exceeds the intended budget',
520
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0 && v <= 10_000_000,
521
+ },
404
522
  ];