@pingagent/sdk 0.1.16 → 0.1.17

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/dist/index.d.ts CHANGED
@@ -1726,6 +1726,33 @@ declare function clearSessionBindingAlert(conversationId: string, filePath?: str
1726
1726
  removed: boolean;
1727
1727
  };
1728
1728
 
1729
+ type OpenClawAgentLifecycleState = 'activating' | 'ready_waiting_inbound' | 'active_session' | 'decision_pending' | 'human_delivery_pending' | 'human_delivery_acknowledged' | 'degraded' | 'blocked';
1730
+ interface OpenClawAgentState {
1731
+ state: OpenClawAgentLifecycleState;
1732
+ summary: string;
1733
+ reason?: string | null;
1734
+ next_action: string;
1735
+ active_session_key?: string | null;
1736
+ pending_decisions: number;
1737
+ human_delivery_pending: number;
1738
+ human_delivery_unresolved: number;
1739
+ human_delivery_failed: number;
1740
+ human_delivery_acknowledged: number;
1741
+ blocked: boolean;
1742
+ degraded: boolean;
1743
+ }
1744
+ interface DeriveOpenClawAgentStateInput {
1745
+ runtime_status?: OpenClawIngressRuntimeStatus | null;
1746
+ sessions?: Array<Pick<SessionState, 'session_key' | 'active' | 'unread_count'>>;
1747
+ pending_decisions?: number;
1748
+ human_delivery?: Pick<HumanDeliverySummary, 'pending_intents' | 'unresolved_intents' | 'failed_intents' | 'acknowledged_intents'> | null;
1749
+ transport_health?: Pick<TransportHealth, 'state' | 'last_error'> | null;
1750
+ blocked_reason?: string | null;
1751
+ }
1752
+ declare function describeOpenClawAgentState(state: OpenClawAgentLifecycleState): string;
1753
+ declare function nextActionForOpenClawAgentState(state: OpenClawAgentLifecycleState): string;
1754
+ declare function deriveOpenClawAgentState(input: DeriveOpenClawAgentStateInput): OpenClawAgentState;
1755
+
1729
1756
  interface OpenClawDeliveryContext {
1730
1757
  channel?: string;
1731
1758
  to?: string;
@@ -1761,4 +1788,4 @@ declare function getOpenClawSessionEntry(sessionKey: string, filePath?: string):
1761
1788
  declare function deriveOwnerRefFromOpenClawSessionEntry(entry: OpenClawSessionEntryRecord): string | undefined;
1762
1789
  declare function buildHumanDeliveryBindingCandidate(sessionKey: string, filePath?: string): OpenClawHumanDeliveryBindingCandidate | null;
1763
1790
 
1764
- export { A2AAdapter, type A2AAdapterOptions, type A2ATaskResult, type AgentEncryptionCard, type AgentProfile, type CapabilityCard, type CapabilityCardItem, type CapabilityContactMode, type ClientOptions, type CollaborationApprovalStatus, type CollaborationDecisionView, type CollaborationEvent, type CollaborationEventInput, CollaborationEventManager, type CollaborationEventSeverity, type CollaborationEventSummary, type CollaborationEventType, type CollaborationProjectionKind, type CollaborationProjectionOutboxEntry, type CollaborationProjectionOutboxInput, CollaborationProjectionOutboxManager, type CollaborationProjectionOutboxStatus, type CollaborationProjectionPreset, type Contact, type ContactCardShare, ContactManager, type ContactPolicyAction, type ContactPolicyDecision, type ConversationEntry, type ConversationListResponse, type DeliveryTimelineEntry, type DirectoryBrowseResponse, type DirectorySelfResponse, type EncryptedPayloadWrapper, type EncryptionIdentityFields, type EncryptionPrivateKeyJwk, type EncryptionPublicKeyJwk, type FeedByDidResponse, type FeedPost, type FeedPublicResponse, type FetchResponse, HUMAN_DELIVERY_CHANNELS, HistoryManager, HttpTransport, type HumanDeliveryBinding, type HumanDeliveryBindingInput, HumanDeliveryBindingManager, type HumanDeliveryBindingStatus, type HumanDeliveryChannel, type HumanDeliveryChannelCapability, type HumanDeliverySummary, LocalStore, type ManagedTransportSwitchResult, type MarkOperatorSeenInput, type NotificationIntent, type NotificationIntentBindingScope, type NotificationIntentInput, NotificationIntentManager, type NotificationIntentStatus, type NotificationIntentType, type NotificationOverride, type OpenClawDeliveryContext, type OpenClawHumanDeliveryBindingCandidate, type OpenClawIngressRuntimeStatus, type OpenClawSessionEntryRecord, type OpenClawTransportMode, type OperatorSeenState, OperatorSeenStateManager, type OperatorSeenStateOperatorId, type OperatorSeenStateScopeType, PingAgentClient, type ProjectionDisposition, type ProjectionDispositionInput, type ProjectionDispositionResult, type ProjectionPreviewEntry, type PublicAgentProfile, type PublicLinkState, type RecommendationSummary, type ReplyTarget, type ResolveCollaborationApprovalInput, type ResolveCollaborationApprovalResult, type ResolveHumanDeliveryBindingInput, type ResolveHumanDeliveryBindingResult, type RuntimeMode, SESSION_SUMMARY_FIELDS, type SendResponse, type SessionBindingAlert, type SessionBindingEntry, SessionManager, type SessionMessageInput, type SessionState, type SessionSummary, type SessionSummaryFieldKey, SessionSummaryManager, type SessionSummaryUpsert, type SinceLastSeenSummary, type StoredMessage, type StoredTrustRecommendation, type SubscriptionResponse, type SubscriptionUsage, type SyncTrustRecommendationsInput, type TaskHandoff, TaskHandoffManager, type TaskHandoffPayload, type TaskHandoffUpsert, type TaskPolicyAction, type TaskPolicyDecision, type TaskResult, type TaskShareEntry, type TaskThread, TaskThreadManager, type TaskThreadStatus, type TaskThreadUpsert, type TransportHealth, type TransportHealthState, type TransportOptions, type TransportPreferenceState, type TrustPolicyAuditEvent, type TrustPolicyAuditEventType, type TrustPolicyAuditInput, TrustPolicyAuditManager, type TrustPolicyAuditSummary, type TrustPolicyContext, type TrustPolicyDoc, type TrustPolicyLearningSummary, type TrustPolicyRecommendation, TrustRecommendationManager, type TrustRecommendationStatus, type TrustState, type UpdateProfileInput, type UserWakeEvent, UserWakeSubscription, type UserWakeSubscriptionOptions, WsSubscription, type WsSubscriptionOptions, buildDecisionReminderOutboxMessage, buildDeliveryTimeline, buildHumanDeliveryBindingCandidate, buildHumanDeliveryPayload, buildNotificationIntentInputFromProjectionOutbox, buildProjectionPreview, buildSessionKey, buildSessionSummaryHandoffText, buildTrustPolicyRecommendations, capabilityCardToLegacyCapabilities, clearSessionBindingAlert, decideContactPolicy, decideTaskPolicy, decryptPayloadForIdentity, defaultTrustPolicyDoc, deriveOwnerRefFromOpenClawSessionEntry, deriveTransportHealth, describeProjectionPreset, encryptPayloadForRecipients, ensureIdentityEncryptionKeys, ensureTokenValid, formatCapabilityCardSummary, generateIdentity, getActiveSessionFilePath, getIdentityPath, getIngressRuntimeStatusFilePath, getOpenClawConfigFilePath, getOpenClawSessionEntry, getOpenClawSessionStorePath, getProfile, getProjectedEventTypes, getProjectionDisposition, getRootDir, getSessionBindingAlertsFilePath, getSessionMapFilePath, getStorePath, getTransportPreferenceFilePath, getTrustRecommendationActionLabel, hasDecisionPromptOutbox, identityExists, isEncryptedPayload, listOpenClawSessionEntries, listPendingDecisionViews, listRecentBindingsForSession, loadIdentity, matchesTrustPolicyRule, normalizeCapabilityCard, normalizeTransportMode, normalizeTrustPolicyDoc, parseNotificationOverride, previewFromPayload, readCurrentActiveSessionKey, readIngressRuntimeStatus, readSessionBindingAlerts, readSessionBindings, readTransportPreference, removeSessionBinding, resolveHumanDeliveryBinding, saveIdentity, setSessionBinding, shouldEncryptConversationPayload, summarizeHumanDelivery, summarizeSinceLastSeen, summarizeTrustPolicyAudit, switchTransportPreference, updateStoredToken, upsertSessionBindingAlert, upsertTrustPolicyRecommendation, writeSessionBindingAlerts, writeSessionBindings, writeTransportPreference };
1791
+ export { A2AAdapter, type A2AAdapterOptions, type A2ATaskResult, type AgentEncryptionCard, type AgentProfile, type CapabilityCard, type CapabilityCardItem, type CapabilityContactMode, type ClientOptions, type CollaborationApprovalStatus, type CollaborationDecisionView, type CollaborationEvent, type CollaborationEventInput, CollaborationEventManager, type CollaborationEventSeverity, type CollaborationEventSummary, type CollaborationEventType, type CollaborationProjectionKind, type CollaborationProjectionOutboxEntry, type CollaborationProjectionOutboxInput, CollaborationProjectionOutboxManager, type CollaborationProjectionOutboxStatus, type CollaborationProjectionPreset, type Contact, type ContactCardShare, ContactManager, type ContactPolicyAction, type ContactPolicyDecision, type ConversationEntry, type ConversationListResponse, type DeliveryTimelineEntry, type DeriveOpenClawAgentStateInput, type DirectoryBrowseResponse, type DirectorySelfResponse, type EncryptedPayloadWrapper, type EncryptionIdentityFields, type EncryptionPrivateKeyJwk, type EncryptionPublicKeyJwk, type FeedByDidResponse, type FeedPost, type FeedPublicResponse, type FetchResponse, HUMAN_DELIVERY_CHANNELS, HistoryManager, HttpTransport, type HumanDeliveryBinding, type HumanDeliveryBindingInput, HumanDeliveryBindingManager, type HumanDeliveryBindingStatus, type HumanDeliveryChannel, type HumanDeliveryChannelCapability, type HumanDeliverySummary, LocalStore, type ManagedTransportSwitchResult, type MarkOperatorSeenInput, type NotificationIntent, type NotificationIntentBindingScope, type NotificationIntentInput, NotificationIntentManager, type NotificationIntentStatus, type NotificationIntentType, type NotificationOverride, type OpenClawAgentLifecycleState, type OpenClawAgentState, type OpenClawDeliveryContext, type OpenClawHumanDeliveryBindingCandidate, type OpenClawIngressRuntimeStatus, type OpenClawSessionEntryRecord, type OpenClawTransportMode, type OperatorSeenState, OperatorSeenStateManager, type OperatorSeenStateOperatorId, type OperatorSeenStateScopeType, PingAgentClient, type ProjectionDisposition, type ProjectionDispositionInput, type ProjectionDispositionResult, type ProjectionPreviewEntry, type PublicAgentProfile, type PublicLinkState, type RecommendationSummary, type ReplyTarget, type ResolveCollaborationApprovalInput, type ResolveCollaborationApprovalResult, type ResolveHumanDeliveryBindingInput, type ResolveHumanDeliveryBindingResult, type RuntimeMode, SESSION_SUMMARY_FIELDS, type SendResponse, type SessionBindingAlert, type SessionBindingEntry, SessionManager, type SessionMessageInput, type SessionState, type SessionSummary, type SessionSummaryFieldKey, SessionSummaryManager, type SessionSummaryUpsert, type SinceLastSeenSummary, type StoredMessage, type StoredTrustRecommendation, type SubscriptionResponse, type SubscriptionUsage, type SyncTrustRecommendationsInput, type TaskHandoff, TaskHandoffManager, type TaskHandoffPayload, type TaskHandoffUpsert, type TaskPolicyAction, type TaskPolicyDecision, type TaskResult, type TaskShareEntry, type TaskThread, TaskThreadManager, type TaskThreadStatus, type TaskThreadUpsert, type TransportHealth, type TransportHealthState, type TransportOptions, type TransportPreferenceState, type TrustPolicyAuditEvent, type TrustPolicyAuditEventType, type TrustPolicyAuditInput, TrustPolicyAuditManager, type TrustPolicyAuditSummary, type TrustPolicyContext, type TrustPolicyDoc, type TrustPolicyLearningSummary, type TrustPolicyRecommendation, TrustRecommendationManager, type TrustRecommendationStatus, type TrustState, type UpdateProfileInput, type UserWakeEvent, UserWakeSubscription, type UserWakeSubscriptionOptions, WsSubscription, type WsSubscriptionOptions, buildDecisionReminderOutboxMessage, buildDeliveryTimeline, buildHumanDeliveryBindingCandidate, buildHumanDeliveryPayload, buildNotificationIntentInputFromProjectionOutbox, buildProjectionPreview, buildSessionKey, buildSessionSummaryHandoffText, buildTrustPolicyRecommendations, capabilityCardToLegacyCapabilities, clearSessionBindingAlert, decideContactPolicy, decideTaskPolicy, decryptPayloadForIdentity, defaultTrustPolicyDoc, deriveOpenClawAgentState, deriveOwnerRefFromOpenClawSessionEntry, deriveTransportHealth, describeOpenClawAgentState, describeProjectionPreset, encryptPayloadForRecipients, ensureIdentityEncryptionKeys, ensureTokenValid, formatCapabilityCardSummary, generateIdentity, getActiveSessionFilePath, getIdentityPath, getIngressRuntimeStatusFilePath, getOpenClawConfigFilePath, getOpenClawSessionEntry, getOpenClawSessionStorePath, getProfile, getProjectedEventTypes, getProjectionDisposition, getRootDir, getSessionBindingAlertsFilePath, getSessionMapFilePath, getStorePath, getTransportPreferenceFilePath, getTrustRecommendationActionLabel, hasDecisionPromptOutbox, identityExists, isEncryptedPayload, listOpenClawSessionEntries, listPendingDecisionViews, listRecentBindingsForSession, loadIdentity, matchesTrustPolicyRule, nextActionForOpenClawAgentState, normalizeCapabilityCard, normalizeTransportMode, normalizeTrustPolicyDoc, parseNotificationOverride, previewFromPayload, readCurrentActiveSessionKey, readIngressRuntimeStatus, readSessionBindingAlerts, readSessionBindings, readTransportPreference, removeSessionBinding, resolveHumanDeliveryBinding, saveIdentity, setSessionBinding, shouldEncryptConversationPayload, summarizeHumanDelivery, summarizeSinceLastSeen, summarizeTrustPolicyAudit, switchTransportPreference, updateStoredToken, upsertSessionBindingAlert, upsertTrustPolicyRecommendation, writeSessionBindingAlerts, writeSessionBindings, writeTransportPreference };
package/dist/index.js CHANGED
@@ -35,8 +35,10 @@ import {
35
35
  decideTaskPolicy,
36
36
  decryptPayloadForIdentity,
37
37
  defaultTrustPolicyDoc,
38
+ deriveOpenClawAgentState,
38
39
  deriveOwnerRefFromOpenClawSessionEntry,
39
40
  deriveTransportHealth,
41
+ describeOpenClawAgentState,
40
42
  describeProjectionPreset,
41
43
  encryptPayloadForRecipients,
42
44
  ensureIdentityEncryptionKeys,
@@ -66,6 +68,7 @@ import {
66
68
  listRecentBindingsForSession,
67
69
  loadIdentity,
68
70
  matchesTrustPolicyRule,
71
+ nextActionForOpenClawAgentState,
69
72
  normalizeCapabilityCard,
70
73
  normalizeTransportMode,
71
74
  normalizeTrustPolicyDoc,
@@ -91,7 +94,7 @@ import {
91
94
  writeSessionBindingAlerts,
92
95
  writeSessionBindings,
93
96
  writeTransportPreference
94
- } from "./chunk-GU5W4KRD.js";
97
+ } from "./chunk-IB7OSFZS.js";
95
98
  export {
96
99
  A2AAdapter,
97
100
  CollaborationEventManager,
@@ -129,8 +132,10 @@ export {
129
132
  decideTaskPolicy,
130
133
  decryptPayloadForIdentity,
131
134
  defaultTrustPolicyDoc,
135
+ deriveOpenClawAgentState,
132
136
  deriveOwnerRefFromOpenClawSessionEntry,
133
137
  deriveTransportHealth,
138
+ describeOpenClawAgentState,
134
139
  describeProjectionPreset,
135
140
  encryptPayloadForRecipients,
136
141
  ensureIdentityEncryptionKeys,
@@ -160,6 +165,7 @@ export {
160
165
  listRecentBindingsForSession,
161
166
  loadIdentity,
162
167
  matchesTrustPolicyRule,
168
+ nextActionForOpenClawAgentState,
163
169
  normalizeCapabilityCard,
164
170
  normalizeTransportMode,
165
171
  normalizeTrustPolicyDoc,
@@ -14,6 +14,7 @@ import {
14
14
  decideContactPolicy,
15
15
  decideTaskPolicy,
16
16
  defaultTrustPolicyDoc,
17
+ deriveOpenClawAgentState,
17
18
  deriveTransportHealth,
18
19
  ensureTokenValid,
19
20
  getActiveSessionFilePath,
@@ -37,7 +38,7 @@ import {
37
38
  switchTransportPreference,
38
39
  updateStoredToken,
39
40
  upsertTrustPolicyRecommendation
40
- } from "./chunk-GU5W4KRD.js";
41
+ } from "./chunk-IB7OSFZS.js";
41
42
 
42
43
  // src/web-server.ts
43
44
  import * as fs from "fs";
@@ -263,8 +264,8 @@ function getHostPanelHtml() {
263
264
  <div class="audit-list" id="decisionInboxList"></div>
264
265
  </div>
265
266
  <div class="card">
266
- <h2>Projection Delivery</h2>
267
- <div id="projectionOutboxSummary" class="muted small" style="margin-bottom:12px">Loading projection delivery state\u2026</div>
267
+ <h2>Human Delivery</h2>
268
+ <div id="projectionOutboxSummary" class="muted small" style="margin-bottom:12px">Loading human-delivery state\u2026</div>
268
269
  <div class="audit-list" id="projectionOutboxList"></div>
269
270
  </div>
270
271
  </div>
@@ -281,7 +282,7 @@ function getHostPanelHtml() {
281
282
  <option value="balanced">balanced</option>
282
283
  <option value="strict">strict</option>
283
284
  </select>
284
- <div class="muted small">Balanced is the default: key conclusions, handoffs, repairs, and required decisions are pushed to the human thread; ordinary progress stays summary-first.</div>
285
+ <div class="muted small">Balanced is the default: key conclusions, handoffs, repairs, and required decisions become notification intents and are sent through bound-channel reply; ordinary progress stays summary-first.</div>
285
286
  <div class="row-actions">
286
287
  <button class="action-btn" id="saveProjectionPresetBtn">Save projection preset</button>
287
288
  </div>
@@ -866,7 +867,7 @@ function getHostPanelHtml() {
866
867
  event.approval_required
867
868
  ? '<span class="badge">' + esc(event.approval_status === 'pending' ? 'review' : event.approval_status) + '</span>'
868
869
  : '',
869
- event.target_human_session ? '<span class="badge">human thread</span>' : '',
870
+ event.target_human_session ? '<span class="badge">human delivery</span>' : '',
870
871
  ].filter(Boolean).join('');
871
872
  const actions = event.approval_required && event.approval_status === 'pending'
872
873
  ? '<div class="row-actions" style="margin-top:10px">' +
@@ -927,8 +928,8 @@ function getHostPanelHtml() {
927
928
  document.getElementById('projectionOutboxSummary').textContent = boundChannelReply
928
929
  ? ('bound reply mode \xB7 pending=' + pendingIntents.length + ' \xB7 unresolved=' + unresolvedIntents.length + ' \xB7 failed=' + failedIntents.length)
929
930
  : (combinedOutbox.length
930
- ? 'Human-thread projection uses a stable outbox. Failed rows stay visible until delivery recovers.'
931
- : 'No undelivered human-thread projections.');
931
+ ? 'Legacy projection outbox remains visible for audit and compatibility. Failed rows stay visible until delivery recovers.'
932
+ : 'No legacy projection-outbox rows need attention.');
932
933
  document.getElementById('projectionOutboxList').innerHTML = boundChannelReply
933
934
  ? renderHumanDeliveryIntents(
934
935
  pendingIntents.concat(unresolvedIntents).concat(failedIntents),
@@ -943,7 +944,7 @@ function getHostPanelHtml() {
943
944
  (entry.last_error ? '<div style="margin-top:8px">' + esc(entry.last_error) + '</div>' : '') +
944
945
  '</div>';
945
946
  }).join('')
946
- : '<div class="empty">No pending or failed projection deliveries.</div>');
947
+ : '<div class="empty">No pending or failed legacy projection deliveries.</div>');
947
948
 
948
949
  document.querySelectorAll('.inbox-decision-btn').forEach(function (btn) {
949
950
  btn.addEventListener('click', async function () {
@@ -1008,24 +1009,41 @@ function getHostPanelHtml() {
1008
1009
  if (!overview) return;
1009
1010
  syncSelectedSessionFromOverview();
1010
1011
  const ingressState = ingressStatusModel(overview);
1012
+ const agentState = overview.agentState || null;
1011
1013
  const transportHealth = overview.transportHealth || null;
1012
1014
  const sinceLastSeen = overview.sinceLastSeen || null;
1013
1015
  const humanDelivery = overview.humanDelivery || null;
1014
1016
  const overdueDecisions = Array.isArray(overview.pendingDecisions)
1015
1017
  ? overview.pendingDecisions.filter(function (event) { return !!event.overdue; })
1016
1018
  : [];
1019
+ const statusClass = agentState && (agentState.blocked || agentState.degraded)
1020
+ ? 'degraded'
1021
+ : ingressState.className;
1022
+ const statusLabel = agentState && agentState.state
1023
+ ? agentState.state
1024
+ : ingressState.label;
1025
+ const statusDetail = agentState && agentState.summary
1026
+ ? agentState.summary
1027
+ : ingressState.detail;
1017
1028
  document.getElementById('activationCard').innerHTML =
1018
1029
  '<div class="status-strip">' +
1019
1030
  '<div class="status-main">' +
1020
- '<h2>Activation</h2>' +
1021
- '<div class="status-state ' + ingressState.className + '">' + esc(ingressState.label) + '</div>' +
1022
- '<div class="muted small">' + esc(ingressState.detail) + '</div>' +
1031
+ '<h2>Agent Runtime</h2>' +
1032
+ '<div class="status-state ' + statusClass + '">' + esc(statusLabel) + '</div>' +
1033
+ '<div class="muted small">' + esc(statusDetail) + '</div>' +
1034
+ (agentState && agentState.next_action
1035
+ ? '<div class="muted small">next_action=' + esc(agentState.next_action) + '</div>'
1036
+ : '') +
1037
+ (agentState && agentState.reason
1038
+ ? '<div class="muted small">reason=' + esc(agentState.reason) + '</div>'
1039
+ : '') +
1023
1040
  '<div class="muted small">Public link: ' + esc(overview.publicSelf && overview.publicSelf.public_url ? overview.publicSelf.public_url : '(not ready yet)') + '</div>' +
1024
1041
  '<div class="summary-pills">' +
1025
1042
  '<span class="pill">pending_decisions=' + esc((overview.pendingDecisions || []).length) + '</span>' +
1026
1043
  '<span class="pill">overdue=' + esc(overdueDecisions.length) + '</span>' +
1027
- '<span class="pill">projection=' + esc(overview.collaborationProjection && overview.collaborationProjection.preset ? overview.collaborationProjection.preset : 'balanced') + '</span>' +
1044
+ '<span class="pill">projection_policy=' + esc(overview.collaborationProjection && overview.collaborationProjection.preset ? overview.collaborationProjection.preset : 'balanced') + '</span>' +
1028
1045
  (humanDelivery ? '<span class="pill">human_delivery=' + esc(humanDelivery.mode || 'projection_outbox') + '</span>' : '') +
1046
+ (agentState && agentState.active_session_key ? '<span class="pill">active_session=ready</span>' : '') +
1029
1047
  '</div>' +
1030
1048
  '</div>' +
1031
1049
  '<div style="min-width:320px">' +
@@ -1069,7 +1087,13 @@ function getHostPanelHtml() {
1069
1087
  if (toggleUnreadBtn) toggleUnreadBtn.textContent = 'Unread only: ' + (state.showUnreadOnly ? 'on' : 'off');
1070
1088
  const sessions = getVisibleSessions();
1071
1089
  if (!sessions.length) {
1072
- document.getElementById('sessionList').innerHTML = '<div class="empty">' + (state.showUnreadOnly ? 'No unread sessions.' : 'No sessions yet.') + '</div>';
1090
+ document.getElementById('sessionList').innerHTML = '<div class="empty">' + (
1091
+ state.showUnreadOnly
1092
+ ? 'No unread sessions.'
1093
+ : (agentState && agentState.summary
1094
+ ? agentState.summary + ' Wait for inbound work or review pending decisions.'
1095
+ : 'No sessions yet.')
1096
+ ) + '</div>';
1073
1097
  } else {
1074
1098
  document.getElementById('sessionList').innerHTML = sessions.map(function (session) {
1075
1099
  const active = session.session_key === state.selectedSessionKey ? ' active' : '';
@@ -1079,7 +1103,7 @@ function getHostPanelHtml() {
1079
1103
  ? '<span class="badge alert">new ' + esc(countSinceLastSeen(session.since_last_seen)) + '</span>'
1080
1104
  : ''),
1081
1105
  session.binding_alert
1082
- ? '<button type="button" class="badge alert rebind-badge-btn" data-session="' + esc(session.session_key) + '" data-conversation="' + esc(session.conversation_id || '') + '" data-bound-session="' + esc(session.mapped_work_session || '') + '" data-remote-did="' + esc(session.remote_did || '') + '" title="OpenClaw chat link needs attention">Needs reconnect</button>'
1106
+ ? '<button type="button" class="badge alert rebind-badge-btn" data-session="' + esc(session.session_key) + '" data-conversation="' + esc(session.conversation_id || '') + '" data-bound-session="' + esc(session.mapped_work_session || '') + '" data-remote-did="' + esc(session.remote_did || '') + '" title="Legacy compatibility route needs attention">Compatibility repair</button>'
1083
1107
  : '',
1084
1108
  ].filter(Boolean).join('');
1085
1109
  return '<div class="session-row' + active + '" data-session="' + esc(session.session_key) + '">' +
@@ -1087,7 +1111,7 @@ function getHostPanelHtml() {
1087
1111
  '<div class="muted small">unread=' + esc(session.unread_count) + ' \xB7 last=' + esc(fmtTs(session.last_remote_activity_at || session.updated_at)) + '</div>' +
1088
1112
  (state.detailMode === 'advanced'
1089
1113
  ? '<div class="muted small" style="margin-top:6px">conversation=' + esc(session.conversation_id || '(none)') + '</div>' +
1090
- '<div class="muted small">work_session=' + esc(session.mapped_work_session || '(unbound)') + (session.is_active_work_session ? ' \xB7 active_chat=true' : '') + '</div>'
1114
+ '<div class="muted small">compatibility_route=' + esc(session.mapped_work_session || '(unbound)') + (session.is_active_work_session ? ' \xB7 active_route=true' : '') + '</div>'
1091
1115
  : '') +
1092
1116
  '<div class="muted small" style="margin-top:6px">' + esc(session.last_message_preview || '(no preview)') + '</div>' +
1093
1117
  '</div>';
@@ -1252,8 +1276,8 @@ conversation=' + result.conversation_id));
1252
1276
  if (task && task.action) summaryPills.push('<span class="pill">task=' + esc(task.action) + '</span>');
1253
1277
  if (session.trust_state) summaryPills.push('<span class="pill">trust=' + esc(session.trust_state) + '</span>');
1254
1278
  if (Number(session.unread_count || 0) > 0) summaryPills.push('<span class="pill">unread=' + esc(session.unread_count) + '</span>');
1255
- if (binding && binding.session_key) summaryPills.push('<span class="pill">chat link attached</span>');
1256
- else if (activeWorkSession) summaryPills.push('<span class="pill">current OpenClaw chat available</span>');
1279
+ if (binding && binding.target_key) summaryPills.push('<span class="pill">human reply target ready</span>');
1280
+ if (isAdvanced && activeWorkSession) summaryPills.push('<span class="pill">compatibility route available</span>');
1257
1281
  const policyBlock = isAdvanced
1258
1282
  ? '<pre style="margin-top:8px">[Contact]\\naction=' + esc(contact.action) + '\\nsource=' + esc(contact.source) + (contact.matched_rule ? '\\nmatched_rule=' + esc(contact.matched_rule) : '') + '\\n' + esc(contact.explanation) + '\\n\\n[Task]\\naction=' + esc(task.action) + '\\nsource=' + esc(task.source) + (task.matched_rule ? '\\nmatched_rule=' + esc(task.matched_rule) : '') + '\\n' + esc(task.explanation) + '</pre>'
1259
1283
  : '<div class="summary-pills" style="margin-top:8px">' + summaryPills.join('') + '</div>' +
@@ -1271,8 +1295,8 @@ conversation=' + result.conversation_id));
1271
1295
  ? '<div style="margin-top:8px">' +
1272
1296
  '<div class="muted small">session=' + esc(session.session_key) + '</div>' +
1273
1297
  '<div class="muted small">conversation=' + esc(session.conversation_id || '(none)') + '</div>' +
1274
- '<div class="muted small">active_chat_session=' + esc(activeWorkSession || '(none)') + '</div>' +
1275
- '<div class="muted small">binding=' + esc(binding ? binding.session_key : '(unbound)') + '</div>' +
1298
+ '<div class="muted small">compatibility_active_session=' + esc(activeWorkSession || '(none)') + '</div>' +
1299
+ '<div class="muted small">reply_binding=' + esc(binding ? (binding.target_key || binding.session_key || '(bound)') : '(unbound)') + '</div>' +
1276
1300
  '</div>'
1277
1301
  : '') +
1278
1302
  (openRecommendation
@@ -1280,11 +1304,11 @@ conversation=' + result.conversation_id));
1280
1304
  : (reopenRecommendation ? '<div class="muted small" style="margin-top:8px">trust_action=' + esc(recommendationActionLabel(reopenRecommendation)) + '</div>' : '')) +
1281
1305
  (summaryPills.length ? '<div class="summary-pills">' + summaryPills.join('') + '</div>' : '') +
1282
1306
  (pendingCollaborationEvents.length
1283
- ? '<div style="margin-top:10px;padding:10px 12px;border:1px solid #f59e0b;border-radius:10px;background:rgba(120,53,15,0.25);color:#fde68a"><strong>Decision pending</strong><div class="small" style="margin-top:6px">A collaboration update needs review before the human thread can be treated as fully current. Resolve it in the Collaboration Feed below.' +
1307
+ ? '<div style="margin-top:10px;padding:10px 12px;border:1px solid #f59e0b;border-radius:10px;background:rgba(120,53,15,0.25);color:#fde68a"><strong>Decision pending</strong><div class="small" style="margin-top:6px">A collaboration update needs review before this session is treated as settled. Resolve it in the Collaboration Feed below.' +
1284
1308
  (pendingCollaborationEvents[0].overdue ? ' This item is overdue.' : '') + '</div></div>'
1285
1309
  : '') +
1286
1310
  (bindingAlert
1287
- ? '<div style="margin-top:10px;padding:10px 12px;border:1px solid #ef4444;border-radius:10px;background:rgba(127,29,29,0.25);color:#fecaca"><strong>Needs reconnect</strong><div class="small" style="margin-top:6px">' + esc(isAdvanced ? (bindingAlert.message || 'Bound work session is missing. Rebind this PingAgent conversation to the current chat session.') : 'OpenClaw chat link is stale. Attach this PingAgent session to the current OpenClaw chat.') + '</div></div>'
1311
+ ? '<div style="margin-top:10px;padding:10px 12px;border:1px solid #ef4444;border-radius:10px;background:rgba(127,29,29,0.25);color:#fecaca"><strong>Compatibility route stale</strong><div class="small" style="margin-top:6px">' + esc(isAdvanced ? (bindingAlert.message || 'Legacy current-thread compatibility routing is missing. Repair it only if you intentionally depend on the compatibility path.') : 'Legacy current-thread compatibility routing is stale. Default human delivery continues to use bindings + notification intents.') + '</div></div>'
1288
1312
  : '') +
1289
1313
  '<div class="row-actions">' +
1290
1314
  (session.trust_state === 'pending'
@@ -1299,11 +1323,16 @@ conversation=' + result.conversation_id));
1299
1323
  (!openRecommendation && reopenRecommendation
1300
1324
  ? '<button class="secondary-btn reopen-session-recommendation-btn" data-session="' + esc(session.session_key) + '">Reopen</button>'
1301
1325
  : '') +
1302
- '<button class="action-btn bind-current-btn" data-conversation="' + esc(session.conversation_id || '') + '">Attach to Current Chat</button>' +
1303
1326
  '<button class="secondary-btn mark-read-btn" data-session="' + esc(session.session_key) + '">Mark read</button>' +
1304
1327
  '<button class="secondary-btn copy-session-link-btn" data-session="' + esc(session.session_key) + '">Copy Session Link</button>' +
1305
- '<button class="danger-btn clear-binding-btn" data-conversation="' + esc(session.conversation_id || '') + '">Detach Chat Link</button>' +
1328
+ (isAdvanced
1329
+ ? '<button class="action-btn bind-current-btn" data-conversation="' + esc(session.conversation_id || '') + '">Repair Compatibility Route</button>' +
1330
+ '<button class="danger-btn clear-binding-btn" data-conversation="' + esc(session.conversation_id || '') + '">Clear Compatibility Route</button>'
1331
+ : '') +
1306
1332
  '</div>' +
1333
+ (isAdvanced
1334
+ ? '<div class="muted small" style="margin-top:8px">Compatibility routing is repair-only. The default human-delivery path uses Human Delivery Binding plus Notification Intent.</div>'
1335
+ : '') +
1307
1336
  '<div class="form-grid" style="margin-top:16px">' +
1308
1337
  '<label class="label">Reply in this session</label>' +
1309
1338
  '<textarea id="sessionReplyInput" placeholder="Send a text reply in this session"></textarea>' +
@@ -1391,9 +1420,9 @@ conversation=' + result.conversation_id));
1391
1420
  '</div>';
1392
1421
  }).join('') : '<div class="empty">No audit events for this session.</div>') +
1393
1422
  '</div></div>' +
1394
- '<div><div class="label">Human Thread Posture</div><div class="audit-list" style="margin-top:8px">' +
1423
+ '<div><div class="label">Human Delivery Posture</div><div class="audit-list" style="margin-top:8px">' +
1395
1424
  '<div class="audit-row"><div class="top"><strong>Projection policy</strong><span class="badge">' + esc(projectionPreset) + '</span></div>' +
1396
- '<div class="muted small">The collaboration session keeps the raw transcript. The human thread receives concise updates, risk signals, decisions, and approval results through the projection outbox.</div>' +
1425
+ '<div class="muted small">The collaboration session keeps the raw transcript. Human-visible updates now flow through Human Delivery Binding plus Notification Intent. Projection outbox remains visible for audit and compatibility.</div>' +
1397
1426
  '<div style="margin-top:8px">Use this detail view to inspect every raw message, task, handoff, audit event, and runtime change before taking action.</div>' +
1398
1427
  (sinceLastSeen
1399
1428
  ? '<div class="summary-pills" style="margin-top:8px">' +
@@ -1586,7 +1615,7 @@ conversation=' + result.conversation_id));
1586
1615
  const previous = previousBinding || (state.session && state.session.binding ? state.session.binding.session_key : null) || '(unbound)';
1587
1616
  const targetRemoteDid = remoteDid || (state.session && state.session.session ? state.session.session.remote_did : null) || '(unknown)';
1588
1617
  const confirmed = window.confirm(
1589
- 'Attach this PingAgent session to the current OpenClaw chat?' +
1618
+ 'Repair the legacy current-thread compatibility route for this PingAgent session?' +
1590
1619
  '
1591
1620
 
1592
1621
  Conversation: ' + conversationId +
@@ -1594,9 +1623,9 @@ Conversation: ' + conversationId +
1594
1623
  Remote DID: ' + targetRemoteDid +
1595
1624
  '
1596
1625
 
1597
- Current OpenClaw chat: ' + (current || '(none)') +
1626
+ Current OpenClaw compatibility target: ' + (current || '(none)') +
1598
1627
  '
1599
- Previous chat link: ' + previous
1628
+ Previous compatibility route: ' + previous
1600
1629
  );
1601
1630
  if (!confirmed) return;
1602
1631
  await api('/api/runtime/session-bindings/bind-current', {
@@ -2292,6 +2321,16 @@ function readHumanDeliveryState(storePath, limit = 12) {
2292
2321
  store.close();
2293
2322
  }
2294
2323
  }
2324
+ function buildOpenClawAgentStatePayload(input) {
2325
+ return deriveOpenClawAgentState({
2326
+ runtime_status: input.runtimeStatus ?? null,
2327
+ sessions: input.sessions ?? [],
2328
+ pending_decisions: Array.isArray(input.pendingDecisions) ? input.pendingDecisions.length : 0,
2329
+ human_delivery: input.humanDelivery ?? null,
2330
+ transport_health: input.transportHealth ?? null,
2331
+ blocked_reason: input.blockedReason ?? null
2332
+ });
2333
+ }
2295
2334
  function buildPolicyDecisionShape(identityPath, remoteDid, opts) {
2296
2335
  const policy = readTrustPolicyDoc(identityPath);
2297
2336
  const runtimeMode = opts?.runtimeMode ?? getRuntimeMode();
@@ -2423,6 +2462,13 @@ async function buildRuntimeOverviewPayload(ctx) {
2423
2462
  } finally {
2424
2463
  decisionStore.close();
2425
2464
  }
2465
+ const agentState = buildOpenClawAgentStatePayload({
2466
+ runtimeStatus: ingressRuntime,
2467
+ sessions,
2468
+ pendingDecisions: decisionViews,
2469
+ humanDelivery,
2470
+ transportHealth
2471
+ });
2426
2472
  return {
2427
2473
  did: ctx.myDid,
2428
2474
  serverUrl: ctx.serverUrl,
@@ -2461,6 +2507,7 @@ async function buildRuntimeOverviewPayload(ctx) {
2461
2507
  collaborationSummary,
2462
2508
  projectionOutbox,
2463
2509
  transportHealth,
2510
+ agentState,
2464
2511
  sinceLastSeen,
2465
2512
  humanDelivery,
2466
2513
  humanDeliveryDetails,
@@ -2559,6 +2606,13 @@ async function buildSessionOverviewPayload(ctx, sessionKey) {
2559
2606
  } finally {
2560
2607
  outboxStore.close();
2561
2608
  }
2609
+ const agentState = buildOpenClawAgentStatePayload({
2610
+ runtimeStatus: readIngressRuntimeStatus(),
2611
+ sessions: sessionManager.listRecentSessions(50),
2612
+ pendingDecisions: pendingDecisionViews,
2613
+ humanDelivery,
2614
+ transportHealth: readTransportHealthState(ctx.storePath)
2615
+ });
2562
2616
  return {
2563
2617
  session,
2564
2618
  sessionSummary: sessionSummaryManager.get(session.session_key),
@@ -2567,6 +2621,7 @@ async function buildSessionOverviewPayload(ctx, sessionKey) {
2567
2621
  collaborationSummary: collaborationEventManager.summarize(200),
2568
2622
  ingressRuntime: readIngressRuntimeStatus(),
2569
2623
  transportHealth: readTransportHealthState(ctx.storePath),
2624
+ agentState,
2570
2625
  binding,
2571
2626
  bindingAlert,
2572
2627
  activeWorkSession,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingagent/sdk",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -35,8 +35,8 @@
35
35
  "uuid": "^11.0.0",
36
36
  "ws": "^8.0.0",
37
37
  "@pingagent/protocol": "0.1.1",
38
- "@pingagent/schemas": "0.1.4",
39
- "@pingagent/a2a": "0.1.1"
38
+ "@pingagent/a2a": "0.1.1",
39
+ "@pingagent/schemas": "0.1.4"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/better-sqlite3": "^7.6.0",