@senguoyun/dsh-arkme 0.1.78 → 0.1.79

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 (52) hide show
  1. package/lib/client.js +912 -108
  2. package/lib/client.js.map +1 -1
  3. package/lib/harness-model-client.js +11 -3
  4. package/lib/harness-native-selection-client.js +11 -3
  5. package/lib/index.js +29 -1
  6. package/lib/persistent-extension.js +1 -1
  7. package/lib/{persistent-runtime-aiHgSAmj.js → persistent-runtime-CB7mEj3E.js} +404 -107
  8. package/lib/types/arkme-service.d.ts +9 -0
  9. package/lib/types/arkme-service.d.ts.map +1 -1
  10. package/lib/types/client/ArkmeAccountCancellation.d.ts +8 -0
  11. package/lib/types/client/ArkmeAccountCancellation.d.ts.map +1 -0
  12. package/lib/types/client/ArkmeLogin.d.ts +3 -0
  13. package/lib/types/client/ArkmeLogin.d.ts.map +1 -1
  14. package/lib/types/client/ArkmeRecordingSurface.d.ts +2 -1
  15. package/lib/types/client/ArkmeRecordingSurface.d.ts.map +1 -1
  16. package/lib/types/client/ArkmeSearchSurface.d.ts.map +1 -1
  17. package/lib/types/client/ArkmeSettingsSurface.d.ts +5 -0
  18. package/lib/types/client/ArkmeSettingsSurface.d.ts.map +1 -1
  19. package/lib/types/client/arkme-auth-flow.d.ts.map +1 -1
  20. package/lib/types/client/arkme-login-locales.d.ts +6 -0
  21. package/lib/types/client/arkme-login-locales.d.ts.map +1 -1
  22. package/lib/types/client/auth-store.d.ts.map +1 -1
  23. package/lib/types/client/locales/actions-en.d.ts.map +1 -1
  24. package/lib/types/client/recordings/RecordingSearchRow.d.ts +5 -0
  25. package/lib/types/client/recordings/RecordingSearchRow.d.ts.map +1 -0
  26. package/lib/types/client/recordings/recording-search-target.d.ts +4 -0
  27. package/lib/types/client/recordings/recording-search-target.d.ts.map +1 -0
  28. package/lib/types/client/ui-controller.d.ts +3 -5
  29. package/lib/types/client/ui-controller.d.ts.map +1 -1
  30. package/lib/types/host-api.d.ts.map +1 -1
  31. package/lib/types/index.d.ts +1 -1
  32. package/lib/types/index.d.ts.map +1 -1
  33. package/lib/types/local-database.d.ts +2 -0
  34. package/lib/types/local-database.d.ts.map +1 -1
  35. package/lib/types/recording-presentation.d.ts +1 -0
  36. package/lib/types/recording-presentation.d.ts.map +1 -1
  37. package/lib/types/recording-search-result.d.ts +3 -0
  38. package/lib/types/recording-search-result.d.ts.map +1 -0
  39. package/lib/types/recording-search-version.d.ts +17 -0
  40. package/lib/types/recording-search-version.d.ts.map +1 -0
  41. package/lib/types/services/auth-service.d.ts +20 -1
  42. package/lib/types/services/auth-service.d.ts.map +1 -1
  43. package/lib/types/services/recording-service.d.ts.map +1 -1
  44. package/lib/types/services/search-service.d.ts +3 -1
  45. package/lib/types/services/search-service.d.ts.map +1 -1
  46. package/lib/types/services/service.d.ts +3 -0
  47. package/lib/types/services/service.d.ts.map +1 -1
  48. package/lib/types/state-store.d.ts +7 -0
  49. package/lib/types/state-store.d.ts.map +1 -1
  50. package/lib/types/types.d.ts +45 -2
  51. package/lib/types/types.d.ts.map +1 -1
  52. package/package.json +5 -5
@@ -1756,7 +1756,7 @@ Arkme 用户 {v0}|Arkme user {v0}
1756
1756
  return current.revision + 1;
1757
1757
  }
1758
1758
  function sameAuth(left, right) {
1759
- return left?.status === right?.status && left?.environment === right?.environment && left?.userId === right?.userId && left?.attemptId === right?.attemptId && left?.expiresAtMillis === right?.expiresAtMillis;
1759
+ return left?.status === right?.status && left?.environment === right?.environment && left?.userId === right?.userId && left?.attemptId === right?.attemptId && left?.expiresAtMillis === right?.expiresAtMillis && left?.restDaysCancel === right?.restDaysCancel && left?.cancellationNotice === right?.cancellationNotice;
1760
1760
  }
1761
1761
  var ArkmeAuthStore = class {
1762
1762
  state = {
@@ -1779,6 +1779,10 @@ Arkme 用户 {v0}|Arkme user {v0}
1779
1779
  };
1780
1780
  setAuth(auth) {
1781
1781
  if (sameAuth(this.state.auth, auth) && this.state.checked && !this.state.busy && this.state.error === "") return;
1782
+ if (!["authenticated", "binding-required"].includes(auth.status) && auth.cancellationNotice === void 0 && this.state.auth?.cancellationNotice !== void 0) auth = {
1783
+ ...auth,
1784
+ cancellationNotice: this.state.auth.cancellationNotice
1785
+ };
1782
1786
  this.authGeneration += 1;
1783
1787
  this.publish({
1784
1788
  ...this.state,
@@ -1809,8 +1813,12 @@ Arkme 用户 {v0}|Arkme user {v0}
1809
1813
  });
1810
1814
  const pending = Promise.all([callArkme("auth.status"), callArkme("auth.config")]).then(([auth, config]) => {
1811
1815
  const currentAuth = this.state.auth;
1812
- const preservePendingAttempt = currentAuth?.status === "pending" && (auth.status === "logged-out" || auth.status === "expired");
1813
- const effectiveAuth = this.authGeneration === authGeneration && !preservePendingAttempt ? auth : currentAuth ?? auth;
1816
+ const preservePendingAttempt = (currentAuth?.status === "pending" || currentAuth?.status === "cancellation-pending") && (auth.status === "logged-out" || auth.status === "expired");
1817
+ let effectiveAuth = this.authGeneration === authGeneration && !preservePendingAttempt ? auth : currentAuth ?? auth;
1818
+ if (!["authenticated", "binding-required"].includes(effectiveAuth.status) && effectiveAuth.cancellationNotice === void 0 && currentAuth?.cancellationNotice !== void 0) effectiveAuth = {
1819
+ ...effectiveAuth,
1820
+ cancellationNotice: currentAuth.cancellationNotice
1821
+ };
1814
1822
  this.publish({
1815
1823
  ...this.state,
1816
1824
  auth: effectiveAuth,
@@ -36,7 +36,7 @@ window.__ModuleLoader__.load({
36
36
  return current.revision + 1;
37
37
  }
38
38
  function sameAuth(left, right) {
39
- return left?.status === right?.status && left?.environment === right?.environment && left?.userId === right?.userId && left?.attemptId === right?.attemptId && left?.expiresAtMillis === right?.expiresAtMillis;
39
+ return left?.status === right?.status && left?.environment === right?.environment && left?.userId === right?.userId && left?.attemptId === right?.attemptId && left?.expiresAtMillis === right?.expiresAtMillis && left?.restDaysCancel === right?.restDaysCancel && left?.cancellationNotice === right?.cancellationNotice;
40
40
  }
41
41
  var ArkmeAuthStore = class {
42
42
  state = {
@@ -59,6 +59,10 @@ window.__ModuleLoader__.load({
59
59
  };
60
60
  setAuth(auth) {
61
61
  if (sameAuth(this.state.auth, auth) && this.state.checked && !this.state.busy && this.state.error === "") return;
62
+ if (!["authenticated", "binding-required"].includes(auth.status) && auth.cancellationNotice === void 0 && this.state.auth?.cancellationNotice !== void 0) auth = {
63
+ ...auth,
64
+ cancellationNotice: this.state.auth.cancellationNotice
65
+ };
62
66
  this.authGeneration += 1;
63
67
  this.publish({
64
68
  ...this.state,
@@ -89,8 +93,12 @@ window.__ModuleLoader__.load({
89
93
  });
90
94
  const pending = Promise.all([callArkme("auth.status"), callArkme("auth.config")]).then(([auth, config]) => {
91
95
  const currentAuth = this.state.auth;
92
- const preservePendingAttempt = currentAuth?.status === "pending" && (auth.status === "logged-out" || auth.status === "expired");
93
- const effectiveAuth = this.authGeneration === authGeneration && !preservePendingAttempt ? auth : currentAuth ?? auth;
96
+ const preservePendingAttempt = (currentAuth?.status === "pending" || currentAuth?.status === "cancellation-pending") && (auth.status === "logged-out" || auth.status === "expired");
97
+ let effectiveAuth = this.authGeneration === authGeneration && !preservePendingAttempt ? auth : currentAuth ?? auth;
98
+ if (!["authenticated", "binding-required"].includes(effectiveAuth.status) && effectiveAuth.cancellationNotice === void 0 && currentAuth?.cancellationNotice !== void 0) effectiveAuth = {
99
+ ...effectiveAuth,
100
+ cancellationNotice: currentAuth.cancellationNotice
101
+ };
94
102
  this.publish({
95
103
  ...this.state,
96
104
  auth: effectiveAuth,
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as inspectNativeBundleArtifactV3, At as parseArkmeRecordReeditAttachments, Ct as isRecentEmojiId, D as bundleSha256, Dt as retryAfterMillis, E as arkmeSandboxEntryId, Et as ArkmePluginError, F as assertExtensionArtifactSize, Ft as __esmMin, G as validateVoiceprintPcm16Wav, I as canonicalExtensionJson, It as __exportAll, J as arkmeRequiredLinkMetadataFallback, K as arkmeExtensionShareRefFromLink, L as sha256Hex, Lt as __require, M as packLocalNativeBundleDirectoryV3, Mt as registerDSHAgentInputRecordSync, N as readNativeBundleTarballV3, Nt as createDesktopLifecycleReader, O as canonicalBundleJson, Ot as recordOwnerId, P as renderArkmeSandboxHostEntry, Pt as __commonJSMin, Q as ARKME_PROVIDER_CONTRACT_VERSION, R as unpackArkmeExtension, Rt as __toCommonJS, S as ARKME_BUNDLE_ARTIFACT_KIND, St as recordingImportFileNameKey, T as ArkmeBundleArtifactError, Tt as registerManagedAiProvider, U as ARKME_EXTENSION_RUNTIME_UNAVAILABLE_MESSAGE, W as ArkmeService, X as arkmeRichBackgroundSound, Y as arkmeFileBackgroundSound, Z as ARKME_DEFAULT_SHARE_WEBSITE, _ as arkmeClientContentDigest, _t as isRecordingInstantOnOrAfterUnixEpoch, at as cachedMemberItem, b as verifyExtensionResolutionSignature, bt as sameRecordingImportIdentity, c as persistentExtensionBundleDirectory, ct as ARKME_RUNTIME_INSTANCE_ID, d as readPersistentExtensionActivation, dt as arkmeNormalizedFileMimeType, f as refreshPersistentClientWrapper, ft as arkmePickedFileKind, g as activeProfileExtensionOwnerConflicts, gt as ArkmeDirectMessageAdmissionError, h as renderArkmeBundleClientBundle, ht as SecretValue, i as invokePersistentArkmeExtension, it as applyMemberUpdate, j as packBundleFiles, jt as parseArkmeRecordReeditMentions, k as inspectBundleArtifact, kt as ArkmeRecordReeditDraftConflict, l as persistentExtensionPackageIdentity, lt as ARKME_TOOL_FILE_MAX_BYTES, m as writePersistentExtensionActivation, mt as ArkmeOutgoingCallError, nt as ARKME_WORLD_PUBLISH_MAX_IMAGES, o as persistentArkmeExtensionRuntimeState, ot as mergeMemberJoinEvents, p as repairPersistentExtensionInstallation, pt as isArkmeBotAvatarRef, q as arkmeIsGenericLinkMetadataTitle, r as deactivatePersistentArkmeExtension, rt as ARKME_WORLD_PUBLISH_MAX_IMAGE_BYTES, s as materializePersistentExtensionBundle, st as validateMemberUpdate, t as activatePersistentArkmeExtension, u as quarantinePersistentExtension, ut as arkmeCanInlineLocalFile, v as arkmeClientContentDigestFromSource, vt as isUnresolvedRecordingImportJob, w as ARKME_NATIVE_BUNDLE_ARTIFACT_KIND, wt as normalizeRecentEmojiIds, x as verifyNativeBundleResolutionSignature, y as verifyBundleResolutionSignature, yt as recordingImportFileKind, z as ARKME_EXTENSION_FORMAT } from "./persistent-runtime-aiHgSAmj.js";
1
+ import { A as inspectNativeBundleArtifactV3, At as parseArkmeRecordReeditAttachments, Ct as isRecentEmojiId, D as bundleSha256, Dt as retryAfterMillis, E as arkmeSandboxEntryId, Et as ArkmePluginError, F as assertExtensionArtifactSize, Ft as __esmMin, G as validateVoiceprintPcm16Wav, I as canonicalExtensionJson, It as __exportAll, J as arkmeRequiredLinkMetadataFallback, K as arkmeExtensionShareRefFromLink, L as sha256Hex, Lt as __require, M as packLocalNativeBundleDirectoryV3, Mt as registerDSHAgentInputRecordSync, N as readNativeBundleTarballV3, Nt as createDesktopLifecycleReader, O as canonicalBundleJson, Ot as recordOwnerId, P as renderArkmeSandboxHostEntry, Pt as __commonJSMin, Q as ARKME_PROVIDER_CONTRACT_VERSION, R as unpackArkmeExtension, Rt as __toCommonJS, S as ARKME_BUNDLE_ARTIFACT_KIND, St as recordingImportFileNameKey, T as ArkmeBundleArtifactError, Tt as registerManagedAiProvider, U as ARKME_EXTENSION_RUNTIME_UNAVAILABLE_MESSAGE, W as ArkmeService, X as arkmeRichBackgroundSound, Y as arkmeFileBackgroundSound, Z as ARKME_DEFAULT_SHARE_WEBSITE, _ as arkmeClientContentDigest, _t as isRecordingInstantOnOrAfterUnixEpoch, at as cachedMemberItem, b as verifyExtensionResolutionSignature, bt as sameRecordingImportIdentity, c as persistentExtensionBundleDirectory, ct as ARKME_RUNTIME_INSTANCE_ID, d as readPersistentExtensionActivation, dt as arkmeNormalizedFileMimeType, f as refreshPersistentClientWrapper, ft as arkmePickedFileKind, g as activeProfileExtensionOwnerConflicts, gt as ArkmeDirectMessageAdmissionError, h as renderArkmeBundleClientBundle, ht as SecretValue, i as invokePersistentArkmeExtension, it as applyMemberUpdate, j as packBundleFiles, jt as parseArkmeRecordReeditMentions, k as inspectBundleArtifact, kt as ArkmeRecordReeditDraftConflict, l as persistentExtensionPackageIdentity, lt as ARKME_TOOL_FILE_MAX_BYTES, m as writePersistentExtensionActivation, mt as ArkmeOutgoingCallError, nt as ARKME_WORLD_PUBLISH_MAX_IMAGES, o as persistentArkmeExtensionRuntimeState, ot as mergeMemberJoinEvents, p as repairPersistentExtensionInstallation, pt as isArkmeBotAvatarRef, q as arkmeIsGenericLinkMetadataTitle, r as deactivatePersistentArkmeExtension, rt as ARKME_WORLD_PUBLISH_MAX_IMAGE_BYTES, s as materializePersistentExtensionBundle, st as validateMemberUpdate, t as activatePersistentArkmeExtension, u as quarantinePersistentExtension, ut as arkmeCanInlineLocalFile, v as arkmeClientContentDigestFromSource, vt as isUnresolvedRecordingImportJob, w as ARKME_NATIVE_BUNDLE_ARTIFACT_KIND, wt as normalizeRecentEmojiIds, x as verifyNativeBundleResolutionSignature, y as verifyBundleResolutionSignature, yt as recordingImportFileKind, z as ARKME_EXTENSION_FORMAT } from "./persistent-runtime-CB7mEj3E.js";
2
2
  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-Cwi2iuHi.js";
3
3
  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-BWIKYugE.js";
4
4
  import { i as invokeArkmeBundle, n as arkmeBundleActive, r as deactivateArkmeBundle } from "./bundle-runtime-QUG0eHSZ.js";
@@ -14299,11 +14299,16 @@ async function dispatchArkmeHostOperation(service, operation, params, updateMana
14299
14299
  case "auth.app.poll": return await service.pollJiwoLogin(stringParam(params, "attemptId"));
14300
14300
  case "auth.app.cancel": return await service.cancelJiwoLogin(stringParam(params, "attemptId"));
14301
14301
  case "auth.test.login": return await service.testLogin(numberParam(params, "userId", 0));
14302
+ case "auth.email.send": return await service.sendEmailBindCode(numberParam(params, "expectedUserId", 0), stringParam(params, "email"));
14303
+ case "auth.email.bind": return await service.bindEmail(numberParam(params, "expectedUserId", 0), stringParam(params, "email"), stringParam(params, "code"));
14302
14304
  case "auth.phone.send": return await service.sendPhoneCode(stringParam(params, "phone"), captchaParam(params));
14303
14305
  case "auth.phone.unbind.check": return await service.checkPhoneUnbindEligibility(numberParam(params, "expectedUserId", 0));
14304
14306
  case "auth.phone.unbind.send": return await service.sendPhoneUnbindCode(captchaParam(params));
14305
14307
  case "auth.phone.unbind": return await service.unbindPhone(stringParam(params, "code"));
14306
14308
  case "auth.phone.verify": return await service.verifyPhoneCode(stringParam(params, "phone"), stringParam(params, "code"));
14309
+ case "auth.cancellation.preview": return await service.previewCancellation(numberParam(params, "expectedUserId", 0));
14310
+ case "auth.cancellation.submit": return await service.submitCancellation(numberParam(params, "expectedUserId", 0), stringParam(params, "expectedMode"));
14311
+ case "auth.cancellation.login.resolve": return await service.resolveCancellationLogin(requiredBooleanParam(params, "continueLogin"));
14307
14312
  case "auth.logout": return await service.logout();
14308
14313
  case "chat.direct-message-admission": return await service.directMessageAdmission(stringParam(params, "sourceRef"), requestSignal);
14309
14314
  case "chat.direct-message-refusal.set": return await service.setDirectMessageRefusal(stringParam(params, "sourceRef"), requiredBooleanParam(params, "refused"), numberParam(params, "expectedRevision", -1), requestSignal);
@@ -19533,6 +19538,12 @@ var ArkmeLocalDatabase = class {
19533
19538
  if (!this.database.prepare("PRAGMA table_info(user_profile_cache)").all().some((column) => column.name === "can_update_arkme_id")) this.database.exec("ALTER TABLE user_profile_cache ADD COLUMN can_update_arkme_id INTEGER");
19534
19539
  this.secureDatabaseFiles();
19535
19540
  }
19541
+ async readCancellationCompletion() {
19542
+ return await this.operationalState.readCancellationCompletion();
19543
+ }
19544
+ async writeCancellationCompletion(completion) {
19545
+ await this.operationalState.writeCancellationCompletion(completion);
19546
+ }
19536
19547
  async uniqueCode() {
19537
19548
  return await this.operationalState.uniqueCode();
19538
19549
  }
@@ -24804,6 +24815,12 @@ function legacyRecordReeditRevision(drafts, submissions) {
24804
24815
  }
24805
24816
  return revision;
24806
24817
  }
24818
+ function validCancellationCompletion(value) {
24819
+ if (value === null || typeof value !== "object") return false;
24820
+ const candidate = value;
24821
+ const result = candidate.result;
24822
+ return Number.isSafeInteger(candidate.userId) && candidate.userId > 0 && typeof candidate.sessionHash === "string" && /^[a-f0-9]{64}$/.test(candidate.sessionHash) && result != null && ["immediate", "waiting"].includes(result.mode) && ["done", "waiting"].includes(result.status) && Number.isSafeInteger(result.cancel_at) && typeof result.has_phone === "boolean";
24823
+ }
24807
24824
  function parseState(raw) {
24808
24825
  const parsed = JSON.parse(raw);
24809
24826
  if (parsed === null || typeof parsed !== "object") return emptyState$1();
@@ -24835,6 +24852,7 @@ function parseState(raw) {
24835
24852
  return {
24836
24853
  version: 2,
24837
24854
  uniqueCode: typeof source.uniqueCode === "string" && source.uniqueCode.trim() !== "" ? source.uniqueCode : randomUUID(),
24855
+ ...validCancellationCompletion(source.cancellationCompletion) ? { cancellationCompletion: source.cancellationCompletion } : {},
24838
24856
  pendingByUser,
24839
24857
  longArticleDraftsByUser,
24840
24858
  recordReeditDraftsByUser,
@@ -24908,6 +24926,16 @@ var ArkmeStateStore = class {
24908
24926
  constructor(directory) {
24909
24927
  this.path = join(directory, "state.json");
24910
24928
  }
24929
+ async readCancellationCompletion() {
24930
+ return await this.read((state) => state.cancellationCompletion === void 0 ? void 0 : structuredClone(state.cancellationCompletion));
24931
+ }
24932
+ async writeCancellationCompletion(completion) {
24933
+ if (completion !== void 0 && !validCancellationCompletion(completion)) throw new Error("注销完成记录无效");
24934
+ await this.update((state) => {
24935
+ if (completion === void 0) delete state.cancellationCompletion;
24936
+ else state.cancellationCompletion = structuredClone(completion);
24937
+ });
24938
+ }
24911
24939
  async uniqueCode() {
24912
24940
  return await this.read((state) => state.uniqueCode);
24913
24941
  }
@@ -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-aiHgSAmj.js";
1
+ import { a as persistentArkmeExtensionActive, i as invokePersistentArkmeExtension, n as applyPersistentArkmeHostExtension, o as persistentArkmeExtensionRuntimeState, r as deactivatePersistentArkmeExtension, t as activatePersistentArkmeExtension } from "./persistent-runtime-CB7mEj3E.js";
2
2
  export { activatePersistentArkmeExtension, applyPersistentArkmeHostExtension, deactivatePersistentArkmeExtension, invokePersistentArkmeExtension, persistentArkmeExtensionActive, persistentArkmeExtensionRuntimeState };