@senguoyun/dsh-arkme 0.1.59 → 0.1.61

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 (154) hide show
  1. package/cordis.patch.yml +6 -0
  2. package/docs/dsh-input-system-topic.md +7 -3
  3. package/docs/search-dsh-navigation.md +37 -0
  4. package/lib/client.js +5823 -3562
  5. package/lib/client.js.map +1 -1
  6. package/lib/harness-model-client.js +9 -0
  7. package/lib/harness-native-selection-client.js +1341 -0
  8. package/lib/harness-onboarding-client.js +64 -2
  9. package/lib/harness-session-client.js +39 -2
  10. package/lib/harness-sidebar-client.js +214 -23
  11. package/lib/index.js +114 -156
  12. package/lib/persistent-extension.js +1 -1
  13. package/lib/{persistent-runtime-ByM3JB3z.js → persistent-runtime-CXd9RuRR.js} +30263 -29553
  14. package/lib/sdk.js +9 -0
  15. package/lib/types/arkme-service.d.ts +7 -1
  16. package/lib/types/arkme-service.d.ts.map +1 -1
  17. package/lib/types/client/ArkmeCalendarSurface.d.ts +22 -1
  18. package/lib/types/client/ArkmeCalendarSurface.d.ts.map +1 -1
  19. package/lib/types/client/ArkmeChatMemberActions.d.ts +1 -1
  20. package/lib/types/client/ArkmeChatMemberActions.d.ts.map +1 -1
  21. package/lib/types/client/ArkmeDetailShell.d.ts +3 -1
  22. package/lib/types/client/ArkmeDetailShell.d.ts.map +1 -1
  23. package/lib/types/client/ArkmeDshMenu.d.ts +38 -0
  24. package/lib/types/client/ArkmeDshMenu.d.ts.map +1 -0
  25. package/lib/types/client/ArkmeFileViewer.d.ts +1 -0
  26. package/lib/types/client/ArkmeFileViewer.d.ts.map +1 -1
  27. package/lib/types/client/ArkmeGroupChatControls.d.ts +4 -0
  28. package/lib/types/client/ArkmeGroupChatControls.d.ts.map +1 -1
  29. package/lib/types/client/ArkmeMessageActions.d.ts.map +1 -1
  30. package/lib/types/client/ArkmeNoteDetails.d.ts +2 -1
  31. package/lib/types/client/ArkmeNoteDetails.d.ts.map +1 -1
  32. package/lib/types/client/ArkmeProductNavigation.d.ts.map +1 -1
  33. package/lib/types/client/ArkmeRecordEditHistory.d.ts +10 -0
  34. package/lib/types/client/ArkmeRecordEditHistory.d.ts.map +1 -0
  35. package/lib/types/client/ArkmeRichContent.d.ts +2 -1
  36. package/lib/types/client/ArkmeRichContent.d.ts.map +1 -1
  37. package/lib/types/client/ArkmeSearchSurface.d.ts.map +1 -1
  38. package/lib/types/client/ArkmeSidebar.d.ts.map +1 -1
  39. package/lib/types/client/ArkmeSourceBreadcrumb.d.ts +6 -2
  40. package/lib/types/client/ArkmeSourceBreadcrumb.d.ts.map +1 -1
  41. package/lib/types/client/ArkmeTopicDirectoryPopover.d.ts +5 -2
  42. package/lib/types/client/ArkmeTopicDirectoryPopover.d.ts.map +1 -1
  43. package/lib/types/client/ArkmeVirtualWorkspace.d.ts.map +1 -1
  44. package/lib/types/client/ArkmeWorldSurface.d.ts +3 -3
  45. package/lib/types/client/ArkmeWorldSurface.d.ts.map +1 -1
  46. package/lib/types/client/DeepSeekHarnessSurface.d.ts +4 -0
  47. package/lib/types/client/DeepSeekHarnessSurface.d.ts.map +1 -1
  48. package/lib/types/client/PrivateChatActions.d.ts +15 -3
  49. package/lib/types/client/PrivateChatActions.d.ts.map +1 -1
  50. package/lib/types/client/api.d.ts +1 -1
  51. package/lib/types/client/api.d.ts.map +1 -1
  52. package/lib/types/client/arkme-theme.d.ts +1 -0
  53. package/lib/types/client/arkme-theme.d.ts.map +1 -1
  54. package/lib/types/client/calendar-invalidation-store.d.ts +10 -1
  55. package/lib/types/client/calendar-invalidation-store.d.ts.map +1 -1
  56. package/lib/types/client/calendar-month-cache.d.ts +37 -0
  57. package/lib/types/client/calendar-month-cache.d.ts.map +1 -0
  58. package/lib/types/client/clipboard-text.d.ts +2 -0
  59. package/lib/types/client/clipboard-text.d.ts.map +1 -0
  60. package/lib/types/client/conversation-export.d.ts +18 -0
  61. package/lib/types/client/conversation-export.d.ts.map +1 -0
  62. package/lib/types/client/conversation-menu-layer.d.ts +27 -0
  63. package/lib/types/client/conversation-menu-layer.d.ts.map +1 -0
  64. package/lib/types/client/conversation-menu-scrollbars.d.ts +3 -0
  65. package/lib/types/client/conversation-menu-scrollbars.d.ts.map +1 -0
  66. package/lib/types/client/conversation-selector-style.d.ts +34 -0
  67. package/lib/types/client/conversation-selector-style.d.ts.map +1 -0
  68. package/lib/types/client/harness-native-selection-client.d.ts +13 -0
  69. package/lib/types/client/harness-native-selection-client.d.ts.map +1 -0
  70. package/lib/types/client/harness-native-selection-geometry.d.ts +47 -0
  71. package/lib/types/client/harness-native-selection-geometry.d.ts.map +1 -0
  72. package/lib/types/client/harness-native-selection-loader.d.ts +4 -0
  73. package/lib/types/client/harness-native-selection-loader.d.ts.map +1 -0
  74. package/lib/types/client/harness-native-selection.d.ts +35 -0
  75. package/lib/types/client/harness-native-selection.d.ts.map +1 -0
  76. package/lib/types/client/harness-onboarding-client.d.ts.map +1 -1
  77. package/lib/types/client/harness-session-client.d.ts.map +1 -1
  78. package/lib/types/client/harness-session-dropdown.d.ts.map +1 -1
  79. package/lib/types/client/harness-session-hover.d.ts +1 -1
  80. package/lib/types/client/harness-session-hover.d.ts.map +1 -1
  81. package/lib/types/client/harness-session-menu-bridge.d.ts +2 -0
  82. package/lib/types/client/harness-session-menu-bridge.d.ts.map +1 -1
  83. package/lib/types/client/harness-session-summary.d.ts +0 -7
  84. package/lib/types/client/harness-session-summary.d.ts.map +1 -1
  85. package/lib/types/client/harness-slots-contract.d.ts +12 -0
  86. package/lib/types/client/harness-slots-contract.d.ts.map +1 -0
  87. package/lib/types/client/harness-surface-viewport.d.ts +7 -0
  88. package/lib/types/client/harness-surface-viewport.d.ts.map +1 -0
  89. package/lib/types/client/index.d.ts.map +1 -1
  90. package/lib/types/client/interwoven-moments.d.ts.map +1 -1
  91. package/lib/types/client/member-records-loader.d.ts +10 -0
  92. package/lib/types/client/member-records-loader.d.ts.map +1 -0
  93. package/lib/types/client/member-records-viewport.d.ts +10 -0
  94. package/lib/types/client/member-records-viewport.d.ts.map +1 -0
  95. package/lib/types/client/message-selection-presentation.d.ts +42 -2
  96. package/lib/types/client/message-selection-presentation.d.ts.map +1 -1
  97. package/lib/types/client/navigation-cache.d.ts +6 -1
  98. package/lib/types/client/navigation-cache.d.ts.map +1 -1
  99. package/lib/types/client/provider-instance-runtime.d.ts.map +1 -1
  100. package/lib/types/client/realtime-client-events.d.ts.map +1 -1
  101. package/lib/types/client/redesign/contacts/ContactProfileDetail.d.ts.map +1 -1
  102. package/lib/types/client/redesign/contacts/ContactWorldList.d.ts +2 -1
  103. package/lib/types/client/redesign/contacts/ContactWorldList.d.ts.map +1 -1
  104. package/lib/types/client/self-topic-directory-cache.d.ts +42 -0
  105. package/lib/types/client/self-topic-directory-cache.d.ts.map +1 -0
  106. package/lib/types/client/self-topic-expansion-preference.d.ts +23 -0
  107. package/lib/types/client/self-topic-expansion-preference.d.ts.map +1 -0
  108. package/lib/types/client/self-topic-menu-bridge.d.ts +20 -0
  109. package/lib/types/client/self-topic-menu-bridge.d.ts.map +1 -0
  110. package/lib/types/client/self-topic-menu-hover.d.ts +3 -0
  111. package/lib/types/client/self-topic-menu-hover.d.ts.map +1 -0
  112. package/lib/types/client/timeline-message-order.d.ts +4 -0
  113. package/lib/types/client/timeline-message-order.d.ts.map +1 -0
  114. package/lib/types/client/ui-controller.d.ts +7 -1
  115. package/lib/types/client/ui-controller.d.ts.map +1 -1
  116. package/lib/types/client/use-calendar-month.d.ts +4 -0
  117. package/lib/types/client/use-calendar-month.d.ts.map +1 -0
  118. package/lib/types/dsh-agent-input-source.d.ts +2 -0
  119. package/lib/types/dsh-agent-input-source.d.ts.map +1 -1
  120. package/lib/types/dsh-search-origins.d.ts +4 -0
  121. package/lib/types/dsh-search-origins.d.ts.map +1 -0
  122. package/lib/types/harness-embed-contract.d.ts +10 -0
  123. package/lib/types/harness-embed-contract.d.ts.map +1 -1
  124. package/lib/types/harness-embed-route.d.ts +2 -1
  125. package/lib/types/harness-embed-route.d.ts.map +1 -1
  126. package/lib/types/host-api.d.ts.map +1 -1
  127. package/lib/types/index.d.ts.map +1 -1
  128. package/lib/types/managed-ai/adapter.d.ts.map +1 -1
  129. package/lib/types/managed-ai/transport.d.ts.map +1 -1
  130. package/lib/types/record-edit-history.d.ts +21 -0
  131. package/lib/types/record-edit-history.d.ts.map +1 -0
  132. package/lib/types/sdk/index.d.ts +7 -0
  133. package/lib/types/sdk/index.d.ts.map +1 -1
  134. package/lib/types/services/calendar-service.d.ts +10 -0
  135. package/lib/types/services/calendar-service.d.ts.map +1 -1
  136. package/lib/types/services/chat-realtime-service.d.ts +3 -1
  137. package/lib/types/services/chat-realtime-service.d.ts.map +1 -1
  138. package/lib/types/services/chat-service.d.ts +5 -1
  139. package/lib/types/services/chat-service.d.ts.map +1 -1
  140. package/lib/types/services/contact-directory-service.d.ts.map +1 -1
  141. package/lib/types/services/media-service.d.ts +7 -0
  142. package/lib/types/services/media-service.d.ts.map +1 -1
  143. package/lib/types/services/record-edit-history-service.d.ts +25 -0
  144. package/lib/types/services/record-edit-history-service.d.ts.map +1 -0
  145. package/lib/types/services/record-service.d.ts.map +1 -1
  146. package/lib/types/services/search-service.d.ts +1 -0
  147. package/lib/types/services/search-service.d.ts.map +1 -1
  148. package/lib/types/services/service.d.ts +5 -0
  149. package/lib/types/services/service.d.ts.map +1 -1
  150. package/lib/types/services/source-service.d.ts +3 -0
  151. package/lib/types/services/source-service.d.ts.map +1 -1
  152. package/lib/types/types.d.ts +21 -3
  153. package/lib/types/types.d.ts.map +1 -1
  154. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as ARKME_DEFAULT_SHARE_WEBSITE, A as inspectNativeBundleArtifactV3, At as createDesktopLifecycleReader, D as bundleSha256, Dt as ArkmePluginError, E as arkmeSandboxEntryId, Et as normalizeRecentEmojiIds, F as assertExtensionArtifactSize, Ft as __toCommonJS, G as validateVoiceprintPcm16Wav, I as canonicalExtensionJson, J as arkmeRequiredLinkMetadataFallback, K as arkmeExtensionShareRefFromLink, L as sha256Hex, M as packLocalNativeBundleDirectoryV3, Mt as __esmMin, N as readNativeBundleTarballV3, Nt as __exportAll, O as canonicalBundleJson, Ot as retryAfterMillis, P as renderArkmeSandboxHostEntry, Pt as __require, Q as parseArkmeRecordReeditAttachments, R as unpackArkmeExtension, S as ARKME_BUNDLE_ARTIFACT_KIND, St as sameRecordingImportIdentity, T as ArkmeBundleArtifactError, Tt as isRecentEmojiId, U as ARKME_EXTENSION_RUNTIME_UNAVAILABLE_MESSAGE, W as ArkmeService, X as arkmeRichBackgroundSound, Y as arkmeFileBackgroundSound, Z as ArkmeRecordReeditDraftConflict, _ as arkmeClientContentDigest, _t as SecretValue, at as ARKME_WORLD_PUBLISH_MAX_IMAGE_BYTES, b as verifyExtensionResolutionSignature, bt as isUnresolvedRecordingImportJob, c as persistentExtensionBundleDirectory, ct as mergeMemberJoinEvents, d as readPersistentExtensionActivation, dt as ARKME_TOOL_FILE_MAX_BYTES, et as ARKME_PROVIDER_CONTRACT_VERSION, f as refreshPersistentClientWrapper, ft as arkmeCanInlineLocalFile, g as activeProfileExtensionOwnerConflicts, gt as ArkmeOutgoingCallError, h as renderArkmeBundleClientBundle, ht as isArkmeBotAvatarRef, i as invokePersistentArkmeExtension, it as ARKME_WORLD_PUBLISH_MAX_IMAGES, j as packBundleFiles, jt as __commonJSMin, k as inspectBundleArtifact, kt as recordOwnerId, l as persistentExtensionPackageIdentity, lt as validateMemberUpdate, m as writePersistentExtensionActivation, mt as arkmePickedFileKind, o as persistentArkmeExtensionRuntimeState, ot as applyMemberUpdate, p as repairPersistentExtensionInstallation, pt as arkmeNormalizedFileMimeType, q as arkmeIsGenericLinkMetadataTitle, r as deactivatePersistentArkmeExtension, s as materializePersistentExtensionBundle, st as cachedMemberItem, t as activatePersistentArkmeExtension, u as quarantinePersistentExtension, ut as ARKME_RUNTIME_INSTANCE_ID, v as arkmeClientContentDigestFromSource, vt as ArkmeDirectMessageAdmissionError, w as ARKME_NATIVE_BUNDLE_ARTIFACT_KIND, wt as recordingImportFileNameKey, x as verifyNativeBundleResolutionSignature, xt as recordingImportFileKind, y as verifyBundleResolutionSignature, yt as isRecordingInstantOnOrAfterUnixEpoch, z as ARKME_EXTENSION_FORMAT } from "./persistent-runtime-ByM3JB3z.js";
1
+ import { $ as ARKME_DEFAULT_SHARE_WEBSITE, A as inspectNativeBundleArtifactV3, At as registerDSHAgentInputRecordSync, D as bundleSha256, Dt as ArkmePluginError, E as arkmeSandboxEntryId, Et as normalizeRecentEmojiIds, F as assertExtensionArtifactSize, Ft as __require, G as validateVoiceprintPcm16Wav, I as canonicalExtensionJson, It as __toCommonJS, J as arkmeRequiredLinkMetadataFallback, K as arkmeExtensionShareRefFromLink, L as sha256Hex, M as packLocalNativeBundleDirectoryV3, Mt as __commonJSMin, N as readNativeBundleTarballV3, Nt as __esmMin, O as canonicalBundleJson, Ot as retryAfterMillis, P as renderArkmeSandboxHostEntry, Pt as __exportAll, Q as parseArkmeRecordReeditAttachments, R as unpackArkmeExtension, S as ARKME_BUNDLE_ARTIFACT_KIND, St as sameRecordingImportIdentity, T as ArkmeBundleArtifactError, Tt as isRecentEmojiId, U as ARKME_EXTENSION_RUNTIME_UNAVAILABLE_MESSAGE, W as ArkmeService, X as arkmeRichBackgroundSound, Y as arkmeFileBackgroundSound, Z as ArkmeRecordReeditDraftConflict, _ as arkmeClientContentDigest, _t as SecretValue, at as ARKME_WORLD_PUBLISH_MAX_IMAGE_BYTES, b as verifyExtensionResolutionSignature, bt as isUnresolvedRecordingImportJob, c as persistentExtensionBundleDirectory, ct as mergeMemberJoinEvents, d as readPersistentExtensionActivation, dt as ARKME_TOOL_FILE_MAX_BYTES, et as ARKME_PROVIDER_CONTRACT_VERSION, f as refreshPersistentClientWrapper, ft as arkmeCanInlineLocalFile, g as activeProfileExtensionOwnerConflicts, gt as ArkmeOutgoingCallError, h as renderArkmeBundleClientBundle, ht as isArkmeBotAvatarRef, i as invokePersistentArkmeExtension, it as ARKME_WORLD_PUBLISH_MAX_IMAGES, j as packBundleFiles, jt as createDesktopLifecycleReader, k as inspectBundleArtifact, kt as recordOwnerId, l as persistentExtensionPackageIdentity, lt as validateMemberUpdate, m as writePersistentExtensionActivation, mt as arkmePickedFileKind, o as persistentArkmeExtensionRuntimeState, ot as applyMemberUpdate, p as repairPersistentExtensionInstallation, pt as arkmeNormalizedFileMimeType, q as arkmeIsGenericLinkMetadataTitle, r as deactivatePersistentArkmeExtension, s as materializePersistentExtensionBundle, st as cachedMemberItem, t as activatePersistentArkmeExtension, u as quarantinePersistentExtension, ut as ARKME_RUNTIME_INSTANCE_ID, v as arkmeClientContentDigestFromSource, vt as ArkmeDirectMessageAdmissionError, w as ARKME_NATIVE_BUNDLE_ARTIFACT_KIND, wt as recordingImportFileNameKey, x as verifyNativeBundleResolutionSignature, xt as recordingImportFileKind, y as verifyBundleResolutionSignature, yt as isRecordingInstantOnOrAfterUnixEpoch, z as ARKME_EXTENSION_FORMAT } from "./persistent-runtime-CXd9RuRR.js";
2
2
  import { _ as parsePluginUpdateManifest, b as validatePluginUpdateServiceOrigin, d as writePluginUpdateLifecycleLog, f as PluginUpdateInstallStateStore, g as existingCachedPluginArtifactPath, h as downloadAndCachePluginArtifact, m as PluginUpdateArtifactError, n as buildTargetInstallArgs, o as reconcilePluginUpdaterProfilePolicy, p as ARKME_PLUGIN_PACKAGE_NAME$1, t as assertTargetArtifactIntegrity, u as detachManagedProfilePluginLink, v as pluginUpdateEndpointUrl, y as validatePluginUpdateArtifactOrigin } from "./plugin-updater-helper-y7wzJLOx.js";
3
3
  import { a as securePrivateDirectory, c as securePrivateFileSync, i as prepareProfilePackageManager, n as isArkmeProfilePackageName, o as securePrivateDirectorySync, r as localExtensionPnpmArgs, s as securePrivateFile, t as applyArkmeProfileBundlePolicy } from "./profile-bundle-policy-DLXDyohJ.js";
4
4
  import { i as invokeArkmeBundle, n as arkmeBundleActive, r as deactivateArkmeBundle } from "./bundle-runtime-CE73h3vS.js";
@@ -148,6 +148,7 @@ const ARKME_HARNESS_MODEL_CLIENT_PATH = "/arkme-self/harness-model-client.js";
148
148
  const ARKME_HARNESS_ONBOARDING_CLIENT_PATH = "/arkme-self/harness-onboarding-client.js";
149
149
  const ARKME_HARNESS_TRAJECTORY_CLIENT_PATH = "/arkme-self/harness-trajectory-client.js";
150
150
  const ARKME_HARNESS_SIDEBAR_CLIENT_PATH = "/arkme-self/harness-sidebar-client.js";
151
+ const ARKME_NATIVE_SELECTION_CLIENT_PATH = "/arkme-self/harness-native-selection-client.js";
151
152
  //#endregion
152
153
  //#region src/plugin-update-policy.ts
153
154
  const PLUGIN_UPDATE_TERMINAL_STATE_TTL_MS = 10 * 6e4;
@@ -10481,103 +10482,6 @@ function createOpenClawFileSecretStore(options) {
10481
10482
  };
10482
10483
  }
10483
10484
  //#endregion
10484
- //#region src/dsh-agent-input-sync.ts
10485
- function sessionEventSource(value) {
10486
- return value !== null && typeof value === "object" && typeof value.on === "function" ? value : void 0;
10487
- }
10488
- function objectValue$2(value) {
10489
- return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
10490
- }
10491
- function stringValue(value) {
10492
- return typeof value === "string" ? value : "";
10493
- }
10494
- function numberValue(value) {
10495
- return typeof value === "number" && Number.isFinite(value) ? value : 0;
10496
- }
10497
- function stableRecordUid(namespace, key) {
10498
- const bytes = createHash("sha256").update(`dsh-arkme:${namespace}:${key}`).digest().subarray(0, 16);
10499
- bytes[6] = (bytes[6] ?? 0) & 15 | 80;
10500
- bytes[8] = (bytes[8] ?? 0) & 63 | 128;
10501
- const hex = bytes.toString("hex");
10502
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
10503
- }
10504
- function dshAgentInputRecordUid(sessionId, eventSeq) {
10505
- return stableRecordUid("dsh-agent-input", `${sessionId}\0${String(eventSeq)}`);
10506
- }
10507
- function dshAgentInputTextFromEvent(event) {
10508
- const envelope = objectValue$2(event);
10509
- if (envelope.type !== "user/message") return void 0;
10510
- const data = objectValue$2(envelope.data);
10511
- if (objectValue$2(data.source).kind !== "user") return void 0;
10512
- const text = (Array.isArray(data.content) ? data.content : []).map((block) => {
10513
- const item = objectValue$2(block);
10514
- return item.type === "text" ? stringValue(item.text).trim() : "";
10515
- }).filter(Boolean).join("\n").trim();
10516
- return text === "" ? void 0 : text;
10517
- }
10518
- function registerDSHAgentInputRecordSync(ctx, service, options = {}) {
10519
- const logger = options.logger ?? ctx.logger;
10520
- const maxAttempts = Math.max(1, Math.trunc(options.maxAttempts ?? 3));
10521
- const retryDelayMillis = Math.max(0, Math.trunc(options.retryDelayMillis ?? 5e3));
10522
- const inFlight = /* @__PURE__ */ new Set();
10523
- const synced = /* @__PURE__ */ new Set();
10524
- const timers = /* @__PURE__ */ new Set();
10525
- let disposed = false;
10526
- const sync = (key, recordUid, text, sendAtMillis, attempt) => {
10527
- inFlight.add(key);
10528
- let retrying = false;
10529
- service.createDSHAgentInputText(recordUid, text, sendAtMillis).then(() => {
10530
- if (disposed) return;
10531
- synced.add(key);
10532
- }).catch((error) => {
10533
- if (disposed) return;
10534
- if (attempt < maxAttempts) {
10535
- retrying = true;
10536
- const timer = setTimeout(() => {
10537
- timers.delete(timer);
10538
- if (disposed) {
10539
- inFlight.delete(key);
10540
- return;
10541
- }
10542
- sync(key, recordUid, text, sendAtMillis, attempt + 1);
10543
- }, retryDelayMillis);
10544
- timers.add(timer);
10545
- return;
10546
- }
10547
- const message = error instanceof Error && error.message.trim() !== "" ? error.message : String(error);
10548
- logger.warn(`dsh-arkme: failed to sync DSH Agent input record: ${message}`);
10549
- }).finally(() => {
10550
- if (!retrying || disposed) inFlight.delete(key);
10551
- });
10552
- };
10553
- const listener = (rawSession, rawEvent) => {
10554
- if (disposed) return;
10555
- const event = objectValue$2(rawEvent);
10556
- const sessionId = stringValue(objectValue$2(rawSession).id).trim();
10557
- const eventSeq = Math.trunc(numberValue(event.seq));
10558
- if (sessionId === "" || eventSeq < 0) return;
10559
- const text = dshAgentInputTextFromEvent(event);
10560
- if (text === void 0) return;
10561
- const key = `${sessionId}\0${String(eventSeq)}`;
10562
- if (inFlight.has(key) || synced.has(key)) return;
10563
- sync(key, dshAgentInputRecordUid(sessionId, eventSeq), text, numberValue(event.time), 1);
10564
- };
10565
- ctx.effect(() => {
10566
- const source = sessionEventSource(ctx);
10567
- if (source === void 0) {
10568
- logger.warn("dsh-arkme: DSH session/event API is unavailable; DSH Agent input sync disabled");
10569
- return () => {};
10570
- }
10571
- const dispose = source.on("session/event", listener, { global: true });
10572
- return () => {
10573
- disposed = true;
10574
- dispose();
10575
- for (const timer of timers) clearTimeout(timer);
10576
- timers.clear();
10577
- };
10578
- }, "dsh-arkme: DSH Agent input record sync");
10579
- }
10580
- //#endregion
10581
10485
  //#region src/directory-reader.ts
10582
10486
  /** Transport-neutral dispatch only: each business owner keeps its own projection and credentials. */
10583
10487
  function readDirectoryPage(service, teams, section, options = {}) {
@@ -11558,7 +11462,9 @@ async function dispatchArkmeHostOperation(service, operation, params, updateMana
11558
11462
  scope: recordingSpeakerScopeParam(params)
11559
11463
  }, requestSignal);
11560
11464
  case "calendar.buckets": return await service.calendarBuckets({
11465
+ ...params?.background === true ? { background: true } : {},
11561
11466
  startDate: stringParam(params, "startDate"),
11467
+ ...params?.sourceRef === void 0 ? {} : { sourceRef: stringParam(params, "sourceRef") },
11562
11468
  ...requestSignal === void 0 ? {} : { signal: requestSignal },
11563
11469
  endDate: stringParam(params, "endDate"),
11564
11470
  ...stringParam(params, "timezone") === "" ? {} : { timezone: stringParam(params, "timezone") }
@@ -11567,6 +11473,7 @@ async function dispatchArkmeHostOperation(service, operation, params, updateMana
11567
11473
  const cursor = cursorParam(params);
11568
11474
  return await service.calendarRecords({
11569
11475
  bucketDate: stringParam(params, "bucketDate"),
11476
+ ...params?.sourceRef === void 0 ? {} : { sourceRef: stringParam(params, "sourceRef") },
11570
11477
  ...requestSignal === void 0 ? {} : { signal: requestSignal },
11571
11478
  limit: numberParam(params, "limit", 20),
11572
11479
  ...stringParam(params, "timezone") === "" ? {} : { timezone: stringParam(params, "timezone") },
@@ -11822,6 +11729,7 @@ async function dispatchArkmeHostOperation(service, operation, params, updateMana
11822
11729
  case "source.interwoven-detail": return await service.interwovenMomentDetail(requiredInterwovenParam(params, "sourceRef"), requiredInterwovenParam(params, "momentRef"));
11823
11730
  case "source.related-quick-notes.from-message": return await service.relatedQuickNotesFromMessage(requiredRelatedQuickNoteParam(params, "sourceRef"), requiredRelatedQuickNoteParam(params, "messageActionRef", MAX_MESSAGE_ACTION_REF_CHARS), requestSignal);
11824
11731
  case "source.related-quick-notes.from-moment": return await service.relatedQuickNotesFromMoment(requiredRelatedQuickNoteParam(params, "sourceRef"), requiredRelatedQuickNoteParam(params, "momentRef"), requestSignal);
11732
+ case "source.record-edit-history": return await service.recordEditHistoryPage(stringParam(params, "sourceRef"), stringParam(params, "messageActionRef"), numberParam(params, "cursorEditAt", 0), requestSignal);
11825
11733
  case "source.related-quick-note.detail": return await service.relatedQuickNoteDetail(requiredRelatedQuickNoteParam(params, "sourceRef"), requiredRelatedQuickNoteParam(params, "relatedRef"), requestSignal);
11826
11734
  case "source.message-preparing.report":
11827
11735
  case "source.message-preparing.cancel": {
@@ -12556,7 +12464,8 @@ function createHarnessEmbedRouteHandler(options) {
12556
12464
  projectedGraph.rev = shortHash(`${projectedGraph.rev}:${rev}`);
12557
12465
  }
12558
12466
  let html = replaceHarnessBootGraph(await options.readRootHtml(request), fullGraph, projectedGraph);
12559
- if (options.sessionClient !== void 0) {
12467
+ if (options.selectionClientRevision && /^[a-f0-9]+$/.test(options.selectionClientRevision)) html = html.replace("</head>", `<meta name="arkme-native-selection" content="/arkme-self/harness-native-selection-client.js?rev=${options.selectionClientRevision}"></head>`);
12468
+ if (options.sessionClient?.apiPath !== void 0) {
12560
12469
  const apiPath = options.sessionClient.apiPath;
12561
12470
  if (!/^\/[A-Za-z0-9/_-]+$/.test(apiPath) || !html.includes("</head>")) throw new Error("harness session observer configuration is invalid");
12562
12471
  html = html.replace("</head>", `<meta name="arkme-session-api" content="${apiPath}"></head>`);
@@ -16593,10 +16502,9 @@ async function parseHttpError(response) {
16593
16502
  }
16594
16503
  function requestImageAttachments(options) {
16595
16504
  const result = [];
16596
- for (const message of options.messages) {
16597
- if (message.role !== "user") continue;
16598
- for (const block of message.content) if (block.type === "image") result.push(block.attachment);
16599
- }
16505
+ for (const message of options.messages) if (message.role === "system") assertTextOnly(message.content, "系统消息");
16506
+ else if (message.role === "assistant") assertAssistantBlocks(message.content);
16507
+ else for (const block of userContentLeaves(message.content)) if (block.type === "image") result.push(block.attachment);
16600
16508
  return result;
16601
16509
  }
16602
16510
  function inputAssetOwnerAttachmentScope(bearer, attachment) {
@@ -16630,15 +16538,11 @@ function assertTextOnly(blocks, location) {
16630
16538
  function assertAssistantBlocks(blocks) {
16631
16539
  for (const block of blocks) if (block.type !== "text" && block.type !== "reasoning" && block.type !== "tool-call") throw new LlmError(`助手消息不支持内容类型“${block.type}”`, "UNSUPPORTED_CONTENT");
16632
16540
  }
16633
- function assertUserBlocks(blocks) {
16634
- for (const block of blocks) {
16635
- if (block.type === "text" || block.type === "image") continue;
16636
- if (block.type === "tool-result") {
16637
- assertTextOnly(block.content, "工具结果");
16638
- continue;
16639
- }
16640
- throw new LlmError(`用户消息不支持内容类型“${block.type}”`, "UNSUPPORTED_CONTENT");
16641
- }
16541
+ /** One traversal for validation, image accounting and tool-result serialization. */
16542
+ function* userContentLeaves(blocks) {
16543
+ for (const block of blocks) if (block.type === "text" || block.type === "image") yield block;
16544
+ else if (block.type === "tool-result") yield* userContentLeaves(block.content);
16545
+ else throw new LlmError(`用户或工具结果不支持内容类型“${block.type}”`, "UNSUPPORTED_CONTENT");
16642
16546
  }
16643
16547
  function limitConcurrency(maximum, operation, signal) {
16644
16548
  let active = 0;
@@ -16703,47 +16607,78 @@ function serializeAssistant(message) {
16703
16607
  };
16704
16608
  }
16705
16609
  async function serializeMessages(messages, resolveImage, signal) {
16706
- for (const message of messages) if (message.role === "system") assertTextOnly(message.content, "系统消息");
16707
- else if (message.role === "assistant") assertAssistantBlocks(message.content);
16708
- else assertUserBlocks(message.content);
16709
16610
  const resolveImageLimited = limitConcurrency(MAX_CONCURRENT_INPUT_ASSET_UPLOADS, resolveImage, signal);
16710
- return (await Promise.all(messages.map(async (message) => {
16711
- if (message.role === "system") return [{
16712
- role: "system",
16713
- content: flattenText(message.content)
16714
- }];
16715
- if (message.role === "assistant") return [serializeAssistant(message)];
16611
+ const contentParts = async (blocks) => (await Promise.all(Array.from(userContentLeaves(blocks), async (block) => block.type === "text" ? {
16612
+ type: "text",
16613
+ text: block.text
16614
+ } : {
16615
+ type: "image_asset",
16616
+ asset_ref: await resolveImageLimited(block.attachment)
16617
+ }))).filter((part) => part.type !== "text" || part.text.length > 0);
16618
+ const groups = await Promise.all(messages.map(async (message) => {
16619
+ if (message.role === "system") return {
16620
+ regular: {
16621
+ role: "system",
16622
+ content: flattenText(message.content)
16623
+ },
16624
+ tools: [],
16625
+ toolImages: []
16626
+ };
16627
+ if (message.role === "assistant") return {
16628
+ regular: serializeAssistant(message),
16629
+ tools: [],
16630
+ toolImages: []
16631
+ };
16716
16632
  const toolResults = message.content.filter((block) => block.type === "tool-result");
16717
- const parts = (await Promise.all(message.content.map(async (block) => {
16718
- if (block.type === "text") return block.text.length === 0 ? void 0 : {
16719
- type: "text",
16720
- text: block.text
16721
- };
16722
- if (block.type === "image") return {
16723
- type: "image_asset",
16724
- asset_ref: await resolveImageLimited(block.attachment)
16725
- };
16726
- }))).filter((part) => part !== void 0);
16727
- const wire = [];
16728
- if (parts.length > 0 || toolResults.length === 0) if (parts.length === 0) wire.push({
16633
+ const [parts, results] = await Promise.all([contentParts(message.content.filter((block) => block.type !== "tool-result")), Promise.all(toolResults.map(async (result) => ({
16634
+ result,
16635
+ parts: await contentParts(result.content)
16636
+ })))]);
16637
+ let regular;
16638
+ if (parts.length > 0 || toolResults.length === 0) regular = {
16729
16639
  role: "user",
16730
- content: ""
16731
- });
16732
- else if (parts.every((part) => part.type === "text")) wire.push({
16733
- role: "user",
16734
- content: parts.map((part) => part.type === "text" ? part.text : "").join("")
16735
- });
16736
- else wire.push({
16640
+ content: parts.every((part) => part.type === "text") ? parts.map((part) => part.type === "text" ? part.text : "").join("") : parts
16641
+ };
16642
+ const tools = [];
16643
+ const toolImages = [];
16644
+ for (const { result, parts: resultParts } of results) {
16645
+ tools.push({
16646
+ role: "tool",
16647
+ tool_call_id: String(result.toolCallId),
16648
+ content: resultParts.map((part) => part.type === "text" ? part.text : "").join("") || "(no output)"
16649
+ });
16650
+ const images = resultParts.filter((part) => part.type === "image_asset");
16651
+ if (images.length > 0) toolImages.push({
16652
+ type: "text",
16653
+ text: `Images from tool call ${String(result.toolCallId)}:`
16654
+ }, ...images);
16655
+ }
16656
+ return {
16657
+ ...regular === void 0 ? {} : { regular },
16658
+ tools,
16659
+ toolImages
16660
+ };
16661
+ }));
16662
+ const wire = [];
16663
+ let pendingToolImages = [];
16664
+ const flushToolImages = () => {
16665
+ if (pendingToolImages.length === 0) return;
16666
+ wire.push({
16737
16667
  role: "user",
16738
- content: parts
16739
- });
16740
- for (const result of toolResults) wire.push({
16741
- role: "tool",
16742
- tool_call_id: String(result.toolCallId),
16743
- content: flattenText(result.content) || "(no output)"
16668
+ content: pendingToolImages
16744
16669
  });
16745
- return wire;
16746
- }))).flat();
16670
+ pendingToolImages = [];
16671
+ };
16672
+ for (const group of groups) {
16673
+ if (group.regular !== void 0) {
16674
+ flushToolImages();
16675
+ wire.push(group.regular);
16676
+ }
16677
+ wire.push(...group.tools);
16678
+ pendingToolImages.push(...group.toolImages);
16679
+ }
16680
+ flushToolImages();
16681
+ return wire;
16747
16682
  }
16748
16683
  async function serializeRequest(options, resolveImage, signal) {
16749
16684
  const messages = [];
@@ -17351,6 +17286,10 @@ function managedAiLocalizedFailure(facts) {
17351
17286
  code: facts.code,
17352
17287
  message: "无法读取历史图片,请检查本地附件存储后重试"
17353
17288
  };
17289
+ if (facts.code === "UNSUPPORTED_CONTENT") return {
17290
+ code: facts.code,
17291
+ message: "当前模型或图片服务不支持这类内容,请检查模型选择和附件后重试"
17292
+ };
17354
17293
  if (facts.code === "CONTEXT_WINDOW_EXCEEDED") return {
17355
17294
  code: facts.code,
17356
17295
  message: "对话内容过长,请新建对话或减少上下文后重试"
@@ -36511,7 +36450,7 @@ function apply(ctx, config) {
36511
36450
  ...config,
36512
36451
  fileStateDirectory: join(stateDirectory, "files"),
36513
36452
  recordingImportDirectory: join(stateDirectory, "recording-imports")
36514
- }, sessionStore, localDatabase, fetch, pendingSessionStore);
36453
+ }, sessionStore, localDatabase, fetch, pendingSessionStore, void 0, void 0, void 0, () => ctx.get("sessionQuery"));
36515
36454
  const openApiMcpCredentialNamespace = `${config.keychainServicePrefix}.${config.environment}.openapi-mcp`;
36516
36455
  const openApiMcpController = new ManagedOpenApiMcpController({
36517
36456
  mountMcp: config.openApiMcpEnabled,
@@ -36884,11 +36823,11 @@ function apply(ctx, config) {
36884
36823
  expectedPort: ctx.webServer.port,
36885
36824
  allowNonLoopback: config.allowNonLoopback
36886
36825
  });
36887
- const sessionClient = config.dshRemoteFeatureEnabled ? {
36826
+ const sessionClient = {
36888
36827
  source: readFileSync(new URL("../lib/harness-session-client.js", import.meta.url)),
36889
- apiPath: config.routePath
36890
- } : void 0;
36891
- if (sessionClient !== void 0) ctx.effect(() => ctx.webServer.register({
36828
+ ...config.dshRemoteFeatureEnabled ? { apiPath: config.routePath } : {}
36829
+ };
36830
+ ctx.effect(() => ctx.webServer.register({
36892
36831
  kind: "exact",
36893
36832
  path: HARNESS_SESSION_CLIENT_PATH,
36894
36833
  handler: (_request, response) => {
@@ -36903,6 +36842,24 @@ function apply(ctx, config) {
36903
36842
  const harnessOnboardingClient = readFileSync(new URL("../lib/harness-onboarding-client.js", import.meta.url));
36904
36843
  const harnessTrajectoryClient = readFileSync(new URL("../lib/harness-trajectory-client.js", import.meta.url));
36905
36844
  const harnessSidebarClient = readFileSync(new URL("../lib/harness-sidebar-client.js", import.meta.url));
36845
+ let selectionClientRevision;
36846
+ try {
36847
+ const selectionClient = readFileSync(new URL("../lib/harness-native-selection-client.js", import.meta.url));
36848
+ selectionClientRevision = createHash("sha256").update(selectionClient).digest("hex");
36849
+ ctx.effect(() => ctx.webServer.register({
36850
+ kind: "exact",
36851
+ path: ARKME_NATIVE_SELECTION_CLIENT_PATH,
36852
+ handler: (_request, response) => {
36853
+ response.writeHead(200, {
36854
+ "Content-Type": "application/javascript",
36855
+ "Cache-Control": "no-cache"
36856
+ });
36857
+ response.end(selectionClient);
36858
+ }
36859
+ }), "arkme: optional native selection asset");
36860
+ } catch {
36861
+ ctx.logger.warn("dsh-arkme: optional native selection asset unavailable");
36862
+ }
36906
36863
  ctx.effect(() => ctx.webServer.register({
36907
36864
  kind: "exact",
36908
36865
  path: ARKME_HARNESS_SIDEBAR_CLIENT_PATH,
@@ -36937,6 +36894,7 @@ function apply(ctx, config) {
36937
36894
  }
36938
36895
  }), "arkme: Harness onboarding bridge asset");
36939
36896
  const harnessEmbedHandler = createHarnessEmbedRouteHandler({
36897
+ ...selectionClientRevision === void 0 ? {} : { selectionClientRevision },
36940
36898
  sidebarClient: {
36941
36899
  id: "@senguoyun/dsh-arkme/harness-sidebar",
36942
36900
  url: ARKME_HARNESS_SIDEBAR_CLIENT_PATH,
@@ -36953,10 +36911,10 @@ function apply(ctx, config) {
36953
36911
  rev: createHash("sha256").update(harnessOnboardingClient).digest("hex"),
36954
36912
  external: ["react"]
36955
36913
  },
36956
- ...sessionClient === void 0 ? {} : { sessionClient: {
36914
+ sessionClient: {
36957
36915
  revision: createHash("sha256").update(sessionClient.source).digest("hex").slice(0, 12),
36958
- apiPath: sessionClient.apiPath
36959
- } },
36916
+ ..."apiPath" in sessionClient ? { apiPath: sessionClient.apiPath } : {}
36917
+ },
36960
36918
  modelClient: {
36961
36919
  id: "@senguoyun/dsh-arkme/harness-model",
36962
36920
  url: ARKME_HARNESS_MODEL_CLIENT_PATH,
@@ -1,2 +1,2 @@
1
- import { a as persistentArkmeExtensionActive, i as invokePersistentArkmeExtension, n as applyPersistentArkmeHostExtension, o as persistentArkmeExtensionRuntimeState, r as deactivatePersistentArkmeExtension, t as activatePersistentArkmeExtension } from "./persistent-runtime-ByM3JB3z.js";
1
+ import { a as persistentArkmeExtensionActive, i as invokePersistentArkmeExtension, n as applyPersistentArkmeHostExtension, o as persistentArkmeExtensionRuntimeState, r as deactivatePersistentArkmeExtension, t as activatePersistentArkmeExtension } from "./persistent-runtime-CXd9RuRR.js";
2
2
  export { activatePersistentArkmeExtension, applyPersistentArkmeHostExtension, deactivatePersistentArkmeExtension, invokePersistentArkmeExtension, persistentArkmeExtensionActive, persistentArkmeExtensionRuntimeState };