@tangle-network/agent-app 0.61.4 → 0.62.0
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/dist/{DesignCanvas-L6J72JQ2.js → DesignCanvas-IQKYAEC4.js} +3 -2
- package/dist/{DesignCanvasEditor-QFQD63MR.js → DesignCanvasEditor-O7OCZTGC.js} +5 -4
- package/dist/{TimelineEditor-7KBPJQLT.js → TimelineEditor-VB2UJ34D.js} +4 -2
- package/dist/VaultPane-AYW7CO33.js +8 -0
- package/dist/agent-profiles/d1.js +1 -1
- package/dist/agent-profiles/index.d.ts +0 -82
- package/dist/agent-profiles/index.js +1 -21
- package/dist/agent-profiles/self-management.d.ts +0 -55
- package/dist/alerting/index.d.ts +1 -1
- package/dist/alerting/index.js +1 -3
- package/dist/alerting/slack.d.ts +6 -79
- package/dist/app-auth/drizzle.d.ts +17 -271
- package/dist/app-auth/drizzle.js +6 -2
- package/dist/app-auth/drizzle.js.map +1 -1
- package/dist/app-auth/index.js +3 -3
- package/dist/assets/types.d.ts +2 -1
- package/dist/assistant/AssistantPanel.d.ts +1 -1
- package/dist/assistant/index.js +635 -392
- package/dist/assistant/index.js.map +1 -1
- package/dist/billing/identity-locks.d.ts +5 -0
- package/dist/billing/index.js +1 -1
- package/dist/brand-extraction/index.js.map +1 -1
- package/dist/brand-extraction/types.d.ts +2 -1
- package/dist/chat-react/index.js +6 -5
- package/dist/chat-routes/attachment-write-safety.d.ts +4 -0
- package/dist/chat-routes/draft-persistence.d.ts +2 -14
- package/dist/chat-routes/index.d.ts +1 -0
- package/dist/chat-routes/index.js +853 -773
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/sandbox-model-source.d.ts +20 -0
- package/dist/chat-routes/stored-attachments.d.ts +18 -0
- package/dist/chat-routes/turn-admission.d.ts +1 -1
- package/dist/chat-routes/turn-execution.d.ts +2 -2
- package/dist/chat-routes/turn-route-contracts.d.ts +3 -29
- package/dist/chat-store/core.d.ts +19 -1
- package/dist/chat-store/index.js.map +1 -1
- package/dist/chat-store/store.d.ts +3 -29
- package/dist/{chunk-ATQQCG4I.js → chunk-2VJLLRVV.js} +2 -2
- package/dist/{chunk-R4X5474U.js → chunk-52SDU43B.js} +12 -27
- package/dist/chunk-52SDU43B.js.map +1 -0
- package/dist/{chunk-MDRH3SDA.js → chunk-54YIL7WM.js} +3 -3
- package/dist/{chunk-6QJ3GB3A.js → chunk-5GSZGTPJ.js} +2 -2
- package/dist/{chunk-5IM2CLYX.js → chunk-6JEDSKFH.js} +232 -218
- package/dist/chunk-6JEDSKFH.js.map +1 -0
- package/dist/{chunk-6PRQ45QE.js → chunk-6OG4244Y.js} +1 -1
- package/dist/chunk-6OG4244Y.js.map +1 -0
- package/dist/{chunk-ZDPUC6CM.js → chunk-6ZVSMA4T.js} +3 -3
- package/dist/{chunk-TXUAGSFR.js → chunk-76MPX7JQ.js} +47 -1
- package/dist/chunk-76MPX7JQ.js.map +1 -0
- package/dist/{chunk-BOQ4HVVH.js → chunk-7ISHKBAD.js} +61 -52
- package/dist/chunk-7ISHKBAD.js.map +1 -0
- package/dist/chunk-7PULOECS.js +22 -0
- package/dist/chunk-7PULOECS.js.map +1 -0
- package/dist/{chunk-KJODHPWM.js → chunk-CPVGRQ43.js} +511 -339
- package/dist/chunk-CPVGRQ43.js.map +1 -0
- package/dist/{chunk-LO6VQ35O.js → chunk-CQZVJVME.js} +2 -2
- package/dist/{chunk-Y43PXON2.js → chunk-EFQUAWWF.js} +577 -546
- package/dist/chunk-EFQUAWWF.js.map +1 -0
- package/dist/{chunk-FPNZMIAW.js → chunk-ELX5YITO.js} +1 -1
- package/dist/chunk-ELX5YITO.js.map +1 -0
- package/dist/chunk-FGAROAUF.js +19 -0
- package/dist/chunk-FGAROAUF.js.map +1 -0
- package/dist/{chunk-HN6MZ2XL.js → chunk-FTNGGR37.js} +641 -466
- package/dist/chunk-FTNGGR37.js.map +1 -0
- package/dist/{chunk-G4F2NWZH.js → chunk-FZ3ZFVAC.js} +4 -4
- package/dist/{chunk-UCCSJX64.js → chunk-GIEUZBQQ.js} +1112 -644
- package/dist/chunk-GIEUZBQQ.js.map +1 -0
- package/dist/{chunk-MEKOWH5E.js → chunk-IVBREL7A.js} +785 -526
- package/dist/chunk-IVBREL7A.js.map +1 -0
- package/dist/{chunk-WSEXFTN4.js → chunk-JBXNU5WD.js} +26 -26
- package/dist/chunk-JBXNU5WD.js.map +1 -0
- package/dist/{chunk-F2VX6TTJ.js → chunk-JRCZHDRG.js} +2 -41
- package/dist/chunk-JRCZHDRG.js.map +1 -0
- package/dist/{chunk-LXYQOOXU.js → chunk-JRW6LCIA.js} +552 -302
- package/dist/chunk-JRW6LCIA.js.map +1 -0
- package/dist/{chunk-TVPH5T4F.js → chunk-KS4I7KVC.js} +16 -22
- package/dist/{chunk-TVPH5T4F.js.map → chunk-KS4I7KVC.js.map} +1 -1
- package/dist/{chunk-J2BBYVGF.js → chunk-MRZP65DZ.js} +1 -117
- package/dist/chunk-MRZP65DZ.js.map +1 -0
- package/dist/{chunk-4ZSLX3LY.js → chunk-OODZCBSM.js} +1 -1
- package/dist/chunk-OODZCBSM.js.map +1 -0
- package/dist/chunk-P4RRC4AO.js +47 -0
- package/dist/chunk-P4RRC4AO.js.map +1 -0
- package/dist/{chunk-ORQD4AUO.js → chunk-PCAY23GS.js} +1 -6
- package/dist/chunk-PCAY23GS.js.map +1 -0
- package/dist/{chunk-NMZUW6VJ.js → chunk-PEJ5OP5B.js} +3 -3
- package/dist/chunk-PEJ5OP5B.js.map +1 -0
- package/dist/{chunk-NHYRIM4I.js → chunk-PIPNDZ6H.js} +304 -194
- package/dist/chunk-PIPNDZ6H.js.map +1 -0
- package/dist/{chunk-L7LQRJGD.js → chunk-TCJ4TMOW.js} +37 -33
- package/dist/{chunk-L7LQRJGD.js.map → chunk-TCJ4TMOW.js.map} +1 -1
- package/dist/chunk-UHSUY6H6.js +79 -0
- package/dist/chunk-UHSUY6H6.js.map +1 -0
- package/dist/{chunk-PDD5A43Y.js → chunk-UTL6TEN6.js} +3 -3
- package/dist/{chunk-VJBFCNAU.js → chunk-UW2DKTEM.js} +123 -130
- package/dist/chunk-UW2DKTEM.js.map +1 -0
- package/dist/{chunk-S27DKRI6.js → chunk-VDYEVCQQ.js} +2 -2
- package/dist/{chunk-UFQM46NV.js → chunk-VK3F4N4U.js} +2 -2
- package/dist/{chunk-6ZIC6OG5.js → chunk-VYBTQK25.js} +126 -122
- package/dist/chunk-VYBTQK25.js.map +1 -0
- package/dist/{chunk-RL3Z747H.js → chunk-W2BV2XOC.js} +1491 -700
- package/dist/chunk-W2BV2XOC.js.map +1 -0
- package/dist/{chunk-FUZETA6Z.js → chunk-X6SZGQTK.js} +2 -2
- package/dist/{chunk-CD2LQXY6.js → chunk-XOHE6SKU.js} +14 -16
- package/dist/{chunk-CD2LQXY6.js.map → chunk-XOHE6SKU.js.map} +1 -1
- package/dist/{chunk-ZBB5KQ6B.js → chunk-Y3GO6SG3.js} +73 -66
- package/dist/chunk-Y3GO6SG3.js.map +1 -0
- package/dist/chunk-ZAMHLXNS.js +56 -0
- package/dist/chunk-ZAMHLXNS.js.map +1 -0
- package/dist/{chunk-RHFN7TUV.js → chunk-ZDHCV462.js} +47 -44
- package/dist/{chunk-RHFN7TUV.js.map → chunk-ZDHCV462.js.map} +1 -1
- package/dist/chunk-ZOS3D26Z.js +72 -0
- package/dist/chunk-ZOS3D26Z.js.map +1 -0
- package/dist/design-canvas/index.js +32 -32
- package/dist/design-canvas/index.js.map +1 -1
- package/dist/design-canvas-react/components/DesignCanvas.d.ts +1 -1
- package/dist/design-canvas-react/components/Workspace.d.ts +1 -1
- package/dist/design-canvas-react/components/glyphs.d.ts +31 -40
- package/dist/design-canvas-react/components/transform-math.d.ts +0 -8
- package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +2 -2
- package/dist/design-canvas-react/contracts.d.ts +2 -2
- package/dist/design-canvas-react/engine.js +1 -1
- package/dist/design-canvas-react/index.js +9 -7
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/eval/calibration.d.ts +1 -38
- package/dist/eval/index.d.ts +2 -4
- package/dist/eval/index.js +0 -84
- package/dist/eval/index.js.map +1 -1
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/harness/session-selection.d.ts +2 -2
- package/dist/hub-approvals/index.js +1 -1
- package/dist/hub-approvals/result.d.ts +1 -1
- package/dist/hub-approvals-react/index.js +4 -4
- package/dist/hub-approvals-react/index.js.map +1 -1
- package/dist/hub-approvals-react/parts.d.ts +1 -1
- package/dist/launch-invariants/cli.js +4 -4
- package/dist/launch-invariants/index.js +3 -3
- package/dist/launch-invariants/testing.js +4 -4
- package/dist/legibility/cli.js +1 -1
- package/dist/legibility/index.js +1 -1
- package/dist/{mention-editor-B23OMFT2.js → mention-editor-4BKBMWIK.js} +83 -57
- package/dist/mention-editor-4BKBMWIK.js.map +1 -0
- package/dist/missions/index.js +144 -137
- package/dist/missions/index.js.map +1 -1
- package/dist/operator/index.js +1 -1
- package/dist/peer-floors/check.js +1 -1
- package/dist/peer-floors/cli.js +6 -14
- package/dist/peer-floors/cli.js.map +1 -1
- package/dist/peer-floors/source-entries.d.ts +6 -0
- package/dist/platform/index.js +10 -10
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/profile/index.d.ts +0 -1
- package/dist/profile/index.js +1 -422
- package/dist/profile/index.js.map +1 -1
- package/dist/profile-editor/server.d.ts +0 -1
- package/dist/profile-editor/server.js +0 -1
- package/dist/profile-editor/server.js.map +1 -1
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +6 -6
- package/dist/record/drizzle.js +156 -148
- package/dist/record/drizzle.js.map +1 -1
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/router-turn.js +3 -3
- package/dist/sandbox/index.js +5 -5
- package/dist/sequences/drizzle.js +5 -15
- package/dist/sequences/drizzle.js.map +1 -1
- package/dist/sequences/index.d.ts +1 -0
- package/dist/sequences/index.js +18 -14
- package/dist/sequences/index.js.map +1 -1
- package/dist/sequences/row-mapping.d.ts +7 -0
- package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
- package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
- package/dist/sequences-react/components/glyphs.d.ts +12 -21
- package/dist/sequences-react/components/index.d.ts +0 -2
- package/dist/sequences-react/components/interaction-math.d.ts +3 -3
- package/dist/sequences-react/contracts.d.ts +1 -1
- package/dist/sequences-react/engine/snap.d.ts +2 -2
- package/dist/sequences-react/index.js +4 -4
- package/dist/sequences-react/index.js.map +1 -1
- package/dist/settings-react/index.js +13 -30
- package/dist/settings-react/index.js.map +1 -1
- package/dist/settings-react/timezone-picker.d.ts +0 -6
- package/dist/signoff/browser-budget.d.ts +6 -1
- package/dist/signoff/cli.d.ts +0 -7
- package/dist/signoff/cli.js +1 -2
- package/dist/signoff/cli.js.map +1 -1
- package/dist/signoff/index.js +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +5 -25
- package/dist/skills/marketplace.d.ts +1 -75
- package/dist/skills-placement/box.js +3 -4
- package/dist/skills-placement/box.js.map +1 -1
- package/dist/skills-placement/index.js +3 -4
- package/dist/spend/cli-args.d.ts +1 -1
- package/dist/spend/cli.js +3 -3
- package/dist/spend/cli.js.map +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/stories/design-canvas/fixtures.d.ts +1 -14
- package/dist/stream/index.js +17 -17
- package/dist/studio/generation.d.ts +1 -1
- package/dist/studio/index.js +1 -1
- package/dist/studio-react/index.js +353 -184
- package/dist/studio-react/index.js.map +1 -1
- package/dist/studio-react/studio-composer.d.ts +1 -5
- package/dist/studio-react/studio-history-screen.d.ts +1 -1
- package/dist/teams/invitations-api.d.ts +3 -3
- package/dist/teams/invitations-api.js +74 -72
- package/dist/teams/invitations-api.js.map +1 -1
- package/dist/teams/member-sync.d.ts +2 -0
- package/dist/teams/members-api.d.ts +2 -2
- package/dist/teams/members-api.js +1 -1
- package/dist/teams-react/index.js +28 -45
- package/dist/teams-react/index.js.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp-arguments.d.ts +1 -1
- package/dist/trace/index.d.ts +1 -18
- package/dist/trace/index.js +1 -36
- package/dist/trace/index.js.map +1 -1
- package/dist/trace/mission-flow.d.ts +1 -59
- package/dist/turn-health/index.d.ts +1 -1
- package/dist/turn-health/index.js +2 -2
- package/dist/turn-health/sink.d.ts +2 -1
- package/dist/turn-trace/index.js +2 -4
- package/dist/turn-trace/recorder.d.ts +0 -2
- package/dist/vault/VaultPane.d.ts +0 -20
- package/dist/vault/VaultPaneOperations.d.ts +318 -0
- package/dist/vault/index.js +2 -1
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/agent-profile-editor.d.ts +1 -2
- package/dist/web-react/agent-profile-editor.js +6 -5
- package/dist/web-react/chat-composer.d.ts +1 -1
- package/dist/web-react/durable-plan-flow.d.ts +6 -1
- package/dist/web-react/editor-glyphs.d.ts +12 -0
- package/dist/web-react/focus-navigation.d.ts +12 -0
- package/dist/web-react/history-controls.d.ts +37 -0
- package/dist/web-react/index.js +36 -34
- package/dist/web-react/interaction-question-card.d.ts +1 -1
- package/dist/web-react/record-grid-writes.d.ts +31 -0
- package/dist/web-react/record-grid.d.ts +1 -48
- package/dist/web-react/session-history-panel.d.ts +1 -9
- package/dist/web-react/use-document-dark.d.ts +1 -0
- package/dist/workspace-export/engine.d.ts +1 -6
- package/dist/workspace-export/index.js +198 -185
- package/dist/workspace-export/index.js.map +1 -1
- package/dist/workspace-export/routes.d.ts +1 -1
- package/dist/workspace-react/index.js +9 -8
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +1 -11
- package/dist/VaultPane-RXL3WLA2.js +0 -7
- package/dist/agent-profiles/reaper.d.ts +0 -31
- package/dist/agent-profiles/reaper.js +0 -29
- package/dist/agent-profiles/reaper.js.map +0 -1
- package/dist/chunk-4ZSLX3LY.js.map +0 -1
- package/dist/chunk-5IM2CLYX.js.map +0 -1
- package/dist/chunk-6OSJNJA2.js +0 -251
- package/dist/chunk-6OSJNJA2.js.map +0 -1
- package/dist/chunk-6PRQ45QE.js.map +0 -1
- package/dist/chunk-6ZIC6OG5.js.map +0 -1
- package/dist/chunk-BDEBQ4WO.js +0 -38
- package/dist/chunk-BDEBQ4WO.js.map +0 -1
- package/dist/chunk-BOQ4HVVH.js.map +0 -1
- package/dist/chunk-F2VX6TTJ.js.map +0 -1
- package/dist/chunk-FPNZMIAW.js.map +0 -1
- package/dist/chunk-HN6MZ2XL.js.map +0 -1
- package/dist/chunk-J2BBYVGF.js.map +0 -1
- package/dist/chunk-KJODHPWM.js.map +0 -1
- package/dist/chunk-LTWJYNEC.js +0 -100
- package/dist/chunk-LTWJYNEC.js.map +0 -1
- package/dist/chunk-LXYQOOXU.js.map +0 -1
- package/dist/chunk-MEKOWH5E.js.map +0 -1
- package/dist/chunk-NHYRIM4I.js.map +0 -1
- package/dist/chunk-NMZUW6VJ.js.map +0 -1
- package/dist/chunk-ORQD4AUO.js.map +0 -1
- package/dist/chunk-R4X5474U.js.map +0 -1
- package/dist/chunk-RL3Z747H.js.map +0 -1
- package/dist/chunk-TXUAGSFR.js.map +0 -1
- package/dist/chunk-UCCSJX64.js.map +0 -1
- package/dist/chunk-VJBFCNAU.js.map +0 -1
- package/dist/chunk-WSEXFTN4.js.map +0 -1
- package/dist/chunk-Y43PXON2.js.map +0 -1
- package/dist/chunk-ZBB5KQ6B.js.map +0 -1
- package/dist/eval/parity.d.ts +0 -74
- package/dist/mention-editor-B23OMFT2.js.map +0 -1
- package/dist/profile/humanizer-skill.d.ts +0 -23
- package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
- package/dist/sequences-react/components/BrandMark.d.ts +0 -10
- package/dist/skills/marketplace-drizzle.d.ts +0 -121
- package/dist/skills/marketplace-drizzle.js +0 -34
- package/dist/skills/marketplace-drizzle.js.map +0 -1
- package/dist/teams-react/components/BrandMark.d.ts +0 -10
- /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
- /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
- /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
- /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
- /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
- /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
- /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
- /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
- /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
- /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
- /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
- /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
- /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
|
@@ -2,6 +2,93 @@ import {
|
|
|
2
2
|
assertWorkspaceKeyCryptoUsable
|
|
3
3
|
} from "./chunk-VGS2NXLB.js";
|
|
4
4
|
|
|
5
|
+
// src/billing/identity-locks.ts
|
|
6
|
+
function createWorkspaceKeyLocks(leaseWaitMs, options, now, leaseMs, leasePollMs, leaseRenewIntervalMs, operationId2, sleep2) {
|
|
7
|
+
const localLocks = /* @__PURE__ */ new Map();
|
|
8
|
+
async function withLocalLock(scope, work) {
|
|
9
|
+
const previous = localLocks.get(scope) ?? Promise.resolve();
|
|
10
|
+
let release;
|
|
11
|
+
const current = new Promise((resolve) => {
|
|
12
|
+
release = resolve;
|
|
13
|
+
});
|
|
14
|
+
localLocks.set(scope, current);
|
|
15
|
+
await previous;
|
|
16
|
+
try {
|
|
17
|
+
return await work();
|
|
18
|
+
} finally {
|
|
19
|
+
release();
|
|
20
|
+
if (localLocks.get(scope) === current) localLocks.delete(scope);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function withDurableLease(scope, work, onLeaseLost) {
|
|
24
|
+
const leaseOperationId = operationId2();
|
|
25
|
+
const startedAt = Date.now();
|
|
26
|
+
let acquired = false;
|
|
27
|
+
while (!acquired && Date.now() - startedAt <= leaseWaitMs) {
|
|
28
|
+
acquired = await options.store.acquireLease(scope, leaseOperationId, now(), leaseMs);
|
|
29
|
+
if (!acquired) await sleep2(leasePollMs);
|
|
30
|
+
}
|
|
31
|
+
if (!acquired) throw new Error("workspace child-key issuance is busy; retry the request");
|
|
32
|
+
let stopped = false;
|
|
33
|
+
let leaseLost = null;
|
|
34
|
+
let leaseTimer;
|
|
35
|
+
let renewalPromise;
|
|
36
|
+
const scheduleRenewal = () => {
|
|
37
|
+
if (stopped || leaseLost) return;
|
|
38
|
+
leaseTimer = setTimeout(() => {
|
|
39
|
+
leaseTimer = void 0;
|
|
40
|
+
const renewal = (async () => {
|
|
41
|
+
try {
|
|
42
|
+
if (!await options.store.renewLease(scope, leaseOperationId, now(), leaseMs)) {
|
|
43
|
+
leaseLost = new Error("workspace child-key lease was lost during reconciliation");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
scheduleRenewal();
|
|
47
|
+
} catch (error) {
|
|
48
|
+
leaseLost = error instanceof Error ? error : new Error("workspace child-key lease renewal failed");
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
renewalPromise = renewal;
|
|
52
|
+
void renewal.finally(() => {
|
|
53
|
+
if (renewalPromise === renewal) renewalPromise = void 0;
|
|
54
|
+
}).catch(() => void 0);
|
|
55
|
+
}, leaseRenewIntervalMs);
|
|
56
|
+
};
|
|
57
|
+
scheduleRenewal();
|
|
58
|
+
let workError;
|
|
59
|
+
let leaseLossCleanupError;
|
|
60
|
+
try {
|
|
61
|
+
const result = await work();
|
|
62
|
+
if (leaseLost) throw leaseLost;
|
|
63
|
+
return result;
|
|
64
|
+
} catch (error) {
|
|
65
|
+
workError = error;
|
|
66
|
+
throw error;
|
|
67
|
+
} finally {
|
|
68
|
+
stopped = true;
|
|
69
|
+
if (leaseTimer) clearTimeout(leaseTimer);
|
|
70
|
+
if (renewalPromise) await renewalPromise;
|
|
71
|
+
if (leaseLost && onLeaseLost) {
|
|
72
|
+
try {
|
|
73
|
+
await onLeaseLost();
|
|
74
|
+
} catch (error) {
|
|
75
|
+
leaseLossCleanupError = error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
await options.store.releaseLease(scope, leaseOperationId);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if (workError === void 0) throw error;
|
|
82
|
+
}
|
|
83
|
+
if (workError === void 0 && leaseLossCleanupError) {
|
|
84
|
+
throw new Error("workspace child-key lease was lost and cleanup failed", { cause: leaseLossCleanupError });
|
|
85
|
+
}
|
|
86
|
+
if (workError === void 0 && leaseLost) throw leaseLost;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return { withLocalLock, withDurableLease };
|
|
90
|
+
}
|
|
91
|
+
|
|
5
92
|
// src/billing/identity-bound.ts
|
|
6
93
|
var DEFAULT_KEY_LIFETIME_MS = 55 * 6e4;
|
|
7
94
|
var DEFAULT_LEASE_MS = 6e4;
|
|
@@ -122,88 +209,155 @@ function createIdentityBoundWorkspaceKeyManager(options) {
|
|
|
122
209
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
123
210
|
const isRemoteMissing = options.isRemoteMissing ?? defaultRemoteMissing;
|
|
124
211
|
const recoveryProvisioner = options.recoveryProvisioner ?? options.provisioner;
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
212
|
+
const { withLocalLock, withDurableLease } = createWorkspaceKeyLocks(leaseWaitMs, options, now, leaseMs, leasePollMs, leaseRenewIntervalMs, operationId, sleep);
|
|
213
|
+
const { revokePending, markPending, cleanupProvisioning, reconcileProvisioning } = createWorkspaceKeyRecovery(revocationRetryMaxMs, revocationRetryBaseMs, options, now, recoveryProvisioner, isRemoteMissing, product);
|
|
214
|
+
async function retryPendingRevocationsUnlocked(scopeFilter, activeIdentity) {
|
|
215
|
+
const rows = await options.store.listPendingRevocations({
|
|
216
|
+
product,
|
|
217
|
+
workspaceId: scopeFilter?.workspaceId,
|
|
218
|
+
ownerUserId: scopeFilter?.ownerUserId,
|
|
219
|
+
now: now(),
|
|
220
|
+
limit: PENDING_REVOCATION_BATCH_SIZE
|
|
131
221
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
222
|
+
let completed = 0;
|
|
223
|
+
let pending = 0;
|
|
224
|
+
for (const row of rows) {
|
|
225
|
+
if (row.product !== product) continue;
|
|
226
|
+
if (scopeFilter && (row.workspaceId !== scopeFilter.workspaceId || row.ownerUserId !== scopeFilter.ownerUserId)) continue;
|
|
227
|
+
if (await revokePending(row, activeIdentity)) completed += 1;
|
|
228
|
+
else pending += 1;
|
|
139
229
|
}
|
|
230
|
+
return { completed, pending };
|
|
140
231
|
}
|
|
141
|
-
async function
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
232
|
+
async function assertNoPendingRevocations(identity) {
|
|
233
|
+
const rows = await options.store.listPendingRevocations({
|
|
234
|
+
product,
|
|
235
|
+
workspaceId: identity.workspaceId,
|
|
236
|
+
ownerUserId: identity.ownerUserId,
|
|
237
|
+
now: now(),
|
|
238
|
+
limit: PENDING_REVOCATION_BATCH_SIZE,
|
|
239
|
+
includeFuture: true
|
|
240
|
+
});
|
|
241
|
+
if (rows.some((row) => row.product === product && row.workspaceId === identity.workspaceId && row.ownerUserId === identity.ownerUserId)) {
|
|
242
|
+
throw new Error("a previous workspace child-key cleanup is pending; issuance is blocked until it completes");
|
|
148
243
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
244
|
+
}
|
|
245
|
+
async function retryPendingRevocations(scopeInput, identityInput) {
|
|
246
|
+
const identity = identityInput ? normalizeIdentity(identityInput) : void 0;
|
|
247
|
+
if (identity && scopeInput && (identity.workspaceId !== scopeInput.workspaceId || identity.ownerUserId !== scopeInput.ownerUserId)) {
|
|
248
|
+
throw new Error("workspace child key retry identity does not match its scope");
|
|
249
|
+
}
|
|
250
|
+
if (scopeInput) {
|
|
251
|
+
const workspaceId = scopeInput.workspaceId.trim();
|
|
252
|
+
const ownerUserId = scopeInput.ownerUserId.trim();
|
|
253
|
+
if (!workspaceId || !ownerUserId) throw new Error("workspace child key retry scope is incomplete");
|
|
254
|
+
const scope = scopeKey({ workspaceId, ownerUserId, product });
|
|
255
|
+
return withLocalLock(scope, () => withDurableLease(scope, async () => (await retryPendingRevocationsUnlocked({ workspaceId, ownerUserId }, identity)).completed));
|
|
256
|
+
}
|
|
257
|
+
if (identity) {
|
|
258
|
+
const scope = scopeKey(scopeFor(identity, product));
|
|
259
|
+
return withLocalLock(scope, () => withDurableLease(scope, async () => (await retryPendingRevocationsUnlocked({ workspaceId: identity.workspaceId, ownerUserId: identity.ownerUserId }, identity)).completed));
|
|
260
|
+
}
|
|
261
|
+
const rows = await options.store.listPendingRevocations({ product, now: now(), limit: PENDING_REVOCATION_BATCH_SIZE });
|
|
262
|
+
let completed = 0;
|
|
263
|
+
const scopes = /* @__PURE__ */ new Set();
|
|
264
|
+
for (const row of rows) {
|
|
265
|
+
if (row.product !== product) continue;
|
|
266
|
+
const scope = scopeKey({ workspaceId: row.workspaceId, ownerUserId: row.ownerUserId, product });
|
|
267
|
+
if (scopes.has(scope)) continue;
|
|
268
|
+
scopes.add(scope);
|
|
269
|
+
completed += await withLocalLock(scope, () => withDurableLease(scope, async () => (await retryPendingRevocationsUnlocked({
|
|
270
|
+
workspaceId: row.workspaceId,
|
|
271
|
+
ownerUserId: row.ownerUserId
|
|
272
|
+
})).completed));
|
|
273
|
+
}
|
|
274
|
+
return completed;
|
|
275
|
+
}
|
|
276
|
+
async function readActive(identity) {
|
|
277
|
+
const row = await options.store.getActive(scopeFor(identity, product));
|
|
278
|
+
if (!row) return null;
|
|
279
|
+
if (!sameIdentity(row, identity, product)) {
|
|
280
|
+
await options.store.markRevocationPending({
|
|
281
|
+
id: row.id,
|
|
282
|
+
error: "active child key identity does not match the authenticated owner and source",
|
|
283
|
+
nextAttemptAt: now(),
|
|
284
|
+
incrementAttempts: false
|
|
285
|
+
});
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
let remote;
|
|
178
289
|
try {
|
|
179
|
-
|
|
180
|
-
if (leaseLost) throw leaseLost;
|
|
181
|
-
return result;
|
|
290
|
+
remote = await recoveryProvisioner.getKey(row.keyId);
|
|
182
291
|
} catch (error) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
stopped = true;
|
|
187
|
-
if (leaseTimer) clearTimeout(leaseTimer);
|
|
188
|
-
if (renewalPromise) await renewalPromise;
|
|
189
|
-
if (leaseLost && onLeaseLost) {
|
|
190
|
-
try {
|
|
191
|
-
await onLeaseLost();
|
|
192
|
-
} catch (error) {
|
|
193
|
-
leaseLossCleanupError = error;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
try {
|
|
197
|
-
await options.store.releaseLease(scope, leaseOperationId);
|
|
198
|
-
} catch (error) {
|
|
199
|
-
if (workError === void 0) throw error;
|
|
200
|
-
}
|
|
201
|
-
if (workError === void 0 && leaseLossCleanupError) {
|
|
202
|
-
throw new Error("workspace child-key lease was lost and cleanup failed", { cause: leaseLossCleanupError });
|
|
292
|
+
if (isRemoteMissing(error)) {
|
|
293
|
+
await options.store.markRevoked(row.id, now());
|
|
294
|
+
return null;
|
|
203
295
|
}
|
|
204
|
-
|
|
296
|
+
throw error;
|
|
297
|
+
}
|
|
298
|
+
const usage = usageFromRemote(row, remote, now());
|
|
299
|
+
if (usage.exhausted) {
|
|
300
|
+
await options.store.markRevocationPending({
|
|
301
|
+
id: row.id,
|
|
302
|
+
error: "active child key is expired or exhausted",
|
|
303
|
+
nextAttemptAt: now(),
|
|
304
|
+
incrementAttempts: false
|
|
305
|
+
});
|
|
306
|
+
return null;
|
|
205
307
|
}
|
|
308
|
+
return { row, usage };
|
|
206
309
|
}
|
|
310
|
+
const { mint } = createWorkspaceKeyMinter(options, now, keyLifetimeMs, product, markPending, cleanupProvisioning, revokePending);
|
|
311
|
+
async function ensureKey(identityInput, keyOptions) {
|
|
312
|
+
const identity = normalizeIdentity(identityInput);
|
|
313
|
+
const budgetUsd = keyOptions?.budgetUsd ?? defaultBudgetUsd;
|
|
314
|
+
requirePositive(budgetUsd, "budgetUsd");
|
|
315
|
+
const scope = scopeKey(scopeFor(identity, product));
|
|
316
|
+
let mintedRemote = null;
|
|
317
|
+
return withLocalLock(scope, () => withDurableLease(scope, async () => {
|
|
318
|
+
const initialCleanup = await retryPendingRevocationsUnlocked(identity, identity);
|
|
319
|
+
if (initialCleanup.pending > 0) throw new Error("a previous workspace child-key cleanup is pending; issuance is blocked until it completes");
|
|
320
|
+
await reconcileProvisioning(identity);
|
|
321
|
+
const active = await readActive(identity);
|
|
322
|
+
if (active) {
|
|
323
|
+
const key = await options.crypto.decrypt(active.row.keyEncrypted);
|
|
324
|
+
if (!key.trim()) throw new Error("workspace child key secret is empty");
|
|
325
|
+
if (Date.parse(active.usage.expiresAt) > now().getTime()) return { key, usage: active.usage, refreshed: false };
|
|
326
|
+
await options.store.markRevocationPending({
|
|
327
|
+
id: active.row.id,
|
|
328
|
+
error: "active child key expired while it was read",
|
|
329
|
+
nextAttemptAt: now(),
|
|
330
|
+
incrementAttempts: false
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
const finalCleanup = await retryPendingRevocationsUnlocked(identity, identity);
|
|
334
|
+
if (finalCleanup.pending > 0) throw new Error("a previous workspace child-key cleanup is pending; issuance is blocked until it completes");
|
|
335
|
+
await assertNoPendingRevocations(identity);
|
|
336
|
+
return mint(identity, budgetUsd, (row, remoteId) => {
|
|
337
|
+
mintedRemote = { row, remoteId };
|
|
338
|
+
});
|
|
339
|
+
}, async () => {
|
|
340
|
+
const remote = mintedRemote;
|
|
341
|
+
if (!remote) return;
|
|
342
|
+
const cleaned = await revokePending({
|
|
343
|
+
...remote.row,
|
|
344
|
+
keyId: remote.remoteId,
|
|
345
|
+
status: "revocation_pending"
|
|
346
|
+
}, identity);
|
|
347
|
+
if (!cleaned) throw new Error("lease-loss child-key cleanup is pending");
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
async function getUsage(identityInput) {
|
|
351
|
+
const identity = normalizeIdentity(identityInput);
|
|
352
|
+
const scope = scopeKey(scopeFor(identity, product));
|
|
353
|
+
return withLocalLock(scope, () => withDurableLease(scope, async () => {
|
|
354
|
+
const active = await readActive(identity);
|
|
355
|
+
return active?.usage ?? null;
|
|
356
|
+
}));
|
|
357
|
+
}
|
|
358
|
+
return { ensureKey, getUsage, retryPendingRevocations };
|
|
359
|
+
}
|
|
360
|
+
function createWorkspaceKeyRecovery(revocationRetryMaxMs, revocationRetryBaseMs, options, now, recoveryProvisioner, isRemoteMissing, product) {
|
|
207
361
|
function retryDelay(attempts) {
|
|
208
362
|
return Math.min(revocationRetryMaxMs, revocationRetryBaseMs * 2 ** Math.min(Math.max(attempts - 1, 0), 5));
|
|
209
363
|
}
|
|
@@ -344,102 +498,9 @@ function createIdentityBoundWorkspaceKeyManager(options) {
|
|
|
344
498
|
}
|
|
345
499
|
}
|
|
346
500
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
workspaceId: scopeFilter?.workspaceId,
|
|
351
|
-
ownerUserId: scopeFilter?.ownerUserId,
|
|
352
|
-
now: now(),
|
|
353
|
-
limit: PENDING_REVOCATION_BATCH_SIZE
|
|
354
|
-
});
|
|
355
|
-
let completed = 0;
|
|
356
|
-
let pending = 0;
|
|
357
|
-
for (const row of rows) {
|
|
358
|
-
if (row.product !== product) continue;
|
|
359
|
-
if (scopeFilter && (row.workspaceId !== scopeFilter.workspaceId || row.ownerUserId !== scopeFilter.ownerUserId)) continue;
|
|
360
|
-
if (await revokePending(row, activeIdentity)) completed += 1;
|
|
361
|
-
else pending += 1;
|
|
362
|
-
}
|
|
363
|
-
return { completed, pending };
|
|
364
|
-
}
|
|
365
|
-
async function assertNoPendingRevocations(identity) {
|
|
366
|
-
const rows = await options.store.listPendingRevocations({
|
|
367
|
-
product,
|
|
368
|
-
workspaceId: identity.workspaceId,
|
|
369
|
-
ownerUserId: identity.ownerUserId,
|
|
370
|
-
now: now(),
|
|
371
|
-
limit: PENDING_REVOCATION_BATCH_SIZE,
|
|
372
|
-
includeFuture: true
|
|
373
|
-
});
|
|
374
|
-
if (rows.some((row) => row.product === product && row.workspaceId === identity.workspaceId && row.ownerUserId === identity.ownerUserId)) {
|
|
375
|
-
throw new Error("a previous workspace child-key cleanup is pending; issuance is blocked until it completes");
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
async function retryPendingRevocations(scopeInput, identityInput) {
|
|
379
|
-
const identity = identityInput ? normalizeIdentity(identityInput) : void 0;
|
|
380
|
-
if (identity && scopeInput && (identity.workspaceId !== scopeInput.workspaceId || identity.ownerUserId !== scopeInput.ownerUserId)) {
|
|
381
|
-
throw new Error("workspace child key retry identity does not match its scope");
|
|
382
|
-
}
|
|
383
|
-
if (scopeInput) {
|
|
384
|
-
const workspaceId = scopeInput.workspaceId.trim();
|
|
385
|
-
const ownerUserId = scopeInput.ownerUserId.trim();
|
|
386
|
-
if (!workspaceId || !ownerUserId) throw new Error("workspace child key retry scope is incomplete");
|
|
387
|
-
const scope = scopeKey({ workspaceId, ownerUserId, product });
|
|
388
|
-
return withLocalLock(scope, () => withDurableLease(scope, async () => (await retryPendingRevocationsUnlocked({ workspaceId, ownerUserId }, identity)).completed));
|
|
389
|
-
}
|
|
390
|
-
if (identity) {
|
|
391
|
-
const scope = scopeKey(scopeFor(identity, product));
|
|
392
|
-
return withLocalLock(scope, () => withDurableLease(scope, async () => (await retryPendingRevocationsUnlocked({ workspaceId: identity.workspaceId, ownerUserId: identity.ownerUserId }, identity)).completed));
|
|
393
|
-
}
|
|
394
|
-
const rows = await options.store.listPendingRevocations({ product, now: now(), limit: PENDING_REVOCATION_BATCH_SIZE });
|
|
395
|
-
let completed = 0;
|
|
396
|
-
const scopes = /* @__PURE__ */ new Set();
|
|
397
|
-
for (const row of rows) {
|
|
398
|
-
if (row.product !== product) continue;
|
|
399
|
-
const scope = scopeKey({ workspaceId: row.workspaceId, ownerUserId: row.ownerUserId, product });
|
|
400
|
-
if (scopes.has(scope)) continue;
|
|
401
|
-
scopes.add(scope);
|
|
402
|
-
completed += await withLocalLock(scope, () => withDurableLease(scope, async () => (await retryPendingRevocationsUnlocked({
|
|
403
|
-
workspaceId: row.workspaceId,
|
|
404
|
-
ownerUserId: row.ownerUserId
|
|
405
|
-
})).completed));
|
|
406
|
-
}
|
|
407
|
-
return completed;
|
|
408
|
-
}
|
|
409
|
-
async function readActive(identity) {
|
|
410
|
-
const row = await options.store.getActive(scopeFor(identity, product));
|
|
411
|
-
if (!row) return null;
|
|
412
|
-
if (!sameIdentity(row, identity, product)) {
|
|
413
|
-
await options.store.markRevocationPending({
|
|
414
|
-
id: row.id,
|
|
415
|
-
error: "active child key identity does not match the authenticated owner and source",
|
|
416
|
-
nextAttemptAt: now(),
|
|
417
|
-
incrementAttempts: false
|
|
418
|
-
});
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
let remote;
|
|
422
|
-
try {
|
|
423
|
-
remote = await recoveryProvisioner.getKey(row.keyId);
|
|
424
|
-
} catch (error) {
|
|
425
|
-
if (isRemoteMissing(error)) {
|
|
426
|
-
await options.store.markRevoked(row.id, now());
|
|
427
|
-
return null;
|
|
428
|
-
}
|
|
429
|
-
throw error;
|
|
430
|
-
}
|
|
431
|
-
const usage = usageFromRemote(row, remote, now());
|
|
432
|
-
if (usage.exhausted) {
|
|
433
|
-
await options.store.markRevocationPending({
|
|
434
|
-
id: row.id,
|
|
435
|
-
error: "active child key is expired or exhausted",
|
|
436
|
-
nextAttemptAt: now(),
|
|
437
|
-
incrementAttempts: false
|
|
438
|
-
});
|
|
439
|
-
return null;
|
|
440
|
-
}
|
|
441
|
-
return { row, usage };
|
|
442
|
-
}
|
|
501
|
+
return { revokePending, markPending, cleanupProvisioning, reconcileProvisioning };
|
|
502
|
+
}
|
|
503
|
+
function createWorkspaceKeyMinter(options, now, keyLifetimeMs, product, markPending, cleanupProvisioning, revokePending) {
|
|
443
504
|
async function mint(identity, budgetUsd, onRemoteKey) {
|
|
444
505
|
await assertWorkspaceKeyCryptoUsable(options.crypto);
|
|
445
506
|
const mintOperationId = operationId();
|
|
@@ -573,54 +634,7 @@ function createIdentityBoundWorkspaceKeyManager(options) {
|
|
|
573
634
|
}, now());
|
|
574
635
|
return { key: secret, usage, refreshed: true };
|
|
575
636
|
}
|
|
576
|
-
|
|
577
|
-
const identity = normalizeIdentity(identityInput);
|
|
578
|
-
const budgetUsd = keyOptions?.budgetUsd ?? defaultBudgetUsd;
|
|
579
|
-
requirePositive(budgetUsd, "budgetUsd");
|
|
580
|
-
const scope = scopeKey(scopeFor(identity, product));
|
|
581
|
-
let mintedRemote = null;
|
|
582
|
-
return withLocalLock(scope, () => withDurableLease(scope, async () => {
|
|
583
|
-
const initialCleanup = await retryPendingRevocationsUnlocked(identity, identity);
|
|
584
|
-
if (initialCleanup.pending > 0) throw new Error("a previous workspace child-key cleanup is pending; issuance is blocked until it completes");
|
|
585
|
-
await reconcileProvisioning(identity);
|
|
586
|
-
const active = await readActive(identity);
|
|
587
|
-
if (active) {
|
|
588
|
-
const key = await options.crypto.decrypt(active.row.keyEncrypted);
|
|
589
|
-
if (!key.trim()) throw new Error("workspace child key secret is empty");
|
|
590
|
-
if (Date.parse(active.usage.expiresAt) > now().getTime()) return { key, usage: active.usage, refreshed: false };
|
|
591
|
-
await options.store.markRevocationPending({
|
|
592
|
-
id: active.row.id,
|
|
593
|
-
error: "active child key expired while it was read",
|
|
594
|
-
nextAttemptAt: now(),
|
|
595
|
-
incrementAttempts: false
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
const finalCleanup = await retryPendingRevocationsUnlocked(identity, identity);
|
|
599
|
-
if (finalCleanup.pending > 0) throw new Error("a previous workspace child-key cleanup is pending; issuance is blocked until it completes");
|
|
600
|
-
await assertNoPendingRevocations(identity);
|
|
601
|
-
return mint(identity, budgetUsd, (row, remoteId) => {
|
|
602
|
-
mintedRemote = { row, remoteId };
|
|
603
|
-
});
|
|
604
|
-
}, async () => {
|
|
605
|
-
const remote = mintedRemote;
|
|
606
|
-
if (!remote) return;
|
|
607
|
-
const cleaned = await revokePending({
|
|
608
|
-
...remote.row,
|
|
609
|
-
keyId: remote.remoteId,
|
|
610
|
-
status: "revocation_pending"
|
|
611
|
-
}, identity);
|
|
612
|
-
if (!cleaned) throw new Error("lease-loss child-key cleanup is pending");
|
|
613
|
-
}));
|
|
614
|
-
}
|
|
615
|
-
async function getUsage(identityInput) {
|
|
616
|
-
const identity = normalizeIdentity(identityInput);
|
|
617
|
-
const scope = scopeKey(scopeFor(identity, product));
|
|
618
|
-
return withLocalLock(scope, () => withDurableLease(scope, async () => {
|
|
619
|
-
const active = await readActive(identity);
|
|
620
|
-
return active?.usage ?? null;
|
|
621
|
-
}));
|
|
622
|
-
}
|
|
623
|
-
return { ensureKey, getUsage, retryPendingRevocations };
|
|
637
|
+
return { mint };
|
|
624
638
|
}
|
|
625
639
|
|
|
626
640
|
// src/billing/index.ts
|
|
@@ -781,4 +795,4 @@ export {
|
|
|
781
795
|
createPlatformBalanceManager,
|
|
782
796
|
createWorkspaceKeyManager
|
|
783
797
|
};
|
|
784
|
-
//# sourceMappingURL=chunk-
|
|
798
|
+
//# sourceMappingURL=chunk-6JEDSKFH.js.map
|