@pingagent/sdk 0.1.15 → 0.1.16

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/bin/pingagent.js CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  TrustPolicyAuditManager,
27
27
  CollaborationEventManager,
28
28
  CollaborationProjectionOutboxManager,
29
+ NotificationIntentManager,
29
30
  OperatorSeenStateManager,
30
31
  TrustRecommendationManager,
31
32
  getTrustRecommendationActionLabel,
@@ -37,6 +38,8 @@ import {
37
38
  buildDeliveryTimeline,
38
39
  buildProjectionPreview,
39
40
  listPendingDecisionViews,
41
+ summarizeHumanDelivery,
42
+ listRecentBindingsForSession,
40
43
  deriveTransportHealth,
41
44
  readTransportPreference,
42
45
  switchTransportPreference,
@@ -453,6 +456,13 @@ function buildHostState(identityPath, selectedSessionKey = null, historyPageInde
453
456
  const selectedProjectionPreview = selectedSession
454
457
  ? buildProjectionPreview(store, selectedSession.session_key, policy.doc.collaboration_projection?.preset || 'balanced', 5)
455
458
  : null;
459
+ const humanDelivery = summarizeHumanDelivery(store, 20);
460
+ const selectedRecentBindings = selectedSession
461
+ ? listRecentBindingsForSession(store, selectedSession.session_key, selectedSession.conversation_id, 12)
462
+ : [];
463
+ const selectedRecentNotificationIntents = selectedSession
464
+ ? new NotificationIntentManager(store).listBySession(selectedSession.session_key, 12)
465
+ : [];
456
466
  return {
457
467
  identity,
458
468
  runtimeMode,
@@ -466,6 +476,7 @@ function buildHostState(identityPath, selectedSessionKey = null, historyPageInde
466
476
  policyPath: policy.path,
467
477
  policyDoc: policy.doc,
468
478
  projectionPreset: policy.doc.collaboration_projection?.preset || 'balanced',
479
+ humanDelivery,
469
480
  sinceLastSeenGlobal,
470
481
  sessions: sessionsWithSeen,
471
482
  tasks: taskManager.listRecent(30).map((task) => ({
@@ -482,6 +493,8 @@ function buildHostState(identityPath, selectedSessionKey = null, historyPageInde
482
493
  selectedPendingCollaborationEvents,
483
494
  selectedDeliveryTimeline,
484
495
  selectedProjectionPreview,
496
+ selectedRecentBindings,
497
+ selectedRecentNotificationIntents,
485
498
  pendingCollaborationEventsGlobal,
486
499
  selectedMessages,
487
500
  selectedHistoryPage,
@@ -508,6 +521,8 @@ function renderHostTuiScreen(hostState, uiState) {
508
521
  const messages = hostState.selectedMessages || [];
509
522
  const deliveryTimeline = hostState.selectedDeliveryTimeline || [];
510
523
  const projectionPreview = hostState.selectedProjectionPreview || null;
524
+ const recentBindings = hostState.selectedRecentBindings || [];
525
+ const recentNotificationIntents = hostState.selectedRecentNotificationIntents || [];
511
526
  const recommendations = hostState.selectedRecommendations || [];
512
527
  const openRecommendation = recommendations.find((item) => item.status === 'open') || null;
513
528
  const reopenRecommendation = recommendations.find((item) => item.status === 'dismissed' || item.status === 'superseded') || null;
@@ -528,6 +543,19 @@ function renderHostTuiScreen(hostState, uiState) {
528
543
  || !!hostState.ingressRuntime.hooks_last_error;
529
544
  const ingressLabel = degraded ? 'Degraded' : 'Ready';
530
545
  const transportHealth = hostState.transportHealth || { state: 'Ready', transport_mode: 'bridge', preferred_transport_mode: 'bridge', retry_queue_length: 0, consecutive_failures: 0 };
546
+ const humanDelivery = hostState.humanDelivery || {
547
+ mode: 'projection_outbox',
548
+ active_bindings: 0,
549
+ pending_intents: 0,
550
+ unresolved_intents: 0,
551
+ failed_intents: 0,
552
+ acknowledged_intents: 0,
553
+ channel_capabilities: [],
554
+ supported_channels: [],
555
+ unsupported_channels: [],
556
+ last_canary_ok: null,
557
+ last_canary_at: null,
558
+ };
531
559
  const sinceLastSeenGlobal = hostState.sinceLastSeenGlobal || {};
532
560
  const lines = [
533
561
  'PingAgent Host TUI',
@@ -536,6 +564,8 @@ function renderHostTuiScreen(hostState, uiState) {
536
564
  `runtime_mode=${hostState.runtimeMode} receive_mode=${hostState.ingressRuntime?.receive_mode || 'webhook'} current_openclaw_chat=${hostState.activeChatSession || '(none)'}`,
537
565
  `ingress=${ingressLabel}${degraded ? ' action=[f] fix-now' : ''}`,
538
566
  `transport=${transportHealth.transport_mode} preferred=${transportHealth.preferred_transport_mode} state=${transportHealth.state} retry_queue=${transportHealth.retry_queue_length} failures=${transportHealth.consecutive_failures}`,
567
+ `human_delivery mode=${humanDelivery.mode || 'projection_outbox'} active_bindings=${humanDelivery.active_bindings ?? 0} pending=${humanDelivery.pending_intents ?? 0} unresolved=${humanDelivery.unresolved_intents ?? 0} failed=${humanDelivery.failed_intents ?? 0} acked=${humanDelivery.acknowledged_intents ?? 0}`,
568
+ `human_delivery_channels supported=${(humanDelivery.supported_channels || []).join(',') || '(none)'} unsupported=${(humanDelivery.unsupported_channels || []).join(',') || '(none)'} canary_ok=${typeof humanDelivery.last_canary_ok === 'boolean' ? String(humanDelivery.last_canary_ok) : '(unknown)'} at=${humanDelivery.last_canary_at || '(none)'}`,
539
569
  uiState?.publicLinkUrl ? `public_link=${uiState.publicLinkUrl}` : null,
540
570
  `sessions=${sessions.length} unread_total=${hostState.unreadTotal ?? 0} alert_sessions=${hostState.alertSessions ?? 0} view=${view} projection=${hostState.projectionPreset || 'balanced'}`,
541
571
  `since_last_seen external=${sinceLastSeenGlobal.new_external_messages ?? 0} conclusions=${sinceLastSeenGlobal.new_conclusions ?? 0} decisions=${sinceLastSeenGlobal.new_decisions ?? 0} failures=${sinceLastSeenGlobal.new_failures ?? 0}`,
@@ -770,6 +800,21 @@ function renderHostTuiScreen(hostState, uiState) {
770
800
  lines.push(...(deliveryTimeline.length
771
801
  ? deliveryTimeline.slice(0, 10).map((entry) => `- ${formatTs(entry.ts_ms, false)} ${entry.kind} ${truncateLine(entry.summary || '', 72)}`)
772
802
  : ['- none']));
803
+ lines.push('');
804
+ lines.push('Human Reply Targets');
805
+ lines.push(...(recentBindings.length
806
+ ? recentBindings.slice(0, 6).map((binding) => `- ${binding.channel} -> ${truncateLine(binding.to || '(none)', 48)} [${binding.status}] owner=${truncateLine(binding.owner_ref || '(none)', 32)}`)
807
+ : ['- none']));
808
+ lines.push('');
809
+ lines.push('Notification Intents');
810
+ lines.push(...(recentNotificationIntents.length
811
+ ? recentNotificationIntents.slice(0, 6).map((intent) => `- ${intent.intent_type} [${intent.status}] ${truncateLine(intent.summary || '', 72)}${intent.acknowledged_at ? ` ack=${formatTs(intent.acknowledged_at, false)}` : ''}`)
812
+ : ['- none']));
813
+ lines.push('');
814
+ lines.push('Channel Capability Canary');
815
+ lines.push(...((humanDelivery.channel_capabilities || []).length
816
+ ? humanDelivery.channel_capabilities.slice(0, 8).map((capability) => `- ${capability.channel} configured=${capability.configured ? 'true' : 'false'} explicit_send=${capability.supports_explicit_send ? 'true' : 'false'} dry_run=${capability.supports_dry_run ? 'true' : 'false'} canary=${typeof capability.last_canary_ok === 'boolean' ? String(capability.last_canary_ok) : '(unknown)'}`)
817
+ : ['- none']));
773
818
  }
774
819
  lines.push('');
775
820
  lines.push('Audit');