@xopcai/xopc 0.0.475 → 0.0.476

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 (136) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/server/chunks.bin +916 -865
  4. package/dist/gateway/server/chunks.json +1 -1
  5. package/dist/gateway/server/schema.sql +13 -0
  6. package/dist/gateway/server/upgrades/281_session_agent_reactions.sql +13 -0
  7. package/dist/gateway/static/root/assets/{apps-page-BknrhGJ9.js → apps-page-B9Ho8S53.js} +1 -1
  8. package/dist/gateway/static/root/assets/{automations-page-C1s0jwt9.js → automations-page-BL6ASYrU.js} +1 -1
  9. package/dist/gateway/static/root/assets/{automations-workspace-DIwYmYb1.js → automations-workspace-BFk-AF43.js} +2 -2
  10. package/dist/gateway/static/root/assets/{capabilities-page-2vSlbM-C.js → capabilities-page-D9EpUcuB.js} +2 -2
  11. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CfEq0ob4.js → capabilities-settings-panel-ComYXaP1.js} +1 -1
  12. package/dist/gateway/static/root/assets/{channels-Bi0L3VP1.js → channels-Aa2Iun4r.js} +1 -1
  13. package/dist/gateway/static/root/assets/chat-page-BbahuZ59.js +72 -0
  14. package/dist/gateway/static/root/assets/{chat-terminal-dock-CYAZic7B.js → chat-terminal-dock-BALrP7_l.js} +1 -1
  15. package/dist/gateway/static/root/assets/{connectors-page-Bn6Z5xfy.js → connectors-page-BUqNvStL.js} +1 -1
  16. package/dist/gateway/static/root/assets/{extension-debug-page-CNrjzlYX.js → extension-debug-page-gW4GEEcj.js} +1 -1
  17. package/dist/gateway/static/root/assets/{extension-iframe-host-DnautIj8.js → extension-iframe-host-DOPywUKI.js} +1 -1
  18. package/dist/gateway/static/root/assets/{extension-message-router-D81YD6lm.js → extension-message-router-TTAx3dPv.js} +1 -1
  19. package/dist/gateway/static/root/assets/{extension-page-BEY_ML_j.js → extension-page-Iq7vFC-g.js} +1 -1
  20. package/dist/gateway/static/root/assets/{extension-provider-CrMilva_.js → extension-provider-BNnLkq95.js} +1 -1
  21. package/dist/gateway/static/root/assets/{extension-settings-page-QRbfKUay.js → extension-settings-page-C0oLjaz6.js} +1 -1
  22. package/dist/gateway/static/root/assets/{home-page-Cs1kOdTH.js → home-page-pT-lEQsu.js} +3 -3
  23. package/dist/gateway/static/root/assets/index-BtHMU5k4.css +1 -0
  24. package/dist/gateway/static/root/assets/{index-D0R_YIRE.js → index-DdEh8KeB.js} +5 -5
  25. package/dist/gateway/static/root/assets/{local-app-workbench-page-DLGY-zR3.js → local-app-workbench-page-ReBczGac.js} +1 -1
  26. package/dist/gateway/static/root/assets/{note-detail-panel-BS7pKIMu.js → note-detail-panel-DAhIT6xP.js} +3 -3
  27. package/dist/gateway/static/root/assets/{notes-page-DBz5y6aX.js → notes-page-zAJJ2OiQ.js} +1 -1
  28. package/dist/gateway/static/root/assets/{page-context-capture-button-Dtvz4KwD.js → page-context-capture-button-Bd__UBi9.js} +1 -1
  29. package/dist/gateway/static/root/assets/{personal-page-DpmhcQoZ.js → personal-page-DHik8uj6.js} +1 -1
  30. package/dist/gateway/static/root/assets/{personal-profile-settings-KGDtrQK7.js → personal-profile-settings-Cd2xUVbw.js} +1 -1
  31. package/dist/gateway/static/root/assets/{personal-settings-panel-DBlUrnCy.js → personal-settings-panel-CHRra9hc.js} +1 -1
  32. package/dist/gateway/static/root/assets/{preview-runtime-BWkErYI2.js → preview-runtime-MJUo7XlD.js} +1 -1
  33. package/dist/gateway/static/root/assets/{project-detail-page-D6Y3kdtF.js → project-detail-page-BBF8eVJa.js} +1 -1
  34. package/dist/gateway/static/root/assets/{route-preload-CvsNMwNp.js → route-preload-Bl10PwKS.js} +2 -2
  35. package/dist/gateway/static/root/assets/{routine-panel-Cudq6VgR.js → routine-panel-BjqenuXU.js} +2 -2
  36. package/dist/gateway/static/root/assets/{session-manager-CJvUtul5.js → session-manager-fvJusKsK.js} +1 -1
  37. package/dist/gateway/static/root/assets/{settings-page-DEU9sOgT.js → settings-page-B_8kxJQW.js} +1 -1
  38. package/dist/gateway/static/root/assets/{share-preview-page-BRQ6t9CI.js → share-preview-page-C49EIXte.js} +1 -1
  39. package/dist/gateway/static/root/assets/{shares-settings-CQSN1jLt.js → shares-settings-C_ITdQqP.js} +1 -1
  40. package/dist/gateway/static/root/assets/{space-page-Cjp2j2Xx.js → space-page-DmvjU1jc.js} +1 -1
  41. package/dist/gateway/static/root/assets/{task-detail-page-CH7jSUWA.js → task-detail-page-DHYm_bsg.js} +1 -1
  42. package/dist/gateway/static/root/assets/{task-header-title-DemBzQyz.js → task-header-title-Buwr7WTV.js} +1 -1
  43. package/dist/gateway/static/root/assets/{task-result-evidence-ZKcxDYVE.js → task-result-evidence-DpV1mZJA.js} +1 -1
  44. package/dist/gateway/static/root/assets/{use-composer-attachments-O2une3Cn.js → use-composer-attachments-4FKbf6PB.js} +1 -1
  45. package/dist/gateway/static/root/assets/{use-file-preview-expanded-6TirYKSr.js → use-file-preview-expanded-CRBn6UTd.js} +1 -1
  46. package/dist/gateway/static/root/assets/{use-personal-work-CaO6D7sJ.js → use-personal-work-srLCZOam.js} +1 -1
  47. package/dist/gateway/static/root/assets/{use-realtime-voice-D3hr1-yf.js → use-realtime-voice-tyo85cre.js} +1 -1
  48. package/dist/gateway/static/root/assets/{use-workspace-tree-D6IwkuTh.js → use-workspace-tree-VwHdfiR8.js} +1 -1
  49. package/dist/gateway/static/root/assets/{voice-settings-BgdC-Ae5.js → voice-settings-DOajN2ay.js} +1 -1
  50. package/dist/gateway/static/root/assets/{workspace-api-DdVYTEEV.js → workspace-api-CIfedJeG.js} +2 -2
  51. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BTLLCHMI.js → workspace-file-preview-dialog-Xi5feqPq.js} +1 -1
  52. package/dist/gateway/static/root/index.html +17 -17
  53. package/dist/package.js +1 -1
  54. package/dist/src/agent/agent-manager.d.ts +1 -0
  55. package/dist/src/agent/agent-manager.js +1 -0
  56. package/dist/src/agent/mcp/conversation-setup.d.ts +1 -0
  57. package/dist/src/agent/mcp/conversation-setup.js +24 -0
  58. package/dist/src/agent/service.js +1 -0
  59. package/dist/src/agent/service.types.d.ts +1 -0
  60. package/dist/src/agent/tools/capability-catalog-tool.d.ts +10 -0
  61. package/dist/src/agent/tools/capability-catalog-tool.js +63 -0
  62. package/dist/src/agent/tools/factory.d.ts +1 -0
  63. package/dist/src/agent/tools/factory.js +25 -0
  64. package/dist/src/agent/tools/xopc-use-tool.d.ts +1 -0
  65. package/dist/src/agent/tools/xopc-use-tool.js +2 -1
  66. package/dist/src/agent-config/schema.d.ts +3 -0
  67. package/dist/src/agent-config/schema.js +1 -0
  68. package/dist/src/capabilities/capability-catalog.d.ts +47 -0
  69. package/dist/src/capabilities/capability-catalog.js +162 -0
  70. package/dist/src/capabilities/store-connector.d.ts +1 -0
  71. package/dist/src/capabilities/store-connector.js +6 -3
  72. package/dist/src/chat-commands/builtins/config.js +1 -1
  73. package/dist/src/chat-commands/context.js +1 -1
  74. package/dist/src/cli/commands/agent.js +1 -1
  75. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  76. package/dist/src/cli/commands/doctor/checks/database-schema.js +5 -5
  77. package/dist/src/cli/commands/extension-dev.js +1 -1
  78. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  79. package/dist/src/cli/commands/extension.js +1 -1
  80. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  81. package/dist/src/cli/commands/skills.js +1 -1
  82. package/dist/src/cli/extension-cli-register.js +1 -1
  83. package/dist/src/cli/utils/session.js +1 -1
  84. package/dist/src/config/index.js +1 -1
  85. package/dist/src/config/schema.d.ts +2 -0
  86. package/dist/src/config/schema.js +6 -3
  87. package/dist/src/extensions/index.js +2 -2
  88. package/dist/src/extensions/loader.js +1 -1
  89. package/dist/src/extensions/update.js +1 -1
  90. package/dist/src/gateway/agent-reactions/reaction.d.ts +27 -0
  91. package/dist/src/gateway/agent-reactions/reaction.js +186 -0
  92. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  93. package/dist/src/gateway/hono/routes/capabilities.js +27 -0
  94. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  95. package/dist/src/gateway/hono/routes/home.js +1 -1
  96. package/dist/src/gateway/hono/routes/mobile-capability-actions.d.ts +4 -0
  97. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +290 -0
  98. package/dist/src/gateway/hono/routes/music-generation.js +1 -0
  99. package/dist/src/gateway/hono/routes/personal-agent.js +15 -6
  100. package/dist/src/gateway/hono/routes/sessions.js +34 -1
  101. package/dist/src/gateway/security/gateway-scopes.js +3 -0
  102. package/dist/src/gateway/service/agent-runner.d.ts +2 -0
  103. package/dist/src/gateway/service/agent-runner.js +5 -1
  104. package/dist/src/gateway/service/config-coordinator.d.ts +1 -0
  105. package/dist/src/gateway/service/config-coordinator.js +1 -1
  106. package/dist/src/gateway/service/run-gateway-agent.d.ts +3 -0
  107. package/dist/src/gateway/service/run-gateway-agent.js +43 -1
  108. package/dist/src/gateway/service/task-conversation-query-service.d.ts +4 -0
  109. package/dist/src/gateway/service.js +19 -10
  110. package/dist/src/home-intelligence/host.js +5 -5
  111. package/dist/src/personal-agent/repository.d.ts +1 -0
  112. package/dist/src/personal-agent/repository.js +1 -0
  113. package/dist/src/personal-agent/service.d.ts +2 -2
  114. package/dist/src/personal-agent/service.js +6 -3
  115. package/dist/src/providers/model-call.js +1 -0
  116. package/dist/src/realtime/runtime.js +1 -0
  117. package/dist/src/session/client-history.d.ts +1 -0
  118. package/dist/src/session/client-history.js +2 -0
  119. package/dist/src/session/types.d.ts +4 -0
  120. package/dist/src/storage/sqlite/agent-reaction-repository.d.ts +15 -0
  121. package/dist/src/storage/sqlite/agent-reaction-repository.js +73 -0
  122. package/dist/src/storage/sqlite/row-mappers.js +1 -1
  123. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  124. package/dist/src/storage/sqlite/schema.js +7 -7
  125. package/dist/src/storage/sqlite/schema.sql +13 -0
  126. package/dist/src/storage/sqlite/upgrades/281_session_agent_reactions.sql +13 -0
  127. package/dist/src/tui/backends/embedded-backend.js +1 -1
  128. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  129. package/dist/src/tui/tui-commands.js +1 -1
  130. package/dist/src/tui/tui-management.js +1 -1
  131. package/dist/src/tui/tui.js +1 -1
  132. package/dist/src/usage/recorder.js +6 -2
  133. package/dist/src/usage/types.d.ts +1 -0
  134. package/package.json +2 -2
  135. package/dist/gateway/static/root/assets/chat-page-DV7fS7_1.js +0 -72
  136. package/dist/gateway/static/root/assets/index-g7f1Sp02.css +0 -1
@@ -70,25 +70,25 @@ import { runMemoryMaintenance } from "../memory-maintenance/service.js";
70
70
  import "../memory-maintenance/index.js";
71
71
  import { RealtimeExtensionBrowserProvider } from "../browser/providers/realtime-extension.js";
72
72
  import { drainPersonalResultReads } from "../personal-agent/result-read-continuations.js";
73
- import { drainEmbeddedSessionRunnerShutdowns, evictAllEmbeddedSessionRunners } from "../agent/embedded/session-runner.js";
74
73
  import { areExtensionsGloballyDisabled } from "../extensions/discover-extensions.js";
74
+ import { buildExtensionMetadataSnapshot } from "../extensions/extension-metadata-snapshot.js";
75
+ import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot } from "../channels/catalog/channel-catalog-service.js";
76
+ import { loadConfig, saveConfig } from "../config/loader.js";
77
+ import { drainEmbeddedSessionRunnerShutdowns, evictAllEmbeddedSessionRunners } from "../agent/embedded/session-runner.js";
75
78
  import { collectMediaUrisFromMessages, deleteMediaUris } from "../media/session-references.js";
76
79
  import { SessionIndex } from "../session/manager.js";
77
80
  import "../session/index.js";
78
81
  import { ExtensionLoader } from "../extensions/loader.js";
79
- import { buildExtensionMetadataSnapshot } from "../extensions/extension-metadata-snapshot.js";
80
82
  import "../extensions/index.js";
81
- import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot } from "../channels/catalog/channel-catalog-service.js";
82
- import { loadConfig, saveConfig } from "../config/loader.js";
83
83
  import { MessageBus, MessageBusShutdownError } from "../infra/bus/queue.js";
84
84
  import "../infra/bus/index.js";
85
85
  import { publishVoiceChatMessage } from "../voice/realtime/chat-publication.js";
86
86
  import { AgentService } from "../agent/service.js";
87
87
  import { bootstrapApplicationStateSync } from "../bootstrap/application-state.js";
88
- import { ChatPreviewService } from "../chat-previews/service.js";
89
- import "../chat-previews/index.js";
90
88
  import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
91
89
  import { ChannelManager } from "../channels/manager.js";
90
+ import { ChatPreviewService } from "../chat-previews/service.js";
91
+ import "../chat-previews/index.js";
92
92
  import "../config/index.js";
93
93
  import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
94
94
  import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
@@ -105,10 +105,6 @@ import { DiscussionSealer } from "../discussions/sealer.js";
105
105
  import "../discussions/index.js";
106
106
  import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
107
107
  import "../endpoint-tools/index.js";
108
- import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
109
- import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
110
- import { HomeIntelligenceHost } from "../home-intelligence/host.js";
111
- import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
112
108
  import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
113
109
  import { prepareAutomationAgentSession } from "./automation-agent-session.js";
114
110
  import { deliverAutomationCompletion } from "./automation-completion-delivery.js";
@@ -178,6 +174,10 @@ import { TaskMainUpdateDecisionService } from "../tasks/task-main-update-decisio
178
174
  import { selectTaskMainUpdateAttempt, submitAndConfirmTaskMainUpdate } from "../tasks/task-main-update-input.js";
179
175
  import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
180
176
  import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
177
+ import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
178
+ import { HomeIntelligenceHost } from "../home-intelligence/host.js";
179
+ import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
180
+ import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
181
181
  import crypto from "node:crypto";
182
182
  //#region src/gateway/service.ts
183
183
  init_session_repository();
@@ -617,6 +617,11 @@ var GatewayService = class {
617
617
  });
618
618
  this.chatPreviews = new ChatPreviewService({ localApps: this.localApps });
619
619
  this.agentRunner = new GatewayAgentRunner({
620
+ canReact: (endpointId) => {
621
+ if (!this.config.experimental.personalAgentMessageReactions) return false;
622
+ const endpoint = this.endpointTools.registry.get(endpointId);
623
+ return endpoint?.kind === "mobile" && endpoint.platform === "harmonyos" && endpoint.availability === "foreground";
624
+ },
620
625
  canResumeDeviceInteraction: (conversationId, checkpoint) => this.endpointTools.canResumeDeviceInteraction(conversationId, checkpoint),
621
626
  afterConnectionResume: (input, status) => this.mcpSetup.completeContinuation(input, status === "ok" ? this.agentService.getLastAssistantPlainText(input.conversationId) : "连接已保存,但后续读取未完成。请在原微信私聊查看状态或重试;尚未验证业务结果。"),
622
627
  continueConnection: (wait, idempotencyKey) => this.connectionRecovery.continueObjective(wait, idempotencyKey),
@@ -797,6 +802,10 @@ var GatewayService = class {
797
802
  getAutomationService: () => this.automationService,
798
803
  getBrowserSetupService: () => this.browserSetup,
799
804
  getMcpSetupService: () => this.mcpSetup,
805
+ getCapabilityChannelState: () => ({
806
+ channelSnapshot: this.extensionLoader?.getManifestSnapshot(),
807
+ runningChannels: new Set(this.getRunningChannelIds())
808
+ }),
800
809
  getPhoneSetupService: () => this.phoneSetup,
801
810
  canConfigureEndpoint: (endpointId) => this.realtime.canConfigureEndpoint(endpointId),
802
811
  emitBrowserEvent: (type, payload) => this.emit(type, payload),
@@ -7,14 +7,14 @@ import { TaskRepository, init_task_repository } from "../tasks/task-repository.j
7
7
  import { appendTranscriptEntry } from "../storage/sqlite/transcript-repository.js";
8
8
  import { createConversation, init_conversation_repository } from "../storage/sqlite/conversation-repository.js";
9
9
  import { TaskApplicationService } from "../tasks/task-application-service.js";
10
- import { homePatternKey } from "./strategy.js";
11
- import { HomeIntelligenceRepository } from "./repository.js";
12
- import { HomeOpportunityApplicationService } from "./application-service.js";
13
- import { HomeAdvicePolicy } from "./policy.js";
14
10
  import { HomeObservation, ObservationConflictError } from "./observation.js";
15
11
  import { HomeFollowUps } from "./follow-ups.js";
16
- import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
17
12
  import { observationStarters } from "./observation-starters.js";
13
+ import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
14
+ import { homePatternKey } from "./strategy.js";
15
+ import { HomeAdvicePolicy } from "./policy.js";
16
+ import { HomeIntelligenceRepository } from "./repository.js";
17
+ import { HomeOpportunityApplicationService } from "./application-service.js";
18
18
  import { buildHomeOpportunityNotification } from "./notification.js";
19
19
  import { ObservationRoutines } from "./routines.js";
20
20
  import { createHash } from "node:crypto";
@@ -15,6 +15,7 @@ export interface PersonalAgentRecord {
15
15
  voice: string;
16
16
  } | null;
17
17
  voiceCallPreferences: VoiceCallPreferences;
18
+ messageReactionsEnabled: boolean;
18
19
  revision: number;
19
20
  errorMessage: string | null;
20
21
  }
@@ -41,6 +41,7 @@ function toRecord(ownerId, agent, session) {
41
41
  appearance: appearanceFrom(agent),
42
42
  voicePreference: agent.profile?.voicePreference ?? null,
43
43
  voiceCallPreferences: agent.profile?.voiceCallPreferences ?? { openingGreetingEnabled: true },
44
+ messageReactionsEnabled: agent.profile?.messageReactionsEnabled !== false,
44
45
  revision: agent.revision,
45
46
  errorMessage: agent.provisioningError ?? null
46
47
  };
@@ -34,9 +34,9 @@ export declare function patchPersonalProfile(service: PersonalAgentHost, ownerId
34
34
  provider: string;
35
35
  model: string;
36
36
  voice: string;
37
- } | null, voiceCallPreferences?: VoiceCallPreferencesPatch): Promise<PersonalAgentRecord | null>;
37
+ } | null, voiceCallPreferences?: VoiceCallPreferencesPatch, messageReactionsEnabled?: boolean): Promise<PersonalAgentRecord | null>;
38
38
  export declare function updatePersonalProfileRecord(ownerId: string, revision: number, displayName: string, appearance: PersonalAppearance, voicePreference?: {
39
39
  provider: string;
40
40
  model: string;
41
41
  voice: string;
42
- } | null, voiceCallPreferences?: VoiceCallPreferencesPatch): Promise<PersonalAgentRecord | null>;
42
+ } | null, voiceCallPreferences?: VoiceCallPreferencesPatch, messageReactionsEnabled?: boolean): Promise<PersonalAgentRecord | null>;
@@ -143,14 +143,16 @@ async function provisionPersonalAgent(service, ownerId, requestedModel, availabl
143
143
  completePersonalOnboarding(ownerId);
144
144
  return getPersonalAgent(ownerId) ?? record;
145
145
  }
146
- async function patchPersonalProfile(service, ownerId, revision, displayName, appearance, voicePreference, voiceCallPreferences) {
147
- const updated = await updatePersonalProfileRecord(ownerId, revision, displayName, appearance, voicePreference, voiceCallPreferences);
146
+ async function patchPersonalProfile(service, ownerId, revision, displayName, appearance, voicePreference, voiceCallPreferences, messageReactionsEnabled) {
147
+ const previous = getPersonalAgent(ownerId);
148
+ const updated = await updatePersonalProfileRecord(ownerId, revision, displayName, appearance, voicePreference, voiceCallPreferences, messageReactionsEnabled);
148
149
  if (!updated) return null;
150
+ if (messageReactionsEnabled !== void 0 && previous?.displayName === updated.displayName && previous.appearance === updated.appearance && JSON.stringify(previous.voicePreference) === JSON.stringify(updated.voicePreference) && JSON.stringify(previous.voiceCallPreferences) === JSON.stringify(updated.voiceCallPreferences)) return updated;
149
151
  service.refreshAgentCatalog();
150
152
  service.agentService.evictSessionAgent(updated.conversationId);
151
153
  return updated;
152
154
  }
153
- async function updatePersonalProfileRecord(ownerId, revision, displayName, appearance, voicePreference, voiceCallPreferences) {
155
+ async function updatePersonalProfileRecord(ownerId, revision, displayName, appearance, voicePreference, voiceCallPreferences, messageReactionsEnabled) {
154
156
  const current = new AgentCatalogRepository().get(personalAgentId(ownerId));
155
157
  if (!current || current.provisioningState !== "ready" || current.revision !== revision || getPersonalAgent(ownerId)?.state !== "ready") return null;
156
158
  const callPreferences = {
@@ -164,6 +166,7 @@ async function updatePersonalProfileRecord(ownerId, revision, displayName, appea
164
166
  emoji: appearanceEmoji(appearance),
165
167
  avatar: appearanceAvatar(appearance),
166
168
  ...voicePreference !== void 0 ? { voicePreference: voicePreference ?? void 0 } : {},
169
+ ...messageReactionsEnabled !== void 0 ? { messageReactionsEnabled } : {},
167
170
  ...voiceCallPreferences ? { voiceCallPreferences: {
168
171
  openingGreetingEnabled: callPreferences.openingGreetingEnabled,
169
172
  defaultMode: callPreferences.defaultMode,
@@ -52,6 +52,7 @@ async function resolveModelCallOptions(model, options = {}, credentialOptions) {
52
52
  async function completeWithResolvedCredentialsInner(model, context, options, credentialOptions, usageContext) {
53
53
  if (usageContext.trigger === "scheduled" || usageContext.trigger === "system") withModelUsageOrigin("background", () => assertProviderUsage(model.provider, model.baseUrl));
54
54
  const resolvedOptions = await resolveModelCallOptions(model, options, credentialOptions);
55
+ resolvedOptions.signal?.throwIfAborted();
55
56
  const usageCall = startAiUsageCall(model, usageContext, {
56
57
  context,
57
58
  options: {
@@ -221,6 +221,7 @@ var RealtimeRuntime = class {
221
221
  }), "critical");
222
222
  const cancelReplay = writer.enqueueReplay((function* () {
223
223
  for (const message of handle.initial) {
224
+ if (message.kind === "realtime.event" && message.payload.event === "session.agent-reaction") continue;
224
225
  const output = item.view === "compact" ? compactRunEvent(message) : message;
225
226
  if (output) yield output;
226
227
  }
@@ -7,6 +7,7 @@ import type { TranscriptStoredRow } from './session-context-for-llm.js';
7
7
  export interface ClientHistoryMessage {
8
8
  id?: string;
9
9
  transcriptEntryId?: string;
10
+ agentReaction?: import('@xopcai/gateway-contract').SessionAgentReaction;
10
11
  turnId?: string;
11
12
  /** A background Agent turn starts a new visible assistant bubble without a visible user row. */
12
13
  startsNewBubble?: boolean;
@@ -615,8 +615,10 @@ function transcriptRowsToClientHistory(rows, opts) {
615
615
  });
616
616
  continue;
617
617
  }
618
+ const transcriptEntryId = messageRow.role === "user" ? storedTranscriptEntryId(row) : void 0;
618
619
  out.push({
619
620
  id,
621
+ ...transcriptEntryId ? { transcriptEntryId } : {},
620
622
  ...messageRow.turnId ? { turnId: messageRow.turnId } : {},
621
623
  role: messageRow.role,
622
624
  kind: "message",
@@ -134,6 +134,10 @@ export interface SessionTranscriptSummary {
134
134
  }
135
135
  /** Session detail (metadata + messages) */
136
136
  export interface SessionDetail extends SessionMetadata {
137
+ agentReactions?: {
138
+ available: boolean;
139
+ enabled: boolean;
140
+ };
137
141
  messages: Message[];
138
142
  /** Present when loaded with `includeTranscriptSummary` (gateway `?include=transcript`). */
139
143
  transcriptSummary?: SessionTranscriptSummary;
@@ -0,0 +1,15 @@
1
+ import type { SessionAgentReaction } from '@xopcai/gateway-contract';
2
+ export type ReactionTarget = Omit<SessionAgentReaction, 'entryId' | 'emoji' | 'createdAtMs' | 'actorName'> & {
3
+ inputId: string;
4
+ };
5
+ export declare const DEFAULT_AGENT_REACTION = "\uD83D\uDCAC";
6
+ export declare function hasActiveReactionInput(target: ReactionTarget): boolean;
7
+ export declare function activeReactionEntry(target: ReactionTarget, options?: {
8
+ allowSteering: boolean;
9
+ }): {
10
+ entryId: string;
11
+ seq: number;
12
+ } | undefined;
13
+ export declare function reactionCoolingDown(conversationId: string, now: number): boolean;
14
+ export declare function commitAgentReaction(input: ReactionTarget, entryId: string, emoji: string, actorName: string): SessionAgentReaction | null;
15
+ export declare function readAgentReactions(conversationId: string, transcriptId: string, entries: readonly string[], actorName: string): SessionAgentReaction[];
@@ -0,0 +1,73 @@
1
+ import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "./transaction.js";
2
+ //#region src/storage/sqlite/agent-reaction-repository.ts
3
+ init_transaction();
4
+ const DEFAULT_AGENT_REACTION = "💬";
5
+ const ACTIVE_REACTION_INPUT = `SELECT s.active_transcript_id, r.active_run_id FROM sessions s
6
+ JOIN session_input_runtime r ON r.conversation_id = s.conversation_id
7
+ JOIN session_inputs i ON i.id = r.active_input_id AND i.conversation_id = s.conversation_id
8
+ JOIN session_input_receipts receipt ON receipt.conversation_id = i.conversation_id
9
+ AND receipt.client_message_id = i.client_message_id AND receipt.input_id = i.id
10
+ AND receipt.transcript_id = s.active_transcript_id
11
+ WHERE s.conversation_id = ? AND s.active_transcript_id = ? AND s.agent_id = ?
12
+ AND r.active_run_id = ? AND i.id = ? AND i.client_message_id = ? AND i.status = 'running'
13
+ AND i.kind = 'message' AND i.effective_delivery = 'next'
14
+ AND i.expected_transcript_id = s.active_transcript_id
15
+ AND json_extract(i.origin_json, '$.type') = 'endpoint'
16
+ AND (? = 1 OR NOT EXISTS (SELECT 1 FROM session_inputs steer WHERE steer.conversation_id = i.conversation_id
17
+ AND (steer.target_run_id = r.active_run_id OR steer.run_id = r.active_run_id)
18
+ AND steer.id <> i.id AND steer.effective_delivery = 'steer'))`;
19
+ function reactionInputBindings(target, allowSteering = false) {
20
+ return [
21
+ target.conversationId,
22
+ target.transcriptId,
23
+ target.actorAgentId,
24
+ target.runId,
25
+ target.inputId,
26
+ target.clientMessageId,
27
+ Number(allowSteering)
28
+ ];
29
+ }
30
+ function hasActiveReactionInput(target) {
31
+ return getSqliteDatabase().prepare(ACTIVE_REACTION_INPUT).get(...reactionInputBindings(target)) !== void 0;
32
+ }
33
+ function activeReactionEntry(target, options) {
34
+ const entries = getSqliteDatabase().prepare(`SELECT e.entry_id AS entryId, e.seq
35
+ FROM (${ACTIVE_REACTION_INPUT}) input JOIN transcript_entries e ON e.transcript_id = input.active_transcript_id
36
+ WHERE e.entry_kind = 'message' AND e.role = 'user' AND json_extract(e.payload_json, '$.turnId') = input.active_run_id
37
+ AND COALESCE(json_extract(e.payload_json, '$.metadata.steered'), 0) = 0
38
+ AND COALESCE(json_extract(e.payload_json, '$.metadata.hiddenFromClient'), 0) = 0
39
+ ORDER BY e.seq DESC LIMIT 2`).all(...reactionInputBindings(target, options?.allowSteering));
40
+ return entries.length === 1 ? entries[0] : void 0;
41
+ }
42
+ function reactionCoolingDown(conversationId, now) {
43
+ return Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM session_agent_reactions
44
+ WHERE conversation_id = ? AND created_at_ms > ? AND emoji <> ? LIMIT 1`).get(conversationId, now - 2e4, DEFAULT_AGENT_REACTION));
45
+ }
46
+ function commitAgentReaction(input, entryId, emoji, actorName) {
47
+ return runSqliteWriteTransaction((db) => {
48
+ const now = Date.now();
49
+ const isDefault = emoji === DEFAULT_AGENT_REACTION;
50
+ if (activeReactionEntry(input, { allowSteering: isDefault })?.entryId !== entryId || !isDefault && reactionCoolingDown(input.conversationId, now)) return null;
51
+ const { inputId: _inputId, ...identity } = input;
52
+ return db.prepare(`INSERT INTO session_agent_reactions
53
+ (conversation_id, transcript_id, client_message_id, entry_id, actor_agent_id, run_id, emoji, created_at_ms)
54
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT DO NOTHING`).run(input.conversationId, input.transcriptId, input.clientMessageId, entryId, input.actorAgentId, input.runId, emoji, now).changes ? {
55
+ ...identity,
56
+ entryId,
57
+ emoji,
58
+ createdAtMs: now,
59
+ actorName
60
+ } : null;
61
+ });
62
+ }
63
+ function readAgentReactions(conversationId, transcriptId, entries, actorName) {
64
+ if (!entries.length) return [];
65
+ return getSqliteDatabase().prepare(`SELECT r.conversation_id AS conversationId, r.transcript_id AS transcriptId,
66
+ r.client_message_id AS clientMessageId, r.entry_id AS entryId, r.actor_agent_id AS actorAgentId,
67
+ r.run_id AS runId, r.emoji, r.created_at_ms AS createdAtMs, ? AS actorName
68
+ FROM session_agent_reactions r JOIN sessions s ON s.conversation_id = r.conversation_id
69
+ AND s.active_transcript_id = r.transcript_id
70
+ WHERE r.conversation_id = ? AND r.transcript_id = ? AND r.entry_id IN (${entries.map(() => "?").join(",")})`).all(actorName, conversationId, transcriptId, ...entries);
71
+ }
72
+ //#endregion
73
+ export { DEFAULT_AGENT_REACTION, activeReactionEntry, commitAgentReaction, hasActiveReactionInput, reactionCoolingDown, readAgentReactions };
@@ -109,7 +109,7 @@ function storedTranscriptEntryId(row) {
109
109
  }
110
110
  function transcriptEntryRowToStoredRow(row) {
111
111
  const payload = JSON.parse(row.payload_json);
112
- if (row.role === "assistant") storedTranscriptEntryIds.set(payload, row.entry_id);
112
+ if (row.role === "assistant" || row.role === "user") storedTranscriptEntryIds.set(payload, row.entry_id);
113
113
  return payload;
114
114
  }
115
115
  function classifyStoredRow(row) {
@@ -1,7 +1,7 @@
1
1
  import type { DatabaseSync } from 'node:sqlite';
2
2
  export { SCHEMA_META_SCHEMA_VERSION_KEY, readSchemaVersionForTest, readSchemaVersion, setSchemaVersion, ensureSchemaMetaTable } from './schema-version.js';
3
- export declare const XOPC_DB_SCHEMA_VERSION = 280;
4
- export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 280;
3
+ export declare const XOPC_DB_SCHEMA_VERSION = 281;
4
+ export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 281;
5
5
  export { XOPC_DB_MINIMUM_SCHEMA_VERSION } from './schema-upgrade.js';
6
6
  /** Initialize fresh databases directly; upgrade supported installed databases transactionally. */
7
7
  export declare function ensureXopcDatabaseSchema(db: DatabaseSync): void;
@@ -15,18 +15,18 @@ function ensureXopcDatabaseSchema(db) {
15
15
  const hasMetadata = tables.some((row) => row.name === "schema_meta");
16
16
  if (!hasMetadata && tables.length) throw new Error("An unversioned database cannot be initialized");
17
17
  const version = hasMetadata ? readSchemaVersion(db) : 0;
18
- if (version > 280) throw new DatabaseSchemaTooNewError(version, 280);
18
+ if (version > 281) throw new DatabaseSchemaTooNewError(version, 281);
19
19
  if (version > 0 && version < 202) throw new DatabaseSchemaTooOldError(version, 202);
20
- if (version >= 202 && version < 280) {
21
- upgradeXopcDatabase(db, version, 280);
20
+ if (version >= 202 && version < 281) {
21
+ upgradeXopcDatabase(db, version, 281);
22
22
  return;
23
23
  }
24
- if (version === 280) return;
24
+ if (version === 281) return;
25
25
  if (db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'schema_meta' AND name NOT LIKE 'sqlite_%' LIMIT 1").get()) throw new Error("An unversioned database cannot be initialized");
26
26
  db.exec("BEGIN IMMEDIATE");
27
27
  try {
28
28
  db.exec(readSqliteAsset("schema.sql"));
29
- setSchemaVersion(db, 280);
29
+ setSchemaVersion(db, 281);
30
30
  db.exec("COMMIT");
31
31
  } catch (error) {
32
32
  db.exec("ROLLBACK");
@@ -41,8 +41,8 @@ var init_schema = __esmMin((() => {
41
41
  init_schema_version();
42
42
  init_schema_errors();
43
43
  init_schema_upgrade();
44
- XOPC_DB_SCHEMA_VERSION = 280;
45
- XOPC_DB_BASELINE_SCHEMA_VERSION = 280;
44
+ XOPC_DB_SCHEMA_VERSION = 281;
45
+ XOPC_DB_BASELINE_SCHEMA_VERSION = 281;
46
46
  }));
47
47
  //#endregion
48
48
  init_schema();
@@ -3873,3 +3873,16 @@ CREATE TABLE space_backfill (
3873
3873
  );
3874
3874
 
3875
3875
  CREATE TABLE space_media_cleanup (media_id TEXT PRIMARY KEY);
3876
+ CREATE TABLE session_agent_reactions (
3877
+ conversation_id TEXT NOT NULL REFERENCES sessions(conversation_id) ON DELETE CASCADE,
3878
+ transcript_id TEXT NOT NULL REFERENCES transcripts(transcript_id) ON DELETE CASCADE,
3879
+ client_message_id TEXT NOT NULL,
3880
+ entry_id TEXT NOT NULL UNIQUE REFERENCES transcript_entries(entry_id) ON DELETE CASCADE,
3881
+ actor_agent_id TEXT NOT NULL,
3882
+ run_id TEXT NOT NULL,
3883
+ emoji TEXT NOT NULL,
3884
+ created_at_ms INTEGER NOT NULL,
3885
+ PRIMARY KEY (conversation_id, transcript_id, client_message_id)
3886
+ );
3887
+
3888
+ CREATE INDEX idx_session_agent_reactions_cooldown ON session_agent_reactions(conversation_id, created_at_ms);
@@ -0,0 +1,13 @@
1
+ CREATE TABLE session_agent_reactions (
2
+ conversation_id TEXT NOT NULL REFERENCES sessions(conversation_id) ON DELETE CASCADE,
3
+ transcript_id TEXT NOT NULL REFERENCES transcripts(transcript_id) ON DELETE CASCADE,
4
+ client_message_id TEXT NOT NULL,
5
+ entry_id TEXT NOT NULL UNIQUE REFERENCES transcript_entries(entry_id) ON DELETE CASCADE,
6
+ actor_agent_id TEXT NOT NULL,
7
+ run_id TEXT NOT NULL,
8
+ emoji TEXT NOT NULL,
9
+ created_at_ms INTEGER NOT NULL,
10
+ PRIMARY KEY (conversation_id, transcript_id, client_message_id)
11
+ );
12
+
13
+ CREATE INDEX idx_session_agent_reactions_cooldown ON session_agent_reactions(conversation_id, created_at_ms);
@@ -28,11 +28,11 @@ import { AgentCatalogService } from "../../agent-catalog/service.js";
28
28
  import { buildSessionTimeline } from "../../session/transcript-outline.js";
29
29
  import { transcriptRowsToClientHistory } from "../../session/client-history.js";
30
30
  import { createCreateShareTool, isShareToolAvailable } from "../../agent/tools/create-share-tool.js";
31
+ import { loadConfig } from "../../config/loader.js";
31
32
  import { evictEmbeddedSessionRunner } from "../../agent/embedded/session-runner.js";
32
33
  import { SessionIndex } from "../../session/manager.js";
33
34
  import "../../session/index.js";
34
35
  import { parseModelRef } from "../../agent/models/selection.js";
35
- import { loadConfig } from "../../config/loader.js";
36
36
  import { buildReviewContext, resolveGitRoot } from "../../review/review-git.js";
37
37
  import { MessageBus, MessageBusShutdownError } from "../../infra/bus/queue.js";
38
38
  import "../../infra/bus/index.js";
@@ -2,8 +2,8 @@ import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { init_paths, resolveExtensionsDir } from "../../config/paths.js";
4
4
  import { getWorkspacePath } from "../../config/workspace-path-helpers.js";
5
- import { ExtensionLoader } from "../../extensions/loader.js";
6
5
  import { loadConfig } from "../../config/loader.js";
6
+ import { ExtensionLoader } from "../../extensions/loader.js";
7
7
  import "../../config/index.js";
8
8
  //#region src/tui/extension-host/load-extensions.ts
9
9
  init_paths();
@@ -10,9 +10,9 @@ import { isValidProjectAgentId, normalizeProjectAgentId } from "../projects/proj
10
10
  import { inferSuggestedProjectDefaultAgentId } from "../projects/project-agent-suggestion.js";
11
11
  import "../projects/index.js";
12
12
  import "../tasks/index.js";
13
+ import { loadConfig } from "../config/loader.js";
13
14
  import { normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel } from "../agent/transcript/thinking-types.js";
14
15
  import { provenanceTracker } from "../extensions/security.js";
15
- import { loadConfig } from "../config/loader.js";
16
16
  import "../config/index.js";
17
17
  import { theme } from "./theme.js";
18
18
  import { getTuiKeybindingsPath } from "./tui-keybindings-file.js";
@@ -15,8 +15,8 @@ import { cancelMcpAuthorization, getMcpAuthorization, probeMcpConnection, startM
15
15
  import { PluginSetupService, setupActionSchema } from "../extensions/agent-plugins/setup.js";
16
16
  import { LocalWorktreeManager } from "../execution-environments/local-worktree-manager.js";
17
17
  import { SessionEnvironmentService } from "../execution-environments/session-environment-service.js";
18
- import { evictAllEmbeddedSessionRunners } from "../agent/embedded/session-runner.js";
19
18
  import { fetchRegistry } from "../extensions/marketplace.js";
19
+ import { evictAllEmbeddedSessionRunners } from "../agent/embedded/session-runner.js";
20
20
  import { withAgentPluginSource } from "../extensions/agent-plugins/sources.js";
21
21
  import { removePluginCredentials } from "../extensions/agent-plugins/credentials.js";
22
22
  import { z } from "zod";
@@ -7,9 +7,9 @@ import { init_agent_session_key, normalizeAgentId } from "../routing/agent-sessi
7
7
  import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
8
8
  import { getAllProviders, init_providers, isProviderConfiguredSync } from "../providers/index.js";
9
9
  import { sandboxCommand } from "../agent/sandbox/native-command.js";
10
+ import { loadConfig } from "../config/loader.js";
10
11
  import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
11
12
  import { MAX_WEBCHAT_ATTACHMENT_FILE_BYTES } from "../gateway/chat-limits.js";
12
- import { loadConfig } from "../config/loader.js";
13
13
  import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
14
14
  import "../config/index.js";
15
15
  import { resolveTuiConversationId, resolveTuiStartupConversationId } from "../routing/resolve-tui-session-key.js";
@@ -29,7 +29,7 @@ function startAiUsageCall(model, context, input) {
29
29
  "gen_ai.request.model": model.id,
30
30
  "gen_ai.system": model.provider
31
31
  });
32
- observation.input(input);
32
+ if (!context.metadataOnly) observation.input(input);
33
33
  const operation = context.operation;
34
34
  const scenario = resolveAiUsageScenario(operation);
35
35
  const id = randomUUID();
@@ -88,11 +88,15 @@ function startAiUsageCall(model, context, input) {
88
88
  "langfuse.observation.cost_details": costSource === "unknown" ? void 0 : JSON.stringify({ total: result.usage?.cost?.total }),
89
89
  "xopc.costSource": costSource
90
90
  });
91
- observation.finish(result.status === "failed" ? "error" : result.status === "aborted" ? "cancelled" : "success", result.output ?? result.errorSummary);
91
+ observation.finish(result.status === "failed" ? "error" : result.status === "aborted" ? "cancelled" : "success", context.metadataOnly ? void 0 : result.output ?? result.errorSummary);
92
92
  if (!persisted) return;
93
93
  try {
94
94
  finishAiUsageEvent(id, {
95
95
  ...result,
96
+ ...context.metadataOnly ? {
97
+ errorSummary: void 0,
98
+ output: void 0
99
+ } : {},
96
100
  estimatedCostMicrousd: costSource === "local" ? 0 : costSource === "unknown" ? void 0 : dollarsToMicrousd(result.usage?.cost?.total)
97
101
  });
98
102
  if (model.provider === "xopc-cloud") reconcileCloudUsageReceipt(id);
@@ -5,6 +5,7 @@ export type AiUsageCostSource = 'model_catalog' | 'local' | 'unknown';
5
5
  export type AiUsageCategory = 'chat' | 'tool_loop' | 'delegation' | 'compaction' | 'session_title' | 'image_understanding' | 'web_extract' | 'session_search' | 'note_generation' | 'automation' | 'task_planning' | 'task_judging' | 'voice_summary' | 'home_intelligence' | 'work_discovery' | 'discussion_analysis' | 'other';
6
6
  export type AiUsageContext = {
7
7
  operation: string;
8
+ metadataOnly?: boolean;
8
9
  trigger?: AiUsageTrigger;
9
10
  traceId?: string;
10
11
  parentEventId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xopcai/xopc",
3
- "version": "0.0.475",
3
+ "version": "0.0.476",
4
4
  "description": "An open-source AI assistant for work and everyday life. Remembers context and helps you get things done. Local-first, on a computer you choose.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -170,8 +170,8 @@
170
170
  "vue": "^3.5.44",
171
171
  "xlsx": "file:web/vendor/xlsx-0.20.3.tgz",
172
172
  "@xopcai/browser-control-contract": "0.1.0",
173
- "@xopcai/endpoint-tools-client": "0.0.0",
174
173
  "@xopcai/computer-control-contract": "0.1.0",
174
+ "@xopcai/endpoint-tools-client": "0.0.0",
175
175
  "@xopcai/endpoint-tools-protocol": "0.0.0",
176
176
  "@xopcai/gateway-contract": "0.0.0",
177
177
  "@xopcai/image-providers": "0.1.0",