@senguoyun/dsh-arkme 0.1.82 → 0.1.83

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 (74) hide show
  1. package/docs/ai-points-implementation.md +43 -0
  2. package/docs/interwoven-compact-summary-regression-2026-09-28.md +35 -0
  3. package/docs/interwoven-original-read-receipt-regression-2026-09-28.md +50 -0
  4. package/docs/personal-detail-consistency-regression-2026-09-28.md +40 -0
  5. package/docs/send-to-self-roles-cross-client-api-handoff-2026-09-27.md +9 -0
  6. package/lib/client.js +2181 -1710
  7. package/lib/client.js.map +1 -1
  8. package/lib/harness-model-client.js +123 -37
  9. package/lib/harness-native-selection-client.js +57 -1
  10. package/lib/harness-sidebar-client.js +11 -0
  11. package/lib/index.js +194 -56
  12. package/lib/persistent-extension.js +1 -1
  13. package/lib/{persistent-runtime-DV9Hme-U.js → persistent-runtime-B6vPAaiG.js} +507 -42
  14. package/lib/sdk.js +11 -0
  15. package/lib/types/ai-points.d.ts +61 -0
  16. package/lib/types/ai-points.d.ts.map +1 -0
  17. package/lib/types/arkme-service.d.ts +10 -0
  18. package/lib/types/arkme-service.d.ts.map +1 -1
  19. package/lib/types/billing-gateway.d.ts.map +1 -1
  20. package/lib/types/client/ArkmeAccountUsage.d.ts +1 -3
  21. package/lib/types/client/ArkmeAccountUsage.d.ts.map +1 -1
  22. package/lib/types/client/ArkmeArkoSurface.d.ts.map +1 -1
  23. package/lib/types/client/ArkmeBillingSettings.d.ts +3 -2
  24. package/lib/types/client/ArkmeBillingSettings.d.ts.map +1 -1
  25. package/lib/types/client/ArkmeDataManagementSettings.d.ts.map +1 -1
  26. package/lib/types/client/ArkmeDocumentComposerInput.d.ts.map +1 -1
  27. package/lib/types/client/ArkmeEmojiPicker.d.ts.map +1 -1
  28. package/lib/types/client/ArkmeInterwovenReadReceipt.d.ts +12 -0
  29. package/lib/types/client/ArkmeInterwovenReadReceipt.d.ts.map +1 -0
  30. package/lib/types/client/ArkmeModelSelect.d.ts.map +1 -1
  31. package/lib/types/client/ArkmeNoteDetails.d.ts.map +1 -1
  32. package/lib/types/client/ArkmePointsConsumption.d.ts +5 -0
  33. package/lib/types/client/ArkmePointsConsumption.d.ts.map +1 -0
  34. package/lib/types/client/ArkmeRelatedQuickNotes.d.ts.map +1 -1
  35. package/lib/types/client/ArkmeSidebar.d.ts.map +1 -1
  36. package/lib/types/client/ArkoModelMenu.d.ts.map +1 -1
  37. package/lib/types/client/api.d.ts +1 -1
  38. package/lib/types/client/api.d.ts.map +1 -1
  39. package/lib/types/client/interwoven-moments.d.ts.map +1 -1
  40. package/lib/types/client/interwoven-read-receipt-store.d.ts +32 -0
  41. package/lib/types/client/interwoven-read-receipt-store.d.ts.map +1 -0
  42. package/lib/types/client/locales/actions-en.d.ts.map +1 -1
  43. package/lib/types/client/locales/dynamic-en.d.ts.map +1 -1
  44. package/lib/types/client/self-role-presentation.d.ts +6 -1
  45. package/lib/types/client/self-role-presentation.d.ts.map +1 -1
  46. package/lib/types/client/use-personal-extension-parents.d.ts +4 -0
  47. package/lib/types/client/use-personal-extension-parents.d.ts.map +1 -0
  48. package/lib/types/host-api.d.ts.map +1 -1
  49. package/lib/types/index.d.ts.map +1 -1
  50. package/lib/types/managed-ai/adapter.d.ts +2 -1
  51. package/lib/types/managed-ai/adapter.d.ts.map +1 -1
  52. package/lib/types/managed-ai/operation.d.ts +17 -0
  53. package/lib/types/managed-ai/operation.d.ts.map +1 -0
  54. package/lib/types/managed-ai/transport.d.ts +1 -0
  55. package/lib/types/managed-ai/transport.d.ts.map +1 -1
  56. package/lib/types/record-extension-tree.d.ts +2 -0
  57. package/lib/types/record-extension-tree.d.ts.map +1 -1
  58. package/lib/types/sdk/index.d.ts +4 -0
  59. package/lib/types/sdk/index.d.ts.map +1 -1
  60. package/lib/types/services/ai-points-service.d.ts +13 -0
  61. package/lib/types/services/ai-points-service.d.ts.map +1 -0
  62. package/lib/types/services/arko-service.d.ts.map +1 -1
  63. package/lib/types/services/chat-service.d.ts +9 -1
  64. package/lib/types/services/chat-service.d.ts.map +1 -1
  65. package/lib/types/services/interwoven-service.d.ts +3 -1
  66. package/lib/types/services/interwoven-service.d.ts.map +1 -1
  67. package/lib/types/tools/business/account/ai-points.d.ts +4 -0
  68. package/lib/types/tools/business/account/ai-points.d.ts.map +1 -0
  69. package/lib/types/tools/business/account/index.d.ts.map +1 -1
  70. package/lib/types/tools/ports/profile.d.ts +3 -0
  71. package/lib/types/tools/ports/profile.d.ts.map +1 -1
  72. package/lib/types/types.d.ts +17 -3
  73. package/lib/types/types.d.ts.map +1 -1
  74. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as inspectNativeBundleArtifactV3, At as ArkmeRecordReeditDraftConflict, Bt as __require, Ct as isRecentEmojiId, D as bundleSha256, Dt as ArkmePluginError, E as arkmeSandboxEntryId, F as assertExtensionArtifactSize, Ft as registerDSHAgentInputRecordSync, G as validateVoiceprintPcm16Wav, I as canonicalExtensionJson, It as createDesktopLifecycleReader, J as arkmeRequiredLinkMetadataFallback, K as arkmeExtensionShareRefFromLink, L as sha256Hex, Lt as __commonJSMin, M as packLocalNativeBundleDirectoryV3, Mt as parseArkmeRecordReeditMentions, N as readNativeBundleTarballV3, O as canonicalBundleJson, Ot as retryAfterMillis, P as renderArkmeSandboxHostEntry, Pt as parseArrangementBoardCachePages, Q as ARKME_PROVIDER_CONTRACT_VERSION, R as unpackArkmeExtension, Rt as __esmMin, S as ARKME_BUNDLE_ARTIFACT_KIND, St as recordingImportFileNameKey, T as ArkmeBundleArtifactError, Tt as registerManagedAiProvider, U as ARKME_EXTENSION_RUNTIME_UNAVAILABLE_MESSAGE, Vt as __toCommonJS, 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 parseArkmeRecordReeditAttachments, k as inspectBundleArtifact, kt as recordOwnerId, 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, zt as __exportAll } from "./persistent-runtime-DV9Hme-U.js";
1
+ import { A as inspectNativeBundleArtifactV3, At as ArkmeRecordReeditDraftConflict, Bt as __require, Ct as isRecentEmojiId, D as bundleSha256, Dt as ArkmePluginError, E as arkmeSandboxEntryId, F as assertExtensionArtifactSize, Ft as registerDSHAgentInputRecordSync, G as validateVoiceprintPcm16Wav, I as canonicalExtensionJson, It as createDesktopLifecycleReader, J as arkmeRequiredLinkMetadataFallback, K as arkmeExtensionShareRefFromLink, L as sha256Hex, Lt as __commonJSMin, M as packLocalNativeBundleDirectoryV3, Mt as parseArkmeRecordReeditMentions, N as readNativeBundleTarballV3, O as canonicalBundleJson, Ot as retryAfterMillis, P as renderArkmeSandboxHostEntry, Pt as parseArrangementBoardCachePages, Q as ARKME_PROVIDER_CONTRACT_VERSION, R as unpackArkmeExtension, Rt as __esmMin, S as ARKME_BUNDLE_ARTIFACT_KIND, St as recordingImportFileNameKey, T as ArkmeBundleArtifactError, Tt as registerManagedAiProvider, U as ARKME_EXTENSION_RUNTIME_UNAVAILABLE_MESSAGE, Vt as __toCommonJS, 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 parseArkmeRecordReeditAttachments, k as inspectBundleArtifact, kt as recordOwnerId, 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, zt as __exportAll } from "./persistent-runtime-B6vPAaiG.js";
2
2
  import { i as securePrivateFileSync, n as securePrivateDirectorySync, r as securePrivateFile, t as securePrivateDirectory } from "./private-filesystem-CGh4FtyA.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-dNxHpiVg.js";
4
4
  import { i as prepareProfilePackageManager, n as isArkmeProfilePackageName, r as localExtensionPnpmArgs, t as applyArkmeProfileBundlePolicy } from "./profile-bundle-policy-8_y3QfHe.js";
@@ -510,6 +510,84 @@ var DshNativeSocket = class {
510
510
  }
511
511
  };
512
512
  //#endregion
513
+ //#region src/dsh-session-events.ts
514
+ function readSessionEvents(session) {
515
+ if (typeof session.snapshotEvents === "function") return session.snapshotEvents();
516
+ if (Array.isArray(session.events)) return session.events;
517
+ throw new Error("当前 DSH 会话不支持读取事件,无法核验用户输入");
518
+ }
519
+ //#endregion
520
+ //#region src/managed-ai/operation.ts
521
+ /** The durable DSH boundary, never a session-wide credit exemption. */
522
+ function turnOperationId(session, start) {
523
+ return createHash("sha256").update(JSON.stringify([
524
+ session.id,
525
+ start.seq,
526
+ start.time,
527
+ start.data.turn
528
+ ])).digest("hex");
529
+ }
530
+ var ManagedTurnFunding = class {
531
+ session;
532
+ close;
533
+ failed;
534
+ credentials = /* @__PURE__ */ new Map();
535
+ constructor(session, close, failed) {
536
+ this.session = session;
537
+ this.close = close;
538
+ this.failed = failed;
539
+ }
540
+ prepare(request, bearer) {
541
+ if (request.sessionId === void 0 || request.purpose === "session-title") return void 0;
542
+ const session = this.session(request.sessionId);
543
+ if (session === void 0) return void 0;
544
+ const boundary = readSessionEvents(session).findLast((event) => event.type === "turn/start" || event.type === "turn/end");
545
+ if (boundary?.type !== "turn/start") return void 0;
546
+ const uid = turnOperationId(session, boundary);
547
+ const credentials = this.credentials.get(uid) ?? /* @__PURE__ */ new Set();
548
+ credentials.add(bearer);
549
+ this.credentials.set(uid, credentials);
550
+ return uid;
551
+ }
552
+ async ended(session, event) {
553
+ if (event.type !== "turn/end") return;
554
+ const start = readSessionEvents(session).findLast((item) => item.type === "turn/start" && item.data.turn === event.data.turn);
555
+ if (start?.type !== "turn/start") return;
556
+ const uid = turnOperationId(session, start);
557
+ const credentials = this.credentials.get(uid);
558
+ this.credentials.delete(uid);
559
+ if (credentials === void 0) return;
560
+ await Promise.all([...credentials].map(async (bearer) => {
561
+ try {
562
+ await this.close(uid, bearer);
563
+ } catch {
564
+ this.failed();
565
+ }
566
+ }));
567
+ }
568
+ dispose() {
569
+ this.credentials.clear();
570
+ }
571
+ };
572
+ function registerManagedTurnFunding(ctx, intelligentBaseUrl) {
573
+ const funding = new ManagedTurnFunding((id) => ctx.get("sessions")?.get(id), async (operationUid, bearer) => {
574
+ if (!(await fetch(`${intelligentBaseUrl.replace(/\/+$/, "")}/api/v1/managed-ai/operations/close`, {
575
+ method: "POST",
576
+ headers: {
577
+ Authorization: `Bearer ${bearer}`,
578
+ "Content-Type": "application/json"
579
+ },
580
+ body: JSON.stringify({ operation_uid: operationUid }),
581
+ signal: AbortSignal.timeout(5e3)
582
+ })).ok) throw new Error("Could not close AI turn");
583
+ }, () => ctx.logger.warn("Arkme AI turn close failed; server authorization expiry will reclaim it"));
584
+ ctx.on("session/event", (session, event) => {
585
+ funding.ended(session, event).catch(() => ctx.logger.warn("Arkme AI turn boundary could not be read"));
586
+ }, { global: true });
587
+ ctx.effect(() => () => funding.dispose());
588
+ return funding;
589
+ }
590
+ //#endregion
513
591
  //#region src/dsh-remote/native-history-cache.ts
514
592
  /** Rebuildable native history, separate from business records and write ledgers. */
515
593
  var DshNativeHistoryCache = class {
@@ -2579,13 +2657,6 @@ function formatArkmeIdMutationResult(result) {
2579
2657
  ].join("\n");
2580
2658
  }
2581
2659
  //#endregion
2582
- //#region src/dsh-session-events.ts
2583
- function readSessionEvents(session) {
2584
- if (typeof session.snapshotEvents === "function") return session.snapshotEvents();
2585
- if (Array.isArray(session.events)) return session.events;
2586
- throw new Error("当前 DSH 会话不支持读取事件,无法核验用户输入");
2587
- }
2588
- //#endregion
2589
2660
  //#region src/tools/shared/conversational-confirmation.ts
2590
2661
  const DEFAULT_CONFIRMATION_TTL_MILLIS$2 = 10 * 6e4;
2591
2662
  const MAX_PENDING_CONFIRMATIONS$1 = 1024;
@@ -14384,6 +14455,11 @@ async function dispatchArkmeHostOperation(service, operation, params, updateMana
14384
14455
  case "billing.products": return await service.billingProducts();
14385
14456
  case "membership.current": return await service.membershipCurrent(numberParam(params, "expectedUserId", NaN));
14386
14457
  case "membership.catalog": return await service.membershipCatalog(numberParam(params, "expectedUserId", NaN));
14458
+ case "account.points.query": return await service.aiPointsAccount(stringParam(params, "expectedAccountScope"), requestSignal);
14459
+ case "account.points.consumption": return await service.aiPointsConsumption({
14460
+ month: stringParam(params, "month"),
14461
+ ...typeof params.beforeId === "string" && params.beforeId ? { beforeId: params.beforeId } : {}
14462
+ }, stringParam(params, "expectedAccountScope"), requestSignal);
14387
14463
  case "account.usage.tokens": return await service.accountTokenUsage(stringParam(params, "expectedAccountScope"));
14388
14464
  case "account.usage.storage": return await service.accountStorageUsage(stringParam(params, "expectedAccountScope"));
14389
14465
  case "account.usage.voice": return await service.accountVoiceUsage(stringParam(params, "expectedAccountScope"));
@@ -14949,6 +15025,9 @@ async function dispatchArkmeHostOperation(service, operation, params, updateMana
14949
15025
  });
14950
15026
  case "source.interwoven-moments": return await service.interwovenMoments(requiredInterwovenParam(params, "sourceRef"));
14951
15027
  case "source.interwoven-detail": return await service.interwovenMomentDetail(requiredInterwovenParam(params, "sourceRef"), requiredInterwovenParam(params, "momentRef"));
15028
+ case "source.interwoven-read-receipts":
15029
+ if (!Array.isArray(params.momentRefs) || !params.momentRefs.every((ref) => typeof ref === "string")) throw new ArkmePluginError("interwoven-param-invalid", "群互动已读查询参数无效", false, 400);
15030
+ return await service.interwovenReadReceipts(requiredInterwovenParam(params, "sourceRef"), params.momentRefs, requestSignal);
14952
15031
  case "source.related-quick-notes.from-message": return await service.relatedQuickNotesFromMessage(requiredRelatedQuickNoteParam(params, "sourceRef"), requiredRelatedQuickNoteParam(params, "messageActionRef", MAX_MESSAGE_ACTION_REF_CHARS), requestSignal);
14953
15032
  case "source.related-quick-notes.from-moment": return await service.relatedQuickNotesFromMoment(requiredRelatedQuickNoteParam(params, "sourceRef"), requiredRelatedQuickNoteParam(params, "momentRef"), requestSignal);
14954
15033
  case "source.record-edit-history": return await service.recordEditHistoryPage(stringParam(params, "sourceRef"), stringParam(params, "messageActionRef"), numberParam(params, "cursorEditAt", 0), requestSignal);
@@ -14987,6 +15066,7 @@ async function dispatchArkmeHostOperation(service, operation, params, updateMana
14987
15066
  case "message-actions.copy-link": return await service.copyMessageActionsLink(stringParam(params, "conversationRef").trim(), messageActionRefsParam(params), requestSignal === void 0 ? {} : { signal: requestSignal });
14988
15067
  case "source.message-copy-link.resolve": return await service.resolveMessageCopyLink(stringParam(params, "sid"), requestSignal === void 0 ? {} : { signal: requestSignal });
14989
15068
  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 });
15069
+ case "source.message-extension.parent": return await service.sourceMessageExtensionParent(stringParam(params, "sourceRef"), stringParam(params, "messageActionRef"), requestSignal === void 0 ? {} : { signal: requestSignal });
14990
15070
  case "source.message-extension.context": return await service.sourceMessageExtensionContext(stringParam(params, "sourceRef"), stringParam(params, "messageActionRef"), requestSignal === void 0 ? {} : { signal: requestSignal });
14991
15071
  case "source.message-extension.extend": return await service.extendSourceMessage(stringParam(params, "sourceRef"), stringParam(params, "messageActionRef"), stringParam(params, "textContent"), stringParam(params, "recordUid"), [...new Set(stringListParam(params, "fileRefs").map((value) => value.trim()).filter((value) => value !== ""))], {
14992
15072
  ...richSendParam(params),
@@ -28114,6 +28194,60 @@ const recordCalendarToolModules = [defineArkmeCoreToolModule({
28114
28194
  });
28115
28195
  }
28116
28196
  })];
28197
+ const aiPointsToolModules = [defineArkmeCoreToolModule({
28198
+ meta: {
28199
+ id: "business.account.ai-points.v1",
28200
+ toolName: "arkme_ai_points",
28201
+ kind: "business",
28202
+ phase: "core",
28203
+ effect: "read",
28204
+ profiles: ["business", "hybrid"]
28205
+ },
28206
+ create: (ports) => defineTool({
28207
+ name: "arkme_ai_points",
28208
+ description: "Read the signed-in Arkme account AI points: available, member grants and purchased points. This read cannot recharge, grant points or call a model.",
28209
+ parameters: {},
28210
+ output: TEXT_OUTPUT$3,
28211
+ isConcurrencySafe: () => true,
28212
+ execute: async (_args, exec) => {
28213
+ const { accountScope: _scope, ...account } = await ports.aiPointsAccount(void 0, exec.signal);
28214
+ return taggedJSON("AI 积分", account);
28215
+ }
28216
+ })
28217
+ }), defineArkmeCoreToolModule({
28218
+ meta: {
28219
+ id: "business.account.ai-points-consumption.v1",
28220
+ toolName: "arkme_ai_points_consumption",
28221
+ kind: "business",
28222
+ phase: "core",
28223
+ effect: "read",
28224
+ profiles: ["business", "hybrid"]
28225
+ },
28226
+ create: (ports) => defineTool({
28227
+ name: "arkme_ai_points_consumption",
28228
+ description: "Read settled AI point consumption for a natural month (Asia/Shanghai). Non-charged background model usage is excluded. Follow nextBeforeId to read another page.",
28229
+ parameters: {
28230
+ month: {
28231
+ type: "string",
28232
+ required: true,
28233
+ description: "Month YYYY-MM"
28234
+ },
28235
+ beforeId: {
28236
+ type: "string",
28237
+ description: "Opaque nextBeforeId returned by the previous page"
28238
+ }
28239
+ },
28240
+ output: TEXT_OUTPUT$3,
28241
+ isConcurrencySafe: () => true,
28242
+ execute: async (args, exec) => {
28243
+ const { accountScope: _scope, ...page } = await ports.aiPointsConsumption({
28244
+ month: args.month,
28245
+ ...args.beforeId ? { beforeId: args.beforeId } : {}
28246
+ }, void 0, exec.signal);
28247
+ return taggedJSON("AI 积分消费", page);
28248
+ }
28249
+ })
28250
+ })];
28117
28251
  //#endregion
28118
28252
  //#region src/tools/business/account/profile.ts
28119
28253
  const userProfileToolModule = defineArkmeCoreToolModule({
@@ -28184,57 +28318,59 @@ function expectedUserId(value) {
28184
28318
  if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) throw new Error("背景音设置的账号归属无效,请刷新后重试");
28185
28319
  return value;
28186
28320
  }
28321
+ const backgroundSoundPreferenceToolModules = [defineArkmeCoreToolModule({
28322
+ meta: {
28323
+ id: "business.account.background-sound-status.v1",
28324
+ toolName: "arkme_background_sound_status",
28325
+ kind: "business",
28326
+ phase: "core",
28327
+ effect: "read",
28328
+ profiles: ["business", "hybrid"]
28329
+ },
28330
+ create: (ports) => defineTool({
28331
+ name: "arkme_background_sound_status",
28332
+ description: "Read whether text background sound is enabled for the signed-in Arkme account. This does not request microphone permission, record audio, or change the preference.",
28333
+ parameters: {},
28334
+ output: TEXT_OUTPUT$3,
28335
+ isConcurrencySafe: () => true,
28336
+ execute: async (_args, exec) => {
28337
+ return taggedJSON("Arkme 文字背景音设置", safePreference(await ports.backgroundSoundPreference(exec.signal)));
28338
+ }
28339
+ })
28340
+ }), defineArkmeCoreToolModule({
28341
+ meta: {
28342
+ id: "business.account.background-sound-disable.v1",
28343
+ toolName: "arkme_background_sound_disable",
28344
+ kind: "business",
28345
+ phase: "core",
28346
+ effect: "write",
28347
+ grant: "explicit-user-write",
28348
+ profiles: ["business", "hybrid"]
28349
+ },
28350
+ create: (ports) => withArkmeConfirmationContext(defineTool({
28351
+ name: "arkme_background_sound_disable",
28352
+ description: "Only after an explicit current human request: disable text background sound for the signed-in Arkme account. This Tool has no enable parameter and can never request microphone permission or start recording. Enabling is available only from an interactive UI/SDK action by the human.",
28353
+ parameters: {},
28354
+ output: TEXT_OUTPUT$3,
28355
+ execute: async (_args, exec) => {
28356
+ const current = await ports.backgroundSoundPreference(exec.signal);
28357
+ return taggedJSON("Arkme 文字背景音设置", safePreference(await ports.updateBackgroundSoundPreference(false, exec.signal, expectedUserId(current.userId))));
28358
+ }
28359
+ }), {
28360
+ prepare: async (_args, exec) => {
28361
+ return { expectedUserId: expectedUserId((await ports.backgroundSoundPreference(exec.signal)).userId) };
28362
+ },
28363
+ execute: async (_args, exec, prepared) => {
28364
+ return taggedJSON("Arkme 文字背景音设置", safePreference(await ports.updateBackgroundSoundPreference(false, exec.signal, expectedUserId(prepared.expectedUserId))));
28365
+ }
28366
+ })
28367
+ })];
28187
28368
  //#endregion
28188
28369
  //#region src/tools/business/account/index.ts
28189
28370
  const accountBusinessToolModules = [
28190
28371
  userProfileToolModule,
28191
- ...[defineArkmeCoreToolModule({
28192
- meta: {
28193
- id: "business.account.background-sound-status.v1",
28194
- toolName: "arkme_background_sound_status",
28195
- kind: "business",
28196
- phase: "core",
28197
- effect: "read",
28198
- profiles: ["business", "hybrid"]
28199
- },
28200
- create: (ports) => defineTool({
28201
- name: "arkme_background_sound_status",
28202
- description: "Read whether text background sound is enabled for the signed-in Arkme account. This does not request microphone permission, record audio, or change the preference.",
28203
- parameters: {},
28204
- output: TEXT_OUTPUT$3,
28205
- isConcurrencySafe: () => true,
28206
- execute: async (_args, exec) => {
28207
- return taggedJSON("Arkme 文字背景音设置", safePreference(await ports.backgroundSoundPreference(exec.signal)));
28208
- }
28209
- })
28210
- }), defineArkmeCoreToolModule({
28211
- meta: {
28212
- id: "business.account.background-sound-disable.v1",
28213
- toolName: "arkme_background_sound_disable",
28214
- kind: "business",
28215
- phase: "core",
28216
- effect: "write",
28217
- grant: "explicit-user-write",
28218
- profiles: ["business", "hybrid"]
28219
- },
28220
- create: (ports) => withArkmeConfirmationContext(defineTool({
28221
- name: "arkme_background_sound_disable",
28222
- description: "Only after an explicit current human request: disable text background sound for the signed-in Arkme account. This Tool has no enable parameter and can never request microphone permission or start recording. Enabling is available only from an interactive UI/SDK action by the human.",
28223
- parameters: {},
28224
- output: TEXT_OUTPUT$3,
28225
- execute: async (_args, exec) => {
28226
- const current = await ports.backgroundSoundPreference(exec.signal);
28227
- return taggedJSON("Arkme 文字背景音设置", safePreference(await ports.updateBackgroundSoundPreference(false, exec.signal, expectedUserId(current.userId))));
28228
- }
28229
- }), {
28230
- prepare: async (_args, exec) => {
28231
- return { expectedUserId: expectedUserId((await ports.backgroundSoundPreference(exec.signal)).userId) };
28232
- },
28233
- execute: async (_args, exec, prepared) => {
28234
- return taggedJSON("Arkme 文字背景音设置", safePreference(await ports.updateBackgroundSoundPreference(false, exec.signal, expectedUserId(prepared.expectedUserId))));
28235
- }
28236
- })
28237
- })],
28372
+ ...aiPointsToolModules,
28373
+ ...backgroundSoundPreferenceToolModules,
28238
28374
  setArkmeIdToolModule
28239
28375
  ];
28240
28376
  //#endregion
@@ -39008,10 +39144,12 @@ function apply(ctx, config) {
39008
39144
  return () => void 0;
39009
39145
  }, "dsh-arkme: desktop account scope attestation");
39010
39146
  ctx.inject(["llm"], (modelCtx) => {
39147
+ const funding = registerManagedTurnFunding(modelCtx, config.intelligentBaseUrl);
39011
39148
  registerManagedAiProvider(modelCtx, {
39012
39149
  intelligentBaseUrl: config.intelligentBaseUrl,
39013
39150
  credentialOwner: service,
39014
- resolveAttachmentReader: () => modelCtx.get("attachments")
39151
+ resolveAttachmentReader: () => modelCtx.get("attachments"),
39152
+ prepareOperation: (request, bearer) => funding.prepare(request, bearer)
39015
39153
  });
39016
39154
  });
39017
39155
  registerDSHAgentInputRecordSync(ctx, service);
@@ -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-DV9Hme-U.js";
1
+ import { a as persistentArkmeExtensionActive, i as invokePersistentArkmeExtension, n as applyPersistentArkmeHostExtension, o as persistentArkmeExtensionRuntimeState, r as deactivatePersistentArkmeExtension, t as activatePersistentArkmeExtension } from "./persistent-runtime-B6vPAaiG.js";
2
2
  export { activatePersistentArkmeExtension, applyPersistentArkmeHostExtension, deactivatePersistentArkmeExtension, invokePersistentArkmeExtension, persistentArkmeExtensionActive, persistentArkmeExtensionRuntimeState };