@tangle-network/agent-app 0.43.56 → 0.43.58
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-UNL34LS2.js +12 -0
- package/dist/DesignCanvasEditor-FJIVYOA2.js +13 -0
- package/dist/IntakeInterview-3ZIQMZS6.js +8 -0
- package/dist/InvitationsPanel-CJ7DR4F7.js +8 -0
- package/dist/MembersPanel-BB4OD2KB.js +8 -0
- package/dist/{TimelineEditor-I35SJJAJ.js → TimelineEditor-2ECKSU6P.js} +3 -3
- package/dist/{VaultPane-DrQ_tH6c.d.ts → VaultPane-BDP6SB_K.d.ts} +1 -0
- package/dist/{access-BZ81Btt5.d.ts → access-490O6aOU.d.ts} +16 -1
- package/dist/app-auth/index.d.ts +6 -1
- package/dist/app-auth/index.js +3 -3
- package/dist/app-auth/index.js.map +1 -1
- package/dist/{apply-Gk4raT2j.d.ts → apply-6wlMOLf8.d.ts} +30 -1
- package/dist/assets/index.d.ts +41 -0
- package/dist/assets/index.js +1 -1
- package/dist/assistant/index.d.ts +26 -6
- package/dist/assistant/index.js +9 -9
- package/dist/assistant/index.js.map +1 -1
- package/dist/{attachment-validation-D0csjCvz.d.ts → attachment-validation-tPRp-PP1.d.ts} +7 -1
- package/dist/{auth-DuptSkWh.d.ts → auth-_FU8w01b.d.ts} +4 -1
- package/dist/billing/index.d.ts +8 -0
- package/dist/billing/index.js +1 -1
- package/dist/brand/index.d.ts +2 -0
- package/dist/brand/index.js.map +1 -1
- package/dist/brand-extraction/index.d.ts +3 -0
- package/dist/brand-extraction/index.js.map +1 -1
- package/dist/catalog/index.d.ts +2 -0
- package/dist/catalog/index.js +1 -1
- package/dist/chat-routes/index.d.ts +41 -10
- package/dist/chat-routes/index.js +15 -15
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-store/index.d.ts +18 -4
- package/dist/chat-store/index.js +4 -4
- package/dist/chat-store/index.js.map +1 -1
- package/dist/{chunk-H5FM75MR.js → chunk-22GLESKE.js} +3 -3
- package/dist/chunk-22GLESKE.js.map +1 -0
- package/dist/{chunk-WEBBJBDH.js → chunk-2DRYTJHI.js} +1 -1
- package/dist/chunk-2DRYTJHI.js.map +1 -0
- package/dist/{chunk-7EVZUIHW.js → chunk-3EJ6SFJI.js} +1 -1
- package/dist/chunk-3EJ6SFJI.js.map +1 -0
- package/dist/{chunk-HRJJH3RX.js → chunk-3OFQFW5K.js} +4 -4
- package/dist/chunk-3OFQFW5K.js.map +1 -0
- package/dist/{chunk-7SUPA2YT.js → chunk-4KKXZQPT.js} +2 -2
- package/dist/chunk-4KKXZQPT.js.map +1 -0
- package/dist/{chunk-5PTGEJZL.js → chunk-5SD6HT2V.js} +1 -1
- package/dist/chunk-5SD6HT2V.js.map +1 -0
- package/dist/{chunk-7C64WKAH.js → chunk-5SXS3YAB.js} +2 -2
- package/dist/{chunk-L2TG5DBW.js → chunk-5TESA4SN.js} +1 -1
- package/dist/chunk-5TESA4SN.js.map +1 -0
- package/dist/{chunk-63CE7FEZ.js → chunk-6XIAPIW6.js} +1 -1
- package/dist/chunk-6XIAPIW6.js.map +1 -0
- package/dist/{chunk-MFRCM32T.js → chunk-7CTIUCQ4.js} +1 -1
- package/dist/chunk-7CTIUCQ4.js.map +1 -0
- package/dist/{chunk-6KVH5SP5.js → chunk-7YW6EBDX.js} +2 -2
- package/dist/chunk-7YW6EBDX.js.map +1 -0
- package/dist/{chunk-ZXNXAQAH.js → chunk-AP2UXKUK.js} +1 -1
- package/dist/chunk-AP2UXKUK.js.map +1 -0
- package/dist/{chunk-K63OWUDJ.js → chunk-BPSV5AA2.js} +2 -2
- package/dist/chunk-BPSV5AA2.js.map +1 -0
- package/dist/{chunk-MFI4ZM7W.js → chunk-BT4QFCTB.js} +1 -1
- package/dist/chunk-BT4QFCTB.js.map +1 -0
- package/dist/{chunk-ZYBWGSAZ.js → chunk-BVKQKGRK.js} +1 -1
- package/dist/chunk-BVKQKGRK.js.map +1 -0
- package/dist/{chunk-RVUISYUE.js → chunk-C3NSB66C.js} +7 -7
- package/dist/chunk-C3NSB66C.js.map +1 -0
- package/dist/{chunk-BQV42AFK.js → chunk-CCVWR33L.js} +1 -1
- package/dist/chunk-CCVWR33L.js.map +1 -0
- package/dist/{chunk-MCJSS6SM.js → chunk-CQZSAR77.js} +1 -1
- package/dist/chunk-CQZSAR77.js.map +1 -0
- package/dist/{chunk-3SVAA3MA.js → chunk-DJ4VJIH5.js} +1 -1
- package/dist/chunk-DJ4VJIH5.js.map +1 -0
- package/dist/{chunk-XKBIYSSM.js → chunk-DTSPS2HV.js} +3 -3
- package/dist/chunk-DTSPS2HV.js.map +1 -0
- package/dist/{chunk-4QN75UHX.js → chunk-E7N67FYI.js} +8 -8
- package/dist/chunk-E7N67FYI.js.map +1 -0
- package/dist/{chunk-2QI7XV2T.js → chunk-FBVLEGEG.js} +1 -1
- package/dist/{chunk-2QI7XV2T.js.map → chunk-FBVLEGEG.js.map} +1 -1
- package/dist/{chunk-5RMIUJDI.js → chunk-FKCB5FTD.js} +1 -1
- package/dist/chunk-FKCB5FTD.js.map +1 -0
- package/dist/{chunk-EEPJGZJW.js → chunk-GPBRL2XR.js} +1 -1
- package/dist/chunk-GPBRL2XR.js.map +1 -0
- package/dist/{chunk-G3HCU7TA.js → chunk-GXE6KHTS.js} +1 -1
- package/dist/chunk-GXE6KHTS.js.map +1 -0
- package/dist/{chunk-65P3HJY3.js → chunk-HCOROIRT.js} +1 -1
- package/dist/chunk-HCOROIRT.js.map +1 -0
- package/dist/{chunk-54GSK2KK.js → chunk-HYTIHYNV.js} +2 -2
- package/dist/chunk-HYTIHYNV.js.map +1 -0
- package/dist/{chunk-5MG74GVQ.js → chunk-IG46XCZM.js} +3 -3
- package/dist/chunk-IG46XCZM.js.map +1 -0
- package/dist/{chunk-ND3XEGBE.js → chunk-JDEGS53O.js} +1 -1
- package/dist/chunk-JDEGS53O.js.map +1 -0
- package/dist/{chunk-7W5XSTUF.js → chunk-JML7WKWU.js} +1 -1
- package/dist/chunk-JML7WKWU.js.map +1 -0
- package/dist/{chunk-Q4TKVF3L.js → chunk-JTLYXUEV.js} +1 -1
- package/dist/chunk-JTLYXUEV.js.map +1 -0
- package/dist/{chunk-CCRVDLV3.js → chunk-JWBZ74TW.js} +2 -2
- package/dist/chunk-JWBZ74TW.js.map +1 -0
- package/dist/{chunk-ZU5GNSOJ.js → chunk-K3LIPKFV.js} +3 -3
- package/dist/chunk-K3LIPKFV.js.map +1 -0
- package/dist/{chunk-GQRL6VNU.js → chunk-LGBO24FL.js} +1 -1
- package/dist/chunk-LGBO24FL.js.map +1 -0
- package/dist/{chunk-SWUVTGMR.js → chunk-MEUNTJL5.js} +3 -3
- package/dist/{chunk-SWUVTGMR.js.map → chunk-MEUNTJL5.js.map} +1 -1
- package/dist/{chunk-YNALYIQ3.js → chunk-NLSSFLLS.js} +1 -1
- package/dist/chunk-NLSSFLLS.js.map +1 -0
- package/dist/{chunk-HFC4BTWJ.js → chunk-PTUMBMVH.js} +1 -1
- package/dist/chunk-PTUMBMVH.js.map +1 -0
- package/dist/{chunk-R4NOKZMD.js → chunk-ROLFDOMJ.js} +3 -3
- package/dist/{chunk-NYATNLRK.js → chunk-RT5RKAFX.js} +1 -1
- package/dist/chunk-RT5RKAFX.js.map +1 -0
- package/dist/{chunk-GNL3MG5J.js → chunk-S564OFTL.js} +2 -2
- package/dist/{chunk-GUSCYE3S.js → chunk-TQOFR6XY.js} +1 -1
- package/dist/chunk-TQOFR6XY.js.map +1 -0
- package/dist/{chunk-47C6PJCW.js → chunk-TZO3SOUL.js} +1 -1
- package/dist/chunk-TZO3SOUL.js.map +1 -0
- package/dist/{chunk-YGUNTIT5.js → chunk-UKTYKG57.js} +1 -1
- package/dist/chunk-UKTYKG57.js.map +1 -0
- package/dist/{chunk-23LUHHHN.js → chunk-VCOD5AOR.js} +1 -1
- package/dist/chunk-VCOD5AOR.js.map +1 -0
- package/dist/{chunk-5I72FRZY.js → chunk-VOJB7MVG.js} +2 -2
- package/dist/{chunk-XWJXZ6WE.js → chunk-VTWKH4YU.js} +2 -2
- package/dist/chunk-VTWKH4YU.js.map +1 -0
- package/dist/{chunk-4K7BZYO7.js → chunk-VWAEWOWK.js} +3 -3
- package/dist/chunk-VWAEWOWK.js.map +1 -0
- package/dist/{chunk-M2EBUDZ7.js → chunk-VWOPOLVO.js} +2 -2
- package/dist/chunk-VWOPOLVO.js.map +1 -0
- package/dist/{chunk-BN2USWIR.js → chunk-VYECQAGM.js} +2 -2
- package/dist/chunk-VYECQAGM.js.map +1 -0
- package/dist/{chunk-SIXYZ2FB.js → chunk-YJMCRXQQ.js} +1 -1
- package/dist/chunk-YJMCRXQQ.js.map +1 -0
- package/dist/{chunk-PJC4NXPA.js → chunk-YKBDH2UY.js} +3 -3
- package/dist/chunk-YKBDH2UY.js.map +1 -0
- package/dist/{chunk-XAWFPMAR.js → chunk-YKOM4ZLQ.js} +1 -1
- package/dist/chunk-YKOM4ZLQ.js.map +1 -0
- package/dist/{chunk-TKVJE63N.js → chunk-YRMLYFVR.js} +3 -3
- package/dist/chunk-YRMLYFVR.js.map +1 -0
- package/dist/{chunk-USYXHDKE.js → chunk-YZ6KQULN.js} +2 -2
- package/dist/{command-stack-B_-WNfZU.d.ts → command-stack-TNPWJCzW.d.ts} +14 -2
- package/dist/{completion-Kaqp_tWk.d.ts → completion-CvcNUz07.d.ts} +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/{contract-KfqJh_au.d.ts → contract-TjB68uqA.d.ts} +17 -0
- package/dist/design-canvas/drizzle.d.ts +10 -2
- package/dist/design-canvas/drizzle.js.map +1 -1
- package/dist/design-canvas/index.d.ts +29 -11
- package/dist/design-canvas/index.js +1070 -17
- package/dist/design-canvas/index.js.map +1 -1
- package/dist/design-canvas-react/engine.d.ts +42 -6
- package/dist/design-canvas-react/engine.js +4 -4
- package/dist/design-canvas-react/index.d.ts +12 -7
- package/dist/design-canvas-react/index.js +11 -11
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.d.ts +4 -4
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/durable-chat/index.d.ts +46 -1
- package/dist/durable-chat/index.js +3 -3
- package/dist/eval/index.d.ts +1 -1
- package/dist/{export-presets-DAsU5Wal.d.ts → export-presets-mgVulRaV.d.ts} +10 -1
- package/dist/{flow-types-Cb_AblZs.d.ts → flow-types-CqomVAUN.d.ts} +1 -0
- package/dist/harness/index.d.ts +5 -0
- package/dist/harness/index.js +1 -1
- package/dist/index.d.ts +10 -18
- package/dist/index.js +30 -231
- package/dist/intakes/api.d.ts +3 -2
- package/dist/intakes/api.js +3 -3
- package/dist/intakes/api.js.map +1 -1
- package/dist/intakes/drizzle.d.ts +10 -2
- package/dist/intakes/drizzle.js +3 -3
- package/dist/intakes/drizzle.js.map +1 -1
- package/dist/intakes/index.d.ts +2 -2
- package/dist/intakes/index.js +2 -2
- package/dist/intakes-react/index.d.ts +2 -1
- package/dist/intakes-react/index.js +2 -2
- package/dist/intakes-react/lazy.d.ts +2 -1
- package/dist/intakes-react/lazy.js +1 -1
- package/dist/intakes-react/lazy.js.map +1 -1
- package/dist/integrations/index.d.ts +4 -0
- package/dist/integrations/index.js +1 -1
- package/dist/interactions/index.d.ts +13 -2
- package/dist/interactions/index.js +2 -2
- package/dist/{invitations-CZ5G2tIn.d.ts → invitations-DoYMvXea.d.ts} +11 -1
- package/dist/{invitations-schema-DaMO4hZE.d.ts → invitations-schema-_fI7HkJP.d.ts} +5 -1
- package/dist/knowledge/index.d.ts +2 -0
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge-loop/index.d.ts +4 -1
- package/dist/knowledge-loop/index.js +1 -1
- package/dist/{lazy-C7LiVeFt.d.ts → lazy-DrkVyDpe.d.ts} +2 -2
- package/dist/{mcp-BHfIoGLW.d.ts → mcp-BjPqQ-3C.d.ts} +4 -2
- package/dist/{mcp-rpc-DLw_r9PQ.d.ts → mcp-rpc-BfUOsalw.d.ts} +3 -0
- package/dist/missions/index.d.ts +25 -0
- package/dist/missions/index.js +1 -1
- package/dist/{model-Bzi5i63l.d.ts → model-C8U0HZxL.d.ts} +1 -0
- package/dist/{model-dF2h4xT9.d.ts → model-DmdkIteM.d.ts} +19 -0
- package/dist/{model-BBwyOuWG.d.ts → model-DnfO_PdJ.d.ts} +25 -1
- package/dist/model-resolution/index.d.ts +10 -0
- package/dist/model-resolution/index.js.map +1 -1
- package/dist/{operations-DLIvvD00.d.ts → operations-ByJ6yXOW.d.ts} +20 -2
- package/dist/{parts-1sRYSPjF.d.ts → parts-n9XUon0a.d.ts} +29 -1
- package/dist/plans/index.d.ts +6 -0
- package/dist/plans/index.js +1 -1
- package/dist/platform/index.d.ts +24 -2
- package/dist/platform/index.js +3 -3
- package/dist/platform/index.js.map +1 -1
- package/dist/preflight/index.d.ts +3 -0
- package/dist/preflight/index.js +1 -1
- package/dist/preset-cloudflare/index.d.ts +4 -1
- package/dist/preset-cloudflare/index.js +2 -2
- package/dist/redact/index.d.ts +5 -0
- package/dist/redact/index.js +1 -1
- package/dist/{roles-BC1n4t37.d.ts → roles-B4nU3jDi.d.ts} +12 -0
- package/dist/run/index.d.ts +3 -0
- package/dist/run/index.js +1 -1
- package/dist/run/index.js.map +1 -1
- package/dist/runtime/index.d.ts +11 -4
- package/dist/runtime/index.js +4 -4
- package/dist/sandbox/index.d.ts +96 -3
- package/dist/sandbox/index.js +6 -6
- package/dist/{sandbox-terminal-BIIC__CP.d.ts → sandbox-terminal-ChNEdHF8.d.ts} +5 -0
- package/dist/sequences/drizzle.d.ts +11 -1
- package/dist/sequences/drizzle.js +1 -1
- package/dist/sequences/drizzle.js.map +1 -1
- package/dist/sequences/index.d.ts +32 -7
- package/dist/sequences/index.js +1562 -47
- package/dist/sequences/index.js.map +1 -1
- package/dist/sequences-react/index.d.ts +32 -2
- package/dist/sequences-react/index.js +3 -3
- package/dist/sequences-react/index.js.map +1 -1
- package/dist/{sso-CNOsARMJ.d.ts → sso-Cm00S61u.d.ts} +13 -0
- package/dist/{stale-turn-lock-C8Na1cFZ.d.ts → stale-turn-lock-DucQzvXu.d.ts} +2 -0
- package/dist/store/index.d.ts +5 -0
- package/dist/store/index.js.map +1 -1
- package/dist/{store-gckrNq-g.d.ts → store-B7LLlk9p.d.ts} +22 -1
- package/dist/{store-CFyxgTlD.d.ts → store-CqfDtnPQ.d.ts} +8 -2
- package/dist/stream/index.d.ts +10 -4
- package/dist/stream/index.js +4 -4
- package/dist/{stream-normalizer-DWvtmY6F.d.ts → stream-normalizer-C3M--r6y.d.ts} +17 -1
- package/dist/studio/index.d.ts +37 -0
- package/dist/studio/index.js +1 -1
- package/dist/studio-react/index.d.ts +3 -0
- package/dist/studio-react/index.js +1 -1
- package/dist/studio-react/index.js.map +1 -1
- package/dist/tangle/index.d.ts +3 -0
- package/dist/tangle/index.js +1 -1
- package/dist/teams/drizzle.d.ts +8 -4
- package/dist/teams/drizzle.js +1 -1
- package/dist/teams/drizzle.js.map +1 -1
- package/dist/teams/index.d.ts +4 -2
- package/dist/teams/index.js +3 -3
- package/dist/teams/invitations-api.d.ts +10 -4
- package/dist/teams/invitations-api.js +4 -4
- package/dist/teams/invitations-api.js.map +1 -1
- package/dist/teams/members-api.d.ts +4 -2
- package/dist/teams/members-api.js +3 -3
- package/dist/teams/resend.d.ts +5 -4
- package/dist/teams/resend.js +1 -1
- package/dist/teams/resend.js.map +1 -1
- package/dist/teams-react/index.d.ts +7 -2
- package/dist/teams-react/index.js +3 -3
- package/dist/teams-react/lazy.d.ts +5 -2
- package/dist/teams-react/lazy.js +2 -2
- package/dist/teams-react/lazy.js.map +1 -1
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +1 -1
- package/dist/theme/tailwind-preset.d.ts +1 -0
- package/dist/theme/tailwind-preset.js.map +1 -1
- package/dist/theme-contract/cli.js +1 -1
- package/dist/theme-contract/index.d.ts +3 -0
- package/dist/theme-contract/index.js +1 -1
- package/dist/tools/index.d.ts +13 -6
- package/dist/tools/index.js +3 -3
- package/dist/trace/index.d.ts +6 -1
- package/dist/trace/index.js +2 -2
- package/dist/{turn-buffer-C9mEgoop.d.ts → turn-buffer-DGnAPKwa.d.ts} +6 -0
- package/dist/turn-stream/index.d.ts +28 -2
- package/dist/turn-stream/index.js +1 -1
- package/dist/turn-stream/index.js.map +1 -1
- package/dist/{types-BEOvc_ue.d.ts → types-CBRyqijY.d.ts} +10 -0
- package/dist/vault/index.d.ts +1 -1
- package/dist/vault/lazy.d.ts +3 -2
- package/dist/vault/lazy.js.map +1 -1
- package/dist/web/index.d.ts +4 -0
- package/dist/web/index.js +1 -1
- package/dist/web-react/index.d.ts +51 -8
- package/dist/web-react/index.js +9 -9
- package/dist/web-react/terminal.d.ts +2 -2
- package/dist/web-react/terminal.js +1 -1
- package/package.json +3 -2
- package/dist/DesignCanvas-5DJAFDNC.js +0 -12
- package/dist/DesignCanvasEditor-XUJZARSN.js +0 -13
- package/dist/IntakeInterview-WHVKMNQW.js +0 -8
- package/dist/InvitationsPanel-XUUWZBPV.js +0 -8
- package/dist/MembersPanel-FOVHWUQ3.js +0 -8
- package/dist/chunk-23LUHHHN.js.map +0 -1
- package/dist/chunk-3SVAA3MA.js.map +0 -1
- package/dist/chunk-47C6PJCW.js.map +0 -1
- package/dist/chunk-4K7BZYO7.js.map +0 -1
- package/dist/chunk-4QN75UHX.js.map +0 -1
- package/dist/chunk-54GSK2KK.js.map +0 -1
- package/dist/chunk-5MG74GVQ.js.map +0 -1
- package/dist/chunk-5PTGEJZL.js.map +0 -1
- package/dist/chunk-5RMIUJDI.js.map +0 -1
- package/dist/chunk-63CE7FEZ.js.map +0 -1
- package/dist/chunk-65P3HJY3.js.map +0 -1
- package/dist/chunk-6KVH5SP5.js.map +0 -1
- package/dist/chunk-7EVZUIHW.js.map +0 -1
- package/dist/chunk-7SUPA2YT.js.map +0 -1
- package/dist/chunk-7W5XSTUF.js.map +0 -1
- package/dist/chunk-BN2USWIR.js.map +0 -1
- package/dist/chunk-BQV42AFK.js.map +0 -1
- package/dist/chunk-CCRVDLV3.js.map +0 -1
- package/dist/chunk-EEPJGZJW.js.map +0 -1
- package/dist/chunk-G3HCU7TA.js.map +0 -1
- package/dist/chunk-GQRL6VNU.js.map +0 -1
- package/dist/chunk-GUSCYE3S.js.map +0 -1
- package/dist/chunk-H5FM75MR.js.map +0 -1
- package/dist/chunk-HFC4BTWJ.js.map +0 -1
- package/dist/chunk-HRJJH3RX.js.map +0 -1
- package/dist/chunk-K63OWUDJ.js.map +0 -1
- package/dist/chunk-L2TG5DBW.js.map +0 -1
- package/dist/chunk-M2EBUDZ7.js.map +0 -1
- package/dist/chunk-MCJSS6SM.js.map +0 -1
- package/dist/chunk-MFI4ZM7W.js.map +0 -1
- package/dist/chunk-MFRCM32T.js.map +0 -1
- package/dist/chunk-ND3XEGBE.js.map +0 -1
- package/dist/chunk-NEOV2NQ3.js +0 -1617
- package/dist/chunk-NEOV2NQ3.js.map +0 -1
- package/dist/chunk-NYATNLRK.js.map +0 -1
- package/dist/chunk-PJC4NXPA.js.map +0 -1
- package/dist/chunk-Q4TKVF3L.js.map +0 -1
- package/dist/chunk-RVUISYUE.js.map +0 -1
- package/dist/chunk-SIXYZ2FB.js.map +0 -1
- package/dist/chunk-TKVJE63N.js.map +0 -1
- package/dist/chunk-WEBBJBDH.js.map +0 -1
- package/dist/chunk-WFMUDX5J.js +0 -1092
- package/dist/chunk-WFMUDX5J.js.map +0 -1
- package/dist/chunk-XAWFPMAR.js.map +0 -1
- package/dist/chunk-XKBIYSSM.js.map +0 -1
- package/dist/chunk-XWJXZ6WE.js.map +0 -1
- package/dist/chunk-YGUNTIT5.js.map +0 -1
- package/dist/chunk-YNALYIQ3.js.map +0 -1
- package/dist/chunk-ZU5GNSOJ.js.map +0 -1
- package/dist/chunk-ZXNXAQAH.js.map +0 -1
- package/dist/chunk-ZYBWGSAZ.js.map +0 -1
- /package/dist/{DesignCanvas-5DJAFDNC.js.map → DesignCanvas-UNL34LS2.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-XUJZARSN.js.map → DesignCanvasEditor-FJIVYOA2.js.map} +0 -0
- /package/dist/{IntakeInterview-WHVKMNQW.js.map → IntakeInterview-3ZIQMZS6.js.map} +0 -0
- /package/dist/{InvitationsPanel-XUUWZBPV.js.map → InvitationsPanel-CJ7DR4F7.js.map} +0 -0
- /package/dist/{MembersPanel-FOVHWUQ3.js.map → MembersPanel-BB4OD2KB.js.map} +0 -0
- /package/dist/{TimelineEditor-I35SJJAJ.js.map → TimelineEditor-2ECKSU6P.js.map} +0 -0
- /package/dist/{chunk-7C64WKAH.js.map → chunk-5SXS3YAB.js.map} +0 -0
- /package/dist/{chunk-R4NOKZMD.js.map → chunk-ROLFDOMJ.js.map} +0 -0
- /package/dist/{chunk-GNL3MG5J.js.map → chunk-S564OFTL.js.map} +0 -0
- /package/dist/{chunk-5I72FRZY.js.map → chunk-VOJB7MVG.js.map} +0 -0
- /package/dist/{chunk-USYXHDKE.js.map → chunk-YZ6KQULN.js.map} +0 -0
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { a as ChatInteractionField, h as InteractionAnswers, b as ChatInteractionStatus, C as ChatInteraction, i as InteractionCancelData, c as ChatSelectField, k as InteractionRequestWire } from '../contract-
|
|
4
|
-
export { d as ComposerAnswerDelivery, I as INTERACTION_CANCEL_EVENT, e as INTERACTION_EVENT, f as INTERACTION_RESOLVED_EVENT, g as InteractionAnswerValue, j as InteractionPersistedPart, N as NoticeKind, l as NoticePersistedPart, P as ParseInteractionAnswersResult, m as ParseInteractionResult, n as canTransitionInteractionStatus, o as cancelStatusFor, p as composerAnswerData, q as composerAnswerDeliveries, r as dedupeQuestionInteractionsByContent, s as fieldAcceptsFreeText, t as interactionFromWireRequest, u as interactionPartKey, v as interactionToPersistedPart, w as isRenderableInteractionKind, x as isSafeInteractionFieldKey, y as isTerminalInteractionStatus, z as noticePart, A as noticePartKey, B as parseInteractionAnswers, D as parseInteractionCancel, E as parseInteractionRequest, F as persistedPartToInteraction, G as questionInteractionContentSignature, H as stampInteractionAnswers } from '../contract-
|
|
3
|
+
import { a as ChatInteractionField, h as InteractionAnswers, b as ChatInteractionStatus, C as ChatInteraction, i as InteractionCancelData, c as ChatSelectField, k as InteractionRequestWire } from '../contract-TjB68uqA.js';
|
|
4
|
+
export { d as ComposerAnswerDelivery, I as INTERACTION_CANCEL_EVENT, e as INTERACTION_EVENT, f as INTERACTION_RESOLVED_EVENT, g as InteractionAnswerValue, j as InteractionPersistedPart, N as NoticeKind, l as NoticePersistedPart, P as ParseInteractionAnswersResult, m as ParseInteractionResult, n as canTransitionInteractionStatus, o as cancelStatusFor, p as composerAnswerData, q as composerAnswerDeliveries, r as dedupeQuestionInteractionsByContent, s as fieldAcceptsFreeText, t as interactionFromWireRequest, u as interactionPartKey, v as interactionToPersistedPart, w as isRenderableInteractionKind, x as isSafeInteractionFieldKey, y as isTerminalInteractionStatus, z as noticePart, A as noticePartKey, B as parseInteractionAnswers, D as parseInteractionCancel, E as parseInteractionRequest, F as persistedPartToInteraction, G as questionInteractionContentSignature, H as stampInteractionAnswers } from '../contract-TjB68uqA.js';
|
|
5
5
|
import { ChatPlan } from '../plans/index.js';
|
|
6
6
|
import { InteractionData } from '@tangle-network/agent-interface';
|
|
7
7
|
export { InteractionData, InteractionOutcome, InteractionRequest } from '@tangle-network/agent-interface';
|
|
8
|
-
import { K as FileMention, f as ChatMentionPart, a as ChatAttachmentPart, C as ChatAttachmentKind, O as ChatAttachmentInput } from '../parts-
|
|
9
|
-
export { e as ChatMentionKind, N as ChatTurnFilePartInput, M as ChatTurnPartInput, L as ChatTurnRequestPayload, R as DISPATCH_MAX_MEDIA_PARTS, T as DISPATCH_MAX_PARTS, U as DISPATCH_REQUEST_MAX_BYTES, V as DISPATCH_STRUCTURAL_RESERVE_BYTES, Z as ProducerErrorEvent, _ as ProducerNoticeEvent, $ as ProducerPassthroughEvent, a0 as ProducerPassthroughEventType, a1 as ProducerReasoningEvent, a2 as ProducerTextEvent, a3 as ProducerToolCallEvent, a4 as ProducerToolResultEvent, a5 as ProducerUsageEvent, a6 as ProducerWireEvent, t as attachmentInputToPart, u as attachmentKindForMime, v as attachmentPartsFromMessageParts, a9 as base64WireLen, aa as buildMentionPromptBlock, ab as chatTurnRequestInit, ac as fileMentionsToParts, y as isChatAttachmentPart, ae as mediaTypeForMentionPath, H as mentionInputToPart, af as mentionKindForPath, I as mentionPartsFromMessageParts } from '../parts-
|
|
8
|
+
import { K as FileMention, f as ChatMentionPart, a as ChatAttachmentPart, C as ChatAttachmentKind, O as ChatAttachmentInput } from '../parts-n9XUon0a.js';
|
|
9
|
+
export { e as ChatMentionKind, N as ChatTurnFilePartInput, M as ChatTurnPartInput, L as ChatTurnRequestPayload, R as DISPATCH_MAX_MEDIA_PARTS, T as DISPATCH_MAX_PARTS, U as DISPATCH_REQUEST_MAX_BYTES, V as DISPATCH_STRUCTURAL_RESERVE_BYTES, Z as ProducerErrorEvent, _ as ProducerNoticeEvent, $ as ProducerPassthroughEvent, a0 as ProducerPassthroughEventType, a1 as ProducerReasoningEvent, a2 as ProducerTextEvent, a3 as ProducerToolCallEvent, a4 as ProducerToolResultEvent, a5 as ProducerUsageEvent, a6 as ProducerWireEvent, t as attachmentInputToPart, u as attachmentKindForMime, v as attachmentPartsFromMessageParts, a9 as base64WireLen, aa as buildMentionPromptBlock, ab as chatTurnRequestInit, ac as fileMentionsToParts, y as isChatAttachmentPart, ae as mediaTypeForMentionPath, H as mentionInputToPart, af as mentionKindForPath, I as mentionPartsFromMessageParts } from '../parts-n9XUon0a.js';
|
|
10
10
|
import { S as StepAgentActivity } from '../agent-activity-C8ZG0F0M.js';
|
|
11
|
-
import { a as FlowTrace } from '../flow-types-
|
|
12
|
-
export { S as SandboxTerminalConnection, a as SandboxTerminalConnectionResponse, U as UseSandboxTerminalConnectionOptions, b as UseSandboxTerminalConnectionResult, t as tabTerminalConnectionId, u as useSandboxTerminalConnection } from '../sandbox-terminal-
|
|
11
|
+
import { a as FlowTrace } from '../flow-types-CqomVAUN.js';
|
|
12
|
+
export { S as SandboxTerminalConnection, a as SandboxTerminalConnectionResponse, U as UseSandboxTerminalConnectionOptions, b as UseSandboxTerminalConnectionResult, t as tabTerminalConnectionId, u as useSandboxTerminalConnection } from '../sandbox-terminal-ChNEdHF8.js';
|
|
13
13
|
import { CatalogModel } from '../catalog/index.js';
|
|
14
14
|
import { Harness } from '../harness/index.js';
|
|
15
|
-
export { a as ATTACHMENT_ACCEPT, e as FileIndexReadyResponse, f as FileIndexResponse, g as FileIndexWarmingResponse } from '../attachment-validation-
|
|
16
|
-
export { d as attachmentPartKey } from '../stream-normalizer-
|
|
15
|
+
export { a as ATTACHMENT_ACCEPT, e as FileIndexReadyResponse, f as FileIndexResponse, g as FileIndexWarmingResponse } from '../attachment-validation-tPRp-PP1.js';
|
|
16
|
+
export { d as attachmentPartKey } from '../stream-normalizer-C3M--r6y.js';
|
|
17
17
|
|
|
18
|
+
/** Represent durable plan decisions as either approved or rejected */
|
|
18
19
|
type DurablePlanDecision = 'approved' | 'rejected';
|
|
19
20
|
/** Stable authority receipt for the follow-up turn dispatched by a plan
|
|
20
21
|
* decision. Consumers must make `attachFollowUp` idempotent by `receiptId`;
|
|
@@ -26,6 +27,7 @@ interface DurablePlanFollowUpReceipt {
|
|
|
26
27
|
turnId: string;
|
|
27
28
|
state: string;
|
|
28
29
|
}
|
|
30
|
+
/** Describe the result of a durable plan decision including plan details and pending statuses */
|
|
29
31
|
interface DurablePlanDecisionResult {
|
|
30
32
|
plan: ChatPlan;
|
|
31
33
|
followUp?: DurablePlanFollowUpReceipt;
|
|
@@ -33,26 +35,31 @@ interface DurablePlanDecisionResult {
|
|
|
33
35
|
projectionPending?: boolean;
|
|
34
36
|
effectPending?: boolean;
|
|
35
37
|
}
|
|
38
|
+
/** Define input parameters for making a durable plan decision including optional feedback */
|
|
36
39
|
interface DurablePlanDecisionInput {
|
|
37
40
|
planId: string;
|
|
38
41
|
revision: number;
|
|
39
42
|
decision: DurablePlanDecision;
|
|
40
43
|
feedback?: string;
|
|
41
44
|
}
|
|
45
|
+
/** Define input parameters for retrieving the current durable plan including optional revision number */
|
|
42
46
|
interface DurablePlanCurrentInput {
|
|
43
47
|
planId: string;
|
|
44
48
|
revision?: number;
|
|
45
49
|
}
|
|
50
|
+
/** Define methods to obtain and decide durable plan decisions asynchronously */
|
|
46
51
|
interface DurablePlanDecisionClient {
|
|
47
52
|
current: (input: DurablePlanCurrentInput) => Promise<DurablePlanDecisionResult>;
|
|
48
53
|
decide: (input: DurablePlanDecisionInput) => Promise<DurablePlanDecisionResult>;
|
|
49
54
|
}
|
|
55
|
+
/** Represent errors from DurablePlanClient operations including status, code, and current plan details */
|
|
50
56
|
declare class DurablePlanClientError extends Error {
|
|
51
57
|
readonly status: number;
|
|
52
58
|
readonly code?: string | undefined;
|
|
53
59
|
readonly currentPlan?: ChatPlan | undefined;
|
|
54
60
|
constructor(message: string, status: number, code?: string | undefined, currentPlan?: ChatPlan | undefined);
|
|
55
61
|
}
|
|
62
|
+
/** Define configuration options for creating a durable plan decision client */
|
|
56
63
|
interface DurablePlanDecisionClientOptions {
|
|
57
64
|
url: string | ((input: DurablePlanCurrentInput | DurablePlanDecisionInput) => string);
|
|
58
65
|
body?: Record<string, unknown> | ((input: DurablePlanDecisionInput) => Record<string, unknown>);
|
|
@@ -62,6 +69,7 @@ interface DurablePlanDecisionClientOptions {
|
|
|
62
69
|
* product routing fields are injected; workspace/session identity is still
|
|
63
70
|
* resolved and authorized on the server. */
|
|
64
71
|
declare function createDurablePlanDecisionClient(options: DurablePlanDecisionClientOptions): DurablePlanDecisionClient;
|
|
72
|
+
/** Define options to configure durable plan flow with plan, client, and optional callbacks */
|
|
65
73
|
interface UseDurablePlanFlowOptions {
|
|
66
74
|
plan: ChatPlan;
|
|
67
75
|
client: DurablePlanDecisionClient;
|
|
@@ -69,6 +77,7 @@ interface UseDurablePlanFlowOptions {
|
|
|
69
77
|
attachFollowUp?: (receipt: DurablePlanFollowUpReceipt) => Promise<void> | void;
|
|
70
78
|
onUpdated?: (plan: ChatPlan) => void;
|
|
71
79
|
}
|
|
80
|
+
/** Define the result and actions for managing a durable plan flow including decisions, restoration, and error handling */
|
|
72
81
|
interface UseDurablePlanFlowResult {
|
|
73
82
|
plan: ChatPlan;
|
|
74
83
|
deciding: DurablePlanDecision | null;
|
|
@@ -103,6 +112,7 @@ declare function interactionStatusLabels(labels: {
|
|
|
103
112
|
* share one shape around the card's noun ("question"/"plan"); any extra notes
|
|
104
113
|
* (e.g. a plan's `declined` revision line) merge on top. */
|
|
105
114
|
declare function interactionTerminalNotes(noun: string, extra?: Partial<Record<ChatInteractionStatus, string>>): Partial<Record<ChatInteractionStatus, string>>;
|
|
115
|
+
/** Define a record mapping field names to objects with optional selected, text, and custom string arrays or values */
|
|
106
116
|
type FieldValues = Record<string, {
|
|
107
117
|
selected?: string[];
|
|
108
118
|
text?: string;
|
|
@@ -118,6 +128,7 @@ declare function fieldAnswer(field: ChatInteractionField, values: FieldValues):
|
|
|
118
128
|
/** All required fields answered → the respond payload; else null (not
|
|
119
129
|
* submittable yet). Optional unanswered fields are omitted. */
|
|
120
130
|
declare function buildAnswerData(fields: ChatInteractionField[], values: FieldValues): InteractionData | null;
|
|
131
|
+
/** Determine if a status is late answerable by checking if it is expired or cancelled */
|
|
121
132
|
declare function isLateAnswerableStatus(status: ChatInteractionStatus): boolean;
|
|
122
133
|
/** Secrets must never leave the sidecar answer channel for the visible chat
|
|
123
134
|
* transcript, so a secret-bearing ask cannot be late-answered. */
|
|
@@ -125,7 +136,9 @@ declare function hasSecretField(fields: ChatInteractionField[]): boolean;
|
|
|
125
136
|
/** Renders the late answer as a self-contained chat message: the original
|
|
126
137
|
* question, its context, and the user's answer(s). */
|
|
127
138
|
declare function lateAnswerMessage(interaction: ChatInteraction, data: InteractionData): string;
|
|
139
|
+
/** Define the timeout duration in milliseconds for submitting an interaction */
|
|
128
140
|
declare const INTERACTION_SUBMIT_TIMEOUT_MS = 30000;
|
|
141
|
+
/** Provide the timeout message displayed when the agent cannot be reached during interaction submission */
|
|
129
142
|
declare const INTERACTION_SUBMIT_TIMEOUT_MESSAGE = "Could not reach the agent. Try again.";
|
|
130
143
|
/** One card submission: which ask, resolved how, with what answers. */
|
|
131
144
|
interface InteractionAnswerSubmission {
|
|
@@ -133,6 +146,7 @@ interface InteractionAnswerSubmission {
|
|
|
133
146
|
outcome: 'accepted' | 'declined';
|
|
134
147
|
data?: InteractionData;
|
|
135
148
|
}
|
|
149
|
+
/** Resolve the result of an interaction submission indicating success or failure with details */
|
|
136
150
|
type InteractionSubmitResult = {
|
|
137
151
|
ok: true;
|
|
138
152
|
} | {
|
|
@@ -150,6 +164,7 @@ declare function responseErrorMessage(res: Response): Promise<{
|
|
|
150
164
|
code?: string;
|
|
151
165
|
message: string;
|
|
152
166
|
}>;
|
|
167
|
+
/** Define options for submitting interaction answers including URL, body, timeout, and fetch implementation */
|
|
153
168
|
interface InteractionAnswerSubmitterOptions {
|
|
154
169
|
/** The product's answer route (the POST half of `createInteractionAnswerRoute`).
|
|
155
170
|
* A function when the URL carries the session (e.g. `/api/sessions/${id}/interactions`). */
|
|
@@ -219,11 +234,13 @@ declare function DurableChatCards({ parts, canWrite, submitInteraction, decidePl
|
|
|
219
234
|
* lines (live pump, queued follow, resume replay) feeds the same callbacks.
|
|
220
235
|
*/
|
|
221
236
|
|
|
237
|
+
/** Define the structure for a chat tool call including optional ID, name, and arguments object */
|
|
222
238
|
interface ChatStreamToolCall {
|
|
223
239
|
toolCallId?: string;
|
|
224
240
|
toolName: string;
|
|
225
241
|
args: Record<string, unknown>;
|
|
226
242
|
}
|
|
243
|
+
/** Describe the result of a chat stream tool including its outcome and optional metadata fields */
|
|
227
244
|
interface ChatStreamToolResult {
|
|
228
245
|
toolCallId?: string;
|
|
229
246
|
toolName?: string;
|
|
@@ -235,6 +252,7 @@ interface ChatStreamToolResult {
|
|
|
235
252
|
message?: string;
|
|
236
253
|
};
|
|
237
254
|
}
|
|
255
|
+
/** Define callbacks to handle events and data during a chat streaming session */
|
|
238
256
|
interface ChatStreamCallbacks {
|
|
239
257
|
onTurnId?: (turnId: string) => void;
|
|
240
258
|
onText?: (delta: string) => void;
|
|
@@ -273,6 +291,7 @@ interface ChatStreamCallbacks {
|
|
|
273
291
|
/** A durable-plan snapshot from any plan lifecycle event. */
|
|
274
292
|
onPlan?: (plan: ChatPlan) => void;
|
|
275
293
|
}
|
|
294
|
+
/** Represent the result of consuming a chat stream including turn ID and content reception status */
|
|
276
295
|
interface ConsumeChatStreamResult {
|
|
277
296
|
turnId: string | null;
|
|
278
297
|
/** True when any text/reasoning/tool activity was received. */
|
|
@@ -286,6 +305,7 @@ declare function dispatchChatStreamLine(line: string, cb: ChatStreamCallbacks):
|
|
|
286
305
|
/** Drain one NDJSON body into the callbacks. Throws on transport failure
|
|
287
306
|
* (caller decides whether to resume). */
|
|
288
307
|
declare function consumeChatStream(body: ReadableStream<Uint8Array>, cb: ChatStreamCallbacks): Promise<ConsumeChatStreamResult>;
|
|
308
|
+
/** Define options for managing and resuming streaming chat interactions with callbacks */
|
|
289
309
|
interface StreamChatOptions {
|
|
290
310
|
/** Start the turn (POST the chat request); must return a streaming Response. */
|
|
291
311
|
start: () => Promise<Response>;
|
|
@@ -455,14 +475,19 @@ interface DurablePlanCardProps {
|
|
|
455
475
|
}
|
|
456
476
|
declare function DurablePlanCard({ plan, canWrite, decide, deciding, error, renderMarkdown, className, }: DurablePlanCardProps): react.JSX.Element;
|
|
457
477
|
|
|
478
|
+
/** Manage storage and retrieval of interaction attempt keys by interaction and submission identifiers */
|
|
458
479
|
interface InteractionAttemptStore {
|
|
459
480
|
get(interactionId: string, submissionSignature: string): string | null;
|
|
460
481
|
set(interactionId: string, submissionSignature: string, attemptKey: string): void;
|
|
461
482
|
delete(interactionId: string, submissionSignature: string): void;
|
|
462
483
|
}
|
|
484
|
+
/** Create a session-based store to manage interaction attempts using provided storage and optional namespace */
|
|
463
485
|
declare function createSessionInteractionAttemptStore(storage: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>, namespace?: string): InteractionAttemptStore;
|
|
486
|
+
/** Create an in-memory store to manage interaction attempts keyed by ID and signature */
|
|
464
487
|
declare function createMemoryInteractionAttemptStore(): InteractionAttemptStore;
|
|
488
|
+
/** Generate a stable string signature from an interaction answer submission */
|
|
465
489
|
declare function interactionSubmissionSignature(submission: InteractionAnswerSubmission): string;
|
|
490
|
+
/** Define options for submitting durable interaction answers with attempt tracking and optional key creation */
|
|
466
491
|
interface DurableInteractionAnswerSubmitterOptions extends InteractionAnswerSubmitterOptions {
|
|
467
492
|
attempts: InteractionAttemptStore;
|
|
468
493
|
createAttemptKey?: () => string;
|
|
@@ -505,7 +530,9 @@ declare function resolveChatInteraction(list: ChatInteraction[], id: string, sta
|
|
|
505
530
|
/** Settles every still-pending ask when the turn ends: `answered` for a turn
|
|
506
531
|
* that completed cleanly, `expired` for one that failed. */
|
|
507
532
|
declare function terminalizePendingChatInteractions(list: ChatInteraction[], status: Extract<ChatInteractionStatus, 'answered' | 'expired'>): ChatInteraction[];
|
|
533
|
+
/** Define modes for restoring chat interactions with legacy or durable strategies */
|
|
508
534
|
type ChatInteractionRestoreMode = 'legacy' | 'durable';
|
|
535
|
+
/** Define options to control how chat interactions are restored during the restore process */
|
|
509
536
|
interface RestoreChatInteractionsOptions {
|
|
510
537
|
/**
|
|
511
538
|
* `legacy` settles pending asks absent from the sidecar list as answered,
|
|
@@ -523,6 +550,7 @@ declare function restoreChatInteractions(list: ChatInteraction[], outstanding: I
|
|
|
523
550
|
* acknowledged answer values enrich an existing pending card without relying
|
|
524
551
|
* on the sidecar's outstanding-list absence. */
|
|
525
552
|
declare function hydrateChatInteractions(list: ChatInteraction[], persisted: ChatInteraction[]): ChatInteraction[];
|
|
553
|
+
/** Resolve and manage chat interactions with methods to update, cancel, mark resolved, and restore state */
|
|
526
554
|
interface UseChatInteractionsResult {
|
|
527
555
|
/** All known interactions, insertion-ordered. */
|
|
528
556
|
interactions: ChatInteraction[];
|
|
@@ -543,7 +571,9 @@ interface UseChatInteractionsResult {
|
|
|
543
571
|
/** Drop everything (thread switch). */
|
|
544
572
|
reset: () => void;
|
|
545
573
|
}
|
|
574
|
+
/** Resolve options for restoring chat interactions from previous sessions */
|
|
546
575
|
type UseChatInteractionsOptions = RestoreChatInteractionsOptions;
|
|
576
|
+
/** Manage chat interactions state with upsert, cancel, resolve, and restore capabilities */
|
|
547
577
|
declare function useChatInteractions(options?: UseChatInteractionsOptions): UseChatInteractionsResult;
|
|
548
578
|
|
|
549
579
|
/**
|
|
@@ -607,6 +637,7 @@ declare const INDEX_REFRESH_AFTER_MS: number;
|
|
|
607
637
|
/** Popover empty-state copy for a `ready` index whose query matched nothing.
|
|
608
638
|
* Loading/warming/error states have their own copy — see `emptyTextFor`. */
|
|
609
639
|
declare const DEFAULT_MENTION_EMPTY_TEXT = "No matching files";
|
|
640
|
+
/** Define options for configuring file mention fetching, caching, and display behavior */
|
|
610
641
|
interface UseFileMentionsOptions {
|
|
611
642
|
/** GET endpoint returning `FileIndexResponse` (a `createSandboxFileIndexRoute`). */
|
|
612
643
|
indexUrl: string;
|
|
@@ -621,6 +652,7 @@ interface UseFileMentionsOptions {
|
|
|
621
652
|
* the query matched nothing. Default {@link DEFAULT_MENTION_EMPTY_TEXT}. */
|
|
622
653
|
emptyText?: string;
|
|
623
654
|
}
|
|
655
|
+
/** Provide properties and methods to manage and refresh file mentions in a composer interface */
|
|
624
656
|
interface UseFileMentionsResult {
|
|
625
657
|
/** Spread straight into `AgentComposer`'s `mention` prop. */
|
|
626
658
|
mention: ComposerMentionProp;
|
|
@@ -635,6 +667,7 @@ interface UseFileMentionsResult {
|
|
|
635
667
|
* than firing a second request. */
|
|
636
668
|
refresh: () => Promise<void>;
|
|
637
669
|
}
|
|
670
|
+
/** Resolve and manage file mention data with configurable fetching and state handling */
|
|
638
671
|
declare function useFileMentions(options: UseFileMentionsOptions): UseFileMentionsResult;
|
|
639
672
|
|
|
640
673
|
/**
|
|
@@ -773,6 +806,7 @@ declare function MessageAttachments({ parts, resolveFileUrl, justify, fetchFile
|
|
|
773
806
|
* may reach a Node builtin, `sandbox-ui`, or an engine package.
|
|
774
807
|
*/
|
|
775
808
|
|
|
809
|
+
/** Define options for configuring file upload behavior and handling in a composer component */
|
|
776
810
|
interface UseComposerAttachmentsOptions {
|
|
777
811
|
/** Simple upload target: every file POSTs here. Ignored when
|
|
778
812
|
* `buildUploadRequest` is provided. */
|
|
@@ -811,6 +845,7 @@ interface UseComposerAttachmentsOptions {
|
|
|
811
845
|
* loaded yet). Default `true`. */
|
|
812
846
|
enabled?: boolean;
|
|
813
847
|
}
|
|
848
|
+
/** Provide staged file chips, ready attachments, and methods to add, retry, or drop composer files */
|
|
814
849
|
interface UseComposerAttachmentsResult {
|
|
815
850
|
/** Chip models for `ChatComposer`'s `pendingFiles` prop, one per staged
|
|
816
851
|
* file — `kind` is always `'file'` (agent-app's `ComposerFile.kind`
|
|
@@ -872,6 +907,7 @@ declare function ProviderLogo({ provider, size }: ProviderLogoProps): ReactNode;
|
|
|
872
907
|
* up and sprints when a burst lands (e.g. a reasoning summary arriving all at
|
|
873
908
|
* once still *types out* instead of popping in).
|
|
874
909
|
*/
|
|
910
|
+
/** Define configuration options for controlling smooth text reveal animation rates */
|
|
875
911
|
interface SmoothRevealOptions {
|
|
876
912
|
/** Baseline reveal rate when nearly caught up. Default 90 chars/s. */
|
|
877
913
|
baseCharsPerSecond?: number;
|
|
@@ -1119,6 +1155,7 @@ interface AgentSessionControlsProps {
|
|
|
1119
1155
|
}
|
|
1120
1156
|
declare function AgentSessionControls(props: AgentSessionControlsProps): react.JSX.Element;
|
|
1121
1157
|
|
|
1158
|
+
/** Describe metrics related to a chat message including model, token counts, and duration */
|
|
1122
1159
|
interface ChatMessageMetrics {
|
|
1123
1160
|
modelUsed?: string;
|
|
1124
1161
|
promptTokens?: number;
|
|
@@ -1146,6 +1183,7 @@ interface ToolRunRecord {
|
|
|
1146
1183
|
status: 'running' | 'complete' | 'error';
|
|
1147
1184
|
steps: ToolRunStep[];
|
|
1148
1185
|
}
|
|
1186
|
+
/** Define properties required to run a drill and handle its closure event */
|
|
1149
1187
|
interface RunDrillInProps {
|
|
1150
1188
|
run: ToolRunRecord;
|
|
1151
1189
|
onClose: () => void;
|
|
@@ -1156,6 +1194,7 @@ interface RunDrillInProps {
|
|
|
1156
1194
|
* main chat, never here.
|
|
1157
1195
|
*/
|
|
1158
1196
|
declare function RunDrillIn({ run, onClose }: RunDrillInProps): react.JSX.Element;
|
|
1197
|
+
/** Describe the structure and state of a tool call within a chat interaction */
|
|
1159
1198
|
interface ChatToolCallInfo {
|
|
1160
1199
|
id: string;
|
|
1161
1200
|
name: string;
|
|
@@ -1184,6 +1223,7 @@ type ChatMessageSegment = {
|
|
|
1184
1223
|
kind: 'tool';
|
|
1185
1224
|
call: ChatToolCallInfo;
|
|
1186
1225
|
};
|
|
1226
|
+
/** Describe the structure and properties of a chat message with roles, content, and optional metadata */
|
|
1187
1227
|
interface ChatUiMessage extends ChatMessageMetrics {
|
|
1188
1228
|
id: string;
|
|
1189
1229
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -1198,6 +1238,7 @@ interface ChatUiMessage extends ChatMessageMetrics {
|
|
|
1198
1238
|
* shared plan/question cards render directly from these projections. */
|
|
1199
1239
|
parts?: Array<Record<string, unknown>>;
|
|
1200
1240
|
}
|
|
1241
|
+
/** Define properties for rendering chat messages with optional models, markdown, extras, and durable cards */
|
|
1201
1242
|
interface ChatMessagesProps {
|
|
1202
1243
|
messages: ChatUiMessage[];
|
|
1203
1244
|
/** Catalogue models, for per-message cost from pricing. Pass [] to skip cost. */
|
|
@@ -1253,6 +1294,7 @@ interface ChatEmptyDoor {
|
|
|
1253
1294
|
description?: string;
|
|
1254
1295
|
onSelect: () => void;
|
|
1255
1296
|
}
|
|
1297
|
+
/** Define properties for rendering the chat empty state with customizable text and starting doors */
|
|
1256
1298
|
interface ChatEmptyStateProps {
|
|
1257
1299
|
/** Product name shown next to the Tangle mark. Default "Agent". */
|
|
1258
1300
|
productName?: string;
|
|
@@ -1269,6 +1311,7 @@ interface ChatEmptyStateProps {
|
|
|
1269
1311
|
* broken". Concrete + actionable — never a "coming soon" placeholder.
|
|
1270
1312
|
*/
|
|
1271
1313
|
declare function ChatEmptyState({ productName, headline, subline, doors, }: ChatEmptyStateProps): react.JSX.Element;
|
|
1314
|
+
/** Handle approval and rejection actions for proposals with asynchronous support */
|
|
1272
1315
|
interface ProposalApprovalHandlers {
|
|
1273
1316
|
onApprove: (proposalId: string, toolCallId: string) => void | Promise<void>;
|
|
1274
1317
|
onReject: (proposalId: string, toolCallId: string) => void | Promise<void>;
|
package/dist/web-react/index.js
CHANGED
|
@@ -73,15 +73,15 @@ import {
|
|
|
73
73
|
useSmoothText,
|
|
74
74
|
useThinkingSeconds,
|
|
75
75
|
waterfallLayout
|
|
76
|
-
} from "../chunk-
|
|
76
|
+
} from "../chunk-C3NSB66C.js";
|
|
77
77
|
import {
|
|
78
78
|
tabTerminalConnectionId,
|
|
79
79
|
useSandboxTerminalConnection
|
|
80
|
-
} from "../chunk-
|
|
80
|
+
} from "../chunk-HCOROIRT.js";
|
|
81
81
|
import {
|
|
82
82
|
ATTACHMENT_ACCEPT
|
|
83
|
-
} from "../chunk-
|
|
84
|
-
import "../chunk-
|
|
83
|
+
} from "../chunk-BPSV5AA2.js";
|
|
84
|
+
import "../chunk-FBVLEGEG.js";
|
|
85
85
|
import {
|
|
86
86
|
DISPATCH_MAX_MEDIA_PARTS,
|
|
87
87
|
DISPATCH_MAX_PARTS,
|
|
@@ -99,10 +99,10 @@ import {
|
|
|
99
99
|
mentionInputToPart,
|
|
100
100
|
mentionKindForPath,
|
|
101
101
|
mentionPartsFromMessageParts
|
|
102
|
-
} from "../chunk-
|
|
102
|
+
} from "../chunk-DTSPS2HV.js";
|
|
103
103
|
import {
|
|
104
104
|
attachmentPartKey
|
|
105
|
-
} from "../chunk-
|
|
105
|
+
} from "../chunk-IG46XCZM.js";
|
|
106
106
|
import {
|
|
107
107
|
INTERACTION_CANCEL_EVENT,
|
|
108
108
|
INTERACTION_EVENT,
|
|
@@ -127,9 +127,9 @@ import {
|
|
|
127
127
|
persistedPartToInteraction,
|
|
128
128
|
questionInteractionContentSignature,
|
|
129
129
|
stampInteractionAnswers
|
|
130
|
-
} from "../chunk-
|
|
131
|
-
import "../chunk-
|
|
132
|
-
import "../chunk-
|
|
130
|
+
} from "../chunk-YKOM4ZLQ.js";
|
|
131
|
+
import "../chunk-YJMCRXQQ.js";
|
|
132
|
+
import "../chunk-CQZSAR77.js";
|
|
133
133
|
export {
|
|
134
134
|
ATTACHMENT_ACCEPT,
|
|
135
135
|
AgentActivityPanel,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SandboxTerminalConnection } from '../sandbox-terminal-
|
|
2
|
-
export { a as SandboxTerminalConnectionResponse, U as UseSandboxTerminalConnectionOptions, b as UseSandboxTerminalConnectionResult, t as tabTerminalConnectionId, u as useSandboxTerminalConnection } from '../sandbox-terminal-
|
|
1
|
+
import { S as SandboxTerminalConnection } from '../sandbox-terminal-ChNEdHF8.js';
|
|
2
|
+
export { a as SandboxTerminalConnectionResponse, U as UseSandboxTerminalConnectionOptions, b as UseSandboxTerminalConnectionResult, t as tabTerminalConnectionId, u as useSandboxTerminalConnection } from '../sandbox-terminal-ChNEdHF8.js';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-app",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.58",
|
|
4
4
|
"packageManager": "pnpm@10.33.4",
|
|
5
5
|
"description": "Application-shell framework for Tangle agent products: a bounded tool loop, the structured agent→app tool side channel, integration-hub client, per-workspace billing, and crypto — composed over the Tangle agent substrate through typed seams.",
|
|
6
6
|
"keywords": [
|
|
@@ -407,12 +407,13 @@
|
|
|
407
407
|
"test": "vitest run",
|
|
408
408
|
"test:watch": "vitest",
|
|
409
409
|
"typecheck": "tsc --noEmit",
|
|
410
|
-
"docs:gen": "
|
|
410
|
+
"docs:gen": "agent-docs",
|
|
411
411
|
"knip": "knip"
|
|
412
412
|
},
|
|
413
413
|
"devDependencies": {
|
|
414
414
|
"@cloudflare/workers-types": "^4.20250620.0",
|
|
415
415
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
416
|
+
"@tangle-network/agent-docs": "0.2.0",
|
|
416
417
|
"@tangle-network/agent-eval": "^0.100.0",
|
|
417
418
|
"@tangle-network/agent-integrations": "^0.44.0",
|
|
418
419
|
"@tangle-network/agent-interface": "^0.15.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DesignCanvas,
|
|
3
|
-
DesignCanvas_default
|
|
4
|
-
} from "./chunk-H5FM75MR.js";
|
|
5
|
-
import "./chunk-XWJXZ6WE.js";
|
|
6
|
-
import "./chunk-M2EBUDZ7.js";
|
|
7
|
-
import "./chunk-HFC4BTWJ.js";
|
|
8
|
-
export {
|
|
9
|
-
DesignCanvas,
|
|
10
|
-
DesignCanvas_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=DesignCanvas-5DJAFDNC.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DesignCanvasEditor
|
|
3
|
-
} from "./chunk-4QN75UHX.js";
|
|
4
|
-
import "./chunk-H5FM75MR.js";
|
|
5
|
-
import "./chunk-BN2USWIR.js";
|
|
6
|
-
import "./chunk-XWJXZ6WE.js";
|
|
7
|
-
import "./chunk-47C6PJCW.js";
|
|
8
|
-
import "./chunk-M2EBUDZ7.js";
|
|
9
|
-
import "./chunk-HFC4BTWJ.js";
|
|
10
|
-
export {
|
|
11
|
-
DesignCanvasEditor
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=DesignCanvasEditor-XUJZARSN.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/stream/turn-identity.ts","../src/stream/turn-buffer.ts"],"sourcesContent":["import type { JsonRecord } from './stream-normalizer'\n\nexport interface PersistedChatMessageForTurn {\n id: string\n role: 'user' | 'assistant' | 'system' | 'tool'\n content: string\n parts: Array<Record<string, unknown>> | null\n}\n\nexport interface ResolvedChatTurn {\n turnIndex: number\n shouldInsertUserMessage: boolean\n priorMessages: PersistedChatMessageForTurn[]\n userParts: JsonRecord[]\n}\n\nexport function normalizeClientTurnId(value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n if (typeof value !== 'string') throw new Error('turnId must be a string')\n const trimmed = value.trim()\n if (!trimmed) throw new Error('turnId must not be blank')\n if (trimmed.length > 160) throw new Error('turnId is too long')\n if (!/^[A-Za-z0-9:_-]+$/.test(trimmed)) {\n throw new Error('turnId contains unsupported characters')\n }\n return trimmed\n}\n\nexport function buildUserTextParts(text: string, turnId: string | undefined): JsonRecord[] {\n const part: JsonRecord = { type: 'text', text }\n if (turnId) part.turnId = turnId\n return [part]\n}\n\nexport function messageHasTurnId(message: PersistedChatMessageForTurn, turnId: string): boolean {\n for (const part of message.parts ?? []) {\n if (part && typeof part === 'object' && String(part.turnId ?? '') === turnId) {\n return true\n }\n }\n return false\n}\n\nexport function resolveChatTurn(input: {\n existingMessages: PersistedChatMessageForTurn[]\n userContent: string\n turnId?: string\n}): ResolvedChatTurn {\n const { existingMessages, userContent, turnId } = input\n const reusableIndex = findReusableUserMessageIndex(existingMessages, userContent, turnId)\n if (reusableIndex >= 0) {\n return {\n turnIndex: countUserMessages(existingMessages.slice(0, reusableIndex)),\n shouldInsertUserMessage: false,\n priorMessages: existingMessages.slice(0, reusableIndex),\n userParts: buildUserTextParts(userContent, turnId),\n }\n }\n\n return {\n turnIndex: countUserMessages(existingMessages),\n shouldInsertUserMessage: true,\n priorMessages: existingMessages,\n userParts: buildUserTextParts(userContent, turnId),\n }\n}\n\nfunction findReusableUserMessageIndex(\n messages: PersistedChatMessageForTurn[],\n userContent: string,\n turnId: string | undefined,\n): number {\n if (turnId) {\n for (let index = messages.length - 1; index >= 0; index -= 1) {\n const message = messages[index]\n if (message?.role === 'user' && messageHasTurnId(message, turnId)) return index\n }\n }\n\n const latest = messages.at(-1)\n if (latest?.role === 'user' && latest.content === userContent) {\n return messages.length - 1\n }\n\n return -1\n}\n\nfunction countUserMessages(messages: PersistedChatMessageForTurn[]): number {\n return messages.filter((message) => message.role === 'user').length\n}\n","/**\n * Resumable chat turns — the router-path answer to \"streams resume on\n * disconnect\" (issue #27). A turn's loop events are teed into a store as they\n * stream; the turn keeps running under `ctx.waitUntil` when the client drops;\n * a reconnecting client replays the buffered tail by sequence number and\n * keeps following until the turn completes.\n *\n * POST /chat/stream → pumpBufferedTurn(...) + live NDJSON\n * GET /chat/stream/:turnId → replayTurnEvents({ fromSeq }) → NDJSON\n *\n * Storage is a structural seam ({@link TurnEventStore}); a D1 implementation\n * ships here because that's what Cloudflare products have (KV is unsuitable:\n * eventually consistent cross-isolate). Per-token deltas would mean hundreds\n * of rows per turn, so consecutive text/reasoning deltas are coalesced within\n * a flush window before they are persisted — replay yields slightly chunkier\n * deltas with identical concatenation.\n */\n\nexport type TurnStatus = 'running' | 'complete' | 'error'\n\nexport interface BufferedTurnEvent {\n seq: number\n /** The serialized event line (JSON string, no trailing newline). */\n event: string\n}\n\nexport interface TurnEventStore {\n append(turnId: string, events: BufferedTurnEvent[]): Promise<void>\n read(turnId: string, fromSeq: number): Promise<BufferedTurnEvent[]>\n /** Record turn lifecycle. `scopeId` (a thread/session id) is optional and lets\n * {@link TurnEventStore.listRunning} rediscover this turn after a client reload\n * loses the turnId; stores that don't track scope ignore it. */\n setStatus(turnId: string, status: TurnStatus, scopeId?: string): Promise<void>\n getStatus(turnId: string): Promise<TurnStatus | null>\n /** Running turnIds for a scope, newest first — so a reloaded client (clientRunId\n * lost) can find and resume the in-flight turn. Optional: a store records it\n * only if `setStatus` was given a `scopeId`. */\n listRunning?(scopeId: string): Promise<string[]>\n}\n\n// ── coalescing ────────────────────────────────────────────────────────────\n\ntype AnyRecord = Record<string, unknown>\n\nfunction deltaTypeOf(ev: unknown): 'text' | 'reasoning' | null {\n const e = ev as AnyRecord | null\n if (!e || typeof e !== 'object') return null\n const inner = (e.kind === 'event' ? (e.event as AnyRecord | undefined) : e) as AnyRecord | undefined\n if (!inner || typeof inner !== 'object') return null\n if ((inner.type === 'text' || inner.type === 'reasoning') && typeof inner.text === 'string') {\n return inner.type\n }\n return null\n}\n\n/** Merge consecutive text/reasoning deltas of the same type into one event.\n * Concatenation-preserving: replaying the coalesced stream produces the same\n * accumulated text as the original. */\nexport function coalesceDeltas(events: unknown[]): unknown[] {\n const out: unknown[] = []\n for (const ev of events) {\n const type = deltaTypeOf(ev)\n const prev = out[out.length - 1]\n if (type && prev && deltaTypeOf(prev) === type) {\n const read = (x: unknown): AnyRecord =>\n ((x as AnyRecord).kind === 'event' ? (x as AnyRecord).event : x) as AnyRecord\n const merged = JSON.parse(JSON.stringify(prev)) as AnyRecord\n read(merged).text = String(read(prev).text) + String(read(ev).text)\n out[out.length - 1] = merged\n continue\n }\n out.push(ev)\n }\n return out\n}\n\nfunction asPartUpdate(ev: unknown): { partId: unknown; delta: unknown } | null {\n const e = ev as AnyRecord | null\n if (!e || typeof e !== 'object' || e.type !== 'message.part.updated') return null\n const data = e.data as AnyRecord | undefined\n if (!data || typeof data !== 'object') return null\n const part = data.part as AnyRecord | undefined\n const partId = part?.id ?? data.partId ?? part?.partId ?? null\n return { partId, delta: data.delta }\n}\n\n/**\n * Coalesce consecutive `message.part.updated` deltas for the SAME part into one\n * event. agent-runtime products stream `ChatStreamEvent` NDJSON\n * (`{type:'message.part.updated', data:{part, delta}}`); pumped through the\n * buffer with the default tool-loop coalescer, every per-token delta persists as\n * its own row because that coalescer never recognizes the shape. Pass this as\n * {@link PumpBufferedTurnOptions.coalesce} instead.\n *\n * Concatenation-preserving for BOTH consumer styles: the merged event keeps the\n * LATEST event's `data.part` (already the cumulative accumulation) and sets\n * `data.delta` to the concatenation of the merged deltas, so a client that\n * appends `delta` and one that reads the cumulative `part` both reconstruct the\n * identical final text.\n */\nexport function coalesceChatStreamEvents(events: unknown[]): unknown[] {\n const out: unknown[] = []\n for (const ev of events) {\n const cur = asPartUpdate(ev)\n const prevEv = out[out.length - 1]\n const prev = prevEv ? asPartUpdate(prevEv) : null\n if (cur && prev && cur.partId != null && cur.partId === prev.partId) {\n // Base the merged row on the latest event (its `part` is the most complete\n // accumulation); carry forward the summed delta.\n const merged = JSON.parse(JSON.stringify(ev)) as AnyRecord\n ;(merged.data as AnyRecord).delta = String(prev.delta ?? '') + String(cur.delta ?? '')\n out[out.length - 1] = merged\n continue\n }\n out.push(ev)\n }\n return out\n}\n\n// ── buffering core (the tap) ────────────────────────────────────────────────\n\nexport interface BufferedTurnOptions {\n store: TurnEventStore\n turnId: string\n /** Deliver one serialized line to the live client. Throwing here (client\n * disconnected) does NOT stop buffering — events keep persisting. */\n write?: (line: string) => Promise<void> | void\n /** Flush buffered events to the store at most this often. Default 400ms. */\n flushIntervalMs?: number\n /** Per-flush coalescer. Default {@link coalesceDeltas} (tool-loop text/reasoning\n * deltas). agent-runtime products streaming `ChatStreamEvent` pass\n * {@link coalesceChatStreamEvents} so per-token deltas don't each persist as a\n * row. Must be concatenation-preserving. */\n coalesce?: (events: unknown[]) => unknown[]\n /** Optional scope (thread/session id) recorded with the turn status, so\n * {@link TurnEventStore.listRunning} can find this turn after a reload. */\n scopeId?: string\n}\n\n/** A push-driven buffer for a turn whose producer the caller does NOT own. */\nexport interface BufferedTurnTap {\n /** Buffer one event: persist (coalesced, on the flush window) + best-effort\n * live-deliver. Wire to a push source's per-event hook (e.g. agent-runtime\n * `handleChatTurn`'s `hooks.onEvent`). Marks the turn 'running' on first call. */\n onEvent(raw: unknown): Promise<void>\n /** Settle the turn: final flush + set status. Call after the producer resolves\n * ('complete') or rejects ('error'). 'error' flushes what was produced first. */\n done(status?: Extract<TurnStatus, 'complete' | 'error'>): Promise<void>\n}\n\n/**\n * The buffering core. Sequence-numbers every event, delivers it to `write`\n * (best-effort — a disconnected client never stops buffering), and flushes to\n * the store in coalesced batches. Drives both transports:\n *\n * • {@link pumpBufferedTurn} — when you OWN an `AsyncIterable` producer.\n * • this tap (`onEvent`/`done`) — when the producer owns iteration and only\n * hands you a push callback (agent-runtime `handleChatTurn`'s `hooks.onEvent`\n * + the finished body). Durability stays here in the shell; the engine needs\n * no `TurnEventStore` seam.\n */\nexport function createBufferedTurnTap(opts: BufferedTurnOptions): BufferedTurnTap {\n const flushIntervalMs = opts.flushIntervalMs ?? 400\n const coalesce = opts.coalesce ?? coalesceDeltas\n const startedAt = Date.now()\n let seq = 0\n let clientGone = false\n let pending: unknown[] = []\n let lastFlush = Date.now()\n let started = false\n\n async function flush(): Promise<void> {\n if (pending.length === 0) return\n const batch = coalesce(pending)\n pending = []\n const rows = batch.map((ev) => ({ seq: ++seq, event: JSON.stringify(ev) }))\n await opts.store.append(opts.turnId, rows)\n lastFlush = Date.now()\n }\n\n async function ensureStarted(): Promise<void> {\n if (started) return\n started = true\n await opts.store.setStatus(opts.turnId, 'running', opts.scopeId)\n }\n\n return {\n async onEvent(raw) {\n await ensureStarted()\n // Stamp ms-since-turn-start so any stored turn is replayable AND traceable\n // (see ../trace) from the same buffered rows.\n const ev = raw && typeof raw === 'object' ? { ...(raw as Record<string, unknown>), _t: Date.now() - startedAt } : raw\n pending.push(ev)\n if (!clientGone && opts.write) {\n try {\n // Live delivery carries a provisional ordering hint, not the persisted\n // seq (coalescing changes seq assignment); clients resume with the\n // seqs from replay, or 0 for \"everything\".\n await opts.write(JSON.stringify(ev))\n } catch {\n clientGone = true\n }\n }\n if (Date.now() - lastFlush >= flushIntervalMs) await flush()\n },\n async done(status = 'complete') {\n await ensureStarted()\n if (status === 'error') {\n await flush().catch(() => {})\n await opts.store.setStatus(opts.turnId, 'error', opts.scopeId).catch(() => {})\n return\n }\n await flush()\n await opts.store.setStatus(opts.turnId, 'complete', opts.scopeId)\n },\n }\n}\n\n// ── pump (producer side) ──────────────────────────────────────────────────\n\nexport interface PumpBufferedTurnOptions extends BufferedTurnOptions {\n source: AsyncIterable<unknown>\n}\n\n/**\n * Drive a turn to completion regardless of the live client, when you OWN the\n * producer as an `AsyncIterable`. A thin driver over {@link createBufferedTurnTap}.\n * Returns a promise that resolves when the turn finishes — hand it to\n * `ctx.waitUntil` so a disconnect can't kill the turn. Never rejects on\n * client-write failure; a source error marks the turn 'error' (after flushing\n * what was produced) and rethrows.\n */\nexport async function pumpBufferedTurn(opts: PumpBufferedTurnOptions): Promise<void> {\n const tap = createBufferedTurnTap(opts)\n try {\n for await (const raw of opts.source) await tap.onEvent(raw)\n await tap.done('complete')\n } catch (err) {\n await tap.done('error')\n throw err\n }\n}\n\n// ── replay (consumer side) ────────────────────────────────────────────────\n\nexport interface ReplayTurnEventsOptions {\n store: TurnEventStore\n turnId: string\n /** Replay strictly after this sequence number (0 = from the beginning). */\n fromSeq?: number\n /** Poll cadence while the turn is still running. Default 500ms. */\n pollMs?: number\n /** Give up following a 'running' turn after this long. Default 120s. */\n timeoutMs?: number\n}\n\n/**\n * Yield buffered events after `fromSeq`, then keep polling while the turn is\n * still 'running' until it completes, errors, or times out. Terminates with a\n * final `{seq: -1, event: '{\"type\":\"turn_status\",...}'}` marker so clients\n * know why the replay ended.\n */\nexport async function* replayTurnEvents(opts: ReplayTurnEventsOptions): AsyncGenerator<BufferedTurnEvent> {\n const pollMs = opts.pollMs ?? 500\n const timeoutMs = opts.timeoutMs ?? 120_000\n let cursor = opts.fromSeq ?? 0\n const deadline = Date.now() + timeoutMs\n\n for (;;) {\n const batch = await opts.store.read(opts.turnId, cursor)\n for (const row of batch) {\n cursor = Math.max(cursor, row.seq)\n yield row\n }\n const status = await opts.store.getStatus(opts.turnId)\n if (status !== 'running') {\n yield { seq: -1, event: JSON.stringify({ type: 'turn_status', status: status ?? 'unknown' }) }\n return\n }\n if (Date.now() >= deadline) {\n yield { seq: -1, event: JSON.stringify({ type: 'turn_status', status: 'timeout' }) }\n return\n }\n await new Promise((r) => setTimeout(r, pollMs))\n }\n}\n\n// ── D1 store ──────────────────────────────────────────────────────────────\n\n/** Minimal structural D1 contract (Cloudflare `D1Database` satisfies it). */\nexport interface D1LikeForTurns {\n prepare(sql: string): {\n bind(...values: unknown[]): {\n run(): Promise<unknown>\n all<T = Record<string, unknown>>(): Promise<{ results: T[] }>\n first<T = Record<string, unknown>>(): Promise<T | null>\n }\n }\n}\n\n/** Schema for the D1 store — append to the product's migrations. */\nexport const TURN_EVENTS_MIGRATION_SQL = `\nCREATE TABLE IF NOT EXISTS turn_events (\n turnId TEXT NOT NULL,\n seq INTEGER NOT NULL,\n event TEXT NOT NULL,\n PRIMARY KEY (turnId, seq)\n);\nCREATE TABLE IF NOT EXISTS turn_status (\n turnId TEXT PRIMARY KEY,\n status TEXT NOT NULL,\n scopeId TEXT,\n updatedAt TEXT NOT NULL\n);\nCREATE INDEX IF NOT EXISTS idx_turn_status_scope ON turn_status (scopeId, status);\n`\n\n/** For deployments whose `turn_status` table predates `scopeId`/`listRunning` —\n * run once to add the column (the CREATE above already includes it for new\n * deployments). SQLite ignores a duplicate-add error if already applied. */\nexport const TURN_STATUS_SCOPE_MIGRATION_SQL = `ALTER TABLE turn_status ADD COLUMN scopeId TEXT;`\n\nexport function createD1TurnEventStore(db: D1LikeForTurns): TurnEventStore {\n return {\n async append(turnId, events) {\n if (!events.length) return\n // One multi-row insert per flush window keeps write volume bounded.\n const placeholders = events.map(() => '(?, ?, ?)').join(', ')\n const values = events.flatMap((e) => [turnId, e.seq, e.event])\n await db.prepare(`INSERT OR IGNORE INTO turn_events (turnId, seq, event) VALUES ${placeholders}`).bind(...values).run()\n },\n async read(turnId, fromSeq) {\n const { results } = await db\n .prepare('SELECT seq, event FROM turn_events WHERE turnId = ? AND seq > ? ORDER BY seq ASC')\n .bind(turnId, fromSeq)\n .all<{ seq: number; event: string }>()\n return results\n },\n async setStatus(turnId, status, scopeId) {\n // COALESCE preserves a scopeId set on the initial 'running' write when a\n // later 'complete'/'error' write passes none.\n await db\n .prepare(\n 'INSERT INTO turn_status (turnId, status, scopeId, updatedAt) VALUES (?, ?, ?, ?) ON CONFLICT(turnId) DO UPDATE SET status = excluded.status, scopeId = COALESCE(excluded.scopeId, turn_status.scopeId), updatedAt = excluded.updatedAt',\n )\n .bind(turnId, status, scopeId ?? null, new Date().toISOString())\n .run()\n },\n async getStatus(turnId) {\n const row = await db.prepare('SELECT status FROM turn_status WHERE turnId = ?').bind(turnId).first<{ status: TurnStatus }>()\n return row?.status ?? null\n },\n async listRunning(scopeId) {\n const { results } = await db\n .prepare(\"SELECT turnId FROM turn_status WHERE scopeId = ? AND status = 'running' ORDER BY updatedAt DESC\")\n .bind(scopeId)\n .all<{ turnId: string }>()\n return results.map((r) => r.turnId)\n },\n }\n}\n\n/** In-memory store for tests and keyless local dev. */\nexport function createMemoryTurnEventStore(): TurnEventStore {\n const events = new Map<string, BufferedTurnEvent[]>()\n const status = new Map<string, TurnStatus>()\n const scopes = new Map<string, string>()\n const order: string[] = []\n return {\n async append(turnId, rows) {\n const list = events.get(turnId) ?? []\n list.push(...rows)\n events.set(turnId, list)\n },\n async read(turnId, fromSeq) {\n return (events.get(turnId) ?? []).filter((e) => e.seq > fromSeq)\n },\n async setStatus(turnId, s, scopeId) {\n status.set(turnId, s)\n if (scopeId) scopes.set(turnId, scopeId)\n if (!order.includes(turnId)) order.push(turnId)\n },\n async getStatus(turnId) {\n return status.get(turnId) ?? null\n },\n async listRunning(scopeId) {\n // Newest first, mirroring the D1 store's `ORDER BY updatedAt DESC`.\n return [...order].reverse().filter((t) => status.get(t) === 'running' && scopes.get(t) === scopeId)\n },\n }\n}\n"],"mappings":";AAgBO,SAAS,sBAAsB,OAA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UAAI,QAAS,QAAO,IAAI,QAAQ,OAAO;AACvC,UAAI,CAAC,MAAM,SAAS,MAAM,EAAG,OAAM,KAAK,MAAM;AAAA,IAChD;AAAA,IACA,MAAM,UAAU,QAAQ;AACtB,aAAO,OAAO,IAAI,MAAM,KAAK;AAAA,IAC/B;AAAA,IACA,MAAM,YAAY,SAAS;AAEzB,aAAO,CAAC,GAAG,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,OAAO,IAAI,CAAC,MAAM,aAAa,OAAO,IAAI,CAAC,MAAM,OAAO;AAAA,IACpG;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/teams/invite.ts"],"sourcesContent":["/**\n * Pure invite-token helpers — generation, shape validation, and expiry math.\n * No I/O: the members API persists/looks up tokens; these functions only\n * produce well-formed tokens and decide, given values the caller already\n * loaded, whether an invite is usable.\n *\n * A token is an opaque high-entropy URL-safe string. It is the bearer secret\n * in `/invite/:token`, so it must be unguessable and never derived from the\n * email or workspace. `generateInviteToken` uses Web Crypto (`crypto`), which\n * is present in Workers, Node 18+, Deno, and browsers — no Node-only import,\n * so this stays a pure leaf.\n */\n\nconst INVITE_TOKEN_BYTES = 24\nconst INVITE_TOKEN_PATTERN = /^[A-Za-z0-9_-]{16,}$/\n\n/** Cryptographically-random, URL-safe (base64url) invite token. */\nexport function generateInviteToken(): string {\n const bytes = new Uint8Array(INVITE_TOKEN_BYTES)\n crypto.getRandomValues(bytes)\n return base64UrlEncode(bytes)\n}\n\n/** True when `value` has the shape of an invite token (not whether it exists). */\nexport function isInviteTokenShape(value: unknown): value is string {\n return typeof value === 'string' && INVITE_TOKEN_PATTERN.test(value)\n}\n\n/** A pending invite row, narrowed to the fields invite acceptance reasons over. */\nexport interface InviteTokenState {\n /** null until accepted — a non-null value means the invite was already used. */\n acceptedAt: Date | number | null | undefined\n /** Email the invite was addressed to, if any. */\n inviteEmail?: string | null\n /** Optional hard expiry; omit/undefined for invites that never expire. */\n expiresAt?: Date | number | null\n}\n\nexport type InviteRejectionReason = 'already-accepted' | 'expired' | 'email-mismatch'\n\nexport interface InviteValidationResult {\n ok: boolean\n reason?: InviteRejectionReason\n}\n\n/**\n * Decide whether a loaded invite can be accepted by `acceptingEmail` at `now`.\n * Pure: the caller has already fetched the row by token; this only judges it.\n * Email match is case-insensitive and only enforced when the invite was\n * addressed to a specific email (an open invite has no `inviteEmail`).\n */\nexport function validateInviteToken(\n invite: InviteTokenState,\n opts: { acceptingEmail?: string | null; now?: Date } = {},\n): InviteValidationResult {\n if (invite.acceptedAt != null) return { ok: false, reason: 'already-accepted' }\n\n if (invite.expiresAt != null) {\n const now = (opts.now ?? new Date()).getTime()\n const expires = invite.expiresAt instanceof Date ? invite.expiresAt.getTime() : Number(invite.expiresAt)\n if (Number.isFinite(expires) && now >= expires) return { ok: false, reason: 'expired' }\n }\n\n if (invite.inviteEmail && opts.acceptingEmail) {\n if (invite.inviteEmail.trim().toLowerCase() !== opts.acceptingEmail.trim().toLowerCase()) {\n return { ok: false, reason: 'email-mismatch' }\n }\n }\n\n return { ok: true }\n}\n\nfunction base64UrlEncode(bytes: Uint8Array): string {\n let binary = ''\n for (const byte of bytes) binary += String.fromCharCode(byte)\n const base64 = typeof btoa === 'function' ? btoa(binary) : bufferToBase64(binary)\n return base64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '')\n}\n\nfunction bufferToBase64(binary: string): string {\n // Node without a global `btoa` (older runtimes); Buffer is always present there.\n return Buffer.from(binary, 'binary').toString('base64')\n}\n"],"mappings":";AAaA,IAAM,qBAAqB;AAC3B,IAAM,uBAAuB;AAGtB,SAAS,sBAA8B;AAC5C,QAAM,QAAQ,IAAI,WAAW,kBAAkB;AAC/C,SAAO,gBAAgB,KAAK;AAC5B,SAAO,gBAAgB,KAAK;AAC9B;AAGO,SAAS,mBAAmB,OAAiC;AAClE,SAAO,OAAO,UAAU,YAAY,qBAAqB,KAAK,KAAK;AACrE;AAyBO,SAAS,oBACd,QACA,OAAuD,CAAC,GAChC;AACxB,MAAI,OAAO,cAAc,KAAM,QAAO,EAAE,IAAI,OAAO,QAAQ,mBAAmB;AAE9E,MAAI,OAAO,aAAa,MAAM;AAC5B,UAAM,OAAO,KAAK,OAAO,oBAAI,KAAK,GAAG,QAAQ;AAC7C,UAAM,UAAU,OAAO,qBAAqB,OAAO,OAAO,UAAU,QAAQ,IAAI,OAAO,OAAO,SAAS;AACvG,QAAI,OAAO,SAAS,OAAO,KAAK,OAAO,QAAS,QAAO,EAAE,IAAI,OAAO,QAAQ,UAAU;AAAA,EACxF;AAEA,MAAI,OAAO,eAAe,KAAK,gBAAgB;AAC7C,QAAI,OAAO,YAAY,KAAK,EAAE,YAAY,MAAM,KAAK,eAAe,KAAK,EAAE,YAAY,GAAG;AACxF,aAAO,EAAE,IAAI,OAAO,QAAQ,iBAAiB;AAAA,IAC/C;AAAA,EACF;AAEA,SAAO,EAAE,IAAI,KAAK;AACpB;AAEA,SAAS,gBAAgB,OAA2B;AAClD,MAAI,SAAS;AACb,aAAW,QAAQ,MAAO,WAAU,OAAO,aAAa,IAAI;AAC5D,QAAM,SAAS,OAAO,SAAS,aAAa,KAAK,MAAM,IAAI,eAAe,MAAM;AAChF,SAAO,OAAO,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,EAAE;AACzE;AAEA,SAAS,eAAe,QAAwB;AAE9C,SAAO,OAAO,KAAK,QAAQ,QAAQ,EAAE,SAAS,QAAQ;AACxD;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/theme.ts"],"sourcesContent":["/**\n * Typed mirror of tokens.css for runtime/JS theming. The canonical source is\n * tokens.css (`import '@tangle-network/agent-app/styles'`); this module is for\n * apps that compute theme variables in JS, or read color values where CSS\n * custom properties cannot reach — notably Konva canvas render code, which\n * paints to a bitmap and cannot resolve `var(--…)`.\n *\n * Values are shadcn-style HSL channel triples (\"H S% L%\"); wrap with `color()`.\n */\n\nexport interface AgentAppTheme {\n background: string\n foreground: string\n card: string\n cardForeground: string\n popover: string\n popoverForeground: string\n primary: string\n primaryForeground: string\n secondary: string\n secondaryForeground: string\n muted: string\n mutedForeground: string\n accent: string\n accentForeground: string\n destructive: string\n destructiveForeground: string\n border: string\n input: string\n ring: string\n success: string\n successForeground: string\n warning: string\n warningForeground: string\n /** Full CSS color (not a triple) — the canvas/scene backdrop. */\n canvasBackdrop: string\n /** Konva render palette — full hex colors the bitmap canvas paints with\n * (it cannot resolve `var(--…)`). NOT emitted by themeToCssVars. */\n canvasRender: CanvasRenderPalette\n}\n\n/**\n * Colors the Konva design-canvas paints directly. Konva renders to a bitmap\n * and cannot read CSS custom properties, so these are full hex strings sourced\n * from the active theme and threaded through the canvas components.\n */\nexport interface CanvasRenderPalette {\n /** Grid line color (GridLayer). */\n grid: string\n /** Grid-snap guide line (SnapGuidesOverlay, kind 'grid'). */\n snapGrid: string\n /** Saved ruler-guide snap line (kind 'guide'). */\n snapGuide: string\n /** Page edge/center snap line (kinds 'page-edge'/'page-center'). */\n snapPage: string\n /** Element edge/center snap line (kinds 'element-edge'/'element-center'). */\n snapElement: string\n /** Transformer border + anchor stroke (SelectionLayer). */\n selectionStroke: string\n /** Transformer anchor fill (SelectionLayer). */\n selectionAnchorFill: string\n /** Video placeholder fill (ElementNode VideoNode). */\n placeholderFill: string\n /** Video placeholder stroke (ElementNode VideoNode). */\n placeholderStroke: string\n /** Broken/loading image placeholder fill (ElementNode ImageNode). */\n brokenFill: string\n /** Broken/loading image placeholder stroke (ElementNode ImageNode). */\n brokenStroke: string\n}\n\nexport const lightTheme: AgentAppTheme = {\n background: '0 0% 100%',\n foreground: '0 0% 5%',\n card: '240 7% 97%',\n cardForeground: '0 0% 5%',\n popover: '0 0% 100%',\n popoverForeground: '0 0% 5%',\n primary: '245 62% 57%',\n primaryForeground: '0 0% 100%',\n secondary: '240 6% 93%',\n secondaryForeground: '0 0% 10%',\n muted: '240 6% 93%',\n mutedForeground: '240 5% 38%',\n accent: '240 6% 93%',\n accentForeground: '0 0% 10%',\n destructive: '0 72% 41%',\n destructiveForeground: '0 0% 100%',\n border: '240 6% 89%',\n input: '240 6% 89%',\n ring: '245 62% 57%',\n success: '160 84% 26%',\n successForeground: '0 0% 100%',\n warning: '41 96% 38%',\n warningForeground: '38 92% 12%',\n canvasBackdrop: 'hsl(240 7% 90%)',\n canvasRender: {\n grid: '#c0c0c0',\n snapGrid: '#a0a0a0',\n snapGuide: '#3b82f6',\n snapPage: '#f59e0b',\n snapElement: '#f43f5e',\n selectionStroke: '#00a1ff',\n selectionAnchorFill: '#ffffff',\n placeholderFill: '#1f2937',\n placeholderStroke: '#374151',\n brokenFill: '#e5e7eb',\n brokenStroke: '#9ca3af',\n },\n}\n\nexport const darkTheme: AgentAppTheme = {\n background: '240 8% 5%',\n foreground: '240 6% 93%',\n card: '240 5% 8%',\n cardForeground: '240 6% 93%',\n popover: '240 4% 13%',\n popoverForeground: '240 6% 93%',\n primary: '239 84% 74%',\n primaryForeground: '0 0% 100%',\n secondary: '240 5% 11%',\n secondaryForeground: '240 6% 93%',\n muted: '240 5% 11%',\n mutedForeground: '240 4% 62%',\n accent: '240 5% 11%',\n accentForeground: '240 6% 93%',\n destructive: '348 90% 68%',\n destructiveForeground: '0 0% 12%',\n border: '240 3% 13%',\n input: '240 5% 11%',\n ring: '239 84% 74%',\n success: '160 70% 52%',\n successForeground: '160 84% 10%',\n warning: '40 94% 56%',\n warningForeground: '38 92% 12%',\n canvasBackdrop: 'hsl(240 8% 5%)',\n canvasRender: {\n grid: '#3a3a3a',\n snapGrid: '#5a5a5a',\n snapGuide: '#3b82f6',\n snapPage: '#f59e0b',\n snapElement: '#f43f5e',\n selectionStroke: '#00a1ff',\n selectionAnchorFill: '#e5e7eb',\n placeholderFill: '#2a2f3a',\n placeholderStroke: '#3f4654',\n brokenFill: '#262b33',\n brokenStroke: '#4b5563',\n },\n}\n\n/** Wrap a channel triple in `hsl()`; pass through values already in a color form. */\nexport function themeColor(value: string): string {\n return value.startsWith('hsl') || value.startsWith('#') || value.startsWith('rgb')\n ? value\n : `hsl(${value})`\n}\n\n/**\n * Map a theme to the full CSS-variable set (shadcn triples + canvas/sequences\n * aliases + canvas surface). Apply at runtime to scope a theme without loading\n * tokens.css: `Object.assign(el.style, themeToCssVars(darkTheme))`.\n */\nexport function themeToCssVars(theme: AgentAppTheme): Record<string, string> {\n return {\n '--background': theme.background,\n '--foreground': theme.foreground,\n '--card': theme.card,\n '--card-foreground': theme.cardForeground,\n '--popover': theme.popover,\n '--popover-foreground': theme.popoverForeground,\n '--primary': theme.primary,\n '--primary-foreground': theme.primaryForeground,\n '--secondary': theme.secondary,\n '--secondary-foreground': theme.secondaryForeground,\n '--muted': theme.muted,\n '--muted-foreground': theme.mutedForeground,\n '--accent': theme.accent,\n '--accent-foreground': theme.accentForeground,\n '--destructive': theme.destructive,\n '--destructive-foreground': theme.destructiveForeground,\n '--border': theme.border,\n '--input': theme.input,\n '--ring': theme.ring,\n '--success': theme.success,\n '--success-foreground': theme.successForeground,\n '--warning': theme.warning,\n '--warning-foreground': theme.warningForeground,\n '--bg-input': `hsl(${theme.card})`,\n '--text-primary': `hsl(${theme.foreground})`,\n '--text-secondary': `hsl(${theme.secondaryForeground})`,\n '--text-muted': `hsl(${theme.mutedForeground})`,\n '--text-danger': `hsl(${theme.destructive})`,\n '--border-default': `hsl(${theme.border})`,\n '--brand-primary': `hsl(${theme.primary})`,\n '--editor-selection-background': `hsl(${theme.primary})`,\n '--editor-selection-foreground': `hsl(${theme.background})`,\n '--canvas-backdrop': theme.canvasBackdrop,\n }\n}\n"],"mappings":";AAuEO,IAAM,aAA4B;AAAA,EACvC,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,SAAS;AAAA,EACT,mBAAmB;AAAA,E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sourcesContent":["/**\n * Drizzle-backed store over the tables from `createIntakeTables`. One store\n * builder per scope: `createUserIntakeStore` (keyed on userId) and\n * `createProjectIntakeStore` (keyed on workspaceId). Each returns the same\n * three-method surface — `get` / `save` / `complete` — so the api handlers and\n * the UI talk to one shape regardless of scope.\n *\n * Works against any SQLite drizzle driver (better-sqlite3, D1, libsql): the\n * builders are awaited, never `.run()`/`.all()`, so sync and async drivers\n * behave identically.\n *\n * Validation is fail-loud and pure (from the `./intakes` leaf). `save` runs\n * `validateAnswer` before writing, so an invalid answer can never enter the\n * payload; `complete` runs `payloadComplete` and refuses to stamp an\n * incomplete (or stale-graph) intake — it throws a typed `IntakeError` rather\n * than silently writing a half-finished onboarding state.\n *\n * `getProjectIntakeStore` pins `workspaceId` in every WHERE clause; RBAC runs\n * in the route before the store is built, but the scope key is enforced here\n * too, so a leaked id can never read or write across the boundary.\n *\n * Imports `drizzle-orm`, so this is a subpath, never re-exported from root.\n */\n\nimport { eq } from 'drizzle-orm'\nimport type { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core'\nimport {\n type IntakeAnswerValue,\n type IntakeGraph,\n getQuestion,\n validateAnswer,\n} from '../model'\nimport {\n type IntakePayload,\n emptyPayload,\n markComplete,\n payloadComplete,\n withAnswer,\n} from '../completion'\nimport type { ProjectIntakeTable, UserIntakeTable } from './schema'\n\n/** Any SQLite drizzle database — `any` erases driver-specific generics so\n * better-sqlite3, D1, and libsql handles all fit. */\nexport type IntakeDatabase = BaseSQLiteDatabase<'sync' | 'async', any, any>\n\n/** A loaded intake: the payload plus whether it is complete against the graph. */\nexport interface IntakeState {\n payload: IntakePayload\n completed: boolean\n completedAt: Date | null\n}\n\nexport type IntakeErrorCode = 'invalid-answer' | 'unknown-question' | 'incomplete' | 'stale-graph'\n\n/** Thrown by store mutations on a refused write — callers map it to a 4xx. */\nexport class IntakeError extends Error {\n readonly code: IntakeErrorCode\n constructor(code: IntakeErrorCode, message: string) {\n super(message)\n this.name = 'IntakeError'\n this.code = code\n }\n}\n\n/** The three-method store surface, identical for both scopes. */\nexport interface IntakeStore {\n /** Load the current intake, or seed an empty payload when none exists yet. */\n get(): Promise<IntakeState>\n /** Validate and persist one answer; returns the updated state. */\n save(questionId: string, value: IntakeAnswerValue): Promise<IntakeState>\n /** Stamp the intake complete; throws IntakeError when not yet completable. */\n complete(): Promise<IntakeState>\n}\n\ninterface IntakeTableShape {\n id: any\n graphId: any\n payload: any\n completedAt: any\n updatedAt: any\n}\n\ninterface ScopedStoreOptions {\n db: IntakeDatabase\n graph: IntakeGraph\n table: IntakeTableShape\n /** The scope column (userIntake.userId or projectIntake.workspaceId). */\n scopeColumn: any\n scopeValue: string\n /** Extra columns to set on insert (the scope key). */\n insertScope: Record<string, unknown>\n}\n\nfunction createScopedStore(opts: ScopedStoreOptions): IntakeStore {\n const { db, graph, table, scopeColumn, scopeValue, insertScope } = opts\n\n async function loadRow() {\n const [row] = await db\n .select()\n .from(table as any)\n .where(eq(scopeColumn, scopeValue))\n .limit(1)\n return (row ?? null) as\n | { id: string; graphId: string; payload: unknown; completedAt: Date | number | null }\n | null\n }\n\n function toState(\n row: { graphId: string; payload: unknown; completedAt: Date | number | null } | null,\n ): IntakeState {\n if (!row) {\n return { payload: emptyPayload(graph), completed: false, completedAt: null }\n }\n const payload = normalizePayload(row.payload, row.graphId)\n const completedAt = toDate(row.completedAt)\n return {\n payload,\n completed: completedAt != null && payloadComplete(graph, payload),\n completedAt,\n }\n }\n\n async function get(): Promise<IntakeState> {\n return toState(await loadRow())\n }\n\n async function upsertPayload(payload: IntakePayload, completedAt: Date | null) {\n const existing = await loadRow()\n if (existing) {\n await db\n .update(table as any)\n .set({ graphId: payload.graphId, payload, completedAt, updatedAt: new Date() })\n .where(eq(scopeColumn, scopeValue))\n return\n }\n await db.insert(table as any).values({\n ...insertScope,\n graphId: payload.graphId,\n payload,\n completedAt,\n })\n }\n\n async function save(questionId: string, value: IntakeAnswerValue): Promise<IntakeState> {\n const question = getQuestion(graph, questionId)\n if (!question) throw new IntakeError('unknown-question', `No question '${questionId}' in intake '${graph.id}'`)\n const validity = validateAnswer(question, value)\n if (!validity.ok) {\n throw new IntakeError('invalid-answer', `Answer to '${questionId}' rejected: ${validity.reason}`)\n }\n\n const current = await get()\n const next = withAnswer(current.payload, questionId, value)\n await upsertPayload(next, current.completedAt)\n return toState({ graphId: next.graphId, payload: next, completedAt: current.completedAt })\n }\n\n async function complete(): Promise<IntakeState> {\n const current = await get()\n if (current.payload.graphId !== graph.id) {\n throw new IntakeError('stale-graph', `Intake payload was collected against '${current.payload.graphId}', not '${graph.id}'`)\n }\n if (!payloadComplete(graph, current.payload)) {\n throw new IntakeError('incomplete', `Intake '${graph.id}' has unanswered required questions`)\n }\n const completedPayload = markComplete(current.payload)\n const completedAt = new Date(completedPayload.completedAt!)\n await upsertPayload(completedPayload, completedAt)\n return { payload: completedPayload, completed: true, completedAt }\n }\n\n return { get, save, complete }\n}\n\nexport interface CreateUserIntakeStoreOptions {\n db: IntakeDatabase\n /** The user-intake table from createIntakeTables. */\n table: UserIntakeTable\n /** The intake definition this store collects answers against. */\n graph: IntakeGraph\n /** The user whose onboarding this is. */\n userId: string\n}\n\n/** Build the per-user onboarding store, scoped to one userId. */\nexport function createUserIntakeStore(opts: CreateUserIntakeStoreOptions): IntakeStore {\n return createScopedStore({\n db: opts.db,\n graph: opts.graph,\n table: opts.table as unknown as IntakeTableShape,\n scopeColumn: opts.table.userId,\n scopeValue: opts.userId,\n insertScope: { userId: opts.userId },\n })\n}\n\nexport interface CreateProjectIntakeStoreOptions {\n db: IntakeDatabase\n /** The project-intake table from createIntakeTables (workspace scope). */\n table: ProjectIntakeTable\n graph: IntakeGraph\n /** The workspace this intake is attached to. */\n workspaceId: string\n}\n\n/** Build the per-project store, scoped to one workspaceId. */\nexport function createProjectIntakeStore(opts: CreateProjectIntakeStoreOptions): IntakeStore {\n return createScopedStore({\n db: opts.db,\n graph: opts.graph,\n table: opts.table as unknown as IntakeTableShape,\n scopeColumn: opts.table.workspaceId,\n scopeValue: opts.workspaceId,\n insertScope: { workspaceId: opts.workspaceId },\n })\n}\n\nfunction normalizePayload(raw: unknown, graphId: string): IntakePayload {\n if (raw && typeof raw === 'object' && 'answers' in (raw as Record<string, unknown>)) {\n const candidate = raw as Partial<IntakePayload>\n return {\n graphId: candidate.graphId ?? graphId,\n answers: candidate.answers ?? {},\n ...(candidate.completedAt ? { completedAt: candidate.completedAt } : {}),\n }\n }\n return { graphId, answers: {} }\n}\n\nfunction toDate(value: Date | number | null | undefined): Date | null {\n if (value == null) return null\n return value instanceof Date ? value : new Date(Number(value) * (Number(value) < 1e12 ? 1000 : 1))\n}\n"],"mappings":";;;;;;;;;;;;AAwBA,SAAS,UAAU;AA+BZ,IAAM,cAAN,cAA0B,MAAM;AAAA,EAC5B;AAAA,EACT,YAAY,MAAuB,SAAiB;AAClD,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;AA+BA,SAAS,kBAAkB,MAAuC;AAChE,QAAM,EAAE,IAAI,OAAO,OAAO,aAAa,YAAY,YAAY,IAAI;AAEnE,iBAAe,UAAU;AACvB,UAAM,CAAC,GAAG,IAAI,MAAM,GACjB,OAAO,EACP,KAAK,KAAY,EACjB,MAAM,GAAG,aAAa,UAAU,CAAC,EACjC,MAAM,CAAC;AACV,WAAQ,OAAO;AAAA,EAGjB;AAEA,WAAS,QACP,KACa;AACb,QAAI,CAAC,KAAK;AACR,aAAO,EAAE,SAAS,aAAa,KAAK,GAAG,WAAW,OAAO,aAAa,KAAK;AAAA,IAC7E;AACA,UAAM,UAAU,iBAAiB,IAAI,SAAS,IAAI,OAAO;AACzD,UAAM,cAAc,OAAO,IAAI,WAAW;AAC1C,WAAO;AAAA,MACL;AAAA,MACA,WAAW,eAAe,QAAQ,gBAAgB,OAAO,OAAO;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAEA,iBAAe,MAA4B;AACzC,WAAO,QAAQ,MAAM,QAAQ,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