@pingagent/sdk 0.1.17 → 0.1.19

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
@@ -40,6 +40,8 @@ import {
40
40
  listPendingDecisionViews,
41
41
  summarizeHumanDelivery,
42
42
  listRecentBindingsForSession,
43
+ buildActionInboxSummary,
44
+ OpenClawExecutionAdapter,
43
45
  deriveOpenClawAgentState,
44
46
  deriveTransportHealth,
45
47
  readTransportPreference,
@@ -123,9 +125,9 @@ function formatRetentionLabel(ttlMs) {
123
125
 
124
126
  function describeHostedTier(tier) {
125
127
  if (tier === 'plus') return 'shareable identity + first alias + higher relay';
126
- if (tier === 'pro') return 'multi-identity communication + audit export';
128
+ if (tier === 'pro') return 'multi-identity escalation + callback governance + audit export';
127
129
  if (tier === 'enterprise') return 'high-scale governance + operational controls';
128
- return 'free communication-first entry tier';
130
+ return 'free escalation-first entry tier';
129
131
  }
130
132
 
131
133
  function openStore(identityPath) {
@@ -472,6 +474,15 @@ function buildHostState(identityPath, selectedSessionKey = null, historyPageInde
472
474
  const selectedRecentNotificationIntents = selectedSession
473
475
  ? new NotificationIntentManager(store).listBySession(selectedSession.session_key, 12)
474
476
  : [];
477
+ const openClawAdapter = new OpenClawExecutionAdapter(store).buildOverview(20);
478
+ const actionInbox = buildActionInboxSummary({
479
+ pending_decisions: pendingCollaborationEventsGlobal,
480
+ notification_intents: new NotificationIntentManager(store).listRecent(20),
481
+ external_escalations: openClawAdapter.recent_escalations,
482
+ agent_state: agentState,
483
+ include_runtime: true,
484
+ limit: 20,
485
+ });
475
486
  return {
476
487
  identity,
477
488
  runtimeMode,
@@ -487,6 +498,8 @@ function buildHostState(identityPath, selectedSessionKey = null, historyPageInde
487
498
  policyDoc: policy.doc,
488
499
  projectionPreset: policy.doc.collaboration_projection?.preset || 'balanced',
489
500
  humanDelivery,
501
+ actionInbox,
502
+ openClawAdapter,
490
503
  sinceLastSeenGlobal,
491
504
  sessions: sessionsWithSeen,
492
505
  tasks: taskManager.listRecent(30).map((task) => ({
@@ -570,7 +583,19 @@ function renderHostTuiScreen(hostState, uiState) {
570
583
  state: 'activating',
571
584
  summary: 'Activation is still in progress.',
572
585
  next_action: 'Wait for activation to finish.',
573
- reason: null,
586
+ reason: null,
587
+ };
588
+ const actionInbox = hostState.actionInbox || {
589
+ total: 0,
590
+ pending_approval: 0,
591
+ pending_callback: 0,
592
+ pending_escalation: 0,
593
+ blocked: 0,
594
+ degraded: 0,
595
+ timed_out: 0,
596
+ high_risk: 0,
597
+ critical_risk: 0,
598
+ items: [],
574
599
  };
575
600
  const sinceLastSeenGlobal = hostState.sinceLastSeenGlobal || {};
576
601
  const lines = [
@@ -583,6 +608,7 @@ function renderHostTuiScreen(hostState, uiState) {
583
608
  `ingress=${ingressLabel}${degraded ? ' action=[f] fix-now' : ''}`,
584
609
  `transport=${transportHealth.transport_mode} preferred=${transportHealth.preferred_transport_mode} state=${transportHealth.state} retry_queue=${transportHealth.retry_queue_length} failures=${transportHealth.consecutive_failures}`,
585
610
  `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}`,
611
+ `action_inbox total=${actionInbox.total} approvals=${actionInbox.pending_approval} callbacks=${actionInbox.pending_callback} escalations=${actionInbox.pending_escalation} blocked=${actionInbox.blocked} timed_out=${actionInbox.timed_out} degraded=${actionInbox.degraded}`,
586
612
  `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)'}`,
587
613
  uiState?.publicLinkUrl ? `public_link=${uiState.publicLinkUrl}` : null,
588
614
  `sessions=${sessions.length} unread_total=${hostState.unreadTotal ?? 0} repair_alert_sessions=${hostState.alertSessions ?? 0} view=${view} projection=${hostState.projectionPreset || 'balanced'}`,
@@ -603,7 +629,7 @@ function renderHostTuiScreen(hostState, uiState) {
603
629
  lines.push('- a: approve selected pending contact');
604
630
  lines.push('- m: mark selected session as read');
605
631
  lines.push('- t: open task list view for selected session');
606
- lines.push('- i: open global decision inbox');
632
+ lines.push('- i: open Action Inbox approval slice');
607
633
  lines.push('- x: cancel selected task (in task views)');
608
634
  lines.push('- p: multiline reply prompt (detail view)');
609
635
  lines.push('- S: edit carry-forward summary (detail view)');
@@ -677,8 +703,8 @@ function renderHostTuiScreen(hostState, uiState) {
677
703
  lines.push(...tasks.map((task, idx) => `${idx === selectedTaskIndex ? '>' : ' '} ${task.task_id} [${task.status}] ${truncateLine(task.title || task.result_summary || '', 70)}`));
678
704
  }
679
705
  } else if (view === 'decisions') {
680
- lines.push('Decision Inbox');
681
- lines.push(`pending=${pendingCollaborationEventsGlobal.length}`);
706
+ lines.push('Action Inbox (approval-only slice)');
707
+ lines.push(`pending_approvals=${pendingCollaborationEventsGlobal.length} action_inbox_total=${actionInbox.total}`);
682
708
  lines.push('actions=[u] approve [U] reject [Enter/l] open-session [j/k] select [h/Esc] back');
683
709
  lines.push('');
684
710
  lines.push(...(pendingCollaborationEventsGlobal.length
@@ -747,12 +773,13 @@ function renderHostTuiScreen(hostState, uiState) {
747
773
  lines.push('summary_objective=(none)');
748
774
  }
749
775
  if (pendingCollaborationEvents.length > 0) {
750
- lines.push(`pending_collaboration_decisions=${pendingCollaborationEvents.length}`);
751
- lines.push(`next_decision=${truncateLine(pendingCollaborationEvents[0].summary || '(none)', 100)}`);
776
+ lines.push(`action_inbox_pending_approvals=${pendingCollaborationEvents.length}`);
777
+ lines.push(`next_approval=${truncateLine(pendingCollaborationEvents[0].summary || '(none)', 100)}`);
752
778
  if (pendingCollaborationEvents[0].overdue) {
753
- lines.push(`next_decision_overdue=${Math.ceil((pendingCollaborationEvents[0].overdue_by_ms || 0) / 60000)}m`);
779
+ lines.push(`next_approval_overdue=${Math.ceil((pendingCollaborationEvents[0].overdue_by_ms || 0) / 60000)}m`);
754
780
  }
755
781
  }
782
+ lines.push(`action_inbox_total=${actionInbox.total} callbacks=${actionInbox.pending_callback} escalations=${actionInbox.pending_escalation} blocked=${actionInbox.blocked} timed_out=${actionInbox.timed_out}`);
756
783
  const sessionSeen = selected.since_last_seen || {};
757
784
  lines.push(`since_last_seen external=${sessionSeen.new_external_messages ?? 0} conclusions=${sessionSeen.new_conclusions ?? 0} decisions=${sessionSeen.new_decisions ?? 0} failures=${sessionSeen.new_failures ?? 0}`);
758
785
  const actionBar = [
@@ -763,8 +790,8 @@ function renderHostTuiScreen(hostState, uiState) {
763
790
  '[m] mark-read',
764
791
  '[p] reply',
765
792
  '[S] summary',
766
- pendingCollaborationEvents.length ? '[u] approve-decision' : null,
767
- pendingCollaborationEvents.length ? '[U] reject-decision' : null,
793
+ pendingCollaborationEvents.length ? '[u] approve-action' : null,
794
+ pendingCollaborationEvents.length ? '[U] reject-action' : null,
768
795
  '[o] history',
769
796
  '[t] tasks',
770
797
  ].filter(Boolean).join(' ');
@@ -840,7 +867,7 @@ function renderHostTuiScreen(hostState, uiState) {
840
867
  }
841
868
 
842
869
  lines.push('');
843
- lines.push('Keys: ↑/↓ or j/k select Enter/l open Esc/h back g/G jump r refresh a approve u/U decide A apply-rec D dismiss-rec R reopen-rec m read p reply o history s search t tasks x cancel-task y dump f fix-hooks b transport->bridge c transport->channel ? help q quit');
870
+ lines.push('Keys: ↑/↓ or j/k select Enter/l open Esc/h back g/G jump r refresh a approve u/U resolve-approval A apply-rec D dismiss-rec R reopen-rec m read p reply o history s search t tasks x cancel-task y dump f fix-hooks b transport->bridge c transport->channel ? help q quit');
844
871
  return lines.join('\n');
845
872
  }
846
873
 
@@ -1351,7 +1378,7 @@ async function runHostTui(identityPath, opts) {
1351
1378
  if (key?.name === 'i') {
1352
1379
  uiState.view = 'decisions';
1353
1380
  uiState.selectedDecisionIndex = 0;
1354
- setStatus('Opened decision inbox.', 'info');
1381
+ setStatus('Opened the Action Inbox approval slice.', 'info');
1355
1382
  latestState = redraw();
1356
1383
  latestState = rerenderAfterSeenUpdate(latestState, { forceGlobal: true });
1357
1384
  return;