@senguoyun/dsh-arkme 0.1.33 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/plugin-release.md +14 -1
- package/lib/client.js +36141 -32483
- package/lib/client.js.map +1 -1
- package/lib/index.js +162 -16
- package/lib/persistent-extension.js +1 -1
- package/lib/{persistent-runtime-DUqdJv8K.js → persistent-runtime-e4gV6dqq.js} +1775 -710
- package/lib/sdk.js +19 -0
- package/lib/types/arkme-service.d.ts +13 -1
- package/lib/types/arkme-service.d.ts.map +1 -1
- package/lib/types/billing-gateway.d.ts.map +1 -1
- package/lib/types/client/ArkmeAvatar.d.ts +16 -10
- package/lib/types/client/ArkmeAvatar.d.ts.map +1 -1
- package/lib/types/client/ArkmeBillingSettings.d.ts +4 -0
- package/lib/types/client/ArkmeBillingSettings.d.ts.map +1 -1
- package/lib/types/client/ArkmeCalendarSurface.d.ts.map +1 -1
- package/lib/types/client/ArkmeCallHistorySurface.d.ts.map +1 -1
- package/lib/types/client/ArkmeCallSurface.d.ts.map +1 -1
- package/lib/types/client/ArkmeChatMemberActions.d.ts +4 -3
- package/lib/types/client/ArkmeChatMemberActions.d.ts.map +1 -1
- package/lib/types/client/ArkmeExtensionReviews.d.ts +2 -1
- package/lib/types/client/ArkmeExtensionReviews.d.ts.map +1 -1
- package/lib/types/client/ArkmeGroupChatControls.d.ts.map +1 -1
- package/lib/types/client/ArkmeMarketplace.d.ts +4 -2
- package/lib/types/client/ArkmeMarketplace.d.ts.map +1 -1
- package/lib/types/client/ArkmeMessageReportDialog.d.ts +8 -0
- package/lib/types/client/ArkmeMessageReportDialog.d.ts.map +1 -0
- package/lib/types/client/ArkmeMessageSnapshotDialog.d.ts +17 -0
- package/lib/types/client/ArkmeMessageSnapshotDialog.d.ts.map +1 -0
- package/lib/types/client/ArkmeNoteDetails.d.ts.map +1 -1
- package/lib/types/client/ArkmeOutgoingCallHost.d.ts.map +1 -1
- package/lib/types/client/ArkmePersistentShell.d.ts.map +1 -1
- package/lib/types/client/ArkmeRelatedQuickNotes.d.ts +47 -0
- package/lib/types/client/ArkmeRelatedQuickNotes.d.ts.map +1 -0
- package/lib/types/client/ArkmeRichComposerInput.d.ts +3 -1
- package/lib/types/client/ArkmeRichComposerInput.d.ts.map +1 -1
- package/lib/types/client/ArkmeSearchSurface.d.ts.map +1 -1
- package/lib/types/client/ArkmeSettingsSurface.d.ts.map +1 -1
- package/lib/types/client/ArkmeSidebar.d.ts +7 -4
- package/lib/types/client/ArkmeSidebar.d.ts.map +1 -1
- package/lib/types/client/ArkmeVirtualWorkspace.d.ts.map +1 -1
- package/lib/types/client/ArkmeWorldSurface.d.ts +6 -1
- package/lib/types/client/ArkmeWorldSurface.d.ts.map +1 -1
- package/lib/types/client/api.d.ts +1 -1
- package/lib/types/client/api.d.ts.map +1 -1
- package/lib/types/client/arkme-billing.d.ts +7 -1
- package/lib/types/client/arkme-billing.d.ts.map +1 -1
- package/lib/types/client/avatar-image-runtime.d.ts +3 -0
- package/lib/types/client/avatar-image-runtime.d.ts.map +1 -0
- package/lib/types/client/avatar-image-store.d.ts +44 -0
- package/lib/types/client/avatar-image-store.d.ts.map +1 -0
- package/lib/types/client/calendar-invalidation-store.d.ts +26 -0
- package/lib/types/client/calendar-invalidation-store.d.ts.map +1 -0
- package/lib/types/client/chat-directory-store.d.ts +23 -13
- package/lib/types/client/chat-directory-store.d.ts.map +1 -1
- package/lib/types/client/composer-draft-store.d.ts +3 -3
- package/lib/types/client/composer-draft-store.d.ts.map +1 -1
- package/lib/types/client/composer-placeholder.d.ts +13 -0
- package/lib/types/client/composer-placeholder.d.ts.map +1 -0
- package/lib/types/client/conversation-memory-cache.d.ts +11 -14
- package/lib/types/client/conversation-memory-cache.d.ts.map +1 -1
- package/lib/types/client/file-send-tasks.d.ts +3 -1
- package/lib/types/client/file-send-tasks.d.ts.map +1 -1
- package/lib/types/client/interwoven-moments.d.ts +13 -2
- package/lib/types/client/interwoven-moments.d.ts.map +1 -1
- package/lib/types/client/navigation-cache.d.ts.map +1 -1
- package/lib/types/client/presentation-maintenance-runtime.d.ts +13 -0
- package/lib/types/client/presentation-maintenance-runtime.d.ts.map +1 -0
- package/lib/types/client/provider-instance-runtime.d.ts +5 -2
- package/lib/types/client/provider-instance-runtime.d.ts.map +1 -1
- package/lib/types/client/realtime-client-events.d.ts +6 -0
- package/lib/types/client/realtime-client-events.d.ts.map +1 -1
- package/lib/types/client/record-capture-location.d.ts +8 -0
- package/lib/types/client/record-capture-location.d.ts.map +1 -0
- package/lib/types/client/redesign/contacts/contacts-tab-store.d.ts.map +1 -1
- package/lib/types/client/related-recordings.d.ts +1 -1
- package/lib/types/client/source-identity.d.ts +5 -0
- package/lib/types/client/source-identity.d.ts.map +1 -0
- package/lib/types/client/ui-controller.d.ts +6 -0
- package/lib/types/client/ui-controller.d.ts.map +1 -1
- package/lib/types/client/use-arkme-avatar-image.d.ts +3 -0
- package/lib/types/client/use-arkme-avatar-image.d.ts.map +1 -0
- package/lib/types/extensions/manager.d.ts.map +1 -1
- package/lib/types/extensions/types.d.ts +1 -0
- package/lib/types/extensions/types.d.ts.map +1 -1
- package/lib/types/host-api.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/local-database.d.ts +1 -0
- package/lib/types/local-database.d.ts.map +1 -1
- package/lib/types/request-coordinator.d.ts.map +1 -1
- package/lib/types/sdk/index.d.ts +7 -2
- package/lib/types/sdk/index.d.ts.map +1 -1
- package/lib/types/services/chat-realtime-service.d.ts.map +1 -1
- package/lib/types/services/chat-service.d.ts +21 -2
- package/lib/types/services/chat-service.d.ts.map +1 -1
- package/lib/types/services/group-ai-polish-service.d.ts +3 -1
- package/lib/types/services/group-ai-polish-service.d.ts.map +1 -1
- package/lib/types/services/interwoven-service.d.ts +3 -0
- package/lib/types/services/interwoven-service.d.ts.map +1 -1
- package/lib/types/services/record-service.d.ts +10 -3
- package/lib/types/services/record-service.d.ts.map +1 -1
- package/lib/types/services/related-quick-note-service.d.ts +38 -0
- package/lib/types/services/related-quick-note-service.d.ts.map +1 -0
- package/lib/types/services/world-service.d.ts.map +1 -1
- package/lib/types/state-store.d.ts.map +1 -1
- package/lib/types/types.d.ts +111 -5
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
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-CvojZuTD.js";
|
|
2
|
-
import { $ as ARKME_RUNTIME_INSTANCE_ID, A as inspectNativeBundleArtifactV3, D as bundleSha256, E as arkmeSandboxEntryId, F as assertExtensionArtifactSize, G as validateVoiceprintPcm16Wav, I as canonicalExtensionJson, K as ARKME_DEFAULT_SHARE_WEBSITE, L as sha256Hex, M as packLocalNativeBundleDirectoryV3, N as readNativeBundleTarballV3, O as canonicalBundleJson, P as renderArkmeSandboxHostEntry, Q as ARKME_WORLD_PUBLISH_MAX_IMAGE_BYTES, R as unpackArkmeExtension, S as ARKME_BUNDLE_ARTIFACT_KIND, T as ArkmeBundleArtifactError, U as ARKME_EXTENSION_RUNTIME_UNAVAILABLE_MESSAGE, W as ArkmeService, Z as ARKME_WORLD_PUBLISH_MAX_IMAGES, _ as arkmeClientContentDigest, at as ArkmePluginError, b as verifyExtensionResolutionSignature, c as persistentExtensionBundleDirectory, d as readPersistentExtensionActivation, et as ARKME_TOOL_FILE_MAX_BYTES, f as refreshPersistentClientWrapper, g as activeProfileExtensionOwnerConflicts, h as renderArkmeBundleClientBundle, i as invokePersistentArkmeExtension, it as isArkmeBotAvatarRef, j as packBundleFiles, k as inspectBundleArtifact, l as persistentExtensionPackageIdentity, m as writePersistentExtensionActivation, nt as arkmeNormalizedFileMimeType, o as persistentArkmeExtensionRuntimeState, ot as ArkmeOutgoingCallError, p as repairPersistentExtensionInstallation, q as ARKME_PROVIDER_CONTRACT_VERSION, r as deactivatePersistentArkmeExtension, rt as arkmePickedFileKind, s as materializePersistentExtensionBundle, t as activatePersistentArkmeExtension, tt as arkmeCanInlineLocalFile, u as quarantinePersistentExtension, v as arkmeClientContentDigestFromSource, w as ARKME_NATIVE_BUNDLE_ARTIFACT_KIND, x as verifyNativeBundleResolutionSignature, y as verifyBundleResolutionSignature, z as ARKME_EXTENSION_FORMAT } from "./persistent-runtime-
|
|
2
|
+
import { $ as ARKME_RUNTIME_INSTANCE_ID, A as inspectNativeBundleArtifactV3, D as bundleSha256, E as arkmeSandboxEntryId, F as assertExtensionArtifactSize, G as validateVoiceprintPcm16Wav, I as canonicalExtensionJson, K as ARKME_DEFAULT_SHARE_WEBSITE, L as sha256Hex, M as packLocalNativeBundleDirectoryV3, N as readNativeBundleTarballV3, O as canonicalBundleJson, P as renderArkmeSandboxHostEntry, Q as ARKME_WORLD_PUBLISH_MAX_IMAGE_BYTES, R as unpackArkmeExtension, S as ARKME_BUNDLE_ARTIFACT_KIND, T as ArkmeBundleArtifactError, U as ARKME_EXTENSION_RUNTIME_UNAVAILABLE_MESSAGE, W as ArkmeService, Z as ARKME_WORLD_PUBLISH_MAX_IMAGES, _ as arkmeClientContentDigest, at as ArkmePluginError, b as verifyExtensionResolutionSignature, c as persistentExtensionBundleDirectory, d as readPersistentExtensionActivation, et as ARKME_TOOL_FILE_MAX_BYTES, f as refreshPersistentClientWrapper, g as activeProfileExtensionOwnerConflicts, h as renderArkmeBundleClientBundle, i as invokePersistentArkmeExtension, it as isArkmeBotAvatarRef, j as packBundleFiles, k as inspectBundleArtifact, l as persistentExtensionPackageIdentity, m as writePersistentExtensionActivation, nt as arkmeNormalizedFileMimeType, o as persistentArkmeExtensionRuntimeState, ot as ArkmeOutgoingCallError, p as repairPersistentExtensionInstallation, q as ARKME_PROVIDER_CONTRACT_VERSION, r as deactivatePersistentArkmeExtension, rt as arkmePickedFileKind, s as materializePersistentExtensionBundle, t as activatePersistentArkmeExtension, tt as arkmeCanInlineLocalFile, u as quarantinePersistentExtension, v as arkmeClientContentDigestFromSource, w as ARKME_NATIVE_BUNDLE_ARTIFACT_KIND, x as verifyNativeBundleResolutionSignature, y as verifyBundleResolutionSignature, z as ARKME_EXTENSION_FORMAT } from "./persistent-runtime-e4gV6dqq.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-BByw0ZyG.js";
|
|
4
4
|
import { i as invokeArkmeBundle, n as arkmeBundleActive, r as deactivateArkmeBundle } from "./bundle-runtime-BTzRlc6V.js";
|
|
5
5
|
import { t as ArkmeExtensionInstallStore } from "./install-store-C1tAM346.js";
|
|
@@ -1458,7 +1458,10 @@ function arkmeRequiredLinkMetadataFallback(rawUrl) {
|
|
|
1458
1458
|
}
|
|
1459
1459
|
//#endregion
|
|
1460
1460
|
//#region src/host-api.ts
|
|
1461
|
-
const
|
|
1461
|
+
const MAX_STANDARD_REQUEST_BYTES = 128 * 1024;
|
|
1462
|
+
const MAX_MESSAGE_ACTION_REF_CHARS = 1024 * 1024;
|
|
1463
|
+
const MAX_MESSAGE_REPORT_REF_CHARS = 4096;
|
|
1464
|
+
const MAX_REQUEST_BYTES = 1114112;
|
|
1462
1465
|
function isLoopback$5(address) {
|
|
1463
1466
|
return address === "127.0.0.1" || address === "::1" || address === "::ffff:127.0.0.1";
|
|
1464
1467
|
}
|
|
@@ -1480,6 +1483,7 @@ async function readRequest(req) {
|
|
|
1480
1483
|
if (value === null || typeof value !== "object") throw new ArkmePluginError("request-invalid", "请求格式无效", false);
|
|
1481
1484
|
const source = value;
|
|
1482
1485
|
if (typeof source.operation !== "string") throw new ArkmePluginError("operation-required", "缺少操作类型", false);
|
|
1486
|
+
if (bytes > MAX_STANDARD_REQUEST_BYTES && source.operation !== "source.related-quick-notes.from-message") throw new ArkmePluginError("request-too-large", "请求内容过大", false, 413);
|
|
1483
1487
|
return {
|
|
1484
1488
|
operation: source.operation,
|
|
1485
1489
|
...source.params !== null && typeof source.params === "object" ? { params: source.params } : {}
|
|
@@ -1517,6 +1521,43 @@ function numberParam(params, key, fallback) {
|
|
|
1517
1521
|
const value = params[key];
|
|
1518
1522
|
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
1519
1523
|
}
|
|
1524
|
+
function captureContextParam(params) {
|
|
1525
|
+
const raw = params.captureContext;
|
|
1526
|
+
if (raw === void 0) return void 0;
|
|
1527
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) throw new ArkmePluginError("capture-context-invalid", "记忆快照参数无效", false, 400);
|
|
1528
|
+
const value = raw;
|
|
1529
|
+
const clientName = stringParam(value, "clientName").trim().slice(0, 120);
|
|
1530
|
+
const networkName = stringParam(value, "networkName").trim().slice(0, 120);
|
|
1531
|
+
const electric = typeof value.electric === "number" && Number.isFinite(value.electric) ? Math.trunc(value.electric) : void 0;
|
|
1532
|
+
const charge = Math.trunc(numberParam(value, "charge", 0));
|
|
1533
|
+
const context = {
|
|
1534
|
+
...clientName === "" ? {} : { clientName },
|
|
1535
|
+
...networkName === "" ? {} : { networkName },
|
|
1536
|
+
...electric === void 0 || electric < 0 || electric > 100 ? {} : { electric },
|
|
1537
|
+
...charge < 1 || charge > 3 ? {} : { charge }
|
|
1538
|
+
};
|
|
1539
|
+
return Object.keys(context).length === 0 ? void 0 : context;
|
|
1540
|
+
}
|
|
1541
|
+
function recordLocationCaptureParam(params) {
|
|
1542
|
+
const raw = params.location;
|
|
1543
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) throw new ArkmePluginError("record-location-invalid", "位置快照参数无效", false, 400);
|
|
1544
|
+
const value = raw;
|
|
1545
|
+
const latitude = numberParam(value, "latitude", NaN);
|
|
1546
|
+
const longitude = numberParam(value, "longitude", NaN);
|
|
1547
|
+
if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90 || !Number.isFinite(longitude) || longitude < -180 || longitude > 180) throw new ArkmePluginError("record-location-invalid", "位置坐标无效", false, 400);
|
|
1548
|
+
const altitudeMeters = numberParam(value, "altitudeMeters", NaN);
|
|
1549
|
+
const speedMetersPerSecond = numberParam(value, "speedMetersPerSecond", NaN);
|
|
1550
|
+
const accuracyMeters = numberParam(value, "accuracyMeters", NaN);
|
|
1551
|
+
const capturedAtMillis = Math.trunc(numberParam(value, "capturedAtMillis", 0));
|
|
1552
|
+
return {
|
|
1553
|
+
latitude,
|
|
1554
|
+
longitude,
|
|
1555
|
+
capturedAtMillis: capturedAtMillis > 0 ? capturedAtMillis : Date.now(),
|
|
1556
|
+
...Number.isFinite(accuracyMeters) && accuracyMeters >= 0 ? { accuracyMeters } : {},
|
|
1557
|
+
...Number.isFinite(altitudeMeters) ? { altitudeMeters } : {},
|
|
1558
|
+
...Number.isFinite(speedMetersPerSecond) && speedMetersPerSecond >= 0 ? { speedMetersPerSecond } : {}
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1520
1561
|
const ARKME_DIRECTORY_SECTIONS = /* @__PURE__ */ new Set([
|
|
1521
1562
|
"groups",
|
|
1522
1563
|
"bots",
|
|
@@ -1615,6 +1656,24 @@ function stringListParam(params, key) {
|
|
|
1615
1656
|
function messageActionRefsParam(params) {
|
|
1616
1657
|
return stringListParam(params, "actionRefs").map((value) => value.trim()).filter((value) => value !== "");
|
|
1617
1658
|
}
|
|
1659
|
+
function messageReportParam(params) {
|
|
1660
|
+
const messageRef = stringParam(params, "messageRef").trim();
|
|
1661
|
+
const reportType = numberParam(params, "reportType", 0);
|
|
1662
|
+
const reason = stringParam(params, "reason").trim();
|
|
1663
|
+
const requestUid = stringParam(params, "requestUid").trim().toLowerCase();
|
|
1664
|
+
if (messageRef === "" || messageRef.length > MAX_MESSAGE_REPORT_REF_CHARS || !Number.isInteger(reportType) || ![
|
|
1665
|
+
1,
|
|
1666
|
+
2,
|
|
1667
|
+
3,
|
|
1668
|
+
4
|
|
1669
|
+
].includes(reportType) || reportType === 4 && reason === "" || [...reason].length > 500 || requestUid !== "" && !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(requestUid)) throw new ArkmePluginError("message-report-invalid", "举报类型或补充说明无效", false, 400);
|
|
1670
|
+
return {
|
|
1671
|
+
messageRef,
|
|
1672
|
+
reportType,
|
|
1673
|
+
...reason === "" ? {} : { reason },
|
|
1674
|
+
...requestUid === "" ? {} : { requestUid }
|
|
1675
|
+
};
|
|
1676
|
+
}
|
|
1618
1677
|
function aiPolishThreadMessagesParam(params) {
|
|
1619
1678
|
if (!Array.isArray(params.threadMessages)) return [];
|
|
1620
1679
|
return params.threadMessages.slice(-40).flatMap((raw) => {
|
|
@@ -1672,6 +1731,11 @@ function requiredInterwovenParam(params, key) {
|
|
|
1672
1731
|
if (value === "" || value.length > 4096) throw new ArkmePluginError("interwoven-param-invalid", "交织瞬间请求参数无效", false, 400);
|
|
1673
1732
|
return value;
|
|
1674
1733
|
}
|
|
1734
|
+
function requiredRelatedQuickNoteParam(params, key, maxLength = 4096) {
|
|
1735
|
+
const value = stringParam(params, key).trim();
|
|
1736
|
+
if (value === "" || value.length > maxLength) throw new ArkmePluginError("related-quick-note-param-invalid", "相关快记请求参数无效", false, 400);
|
|
1737
|
+
return value;
|
|
1738
|
+
}
|
|
1675
1739
|
function outgoingMediaTypeParam(params) {
|
|
1676
1740
|
const value = stringParam(params, "mediaType");
|
|
1677
1741
|
if (value !== "audio" && value !== "video") throw new ArkmePluginError("call-media-type-invalid", "呼叫媒体类型无效", false);
|
|
@@ -1731,8 +1795,11 @@ function humanMentionsParam(params) {
|
|
|
1731
1795
|
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new ArkmePluginError("human-mention-invalid", "真人 mention 参数无效", false, 400);
|
|
1732
1796
|
const item = value;
|
|
1733
1797
|
const all = item.all === true;
|
|
1798
|
+
const mentionRef = stringParam(item, "mentionRef");
|
|
1799
|
+
const memberRef = stringParam(item, "memberRef");
|
|
1800
|
+
if (all ? mentionRef !== "" || memberRef !== "" : mentionRef === "" || memberRef !== "") throw new ArkmePluginError("human-mention-invalid", "真人 mention 类型与引用不匹配", false, 400);
|
|
1734
1801
|
return {
|
|
1735
|
-
...all ? { all } : {
|
|
1802
|
+
...all ? { all } : { mentionRef },
|
|
1736
1803
|
startIndex: numberParam(item, "startIndex", -1),
|
|
1737
1804
|
length: numberParam(item, "length", 0)
|
|
1738
1805
|
};
|
|
@@ -1773,6 +1840,8 @@ function botRefsParam(params) {
|
|
|
1773
1840
|
function richSendParam(params) {
|
|
1774
1841
|
const rawAssets = Array.isArray(params.assets) ? params.assets : [];
|
|
1775
1842
|
const thinkingDurationMillis = Math.max(0, Math.trunc(numberParam(params, "thinkingDurationMillis", 0)));
|
|
1843
|
+
const recordDurationMillis = Math.max(0, Math.trunc(numberParam(params, "recordDurationMillis", 0)));
|
|
1844
|
+
const captureContext = captureContextParam(params);
|
|
1776
1845
|
const humanMentions = humanMentionsParam(params);
|
|
1777
1846
|
const botMentions = botMentionsParam(params);
|
|
1778
1847
|
return {
|
|
@@ -1780,6 +1849,8 @@ function richSendParam(params) {
|
|
|
1780
1849
|
textContent: stringParam(params, "textContent"),
|
|
1781
1850
|
displayKind: numberParam(params, "displayKind", 0) === 1 ? 1 : 0,
|
|
1782
1851
|
...thinkingDurationMillis === 0 ? {} : { thinkingDurationMillis },
|
|
1852
|
+
...recordDurationMillis === 0 ? {} : { recordDurationMillis },
|
|
1853
|
+
...captureContext === void 0 ? {} : { captureContext },
|
|
1783
1854
|
...humanMentions.length === 0 ? {} : { humanMentions },
|
|
1784
1855
|
...botMentions.length === 0 ? {} : { botMentions },
|
|
1785
1856
|
assets: rawAssets.flatMap((raw) => {
|
|
@@ -2233,13 +2304,28 @@ async function dispatchArkmeHostOperation(service, operation, params, updateMana
|
|
|
2233
2304
|
});
|
|
2234
2305
|
case "source.interwoven-moments": return await service.interwovenMoments(requiredInterwovenParam(params, "sourceRef"));
|
|
2235
2306
|
case "source.interwoven-detail": return await service.interwovenMomentDetail(requiredInterwovenParam(params, "sourceRef"), requiredInterwovenParam(params, "momentRef"));
|
|
2307
|
+
case "source.related-quick-notes.from-message": return await service.relatedQuickNotesFromMessage(requiredRelatedQuickNoteParam(params, "sourceRef"), requiredRelatedQuickNoteParam(params, "messageActionRef", MAX_MESSAGE_ACTION_REF_CHARS), requestSignal);
|
|
2308
|
+
case "source.related-quick-notes.from-moment": return await service.relatedQuickNotesFromMoment(requiredRelatedQuickNoteParam(params, "sourceRef"), requiredRelatedQuickNoteParam(params, "momentRef"), requestSignal);
|
|
2309
|
+
case "source.related-quick-note.detail": return await service.relatedQuickNoteDetail(requiredRelatedQuickNoteParam(params, "sourceRef"), requiredRelatedQuickNoteParam(params, "relatedRef"), requestSignal);
|
|
2236
2310
|
case "source.mark-read": return await service.markSourceRead(stringParam(params, "sourceRef"), numberParam(params, "readSequence", 0));
|
|
2237
2311
|
case "source.read-receipts.summary-list": return await service.messageReadReceiptSummaries(stringParam(params, "sourceRef"), messageReadReceiptItemsParam(params), requestSignal === void 0 ? {} : { signal: requestSignal });
|
|
2238
2312
|
case "source.read-receipts.detail": return await service.messageReadReceiptDetail(stringParam(params, "sourceRef"), stringParam(params, "itemUid"), numberParam(params, "sequence", 0), requestSignal === void 0 ? {} : { signal: requestSignal });
|
|
2313
|
+
case "source.message-report": {
|
|
2314
|
+
const report = messageReportParam(params);
|
|
2315
|
+
return await service.reportMessage(report.messageRef, report.reportType, {
|
|
2316
|
+
...report.reason === void 0 ? {} : { reason: report.reason },
|
|
2317
|
+
...report.requestUid === void 0 ? {} : { requestUid: report.requestUid },
|
|
2318
|
+
...requestSignal === void 0 ? {} : { signal: requestSignal }
|
|
2319
|
+
});
|
|
2320
|
+
}
|
|
2239
2321
|
case "source.message-copy-link": return await service.copySourceMessageLink(stringParam(params, "sourceRef"), messageActionRefsParam(params), requestSignal === void 0 ? {} : { signal: requestSignal });
|
|
2240
2322
|
case "source.message-copy-link.resolve": return await service.resolveMessageCopyLink(stringParam(params, "sid"), requestSignal === void 0 ? {} : { signal: requestSignal });
|
|
2241
2323
|
case "source.message-copy-link.extend": return await service.extendMessageCopyLink(stringParam(params, "sid"), numberParam(params, "itemIndex", 0), stringParam(params, "textContent"), stringParam(params, "recordUid"), requestSignal === void 0 ? {} : { signal: requestSignal });
|
|
2242
2324
|
case "source.shared-recording-detail": return await service.sharedRecordingDetail(stringParam(params, "detailRef"), requestSignal === void 0 ? {} : { signal: requestSignal });
|
|
2325
|
+
case "source.message-snapshot.detail": return await service.messageSnapshotDetail(stringParam(params, "sourceRef"), stringParam(params, "actionRef"), requestSignal === void 0 ? {} : { signal: requestSignal });
|
|
2326
|
+
case "source.message-location.set":
|
|
2327
|
+
await service.saveMessageLocation(stringParam(params, "sourceRef"), stringParam(params, "itemUid"), recordLocationCaptureParam(params), numberParam(params, "recordVersion", 0) || void 0, requestSignal === void 0 ? {} : { signal: requestSignal });
|
|
2328
|
+
return { ok: true };
|
|
2243
2329
|
case "source.forward-messages": return await service.forwardSourceMessages(stringParam(params, "sourceRef"), messageActionRefsParam(params), {
|
|
2244
2330
|
...stringParam(params, "targetSourceRef") === "" ? {} : { targetSourceRef: stringParam(params, "targetSourceRef") },
|
|
2245
2331
|
...stringParam(params, "recordUid") === "" ? {} : { recordUid: stringParam(params, "recordUid") },
|
|
@@ -2251,9 +2337,12 @@ async function dispatchArkmeHostOperation(service, operation, params, updateMana
|
|
|
2251
2337
|
const botRefs = botRefsParam(params);
|
|
2252
2338
|
const humanMentions = humanMentionsParam(params);
|
|
2253
2339
|
const botMentions = botMentionsParam(params);
|
|
2340
|
+
const captureContext = captureContextParam(params);
|
|
2254
2341
|
return await service.sendSourceText(stringParam(params, "sourceRef"), stringParam(params, "textContent"), {
|
|
2255
2342
|
...stringParam(params, "recordUid") === "" ? {} : { recordUid: stringParam(params, "recordUid") },
|
|
2256
2343
|
...stringParam(params, "relationUid") === "" ? {} : { relationUid: stringParam(params, "relationUid") },
|
|
2344
|
+
...numberParam(params, "recordDurationMillis", 0) <= 0 ? {} : { recordDurationMillis: Math.max(0, Math.trunc(numberParam(params, "recordDurationMillis", 0))) },
|
|
2345
|
+
...captureContext === void 0 ? {} : { captureContext },
|
|
2257
2346
|
...booleanParam(params, "agentAuthored") ? { agentAuthored: true } : {},
|
|
2258
2347
|
...botRefs.length === 0 ? {} : { botRefs },
|
|
2259
2348
|
...humanMentions.length === 0 ? {} : { humanMentions },
|
|
@@ -3753,6 +3842,8 @@ var ArkmeLocalDatabase = class {
|
|
|
3753
3842
|
sync_state TEXT NOT NULL CHECK (sync_state IN ('synced', 'pending', 'failed')),
|
|
3754
3843
|
attempts INTEGER NOT NULL DEFAULT 0,
|
|
3755
3844
|
last_error TEXT,
|
|
3845
|
+
record_duration_millis INTEGER NOT NULL DEFAULT 0,
|
|
3846
|
+
capture_context_json TEXT,
|
|
3756
3847
|
created_at_millis INTEGER NOT NULL,
|
|
3757
3848
|
updated_at_millis INTEGER NOT NULL,
|
|
3758
3849
|
PRIMARY KEY (user_id, record_uid)
|
|
@@ -3806,6 +3897,9 @@ var ArkmeLocalDatabase = class {
|
|
|
3806
3897
|
CREATE UNIQUE INDEX IF NOT EXISTS extension_review_outbox_user_record
|
|
3807
3898
|
ON extension_review_outbox (user_id, record_uid);
|
|
3808
3899
|
`);
|
|
3900
|
+
const recordColumns = this.database.prepare("PRAGMA table_info(record_cache)").all();
|
|
3901
|
+
if (!recordColumns.some((column) => column.name === "record_duration_millis")) this.database.exec("ALTER TABLE record_cache ADD COLUMN record_duration_millis INTEGER NOT NULL DEFAULT 0");
|
|
3902
|
+
if (!recordColumns.some((column) => column.name === "capture_context_json")) this.database.exec("ALTER TABLE record_cache ADD COLUMN capture_context_json TEXT");
|
|
3809
3903
|
const metaColumns = this.database.prepare("PRAGMA table_info(cache_meta)").all();
|
|
3810
3904
|
if (!metaColumns.some((column) => column.name === "pagination_initialized")) this.database.exec("ALTER TABLE cache_meta ADD COLUMN pagination_initialized INTEGER NOT NULL DEFAULT 0");
|
|
3811
3905
|
if (!metaColumns.some((column) => column.name === "revision")) this.database.exec("ALTER TABLE cache_meta ADD COLUMN revision INTEGER NOT NULL DEFAULT 0");
|
|
@@ -3964,18 +4058,25 @@ var ArkmeLocalDatabase = class {
|
|
|
3964
4058
|
async listPending(userId) {
|
|
3965
4059
|
await this.ensureMigrated(userId);
|
|
3966
4060
|
return this.database.prepare(`
|
|
3967
|
-
SELECT record_uid, text_content, created_at_millis, send_at_millis, attempts, last_error
|
|
4061
|
+
SELECT record_uid, text_content, created_at_millis, send_at_millis, attempts, last_error,
|
|
4062
|
+
record_duration_millis, capture_context_json
|
|
3968
4063
|
FROM record_cache
|
|
3969
4064
|
WHERE user_id = ? AND sync_state IN ('pending', 'failed')
|
|
3970
4065
|
ORDER BY created_at_millis ASC, record_uid ASC
|
|
3971
|
-
`).all(userId).map((row) =>
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
4066
|
+
`).all(userId).map((row) => {
|
|
4067
|
+
const captureContext = this.pendingCaptureContext(row.capture_context_json);
|
|
4068
|
+
const recordDurationMillis = Math.max(0, Math.trunc(row.record_duration_millis ?? 0));
|
|
4069
|
+
return {
|
|
4070
|
+
recordUid: row.record_uid,
|
|
4071
|
+
textContent: row.text_content,
|
|
4072
|
+
createdAtMillis: row.created_at_millis,
|
|
4073
|
+
sendAtMillis: row.send_at_millis,
|
|
4074
|
+
attempts: row.attempts,
|
|
4075
|
+
...recordDurationMillis === 0 ? {} : { recordDurationMillis },
|
|
4076
|
+
...captureContext === void 0 ? {} : { captureContext },
|
|
4077
|
+
...row.last_error == null || row.last_error === "" ? {} : { lastError: row.last_error }
|
|
4078
|
+
};
|
|
4079
|
+
});
|
|
3979
4080
|
}
|
|
3980
4081
|
async putPending(userId, pending) {
|
|
3981
4082
|
await this.ensureMigrated(userId);
|
|
@@ -4111,12 +4212,14 @@ var ArkmeLocalDatabase = class {
|
|
|
4111
4212
|
}
|
|
4112
4213
|
insertPending(userId, pending) {
|
|
4113
4214
|
const now = Date.now();
|
|
4215
|
+
const recordDurationMillis = Math.max(0, Math.trunc(pending.recordDurationMillis ?? 0));
|
|
4216
|
+
const captureContextJson = pending.captureContext === void 0 ? null : JSON.stringify(pending.captureContext);
|
|
4114
4217
|
this.database.prepare(`
|
|
4115
4218
|
INSERT INTO record_cache (
|
|
4116
4219
|
user_id, record_uid, send_at_millis, title, text_content, template_kind,
|
|
4117
4220
|
status, version, sync_state, attempts, last_error,
|
|
4118
|
-
created_at_millis, updated_at_millis
|
|
4119
|
-
) VALUES (?, ?, ?, '', ?, 1, 0, 0, 'pending', ?, ?, ?, ?)
|
|
4221
|
+
record_duration_millis, capture_context_json, created_at_millis, updated_at_millis
|
|
4222
|
+
) VALUES (?, ?, ?, '', ?, 1, 0, 0, 'pending', ?, ?, ?, ?, ?, ?)
|
|
4120
4223
|
ON CONFLICT(user_id, record_uid) DO UPDATE SET
|
|
4121
4224
|
send_at_millis = excluded.send_at_millis,
|
|
4122
4225
|
text_content = excluded.text_content,
|
|
@@ -4124,8 +4227,31 @@ var ArkmeLocalDatabase = class {
|
|
|
4124
4227
|
sync_state = 'pending',
|
|
4125
4228
|
attempts = excluded.attempts,
|
|
4126
4229
|
last_error = excluded.last_error,
|
|
4230
|
+
record_duration_millis = excluded.record_duration_millis,
|
|
4231
|
+
capture_context_json = excluded.capture_context_json,
|
|
4127
4232
|
updated_at_millis = excluded.updated_at_millis
|
|
4128
|
-
`).run(userId, pending.recordUid, pending.sendAtMillis, pending.textContent, pending.attempts, pending.lastError ?? null, pending.createdAtMillis, now);
|
|
4233
|
+
`).run(userId, pending.recordUid, pending.sendAtMillis, pending.textContent, pending.attempts, pending.lastError ?? null, recordDurationMillis, captureContextJson, pending.createdAtMillis, now);
|
|
4234
|
+
}
|
|
4235
|
+
pendingCaptureContext(raw) {
|
|
4236
|
+
if (raw == null || raw === "") return void 0;
|
|
4237
|
+
try {
|
|
4238
|
+
const value = JSON.parse(raw);
|
|
4239
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
4240
|
+
const source = value;
|
|
4241
|
+
const clientName = typeof source.clientName === "string" ? source.clientName.trim().slice(0, 120) : "";
|
|
4242
|
+
const networkName = typeof source.networkName === "string" ? source.networkName.trim().slice(0, 120) : "";
|
|
4243
|
+
const electric = typeof source.electric === "number" && Number.isFinite(source.electric) ? Math.trunc(source.electric) : void 0;
|
|
4244
|
+
const charge = typeof source.charge === "number" && Number.isFinite(source.charge) ? Math.trunc(source.charge) : 0;
|
|
4245
|
+
const result = {
|
|
4246
|
+
...clientName === "" ? {} : { clientName },
|
|
4247
|
+
...networkName === "" ? {} : { networkName },
|
|
4248
|
+
...electric === void 0 || electric < 0 || electric > 100 ? {} : { electric },
|
|
4249
|
+
...charge < 1 || charge > 3 ? {} : { charge }
|
|
4250
|
+
};
|
|
4251
|
+
return Object.keys(result).length === 0 ? void 0 : result;
|
|
4252
|
+
} catch {
|
|
4253
|
+
return;
|
|
4254
|
+
}
|
|
4129
4255
|
}
|
|
4130
4256
|
upsertSyncedRecord(userId, item) {
|
|
4131
4257
|
const now = Date.now();
|
|
@@ -5426,7 +5552,8 @@ function completedPublishSession(session, fallbackVersion) {
|
|
|
5426
5552
|
return session.status === "published" ? {
|
|
5427
5553
|
extension_id: session.extension_id,
|
|
5428
5554
|
version: session.version ?? fallbackVersion,
|
|
5429
|
-
status: "published"
|
|
5555
|
+
status: "published",
|
|
5556
|
+
...session.share === void 0 ? {} : { share: session.share }
|
|
5430
5557
|
} : void 0;
|
|
5431
5558
|
}
|
|
5432
5559
|
function requireBundleUploadSlots(session) {
|
|
@@ -9020,6 +9147,21 @@ function normalizedLongArticleDraft(value) {
|
|
|
9020
9147
|
function longArticleDraftKey(sourceRef, itemUid) {
|
|
9021
9148
|
return `${sourceRef}\u0000${itemUid ?? ""}`;
|
|
9022
9149
|
}
|
|
9150
|
+
function normalizedCaptureContext(value) {
|
|
9151
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
9152
|
+
const source = value;
|
|
9153
|
+
const clientName = typeof source.clientName === "string" ? source.clientName.trim().slice(0, 120) : "";
|
|
9154
|
+
const networkName = typeof source.networkName === "string" ? source.networkName.trim().slice(0, 120) : "";
|
|
9155
|
+
const electric = typeof source.electric === "number" && Number.isFinite(source.electric) ? Math.trunc(source.electric) : void 0;
|
|
9156
|
+
const charge = typeof source.charge === "number" && Number.isFinite(source.charge) ? Math.trunc(source.charge) : 0;
|
|
9157
|
+
const result = {
|
|
9158
|
+
...clientName === "" ? {} : { clientName },
|
|
9159
|
+
...networkName === "" ? {} : { networkName },
|
|
9160
|
+
...electric === void 0 || electric < 0 || electric > 100 ? {} : { electric },
|
|
9161
|
+
...charge < 1 || charge > 3 ? {} : { charge }
|
|
9162
|
+
};
|
|
9163
|
+
return Object.keys(result).length === 0 ? void 0 : result;
|
|
9164
|
+
}
|
|
9023
9165
|
function normalizedPending(value) {
|
|
9024
9166
|
if (!Array.isArray(value)) return [];
|
|
9025
9167
|
const result = [];
|
|
@@ -9028,12 +9170,16 @@ function normalizedPending(value) {
|
|
|
9028
9170
|
const source = item;
|
|
9029
9171
|
if (typeof source.recordUid !== "string" || source.recordUid.trim() === "") continue;
|
|
9030
9172
|
if (typeof source.textContent !== "string" || source.textContent.trim() === "") continue;
|
|
9173
|
+
const recordDurationMillis = typeof source.recordDurationMillis === "number" && Number.isFinite(source.recordDurationMillis) ? Math.max(0, Math.trunc(source.recordDurationMillis)) : 0;
|
|
9174
|
+
const captureContext = normalizedCaptureContext(source.captureContext);
|
|
9031
9175
|
result.push({
|
|
9032
9176
|
recordUid: source.recordUid,
|
|
9033
9177
|
textContent: source.textContent,
|
|
9034
9178
|
createdAtMillis: typeof source.createdAtMillis === "number" ? source.createdAtMillis : 0,
|
|
9035
9179
|
sendAtMillis: typeof source.sendAtMillis === "number" ? source.sendAtMillis : 0,
|
|
9036
9180
|
attempts: typeof source.attempts === "number" ? source.attempts : 0,
|
|
9181
|
+
...recordDurationMillis === 0 ? {} : { recordDurationMillis },
|
|
9182
|
+
...captureContext === void 0 ? {} : { captureContext },
|
|
9037
9183
|
...typeof source.lastError === "string" && source.lastError !== "" ? { lastError: source.lastError } : {}
|
|
9038
9184
|
});
|
|
9039
9185
|
}
|
|
@@ -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-
|
|
1
|
+
import { a as persistentArkmeExtensionActive, i as invokePersistentArkmeExtension, n as applyPersistentArkmeHostExtension, o as persistentArkmeExtensionRuntimeState, r as deactivatePersistentArkmeExtension, t as activatePersistentArkmeExtension } from "./persistent-runtime-e4gV6dqq.js";
|
|
2
2
|
export { activatePersistentArkmeExtension, applyPersistentArkmeHostExtension, deactivatePersistentArkmeExtension, invokePersistentArkmeExtension, persistentArkmeExtensionActive, persistentArkmeExtensionRuntimeState };
|